From 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:20:39 +0200 Subject: Merging upstream version 1.70.0+dfsg1. Signed-off-by: Daniel Baumann --- tests/assembly/asm/global_asm.rs | 4 +- tests/assembly/asm/m68k-types.rs | 83 ++ tests/assembly/is_aligned.rs | 1 + tests/assembly/static-relocation-model.rs | 1 + tests/assembly/strict_provenance.rs | 1 + tests/assembly/x86_64-floating-point-clamp.rs | 1 + ...x86_64-fortanix-unknown-sgx-lvi-generic-load.rs | 2 +- ..._64-fortanix-unknown-sgx-lvi-inline-assembly.rs | 17 +- tests/assembly/x86_64-no-jump-tables.rs | 1 + .../polymorphization/auxiliary/poly-dep.rs | 4 + .../codegen-units/polymorphization/poly-foreign.rs | 11 + tests/codegen/abi-main-signature-16bit-c-int.rs | 1 - tests/codegen/adjustments.rs | 2 +- tests/codegen/array-map.rs | 6 +- tests/codegen/auxiliary/static_dllimport_aux.rs | 13 - tests/codegen/comparison-operators-2-tuple.rs | 121 +++ tests/codegen/consts.rs | 2 +- tests/codegen/debug-limited.rs | 27 + tests/codegen/debug-line-directives-only.rs | 27 + tests/codegen/debug-line-tables-only.rs | 27 + tests/codegen/enum-match.rs | 7 +- tests/codegen/fewer-names.rs | 4 +- tests/codegen/global_asm.rs | 27 +- tests/codegen/global_asm_include.rs | 27 +- tests/codegen/global_asm_x2.rs | 27 +- tests/codegen/inherit_overflow.rs | 2 +- tests/codegen/inline-function-args-debug-info.rs | 20 + tests/codegen/intrinsics/transmute-x64.rs | 35 + tests/codegen/intrinsics/transmute.rs | 431 ++++++++++ .../issue-103285-ptr-addr-overflow-check.rs | 16 - tests/codegen/issue-103840.rs | 9 - tests/codegen/issue-105386-ub-in-debuginfo.rs | 22 - tests/codegen/issue-13018.rs | 11 - tests/codegen/issue-15953.rs | 29 - tests/codegen/issue-27130.rs | 21 - tests/codegen/issue-32031.rs | 23 - tests/codegen/issue-32364.rs | 18 - tests/codegen/issue-34634.rs | 16 - tests/codegen/issue-34947-pow-i32.rs | 13 - tests/codegen/issue-37945.rs | 38 - tests/codegen/issue-44056-macos-tls-align.rs | 28 - tests/codegen/issue-45222.rs | 63 -- tests/codegen/issue-45466.rs | 15 - .../codegen/issue-45964-bounds-check-slice-pos.rs | 39 - tests/codegen/issue-47278.rs | 9 - tests/codegen/issue-47442.rs | 22 - tests/codegen/issue-56267-2.rs | 18 - tests/codegen/issue-56267.rs | 18 - tests/codegen/issue-56927.rs | 43 - tests/codegen/issue-58881.rs | 21 - tests/codegen/issue-59352.rs | 18 - tests/codegen/issue-69101-bounds-check.rs | 44 - tests/codegen/issue-73031.rs | 26 - tests/codegen/issue-73338-effecient-cmp.rs | 39 - .../issue-73396-bounds-check-after-position.rs | 77 -- .../issue-73827-bounds-check-index-in-subexpr.rs | 17 - tests/codegen/issue-75525-bounds-checks.rs | 26 - tests/codegen/issue-75546.rs | 15 - tests/codegen/issue-75659.rs | 63 -- tests/codegen/issue-77812.rs | 32 - .../issue-81408-dllimport-thinlto-windows.rs | 15 - tests/codegen/issue-84268.rs | 23 - tests/codegen/issue-85872-multiple-reverse.rs | 20 - tests/codegen/issue-86106.rs | 62 -- tests/codegen/issue-96274.rs | 17 - tests/codegen/issue-96497-slice-size-nowrap.rs | 29 - .../codegen/issue-98156-const-arg-temp-lifetime.rs | 27 - .../issue-98294-get-mut-copy-from-slice-opt.rs | 19 - .../issues/auxiliary/static_dllimport_aux.rs | 13 + tests/codegen/issues/issue-101048.rs | 13 + tests/codegen/issues/issue-101082.rs | 17 + tests/codegen/issues/issue-101814.rs | 20 + tests/codegen/issues/issue-103132.rs | 16 + .../issues/issue-103285-ptr-addr-overflow-check.rs | 16 + tests/codegen/issues/issue-103327.rs | 18 + tests/codegen/issues/issue-103840.rs | 9 + .../codegen/issues/issue-105386-ub-in-debuginfo.rs | 22 + tests/codegen/issues/issue-106369.rs | 15 + tests/codegen/issues/issue-13018.rs | 11 + tests/codegen/issues/issue-15953.rs | 29 + tests/codegen/issues/issue-27130.rs | 21 + tests/codegen/issues/issue-32031.rs | 23 + tests/codegen/issues/issue-32364.rs | 18 + tests/codegen/issues/issue-34634.rs | 16 + tests/codegen/issues/issue-34947-pow-i32.rs | 13 + tests/codegen/issues/issue-37945.rs | 35 + .../codegen/issues/issue-44056-macos-tls-align.rs | 28 + tests/codegen/issues/issue-45222.rs | 63 ++ tests/codegen/issues/issue-45466.rs | 15 + .../issues/issue-45964-bounds-check-slice-pos.rs | 39 + tests/codegen/issues/issue-47278.rs | 9 + tests/codegen/issues/issue-47442.rs | 22 + tests/codegen/issues/issue-56267-2.rs | 18 + tests/codegen/issues/issue-56267.rs | 18 + tests/codegen/issues/issue-56927.rs | 43 + tests/codegen/issues/issue-58881.rs | 21 + tests/codegen/issues/issue-59352.rs | 18 + tests/codegen/issues/issue-69101-bounds-check.rs | 44 + tests/codegen/issues/issue-73031.rs | 26 + tests/codegen/issues/issue-73258.rs | 38 + tests/codegen/issues/issue-73338-effecient-cmp.rs | 39 + .../issue-73396-bounds-check-after-position.rs | 77 ++ .../issue-73827-bounds-check-index-in-subexpr.rs | 17 + tests/codegen/issues/issue-75525-bounds-checks.rs | 26 + tests/codegen/issues/issue-75546.rs | 15 + tests/codegen/issues/issue-75659.rs | 63 ++ tests/codegen/issues/issue-75978.rs | 19 + tests/codegen/issues/issue-77812.rs | 32 + .../issue-81408-dllimport-thinlto-windows.rs | 15 + tests/codegen/issues/issue-84268.rs | 23 + .../codegen/issues/issue-85872-multiple-reverse.rs | 20 + tests/codegen/issues/issue-86106.rs | 62 ++ tests/codegen/issues/issue-96274.rs | 17 + .../issues/issue-96497-slice-size-nowrap.rs | 29 + .../issues/issue-98156-const-arg-temp-lifetime.rs | 27 + .../issue-98294-get-mut-copy-from-slice-opt.rs | 19 + tests/codegen/issues/issue-99960.rs | 15 + tests/codegen/mem-replace-big-type.rs | 36 + tests/codegen/mem-replace-direct-memcpy.rs | 21 +- tests/codegen/optimize-attr-1.rs | 3 - tests/codegen/option-as-slice.rs | 18 +- tests/codegen/ptr-read-metadata.rs | 96 +++ tests/codegen/remap_path_prefix/main.rs | 2 +- tests/codegen/repr-transparent-aggregates-2.rs | 1 - .../simd-intrinsic-transmute-array.rs | 51 +- tests/codegen/simd-wide-sum.rs | 2 +- tests/codegen/slice-indexing.rs | 35 + tests/codegen/transmute-scalar.rs | 65 +- tests/codegen/var-names.rs | 4 +- tests/codegen/vec-as-ptr.rs | 19 + tests/codegen/vec-in-place.rs | 42 +- tests/codegen/vec-shrink-panik.rs | 23 +- tests/codegen/virtual-function-elimination.rs | 5 +- tests/debuginfo/function-names.rs | 4 +- tests/debuginfo/type-names.rs | 1 - .../auxiliary/circular-dependencies-aux.rs | 10 + tests/incremental/circular-dependencies.rs | 37 + tests/incremental/hashes/let_expressions.rs | 4 +- tests/incremental/issue-108481-feed-eval-always.rs | 16 + ...dress_of_reborrow.SimplifyCfg-initial.after.mir | 60 +- ...rary.main.SimplifyCfg-elaborate-drops.after.mir | 2 +- tests/mir-opt/array_index_is_temporary.rs | 1 + ..._panic_abort.main.AbortUnwindingCalls.after.mir | 6 +- .../basic_assignment.main.ElaborateDrops.diff | 89 ++ ...c_assignment.main.SimplifyCfg-initial.after.mir | 32 +- tests/mir-opt/basic_assignment.rs | 2 + .../box_expr.main.ElaborateDrops.before.mir | 64 +- tests/mir-opt/box_expr.rs | 9 +- ...sync_await.b-{closure#0}.generator_resume.0.mir | 54 +- .../custom/aggregate_exprs.adt.built.after.mir | 16 + .../custom/aggregate_exprs.array.built.after.mir | 15 + tests/mir-opt/building/custom/aggregate_exprs.rs | 71 ++ .../custom/aggregate_exprs.tuple.built.after.mir | 10 + .../custom/as_cast.float_to_int.built.after.mir | 10 + .../custom/as_cast.int_to_int.built.after.mir | 10 + .../custom/as_cast.int_to_ptr.built.after.mir | 10 + tests/mir-opt/building/custom/as_cast.rs | 43 + tests/mir-opt/building/custom/composite_return.rs | 21 + .../custom/composite_return.tuple.built.after.mir | 11 + .../references.raw_pointer_offset.built.after.mir | 10 + tests/mir-opt/building/custom/references.rs | 11 + .../custom/terminators.drop_first.built.after.mir | 5 +- tests/mir-opt/building/custom/terminators.rs | 3 +- .../building/enum_cast.droppy.built.after.mir | 2 +- .../building/issue_101867.main.built.after.mir | 4 +- .../building/issue_49232.main.built.after.mir | 2 +- ...h_false_edges.full_tested_match.built.after.mir | 1 + ..._false_edges.full_tested_match2.built.after.mir | 1 + .../match_false_edges.main.built.after.mir | 1 + .../receiver_ptr_mutability.main.built.after.mir | 8 +- tests/mir-opt/building/shifts.rs | 20 + .../building/shifts.shift_signed.built.after.mir | 147 ++++ .../building/shifts.shift_unsigned.built.after.mir | 135 +++ ...y_move_out.move_out_by_subslice.built.after.mir | 103 +-- ...rray_move_out.move_out_from_end.built.after.mir | 103 +-- tests/mir-opt/building/uniform_array_move_out.rs | 16 +- tests/mir-opt/combine_array_len.rs | 1 + ...e_of_primitives.{impl#0}-clone.InstCombine.diff | 2 +- ...bine_transmutes.adt_transmutes.InstCombine.diff | 158 ++++ ...transmutes.identity_transmutes.InstCombine.diff | 43 + ..._transmutes.integer_transmutes.InstCombine.diff | 24 + tests/mir-opt/combine_transmutes.rs | 65 ++ ...omoted[0].SimplifyCfg-elaborate-drops.after.mir | 6 +- ...t_promotion_extern_static.FOO.PromoteTemps.diff | 6 +- .../const_prop/aggregate.main.ConstProp.diff | 2 +- .../const_prop/aggregate.main.PreCodegen.after.mir | 2 +- tests/mir-opt/const_prop/aggregate.rs | 1 + tests/mir-opt/const_prop/array_index.rs | 1 + tests/mir-opt/const_prop/bad_op_div_by_zero.rs | 1 + .../bad_op_mod_by_zero.main.ConstProp.diff | 8 +- tests/mir-opt/const_prop/bad_op_mod_by_zero.rs | 1 + ...unsafe_oob_for_slices.main.ConstProp.32bit.diff | 2 +- ...unsafe_oob_for_slices.main.ConstProp.64bit.diff | 2 +- .../const_prop/bad_op_unsafe_oob_for_slices.rs | 1 + tests/mir-opt/const_prop/boxes.main.ConstProp.diff | 64 +- tests/mir-opt/const_prop/boxes.rs | 8 +- tests/mir-opt/const_prop/checked_add.rs | 1 + ...const_prop_fails_gracefully.main.ConstProp.diff | 4 +- .../const_prop/const_prop_fails_gracefully.rs | 1 + ...ontrol_flow_simplification.hello.ConstProp.diff | 1 - .../const_prop/control_flow_simplification.rs | 1 + .../discriminant.main.ConstProp.32bit.diff | 2 +- .../discriminant.main.ConstProp.64bit.diff | 2 +- tests/mir-opt/const_prop/indirect.rs | 1 + .../inherit_overflow.main.ConstProp.diff | 2 +- tests/mir-opt/const_prop/inherit_overflow.rs | 1 + .../invalid_constant.main.ConstProp.diff | 14 +- .../invalid_constant.main.RemoveZsts.diff | 76 ++ tests/mir-opt/const_prop/invalid_constant.rs | 1 + .../const_prop/issue_66971.main.ConstProp.diff | 9 +- tests/mir-opt/const_prop/issue_66971.rs | 1 + .../const_prop/issue_67019.main.ConstProp.diff | 4 +- tests/mir-opt/const_prop/issue_67019.rs | 1 + tests/mir-opt/const_prop/large_array_index.rs | 1 + ...able_aggregate_partial_read.main.ConstProp.diff | 2 +- .../mutable_variable_aggregate_partial_read.rs | 1 + ...able_variable_unprop_assign.main.ConstProp.diff | 2 +- .../const_prop/mutable_variable_unprop_assign.rs | 1 + .../mir-opt/const_prop/optimizes_into_variable.rs | 1 + tests/mir-opt/const_prop/repeat.rs | 1 + tests/mir-opt/const_prop/return_place.rs | 1 + .../scalar_literal_propagation.main.ConstProp.diff | 4 +- .../const_prop/scalar_literal_propagation.rs | 1 + .../const_prop/slice_len.main.ConstProp.32bit.diff | 2 +- .../const_prop/slice_len.main.ConstProp.64bit.diff | 2 +- tests/mir-opt/const_prop/slice_len.rs | 1 + .../const_prop/switch_int.main.ConstProp.diff | 4 +- ...in.SimplifyConstCondition-after-const-prop.diff | 4 +- tests/mir-opt/const_prop/switch_int.rs | 1 + .../const_prop/transmute.from_char.ConstProp.diff | 15 + .../transmute.invalid_bool.ConstProp.diff | 14 + .../transmute.invalid_char.ConstProp.diff | 14 + .../const_prop/transmute.less_as_i8.ConstProp.diff | 23 + tests/mir-opt/const_prop/transmute.rs | 61 ++ ...transmute.undef_union_as_integer.ConstProp.diff | 22 + .../transmute.unreachable_box.ConstProp.diff | 23 + .../transmute.unreachable_direct.ConstProp.diff | 25 + .../transmute.unreachable_mut.ConstProp.diff | 27 + .../transmute.unreachable_ref.ConstProp.diff | 23 + .../const_prop/transmute.valid_char.ConstProp.diff | 15 + .../tuple_literal_propagation.main.ConstProp.diff | 4 +- .../const_prop/tuple_literal_propagation.rs | 1 + .../copy-prop/borrowed_local.f.CopyProp.diff | 4 +- tests/mir-opt/copy-prop/borrowed_local.rs | 1 + tests/mir-opt/copy-prop/branch.foo.CopyProp.diff | 6 +- tests/mir-opt/copy-prop/branch.rs | 1 + .../copy_propagation_arg.bar.CopyProp.diff | 2 +- .../copy_propagation_arg.foo.CopyProp.diff | 2 +- tests/mir-opt/copy-prop/copy_propagation_arg.rs | 1 + .../copy-prop/custom_move_arg.f.CopyProp.diff | 4 +- tests/mir-opt/copy-prop/custom_move_arg.rs | 1 + tests/mir-opt/copy-prop/cycle.main.CopyProp.diff | 4 +- tests/mir-opt/copy-prop/cycle.rs | 1 + .../dead_stores_79191.f.CopyProp.after.mir | 2 +- tests/mir-opt/copy-prop/dead_stores_79191.rs | 1 + .../dead_stores_better.f.CopyProp.after.mir | 2 +- tests/mir-opt/copy-prop/dead_stores_better.rs | 1 + .../copy-prop/issue_107511.main.CopyProp.diff | 6 +- tests/mir-opt/copy-prop/issue_107511.rs | 1 + tests/mir-opt/copy-prop/move_arg.f.CopyProp.diff | 2 +- tests/mir-opt/copy-prop/move_arg.rs | 1 + .../copy-prop/move_projection.f.CopyProp.diff | 4 +- tests/mir-opt/copy-prop/move_projection.rs | 1 + .../copy-prop/reborrow.demiraw.CopyProp.diff | 56 ++ .../mir-opt/copy-prop/reborrow.miraw.CopyProp.diff | 52 ++ .../mir-opt/copy-prop/reborrow.remut.CopyProp.diff | 50 ++ .../mir-opt/copy-prop/reborrow.reraw.CopyProp.diff | 50 ++ tests/mir-opt/copy-prop/reborrow.rs | 47 ++ tests/mir-opt/dataflow-const-prop/checked.rs | 1 + .../inherit_overflow.main.DataflowConstProp.diff | 2 +- .../dataflow-const-prop/inherit_overflow.rs | 1 + .../ref_without_sb.main.DataflowConstProp.diff | 4 +- .../mir-opt/dataflow-const-prop/ref_without_sb.rs | 1 + .../sibling_ptr.main.DataflowConstProp.diff | 2 +- tests/mir-opt/dataflow-const-prop/sibling_ptr.rs | 1 + .../terminator.main.DataflowConstProp.diff | 2 +- tests/mir-opt/dataflow-const-prop/terminator.rs | 1 + .../cycle.cycle.DeadStoreElimination.diff | 2 +- tests/mir-opt/dead-store-elimination/cycle.rs | 1 + ...ks.is_line_doc_comment_2.DeduplicateBlocks.diff | 2 +- tests/mir-opt/deduplicate_blocks.rs | 1 + .../deref-patterns/string.foo.PreCodegen.after.mir | 8 +- .../mir-opt/derefer_inline_test.main.Derefer.diff | 50 +- tests/mir-opt/derefer_inline_test.rs | 5 +- .../branch.foo.DestinationPropagation.diff | 6 +- tests/mir-opt/dest-prop/branch.rs | 1 + ...propagation_arg.bar.DestinationPropagation.diff | 2 +- ...propagation_arg.foo.DestinationPropagation.diff | 2 +- tests/mir-opt/dest-prop/copy_propagation_arg.rs | 1 + .../cycle.main.DestinationPropagation.diff | 4 +- tests/mir-opt/dest-prop/cycle.rs | 1 + ...stores_79191.f.DestinationPropagation.after.mir | 2 +- tests/mir-opt/dest-prop/dead_stores_79191.rs | 1 + ...tores_better.f.DestinationPropagation.after.mir | 2 +- tests/mir-opt/dest-prop/dead_stores_better.rs | 1 + tests/mir-opt/dest-prop/simple.rs | 1 + .../union.main.DestinationPropagation.diff | 4 +- tests/mir-opt/dest-prop/union.rs | 1 + .../unreachable.f.DestinationPropagation.diff | 4 +- tests/mir-opt/dest-prop/unreachable.rs | 1 + ...iv_overflow.const_dividend.PreCodegen.after.mir | 17 - ...div_overflow.const_divisor.PreCodegen.after.mir | 11 - tests/mir-opt/div_overflow.rs | 18 - .../dont_yeet_assert.generic.InstCombine.diff | 2 +- ...arms.float_to_exponential_common.ConstProp.diff | 12 +- tests/mir-opt/funky_arms.rs | 1 + ...wind.main-{closure#0}.StateTransform.before.mir | 4 +- ...or_tiny.main-{closure#0}.generator_resume.0.mir | 2 +- tests/mir-opt/inline/asm_unwind.main.Inline.diff | 18 +- tests/mir-opt/inline/cycle.f.Inline.diff | 2 +- tests/mir-opt/inline/cycle.g.Inline.diff | 11 +- tests/mir-opt/inline/cycle.main.Inline.diff | 11 +- .../mir-opt/inline/dyn_trait.get_query.Inline.diff | 24 +- .../mir-opt/inline/dyn_trait.mk_cycle.Inline.diff | 2 +- tests/mir-opt/inline/dyn_trait.rs | 1 + .../inline/dyn_trait.try_execute_query.Inline.diff | 10 +- .../inline/exponential_runtime.main.Inline.diff | 74 +- tests/mir-opt/inline/exponential_runtime.rs | 1 + .../inline/inline_closure.foo.Inline.after.mir | 2 +- ...inline_closure_borrows_arg.foo.Inline.after.mir | 2 +- .../inline_closure_captures.foo.Inline.after.mir | 2 +- tests/mir-opt/inline/inline_cycle.one.Inline.diff | 12 +- tests/mir-opt/inline/inline_cycle.rs | 1 + tests/mir-opt/inline/inline_cycle.two.Inline.diff | 23 +- .../inline/inline_cycle_generic.main.Inline.diff | 17 +- tests/mir-opt/inline/inline_cycle_generic.rs | 1 + .../mir-opt/inline/inline_diverging.g.Inline.diff | 2 +- .../mir-opt/inline/inline_diverging.h.Inline.diff | 40 +- .../inline/inline_generator.main.Inline.diff | 2 +- .../inline_instruction_set.default.Inline.diff | 10 +- .../inline/inline_instruction_set.t32.Inline.diff | 10 +- .../inline/inline_into_box_place.main.Inline.diff | 111 ++- tests/mir-opt/inline/inline_into_box_place.rs | 4 +- .../inline/inline_options.main.Inline.after.mir | 44 +- tests/mir-opt/inline/inline_options.rs | 1 + .../inline/inline_specialization.main.Inline.diff | 6 +- tests/mir-opt/inline/inline_specialization.rs | 1 + tests/mir-opt/inline/inline_trait_method.rs | 1 + .../inline_trait_method.test.Inline.after.mir | 2 +- tests/mir-opt/inline/inline_trait_method_2.rs | 1 + .../inline_trait_method_2.test2.Inline.after.mir | 8 +- .../mir-opt/inline/issue_106141.outer.Inline.diff | 38 +- tests/mir-opt/inline/issue_106141.rs | 1 + ...7_inline_scopes_parenting.main.Inline.after.mir | 9 +- tests/mir-opt/inline/issue_78442.bar.Inline.diff | 4 +- .../mir-opt/inline/issue_78442.bar.RevealAll.diff | 2 +- tests/mir-opt/inline/unchecked_shifts.rs | 18 + ...ifts.unchecked_shl_unsigned_smaller.Inline.diff | 144 ++++ ...ecked_shl_unsigned_smaller.PreCodegen.after.mir | 130 +++ ...shifts.unchecked_shr_signed_smaller.Inline.diff | 144 ++++ ...checked_shr_signed_smaller.PreCodegen.after.mir | 130 +++ tests/mir-opt/inline/unwrap_unchecked.rs | 11 + .../unwrap_unchecked.unwrap_unchecked.Inline.diff | 55 ++ ...unchecked.unwrap_unchecked.PreCodegen.after.mir | 41 + ...ate_switch_targets.assert_zero.InstCombine.diff | 21 + .../instcombine_duplicate_switch_targets.rs | 27 + ...nstrument_coverage.main.InstrumentCoverage.diff | 2 +- .../intrinsic_asserts.generic.InstCombine.diff | 18 +- .../intrinsic_asserts.panics.InstCombine.diff | 24 +- .../intrinsic_asserts.removable.InstCombine.diff | 18 +- tests/mir-opt/issue_101973.inner.ConstProp.diff | 66 +- tests/mir-opt/issue_101973.rs | 1 + ...e_intrinsics.main.AbortUnwindingCalls.after.mir | 25 + .../mir-opt/issue_104451_unwindable_intrinsics.rs | 14 + .../issue_38669.main.SimplifyCfg-initial.after.mir | 2 +- tests/mir-opt/issue_41110.main.ElaborateDrops.diff | 8 +- tests/mir-opt/issue_41110.test.ElaborateDrops.diff | 52 +- tests/mir-opt/issue_41888.main.ElaborateDrops.diff | 91 +- tests/mir-opt/issue_62289.rs | 7 +- .../issue_62289.test.ElaborateDrops.before.mir | 118 +-- tests/mir-opt/issue_72181.main.built.after.mir | 2 + tests/mir-opt/issue_72181_1.main.built.after.mir | 4 +- tests/mir-opt/issue_76432.rs | 1 + ...ssue_76432.test.SimplifyComparisonIntegral.diff | 1 - tests/mir-opt/issue_91633.bar.built.after.mir | 3 +- tests/mir-opt/issue_91633.foo.built.after.mir | 2 +- tests/mir-opt/issue_91633.hey.built.after.mir | 1 + tests/mir-opt/issue_99325.main.built.after.mir | 4 +- .../issue_59352.num_to_digit.PreCodegen.after.mir | 7 +- tests/mir-opt/issues/issue_59352.rs | 1 + .../issue_75439.foo.MatchBranchSimplification.diff | 48 +- ..._test.main.SimplifyCfg-promote-consts.after.mir | 2 +- tests/mir-opt/lower_array_len.rs | 1 + .../lower_intrinsics.align_of.LowerIntrinsics.diff | 2 +- .../lower_intrinsics.assume.LowerIntrinsics.diff | 4 +- ...er_intrinsics.discriminant.LowerIntrinsics.diff | 22 +- ...sics.f_copy_nonoverlapping.LowerIntrinsics.diff | 4 +- .../lower_intrinsics.forget.LowerIntrinsics.diff | 2 +- ...lower_intrinsics.non_const.LowerIntrinsics.diff | 2 +- ..._intrinsics.option_payload.LowerIntrinsics.diff | 54 ++ ...cs.read_via_copy_primitive.LowerIntrinsics.diff | 27 + ....read_via_copy_uninhabited.LowerIntrinsics.diff | 21 + tests/mir-opt/lower_intrinsics.rs | 57 +- .../lower_intrinsics.size_of.LowerIntrinsics.diff | 2 +- ...insics.transmute_inhabited.LowerIntrinsics.diff | 27 + ...trinsics.transmute_ref_dst.LowerIntrinsics.diff | 27 + ...ansmute_to_box_uninhabited.LowerIntrinsics.diff | 29 + ...ansmute_to_mut_uninhabited.LowerIntrinsics.diff | 29 + ...ansmute_to_ref_uninhabited.LowerIntrinsics.diff | 29 + ...sics.transmute_uninhabited.LowerIntrinsics.diff | 22 + ...wer_intrinsics.unreachable.LowerIntrinsics.diff | 2 +- ...r_intrinsics.with_overflow.LowerIntrinsics.diff | 12 +- .../lower_intrinsics.wrapping.LowerIntrinsics.diff | 6 +- ...lower_intrinsics_e2e.f_u64.PreCodegen.after.mir | 4 +- ...ower_intrinsics_e2e.f_unit.PreCodegen.after.mir | 11 +- .../lower_slice_len.bound.LowerSliceLenCalls.diff | 2 +- tests/mir-opt/lower_slice_len.rs | 1 + ...lifyCfg-initial.after-ElaborateDrops.after.diff | 2 +- ..._drop_after_call.main.ElaborateDrops.before.mir | 2 +- tests/mir-opt/nrvo_simple.rs | 1 + ...gned.main.SimplifyCfg-elaborate-drops.after.mir | 18 +- ..._storage_markers.main.RemoveStorageMarkers.diff | 4 +- tests/mir-opt/remove_storage_markers.rs | 1 + ...ops.cannot_opt_generic.RemoveUnneededDrops.diff | 4 +- ...nneeded_drops.dont_opt.RemoveUnneededDrops.diff | 4 +- ...ove_unneeded_drops.opt.RemoveUnneededDrops.diff | 4 +- ...drops.opt_generic_copy.RemoveUnneededDrops.diff | 4 +- .../remove_zsts.get_union.PreCodegen.after.mir | 5 +- .../mir-opt/remove_zsts.get_union.RemoveZsts.diff | 9 +- ...etag.main.SimplifyCfg-elaborate-drops.after.mir | 6 +- ..._const_switch.identity.SeparateConstSwitch.diff | 8 +- ...nst_switch.too_complex.SeparateConstSwitch.diff | 12 +- ...imple_option_map_e2e.ezmap.PreCodegen.after.mir | 37 +- .../simplify_cfg.main.SimplifyCfg-initial.diff | 4 +- ...mplifyCfg-after-uninhabited-enum-branching.diff | 25 + .../simplify_duplicate_unreachable_blocks.rs | 30 + ...in.SimplifyConstCondition-after-const-prop.diff | 4 +- tests/mir-opt/simplify_if.rs | 1 + tests/mir-opt/simplify_locals_fixedpoint.rs | 1 + ...nsts.main.SimplifyLocals-before-const-prop.diff | 4 +- .../simplify_locals_removes_unused_consts.rs | 1 + tests/mir-opt/simplify_match.main.ConstProp.diff | 2 +- tests/mir-opt/simplify_match.rs | 1 + ...lace.[String].AddMovesForPackedDrops.before.mir | 80 +- ...roa.constant.ScalarReplacementOfAggregates.diff | 46 -- .../sroa.copies.ScalarReplacementOfAggregates.diff | 91 -- ...roa.dropping.ScalarReplacementOfAggregates.diff | 44 - .../sroa.enums.ScalarReplacementOfAggregates.diff | 43 - ...roa.escaping.ScalarReplacementOfAggregates.diff | 44 - .../sroa.flat.ScalarReplacementOfAggregates.diff | 80 -- ...a.ref_copies.ScalarReplacementOfAggregates.diff | 56 -- tests/mir-opt/sroa.rs | 122 --- ...sroa.structs.ScalarReplacementOfAggregates.diff | 33 - .../sroa.unions.ScalarReplacementOfAggregates.diff | 23 - ...ifetimes.foo.ScalarReplacementOfAggregates.diff | 214 +++++ tests/mir-opt/sroa/lifetimes.rs | 37 + ...cts.constant.ScalarReplacementOfAggregates.diff | 46 ++ ...ructs.copies.ScalarReplacementOfAggregates.diff | 91 ++ ...cts.dropping.ScalarReplacementOfAggregates.diff | 44 + ...tructs.enums.ScalarReplacementOfAggregates.diff | 43 + ...cts.escaping.ScalarReplacementOfAggregates.diff | 44 + ...structs.flat.ScalarReplacementOfAggregates.diff | 80 ++ ...s.ref_copies.ScalarReplacementOfAggregates.diff | 56 ++ tests/mir-opt/sroa/structs.rs | 122 +++ ...ucts.structs.ScalarReplacementOfAggregates.diff | 33 + ...ructs.unions.ScalarReplacementOfAggregates.diff | 23 + .../try_identity_e2e.new.PreCodegen.after.mir | 20 +- ...yCfg-after-uninhabited-enum-branching.after.mir | 12 +- ...um_branching.main.UninhabitedEnumBranching.diff | 12 +- ...yCfg-after-uninhabited-enum-branching.after.mir | 12 +- ...m_branching2.main.UninhabitedEnumBranching.diff | 22 +- .../unreachable.main.UnreachablePropagation.diff | 2 +- tests/mir-opt/unreachable.rs | 1 + ...able_diverging.main.UnreachablePropagation.diff | 4 +- tests/mir-opt/unreachable_diverging.rs | 1 + ...lace.Vec_i32_.AddMovesForPackedDrops.before.mir | 2 +- tests/mir-opt/while_storage.rs | 1 + .../while_storage.while_loop.PreCodegen.after.mir | 4 +- tests/pretty/ast-stmt-expr-attr.rs | 1 - tests/pretty/issue-4264.pp | 10 +- tests/pretty/stmt_expr_attributes.rs | 2 - tests/pretty/tests-are-sorted.pp | 22 +- tests/pretty/tests-are-sorted.rs | 3 +- .../run-make-fulldeps/a-b-a-linker-guard/Makefile | 15 - tests/run-make-fulldeps/a-b-a-linker-guard/a.rs | 8 - tests/run-make-fulldeps/a-b-a-linker-guard/b.rs | 7 - .../alloc-no-oom-handling/Makefile | 4 - tests/run-make-fulldeps/alloc-no-rc/Makefile | 4 - tests/run-make-fulldeps/alloc-no-sync/Makefile | 4 - .../allow-non-lint-warnings-cmdline/Makefile | 11 - .../allow-non-lint-warnings-cmdline/foo.rs | 5 - .../allow-warnings-cmdline-stability/Makefile | 15 - .../allow-warnings-cmdline-stability/bar.rs | 5 - .../allow-warnings-cmdline-stability/foo.rs | 5 - .../archive-duplicate-names/Makefile | 11 - .../archive-duplicate-names/bar.c | 1 - .../archive-duplicate-names/bar.rs | 5 - .../archive-duplicate-names/foo.c | 1 - .../archive-duplicate-names/foo.rs | 14 - .../arguments-non-c-like-enum/Makefile | 7 - .../arguments-non-c-like-enum/nonclike.rs | 31 - .../arguments-non-c-like-enum/test.c | 66 -- tests/run-make-fulldeps/atomic-lock-free/Makefile | 48 -- .../atomic-lock-free/atomic_lock_free.rs | 66 -- tests/run-make-fulldeps/bare-outfile/Makefile | 6 - tests/run-make-fulldeps/bare-outfile/foo.rs | 2 - tests/run-make-fulldeps/c-dynamic-dylib/Makefile | 12 - tests/run-make-fulldeps/c-dynamic-dylib/bar.rs | 5 - tests/run-make-fulldeps/c-dynamic-dylib/cfoo.c | 4 - tests/run-make-fulldeps/c-dynamic-dylib/foo.rs | 10 - tests/run-make-fulldeps/c-dynamic-rlib/Makefile | 15 - tests/run-make-fulldeps/c-dynamic-rlib/bar.rs | 5 - tests/run-make-fulldeps/c-dynamic-rlib/cfoo.c | 4 - tests/run-make-fulldeps/c-dynamic-rlib/foo.rs | 10 - .../c-link-to-rust-dylib/Makefile | 17 - tests/run-make-fulldeps/c-link-to-rust-dylib/bar.c | 6 - .../run-make-fulldeps/c-link-to-rust-dylib/foo.rs | 4 - .../c-link-to-rust-staticlib/Makefile | 12 - .../c-link-to-rust-staticlib/bar.c | 6 - .../c-link-to-rust-staticlib/foo.rs | 4 - .../c-link-to-rust-va-list-fn/Makefile | 6 - .../c-link-to-rust-va-list-fn/checkrust.rs | 148 ---- .../c-link-to-rust-va-list-fn/test.c | 50 -- tests/run-make-fulldeps/c-static-dylib/Makefile | 9 - tests/run-make-fulldeps/c-static-dylib/bar.rs | 5 - tests/run-make-fulldeps/c-static-dylib/cfoo.c | 1 - tests/run-make-fulldeps/c-static-dylib/foo.rs | 10 - tests/run-make-fulldeps/c-static-rlib/Makefile | 8 - tests/run-make-fulldeps/c-static-rlib/bar.rs | 5 - tests/run-make-fulldeps/c-static-rlib/cfoo.c | 1 - tests/run-make-fulldeps/c-static-rlib/foo.rs | 10 - .../c-unwind-abi-catch-lib-panic/Makefile | 30 - .../c-unwind-abi-catch-lib-panic/add.c | 12 - .../c-unwind-abi-catch-lib-panic/main.rs | 35 - .../c-unwind-abi-catch-lib-panic/panic.rs | 12 - .../c-unwind-abi-catch-panic/Makefile | 5 - .../c-unwind-abi-catch-panic/add.c | 12 - .../c-unwind-abi-catch-panic/main.rs | 44 - .../cat-and-grep-sanity-check/Makefile | 46 -- .../cdylib-dylib-linkage/Makefile | 27 - .../run-make-fulldeps/cdylib-dylib-linkage/bar.rs | 5 - tests/run-make-fulldeps/cdylib-dylib-linkage/foo.c | 10 - .../run-make-fulldeps/cdylib-dylib-linkage/foo.rs | 13 - .../cdylib-fewer-symbols/Makefile | 12 - .../run-make-fulldeps/cdylib-fewer-symbols/foo.rs | 6 - tests/run-make-fulldeps/cdylib/Makefile | 19 - tests/run-make-fulldeps/cdylib/bar.rs | 5 - tests/run-make-fulldeps/cdylib/foo.c | 10 - tests/run-make-fulldeps/cdylib/foo.rs | 13 - .../codegen-options-parsing/Makefile | 31 - .../codegen-options-parsing/dummy.rs | 1 - tests/run-make-fulldeps/compile-stdin/Makefile | 5 - .../compiler-lookup-paths-2/Makefile | 8 - .../run-make-fulldeps/compiler-lookup-paths-2/a.rs | 1 - .../run-make-fulldeps/compiler-lookup-paths-2/b.rs | 2 - .../run-make-fulldeps/compiler-lookup-paths-2/c.rs | 3 - .../compiler-lookup-paths/Makefile | 38 - tests/run-make-fulldeps/compiler-lookup-paths/a.rs | 1 - tests/run-make-fulldeps/compiler-lookup-paths/b.rs | 2 - tests/run-make-fulldeps/compiler-lookup-paths/c.rs | 2 - tests/run-make-fulldeps/compiler-lookup-paths/d.rs | 4 - tests/run-make-fulldeps/compiler-lookup-paths/e.rs | 2 - .../run-make-fulldeps/compiler-lookup-paths/e2.rs | 4 - tests/run-make-fulldeps/compiler-lookup-paths/f.rs | 2 - .../compiler-lookup-paths/native.c | 1 - .../compiler-rt-works-on-mingw/Makefile | 9 - .../compiler-rt-works-on-mingw/foo.cpp | 4 - .../compiler-rt-works-on-mingw/foo.rs | 10 - .../core-no-fp-fmt-parse/Makefile | 4 - tests/run-make-fulldeps/crate-data-smoke/Makefile | 10 - tests/run-make-fulldeps/crate-data-smoke/crate.rs | 7 - tests/run-make-fulldeps/crate-data-smoke/lib.rs | 2 - tests/run-make-fulldeps/crate-data-smoke/rlib.rs | 2 - .../crate-hash-rustc-version/Makefile | 37 - .../crate-hash-rustc-version/a.rs | 4 - .../crate-hash-rustc-version/b.rs | 8 - .../run-make-fulldeps/crate-name-priority/Makefile | 11 - tests/run-make-fulldeps/crate-name-priority/foo.rs | 1 - .../run-make-fulldeps/crate-name-priority/foo1.rs | 3 - .../cross-lang-lto-clang/Makefile | 25 - .../run-make-fulldeps/cross-lang-lto-clang/clib.c | 9 - .../run-make-fulldeps/cross-lang-lto-clang/cmain.c | 12 - .../run-make-fulldeps/cross-lang-lto-clang/main.rs | 11 - .../cross-lang-lto-clang/rustlib.rs | 12 - .../cross-lang-lto-pgo-smoketest/Makefile | 87 -- .../cross-lang-lto-pgo-smoketest/clib.c | 9 - .../cross-lang-lto-pgo-smoketest/cmain.c | 12 - .../cross-lang-lto-pgo-smoketest/main.rs | 11 - .../cross-lang-lto-pgo-smoketest/rustlib.rs | 12 - .../cross-lang-lto-upstream-rlibs/Makefile | 32 - .../cross-lang-lto-upstream-rlibs/staticlib.rs | 8 - .../cross-lang-lto-upstream-rlibs/upstream.rs | 3 - tests/run-make-fulldeps/cross-lang-lto/Makefile | 57 -- tests/run-make-fulldeps/cross-lang-lto/lib.rs | 4 - tests/run-make-fulldeps/cross-lang-lto/main.rs | 3 - tests/run-make-fulldeps/debug-assertions/Makefile | 25 - tests/run-make-fulldeps/debug-assertions/debug.rs | 33 - .../dep-info-doesnt-run-much/Makefile | 4 - .../dep-info-doesnt-run-much/foo.rs | 5 - tests/run-make-fulldeps/dep-info-spaces/Makefile | 19 - .../run-make-fulldeps/dep-info-spaces/Makefile.foo | 7 - tests/run-make-fulldeps/dep-info-spaces/bar.rs | 1 - tests/run-make-fulldeps/dep-info-spaces/foo foo.rs | 1 - tests/run-make-fulldeps/dep-info-spaces/lib.rs | 4 - tests/run-make-fulldeps/dep-info/Makefile | 25 - tests/run-make-fulldeps/dep-info/Makefile.foo | 7 - tests/run-make-fulldeps/dep-info/bar.rs | 1 - tests/run-make-fulldeps/dep-info/foo.rs | 1 - tests/run-make-fulldeps/dep-info/lib.rs | 4 - tests/run-make-fulldeps/dep-info/lib2.rs | 3 - .../doctests-keep-binaries/Makefile | 21 - .../run-make-fulldeps/doctests-keep-binaries/t.rs | 11 - .../duplicate-output-flavors/Makefile | 5 - .../duplicate-output-flavors/foo.rs | 1 - tests/run-make-fulldeps/dylib-chain/Makefile | 12 - tests/run-make-fulldeps/dylib-chain/m1.rs | 2 - tests/run-make-fulldeps/dylib-chain/m2.rs | 4 - tests/run-make-fulldeps/dylib-chain/m3.rs | 4 - tests/run-make-fulldeps/dylib-chain/m4.rs | 3 - tests/run-make-fulldeps/emit-stack-sizes/Makefile | 12 - tests/run-make-fulldeps/emit-stack-sizes/foo.rs | 3 - tests/run-make-fulldeps/emit/Makefile | 21 - tests/run-make-fulldeps/emit/test-24876.rs | 9 - tests/run-make-fulldeps/emit/test-26235.rs | 46 -- .../error-found-staticlib-instead-crate/Makefile | 5 - .../error-found-staticlib-instead-crate/bar.rs | 5 - .../error-found-staticlib-instead-crate/foo.rs | 1 - .../error-writing-dependencies/Makefile | 8 - .../error-writing-dependencies/foo.rs | 1 - tests/run-make-fulldeps/exit-code/Makefile | 11 - tests/run-make-fulldeps/exit-code/compile-error.rs | 3 - tests/run-make-fulldeps/exit-code/lint-failure.rs | 6 - tests/run-make-fulldeps/exit-code/success.rs | 4 - .../extern-diff-internal-name/Makefile | 5 - .../extern-diff-internal-name/lib.rs | 2 - .../extern-diff-internal-name/test.rs | 5 - .../extern-flag-disambiguates/Makefile | 25 - .../extern-flag-disambiguates/a.rs | 6 - .../extern-flag-disambiguates/b.rs | 9 - .../extern-flag-disambiguates/c.rs | 9 - .../extern-flag-disambiguates/d.rs | 11 - tests/run-make-fulldeps/extern-flag-fun/Makefile | 19 - tests/run-make-fulldeps/extern-flag-fun/bar-alt.rs | 1 - tests/run-make-fulldeps/extern-flag-fun/bar.rs | 1 - tests/run-make-fulldeps/extern-flag-fun/foo.rs | 3 - .../extern-flag-fun/gated_unstable.rs | 3 - tests/run-make-fulldeps/extern-flag-fun/rustc.rs | 1 - .../extern-flag-pathless/Makefile | 18 - .../extern-flag-pathless/bar-dynamic.rs | 3 - .../extern-flag-pathless/bar-static.rs | 3 - .../run-make-fulldeps/extern-flag-pathless/foo.rs | 3 - .../extern-flag-rename-transitive/Makefile | 7 - .../extern-flag-rename-transitive/bar.rs | 3 - .../extern-flag-rename-transitive/baz.rs | 4 - .../extern-flag-rename-transitive/foo.rs | 1 - tests/run-make-fulldeps/extern-fn-generic/Makefile | 6 - tests/run-make-fulldeps/extern-fn-generic/test.c | 16 - tests/run-make-fulldeps/extern-fn-generic/test.rs | 20 - .../extern-fn-generic/testcrate.rs | 16 - tests/run-make-fulldeps/extern-fn-mangle/Makefile | 5 - tests/run-make-fulldeps/extern-fn-mangle/test.c | 8 - tests/run-make-fulldeps/extern-fn-mangle/test.rs | 19 - .../run-make-fulldeps/extern-fn-reachable/Makefile | 25 - .../run-make-fulldeps/extern-fn-reachable/dylib.rs | 14 - .../extern-fn-struct-passing-abi/Makefile | 5 - .../extern-fn-struct-passing-abi/test.c | 314 ------- .../extern-fn-struct-passing-abi/test.rs | 138 ---- .../extern-fn-with-extern-types/Makefile | 5 - .../extern-fn-with-extern-types/ctest.c | 16 - .../extern-fn-with-extern-types/test.rs | 17 - .../extern-fn-with-packed-struct/Makefile | 5 - .../extern-fn-with-packed-struct/test.c | 26 - .../extern-fn-with-packed-struct/test.rs | 20 - .../extern-fn-with-union/Makefile | 6 - .../run-make-fulldeps/extern-fn-with-union/ctest.c | 10 - .../run-make-fulldeps/extern-fn-with-union/test.rs | 19 - .../extern-fn-with-union/testcrate.rs | 11 - .../extern-multiple-copies/Makefile | 8 - .../extern-multiple-copies/bar.rs | 6 - .../extern-multiple-copies/foo1.rs | 1 - .../extern-multiple-copies/foo2.rs | 1 - .../extern-multiple-copies2/Makefile | 10 - .../extern-multiple-copies2/bar.rs | 8 - .../extern-multiple-copies2/foo1.rs | 7 - .../extern-multiple-copies2/foo2.rs | 8 - .../extern-overrides-distribution/Makefile | 5 - .../extern-overrides-distribution/libc.rs | 3 - .../extern-overrides-distribution/main.rs | 5 - .../extra-filename-with-temp-outputs/Makefile | 6 - .../extra-filename-with-temp-outputs/foo.rs | 1 - .../foreign-double-unwind/Makefile | 10 - .../foreign-double-unwind/foo.cpp | 33 - .../run-make-fulldeps/foreign-double-unwind/foo.rs | 26 - .../run-make-fulldeps/foreign-exceptions/Makefile | 10 - tests/run-make-fulldeps/foreign-exceptions/foo.cpp | 60 -- tests/run-make-fulldeps/foreign-exceptions/foo.rs | 59 -- .../foreign-rust-exceptions/Makefile | 11 - .../foreign-rust-exceptions/bar.rs | 7 - .../foreign-rust-exceptions/foo.rs | 13 - tests/run-make-fulldeps/fpic/Makefile | 10 - tests/run-make-fulldeps/fpic/hello.rs | 1 - .../glibc-staticlib-args/Makefile | 12 - .../glibc-staticlib-args/library.rs | 4 - .../glibc-staticlib-args/program.c | 6 - tests/run-make-fulldeps/hir-tree/Makefile | 8 - tests/run-make-fulldeps/hir-tree/input.rs | 3 - .../hotplug_codegen_backend/Makefile | 2 +- .../run-make-fulldeps/include_bytes_deps/Makefile | 7 - .../run-make-fulldeps/include_bytes_deps/input.bin | 1 - .../run-make-fulldeps/include_bytes_deps/input.md | 1 - .../run-make-fulldeps/include_bytes_deps/input.txt | 1 - tests/run-make-fulldeps/include_bytes_deps/main.rs | 10 - .../incr-add-rust-src-component/Makefile | 44 - .../incr-add-rust-src-component/main.rs | 3 - .../inline-always-many-cgu/Makefile | 8 - .../inline-always-many-cgu/foo.rs | 15 - .../interdependent-c-libraries/Makefile | 14 - .../interdependent-c-libraries/bar.c | 3 - .../interdependent-c-libraries/bar.rs | 14 - .../interdependent-c-libraries/foo.c | 1 - .../interdependent-c-libraries/foo.rs | 12 - .../interdependent-c-libraries/main.rs | 6 - .../intrinsic-unreachable/Makefile | 12 - .../intrinsic-unreachable/exit-ret.rs | 14 - .../intrinsic-unreachable/exit-unreachable.rs | 18 - tests/run-make-fulldeps/invalid-library/Makefile | 6 - tests/run-make-fulldeps/invalid-library/foo.rs | 3 - tests/run-make-fulldeps/invalid-staticlib/Makefile | 5 - tests/run-make-fulldeps/issue-11908/Makefile | 21 - tests/run-make-fulldeps/issue-11908/bar.rs | 3 - tests/run-make-fulldeps/issue-11908/foo.rs | 1 - tests/run-make-fulldeps/issue-14500/Makefile | 13 - tests/run-make-fulldeps/issue-14500/bar.rs | 1 - tests/run-make-fulldeps/issue-14500/foo.c | 7 - tests/run-make-fulldeps/issue-14500/foo.rs | 5 - tests/run-make-fulldeps/issue-14698/Makefile | 4 - tests/run-make-fulldeps/issue-14698/foo.rs | 1 - tests/run-make-fulldeps/issue-15460/Makefile | 6 - tests/run-make-fulldeps/issue-15460/bar.rs | 4 - tests/run-make-fulldeps/issue-15460/foo.c | 6 - tests/run-make-fulldeps/issue-15460/foo.rs | 6 - tests/run-make-fulldeps/issue-18943/Makefile | 7 - tests/run-make-fulldeps/issue-18943/foo.rs | 5 - tests/run-make-fulldeps/issue-19371/Makefile | 2 +- tests/run-make-fulldeps/issue-20626/Makefile | 8 - tests/run-make-fulldeps/issue-20626/foo.rs | 13 - tests/run-make-fulldeps/issue-22131/Makefile | 7 - tests/run-make-fulldeps/issue-22131/foo.rs | 5 - tests/run-make-fulldeps/issue-24445/Makefile | 10 - tests/run-make-fulldeps/issue-24445/foo.c | 6 - tests/run-make-fulldeps/issue-24445/foo.rs | 15 - tests/run-make-fulldeps/issue-25581/Makefile | 5 - tests/run-make-fulldeps/issue-25581/test.c | 15 - tests/run-make-fulldeps/issue-25581/test.rs | 18 - tests/run-make-fulldeps/issue-26006/Makefile | 16 - tests/run-make-fulldeps/issue-26006/in/libc/lib.rs | 3 - tests/run-make-fulldeps/issue-26006/in/time/lib.rs | 4 - tests/run-make-fulldeps/issue-26092/Makefile | 6 - tests/run-make-fulldeps/issue-26092/blank.rs | 1 - tests/run-make-fulldeps/issue-28595/Makefile | 6 - tests/run-make-fulldeps/issue-28595/a.c | 1 - tests/run-make-fulldeps/issue-28595/a.rs | 6 - tests/run-make-fulldeps/issue-28595/b.c | 5 - tests/run-make-fulldeps/issue-28595/b.rs | 12 - tests/run-make-fulldeps/issue-28766/Makefile | 5 - tests/run-make-fulldeps/issue-28766/foo.rs | 8 - tests/run-make-fulldeps/issue-28766/main.rs | 7 - tests/run-make-fulldeps/issue-30063/Makefile | 35 - tests/run-make-fulldeps/issue-30063/foo.rs | 1 - tests/run-make-fulldeps/issue-33329/Makefile | 5 - tests/run-make-fulldeps/issue-33329/main.rs | 1 - tests/run-make-fulldeps/issue-35164/Makefile | 4 - tests/run-make-fulldeps/issue-35164/main.rs | 5 - .../run-make-fulldeps/issue-35164/submodule/mod.rs | 3 - tests/run-make-fulldeps/issue-37839/Makefile | 6 - tests/run-make-fulldeps/issue-37839/a.rs | 2 - tests/run-make-fulldeps/issue-37839/b.rs | 2 - tests/run-make-fulldeps/issue-37839/c.rs | 2 - tests/run-make-fulldeps/issue-37893/Makefile | 4 - tests/run-make-fulldeps/issue-37893/a.rs | 2 - tests/run-make-fulldeps/issue-37893/b.rs | 2 - tests/run-make-fulldeps/issue-37893/c.rs | 3 - tests/run-make-fulldeps/issue-38237/Makefile | 5 - tests/run-make-fulldeps/issue-38237/bar.rs | 4 - tests/run-make-fulldeps/issue-38237/baz.rs | 8 - tests/run-make-fulldeps/issue-38237/foo.rs | 9 - tests/run-make-fulldeps/issue-40535/Makefile | 13 - tests/run-make-fulldeps/issue-40535/bar.rs | 3 - tests/run-make-fulldeps/issue-40535/baz.rs | 1 - tests/run-make-fulldeps/issue-40535/foo.rs | 4 - tests/run-make-fulldeps/issue-46239/Makefile | 5 - tests/run-make-fulldeps/issue-46239/main.rs | 8 - tests/run-make-fulldeps/issue-47551/Makefile | 9 - .../issue-47551/eh_frame-terminator.rs | 22 - tests/run-make-fulldeps/issue-51671/Makefile | 9 - tests/run-make-fulldeps/issue-51671/app.rs | 20 - tests/run-make-fulldeps/issue-53964/Makefile | 5 - tests/run-make-fulldeps/issue-53964/app.rs | 8 - tests/run-make-fulldeps/issue-53964/panic.rs | 10 - tests/run-make-fulldeps/issue-64153/Makefile | 26 - tests/run-make-fulldeps/issue-64153/downstream.rs | 6 - tests/run-make-fulldeps/issue-64153/upstream.rs | 6 - .../issue-68794-textrel-on-minimal-lib/Makefile | 17 - .../issue-68794-textrel-on-minimal-lib/bar.c | 6 - .../issue-68794-textrel-on-minimal-lib/foo.rs | 8 - tests/run-make-fulldeps/issue-69368/Makefile | 18 - tests/run-make-fulldeps/issue-69368/a.rs | 26 - tests/run-make-fulldeps/issue-69368/b.rs | 8 - tests/run-make-fulldeps/issue-69368/c.rs | 34 - tests/run-make-fulldeps/issue-7349/Makefile | 11 - tests/run-make-fulldeps/issue-7349/foo.rs | 22 - tests/run-make-fulldeps/issue-83045/Makefile | 33 - tests/run-make-fulldeps/issue-83045/a.rs | 1 - tests/run-make-fulldeps/issue-83045/b.rs | 1 - tests/run-make-fulldeps/issue-83045/c.rs | 1 - .../issue-84395-lto-embed-bitcode/Makefile | 11 - .../issue-84395-lto-embed-bitcode/test.rs | 3 - .../issue-97463-abi-param-passing/Makefile | 14 - .../issue-97463-abi-param-passing/bad.c | 24 - .../issue-97463-abi-param-passing/param_passing.rs | 38 - tests/run-make-fulldeps/issue64319/Makefile | 39 - tests/run-make-fulldeps/issue64319/bar.rs | 5 - tests/run-make-fulldeps/issue64319/foo.rs | 9 - .../libs-through-symlinks/Makefile | 11 - .../run-make-fulldeps/libs-through-symlinks/bar.rs | 3 - .../run-make-fulldeps/libs-through-symlinks/foo.rs | 2 - tests/run-make-fulldeps/libtest-json/Makefile | 18 - tests/run-make-fulldeps/libtest-json/f.rs | 22 - .../libtest-json/output-default.json | 10 - .../libtest-json/output-stdout-success.json | 10 - .../libtest-json/validate_json.py | 8 - tests/run-make-fulldeps/link-arg/Makefile | 5 - tests/run-make-fulldeps/link-arg/empty.rs | 1 - tests/run-make-fulldeps/link-args-order/Makefile | 10 - tests/run-make-fulldeps/link-args-order/empty.rs | 1 - tests/run-make-fulldeps/link-cfg/Makefile | 22 - .../link-cfg/dep-with-staticlib.rs | 8 - tests/run-make-fulldeps/link-cfg/dep.rs | 8 - tests/run-make-fulldeps/link-cfg/no-deps.rs | 20 - tests/run-make-fulldeps/link-cfg/return1.c | 6 - tests/run-make-fulldeps/link-cfg/return2.c | 6 - tests/run-make-fulldeps/link-cfg/return3.c | 6 - tests/run-make-fulldeps/link-cfg/with-deps.rs | 14 - .../link-cfg/with-staticlib-deps.rs | 14 - tests/run-make-fulldeps/link-dedup/Makefile | 12 - tests/run-make-fulldeps/link-dedup/depa.rs | 10 - tests/run-make-fulldeps/link-dedup/depb.rs | 8 - tests/run-make-fulldeps/link-dedup/depc.rs | 4 - tests/run-make-fulldeps/link-dedup/empty.rs | 5 - tests/run-make-fulldeps/link-path-order/Makefile | 18 - tests/run-make-fulldeps/link-path-order/correct.c | 1 - tests/run-make-fulldeps/link-path-order/main.rs | 16 - tests/run-make-fulldeps/link-path-order/wrong.c | 1 - .../linkage-attr-on-static/Makefile | 5 - .../linkage-attr-on-static/bar.rs | 16 - .../run-make-fulldeps/linkage-attr-on-static/foo.c | 7 - .../long-linker-command-lines-cmd-exe/Makefile | 6 - .../long-linker-command-lines-cmd-exe/foo.bat | 1 - .../long-linker-command-lines-cmd-exe/foo.rs | 101 --- .../long-linker-command-lines/Makefile | 5 - .../long-linker-command-lines/foo.rs | 106 --- .../run-make-fulldeps/longjmp-across-rust/Makefile | 5 - tests/run-make-fulldeps/longjmp-across-rust/foo.c | 18 - .../run-make-fulldeps/longjmp-across-rust/main.rs | 29 - tests/run-make-fulldeps/ls-metadata/Makefile | 7 - tests/run-make-fulldeps/ls-metadata/foo.rs | 1 - tests/run-make-fulldeps/lto-dylib-dep/Makefile | 10 - tests/run-make-fulldeps/lto-dylib-dep/a_dylib.rs | 3 - tests/run-make-fulldeps/lto-dylib-dep/main.rs | 5 - tests/run-make-fulldeps/lto-empty/Makefile | 12 - tests/run-make-fulldeps/lto-empty/lib.rs | 1 - .../lto-no-link-whole-rlib/Makefile | 8 - .../run-make-fulldeps/lto-no-link-whole-rlib/bar.c | 3 - .../run-make-fulldeps/lto-no-link-whole-rlib/foo.c | 3 - .../lto-no-link-whole-rlib/lib1.rs | 10 - .../lto-no-link-whole-rlib/lib2.rs | 12 - .../lto-no-link-whole-rlib/main.rs | 7 - tests/run-make-fulldeps/lto-readonly-lib/Makefile | 12 - tests/run-make-fulldeps/lto-readonly-lib/lib.rs | 1 - tests/run-make-fulldeps/lto-readonly-lib/main.rs | 3 - tests/run-make-fulldeps/lto-smoke-c/Makefile | 11 - tests/run-make-fulldeps/lto-smoke-c/bar.c | 6 - tests/run-make-fulldeps/lto-smoke-c/foo.rs | 4 - tests/run-make-fulldeps/lto-smoke/Makefile | 30 - tests/run-make-fulldeps/lto-smoke/lib.rs | 1 - tests/run-make-fulldeps/lto-smoke/main.rs | 3 - tests/run-make-fulldeps/manual-crate-name/Makefile | 5 - tests/run-make-fulldeps/manual-crate-name/bar.rs | 1 - tests/run-make-fulldeps/manual-link/Makefile | 6 - tests/run-make-fulldeps/manual-link/bar.c | 1 - tests/run-make-fulldeps/manual-link/foo.c | 1 - tests/run-make-fulldeps/manual-link/foo.rs | 11 - tests/run-make-fulldeps/manual-link/main.rs | 5 - .../many-crates-but-no-match/Makefile | 35 - .../many-crates-but-no-match/crateA1.rs | 4 - .../many-crates-but-no-match/crateA2.rs | 4 - .../many-crates-but-no-match/crateA3.rs | 4 - .../many-crates-but-no-match/crateB.rs | 1 - .../many-crates-but-no-match/crateC.rs | 3 - .../metadata-flag-frobs-symbols/Makefile | 10 - .../metadata-flag-frobs-symbols/bar.rs | 8 - .../metadata-flag-frobs-symbols/foo.rs | 6 - tests/run-make-fulldeps/min-global-align/Makefile | 22 - .../min-global-align/min_global_align.rs | 32 - .../mingw-export-call-convention/Makefile | 9 - .../mingw-export-call-convention/foo.rs | 4 - .../mismatching-target-triples/Makefile | 11 - .../mismatching-target-triples/bar.rs | 3 - .../mismatching-target-triples/foo.rs | 3 - .../missing-crate-dependency/Makefile | 9 - .../missing-crate-dependency/crateA.rs | 2 - .../missing-crate-dependency/crateB.rs | 1 - .../missing-crate-dependency/crateC.rs | 3 - tests/run-make-fulldeps/mixing-deps/Makefile | 7 - tests/run-make-fulldeps/mixing-deps/both.rs | 4 - tests/run-make-fulldeps/mixing-deps/dylib.rs | 6 - tests/run-make-fulldeps/mixing-deps/prog.rs | 9 - tests/run-make-fulldeps/mixing-formats/Makefile | 74 -- tests/run-make-fulldeps/mixing-formats/bar1.rs | 1 - tests/run-make-fulldeps/mixing-formats/bar2.rs | 1 - tests/run-make-fulldeps/mixing-formats/baz.rs | 3 - tests/run-make-fulldeps/mixing-formats/baz2.rs | 4 - tests/run-make-fulldeps/mixing-formats/foo.rs | 1 - tests/run-make-fulldeps/mixing-libs/Makefile | 9 - tests/run-make-fulldeps/mixing-libs/dylib.rs | 4 - tests/run-make-fulldeps/mixing-libs/prog.rs | 7 - tests/run-make-fulldeps/mixing-libs/rlib.rs | 2 - tests/run-make-fulldeps/msvc-opt-minsize/Makefile | 5 - tests/run-make-fulldeps/msvc-opt-minsize/foo.rs | 19 - tests/run-make-fulldeps/multiple-emits/Makefile | 7 - tests/run-make-fulldeps/multiple-emits/foo.rs | 1 - tests/run-make-fulldeps/no-builtins-lto/Makefile | 9 - tests/run-make-fulldeps/no-builtins-lto/main.rs | 3 - .../no-builtins-lto/no_builtins.rs | 2 - tests/run-make-fulldeps/no-duplicate-libs/Makefile | 10 - tests/run-make-fulldeps/no-duplicate-libs/bar.c | 5 - tests/run-make-fulldeps/no-duplicate-libs/foo.c | 1 - tests/run-make-fulldeps/no-duplicate-libs/main.rs | 10 - .../no-intermediate-extras/Makefile | 7 - .../no-intermediate-extras/foo.rs | 1 - .../obey-crate-type-flag/Makefile | 13 - .../run-make-fulldeps/obey-crate-type-flag/test.rs | 2 - tests/run-make-fulldeps/obtain-borrowck/Makefile | 2 +- .../Makefile | 7 - .../foo.rs | 1 - .../output-filename-overwrites-input/Makefile | 13 - .../output-filename-overwrites-input/bar.rs | 1 - .../output-filename-overwrites-input/foo.rs | 1 - .../output-type-permutations/Makefile | 146 ---- .../output-type-permutations/foo.rs | 3 - .../run-make-fulldeps/output-with-hyphens/Makefile | 7 - .../output-with-hyphens/foo-bar.rs | 1 - .../override-aliased-flags/Makefile | 22 - .../override-aliased-flags/main.rs | 1 - .../panic-impl-transitive/Makefile | 7 - .../panic-impl-transitive/panic-impl-consumer.rs | 5 - .../panic-impl-transitive/panic-impl-provider.rs | 9 - .../pass-non-c-like-enum-to-c/Makefile | 5 - .../pass-non-c-like-enum-to-c/nonclike.rs | 21 - .../pass-non-c-like-enum-to-c/test.c | 85 -- .../run-make-fulldeps/pgo-branch-weights/Makefile | 34 - .../pgo-branch-weights/filecheck-patterns.txt | 24 - .../pgo-branch-weights/interesting.rs | 40 - tests/run-make-fulldeps/pgo-branch-weights/main.rs | 17 - .../run-make-fulldeps/pgo-branch-weights/opaque.rs | 6 - tests/run-make-fulldeps/pgo-gen-lto/Makefile | 14 - tests/run-make-fulldeps/pgo-gen-lto/test.rs | 1 - .../pgo-gen-no-imp-symbols/Makefile | 13 - .../pgo-gen-no-imp-symbols/test.rs | 1 - tests/run-make-fulldeps/pgo-gen/Makefile | 14 - tests/run-make-fulldeps/pgo-gen/test.rs | 1 - .../pgo-indirect-call-promotion/Makefile | 26 - .../filecheck-patterns.txt | 16 - .../pgo-indirect-call-promotion/interesting.rs | 56 -- .../pgo-indirect-call-promotion/main.rs | 14 - .../pgo-indirect-call-promotion/opaque.rs | 7 - tests/run-make-fulldeps/pgo-use/Makefile | 46 -- .../pgo-use/filecheck-patterns.txt | 11 - tests/run-make-fulldeps/pgo-use/main.rs | 23 - .../pointer-auth-link-with-c/Makefile | 14 - .../pointer-auth-link-with-c/test.c | 1 - .../pointer-auth-link-with-c/test.rs | 8 - tests/run-make-fulldeps/prefer-dylib/Makefile | 8 - tests/run-make-fulldeps/prefer-dylib/bar.rs | 1 - tests/run-make-fulldeps/prefer-dylib/foo.rs | 5 - tests/run-make-fulldeps/prefer-rlib/Makefile | 8 - tests/run-make-fulldeps/prefer-rlib/bar.rs | 1 - tests/run-make-fulldeps/prefer-rlib/foo.rs | 5 - tests/run-make-fulldeps/pretty-expanded/Makefile | 2 +- .../pretty-print-to-file/Makefile | 5 - .../pretty-print-to-file/input.pp | 3 - .../pretty-print-to-file/input.rs | 5 - .../print-calling-conventions/Makefile | 4 - tests/run-make-fulldeps/print-cfg/Makefile | 20 - tests/run-make-fulldeps/print-target-list/Makefile | 8 - tests/run-make-fulldeps/profile/Makefile | 12 - tests/run-make-fulldeps/profile/test.rs | 1 - tests/run-make-fulldeps/prune-link-args/Makefile | 9 - tests/run-make-fulldeps/prune-link-args/empty.rs | 1 - tests/run-make-fulldeps/redundant-libs/Makefile | 23 - tests/run-make-fulldeps/redundant-libs/bar.c | 1 - tests/run-make-fulldeps/redundant-libs/baz.c | 7 - tests/run-make-fulldeps/redundant-libs/foo.c | 2 - tests/run-make-fulldeps/redundant-libs/main.rs | 11 - tests/run-make-fulldeps/relocation-model/Makefile | 19 - tests/run-make-fulldeps/relocation-model/foo.rs | 1 - tests/run-make-fulldeps/relro-levels/Makefile | 21 - tests/run-make-fulldeps/relro-levels/hello.rs | 3 - tests/run-make-fulldeps/remap-path-prefix/Makefile | 9 - .../remap-path-prefix/auxiliary/lib.rs | 3 - .../reproducible-build-2/Makefile | 26 - .../reproducible-build-2/linker.rs | 44 - .../reproducible-build-2/reproducible-build-aux.rs | 28 - .../reproducible-build-2/reproducible-build.rs | 116 --- .../run-make-fulldeps/reproducible-build/Makefile | 139 ---- .../run-make-fulldeps/reproducible-build/linker.rs | 50 -- .../reproducible-build/reproducible-build-aux.rs | 28 - .../reproducible-build/reproducible-build.rs | 116 --- tests/run-make-fulldeps/resolve-rename/Makefile | 7 - tests/run-make-fulldeps/resolve-rename/bar.rs | 5 - tests/run-make-fulldeps/resolve-rename/baz.rs | 5 - tests/run-make-fulldeps/resolve-rename/foo.rs | 3 - .../return-non-c-like-enum-from-c/Makefile | 5 - .../return-non-c-like-enum-from-c/nonclike.rs | 31 - .../return-non-c-like-enum-from-c/test.c | 61 -- .../return-non-c-like-enum/Makefile | 7 - .../return-non-c-like-enum/nonclike.rs | 21 - .../return-non-c-like-enum/test.c | 63 -- tests/run-make-fulldeps/rlib-chain/Makefile | 10 - tests/run-make-fulldeps/rlib-chain/m1.rs | 2 - tests/run-make-fulldeps/rlib-chain/m2.rs | 4 - tests/run-make-fulldeps/rlib-chain/m3.rs | 4 - tests/run-make-fulldeps/rlib-chain/m4.rs | 3 - .../run-make-fulldeps/rustdoc-determinism/Makefile | 16 - tests/run-make-fulldeps/rustdoc-determinism/bar.rs | 1 - tests/run-make-fulldeps/rustdoc-determinism/foo.rs | 1 - .../run-make-fulldeps/rustdoc-error-lines/Makefile | 13 - .../run-make-fulldeps/rustdoc-error-lines/input.rs | 28 - tests/run-make-fulldeps/rustdoc-io-error/Makefile | 20 - tests/run-make-fulldeps/rustdoc-io-error/foo.rs | 1 - tests/run-make-fulldeps/rustdoc-map-file/Makefile | 5 - .../rustdoc-map-file/expected.json | 5 - tests/run-make-fulldeps/rustdoc-map-file/foo.rs | 16 - .../rustdoc-map-file/validate_json.py | 41 - .../run-make-fulldeps/rustdoc-output-path/Makefile | 4 - tests/run-make-fulldeps/rustdoc-output-path/foo.rs | 1 - .../rustdoc-scrape-examples-macros/Makefile | 18 - .../rustdoc-scrape-examples-macros/examples/ex.rs | 27 - .../rustdoc-scrape-examples-macros/src/lib.rs | 12 - .../rustdoc-scrape-examples-macros/src/proc.rs | 39 - .../rustdoc-target-spec-json-path/Makefile | 9 - .../rustdoc-target-spec-json-path/dummy_core.rs | 2 - .../rustdoc-target-spec-json-path/my_crate.rs | 3 - .../rustdoc-target-spec-json-path/target.json | 38 - tests/run-make-fulldeps/rustdoc-themes/Makefile | 10 - tests/run-make-fulldeps/rustdoc-themes/foo.rs | 4 - .../sanitizer-cdylib-link/Makefile | 16 - .../sanitizer-cdylib-link/library.rs | 5 - .../sanitizer-cdylib-link/program.rs | 7 - .../sanitizer-dylib-link/Makefile | 16 - .../sanitizer-dylib-link/library.rs | 5 - .../sanitizer-dylib-link/program.rs | 7 - .../sanitizer-staticlib-link/Makefile | 20 - .../sanitizer-staticlib-link/library.rs | 5 - .../sanitizer-staticlib-link/program.c | 6 - .../sanitizer-staticlib-link/program.rs | 10 - .../run-make-fulldeps/separate-link-fail/Makefile | 7 - tests/run-make-fulldeps/separate-link/Makefile | 6 - .../run-make-fulldeps/sepcomp-cci-copies/Makefile | 12 - .../sepcomp-cci-copies/cci_lib.rs | 6 - tests/run-make-fulldeps/sepcomp-cci-copies/foo.rs | 25 - tests/run-make-fulldeps/sepcomp-inlining/Makefile | 15 - tests/run-make-fulldeps/sepcomp-inlining/foo.rs | 30 - tests/run-make-fulldeps/sepcomp-separate/Makefile | 9 - tests/run-make-fulldeps/sepcomp-separate/foo.rs | 21 - .../share-generics-dylib/Makefile | 22 - .../share-generics-dylib/instance_provider_a.rs | 6 - .../share-generics-dylib/instance_provider_b.rs | 6 - .../share-generics-dylib/instance_user_a_rlib.rs | 9 - .../share-generics-dylib/instance_user_b_rlib.rs | 9 - .../share-generics-dylib/instance_user_dylib.rs | 7 - .../share-generics-dylib/linked_leaf.rs | 15 - tests/run-make-fulldeps/simd-ffi/Makefile | 47 -- tests/run-make-fulldeps/simd-ffi/simd.rs | 82 -- tests/run-make-fulldeps/simple-dylib/Makefile | 5 - tests/run-make-fulldeps/simple-dylib/bar.rs | 1 - tests/run-make-fulldeps/simple-dylib/foo.rs | 5 - tests/run-make-fulldeps/simple-rlib/Makefile | 5 - tests/run-make-fulldeps/simple-rlib/bar.rs | 1 - tests/run-make-fulldeps/simple-rlib/foo.rs | 5 - tests/run-make-fulldeps/split-debuginfo/Makefile | 308 ------- tests/run-make-fulldeps/split-debuginfo/bar.rs | 13 - tests/run-make-fulldeps/split-debuginfo/baz.rs | 1 - tests/run-make-fulldeps/split-debuginfo/foo.rs | 15 - tests/run-make-fulldeps/split-debuginfo/main.rs | 8 - .../run-make-fulldeps/stable-symbol-names/Makefile | 41 - .../stable-symbol-names/stable-symbol-names1.rs | 31 - .../stable-symbol-names/stable-symbol-names2.rs | 17 - .../static-dylib-by-default/Makefile | 16 - .../static-dylib-by-default/bar.rs | 8 - .../static-dylib-by-default/foo.rs | 4 - .../static-dylib-by-default/main.c | 6 - .../run-make-fulldeps/static-extern-type/Makefile | 5 - .../static-extern-type/define-foo.c | 11 - .../static-extern-type/use-foo.rs | 14 - tests/run-make-fulldeps/static-unwinding/Makefile | 6 - tests/run-make-fulldeps/static-unwinding/lib.rs | 15 - tests/run-make-fulldeps/static-unwinding/main.rs | 24 - .../run-make-fulldeps/staticlib-blank-lib/Makefile | 6 - tests/run-make-fulldeps/staticlib-blank-lib/foo.rs | 6 - tests/run-make-fulldeps/std-core-cycle/Makefile | 16 - tests/run-make-fulldeps/std-core-cycle/bar.rs | 16 - tests/run-make-fulldeps/std-core-cycle/foo.rs | 11 - tests/run-make-fulldeps/stdin-non-utf8/Makefile | 6 - tests/run-make-fulldeps/stdin-non-utf8/non-utf8 | 1 - .../run-make-fulldeps/suspicious-library/Makefile | 7 - tests/run-make-fulldeps/suspicious-library/bar.rs | 3 - tests/run-make-fulldeps/suspicious-library/foo.rs | 3 - tests/run-make-fulldeps/symbol-visibility/Makefile | 122 --- .../symbol-visibility/a_cdylib.rs | 12 - .../symbol-visibility/a_proc_macro.rs | 9 - .../symbol-visibility/a_rust_dylib.rs | 15 - .../symbol-visibility/an_executable.rs | 7 - .../run-make-fulldeps/symbol-visibility/an_rlib.rs | 12 - .../symbols-include-type-name/Makefile | 9 - .../symbols-include-type-name/lib.rs | 14 - tests/run-make-fulldeps/symlinked-extern/Makefile | 11 - tests/run-make-fulldeps/symlinked-extern/bar.rs | 6 - tests/run-make-fulldeps/symlinked-extern/baz.rs | 6 - tests/run-make-fulldeps/symlinked-extern/foo.rs | 5 - .../run-make-fulldeps/symlinked-libraries/Makefile | 10 - tests/run-make-fulldeps/symlinked-libraries/bar.rs | 5 - tests/run-make-fulldeps/symlinked-libraries/foo.rs | 3 - tests/run-make-fulldeps/symlinked-rlib/Makefile | 9 - tests/run-make-fulldeps/symlinked-rlib/bar.rs | 5 - tests/run-make-fulldeps/symlinked-rlib/foo.rs | 1 - .../sysroot-crates-are-unstable/Makefile | 2 - .../sysroot-crates-are-unstable/test.py | 74 -- tests/run-make-fulldeps/target-cpu-native/Makefile | 20 - tests/run-make-fulldeps/target-cpu-native/foo.rs | 2 - tests/run-make-fulldeps/target-specs/Makefile | 11 - .../definitely-not-builtin-target.json | 7 - tests/run-make-fulldeps/target-specs/foo.rs | 24 - .../target-specs/mismatching-data-layout.json | 6 - .../target-specs/my-awesome-platform.json | 11 - .../target-specs/my-incomplete-platform.json | 10 - .../target-specs/my-invalid-platform.json | 1 - .../my-x86_64-unknown-linux-gnu-platform.json | 12 - .../target-without-atomic-cas/Makefile | 5 - tests/run-make-fulldeps/test-harness/Makefile | 8 - .../test-harness/test-ignore-cfg.rs | 9 - tests/run-make-fulldeps/tools.mk | 187 ----- .../type-mismatch-same-crate-name/Makefile | 19 - .../type-mismatch-same-crate-name/crateA.rs | 16 - .../type-mismatch-same-crate-name/crateB.rs | 4 - .../type-mismatch-same-crate-name/crateC.rs | 25 - .../use-extern-for-plugins/Makefile | 17 - .../use-extern-for-plugins/bar.rs | 9 - .../use-extern-for-plugins/baz.rs | 8 - .../use-extern-for-plugins/foo.rs | 8 - .../use-suggestions-rust-2018/Makefile | 7 - .../use-suggestions-rust-2018/ep-nested-lib.rs | 7 - .../use-suggestions-rust-2018/use-suggestions.rs | 3 - tests/run-make-fulldeps/used-cdylib-macos/Makefile | 11 - .../used-cdylib-macos/dylib_used.rs | 4 - tests/run-make-fulldeps/used/Makefile | 7 - tests/run-make-fulldeps/used/used.rs | 6 - tests/run-make-fulldeps/version/Makefile | 6 - .../run-make-fulldeps/volatile-intrinsics/Makefile | 9 - .../run-make-fulldeps/volatile-intrinsics/main.rs | 24 - .../weird-output-filenames/Makefile | 15 - .../weird-output-filenames/foo.rs | 1 - .../windows-binary-no-external-deps/Makefile | 9 - .../windows-binary-no-external-deps/hello.rs | 3 - tests/run-make-fulldeps/windows-spawn/Makefile | 8 - tests/run-make-fulldeps/windows-spawn/hello.rs | 3 - tests/run-make-fulldeps/windows-spawn/spawn.rs | 12 - tests/run-make-fulldeps/windows-subsystem/Makefile | 5 - .../run-make-fulldeps/windows-subsystem/console.rs | 3 - .../run-make-fulldeps/windows-subsystem/windows.rs | 3 - tests/run-make/a-b-a-linker-guard/Makefile | 16 + tests/run-make/a-b-a-linker-guard/a.rs | 8 + tests/run-make/a-b-a-linker-guard/b.rs | 7 + tests/run-make/alloc-no-oom-handling/Makefile | 4 + tests/run-make/alloc-no-rc/Makefile | 4 + tests/run-make/alloc-no-sync/Makefile | 4 + .../allow-non-lint-warnings-cmdline/Makefile | 12 + .../allow-non-lint-warnings-cmdline/foo.rs | 5 + .../allow-warnings-cmdline-stability/Makefile | 16 + .../allow-warnings-cmdline-stability/bar.rs | 5 + .../allow-warnings-cmdline-stability/foo.rs | 5 + tests/run-make/archive-duplicate-names/Makefile | 12 + tests/run-make/archive-duplicate-names/bar.c | 1 + tests/run-make/archive-duplicate-names/bar.rs | 5 + tests/run-make/archive-duplicate-names/foo.c | 1 + tests/run-make/archive-duplicate-names/foo.rs | 14 + tests/run-make/arguments-non-c-like-enum/Makefile | 8 + .../run-make/arguments-non-c-like-enum/nonclike.rs | 31 + tests/run-make/arguments-non-c-like-enum/test.c | 66 ++ tests/run-make/atomic-lock-free/Makefile | 48 ++ .../run-make/atomic-lock-free/atomic_lock_free.rs | 66 ++ tests/run-make/bare-outfile/Makefile | 7 + tests/run-make/bare-outfile/foo.rs | 2 + tests/run-make/c-dynamic-dylib/Makefile | 13 + tests/run-make/c-dynamic-dylib/bar.rs | 5 + tests/run-make/c-dynamic-dylib/cfoo.c | 4 + tests/run-make/c-dynamic-dylib/foo.rs | 10 + tests/run-make/c-dynamic-rlib/Makefile | 16 + tests/run-make/c-dynamic-rlib/bar.rs | 5 + tests/run-make/c-dynamic-rlib/cfoo.c | 4 + tests/run-make/c-dynamic-rlib/foo.rs | 10 + tests/run-make/c-link-to-rust-dylib/Makefile | 18 + tests/run-make/c-link-to-rust-dylib/bar.c | 6 + tests/run-make/c-link-to-rust-dylib/foo.rs | 4 + tests/run-make/c-link-to-rust-staticlib/Makefile | 13 + tests/run-make/c-link-to-rust-staticlib/bar.c | 6 + tests/run-make/c-link-to-rust-staticlib/foo.rs | 4 + tests/run-make/c-link-to-rust-va-list-fn/Makefile | 7 + .../c-link-to-rust-va-list-fn/checkrust.rs | 148 ++++ tests/run-make/c-link-to-rust-va-list-fn/test.c | 50 ++ tests/run-make/c-static-dylib/Makefile | 10 + tests/run-make/c-static-dylib/bar.rs | 5 + tests/run-make/c-static-dylib/cfoo.c | 1 + tests/run-make/c-static-dylib/foo.rs | 10 + tests/run-make/c-static-rlib/Makefile | 9 + tests/run-make/c-static-rlib/bar.rs | 5 + tests/run-make/c-static-rlib/cfoo.c | 1 + tests/run-make/c-static-rlib/foo.rs | 10 + .../run-make/c-unwind-abi-catch-lib-panic/Makefile | 31 + tests/run-make/c-unwind-abi-catch-lib-panic/add.c | 12 + .../run-make/c-unwind-abi-catch-lib-panic/main.rs | 35 + .../run-make/c-unwind-abi-catch-lib-panic/panic.rs | 12 + tests/run-make/c-unwind-abi-catch-panic/Makefile | 6 + tests/run-make/c-unwind-abi-catch-panic/add.c | 12 + tests/run-make/c-unwind-abi-catch-panic/main.rs | 44 + tests/run-make/cat-and-grep-sanity-check/Makefile | 46 ++ tests/run-make/cdylib-dylib-linkage/Makefile | 28 + tests/run-make/cdylib-dylib-linkage/bar.rs | 5 + tests/run-make/cdylib-dylib-linkage/foo.c | 10 + tests/run-make/cdylib-dylib-linkage/foo.rs | 13 + tests/run-make/cdylib-fewer-symbols/Makefile | 13 + tests/run-make/cdylib-fewer-symbols/foo.rs | 6 + tests/run-make/cdylib/Makefile | 20 + tests/run-make/cdylib/bar.rs | 5 + tests/run-make/cdylib/foo.c | 10 + tests/run-make/cdylib/foo.rs | 13 + tests/run-make/codegen-options-parsing/Makefile | 32 + tests/run-make/codegen-options-parsing/dummy.rs | 1 + tests/run-make/compile-stdin/Makefile | 6 + tests/run-make/compiler-lookup-paths-2/Makefile | 8 + tests/run-make/compiler-lookup-paths-2/a.rs | 1 + tests/run-make/compiler-lookup-paths-2/b.rs | 2 + tests/run-make/compiler-lookup-paths-2/c.rs | 3 + tests/run-make/compiler-lookup-paths/Makefile | 41 + tests/run-make/compiler-lookup-paths/a.rs | 1 + tests/run-make/compiler-lookup-paths/b.rs | 2 + tests/run-make/compiler-lookup-paths/c.rs | 2 + tests/run-make/compiler-lookup-paths/d.rs | 4 + tests/run-make/compiler-lookup-paths/e.rs | 2 + tests/run-make/compiler-lookup-paths/e2.rs | 4 + tests/run-make/compiler-lookup-paths/f.rs | 2 + tests/run-make/compiler-lookup-paths/native.c | 1 + tests/run-make/compiler-rt-works-on-mingw/Makefile | 9 + tests/run-make/compiler-rt-works-on-mingw/foo.cpp | 4 + tests/run-make/compiler-rt-works-on-mingw/foo.rs | 10 + tests/run-make/const_fn_mir/Makefile | 2 +- tests/run-make/const_fn_mir/dump.mir | 8 +- tests/run-make/core-no-fp-fmt-parse/Makefile | 4 + .../expected_show_coverage.abort.txt | 2 +- .../expected_show_coverage.closure.txt | 4 +- .../expected_show_coverage.continue.txt | 2 +- tests/run-make/coverage/abort.rs | 2 +- tests/run-make/coverage/coverage_tools.mk | 2 +- tests/run-make/crate-data-smoke/Makefile | 10 + tests/run-make/crate-data-smoke/crate.rs | 7 + tests/run-make/crate-data-smoke/lib.rs | 2 + tests/run-make/crate-data-smoke/rlib.rs | 2 + tests/run-make/crate-hash-rustc-version/Makefile | 38 + tests/run-make/crate-hash-rustc-version/a.rs | 4 + tests/run-make/crate-hash-rustc-version/b.rs | 8 + tests/run-make/crate-name-priority/Makefile | 12 + tests/run-make/crate-name-priority/foo.rs | 1 + tests/run-make/crate-name-priority/foo1.rs | 3 + tests/run-make/cross-lang-lto-clang/Makefile | 25 + tests/run-make/cross-lang-lto-clang/clib.c | 9 + tests/run-make/cross-lang-lto-clang/cmain.c | 12 + tests/run-make/cross-lang-lto-clang/main.rs | 11 + tests/run-make/cross-lang-lto-clang/rustlib.rs | 12 + .../run-make/cross-lang-lto-pgo-smoketest/Makefile | 87 ++ tests/run-make/cross-lang-lto-pgo-smoketest/clib.c | 9 + .../run-make/cross-lang-lto-pgo-smoketest/cmain.c | 12 + .../run-make/cross-lang-lto-pgo-smoketest/main.rs | 11 + .../cross-lang-lto-pgo-smoketest/rustlib.rs | 12 + .../cross-lang-lto-upstream-rlibs/Makefile | 32 + .../cross-lang-lto-upstream-rlibs/staticlib.rs | 8 + .../cross-lang-lto-upstream-rlibs/upstream.rs | 3 + tests/run-make/cross-lang-lto/Makefile | 57 ++ tests/run-make/cross-lang-lto/lib.rs | 4 + tests/run-make/cross-lang-lto/main.rs | 3 + tests/run-make/debug-assertions/Makefile | 26 + tests/run-make/debug-assertions/debug.rs | 33 + tests/run-make/dep-graph/Makefile | 2 +- tests/run-make/dep-info-doesnt-run-much/Makefile | 4 + tests/run-make/dep-info-doesnt-run-much/foo.rs | 5 + tests/run-make/dep-info-spaces/Makefile | 19 + tests/run-make/dep-info-spaces/Makefile.foo | 7 + tests/run-make/dep-info-spaces/bar.rs | 1 + tests/run-make/dep-info-spaces/foo foo.rs | 1 + tests/run-make/dep-info-spaces/lib.rs | 4 + tests/run-make/dep-info/Makefile | 25 + tests/run-make/dep-info/Makefile.foo | 7 + tests/run-make/dep-info/bar.rs | 1 + tests/run-make/dep-info/foo.rs | 1 + tests/run-make/dep-info/lib.rs | 4 + tests/run-make/dep-info/lib2.rs | 3 + tests/run-make/doctests-keep-binaries/Makefile | 22 + tests/run-make/doctests-keep-binaries/t.rs | 11 + tests/run-make/dump-mono-stats/Makefile | 2 +- tests/run-make/duplicate-output-flavors/Makefile | 5 + tests/run-make/duplicate-output-flavors/foo.rs | 1 + tests/run-make/dylib-chain/Makefile | 13 + tests/run-make/dylib-chain/m1.rs | 2 + tests/run-make/dylib-chain/m2.rs | 4 + tests/run-make/dylib-chain/m3.rs | 4 + tests/run-make/dylib-chain/m4.rs | 3 + tests/run-make/emit-named-files/Makefile | 2 +- tests/run-make/emit-path-unhashed/Makefile | 2 +- tests/run-make/emit-shared-files/Makefile | 2 +- tests/run-make/emit-stack-sizes/Makefile | 12 + tests/run-make/emit-stack-sizes/foo.rs | 3 + tests/run-make/emit/Makefile | 22 + tests/run-make/emit/test-24876.rs | 9 + tests/run-make/emit/test-26235.rs | 46 ++ tests/run-make/env-dep-info/Makefile | 2 +- .../error-found-staticlib-instead-crate/Makefile | 5 + .../error-found-staticlib-instead-crate/bar.rs | 5 + .../error-found-staticlib-instead-crate/foo.rs | 1 + tests/run-make/error-writing-dependencies/Makefile | 8 + tests/run-make/error-writing-dependencies/foo.rs | 1 + tests/run-make/exit-code/Makefile | 12 + tests/run-make/exit-code/compile-error.rs | 3 + tests/run-make/exit-code/lint-failure.rs | 6 + tests/run-make/exit-code/success.rs | 4 + tests/run-make/export-executable-symbols/Makefile | 2 +- tests/run-make/extern-diff-internal-name/Makefile | 6 + tests/run-make/extern-diff-internal-name/lib.rs | 2 + tests/run-make/extern-diff-internal-name/test.rs | 5 + tests/run-make/extern-flag-disambiguates/Makefile | 26 + tests/run-make/extern-flag-disambiguates/a.rs | 6 + tests/run-make/extern-flag-disambiguates/b.rs | 9 + tests/run-make/extern-flag-disambiguates/c.rs | 9 + tests/run-make/extern-flag-disambiguates/d.rs | 11 + tests/run-make/extern-flag-fun/Makefile | 20 + tests/run-make/extern-flag-fun/bar-alt.rs | 1 + tests/run-make/extern-flag-fun/bar.rs | 1 + tests/run-make/extern-flag-fun/foo.rs | 3 + tests/run-make/extern-flag-fun/gated_unstable.rs | 3 + tests/run-make/extern-flag-fun/rustc.rs | 1 + tests/run-make/extern-flag-pathless/Makefile | 19 + tests/run-make/extern-flag-pathless/bar-dynamic.rs | 3 + tests/run-make/extern-flag-pathless/bar-static.rs | 3 + tests/run-make/extern-flag-pathless/foo.rs | 3 + .../extern-flag-rename-transitive/Makefile | 7 + .../run-make/extern-flag-rename-transitive/bar.rs | 3 + .../run-make/extern-flag-rename-transitive/baz.rs | 4 + .../run-make/extern-flag-rename-transitive/foo.rs | 1 + tests/run-make/extern-fn-generic/Makefile | 7 + tests/run-make/extern-fn-generic/test.c | 16 + tests/run-make/extern-fn-generic/test.rs | 20 + tests/run-make/extern-fn-generic/testcrate.rs | 16 + tests/run-make/extern-fn-mangle/Makefile | 6 + tests/run-make/extern-fn-mangle/test.c | 8 + tests/run-make/extern-fn-mangle/test.rs | 19 + tests/run-make/extern-fn-reachable/Makefile | 26 + tests/run-make/extern-fn-reachable/dylib.rs | 14 + .../run-make/extern-fn-struct-passing-abi/Makefile | 6 + tests/run-make/extern-fn-struct-passing-abi/test.c | 314 +++++++ .../run-make/extern-fn-struct-passing-abi/test.rs | 138 ++++ .../run-make/extern-fn-with-extern-types/Makefile | 6 + tests/run-make/extern-fn-with-extern-types/ctest.c | 16 + tests/run-make/extern-fn-with-extern-types/test.rs | 17 + .../run-make/extern-fn-with-packed-struct/Makefile | 6 + tests/run-make/extern-fn-with-packed-struct/test.c | 26 + .../run-make/extern-fn-with-packed-struct/test.rs | 20 + tests/run-make/extern-fn-with-union/Makefile | 7 + tests/run-make/extern-fn-with-union/ctest.c | 10 + tests/run-make/extern-fn-with-union/test.rs | 19 + tests/run-make/extern-fn-with-union/testcrate.rs | 11 + tests/run-make/extern-multiple-copies/Makefile | 9 + tests/run-make/extern-multiple-copies/bar.rs | 6 + tests/run-make/extern-multiple-copies/foo1.rs | 1 + tests/run-make/extern-multiple-copies/foo2.rs | 1 + tests/run-make/extern-multiple-copies2/Makefile | 11 + tests/run-make/extern-multiple-copies2/bar.rs | 8 + tests/run-make/extern-multiple-copies2/foo1.rs | 7 + tests/run-make/extern-multiple-copies2/foo2.rs | 8 + .../extern-overrides-distribution/Makefile | 6 + .../run-make/extern-overrides-distribution/libc.rs | 3 + .../run-make/extern-overrides-distribution/main.rs | 5 + .../extra-filename-with-temp-outputs/Makefile | 7 + .../extra-filename-with-temp-outputs/foo.rs | 1 + tests/run-make/fmt-write-bloat/Makefile | 6 +- tests/run-make/foreign-double-unwind/Makefile | 11 + tests/run-make/foreign-double-unwind/foo.cpp | 33 + tests/run-make/foreign-double-unwind/foo.rs | 26 + tests/run-make/foreign-exceptions/Makefile | 11 + tests/run-make/foreign-exceptions/foo.cpp | 60 ++ tests/run-make/foreign-exceptions/foo.rs | 59 ++ tests/run-make/foreign-rust-exceptions/Makefile | 12 + tests/run-make/foreign-rust-exceptions/bar.rs | 7 + tests/run-make/foreign-rust-exceptions/foo.rs | 13 + tests/run-make/fpic/Makefile | 11 + tests/run-make/fpic/hello.rs | 1 + tests/run-make/glibc-staticlib-args/Makefile | 13 + tests/run-make/glibc-staticlib-args/library.rs | 4 + tests/run-make/glibc-staticlib-args/program.c | 6 + tests/run-make/hir-tree/Makefile | 8 + tests/run-make/hir-tree/input.rs | 3 + tests/run-make/include_bytes_deps/Makefile | 7 + tests/run-make/include_bytes_deps/input.bin | 1 + tests/run-make/include_bytes_deps/input.md | 1 + tests/run-make/include_bytes_deps/input.txt | 1 + tests/run-make/include_bytes_deps/main.rs | 10 + .../run-make/incr-add-rust-src-component/Makefile | 45 + tests/run-make/incr-add-rust-src-component/main.rs | 3 + tests/run-make/incr-foreign-head-span/Makefile | 2 +- tests/run-make/incr-prev-body-beyond-eof/Makefile | 2 +- tests/run-make/incremental-session-fail/Makefile | 2 +- tests/run-make/inline-always-many-cgu/Makefile | 8 + tests/run-make/inline-always-many-cgu/foo.rs | 15 + tests/run-make/interdependent-c-libraries/Makefile | 15 + tests/run-make/interdependent-c-libraries/bar.c | 3 + tests/run-make/interdependent-c-libraries/bar.rs | 14 + tests/run-make/interdependent-c-libraries/foo.c | 1 + tests/run-make/interdependent-c-libraries/foo.rs | 12 + tests/run-make/interdependent-c-libraries/main.rs | 6 + tests/run-make/intrinsic-unreachable/Makefile | 12 + tests/run-make/intrinsic-unreachable/exit-ret.rs | 14 + .../intrinsic-unreachable/exit-unreachable.rs | 18 + tests/run-make/invalid-library/Makefile | 6 + tests/run-make/invalid-library/foo.rs | 3 + tests/run-make/invalid-so/Makefile | 2 +- tests/run-make/invalid-staticlib/Makefile | 5 + tests/run-make/issue-10971-temps-dir/Makefile | 2 +- tests/run-make/issue-109934-lto-debuginfo/Makefile | 12 + tests/run-make/issue-109934-lto-debuginfo/lib.rs | 9 + tests/run-make/issue-11908/Makefile | 22 + tests/run-make/issue-11908/bar.rs | 3 + tests/run-make/issue-11908/foo.rs | 1 + tests/run-make/issue-14500/Makefile | 15 + tests/run-make/issue-14500/bar.rs | 1 + tests/run-make/issue-14500/foo.c | 7 + tests/run-make/issue-14500/foo.rs | 5 + tests/run-make/issue-14698/Makefile | 4 + tests/run-make/issue-14698/foo.rs | 1 + tests/run-make/issue-15460/Makefile | 7 + tests/run-make/issue-15460/bar.rs | 4 + tests/run-make/issue-15460/foo.c | 6 + tests/run-make/issue-15460/foo.rs | 6 + tests/run-make/issue-18943/Makefile | 7 + tests/run-make/issue-18943/foo.rs | 5 + tests/run-make/issue-20626/Makefile | 9 + tests/run-make/issue-20626/foo.rs | 13 + tests/run-make/issue-22131/Makefile | 8 + tests/run-make/issue-22131/foo.rs | 5 + tests/run-make/issue-24445/Makefile | 11 + tests/run-make/issue-24445/foo.c | 6 + tests/run-make/issue-24445/foo.rs | 15 + tests/run-make/issue-25581/Makefile | 6 + tests/run-make/issue-25581/test.c | 15 + tests/run-make/issue-25581/test.rs | 18 + tests/run-make/issue-26006/Makefile | 17 + tests/run-make/issue-26006/in/libc/lib.rs | 3 + tests/run-make/issue-26006/in/time/lib.rs | 4 + tests/run-make/issue-26092/Makefile | 6 + tests/run-make/issue-26092/blank.rs | 1 + tests/run-make/issue-28595/Makefile | 7 + tests/run-make/issue-28595/a.c | 1 + tests/run-make/issue-28595/a.rs | 6 + tests/run-make/issue-28595/b.c | 5 + tests/run-make/issue-28595/b.rs | 12 + tests/run-make/issue-28766/Makefile | 5 + tests/run-make/issue-28766/foo.rs | 8 + tests/run-make/issue-28766/main.rs | 7 + tests/run-make/issue-30063/Makefile | 36 + tests/run-make/issue-30063/foo.rs | 1 + tests/run-make/issue-33329/Makefile | 5 + tests/run-make/issue-33329/main.rs | 1 + tests/run-make/issue-35164/Makefile | 4 + tests/run-make/issue-35164/main.rs | 5 + tests/run-make/issue-35164/submodule/mod.rs | 3 + tests/run-make/issue-36710/Makefile | 4 +- tests/run-make/issue-37839/Makefile | 7 + tests/run-make/issue-37839/a.rs | 2 + tests/run-make/issue-37839/b.rs | 2 + tests/run-make/issue-37839/c.rs | 2 + tests/run-make/issue-37893/Makefile | 5 + tests/run-make/issue-37893/a.rs | 2 + tests/run-make/issue-37893/b.rs | 2 + tests/run-make/issue-37893/c.rs | 3 + tests/run-make/issue-38237/Makefile | 6 + tests/run-make/issue-38237/bar.rs | 4 + tests/run-make/issue-38237/baz.rs | 8 + tests/run-make/issue-38237/foo.rs | 9 + tests/run-make/issue-40535/Makefile | 13 + tests/run-make/issue-40535/bar.rs | 3 + tests/run-make/issue-40535/baz.rs | 1 + tests/run-make/issue-40535/foo.rs | 4 + tests/run-make/issue-46239/Makefile | 6 + tests/run-make/issue-46239/main.rs | 8 + tests/run-make/issue-47384/Makefile | 2 +- tests/run-make/issue-47551/Makefile | 9 + tests/run-make/issue-47551/eh_frame-terminator.rs | 22 + tests/run-make/issue-51671/Makefile | 9 + tests/run-make/issue-51671/app.rs | 20 + tests/run-make/issue-53964/Makefile | 5 + tests/run-make/issue-53964/app.rs | 8 + tests/run-make/issue-53964/panic.rs | 10 + tests/run-make/issue-64153/Makefile | 26 + tests/run-make/issue-64153/downstream.rs | 6 + tests/run-make/issue-64153/upstream.rs | 6 + .../issue-68794-textrel-on-minimal-lib/Makefile | 18 + .../issue-68794-textrel-on-minimal-lib/bar.c | 6 + .../issue-68794-textrel-on-minimal-lib/foo.rs | 8 + tests/run-make/issue-69368/Makefile | 19 + tests/run-make/issue-69368/a.rs | 26 + tests/run-make/issue-69368/b.rs | 8 + tests/run-make/issue-69368/c.rs | 34 + tests/run-make/issue-71519/Makefile | 2 +- tests/run-make/issue-7349/Makefile | 11 + tests/run-make/issue-7349/foo.rs | 22 + tests/run-make/issue-83045/Makefile | 33 + tests/run-make/issue-83045/a.rs | 1 + tests/run-make/issue-83045/b.rs | 1 + tests/run-make/issue-83045/c.rs | 1 + .../issue-83112-incr-test-moved-file/Makefile | 2 +- .../issue-84395-lto-embed-bitcode/Makefile | 11 + .../run-make/issue-84395-lto-embed-bitcode/test.rs | 3 + tests/run-make/issue-85019-moved-src-dir/Makefile | 2 +- tests/run-make/issue-85401-static-mir/Makefile | 2 +- tests/run-make/issue-85441/Makefile | 2 +- tests/run-make/issue-88756-default-output/Makefile | 2 +- tests/run-make/issue-96498/Makefile | 2 +- .../issue-97463-abi-param-passing/Makefile | 15 + tests/run-make/issue-97463-abi-param-passing/bad.c | 24 + .../issue-97463-abi-param-passing/param_passing.rs | 38 + tests/run-make/issue64319/Makefile | 40 + tests/run-make/issue64319/bar.rs | 5 + tests/run-make/issue64319/foo.rs | 9 + tests/run-make/jobserver-error/Makefile | 9 + tests/run-make/jobserver-error/jobserver.stderr | 4 + tests/run-make/libs-through-symlinks/Makefile | 12 + tests/run-make/libs-through-symlinks/bar.rs | 3 + tests/run-make/libs-through-symlinks/foo.rs | 2 + tests/run-make/libtest-json/Makefile | 19 + tests/run-make/libtest-json/f.rs | 22 + tests/run-make/libtest-json/output-default.json | 10 + .../libtest-json/output-stdout-success.json | 10 + tests/run-make/libtest-json/validate_json.py | 8 + tests/run-make/libtest-thread-limit/Makefile | 2 +- tests/run-make/libtest-thread-limit/test.rs | 2 - tests/run-make/link-arg/Makefile | 5 + tests/run-make/link-arg/empty.rs | 1 + tests/run-make/link-args-order/Makefile | 10 + tests/run-make/link-args-order/empty.rs | 1 + tests/run-make/link-cfg/Makefile | 23 + tests/run-make/link-cfg/dep-with-staticlib.rs | 8 + tests/run-make/link-cfg/dep.rs | 8 + tests/run-make/link-cfg/no-deps.rs | 20 + tests/run-make/link-cfg/return1.c | 6 + tests/run-make/link-cfg/return2.c | 6 + tests/run-make/link-cfg/return3.c | 6 + tests/run-make/link-cfg/with-deps.rs | 14 + tests/run-make/link-cfg/with-staticlib-deps.rs | 14 + tests/run-make/link-dedup/Makefile | 12 + tests/run-make/link-dedup/depa.rs | 10 + tests/run-make/link-dedup/depb.rs | 8 + tests/run-make/link-dedup/depc.rs | 4 + tests/run-make/link-dedup/empty.rs | 5 + tests/run-make/link-path-order/Makefile | 19 + tests/run-make/link-path-order/correct.c | 1 + tests/run-make/link-path-order/main.rs | 16 + tests/run-make/link-path-order/wrong.c | 1 + tests/run-make/linkage-attr-on-static/Makefile | 6 + tests/run-make/linkage-attr-on-static/bar.rs | 16 + tests/run-make/linkage-attr-on-static/foo.c | 7 + tests/run-make/llvm-outputs/Makefile | 2 +- .../long-linker-command-lines-cmd-exe/Makefile | 7 + .../long-linker-command-lines-cmd-exe/foo.bat | 1 + .../long-linker-command-lines-cmd-exe/foo.rs | 101 +++ tests/run-make/long-linker-command-lines/Makefile | 6 + tests/run-make/long-linker-command-lines/foo.rs | 106 +++ tests/run-make/longjmp-across-rust/Makefile | 6 + tests/run-make/longjmp-across-rust/foo.c | 18 + tests/run-make/longjmp-across-rust/main.rs | 29 + tests/run-make/ls-metadata/Makefile | 8 + tests/run-make/ls-metadata/foo.rs | 1 + tests/run-make/lto-dylib-dep/Makefile | 11 + tests/run-make/lto-dylib-dep/a_dylib.rs | 3 + tests/run-make/lto-dylib-dep/main.rs | 5 + tests/run-make/lto-empty/Makefile | 13 + tests/run-make/lto-empty/lib.rs | 1 + tests/run-make/lto-no-link-whole-rlib/Makefile | 9 + tests/run-make/lto-no-link-whole-rlib/bar.c | 3 + tests/run-make/lto-no-link-whole-rlib/foo.c | 3 + tests/run-make/lto-no-link-whole-rlib/lib1.rs | 10 + tests/run-make/lto-no-link-whole-rlib/lib2.rs | 12 + tests/run-make/lto-no-link-whole-rlib/main.rs | 7 + tests/run-make/lto-readonly-lib/Makefile | 13 + tests/run-make/lto-readonly-lib/lib.rs | 1 + tests/run-make/lto-readonly-lib/main.rs | 3 + tests/run-make/lto-smoke-c/Makefile | 12 + tests/run-make/lto-smoke-c/bar.c | 6 + tests/run-make/lto-smoke-c/foo.rs | 4 + tests/run-make/lto-smoke/Makefile | 31 + tests/run-make/lto-smoke/lib.rs | 1 + tests/run-make/lto-smoke/main.rs | 3 + tests/run-make/macos-deployment-target/Makefile | 2 +- tests/run-make/macos-fat-archive/Makefile | 2 +- tests/run-make/manual-crate-name/Makefile | 5 + tests/run-make/manual-crate-name/bar.rs | 1 + tests/run-make/manual-link/Makefile | 7 + tests/run-make/manual-link/bar.c | 1 + tests/run-make/manual-link/foo.c | 1 + tests/run-make/manual-link/foo.rs | 11 + tests/run-make/manual-link/main.rs | 5 + tests/run-make/many-crates-but-no-match/Makefile | 35 + tests/run-make/many-crates-but-no-match/crateA1.rs | 4 + tests/run-make/many-crates-but-no-match/crateA2.rs | 4 + tests/run-make/many-crates-but-no-match/crateA3.rs | 4 + tests/run-make/many-crates-but-no-match/crateB.rs | 1 + tests/run-make/many-crates-but-no-match/crateC.rs | 3 + .../run-make/metadata-flag-frobs-symbols/Makefile | 11 + tests/run-make/metadata-flag-frobs-symbols/bar.rs | 8 + tests/run-make/metadata-flag-frobs-symbols/foo.rs | 6 + tests/run-make/min-global-align/Makefile | 22 + .../run-make/min-global-align/min_global_align.rs | 32 + .../run-make/mingw-export-call-convention/Makefile | 9 + tests/run-make/mingw-export-call-convention/foo.rs | 4 + tests/run-make/mismatching-target-triples/Makefile | 11 + tests/run-make/mismatching-target-triples/bar.rs | 3 + tests/run-make/mismatching-target-triples/foo.rs | 3 + tests/run-make/missing-crate-dependency/Makefile | 9 + tests/run-make/missing-crate-dependency/crateA.rs | 2 + tests/run-make/missing-crate-dependency/crateB.rs | 1 + tests/run-make/missing-crate-dependency/crateC.rs | 3 + tests/run-make/mixing-deps/Makefile | 8 + tests/run-make/mixing-deps/both.rs | 4 + tests/run-make/mixing-deps/dylib.rs | 6 + tests/run-make/mixing-deps/prog.rs | 9 + tests/run-make/mixing-formats/Makefile | 75 ++ tests/run-make/mixing-formats/bar1.rs | 1 + tests/run-make/mixing-formats/bar2.rs | 1 + tests/run-make/mixing-formats/baz.rs | 3 + tests/run-make/mixing-formats/baz2.rs | 4 + tests/run-make/mixing-formats/foo.rs | 1 + tests/run-make/mixing-libs/Makefile | 10 + tests/run-make/mixing-libs/dylib.rs | 4 + tests/run-make/mixing-libs/prog.rs | 7 + tests/run-make/mixing-libs/rlib.rs | 2 + tests/run-make/msvc-opt-minsize/Makefile | 6 + tests/run-make/msvc-opt-minsize/foo.rs | 19 + tests/run-make/multiple-emits/Makefile | 7 + tests/run-make/multiple-emits/foo.rs | 1 + .../run-make/native-link-modifier-bundle/Makefile | 2 +- .../native-link-modifier-verbatim-linker/Makefile | 2 +- .../native-link-modifier-verbatim-rustc/Makefile | 2 +- .../native-link-modifier-whole-archive/Makefile | 2 +- tests/run-make/no-builtins-lto/Makefile | 9 + tests/run-make/no-builtins-lto/main.rs | 3 + tests/run-make/no-builtins-lto/no_builtins.rs | 2 + tests/run-make/no-duplicate-libs/Makefile | 11 + tests/run-make/no-duplicate-libs/bar.c | 5 + tests/run-make/no-duplicate-libs/foo.c | 1 + tests/run-make/no-duplicate-libs/main.rs | 10 + tests/run-make/no-input-file/Makefile | 2 +- tests/run-make/no-intermediate-extras/Makefile | 8 + tests/run-make/no-intermediate-extras/foo.rs | 1 + tests/run-make/obey-crate-type-flag/Makefile | 14 + tests/run-make/obey-crate-type-flag/test.rs | 2 + .../Makefile | 7 + .../foo.rs | 1 + .../output-filename-overwrites-input/Makefile | 14 + .../output-filename-overwrites-input/bar.rs | 1 + .../output-filename-overwrites-input/foo.rs | 1 + tests/run-make/output-type-permutations/Makefile | 147 ++++ tests/run-make/output-type-permutations/foo.rs | 3 + tests/run-make/output-with-hyphens/Makefile | 8 + tests/run-make/output-with-hyphens/foo-bar.rs | 1 + tests/run-make/override-aliased-flags/Makefile | 23 + tests/run-make/override-aliased-flags/main.rs | 1 + tests/run-make/overwrite-input/Makefile | 2 +- tests/run-make/panic-impl-transitive/Makefile | 7 + .../panic-impl-transitive/panic-impl-consumer.rs | 5 + .../panic-impl-transitive/panic-impl-provider.rs | 9 + tests/run-make/pass-linker-flags-from-dep/Makefile | 2 +- tests/run-make/pass-linker-flags/Makefile | 2 +- tests/run-make/pass-non-c-like-enum-to-c/Makefile | 6 + .../run-make/pass-non-c-like-enum-to-c/nonclike.rs | 21 + tests/run-make/pass-non-c-like-enum-to-c/test.c | 85 ++ tests/run-make/pgo-branch-weights/Makefile | 34 + .../pgo-branch-weights/filecheck-patterns.txt | 24 + tests/run-make/pgo-branch-weights/interesting.rs | 40 + tests/run-make/pgo-branch-weights/main.rs | 17 + tests/run-make/pgo-branch-weights/opaque.rs | 6 + tests/run-make/pgo-gen-lto/Makefile | 14 + tests/run-make/pgo-gen-lto/test.rs | 1 + tests/run-make/pgo-gen-no-imp-symbols/Makefile | 13 + tests/run-make/pgo-gen-no-imp-symbols/test.rs | 1 + tests/run-make/pgo-gen/Makefile | 14 + tests/run-make/pgo-gen/test.rs | 1 + .../run-make/pgo-indirect-call-promotion/Makefile | 26 + .../filecheck-patterns.txt | 16 + .../pgo-indirect-call-promotion/interesting.rs | 56 ++ tests/run-make/pgo-indirect-call-promotion/main.rs | 14 + .../run-make/pgo-indirect-call-promotion/opaque.rs | 7 + tests/run-make/pgo-use/Makefile | 46 ++ tests/run-make/pgo-use/filecheck-patterns.txt | 11 + tests/run-make/pgo-use/main.rs | 23 + tests/run-make/pointer-auth-link-with-c/Makefile | 14 + tests/run-make/pointer-auth-link-with-c/test.c | 1 + tests/run-make/pointer-auth-link-with-c/test.rs | 8 + tests/run-make/prefer-dylib/Makefile | 9 + tests/run-make/prefer-dylib/bar.rs | 1 + tests/run-make/prefer-dylib/foo.rs | 5 + tests/run-make/prefer-rlib/Makefile | 9 + tests/run-make/prefer-rlib/bar.rs | 1 + tests/run-make/prefer-rlib/foo.rs | 5 + tests/run-make/pretty-print-to-file/Makefile | 5 + tests/run-make/pretty-print-to-file/input.pp | 3 + tests/run-make/pretty-print-to-file/input.rs | 5 + tests/run-make/print-calling-conventions/Makefile | 4 + tests/run-make/print-cfg/Makefile | 20 + tests/run-make/print-target-list/Makefile | 8 + tests/run-make/profile/Makefile | 12 + tests/run-make/profile/test.rs | 1 + tests/run-make/prune-link-args/Makefile | 10 + tests/run-make/prune-link-args/empty.rs | 1 + .../raw-dylib-alt-calling-convention/Makefile | 2 +- tests/run-make/raw-dylib-c/Makefile | 2 +- .../run-make/raw-dylib-cross-compilation/Makefile | 22 + tests/run-make/raw-dylib-cross-compilation/lib.rs | 20 + tests/run-make/raw-dylib-import-name-type/Makefile | 2 +- .../run-make/raw-dylib-inline-cross-dylib/Makefile | 2 +- tests/run-make/raw-dylib-link-ordinal/Makefile | 2 +- tests/run-make/raw-dylib-stdcall-ordinal/Makefile | 2 +- tests/run-make/redundant-libs/Makefile | 24 + tests/run-make/redundant-libs/bar.c | 1 + tests/run-make/redundant-libs/baz.c | 7 + tests/run-make/redundant-libs/foo.c | 2 + tests/run-make/redundant-libs/main.rs | 11 + tests/run-make/relocation-model/Makefile | 20 + tests/run-make/relocation-model/foo.rs | 1 + tests/run-make/relro-levels/Makefile | 22 + tests/run-make/relro-levels/hello.rs | 3 + tests/run-make/remap-path-prefix-dwarf/Makefile | 2 +- tests/run-make/remap-path-prefix/Makefile | 9 + tests/run-make/remap-path-prefix/auxiliary/lib.rs | 3 + tests/run-make/repr128-dwarf/Makefile | 2 +- tests/run-make/reproducible-build-2/Makefile | 27 + tests/run-make/reproducible-build-2/linker.rs | 44 + .../reproducible-build-2/reproducible-build-aux.rs | 28 + .../reproducible-build-2/reproducible-build.rs | 116 +++ tests/run-make/reproducible-build/Makefile | 140 ++++ tests/run-make/reproducible-build/linker.rs | 50 ++ .../reproducible-build/reproducible-build-aux.rs | 28 + .../reproducible-build/reproducible-build.rs | 116 +++ tests/run-make/resolve-rename/Makefile | 7 + tests/run-make/resolve-rename/bar.rs | 5 + tests/run-make/resolve-rename/baz.rs | 5 + tests/run-make/resolve-rename/foo.rs | 3 + .../return-non-c-like-enum-from-c/Makefile | 6 + .../return-non-c-like-enum-from-c/nonclike.rs | 31 + .../run-make/return-non-c-like-enum-from-c/test.c | 61 ++ tests/run-make/return-non-c-like-enum/Makefile | 8 + tests/run-make/return-non-c-like-enum/nonclike.rs | 21 + tests/run-make/return-non-c-like-enum/test.c | 63 ++ tests/run-make/rlib-chain/Makefile | 11 + tests/run-make/rlib-chain/m1.rs | 2 + tests/run-make/rlib-chain/m2.rs | 4 + tests/run-make/rlib-chain/m3.rs | 4 + tests/run-make/rlib-chain/m4.rs | 3 + .../rlib-format-packed-bundled-libs-2/Makefile | 2 +- .../rlib-format-packed-bundled-libs-3/Makefile | 2 +- .../rlib-format-packed-bundled-libs/Makefile | 2 +- tests/run-make/rustc-macro-dep-files/Makefile | 2 +- tests/run-make/rustdoc-determinism/Makefile | 16 + tests/run-make/rustdoc-determinism/bar.rs | 1 + tests/run-make/rustdoc-determinism/foo.rs | 1 + tests/run-make/rustdoc-error-lines/Makefile | 13 + tests/run-make/rustdoc-error-lines/input.rs | 28 + tests/run-make/rustdoc-io-error/Makefile | 20 + tests/run-make/rustdoc-io-error/foo.rs | 1 + tests/run-make/rustdoc-map-file/Makefile | 5 + tests/run-make/rustdoc-map-file/expected.json | 5 + tests/run-make/rustdoc-map-file/foo.rs | 16 + tests/run-make/rustdoc-map-file/validate_json.py | 41 + tests/run-make/rustdoc-output-path/Makefile | 4 + tests/run-make/rustdoc-output-path/foo.rs | 1 + .../rustdoc-scrape-examples-macros/Makefile | 19 + .../rustdoc-scrape-examples-macros/examples/ex.rs | 27 + .../rustdoc-scrape-examples-macros/src/lib.rs | 12 + .../rustdoc-scrape-examples-macros/src/proc.rs | 39 + .../rustdoc-scrape-examples-multiple/scrape.mk | 2 +- tests/run-make/rustdoc-shared-flags/Makefile | 18 + .../rustdoc-target-spec-json-path/Makefile | 9 + .../rustdoc-target-spec-json-path/dummy_core.rs | 2 + .../rustdoc-target-spec-json-path/my_crate.rs | 3 + .../rustdoc-target-spec-json-path/target.json | 38 + tests/run-make/rustdoc-themes/Makefile | 10 + tests/run-make/rustdoc-themes/foo.rs | 4 + .../run-make/rustdoc-verify-output-files/Makefile | 20 +- .../run-make/rustdoc-with-out-dir-option/Makefile | 2 +- tests/run-make/rustdoc-with-output-option/Makefile | 2 +- .../rustdoc-with-short-out-dir-option/Makefile | 2 +- tests/run-make/sanitizer-cdylib-link/Makefile | 16 + tests/run-make/sanitizer-cdylib-link/library.rs | 5 + tests/run-make/sanitizer-cdylib-link/program.rs | 7 + tests/run-make/sanitizer-dylib-link/Makefile | 16 + tests/run-make/sanitizer-dylib-link/library.rs | 5 + tests/run-make/sanitizer-dylib-link/program.rs | 7 + tests/run-make/sanitizer-staticlib-link/Makefile | 20 + tests/run-make/sanitizer-staticlib-link/library.rs | 5 + tests/run-make/sanitizer-staticlib-link/program.c | 6 + tests/run-make/sanitizer-staticlib-link/program.rs | 10 + tests/run-make/separate-link-fail/Makefile | 7 + tests/run-make/separate-link/Makefile | 7 + tests/run-make/sepcomp-cci-copies/Makefile | 12 + tests/run-make/sepcomp-cci-copies/cci_lib.rs | 6 + tests/run-make/sepcomp-cci-copies/foo.rs | 25 + tests/run-make/sepcomp-inlining/Makefile | 15 + tests/run-make/sepcomp-inlining/foo.rs | 30 + tests/run-make/sepcomp-separate/Makefile | 9 + tests/run-make/sepcomp-separate/foo.rs | 21 + tests/run-make/share-generics-dylib/Makefile | 23 + .../share-generics-dylib/instance_provider_a.rs | 6 + .../share-generics-dylib/instance_provider_b.rs | 6 + .../share-generics-dylib/instance_user_a_rlib.rs | 9 + .../share-generics-dylib/instance_user_b_rlib.rs | 9 + .../share-generics-dylib/instance_user_dylib.rs | 7 + tests/run-make/share-generics-dylib/linked_leaf.rs | 15 + tests/run-make/simd-ffi/Makefile | 47 ++ tests/run-make/simd-ffi/simd.rs | 82 ++ tests/run-make/simple-dylib/Makefile | 6 + tests/run-make/simple-dylib/bar.rs | 1 + tests/run-make/simple-dylib/foo.rs | 5 + tests/run-make/simple-rlib/Makefile | 6 + tests/run-make/simple-rlib/bar.rs | 1 + tests/run-make/simple-rlib/foo.rs | 5 + tests/run-make/split-debuginfo/Makefile | 309 +++++++ tests/run-make/split-debuginfo/bar.rs | 13 + tests/run-make/split-debuginfo/baz.rs | 1 + tests/run-make/split-debuginfo/foo.rs | 15 + tests/run-make/split-debuginfo/main.rs | 8 + tests/run-make/stable-symbol-names/Makefile | 41 + .../stable-symbol-names/stable-symbol-names1.rs | 31 + .../stable-symbol-names/stable-symbol-names2.rs | 17 + tests/run-make/static-dylib-by-default/Makefile | 17 + tests/run-make/static-dylib-by-default/bar.rs | 8 + tests/run-make/static-dylib-by-default/foo.rs | 4 + tests/run-make/static-dylib-by-default/main.c | 6 + tests/run-make/static-extern-type/Makefile | 6 + tests/run-make/static-extern-type/define-foo.c | 11 + tests/run-make/static-extern-type/use-foo.rs | 14 + tests/run-make/static-pie/Makefile | 4 +- tests/run-make/static-unwinding/Makefile | 7 + tests/run-make/static-unwinding/lib.rs | 15 + tests/run-make/static-unwinding/main.rs | 24 + tests/run-make/staticlib-blank-lib/Makefile | 6 + tests/run-make/staticlib-blank-lib/foo.rs | 6 + tests/run-make/std-core-cycle/Makefile | 17 + tests/run-make/std-core-cycle/bar.rs | 16 + tests/run-make/std-core-cycle/foo.rs | 11 + tests/run-make/stdin-non-utf8/Makefile | 6 + tests/run-make/stdin-non-utf8/non-utf8 | 1 + tests/run-make/suspicious-library/Makefile | 8 + tests/run-make/suspicious-library/bar.rs | 3 + tests/run-make/suspicious-library/foo.rs | 3 + tests/run-make/symbol-visibility/Makefile | 123 +++ tests/run-make/symbol-visibility/a_cdylib.rs | 12 + tests/run-make/symbol-visibility/a_proc_macro.rs | 9 + tests/run-make/symbol-visibility/a_rust_dylib.rs | 15 + tests/run-make/symbol-visibility/an_executable.rs | 7 + tests/run-make/symbol-visibility/an_rlib.rs | 12 + tests/run-make/symbols-include-type-name/Makefile | 9 + tests/run-make/symbols-include-type-name/lib.rs | 14 + tests/run-make/symlinked-extern/Makefile | 12 + tests/run-make/symlinked-extern/bar.rs | 6 + tests/run-make/symlinked-extern/baz.rs | 6 + tests/run-make/symlinked-extern/foo.rs | 5 + tests/run-make/symlinked-libraries/Makefile | 11 + tests/run-make/symlinked-libraries/bar.rs | 5 + tests/run-make/symlinked-libraries/foo.rs | 3 + tests/run-make/symlinked-rlib/Makefile | 10 + tests/run-make/symlinked-rlib/bar.rs | 5 + tests/run-make/symlinked-rlib/foo.rs | 1 + .../run-make/sysroot-crates-are-unstable/Makefile | 2 + tests/run-make/sysroot-crates-are-unstable/test.py | 75 ++ tests/run-make/target-cpu-native/Makefile | 20 + tests/run-make/target-cpu-native/foo.rs | 2 + tests/run-make/target-specs/Makefile | 11 + .../definitely-not-builtin-target.json | 7 + tests/run-make/target-specs/foo.rs | 24 + .../target-specs/mismatching-data-layout.json | 6 + .../run-make/target-specs/my-awesome-platform.json | 11 + .../target-specs/my-incomplete-platform.json | 10 + .../run-make/target-specs/my-invalid-platform.json | 1 + .../my-x86_64-unknown-linux-gnu-platform.json | 12 + tests/run-make/target-without-atomic-cas/Makefile | 5 + tests/run-make/test-benches/Makefile | 2 +- tests/run-make/test-harness/Makefile | 9 + tests/run-make/test-harness/test-ignore-cfg.rs | 9 + tests/run-make/thumb-none-cortex-m/Makefile | 2 +- tests/run-make/thumb-none-qemu/Makefile | 2 +- tests/run-make/tools.mk | 187 +++++ tests/run-make/track-path-dep-info/Makefile | 2 +- tests/run-make/track-pgo-dep-info/Makefile | 2 +- tests/run-make/translation/Makefile | 18 +- .../type-mismatch-same-crate-name/Makefile | 19 + .../type-mismatch-same-crate-name/crateA.rs | 16 + .../type-mismatch-same-crate-name/crateB.rs | 4 + .../type-mismatch-same-crate-name/crateC.rs | 25 + tests/run-make/unstable-flag-required/Makefile | 2 +- tests/run-make/use-extern-for-plugins/Makefile | 17 + tests/run-make/use-extern-for-plugins/bar.rs | 9 + tests/run-make/use-extern-for-plugins/baz.rs | 8 + tests/run-make/use-extern-for-plugins/foo.rs | 8 + tests/run-make/use-suggestions-rust-2018/Makefile | 7 + .../use-suggestions-rust-2018/ep-nested-lib.rs | 7 + .../use-suggestions-rust-2018/use-suggestions.rs | 3 + tests/run-make/used-cdylib-macos/Makefile | 11 + tests/run-make/used-cdylib-macos/dylib_used.rs | 4 + tests/run-make/used/Makefile | 7 + tests/run-make/used/used.rs | 6 + tests/run-make/valid-print-requests/Makefile | 2 +- .../valid-print-requests.stderr | 2 +- tests/run-make/version/Makefile | 6 + tests/run-make/volatile-intrinsics/Makefile | 10 + tests/run-make/volatile-intrinsics/main.rs | 24 + tests/run-make/wasm-abi/Makefile | 2 +- tests/run-make/wasm-custom-section/Makefile | 2 +- tests/run-make/wasm-custom-sections-opt/Makefile | 2 +- tests/run-make/wasm-export-all-symbols/Makefile | 2 +- tests/run-make/wasm-import-module/Makefile | 2 +- tests/run-make/wasm-panic-small/Makefile | 2 +- tests/run-make/wasm-spurious-import/Makefile | 2 +- tests/run-make/wasm-stringify-ints-small/Makefile | 2 +- .../wasm-symbols-different-module/Makefile | 2 +- tests/run-make/wasm-symbols-not-exported/Makefile | 2 +- tests/run-make/wasm-symbols-not-imported/Makefile | 2 +- tests/run-make/weird-output-filenames/Makefile | 15 + tests/run-make/weird-output-filenames/foo.rs | 1 + .../windows-binary-no-external-deps/Makefile | 9 + .../windows-binary-no-external-deps/hello.rs | 3 + tests/run-make/windows-spawn/Makefile | 8 + tests/run-make/windows-spawn/hello.rs | 3 + tests/run-make/windows-spawn/spawn.rs | 12 + tests/run-make/windows-subsystem/Makefile | 6 + tests/run-make/windows-subsystem/console.rs | 3 + tests/run-make/windows-subsystem/windows.rs | 3 + .../x86_64-fortanix-unknown-sgx-lvi/Makefile | 2 +- .../cc_plus_one_asm.checks | 5 +- .../cc_plus_one_c_asm.checks | 2 +- .../cc_plus_one_cxx_asm.checks | 2 +- .../cmake_plus_one_asm.checks | 2 +- .../cmake_plus_one_c_asm.checks | 2 +- .../cmake_plus_one_cxx_asm.checks | 2 +- .../x86_64-fortanix-unknown-sgx-lvi/jumpto.checks | 22 +- .../x86_64-fortanix-unknown-sgx-lvi/print.checks | 1 - .../x86_64-fortanix-unknown-sgx-lvi/script.sh | 35 +- .../unw_getcontext.checks | 2 +- tests/rustdoc-gui/anchor-navigable.goml | 2 +- tests/rustdoc-gui/anchors.goml | 8 +- .../auto-hide-trait-implementations.goml | 13 - tests/rustdoc-gui/basic-code.goml | 2 +- tests/rustdoc-gui/check-code-blocks-margin.goml | 2 +- tests/rustdoc-gui/check-stab-in-docblock.goml | 4 +- tests/rustdoc-gui/check_info_sign_position.goml | 4 +- tests/rustdoc-gui/code-blocks-overflow.goml | 4 +- tests/rustdoc-gui/code-color.goml | 4 +- tests/rustdoc-gui/code-sidebar-toggle.goml | 4 +- tests/rustdoc-gui/code-tags.goml | 12 +- tests/rustdoc-gui/codeblock-sub.goml | 2 +- tests/rustdoc-gui/codeblock-tooltip.goml | 4 +- tests/rustdoc-gui/cursor.goml | 6 +- tests/rustdoc-gui/default-settings.goml | 2 +- tests/rustdoc-gui/docblock-big-code-mobile.goml | 4 +- .../docblock-code-block-line-number.goml | 4 +- tests/rustdoc-gui/docblock-details.goml | 4 +- tests/rustdoc-gui/docblock-table-overflow.goml | 4 +- tests/rustdoc-gui/docblock-table.goml | 4 +- tests/rustdoc-gui/duplicate-macro-reexport.goml | 2 +- tests/rustdoc-gui/enum-variants.goml | 2 +- tests/rustdoc-gui/escape-key.goml | 2 +- tests/rustdoc-gui/extend-css.goml | 5 + tests/rustdoc-gui/font-weight.goml | 8 +- tests/rustdoc-gui/go-to-collapsed-elem.goml | 40 + tests/rustdoc-gui/hash-item-expansion.goml | 2 +- tests/rustdoc-gui/headers-color.goml | 12 +- tests/rustdoc-gui/headings.goml | 16 +- tests/rustdoc-gui/help-page.goml | 16 +- tests/rustdoc-gui/highlight-colors.goml | 4 +- .../rustdoc-gui/huge-collection-of-constants.goml | 2 +- tests/rustdoc-gui/huge-logo.goml | 16 +- tests/rustdoc-gui/impl-default-expansion.goml | 2 +- tests/rustdoc-gui/impl-doc.goml | 2 +- tests/rustdoc-gui/implementors.goml | 10 +- tests/rustdoc-gui/item-decl-colors.goml | 6 +- tests/rustdoc-gui/item-info-alignment.goml | 6 +- tests/rustdoc-gui/item-info-overflow.goml | 6 +- tests/rustdoc-gui/item-info.goml | 6 +- tests/rustdoc-gui/item-summary-table.goml | 2 +- tests/rustdoc-gui/javascript-disabled.goml | 2 +- tests/rustdoc-gui/jump-to-def-background.goml | 4 +- tests/rustdoc-gui/label-next-to-symbol.goml | 6 +- tests/rustdoc-gui/links-color.goml | 4 +- tests/rustdoc-gui/list_code_block.goml | 4 +- tests/rustdoc-gui/method-margins.goml | 2 +- tests/rustdoc-gui/mobile.goml | 12 +- tests/rustdoc-gui/module-items-font.goml | 2 +- tests/rustdoc-gui/no-docblock.goml | 4 +- tests/rustdoc-gui/notable-trait.goml | 18 +- .../rustdoc-gui/overflow-tooltip-information.goml | 2 +- tests/rustdoc-gui/pocket-menu.goml | 10 +- tests/rustdoc-gui/run-on-hover.goml | 4 +- tests/rustdoc-gui/rust-logo.goml | 14 +- .../rustdoc-gui/scrape-examples-button-focus.goml | 12 +- tests/rustdoc-gui/scrape-examples-color.goml | 8 +- tests/rustdoc-gui/scrape-examples-fonts.goml | 2 +- tests/rustdoc-gui/scrape-examples-layout.goml | 4 +- tests/rustdoc-gui/scrape-examples-toggle.goml | 4 +- tests/rustdoc-gui/search-error.goml | 4 +- tests/rustdoc-gui/search-filter.goml | 10 +- tests/rustdoc-gui/search-form-elements.goml | 8 +- tests/rustdoc-gui/search-input-mobile.goml | 6 +- tests/rustdoc-gui/search-keyboard.goml | 2 +- tests/rustdoc-gui/search-no-result.goml | 4 +- tests/rustdoc-gui/search-reexport.goml | 4 +- tests/rustdoc-gui/search-result-color.goml | 12 +- tests/rustdoc-gui/search-result-description.goml | 2 +- tests/rustdoc-gui/search-result-display.goml | 12 +- tests/rustdoc-gui/search-result-go-to-first.goml | 6 +- tests/rustdoc-gui/search-result-keyword.goml | 2 +- .../search-tab-change-title-fn-sig.goml | 10 +- tests/rustdoc-gui/search-tab.goml | 4 +- .../setting-auto-hide-content-large-items.goml | 51 ++ .../setting-auto-hide-item-methods-docs.goml | 48 ++ .../setting-auto-hide-trait-implementations.goml | 47 ++ tests/rustdoc-gui/setting-go-to-only-result.goml | 63 ++ tests/rustdoc-gui/settings.goml | 87 +- tests/rustdoc-gui/shortcuts.goml | 2 +- tests/rustdoc-gui/sidebar-links-color.goml | 4 +- tests/rustdoc-gui/sidebar-macro-reexport.goml | 2 +- tests/rustdoc-gui/sidebar-mobile-scroll.goml | 43 +- tests/rustdoc-gui/sidebar-mobile.goml | 6 +- tests/rustdoc-gui/sidebar-source-code-display.goml | 24 +- tests/rustdoc-gui/sidebar-source-code.goml | 12 +- tests/rustdoc-gui/sidebar.goml | 32 +- tests/rustdoc-gui/source-anchor-scroll.goml | 4 +- .../rustdoc-gui/source-code-page-code-scroll.goml | 8 + tests/rustdoc-gui/source-code-page.goml | 19 +- tests/rustdoc-gui/src-font-size.goml | 2 +- tests/rustdoc-gui/src/extend_css/Cargo.lock | 7 + tests/rustdoc-gui/src/extend_css/Cargo.toml | 7 + tests/rustdoc-gui/src/extend_css/extra.css | 3 + tests/rustdoc-gui/src/extend_css/lib.rs | 1 + tests/rustdoc-gui/stab-badge.goml | 8 +- tests/rustdoc-gui/struct-fields.goml | 2 +- tests/rustdoc-gui/target.goml | 4 +- tests/rustdoc-gui/theme-change.goml | 8 +- tests/rustdoc-gui/theme-defaults.goml | 24 + tests/rustdoc-gui/theme-in-history.goml | 6 +- tests/rustdoc-gui/toggle-click-deadspace.goml | 2 +- tests/rustdoc-gui/toggle-docs-mobile.goml | 6 +- tests/rustdoc-gui/toggle-docs.goml | 6 +- tests/rustdoc-gui/toggle-implementors.goml | 2 +- .../rustdoc-gui/toggled-open-implementations.goml | 2 +- tests/rustdoc-gui/trait-sidebar-item-order.goml | 2 +- tests/rustdoc-gui/type-declation-overflow.goml | 30 +- tests/rustdoc-gui/unsafe-fn.goml | 4 +- tests/rustdoc-gui/where-whitespace.goml | 6 +- tests/rustdoc-js-std/option-type-signatures.js | 18 + tests/rustdoc-js-std/parser-errors.js | 58 +- tests/rustdoc-js-std/parser-filter.js | 96 ++- tests/rustdoc-js-std/parser-generics.js | 130 ++- tests/rustdoc-js-std/parser-ident.js | 10 +- tests/rustdoc-js-std/parser-literal.js | 2 +- tests/rustdoc-js-std/parser-paths.js | 10 +- tests/rustdoc-js-std/parser-quote.js | 9 +- tests/rustdoc-js-std/parser-returned.js | 11 +- tests/rustdoc-js-std/parser-separators.js | 18 +- tests/rustdoc-js-std/parser-weird-queries.js | 17 +- tests/rustdoc-js-std/println-typo.js | 12 + tests/rustdoc-js/generics-impl.js | 13 + tests/rustdoc-js/generics-nested.js | 33 + tests/rustdoc-js/generics-nested.rs | 19 + tests/rustdoc-js/generics.js | 16 + tests/rustdoc-js/primitive.js | 10 + tests/rustdoc-js/search-bag-semantics.js | 20 + tests/rustdoc-js/search-bag-semantics.rs | 4 + tests/rustdoc-js/where-clause.js | 30 + tests/rustdoc-js/where-clause.rs | 30 + tests/rustdoc-json/fns/extern_c_variadic.rs | 9 + .../impls/local_for_local_primitive.rs | 4 +- tests/rustdoc-json/non_lifetime_binders.rs | 24 + tests/rustdoc-json/primitives/local_primitive.rs | 2 +- tests/rustdoc-json/primitives/primitive_impls.rs | 2 +- .../primitives/primitive_overloading.rs | 4 +- tests/rustdoc-json/primitives/use_primitive.rs | 4 +- tests/rustdoc-ui/c-help.rs | 6 - tests/rustdoc-ui/c-help.stdout | 51 -- tests/rustdoc-ui/const_arg_in_type_position.rs | 6 + tests/rustdoc-ui/const_arg_in_type_position.stderr | 9 + tests/rustdoc-ui/coverage/exotic.rs | 3 +- .../rustdoc-ui/crate-reference-in-block-module.rs | 5 + .../crate-reference-in-block-module.stderr | 0 tests/rustdoc-ui/intra-doc/ambiguity.rs | 2 +- tests/rustdoc-ui/intra-doc/ambiguity.stderr | 54 +- .../intra-doc/auxiliary/inner-crate-doc.rs | 1 + .../intra-doc/auxiliary/inner-crate-enum.rs | 3 + tests/rustdoc-ui/intra-doc/errors.rs | 4 +- tests/rustdoc-ui/intra-doc/errors.stderr | 4 +- .../intra-doc/import-inline-merge-module.rs | 10 + tests/rustdoc-ui/intra-doc/inline-external-enum.rs | 8 + .../intra-doc/issue-108653-associated-items-10.rs | 22 + .../intra-doc/issue-108653-associated-items-2.rs | 17 + .../issue-108653-associated-items-2.stderr | 37 + .../intra-doc/issue-108653-associated-items-3.rs | 16 + .../issue-108653-associated-items-3.stderr | 37 + .../intra-doc/issue-108653-associated-items-4.rs | 21 + .../issue-108653-associated-items-4.stderr | 22 + .../intra-doc/issue-108653-associated-items-5.rs | 8 + .../issue-108653-associated-items-5.stderr | 22 + .../intra-doc/issue-108653-associated-items-6.rs | 8 + .../issue-108653-associated-items-6.stderr | 22 + .../intra-doc/issue-108653-associated-items-7.rs | 12 + .../issue-108653-associated-items-7.stderr | 22 + .../intra-doc/issue-108653-associated-items-8.rs | 12 + .../issue-108653-associated-items-8.stderr | 22 + .../intra-doc/issue-108653-associated-items-9.rs | 11 + .../intra-doc/issue-108653-associated-items.rs | 35 + .../intra-doc/issue-108653-associated-items.stderr | 67 ++ .../intra-doc/non-path-primitives.stderr | 8 +- tests/rustdoc-ui/intra-doc/prim-conflict.rs | 10 +- tests/rustdoc-ui/intra-doc/prim-conflict.stderr | 12 +- .../rustdoc-ui/intra-doc/reachable-non-exported.rs | 13 + tests/rustdoc-ui/invalid_associated_const.rs | 10 + tests/rustdoc-ui/invalid_associated_const.stderr | 9 + .../invalid_const_in_lifetime_position.rs | 6 + .../invalid_const_in_lifetime_position.stderr | 33 + .../rustdoc-ui/invalid_infered_static_and_const.rs | 2 + .../invalid_infered_static_and_const.stderr | 15 + tests/rustdoc-ui/issue-105742.rs | 37 +- tests/rustdoc-ui/issue-105742.stderr | 331 +++++++- tests/rustdoc-ui/issue-106226.stderr | 8 +- .../rustdoc-ui/issue-109282-import-inline-merge.rs | 14 + tests/rustdoc-ui/issue-79465.rs | 1 - tests/rustdoc-ui/issue-79465.stderr | 8 +- tests/rustdoc-ui/issue-96287.rs | 1 - tests/rustdoc-ui/issue-96287.stderr | 8 +- tests/rustdoc-ui/mismatched_arg_count.rs | 8 + tests/rustdoc-ui/mismatched_arg_count.stderr | 17 + tests/rustdoc-ui/run-directory.rs | 4 +- tests/rustdoc-ui/z-help.rs | 6 - tests/rustdoc-ui/z-help.stdout | 218 ----- tests/rustdoc/anonymous-reexport.rs | 8 +- tests/rustdoc/auto-impl-primitive.rs | 4 +- tests/rustdoc/auxiliary/issue-15318.rs | 3 +- tests/rustdoc/auxiliary/issue-73061.rs | 2 +- tests/rustdoc/auxiliary/primitive-doc.rs | 3 +- tests/rustdoc/check-source-code-urls-to-def.rs | 4 +- tests/rustdoc/compiler-derive-proc-macro.rs | 15 + tests/rustdoc/deprecated.rs | 4 +- .../doc-notable_trait-mut_t_is_not_an_iterator.rs | 23 - .../doc-notable_trait-mut_t_is_not_ref_t.rs | 21 - .../doc-notable_trait-slice.bare_fn_matches.html | 1 - tests/rustdoc/doc-notable_trait-slice.rs | 20 - tests/rustdoc/doc-notable_trait.bare-fn.html | 1 - tests/rustdoc/doc-notable_trait.rs | 38 - .../rustdoc/doc-notable_trait.some-struct-new.html | 1 - tests/rustdoc/doc-notable_trait.wrap-me.html | 1 - .../doc-notable_trait_box_is_not_an_iterator.rs | 38 - tests/rustdoc/footnote-in-summary.rs | 17 + .../generic-associated-types/issue-109488.rs | 18 + tests/rustdoc/intra-doc/auxiliary/my-core.rs | 2 +- tests/rustdoc/intra-doc/no-doc-primitive.rs | 2 +- tests/rustdoc/intra-doc/prim-methods-local.rs | 2 +- tests/rustdoc/intra-doc/prim-methods.rs | 2 + tests/rustdoc/intra-doc/prim-self.rs | 2 +- tests/rustdoc/issue-108679-reexport-of-reexport.rs | 29 + tests/rustdoc/issue-108925.rs | 10 + tests/rustdoc/issue-108931-anonymous-reexport.rs | 21 + .../issue-109258-missing-private-inlining.rs | 27 + tests/rustdoc/issue-109695-crate-doc-hidden.rs | 8 + tests/rustdoc/issue-15318-2.rs | 2 +- tests/rustdoc/issue-15318-3.rs | 4 +- tests/rustdoc/issue-23511.rs | 2 +- tests/rustdoc/issue-25001.rs | 4 +- tests/rustdoc/macro_pub_in_module.rs | 12 +- tests/rustdoc/non_lifetime_binders.rs | 9 + tests/rustdoc/normalize-assoc-item.rs | 4 +- .../doc-notable_trait-mut_t_is_not_an_iterator.rs | 23 + .../doc-notable_trait-mut_t_is_not_ref_t.rs | 21 + .../doc-notable_trait-slice.bare_fn_matches.html | 1 + .../notable-trait/doc-notable_trait-slice.rs | 26 + .../notable-trait/doc-notable_trait.bare-fn.html | 1 + tests/rustdoc/notable-trait/doc-notable_trait.rs | 38 + .../doc-notable_trait.some-struct-new.html | 1 + .../notable-trait/doc-notable_trait.wrap-me.html | 1 + .../doc-notable_trait_box_is_not_an_iterator.rs | 38 + .../notable-trait/notable-trait-generics.rs | 35 + .../spotlight-from-dependency.odd.html | 1 + .../notable-trait/spotlight-from-dependency.rs | 25 + tests/rustdoc/primitive-reference.rs | 4 +- tests/rustdoc/primitive-slice-auto-trait.rs | 4 +- tests/rustdoc/primitive-tuple-auto-trait.rs | 4 +- tests/rustdoc/primitive-unit-auto-trait.rs | 4 +- tests/rustdoc/primitive.rs | 21 - tests/rustdoc/primitive/primitive-generic-impl.rs | 4 +- tests/rustdoc/primitive/primitive.rs | 21 + tests/rustdoc/sidebar-all-page.rs | 4 +- tests/rustdoc/spotlight-from-dependency.odd.html | 1 - tests/rustdoc/spotlight-from-dependency.rs | 25 - tests/rustdoc/tab_title.rs | 3 +- tests/rustdoc/titles.rs | 4 +- tests/rustdoc/type-layout.rs | 8 + tests/ui-fulldeps/auxiliary/issue-13560-1.rs | 3 - tests/ui-fulldeps/auxiliary/issue-13560-2.rs | 3 - tests/ui-fulldeps/auxiliary/issue-13560-3.rs | 6 - tests/ui-fulldeps/auxiliary/issue-16822.rs | 20 - tests/ui-fulldeps/auxiliary/issue-18502.rs | 21 - tests/ui-fulldeps/auxiliary/issue-24106.rs | 13 - .../ui-fulldeps/auxiliary/lint-for-crate-rpass.rs | 80 -- tests/ui-fulldeps/auxiliary/lint-for-crate.rs | 12 +- tests/ui-fulldeps/extern-mod-syntax.rs | 11 - .../ui-fulldeps/fluent-messages/invalid-escape.ftl | 1 + tests/ui-fulldeps/fluent-messages/test.rs | 11 +- tests/ui-fulldeps/fluent-messages/test.stderr | 34 +- .../internal-lints/diagnostics_incorrect.rs | 15 - .../internal-lints/diagnostics_incorrect.stderr | 17 - .../internal-lints/existing_doc_keyword.rs | 11 - .../internal-lints/existing_doc_keyword.stderr | 15 - .../internal-lints/query_stability_incorrect.rs | 15 - .../query_stability_incorrect.stderr | 17 - .../internal-lints/rustc_pass_by_value_self.rs | 54 -- .../internal-lints/rustc_pass_by_value_self.stderr | 38 - tests/ui-fulldeps/issue-11881.rs | 91 -- tests/ui-fulldeps/issue-13560.rs | 12 - tests/ui-fulldeps/issue-15924.rs | 53 -- tests/ui-fulldeps/issue-16822.rs | 22 - tests/ui-fulldeps/issue-18502.rs | 8 - tests/ui-fulldeps/issue-24106.rs | 8 - tests/ui-fulldeps/issue-2804.rs | 81 -- tests/ui-fulldeps/myriad-closures.rs | 39 - tests/ui-fulldeps/pprust-expr-roundtrip.rs | 43 +- .../session-diagnostic/diagnostic-derive.rs | 57 +- .../session-diagnostic/diagnostic-derive.stderr | 315 ++++--- .../session-diagnostic/subdiagnostic-derive.rs | 43 +- .../session-diagnostic/subdiagnostic-derive.stderr | 288 ++++--- tests/ui-fulldeps/stable-mir/crate-info.rs | 129 +++ tests/ui-fulldeps/std/issue-15149.rs | 57 -- .../std/issue-81357-unsound-file-methods.rs | 81 -- tests/ui-fulldeps/std/stdio-from.rs | 69 -- tests/ui-fulldeps/std/switch-stdout.rs | 51 -- .../array_size_threshold/array_size_threshold.rs | 10 - .../array_size_threshold.stderr | 29 - tests/ui-toml/array_size_threshold/clippy.toml | 1 - tests/ui/abi/stack-probes-lto.rs | 1 - tests/ui/argument-suggestions/issue-109425.fixed | 20 + tests/ui/argument-suggestions/issue-109425.rs | 20 + tests/ui/argument-suggestions/issue-109425.stderr | 98 +++ tests/ui/argument-suggestions/issue-109831.rs | 9 + tests/ui/argument-suggestions/issue-109831.stderr | 51 ++ tests/ui/array-slice-vec/repeat_empty_ok.stderr | 6 +- tests/ui/asm/aarch64/parse-error.rs | 23 +- tests/ui/asm/aarch64/parse-error.stderr | 169 ++-- .../ui/asm/bad-template.aarch64_mirunsafeck.stderr | 5 + .../asm/bad-template.aarch64_thirunsafeck.stderr | 5 + .../ui/asm/bad-template.x86_64_mirunsafeck.stderr | 5 + .../ui/asm/bad-template.x86_64_thirunsafeck.stderr | 5 + tests/ui/asm/x86_64/issue-89875.rs | 4 +- tests/ui/asm/x86_64/parse-error.rs | 23 +- tests/ui/asm/x86_64/parse-error.stderr | 173 ++-- .../associated-const-dead-code.stderr | 2 + .../defaults-not-assumed-fail.stderr | 8 - tests/ui/associated-consts/issue-93775.rs | 2 +- .../ui/associated-inherent-types/issue-109299-1.rs | 12 + .../issue-109299-1.stderr | 15 + tests/ui/associated-inherent-types/issue-109299.rs | 12 + .../associated-inherent-types/issue-109299.stderr | 11 + .../ambiguous-associated-type2.stderr | 2 +- tests/ui/associated-type-bounds/issue-104916.rs | 14 + .../ui/associated-type-bounds/issue-104916.stderr | 8 + .../return-type-notation/bad-inputs-and-output.rs | 22 + .../bad-inputs-and-output.stderr | 56 ++ .../return-type-notation/basic.rs | 28 + .../return-type-notation/basic.with.stderr | 19 + .../return-type-notation/basic.without.stderr | 37 + .../return-type-notation/equality.rs | 16 + .../return-type-notation/equality.stderr | 25 + .../return-type-notation/missing.rs | 14 + .../return-type-notation/missing.stderr | 25 + .../return-type-notation/non-rpitit.rs | 11 + .../return-type-notation/non-rpitit.stderr | 22 + .../return-type-notation/unpretty-parenthesized.rs | 11 + .../unpretty-parenthesized.stderr | 12 + .../unpretty-parenthesized.stdout | 15 + .../associated-types-in-ambiguous-context.rs | 2 + .../associated-types-in-ambiguous-context.stderr | 21 +- .../associated-types/defaults-suitability.stderr | 6 +- tests/ui/associated-types/issue-20825.stderr | 2 +- tests/ui/associated-types/issue-63591.rs | 10 +- tests/ui/associated-types/issue-67684.rs | 8 +- tests/ui/async-await/async-trait-fn.current.stderr | 42 + tests/ui/async-await/async-trait-fn.next.stderr | 42 + tests/ui/async-await/async-trait-fn.rs | 1 + tests/ui/async-await/async-trait-fn.stderr | 6 +- .../edition-deny-async-fns-2015.current.stderr | 98 +++ .../edition-deny-async-fns-2015.next.stderr | 98 +++ .../ui/async-await/edition-deny-async-fns-2015.rs | 2 + .../async-await/edition-deny-async-fns-2015.stderr | 98 --- tests/ui/async-await/generator-desc.stderr | 14 +- .../async-await/in-trait/async-associated-types.rs | 2 + .../in-trait/async-associated-types2.rs | 8 +- .../async-default-fn-overridden.current.stderr | 11 + .../async-default-fn-overridden.next.stderr | 11 + .../in-trait/async-default-fn-overridden.rs | 2 + .../in-trait/async-default-fn-overridden.stderr | 11 - ...example-desugared-boxed-in-trait.current.stderr | 17 + ...nc-example-desugared-boxed-in-trait.next.stderr | 17 + .../async-example-desugared-boxed-in-trait.rs | 2 + .../async-example-desugared-boxed-in-trait.stderr | 17 - .../async-example-desugared-boxed.current.stderr | 11 + .../async-example-desugared-boxed.next.stderr | 11 + .../in-trait/async-example-desugared-boxed.rs | 2 + .../in-trait/async-example-desugared-boxed.stderr | 11 - .../in-trait/async-example-desugared-extra.rs | 2 + .../in-trait/async-example-desugared-in-trait.rs | 2 + .../async-example-desugared-manual.current.stderr | 11 + .../async-example-desugared-manual.next.stderr | 11 + .../in-trait/async-example-desugared-manual.rs | 2 + .../in-trait/async-example-desugared-manual.stderr | 11 - .../in-trait/async-example-desugared.rs | 2 + .../async-generics-and-bounds.current.stderr | 37 + .../in-trait/async-generics-and-bounds.next.stderr | 37 + .../in-trait/async-generics-and-bounds.rs | 2 + .../in-trait/async-generics-and-bounds.stderr | 37 - .../in-trait/async-generics.current.stderr | 37 + .../in-trait/async-generics.next.stderr | 37 + tests/ui/async-await/in-trait/async-generics.rs | 2 + .../ui/async-await/in-trait/async-generics.stderr | 37 - .../async-recursive-generic.current.stderr | 12 + .../in-trait/async-recursive-generic.next.stderr | 12 + .../in-trait/async-recursive-generic.rs | 2 + .../in-trait/async-recursive-generic.stderr | 12 - .../in-trait/async-recursive.current.stderr | 12 + .../in-trait/async-recursive.next.stderr | 12 + tests/ui/async-await/in-trait/async-recursive.rs | 2 + .../ui/async-await/in-trait/async-recursive.stderr | 12 - .../in-trait/bad-signatures.current.stderr | 26 + .../in-trait/bad-signatures.next.stderr | 26 + tests/ui/async-await/in-trait/bad-signatures.rs | 2 + .../ui/async-await/in-trait/bad-signatures.stderr | 26 - ...ject-to-specializable-projection.current.stderr | 19 + ...project-to-specializable-projection.next.stderr | 34 + .../dont-project-to-specializable-projection.rs | 2 + ...dont-project-to-specializable-projection.stderr | 19 - tests/ui/async-await/in-trait/early-bound-1.rs | 2 + tests/ui/async-await/in-trait/early-bound-2.rs | 2 + .../in-trait/fn-not-async-err2.current.stderr | 12 + .../in-trait/fn-not-async-err2.next.stderr | 12 + tests/ui/async-await/in-trait/fn-not-async-err2.rs | 2 + .../async-await/in-trait/fn-not-async-err2.stderr | 12 - .../in-trait/generics-mismatch.current.stderr | 16 + .../in-trait/generics-mismatch.next.stderr | 16 + tests/ui/async-await/in-trait/generics-mismatch.rs | 15 + .../async-await/in-trait/generics-mismatch.stderr | 16 + tests/ui/async-await/in-trait/implied-bounds.rs | 2 + tests/ui/async-await/in-trait/issue-102138.rs | 2 + tests/ui/async-await/in-trait/issue-102219.rs | 2 + tests/ui/async-await/in-trait/issue-102310.rs | 2 + tests/ui/async-await/in-trait/issue-104678.rs | 2 + .../in-trait/lifetime-mismatch.current.stderr | 21 + .../in-trait/lifetime-mismatch.next.stderr | 21 + tests/ui/async-await/in-trait/lifetime-mismatch.rs | 2 + .../async-await/in-trait/lifetime-mismatch.stderr | 21 - .../in-trait/missing-send-bound.current.stderr | 29 + .../in-trait/missing-send-bound.next.stderr | 29 + .../ui/async-await/in-trait/missing-send-bound.rs | 2 + .../async-await/in-trait/missing-send-bound.stderr | 29 - .../in-trait/object-safety.current.stderr | 27 + .../async-await/in-trait/object-safety.next.stderr | 27 + tests/ui/async-await/in-trait/object-safety.rs | 2 + tests/ui/async-await/in-trait/object-safety.stderr | 27 - .../in-trait/return-type-suggestion.current.stderr | 23 + .../in-trait/return-type-suggestion.next.stderr | 23 + .../async-await/in-trait/return-type-suggestion.rs | 2 + .../in-trait/return-type-suggestion.stderr | 23 - tests/ui/async-await/issue-108572.rs | 12 + tests/ui/async-await/issue-108572.stderr | 12 + tests/ui/async-await/large_moves.attribute.stderr | 22 +- tests/ui/async-await/large_moves.option.stderr | 22 +- tests/ui/async-await/large_moves.rs | 2 +- .../ui/async-await/missed-capture-issue-107414.rs | 24 + tests/ui/async-await/no-const-async.rs | 1 - tests/ui/async-await/no-const-async.stderr | 33 +- tests/ui/async-await/pin-needed-to-poll-2.stderr | 3 +- tests/ui/async-await/task-context-arg.rs | 25 + tests/ui/async-await/track-caller/async-block.rs | 4 +- .../ui/async-await/track-caller/async-block.stderr | 14 +- .../async-await/track-caller/panic-track-caller.rs | 13 + .../issue-105594-invalid-attr-validation.rs | 2 +- tests/ui/attributes/no-mangle-closure.rs | 11 + tests/ui/attributes/no-mangle-closure.stderr | 8 + .../auto-traits/suspicious-negative-impls-lint.rs | 21 + .../suspicious-negative-impls-lint.stderr | 52 ++ tests/ui/autoref-autoderef/issue-38940.rs | 52 -- tests/ui/autoref-autoderef/issue-38940.stderr | 23 - tests/ui/auxiliary/issue-13560-1.rs | 3 + tests/ui/auxiliary/issue-13560-2.rs | 3 + tests/ui/auxiliary/issue-13560-3.rs | 6 + tests/ui/auxiliary/issue-16822.rs | 20 + tests/ui/auxiliary/issue-18502.rs | 21 + tests/ui/auxiliary/issue-24106.rs | 13 + tests/ui/auxiliary/xc-private-method-lib.rs | 33 - tests/ui/binding/issue-53114-safety-checks.rs | 16 +- tests/ui/binding/issue-53114-safety-checks.stderr | 72 +- tests/ui/binding/optional_comma_in_match_arm.rs | 1 - tests/ui/binop/issue-28837.stderr | 18 +- ...-or-patterns-slice-patterns-box-patterns.stderr | 10 +- tests/ui/borrowck/borrowck-pat-enum.rs | 1 - tests/ui/borrowck/borrowck-vec-pattern-nesting.rs | 2 + .../borrowck/borrowck-vec-pattern-nesting.stderr | 18 +- tests/ui/borrowck/drop-in-loop.rs | 24 + tests/ui/borrowck/drop-in-loop.stderr | 14 + tests/ui/borrowck/issue-45199.rs | 3 + tests/ui/borrowck/issue-45199.stderr | 4 +- .../issue-58776-borrowck-scans-children.rs | 1 - .../issue-58776-borrowck-scans-children.stderr | 19 +- tests/ui/borrowck/issue-64453.stderr | 2 +- tests/ui/borrowck/issue-70919-drop-in-loop.rs | 25 + tests/ui/borrowck/let_underscore_temporary.rs | 27 + tests/ui/box/unit/expr-block-generic-unique1.rs | 18 + tests/ui/box/unit/expr-block-generic-unique2.rs | 14 + tests/ui/box/unit/expr-if-unique.rs | 9 + tests/ui/box/unit/unique-assign-copy.rs | 12 + tests/ui/box/unit/unique-assign-drop.rs | 10 + tests/ui/box/unit/unique-assign-generic.rs | 11 + tests/ui/box/unit/unique-assign.rs | 8 + tests/ui/box/unit/unique-autoderef-field.rs | 10 + tests/ui/box/unit/unique-autoderef-index.rs | 6 + tests/ui/box/unit/unique-cmp.rs | 11 + tests/ui/box/unit/unique-containing-tag.rs | 25 + tests/ui/box/unit/unique-create.rs | 11 + tests/ui/box/unit/unique-decl-init-copy.rs | 11 + tests/ui/box/unit/unique-decl-init.rs | 7 + tests/ui/box/unit/unique-decl-move.rs | 7 + tests/ui/box/unit/unique-decl.rs | 11 + tests/ui/box/unit/unique-deref.rs | 6 + tests/ui/box/unit/unique-destructure.rs | 9 + tests/ui/box/unit/unique-drop-complex.rs | 6 + tests/ui/box/unit/unique-ffi-symbols.rs | 16 + tests/ui/box/unit/unique-fn-arg-move.rs | 10 + tests/ui/box/unit/unique-fn-arg-mut.rs | 11 + tests/ui/box/unit/unique-fn-arg.rs | 11 + tests/ui/box/unit/unique-fn-ret.rs | 9 + tests/ui/box/unit/unique-generic-assign.rs | 11 + tests/ui/box/unit/unique-in-tag.rs | 20 + tests/ui/box/unit/unique-in-vec-copy.rs | 15 + tests/ui/box/unit/unique-in-vec.rs | 6 + tests/ui/box/unit/unique-init.rs | 6 + tests/ui/box/unit/unique-kinds.rs | 64 ++ tests/ui/box/unit/unique-log.rs | 6 + tests/ui/box/unit/unique-match-discrim.rs | 12 + tests/ui/box/unit/unique-move-drop.rs | 10 + tests/ui/box/unit/unique-move-temp.rs | 8 + tests/ui/box/unit/unique-move.rs | 9 + tests/ui/box/unit/unique-mutable.rs | 7 + tests/ui/box/unit/unique-object-move.rs | 18 + tests/ui/box/unit/unique-object-noncopyable.rs | 25 + tests/ui/box/unit/unique-object-noncopyable.stderr | 25 + tests/ui/box/unit/unique-pat-2.rs | 18 + tests/ui/box/unit/unique-pat-3.rs | 16 + tests/ui/box/unit/unique-pat.rs | 14 + tests/ui/box/unit/unique-pinned-nocopy.rs | 14 + tests/ui/box/unit/unique-pinned-nocopy.stderr | 28 + tests/ui/box/unit/unique-rec.rs | 9 + tests/ui/box/unit/unique-send-2.rs | 33 + tests/ui/box/unit/unique-send.rs | 10 + tests/ui/box/unit/unique-swap.rs | 11 + tests/ui/box/unit/unwind-unique.rs | 15 + tests/ui/cfg/auxiliary/cfg_false_lib.rs | 6 + tests/ui/cfg/cfg-false-feature.rs | 20 + tests/ui/cfg/cfg-false-feature.stderr | 35 + tests/ui/cfg/cfg_false_no_std.rs | 11 + tests/ui/chalkify/bugs/async.rs | 2 +- tests/ui/chalkify/bugs/async.stderr | 51 +- tests/ui/check-cfg/compact-values.stderr | 2 +- tests/ui/check-cfg/my-awesome-platform.json | 12 + tests/ui/check-cfg/values-target-json.rs | 21 + tests/ui/check-cfg/values-target-json.stderr | 13 + tests/ui/check-static-values-constraints.rs | 73 +- tests/ui/check-static-values-constraints.stderr | 158 +++- .../2229_closure_analysis/array_subslice.rs | 13 + .../2229_closure_analysis/array_subslice.stderr | 26 + .../unique-borrows-are-invariant-1.rs | 18 + .../unique-borrows-are-invariant-1.stderr | 14 + .../unique-borrows-are-invariant-2.rs | 31 + .../unique-borrows-are-invariant-2.stderr | 15 + tests/ui/closures/issue-109188.rs | 22 + tests/ui/closures/issue-109188.stderr | 19 + tests/ui/closures/self-supertrait-bounds.rs | 14 + tests/ui/codegen/mono-impossible-2.rs | 19 + tests/ui/codegen/mono-impossible.rs | 13 + .../ui/coercion/coerce-expect-unsized-ascribed.rs | 17 +- .../coercion/coerce-expect-unsized-ascribed.stderr | 58 +- .../coherence-conflicting-negative-trait-impl.rs | 2 + ...oherence-conflicting-negative-trait-impl.stderr | 18 +- tests/ui/coherence/coherence-impls-copy.stderr | 6 +- tests/ui/coherence/coherence-orphan.rs | 5 +- tests/ui/coherence/coherence-orphan.stderr | 15 +- tests/ui/coherence/coherence_inherent.stderr | 2 +- tests/ui/coherence/coherence_inherent_cc.stderr | 2 +- tests/ui/coherence/deep-bad-copy-reason.rs | 2 +- tests/ui/coherence/deep-bad-copy-reason.stderr | 2 +- tests/ui/coherence/illegal-copy-bad-projection.rs | 16 + .../coherence/illegal-copy-bad-projection.stderr | 9 + tests/ui/command/command-exec.rs | 1 - .../cfg-attr-multi-true.stderr | 4 + .../ui/const-generics/bad-generic-in-copy-impl.rs | 9 + .../const-generics/bad-generic-in-copy-impl.stderr | 9 + tests/ui/const-generics/bad-subst-const-kind.rs | 13 + .../ui/const-generics/bad-subst-const-kind.stderr | 9 + .../const-arg-in-const-arg.full.stderr | 17 +- .../const-arg-in-const-arg.min.stderr | 18 +- .../ui/const-generics/defaults/doesnt_infer.stderr | 2 +- .../cross_crate_predicate.stderr | 8 +- .../generic_const_exprs/issue-94287.stderr | 2 +- .../mismatched-gat-subst-kind.rs | 11 + .../mismatched-gat-subst-kind.stderr | 18 + .../typeid-equality-by-subtyping.rs | 52 ++ tests/ui/const-generics/issue-93647.rs | 1 + tests/ui/const-generics/issue-93647.stderr | 19 +- tests/ui/const-generics/issues/issue-82956.stderr | 8 +- tests/ui/const-generics/transmute-fail.rs | 35 + tests/ui/const-generics/transmute-fail.stderr | 52 ++ tests/ui/const-generics/transmute.rs | 83 ++ tests/ui/const-generics/transmute_no_gate.rs | 91 ++ tests/ui/const-generics/transmute_no_gate.stderr | 84 ++ tests/ui/const-generics/type_mismatch.rs | 1 + tests/ui/const-generics/type_mismatch.stderr | 18 +- tests/ui/const-generics/type_not_in_scope.rs | 1 - tests/ui/const-generics/type_not_in_scope.stderr | 14 +- tests/ui/const-ptr/out_of_bounds_read.stderr | 6 +- tests/ui/const_prop/issue-86351.rs | 22 + tests/ui/const_prop/unreachable-bounds.rs | 6 + tests/ui/const_prop/unreachable-overflow.rs | 10 + tests/ui/consts/const-block-const-bound.stderr | 38 +- .../const-blocks/fn-call-in-non-const.stderr | 3 +- tests/ui/consts/const-blocks/migrate-fail.stderr | 6 +- tests/ui/consts/const-blocks/nll-fail.stderr | 6 +- tests/ui/consts/const-err-late.stderr | 6 - .../ui/consts/const-eval/const-eval-overflow-2.rs | 1 - .../consts/const-eval/const-eval-overflow-2.stderr | 8 +- tests/ui/consts/const-eval/format.rs | 3 +- tests/ui/consts/const-eval/format.stderr | 35 +- tests/ui/consts/const-eval/issue-44578.stderr | 8 - .../ui/consts/const-eval/panic-assoc-never-type.rs | 2 +- .../const-eval/ref_to_int_match.32bit.stderr | 10 +- .../const-eval/ref_to_int_match.64bit.stderr | 10 +- tests/ui/consts/const-eval/ref_to_int_match.rs | 1 - .../consts/const-eval/transmute-size-mismatch.rs | 24 + .../const-eval/transmute-size-mismatch.stderr | 37 + tests/ui/consts/const-eval/ub-enum.32bit.stderr | 4 +- tests/ui/consts/const-eval/ub-enum.64bit.stderr | 4 +- tests/ui/consts/const-eval/ub-ref-ptr.stderr | 24 +- .../ui/consts/const-eval/ub-slice-get-unchecked.rs | 9 + .../const-eval/ub-slice-get-unchecked.stderr | 18 + tests/ui/consts/const-eval/ub-uninhabit.rs | 4 +- tests/ui/consts/const-eval/ub-uninhabit.stderr | 18 +- .../validate_uninhabited_zsts.32bit.stderr | 11 +- .../validate_uninhabited_zsts.64bit.stderr | 11 +- .../consts/const-eval/validate_uninhabited_zsts.rs | 2 +- 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-match-check.eval1.stderr | 4 +- tests/ui/consts/const-match-check.eval2.stderr | 4 +- tests/ui/consts/const-match-check.matchck.stderr | 16 +- tests/ui/consts/const-pattern-irrefutable.stderr | 15 +- .../const_in_pattern/cross-crate-fail.stderr | 6 + .../const_in_pattern/custom-eq-branch-warn.rs | 2 + .../const_in_pattern/custom-eq-branch-warn.stderr | 2 + .../const_in_pattern/incomplete-slice.stderr | 4 +- .../ui/consts/const_in_pattern/issue-78057.stderr | 3 + .../const_in_pattern/no-eq-branch-fail.stderr | 3 + .../const_in_pattern/reject_non_partial_eq.stderr | 3 + .../const_in_pattern/reject_non_structural.rs | 22 + .../const_in_pattern/reject_non_structural.stderr | 52 +- .../const_in_pattern/warn_corner_cases.stderr | 6 + .../ui/consts/invalid-inline-const-in-match-arm.rs | 1 + .../invalid-inline-const-in-match-arm.stderr | 19 +- tests/ui/consts/issue-28113.rs | 1 + tests/ui/consts/issue-28113.stderr | 19 +- tests/ui/consts/issue-43105.rs | 1 - tests/ui/consts/issue-43105.stderr | 8 +- tests/ui/consts/issue-56164.rs | 1 + tests/ui/consts/issue-56164.stderr | 21 +- tests/ui/consts/issue-64506.rs | 3 +- tests/ui/consts/issue-64506.stderr | 9 + .../ui/consts/issue-68542-closure-in-array-len.rs | 1 + .../consts/issue-68542-closure-in-array-len.stderr | 19 +- tests/ui/consts/issue-73976-polymorphic.rs | 2 - tests/ui/consts/issue-73976-polymorphic.stderr | 16 +- tests/ui/consts/issue-78655.rs | 1 - tests/ui/consts/issue-78655.stderr | 8 +- tests/ui/consts/issue-79137-toogeneric.rs | 1 - tests/ui/consts/issue-79137-toogeneric.stderr | 8 +- tests/ui/consts/issue-miri-1910.stderr | 2 +- tests/ui/consts/match_ice.stderr | 3 + .../min_const_fn_libstd_stability.stderr | 6 +- .../consts/min_const_fn/min_const_fn_unsafe_bad.rs | 3 + .../min_const_fn/min_const_fn_unsafe_bad.stderr | 11 +- .../min_const_unsafe_fn_libstd_stability.stderr | 6 +- tests/ui/consts/miri_unleashed/assoc_const.stderr | 6 - .../ui/consts/miri_unleashed/assoc_const_2.stderr | 6 - tests/ui/consts/miri_unleashed/box.rs | 5 +- tests/ui/consts/miri_unleashed/box.stderr | 29 +- ...const_refers_to_static_cross_crate.32bit.stderr | 32 +- ...const_refers_to_static_cross_crate.64bit.stderr | 32 +- .../const_refers_to_static_cross_crate.rs | 4 - tests/ui/consts/miri_unleashed/tls.stderr | 4 +- tests/ui/consts/offset_from_ub.stderr | 6 +- .../ui/consts/uninhabited-const-issue-61744.stderr | 6 - .../cycle-trait-supertrait-direct.stderr | 9 +- .../cycle-trait-supertrait-indirect.stderr | 14 +- tests/ui/derived-errors/issue-31997-1.stderr | 2 +- tests/ui/derives/derive-assoc-type-not-impl.stderr | 3 +- .../derives-span-Clone-enum-struct-variant.stderr | 3 +- tests/ui/derives/derives-span-Clone-enum.stderr | 3 +- tests/ui/derives/derives-span-Clone-struct.stderr | 3 +- .../derives/derives-span-Clone-tuple-struct.stderr | 3 +- .../derives-span-Debug-enum-struct-variant.stderr | 3 +- tests/ui/derives/derives-span-Debug-enum.stderr | 3 +- tests/ui/derives/derives-span-Debug-struct.stderr | 3 +- .../derives/derives-span-Debug-tuple-struct.stderr | 3 +- .../ui/derives/derives-span-Default-struct.stderr | 3 +- .../derives-span-Default-tuple-struct.stderr | 3 +- .../derives-span-Eq-enum-struct-variant.stderr | 3 +- tests/ui/derives/derives-span-Eq-enum.stderr | 3 +- tests/ui/derives/derives-span-Eq-struct.stderr | 3 +- .../ui/derives/derives-span-Eq-tuple-struct.stderr | 3 +- .../derives-span-Hash-enum-struct-variant.stderr | 3 +- tests/ui/derives/derives-span-Hash-enum.stderr | 3 +- tests/ui/derives/derives-span-Hash-struct.stderr | 3 +- .../derives/derives-span-Hash-tuple-struct.stderr | 3 +- .../derives-span-Ord-enum-struct-variant.stderr | 3 +- tests/ui/derives/derives-span-Ord-enum.stderr | 3 +- tests/ui/derives/derives-span-Ord-struct.stderr | 3 +- .../derives/derives-span-Ord-tuple-struct.stderr | 3 +- ...rives-span-PartialEq-enum-struct-variant.stderr | 3 +- .../ui/derives/derives-span-PartialEq-enum.stderr | 3 +- .../derives/derives-span-PartialEq-struct.stderr | 3 +- .../derives-span-PartialEq-tuple-struct.stderr | 3 +- ...ives-span-PartialOrd-enum-struct-variant.stderr | 3 +- .../ui/derives/derives-span-PartialOrd-enum.stderr | 3 +- .../derives/derives-span-PartialOrd-struct.stderr | 3 +- .../derives-span-PartialOrd-tuple-struct.stderr | 3 +- .../deriving-no-inner-impl-error-message.stderr | 6 +- .../ui/derives/deriving-with-repr-packed-2.stderr | 3 +- tests/ui/derives/issue-91492.stderr | 9 +- tests/ui/derives/issue-91550.stderr | 12 +- .../auxiliary/tab_column_numbers.rs | 6 + tests/ui/diagnostic-width/tab-column-numbers.rs | 12 + .../ui/diagnostic-width/tab-column-numbers.stderr | 14 + .../issue-56028-there-is-an-enum-variant.stderr | 8 +- tests/ui/did_you_mean/recursion_limit.stderr | 7 +- tests/ui/did_you_mean/recursion_limit_deref.stderr | 6 +- tests/ui/disambiguate-identical-names.rs | 15 - tests/ui/disambiguate-identical-names.stderr | 19 - tests/ui/dst/issue-90528-unsizing-suggestion-1.rs | 20 + .../dst/issue-90528-unsizing-suggestion-1.stderr | 56 ++ tests/ui/dst/issue-90528-unsizing-suggestion-2.rs | 28 + .../dst/issue-90528-unsizing-suggestion-2.stderr | 94 +++ tests/ui/dst/issue-90528-unsizing-suggestion-3.rs | 22 + .../dst/issue-90528-unsizing-suggestion-3.stderr | 75 ++ tests/ui/dst/issue-90528-unsizing-suggestion-4.rs | 26 + .../dst/issue-90528-unsizing-suggestion-4.stderr | 79 ++ tests/ui/dyn-star/align.normal.stderr | 13 +- tests/ui/dyn-star/align.over_aligned.stderr | 6 +- tests/ui/dyn-star/align.rs | 3 +- .../dyn-star/check-size-at-cast-polymorphic-bad.rs | 2 +- .../check-size-at-cast-polymorphic-bad.stderr | 2 +- tests/ui/dyn-star/check-size-at-cast.rs | 2 +- tests/ui/dyn-star/check-size-at-cast.stderr | 2 +- tests/ui/dyn-star/const-and-static.rs | 10 + tests/ui/dyn-star/const-and-static.stderr | 11 + tests/ui/dyn-star/feature-gate-dyn_star.rs | 2 +- tests/ui/dyn-star/feature-gate-dyn_star.stderr | 4 +- tests/ui/dyn-star/gated-span.rs | 8 + tests/ui/dyn-star/gated-span.stderr | 12 + tests/ui/dyn-star/no-explicit-dyn-star-cast.rs | 4 +- tests/ui/dyn-star/no-explicit-dyn-star-cast.stderr | 8 +- tests/ui/dyn-star/upcast.stderr | 2 +- tests/ui/empty/empty-struct-tuple-pat.stderr | 4 +- .../auxiliary/discr-foreign-dep.rs | 7 + tests/ui/enum-discriminant/discr-foreign.rs | 11 + tests/ui/enum-discriminant/issue-104519.rs | 10 - tests/ui/enum-discriminant/issue-61696.rs | 77 ++ tests/ui/error-codes/E0004.stderr | 2 +- tests/ui/error-codes/E0010-teach.rs | 5 +- tests/ui/error-codes/E0010-teach.stderr | 21 +- tests/ui/error-codes/E0010.rs | 5 +- tests/ui/error-codes/E0010.stderr | 22 +- tests/ui/error-codes/E0030-teach.rs | 1 - tests/ui/error-codes/E0030-teach.stderr | 8 +- tests/ui/error-codes/E0030.rs | 1 - tests/ui/error-codes/E0030.stderr | 8 +- tests/ui/error-codes/E0184.stderr | 2 +- tests/ui/error-codes/E0206.rs | 2 +- tests/ui/error-codes/E0206.stderr | 2 +- tests/ui/error-codes/E0275.stderr | 2 +- tests/ui/error-codes/E0277-3.stderr | 3 +- tests/ui/error-codes/E0449.stderr | 16 +- tests/ui/exclusive-drop-and-copy.rs | 4 +- tests/ui/exclusive-drop-and-copy.stderr | 4 +- tests/ui/expr-block-generic-unique1.rs | 18 - tests/ui/expr-block-generic-unique2.rs | 14 - tests/ui/expr-if-unique.rs | 9 - tests/ui/extenv/extenv-no-args.rs | 2 +- tests/ui/extenv/extenv-no-args.stderr | 2 +- tests/ui/extenv/extenv-too-many-args.rs | 2 +- tests/ui/extenv/extenv-too-many-args.stderr | 2 +- tests/ui/extenv/issue-55897.stderr | 2 +- tests/ui/extern-mod-syntax.rs | 11 + tests/ui/feature-gates/feature-gate-box-expr.rs | 14 - .../ui/feature-gates/feature-gate-box-expr.stderr | 12 - tests/ui/feature-gates/feature-gate-box_syntax.rs | 6 - .../feature-gates/feature-gate-box_syntax.stderr | 12 - .../feature-gate-closure_track_caller.rs | 2 + .../feature-gate-closure_track_caller.stderr | 15 +- .../feature-gate-impl_trait_in_assoc_type.rs | 18 + .../feature-gate-impl_trait_in_assoc_type.stderr | 30 + .../ui/feature-gates/feature-gate-link_cfg.stderr | 1 - ...ate-non_exhaustive_omitted_patterns_lint.stderr | 2 +- ...ature-gate-precise_pointer_size_matching.stderr | 4 +- .../feature-gate-return_type_notation.cfg.stderr | 36 + .../feature-gate-return_type_notation.no.stderr | 22 + .../feature-gate-return_type_notation.rs | 22 + ...ature-gate-unboxed-closures-manual-impls.stderr | 6 + tests/ui/feature-gates/test-listing-format-json.rs | 18 + .../test-listing-format-json.run.stderr | 1 + tests/ui/fmt/auxiliary/format-string-proc-macro.rs | 36 +- tests/ui/fmt/format-args-argument-span.rs | 22 + tests/ui/fmt/format-args-argument-span.stderr | 53 ++ .../format-args-capture-first-literal-is-macro.rs | 21 + ...rmat-args-capture-first-literal-is-macro.stderr | 30 + .../format-args-capture-from-pm-first-arg-macro.rs | 8 + ...mat-args-capture-from-pm-first-arg-macro.stderr | 12 + tests/ui/fmt/format-args-capture-issue-106408.rs | 10 + .../fmt/format-args-capture-macro-hygiene-pass.rs | 16 + tests/ui/fmt/ifmt-bad-arg.stderr | 14 +- tests/ui/fmt/ifmt-unimpl.stderr | 4 +- tests/ui/fmt/respanned-literal-issue-106191.rs | 9 +- tests/ui/fmt/respanned-literal-issue-106191.stderr | 21 +- tests/ui/fn/fn-ptr-trait-int-float-infer-var.rs | 10 + tests/ui/fn/fn-ptr-trait.rs | 9 + tests/ui/fn/issue-39259.rs | 13 + tests/ui/fn/issue-39259.stderr | 15 + tests/ui/foreign-unsafe-fn-called.mir.stderr | 11 - tests/ui/foreign-unsafe-fn-called.rs | 14 - tests/ui/foreign-unsafe-fn-called.thir.stderr | 11 - tests/ui/generator/clone-impl.stderr | 6 +- .../issue-105084.drop_tracking_mir.stderr | 16 +- tests/ui/generator/issue-105084.rs | 5 +- tests/ui/generator/issue-87142.rs | 2 +- tests/ui/generator/non-static-is-unpin.rs | 2 + .../generator-print-verbose-1.drop_tracking.stderr | 8 +- ...erator-print-verbose-1.drop_tracking_mir.stderr | 8 +- ...nerator-print-verbose-1.no_drop_tracking.stderr | 8 +- tests/ui/generator/static-not-unpin.current.stderr | 19 + tests/ui/generator/static-not-unpin.next.stderr | 19 + tests/ui/generator/static-not-unpin.rs | 3 + tests/ui/generator/static-not-unpin.stderr | 18 - tests/ui/generator/yield-in-box.rs | 24 - tests/ui/generator/yield-in-box.stderr | 17 - .../bugs/issue-100013.stderr | 8 +- .../gat-bounds-normalize-pred.rs | 17 + tests/ui/generic-associated-types/issue-86218-2.rs | 6 +- tests/ui/generic-associated-types/issue-86218.rs | 6 +- tests/ui/generic-associated-types/issue-87258_a.rs | 2 +- .../issue-87429-associated-type-default.stderr | 3 +- .../issue-87429-specialization.stderr | 3 +- tests/ui/generic-associated-types/issue-88595.rs | 3 +- .../ui/generic-associated-types/issue-88595.stderr | 4 +- tests/ui/generic-associated-types/issue-89008.rs | 2 +- tests/ui/generic-associated-types/issue-90014.rs | 6 +- .../ui/generic-associated-types/issue-90014.stderr | 6 +- .../generics/auxiliary/foreign-generic-mismatch.rs | 3 + tests/ui/generics/foreign-generic-mismatch.rs | 10 + tests/ui/generics/foreign-generic-mismatch.stderr | 35 + .../slightly-nice-generic-literal-messages.rs | 14 + .../slightly-nice-generic-literal-messages.stderr | 14 + .../half-open-range-pats-thir-lower-empty.rs | 13 - .../half-open-range-pats-thir-lower-empty.stderr | 102 +-- .../higher-rank-trait-bounds/fn-ptr.classic.stderr | 19 + tests/ui/higher-rank-trait-bounds/fn-ptr.rs | 14 + .../issue-95230.new.stderr | 19 + tests/ui/higher-rank-trait-bounds/issue-95230.rs | 6 +- tests/ui/hygiene/arguments.rs | 2 - tests/ui/hygiene/arguments.stderr | 2 +- tests/ui/hygiene/assoc_item_ctxt.rs | 2 - tests/ui/hygiene/assoc_item_ctxt.stderr | 4 +- tests/ui/hygiene/assoc_ty_bindings.rs | 1 - tests/ui/hygiene/auxiliary/legacy_interaction.rs | 2 - tests/ui/hygiene/fields.rs | 2 - tests/ui/hygiene/fields.stderr | 8 +- tests/ui/hygiene/generic_params.rs | 1 - tests/ui/hygiene/globs.stderr | 4 +- tests/ui/hygiene/impl_items.rs | 2 - tests/ui/hygiene/impl_items.stderr | 2 +- tests/ui/hygiene/intercrate.rs | 2 - tests/ui/hygiene/intercrate.stderr | 2 +- tests/ui/hygiene/issue-47311.rs | 1 - tests/ui/hygiene/issue-47312.rs | 1 - tests/ui/hygiene/items.rs | 1 - tests/ui/hygiene/legacy_interaction.rs | 1 - tests/ui/hygiene/lexical.rs | 1 - tests/ui/hygiene/no_implicit_prelude.stderr | 4 +- tests/ui/hygiene/panic-location.run.stderr | 2 +- tests/ui/hygiene/specialization.rs | 1 - tests/ui/hygiene/trait_items-2.rs | 1 - tests/ui/hygiene/trait_items.stderr | 2 +- tests/ui/hygiene/wrap_unhygienic_example.rs | 1 - tests/ui/hygiene/xcrate.rs | 1 - .../associated-impl-trait-type-generic-trait.rs | 2 +- .../associated-impl-trait-type-trivial.rs | 2 +- tests/ui/impl-trait/associated-impl-trait-type.rs | 2 +- tests/ui/impl-trait/auto-trait-leak.stderr | 10 + tests/ui/impl-trait/impl-fn-hrtb-bounds-2.stderr | 2 +- tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs | 9 +- .../box-coerce-span-in-default.current.stderr | 11 + .../box-coerce-span-in-default.next.stderr | 11 + .../in-trait/box-coerce-span-in-default.rs | 2 + .../in-trait/box-coerce-span-in-default.stderr | 11 - tests/ui/impl-trait/in-trait/deep-match-works.rs | 6 +- .../impl-trait/in-trait/deep-match.current.stderr | 15 + .../ui/impl-trait/in-trait/deep-match.next.stderr | 15 + tests/ui/impl-trait/in-trait/deep-match.rs | 9 +- tests/ui/impl-trait/in-trait/deep-match.stderr | 15 - .../default-body-type-err-2.current.stderr | 11 + .../in-trait/default-body-type-err-2.next.stderr | 11 + .../impl-trait/in-trait/default-body-type-err-2.rs | 2 + .../in-trait/default-body-type-err-2.stderr | 11 - .../in-trait/default-body-type-err.current.stderr | 12 + .../in-trait/default-body-type-err.next.stderr | 12 + .../impl-trait/in-trait/default-body-type-err.rs | 3 + .../in-trait/default-body-type-err.stderr | 12 - .../in-trait/default-body-with-rpit.current.stderr | 24 + .../in-trait/default-body-with-rpit.next.stderr | 24 + .../impl-trait/in-trait/default-body-with-rpit.rs | 4 +- tests/ui/impl-trait/in-trait/default-body.rs | 2 + .../default-method-binder-shifting.current.stderr | 11 + .../default-method-binder-shifting.next.stderr | 11 + .../in-trait/default-method-binder-shifting.rs | 22 + .../default-method-constraint.current.stderr | 11 + .../in-trait/default-method-constraint.next.stderr | 11 + .../in-trait/default-method-constraint.rs | 2 + .../in-trait/default-method-constraint.stderr | 11 - .../in-trait/doesnt-satisfy.current.stderr | 17 + .../impl-trait/in-trait/doesnt-satisfy.next.stderr | 17 + tests/ui/impl-trait/in-trait/doesnt-satisfy.rs | 3 + tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr | 17 - ...-project-to-rpitit-with-no-value.current.stderr | 21 + ...ont-project-to-rpitit-with-no-value.next.stderr | 21 + .../dont-project-to-rpitit-with-no-value.rs | 19 + tests/ui/impl-trait/in-trait/early.rs | 2 + tests/ui/impl-trait/in-trait/encode.rs | 2 + tests/ui/impl-trait/in-trait/foreign.rs | 16 +- .../in-trait/generics-mismatch.current.stderr | 12 + .../in-trait/generics-mismatch.next.stderr | 12 + tests/ui/impl-trait/in-trait/generics-mismatch.rs | 3 + .../impl-trait/in-trait/generics-mismatch.stderr | 12 - .../in-trait/issue-102140.current.stderr | 33 + .../impl-trait/in-trait/issue-102140.next.stderr | 33 + tests/ui/impl-trait/in-trait/issue-102140.rs | 3 + tests/ui/impl-trait/in-trait/issue-102140.stderr | 33 - tests/ui/impl-trait/in-trait/issue-102301.rs | 2 + .../in-trait/issue-102571.current.stderr | 14 + .../impl-trait/in-trait/issue-102571.next.stderr | 14 + tests/ui/impl-trait/in-trait/issue-102571.rs | 3 + tests/ui/impl-trait/in-trait/issue-102571.stderr | 14 - tests/ui/impl-trait/in-trait/nested-rpitit.rs | 2 + .../in-trait/new-lowering-strategy/simple-trait.rs | 11 - .../in-trait/object-safety.current.stderr | 50 ++ .../impl-trait/in-trait/object-safety.next.stderr | 50 ++ tests/ui/impl-trait/in-trait/object-safety.rs | 3 + tests/ui/impl-trait/in-trait/object-safety.stderr | 50 -- .../opaque-in-impl-is-opaque.current.stderr | 17 + .../in-trait/opaque-in-impl-is-opaque.next.stderr | 17 + .../in-trait/opaque-in-impl-is-opaque.rs | 3 + .../in-trait/opaque-in-impl-is-opaque.stderr | 17 - tests/ui/impl-trait/in-trait/opaque-in-impl.rs | 2 + tests/ui/impl-trait/in-trait/reveal.rs | 2 + .../in-trait/signature-mismatch.current.stderr | 16 + .../in-trait/signature-mismatch.next.stderr | 16 + tests/ui/impl-trait/in-trait/signature-mismatch.rs | 2 + .../impl-trait/in-trait/signature-mismatch.stderr | 16 - .../in-trait/specialization-broken.current.stderr | 31 + .../in-trait/specialization-broken.next.stderr | 31 + .../impl-trait/in-trait/specialization-broken.rs | 3 + .../in-trait/specialization-broken.stderr | 31 - .../in-trait/specialization-substs-remap.rs | 2 + tests/ui/impl-trait/in-trait/success.rs | 2 + .../trait-more-generics-than-impl.current.stderr | 12 + .../trait-more-generics-than-impl.next.stderr | 12 + .../in-trait/trait-more-generics-than-impl.rs | 3 + .../in-trait/trait-more-generics-than-impl.stderr | 12 - .../impl-trait/in-trait/wf-bounds.current.stderr | 40 + tests/ui/impl-trait/in-trait/wf-bounds.next.stderr | 40 + tests/ui/impl-trait/in-trait/wf-bounds.rs | 9 +- tests/ui/impl-trait/in-trait/wf-bounds.stderr | 30 - tests/ui/impl-trait/in-trait/where-clause.rs | 2 + tests/ui/impl-trait/issue-55872-1.rs | 2 +- tests/ui/impl-trait/issue-55872-2.rs | 2 +- tests/ui/impl-trait/issue-55872-2.stderr | 8 - tests/ui/impl-trait/issue-55872-3.rs | 2 +- tests/ui/impl-trait/issue-55872.rs | 2 +- tests/ui/impl-trait/issues/issue-78722.rs | 1 - tests/ui/impl-trait/issues/issue-78722.stderr | 13 +- tests/ui/impl-trait/issues/issue-82139.rs | 2 +- tests/ui/impl-trait/issues/issue-83919.rs | 12 +- tests/ui/impl-trait/issues/issue-86719.rs | 5 +- tests/ui/impl-trait/issues/issue-86719.stderr | 3 +- tests/ui/impl-trait/issues/issue-87340.rs | 4 +- tests/ui/impl-trait/multiple-lifetimes.rs | 12 - .../multiple-lifetimes/multiple-lifetimes.rs | 12 + tests/ui/impl-trait/nested-return-type2.rs | 1 - tests/ui/impl-trait/nested-return-type2.stderr | 17 - tests/ui/impl-trait/nested-return-type3.rs | 1 - tests/ui/impl-trait/nested-return-type3.stderr | 17 - .../impl-trait/no-method-suggested-traits.stderr | 24 +- ...pl-trait-type-indirect.drop_tracking_mir.stderr | 3 + tests/ui/impl-trait/type-alias-generic-param.rs | 2 +- tests/ui/impl-trait/universal_wrong_bounds.stderr | 4 +- tests/ui/impl-trait/where-allowed.rs | 4 +- tests/ui/impl-trait/where-allowed.stderr | 98 +-- tests/ui/implied-bounds/ice-unbound-region-vars.rs | 24 + .../normalization-nested.lifetime.stderr | 18 + tests/ui/implied-bounds/normalization-nested.rs | 39 + tests/ui/implied-bounds/normalization.rs | 58 ++ tests/ui/imports/auxiliary/glob-conflict.rs | 2 + tests/ui/imports/glob-resolve1.stderr | 2 +- .../issue-26873-multifile/issue-26873-multifile.rs | 1 - tests/ui/imports/issue-38293.stderr | 2 +- tests/ui/imports/issue-4366-2.stderr | 2 +- tests/ui/imports/issue-4366.stderr | 2 +- .../ui/imports/local-modularized-tricky-fail-1.rs | 1 + .../imports/local-modularized-tricky-fail-1.stderr | 14 +- tests/ui/imports/overlapping_pub_trait.stderr | 2 +- tests/ui/imports/unnamed_pub_trait.stderr | 2 +- tests/ui/index_message.rs | 4 +- tests/ui/index_message.stderr | 2 +- tests/ui/inference/char-as-str-single.fixed | 9 + tests/ui/inference/char-as-str-single.rs | 9 + tests/ui/inference/char-as-str-single.stderr | 15 +- tests/ui/inference/issue-80409.rs | 36 + tests/ui/inference/issue-83606.stderr | 2 +- tests/ui/inference/need_type_info/concrete-impl.rs | 3 + .../inference/need_type_info/concrete-impl.stderr | 9 +- tests/ui/inference/need_type_info/issue-109905.rs | 25 + .../inference/need_type_info/issue-109905.stderr | 15 + .../infinite/infinite-trait-alias-recursion.stderr | 17 +- tests/ui/inline-const/const-match-pat-generic.rs | 2 - .../ui/inline-const/const-match-pat-generic.stderr | 16 +- tests/ui/internal-lints/diagnostics_incorrect.rs | 15 + .../ui/internal-lints/diagnostics_incorrect.stderr | 17 + tests/ui/internal-lints/existing_doc_keyword.rs | 11 + .../ui/internal-lints/existing_doc_keyword.stderr | 15 + .../ui/internal-lints/query_stability_incorrect.rs | 15 + .../query_stability_incorrect.stderr | 17 + .../ui/internal-lints/rustc_pass_by_value_self.rs | 54 ++ .../internal-lints/rustc_pass_by_value_self.stderr | 38 + tests/ui/internal/internal-unstable-const.stderr | 6 +- tests/ui/issue-11881.rs | 91 ++ tests/ui/issue-13560.rs | 13 + tests/ui/issue-15924.rs | 53 ++ tests/ui/issue-16822.rs | 22 + tests/ui/issue-18502.rs | 8 + tests/ui/issue-24106.rs | 8 + tests/ui/issue-2804.rs | 81 ++ tests/ui/issues/issue-10465.stderr | 2 +- tests/ui/issues/issue-106755.rs | 2 + tests/ui/issues/issue-106755.stderr | 18 +- tests/ui/issues/issue-11709.rs | 1 - tests/ui/issues/issue-12511.stderr | 12 +- tests/ui/issues/issue-17546.stderr | 16 +- tests/ui/issues/issue-19086.stderr | 2 +- tests/ui/issues/issue-20162.stderr | 3 +- tests/ui/issues/issue-20413.stderr | 34 +- tests/ui/issues/issue-20772.stderr | 2 +- tests/ui/issues/issue-21160.stderr | 3 +- tests/ui/issues/issue-27340.rs | 2 +- tests/ui/issues/issue-27340.stderr | 2 +- tests/ui/issues/issue-27842.rs | 5 + tests/ui/issues/issue-27842.stderr | 12 +- tests/ui/issues/issue-28433.rs | 4 +- tests/ui/issues/issue-28433.stderr | 10 +- tests/ui/issues/issue-28839.rs | 1 - tests/ui/issues/issue-3029.rs | 2 - tests/ui/issues/issue-35976.unimported.stderr | 2 +- tests/ui/issues/issue-37534.stderr | 2 +- tests/ui/issues/issue-38190.rs | 1 - tests/ui/issues/issue-39175.stderr | 2 +- tests/ui/issues/issue-50403.rs | 2 +- tests/ui/issues/issue-50403.stderr | 2 +- tests/ui/issues/issue-56175.stderr | 4 +- tests/ui/issues/issue-59488.stderr | 20 - tests/ui/issues/issue-61696.rs | 66 -- tests/ui/issues/issue-62375.stderr | 3 +- tests/ui/issues/issue-66667-function-cmp-cycle.rs | 3 + .../issues/issue-66667-function-cmp-cycle.stderr | 34 +- tests/ui/issues/issue-77919.stderr | 2 +- tests/ui/issues/issue-9129.rs | 1 - tests/ui/issues/issue-98299.stderr | 2 +- tests/ui/iterators/into-iter-on-arrays-lint.fixed | 2 +- tests/ui/iterators/into-iter-on-arrays-lint.rs | 2 +- tests/ui/kindck/kindck-impl-type-params.stderr | 3 +- tests/ui/lang-items/no_owned_box_lang_item.rs | 16 - tests/ui/lang-items/no_owned_box_lang_item.stderr | 4 - tests/ui/late-bound-lifetimes/issue-80618.rs | 8 + tests/ui/late-bound-lifetimes/issue-80618.stderr | 15 + tests/ui/layout/issue-84108.stderr | 4 +- tests/ui/layout/transmute-to-tail-with-err.rs | 8 + tests/ui/layout/transmute-to-tail-with-err.stderr | 14 + ...crlf-line-endings-string-literal-doc-comment.rs | 1 - tests/ui/lexer/unterminated-comment.rs | 1 + tests/ui/lexer/unterminated-comment.stderr | 9 + tests/ui/lexer/unterminated-nested-comment.rs | 4 + tests/ui/lexer/unterminated-nested-comment.stderr | 21 + tests/ui/lifetimes/issue-93911.rs | 18 + tests/ui/lifetimes/issue-95023.stderr | 6 + tests/ui/lifetimes/unusual-rib-combinations.rs | 5 + tests/ui/lifetimes/unusual-rib-combinations.stderr | 21 +- tests/ui/limits/issue-55878.stderr | 8 - tests/ui/linkage-attr/issue-109144.rs | 4 + tests/ui/linkage-attr/issue-109144.stderr | 9 + tests/ui/lint/anonymous-reexport.rs | 19 + tests/ui/lint/anonymous-reexport.stderr | 44 + tests/ui/lint/clashing-extern-fn.rs | 33 +- tests/ui/lint/clashing-extern-fn.stderr | 18 +- tests/ui/lint/dead-code/issue-59003.rs | 18 + tests/ui/lint/dead-code/issue-85255.rs | 12 +- tests/ui/lint/dead-code/issue-85255.stderr | 54 +- tests/ui/lint/dead-code/lint-dead-code-3.stderr | 14 +- tests/ui/lint/dead-code/lint-dead-code-6.rs | 9 +- tests/ui/lint/dead-code/lint-dead-code-6.stderr | 18 +- tests/ui/lint/dead-code/unused-assoc-fns.rs | 35 + tests/ui/lint/dead-code/unused-assoc-fns.stderr | 29 + tests/ui/lint/fn_must_use.stderr | 28 + tests/ui/lint/inline-trait-and-foreign-items.rs | 2 +- tests/ui/lint/issue-109152.rs | 7 + tests/ui/lint/issue-109152.stderr | 23 + tests/ui/lint/issue-109529.fixed | 6 + tests/ui/lint/issue-109529.rs | 6 + tests/ui/lint/issue-109529.stderr | 23 + tests/ui/lint/lint-temporary-cstring-as-ptr.rs | 8 + tests/ui/lint/lint-temporary-cstring-as-ptr.stderr | 19 +- tests/ui/lint/no-coverage.rs | 2 +- tests/ui/lint/unconditional_panic_98444.rs | 7 + tests/ui/lint/unconditional_panic_98444.stderr | 10 + tests/ui/lint/unused/auxiliary/must-use-foreign.rs | 12 + tests/ui/lint/unused/must-use-box-from-raw.stderr | 4 + tests/ui/lint/unused/must-use-foreign.rs | 15 + tests/ui/lint/unused/must_use-unit.stderr | 9 + tests/ui/lint/unused/trait-alias-supertrait.rs | 15 + tests/ui/lint/unused/unused-allocation.rs | 7 + tests/ui/lint/unused/unused-allocation.stderr | 20 + tests/ui/lint/unused/unused-async.rs | 2 +- tests/ui/lint/unused/unused-async.stderr | 21 +- tests/ui/lint/unused/unused-result.stderr | 17 + .../lint/unused/unused_attributes-must_use.stderr | 34 + tests/ui/lint/use-redundant.rs | 27 - tests/ui/lint/use-redundant.stderr | 29 - tests/ui/lint/use-redundant/issue-92904.rs | 17 + .../use-redundant/use-redundant-glob-parent.rs | 16 + .../use-redundant/use-redundant-glob-parent.stderr | 17 + tests/ui/lint/use-redundant/use-redundant-glob.rs | 15 + .../lint/use-redundant/use-redundant-glob.stderr | 16 + .../use-redundant-multiple-namespaces.rs | 21 + .../lint/use-redundant/use-redundant-not-parent.rs | 19 + tests/ui/lint/use-redundant/use-redundant.rs | 27 + tests/ui/lint/use-redundant/use-redundant.stderr | 29 + .../liveness-assign-imm-local-with-drop.rs | 1 + tests/ui/macros/bad-concat.stderr | 2 +- tests/ui/macros/concat-bytes-error.stderr | 8 +- tests/ui/macros/concat.stderr | 4 +- tests/ui/macros/issue-100199.stderr | 2 +- tests/ui/macros/issue-106837.rs | 10 + tests/ui/macros/issue-106837.stderr | 18 + tests/ui/macros/issue-109237.rs | 7 + tests/ui/macros/issue-109237.stderr | 18 + tests/ui/macros/issue-40469.rs | 1 - tests/ui/macros/issue-98790.rs | 24 + tests/ui/macros/macro-comma-support-rpass.rs | 1 - tests/ui/macros/macro-include-items.rs | 1 - tests/ui/macros/macro-outer-attributes.stderr | 2 +- tests/ui/macros/macro-path-prelude-fail-4.stderr | 8 + tests/ui/macros/macro-path-prelude-fail-5.rs | 10 + tests/ui/macros/macro-path-prelude-fail-5.stderr | 30 + tests/ui/macros/macros-nonfatal-errors.stderr | 18 +- tests/ui/macros/missing-writer.rs | 17 + tests/ui/macros/missing-writer.stderr | 59 ++ tests/ui/macros/nested-use-as.rs | 83 ++ tests/ui/macros/nonterminal-matching.stderr | 3 + .../all-expr-kinds.rs | 7 +- tests/ui/macros/stringify.rs | 4 - tests/ui/macros/syntax-extension-source-utils.rs | 7 +- tests/ui/malformed/malformed-derive-entry.stderr | 6 +- .../overlap-marker-trait-with-static-lifetime.rs | 6 +- ...verlap-marker-trait-with-static-lifetime.stderr | 31 + .../overlapping-impl-1-modulo-regions.rs | 14 +- .../overlapping-impl-1-modulo-regions.stderr | 14 + tests/ui/match/guards-parenthesized-and.rs | 10 + tests/ui/match/match-range-fail-2.rs | 9 +- tests/ui/match/match-range-fail-2.stderr | 24 +- tests/ui/methods/inherent-bound-in-probe.rs | 49 ++ tests/ui/methods/inherent-bound-in-probe.stderr | 38 + .../methods/method-call-lifetime-args-fail.stderr | 31 +- tests/ui/methods/method-call-lifetime-args.stderr | 5 +- tests/ui/mir-unpretty.rs | 5 - tests/ui/mir-unpretty.stderr | 11 - tests/ui/mir/addrof_alignment.rs | 15 + tests/ui/mir/checks_without_panic_impl.rs | 17 + tests/ui/mir/issue-109004-drop-large-array.rs | 16 + tests/ui/mir/mir_alignment_check.rs | 12 + tests/ui/mir/mir_boxing.rs | 10 - tests/ui/mir/unsize-trait.rs | 15 + tests/ui/mir/validate/transmute_cast_sized.rs | 17 + .../method-help-unsatisfied-bound.stderr | 3 +- .../missing-items/missing-const-parameter.rs | 24 + .../missing-items/missing-const-parameter.stderr | 64 ++ tests/ui/modules/issue-107649.stderr | 3 +- tests/ui/modules/mod_dir_implicit.rs | 1 - tests/ui/modules/mod_dir_path.rs | 1 - tests/ui/modules/mod_dir_path2.rs | 1 - tests/ui/modules/mod_dir_path3.rs | 1 - tests/ui/modules/mod_dir_path_multi.rs | 1 - tests/ui/modules/mod_dir_recursive.rs | 1 - tests/ui/modules/mod_dir_simple.rs | 1 - tests/ui/modules/mod_file.rs | 1 - tests/ui/modules/mod_file_with_path_attr.rs | 1 - .../mod_file_disambig_aux/compiletest-ignore-dir | 0 tests/ui/myriad-closures.rs | 39 + tests/ui/namespace/namespace-mix.stderr | 16 +- tests/ui/never_type/exhaustive_patterns.stderr | 4 +- tests/ui/never_type/issue-52443.rs | 1 + tests/ui/never_type/issue-52443.stderr | 17 +- tests/ui/new-unsafe-pointers.rs | 7 - .../escape-argument-callee.stderr | 2 +- .../closure-requirements/escape-argument.stderr | 2 +- .../propagate-approximated-fail-no-postdom.stderr | 2 +- .../propagate-approximated-ref.stderr | 2 +- ...shorter-to-static-comparing-against-free.stderr | 4 +- ...-approximated-shorter-to-static-no-bound.stderr | 2 +- ...proximated-shorter-to-static-wrong-bound.stderr | 2 +- .../propagate-approximated-val.stderr | 2 +- .../propagate-despite-same-free-region.stderr | 2 +- ...ate-fail-to-approximate-longer-no-bounds.stderr | 2 +- ...-fail-to-approximate-longer-wrong-bounds.stderr | 2 +- .../return-wrong-bound-region.stderr | 2 +- tests/ui/nll/issue-78561.rs | 2 +- .../ui/nll/ty-outlives/impl-trait-captures.stderr | 8 +- ...ty-param-closure-approximate-lower-bound.stderr | 4 +- .../user-annotations/region-error-ice-109072.rs | 14 + .../region-error-ice-109072.stderr | 26 + tests/ui/non_modrs_mods/non_modrs_mods.rs | 1 - .../x/y/z/compiletest-ignore-dir | 0 tests/ui/not-clone-closure.stderr | 3 +- tests/ui/on-unimplemented/no-debug.stderr | 3 +- tests/ui/opt-in-copy.rs | 4 +- tests/ui/opt-in-copy.stderr | 4 +- .../exhaustiveness-non-exhaustive.stderr | 6 +- ...ave-been-expanded-earlier-non-exhaustive.stderr | 6 +- tests/ui/output-type-mismatch.rs | 5 - tests/ui/output-type-mismatch.stderr | 11 - .../panic-runtime/unwind-tables-target-required.rs | 5 +- tests/ui/parser/assoc-static-semantic-fail.rs | 4 +- tests/ui/parser/assoc-static-semantic-fail.stderr | 10 +- tests/ui/parser/attr-stmt-expr-attr-bad.rs | 2 - tests/ui/parser/attr-stmt-expr-attr-bad.stderr | 115 ++- tests/ui/parser/circular_modules_main.stderr | 2 +- tests/ui/parser/default.rs | 2 +- tests/ui/parser/default.stderr | 6 +- tests/ui/parser/dyn-trait-compatibility.rs | 2 +- tests/ui/parser/dyn-trait-compatibility.stderr | 16 +- tests/ui/parser/fn-header-semantic-fail.rs | 3 - tests/ui/parser/fn-header-semantic-fail.stderr | 146 +--- tests/ui/parser/ident-recovery.rs | 16 + tests/ui/parser/ident-recovery.stderr | 42 + tests/ui/parser/integer-literal-start-ident.rs | 2 + tests/ui/parser/integer-literal-start-ident.stderr | 14 + tests/ui/parser/issues/issue-104088.rs | 25 +- tests/ui/parser/issues/issue-104088.stderr | 56 +- .../issues/issue-108242-semicolon-recovery.rs | 5 + .../issues/issue-108242-semicolon-recovery.stderr | 13 + tests/ui/parser/issues/issue-110014.rs | 3 + tests/ui/parser/issues/issue-110014.stderr | 19 + tests/ui/parser/issues/issue-48508.rs | 1 - .../issue-65846-rollback-gating-failing-matcher.rs | 14 +- tests/ui/parser/removed-syntax-box.fixed | 14 + tests/ui/parser/removed-syntax-box.rs | 14 + tests/ui/parser/removed-syntax-box.stderr | 57 ++ tests/ui/parser/trait-pub-assoc-const.rs | 2 +- tests/ui/parser/trait-pub-assoc-const.stderr | 6 +- tests/ui/parser/trait-pub-assoc-ty.rs | 2 +- tests/ui/parser/trait-pub-assoc-ty.stderr | 6 +- tests/ui/parser/trait-pub-method.rs | 2 +- tests/ui/parser/trait-pub-method.stderr | 6 +- ...ther-can-live-while-the-other-survives-1.stderr | 20 +- .../borrowck-pat-at-and-box.stderr | 40 +- ...ck-pat-by-move-and-ref-inverse-promotion.stderr | 5 +- .../borrowck-pat-by-move-and-ref-inverse.stderr | 125 ++- .../borrowck-pat-by-move-and-ref.stderr | 125 ++- .../borrowck-pat-ref-mut-and-ref.stderr | 160 ++-- .../borrowck-pat-ref-mut-twice.stderr | 186 ++--- ...ult-binding-modes-both-sides-independent.stderr | 25 +- tests/ui/pattern/issue-106552.stderr | 6 +- tests/ui/pattern/issue-106862.fixed | 44 + tests/ui/pattern/issue-106862.rs | 44 + tests/ui/pattern/issue-106862.stderr | 48 ++ .../issue-68393-let-pat-assoc-constant.stderr | 12 +- .../ui/pattern/pat-tuple-field-count-cross.stderr | 4 +- ...priate-missing-pattern-excluding-comments.fixed | 2 +- ...riate-missing-pattern-excluding-comments.stderr | 2 +- .../const-partial_eq-fallback-ice.stderr | 3 + tests/ui/pattern/usefulness/consts-opaque.stderr | 145 ++-- .../usefulness/doc-hidden-non-exhaustive.stderr | 10 +- .../empty-match.exhaustive_patterns.stderr | 16 +- .../pattern/usefulness/empty-match.normal.stderr | 16 +- tests/ui/pattern/usefulness/floats.stderr | 2 +- tests/ui/pattern/usefulness/guards.stderr | 2 +- .../integer-ranges/exhaustiveness.stderr | 4 +- .../integer-ranges/pointer-sized-int.deny.stderr | 6 +- .../precise_pointer_matching-message.stderr | 4 +- tests/ui/pattern/usefulness/issue-2111.stderr | 2 +- tests/ui/pattern/usefulness/issue-30240.stderr | 4 +- tests/ui/pattern/usefulness/issue-35609.stderr | 14 +- tests/ui/pattern/usefulness/issue-3601.stderr | 2 +- tests/ui/pattern/usefulness/issue-50900.stderr | 2 +- tests/ui/pattern/usefulness/issue-56379.stderr | 2 +- .../usefulness/match-byte-array-patterns-2.stderr | 4 +- .../usefulness/match-privately-empty.stderr | 2 +- .../pattern/usefulness/match-slice-patterns.stderr | 2 +- .../usefulness/non-exhaustive-defined-here.stderr | 20 +- .../usefulness/non-exhaustive-match-nested.stderr | 2 +- .../pattern/usefulness/non-exhaustive-match.stderr | 12 +- .../usefulness/refutable-pattern-errors.stderr | 4 +- .../usefulness/refutable-pattern-in-fn-arg.stderr | 4 + .../slice-patterns-exhaustiveness.stderr | 40 +- .../usefulness/stable-gated-patterns.stderr | 4 +- .../struct-like-enum-nonexhaustive.stderr | 2 +- .../usefulness/unstable-gated-patterns.stderr | 2 +- .../ui/privacy/auxiliary/xc-private-method-lib.rs | 33 + tests/ui/privacy/effective_visibilities.rs | 7 +- tests/ui/privacy/effective_visibilities.stderr | 66 +- tests/ui/privacy/issue-29161.rs | 2 +- tests/ui/privacy/issue-29161.stderr | 6 +- tests/ui/privacy/priv-in-bad-locations.rs | 8 +- tests/ui/privacy/priv-in-bad-locations.stderr | 20 +- tests/ui/privacy/privacy-ns1.stderr | 6 +- tests/ui/privacy/privacy-ns2.stderr | 6 +- tests/ui/privacy/privacy-sanity.rs | 36 +- tests/ui/privacy/privacy-sanity.stderr | 96 ++- tests/ui/privacy/private-in-public-assoc-ty.rs | 2 +- .../private-in-public-type-alias-impl-trait.rs | 2 +- tests/ui/privacy/useless-pub.rs | 6 +- tests/ui/privacy/useless-pub.stderr | 18 +- tests/ui/privacy/xc-private-method.rs | 11 + tests/ui/privacy/xc-private-method.stderr | 25 + tests/ui/privacy/xc-private-method2.rs | 11 + tests/ui/privacy/xc-private-method2.stderr | 25 + tests/ui/proc-macro/amputate-span.stderr | 4 +- .../proc-macro/attributes-on-modules-fail.stderr | 4 +- tests/ui/proc-macro/bad-projection.rs | 15 + tests/ui/proc-macro/bad-projection.stderr | 9 + tests/ui/proc-macro/derive-bad.rs | 2 +- tests/ui/proc-macro/derive-bad.stderr | 2 +- tests/ui/proc-macro/issue-91800.rs | 2 +- tests/ui/proc-macro/issue-91800.stderr | 2 +- .../proc-macro/macro-namespace-reserved-2.stderr | 16 + tests/ui/proc-macro/proc-macro-abi.rs | 6 +- tests/ui/proc-macro/proc-macro-abi.stderr | 21 +- .../proc-macro/signature-proc-macro-attribute.rs | 10 +- .../signature-proc-macro-attribute.stderr | 46 +- tests/ui/proc-macro/signature-proc-macro-derive.rs | 9 +- .../proc-macro/signature-proc-macro-derive.stderr | 40 +- tests/ui/proc-macro/signature-proc-macro.rs | 9 +- tests/ui/proc-macro/signature-proc-macro.stderr | 40 +- tests/ui/proc-macro/signature.rs | 6 +- tests/ui/proc-macro/signature.stderr | 35 +- tests/ui/proc-macro/span-api-tests.rs | 1 - tests/ui/process/signal-exit-status.rs | 6 +- .../range-pattern-out-of-bounds-issue-68972.rs | 2 - .../range-pattern-out-of-bounds-issue-68972.stderr | 16 +- tests/ui/range/range_traits-2.stderr | 2 +- tests/ui/range/range_traits-3.stderr | 2 +- tests/ui/range/range_traits-6.stderr | 2 +- tests/ui/reachable-unnameable-type-alias.rs | 16 - tests/ui/reachable/expr_box.rs | 8 - tests/ui/reachable/expr_box.stderr | 17 - .../reachable/reachable-unnameable-type-alias.rs | 16 + tests/ui/recursion/issue-95134.rs | 2 +- tests/ui/regions/issue-2718.rs | 327 -------- .../ui/repeat-expr/repeat-to-run-dtor-twice.stderr | 3 +- tests/ui/resolve/crate-in-paths.stderr | 2 +- tests/ui/resolve/disambiguate-identical-names.rs | 15 + .../ui/resolve/disambiguate-identical-names.stderr | 19 + tests/ui/resolve/enums-are-namespaced-xc.stderr | 6 +- tests/ui/resolve/filter-intrinsics.stderr | 4 +- tests/ui/resolve/issue-102946.stderr | 2 +- .../issue-107563-ambiguous-glob-reexports.rs | 33 + .../issue-107563-ambiguous-glob-reexports.stderr | 47 ++ tests/ui/resolve/issue-16058.stderr | 6 +- tests/ui/resolve/issue-17518.stderr | 2 +- tests/ui/resolve/issue-21221-1.stderr | 14 +- tests/ui/resolve/issue-21221-2.stderr | 4 +- tests/ui/resolve/issue-21221-3.stderr | 2 +- tests/ui/resolve/issue-21221-4.stderr | 2 +- tests/ui/resolve/issue-2356.stderr | 2 +- tests/ui/resolve/issue-26545.stderr | 2 +- tests/ui/resolve/issue-35675.stderr | 4 +- tests/ui/resolve/issue-3907.stderr | 2 +- tests/ui/resolve/issue-50599.stderr | 4 +- tests/ui/resolve/issue-73427.stderr | 4 +- tests/ui/resolve/issue-90113.stderr | 2 +- tests/ui/resolve/missing-in-namespace.stderr | 2 +- tests/ui/resolve/no-implicit-prelude-nested.stderr | 30 +- tests/ui/resolve/no-implicit-prelude.stderr | 10 +- tests/ui/resolve/privacy-enum-ctor.stderr | 8 +- tests/ui/resolve/resolve-primitive-fallback.stderr | 2 +- tests/ui/resolve/tool-import.rs | 8 + tests/ui/resolve/tool-import.stderr | 9 + tests/ui/resolve/use_suggestion.stderr | 4 +- tests/ui/resolve/use_suggestion_placement.stderr | 6 +- .../cant-hide-behind-direct-struct-embedded.stderr | 3 + .../cant-hide-behind-direct-struct-param.stderr | 3 + ...ant-hide-behind-doubly-indirect-embedded.stderr | 2 + .../cant-hide-behind-doubly-indirect-param.stderr | 2 + ...ant-hide-behind-indirect-struct-embedded.stderr | 2 + .../cant-hide-behind-indirect-struct-param.stderr | 2 + ...e-61188-match-slice-forbidden-without-eq.stderr | 3 + ...62307-match-ref-ref-forbidden-without-eq.stderr | 4 + .../match-forbidden-without-eq.stderr | 3 + ...atch-nonempty-array-forbidden-without-eq.stderr | 3 + .../match-requires-both-partialeq-and-eq.stderr | 3 + .../issue-103052-2.current.stderr | 15 + .../issue-103052-2.next.stderr | 15 + .../rfc-1937-termination-trait/issue-103052-2.rs | 6 +- .../issue-103052-2.stderr | 15 - .../ui/rfc-2005-default-binding-mode/slice.stderr | 2 +- .../ui/rfc-2008-non-exhaustive/omitted-patterns.rs | 24 + .../omitted-patterns.stderr | 31 +- tests/ui/rfc-2008-non-exhaustive/struct.stderr | 9 +- tests/ui/rfc-2008-non-exhaustive/variant.stderr | 20 +- .../ui/rfc-2091-track-caller/intrinsic-wrapper.rs | 5 +- .../ui/rfc-2091-track-caller/mir-inlined-macro.rs | 23 + .../dbg-macro-requires-debug.stderr | 3 +- .../call-generic-method-nonconst.stderr | 15 +- .../const-closure-trait-method-fail.stderr | 15 +- .../const-drop-fail-2.precise.stderr | 50 ++ .../rfc-2632-const-trait-impl/const-drop-fail-2.rs | 46 ++ .../const-drop-fail-2.stock.stderr | 50 ++ .../const-drop-fail.precise.stderr | 119 +-- .../rfc-2632-const-trait-impl/const-drop-fail.rs | 29 +- .../const-drop-fail.stock.stderr | 119 +-- .../const_derives/derive-const-non-const-type.rs | 1 + .../derive-const-non-const-type.stderr | 27 +- ...fault-method-body-is-const-body-checking.stderr | 13 +- .../function-pointer-does-not-require-const.rs | 13 +- tests/ui/rfc-2632-const-trait-impl/gate.rs | 8 + tests/ui/rfc-2632-const-trait-impl/gate.stderr | 15 +- .../ui/rfc-2632-const-trait-impl/nested-closure.rs | 2 +- .../issue-108645-target-feature-on-main.rs | 7 + .../issue-108645-target-feature-on-main.stderr | 8 + .../issue-108645-target-feature-on-start.rs | 9 + .../issue-108645-target-feature-on-start.stderr | 11 + .../rfcs/rfc-2396-target_feature-11/trait-impl.rs | 6 + .../rfc-2396-target_feature-11/trait-impl.stderr | 11 +- tests/ui/runtime/backtrace-debuginfo.rs | 1 - .../edition-lint-fully-qualified-paths.fixed | 6 +- .../edition-lint-fully-qualified-paths.rs | 6 +- .../edition-lint-fully-qualified-paths.stderr | 13 +- .../rust-2018/issue-52202-use-suggestions.stderr | 8 +- tests/ui/rust-2018/trait-import-suggestions.stderr | 6 +- .../ui/rust-2018/uniform-paths/issue-87932.stderr | 2 +- .../future-prelude-collision-shadow.stderr | 4 +- tests/ui/rustdoc/doc-primitive.rs | 8 + tests/ui/rustdoc/doc-primitive.stderr | 16 + tests/ui/rustdoc/feature-gate-doc_primitive.rs | 6 +- tests/ui/rustdoc/feature-gate-doc_primitive.stderr | 15 +- tests/ui/self/arbitrary_self_types_trait.rs | 5 +- tests/ui/self/class-missing-self.stderr | 2 +- tests/ui/shadowed/shadowed-trait-methods.stderr | 2 +- tests/ui/simd/monomorphize-heterogeneous.rs | 9 + tests/ui/simd/monomorphize-heterogeneous.stderr | 9 + tests/ui/simple_global_asm.rs | 1 + tests/ui/slightly-nice-generic-literal-messages.rs | 14 - .../slightly-nice-generic-literal-messages.stderr | 14 - tests/ui/span/E0204.rs | 8 +- tests/ui/span/E0204.stderr | 8 +- ...2021-incompatible-closure-captures-96258.stderr | 2 +- tests/ui/span/issue-35987.stderr | 2 +- tests/ui/span/issue-71363.stderr | 3 +- tests/ui/specialization/issue-59435.stderr | 3 +- .../bad-const-wf-doesnt-specialize.rs | 12 + .../bad-const-wf-doesnt-specialize.stderr | 14 + .../auxiliary/const-stability-attribute-implies.rs | 12 + .../auxiliary/similar-unstable-method.rs | 13 + .../const-stability-attribute-implies-missing.rs | 16 + ...onst-stability-attribute-implies-missing.stderr | 8 + ...const-stability-attribute-implies-no-feature.rs | 16 + ...t-stability-attribute-implies-no-feature.stderr | 10 + ...nst-stability-attribute-implies-using-stable.rs | 19 + ...stability-attribute-implies-using-stable.stderr | 22 + ...t-stability-attribute-implies-using-unstable.rs | 21 + ...ability-attribute-implies-using-unstable.stderr | 22 + tests/ui/stability-attribute/issue-109177.rs | 13 + tests/ui/stability-attribute/issue-109177.stderr | 21 + tests/ui/static/static-mut-not-constant.rs | 6 +- tests/ui/static/static-mut-not-constant.stderr | 13 +- tests/ui/statics/uninhabited-static.stderr | 4 +- tests/ui/stats/hir-stats.stderr | 86 +- tests/ui/std/issue-15149.rs | 57 ++ tests/ui/std/issue-81357-unsound-file-methods.rs | 81 ++ tests/ui/std/stdio-from.rs | 69 ++ tests/ui/std/switch-stdout.rs | 52 ++ tests/ui/str/str-escape.rs | 22 +- tests/ui/str/str-escape.stderr | 20 +- tests/ui/structs-enums/align-struct.rs | 26 +- tests/ui/structs/struct-path-alias-bounds.stderr | 3 +- tests/ui/structs/struct-tuple-field-names.rs | 3 + tests/ui/structs/struct-tuple-field-names.stderr | 20 +- tests/ui/suggestions/bad-infer-in-trait-impl.rs | 10 + .../ui/suggestions/bad-infer-in-trait-impl.stderr | 14 + .../chain-method-call-mutation-in-place.rs | 6 +- .../chain-method-call-mutation-in-place.stderr | 37 +- ...one-on-unconstrained-borrowed-type-param.stderr | 3 +- .../const-pat-non-exaustive-let-new-var.rs | 5 +- .../const-pat-non-exaustive-let-new-var.stderr | 9 +- .../core-std-import-order-issue-83564.stderr | 4 +- .../correct-binder-for-arbitrary-bound-sugg.rs | 16 + .../correct-binder-for-arbitrary-bound-sugg.stderr | 22 + .../suggestions/derive-macro-missing-bounds.stderr | 3 +- .../derive-trait-for-method-call.stderr | 9 +- .../dont-wrap-ambiguous-receivers.stderr | 4 +- .../expected-boxed-future-isnt-pinned.stderr | 17 +- .../import-trait-for-method-call.stderr | 2 +- tests/ui/suggestions/invalid-bin-op.stderr | 3 +- tests/ui/suggestions/issue-107860.rs | 6 + tests/ui/suggestions/issue-107860.stderr | 12 + tests/ui/suggestions/issue-108470.fixed | 29 + tests/ui/suggestions/issue-108470.rs | 29 + tests/ui/suggestions/issue-108470.stderr | 27 + tests/ui/suggestions/issue-109291.rs | 4 + tests/ui/suggestions/issue-109291.stderr | 12 + tests/ui/suggestions/issue-109396.rs | 12 + tests/ui/suggestions/issue-109396.stderr | 34 + tests/ui/suggestions/issue-109436.rs | 13 + tests/ui/suggestions/issue-109436.stderr | 15 + tests/ui/suggestions/issue-84973-blacklist.stderr | 6 +- tests/ui/suggestions/issue-97760.stderr | 4 +- .../missing-bound-in-derive-copy-impl-3.fixed | 2 +- .../missing-bound-in-derive-copy-impl-3.rs | 2 +- .../missing-bound-in-derive-copy-impl-3.stderr | 6 +- .../missing-bound-in-derive-copy-impl.rs | 2 +- .../missing-bound-in-derive-copy-impl.stderr | 6 +- .../missing-bound-in-manual-copy-impl-2.fixed | 2 +- .../missing-bound-in-manual-copy-impl-2.rs | 2 +- .../missing-bound-in-manual-copy-impl-2.stderr | 2 +- .../missing-bound-in-manual-copy-impl.fixed | 2 +- .../missing-bound-in-manual-copy-impl.rs | 2 +- .../missing-bound-in-manual-copy-impl.stderr | 2 +- .../suggestions/multiline-multipart-suggestion.rs | 19 + .../multiline-multipart-suggestion.stderr | 46 ++ .../suggestions/mut-borrow-needed-by-trait.stderr | 10 +- .../ui/suggestions/no-extern-crate-in-type.stderr | 2 +- .../ui/suggestions/raw-name-use-suggestion.stderr | 2 +- tests/ui/suggestions/ref-pattern-binding.stderr | 20 +- tests/ui/suggestions/suggest-pin-macro.rs | 23 + tests/ui/suggestions/suggest-pin-macro.stderr | 19 + .../ui/suggestions/suggest-ret-on-async-w-late.rs | 11 + .../suggestions/suggest-ret-on-async-w-late.stderr | 11 + .../suggest-tryinto-edition-change.stderr | 14 +- tests/ui/suggestions/use-placement-resolve.stderr | 2 +- tests/ui/suggestions/use-placement-typeck.stderr | 2 +- tests/ui/suppressed-error.rs | 8 - tests/ui/suppressed-error.stderr | 14 - tests/ui/symbol-names/basic.legacy.stderr | 4 +- tests/ui/symbol-names/basic.v0.stderr | 2 +- tests/ui/symbol-names/foreign-types.stderr | 2 +- tests/ui/symbol-names/impl1.v0.stderr | 6 +- tests/ui/symbol-names/issue-60925.legacy.stderr | 4 +- tests/ui/symbol-names/issue-60925.v0.stderr | 2 +- tests/ui/symbol-names/issue-75326.v0.stderr | 2 +- tests/ui/symbol-names/trait-objects.v0.stderr | 6 +- tests/ui/symbol-names/x86-stdcall.rs | 4 +- tests/ui/sync/suggest-once-cell.rs | 2 - tests/ui/sync/suggest-once-cell.stderr | 4 +- tests/ui/sync/suggest-ref-cell.rs | 2 - tests/ui/sync/suggest-ref-cell.stderr | 4 +- tests/ui/tag-that-dare-not-speak-its-name.rs | 16 - tests/ui/tag-that-dare-not-speak-its-name.stderr | 14 - tests/ui/target-feature/gate.rs | 1 - tests/ui/target-feature/gate.stderr | 2 +- tests/ui/target-feature/invalid-attribute.rs | 36 +- tests/ui/target-feature/invalid-attribute.stderr | 95 ++- tests/ui/terr-in-field.rs | 17 - tests/ui/terr-in-field.stderr | 17 - tests/ui/terr-sorts.rs | 15 - tests/ui/terr-sorts.stderr | 23 - .../custom-test-frameworks/issue-107454.rs | 10 + .../custom-test-frameworks/issue-107454.stderr | 15 + tests/ui/test-attrs/issue-109816.rs | 7 + tests/ui/test-attrs/issue-109816.stderr | 16 + .../test-attr-non-associated-functions.rs | 6 +- .../test-attr-non-associated-functions.stderr | 36 +- tests/ui/test-attrs/test-on-not-fn.stderr | 24 +- .../ui/test-attrs/tests-listing-format-default.rs | 18 + .../tests-listing-format-default.run.stdout | 5 + ...sts-listing-format-json-without-unstableopts.rs | 18 + ...ing-format-json-without-unstableopts.run.stderr | 1 + tests/ui/test-attrs/tests-listing-format-json.rs | 21 + .../tests-listing-format-json.run.stdout | 5 + tests/ui/test-attrs/tests-listing-format-terse.rs | 18 + .../tests-listing-format-terse.run.stdout | 3 + tests/ui/thir-print/thir-flat.stdout | 4 +- tests/ui/thir-print/thir-tree-match.stdout | 54 +- tests/ui/thir-print/thir-tree.stdout | 4 +- tests/ui/thread-local-mutation.rs | 18 - tests/ui/thread-local-mutation.stderr | 9 - tests/ui/thread-local-static.rs | 16 - tests/ui/thread-local-static.stderr | 44 - tests/ui/thread-local/auxiliary/tls-export.rs | 17 + tests/ui/thread-local/auxiliary/tls-rlib.rs | 15 + tests/ui/thread-local/thread-local-mutation.rs | 18 + tests/ui/thread-local/thread-local-mutation.stderr | 9 + tests/ui/thread-local/thread-local-static.rs | 16 + tests/ui/thread-local/thread-local-static.stderr | 44 + tests/ui/thread-local/tls-dylib-access.rs | 19 + tests/ui/threads-sendsync/issue-43733-2.rs | 2 +- tests/ui/threads-sendsync/issue-43733.rs | 8 +- .../tool-attributes-misplaced-2.stderr | 8 + .../impl-bound-with-references-error.stderr | 2 +- .../shadowed-path-in-trait-bound-suggestion.stderr | 2 +- tests/ui/traits/alias/dont-elaborate-non-self.rs | 10 + .../ui/traits/alias/dont-elaborate-non-self.stderr | 20 + .../assoc_type_bound_with_struct.rs | 2 +- .../assoc_type_bound_with_struct.stderr | 14 +- .../copy-is-not-modulo-regions.not_static.stderr | 2 +- tests/ui/traits/copy-is-not-modulo-regions.rs | 2 +- tests/ui/traits/dyn-trait.rs | 1 - tests/ui/traits/inductive-overflow/lifetime.rs | 6 +- tests/ui/traits/inductive-overflow/lifetime.stderr | 14 +- .../supertrait-auto-trait.stderr | 3 +- tests/ui/traits/issue-50480.rs | 4 +- tests/ui/traits/issue-50480.stderr | 4 +- tests/ui/traits/issue-71136.stderr | 3 +- tests/ui/traits/issue-78372.stderr | 2 +- tests/ui/traits/issue-87558.stderr | 6 + tests/ui/traits/issue-91949-hangs-on-recursion.rs | 2 +- .../traits/issue-91949-hangs-on-recursion.stderr | 12 +- tests/ui/traits/item-privacy.stderr | 6 +- tests/ui/traits/method-private.stderr | 2 +- .../new-solver/alias-eq-in-canonical-response.rs | 40 + tests/ui/traits/new-solver/alias-sub.rs | 34 + ...alias_eq_dont_use_normalizes_to_if_substs_eq.rs | 2 +- .../auto-with-drop_tracking_mir.fail.stderr | 18 + .../new-solver/auto-with-drop_tracking_mir.rs | 26 + .../new-solver/canonical-int-var-eq-in-response.rs | 22 + .../new-solver/canonical-ty-var-eq-in-response.rs | 39 + .../new-solver/cast-checks-handling-projections.rs | 6 + .../new-solver/closure-inference-guidance.rs | 11 + .../ui/traits/new-solver/coherence/issue-102048.rs | 44 + .../new-solver/coherence/issue-102048.stderr | 12 + .../new-solver/const-param-placeholder.fail.stderr | 16 + .../traits/new-solver/const-param-placeholder.rs | 21 + .../ui/traits/new-solver/deduce-ty-from-object.rs | 6 + tests/ui/traits/new-solver/destruct.rs | 13 + .../new-solver/dont-elaborate-for-projections.rs | 12 + .../new-solver/equating-projection-cyclically.rs | 24 + .../equating-projection-cyclically.stderr | 14 + tests/ui/traits/new-solver/float-canonical.rs | 8 + tests/ui/traits/new-solver/fn-trait.rs | 21 +- tests/ui/traits/new-solver/fn-trait.stderr | 124 +++ tests/ui/traits/new-solver/int-var-alias-eq.rs | 18 + tests/ui/traits/new-solver/int-var-is-send.rs | 8 + .../ui/traits/new-solver/iter-filter-projection.rs | 12 + .../traits/new-solver/lazy-nested-obligations-1.rs | 13 + .../traits/new-solver/lazy-nested-obligations-2.rs | 23 + .../traits/new-solver/lazy-nested-obligations-3.rs | 38 + tests/ui/traits/new-solver/more-object-bound.rs | 2 +- .../ui/traits/new-solver/more-object-bound.stderr | 13 +- .../nested-obligations-with-bound-vars-gat.rs | 43 + .../ui/traits/new-solver/normalize-param-env-1.rs | 40 + .../ui/traits/new-solver/normalize-param-env-2.rs | 26 + .../ui/traits/new-solver/normalize-param-env-3.rs | 32 + tests/ui/traits/new-solver/param-discr-kind.rs | 8 + tests/ui/traits/new-solver/pointee.rs | 18 +- tests/ui/traits/new-solver/pointer-like.rs | 2 +- tests/ui/traits/new-solver/pointer-like.stderr | 2 +- .../new-solver/prefer-candidate-no-constraints.rs | 22 + .../new-solver/prefer-param-env-on-ambiguity.rs | 10 + .../ui/traits/new-solver/projection-discr-kind.rs | 18 + .../traits/new-solver/projection-discr-kind.stderr | 17 + .../new-solver/recursive-self-normalization-2.rs | 19 + .../recursive-self-normalization-2.stderr | 16 + .../new-solver/recursive-self-normalization.rs | 15 + .../new-solver/recursive-self-normalization.stderr | 16 + .../new-solver/runaway-impl-candidate-selection.rs | 15 + .../runaway-impl-candidate-selection.stderr | 9 + .../traits/new-solver/specialization-transmute.rs | 30 + .../new-solver/specialization-transmute.stderr | 31 + .../new-solver/specialization-unconstrained.rs | 22 + .../new-solver/specialization-unconstrained.stderr | 25 + .../stall-num-var-auto-trait.fallback.stderr | 17 + .../traits/new-solver/stall-num-var-auto-trait.rs | 25 + .../traits/non_lifetime_binders/bad-copy-cond.rs | 9 + .../non_lifetime_binders/bad-copy-cond.stderr | 24 + .../capture-late-ct-in-anon.rs | 11 + .../capture-late-ct-in-anon.stderr | 19 + .../ui/traits/non_lifetime_binders/method-probe.rs | 16 + .../non_lifetime_binders/method-probe.stderr | 11 + .../non_lifetime_binders/missing-assoc-item.rs | 11 + .../non_lifetime_binders/missing-assoc-item.stderr | 23 + .../supertrait-object-safety.rs | 24 + .../supertrait-object-safety.stderr | 56 ++ .../coherence-conflict.next.stderr | 11 + .../reservation-impl/coherence-conflict.old.stderr | 13 + .../traits/reservation-impl/coherence-conflict.rs | 3 +- .../reservation-impl/coherence-conflict.stderr | 13 - .../ui/traits/reservation-impl/no-use.next.stderr | 13 + tests/ui/traits/reservation-impl/no-use.old.stderr | 13 + tests/ui/traits/reservation-impl/no-use.rs | 3 +- tests/ui/traits/reservation-impl/no-use.stderr | 13 - tests/ui/traits/reservation-impl/non-lattice-ok.rs | 6 + tests/ui/traits/reservation-impl/ok.rs | 3 + .../cycle-via-builtin-auto-trait-impl.rs | 34 + .../cycle-via-builtin-auto-trait-impl.stderr | 24 + .../alias-where-clause-isnt-supertrait.rs | 33 + .../alias-where-clause-isnt-supertrait.stderr | 14 + .../trait-upcasting/cyclic-trait-resolution.stderr | 9 +- tests/ui/traits/wrong-mul-method-signature.rs | 68 ++ tests/ui/traits/wrong-mul-method-signature.stderr | 56 ++ .../should_require_well_defined_layout.stderr | 30 +- ...imitive_reprs_should_have_correct_length.stderr | 100 +-- .../repr/should_require_well_defined_layout.stderr | 30 +- .../enums/should_pad_variants.stderr | 5 +- .../enums/should_respect_endianness.stderr | 5 +- tests/ui/transmutability/issue-101739-1.rs | 2 +- tests/ui/transmutability/issue-101739-1.stderr | 12 +- .../transmutability/primitives/bool.current.stderr | 18 + .../ui/transmutability/primitives/bool.next.stderr | 18 + tests/ui/transmutability/primitives/bool.rs | 4 +- tests/ui/transmutability/primitives/bool.stderr | 19 - .../primitives/numbers.current.stderr | 858 +++++++++++++++++++ .../transmutability/primitives/numbers.next.stderr | 858 +++++++++++++++++++ tests/ui/transmutability/primitives/numbers.rs | 3 + tests/ui/transmutability/primitives/numbers.stderr | 915 --------------------- .../transmutability/primitives/unit.current.stderr | 24 + .../ui/transmutability/primitives/unit.next.stderr | 24 + tests/ui/transmutability/primitives/unit.rs | 3 + tests/ui/transmutability/primitives/unit.stderr | 25 - tests/ui/transmutability/references.current.stderr | 25 + tests/ui/transmutability/references.next.stderr | 25 + tests/ui/transmutability/references.rs | 3 + tests/ui/transmutability/references.stderr | 26 - .../repr/should_require_well_defined_layout.stderr | 60 +- .../repr/should_require_well_defined_layout.stderr | 10 +- .../unions/should_pad_variants.stderr | 5 +- .../unions/should_reject_contraction.stderr | 5 +- .../unions/should_reject_disjoint.stderr | 10 +- .../unions/should_reject_intersecting.stderr | 10 +- .../should_reject_if_dst_has_private_field.stderr | 5 +- ...should_reject_if_dst_has_private_variant.stderr | 5 +- ...ould_reject_if_dst_has_unreachable_field.stderr | 5 +- .../should_reject_if_dst_has_unreachable_ty.stderr | 5 +- tests/ui/transmute/transmute-padding-ice.stderr | 5 +- tests/ui/tuple-index.rs | 32 - tests/ui/tuple/tuple-index.rs | 32 + tests/ui/type-alias-impl-trait/assoc-type-const.rs | 2 +- .../assoc-type-lifetime-unconstrained.rs | 2 +- .../type-alias-impl-trait/assoc-type-lifetime.rs | 2 +- .../associated-type-impl-trait-lifetime.rs | 2 +- .../auxiliary/collect_hidden_types.rs | 2 +- .../auxiliary/cross_crate_ice2.rs | 2 +- .../impl-with-unconstrained-param.rs | 2 +- .../imply_bounds_from_bounds.rs | 2 +- .../imply_bounds_from_bounds_param.rs | 6 +- .../imply_bounds_from_bounds_param.stderr | 2 +- .../incoherent-assoc-imp-trait.rs | 2 +- tests/ui/type-alias-impl-trait/issue-53598.rs | 2 +- .../issue-57188-associate-impl-capture.rs | 2 +- .../issue-57611-trait-alias.rs | 2 +- tests/ui/type-alias-impl-trait/issue-57700.rs | 2 +- .../issue-57807-associated-type.rs | 2 +- tests/ui/type-alias-impl-trait/issue-58887.rs | 2 +- tests/ui/type-alias-impl-trait/issue-60371.rs | 2 +- tests/ui/type-alias-impl-trait/issue-60371.stderr | 4 +- .../type-alias-impl-trait/issue-60564-working.rs | 2 +- .../issue-62000-associate-impl-trait-lifetimes.rs | 2 +- tests/ui/type-alias-impl-trait/issue-74761-2.rs | 2 +- tests/ui/type-alias-impl-trait/issue-74761.rs | 2 +- tests/ui/type-alias-impl-trait/issue-78450.rs | 2 +- tests/ui/type-alias-impl-trait/issue-89952.rs | 2 +- tests/ui/type-alias-impl-trait/issue-90400-1.rs | 2 +- tests/ui/type-alias-impl-trait/issue-90400-2.rs | 2 +- tests/ui/type-alias-impl-trait/issue-94429.rs | 4 +- ...type-alias-impl-trait-unconstrained-lifetime.rs | 2 +- tests/ui/type/type-check/assignment-in-if.stderr | 9 - .../ui/type/type-check/point-at-inference-3.fixed | 3 +- tests/ui/type/type-check/point-at-inference-3.rs | 3 +- .../ui/type/type-check/point-at-inference-3.stderr | 6 +- tests/ui/type/type-check/point-at-inference-4.rs | 3 + .../ui/type/type-check/point-at-inference-4.stderr | 11 +- tests/ui/type/type-check/point-at-inference.stderr | 4 +- tests/ui/typeck/bad-type-in-vec-contains.stderr | 1 - tests/ui/typeck/bad-type-in-vec-push.stderr | 2 - tests/ui/typeck/explain_clone_autoref.stderr | 3 +- tests/ui/typeck/issue-105946.rs | 8 +- tests/ui/typeck/issue-105946.stderr | 32 +- tests/ui/typeck/issue-107775.stderr | 6 +- tests/ui/typeck/issue-110052.rs | 12 + tests/ui/typeck/issue-110052.stderr | 9 + tests/ui/typeck/issue-43189.stderr | 2 +- tests/ui/typeck/issue-87935-unsized-box-expr.rs | 10 - .../ui/typeck/issue-87935-unsized-box-expr.stderr | 12 - tests/ui/typeck/issue-90164.stderr | 3 +- .../lazy-norm/cast-checks-handling-projections.rs | 6 - .../cast-checks-handling-projections.stderr | 9 - .../lazy-norm/equating-projection-cyclically.rs | 24 - .../equating-projection-cyclically.stderr | 14 - tests/ui/typeck/output-type-mismatch.rs | 5 + tests/ui/typeck/output-type-mismatch.stderr | 11 + tests/ui/typeck/suppressed-error.rs | 8 + tests/ui/typeck/suppressed-error.stderr | 14 + .../ui/typeck/tag-that-dare-not-speak-its-name.rs | 16 + .../typeck/tag-that-dare-not-speak-its-name.stderr | 14 + tests/ui/typeck/terr-in-field.rs | 17 + tests/ui/typeck/terr-in-field.stderr | 17 + tests/ui/typeck/terr-sorts.rs | 15 + tests/ui/typeck/terr-sorts.stderr | 23 + tests/ui/typeck/while-type-error.rs | 3 + tests/ui/typeck/while-type-error.stderr | 12 + tests/ui/typeck/wrong-ret-type.rs | 3 + tests/ui/typeck/wrong-ret-type.stderr | 16 + tests/ui/ufcs-polymorphic-paths.rs | 154 ---- tests/ui/ufcs/ufcs-partially-resolved.rs | 44 +- tests/ui/ufcs/ufcs-partially-resolved.stderr | 190 +++-- tests/ui/ufcs/ufcs-polymorphic-paths.rs | 154 ++++ tests/ui/underscore-imports/shadow.stderr | 2 +- tests/ui/union/field_checks.rs | 10 +- tests/ui/union/field_checks.stderr | 30 +- tests/ui/union/issue-41073.rs | 2 +- tests/ui/union/issue-41073.stderr | 6 +- tests/ui/union/union-copy.rs | 2 +- tests/ui/union/union-copy.stderr | 2 +- .../ui/union/union-derive-clone.mirunsafeck.stderr | 6 +- .../union/union-derive-clone.thirunsafeck.stderr | 6 +- tests/ui/union/union-derive-eq.mirunsafeck.stderr | 3 +- tests/ui/union/union-derive-eq.thirunsafeck.stderr | 3 +- .../union-with-drop-fields.mirunsafeck.stderr | 18 +- tests/ui/union/union-with-drop-fields.rs | 6 +- .../union-with-drop-fields.thirunsafeck.stderr | 18 +- tests/ui/union/unresolved-field-isnt-copy.rs | 8 + tests/ui/union/unresolved-field-isnt-copy.stderr | 9 + tests/ui/unique-object-noncopyable.rs | 25 - tests/ui/unique-object-noncopyable.stderr | 25 - tests/ui/unique-pinned-nocopy.rs | 14 - tests/ui/unique-pinned-nocopy.stderr | 27 - tests/ui/unique/unique-assign-copy.rs | 12 - tests/ui/unique/unique-assign-drop.rs | 10 - tests/ui/unique/unique-assign-generic.rs | 11 - tests/ui/unique/unique-assign.rs | 8 - tests/ui/unique/unique-autoderef-field.rs | 10 - tests/ui/unique/unique-autoderef-index.rs | 6 - tests/ui/unique/unique-cmp.rs | 11 - tests/ui/unique/unique-containing-tag.rs | 25 - tests/ui/unique/unique-create.rs | 11 - tests/ui/unique/unique-decl-init-copy.rs | 11 - tests/ui/unique/unique-decl-init.rs | 7 - tests/ui/unique/unique-decl-move.rs | 7 - tests/ui/unique/unique-decl.rs | 11 - tests/ui/unique/unique-deref.rs | 6 - tests/ui/unique/unique-destructure.rs | 9 - tests/ui/unique/unique-drop-complex.rs | 6 - tests/ui/unique/unique-ffi-symbols.rs | 16 - tests/ui/unique/unique-fn-arg-move.rs | 10 - tests/ui/unique/unique-fn-arg-mut.rs | 11 - tests/ui/unique/unique-fn-arg.rs | 11 - tests/ui/unique/unique-fn-ret.rs | 9 - tests/ui/unique/unique-generic-assign.rs | 11 - tests/ui/unique/unique-in-tag.rs | 20 - tests/ui/unique/unique-in-vec-copy.rs | 15 - tests/ui/unique/unique-in-vec.rs | 6 - tests/ui/unique/unique-init.rs | 6 - tests/ui/unique/unique-kinds.rs | 64 -- tests/ui/unique/unique-log.rs | 6 - tests/ui/unique/unique-match-discrim.rs | 12 - tests/ui/unique/unique-move-drop.rs | 10 - tests/ui/unique/unique-move-temp.rs | 8 - tests/ui/unique/unique-move.rs | 9 - tests/ui/unique/unique-mutable.rs | 7 - tests/ui/unique/unique-object-move.rs | 18 - tests/ui/unique/unique-pat-2.rs | 18 - tests/ui/unique/unique-pat-3.rs | 16 - tests/ui/unique/unique-pat.rs | 14 - tests/ui/unique/unique-rec.rs | 9 - tests/ui/unique/unique-send-2.rs | 33 - tests/ui/unique/unique-send.rs | 10 - tests/ui/unique/unique-swap.rs | 11 - tests/ui/unpretty-expr-fn-arg.rs | 13 - tests/ui/unpretty-expr-fn-arg.stdout | 17 - tests/ui/unpretty/box.rs | 9 + tests/ui/unpretty/box.stdout | 14 + tests/ui/unpretty/flattened-format-args.rs | 8 + tests/ui/unpretty/flattened-format-args.stdout | 16 + tests/ui/unpretty/mir-unpretty.rs | 5 + tests/ui/unpretty/mir-unpretty.stderr | 11 + tests/ui/unpretty/unpretty-expr-fn-arg.rs | 13 + tests/ui/unpretty/unpretty-expr-fn-arg.stdout | 17 + tests/ui/unresolved/unresolved-candidates.stderr | 2 +- tests/ui/unsafe-fn-called-from-unsafe-blk.rs | 18 - tests/ui/unsafe-fn-called-from-unsafe-fn.rs | 17 - tests/ui/unsafe-pointer-assignability.rs | 11 - .../ui/unsafe/foreign-unsafe-fn-called.mir.stderr | 11 + tests/ui/unsafe/foreign-unsafe-fn-called.rs | 14 + .../ui/unsafe/foreign-unsafe-fn-called.thir.stderr | 11 + tests/ui/unsafe/new-unsafe-pointers.rs | 7 + .../ui/unsafe/unsafe-fn-called-from-unsafe-blk.rs | 18 + tests/ui/unsafe/unsafe-fn-called-from-unsafe-fn.rs | 17 + tests/ui/unsafe/unsafe-fn-deref-ptr.mir.stderr | 28 +- tests/ui/unsafe/unsafe-fn-deref-ptr.rs | 3 + tests/ui/unsafe/unsafe-fn-deref-ptr.thir.stderr | 28 +- tests/ui/unsafe/unsafe-pointer-assignability.rs | 11 + tests/ui/unterminated-comment.rs | 1 - tests/ui/unterminated-comment.stderr | 9 - tests/ui/unterminated-nested-comment.rs | 4 - tests/ui/unterminated-nested-comment.stderr | 21 - tests/ui/unwind-unique.rs | 15 - tests/ui/use.rs | 23 - tests/ui/use/use-mod.rs | 19 - tests/ui/use/use-mod.stderr | 33 - tests/ui/use/use-mod/use-mod.rs | 19 + tests/ui/use/use-mod/use-mod.stderr | 33 + tests/ui/use/use.rs | 23 + .../ui/variance-intersection-of-ref-and-opt-ref.rs | 25 - tests/ui/variance-iterators-in-libcore.rs | 10 - .../variance-intersection-of-ref-and-opt-ref.rs | 25 + tests/ui/variance/variance-iterators-in-libcore.rs | 10 + tests/ui/wasm-custom-section-relocations.rs | 15 - tests/ui/wasm-custom-section-relocations.stderr | 14 - tests/ui/wasm/wasm-custom-section-relocations.rs | 15 + .../ui/wasm/wasm-custom-section-relocations.stderr | 14 + tests/ui/wf/hir-wf-check-erase-regions.rs | 4 +- tests/ui/wf/hir-wf-check-erase-regions.stderr | 16 +- tests/ui/wf/issue-110157.rs | 12 + tests/ui/wf/issue-110157.stderr | 32 + tests/ui/wf/wf-const-type.stderr | 3 +- tests/ui/wf/wf-static-type.stderr | 3 +- .../higher-ranked-fn-type.verbose.stderr | 4 +- .../where-clauses-method-unsatisfied.stderr | 3 +- .../where-clauses/where-clauses-unsatisfied.stderr | 3 +- tests/ui/while-type-error.rs | 3 - tests/ui/while-type-error.stderr | 12 - tests/ui/wrong-mul-method-signature.rs | 68 -- tests/ui/wrong-mul-method-signature.stderr | 56 -- tests/ui/wrong-ret-type.rs | 3 - tests/ui/wrong-ret-type.stderr | 16 - tests/ui/xc-private-method.rs | 11 - tests/ui/xc-private-method.stderr | 25 - tests/ui/xc-private-method2.rs | 11 - tests/ui/xc-private-method2.stderr | 25 - 3874 files changed, 38126 insertions(+), 23216 deletions(-) create mode 100644 tests/assembly/asm/m68k-types.rs create mode 100644 tests/codegen-units/polymorphization/auxiliary/poly-dep.rs create mode 100644 tests/codegen-units/polymorphization/poly-foreign.rs delete mode 100644 tests/codegen/auxiliary/static_dllimport_aux.rs create mode 100644 tests/codegen/comparison-operators-2-tuple.rs create mode 100644 tests/codegen/debug-limited.rs create mode 100644 tests/codegen/debug-line-directives-only.rs create mode 100644 tests/codegen/debug-line-tables-only.rs create mode 100644 tests/codegen/inline-function-args-debug-info.rs create mode 100644 tests/codegen/intrinsics/transmute-x64.rs create mode 100644 tests/codegen/intrinsics/transmute.rs delete mode 100644 tests/codegen/issue-103285-ptr-addr-overflow-check.rs delete mode 100644 tests/codegen/issue-103840.rs delete mode 100644 tests/codegen/issue-105386-ub-in-debuginfo.rs delete mode 100644 tests/codegen/issue-13018.rs delete mode 100644 tests/codegen/issue-15953.rs delete mode 100644 tests/codegen/issue-27130.rs delete mode 100644 tests/codegen/issue-32031.rs delete mode 100644 tests/codegen/issue-32364.rs delete mode 100644 tests/codegen/issue-34634.rs delete mode 100644 tests/codegen/issue-34947-pow-i32.rs delete mode 100644 tests/codegen/issue-37945.rs delete mode 100644 tests/codegen/issue-44056-macos-tls-align.rs delete mode 100644 tests/codegen/issue-45222.rs delete mode 100644 tests/codegen/issue-45466.rs delete mode 100644 tests/codegen/issue-45964-bounds-check-slice-pos.rs delete mode 100644 tests/codegen/issue-47278.rs delete mode 100644 tests/codegen/issue-47442.rs delete mode 100644 tests/codegen/issue-56267-2.rs delete mode 100644 tests/codegen/issue-56267.rs delete mode 100644 tests/codegen/issue-56927.rs delete mode 100644 tests/codegen/issue-58881.rs delete mode 100644 tests/codegen/issue-59352.rs delete mode 100644 tests/codegen/issue-69101-bounds-check.rs delete mode 100644 tests/codegen/issue-73031.rs delete mode 100644 tests/codegen/issue-73338-effecient-cmp.rs delete mode 100644 tests/codegen/issue-73396-bounds-check-after-position.rs delete mode 100644 tests/codegen/issue-73827-bounds-check-index-in-subexpr.rs delete mode 100644 tests/codegen/issue-75525-bounds-checks.rs delete mode 100644 tests/codegen/issue-75546.rs delete mode 100644 tests/codegen/issue-75659.rs delete mode 100644 tests/codegen/issue-77812.rs delete mode 100644 tests/codegen/issue-81408-dllimport-thinlto-windows.rs delete mode 100644 tests/codegen/issue-84268.rs delete mode 100644 tests/codegen/issue-85872-multiple-reverse.rs delete mode 100644 tests/codegen/issue-86106.rs delete mode 100644 tests/codegen/issue-96274.rs delete mode 100644 tests/codegen/issue-96497-slice-size-nowrap.rs delete mode 100644 tests/codegen/issue-98156-const-arg-temp-lifetime.rs delete mode 100644 tests/codegen/issue-98294-get-mut-copy-from-slice-opt.rs create mode 100644 tests/codegen/issues/auxiliary/static_dllimport_aux.rs create mode 100644 tests/codegen/issues/issue-101048.rs create mode 100644 tests/codegen/issues/issue-101082.rs create mode 100644 tests/codegen/issues/issue-101814.rs create mode 100644 tests/codegen/issues/issue-103132.rs create mode 100644 tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs create mode 100644 tests/codegen/issues/issue-103327.rs create mode 100644 tests/codegen/issues/issue-103840.rs create mode 100644 tests/codegen/issues/issue-105386-ub-in-debuginfo.rs create mode 100644 tests/codegen/issues/issue-106369.rs create mode 100644 tests/codegen/issues/issue-13018.rs create mode 100644 tests/codegen/issues/issue-15953.rs create mode 100644 tests/codegen/issues/issue-27130.rs create mode 100644 tests/codegen/issues/issue-32031.rs create mode 100644 tests/codegen/issues/issue-32364.rs create mode 100644 tests/codegen/issues/issue-34634.rs create mode 100644 tests/codegen/issues/issue-34947-pow-i32.rs create mode 100644 tests/codegen/issues/issue-37945.rs create mode 100644 tests/codegen/issues/issue-44056-macos-tls-align.rs create mode 100644 tests/codegen/issues/issue-45222.rs create mode 100644 tests/codegen/issues/issue-45466.rs create mode 100644 tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs create mode 100644 tests/codegen/issues/issue-47278.rs create mode 100644 tests/codegen/issues/issue-47442.rs create mode 100644 tests/codegen/issues/issue-56267-2.rs create mode 100644 tests/codegen/issues/issue-56267.rs create mode 100644 tests/codegen/issues/issue-56927.rs create mode 100644 tests/codegen/issues/issue-58881.rs create mode 100644 tests/codegen/issues/issue-59352.rs create mode 100644 tests/codegen/issues/issue-69101-bounds-check.rs create mode 100644 tests/codegen/issues/issue-73031.rs create mode 100644 tests/codegen/issues/issue-73258.rs create mode 100644 tests/codegen/issues/issue-73338-effecient-cmp.rs create mode 100644 tests/codegen/issues/issue-73396-bounds-check-after-position.rs create mode 100644 tests/codegen/issues/issue-73827-bounds-check-index-in-subexpr.rs create mode 100644 tests/codegen/issues/issue-75525-bounds-checks.rs create mode 100644 tests/codegen/issues/issue-75546.rs create mode 100644 tests/codegen/issues/issue-75659.rs create mode 100644 tests/codegen/issues/issue-75978.rs create mode 100644 tests/codegen/issues/issue-77812.rs create mode 100644 tests/codegen/issues/issue-81408-dllimport-thinlto-windows.rs create mode 100644 tests/codegen/issues/issue-84268.rs create mode 100644 tests/codegen/issues/issue-85872-multiple-reverse.rs create mode 100644 tests/codegen/issues/issue-86106.rs create mode 100644 tests/codegen/issues/issue-96274.rs create mode 100644 tests/codegen/issues/issue-96497-slice-size-nowrap.rs create mode 100644 tests/codegen/issues/issue-98156-const-arg-temp-lifetime.rs create mode 100644 tests/codegen/issues/issue-98294-get-mut-copy-from-slice-opt.rs create mode 100644 tests/codegen/issues/issue-99960.rs create mode 100644 tests/codegen/mem-replace-big-type.rs create mode 100644 tests/codegen/ptr-read-metadata.rs create mode 100644 tests/codegen/slice-indexing.rs create mode 100644 tests/codegen/vec-as-ptr.rs create mode 100644 tests/incremental/auxiliary/circular-dependencies-aux.rs create mode 100644 tests/incremental/circular-dependencies.rs create mode 100644 tests/incremental/issue-108481-feed-eval-always.rs create mode 100644 tests/mir-opt/basic_assignment.main.ElaborateDrops.diff create mode 100644 tests/mir-opt/building/custom/aggregate_exprs.adt.built.after.mir create mode 100644 tests/mir-opt/building/custom/aggregate_exprs.array.built.after.mir create mode 100644 tests/mir-opt/building/custom/aggregate_exprs.rs create mode 100644 tests/mir-opt/building/custom/aggregate_exprs.tuple.built.after.mir create mode 100644 tests/mir-opt/building/custom/as_cast.float_to_int.built.after.mir create mode 100644 tests/mir-opt/building/custom/as_cast.int_to_int.built.after.mir create mode 100644 tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir create mode 100644 tests/mir-opt/building/custom/as_cast.rs create mode 100644 tests/mir-opt/building/custom/composite_return.rs create mode 100644 tests/mir-opt/building/custom/composite_return.tuple.built.after.mir create mode 100644 tests/mir-opt/building/custom/references.raw_pointer_offset.built.after.mir create mode 100644 tests/mir-opt/building/shifts.rs create mode 100644 tests/mir-opt/building/shifts.shift_signed.built.after.mir create mode 100644 tests/mir-opt/building/shifts.shift_unsigned.built.after.mir create mode 100644 tests/mir-opt/combine_transmutes.adt_transmutes.InstCombine.diff create mode 100644 tests/mir-opt/combine_transmutes.identity_transmutes.InstCombine.diff create mode 100644 tests/mir-opt/combine_transmutes.integer_transmutes.InstCombine.diff create mode 100644 tests/mir-opt/combine_transmutes.rs create mode 100644 tests/mir-opt/const_prop/invalid_constant.main.RemoveZsts.diff create mode 100644 tests/mir-opt/const_prop/transmute.from_char.ConstProp.diff create mode 100644 tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.diff create 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.diff create mode 100644 tests/mir-opt/const_prop/transmute.rs create 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.diff create mode 100644 tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.diff create mode 100644 tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.diff create mode 100644 tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.diff create mode 100644 tests/mir-opt/const_prop/transmute.valid_char.ConstProp.diff create mode 100644 tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.diff create mode 100644 tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.diff create mode 100644 tests/mir-opt/copy-prop/reborrow.remut.CopyProp.diff create mode 100644 tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.diff create mode 100644 tests/mir-opt/copy-prop/reborrow.rs delete mode 100644 tests/mir-opt/div_overflow.const_dividend.PreCodegen.after.mir delete mode 100644 tests/mir-opt/div_overflow.const_divisor.PreCodegen.after.mir delete mode 100644 tests/mir-opt/div_overflow.rs create mode 100644 tests/mir-opt/inline/unchecked_shifts.rs create mode 100644 tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff create mode 100644 tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir create mode 100644 tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff create mode 100644 tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir create mode 100644 tests/mir-opt/inline/unwrap_unchecked.rs create mode 100644 tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff create mode 100644 tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir create mode 100644 tests/mir-opt/instcombine_duplicate_switch_targets.assert_zero.InstCombine.diff create mode 100644 tests/mir-opt/instcombine_duplicate_switch_targets.rs create mode 100644 tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.mir create mode 100644 tests/mir-opt/issue_104451_unwindable_intrinsics.rs create mode 100644 tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff create mode 100644 tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.diff create mode 100644 tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.diff create mode 100644 tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.diff create mode 100644 tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.diff create mode 100644 tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff create mode 100644 tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff create mode 100644 tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff create mode 100644 tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.diff create mode 100644 tests/mir-opt/simplify_duplicate_unreachable_blocks.assert_nonzero_nonmax.SimplifyCfg-after-uninhabited-enum-branching.diff create mode 100644 tests/mir-opt/simplify_duplicate_unreachable_blocks.rs delete mode 100644 tests/mir-opt/sroa.constant.ScalarReplacementOfAggregates.diff delete mode 100644 tests/mir-opt/sroa.copies.ScalarReplacementOfAggregates.diff delete mode 100644 tests/mir-opt/sroa.dropping.ScalarReplacementOfAggregates.diff delete mode 100644 tests/mir-opt/sroa.enums.ScalarReplacementOfAggregates.diff delete mode 100644 tests/mir-opt/sroa.escaping.ScalarReplacementOfAggregates.diff delete mode 100644 tests/mir-opt/sroa.flat.ScalarReplacementOfAggregates.diff delete mode 100644 tests/mir-opt/sroa.ref_copies.ScalarReplacementOfAggregates.diff delete mode 100644 tests/mir-opt/sroa.rs delete mode 100644 tests/mir-opt/sroa.structs.ScalarReplacementOfAggregates.diff delete mode 100644 tests/mir-opt/sroa.unions.ScalarReplacementOfAggregates.diff create mode 100644 tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff create mode 100644 tests/mir-opt/sroa/lifetimes.rs create mode 100644 tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff create mode 100644 tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff create mode 100644 tests/mir-opt/sroa/structs.dropping.ScalarReplacementOfAggregates.diff create mode 100644 tests/mir-opt/sroa/structs.enums.ScalarReplacementOfAggregates.diff create mode 100644 tests/mir-opt/sroa/structs.escaping.ScalarReplacementOfAggregates.diff create mode 100644 tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff create mode 100644 tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff create mode 100644 tests/mir-opt/sroa/structs.rs create mode 100644 tests/mir-opt/sroa/structs.structs.ScalarReplacementOfAggregates.diff create mode 100644 tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff delete mode 100644 tests/run-make-fulldeps/a-b-a-linker-guard/Makefile delete mode 100644 tests/run-make-fulldeps/a-b-a-linker-guard/a.rs delete mode 100644 tests/run-make-fulldeps/a-b-a-linker-guard/b.rs delete mode 100644 tests/run-make-fulldeps/alloc-no-oom-handling/Makefile delete mode 100644 tests/run-make-fulldeps/alloc-no-rc/Makefile delete mode 100644 tests/run-make-fulldeps/alloc-no-sync/Makefile delete mode 100644 tests/run-make-fulldeps/allow-non-lint-warnings-cmdline/Makefile delete mode 100644 tests/run-make-fulldeps/allow-non-lint-warnings-cmdline/foo.rs delete mode 100644 tests/run-make-fulldeps/allow-warnings-cmdline-stability/Makefile delete mode 100644 tests/run-make-fulldeps/allow-warnings-cmdline-stability/bar.rs delete mode 100644 tests/run-make-fulldeps/allow-warnings-cmdline-stability/foo.rs delete mode 100644 tests/run-make-fulldeps/archive-duplicate-names/Makefile delete mode 100644 tests/run-make-fulldeps/archive-duplicate-names/bar.c delete mode 100644 tests/run-make-fulldeps/archive-duplicate-names/bar.rs delete mode 100644 tests/run-make-fulldeps/archive-duplicate-names/foo.c delete mode 100644 tests/run-make-fulldeps/archive-duplicate-names/foo.rs delete mode 100644 tests/run-make-fulldeps/arguments-non-c-like-enum/Makefile delete mode 100644 tests/run-make-fulldeps/arguments-non-c-like-enum/nonclike.rs delete mode 100644 tests/run-make-fulldeps/arguments-non-c-like-enum/test.c delete mode 100644 tests/run-make-fulldeps/atomic-lock-free/Makefile delete mode 100644 tests/run-make-fulldeps/atomic-lock-free/atomic_lock_free.rs delete mode 100644 tests/run-make-fulldeps/bare-outfile/Makefile delete mode 100644 tests/run-make-fulldeps/bare-outfile/foo.rs delete mode 100644 tests/run-make-fulldeps/c-dynamic-dylib/Makefile delete mode 100644 tests/run-make-fulldeps/c-dynamic-dylib/bar.rs delete mode 100644 tests/run-make-fulldeps/c-dynamic-dylib/cfoo.c delete mode 100644 tests/run-make-fulldeps/c-dynamic-dylib/foo.rs delete mode 100644 tests/run-make-fulldeps/c-dynamic-rlib/Makefile delete mode 100644 tests/run-make-fulldeps/c-dynamic-rlib/bar.rs delete mode 100644 tests/run-make-fulldeps/c-dynamic-rlib/cfoo.c delete mode 100644 tests/run-make-fulldeps/c-dynamic-rlib/foo.rs delete mode 100644 tests/run-make-fulldeps/c-link-to-rust-dylib/Makefile delete mode 100644 tests/run-make-fulldeps/c-link-to-rust-dylib/bar.c delete mode 100644 tests/run-make-fulldeps/c-link-to-rust-dylib/foo.rs delete mode 100644 tests/run-make-fulldeps/c-link-to-rust-staticlib/Makefile delete mode 100644 tests/run-make-fulldeps/c-link-to-rust-staticlib/bar.c delete mode 100644 tests/run-make-fulldeps/c-link-to-rust-staticlib/foo.rs delete mode 100644 tests/run-make-fulldeps/c-link-to-rust-va-list-fn/Makefile delete mode 100644 tests/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs delete mode 100644 tests/run-make-fulldeps/c-link-to-rust-va-list-fn/test.c delete mode 100644 tests/run-make-fulldeps/c-static-dylib/Makefile delete mode 100644 tests/run-make-fulldeps/c-static-dylib/bar.rs delete mode 100644 tests/run-make-fulldeps/c-static-dylib/cfoo.c delete mode 100644 tests/run-make-fulldeps/c-static-dylib/foo.rs delete mode 100644 tests/run-make-fulldeps/c-static-rlib/Makefile delete mode 100644 tests/run-make-fulldeps/c-static-rlib/bar.rs delete mode 100644 tests/run-make-fulldeps/c-static-rlib/cfoo.c delete mode 100644 tests/run-make-fulldeps/c-static-rlib/foo.rs delete mode 100644 tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/Makefile delete mode 100644 tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/add.c delete mode 100644 tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/main.rs delete mode 100644 tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/panic.rs delete mode 100644 tests/run-make-fulldeps/c-unwind-abi-catch-panic/Makefile delete mode 100644 tests/run-make-fulldeps/c-unwind-abi-catch-panic/add.c delete mode 100644 tests/run-make-fulldeps/c-unwind-abi-catch-panic/main.rs delete mode 100644 tests/run-make-fulldeps/cat-and-grep-sanity-check/Makefile delete mode 100644 tests/run-make-fulldeps/cdylib-dylib-linkage/Makefile delete mode 100644 tests/run-make-fulldeps/cdylib-dylib-linkage/bar.rs delete mode 100644 tests/run-make-fulldeps/cdylib-dylib-linkage/foo.c delete mode 100644 tests/run-make-fulldeps/cdylib-dylib-linkage/foo.rs delete mode 100644 tests/run-make-fulldeps/cdylib-fewer-symbols/Makefile delete mode 100644 tests/run-make-fulldeps/cdylib-fewer-symbols/foo.rs delete mode 100644 tests/run-make-fulldeps/cdylib/Makefile delete mode 100644 tests/run-make-fulldeps/cdylib/bar.rs delete mode 100644 tests/run-make-fulldeps/cdylib/foo.c delete mode 100644 tests/run-make-fulldeps/cdylib/foo.rs delete mode 100644 tests/run-make-fulldeps/codegen-options-parsing/Makefile delete mode 100644 tests/run-make-fulldeps/codegen-options-parsing/dummy.rs delete mode 100644 tests/run-make-fulldeps/compile-stdin/Makefile delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths-2/Makefile delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths-2/a.rs delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths-2/b.rs delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths-2/c.rs delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths/Makefile delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths/a.rs delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths/b.rs delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths/c.rs delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths/d.rs delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths/e.rs delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths/e2.rs delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths/f.rs delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths/native.c delete mode 100644 tests/run-make-fulldeps/compiler-rt-works-on-mingw/Makefile delete mode 100644 tests/run-make-fulldeps/compiler-rt-works-on-mingw/foo.cpp delete mode 100644 tests/run-make-fulldeps/compiler-rt-works-on-mingw/foo.rs delete mode 100644 tests/run-make-fulldeps/core-no-fp-fmt-parse/Makefile delete mode 100644 tests/run-make-fulldeps/crate-data-smoke/Makefile delete mode 100644 tests/run-make-fulldeps/crate-data-smoke/crate.rs delete mode 100644 tests/run-make-fulldeps/crate-data-smoke/lib.rs delete mode 100644 tests/run-make-fulldeps/crate-data-smoke/rlib.rs delete mode 100644 tests/run-make-fulldeps/crate-hash-rustc-version/Makefile delete mode 100644 tests/run-make-fulldeps/crate-hash-rustc-version/a.rs delete mode 100644 tests/run-make-fulldeps/crate-hash-rustc-version/b.rs delete mode 100644 tests/run-make-fulldeps/crate-name-priority/Makefile delete mode 100644 tests/run-make-fulldeps/crate-name-priority/foo.rs delete mode 100644 tests/run-make-fulldeps/crate-name-priority/foo1.rs delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-clang/Makefile delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-clang/clib.c delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-clang/cmain.c delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-clang/main.rs delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-clang/rustlib.rs delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/Makefile delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/clib.c delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/cmain.c delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/main.rs delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/rustlib.rs delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/Makefile delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/staticlib.rs delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/upstream.rs delete mode 100644 tests/run-make-fulldeps/cross-lang-lto/Makefile delete mode 100644 tests/run-make-fulldeps/cross-lang-lto/lib.rs delete mode 100644 tests/run-make-fulldeps/cross-lang-lto/main.rs delete mode 100644 tests/run-make-fulldeps/debug-assertions/Makefile delete mode 100644 tests/run-make-fulldeps/debug-assertions/debug.rs delete mode 100644 tests/run-make-fulldeps/dep-info-doesnt-run-much/Makefile delete mode 100644 tests/run-make-fulldeps/dep-info-doesnt-run-much/foo.rs delete mode 100644 tests/run-make-fulldeps/dep-info-spaces/Makefile delete mode 100644 tests/run-make-fulldeps/dep-info-spaces/Makefile.foo delete mode 100644 tests/run-make-fulldeps/dep-info-spaces/bar.rs delete mode 100644 tests/run-make-fulldeps/dep-info-spaces/foo foo.rs delete mode 100644 tests/run-make-fulldeps/dep-info-spaces/lib.rs delete mode 100644 tests/run-make-fulldeps/dep-info/Makefile delete mode 100644 tests/run-make-fulldeps/dep-info/Makefile.foo delete mode 100644 tests/run-make-fulldeps/dep-info/bar.rs delete mode 100644 tests/run-make-fulldeps/dep-info/foo.rs delete mode 100644 tests/run-make-fulldeps/dep-info/lib.rs delete mode 100644 tests/run-make-fulldeps/dep-info/lib2.rs delete mode 100644 tests/run-make-fulldeps/doctests-keep-binaries/Makefile delete mode 100644 tests/run-make-fulldeps/doctests-keep-binaries/t.rs delete mode 100644 tests/run-make-fulldeps/duplicate-output-flavors/Makefile delete mode 100644 tests/run-make-fulldeps/duplicate-output-flavors/foo.rs delete mode 100644 tests/run-make-fulldeps/dylib-chain/Makefile delete mode 100644 tests/run-make-fulldeps/dylib-chain/m1.rs delete mode 100644 tests/run-make-fulldeps/dylib-chain/m2.rs delete mode 100644 tests/run-make-fulldeps/dylib-chain/m3.rs delete mode 100644 tests/run-make-fulldeps/dylib-chain/m4.rs delete mode 100644 tests/run-make-fulldeps/emit-stack-sizes/Makefile delete mode 100644 tests/run-make-fulldeps/emit-stack-sizes/foo.rs delete mode 100644 tests/run-make-fulldeps/emit/Makefile delete mode 100644 tests/run-make-fulldeps/emit/test-24876.rs delete mode 100644 tests/run-make-fulldeps/emit/test-26235.rs delete mode 100644 tests/run-make-fulldeps/error-found-staticlib-instead-crate/Makefile delete mode 100644 tests/run-make-fulldeps/error-found-staticlib-instead-crate/bar.rs delete mode 100644 tests/run-make-fulldeps/error-found-staticlib-instead-crate/foo.rs delete mode 100644 tests/run-make-fulldeps/error-writing-dependencies/Makefile delete mode 100644 tests/run-make-fulldeps/error-writing-dependencies/foo.rs delete mode 100644 tests/run-make-fulldeps/exit-code/Makefile delete mode 100644 tests/run-make-fulldeps/exit-code/compile-error.rs delete mode 100644 tests/run-make-fulldeps/exit-code/lint-failure.rs delete mode 100644 tests/run-make-fulldeps/exit-code/success.rs delete mode 100644 tests/run-make-fulldeps/extern-diff-internal-name/Makefile delete mode 100644 tests/run-make-fulldeps/extern-diff-internal-name/lib.rs delete mode 100644 tests/run-make-fulldeps/extern-diff-internal-name/test.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-disambiguates/Makefile delete mode 100644 tests/run-make-fulldeps/extern-flag-disambiguates/a.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-disambiguates/b.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-disambiguates/c.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-disambiguates/d.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-fun/Makefile delete mode 100644 tests/run-make-fulldeps/extern-flag-fun/bar-alt.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-fun/bar.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-fun/foo.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-fun/gated_unstable.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-fun/rustc.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-pathless/Makefile delete mode 100644 tests/run-make-fulldeps/extern-flag-pathless/bar-dynamic.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-pathless/bar-static.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-pathless/foo.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-rename-transitive/Makefile delete mode 100644 tests/run-make-fulldeps/extern-flag-rename-transitive/bar.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-rename-transitive/baz.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-rename-transitive/foo.rs delete mode 100644 tests/run-make-fulldeps/extern-fn-generic/Makefile delete mode 100644 tests/run-make-fulldeps/extern-fn-generic/test.c delete mode 100644 tests/run-make-fulldeps/extern-fn-generic/test.rs delete mode 100644 tests/run-make-fulldeps/extern-fn-generic/testcrate.rs delete mode 100644 tests/run-make-fulldeps/extern-fn-mangle/Makefile delete mode 100644 tests/run-make-fulldeps/extern-fn-mangle/test.c delete mode 100644 tests/run-make-fulldeps/extern-fn-mangle/test.rs delete mode 100644 tests/run-make-fulldeps/extern-fn-reachable/Makefile delete mode 100644 tests/run-make-fulldeps/extern-fn-reachable/dylib.rs delete mode 100644 tests/run-make-fulldeps/extern-fn-struct-passing-abi/Makefile delete mode 100644 tests/run-make-fulldeps/extern-fn-struct-passing-abi/test.c delete mode 100644 tests/run-make-fulldeps/extern-fn-struct-passing-abi/test.rs delete mode 100644 tests/run-make-fulldeps/extern-fn-with-extern-types/Makefile delete mode 100644 tests/run-make-fulldeps/extern-fn-with-extern-types/ctest.c delete mode 100644 tests/run-make-fulldeps/extern-fn-with-extern-types/test.rs delete mode 100644 tests/run-make-fulldeps/extern-fn-with-packed-struct/Makefile delete mode 100644 tests/run-make-fulldeps/extern-fn-with-packed-struct/test.c delete mode 100644 tests/run-make-fulldeps/extern-fn-with-packed-struct/test.rs delete mode 100644 tests/run-make-fulldeps/extern-fn-with-union/Makefile delete mode 100644 tests/run-make-fulldeps/extern-fn-with-union/ctest.c delete mode 100644 tests/run-make-fulldeps/extern-fn-with-union/test.rs delete mode 100644 tests/run-make-fulldeps/extern-fn-with-union/testcrate.rs delete mode 100644 tests/run-make-fulldeps/extern-multiple-copies/Makefile delete mode 100644 tests/run-make-fulldeps/extern-multiple-copies/bar.rs delete mode 100644 tests/run-make-fulldeps/extern-multiple-copies/foo1.rs delete mode 100644 tests/run-make-fulldeps/extern-multiple-copies/foo2.rs delete mode 100644 tests/run-make-fulldeps/extern-multiple-copies2/Makefile delete mode 100644 tests/run-make-fulldeps/extern-multiple-copies2/bar.rs delete mode 100644 tests/run-make-fulldeps/extern-multiple-copies2/foo1.rs delete mode 100644 tests/run-make-fulldeps/extern-multiple-copies2/foo2.rs delete mode 100644 tests/run-make-fulldeps/extern-overrides-distribution/Makefile delete mode 100644 tests/run-make-fulldeps/extern-overrides-distribution/libc.rs delete mode 100644 tests/run-make-fulldeps/extern-overrides-distribution/main.rs delete mode 100644 tests/run-make-fulldeps/extra-filename-with-temp-outputs/Makefile delete mode 100644 tests/run-make-fulldeps/extra-filename-with-temp-outputs/foo.rs delete mode 100644 tests/run-make-fulldeps/foreign-double-unwind/Makefile delete mode 100644 tests/run-make-fulldeps/foreign-double-unwind/foo.cpp delete mode 100644 tests/run-make-fulldeps/foreign-double-unwind/foo.rs delete mode 100644 tests/run-make-fulldeps/foreign-exceptions/Makefile delete mode 100644 tests/run-make-fulldeps/foreign-exceptions/foo.cpp delete mode 100644 tests/run-make-fulldeps/foreign-exceptions/foo.rs delete mode 100644 tests/run-make-fulldeps/foreign-rust-exceptions/Makefile delete mode 100644 tests/run-make-fulldeps/foreign-rust-exceptions/bar.rs delete mode 100644 tests/run-make-fulldeps/foreign-rust-exceptions/foo.rs delete mode 100644 tests/run-make-fulldeps/fpic/Makefile delete mode 100644 tests/run-make-fulldeps/fpic/hello.rs delete mode 100644 tests/run-make-fulldeps/glibc-staticlib-args/Makefile delete mode 100644 tests/run-make-fulldeps/glibc-staticlib-args/library.rs delete mode 100644 tests/run-make-fulldeps/glibc-staticlib-args/program.c delete mode 100644 tests/run-make-fulldeps/hir-tree/Makefile delete mode 100644 tests/run-make-fulldeps/hir-tree/input.rs delete mode 100644 tests/run-make-fulldeps/include_bytes_deps/Makefile delete mode 100644 tests/run-make-fulldeps/include_bytes_deps/input.bin delete mode 100644 tests/run-make-fulldeps/include_bytes_deps/input.md delete mode 100644 tests/run-make-fulldeps/include_bytes_deps/input.txt delete mode 100644 tests/run-make-fulldeps/include_bytes_deps/main.rs delete mode 100644 tests/run-make-fulldeps/incr-add-rust-src-component/Makefile delete mode 100644 tests/run-make-fulldeps/incr-add-rust-src-component/main.rs delete mode 100644 tests/run-make-fulldeps/inline-always-many-cgu/Makefile delete mode 100644 tests/run-make-fulldeps/inline-always-many-cgu/foo.rs delete mode 100644 tests/run-make-fulldeps/interdependent-c-libraries/Makefile delete mode 100644 tests/run-make-fulldeps/interdependent-c-libraries/bar.c delete mode 100644 tests/run-make-fulldeps/interdependent-c-libraries/bar.rs delete mode 100644 tests/run-make-fulldeps/interdependent-c-libraries/foo.c delete mode 100644 tests/run-make-fulldeps/interdependent-c-libraries/foo.rs delete mode 100644 tests/run-make-fulldeps/interdependent-c-libraries/main.rs delete mode 100644 tests/run-make-fulldeps/intrinsic-unreachable/Makefile delete mode 100644 tests/run-make-fulldeps/intrinsic-unreachable/exit-ret.rs delete mode 100644 tests/run-make-fulldeps/intrinsic-unreachable/exit-unreachable.rs delete mode 100644 tests/run-make-fulldeps/invalid-library/Makefile delete mode 100644 tests/run-make-fulldeps/invalid-library/foo.rs delete mode 100644 tests/run-make-fulldeps/invalid-staticlib/Makefile delete mode 100644 tests/run-make-fulldeps/issue-11908/Makefile delete mode 100644 tests/run-make-fulldeps/issue-11908/bar.rs delete mode 100644 tests/run-make-fulldeps/issue-11908/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-14500/Makefile delete mode 100644 tests/run-make-fulldeps/issue-14500/bar.rs delete mode 100644 tests/run-make-fulldeps/issue-14500/foo.c delete mode 100644 tests/run-make-fulldeps/issue-14500/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-14698/Makefile delete mode 100644 tests/run-make-fulldeps/issue-14698/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-15460/Makefile delete mode 100644 tests/run-make-fulldeps/issue-15460/bar.rs delete mode 100644 tests/run-make-fulldeps/issue-15460/foo.c delete mode 100644 tests/run-make-fulldeps/issue-15460/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-18943/Makefile delete mode 100644 tests/run-make-fulldeps/issue-18943/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-20626/Makefile delete mode 100644 tests/run-make-fulldeps/issue-20626/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-22131/Makefile delete mode 100644 tests/run-make-fulldeps/issue-22131/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-24445/Makefile delete mode 100644 tests/run-make-fulldeps/issue-24445/foo.c delete mode 100644 tests/run-make-fulldeps/issue-24445/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-25581/Makefile delete mode 100644 tests/run-make-fulldeps/issue-25581/test.c delete mode 100644 tests/run-make-fulldeps/issue-25581/test.rs delete mode 100644 tests/run-make-fulldeps/issue-26006/Makefile delete mode 100644 tests/run-make-fulldeps/issue-26006/in/libc/lib.rs delete mode 100644 tests/run-make-fulldeps/issue-26006/in/time/lib.rs delete mode 100644 tests/run-make-fulldeps/issue-26092/Makefile delete mode 100644 tests/run-make-fulldeps/issue-26092/blank.rs delete mode 100644 tests/run-make-fulldeps/issue-28595/Makefile delete mode 100644 tests/run-make-fulldeps/issue-28595/a.c delete mode 100644 tests/run-make-fulldeps/issue-28595/a.rs delete mode 100644 tests/run-make-fulldeps/issue-28595/b.c delete mode 100644 tests/run-make-fulldeps/issue-28595/b.rs delete mode 100644 tests/run-make-fulldeps/issue-28766/Makefile delete mode 100644 tests/run-make-fulldeps/issue-28766/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-28766/main.rs delete mode 100644 tests/run-make-fulldeps/issue-30063/Makefile delete mode 100644 tests/run-make-fulldeps/issue-30063/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-33329/Makefile delete mode 100644 tests/run-make-fulldeps/issue-33329/main.rs delete mode 100644 tests/run-make-fulldeps/issue-35164/Makefile delete mode 100644 tests/run-make-fulldeps/issue-35164/main.rs delete mode 100644 tests/run-make-fulldeps/issue-35164/submodule/mod.rs delete mode 100644 tests/run-make-fulldeps/issue-37839/Makefile delete mode 100644 tests/run-make-fulldeps/issue-37839/a.rs delete mode 100644 tests/run-make-fulldeps/issue-37839/b.rs delete mode 100644 tests/run-make-fulldeps/issue-37839/c.rs delete mode 100644 tests/run-make-fulldeps/issue-37893/Makefile delete mode 100644 tests/run-make-fulldeps/issue-37893/a.rs delete mode 100644 tests/run-make-fulldeps/issue-37893/b.rs delete mode 100644 tests/run-make-fulldeps/issue-37893/c.rs delete mode 100644 tests/run-make-fulldeps/issue-38237/Makefile delete mode 100644 tests/run-make-fulldeps/issue-38237/bar.rs delete mode 100644 tests/run-make-fulldeps/issue-38237/baz.rs delete mode 100644 tests/run-make-fulldeps/issue-38237/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-40535/Makefile delete mode 100644 tests/run-make-fulldeps/issue-40535/bar.rs delete mode 100644 tests/run-make-fulldeps/issue-40535/baz.rs delete mode 100644 tests/run-make-fulldeps/issue-40535/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-46239/Makefile delete mode 100644 tests/run-make-fulldeps/issue-46239/main.rs delete mode 100644 tests/run-make-fulldeps/issue-47551/Makefile delete mode 100644 tests/run-make-fulldeps/issue-47551/eh_frame-terminator.rs delete mode 100644 tests/run-make-fulldeps/issue-51671/Makefile delete mode 100644 tests/run-make-fulldeps/issue-51671/app.rs delete mode 100644 tests/run-make-fulldeps/issue-53964/Makefile delete mode 100644 tests/run-make-fulldeps/issue-53964/app.rs delete mode 100644 tests/run-make-fulldeps/issue-53964/panic.rs delete mode 100644 tests/run-make-fulldeps/issue-64153/Makefile delete mode 100644 tests/run-make-fulldeps/issue-64153/downstream.rs delete mode 100644 tests/run-make-fulldeps/issue-64153/upstream.rs delete mode 100644 tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/Makefile delete mode 100644 tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/bar.c delete mode 100644 tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-69368/Makefile delete mode 100644 tests/run-make-fulldeps/issue-69368/a.rs delete mode 100644 tests/run-make-fulldeps/issue-69368/b.rs delete mode 100644 tests/run-make-fulldeps/issue-69368/c.rs delete mode 100644 tests/run-make-fulldeps/issue-7349/Makefile delete mode 100644 tests/run-make-fulldeps/issue-7349/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-83045/Makefile delete mode 100644 tests/run-make-fulldeps/issue-83045/a.rs delete mode 100644 tests/run-make-fulldeps/issue-83045/b.rs delete mode 100644 tests/run-make-fulldeps/issue-83045/c.rs delete mode 100644 tests/run-make-fulldeps/issue-84395-lto-embed-bitcode/Makefile delete mode 100644 tests/run-make-fulldeps/issue-84395-lto-embed-bitcode/test.rs delete mode 100644 tests/run-make-fulldeps/issue-97463-abi-param-passing/Makefile delete mode 100644 tests/run-make-fulldeps/issue-97463-abi-param-passing/bad.c delete mode 100644 tests/run-make-fulldeps/issue-97463-abi-param-passing/param_passing.rs delete mode 100644 tests/run-make-fulldeps/issue64319/Makefile delete mode 100644 tests/run-make-fulldeps/issue64319/bar.rs delete mode 100644 tests/run-make-fulldeps/issue64319/foo.rs delete mode 100644 tests/run-make-fulldeps/libs-through-symlinks/Makefile delete mode 100644 tests/run-make-fulldeps/libs-through-symlinks/bar.rs delete mode 100644 tests/run-make-fulldeps/libs-through-symlinks/foo.rs delete mode 100644 tests/run-make-fulldeps/libtest-json/Makefile delete mode 100644 tests/run-make-fulldeps/libtest-json/f.rs delete mode 100644 tests/run-make-fulldeps/libtest-json/output-default.json delete mode 100644 tests/run-make-fulldeps/libtest-json/output-stdout-success.json delete mode 100755 tests/run-make-fulldeps/libtest-json/validate_json.py delete mode 100644 tests/run-make-fulldeps/link-arg/Makefile delete mode 100644 tests/run-make-fulldeps/link-arg/empty.rs delete mode 100644 tests/run-make-fulldeps/link-args-order/Makefile delete mode 100644 tests/run-make-fulldeps/link-args-order/empty.rs delete mode 100644 tests/run-make-fulldeps/link-cfg/Makefile delete mode 100644 tests/run-make-fulldeps/link-cfg/dep-with-staticlib.rs delete mode 100644 tests/run-make-fulldeps/link-cfg/dep.rs delete mode 100644 tests/run-make-fulldeps/link-cfg/no-deps.rs delete mode 100644 tests/run-make-fulldeps/link-cfg/return1.c delete mode 100644 tests/run-make-fulldeps/link-cfg/return2.c delete mode 100644 tests/run-make-fulldeps/link-cfg/return3.c delete mode 100644 tests/run-make-fulldeps/link-cfg/with-deps.rs delete mode 100644 tests/run-make-fulldeps/link-cfg/with-staticlib-deps.rs delete mode 100644 tests/run-make-fulldeps/link-dedup/Makefile delete mode 100644 tests/run-make-fulldeps/link-dedup/depa.rs delete mode 100644 tests/run-make-fulldeps/link-dedup/depb.rs delete mode 100644 tests/run-make-fulldeps/link-dedup/depc.rs delete mode 100644 tests/run-make-fulldeps/link-dedup/empty.rs delete mode 100644 tests/run-make-fulldeps/link-path-order/Makefile delete mode 100644 tests/run-make-fulldeps/link-path-order/correct.c delete mode 100644 tests/run-make-fulldeps/link-path-order/main.rs delete mode 100644 tests/run-make-fulldeps/link-path-order/wrong.c delete mode 100644 tests/run-make-fulldeps/linkage-attr-on-static/Makefile delete mode 100644 tests/run-make-fulldeps/linkage-attr-on-static/bar.rs delete mode 100644 tests/run-make-fulldeps/linkage-attr-on-static/foo.c delete mode 100644 tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/Makefile delete mode 100644 tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/foo.bat delete mode 100644 tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/foo.rs delete mode 100644 tests/run-make-fulldeps/long-linker-command-lines/Makefile delete mode 100644 tests/run-make-fulldeps/long-linker-command-lines/foo.rs delete mode 100644 tests/run-make-fulldeps/longjmp-across-rust/Makefile delete mode 100644 tests/run-make-fulldeps/longjmp-across-rust/foo.c delete mode 100644 tests/run-make-fulldeps/longjmp-across-rust/main.rs delete mode 100644 tests/run-make-fulldeps/ls-metadata/Makefile delete mode 100644 tests/run-make-fulldeps/ls-metadata/foo.rs delete mode 100644 tests/run-make-fulldeps/lto-dylib-dep/Makefile delete mode 100644 tests/run-make-fulldeps/lto-dylib-dep/a_dylib.rs delete mode 100644 tests/run-make-fulldeps/lto-dylib-dep/main.rs delete mode 100644 tests/run-make-fulldeps/lto-empty/Makefile delete mode 100644 tests/run-make-fulldeps/lto-empty/lib.rs delete mode 100644 tests/run-make-fulldeps/lto-no-link-whole-rlib/Makefile delete mode 100644 tests/run-make-fulldeps/lto-no-link-whole-rlib/bar.c delete mode 100644 tests/run-make-fulldeps/lto-no-link-whole-rlib/foo.c delete mode 100644 tests/run-make-fulldeps/lto-no-link-whole-rlib/lib1.rs delete mode 100644 tests/run-make-fulldeps/lto-no-link-whole-rlib/lib2.rs delete mode 100644 tests/run-make-fulldeps/lto-no-link-whole-rlib/main.rs delete mode 100644 tests/run-make-fulldeps/lto-readonly-lib/Makefile delete mode 100644 tests/run-make-fulldeps/lto-readonly-lib/lib.rs delete mode 100644 tests/run-make-fulldeps/lto-readonly-lib/main.rs delete mode 100644 tests/run-make-fulldeps/lto-smoke-c/Makefile delete mode 100644 tests/run-make-fulldeps/lto-smoke-c/bar.c delete mode 100644 tests/run-make-fulldeps/lto-smoke-c/foo.rs delete mode 100644 tests/run-make-fulldeps/lto-smoke/Makefile delete mode 100644 tests/run-make-fulldeps/lto-smoke/lib.rs delete mode 100644 tests/run-make-fulldeps/lto-smoke/main.rs delete mode 100644 tests/run-make-fulldeps/manual-crate-name/Makefile delete mode 100644 tests/run-make-fulldeps/manual-crate-name/bar.rs delete mode 100644 tests/run-make-fulldeps/manual-link/Makefile delete mode 100644 tests/run-make-fulldeps/manual-link/bar.c delete mode 100644 tests/run-make-fulldeps/manual-link/foo.c delete mode 100644 tests/run-make-fulldeps/manual-link/foo.rs delete mode 100644 tests/run-make-fulldeps/manual-link/main.rs delete mode 100644 tests/run-make-fulldeps/many-crates-but-no-match/Makefile delete mode 100644 tests/run-make-fulldeps/many-crates-but-no-match/crateA1.rs delete mode 100644 tests/run-make-fulldeps/many-crates-but-no-match/crateA2.rs delete mode 100644 tests/run-make-fulldeps/many-crates-but-no-match/crateA3.rs delete mode 100644 tests/run-make-fulldeps/many-crates-but-no-match/crateB.rs delete mode 100644 tests/run-make-fulldeps/many-crates-but-no-match/crateC.rs delete mode 100644 tests/run-make-fulldeps/metadata-flag-frobs-symbols/Makefile delete mode 100644 tests/run-make-fulldeps/metadata-flag-frobs-symbols/bar.rs delete mode 100644 tests/run-make-fulldeps/metadata-flag-frobs-symbols/foo.rs delete mode 100644 tests/run-make-fulldeps/min-global-align/Makefile delete mode 100644 tests/run-make-fulldeps/min-global-align/min_global_align.rs delete mode 100644 tests/run-make-fulldeps/mingw-export-call-convention/Makefile delete mode 100644 tests/run-make-fulldeps/mingw-export-call-convention/foo.rs delete mode 100644 tests/run-make-fulldeps/mismatching-target-triples/Makefile delete mode 100644 tests/run-make-fulldeps/mismatching-target-triples/bar.rs delete mode 100644 tests/run-make-fulldeps/mismatching-target-triples/foo.rs delete mode 100644 tests/run-make-fulldeps/missing-crate-dependency/Makefile delete mode 100644 tests/run-make-fulldeps/missing-crate-dependency/crateA.rs delete mode 100644 tests/run-make-fulldeps/missing-crate-dependency/crateB.rs delete mode 100644 tests/run-make-fulldeps/missing-crate-dependency/crateC.rs delete mode 100644 tests/run-make-fulldeps/mixing-deps/Makefile delete mode 100644 tests/run-make-fulldeps/mixing-deps/both.rs delete mode 100644 tests/run-make-fulldeps/mixing-deps/dylib.rs delete mode 100644 tests/run-make-fulldeps/mixing-deps/prog.rs delete mode 100644 tests/run-make-fulldeps/mixing-formats/Makefile delete mode 100644 tests/run-make-fulldeps/mixing-formats/bar1.rs delete mode 100644 tests/run-make-fulldeps/mixing-formats/bar2.rs delete mode 100644 tests/run-make-fulldeps/mixing-formats/baz.rs delete mode 100644 tests/run-make-fulldeps/mixing-formats/baz2.rs delete mode 100644 tests/run-make-fulldeps/mixing-formats/foo.rs delete mode 100644 tests/run-make-fulldeps/mixing-libs/Makefile delete mode 100644 tests/run-make-fulldeps/mixing-libs/dylib.rs delete mode 100644 tests/run-make-fulldeps/mixing-libs/prog.rs delete mode 100644 tests/run-make-fulldeps/mixing-libs/rlib.rs delete mode 100644 tests/run-make-fulldeps/msvc-opt-minsize/Makefile delete mode 100644 tests/run-make-fulldeps/msvc-opt-minsize/foo.rs delete mode 100644 tests/run-make-fulldeps/multiple-emits/Makefile delete mode 100644 tests/run-make-fulldeps/multiple-emits/foo.rs delete mode 100644 tests/run-make-fulldeps/no-builtins-lto/Makefile delete mode 100644 tests/run-make-fulldeps/no-builtins-lto/main.rs delete mode 100644 tests/run-make-fulldeps/no-builtins-lto/no_builtins.rs delete mode 100644 tests/run-make-fulldeps/no-duplicate-libs/Makefile delete mode 100644 tests/run-make-fulldeps/no-duplicate-libs/bar.c delete mode 100644 tests/run-make-fulldeps/no-duplicate-libs/foo.c delete mode 100644 tests/run-make-fulldeps/no-duplicate-libs/main.rs delete mode 100644 tests/run-make-fulldeps/no-intermediate-extras/Makefile delete mode 100644 tests/run-make-fulldeps/no-intermediate-extras/foo.rs delete mode 100644 tests/run-make-fulldeps/obey-crate-type-flag/Makefile delete mode 100644 tests/run-make-fulldeps/obey-crate-type-flag/test.rs delete mode 100644 tests/run-make-fulldeps/output-filename-conflicts-with-directory/Makefile delete mode 100644 tests/run-make-fulldeps/output-filename-conflicts-with-directory/foo.rs delete mode 100644 tests/run-make-fulldeps/output-filename-overwrites-input/Makefile delete mode 100644 tests/run-make-fulldeps/output-filename-overwrites-input/bar.rs delete mode 100644 tests/run-make-fulldeps/output-filename-overwrites-input/foo.rs delete mode 100644 tests/run-make-fulldeps/output-type-permutations/Makefile delete mode 100644 tests/run-make-fulldeps/output-type-permutations/foo.rs delete mode 100644 tests/run-make-fulldeps/output-with-hyphens/Makefile delete mode 100644 tests/run-make-fulldeps/output-with-hyphens/foo-bar.rs delete mode 100644 tests/run-make-fulldeps/override-aliased-flags/Makefile delete mode 100644 tests/run-make-fulldeps/override-aliased-flags/main.rs delete mode 100644 tests/run-make-fulldeps/panic-impl-transitive/Makefile delete mode 100644 tests/run-make-fulldeps/panic-impl-transitive/panic-impl-consumer.rs delete mode 100644 tests/run-make-fulldeps/panic-impl-transitive/panic-impl-provider.rs delete mode 100644 tests/run-make-fulldeps/pass-non-c-like-enum-to-c/Makefile delete mode 100644 tests/run-make-fulldeps/pass-non-c-like-enum-to-c/nonclike.rs delete mode 100644 tests/run-make-fulldeps/pass-non-c-like-enum-to-c/test.c delete mode 100644 tests/run-make-fulldeps/pgo-branch-weights/Makefile delete mode 100644 tests/run-make-fulldeps/pgo-branch-weights/filecheck-patterns.txt delete mode 100644 tests/run-make-fulldeps/pgo-branch-weights/interesting.rs delete mode 100644 tests/run-make-fulldeps/pgo-branch-weights/main.rs delete mode 100644 tests/run-make-fulldeps/pgo-branch-weights/opaque.rs delete mode 100644 tests/run-make-fulldeps/pgo-gen-lto/Makefile delete mode 100644 tests/run-make-fulldeps/pgo-gen-lto/test.rs delete mode 100644 tests/run-make-fulldeps/pgo-gen-no-imp-symbols/Makefile delete mode 100644 tests/run-make-fulldeps/pgo-gen-no-imp-symbols/test.rs delete mode 100644 tests/run-make-fulldeps/pgo-gen/Makefile delete mode 100644 tests/run-make-fulldeps/pgo-gen/test.rs delete mode 100644 tests/run-make-fulldeps/pgo-indirect-call-promotion/Makefile delete mode 100644 tests/run-make-fulldeps/pgo-indirect-call-promotion/filecheck-patterns.txt delete mode 100644 tests/run-make-fulldeps/pgo-indirect-call-promotion/interesting.rs delete mode 100644 tests/run-make-fulldeps/pgo-indirect-call-promotion/main.rs delete mode 100644 tests/run-make-fulldeps/pgo-indirect-call-promotion/opaque.rs delete mode 100644 tests/run-make-fulldeps/pgo-use/Makefile delete mode 100644 tests/run-make-fulldeps/pgo-use/filecheck-patterns.txt delete mode 100644 tests/run-make-fulldeps/pgo-use/main.rs delete mode 100644 tests/run-make-fulldeps/pointer-auth-link-with-c/Makefile delete mode 100644 tests/run-make-fulldeps/pointer-auth-link-with-c/test.c delete mode 100644 tests/run-make-fulldeps/pointer-auth-link-with-c/test.rs delete mode 100644 tests/run-make-fulldeps/prefer-dylib/Makefile delete mode 100644 tests/run-make-fulldeps/prefer-dylib/bar.rs delete mode 100644 tests/run-make-fulldeps/prefer-dylib/foo.rs delete mode 100644 tests/run-make-fulldeps/prefer-rlib/Makefile delete mode 100644 tests/run-make-fulldeps/prefer-rlib/bar.rs delete mode 100644 tests/run-make-fulldeps/prefer-rlib/foo.rs delete mode 100644 tests/run-make-fulldeps/pretty-print-to-file/Makefile delete mode 100644 tests/run-make-fulldeps/pretty-print-to-file/input.pp delete mode 100644 tests/run-make-fulldeps/pretty-print-to-file/input.rs delete mode 100644 tests/run-make-fulldeps/print-calling-conventions/Makefile delete mode 100644 tests/run-make-fulldeps/print-cfg/Makefile delete mode 100644 tests/run-make-fulldeps/print-target-list/Makefile delete mode 100644 tests/run-make-fulldeps/profile/Makefile delete mode 100644 tests/run-make-fulldeps/profile/test.rs delete mode 100644 tests/run-make-fulldeps/prune-link-args/Makefile delete mode 100644 tests/run-make-fulldeps/prune-link-args/empty.rs delete mode 100644 tests/run-make-fulldeps/redundant-libs/Makefile delete mode 100644 tests/run-make-fulldeps/redundant-libs/bar.c delete mode 100644 tests/run-make-fulldeps/redundant-libs/baz.c delete mode 100644 tests/run-make-fulldeps/redundant-libs/foo.c delete mode 100644 tests/run-make-fulldeps/redundant-libs/main.rs delete mode 100644 tests/run-make-fulldeps/relocation-model/Makefile delete mode 100644 tests/run-make-fulldeps/relocation-model/foo.rs delete mode 100644 tests/run-make-fulldeps/relro-levels/Makefile delete mode 100644 tests/run-make-fulldeps/relro-levels/hello.rs delete mode 100644 tests/run-make-fulldeps/remap-path-prefix/Makefile delete mode 100644 tests/run-make-fulldeps/remap-path-prefix/auxiliary/lib.rs delete mode 100644 tests/run-make-fulldeps/reproducible-build-2/Makefile delete mode 100644 tests/run-make-fulldeps/reproducible-build-2/linker.rs delete mode 100644 tests/run-make-fulldeps/reproducible-build-2/reproducible-build-aux.rs delete mode 100644 tests/run-make-fulldeps/reproducible-build-2/reproducible-build.rs delete mode 100644 tests/run-make-fulldeps/reproducible-build/Makefile delete mode 100644 tests/run-make-fulldeps/reproducible-build/linker.rs delete mode 100644 tests/run-make-fulldeps/reproducible-build/reproducible-build-aux.rs delete mode 100644 tests/run-make-fulldeps/reproducible-build/reproducible-build.rs delete mode 100644 tests/run-make-fulldeps/resolve-rename/Makefile delete mode 100644 tests/run-make-fulldeps/resolve-rename/bar.rs delete mode 100644 tests/run-make-fulldeps/resolve-rename/baz.rs delete mode 100644 tests/run-make-fulldeps/resolve-rename/foo.rs delete mode 100644 tests/run-make-fulldeps/return-non-c-like-enum-from-c/Makefile delete mode 100644 tests/run-make-fulldeps/return-non-c-like-enum-from-c/nonclike.rs delete mode 100644 tests/run-make-fulldeps/return-non-c-like-enum-from-c/test.c delete mode 100644 tests/run-make-fulldeps/return-non-c-like-enum/Makefile delete mode 100644 tests/run-make-fulldeps/return-non-c-like-enum/nonclike.rs delete mode 100644 tests/run-make-fulldeps/return-non-c-like-enum/test.c delete mode 100644 tests/run-make-fulldeps/rlib-chain/Makefile delete mode 100644 tests/run-make-fulldeps/rlib-chain/m1.rs delete mode 100644 tests/run-make-fulldeps/rlib-chain/m2.rs delete mode 100644 tests/run-make-fulldeps/rlib-chain/m3.rs delete mode 100644 tests/run-make-fulldeps/rlib-chain/m4.rs delete mode 100644 tests/run-make-fulldeps/rustdoc-determinism/Makefile delete mode 100644 tests/run-make-fulldeps/rustdoc-determinism/bar.rs delete mode 100644 tests/run-make-fulldeps/rustdoc-determinism/foo.rs delete mode 100644 tests/run-make-fulldeps/rustdoc-error-lines/Makefile delete mode 100644 tests/run-make-fulldeps/rustdoc-error-lines/input.rs delete mode 100644 tests/run-make-fulldeps/rustdoc-io-error/Makefile delete mode 100644 tests/run-make-fulldeps/rustdoc-io-error/foo.rs delete mode 100644 tests/run-make-fulldeps/rustdoc-map-file/Makefile delete mode 100644 tests/run-make-fulldeps/rustdoc-map-file/expected.json delete mode 100644 tests/run-make-fulldeps/rustdoc-map-file/foo.rs delete mode 100755 tests/run-make-fulldeps/rustdoc-map-file/validate_json.py delete mode 100644 tests/run-make-fulldeps/rustdoc-output-path/Makefile delete mode 100644 tests/run-make-fulldeps/rustdoc-output-path/foo.rs delete mode 100644 tests/run-make-fulldeps/rustdoc-scrape-examples-macros/Makefile delete mode 100644 tests/run-make-fulldeps/rustdoc-scrape-examples-macros/examples/ex.rs delete mode 100644 tests/run-make-fulldeps/rustdoc-scrape-examples-macros/src/lib.rs delete mode 100644 tests/run-make-fulldeps/rustdoc-scrape-examples-macros/src/proc.rs delete mode 100644 tests/run-make-fulldeps/rustdoc-target-spec-json-path/Makefile delete mode 100644 tests/run-make-fulldeps/rustdoc-target-spec-json-path/dummy_core.rs delete mode 100644 tests/run-make-fulldeps/rustdoc-target-spec-json-path/my_crate.rs delete mode 100644 tests/run-make-fulldeps/rustdoc-target-spec-json-path/target.json delete mode 100644 tests/run-make-fulldeps/rustdoc-themes/Makefile delete mode 100644 tests/run-make-fulldeps/rustdoc-themes/foo.rs delete mode 100644 tests/run-make-fulldeps/sanitizer-cdylib-link/Makefile delete mode 100644 tests/run-make-fulldeps/sanitizer-cdylib-link/library.rs delete mode 100644 tests/run-make-fulldeps/sanitizer-cdylib-link/program.rs delete mode 100644 tests/run-make-fulldeps/sanitizer-dylib-link/Makefile delete mode 100644 tests/run-make-fulldeps/sanitizer-dylib-link/library.rs delete mode 100644 tests/run-make-fulldeps/sanitizer-dylib-link/program.rs delete mode 100644 tests/run-make-fulldeps/sanitizer-staticlib-link/Makefile delete mode 100644 tests/run-make-fulldeps/sanitizer-staticlib-link/library.rs delete mode 100644 tests/run-make-fulldeps/sanitizer-staticlib-link/program.c delete mode 100644 tests/run-make-fulldeps/sanitizer-staticlib-link/program.rs delete mode 100644 tests/run-make-fulldeps/separate-link-fail/Makefile delete mode 100644 tests/run-make-fulldeps/separate-link/Makefile delete mode 100644 tests/run-make-fulldeps/sepcomp-cci-copies/Makefile delete mode 100644 tests/run-make-fulldeps/sepcomp-cci-copies/cci_lib.rs delete mode 100644 tests/run-make-fulldeps/sepcomp-cci-copies/foo.rs delete mode 100644 tests/run-make-fulldeps/sepcomp-inlining/Makefile delete mode 100644 tests/run-make-fulldeps/sepcomp-inlining/foo.rs delete mode 100644 tests/run-make-fulldeps/sepcomp-separate/Makefile delete mode 100644 tests/run-make-fulldeps/sepcomp-separate/foo.rs delete mode 100644 tests/run-make-fulldeps/share-generics-dylib/Makefile delete mode 100644 tests/run-make-fulldeps/share-generics-dylib/instance_provider_a.rs delete mode 100644 tests/run-make-fulldeps/share-generics-dylib/instance_provider_b.rs delete mode 100644 tests/run-make-fulldeps/share-generics-dylib/instance_user_a_rlib.rs delete mode 100644 tests/run-make-fulldeps/share-generics-dylib/instance_user_b_rlib.rs delete mode 100644 tests/run-make-fulldeps/share-generics-dylib/instance_user_dylib.rs delete mode 100644 tests/run-make-fulldeps/share-generics-dylib/linked_leaf.rs delete mode 100644 tests/run-make-fulldeps/simd-ffi/Makefile delete mode 100644 tests/run-make-fulldeps/simd-ffi/simd.rs delete mode 100644 tests/run-make-fulldeps/simple-dylib/Makefile delete mode 100644 tests/run-make-fulldeps/simple-dylib/bar.rs delete mode 100644 tests/run-make-fulldeps/simple-dylib/foo.rs delete mode 100644 tests/run-make-fulldeps/simple-rlib/Makefile delete mode 100644 tests/run-make-fulldeps/simple-rlib/bar.rs delete mode 100644 tests/run-make-fulldeps/simple-rlib/foo.rs delete mode 100644 tests/run-make-fulldeps/split-debuginfo/Makefile delete mode 100644 tests/run-make-fulldeps/split-debuginfo/bar.rs delete mode 100644 tests/run-make-fulldeps/split-debuginfo/baz.rs delete mode 100644 tests/run-make-fulldeps/split-debuginfo/foo.rs delete mode 100644 tests/run-make-fulldeps/split-debuginfo/main.rs delete mode 100644 tests/run-make-fulldeps/stable-symbol-names/Makefile delete mode 100644 tests/run-make-fulldeps/stable-symbol-names/stable-symbol-names1.rs delete mode 100644 tests/run-make-fulldeps/stable-symbol-names/stable-symbol-names2.rs delete mode 100644 tests/run-make-fulldeps/static-dylib-by-default/Makefile delete mode 100644 tests/run-make-fulldeps/static-dylib-by-default/bar.rs delete mode 100644 tests/run-make-fulldeps/static-dylib-by-default/foo.rs delete mode 100644 tests/run-make-fulldeps/static-dylib-by-default/main.c delete mode 100644 tests/run-make-fulldeps/static-extern-type/Makefile delete mode 100644 tests/run-make-fulldeps/static-extern-type/define-foo.c delete mode 100644 tests/run-make-fulldeps/static-extern-type/use-foo.rs delete mode 100644 tests/run-make-fulldeps/static-unwinding/Makefile delete mode 100644 tests/run-make-fulldeps/static-unwinding/lib.rs delete mode 100644 tests/run-make-fulldeps/static-unwinding/main.rs delete mode 100644 tests/run-make-fulldeps/staticlib-blank-lib/Makefile delete mode 100644 tests/run-make-fulldeps/staticlib-blank-lib/foo.rs delete mode 100644 tests/run-make-fulldeps/std-core-cycle/Makefile delete mode 100644 tests/run-make-fulldeps/std-core-cycle/bar.rs delete mode 100644 tests/run-make-fulldeps/std-core-cycle/foo.rs delete mode 100644 tests/run-make-fulldeps/stdin-non-utf8/Makefile delete mode 100644 tests/run-make-fulldeps/stdin-non-utf8/non-utf8 delete mode 100644 tests/run-make-fulldeps/suspicious-library/Makefile delete mode 100644 tests/run-make-fulldeps/suspicious-library/bar.rs delete mode 100644 tests/run-make-fulldeps/suspicious-library/foo.rs delete mode 100644 tests/run-make-fulldeps/symbol-visibility/Makefile delete mode 100644 tests/run-make-fulldeps/symbol-visibility/a_cdylib.rs delete mode 100644 tests/run-make-fulldeps/symbol-visibility/a_proc_macro.rs delete mode 100644 tests/run-make-fulldeps/symbol-visibility/a_rust_dylib.rs delete mode 100644 tests/run-make-fulldeps/symbol-visibility/an_executable.rs delete mode 100644 tests/run-make-fulldeps/symbol-visibility/an_rlib.rs delete mode 100644 tests/run-make-fulldeps/symbols-include-type-name/Makefile delete mode 100644 tests/run-make-fulldeps/symbols-include-type-name/lib.rs delete mode 100644 tests/run-make-fulldeps/symlinked-extern/Makefile delete mode 100644 tests/run-make-fulldeps/symlinked-extern/bar.rs delete mode 100644 tests/run-make-fulldeps/symlinked-extern/baz.rs delete mode 100644 tests/run-make-fulldeps/symlinked-extern/foo.rs delete mode 100644 tests/run-make-fulldeps/symlinked-libraries/Makefile delete mode 100644 tests/run-make-fulldeps/symlinked-libraries/bar.rs delete mode 100644 tests/run-make-fulldeps/symlinked-libraries/foo.rs delete mode 100644 tests/run-make-fulldeps/symlinked-rlib/Makefile delete mode 100644 tests/run-make-fulldeps/symlinked-rlib/bar.rs delete mode 100644 tests/run-make-fulldeps/symlinked-rlib/foo.rs delete mode 100644 tests/run-make-fulldeps/sysroot-crates-are-unstable/Makefile delete mode 100644 tests/run-make-fulldeps/sysroot-crates-are-unstable/test.py delete mode 100644 tests/run-make-fulldeps/target-cpu-native/Makefile delete mode 100644 tests/run-make-fulldeps/target-cpu-native/foo.rs delete mode 100644 tests/run-make-fulldeps/target-specs/Makefile delete mode 100644 tests/run-make-fulldeps/target-specs/definitely-not-builtin-target.json delete mode 100644 tests/run-make-fulldeps/target-specs/foo.rs delete mode 100644 tests/run-make-fulldeps/target-specs/mismatching-data-layout.json delete mode 100644 tests/run-make-fulldeps/target-specs/my-awesome-platform.json delete mode 100644 tests/run-make-fulldeps/target-specs/my-incomplete-platform.json delete mode 100644 tests/run-make-fulldeps/target-specs/my-invalid-platform.json delete mode 100644 tests/run-make-fulldeps/target-specs/my-x86_64-unknown-linux-gnu-platform.json delete mode 100644 tests/run-make-fulldeps/target-without-atomic-cas/Makefile delete mode 100644 tests/run-make-fulldeps/test-harness/Makefile delete mode 100644 tests/run-make-fulldeps/test-harness/test-ignore-cfg.rs delete mode 100644 tests/run-make-fulldeps/tools.mk delete mode 100644 tests/run-make-fulldeps/type-mismatch-same-crate-name/Makefile delete mode 100644 tests/run-make-fulldeps/type-mismatch-same-crate-name/crateA.rs delete mode 100644 tests/run-make-fulldeps/type-mismatch-same-crate-name/crateB.rs delete mode 100644 tests/run-make-fulldeps/type-mismatch-same-crate-name/crateC.rs delete mode 100644 tests/run-make-fulldeps/use-extern-for-plugins/Makefile delete mode 100644 tests/run-make-fulldeps/use-extern-for-plugins/bar.rs delete mode 100644 tests/run-make-fulldeps/use-extern-for-plugins/baz.rs delete mode 100644 tests/run-make-fulldeps/use-extern-for-plugins/foo.rs delete mode 100644 tests/run-make-fulldeps/use-suggestions-rust-2018/Makefile delete mode 100644 tests/run-make-fulldeps/use-suggestions-rust-2018/ep-nested-lib.rs delete mode 100644 tests/run-make-fulldeps/use-suggestions-rust-2018/use-suggestions.rs delete mode 100644 tests/run-make-fulldeps/used-cdylib-macos/Makefile delete mode 100644 tests/run-make-fulldeps/used-cdylib-macos/dylib_used.rs delete mode 100644 tests/run-make-fulldeps/used/Makefile delete mode 100644 tests/run-make-fulldeps/used/used.rs delete mode 100644 tests/run-make-fulldeps/version/Makefile delete mode 100644 tests/run-make-fulldeps/volatile-intrinsics/Makefile delete mode 100644 tests/run-make-fulldeps/volatile-intrinsics/main.rs delete mode 100644 tests/run-make-fulldeps/weird-output-filenames/Makefile delete mode 100644 tests/run-make-fulldeps/weird-output-filenames/foo.rs delete mode 100644 tests/run-make-fulldeps/windows-binary-no-external-deps/Makefile delete mode 100644 tests/run-make-fulldeps/windows-binary-no-external-deps/hello.rs delete mode 100644 tests/run-make-fulldeps/windows-spawn/Makefile delete mode 100644 tests/run-make-fulldeps/windows-spawn/hello.rs delete mode 100644 tests/run-make-fulldeps/windows-spawn/spawn.rs delete mode 100644 tests/run-make-fulldeps/windows-subsystem/Makefile delete mode 100644 tests/run-make-fulldeps/windows-subsystem/console.rs delete mode 100644 tests/run-make-fulldeps/windows-subsystem/windows.rs create mode 100644 tests/run-make/a-b-a-linker-guard/Makefile create mode 100644 tests/run-make/a-b-a-linker-guard/a.rs create mode 100644 tests/run-make/a-b-a-linker-guard/b.rs create mode 100644 tests/run-make/alloc-no-oom-handling/Makefile create mode 100644 tests/run-make/alloc-no-rc/Makefile create mode 100644 tests/run-make/alloc-no-sync/Makefile create mode 100644 tests/run-make/allow-non-lint-warnings-cmdline/Makefile create mode 100644 tests/run-make/allow-non-lint-warnings-cmdline/foo.rs create mode 100644 tests/run-make/allow-warnings-cmdline-stability/Makefile create mode 100644 tests/run-make/allow-warnings-cmdline-stability/bar.rs create mode 100644 tests/run-make/allow-warnings-cmdline-stability/foo.rs create mode 100644 tests/run-make/archive-duplicate-names/Makefile create mode 100644 tests/run-make/archive-duplicate-names/bar.c create mode 100644 tests/run-make/archive-duplicate-names/bar.rs create mode 100644 tests/run-make/archive-duplicate-names/foo.c create mode 100644 tests/run-make/archive-duplicate-names/foo.rs create mode 100644 tests/run-make/arguments-non-c-like-enum/Makefile create mode 100644 tests/run-make/arguments-non-c-like-enum/nonclike.rs create mode 100644 tests/run-make/arguments-non-c-like-enum/test.c create mode 100644 tests/run-make/atomic-lock-free/Makefile create mode 100644 tests/run-make/atomic-lock-free/atomic_lock_free.rs create mode 100644 tests/run-make/bare-outfile/Makefile create mode 100644 tests/run-make/bare-outfile/foo.rs create mode 100644 tests/run-make/c-dynamic-dylib/Makefile create mode 100644 tests/run-make/c-dynamic-dylib/bar.rs create mode 100644 tests/run-make/c-dynamic-dylib/cfoo.c create mode 100644 tests/run-make/c-dynamic-dylib/foo.rs create mode 100644 tests/run-make/c-dynamic-rlib/Makefile create mode 100644 tests/run-make/c-dynamic-rlib/bar.rs create mode 100644 tests/run-make/c-dynamic-rlib/cfoo.c create mode 100644 tests/run-make/c-dynamic-rlib/foo.rs create mode 100644 tests/run-make/c-link-to-rust-dylib/Makefile create mode 100644 tests/run-make/c-link-to-rust-dylib/bar.c create mode 100644 tests/run-make/c-link-to-rust-dylib/foo.rs create mode 100644 tests/run-make/c-link-to-rust-staticlib/Makefile create mode 100644 tests/run-make/c-link-to-rust-staticlib/bar.c create mode 100644 tests/run-make/c-link-to-rust-staticlib/foo.rs create mode 100644 tests/run-make/c-link-to-rust-va-list-fn/Makefile create mode 100644 tests/run-make/c-link-to-rust-va-list-fn/checkrust.rs create mode 100644 tests/run-make/c-link-to-rust-va-list-fn/test.c create mode 100644 tests/run-make/c-static-dylib/Makefile create mode 100644 tests/run-make/c-static-dylib/bar.rs create mode 100644 tests/run-make/c-static-dylib/cfoo.c create mode 100644 tests/run-make/c-static-dylib/foo.rs create mode 100644 tests/run-make/c-static-rlib/Makefile create mode 100644 tests/run-make/c-static-rlib/bar.rs create mode 100644 tests/run-make/c-static-rlib/cfoo.c create mode 100644 tests/run-make/c-static-rlib/foo.rs create mode 100644 tests/run-make/c-unwind-abi-catch-lib-panic/Makefile create mode 100644 tests/run-make/c-unwind-abi-catch-lib-panic/add.c create mode 100644 tests/run-make/c-unwind-abi-catch-lib-panic/main.rs create mode 100644 tests/run-make/c-unwind-abi-catch-lib-panic/panic.rs create mode 100644 tests/run-make/c-unwind-abi-catch-panic/Makefile create mode 100644 tests/run-make/c-unwind-abi-catch-panic/add.c create mode 100644 tests/run-make/c-unwind-abi-catch-panic/main.rs create mode 100644 tests/run-make/cat-and-grep-sanity-check/Makefile create mode 100644 tests/run-make/cdylib-dylib-linkage/Makefile create mode 100644 tests/run-make/cdylib-dylib-linkage/bar.rs create mode 100644 tests/run-make/cdylib-dylib-linkage/foo.c create mode 100644 tests/run-make/cdylib-dylib-linkage/foo.rs create mode 100644 tests/run-make/cdylib-fewer-symbols/Makefile create mode 100644 tests/run-make/cdylib-fewer-symbols/foo.rs create mode 100644 tests/run-make/cdylib/Makefile create mode 100644 tests/run-make/cdylib/bar.rs create mode 100644 tests/run-make/cdylib/foo.c create mode 100644 tests/run-make/cdylib/foo.rs create mode 100644 tests/run-make/codegen-options-parsing/Makefile create mode 100644 tests/run-make/codegen-options-parsing/dummy.rs create mode 100644 tests/run-make/compile-stdin/Makefile create mode 100644 tests/run-make/compiler-lookup-paths-2/Makefile create mode 100644 tests/run-make/compiler-lookup-paths-2/a.rs create mode 100644 tests/run-make/compiler-lookup-paths-2/b.rs create mode 100644 tests/run-make/compiler-lookup-paths-2/c.rs create mode 100644 tests/run-make/compiler-lookup-paths/Makefile create mode 100644 tests/run-make/compiler-lookup-paths/a.rs create mode 100644 tests/run-make/compiler-lookup-paths/b.rs create mode 100644 tests/run-make/compiler-lookup-paths/c.rs create mode 100644 tests/run-make/compiler-lookup-paths/d.rs create mode 100644 tests/run-make/compiler-lookup-paths/e.rs create mode 100644 tests/run-make/compiler-lookup-paths/e2.rs create mode 100644 tests/run-make/compiler-lookup-paths/f.rs create mode 100644 tests/run-make/compiler-lookup-paths/native.c create mode 100644 tests/run-make/compiler-rt-works-on-mingw/Makefile create mode 100644 tests/run-make/compiler-rt-works-on-mingw/foo.cpp create mode 100644 tests/run-make/compiler-rt-works-on-mingw/foo.rs create mode 100644 tests/run-make/core-no-fp-fmt-parse/Makefile create mode 100644 tests/run-make/crate-data-smoke/Makefile create mode 100644 tests/run-make/crate-data-smoke/crate.rs create mode 100644 tests/run-make/crate-data-smoke/lib.rs create mode 100644 tests/run-make/crate-data-smoke/rlib.rs create mode 100644 tests/run-make/crate-hash-rustc-version/Makefile create mode 100644 tests/run-make/crate-hash-rustc-version/a.rs create mode 100644 tests/run-make/crate-hash-rustc-version/b.rs create mode 100644 tests/run-make/crate-name-priority/Makefile create mode 100644 tests/run-make/crate-name-priority/foo.rs create mode 100644 tests/run-make/crate-name-priority/foo1.rs create mode 100644 tests/run-make/cross-lang-lto-clang/Makefile create mode 100644 tests/run-make/cross-lang-lto-clang/clib.c create mode 100644 tests/run-make/cross-lang-lto-clang/cmain.c create mode 100644 tests/run-make/cross-lang-lto-clang/main.rs create mode 100644 tests/run-make/cross-lang-lto-clang/rustlib.rs create mode 100644 tests/run-make/cross-lang-lto-pgo-smoketest/Makefile create mode 100644 tests/run-make/cross-lang-lto-pgo-smoketest/clib.c create mode 100644 tests/run-make/cross-lang-lto-pgo-smoketest/cmain.c create mode 100644 tests/run-make/cross-lang-lto-pgo-smoketest/main.rs create mode 100644 tests/run-make/cross-lang-lto-pgo-smoketest/rustlib.rs create mode 100644 tests/run-make/cross-lang-lto-upstream-rlibs/Makefile create mode 100644 tests/run-make/cross-lang-lto-upstream-rlibs/staticlib.rs create mode 100644 tests/run-make/cross-lang-lto-upstream-rlibs/upstream.rs create mode 100644 tests/run-make/cross-lang-lto/Makefile create mode 100644 tests/run-make/cross-lang-lto/lib.rs create mode 100644 tests/run-make/cross-lang-lto/main.rs create mode 100644 tests/run-make/debug-assertions/Makefile create mode 100644 tests/run-make/debug-assertions/debug.rs create mode 100644 tests/run-make/dep-info-doesnt-run-much/Makefile create mode 100644 tests/run-make/dep-info-doesnt-run-much/foo.rs create mode 100644 tests/run-make/dep-info-spaces/Makefile create mode 100644 tests/run-make/dep-info-spaces/Makefile.foo create mode 100644 tests/run-make/dep-info-spaces/bar.rs create mode 100644 tests/run-make/dep-info-spaces/foo foo.rs create mode 100644 tests/run-make/dep-info-spaces/lib.rs create mode 100644 tests/run-make/dep-info/Makefile create mode 100644 tests/run-make/dep-info/Makefile.foo create mode 100644 tests/run-make/dep-info/bar.rs create mode 100644 tests/run-make/dep-info/foo.rs create mode 100644 tests/run-make/dep-info/lib.rs create mode 100644 tests/run-make/dep-info/lib2.rs create mode 100644 tests/run-make/doctests-keep-binaries/Makefile create mode 100644 tests/run-make/doctests-keep-binaries/t.rs create mode 100644 tests/run-make/duplicate-output-flavors/Makefile create mode 100644 tests/run-make/duplicate-output-flavors/foo.rs create mode 100644 tests/run-make/dylib-chain/Makefile create mode 100644 tests/run-make/dylib-chain/m1.rs create mode 100644 tests/run-make/dylib-chain/m2.rs create mode 100644 tests/run-make/dylib-chain/m3.rs create mode 100644 tests/run-make/dylib-chain/m4.rs create mode 100644 tests/run-make/emit-stack-sizes/Makefile create mode 100644 tests/run-make/emit-stack-sizes/foo.rs create mode 100644 tests/run-make/emit/Makefile create mode 100644 tests/run-make/emit/test-24876.rs create mode 100644 tests/run-make/emit/test-26235.rs create mode 100644 tests/run-make/error-found-staticlib-instead-crate/Makefile create mode 100644 tests/run-make/error-found-staticlib-instead-crate/bar.rs create mode 100644 tests/run-make/error-found-staticlib-instead-crate/foo.rs create mode 100644 tests/run-make/error-writing-dependencies/Makefile create mode 100644 tests/run-make/error-writing-dependencies/foo.rs create mode 100644 tests/run-make/exit-code/Makefile create mode 100644 tests/run-make/exit-code/compile-error.rs create mode 100644 tests/run-make/exit-code/lint-failure.rs create mode 100644 tests/run-make/exit-code/success.rs create mode 100644 tests/run-make/extern-diff-internal-name/Makefile create mode 100644 tests/run-make/extern-diff-internal-name/lib.rs create mode 100644 tests/run-make/extern-diff-internal-name/test.rs create mode 100644 tests/run-make/extern-flag-disambiguates/Makefile create mode 100644 tests/run-make/extern-flag-disambiguates/a.rs create mode 100644 tests/run-make/extern-flag-disambiguates/b.rs create mode 100644 tests/run-make/extern-flag-disambiguates/c.rs create mode 100644 tests/run-make/extern-flag-disambiguates/d.rs create mode 100644 tests/run-make/extern-flag-fun/Makefile create mode 100644 tests/run-make/extern-flag-fun/bar-alt.rs create mode 100644 tests/run-make/extern-flag-fun/bar.rs create mode 100644 tests/run-make/extern-flag-fun/foo.rs create mode 100644 tests/run-make/extern-flag-fun/gated_unstable.rs create mode 100644 tests/run-make/extern-flag-fun/rustc.rs create mode 100644 tests/run-make/extern-flag-pathless/Makefile create mode 100644 tests/run-make/extern-flag-pathless/bar-dynamic.rs create mode 100644 tests/run-make/extern-flag-pathless/bar-static.rs create mode 100644 tests/run-make/extern-flag-pathless/foo.rs create mode 100644 tests/run-make/extern-flag-rename-transitive/Makefile create mode 100644 tests/run-make/extern-flag-rename-transitive/bar.rs create mode 100644 tests/run-make/extern-flag-rename-transitive/baz.rs create mode 100644 tests/run-make/extern-flag-rename-transitive/foo.rs create mode 100644 tests/run-make/extern-fn-generic/Makefile create mode 100644 tests/run-make/extern-fn-generic/test.c create mode 100644 tests/run-make/extern-fn-generic/test.rs create mode 100644 tests/run-make/extern-fn-generic/testcrate.rs create mode 100644 tests/run-make/extern-fn-mangle/Makefile create mode 100644 tests/run-make/extern-fn-mangle/test.c create mode 100644 tests/run-make/extern-fn-mangle/test.rs create mode 100644 tests/run-make/extern-fn-reachable/Makefile create mode 100644 tests/run-make/extern-fn-reachable/dylib.rs create mode 100644 tests/run-make/extern-fn-struct-passing-abi/Makefile create mode 100644 tests/run-make/extern-fn-struct-passing-abi/test.c create mode 100644 tests/run-make/extern-fn-struct-passing-abi/test.rs create mode 100644 tests/run-make/extern-fn-with-extern-types/Makefile create mode 100644 tests/run-make/extern-fn-with-extern-types/ctest.c create mode 100644 tests/run-make/extern-fn-with-extern-types/test.rs create mode 100644 tests/run-make/extern-fn-with-packed-struct/Makefile create mode 100644 tests/run-make/extern-fn-with-packed-struct/test.c create mode 100644 tests/run-make/extern-fn-with-packed-struct/test.rs create mode 100644 tests/run-make/extern-fn-with-union/Makefile create mode 100644 tests/run-make/extern-fn-with-union/ctest.c create mode 100644 tests/run-make/extern-fn-with-union/test.rs create mode 100644 tests/run-make/extern-fn-with-union/testcrate.rs create mode 100644 tests/run-make/extern-multiple-copies/Makefile create mode 100644 tests/run-make/extern-multiple-copies/bar.rs create mode 100644 tests/run-make/extern-multiple-copies/foo1.rs create mode 100644 tests/run-make/extern-multiple-copies/foo2.rs create mode 100644 tests/run-make/extern-multiple-copies2/Makefile create mode 100644 tests/run-make/extern-multiple-copies2/bar.rs create mode 100644 tests/run-make/extern-multiple-copies2/foo1.rs create mode 100644 tests/run-make/extern-multiple-copies2/foo2.rs create mode 100644 tests/run-make/extern-overrides-distribution/Makefile create mode 100644 tests/run-make/extern-overrides-distribution/libc.rs create mode 100644 tests/run-make/extern-overrides-distribution/main.rs create mode 100644 tests/run-make/extra-filename-with-temp-outputs/Makefile create mode 100644 tests/run-make/extra-filename-with-temp-outputs/foo.rs create mode 100644 tests/run-make/foreign-double-unwind/Makefile create mode 100644 tests/run-make/foreign-double-unwind/foo.cpp create mode 100644 tests/run-make/foreign-double-unwind/foo.rs create mode 100644 tests/run-make/foreign-exceptions/Makefile create mode 100644 tests/run-make/foreign-exceptions/foo.cpp create mode 100644 tests/run-make/foreign-exceptions/foo.rs create mode 100644 tests/run-make/foreign-rust-exceptions/Makefile create mode 100644 tests/run-make/foreign-rust-exceptions/bar.rs create mode 100644 tests/run-make/foreign-rust-exceptions/foo.rs create mode 100644 tests/run-make/fpic/Makefile create mode 100644 tests/run-make/fpic/hello.rs create mode 100644 tests/run-make/glibc-staticlib-args/Makefile create mode 100644 tests/run-make/glibc-staticlib-args/library.rs create mode 100644 tests/run-make/glibc-staticlib-args/program.c create mode 100644 tests/run-make/hir-tree/Makefile create mode 100644 tests/run-make/hir-tree/input.rs create mode 100644 tests/run-make/include_bytes_deps/Makefile create mode 100644 tests/run-make/include_bytes_deps/input.bin create mode 100644 tests/run-make/include_bytes_deps/input.md create mode 100644 tests/run-make/include_bytes_deps/input.txt create mode 100644 tests/run-make/include_bytes_deps/main.rs create mode 100644 tests/run-make/incr-add-rust-src-component/Makefile create mode 100644 tests/run-make/incr-add-rust-src-component/main.rs create mode 100644 tests/run-make/inline-always-many-cgu/Makefile create mode 100644 tests/run-make/inline-always-many-cgu/foo.rs create mode 100644 tests/run-make/interdependent-c-libraries/Makefile create mode 100644 tests/run-make/interdependent-c-libraries/bar.c create mode 100644 tests/run-make/interdependent-c-libraries/bar.rs create mode 100644 tests/run-make/interdependent-c-libraries/foo.c create mode 100644 tests/run-make/interdependent-c-libraries/foo.rs create mode 100644 tests/run-make/interdependent-c-libraries/main.rs create mode 100644 tests/run-make/intrinsic-unreachable/Makefile create mode 100644 tests/run-make/intrinsic-unreachable/exit-ret.rs create mode 100644 tests/run-make/intrinsic-unreachable/exit-unreachable.rs create mode 100644 tests/run-make/invalid-library/Makefile create mode 100644 tests/run-make/invalid-library/foo.rs create mode 100644 tests/run-make/invalid-staticlib/Makefile create mode 100644 tests/run-make/issue-109934-lto-debuginfo/Makefile create mode 100644 tests/run-make/issue-109934-lto-debuginfo/lib.rs create mode 100644 tests/run-make/issue-11908/Makefile create mode 100644 tests/run-make/issue-11908/bar.rs create mode 100644 tests/run-make/issue-11908/foo.rs create mode 100644 tests/run-make/issue-14500/Makefile create mode 100644 tests/run-make/issue-14500/bar.rs create mode 100644 tests/run-make/issue-14500/foo.c create mode 100644 tests/run-make/issue-14500/foo.rs create mode 100644 tests/run-make/issue-14698/Makefile create mode 100644 tests/run-make/issue-14698/foo.rs create mode 100644 tests/run-make/issue-15460/Makefile create mode 100644 tests/run-make/issue-15460/bar.rs create mode 100644 tests/run-make/issue-15460/foo.c create mode 100644 tests/run-make/issue-15460/foo.rs create mode 100644 tests/run-make/issue-18943/Makefile create mode 100644 tests/run-make/issue-18943/foo.rs create mode 100644 tests/run-make/issue-20626/Makefile create mode 100644 tests/run-make/issue-20626/foo.rs create mode 100644 tests/run-make/issue-22131/Makefile create mode 100644 tests/run-make/issue-22131/foo.rs create mode 100644 tests/run-make/issue-24445/Makefile create mode 100644 tests/run-make/issue-24445/foo.c create mode 100644 tests/run-make/issue-24445/foo.rs create mode 100644 tests/run-make/issue-25581/Makefile create mode 100644 tests/run-make/issue-25581/test.c create mode 100644 tests/run-make/issue-25581/test.rs create mode 100644 tests/run-make/issue-26006/Makefile create mode 100644 tests/run-make/issue-26006/in/libc/lib.rs create mode 100644 tests/run-make/issue-26006/in/time/lib.rs create mode 100644 tests/run-make/issue-26092/Makefile create mode 100644 tests/run-make/issue-26092/blank.rs create mode 100644 tests/run-make/issue-28595/Makefile create mode 100644 tests/run-make/issue-28595/a.c create mode 100644 tests/run-make/issue-28595/a.rs create mode 100644 tests/run-make/issue-28595/b.c create mode 100644 tests/run-make/issue-28595/b.rs create mode 100644 tests/run-make/issue-28766/Makefile create mode 100644 tests/run-make/issue-28766/foo.rs create mode 100644 tests/run-make/issue-28766/main.rs create mode 100644 tests/run-make/issue-30063/Makefile create mode 100644 tests/run-make/issue-30063/foo.rs create mode 100644 tests/run-make/issue-33329/Makefile create mode 100644 tests/run-make/issue-33329/main.rs create mode 100644 tests/run-make/issue-35164/Makefile create mode 100644 tests/run-make/issue-35164/main.rs create mode 100644 tests/run-make/issue-35164/submodule/mod.rs create mode 100644 tests/run-make/issue-37839/Makefile create mode 100644 tests/run-make/issue-37839/a.rs create mode 100644 tests/run-make/issue-37839/b.rs create mode 100644 tests/run-make/issue-37839/c.rs create mode 100644 tests/run-make/issue-37893/Makefile create mode 100644 tests/run-make/issue-37893/a.rs create mode 100644 tests/run-make/issue-37893/b.rs create mode 100644 tests/run-make/issue-37893/c.rs create mode 100644 tests/run-make/issue-38237/Makefile create mode 100644 tests/run-make/issue-38237/bar.rs create mode 100644 tests/run-make/issue-38237/baz.rs create mode 100644 tests/run-make/issue-38237/foo.rs create mode 100644 tests/run-make/issue-40535/Makefile create mode 100644 tests/run-make/issue-40535/bar.rs create mode 100644 tests/run-make/issue-40535/baz.rs create mode 100644 tests/run-make/issue-40535/foo.rs create mode 100644 tests/run-make/issue-46239/Makefile create mode 100644 tests/run-make/issue-46239/main.rs create mode 100644 tests/run-make/issue-47551/Makefile create mode 100644 tests/run-make/issue-47551/eh_frame-terminator.rs create mode 100644 tests/run-make/issue-51671/Makefile create mode 100644 tests/run-make/issue-51671/app.rs create mode 100644 tests/run-make/issue-53964/Makefile create mode 100644 tests/run-make/issue-53964/app.rs create mode 100644 tests/run-make/issue-53964/panic.rs create mode 100644 tests/run-make/issue-64153/Makefile create mode 100644 tests/run-make/issue-64153/downstream.rs create mode 100644 tests/run-make/issue-64153/upstream.rs create mode 100644 tests/run-make/issue-68794-textrel-on-minimal-lib/Makefile create mode 100644 tests/run-make/issue-68794-textrel-on-minimal-lib/bar.c create mode 100644 tests/run-make/issue-68794-textrel-on-minimal-lib/foo.rs create mode 100644 tests/run-make/issue-69368/Makefile create mode 100644 tests/run-make/issue-69368/a.rs create mode 100644 tests/run-make/issue-69368/b.rs create mode 100644 tests/run-make/issue-69368/c.rs create mode 100644 tests/run-make/issue-7349/Makefile create mode 100644 tests/run-make/issue-7349/foo.rs create mode 100644 tests/run-make/issue-83045/Makefile create mode 100644 tests/run-make/issue-83045/a.rs create mode 100644 tests/run-make/issue-83045/b.rs create mode 100644 tests/run-make/issue-83045/c.rs create mode 100644 tests/run-make/issue-84395-lto-embed-bitcode/Makefile create mode 100644 tests/run-make/issue-84395-lto-embed-bitcode/test.rs create mode 100644 tests/run-make/issue-97463-abi-param-passing/Makefile create mode 100644 tests/run-make/issue-97463-abi-param-passing/bad.c create mode 100644 tests/run-make/issue-97463-abi-param-passing/param_passing.rs create mode 100644 tests/run-make/issue64319/Makefile create mode 100644 tests/run-make/issue64319/bar.rs create mode 100644 tests/run-make/issue64319/foo.rs create mode 100644 tests/run-make/jobserver-error/Makefile create mode 100644 tests/run-make/jobserver-error/jobserver.stderr create mode 100644 tests/run-make/libs-through-symlinks/Makefile create mode 100644 tests/run-make/libs-through-symlinks/bar.rs create mode 100644 tests/run-make/libs-through-symlinks/foo.rs create mode 100644 tests/run-make/libtest-json/Makefile create mode 100644 tests/run-make/libtest-json/f.rs create mode 100644 tests/run-make/libtest-json/output-default.json create mode 100644 tests/run-make/libtest-json/output-stdout-success.json create mode 100755 tests/run-make/libtest-json/validate_json.py create mode 100644 tests/run-make/link-arg/Makefile create mode 100644 tests/run-make/link-arg/empty.rs create mode 100644 tests/run-make/link-args-order/Makefile create mode 100644 tests/run-make/link-args-order/empty.rs create mode 100644 tests/run-make/link-cfg/Makefile create mode 100644 tests/run-make/link-cfg/dep-with-staticlib.rs create mode 100644 tests/run-make/link-cfg/dep.rs create mode 100644 tests/run-make/link-cfg/no-deps.rs create mode 100644 tests/run-make/link-cfg/return1.c create mode 100644 tests/run-make/link-cfg/return2.c create mode 100644 tests/run-make/link-cfg/return3.c create mode 100644 tests/run-make/link-cfg/with-deps.rs create mode 100644 tests/run-make/link-cfg/with-staticlib-deps.rs create mode 100644 tests/run-make/link-dedup/Makefile create mode 100644 tests/run-make/link-dedup/depa.rs create mode 100644 tests/run-make/link-dedup/depb.rs create mode 100644 tests/run-make/link-dedup/depc.rs create mode 100644 tests/run-make/link-dedup/empty.rs create mode 100644 tests/run-make/link-path-order/Makefile create mode 100644 tests/run-make/link-path-order/correct.c create mode 100644 tests/run-make/link-path-order/main.rs create mode 100644 tests/run-make/link-path-order/wrong.c create mode 100644 tests/run-make/linkage-attr-on-static/Makefile create mode 100644 tests/run-make/linkage-attr-on-static/bar.rs create mode 100644 tests/run-make/linkage-attr-on-static/foo.c create mode 100644 tests/run-make/long-linker-command-lines-cmd-exe/Makefile create mode 100644 tests/run-make/long-linker-command-lines-cmd-exe/foo.bat create mode 100644 tests/run-make/long-linker-command-lines-cmd-exe/foo.rs create mode 100644 tests/run-make/long-linker-command-lines/Makefile create mode 100644 tests/run-make/long-linker-command-lines/foo.rs create mode 100644 tests/run-make/longjmp-across-rust/Makefile create mode 100644 tests/run-make/longjmp-across-rust/foo.c create mode 100644 tests/run-make/longjmp-across-rust/main.rs create mode 100644 tests/run-make/ls-metadata/Makefile create mode 100644 tests/run-make/ls-metadata/foo.rs create mode 100644 tests/run-make/lto-dylib-dep/Makefile create mode 100644 tests/run-make/lto-dylib-dep/a_dylib.rs create mode 100644 tests/run-make/lto-dylib-dep/main.rs create mode 100644 tests/run-make/lto-empty/Makefile create mode 100644 tests/run-make/lto-empty/lib.rs create mode 100644 tests/run-make/lto-no-link-whole-rlib/Makefile create mode 100644 tests/run-make/lto-no-link-whole-rlib/bar.c create mode 100644 tests/run-make/lto-no-link-whole-rlib/foo.c create mode 100644 tests/run-make/lto-no-link-whole-rlib/lib1.rs create mode 100644 tests/run-make/lto-no-link-whole-rlib/lib2.rs create mode 100644 tests/run-make/lto-no-link-whole-rlib/main.rs create mode 100644 tests/run-make/lto-readonly-lib/Makefile create mode 100644 tests/run-make/lto-readonly-lib/lib.rs create mode 100644 tests/run-make/lto-readonly-lib/main.rs create mode 100644 tests/run-make/lto-smoke-c/Makefile create mode 100644 tests/run-make/lto-smoke-c/bar.c create mode 100644 tests/run-make/lto-smoke-c/foo.rs create mode 100644 tests/run-make/lto-smoke/Makefile create mode 100644 tests/run-make/lto-smoke/lib.rs create mode 100644 tests/run-make/lto-smoke/main.rs create mode 100644 tests/run-make/manual-crate-name/Makefile create mode 100644 tests/run-make/manual-crate-name/bar.rs create mode 100644 tests/run-make/manual-link/Makefile create mode 100644 tests/run-make/manual-link/bar.c create mode 100644 tests/run-make/manual-link/foo.c create mode 100644 tests/run-make/manual-link/foo.rs create mode 100644 tests/run-make/manual-link/main.rs create mode 100644 tests/run-make/many-crates-but-no-match/Makefile create mode 100644 tests/run-make/many-crates-but-no-match/crateA1.rs create mode 100644 tests/run-make/many-crates-but-no-match/crateA2.rs create mode 100644 tests/run-make/many-crates-but-no-match/crateA3.rs create mode 100644 tests/run-make/many-crates-but-no-match/crateB.rs create mode 100644 tests/run-make/many-crates-but-no-match/crateC.rs create mode 100644 tests/run-make/metadata-flag-frobs-symbols/Makefile create mode 100644 tests/run-make/metadata-flag-frobs-symbols/bar.rs create mode 100644 tests/run-make/metadata-flag-frobs-symbols/foo.rs create mode 100644 tests/run-make/min-global-align/Makefile create mode 100644 tests/run-make/min-global-align/min_global_align.rs create mode 100644 tests/run-make/mingw-export-call-convention/Makefile create mode 100644 tests/run-make/mingw-export-call-convention/foo.rs create mode 100644 tests/run-make/mismatching-target-triples/Makefile create mode 100644 tests/run-make/mismatching-target-triples/bar.rs create mode 100644 tests/run-make/mismatching-target-triples/foo.rs create mode 100644 tests/run-make/missing-crate-dependency/Makefile create mode 100644 tests/run-make/missing-crate-dependency/crateA.rs create mode 100644 tests/run-make/missing-crate-dependency/crateB.rs create mode 100644 tests/run-make/missing-crate-dependency/crateC.rs create mode 100644 tests/run-make/mixing-deps/Makefile create mode 100644 tests/run-make/mixing-deps/both.rs create mode 100644 tests/run-make/mixing-deps/dylib.rs create mode 100644 tests/run-make/mixing-deps/prog.rs create mode 100644 tests/run-make/mixing-formats/Makefile create mode 100644 tests/run-make/mixing-formats/bar1.rs create mode 100644 tests/run-make/mixing-formats/bar2.rs create mode 100644 tests/run-make/mixing-formats/baz.rs create mode 100644 tests/run-make/mixing-formats/baz2.rs create mode 100644 tests/run-make/mixing-formats/foo.rs create mode 100644 tests/run-make/mixing-libs/Makefile create mode 100644 tests/run-make/mixing-libs/dylib.rs create mode 100644 tests/run-make/mixing-libs/prog.rs create mode 100644 tests/run-make/mixing-libs/rlib.rs create mode 100644 tests/run-make/msvc-opt-minsize/Makefile create mode 100644 tests/run-make/msvc-opt-minsize/foo.rs create mode 100644 tests/run-make/multiple-emits/Makefile create mode 100644 tests/run-make/multiple-emits/foo.rs create mode 100644 tests/run-make/no-builtins-lto/Makefile create mode 100644 tests/run-make/no-builtins-lto/main.rs create mode 100644 tests/run-make/no-builtins-lto/no_builtins.rs create mode 100644 tests/run-make/no-duplicate-libs/Makefile create mode 100644 tests/run-make/no-duplicate-libs/bar.c create mode 100644 tests/run-make/no-duplicate-libs/foo.c create mode 100644 tests/run-make/no-duplicate-libs/main.rs create mode 100644 tests/run-make/no-intermediate-extras/Makefile create mode 100644 tests/run-make/no-intermediate-extras/foo.rs create mode 100644 tests/run-make/obey-crate-type-flag/Makefile create mode 100644 tests/run-make/obey-crate-type-flag/test.rs create mode 100644 tests/run-make/output-filename-conflicts-with-directory/Makefile create mode 100644 tests/run-make/output-filename-conflicts-with-directory/foo.rs create mode 100644 tests/run-make/output-filename-overwrites-input/Makefile create mode 100644 tests/run-make/output-filename-overwrites-input/bar.rs create mode 100644 tests/run-make/output-filename-overwrites-input/foo.rs create mode 100644 tests/run-make/output-type-permutations/Makefile create mode 100644 tests/run-make/output-type-permutations/foo.rs create mode 100644 tests/run-make/output-with-hyphens/Makefile create mode 100644 tests/run-make/output-with-hyphens/foo-bar.rs create mode 100644 tests/run-make/override-aliased-flags/Makefile create mode 100644 tests/run-make/override-aliased-flags/main.rs create mode 100644 tests/run-make/panic-impl-transitive/Makefile create mode 100644 tests/run-make/panic-impl-transitive/panic-impl-consumer.rs create mode 100644 tests/run-make/panic-impl-transitive/panic-impl-provider.rs create mode 100644 tests/run-make/pass-non-c-like-enum-to-c/Makefile create mode 100644 tests/run-make/pass-non-c-like-enum-to-c/nonclike.rs create mode 100644 tests/run-make/pass-non-c-like-enum-to-c/test.c create mode 100644 tests/run-make/pgo-branch-weights/Makefile create mode 100644 tests/run-make/pgo-branch-weights/filecheck-patterns.txt create mode 100644 tests/run-make/pgo-branch-weights/interesting.rs create mode 100644 tests/run-make/pgo-branch-weights/main.rs create mode 100644 tests/run-make/pgo-branch-weights/opaque.rs create mode 100644 tests/run-make/pgo-gen-lto/Makefile create mode 100644 tests/run-make/pgo-gen-lto/test.rs create mode 100644 tests/run-make/pgo-gen-no-imp-symbols/Makefile create mode 100644 tests/run-make/pgo-gen-no-imp-symbols/test.rs create mode 100644 tests/run-make/pgo-gen/Makefile create mode 100644 tests/run-make/pgo-gen/test.rs create mode 100644 tests/run-make/pgo-indirect-call-promotion/Makefile create mode 100644 tests/run-make/pgo-indirect-call-promotion/filecheck-patterns.txt create mode 100644 tests/run-make/pgo-indirect-call-promotion/interesting.rs create mode 100644 tests/run-make/pgo-indirect-call-promotion/main.rs create mode 100644 tests/run-make/pgo-indirect-call-promotion/opaque.rs create mode 100644 tests/run-make/pgo-use/Makefile create mode 100644 tests/run-make/pgo-use/filecheck-patterns.txt create mode 100644 tests/run-make/pgo-use/main.rs create mode 100644 tests/run-make/pointer-auth-link-with-c/Makefile create mode 100644 tests/run-make/pointer-auth-link-with-c/test.c create mode 100644 tests/run-make/pointer-auth-link-with-c/test.rs create mode 100644 tests/run-make/prefer-dylib/Makefile create mode 100644 tests/run-make/prefer-dylib/bar.rs create mode 100644 tests/run-make/prefer-dylib/foo.rs create mode 100644 tests/run-make/prefer-rlib/Makefile create mode 100644 tests/run-make/prefer-rlib/bar.rs create mode 100644 tests/run-make/prefer-rlib/foo.rs create mode 100644 tests/run-make/pretty-print-to-file/Makefile create mode 100644 tests/run-make/pretty-print-to-file/input.pp create mode 100644 tests/run-make/pretty-print-to-file/input.rs create mode 100644 tests/run-make/print-calling-conventions/Makefile create mode 100644 tests/run-make/print-cfg/Makefile create mode 100644 tests/run-make/print-target-list/Makefile create mode 100644 tests/run-make/profile/Makefile create mode 100644 tests/run-make/profile/test.rs create mode 100644 tests/run-make/prune-link-args/Makefile create mode 100644 tests/run-make/prune-link-args/empty.rs create mode 100644 tests/run-make/raw-dylib-cross-compilation/Makefile create mode 100644 tests/run-make/raw-dylib-cross-compilation/lib.rs create mode 100644 tests/run-make/redundant-libs/Makefile create mode 100644 tests/run-make/redundant-libs/bar.c create mode 100644 tests/run-make/redundant-libs/baz.c create mode 100644 tests/run-make/redundant-libs/foo.c create mode 100644 tests/run-make/redundant-libs/main.rs create mode 100644 tests/run-make/relocation-model/Makefile create mode 100644 tests/run-make/relocation-model/foo.rs create mode 100644 tests/run-make/relro-levels/Makefile create mode 100644 tests/run-make/relro-levels/hello.rs create mode 100644 tests/run-make/remap-path-prefix/Makefile create mode 100644 tests/run-make/remap-path-prefix/auxiliary/lib.rs create mode 100644 tests/run-make/reproducible-build-2/Makefile create mode 100644 tests/run-make/reproducible-build-2/linker.rs create mode 100644 tests/run-make/reproducible-build-2/reproducible-build-aux.rs create mode 100644 tests/run-make/reproducible-build-2/reproducible-build.rs create mode 100644 tests/run-make/reproducible-build/Makefile create mode 100644 tests/run-make/reproducible-build/linker.rs create mode 100644 tests/run-make/reproducible-build/reproducible-build-aux.rs create mode 100644 tests/run-make/reproducible-build/reproducible-build.rs create mode 100644 tests/run-make/resolve-rename/Makefile create mode 100644 tests/run-make/resolve-rename/bar.rs create mode 100644 tests/run-make/resolve-rename/baz.rs create mode 100644 tests/run-make/resolve-rename/foo.rs create mode 100644 tests/run-make/return-non-c-like-enum-from-c/Makefile create mode 100644 tests/run-make/return-non-c-like-enum-from-c/nonclike.rs create mode 100644 tests/run-make/return-non-c-like-enum-from-c/test.c create mode 100644 tests/run-make/return-non-c-like-enum/Makefile create mode 100644 tests/run-make/return-non-c-like-enum/nonclike.rs create mode 100644 tests/run-make/return-non-c-like-enum/test.c create mode 100644 tests/run-make/rlib-chain/Makefile create mode 100644 tests/run-make/rlib-chain/m1.rs create mode 100644 tests/run-make/rlib-chain/m2.rs create mode 100644 tests/run-make/rlib-chain/m3.rs create mode 100644 tests/run-make/rlib-chain/m4.rs create mode 100644 tests/run-make/rustdoc-determinism/Makefile create mode 100644 tests/run-make/rustdoc-determinism/bar.rs create mode 100644 tests/run-make/rustdoc-determinism/foo.rs create mode 100644 tests/run-make/rustdoc-error-lines/Makefile create mode 100644 tests/run-make/rustdoc-error-lines/input.rs create mode 100644 tests/run-make/rustdoc-io-error/Makefile create mode 100644 tests/run-make/rustdoc-io-error/foo.rs create mode 100644 tests/run-make/rustdoc-map-file/Makefile create mode 100644 tests/run-make/rustdoc-map-file/expected.json create mode 100644 tests/run-make/rustdoc-map-file/foo.rs create mode 100755 tests/run-make/rustdoc-map-file/validate_json.py create mode 100644 tests/run-make/rustdoc-output-path/Makefile create mode 100644 tests/run-make/rustdoc-output-path/foo.rs create mode 100644 tests/run-make/rustdoc-scrape-examples-macros/Makefile create mode 100644 tests/run-make/rustdoc-scrape-examples-macros/examples/ex.rs create mode 100644 tests/run-make/rustdoc-scrape-examples-macros/src/lib.rs create mode 100644 tests/run-make/rustdoc-scrape-examples-macros/src/proc.rs create mode 100644 tests/run-make/rustdoc-shared-flags/Makefile create mode 100644 tests/run-make/rustdoc-target-spec-json-path/Makefile create mode 100644 tests/run-make/rustdoc-target-spec-json-path/dummy_core.rs create mode 100644 tests/run-make/rustdoc-target-spec-json-path/my_crate.rs create mode 100644 tests/run-make/rustdoc-target-spec-json-path/target.json create mode 100644 tests/run-make/rustdoc-themes/Makefile create mode 100644 tests/run-make/rustdoc-themes/foo.rs create mode 100644 tests/run-make/sanitizer-cdylib-link/Makefile create mode 100644 tests/run-make/sanitizer-cdylib-link/library.rs create mode 100644 tests/run-make/sanitizer-cdylib-link/program.rs create mode 100644 tests/run-make/sanitizer-dylib-link/Makefile create mode 100644 tests/run-make/sanitizer-dylib-link/library.rs create mode 100644 tests/run-make/sanitizer-dylib-link/program.rs create mode 100644 tests/run-make/sanitizer-staticlib-link/Makefile create mode 100644 tests/run-make/sanitizer-staticlib-link/library.rs create mode 100644 tests/run-make/sanitizer-staticlib-link/program.c create mode 100644 tests/run-make/sanitizer-staticlib-link/program.rs create mode 100644 tests/run-make/separate-link-fail/Makefile create mode 100644 tests/run-make/separate-link/Makefile create mode 100644 tests/run-make/sepcomp-cci-copies/Makefile create mode 100644 tests/run-make/sepcomp-cci-copies/cci_lib.rs create mode 100644 tests/run-make/sepcomp-cci-copies/foo.rs create mode 100644 tests/run-make/sepcomp-inlining/Makefile create mode 100644 tests/run-make/sepcomp-inlining/foo.rs create mode 100644 tests/run-make/sepcomp-separate/Makefile create mode 100644 tests/run-make/sepcomp-separate/foo.rs create mode 100644 tests/run-make/share-generics-dylib/Makefile create mode 100644 tests/run-make/share-generics-dylib/instance_provider_a.rs create mode 100644 tests/run-make/share-generics-dylib/instance_provider_b.rs create mode 100644 tests/run-make/share-generics-dylib/instance_user_a_rlib.rs create mode 100644 tests/run-make/share-generics-dylib/instance_user_b_rlib.rs create mode 100644 tests/run-make/share-generics-dylib/instance_user_dylib.rs create mode 100644 tests/run-make/share-generics-dylib/linked_leaf.rs create mode 100644 tests/run-make/simd-ffi/Makefile create mode 100644 tests/run-make/simd-ffi/simd.rs create mode 100644 tests/run-make/simple-dylib/Makefile create mode 100644 tests/run-make/simple-dylib/bar.rs create mode 100644 tests/run-make/simple-dylib/foo.rs create mode 100644 tests/run-make/simple-rlib/Makefile create mode 100644 tests/run-make/simple-rlib/bar.rs create mode 100644 tests/run-make/simple-rlib/foo.rs create mode 100644 tests/run-make/split-debuginfo/Makefile create mode 100644 tests/run-make/split-debuginfo/bar.rs create mode 100644 tests/run-make/split-debuginfo/baz.rs create mode 100644 tests/run-make/split-debuginfo/foo.rs create mode 100644 tests/run-make/split-debuginfo/main.rs create mode 100644 tests/run-make/stable-symbol-names/Makefile create mode 100644 tests/run-make/stable-symbol-names/stable-symbol-names1.rs create mode 100644 tests/run-make/stable-symbol-names/stable-symbol-names2.rs create mode 100644 tests/run-make/static-dylib-by-default/Makefile create mode 100644 tests/run-make/static-dylib-by-default/bar.rs create mode 100644 tests/run-make/static-dylib-by-default/foo.rs create mode 100644 tests/run-make/static-dylib-by-default/main.c create mode 100644 tests/run-make/static-extern-type/Makefile create mode 100644 tests/run-make/static-extern-type/define-foo.c create mode 100644 tests/run-make/static-extern-type/use-foo.rs create mode 100644 tests/run-make/static-unwinding/Makefile create mode 100644 tests/run-make/static-unwinding/lib.rs create mode 100644 tests/run-make/static-unwinding/main.rs create mode 100644 tests/run-make/staticlib-blank-lib/Makefile create mode 100644 tests/run-make/staticlib-blank-lib/foo.rs create mode 100644 tests/run-make/std-core-cycle/Makefile create mode 100644 tests/run-make/std-core-cycle/bar.rs create mode 100644 tests/run-make/std-core-cycle/foo.rs create mode 100644 tests/run-make/stdin-non-utf8/Makefile create mode 100644 tests/run-make/stdin-non-utf8/non-utf8 create mode 100644 tests/run-make/suspicious-library/Makefile create mode 100644 tests/run-make/suspicious-library/bar.rs create mode 100644 tests/run-make/suspicious-library/foo.rs create mode 100644 tests/run-make/symbol-visibility/Makefile create mode 100644 tests/run-make/symbol-visibility/a_cdylib.rs create mode 100644 tests/run-make/symbol-visibility/a_proc_macro.rs create mode 100644 tests/run-make/symbol-visibility/a_rust_dylib.rs create mode 100644 tests/run-make/symbol-visibility/an_executable.rs create mode 100644 tests/run-make/symbol-visibility/an_rlib.rs create mode 100644 tests/run-make/symbols-include-type-name/Makefile create mode 100644 tests/run-make/symbols-include-type-name/lib.rs create mode 100644 tests/run-make/symlinked-extern/Makefile create mode 100644 tests/run-make/symlinked-extern/bar.rs create mode 100644 tests/run-make/symlinked-extern/baz.rs create mode 100644 tests/run-make/symlinked-extern/foo.rs create mode 100644 tests/run-make/symlinked-libraries/Makefile create mode 100644 tests/run-make/symlinked-libraries/bar.rs create mode 100644 tests/run-make/symlinked-libraries/foo.rs create mode 100644 tests/run-make/symlinked-rlib/Makefile create mode 100644 tests/run-make/symlinked-rlib/bar.rs create mode 100644 tests/run-make/symlinked-rlib/foo.rs create mode 100644 tests/run-make/sysroot-crates-are-unstable/Makefile create mode 100644 tests/run-make/sysroot-crates-are-unstable/test.py create mode 100644 tests/run-make/target-cpu-native/Makefile create mode 100644 tests/run-make/target-cpu-native/foo.rs create mode 100644 tests/run-make/target-specs/Makefile create mode 100644 tests/run-make/target-specs/definitely-not-builtin-target.json create mode 100644 tests/run-make/target-specs/foo.rs create mode 100644 tests/run-make/target-specs/mismatching-data-layout.json create mode 100644 tests/run-make/target-specs/my-awesome-platform.json create mode 100644 tests/run-make/target-specs/my-incomplete-platform.json create mode 100644 tests/run-make/target-specs/my-invalid-platform.json create mode 100644 tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json create mode 100644 tests/run-make/target-without-atomic-cas/Makefile create mode 100644 tests/run-make/test-harness/Makefile create mode 100644 tests/run-make/test-harness/test-ignore-cfg.rs create mode 100644 tests/run-make/tools.mk create mode 100644 tests/run-make/type-mismatch-same-crate-name/Makefile create mode 100644 tests/run-make/type-mismatch-same-crate-name/crateA.rs create mode 100644 tests/run-make/type-mismatch-same-crate-name/crateB.rs create mode 100644 tests/run-make/type-mismatch-same-crate-name/crateC.rs create mode 100644 tests/run-make/use-extern-for-plugins/Makefile create mode 100644 tests/run-make/use-extern-for-plugins/bar.rs create mode 100644 tests/run-make/use-extern-for-plugins/baz.rs create mode 100644 tests/run-make/use-extern-for-plugins/foo.rs create mode 100644 tests/run-make/use-suggestions-rust-2018/Makefile create mode 100644 tests/run-make/use-suggestions-rust-2018/ep-nested-lib.rs create mode 100644 tests/run-make/use-suggestions-rust-2018/use-suggestions.rs create mode 100644 tests/run-make/used-cdylib-macos/Makefile create mode 100644 tests/run-make/used-cdylib-macos/dylib_used.rs create mode 100644 tests/run-make/used/Makefile create mode 100644 tests/run-make/used/used.rs create mode 100644 tests/run-make/version/Makefile create mode 100644 tests/run-make/volatile-intrinsics/Makefile create mode 100644 tests/run-make/volatile-intrinsics/main.rs create mode 100644 tests/run-make/weird-output-filenames/Makefile create mode 100644 tests/run-make/weird-output-filenames/foo.rs create mode 100644 tests/run-make/windows-binary-no-external-deps/Makefile create mode 100644 tests/run-make/windows-binary-no-external-deps/hello.rs create mode 100644 tests/run-make/windows-spawn/Makefile create mode 100644 tests/run-make/windows-spawn/hello.rs create mode 100644 tests/run-make/windows-spawn/spawn.rs create mode 100644 tests/run-make/windows-subsystem/Makefile create mode 100644 tests/run-make/windows-subsystem/console.rs create mode 100644 tests/run-make/windows-subsystem/windows.rs delete mode 100644 tests/rustdoc-gui/auto-hide-trait-implementations.goml create mode 100644 tests/rustdoc-gui/extend-css.goml create mode 100644 tests/rustdoc-gui/go-to-collapsed-elem.goml create mode 100644 tests/rustdoc-gui/setting-auto-hide-content-large-items.goml create mode 100644 tests/rustdoc-gui/setting-auto-hide-item-methods-docs.goml create mode 100644 tests/rustdoc-gui/setting-auto-hide-trait-implementations.goml create mode 100644 tests/rustdoc-gui/setting-go-to-only-result.goml create mode 100644 tests/rustdoc-gui/source-code-page-code-scroll.goml create mode 100644 tests/rustdoc-gui/src/extend_css/Cargo.lock create mode 100644 tests/rustdoc-gui/src/extend_css/Cargo.toml create mode 100644 tests/rustdoc-gui/src/extend_css/extra.css create mode 100644 tests/rustdoc-gui/src/extend_css/lib.rs create mode 100644 tests/rustdoc-gui/theme-defaults.goml create mode 100644 tests/rustdoc-js-std/option-type-signatures.js create mode 100644 tests/rustdoc-js-std/println-typo.js create mode 100644 tests/rustdoc-js/generics-nested.js create mode 100644 tests/rustdoc-js/generics-nested.rs create mode 100644 tests/rustdoc-js/search-bag-semantics.js create mode 100644 tests/rustdoc-js/search-bag-semantics.rs create mode 100644 tests/rustdoc-js/where-clause.js create mode 100644 tests/rustdoc-js/where-clause.rs create mode 100644 tests/rustdoc-json/fns/extern_c_variadic.rs create mode 100644 tests/rustdoc-json/non_lifetime_binders.rs delete mode 100644 tests/rustdoc-ui/c-help.rs delete mode 100644 tests/rustdoc-ui/c-help.stdout create mode 100644 tests/rustdoc-ui/const_arg_in_type_position.rs create mode 100644 tests/rustdoc-ui/const_arg_in_type_position.stderr create mode 100644 tests/rustdoc-ui/crate-reference-in-block-module.rs create mode 100644 tests/rustdoc-ui/crate-reference-in-block-module.stderr create mode 100644 tests/rustdoc-ui/intra-doc/auxiliary/inner-crate-doc.rs create mode 100644 tests/rustdoc-ui/intra-doc/auxiliary/inner-crate-enum.rs create mode 100644 tests/rustdoc-ui/intra-doc/import-inline-merge-module.rs create mode 100644 tests/rustdoc-ui/intra-doc/inline-external-enum.rs create mode 100644 tests/rustdoc-ui/intra-doc/issue-108653-associated-items-10.rs create mode 100644 tests/rustdoc-ui/intra-doc/issue-108653-associated-items-2.rs create mode 100644 tests/rustdoc-ui/intra-doc/issue-108653-associated-items-2.stderr create mode 100644 tests/rustdoc-ui/intra-doc/issue-108653-associated-items-3.rs create mode 100644 tests/rustdoc-ui/intra-doc/issue-108653-associated-items-3.stderr create mode 100644 tests/rustdoc-ui/intra-doc/issue-108653-associated-items-4.rs create mode 100644 tests/rustdoc-ui/intra-doc/issue-108653-associated-items-4.stderr create mode 100644 tests/rustdoc-ui/intra-doc/issue-108653-associated-items-5.rs create mode 100644 tests/rustdoc-ui/intra-doc/issue-108653-associated-items-5.stderr create mode 100644 tests/rustdoc-ui/intra-doc/issue-108653-associated-items-6.rs create mode 100644 tests/rustdoc-ui/intra-doc/issue-108653-associated-items-6.stderr create mode 100644 tests/rustdoc-ui/intra-doc/issue-108653-associated-items-7.rs create mode 100644 tests/rustdoc-ui/intra-doc/issue-108653-associated-items-7.stderr create mode 100644 tests/rustdoc-ui/intra-doc/issue-108653-associated-items-8.rs create mode 100644 tests/rustdoc-ui/intra-doc/issue-108653-associated-items-8.stderr create mode 100644 tests/rustdoc-ui/intra-doc/issue-108653-associated-items-9.rs create mode 100644 tests/rustdoc-ui/intra-doc/issue-108653-associated-items.rs create mode 100644 tests/rustdoc-ui/intra-doc/issue-108653-associated-items.stderr create mode 100644 tests/rustdoc-ui/intra-doc/reachable-non-exported.rs create mode 100644 tests/rustdoc-ui/invalid_associated_const.rs create mode 100644 tests/rustdoc-ui/invalid_associated_const.stderr create mode 100644 tests/rustdoc-ui/invalid_const_in_lifetime_position.rs create mode 100644 tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr create mode 100644 tests/rustdoc-ui/invalid_infered_static_and_const.rs create mode 100644 tests/rustdoc-ui/invalid_infered_static_and_const.stderr create mode 100644 tests/rustdoc-ui/issue-109282-import-inline-merge.rs create mode 100644 tests/rustdoc-ui/mismatched_arg_count.rs create mode 100644 tests/rustdoc-ui/mismatched_arg_count.stderr delete mode 100644 tests/rustdoc-ui/z-help.rs delete mode 100644 tests/rustdoc-ui/z-help.stdout create mode 100644 tests/rustdoc/compiler-derive-proc-macro.rs delete mode 100644 tests/rustdoc/doc-notable_trait-mut_t_is_not_an_iterator.rs delete mode 100644 tests/rustdoc/doc-notable_trait-mut_t_is_not_ref_t.rs delete mode 100644 tests/rustdoc/doc-notable_trait-slice.bare_fn_matches.html delete mode 100644 tests/rustdoc/doc-notable_trait-slice.rs delete mode 100644 tests/rustdoc/doc-notable_trait.bare-fn.html delete mode 100644 tests/rustdoc/doc-notable_trait.rs delete mode 100644 tests/rustdoc/doc-notable_trait.some-struct-new.html delete mode 100644 tests/rustdoc/doc-notable_trait.wrap-me.html delete mode 100644 tests/rustdoc/doc-notable_trait_box_is_not_an_iterator.rs create mode 100644 tests/rustdoc/footnote-in-summary.rs create mode 100644 tests/rustdoc/generic-associated-types/issue-109488.rs create mode 100644 tests/rustdoc/issue-108679-reexport-of-reexport.rs create mode 100644 tests/rustdoc/issue-108925.rs create mode 100644 tests/rustdoc/issue-108931-anonymous-reexport.rs create mode 100644 tests/rustdoc/issue-109258-missing-private-inlining.rs create mode 100644 tests/rustdoc/issue-109695-crate-doc-hidden.rs create mode 100644 tests/rustdoc/non_lifetime_binders.rs create mode 100644 tests/rustdoc/notable-trait/doc-notable_trait-mut_t_is_not_an_iterator.rs create mode 100644 tests/rustdoc/notable-trait/doc-notable_trait-mut_t_is_not_ref_t.rs create mode 100644 tests/rustdoc/notable-trait/doc-notable_trait-slice.bare_fn_matches.html create mode 100644 tests/rustdoc/notable-trait/doc-notable_trait-slice.rs create mode 100644 tests/rustdoc/notable-trait/doc-notable_trait.bare-fn.html create mode 100644 tests/rustdoc/notable-trait/doc-notable_trait.rs create mode 100644 tests/rustdoc/notable-trait/doc-notable_trait.some-struct-new.html create mode 100644 tests/rustdoc/notable-trait/doc-notable_trait.wrap-me.html create mode 100644 tests/rustdoc/notable-trait/doc-notable_trait_box_is_not_an_iterator.rs create mode 100644 tests/rustdoc/notable-trait/notable-trait-generics.rs create mode 100644 tests/rustdoc/notable-trait/spotlight-from-dependency.odd.html create mode 100644 tests/rustdoc/notable-trait/spotlight-from-dependency.rs delete mode 100644 tests/rustdoc/primitive.rs create mode 100644 tests/rustdoc/primitive/primitive.rs delete mode 100644 tests/rustdoc/spotlight-from-dependency.odd.html delete mode 100644 tests/rustdoc/spotlight-from-dependency.rs delete mode 100644 tests/ui-fulldeps/auxiliary/issue-13560-1.rs delete mode 100644 tests/ui-fulldeps/auxiliary/issue-13560-2.rs delete mode 100644 tests/ui-fulldeps/auxiliary/issue-13560-3.rs delete mode 100644 tests/ui-fulldeps/auxiliary/issue-16822.rs delete mode 100644 tests/ui-fulldeps/auxiliary/issue-18502.rs delete mode 100644 tests/ui-fulldeps/auxiliary/issue-24106.rs delete mode 100644 tests/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs delete mode 100644 tests/ui-fulldeps/extern-mod-syntax.rs create mode 100644 tests/ui-fulldeps/fluent-messages/invalid-escape.ftl delete mode 100644 tests/ui-fulldeps/internal-lints/diagnostics_incorrect.rs delete mode 100644 tests/ui-fulldeps/internal-lints/diagnostics_incorrect.stderr delete mode 100644 tests/ui-fulldeps/internal-lints/existing_doc_keyword.rs delete mode 100644 tests/ui-fulldeps/internal-lints/existing_doc_keyword.stderr delete mode 100644 tests/ui-fulldeps/internal-lints/query_stability_incorrect.rs delete mode 100644 tests/ui-fulldeps/internal-lints/query_stability_incorrect.stderr delete mode 100644 tests/ui-fulldeps/internal-lints/rustc_pass_by_value_self.rs delete mode 100644 tests/ui-fulldeps/internal-lints/rustc_pass_by_value_self.stderr delete mode 100644 tests/ui-fulldeps/issue-11881.rs delete mode 100644 tests/ui-fulldeps/issue-13560.rs delete mode 100644 tests/ui-fulldeps/issue-15924.rs delete mode 100644 tests/ui-fulldeps/issue-16822.rs delete mode 100644 tests/ui-fulldeps/issue-18502.rs delete mode 100644 tests/ui-fulldeps/issue-24106.rs delete mode 100644 tests/ui-fulldeps/issue-2804.rs delete mode 100644 tests/ui-fulldeps/myriad-closures.rs create mode 100644 tests/ui-fulldeps/stable-mir/crate-info.rs delete mode 100644 tests/ui-fulldeps/std/issue-15149.rs delete mode 100644 tests/ui-fulldeps/std/issue-81357-unsound-file-methods.rs delete mode 100644 tests/ui-fulldeps/std/stdio-from.rs delete mode 100644 tests/ui-fulldeps/std/switch-stdout.rs delete mode 100644 tests/ui-toml/array_size_threshold/array_size_threshold.rs delete mode 100644 tests/ui-toml/array_size_threshold/array_size_threshold.stderr delete mode 100644 tests/ui-toml/array_size_threshold/clippy.toml create mode 100644 tests/ui/argument-suggestions/issue-109425.fixed create mode 100644 tests/ui/argument-suggestions/issue-109425.rs create mode 100644 tests/ui/argument-suggestions/issue-109425.stderr create mode 100644 tests/ui/argument-suggestions/issue-109831.rs create mode 100644 tests/ui/argument-suggestions/issue-109831.stderr create mode 100644 tests/ui/associated-inherent-types/issue-109299-1.rs create mode 100644 tests/ui/associated-inherent-types/issue-109299-1.stderr create mode 100644 tests/ui/associated-inherent-types/issue-109299.rs create mode 100644 tests/ui/associated-inherent-types/issue-109299.stderr create mode 100644 tests/ui/associated-type-bounds/issue-104916.rs create mode 100644 tests/ui/associated-type-bounds/issue-104916.stderr create mode 100644 tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs create mode 100644 tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr create mode 100644 tests/ui/associated-type-bounds/return-type-notation/basic.rs create mode 100644 tests/ui/associated-type-bounds/return-type-notation/basic.with.stderr create mode 100644 tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr create mode 100644 tests/ui/associated-type-bounds/return-type-notation/equality.rs create mode 100644 tests/ui/associated-type-bounds/return-type-notation/equality.stderr create mode 100644 tests/ui/associated-type-bounds/return-type-notation/missing.rs create mode 100644 tests/ui/associated-type-bounds/return-type-notation/missing.stderr create mode 100644 tests/ui/associated-type-bounds/return-type-notation/non-rpitit.rs create mode 100644 tests/ui/associated-type-bounds/return-type-notation/non-rpitit.stderr create mode 100644 tests/ui/associated-type-bounds/return-type-notation/unpretty-parenthesized.rs create mode 100644 tests/ui/associated-type-bounds/return-type-notation/unpretty-parenthesized.stderr create mode 100644 tests/ui/associated-type-bounds/return-type-notation/unpretty-parenthesized.stdout create mode 100644 tests/ui/async-await/async-trait-fn.current.stderr create mode 100644 tests/ui/async-await/async-trait-fn.next.stderr create mode 100644 tests/ui/async-await/edition-deny-async-fns-2015.current.stderr create mode 100644 tests/ui/async-await/edition-deny-async-fns-2015.next.stderr delete mode 100644 tests/ui/async-await/edition-deny-async-fns-2015.stderr create mode 100644 tests/ui/async-await/in-trait/async-default-fn-overridden.current.stderr create mode 100644 tests/ui/async-await/in-trait/async-default-fn-overridden.next.stderr delete mode 100644 tests/ui/async-await/in-trait/async-default-fn-overridden.stderr create mode 100644 tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.current.stderr create mode 100644 tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.next.stderr delete mode 100644 tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr create mode 100644 tests/ui/async-await/in-trait/async-example-desugared-boxed.current.stderr create mode 100644 tests/ui/async-await/in-trait/async-example-desugared-boxed.next.stderr delete mode 100644 tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr create mode 100644 tests/ui/async-await/in-trait/async-example-desugared-manual.current.stderr create mode 100644 tests/ui/async-await/in-trait/async-example-desugared-manual.next.stderr delete mode 100644 tests/ui/async-await/in-trait/async-example-desugared-manual.stderr create mode 100644 tests/ui/async-await/in-trait/async-generics-and-bounds.current.stderr create mode 100644 tests/ui/async-await/in-trait/async-generics-and-bounds.next.stderr delete mode 100644 tests/ui/async-await/in-trait/async-generics-and-bounds.stderr create mode 100644 tests/ui/async-await/in-trait/async-generics.current.stderr create mode 100644 tests/ui/async-await/in-trait/async-generics.next.stderr delete mode 100644 tests/ui/async-await/in-trait/async-generics.stderr create mode 100644 tests/ui/async-await/in-trait/async-recursive-generic.current.stderr create mode 100644 tests/ui/async-await/in-trait/async-recursive-generic.next.stderr delete mode 100644 tests/ui/async-await/in-trait/async-recursive-generic.stderr create mode 100644 tests/ui/async-await/in-trait/async-recursive.current.stderr create mode 100644 tests/ui/async-await/in-trait/async-recursive.next.stderr delete mode 100644 tests/ui/async-await/in-trait/async-recursive.stderr create mode 100644 tests/ui/async-await/in-trait/bad-signatures.current.stderr create mode 100644 tests/ui/async-await/in-trait/bad-signatures.next.stderr delete mode 100644 tests/ui/async-await/in-trait/bad-signatures.stderr create mode 100644 tests/ui/async-await/in-trait/dont-project-to-specializable-projection.current.stderr create mode 100644 tests/ui/async-await/in-trait/dont-project-to-specializable-projection.next.stderr delete mode 100644 tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr create mode 100644 tests/ui/async-await/in-trait/fn-not-async-err2.current.stderr create mode 100644 tests/ui/async-await/in-trait/fn-not-async-err2.next.stderr delete mode 100644 tests/ui/async-await/in-trait/fn-not-async-err2.stderr create mode 100644 tests/ui/async-await/in-trait/generics-mismatch.current.stderr create mode 100644 tests/ui/async-await/in-trait/generics-mismatch.next.stderr create mode 100644 tests/ui/async-await/in-trait/generics-mismatch.rs create mode 100644 tests/ui/async-await/in-trait/generics-mismatch.stderr create mode 100644 tests/ui/async-await/in-trait/lifetime-mismatch.current.stderr create mode 100644 tests/ui/async-await/in-trait/lifetime-mismatch.next.stderr delete mode 100644 tests/ui/async-await/in-trait/lifetime-mismatch.stderr create mode 100644 tests/ui/async-await/in-trait/missing-send-bound.current.stderr create mode 100644 tests/ui/async-await/in-trait/missing-send-bound.next.stderr delete mode 100644 tests/ui/async-await/in-trait/missing-send-bound.stderr create mode 100644 tests/ui/async-await/in-trait/object-safety.current.stderr create mode 100644 tests/ui/async-await/in-trait/object-safety.next.stderr delete mode 100644 tests/ui/async-await/in-trait/object-safety.stderr create mode 100644 tests/ui/async-await/in-trait/return-type-suggestion.current.stderr create mode 100644 tests/ui/async-await/in-trait/return-type-suggestion.next.stderr delete mode 100644 tests/ui/async-await/in-trait/return-type-suggestion.stderr create mode 100644 tests/ui/async-await/issue-108572.rs create mode 100644 tests/ui/async-await/issue-108572.stderr create mode 100644 tests/ui/async-await/missed-capture-issue-107414.rs create mode 100644 tests/ui/async-await/task-context-arg.rs create mode 100644 tests/ui/attributes/no-mangle-closure.rs create mode 100644 tests/ui/attributes/no-mangle-closure.stderr create mode 100644 tests/ui/auto-traits/suspicious-negative-impls-lint.rs create mode 100644 tests/ui/auto-traits/suspicious-negative-impls-lint.stderr delete mode 100644 tests/ui/autoref-autoderef/issue-38940.rs delete mode 100644 tests/ui/autoref-autoderef/issue-38940.stderr create mode 100644 tests/ui/auxiliary/issue-13560-1.rs create mode 100644 tests/ui/auxiliary/issue-13560-2.rs create mode 100644 tests/ui/auxiliary/issue-13560-3.rs create mode 100644 tests/ui/auxiliary/issue-16822.rs create mode 100644 tests/ui/auxiliary/issue-18502.rs create mode 100644 tests/ui/auxiliary/issue-24106.rs delete mode 100644 tests/ui/auxiliary/xc-private-method-lib.rs create mode 100644 tests/ui/borrowck/drop-in-loop.rs create mode 100644 tests/ui/borrowck/drop-in-loop.stderr create mode 100644 tests/ui/borrowck/issue-70919-drop-in-loop.rs create mode 100644 tests/ui/borrowck/let_underscore_temporary.rs create mode 100644 tests/ui/box/unit/expr-block-generic-unique1.rs create mode 100644 tests/ui/box/unit/expr-block-generic-unique2.rs create mode 100644 tests/ui/box/unit/expr-if-unique.rs create mode 100644 tests/ui/box/unit/unique-assign-copy.rs create mode 100644 tests/ui/box/unit/unique-assign-drop.rs create mode 100644 tests/ui/box/unit/unique-assign-generic.rs create mode 100644 tests/ui/box/unit/unique-assign.rs create mode 100644 tests/ui/box/unit/unique-autoderef-field.rs create mode 100644 tests/ui/box/unit/unique-autoderef-index.rs create mode 100644 tests/ui/box/unit/unique-cmp.rs create mode 100644 tests/ui/box/unit/unique-containing-tag.rs create mode 100644 tests/ui/box/unit/unique-create.rs create mode 100644 tests/ui/box/unit/unique-decl-init-copy.rs create mode 100644 tests/ui/box/unit/unique-decl-init.rs create mode 100644 tests/ui/box/unit/unique-decl-move.rs create mode 100644 tests/ui/box/unit/unique-decl.rs create mode 100644 tests/ui/box/unit/unique-deref.rs create mode 100644 tests/ui/box/unit/unique-destructure.rs create mode 100644 tests/ui/box/unit/unique-drop-complex.rs create mode 100644 tests/ui/box/unit/unique-ffi-symbols.rs create mode 100644 tests/ui/box/unit/unique-fn-arg-move.rs create mode 100644 tests/ui/box/unit/unique-fn-arg-mut.rs create mode 100644 tests/ui/box/unit/unique-fn-arg.rs create mode 100644 tests/ui/box/unit/unique-fn-ret.rs create mode 100644 tests/ui/box/unit/unique-generic-assign.rs create mode 100644 tests/ui/box/unit/unique-in-tag.rs create mode 100644 tests/ui/box/unit/unique-in-vec-copy.rs create mode 100644 tests/ui/box/unit/unique-in-vec.rs create mode 100644 tests/ui/box/unit/unique-init.rs create mode 100644 tests/ui/box/unit/unique-kinds.rs create mode 100644 tests/ui/box/unit/unique-log.rs create mode 100644 tests/ui/box/unit/unique-match-discrim.rs create mode 100644 tests/ui/box/unit/unique-move-drop.rs create mode 100644 tests/ui/box/unit/unique-move-temp.rs create mode 100644 tests/ui/box/unit/unique-move.rs create mode 100644 tests/ui/box/unit/unique-mutable.rs create mode 100644 tests/ui/box/unit/unique-object-move.rs create mode 100644 tests/ui/box/unit/unique-object-noncopyable.rs create mode 100644 tests/ui/box/unit/unique-object-noncopyable.stderr create mode 100644 tests/ui/box/unit/unique-pat-2.rs create mode 100644 tests/ui/box/unit/unique-pat-3.rs create mode 100644 tests/ui/box/unit/unique-pat.rs create mode 100644 tests/ui/box/unit/unique-pinned-nocopy.rs create mode 100644 tests/ui/box/unit/unique-pinned-nocopy.stderr create mode 100644 tests/ui/box/unit/unique-rec.rs create mode 100644 tests/ui/box/unit/unique-send-2.rs create mode 100644 tests/ui/box/unit/unique-send.rs create mode 100644 tests/ui/box/unit/unique-swap.rs create mode 100644 tests/ui/box/unit/unwind-unique.rs create mode 100644 tests/ui/cfg/auxiliary/cfg_false_lib.rs create mode 100644 tests/ui/cfg/cfg-false-feature.rs create mode 100644 tests/ui/cfg/cfg-false-feature.stderr create mode 100644 tests/ui/cfg/cfg_false_no_std.rs create mode 100644 tests/ui/check-cfg/my-awesome-platform.json create mode 100644 tests/ui/check-cfg/values-target-json.rs create mode 100644 tests/ui/check-cfg/values-target-json.stderr create mode 100644 tests/ui/closures/2229_closure_analysis/array_subslice.rs create mode 100644 tests/ui/closures/2229_closure_analysis/array_subslice.stderr create mode 100644 tests/ui/closures/2229_closure_analysis/unique-borrows-are-invariant-1.rs create mode 100644 tests/ui/closures/2229_closure_analysis/unique-borrows-are-invariant-1.stderr create mode 100644 tests/ui/closures/2229_closure_analysis/unique-borrows-are-invariant-2.rs create mode 100644 tests/ui/closures/2229_closure_analysis/unique-borrows-are-invariant-2.stderr create mode 100644 tests/ui/closures/issue-109188.rs create mode 100644 tests/ui/closures/issue-109188.stderr create mode 100644 tests/ui/closures/self-supertrait-bounds.rs create mode 100644 tests/ui/codegen/mono-impossible-2.rs create mode 100644 tests/ui/codegen/mono-impossible.rs create mode 100644 tests/ui/coherence/illegal-copy-bad-projection.rs create mode 100644 tests/ui/coherence/illegal-copy-bad-projection.stderr create mode 100644 tests/ui/const-generics/bad-generic-in-copy-impl.rs create mode 100644 tests/ui/const-generics/bad-generic-in-copy-impl.stderr create mode 100644 tests/ui/const-generics/bad-subst-const-kind.rs create mode 100644 tests/ui/const-generics/bad-subst-const-kind.stderr create mode 100644 tests/ui/const-generics/generic_const_exprs/mismatched-gat-subst-kind.rs create mode 100644 tests/ui/const-generics/generic_const_exprs/mismatched-gat-subst-kind.stderr create mode 100644 tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.rs create mode 100644 tests/ui/const-generics/transmute-fail.rs create mode 100644 tests/ui/const-generics/transmute-fail.stderr create mode 100644 tests/ui/const-generics/transmute.rs create mode 100644 tests/ui/const-generics/transmute_no_gate.rs create mode 100644 tests/ui/const-generics/transmute_no_gate.stderr create mode 100644 tests/ui/const_prop/issue-86351.rs create mode 100644 tests/ui/const_prop/unreachable-bounds.rs create mode 100644 tests/ui/const_prop/unreachable-overflow.rs create mode 100644 tests/ui/consts/const-eval/transmute-size-mismatch.rs create mode 100644 tests/ui/consts/const-eval/transmute-size-mismatch.stderr create mode 100644 tests/ui/consts/const-eval/ub-slice-get-unchecked.rs create mode 100644 tests/ui/consts/const-eval/ub-slice-get-unchecked.stderr create mode 100644 tests/ui/consts/issue-64506.stderr create mode 100644 tests/ui/diagnostic-width/auxiliary/tab_column_numbers.rs create mode 100644 tests/ui/diagnostic-width/tab-column-numbers.rs create mode 100644 tests/ui/diagnostic-width/tab-column-numbers.stderr delete mode 100644 tests/ui/disambiguate-identical-names.rs delete mode 100644 tests/ui/disambiguate-identical-names.stderr create mode 100644 tests/ui/dst/issue-90528-unsizing-suggestion-1.rs create mode 100644 tests/ui/dst/issue-90528-unsizing-suggestion-1.stderr create mode 100644 tests/ui/dst/issue-90528-unsizing-suggestion-2.rs create mode 100644 tests/ui/dst/issue-90528-unsizing-suggestion-2.stderr create mode 100644 tests/ui/dst/issue-90528-unsizing-suggestion-3.rs create mode 100644 tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr create mode 100644 tests/ui/dst/issue-90528-unsizing-suggestion-4.rs create mode 100644 tests/ui/dst/issue-90528-unsizing-suggestion-4.stderr create mode 100644 tests/ui/dyn-star/const-and-static.rs create mode 100644 tests/ui/dyn-star/const-and-static.stderr create mode 100644 tests/ui/dyn-star/gated-span.rs create mode 100644 tests/ui/dyn-star/gated-span.stderr create mode 100644 tests/ui/enum-discriminant/auxiliary/discr-foreign-dep.rs create mode 100644 tests/ui/enum-discriminant/discr-foreign.rs create mode 100644 tests/ui/enum-discriminant/issue-61696.rs delete mode 100644 tests/ui/expr-block-generic-unique1.rs delete mode 100644 tests/ui/expr-block-generic-unique2.rs delete mode 100644 tests/ui/expr-if-unique.rs create mode 100644 tests/ui/extern-mod-syntax.rs delete mode 100644 tests/ui/feature-gates/feature-gate-box-expr.rs delete mode 100644 tests/ui/feature-gates/feature-gate-box-expr.stderr delete mode 100644 tests/ui/feature-gates/feature-gate-box_syntax.rs delete mode 100644 tests/ui/feature-gates/feature-gate-box_syntax.stderr create mode 100644 tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.rs create mode 100644 tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.stderr create mode 100644 tests/ui/feature-gates/feature-gate-return_type_notation.cfg.stderr create mode 100644 tests/ui/feature-gates/feature-gate-return_type_notation.no.stderr create mode 100644 tests/ui/feature-gates/feature-gate-return_type_notation.rs create mode 100644 tests/ui/feature-gates/test-listing-format-json.rs create mode 100644 tests/ui/feature-gates/test-listing-format-json.run.stderr create mode 100644 tests/ui/fmt/format-args-argument-span.rs create mode 100644 tests/ui/fmt/format-args-argument-span.stderr create mode 100644 tests/ui/fmt/format-args-capture-first-literal-is-macro.rs create mode 100644 tests/ui/fmt/format-args-capture-first-literal-is-macro.stderr create mode 100644 tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.rs create mode 100644 tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.stderr create mode 100644 tests/ui/fmt/format-args-capture-issue-106408.rs create mode 100644 tests/ui/fmt/format-args-capture-macro-hygiene-pass.rs create mode 100644 tests/ui/fn/fn-ptr-trait-int-float-infer-var.rs create mode 100644 tests/ui/fn/fn-ptr-trait.rs create mode 100644 tests/ui/fn/issue-39259.rs create mode 100644 tests/ui/fn/issue-39259.stderr delete mode 100644 tests/ui/foreign-unsafe-fn-called.mir.stderr delete mode 100644 tests/ui/foreign-unsafe-fn-called.rs delete mode 100644 tests/ui/foreign-unsafe-fn-called.thir.stderr create mode 100644 tests/ui/generator/static-not-unpin.current.stderr create mode 100644 tests/ui/generator/static-not-unpin.next.stderr delete mode 100644 tests/ui/generator/static-not-unpin.stderr delete mode 100644 tests/ui/generator/yield-in-box.rs delete mode 100644 tests/ui/generator/yield-in-box.stderr create mode 100644 tests/ui/generic-associated-types/gat-bounds-normalize-pred.rs create mode 100644 tests/ui/generics/auxiliary/foreign-generic-mismatch.rs create mode 100644 tests/ui/generics/foreign-generic-mismatch.rs create mode 100644 tests/ui/generics/foreign-generic-mismatch.stderr create mode 100644 tests/ui/generics/slightly-nice-generic-literal-messages.rs create mode 100644 tests/ui/generics/slightly-nice-generic-literal-messages.stderr create mode 100644 tests/ui/higher-rank-trait-bounds/fn-ptr.classic.stderr create mode 100644 tests/ui/higher-rank-trait-bounds/fn-ptr.rs create mode 100644 tests/ui/higher-rank-trait-bounds/issue-95230.new.stderr create mode 100644 tests/ui/impl-trait/in-trait/box-coerce-span-in-default.current.stderr create mode 100644 tests/ui/impl-trait/in-trait/box-coerce-span-in-default.next.stderr delete mode 100644 tests/ui/impl-trait/in-trait/box-coerce-span-in-default.stderr create mode 100644 tests/ui/impl-trait/in-trait/deep-match.current.stderr create mode 100644 tests/ui/impl-trait/in-trait/deep-match.next.stderr delete mode 100644 tests/ui/impl-trait/in-trait/deep-match.stderr create mode 100644 tests/ui/impl-trait/in-trait/default-body-type-err-2.current.stderr create mode 100644 tests/ui/impl-trait/in-trait/default-body-type-err-2.next.stderr delete mode 100644 tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr create mode 100644 tests/ui/impl-trait/in-trait/default-body-type-err.current.stderr create mode 100644 tests/ui/impl-trait/in-trait/default-body-type-err.next.stderr delete mode 100644 tests/ui/impl-trait/in-trait/default-body-type-err.stderr create mode 100644 tests/ui/impl-trait/in-trait/default-body-with-rpit.current.stderr create mode 100644 tests/ui/impl-trait/in-trait/default-body-with-rpit.next.stderr create mode 100644 tests/ui/impl-trait/in-trait/default-method-binder-shifting.current.stderr create mode 100644 tests/ui/impl-trait/in-trait/default-method-binder-shifting.next.stderr create mode 100644 tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs create mode 100644 tests/ui/impl-trait/in-trait/default-method-constraint.current.stderr create mode 100644 tests/ui/impl-trait/in-trait/default-method-constraint.next.stderr delete mode 100644 tests/ui/impl-trait/in-trait/default-method-constraint.stderr create mode 100644 tests/ui/impl-trait/in-trait/doesnt-satisfy.current.stderr create mode 100644 tests/ui/impl-trait/in-trait/doesnt-satisfy.next.stderr delete mode 100644 tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr create mode 100644 tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.current.stderr create mode 100644 tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.next.stderr create mode 100644 tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs create mode 100644 tests/ui/impl-trait/in-trait/generics-mismatch.current.stderr create mode 100644 tests/ui/impl-trait/in-trait/generics-mismatch.next.stderr delete mode 100644 tests/ui/impl-trait/in-trait/generics-mismatch.stderr create mode 100644 tests/ui/impl-trait/in-trait/issue-102140.current.stderr create mode 100644 tests/ui/impl-trait/in-trait/issue-102140.next.stderr delete mode 100644 tests/ui/impl-trait/in-trait/issue-102140.stderr create mode 100644 tests/ui/impl-trait/in-trait/issue-102571.current.stderr create mode 100644 tests/ui/impl-trait/in-trait/issue-102571.next.stderr delete mode 100644 tests/ui/impl-trait/in-trait/issue-102571.stderr delete mode 100644 tests/ui/impl-trait/in-trait/new-lowering-strategy/simple-trait.rs create mode 100644 tests/ui/impl-trait/in-trait/object-safety.current.stderr create mode 100644 tests/ui/impl-trait/in-trait/object-safety.next.stderr delete mode 100644 tests/ui/impl-trait/in-trait/object-safety.stderr create mode 100644 tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.current.stderr create mode 100644 tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.next.stderr delete mode 100644 tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr create mode 100644 tests/ui/impl-trait/in-trait/signature-mismatch.current.stderr create mode 100644 tests/ui/impl-trait/in-trait/signature-mismatch.next.stderr delete mode 100644 tests/ui/impl-trait/in-trait/signature-mismatch.stderr create mode 100644 tests/ui/impl-trait/in-trait/specialization-broken.current.stderr create mode 100644 tests/ui/impl-trait/in-trait/specialization-broken.next.stderr delete mode 100644 tests/ui/impl-trait/in-trait/specialization-broken.stderr create mode 100644 tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.current.stderr create mode 100644 tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.next.stderr delete mode 100644 tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr create mode 100644 tests/ui/impl-trait/in-trait/wf-bounds.current.stderr create mode 100644 tests/ui/impl-trait/in-trait/wf-bounds.next.stderr delete mode 100644 tests/ui/impl-trait/in-trait/wf-bounds.stderr delete mode 100644 tests/ui/impl-trait/issue-55872-2.stderr delete mode 100644 tests/ui/impl-trait/multiple-lifetimes.rs create mode 100644 tests/ui/impl-trait/multiple-lifetimes/multiple-lifetimes.rs delete mode 100644 tests/ui/impl-trait/nested-return-type2.stderr delete mode 100644 tests/ui/impl-trait/nested-return-type3.stderr create mode 100644 tests/ui/implied-bounds/ice-unbound-region-vars.rs create mode 100644 tests/ui/implied-bounds/normalization-nested.lifetime.stderr create mode 100644 tests/ui/implied-bounds/normalization-nested.rs create mode 100644 tests/ui/implied-bounds/normalization.rs create mode 100644 tests/ui/inference/issue-80409.rs create mode 100644 tests/ui/inference/need_type_info/issue-109905.rs create mode 100644 tests/ui/inference/need_type_info/issue-109905.stderr create mode 100644 tests/ui/internal-lints/diagnostics_incorrect.rs create mode 100644 tests/ui/internal-lints/diagnostics_incorrect.stderr create mode 100644 tests/ui/internal-lints/existing_doc_keyword.rs create mode 100644 tests/ui/internal-lints/existing_doc_keyword.stderr create mode 100644 tests/ui/internal-lints/query_stability_incorrect.rs create mode 100644 tests/ui/internal-lints/query_stability_incorrect.stderr create mode 100644 tests/ui/internal-lints/rustc_pass_by_value_self.rs create mode 100644 tests/ui/internal-lints/rustc_pass_by_value_self.stderr create mode 100644 tests/ui/issue-11881.rs create mode 100644 tests/ui/issue-13560.rs create mode 100644 tests/ui/issue-15924.rs create mode 100644 tests/ui/issue-16822.rs create mode 100644 tests/ui/issue-18502.rs create mode 100644 tests/ui/issue-24106.rs create mode 100644 tests/ui/issue-2804.rs delete mode 100644 tests/ui/issues/issue-61696.rs delete mode 100644 tests/ui/lang-items/no_owned_box_lang_item.rs delete mode 100644 tests/ui/lang-items/no_owned_box_lang_item.stderr create mode 100644 tests/ui/late-bound-lifetimes/issue-80618.rs create mode 100644 tests/ui/late-bound-lifetimes/issue-80618.stderr create mode 100644 tests/ui/layout/transmute-to-tail-with-err.rs create mode 100644 tests/ui/layout/transmute-to-tail-with-err.stderr create mode 100644 tests/ui/lexer/unterminated-comment.rs create mode 100644 tests/ui/lexer/unterminated-comment.stderr create mode 100644 tests/ui/lexer/unterminated-nested-comment.rs create mode 100644 tests/ui/lexer/unterminated-nested-comment.stderr create mode 100644 tests/ui/lifetimes/issue-93911.rs create mode 100644 tests/ui/linkage-attr/issue-109144.rs create mode 100644 tests/ui/linkage-attr/issue-109144.stderr create mode 100644 tests/ui/lint/anonymous-reexport.rs create mode 100644 tests/ui/lint/anonymous-reexport.stderr create mode 100644 tests/ui/lint/dead-code/issue-59003.rs create mode 100644 tests/ui/lint/dead-code/unused-assoc-fns.rs create mode 100644 tests/ui/lint/dead-code/unused-assoc-fns.stderr create mode 100644 tests/ui/lint/issue-109152.rs create mode 100644 tests/ui/lint/issue-109152.stderr create mode 100644 tests/ui/lint/issue-109529.fixed create mode 100644 tests/ui/lint/issue-109529.rs create mode 100644 tests/ui/lint/issue-109529.stderr create mode 100644 tests/ui/lint/unconditional_panic_98444.rs create mode 100644 tests/ui/lint/unconditional_panic_98444.stderr create mode 100644 tests/ui/lint/unused/auxiliary/must-use-foreign.rs create mode 100644 tests/ui/lint/unused/must-use-foreign.rs create mode 100644 tests/ui/lint/unused/trait-alias-supertrait.rs create mode 100644 tests/ui/lint/unused/unused-allocation.rs create mode 100644 tests/ui/lint/unused/unused-allocation.stderr delete mode 100644 tests/ui/lint/use-redundant.rs delete mode 100644 tests/ui/lint/use-redundant.stderr create mode 100644 tests/ui/lint/use-redundant/issue-92904.rs create mode 100644 tests/ui/lint/use-redundant/use-redundant-glob-parent.rs create mode 100644 tests/ui/lint/use-redundant/use-redundant-glob-parent.stderr create mode 100644 tests/ui/lint/use-redundant/use-redundant-glob.rs create mode 100644 tests/ui/lint/use-redundant/use-redundant-glob.stderr create mode 100644 tests/ui/lint/use-redundant/use-redundant-multiple-namespaces.rs create mode 100644 tests/ui/lint/use-redundant/use-redundant-not-parent.rs create mode 100644 tests/ui/lint/use-redundant/use-redundant.rs create mode 100644 tests/ui/lint/use-redundant/use-redundant.stderr create mode 100644 tests/ui/macros/issue-106837.rs create mode 100644 tests/ui/macros/issue-106837.stderr create mode 100644 tests/ui/macros/issue-109237.rs create mode 100644 tests/ui/macros/issue-109237.stderr create mode 100644 tests/ui/macros/issue-98790.rs create mode 100644 tests/ui/macros/macro-path-prelude-fail-5.rs create mode 100644 tests/ui/macros/macro-path-prelude-fail-5.stderr create mode 100644 tests/ui/macros/missing-writer.rs create mode 100644 tests/ui/macros/missing-writer.stderr create mode 100644 tests/ui/macros/nested-use-as.rs create mode 100644 tests/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.stderr create mode 100644 tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.stderr create mode 100644 tests/ui/match/guards-parenthesized-and.rs create mode 100644 tests/ui/methods/inherent-bound-in-probe.rs create mode 100644 tests/ui/methods/inherent-bound-in-probe.stderr delete mode 100644 tests/ui/mir-unpretty.rs delete mode 100644 tests/ui/mir-unpretty.stderr create mode 100644 tests/ui/mir/addrof_alignment.rs create mode 100644 tests/ui/mir/checks_without_panic_impl.rs create mode 100644 tests/ui/mir/issue-109004-drop-large-array.rs create mode 100644 tests/ui/mir/mir_alignment_check.rs delete mode 100644 tests/ui/mir/mir_boxing.rs create mode 100644 tests/ui/mir/unsize-trait.rs create mode 100644 tests/ui/mir/validate/transmute_cast_sized.rs create mode 100644 tests/ui/missing/missing-items/missing-const-parameter.rs create mode 100644 tests/ui/missing/missing-items/missing-const-parameter.stderr create mode 100644 tests/ui/modules_and_files_visibility/mod_file_disambig_aux/compiletest-ignore-dir create mode 100644 tests/ui/myriad-closures.rs delete mode 100644 tests/ui/new-unsafe-pointers.rs create mode 100644 tests/ui/nll/user-annotations/region-error-ice-109072.rs create mode 100644 tests/ui/nll/user-annotations/region-error-ice-109072.stderr create mode 100644 tests/ui/non_modrs_mods_and_inline_mods/x/y/z/compiletest-ignore-dir delete mode 100644 tests/ui/output-type-mismatch.rs delete mode 100644 tests/ui/output-type-mismatch.stderr create mode 100644 tests/ui/parser/ident-recovery.rs create mode 100644 tests/ui/parser/ident-recovery.stderr create mode 100644 tests/ui/parser/integer-literal-start-ident.rs create mode 100644 tests/ui/parser/integer-literal-start-ident.stderr create mode 100644 tests/ui/parser/issues/issue-108242-semicolon-recovery.rs create mode 100644 tests/ui/parser/issues/issue-108242-semicolon-recovery.stderr create mode 100644 tests/ui/parser/issues/issue-110014.rs create mode 100644 tests/ui/parser/issues/issue-110014.stderr create mode 100644 tests/ui/parser/removed-syntax-box.fixed create mode 100644 tests/ui/parser/removed-syntax-box.rs create mode 100644 tests/ui/parser/removed-syntax-box.stderr create mode 100644 tests/ui/pattern/issue-106862.fixed create mode 100644 tests/ui/pattern/issue-106862.rs create mode 100644 tests/ui/pattern/issue-106862.stderr create mode 100644 tests/ui/privacy/auxiliary/xc-private-method-lib.rs create mode 100644 tests/ui/privacy/xc-private-method.rs create mode 100644 tests/ui/privacy/xc-private-method.stderr create mode 100644 tests/ui/privacy/xc-private-method2.rs create mode 100644 tests/ui/privacy/xc-private-method2.stderr create mode 100644 tests/ui/proc-macro/bad-projection.rs create mode 100644 tests/ui/proc-macro/bad-projection.stderr delete mode 100644 tests/ui/reachable-unnameable-type-alias.rs delete mode 100644 tests/ui/reachable/expr_box.rs delete mode 100644 tests/ui/reachable/expr_box.stderr create mode 100644 tests/ui/reachable/reachable-unnameable-type-alias.rs delete mode 100644 tests/ui/regions/issue-2718.rs create mode 100644 tests/ui/resolve/disambiguate-identical-names.rs create mode 100644 tests/ui/resolve/disambiguate-identical-names.stderr create mode 100644 tests/ui/resolve/issue-107563-ambiguous-glob-reexports.rs create mode 100644 tests/ui/resolve/issue-107563-ambiguous-glob-reexports.stderr create mode 100644 tests/ui/resolve/tool-import.rs create mode 100644 tests/ui/resolve/tool-import.stderr create mode 100644 tests/ui/rfc-1937-termination-trait/issue-103052-2.current.stderr create mode 100644 tests/ui/rfc-1937-termination-trait/issue-103052-2.next.stderr delete mode 100644 tests/ui/rfc-1937-termination-trait/issue-103052-2.stderr create mode 100644 tests/ui/rfc-2091-track-caller/mir-inlined-macro.rs create mode 100644 tests/ui/rfc-2632-const-trait-impl/const-drop-fail-2.precise.stderr create mode 100644 tests/ui/rfc-2632-const-trait-impl/const-drop-fail-2.rs create mode 100644 tests/ui/rfc-2632-const-trait-impl/const-drop-fail-2.stock.stderr create mode 100644 tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.rs create mode 100644 tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.stderr create mode 100644 tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.rs create mode 100644 tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr create mode 100644 tests/ui/rustdoc/doc-primitive.rs create mode 100644 tests/ui/rustdoc/doc-primitive.stderr create mode 100644 tests/ui/simd/monomorphize-heterogeneous.rs create mode 100644 tests/ui/simd/monomorphize-heterogeneous.stderr delete mode 100644 tests/ui/slightly-nice-generic-literal-messages.rs delete mode 100644 tests/ui/slightly-nice-generic-literal-messages.stderr create mode 100644 tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.rs create mode 100644 tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.stderr create mode 100644 tests/ui/stability-attribute/auxiliary/const-stability-attribute-implies.rs create mode 100644 tests/ui/stability-attribute/auxiliary/similar-unstable-method.rs create mode 100644 tests/ui/stability-attribute/const-stability-attribute-implies-missing.rs create mode 100644 tests/ui/stability-attribute/const-stability-attribute-implies-missing.stderr create mode 100644 tests/ui/stability-attribute/const-stability-attribute-implies-no-feature.rs create mode 100644 tests/ui/stability-attribute/const-stability-attribute-implies-no-feature.stderr create mode 100644 tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.rs create mode 100644 tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr create mode 100644 tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.rs create mode 100644 tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr create mode 100644 tests/ui/stability-attribute/issue-109177.rs create mode 100644 tests/ui/stability-attribute/issue-109177.stderr create mode 100644 tests/ui/std/issue-15149.rs create mode 100644 tests/ui/std/issue-81357-unsound-file-methods.rs create mode 100644 tests/ui/std/stdio-from.rs create mode 100644 tests/ui/std/switch-stdout.rs create mode 100644 tests/ui/suggestions/bad-infer-in-trait-impl.rs create mode 100644 tests/ui/suggestions/bad-infer-in-trait-impl.stderr create mode 100644 tests/ui/suggestions/correct-binder-for-arbitrary-bound-sugg.rs create mode 100644 tests/ui/suggestions/correct-binder-for-arbitrary-bound-sugg.stderr create mode 100644 tests/ui/suggestions/issue-107860.rs create mode 100644 tests/ui/suggestions/issue-107860.stderr create mode 100644 tests/ui/suggestions/issue-108470.fixed create mode 100644 tests/ui/suggestions/issue-108470.rs create mode 100644 tests/ui/suggestions/issue-108470.stderr create mode 100644 tests/ui/suggestions/issue-109291.rs create mode 100644 tests/ui/suggestions/issue-109291.stderr create mode 100644 tests/ui/suggestions/issue-109396.rs create mode 100644 tests/ui/suggestions/issue-109396.stderr create mode 100644 tests/ui/suggestions/issue-109436.rs create mode 100644 tests/ui/suggestions/issue-109436.stderr create mode 100644 tests/ui/suggestions/multiline-multipart-suggestion.rs create mode 100644 tests/ui/suggestions/multiline-multipart-suggestion.stderr create mode 100644 tests/ui/suggestions/suggest-pin-macro.rs create mode 100644 tests/ui/suggestions/suggest-pin-macro.stderr create mode 100644 tests/ui/suggestions/suggest-ret-on-async-w-late.rs create mode 100644 tests/ui/suggestions/suggest-ret-on-async-w-late.stderr delete mode 100644 tests/ui/suppressed-error.rs delete mode 100644 tests/ui/suppressed-error.stderr delete mode 100644 tests/ui/tag-that-dare-not-speak-its-name.rs delete mode 100644 tests/ui/tag-that-dare-not-speak-its-name.stderr delete mode 100644 tests/ui/terr-in-field.rs delete mode 100644 tests/ui/terr-in-field.stderr delete mode 100644 tests/ui/terr-sorts.rs delete mode 100644 tests/ui/terr-sorts.stderr create mode 100644 tests/ui/test-attrs/custom-test-frameworks/issue-107454.rs create mode 100644 tests/ui/test-attrs/custom-test-frameworks/issue-107454.stderr create mode 100644 tests/ui/test-attrs/issue-109816.rs create mode 100644 tests/ui/test-attrs/issue-109816.stderr create mode 100644 tests/ui/test-attrs/tests-listing-format-default.rs create mode 100644 tests/ui/test-attrs/tests-listing-format-default.run.stdout create mode 100644 tests/ui/test-attrs/tests-listing-format-json-without-unstableopts.rs create mode 100644 tests/ui/test-attrs/tests-listing-format-json-without-unstableopts.run.stderr create mode 100644 tests/ui/test-attrs/tests-listing-format-json.rs create mode 100644 tests/ui/test-attrs/tests-listing-format-json.run.stdout create mode 100644 tests/ui/test-attrs/tests-listing-format-terse.rs create mode 100644 tests/ui/test-attrs/tests-listing-format-terse.run.stdout delete mode 100644 tests/ui/thread-local-mutation.rs delete mode 100644 tests/ui/thread-local-mutation.stderr delete mode 100644 tests/ui/thread-local-static.rs delete mode 100644 tests/ui/thread-local-static.stderr create mode 100644 tests/ui/thread-local/auxiliary/tls-export.rs create mode 100644 tests/ui/thread-local/auxiliary/tls-rlib.rs create mode 100644 tests/ui/thread-local/thread-local-mutation.rs create mode 100644 tests/ui/thread-local/thread-local-mutation.stderr create mode 100644 tests/ui/thread-local/thread-local-static.rs create mode 100644 tests/ui/thread-local/thread-local-static.stderr create mode 100644 tests/ui/thread-local/tls-dylib-access.rs create mode 100644 tests/ui/traits/alias/dont-elaborate-non-self.rs create mode 100644 tests/ui/traits/alias/dont-elaborate-non-self.stderr create mode 100644 tests/ui/traits/new-solver/alias-eq-in-canonical-response.rs create mode 100644 tests/ui/traits/new-solver/alias-sub.rs create mode 100644 tests/ui/traits/new-solver/auto-with-drop_tracking_mir.fail.stderr create mode 100644 tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs create mode 100644 tests/ui/traits/new-solver/canonical-int-var-eq-in-response.rs create mode 100644 tests/ui/traits/new-solver/canonical-ty-var-eq-in-response.rs create mode 100644 tests/ui/traits/new-solver/cast-checks-handling-projections.rs create mode 100644 tests/ui/traits/new-solver/closure-inference-guidance.rs create mode 100644 tests/ui/traits/new-solver/coherence/issue-102048.rs create mode 100644 tests/ui/traits/new-solver/coherence/issue-102048.stderr create mode 100644 tests/ui/traits/new-solver/const-param-placeholder.fail.stderr create mode 100644 tests/ui/traits/new-solver/const-param-placeholder.rs create mode 100644 tests/ui/traits/new-solver/deduce-ty-from-object.rs create mode 100644 tests/ui/traits/new-solver/destruct.rs create mode 100644 tests/ui/traits/new-solver/dont-elaborate-for-projections.rs create mode 100644 tests/ui/traits/new-solver/equating-projection-cyclically.rs create mode 100644 tests/ui/traits/new-solver/equating-projection-cyclically.stderr create mode 100644 tests/ui/traits/new-solver/float-canonical.rs create mode 100644 tests/ui/traits/new-solver/fn-trait.stderr create mode 100644 tests/ui/traits/new-solver/int-var-alias-eq.rs create mode 100644 tests/ui/traits/new-solver/int-var-is-send.rs create mode 100644 tests/ui/traits/new-solver/iter-filter-projection.rs create mode 100644 tests/ui/traits/new-solver/lazy-nested-obligations-1.rs create mode 100644 tests/ui/traits/new-solver/lazy-nested-obligations-2.rs create mode 100644 tests/ui/traits/new-solver/lazy-nested-obligations-3.rs create mode 100644 tests/ui/traits/new-solver/nested-obligations-with-bound-vars-gat.rs create mode 100644 tests/ui/traits/new-solver/normalize-param-env-1.rs create mode 100644 tests/ui/traits/new-solver/normalize-param-env-2.rs create mode 100644 tests/ui/traits/new-solver/normalize-param-env-3.rs create mode 100644 tests/ui/traits/new-solver/param-discr-kind.rs create mode 100644 tests/ui/traits/new-solver/prefer-candidate-no-constraints.rs create mode 100644 tests/ui/traits/new-solver/prefer-param-env-on-ambiguity.rs create mode 100644 tests/ui/traits/new-solver/projection-discr-kind.rs create mode 100644 tests/ui/traits/new-solver/projection-discr-kind.stderr create mode 100644 tests/ui/traits/new-solver/recursive-self-normalization-2.rs create mode 100644 tests/ui/traits/new-solver/recursive-self-normalization-2.stderr create mode 100644 tests/ui/traits/new-solver/recursive-self-normalization.rs create mode 100644 tests/ui/traits/new-solver/recursive-self-normalization.stderr create mode 100644 tests/ui/traits/new-solver/runaway-impl-candidate-selection.rs create mode 100644 tests/ui/traits/new-solver/runaway-impl-candidate-selection.stderr create mode 100644 tests/ui/traits/new-solver/specialization-transmute.rs create mode 100644 tests/ui/traits/new-solver/specialization-transmute.stderr create mode 100644 tests/ui/traits/new-solver/specialization-unconstrained.rs create mode 100644 tests/ui/traits/new-solver/specialization-unconstrained.stderr create mode 100644 tests/ui/traits/new-solver/stall-num-var-auto-trait.fallback.stderr create mode 100644 tests/ui/traits/new-solver/stall-num-var-auto-trait.rs create mode 100644 tests/ui/traits/non_lifetime_binders/bad-copy-cond.rs create mode 100644 tests/ui/traits/non_lifetime_binders/bad-copy-cond.stderr create mode 100644 tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.rs create mode 100644 tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.stderr create mode 100644 tests/ui/traits/non_lifetime_binders/method-probe.rs create mode 100644 tests/ui/traits/non_lifetime_binders/method-probe.stderr create mode 100644 tests/ui/traits/non_lifetime_binders/missing-assoc-item.rs create mode 100644 tests/ui/traits/non_lifetime_binders/missing-assoc-item.stderr create mode 100644 tests/ui/traits/non_lifetime_binders/supertrait-object-safety.rs create mode 100644 tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr create mode 100644 tests/ui/traits/reservation-impl/coherence-conflict.next.stderr create mode 100644 tests/ui/traits/reservation-impl/coherence-conflict.old.stderr delete mode 100644 tests/ui/traits/reservation-impl/coherence-conflict.stderr create mode 100644 tests/ui/traits/reservation-impl/no-use.next.stderr create mode 100644 tests/ui/traits/reservation-impl/no-use.old.stderr delete mode 100644 tests/ui/traits/reservation-impl/no-use.stderr create mode 100644 tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs create mode 100644 tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr create mode 100644 tests/ui/traits/trait-upcasting/alias-where-clause-isnt-supertrait.rs create mode 100644 tests/ui/traits/trait-upcasting/alias-where-clause-isnt-supertrait.stderr create mode 100644 tests/ui/traits/wrong-mul-method-signature.rs create mode 100644 tests/ui/traits/wrong-mul-method-signature.stderr create mode 100644 tests/ui/transmutability/primitives/bool.current.stderr create mode 100644 tests/ui/transmutability/primitives/bool.next.stderr delete mode 100644 tests/ui/transmutability/primitives/bool.stderr create mode 100644 tests/ui/transmutability/primitives/numbers.current.stderr create mode 100644 tests/ui/transmutability/primitives/numbers.next.stderr delete mode 100644 tests/ui/transmutability/primitives/numbers.stderr create mode 100644 tests/ui/transmutability/primitives/unit.current.stderr create mode 100644 tests/ui/transmutability/primitives/unit.next.stderr delete mode 100644 tests/ui/transmutability/primitives/unit.stderr create mode 100644 tests/ui/transmutability/references.current.stderr create mode 100644 tests/ui/transmutability/references.next.stderr delete mode 100644 tests/ui/transmutability/references.stderr delete mode 100644 tests/ui/tuple-index.rs create mode 100644 tests/ui/tuple/tuple-index.rs create mode 100644 tests/ui/typeck/issue-110052.rs create mode 100644 tests/ui/typeck/issue-110052.stderr delete mode 100644 tests/ui/typeck/issue-87935-unsized-box-expr.rs delete mode 100644 tests/ui/typeck/issue-87935-unsized-box-expr.stderr delete mode 100644 tests/ui/typeck/lazy-norm/cast-checks-handling-projections.rs delete mode 100644 tests/ui/typeck/lazy-norm/cast-checks-handling-projections.stderr delete mode 100644 tests/ui/typeck/lazy-norm/equating-projection-cyclically.rs delete mode 100644 tests/ui/typeck/lazy-norm/equating-projection-cyclically.stderr create mode 100644 tests/ui/typeck/output-type-mismatch.rs create mode 100644 tests/ui/typeck/output-type-mismatch.stderr create mode 100644 tests/ui/typeck/suppressed-error.rs create mode 100644 tests/ui/typeck/suppressed-error.stderr create mode 100644 tests/ui/typeck/tag-that-dare-not-speak-its-name.rs create mode 100644 tests/ui/typeck/tag-that-dare-not-speak-its-name.stderr create mode 100644 tests/ui/typeck/terr-in-field.rs create mode 100644 tests/ui/typeck/terr-in-field.stderr create mode 100644 tests/ui/typeck/terr-sorts.rs create mode 100644 tests/ui/typeck/terr-sorts.stderr create mode 100644 tests/ui/typeck/while-type-error.rs create mode 100644 tests/ui/typeck/while-type-error.stderr create mode 100644 tests/ui/typeck/wrong-ret-type.rs create mode 100644 tests/ui/typeck/wrong-ret-type.stderr delete mode 100644 tests/ui/ufcs-polymorphic-paths.rs create mode 100644 tests/ui/ufcs/ufcs-polymorphic-paths.rs create mode 100644 tests/ui/union/unresolved-field-isnt-copy.rs create mode 100644 tests/ui/union/unresolved-field-isnt-copy.stderr delete mode 100644 tests/ui/unique-object-noncopyable.rs delete mode 100644 tests/ui/unique-object-noncopyable.stderr delete mode 100644 tests/ui/unique-pinned-nocopy.rs delete mode 100644 tests/ui/unique-pinned-nocopy.stderr delete mode 100644 tests/ui/unique/unique-assign-copy.rs delete mode 100644 tests/ui/unique/unique-assign-drop.rs delete mode 100644 tests/ui/unique/unique-assign-generic.rs delete mode 100644 tests/ui/unique/unique-assign.rs delete mode 100644 tests/ui/unique/unique-autoderef-field.rs delete mode 100644 tests/ui/unique/unique-autoderef-index.rs delete mode 100644 tests/ui/unique/unique-cmp.rs delete mode 100644 tests/ui/unique/unique-containing-tag.rs delete mode 100644 tests/ui/unique/unique-create.rs delete mode 100644 tests/ui/unique/unique-decl-init-copy.rs delete mode 100644 tests/ui/unique/unique-decl-init.rs delete mode 100644 tests/ui/unique/unique-decl-move.rs delete mode 100644 tests/ui/unique/unique-decl.rs delete mode 100644 tests/ui/unique/unique-deref.rs delete mode 100644 tests/ui/unique/unique-destructure.rs delete mode 100644 tests/ui/unique/unique-drop-complex.rs delete mode 100644 tests/ui/unique/unique-ffi-symbols.rs delete mode 100644 tests/ui/unique/unique-fn-arg-move.rs delete mode 100644 tests/ui/unique/unique-fn-arg-mut.rs delete mode 100644 tests/ui/unique/unique-fn-arg.rs delete mode 100644 tests/ui/unique/unique-fn-ret.rs delete mode 100644 tests/ui/unique/unique-generic-assign.rs delete mode 100644 tests/ui/unique/unique-in-tag.rs delete mode 100644 tests/ui/unique/unique-in-vec-copy.rs delete mode 100644 tests/ui/unique/unique-in-vec.rs delete mode 100644 tests/ui/unique/unique-init.rs delete mode 100644 tests/ui/unique/unique-kinds.rs delete mode 100644 tests/ui/unique/unique-log.rs delete mode 100644 tests/ui/unique/unique-match-discrim.rs delete mode 100644 tests/ui/unique/unique-move-drop.rs delete mode 100644 tests/ui/unique/unique-move-temp.rs delete mode 100644 tests/ui/unique/unique-move.rs delete mode 100644 tests/ui/unique/unique-mutable.rs delete mode 100644 tests/ui/unique/unique-object-move.rs delete mode 100644 tests/ui/unique/unique-pat-2.rs delete mode 100644 tests/ui/unique/unique-pat-3.rs delete mode 100644 tests/ui/unique/unique-pat.rs delete mode 100644 tests/ui/unique/unique-rec.rs delete mode 100644 tests/ui/unique/unique-send-2.rs delete mode 100644 tests/ui/unique/unique-send.rs delete mode 100644 tests/ui/unique/unique-swap.rs delete mode 100644 tests/ui/unpretty-expr-fn-arg.rs delete mode 100644 tests/ui/unpretty-expr-fn-arg.stdout create mode 100644 tests/ui/unpretty/box.rs create mode 100644 tests/ui/unpretty/box.stdout create mode 100644 tests/ui/unpretty/flattened-format-args.rs create mode 100644 tests/ui/unpretty/flattened-format-args.stdout create mode 100644 tests/ui/unpretty/mir-unpretty.rs create mode 100644 tests/ui/unpretty/mir-unpretty.stderr create mode 100644 tests/ui/unpretty/unpretty-expr-fn-arg.rs create mode 100644 tests/ui/unpretty/unpretty-expr-fn-arg.stdout delete mode 100644 tests/ui/unsafe-fn-called-from-unsafe-blk.rs delete mode 100644 tests/ui/unsafe-fn-called-from-unsafe-fn.rs delete mode 100644 tests/ui/unsafe-pointer-assignability.rs create mode 100644 tests/ui/unsafe/foreign-unsafe-fn-called.mir.stderr create mode 100644 tests/ui/unsafe/foreign-unsafe-fn-called.rs create mode 100644 tests/ui/unsafe/foreign-unsafe-fn-called.thir.stderr create mode 100644 tests/ui/unsafe/new-unsafe-pointers.rs create mode 100644 tests/ui/unsafe/unsafe-fn-called-from-unsafe-blk.rs create mode 100644 tests/ui/unsafe/unsafe-fn-called-from-unsafe-fn.rs create mode 100644 tests/ui/unsafe/unsafe-pointer-assignability.rs delete mode 100644 tests/ui/unterminated-comment.rs delete mode 100644 tests/ui/unterminated-comment.stderr delete mode 100644 tests/ui/unterminated-nested-comment.rs delete mode 100644 tests/ui/unterminated-nested-comment.stderr delete mode 100644 tests/ui/unwind-unique.rs delete mode 100644 tests/ui/use.rs delete mode 100644 tests/ui/use/use-mod.rs delete mode 100644 tests/ui/use/use-mod.stderr create mode 100644 tests/ui/use/use-mod/use-mod.rs create mode 100644 tests/ui/use/use-mod/use-mod.stderr create mode 100644 tests/ui/use/use.rs delete mode 100644 tests/ui/variance-intersection-of-ref-and-opt-ref.rs delete mode 100644 tests/ui/variance-iterators-in-libcore.rs create mode 100644 tests/ui/variance/variance-intersection-of-ref-and-opt-ref.rs create mode 100644 tests/ui/variance/variance-iterators-in-libcore.rs delete mode 100644 tests/ui/wasm-custom-section-relocations.rs delete mode 100644 tests/ui/wasm-custom-section-relocations.stderr create mode 100644 tests/ui/wasm/wasm-custom-section-relocations.rs create mode 100644 tests/ui/wasm/wasm-custom-section-relocations.stderr create mode 100644 tests/ui/wf/issue-110157.rs create mode 100644 tests/ui/wf/issue-110157.stderr delete mode 100644 tests/ui/while-type-error.rs delete mode 100644 tests/ui/while-type-error.stderr delete mode 100644 tests/ui/wrong-mul-method-signature.rs delete mode 100644 tests/ui/wrong-mul-method-signature.stderr delete mode 100644 tests/ui/wrong-ret-type.rs delete mode 100644 tests/ui/wrong-ret-type.stderr delete mode 100644 tests/ui/xc-private-method.rs delete mode 100644 tests/ui/xc-private-method.stderr delete mode 100644 tests/ui/xc-private-method2.rs delete mode 100644 tests/ui/xc-private-method2.stderr (limited to 'tests') diff --git a/tests/assembly/asm/global_asm.rs b/tests/assembly/asm/global_asm.rs index 0b361a7ed..36f017cf9 100644 --- a/tests/assembly/asm/global_asm.rs +++ b/tests/assembly/asm/global_asm.rs @@ -25,9 +25,9 @@ global_asm!("movl ${}, %ecx", const 5, options(att_syntax)); global_asm!("call {}", sym my_func); // CHECK: lea rax, [rip + MY_STATIC] global_asm!("lea rax, [rip + {}]", sym MY_STATIC); -// CHECK: call _RNvCsiubXh4Yz005_10global_asm6foobar +// CHECK: call _RNvCsddMtV7nAi4C_10global_asm6foobar global_asm!("call {}", sym foobar); -// CHECK: _RNvCsiubXh4Yz005_10global_asm6foobar: +// CHECK: _RNvCsddMtV7nAi4C_10global_asm6foobar: fn foobar() { loop {} } diff --git a/tests/assembly/asm/m68k-types.rs b/tests/assembly/asm/m68k-types.rs new file mode 100644 index 000000000..0322e615a --- /dev/null +++ b/tests/assembly/asm/m68k-types.rs @@ -0,0 +1,83 @@ +// assembly-output: emit-asm +// compile-flags: --target m68k-unknown-linux-gnu +// needs-llvm-components: m68k + +#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)] +#![crate_type = "rlib"] +#![no_core] +#![allow(non_camel_case_types)] + +#[rustc_builtin_macro] +macro_rules! asm { + () => {}; +} +#[rustc_builtin_macro] +macro_rules! concat { + () => {}; +} + +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} + +type ptr = *const u64; + +impl Copy for i8 {} +impl Copy for i16 {} +impl Copy for i32 {} +impl Copy for i64 {} +impl Copy for ptr {} + +macro_rules! check { + ($func:ident $ty:ident $class:ident $mov:literal) => { + #[no_mangle] + pub unsafe fn $func(x: $ty) -> $ty { + let y; + asm!(concat!($mov, " {}, {};"), out($class) y, in($class) x); + y + } + }; +} + +// CHECK-LABEL: reg_data_i8: +// CHECK: ;APP +// CHECK: move.b %d{{[0-9]}}, %d{{[0-9]}} +// CHECK: ;NO_APP +check!(reg_data_i8 i8 reg_data "move.b"); + +// CHECK-LABEL: reg_data_i16: +// CHECK: ;APP +// CHECK: move.w %d{{[0-9]}}, %d{{[0-9]}} +// CHECK: ;NO_APP +check!(reg_data_i16 i16 reg_data "move.w"); + +// CHECK-LABEL: reg_data_i32: +// CHECK: ;APP +// CHECK: move.l %d{{[0-9]}}, %d{{[0-9]}} +// CHECK: ;NO_APP +check!(reg_data_i32 i32 reg_data "move.l"); + +// CHECK-LABEL: reg_addr_i16: +// CHECK: ;APP +// CHECK: move.w %a{{[0-9]}}, %a{{[0-9]}} +// CHECK: ;NO_APP +check!(reg_addr_i16 i16 reg_addr "move.w"); + +// CHECK-LABEL: reg_addr_i32: +// CHECK: ;APP +// CHECK: move.l %a{{[0-9]}}, %a{{[0-9]}} +// CHECK: ;NO_APP +check!(reg_addr_i32 i32 reg_addr "move.l"); + +// CHECK-LABEL: reg_i16: +// CHECK: ;APP +// CHECK: move.w %{{[da][0-9]}}, %{{[da][0-9]}} +// CHECK: ;NO_APP +check!(reg_i16 i16 reg "move.w"); + +// CHECK-LABEL: reg_i32: +// CHECK: ;APP +// CHECK: move.l %{{[da][0-9]}}, %{{[da][0-9]}} +// CHECK: ;NO_APP +check!(reg_i32 i32 reg "move.l"); diff --git a/tests/assembly/is_aligned.rs b/tests/assembly/is_aligned.rs index 620a3da94..148d11ee4 100644 --- a/tests/assembly/is_aligned.rs +++ b/tests/assembly/is_aligned.rs @@ -1,6 +1,7 @@ // assembly-output: emit-asm // min-llvm-version: 15.0 // only-x86_64 +// ignore-sgx // revisions: opt-speed opt-size // [opt-speed] compile-flags: -Copt-level=1 // [opt-size] compile-flags: -Copt-level=s diff --git a/tests/assembly/static-relocation-model.rs b/tests/assembly/static-relocation-model.rs index faa2e3952..41aa9a461 100644 --- a/tests/assembly/static-relocation-model.rs +++ b/tests/assembly/static-relocation-model.rs @@ -6,6 +6,7 @@ // [A64] needs-llvm-components: aarch64 // [ppc64le] compile-flags: --target powerpc64le-unknown-linux-gnu -Crelocation-model=static // [ppc64le] needs-llvm-components: powerpc +// ignore-debug: alignment checks insert panics that we don't have a lang item for #![feature(no_core, lang_items)] #![no_core] diff --git a/tests/assembly/strict_provenance.rs b/tests/assembly/strict_provenance.rs index 01f1957d5..24a7c6b5b 100644 --- a/tests/assembly/strict_provenance.rs +++ b/tests/assembly/strict_provenance.rs @@ -1,6 +1,7 @@ // assembly-output: emit-asm // compile-flags: -Copt-level=1 // only-x86_64 +// ignore-sgx // min-llvm-version: 15.0 #![crate_type = "rlib"] diff --git a/tests/assembly/x86_64-floating-point-clamp.rs b/tests/assembly/x86_64-floating-point-clamp.rs index 0f3b465d0..0bc6baad4 100644 --- a/tests/assembly/x86_64-floating-point-clamp.rs +++ b/tests/assembly/x86_64-floating-point-clamp.rs @@ -4,6 +4,7 @@ // assembly-output: emit-asm // compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel // only-x86_64 +// ignore-sgx // CHECK-LABEL: clamp_demo: #[no_mangle] diff --git a/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs b/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs index 79d82cf70..7eb3c6948 100644 --- a/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs +++ b/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs @@ -11,7 +11,7 @@ pub extern fn plus_one(r: &mut u64) { // CHECK: plus_one // CHECK: lfence -// CHECK-NEXT: addq +// CHECK-NEXT: incq // CHECK: popq [[REGISTER:%[a-z]+]] // CHECK-NEXT: lfence // CHECK-NEXT: jmpq *[[REGISTER]] diff --git a/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs b/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs index c316379d5..4745ebc4f 100644 --- a/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs +++ b/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs @@ -10,9 +10,7 @@ use std::arch::asm; pub extern "C" fn get(ptr: *const u64) -> u64 { let value: u64; unsafe { - asm!(".start_inline_asm:", - "mov {}, [{}]", - ".end_inline_asm:", + asm!("mov {}, [{}]", out(reg) value, in(reg) ptr); } @@ -20,24 +18,17 @@ pub extern "C" fn get(ptr: *const u64) -> u64 { } // CHECK: get -// CHECK: .start_inline_asm -// CHECK-NEXT: movq +// CHECK: movq // CHECK-NEXT: lfence -// CHECK-NEXT: .end_inline_asm #[no_mangle] pub extern "C" fn myret() { unsafe { - asm!( - ".start_myret_inline_asm:", - "ret", - ".end_myret_inline_asm:", - ); + asm!("ret"); } } // CHECK: myret -// CHECK: .start_myret_inline_asm -// CHECK-NEXT: shlq $0, (%rsp) +// CHECK: shlq $0, (%rsp) // CHECK-NEXT: lfence // CHECK-NEXT: retq diff --git a/tests/assembly/x86_64-no-jump-tables.rs b/tests/assembly/x86_64-no-jump-tables.rs index 007c3591a..edf4adaad 100644 --- a/tests/assembly/x86_64-no-jump-tables.rs +++ b/tests/assembly/x86_64-no-jump-tables.rs @@ -6,6 +6,7 @@ // compile-flags: -O // [set] compile-flags: -Zno-jump-tables // only-x86_64 +// ignore-sgx #![crate_type = "lib"] diff --git a/tests/codegen-units/polymorphization/auxiliary/poly-dep.rs b/tests/codegen-units/polymorphization/auxiliary/poly-dep.rs new file mode 100644 index 000000000..fdbfa1b09 --- /dev/null +++ b/tests/codegen-units/polymorphization/auxiliary/poly-dep.rs @@ -0,0 +1,4 @@ +// compile-flags: -Zpolymorphize=on + +#[inline(never)] +pub fn foo() {} diff --git a/tests/codegen-units/polymorphization/poly-foreign.rs b/tests/codegen-units/polymorphization/poly-foreign.rs new file mode 100644 index 000000000..9da082daf --- /dev/null +++ b/tests/codegen-units/polymorphization/poly-foreign.rs @@ -0,0 +1,11 @@ +// aux-build:poly-dep.rs +// compile-flags: --crate-type=lib -Zprint-mono-items=eager -Zpolymorphize=on + +extern crate poly_dep; + +pub static FN1: fn() = poly_dep::foo::; +pub static FN2: fn() = poly_dep::foo::; + +//~ MONO_ITEM static FN1 +//~ MONO_ITEM static FN2 +//~ MONO_ITEM fn poly_dep::foo:: diff --git a/tests/codegen/abi-main-signature-16bit-c-int.rs b/tests/codegen/abi-main-signature-16bit-c-int.rs index 4ed491dfb..3548cc06a 100644 --- a/tests/codegen/abi-main-signature-16bit-c-int.rs +++ b/tests/codegen/abi-main-signature-16bit-c-int.rs @@ -17,7 +17,6 @@ // ignore-wasm32 // ignore-x86 // ignore-x86_64 -// ignore-xcore fn main() { } diff --git a/tests/codegen/adjustments.rs b/tests/codegen/adjustments.rs index 6d2247517..b53a68a55 100644 --- a/tests/codegen/adjustments.rs +++ b/tests/codegen/adjustments.rs @@ -13,7 +13,7 @@ pub fn helper(_: usize) { pub fn no_op_slice_adjustment(x: &[u8]) -> &[u8] { // We used to generate an extra alloca and memcpy for the block's trailing expression value, so // check that we copy directly to the return value slot -// CHECK: %0 = insertvalue { {{\[0 x i8\]\*|ptr}}, [[USIZE]] } undef, {{\[0 x i8\]\*|ptr}} %x.0, 0 +// CHECK: %0 = insertvalue { {{\[0 x i8\]\*|ptr}}, [[USIZE]] } poison, {{\[0 x i8\]\*|ptr}} %x.0, 0 // CHECK: %1 = insertvalue { {{\[0 x i8\]\*|ptr}}, [[USIZE]] } %0, [[USIZE]] %x.1, 1 // CHECK: ret { {{\[0 x i8\]\*|ptr}}, [[USIZE]] } %1 { x } diff --git a/tests/codegen/array-map.rs b/tests/codegen/array-map.rs index 9298e89e3..7b8ab2c79 100644 --- a/tests/codegen/array-map.rs +++ b/tests/codegen/array-map.rs @@ -38,10 +38,10 @@ pub fn short_integer_zip_map(x: [u32; 8], y: [u32; 8]) -> [u32; 8] { // // CHECK-LABEL: @long_integer_map #[no_mangle] -pub fn long_integer_map(x: [u32; 64]) -> [u32; 64] { +pub fn long_integer_map(x: [u32; 512]) -> [u32; 512] { // CHECK: start: - // CHECK-NEXT: alloca [64 x i32] - // CHECK-NEXT: alloca %"core::mem::manually_drop::ManuallyDrop<[u32; 64]>" + // CHECK-NEXT: alloca [512 x i32] + // CHECK-NEXT: alloca %"core::mem::manually_drop::ManuallyDrop<[u32; 512]>" // CHECK-NOT: alloca // CHECK: mul <{{[0-9]+}} x i32> // CHECK: add <{{[0-9]+}} x i32> diff --git a/tests/codegen/auxiliary/static_dllimport_aux.rs b/tests/codegen/auxiliary/static_dllimport_aux.rs deleted file mode 100644 index afb0dc42f..000000000 --- a/tests/codegen/auxiliary/static_dllimport_aux.rs +++ /dev/null @@ -1,13 +0,0 @@ -use std::sync::atomic::{AtomicPtr, Ordering}; - -#[inline(always)] -pub fn memrchr() { - fn detect() {} - - static CROSS_CRATE_STATIC_ITEM: AtomicPtr<()> = AtomicPtr::new(detect as *mut ()); - - unsafe { - let fun = CROSS_CRATE_STATIC_ITEM.load(Ordering::SeqCst); - std::mem::transmute::<*mut (), fn()>(fun)() - } -} diff --git a/tests/codegen/comparison-operators-2-tuple.rs b/tests/codegen/comparison-operators-2-tuple.rs new file mode 100644 index 000000000..a9d25e3b5 --- /dev/null +++ b/tests/codegen/comparison-operators-2-tuple.rs @@ -0,0 +1,121 @@ +// compile-flags: -C opt-level=1 -Z merge-functions=disabled +// min-llvm-version: 15.0 +// only-x86_64 + +#![crate_type = "lib"] + +use std::cmp::Ordering; + +type TwoTuple = (i16, u16); + +// +// The operators are all overridden directly, so should optimize easily. +// +// Yes, the `s[lg]t` is correct for the `[lg]e` version because it's only used +// in the side of the select where we know the values are *not* equal. +// + +// CHECK-LABEL: @check_lt_direct +// CHECK-SAME: (i16 noundef %[[A0:.+]], i16 noundef %[[A1:.+]], i16 noundef %[[B0:.+]], i16 noundef %[[B1:.+]]) +#[no_mangle] +pub fn check_lt_direct(a: TwoTuple, b: TwoTuple) -> bool { + // CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]] + // CHECK-DAG: %[[CMP0:.+]] = icmp slt i16 %[[A0]], %[[B0]] + // CHECK-DAG: %[[CMP1:.+]] = icmp ult i16 %[[A1]], %[[B1]] + // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]] + // CHECK: ret i1 %[[R]] + a < b +} + +// CHECK-LABEL: @check_le_direct +// CHECK-SAME: (i16 noundef %[[A0:.+]], i16 noundef %[[A1:.+]], i16 noundef %[[B0:.+]], i16 noundef %[[B1:.+]]) +#[no_mangle] +pub fn check_le_direct(a: TwoTuple, b: TwoTuple) -> bool { + // CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]] + // CHECK-DAG: %[[CMP0:.+]] = icmp slt i16 %[[A0]], %[[B0]] + // CHECK-DAG: %[[CMP1:.+]] = icmp ule i16 %[[A1]], %[[B1]] + // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]] + // CHECK: ret i1 %[[R]] + a <= b +} + +// CHECK-LABEL: @check_gt_direct +// CHECK-SAME: (i16 noundef %[[A0:.+]], i16 noundef %[[A1:.+]], i16 noundef %[[B0:.+]], i16 noundef %[[B1:.+]]) +#[no_mangle] +pub fn check_gt_direct(a: TwoTuple, b: TwoTuple) -> bool { + // CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]] + // CHECK-DAG: %[[CMP0:.+]] = icmp sgt i16 %[[A0]], %[[B0]] + // CHECK-DAG: %[[CMP1:.+]] = icmp ugt i16 %[[A1]], %[[B1]] + // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]] + // CHECK: ret i1 %[[R]] + a > b +} + +// CHECK-LABEL: @check_ge_direct +// CHECK-SAME: (i16 noundef %[[A0:.+]], i16 noundef %[[A1:.+]], i16 noundef %[[B0:.+]], i16 noundef %[[B1:.+]]) +#[no_mangle] +pub fn check_ge_direct(a: TwoTuple, b: TwoTuple) -> bool { + // CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]] + // CHECK-DAG: %[[CMP0:.+]] = icmp sgt i16 %[[A0]], %[[B0]] + // CHECK-DAG: %[[CMP1:.+]] = icmp uge i16 %[[A1]], %[[B1]] + // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]] + // CHECK: ret i1 %[[R]] + a >= b +} + +// +// These ones are harder, since there are more intermediate values to remove. +// +// `<` seems to be getting lucky right now, so test that doesn't regress. +// +// The others, however, aren't managing to optimize away the extra `select`s yet. +// See for more about this. +// + +// CHECK-LABEL: @check_lt_via_cmp +// CHECK-SAME: (i16 noundef %[[A0:.+]], i16 noundef %[[A1:.+]], i16 noundef %[[B0:.+]], i16 noundef %[[B1:.+]]) +#[no_mangle] +pub fn check_lt_via_cmp(a: TwoTuple, b: TwoTuple) -> bool { + // CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]] + // CHECK-DAG: %[[CMP0:.+]] = icmp slt i16 %[[A0]], %[[B0]] + // CHECK-DAG: %[[CMP1:.+]] = icmp ult i16 %[[A1]], %[[B1]] + // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]] + // CHECK: ret i1 %[[R]] + Ord::cmp(&a, &b).is_lt() +} + +// CHECK-LABEL: @check_le_via_cmp +// CHECK-SAME: (i16 noundef %[[A0:.+]], i16 noundef %[[A1:.+]], i16 noundef %[[B0:.+]], i16 noundef %[[B1:.+]]) +#[no_mangle] +pub fn check_le_via_cmp(a: TwoTuple, b: TwoTuple) -> bool { + // FIXME-CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]] + // FIXME-CHECK-DAG: %[[CMP0:.+]] = icmp sle i16 %[[A0]], %[[B0]] + // FIXME-CHECK-DAG: %[[CMP1:.+]] = icmp ule i16 %[[A1]], %[[B1]] + // FIXME-CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]] + // FIXME-CHECK: ret i1 %[[R]] + Ord::cmp(&a, &b).is_le() +} + +// CHECK-LABEL: @check_gt_via_cmp +// CHECK-SAME: (i16 noundef %[[A0:.+]], i16 noundef %[[A1:.+]], i16 noundef %[[B0:.+]], i16 noundef %[[B1:.+]]) +#[no_mangle] +pub fn check_gt_via_cmp(a: TwoTuple, b: TwoTuple) -> bool { + // FIXME-CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]] + // FIXME-CHECK-DAG: %[[CMP0:.+]] = icmp sgt i16 %[[A0]], %[[B0]] + // FIXME-CHECK-DAG: %[[CMP1:.+]] = icmp ugt i16 %[[A1]], %[[B1]] + // FIXME-CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]] + // FIXME-CHECK: ret i1 %[[R]] + Ord::cmp(&a, &b).is_gt() +} + +// CHECK-LABEL: @check_ge_via_cmp +// CHECK-SAME: (i16 noundef %[[A0:.+]], i16 noundef %[[A1:.+]], i16 noundef %[[B0:.+]], i16 noundef %[[B1:.+]]) +#[no_mangle] +pub fn check_ge_via_cmp(a: TwoTuple, b: TwoTuple) -> bool { + // FIXME-CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]] + // FIXME-CHECK-DAG: %[[CMP0:.+]] = icmp sge i16 %[[A0]], %[[B0]] + // FIXME-CHECK-DAG: %[[CMP1:.+]] = icmp uge i16 %[[A1]], %[[B1]] + // FIXME-CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]] + // FIXME-CHECK: ret i1 %[[R]] + Ord::cmp(&a, &b).is_ge() +} diff --git a/tests/codegen/consts.rs b/tests/codegen/consts.rs index dd22fd0f7..fc2badc41 100644 --- a/tests/codegen/consts.rs +++ b/tests/codegen/consts.rs @@ -9,7 +9,7 @@ // CHECK: @STATIC = {{.*}}, align 4 // This checks the constants from inline_enum_const -// CHECK: @alloc_76bfe2f13a3e3b01074971d122eac57e = {{.*}}, align 2 +// CHECK: @alloc_af1f8e8e6f4b341431a1d405e652df2d = {{.*}}, align 2 // This checks the constants from {low,high}_align_const, they share the same // constant, but the alignment differs, so the higher one should be used diff --git a/tests/codegen/debug-limited.rs b/tests/codegen/debug-limited.rs new file mode 100644 index 000000000..48d676887 --- /dev/null +++ b/tests/codegen/debug-limited.rs @@ -0,0 +1,27 @@ +// Verify that the limited debuginfo option emits llvm's FullDebugInfo, but no type info. +// +// compile-flags: -C debuginfo=limited + +#[repr(C)] +struct StructType { + a: i64, + b: i32, +} + +extern "C" { + fn creator() -> *mut StructType; + fn save(p: *const StructType); +} + +fn main() { + unsafe { + let value: &mut StructType = &mut *creator(); + value.a = 7; + save(value as *const StructType) + } +} + +// CHECK: !DICompileUnit +// CHECK: emissionKind: FullDebug +// CHECK: !DILocation +// CHECK-NOT: !DIBasicType diff --git a/tests/codegen/debug-line-directives-only.rs b/tests/codegen/debug-line-directives-only.rs new file mode 100644 index 000000000..750bdd49d --- /dev/null +++ b/tests/codegen/debug-line-directives-only.rs @@ -0,0 +1,27 @@ +// Verify that the only debuginfo generated are the line directives. +// +// compile-flags: -C debuginfo=line-directives-only + +#[repr(C)] +struct StructType { + a: i64, + b: i32, +} + +extern "C" { + fn creator() -> *mut StructType; + fn save(p: *const StructType); +} + +fn main() { + unsafe { + let value: &mut StructType = &mut *creator(); + value.a = 7; + save(value as *const StructType) + } +} + +// CHECK: !DICompileUnit +// CHECK: emissionKind: DebugDirectivesOnly +// CHECK: !DILocation +// CHECK-NOT: !DIBasicType diff --git a/tests/codegen/debug-line-tables-only.rs b/tests/codegen/debug-line-tables-only.rs new file mode 100644 index 000000000..3ed165a6f --- /dev/null +++ b/tests/codegen/debug-line-tables-only.rs @@ -0,0 +1,27 @@ +// Verify that the only debuginfo generated are the line tables. +// +// compile-flags: -C debuginfo=line-tables-only + +#[repr(C)] +struct StructType { + a: i64, + b: i32, +} + +extern "C" { + fn creator() -> *mut StructType; + fn save(p: *const StructType); +} + +fn main() { + unsafe { + let value: &mut StructType = &mut *creator(); + value.a = 7; + save(value as *const StructType) + } +} + +// CHECK: !DICompileUnit +// CHECK: emissionKind: LineTablesOnly +// CHECK: !DILocation +// CHECK-NOT: !DIBasicType diff --git a/tests/codegen/enum-match.rs b/tests/codegen/enum-match.rs index 5f8063a27..36c6be190 100644 --- a/tests/codegen/enum-match.rs +++ b/tests/codegen/enum-match.rs @@ -34,8 +34,11 @@ pub enum Enum1 { // CHECK: define noundef i8 @match1{{.*}} // CHECK-NEXT: start: -// CHECK-NEXT: [[DISCR:%.*]] = {{.*}}call i8 @llvm.usub.sat.i8(i8 %0, i8 1) -// CHECK-NEXT: switch i8 [[DISCR]], label {{.*}} [ +// CHECK-NEXT: %1 = add i8 %0, -2 +// CHECK-NEXT: %2 = zext i8 %1 to i64 +// CHECK-NEXT: %3 = icmp ult i8 %1, 2 +// CHECK-NEXT: %4 = add nuw nsw i64 %2, 1 +// CHECK-NEXT: %_2 = select i1 %3, i64 %4, i64 0 #[no_mangle] pub fn match1(e: Enum1) -> u8 { use Enum1::*; diff --git a/tests/codegen/fewer-names.rs b/tests/codegen/fewer-names.rs index ac8cba06b..7f383a5c1 100644 --- a/tests/codegen/fewer-names.rs +++ b/tests/codegen/fewer-names.rs @@ -13,8 +13,8 @@ pub fn sum(x: u32, y: u32) -> u32 { // NO-LABEL: define{{.*}}i32 @sum(i32 noundef %x, i32 noundef %y) // NO-NEXT: start: -// NO-NEXT: %z = add i32 %y, %x -// NO-NEXT: ret i32 %z +// 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 fab84868f..9912b1e75 100644 --- a/tests/codegen/global_asm.rs +++ b/tests/codegen/global_asm.rs @@ -1,39 +1,20 @@ // ignore-aarch64 -// ignore-aarch64_be // ignore-arm -// ignore-armeb // ignore-avr -// ignore-bpfel -// ignore-bpfeb +// ignore-bpf +// ignore-bpf // ignore-hexagon // ignore-mips // ignore-mips64 // ignore-msp430 // ignore-powerpc64 -// ignore-powerpc64le // ignore-powerpc -// ignore-r600 -// ignore-amdgcn // ignore-sparc -// ignore-sparcv9 -// ignore-sparcel +// ignore-sparc64 // ignore-s390x -// ignore-tce // ignore-thumb -// ignore-thumbeb -// ignore-xcore -// ignore-nvptx // ignore-nvptx64 -// ignore-le32 -// ignore-le64 -// ignore-amdil -// ignore-amdil64 -// ignore-hsail -// ignore-hsail64 -// ignore-spir -// ignore-spir64 -// ignore-kalimba -// ignore-shave +// ignore-spirv // ignore-wasm32 // ignore-wasm64 // ignore-emscripten diff --git a/tests/codegen/global_asm_include.rs b/tests/codegen/global_asm_include.rs index 02ee91645..b68c5ad3b 100644 --- a/tests/codegen/global_asm_include.rs +++ b/tests/codegen/global_asm_include.rs @@ -1,39 +1,20 @@ // ignore-aarch64 -// ignore-aarch64_be // ignore-arm -// ignore-armeb // ignore-avr -// ignore-bpfel -// ignore-bpfeb +// ignore-bpf +// ignore-bpf // ignore-hexagon // ignore-mips // ignore-mips64 // ignore-msp430 // ignore-powerpc64 -// ignore-powerpc64le // ignore-powerpc -// ignore-r600 -// ignore-amdgcn // ignore-sparc -// ignore-sparcv9 -// ignore-sparcel +// ignore-sparc64 // ignore-s390x -// ignore-tce // ignore-thumb -// ignore-thumbeb -// ignore-xcore -// ignore-nvptx // ignore-nvptx64 -// ignore-le32 -// ignore-le64 -// ignore-amdil -// ignore-amdil64 -// ignore-hsail -// ignore-hsail64 -// ignore-spir -// ignore-spir64 -// ignore-kalimba -// ignore-shave +// ignore-spirv // ignore-wasm32 // ignore-wasm64 // ignore-emscripten diff --git a/tests/codegen/global_asm_x2.rs b/tests/codegen/global_asm_x2.rs index bdcf0ea84..d87e02bef 100644 --- a/tests/codegen/global_asm_x2.rs +++ b/tests/codegen/global_asm_x2.rs @@ -1,39 +1,20 @@ // ignore-aarch64 -// ignore-aarch64_be // ignore-arm -// ignore-armeb // ignore-avr -// ignore-bpfel -// ignore-bpfeb +// ignore-bpf +// ignore-bpf // ignore-hexagon // ignore-mips // ignore-mips64 // ignore-msp430 // ignore-powerpc64 -// ignore-powerpc64le // ignore-powerpc -// ignore-r600 -// ignore-amdgcn // ignore-sparc -// ignore-sparcv9 -// ignore-sparcel +// ignore-sparc64 // ignore-s390x -// ignore-tce // ignore-thumb -// ignore-thumbeb -// ignore-xcore -// ignore-nvptx // ignore-nvptx64 -// ignore-le32 -// ignore-le64 -// ignore-amdil -// ignore-amdil64 -// ignore-hsail -// ignore-hsail64 -// ignore-spir -// ignore-spir64 -// ignore-kalimba -// ignore-shave +// ignore-spirv // ignore-wasm32 // ignore-wasm64 // ignore-emscripten diff --git a/tests/codegen/inherit_overflow.rs b/tests/codegen/inherit_overflow.rs index 0b0b890b2..39909d7ab 100644 --- a/tests/codegen/inherit_overflow.rs +++ b/tests/codegen/inherit_overflow.rs @@ -4,7 +4,7 @@ //[NOASSERT] compile-flags: -Coverflow-checks=off // CHECK-LABEL: define{{.*}} @assertion -// ASSERT: call void @_ZN4core9panicking5panic17h +// ASSERT: call void @{{.*4core9panicking5panic}} // NOASSERT: ret i8 0 #[no_mangle] pub fn assertion() -> u8 { diff --git a/tests/codegen/inline-function-args-debug-info.rs b/tests/codegen/inline-function-args-debug-info.rs new file mode 100644 index 000000000..e3d8caa49 --- /dev/null +++ b/tests/codegen/inline-function-args-debug-info.rs @@ -0,0 +1,20 @@ +// This test checks that debug information includes function argument indexes even if the function +// gets inlined by MIR inlining. Without function argument indexes, `info args` in gdb won't show +// arguments and their values for the current function. + +// compile-flags: -Zinline-mir=yes -Cdebuginfo=2 --edition=2021 + +#![crate_type = "lib"] + +pub fn outer_function(x: usize, y: usize) -> usize { + inner_function(x, y) + 1 +} + +#[inline] +fn inner_function(aaaa: usize, bbbb: usize) -> usize { + // CHECK: !DILocalVariable(name: "aaaa", arg: 1 + // CHECK-SAME: line: 14 + // CHECK: !DILocalVariable(name: "bbbb", arg: 2 + // CHECK-SAME: line: 14 + aaaa + bbbb +} diff --git a/tests/codegen/intrinsics/transmute-x64.rs b/tests/codegen/intrinsics/transmute-x64.rs new file mode 100644 index 000000000..99d258c62 --- /dev/null +++ b/tests/codegen/intrinsics/transmute-x64.rs @@ -0,0 +1,35 @@ +// compile-flags: -O -C no-prepopulate-passes +// only-x86_64 (it's using arch-specific types) +// min-llvm-version: 15.0 # this test assumes `ptr`s + +#![crate_type = "lib"] + +use std::arch::x86_64::{__m128, __m128i, __m256i}; +use std::mem::transmute; + +// CHECK-LABEL: @check_sse_float_to_int( +#[no_mangle] +pub unsafe fn check_sse_float_to_int(x: __m128) -> __m128i { + // CHECK-NOT: alloca + // CHECK: %1 = load <4 x float>, ptr %x, align 16 + // CHECK: store <4 x float> %1, ptr %0, align 16 + transmute(x) +} + +// CHECK-LABEL: @check_sse_pair_to_avx( +#[no_mangle] +pub unsafe fn check_sse_pair_to_avx(x: (__m128i, __m128i)) -> __m256i { + // CHECK-NOT: alloca + // CHECK: %1 = load <4 x i64>, ptr %x, align 16 + // CHECK: store <4 x i64> %1, ptr %0, align 32 + transmute(x) +} + +// CHECK-LABEL: @check_sse_pair_from_avx( +#[no_mangle] +pub unsafe fn check_sse_pair_from_avx(x: __m256i) -> (__m128i, __m128i) { + // CHECK-NOT: alloca + // CHECK: %1 = load <4 x i64>, ptr %x, align 32 + // CHECK: store <4 x i64> %1, ptr %0, align 16 + transmute(x) +} diff --git a/tests/codegen/intrinsics/transmute.rs b/tests/codegen/intrinsics/transmute.rs new file mode 100644 index 000000000..57f901c67 --- /dev/null +++ b/tests/codegen/intrinsics/transmute.rs @@ -0,0 +1,431 @@ +// compile-flags: -O -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"] +#![feature(core_intrinsics)] +#![feature(custom_mir)] +#![feature(inline_const)] +#![allow(unreachable_code)] + +use std::mem::{transmute, MaybeUninit}; + +// 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. +use std::intrinsics::mir::*; + +enum Never {} + +#[repr(align(2))] +pub struct BigNever(Never, u16, Never); + +#[repr(align(8))] +pub struct Scalar64(i64); + +#[repr(C, align(4))] +pub struct Aggregate64(u16, u8, i8, f32); + +#[repr(C)] +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() + } + } +} + +// 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() + } + } +} + +// 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() + } + } +} + +// 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() + } + } +} + +// CHECK-LABEL: @check_to_uninhabited( +#[no_mangle] +#[custom_mir(dialect = "runtime", phase = "initial")] +pub unsafe fn check_to_uninhabited(x: u16) -> BigNever { + // CHECK: call void @llvm.trap + mir!{ + { + RET = CastTransmute(x); + Return() + } + } +} + +// CHECK-LABEL: @check_from_uninhabited( +#[no_mangle] +#[custom_mir(dialect = "runtime", phase = "initial")] +pub unsafe fn check_from_uninhabited(x: BigNever) -> u16 { + // CHECK: ret i16 poison + mir!{ + { + RET = CastTransmute(x); + Return() + } + } +} + +// CHECK-LABEL: @check_intermediate_passthrough( +#[no_mangle] +pub unsafe fn check_intermediate_passthrough(x: u32) -> i32 { + // CHECK: start + // CHECK: %[[TMP:.+]] = add i32 1, %x + // CHECK: %[[RET:.+]] = add i32 %[[TMP]], 1 + // CHECK: ret i32 %[[RET]] + unsafe { + transmute::(1 + x) + 1 + } +} + +// CHECK-LABEL: @check_nop_pair( +#[no_mangle] +pub unsafe fn check_nop_pair(x: (u8, i8)) -> (i8, u8) { + // CHECK-NOT: alloca + // CHECK: %0 = insertvalue { i8, i8 } poison, i8 %x.0, 0 + // CHECK: %1 = insertvalue { i8, i8 } %0, i8 %x.1, 1 + // CHECK: ret { i8, i8 } %1 + unsafe { + transmute(x) + } +} + +// CHECK-LABEL: @check_to_newtype( +#[no_mangle] +pub unsafe fn check_to_newtype(x: u64) -> Scalar64 { + // CHECK-NOT: alloca + // CHECK: ret i64 %x + transmute(x) +} + +// CHECK-LABEL: @check_from_newtype( +#[no_mangle] +pub unsafe fn check_from_newtype(x: Scalar64) -> u64 { + // CHECK-NOT: alloca + // CHECK: ret i64 %x + transmute(x) +} + +// CHECK-LABEL: @check_aggregate_to_bool( +#[no_mangle] +pub unsafe fn check_aggregate_to_bool(x: Aggregate8) -> bool { + // CHECK: %x = alloca %Aggregate8, align 1 + // CHECK: %[[BYTE:.+]] = load i8, ptr %x, align 1 + // CHECK: %[[BOOL:.+]] = trunc i8 %[[BYTE]] to i1 + // CHECK: ret i1 %[[BOOL]] + transmute(x) +} + +// CHECK-LABEL: @check_aggregate_from_bool( +#[no_mangle] +pub unsafe fn check_aggregate_from_bool(x: bool) -> Aggregate8 { + // CHECK: %0 = alloca %Aggregate8, align 1 + // CHECK: %[[BYTE:.+]] = zext i1 %x to i8 + // CHECK: store i8 %[[BYTE]], ptr %0, align 1 + transmute(x) +} + +// CHECK-LABEL: @check_byte_to_bool( +#[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 + transmute(x) +} + +// CHECK-LABEL: @check_byte_from_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 + transmute(x) +} + +// CHECK-LABEL: @check_to_pair( +#[no_mangle] +pub unsafe fn check_to_pair(x: u64) -> Option { + // CHECK: %0 = alloca { i32, i32 }, align 4 + // CHECK: store i64 %x, ptr %0, align 4 + transmute(x) +} + +// CHECK-LABEL: @check_from_pair( +#[no_mangle] +pub unsafe fn check_from_pair(x: Option) -> u64 { + // The two arguments are of types that are only 4-aligned, but they're + // immediates so we can write using the destination alloca's alignment. + const { assert!(std::mem::align_of::>() == 4) }; + + // CHECK: %0 = alloca i64, align 8 + // CHECK: store i32 %x.0, ptr %1, align 8 + // CHECK: store i32 %x.1, ptr %2, align 4 + // CHECK: %3 = load i64, ptr %0, align 8 + // CHECK: ret i64 %3 + transmute(x) +} + +// CHECK-LABEL: @check_to_float( +#[no_mangle] +pub unsafe fn check_to_float(x: u32) -> f32 { + // CHECK-NOT: alloca + // CHECK: %0 = bitcast i32 %x to float + // CHECK: ret float %0 + transmute(x) +} + +// CHECK-LABEL: @check_from_float( +#[no_mangle] +pub unsafe fn check_from_float(x: f32) -> u32 { + // CHECK-NOT: alloca + // CHECK: %0 = bitcast float %x to i32 + // CHECK: ret i32 %0 + transmute(x) +} + +// CHECK-LABEL: @check_to_bytes( +#[no_mangle] +pub unsafe fn check_to_bytes(x: u32) -> [u8; 4] { + // CHECK: %0 = alloca [4 x i8], align 1 + // CHECK: store i32 %x, ptr %0, align 1 + transmute(x) +} + +// CHECK-LABEL: @check_from_bytes( +#[no_mangle] +pub unsafe fn check_from_bytes(x: [u8; 4]) -> u32 { + // CHECK: %x = alloca [4 x i8], align 1 + // CHECK: %[[VAL:.+]] = load i32, ptr %x, align 1 + // CHECK: ret i32 %[[VAL]] + transmute(x) +} + +// CHECK-LABEL: @check_to_aggregate( +#[no_mangle] +pub unsafe fn check_to_aggregate(x: u64) -> Aggregate64 { + // CHECK: %0 = alloca %Aggregate64, align 4 + // CHECK: store i64 %x, ptr %0, align 4 + // CHECK: %1 = load i64, ptr %0, align 4 + // CHECK: ret i64 %1 + transmute(x) +} + +// CHECK-LABEL: @check_from_aggregate( +#[no_mangle] +pub unsafe fn check_from_aggregate(x: Aggregate64) -> u64 { + // CHECK: %x = alloca %Aggregate64, align 4 + // CHECK: %[[VAL:.+]] = load i64, ptr %x, align 4 + // CHECK: ret i64 %[[VAL]] + transmute(x) +} + +// CHECK-LABEL: @check_long_array_less_aligned( +#[no_mangle] +pub unsafe fn check_long_array_less_aligned(x: [u64; 100]) -> [u16; 400] { + // CHECK-NEXT: start + // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 2 %0, ptr align 8 %x, i64 800, i1 false) + // CHECK-NEXT: ret void + transmute(x) +} + +// CHECK-LABEL: @check_long_array_more_aligned( +#[no_mangle] +pub unsafe fn check_long_array_more_aligned(x: [u8; 100]) -> [u32; 25] { + // CHECK-NEXT: start + // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %0, ptr align 1 %x, i64 100, i1 false) + // CHECK-NEXT: ret void + transmute(x) +} + +// CHECK-LABEL: @check_pair_with_bool( +#[no_mangle] +pub unsafe fn check_pair_with_bool(x: (u8, bool)) -> (bool, i8) { + // CHECK-NOT: alloca + // CHECK: trunc i8 %x.0 to i1 + // CHECK: zext i1 %x.1 to i8 + transmute(x) +} + +// CHECK-LABEL: @check_float_to_pointer( +#[no_mangle] +pub unsafe fn check_float_to_pointer(x: f64) -> *const () { + // CHECK-NOT: alloca + // CHECK: %0 = bitcast double %x to i64 + // CHECK: %1 = inttoptr i64 %0 to ptr + // CHECK: ret ptr %1 + transmute(x) +} + +// CHECK-LABEL: @check_float_from_pointer( +#[no_mangle] +pub unsafe fn check_float_from_pointer(x: *const ()) -> f64 { + // CHECK-NOT: alloca + // CHECK: %0 = ptrtoint ptr %x to i64 + // CHECK: %1 = bitcast i64 %0 to double + // CHECK: ret double %1 + transmute(x) +} + +// CHECK-LABEL: @check_array_to_pair( +#[no_mangle] +pub unsafe fn check_array_to_pair(x: [u8; 16]) -> (i64, u64) { + // CHECK-NOT: alloca + // CHECK: %[[FST:.+]] = load i64, ptr %{{.+}}, align 1, !noundef ! + // CHECK: %[[SND:.+]] = load i64, ptr %{{.+}}, align 1, !noundef ! + // CHECK: %[[PAIR0:.+]] = insertvalue { i64, i64 } poison, i64 %[[FST]], 0 + // CHECK: %[[PAIR01:.+]] = insertvalue { i64, i64 } %[[PAIR0]], i64 %[[SND]], 1 + // CHECK: ret { i64, i64 } %[[PAIR01]] + transmute(x) +} + +// CHECK-LABEL: @check_pair_to_array( +#[no_mangle] +pub unsafe fn check_pair_to_array(x: (i64, u64)) -> [u8; 16] { + // CHECK-NOT: alloca + // CHECK: store i64 %x.0, ptr %{{.+}}, align 1 + // CHECK: store i64 %x.1, ptr %{{.+}}, align 1 + transmute(x) +} + +// CHECK-LABEL: @check_heterogeneous_integer_pair( +#[no_mangle] +pub unsafe fn check_heterogeneous_integer_pair(x: (i32, bool)) -> (bool, u32) { + // CHECK: store i32 %x.0 + // CHECK: %[[WIDER:.+]] = zext i1 %x.1 to i8 + // CHECK: store i8 %[[WIDER]] + + // CHECK: %[[BYTE:.+]] = load i8 + // CHECK: trunc i8 %[[BYTE:.+]] to i1 + // CHECK: load i32 + transmute(x) +} + +// CHECK-LABEL: @check_heterogeneous_float_pair( +#[no_mangle] +pub unsafe fn check_heterogeneous_float_pair(x: (f64, f32)) -> (f32, f64) { + // CHECK: store double %x.0 + // CHECK: store float %x.1 + // CHECK: %[[A:.+]] = load float + // CHECK: %[[B:.+]] = load double + // CHECK: %[[P:.+]] = insertvalue { float, double } poison, float %[[A]], 0 + // CHECK: insertvalue { float, double } %[[P]], double %[[B]], 1 + transmute(x) +} + +// CHECK-LABEL: @check_issue_110005( +#[no_mangle] +pub unsafe fn check_issue_110005(x: (usize, bool)) -> Option> { + // CHECK: store i64 %x.0 + // CHECK: %[[WIDER:.+]] = zext i1 %x.1 to i8 + // CHECK: store i8 %[[WIDER]] + // CHECK: load ptr + // CHECK: load i64 + transmute(x) +} + +// CHECK-LABEL: @check_pair_to_dst_ref( +#[no_mangle] +pub unsafe fn check_pair_to_dst_ref<'a>(x: (usize, usize)) -> &'a [u8] { + // CHECK: %0 = inttoptr i64 %x.0 to ptr + // CHECK: %1 = insertvalue { ptr, i64 } poison, ptr %0, 0 + // CHECK: %2 = insertvalue { ptr, i64 } %1, i64 %x.1, 1 + // CHECK: ret { ptr, i64 } %2 + transmute(x) +} + +// CHECK-LABEL: @check_issue_109992( +#[no_mangle] +#[custom_mir(dialect = "runtime", phase = "optimized")] +pub unsafe fn check_issue_109992(x: ()) -> [(); 1] { + // This uses custom MIR to avoid MIR optimizations having removed ZST ops. + + // CHECK: start + // CHECK-NEXT: ret void + mir!{ + { + RET = CastTransmute(x); + Return() + } + } +} + +// CHECK-LABEL: @check_maybe_uninit_pair(i16 %x.0, i64 %x.1) +#[no_mangle] +pub unsafe fn check_maybe_uninit_pair( + x: (MaybeUninit, MaybeUninit), +) -> (MaybeUninit, MaybeUninit) { + // Thanks to `MaybeUninit` this is actually defined behaviour, + // unlike the examples above with pairs of primitives. + + // CHECK: store i16 %x.0 + // CHECK: store i64 %x.1 + // CHECK: load i64 + // CHECK-NOT: noundef + // CHECK: load i16 + // CHECK-NOT: noundef + // CHECK: ret { i64, i16 } + transmute(x) +} + +#[repr(align(8))] +pub struct HighAlignScalar(u8); + +// CHECK-LABEL: @check_to_overalign( +#[no_mangle] +pub unsafe fn check_to_overalign(x: u64) -> HighAlignScalar { + // CHECK: %0 = alloca %HighAlignScalar, align 8 + // CHECK: store i64 %x, ptr %0, align 8 + // CHECK: %1 = load i64, ptr %0, align 8 + // CHECK: ret i64 %1 + transmute(x) +} + +// CHECK-LABEL: @check_from_overalign( +#[no_mangle] +pub unsafe fn check_from_overalign(x: HighAlignScalar) -> u64 { + // CHECK: %x = alloca %HighAlignScalar, align 8 + // CHECK: %[[VAL:.+]] = load i64, ptr %x, align 8 + // CHECK: ret i64 %[[VAL]] + transmute(x) +} diff --git a/tests/codegen/issue-103285-ptr-addr-overflow-check.rs b/tests/codegen/issue-103285-ptr-addr-overflow-check.rs deleted file mode 100644 index a3499babe..000000000 --- a/tests/codegen/issue-103285-ptr-addr-overflow-check.rs +++ /dev/null @@ -1,16 +0,0 @@ -// compile-flags: -O -C debug-assertions=yes - -#![crate_type = "lib"] -#![feature(strict_provenance)] - -#[no_mangle] -pub fn test(src: *const u8, dst: *const u8) -> usize { - // CHECK-LABEL: @test( - // CHECK-NOT: panic - let src_usize = src.addr(); - let dst_usize = dst.addr(); - if src_usize > dst_usize { - return src_usize - dst_usize; - } - return 0; -} diff --git a/tests/codegen/issue-103840.rs b/tests/codegen/issue-103840.rs deleted file mode 100644 index f19d7031b..000000000 --- a/tests/codegen/issue-103840.rs +++ /dev/null @@ -1,9 +0,0 @@ -// compile-flags: -O -#![crate_type = "lib"] - -pub fn foo(t: &mut Vec) { - // CHECK-NOT: __rust_dealloc - let mut taken = std::mem::take(t); - taken.pop(); - *t = taken; -} diff --git a/tests/codegen/issue-105386-ub-in-debuginfo.rs b/tests/codegen/issue-105386-ub-in-debuginfo.rs deleted file mode 100644 index d54ac9e33..000000000 --- a/tests/codegen/issue-105386-ub-in-debuginfo.rs +++ /dev/null @@ -1,22 +0,0 @@ -// compile-flags: --crate-type=lib -O -Cdebuginfo=2 -Cno-prepopulate-passes -// min-llvm-version: 15.0 # this test uses opaque pointer notation -#![feature(stmt_expr_attributes)] - -pub struct S([usize; 8]); - -#[no_mangle] -pub fn outer_function(x: S, y: S) -> usize { - (#[inline(always)]|| { - let _z = x; - y.0[0] - })() -} - -// Check that we do not attempt to load from the spilled arg before it is assigned to -// when generating debuginfo. -// CHECK-LABEL: @outer_function -// CHECK: [[spill:%.*]] = alloca %"[closure@{{.*.rs}}:9:23: 9:25]" -// 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 diff --git a/tests/codegen/issue-13018.rs b/tests/codegen/issue-13018.rs deleted file mode 100644 index b70ea1f48..000000000 --- a/tests/codegen/issue-13018.rs +++ /dev/null @@ -1,11 +0,0 @@ -// compile-flags: -O - -// A drop([...].clone()) sequence on an Rc should be a no-op -// In particular, no call to __rust_dealloc should be emitted -#![crate_type = "lib"] -use std::rc::Rc; - -pub fn foo(t: &Rc>) { -// CHECK-NOT: __rust_dealloc - drop(t.clone()); -} diff --git a/tests/codegen/issue-15953.rs b/tests/codegen/issue-15953.rs deleted file mode 100644 index 28d284289..000000000 --- a/tests/codegen/issue-15953.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Test that llvm generates `memcpy` for moving a value -// inside a function and moving an argument. - -struct Foo { - x: Vec, -} - -#[inline(never)] -#[no_mangle] -// CHECK: memcpy -fn interior(x: Vec) -> Vec { - let Foo { x } = Foo { x: x }; - x -} - -#[inline(never)] -#[no_mangle] -// CHECK: memcpy -fn exterior(x: Vec) -> Vec { - x -} - -fn main() { - let x = interior(Vec::new()); - println!("{:?}", x); - - let x = exterior(Vec::new()); - println!("{:?}", x); -} diff --git a/tests/codegen/issue-27130.rs b/tests/codegen/issue-27130.rs deleted file mode 100644 index e5ee94e1f..000000000 --- a/tests/codegen/issue-27130.rs +++ /dev/null @@ -1,21 +0,0 @@ -// compile-flags: -O - -#![crate_type = "lib"] - -// CHECK-LABEL: @trim_in_place -#[no_mangle] -pub fn trim_in_place(a: &mut &[u8]) { - while a.first() == Some(&42) { - // CHECK-NOT: slice_index_order_fail - *a = &a[1..]; - } -} - -// CHECK-LABEL: @trim_in_place2 -#[no_mangle] -pub fn trim_in_place2(a: &mut &[u8]) { - while let Some(&42) = a.first() { - // CHECK-NOT: slice_index_order_fail - *a = &a[2..]; - } -} diff --git a/tests/codegen/issue-32031.rs b/tests/codegen/issue-32031.rs deleted file mode 100644 index abef92c19..000000000 --- a/tests/codegen/issue-32031.rs +++ /dev/null @@ -1,23 +0,0 @@ -// compile-flags: -C no-prepopulate-passes -Copt-level=0 - -#![crate_type = "lib"] - -#[no_mangle] -pub struct F32(f32); - -// CHECK: define{{.*}}float @add_newtype_f32(float %a, float %b) -#[inline(never)] -#[no_mangle] -pub fn add_newtype_f32(a: F32, b: F32) -> F32 { - F32(a.0 + b.0) -} - -#[no_mangle] -pub struct F64(f64); - -// CHECK: define{{.*}}double @add_newtype_f64(double %a, double %b) -#[inline(never)] -#[no_mangle] -pub fn add_newtype_f64(a: F64, b: F64) -> F64 { - F64(a.0 + b.0) -} diff --git a/tests/codegen/issue-32364.rs b/tests/codegen/issue-32364.rs deleted file mode 100644 index 85493a4bb..000000000 --- a/tests/codegen/issue-32364.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Test that `extern "stdcall"` is properly translated. - -// only-x86 - -// compile-flags: -C no-prepopulate-passes - -struct Foo; - -impl Foo { -// CHECK: define internal x86_stdcallcc void @{{.*}}foo{{.*}}() - #[inline(never)] - pub extern "stdcall" fn foo() { - } -} - -fn main() { - Foo::foo::(); -} diff --git a/tests/codegen/issue-34634.rs b/tests/codegen/issue-34634.rs deleted file mode 100644 index f53fa240c..000000000 --- a/tests/codegen/issue-34634.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Test that `wrapping_div` only checks divisor once. -// This test checks that there is only a single compare against -1 and -1 is not present as a -// switch case (the second check present until rustc 1.12). -// This test also verifies that a single panic call is generated (for the division by zero case). - -// compile-flags: -O -#![crate_type = "lib"] - -// CHECK-LABEL: @f -#[no_mangle] -pub fn f(x: i32, y: i32) -> i32 { - // CHECK-COUNT-1: icmp eq i32 %y, -1 - // CHECK-COUNT-1: panic - // CHECK-NOT: i32 -1, label - x.wrapping_div(y) -} diff --git a/tests/codegen/issue-34947-pow-i32.rs b/tests/codegen/issue-34947-pow-i32.rs deleted file mode 100644 index 653da8e8b..000000000 --- a/tests/codegen/issue-34947-pow-i32.rs +++ /dev/null @@ -1,13 +0,0 @@ -// compile-flags: -O - -#![crate_type = "lib"] - -// CHECK-LABEL: @issue_34947 -#[no_mangle] -pub fn issue_34947(x: i32) -> i32 { - // CHECK: mul - // CHECK-NEXT: mul - // CHECK-NEXT: mul - // CHECK-NEXT: ret - x.pow(5) -} diff --git a/tests/codegen/issue-37945.rs b/tests/codegen/issue-37945.rs deleted file mode 100644 index fe54375bb..000000000 --- a/tests/codegen/issue-37945.rs +++ /dev/null @@ -1,38 +0,0 @@ -// compile-flags: -O -Zmerge-functions=disabled -// ignore-x86 -// ignore-arm -// ignore-emscripten -// ignore-gnux32 -// ignore 32-bit platforms (LLVM has a bug with them) - -// Check that LLVM understands that `Iter` pointer is not null. Issue #37945. - -#![crate_type = "lib"] - -use std::slice::Iter; - -#[no_mangle] -pub fn is_empty_1(xs: Iter) -> bool { -// CHECK-LABEL: @is_empty_1( -// CHECK-NEXT: start: -// CHECK-NEXT: [[A:%.*]] = icmp ne {{i32\*|ptr}} {{%xs.0|%xs.1}}, null -// CHECK-NEXT: tail call void @llvm.assume(i1 [[A]]) -// The order between %xs.0 and %xs.1 on the next line doesn't matter -// and different LLVM versions produce different order. -// CHECK-NEXT: [[B:%.*]] = icmp eq {{i32\*|ptr}} {{%xs.0, %xs.1|%xs.1, %xs.0}} -// CHECK-NEXT: ret i1 [[B:%.*]] - {xs}.next().is_none() -} - -#[no_mangle] -pub fn is_empty_2(xs: Iter) -> bool { -// CHECK-LABEL: @is_empty_2 -// CHECK-NEXT: start: -// CHECK-NEXT: [[C:%.*]] = icmp ne {{i32\*|ptr}} {{%xs.0|%xs.1}}, null -// CHECK-NEXT: tail call void @llvm.assume(i1 [[C]]) -// The order between %xs.0 and %xs.1 on the next line doesn't matter -// and different LLVM versions produce different order. -// CHECK-NEXT: [[D:%.*]] = icmp eq {{i32\*|ptr}} {{%xs.0, %xs.1|%xs.1, %xs.0}} -// CHECK-NEXT: ret i1 [[D:%.*]] - xs.map(|&x| x).next().is_none() -} diff --git a/tests/codegen/issue-44056-macos-tls-align.rs b/tests/codegen/issue-44056-macos-tls-align.rs deleted file mode 100644 index 1a3923f1b..000000000 --- a/tests/codegen/issue-44056-macos-tls-align.rs +++ /dev/null @@ -1,28 +0,0 @@ -// -// only-macos -// no-system-llvm -// compile-flags: -O - -#![crate_type = "rlib"] -#![feature(thread_local)] - -// local_unnamed_addr does not appear when std is built with debug assertions. -// CHECK: @STATIC_VAR_1 = thread_local {{(local_unnamed_addr )?}}global <{ [32 x i8] }> zeroinitializer, section "__DATA,__thread_bss", align 4 -#[no_mangle] -#[thread_local] -static mut STATIC_VAR_1: [u32; 8] = [0; 8]; - -// CHECK: @STATIC_VAR_2 = thread_local {{(local_unnamed_addr )?}}global <{ [32 x i8] }> <{{[^>]*}}>, section "__DATA,__thread_data", align 4 -#[no_mangle] -#[thread_local] -static mut STATIC_VAR_2: [u32; 8] = [4; 8]; - -#[no_mangle] -pub unsafe fn f(x: &mut [u32; 8]) { - std::mem::swap(x, &mut STATIC_VAR_1) -} - -#[no_mangle] -pub unsafe fn g(x: &mut [u32; 8]) { - std::mem::swap(x, &mut STATIC_VAR_2) -} diff --git a/tests/codegen/issue-45222.rs b/tests/codegen/issue-45222.rs deleted file mode 100644 index e9b05e648..000000000 --- a/tests/codegen/issue-45222.rs +++ /dev/null @@ -1,63 +0,0 @@ -// compile-flags: -O -// ignore-debug: the debug assertions get in the way - -#![crate_type = "lib"] - -// verify that LLVM recognizes a loop involving 0..=n and will const-fold it. - -// Example from original issue #45222 - -fn foo2(n: u64) -> u64 { - let mut count = 0; - for _ in 0..n { - for j in (0..=n).rev() { - count += j; - } - } - count -} - -// CHECK-LABEL: @check_foo2 -#[no_mangle] -pub fn check_foo2() -> u64 { - // CHECK: ret i64 500005000000000 - foo2(100000) -} - -// Simplified example of #45222 -// -// Temporarily disabled in #68835 to fix a soundness hole. -// -// fn triangle_inc(n: u64) -> u64 { -// let mut count = 0; -// for j in 0 ..= n { -// count += j; -// } -// count -// } -// -// // COMMENTEDCHECK-LABEL: @check_triangle_inc -// #[no_mangle] -// pub fn check_triangle_inc() -> u64 { -// // COMMENTEDCHECK: ret i64 5000050000 -// triangle_inc(100000) -// } - -// Demo in #48012 - -fn foo3r(n: u64) -> u64 { - let mut count = 0; - (0..n).for_each(|_| { - (0..=n).rev().for_each(|j| { - count += j; - }) - }); - count -} - -// CHECK-LABEL: @check_foo3r -#[no_mangle] -pub fn check_foo3r() -> u64 { - // CHECK: ret i64 500050000000 - foo3r(10000) -} diff --git a/tests/codegen/issue-45466.rs b/tests/codegen/issue-45466.rs deleted file mode 100644 index c79542767..000000000 --- a/tests/codegen/issue-45466.rs +++ /dev/null @@ -1,15 +0,0 @@ -// compile-flags: -O -// ignore-debug: the debug assertions get in the way - -#![crate_type="rlib"] - -// CHECK-LABEL: @memzero -// CHECK-NOT: store -// CHECK: call void @llvm.memset -// CHECK-NOT: store -#[no_mangle] -pub fn memzero(data: &mut [u8]) { - for i in 0..data.len() { - data[i] = 0; - } -} diff --git a/tests/codegen/issue-45964-bounds-check-slice-pos.rs b/tests/codegen/issue-45964-bounds-check-slice-pos.rs deleted file mode 100644 index 1daa213fc..000000000 --- a/tests/codegen/issue-45964-bounds-check-slice-pos.rs +++ /dev/null @@ -1,39 +0,0 @@ -// This test case checks that slice::{r}position functions do not -// prevent optimizing away bounds checks - -// compile-flags: -O -// ignore-debug: the debug assertions get in the way - -#![crate_type="rlib"] - -// CHECK-LABEL: @test -#[no_mangle] -pub fn test(y: &[u32], x: &u32, z: &u32) -> bool { - let result = match y.iter().position(|a| a == x) { - Some(p) => Ok(p), - None => Err(()), - }; - - if let Ok(p) = result { - // CHECK-NOT: panic - y[p] == *z - } else { - false - } -} - -// CHECK-LABEL: @rtest -#[no_mangle] -pub fn rtest(y: &[u32], x: &u32, z: &u32) -> bool { - let result = match y.iter().rposition(|a| a == x) { - Some(p) => Ok(p), - None => Err(()), - }; - - if let Ok(p) = result { - // CHECK-NOT: panic - y[p] == *z - } else { - false - } -} diff --git a/tests/codegen/issue-47278.rs b/tests/codegen/issue-47278.rs deleted file mode 100644 index 9076274f4..000000000 --- a/tests/codegen/issue-47278.rs +++ /dev/null @@ -1,9 +0,0 @@ -// -C no-prepopulate-passes -#![crate_type="staticlib"] - -#[repr(C)] -pub struct Foo(u64); - -// CHECK: define {{.*}} @foo( -#[no_mangle] -pub extern "C" fn foo(_: Foo) -> Foo { loop {} } diff --git a/tests/codegen/issue-47442.rs b/tests/codegen/issue-47442.rs deleted file mode 100644 index 6944336d3..000000000 --- a/tests/codegen/issue-47442.rs +++ /dev/null @@ -1,22 +0,0 @@ -// check that we don't emit unneeded `resume` cleanup blocks for every -// destructor. - -// CHECK-NOT: Unwind - -#![feature(test)] -#![crate_type="rlib"] - -extern crate test; - -struct Foo {} - -impl Drop for Foo { - fn drop(&mut self) { - test::black_box(()); - } -} - -#[no_mangle] -pub fn foo() { - let _foo = Foo {}; -} diff --git a/tests/codegen/issue-56267-2.rs b/tests/codegen/issue-56267-2.rs deleted file mode 100644 index 4dc9ebfeb..000000000 --- a/tests/codegen/issue-56267-2.rs +++ /dev/null @@ -1,18 +0,0 @@ -// compile-flags: -C no-prepopulate-passes - -#![crate_type="rlib"] - -#[allow(dead_code)] -pub struct Foo { - foo: u64, - bar: T, -} - -// The load from bar.1 should have alignment 4. Not checking -// other loads here, as the alignment will be platform-dependent. - -// CHECK: %{{.+}} = load i32, {{i32\*|ptr}} %{{.+}}, align 4 -#[no_mangle] -pub fn test(x: Foo<(i32, i32)>) -> (i32, i32) { - x.bar -} diff --git a/tests/codegen/issue-56267.rs b/tests/codegen/issue-56267.rs deleted file mode 100644 index 7bdd25779..000000000 --- a/tests/codegen/issue-56267.rs +++ /dev/null @@ -1,18 +0,0 @@ -// compile-flags: -C no-prepopulate-passes - -#![crate_type="rlib"] - -#[allow(dead_code)] -pub struct Foo { - foo: u64, - bar: T, -} - -// The store writing to bar.1 should have alignment 4. Not checking -// other stores here, as the alignment will be platform-dependent. - -// CHECK: store i32 [[TMP1:%.+]], {{i32\*|ptr}} [[TMP2:%.+]], align 4 -#[no_mangle] -pub fn test(x: (i32, i32)) -> Foo<(i32, i32)> { - Foo { foo: 0, bar: x } -} diff --git a/tests/codegen/issue-56927.rs b/tests/codegen/issue-56927.rs deleted file mode 100644 index 044d72181..000000000 --- a/tests/codegen/issue-56927.rs +++ /dev/null @@ -1,43 +0,0 @@ -// compile-flags: -C no-prepopulate-passes - -#![crate_type="rlib"] - -#[repr(align(16))] -pub struct S { - arr: [u32; 4], -} - -// CHECK-LABEL: @test1 -// CHECK: store i32 0, {{i32\*|ptr}} %{{.+}}, align 16 -// CHECK: store i32 1, {{i32\*|ptr}} %{{.+}}, align 4 -// CHECK: store i32 2, {{i32\*|ptr}} %{{.+}}, align 8 -// CHECK: store i32 3, {{i32\*|ptr}} %{{.+}}, align 4 -#[no_mangle] -pub fn test1(s: &mut S) { - s.arr[0] = 0; - s.arr[1] = 1; - s.arr[2] = 2; - s.arr[3] = 3; -} - -// CHECK-LABEL: @test2 -// CHECK: store i32 4, {{i32\*|ptr}} %{{.+}}, align 4 -#[allow(unconditional_panic)] -#[no_mangle] -pub fn test2(s: &mut S) { - s.arr[usize::MAX / 4 + 1] = 4; -} - -// CHECK-LABEL: @test3 -// CHECK: store i32 5, {{i32\*|ptr}} %{{.+}}, align 4 -#[no_mangle] -pub fn test3(s: &mut S, i: usize) { - s.arr[i] = 5; -} - -// CHECK-LABEL: @test4 -// CHECK: store i32 6, {{i32\*|ptr}} %{{.+}}, align 4 -#[no_mangle] -pub fn test4(s: &mut S) { - s.arr = [6; 4]; -} diff --git a/tests/codegen/issue-58881.rs b/tests/codegen/issue-58881.rs deleted file mode 100644 index 00f8953d9..000000000 --- a/tests/codegen/issue-58881.rs +++ /dev/null @@ -1,21 +0,0 @@ -// compile-flags: -C no-prepopulate-passes -Copt-level=0 -// -// only-x86_64 -// ignore-windows - -#![crate_type = "lib"] - -extern "C" { - fn variadic_fn(_: i32, ...); -} - -#[repr(C)] -struct Foo(u8); -#[repr(C)] -struct Bar(u64, u64, u64); - -// Ensure that emit arguments of the correct type. -pub unsafe fn test_call_variadic() { - // CHECK: call void (i32, ...) @variadic_fn(i32 0, i8 {{.*}}, {{%Bar\*|ptr}} {{.*}}) - variadic_fn(0, Foo(0), Bar(0, 0, 0)) -} diff --git a/tests/codegen/issue-59352.rs b/tests/codegen/issue-59352.rs deleted file mode 100644 index d271fe027..000000000 --- a/tests/codegen/issue-59352.rs +++ /dev/null @@ -1,18 +0,0 @@ -// This test is a mirror of mir-opt/issues/issue-59352.rs. The LLVM inliner doesn't inline -// `char::method::is_digit()` and `char::method::to_digit()`, probably because of their size. -// -// Currently, the MIR optimizer isn't capable of removing the unreachable panic in this test case. -// Once the optimizer can do that, mir-opt/issues/issue-59352.rs will need to be updated and this -// test case should be removed as it will become redundant. - -// mir-opt-level=3 enables inlining and enables LLVM to optimize away the unreachable panic call. -// compile-flags: -O -Z mir-opt-level=3 - -#![crate_type = "rlib"] - -// CHECK-LABEL: @num_to_digit -#[no_mangle] -pub fn num_to_digit(num: char) -> u32 { - // CHECK-NOT: panic - if num.is_digit(8) { num.to_digit(8).unwrap() } else { 0 } -} diff --git a/tests/codegen/issue-69101-bounds-check.rs b/tests/codegen/issue-69101-bounds-check.rs deleted file mode 100644 index a3aca3a29..000000000 --- a/tests/codegen/issue-69101-bounds-check.rs +++ /dev/null @@ -1,44 +0,0 @@ -// no-system-llvm -// compile-flags: -O -// ignore-debug: the debug assertions get in the way -#![crate_type = "lib"] - -// Make sure no bounds checks are emitted in the loop when upfront slicing -// ensures that the slices are big enough. -// In particular, bounds checks were not always optimized out if the upfront -// check was for a greater len than the loop requires. -// (i.e. `already_sliced_no_bounds_check` was not always optimized even when -// `already_sliced_no_bounds_check_exact` was) -// CHECK-LABEL: @already_sliced_no_bounds_check -#[no_mangle] -pub fn already_sliced_no_bounds_check(a: &[u8], b: &[u8], c: &mut [u8]) { - // CHECK: slice_end_index_len_fail - // CHECK-NOT: panic_bounds_check - let _ = (&a[..2048], &b[..2048], &mut c[..2048]); - for i in 0..1024 { - c[i] = a[i] ^ b[i]; - } -} - -// CHECK-LABEL: @already_sliced_no_bounds_check_exact -#[no_mangle] -pub fn already_sliced_no_bounds_check_exact(a: &[u8], b: &[u8], c: &mut [u8]) { - // CHECK: slice_end_index_len_fail - // CHECK-NOT: panic_bounds_check - let _ = (&a[..1024], &b[..1024], &mut c[..1024]); - for i in 0..1024 { - c[i] = a[i] ^ b[i]; - } -} - -// Make sure we're checking for the right thing: there can be a panic if the slice is too small. -// CHECK-LABEL: @already_sliced_bounds_check -#[no_mangle] -pub fn already_sliced_bounds_check(a: &[u8], b: &[u8], c: &mut [u8]) { - // CHECK: slice_end_index_len_fail - // CHECK: panic_bounds_check - let _ = (&a[..1023], &b[..2048], &mut c[..2048]); - for i in 0..1024 { - c[i] = a[i] ^ b[i]; - } -} diff --git a/tests/codegen/issue-73031.rs b/tests/codegen/issue-73031.rs deleted file mode 100644 index a09c4bcfb..000000000 --- a/tests/codegen/issue-73031.rs +++ /dev/null @@ -1,26 +0,0 @@ -// compile-flags: -O -#![crate_type = "lib"] - -// Test that LLVM can eliminate the unreachable `All::None` branch. - -pub enum All { - None, - Foo, - Bar, -} - -// CHECK-LABEL: @issue_73031 -#[no_mangle] -pub fn issue_73031(a: &mut All, q: i32) -> i32 { - *a = if q == 5 { - All::Foo - } else { - All::Bar - }; - match *a { - // CHECK-NOT: panic - All::None => panic!(), - All::Foo => 1, - All::Bar => 2, - } -} diff --git a/tests/codegen/issue-73338-effecient-cmp.rs b/tests/codegen/issue-73338-effecient-cmp.rs deleted file mode 100644 index 85c2bbfd0..000000000 --- a/tests/codegen/issue-73338-effecient-cmp.rs +++ /dev/null @@ -1,39 +0,0 @@ -// This test checks that comparison operation -// generated by #[derive(PartialOrd)] -// doesn't contain jumps for C enums - -// compile-flags: -Copt-level=3 - -#![crate_type="lib"] - -#[repr(u32)] -#[derive(Copy, Clone, Eq, PartialEq, PartialOrd)] -pub enum Foo { - Zero, - One, - Two, -} - -#[no_mangle] -pub fn compare_less(a: Foo, b: Foo)->bool{ - // CHECK-NOT: br {{.*}} - a < b -} - -#[no_mangle] -pub fn compare_le(a: Foo, b: Foo)->bool{ - // CHECK-NOT: br {{.*}} - a <= b -} - -#[no_mangle] -pub fn compare_ge(a: Foo, b: Foo)->bool{ - // CHECK-NOT: br {{.*}} - a >= b -} - -#[no_mangle] -pub fn compare_greater(a: Foo, b: Foo)->bool{ - // CHECK-NOT: br {{.*}} - a > b -} diff --git a/tests/codegen/issue-73396-bounds-check-after-position.rs b/tests/codegen/issue-73396-bounds-check-after-position.rs deleted file mode 100644 index 8d07a67a1..000000000 --- a/tests/codegen/issue-73396-bounds-check-after-position.rs +++ /dev/null @@ -1,77 +0,0 @@ -// compile-flags: -O -// ignore-debug: the debug assertions get in the way -#![crate_type = "lib"] - -// Make sure no bounds checks are emitted when slicing or indexing -// with an index from `position()` or `rposition()`. - -// CHECK-LABEL: @position_slice_to_no_bounds_check -#[no_mangle] -pub fn position_slice_to_no_bounds_check(s: &[u8]) -> &[u8] { - // CHECK-NOT: panic - // CHECK-NOT: slice_index_len_fail - if let Some(idx) = s.iter().position(|b| *b == b'\\') { - &s[..idx] - } else { - s - } -} - -// CHECK-LABEL: @position_slice_from_no_bounds_check -#[no_mangle] -pub fn position_slice_from_no_bounds_check(s: &[u8]) -> &[u8] { - // CHECK-NOT: panic - // CHECK-NOT: slice_index_len_fail - if let Some(idx) = s.iter().position(|b| *b == b'\\') { - &s[idx..] - } else { - s - } -} - -// CHECK-LABEL: @position_index_no_bounds_check -#[no_mangle] -pub fn position_index_no_bounds_check(s: &[u8]) -> u8 { - // CHECK-NOT: panic - // CHECK-NOT: slice_index_len_fail - if let Some(idx) = s.iter().position(|b| *b == b'\\') { - s[idx] - } else { - 42 - } -} -// CHECK-LABEL: @rposition_slice_to_no_bounds_check -#[no_mangle] -pub fn rposition_slice_to_no_bounds_check(s: &[u8]) -> &[u8] { - // CHECK-NOT: panic - // CHECK-NOT: slice_index_len_fail - if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { - &s[..idx] - } else { - s - } -} - -// CHECK-LABEL: @rposition_slice_from_no_bounds_check -#[no_mangle] -pub fn rposition_slice_from_no_bounds_check(s: &[u8]) -> &[u8] { - // CHECK-NOT: panic - // CHECK-NOT: slice_index_len_fail - if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { - &s[idx..] - } else { - s - } -} - -// CHECK-LABEL: @rposition_index_no_bounds_check -#[no_mangle] -pub fn rposition_index_no_bounds_check(s: &[u8]) -> u8 { - // CHECK-NOT: panic - // CHECK-NOT: slice_index_len_fail - if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { - s[idx] - } else { - 42 - } -} diff --git a/tests/codegen/issue-73827-bounds-check-index-in-subexpr.rs b/tests/codegen/issue-73827-bounds-check-index-in-subexpr.rs deleted file mode 100644 index 1ad05906e..000000000 --- a/tests/codegen/issue-73827-bounds-check-index-in-subexpr.rs +++ /dev/null @@ -1,17 +0,0 @@ -// This test checks that bounds checks are elided when -// index is part of a (x | y) < C style condition - -// compile-flags: -O - -#![crate_type = "lib"] - -// CHECK-LABEL: @get -#[no_mangle] -pub fn get(array: &[u8; 8], x: usize, y: usize) -> u8 { - if x > 7 || y > 7 { - 0 - } else { - // CHECK-NOT: panic_bounds_check - array[y] - } -} diff --git a/tests/codegen/issue-75525-bounds-checks.rs b/tests/codegen/issue-75525-bounds-checks.rs deleted file mode 100644 index 2d363d8f7..000000000 --- a/tests/codegen/issue-75525-bounds-checks.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Regression test for #75525, verifies that no bounds checks are generated. - -// compile-flags: -O - -#![crate_type = "lib"] - -// CHECK-LABEL: @f0 -// CHECK-NOT: panic -#[no_mangle] -pub fn f0(idx: usize, buf: &[u8; 10]) -> u8 { - if idx < 8 { buf[idx + 1] } else { 0 } -} - -// CHECK-LABEL: @f1 -// CHECK-NOT: panic -#[no_mangle] -pub fn f1(idx: usize, buf: &[u8; 10]) -> u8 { - if idx > 5 && idx < 8 { buf[idx - 1] } else { 0 } -} - -// CHECK-LABEL: @f2 -// CHECK-NOT: panic -#[no_mangle] -pub fn f2(idx: usize, buf: &[u8; 10]) -> u8 { - if idx > 5 && idx < 8 { buf[idx] } else { 0 } -} diff --git a/tests/codegen/issue-75546.rs b/tests/codegen/issue-75546.rs deleted file mode 100644 index 470a9e040..000000000 --- a/tests/codegen/issue-75546.rs +++ /dev/null @@ -1,15 +0,0 @@ -// compile-flags: -O -#![crate_type = "lib"] - -// Test that LLVM can eliminate the impossible `i == 0` check. - -// CHECK-LABEL: @issue_75546 -#[no_mangle] -pub fn issue_75546() { - let mut i = 1u32; - while i < u32::MAX { - // CHECK-NOT: panic - if i == 0 { panic!(); } - i += 1; - } -} diff --git a/tests/codegen/issue-75659.rs b/tests/codegen/issue-75659.rs deleted file mode 100644 index 9394868c0..000000000 --- a/tests/codegen/issue-75659.rs +++ /dev/null @@ -1,63 +0,0 @@ -// This test checks that the call to memchr/slice_contains is optimized away -// when searching in small slices. - -// compile-flags: -O -Zinline-mir=false -// only-x86_64 - -#![crate_type = "lib"] - -// CHECK-LABEL: @foo1 -#[no_mangle] -pub fn foo1(x: u8, data: &[u8; 1]) -> bool { - // CHECK-NOT: memchr - // CHECK-NOT: slice_contains - data.contains(&x) -} - -// CHECK-LABEL: @foo2 -#[no_mangle] -pub fn foo2(x: u8, data: &[u8; 2]) -> bool { - // CHECK-NOT: memchr - // CHECK-NOT: slice_contains - data.contains(&x) -} - -// CHECK-LABEL: @foo3 -#[no_mangle] -pub fn foo3(x: u8, data: &[u8; 3]) -> bool { - // CHECK-NOT: memchr - // CHECK-NOT: slice_contains - data.contains(&x) -} - -// CHECK-LABEL: @foo4 -#[no_mangle] -pub fn foo4(x: u8, data: &[u8; 4]) -> bool { - // CHECK-NOT: memchr - // CHECK-NOT: slice_contains - data.contains(&x) -} - -// CHECK-LABEL: @foo8 -#[no_mangle] -pub fn foo8(x: u8, data: &[u8; 8]) -> bool { - // CHECK-NOT: memchr - // CHECK-NOT: slice_contains - data.contains(&x) -} - -// CHECK-LABEL: @foo8_i8 -#[no_mangle] -pub fn foo8_i8(x: i8, data: &[i8; 8]) -> bool { - // CHECK-NOT: memchr - // CHECK-NOT: slice_contains - !data.contains(&x) -} - -// Check that the general case isn't inlined -// CHECK-LABEL: @foo80 -#[no_mangle] -pub fn foo80(x: u8, data: &[u8; 80]) -> bool { - // CHECK: call core::slice::memchr - data.contains(&x) -} diff --git a/tests/codegen/issue-77812.rs b/tests/codegen/issue-77812.rs deleted file mode 100644 index 4cc824145..000000000 --- a/tests/codegen/issue-77812.rs +++ /dev/null @@ -1,32 +0,0 @@ -// compile-flags: -O -#![crate_type = "lib"] - -// Test that LLVM can eliminate the unreachable `Variant::Zero` branch. - -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum Variant { - Zero, - One, - Two, -} - -extern { - fn exf1(); - fn exf2(); -} - -pub static mut GLOBAL: Variant = Variant::Zero; - -// CHECK-LABEL: @issue_77812 -#[no_mangle] -pub unsafe fn issue_77812() { - let g = GLOBAL; - if g != Variant::Zero { - match g { - Variant::One => exf1(), - Variant::Two => exf2(), - // CHECK-NOT: panic - Variant::Zero => panic!(), - } - } -} diff --git a/tests/codegen/issue-81408-dllimport-thinlto-windows.rs b/tests/codegen/issue-81408-dllimport-thinlto-windows.rs deleted file mode 100644 index 0b6ab4f7e..000000000 --- a/tests/codegen/issue-81408-dllimport-thinlto-windows.rs +++ /dev/null @@ -1,15 +0,0 @@ -// compile-flags: -O -C lto=thin -C prefer-dynamic=no -// only-windows -// aux-build:static_dllimport_aux.rs - -// Test that on Windows, when performing ThinLTO, we do not mark cross-crate static items with -// dllimport because lld does not fix the symbol names for us. - -extern crate static_dllimport_aux; - -// CHECK-LABEL: @{{.+}}CROSS_CRATE_STATIC_ITEM{{.+}} = -// CHECK-SAME: external local_unnamed_addr global %"{{.+}}AtomicPtr - -pub fn main() { - static_dllimport_aux::memrchr(); -} diff --git a/tests/codegen/issue-84268.rs b/tests/codegen/issue-84268.rs deleted file mode 100644 index 7ca195447..000000000 --- a/tests/codegen/issue-84268.rs +++ /dev/null @@ -1,23 +0,0 @@ -// compile-flags: -O --crate-type=rlib -#![feature(platform_intrinsics, repr_simd)] - -extern "platform-intrinsic" { - fn simd_fabs(x: T) -> T; - fn simd_eq(x: T, y: T) -> U; -} - -#[repr(simd)] -pub struct V([f32; 4]); - -#[repr(simd)] -pub struct M([i32; 4]); - -#[no_mangle] -// CHECK-LABEL: @is_infinite -pub fn is_infinite(v: V) -> M { - // CHECK: fabs - // CHECK: cmp oeq - unsafe { - simd_eq(simd_fabs(v), V([f32::INFINITY; 4])) - } -} diff --git a/tests/codegen/issue-85872-multiple-reverse.rs b/tests/codegen/issue-85872-multiple-reverse.rs deleted file mode 100644 index 591a1aca7..000000000 --- a/tests/codegen/issue-85872-multiple-reverse.rs +++ /dev/null @@ -1,20 +0,0 @@ -// min-llvm-version: 15.0.0 -// compile-flags: -O - -#![crate_type = "lib"] - -#[no_mangle] -pub fn u16_be_to_arch(mut data: [u8; 2]) -> [u8; 2] { - // CHECK-LABEL: @u16_be_to_arch - // CHECK: @llvm.bswap.i16 - data.reverse(); - data -} - -#[no_mangle] -pub fn u32_be_to_arch(mut data: [u8; 4]) -> [u8; 4] { - // CHECK-LABEL: @u32_be_to_arch - // CHECK: @llvm.bswap.i32 - data.reverse(); - data -} diff --git a/tests/codegen/issue-86106.rs b/tests/codegen/issue-86106.rs deleted file mode 100644 index 9ccbcb24f..000000000 --- a/tests/codegen/issue-86106.rs +++ /dev/null @@ -1,62 +0,0 @@ -// min-llvm-version: 15.0 -// compile-flags: -C opt-level=3 -Z merge-functions=disabled - -// The below two functions ensure that both `String::new()` and `"".to_string()` -// produce the identical code. - -#![crate_type = "lib"] - -// CHECK-LABEL: define void @string_new -#[no_mangle] -pub fn string_new() -> String { - // CHECK-NOT: load i8 - // CHECK: store i{{32|64}} - // CHECK-NEXT: getelementptr - // CHECK-NEXT: store ptr - // CHECK-NEXT: getelementptr - // CHECK-NEXT: store i{{32|64}} - // CHECK-NEXT: ret void - String::new() -} - -// 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-NEXT: getelementptr - // CHECK-NEXT: store i{{32|64}} - // CHECK-NEXT: ret void - "".to_string() -} - -// The below two functions ensure that both `vec![]` and `vec![].clone()` -// produce the identical code. - -// CHECK-LABEL: @empty_vec -#[no_mangle] -pub fn empty_vec() -> Vec { - // CHECK: store i{{32|64}} - // CHECK-NOT: load i8 - // CHECK-NEXT: getelementptr - // CHECK-NEXT: store ptr - // CHECK-NEXT: getelementptr - // CHECK-NEXT: store i{{32|64}} - // CHECK-NEXT: ret void - 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-NEXT: getelementptr - // CHECK-NEXT: store i{{32|64}} - // CHECK-NEXT: ret void - vec![].clone() -} diff --git a/tests/codegen/issue-96274.rs b/tests/codegen/issue-96274.rs deleted file mode 100644 index 28bfcce0d..000000000 --- a/tests/codegen/issue-96274.rs +++ /dev/null @@ -1,17 +0,0 @@ -// min-llvm-version: 15.0 -// compile-flags: -O - -#![crate_type = "lib"] -#![feature(inline_const)] - -use std::mem::MaybeUninit; - -pub fn maybe_uninit() -> [MaybeUninit; 3000] { - // CHECK-NOT: memset - [MaybeUninit::uninit(); 3000] -} - -pub fn maybe_uninit_const() -> [MaybeUninit; 8192] { - // CHECK-NOT: memset - [const { MaybeUninit::uninit() }; 8192] -} diff --git a/tests/codegen/issue-96497-slice-size-nowrap.rs b/tests/codegen/issue-96497-slice-size-nowrap.rs deleted file mode 100644 index 0413ed6b2..000000000 --- a/tests/codegen/issue-96497-slice-size-nowrap.rs +++ /dev/null @@ -1,29 +0,0 @@ -// This test case checks that LLVM is aware that computing the size of a slice cannot wrap. -// The possibility of wrapping results in an additional branch when dropping boxed slices -// in some situations, see https://github.com/rust-lang/rust/issues/96497#issuecomment-1112865218 - -// compile-flags: -O -// min-llvm-version: 15.0 - -#![crate_type="lib"] - -// CHECK-LABEL: @simple_size_of_nowrap -#[no_mangle] -pub fn simple_size_of_nowrap(x: &[u32]) -> usize { - // Make sure the shift used to compute the size has a nowrap flag. - - // CHECK: [[A:%.*]] = shl nsw {{.*}}, 2 - // CHECK-NEXT: ret {{.*}} [[A]] - core::mem::size_of_val(x) -} - -// CHECK-LABEL: @drop_write -#[no_mangle] -pub fn drop_write(mut x: Box<[u32]>) { - // Check that this write is optimized out. - // This depends on the size calculation not wrapping, - // since otherwise LLVM can't tell that the memory is always deallocated if the slice len > 0. - - // CHECK-NOT: store i32 42 - x[1] = 42; -} diff --git a/tests/codegen/issue-98156-const-arg-temp-lifetime.rs b/tests/codegen/issue-98156-const-arg-temp-lifetime.rs deleted file mode 100644 index 12ace5fff..000000000 --- a/tests/codegen/issue-98156-const-arg-temp-lifetime.rs +++ /dev/null @@ -1,27 +0,0 @@ -// This test checks that temporaries for indirectly-passed arguments get lifetime markers. - -// compile-flags: -O -C no-prepopulate-passes -Zmir-opt-level=0 - -#![crate_type = "lib"] - -extern "Rust" { - fn f(x: [u8; 1024]); -} - -const A: [u8; 1024] = [0; 1024]; - -// CHECK-LABEL: @const_arg_indirect -#[no_mangle] -pub unsafe fn const_arg_indirect() { - // Ensure that the live ranges for the two argument temporaries don't overlap. - - // CHECK: call void @llvm.lifetime.start - // CHECK: call void @f - // CHECK: call void @llvm.lifetime.end - // CHECK: call void @llvm.lifetime.start - // CHECK: call void @f - // CHECK: call void @llvm.lifetime.end - - f(A); - f(A); -} diff --git a/tests/codegen/issue-98294-get-mut-copy-from-slice-opt.rs b/tests/codegen/issue-98294-get-mut-copy-from-slice-opt.rs deleted file mode 100644 index 7da29cd79..000000000 --- a/tests/codegen/issue-98294-get-mut-copy-from-slice-opt.rs +++ /dev/null @@ -1,19 +0,0 @@ -// min-llvm-version: 15.0.0 -// ignore-debug: The debug assertions get in the way -// compile-flags: -O - -#![crate_type = "lib"] - -// There should be no calls to panic / len_mismatch_fail. - -#[no_mangle] -pub fn test(a: &mut [u8], offset: usize, bytes: &[u8]) { - // CHECK-LABEL: @test( - // CHECK-NOT: call - // CHECK: call void @llvm.memcpy - // CHECK-NOT: call - // CHECK: } - if let Some(dst) = a.get_mut(offset..offset + bytes.len()) { - dst.copy_from_slice(bytes); - } -} diff --git a/tests/codegen/issues/auxiliary/static_dllimport_aux.rs b/tests/codegen/issues/auxiliary/static_dllimport_aux.rs new file mode 100644 index 000000000..afb0dc42f --- /dev/null +++ b/tests/codegen/issues/auxiliary/static_dllimport_aux.rs @@ -0,0 +1,13 @@ +use std::sync::atomic::{AtomicPtr, Ordering}; + +#[inline(always)] +pub fn memrchr() { + fn detect() {} + + static CROSS_CRATE_STATIC_ITEM: AtomicPtr<()> = AtomicPtr::new(detect as *mut ()); + + unsafe { + let fun = CROSS_CRATE_STATIC_ITEM.load(Ordering::SeqCst); + std::mem::transmute::<*mut (), fn()>(fun)() + } +} diff --git a/tests/codegen/issues/issue-101048.rs b/tests/codegen/issues/issue-101048.rs new file mode 100644 index 000000000..efa4db93e --- /dev/null +++ b/tests/codegen/issues/issue-101048.rs @@ -0,0 +1,13 @@ +// compile-flags: -O +// min-llvm-version: 16 + +#![crate_type = "lib"] + +#[no_mangle] +pub fn all_zero(data: &[u64]) -> bool { + // CHECK-LABEL: @all_zero( + // CHECK: [[PHI:%.*]] = phi i1 + // CHECK-NOT: phi i8 + // CHECK-NOT: zext + data.iter().copied().fold(true, |acc, x| acc & (x == 0)) +} diff --git a/tests/codegen/issues/issue-101082.rs b/tests/codegen/issues/issue-101082.rs new file mode 100644 index 000000000..2cbe99942 --- /dev/null +++ b/tests/codegen/issues/issue-101082.rs @@ -0,0 +1,17 @@ +// compile-flags: -O +// min-llvm-version: 16 +// ignore-debug: the debug assertions get in the way + +#![crate_type = "lib"] + +#[no_mangle] +pub fn test() -> usize { + // CHECK-LABEL: @test( + // CHECK: ret {{i64|i32}} 165 + let values = [23, 16, 54, 3, 60, 9]; + let mut acc = 0; + for item in values { + acc += item; + } + acc +} diff --git a/tests/codegen/issues/issue-101814.rs b/tests/codegen/issues/issue-101814.rs new file mode 100644 index 000000000..13796352c --- /dev/null +++ b/tests/codegen/issues/issue-101814.rs @@ -0,0 +1,20 @@ +// compile-flags: -O +// min-llvm-version: 16 +// ignore-debug: the debug assertions get in the way + +#![crate_type = "lib"] + +#[no_mangle] +pub fn test(a: [i32; 10]) -> i32 { + // CHECK-LABEL: @test( + // CHECK: [[L1:%.+]] = load i32 + // CHECK: [[L2:%.+]] = load i32 + // CHECK: [[R:%.+]] = add i32 [[L1]], [[L2]] + // CHECK: ret i32 [[R]] + let mut sum = 0; + for v in a.iter().skip(8) { + sum += v; + } + + sum +} diff --git a/tests/codegen/issues/issue-103132.rs b/tests/codegen/issues/issue-103132.rs new file mode 100644 index 000000000..cc87d7cd2 --- /dev/null +++ b/tests/codegen/issues/issue-103132.rs @@ -0,0 +1,16 @@ +// compile-flags: -O -C overflow-checks +// min-llvm-version: 16 + +#![crate_type = "lib"] + +#[no_mangle] +pub fn test(arr: &[u8], weight: u32) { + // CHECK-LABEL: @test( + // CHECK-NOT: panic + let weight = weight.min(256 * 256 * 256); + + for x in arr { + assert!(weight <= 256 * 256 * 256); + let result = *x as u32 * weight; + } +} diff --git a/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs b/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs new file mode 100644 index 000000000..a3499babe --- /dev/null +++ b/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs @@ -0,0 +1,16 @@ +// compile-flags: -O -C debug-assertions=yes + +#![crate_type = "lib"] +#![feature(strict_provenance)] + +#[no_mangle] +pub fn test(src: *const u8, dst: *const u8) -> usize { + // CHECK-LABEL: @test( + // CHECK-NOT: panic + let src_usize = src.addr(); + let dst_usize = dst.addr(); + if src_usize > dst_usize { + return src_usize - dst_usize; + } + return 0; +} diff --git a/tests/codegen/issues/issue-103327.rs b/tests/codegen/issues/issue-103327.rs new file mode 100644 index 000000000..cee00facc --- /dev/null +++ b/tests/codegen/issues/issue-103327.rs @@ -0,0 +1,18 @@ +// compile-flags: -O +// min-llvm-version: 16 + +#![crate_type = "lib"] + +#[no_mangle] +pub fn test(a: i32, b: i32) -> bool { + // CHECK-LABEL: @test( + // CHECK: ret i1 true + let c1 = (a >= 0) && (a <= 10); + let c2 = (b >= 0) && (b <= 20); + + if c1 & c2 { + a + 100 != b + } else { + true + } +} diff --git a/tests/codegen/issues/issue-103840.rs b/tests/codegen/issues/issue-103840.rs new file mode 100644 index 000000000..f19d7031b --- /dev/null +++ b/tests/codegen/issues/issue-103840.rs @@ -0,0 +1,9 @@ +// compile-flags: -O +#![crate_type = "lib"] + +pub fn foo(t: &mut Vec) { + // CHECK-NOT: __rust_dealloc + let mut taken = std::mem::take(t); + taken.pop(); + *t = taken; +} diff --git a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs new file mode 100644 index 000000000..d54ac9e33 --- /dev/null +++ b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs @@ -0,0 +1,22 @@ +// compile-flags: --crate-type=lib -O -Cdebuginfo=2 -Cno-prepopulate-passes +// min-llvm-version: 15.0 # this test uses opaque pointer notation +#![feature(stmt_expr_attributes)] + +pub struct S([usize; 8]); + +#[no_mangle] +pub fn outer_function(x: S, y: S) -> usize { + (#[inline(always)]|| { + let _z = x; + y.0[0] + })() +} + +// Check that we do not attempt to load from the spilled arg before it is assigned to +// when generating debuginfo. +// CHECK-LABEL: @outer_function +// CHECK: [[spill:%.*]] = alloca %"[closure@{{.*.rs}}:9:23: 9:25]" +// 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 diff --git a/tests/codegen/issues/issue-106369.rs b/tests/codegen/issues/issue-106369.rs new file mode 100644 index 000000000..3fe7be4f1 --- /dev/null +++ b/tests/codegen/issues/issue-106369.rs @@ -0,0 +1,15 @@ +// compile-flags: -O +// ignore-debug (the extra assertions get in the way) + +#![crate_type = "lib"] + +// From + +// CHECK-LABEL: @issue_106369( +#[no_mangle] +pub unsafe fn issue_106369(ptr: *const &i32) -> bool { + // CHECK-NOT: icmp + // CHECK: ret i1 true + // CHECK-NOT: icmp + Some(std::ptr::read(ptr)).is_some() +} diff --git a/tests/codegen/issues/issue-13018.rs b/tests/codegen/issues/issue-13018.rs new file mode 100644 index 000000000..b70ea1f48 --- /dev/null +++ b/tests/codegen/issues/issue-13018.rs @@ -0,0 +1,11 @@ +// compile-flags: -O + +// A drop([...].clone()) sequence on an Rc should be a no-op +// In particular, no call to __rust_dealloc should be emitted +#![crate_type = "lib"] +use std::rc::Rc; + +pub fn foo(t: &Rc>) { +// CHECK-NOT: __rust_dealloc + drop(t.clone()); +} diff --git a/tests/codegen/issues/issue-15953.rs b/tests/codegen/issues/issue-15953.rs new file mode 100644 index 000000000..28d284289 --- /dev/null +++ b/tests/codegen/issues/issue-15953.rs @@ -0,0 +1,29 @@ +// Test that llvm generates `memcpy` for moving a value +// inside a function and moving an argument. + +struct Foo { + x: Vec, +} + +#[inline(never)] +#[no_mangle] +// CHECK: memcpy +fn interior(x: Vec) -> Vec { + let Foo { x } = Foo { x: x }; + x +} + +#[inline(never)] +#[no_mangle] +// CHECK: memcpy +fn exterior(x: Vec) -> Vec { + x +} + +fn main() { + let x = interior(Vec::new()); + println!("{:?}", x); + + let x = exterior(Vec::new()); + println!("{:?}", x); +} diff --git a/tests/codegen/issues/issue-27130.rs b/tests/codegen/issues/issue-27130.rs new file mode 100644 index 000000000..e5ee94e1f --- /dev/null +++ b/tests/codegen/issues/issue-27130.rs @@ -0,0 +1,21 @@ +// compile-flags: -O + +#![crate_type = "lib"] + +// CHECK-LABEL: @trim_in_place +#[no_mangle] +pub fn trim_in_place(a: &mut &[u8]) { + while a.first() == Some(&42) { + // CHECK-NOT: slice_index_order_fail + *a = &a[1..]; + } +} + +// CHECK-LABEL: @trim_in_place2 +#[no_mangle] +pub fn trim_in_place2(a: &mut &[u8]) { + while let Some(&42) = a.first() { + // CHECK-NOT: slice_index_order_fail + *a = &a[2..]; + } +} diff --git a/tests/codegen/issues/issue-32031.rs b/tests/codegen/issues/issue-32031.rs new file mode 100644 index 000000000..abef92c19 --- /dev/null +++ b/tests/codegen/issues/issue-32031.rs @@ -0,0 +1,23 @@ +// compile-flags: -C no-prepopulate-passes -Copt-level=0 + +#![crate_type = "lib"] + +#[no_mangle] +pub struct F32(f32); + +// CHECK: define{{.*}}float @add_newtype_f32(float %a, float %b) +#[inline(never)] +#[no_mangle] +pub fn add_newtype_f32(a: F32, b: F32) -> F32 { + F32(a.0 + b.0) +} + +#[no_mangle] +pub struct F64(f64); + +// CHECK: define{{.*}}double @add_newtype_f64(double %a, double %b) +#[inline(never)] +#[no_mangle] +pub fn add_newtype_f64(a: F64, b: F64) -> F64 { + F64(a.0 + b.0) +} diff --git a/tests/codegen/issues/issue-32364.rs b/tests/codegen/issues/issue-32364.rs new file mode 100644 index 000000000..85493a4bb --- /dev/null +++ b/tests/codegen/issues/issue-32364.rs @@ -0,0 +1,18 @@ +// Test that `extern "stdcall"` is properly translated. + +// only-x86 + +// compile-flags: -C no-prepopulate-passes + +struct Foo; + +impl Foo { +// CHECK: define internal x86_stdcallcc void @{{.*}}foo{{.*}}() + #[inline(never)] + pub extern "stdcall" fn foo() { + } +} + +fn main() { + Foo::foo::(); +} diff --git a/tests/codegen/issues/issue-34634.rs b/tests/codegen/issues/issue-34634.rs new file mode 100644 index 000000000..f53fa240c --- /dev/null +++ b/tests/codegen/issues/issue-34634.rs @@ -0,0 +1,16 @@ +// Test that `wrapping_div` only checks divisor once. +// This test checks that there is only a single compare against -1 and -1 is not present as a +// switch case (the second check present until rustc 1.12). +// This test also verifies that a single panic call is generated (for the division by zero case). + +// compile-flags: -O +#![crate_type = "lib"] + +// CHECK-LABEL: @f +#[no_mangle] +pub fn f(x: i32, y: i32) -> i32 { + // CHECK-COUNT-1: icmp eq i32 %y, -1 + // CHECK-COUNT-1: panic + // CHECK-NOT: i32 -1, label + x.wrapping_div(y) +} diff --git a/tests/codegen/issues/issue-34947-pow-i32.rs b/tests/codegen/issues/issue-34947-pow-i32.rs new file mode 100644 index 000000000..653da8e8b --- /dev/null +++ b/tests/codegen/issues/issue-34947-pow-i32.rs @@ -0,0 +1,13 @@ +// compile-flags: -O + +#![crate_type = "lib"] + +// CHECK-LABEL: @issue_34947 +#[no_mangle] +pub fn issue_34947(x: i32) -> i32 { + // CHECK: mul + // CHECK-NEXT: mul + // CHECK-NEXT: mul + // CHECK-NEXT: ret + x.pow(5) +} diff --git a/tests/codegen/issues/issue-37945.rs b/tests/codegen/issues/issue-37945.rs new file mode 100644 index 000000000..4f386d335 --- /dev/null +++ b/tests/codegen/issues/issue-37945.rs @@ -0,0 +1,35 @@ +// compile-flags: -O -Zmerge-functions=disabled +// ignore-32bit LLVM has a bug with them +// ignore-debug + +// Check that LLVM understands that `Iter` pointer is not null. Issue #37945. + +#![crate_type = "lib"] + +use std::slice::Iter; + +#[no_mangle] +pub fn is_empty_1(xs: Iter) -> bool { +// CHECK-LABEL: @is_empty_1( +// CHECK-NEXT: start: +// CHECK-NEXT: [[A:%.*]] = icmp ne {{i32\*|ptr}} {{%xs.0|%xs.1}}, null +// CHECK-NEXT: tail call void @llvm.assume(i1 [[A]]) +// The order between %xs.0 and %xs.1 on the next line doesn't matter +// and different LLVM versions produce different order. +// CHECK-NEXT: [[B:%.*]] = icmp eq {{i32\*|ptr}} {{%xs.0, %xs.1|%xs.1, %xs.0}} +// CHECK-NEXT: ret i1 [[B:%.*]] + {xs}.next().is_none() +} + +#[no_mangle] +pub fn is_empty_2(xs: Iter) -> bool { +// CHECK-LABEL: @is_empty_2 +// CHECK-NEXT: start: +// CHECK-NEXT: [[C:%.*]] = icmp ne {{i32\*|ptr}} {{%xs.0|%xs.1}}, null +// CHECK-NEXT: tail call void @llvm.assume(i1 [[C]]) +// The order between %xs.0 and %xs.1 on the next line doesn't matter +// and different LLVM versions produce different order. +// CHECK-NEXT: [[D:%.*]] = icmp eq {{i32\*|ptr}} {{%xs.0, %xs.1|%xs.1, %xs.0}} +// CHECK-NEXT: ret i1 [[D:%.*]] + xs.map(|&x| x).next().is_none() +} diff --git a/tests/codegen/issues/issue-44056-macos-tls-align.rs b/tests/codegen/issues/issue-44056-macos-tls-align.rs new file mode 100644 index 000000000..1a3923f1b --- /dev/null +++ b/tests/codegen/issues/issue-44056-macos-tls-align.rs @@ -0,0 +1,28 @@ +// +// only-macos +// no-system-llvm +// compile-flags: -O + +#![crate_type = "rlib"] +#![feature(thread_local)] + +// local_unnamed_addr does not appear when std is built with debug assertions. +// CHECK: @STATIC_VAR_1 = thread_local {{(local_unnamed_addr )?}}global <{ [32 x i8] }> zeroinitializer, section "__DATA,__thread_bss", align 4 +#[no_mangle] +#[thread_local] +static mut STATIC_VAR_1: [u32; 8] = [0; 8]; + +// CHECK: @STATIC_VAR_2 = thread_local {{(local_unnamed_addr )?}}global <{ [32 x i8] }> <{{[^>]*}}>, section "__DATA,__thread_data", align 4 +#[no_mangle] +#[thread_local] +static mut STATIC_VAR_2: [u32; 8] = [4; 8]; + +#[no_mangle] +pub unsafe fn f(x: &mut [u32; 8]) { + std::mem::swap(x, &mut STATIC_VAR_1) +} + +#[no_mangle] +pub unsafe fn g(x: &mut [u32; 8]) { + std::mem::swap(x, &mut STATIC_VAR_2) +} diff --git a/tests/codegen/issues/issue-45222.rs b/tests/codegen/issues/issue-45222.rs new file mode 100644 index 000000000..e9b05e648 --- /dev/null +++ b/tests/codegen/issues/issue-45222.rs @@ -0,0 +1,63 @@ +// compile-flags: -O +// ignore-debug: the debug assertions get in the way + +#![crate_type = "lib"] + +// verify that LLVM recognizes a loop involving 0..=n and will const-fold it. + +// Example from original issue #45222 + +fn foo2(n: u64) -> u64 { + let mut count = 0; + for _ in 0..n { + for j in (0..=n).rev() { + count += j; + } + } + count +} + +// CHECK-LABEL: @check_foo2 +#[no_mangle] +pub fn check_foo2() -> u64 { + // CHECK: ret i64 500005000000000 + foo2(100000) +} + +// Simplified example of #45222 +// +// Temporarily disabled in #68835 to fix a soundness hole. +// +// fn triangle_inc(n: u64) -> u64 { +// let mut count = 0; +// for j in 0 ..= n { +// count += j; +// } +// count +// } +// +// // COMMENTEDCHECK-LABEL: @check_triangle_inc +// #[no_mangle] +// pub fn check_triangle_inc() -> u64 { +// // COMMENTEDCHECK: ret i64 5000050000 +// triangle_inc(100000) +// } + +// Demo in #48012 + +fn foo3r(n: u64) -> u64 { + let mut count = 0; + (0..n).for_each(|_| { + (0..=n).rev().for_each(|j| { + count += j; + }) + }); + count +} + +// CHECK-LABEL: @check_foo3r +#[no_mangle] +pub fn check_foo3r() -> u64 { + // CHECK: ret i64 500050000000 + foo3r(10000) +} diff --git a/tests/codegen/issues/issue-45466.rs b/tests/codegen/issues/issue-45466.rs new file mode 100644 index 000000000..c79542767 --- /dev/null +++ b/tests/codegen/issues/issue-45466.rs @@ -0,0 +1,15 @@ +// compile-flags: -O +// ignore-debug: the debug assertions get in the way + +#![crate_type="rlib"] + +// CHECK-LABEL: @memzero +// CHECK-NOT: store +// CHECK: call void @llvm.memset +// CHECK-NOT: store +#[no_mangle] +pub fn memzero(data: &mut [u8]) { + for i in 0..data.len() { + data[i] = 0; + } +} diff --git a/tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs b/tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs new file mode 100644 index 000000000..1daa213fc --- /dev/null +++ b/tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs @@ -0,0 +1,39 @@ +// This test case checks that slice::{r}position functions do not +// prevent optimizing away bounds checks + +// compile-flags: -O +// ignore-debug: the debug assertions get in the way + +#![crate_type="rlib"] + +// CHECK-LABEL: @test +#[no_mangle] +pub fn test(y: &[u32], x: &u32, z: &u32) -> bool { + let result = match y.iter().position(|a| a == x) { + Some(p) => Ok(p), + None => Err(()), + }; + + if let Ok(p) = result { + // CHECK-NOT: panic + y[p] == *z + } else { + false + } +} + +// CHECK-LABEL: @rtest +#[no_mangle] +pub fn rtest(y: &[u32], x: &u32, z: &u32) -> bool { + let result = match y.iter().rposition(|a| a == x) { + Some(p) => Ok(p), + None => Err(()), + }; + + if let Ok(p) = result { + // CHECK-NOT: panic + y[p] == *z + } else { + false + } +} diff --git a/tests/codegen/issues/issue-47278.rs b/tests/codegen/issues/issue-47278.rs new file mode 100644 index 000000000..9076274f4 --- /dev/null +++ b/tests/codegen/issues/issue-47278.rs @@ -0,0 +1,9 @@ +// -C no-prepopulate-passes +#![crate_type="staticlib"] + +#[repr(C)] +pub struct Foo(u64); + +// CHECK: define {{.*}} @foo( +#[no_mangle] +pub extern "C" fn foo(_: Foo) -> Foo { loop {} } diff --git a/tests/codegen/issues/issue-47442.rs b/tests/codegen/issues/issue-47442.rs new file mode 100644 index 000000000..6944336d3 --- /dev/null +++ b/tests/codegen/issues/issue-47442.rs @@ -0,0 +1,22 @@ +// check that we don't emit unneeded `resume` cleanup blocks for every +// destructor. + +// CHECK-NOT: Unwind + +#![feature(test)] +#![crate_type="rlib"] + +extern crate test; + +struct Foo {} + +impl Drop for Foo { + fn drop(&mut self) { + test::black_box(()); + } +} + +#[no_mangle] +pub fn foo() { + let _foo = Foo {}; +} diff --git a/tests/codegen/issues/issue-56267-2.rs b/tests/codegen/issues/issue-56267-2.rs new file mode 100644 index 000000000..4dc9ebfeb --- /dev/null +++ b/tests/codegen/issues/issue-56267-2.rs @@ -0,0 +1,18 @@ +// compile-flags: -C no-prepopulate-passes + +#![crate_type="rlib"] + +#[allow(dead_code)] +pub struct Foo { + foo: u64, + bar: T, +} + +// The load from bar.1 should have alignment 4. Not checking +// other loads here, as the alignment will be platform-dependent. + +// CHECK: %{{.+}} = load i32, {{i32\*|ptr}} %{{.+}}, align 4 +#[no_mangle] +pub fn test(x: Foo<(i32, i32)>) -> (i32, i32) { + x.bar +} diff --git a/tests/codegen/issues/issue-56267.rs b/tests/codegen/issues/issue-56267.rs new file mode 100644 index 000000000..7bdd25779 --- /dev/null +++ b/tests/codegen/issues/issue-56267.rs @@ -0,0 +1,18 @@ +// compile-flags: -C no-prepopulate-passes + +#![crate_type="rlib"] + +#[allow(dead_code)] +pub struct Foo { + foo: u64, + bar: T, +} + +// The store writing to bar.1 should have alignment 4. Not checking +// other stores here, as the alignment will be platform-dependent. + +// CHECK: store i32 [[TMP1:%.+]], {{i32\*|ptr}} [[TMP2:%.+]], align 4 +#[no_mangle] +pub fn test(x: (i32, i32)) -> Foo<(i32, i32)> { + Foo { foo: 0, bar: x } +} diff --git a/tests/codegen/issues/issue-56927.rs b/tests/codegen/issues/issue-56927.rs new file mode 100644 index 000000000..044d72181 --- /dev/null +++ b/tests/codegen/issues/issue-56927.rs @@ -0,0 +1,43 @@ +// compile-flags: -C no-prepopulate-passes + +#![crate_type="rlib"] + +#[repr(align(16))] +pub struct S { + arr: [u32; 4], +} + +// CHECK-LABEL: @test1 +// CHECK: store i32 0, {{i32\*|ptr}} %{{.+}}, align 16 +// CHECK: store i32 1, {{i32\*|ptr}} %{{.+}}, align 4 +// CHECK: store i32 2, {{i32\*|ptr}} %{{.+}}, align 8 +// CHECK: store i32 3, {{i32\*|ptr}} %{{.+}}, align 4 +#[no_mangle] +pub fn test1(s: &mut S) { + s.arr[0] = 0; + s.arr[1] = 1; + s.arr[2] = 2; + s.arr[3] = 3; +} + +// CHECK-LABEL: @test2 +// CHECK: store i32 4, {{i32\*|ptr}} %{{.+}}, align 4 +#[allow(unconditional_panic)] +#[no_mangle] +pub fn test2(s: &mut S) { + s.arr[usize::MAX / 4 + 1] = 4; +} + +// CHECK-LABEL: @test3 +// CHECK: store i32 5, {{i32\*|ptr}} %{{.+}}, align 4 +#[no_mangle] +pub fn test3(s: &mut S, i: usize) { + s.arr[i] = 5; +} + +// CHECK-LABEL: @test4 +// CHECK: store i32 6, {{i32\*|ptr}} %{{.+}}, align 4 +#[no_mangle] +pub fn test4(s: &mut S) { + s.arr = [6; 4]; +} diff --git a/tests/codegen/issues/issue-58881.rs b/tests/codegen/issues/issue-58881.rs new file mode 100644 index 000000000..00f8953d9 --- /dev/null +++ b/tests/codegen/issues/issue-58881.rs @@ -0,0 +1,21 @@ +// compile-flags: -C no-prepopulate-passes -Copt-level=0 +// +// only-x86_64 +// ignore-windows + +#![crate_type = "lib"] + +extern "C" { + fn variadic_fn(_: i32, ...); +} + +#[repr(C)] +struct Foo(u8); +#[repr(C)] +struct Bar(u64, u64, u64); + +// Ensure that emit arguments of the correct type. +pub unsafe fn test_call_variadic() { + // CHECK: call void (i32, ...) @variadic_fn(i32 0, i8 {{.*}}, {{%Bar\*|ptr}} {{.*}}) + variadic_fn(0, Foo(0), Bar(0, 0, 0)) +} diff --git a/tests/codegen/issues/issue-59352.rs b/tests/codegen/issues/issue-59352.rs new file mode 100644 index 000000000..d271fe027 --- /dev/null +++ b/tests/codegen/issues/issue-59352.rs @@ -0,0 +1,18 @@ +// This test is a mirror of mir-opt/issues/issue-59352.rs. The LLVM inliner doesn't inline +// `char::method::is_digit()` and `char::method::to_digit()`, probably because of their size. +// +// Currently, the MIR optimizer isn't capable of removing the unreachable panic in this test case. +// Once the optimizer can do that, mir-opt/issues/issue-59352.rs will need to be updated and this +// test case should be removed as it will become redundant. + +// mir-opt-level=3 enables inlining and enables LLVM to optimize away the unreachable panic call. +// compile-flags: -O -Z mir-opt-level=3 + +#![crate_type = "rlib"] + +// CHECK-LABEL: @num_to_digit +#[no_mangle] +pub fn num_to_digit(num: char) -> u32 { + // CHECK-NOT: panic + if num.is_digit(8) { num.to_digit(8).unwrap() } else { 0 } +} diff --git a/tests/codegen/issues/issue-69101-bounds-check.rs b/tests/codegen/issues/issue-69101-bounds-check.rs new file mode 100644 index 000000000..a3aca3a29 --- /dev/null +++ b/tests/codegen/issues/issue-69101-bounds-check.rs @@ -0,0 +1,44 @@ +// no-system-llvm +// compile-flags: -O +// ignore-debug: the debug assertions get in the way +#![crate_type = "lib"] + +// Make sure no bounds checks are emitted in the loop when upfront slicing +// ensures that the slices are big enough. +// In particular, bounds checks were not always optimized out if the upfront +// check was for a greater len than the loop requires. +// (i.e. `already_sliced_no_bounds_check` was not always optimized even when +// `already_sliced_no_bounds_check_exact` was) +// CHECK-LABEL: @already_sliced_no_bounds_check +#[no_mangle] +pub fn already_sliced_no_bounds_check(a: &[u8], b: &[u8], c: &mut [u8]) { + // CHECK: slice_end_index_len_fail + // CHECK-NOT: panic_bounds_check + let _ = (&a[..2048], &b[..2048], &mut c[..2048]); + for i in 0..1024 { + c[i] = a[i] ^ b[i]; + } +} + +// CHECK-LABEL: @already_sliced_no_bounds_check_exact +#[no_mangle] +pub fn already_sliced_no_bounds_check_exact(a: &[u8], b: &[u8], c: &mut [u8]) { + // CHECK: slice_end_index_len_fail + // CHECK-NOT: panic_bounds_check + let _ = (&a[..1024], &b[..1024], &mut c[..1024]); + for i in 0..1024 { + c[i] = a[i] ^ b[i]; + } +} + +// Make sure we're checking for the right thing: there can be a panic if the slice is too small. +// CHECK-LABEL: @already_sliced_bounds_check +#[no_mangle] +pub fn already_sliced_bounds_check(a: &[u8], b: &[u8], c: &mut [u8]) { + // CHECK: slice_end_index_len_fail + // CHECK: panic_bounds_check + let _ = (&a[..1023], &b[..2048], &mut c[..2048]); + for i in 0..1024 { + c[i] = a[i] ^ b[i]; + } +} diff --git a/tests/codegen/issues/issue-73031.rs b/tests/codegen/issues/issue-73031.rs new file mode 100644 index 000000000..a09c4bcfb --- /dev/null +++ b/tests/codegen/issues/issue-73031.rs @@ -0,0 +1,26 @@ +// compile-flags: -O +#![crate_type = "lib"] + +// Test that LLVM can eliminate the unreachable `All::None` branch. + +pub enum All { + None, + Foo, + Bar, +} + +// CHECK-LABEL: @issue_73031 +#[no_mangle] +pub fn issue_73031(a: &mut All, q: i32) -> i32 { + *a = if q == 5 { + All::Foo + } else { + All::Bar + }; + match *a { + // CHECK-NOT: panic + All::None => panic!(), + All::Foo => 1, + All::Bar => 2, + } +} diff --git a/tests/codegen/issues/issue-73258.rs b/tests/codegen/issues/issue-73258.rs new file mode 100644 index 000000000..0134f929b --- /dev/null +++ b/tests/codegen/issues/issue-73258.rs @@ -0,0 +1,38 @@ +// compile-flags: -O +// ignore-debug (the extra assertions get in the way) + +#![crate_type = "lib"] + +// Adapted from + +#[derive(Clone, Copy)] +#[repr(u8)] +pub enum Foo { + A, B, C, D, +} + +// CHECK-LABEL: @issue_73258( +#[no_mangle] +pub unsafe fn issue_73258(ptr: *const Foo) -> Foo { + // CHECK-NOT: icmp + // CHECK-NOT: call + // CHECK-NOT: br + // CHECK-NOT: select + + // CHECK: %[[R:.+]] = load i8 + // CHECK-SAME: !range ! + + // CHECK-NOT: icmp + // CHECK-NOT: call + // CHECK-NOT: br + // CHECK-NOT: select + + // CHECK: ret i8 %[[R]] + + // CHECK-NOT: icmp + // CHECK-NOT: call + // CHECK-NOT: br + // CHECK-NOT: select + let k: Option = Some(ptr.read()); + return k.unwrap(); +} diff --git a/tests/codegen/issues/issue-73338-effecient-cmp.rs b/tests/codegen/issues/issue-73338-effecient-cmp.rs new file mode 100644 index 000000000..85c2bbfd0 --- /dev/null +++ b/tests/codegen/issues/issue-73338-effecient-cmp.rs @@ -0,0 +1,39 @@ +// This test checks that comparison operation +// generated by #[derive(PartialOrd)] +// doesn't contain jumps for C enums + +// compile-flags: -Copt-level=3 + +#![crate_type="lib"] + +#[repr(u32)] +#[derive(Copy, Clone, Eq, PartialEq, PartialOrd)] +pub enum Foo { + Zero, + One, + Two, +} + +#[no_mangle] +pub fn compare_less(a: Foo, b: Foo)->bool{ + // CHECK-NOT: br {{.*}} + a < b +} + +#[no_mangle] +pub fn compare_le(a: Foo, b: Foo)->bool{ + // CHECK-NOT: br {{.*}} + a <= b +} + +#[no_mangle] +pub fn compare_ge(a: Foo, b: Foo)->bool{ + // CHECK-NOT: br {{.*}} + a >= b +} + +#[no_mangle] +pub fn compare_greater(a: Foo, b: Foo)->bool{ + // CHECK-NOT: br {{.*}} + a > b +} diff --git a/tests/codegen/issues/issue-73396-bounds-check-after-position.rs b/tests/codegen/issues/issue-73396-bounds-check-after-position.rs new file mode 100644 index 000000000..8d07a67a1 --- /dev/null +++ b/tests/codegen/issues/issue-73396-bounds-check-after-position.rs @@ -0,0 +1,77 @@ +// compile-flags: -O +// ignore-debug: the debug assertions get in the way +#![crate_type = "lib"] + +// Make sure no bounds checks are emitted when slicing or indexing +// with an index from `position()` or `rposition()`. + +// CHECK-LABEL: @position_slice_to_no_bounds_check +#[no_mangle] +pub fn position_slice_to_no_bounds_check(s: &[u8]) -> &[u8] { + // CHECK-NOT: panic + // CHECK-NOT: slice_index_len_fail + if let Some(idx) = s.iter().position(|b| *b == b'\\') { + &s[..idx] + } else { + s + } +} + +// CHECK-LABEL: @position_slice_from_no_bounds_check +#[no_mangle] +pub fn position_slice_from_no_bounds_check(s: &[u8]) -> &[u8] { + // CHECK-NOT: panic + // CHECK-NOT: slice_index_len_fail + if let Some(idx) = s.iter().position(|b| *b == b'\\') { + &s[idx..] + } else { + s + } +} + +// CHECK-LABEL: @position_index_no_bounds_check +#[no_mangle] +pub fn position_index_no_bounds_check(s: &[u8]) -> u8 { + // CHECK-NOT: panic + // CHECK-NOT: slice_index_len_fail + if let Some(idx) = s.iter().position(|b| *b == b'\\') { + s[idx] + } else { + 42 + } +} +// CHECK-LABEL: @rposition_slice_to_no_bounds_check +#[no_mangle] +pub fn rposition_slice_to_no_bounds_check(s: &[u8]) -> &[u8] { + // CHECK-NOT: panic + // CHECK-NOT: slice_index_len_fail + if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { + &s[..idx] + } else { + s + } +} + +// CHECK-LABEL: @rposition_slice_from_no_bounds_check +#[no_mangle] +pub fn rposition_slice_from_no_bounds_check(s: &[u8]) -> &[u8] { + // CHECK-NOT: panic + // CHECK-NOT: slice_index_len_fail + if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { + &s[idx..] + } else { + s + } +} + +// CHECK-LABEL: @rposition_index_no_bounds_check +#[no_mangle] +pub fn rposition_index_no_bounds_check(s: &[u8]) -> u8 { + // CHECK-NOT: panic + // CHECK-NOT: slice_index_len_fail + if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { + s[idx] + } else { + 42 + } +} diff --git a/tests/codegen/issues/issue-73827-bounds-check-index-in-subexpr.rs b/tests/codegen/issues/issue-73827-bounds-check-index-in-subexpr.rs new file mode 100644 index 000000000..1ad05906e --- /dev/null +++ b/tests/codegen/issues/issue-73827-bounds-check-index-in-subexpr.rs @@ -0,0 +1,17 @@ +// This test checks that bounds checks are elided when +// index is part of a (x | y) < C style condition + +// compile-flags: -O + +#![crate_type = "lib"] + +// CHECK-LABEL: @get +#[no_mangle] +pub fn get(array: &[u8; 8], x: usize, y: usize) -> u8 { + if x > 7 || y > 7 { + 0 + } else { + // CHECK-NOT: panic_bounds_check + array[y] + } +} diff --git a/tests/codegen/issues/issue-75525-bounds-checks.rs b/tests/codegen/issues/issue-75525-bounds-checks.rs new file mode 100644 index 000000000..2d363d8f7 --- /dev/null +++ b/tests/codegen/issues/issue-75525-bounds-checks.rs @@ -0,0 +1,26 @@ +// Regression test for #75525, verifies that no bounds checks are generated. + +// compile-flags: -O + +#![crate_type = "lib"] + +// CHECK-LABEL: @f0 +// CHECK-NOT: panic +#[no_mangle] +pub fn f0(idx: usize, buf: &[u8; 10]) -> u8 { + if idx < 8 { buf[idx + 1] } else { 0 } +} + +// CHECK-LABEL: @f1 +// CHECK-NOT: panic +#[no_mangle] +pub fn f1(idx: usize, buf: &[u8; 10]) -> u8 { + if idx > 5 && idx < 8 { buf[idx - 1] } else { 0 } +} + +// CHECK-LABEL: @f2 +// CHECK-NOT: panic +#[no_mangle] +pub fn f2(idx: usize, buf: &[u8; 10]) -> u8 { + if idx > 5 && idx < 8 { buf[idx] } else { 0 } +} diff --git a/tests/codegen/issues/issue-75546.rs b/tests/codegen/issues/issue-75546.rs new file mode 100644 index 000000000..470a9e040 --- /dev/null +++ b/tests/codegen/issues/issue-75546.rs @@ -0,0 +1,15 @@ +// compile-flags: -O +#![crate_type = "lib"] + +// Test that LLVM can eliminate the impossible `i == 0` check. + +// CHECK-LABEL: @issue_75546 +#[no_mangle] +pub fn issue_75546() { + let mut i = 1u32; + while i < u32::MAX { + // CHECK-NOT: panic + if i == 0 { panic!(); } + i += 1; + } +} diff --git a/tests/codegen/issues/issue-75659.rs b/tests/codegen/issues/issue-75659.rs new file mode 100644 index 000000000..9394868c0 --- /dev/null +++ b/tests/codegen/issues/issue-75659.rs @@ -0,0 +1,63 @@ +// This test checks that the call to memchr/slice_contains is optimized away +// when searching in small slices. + +// compile-flags: -O -Zinline-mir=false +// only-x86_64 + +#![crate_type = "lib"] + +// CHECK-LABEL: @foo1 +#[no_mangle] +pub fn foo1(x: u8, data: &[u8; 1]) -> bool { + // CHECK-NOT: memchr + // CHECK-NOT: slice_contains + data.contains(&x) +} + +// CHECK-LABEL: @foo2 +#[no_mangle] +pub fn foo2(x: u8, data: &[u8; 2]) -> bool { + // CHECK-NOT: memchr + // CHECK-NOT: slice_contains + data.contains(&x) +} + +// CHECK-LABEL: @foo3 +#[no_mangle] +pub fn foo3(x: u8, data: &[u8; 3]) -> bool { + // CHECK-NOT: memchr + // CHECK-NOT: slice_contains + data.contains(&x) +} + +// CHECK-LABEL: @foo4 +#[no_mangle] +pub fn foo4(x: u8, data: &[u8; 4]) -> bool { + // CHECK-NOT: memchr + // CHECK-NOT: slice_contains + data.contains(&x) +} + +// CHECK-LABEL: @foo8 +#[no_mangle] +pub fn foo8(x: u8, data: &[u8; 8]) -> bool { + // CHECK-NOT: memchr + // CHECK-NOT: slice_contains + data.contains(&x) +} + +// CHECK-LABEL: @foo8_i8 +#[no_mangle] +pub fn foo8_i8(x: i8, data: &[i8; 8]) -> bool { + // CHECK-NOT: memchr + // CHECK-NOT: slice_contains + !data.contains(&x) +} + +// Check that the general case isn't inlined +// CHECK-LABEL: @foo80 +#[no_mangle] +pub fn foo80(x: u8, data: &[u8; 80]) -> bool { + // CHECK: call core::slice::memchr + data.contains(&x) +} diff --git a/tests/codegen/issues/issue-75978.rs b/tests/codegen/issues/issue-75978.rs new file mode 100644 index 000000000..f335e92c3 --- /dev/null +++ b/tests/codegen/issues/issue-75978.rs @@ -0,0 +1,19 @@ +// compile-flags: -O +// min-llvm-version: 16 + +#![crate_type = "lib"] + +#[no_mangle] +pub fn test() -> u32 { + // CHECK-LABEL: @test( + // CHECK: ret i32 13 + let s = [1, 2, 3, 4, 5, 6, 7]; + + let mut iter = s.iter(); + let mut sum = 0; + while let Some(_) = iter.next() { + sum += iter.next().map_or(1, |&x| x) + } + + sum +} diff --git a/tests/codegen/issues/issue-77812.rs b/tests/codegen/issues/issue-77812.rs new file mode 100644 index 000000000..4cc824145 --- /dev/null +++ b/tests/codegen/issues/issue-77812.rs @@ -0,0 +1,32 @@ +// compile-flags: -O +#![crate_type = "lib"] + +// Test that LLVM can eliminate the unreachable `Variant::Zero` branch. + +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum Variant { + Zero, + One, + Two, +} + +extern { + fn exf1(); + fn exf2(); +} + +pub static mut GLOBAL: Variant = Variant::Zero; + +// CHECK-LABEL: @issue_77812 +#[no_mangle] +pub unsafe fn issue_77812() { + let g = GLOBAL; + if g != Variant::Zero { + match g { + Variant::One => exf1(), + Variant::Two => exf2(), + // CHECK-NOT: panic + Variant::Zero => panic!(), + } + } +} diff --git a/tests/codegen/issues/issue-81408-dllimport-thinlto-windows.rs b/tests/codegen/issues/issue-81408-dllimport-thinlto-windows.rs new file mode 100644 index 000000000..0b6ab4f7e --- /dev/null +++ b/tests/codegen/issues/issue-81408-dllimport-thinlto-windows.rs @@ -0,0 +1,15 @@ +// compile-flags: -O -C lto=thin -C prefer-dynamic=no +// only-windows +// aux-build:static_dllimport_aux.rs + +// Test that on Windows, when performing ThinLTO, we do not mark cross-crate static items with +// dllimport because lld does not fix the symbol names for us. + +extern crate static_dllimport_aux; + +// CHECK-LABEL: @{{.+}}CROSS_CRATE_STATIC_ITEM{{.+}} = +// CHECK-SAME: external local_unnamed_addr global %"{{.+}}AtomicPtr + +pub fn main() { + static_dllimport_aux::memrchr(); +} diff --git a/tests/codegen/issues/issue-84268.rs b/tests/codegen/issues/issue-84268.rs new file mode 100644 index 000000000..7ca195447 --- /dev/null +++ b/tests/codegen/issues/issue-84268.rs @@ -0,0 +1,23 @@ +// compile-flags: -O --crate-type=rlib +#![feature(platform_intrinsics, repr_simd)] + +extern "platform-intrinsic" { + fn simd_fabs(x: T) -> T; + fn simd_eq(x: T, y: T) -> U; +} + +#[repr(simd)] +pub struct V([f32; 4]); + +#[repr(simd)] +pub struct M([i32; 4]); + +#[no_mangle] +// CHECK-LABEL: @is_infinite +pub fn is_infinite(v: V) -> M { + // CHECK: fabs + // CHECK: cmp oeq + unsafe { + simd_eq(simd_fabs(v), V([f32::INFINITY; 4])) + } +} diff --git a/tests/codegen/issues/issue-85872-multiple-reverse.rs b/tests/codegen/issues/issue-85872-multiple-reverse.rs new file mode 100644 index 000000000..591a1aca7 --- /dev/null +++ b/tests/codegen/issues/issue-85872-multiple-reverse.rs @@ -0,0 +1,20 @@ +// min-llvm-version: 15.0.0 +// compile-flags: -O + +#![crate_type = "lib"] + +#[no_mangle] +pub fn u16_be_to_arch(mut data: [u8; 2]) -> [u8; 2] { + // CHECK-LABEL: @u16_be_to_arch + // CHECK: @llvm.bswap.i16 + data.reverse(); + data +} + +#[no_mangle] +pub fn u32_be_to_arch(mut data: [u8; 4]) -> [u8; 4] { + // CHECK-LABEL: @u32_be_to_arch + // CHECK: @llvm.bswap.i32 + data.reverse(); + data +} diff --git a/tests/codegen/issues/issue-86106.rs b/tests/codegen/issues/issue-86106.rs new file mode 100644 index 000000000..9ccbcb24f --- /dev/null +++ b/tests/codegen/issues/issue-86106.rs @@ -0,0 +1,62 @@ +// min-llvm-version: 15.0 +// compile-flags: -C opt-level=3 -Z merge-functions=disabled + +// The below two functions ensure that both `String::new()` and `"".to_string()` +// produce the identical code. + +#![crate_type = "lib"] + +// CHECK-LABEL: define void @string_new +#[no_mangle] +pub fn string_new() -> String { + // CHECK-NOT: load i8 + // CHECK: store i{{32|64}} + // CHECK-NEXT: getelementptr + // CHECK-NEXT: store ptr + // CHECK-NEXT: getelementptr + // CHECK-NEXT: store i{{32|64}} + // CHECK-NEXT: ret void + String::new() +} + +// 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-NEXT: getelementptr + // CHECK-NEXT: store i{{32|64}} + // CHECK-NEXT: ret void + "".to_string() +} + +// The below two functions ensure that both `vec![]` and `vec![].clone()` +// produce the identical code. + +// CHECK-LABEL: @empty_vec +#[no_mangle] +pub fn empty_vec() -> Vec { + // CHECK: store i{{32|64}} + // CHECK-NOT: load i8 + // CHECK-NEXT: getelementptr + // CHECK-NEXT: store ptr + // CHECK-NEXT: getelementptr + // CHECK-NEXT: store i{{32|64}} + // CHECK-NEXT: ret void + 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-NEXT: getelementptr + // CHECK-NEXT: store i{{32|64}} + // CHECK-NEXT: ret void + vec![].clone() +} diff --git a/tests/codegen/issues/issue-96274.rs b/tests/codegen/issues/issue-96274.rs new file mode 100644 index 000000000..28bfcce0d --- /dev/null +++ b/tests/codegen/issues/issue-96274.rs @@ -0,0 +1,17 @@ +// min-llvm-version: 15.0 +// compile-flags: -O + +#![crate_type = "lib"] +#![feature(inline_const)] + +use std::mem::MaybeUninit; + +pub fn maybe_uninit() -> [MaybeUninit; 3000] { + // CHECK-NOT: memset + [MaybeUninit::uninit(); 3000] +} + +pub fn maybe_uninit_const() -> [MaybeUninit; 8192] { + // CHECK-NOT: memset + [const { MaybeUninit::uninit() }; 8192] +} diff --git a/tests/codegen/issues/issue-96497-slice-size-nowrap.rs b/tests/codegen/issues/issue-96497-slice-size-nowrap.rs new file mode 100644 index 000000000..0413ed6b2 --- /dev/null +++ b/tests/codegen/issues/issue-96497-slice-size-nowrap.rs @@ -0,0 +1,29 @@ +// This test case checks that LLVM is aware that computing the size of a slice cannot wrap. +// The possibility of wrapping results in an additional branch when dropping boxed slices +// in some situations, see https://github.com/rust-lang/rust/issues/96497#issuecomment-1112865218 + +// compile-flags: -O +// min-llvm-version: 15.0 + +#![crate_type="lib"] + +// CHECK-LABEL: @simple_size_of_nowrap +#[no_mangle] +pub fn simple_size_of_nowrap(x: &[u32]) -> usize { + // Make sure the shift used to compute the size has a nowrap flag. + + // CHECK: [[A:%.*]] = shl nsw {{.*}}, 2 + // CHECK-NEXT: ret {{.*}} [[A]] + core::mem::size_of_val(x) +} + +// CHECK-LABEL: @drop_write +#[no_mangle] +pub fn drop_write(mut x: Box<[u32]>) { + // Check that this write is optimized out. + // This depends on the size calculation not wrapping, + // since otherwise LLVM can't tell that the memory is always deallocated if the slice len > 0. + + // CHECK-NOT: store i32 42 + x[1] = 42; +} diff --git a/tests/codegen/issues/issue-98156-const-arg-temp-lifetime.rs b/tests/codegen/issues/issue-98156-const-arg-temp-lifetime.rs new file mode 100644 index 000000000..12ace5fff --- /dev/null +++ b/tests/codegen/issues/issue-98156-const-arg-temp-lifetime.rs @@ -0,0 +1,27 @@ +// This test checks that temporaries for indirectly-passed arguments get lifetime markers. + +// compile-flags: -O -C no-prepopulate-passes -Zmir-opt-level=0 + +#![crate_type = "lib"] + +extern "Rust" { + fn f(x: [u8; 1024]); +} + +const A: [u8; 1024] = [0; 1024]; + +// CHECK-LABEL: @const_arg_indirect +#[no_mangle] +pub unsafe fn const_arg_indirect() { + // Ensure that the live ranges for the two argument temporaries don't overlap. + + // CHECK: call void @llvm.lifetime.start + // CHECK: call void @f + // CHECK: call void @llvm.lifetime.end + // CHECK: call void @llvm.lifetime.start + // CHECK: call void @f + // CHECK: call void @llvm.lifetime.end + + f(A); + f(A); +} diff --git a/tests/codegen/issues/issue-98294-get-mut-copy-from-slice-opt.rs b/tests/codegen/issues/issue-98294-get-mut-copy-from-slice-opt.rs new file mode 100644 index 000000000..7da29cd79 --- /dev/null +++ b/tests/codegen/issues/issue-98294-get-mut-copy-from-slice-opt.rs @@ -0,0 +1,19 @@ +// min-llvm-version: 15.0.0 +// ignore-debug: The debug assertions get in the way +// compile-flags: -O + +#![crate_type = "lib"] + +// There should be no calls to panic / len_mismatch_fail. + +#[no_mangle] +pub fn test(a: &mut [u8], offset: usize, bytes: &[u8]) { + // CHECK-LABEL: @test( + // CHECK-NOT: call + // CHECK: call void @llvm.memcpy + // CHECK-NOT: call + // CHECK: } + if let Some(dst) = a.get_mut(offset..offset + bytes.len()) { + dst.copy_from_slice(bytes); + } +} diff --git a/tests/codegen/issues/issue-99960.rs b/tests/codegen/issues/issue-99960.rs new file mode 100644 index 000000000..e9c9367fa --- /dev/null +++ b/tests/codegen/issues/issue-99960.rs @@ -0,0 +1,15 @@ +// compile-flags: -O +// min-llvm-version: 16 + +#![crate_type = "lib"] + +#[no_mangle] +pub fn test(dividend: i64, divisor: i64) -> Option { + // CHECK-LABEL: @test( + // CHECK-NOT: panic + if dividend > i64::min_value() && divisor != 0 { + Some(dividend / divisor) + } else { + None + } +} diff --git a/tests/codegen/mem-replace-big-type.rs b/tests/codegen/mem-replace-big-type.rs new file mode 100644 index 000000000..f6898e2f7 --- /dev/null +++ b/tests/codegen/mem-replace-big-type.rs @@ -0,0 +1,36 @@ +// 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"] + +#[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. + 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 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 diff --git a/tests/codegen/mem-replace-direct-memcpy.rs b/tests/codegen/mem-replace-direct-memcpy.rs index e8bbf0e1b..83babab4f 100644 --- a/tests/codegen/mem-replace-direct-memcpy.rs +++ b/tests/codegen/mem-replace-direct-memcpy.rs @@ -13,12 +13,21 @@ pub fn replace_byte(dst: &mut u8, src: u8) -> u8 { } // NOTE(eddyb) the `CHECK-NOT`s ensure that the only calls of `@llvm.memcpy` in -// the entire output, are the two direct calls we want, from `ptr::replace`. +// the entire output, are the direct calls we want, from `ptr::replace`. // CHECK-NOT: call void @llvm.memcpy -// CHECK: ; core::mem::replace -// 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: call void @llvm.memcpy.{{.+}}({{i8\*|ptr}} align 1 %{{.*}}, {{i8\*|ptr}} align 1 %{{.*}}, i{{.*}} 1, i1 false) + +// 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/optimize-attr-1.rs b/tests/codegen/optimize-attr-1.rs index 22abe06e7..1d1f0a386 100644 --- a/tests/codegen/optimize-attr-1.rs +++ b/tests/codegen/optimize-attr-1.rs @@ -8,7 +8,6 @@ // CHECK-LABEL: define{{.*}}i32 @nothing // CHECK-SAME: [[NOTHING_ATTRS:#[0-9]+]] -// NO-OPT: ret i32 4 // SIZE-OPT: ret i32 4 // SPEEC-OPT: ret i32 4 #[no_mangle] @@ -18,7 +17,6 @@ pub fn nothing() -> i32 { // CHECK-LABEL: define{{.*}}i32 @size // CHECK-SAME: [[SIZE_ATTRS:#[0-9]+]] -// NO-OPT: ret i32 6 // SIZE-OPT: ret i32 6 // SPEED-OPT: ret i32 6 #[optimize(size)] @@ -31,7 +29,6 @@ pub fn size() -> i32 { // NO-OPT-SAME: [[NOTHING_ATTRS]] // SPEED-OPT-SAME: [[NOTHING_ATTRS]] // SIZE-OPT-SAME: [[SPEED_ATTRS:#[0-9]+]] -// NO-OPT: ret i32 8 // SIZE-OPT: ret i32 8 // SPEED-OPT: ret i32 8 #[optimize(speed)] diff --git a/tests/codegen/option-as-slice.rs b/tests/codegen/option-as-slice.rs index d5077dbf6..d735d5583 100644 --- a/tests/codegen/option-as-slice.rs +++ b/tests/codegen/option-as-slice.rs @@ -1,4 +1,4 @@ -// compile-flags: -O +// compile-flags: -O -Z randomize-layout=no // only-x86_64 #![crate_type = "lib"] @@ -12,17 +12,25 @@ use core::option::Option; // CHECK-LABEL: @u64_opt_as_slice #[no_mangle] pub fn u64_opt_as_slice(o: &Option) -> &[u64] { - // CHECK: start: // CHECK-NOT: select - // CHECK: ret + // CHECK-NOT: br + // CHECK-NOT: switch + // CHECK-NOT: icmp o.as_slice() } // CHECK-LABEL: @nonzero_u64_opt_as_slice #[no_mangle] pub fn nonzero_u64_opt_as_slice(o: &Option) -> &[NonZeroU64] { - // CHECK: start: // CHECK-NOT: select - // CHECK: ret + // CHECK-NOT: br + // CHECK-NOT: switch + // CHECK-NOT: icmp + // CHECK: %[[NZ:.+]] = icmp ne i64 %{{.+}}, 0 + // CHECK-NEXT: zext i1 %[[NZ]] to i64 + // CHECK-NOT: select + // CHECK-NOT: br + // CHECK-NOT: switch + // CHECK-NOT: icmp o.as_slice() } diff --git a/tests/codegen/ptr-read-metadata.rs b/tests/codegen/ptr-read-metadata.rs new file mode 100644 index 000000000..e1e327266 --- /dev/null +++ b/tests/codegen/ptr-read-metadata.rs @@ -0,0 +1,96 @@ +// compile-flags: -O -Z merge-functions=disabled +// no-system-llvm +// ignore-debug (the extra assertions get in the way) + +#![crate_type = "lib"] + +// Ensure that various forms of reading pointers correctly annotate the `load`s +// with `!noundef` and `!range` metadata to enable extra optimization. + +use std::mem::MaybeUninit; + +// CHECK-LABEL: define noundef i8 @copy_byte( +#[no_mangle] +pub unsafe fn copy_byte(p: *const u8) -> u8 { + // CHECK-NOT: load + // CHECK: load i8, ptr %p, align 1 + // CHECK-SAME: !noundef ! + // CHECK-NOT: load + *p +} + +// CHECK-LABEL: define noundef i8 @read_byte( +#[no_mangle] +pub unsafe fn read_byte(p: *const u8) -> u8 { + // CHECK-NOT: load + // CHECK: load i8, ptr %p, align 1 + // CHECK-SAME: !noundef ! + // CHECK-NOT: load + p.read() +} + +// CHECK-LABEL: define i8 @read_byte_maybe_uninit( +#[no_mangle] +pub unsafe fn read_byte_maybe_uninit(p: *const MaybeUninit) -> MaybeUninit { + // CHECK-NOT: load + // CHECK: load i8, ptr %p, align 1 + // CHECK-NOT: noundef + // CHECK-NOT: load + p.read() +} + +// CHECK-LABEL: define noundef i8 @read_byte_assume_init( +#[no_mangle] +pub unsafe fn read_byte_assume_init(p: &MaybeUninit) -> u8 { + // CHECK-NOT: load + // CHECK: load i8, ptr %p, align 1 + // CHECK-SAME: !noundef ! + // CHECK-NOT: load + p.assume_init_read() +} + +// CHECK-LABEL: define noundef i32 @copy_char( +#[no_mangle] +pub unsafe fn copy_char(p: *const char) -> char { + // CHECK-NOT: load + // CHECK: load i32, ptr %p + // CHECK-SAME: !range ![[RANGE:[0-9]+]] + // CHECK-SAME: !noundef ! + // CHECK-NOT: load + *p +} + +// CHECK-LABEL: define noundef i32 @read_char( +#[no_mangle] +pub unsafe fn read_char(p: *const char) -> char { + // CHECK-NOT: load + // CHECK: load i32, ptr %p + // CHECK-SAME: !range ![[RANGE]] + // CHECK-SAME: !noundef ! + // CHECK-NOT: load + p.read() +} + +// CHECK-LABEL: define i32 @read_char_maybe_uninit( +#[no_mangle] +pub unsafe fn read_char_maybe_uninit(p: *const MaybeUninit) -> MaybeUninit { + // CHECK-NOT: load + // CHECK: load i32, ptr %p + // CHECK-NOT: range + // CHECK-NOT: noundef + // CHECK-NOT: load + p.read() +} + +// CHECK-LABEL: define noundef i32 @read_char_assume_init( +#[no_mangle] +pub unsafe fn read_char_assume_init(p: &MaybeUninit) -> char { + // CHECK-NOT: load + // CHECK: load i32, ptr %p + // CHECK-SAME: !range ![[RANGE]] + // CHECK-SAME: !noundef ! + // CHECK-NOT: load + p.assume_init_read() +} + +// CHECK: ![[RANGE]] = !{i32 0, i32 1114112} diff --git a/tests/codegen/remap_path_prefix/main.rs b/tests/codegen/remap_path_prefix/main.rs index 6c0cd6997..f1e1dd69b 100644 --- a/tests/codegen/remap_path_prefix/main.rs +++ b/tests/codegen/remap_path_prefix/main.rs @@ -12,7 +12,7 @@ mod aux_mod; include!("aux_mod.rs"); // Here we check that the expansion of the file!() macro is mapped. -// CHECK: @alloc_92a59126a55aa3c0019b6c8a007fe001 = private unnamed_addr constant <{ [34 x i8] }> <{ [34 x i8] c"/the/src/remap_path_prefix/main.rs" }> +// CHECK: @alloc_5761061597a97f66e13ef2ff92712c4b = private unnamed_addr constant <{ [34 x i8] }> <{ [34 x i8] c"/the/src/remap_path_prefix/main.rs" }> pub static FILE_PATH: &'static str = file!(); fn main() { diff --git a/tests/codegen/repr-transparent-aggregates-2.rs b/tests/codegen/repr-transparent-aggregates-2.rs index df7e88f08..e9fa5143b 100644 --- a/tests/codegen/repr-transparent-aggregates-2.rs +++ b/tests/codegen/repr-transparent-aggregates-2.rs @@ -6,7 +6,6 @@ // ignore-mips64 // ignore-powerpc // ignore-powerpc64 -// ignore-powerpc64le // ignore-riscv64 see codegen/riscv-abi // ignore-s390x // ignore-sparc diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs index 7c77398df..fd488a14b 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs @@ -4,7 +4,8 @@ #![crate_type = "lib"] #![allow(non_camel_case_types)] -#![feature(repr_simd, platform_intrinsics, min_const_generics)] +#![feature(repr_simd, platform_intrinsics)] +#![feature(inline_const)] #[repr(simd)] #[derive(Copy, Clone)] @@ -18,23 +19,65 @@ pub struct T([f32; 4]); #[derive(Copy, Clone)] pub struct U(f32, f32, f32, f32); +// CHECK-LABEL: @array_align( +#[no_mangle] +pub fn array_align() -> usize { + // CHECK: ret [[USIZE:i[0-9]+]] [[ARRAY_ALIGN:[0-9]+]] + const { std::mem::align_of::() } +} + +// CHECK-LABEL: @vector_align( +#[no_mangle] +pub fn vector_align() -> usize { + // CHECK: ret [[USIZE]] [[VECTOR_ALIGN:[0-9]+]] + const { std::mem::align_of::() } +} + // CHECK-LABEL: @build_array_s #[no_mangle] pub fn build_array_s(x: [f32; 4]) -> S<4> { - // CHECK: call void @llvm.memcpy.{{.+}}({{.*}}, i{{[0-9]+}} 16, i1 false) + // CHECK: call void @llvm.memcpy.{{.+}}({{.*}} align [[VECTOR_ALIGN]] {{.*}} align [[ARRAY_ALIGN]] {{.*}}, [[USIZE]] 16, i1 false) S::<4>(x) } +// CHECK-LABEL: @build_array_transmute_s +#[no_mangle] +pub fn build_array_transmute_s(x: [f32; 4]) -> S<4> { + // CHECK: %[[VAL:.+]] = load <4 x float>, {{ptr %x|.+>\* %.+}}, align [[ARRAY_ALIGN]] + // CHECK: store <4 x float> %[[VAL:.+]], {{ptr %0|.+>\* %.+}}, align [[VECTOR_ALIGN]] + unsafe { std::mem::transmute(x) } +} + // CHECK-LABEL: @build_array_t #[no_mangle] pub fn build_array_t(x: [f32; 4]) -> T { - // CHECK: call void @llvm.memcpy.{{.+}}({{.*}}, i{{[0-9]+}} 16, i1 false) + // CHECK: call void @llvm.memcpy.{{.+}}({{.*}} align [[VECTOR_ALIGN]] {{.*}} align [[ARRAY_ALIGN]] {{.*}}, [[USIZE]] 16, i1 false) T(x) } +// CHECK-LABEL: @build_array_transmute_t +#[no_mangle] +pub fn build_array_transmute_t(x: [f32; 4]) -> T { + // CHECK: %[[VAL:.+]] = load <4 x float>, {{ptr %x|.+>\* %.+}}, align [[ARRAY_ALIGN]] + // CHECK: store <4 x float> %[[VAL:.+]], {{ptr %0|.+>\* %.+}}, align [[VECTOR_ALIGN]] + unsafe { std::mem::transmute(x) } +} + // CHECK-LABEL: @build_array_u #[no_mangle] pub fn build_array_u(x: [f32; 4]) -> U { - // CHECK: call void @llvm.memcpy.{{.+}}({{.*}}, i{{[0-9]+}} 16, i1 false) + // CHECK: store float %a, {{.+}}, align [[VECTOR_ALIGN]] + // CHECK: store float %b, {{.+}}, align [[ARRAY_ALIGN]] + // CHECK: store float %c, {{.+}}, align + // CHECK: store float %d, {{.+}}, align [[ARRAY_ALIGN]] + let [a, b, c, d] = x; + U(a, b, c, d) +} + +// CHECK-LABEL: @build_array_transmute_u +#[no_mangle] +pub fn build_array_transmute_u(x: [f32; 4]) -> U { + // CHECK: %[[VAL:.+]] = load <4 x float>, {{ptr %x|.+>\* %.+}}, align [[ARRAY_ALIGN]] + // CHECK: store <4 x float> %[[VAL:.+]], {{ptr %0|.+>\* %.+}}, align [[VECTOR_ALIGN]] unsafe { std::mem::transmute(x) } } diff --git a/tests/codegen/simd-wide-sum.rs b/tests/codegen/simd-wide-sum.rs index 04314dc29..db2aa20bd 100644 --- a/tests/codegen/simd-wide-sum.rs +++ b/tests/codegen/simd-wide-sum.rs @@ -1,4 +1,4 @@ -// compile-flags: -C opt-level=3 --edition=2021 +// compile-flags: -C opt-level=3 -Z merge-functions=disabled --edition=2021 // only-x86_64 // ignore-debug: the debug assertions get in the way diff --git a/tests/codegen/slice-indexing.rs b/tests/codegen/slice-indexing.rs new file mode 100644 index 000000000..c40d59fb0 --- /dev/null +++ b/tests/codegen/slice-indexing.rs @@ -0,0 +1,35 @@ +// compile-flags: -O +// only-64bit (because the LLVM type of i64 for usize shows up) +// ignore-debug: the debug assertions get in the way + +#![crate_type = "lib"] + +use std::ops::Range; + +// CHECK-LABEL: @index_by_range( +#[no_mangle] +pub fn index_by_range(x: &[u16], r: Range) -> &[u16] { + // CHECK: sub nuw i64 + &x[r] +} + +// CHECK-LABEL: @get_unchecked_by_range( +#[no_mangle] +pub unsafe fn get_unchecked_by_range(x: &[u16], r: Range) -> &[u16] { + // CHECK: sub nuw i64 + x.get_unchecked(r) +} + +// CHECK-LABEL: @index_mut_by_range( +#[no_mangle] +pub fn index_mut_by_range(x: &mut [i32], r: Range) -> &mut [i32] { + // CHECK: sub nuw i64 + &mut x[r] +} + +// CHECK-LABEL: @get_unchecked_mut_by_range( +#[no_mangle] +pub unsafe fn get_unchecked_mut_by_range(x: &mut [i32], r: Range) -> &mut [i32] { + // CHECK: sub nuw i64 + x.get_unchecked_mut(r) +} diff --git a/tests/codegen/transmute-scalar.rs b/tests/codegen/transmute-scalar.rs index 260dcbac0..af2cef472 100644 --- a/tests/codegen/transmute-scalar.rs +++ b/tests/codegen/transmute-scalar.rs @@ -1,80 +1,57 @@ // compile-flags: -O -C no-prepopulate-passes +// min-llvm-version: 15.0 # this test assumes `ptr`s and thus no `pointercast`s #![crate_type = "lib"] -// FIXME(eddyb) all of these tests show memory stores and loads, even after a -// scalar `bitcast`, more special-casing is required to remove `alloca` usage. +// With opaque ptrs in LLVM, `transmute` can load/store any `alloca` as any type, +// without needing to pointercast, and SRoA will turn that into a `bitcast`. +// Thus memory-to-memory transmutes don't need to generate them ourselves. + +// 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: store i32 %{{.*}}, {{.*}} %0 -// CHECK-NEXT: %[[RES:.*]] = load i32, {{.*}} %0 -// CHECK: ret i32 %[[RES]] +// CHECK: %0 = bitcast float %x to i32 +// CHECK-NEXT: ret i32 %0 #[no_mangle] 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: %1 = zext i1 %b to i8 -// CHECK-NEXT: store i8 %1, {{.*}} %0 -// CHECK-NEXT: %2 = load i8, {{.*}} %0 -// CHECK: ret i8 %2 +// CHECK: %0 = zext i1 %b to i8 +// CHECK-NEXT: ret i8 %0 #[no_mangle] 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: %1 = trunc i8 %byte to i1 -// CHECK-NEXT: %2 = zext i1 %1 to i8 -// CHECK-NEXT: store i8 %2, {{.*}} %0 -// CHECK-NEXT: %3 = load i8, {{.*}} %0 -// CHECK-NEXT: %4 = trunc i8 %3 to i1 -// CHECK: ret i1 %4 +// CHECK: %0 = trunc i8 %byte to i1 +// CHECK-NEXT: ret i1 %0 #[no_mangle] pub unsafe fn byte_to_bool(byte: u8) -> bool { std::mem::transmute(byte) } -// CHECK-LABEL: define{{.*}}{{i8\*|ptr}} @ptr_to_ptr({{i16\*|ptr}} noundef %p) -// CHECK: store {{i8\*|ptr}} %{{.*}}, {{.*}} %0 -// CHECK-NEXT: %[[RES:.*]] = load {{i8\*|ptr}}, {{.*}} %0 -// CHECK: ret {{i8\*|ptr}} %[[RES]] +// CHECK-LABEL: define{{.*}}ptr @ptr_to_ptr(ptr noundef %p) +// CHECK: ret ptr %p #[no_mangle] pub fn ptr_to_ptr(p: *mut u16) -> *mut u8 { unsafe { std::mem::transmute(p) } } -// HACK(eddyb) scalar `transmute`s between pointers and non-pointers are -// currently not special-cased like other scalar `transmute`s, because -// LLVM requires specifically `ptrtoint`/`inttoptr` instead of `bitcast`. -// -// Tests below show the non-special-cased behavior (with the possible -// future special-cased instructions in the "NOTE(eddyb)" comments). - -// CHECK: define{{.*}}[[USIZE:i[0-9]+]] @ptr_to_int({{i16\*|ptr}} noundef %p) - -// NOTE(eddyb) see above, the following two CHECK lines should ideally be this: -// %2 = ptrtoint i16* %p to [[USIZE]] -// store [[USIZE]] %2, [[USIZE]]* %0 -// CHECK: store {{i16\*|ptr}} %p, {{.*}} - -// CHECK-NEXT: %[[RES:.*]] = load [[USIZE]], {{.*}} %0 -// CHECK: ret [[USIZE]] %[[RES]] +// CHECK: define{{.*}}[[USIZE:i[0-9]+]] @ptr_to_int(ptr noundef %p) +// CHECK: %0 = ptrtoint ptr %p to [[USIZE]] +// CHECK-NEXT: ret [[USIZE]] %0 #[no_mangle] pub fn ptr_to_int(p: *mut u16) -> usize { unsafe { std::mem::transmute(p) } } -// CHECK: define{{.*}}{{i16\*|ptr}} @int_to_ptr([[USIZE]] noundef %i) - -// NOTE(eddyb) see above, the following two CHECK lines should ideally be this: -// %2 = inttoptr [[USIZE]] %i to i16* -// store i16* %2, i16** %0 -// CHECK: store [[USIZE]] %i, {{.*}} - -// CHECK-NEXT: %[[RES:.*]] = load {{i16\*|ptr}}, {{.*}} %0 -// CHECK: ret {{i16\*|ptr}} %[[RES]] +// CHECK: define{{.*}}ptr @int_to_ptr([[USIZE]] noundef %i) +// CHECK: %0 = inttoptr [[USIZE]] %i to ptr +// CHECK-NEXT: ret ptr %0 #[no_mangle] pub fn int_to_ptr(i: usize) -> *mut u16 { unsafe { std::mem::transmute(i) } diff --git a/tests/codegen/var-names.rs b/tests/codegen/var-names.rs index d4715efad..53841df32 100644 --- a/tests/codegen/var-names.rs +++ b/tests/codegen/var-names.rs @@ -9,7 +9,7 @@ pub fn test(a: u32, b: u32) -> u32 { // CHECK: %c = add i32 %a, %b let d = c; let e = d * a; - // CHECK-NEXT: %e = mul i32 %c, %a + // CHECK-NEXT: %0 = mul i32 %c, %a e - // CHECK-NEXT: ret i32 %e + // CHECK-NEXT: ret i32 %0 } diff --git a/tests/codegen/vec-as-ptr.rs b/tests/codegen/vec-as-ptr.rs new file mode 100644 index 000000000..8ff7ba9cb --- /dev/null +++ b/tests/codegen/vec-as-ptr.rs @@ -0,0 +1,19 @@ +// compile-flags: -O -Zmerge-functions=disabled + +#![crate_type = "lib"] + +// Test that even though we return a *const u8 not a &[u8] or a NonNull, LLVM knows that this +// pointer is nonnull. +// CHECK: nonnull {{i8\*|ptr}} @vec_as_ptr +#[no_mangle] +pub fn vec_as_ptr(v: &Vec) -> *const u8 { + v.as_ptr() +} + +// Test that even though we return a *const u8 not a &[u8] or a NonNull, LLVM knows that this +// pointer is nonnull. +// CHECK: nonnull {{i8\*|ptr}} @vec_as_mut_ptr +#[no_mangle] +pub fn vec_as_mut_ptr(v: &mut Vec) -> *mut u8 { + v.as_mut_ptr() +} diff --git a/tests/codegen/vec-in-place.rs b/tests/codegen/vec-in-place.rs index 999260422..d68067ceb 100644 --- a/tests/codegen/vec-in-place.rs +++ b/tests/codegen/vec-in-place.rs @@ -1,11 +1,13 @@ // ignore-debug: the debug assertions get in the way // compile-flags: -O -Z merge-functions=disabled +// min-llvm-version: 16 #![crate_type = "lib"] // Ensure that trivial casts of vec elements are O(1) pub struct Wrapper(T); +// previously repr(C) caused the optimization to fail #[repr(C)] pub struct Foo { a: u64, @@ -14,9 +16,8 @@ pub struct Foo { d: u64, } -// Going from an aggregate struct to another type currently requires Copy to -// enable the TrustedRandomAccess specialization. Without it optimizations do not yet -// reliably recognize the loops as noop for repr(C) or non-Copy structs. +// implementing Copy exercises the TrustedRandomAccess specialization inside the in-place +// specialization #[derive(Copy, Clone)] pub struct Bar { a: u64, @@ -25,6 +26,14 @@ pub struct Bar { d: u64, } +// this exercises the try-fold codepath +pub struct Baz { + a: u64, + b: u64, + c: u64, + d: u64, +} + // CHECK-LABEL: @vec_iterator_cast_primitive #[no_mangle] pub fn vec_iterator_cast_primitive(vec: Vec) -> Vec { @@ -52,18 +61,29 @@ pub fn vec_iterator_cast_unwrap(vec: Vec>) -> Vec { // CHECK-LABEL: @vec_iterator_cast_aggregate #[no_mangle] pub fn vec_iterator_cast_aggregate(vec: Vec<[u64; 4]>) -> Vec { - // FIXME These checks should be the same as other functions. - // CHECK-NOT: @__rust_alloc - // CHECK-NOT: @__rust_alloc + // CHECK-NOT: loop + // CHECK-NOT: call vec.into_iter().map(|e| unsafe { std::mem::transmute(e) }).collect() } -// CHECK-LABEL: @vec_iterator_cast_deaggregate +// CHECK-LABEL: @vec_iterator_cast_deaggregate_tra #[no_mangle] -pub fn vec_iterator_cast_deaggregate(vec: Vec) -> Vec<[u64; 4]> { - // FIXME These checks should be the same as other functions. - // CHECK-NOT: @__rust_alloc - // CHECK-NOT: @__rust_alloc +pub fn vec_iterator_cast_deaggregate_tra(vec: Vec) -> Vec<[u64; 4]> { + // CHECK-NOT: loop + // CHECK-NOT: call + + // Safety: For the purpose of this test we assume that Bar layout matches [u64; 4]. + // This currently is not guaranteed for repr(Rust) types, but it happens to work here and + // the UCG may add additional guarantees for homogenous types in the future that would make this + // correct. + vec.into_iter().map(|e| unsafe { std::mem::transmute(e) }).collect() +} + +// CHECK-LABEL: @vec_iterator_cast_deaggregate_fold +#[no_mangle] +pub fn vec_iterator_cast_deaggregate_fold(vec: Vec) -> Vec<[u64; 4]> { + // CHECK-NOT: loop + // CHECK-NOT: call // Safety: For the purpose of this test we assume that Bar layout matches [u64; 4]. // This currently is not guaranteed for repr(Rust) types, but it happens to work here and diff --git a/tests/codegen/vec-shrink-panik.rs b/tests/codegen/vec-shrink-panik.rs index aa6589dc3..b3c3483fe 100644 --- a/tests/codegen/vec-shrink-panik.rs +++ b/tests/codegen/vec-shrink-panik.rs @@ -1,3 +1,8 @@ +// revisions: old new +// LLVM 17 realizes double panic is not possible and doesn't generate calls +// to panic_cannot_unwind. +// [old]ignore-llvm-version: 17 - 99 +// [new]min-llvm-version: 17 // compile-flags: -O // ignore-debug: the debug assertions get in the way #![crate_type = "lib"] @@ -18,11 +23,11 @@ pub fn shrink_to_fit(vec: &mut Vec) { pub fn issue71861(vec: Vec) -> Box<[u32]> { // CHECK-NOT: panic - // Call to panic_cannot_unwind in case of double-panic is expected, - // but other panics are not. + // Call to panic_cannot_unwind in case of double-panic is expected + // on LLVM 16 and older, but other panics are not. // CHECK: cleanup - // CHECK-NEXT: ; call core::panicking::panic_cannot_unwind - // CHECK-NEXT: panic_cannot_unwind + // old-NEXT: ; call core::panicking::panic_cannot_unwind + // old-NEXT: panic_cannot_unwind // CHECK-NOT: panic vec.into_boxed_slice() @@ -34,14 +39,14 @@ pub fn issue75636<'a>(iter: &[&'a str]) -> Box<[&'a str]> { // CHECK-NOT: panic // Call to panic_cannot_unwind in case of double-panic is expected, - // but other panics are not. + // on LLVM 16 and older, but other panics are not. // CHECK: cleanup - // CHECK-NEXT: ; call core::panicking::panic_cannot_unwind - // CHECK-NEXT: panic_cannot_unwind + // old-NEXT: ; call core::panicking::panic_cannot_unwind + // old-NEXT: panic_cannot_unwind // CHECK-NOT: panic iter.iter().copied().collect() } -// CHECK: ; core::panicking::panic_cannot_unwind -// CHECK: declare void @{{.*}}panic_cannot_unwind +// old: ; core::panicking::panic_cannot_unwind +// old: declare void @{{.*}}panic_cannot_unwind diff --git a/tests/codegen/virtual-function-elimination.rs b/tests/codegen/virtual-function-elimination.rs index 4cf7e12fe..f22176a02 100644 --- a/tests/codegen/virtual-function-elimination.rs +++ b/tests/codegen/virtual-function-elimination.rs @@ -1,5 +1,6 @@ // compile-flags: -Zvirtual-function-elimination -Clto -O -Csymbol-mangling-version=v0 // ignore-32bit +// ignore-debug // CHECK: @vtable.0 = {{.*}}, !type ![[TYPE0:[0-9]+]], !vcall_visibility ![[VCALL_VIS0:[0-9]+]] // CHECK: @vtable.1 = {{.*}}, !type ![[TYPE1:[0-9]+]], !vcall_visibility ![[VCALL_VIS0:[0-9]+]] @@ -81,7 +82,7 @@ fn taking_u(u: &dyn U) -> i32 { } pub fn taking_v(v: &dyn V) -> i32 { - // CHECK: @llvm.type.checked.load({{.*}}, i32 24, metadata !"NtCsfRpWlKdQPZn_28virtual_function_elimination1V") + // CHECK: @llvm.type.checked.load({{.*}}, i32 24, metadata !"NtCs64ITQYi9761_28virtual_function_elimination1V") v.public_function() } @@ -96,5 +97,5 @@ pub fn main() { // CHECK: ![[TYPE0]] = !{i64 0, !"[[MANGLED_TYPE0]]"} // CHECK: ![[VCALL_VIS0]] = !{i64 2} // CHECK: ![[TYPE1]] = !{i64 0, !"[[MANGLED_TYPE1]]"} -// CHECK: ![[TYPE2]] = !{i64 0, !"NtCsfRpWlKdQPZn_28virtual_function_elimination1V"} +// CHECK: ![[TYPE2]] = !{i64 0, !"NtCs64ITQYi9761_28virtual_function_elimination1V"} // CHECK: ![[VCALL_VIS2]] = !{i64 1} diff --git a/tests/debuginfo/function-names.rs b/tests/debuginfo/function-names.rs index 2227de3b3..d9aa03fee 100644 --- a/tests/debuginfo/function-names.rs +++ b/tests/debuginfo/function-names.rs @@ -37,7 +37,7 @@ // Const generic parameter // gdb-command:info functions -q function_names::const_generic_fn.* // gdb-check:[...]static fn function_names::const_generic_fn_bool(); -// gdb-check:[...]static fn function_names::const_generic_fn_non_int<{CONST#6348c650c7b26618}>(); +// gdb-check:[...]static fn function_names::const_generic_fn_non_int<{CONST#ad91263f6d2dd96e}>(); // gdb-check:[...]static fn function_names::const_generic_fn_signed_int<-7>(); // gdb-check:[...]static fn function_names::const_generic_fn_unsigned_int<14>(); @@ -76,9 +76,9 @@ // Const generic parameter // cdb-command:x a!function_names::const_generic_fn* // cdb-check:[...] a!function_names::const_generic_fn_bool (void) +// cdb-check:[...] a!function_names::const_generic_fn_non_int (void) // cdb-check:[...] a!function_names::const_generic_fn_unsigned_int<14> (void) // cdb-check:[...] a!function_names::const_generic_fn_signed_int<-7> (void) -// cdb-check:[...] a!function_names::const_generic_fn_non_int (void) #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/type-names.rs b/tests/debuginfo/type-names.rs index d7b79a845..c5ce044dd 100644 --- a/tests/debuginfo/type-names.rs +++ b/tests/debuginfo/type-names.rs @@ -175,7 +175,6 @@ // 0-sized structs appear to be optimized away in some cases, so only check the structs that do // actually appear. // cdb-command:dv /t *_struct -// cdb-check:struct type_names::GenericStruct,f64> mut_generic_struct = [...] // ENUMS // cdb-command:dv /t *_enum_* diff --git a/tests/incremental/auxiliary/circular-dependencies-aux.rs b/tests/incremental/auxiliary/circular-dependencies-aux.rs new file mode 100644 index 000000000..0e74eb1b2 --- /dev/null +++ b/tests/incremental/auxiliary/circular-dependencies-aux.rs @@ -0,0 +1,10 @@ +// edition: 2021 +// compile-flags: --crate-type lib --extern circular_dependencies={{build-base}}/circular-dependencies/libcircular_dependencies.rmeta --emit dep-info,metadata + +use circular_dependencies::Foo; + +pub fn consume_foo(_: Foo) {} + +pub fn produce_foo() -> Foo { + Foo +} diff --git a/tests/incremental/circular-dependencies.rs b/tests/incremental/circular-dependencies.rs new file mode 100644 index 000000000..10673066a --- /dev/null +++ b/tests/incremental/circular-dependencies.rs @@ -0,0 +1,37 @@ +// ignore-tidy-linelength +// revisions: cpass1 cfail2 +// edition: 2021 +// [cpass1] compile-flags: --crate-type lib --emit dep-info,metadata +// [cfail2] aux-build: circular-dependencies-aux.rs +// [cfail2] compile-flags: --test --extern aux={{build-base}}/circular-dependencies/auxiliary/libcircular_dependencies_aux.rmeta -L dependency={{build-base}}/circular-dependencies + +pub struct Foo; +//[cfail2]~^ NOTE `Foo` is defined in the current crate +//[cfail2]~| NOTE `Foo` is defined in the current crate +//[cfail2]~| NOTE `circular_dependencies::Foo` is defined in crate `circular_dependencies` +//[cfail2]~| NOTE `circular_dependencies::Foo` is defined in crate `circular_dependencies` + +pub fn consume_foo(_: Foo) {} +//[cfail2]~^ NOTE function defined here + +pub fn produce_foo() -> Foo { + Foo +} + +#[test] +fn test() { + aux::consume_foo(produce_foo()); + //[cfail2]~^ ERROR mismatched types [E0308] + //[cfail2]~| NOTE expected `circular_dependencies::Foo`, found `Foo` + //[cfail2]~| NOTE arguments to this function are incorrect + //[cfail2]~| NOTE `Foo` and `circular_dependencies::Foo` have similar names, but are actually distinct types + //[cfail2]~| NOTE the crate `circular_dependencies` is compiled multiple times, possibly with different configurations + //[cfail2]~| NOTE function defined here + + consume_foo(aux::produce_foo()); + //[cfail2]~^ ERROR mismatched types [E0308] + //[cfail2]~| NOTE expected `Foo`, found `circular_dependencies::Foo` + //[cfail2]~| NOTE arguments to this function are incorrect + //[cfail2]~| NOTE `circular_dependencies::Foo` and `Foo` have similar names, but are actually distinct types + //[cfail2]~| NOTE the crate `circular_dependencies` is compiled multiple times, possibly with different configurations +} diff --git a/tests/incremental/hashes/let_expressions.rs b/tests/incremental/hashes/let_expressions.rs index 180bf6fec..7aca43242 100644 --- a/tests/incremental/hashes/let_expressions.rs +++ b/tests/incremental/hashes/let_expressions.rs @@ -193,9 +193,9 @@ pub fn add_initializer() { } #[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="cfail5", except="hir_owner_nodes,typeck")] #[rustc_clean(cfg="cfail6")] pub fn add_initializer() { let _x: i16 = 3i16; diff --git a/tests/incremental/issue-108481-feed-eval-always.rs b/tests/incremental/issue-108481-feed-eval-always.rs new file mode 100644 index 000000000..8f346a720 --- /dev/null +++ b/tests/incremental/issue-108481-feed-eval-always.rs @@ -0,0 +1,16 @@ +// revisions: cpass1 cpass2 + +#![crate_type = "rlib"] + +use std::fmt::Debug; + +// MCVE kindly provided by Nilstrieb at +// https://github.com/rust-lang/rust/issues/108481#issuecomment-1493080185 + +#[derive(Debug)] +pub struct ConstGeneric { + _p: [(); CHUNK_SIZE], +} + +#[cfg(cpass1)] +impl ConstGeneric {} diff --git a/tests/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir b/tests/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir index 5f8b2f931..b1d34a196 100644 --- a/tests/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir @@ -1,36 +1,36 @@ // MIR for `address_of_reborrow` after SimplifyCfg-initial | User Type Annotations -| 0: user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }], value: Ty(*const ^0) }, span: $DIR/address_of.rs:7:5: 7:18, inferred_ty: *const [i32; 10] -| 1: user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }], value: Ty(*const dyn std::marker::Send) }, span: $DIR/address_of.rs:9:5: 9:25, inferred_ty: *const dyn std::marker::Send -| 2: user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }], value: Ty(*const ^0) }, span: $DIR/address_of.rs:13:12: 13:20, inferred_ty: *const [i32; 10] -| 3: user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }], value: Ty(*const ^0) }, span: $DIR/address_of.rs:13:12: 13:20, inferred_ty: *const [i32; 10] -| 4: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(*const [i32; 10]) }, span: $DIR/address_of.rs:14:12: 14:28, inferred_ty: *const [i32; 10] -| 5: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(*const [i32; 10]) }, span: $DIR/address_of.rs:14:12: 14:28, inferred_ty: *const [i32; 10] -| 6: user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }], value: Ty(*const dyn std::marker::Send) }, span: $DIR/address_of.rs:15:12: 15:27, inferred_ty: *const dyn std::marker::Send -| 7: user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }], value: Ty(*const dyn std::marker::Send) }, span: $DIR/address_of.rs:15:12: 15:27, inferred_ty: *const dyn std::marker::Send -| 8: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(*const [i32]) }, span: $DIR/address_of.rs:16:12: 16:24, inferred_ty: *const [i32] -| 9: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(*const [i32]) }, span: $DIR/address_of.rs:16:12: 16:24, inferred_ty: *const [i32] -| 10: user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }], value: Ty(*const ^0) }, span: $DIR/address_of.rs:18:5: 18:18, inferred_ty: *const [i32; 10] -| 11: user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }], value: Ty(*const dyn std::marker::Send) }, span: $DIR/address_of.rs:20:5: 20:25, inferred_ty: *const dyn std::marker::Send -| 12: user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }], value: Ty(*const ^0) }, span: $DIR/address_of.rs:23:12: 23:20, inferred_ty: *const [i32; 10] -| 13: user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }], value: Ty(*const ^0) }, span: $DIR/address_of.rs:23:12: 23:20, inferred_ty: *const [i32; 10] -| 14: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(*const [i32; 10]) }, span: $DIR/address_of.rs:24:12: 24:28, inferred_ty: *const [i32; 10] -| 15: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(*const [i32; 10]) }, span: $DIR/address_of.rs:24:12: 24:28, inferred_ty: *const [i32; 10] -| 16: user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }], value: Ty(*const dyn std::marker::Send) }, span: $DIR/address_of.rs:25:12: 25:27, inferred_ty: *const dyn std::marker::Send -| 17: user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }], value: Ty(*const dyn std::marker::Send) }, span: $DIR/address_of.rs:25:12: 25:27, inferred_ty: *const dyn std::marker::Send -| 18: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(*const [i32]) }, span: $DIR/address_of.rs:26:12: 26:24, inferred_ty: *const [i32] -| 19: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(*const [i32]) }, span: $DIR/address_of.rs:26:12: 26:24, inferred_ty: *const [i32] -| 20: user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }], value: Ty(*mut ^0) }, span: $DIR/address_of.rs:28:5: 28:16, inferred_ty: *mut [i32; 10] -| 21: user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }], value: Ty(*mut dyn std::marker::Send) }, span: $DIR/address_of.rs:30:5: 30:23, inferred_ty: *mut dyn std::marker::Send -| 22: user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }], value: Ty(*mut ^0) }, span: $DIR/address_of.rs:33:12: 33:18, inferred_ty: *mut [i32; 10] -| 23: user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }], value: Ty(*mut ^0) }, span: $DIR/address_of.rs:33:12: 33:18, inferred_ty: *mut [i32; 10] -| 24: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(*mut [i32; 10]) }, span: $DIR/address_of.rs:34:12: 34:26, inferred_ty: *mut [i32; 10] -| 25: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(*mut [i32; 10]) }, span: $DIR/address_of.rs:34:12: 34:26, inferred_ty: *mut [i32; 10] -| 26: user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }], value: Ty(*mut dyn std::marker::Send) }, span: $DIR/address_of.rs:35:12: 35:25, inferred_ty: *mut dyn std::marker::Send -| 27: user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }], value: Ty(*mut dyn std::marker::Send) }, span: $DIR/address_of.rs:35:12: 35:25, inferred_ty: *mut dyn std::marker::Send -| 28: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(*mut [i32]) }, span: $DIR/address_of.rs:36:12: 36:22, inferred_ty: *mut [i32] -| 29: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(*mut [i32]) }, span: $DIR/address_of.rs:36:12: 36:22, inferred_ty: *mut [i32] +| 0: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:7:5: 7:18, inferred_ty: *const [i32; 10] +| 1: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:9:5: 9:25, inferred_ty: *const dyn std::marker::Send +| 2: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:13:12: 13:20, inferred_ty: *const [i32; 10] +| 3: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:13:12: 13:20, inferred_ty: *const [i32; 10] +| 4: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:14:12: 14:28, inferred_ty: *const [i32; 10] +| 5: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:14:12: 14:28, inferred_ty: *const [i32; 10] +| 6: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:15:12: 15:27, inferred_ty: *const dyn std::marker::Send +| 7: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:15:12: 15:27, inferred_ty: *const dyn std::marker::Send +| 8: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:16:12: 16:24, inferred_ty: *const [i32] +| 9: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:16:12: 16:24, inferred_ty: *const [i32] +| 10: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:18:5: 18:18, inferred_ty: *const [i32; 10] +| 11: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:20:5: 20:25, inferred_ty: *const dyn std::marker::Send +| 12: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:23:12: 23:20, inferred_ty: *const [i32; 10] +| 13: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:23:12: 23:20, inferred_ty: *const [i32; 10] +| 14: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:24:12: 24:28, inferred_ty: *const [i32; 10] +| 15: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:24:12: 24:28, inferred_ty: *const [i32; 10] +| 16: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:25:12: 25:27, inferred_ty: *const dyn std::marker::Send +| 17: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:25:12: 25:27, inferred_ty: *const dyn std::marker::Send +| 18: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:26:12: 26:24, inferred_ty: *const [i32] +| 19: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:26:12: 26:24, inferred_ty: *const [i32] +| 20: user_ty: Canonical { value: Ty(*mut ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:28:5: 28:16, inferred_ty: *mut [i32; 10] +| 21: user_ty: Canonical { value: Ty(*mut dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:30:5: 30:23, inferred_ty: *mut dyn std::marker::Send +| 22: user_ty: Canonical { value: Ty(*mut ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:33:12: 33:18, inferred_ty: *mut [i32; 10] +| 23: user_ty: Canonical { value: Ty(*mut ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:33:12: 33:18, inferred_ty: *mut [i32; 10] +| 24: user_ty: Canonical { value: Ty(*mut [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:34:12: 34:26, inferred_ty: *mut [i32; 10] +| 25: user_ty: Canonical { value: Ty(*mut [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:34:12: 34:26, inferred_ty: *mut [i32; 10] +| 26: user_ty: Canonical { value: Ty(*mut dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:35:12: 35:25, inferred_ty: *mut dyn std::marker::Send +| 27: user_ty: Canonical { value: Ty(*mut dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:35:12: 35:25, inferred_ty: *mut dyn std::marker::Send +| 28: user_ty: Canonical { value: Ty(*mut [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:36:12: 36:22, inferred_ty: *mut [i32] +| 29: user_ty: Canonical { value: Ty(*mut [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:36:12: 36:22, inferred_ty: *mut [i32] | fn address_of_reborrow() -> () { let mut _0: (); // return place in scope 0 at $DIR/address_of.rs:+0:26: +0:26 diff --git a/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir index af5178d40..4be382fac 100644 --- a/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir +++ b/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir @@ -38,7 +38,7 @@ fn main() -> () { _6 = _3; // scope 4 at $DIR/array_index_is_temporary.rs:+4:25: +4:26 _5 = foo(move _6) -> bb1; // scope 4 at $DIR/array_index_is_temporary.rs:+4:21: +4:27 // mir::Constant - // + span: $DIR/array_index_is_temporary.rs:16:21: 16:24 + // + span: $DIR/array_index_is_temporary.rs:17:21: 17:24 // + literal: Const { ty: unsafe fn(*mut usize) -> u32 {foo}, val: Value() } } diff --git a/tests/mir-opt/array_index_is_temporary.rs b/tests/mir-opt/array_index_is_temporary.rs index e7bde81d4..702b9c70e 100644 --- a/tests/mir-opt/array_index_is_temporary.rs +++ b/tests/mir-opt/array_index_is_temporary.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // Retagging (from Stacked Borrows) relies on the array index being a fresh // temporary, so that side-effects cannot change it. // Test that this is indeed the case. diff --git a/tests/mir-opt/asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir b/tests/mir-opt/asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir index 2487ef5c2..f6954ab35 100644 --- a/tests/mir-opt/asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir +++ b/tests/mir-opt/asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir @@ -9,7 +9,7 @@ fn main() -> () { bb0: { StorageLive(_1); // scope 1 at $DIR/asm_unwind_panic_abort.rs:+2:9: +2:49 _1 = const (); // scope 1 at $DIR/asm_unwind_panic_abort.rs:+2:9: +2:49 - asm!("", options(MAY_UNWIND)) -> [return: bb1, unwind: bb2]; // scope 1 at $DIR/asm_unwind_panic_abort.rs:+2:9: +2:49 + asm!("", options(MAY_UNWIND)) -> [return: bb1, unwind terminate]; // scope 1 at $DIR/asm_unwind_panic_abort.rs:+2:9: +2:49 } bb1: { @@ -17,8 +17,4 @@ fn main() -> () { _0 = const (); // scope 1 at $DIR/asm_unwind_panic_abort.rs:+1:5: +3:6 return; // scope 0 at $DIR/asm_unwind_panic_abort.rs:+4:2: +4:2 } - - bb2 (cleanup): { - abort; // scope 0 at $DIR/asm_unwind_panic_abort.rs:+0:1: +4:2 - } } diff --git a/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff b/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff new file mode 100644 index 000000000..d663c3435 --- /dev/null +++ b/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff @@ -0,0 +1,89 @@ +- // MIR for `main` before ElaborateDrops ++ // MIR for `main` after ElaborateDrops + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/basic_assignment.rs:+0:11: +0:11 + let _1: bool; // in scope 0 at $DIR/basic_assignment.rs:+1:9: +1:17 + let mut _3: bool; // in scope 0 at $DIR/basic_assignment.rs:+6:16: +6:24 + let mut _6: std::option::Option>; // in scope 0 at $DIR/basic_assignment.rs:+13:14: +13:20 + scope 1 { + debug nodrop_x => _1; // in scope 1 at $DIR/basic_assignment.rs:+1:9: +1:17 + let _2: bool; // in scope 1 at $DIR/basic_assignment.rs:+2:9: +2:17 + scope 2 { + debug nodrop_y => _2; // in scope 2 at $DIR/basic_assignment.rs:+2:9: +2:17 + let _4: std::option::Option>; // in scope 2 at $DIR/basic_assignment.rs:+8:9: +8:15 + scope 3 { + debug drop_x => _4; // in scope 3 at $DIR/basic_assignment.rs:+8:9: +8:15 + let _5: std::option::Option>; // in scope 3 at $DIR/basic_assignment.rs:+9:9: +9:15 + scope 4 { + debug drop_y => _5; // in scope 4 at $DIR/basic_assignment.rs:+9:9: +9:15 + } + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/basic_assignment.rs:+1:9: +1:17 + _1 = const false; // scope 0 at $DIR/basic_assignment.rs:+1:20: +1:25 + StorageLive(_2); // scope 1 at $DIR/basic_assignment.rs:+2:9: +2:17 + StorageLive(_3); // scope 2 at $DIR/basic_assignment.rs:+6:16: +6:24 + _3 = _1; // scope 2 at $DIR/basic_assignment.rs:+6:16: +6:24 + _2 = move _3; // scope 2 at $DIR/basic_assignment.rs:+6:5: +6:24 + StorageDead(_3); // scope 2 at $DIR/basic_assignment.rs:+6:23: +6:24 + StorageLive(_4); // scope 2 at $DIR/basic_assignment.rs:+8:9: +8:15 + _4 = Option::>::None; // scope 2 at $DIR/basic_assignment.rs:+8:36: +8:40 + StorageLive(_5); // scope 3 at $DIR/basic_assignment.rs:+9:9: +9:15 + StorageLive(_6); // scope 4 at $DIR/basic_assignment.rs:+13:14: +13:20 + _6 = move _4; // scope 4 at $DIR/basic_assignment.rs:+13:14: +13:20 +- drop(_5) -> [return: bb1, unwind: bb2]; // scope 4 at $DIR/basic_assignment.rs:+13:5: +13:11 ++ goto -> bb1; // scope 4 at $DIR/basic_assignment.rs:+13:5: +13:11 + } + + bb1: { + _5 = move _6; // scope 4 at $DIR/basic_assignment.rs:+13:5: +13:11 +- drop(_6) -> [return: bb3, unwind: bb6]; // scope 4 at $DIR/basic_assignment.rs:+13:19: +13:20 ++ goto -> bb3; // scope 4 at $DIR/basic_assignment.rs:+13:19: +13:20 + } + + bb2 (cleanup): { + _5 = move _6; // scope 4 at $DIR/basic_assignment.rs:+13:5: +13:11 + drop(_6) -> [return: bb6, unwind terminate]; // scope 4 at $DIR/basic_assignment.rs:+13:19: +13:20 + } + + bb3: { + StorageDead(_6); // scope 4 at $DIR/basic_assignment.rs:+13:19: +13:20 + _0 = const (); // scope 0 at $DIR/basic_assignment.rs:+0:11: +14:2 + drop(_5) -> [return: bb4, unwind: bb7]; // scope 3 at $DIR/basic_assignment.rs:+14:1: +14:2 + } + + bb4: { + StorageDead(_5); // scope 3 at $DIR/basic_assignment.rs:+14:1: +14:2 +- drop(_4) -> bb5; // scope 2 at $DIR/basic_assignment.rs:+14:1: +14:2 ++ goto -> bb5; // scope 2 at $DIR/basic_assignment.rs:+14:1: +14:2 + } + + bb5: { + StorageDead(_4); // scope 2 at $DIR/basic_assignment.rs:+14:1: +14:2 + StorageDead(_2); // scope 1 at $DIR/basic_assignment.rs:+14:1: +14:2 + StorageDead(_1); // scope 0 at $DIR/basic_assignment.rs:+14:1: +14:2 + return; // scope 0 at $DIR/basic_assignment.rs:+14:2: +14:2 + } + + bb6 (cleanup): { + drop(_5) -> [return: bb7, unwind terminate]; // scope 3 at $DIR/basic_assignment.rs:+14:1: +14:2 + } + + bb7 (cleanup): { +- drop(_4) -> [return: bb8, unwind terminate]; // scope 2 at $DIR/basic_assignment.rs:+14:1: +14:2 ++ goto -> bb8; // scope 2 at $DIR/basic_assignment.rs:+14:1: +14:2 + } + + bb8 (cleanup): { + resume; // scope 0 at $DIR/basic_assignment.rs:+0:1: +14:2 ++ } ++ ++ bb9 (cleanup): { ++ unreachable; // scope 0 at $DIR/basic_assignment.rs:+0:1: +14:2 + } + } + diff --git a/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir b/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir index 1f099cd5e..d63497e3a 100644 --- a/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir @@ -1,8 +1,8 @@ // MIR for `main` after SimplifyCfg-initial | User Type Annotations -| 0: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(std::option::Option>) }, span: $DIR/basic_assignment.rs:18:17: 18:33, inferred_ty: std::option::Option> -| 1: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(std::option::Option>) }, span: $DIR/basic_assignment.rs:18:17: 18:33, inferred_ty: std::option::Option> +| 0: user_ty: Canonical { value: Ty(std::option::Option>), max_universe: U0, variables: [] }, span: $DIR/basic_assignment.rs:20:17: 20:33, inferred_ty: std::option::Option> +| 1: user_ty: Canonical { value: Ty(std::option::Option>), max_universe: U0, variables: [] }, span: $DIR/basic_assignment.rs:20:17: 20:33, inferred_ty: std::option::Option> | fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/basic_assignment.rs:+0:11: +0:11 @@ -41,41 +41,43 @@ fn main() -> () { StorageLive(_5); // scope 3 at $DIR/basic_assignment.rs:+9:9: +9:15 StorageLive(_6); // scope 4 at $DIR/basic_assignment.rs:+13:14: +13:20 _6 = move _4; // scope 4 at $DIR/basic_assignment.rs:+13:14: +13:20 - replace(_5 <- move _6) -> [return: bb1, unwind: bb5]; // scope 4 at $DIR/basic_assignment.rs:+13:5: +13:11 + drop(_5) -> [return: bb1, unwind: bb2]; // scope 4 at $DIR/basic_assignment.rs:+13:5: +13:11 } bb1: { - drop(_6) -> [return: bb2, unwind: bb6]; // scope 4 at $DIR/basic_assignment.rs:+13:19: +13:20 + _5 = move _6; // scope 4 at $DIR/basic_assignment.rs:+13:5: +13:11 + drop(_6) -> [return: bb3, unwind: bb6]; // scope 4 at $DIR/basic_assignment.rs:+13:19: +13:20 } - bb2: { + bb2 (cleanup): { + _5 = move _6; // scope 4 at $DIR/basic_assignment.rs:+13:5: +13:11 + drop(_6) -> [return: bb6, unwind terminate]; // scope 4 at $DIR/basic_assignment.rs:+13:19: +13:20 + } + + bb3: { StorageDead(_6); // scope 4 at $DIR/basic_assignment.rs:+13:19: +13:20 _0 = const (); // scope 0 at $DIR/basic_assignment.rs:+0:11: +14:2 - drop(_5) -> [return: bb3, unwind: bb7]; // scope 3 at $DIR/basic_assignment.rs:+14:1: +14:2 + drop(_5) -> [return: bb4, unwind: bb7]; // scope 3 at $DIR/basic_assignment.rs:+14:1: +14:2 } - bb3: { + bb4: { StorageDead(_5); // scope 3 at $DIR/basic_assignment.rs:+14:1: +14:2 - drop(_4) -> [return: bb4, unwind: bb8]; // scope 2 at $DIR/basic_assignment.rs:+14:1: +14:2 + drop(_4) -> [return: bb5, unwind: bb8]; // scope 2 at $DIR/basic_assignment.rs:+14:1: +14:2 } - bb4: { + bb5: { StorageDead(_4); // scope 2 at $DIR/basic_assignment.rs:+14:1: +14:2 StorageDead(_2); // scope 1 at $DIR/basic_assignment.rs:+14:1: +14:2 StorageDead(_1); // scope 0 at $DIR/basic_assignment.rs:+14:1: +14:2 return; // scope 0 at $DIR/basic_assignment.rs:+14:2: +14:2 } - bb5 (cleanup): { - drop(_6) -> bb6; // scope 4 at $DIR/basic_assignment.rs:+13:19: +13:20 - } - bb6 (cleanup): { - drop(_5) -> bb7; // scope 3 at $DIR/basic_assignment.rs:+14:1: +14:2 + drop(_5) -> [return: bb7, unwind terminate]; // scope 3 at $DIR/basic_assignment.rs:+14:1: +14:2 } bb7 (cleanup): { - drop(_4) -> bb8; // scope 2 at $DIR/basic_assignment.rs:+14:1: +14:2 + drop(_4) -> [return: bb8, unwind terminate]; // scope 2 at $DIR/basic_assignment.rs:+14:1: +14:2 } bb8 (cleanup): { diff --git a/tests/mir-opt/basic_assignment.rs b/tests/mir-opt/basic_assignment.rs index ac350271e..92434e44a 100644 --- a/tests/mir-opt/basic_assignment.rs +++ b/tests/mir-opt/basic_assignment.rs @@ -1,5 +1,7 @@ +// needs-unwind // this tests move up progration, which is not yet implemented +// EMIT_MIR basic_assignment.main.ElaborateDrops.diff // EMIT_MIR basic_assignment.main.SimplifyCfg-initial.after.mir // Check codegen for assignments (`a = b`) where the left-hand-side is diff --git a/tests/mir-opt/box_expr.main.ElaborateDrops.before.mir b/tests/mir-opt/box_expr.main.ElaborateDrops.before.mir index 49133138d..bac5b21df 100644 --- a/tests/mir-opt/box_expr.main.ElaborateDrops.before.mir +++ b/tests/mir-opt/box_expr.main.ElaborateDrops.before.mir @@ -3,12 +3,12 @@ fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/box_expr.rs:+0:11: +0:11 let _1: std::boxed::Box; // in scope 0 at $DIR/box_expr.rs:+1:9: +1:10 - let mut _2: usize; // in scope 0 at $DIR/box_expr.rs:+1:13: +1:25 - let mut _3: usize; // in scope 0 at $DIR/box_expr.rs:+1:13: +1:25 - let mut _4: *mut u8; // in scope 0 at $DIR/box_expr.rs:+1:13: +1:25 - let mut _5: std::boxed::Box; // in scope 0 at $DIR/box_expr.rs:+1:13: +1:25 - let _6: (); // in scope 0 at $DIR/box_expr.rs:+2:5: +2:12 - let mut _7: std::boxed::Box; // in scope 0 at $DIR/box_expr.rs:+2:10: +2:11 + let mut _2: usize; // in scope 0 at $DIR/box_expr.rs:+2:5: +2:23 + let mut _3: usize; // in scope 0 at $DIR/box_expr.rs:+2:5: +2:23 + let mut _4: *mut u8; // in scope 0 at $DIR/box_expr.rs:+2:5: +2:23 + let mut _5: std::boxed::Box; // in scope 0 at $DIR/box_expr.rs:+2:5: +2:23 + let _6: (); // in scope 0 at $DIR/box_expr.rs:+3:5: +3:12 + let mut _7: std::boxed::Box; // in scope 0 at $DIR/box_expr.rs:+3:10: +3:11 scope 1 { debug x => _1; // in scope 1 at $DIR/box_expr.rs:+1:9: +1:10 } @@ -17,64 +17,64 @@ fn main() -> () { bb0: { StorageLive(_1); // scope 0 at $DIR/box_expr.rs:+1:9: +1:10 - _2 = SizeOf(S); // scope 2 at $DIR/box_expr.rs:+1:13: +1:25 - _3 = AlignOf(S); // scope 2 at $DIR/box_expr.rs:+1:13: +1:25 - _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> bb1; // scope 2 at $DIR/box_expr.rs:+1:13: +1:25 + _2 = SizeOf(S); // scope 2 at $DIR/box_expr.rs:+2:5: +2:23 + _3 = AlignOf(S); // scope 2 at $DIR/box_expr.rs:+2:5: +2:23 + _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> bb1; // scope 2 at $DIR/box_expr.rs:+2:5: +2:23 // mir::Constant - // + span: $DIR/box_expr.rs:7:13: 7:25 + // + span: $DIR/box_expr.rs:8:5: 8:23 // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value() } } bb1: { - StorageLive(_5); // scope 0 at $DIR/box_expr.rs:+1:13: +1:25 - _5 = ShallowInitBox(move _4, S); // scope 0 at $DIR/box_expr.rs:+1:13: +1:25 - (*_5) = S::new() -> [return: bb2, unwind: bb8]; // scope 0 at $DIR/box_expr.rs:+1:17: +1:25 + StorageLive(_5); // scope 0 at $DIR/box_expr.rs:+2:5: +2:23 + _5 = ShallowInitBox(move _4, S); // scope 0 at $DIR/box_expr.rs:+2:5: +2:23 + (*_5) = S::new() -> [return: bb2, unwind: bb8]; // scope 0 at $DIR/box_expr.rs:+2:14: +2:22 // mir::Constant - // + span: $DIR/box_expr.rs:7:17: 7:23 + // + span: $DIR/box_expr.rs:8:14: 8:20 // + literal: Const { ty: fn() -> S {S::new}, val: Value() } } bb2: { - _1 = move _5; // scope 0 at $DIR/box_expr.rs:+1:13: +1:25 - drop(_5) -> bb3; // scope 0 at $DIR/box_expr.rs:+1:24: +1:25 + _1 = move _5; // scope 0 at $DIR/box_expr.rs:+2:5: +2:23 + drop(_5) -> bb3; // scope 0 at $DIR/box_expr.rs:+2:22: +2:23 } bb3: { - StorageDead(_5); // scope 0 at $DIR/box_expr.rs:+1:24: +1:25 - StorageLive(_6); // scope 1 at $DIR/box_expr.rs:+2:5: +2:12 - StorageLive(_7); // scope 1 at $DIR/box_expr.rs:+2:10: +2:11 - _7 = move _1; // scope 1 at $DIR/box_expr.rs:+2:10: +2:11 - _6 = std::mem::drop::>(move _7) -> [return: bb4, unwind: bb6]; // scope 1 at $DIR/box_expr.rs:+2:5: +2:12 + StorageDead(_5); // scope 0 at $DIR/box_expr.rs:+2:22: +2:23 + StorageLive(_6); // scope 1 at $DIR/box_expr.rs:+3:5: +3:12 + StorageLive(_7); // scope 1 at $DIR/box_expr.rs:+3:10: +3:11 + _7 = move _1; // scope 1 at $DIR/box_expr.rs:+3:10: +3:11 + _6 = std::mem::drop::>(move _7) -> [return: bb4, unwind: bb6]; // scope 1 at $DIR/box_expr.rs:+3:5: +3:12 // mir::Constant - // + span: $DIR/box_expr.rs:8:5: 8:9 + // + span: $DIR/box_expr.rs:9:5: 9:9 // + literal: Const { ty: fn(Box) {std::mem::drop::>}, val: Value() } } bb4: { - StorageDead(_7); // scope 1 at $DIR/box_expr.rs:+2:11: +2:12 - StorageDead(_6); // scope 1 at $DIR/box_expr.rs:+2:12: +2:13 - _0 = const (); // scope 0 at $DIR/box_expr.rs:+0:11: +3:2 - drop(_1) -> bb5; // scope 0 at $DIR/box_expr.rs:+3:1: +3:2 + StorageDead(_7); // scope 1 at $DIR/box_expr.rs:+3:11: +3:12 + StorageDead(_6); // scope 1 at $DIR/box_expr.rs:+3:12: +3:13 + _0 = const (); // scope 0 at $DIR/box_expr.rs:+0:11: +4:2 + drop(_1) -> bb5; // scope 0 at $DIR/box_expr.rs:+4:1: +4:2 } bb5: { - StorageDead(_1); // scope 0 at $DIR/box_expr.rs:+3:1: +3:2 - return; // scope 0 at $DIR/box_expr.rs:+3:2: +3:2 + StorageDead(_1); // scope 0 at $DIR/box_expr.rs:+4:1: +4:2 + return; // scope 0 at $DIR/box_expr.rs:+4:2: +4:2 } bb6 (cleanup): { - drop(_7) -> bb7; // scope 1 at $DIR/box_expr.rs:+2:11: +2:12 + drop(_7) -> [return: bb7, unwind terminate]; // scope 1 at $DIR/box_expr.rs:+3:11: +3:12 } bb7 (cleanup): { - drop(_1) -> bb9; // scope 0 at $DIR/box_expr.rs:+3:1: +3:2 + drop(_1) -> [return: bb9, unwind terminate]; // scope 0 at $DIR/box_expr.rs:+4:1: +4:2 } bb8 (cleanup): { - drop(_5) -> bb9; // scope 0 at $DIR/box_expr.rs:+1:24: +1:25 + drop(_5) -> [return: bb9, unwind terminate]; // scope 0 at $DIR/box_expr.rs:+2:22: +2:23 } bb9 (cleanup): { - resume; // scope 0 at $DIR/box_expr.rs:+0:1: +3:2 + resume; // scope 0 at $DIR/box_expr.rs:+0:1: +4:2 } } diff --git a/tests/mir-opt/box_expr.rs b/tests/mir-opt/box_expr.rs index a214504f6..ad3670b5d 100644 --- a/tests/mir-opt/box_expr.rs +++ b/tests/mir-opt/box_expr.rs @@ -1,17 +1,20 @@ // ignore-wasm32-bare compiled with panic=abort by default -#![feature(box_syntax)] +#![feature(rustc_attrs, stmt_expr_attributes)] // EMIT_MIR box_expr.main.ElaborateDrops.before.mir fn main() { - let x = box S::new(); + let x = #[rustc_box] + Box::new(S::new()); drop(x); } struct S; impl S { - fn new() -> Self { S } + fn new() -> Self { + S + } } impl Drop for S { 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 ad4e5c6fc..7cce3415f 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 (#9), + span: $DIR/async_await.rs:15:8: 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 (#12), + span: $DIR/async_await.rs:16:8: 16:14 (#11), scope: scope[0], }, ignore_for_traits: false, @@ -90,7 +90,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, bb0: { _39 = discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))); // scope 0 at $DIR/async_await.rs:+0:18: +3:2 - switchInt(move _39) -> [0: bb1, 1: bb29, 3: bb27, 4: bb28, otherwise: bb30]; // scope 0 at $DIR/async_await.rs:+0:18: +3:2 + switchInt(move _39) -> [0: bb1, 1: bb28, 3: bb26, 4: bb27, otherwise: bb29]; // scope 0 at $DIR/async_await.rs:+0:18: +3:2 } bb1: { @@ -98,14 +98,14 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17: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(_5); // scope 0 at $DIR/async_await.rs:+1:5: +1:8 - _5 = a() -> bb2; // 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 // + span: $DIR/async_await.rs:15:5: 15:6 // + literal: Const { ty: fn() -> impl Future {a}, val: Value() } } bb2: { - _4 = as IntoFuture>::into_future(move _5) -> bb3; // 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:8: +1:14 // mir::Constant // + span: $DIR/async_await.rs:15:8: 15:14 // + literal: Const { ty: fn(impl Future) -> as IntoFuture>::IntoFuture { as IntoFuture>::into_future}, val: Value() } @@ -126,7 +126,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, 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) -> bb5; // 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 // mir::Constant // + span: $DIR/async_await.rs:15:8: 15:14 // + literal: Const { ty: unsafe fn(&mut impl Future) -> Pin<&mut impl Future> {Pin::<&mut impl Future>::new_unchecked}, val: Value() } @@ -145,7 +145,7 @@ 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) -> bb7; // 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:8: +1:14 // mir::Constant // + span: $DIR/async_await.rs:15:8: 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() } @@ -206,14 +206,14 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, 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(_22); // scope 0 at $DIR/async_await.rs:+2:5: +2:8 - _22 = a() -> bb14; // 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 // + span: $DIR/async_await.rs:16:5: 16:6 // + literal: Const { ty: fn() -> impl Future {a}, val: Value() } } bb14: { - _21 = as IntoFuture>::into_future(move _22) -> bb15; // 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:8: +2:14 // mir::Constant // + span: $DIR/async_await.rs:16:8: 16:14 // + literal: Const { ty: fn(impl Future) -> as IntoFuture>::IntoFuture { as IntoFuture>::into_future}, val: Value() } @@ -234,7 +234,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, 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) -> bb17; // 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 // mir::Constant // + span: $DIR/async_await.rs:16:8: 16:14 // + literal: Const { ty: unsafe fn(&mut impl Future) -> Pin<&mut impl Future> {Pin::<&mut impl Future>::new_unchecked}, val: Value() } @@ -253,7 +253,7 @@ 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) -> bb19; // 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:8: +2:14 // mir::Constant // + span: $DIR/async_await.rs:16:8: 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() } @@ -263,7 +263,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, 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: bb22, 1: bb20, otherwise: bb21]; // 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 } bb20: { @@ -281,10 +281,6 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, } bb21: { - unreachable; // scope 4 at $DIR/async_await.rs:+2:8: +2:14 - } - - bb22: { StorageLive(_33); // scope 4 at $DIR/async_await.rs:+2:5: +2:14 _33 = ((_25 as Ready).0: ()); // scope 4 at $DIR/async_await.rs:+2:5: +2:14 _37 = _33; // scope 6 at $DIR/async_await.rs:+2:5: +2:14 @@ -293,10 +289,10 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, 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 - goto -> bb24; // scope 0 at $DIR/async_await.rs:+2:13: +2:14 + goto -> bb23; // scope 0 at $DIR/async_await.rs:+2:13: +2:14 } - bb23: { + 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 StorageDead(_35); // scope 4 at $DIR/async_await.rs:+2:13: +2:14 @@ -304,23 +300,23 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, goto -> bb16; // scope 4 at $DIR/async_await.rs:+2:8: +2:14 } - bb24: { + bb23: { nop; // scope 0 at $DIR/async_await.rs:+2:13: +2:14 - goto -> bb25; // scope 0 at $DIR/async_await.rs:+3:1: +3:2 + goto -> bb24; // scope 0 at $DIR/async_await.rs:+3:1: +3:2 } - bb25: { + bb24: { StorageDead(_21); // scope 0 at $DIR/async_await.rs:+3:1: +3:2 - goto -> bb26; // scope 0 at $DIR/async_await.rs:+3:1: +3:2 + goto -> bb25; // scope 0 at $DIR/async_await.rs:+3:1: +3:2 } - bb26: { + bb25: { _0 = Poll::<()>::Ready(move _37); // scope 0 at $DIR/async_await.rs:+3:2: +3:2 discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 1; // scope 0 at $DIR/async_await.rs:+3:2: +3:2 return; // scope 0 at $DIR/async_await.rs:+3:2: +3:2 } - bb27: { + bb26: { StorageLive(_3); // scope 0 at $DIR/async_await.rs:+0:18: +3:2 StorageLive(_4); // scope 0 at $DIR/async_await.rs:+0:18: +3:2 StorageLive(_19); // scope 0 at $DIR/async_await.rs:+0:18: +3:2 @@ -329,19 +325,19 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, goto -> bb11; // scope 0 at $DIR/async_await.rs:+0:18: +3:2 } - bb28: { + bb27: { StorageLive(_21); // scope 0 at $DIR/async_await.rs:+0:18: +3:2 StorageLive(_35); // scope 0 at $DIR/async_await.rs:+0:18: +3:2 StorageLive(_36); // scope 0 at $DIR/async_await.rs:+0:18: +3:2 _35 = move _2; // scope 0 at $DIR/async_await.rs:+0:18: +3:2 - goto -> bb23; // scope 0 at $DIR/async_await.rs:+0:18: +3:2 + goto -> bb22; // scope 0 at $DIR/async_await.rs:+0:18: +3:2 } - bb29: { - assert(const false, "`async fn` resumed after completion") -> bb29; // scope 0 at $DIR/async_await.rs:+0:18: +3:2 + bb28: { + assert(const false, "`async fn` resumed after completion") -> bb28; // scope 0 at $DIR/async_await.rs:+0:18: +3:2 } - bb30: { + bb29: { unreachable; // scope 0 at $DIR/async_await.rs:+0:18: +3:2 } } diff --git a/tests/mir-opt/building/custom/aggregate_exprs.adt.built.after.mir b/tests/mir-opt/building/custom/aggregate_exprs.adt.built.after.mir new file mode 100644 index 000000000..49e8c812c --- /dev/null +++ b/tests/mir-opt/building/custom/aggregate_exprs.adt.built.after.mir @@ -0,0 +1,16 @@ +// MIR for `adt` after built + +fn adt() -> Onion { + let mut _0: Onion; // return place in scope 0 at $DIR/aggregate_exprs.rs:+0:13: +0:18 + let mut _1: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _2: Foo; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _3: Bar; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + + bb0: { + _1 = const 1_i32; // scope 0 at $DIR/aggregate_exprs.rs:+6:13: +6:20 + _2 = Foo { a: const 1_i32, b: const 2_i32 }; // scope 0 at $DIR/aggregate_exprs.rs:+7:13: +10:14 + _3 = Bar::Foo(move _2, _1); // scope 0 at $DIR/aggregate_exprs.rs:+11:13: +11:39 + _0 = Onion { neon: ((_3 as variant#0).1: i32) }; // scope 0 at $DIR/aggregate_exprs.rs:+12:13: +12:58 + return; // scope 0 at $DIR/aggregate_exprs.rs:+13:13: +13:21 + } +} diff --git a/tests/mir-opt/building/custom/aggregate_exprs.array.built.after.mir b/tests/mir-opt/building/custom/aggregate_exprs.array.built.after.mir new file mode 100644 index 000000000..30d128973 --- /dev/null +++ b/tests/mir-opt/building/custom/aggregate_exprs.array.built.after.mir @@ -0,0 +1,15 @@ +// MIR for `array` after built + +fn array() -> [i32; 2] { + let mut _0: [i32; 2]; // return place in scope 0 at $DIR/aggregate_exprs.rs:+0:15: +0:23 + let mut _1: [i32; 2]; // 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 + + bb0: { + _1 = [const 42_i32, const 43_i32]; // scope 0 at $DIR/aggregate_exprs.rs:+5:13: +5:25 + _2 = const 1_i32; // scope 0 at $DIR/aggregate_exprs.rs:+6:13: +6:20 + _1 = [_2, const 2_i32]; // scope 0 at $DIR/aggregate_exprs.rs:+7:13: +7:25 + _0 = move _1; // scope 0 at $DIR/aggregate_exprs.rs:+8:13: +8:26 + return; // scope 0 at $DIR/aggregate_exprs.rs:+9:13: +9:21 + } +} diff --git a/tests/mir-opt/building/custom/aggregate_exprs.rs b/tests/mir-opt/building/custom/aggregate_exprs.rs new file mode 100644 index 000000000..554c9c03b --- /dev/null +++ b/tests/mir-opt/building/custom/aggregate_exprs.rs @@ -0,0 +1,71 @@ +#![feature(custom_mir, core_intrinsics)] + +extern crate core; +use core::intrinsics::mir::*; + +// EMIT_MIR aggregate_exprs.tuple.built.after.mir +#[custom_mir(dialect = "built")] +fn tuple() -> (i32, bool) { + mir!( + { + RET = (1, true); + Return() + } + ) +} + +// EMIT_MIR aggregate_exprs.array.built.after.mir +#[custom_mir(dialect = "built")] +fn array() -> [i32; 2] { + mir!( + let x: [i32; 2]; + let one: i32; + { + x = [42, 43]; + one = 1; + x = [one, 2]; + RET = Move(x); + Return() + } + ) +} + +struct Foo { + a: i32, + b: i32, +} + +enum Bar { + Foo(Foo, i32), +} + +union Onion { + neon: i32, + noun: f32, +} + +// EMIT_MIR aggregate_exprs.adt.built.after.mir +#[custom_mir(dialect = "built")] +fn adt() -> Onion { + mir!( + let one: i32; + let x: Foo; + let y: Bar; + { + one = 1; + x = Foo { + a: 1, + b: 2, + }; + y = Bar::Foo(Move(x), one); + RET = Onion { neon: Field(Variant(y, 0), 1) }; + Return() + } + ) +} + +fn main() { + assert_eq!(tuple(), (1, true)); + assert_eq!(array(), [1, 2]); + assert_eq!(unsafe { adt().neon }, 1); +} diff --git a/tests/mir-opt/building/custom/aggregate_exprs.tuple.built.after.mir b/tests/mir-opt/building/custom/aggregate_exprs.tuple.built.after.mir new file mode 100644 index 000000000..5fe45ccc9 --- /dev/null +++ b/tests/mir-opt/building/custom/aggregate_exprs.tuple.built.after.mir @@ -0,0 +1,10 @@ +// MIR for `tuple` after built + +fn tuple() -> (i32, bool) { + let mut _0: (i32, bool); // return place in scope 0 at $DIR/aggregate_exprs.rs:+0:15: +0:26 + + bb0: { + _0 = (const 1_i32, const true); // scope 0 at $DIR/aggregate_exprs.rs:+3:13: +3:28 + return; // scope 0 at $DIR/aggregate_exprs.rs:+4:13: +4:21 + } +} diff --git a/tests/mir-opt/building/custom/as_cast.float_to_int.built.after.mir b/tests/mir-opt/building/custom/as_cast.float_to_int.built.after.mir new file mode 100644 index 000000000..d0b770783 --- /dev/null +++ b/tests/mir-opt/building/custom/as_cast.float_to_int.built.after.mir @@ -0,0 +1,10 @@ +// MIR for `float_to_int` after built + +fn float_to_int(_1: f32) -> i32 { + let mut _0: i32; // return place in scope 0 at $DIR/as_cast.rs:+0:28: +0:31 + + bb0: { + _0 = _1 as i32 (FloatToInt); // scope 0 at $DIR/as_cast.rs:+3:13: +3:27 + return; // scope 0 at $DIR/as_cast.rs:+4:13: +4:21 + } +} diff --git a/tests/mir-opt/building/custom/as_cast.int_to_int.built.after.mir b/tests/mir-opt/building/custom/as_cast.int_to_int.built.after.mir new file mode 100644 index 000000000..aaebff0d7 --- /dev/null +++ b/tests/mir-opt/building/custom/as_cast.int_to_int.built.after.mir @@ -0,0 +1,10 @@ +// MIR for `int_to_int` after built + +fn int_to_int(_1: u32) -> i32 { + let mut _0: i32; // return place in scope 0 at $DIR/as_cast.rs:+0:26: +0:29 + + bb0: { + _0 = _1 as i32 (IntToInt); // scope 0 at $DIR/as_cast.rs:+3:13: +3:27 + return; // scope 0 at $DIR/as_cast.rs:+4:13: +4:21 + } +} diff --git a/tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir b/tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir new file mode 100644 index 000000000..f040cf53d --- /dev/null +++ b/tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir @@ -0,0 +1,10 @@ +// MIR for `int_to_ptr` after built + +fn int_to_ptr(_1: usize) -> *const i32 { + let mut _0: *const i32; // return place in scope 0 at $DIR/as_cast.rs:+0:28: +0:38 + + bb0: { + _0 = _1 as *const i32 (PointerFromExposedAddress); // scope 0 at $DIR/as_cast.rs:+3:13: +3:34 + return; // scope 0 at $DIR/as_cast.rs:+4:13: +4:21 + } +} diff --git a/tests/mir-opt/building/custom/as_cast.rs b/tests/mir-opt/building/custom/as_cast.rs new file mode 100644 index 000000000..b4b5ac6aa --- /dev/null +++ b/tests/mir-opt/building/custom/as_cast.rs @@ -0,0 +1,43 @@ +#![feature(custom_mir, core_intrinsics)] + +extern crate core; +use core::intrinsics::mir::*; + +// EMIT_MIR as_cast.int_to_int.built.after.mir +#[custom_mir(dialect = "built")] +fn int_to_int(x: u32) -> i32 { + mir!( + { + RET = x as i32; + Return() + } + ) +} + +// EMIT_MIR as_cast.float_to_int.built.after.mir +#[custom_mir(dialect = "built")] +fn float_to_int(x: f32) -> i32 { + mir!( + { + RET = x as i32; + Return() + } + ) +} + +// EMIT_MIR as_cast.int_to_ptr.built.after.mir +#[custom_mir(dialect = "built")] +fn int_to_ptr(x: usize) -> *const i32 { + mir!( + { + RET = x as *const i32; + Return() + } + ) +} + +fn main() { + assert_eq!(int_to_int(5), 5); + assert_eq!(float_to_int(5.), 5); + assert_eq!(int_to_ptr(0), std::ptr::null()); +} diff --git a/tests/mir-opt/building/custom/composite_return.rs b/tests/mir-opt/building/custom/composite_return.rs new file mode 100644 index 000000000..701d6b1ab --- /dev/null +++ b/tests/mir-opt/building/custom/composite_return.rs @@ -0,0 +1,21 @@ +#![feature(custom_mir, core_intrinsics)] + +extern crate core; +use core::intrinsics::mir::*; + +// EMIT_MIR composite_return.tuple.built.after.mir +#[custom_mir(dialect = "runtime", phase = "optimized")] +fn tuple() -> (i32, bool) { + mir!( + type RET = (i32, bool); + { + RET.0 = 1; + RET.1 = true; + Return() + } + ) +} + +fn main() { + assert_eq!(tuple(), (1, true)); +} diff --git a/tests/mir-opt/building/custom/composite_return.tuple.built.after.mir b/tests/mir-opt/building/custom/composite_return.tuple.built.after.mir new file mode 100644 index 000000000..d159c1a65 --- /dev/null +++ b/tests/mir-opt/building/custom/composite_return.tuple.built.after.mir @@ -0,0 +1,11 @@ +// MIR for `tuple` after built + +fn tuple() -> (i32, bool) { + let mut _0: (i32, bool); // return place in scope 0 at $DIR/composite_return.rs:+0:15: +0:26 + + bb0: { + (_0.0: i32) = const 1_i32; // scope 0 at $DIR/composite_return.rs:+4:13: +4:22 + (_0.1: bool) = const true; // scope 0 at $DIR/composite_return.rs:+5:13: +5:25 + return; // scope 0 at $DIR/composite_return.rs:+6:13: +6:21 + } +} diff --git a/tests/mir-opt/building/custom/references.raw_pointer_offset.built.after.mir b/tests/mir-opt/building/custom/references.raw_pointer_offset.built.after.mir new file mode 100644 index 000000000..f614aef40 --- /dev/null +++ b/tests/mir-opt/building/custom/references.raw_pointer_offset.built.after.mir @@ -0,0 +1,10 @@ +// MIR for `raw_pointer_offset` after built + +fn raw_pointer_offset(_1: *const i32) -> *const i32 { + let mut _0: *const i32; // return place in scope 0 at $DIR/references.rs:+0:45: +0:55 + + bb0: { + _0 = Offset(_1, const 1_isize); // scope 0 at $DIR/references.rs:+2:9: +2:33 + return; // scope 0 at $DIR/references.rs:+3:9: +3:17 + } +} diff --git a/tests/mir-opt/building/custom/references.rs b/tests/mir-opt/building/custom/references.rs index a1c896de0..f87f6664c 100644 --- a/tests/mir-opt/building/custom/references.rs +++ b/tests/mir-opt/building/custom/references.rs @@ -45,11 +45,22 @@ pub fn raw_pointer(x: *const i32) -> *const i32 { }) } +// EMIT_MIR references.raw_pointer_offset.built.after.mir +#[custom_mir(dialect = "built")] +pub fn raw_pointer_offset(x: *const i32) -> *const i32 { + mir!({ + RET = Offset(x, 1_isize); + Return() + }) +} + fn main() { let mut x = 5; + let arr = [1, 2]; assert_eq!(*mut_ref(&mut x), 5); assert_eq!(*immut_ref(&x), 5); unsafe { assert_eq!(*raw_pointer(addr_of!(x)), 5); + assert_eq!(*raw_pointer_offset(addr_of!(arr[0])), 2); } } diff --git a/tests/mir-opt/building/custom/terminators.drop_first.built.after.mir b/tests/mir-opt/building/custom/terminators.drop_first.built.after.mir index c903e5946..ada78c0fc 100644 --- a/tests/mir-opt/building/custom/terminators.drop_first.built.after.mir +++ b/tests/mir-opt/building/custom/terminators.drop_first.built.after.mir @@ -4,10 +4,11 @@ fn drop_first(_1: WriteOnDrop<'_>, _2: WriteOnDrop<'_>) -> () { let mut _0: (); // return place in scope 0 at $DIR/terminators.rs:+0:59: +0:59 bb0: { - replace(_1 <- move _2) -> bb1; // scope 0 at $DIR/terminators.rs:+3:13: +3:49 + drop(_1) -> bb1; // scope 0 at $DIR/terminators.rs:+3:13: +3:30 } bb1: { - return; // scope 0 at $DIR/terminators.rs:+7:13: +7:21 + _1 = move _2; // scope 0 at $DIR/terminators.rs:+7:13: +7:24 + return; // scope 0 at $DIR/terminators.rs:+8:13: +8:21 } } diff --git a/tests/mir-opt/building/custom/terminators.rs b/tests/mir-opt/building/custom/terminators.rs index c23233fcf..f12405661 100644 --- a/tests/mir-opt/building/custom/terminators.rs +++ b/tests/mir-opt/building/custom/terminators.rs @@ -48,10 +48,11 @@ impl<'a> Drop for WriteOnDrop<'a> { fn drop_first<'a>(a: WriteOnDrop<'a>, b: WriteOnDrop<'a>) { mir!( { - DropAndReplace(a, Move(b), retblock) + Drop(a, retblock) } retblock = { + a = Move(b); Return() } ) 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 5231c2eab..1112177fb 100644 --- a/tests/mir-opt/building/enum_cast.droppy.built.after.mir +++ b/tests/mir-opt/building/enum_cast.droppy.built.after.mir @@ -63,7 +63,7 @@ fn droppy() -> () { } bb4 (cleanup): { - drop(_2) -> bb5; // scope 0 at $DIR/enum_cast.rs:+6:5: +6:6 + drop(_2) -> [return: bb5, unwind terminate]; // scope 0 at $DIR/enum_cast.rs:+6:5: +6:6 } bb5 (cleanup): { diff --git a/tests/mir-opt/building/issue_101867.main.built.after.mir b/tests/mir-opt/building/issue_101867.main.built.after.mir index 628a33f10..44c25ce67 100644 --- a/tests/mir-opt/building/issue_101867.main.built.after.mir +++ b/tests/mir-opt/building/issue_101867.main.built.after.mir @@ -1,8 +1,8 @@ // MIR for `main` after built | User Type Annotations -| 0: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(std::option::Option) }, span: $DIR/issue_101867.rs:3:12: 3:22, inferred_ty: std::option::Option -| 1: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(std::option::Option) }, span: $DIR/issue_101867.rs:3:12: 3:22, inferred_ty: std::option::Option +| 0: user_ty: Canonical { value: Ty(std::option::Option), max_universe: U0, variables: [] }, span: $DIR/issue_101867.rs:3:12: 3:22, inferred_ty: std::option::Option +| 1: user_ty: Canonical { value: Ty(std::option::Option), max_universe: U0, variables: [] }, span: $DIR/issue_101867.rs:3:12: 3:22, inferred_ty: std::option::Option | fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/issue_101867.rs:+0:11: +0:11 diff --git a/tests/mir-opt/building/issue_49232.main.built.after.mir b/tests/mir-opt/building/issue_49232.main.built.after.mir index de5e4c0f6..cc135f417 100644 --- a/tests/mir-opt/building/issue_49232.main.built.after.mir +++ b/tests/mir-opt/building/issue_49232.main.built.after.mir @@ -17,7 +17,7 @@ fn main() -> () { } bb1: { - falseUnwind -> [real: bb2, cleanup: bb11]; // scope 0 at $DIR/issue_49232.rs:+1:5: +9:6 + falseUnwind -> [real: bb2, unwind: bb11]; // scope 0 at $DIR/issue_49232.rs:+1:5: +9:6 } bb2: { diff --git a/tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir b/tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir index cb36bc64d..0e6de839d 100644 --- a/tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir +++ b/tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir @@ -100,6 +100,7 @@ fn full_tested_match() -> () { } bb11: { + PlaceMention(_1); // scope 0 at $DIR/match_false_edges.rs:+1:13: +5:6 StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7 StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7 _0 = const (); // scope 0 at $DIR/match_false_edges.rs:+0:28: +6:2 diff --git a/tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir b/tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir index 7f8755faa..37e6b1cd4 100644 --- a/tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir +++ b/tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir @@ -100,6 +100,7 @@ fn full_tested_match2() -> () { } bb11: { + PlaceMention(_1); // scope 0 at $DIR/match_false_edges.rs:+1:13: +5:6 StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7 StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7 _0 = const (); // scope 0 at $DIR/match_false_edges.rs:+0:29: +6:2 diff --git a/tests/mir-opt/building/match_false_edges.main.built.after.mir b/tests/mir-opt/building/match_false_edges.main.built.after.mir index e8b93f437..7b8983138 100644 --- a/tests/mir-opt/building/match_false_edges.main.built.after.mir +++ b/tests/mir-opt/building/match_false_edges.main.built.after.mir @@ -162,6 +162,7 @@ fn main() -> () { } bb19: { + PlaceMention(_1); // scope 0 at $DIR/match_false_edges.rs:+1:13: +6:6 StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:+6:6: +6:7 StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:+6:6: +6:7 _0 = const (); // scope 0 at $DIR/match_false_edges.rs:+0:11: +7:2 diff --git a/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir b/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir index 41eb00363..7a6944dee 100644 --- a/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir +++ b/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir @@ -1,10 +1,10 @@ // MIR for `main` after built | User Type Annotations -| 0: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(*mut Test) }, span: $DIR/receiver_ptr_mutability.rs:14:14: 14:23, inferred_ty: *mut Test -| 1: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(*mut Test) }, span: $DIR/receiver_ptr_mutability.rs:14:14: 14:23, inferred_ty: *mut Test -| 2: user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }], value: Ty(&&&&*mut Test) }, span: $DIR/receiver_ptr_mutability.rs:18:18: 18:31, inferred_ty: &&&&*mut Test -| 3: user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }], value: Ty(&&&&*mut Test) }, span: $DIR/receiver_ptr_mutability.rs:18:18: 18:31, inferred_ty: &&&&*mut Test +| 0: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:14:14: 14:23, inferred_ty: *mut Test +| 1: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:14:14: 14:23, inferred_ty: *mut Test +| 2: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/receiver_ptr_mutability.rs:18:18: 18:31, inferred_ty: &&&&*mut Test +| 3: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/receiver_ptr_mutability.rs:18:18: 18:31, inferred_ty: &&&&*mut Test | fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/receiver_ptr_mutability.rs:+0:11: +0:11 diff --git a/tests/mir-opt/building/shifts.rs b/tests/mir-opt/building/shifts.rs new file mode 100644 index 000000000..4b63a00a3 --- /dev/null +++ b/tests/mir-opt/building/shifts.rs @@ -0,0 +1,20 @@ +// compile-flags: -C debug-assertions=yes + +// EMIT_MIR shifts.shift_signed.built.after.mir +fn shift_signed(small: i8, big: u128, a: i8, b: i32, c: i128) -> ([i8; 3], [u128; 3]) { + ( + [small >> a, small >> b, small >> c], + [big << a, big << b, big << c], + ) +} + +// EMIT_MIR shifts.shift_unsigned.built.after.mir +fn shift_unsigned(small: u8, big: i128, a: u8, b: u32, c: u128) -> ([u8; 3], [i128; 3]) { + ( + [small >> a, small >> b, small >> c], + [big << a, big << b, big << c], + ) +} + +fn main() { +} diff --git a/tests/mir-opt/building/shifts.shift_signed.built.after.mir b/tests/mir-opt/building/shifts.shift_signed.built.after.mir new file mode 100644 index 000000000..028777cef --- /dev/null +++ b/tests/mir-opt/building/shifts.shift_signed.built.after.mir @@ -0,0 +1,147 @@ +// MIR for `shift_signed` after built + +fn shift_signed(_1: i8, _2: u128, _3: i8, _4: i32, _5: i128) -> ([i8; 3], [u128; 3]) { + debug small => _1; // in scope 0 at $DIR/shifts.rs:+0:17: +0:22 + debug big => _2; // in scope 0 at $DIR/shifts.rs:+0:28: +0:31 + debug a => _3; // in scope 0 at $DIR/shifts.rs:+0:39: +0:40 + debug b => _4; // in scope 0 at $DIR/shifts.rs:+0:46: +0:47 + debug c => _5; // in scope 0 at $DIR/shifts.rs:+0:54: +0:55 + let mut _0: ([i8; 3], [u128; 3]); // return place in scope 0 at $DIR/shifts.rs:+0:66: +0:86 + let mut _6: [i8; 3]; // in scope 0 at $DIR/shifts.rs:+2:9: +2:45 + let mut _7: i8; // in scope 0 at $DIR/shifts.rs:+2:10: +2:20 + let mut _8: i8; // in scope 0 at $DIR/shifts.rs:+2:10: +2:15 + let mut _9: i8; // in scope 0 at $DIR/shifts.rs:+2:19: +2:20 + let mut _10: u8; // in scope 0 at $DIR/shifts.rs:+2:10: +2:20 + let mut _11: bool; // in scope 0 at $DIR/shifts.rs:+2:10: +2:20 + let mut _12: i8; // in scope 0 at $DIR/shifts.rs:+2:22: +2:32 + let mut _13: i8; // in scope 0 at $DIR/shifts.rs:+2:22: +2:27 + let mut _14: i32; // in scope 0 at $DIR/shifts.rs:+2:31: +2:32 + let mut _15: u32; // in scope 0 at $DIR/shifts.rs:+2:22: +2:32 + let mut _16: bool; // in scope 0 at $DIR/shifts.rs:+2:22: +2:32 + let mut _17: i8; // in scope 0 at $DIR/shifts.rs:+2:34: +2:44 + let mut _18: i8; // in scope 0 at $DIR/shifts.rs:+2:34: +2:39 + let mut _19: i128; // in scope 0 at $DIR/shifts.rs:+2:43: +2:44 + let mut _20: u128; // in scope 0 at $DIR/shifts.rs:+2:34: +2:44 + let mut _21: bool; // in scope 0 at $DIR/shifts.rs:+2:34: +2:44 + let mut _22: [u128; 3]; // in scope 0 at $DIR/shifts.rs:+3:9: +3:39 + let mut _23: u128; // in scope 0 at $DIR/shifts.rs:+3:10: +3:18 + let mut _24: u128; // in scope 0 at $DIR/shifts.rs:+3:10: +3:13 + let mut _25: i8; // in scope 0 at $DIR/shifts.rs:+3:17: +3:18 + let mut _26: u8; // in scope 0 at $DIR/shifts.rs:+3:10: +3:18 + let mut _27: bool; // in scope 0 at $DIR/shifts.rs:+3:10: +3:18 + let mut _28: u128; // in scope 0 at $DIR/shifts.rs:+3:20: +3:28 + let mut _29: u128; // in scope 0 at $DIR/shifts.rs:+3:20: +3:23 + let mut _30: i32; // in scope 0 at $DIR/shifts.rs:+3:27: +3:28 + let mut _31: u32; // in scope 0 at $DIR/shifts.rs:+3:20: +3:28 + let mut _32: bool; // in scope 0 at $DIR/shifts.rs:+3:20: +3:28 + let mut _33: u128; // in scope 0 at $DIR/shifts.rs:+3:30: +3:38 + let mut _34: u128; // in scope 0 at $DIR/shifts.rs:+3:30: +3:33 + let mut _35: i128; // in scope 0 at $DIR/shifts.rs:+3:37: +3:38 + let mut _36: u128; // in scope 0 at $DIR/shifts.rs:+3:30: +3:38 + let mut _37: bool; // in scope 0 at $DIR/shifts.rs:+3:30: +3:38 + + bb0: { + StorageLive(_6); // scope 0 at $DIR/shifts.rs:+2:9: +2:45 + StorageLive(_7); // scope 0 at $DIR/shifts.rs:+2:10: +2:20 + StorageLive(_8); // scope 0 at $DIR/shifts.rs:+2:10: +2:15 + _8 = _1; // scope 0 at $DIR/shifts.rs:+2:10: +2:15 + StorageLive(_9); // scope 0 at $DIR/shifts.rs:+2:19: +2:20 + _9 = _3; // scope 0 at $DIR/shifts.rs:+2:19: +2:20 + _10 = _9 as u8 (IntToInt); // scope 0 at $DIR/shifts.rs:+2:10: +2:20 + _11 = Lt(move _10, const 8_u8); // scope 0 at $DIR/shifts.rs:+2:10: +2:20 + assert(move _11, "attempt to shift right by `{}`, which would overflow", _9) -> [success: bb1, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+2:10: +2:20 + } + + bb1: { + _7 = Shr(move _8, move _9); // scope 0 at $DIR/shifts.rs:+2:10: +2:20 + StorageDead(_9); // scope 0 at $DIR/shifts.rs:+2:19: +2:20 + StorageDead(_8); // scope 0 at $DIR/shifts.rs:+2:19: +2:20 + StorageLive(_12); // scope 0 at $DIR/shifts.rs:+2:22: +2:32 + StorageLive(_13); // scope 0 at $DIR/shifts.rs:+2:22: +2:27 + _13 = _1; // scope 0 at $DIR/shifts.rs:+2:22: +2:27 + StorageLive(_14); // scope 0 at $DIR/shifts.rs:+2:31: +2:32 + _14 = _4; // scope 0 at $DIR/shifts.rs:+2:31: +2:32 + _15 = _14 as u32 (IntToInt); // scope 0 at $DIR/shifts.rs:+2:22: +2:32 + _16 = Lt(move _15, const 8_u32); // scope 0 at $DIR/shifts.rs:+2:22: +2:32 + assert(move _16, "attempt to shift right by `{}`, which would overflow", _14) -> [success: bb2, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+2:22: +2:32 + } + + bb2: { + _12 = Shr(move _13, move _14); // scope 0 at $DIR/shifts.rs:+2:22: +2:32 + StorageDead(_14); // scope 0 at $DIR/shifts.rs:+2:31: +2:32 + StorageDead(_13); // scope 0 at $DIR/shifts.rs:+2:31: +2:32 + StorageLive(_17); // scope 0 at $DIR/shifts.rs:+2:34: +2:44 + StorageLive(_18); // scope 0 at $DIR/shifts.rs:+2:34: +2:39 + _18 = _1; // scope 0 at $DIR/shifts.rs:+2:34: +2:39 + StorageLive(_19); // scope 0 at $DIR/shifts.rs:+2:43: +2:44 + _19 = _5; // scope 0 at $DIR/shifts.rs:+2:43: +2:44 + _20 = _19 as u128 (IntToInt); // scope 0 at $DIR/shifts.rs:+2:34: +2:44 + _21 = Lt(move _20, const 8_u128); // scope 0 at $DIR/shifts.rs:+2:34: +2:44 + assert(move _21, "attempt to shift right by `{}`, which would overflow", _19) -> [success: bb3, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+2:34: +2:44 + } + + bb3: { + _17 = Shr(move _18, move _19); // scope 0 at $DIR/shifts.rs:+2:34: +2:44 + StorageDead(_19); // scope 0 at $DIR/shifts.rs:+2:43: +2:44 + StorageDead(_18); // scope 0 at $DIR/shifts.rs:+2:43: +2:44 + _6 = [move _7, move _12, move _17]; // scope 0 at $DIR/shifts.rs:+2:9: +2:45 + StorageDead(_17); // scope 0 at $DIR/shifts.rs:+2:44: +2:45 + StorageDead(_12); // scope 0 at $DIR/shifts.rs:+2:44: +2:45 + StorageDead(_7); // scope 0 at $DIR/shifts.rs:+2:44: +2:45 + StorageLive(_22); // scope 0 at $DIR/shifts.rs:+3:9: +3:39 + StorageLive(_23); // scope 0 at $DIR/shifts.rs:+3:10: +3:18 + StorageLive(_24); // scope 0 at $DIR/shifts.rs:+3:10: +3:13 + _24 = _2; // scope 0 at $DIR/shifts.rs:+3:10: +3:13 + StorageLive(_25); // scope 0 at $DIR/shifts.rs:+3:17: +3:18 + _25 = _3; // scope 0 at $DIR/shifts.rs:+3:17: +3:18 + _26 = _25 as u8 (IntToInt); // scope 0 at $DIR/shifts.rs:+3:10: +3:18 + _27 = Lt(move _26, const 128_u8); // scope 0 at $DIR/shifts.rs:+3:10: +3:18 + assert(move _27, "attempt to shift left by `{}`, which would overflow", _25) -> [success: bb4, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+3:10: +3:18 + } + + bb4: { + _23 = Shl(move _24, move _25); // scope 0 at $DIR/shifts.rs:+3:10: +3:18 + StorageDead(_25); // scope 0 at $DIR/shifts.rs:+3:17: +3:18 + StorageDead(_24); // scope 0 at $DIR/shifts.rs:+3:17: +3:18 + StorageLive(_28); // scope 0 at $DIR/shifts.rs:+3:20: +3:28 + StorageLive(_29); // scope 0 at $DIR/shifts.rs:+3:20: +3:23 + _29 = _2; // scope 0 at $DIR/shifts.rs:+3:20: +3:23 + StorageLive(_30); // scope 0 at $DIR/shifts.rs:+3:27: +3:28 + _30 = _4; // scope 0 at $DIR/shifts.rs:+3:27: +3:28 + _31 = _30 as u32 (IntToInt); // scope 0 at $DIR/shifts.rs:+3:20: +3:28 + _32 = Lt(move _31, const 128_u32); // scope 0 at $DIR/shifts.rs:+3:20: +3:28 + assert(move _32, "attempt to shift left by `{}`, which would overflow", _30) -> [success: bb5, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+3:20: +3:28 + } + + bb5: { + _28 = Shl(move _29, move _30); // scope 0 at $DIR/shifts.rs:+3:20: +3:28 + StorageDead(_30); // scope 0 at $DIR/shifts.rs:+3:27: +3:28 + StorageDead(_29); // scope 0 at $DIR/shifts.rs:+3:27: +3:28 + StorageLive(_33); // scope 0 at $DIR/shifts.rs:+3:30: +3:38 + StorageLive(_34); // scope 0 at $DIR/shifts.rs:+3:30: +3:33 + _34 = _2; // scope 0 at $DIR/shifts.rs:+3:30: +3:33 + StorageLive(_35); // scope 0 at $DIR/shifts.rs:+3:37: +3:38 + _35 = _5; // scope 0 at $DIR/shifts.rs:+3:37: +3:38 + _36 = _35 as u128 (IntToInt); // scope 0 at $DIR/shifts.rs:+3:30: +3:38 + _37 = Lt(move _36, const 128_u128); // scope 0 at $DIR/shifts.rs:+3:30: +3:38 + assert(move _37, "attempt to shift left by `{}`, which would overflow", _35) -> [success: bb6, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+3:30: +3:38 + } + + bb6: { + _33 = Shl(move _34, move _35); // scope 0 at $DIR/shifts.rs:+3:30: +3:38 + StorageDead(_35); // scope 0 at $DIR/shifts.rs:+3:37: +3:38 + StorageDead(_34); // scope 0 at $DIR/shifts.rs:+3:37: +3:38 + _22 = [move _23, move _28, move _33]; // scope 0 at $DIR/shifts.rs:+3:9: +3:39 + StorageDead(_33); // scope 0 at $DIR/shifts.rs:+3:38: +3:39 + StorageDead(_28); // scope 0 at $DIR/shifts.rs:+3:38: +3:39 + StorageDead(_23); // scope 0 at $DIR/shifts.rs:+3:38: +3:39 + _0 = (move _6, move _22); // scope 0 at $DIR/shifts.rs:+1:5: +4:6 + StorageDead(_22); // scope 0 at $DIR/shifts.rs:+4:5: +4:6 + StorageDead(_6); // scope 0 at $DIR/shifts.rs:+4:5: +4:6 + return; // scope 0 at $DIR/shifts.rs:+5:2: +5:2 + } + + bb7 (cleanup): { + resume; // scope 0 at $DIR/shifts.rs:+0:1: +5:2 + } +} diff --git a/tests/mir-opt/building/shifts.shift_unsigned.built.after.mir b/tests/mir-opt/building/shifts.shift_unsigned.built.after.mir new file mode 100644 index 000000000..04da2d20d --- /dev/null +++ b/tests/mir-opt/building/shifts.shift_unsigned.built.after.mir @@ -0,0 +1,135 @@ +// MIR for `shift_unsigned` after built + +fn shift_unsigned(_1: u8, _2: i128, _3: u8, _4: u32, _5: u128) -> ([u8; 3], [i128; 3]) { + debug small => _1; // in scope 0 at $DIR/shifts.rs:+0:19: +0:24 + debug big => _2; // in scope 0 at $DIR/shifts.rs:+0:30: +0:33 + debug a => _3; // in scope 0 at $DIR/shifts.rs:+0:41: +0:42 + debug b => _4; // in scope 0 at $DIR/shifts.rs:+0:48: +0:49 + debug c => _5; // in scope 0 at $DIR/shifts.rs:+0:56: +0:57 + let mut _0: ([u8; 3], [i128; 3]); // return place in scope 0 at $DIR/shifts.rs:+0:68: +0:88 + let mut _6: [u8; 3]; // in scope 0 at $DIR/shifts.rs:+2:9: +2:45 + let mut _7: u8; // in scope 0 at $DIR/shifts.rs:+2:10: +2:20 + let mut _8: u8; // in scope 0 at $DIR/shifts.rs:+2:10: +2:15 + let mut _9: u8; // in scope 0 at $DIR/shifts.rs:+2:19: +2:20 + let mut _10: bool; // in scope 0 at $DIR/shifts.rs:+2:10: +2:20 + let mut _11: u8; // in scope 0 at $DIR/shifts.rs:+2:22: +2:32 + let mut _12: u8; // in scope 0 at $DIR/shifts.rs:+2:22: +2:27 + let mut _13: u32; // in scope 0 at $DIR/shifts.rs:+2:31: +2:32 + let mut _14: bool; // in scope 0 at $DIR/shifts.rs:+2:22: +2:32 + let mut _15: u8; // in scope 0 at $DIR/shifts.rs:+2:34: +2:44 + let mut _16: u8; // in scope 0 at $DIR/shifts.rs:+2:34: +2:39 + let mut _17: u128; // in scope 0 at $DIR/shifts.rs:+2:43: +2:44 + let mut _18: bool; // in scope 0 at $DIR/shifts.rs:+2:34: +2:44 + let mut _19: [i128; 3]; // in scope 0 at $DIR/shifts.rs:+3:9: +3:39 + let mut _20: i128; // in scope 0 at $DIR/shifts.rs:+3:10: +3:18 + let mut _21: i128; // in scope 0 at $DIR/shifts.rs:+3:10: +3:13 + let mut _22: u8; // in scope 0 at $DIR/shifts.rs:+3:17: +3:18 + let mut _23: bool; // in scope 0 at $DIR/shifts.rs:+3:10: +3:18 + let mut _24: i128; // in scope 0 at $DIR/shifts.rs:+3:20: +3:28 + let mut _25: i128; // in scope 0 at $DIR/shifts.rs:+3:20: +3:23 + let mut _26: u32; // in scope 0 at $DIR/shifts.rs:+3:27: +3:28 + let mut _27: bool; // in scope 0 at $DIR/shifts.rs:+3:20: +3:28 + let mut _28: i128; // in scope 0 at $DIR/shifts.rs:+3:30: +3:38 + let mut _29: i128; // in scope 0 at $DIR/shifts.rs:+3:30: +3:33 + let mut _30: u128; // in scope 0 at $DIR/shifts.rs:+3:37: +3:38 + let mut _31: bool; // in scope 0 at $DIR/shifts.rs:+3:30: +3:38 + + bb0: { + StorageLive(_6); // scope 0 at $DIR/shifts.rs:+2:9: +2:45 + StorageLive(_7); // scope 0 at $DIR/shifts.rs:+2:10: +2:20 + StorageLive(_8); // scope 0 at $DIR/shifts.rs:+2:10: +2:15 + _8 = _1; // scope 0 at $DIR/shifts.rs:+2:10: +2:15 + StorageLive(_9); // scope 0 at $DIR/shifts.rs:+2:19: +2:20 + _9 = _3; // scope 0 at $DIR/shifts.rs:+2:19: +2:20 + _10 = Lt(_9, const 8_u8); // scope 0 at $DIR/shifts.rs:+2:10: +2:20 + assert(move _10, "attempt to shift right by `{}`, which would overflow", _9) -> [success: bb1, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+2:10: +2:20 + } + + bb1: { + _7 = Shr(move _8, move _9); // scope 0 at $DIR/shifts.rs:+2:10: +2:20 + StorageDead(_9); // scope 0 at $DIR/shifts.rs:+2:19: +2:20 + StorageDead(_8); // scope 0 at $DIR/shifts.rs:+2:19: +2:20 + StorageLive(_11); // scope 0 at $DIR/shifts.rs:+2:22: +2:32 + StorageLive(_12); // scope 0 at $DIR/shifts.rs:+2:22: +2:27 + _12 = _1; // scope 0 at $DIR/shifts.rs:+2:22: +2:27 + StorageLive(_13); // scope 0 at $DIR/shifts.rs:+2:31: +2:32 + _13 = _4; // scope 0 at $DIR/shifts.rs:+2:31: +2:32 + _14 = Lt(_13, const 8_u32); // scope 0 at $DIR/shifts.rs:+2:22: +2:32 + assert(move _14, "attempt to shift right by `{}`, which would overflow", _13) -> [success: bb2, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+2:22: +2:32 + } + + bb2: { + _11 = Shr(move _12, move _13); // scope 0 at $DIR/shifts.rs:+2:22: +2:32 + StorageDead(_13); // scope 0 at $DIR/shifts.rs:+2:31: +2:32 + StorageDead(_12); // scope 0 at $DIR/shifts.rs:+2:31: +2:32 + StorageLive(_15); // scope 0 at $DIR/shifts.rs:+2:34: +2:44 + StorageLive(_16); // scope 0 at $DIR/shifts.rs:+2:34: +2:39 + _16 = _1; // scope 0 at $DIR/shifts.rs:+2:34: +2:39 + StorageLive(_17); // scope 0 at $DIR/shifts.rs:+2:43: +2:44 + _17 = _5; // scope 0 at $DIR/shifts.rs:+2:43: +2:44 + _18 = Lt(_17, const 8_u128); // scope 0 at $DIR/shifts.rs:+2:34: +2:44 + assert(move _18, "attempt to shift right by `{}`, which would overflow", _17) -> [success: bb3, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+2:34: +2:44 + } + + bb3: { + _15 = Shr(move _16, move _17); // scope 0 at $DIR/shifts.rs:+2:34: +2:44 + StorageDead(_17); // scope 0 at $DIR/shifts.rs:+2:43: +2:44 + StorageDead(_16); // scope 0 at $DIR/shifts.rs:+2:43: +2:44 + _6 = [move _7, move _11, move _15]; // scope 0 at $DIR/shifts.rs:+2:9: +2:45 + StorageDead(_15); // scope 0 at $DIR/shifts.rs:+2:44: +2:45 + StorageDead(_11); // scope 0 at $DIR/shifts.rs:+2:44: +2:45 + StorageDead(_7); // scope 0 at $DIR/shifts.rs:+2:44: +2:45 + StorageLive(_19); // scope 0 at $DIR/shifts.rs:+3:9: +3:39 + StorageLive(_20); // scope 0 at $DIR/shifts.rs:+3:10: +3:18 + StorageLive(_21); // scope 0 at $DIR/shifts.rs:+3:10: +3:13 + _21 = _2; // scope 0 at $DIR/shifts.rs:+3:10: +3:13 + StorageLive(_22); // scope 0 at $DIR/shifts.rs:+3:17: +3:18 + _22 = _3; // scope 0 at $DIR/shifts.rs:+3:17: +3:18 + _23 = Lt(_22, const 128_u8); // scope 0 at $DIR/shifts.rs:+3:10: +3:18 + assert(move _23, "attempt to shift left by `{}`, which would overflow", _22) -> [success: bb4, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+3:10: +3:18 + } + + bb4: { + _20 = Shl(move _21, move _22); // scope 0 at $DIR/shifts.rs:+3:10: +3:18 + StorageDead(_22); // scope 0 at $DIR/shifts.rs:+3:17: +3:18 + StorageDead(_21); // scope 0 at $DIR/shifts.rs:+3:17: +3:18 + StorageLive(_24); // scope 0 at $DIR/shifts.rs:+3:20: +3:28 + StorageLive(_25); // scope 0 at $DIR/shifts.rs:+3:20: +3:23 + _25 = _2; // scope 0 at $DIR/shifts.rs:+3:20: +3:23 + StorageLive(_26); // scope 0 at $DIR/shifts.rs:+3:27: +3:28 + _26 = _4; // scope 0 at $DIR/shifts.rs:+3:27: +3:28 + _27 = Lt(_26, const 128_u32); // scope 0 at $DIR/shifts.rs:+3:20: +3:28 + assert(move _27, "attempt to shift left by `{}`, which would overflow", _26) -> [success: bb5, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+3:20: +3:28 + } + + bb5: { + _24 = Shl(move _25, move _26); // scope 0 at $DIR/shifts.rs:+3:20: +3:28 + StorageDead(_26); // scope 0 at $DIR/shifts.rs:+3:27: +3:28 + StorageDead(_25); // scope 0 at $DIR/shifts.rs:+3:27: +3:28 + StorageLive(_28); // scope 0 at $DIR/shifts.rs:+3:30: +3:38 + StorageLive(_29); // scope 0 at $DIR/shifts.rs:+3:30: +3:33 + _29 = _2; // scope 0 at $DIR/shifts.rs:+3:30: +3:33 + StorageLive(_30); // scope 0 at $DIR/shifts.rs:+3:37: +3:38 + _30 = _5; // scope 0 at $DIR/shifts.rs:+3:37: +3:38 + _31 = Lt(_30, const 128_u128); // scope 0 at $DIR/shifts.rs:+3:30: +3:38 + assert(move _31, "attempt to shift left by `{}`, which would overflow", _30) -> [success: bb6, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+3:30: +3:38 + } + + bb6: { + _28 = Shl(move _29, move _30); // scope 0 at $DIR/shifts.rs:+3:30: +3:38 + StorageDead(_30); // scope 0 at $DIR/shifts.rs:+3:37: +3:38 + StorageDead(_29); // scope 0 at $DIR/shifts.rs:+3:37: +3:38 + _19 = [move _20, move _24, move _28]; // scope 0 at $DIR/shifts.rs:+3:9: +3:39 + StorageDead(_28); // scope 0 at $DIR/shifts.rs:+3:38: +3:39 + StorageDead(_24); // scope 0 at $DIR/shifts.rs:+3:38: +3:39 + StorageDead(_20); // scope 0 at $DIR/shifts.rs:+3:38: +3:39 + _0 = (move _6, move _19); // scope 0 at $DIR/shifts.rs:+1:5: +4:6 + StorageDead(_19); // scope 0 at $DIR/shifts.rs:+4:5: +4:6 + StorageDead(_6); // scope 0 at $DIR/shifts.rs:+4:5: +4:6 + return; // scope 0 at $DIR/shifts.rs:+5:2: +5:2 + } + + bb7 (cleanup): { + resume; // scope 0 at $DIR/shifts.rs:+0:1: +5:2 + } +} diff --git a/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir b/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir index 234cd0839..54f0ea2d8 100644 --- a/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir +++ b/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir @@ -3,21 +3,21 @@ fn move_out_by_subslice() -> () { let mut _0: (); // return place in scope 0 at $DIR/uniform_array_move_out.rs:+0:27: +0:27 let _1: [std::boxed::Box; 2]; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:9: +1:10 - let mut _2: std::boxed::Box; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 - let mut _3: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 - let mut _4: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 - let mut _5: *mut u8; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 - let mut _6: std::boxed::Box; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 - let mut _7: std::boxed::Box; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 - let mut _8: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 - let mut _9: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 - let mut _10: *mut u8; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 - let mut _11: std::boxed::Box; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 + let mut _2: std::boxed::Box; // in scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 + let mut _3: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 + let mut _4: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 + let mut _5: *mut u8; // in scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 + let mut _6: std::boxed::Box; // in scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 + let mut _7: std::boxed::Box; // in scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 + let mut _8: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 + let mut _9: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 + let mut _10: *mut u8; // in scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 + let mut _11: std::boxed::Box; // in scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 scope 1 { debug a => _1; // in scope 1 at $DIR/uniform_array_move_out.rs:+1:9: +1:10 - let _12: [std::boxed::Box; 2]; // in scope 1 at $DIR/uniform_array_move_out.rs:+2:10: +2:12 + let _12: [std::boxed::Box; 2]; // in scope 1 at $DIR/uniform_array_move_out.rs:+7:10: +7:12 scope 4 { - debug _y => _12; // in scope 4 at $DIR/uniform_array_move_out.rs:+2:10: +2:12 + debug _y => _12; // in scope 4 at $DIR/uniform_array_move_out.rs:+7:10: +7:12 } } scope 2 { @@ -27,85 +27,86 @@ fn move_out_by_subslice() -> () { bb0: { StorageLive(_1); // scope 0 at $DIR/uniform_array_move_out.rs:+1:9: +1:10 - StorageLive(_2); // scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 - _3 = SizeOf(i32); // scope 2 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 - _4 = AlignOf(i32); // scope 2 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 - _5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb12]; // scope 2 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 + StorageLive(_2); // scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 + _3 = SizeOf(i32); // scope 2 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 + _4 = AlignOf(i32); // scope 2 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 + _5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb12]; // scope 2 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 // mir::Constant - // + span: $DIR/uniform_array_move_out.rs:11:14: 11:19 + // + span: $DIR/uniform_array_move_out.rs:18:9: 18:20 // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value() } } bb1: { - StorageLive(_6); // scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 - _6 = ShallowInitBox(move _5, i32); // scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 - (*_6) = const 1_i32; // scope 0 at $DIR/uniform_array_move_out.rs:+1:18: +1:19 - _2 = move _6; // scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 - drop(_6) -> [return: bb2, unwind: bb11]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:18: +1:19 + StorageLive(_6); // scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 + _6 = ShallowInitBox(move _5, i32); // scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 + (*_6) = const 1_i32; // scope 0 at $DIR/uniform_array_move_out.rs:+3:18: +3:19 + _2 = move _6; // scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 + drop(_6) -> [return: bb2, unwind: bb11]; // scope 0 at $DIR/uniform_array_move_out.rs:+3:19: +3:20 } bb2: { - StorageDead(_6); // scope 0 at $DIR/uniform_array_move_out.rs:+1:18: +1:19 - StorageLive(_7); // scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 - _8 = SizeOf(i32); // scope 3 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 - _9 = AlignOf(i32); // scope 3 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 - _10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb11]; // scope 3 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 + StorageDead(_6); // scope 0 at $DIR/uniform_array_move_out.rs:+3:19: +3:20 + StorageLive(_7); // scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 + _8 = SizeOf(i32); // scope 3 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 + _9 = AlignOf(i32); // scope 3 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 + _10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb11]; // scope 3 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 // mir::Constant - // + span: $DIR/uniform_array_move_out.rs:11:21: 11:26 + // + span: $DIR/uniform_array_move_out.rs:20:9: 20:20 // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value() } } bb3: { - StorageLive(_11); // scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 - _11 = ShallowInitBox(move _10, i32); // scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 - (*_11) = const 2_i32; // scope 0 at $DIR/uniform_array_move_out.rs:+1:25: +1:26 - _7 = move _11; // scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 - drop(_11) -> [return: bb4, unwind: bb10]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:25: +1:26 + StorageLive(_11); // scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 + _11 = ShallowInitBox(move _10, i32); // scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 + (*_11) = const 2_i32; // scope 0 at $DIR/uniform_array_move_out.rs:+5:18: +5:19 + _7 = move _11; // scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 + drop(_11) -> [return: bb4, unwind: bb10]; // scope 0 at $DIR/uniform_array_move_out.rs:+5:19: +5:20 } bb4: { - StorageDead(_11); // scope 0 at $DIR/uniform_array_move_out.rs:+1:25: +1:26 - _1 = [move _2, move _7]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:13: +1:27 - drop(_7) -> [return: bb5, unwind: bb11]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27 + StorageDead(_11); // scope 0 at $DIR/uniform_array_move_out.rs:+5:19: +5:20 + _1 = [move _2, move _7]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:13: +6:6 + drop(_7) -> [return: bb5, unwind: bb11]; // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6 } bb5: { - StorageDead(_7); // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27 - drop(_2) -> [return: bb6, unwind: bb12]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27 + StorageDead(_7); // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6 + drop(_2) -> [return: bb6, unwind: bb12]; // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6 } bb6: { - StorageDead(_2); // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27 + StorageDead(_2); // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6 FakeRead(ForLet(None), _1); // scope 0 at $DIR/uniform_array_move_out.rs:+1:9: +1:10 - StorageLive(_12); // scope 1 at $DIR/uniform_array_move_out.rs:+2:10: +2:12 - _12 = move _1[0..2]; // scope 1 at $DIR/uniform_array_move_out.rs:+2:10: +2:12 - _0 = const (); // scope 0 at $DIR/uniform_array_move_out.rs:+0:27: +3:2 - drop(_12) -> [return: bb7, unwind: bb9]; // scope 1 at $DIR/uniform_array_move_out.rs:+3:1: +3:2 + PlaceMention(_1); // scope 1 at $DIR/uniform_array_move_out.rs:+7:21: +7:22 + StorageLive(_12); // scope 1 at $DIR/uniform_array_move_out.rs:+7:10: +7:12 + _12 = move _1[0..2]; // scope 1 at $DIR/uniform_array_move_out.rs:+7:10: +7:12 + _0 = const (); // scope 0 at $DIR/uniform_array_move_out.rs:+0:27: +8:2 + drop(_12) -> [return: bb7, unwind: bb9]; // scope 1 at $DIR/uniform_array_move_out.rs:+8:1: +8:2 } bb7: { - StorageDead(_12); // scope 1 at $DIR/uniform_array_move_out.rs:+3:1: +3:2 - drop(_1) -> [return: bb8, unwind: bb12]; // scope 0 at $DIR/uniform_array_move_out.rs:+3:1: +3:2 + StorageDead(_12); // scope 1 at $DIR/uniform_array_move_out.rs:+8:1: +8:2 + drop(_1) -> [return: bb8, unwind: bb12]; // scope 0 at $DIR/uniform_array_move_out.rs:+8:1: +8:2 } bb8: { - StorageDead(_1); // scope 0 at $DIR/uniform_array_move_out.rs:+3:1: +3:2 - return; // scope 0 at $DIR/uniform_array_move_out.rs:+3:2: +3:2 + StorageDead(_1); // scope 0 at $DIR/uniform_array_move_out.rs:+8:1: +8:2 + return; // scope 0 at $DIR/uniform_array_move_out.rs:+8:2: +8:2 } bb9 (cleanup): { - drop(_1) -> bb12; // scope 0 at $DIR/uniform_array_move_out.rs:+3:1: +3:2 + drop(_1) -> [return: bb12, unwind terminate]; // scope 0 at $DIR/uniform_array_move_out.rs:+8:1: +8:2 } bb10 (cleanup): { - drop(_7) -> bb11; // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27 + drop(_7) -> [return: bb11, unwind terminate]; // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6 } bb11 (cleanup): { - drop(_2) -> bb12; // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27 + drop(_2) -> [return: bb12, unwind terminate]; // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6 } bb12 (cleanup): { - resume; // scope 0 at $DIR/uniform_array_move_out.rs:+0:1: +3:2 + resume; // scope 0 at $DIR/uniform_array_move_out.rs:+0:1: +8:2 } } diff --git a/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir b/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir index 24a189498..5090a4ba6 100644 --- a/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir +++ b/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir @@ -3,21 +3,21 @@ fn move_out_from_end() -> () { let mut _0: (); // return place in scope 0 at $DIR/uniform_array_move_out.rs:+0:24: +0:24 let _1: [std::boxed::Box; 2]; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:9: +1:10 - let mut _2: std::boxed::Box; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 - let mut _3: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 - let mut _4: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 - let mut _5: *mut u8; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 - let mut _6: std::boxed::Box; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 - let mut _7: std::boxed::Box; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 - let mut _8: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 - let mut _9: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 - let mut _10: *mut u8; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 - let mut _11: std::boxed::Box; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 + let mut _2: std::boxed::Box; // in scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 + let mut _3: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 + let mut _4: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 + let mut _5: *mut u8; // in scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 + let mut _6: std::boxed::Box; // in scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 + let mut _7: std::boxed::Box; // in scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 + let mut _8: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 + let mut _9: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 + let mut _10: *mut u8; // in scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 + let mut _11: std::boxed::Box; // in scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 scope 1 { debug a => _1; // in scope 1 at $DIR/uniform_array_move_out.rs:+1:9: +1:10 - let _12: std::boxed::Box; // in scope 1 at $DIR/uniform_array_move_out.rs:+2:14: +2:16 + let _12: std::boxed::Box; // in scope 1 at $DIR/uniform_array_move_out.rs:+7:14: +7:16 scope 4 { - debug _y => _12; // in scope 4 at $DIR/uniform_array_move_out.rs:+2:14: +2:16 + debug _y => _12; // in scope 4 at $DIR/uniform_array_move_out.rs:+7:14: +7:16 } } scope 2 { @@ -27,85 +27,86 @@ fn move_out_from_end() -> () { bb0: { StorageLive(_1); // scope 0 at $DIR/uniform_array_move_out.rs:+1:9: +1:10 - StorageLive(_2); // scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 - _3 = SizeOf(i32); // scope 2 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 - _4 = AlignOf(i32); // scope 2 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 - _5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb12]; // scope 2 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 + StorageLive(_2); // scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 + _3 = SizeOf(i32); // scope 2 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 + _4 = AlignOf(i32); // scope 2 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 + _5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb12]; // scope 2 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 // mir::Constant - // + span: $DIR/uniform_array_move_out.rs:5:14: 5:19 + // + span: $DIR/uniform_array_move_out.rs:7:9: 7:20 // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value() } } bb1: { - StorageLive(_6); // scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 - _6 = ShallowInitBox(move _5, i32); // scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 - (*_6) = const 1_i32; // scope 0 at $DIR/uniform_array_move_out.rs:+1:18: +1:19 - _2 = move _6; // scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19 - drop(_6) -> [return: bb2, unwind: bb11]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:18: +1:19 + StorageLive(_6); // scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 + _6 = ShallowInitBox(move _5, i32); // scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 + (*_6) = const 1_i32; // scope 0 at $DIR/uniform_array_move_out.rs:+3:18: +3:19 + _2 = move _6; // scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20 + drop(_6) -> [return: bb2, unwind: bb11]; // scope 0 at $DIR/uniform_array_move_out.rs:+3:19: +3:20 } bb2: { - StorageDead(_6); // scope 0 at $DIR/uniform_array_move_out.rs:+1:18: +1:19 - StorageLive(_7); // scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 - _8 = SizeOf(i32); // scope 3 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 - _9 = AlignOf(i32); // scope 3 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 - _10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb11]; // scope 3 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 + StorageDead(_6); // scope 0 at $DIR/uniform_array_move_out.rs:+3:19: +3:20 + StorageLive(_7); // scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 + _8 = SizeOf(i32); // scope 3 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 + _9 = AlignOf(i32); // scope 3 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 + _10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb11]; // scope 3 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 // mir::Constant - // + span: $DIR/uniform_array_move_out.rs:5:21: 5:26 + // + span: $DIR/uniform_array_move_out.rs:9:9: 9:20 // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value() } } bb3: { - StorageLive(_11); // scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 - _11 = ShallowInitBox(move _10, i32); // scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 - (*_11) = const 2_i32; // scope 0 at $DIR/uniform_array_move_out.rs:+1:25: +1:26 - _7 = move _11; // scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 - drop(_11) -> [return: bb4, unwind: bb10]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:25: +1:26 + StorageLive(_11); // scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 + _11 = ShallowInitBox(move _10, i32); // scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 + (*_11) = const 2_i32; // scope 0 at $DIR/uniform_array_move_out.rs:+5:18: +5:19 + _7 = move _11; // scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20 + drop(_11) -> [return: bb4, unwind: bb10]; // scope 0 at $DIR/uniform_array_move_out.rs:+5:19: +5:20 } bb4: { - StorageDead(_11); // scope 0 at $DIR/uniform_array_move_out.rs:+1:25: +1:26 - _1 = [move _2, move _7]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:13: +1:27 - drop(_7) -> [return: bb5, unwind: bb11]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27 + StorageDead(_11); // scope 0 at $DIR/uniform_array_move_out.rs:+5:19: +5:20 + _1 = [move _2, move _7]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:13: +6:6 + drop(_7) -> [return: bb5, unwind: bb11]; // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6 } bb5: { - StorageDead(_7); // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27 - drop(_2) -> [return: bb6, unwind: bb12]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27 + StorageDead(_7); // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6 + drop(_2) -> [return: bb6, unwind: bb12]; // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6 } bb6: { - StorageDead(_2); // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27 + StorageDead(_2); // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6 FakeRead(ForLet(None), _1); // scope 0 at $DIR/uniform_array_move_out.rs:+1:9: +1:10 - StorageLive(_12); // scope 1 at $DIR/uniform_array_move_out.rs:+2:14: +2:16 - _12 = move _1[1 of 2]; // scope 1 at $DIR/uniform_array_move_out.rs:+2:14: +2:16 - _0 = const (); // scope 0 at $DIR/uniform_array_move_out.rs:+0:24: +3:2 - drop(_12) -> [return: bb7, unwind: bb9]; // scope 1 at $DIR/uniform_array_move_out.rs:+3:1: +3:2 + PlaceMention(_1); // scope 1 at $DIR/uniform_array_move_out.rs:+7:20: +7:21 + StorageLive(_12); // scope 1 at $DIR/uniform_array_move_out.rs:+7:14: +7:16 + _12 = move _1[1 of 2]; // scope 1 at $DIR/uniform_array_move_out.rs:+7:14: +7:16 + _0 = const (); // scope 0 at $DIR/uniform_array_move_out.rs:+0:24: +8:2 + drop(_12) -> [return: bb7, unwind: bb9]; // scope 1 at $DIR/uniform_array_move_out.rs:+8:1: +8:2 } bb7: { - StorageDead(_12); // scope 1 at $DIR/uniform_array_move_out.rs:+3:1: +3:2 - drop(_1) -> [return: bb8, unwind: bb12]; // scope 0 at $DIR/uniform_array_move_out.rs:+3:1: +3:2 + StorageDead(_12); // scope 1 at $DIR/uniform_array_move_out.rs:+8:1: +8:2 + drop(_1) -> [return: bb8, unwind: bb12]; // scope 0 at $DIR/uniform_array_move_out.rs:+8:1: +8:2 } bb8: { - StorageDead(_1); // scope 0 at $DIR/uniform_array_move_out.rs:+3:1: +3:2 - return; // scope 0 at $DIR/uniform_array_move_out.rs:+3:2: +3:2 + StorageDead(_1); // scope 0 at $DIR/uniform_array_move_out.rs:+8:1: +8:2 + return; // scope 0 at $DIR/uniform_array_move_out.rs:+8:2: +8:2 } bb9 (cleanup): { - drop(_1) -> bb12; // scope 0 at $DIR/uniform_array_move_out.rs:+3:1: +3:2 + drop(_1) -> [return: bb12, unwind terminate]; // scope 0 at $DIR/uniform_array_move_out.rs:+8:1: +8:2 } bb10 (cleanup): { - drop(_7) -> bb11; // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27 + drop(_7) -> [return: bb11, unwind terminate]; // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6 } bb11 (cleanup): { - drop(_2) -> bb12; // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27 + drop(_2) -> [return: bb12, unwind terminate]; // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6 } bb12 (cleanup): { - resume; // scope 0 at $DIR/uniform_array_move_out.rs:+0:1: +3:2 + resume; // scope 0 at $DIR/uniform_array_move_out.rs:+0:1: +8:2 } } diff --git a/tests/mir-opt/building/uniform_array_move_out.rs b/tests/mir-opt/building/uniform_array_move_out.rs index e925036ec..4ba107c87 100644 --- a/tests/mir-opt/building/uniform_array_move_out.rs +++ b/tests/mir-opt/building/uniform_array_move_out.rs @@ -1,14 +1,24 @@ -#![feature(box_syntax)] +#![feature(stmt_expr_attributes, rustc_attrs)] // EMIT_MIR uniform_array_move_out.move_out_from_end.built.after.mir fn move_out_from_end() { - let a = [box 1, box 2]; + let a = [ + #[rustc_box] + Box::new(1), + #[rustc_box] + Box::new(2), + ]; let [.., _y] = a; } // EMIT_MIR uniform_array_move_out.move_out_by_subslice.built.after.mir fn move_out_by_subslice() { - let a = [box 1, box 2]; + let a = [ + #[rustc_box] + Box::new(1), + #[rustc_box] + Box::new(2), + ]; let [_y @ ..] = a; } diff --git a/tests/mir-opt/combine_array_len.rs b/tests/mir-opt/combine_array_len.rs index 3ef3bd09a..08c5f1a1f 100644 --- a/tests/mir-opt/combine_array_len.rs +++ b/tests/mir-opt/combine_array_len.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: InstCombine // EMIT_MIR combine_array_len.norm2.InstCombine.diff 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 index 20b0fb964..b715a544f 100644 --- 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 @@ -72,7 +72,7 @@ } bb4 (cleanup): { - drop(_2) -> bb5; // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15 + drop(_2) -> [return: bb5, unwind terminate]; // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15 } bb5 (cleanup): { diff --git a/tests/mir-opt/combine_transmutes.adt_transmutes.InstCombine.diff b/tests/mir-opt/combine_transmutes.adt_transmutes.InstCombine.diff new file mode 100644 index 000000000..168e8c610 --- /dev/null +++ b/tests/mir-opt/combine_transmutes.adt_transmutes.InstCombine.diff @@ -0,0 +1,158 @@ +- // 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.identity_transmutes.InstCombine.diff b/tests/mir-opt/combine_transmutes.identity_transmutes.InstCombine.diff new file mode 100644 index 000000000..ae1185c7f --- /dev/null +++ b/tests/mir-opt/combine_transmutes.identity_transmutes.InstCombine.diff @@ -0,0 +1,43 @@ +- // 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.integer_transmutes.InstCombine.diff b/tests/mir-opt/combine_transmutes.integer_transmutes.InstCombine.diff new file mode 100644 index 000000000..8de7c34e6 --- /dev/null +++ b/tests/mir-opt/combine_transmutes.integer_transmutes.InstCombine.diff @@ -0,0 +1,24 @@ +- // 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.rs b/tests/mir-opt/combine_transmutes.rs new file mode 100644 index 000000000..de9b9c35c --- /dev/null +++ b/tests/mir-opt/combine_transmutes.rs @@ -0,0 +1,65 @@ +// unit-test: InstCombine +// compile-flags: -C panic=abort + +#![crate_type = "lib"] +#![feature(core_intrinsics)] +#![feature(custom_mir)] + +use std::intrinsics::mir::*; +use std::mem::{MaybeUninit, ManuallyDrop, transmute}; + +// EMIT_MIR combine_transmutes.identity_transmutes.InstCombine.diff +pub unsafe fn identity_transmutes() { + // These are nops and should be removed + let _a = transmute::(1); + let _a = transmute::, Vec>(Vec::new()); +} + +#[custom_mir(dialect = "runtime", phase = "initial")] +// EMIT_MIR combine_transmutes.integer_transmutes.InstCombine.diff +pub unsafe fn integer_transmutes() { + mir! { + { + let A = CastTransmute::(1); // Can be a cast + let B = CastTransmute::(1); // UB + let C = CastTransmute::(1); // Can be a cast + let D = CastTransmute::(1); // UB + let E = CastTransmute::(1); // Can be a cast + Return() + } + } +} + +// EMIT_MIR combine_transmutes.adt_transmutes.InstCombine.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)); + let _a: u32 = transmute(Union32 { i32: 0 }); + let _a: i32 = transmute(Union32 { u32: 0 }); + 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_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 41657b53f..19daae865 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 {alloc3: *const i32}; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43 + _3 = const {alloc2: *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(alloc3)) } + // + literal: Const { ty: *const i32, val: Value(Scalar(alloc2)) } _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] = { } } -alloc3 (extern static: X) +alloc2 (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 25ba0face..5b13d6005 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 {alloc3: *const i32}; // 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 + _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(alloc3)) } +- // + literal: Const { ty: *const i32, val: Value(Scalar(alloc2)) } - _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 @@ } } - -- alloc3 (extern static: X) +- alloc2 (extern static: X) diff --git a/tests/mir-opt/const_prop/aggregate.main.ConstProp.diff b/tests/mir-opt/const_prop/aggregate.main.ConstProp.diff index f6e58955b..041197266 100644 --- a/tests/mir-opt/const_prop/aggregate.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/aggregate.main.ConstProp.diff @@ -29,7 +29,7 @@ + _5 = const 1_u8; // scope 1 at $DIR/aggregate.rs:+2:9: +2:10 _4 = foo(move _5) -> bb1; // scope 1 at $DIR/aggregate.rs:+2:5: +2:11 // mir::Constant - // + span: $DIR/aggregate.rs:8:5: 8:8 + // + span: $DIR/aggregate.rs:9:5: 9:8 // + literal: Const { ty: fn(u8) {foo}, val: Value() } } diff --git a/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.mir b/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.mir index 4706af92c..05d4bf8b5 100644 --- a/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.mir +++ b/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.mir @@ -25,7 +25,7 @@ fn main() -> () { _5 = const 1_u8; // scope 1 at $DIR/aggregate.rs:+2:9: +2:10 _4 = foo(move _5) -> bb1; // scope 1 at $DIR/aggregate.rs:+2:5: +2:11 // mir::Constant - // + span: $DIR/aggregate.rs:8:5: 8:8 + // + span: $DIR/aggregate.rs:9:5: 9:8 // + literal: Const { ty: fn(u8) {foo}, val: Value() } } diff --git a/tests/mir-opt/const_prop/aggregate.rs b/tests/mir-opt/const_prop/aggregate.rs index aa123b7a8..ed5a4ab59 100644 --- a/tests/mir-opt/const_prop/aggregate.rs +++ b/tests/mir-opt/const_prop/aggregate.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: ConstProp // compile-flags: -O diff --git a/tests/mir-opt/const_prop/array_index.rs b/tests/mir-opt/const_prop/array_index.rs index d31c2827b..f36cf2213 100644 --- a/tests/mir-opt/const_prop/array_index.rs +++ b/tests/mir-opt/const_prop/array_index.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: ConstProp // EMIT_MIR_FOR_EACH_BIT_WIDTH diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.rs b/tests/mir-opt/const_prop/bad_op_div_by_zero.rs index a6fd325ec..38f1a993d 100644 --- a/tests/mir-opt/const_prop/bad_op_div_by_zero.rs +++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: ConstProp // EMIT_MIR bad_op_div_by_zero.main.ConstProp.diff #[allow(unconditional_panic)] 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 ae9ffd519..bedfa5992 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 @@ -27,17 +27,19 @@ } bb1: { - _5 = Eq(_1, const -1_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 +- _5 = Eq(_1, 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 ++ _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, _1) -> 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, const 0_i32) -> 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, _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 StorageDead(_2); // scope 1 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 cc16a4a5a..a1078472c 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 @@ +// ignore-wasm32 compiled with panic=abort by default // EMIT_MIR bad_op_mod_by_zero.main.ConstProp.diff #[allow(unconditional_panic)] fn main() { 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 38d402b8f..e711babf0 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 @@ -25,7 +25,7 @@ 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 // mir::Constant - // + span: $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35 + // + span: $DIR/bad_op_unsafe_oob_for_slices.rs:6:25: 6: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 _1 = move _2 as *const [i32] (Pointer(Unsize)); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 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 38d402b8f..e711babf0 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 @@ -25,7 +25,7 @@ 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 // mir::Constant - // + span: $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35 + // + span: $DIR/bad_op_unsafe_oob_for_slices.rs:6:25: 6: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 _1 = move _2 as *const [i32] (Pointer(Unsize)); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 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 cf22b06d5..3d252f2d2 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,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // 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/boxes.main.ConstProp.diff b/tests/mir-opt/const_prop/boxes.main.ConstProp.diff index 5ec421eb2..b0e86e753 100644 --- a/tests/mir-opt/const_prop/boxes.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/boxes.main.ConstProp.diff @@ -4,14 +4,14 @@ fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/boxes.rs:+0:11: +0:11 let _1: i32; // in scope 0 at $DIR/boxes.rs:+1:9: +1:10 - let mut _2: i32; // in scope 0 at $DIR/boxes.rs:+1:13: +1:22 - let mut _3: std::boxed::Box; // in scope 0 at $DIR/boxes.rs:+1:14: +1:22 - let mut _4: usize; // in scope 0 at $DIR/boxes.rs:+1:14: +1:22 - let mut _5: usize; // in scope 0 at $DIR/boxes.rs:+1:14: +1:22 - let mut _6: *mut u8; // in scope 0 at $DIR/boxes.rs:+1:14: +1:22 - let mut _7: std::boxed::Box; // in scope 0 at $DIR/boxes.rs:+1:14: +1:22 - let mut _8: *const i32; // in scope 0 at $DIR/boxes.rs:+1:14: +1:22 - let mut _9: *const i32; // in scope 0 at $DIR/boxes.rs:+1:14: +1:22 + let mut _2: i32; // in scope 0 at $DIR/boxes.rs:+1:13: +2:18 + let mut _3: std::boxed::Box; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18 + let mut _4: usize; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18 + let mut _5: usize; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18 + let mut _6: *mut u8; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18 + let mut _7: std::boxed::Box; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18 + let mut _8: *const i32; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18 + let mut _9: *const i32; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18 scope 1 { debug x => _1; // in scope 1 at $DIR/boxes.rs:+1:9: +1:10 } @@ -20,41 +20,41 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/boxes.rs:+1:9: +1:10 - StorageLive(_2); // scope 0 at $DIR/boxes.rs:+1:13: +1:22 - StorageLive(_3); // scope 0 at $DIR/boxes.rs:+1:14: +1:22 -- _4 = SizeOf(i32); // scope 2 at $DIR/boxes.rs:+1:14: +1:22 -- _5 = AlignOf(i32); // scope 2 at $DIR/boxes.rs:+1:14: +1:22 -+ _4 = const 4_usize; // scope 2 at $DIR/boxes.rs:+1:14: +1:22 -+ _5 = const 4_usize; // scope 2 at $DIR/boxes.rs:+1:14: +1:22 - _6 = alloc::alloc::exchange_malloc(move _4, move _5) -> bb1; // scope 2 at $DIR/boxes.rs:+1:14: +1:22 + StorageLive(_2); // scope 0 at $DIR/boxes.rs:+1:13: +2:18 + StorageLive(_3); // scope 0 at $DIR/boxes.rs:+1:14: +2:18 +- _4 = SizeOf(i32); // scope 2 at $DIR/boxes.rs:+1:14: +2:18 +- _5 = AlignOf(i32); // scope 2 at $DIR/boxes.rs:+1:14: +2:18 ++ _4 = const 4_usize; // scope 2 at $DIR/boxes.rs:+1:14: +2:18 ++ _5 = const 4_usize; // scope 2 at $DIR/boxes.rs:+1:14: +2:18 + _6 = alloc::alloc::exchange_malloc(move _4, move _5) -> bb1; // scope 2 at $DIR/boxes.rs:+1:14: +2:18 // mir::Constant - // + span: $DIR/boxes.rs:13:14: 13:22 + // + span: $DIR/boxes.rs:13:14: 14:18 // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value() } } bb1: { - StorageLive(_7); // scope 0 at $DIR/boxes.rs:+1:14: +1:22 - _7 = ShallowInitBox(move _6, i32); // scope 0 at $DIR/boxes.rs:+1:14: +1:22 - _8 = (((_7.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const i32); // scope 0 at $DIR/boxes.rs:+1:19: +1:21 - (*_8) = const 42_i32; // scope 0 at $DIR/boxes.rs:+1:19: +1:21 - _3 = move _7; // scope 0 at $DIR/boxes.rs:+1:14: +1:22 - StorageDead(_7); // scope 0 at $DIR/boxes.rs:+1:21: +1:22 - _9 = (((_3.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const i32); // scope 0 at $DIR/boxes.rs:+1:13: +1:22 - _2 = (*_9); // scope 0 at $DIR/boxes.rs:+1:13: +1:22 - _1 = Add(move _2, const 0_i32); // scope 0 at $DIR/boxes.rs:+1:13: +1:26 - StorageDead(_2); // scope 0 at $DIR/boxes.rs:+1:25: +1:26 - drop(_3) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/boxes.rs:+1:26: +1:27 + StorageLive(_7); // scope 0 at $DIR/boxes.rs:+1:14: +2:18 + _7 = ShallowInitBox(move _6, i32); // scope 0 at $DIR/boxes.rs:+1:14: +2:18 + _8 = (((_7.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const i32); // scope 0 at $DIR/boxes.rs:+2:14: +2:16 + (*_8) = const 42_i32; // scope 0 at $DIR/boxes.rs:+2:14: +2:16 + _3 = move _7; // scope 0 at $DIR/boxes.rs:+1:14: +2:18 + StorageDead(_7); // scope 0 at $DIR/boxes.rs:+2:17: +2:18 + _9 = (((_3.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const i32); // scope 0 at $DIR/boxes.rs:+1:13: +2:18 + _2 = (*_9); // scope 0 at $DIR/boxes.rs:+1:13: +2:18 + _1 = Add(move _2, const 0_i32); // scope 0 at $DIR/boxes.rs:+1:13: +3:12 + StorageDead(_2); // scope 0 at $DIR/boxes.rs:+3:11: +3:12 + drop(_3) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/boxes.rs:+3:12: +3:13 } bb2: { - StorageDead(_3); // scope 0 at $DIR/boxes.rs:+1:26: +1:27 - _0 = const (); // scope 0 at $DIR/boxes.rs:+0:11: +2:2 - StorageDead(_1); // scope 0 at $DIR/boxes.rs:+2:1: +2:2 - return; // scope 0 at $DIR/boxes.rs:+2:2: +2:2 + StorageDead(_3); // scope 0 at $DIR/boxes.rs:+3:12: +3:13 + _0 = const (); // scope 0 at $DIR/boxes.rs:+0:11: +4:2 + StorageDead(_1); // scope 0 at $DIR/boxes.rs:+4:1: +4:2 + return; // scope 0 at $DIR/boxes.rs:+4:2: +4:2 } bb3 (cleanup): { - resume; // scope 0 at $DIR/boxes.rs:+0:1: +2:2 + resume; // scope 0 at $DIR/boxes.rs:+0:1: +4:2 } } diff --git a/tests/mir-opt/const_prop/boxes.rs b/tests/mir-opt/const_prop/boxes.rs index d287830db..66e8c24d4 100644 --- a/tests/mir-opt/const_prop/boxes.rs +++ b/tests/mir-opt/const_prop/boxes.rs @@ -4,11 +4,13 @@ // ignore-wasm32 // ignore-wasm64 -#![feature(box_syntax)] +#![feature(rustc_attrs, stmt_expr_attributes)] -// Note: this test verifies that we, in fact, do not const prop `box` +// Note: this test verifies that we, in fact, do not const prop `#[rustc_box]` // EMIT_MIR boxes.main.ConstProp.diff fn main() { - let x = *(box 42) + 0; + let x = *(#[rustc_box] + Box::new(42)) + + 0; } diff --git a/tests/mir-opt/const_prop/checked_add.rs b/tests/mir-opt/const_prop/checked_add.rs index b9860da4c..007defd10 100644 --- a/tests/mir-opt/const_prop/checked_add.rs +++ b/tests/mir-opt/const_prop/checked_add.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: ConstProp // compile-flags: -C overflow-checks=on diff --git a/tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff b/tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff index bea7114c7..d75fae30b 100644 --- a/tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff @@ -18,7 +18,7 @@ StorageLive(_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16 _3 = const _; // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16 // mir::Constant - // + span: $DIR/const_prop_fails_gracefully.rs:8:13: 8:16 + // + span: $DIR/const_prop_fails_gracefully.rs:9:13: 9:16 // + literal: Const { ty: &i32, val: Unevaluated(FOO, [], None) } _2 = &raw const (*_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16 _1 = move _2 as usize (PointerExposeAddress); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:39 @@ -29,7 +29,7 @@ _5 = _1; // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:10: +3:11 _4 = read(move _5) -> bb1; // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:5: +3:12 // mir::Constant - // + span: $DIR/const_prop_fails_gracefully.rs:9:5: 9:9 + // + span: $DIR/const_prop_fails_gracefully.rs:10:5: 10:9 // + literal: Const { ty: fn(usize) {read}, val: Value() } } diff --git a/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs b/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs index 0a3dcbd38..44d487842 100644 --- a/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs +++ b/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: ConstProp #[inline(never)] fn read(_: usize) { } diff --git a/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff b/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff index f270ab8b6..7e77c18d5 100644 --- a/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff +++ b/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff @@ -14,7 +14,6 @@ } bb1: { - StorageLive(_2); // scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL _2 = begin_panic::<&str>(const "explicit panic"); // scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL // mir::Constant // + span: $SRC_DIR/std/src/panic.rs:LL:COL diff --git a/tests/mir-opt/const_prop/control_flow_simplification.rs b/tests/mir-opt/const_prop/control_flow_simplification.rs index 7dbe8e734..b2ca045e8 100644 --- a/tests/mir-opt/const_prop/control_flow_simplification.rs +++ b/tests/mir-opt/const_prop/control_flow_simplification.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: ConstProp // compile-flags: -Zmir-opt-level=1 diff --git a/tests/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff index b9a10704b..6d8738aa6 100644 --- a/tests/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff @@ -22,7 +22,7 @@ - switchInt(move _4) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 + _3 = const Option::::Some(true); // scope 2 at $DIR/discriminant.rs:+1:34: +1:44 + // mir::Constant -+ // + span: $DIR/discriminant.rs:12:34: 12:44 ++ // + span: no-location + // + literal: Const { ty: Option, val: Value(Scalar(0x01)) } + _4 = const 1_isize; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 + switchInt(const 1_isize) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 diff --git a/tests/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff index b9a10704b..6d8738aa6 100644 --- a/tests/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff @@ -22,7 +22,7 @@ - switchInt(move _4) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 + _3 = const Option::::Some(true); // scope 2 at $DIR/discriminant.rs:+1:34: +1:44 + // mir::Constant -+ // + span: $DIR/discriminant.rs:12:34: 12:44 ++ // + span: no-location + // + literal: Const { ty: Option, val: Value(Scalar(0x01)) } + _4 = const 1_isize; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 + switchInt(const 1_isize) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 diff --git a/tests/mir-opt/const_prop/indirect.rs b/tests/mir-opt/const_prop/indirect.rs index 44916cbfe..46fd8082d 100644 --- a/tests/mir-opt/const_prop/indirect.rs +++ b/tests/mir-opt/const_prop/indirect.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: ConstProp // compile-flags: -C overflow-checks=on diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.diff b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.diff index d03c23a3f..0ac7fa43d 100644 --- a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.diff @@ -8,7 +8,7 @@ let mut _3: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 scope 1 { } - scope 2 (inlined ::add) { // at $DIR/inherit_overflow.rs:8:13: 8:47 + scope 2 (inlined ::add) { // at $DIR/inherit_overflow.rs:9:13: 9:47 debug self => _2; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL debug other => _3; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL let mut _4: (u8, bool); // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL diff --git a/tests/mir-opt/const_prop/inherit_overflow.rs b/tests/mir-opt/const_prop/inherit_overflow.rs index 541a8c5c3..4e905d00d 100644 --- a/tests/mir-opt/const_prop/inherit_overflow.rs +++ b/tests/mir-opt/const_prop/inherit_overflow.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: ConstProp // compile-flags: -Zmir-enable-passes=+Inline 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 4f056dd85..85dedf68c 100644 --- a/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff @@ -12,12 +12,10 @@ 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 => _6; // in scope 5 at $DIR/invalid_constant.rs:+20:9: +20:31 - let _7: main::Str<"���">; // in scope 5 at $DIR/invalid_constant.rs:+24:9: +24:22 + debug _enum_without_variants => const [ZeroSized: Empty]; // in scope 5 at $DIR/invalid_constant.rs:+20:9: +20:31 scope 7 { - debug _non_utf8_str => _7; // in scope 7 at $DIR/invalid_constant.rs:+24:9: +24:22 + debug _non_utf8_str => const Str::<"���">; // in scope 7 at $DIR/invalid_constant.rs:+24:9: +24:22 } } scope 6 { @@ -44,18 +42,14 @@ - _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: $DIR/invalid_constant.rs:28:34: 28:57 ++ // + 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: $DIR/invalid_constant.rs:28:24: 28:60 ++ // + span: no-location + // + literal: Const { ty: E, val: Value(Scalar(0x00000004)) } 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 - StorageLive(_6); // scope 3 at $DIR/invalid_constant.rs:+20:9: +20:31 - StorageLive(_7); // scope 5 at $DIR/invalid_constant.rs:+24:9: +24:22 - StorageDead(_7); // scope 5 at $DIR/invalid_constant.rs:+27:1: +27:2 - StorageDead(_6); // 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.main.RemoveZsts.diff b/tests/mir-opt/const_prop/invalid_constant.main.RemoveZsts.diff new file mode 100644 index 000000000..e31c2bc39 --- /dev/null +++ b/tests/mir-opt/const_prop/invalid_constant.main.RemoveZsts.diff @@ -0,0 +1,76 @@ +- // MIR for `main` before RemoveZsts ++ // MIR for `main` after RemoveZsts + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/invalid_constant.rs:+0:11: +0:11 + let _1: char; // in scope 0 at $DIR/invalid_constant.rs:+6:9: +6:22 + 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 => _6; // in scope 5 at $DIR/invalid_constant.rs:+20:9: +20:31 ++ 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 => _9; // in scope 7 at $DIR/invalid_constant.rs:+24:9: +24:22 ++ debug _non_utf8_str => const Str::<"���">; // in scope 7 at $DIR/invalid_constant.rs:+24:9: +24:22 + } + } + scope 6 { + } + } + scope 4 { + } + } + scope 2 { + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/invalid_constant.rs:+6:9: +6:22 + StorageLive(_2); // scope 2 at $DIR/invalid_constant.rs:+6:34: +6:63 + _2 = InvalidChar { int: const 1114113_u32 }; // scope 2 at $DIR/invalid_constant.rs:+6:34: +6:63 + _1 = (_2.1: char); // scope 2 at $DIR/invalid_constant.rs:+6:34: +6:67 + StorageDead(_2); // scope 0 at $DIR/invalid_constant.rs:+6:69: +6:70 + StorageLive(_3); // scope 1 at $DIR/invalid_constant.rs:+13:9: +13:21 + StorageLive(_4); // scope 1 at $DIR/invalid_constant.rs:+13:25: +13:59 + 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 + 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 +- StorageLive(_6); // scope 3 at $DIR/invalid_constant.rs:+20:9: +20:31 +- StorageLive(_7); // scope 3 at $DIR/invalid_constant.rs:+20:35: +20:73 ++ 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 +- _7 = (_8.1: Empty); // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:71 +- _6 = [move _7]; // scope 3 at $DIR/invalid_constant.rs:+20:34: +20:74 +- StorageDead(_7); // scope 3 at $DIR/invalid_constant.rs:+20:73: +20:74 ++ 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 +- StorageLive(_9); // scope 5 at $DIR/invalid_constant.rs:+24:9: +24:22 +- _0 = const (); // scope 0 at $DIR/invalid_constant.rs:+0:11: +27:2 +- StorageDead(_9); // scope 5 at $DIR/invalid_constant.rs:+27:1: +27:2 +- StorageDead(_6); // scope 3 at $DIR/invalid_constant.rs:+27:1: +27:2 ++ 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 0337a7ca8..eb6172cdf 100644 --- a/tests/mir-opt/const_prop/invalid_constant.rs +++ b/tests/mir-opt/const_prop/invalid_constant.rs @@ -11,6 +11,7 @@ enum E { A, B, C } #[derive(Copy, Clone)] enum Empty {} +// EMIT_MIR invalid_constant.main.RemoveZsts.diff // EMIT_MIR invalid_constant.main.ConstProp.diff fn main() { // An invalid char. diff --git a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.diff b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.diff index 964dd3080..265269409 100644 --- a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.diff @@ -5,23 +5,18 @@ let mut _0: (); // return place in scope 0 at $DIR/issue_66971.rs:+0:11: +0:11 let _1: (); // in scope 0 at $DIR/issue_66971.rs:+1:5: +1:23 let mut _2: ((), u8, u8); // in scope 0 at $DIR/issue_66971.rs:+1:12: +1:22 - let mut _3: (); // in scope 0 at $DIR/issue_66971.rs:+1:13: +1:15 bb0: { - StorageLive(_1); // scope 0 at $DIR/issue_66971.rs:+1:5: +1:23 StorageLive(_2); // scope 0 at $DIR/issue_66971.rs:+1:12: +1:22 - StorageLive(_3); // scope 0 at $DIR/issue_66971.rs:+1:13: +1:15 - _2 = (move _3, const 0_u8, const 0_u8); // scope 0 at $DIR/issue_66971.rs:+1:12: +1:22 - StorageDead(_3); // scope 0 at $DIR/issue_66971.rs:+1:21: +1:22 + _2 = (const (), const 0_u8, const 0_u8); // scope 0 at $DIR/issue_66971.rs:+1:12: +1:22 _1 = encode(move _2) -> bb1; // scope 0 at $DIR/issue_66971.rs:+1:5: +1:23 // mir::Constant - // + span: $DIR/issue_66971.rs:17:5: 17:11 + // + span: $DIR/issue_66971.rs:18:5: 18:11 // + literal: Const { ty: fn(((), u8, u8)) {encode}, val: Value() } } bb1: { StorageDead(_2); // scope 0 at $DIR/issue_66971.rs:+1:22: +1:23 - StorageDead(_1); // scope 0 at $DIR/issue_66971.rs:+1:23: +1:24 return; // scope 0 at $DIR/issue_66971.rs:+2:2: +2:2 } } diff --git a/tests/mir-opt/const_prop/issue_66971.rs b/tests/mir-opt/const_prop/issue_66971.rs index 6ca03438e..af95c9ca2 100644 --- a/tests/mir-opt/const_prop/issue_66971.rs +++ b/tests/mir-opt/const_prop/issue_66971.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: ConstProp // compile-flags: -Z mir-opt-level=3 diff --git a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.diff b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.diff index a631cb310..54c9200d6 100644 --- a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.diff @@ -8,7 +8,6 @@ let mut _3: (u8, u8); // in scope 0 at $DIR/issue_67019.rs:+1:11: +1:17 bb0: { - StorageLive(_1); // scope 0 at $DIR/issue_67019.rs:+1:5: +1:20 StorageLive(_2); // scope 0 at $DIR/issue_67019.rs:+1:10: +1:19 StorageLive(_3); // scope 0 at $DIR/issue_67019.rs:+1:11: +1:17 - _3 = (const 1_u8, const 2_u8); // scope 0 at $DIR/issue_67019.rs:+1:11: +1:17 @@ -17,13 +16,12 @@ StorageDead(_3); // scope 0 at $DIR/issue_67019.rs:+1:18: +1:19 _1 = test(move _2) -> bb1; // scope 0 at $DIR/issue_67019.rs:+1:5: +1:20 // mir::Constant - // + span: $DIR/issue_67019.rs:12:5: 12:9 + // + span: $DIR/issue_67019.rs:13:5: 13:9 // + literal: Const { ty: fn(((u8, u8),)) {test}, val: Value() } } bb1: { StorageDead(_2); // scope 0 at $DIR/issue_67019.rs:+1:19: +1:20 - StorageDead(_1); // scope 0 at $DIR/issue_67019.rs:+1:20: +1:21 return; // scope 0 at $DIR/issue_67019.rs:+2:2: +2:2 } } diff --git a/tests/mir-opt/const_prop/issue_67019.rs b/tests/mir-opt/const_prop/issue_67019.rs index ffc6fa1f2..08c7d4805 100644 --- a/tests/mir-opt/const_prop/issue_67019.rs +++ b/tests/mir-opt/const_prop/issue_67019.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: ConstProp // compile-flags: -Z mir-opt-level=3 diff --git a/tests/mir-opt/const_prop/large_array_index.rs b/tests/mir-opt/const_prop/large_array_index.rs index 48d134376..073f98495 100644 --- a/tests/mir-opt/const_prop/large_array_index.rs +++ b/tests/mir-opt/const_prop/large_array_index.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR large_array_index.main.ConstProp.diff 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 149aa6290..75f6ebc58 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:6:29: 6:32 + // + span: $DIR/mutable_variable_aggregate_partial_read.rs:7:29: 7:32 // + literal: Const { ty: fn() -> (i32, i32) {foo}, val: Value() } } 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 cb59509ff..70a287cf3 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,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test // compile-flags: -O 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 4010dd6c6..9582504b2 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 @@ -26,7 +26,7 @@ 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:6:13: 6:16 + // + span: $DIR/mutable_variable_unprop_assign.rs:7:13: 7:16 // + literal: Const { ty: fn() -> i32 {foo}, val: Value() } } 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 b077cfd3e..fabd04e9b 100644 --- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs +++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test // compile-flags: -O diff --git a/tests/mir-opt/const_prop/optimizes_into_variable.rs b/tests/mir-opt/const_prop/optimizes_into_variable.rs index abea07e20..5ffa15347 100644 --- a/tests/mir-opt/const_prop/optimizes_into_variable.rs +++ b/tests/mir-opt/const_prop/optimizes_into_variable.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test // compile-flags: -C overflow-checks=on diff --git a/tests/mir-opt/const_prop/repeat.rs b/tests/mir-opt/const_prop/repeat.rs index 36d9b9fc6..2f3b7d2c5 100644 --- a/tests/mir-opt/const_prop/repeat.rs +++ b/tests/mir-opt/const_prop/repeat.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // compile-flags: -O // EMIT_MIR_FOR_EACH_BIT_WIDTH diff --git a/tests/mir-opt/const_prop/return_place.rs b/tests/mir-opt/const_prop/return_place.rs index 06a853696..ae119df85 100644 --- a/tests/mir-opt/const_prop/return_place.rs +++ b/tests/mir-opt/const_prop/return_place.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // compile-flags: -C overflow-checks=on // EMIT_MIR return_place.add.ConstProp.diff 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 22f710387..a091b4ace 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 @@ -12,16 +12,14 @@ bb0: { _1 = const 1_u32; // scope 0 at $DIR/scalar_literal_propagation.rs:+1:13: +1:14 - StorageLive(_2); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15 - _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 // mir::Constant - // + span: $DIR/scalar_literal_propagation.rs:4:5: 4:12 + // + span: $DIR/scalar_literal_propagation.rs:5:5: 5:12 // + literal: Const { ty: fn(u32) {consume}, val: Value() } } bb1: { - StorageDead(_2); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:15: +2:16 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 8724e4d57..e13e352f8 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 @@ +// ignore-wasm32 compiled with panic=abort by default // EMIT_MIR scalar_literal_propagation.main.ConstProp.diff fn main() { let x = 1; diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff index b99b83b0c..8bd2b48d6 100644 --- a/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff @@ -20,7 +20,7 @@ StorageLive(_4); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 _9 = const _; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 // mir::Constant - // + span: $DIR/slice_len.rs:7:6: 7:19 + // + span: $DIR/slice_len.rs:8:6: 8:19 // + literal: Const { ty: &[u32; 3], val: Unevaluated(main, [], Some(promoted[0])) } _4 = _9; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 _3 = _4; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff index b99b83b0c..8bd2b48d6 100644 --- a/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff @@ -20,7 +20,7 @@ StorageLive(_4); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 _9 = const _; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 // mir::Constant - // + span: $DIR/slice_len.rs:7:6: 7:19 + // + span: $DIR/slice_len.rs:8:6: 8:19 // + literal: Const { ty: &[u32; 3], val: Unevaluated(main, [], Some(promoted[0])) } _4 = _9; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 _3 = _4; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 diff --git a/tests/mir-opt/const_prop/slice_len.rs b/tests/mir-opt/const_prop/slice_len.rs index 8183def0c..4499c54f2 100644 --- a/tests/mir-opt/const_prop/slice_len.rs +++ b/tests/mir-opt/const_prop/slice_len.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: ConstProp // compile-flags: -Zmir-enable-passes=+InstCombine // EMIT_MIR_FOR_EACH_BIT_WIDTH 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 ddc1a4493..85704c48a 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:9:14: 9:17 + // + span: $DIR/switch_int.rs:10:14: 10: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:8:14: 8:17 + // + span: $DIR/switch_int.rs:9:14: 9: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 09c47ee6e..0864db225 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:9:14: 9:17 + // + span: $DIR/switch_int.rs:10:14: 10: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:8:14: 8:17 + // + span: $DIR/switch_int.rs:9:14: 9: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 d7319eca1..2a2322e43 100644 --- a/tests/mir-opt/const_prop/switch_int.rs +++ b/tests/mir-opt/const_prop/switch_int.rs @@ -1,3 +1,4 @@ +// 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.diff b/tests/mir-opt/const_prop/transmute.from_char.ConstProp.diff new file mode 100644 index 000000000..933dfbb51 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.from_char.ConstProp.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.invalid_bool.ConstProp.diff b/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.diff new file mode 100644 index 000000000..f3474855f --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.diff @@ -0,0 +1,14 @@ +- // 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.diff b/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.diff new file mode 100644 index 000000000..ba087e226 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.diff @@ -0,0 +1,14 @@ +- // 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.diff b/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.diff new file mode 100644 index 000000000..76d464789 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.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.rs b/tests/mir-opt/const_prop/transmute.rs new file mode 100644 index 000000000..b753cdccd --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.rs @@ -0,0 +1,61 @@ +// unit-test: ConstProp +// compile-flags: -O --crate-type=lib + +use std::mem::transmute; + +// EMIT_MIR transmute.less_as_i8.ConstProp.diff +pub fn less_as_i8() -> i8 { + unsafe { transmute(std::cmp::Ordering::Less) } +} + +// EMIT_MIR transmute.from_char.ConstProp.diff +pub fn from_char() -> i32 { + unsafe { transmute('R') } +} + +// EMIT_MIR transmute.valid_char.ConstProp.diff +pub fn valid_char() -> char { + unsafe { transmute(0x52_u32) } +} + +// EMIT_MIR transmute.invalid_char.ConstProp.diff +pub unsafe fn invalid_char() -> char { + unsafe { transmute(i32::MAX) } +} + +// EMIT_MIR transmute.invalid_bool.ConstProp.diff +pub unsafe fn invalid_bool() -> bool { + unsafe { transmute(-1_i8) } +} + +// EMIT_MIR transmute.undef_union_as_integer.ConstProp.diff +pub unsafe fn undef_union_as_integer() -> u32 { + union Union32 { value: u32, unit: () } + unsafe { transmute(Union32 { unit: () }) } +} + +// EMIT_MIR transmute.unreachable_direct.ConstProp.diff +pub unsafe fn unreachable_direct() -> ! { + let x: Never = unsafe { transmute(()) }; + match x {} +} + +// EMIT_MIR transmute.unreachable_ref.ConstProp.diff +pub unsafe fn unreachable_ref() -> ! { + let x: &Never = unsafe { transmute(1_usize) }; + match *x {} +} + +// EMIT_MIR transmute.unreachable_mut.ConstProp.diff +pub unsafe fn unreachable_mut() -> ! { + let x: &mut Never = unsafe { transmute(1_usize) }; + match *x {} +} + +// EMIT_MIR transmute.unreachable_box.ConstProp.diff +pub unsafe fn unreachable_box() -> ! { + let x: Box = unsafe { transmute(1_usize) }; + match *x {} +} + +enum Never {} 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 new file mode 100644 index 000000000..538b1f26e --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.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.unreachable_box.ConstProp.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.diff new file mode 100644 index 000000000..8bf97996a --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.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 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.diff b/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.diff new file mode 100644 index 000000000..81b7b3689 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.diff @@ -0,0 +1,25 @@ +- // 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.diff b/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.diff new file mode 100644 index 000000000..34f7aea8e --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.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 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.diff b/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.diff new file mode 100644 index 000000000..ff95f2a0b --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.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 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.diff b/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.diff new file mode 100644 index 000000000..eac33b730 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.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/tuple_literal_propagation.main.ConstProp.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff index 270a1ccf5..12313b6c5 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 @@ -13,15 +13,13 @@ bb0: { - _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 - StorageLive(_2); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:5: +3:15 _2 = consume(_1) -> bb1; // scope 1 at $DIR/tuple_literal_propagation.rs:+3:5: +3:15 // mir::Constant - // + span: $DIR/tuple_literal_propagation.rs:5:5: 5:12 + // + span: $DIR/tuple_literal_propagation.rs:6:5: 6:12 // + literal: Const { ty: fn((u32, u32)) {consume}, val: Value() } } bb1: { - StorageDead(_2); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:15: +3:16 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 e644baec4..edd748d00 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 @@ +// ignore-wasm32 compiled with panic=abort by default // EMIT_MIR tuple_literal_propagation.main.ConstProp.diff fn main() { let x = (1, 2); 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 b183865a9..2a0bff57d 100644 --- a/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.diff +++ b/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.diff @@ -15,7 +15,7 @@ _4 = &_3; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL _0 = cmp_ref(_2, _4) -> bb1; // scope 0 at $DIR/borrowed_local.rs:+8:13: +8:45 // mir::Constant - // + span: $DIR/borrowed_local.rs:23:29: 23:36 + // + span: $DIR/borrowed_local.rs:24:29: 24:36 // + literal: Const { ty: for<'a, 'b> fn(&'a u8, &'b u8) -> bool {cmp_ref}, val: Value() } } @@ -23,7 +23,7 @@ - _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 // mir::Constant - // + span: $DIR/borrowed_local.rs:27:28: 27:34 + // + 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/borrowed_local.rs b/tests/mir-opt/copy-prop/borrowed_local.rs index c4b980e2b..9186da5af 100644 --- a/tests/mir-opt/copy-prop/borrowed_local.rs +++ b/tests/mir-opt/copy-prop/borrowed_local.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: CopyProp #![feature(custom_mir, core_intrinsics)] diff --git a/tests/mir-opt/copy-prop/branch.foo.CopyProp.diff b/tests/mir-opt/copy-prop/branch.foo.CopyProp.diff index 8b116532d..b78c19d78 100644 --- a/tests/mir-opt/copy-prop/branch.foo.CopyProp.diff +++ b/tests/mir-opt/copy-prop/branch.foo.CopyProp.diff @@ -18,7 +18,7 @@ StorageLive(_1); // scope 0 at $DIR/branch.rs:+1:9: +1:10 _1 = val() -> bb1; // scope 0 at $DIR/branch.rs:+1:13: +1:18 // mir::Constant - // + span: $DIR/branch.rs:13:13: 13:16 + // + span: $DIR/branch.rs:14:13: 14:16 // + literal: Const { ty: fn() -> i32 {val}, val: Value() } } @@ -27,7 +27,7 @@ StorageLive(_3); // scope 1 at $DIR/branch.rs:+3:16: +3:22 _3 = cond() -> bb2; // scope 1 at $DIR/branch.rs:+3:16: +3:22 // mir::Constant - // + span: $DIR/branch.rs:15:16: 15:20 + // + span: $DIR/branch.rs:16:16: 16:20 // + literal: Const { ty: fn() -> bool {cond}, val: Value() } } @@ -44,7 +44,7 @@ StorageLive(_4); // scope 1 at $DIR/branch.rs:+6:9: +6:14 _4 = val() -> bb5; // scope 1 at $DIR/branch.rs:+6:9: +6:14 // mir::Constant - // + span: $DIR/branch.rs:18:9: 18:12 + // + span: $DIR/branch.rs:19:9: 19:12 // + literal: Const { ty: fn() -> i32 {val}, val: Value() } } diff --git a/tests/mir-opt/copy-prop/branch.rs b/tests/mir-opt/copy-prop/branch.rs index 50b1e00fa..0a2e16946 100644 --- a/tests/mir-opt/copy-prop/branch.rs +++ b/tests/mir-opt/copy-prop/branch.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default //! Tests that we bail out when there are multiple assignments to the same local. // unit-test: CopyProp fn val() -> i32 { diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.diff index ac4e9a2bf..24bca3220 100644 --- a/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.diff +++ b/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.diff @@ -13,7 +13,7 @@ _3 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12 _2 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13 // mir::Constant - // + span: $DIR/copy_propagation_arg.rs:16:5: 16:10 + // + span: $DIR/copy_propagation_arg.rs:17:5: 17:10 // + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value() } } diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.diff index 0a3e985e7..87708f340 100644 --- a/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.diff +++ b/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.diff @@ -13,7 +13,7 @@ _3 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:15: +2:16 _2 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17 // mir::Constant - // + span: $DIR/copy_propagation_arg.rs:11:9: 11:14 + // + span: $DIR/copy_propagation_arg.rs:12:9: 12:14 // + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value() } } diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.rs b/tests/mir-opt/copy-prop/copy_propagation_arg.rs index cc98985f1..1b65dcb01 100644 --- a/tests/mir-opt/copy-prop/copy_propagation_arg.rs +++ b/tests/mir-opt/copy-prop/copy_propagation_arg.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // Check that CopyProp does not propagate an assignment to a function argument // (doing so can break usages of the original argument value) // unit-test: CopyProp diff --git a/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.diff b/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.diff index 6ca73ffdd..160f47bdd 100644 --- a/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.diff +++ b/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.diff @@ -11,7 +11,7 @@ - _0 = opaque::(move _1) -> bb1; // scope 0 at $DIR/custom_move_arg.rs:+3:9: +3:41 + _0 = opaque::(_1) -> bb1; // scope 0 at $DIR/custom_move_arg.rs:+3:9: +3:41 // mir::Constant - // + span: $DIR/custom_move_arg.rs:15:24: 15:30 + // + span: $DIR/custom_move_arg.rs:16:24: 16:30 // + literal: Const { ty: fn(NotCopy) {opaque::}, val: Value() } } @@ -20,7 +20,7 @@ - _0 = opaque::(_3) -> bb2; // scope 0 at $DIR/custom_move_arg.rs:+7:9: +7:35 + _0 = opaque::(_1) -> bb2; // scope 0 at $DIR/custom_move_arg.rs:+7:9: +7:35 // mir::Constant - // + span: $DIR/custom_move_arg.rs:19:24: 19:30 + // + span: $DIR/custom_move_arg.rs:20:24: 20:30 // + literal: Const { ty: fn(NotCopy) {opaque::}, val: Value() } } diff --git a/tests/mir-opt/copy-prop/custom_move_arg.rs b/tests/mir-opt/copy-prop/custom_move_arg.rs index 4a591146e..29c368df8 100644 --- a/tests/mir-opt/copy-prop/custom_move_arg.rs +++ b/tests/mir-opt/copy-prop/custom_move_arg.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: CopyProp #![feature(custom_mir, core_intrinsics)] diff --git a/tests/mir-opt/copy-prop/cycle.main.CopyProp.diff b/tests/mir-opt/copy-prop/cycle.main.CopyProp.diff index 3e61869e8..23d92ed1a 100644 --- a/tests/mir-opt/copy-prop/cycle.main.CopyProp.diff +++ b/tests/mir-opt/copy-prop/cycle.main.CopyProp.diff @@ -24,7 +24,7 @@ StorageLive(_1); // scope 0 at $DIR/cycle.rs:+1:9: +1:14 _1 = val() -> bb1; // scope 0 at $DIR/cycle.rs:+1:17: +1:22 // mir::Constant - // + span: $DIR/cycle.rs:9:17: 9:20 + // + span: $DIR/cycle.rs:10:17: 10:20 // + literal: Const { ty: fn() -> i32 {val}, val: Value() } } @@ -43,7 +43,7 @@ _6 = _1; // scope 3 at $DIR/cycle.rs:+6:10: +6:11 _5 = std::mem::drop::(move _6) -> bb2; // scope 3 at $DIR/cycle.rs:+6:5: +6:12 // mir::Constant - // + span: $DIR/cycle.rs:14:5: 14:9 + // + span: $DIR/cycle.rs:15:5: 15:9 // + literal: Const { ty: fn(i32) {std::mem::drop::}, val: Value() } } diff --git a/tests/mir-opt/copy-prop/cycle.rs b/tests/mir-opt/copy-prop/cycle.rs index b74c39726..da70f6bec 100644 --- a/tests/mir-opt/copy-prop/cycle.rs +++ b/tests/mir-opt/copy-prop/cycle.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default //! Tests that cyclic assignments don't hang CopyProp, and result in reasonable code. // unit-test: CopyProp fn val() -> i32 { diff --git a/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.mir b/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.mir index d48b04e2d..c56418d88 100644 --- a/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.mir +++ b/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.mir @@ -18,7 +18,7 @@ fn f(_1: usize) -> usize { _4 = _1; // scope 1 at $DIR/dead_stores_79191.rs:+4:8: +4:9 _0 = id::(move _4) -> bb1; // scope 1 at $DIR/dead_stores_79191.rs:+4:5: +4:10 // mir::Constant - // + span: $DIR/dead_stores_79191.rs:12:5: 12:7 + // + span: $DIR/dead_stores_79191.rs:13:5: 13:7 // + literal: Const { ty: fn(usize) -> usize {id::}, val: Value() } } diff --git a/tests/mir-opt/copy-prop/dead_stores_79191.rs b/tests/mir-opt/copy-prop/dead_stores_79191.rs index e3493b8b7..84453c55e 100644 --- a/tests/mir-opt/copy-prop/dead_stores_79191.rs +++ b/tests/mir-opt/copy-prop/dead_stores_79191.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: CopyProp fn id(x: T) -> T { diff --git a/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.mir b/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.mir index 727791f50..f35542173 100644 --- a/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.mir +++ b/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.mir @@ -18,7 +18,7 @@ fn f(_1: usize) -> usize { _4 = _1; // scope 1 at $DIR/dead_stores_better.rs:+4:8: +4:9 _0 = id::(move _4) -> bb1; // scope 1 at $DIR/dead_stores_better.rs:+4:5: +4:10 // mir::Constant - // + span: $DIR/dead_stores_better.rs:16:5: 16:7 + // + span: $DIR/dead_stores_better.rs:17:5: 17:7 // + literal: Const { ty: fn(usize) -> usize {id::}, val: Value() } } diff --git a/tests/mir-opt/copy-prop/dead_stores_better.rs b/tests/mir-opt/copy-prop/dead_stores_better.rs index 8465b3c98..87b916fd3 100644 --- a/tests/mir-opt/copy-prop/dead_stores_better.rs +++ b/tests/mir-opt/copy-prop/dead_stores_better.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // This is a copy of the `dead_stores_79191` test, except that we turn on DSE. This demonstrates // that that pass enables this one to do more optimizations. diff --git a/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.diff b/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.diff index 97d0a01e0..e09ccb831 100644 --- a/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.diff +++ b/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.diff @@ -51,7 +51,7 @@ StorageDead(_7); // scope 2 at $DIR/issue_107511.rs:+6:17: +6:18 _5 = core::slice::::len(move _6) -> bb1; // scope 2 at $DIR/issue_107511.rs:+6:17: +6:24 // mir::Constant - // + span: $DIR/issue_107511.rs:10:19: 10:22 + // + span: $DIR/issue_107511.rs:11:19: 11:22 // + literal: Const { ty: for<'a> fn(&'a [i32]) -> usize {core::slice::::len}, val: Value() } } @@ -61,7 +61,7 @@ StorageDead(_5); // scope 2 at $DIR/issue_107511.rs:+6:23: +6:24 _3 = as IntoIterator>::into_iter(move _4) -> bb2; // scope 2 at $DIR/issue_107511.rs:+6:14: +6:24 // mir::Constant - // + span: $DIR/issue_107511.rs:10:14: 10:24 + // + span: $DIR/issue_107511.rs:11:14: 11:24 // + literal: Const { ty: fn(std::ops::Range) -> as IntoIterator>::IntoIter { as IntoIterator>::into_iter}, val: Value() } } @@ -81,7 +81,7 @@ _12 = &mut (*_13); // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24 _11 = as Iterator>::next(move _12) -> bb4; // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24 // mir::Constant - // + span: $DIR/issue_107511.rs:10:14: 10:24 + // + span: $DIR/issue_107511.rs:11:14: 11:24 // + literal: Const { ty: for<'a> fn(&'a mut std::ops::Range) -> Option< as Iterator>::Item> { as Iterator>::next}, val: Value() } } diff --git a/tests/mir-opt/copy-prop/issue_107511.rs b/tests/mir-opt/copy-prop/issue_107511.rs index d593f2872..2b00ff155 100644 --- a/tests/mir-opt/copy-prop/issue_107511.rs +++ b/tests/mir-opt/copy-prop/issue_107511.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: CopyProp // EMIT_MIR issue_107511.main.CopyProp.diff diff --git a/tests/mir-opt/copy-prop/move_arg.f.CopyProp.diff b/tests/mir-opt/copy-prop/move_arg.f.CopyProp.diff index d76bf1cfe..650bd66a7 100644 --- a/tests/mir-opt/copy-prop/move_arg.f.CopyProp.diff +++ b/tests/mir-opt/copy-prop/move_arg.f.CopyProp.diff @@ -24,7 +24,7 @@ - _3 = g::(move _4, move _5) -> bb1; // scope 1 at $DIR/move_arg.rs:+2:5: +2:12 + _3 = g::(_1, _1) -> bb1; // scope 1 at $DIR/move_arg.rs:+2:5: +2:12 // mir::Constant - // + span: $DIR/move_arg.rs:7:5: 7:6 + // + span: $DIR/move_arg.rs:8:5: 8:6 // + literal: Const { ty: fn(T, T) {g::}, val: Value() } } diff --git a/tests/mir-opt/copy-prop/move_arg.rs b/tests/mir-opt/copy-prop/move_arg.rs index 40ae1d8f4..f88d9a9e7 100644 --- a/tests/mir-opt/copy-prop/move_arg.rs +++ b/tests/mir-opt/copy-prop/move_arg.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // Test that we do not move multiple times from the same local. // unit-test: CopyProp diff --git a/tests/mir-opt/copy-prop/move_projection.f.CopyProp.diff b/tests/mir-opt/copy-prop/move_projection.f.CopyProp.diff index 02308beb8..beb85d68a 100644 --- a/tests/mir-opt/copy-prop/move_projection.f.CopyProp.diff +++ b/tests/mir-opt/copy-prop/move_projection.f.CopyProp.diff @@ -13,14 +13,14 @@ + _3 = (_1.0: u8); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + _0 = opaque::(_1) -> bb1; // scope 0 at $DIR/move_projection.rs:+6:13: +6:44 // mir::Constant - // + span: $DIR/move_projection.rs:19:28: 19:34 + // + span: $DIR/move_projection.rs:20:28: 20:34 // + literal: Const { ty: fn(Foo) -> bool {opaque::}, val: Value() } } bb1: { _0 = opaque::(move _3) -> bb2; // scope 0 at $DIR/move_projection.rs:+9:13: +9:44 // mir::Constant - // + span: $DIR/move_projection.rs:22:28: 22:34 + // + span: $DIR/move_projection.rs:23:28: 23:34 // + literal: Const { ty: fn(u8) -> bool {opaque::}, val: Value() } } diff --git a/tests/mir-opt/copy-prop/move_projection.rs b/tests/mir-opt/copy-prop/move_projection.rs index 2a1bbae99..c158c69e0 100644 --- a/tests/mir-opt/copy-prop/move_projection.rs +++ b/tests/mir-opt/copy-prop/move_projection.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: CopyProp #![feature(custom_mir, core_intrinsics)] diff --git a/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.diff b/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.diff new file mode 100644 index 000000000..b4a248245 --- /dev/null +++ b/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.diff @@ -0,0 +1,56 @@ +- // MIR for `demiraw` before CopyProp ++ // MIR for `demiraw` after CopyProp + + fn demiraw(_1: u8) -> () { + debug x => _1; // in scope 0 at $DIR/reborrow.rs:+0:12: +0:17 + let mut _0: (); // return place in scope 0 at $DIR/reborrow.rs:+0:23: +0:23 + let _2: *mut u8; // in scope 0 at $DIR/reborrow.rs:+1:9: +1:10 + let mut _4: &mut u8; // in scope 0 at $DIR/reborrow.rs:+2:22: +2:29 + let _6: (); // in scope 0 at $DIR/reborrow.rs:+4:5: +4:14 + let mut _7: *mut u8; // in scope 0 at $DIR/reborrow.rs:+4:12: +4:13 + scope 1 { + debug a => _2; // in scope 1 at $DIR/reborrow.rs:+1:9: +1:10 + let _3: &mut u8; // in scope 1 at $DIR/reborrow.rs:+2:9: +2:10 + scope 2 { + debug b => _3; // in scope 2 at $DIR/reborrow.rs:+2:9: +2:10 + let _5: *mut u8; // in scope 2 at $DIR/reborrow.rs:+3:9: +3:10 + scope 4 { +- debug c => _5; // in scope 4 at $DIR/reborrow.rs:+3:9: +3:10 ++ debug c => _2; // in scope 4 at $DIR/reborrow.rs:+3:9: +3:10 + } + } + scope 3 { + } + } + + bb0: { +- StorageLive(_2); // scope 0 at $DIR/reborrow.rs:+1:9: +1:10 + _2 = &raw mut _1; // scope 0 at $DIR/reborrow.rs:+1:13: +1:23 + StorageLive(_3); // scope 1 at $DIR/reborrow.rs:+2:9: +2:10 + StorageLive(_4); // scope 1 at $DIR/reborrow.rs:+2:22: +2:29 + _4 = &mut (*_2); // scope 3 at $DIR/reborrow.rs:+2:22: +2:29 + _3 = &mut (*_4); // scope 1 at $DIR/reborrow.rs:+2:22: +2:29 + StorageDead(_4); // scope 1 at $DIR/reborrow.rs:+2:31: +2:32 +- StorageLive(_5); // scope 2 at $DIR/reborrow.rs:+3:9: +3:10 +- _5 = _2; // scope 2 at $DIR/reborrow.rs:+3:13: +3:14 + StorageLive(_6); // scope 4 at $DIR/reborrow.rs:+4:5: +4:14 +- StorageLive(_7); // scope 4 at $DIR/reborrow.rs:+4:12: +4:13 +- _7 = _5; // scope 4 at $DIR/reborrow.rs:+4:12: +4:13 +- _6 = opaque::<*mut u8>(move _7) -> bb1; // scope 4 at $DIR/reborrow.rs:+4:5: +4:14 ++ _6 = opaque::<*mut u8>(_2) -> bb1; // scope 4 at $DIR/reborrow.rs:+4:5: +4:14 + // mir::Constant + // + span: $DIR/reborrow.rs:39:5: 39:11 + // + literal: Const { ty: fn(*mut u8) {opaque::<*mut u8>}, val: Value() } + } + + bb1: { +- StorageDead(_7); // scope 4 at $DIR/reborrow.rs:+4:13: +4:14 + StorageDead(_6); // scope 4 at $DIR/reborrow.rs:+4:14: +4:15 + _0 = const (); // scope 0 at $DIR/reborrow.rs:+0:23: +5:2 +- StorageDead(_5); // scope 2 at $DIR/reborrow.rs:+5:1: +5:2 + StorageDead(_3); // scope 1 at $DIR/reborrow.rs:+5:1: +5:2 +- StorageDead(_2); // scope 0 at $DIR/reborrow.rs:+5:1: +5:2 + return; // scope 0 at $DIR/reborrow.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.diff b/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.diff new file mode 100644 index 000000000..a6a6c05b2 --- /dev/null +++ b/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.diff @@ -0,0 +1,52 @@ +- // MIR for `miraw` before CopyProp ++ // MIR for `miraw` after CopyProp + + fn miraw(_1: u8) -> () { + debug x => _1; // in scope 0 at $DIR/reborrow.rs:+0:10: +0:15 + let mut _0: (); // return place in scope 0 at $DIR/reborrow.rs:+0:21: +0:21 + let _2: *mut u8; // in scope 0 at $DIR/reborrow.rs:+1:9: +1:10 + let _5: (); // in scope 0 at $DIR/reborrow.rs:+4:5: +4:14 + let mut _6: *mut u8; // in scope 0 at $DIR/reborrow.rs:+4:12: +4:13 + scope 1 { + debug a => _2; // in scope 1 at $DIR/reborrow.rs:+1:9: +1:10 + let _3: *mut u8; // in scope 1 at $DIR/reborrow.rs:+2:9: +2:10 + scope 2 { + debug b => _3; // in scope 2 at $DIR/reborrow.rs:+2:9: +2:10 + let _4: *mut u8; // in scope 2 at $DIR/reborrow.rs:+3:9: +3:10 + scope 4 { +- debug c => _4; // in scope 4 at $DIR/reborrow.rs:+3:9: +3:10 ++ debug c => _2; // in scope 4 at $DIR/reborrow.rs:+3:9: +3:10 + } + } + scope 3 { + } + } + + bb0: { +- StorageLive(_2); // scope 0 at $DIR/reborrow.rs:+1:9: +1:10 + _2 = &raw mut _1; // scope 0 at $DIR/reborrow.rs:+1:13: +1:23 + StorageLive(_3); // scope 1 at $DIR/reborrow.rs:+2:9: +2:10 + _3 = &raw mut (*_2); // scope 3 at $DIR/reborrow.rs:+2:22: +2:33 +- StorageLive(_4); // scope 2 at $DIR/reborrow.rs:+3:9: +3:10 +- _4 = _2; // scope 2 at $DIR/reborrow.rs:+3:13: +3:14 + StorageLive(_5); // scope 4 at $DIR/reborrow.rs:+4:5: +4:14 +- StorageLive(_6); // scope 4 at $DIR/reborrow.rs:+4:12: +4:13 +- _6 = _4; // scope 4 at $DIR/reborrow.rs:+4:12: +4:13 +- _5 = opaque::<*mut u8>(move _6) -> bb1; // scope 4 at $DIR/reborrow.rs:+4:5: +4:14 ++ _5 = opaque::<*mut u8>(_2) -> bb1; // scope 4 at $DIR/reborrow.rs:+4:5: +4:14 + // mir::Constant + // + span: $DIR/reborrow.rs:31:5: 31:11 + // + literal: Const { ty: fn(*mut u8) {opaque::<*mut u8>}, val: Value() } + } + + bb1: { +- StorageDead(_6); // scope 4 at $DIR/reborrow.rs:+4:13: +4:14 + StorageDead(_5); // scope 4 at $DIR/reborrow.rs:+4:14: +4:15 + _0 = const (); // scope 0 at $DIR/reborrow.rs:+0:21: +5:2 +- StorageDead(_4); // scope 2 at $DIR/reborrow.rs:+5:1: +5:2 + StorageDead(_3); // scope 1 at $DIR/reborrow.rs:+5:1: +5:2 +- StorageDead(_2); // scope 0 at $DIR/reborrow.rs:+5:1: +5:2 + return; // scope 0 at $DIR/reborrow.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/copy-prop/reborrow.remut.CopyProp.diff b/tests/mir-opt/copy-prop/reborrow.remut.CopyProp.diff new file mode 100644 index 000000000..f3d26cc6e --- /dev/null +++ b/tests/mir-opt/copy-prop/reborrow.remut.CopyProp.diff @@ -0,0 +1,50 @@ +- // MIR for `remut` before CopyProp ++ // MIR for `remut` after CopyProp + + fn remut(_1: u8) -> () { + debug x => _1; // in scope 0 at $DIR/reborrow.rs:+0:10: +0:15 + let mut _0: (); // return place in scope 0 at $DIR/reborrow.rs:+0:21: +0:21 + let _2: &mut u8; // in scope 0 at $DIR/reborrow.rs:+1:9: +1:10 + let _5: (); // in scope 0 at $DIR/reborrow.rs:+4:5: +4:14 + let mut _6: &mut u8; // in scope 0 at $DIR/reborrow.rs:+4:12: +4:13 + scope 1 { + debug a => _2; // in scope 1 at $DIR/reborrow.rs:+1:9: +1:10 + let _3: &mut u8; // in scope 1 at $DIR/reborrow.rs:+2:9: +2:10 + scope 2 { + debug b => _3; // in scope 2 at $DIR/reborrow.rs:+2:9: +2:10 + let _4: &mut u8; // in scope 2 at $DIR/reborrow.rs:+3:9: +3:10 + scope 3 { +- debug c => _4; // in scope 3 at $DIR/reborrow.rs:+3:9: +3:10 ++ debug c => _2; // in scope 3 at $DIR/reborrow.rs:+3:9: +3:10 + } + } + } + + bb0: { +- StorageLive(_2); // scope 0 at $DIR/reborrow.rs:+1:9: +1:10 + _2 = &mut _1; // scope 0 at $DIR/reborrow.rs:+1:13: +1:19 + StorageLive(_3); // scope 1 at $DIR/reborrow.rs:+2:9: +2:10 + _3 = &mut (*_2); // scope 1 at $DIR/reborrow.rs:+2:13: +2:20 +- StorageLive(_4); // scope 2 at $DIR/reborrow.rs:+3:9: +3:10 +- _4 = move _2; // scope 2 at $DIR/reborrow.rs:+3:13: +3:14 + StorageLive(_5); // scope 3 at $DIR/reborrow.rs:+4:5: +4:14 +- StorageLive(_6); // scope 3 at $DIR/reborrow.rs:+4:12: +4:13 +- _6 = move _4; // scope 3 at $DIR/reborrow.rs:+4:12: +4:13 +- _5 = opaque::<&mut u8>(move _6) -> bb1; // scope 3 at $DIR/reborrow.rs:+4:5: +4:14 ++ _5 = opaque::<&mut u8>(move _2) -> bb1; // scope 3 at $DIR/reborrow.rs:+4:5: +4:14 + // mir::Constant + // + span: $DIR/reborrow.rs:15:5: 15:11 + // + literal: Const { ty: fn(&mut u8) {opaque::<&mut u8>}, val: Value() } + } + + bb1: { +- StorageDead(_6); // scope 3 at $DIR/reborrow.rs:+4:13: +4:14 + StorageDead(_5); // scope 3 at $DIR/reborrow.rs:+4:14: +4:15 + _0 = const (); // scope 0 at $DIR/reborrow.rs:+0:21: +5:2 +- StorageDead(_4); // scope 2 at $DIR/reborrow.rs:+5:1: +5:2 + StorageDead(_3); // scope 1 at $DIR/reborrow.rs:+5:1: +5:2 +- StorageDead(_2); // scope 0 at $DIR/reborrow.rs:+5:1: +5:2 + return; // scope 0 at $DIR/reborrow.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.diff b/tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.diff new file mode 100644 index 000000000..63e42b4dc --- /dev/null +++ b/tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.diff @@ -0,0 +1,50 @@ +- // MIR for `reraw` before CopyProp ++ // MIR for `reraw` after CopyProp + + fn reraw(_1: u8) -> () { + debug x => _1; // in scope 0 at $DIR/reborrow.rs:+0:10: +0:15 + let mut _0: (); // return place in scope 0 at $DIR/reborrow.rs:+0:21: +0:21 + let _2: &mut u8; // in scope 0 at $DIR/reborrow.rs:+1:9: +1:10 + let _5: (); // in scope 0 at $DIR/reborrow.rs:+4:5: +4:14 + let mut _6: &mut u8; // in scope 0 at $DIR/reborrow.rs:+4:12: +4:13 + scope 1 { + debug a => _2; // in scope 1 at $DIR/reborrow.rs:+1:9: +1:10 + let _3: *mut u8; // in scope 1 at $DIR/reborrow.rs:+2:9: +2:10 + scope 2 { + debug b => _3; // in scope 2 at $DIR/reborrow.rs:+2:9: +2:10 + let _4: &mut u8; // in scope 2 at $DIR/reborrow.rs:+3:9: +3:10 + scope 3 { +- debug c => _4; // in scope 3 at $DIR/reborrow.rs:+3:9: +3:10 ++ debug c => _2; // in scope 3 at $DIR/reborrow.rs:+3:9: +3:10 + } + } + } + + bb0: { +- StorageLive(_2); // scope 0 at $DIR/reborrow.rs:+1:9: +1:10 + _2 = &mut _1; // scope 0 at $DIR/reborrow.rs:+1:13: +1:19 + StorageLive(_3); // scope 1 at $DIR/reborrow.rs:+2:9: +2:10 + _3 = &raw mut (*_2); // scope 1 at $DIR/reborrow.rs:+2:13: +2:24 +- StorageLive(_4); // scope 2 at $DIR/reborrow.rs:+3:9: +3:10 +- _4 = move _2; // scope 2 at $DIR/reborrow.rs:+3:13: +3:14 + StorageLive(_5); // scope 3 at $DIR/reborrow.rs:+4:5: +4:14 +- StorageLive(_6); // scope 3 at $DIR/reborrow.rs:+4:12: +4:13 +- _6 = move _4; // scope 3 at $DIR/reborrow.rs:+4:12: +4:13 +- _5 = opaque::<&mut u8>(move _6) -> bb1; // scope 3 at $DIR/reborrow.rs:+4:5: +4:14 ++ _5 = opaque::<&mut u8>(move _2) -> bb1; // scope 3 at $DIR/reborrow.rs:+4:5: +4:14 + // mir::Constant + // + span: $DIR/reborrow.rs:23:5: 23:11 + // + literal: Const { ty: fn(&mut u8) {opaque::<&mut u8>}, val: Value() } + } + + bb1: { +- StorageDead(_6); // scope 3 at $DIR/reborrow.rs:+4:13: +4:14 + StorageDead(_5); // scope 3 at $DIR/reborrow.rs:+4:14: +4:15 + _0 = const (); // scope 0 at $DIR/reborrow.rs:+0:21: +5:2 +- StorageDead(_4); // scope 2 at $DIR/reborrow.rs:+5:1: +5:2 + StorageDead(_3); // scope 1 at $DIR/reborrow.rs:+5:1: +5:2 +- StorageDead(_2); // scope 0 at $DIR/reborrow.rs:+5:1: +5:2 + return; // scope 0 at $DIR/reborrow.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/copy-prop/reborrow.rs b/tests/mir-opt/copy-prop/reborrow.rs new file mode 100644 index 000000000..91b77966b --- /dev/null +++ b/tests/mir-opt/copy-prop/reborrow.rs @@ -0,0 +1,47 @@ +// ignore-wasm32 compiled with panic=abort by default +// Check that CopyProp considers reborrows as not mutating the pointer. +// unit-test: CopyProp + +#![feature(raw_ref_op)] + +#[inline(never)] +fn opaque(_: impl Sized) {} + +// EMIT_MIR reborrow.remut.CopyProp.diff +fn remut(mut x: u8) { + let a = &mut x; + let b = &mut *a; //< this cannot mutate a. + let c = a; //< so `c` and `a` can be merged. + opaque(c); +} + +// EMIT_MIR reborrow.reraw.CopyProp.diff +fn reraw(mut x: u8) { + let a = &mut x; + let b = &raw mut *a; //< this cannot mutate a. + let c = a; //< so `c` and `a` can be merged. + opaque(c); +} + +// EMIT_MIR reborrow.miraw.CopyProp.diff +fn miraw(mut x: u8) { + let a = &raw mut x; + let b = unsafe { &raw mut *a }; //< this cannot mutate a. + let c = a; //< so `c` and `a` can be merged. + opaque(c); +} + +// EMIT_MIR reborrow.demiraw.CopyProp.diff +fn demiraw(mut x: u8) { + let a = &raw mut x; + let b = unsafe { &mut *a }; //< this cannot mutate a. + let c = a; //< so `c` and `a` can be merged. + opaque(c); +} + +fn main() { + remut(0); + reraw(0); + miraw(0); + demiraw(0); +} diff --git a/tests/mir-opt/dataflow-const-prop/checked.rs b/tests/mir-opt/dataflow-const-prop/checked.rs index 0738a4ee5..0f9f5a97f 100644 --- a/tests/mir-opt/dataflow-const-prop/checked.rs +++ b/tests/mir-opt/dataflow-const-prop/checked.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: DataflowConstProp // compile-flags: -Coverflow-checks=on diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.diff index 29781e9ce..1edcc28e6 100644 --- a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.diff @@ -8,7 +8,7 @@ let mut _3: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 scope 1 { } - scope 2 (inlined ::add) { // at $DIR/inherit_overflow.rs:8:13: 8:47 + scope 2 (inlined ::add) { // at $DIR/inherit_overflow.rs:9:13: 9:47 debug self => _2; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL debug other => _3; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL let mut _4: (u8, bool); // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs b/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs index f4aba60f0..90349d527 100644 --- a/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs +++ b/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: DataflowConstProp // compile-flags: -Zmir-enable-passes=+Inline diff --git a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.diff index 158f187f1..70ef17afd 100644 --- a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.diff @@ -26,7 +26,7 @@ _3 = &(*_4); // scope 1 at $DIR/ref_without_sb.rs:+2:12: +2:14 _2 = escape::(move _3) -> bb1; // scope 1 at $DIR/ref_without_sb.rs:+2:5: +2:15 // mir::Constant - // + span: $DIR/ref_without_sb.rs:12:5: 12:11 + // + span: $DIR/ref_without_sb.rs:13:5: 13:11 // + literal: Const { ty: for<'a> fn(&'a i32) {escape::}, val: Value() } } @@ -38,7 +38,7 @@ StorageLive(_5); // scope 1 at $DIR/ref_without_sb.rs:+4:5: +4:20 _5 = some_function() -> bb2; // scope 1 at $DIR/ref_without_sb.rs:+4:5: +4:20 // mir::Constant - // + span: $DIR/ref_without_sb.rs:14:5: 14:18 + // + span: $DIR/ref_without_sb.rs:15:5: 15:18 // + literal: Const { ty: fn() {some_function}, val: Value() } } diff --git a/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs b/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs index 2fd480b09..f53de3cf2 100644 --- a/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs +++ b/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: DataflowConstProp #[inline(never)] diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.diff index 004643e36..6ca569f3d 100644 --- a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.diff @@ -32,7 +32,7 @@ _5 = _3; // scope 3 at $DIR/sibling_ptr.rs:+4:10: +4:11 _4 = ptr::mut_ptr::::add(move _5, const 1_usize) -> bb1; // scope 3 at $DIR/sibling_ptr.rs:+4:10: +4:18 // mir::Constant - // + span: $DIR/sibling_ptr.rs:15:12: 15:15 + // + span: $DIR/sibling_ptr.rs:16:12: 16:15 // + literal: Const { ty: unsafe fn(*mut u8, usize) -> *mut u8 {ptr::mut_ptr::::add}, val: Value() } } diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs b/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs index 6dfb3a4ed..81fc3c2f4 100644 --- a/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs +++ b/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // This attempts to modify `x.1` via a pointer derived from `addr_of_mut!(x.0)`. // According to Miri, that is UB. However, T-opsem has not finalized that // decision and as such we cannot rely on it in optimizations. Consequently, diff --git a/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.diff index 8018400e7..9854beaeb 100644 --- a/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.diff @@ -25,7 +25,7 @@ - _2 = foo(move _3) -> bb1; // scope 1 at $DIR/terminator.rs:+3:5: +3:15 + _2 = foo(const 2_i32) -> bb1; // scope 1 at $DIR/terminator.rs:+3:5: +3:15 // mir::Constant - // + span: $DIR/terminator.rs:9:5: 9:8 + // + span: $DIR/terminator.rs:10:5: 10:8 // + literal: Const { ty: fn(i32) {foo}, val: Value() } } diff --git a/tests/mir-opt/dataflow-const-prop/terminator.rs b/tests/mir-opt/dataflow-const-prop/terminator.rs index d151f666a..4f001df35 100644 --- a/tests/mir-opt/dataflow-const-prop/terminator.rs +++ b/tests/mir-opt/dataflow-const-prop/terminator.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: DataflowConstProp fn foo(n: i32) {} diff --git a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff index cd3b792fb..2776ff51d 100644 --- a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff +++ b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff @@ -32,7 +32,7 @@ + StorageLive(_4); // scope 0 at $DIR/cycle.rs:+3:11: +3:17 + _4 = cond() -> bb2; // scope 0 at $DIR/cycle.rs:+3:11: +3:17 // mir::Constant - // + span: $DIR/cycle.rs:12:11: 12:15 + // + span: $DIR/cycle.rs:13:11: 13:15 // + literal: Const { ty: fn() -> bool {cond}, val: Value() } } diff --git a/tests/mir-opt/dead-store-elimination/cycle.rs b/tests/mir-opt/dead-store-elimination/cycle.rs index b35ce0bcb..570bfe84d 100644 --- a/tests/mir-opt/dead-store-elimination/cycle.rs +++ b/tests/mir-opt/dead-store-elimination/cycle.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: DeadStoreElimination #[inline(never)] diff --git a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff b/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff index 3b1f81175..c4ebf1ca8 100644 --- a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff +++ b/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff @@ -19,7 +19,7 @@ _3 = &(*_1); // scope 0 at $DIR/deduplicate_blocks.rs:+1:11: +1:23 _2 = core::str::::as_bytes(move _3) -> bb1; // scope 0 at $DIR/deduplicate_blocks.rs:+1:11: +1:23 // mir::Constant - // + span: $DIR/deduplicate_blocks.rs:5:13: 5:21 + // + span: $DIR/deduplicate_blocks.rs:6:13: 6:21 // + literal: Const { ty: for<'a> fn(&'a str) -> &'a [u8] {core::str::::as_bytes}, val: Value() } } diff --git a/tests/mir-opt/deduplicate_blocks.rs b/tests/mir-opt/deduplicate_blocks.rs index 2b9eed99e..46012e19a 100644 --- a/tests/mir-opt/deduplicate_blocks.rs +++ b/tests/mir-opt/deduplicate_blocks.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: DeduplicateBlocks // EMIT_MIR deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff diff --git a/tests/mir-opt/deref-patterns/string.foo.PreCodegen.after.mir b/tests/mir-opt/deref-patterns/string.foo.PreCodegen.after.mir index 9597a0c83..97826ed19 100644 --- a/tests/mir-opt/deref-patterns/string.foo.PreCodegen.after.mir +++ b/tests/mir-opt/deref-patterns/string.foo.PreCodegen.after.mir @@ -25,19 +25,19 @@ fn foo(_1: Option) -> i32 { _7 = const false; // scope 0 at $DIR/string.rs:+3:9: +3:10 _6 = move _1; // scope 0 at $DIR/string.rs:+3:9: +3:10 _0 = const 4321_i32; // scope 1 at $DIR/string.rs:+3:14: +3:18 - drop(_6) -> bb6; // scope 0 at $DIR/string.rs:+3:17: +3:18 + drop(_6) -> [return: bb6, unwind unreachable]; // scope 0 at $DIR/string.rs:+3:17: +3:18 } bb2: { _2 = &((_1 as Some).0: std::string::String); // scope 0 at $DIR/string.rs:+2:14: +2:17 - _3 = ::deref(move _2) -> bb3; // scope 0 at $DIR/string.rs:+2:14: +2:17 + _3 = ::deref(move _2) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/string.rs:+2:14: +2:17 // mir::Constant // + span: $DIR/string.rs:9:14: 9:17 // + literal: Const { ty: for<'a> fn(&'a String) -> &'a ::Target {::deref}, val: Value() } } bb3: { - _4 = ::eq(_3, const "a") -> bb4; // scope 0 at $DIR/string.rs:+2:14: +2:17 + _4 = ::eq(_3, const "a") -> [return: bb4, unwind unreachable]; // scope 0 at $DIR/string.rs:+2:14: +2:17 // mir::Constant // + span: $DIR/string.rs:9:14: 9:17 // + literal: Const { ty: for<'a, 'b> fn(&'a str, &'b str) -> bool {::eq}, val: Value() } @@ -65,7 +65,7 @@ fn foo(_1: Option) -> i32 { } bb8: { - drop(_1) -> bb7; // scope 0 at $DIR/string.rs:+5:1: +5:2 + drop(_1) -> [return: bb7, unwind unreachable]; // scope 0 at $DIR/string.rs:+5:1: +5:2 } bb9: { diff --git a/tests/mir-opt/derefer_inline_test.main.Derefer.diff b/tests/mir-opt/derefer_inline_test.main.Derefer.diff index 3540df308..426d4fb21 100644 --- a/tests/mir-opt/derefer_inline_test.main.Derefer.diff +++ b/tests/mir-opt/derefer_inline_test.main.Derefer.diff @@ -3,58 +3,42 @@ fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/derefer_inline_test.rs:+0:11: +0:11 - let _1: std::boxed::Box>; // in scope 0 at $DIR/derefer_inline_test.rs:+1:5: +1:12 - let mut _2: usize; // in scope 0 at $DIR/derefer_inline_test.rs:+1:5: +1:12 - let mut _3: usize; // in scope 0 at $DIR/derefer_inline_test.rs:+1:5: +1:12 - let mut _4: *mut u8; // in scope 0 at $DIR/derefer_inline_test.rs:+1:5: +1:12 - let mut _5: std::boxed::Box>; // in scope 0 at $DIR/derefer_inline_test.rs:+1:5: +1:12 - scope 1 { - } + let _1: std::boxed::Box>; // in scope 0 at $DIR/derefer_inline_test.rs:+1:5: +1:18 + let mut _2: std::boxed::Box; // in scope 0 at $DIR/derefer_inline_test.rs:+1:14: +1:17 bb0: { - StorageLive(_1); // scope 0 at $DIR/derefer_inline_test.rs:+1:5: +1:12 - _2 = SizeOf(std::boxed::Box); // scope 1 at $DIR/derefer_inline_test.rs:+1:5: +1:12 - _3 = AlignOf(std::boxed::Box); // scope 1 at $DIR/derefer_inline_test.rs:+1:5: +1:12 - _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> bb1; // scope 1 at $DIR/derefer_inline_test.rs:+1:5: +1:12 + StorageLive(_1); // scope 0 at $DIR/derefer_inline_test.rs:+1:5: +1:18 + StorageLive(_2); // scope 0 at $DIR/derefer_inline_test.rs:+1:14: +1:17 + _2 = f() -> bb1; // scope 0 at $DIR/derefer_inline_test.rs:+1:14: +1:17 // mir::Constant - // + span: $DIR/derefer_inline_test.rs:11:5: 11:12 - // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value() } + // + span: $DIR/derefer_inline_test.rs:10:14: 10:15 + // + literal: Const { ty: fn() -> Box {f}, val: Value() } } bb1: { - StorageLive(_5); // scope 0 at $DIR/derefer_inline_test.rs:+1:5: +1:12 - _5 = ShallowInitBox(move _4, std::boxed::Box); // scope 0 at $DIR/derefer_inline_test.rs:+1:5: +1:12 - (*_5) = f() -> [return: bb2, unwind: bb6]; // scope 0 at $DIR/derefer_inline_test.rs:+1:9: +1:12 + _1 = Box::>::new(move _2) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/derefer_inline_test.rs:+1:5: +1:18 // mir::Constant - // + span: $DIR/derefer_inline_test.rs:11:9: 11:10 - // + literal: Const { ty: fn() -> Box {f}, val: Value() } + // + span: $DIR/derefer_inline_test.rs:10:5: 10:13 + // + user_ty: UserType(0) + // + literal: Const { ty: fn(Box) -> Box> {Box::>::new}, val: Value() } } bb2: { - _1 = move _5; // scope 0 at $DIR/derefer_inline_test.rs:+1:5: +1:12 - drop(_5) -> [return: bb3, unwind: bb5]; // scope 0 at $DIR/derefer_inline_test.rs:+1:11: +1:12 + StorageDead(_2); // scope 0 at $DIR/derefer_inline_test.rs:+1:17: +1:18 + drop(_1) -> bb3; // scope 0 at $DIR/derefer_inline_test.rs:+1:18: +1:19 } bb3: { - StorageDead(_5); // scope 0 at $DIR/derefer_inline_test.rs:+1:11: +1:12 - drop(_1) -> bb4; // scope 0 at $DIR/derefer_inline_test.rs:+1:12: +1:13 - } - - bb4: { - StorageDead(_1); // scope 0 at $DIR/derefer_inline_test.rs:+1:12: +1:13 + StorageDead(_1); // scope 0 at $DIR/derefer_inline_test.rs:+1:18: +1:19 _0 = const (); // scope 0 at $DIR/derefer_inline_test.rs:+0:11: +2:2 return; // scope 0 at $DIR/derefer_inline_test.rs:+2:2: +2:2 } - bb5 (cleanup): { - drop(_1) -> bb7; // scope 0 at $DIR/derefer_inline_test.rs:+1:12: +1:13 - } - - bb6 (cleanup): { - drop(_5) -> bb7; // scope 0 at $DIR/derefer_inline_test.rs:+1:11: +1:12 + bb4 (cleanup): { + drop(_2) -> [return: bb5, unwind terminate]; // scope 0 at $DIR/derefer_inline_test.rs:+1:17: +1:18 } - bb7 (cleanup): { + bb5 (cleanup): { resume; // scope 0 at $DIR/derefer_inline_test.rs:+0:1: +2:2 } } diff --git a/tests/mir-opt/derefer_inline_test.rs b/tests/mir-opt/derefer_inline_test.rs index cc06a7dd8..38311d4d0 100644 --- a/tests/mir-opt/derefer_inline_test.rs +++ b/tests/mir-opt/derefer_inline_test.rs @@ -2,11 +2,10 @@ // EMIT_MIR derefer_inline_test.main.Derefer.diff // ignore-wasm32 compiled with panic=abort by default -#![feature(box_syntax)] #[inline] fn f() -> Box { - box 0 + Box::new(0) } fn main() { - box f(); + Box::new(f()); } diff --git a/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.diff b/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.diff index 9c7296632..b7416d389 100644 --- a/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.diff +++ b/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.diff @@ -22,7 +22,7 @@ + nop; // scope 0 at $DIR/branch.rs:+1:9: +1:10 + _0 = val() -> bb1; // scope 0 at $DIR/branch.rs:+1:13: +1:18 // mir::Constant - // + span: $DIR/branch.rs:13:13: 13:16 + // + span: $DIR/branch.rs:14:13: 14:16 // + literal: Const { ty: fn() -> i32 {val}, val: Value() } } @@ -32,7 +32,7 @@ StorageLive(_3); // scope 1 at $DIR/branch.rs:+3:16: +3:22 _3 = cond() -> bb2; // scope 1 at $DIR/branch.rs:+3:16: +3:22 // mir::Constant - // + span: $DIR/branch.rs:15:16: 15:20 + // + span: $DIR/branch.rs:16:16: 16:20 // + literal: Const { ty: fn() -> bool {cond}, val: Value() } } @@ -50,7 +50,7 @@ StorageLive(_4); // scope 1 at $DIR/branch.rs:+6:9: +6:14 _4 = val() -> bb5; // scope 1 at $DIR/branch.rs:+6:9: +6:14 // mir::Constant - // + span: $DIR/branch.rs:18:9: 18:12 + // + span: $DIR/branch.rs:19:9: 19:12 // + literal: Const { ty: fn() -> i32 {val}, val: Value() } } diff --git a/tests/mir-opt/dest-prop/branch.rs b/tests/mir-opt/dest-prop/branch.rs index 898c908b1..7e4276e66 100644 --- a/tests/mir-opt/dest-prop/branch.rs +++ b/tests/mir-opt/dest-prop/branch.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default //! Tests that assignment in both branches of an `if` are eliminated. // unit-test: DestinationPropagation fn val() -> i32 { diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.diff index 298991b5a..a61e741f7 100644 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.diff +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.diff @@ -16,7 +16,7 @@ + nop; // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12 + _2 = dummy(move _1) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13 // mir::Constant - // + span: $DIR/copy_propagation_arg.rs:16:5: 16:10 + // + span: $DIR/copy_propagation_arg.rs:17:5: 17:10 // + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value() } } diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.diff index d37a9f71d..c7fbecac5 100644 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.diff +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.diff @@ -15,7 +15,7 @@ - _2 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17 + _1 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17 // mir::Constant - // + span: $DIR/copy_propagation_arg.rs:11:9: 11:14 + // + span: $DIR/copy_propagation_arg.rs:12:9: 12:14 // + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value() } } diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.rs b/tests/mir-opt/dest-prop/copy_propagation_arg.rs index 31be6c931..57cb328c2 100644 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.rs +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // Check that DestinationPropagation does not propagate an assignment to a function argument // (doing so can break usages of the original argument value) // unit-test: DestinationPropagation diff --git a/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff b/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff index cfc203c5f..b06f069a2 100644 --- a/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff +++ b/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff @@ -28,7 +28,7 @@ + nop; // scope 0 at $DIR/cycle.rs:+1:9: +1:14 + _6 = val() -> bb1; // scope 0 at $DIR/cycle.rs:+1:17: +1:22 // mir::Constant - // + span: $DIR/cycle.rs:9:17: 9:20 + // + span: $DIR/cycle.rs:10:17: 10:20 // + literal: Const { ty: fn() -> i32 {val}, val: Value() } } @@ -56,7 +56,7 @@ + nop; // scope 3 at $DIR/cycle.rs:+6:10: +6:11 _5 = std::mem::drop::(move _6) -> bb2; // scope 3 at $DIR/cycle.rs:+6:5: +6:12 // mir::Constant - // + span: $DIR/cycle.rs:14:5: 14:9 + // + span: $DIR/cycle.rs:15:5: 15:9 // + literal: Const { ty: fn(i32) {std::mem::drop::}, val: Value() } } diff --git a/tests/mir-opt/dest-prop/cycle.rs b/tests/mir-opt/dest-prop/cycle.rs index 6182878f3..3aea19d80 100644 --- a/tests/mir-opt/dest-prop/cycle.rs +++ b/tests/mir-opt/dest-prop/cycle.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default //! Tests that cyclic assignments don't hang DestinationPropagation, and result in reasonable code. // unit-test: DestinationPropagation fn val() -> i32 { diff --git a/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.mir b/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.mir index 63cac133b..b9d4b59d2 100644 --- a/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.mir +++ b/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.mir @@ -22,7 +22,7 @@ fn f(_1: usize) -> usize { nop; // scope 1 at $DIR/dead_stores_79191.rs:+4:8: +4:9 _0 = id::(move _1) -> bb1; // scope 1 at $DIR/dead_stores_79191.rs:+4:5: +4:10 // mir::Constant - // + span: $DIR/dead_stores_79191.rs:12:5: 12:7 + // + span: $DIR/dead_stores_79191.rs:13:5: 13:7 // + literal: Const { ty: fn(usize) -> usize {id::}, val: Value() } } diff --git a/tests/mir-opt/dest-prop/dead_stores_79191.rs b/tests/mir-opt/dest-prop/dead_stores_79191.rs index 43e0bf664..9d4814838 100644 --- a/tests/mir-opt/dest-prop/dead_stores_79191.rs +++ b/tests/mir-opt/dest-prop/dead_stores_79191.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: DestinationPropagation fn id(x: T) -> T { diff --git a/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.mir b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.mir index 26068931a..9eb0e09bf 100644 --- a/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.mir +++ b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.mir @@ -21,7 +21,7 @@ fn f(_1: usize) -> usize { nop; // scope 1 at $DIR/dead_stores_better.rs:+4:8: +4:9 _0 = id::(move _1) -> bb1; // scope 1 at $DIR/dead_stores_better.rs:+4:5: +4:10 // mir::Constant - // + span: $DIR/dead_stores_better.rs:16:5: 16:7 + // + span: $DIR/dead_stores_better.rs:17:5: 17:7 // + literal: Const { ty: fn(usize) -> usize {id::}, val: Value() } } diff --git a/tests/mir-opt/dest-prop/dead_stores_better.rs b/tests/mir-opt/dest-prop/dead_stores_better.rs index 003ad57d8..72d406bfd 100644 --- a/tests/mir-opt/dest-prop/dead_stores_better.rs +++ b/tests/mir-opt/dest-prop/dead_stores_better.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // This is a copy of the `dead_stores_79191` test, except that we turn on DSE. This demonstrates // that that pass enables this one to do more optimizations. diff --git a/tests/mir-opt/dest-prop/simple.rs b/tests/mir-opt/dest-prop/simple.rs index d4c27228f..3a4aec34e 100644 --- a/tests/mir-opt/dest-prop/simple.rs +++ b/tests/mir-opt/dest-prop/simple.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default //! Copy of `nrvo-simple.rs`, to ensure that full dest-prop handles it too. // unit-test: DestinationPropagation // EMIT_MIR simple.nrvo.DestinationPropagation.diff diff --git a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.diff b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.diff index fbed31788..457fc8308 100644 --- a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.diff +++ b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.diff @@ -10,7 +10,7 @@ debug un => _1; // in scope 1 at $DIR/union.rs:+5:9: +5:11 scope 2 { } - scope 3 (inlined std::mem::drop::) { // at $DIR/union.rs:15:5: 15:27 + scope 3 (inlined std::mem::drop::) { // at $DIR/union.rs:16:5: 16:27 debug _x => _3; // in scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL } } @@ -20,7 +20,7 @@ StorageLive(_2); // scope 0 at $DIR/union.rs:+5:23: +5:28 _2 = val() -> bb1; // scope 0 at $DIR/union.rs:+5:23: +5:28 // mir::Constant - // + span: $DIR/union.rs:13:23: 13:26 + // + span: $DIR/union.rs:14:23: 14:26 // + literal: Const { ty: fn() -> u32 {val}, val: Value() } } diff --git a/tests/mir-opt/dest-prop/union.rs b/tests/mir-opt/dest-prop/union.rs index eb6cb09fc..062d02d06 100644 --- a/tests/mir-opt/dest-prop/union.rs +++ b/tests/mir-opt/dest-prop/union.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default //! Tests that we can propagate into places that are projections into unions // compile-flags: -Zunsound-mir-opts fn val() -> u32 { diff --git a/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.diff b/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.diff index 9ea756c27..ae63d724d 100644 --- a/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.diff +++ b/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.diff @@ -36,7 +36,7 @@ - _6 = _2; // scope 1 at $DIR/unreachable.rs:+3:14: +3:15 - _4 = g::(move _5, move _6) -> bb2; // scope 1 at $DIR/unreachable.rs:+3:9: +3:16 - // mir::Constant -- // + span: $DIR/unreachable.rs:11:9: 11:10 +- // + span: $DIR/unreachable.rs:12:9: 12:10 - // + literal: Const { ty: fn(T, T) {g::}, val: Value() } - } - @@ -60,7 +60,7 @@ + _9 = _1; // scope 1 at $DIR/unreachable.rs:+5:14: +5:15 + _7 = g::(move _1, move _9) -> bb2; // scope 1 at $DIR/unreachable.rs:+5:9: +5:16 // mir::Constant - // + span: $DIR/unreachable.rs:13:9: 13:10 + // + span: $DIR/unreachable.rs:14:9: 14:10 // + literal: Const { ty: fn(T, T) {g::}, val: Value() } } diff --git a/tests/mir-opt/dest-prop/unreachable.rs b/tests/mir-opt/dest-prop/unreachable.rs index 32b5def98..c73d11ae3 100644 --- a/tests/mir-opt/dest-prop/unreachable.rs +++ b/tests/mir-opt/dest-prop/unreachable.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // Check that unreachable code is removed after the destination propagation. // Regression test for issue #105428. // diff --git a/tests/mir-opt/div_overflow.const_dividend.PreCodegen.after.mir b/tests/mir-opt/div_overflow.const_dividend.PreCodegen.after.mir deleted file mode 100644 index 1a7fb916e..000000000 --- a/tests/mir-opt/div_overflow.const_dividend.PreCodegen.after.mir +++ /dev/null @@ -1,17 +0,0 @@ -// MIR for `const_dividend` after PreCodegen - -fn const_dividend(_1: i32) -> i32 { - debug a => _1; // in scope 0 at $DIR/div_overflow.rs:+0:23: +0:24 - let mut _0: i32; // return place in scope 0 at $DIR/div_overflow.rs:+0:34: +0:37 - let mut _2: bool; // in scope 0 at $DIR/div_overflow.rs:+1:5: +1:12 - - bb0: { - _2 = Eq(_1, const 0_i32); // scope 0 at $DIR/div_overflow.rs:+1:5: +1:12 - assert(!move _2, "attempt to divide `{}` by zero", const 256_i32) -> bb1; // scope 0 at $DIR/div_overflow.rs:+1:5: +1:12 - } - - bb1: { - _0 = Div(const 256_i32, _1); // scope 0 at $DIR/div_overflow.rs:+1:5: +1:12 - return; // scope 0 at $DIR/div_overflow.rs:+2:2: +2:2 - } -} diff --git a/tests/mir-opt/div_overflow.const_divisor.PreCodegen.after.mir b/tests/mir-opt/div_overflow.const_divisor.PreCodegen.after.mir deleted file mode 100644 index 5526a194b..000000000 --- a/tests/mir-opt/div_overflow.const_divisor.PreCodegen.after.mir +++ /dev/null @@ -1,11 +0,0 @@ -// MIR for `const_divisor` after PreCodegen - -fn const_divisor(_1: i32) -> i32 { - debug a => _1; // in scope 0 at $DIR/div_overflow.rs:+0:22: +0:23 - let mut _0: i32; // return place in scope 0 at $DIR/div_overflow.rs:+0:33: +0:36 - - bb0: { - _0 = Div(_1, const 256_i32); // scope 0 at $DIR/div_overflow.rs:+1:5: +1:12 - return; // scope 0 at $DIR/div_overflow.rs:+2:2: +2:2 - } -} diff --git a/tests/mir-opt/div_overflow.rs b/tests/mir-opt/div_overflow.rs deleted file mode 100644 index 10ce5bc0f..000000000 --- a/tests/mir-opt/div_overflow.rs +++ /dev/null @@ -1,18 +0,0 @@ -// compile-flags: -Copt-level=0 -Coverflow-checks=yes - -// Tests that division with a const does not emit a panicking branch for overflow - -// EMIT_MIR div_overflow.const_divisor.PreCodegen.after.mir -pub fn const_divisor(a: i32) -> i32 { - a / 256 -} - -// EMIT_MIR div_overflow.const_dividend.PreCodegen.after.mir -pub fn const_dividend(a: i32) -> i32 { - 256 / a -} - -fn main() { - const_divisor(123); - const_dividend(123); -} diff --git a/tests/mir-opt/dont_yeet_assert.generic.InstCombine.diff b/tests/mir-opt/dont_yeet_assert.generic.InstCombine.diff index c1a42a47e..c0fc1fb1d 100644 --- a/tests/mir-opt/dont_yeet_assert.generic.InstCombine.diff +++ b/tests/mir-opt/dont_yeet_assert.generic.InstCombine.diff @@ -7,7 +7,7 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/dont_yeet_assert.rs:+1:5: +1:61 - _1 = assert_mem_uninitialized_valid::<&T>() -> bb1; // 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) diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff index 1f5c53381..8a4a16825 100644 --- a/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff +++ b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff @@ -40,7 +40,7 @@ _5 = &(*_1); // scope 0 at $DIR/funky_arms.rs:+4:22: +4:37 _4 = Formatter::<'_>::sign_plus(move _5) -> bb1; // scope 0 at $DIR/funky_arms.rs:+4:22: +4:37 // mir::Constant - // + span: $DIR/funky_arms.rs:15:26: 15:35 + // + span: $DIR/funky_arms.rs:16:26: 16:35 // + literal: Const { ty: for<'a> fn(&'a Formatter<'_>) -> bool {Formatter::<'_>::sign_plus}, val: Value() } } @@ -54,7 +54,7 @@ - _6 = MinusPlus; // scope 1 at $DIR/funky_arms.rs:+10:17: +10:41 + _6 = const MinusPlus; // scope 1 at $DIR/funky_arms.rs:+10:17: +10:41 + // mir::Constant -+ // + span: $DIR/funky_arms.rs:21:17: 21:41 ++ // + span: no-location + // + literal: Const { ty: Sign, val: Value(Scalar(0x01)) } goto -> bb4; // scope 1 at $DIR/funky_arms.rs:+10:17: +10:41 } @@ -63,7 +63,7 @@ - _6 = Minus; // scope 1 at $DIR/funky_arms.rs:+9:18: +9:38 + _6 = const Minus; // scope 1 at $DIR/funky_arms.rs:+9:18: +9:38 + // mir::Constant -+ // + span: $DIR/funky_arms.rs:20:18: 20:38 ++ // + span: no-location + // + literal: Const { ty: Sign, val: Value(Scalar(0x00)) } goto -> bb4; // scope 1 at $DIR/funky_arms.rs:+9:18: +9:38 } @@ -74,7 +74,7 @@ _8 = &(*_1); // scope 3 at $DIR/funky_arms.rs:+13:30: +13:45 _7 = Formatter::<'_>::precision(move _8) -> bb5; // scope 3 at $DIR/funky_arms.rs:+13:30: +13:45 // mir::Constant - // + span: $DIR/funky_arms.rs:24:34: 24:43 + // + span: $DIR/funky_arms.rs:25:34: 25:43 // + literal: Const { ty: for<'a> fn(&'a Formatter<'_>) -> Option {Formatter::<'_>::precision}, val: Value() } } @@ -95,7 +95,7 @@ StorageDead(_15); // scope 3 at $DIR/funky_arms.rs:+15:78: +15:79 _0 = float_to_exponential_common_exact::(_1, _2, move _13, move _14, _3) -> bb7; // scope 3 at $DIR/funky_arms.rs:+15:9: +15:87 // mir::Constant - // + span: $DIR/funky_arms.rs:26:9: 26:42 + // + span: $DIR/funky_arms.rs:27:9: 27:42 // + literal: Const { ty: for<'a, 'b, 'c> fn(&'a mut Formatter<'b>, &'c T, Sign, u32, bool) -> Result<(), std::fmt::Error> {float_to_exponential_common_exact::}, val: Value() } } @@ -110,7 +110,7 @@ _20 = _6; // scope 2 at $DIR/funky_arms.rs:+17:56: +17:60 _0 = float_to_exponential_common_shortest::(_1, _2, move _20, _3) -> bb9; // scope 2 at $DIR/funky_arms.rs:+17:9: +17:68 // mir::Constant - // + span: $DIR/funky_arms.rs:28:9: 28:45 + // + span: $DIR/funky_arms.rs:29:9: 29:45 // + literal: Const { ty: for<'a, 'b, 'c> fn(&'a mut Formatter<'b>, &'c T, Sign, bool) -> Result<(), std::fmt::Error> {float_to_exponential_common_shortest::}, val: Value() } } diff --git a/tests/mir-opt/funky_arms.rs b/tests/mir-opt/funky_arms.rs index 3e70d85e0..c4f75b5df 100644 --- a/tests/mir-opt/funky_arms.rs +++ b/tests/mir-opt/funky_arms.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // compile-flags: --crate-type lib -Cdebug-assertions=no #![feature(flt2dec)] diff --git a/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir b/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir index cfbe0aaf2..32b472ebe 100644 --- a/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir +++ b/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir @@ -110,7 +110,7 @@ yields () bb13 (cleanup): { StorageDead(_3); // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6 - drop(_1) -> bb14; // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6 + drop(_1) -> [return: bb14, unwind terminate]; // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6 } bb14 (cleanup): { @@ -119,6 +119,6 @@ yields () bb15 (cleanup): { StorageDead(_3); // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6 - drop(_1) -> bb14; // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6 + drop(_1) -> [return: bb14, unwind terminate]; // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6 } } diff --git a/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir b/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir index 7efda05d2..dc9bb533f 100644 --- a/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir +++ b/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir @@ -63,7 +63,7 @@ fn main::{closure#0}(_1: Pin<&mut [generator@$DIR/generator_tiny.rs:19:16: 19:24 StorageDead(_7); // scope 1 at $DIR/generator_tiny.rs:+3:17: +3:18 StorageDead(_6); // scope 1 at $DIR/generator_tiny.rs:+3:18: +3:19 StorageLive(_8); // scope 1 at $DIR/generator_tiny.rs:+4:13: +4:21 - _8 = callee() -> bb4; // scope 1 at $DIR/generator_tiny.rs:+4:13: +4:21 + _8 = callee() -> [return: bb4, unwind unreachable]; // scope 1 at $DIR/generator_tiny.rs:+4:13: +4:21 // mir::Constant // + span: $DIR/generator_tiny.rs:23:13: 23:19 // + literal: Const { ty: fn() {callee}, val: Value() } diff --git a/tests/mir-opt/inline/asm_unwind.main.Inline.diff b/tests/mir-opt/inline/asm_unwind.main.Inline.diff index f1b62ac38..ba1bfec05 100644 --- a/tests/mir-opt/inline/asm_unwind.main.Inline.diff +++ b/tests/mir-opt/inline/asm_unwind.main.Inline.diff @@ -7,7 +7,7 @@ + scope 1 (inlined foo) { // at $DIR/asm_unwind.rs:21:5: 21:10 + let _2: D; // in scope 1 at $DIR/asm_unwind.rs:15:9: 15:11 + scope 2 { -+ debug _d => _2; // in scope 2 at $DIR/asm_unwind.rs:15:9: 15:11 ++ debug _d => const D; // in scope 2 at $DIR/asm_unwind.rs:15:9: 15:11 + scope 3 { + } + } @@ -19,23 +19,23 @@ - // mir::Constant - // + span: $DIR/asm_unwind.rs:21:5: 21:8 - // + literal: Const { ty: fn() {foo}, val: Value() } -+ StorageLive(_2); // scope 1 at $DIR/asm_unwind.rs:15:9: 15:11 -+ asm!("", options(MAY_UNWIND)) -> [return: bb1, unwind: bb3]; // scope 3 at $DIR/asm_unwind.rs:16:14: 16:54 ++ StorageLive(_2); // scope 0 at $DIR/asm_unwind.rs:+1:5: +1:10 ++ asm!("", options(MAY_UNWIND)) -> [return: bb2, unwind: bb3]; // scope 3 at $DIR/asm_unwind.rs:16:14: 16:54 } bb1: { -+ drop(_2) -> bb2; // scope 1 at $DIR/asm_unwind.rs:17:1: 17:2 -+ } -+ -+ bb2: { -+ StorageDead(_2); // scope 1 at $DIR/asm_unwind.rs:17:1: 17:2 ++ StorageDead(_2); // scope 0 at $DIR/asm_unwind.rs:+1:5: +1:10 StorageDead(_1); // scope 0 at $DIR/asm_unwind.rs:+1:10: +1:11 _0 = const (); // scope 0 at $DIR/asm_unwind.rs:+0:15: +2:2 return; // scope 0 at $DIR/asm_unwind.rs:+2:2: +2:2 + } + ++ bb2: { ++ drop(_2) -> bb1; // scope 1 at $DIR/asm_unwind.rs:17:1: 17:2 ++ } ++ + bb3 (cleanup): { -+ drop(_2) -> bb4; // scope 1 at $DIR/asm_unwind.rs:17:1: 17:2 ++ drop(_2) -> [return: bb4, unwind terminate]; // scope 1 at $DIR/asm_unwind.rs:17:1: 17:2 + } + + bb4 (cleanup): { diff --git a/tests/mir-opt/inline/cycle.f.Inline.diff b/tests/mir-opt/inline/cycle.f.Inline.diff index 501390c3b..8da597577 100644 --- a/tests/mir-opt/inline/cycle.f.Inline.diff +++ b/tests/mir-opt/inline/cycle.f.Inline.diff @@ -33,7 +33,7 @@ } bb3 (cleanup): { - drop(_1) -> bb4; // scope 0 at $DIR/cycle.rs:+2:1: +2:2 + drop(_1) -> [return: bb4, unwind terminate]; // scope 0 at $DIR/cycle.rs:+2:1: +2:2 } bb4 (cleanup): { diff --git a/tests/mir-opt/inline/cycle.g.Inline.diff b/tests/mir-opt/inline/cycle.g.Inline.diff index 5f3ee467c..1e6e30f9e 100644 --- a/tests/mir-opt/inline/cycle.g.Inline.diff +++ b/tests/mir-opt/inline/cycle.g.Inline.diff @@ -5,11 +5,11 @@ let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:+0:8: +0:8 let _1: (); // in scope 0 at $DIR/cycle.rs:+1:5: +1:12 + let mut _2: fn() {main}; // in scope 0 at $DIR/cycle.rs:+1:5: +1:12 ++ let mut _5: (); // in scope 0 at $DIR/cycle.rs:6:5: 6:8 + scope 1 (inlined f::) { // at $DIR/cycle.rs:12:5: 12:12 + debug g => _2; // in scope 1 at $DIR/cycle.rs:5:6: 5:7 + let _3: (); // in scope 1 at $DIR/cycle.rs:6:5: 6:8 + let mut _4: &fn() {main}; // in scope 1 at $DIR/cycle.rs:6:5: 6:6 -+ let mut _5: (); // in scope 1 at $DIR/cycle.rs:6:5: 6:8 + scope 2 (inlined >::call - shim(fn() {main})) { // at $DIR/cycle.rs:6:5: 6:8 + } + } @@ -25,14 +25,16 @@ - // mir::Constant // + span: $DIR/cycle.rs:12:7: 12:11 // + literal: Const { ty: fn() {main}, val: Value() } -+ StorageLive(_3); // scope 1 at $DIR/cycle.rs:6:5: 6:8 ++ StorageLive(_3); // scope 0 at $DIR/cycle.rs:+1:5: +1:12 + StorageLive(_4); // scope 1 at $DIR/cycle.rs:6:5: 6:6 + _4 = &_2; // scope 1 at $DIR/cycle.rs:6:5: 6:6 + StorageLive(_5); // scope 1 at $DIR/cycle.rs:6:5: 6:8 ++ _5 = const (); // scope 1 at $DIR/cycle.rs:6:5: 6:8 + _3 = move (*_4)() -> [return: bb4, unwind: bb2]; // scope 2 at $SRC_DIR/core/src/ops/function.rs:LL:COL } bb1: { ++ StorageDead(_3); // scope 0 at $DIR/cycle.rs:+1:5: +1:12 + StorageDead(_2); // scope 0 at $DIR/cycle.rs:+1:5: +1:12 StorageDead(_1); // scope 0 at $DIR/cycle.rs:+1:12: +1:13 _0 = const (); // scope 0 at $DIR/cycle.rs:+0:8: +2:2 @@ -40,7 +42,7 @@ + } + + bb2 (cleanup): { -+ drop(_2) -> bb3; // scope 1 at $DIR/cycle.rs:7:1: 7:2 ++ drop(_2) -> [return: bb3, unwind terminate]; // scope 1 at $DIR/cycle.rs:7:1: 7:2 + } + + bb3 (cleanup): { @@ -48,9 +50,8 @@ + } + + bb4: { -+ StorageDead(_5); // scope 1 at $DIR/cycle.rs:6:7: 6:8 ++ StorageDead(_5); // scope 1 at $DIR/cycle.rs:6:5: 6:8 + StorageDead(_4); // scope 1 at $DIR/cycle.rs:6:7: 6:8 -+ StorageDead(_3); // scope 1 at $DIR/cycle.rs:6:8: 6:9 + drop(_2) -> bb1; // scope 1 at $DIR/cycle.rs:7:1: 7:2 } } diff --git a/tests/mir-opt/inline/cycle.main.Inline.diff b/tests/mir-opt/inline/cycle.main.Inline.diff index 6b4c63bbd..315634945 100644 --- a/tests/mir-opt/inline/cycle.main.Inline.diff +++ b/tests/mir-opt/inline/cycle.main.Inline.diff @@ -5,11 +5,11 @@ let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:+0:11: +0:11 let _1: (); // in scope 0 at $DIR/cycle.rs:+1:5: +1:9 + let mut _2: fn() {g}; // in scope 0 at $DIR/cycle.rs:+1:5: +1:9 ++ let mut _5: (); // in scope 0 at $DIR/cycle.rs:6:5: 6:8 + scope 1 (inlined f::) { // at $DIR/cycle.rs:17:5: 17:9 + debug g => _2; // in scope 1 at $DIR/cycle.rs:5:6: 5:7 + let _3: (); // in scope 1 at $DIR/cycle.rs:6:5: 6:8 + let mut _4: &fn() {g}; // in scope 1 at $DIR/cycle.rs:6:5: 6:6 -+ let mut _5: (); // in scope 1 at $DIR/cycle.rs:6:5: 6:8 + scope 2 (inlined >::call - shim(fn() {g})) { // at $DIR/cycle.rs:6:5: 6:8 + } + } @@ -25,14 +25,16 @@ - // mir::Constant // + span: $DIR/cycle.rs:17:7: 17:8 // + literal: Const { ty: fn() {g}, val: Value() } -+ StorageLive(_3); // scope 1 at $DIR/cycle.rs:6:5: 6:8 ++ StorageLive(_3); // scope 0 at $DIR/cycle.rs:+1:5: +1:9 + StorageLive(_4); // scope 1 at $DIR/cycle.rs:6:5: 6:6 + _4 = &_2; // scope 1 at $DIR/cycle.rs:6:5: 6:6 + StorageLive(_5); // scope 1 at $DIR/cycle.rs:6:5: 6:8 ++ _5 = const (); // scope 1 at $DIR/cycle.rs:6:5: 6:8 + _3 = move (*_4)() -> [return: bb4, unwind: bb2]; // scope 2 at $SRC_DIR/core/src/ops/function.rs:LL:COL } bb1: { ++ StorageDead(_3); // scope 0 at $DIR/cycle.rs:+1:5: +1:9 + StorageDead(_2); // scope 0 at $DIR/cycle.rs:+1:5: +1:9 StorageDead(_1); // scope 0 at $DIR/cycle.rs:+1:9: +1:10 _0 = const (); // scope 0 at $DIR/cycle.rs:+0:11: +2:2 @@ -40,7 +42,7 @@ + } + + bb2 (cleanup): { -+ drop(_2) -> bb3; // scope 1 at $DIR/cycle.rs:7:1: 7:2 ++ drop(_2) -> [return: bb3, unwind terminate]; // scope 1 at $DIR/cycle.rs:7:1: 7:2 + } + + bb3 (cleanup): { @@ -48,9 +50,8 @@ + } + + bb4: { -+ StorageDead(_5); // scope 1 at $DIR/cycle.rs:6:7: 6:8 ++ StorageDead(_5); // scope 1 at $DIR/cycle.rs:6:5: 6:8 + StorageDead(_4); // scope 1 at $DIR/cycle.rs:6:7: 6:8 -+ StorageDead(_3); // scope 1 at $DIR/cycle.rs:6:8: 6:9 + drop(_2) -> bb1; // scope 1 at $DIR/cycle.rs:7:1: 7:2 } } diff --git a/tests/mir-opt/inline/dyn_trait.get_query.Inline.diff b/tests/mir-opt/inline/dyn_trait.get_query.Inline.diff index 64c3e47ff..75d9bd54d 100644 --- a/tests/mir-opt/inline/dyn_trait.get_query.Inline.diff +++ b/tests/mir-opt/inline/dyn_trait.get_query.Inline.diff @@ -9,11 +9,11 @@ let mut _4: &::C; // in scope 0 at $DIR/dyn_trait.rs:+2:23: +2:24 scope 1 { debug c => _2; // in scope 1 at $DIR/dyn_trait.rs:+1:9: +1:10 -+ scope 2 (inlined try_execute_query::<::C>) { // at $DIR/dyn_trait.rs:34:5: 34:25 -+ debug c => _4; // in scope 2 at $DIR/dyn_trait.rs:26:36: 26:37 -+ let mut _5: &dyn Cache::V>; // in scope 2 at $DIR/dyn_trait.rs:27:14: 27:15 -+ scope 3 (inlined mk_cycle::<::V>) { // at $DIR/dyn_trait.rs:27:5: 27:16 -+ debug c => _5; // in scope 3 at $DIR/dyn_trait.rs:20:27: 20:28 ++ scope 2 (inlined try_execute_query::<::C>) { // at $DIR/dyn_trait.rs:35:5: 35:25 ++ debug c => _4; // in scope 2 at $DIR/dyn_trait.rs:27:36: 27:37 ++ let mut _5: &dyn Cache::V>; // in scope 2 at $DIR/dyn_trait.rs:28:14: 28:15 ++ scope 3 (inlined mk_cycle::<::V>) { // at $DIR/dyn_trait.rs:28:5: 28:16 ++ debug c => _5; // in scope 3 at $DIR/dyn_trait.rs:21:27: 21:28 + } + } } @@ -24,7 +24,7 @@ _3 = &(*_1); // scope 0 at $DIR/dyn_trait.rs:+1:22: +1:23 _2 = ::cache::(move _3) -> bb1; // scope 0 at $DIR/dyn_trait.rs:+1:13: +1:24 // mir::Constant - // + span: $DIR/dyn_trait.rs:33:13: 33:21 + // + span: $DIR/dyn_trait.rs:34:13: 34:21 // + user_ty: UserType(0) // + literal: Const { ty: for<'a> fn(&'a T) -> &'a ::C {::cache::}, val: Value() } } @@ -34,18 +34,18 @@ StorageLive(_4); // scope 1 at $DIR/dyn_trait.rs:+2:23: +2:24 _4 = &(*_2); // scope 1 at $DIR/dyn_trait.rs:+2:23: +2:24 - _0 = try_execute_query::<::C>(move _4) -> bb2; // scope 1 at $DIR/dyn_trait.rs:+2:5: +2:25 -+ StorageLive(_5); // scope 2 at $DIR/dyn_trait.rs:27:14: 27:15 -+ _5 = _4 as &dyn Cache::V> (Pointer(Unsize)); // scope 2 at $DIR/dyn_trait.rs:27:14: 27:15 -+ _0 = ::V> as Cache>::store_nocache(_5) -> bb2; // scope 3 at $DIR/dyn_trait.rs:21:5: 21:22 ++ StorageLive(_5); // scope 2 at $DIR/dyn_trait.rs:28:14: 28:15 ++ _5 = _4 as &dyn Cache::V> (Pointer(Unsize)); // scope 2 at $DIR/dyn_trait.rs:28:14: 28:15 ++ _0 = ::V> as Cache>::store_nocache(_5) -> bb2; // scope 3 at $DIR/dyn_trait.rs:22:5: 22:22 // mir::Constant -- // + span: $DIR/dyn_trait.rs:34:5: 34:22 +- // + span: $DIR/dyn_trait.rs:35:5: 35:22 - // + literal: Const { ty: for<'a> fn(&'a ::C) {try_execute_query::<::C>}, val: Value() } -+ // + span: $DIR/dyn_trait.rs:21:7: 21:20 ++ // + span: $DIR/dyn_trait.rs:22:7: 22:20 + // + literal: Const { ty: for<'a> fn(&'a dyn Cache::V>) {::V> as Cache>::store_nocache}, val: Value() } } bb2: { -+ StorageDead(_5); // scope 2 at $DIR/dyn_trait.rs:27:15: 27:16 ++ StorageDead(_5); // scope 2 at $DIR/dyn_trait.rs:28:15: 28:16 StorageDead(_4); // scope 1 at $DIR/dyn_trait.rs:+2:24: +2:25 StorageDead(_2); // scope 0 at $DIR/dyn_trait.rs:+3:1: +3:2 return; // scope 0 at $DIR/dyn_trait.rs:+3:2: +3:2 diff --git a/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.diff b/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.diff index 7653a5ded..925c95988 100644 --- a/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.diff +++ b/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.diff @@ -11,7 +11,7 @@ _2 = &(*_1); // scope 0 at $DIR/dyn_trait.rs:+1:5: +1:22 _0 = as Cache>::store_nocache(move _2) -> bb1; // scope 0 at $DIR/dyn_trait.rs:+1:5: +1:22 // mir::Constant - // + span: $DIR/dyn_trait.rs:21:7: 21:20 + // + span: $DIR/dyn_trait.rs:22:7: 22:20 // + literal: Const { ty: for<'a> fn(&'a dyn Cache) { as Cache>::store_nocache}, val: Value() } } diff --git a/tests/mir-opt/inline/dyn_trait.rs b/tests/mir-opt/inline/dyn_trait.rs index 6a46e1e07..2af81f825 100644 --- a/tests/mir-opt/inline/dyn_trait.rs +++ b/tests/mir-opt/inline/dyn_trait.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default #![crate_type = "lib"] use std::fmt::Debug; diff --git a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.diff b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.diff index 3fa9c3e88..f4e5272ab 100644 --- a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.diff +++ b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.diff @@ -6,8 +6,8 @@ let mut _0: (); // return place in scope 0 at $DIR/dyn_trait.rs:+0:43: +0:43 let mut _2: &dyn Cache::V>; // in scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15 let mut _3: &C; // in scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15 -+ scope 1 (inlined mk_cycle::<::V>) { // at $DIR/dyn_trait.rs:27:5: 27:16 -+ debug c => _2; // in scope 1 at $DIR/dyn_trait.rs:20:27: 20:28 ++ scope 1 (inlined mk_cycle::<::V>) { // at $DIR/dyn_trait.rs:28:5: 28:16 ++ debug c => _2; // in scope 1 at $DIR/dyn_trait.rs:21:27: 21:28 + } bb0: { @@ -17,11 +17,11 @@ _2 = move _3 as &dyn Cache::V> (Pointer(Unsize)); // scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15 StorageDead(_3); // scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15 - _0 = mk_cycle::<::V>(move _2) -> bb1; // scope 0 at $DIR/dyn_trait.rs:+1:5: +1:16 -+ _0 = ::V> as Cache>::store_nocache(_2) -> bb1; // scope 1 at $DIR/dyn_trait.rs:21:5: 21:22 ++ _0 = ::V> as Cache>::store_nocache(_2) -> bb1; // scope 1 at $DIR/dyn_trait.rs:22:5: 22:22 // mir::Constant -- // + span: $DIR/dyn_trait.rs:27:5: 27:13 +- // + span: $DIR/dyn_trait.rs:28:5: 28:13 - // + literal: Const { ty: for<'a> fn(&'a (dyn Cache::V> + 'a)) {mk_cycle::<::V>}, val: Value() } -+ // + span: $DIR/dyn_trait.rs:21:7: 21:20 ++ // + span: $DIR/dyn_trait.rs:22:7: 22:20 + // + literal: Const { ty: for<'a> fn(&'a dyn Cache::V>) {::V> as Cache>::store_nocache}, val: Value() } } diff --git a/tests/mir-opt/inline/exponential_runtime.main.Inline.diff b/tests/mir-opt/inline/exponential_runtime.main.Inline.diff index 7fd62be7a..30af8661d 100644 --- a/tests/mir-opt/inline/exponential_runtime.main.Inline.diff +++ b/tests/mir-opt/inline/exponential_runtime.main.Inline.diff @@ -4,72 +4,72 @@ fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/exponential_runtime.rs:+0:11: +0:11 let _1: (); // in scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22 -+ scope 1 (inlined <() as G>::call) { // at $DIR/exponential_runtime.rs:86:5: 86:22 -+ let _2: (); // in scope 1 at $DIR/exponential_runtime.rs:73:9: 73:25 -+ let _3: (); // in scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25 -+ let _4: (); // in scope 1 at $DIR/exponential_runtime.rs:75:9: 75:25 -+ scope 2 (inlined <() as F>::call) { // at $DIR/exponential_runtime.rs:73:9: 73:25 -+ let _5: (); // in scope 2 at $DIR/exponential_runtime.rs:61:9: 61:25 -+ let _6: (); // in scope 2 at $DIR/exponential_runtime.rs:62:9: 62:25 -+ let _7: (); // in scope 2 at $DIR/exponential_runtime.rs:63:9: 63:25 ++ scope 1 (inlined <() as G>::call) { // at $DIR/exponential_runtime.rs:87:5: 87:22 ++ let _2: (); // in scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25 ++ let _3: (); // in scope 1 at $DIR/exponential_runtime.rs:75:9: 75:25 ++ let _4: (); // in scope 1 at $DIR/exponential_runtime.rs:76:9: 76:25 ++ scope 2 (inlined <() as F>::call) { // at $DIR/exponential_runtime.rs:74:9: 74:25 ++ let _5: (); // in scope 2 at $DIR/exponential_runtime.rs:62:9: 62:25 ++ let _6: (); // in scope 2 at $DIR/exponential_runtime.rs:63:9: 63:25 ++ let _7: (); // in scope 2 at $DIR/exponential_runtime.rs:64:9: 64:25 + } + } bb0: { StorageLive(_1); // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22 - _1 = <() as G>::call() -> bb1; // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22 -+ StorageLive(_2); // scope 1 at $DIR/exponential_runtime.rs:73:9: 73:25 -+ StorageLive(_5); // scope 2 at $DIR/exponential_runtime.rs:61:9: 61:25 -+ _5 = <() as E>::call() -> bb3; // scope 2 at $DIR/exponential_runtime.rs:61:9: 61:25 ++ StorageLive(_2); // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22 ++ StorageLive(_3); // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22 ++ StorageLive(_4); // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22 ++ StorageLive(_5); // scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25 ++ StorageLive(_6); // scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25 ++ StorageLive(_7); // scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25 ++ _5 = <() as E>::call() -> bb4; // scope 2 at $DIR/exponential_runtime.rs:62:9: 62:25 // mir::Constant -- // + span: $DIR/exponential_runtime.rs:86:5: 86:20 +- // + span: $DIR/exponential_runtime.rs:87:5: 87:20 - // + literal: Const { ty: fn() {<() as G>::call}, val: Value() } -+ // + span: $DIR/exponential_runtime.rs:61:9: 61:23 ++ // + span: $DIR/exponential_runtime.rs:62:9: 62:23 + // + literal: Const { ty: fn() {<() as E>::call}, val: Value() } } bb1: { -+ StorageDead(_3); // scope 1 at $DIR/exponential_runtime.rs:74:25: 74:26 -+ StorageLive(_4); // scope 1 at $DIR/exponential_runtime.rs:75:9: 75:25 -+ _4 = <() as F>::call() -> bb2; // scope 1 at $DIR/exponential_runtime.rs:75:9: 75:25 -+ // mir::Constant -+ // + span: $DIR/exponential_runtime.rs:75:9: 75:23 -+ // + literal: Const { ty: fn() {<() as F>::call}, val: Value() } -+ } -+ -+ bb2: { -+ StorageDead(_4); // scope 1 at $DIR/exponential_runtime.rs:75:25: 75:26 ++ StorageDead(_4); // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22 ++ StorageDead(_3); // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22 ++ StorageDead(_2); // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22 StorageDead(_1); // scope 0 at $DIR/exponential_runtime.rs:+1:22: +1:23 _0 = const (); // scope 0 at $DIR/exponential_runtime.rs:+0:11: +2:2 return; // scope 0 at $DIR/exponential_runtime.rs:+2:2: +2:2 + } + ++ bb2: { ++ StorageDead(_7); // scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25 ++ StorageDead(_6); // scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25 ++ StorageDead(_5); // scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25 ++ _3 = <() as F>::call() -> bb3; // scope 1 at $DIR/exponential_runtime.rs:75:9: 75:25 ++ // mir::Constant ++ // + span: $DIR/exponential_runtime.rs:75:9: 75:23 ++ // + literal: Const { ty: fn() {<() as F>::call}, val: Value() } ++ } ++ + bb3: { -+ StorageDead(_5); // scope 2 at $DIR/exponential_runtime.rs:61:25: 61:26 -+ StorageLive(_6); // scope 2 at $DIR/exponential_runtime.rs:62:9: 62:25 -+ _6 = <() as E>::call() -> bb4; // scope 2 at $DIR/exponential_runtime.rs:62:9: 62:25 ++ _4 = <() as F>::call() -> bb1; // scope 1 at $DIR/exponential_runtime.rs:76:9: 76:25 + // mir::Constant -+ // + span: $DIR/exponential_runtime.rs:62:9: 62:23 -+ // + literal: Const { ty: fn() {<() as E>::call}, val: Value() } ++ // + span: $DIR/exponential_runtime.rs:76:9: 76:23 ++ // + literal: Const { ty: fn() {<() as F>::call}, val: Value() } + } + + bb4: { -+ StorageDead(_6); // scope 2 at $DIR/exponential_runtime.rs:62:25: 62:26 -+ StorageLive(_7); // scope 2 at $DIR/exponential_runtime.rs:63:9: 63:25 -+ _7 = <() as E>::call() -> bb5; // scope 2 at $DIR/exponential_runtime.rs:63:9: 63:25 ++ _6 = <() as E>::call() -> bb5; // scope 2 at $DIR/exponential_runtime.rs:63:9: 63:25 + // mir::Constant + // + span: $DIR/exponential_runtime.rs:63:9: 63:23 + // + literal: Const { ty: fn() {<() as E>::call}, val: Value() } + } + + bb5: { -+ StorageDead(_7); // scope 2 at $DIR/exponential_runtime.rs:63:25: 63:26 -+ StorageDead(_2); // scope 1 at $DIR/exponential_runtime.rs:73:25: 73:26 -+ StorageLive(_3); // scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25 -+ _3 = <() as F>::call() -> bb1; // scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25 ++ _7 = <() as E>::call() -> bb2; // scope 2 at $DIR/exponential_runtime.rs:64:9: 64:25 + // mir::Constant -+ // + span: $DIR/exponential_runtime.rs:74:9: 74:23 -+ // + literal: Const { ty: fn() {<() as F>::call}, val: Value() } ++ // + span: $DIR/exponential_runtime.rs:64:9: 64:23 ++ // + literal: Const { ty: fn() {<() as E>::call}, val: Value() } } } diff --git a/tests/mir-opt/inline/exponential_runtime.rs b/tests/mir-opt/inline/exponential_runtime.rs index d9219d76a..39985528f 100644 --- a/tests/mir-opt/inline/exponential_runtime.rs +++ b/tests/mir-opt/inline/exponential_runtime.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // Checks that code with exponential runtime does not have exponential behavior in inlining. trait A { diff --git a/tests/mir-opt/inline/inline_closure.foo.Inline.after.mir b/tests/mir-opt/inline/inline_closure.foo.Inline.after.mir index fff8d0171..1d2f99cbe 100644 --- a/tests/mir-opt/inline/inline_closure.foo.Inline.after.mir +++ b/tests/mir-opt/inline/inline_closure.foo.Inline.after.mir @@ -23,7 +23,7 @@ fn foo(_1: T, _2: i32) -> i32 { StorageLive(_3); // scope 0 at $DIR/inline_closure.rs:+1:9: +1:10 _3 = [closure@foo::::{closure#0}]; // scope 0 at $DIR/inline_closure.rs:+1:13: +1:24 // closure - // + def_id: DefId(0:6 ~ inline_closure[92ba]::foo::{closure#0}) + // + def_id: DefId(0:6 ~ inline_closure[8f32]::foo::{closure#0}) // + substs: [ // T, // i8, diff --git a/tests/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir b/tests/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir index dab204306..80274bb7e 100644 --- a/tests/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir +++ b/tests/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir @@ -26,7 +26,7 @@ fn foo(_1: T, _2: &i32) -> i32 { StorageLive(_3); // scope 0 at $DIR/inline_closure_borrows_arg.rs:+1:9: +1:10 _3 = [closure@foo::::{closure#0}]; // scope 0 at $DIR/inline_closure_borrows_arg.rs:+1:13: +4:6 // closure - // + def_id: DefId(0:6 ~ inline_closure_borrows_arg[96e9]::foo::{closure#0}) + // + def_id: DefId(0:6 ~ inline_closure_borrows_arg[f89f]::foo::{closure#0}) // + substs: [ // T, // i8, diff --git a/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir b/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir index 84fd051e0..b36711f82 100644 --- a/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir +++ b/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir @@ -32,7 +32,7 @@ fn foo(_1: T, _2: i32) -> (i32, T) { _5 = &_1; // scope 0 at $DIR/inline_closure_captures.rs:+1:13: +1:24 _3 = [closure@foo::::{closure#0}] { q: move _4, t: move _5 }; // scope 0 at $DIR/inline_closure_captures.rs:+1:13: +1:24 // closure - // + def_id: DefId(0:6 ~ inline_closure_captures[8bc0]::foo::{closure#0}) + // + def_id: DefId(0:6 ~ inline_closure_captures[63a5]::foo::{closure#0}) // + substs: [ // T, // i8, diff --git a/tests/mir-opt/inline/inline_cycle.one.Inline.diff b/tests/mir-opt/inline/inline_cycle.one.Inline.diff index 5510cd7bc..f6ba69a1d 100644 --- a/tests/mir-opt/inline/inline_cycle.one.Inline.diff +++ b/tests/mir-opt/inline/inline_cycle.one.Inline.diff @@ -4,9 +4,9 @@ fn one() -> () { let mut _0: (); // return place in scope 0 at $DIR/inline_cycle.rs:+0:10: +0:10 let _1: (); // in scope 0 at $DIR/inline_cycle.rs:+1:5: +1:24 -+ scope 1 (inlined ::call) { // at $DIR/inline_cycle.rs:14:5: 14:24 -+ scope 2 (inlined as Call>::call) { // at $DIR/inline_cycle.rs:43:9: 43:23 -+ scope 3 (inlined as Call>::call) { // at $DIR/inline_cycle.rs:28:9: 28:31 ++ scope 1 (inlined ::call) { // at $DIR/inline_cycle.rs:15:5: 15:24 ++ scope 2 (inlined as Call>::call) { // at $DIR/inline_cycle.rs:44:9: 44:23 ++ scope 3 (inlined as Call>::call) { // at $DIR/inline_cycle.rs:29:9: 29:31 + } + } + } @@ -14,10 +14,10 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:24 - _1 = ::call() -> bb1; // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:24 -+ _1 = ::call() -> bb1; // scope 3 at $DIR/inline_cycle.rs:36:9: 36:28 ++ _1 = ::call() -> bb1; // scope 3 at $DIR/inline_cycle.rs:37:9: 37:28 // mir::Constant -- // + span: $DIR/inline_cycle.rs:14:5: 14:22 -+ // + span: $DIR/inline_cycle.rs:36:9: 36:26 +- // + span: $DIR/inline_cycle.rs:15:5: 15:22 ++ // + span: $DIR/inline_cycle.rs:37:9: 37:26 // + literal: Const { ty: fn() {::call}, val: Value() } } diff --git a/tests/mir-opt/inline/inline_cycle.rs b/tests/mir-opt/inline/inline_cycle.rs index 63ad57de1..2f81696cf 100644 --- a/tests/mir-opt/inline/inline_cycle.rs +++ b/tests/mir-opt/inline/inline_cycle.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // Check that inliner handles various forms of recursion and doesn't fall into // an infinite inlining cycle. The particular outcome of inlining is not // crucial otherwise. diff --git a/tests/mir-opt/inline/inline_cycle.two.Inline.diff b/tests/mir-opt/inline/inline_cycle.two.Inline.diff index 64c0065b5..c8f58111d 100644 --- a/tests/mir-opt/inline/inline_cycle.two.Inline.diff +++ b/tests/mir-opt/inline/inline_cycle.two.Inline.diff @@ -5,11 +5,11 @@ let mut _0: (); // return place in scope 0 at $DIR/inline_cycle.rs:+0:10: +0:10 let _1: (); // in scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12 + let mut _2: fn() {f}; // in scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12 -+ scope 1 (inlined call::) { // at $DIR/inline_cycle.rs:49:5: 49:12 -+ debug f => _2; // in scope 1 at $DIR/inline_cycle.rs:53:22: 53:23 -+ let _3: (); // in scope 1 at $DIR/inline_cycle.rs:54:5: 54:8 -+ let mut _4: (); // in scope 1 at $DIR/inline_cycle.rs:54:5: 54:8 -+ scope 2 (inlined >::call_once - shim(fn() {f})) { // at $DIR/inline_cycle.rs:54:5: 54:8 ++ let mut _4: (); // in scope 0 at $DIR/inline_cycle.rs:55:5: 55:8 ++ scope 1 (inlined call::) { // at $DIR/inline_cycle.rs:50:5: 50:12 ++ debug f => _2; // in scope 1 at $DIR/inline_cycle.rs:54:22: 54:23 ++ let _3: (); // in scope 1 at $DIR/inline_cycle.rs:55:5: 55:8 ++ scope 2 (inlined >::call_once - shim(fn() {f})) { // at $DIR/inline_cycle.rs:55:5: 55:8 + } + } @@ -19,19 +19,20 @@ + StorageLive(_2); // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12 + _2 = f; // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12 // mir::Constant -- // + span: $DIR/inline_cycle.rs:49:5: 49:9 +- // + span: $DIR/inline_cycle.rs:50:5: 50:9 - // + literal: Const { ty: fn(fn() {f}) {call::}, val: Value() } - // mir::Constant - // + span: $DIR/inline_cycle.rs:49:10: 49:11 + // + span: $DIR/inline_cycle.rs:50:10: 50:11 // + literal: Const { ty: fn() {f}, val: Value() } -+ StorageLive(_3); // scope 1 at $DIR/inline_cycle.rs:54:5: 54:8 -+ StorageLive(_4); // scope 1 at $DIR/inline_cycle.rs:54:5: 54:8 ++ StorageLive(_3); // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12 ++ StorageLive(_4); // scope 1 at $DIR/inline_cycle.rs:55:5: 55:8 ++ _4 = const (); // scope 1 at $DIR/inline_cycle.rs:55:5: 55:8 + _3 = move _2() -> bb1; // scope 2 at $SRC_DIR/core/src/ops/function.rs:LL:COL } bb1: { -+ StorageDead(_4); // scope 1 at $DIR/inline_cycle.rs:54:7: 54:8 -+ StorageDead(_3); // scope 1 at $DIR/inline_cycle.rs:54:8: 54:9 ++ StorageDead(_4); // scope 1 at $DIR/inline_cycle.rs:55:5: 55:8 ++ StorageDead(_3); // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12 + StorageDead(_2); // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12 StorageDead(_1); // scope 0 at $DIR/inline_cycle.rs:+1:12: +1:13 _0 = const (); // scope 0 at $DIR/inline_cycle.rs:+0:10: +2:2 diff --git a/tests/mir-opt/inline/inline_cycle_generic.main.Inline.diff b/tests/mir-opt/inline/inline_cycle_generic.main.Inline.diff index 52debab4d..9429ca593 100644 --- a/tests/mir-opt/inline/inline_cycle_generic.main.Inline.diff +++ b/tests/mir-opt/inline/inline_cycle_generic.main.Inline.diff @@ -4,23 +4,20 @@ fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/inline_cycle_generic.rs:+0:11: +0:11 let _1: (); // in scope 0 at $DIR/inline_cycle_generic.rs:+1:5: +1:24 -+ scope 1 (inlined ::call) { // at $DIR/inline_cycle_generic.rs:9:5: 9:24 -+ scope 2 (inlined as Call>::call) { // at $DIR/inline_cycle_generic.rs:38:9: 38:31 -+ scope 3 (inlined ::call) { // at $DIR/inline_cycle_generic.rs:31:9: 31:28 -+ scope 4 (inlined as Call>::call) { // at $DIR/inline_cycle_generic.rs:23:9: 23:31 -+ } -+ } ++ scope 1 (inlined ::call) { // at $DIR/inline_cycle_generic.rs:10:5: 10:24 ++ scope 2 (inlined as Call>::call) { // at $DIR/inline_cycle_generic.rs:39:9: 39:31 + } + } bb0: { StorageLive(_1); // scope 0 at $DIR/inline_cycle_generic.rs:+1:5: +1:24 - _1 = ::call() -> bb1; // scope 0 at $DIR/inline_cycle_generic.rs:+1:5: +1:24 -+ _1 = ::call() -> bb1; // scope 4 at $DIR/inline_cycle_generic.rs:31:9: 31:28 ++ _1 = ::call() -> bb1; // scope 2 at $DIR/inline_cycle_generic.rs:32:9: 32:28 // mir::Constant -- // + span: $DIR/inline_cycle_generic.rs:9:5: 9:22 -+ // + span: $DIR/inline_cycle_generic.rs:31:9: 31:26 - // + literal: Const { ty: fn() {::call}, val: Value() } +- // + span: $DIR/inline_cycle_generic.rs:10:5: 10:22 +- // + literal: Const { ty: fn() {::call}, val: Value() } ++ // + span: $DIR/inline_cycle_generic.rs:32:9: 32:26 ++ // + literal: Const { ty: fn() {::call}, val: Value() } } bb1: { diff --git a/tests/mir-opt/inline/inline_cycle_generic.rs b/tests/mir-opt/inline/inline_cycle_generic.rs index 24b4f3793..84e6e4005 100644 --- a/tests/mir-opt/inline/inline_cycle_generic.rs +++ b/tests/mir-opt/inline/inline_cycle_generic.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // Check that inliner handles various forms of recursion and doesn't fall into // an infinite inlining cycle. The particular outcome of inlining is not // crucial otherwise. diff --git a/tests/mir-opt/inline/inline_diverging.g.Inline.diff b/tests/mir-opt/inline/inline_diverging.g.Inline.diff index b787a19f4..4f22ad437 100644 --- a/tests/mir-opt/inline/inline_diverging.g.Inline.diff +++ b/tests/mir-opt/inline/inline_diverging.g.Inline.diff @@ -34,7 +34,7 @@ bb2: { StorageLive(_6); // scope 0 at $DIR/inline_diverging.rs:+4:9: +4:16 - _6 = panic(); // scope 0 at $DIR/inline_diverging.rs:+4:9: +4:16 -+ StorageLive(_7); // scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL ++ StorageLive(_7); // scope 0 at $DIR/inline_diverging.rs:+4:9: +4:16 + _7 = begin_panic::<&str>(const "explicit panic"); // scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL // mir::Constant - // + span: $DIR/inline_diverging.rs:16:9: 16:14 diff --git a/tests/mir-opt/inline/inline_diverging.h.Inline.diff b/tests/mir-opt/inline/inline_diverging.h.Inline.diff index e1b2f7dbf..d501b6ca8 100644 --- a/tests/mir-opt/inline/inline_diverging.h.Inline.diff +++ b/tests/mir-opt/inline/inline_diverging.h.Inline.diff @@ -5,19 +5,18 @@ let mut _0: (); // return place in scope 0 at $DIR/inline_diverging.rs:+0:12: +0:12 let _1: (!, !); // in scope 0 at $DIR/inline_diverging.rs:+1:5: +1:22 + let mut _2: fn() -> ! {sleep}; // in scope 0 at $DIR/inline_diverging.rs:+1:5: +1:22 ++ let mut _8: (); // in scope 0 at $DIR/inline_diverging.rs:27:13: 27:16 + scope 1 (inlined call_twice:: ! {sleep}>) { // at $DIR/inline_diverging.rs:22:5: 22:22 + debug f => _2; // in scope 1 at $DIR/inline_diverging.rs:26:36: 26:37 + let _3: !; // in scope 1 at $DIR/inline_diverging.rs:27:9: 27:10 + let mut _4: &fn() -> ! {sleep}; // in scope 1 at $DIR/inline_diverging.rs:27:13: 27:14 -+ let mut _5: (); // in scope 1 at $DIR/inline_diverging.rs:27:13: 27:16 -+ let mut _6: &fn() -> ! {sleep}; // in scope 1 at $DIR/inline_diverging.rs:28:13: 28:14 -+ let mut _7: (); // in scope 1 at $DIR/inline_diverging.rs:28:13: 28:16 -+ let mut _8: !; // in scope 1 at $DIR/inline_diverging.rs:29:6: 29:7 -+ let mut _9: !; // in scope 1 at $DIR/inline_diverging.rs:29:9: 29:10 ++ let mut _5: &fn() -> ! {sleep}; // in scope 1 at $DIR/inline_diverging.rs:28:13: 28:14 ++ let mut _6: !; // in scope 1 at $DIR/inline_diverging.rs:29:6: 29:7 ++ let mut _7: !; // in scope 1 at $DIR/inline_diverging.rs:29:9: 29:10 + scope 2 { + debug a => _3; // in scope 2 at $DIR/inline_diverging.rs:27:9: 27:10 + scope 3 { -+ debug b => _9; // in scope 3 at $DIR/inline_diverging.rs:28:9: 28:10 ++ debug b => _7; // in scope 3 at $DIR/inline_diverging.rs:28:9: 28:10 + } + } + scope 4 (inlined ! {sleep} as Fn<()>>::call - shim(fn() -> ! {sleep})) { // at $DIR/inline_diverging.rs:27:13: 27:16 @@ -35,21 +34,21 @@ - // mir::Constant // + span: $DIR/inline_diverging.rs:22:16: 22:21 // + literal: Const { ty: fn() -> ! {sleep}, val: Value() } -+ StorageLive(_9); // scope 0 at $DIR/inline_diverging.rs:+1:5: +1:22 ++ StorageLive(_7); // scope 0 at $DIR/inline_diverging.rs:+1:5: +1:22 + StorageLive(_3); // scope 1 at $DIR/inline_diverging.rs:27:9: 27:10 + StorageLive(_4); // scope 1 at $DIR/inline_diverging.rs:27:13: 27:14 + _4 = &_2; // scope 1 at $DIR/inline_diverging.rs:27:13: 27:14 -+ StorageLive(_5); // scope 1 at $DIR/inline_diverging.rs:27:13: 27:16 ++ StorageLive(_8); // scope 1 at $DIR/inline_diverging.rs:27:13: 27:16 ++ _8 = const (); // scope 1 at $DIR/inline_diverging.rs:27:13: 27:16 + _3 = move (*_4)() -> [return: bb6, unwind: bb4]; // scope 4 at $SRC_DIR/core/src/ops/function.rs:LL:COL + } + + bb1: { -+ StorageDead(_7); // scope 2 at $DIR/inline_diverging.rs:28:15: 28:16 -+ StorageDead(_6); // scope 2 at $DIR/inline_diverging.rs:28:15: 28:16 -+ StorageLive(_8); // scope 3 at $DIR/inline_diverging.rs:29:6: 29:7 -+ _8 = move _3; // scope 3 at $DIR/inline_diverging.rs:29:6: 29:7 -+ _1 = (move _8, move _9); // scope 3 at $DIR/inline_diverging.rs:29:5: 29:11 -+ StorageDead(_8); // scope 3 at $DIR/inline_diverging.rs:29:10: 29:11 ++ StorageDead(_5); // scope 2 at $DIR/inline_diverging.rs:28:15: 28:16 ++ StorageLive(_6); // scope 3 at $DIR/inline_diverging.rs:29:6: 29:7 ++ _6 = move _3; // scope 3 at $DIR/inline_diverging.rs:29:6: 29:7 ++ _1 = (move _6, move _7); // scope 3 at $DIR/inline_diverging.rs:29:5: 29:11 ++ StorageDead(_6); // scope 3 at $DIR/inline_diverging.rs:29:10: 29:11 + StorageDead(_3); // scope 1 at $DIR/inline_diverging.rs:30:1: 30:2 + drop(_2) -> bb2; // scope 1 at $DIR/inline_diverging.rs:30:1: 30:2 + } @@ -59,11 +58,11 @@ + } + + bb3 (cleanup): { -+ drop(_3) -> bb4; // scope 1 at $DIR/inline_diverging.rs:30:1: 30:2 ++ drop(_3) -> [return: bb4, unwind terminate]; // scope 1 at $DIR/inline_diverging.rs:30:1: 30:2 + } + + bb4 (cleanup): { -+ drop(_2) -> bb5; // scope 1 at $DIR/inline_diverging.rs:30:1: 30:2 ++ drop(_2) -> [return: bb5, unwind terminate]; // scope 1 at $DIR/inline_diverging.rs:30:1: 30:2 + } + + bb5 (cleanup): { @@ -71,12 +70,11 @@ + } + + bb6: { -+ StorageDead(_5); // scope 1 at $DIR/inline_diverging.rs:27:15: 27:16 ++ StorageDead(_8); // scope 1 at $DIR/inline_diverging.rs:27:13: 27:16 + StorageDead(_4); // scope 1 at $DIR/inline_diverging.rs:27:15: 27:16 -+ StorageLive(_6); // scope 2 at $DIR/inline_diverging.rs:28:13: 28:14 -+ _6 = &_2; // scope 2 at $DIR/inline_diverging.rs:28:13: 28:14 -+ StorageLive(_7); // scope 2 at $DIR/inline_diverging.rs:28:13: 28:16 -+ _9 = ! {sleep} as Fn<()>>::call(move _6, move _7) -> [return: bb1, unwind: bb3]; // scope 2 at $DIR/inline_diverging.rs:28:13: 28:16 ++ StorageLive(_5); // scope 2 at $DIR/inline_diverging.rs:28:13: 28:14 ++ _5 = &_2; // scope 2 at $DIR/inline_diverging.rs:28:13: 28:14 ++ _7 = ! {sleep} as Fn<()>>::call(move _5, const ()) -> [return: bb1, unwind: bb3]; // scope 2 at $DIR/inline_diverging.rs:28:13: 28:16 + // mir::Constant + // + span: $DIR/inline_diverging.rs:28:13: 28:14 + // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a fn() -> ! {sleep}, ()) -> ! {sleep} as FnOnce<()>>::Output { ! {sleep} as Fn<()>>::call}, val: Value() } diff --git a/tests/mir-opt/inline/inline_generator.main.Inline.diff b/tests/mir-opt/inline/inline_generator.main.Inline.diff index 01f5052b6..c3ca2d7d4 100644 --- a/tests/mir-opt/inline/inline_generator.main.Inline.diff +++ b/tests/mir-opt/inline/inline_generator.main.Inline.diff @@ -44,7 +44,7 @@ - bb1: { + _4 = [generator@$DIR/inline_generator.rs:15:5: 15:8 (#0)]; // scope 2 at $DIR/inline_generator.rs:15:5: 15:41 + // generator -+ // + def_id: DefId(0:7 ~ inline_generator[ea31]::g::{closure#0}) ++ // + def_id: DefId(0:7 ~ inline_generator[e37e]::g::{closure#0}) + // + substs: [ + // bool, + // i32, diff --git a/tests/mir-opt/inline/inline_instruction_set.default.Inline.diff b/tests/mir-opt/inline/inline_instruction_set.default.Inline.diff index f1988ea4b..a1d2423ae 100644 --- a/tests/mir-opt/inline/inline_instruction_set.default.Inline.diff +++ b/tests/mir-opt/inline/inline_instruction_set.default.Inline.diff @@ -16,7 +16,7 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/inline_instruction_set.rs:+1:5: +1:26 - _1 = instruction_set_a32() -> bb1; // scope 0 at $DIR/inline_instruction_set.rs:+1:5: +1:26 + _1 = instruction_set_a32() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/inline_instruction_set.rs:+1:5: +1:26 // mir::Constant // + span: $DIR/inline_instruction_set.rs:57:5: 57:24 // + literal: Const { ty: fn() {instruction_set_a32}, val: Value() } @@ -25,7 +25,7 @@ bb1: { StorageDead(_1); // scope 0 at $DIR/inline_instruction_set.rs:+1:26: +1:27 StorageLive(_2); // scope 0 at $DIR/inline_instruction_set.rs:+2:5: +2:26 - _2 = instruction_set_t32() -> bb2; // scope 0 at $DIR/inline_instruction_set.rs:+2:5: +2:26 + _2 = instruction_set_t32() -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/inline_instruction_set.rs:+2:5: +2:26 // mir::Constant // + span: $DIR/inline_instruction_set.rs:58:5: 58:24 // + literal: Const { ty: fn() {instruction_set_t32}, val: Value() } @@ -34,7 +34,7 @@ bb2: { StorageDead(_2); // scope 0 at $DIR/inline_instruction_set.rs:+2:26: +2:27 StorageLive(_3); // scope 0 at $DIR/inline_instruction_set.rs:+3:5: +3:30 -- _3 = instruction_set_default() -> bb3; // scope 0 at $DIR/inline_instruction_set.rs:+3:5: +3:30 +- _3 = instruction_set_default() -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/inline_instruction_set.rs:+3:5: +3:30 - // mir::Constant - // + span: $DIR/inline_instruction_set.rs:59:5: 59:28 - // + literal: Const { ty: fn() {instruction_set_default}, val: Value() } @@ -43,11 +43,11 @@ - bb3: { StorageDead(_3); // scope 0 at $DIR/inline_instruction_set.rs:+3:30: +3:31 StorageLive(_4); // scope 0 at $DIR/inline_instruction_set.rs:+4:5: +4:41 -- _4 = inline_always_and_using_inline_asm() -> bb4; // scope 0 at $DIR/inline_instruction_set.rs:+4:5: +4:41 +- _4 = inline_always_and_using_inline_asm() -> [return: bb4, unwind unreachable]; // scope 0 at $DIR/inline_instruction_set.rs:+4:5: +4:41 - // mir::Constant - // + span: $DIR/inline_instruction_set.rs:60:5: 60:39 - // + literal: Const { ty: fn() {inline_always_and_using_inline_asm}, val: Value() } -+ asm!("/* do nothing */", options((empty))) -> bb3; // scope 3 at $DIR/inline_instruction_set.rs:43:14: 43:38 ++ asm!("/* do nothing */", options((empty))) -> [return: bb3, unwind unreachable]; // scope 3 at $DIR/inline_instruction_set.rs:43:14: 43:38 } - bb4: { diff --git a/tests/mir-opt/inline/inline_instruction_set.t32.Inline.diff b/tests/mir-opt/inline/inline_instruction_set.t32.Inline.diff index e777b2cc2..36aec4f47 100644 --- a/tests/mir-opt/inline/inline_instruction_set.t32.Inline.diff +++ b/tests/mir-opt/inline/inline_instruction_set.t32.Inline.diff @@ -14,7 +14,7 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/inline_instruction_set.rs:+1:5: +1:26 - _1 = instruction_set_a32() -> bb1; // scope 0 at $DIR/inline_instruction_set.rs:+1:5: +1:26 + _1 = instruction_set_a32() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/inline_instruction_set.rs:+1:5: +1:26 // mir::Constant // + span: $DIR/inline_instruction_set.rs:49:5: 49:24 // + literal: Const { ty: fn() {instruction_set_a32}, val: Value() } @@ -23,7 +23,7 @@ bb1: { StorageDead(_1); // scope 0 at $DIR/inline_instruction_set.rs:+1:26: +1:27 StorageLive(_2); // scope 0 at $DIR/inline_instruction_set.rs:+2:5: +2:26 -- _2 = instruction_set_t32() -> bb2; // scope 0 at $DIR/inline_instruction_set.rs:+2:5: +2:26 +- _2 = instruction_set_t32() -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/inline_instruction_set.rs:+2:5: +2:26 - // mir::Constant - // + span: $DIR/inline_instruction_set.rs:50:5: 50:24 - // + literal: Const { ty: fn() {instruction_set_t32}, val: Value() } @@ -32,7 +32,7 @@ - bb2: { StorageDead(_2); // scope 0 at $DIR/inline_instruction_set.rs:+2:26: +2:27 StorageLive(_3); // scope 0 at $DIR/inline_instruction_set.rs:+3:5: +3:30 -- _3 = instruction_set_default() -> bb3; // scope 0 at $DIR/inline_instruction_set.rs:+3:5: +3:30 +- _3 = instruction_set_default() -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/inline_instruction_set.rs:+3:5: +3:30 - // mir::Constant - // + span: $DIR/inline_instruction_set.rs:51:5: 51:28 - // + literal: Const { ty: fn() {instruction_set_default}, val: Value() } @@ -41,8 +41,8 @@ - bb3: { StorageDead(_3); // scope 0 at $DIR/inline_instruction_set.rs:+3:30: +3:31 StorageLive(_4); // scope 0 at $DIR/inline_instruction_set.rs:+4:5: +4:41 -- _4 = inline_always_and_using_inline_asm() -> bb4; // scope 0 at $DIR/inline_instruction_set.rs:+4:5: +4:41 -+ _4 = inline_always_and_using_inline_asm() -> bb2; // scope 0 at $DIR/inline_instruction_set.rs:+4:5: +4:41 +- _4 = inline_always_and_using_inline_asm() -> [return: bb4, unwind unreachable]; // scope 0 at $DIR/inline_instruction_set.rs:+4:5: +4:41 ++ _4 = inline_always_and_using_inline_asm() -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/inline_instruction_set.rs:+4:5: +4:41 // mir::Constant // + span: $DIR/inline_instruction_set.rs:52:5: 52:39 // + literal: Const { ty: fn() {inline_always_and_using_inline_asm}, val: Value() } diff --git a/tests/mir-opt/inline/inline_into_box_place.main.Inline.diff b/tests/mir-opt/inline/inline_into_box_place.main.Inline.diff index a1cbf0d3e..a5129e0e8 100644 --- a/tests/mir-opt/inline/inline_into_box_place.main.Inline.diff +++ b/tests/mir-opt/inline/inline_into_box_place.main.Inline.diff @@ -4,81 +4,78 @@ fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/inline_into_box_place.rs:+0:11: +0:11 let _1: std::boxed::Box>; // in scope 0 at $DIR/inline_into_box_place.rs:+1:9: +1:11 - let mut _2: usize; // in scope 0 at $DIR/inline_into_box_place.rs:+1:29: +1:43 - let mut _3: usize; // in scope 0 at $DIR/inline_into_box_place.rs:+1:29: +1:43 - let mut _4: *mut u8; // in scope 0 at $DIR/inline_into_box_place.rs:+1:29: +1:43 - let mut _5: std::boxed::Box>; // in scope 0 at $DIR/inline_into_box_place.rs:+1:29: +1:43 - let mut _6: (); // in scope 0 at $DIR/inline_into_box_place.rs:+1:42: +1:43 - let mut _7: *const std::vec::Vec; // in scope 0 at $DIR/inline_into_box_place.rs:+1:29: +1:43 -+ let mut _8: &mut std::vec::Vec; // in scope 0 at $DIR/inline_into_box_place.rs:+1:33: +1:43 -+ let mut _9: std::vec::Vec; // in scope 0 at $DIR/inline_into_box_place.rs:+1:33: +1:43 + let mut _2: std::vec::Vec; // in scope 0 at $DIR/inline_into_box_place.rs:+1:38: +1:48 scope 1 { debug _x => _1; // in scope 1 at $DIR/inline_into_box_place.rs:+1:9: +1:11 } - scope 2 { - } -+ scope 3 (inlined Vec::::new) { // at $DIR/inline_into_box_place.rs:8:33: 8:43 -+ let mut _10: alloc::raw_vec::RawVec; // in scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ++ scope 2 (inlined Vec::::new) { // at $DIR/inline_into_box_place.rs:8:38: 8:48 ++ let mut _3: alloc::raw_vec::RawVec; // in scope 2 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ++ } ++ scope 3 (inlined Box::>::new) { // at $DIR/inline_into_box_place.rs:8:29: 8:49 ++ debug x => _2; // in scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ let mut _4: usize; // in scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ let mut _5: usize; // in scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ let mut _6: *mut u8; // in scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ let mut _7: *const std::vec::Vec; // in scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ scope 4 { ++ } + } bb0: { StorageLive(_1); // scope 0 at $DIR/inline_into_box_place.rs:+1:9: +1:11 - _2 = SizeOf(std::vec::Vec); // scope 2 at $DIR/inline_into_box_place.rs:+1:29: +1:43 - _3 = AlignOf(std::vec::Vec); // scope 2 at $DIR/inline_into_box_place.rs:+1:29: +1:43 - _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> bb1; // scope 2 at $DIR/inline_into_box_place.rs:+1:29: +1:43 + StorageLive(_2); // scope 0 at $DIR/inline_into_box_place.rs:+1:38: +1:48 +- _2 = Vec::::new() -> bb1; // scope 0 at $DIR/inline_into_box_place.rs:+1:38: +1:48 ++ StorageLive(_3); // scope 2 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ++ _3 = const _; // scope 2 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL // mir::Constant - // + span: $DIR/inline_into_box_place.rs:8:29: 8:43 - // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value() } +- // + span: $DIR/inline_into_box_place.rs:8:38: 8:46 +- // + user_ty: UserType(2) +- // + literal: Const { ty: fn() -> Vec {Vec::::new}, val: Value() } ++ // + span: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ++ // + user_ty: UserType(0) ++ // + literal: Const { ty: alloc::raw_vec::RawVec, val: Unevaluated(alloc::raw_vec::RawVec::::NEW, [u32], None) } ++ _2 = Vec:: { buf: move _3, len: const 0_usize }; // scope 2 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ++ StorageDead(_3); // scope 2 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ++ _4 = SizeOf(std::vec::Vec); // scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ _5 = AlignOf(std::vec::Vec); // scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ _6 = alloc::alloc::exchange_malloc(move _4, move _5) -> [return: bb3, unwind: bb4]; // scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ // mir::Constant ++ // + span: $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value() } } bb1: { - StorageLive(_5); // scope 0 at $DIR/inline_into_box_place.rs:+1:29: +1:43 - _5 = ShallowInitBox(move _4, std::vec::Vec); // scope 0 at $DIR/inline_into_box_place.rs:+1:29: +1:43 - _7 = (((_5.0: std::ptr::Unique>).0: std::ptr::NonNull>).0: *const std::vec::Vec); // scope 0 at $DIR/inline_into_box_place.rs:+1:33: +1:43 -- (*_7) = Vec::::new() -> [return: bb2, unwind: bb5]; // scope 0 at $DIR/inline_into_box_place.rs:+1:33: +1:43 -+ StorageLive(_8); // scope 0 at $DIR/inline_into_box_place.rs:+1:33: +1:43 -+ _8 = &mut (*_7); // scope 0 at $DIR/inline_into_box_place.rs:+1:33: +1:43 -+ StorageLive(_9); // scope 0 at $DIR/inline_into_box_place.rs:+1:33: +1:43 -+ StorageLive(_10); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -+ _10 = const _; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - // mir::Constant -- // + span: $DIR/inline_into_box_place.rs:8:33: 8:41 +- _1 = Box::>::new(move _2) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/inline_into_box_place.rs:+1:29: +1:49 +- // mir::Constant +- // + span: $DIR/inline_into_box_place.rs:8:29: 8:37 - // + user_ty: UserType(1) -- // + literal: Const { ty: fn() -> Vec {Vec::::new}, val: Value() } -- } -- +- // + literal: Const { ty: fn(Vec) -> Box> {Box::>::new}, val: Value() } ++ StorageDead(_1); // scope 0 at $DIR/inline_into_box_place.rs:+2:1: +2:2 ++ return; // scope 0 at $DIR/inline_into_box_place.rs:+2:2: +2:2 + } + - bb2: { -+ // + span: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -+ // + user_ty: UserType(0) -+ // + literal: Const { ty: alloc::raw_vec::RawVec, val: Unevaluated(alloc::raw_vec::RawVec::::NEW, [u32], None) } -+ _9 = Vec:: { buf: move _10, len: const 0_usize }; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -+ StorageDead(_10); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -+ (*_8) = move _9; // scope 0 at $DIR/inline_into_box_place.rs:+1:33: +1:43 -+ StorageDead(_9); // scope 0 at $DIR/inline_into_box_place.rs:+1:33: +1:43 -+ StorageDead(_8); // scope 0 at $DIR/inline_into_box_place.rs:+1:33: +1:43 - _1 = move _5; // scope 0 at $DIR/inline_into_box_place.rs:+1:29: +1:43 - StorageDead(_5); // scope 0 at $DIR/inline_into_box_place.rs:+1:42: +1:43 - _0 = const (); // scope 0 at $DIR/inline_into_box_place.rs:+0:11: +2:2 +- StorageDead(_2); // scope 0 at $DIR/inline_into_box_place.rs:+1:48: +1:49 +- _0 = const (); // scope 0 at $DIR/inline_into_box_place.rs:+0:11: +2:2 - drop(_1) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/inline_into_box_place.rs:+2:1: +2:2 -+ drop(_1) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/inline_into_box_place.rs:+2:1: +2:2 ++ bb2 (cleanup): { ++ resume; // scope 0 at $DIR/inline_into_box_place.rs:+0:1: +2:2 } -- bb3: { -+ bb2: { - StorageDead(_1); // scope 0 at $DIR/inline_into_box_place.rs:+2:1: +2:2 - return; // scope 0 at $DIR/inline_into_box_place.rs:+2:2: +2:2 + bb3: { +- StorageDead(_1); // scope 0 at $DIR/inline_into_box_place.rs:+2:1: +2:2 +- return; // scope 0 at $DIR/inline_into_box_place.rs:+2:2: +2:2 ++ _1 = ShallowInitBox(move _6, std::vec::Vec); // scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ _7 = (((_1.0: std::ptr::Unique>).0: std::ptr::NonNull>).0: *const std::vec::Vec); // scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ (*_7) = move _2; // scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ StorageDead(_2); // scope 0 at $DIR/inline_into_box_place.rs:+1:48: +1:49 ++ _0 = const (); // scope 0 at $DIR/inline_into_box_place.rs:+0:11: +2:2 ++ drop(_1) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/inline_into_box_place.rs:+2:1: +2:2 } -- bb4 (cleanup): { -+ bb3 (cleanup): { - resume; // scope 0 at $DIR/inline_into_box_place.rs:+0:1: +2:2 -- } -- -- bb5 (cleanup): { -- _6 = alloc::alloc::box_free::, std::alloc::Global>(move (_5.0: std::ptr::Unique>), move (_5.1: std::alloc::Global)) -> bb4; // scope 0 at $DIR/inline_into_box_place.rs:+1:42: +1:43 -- // mir::Constant -- // + span: $DIR/inline_into_box_place.rs:8:42: 8:43 -- // + literal: Const { ty: unsafe fn(Unique>, std::alloc::Global) {alloc::alloc::box_free::, std::alloc::Global>}, val: Value() } + bb4 (cleanup): { +- resume; // scope 0 at $DIR/inline_into_box_place.rs:+0:1: +2:2 ++ drop(_2) -> [return: bb2, unwind terminate]; // scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL } } diff --git a/tests/mir-opt/inline/inline_into_box_place.rs b/tests/mir-opt/inline/inline_into_box_place.rs index 232bcc7b2..02823e4e1 100644 --- a/tests/mir-opt/inline/inline_into_box_place.rs +++ b/tests/mir-opt/inline/inline_into_box_place.rs @@ -1,9 +1,9 @@ // ignore-endian-big // ignore-wasm32-bare compiled with panic=abort by default +// ignore-debug MIR alignment checks in std alter the diff, breaking the test // compile-flags: -Z mir-opt-level=4 -#![feature(box_syntax)] // EMIT_MIR inline_into_box_place.main.Inline.diff fn main() { - let _x: Box> = box Vec::new(); + let _x: Box> = Box::new(Vec::new()); } diff --git a/tests/mir-opt/inline/inline_options.main.Inline.after.mir b/tests/mir-opt/inline/inline_options.main.Inline.after.mir index 1c590be94..a2938ead0 100644 --- a/tests/mir-opt/inline/inline_options.main.Inline.after.mir +++ b/tests/mir-opt/inline/inline_options.main.Inline.after.mir @@ -4,52 +4,52 @@ fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/inline_options.rs:+0:11: +0:11 let _1: (); // in scope 0 at $DIR/inline_options.rs:+1:5: +1:18 let _2: (); // in scope 0 at $DIR/inline_options.rs:+2:5: +2:21 - scope 1 (inlined inlined::) { // at $DIR/inline_options.rs:10:5: 10:21 - let _3: (); // in scope 1 at $DIR/inline_options.rs:16:23: 16:26 - let _4: (); // in scope 1 at $DIR/inline_options.rs:16:28: 16:31 - let _5: (); // in scope 1 at $DIR/inline_options.rs:16:33: 16:36 + scope 1 (inlined inlined::) { // at $DIR/inline_options.rs:11:5: 11:21 + let _3: (); // in scope 1 at $DIR/inline_options.rs:17:23: 17:26 + let _4: (); // in scope 1 at $DIR/inline_options.rs:17:28: 17:31 + let _5: (); // in scope 1 at $DIR/inline_options.rs:17:33: 17:36 } bb0: { StorageLive(_1); // scope 0 at $DIR/inline_options.rs:+1:5: +1:18 _1 = not_inlined() -> bb1; // scope 0 at $DIR/inline_options.rs:+1:5: +1:18 // mir::Constant - // + span: $DIR/inline_options.rs:9:5: 9:16 + // + span: $DIR/inline_options.rs:10:5: 10:16 // + literal: Const { ty: fn() {not_inlined}, val: Value() } } bb1: { StorageDead(_1); // scope 0 at $DIR/inline_options.rs:+1:18: +1:19 StorageLive(_2); // scope 0 at $DIR/inline_options.rs:+2:5: +2:21 - StorageLive(_3); // scope 1 at $DIR/inline_options.rs:16:23: 16:26 - _3 = g() -> bb2; // scope 1 at $DIR/inline_options.rs:16:23: 16:26 + StorageLive(_3); // scope 0 at $DIR/inline_options.rs:+2:5: +2:21 + StorageLive(_4); // scope 0 at $DIR/inline_options.rs:+2:5: +2:21 + StorageLive(_5); // scope 0 at $DIR/inline_options.rs:+2:5: +2:21 + _3 = g() -> bb3; // scope 1 at $DIR/inline_options.rs:17:23: 17:26 // mir::Constant - // + span: $DIR/inline_options.rs:16:23: 16:24 + // + span: $DIR/inline_options.rs:17:23: 17:24 // + literal: Const { ty: fn() {g}, val: Value() } } bb2: { - StorageDead(_3); // scope 1 at $DIR/inline_options.rs:16:26: 16:27 - StorageLive(_4); // scope 1 at $DIR/inline_options.rs:16:28: 16:31 - _4 = g() -> bb3; // scope 1 at $DIR/inline_options.rs:16:28: 16:31 - // mir::Constant - // + span: $DIR/inline_options.rs:16:28: 16:29 - // + literal: Const { ty: fn() {g}, val: Value() } + StorageDead(_5); // scope 0 at $DIR/inline_options.rs:+2:5: +2:21 + StorageDead(_4); // scope 0 at $DIR/inline_options.rs:+2:5: +2:21 + StorageDead(_3); // scope 0 at $DIR/inline_options.rs:+2:5: +2:21 + StorageDead(_2); // scope 0 at $DIR/inline_options.rs:+2:21: +2:22 + _0 = const (); // scope 0 at $DIR/inline_options.rs:+0:11: +3:2 + return; // scope 0 at $DIR/inline_options.rs:+3:2: +3:2 } bb3: { - StorageDead(_4); // scope 1 at $DIR/inline_options.rs:16:31: 16:32 - StorageLive(_5); // scope 1 at $DIR/inline_options.rs:16:33: 16:36 - _5 = g() -> bb4; // scope 1 at $DIR/inline_options.rs:16:33: 16:36 + _4 = g() -> bb4; // scope 1 at $DIR/inline_options.rs:17:28: 17:31 // mir::Constant - // + span: $DIR/inline_options.rs:16:33: 16:34 + // + span: $DIR/inline_options.rs:17:28: 17:29 // + literal: Const { ty: fn() {g}, val: Value() } } bb4: { - StorageDead(_5); // scope 1 at $DIR/inline_options.rs:16:36: 16:37 - StorageDead(_2); // scope 0 at $DIR/inline_options.rs:+2:21: +2:22 - _0 = const (); // scope 0 at $DIR/inline_options.rs:+0:11: +3:2 - return; // scope 0 at $DIR/inline_options.rs:+3:2: +3:2 + _5 = g() -> bb2; // scope 1 at $DIR/inline_options.rs:17:33: 17:36 + // mir::Constant + // + span: $DIR/inline_options.rs:17:33: 17:34 + // + literal: Const { ty: fn() {g}, val: Value() } } } diff --git a/tests/mir-opt/inline/inline_options.rs b/tests/mir-opt/inline/inline_options.rs index 477f050b6..f0a898832 100644 --- a/tests/mir-opt/inline/inline_options.rs +++ b/tests/mir-opt/inline/inline_options.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // Checks that inlining threshold can be controlled with // inline-mir-threshold and inline-hint-threshold options. // diff --git a/tests/mir-opt/inline/inline_specialization.main.Inline.diff b/tests/mir-opt/inline/inline_specialization.main.Inline.diff index af08296ed..9dde9994d 100644 --- a/tests/mir-opt/inline/inline_specialization.main.Inline.diff +++ b/tests/mir-opt/inline/inline_specialization.main.Inline.diff @@ -7,19 +7,19 @@ scope 1 { debug x => _1; // in scope 1 at $DIR/inline_specialization.rs:+1:9: +1:10 } -+ scope 2 (inlined as Foo>::bar) { // at $DIR/inline_specialization.rs:5:13: 5:38 ++ scope 2 (inlined as Foo>::bar) { // at $DIR/inline_specialization.rs:6:13: 6:38 + } bb0: { StorageLive(_1); // scope 0 at $DIR/inline_specialization.rs:+1:9: +1:10 - _1 = as Foo>::bar() -> bb1; // scope 0 at $DIR/inline_specialization.rs:+1:13: +1:38 - // mir::Constant -- // + span: $DIR/inline_specialization.rs:5:13: 5:36 +- // + span: $DIR/inline_specialization.rs:6:13: 6:36 - // + literal: Const { ty: fn() -> u32 { as Foo>::bar}, val: Value() } - } - - bb1: { -+ _1 = const 123_u32; // scope 2 at $DIR/inline_specialization.rs:14:31: 14:34 ++ _1 = const 123_u32; // scope 2 at $DIR/inline_specialization.rs:15:31: 15:34 _0 = const (); // scope 0 at $DIR/inline_specialization.rs:+0:11: +2:2 StorageDead(_1); // scope 0 at $DIR/inline_specialization.rs:+2:1: +2:2 return; // scope 0 at $DIR/inline_specialization.rs:+2:2: +2:2 diff --git a/tests/mir-opt/inline/inline_specialization.rs b/tests/mir-opt/inline/inline_specialization.rs index 87275b4e5..c24795e05 100644 --- a/tests/mir-opt/inline/inline_specialization.rs +++ b/tests/mir-opt/inline/inline_specialization.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default #![feature(specialization)] // EMIT_MIR inline_specialization.main.Inline.diff diff --git a/tests/mir-opt/inline/inline_trait_method.rs b/tests/mir-opt/inline/inline_trait_method.rs index 74be53f55..6aa957eb5 100644 --- a/tests/mir-opt/inline/inline_trait_method.rs +++ b/tests/mir-opt/inline/inline_trait_method.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // compile-flags: -Z span_free_formats fn main() { diff --git a/tests/mir-opt/inline/inline_trait_method.test.Inline.after.mir b/tests/mir-opt/inline/inline_trait_method.test.Inline.after.mir index 637bf282a..a9020a5bb 100644 --- a/tests/mir-opt/inline/inline_trait_method.test.Inline.after.mir +++ b/tests/mir-opt/inline/inline_trait_method.test.Inline.after.mir @@ -10,7 +10,7 @@ fn test(_1: &dyn X) -> u32 { _2 = &(*_1); // scope 0 at $DIR/inline_trait_method.rs:+1:5: +1:10 _0 = ::y(move _2) -> bb1; // scope 0 at $DIR/inline_trait_method.rs:+1:5: +1:10 // mir::Constant - // + span: $DIR/inline_trait_method.rs:9:7: 9:8 + // + span: $DIR/inline_trait_method.rs:10:7: 10:8 // + literal: Const { ty: for<'a> fn(&'a dyn X) -> u32 {::y}, val: Value() } } diff --git a/tests/mir-opt/inline/inline_trait_method_2.rs b/tests/mir-opt/inline/inline_trait_method_2.rs index 378e71a25..07a601908 100644 --- a/tests/mir-opt/inline/inline_trait_method_2.rs +++ b/tests/mir-opt/inline/inline_trait_method_2.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // compile-flags: -Z span_free_formats -Z mir-opt-level=4 // EMIT_MIR inline_trait_method_2.test2.Inline.after.mir diff --git a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.mir b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.mir index b7c5bbecb..a4bbecf3b 100644 --- a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.mir +++ b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.mir @@ -5,8 +5,8 @@ fn test2(_1: &dyn X) -> bool { let mut _0: bool; // return place in scope 0 at $DIR/inline_trait_method_2.rs:+0:24: +0:28 let mut _2: &dyn X; // in scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11 let mut _3: &dyn X; // in scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11 - scope 1 (inlined test) { // at $DIR/inline_trait_method_2.rs:5:5: 5:12 - debug x => _2; // in scope 1 at $DIR/inline_trait_method_2.rs:9:9: 9:10 + scope 1 (inlined test) { // at $DIR/inline_trait_method_2.rs:6:5: 6:12 + debug x => _2; // in scope 1 at $DIR/inline_trait_method_2.rs:10:9: 10:10 } bb0: { @@ -15,9 +15,9 @@ fn test2(_1: &dyn X) -> bool { _3 = &(*_1); // scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11 _2 = move _3 as &dyn X (Pointer(Unsize)); // scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11 StorageDead(_3); // scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11 - _0 = ::y(_2) -> bb1; // scope 1 at $DIR/inline_trait_method_2.rs:10:5: 10:10 + _0 = ::y(_2) -> bb1; // scope 1 at $DIR/inline_trait_method_2.rs:11:5: 11:10 // mir::Constant - // + span: $DIR/inline_trait_method_2.rs:10:7: 10:8 + // + span: $DIR/inline_trait_method_2.rs:11:7: 11:8 // + literal: Const { ty: for<'a> fn(&'a dyn X) -> bool {::y}, val: Value() } } diff --git a/tests/mir-opt/inline/issue_106141.outer.Inline.diff b/tests/mir-opt/inline/issue_106141.outer.Inline.diff index 97361fa5f..18df6f9af 100644 --- a/tests/mir-opt/inline/issue_106141.outer.Inline.diff +++ b/tests/mir-opt/inline/issue_106141.outer.Inline.diff @@ -3,14 +3,14 @@ fn outer() -> usize { let mut _0: usize; // return place in scope 0 at $DIR/issue_106141.rs:+0:19: +0:24 -+ scope 1 (inlined inner) { // at $DIR/issue_106141.rs:2:5: 2:12 -+ let mut _1: bool; // in scope 1 at $DIR/issue_106141.rs:13:8: 13:21 -+ let mut _2: bool; // in scope 1 at $DIR/issue_106141.rs:13:8: 13:21 -+ let mut _3: &[bool; 1]; // in scope 1 at $DIR/issue_106141.rs:11:18: 11:25 ++ scope 1 (inlined inner) { // at $DIR/issue_106141.rs:3:5: 3:12 ++ let mut _1: bool; // in scope 1 at $DIR/issue_106141.rs:14:8: 14:21 ++ 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:11:9: 11:15 ++ debug buffer => _3; // 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:12:9: 12:14 ++ debug index => _0; // in scope 3 at $DIR/issue_106141.rs:13:9: 13:14 + } + } + } @@ -18,36 +18,36 @@ bb0: { - _0 = inner() -> bb1; // scope 0 at $DIR/issue_106141.rs:+1:5: +1:12 + StorageLive(_3); // scope 0 at $DIR/issue_106141.rs:+1:5: +1:12 -+ _3 = const _; // scope 1 at $DIR/issue_106141.rs:11:18: 11:25 ++ _3 = const _; // scope 1 at $DIR/issue_106141.rs:12:18: 12:25 // mir::Constant -- // + span: $DIR/issue_106141.rs:2:5: 2:10 +- // + span: $DIR/issue_106141.rs:3:5: 3:10 - // + literal: Const { ty: fn() -> usize {inner}, val: Value() } -+ // + span: $DIR/issue_106141.rs:11:18: 11:25 ++ // + span: $DIR/issue_106141.rs:12:18: 12:25 + // + literal: Const { ty: &[bool; 1], val: Unevaluated(inner, [], Some(promoted[0])) } -+ _0 = index() -> bb1; // scope 2 at $DIR/issue_106141.rs:12:17: 12:24 ++ _0 = index() -> bb1; // scope 2 at $DIR/issue_106141.rs:13:17: 13:24 + // mir::Constant -+ // + span: $DIR/issue_106141.rs:12:17: 12:22 ++ // + span: $DIR/issue_106141.rs:13:17: 13:22 + // + literal: Const { ty: fn() -> usize {index}, val: Value() } } bb1: { -+ StorageLive(_1); // scope 3 at $DIR/issue_106141.rs:13:8: 13:21 -+ _2 = Lt(_0, const 1_usize); // scope 3 at $DIR/issue_106141.rs:13:8: 13:21 -+ assert(move _2, "index out of bounds: the length is {} but the index is {}", const 1_usize, _0) -> bb2; // scope 3 at $DIR/issue_106141.rs:13:8: 13:21 ++ StorageLive(_1); // scope 3 at $DIR/issue_106141.rs:14:8: 14:21 ++ _2 = Lt(_0, const 1_usize); // scope 3 at $DIR/issue_106141.rs:14:8: 14:21 ++ assert(move _2, "index out of bounds: the length is {} but the index is {}", const 1_usize, _0) -> bb2; // scope 3 at $DIR/issue_106141.rs:14:8: 14:21 + } + + bb2: { -+ _1 = (*_3)[_0]; // scope 3 at $DIR/issue_106141.rs:13:8: 13:21 -+ switchInt(move _1) -> [0: bb3, otherwise: bb4]; // scope 3 at $DIR/issue_106141.rs:13:8: 13:21 ++ _1 = (*_3)[_0]; // scope 3 at $DIR/issue_106141.rs:14:8: 14:21 ++ switchInt(move _1) -> [0: bb3, otherwise: bb4]; // scope 3 at $DIR/issue_106141.rs:14:8: 14:21 + } + + bb3: { -+ _0 = const 0_usize; // scope 3 at $DIR/issue_106141.rs:16:9: 16:10 -+ goto -> bb4; // scope 3 at $DIR/issue_106141.rs:13:5: 17:6 ++ _0 = const 0_usize; // scope 3 at $DIR/issue_106141.rs:17:9: 17:10 ++ goto -> bb4; // scope 3 at $DIR/issue_106141.rs:14:5: 18:6 + } + + bb4: { -+ StorageDead(_1); // scope 3 at $DIR/issue_106141.rs:17:5: 17:6 ++ StorageDead(_1); // scope 3 at $DIR/issue_106141.rs:18:5: 18:6 + StorageDead(_3); // scope 0 at $DIR/issue_106141.rs:+1:5: +1:12 return; // scope 0 at $DIR/issue_106141.rs:+2:2: +2:2 } diff --git a/tests/mir-opt/inline/issue_106141.rs b/tests/mir-opt/inline/issue_106141.rs index c8288b7f3..b6bd806e6 100644 --- a/tests/mir-opt/inline/issue_106141.rs +++ b/tests/mir-opt/inline/issue_106141.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default pub fn outer() -> usize { inner() } diff --git a/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir b/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir index 4dd1aad48..1da3c8bb7 100644 --- a/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir +++ b/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir @@ -10,10 +10,9 @@ fn main() -> () { scope 1 { debug f => _1; // in scope 1 at $DIR/issue_76997_inline_scopes_parenting.rs:+1:9: +1:10 scope 2 (inlined main::{closure#0}) { // at $DIR/issue_76997_inline_scopes_parenting.rs:6:5: 6:10 - debug x => _5; // in scope 2 at $DIR/issue_76997_inline_scopes_parenting.rs:+1:14: +1:15 - let _6: (); // in scope 2 at $DIR/issue_76997_inline_scopes_parenting.rs:+1:23: +1:24 + debug x => const (); // in scope 2 at $DIR/issue_76997_inline_scopes_parenting.rs:+1:14: +1:15 scope 3 { - debug y => _6; // in scope 3 at $DIR/issue_76997_inline_scopes_parenting.rs:+1:23: +1:24 + debug y => const (); // in scope 3 at $DIR/issue_76997_inline_scopes_parenting.rs:+1:23: +1:24 } } } @@ -22,7 +21,7 @@ fn main() -> () { StorageLive(_1); // scope 0 at $DIR/issue_76997_inline_scopes_parenting.rs:+1:9: +1:10 _1 = [closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16]; // scope 0 at $DIR/issue_76997_inline_scopes_parenting.rs:+1:13: +1:33 // closure - // + def_id: DefId(0:4 ~ issue_76997_inline_scopes_parenting[bc59]::main::{closure#0}) + // + def_id: DefId(0:4 ~ issue_76997_inline_scopes_parenting[5cd2]::main::{closure#0}) // + substs: [ // i8, // extern "rust-call" fn(((),)), @@ -36,8 +35,6 @@ fn main() -> () { _3 = (move _4,); // scope 1 at $DIR/issue_76997_inline_scopes_parenting.rs:+2:5: +2:10 StorageLive(_5); // scope 1 at $DIR/issue_76997_inline_scopes_parenting.rs:+2:5: +2:10 _5 = move (_3.0: ()); // scope 1 at $DIR/issue_76997_inline_scopes_parenting.rs:+2:5: +2:10 - StorageLive(_6); // scope 2 at $DIR/issue_76997_inline_scopes_parenting.rs:+1:23: +1:24 - StorageDead(_6); // scope 2 at $DIR/issue_76997_inline_scopes_parenting.rs:+1:32: +1:33 StorageDead(_5); // scope 1 at $DIR/issue_76997_inline_scopes_parenting.rs:+2:5: +2:10 StorageDead(_4); // scope 1 at $DIR/issue_76997_inline_scopes_parenting.rs:+2:9: +2:10 StorageDead(_3); // scope 1 at $DIR/issue_76997_inline_scopes_parenting.rs:+2:9: +2:10 diff --git a/tests/mir-opt/inline/issue_78442.bar.Inline.diff b/tests/mir-opt/inline/issue_78442.bar.Inline.diff index aa62e4a16..dc3fe7555 100644 --- a/tests/mir-opt/inline/issue_78442.bar.Inline.diff +++ b/tests/mir-opt/inline/issue_78442.bar.Inline.diff @@ -46,11 +46,11 @@ - bb3: { - return; // scope 0 at $DIR/issue_78442.rs:+5:2: +5:2 + bb3 (cleanup): { -+ drop(_1) -> bb4; // scope 0 at $DIR/issue_78442.rs:+5:1: +5:2 ++ drop(_1) -> [return: bb4, unwind terminate]; // scope 0 at $DIR/issue_78442.rs:+5:1: +5:2 } bb4 (cleanup): { -- drop(_1) -> bb5; // scope 0 at $DIR/issue_78442.rs:+5:1: +5:2 +- drop(_1) -> [return: bb5, unwind terminate]; // scope 0 at $DIR/issue_78442.rs:+5:1: +5:2 + resume; // scope 0 at $DIR/issue_78442.rs:+0:1: +5:2 } diff --git a/tests/mir-opt/inline/issue_78442.bar.RevealAll.diff b/tests/mir-opt/inline/issue_78442.bar.RevealAll.diff index 21055c6bf..8f56ef258 100644 --- a/tests/mir-opt/inline/issue_78442.bar.RevealAll.diff +++ b/tests/mir-opt/inline/issue_78442.bar.RevealAll.diff @@ -47,7 +47,7 @@ } bb4 (cleanup): { - drop(_1) -> bb5; // scope 0 at $DIR/issue_78442.rs:+5:1: +5:2 + drop(_1) -> [return: bb5, unwind terminate]; // scope 0 at $DIR/issue_78442.rs:+5:1: +5:2 } bb5 (cleanup): { diff --git a/tests/mir-opt/inline/unchecked_shifts.rs b/tests/mir-opt/inline/unchecked_shifts.rs new file mode 100644 index 000000000..17724530d --- /dev/null +++ b/tests/mir-opt/inline/unchecked_shifts.rs @@ -0,0 +1,18 @@ +// ignore-wasm32 compiled with panic=abort by default +#![crate_type = "lib"] +#![feature(unchecked_math)] + +// ignore-debug: the debug assertions prevent the inlining we are testing for +// compile-flags: -Zmir-opt-level=2 -Zinline-mir + +// EMIT_MIR unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff +// EMIT_MIR unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir +pub unsafe fn unchecked_shl_unsigned_smaller(a: u16, b: u32) -> u16 { + a.unchecked_shl(b) +} + +// EMIT_MIR unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff +// EMIT_MIR unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir +pub unsafe fn unchecked_shr_signed_smaller(a: i16, b: u32) -> i16 { + a.unchecked_shr(b) +} 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 new file mode 100644 index 000000000..6184a0acd --- /dev/null +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff @@ -0,0 +1,144 @@ +- // MIR for `unchecked_shl_unsigned_smaller` before Inline ++ // MIR for `unchecked_shl_unsigned_smaller` after Inline + + fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 { + debug a => _1; // in scope 0 at $DIR/unchecked_shifts.rs:+0:46: +0:47 + debug b => _2; // in scope 0 at $DIR/unchecked_shifts.rs:+0:54: +0:55 + let mut _0: u16; // return place in scope 0 at $DIR/unchecked_shifts.rs:+0:65: +0:68 + let mut _3: u16; // in scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:6 + let mut _4: u32; // in scope 0 at $DIR/unchecked_shifts.rs:+1:21: +1:22 ++ 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 ++ 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 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 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 ++ } ++ } ++ } ++ } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:6 + _3 = _1; // scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:6 + StorageLive(_4); // scope 0 at $DIR/unchecked_shifts.rs:+1:21: +1:22 + _4 = _2; // scope 0 at $DIR/unchecked_shifts.rs:+1:21: +1:22 +- _0 = core::num::::unchecked_shl(move _3, move _4) -> bb1; // scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:23 +- // 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 + } + + 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 ++ // 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 ++ } ++ ++ 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 ++ } ++ ++ 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 ++ } ++ ++ 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 ++ } ++ ++ bb7: { ++ unreachable; // scope 5 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 ++ } ++ ++ 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 ++ // 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 new file mode 100644 index 000000000..726b6bbf9 --- /dev/null +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir @@ -0,0 +1,130 @@ +// MIR for `unchecked_shl_unsigned_smaller` after PreCodegen + +fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 { + debug a => _1; // in scope 0 at $DIR/unchecked_shifts.rs:+0:46: +0:47 + debug b => _2; // in scope 0 at $DIR/unchecked_shifts.rs:+0:54: +0:55 + let mut _0: u16; // return place in scope 0 at $DIR/unchecked_shifts.rs:+0:65: +0:68 + 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 + 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 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 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 + } + + 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 + // 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 + } + + 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 + } + + 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 + } + + 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 + } + + bb7: { + unreachable; // scope 5 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 + } + + 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 + // 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 new file mode 100644 index 000000000..35d5b6e72 --- /dev/null +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff @@ -0,0 +1,144 @@ +- // MIR for `unchecked_shr_signed_smaller` before Inline ++ // MIR for `unchecked_shr_signed_smaller` after Inline + + fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 { + debug a => _1; // in scope 0 at $DIR/unchecked_shifts.rs:+0:44: +0:45 + debug b => _2; // in scope 0 at $DIR/unchecked_shifts.rs:+0:52: +0:53 + let mut _0: i16; // return place in scope 0 at $DIR/unchecked_shifts.rs:+0:63: +0:66 + let mut _3: i16; // in scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:6 + let mut _4: u32; // in scope 0 at $DIR/unchecked_shifts.rs:+1:21: +1:22 ++ 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 ++ 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 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 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 ++ } ++ } ++ } ++ } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:6 + _3 = _1; // scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:6 + StorageLive(_4); // scope 0 at $DIR/unchecked_shifts.rs:+1:21: +1:22 + _4 = _2; // scope 0 at $DIR/unchecked_shifts.rs:+1:21: +1:22 +- _0 = core::num::::unchecked_shr(move _3, move _4) -> bb1; // scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:23 +- // 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 + } + + 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 ++ // 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 ++ } ++ ++ 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 ++ } ++ ++ 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 ++ } ++ ++ 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 ++ } ++ ++ bb7: { ++ unreachable; // scope 5 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 ++ } ++ ++ 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 ++ // 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 new file mode 100644 index 000000000..b006085b5 --- /dev/null +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir @@ -0,0 +1,130 @@ +// MIR for `unchecked_shr_signed_smaller` after PreCodegen + +fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 { + debug a => _1; // in scope 0 at $DIR/unchecked_shifts.rs:+0:44: +0:45 + debug b => _2; // in scope 0 at $DIR/unchecked_shifts.rs:+0:52: +0:53 + let mut _0: i16; // return place in scope 0 at $DIR/unchecked_shifts.rs:+0:63: +0:66 + 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 + 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 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 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 + } + + 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 + // 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 + } + + 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 + } + + 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 + } + + 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 + } + + bb7: { + unreachable; // scope 5 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 + } + + 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 + // 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/unwrap_unchecked.rs b/tests/mir-opt/inline/unwrap_unchecked.rs new file mode 100644 index 000000000..5856f1479 --- /dev/null +++ b/tests/mir-opt/inline/unwrap_unchecked.rs @@ -0,0 +1,11 @@ +#![crate_type = "lib"] + +// ignore-wasm32-bare compiled with panic=abort by default +// ignore-debug: the debug assertions prevent the inlining we are testing for +// compile-flags: -Zmir-opt-level=2 -Zinline-mir + +// EMIT_MIR unwrap_unchecked.unwrap_unchecked.Inline.diff +// EMIT_MIR unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir +pub unsafe fn unwrap_unchecked(slf: Option) -> T { + slf.unwrap_unchecked() +} diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff new file mode 100644 index 000000000..543ddcfc4 --- /dev/null +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff @@ -0,0 +1,55 @@ +- // MIR for `unwrap_unchecked` before Inline ++ // MIR for `unwrap_unchecked` after Inline + + fn unwrap_unchecked(_1: Option) -> T { + debug slf => _1; // in scope 0 at $DIR/unwrap_unchecked.rs:+0:35: +0:38 + let mut _0: T; // return place in scope 0 at $DIR/unwrap_unchecked.rs:+0:54: +0:55 + let mut _2: std::option::Option; // in scope 0 at $DIR/unwrap_unchecked.rs:+1:5: +1:8 ++ scope 1 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $DIR/unwrap_unchecked.rs:10:9: 10:27 ++ debug self => _2; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL ++ let mut _3: &std::option::Option; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL ++ let mut _4: isize; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL ++ scope 2 { ++ debug val => _0; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL ++ } ++ scope 3 { ++ scope 5 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL ++ scope 6 { ++ scope 7 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL ++ } ++ } ++ } ++ } ++ scope 4 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL ++ debug self => _3; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL ++ } ++ } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/unwrap_unchecked.rs:+1:5: +1:8 + _2 = move _1; // scope 0 at $DIR/unwrap_unchecked.rs:+1:5: +1:8 +- _0 = Option::::unwrap_unchecked(move _2) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/unwrap_unchecked.rs:+1:5: +1:27 +- // mir::Constant +- // + span: $DIR/unwrap_unchecked.rs:10:9: 10:25 +- // + 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 + } + + bb1: { +- StorageDead(_2); // scope 0 at $DIR/unwrap_unchecked.rs:+1:26: +1:27 +- return; // scope 0 at $DIR/unwrap_unchecked.rs:+2:2: +2:2 ++ unreachable; // scope 6 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + } + +- bb2 (cleanup): { +- resume; // scope 0 at $DIR/unwrap_unchecked.rs:+0:1: +2:2 ++ bb2: { ++ _0 = move ((_2 as Some).0: T); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL ++ StorageDead(_3); // scope 0 at $DIR/unwrap_unchecked.rs:+1:9: +1:27 ++ StorageDead(_2); // scope 0 at $DIR/unwrap_unchecked.rs:+1:26: +1:27 ++ return; // scope 0 at $DIR/unwrap_unchecked.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir new file mode 100644 index 000000000..c5e2469fc --- /dev/null +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir @@ -0,0 +1,41 @@ +// MIR for `unwrap_unchecked` after PreCodegen + +fn unwrap_unchecked(_1: Option) -> T { + debug slf => _1; // in scope 0 at $DIR/unwrap_unchecked.rs:+0:35: +0:38 + let mut _0: T; // return place in scope 0 at $DIR/unwrap_unchecked.rs:+0:54: +0:55 + scope 1 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $DIR/unwrap_unchecked.rs:10:9: 10:27 + debug self => _1; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _2: &std::option::Option; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _3: isize; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + scope 2 { + debug val => _0; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL + } + scope 3 { + scope 5 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL + scope 6 { + scope 7 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + } + } + } + } + scope 4 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL + debug self => _2; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL + } + } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/unwrap_unchecked.rs:+1:9: +1:27 + _3 = discriminant(_1); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + switchInt(move _3) -> [1: bb2, otherwise: bb1]; // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + } + + bb1: { + unreachable; // scope 6 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + } + + bb2: { + _0 = move ((_1 as Some).0: T); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_2); // scope 0 at $DIR/unwrap_unchecked.rs:+1:9: +1:27 + return; // scope 0 at $DIR/unwrap_unchecked.rs:+2:2: +2:2 + } +} 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 new file mode 100644 index 000000000..e04079453 --- /dev/null +++ b/tests/mir-opt/instcombine_duplicate_switch_targets.assert_zero.InstCombine.diff @@ -0,0 +1,21 @@ +- // 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 new file mode 100644 index 000000000..ef3b487af --- /dev/null +++ b/tests/mir-opt/instcombine_duplicate_switch_targets.rs @@ -0,0 +1,27 @@ +#![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/instrument_coverage.main.InstrumentCoverage.diff b/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff index 2f6f5f87e..49006e012 100644 --- a/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff +++ b/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff @@ -14,7 +14,7 @@ bb1: { + Coverage::Expression(4294967295) = 1 + 2 for /the/src/instrument_coverage.rs:12:5 - 13:17; // scope 0 at /the/src/instrument_coverage.rs:+1:5: +5:6 - falseUnwind -> [real: bb2, cleanup: bb6]; // scope 0 at /the/src/instrument_coverage.rs:+1:5: +5:6 + falseUnwind -> [real: bb2, unwind: bb6]; // scope 0 at /the/src/instrument_coverage.rs:+1:5: +5:6 } bb2: { diff --git a/tests/mir-opt/intrinsic_asserts.generic.InstCombine.diff b/tests/mir-opt/intrinsic_asserts.generic.InstCombine.diff index 8ff64c1ea..09fc145e7 100644 --- a/tests/mir-opt/intrinsic_asserts.generic.InstCombine.diff +++ b/tests/mir-opt/intrinsic_asserts.generic.InstCombine.diff @@ -8,33 +8,33 @@ let _3: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:60 bb0: { - StorageLive(_1); // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:46 - _1 = assert_inhabited::() -> bb1; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:46 + 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: { - StorageDead(_1); // scope 0 at $DIR/intrinsic_asserts.rs:+1:46: +1:47 - StorageLive(_2); // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:47 - _2 = assert_zero_valid::() -> bb2; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:47 + 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: { - StorageDead(_2); // scope 0 at $DIR/intrinsic_asserts.rs:+2:47: +2:48 - StorageLive(_3); // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:60 - _3 = assert_mem_uninitialized_valid::() -> bb3; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:60 + 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: { - StorageDead(_3); // scope 0 at $DIR/intrinsic_asserts.rs:+3:60: +3:61 + 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 index ddc015903..c52174ef5 100644 --- a/tests/mir-opt/intrinsic_asserts.panics.InstCombine.diff +++ b/tests/mir-opt/intrinsic_asserts.panics.InstCombine.diff @@ -8,19 +8,19 @@ let _3: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:62 bb0: { - StorageLive(_1); // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:50 -- _1 = assert_inhabited::() -> bb1; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:50 -+ _1 = assert_inhabited::(); // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:50 + 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: { - StorageDead(_1); // scope 0 at $DIR/intrinsic_asserts.rs:+1:50: +1:51 - StorageLive(_2); // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:49 -- _2 = assert_zero_valid::<&u8>() -> bb2; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:49 -+ _2 = assert_zero_valid::<&u8>(); // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:49 + 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) @@ -28,10 +28,10 @@ } bb2: { - StorageDead(_2); // scope 0 at $DIR/intrinsic_asserts.rs:+2:49: +2:50 - StorageLive(_3); // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:62 -- _3 = assert_mem_uninitialized_valid::<&u8>() -> bb3; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:62 -+ _3 = assert_mem_uninitialized_valid::<&u8>(); // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:62 + 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) @@ -39,7 +39,7 @@ } bb3: { - StorageDead(_3); // scope 0 at $DIR/intrinsic_asserts.rs:+3:62: +3:63 + 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 index 568fbf1a0..d059d47ee 100644 --- a/tests/mir-opt/intrinsic_asserts.removable.InstCombine.diff +++ b/tests/mir-opt/intrinsic_asserts.removable.InstCombine.diff @@ -8,8 +8,8 @@ let _3: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:61 bb0: { - StorageLive(_1); // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:47 -- _1 = assert_inhabited::<()>() -> bb1; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:47 + 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() } @@ -17,9 +17,9 @@ } bb1: { - StorageDead(_1); // scope 0 at $DIR/intrinsic_asserts.rs:+1:47: +1:48 - StorageLive(_2); // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:48 -- _2 = assert_zero_valid::() -> bb2; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:48 + 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() } @@ -27,9 +27,9 @@ } bb2: { - StorageDead(_2); // scope 0 at $DIR/intrinsic_asserts.rs:+2:48: +2:49 - StorageLive(_3); // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:61 -- _3 = assert_mem_uninitialized_valid::() -> bb3; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:61 + 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() } @@ -37,7 +37,7 @@ } bb3: { - StorageDead(_3); // scope 0 at $DIR/intrinsic_asserts.rs:+3:61: +3:62 + 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/issue_101973.inner.ConstProp.diff b/tests/mir-opt/issue_101973.inner.ConstProp.diff index 6db8e4d26..d048b9e65 100644 --- a/tests/mir-opt/issue_101973.inner.ConstProp.diff +++ b/tests/mir-opt/issue_101973.inner.ConstProp.diff @@ -12,18 +12,19 @@ let mut _7: u32; // in scope 0 at $DIR/issue_101973.rs:+1:31: +1:52 let mut _8: u32; // in scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 let mut _9: u32; // in scope 0 at $DIR/issue_101973.rs:+1:33: +1:39 - let mut _10: (u32, bool); // in scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 - let mut _11: (u32, bool); // in scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 - scope 1 (inlined imm8) { // at $DIR/issue_101973.rs:14:5: 14:17 - debug x => _1; // in scope 1 at $DIR/issue_101973.rs:5:13: 5:14 - let mut _12: u32; // in scope 1 at $DIR/issue_101973.rs:7:12: 7:27 - let mut _13: u32; // in scope 1 at $DIR/issue_101973.rs:7:12: 7:20 - let mut _14: (u32, bool); // in scope 1 at $DIR/issue_101973.rs:7:12: 7:20 + let mut _10: u32; // in scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 + let mut _11: bool; // in scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 + let mut _12: u32; // in scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 + let mut _13: bool; // in scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 + scope 1 (inlined imm8) { // at $DIR/issue_101973.rs:15:5: 15:17 + debug x => _1; // in scope 1 at $DIR/issue_101973.rs:6:13: 6:14 + let mut _14: u32; // in scope 1 at $DIR/issue_101973.rs:8:12: 8:27 + let mut _15: u32; // in scope 1 at $DIR/issue_101973.rs:8:12: 8:20 scope 2 { - debug out => _4; // in scope 2 at $DIR/issue_101973.rs:6:9: 6:16 + debug out => _4; // in scope 2 at $DIR/issue_101973.rs:7:9: 7:16 } } - scope 3 (inlined core::num::::rotate_right) { // at $DIR/issue_101973.rs:14:18: 14:58 + scope 3 (inlined core::num::::rotate_right) { // at $DIR/issue_101973.rs:15:18: 15:58 debug self => _4; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL debug n => _6; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL } @@ -32,43 +33,46 @@ StorageLive(_2); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:65 StorageLive(_3); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:58 StorageLive(_4); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:17 - StorageLive(_12); // scope 2 at $DIR/issue_101973.rs:7:12: 7:27 - StorageLive(_13); // scope 2 at $DIR/issue_101973.rs:7:12: 7:20 - _14 = CheckedShr(_1, const 0_i32); // scope 2 at $DIR/issue_101973.rs:7:12: 7:20 - assert(!move (_14.1: bool), "attempt to shift right by `{}`, which would overflow", const 0_i32) -> bb3; // scope 2 at $DIR/issue_101973.rs:7:12: 7:20 + StorageLive(_14); // scope 2 at $DIR/issue_101973.rs:8:12: 8:27 + StorageLive(_15); // scope 2 at $DIR/issue_101973.rs:8:12: 8:20 + _15 = Shr(_1, const 0_i32); // scope 2 at $DIR/issue_101973.rs:8:12: 8:20 + _14 = BitAnd(move _15, const 255_u32); // scope 2 at $DIR/issue_101973.rs:8:12: 8:27 + StorageDead(_15); // scope 2 at $DIR/issue_101973.rs:8:26: 8:27 + _4 = BitOr(const 0_u32, move _14); // scope 2 at $DIR/issue_101973.rs:8:5: 8:27 + StorageDead(_14); // scope 2 at $DIR/issue_101973.rs:8:26: 8:27 + StorageLive(_6); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 + StorageLive(_7); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:52 + StorageLive(_8); // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 +- _10 = const 8_i32 as u32 (IntToInt); // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 +- _11 = Lt(move _10, const 32_u32); // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 +- assert(move _11, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> bb1; // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 ++ _10 = const 8_u32; // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 ++ _11 = const true; // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 ++ assert(const true, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> bb1; // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 } bb1: { - _8 = move (_10.0: u32); // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 + _8 = Shr(_1, const 8_i32); // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 _7 = BitAnd(move _8, const 15_u32); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:52 StorageDead(_8); // scope 0 at $DIR/issue_101973.rs:+1:51: +1:52 - _11 = CheckedShl(_7, const 1_i32); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 - assert(!move (_11.1: bool), "attempt to shift left by `{}`, which would overflow", const 1_i32) -> bb2; // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 +- _12 = const 1_i32 as u32 (IntToInt); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 +- _13 = Lt(move _12, const 32_u32); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 +- assert(move _13, "attempt to shift left by `{}`, which would overflow", const 1_i32) -> bb2; // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 ++ _12 = const 1_u32; // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 ++ _13 = const true; // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 ++ assert(const true, "attempt to shift left by `{}`, which would overflow", const 1_i32) -> bb2; // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 } bb2: { - _6 = move (_11.0: u32); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 + _6 = Shl(move _7, const 1_i32); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 StorageDead(_7); // scope 0 at $DIR/issue_101973.rs:+1:56: +1:57 - _3 = rotate_right::(_4, _6) -> bb4; // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + _3 = rotate_right::(_4, _6) -> [return: bb3, unwind unreachable]; // scope 3 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: extern "rust-intrinsic" fn(u32, u32) -> u32 {rotate_right::}, val: Value() } } bb3: { - _13 = move (_14.0: u32); // scope 2 at $DIR/issue_101973.rs:7:12: 7:20 - _12 = BitAnd(move _13, const 255_u32); // scope 2 at $DIR/issue_101973.rs:7:12: 7:27 - StorageDead(_13); // scope 2 at $DIR/issue_101973.rs:7:26: 7:27 - _4 = BitOr(const 0_u32, move _12); // scope 2 at $DIR/issue_101973.rs:7:5: 7:27 - StorageDead(_12); // scope 2 at $DIR/issue_101973.rs:7:26: 7:27 - StorageLive(_6); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 - StorageLive(_7); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:52 - StorageLive(_8); // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 - _10 = CheckedShr(_1, const 8_i32); // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 - assert(!move (_10.1: bool), "attempt to shift right by `{}`, which would overflow", const 8_i32) -> bb1; // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 - } - - bb4: { StorageDead(_6); // scope 0 at $DIR/issue_101973.rs:+1:57: +1:58 StorageDead(_4); // scope 0 at $DIR/issue_101973.rs:+1:57: +1:58 _2 = move _3 as i32 (IntToInt); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:65 diff --git a/tests/mir-opt/issue_101973.rs b/tests/mir-opt/issue_101973.rs index 216659a23..da388f149 100644 --- a/tests/mir-opt/issue_101973.rs +++ b/tests/mir-opt/issue_101973.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // compile-flags: -O -C debug-assertions=on // This needs inlining followed by ConstProp to reproduce, so we cannot use "unit-test". diff --git a/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.mir b/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.mir new file mode 100644 index 000000000..f50c0eb47 --- /dev/null +++ b/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.mir @@ -0,0 +1,25 @@ +// MIR for `main` after AbortUnwindingCalls + +fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/issue_104451_unwindable_intrinsics.rs:+0:11: +0:11 + let mut _1: !; // in scope 0 at $DIR/issue_104451_unwindable_intrinsics.rs:+2:9: +2:62 + let mut _2: (); // in scope 0 at $DIR/issue_104451_unwindable_intrinsics.rs:+2:45: +2:47 + scope 1 { + } + + bb0: { + StorageLive(_1); // scope 1 at $DIR/issue_104451_unwindable_intrinsics.rs:+2:9: +2:62 + StorageLive(_2); // scope 1 at $DIR/issue_104451_unwindable_intrinsics.rs:+2:45: +2:47 + _2 = (); // scope 1 at $DIR/issue_104451_unwindable_intrinsics.rs:+2:45: +2:47 + _1 = const_eval_select::<(), fn() -> ! {ow_ct}, fn() -> ! {ow_ct}, !>(move _2, ow_ct, ow_ct); // scope 1 at $DIR/issue_104451_unwindable_intrinsics.rs:+2:9: +2:62 + // mir::Constant + // + span: $DIR/issue_104451_unwindable_intrinsics.rs:8:9: 8:44 + // + literal: Const { ty: unsafe extern "rust-intrinsic" fn((), fn() -> ! {ow_ct}, fn() -> ! {ow_ct}) -> ! {const_eval_select::<(), fn() -> ! {ow_ct}, fn() -> ! {ow_ct}, !>}, val: Value() } + // mir::Constant + // + span: $DIR/issue_104451_unwindable_intrinsics.rs:8:49: 8:54 + // + literal: Const { ty: fn() -> ! {ow_ct}, val: Value() } + // mir::Constant + // + span: $DIR/issue_104451_unwindable_intrinsics.rs:8:56: 8:61 + // + literal: Const { ty: fn() -> ! {ow_ct}, val: Value() } + } +} diff --git a/tests/mir-opt/issue_104451_unwindable_intrinsics.rs b/tests/mir-opt/issue_104451_unwindable_intrinsics.rs new file mode 100644 index 000000000..9babd4aae --- /dev/null +++ b/tests/mir-opt/issue_104451_unwindable_intrinsics.rs @@ -0,0 +1,14 @@ +// Check that `UnwindAction::Unreachable` is not generated for unwindable intrinsics. +// ignore-wasm32 compiled with panic=abort by default +#![feature(core_intrinsics)] + +// EMIT_MIR issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.mir +fn main() { + unsafe { + core::intrinsics::const_eval_select((), ow_ct, ow_ct) + } +} + +const fn ow_ct() -> ! { + panic!(); +} diff --git a/tests/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir b/tests/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir index b0d5b291b..ccaa508c1 100644 --- a/tests/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir @@ -19,7 +19,7 @@ fn main() -> () { } bb1: { - falseUnwind -> [real: bb2, cleanup: bb5]; // scope 1 at $DIR/issue_38669.rs:+2:5: +7:6 + falseUnwind -> [real: bb2, unwind: bb5]; // scope 1 at $DIR/issue_38669.rs:+2:5: +7:6 } bb2: { diff --git a/tests/mir-opt/issue_41110.main.ElaborateDrops.diff b/tests/mir-opt/issue_41110.main.ElaborateDrops.diff index 7ac75b51a..ac2520249 100644 --- a/tests/mir-opt/issue_41110.main.ElaborateDrops.diff +++ b/tests/mir-opt/issue_41110.main.ElaborateDrops.diff @@ -46,17 +46,17 @@ } bb3 (cleanup): { -- drop(_3) -> bb5; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28 +- drop(_3) -> [return: bb5, unwind terminate]; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28 + goto -> bb5; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28 } bb4 (cleanup): { -- drop(_4) -> bb5; // scope 0 at $DIR/issue_41110.rs:+1:26: +1:27 +- drop(_4) -> [return: bb5, unwind terminate]; // scope 0 at $DIR/issue_41110.rs:+1:26: +1:27 + goto -> bb5; // scope 0 at $DIR/issue_41110.rs:+1:26: +1:27 } bb5 (cleanup): { -- drop(_2) -> bb6; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28 +- drop(_2) -> [return: bb6, unwind terminate]; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28 + goto -> bb8; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28 } @@ -65,7 +65,7 @@ + } + + bb7 (cleanup): { -+ drop(_2) -> bb6; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28 ++ drop(_2) -> [return: bb6, unwind terminate]; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28 + } + + bb8 (cleanup): { diff --git a/tests/mir-opt/issue_41110.test.ElaborateDrops.diff b/tests/mir-opt/issue_41110.test.ElaborateDrops.diff index 79e3d073b..a4a07ad12 100644 --- a/tests/mir-opt/issue_41110.test.ElaborateDrops.diff +++ b/tests/mir-opt/issue_41110.test.ElaborateDrops.diff @@ -38,50 +38,52 @@ StorageLive(_5); // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10 + _6 = const false; // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10 _5 = move _1; // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10 -- replace(_2 <- move _5) -> [return: bb2, unwind: bb6]; // scope 2 at $DIR/issue_41110.rs:+4:5: +4:6 -+ goto -> bb12; // scope 2 at $DIR/issue_41110.rs:+4:5: +4:6 +- drop(_2) -> [return: bb2, unwind: bb3]; // scope 2 at $DIR/issue_41110.rs:+4:5: +4:6 ++ goto -> bb2; // scope 2 at $DIR/issue_41110.rs:+4:5: +4:6 } bb2: { -- drop(_5) -> [return: bb3, unwind: bb8]; // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10 -+ goto -> bb3; // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10 + _2 = move _5; // scope 2 at $DIR/issue_41110.rs:+4:5: +4:6 +- drop(_5) -> [return: bb4, unwind: bb8]; // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10 ++ goto -> bb4; // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10 + } + + bb3 (cleanup): { + _2 = move _5; // scope 2 at $DIR/issue_41110.rs:+4:5: +4:6 + drop(_5) -> [return: bb8, unwind terminate]; // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10 } - bb3: { + bb4: { StorageDead(_5); // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10 _0 = const (); // scope 0 at $DIR/issue_41110.rs:+0:15: +5:2 - drop(_2) -> [return: bb4, unwind: bb9]; // scope 1 at $DIR/issue_41110.rs:+5:1: +5:2 + drop(_2) -> [return: bb5, unwind: bb9]; // scope 1 at $DIR/issue_41110.rs:+5:1: +5:2 } - bb4: { + bb5: { StorageDead(_2); // scope 1 at $DIR/issue_41110.rs:+5:1: +5:2 -- drop(_1) -> bb5; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 -+ goto -> bb5; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 +- drop(_1) -> bb6; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 ++ goto -> bb6; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 } - bb5: { + bb6: { + _6 = const false; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 StorageDead(_1); // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 return; // scope 0 at $DIR/issue_41110.rs:+5:2: +5:2 } - bb6 (cleanup): { - drop(_5) -> bb8; // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10 - } - bb7 (cleanup): { -- drop(_4) -> bb8; // scope 2 at $DIR/issue_41110.rs:+3:11: +3:12 +- drop(_4) -> [return: bb8, unwind terminate]; // scope 2 at $DIR/issue_41110.rs:+3:11: +3:12 + goto -> bb8; // scope 2 at $DIR/issue_41110.rs:+3:11: +3:12 } bb8 (cleanup): { -- drop(_2) -> bb9; // scope 1 at $DIR/issue_41110.rs:+5:1: +5:2 +- drop(_2) -> [return: bb9, unwind terminate]; // scope 1 at $DIR/issue_41110.rs:+5:1: +5:2 + goto -> bb9; // scope 1 at $DIR/issue_41110.rs:+5:1: +5:2 } bb9 (cleanup): { -- drop(_1) -> bb10; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 -+ goto -> bb14; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 +- drop(_1) -> [return: bb10, unwind terminate]; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 ++ goto -> bb13; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 } bb10 (cleanup): { @@ -89,21 +91,15 @@ + } + + bb11 (cleanup): { -+ _2 = move _5; // scope 2 at $DIR/issue_41110.rs:+4:5: +4:6 -+ goto -> bb10; // scope 2 at $DIR/issue_41110.rs:+4:5: +4:6 ++ unreachable; // scope 0 at $DIR/issue_41110.rs:+0:1: +5:2 + } + -+ bb12: { -+ _2 = move _5; // scope 2 at $DIR/issue_41110.rs:+4:5: +4:6 -+ goto -> bb2; // scope 2 at $DIR/issue_41110.rs:+4:5: +4:6 ++ bb12 (cleanup): { ++ drop(_1) -> [return: bb10, unwind terminate]; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 + } + + bb13 (cleanup): { -+ drop(_1) -> bb10; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 -+ } -+ -+ bb14 (cleanup): { -+ switchInt(_6) -> [0: bb10, otherwise: bb13]; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 ++ switchInt(_6) -> [0: bb10, otherwise: bb12]; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 } } diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.diff index 257f0b1e6..d98f75e75 100644 --- a/tests/mir-opt/issue_41888.main.ElaborateDrops.diff +++ b/tests/mir-opt/issue_41888.main.ElaborateDrops.diff @@ -34,7 +34,7 @@ } bb1: { - switchInt(move _2) -> [0: bb7, otherwise: bb2]; // scope 1 at $DIR/issue_41888.rs:+2:8: +2:14 + switchInt(move _2) -> [0: bb8, otherwise: bb2]; // scope 1 at $DIR/issue_41888.rs:+2:8: +2:14 } bb2: { @@ -43,47 +43,56 @@ _4 = K; // scope 1 at $DIR/issue_41888.rs:+3:18: +3:19 _3 = E::F(move _4); // scope 1 at $DIR/issue_41888.rs:+3:13: +3:20 StorageDead(_4); // scope 1 at $DIR/issue_41888.rs:+3:19: +3:20 -- replace(_1 <- move _3) -> [return: bb3, unwind: bb10]; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 -+ goto -> bb14; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 +- drop(_1) -> [return: bb3, unwind: bb4]; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 ++ goto -> bb3; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 } bb3: { -- drop(_3) -> [return: bb4, unwind: bb11]; // scope 1 at $DIR/issue_41888.rs:+3:19: +3:20 -+ goto -> bb4; // scope 1 at $DIR/issue_41888.rs:+3:19: +3:20 ++ _7 = const true; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 ++ _8 = const true; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 ++ _9 = const true; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 + _1 = move _3; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 +- drop(_3) -> [return: bb5, unwind: bb11]; // scope 1 at $DIR/issue_41888.rs:+3:19: +3:20 ++ goto -> bb5; // scope 1 at $DIR/issue_41888.rs:+3:19: +3:20 } - bb4: { + bb4 (cleanup): { + _1 = move _3; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 + drop(_3) -> [return: bb11, unwind terminate]; // scope 1 at $DIR/issue_41888.rs:+3:19: +3:20 + } + + bb5: { StorageDead(_3); // scope 1 at $DIR/issue_41888.rs:+3:19: +3:20 _5 = discriminant(_1); // scope 2 at $DIR/issue_41888.rs:+4:16: +4:24 - switchInt(move _5) -> [0: bb5, otherwise: bb6]; // scope 2 at $DIR/issue_41888.rs:+4:16: +4:24 + switchInt(move _5) -> [0: bb6, otherwise: bb7]; // scope 2 at $DIR/issue_41888.rs:+4:16: +4:24 } - bb5: { + bb6: { StorageLive(_6); // scope 2 at $DIR/issue_41888.rs:+4:21: +4:23 + _9 = const false; // scope 2 at $DIR/issue_41888.rs:+4:21: +4:23 _6 = move ((_1 as F).0: K); // scope 2 at $DIR/issue_41888.rs:+4:21: +4:23 _0 = const (); // scope 2 at $DIR/issue_41888.rs:+4:29: +7:10 StorageDead(_6); // scope 1 at $DIR/issue_41888.rs:+7:9: +7:10 - goto -> bb8; // scope 1 at $DIR/issue_41888.rs:+4:9: +7:10 + goto -> bb9; // scope 1 at $DIR/issue_41888.rs:+4:9: +7:10 } - bb6: { + bb7: { _0 = const (); // scope 1 at $DIR/issue_41888.rs:+7:10: +7:10 - goto -> bb8; // scope 1 at $DIR/issue_41888.rs:+4:9: +7:10 + goto -> bb9; // scope 1 at $DIR/issue_41888.rs:+4:9: +7:10 } - bb7: { + bb8: { _0 = const (); // scope 1 at $DIR/issue_41888.rs:+8:6: +8:6 - goto -> bb8; // scope 1 at $DIR/issue_41888.rs:+2:5: +8:6 + goto -> bb9; // scope 1 at $DIR/issue_41888.rs:+2:5: +8:6 } - bb8: { + bb9: { StorageDead(_2); // scope 1 at $DIR/issue_41888.rs:+8:5: +8:6 -- drop(_1) -> bb9; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 -+ goto -> bb20; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 +- drop(_1) -> bb10; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ goto -> bb19; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 } - bb9: { + bb10: { + _7 = const false; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 + _8 = const false; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 + _9 = const false; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 @@ -91,12 +100,8 @@ return; // scope 0 at $DIR/issue_41888.rs:+9:2: +9:2 } - bb10 (cleanup): { - drop(_3) -> bb11; // scope 1 at $DIR/issue_41888.rs:+3:19: +3:20 - } - bb11 (cleanup): { -- drop(_1) -> bb12; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 +- drop(_1) -> [return: bb12, unwind terminate]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 + goto -> bb12; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 } @@ -105,54 +110,42 @@ + } + + bb13 (cleanup): { -+ _7 = const true; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 -+ _8 = const true; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 -+ _9 = const true; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 -+ _1 = move _3; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 -+ goto -> bb12; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 ++ unreachable; // scope 0 at $DIR/issue_41888.rs:+0:1: +9:2 + } + + bb14: { -+ _7 = const true; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 -+ _8 = const true; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 -+ _9 = const true; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 -+ _1 = move _3; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 -+ goto -> bb3; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 -+ } -+ -+ bb15: { + _7 = const false; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 -+ goto -> bb9; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ goto -> bb10; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 + } + -+ bb16 (cleanup): { ++ bb15 (cleanup): { + goto -> bb12; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 + } + -+ bb17: { -+ drop(_1) -> [return: bb15, unwind: bb12]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ bb16: { ++ drop(_1) -> [return: bb14, unwind: bb12]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 + } + -+ bb18 (cleanup): { -+ drop(_1) -> bb12; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ bb17 (cleanup): { ++ drop(_1) -> [return: bb12, unwind terminate]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 + } + -+ bb19: { ++ bb18: { + _10 = discriminant(_1); // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 -+ switchInt(move _10) -> [0: bb15, otherwise: bb17]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ switchInt(move _10) -> [0: bb14, otherwise: bb16]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 + } + -+ bb20: { -+ switchInt(_7) -> [0: bb15, otherwise: bb19]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ bb19: { ++ switchInt(_7) -> [0: bb14, otherwise: bb18]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 + } + -+ bb21 (cleanup): { ++ bb20 (cleanup): { + _11 = discriminant(_1); // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 -+ switchInt(move _11) -> [0: bb16, otherwise: bb18]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ switchInt(move _11) -> [0: bb15, otherwise: bb17]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 + } + -+ bb22 (cleanup): { -+ switchInt(_7) -> [0: bb12, otherwise: bb21]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ bb21 (cleanup): { ++ switchInt(_7) -> [0: bb12, otherwise: bb20]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 } } diff --git a/tests/mir-opt/issue_62289.rs b/tests/mir-opt/issue_62289.rs index 37e3390d5..af1bfea3f 100644 --- a/tests/mir-opt/issue_62289.rs +++ b/tests/mir-opt/issue_62289.rs @@ -2,11 +2,14 @@ // initializing it // ignore-wasm32-bare compiled with panic=abort by default -#![feature(box_syntax)] +#![feature(rustc_attrs)] // EMIT_MIR issue_62289.test.ElaborateDrops.before.mir fn test() -> Option> { - Some(box (None?)) + Some( + #[rustc_box] + Box::new(None?), + ) } fn main() { diff --git a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.mir b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.mir index adfa3a773..8ed910150 100644 --- a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.mir +++ b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.mir @@ -2,121 +2,121 @@ fn test() -> Option> { let mut _0: std::option::Option>; // return place in scope 0 at $DIR/issue_62289.rs:+0:14: +0:30 - let mut _1: std::boxed::Box; // in scope 0 at $DIR/issue_62289.rs:+1:10: +1:21 - let mut _2: usize; // in scope 0 at $DIR/issue_62289.rs:+1:10: +1:21 - let mut _3: usize; // in scope 0 at $DIR/issue_62289.rs:+1:10: +1:21 - let mut _4: *mut u8; // in scope 0 at $DIR/issue_62289.rs:+1:10: +1:21 - let mut _5: std::boxed::Box; // in scope 0 at $DIR/issue_62289.rs:+1:10: +1:21 - let mut _6: std::ops::ControlFlow, u32>; // in scope 0 at $DIR/issue_62289.rs:+1:15: +1:20 - let mut _7: std::option::Option; // in scope 0 at $DIR/issue_62289.rs:+1:15: +1:19 - let mut _8: isize; // in scope 0 at $DIR/issue_62289.rs:+1:19: +1:20 - let _9: std::option::Option; // in scope 0 at $DIR/issue_62289.rs:+1:19: +1:20 - let mut _10: !; // in scope 0 at $DIR/issue_62289.rs:+1:19: +1:20 - let mut _11: std::option::Option; // in scope 0 at $DIR/issue_62289.rs:+1:19: +1:20 - let _12: u32; // in scope 0 at $DIR/issue_62289.rs:+1:15: +1:20 + let mut _1: std::boxed::Box; // in scope 0 at $DIR/issue_62289.rs:+3:9: +3:24 + let mut _2: usize; // in scope 0 at $DIR/issue_62289.rs:+3:9: +3:24 + let mut _3: usize; // in scope 0 at $DIR/issue_62289.rs:+3:9: +3:24 + let mut _4: *mut u8; // in scope 0 at $DIR/issue_62289.rs:+3:9: +3:24 + let mut _5: std::boxed::Box; // in scope 0 at $DIR/issue_62289.rs:+3:9: +3:24 + let mut _6: std::ops::ControlFlow, u32>; // in scope 0 at $DIR/issue_62289.rs:+3:18: +3:23 + let mut _7: std::option::Option; // in scope 0 at $DIR/issue_62289.rs:+3:18: +3:22 + let mut _8: isize; // in scope 0 at $DIR/issue_62289.rs:+3:22: +3:23 + let _9: std::option::Option; // in scope 0 at $DIR/issue_62289.rs:+3:22: +3:23 + let mut _10: !; // in scope 0 at $DIR/issue_62289.rs:+3:22: +3:23 + let mut _11: std::option::Option; // in scope 0 at $DIR/issue_62289.rs:+3:22: +3:23 + let _12: u32; // in scope 0 at $DIR/issue_62289.rs:+3:18: +3:23 scope 1 { } scope 2 { - debug residual => _9; // in scope 2 at $DIR/issue_62289.rs:+1:19: +1:20 + debug residual => _9; // in scope 2 at $DIR/issue_62289.rs:+3:22: +3:23 scope 3 { } } scope 4 { - debug val => _12; // in scope 4 at $DIR/issue_62289.rs:+1:15: +1:20 + debug val => _12; // in scope 4 at $DIR/issue_62289.rs:+3:18: +3:23 scope 5 { } } bb0: { - StorageLive(_1); // scope 0 at $DIR/issue_62289.rs:+1:10: +1:21 - _2 = SizeOf(u32); // scope 1 at $DIR/issue_62289.rs:+1:10: +1:21 - _3 = AlignOf(u32); // scope 1 at $DIR/issue_62289.rs:+1:10: +1:21 - _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> bb1; // scope 1 at $DIR/issue_62289.rs:+1:10: +1:21 + StorageLive(_1); // scope 0 at $DIR/issue_62289.rs:+3:9: +3:24 + _2 = SizeOf(u32); // scope 1 at $DIR/issue_62289.rs:+3:9: +3:24 + _3 = AlignOf(u32); // scope 1 at $DIR/issue_62289.rs:+3:9: +3:24 + _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> bb1; // scope 1 at $DIR/issue_62289.rs:+3:9: +3:24 // mir::Constant - // + span: $DIR/issue_62289.rs:9:10: 9:21 + // + span: $DIR/issue_62289.rs:11:9: 11:24 // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value() } } bb1: { - StorageLive(_5); // scope 0 at $DIR/issue_62289.rs:+1:10: +1:21 - _5 = ShallowInitBox(move _4, u32); // scope 0 at $DIR/issue_62289.rs:+1:10: +1:21 - StorageLive(_6); // scope 0 at $DIR/issue_62289.rs:+1:15: +1:20 - StorageLive(_7); // scope 0 at $DIR/issue_62289.rs:+1:15: +1:19 - _7 = Option::::None; // scope 0 at $DIR/issue_62289.rs:+1:15: +1:19 - _6 = as Try>::branch(move _7) -> [return: bb2, unwind: bb12]; // scope 0 at $DIR/issue_62289.rs:+1:15: +1:20 + StorageLive(_5); // scope 0 at $DIR/issue_62289.rs:+3:9: +3:24 + _5 = ShallowInitBox(move _4, u32); // scope 0 at $DIR/issue_62289.rs:+3:9: +3:24 + StorageLive(_6); // scope 0 at $DIR/issue_62289.rs:+3:18: +3:23 + StorageLive(_7); // scope 0 at $DIR/issue_62289.rs:+3:18: +3:22 + _7 = Option::::None; // scope 0 at $DIR/issue_62289.rs:+3:18: +3:22 + _6 = as Try>::branch(move _7) -> [return: bb2, unwind: bb12]; // scope 0 at $DIR/issue_62289.rs:+3:18: +3:23 // mir::Constant - // + span: $DIR/issue_62289.rs:9:15: 9:20 + // + span: $DIR/issue_62289.rs:11:18: 11:23 // + literal: Const { ty: fn(Option) -> ControlFlow< as Try>::Residual, as Try>::Output> { as Try>::branch}, val: Value() } } bb2: { - StorageDead(_7); // scope 0 at $DIR/issue_62289.rs:+1:19: +1:20 - _8 = discriminant(_6); // scope 0 at $DIR/issue_62289.rs:+1:15: +1:20 - switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb4]; // scope 0 at $DIR/issue_62289.rs:+1:15: +1:20 + StorageDead(_7); // scope 0 at $DIR/issue_62289.rs:+3:22: +3:23 + _8 = discriminant(_6); // scope 0 at $DIR/issue_62289.rs:+3:18: +3:23 + switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb4]; // scope 0 at $DIR/issue_62289.rs:+3:18: +3:23 } bb3: { - StorageLive(_12); // scope 0 at $DIR/issue_62289.rs:+1:15: +1:20 - _12 = ((_6 as Continue).0: u32); // scope 0 at $DIR/issue_62289.rs:+1:15: +1:20 - (*_5) = _12; // scope 5 at $DIR/issue_62289.rs:+1:15: +1:20 - StorageDead(_12); // scope 0 at $DIR/issue_62289.rs:+1:19: +1:20 - _1 = move _5; // scope 0 at $DIR/issue_62289.rs:+1:10: +1:21 - drop(_5) -> [return: bb7, unwind: bb11]; // scope 0 at $DIR/issue_62289.rs:+1:20: +1:21 + StorageLive(_12); // scope 0 at $DIR/issue_62289.rs:+3:18: +3:23 + _12 = ((_6 as Continue).0: u32); // scope 0 at $DIR/issue_62289.rs:+3:18: +3:23 + (*_5) = _12; // scope 5 at $DIR/issue_62289.rs:+3:18: +3:23 + StorageDead(_12); // scope 0 at $DIR/issue_62289.rs:+3:22: +3:23 + _1 = move _5; // scope 0 at $DIR/issue_62289.rs:+3:9: +3:24 + drop(_5) -> [return: bb7, unwind: bb11]; // scope 0 at $DIR/issue_62289.rs:+3:23: +3:24 } bb4: { - unreachable; // scope 0 at $DIR/issue_62289.rs:+1:15: +1:20 + unreachable; // scope 0 at $DIR/issue_62289.rs:+3:18: +3:23 } bb5: { - StorageLive(_9); // scope 0 at $DIR/issue_62289.rs:+1:19: +1:20 - _9 = ((_6 as Break).0: std::option::Option); // scope 0 at $DIR/issue_62289.rs:+1:19: +1:20 - StorageLive(_11); // scope 3 at $DIR/issue_62289.rs:+1:19: +1:20 - _11 = _9; // scope 3 at $DIR/issue_62289.rs:+1:19: +1:20 - _0 = > as FromResidual>>::from_residual(move _11) -> [return: bb6, unwind: bb12]; // scope 3 at $DIR/issue_62289.rs:+1:15: +1:20 + StorageLive(_9); // scope 0 at $DIR/issue_62289.rs:+3:22: +3:23 + _9 = ((_6 as Break).0: std::option::Option); // scope 0 at $DIR/issue_62289.rs:+3:22: +3:23 + StorageLive(_11); // scope 3 at $DIR/issue_62289.rs:+3:22: +3:23 + _11 = _9; // scope 3 at $DIR/issue_62289.rs:+3:22: +3:23 + _0 = > as FromResidual>>::from_residual(move _11) -> [return: bb6, unwind: bb12]; // scope 3 at $DIR/issue_62289.rs:+3:18: +3:23 // mir::Constant - // + span: $DIR/issue_62289.rs:9:19: 9:20 + // + span: $DIR/issue_62289.rs:11:22: 11:23 // + literal: Const { ty: fn(Option) -> Option> {> as FromResidual>>::from_residual}, val: Value() } } bb6: { - StorageDead(_11); // scope 3 at $DIR/issue_62289.rs:+1:19: +1:20 - StorageDead(_9); // scope 0 at $DIR/issue_62289.rs:+1:19: +1:20 - drop(_5) -> bb9; // scope 0 at $DIR/issue_62289.rs:+1:20: +1:21 + StorageDead(_11); // scope 3 at $DIR/issue_62289.rs:+3:22: +3:23 + StorageDead(_9); // scope 0 at $DIR/issue_62289.rs:+3:22: +3:23 + drop(_5) -> bb9; // scope 0 at $DIR/issue_62289.rs:+3:23: +3:24 } bb7: { - StorageDead(_5); // scope 0 at $DIR/issue_62289.rs:+1:20: +1:21 - _0 = Option::>::Some(move _1); // scope 0 at $DIR/issue_62289.rs:+1:5: +1:22 - drop(_1) -> bb8; // scope 0 at $DIR/issue_62289.rs:+1:21: +1:22 + StorageDead(_5); // scope 0 at $DIR/issue_62289.rs:+3:23: +3:24 + _0 = Option::>::Some(move _1); // scope 0 at $DIR/issue_62289.rs:+1:5: +4:6 + drop(_1) -> bb8; // scope 0 at $DIR/issue_62289.rs:+4:5: +4:6 } bb8: { - StorageDead(_1); // scope 0 at $DIR/issue_62289.rs:+1:21: +1:22 - StorageDead(_6); // scope 0 at $DIR/issue_62289.rs:+2:1: +2:2 - goto -> bb10; // scope 0 at $DIR/issue_62289.rs:+2:2: +2:2 + StorageDead(_1); // scope 0 at $DIR/issue_62289.rs:+4:5: +4:6 + StorageDead(_6); // scope 0 at $DIR/issue_62289.rs:+5:1: +5:2 + goto -> bb10; // scope 0 at $DIR/issue_62289.rs:+5:2: +5:2 } bb9: { - StorageDead(_5); // scope 0 at $DIR/issue_62289.rs:+1:20: +1:21 - StorageDead(_1); // scope 0 at $DIR/issue_62289.rs:+1:21: +1:22 - StorageDead(_6); // scope 0 at $DIR/issue_62289.rs:+2:1: +2:2 - goto -> bb10; // scope 0 at $DIR/issue_62289.rs:+2:2: +2:2 + StorageDead(_5); // scope 0 at $DIR/issue_62289.rs:+3:23: +3:24 + StorageDead(_1); // scope 0 at $DIR/issue_62289.rs:+4:5: +4:6 + StorageDead(_6); // scope 0 at $DIR/issue_62289.rs:+5:1: +5:2 + goto -> bb10; // scope 0 at $DIR/issue_62289.rs:+5:2: +5:2 } bb10: { - return; // scope 0 at $DIR/issue_62289.rs:+2:2: +2:2 + return; // scope 0 at $DIR/issue_62289.rs:+5:2: +5:2 } bb11 (cleanup): { - drop(_1) -> bb13; // scope 0 at $DIR/issue_62289.rs:+1:21: +1:22 + drop(_1) -> [return: bb13, unwind terminate]; // scope 0 at $DIR/issue_62289.rs:+4:5: +4:6 } bb12 (cleanup): { - drop(_5) -> bb13; // scope 0 at $DIR/issue_62289.rs:+1:20: +1:21 + drop(_5) -> [return: bb13, unwind terminate]; // scope 0 at $DIR/issue_62289.rs:+3:23: +3:24 } bb13 (cleanup): { - resume; // scope 0 at $DIR/issue_62289.rs:+0:1: +2:2 + resume; // scope 0 at $DIR/issue_62289.rs:+0:1: +5:2 } } diff --git a/tests/mir-opt/issue_72181.main.built.after.mir b/tests/mir-opt/issue_72181.main.built.after.mir index e86836927..724e55e17 100644 --- a/tests/mir-opt/issue_72181.main.built.after.mir +++ b/tests/mir-opt/issue_72181.main.built.after.mir @@ -29,6 +29,7 @@ fn main() -> () { } bb1: { + PlaceMention(_1); // scope 0 at $DIR/issue_72181.rs:+1:13: +1:34 StorageDead(_1); // scope 0 at $DIR/issue_72181.rs:+1:34: +1:35 StorageLive(_2); // scope 1 at $DIR/issue_72181.rs:+3:9: +3:10 StorageLive(_3); // scope 1 at $DIR/issue_72181.rs:+3:14: +3:27 @@ -49,6 +50,7 @@ fn main() -> () { bb2: { _5 = (_2[_6].0: u64); // scope 4 at $DIR/issue_72181.rs:+4:22: +4:28 + PlaceMention(_5); // scope 2 at $DIR/issue_72181.rs:+4:13: +4:30 StorageDead(_6); // scope 2 at $DIR/issue_72181.rs:+4:30: +4:31 StorageDead(_5); // scope 2 at $DIR/issue_72181.rs:+4:30: +4:31 _0 = const (); // scope 0 at $DIR/issue_72181.rs:+0:11: +5:2 diff --git a/tests/mir-opt/issue_72181_1.main.built.after.mir b/tests/mir-opt/issue_72181_1.main.built.after.mir index 2172f3aa9..e1d896cbc 100644 --- a/tests/mir-opt/issue_72181_1.main.built.after.mir +++ b/tests/mir-opt/issue_72181_1.main.built.after.mir @@ -1,8 +1,8 @@ // MIR for `main` after built | User Type Annotations -| 0: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(Void) }, span: $DIR/issue_72181_1.rs:16:12: 16:16, inferred_ty: Void -| 1: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(Void) }, span: $DIR/issue_72181_1.rs:16:12: 16:16, inferred_ty: Void +| 0: user_ty: Canonical { value: Ty(Void), max_universe: U0, variables: [] }, span: $DIR/issue_72181_1.rs:16:12: 16:16, inferred_ty: Void +| 1: user_ty: Canonical { value: Ty(Void), max_universe: U0, variables: [] }, span: $DIR/issue_72181_1.rs:16:12: 16:16, inferred_ty: Void | fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/issue_72181_1.rs:+0:11: +0:11 diff --git a/tests/mir-opt/issue_76432.rs b/tests/mir-opt/issue_76432.rs index fbbfd4ceb..76bb11aae 100644 --- a/tests/mir-opt/issue_76432.rs +++ b/tests/mir-opt/issue_76432.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // compile-flags: -Zmir-enable-passes=-NormalizeArrayLen // Check that we do not insert StorageDead at each target if StorageDead was never seen diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff index cc4f7cc06..abb89b91d 100644 --- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff +++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff @@ -42,7 +42,6 @@ } bb1: { - StorageLive(_15); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL _15 = core::panicking::panic(const "internal error: entered unreachable code"); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/panic.rs:LL:COL diff --git a/tests/mir-opt/issue_91633.bar.built.after.mir b/tests/mir-opt/issue_91633.bar.built.after.mir index c3fb90e84..88a383015 100644 --- a/tests/mir-opt/issue_91633.bar.built.after.mir +++ b/tests/mir-opt/issue_91633.bar.built.after.mir @@ -20,6 +20,7 @@ fn bar(_1: Box<[T]>) -> () { bb1: { StorageDead(_3); // scope 0 at $DIR/issue_91633.rs:+4:18: +4:19 + PlaceMention((*_2)); // scope 0 at $DIR/issue_91633.rs:+4:14: +4:19 StorageDead(_2); // scope 0 at $DIR/issue_91633.rs:+4:19: +4:20 _0 = const (); // scope 0 at $DIR/issue_91633.rs:+3:2: +5:3 drop(_1) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/issue_91633.rs:+5:2: +5:3 @@ -30,7 +31,7 @@ fn bar(_1: Box<[T]>) -> () { } bb3 (cleanup): { - drop(_1) -> bb4; // scope 0 at $DIR/issue_91633.rs:+5:2: +5:3 + drop(_1) -> [return: bb4, unwind terminate]; // scope 0 at $DIR/issue_91633.rs:+5:2: +5:3 } bb4 (cleanup): { diff --git a/tests/mir-opt/issue_91633.foo.built.after.mir b/tests/mir-opt/issue_91633.foo.built.after.mir index 4e3dd365e..569135803 100644 --- a/tests/mir-opt/issue_91633.foo.built.after.mir +++ b/tests/mir-opt/issue_91633.foo.built.after.mir @@ -48,7 +48,7 @@ fn foo(_1: Box<[T]>) -> T { } bb5 (cleanup): { - drop(_1) -> bb6; // scope 0 at $DIR/issue_91633.rs:+4:2: +4:3 + drop(_1) -> [return: bb6, unwind terminate]; // scope 0 at $DIR/issue_91633.rs:+4:2: +4:3 } bb6 (cleanup): { diff --git a/tests/mir-opt/issue_91633.hey.built.after.mir b/tests/mir-opt/issue_91633.hey.built.after.mir index ccb06dd59..19f0c133e 100644 --- a/tests/mir-opt/issue_91633.hey.built.after.mir +++ b/tests/mir-opt/issue_91633.hey.built.after.mir @@ -23,6 +23,7 @@ fn hey(_1: &[T]) -> () { bb1: { StorageDead(_4); // scope 0 at $DIR/issue_91633.rs:+4:19: +4:20 _2 = &(*_3); // scope 0 at $DIR/issue_91633.rs:+4:14: +4:20 + PlaceMention(_2); // scope 0 at $DIR/issue_91633.rs:+4:14: +4:20 StorageDead(_2); // scope 0 at $DIR/issue_91633.rs:+4:20: +4:21 _0 = const (); // scope 0 at $DIR/issue_91633.rs:+3:2: +5:3 StorageDead(_3); // scope 0 at $DIR/issue_91633.rs:+5:2: +5:3 diff --git a/tests/mir-opt/issue_99325.main.built.after.mir b/tests/mir-opt/issue_99325.main.built.after.mir index 3e035c18d..2324f5356 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 { max_universe: U0, variables: [], value: TypeOf(DefId(0:3 ~ issue_99325[8f58]::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 }) }, span: $DIR/issue_99325.rs:10:16: 10:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} -| 1: user_ty: Canonical { max_universe: U0, variables: [], value: TypeOf(DefId(0:3 ~ issue_99325[8f58]::function_with_bytes), UserSubsts { substs: [Const { ty: &'static [u8; 4], kind: Unevaluated(UnevaluatedConst { def: WithOptConstParam { did: DefId(0:8 ~ issue_99325[8f58]::main::{constant#1}), const_param_did: Some(DefId(0:4 ~ issue_99325[8f58]::function_with_bytes::BYTES)) }, substs: [] }) }], user_self_ty: None }) }, 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: 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">} | 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 291fc5063..42b605326 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 @@ -5,7 +5,7 @@ fn num_to_digit(_1: char) -> u32 { 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:14:12: 14: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 @@ -15,7 +15,7 @@ fn num_to_digit(_1: char) -> u32 { let mut _6: 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:14:42: 14:50 + 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 @@ -38,7 +38,7 @@ fn num_to_digit(_1: char) -> u32 { StorageLive(_2); // scope 0 at $DIR/issue_59352.rs:+2:26: +2:41 _2 = char::methods::::to_digit(_1, const 8_u32) -> bb2; // scope 0 at $DIR/issue_59352.rs:+2:26: +2:41 // mir::Constant - // + span: $DIR/issue_59352.rs:14:30: 14:38 + // + span: $DIR/issue_59352.rs:15:30: 15:38 // + literal: Const { ty: fn(char, u32) -> Option {char::methods::::to_digit}, val: Value() } } @@ -66,7 +66,6 @@ fn num_to_digit(_1: char) -> u32 { } bb6: { - StorageLive(_8); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL _8 = 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 diff --git a/tests/mir-opt/issues/issue_59352.rs b/tests/mir-opt/issues/issue_59352.rs index 1e0045555..92011bd65 100644 --- a/tests/mir-opt/issues/issue_59352.rs +++ b/tests/mir-opt/issues/issue_59352.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // This test is a mirror of codegen/issue-59352.rs. // The LLVM inliner doesn't inline `char::method::is_digit()` and so it doesn't recognize this case // as effectively `if x.is_some() { x.unwrap() } else { 0 }`. diff --git a/tests/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff b/tests/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff index bcda12880..8e6e6fc0e 100644 --- a/tests/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff +++ b/tests/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff @@ -24,61 +24,49 @@ StorageLive(_2); // scope 0 at $DIR/issue_75439.rs:+2:9: +2:15 StorageLive(_3); // scope 2 at $DIR/issue_75439.rs:+2:47: +2:52 _3 = _1; // scope 2 at $DIR/issue_75439.rs:+2:47: +2:52 - _2 = transmute::<[u8; 16], [u32; 4]>(move _3) -> bb1; // scope 2 at $DIR/issue_75439.rs:+2:37: +2:53 - // mir::Constant - // + span: $DIR/issue_75439.rs:8:37: 8:46 - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn([u8; 16]) -> [u32; 4] {transmute::<[u8; 16], [u32; 4]>}, val: Value() } + _2 = move _3 as [u32; 4] (Transmute); // scope 2 at $DIR/issue_75439.rs:+2:37: +2:53 + StorageDead(_3); // scope 2 at $DIR/issue_75439.rs:+2:52: +2:53 + switchInt(_2[0 of 4]) -> [0: bb1, otherwise: bb6]; // scope 3 at $DIR/issue_75439.rs:+4:12: +4:30 } bb1: { - StorageDead(_3); // scope 2 at $DIR/issue_75439.rs:+2:52: +2:53 - switchInt(_2[0 of 4]) -> [0: bb2, otherwise: bb8]; // scope 3 at $DIR/issue_75439.rs:+4:12: +4:30 + switchInt(_2[1 of 4]) -> [0: bb2, otherwise: bb6]; // scope 3 at $DIR/issue_75439.rs:+4:12: +4:30 } bb2: { - switchInt(_2[1 of 4]) -> [0: bb3, otherwise: bb8]; // scope 3 at $DIR/issue_75439.rs:+4:12: +4:30 + switchInt(_2[2 of 4]) -> [0: bb4, 4294901760: bb5, otherwise: bb6]; // scope 3 at $DIR/issue_75439.rs:+4:12: +4:30 } bb3: { - switchInt(_2[2 of 4]) -> [0: bb5, 4294901760: bb6, otherwise: bb8]; // scope 3 at $DIR/issue_75439.rs:+4:12: +4:30 - } - - bb4: { StorageLive(_5); // scope 3 at $DIR/issue_75439.rs:+5:14: +5:38 StorageLive(_6); // scope 4 at $DIR/issue_75439.rs:+5:33: +5:35 _6 = _4; // scope 4 at $DIR/issue_75439.rs:+5:33: +5:35 - _5 = transmute::(move _6) -> bb7; // scope 4 at $DIR/issue_75439.rs:+5:23: +5:36 - // mir::Constant - // + span: $DIR/issue_75439.rs:11:23: 11:32 - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u32) -> [u8; 4] {transmute::}, val: Value() } + _5 = move _6 as [u8; 4] (Transmute); // scope 4 at $DIR/issue_75439.rs:+5:23: +5:36 + StorageDead(_6); // scope 4 at $DIR/issue_75439.rs:+5:35: +5:36 + _0 = Option::<[u8; 4]>::Some(move _5); // scope 3 at $DIR/issue_75439.rs:+5:9: +5:39 + StorageDead(_5); // scope 3 at $DIR/issue_75439.rs:+5:38: +5:39 + StorageDead(_4); // scope 1 at $DIR/issue_75439.rs:+6:5: +6:6 + goto -> bb7; // scope 1 at $DIR/issue_75439.rs:+4:5: +8:6 } - bb5: { + bb4: { StorageLive(_4); // scope 3 at $DIR/issue_75439.rs:+4:27: +4:29 _4 = _2[3 of 4]; // scope 3 at $DIR/issue_75439.rs:+4:27: +4:29 - goto -> bb4; // scope 3 at $DIR/issue_75439.rs:+4:12: +4:30 + goto -> bb3; // scope 3 at $DIR/issue_75439.rs:+4:12: +4:30 } - bb6: { + bb5: { StorageLive(_4); // scope 3 at $DIR/issue_75439.rs:+4:27: +4:29 _4 = _2[3 of 4]; // scope 3 at $DIR/issue_75439.rs:+4:27: +4:29 - goto -> bb4; // scope 3 at $DIR/issue_75439.rs:+4:12: +4:30 + goto -> bb3; // scope 3 at $DIR/issue_75439.rs:+4:12: +4:30 } - bb7: { - StorageDead(_6); // scope 4 at $DIR/issue_75439.rs:+5:35: +5:36 - _0 = Option::<[u8; 4]>::Some(move _5); // scope 3 at $DIR/issue_75439.rs:+5:9: +5:39 - StorageDead(_5); // scope 3 at $DIR/issue_75439.rs:+5:38: +5:39 - StorageDead(_4); // scope 1 at $DIR/issue_75439.rs:+6:5: +6:6 - goto -> bb9; // scope 1 at $DIR/issue_75439.rs:+4:5: +8:6 - } - - bb8: { + bb6: { _0 = Option::<[u8; 4]>::None; // scope 1 at $DIR/issue_75439.rs:+7:9: +7:13 - goto -> bb9; // scope 1 at $DIR/issue_75439.rs:+4:5: +8:6 + goto -> bb7; // scope 1 at $DIR/issue_75439.rs:+4:5: +8:6 } - bb9: { + bb7: { StorageDead(_2); // scope 0 at $DIR/issue_75439.rs:+9:1: +9:2 return; // scope 0 at $DIR/issue_75439.rs:+9:2: +9:2 } diff --git a/tests/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir b/tests/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir index 4ee2dae49..43d00b29e 100644 --- a/tests/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir +++ b/tests/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir @@ -35,7 +35,7 @@ fn main() -> () { } bb3: { - falseUnwind -> [real: bb4, cleanup: bb5]; // scope 0 at $DIR/loop_test.rs:+7:5: +10:6 + falseUnwind -> [real: bb4, unwind: bb5]; // scope 0 at $DIR/loop_test.rs:+7:5: +10:6 } bb4: { diff --git a/tests/mir-opt/lower_array_len.rs b/tests/mir-opt/lower_array_len.rs index 972d46cb8..e1bb51f2d 100644 --- a/tests/mir-opt/lower_array_len.rs +++ b/tests/mir-opt/lower_array_len.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: NormalizeArrayLen // compile-flags: -Zmir-enable-passes=+LowerSliceLenCalls diff --git a/tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.diff index 3389db733..dd742d87a 100644 --- a/tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.diff +++ b/tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.diff @@ -5,7 +5,7 @@ let mut _0: usize; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:25: +0:30 bb0: { -- _0 = std::intrinsics::min_align_of::() -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:42 +- _0 = std::intrinsics::min_align_of::() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:42 - // mir::Constant - // + span: $DIR/lower_intrinsics.rs:21:5: 21:40 - // + literal: Const { ty: extern "rust-intrinsic" fn() -> usize {std::intrinsics::min_align_of::}, val: Value() } diff --git a/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.diff index d9898d8e0..e95c3f9bc 100644 --- a/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.diff +++ b/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.diff @@ -9,9 +9,9 @@ bb0: { StorageLive(_1); // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:38 -- _1 = std::intrinsics::assume(const true) -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:38 +- _1 = std::intrinsics::assume(const true) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:38 - // mir::Constant -- // + span: $DIR/lower_intrinsics.rs:72:9: 72:32 +- // + span: $DIR/lower_intrinsics.rs:106:9: 106:32 - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(bool) {std::intrinsics::assume}, val: Value() } + assume(const true); // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:38 + goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:38 diff --git a/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff index d962ef8cb..1f03b7b0b 100644 --- a/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff +++ b/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff @@ -29,9 +29,9 @@ StorageLive(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:42: +1:44 _4 = &_1; // scope 0 at $DIR/lower_intrinsics.rs:+1:42: +1:44 _3 = &(*_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:42: +1:44 -- _2 = discriminant_value::(move _3) -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:45 +- _2 = discriminant_value::(move _3) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:45 - // mir::Constant -- // + span: $DIR/lower_intrinsics.rs:49:5: 49:41 +- // + span: $DIR/lower_intrinsics.rs:82:5: 82:41 - // + literal: Const { ty: for<'a> extern "rust-intrinsic" fn(&'a T) -> ::Discriminant {discriminant_value::}, val: Value() } + _2 = discriminant((*_3)); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:45 + goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:45 @@ -46,13 +46,13 @@ StorageLive(_7); // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44 _19 = const _; // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44 // mir::Constant - // + span: $DIR/lower_intrinsics.rs:50:42: 50:44 + // + span: $DIR/lower_intrinsics.rs:83:42: 83:44 // + literal: Const { ty: &i32, val: Unevaluated(discriminant, [T], Some(promoted[2])) } _7 = &(*_19); // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44 _6 = &(*_7); // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44 -- _5 = discriminant_value::(move _6) -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:45 +- _5 = discriminant_value::(move _6) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:45 - // mir::Constant -- // + span: $DIR/lower_intrinsics.rs:50:5: 50:41 +- // + span: $DIR/lower_intrinsics.rs:83:5: 83:41 - // + literal: Const { ty: for<'a> extern "rust-intrinsic" fn(&'a i32) -> ::Discriminant {discriminant_value::}, val: Value() } + _5 = discriminant((*_6)); // scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:45 + goto -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:45 @@ -67,13 +67,13 @@ StorageLive(_11); // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45 _18 = const _; // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45 // mir::Constant - // + span: $DIR/lower_intrinsics.rs:51:42: 51:45 + // + span: $DIR/lower_intrinsics.rs:84:42: 84:45 // + literal: Const { ty: &(), val: Unevaluated(discriminant, [T], Some(promoted[1])) } _11 = &(*_18); // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45 _10 = &(*_11); // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45 -- _9 = discriminant_value::<()>(move _10) -> bb3; // scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:46 +- _9 = discriminant_value::<()>(move _10) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:46 - // mir::Constant -- // + span: $DIR/lower_intrinsics.rs:51:5: 51:41 +- // + span: $DIR/lower_intrinsics.rs:84:5: 84:41 - // + literal: Const { ty: for<'a> extern "rust-intrinsic" fn(&'a ()) -> <() as DiscriminantKind>::Discriminant {discriminant_value::<()>}, val: Value() } + _9 = discriminant((*_10)); // scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:46 + goto -> bb3; // scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:46 @@ -88,13 +88,13 @@ StorageLive(_15); // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47 _17 = const _; // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47 // mir::Constant - // + span: $DIR/lower_intrinsics.rs:52:42: 52:47 + // + span: $DIR/lower_intrinsics.rs:85:42: 85:47 // + literal: Const { ty: &E, val: Unevaluated(discriminant, [T], Some(promoted[0])) } _15 = &(*_17); // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47 _14 = &(*_15); // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47 -- _13 = discriminant_value::(move _14) -> bb4; // scope 0 at $DIR/lower_intrinsics.rs:+4:5: +4:48 +- _13 = discriminant_value::(move _14) -> [return: bb4, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+4:5: +4:48 - // mir::Constant -- // + span: $DIR/lower_intrinsics.rs:52:5: 52:41 +- // + span: $DIR/lower_intrinsics.rs:85:5: 85:41 - // + literal: Const { ty: for<'a> extern "rust-intrinsic" fn(&'a E) -> ::Discriminant {discriminant_value::}, val: Value() } + _13 = discriminant((*_14)); // scope 0 at $DIR/lower_intrinsics.rs:+4:5: +4:48 + goto -> bb4; // scope 0 at $DIR/lower_intrinsics.rs:+4:5: +4:48 diff --git a/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.diff index 5c972a00e..a54e9a932 100644 --- a/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.diff +++ b/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.diff @@ -47,9 +47,9 @@ _9 = _10; // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:79 _8 = move _9 as *mut i32 (PtrToPtr); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:91 StorageDead(_9); // scope 3 at $DIR/lower_intrinsics.rs:+4:90: +4:91 -- _3 = copy_nonoverlapping::(move _4, move _8, const 0_usize) -> bb1; // scope 3 at $DIR/lower_intrinsics.rs:+4:9: +4:95 +- _3 = copy_nonoverlapping::(move _4, move _8, const 0_usize) -> [return: bb1, unwind unreachable]; // scope 3 at $DIR/lower_intrinsics.rs:+4:9: +4:95 - // mir::Constant -- // + span: $DIR/lower_intrinsics.rs:65:9: 65:28 +- // + span: $DIR/lower_intrinsics.rs:99:9: 99:28 - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const i32, *mut i32, usize) {copy_nonoverlapping::}, val: Value() } + copy_nonoverlapping(dst = move _8, src = move _4, count = const 0_usize); // scope 3 at $DIR/lower_intrinsics.rs:+4:9: +4:95 + goto -> bb1; // scope 3 at $DIR/lower_intrinsics.rs:+4:9: +4:95 diff --git a/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.diff index 4cbbc02c9..bfb000ccd 100644 --- a/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.diff +++ b/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.diff @@ -9,7 +9,7 @@ bb0: { StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:+1:30: +1:31 _2 = move _1; // scope 0 at $DIR/lower_intrinsics.rs:+1:30: +1:31 -- _0 = std::intrinsics::forget::(move _2) -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:32 +- _0 = std::intrinsics::forget::(move _2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:32 - // mir::Constant - // + span: $DIR/lower_intrinsics.rs:26:5: 26:29 - // + literal: Const { ty: extern "rust-intrinsic" fn(T) {std::intrinsics::forget::}, val: Value() } diff --git a/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.diff index d8cd5f59a..64d82907c 100644 --- a/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.diff +++ b/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.diff @@ -17,7 +17,7 @@ // + literal: Const { ty: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::}, val: Value() } StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+3:5: +3:14 _2 = _1; // scope 1 at $DIR/lower_intrinsics.rs:+3:5: +3:14 -- _0 = move _2() -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+3:5: +3:16 +- _0 = move _2() -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+3:5: +3:16 + _0 = SizeOf(T); // scope 1 at $DIR/lower_intrinsics.rs:+3:5: +3:16 + goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+3:5: +3:16 } diff --git a/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff new file mode 100644 index 000000000..cc5079af7 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff @@ -0,0 +1,54 @@ +- // MIR for `option_payload` before LowerIntrinsics ++ // MIR for `option_payload` after LowerIntrinsics + + fn option_payload(_1: &Option, _2: &Option) -> () { + debug o => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:23: +0:24 + debug p => _2; // in scope 0 at $DIR/lower_intrinsics.rs:+0:42: +0:43 + let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:62: +0:62 + let mut _4: *const std::option::Option; // in scope 0 at $DIR/lower_intrinsics.rs:+2:55: +2:56 + let mut _6: *const std::option::Option; // in scope 0 at $DIR/lower_intrinsics.rs:+3:55: +3:56 + scope 1 { + let _3: *const usize; // in scope 1 at $DIR/lower_intrinsics.rs:+2:13: +2:15 + scope 2 { + debug _x => _3; // in scope 2 at $DIR/lower_intrinsics.rs:+2:13: +2:15 + let _5: *const std::string::String; // in scope 2 at $DIR/lower_intrinsics.rs:+3:13: +3:15 + scope 3 { + debug _y => _5; // in scope 3 at $DIR/lower_intrinsics.rs:+3:13: +3:15 + } + } + } + + bb0: { + StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:+2:13: +2:15 + StorageLive(_4); // scope 1 at $DIR/lower_intrinsics.rs:+2:55: +2:56 + _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 +- // + 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 + } + + bb1: { + StorageDead(_4); // scope 1 at $DIR/lower_intrinsics.rs:+2:56: +2:57 + StorageLive(_5); // scope 2 at $DIR/lower_intrinsics.rs:+3:13: +3:15 + StorageLive(_6); // scope 2 at $DIR/lower_intrinsics.rs:+3:55: +3:56 + _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 +- // + 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 + } + + bb2: { + StorageDead(_6); // scope 2 at $DIR/lower_intrinsics.rs:+3:56: +3:57 + _0 = const (); // scope 1 at $DIR/lower_intrinsics.rs:+1:5: +4:6 + StorageDead(_5); // scope 2 at $DIR/lower_intrinsics.rs:+4:5: +4:6 + StorageDead(_3); // scope 1 at $DIR/lower_intrinsics.rs:+4:5: +4:6 + return; // scope 0 at $DIR/lower_intrinsics.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.diff new file mode 100644 index 000000000..5805df48f --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.diff @@ -0,0 +1,27 @@ +- // MIR for `read_via_copy_primitive` before LowerIntrinsics ++ // MIR for `read_via_copy_primitive` after LowerIntrinsics + + fn read_via_copy_primitive(_1: &i32) -> i32 { + debug r => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:32: +0:33 + let mut _0: i32; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:44: +0:47 + let mut _2: *const i32; // in scope 0 at $DIR/lower_intrinsics.rs:+1:46: +1:47 + scope 1 { + } + + bb0: { + StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:46: +1:47 + _2 = &raw const (*_1); // scope 1 at $DIR/lower_intrinsics.rs:+1:46: +1:47 +- _0 = read_via_copy::(move _2) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:48 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:119:14: 119:45 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const i32) -> i32 {read_via_copy::}, val: Value() } ++ _0 = (*_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:48 ++ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:48 + } + + bb1: { + StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:47: +1:48 + return; // scope 0 at $DIR/lower_intrinsics.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.diff new file mode 100644 index 000000000..95b2ec49d --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.diff @@ -0,0 +1,21 @@ +- // MIR for `read_via_copy_uninhabited` before LowerIntrinsics ++ // MIR for `read_via_copy_uninhabited` after LowerIntrinsics + + fn read_via_copy_uninhabited(_1: &Never) -> Never { + debug r => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:34: +0:35 + let mut _0: Never; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:48: +0:53 + let mut _2: *const Never; // in scope 0 at $DIR/lower_intrinsics.rs:+1:46: +1:47 + scope 1 { + } + + bb0: { + StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:46: +1:47 + _2 = &raw const (*_1); // scope 1 at $DIR/lower_intrinsics.rs:+1:46: +1:47 +- _0 = read_via_copy::(move _2) -> unwind unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:48 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:124:14: 124:45 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const Never) -> Never {read_via_copy::}, val: Value() } ++ unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:48 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.rs b/tests/mir-opt/lower_intrinsics.rs index 7147be43c..33fef930a 100644 --- a/tests/mir-opt/lower_intrinsics.rs +++ b/tests/mir-opt/lower_intrinsics.rs @@ -1,7 +1,7 @@ // unit-test: LowerIntrinsics // ignore-wasm32 compiled with panic=abort by default -#![feature(core_intrinsics, intrinsics)] +#![feature(core_intrinsics, intrinsics, rustc_attrs)] #![crate_type = "lib"] // EMIT_MIR lower_intrinsics.wrapping.LowerIntrinsics.diff @@ -38,6 +38,39 @@ pub fn non_const() -> usize { size_of_t() } +// EMIT_MIR lower_intrinsics.transmute_inhabited.LowerIntrinsics.diff +pub fn transmute_inhabited(c: std::cmp::Ordering) -> i8 { + unsafe { std::mem::transmute(c) } +} + +// EMIT_MIR lower_intrinsics.transmute_uninhabited.LowerIntrinsics.diff +pub unsafe fn transmute_uninhabited(u: ()) -> Never { + unsafe { std::mem::transmute::<(), Never>(u) } +} + +// EMIT_MIR lower_intrinsics.transmute_ref_dst.LowerIntrinsics.diff +pub unsafe fn transmute_ref_dst(u: &T) -> *const T { + unsafe { std::mem::transmute(u) } +} + +// EMIT_MIR lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff +pub unsafe fn transmute_to_ref_uninhabited() -> ! { + let x: &Never = std::mem::transmute(1usize); + match *x {} +} + +// EMIT_MIR lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff +pub unsafe fn transmute_to_mut_uninhabited() -> ! { + let x: &mut Never = std::mem::transmute(1usize); + match *x {} +} + +// EMIT_MIR lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff +pub unsafe fn transmute_to_box_uninhabited() -> ! { + let x: Box = std::mem::transmute(1usize); + match *x {} +} + pub enum E { A, B, @@ -54,6 +87,7 @@ pub fn discriminant(t: T) { extern "rust-intrinsic" { // Cannot use `std::intrinsics::copy_nonoverlapping` as that is a wrapper function + #[rustc_nounwind] fn copy_nonoverlapping(src: *const T, dst: *mut T, count: usize); } @@ -79,3 +113,24 @@ pub fn with_overflow(a: i32, b: i32) { let _y = core::intrinsics::sub_with_overflow(a, b); let _z = core::intrinsics::mul_with_overflow(a, b); } + +// EMIT_MIR lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.diff +pub fn read_via_copy_primitive(r: &i32) -> i32 { + unsafe { core::intrinsics::read_via_copy(r) } +} + +// EMIT_MIR lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.diff +pub fn read_via_copy_uninhabited(r: &Never) -> Never { + unsafe { core::intrinsics::read_via_copy(r) } +} + +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); + } +} diff --git a/tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.diff index cf0ab73a5..27e8accea 100644 --- a/tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.diff +++ b/tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.diff @@ -5,7 +5,7 @@ let mut _0: usize; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:24: +0:29 bb0: { -- _0 = std::intrinsics::size_of::() -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:37 +- _0 = std::intrinsics::size_of::() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:37 - // mir::Constant - // + span: $DIR/lower_intrinsics.rs:16:5: 16:35 - // + literal: Const { ty: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::}, val: Value() } diff --git a/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.diff new file mode 100644 index 000000000..1b3b76851 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.diff @@ -0,0 +1,27 @@ +- // MIR for `transmute_inhabited` before LowerIntrinsics ++ // MIR for `transmute_inhabited` after LowerIntrinsics + + fn transmute_inhabited(_1: std::cmp::Ordering) -> i8 { + debug c => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:28: +0:29 + let mut _0: i8; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:54: +0:56 + let mut _2: std::cmp::Ordering; // in scope 0 at $DIR/lower_intrinsics.rs:+1:34: +1:35 + scope 1 { + } + + bb0: { + StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:34: +1:35 + _2 = _1; // scope 1 at $DIR/lower_intrinsics.rs:+1:34: +1:35 +- _0 = transmute::(move _2) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:43:14: 43:33 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(std::cmp::Ordering) -> i8 {transmute::}, val: Value() } ++ _0 = move _2 as i8 (Transmute); // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36 ++ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36 + } + + bb1: { + StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:35: +1:36 + return; // scope 0 at $DIR/lower_intrinsics.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.diff new file mode 100644 index 000000000..c6a7d2287 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.diff @@ -0,0 +1,27 @@ +- // MIR for `transmute_ref_dst` before LowerIntrinsics ++ // MIR for `transmute_ref_dst` after LowerIntrinsics + + fn transmute_ref_dst(_1: &T) -> *const T { + debug u => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:44: +0:45 + let mut _0: *const T; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:54: +0:62 + let mut _2: &T; // in scope 0 at $DIR/lower_intrinsics.rs:+1:34: +1:35 + scope 1 { + } + + bb0: { + StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:34: +1:35 + _2 = _1; // scope 1 at $DIR/lower_intrinsics.rs:+1:34: +1:35 +- _0 = transmute::<&T, *const T>(move _2) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:53:14: 53:33 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&T) -> *const T {transmute::<&T, *const T>}, val: Value() } ++ _0 = move _2 as *const T (Transmute); // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36 ++ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36 + } + + bb1: { + StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:35: +1:36 + return; // scope 0 at $DIR/lower_intrinsics.rs:+2:2: +2:2 + } + } + 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 new file mode 100644 index 000000000..8735a7500 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff @@ -0,0 +1,29 @@ +- // MIR for `transmute_to_box_uninhabited` before LowerIntrinsics ++ // MIR for `transmute_to_box_uninhabited` after LowerIntrinsics + + 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 + scope 1 { + debug x => _2; // 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 +- // 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 ++ 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 new file mode 100644 index 000000000..a77213277 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff @@ -0,0 +1,29 @@ +- // MIR for `transmute_to_mut_uninhabited` before LowerIntrinsics ++ // MIR for `transmute_to_mut_uninhabited` after LowerIntrinsics + + 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 + scope 1 { + debug x => _2; // 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 +- // 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 ++ 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 new file mode 100644 index 000000000..c4d53d4e8 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff @@ -0,0 +1,29 @@ +- // MIR for `transmute_to_ref_uninhabited` before LowerIntrinsics ++ // MIR for `transmute_to_ref_uninhabited` after LowerIntrinsics + + 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 + scope 1 { + debug x => _2; // 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 +- // 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 ++ 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.transmute_uninhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.diff new file mode 100644 index 000000000..f0b76127d --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.diff @@ -0,0 +1,22 @@ +- // MIR for `transmute_uninhabited` before LowerIntrinsics ++ // MIR for `transmute_uninhabited` after LowerIntrinsics + + fn transmute_uninhabited(_1: ()) -> Never { + debug u => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:37: +0:38 + let mut _0: Never; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:47: +0:52 + let mut _2: (); // in scope 0 at $DIR/lower_intrinsics.rs:+1:47: +1:48 + scope 1 { + } + + bb0: { + StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:47: +1:48 + _2 = _1; // scope 1 at $DIR/lower_intrinsics.rs:+1:47: +1:48 +- _0 = transmute::<(), Never>(move _2) -> unwind unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:49 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:48:14: 48:46 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(()) -> Never {transmute::<(), Never>}, val: Value() } ++ _0 = move _2 as Never (Transmute); // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:49 ++ unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:49 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.diff index 6f17d4451..c0cc698c4 100644 --- a/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.diff +++ b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.diff @@ -12,7 +12,7 @@ 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(); // 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 - // 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.with_overflow.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.diff index 9870a70de..9cf4fbb88 100644 --- a/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.diff +++ b/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.diff @@ -30,9 +30,9 @@ _4 = _1; // scope 0 at $DIR/lower_intrinsics.rs:+1:50: +1:51 StorageLive(_5); // scope 0 at $DIR/lower_intrinsics.rs:+1:53: +1:54 _5 = _2; // scope 0 at $DIR/lower_intrinsics.rs:+1:53: +1:54 -- _3 = add_with_overflow::(move _4, move _5) -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:55 +- _3 = add_with_overflow::(move _4, move _5) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:55 - // mir::Constant -- // + span: $DIR/lower_intrinsics.rs:78:14: 78:49 +- // + span: $DIR/lower_intrinsics.rs:112:14: 112:49 - // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> (i32, bool) {add_with_overflow::}, val: Value() } + _3 = CheckedAdd(move _4, move _5); // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:55 + goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:55 @@ -46,9 +46,9 @@ _7 = _1; // scope 1 at $DIR/lower_intrinsics.rs:+2:50: +2:51 StorageLive(_8); // scope 1 at $DIR/lower_intrinsics.rs:+2:53: +2:54 _8 = _2; // scope 1 at $DIR/lower_intrinsics.rs:+2:53: +2:54 -- _6 = sub_with_overflow::(move _7, move _8) -> bb2; // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:55 +- _6 = sub_with_overflow::(move _7, move _8) -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:55 - // mir::Constant -- // + span: $DIR/lower_intrinsics.rs:79:14: 79:49 +- // + span: $DIR/lower_intrinsics.rs:113:14: 113:49 - // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> (i32, bool) {sub_with_overflow::}, val: Value() } + _6 = CheckedSub(move _7, move _8); // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:55 + goto -> bb2; // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:55 @@ -62,9 +62,9 @@ _10 = _1; // scope 2 at $DIR/lower_intrinsics.rs:+3:50: +3:51 StorageLive(_11); // scope 2 at $DIR/lower_intrinsics.rs:+3:53: +3:54 _11 = _2; // scope 2 at $DIR/lower_intrinsics.rs:+3:53: +3:54 -- _9 = mul_with_overflow::(move _10, move _11) -> bb3; // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:55 +- _9 = mul_with_overflow::(move _10, move _11) -> [return: bb3, unwind unreachable]; // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:55 - // mir::Constant -- // + span: $DIR/lower_intrinsics.rs:80:14: 80:49 +- // + span: $DIR/lower_intrinsics.rs:114:14: 114:49 - // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> (i32, bool) {mul_with_overflow::}, val: Value() } + _9 = CheckedMul(move _10, move _11); // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:55 + goto -> bb3; // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:55 diff --git a/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.diff index 22ef75fd8..0bfb34aca 100644 --- a/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.diff +++ b/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.diff @@ -30,7 +30,7 @@ _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) -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:50 +- _3 = 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() } @@ -46,7 +46,7 @@ _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) -> bb2; // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:50 +- _6 = 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() } @@ -62,7 +62,7 @@ _10 = _1; // scope 2 at $DIR/lower_intrinsics.rs:+3:45: +3:46 StorageLive(_11); // scope 2 at $DIR/lower_intrinsics.rs:+3:48: +3:49 _11 = _2; // scope 2 at $DIR/lower_intrinsics.rs:+3:48: +3:49 -- _9 = wrapping_mul::(move _10, move _11) -> bb3; // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:50 +- _9 = wrapping_mul::(move _10, move _11) -> [return: bb3, unwind unreachable]; // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:50 - // mir::Constant - // + span: $DIR/lower_intrinsics.rs:11:14: 11:44 - // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> i32 {wrapping_mul::}, val: Value() } 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 index f6d8bdd74..4f5df1331 100644 --- a/tests/mir-opt/lower_intrinsics_e2e.f_u64.PreCodegen.after.mir +++ b/tests/mir-opt/lower_intrinsics_e2e.f_u64.PreCodegen.after.mir @@ -12,15 +12,13 @@ fn f_u64() -> () { bb0: { StorageLive(_1); // scope 0 at $DIR/lower_intrinsics_e2e.rs:+1:5: +1:21 - StorageLive(_2); // scope 1 at $DIR/lower_intrinsics_e2e.rs:23:9: 23:21 - _2 = f_non_zst::(const 0_u64) -> bb1; // scope 1 at $DIR/lower_intrinsics_e2e.rs:23:9: 23: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(_2); // scope 1 at $DIR/lower_intrinsics_e2e.rs:23:21: 23:22 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 index b672e1a6e..8654e80cd 100644 --- a/tests/mir-opt/lower_intrinsics_e2e.f_unit.PreCodegen.after.mir +++ b/tests/mir-opt/lower_intrinsics_e2e.f_unit.PreCodegen.after.mir @@ -2,26 +2,21 @@ fn f_unit() -> () { let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics_e2e.rs:+0:17: +0:17 - let mut _1: (); // in scope 0 at $DIR/lower_intrinsics_e2e.rs:+1:16: +1:18 scope 1 (inlined f_dispatch::<()>) { // at $DIR/lower_intrinsics_e2e.rs:9:5: 9:19 - 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:21:9: 21:17 + 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: { - StorageLive(_1); // scope 0 at $DIR/lower_intrinsics_e2e.rs:+1:16: +1:18 - StorageLive(_2); // scope 1 at $DIR/lower_intrinsics_e2e.rs:21:9: 21:17 - _2 = f_zst::<()>(move _1) -> bb1; // scope 1 at $DIR/lower_intrinsics_e2e.rs:21:9: 21:17 + _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: { - StorageDead(_2); // scope 1 at $DIR/lower_intrinsics_e2e.rs:21:17: 21:18 - StorageDead(_1); // scope 0 at $DIR/lower_intrinsics_e2e.rs:+1:18: +1:19 return; // scope 0 at $DIR/lower_intrinsics_e2e.rs:+2:2: +2:2 } } diff --git a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff index 2b0370cf3..67918e62b 100644 --- a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff +++ b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff @@ -22,7 +22,7 @@ _6 = &(*_2); // scope 0 at $DIR/lower_slice_len.rs:+1:16: +1:27 - _5 = core::slice::::len(move _6) -> bb1; // scope 0 at $DIR/lower_slice_len.rs:+1:16: +1:27 - // mir::Constant -- // + span: $DIR/lower_slice_len.rs:5:22: 5:25 +- // + span: $DIR/lower_slice_len.rs:6:22: 6:25 - // + literal: Const { ty: for<'a> fn(&'a [u8]) -> usize {core::slice::::len}, val: Value() } + _5 = Len((*_6)); // scope 0 at $DIR/lower_slice_len.rs:+1:16: +1:27 + goto -> bb1; // scope 0 at $DIR/lower_slice_len.rs:+1:16: +1:27 diff --git a/tests/mir-opt/lower_slice_len.rs b/tests/mir-opt/lower_slice_len.rs index 12955aed1..9c39c29fc 100644 --- a/tests/mir-opt/lower_slice_len.rs +++ b/tests/mir-opt/lower_slice_len.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: LowerSliceLenCalls // EMIT_MIR lower_slice_len.bound.LowerSliceLenCalls.diff diff --git a/tests/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/tests/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff index 84e4d35f9..3081e78f2 100644 --- a/tests/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff +++ b/tests/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff @@ -243,7 +243,7 @@ } - bb25 (cleanup): { -- drop(_2) -> bb26; // scope 0 at $DIR/match_arm_scopes.rs:+5:1: +5:2 +- drop(_2) -> [return: bb26, unwind terminate]; // scope 0 at $DIR/match_arm_scopes.rs:+5:1: +5:2 + bb22 (cleanup): { + goto -> bb27; // scope 0 at $DIR/match_arm_scopes.rs:+5:1: +5:2 } diff --git a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.mir b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.mir index 0cb34a2f2..950f8758e 100644 --- a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.mir +++ b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.mir @@ -40,7 +40,7 @@ fn main() -> () { } bb3 (cleanup): { - drop(_2) -> bb4; // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:34: +1:35 + drop(_2) -> [return: bb4, unwind terminate]; // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:34: +1:35 } bb4 (cleanup): { diff --git a/tests/mir-opt/nrvo_simple.rs b/tests/mir-opt/nrvo_simple.rs index 5786ae621..525dfe426 100644 --- a/tests/mir-opt/nrvo_simple.rs +++ b/tests/mir-opt/nrvo_simple.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: RenameReturnPlace // EMIT_MIR nrvo_simple.nrvo.RenameReturnPlace.diff diff --git a/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.mir index 210f178a0..81b96e3b6 100644 --- a/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.mir +++ b/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.mir @@ -28,21 +28,21 @@ fn main() -> () { StorageDead(_5); // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:28: +2:29 StorageLive(_6); // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:5: +2:8 _6 = move (_1.0: Aligned); // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:5: +2:8 - drop(_6) -> [return: bb4, unwind: bb3]; // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:5: +2:8 + drop(_6) -> [return: bb4, unwind: bb1]; // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:5: +2:8 } - bb1: { - StorageDead(_1); // scope 0 at $DIR/packed_struct_drop_aligned.rs:+3:1: +3:2 - return; // scope 0 at $DIR/packed_struct_drop_aligned.rs:+3:2: +3:2 + bb1 (cleanup): { + (_1.0: Aligned) = move _4; // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:5: +2:8 + drop(_1) -> [return: bb3, unwind terminate]; // scope 0 at $DIR/packed_struct_drop_aligned.rs:+3:1: +3:2 } - bb2 (cleanup): { - resume; // scope 0 at $DIR/packed_struct_drop_aligned.rs:+0:1: +3:2 + bb2: { + StorageDead(_1); // scope 0 at $DIR/packed_struct_drop_aligned.rs:+3:1: +3:2 + return; // scope 0 at $DIR/packed_struct_drop_aligned.rs:+3:2: +3:2 } bb3 (cleanup): { - (_1.0: Aligned) = move _4; // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:5: +2:8 - drop(_1) -> bb2; // scope 0 at $DIR/packed_struct_drop_aligned.rs:+3:1: +3:2 + resume; // scope 0 at $DIR/packed_struct_drop_aligned.rs:+0:1: +3:2 } bb4: { @@ -50,6 +50,6 @@ fn main() -> () { (_1.0: Aligned) = move _4; // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:5: +2:8 StorageDead(_4); // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:28: +2:29 _0 = const (); // scope 0 at $DIR/packed_struct_drop_aligned.rs:+0:11: +3:2 - drop(_1) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/packed_struct_drop_aligned.rs:+3:1: +3:2 + drop(_1) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/packed_struct_drop_aligned.rs:+3:1: +3:2 } } diff --git a/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff b/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff index a8dd91efc..0e8309532 100644 --- a/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff +++ b/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff @@ -34,7 +34,7 @@ _3 = std::ops::Range:: { start: const 0_i32, end: const 10_i32 }; // scope 1 at $DIR/remove_storage_markers.rs:+2:14: +2:19 _2 = as IntoIterator>::into_iter(move _3) -> bb1; // scope 1 at $DIR/remove_storage_markers.rs:+2:14: +2:19 // mir::Constant - // + span: $DIR/remove_storage_markers.rs:10:14: 10:19 + // + span: $DIR/remove_storage_markers.rs:11:14: 11:19 // + literal: Const { ty: fn(std::ops::Range) -> as IntoIterator>::IntoIter { as IntoIterator>::into_iter}, val: Value() } } @@ -54,7 +54,7 @@ _8 = &mut (*_9); // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19 _7 = as Iterator>::next(move _8) -> bb3; // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19 // mir::Constant - // + span: $DIR/remove_storage_markers.rs:10:14: 10:19 + // + span: $DIR/remove_storage_markers.rs:11:14: 11:19 // + literal: Const { ty: for<'a> fn(&'a mut std::ops::Range) -> Option< as Iterator>::Item> { as Iterator>::next}, val: Value() } } diff --git a/tests/mir-opt/remove_storage_markers.rs b/tests/mir-opt/remove_storage_markers.rs index f00b82691..480db8ac1 100644 --- a/tests/mir-opt/remove_storage_markers.rs +++ b/tests/mir-opt/remove_storage_markers.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: RemoveStorageMarkers // Checks that storage markers are removed at opt-level=0. diff --git a/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.diff b/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.diff index 07e4dd418..7713649c5 100644 --- a/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.diff +++ b/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.diff @@ -11,7 +11,7 @@ } bb0: { - StorageLive(_2); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12 + nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12 StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11 _3 = move _1; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11 drop(_3) -> [return: bb2, unwind: bb1]; // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL @@ -23,7 +23,7 @@ bb2: { StorageDead(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:11: +1:12 - StorageDead(_2); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:12: +1:13 + nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:12: +1:13 nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+0:32: +2:2 return; // scope 0 at $DIR/remove_unneeded_drops.rs:+2:2: +2:2 } diff --git a/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.diff b/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.diff index e809ca4e9..533db4051 100644 --- a/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.diff +++ b/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.diff @@ -11,7 +11,7 @@ } bb0: { - StorageLive(_2); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12 + nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12 StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11 _3 = move _1; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11 drop(_3) -> [return: bb2, unwind: bb1]; // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL @@ -23,7 +23,7 @@ bb2: { StorageDead(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:11: +1:12 - StorageDead(_2); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:12: +1:13 + nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:12: +1:13 nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+0:27: +2:2 return; // scope 0 at $DIR/remove_unneeded_drops.rs:+2:2: +2:2 } diff --git a/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.diff b/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.diff index 087f76dbd..04a2d54e9 100644 --- a/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.diff +++ b/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.diff @@ -11,7 +11,7 @@ } bb0: { - StorageLive(_2); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12 +- nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12 StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11 _3 = _1; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11 - drop(_3) -> bb1; // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL @@ -19,7 +19,7 @@ - - bb1: { StorageDead(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:11: +1:12 - StorageDead(_2); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:12: +1:13 +- nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:12: +1:13 - nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+0:17: +2:2 return; // scope 0 at $DIR/remove_unneeded_drops.rs:+2:2: +2:2 } diff --git a/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.diff b/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.diff index 933d6895f..782d0c6c5 100644 --- a/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.diff +++ b/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.diff @@ -11,7 +11,7 @@ } bb0: { - StorageLive(_2); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12 +- nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12 StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11 _3 = _1; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11 - drop(_3) -> bb1; // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL @@ -19,7 +19,7 @@ - - bb1: { StorageDead(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:11: +1:12 - StorageDead(_2); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:12: +1:13 +- nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:12: +1:13 - nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+0:36: +2:2 return; // scope 0 at $DIR/remove_unneeded_drops.rs:+2:2: +2:2 } diff --git a/tests/mir-opt/remove_zsts.get_union.PreCodegen.after.mir b/tests/mir-opt/remove_zsts.get_union.PreCodegen.after.mir index af34bc5ed..7ac9ef3d4 100644 --- a/tests/mir-opt/remove_zsts.get_union.PreCodegen.after.mir +++ b/tests/mir-opt/remove_zsts.get_union.PreCodegen.after.mir @@ -2,12 +2,9 @@ fn get_union() -> Foo { let mut _0: Foo; // return place in scope 0 at $DIR/remove_zsts.rs:+0:19: +0:22 - let mut _1: (); // in scope 0 at $DIR/remove_zsts.rs:+1:14: +1:16 bb0: { - StorageLive(_1); // scope 0 at $DIR/remove_zsts.rs:+1:14: +1:16 - _0 = Foo { x: move _1 }; // scope 0 at $DIR/remove_zsts.rs:+1:5: +1:18 - StorageDead(_1); // scope 0 at $DIR/remove_zsts.rs:+1:17: +1:18 + _0 = Foo { x: const () }; // scope 0 at $DIR/remove_zsts.rs:+1:5: +1:18 return; // scope 0 at $DIR/remove_zsts.rs:+2:2: +2:2 } } diff --git a/tests/mir-opt/remove_zsts.get_union.RemoveZsts.diff b/tests/mir-opt/remove_zsts.get_union.RemoveZsts.diff index 0af29b2ba..edd86ef0a 100644 --- a/tests/mir-opt/remove_zsts.get_union.RemoveZsts.diff +++ b/tests/mir-opt/remove_zsts.get_union.RemoveZsts.diff @@ -6,11 +6,14 @@ let mut _1: (); // in scope 0 at $DIR/remove_zsts.rs:+1:14: +1:16 bb0: { - StorageLive(_1); // scope 0 at $DIR/remove_zsts.rs:+1:14: +1:16 +- StorageLive(_1); // scope 0 at $DIR/remove_zsts.rs:+1:14: +1:16 - _1 = (); // scope 0 at $DIR/remove_zsts.rs:+1:14: +1:16 +- _0 = Foo { x: move _1 }; // scope 0 at $DIR/remove_zsts.rs:+1:5: +1:18 +- StorageDead(_1); // scope 0 at $DIR/remove_zsts.rs:+1:17: +1:18 + nop; // scope 0 at $DIR/remove_zsts.rs:+1:14: +1:16 - _0 = Foo { x: move _1 }; // scope 0 at $DIR/remove_zsts.rs:+1:5: +1:18 - StorageDead(_1); // scope 0 at $DIR/remove_zsts.rs:+1:17: +1:18 ++ nop; // scope 0 at $DIR/remove_zsts.rs:+1:14: +1:16 ++ _0 = Foo { x: const () }; // scope 0 at $DIR/remove_zsts.rs:+1:5: +1:18 ++ nop; // scope 0 at $DIR/remove_zsts.rs:+1:17: +1:18 return; // scope 0 at $DIR/remove_zsts.rs:+2:2: +2:2 } } diff --git a/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir index d7b6d64b6..4eef028e1 100644 --- a/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir +++ b/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir @@ -108,7 +108,7 @@ fn main() -> () { StorageLive(_14); // scope 1 at $DIR/retag.rs:+11:31: +14:6 _14 = [closure@main::{closure#0}]; // scope 1 at $DIR/retag.rs:+11:31: +14:6 // closure - // + def_id: DefId(0:14 ~ retag[4622]::main::{closure#0}) + // + def_id: DefId(0:14 ~ retag[7654]::main::{closure#0}) // + substs: [ // i8, // for<'a> extern "rust-call" fn((&'a i32,)) -> &'a i32, @@ -186,11 +186,11 @@ fn main() -> () { } bb7 (cleanup): { - drop(_21) -> bb9; // scope 7 at $DIR/retag.rs:+18:24: +18:25 + drop(_21) -> [return: bb9, unwind terminate]; // scope 7 at $DIR/retag.rs:+18:24: +18:25 } bb8 (cleanup): { - drop(_5) -> bb9; // scope 1 at $DIR/retag.rs:+3:36: +3:37 + drop(_5) -> [return: bb9, unwind terminate]; // scope 1 at $DIR/retag.rs:+3:36: +3:37 } bb9 (cleanup): { diff --git a/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff b/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff index cfcd43093..bdf1de468 100644 --- a/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff +++ b/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff @@ -12,7 +12,6 @@ let mut _7: !; // in scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 let mut _8: std::result::Result; // in scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 let _9: i32; // in scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 - let mut _16: i32; // in scope 0 at $SRC_DIR/core/src/result.rs:LL:COL scope 1 { debug residual => _6; // in scope 1 at $DIR/separate_const_switch.rs:+1:9: +1:10 scope 2 { @@ -23,7 +22,7 @@ scope 9 { debug e => _14; // in scope 9 at $SRC_DIR/core/src/result.rs:LL:COL scope 10 (inlined >::from) { // at $SRC_DIR/core/src/result.rs:LL:COL - debug t => _16; // in scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL + debug t => _14; // in scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL } } } @@ -90,10 +89,7 @@ StorageLive(_14); // scope 2 at $DIR/separate_const_switch.rs:+1:8: +1:10 _14 = move ((_8 as Err).0: i32); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL StorageLive(_15); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - StorageLive(_16); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - _16 = move _14; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - _15 = move _16; // scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL - StorageDead(_16); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL + _15 = move _14; // scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL _0 = Result::::Err(move _15); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL StorageDead(_15); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL StorageDead(_14); // scope 2 at $DIR/separate_const_switch.rs:+1:8: +1:10 diff --git a/tests/mir-opt/separate_const_switch.too_complex.SeparateConstSwitch.diff b/tests/mir-opt/separate_const_switch.too_complex.SeparateConstSwitch.diff index 3c7e9dc61..b5e0a66d8 100644 --- a/tests/mir-opt/separate_const_switch.too_complex.SeparateConstSwitch.diff +++ b/tests/mir-opt/separate_const_switch.too_complex.SeparateConstSwitch.diff @@ -61,7 +61,7 @@ bb4: { _8 = discriminant(_2); // scope 0 at $DIR/separate_const_switch.rs:+5:11: +10:6 - switchInt(move _8) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 0 at $DIR/separate_const_switch.rs:+5:5: +10:6 + switchInt(move _8) -> [0: bb6, 1: bb5, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:+5:5: +10:6 } bb5: { @@ -69,14 +69,10 @@ _11 = ((_2 as Break).0: usize); // scope 0 at $DIR/separate_const_switch.rs:+12:28: +12:29 _0 = Option::::None; // scope 4 at $DIR/separate_const_switch.rs:+12:34: +12:38 StorageDead(_11); // scope 0 at $DIR/separate_const_switch.rs:+12:37: +12:38 - goto -> bb8; // scope 0 at $DIR/separate_const_switch.rs:+12:37: +12:38 + goto -> bb7; // scope 0 at $DIR/separate_const_switch.rs:+12:37: +12:38 } bb6: { - unreachable; // scope 0 at $DIR/separate_const_switch.rs:+5:11: +10:6 - } - - bb7: { StorageLive(_9); // scope 0 at $DIR/separate_const_switch.rs:+11:31: +11:32 _9 = ((_2 as Continue).0: i32); // scope 0 at $DIR/separate_const_switch.rs:+11:31: +11:32 StorageLive(_10); // scope 3 at $DIR/separate_const_switch.rs:+11:42: +11:43 @@ -84,10 +80,10 @@ _0 = Option::::Some(move _10); // scope 3 at $DIR/separate_const_switch.rs:+11:37: +11:44 StorageDead(_10); // scope 3 at $DIR/separate_const_switch.rs:+11:43: +11:44 StorageDead(_9); // scope 0 at $DIR/separate_const_switch.rs:+11:43: +11:44 - goto -> bb8; // scope 0 at $DIR/separate_const_switch.rs:+11:43: +11:44 + goto -> bb7; // scope 0 at $DIR/separate_const_switch.rs:+11:43: +11:44 } - bb8: { + bb7: { StorageDead(_2); // scope 0 at $DIR/separate_const_switch.rs:+14:1: +14:2 return; // scope 0 at $DIR/separate_const_switch.rs:+14:2: +14: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 index 66ba4df76..cae89fb17 100644 --- a/tests/mir-opt/simple_option_map_e2e.ezmap.PreCodegen.after.mir +++ b/tests/mir-opt/simple_option_map_e2e.ezmap.PreCodegen.after.mir @@ -3,30 +3,28 @@ 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 - let mut _2: [closure@$DIR/simple_option_map_e2e.rs:14:12: 14:15]; // in scope 0 at $DIR/simple_option_map_e2e.rs:+1:12: +1:21 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 => _2; // in scope 1 at $DIR/simple_option_map_e2e.rs:2:33: 2:34 - let mut _3: isize; // in scope 1 at $DIR/simple_option_map_e2e.rs:7:9: 7:16 - let _4: i32; // in scope 1 at $DIR/simple_option_map_e2e.rs:7:14: 7:15 - let mut _5: i32; // in scope 1 at $DIR/simple_option_map_e2e.rs:7:25: 7:29 + 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 => _4; // in scope 2 at $DIR/simple_option_map_e2e.rs:7:14: 7:15 + 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 => _4; // in scope 3 at $DIR/simple_option_map_e2e.rs:+1:13: +1:14 + debug n => _3; // in scope 3 at $DIR/simple_option_map_e2e.rs:+1:13: +1:14 } } } bb0: { - StorageLive(_2); // scope 0 at $DIR/simple_option_map_e2e.rs:+1:12: +1:21 - _3 = discriminant(_1); // scope 1 at $DIR/simple_option_map_e2e.rs:6:11: 6:14 - switchInt(move _3) -> [0: bb1, 1: bb3, otherwise: bb2]; // scope 1 at $DIR/simple_option_map_e2e.rs:6:5: 6:14 + _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 - goto -> bb4; // 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: { @@ -34,16 +32,11 @@ fn ezmap(_1: Option) -> Option { } bb3: { - _4 = ((_1 as Some).0: i32); // scope 1 at $DIR/simple_option_map_e2e.rs:7:14: 7:15 - StorageLive(_5); // scope 2 at $DIR/simple_option_map_e2e.rs:7:25: 7:29 - _5 = Add(_4, const 1_i32); // scope 3 at $DIR/simple_option_map_e2e.rs:+1:16: +1:21 - _0 = Option::::Some(move _5); // scope 2 at $DIR/simple_option_map_e2e.rs:7:20: 7:30 - StorageDead(_5); // scope 2 at $DIR/simple_option_map_e2e.rs:7:29: 7:30 - goto -> bb4; // scope 1 at $DIR/simple_option_map_e2e.rs:10:1: 10:2 - } - - bb4: { - StorageDead(_2); // scope 0 at $DIR/simple_option_map_e2e.rs:+1:21: +1:22 - return; // scope 0 at $DIR/simple_option_map_e2e.rs:+2:2: +2:2 + _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/simplify_cfg.main.SimplifyCfg-initial.diff b/tests/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff index 1e66b1f70..c61107d25 100644 --- a/tests/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff +++ b/tests/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff @@ -12,8 +12,8 @@ } bb1: { -- falseUnwind -> [real: bb2, cleanup: bb11]; // scope 0 at $DIR/simplify_cfg.rs:+1:5: +5:6 -+ falseUnwind -> [real: bb2, cleanup: bb6]; // scope 0 at $DIR/simplify_cfg.rs:+1:5: +5:6 +- falseUnwind -> [real: bb2, unwind: bb11]; // scope 0 at $DIR/simplify_cfg.rs:+1:5: +5:6 ++ falseUnwind -> [real: bb2, unwind: bb6]; // scope 0 at $DIR/simplify_cfg.rs:+1:5: +5:6 } bb2: { diff --git a/tests/mir-opt/simplify_duplicate_unreachable_blocks.assert_nonzero_nonmax.SimplifyCfg-after-uninhabited-enum-branching.diff b/tests/mir-opt/simplify_duplicate_unreachable_blocks.assert_nonzero_nonmax.SimplifyCfg-after-uninhabited-enum-branching.diff new file mode 100644 index 000000000..f7f50206a --- /dev/null +++ b/tests/mir-opt/simplify_duplicate_unreachable_blocks.assert_nonzero_nonmax.SimplifyCfg-after-uninhabited-enum-branching.diff @@ -0,0 +1,25 @@ +- // MIR for `assert_nonzero_nonmax` before SimplifyCfg-after-uninhabited-enum-branching ++ // MIR for `assert_nonzero_nonmax` after SimplifyCfg-after-uninhabited-enum-branching + + fn assert_nonzero_nonmax(_1: u8) -> u8 { + let mut _0: u8; // return place in scope 0 at $DIR/simplify_duplicate_unreachable_blocks.rs:+0:47: +0:49 + + bb0: { +- switchInt(_1) -> [0: bb1, 255: bb2, otherwise: bb3]; // scope 0 at $DIR/simplify_duplicate_unreachable_blocks.rs:+3:13: +7:14 ++ switchInt(_1) -> [0: bb1, 255: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify_duplicate_unreachable_blocks.rs:+3:13: +7:14 + } + + bb1: { + unreachable; // scope 0 at $DIR/simplify_duplicate_unreachable_blocks.rs:+10:13: +10:26 + } + + bb2: { +- unreachable; // scope 0 at $DIR/simplify_duplicate_unreachable_blocks.rs:+13:13: +13:26 +- } +- +- bb3: { + _0 = _1; // scope 0 at $DIR/simplify_duplicate_unreachable_blocks.rs:+16:13: +16:20 + return; // scope 0 at $DIR/simplify_duplicate_unreachable_blocks.rs:+17:13: +17:21 + } + } + diff --git a/tests/mir-opt/simplify_duplicate_unreachable_blocks.rs b/tests/mir-opt/simplify_duplicate_unreachable_blocks.rs new file mode 100644 index 000000000..e2578407f --- /dev/null +++ b/tests/mir-opt/simplify_duplicate_unreachable_blocks.rs @@ -0,0 +1,30 @@ +#![feature(custom_mir, core_intrinsics)] +#![crate_type = "lib"] + +use std::intrinsics::mir::*; + +// unit-test: SimplifyCfg-after-uninhabited-enum-branching + +// EMIT_MIR simplify_duplicate_unreachable_blocks.assert_nonzero_nonmax.SimplifyCfg-after-uninhabited-enum-branching.diff +#[custom_mir(dialect = "runtime", phase = "post-cleanup")] +pub unsafe fn assert_nonzero_nonmax(x: u8) -> u8 { + mir!( + { + match x { + 0 => unreachable1, + u8::MAX => unreachable2, + _ => retblock, + } + } + unreachable1 = { + Unreachable() + } + unreachable2 = { + Unreachable() + } + retblock = { + RET = x; + Return() + } + ) +} diff --git a/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.diff b/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.diff index f9e22866b..b473d0fde 100644 --- a/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.diff +++ b/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.diff @@ -14,15 +14,13 @@ } bb1: { - StorageLive(_2); // scope 0 at $DIR/simplify_if.rs:+2:9: +2:15 _2 = noop() -> bb2; // scope 0 at $DIR/simplify_if.rs:+2:9: +2:15 // mir::Constant - // + span: $DIR/simplify_if.rs:7:9: 7:13 + // + span: $DIR/simplify_if.rs:8:9: 8:13 // + literal: Const { ty: fn() {noop}, val: Value() } } bb2: { - StorageDead(_2); // scope 0 at $DIR/simplify_if.rs:+2:15: +2:16 goto -> bb4; // scope 0 at $DIR/simplify_if.rs:+1:5: +3:6 } diff --git a/tests/mir-opt/simplify_if.rs b/tests/mir-opt/simplify_if.rs index 2d093d926..b86f80a80 100644 --- a/tests/mir-opt/simplify_if.rs +++ b/tests/mir-opt/simplify_if.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default #[inline(never)] fn noop() {} diff --git a/tests/mir-opt/simplify_locals_fixedpoint.rs b/tests/mir-opt/simplify_locals_fixedpoint.rs index 1fdba6e99..7c41e8b7c 100644 --- a/tests/mir-opt/simplify_locals_fixedpoint.rs +++ b/tests/mir-opt/simplify_locals_fixedpoint.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // compile-flags: -Zmir-opt-level=1 fn foo() { diff --git a/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.diff index 0f8866f9c..ae2c774f2 100644 --- a/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.diff +++ b/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.diff @@ -56,7 +56,7 @@ + StorageDead(_3); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:20: +2:21 + _1 = use_zst(move _2) -> bb1; // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:5: +2:22 // mir::Constant - // + span: $DIR/simplify_locals_removes_unused_consts.rs:15:5: 15:12 + // + span: $DIR/simplify_locals_removes_unused_consts.rs:16:5: 16:12 // + literal: Const { ty: fn(((), ())) {use_zst}, val: Value() } } @@ -84,7 +84,7 @@ + StorageDead(_7); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:33: +4:34 + _5 = use_u8(move _6) -> bb2; // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:5: +4:35 // mir::Constant - // + span: $DIR/simplify_locals_removes_unused_consts.rs:17:5: 17:11 + // + span: $DIR/simplify_locals_removes_unused_consts.rs:18:5: 18:11 // + literal: Const { ty: fn(u8) {use_u8}, val: Value() } } diff --git a/tests/mir-opt/simplify_locals_removes_unused_consts.rs b/tests/mir-opt/simplify_locals_removes_unused_consts.rs index 7a03a2837..983d8004e 100644 --- a/tests/mir-opt/simplify_locals_removes_unused_consts.rs +++ b/tests/mir-opt/simplify_locals_removes_unused_consts.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // unit-test: SimplifyLocals-before-const-prop // compile-flags: -C overflow-checks=no diff --git a/tests/mir-opt/simplify_match.main.ConstProp.diff b/tests/mir-opt/simplify_match.main.ConstProp.diff index b700adfb1..d2b9ac3cc 100644 --- a/tests/mir-opt/simplify_match.main.ConstProp.diff +++ b/tests/mir-opt/simplify_match.main.ConstProp.diff @@ -22,7 +22,7 @@ bb2: { _0 = noop() -> bb3; // scope 0 at $DIR/simplify_match.rs:+2:17: +2:23 // mir::Constant - // + span: $DIR/simplify_match.rs:7:17: 7:21 + // + span: $DIR/simplify_match.rs:8:17: 8:21 // + literal: Const { ty: fn() {noop}, val: Value() } } diff --git a/tests/mir-opt/simplify_match.rs b/tests/mir-opt/simplify_match.rs index 216203f9f..6a2a6f217 100644 --- a/tests/mir-opt/simplify_match.rs +++ b/tests/mir-opt/simplify_match.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default #[inline(never)] fn noop() {} diff --git a/tests/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir b/tests/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir index 391b00eff..11115c96e 100644 --- a/tests/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir +++ b/tests/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir @@ -4,21 +4,13 @@ fn std::ptr::drop_in_place(_1: *mut [String]) -> () { let mut _0: (); // return place in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 let mut _2: usize; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 let mut _3: usize; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _4: usize; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _5: *mut std::string::String; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _6: bool; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _7: *mut std::string::String; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _8: bool; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _9: *mut std::string::String; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _10: *mut std::string::String; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _11: *mut std::string::String; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _12: bool; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _13: *mut std::string::String; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _14: bool; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _15: *mut [std::string::String]; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + let mut _4: *mut std::string::String; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + let mut _5: bool; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + let mut _6: *mut std::string::String; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + let mut _7: bool; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 bb0: { - goto -> bb15; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + goto -> bb8; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 } bb1: { @@ -30,72 +22,34 @@ fn std::ptr::drop_in_place(_1: *mut [String]) -> () { } bb3 (cleanup): { - _5 = &raw mut (*_1)[_4]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - _4 = Add(move _4, const 1_usize); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - drop((*_5)) -> bb4; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + _4 = &raw mut (*_1)[_3]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + _3 = Add(move _3, const 1_usize); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + drop((*_4)) -> [return: bb4, unwind terminate]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 } bb4 (cleanup): { - _6 = Eq(_4, _3); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - switchInt(move _6) -> [0: bb3, otherwise: bb2]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + _5 = Eq(_3, _2); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + switchInt(move _5) -> [0: bb3, otherwise: bb2]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 } bb5: { - _7 = &raw mut (*_1)[_4]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - _4 = Add(move _4, const 1_usize); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - drop((*_7)) -> [return: bb6, unwind: bb4]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + _6 = &raw mut (*_1)[_3]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + _3 = Add(move _3, const 1_usize); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + drop((*_6)) -> [return: bb6, unwind: bb4]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 } bb6: { - _8 = Eq(_4, _3); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - switchInt(move _8) -> [0: bb5, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + _7 = Eq(_3, _2); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + switchInt(move _7) -> [0: bb5, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 } bb7: { - _4 = const 0_usize; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + _2 = Len((*_1)); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + _3 = const 0_usize; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 goto -> bb6; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 } bb8: { goto -> bb7; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 } - - bb9 (cleanup): { - _11 = _9; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - _9 = Offset(move _9, const 1_usize); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - drop((*_11)) -> bb10; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb10 (cleanup): { - _12 = Eq(_9, _10); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - switchInt(move _12) -> [0: bb9, otherwise: bb2]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb11: { - _13 = _9; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - _9 = Offset(move _9, const 1_usize); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - drop((*_13)) -> [return: bb12, unwind: bb10]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb12: { - _14 = Eq(_9, _10); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - switchInt(move _14) -> [0: bb11, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb13: { - _15 = &raw mut (*_1); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - _9 = move _15 as *mut std::string::String (PtrToPtr); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - _10 = Offset(_9, move _3); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - goto -> bb12; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb14: { - goto -> bb13; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb15: { - _2 = SizeOf(std::string::String); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - _3 = Len((*_1)); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - switchInt(move _2) -> [0: bb8, otherwise: bb14]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } } diff --git a/tests/mir-opt/sroa.constant.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa.constant.ScalarReplacementOfAggregates.diff deleted file mode 100644 index 9e33215f2..000000000 --- a/tests/mir-opt/sroa.constant.ScalarReplacementOfAggregates.diff +++ /dev/null @@ -1,46 +0,0 @@ -- // MIR for `constant` before ScalarReplacementOfAggregates -+ // MIR for `constant` after ScalarReplacementOfAggregates - - fn constant() -> () { - let mut _0: (); // return place in scope 0 at $DIR/sroa.rs:+0:15: +0:15 - let _1: (usize, u8); // in scope 0 at $DIR/sroa.rs:+2:9: +2:10 -+ let _4: usize; // in scope 0 at $DIR/sroa.rs:+2:9: +2:10 -+ let _5: u8; // in scope 0 at $DIR/sroa.rs:+2:9: +2:10 - scope 1 { -- debug y => _1; // in scope 1 at $DIR/sroa.rs:+2:9: +2:10 -+ debug y => (usize, u8){ .0 => _4, .1 => _5, }; // in scope 1 at $DIR/sroa.rs:+2:9: +2:10 - let _2: usize; // in scope 1 at $DIR/sroa.rs:+3:9: +3:10 - scope 2 { - debug t => _2; // in scope 2 at $DIR/sroa.rs:+3:9: +3:10 - let _3: u8; // in scope 2 at $DIR/sroa.rs:+4:9: +4:10 - scope 3 { - debug u => _3; // in scope 3 at $DIR/sroa.rs:+4:9: +4:10 - } - } - } - - bb0: { -- StorageLive(_1); // scope 0 at $DIR/sroa.rs:+2:9: +2:10 -+ StorageLive(_4); // scope 0 at $DIR/sroa.rs:+2:9: +2:10 -+ StorageLive(_5); // scope 0 at $DIR/sroa.rs:+2:9: +2:10 -+ nop; // scope 0 at $DIR/sroa.rs:+2:9: +2:10 - _1 = const _; // scope 0 at $DIR/sroa.rs:+2:13: +2:14 -+ _4 = move (_1.0: usize); // scope 1 at $DIR/sroa.rs:+3:9: +3:10 -+ _5 = move (_1.1: u8); // scope 1 at $DIR/sroa.rs:+3:9: +3:10 - StorageLive(_2); // scope 1 at $DIR/sroa.rs:+3:9: +3:10 -- _2 = (_1.0: usize); // scope 1 at $DIR/sroa.rs:+3:13: +3:16 -+ _2 = _4; // scope 1 at $DIR/sroa.rs:+3:13: +3:16 - StorageLive(_3); // scope 2 at $DIR/sroa.rs:+4:9: +4:10 -- _3 = (_1.1: u8); // scope 2 at $DIR/sroa.rs:+4:13: +4:16 -+ _3 = _5; // scope 2 at $DIR/sroa.rs:+4:13: +4:16 - _0 = const (); // scope 0 at $DIR/sroa.rs:+0:15: +5:2 - StorageDead(_3); // scope 2 at $DIR/sroa.rs:+5:1: +5:2 - StorageDead(_2); // scope 1 at $DIR/sroa.rs:+5:1: +5:2 -- StorageDead(_1); // scope 0 at $DIR/sroa.rs:+5:1: +5:2 -+ StorageDead(_4); // scope 0 at $DIR/sroa.rs:+5:1: +5:2 -+ StorageDead(_5); // scope 0 at $DIR/sroa.rs:+5:1: +5:2 -+ nop; // scope 0 at $DIR/sroa.rs:+5:1: +5:2 - return; // scope 0 at $DIR/sroa.rs:+5:2: +5:2 - } - } - diff --git a/tests/mir-opt/sroa.copies.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa.copies.ScalarReplacementOfAggregates.diff deleted file mode 100644 index 976f6d44b..000000000 --- a/tests/mir-opt/sroa.copies.ScalarReplacementOfAggregates.diff +++ /dev/null @@ -1,91 +0,0 @@ -- // MIR for `copies` before ScalarReplacementOfAggregates -+ // MIR for `copies` after ScalarReplacementOfAggregates - - fn copies(_1: Foo) -> () { - debug x => _1; // in scope 0 at $DIR/sroa.rs:+0:11: +0:12 - let mut _0: (); // return place in scope 0 at $DIR/sroa.rs:+0:19: +0:19 - let _2: Foo; // in scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ let _11: u8; // in scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ let _12: (); // in scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ let _13: &str; // in scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ let _14: std::option::Option; // in scope 0 at $DIR/sroa.rs:+1:9: +1:10 - scope 1 { -- debug y => _2; // in scope 1 at $DIR/sroa.rs:+1:9: +1:10 -+ debug y => Foo{ .0 => _11, .1 => _12, .2 => _13, .3 => _14, }; // in scope 1 at $DIR/sroa.rs:+1:9: +1:10 - let _3: u8; // in scope 1 at $DIR/sroa.rs:+2:9: +2:10 - scope 2 { - debug t => _3; // in scope 2 at $DIR/sroa.rs:+2:9: +2:10 - let _4: &str; // in scope 2 at $DIR/sroa.rs:+3:9: +3:10 - scope 3 { - debug u => _4; // in scope 3 at $DIR/sroa.rs:+3:9: +3:10 - let _5: Foo; // in scope 3 at $DIR/sroa.rs:+4:9: +4:10 -+ let _7: u8; // in scope 3 at $DIR/sroa.rs:+4:9: +4:10 -+ let _8: (); // in scope 3 at $DIR/sroa.rs:+4:9: +4:10 -+ let _9: &str; // in scope 3 at $DIR/sroa.rs:+4:9: +4:10 -+ let _10: std::option::Option; // in scope 3 at $DIR/sroa.rs:+4:9: +4:10 - scope 4 { -- debug z => _5; // in scope 4 at $DIR/sroa.rs:+4:9: +4:10 -+ debug z => Foo{ .0 => _7, .1 => _8, .2 => _9, .3 => _10, }; // in scope 4 at $DIR/sroa.rs:+4:9: +4:10 - let _6: (); // in scope 4 at $DIR/sroa.rs:+5:9: +5:10 - scope 5 { - debug a => _6; // in scope 5 at $DIR/sroa.rs:+5:9: +5:10 - } - } - } - } - } - - bb0: { -- StorageLive(_2); // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -- _2 = _1; // scope 0 at $DIR/sroa.rs:+1:13: +1:14 -+ StorageLive(_11); // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ StorageLive(_12); // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ StorageLive(_13); // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ StorageLive(_14); // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ nop; // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ _11 = (_1.0: u8); // scope 0 at $DIR/sroa.rs:+1:13: +1:14 -+ _12 = (_1.1: ()); // scope 0 at $DIR/sroa.rs:+1:13: +1:14 -+ _13 = (_1.2: &str); // scope 0 at $DIR/sroa.rs:+1:13: +1:14 -+ _14 = (_1.3: std::option::Option); // scope 0 at $DIR/sroa.rs:+1:13: +1:14 -+ nop; // scope 0 at $DIR/sroa.rs:+1:13: +1:14 - StorageLive(_3); // scope 1 at $DIR/sroa.rs:+2:9: +2:10 -- _3 = (_2.0: u8); // scope 1 at $DIR/sroa.rs:+2:13: +2:16 -+ _3 = _11; // scope 1 at $DIR/sroa.rs:+2:13: +2:16 - StorageLive(_4); // scope 2 at $DIR/sroa.rs:+3:9: +3:10 -- _4 = (_2.2: &str); // scope 2 at $DIR/sroa.rs:+3:13: +3:16 -- StorageLive(_5); // scope 3 at $DIR/sroa.rs:+4:9: +4:10 -- _5 = _2; // scope 3 at $DIR/sroa.rs:+4:13: +4:14 -+ _4 = _13; // scope 2 at $DIR/sroa.rs:+3:13: +3:16 -+ StorageLive(_7); // scope 3 at $DIR/sroa.rs:+4:9: +4:10 -+ StorageLive(_8); // scope 3 at $DIR/sroa.rs:+4:9: +4:10 -+ StorageLive(_9); // scope 3 at $DIR/sroa.rs:+4:9: +4:10 -+ StorageLive(_10); // scope 3 at $DIR/sroa.rs:+4:9: +4:10 -+ nop; // scope 3 at $DIR/sroa.rs:+4:9: +4:10 -+ _7 = _11; // scope 3 at $DIR/sroa.rs:+4:13: +4:14 -+ _8 = _12; // scope 3 at $DIR/sroa.rs:+4:13: +4:14 -+ _9 = _13; // scope 3 at $DIR/sroa.rs:+4:13: +4:14 -+ _10 = _14; // scope 3 at $DIR/sroa.rs:+4:13: +4:14 -+ nop; // scope 3 at $DIR/sroa.rs:+4:13: +4:14 - StorageLive(_6); // scope 4 at $DIR/sroa.rs:+5:9: +5:10 -- _6 = (_5.1: ()); // scope 4 at $DIR/sroa.rs:+5:13: +5:16 -+ _6 = _8; // scope 4 at $DIR/sroa.rs:+5:13: +5:16 - _0 = const (); // scope 0 at $DIR/sroa.rs:+0:19: +6:2 - StorageDead(_6); // scope 4 at $DIR/sroa.rs:+6:1: +6:2 -- StorageDead(_5); // scope 3 at $DIR/sroa.rs:+6:1: +6:2 -+ StorageDead(_7); // scope 3 at $DIR/sroa.rs:+6:1: +6:2 -+ StorageDead(_8); // scope 3 at $DIR/sroa.rs:+6:1: +6:2 -+ StorageDead(_9); // scope 3 at $DIR/sroa.rs:+6:1: +6:2 -+ StorageDead(_10); // scope 3 at $DIR/sroa.rs:+6:1: +6:2 -+ nop; // scope 3 at $DIR/sroa.rs:+6:1: +6:2 - StorageDead(_4); // scope 2 at $DIR/sroa.rs:+6:1: +6:2 - StorageDead(_3); // scope 1 at $DIR/sroa.rs:+6:1: +6:2 -- StorageDead(_2); // scope 0 at $DIR/sroa.rs:+6:1: +6:2 -+ StorageDead(_11); // scope 0 at $DIR/sroa.rs:+6:1: +6:2 -+ StorageDead(_12); // scope 0 at $DIR/sroa.rs:+6:1: +6:2 -+ StorageDead(_13); // scope 0 at $DIR/sroa.rs:+6:1: +6:2 -+ StorageDead(_14); // scope 0 at $DIR/sroa.rs:+6:1: +6:2 -+ nop; // scope 0 at $DIR/sroa.rs:+6:1: +6:2 - return; // scope 0 at $DIR/sroa.rs:+6:2: +6:2 - } - } - diff --git a/tests/mir-opt/sroa.dropping.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa.dropping.ScalarReplacementOfAggregates.diff deleted file mode 100644 index 17a89e7d8..000000000 --- a/tests/mir-opt/sroa.dropping.ScalarReplacementOfAggregates.diff +++ /dev/null @@ -1,44 +0,0 @@ -- // MIR for `dropping` before ScalarReplacementOfAggregates -+ // MIR for `dropping` after ScalarReplacementOfAggregates - - fn dropping() -> () { - let mut _0: (); // return place in scope 0 at $DIR/sroa.rs:+0:19: +0:19 - let _1: Tag; // in scope 0 at $DIR/sroa.rs:+1:5: +1:32 - let mut _2: S; // in scope 0 at $DIR/sroa.rs:+1:5: +1:30 - let mut _3: Tag; // in scope 0 at $DIR/sroa.rs:+1:7: +1:13 - let mut _4: Tag; // in scope 0 at $DIR/sroa.rs:+1:15: +1:21 - let mut _5: Tag; // in scope 0 at $DIR/sroa.rs:+1:23: +1:29 - - bb0: { - StorageLive(_1); // scope 0 at $DIR/sroa.rs:+1:5: +1:32 - StorageLive(_2); // scope 0 at $DIR/sroa.rs:+1:5: +1:30 - StorageLive(_3); // scope 0 at $DIR/sroa.rs:+1:7: +1:13 - _3 = Tag(const 0_usize); // scope 0 at $DIR/sroa.rs:+1:7: +1:13 - StorageLive(_4); // scope 0 at $DIR/sroa.rs:+1:15: +1:21 - _4 = Tag(const 1_usize); // scope 0 at $DIR/sroa.rs:+1:15: +1:21 - StorageLive(_5); // scope 0 at $DIR/sroa.rs:+1:23: +1:29 - _5 = Tag(const 2_usize); // scope 0 at $DIR/sroa.rs:+1:23: +1:29 - _2 = S(move _3, move _4, move _5); // scope 0 at $DIR/sroa.rs:+1:5: +1:30 - StorageDead(_5); // scope 0 at $DIR/sroa.rs:+1:29: +1:30 - StorageDead(_4); // scope 0 at $DIR/sroa.rs:+1:29: +1:30 - StorageDead(_3); // scope 0 at $DIR/sroa.rs:+1:29: +1:30 - _1 = move (_2.1: Tag); // scope 0 at $DIR/sroa.rs:+1:5: +1:32 - drop(_1) -> bb1; // scope 0 at $DIR/sroa.rs:+1:32: +1:33 - } - - bb1: { - drop((_2.0: Tag)) -> bb3; // scope 0 at $DIR/sroa.rs:+1:32: +1:33 - } - - bb2: { - StorageDead(_2); // scope 0 at $DIR/sroa.rs:+1:32: +1:33 - StorageDead(_1); // scope 0 at $DIR/sroa.rs:+1:32: +1:33 - _0 = const (); // scope 0 at $DIR/sroa.rs:+0:19: +2:2 - return; // scope 0 at $DIR/sroa.rs:+2:2: +2:2 - } - - bb3: { - drop((_2.2: Tag)) -> bb2; // scope 0 at $DIR/sroa.rs:+1:32: +1:33 - } - } - diff --git a/tests/mir-opt/sroa.enums.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa.enums.ScalarReplacementOfAggregates.diff deleted file mode 100644 index 04d26162a..000000000 --- a/tests/mir-opt/sroa.enums.ScalarReplacementOfAggregates.diff +++ /dev/null @@ -1,43 +0,0 @@ -- // MIR for `enums` before ScalarReplacementOfAggregates -+ // MIR for `enums` after ScalarReplacementOfAggregates - - fn enums(_1: usize) -> usize { - debug a => _1; // in scope 0 at $DIR/sroa.rs:+0:14: +0:15 - let mut _0: usize; // return place in scope 0 at $DIR/sroa.rs:+0:27: +0:32 - let mut _2: std::option::Option; // in scope 0 at $DIR/sroa.rs:+1:22: +1:29 - let mut _3: usize; // in scope 0 at $DIR/sroa.rs:+1:27: +1:28 - let mut _4: isize; // in scope 0 at $DIR/sroa.rs:+1:12: +1:19 - scope 1 { - debug a => _5; // in scope 1 at $DIR/sroa.rs:+1:17: +1:18 - let _5: usize; // in scope 1 at $DIR/sroa.rs:+1:17: +1:18 - } - - bb0: { - StorageLive(_2); // scope 1 at $DIR/sroa.rs:+1:22: +1:29 - StorageLive(_3); // scope 1 at $DIR/sroa.rs:+1:27: +1:28 - _3 = _1; // scope 1 at $DIR/sroa.rs:+1:27: +1:28 - _2 = Option::::Some(move _3); // scope 1 at $DIR/sroa.rs:+1:22: +1:29 - StorageDead(_3); // scope 1 at $DIR/sroa.rs:+1:28: +1:29 - _4 = discriminant(_2); // scope 1 at $DIR/sroa.rs:+1:12: +1:19 - switchInt(move _4) -> [1: bb1, otherwise: bb2]; // scope 1 at $DIR/sroa.rs:+1:12: +1:19 - } - - bb1: { - StorageLive(_5); // scope 1 at $DIR/sroa.rs:+1:17: +1:18 - _5 = ((_2 as Some).0: usize); // scope 1 at $DIR/sroa.rs:+1:17: +1:18 - _0 = _5; // scope 1 at $DIR/sroa.rs:+1:32: +1:33 - StorageDead(_5); // scope 0 at $DIR/sroa.rs:+1:34: +1:35 - goto -> bb3; // scope 0 at $DIR/sroa.rs:+1:5: +1:46 - } - - bb2: { - _0 = const 0_usize; // scope 0 at $DIR/sroa.rs:+1:43: +1:44 - goto -> bb3; // scope 0 at $DIR/sroa.rs:+1:5: +1:46 - } - - bb3: { - StorageDead(_2); // scope 0 at $DIR/sroa.rs:+2:1: +2:2 - return; // scope 0 at $DIR/sroa.rs:+2:2: +2:2 - } - } - diff --git a/tests/mir-opt/sroa.escaping.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa.escaping.ScalarReplacementOfAggregates.diff deleted file mode 100644 index fd691fdd1..000000000 --- a/tests/mir-opt/sroa.escaping.ScalarReplacementOfAggregates.diff +++ /dev/null @@ -1,44 +0,0 @@ -- // MIR for `escaping` before ScalarReplacementOfAggregates -+ // MIR for `escaping` after ScalarReplacementOfAggregates - - fn escaping() -> () { - let mut _0: (); // return place in scope 0 at $DIR/sroa.rs:+0:19: +0:19 - let _1: (); // in scope 0 at $DIR/sroa.rs:+1:5: +1:42 - let mut _2: *const u32; // in scope 0 at $DIR/sroa.rs:+1:7: +1:41 - let _3: &u32; // in scope 0 at $DIR/sroa.rs:+1:7: +1:41 - let _4: Escaping; // in scope 0 at $DIR/sroa.rs:+1:8: +1:39 - let mut _5: u32; // in scope 0 at $DIR/sroa.rs:+1:34: +1:37 - - bb0: { - StorageLive(_1); // scope 0 at $DIR/sroa.rs:+1:5: +1:42 - StorageLive(_2); // scope 0 at $DIR/sroa.rs:+1:7: +1:41 - StorageLive(_3); // scope 0 at $DIR/sroa.rs:+1:7: +1:41 - StorageLive(_4); // scope 0 at $DIR/sroa.rs:+1:8: +1:39 - StorageLive(_5); // scope 0 at $DIR/sroa.rs:+1:34: +1:37 - _5 = g() -> bb1; // scope 0 at $DIR/sroa.rs:+1:34: +1:37 - // mir::Constant - // + span: $DIR/sroa.rs:78:34: 78:35 - // + literal: Const { ty: fn() -> u32 {g}, val: Value() } - } - - bb1: { - _4 = Escaping { a: const 1_u32, b: const 2_u32, c: move _5 }; // scope 0 at $DIR/sroa.rs:+1:8: +1:39 - StorageDead(_5); // scope 0 at $DIR/sroa.rs:+1:38: +1:39 - _3 = &(_4.0: u32); // scope 0 at $DIR/sroa.rs:+1:7: +1:41 - _2 = &raw const (*_3); // scope 0 at $DIR/sroa.rs:+1:7: +1:41 - _1 = f(move _2) -> bb2; // scope 0 at $DIR/sroa.rs:+1:5: +1:42 - // mir::Constant - // + span: $DIR/sroa.rs:78:5: 78:6 - // + literal: Const { ty: fn(*const u32) {f}, val: Value() } - } - - bb2: { - StorageDead(_2); // scope 0 at $DIR/sroa.rs:+1:41: +1:42 - StorageDead(_4); // scope 0 at $DIR/sroa.rs:+1:42: +1:43 - StorageDead(_3); // scope 0 at $DIR/sroa.rs:+1:42: +1:43 - StorageDead(_1); // scope 0 at $DIR/sroa.rs:+1:42: +1:43 - _0 = const (); // scope 0 at $DIR/sroa.rs:+0:19: +2:2 - return; // scope 0 at $DIR/sroa.rs:+2:2: +2:2 - } - } - diff --git a/tests/mir-opt/sroa.flat.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa.flat.ScalarReplacementOfAggregates.diff deleted file mode 100644 index 69631fc02..000000000 --- a/tests/mir-opt/sroa.flat.ScalarReplacementOfAggregates.diff +++ /dev/null @@ -1,80 +0,0 @@ -- // MIR for `flat` before ScalarReplacementOfAggregates -+ // MIR for `flat` after ScalarReplacementOfAggregates - - fn flat() -> () { - let mut _0: (); // return place in scope 0 at $DIR/sroa.rs:+0:15: +0:15 - let _1: u8; // in scope 0 at $DIR/sroa.rs:+1:15: +1:16 - let _2: (); // in scope 0 at $DIR/sroa.rs:+1:18: +1:19 - let _3: &str; // in scope 0 at $DIR/sroa.rs:+1:21: +1:22 - let _4: std::option::Option; // in scope 0 at $DIR/sroa.rs:+1:24: +1:25 - let mut _5: Foo; // in scope 0 at $DIR/sroa.rs:+1:30: +1:70 - let mut _6: (); // in scope 0 at $DIR/sroa.rs:+1:45: +1:47 - let mut _7: std::option::Option; // in scope 0 at $DIR/sroa.rs:+1:60: +1:68 -+ let mut _8: u8; // in scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ let mut _9: (); // in scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ let mut _10: &str; // in scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ let mut _11: std::option::Option; // in scope 0 at $DIR/sroa.rs:+1:30: +1:70 - scope 1 { - debug a => _1; // in scope 1 at $DIR/sroa.rs:+1:15: +1:16 - debug b => _2; // in scope 1 at $DIR/sroa.rs:+1:18: +1:19 - debug c => _3; // in scope 1 at $DIR/sroa.rs:+1:21: +1:22 - debug d => _4; // in scope 1 at $DIR/sroa.rs:+1:24: +1:25 - scope 2 { - scope 3 { - scope 4 { - scope 5 { - } - } - } - } - } - - bb0: { -- StorageLive(_5); // scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ StorageLive(_8); // scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ StorageLive(_9); // scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ StorageLive(_10); // scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ StorageLive(_11); // scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ nop; // scope 0 at $DIR/sroa.rs:+1:30: +1:70 - StorageLive(_6); // scope 0 at $DIR/sroa.rs:+1:45: +1:47 - _6 = (); // scope 0 at $DIR/sroa.rs:+1:45: +1:47 - StorageLive(_7); // scope 0 at $DIR/sroa.rs:+1:60: +1:68 - _7 = Option::::Some(const -4_isize); // scope 0 at $DIR/sroa.rs:+1:60: +1:68 -- _5 = Foo { a: const 5_u8, b: move _6, c: const "a", d: move _7 }; // scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ _8 = const 5_u8; // scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ _9 = move _6; // scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ _10 = const "a"; // scope 0 at $DIR/sroa.rs:+1:30: +1:70 - // mir::Constant - // + span: $DIR/sroa.rs:53:52: 53:55 - // + literal: Const { ty: &str, val: Value(Slice(..)) } -+ _11 = move _7; // scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ nop; // scope 0 at $DIR/sroa.rs:+1:30: +1:70 - StorageDead(_7); // scope 0 at $DIR/sroa.rs:+1:69: +1:70 - StorageDead(_6); // scope 0 at $DIR/sroa.rs:+1:69: +1:70 - StorageLive(_1); // scope 0 at $DIR/sroa.rs:+1:15: +1:16 -- _1 = (_5.0: u8); // scope 0 at $DIR/sroa.rs:+1:15: +1:16 -+ _1 = _8; // scope 0 at $DIR/sroa.rs:+1:15: +1:16 - StorageLive(_2); // scope 0 at $DIR/sroa.rs:+1:18: +1:19 -- _2 = (_5.1: ()); // scope 0 at $DIR/sroa.rs:+1:18: +1:19 -+ _2 = _9; // scope 0 at $DIR/sroa.rs:+1:18: +1:19 - StorageLive(_3); // scope 0 at $DIR/sroa.rs:+1:21: +1:22 -- _3 = (_5.2: &str); // scope 0 at $DIR/sroa.rs:+1:21: +1:22 -+ _3 = _10; // scope 0 at $DIR/sroa.rs:+1:21: +1:22 - StorageLive(_4); // scope 0 at $DIR/sroa.rs:+1:24: +1:25 -- _4 = (_5.3: std::option::Option); // scope 0 at $DIR/sroa.rs:+1:24: +1:25 -- StorageDead(_5); // scope 0 at $DIR/sroa.rs:+1:70: +1:71 -+ _4 = _11; // scope 0 at $DIR/sroa.rs:+1:24: +1:25 -+ StorageDead(_8); // scope 0 at $DIR/sroa.rs:+1:70: +1:71 -+ StorageDead(_9); // scope 0 at $DIR/sroa.rs:+1:70: +1:71 -+ StorageDead(_10); // scope 0 at $DIR/sroa.rs:+1:70: +1:71 -+ StorageDead(_11); // scope 0 at $DIR/sroa.rs:+1:70: +1:71 -+ nop; // scope 0 at $DIR/sroa.rs:+1:70: +1:71 - _0 = const (); // scope 0 at $DIR/sroa.rs:+0:15: +6:2 - StorageDead(_4); // scope 0 at $DIR/sroa.rs:+6:1: +6:2 - StorageDead(_3); // scope 0 at $DIR/sroa.rs:+6:1: +6:2 - StorageDead(_2); // scope 0 at $DIR/sroa.rs:+6:1: +6:2 - StorageDead(_1); // scope 0 at $DIR/sroa.rs:+6:1: +6:2 - return; // scope 0 at $DIR/sroa.rs:+6:2: +6:2 - } - } - diff --git a/tests/mir-opt/sroa.ref_copies.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa.ref_copies.ScalarReplacementOfAggregates.diff deleted file mode 100644 index f0d62220d..000000000 --- a/tests/mir-opt/sroa.ref_copies.ScalarReplacementOfAggregates.diff +++ /dev/null @@ -1,56 +0,0 @@ -- // MIR for `ref_copies` before ScalarReplacementOfAggregates -+ // MIR for `ref_copies` after ScalarReplacementOfAggregates - - fn ref_copies(_1: &Foo) -> () { - debug x => _1; // in scope 0 at $DIR/sroa.rs:+0:15: +0:16 - let mut _0: (); // return place in scope 0 at $DIR/sroa.rs:+0:24: +0:24 - let _2: Foo; // in scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ let _5: u8; // in scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ let _6: (); // in scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ let _7: &str; // in scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ let _8: std::option::Option; // in scope 0 at $DIR/sroa.rs:+1:9: +1:10 - scope 1 { -- debug y => _2; // in scope 1 at $DIR/sroa.rs:+1:9: +1:10 -+ debug y => Foo{ .0 => _5, .1 => _6, .2 => _7, .3 => _8, }; // in scope 1 at $DIR/sroa.rs:+1:9: +1:10 - let _3: u8; // in scope 1 at $DIR/sroa.rs:+2:9: +2:10 - scope 2 { - debug t => _3; // in scope 2 at $DIR/sroa.rs:+2:9: +2:10 - let _4: &str; // in scope 2 at $DIR/sroa.rs:+3:9: +3:10 - scope 3 { - debug u => _4; // in scope 3 at $DIR/sroa.rs:+3:9: +3:10 - } - } - } - - bb0: { -- StorageLive(_2); // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -- _2 = (*_1); // scope 0 at $DIR/sroa.rs:+1:13: +1:15 -+ StorageLive(_5); // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ StorageLive(_6); // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ StorageLive(_7); // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ StorageLive(_8); // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ nop; // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ _5 = ((*_1).0: u8); // scope 0 at $DIR/sroa.rs:+1:13: +1:15 -+ _6 = ((*_1).1: ()); // scope 0 at $DIR/sroa.rs:+1:13: +1:15 -+ _7 = ((*_1).2: &str); // scope 0 at $DIR/sroa.rs:+1:13: +1:15 -+ _8 = ((*_1).3: std::option::Option); // scope 0 at $DIR/sroa.rs:+1:13: +1:15 -+ nop; // scope 0 at $DIR/sroa.rs:+1:13: +1:15 - StorageLive(_3); // scope 1 at $DIR/sroa.rs:+2:9: +2:10 -- _3 = (_2.0: u8); // scope 1 at $DIR/sroa.rs:+2:13: +2:16 -+ _3 = _5; // scope 1 at $DIR/sroa.rs:+2:13: +2:16 - StorageLive(_4); // scope 2 at $DIR/sroa.rs:+3:9: +3:10 -- _4 = (_2.2: &str); // scope 2 at $DIR/sroa.rs:+3:13: +3:16 -+ _4 = _7; // scope 2 at $DIR/sroa.rs:+3:13: +3:16 - _0 = const (); // scope 0 at $DIR/sroa.rs:+0:24: +4:2 - StorageDead(_4); // scope 2 at $DIR/sroa.rs:+4:1: +4:2 - StorageDead(_3); // scope 1 at $DIR/sroa.rs:+4:1: +4:2 -- StorageDead(_2); // scope 0 at $DIR/sroa.rs:+4:1: +4:2 -+ StorageDead(_5); // scope 0 at $DIR/sroa.rs:+4:1: +4:2 -+ StorageDead(_6); // scope 0 at $DIR/sroa.rs:+4:1: +4:2 -+ StorageDead(_7); // scope 0 at $DIR/sroa.rs:+4:1: +4:2 -+ StorageDead(_8); // scope 0 at $DIR/sroa.rs:+4:1: +4:2 -+ nop; // scope 0 at $DIR/sroa.rs:+4:1: +4:2 - return; // scope 0 at $DIR/sroa.rs:+4:2: +4:2 - } - } - diff --git a/tests/mir-opt/sroa.rs b/tests/mir-opt/sroa.rs deleted file mode 100644 index fff92cf8d..000000000 --- a/tests/mir-opt/sroa.rs +++ /dev/null @@ -1,122 +0,0 @@ -// unit-test: ScalarReplacementOfAggregates -// compile-flags: -Cpanic=abort -// no-prefer-dynamic - -struct Tag(usize); - -#[repr(C)] -struct S(Tag, Tag, Tag); - -impl Drop for Tag { - #[inline(never)] - fn drop(&mut self) {} -} - -pub fn dropping() { - S(Tag(0), Tag(1), Tag(2)).1; -} - -pub fn enums(a: usize) -> usize { - if let Some(a) = Some(a) { a } else { 0 } -} - -pub fn structs(a: f32) -> f32 { - struct U { - _foo: usize, - a: f32, - } - - U { _foo: 0, a }.a -} - -pub fn unions(a: f32) -> u32 { - union Repr { - f: f32, - u: u32, - } - unsafe { Repr { f: a }.u } -} - -#[derive(Copy, Clone)] -struct Foo { - a: u8, - b: (), - c: &'static str, - d: Option, -} - -fn g() -> u32 { - 3 -} - -pub fn flat() { - let Foo { a, b, c, d } = Foo { a: 5, b: (), c: "a", d: Some(-4) }; - let _ = a; - let _ = b; - let _ = c; - let _ = d; -} - -#[repr(C)] -struct Escaping { - a: u32, - b: u32, - c: u32, -} - -fn f(a: *const u32) { - println!("{}", unsafe { *a.add(2) }); -} - -// `f` uses the `&e.a` to access `e.c`. This is UB according to Miri today; however, -// T-opsem has not finalized that decision and as such rustc should not rely on -// it. If SROA were to rely on it, it would be (almost) correct to turn `e` into -// three distinct locals - one for each field - and pass a reference to only one -// of them to `f`. However, this would lead to a miscompilation because `b` and `c` -// might no longer appear right after `a` in memory. -pub fn escaping() { - f(&Escaping { a: 1, b: 2, c: g() }.a); -} - -fn copies(x: Foo) { - let y = x; - let t = y.a; - let u = y.c; - let z = y; - let a = z.b; -} - -fn ref_copies(x: &Foo) { - let y = *x; - let t = y.a; - let u = y.c; -} - -fn constant() { - const U: (usize, u8) = (5, 9); - let y = U; - let t = y.0; - let u = y.1; -} - -fn main() { - dropping(); - enums(5); - structs(5.); - unions(5.); - flat(); - escaping(); - copies(Foo { a: 5, b: (), c: "a", d: Some(-4) }); - ref_copies(&Foo { a: 5, b: (), c: "a", d: Some(-4) }); - constant(); -} - -// EMIT_MIR sroa.dropping.ScalarReplacementOfAggregates.diff -// EMIT_MIR sroa.enums.ScalarReplacementOfAggregates.diff -// EMIT_MIR sroa.structs.ScalarReplacementOfAggregates.diff -// EMIT_MIR sroa.unions.ScalarReplacementOfAggregates.diff -// EMIT_MIR sroa.flat.ScalarReplacementOfAggregates.diff -// EMIT_MIR sroa.escaping.ScalarReplacementOfAggregates.diff -// EMIT_MIR sroa.copies.ScalarReplacementOfAggregates.diff -// EMIT_MIR sroa.ref_copies.ScalarReplacementOfAggregates.diff -// EMIT_MIR sroa.constant.ScalarReplacementOfAggregates.diff diff --git a/tests/mir-opt/sroa.structs.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa.structs.ScalarReplacementOfAggregates.diff deleted file mode 100644 index 2c63d8b26..000000000 --- a/tests/mir-opt/sroa.structs.ScalarReplacementOfAggregates.diff +++ /dev/null @@ -1,33 +0,0 @@ -- // MIR for `structs` before ScalarReplacementOfAggregates -+ // MIR for `structs` after ScalarReplacementOfAggregates - - fn structs(_1: f32) -> f32 { - debug a => _1; // in scope 0 at $DIR/sroa.rs:+0:16: +0:17 - let mut _0: f32; // return place in scope 0 at $DIR/sroa.rs:+0:27: +0:30 - let mut _2: structs::U; // in scope 0 at $DIR/sroa.rs:+6:5: +6:21 - let mut _3: f32; // in scope 0 at $DIR/sroa.rs:+6:18: +6:19 -+ let mut _4: usize; // in scope 0 at $DIR/sroa.rs:+6:5: +6:21 -+ let mut _5: f32; // in scope 0 at $DIR/sroa.rs:+6:5: +6:21 - - bb0: { -- StorageLive(_2); // scope 0 at $DIR/sroa.rs:+6:5: +6:21 -+ StorageLive(_4); // scope 0 at $DIR/sroa.rs:+6:5: +6:21 -+ StorageLive(_5); // scope 0 at $DIR/sroa.rs:+6:5: +6:21 -+ nop; // scope 0 at $DIR/sroa.rs:+6:5: +6:21 - StorageLive(_3); // scope 0 at $DIR/sroa.rs:+6:18: +6:19 - _3 = _1; // scope 0 at $DIR/sroa.rs:+6:18: +6:19 -- _2 = U { _foo: const 0_usize, a: move _3 }; // scope 0 at $DIR/sroa.rs:+6:5: +6:21 -+ _4 = const 0_usize; // scope 0 at $DIR/sroa.rs:+6:5: +6:21 -+ _5 = move _3; // scope 0 at $DIR/sroa.rs:+6:5: +6:21 -+ nop; // scope 0 at $DIR/sroa.rs:+6:5: +6:21 - StorageDead(_3); // scope 0 at $DIR/sroa.rs:+6:20: +6:21 -- _0 = (_2.1: f32); // scope 0 at $DIR/sroa.rs:+6:5: +6:23 -- StorageDead(_2); // scope 0 at $DIR/sroa.rs:+7:1: +7:2 -+ _0 = _5; // scope 0 at $DIR/sroa.rs:+6:5: +6:23 -+ StorageDead(_4); // scope 0 at $DIR/sroa.rs:+7:1: +7:2 -+ StorageDead(_5); // scope 0 at $DIR/sroa.rs:+7:1: +7:2 -+ nop; // scope 0 at $DIR/sroa.rs:+7:1: +7:2 - return; // scope 0 at $DIR/sroa.rs:+7:2: +7:2 - } - } - diff --git a/tests/mir-opt/sroa.unions.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa.unions.ScalarReplacementOfAggregates.diff deleted file mode 100644 index adfb01385..000000000 --- a/tests/mir-opt/sroa.unions.ScalarReplacementOfAggregates.diff +++ /dev/null @@ -1,23 +0,0 @@ -- // MIR for `unions` before ScalarReplacementOfAggregates -+ // MIR for `unions` after ScalarReplacementOfAggregates - - fn unions(_1: f32) -> u32 { - debug a => _1; // in scope 0 at $DIR/sroa.rs:+0:15: +0:16 - let mut _0: u32; // return place in scope 0 at $DIR/sroa.rs:+0:26: +0:29 - let mut _2: unions::Repr; // in scope 0 at $DIR/sroa.rs:+5:14: +5:27 - let mut _3: f32; // in scope 0 at $DIR/sroa.rs:+5:24: +5:25 - scope 1 { - } - - bb0: { - StorageLive(_2); // scope 1 at $DIR/sroa.rs:+5:14: +5:27 - StorageLive(_3); // scope 1 at $DIR/sroa.rs:+5:24: +5:25 - _3 = _1; // scope 1 at $DIR/sroa.rs:+5:24: +5:25 - _2 = Repr { f: move _3 }; // scope 1 at $DIR/sroa.rs:+5:14: +5:27 - StorageDead(_3); // scope 1 at $DIR/sroa.rs:+5:26: +5:27 - _0 = (_2.1: u32); // scope 1 at $DIR/sroa.rs:+5:14: +5:29 - StorageDead(_2); // scope 0 at $DIR/sroa.rs:+6:1: +6:2 - return; // scope 0 at $DIR/sroa.rs:+6:2: +6:2 - } - } - diff --git a/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff new file mode 100644 index 000000000..579587a43 --- /dev/null +++ b/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff @@ -0,0 +1,214 @@ +- // MIR for `foo` before ScalarReplacementOfAggregates ++ // MIR for `foo` after ScalarReplacementOfAggregates + + fn foo() -> () { + let mut _0: (); // return place in scope 0 at $DIR/lifetimes.rs:+0:18: +0:18 + let _1: Foo; // in scope 0 at $DIR/lifetimes.rs:+1:9: +1:12 + let mut _2: std::result::Result, ::Err>; // in scope 0 at $DIR/lifetimes.rs:+2:12: +2:31 + let mut _3: std::boxed::Box; // in scope 0 at $DIR/lifetimes.rs:+2:15: +2:30 + let mut _4: std::boxed::Box; // in scope 0 at $DIR/lifetimes.rs:+2:15: +2:30 + let mut _7: isize; // in scope 0 at $DIR/lifetimes.rs:+9:12: +9:17 + let _9: (); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let _10: (); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _11: std::fmt::Arguments<'_>; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _12: &[&str]; // in scope 0 at $DIR/lifetimes.rs:+10:19: +10:28 + 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 _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 _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 + let mut _28: isize; // in scope 0 at $DIR/lifetimes.rs:+12:1: +12:2 + let mut _29: isize; // in scope 0 at $DIR/lifetimes.rs:+12:1: +12:2 + let mut _30: isize; // in scope 0 at $DIR/lifetimes.rs:+12:1: +12:2 ++ let _31: std::result::Result, ::Err>; // in scope 0 at $DIR/lifetimes.rs:+1:9: +1:12 ++ let _32: u32; // in scope 0 at $DIR/lifetimes.rs:+1:9: +1:12 + scope 1 { +- debug foo => _1; // in scope 1 at $DIR/lifetimes.rs:+1:9: +1:12 ++ debug foo => Foo{ .0 => _31, .1 => _32, }; // in scope 1 at $DIR/lifetimes.rs:+1:9: +1:12 + let _5: std::result::Result, ::Err>; // in scope 1 at $DIR/lifetimes.rs:+6:9: +6:10 + scope 2 { + debug x => _5; // in scope 2 at $DIR/lifetimes.rs:+6:9: +6:10 + let _6: u32; // in scope 2 at $DIR/lifetimes.rs:+7:9: +7:10 + scope 3 { + debug y => _6; // in scope 3 at $DIR/lifetimes.rs:+7:9: +7:10 + scope 4 { + debug x => _8; // in scope 4 at $DIR/lifetimes.rs:+9:15: +9:16 + let _8: std::boxed::Box; // in scope 4 at $DIR/lifetimes.rs:+9:15: +9:16 + let mut _26: &[&str; 3]; // in scope 4 at $DIR/lifetimes.rs:+10:19: +10:28 + } + } + } + } + + bb0: { + _27 = const false; // scope 0 at $DIR/lifetimes.rs:+1:9: +1:12 +- StorageLive(_1); // scope 0 at $DIR/lifetimes.rs:+1:9: +1:12 ++ StorageLive(_31); // scope 0 at $DIR/lifetimes.rs:+1:9: +1:12 ++ StorageLive(_32); // scope 0 at $DIR/lifetimes.rs:+1:9: +1:12 ++ nop; // scope 0 at $DIR/lifetimes.rs:+1:9: +1:12 + StorageLive(_2); // scope 0 at $DIR/lifetimes.rs:+2:12: +2:31 + StorageLive(_3); // scope 0 at $DIR/lifetimes.rs:+2:15: +2:30 + StorageLive(_4); // scope 0 at $DIR/lifetimes.rs:+2:15: +2:30 + _4 = Box::::new(const 5_u32) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lifetimes.rs:+2:15: +2:30 + // mir::Constant + // + span: $DIR/lifetimes.rs:19:15: 19:23 + // + user_ty: UserType(1) + // + literal: Const { ty: fn(u32) -> Box {Box::::new}, val: Value() } + } + + bb1: { + _3 = move _4 as std::boxed::Box (Pointer(Unsize)); // scope 0 at $DIR/lifetimes.rs:+2:15: +2:30 + StorageDead(_4); // scope 0 at $DIR/lifetimes.rs:+2:29: +2:30 + _2 = Result::, ::Err>::Ok(move _3); // scope 0 at $DIR/lifetimes.rs:+2:12: +2:31 + StorageDead(_3); // scope 0 at $DIR/lifetimes.rs:+2:30: +2:31 +- _1 = Foo:: { x: move _2, y: const 7_u32 }; // scope 0 at $DIR/lifetimes.rs:+1:23: +4:6 ++ _31 = move _2; // scope 0 at $DIR/lifetimes.rs:+1:23: +4:6 ++ _32 = const 7_u32; // scope 0 at $DIR/lifetimes.rs:+1:23: +4:6 ++ nop; // scope 0 at $DIR/lifetimes.rs:+1:23: +4:6 + StorageDead(_2); // scope 0 at $DIR/lifetimes.rs:+4:5: +4:6 + StorageLive(_5); // scope 1 at $DIR/lifetimes.rs:+6:9: +6:10 + _27 = const true; // scope 1 at $DIR/lifetimes.rs:+6:13: +6:18 +- _5 = move (_1.0: std::result::Result, ::Err>); // scope 1 at $DIR/lifetimes.rs:+6:13: +6:18 ++ _5 = move _31; // scope 1 at $DIR/lifetimes.rs:+6:13: +6:18 + StorageLive(_6); // scope 2 at $DIR/lifetimes.rs:+7:9: +7:10 +- _6 = (_1.1: u32); // scope 2 at $DIR/lifetimes.rs:+7:13: +7:18 ++ _6 = _32; // scope 2 at $DIR/lifetimes.rs:+7:13: +7:18 + _7 = discriminant(_5); // scope 4 at $DIR/lifetimes.rs:+9:12: +9:17 + switchInt(move _7) -> [0: bb2, otherwise: bb7]; // scope 4 at $DIR/lifetimes.rs:+9:12: +9:17 + } + + bb2: { + StorageLive(_8); // scope 4 at $DIR/lifetimes.rs:+9:15: +9:16 + _27 = const false; // scope 4 at $DIR/lifetimes.rs:+9:15: +9:16 + _8 = move ((_5 as Ok).0: std::boxed::Box); // scope 4 at $DIR/lifetimes.rs:+9:15: +9:16 + StorageLive(_9); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_10); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_11); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_12); // scope 4 at $DIR/lifetimes.rs:+10:19: +10:28 + StorageLive(_13); // scope 4 at $DIR/lifetimes.rs:+10:19: +10:28 + StorageLive(_14); // scope 4 at $DIR/lifetimes.rs:+10:19: +10:28 + _26 = const _; // scope 4 at $DIR/lifetimes.rs:+10:19: +10:28 + // mir::Constant + // + span: $DIR/lifetimes.rs:27:19: 27:28 + // + literal: Const { ty: &[&str; 3], val: Unevaluated(foo, [T], Some(promoted[0])) } + _14 = &(*_26); // scope 4 at $DIR/lifetimes.rs:+10:19: +10:28 + _13 = &(*_14); // scope 4 at $DIR/lifetimes.rs:+10:19: +10:28 + _12 = move _13 as &[&str] (Pointer(Unsize)); // scope 4 at $DIR/lifetimes.rs:+10:19: +10:28 + StorageDead(_13); // scope 4 at $DIR/lifetimes.rs:+10:27: +10:28 + StorageLive(_16); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_17); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_18); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_19); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_20); // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23 + StorageLive(_21); // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23 + 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 + // 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() } + } + + bb3: { + StorageDead(_21); // scope 4 at $DIR/lifetimes.rs:+10:22: +10:23 + StorageLive(_23); // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27 + StorageLive(_24); // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27 + 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 + // 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() } + } + + bb4: { + StorageDead(_24); // scope 4 at $DIR/lifetimes.rs:+10:26: +10:27 + _19 = [move _20, move _23]; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageDead(_23); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + 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 + 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() } + } + + bb5: { + StorageDead(_16); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageDead(_12); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + _10 = _eprint(move _11) -> [return: bb6, unwind unreachable]; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/std/src/macros.rs:LL:COL + // + literal: Const { ty: for<'a> fn(Arguments<'a>) {_eprint}, val: Value() } + } + + bb6: { + StorageDead(_11); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageDead(_25); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageDead(_22); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageDead(_19); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageDead(_18); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageDead(_14); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageDead(_10); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + _9 = const (); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageDead(_9); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + _0 = const (); // scope 4 at $DIR/lifetimes.rs:+9:22: +11:6 + drop(_8) -> [return: bb8, unwind unreachable]; // scope 3 at $DIR/lifetimes.rs:+11:5: +11:6 + } + + bb7: { + _0 = const (); // scope 3 at $DIR/lifetimes.rs:+11:6: +11:6 + goto -> bb9; // scope 3 at $DIR/lifetimes.rs:+9:5: +11:6 + } + + bb8: { + StorageDead(_8); // scope 3 at $DIR/lifetimes.rs:+11:5: +11:6 + goto -> bb9; // scope 3 at $DIR/lifetimes.rs:+9:5: +11:6 + } + + bb9: { + StorageDead(_6); // scope 2 at $DIR/lifetimes.rs:+12:1: +12:2 + _28 = discriminant(_5); // scope 1 at $DIR/lifetimes.rs:+12:1: +12:2 + switchInt(move _28) -> [0: bb11, otherwise: bb13]; // scope 1 at $DIR/lifetimes.rs:+12:1: +12:2 + } + + bb10: { + _27 = const false; // scope 1 at $DIR/lifetimes.rs:+12:1: +12:2 + StorageDead(_5); // scope 1 at $DIR/lifetimes.rs:+12:1: +12:2 +- StorageDead(_1); // scope 0 at $DIR/lifetimes.rs:+12:1: +12:2 ++ StorageDead(_31); // scope 0 at $DIR/lifetimes.rs:+12:1: +12:2 ++ StorageDead(_32); // scope 0 at $DIR/lifetimes.rs:+12:1: +12:2 ++ nop; // scope 0 at $DIR/lifetimes.rs:+12:1: +12:2 + return; // scope 0 at $DIR/lifetimes.rs:+12:2: +12:2 + } + + bb11: { + switchInt(_27) -> [0: bb10, otherwise: bb12]; // scope 1 at $DIR/lifetimes.rs:+12:1: +12:2 + } + + bb12: { + drop(((_5 as Ok).0: std::boxed::Box)) -> [return: bb10, unwind unreachable]; // scope 1 at $DIR/lifetimes.rs:+12:1: +12:2 + } + + bb13: { + drop(_5) -> [return: bb10, unwind unreachable]; // scope 1 at $DIR/lifetimes.rs:+12:1: +12:2 + } + } + diff --git a/tests/mir-opt/sroa/lifetimes.rs b/tests/mir-opt/sroa/lifetimes.rs new file mode 100644 index 000000000..2356d212f --- /dev/null +++ b/tests/mir-opt/sroa/lifetimes.rs @@ -0,0 +1,37 @@ +// unit-test: ScalarReplacementOfAggregates +// compile-flags: -Cpanic=abort +// no-prefer-dynamic + +trait Err { + type Err; +} + +struct Foo { + // Check that the `'static` lifetime is erased when creating the local for `x`, + // even if we fail to normalize the type. + x: Result, ::Err>, + y: u32, +} + +// EMIT_MIR lifetimes.foo.ScalarReplacementOfAggregates.diff +fn foo() { + let foo: Foo = Foo { + x: Ok(Box::new(5_u32)), + y: 7_u32, + }; + + let x = foo.x; + let y = foo.y; + + if let Ok(x) = x { + eprintln!("{x} {y}"); + } +} + +impl Err for () { + type Err = (); +} + +fn main() { + foo::<()>() +} diff --git a/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff new file mode 100644 index 000000000..647681f0e --- /dev/null +++ b/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff @@ -0,0 +1,46 @@ +- // MIR for `constant` before ScalarReplacementOfAggregates ++ // MIR for `constant` after ScalarReplacementOfAggregates + + fn constant() -> () { + let mut _0: (); // return place in scope 0 at $DIR/structs.rs:+0:15: +0:15 + let _1: (usize, u8); // in scope 0 at $DIR/structs.rs:+2:9: +2:10 ++ let _4: usize; // in scope 0 at $DIR/structs.rs:+2:9: +2:10 ++ let _5: u8; // in scope 0 at $DIR/structs.rs:+2:9: +2:10 + scope 1 { +- debug y => _1; // in scope 1 at $DIR/structs.rs:+2:9: +2:10 ++ debug y => (usize, u8){ .0 => _4, .1 => _5, }; // in scope 1 at $DIR/structs.rs:+2:9: +2:10 + let _2: usize; // in scope 1 at $DIR/structs.rs:+3:9: +3:10 + scope 2 { + debug t => _2; // in scope 2 at $DIR/structs.rs:+3:9: +3:10 + let _3: u8; // in scope 2 at $DIR/structs.rs:+4:9: +4:10 + scope 3 { + debug u => _3; // in scope 3 at $DIR/structs.rs:+4:9: +4:10 + } + } + } + + bb0: { +- StorageLive(_1); // scope 0 at $DIR/structs.rs:+2:9: +2:10 ++ StorageLive(_4); // scope 0 at $DIR/structs.rs:+2:9: +2:10 ++ StorageLive(_5); // scope 0 at $DIR/structs.rs:+2:9: +2:10 ++ nop; // scope 0 at $DIR/structs.rs:+2:9: +2:10 + _1 = const _; // scope 0 at $DIR/structs.rs:+2:13: +2:14 ++ _4 = move (_1.0: usize); // scope 1 at $DIR/structs.rs:+3:9: +3:10 ++ _5 = move (_1.1: u8); // scope 1 at $DIR/structs.rs:+3:9: +3:10 + StorageLive(_2); // scope 1 at $DIR/structs.rs:+3:9: +3:10 +- _2 = (_1.0: usize); // scope 1 at $DIR/structs.rs:+3:13: +3:16 ++ _2 = _4; // scope 1 at $DIR/structs.rs:+3:13: +3:16 + StorageLive(_3); // scope 2 at $DIR/structs.rs:+4:9: +4:10 +- _3 = (_1.1: u8); // scope 2 at $DIR/structs.rs:+4:13: +4:16 ++ _3 = _5; // scope 2 at $DIR/structs.rs:+4:13: +4:16 + _0 = const (); // scope 0 at $DIR/structs.rs:+0:15: +5:2 + StorageDead(_3); // scope 2 at $DIR/structs.rs:+5:1: +5:2 + StorageDead(_2); // scope 1 at $DIR/structs.rs:+5:1: +5:2 +- StorageDead(_1); // scope 0 at $DIR/structs.rs:+5:1: +5:2 ++ StorageDead(_4); // scope 0 at $DIR/structs.rs:+5:1: +5:2 ++ StorageDead(_5); // scope 0 at $DIR/structs.rs:+5:1: +5:2 ++ nop; // scope 0 at $DIR/structs.rs:+5:1: +5:2 + return; // scope 0 at $DIR/structs.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff new file mode 100644 index 000000000..b0b0da886 --- /dev/null +++ b/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff @@ -0,0 +1,91 @@ +- // MIR for `copies` before ScalarReplacementOfAggregates ++ // MIR for `copies` after ScalarReplacementOfAggregates + + fn copies(_1: Foo) -> () { + debug x => _1; // in scope 0 at $DIR/structs.rs:+0:11: +0:12 + let mut _0: (); // return place in scope 0 at $DIR/structs.rs:+0:19: +0:19 + let _2: Foo; // in scope 0 at $DIR/structs.rs:+1:9: +1:10 ++ let _11: u8; // in scope 0 at $DIR/structs.rs:+1:9: +1:10 ++ let _12: (); // in scope 0 at $DIR/structs.rs:+1:9: +1:10 ++ let _13: &str; // in scope 0 at $DIR/structs.rs:+1:9: +1:10 ++ let _14: std::option::Option; // in scope 0 at $DIR/structs.rs:+1:9: +1:10 + scope 1 { +- debug y => _2; // in scope 1 at $DIR/structs.rs:+1:9: +1:10 ++ debug y => Foo{ .0 => _11, .1 => _12, .2 => _13, .3 => _14, }; // in scope 1 at $DIR/structs.rs:+1:9: +1:10 + let _3: u8; // in scope 1 at $DIR/structs.rs:+2:9: +2:10 + scope 2 { + debug t => _3; // in scope 2 at $DIR/structs.rs:+2:9: +2:10 + let _4: &str; // in scope 2 at $DIR/structs.rs:+3:9: +3:10 + scope 3 { + debug u => _4; // in scope 3 at $DIR/structs.rs:+3:9: +3:10 + let _5: Foo; // in scope 3 at $DIR/structs.rs:+4:9: +4:10 ++ let _7: u8; // in scope 3 at $DIR/structs.rs:+4:9: +4:10 ++ let _8: (); // in scope 3 at $DIR/structs.rs:+4:9: +4:10 ++ let _9: &str; // in scope 3 at $DIR/structs.rs:+4:9: +4:10 ++ let _10: std::option::Option; // in scope 3 at $DIR/structs.rs:+4:9: +4:10 + scope 4 { +- debug z => _5; // in scope 4 at $DIR/structs.rs:+4:9: +4:10 ++ debug z => Foo{ .0 => _7, .1 => _8, .2 => _9, .3 => _10, }; // in scope 4 at $DIR/structs.rs:+4:9: +4:10 + let _6: (); // in scope 4 at $DIR/structs.rs:+5:9: +5:10 + scope 5 { + debug a => _6; // in scope 5 at $DIR/structs.rs:+5:9: +5:10 + } + } + } + } + } + + bb0: { +- StorageLive(_2); // scope 0 at $DIR/structs.rs:+1:9: +1:10 +- _2 = _1; // scope 0 at $DIR/structs.rs:+1:13: +1:14 ++ StorageLive(_11); // scope 0 at $DIR/structs.rs:+1:9: +1:10 ++ StorageLive(_12); // scope 0 at $DIR/structs.rs:+1:9: +1:10 ++ StorageLive(_13); // scope 0 at $DIR/structs.rs:+1:9: +1:10 ++ StorageLive(_14); // scope 0 at $DIR/structs.rs:+1:9: +1:10 ++ nop; // scope 0 at $DIR/structs.rs:+1:9: +1:10 ++ _11 = (_1.0: u8); // scope 0 at $DIR/structs.rs:+1:13: +1:14 ++ _12 = (_1.1: ()); // scope 0 at $DIR/structs.rs:+1:13: +1:14 ++ _13 = (_1.2: &str); // scope 0 at $DIR/structs.rs:+1:13: +1:14 ++ _14 = (_1.3: std::option::Option); // scope 0 at $DIR/structs.rs:+1:13: +1:14 ++ nop; // scope 0 at $DIR/structs.rs:+1:13: +1:14 + StorageLive(_3); // scope 1 at $DIR/structs.rs:+2:9: +2:10 +- _3 = (_2.0: u8); // scope 1 at $DIR/structs.rs:+2:13: +2:16 ++ _3 = _11; // scope 1 at $DIR/structs.rs:+2:13: +2:16 + StorageLive(_4); // scope 2 at $DIR/structs.rs:+3:9: +3:10 +- _4 = (_2.2: &str); // scope 2 at $DIR/structs.rs:+3:13: +3:16 +- StorageLive(_5); // scope 3 at $DIR/structs.rs:+4:9: +4:10 +- _5 = _2; // scope 3 at $DIR/structs.rs:+4:13: +4:14 ++ _4 = _13; // scope 2 at $DIR/structs.rs:+3:13: +3:16 ++ StorageLive(_7); // scope 3 at $DIR/structs.rs:+4:9: +4:10 ++ StorageLive(_8); // scope 3 at $DIR/structs.rs:+4:9: +4:10 ++ StorageLive(_9); // scope 3 at $DIR/structs.rs:+4:9: +4:10 ++ StorageLive(_10); // scope 3 at $DIR/structs.rs:+4:9: +4:10 ++ nop; // scope 3 at $DIR/structs.rs:+4:9: +4:10 ++ _7 = _11; // scope 3 at $DIR/structs.rs:+4:13: +4:14 ++ _8 = _12; // scope 3 at $DIR/structs.rs:+4:13: +4:14 ++ _9 = _13; // scope 3 at $DIR/structs.rs:+4:13: +4:14 ++ _10 = _14; // scope 3 at $DIR/structs.rs:+4:13: +4:14 ++ nop; // scope 3 at $DIR/structs.rs:+4:13: +4:14 + StorageLive(_6); // scope 4 at $DIR/structs.rs:+5:9: +5:10 +- _6 = (_5.1: ()); // scope 4 at $DIR/structs.rs:+5:13: +5:16 ++ _6 = _8; // scope 4 at $DIR/structs.rs:+5:13: +5:16 + _0 = const (); // scope 0 at $DIR/structs.rs:+0:19: +6:2 + StorageDead(_6); // scope 4 at $DIR/structs.rs:+6:1: +6:2 +- StorageDead(_5); // scope 3 at $DIR/structs.rs:+6:1: +6:2 ++ StorageDead(_7); // scope 3 at $DIR/structs.rs:+6:1: +6:2 ++ StorageDead(_8); // scope 3 at $DIR/structs.rs:+6:1: +6:2 ++ StorageDead(_9); // scope 3 at $DIR/structs.rs:+6:1: +6:2 ++ StorageDead(_10); // scope 3 at $DIR/structs.rs:+6:1: +6:2 ++ nop; // scope 3 at $DIR/structs.rs:+6:1: +6:2 + StorageDead(_4); // scope 2 at $DIR/structs.rs:+6:1: +6:2 + StorageDead(_3); // scope 1 at $DIR/structs.rs:+6:1: +6:2 +- StorageDead(_2); // scope 0 at $DIR/structs.rs:+6:1: +6:2 ++ StorageDead(_11); // scope 0 at $DIR/structs.rs:+6:1: +6:2 ++ StorageDead(_12); // scope 0 at $DIR/structs.rs:+6:1: +6:2 ++ StorageDead(_13); // scope 0 at $DIR/structs.rs:+6:1: +6:2 ++ StorageDead(_14); // scope 0 at $DIR/structs.rs:+6:1: +6:2 ++ nop; // scope 0 at $DIR/structs.rs:+6:1: +6:2 + return; // scope 0 at $DIR/structs.rs:+6:2: +6:2 + } + } + diff --git a/tests/mir-opt/sroa/structs.dropping.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.dropping.ScalarReplacementOfAggregates.diff new file mode 100644 index 000000000..d378c260a --- /dev/null +++ b/tests/mir-opt/sroa/structs.dropping.ScalarReplacementOfAggregates.diff @@ -0,0 +1,44 @@ +- // MIR for `dropping` before ScalarReplacementOfAggregates ++ // MIR for `dropping` after ScalarReplacementOfAggregates + + fn dropping() -> () { + let mut _0: (); // return place in scope 0 at $DIR/structs.rs:+0:19: +0:19 + let _1: Tag; // in scope 0 at $DIR/structs.rs:+1:5: +1:32 + let mut _2: S; // in scope 0 at $DIR/structs.rs:+1:5: +1:30 + let mut _3: Tag; // in scope 0 at $DIR/structs.rs:+1:7: +1:13 + let mut _4: Tag; // in scope 0 at $DIR/structs.rs:+1:15: +1:21 + let mut _5: Tag; // in scope 0 at $DIR/structs.rs:+1:23: +1:29 + + bb0: { + StorageLive(_1); // scope 0 at $DIR/structs.rs:+1:5: +1:32 + StorageLive(_2); // scope 0 at $DIR/structs.rs:+1:5: +1:30 + StorageLive(_3); // scope 0 at $DIR/structs.rs:+1:7: +1:13 + _3 = Tag(const 0_usize); // scope 0 at $DIR/structs.rs:+1:7: +1:13 + StorageLive(_4); // scope 0 at $DIR/structs.rs:+1:15: +1:21 + _4 = Tag(const 1_usize); // scope 0 at $DIR/structs.rs:+1:15: +1:21 + StorageLive(_5); // scope 0 at $DIR/structs.rs:+1:23: +1:29 + _5 = Tag(const 2_usize); // scope 0 at $DIR/structs.rs:+1:23: +1:29 + _2 = S(move _3, move _4, move _5); // scope 0 at $DIR/structs.rs:+1:5: +1:30 + StorageDead(_5); // scope 0 at $DIR/structs.rs:+1:29: +1:30 + StorageDead(_4); // scope 0 at $DIR/structs.rs:+1:29: +1:30 + StorageDead(_3); // scope 0 at $DIR/structs.rs:+1:29: +1:30 + _1 = move (_2.1: Tag); // scope 0 at $DIR/structs.rs:+1:5: +1:32 + drop(_1) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/structs.rs:+1:32: +1:33 + } + + bb1: { + drop((_2.0: Tag)) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/structs.rs:+1:32: +1:33 + } + + bb2: { + StorageDead(_2); // scope 0 at $DIR/structs.rs:+1:32: +1:33 + StorageDead(_1); // scope 0 at $DIR/structs.rs:+1:32: +1:33 + _0 = const (); // scope 0 at $DIR/structs.rs:+0:19: +2:2 + return; // scope 0 at $DIR/structs.rs:+2:2: +2:2 + } + + bb3: { + drop((_2.2: Tag)) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/structs.rs:+1:32: +1:33 + } + } + diff --git a/tests/mir-opt/sroa/structs.enums.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.enums.ScalarReplacementOfAggregates.diff new file mode 100644 index 000000000..ff1e30c2d --- /dev/null +++ b/tests/mir-opt/sroa/structs.enums.ScalarReplacementOfAggregates.diff @@ -0,0 +1,43 @@ +- // MIR for `enums` before ScalarReplacementOfAggregates ++ // MIR for `enums` after ScalarReplacementOfAggregates + + fn enums(_1: usize) -> usize { + debug a => _1; // in scope 0 at $DIR/structs.rs:+0:14: +0:15 + let mut _0: usize; // return place in scope 0 at $DIR/structs.rs:+0:27: +0:32 + let mut _2: std::option::Option; // in scope 0 at $DIR/structs.rs:+1:22: +1:29 + let mut _3: usize; // in scope 0 at $DIR/structs.rs:+1:27: +1:28 + let mut _4: isize; // in scope 0 at $DIR/structs.rs:+1:12: +1:19 + scope 1 { + debug a => _5; // in scope 1 at $DIR/structs.rs:+1:17: +1:18 + let _5: usize; // in scope 1 at $DIR/structs.rs:+1:17: +1:18 + } + + bb0: { + StorageLive(_2); // scope 1 at $DIR/structs.rs:+1:22: +1:29 + StorageLive(_3); // scope 1 at $DIR/structs.rs:+1:27: +1:28 + _3 = _1; // scope 1 at $DIR/structs.rs:+1:27: +1:28 + _2 = Option::::Some(move _3); // scope 1 at $DIR/structs.rs:+1:22: +1:29 + StorageDead(_3); // scope 1 at $DIR/structs.rs:+1:28: +1:29 + _4 = discriminant(_2); // scope 1 at $DIR/structs.rs:+1:12: +1:19 + switchInt(move _4) -> [1: bb1, otherwise: bb2]; // scope 1 at $DIR/structs.rs:+1:12: +1:19 + } + + bb1: { + StorageLive(_5); // scope 1 at $DIR/structs.rs:+1:17: +1:18 + _5 = ((_2 as Some).0: usize); // scope 1 at $DIR/structs.rs:+1:17: +1:18 + _0 = _5; // scope 1 at $DIR/structs.rs:+1:32: +1:33 + StorageDead(_5); // scope 0 at $DIR/structs.rs:+1:34: +1:35 + goto -> bb3; // scope 0 at $DIR/structs.rs:+1:5: +1:46 + } + + bb2: { + _0 = const 0_usize; // scope 0 at $DIR/structs.rs:+1:43: +1:44 + goto -> bb3; // scope 0 at $DIR/structs.rs:+1:5: +1:46 + } + + bb3: { + StorageDead(_2); // scope 0 at $DIR/structs.rs:+2:1: +2:2 + return; // scope 0 at $DIR/structs.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/sroa/structs.escaping.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.escaping.ScalarReplacementOfAggregates.diff new file mode 100644 index 000000000..3074fcbdf --- /dev/null +++ b/tests/mir-opt/sroa/structs.escaping.ScalarReplacementOfAggregates.diff @@ -0,0 +1,44 @@ +- // MIR for `escaping` before ScalarReplacementOfAggregates ++ // MIR for `escaping` after ScalarReplacementOfAggregates + + fn escaping() -> () { + let mut _0: (); // return place in scope 0 at $DIR/structs.rs:+0:19: +0:19 + let _1: (); // in scope 0 at $DIR/structs.rs:+1:5: +1:42 + let mut _2: *const u32; // in scope 0 at $DIR/structs.rs:+1:7: +1:41 + let _3: &u32; // in scope 0 at $DIR/structs.rs:+1:7: +1:41 + let _4: Escaping; // in scope 0 at $DIR/structs.rs:+1:8: +1:39 + let mut _5: u32; // in scope 0 at $DIR/structs.rs:+1:34: +1:37 + + bb0: { + StorageLive(_1); // scope 0 at $DIR/structs.rs:+1:5: +1:42 + StorageLive(_2); // scope 0 at $DIR/structs.rs:+1:7: +1:41 + StorageLive(_3); // scope 0 at $DIR/structs.rs:+1:7: +1:41 + StorageLive(_4); // scope 0 at $DIR/structs.rs:+1:8: +1:39 + StorageLive(_5); // scope 0 at $DIR/structs.rs:+1:34: +1:37 + _5 = g() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/structs.rs:+1:34: +1:37 + // mir::Constant + // + span: $DIR/structs.rs:78:34: 78:35 + // + literal: Const { ty: fn() -> u32 {g}, val: Value() } + } + + bb1: { + _4 = Escaping { a: const 1_u32, b: const 2_u32, c: move _5 }; // scope 0 at $DIR/structs.rs:+1:8: +1:39 + StorageDead(_5); // scope 0 at $DIR/structs.rs:+1:38: +1:39 + _3 = &(_4.0: u32); // scope 0 at $DIR/structs.rs:+1:7: +1:41 + _2 = &raw const (*_3); // scope 0 at $DIR/structs.rs:+1:7: +1:41 + _1 = f(move _2) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/structs.rs:+1:5: +1:42 + // mir::Constant + // + span: $DIR/structs.rs:78:5: 78:6 + // + literal: Const { ty: fn(*const u32) {f}, val: Value() } + } + + bb2: { + StorageDead(_2); // scope 0 at $DIR/structs.rs:+1:41: +1:42 + StorageDead(_4); // scope 0 at $DIR/structs.rs:+1:42: +1:43 + StorageDead(_3); // scope 0 at $DIR/structs.rs:+1:42: +1:43 + StorageDead(_1); // scope 0 at $DIR/structs.rs:+1:42: +1:43 + _0 = const (); // scope 0 at $DIR/structs.rs:+0:19: +2:2 + return; // scope 0 at $DIR/structs.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff new file mode 100644 index 000000000..1aa11d17b --- /dev/null +++ b/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff @@ -0,0 +1,80 @@ +- // MIR for `flat` before ScalarReplacementOfAggregates ++ // MIR for `flat` after ScalarReplacementOfAggregates + + fn flat() -> () { + let mut _0: (); // return place in scope 0 at $DIR/structs.rs:+0:15: +0:15 + let _1: u8; // in scope 0 at $DIR/structs.rs:+1:15: +1:16 + let _2: (); // in scope 0 at $DIR/structs.rs:+1:18: +1:19 + let _3: &str; // in scope 0 at $DIR/structs.rs:+1:21: +1:22 + let _4: std::option::Option; // in scope 0 at $DIR/structs.rs:+1:24: +1:25 + let mut _5: Foo; // in scope 0 at $DIR/structs.rs:+1:30: +1:70 + let mut _6: (); // in scope 0 at $DIR/structs.rs:+1:45: +1:47 + let mut _7: std::option::Option; // in scope 0 at $DIR/structs.rs:+1:60: +1:68 ++ let mut _8: u8; // in scope 0 at $DIR/structs.rs:+1:30: +1:70 ++ let mut _9: (); // in scope 0 at $DIR/structs.rs:+1:30: +1:70 ++ let mut _10: &str; // in scope 0 at $DIR/structs.rs:+1:30: +1:70 ++ let mut _11: std::option::Option; // in scope 0 at $DIR/structs.rs:+1:30: +1:70 + scope 1 { + debug a => _1; // in scope 1 at $DIR/structs.rs:+1:15: +1:16 + debug b => _2; // in scope 1 at $DIR/structs.rs:+1:18: +1:19 + debug c => _3; // in scope 1 at $DIR/structs.rs:+1:21: +1:22 + debug d => _4; // in scope 1 at $DIR/structs.rs:+1:24: +1:25 + scope 2 { + scope 3 { + scope 4 { + scope 5 { + } + } + } + } + } + + bb0: { +- StorageLive(_5); // scope 0 at $DIR/structs.rs:+1:30: +1:70 ++ StorageLive(_8); // scope 0 at $DIR/structs.rs:+1:30: +1:70 ++ StorageLive(_9); // scope 0 at $DIR/structs.rs:+1:30: +1:70 ++ StorageLive(_10); // scope 0 at $DIR/structs.rs:+1:30: +1:70 ++ StorageLive(_11); // scope 0 at $DIR/structs.rs:+1:30: +1:70 ++ nop; // scope 0 at $DIR/structs.rs:+1:30: +1:70 + StorageLive(_6); // scope 0 at $DIR/structs.rs:+1:45: +1:47 + _6 = (); // scope 0 at $DIR/structs.rs:+1:45: +1:47 + StorageLive(_7); // scope 0 at $DIR/structs.rs:+1:60: +1:68 + _7 = Option::::Some(const -4_isize); // scope 0 at $DIR/structs.rs:+1:60: +1:68 +- _5 = Foo { a: const 5_u8, b: move _6, c: const "a", d: move _7 }; // scope 0 at $DIR/structs.rs:+1:30: +1:70 ++ _8 = const 5_u8; // scope 0 at $DIR/structs.rs:+1:30: +1:70 ++ _9 = move _6; // scope 0 at $DIR/structs.rs:+1:30: +1:70 ++ _10 = const "a"; // scope 0 at $DIR/structs.rs:+1:30: +1:70 + // mir::Constant + // + span: $DIR/structs.rs:53:52: 53:55 + // + literal: Const { ty: &str, val: Value(Slice(..)) } ++ _11 = move _7; // scope 0 at $DIR/structs.rs:+1:30: +1:70 ++ nop; // scope 0 at $DIR/structs.rs:+1:30: +1:70 + StorageDead(_7); // scope 0 at $DIR/structs.rs:+1:69: +1:70 + StorageDead(_6); // scope 0 at $DIR/structs.rs:+1:69: +1:70 + StorageLive(_1); // scope 0 at $DIR/structs.rs:+1:15: +1:16 +- _1 = (_5.0: u8); // scope 0 at $DIR/structs.rs:+1:15: +1:16 ++ _1 = _8; // scope 0 at $DIR/structs.rs:+1:15: +1:16 + StorageLive(_2); // scope 0 at $DIR/structs.rs:+1:18: +1:19 +- _2 = (_5.1: ()); // scope 0 at $DIR/structs.rs:+1:18: +1:19 ++ _2 = _9; // scope 0 at $DIR/structs.rs:+1:18: +1:19 + StorageLive(_3); // scope 0 at $DIR/structs.rs:+1:21: +1:22 +- _3 = (_5.2: &str); // scope 0 at $DIR/structs.rs:+1:21: +1:22 ++ _3 = _10; // scope 0 at $DIR/structs.rs:+1:21: +1:22 + StorageLive(_4); // scope 0 at $DIR/structs.rs:+1:24: +1:25 +- _4 = (_5.3: std::option::Option); // scope 0 at $DIR/structs.rs:+1:24: +1:25 +- StorageDead(_5); // scope 0 at $DIR/structs.rs:+1:70: +1:71 ++ _4 = _11; // scope 0 at $DIR/structs.rs:+1:24: +1:25 ++ StorageDead(_8); // scope 0 at $DIR/structs.rs:+1:70: +1:71 ++ StorageDead(_9); // scope 0 at $DIR/structs.rs:+1:70: +1:71 ++ StorageDead(_10); // scope 0 at $DIR/structs.rs:+1:70: +1:71 ++ StorageDead(_11); // scope 0 at $DIR/structs.rs:+1:70: +1:71 ++ nop; // scope 0 at $DIR/structs.rs:+1:70: +1:71 + _0 = const (); // scope 0 at $DIR/structs.rs:+0:15: +6:2 + StorageDead(_4); // scope 0 at $DIR/structs.rs:+6:1: +6:2 + StorageDead(_3); // scope 0 at $DIR/structs.rs:+6:1: +6:2 + StorageDead(_2); // scope 0 at $DIR/structs.rs:+6:1: +6:2 + StorageDead(_1); // scope 0 at $DIR/structs.rs:+6:1: +6:2 + return; // scope 0 at $DIR/structs.rs:+6:2: +6:2 + } + } + diff --git a/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff new file mode 100644 index 000000000..7b09ac182 --- /dev/null +++ b/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff @@ -0,0 +1,56 @@ +- // MIR for `ref_copies` before ScalarReplacementOfAggregates ++ // MIR for `ref_copies` after ScalarReplacementOfAggregates + + fn ref_copies(_1: &Foo) -> () { + debug x => _1; // in scope 0 at $DIR/structs.rs:+0:15: +0:16 + let mut _0: (); // return place in scope 0 at $DIR/structs.rs:+0:24: +0:24 + let _2: Foo; // in scope 0 at $DIR/structs.rs:+1:9: +1:10 ++ let _5: u8; // in scope 0 at $DIR/structs.rs:+1:9: +1:10 ++ let _6: (); // in scope 0 at $DIR/structs.rs:+1:9: +1:10 ++ let _7: &str; // in scope 0 at $DIR/structs.rs:+1:9: +1:10 ++ let _8: std::option::Option; // in scope 0 at $DIR/structs.rs:+1:9: +1:10 + scope 1 { +- debug y => _2; // in scope 1 at $DIR/structs.rs:+1:9: +1:10 ++ debug y => Foo{ .0 => _5, .1 => _6, .2 => _7, .3 => _8, }; // in scope 1 at $DIR/structs.rs:+1:9: +1:10 + let _3: u8; // in scope 1 at $DIR/structs.rs:+2:9: +2:10 + scope 2 { + debug t => _3; // in scope 2 at $DIR/structs.rs:+2:9: +2:10 + let _4: &str; // in scope 2 at $DIR/structs.rs:+3:9: +3:10 + scope 3 { + debug u => _4; // in scope 3 at $DIR/structs.rs:+3:9: +3:10 + } + } + } + + bb0: { +- StorageLive(_2); // scope 0 at $DIR/structs.rs:+1:9: +1:10 +- _2 = (*_1); // scope 0 at $DIR/structs.rs:+1:13: +1:15 ++ StorageLive(_5); // scope 0 at $DIR/structs.rs:+1:9: +1:10 ++ StorageLive(_6); // scope 0 at $DIR/structs.rs:+1:9: +1:10 ++ StorageLive(_7); // scope 0 at $DIR/structs.rs:+1:9: +1:10 ++ StorageLive(_8); // scope 0 at $DIR/structs.rs:+1:9: +1:10 ++ nop; // scope 0 at $DIR/structs.rs:+1:9: +1:10 ++ _5 = ((*_1).0: u8); // scope 0 at $DIR/structs.rs:+1:13: +1:15 ++ _6 = ((*_1).1: ()); // scope 0 at $DIR/structs.rs:+1:13: +1:15 ++ _7 = ((*_1).2: &str); // scope 0 at $DIR/structs.rs:+1:13: +1:15 ++ _8 = ((*_1).3: std::option::Option); // scope 0 at $DIR/structs.rs:+1:13: +1:15 ++ nop; // scope 0 at $DIR/structs.rs:+1:13: +1:15 + StorageLive(_3); // scope 1 at $DIR/structs.rs:+2:9: +2:10 +- _3 = (_2.0: u8); // scope 1 at $DIR/structs.rs:+2:13: +2:16 ++ _3 = _5; // scope 1 at $DIR/structs.rs:+2:13: +2:16 + StorageLive(_4); // scope 2 at $DIR/structs.rs:+3:9: +3:10 +- _4 = (_2.2: &str); // scope 2 at $DIR/structs.rs:+3:13: +3:16 ++ _4 = _7; // scope 2 at $DIR/structs.rs:+3:13: +3:16 + _0 = const (); // scope 0 at $DIR/structs.rs:+0:24: +4:2 + StorageDead(_4); // scope 2 at $DIR/structs.rs:+4:1: +4:2 + StorageDead(_3); // scope 1 at $DIR/structs.rs:+4:1: +4:2 +- StorageDead(_2); // scope 0 at $DIR/structs.rs:+4:1: +4:2 ++ StorageDead(_5); // scope 0 at $DIR/structs.rs:+4:1: +4:2 ++ StorageDead(_6); // scope 0 at $DIR/structs.rs:+4:1: +4:2 ++ StorageDead(_7); // scope 0 at $DIR/structs.rs:+4:1: +4:2 ++ StorageDead(_8); // scope 0 at $DIR/structs.rs:+4:1: +4:2 ++ nop; // scope 0 at $DIR/structs.rs:+4:1: +4:2 + return; // scope 0 at $DIR/structs.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/sroa/structs.rs b/tests/mir-opt/sroa/structs.rs new file mode 100644 index 000000000..7946eeaea --- /dev/null +++ b/tests/mir-opt/sroa/structs.rs @@ -0,0 +1,122 @@ +// unit-test: ScalarReplacementOfAggregates +// compile-flags: -Cpanic=abort +// no-prefer-dynamic + +struct Tag(usize); + +#[repr(C)] +struct S(Tag, Tag, Tag); + +impl Drop for Tag { + #[inline(never)] + fn drop(&mut self) {} +} + +pub fn dropping() { + S(Tag(0), Tag(1), Tag(2)).1; +} + +pub fn enums(a: usize) -> usize { + if let Some(a) = Some(a) { a } else { 0 } +} + +pub fn structs(a: f32) -> f32 { + struct U { + _foo: usize, + a: f32, + } + + U { _foo: 0, a }.a +} + +pub fn unions(a: f32) -> u32 { + union Repr { + f: f32, + u: u32, + } + unsafe { Repr { f: a }.u } +} + +#[derive(Copy, Clone)] +struct Foo { + a: u8, + b: (), + c: &'static str, + d: Option, +} + +fn g() -> u32 { + 3 +} + +pub fn flat() { + let Foo { a, b, c, d } = Foo { a: 5, b: (), c: "a", d: Some(-4) }; + let _ = a; + let _ = b; + let _ = c; + let _ = d; +} + +#[repr(C)] +struct Escaping { + a: u32, + b: u32, + c: u32, +} + +fn f(a: *const u32) { + println!("{}", unsafe { *a.add(2) }); +} + +// `f` uses the `&e.a` to access `e.c`. This is UB according to Miri today; however, +// T-opsem has not finalized that decision and as such rustc should not rely on +// it. If SROA were to rely on it, it would be (almost) correct to turn `e` into +// three distinct locals - one for each field - and pass a reference to only one +// of them to `f`. However, this would lead to a miscompilation because `b` and `c` +// might no longer appear right after `a` in memory. +pub fn escaping() { + f(&Escaping { a: 1, b: 2, c: g() }.a); +} + +fn copies(x: Foo) { + let y = x; + let t = y.a; + let u = y.c; + let z = y; + let a = z.b; +} + +fn ref_copies(x: &Foo) { + let y = *x; + let t = y.a; + let u = y.c; +} + +fn constant() { + const U: (usize, u8) = (5, 9); + let y = U; + let t = y.0; + let u = y.1; +} + +fn main() { + dropping(); + enums(5); + structs(5.); + unions(5.); + flat(); + escaping(); + copies(Foo { a: 5, b: (), c: "a", d: Some(-4) }); + ref_copies(&Foo { a: 5, b: (), c: "a", d: Some(-4) }); + constant(); +} + +// EMIT_MIR structs.dropping.ScalarReplacementOfAggregates.diff +// EMIT_MIR structs.enums.ScalarReplacementOfAggregates.diff +// EMIT_MIR structs.structs.ScalarReplacementOfAggregates.diff +// EMIT_MIR structs.unions.ScalarReplacementOfAggregates.diff +// EMIT_MIR structs.flat.ScalarReplacementOfAggregates.diff +// EMIT_MIR structs.escaping.ScalarReplacementOfAggregates.diff +// EMIT_MIR structs.copies.ScalarReplacementOfAggregates.diff +// EMIT_MIR structs.ref_copies.ScalarReplacementOfAggregates.diff +// EMIT_MIR structs.constant.ScalarReplacementOfAggregates.diff diff --git a/tests/mir-opt/sroa/structs.structs.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.structs.ScalarReplacementOfAggregates.diff new file mode 100644 index 000000000..c94e4b137 --- /dev/null +++ b/tests/mir-opt/sroa/structs.structs.ScalarReplacementOfAggregates.diff @@ -0,0 +1,33 @@ +- // MIR for `structs` before ScalarReplacementOfAggregates ++ // MIR for `structs` after ScalarReplacementOfAggregates + + fn structs(_1: f32) -> f32 { + debug a => _1; // in scope 0 at $DIR/structs.rs:+0:16: +0:17 + let mut _0: f32; // return place in scope 0 at $DIR/structs.rs:+0:27: +0:30 + let mut _2: structs::U; // in scope 0 at $DIR/structs.rs:+6:5: +6:21 + let mut _3: f32; // in scope 0 at $DIR/structs.rs:+6:18: +6:19 ++ let mut _4: usize; // in scope 0 at $DIR/structs.rs:+6:5: +6:21 ++ let mut _5: f32; // in scope 0 at $DIR/structs.rs:+6:5: +6:21 + + bb0: { +- StorageLive(_2); // scope 0 at $DIR/structs.rs:+6:5: +6:21 ++ StorageLive(_4); // scope 0 at $DIR/structs.rs:+6:5: +6:21 ++ StorageLive(_5); // scope 0 at $DIR/structs.rs:+6:5: +6:21 ++ nop; // scope 0 at $DIR/structs.rs:+6:5: +6:21 + StorageLive(_3); // scope 0 at $DIR/structs.rs:+6:18: +6:19 + _3 = _1; // scope 0 at $DIR/structs.rs:+6:18: +6:19 +- _2 = U { _foo: const 0_usize, a: move _3 }; // scope 0 at $DIR/structs.rs:+6:5: +6:21 ++ _4 = const 0_usize; // scope 0 at $DIR/structs.rs:+6:5: +6:21 ++ _5 = move _3; // scope 0 at $DIR/structs.rs:+6:5: +6:21 ++ nop; // scope 0 at $DIR/structs.rs:+6:5: +6:21 + StorageDead(_3); // scope 0 at $DIR/structs.rs:+6:20: +6:21 +- _0 = (_2.1: f32); // scope 0 at $DIR/structs.rs:+6:5: +6:23 +- StorageDead(_2); // scope 0 at $DIR/structs.rs:+7:1: +7:2 ++ _0 = _5; // scope 0 at $DIR/structs.rs:+6:5: +6:23 ++ StorageDead(_4); // scope 0 at $DIR/structs.rs:+7:1: +7:2 ++ StorageDead(_5); // scope 0 at $DIR/structs.rs:+7:1: +7:2 ++ nop; // scope 0 at $DIR/structs.rs:+7:1: +7:2 + return; // scope 0 at $DIR/structs.rs:+7:2: +7:2 + } + } + diff --git a/tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff new file mode 100644 index 000000000..5aa054589 --- /dev/null +++ b/tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff @@ -0,0 +1,23 @@ +- // MIR for `unions` before ScalarReplacementOfAggregates ++ // MIR for `unions` after ScalarReplacementOfAggregates + + fn unions(_1: f32) -> u32 { + debug a => _1; // in scope 0 at $DIR/structs.rs:+0:15: +0:16 + let mut _0: u32; // return place in scope 0 at $DIR/structs.rs:+0:26: +0:29 + let mut _2: unions::Repr; // in scope 0 at $DIR/structs.rs:+5:14: +5:27 + let mut _3: f32; // in scope 0 at $DIR/structs.rs:+5:24: +5:25 + scope 1 { + } + + bb0: { + StorageLive(_2); // scope 1 at $DIR/structs.rs:+5:14: +5:27 + StorageLive(_3); // scope 1 at $DIR/structs.rs:+5:24: +5:25 + _3 = _1; // scope 1 at $DIR/structs.rs:+5:24: +5:25 + _2 = Repr { f: move _3 }; // scope 1 at $DIR/structs.rs:+5:14: +5:27 + StorageDead(_3); // scope 1 at $DIR/structs.rs:+5:26: +5:27 + _0 = (_2.1: u32); // scope 1 at $DIR/structs.rs:+5:14: +5:29 + StorageDead(_2); // scope 0 at $DIR/structs.rs:+6:1: +6:2 + return; // scope 0 at $DIR/structs.rs:+6:2: +6:2 + } + } + diff --git a/tests/mir-opt/try_identity_e2e.new.PreCodegen.after.mir b/tests/mir-opt/try_identity_e2e.new.PreCodegen.after.mir index b9cc10575..935dbb28b 100644 --- a/tests/mir-opt/try_identity_e2e.new.PreCodegen.after.mir +++ b/tests/mir-opt/try_identity_e2e.new.PreCodegen.after.mir @@ -26,37 +26,37 @@ fn new(_1: Result) -> Result { 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: bb2, 1: bb1, otherwise: bb5]; // scope 0 at $DIR/try_identity_e2e.rs:+3:13: +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 -> bb3; // scope 0 at $DIR/try_identity_e2e.rs:+5:47: +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 -> bb3; // scope 0 at $DIR/try_identity_e2e.rs:+4:49: +4:50 + goto -> bb4; // scope 0 at $DIR/try_identity_e2e.rs:+4:49: +4:50 } - bb3: { + bb4: { _6 = discriminant(_2); // scope 0 at $DIR/try_identity_e2e.rs:+2:15: +7:10 - switchInt(move _6) -> [0: bb6, 1: bb4, otherwise: bb5]; // scope 0 at $DIR/try_identity_e2e.rs:+2:9: +7:10 + switchInt(move _6) -> [0: bb6, 1: bb5, otherwise: bb2]; // scope 0 at $DIR/try_identity_e2e.rs:+2:9: +7:10 } - bb4: { + 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 } - bb5: { - unreachable; // scope 0 at $DIR/try_identity_e2e.rs:+2:15: +7:10 - } - 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 diff --git a/tests/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir b/tests/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir index 03f37b14b..a0b556640 100644 --- a/tests/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir +++ b/tests/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir @@ -34,7 +34,7 @@ fn main() -> () { StorageLive(_7); // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:11: +7:19 _7 = Test2::D; // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:11: +7:19 _8 = discriminant(_7); // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:11: +7:19 - switchInt(move _8) -> [4: bb5, 5: bb3, otherwise: bb4]; // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:5: +7:19 + switchInt(move _8) -> [4: bb4, 5: bb3, otherwise: bb2]; // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:5: +7:19 } bb2: { @@ -49,22 +49,18 @@ fn main() -> () { // + literal: Const { ty: &str, val: Value(Slice(..)) } _6 = &(*_9); // scope 0 at $DIR/uninhabited_enum_branching.rs:+9:21: +9:24 StorageDead(_9); // scope 0 at $DIR/uninhabited_enum_branching.rs:+9:23: +9:24 - goto -> bb6; // scope 0 at $DIR/uninhabited_enum_branching.rs:+9:23: +9:24 + goto -> bb5; // scope 0 at $DIR/uninhabited_enum_branching.rs:+9:23: +9:24 } bb4: { - unreachable; // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:11: +7:19 - } - - bb5: { _6 = const "D"; // scope 0 at $DIR/uninhabited_enum_branching.rs:+8:21: +8:24 // mir::Constant // + span: $DIR/uninhabited_enum_branching.rs:27:21: 27:24 // + literal: Const { ty: &str, val: Value(Slice(..)) } - goto -> bb6; // scope 0 at $DIR/uninhabited_enum_branching.rs:+8:21: +8:24 + goto -> bb5; // scope 0 at $DIR/uninhabited_enum_branching.rs:+8:21: +8:24 } - bb6: { + bb5: { StorageDead(_7); // scope 0 at $DIR/uninhabited_enum_branching.rs:+10:6: +10:7 StorageDead(_6); // scope 0 at $DIR/uninhabited_enum_branching.rs:+10:6: +10:7 _0 = const (); // scope 0 at $DIR/uninhabited_enum_branching.rs:+0:11: +11:2 diff --git a/tests/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff b/tests/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff index 671e11622..58d6e4281 100644 --- a/tests/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff +++ b/tests/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff @@ -63,7 +63,7 @@ StorageLive(_7); // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:11: +7:19 _7 = Test2::D; // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:11: +7:19 _8 = discriminant(_7); // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:11: +7:19 - switchInt(move _8) -> [4: bb8, 5: bb6, otherwise: bb7]; // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:5: +7:19 + switchInt(move _8) -> [4: bb7, 5: bb6, otherwise: bb2]; // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:5: +7:19 } bb6: { @@ -74,22 +74,18 @@ // + literal: Const { ty: &str, val: Value(Slice(..)) } _6 = &(*_9); // scope 0 at $DIR/uninhabited_enum_branching.rs:+9:21: +9:24 StorageDead(_9); // scope 0 at $DIR/uninhabited_enum_branching.rs:+9:23: +9:24 - goto -> bb9; // scope 0 at $DIR/uninhabited_enum_branching.rs:+9:23: +9:24 + goto -> bb8; // scope 0 at $DIR/uninhabited_enum_branching.rs:+9:23: +9:24 } bb7: { - unreachable; // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:11: +7:19 - } - - bb8: { _6 = const "D"; // scope 0 at $DIR/uninhabited_enum_branching.rs:+8:21: +8:24 // mir::Constant // + span: $DIR/uninhabited_enum_branching.rs:27:21: 27:24 // + literal: Const { ty: &str, val: Value(Slice(..)) } - goto -> bb9; // scope 0 at $DIR/uninhabited_enum_branching.rs:+8:21: +8:24 + goto -> bb8; // scope 0 at $DIR/uninhabited_enum_branching.rs:+8:21: +8:24 } - bb9: { + bb8: { StorageDead(_7); // scope 0 at $DIR/uninhabited_enum_branching.rs:+10:6: +10:7 StorageDead(_6); // scope 0 at $DIR/uninhabited_enum_branching.rs:+10:6: +10:7 _0 = const (); // scope 0 at $DIR/uninhabited_enum_branching.rs:+0:11: +11:2 diff --git a/tests/mir-opt/uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir b/tests/mir-opt/uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir index eb2a76ed1..0368b5f18 100644 --- a/tests/mir-opt/uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir +++ b/tests/mir-opt/uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir @@ -63,7 +63,7 @@ fn main() -> () { StorageDead(_3); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+8:6: +8:7 StorageLive(_9); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:5: +15:6 _10 = discriminant((_1.1: Test1)); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:11: +10:21 - switchInt(move _10) -> [2: bb7, 3: bb5, otherwise: bb6]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:5: +10:21 + switchInt(move _10) -> [2: bb6, 3: bb5, otherwise: bb2]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:5: +10:21 } bb5: { @@ -74,14 +74,10 @@ fn main() -> () { // + literal: Const { ty: &str, val: Value(Slice(..)) } _9 = &(*_13); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+14:21: +14:24 StorageDead(_13); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+14:23: +14:24 - goto -> bb8; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+14:23: +14:24 + goto -> bb7; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+14:23: +14:24 } bb6: { - unreachable; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:11: +10:21 - } - - bb7: { StorageLive(_12); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+13:21: +13:24 _12 = const "C"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+13:21: +13:24 // mir::Constant @@ -89,10 +85,10 @@ fn main() -> () { // + literal: Const { ty: &str, val: Value(Slice(..)) } _9 = &(*_12); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+13:21: +13:24 StorageDead(_12); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+13:23: +13:24 - goto -> bb8; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+13:23: +13:24 + goto -> bb7; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+13:23: +13:24 } - bb8: { + bb7: { StorageDead(_9); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+15:6: +15:7 _0 = const (); // scope 0 at $DIR/uninhabited_enum_branching2.rs:+0:11: +16:2 StorageDead(_1); // scope 0 at $DIR/uninhabited_enum_branching2.rs:+16:1: +16:2 diff --git a/tests/mir-opt/uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff b/tests/mir-opt/uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff index 4e797774d..73353941f 100644 --- a/tests/mir-opt/uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff +++ b/tests/mir-opt/uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff @@ -84,8 +84,8 @@ StorageDead(_3); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+8:6: +8:7 StorageLive(_9); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:5: +15:6 _10 = discriminant((_1.1: Test1)); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:11: +10:21 -- switchInt(move _10) -> [0: bb9, 1: bb10, 2: bb11, 3: bb7, otherwise: bb8]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:5: +10:21 -+ switchInt(move _10) -> [2: bb11, 3: bb7, otherwise: bb8]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:5: +10:21 +- switchInt(move _10) -> [0: bb8, 1: bb9, 2: bb10, 3: bb7, otherwise: bb2]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:5: +10:21 ++ switchInt(move _10) -> [2: bb10, 3: bb7, otherwise: bb2]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:5: +10:21 } bb7: { @@ -96,22 +96,18 @@ // + literal: Const { ty: &str, val: Value(Slice(..)) } _9 = &(*_13); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+14:21: +14:24 StorageDead(_13); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+14:23: +14:24 - goto -> bb12; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+14:23: +14:24 + goto -> bb11; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+14:23: +14:24 } bb8: { - unreachable; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:11: +10:21 - } - - bb9: { _9 = const "A(Empty)"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+11:24: +11:34 // mir::Constant // + span: $DIR/uninhabited_enum_branching2.rs:29:24: 29:34 // + literal: Const { ty: &str, val: Value(Slice(..)) } - goto -> bb12; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+11:24: +11:34 + goto -> bb11; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+11:24: +11:34 } - bb10: { + bb9: { StorageLive(_11); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+12:24: +12:34 _11 = const "B(Empty)"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+12:24: +12:34 // mir::Constant @@ -119,10 +115,10 @@ // + literal: Const { ty: &str, val: Value(Slice(..)) } _9 = &(*_11); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+12:24: +12:34 StorageDead(_11); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+12:33: +12:34 - goto -> bb12; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+12:33: +12:34 + goto -> bb11; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+12:33: +12:34 } - bb11: { + bb10: { StorageLive(_12); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+13:21: +13:24 _12 = const "C"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+13:21: +13:24 // mir::Constant @@ -130,10 +126,10 @@ // + literal: Const { ty: &str, val: Value(Slice(..)) } _9 = &(*_12); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+13:21: +13:24 StorageDead(_12); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+13:23: +13:24 - goto -> bb12; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+13:23: +13:24 + goto -> bb11; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+13:23: +13:24 } - bb12: { + bb11: { StorageDead(_9); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+15:6: +15:7 _0 = const (); // scope 0 at $DIR/uninhabited_enum_branching2.rs:+0:11: +16:2 StorageDead(_1); // scope 0 at $DIR/uninhabited_enum_branching2.rs:+16:1: +16:2 diff --git a/tests/mir-opt/unreachable.main.UnreachablePropagation.diff b/tests/mir-opt/unreachable.main.UnreachablePropagation.diff index 848bff1d4..323b61346 100644 --- a/tests/mir-opt/unreachable.main.UnreachablePropagation.diff +++ b/tests/mir-opt/unreachable.main.UnreachablePropagation.diff @@ -21,7 +21,7 @@ StorageLive(_1); // scope 1 at $DIR/unreachable.rs:+1:23: +1:30 _1 = empty() -> bb1; // scope 1 at $DIR/unreachable.rs:+1:23: +1:30 // mir::Constant - // + span: $DIR/unreachable.rs:9:23: 9:28 + // + span: $DIR/unreachable.rs:10:23: 10:28 // + literal: Const { ty: fn() -> Option {empty}, val: Value() } } diff --git a/tests/mir-opt/unreachable.rs b/tests/mir-opt/unreachable.rs index 6098b525b..97093729d 100644 --- a/tests/mir-opt/unreachable.rs +++ b/tests/mir-opt/unreachable.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default enum Empty {} fn empty() -> Option { diff --git a/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff index fb778470e..94bc63361 100644 --- a/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff +++ b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff @@ -23,7 +23,7 @@ StorageLive(_2); // scope 2 at $DIR/unreachable_diverging.rs:+2:25: +2:32 _2 = empty() -> bb1; // scope 2 at $DIR/unreachable_diverging.rs:+2:25: +2:32 // mir::Constant - // + span: $DIR/unreachable_diverging.rs:14:25: 14:30 + // + span: $DIR/unreachable_diverging.rs:15:25: 15:30 // + literal: Const { ty: fn() -> Option {empty}, val: Value() } } @@ -44,7 +44,7 @@ bb3: { _5 = loop_forever() -> bb5; // scope 2 at $DIR/unreachable_diverging.rs:+4:13: +4:27 // mir::Constant - // + span: $DIR/unreachable_diverging.rs:16:13: 16:25 + // + span: $DIR/unreachable_diverging.rs:17:13: 17:25 // + literal: Const { ty: fn() {loop_forever}, val: Value() } } diff --git a/tests/mir-opt/unreachable_diverging.rs b/tests/mir-opt/unreachable_diverging.rs index bbf28efc7..24e776148 100644 --- a/tests/mir-opt/unreachable_diverging.rs +++ b/tests/mir-opt/unreachable_diverging.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default pub enum Empty {} fn empty() -> Option { diff --git a/tests/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.mir b/tests/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.mir index ed9f3bdbd..c27a93e91 100644 --- a/tests/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.mir +++ b/tests/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.mir @@ -22,7 +22,7 @@ fn std::ptr::drop_in_place(_1: *mut Vec) -> () { } bb4 (cleanup): { - drop(((*_1).0: alloc::raw_vec::RawVec)) -> bb2; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + drop(((*_1).0: alloc::raw_vec::RawVec)) -> [return: bb2, unwind terminate]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 } bb5: { diff --git a/tests/mir-opt/while_storage.rs b/tests/mir-opt/while_storage.rs index afd083acb..d10048dd9 100644 --- a/tests/mir-opt/while_storage.rs +++ b/tests/mir-opt/while_storage.rs @@ -1,3 +1,4 @@ +// ignore-wasm32 compiled with panic=abort by default // Test that we correctly generate StorageDead statements for while loop // conditions on all branches diff --git a/tests/mir-opt/while_storage.while_loop.PreCodegen.after.mir b/tests/mir-opt/while_storage.while_loop.PreCodegen.after.mir index 318119bd4..811789a60 100644 --- a/tests/mir-opt/while_storage.while_loop.PreCodegen.after.mir +++ b/tests/mir-opt/while_storage.while_loop.PreCodegen.after.mir @@ -14,7 +14,7 @@ fn while_loop(_1: bool) -> () { StorageLive(_2); // scope 0 at $DIR/while_storage.rs:+1:11: +1:22 _2 = get_bool(_1) -> bb2; // scope 0 at $DIR/while_storage.rs:+1:11: +1:22 // mir::Constant - // + span: $DIR/while_storage.rs:10:11: 10:19 + // + span: $DIR/while_storage.rs:11:11: 11:19 // + literal: Const { ty: fn(bool) -> bool {get_bool}, val: Value() } } @@ -26,7 +26,7 @@ fn while_loop(_1: bool) -> () { StorageLive(_3); // scope 0 at $DIR/while_storage.rs:+2:12: +2:23 _3 = get_bool(_1) -> bb4; // scope 0 at $DIR/while_storage.rs:+2:12: +2:23 // mir::Constant - // + span: $DIR/while_storage.rs:11:12: 11:20 + // + span: $DIR/while_storage.rs:12:12: 12:20 // + literal: Const { ty: fn(bool) -> bool {get_bool}, val: Value() } } diff --git a/tests/pretty/ast-stmt-expr-attr.rs b/tests/pretty/ast-stmt-expr-attr.rs index 27c86ec22..a958666e3 100644 --- a/tests/pretty/ast-stmt-expr-attr.rs +++ b/tests/pretty/ast-stmt-expr-attr.rs @@ -4,7 +4,6 @@ fn main() {} #[cfg(FALSE)] fn syntax() { - let _ = #[attr] box 0; let _ = #[attr] []; let _ = #[attr] [0]; let _ = #[attr] [0; 0]; diff --git a/tests/pretty/issue-4264.pp b/tests/pretty/issue-4264.pp index e0fa1fe28..4020a433d 100644 --- a/tests/pretty/issue-4264.pp +++ b/tests/pretty/issue-4264.pp @@ -32,13 +32,11 @@ fn bar() ({ ({ let res = ((::alloc::fmt::format as - for<'a> fn(Arguments<'a>) -> String {format})(((<#[lang = "format_arguments"]>::new_v1 + for<'a> fn(Arguments<'a>) -> String {format})(((<#[lang = "format_arguments"]>::new_const as - fn(&[&'static str], &[core::fmt::ArgumentV1<'_>]) -> Arguments<'_> {Arguments::<'_>::new_v1})((&([("test" - as &str)] as [&str; 1]) as &[&str; 1]), - (&([] as [core::fmt::ArgumentV1<'_>; 0]) as - &[core::fmt::ArgumentV1<'_>; 0])) as Arguments<'_>)) as - String); + fn(&[&'static str]) -> Arguments<'_> {Arguments::<'_>::new_const})((&([("test" + as &str)] as [&str; 1]) as &[&str; 1])) as Arguments<'_>)) + as String); (res as String) } as String); } as ()) diff --git a/tests/pretty/stmt_expr_attributes.rs b/tests/pretty/stmt_expr_attributes.rs index c01379065..052c45f2c 100644 --- a/tests/pretty/stmt_expr_attributes.rs +++ b/tests/pretty/stmt_expr_attributes.rs @@ -1,6 +1,5 @@ // pp-exact -#![feature(box_syntax)] #![feature(inline_const)] #![feature(inline_const_pat)] #![feature(rustc_attrs)] @@ -140,7 +139,6 @@ fn _10() { } fn _11() { - let _ = #[rustc_dummy] box 0; let _: [(); 0] = #[rustc_dummy] []; let _ = #[rustc_dummy] [0, 0]; let _ = #[rustc_dummy] [0; 0]; diff --git a/tests/pretty/tests-are-sorted.pp b/tests/pretty/tests-are-sorted.pp index 15dcd4ed9..58f746f2e 100644 --- a/tests/pretty/tests-are-sorted.pp +++ b/tests/pretty/tests-are-sorted.pp @@ -4,7 +4,7 @@ use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; -// compile-flags: --crate-type=lib --test +// compile-flags: --crate-type=lib --test --remap-path-prefix={{src-base}}/=/the/src/ --remap-path-prefix={{src-base}}\=/the/src/ // pretty-compare-only // pretty-mode:expanded // pp-exact:tests-are-sorted.pp @@ -18,6 +18,11 @@ pub const m_test: test::TestDescAndFn = name: test::StaticTestName("m_test"), ignore: false, ignore_message: ::core::option::Option::None, + source_file: "/the/src/tests-are-sorted.rs", + start_line: 7usize, + start_col: 4usize, + end_line: 7usize, + end_col: 10usize, compile_fail: false, no_run: false, should_panic: test::ShouldPanic::No, @@ -34,8 +39,13 @@ pub const z_test: test::TestDescAndFn = test::TestDescAndFn { desc: test::TestDesc { name: test::StaticTestName("z_test"), - ignore: false, - ignore_message: ::core::option::Option::None, + ignore: true, + ignore_message: ::core::option::Option::Some("not yet implemented"), + source_file: "/the/src/tests-are-sorted.rs", + start_line: 11usize, + start_col: 4usize, + end_line: 11usize, + end_col: 10usize, compile_fail: false, no_run: false, should_panic: test::ShouldPanic::No, @@ -43,6 +53,7 @@ pub const z_test: test::TestDescAndFn = }, testfn: test::StaticTestFn(|| test::assert_test_result(z_test())), }; +#[ignore = "not yet implemented"] fn z_test() {} extern crate test; @@ -54,6 +65,11 @@ pub const a_test: test::TestDescAndFn = name: test::StaticTestName("a_test"), ignore: false, ignore_message: ::core::option::Option::None, + source_file: "/the/src/tests-are-sorted.rs", + start_line: 14usize, + start_col: 4usize, + end_line: 14usize, + end_col: 10usize, compile_fail: false, no_run: false, should_panic: test::ShouldPanic::No, diff --git a/tests/pretty/tests-are-sorted.rs b/tests/pretty/tests-are-sorted.rs index 1f737d547..39e092225 100644 --- a/tests/pretty/tests-are-sorted.rs +++ b/tests/pretty/tests-are-sorted.rs @@ -1,4 +1,4 @@ -// compile-flags: --crate-type=lib --test +// compile-flags: --crate-type=lib --test --remap-path-prefix={{src-base}}/=/the/src/ --remap-path-prefix={{src-base}}\=/the/src/ // pretty-compare-only // pretty-mode:expanded // pp-exact:tests-are-sorted.pp @@ -7,6 +7,7 @@ fn m_test() {} #[test] +#[ignore = "not yet implemented"] fn z_test() {} #[test] diff --git a/tests/run-make-fulldeps/a-b-a-linker-guard/Makefile b/tests/run-make-fulldeps/a-b-a-linker-guard/Makefile deleted file mode 100644 index adc9e3d09..000000000 --- a/tests/run-make-fulldeps/a-b-a-linker-guard/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -include ../tools.mk - -# Test that if we build `b` against a version of `a` that has one set -# of types, it will not run with a dylib that has a different set of -# types. - -# NOTE(eddyb) this test only works with the `legacy` mangling, -# and will probably get removed once `legacy` is gone. - -all: - $(RUSTC) a.rs --cfg x -C prefer-dynamic -Z unstable-options -C symbol-mangling-version=legacy - $(RUSTC) b.rs -C prefer-dynamic -Z unstable-options -C symbol-mangling-version=legacy - $(call RUN,b) - $(RUSTC) a.rs --cfg y -C prefer-dynamic -Z unstable-options -C symbol-mangling-version=legacy - $(call FAIL,b) diff --git a/tests/run-make-fulldeps/a-b-a-linker-guard/a.rs b/tests/run-make-fulldeps/a-b-a-linker-guard/a.rs deleted file mode 100644 index aa07b1e71..000000000 --- a/tests/run-make-fulldeps/a-b-a-linker-guard/a.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![crate_name = "a"] -#![crate_type = "dylib"] - -#[cfg(x)] -pub fn foo(x: u32) { } - -#[cfg(y)] -pub fn foo(x: i32) { } diff --git a/tests/run-make-fulldeps/a-b-a-linker-guard/b.rs b/tests/run-make-fulldeps/a-b-a-linker-guard/b.rs deleted file mode 100644 index f30df120a..000000000 --- a/tests/run-make-fulldeps/a-b-a-linker-guard/b.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![crate_name = "b"] - -extern crate a; - -fn main() { - a::foo(22_u32); -} diff --git a/tests/run-make-fulldeps/alloc-no-oom-handling/Makefile b/tests/run-make-fulldeps/alloc-no-oom-handling/Makefile deleted file mode 100644 index 87f74c69c..000000000 --- a/tests/run-make-fulldeps/alloc-no-oom-handling/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/alloc/src/lib.rs --cfg no_global_oom_handling diff --git a/tests/run-make-fulldeps/alloc-no-rc/Makefile b/tests/run-make-fulldeps/alloc-no-rc/Makefile deleted file mode 100644 index 9824b17e6..000000000 --- a/tests/run-make-fulldeps/alloc-no-rc/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/alloc/src/lib.rs --cfg no_rc diff --git a/tests/run-make-fulldeps/alloc-no-sync/Makefile b/tests/run-make-fulldeps/alloc-no-sync/Makefile deleted file mode 100644 index 04ec4c7d8..000000000 --- a/tests/run-make-fulldeps/alloc-no-sync/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/alloc/src/lib.rs --cfg no_sync diff --git a/tests/run-make-fulldeps/allow-non-lint-warnings-cmdline/Makefile b/tests/run-make-fulldeps/allow-non-lint-warnings-cmdline/Makefile deleted file mode 100644 index 60d9c7c37..000000000 --- a/tests/run-make-fulldeps/allow-non-lint-warnings-cmdline/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include ../tools.mk - -# Test that -A warnings makes the 'empty trait list for derive' warning go away -OUT=$(shell $(RUSTC) foo.rs -A warnings 2>&1 | grep "warning" ) - -all: foo - test -z '$(OUT)' - -# This is just to make sure the above command actually succeeds -foo: - $(RUSTC) foo.rs -A warnings diff --git a/tests/run-make-fulldeps/allow-non-lint-warnings-cmdline/foo.rs b/tests/run-make-fulldeps/allow-non-lint-warnings-cmdline/foo.rs deleted file mode 100644 index 46e72da2d..000000000 --- a/tests/run-make-fulldeps/allow-non-lint-warnings-cmdline/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[derive()] -#[derive(Copy, Clone)] -pub struct Foo; - -pub fn main() { } diff --git a/tests/run-make-fulldeps/allow-warnings-cmdline-stability/Makefile b/tests/run-make-fulldeps/allow-warnings-cmdline-stability/Makefile deleted file mode 100644 index 1ce8d0ec2..000000000 --- a/tests/run-make-fulldeps/allow-warnings-cmdline-stability/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -include ../tools.mk - -# Test that -A warnings makes the 'empty trait list for derive' warning go away -DEP=$(shell $(RUSTC) bar.rs) -OUT=$(shell $(RUSTC) foo.rs -A warnings 2>&1 | grep "warning" ) - -all: foo bar - test -z '$(OUT)' - -# These are just to ensure that the above commands actually work -bar: - $(RUSTC) bar.rs - -foo: bar - $(RUSTC) foo.rs -A warnings diff --git a/tests/run-make-fulldeps/allow-warnings-cmdline-stability/bar.rs b/tests/run-make-fulldeps/allow-warnings-cmdline-stability/bar.rs deleted file mode 100644 index 3dcfb9dad..000000000 --- a/tests/run-make-fulldeps/allow-warnings-cmdline-stability/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![crate_type = "lib"] -#![feature(staged_api)] -#![unstable(feature = "unstable_test_feature", issue = "none")] - -pub fn baz() {} diff --git a/tests/run-make-fulldeps/allow-warnings-cmdline-stability/foo.rs b/tests/run-make-fulldeps/allow-warnings-cmdline-stability/foo.rs deleted file mode 100644 index 869b54354..000000000 --- a/tests/run-make-fulldeps/allow-warnings-cmdline-stability/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![feature(unstable_test_feature)] - -extern crate bar; - -pub fn main() { bar::baz() } diff --git a/tests/run-make-fulldeps/archive-duplicate-names/Makefile b/tests/run-make-fulldeps/archive-duplicate-names/Makefile deleted file mode 100644 index bbdcd2a34..000000000 --- a/tests/run-make-fulldeps/archive-duplicate-names/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include ../tools.mk - -all: - mkdir $(TMPDIR)/a - mkdir $(TMPDIR)/b - $(call COMPILE_OBJ,$(TMPDIR)/a/foo.o,foo.c) - $(call COMPILE_OBJ,$(TMPDIR)/b/foo.o,bar.c) - $(AR) crus $(TMPDIR)/libfoo.a $(TMPDIR)/a/foo.o $(TMPDIR)/b/foo.o - $(RUSTC) foo.rs - $(RUSTC) bar.rs - $(call RUN,bar) diff --git a/tests/run-make-fulldeps/archive-duplicate-names/bar.c b/tests/run-make-fulldeps/archive-duplicate-names/bar.c deleted file mode 100644 index e42599986..000000000 --- a/tests/run-make-fulldeps/archive-duplicate-names/bar.c +++ /dev/null @@ -1 +0,0 @@ -void bar() {} diff --git a/tests/run-make-fulldeps/archive-duplicate-names/bar.rs b/tests/run-make-fulldeps/archive-duplicate-names/bar.rs deleted file mode 100644 index 994a98c2c..000000000 --- a/tests/run-make-fulldeps/archive-duplicate-names/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate foo; - -fn main() { - foo::baz(); -} diff --git a/tests/run-make-fulldeps/archive-duplicate-names/foo.c b/tests/run-make-fulldeps/archive-duplicate-names/foo.c deleted file mode 100644 index 85e6cd8c3..000000000 --- a/tests/run-make-fulldeps/archive-duplicate-names/foo.c +++ /dev/null @@ -1 +0,0 @@ -void foo() {} diff --git a/tests/run-make-fulldeps/archive-duplicate-names/foo.rs b/tests/run-make-fulldeps/archive-duplicate-names/foo.rs deleted file mode 100644 index 0bf13c406..000000000 --- a/tests/run-make-fulldeps/archive-duplicate-names/foo.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![crate_type = "rlib"] - -#[link(name = "foo", kind = "static")] -extern "C" { - fn foo(); - fn bar(); -} - -pub fn baz() { - unsafe { - foo(); - bar(); - } -} diff --git a/tests/run-make-fulldeps/arguments-non-c-like-enum/Makefile b/tests/run-make-fulldeps/arguments-non-c-like-enum/Makefile deleted file mode 100644 index 513311c82..000000000 --- a/tests/run-make-fulldeps/arguments-non-c-like-enum/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --crate-type=staticlib nonclike.rs - $(CC) test.c $(call STATICLIB,nonclike) $(call OUT_EXE,test) \ - $(EXTRACFLAGS) $(EXTRACXXFLAGS) - $(call RUN,test) diff --git a/tests/run-make-fulldeps/arguments-non-c-like-enum/nonclike.rs b/tests/run-make-fulldeps/arguments-non-c-like-enum/nonclike.rs deleted file mode 100644 index 57c2c6127..000000000 --- a/tests/run-make-fulldeps/arguments-non-c-like-enum/nonclike.rs +++ /dev/null @@ -1,31 +0,0 @@ -#[repr(C, u8)] -pub enum TT { - AA(u64, u64), - BB, -} - -#[no_mangle] -pub extern "C" fn tt_add(a: TT, b: TT) -> u64 { - match (a, b) { - (TT::AA(a1, b1), TT::AA(a2, b2)) => a1 + a2 + b1 + b2, - (TT::AA(a1, b1), TT::BB) => a1 + b1, - (TT::BB, TT::AA(a1, b1)) => a1 + b1, - _ => 0, - } -} - -#[repr(C, u8)] -pub enum T { - A(u64), - B, -} - -#[no_mangle] -pub extern "C" fn t_add(a: T, b: T) -> u64 { - match (a, b) { - (T::A(a), T::A(b)) => a + b, - (T::A(a), T::B) => a, - (T::B, T::A(b)) => b, - _ => 0, - } -} diff --git a/tests/run-make-fulldeps/arguments-non-c-like-enum/test.c b/tests/run-make-fulldeps/arguments-non-c-like-enum/test.c deleted file mode 100644 index 0a1621e49..000000000 --- a/tests/run-make-fulldeps/arguments-non-c-like-enum/test.c +++ /dev/null @@ -1,66 +0,0 @@ -#include -#include - -#include - -/* This is the code generated by cbindgen 0.12.1 for the `enum TT` - * type in nonclike.rs . */ -enum TT_Tag { - AA, - BB, -}; -typedef uint8_t TT_Tag; - -typedef struct { - uint64_t _0; - uint64_t _1; -} AA_Body; - -typedef struct { - TT_Tag tag; - union { - AA_Body aa; - }; -} TT; - -/* This is the code generated by cbindgen 0.12.1 for the `enum T` type - * in nonclike.rs . */ -enum T_Tag { - A, - B, -}; -typedef uint8_t T_Tag; - -typedef struct { - uint64_t _0; -} A_Body; - -typedef struct { - T_Tag tag; - union { - A_Body a; - }; -} T; - -/* These symbols are defined by the Rust staticlib built from - * nonclike.rs. */ -extern uint64_t t_add(T a, T b); -extern uint64_t tt_add(TT a, TT b); - -int main(int argc, char *argv[]) { - (void)argc; (void)argv; - - /* This example works. */ - TT xx = { .tag = AA, .aa = { ._0 = 1, ._1 = 2 } }; - TT yy = { .tag = AA, .aa = { ._0 = 10, ._1 = 20 } }; - uint64_t rr = tt_add(xx, yy); - assert(33 == rr); - - /* This one used to return an incorrect result (see issue #68190). */ - T x = { .tag = A, .a = { ._0 = 1 } }; - T y = { .tag = A, .a = { ._0 = 10 } }; - uint64_t r = t_add(x, y); - assert(11 == r); - - return 0; -} diff --git a/tests/run-make-fulldeps/atomic-lock-free/Makefile b/tests/run-make-fulldeps/atomic-lock-free/Makefile deleted file mode 100644 index 37e59624a..000000000 --- a/tests/run-make-fulldeps/atomic-lock-free/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -include ../tools.mk - -# This tests ensure that atomic types are never lowered into runtime library calls that are not -# guaranteed to be lock-free. - -all: -ifeq ($(UNAME),Linux) -ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86) - $(RUSTC) --target=i686-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add - $(RUSTC) --target=x86_64-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add -endif -ifeq ($(filter arm,$(LLVM_COMPONENTS)),arm) - $(RUSTC) --target=arm-unknown-linux-gnueabi atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add - $(RUSTC) --target=arm-unknown-linux-gnueabihf atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add - $(RUSTC) --target=armv7-unknown-linux-gnueabihf atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add - $(RUSTC) --target=thumbv7neon-unknown-linux-gnueabihf atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add -endif -ifeq ($(filter aarch64,$(LLVM_COMPONENTS)),aarch64) - $(RUSTC) --target=aarch64-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add -endif -ifeq ($(filter mips,$(LLVM_COMPONENTS)),mips) - $(RUSTC) --target=mips-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add - $(RUSTC) --target=mipsel-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add -endif -ifeq ($(filter powerpc,$(LLVM_COMPONENTS)),powerpc) - $(RUSTC) --target=powerpc-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add - $(RUSTC) --target=powerpc-unknown-linux-gnuspe atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add - $(RUSTC) --target=powerpc64-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add - $(RUSTC) --target=powerpc64le-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add -endif -ifeq ($(filter systemz,$(LLVM_COMPONENTS)),systemz) - $(RUSTC) --target=s390x-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add -endif -endif diff --git a/tests/run-make-fulldeps/atomic-lock-free/atomic_lock_free.rs b/tests/run-make-fulldeps/atomic-lock-free/atomic_lock_free.rs deleted file mode 100644 index 47d90b185..000000000 --- a/tests/run-make-fulldeps/atomic-lock-free/atomic_lock_free.rs +++ /dev/null @@ -1,66 +0,0 @@ -#![feature(no_core, intrinsics, lang_items)] -#![crate_type="rlib"] -#![no_core] - -extern "rust-intrinsic" { - fn atomic_xadd_seqcst(dst: *mut T, src: T) -> T; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} -#[lang = "freeze"] -trait Freeze {} - -impl Copy for *mut T {} - -#[cfg(target_has_atomic = "8")] -pub unsafe fn atomic_u8(x: *mut u8) { - atomic_xadd_seqcst(x, 1); - atomic_xadd_seqcst(x, 1); -} -#[cfg(target_has_atomic = "8")] -pub unsafe fn atomic_i8(x: *mut i8) { - atomic_xadd_seqcst(x, 1); -} -#[cfg(target_has_atomic = "16")] -pub unsafe fn atomic_u16(x: *mut u16) { - atomic_xadd_seqcst(x, 1); -} -#[cfg(target_has_atomic = "16")] -pub unsafe fn atomic_i16(x: *mut i16) { - atomic_xadd_seqcst(x, 1); -} -#[cfg(target_has_atomic = "32")] -pub unsafe fn atomic_u32(x: *mut u32) { - atomic_xadd_seqcst(x, 1); -} -#[cfg(target_has_atomic = "32")] -pub unsafe fn atomic_i32(x: *mut i32) { - atomic_xadd_seqcst(x, 1); -} -#[cfg(target_has_atomic = "64")] -pub unsafe fn atomic_u64(x: *mut u64) { - atomic_xadd_seqcst(x, 1); -} -#[cfg(target_has_atomic = "64")] -pub unsafe fn atomic_i64(x: *mut i64) { - atomic_xadd_seqcst(x, 1); -} -#[cfg(target_has_atomic = "128")] -pub unsafe fn atomic_u128(x: *mut u128) { - atomic_xadd_seqcst(x, 1); -} -#[cfg(target_has_atomic = "128")] -pub unsafe fn atomic_i128(x: *mut i128) { - atomic_xadd_seqcst(x, 1); -} -#[cfg(target_has_atomic = "ptr")] -pub unsafe fn atomic_usize(x: *mut usize) { - atomic_xadd_seqcst(x, 1); -} -#[cfg(target_has_atomic = "ptr")] -pub unsafe fn atomic_isize(x: *mut isize) { - atomic_xadd_seqcst(x, 1); -} diff --git a/tests/run-make-fulldeps/bare-outfile/Makefile b/tests/run-make-fulldeps/bare-outfile/Makefile deleted file mode 100644 index 858466e94..000000000 --- a/tests/run-make-fulldeps/bare-outfile/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - cp foo.rs $(TMPDIR) - cd $(TMPDIR) && $(RUSTC) -o foo foo.rs - $(call RUN,foo) diff --git a/tests/run-make-fulldeps/bare-outfile/foo.rs b/tests/run-make-fulldeps/bare-outfile/foo.rs deleted file mode 100644 index f79c691f0..000000000 --- a/tests/run-make-fulldeps/bare-outfile/foo.rs +++ /dev/null @@ -1,2 +0,0 @@ -fn main() { -} diff --git a/tests/run-make-fulldeps/c-dynamic-dylib/Makefile b/tests/run-make-fulldeps/c-dynamic-dylib/Makefile deleted file mode 100644 index ac6877892..000000000 --- a/tests/run-make-fulldeps/c-dynamic-dylib/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include ../tools.mk - -# ignore-macos -# -# This hits an assertion in the linker on older versions of osx apparently - -all: $(call DYLIB,cfoo) - $(RUSTC) foo.rs -C prefer-dynamic - $(RUSTC) bar.rs - $(call RUN,bar) - $(call REMOVE_DYLIBS,cfoo) - $(call FAIL,bar) diff --git a/tests/run-make-fulldeps/c-dynamic-dylib/bar.rs b/tests/run-make-fulldeps/c-dynamic-dylib/bar.rs deleted file mode 100644 index b8c798ffd..000000000 --- a/tests/run-make-fulldeps/c-dynamic-dylib/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate foo; - -fn main() { - foo::rsfoo(); -} diff --git a/tests/run-make-fulldeps/c-dynamic-dylib/cfoo.c b/tests/run-make-fulldeps/c-dynamic-dylib/cfoo.c deleted file mode 100644 index fea490cf9..000000000 --- a/tests/run-make-fulldeps/c-dynamic-dylib/cfoo.c +++ /dev/null @@ -1,4 +0,0 @@ -#ifdef _WIN32 -__declspec(dllexport) -#endif -int foo() { return 0; } diff --git a/tests/run-make-fulldeps/c-dynamic-dylib/foo.rs b/tests/run-make-fulldeps/c-dynamic-dylib/foo.rs deleted file mode 100644 index 9f7a9e221..000000000 --- a/tests/run-make-fulldeps/c-dynamic-dylib/foo.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![crate_type = "dylib"] - -#[link(name = "cfoo")] -extern "C" { - fn foo(); -} - -pub fn rsfoo() { - unsafe { foo() } -} diff --git a/tests/run-make-fulldeps/c-dynamic-rlib/Makefile b/tests/run-make-fulldeps/c-dynamic-rlib/Makefile deleted file mode 100644 index c65d648b9..000000000 --- a/tests/run-make-fulldeps/c-dynamic-rlib/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -include ../tools.mk - -# ignore-macos -# -# This hits an assertion in the linker on older versions of osx apparently - -# This overrides the LD_LIBRARY_PATH for RUN -TARGET_RPATH_DIR:=$(TARGET_RPATH_DIR):$(TMPDIR) - -all: $(call DYLIB,cfoo) - $(RUSTC) foo.rs - $(RUSTC) bar.rs - $(call RUN,bar) - $(call REMOVE_DYLIBS,cfoo) - $(call FAIL,bar) diff --git a/tests/run-make-fulldeps/c-dynamic-rlib/bar.rs b/tests/run-make-fulldeps/c-dynamic-rlib/bar.rs deleted file mode 100644 index b8c798ffd..000000000 --- a/tests/run-make-fulldeps/c-dynamic-rlib/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate foo; - -fn main() { - foo::rsfoo(); -} diff --git a/tests/run-make-fulldeps/c-dynamic-rlib/cfoo.c b/tests/run-make-fulldeps/c-dynamic-rlib/cfoo.c deleted file mode 100644 index fea490cf9..000000000 --- a/tests/run-make-fulldeps/c-dynamic-rlib/cfoo.c +++ /dev/null @@ -1,4 +0,0 @@ -#ifdef _WIN32 -__declspec(dllexport) -#endif -int foo() { return 0; } diff --git a/tests/run-make-fulldeps/c-dynamic-rlib/foo.rs b/tests/run-make-fulldeps/c-dynamic-rlib/foo.rs deleted file mode 100644 index 3dd376f1f..000000000 --- a/tests/run-make-fulldeps/c-dynamic-rlib/foo.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![crate_type = "rlib"] - -#[link(name = "cfoo")] -extern "C" { - fn foo(); -} - -pub fn rsfoo() { - unsafe { foo() } -} diff --git a/tests/run-make-fulldeps/c-link-to-rust-dylib/Makefile b/tests/run-make-fulldeps/c-link-to-rust-dylib/Makefile deleted file mode 100644 index 2a371b545..000000000 --- a/tests/run-make-fulldeps/c-link-to-rust-dylib/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -include ../tools.mk - -all: $(TMPDIR)/$(call BIN,bar) - $(call RUN,bar) - $(call REMOVE_DYLIBS,foo) - $(call FAIL,bar) - -ifdef IS_MSVC -$(TMPDIR)/$(call BIN,bar): $(call DYLIB,foo) - $(CC) bar.c $(TMPDIR)/foo.dll.lib $(call OUT_EXE,bar) -else -$(TMPDIR)/$(call BIN,bar): $(call DYLIB,foo) - $(CC) bar.c -lfoo -o $(call RUN_BINFILE,bar) -L $(TMPDIR) -endif - -$(call DYLIB,foo): foo.rs - $(RUSTC) foo.rs diff --git a/tests/run-make-fulldeps/c-link-to-rust-dylib/bar.c b/tests/run-make-fulldeps/c-link-to-rust-dylib/bar.c deleted file mode 100644 index bb4036b06..000000000 --- a/tests/run-make-fulldeps/c-link-to-rust-dylib/bar.c +++ /dev/null @@ -1,6 +0,0 @@ -void foo(); - -int main() { - foo(); - return 0; -} diff --git a/tests/run-make-fulldeps/c-link-to-rust-dylib/foo.rs b/tests/run-make-fulldeps/c-link-to-rust-dylib/foo.rs deleted file mode 100644 index f197fa513..000000000 --- a/tests/run-make-fulldeps/c-link-to-rust-dylib/foo.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "dylib"] - -#[no_mangle] -pub extern "C" fn foo() {} diff --git a/tests/run-make-fulldeps/c-link-to-rust-staticlib/Makefile b/tests/run-make-fulldeps/c-link-to-rust-staticlib/Makefile deleted file mode 100644 index d38bcef30..000000000 --- a/tests/run-make-fulldeps/c-link-to-rust-staticlib/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include ../tools.mk - -# ignore-freebsd -# FIXME - -all: - $(RUSTC) foo.rs - $(CC) bar.c $(call STATICLIB,foo) $(call OUT_EXE,bar) \ - $(EXTRACFLAGS) $(EXTRACXXFLAGS) - $(call RUN,bar) - rm $(call STATICLIB,foo) - $(call RUN,bar) diff --git a/tests/run-make-fulldeps/c-link-to-rust-staticlib/bar.c b/tests/run-make-fulldeps/c-link-to-rust-staticlib/bar.c deleted file mode 100644 index bb4036b06..000000000 --- a/tests/run-make-fulldeps/c-link-to-rust-staticlib/bar.c +++ /dev/null @@ -1,6 +0,0 @@ -void foo(); - -int main() { - foo(); - return 0; -} diff --git a/tests/run-make-fulldeps/c-link-to-rust-staticlib/foo.rs b/tests/run-make-fulldeps/c-link-to-rust-staticlib/foo.rs deleted file mode 100644 index 2e59432cd..000000000 --- a/tests/run-make-fulldeps/c-link-to-rust-staticlib/foo.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "staticlib"] - -#[no_mangle] -pub extern "C" fn foo() {} diff --git a/tests/run-make-fulldeps/c-link-to-rust-va-list-fn/Makefile b/tests/run-make-fulldeps/c-link-to-rust-va-list-fn/Makefile deleted file mode 100644 index 9ce2a34e6..000000000 --- a/tests/run-make-fulldeps/c-link-to-rust-va-list-fn/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) checkrust.rs - $(CC) test.c $(call STATICLIB,checkrust) $(call OUT_EXE,test) $(EXTRACFLAGS) - $(call RUN,test) diff --git a/tests/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs b/tests/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs deleted file mode 100644 index 5830ef033..000000000 --- a/tests/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs +++ /dev/null @@ -1,148 +0,0 @@ -#![crate_type = "staticlib"] -#![feature(c_variadic)] -#![feature(rustc_private)] - -extern crate libc; - -use libc::{c_char, c_double, c_int, c_long, c_longlong}; -use std::ffi::VaList; -use std::ffi::{CString, CStr}; - -macro_rules! continue_if { - ($cond:expr) => { - if !($cond) { - return 0xff; - } - } -} - -unsafe fn compare_c_str(ptr: *const c_char, val: &str) -> bool { - let cstr0 = CStr::from_ptr(ptr); - match CString::new(val) { - Ok(cstr1) => &*cstr1 == cstr0, - Err(_) => false, - } -} - -#[no_mangle] -pub unsafe extern "C" fn check_list_0(mut ap: VaList) -> usize { - continue_if!(ap.arg::() == 1); - continue_if!(ap.arg::() == 2); - continue_if!(ap.arg::() == 3); - 0 -} - -#[no_mangle] -pub unsafe extern "C" fn check_list_1(mut ap: VaList) -> usize { - continue_if!(ap.arg::() == -1); - continue_if!(ap.arg::() == 'A' as c_char); - continue_if!(ap.arg::() == '4' as c_char); - continue_if!(ap.arg::() == ';' as c_char); - continue_if!(ap.arg::() == 0x32); - continue_if!(ap.arg::() == 0x10000001); - continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Valid!")); - 0 -} - -#[no_mangle] -pub unsafe extern "C" fn check_list_2(mut ap: VaList) -> usize { - continue_if!(ap.arg::().floor() == 3.14f64.floor()); - continue_if!(ap.arg::() == 12); - continue_if!(ap.arg::() == 'a' as c_char); - continue_if!(ap.arg::().floor() == 6.18f64.floor()); - continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Hello")); - continue_if!(ap.arg::() == 42); - continue_if!(compare_c_str(ap.arg::<*const c_char>(), "World")); - 0 -} - -#[no_mangle] -pub unsafe extern "C" fn check_list_copy_0(mut ap: VaList) -> usize { - continue_if!(ap.arg::().floor() == 6.28f64.floor()); - continue_if!(ap.arg::() == 16); - continue_if!(ap.arg::() == 'A' as c_char); - continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Skip Me!")); - ap.with_copy(|mut ap| { - if compare_c_str(ap.arg::<*const c_char>(), "Correct") { - 0 - } else { - 0xff - } - }) -} - -#[no_mangle] -pub unsafe extern "C" fn check_varargs_0(_: c_int, mut ap: ...) -> usize { - continue_if!(ap.arg::() == 42); - continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Hello, World!")); - 0 -} - -#[no_mangle] -pub unsafe extern "C" fn check_varargs_1(_: c_int, mut ap: ...) -> usize { - continue_if!(ap.arg::().floor() == 3.14f64.floor()); - continue_if!(ap.arg::() == 12); - continue_if!(ap.arg::() == 'A' as c_char); - continue_if!(ap.arg::() == 1); - 0 -} - -#[no_mangle] -pub unsafe extern "C" fn check_varargs_2(_: c_int, _ap: ...) -> usize { - 0 -} - -#[no_mangle] -pub unsafe extern "C" fn check_varargs_3(_: c_int, mut ap: ...) -> usize { - continue_if!(ap.arg::() == 1); - continue_if!(ap.arg::() == 2); - continue_if!(ap.arg::() == 3); - continue_if!(ap.arg::() == 4); - continue_if!(ap.arg::() == 5); - continue_if!(ap.arg::() == 6); - continue_if!(ap.arg::() == 7); - continue_if!(ap.arg::() == 8); - continue_if!(ap.arg::() == 9); - continue_if!(ap.arg::() == 10); - 0 -} - -#[no_mangle] -pub unsafe extern "C" fn check_varargs_4(_: c_double, mut ap: ...) -> usize { - continue_if!(ap.arg::() == 1.0); - continue_if!(ap.arg::() == 2.0); - continue_if!(ap.arg::() == 3.0); - continue_if!(ap.arg::() == 4.0); - continue_if!(ap.arg::() == 5.0); - continue_if!(ap.arg::() == 6.0); - continue_if!(ap.arg::() == 7.0); - continue_if!(ap.arg::() == 8.0); - continue_if!(ap.arg::() == 9.0); - continue_if!(ap.arg::() == 10.0); - 0 -} - -#[no_mangle] -pub unsafe extern "C" fn check_varargs_5(_: c_int, mut ap: ...) -> usize { - continue_if!(ap.arg::() == 1.0); - continue_if!(ap.arg::() == 1); - continue_if!(ap.arg::() == 2.0); - continue_if!(ap.arg::() == 2); - continue_if!(ap.arg::() == 3.0); - continue_if!(ap.arg::() == 3); - continue_if!(ap.arg::() == 4.0); - continue_if!(ap.arg::() == 4); - continue_if!(ap.arg::() == 5); - continue_if!(ap.arg::() == 5.0); - continue_if!(ap.arg::() == 6); - continue_if!(ap.arg::() == 6.0); - continue_if!(ap.arg::() == 7); - continue_if!(ap.arg::() == 7.0); - continue_if!(ap.arg::() == 8); - continue_if!(ap.arg::() == 8.0); - continue_if!(ap.arg::() == 9); - continue_if!(ap.arg::() == 9.0); - continue_if!(ap.arg::() == 10); - continue_if!(ap.arg::() == 10.0); - 0 -} diff --git a/tests/run-make-fulldeps/c-link-to-rust-va-list-fn/test.c b/tests/run-make-fulldeps/c-link-to-rust-va-list-fn/test.c deleted file mode 100644 index 5bdb51680..000000000 --- a/tests/run-make-fulldeps/c-link-to-rust-va-list-fn/test.c +++ /dev/null @@ -1,50 +0,0 @@ -#include -#include -#include -#include -#include - -extern size_t check_list_0(va_list ap); -extern size_t check_list_1(va_list ap); -extern size_t check_list_2(va_list ap); -extern size_t check_list_copy_0(va_list ap); -extern size_t check_varargs_0(int fixed, ...); -extern size_t check_varargs_1(int fixed, ...); -extern size_t check_varargs_2(int fixed, ...); -extern size_t check_varargs_3(int fixed, ...); -extern size_t check_varargs_4(double fixed, ...); -extern size_t check_varargs_5(int fixed, ...); - -int test_rust(size_t (*fn)(va_list), ...) { - size_t ret = 0; - va_list ap; - va_start(ap, fn); - ret = fn(ap); - va_end(ap); - return ret; -} - -int main(int argc, char* argv[]) { - assert(test_rust(check_list_0, 0x01LL, 0x02, 0x03LL) == 0); - - assert(test_rust(check_list_1, -1, 'A', '4', ';', 0x32, 0x10000001, "Valid!") == 0); - - assert(test_rust(check_list_2, 3.14, 12l, 'a', 6.28, "Hello", 42, "World") == 0); - - assert(test_rust(check_list_copy_0, 6.28, 16, 'A', "Skip Me!", "Correct") == 0); - - assert(check_varargs_0(0, 42, "Hello, World!") == 0); - - assert(check_varargs_1(0, 3.14, 12l, 'A', 0x1LL) == 0); - - assert(check_varargs_2(0, "All", "of", "these", "are", "ignored", ".") == 0); - - assert(check_varargs_3(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) == 0); - - assert(check_varargs_4(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0) == 0); - - assert(check_varargs_5(0, 1.0, 1, 2.0, 2, 3.0, 3, 4.0, 4, 5, 5.0, 6, 6.0, 7, 7.0, 8, 8.0, - 9, 9.0, 10, 10.0) == 0); - - return 0; -} diff --git a/tests/run-make-fulldeps/c-static-dylib/Makefile b/tests/run-make-fulldeps/c-static-dylib/Makefile deleted file mode 100644 index 5b78005e3..000000000 --- a/tests/run-make-fulldeps/c-static-dylib/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,cfoo) - $(RUSTC) foo.rs -C prefer-dynamic - $(RUSTC) bar.rs - rm $(call NATIVE_STATICLIB,cfoo) - $(call RUN,bar) - $(call REMOVE_DYLIBS,foo) - $(call FAIL,bar) diff --git a/tests/run-make-fulldeps/c-static-dylib/bar.rs b/tests/run-make-fulldeps/c-static-dylib/bar.rs deleted file mode 100644 index b8c798ffd..000000000 --- a/tests/run-make-fulldeps/c-static-dylib/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate foo; - -fn main() { - foo::rsfoo(); -} diff --git a/tests/run-make-fulldeps/c-static-dylib/cfoo.c b/tests/run-make-fulldeps/c-static-dylib/cfoo.c deleted file mode 100644 index 9fe07f82f..000000000 --- a/tests/run-make-fulldeps/c-static-dylib/cfoo.c +++ /dev/null @@ -1 +0,0 @@ -int foo() { return 0; } diff --git a/tests/run-make-fulldeps/c-static-dylib/foo.rs b/tests/run-make-fulldeps/c-static-dylib/foo.rs deleted file mode 100644 index 1e8af4d44..000000000 --- a/tests/run-make-fulldeps/c-static-dylib/foo.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![crate_type = "dylib"] - -#[link(name = "cfoo", kind = "static")] -extern "C" { - fn foo(); -} - -pub fn rsfoo() { - unsafe { foo() } -} diff --git a/tests/run-make-fulldeps/c-static-rlib/Makefile b/tests/run-make-fulldeps/c-static-rlib/Makefile deleted file mode 100644 index 11a3cf194..000000000 --- a/tests/run-make-fulldeps/c-static-rlib/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,cfoo) - $(RUSTC) foo.rs - $(RUSTC) bar.rs - $(call REMOVE_RLIBS,foo) - rm $(call NATIVE_STATICLIB,cfoo) - $(call RUN,bar) diff --git a/tests/run-make-fulldeps/c-static-rlib/bar.rs b/tests/run-make-fulldeps/c-static-rlib/bar.rs deleted file mode 100644 index b8c798ffd..000000000 --- a/tests/run-make-fulldeps/c-static-rlib/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate foo; - -fn main() { - foo::rsfoo(); -} diff --git a/tests/run-make-fulldeps/c-static-rlib/cfoo.c b/tests/run-make-fulldeps/c-static-rlib/cfoo.c deleted file mode 100644 index 9fe07f82f..000000000 --- a/tests/run-make-fulldeps/c-static-rlib/cfoo.c +++ /dev/null @@ -1 +0,0 @@ -int foo() { return 0; } diff --git a/tests/run-make-fulldeps/c-static-rlib/foo.rs b/tests/run-make-fulldeps/c-static-rlib/foo.rs deleted file mode 100644 index 9c6d2080e..000000000 --- a/tests/run-make-fulldeps/c-static-rlib/foo.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![crate_type = "rlib"] - -#[link(name = "cfoo", kind = "static")] -extern "C" { - fn foo(); -} - -pub fn rsfoo() { - unsafe { foo() } -} diff --git a/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/Makefile b/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/Makefile deleted file mode 100644 index 134f000d4..000000000 --- a/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -include ../tools.mk - -all: archive - # Compile `main.rs`, which will link into our library, and run it. - $(RUSTC) main.rs - $(call RUN,main) - -ifdef IS_MSVC -archive: add.o panic.o - # Now, create an archive using these two objects. - $(AR) crus $(TMPDIR)/add.lib $(TMPDIR)/add.o $(TMPDIR)/panic.o -else -archive: add.o panic.o - # Now, create an archive using these two objects. - $(AR) crus $(TMPDIR)/libadd.a $(TMPDIR)/add.o $(TMPDIR)/panic.o -endif - -# Compile `panic.rs` into an object file. -# -# Note that we invoke `rustc` directly, so we may emit an object rather -# than an archive. We'll do that later. -panic.o: - $(BARE_RUSTC) $(RUSTFLAGS) \ - --out-dir $(TMPDIR) \ - --emit=obj panic.rs - -# Compile `add.c` into an object file. -add.o: - $(call COMPILE_OBJ,$(TMPDIR)/add.o,add.c) - diff --git a/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/add.c b/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/add.c deleted file mode 100644 index 444359451..000000000 --- a/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/add.c +++ /dev/null @@ -1,12 +0,0 @@ -#ifdef _WIN32 -__declspec(dllexport) -#endif - -// An external function, defined in Rust. -extern void panic_if_greater_than_10(unsigned x); - -unsigned add_small_numbers(unsigned a, unsigned b) { - unsigned c = a + b; - panic_if_greater_than_10(c); - return c; -} diff --git a/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/main.rs b/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/main.rs deleted file mode 100644 index 78a71219c..000000000 --- a/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/main.rs +++ /dev/null @@ -1,35 +0,0 @@ -//! A test for calling `C-unwind` functions across foreign function boundaries. -//! -//! 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}; - -fn main() { - // Call `add_small_numbers`, passing arguments that will NOT trigger a panic. - let (a, b) = (9, 1); - let c = unsafe { add_small_numbers(a, b) }; - assert_eq!(c, 10); - - // Call `add_small_numbers`, passing arguments that will trigger a panic, and catch it. - let caught_unwind = catch_unwind(AssertUnwindSafe(|| { - let (a, b) = (10, 1); - let _c = unsafe { add_small_numbers(a, b) }; - unreachable!("should have unwound instead of returned"); - })); - - // Assert that we did indeed panic, then unwrap and downcast the panic into the sum. - assert!(caught_unwind.is_err()); - let panic_obj = caught_unwind.unwrap_err(); - let msg = panic_obj.downcast_ref::().unwrap(); - assert_eq!(msg, "11"); -} - -#[link(name = "add", kind = "static")] -extern "C-unwind" { - /// An external function, defined in C. - /// - /// Returns the sum of two numbers, or panics if the sum is greater than 10. - fn add_small_numbers(a: u32, b: u32) -> u32; -} diff --git a/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/panic.rs b/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/panic.rs deleted file mode 100644 index a99a04d5c..000000000 --- a/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/panic.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![crate_type = "staticlib"] -#![feature(c_unwind)] - -/// This function will panic if `x` is greater than 10. -/// -/// This function is called by `add_small_numbers`. -#[no_mangle] -pub extern "C-unwind" fn panic_if_greater_than_10(x: u32) { - if x > 10 { - panic!("{}", x); // That is too big! - } -} diff --git a/tests/run-make-fulldeps/c-unwind-abi-catch-panic/Makefile b/tests/run-make-fulldeps/c-unwind-abi-catch-panic/Makefile deleted file mode 100644 index e93ec99da..000000000 --- a/tests/run-make-fulldeps/c-unwind-abi-catch-panic/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,add) - $(RUSTC) main.rs - $(call RUN,main) || exit 1 diff --git a/tests/run-make-fulldeps/c-unwind-abi-catch-panic/add.c b/tests/run-make-fulldeps/c-unwind-abi-catch-panic/add.c deleted file mode 100644 index 444359451..000000000 --- a/tests/run-make-fulldeps/c-unwind-abi-catch-panic/add.c +++ /dev/null @@ -1,12 +0,0 @@ -#ifdef _WIN32 -__declspec(dllexport) -#endif - -// An external function, defined in Rust. -extern void panic_if_greater_than_10(unsigned x); - -unsigned add_small_numbers(unsigned a, unsigned b) { - unsigned c = a + b; - panic_if_greater_than_10(c); - return c; -} diff --git a/tests/run-make-fulldeps/c-unwind-abi-catch-panic/main.rs b/tests/run-make-fulldeps/c-unwind-abi-catch-panic/main.rs deleted file mode 100644 index 15d38d721..000000000 --- a/tests/run-make-fulldeps/c-unwind-abi-catch-panic/main.rs +++ /dev/null @@ -1,44 +0,0 @@ -//! 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}; - -fn main() { - // Call `add_small_numbers`, passing arguments that will NOT trigger a panic. - let (a, b) = (9, 1); - let c = unsafe { add_small_numbers(a, b) }; - assert_eq!(c, 10); - - // Call `add_small_numbers`, passing arguments that will trigger a panic, and catch it. - let caught_unwind = catch_unwind(AssertUnwindSafe(|| { - let (a, b) = (10, 1); - let _c = unsafe { add_small_numbers(a, b) }; - unreachable!("should have unwound instead of returned"); - })); - - // Assert that we did indeed panic, then unwrap and downcast the panic into the sum. - assert!(caught_unwind.is_err()); - let panic_obj = caught_unwind.unwrap_err(); - let msg = panic_obj.downcast_ref::().unwrap(); - assert_eq!(msg, "11"); -} - -#[link(name = "add", kind = "static")] -extern "C-unwind" { - /// An external function, defined in C. - /// - /// Returns the sum of two numbers, or panics if the sum is greater than 10. - fn add_small_numbers(a: u32, b: u32) -> u32; -} - -/// This function will panic if `x` is greater than 10. -/// -/// This function is called by `add_small_numbers`. -#[no_mangle] -pub extern "C-unwind" fn panic_if_greater_than_10(x: u32) { - if x > 10 { - panic!("{}", x); // That is too big! - } -} diff --git a/tests/run-make-fulldeps/cat-and-grep-sanity-check/Makefile b/tests/run-make-fulldeps/cat-and-grep-sanity-check/Makefile deleted file mode 100644 index 82351e220..000000000 --- a/tests/run-make-fulldeps/cat-and-grep-sanity-check/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -include ../tools.mk - -all: - echo a | $(CGREP) a - ! echo b | $(CGREP) a - echo xyz | $(CGREP) x y z - ! echo abc | $(CGREP) b c d - printf "x\ny\nz" | $(CGREP) x y z - - echo AbCd | $(CGREP) -i a b C D - ! echo AbCd | $(CGREP) a b C D - - true | $(CGREP) -v nothing - ! echo nothing | $(CGREP) -v nothing - ! echo xyz | $(CGREP) -v w x y - ! echo xyz | $(CGREP) -v x y z - echo xyz | $(CGREP) -v a b c - - ! echo 'foo bar baz' | $(CGREP) 'foo baz' - echo 'foo bar baz' | $(CGREP) foo baz - echo 'x a `b` c y z' | $(CGREP) 'a `b` c' - - echo baaac | $(CGREP) -e 'ba*c' - echo bc | $(CGREP) -e 'ba*c' - ! echo aaac | $(CGREP) -e 'ba*c' - - echo aaa | $(CGREP) -e 'a+' - ! echo bbb | $(CGREP) -e 'a+' - - echo abc | $(CGREP) -e 'a|e|i|o|u' - ! echo fgh | $(CGREP) -e 'a|e|i|o|u' - echo abc | $(CGREP) -e '[aeiou]' - ! echo fgh | $(CGREP) -e '[aeiou]' - ! echo abc | $(CGREP) -e '[^aeiou]{3}' - echo fgh | $(CGREP) -e '[^aeiou]{3}' - echo ab cd ef gh | $(CGREP) -e '\bcd\b' - ! echo abcdefgh | $(CGREP) -e '\bcd\b' - echo xyz | $(CGREP) -e '...' - ! echo xy | $(CGREP) -e '...' - ! echo xyz | $(CGREP) -e '\.\.\.' - echo ... | $(CGREP) -e '\.\.\.' - - echo foo bar baz | $(CGREP) -e 'foo.*baz' - ! echo foo bar baz | $(CGREP) -ve 'foo.*baz' - ! echo foo bar baz | $(CGREP) -e 'baz.*foo' - echo foo bar baz | $(CGREP) -ve 'baz.*foo' diff --git a/tests/run-make-fulldeps/cdylib-dylib-linkage/Makefile b/tests/run-make-fulldeps/cdylib-dylib-linkage/Makefile deleted file mode 100644 index 5c9b2d1bb..000000000 --- a/tests/run-make-fulldeps/cdylib-dylib-linkage/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -include ../tools.mk - -TARGET_SYSROOT := $(shell $(RUSTC) --print sysroot)/lib/rustlib/$(TARGET)/lib - -ifdef IS_MSVC -LIBSTD := $(wildcard $(TARGET_SYSROOT)/libstd-*.dll.lib) -else -LIBSTD := $(wildcard $(TARGET_SYSROOT)/$(call DYLIB_GLOB,std)) -STD := $(basename $(patsubst lib%,%, $(notdir $(LIBSTD)))) -endif - -all: $(call RUN_BINFILE,foo) - $(call RUN,foo) - -ifdef IS_MSVC -CLIBS := $(TMPDIR)/foo.dll.lib $(TMPDIR)/bar.dll.lib $(LIBSTD) -$(call RUN_BINFILE,foo): $(call DYLIB,foo) - $(CC) $(CFLAGS) foo.c $(CLIBS) $(call OUT_EXE,foo) -else -CLIBS := -lfoo -lbar -l$(STD) -L $(TMPDIR) -L $(TARGET_SYSROOT) -$(call RUN_BINFILE,foo): $(call DYLIB,foo) - $(CC) $(CFLAGS) foo.c $(CLIBS) -o $(call RUN_BINFILE,foo) -endif - -$(call DYLIB,foo): - $(RUSTC) -C prefer-dynamic bar.rs - $(RUSTC) foo.rs diff --git a/tests/run-make-fulldeps/cdylib-dylib-linkage/bar.rs b/tests/run-make-fulldeps/cdylib-dylib-linkage/bar.rs deleted file mode 100644 index b3a7539ab..000000000 --- a/tests/run-make-fulldeps/cdylib-dylib-linkage/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![crate_type = "dylib"] - -pub fn bar() { - println!("hello!"); -} diff --git a/tests/run-make-fulldeps/cdylib-dylib-linkage/foo.c b/tests/run-make-fulldeps/cdylib-dylib-linkage/foo.c deleted file mode 100644 index 154f9682e..000000000 --- a/tests/run-make-fulldeps/cdylib-dylib-linkage/foo.c +++ /dev/null @@ -1,10 +0,0 @@ -#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-fulldeps/cdylib-dylib-linkage/foo.rs b/tests/run-make-fulldeps/cdylib-dylib-linkage/foo.rs deleted file mode 100644 index c4069495a..000000000 --- a/tests/run-make-fulldeps/cdylib-dylib-linkage/foo.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![crate_type = "cdylib"] - -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-fulldeps/cdylib-fewer-symbols/Makefile b/tests/run-make-fulldeps/cdylib-fewer-symbols/Makefile deleted file mode 100644 index 324791af8..000000000 --- a/tests/run-make-fulldeps/cdylib-fewer-symbols/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# Test that allocator-related symbols don't show up as exported from a cdylib as -# they're internal to Rust and not part of the public ABI. - -include ../tools.mk - -# ignore-windows -# FIXME: The __rdl_ and __rust_ symbol still remains, no matter using MSVC or GNU -# See https://github.com/rust-lang/rust/pull/46207#issuecomment-347561753 - -all: - $(RUSTC) foo.rs - nm -g "$(call DYLIB,foo)" | $(CGREP) -v __rdl_ __rde_ __rg_ __rust_ diff --git a/tests/run-make-fulldeps/cdylib-fewer-symbols/foo.rs b/tests/run-make-fulldeps/cdylib-fewer-symbols/foo.rs deleted file mode 100644 index af37bc8e9..000000000 --- a/tests/run-make-fulldeps/cdylib-fewer-symbols/foo.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_type = "cdylib"] - -#[no_mangle] -pub extern "C" fn foo() -> u32 { - 3 -} diff --git a/tests/run-make-fulldeps/cdylib/Makefile b/tests/run-make-fulldeps/cdylib/Makefile deleted file mode 100644 index 47ec762b3..000000000 --- a/tests/run-make-fulldeps/cdylib/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -include ../tools.mk - -all: $(call RUN_BINFILE,foo) - $(call RUN,foo) - rm $(call DYLIB,foo) - $(RUSTC) foo.rs -C lto - $(call RUN,foo) - -ifdef IS_MSVC -$(call RUN_BINFILE,foo): $(call DYLIB,foo) - $(CC) $(CFLAGS) foo.c $(TMPDIR)/foo.dll.lib $(call OUT_EXE,foo) -else -$(call RUN_BINFILE,foo): $(call DYLIB,foo) - $(CC) $(CFLAGS) foo.c -lfoo -o $(call RUN_BINFILE,foo) -L $(TMPDIR) -endif - -$(call DYLIB,foo): - $(RUSTC) bar.rs - $(RUSTC) foo.rs diff --git a/tests/run-make-fulldeps/cdylib/bar.rs b/tests/run-make-fulldeps/cdylib/bar.rs deleted file mode 100644 index fe665abc7..000000000 --- a/tests/run-make-fulldeps/cdylib/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![crate_type = "rlib"] - -pub fn bar() { - println!("hello!"); -} diff --git a/tests/run-make-fulldeps/cdylib/foo.c b/tests/run-make-fulldeps/cdylib/foo.c deleted file mode 100644 index 154f9682e..000000000 --- a/tests/run-make-fulldeps/cdylib/foo.c +++ /dev/null @@ -1,10 +0,0 @@ -#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-fulldeps/cdylib/foo.rs b/tests/run-make-fulldeps/cdylib/foo.rs deleted file mode 100644 index c4069495a..000000000 --- a/tests/run-make-fulldeps/cdylib/foo.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![crate_type = "cdylib"] - -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-fulldeps/codegen-options-parsing/Makefile b/tests/run-make-fulldeps/codegen-options-parsing/Makefile deleted file mode 100644 index b063593c9..000000000 --- a/tests/run-make-fulldeps/codegen-options-parsing/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -include ../tools.mk - -all: - #Option taking a number - $(RUSTC) -C codegen-units dummy.rs 2>&1 | \ - $(CGREP) 'codegen option `codegen-units` requires a number' - $(RUSTC) -C codegen-units= dummy.rs 2>&1 | \ - $(CGREP) 'incorrect value `` for codegen option `codegen-units` - a number was expected' - $(RUSTC) -C codegen-units=foo dummy.rs 2>&1 | \ - $(CGREP) 'incorrect value `foo` for codegen option `codegen-units` - a number was expected' - $(RUSTC) -C codegen-units=1 dummy.rs - #Option taking a string - $(RUSTC) -C extra-filename dummy.rs 2>&1 | \ - $(CGREP) 'codegen option `extra-filename` requires a string' - $(RUSTC) -C extra-filename= dummy.rs 2>&1 - $(RUSTC) -C extra-filename=foo dummy.rs 2>&1 - #Option taking no argument - $(RUSTC) -C lto= dummy.rs 2>&1 | \ - $(CGREP) 'codegen option `lto` - either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, `fat`, or omitted' - $(RUSTC) -C lto=1 dummy.rs 2>&1 | \ - $(CGREP) 'codegen option `lto` - either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, `fat`, or omitted' - $(RUSTC) -C lto=foo dummy.rs 2>&1 | \ - $(CGREP) 'codegen option `lto` - either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, `fat`, or omitted' - $(RUSTC) -C lto dummy.rs - - # Should not link dead code... - $(RUSTC) --print link-args dummy.rs 2>&1 | \ - $(CGREP) -e '--gc-sections|-z[^ ]* [^ ]*|-dead_strip|/OPT:REF' - # ... unless you specifically ask to keep it - $(RUSTC) --print link-args -C link-dead-code dummy.rs 2>&1 | \ - $(CGREP) -ve '--gc-sections|-z[^ ]* [^ ]*|-dead_strip|/OPT:REF' diff --git a/tests/run-make-fulldeps/codegen-options-parsing/dummy.rs b/tests/run-make-fulldeps/codegen-options-parsing/dummy.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/tests/run-make-fulldeps/codegen-options-parsing/dummy.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/compile-stdin/Makefile b/tests/run-make-fulldeps/compile-stdin/Makefile deleted file mode 100644 index be1554869..000000000 --- a/tests/run-make-fulldeps/compile-stdin/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - echo 'fn main(){}' | $(RUSTC) - - $(call RUN,rust_out) diff --git a/tests/run-make-fulldeps/compiler-lookup-paths-2/Makefile b/tests/run-make-fulldeps/compiler-lookup-paths-2/Makefile deleted file mode 100644 index d4ff7d8da..000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths-2/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -all: - mkdir -p $(TMPDIR)/a $(TMPDIR)/b - $(RUSTC) a.rs && mv $(TMPDIR)/liba.rlib $(TMPDIR)/a - $(RUSTC) b.rs -L $(TMPDIR)/a && mv $(TMPDIR)/libb.rlib $(TMPDIR)/b - $(RUSTC) c.rs -L crate=$(TMPDIR)/b -L dependency=$(TMPDIR)/a \ - && exit 1 || exit 0 diff --git a/tests/run-make-fulldeps/compiler-lookup-paths-2/a.rs b/tests/run-make-fulldeps/compiler-lookup-paths-2/a.rs deleted file mode 100644 index 83be6e807..000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths-2/a.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "lib"] diff --git a/tests/run-make-fulldeps/compiler-lookup-paths-2/b.rs b/tests/run-make-fulldeps/compiler-lookup-paths-2/b.rs deleted file mode 100644 index 1be6cbc91..000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths-2/b.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "lib"] -extern crate a; diff --git a/tests/run-make-fulldeps/compiler-lookup-paths-2/c.rs b/tests/run-make-fulldeps/compiler-lookup-paths-2/c.rs deleted file mode 100644 index e37bc2e1d..000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths-2/c.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type = "lib"] -extern crate b; -extern crate a; diff --git a/tests/run-make-fulldeps/compiler-lookup-paths/Makefile b/tests/run-make-fulldeps/compiler-lookup-paths/Makefile deleted file mode 100644 index c16bf7af6..000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -include ../tools.mk - -all: $(TMPDIR)/libnative.a - mkdir -p $(TMPDIR)/crate - mkdir -p $(TMPDIR)/native - mv $(TMPDIR)/libnative.a $(TMPDIR)/native - $(RUSTC) a.rs - mv $(TMPDIR)/liba.rlib $(TMPDIR)/crate - $(RUSTC) b.rs -L native=$(TMPDIR)/crate && exit 1 || exit 0 - $(RUSTC) b.rs -L dependency=$(TMPDIR)/crate && exit 1 || exit 0 - $(RUSTC) b.rs -L crate=$(TMPDIR)/crate - $(RUSTC) b.rs -L all=$(TMPDIR)/crate - $(RUSTC) c.rs -L native=$(TMPDIR)/crate && exit 1 || exit 0 - $(RUSTC) c.rs -L crate=$(TMPDIR)/crate && exit 1 || exit 0 - $(RUSTC) c.rs -L dependency=$(TMPDIR)/crate - $(RUSTC) c.rs -L all=$(TMPDIR)/crate - $(RUSTC) d.rs -L dependency=$(TMPDIR)/native && exit 1 || exit 0 - $(RUSTC) d.rs -L crate=$(TMPDIR)/native && exit 1 || exit 0 - $(RUSTC) d.rs -L native=$(TMPDIR)/native - $(RUSTC) d.rs -L all=$(TMPDIR)/native - # Deduplication tests: - # Same hash, no errors. - mkdir -p $(TMPDIR)/e1 - mkdir -p $(TMPDIR)/e2 - $(RUSTC) e.rs -o $(TMPDIR)/e1/libe.rlib - $(RUSTC) e.rs -o $(TMPDIR)/e2/libe.rlib - $(RUSTC) f.rs -L $(TMPDIR)/e1 -L $(TMPDIR)/e2 - $(RUSTC) f.rs -L crate=$(TMPDIR)/e1 -L $(TMPDIR)/e2 - $(RUSTC) f.rs -L crate=$(TMPDIR)/e1 -L crate=$(TMPDIR)/e2 - # Different hash, errors. - $(RUSTC) e2.rs -o $(TMPDIR)/e2/libe.rlib - $(RUSTC) f.rs -L $(TMPDIR)/e1 -L $(TMPDIR)/e2 && exit 1 || exit 0 - $(RUSTC) f.rs -L crate=$(TMPDIR)/e1 -L $(TMPDIR)/e2 && exit 1 || exit 0 - $(RUSTC) f.rs -L crate=$(TMPDIR)/e1 -L crate=$(TMPDIR)/e2 && exit 1 || exit 0 - # Native/dependency paths don't cause errors. - $(RUSTC) f.rs -L native=$(TMPDIR)/e1 -L $(TMPDIR)/e2 - $(RUSTC) f.rs -L dependency=$(TMPDIR)/e1 -L $(TMPDIR)/e2 - $(RUSTC) f.rs -L dependency=$(TMPDIR)/e1 -L crate=$(TMPDIR)/e2 diff --git a/tests/run-make-fulldeps/compiler-lookup-paths/a.rs b/tests/run-make-fulldeps/compiler-lookup-paths/a.rs deleted file mode 100644 index 83be6e807..000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths/a.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "lib"] diff --git a/tests/run-make-fulldeps/compiler-lookup-paths/b.rs b/tests/run-make-fulldeps/compiler-lookup-paths/b.rs deleted file mode 100644 index 1be6cbc91..000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths/b.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "lib"] -extern crate a; diff --git a/tests/run-make-fulldeps/compiler-lookup-paths/c.rs b/tests/run-make-fulldeps/compiler-lookup-paths/c.rs deleted file mode 100644 index 4c7ce01b6..000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths/c.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "lib"] -extern crate b; diff --git a/tests/run-make-fulldeps/compiler-lookup-paths/d.rs b/tests/run-make-fulldeps/compiler-lookup-paths/d.rs deleted file mode 100644 index 6cd9916b6..000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths/d.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "rlib"] - -#[link(name = "native", kind = "static")] -extern "C" {} diff --git a/tests/run-make-fulldeps/compiler-lookup-paths/e.rs b/tests/run-make-fulldeps/compiler-lookup-paths/e.rs deleted file mode 100644 index 18eb60aca..000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths/e.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_name = "e"] -#![crate_type = "rlib"] diff --git a/tests/run-make-fulldeps/compiler-lookup-paths/e2.rs b/tests/run-make-fulldeps/compiler-lookup-paths/e2.rs deleted file mode 100644 index cbf08b98e..000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths/e2.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_name = "e"] -#![crate_type = "rlib"] - -pub fn f() {} diff --git a/tests/run-make-fulldeps/compiler-lookup-paths/f.rs b/tests/run-make-fulldeps/compiler-lookup-paths/f.rs deleted file mode 100644 index 483deaaea..000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths/f.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "rlib"] -extern crate e; diff --git a/tests/run-make-fulldeps/compiler-lookup-paths/native.c b/tests/run-make-fulldeps/compiler-lookup-paths/native.c deleted file mode 100644 index d11c69f81..000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths/native.c +++ /dev/null @@ -1 +0,0 @@ -// intentionally empty diff --git a/tests/run-make-fulldeps/compiler-rt-works-on-mingw/Makefile b/tests/run-make-fulldeps/compiler-rt-works-on-mingw/Makefile deleted file mode 100644 index 74917570a..000000000 --- a/tests/run-make-fulldeps/compiler-rt-works-on-mingw/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -# only-windows-gnu - -all: - $(CXX) foo.cpp -c -o $(TMPDIR)/foo.o - $(AR) crus $(TMPDIR)/libfoo.a $(TMPDIR)/foo.o - $(RUSTC) foo.rs -lfoo -lstdc++ - $(call RUN,foo) diff --git a/tests/run-make-fulldeps/compiler-rt-works-on-mingw/foo.cpp b/tests/run-make-fulldeps/compiler-rt-works-on-mingw/foo.cpp deleted file mode 100644 index 4c2fb9cdb..000000000 --- a/tests/run-make-fulldeps/compiler-rt-works-on-mingw/foo.cpp +++ /dev/null @@ -1,4 +0,0 @@ -extern "C" void foo() { - int *a = new int(3); - delete a; -} diff --git a/tests/run-make-fulldeps/compiler-rt-works-on-mingw/foo.rs b/tests/run-make-fulldeps/compiler-rt-works-on-mingw/foo.rs deleted file mode 100644 index 7fdb81588..000000000 --- a/tests/run-make-fulldeps/compiler-rt-works-on-mingw/foo.rs +++ /dev/null @@ -1,10 +0,0 @@ -extern "C" { - fn foo(); -} - -pub fn main() { - unsafe { - foo(); - } - assert_eq!(7f32.powi(3), 343f32); -} diff --git a/tests/run-make-fulldeps/core-no-fp-fmt-parse/Makefile b/tests/run-make-fulldeps/core-no-fp-fmt-parse/Makefile deleted file mode 100644 index 837664d92..000000000 --- a/tests/run-make-fulldeps/core-no-fp-fmt-parse/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/core/src/lib.rs --cfg no_fp_fmt_parse diff --git a/tests/run-make-fulldeps/crate-data-smoke/Makefile b/tests/run-make-fulldeps/crate-data-smoke/Makefile deleted file mode 100644 index a453f65ff..000000000 --- a/tests/run-make-fulldeps/crate-data-smoke/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -all: - [ `$(RUSTC) --print crate-name crate.rs` = "foo" ] - [ `$(RUSTC) --print file-names crate.rs` = "$(call BIN,foo)" ] - [ `$(RUSTC) --print file-names --crate-type=lib \ - --test crate.rs` = "$(call BIN,foo)" ] - [ `$(RUSTC) --print file-names --test lib.rs` = "$(call BIN,mylib)" ] - $(RUSTC) --print file-names lib.rs - $(RUSTC) --print file-names rlib.rs diff --git a/tests/run-make-fulldeps/crate-data-smoke/crate.rs b/tests/run-make-fulldeps/crate-data-smoke/crate.rs deleted file mode 100644 index a48a6f51c..000000000 --- a/tests/run-make-fulldeps/crate-data-smoke/crate.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![crate_name = "foo"] - -// Querying about the crate metadata should *not* parse the entire crate, it -// only needs the crate attributes (which are guaranteed to be at the top) be -// sure that if we have an error like a missing module that we can still query -// about the crate id. -mod error; diff --git a/tests/run-make-fulldeps/crate-data-smoke/lib.rs b/tests/run-make-fulldeps/crate-data-smoke/lib.rs deleted file mode 100644 index 8002f11ec..000000000 --- a/tests/run-make-fulldeps/crate-data-smoke/lib.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_name = "mylib"] -#![crate_type = "lib"] diff --git a/tests/run-make-fulldeps/crate-data-smoke/rlib.rs b/tests/run-make-fulldeps/crate-data-smoke/rlib.rs deleted file mode 100644 index 47fcce4a7..000000000 --- a/tests/run-make-fulldeps/crate-data-smoke/rlib.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_name = "mylib"] -#![crate_type = "rlib"] diff --git a/tests/run-make-fulldeps/crate-hash-rustc-version/Makefile b/tests/run-make-fulldeps/crate-hash-rustc-version/Makefile deleted file mode 100644 index 4f25a865e..000000000 --- a/tests/run-make-fulldeps/crate-hash-rustc-version/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -include ../../run-make-fulldeps/tools.mk - -# Ensure that crates compiled with different rustc versions cannot -# be dynamically linked. - -FLAGS := -Cprefer-dynamic -Zsymbol-mangling-version=v0 -UNAME := $(shell uname) -ifeq ($(UNAME),Linux) - EXT=".so" - NM_CMD := nm -D -endif -ifeq ($(UNAME),Darwin) - EXT=".dylib" - NM_CMD := nm -endif - -ifndef NM_CMD -all: - exit 0 -else -all: - # a.rs is a dylib - $(RUSTC) a.rs --crate-type=dylib $(FLAGS) - # Write symbols to disk. - $(NM_CMD) $(call DYLIB,a) > $(TMPDIR)/symbolsbefore - # b.rs is a binary - $(RUSTC) b.rs --extern a=$(TMPDIR)/liba$(EXT) --crate-type=bin -Crpath $(FLAGS) - $(call RUN,b) - # Now re-compile a.rs with another rustc version - RUSTC_FORCE_RUSTC_VERSION=deadfeed $(RUSTC) a.rs --crate-type=dylib $(FLAGS) - # After compiling with a different rustc version, write symbols to disk again. - $(NM_CMD) $(call DYLIB,a) > $(TMPDIR)/symbolsafter - # As a sanity check, test if the symbols changed: - # If the symbols are identical, there's been an error. - if diff $(TMPDIR)/symbolsbefore $(TMPDIR)/symbolsafter; then exit 1; fi - $(call FAIL,b) -endif diff --git a/tests/run-make-fulldeps/crate-hash-rustc-version/a.rs b/tests/run-make-fulldeps/crate-hash-rustc-version/a.rs deleted file mode 100644 index d65b5ce8e..000000000 --- a/tests/run-make-fulldeps/crate-hash-rustc-version/a.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub fn foo(mut x: String) -> String { - x.push_str(", world!"); - x -} diff --git a/tests/run-make-fulldeps/crate-hash-rustc-version/b.rs b/tests/run-make-fulldeps/crate-hash-rustc-version/b.rs deleted file mode 100644 index 316ac26e7..000000000 --- a/tests/run-make-fulldeps/crate-hash-rustc-version/b.rs +++ /dev/null @@ -1,8 +0,0 @@ -extern crate a; - -use a::foo; - -fn main() { - let x = String::from("Hello"); - println!("{}", foo(x)); -} diff --git a/tests/run-make-fulldeps/crate-name-priority/Makefile b/tests/run-make-fulldeps/crate-name-priority/Makefile deleted file mode 100644 index 08a07c325..000000000 --- a/tests/run-make-fulldeps/crate-name-priority/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs - rm $(TMPDIR)/$(call BIN,foo) - $(RUSTC) foo.rs --crate-name bar - rm $(TMPDIR)/$(call BIN,bar) - $(RUSTC) foo1.rs - rm $(TMPDIR)/$(call BIN,foo) - $(RUSTC) foo1.rs -o $(TMPDIR)/$(call BIN,bar1) - rm $(TMPDIR)/$(call BIN,bar1) diff --git a/tests/run-make-fulldeps/crate-name-priority/foo.rs b/tests/run-make-fulldeps/crate-name-priority/foo.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/tests/run-make-fulldeps/crate-name-priority/foo.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/crate-name-priority/foo1.rs b/tests/run-make-fulldeps/crate-name-priority/foo1.rs deleted file mode 100644 index 4ff3bd951..000000000 --- a/tests/run-make-fulldeps/crate-name-priority/foo1.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_name = "foo"] - -fn main() {} diff --git a/tests/run-make-fulldeps/cross-lang-lto-clang/Makefile b/tests/run-make-fulldeps/cross-lang-lto-clang/Makefile deleted file mode 100644 index acaebf439..000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-clang/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -# needs-matching-clang - -# This test makes sure that cross-language inlining actually works by checking -# the generated machine code. - -include ../tools.mk - -all: cpp-executable rust-executable - -cpp-executable: - $(RUSTC) -Clinker-plugin-lto=on -o $(TMPDIR)/librustlib-xlto.a -Copt-level=2 -Ccodegen-units=1 ./rustlib.rs - $(CLANG) -flto=thin -fuse-ld=lld -L $(TMPDIR) -lrustlib-xlto -o $(TMPDIR)/cmain ./cmain.c -O3 - # Make sure we don't find a call instruction to the function we expect to - # always be inlined. - "$(LLVM_BIN_DIR)"/llvm-objdump -d $(TMPDIR)/cmain | $(CGREP) -v -e "call.*rust_always_inlined" - # As a sanity check, make sure we do find a call instruction to a - # non-inlined function - "$(LLVM_BIN_DIR)"/llvm-objdump -d $(TMPDIR)/cmain | $(CGREP) -e "call.*rust_never_inlined" - -rust-executable: - $(CLANG) ./clib.c -flto=thin -c -o $(TMPDIR)/clib.o -O2 - (cd $(TMPDIR); $(AR) crus ./libxyz.a ./clib.o) - $(RUSTC) -Clinker-plugin-lto=on -L$(TMPDIR) -Copt-level=2 -Clinker=$(CLANG) -Clink-arg=-fuse-ld=lld ./main.rs -o $(TMPDIR)/rsmain - "$(LLVM_BIN_DIR)"/llvm-objdump -d $(TMPDIR)/rsmain | $(CGREP) -e "call.*c_never_inlined" - "$(LLVM_BIN_DIR)"/llvm-objdump -d $(TMPDIR)/rsmain | $(CGREP) -v -e "call.*c_always_inlined" diff --git a/tests/run-make-fulldeps/cross-lang-lto-clang/clib.c b/tests/run-make-fulldeps/cross-lang-lto-clang/clib.c deleted file mode 100644 index 90f33f24d..000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-clang/clib.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -uint32_t c_always_inlined() { - return 1234; -} - -__attribute__((noinline)) uint32_t c_never_inlined() { - return 12345; -} diff --git a/tests/run-make-fulldeps/cross-lang-lto-clang/cmain.c b/tests/run-make-fulldeps/cross-lang-lto-clang/cmain.c deleted file mode 100644 index e62a40117..000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-clang/cmain.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -// A trivial function defined in Rust, returning a constant value. This should -// always be inlined. -uint32_t rust_always_inlined(); - - -uint32_t rust_never_inlined(); - -int main(int argc, char** argv) { - return rust_never_inlined() + rust_always_inlined(); -} diff --git a/tests/run-make-fulldeps/cross-lang-lto-clang/main.rs b/tests/run-make-fulldeps/cross-lang-lto-clang/main.rs deleted file mode 100644 index 8129dcb85..000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-clang/main.rs +++ /dev/null @@ -1,11 +0,0 @@ -#[link(name = "xyz")] -extern "C" { - fn c_always_inlined() -> u32; - fn c_never_inlined() -> u32; -} - -fn main() { - unsafe { - println!("blub: {}", c_always_inlined() + c_never_inlined()); - } -} diff --git a/tests/run-make-fulldeps/cross-lang-lto-clang/rustlib.rs b/tests/run-make-fulldeps/cross-lang-lto-clang/rustlib.rs deleted file mode 100644 index 8a74d74a4..000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-clang/rustlib.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![crate_type="staticlib"] - -#[no_mangle] -pub extern "C" fn rust_always_inlined() -> u32 { - 42 -} - -#[no_mangle] -#[inline(never)] -pub extern "C" fn rust_never_inlined() -> u32 { - 421 -} diff --git a/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/Makefile b/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/Makefile deleted file mode 100644 index 70085d9bd..000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/Makefile +++ /dev/null @@ -1,87 +0,0 @@ -# needs-matching-clang - -# This test makes sure that cross-language inlining can be used in conjunction -# with profile-guided optimization. The test only tests that the whole workflow -# can be executed without anything crashing. It does not test whether PGO or -# xLTO have any specific effect on the generated code. - -include ../tools.mk - -COMMON_FLAGS=-Copt-level=3 -Ccodegen-units=1 - -# LLVM doesn't support instrumenting binaries that use SEH: -# https://bugs.llvm.org/show_bug.cgi?id=41279 -# -# Things work fine with -Cpanic=abort though. -ifdef IS_MSVC -COMMON_FLAGS+= -Cpanic=abort -endif - -all: cpp-executable rust-executable - -cpp-executable: - $(RUSTC) -Clinker-plugin-lto=on \ - -Cprofile-generate="$(TMPDIR)"/cpp-profdata \ - -o "$(TMPDIR)"/librustlib-xlto.a \ - $(COMMON_FLAGS) \ - ./rustlib.rs - $(CLANG) -flto=thin \ - -fprofile-generate="$(TMPDIR)"/cpp-profdata \ - -fuse-ld=lld \ - -L "$(TMPDIR)" \ - -lrustlib-xlto \ - -o "$(TMPDIR)"/cmain \ - -O3 \ - ./cmain.c - $(TMPDIR)/cmain - # Postprocess the profiling data so it can be used by the compiler - "$(LLVM_BIN_DIR)"/llvm-profdata merge \ - -o "$(TMPDIR)"/cpp-profdata/merged.profdata \ - "$(TMPDIR)"/cpp-profdata/default_*.profraw - $(RUSTC) -Clinker-plugin-lto=on \ - -Cprofile-use="$(TMPDIR)"/cpp-profdata/merged.profdata \ - -o "$(TMPDIR)"/librustlib-xlto.a \ - $(COMMON_FLAGS) \ - ./rustlib.rs - $(CLANG) -flto=thin \ - -fprofile-use="$(TMPDIR)"/cpp-profdata/merged.profdata \ - -fuse-ld=lld \ - -L "$(TMPDIR)" \ - -lrustlib-xlto \ - -o "$(TMPDIR)"/cmain \ - -O3 \ - ./cmain.c - -rust-executable: - exit - $(CLANG) ./clib.c -fprofile-generate="$(TMPDIR)"/rs-profdata -flto=thin -c -o $(TMPDIR)/clib.o -O3 - (cd $(TMPDIR); $(AR) crus ./libxyz.a ./clib.o) - $(RUSTC) -Clinker-plugin-lto=on \ - -Cprofile-generate="$(TMPDIR)"/rs-profdata \ - -L$(TMPDIR) \ - $(COMMON_FLAGS) \ - -Clinker=$(CLANG) \ - -Clink-arg=-fuse-ld=lld \ - -o $(TMPDIR)/rsmain \ - ./main.rs - $(TMPDIR)/rsmain - # Postprocess the profiling data so it can be used by the compiler - "$(LLVM_BIN_DIR)"/llvm-profdata merge \ - -o "$(TMPDIR)"/rs-profdata/merged.profdata \ - "$(TMPDIR)"/rs-profdata/default_*.profraw - $(CLANG) ./clib.c \ - -fprofile-use="$(TMPDIR)"/rs-profdata/merged.profdata \ - -flto=thin \ - -c \ - -o $(TMPDIR)/clib.o \ - -O3 - rm "$(TMPDIR)"/libxyz.a - (cd $(TMPDIR); $(AR) crus ./libxyz.a ./clib.o) - $(RUSTC) -Clinker-plugin-lto=on \ - -Cprofile-use="$(TMPDIR)"/rs-profdata/merged.profdata \ - -L$(TMPDIR) \ - $(COMMON_FLAGS) \ - -Clinker=$(CLANG) \ - -Clink-arg=-fuse-ld=lld \ - -o $(TMPDIR)/rsmain \ - ./main.rs diff --git a/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/clib.c b/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/clib.c deleted file mode 100644 index 90f33f24d..000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/clib.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -uint32_t c_always_inlined() { - return 1234; -} - -__attribute__((noinline)) uint32_t c_never_inlined() { - return 12345; -} diff --git a/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/cmain.c b/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/cmain.c deleted file mode 100644 index e3f24828b..000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/cmain.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -// A trivial function defined in Rust, returning a constant value. This should -// always be inlined. -uint32_t rust_always_inlined(); - - -uint32_t rust_never_inlined(); - -int main(int argc, char** argv) { - return (rust_never_inlined() + rust_always_inlined()) * 0; -} diff --git a/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/main.rs b/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/main.rs deleted file mode 100644 index 8129dcb85..000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/main.rs +++ /dev/null @@ -1,11 +0,0 @@ -#[link(name = "xyz")] -extern "C" { - fn c_always_inlined() -> u32; - fn c_never_inlined() -> u32; -} - -fn main() { - unsafe { - println!("blub: {}", c_always_inlined() + c_never_inlined()); - } -} diff --git a/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/rustlib.rs b/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/rustlib.rs deleted file mode 100644 index 8a74d74a4..000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/rustlib.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![crate_type="staticlib"] - -#[no_mangle] -pub extern "C" fn rust_always_inlined() -> u32 { - 42 -} - -#[no_mangle] -#[inline(never)] -pub extern "C" fn rust_never_inlined() -> u32 { - 421 -} diff --git a/tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/Makefile b/tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/Makefile deleted file mode 100644 index 6f1caa31a..000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -include ../tools.mk - -# ignore windows due to libLLVM being present in PATH and the PATH and library path being the same -# (so fixing it is harder). See #57765 for context -ifndef IS_WINDOWS - -# This test makes sure that we don't loose upstream object files when compiling -# staticlibs with -C linker-plugin-lto - -all: staticlib.rs upstream.rs - $(RUSTC) upstream.rs -C linker-plugin-lto -Ccodegen-units=1 - - # Check No LTO - $(RUSTC) staticlib.rs -C linker-plugin-lto -Ccodegen-units=1 -L. -o $(TMPDIR)/staticlib.a - (cd $(TMPDIR); "$(LLVM_BIN_DIR)"/llvm-ar x ./staticlib.a) - # Make sure the upstream object file was included - ls $(TMPDIR)/upstream.*.rcgu.o - - # Cleanup - rm $(TMPDIR)/* - - # Check ThinLTO - $(RUSTC) upstream.rs -C linker-plugin-lto -Ccodegen-units=1 -Clto=thin - $(RUSTC) staticlib.rs -C linker-plugin-lto -Ccodegen-units=1 -Clto=thin -L. -o $(TMPDIR)/staticlib.a - (cd $(TMPDIR); "$(LLVM_BIN_DIR)"/llvm-ar x ./staticlib.a) - ls $(TMPDIR)/upstream.*.rcgu.o - -else - -all: - -endif diff --git a/tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/staticlib.rs b/tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/staticlib.rs deleted file mode 100644 index 34951dda3..000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/staticlib.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![crate_type="staticlib"] - -extern crate upstream; - -#[no_mangle] -pub extern "C" fn bar() { - upstream::foo(); -} diff --git a/tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/upstream.rs b/tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/upstream.rs deleted file mode 100644 index bd6820098..000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/upstream.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type = "rlib"] - -pub fn foo() {} diff --git a/tests/run-make-fulldeps/cross-lang-lto/Makefile b/tests/run-make-fulldeps/cross-lang-lto/Makefile deleted file mode 100644 index 92058f952..000000000 --- a/tests/run-make-fulldeps/cross-lang-lto/Makefile +++ /dev/null @@ -1,57 +0,0 @@ - -include ../tools.mk - -# ignore windows due to libLLVM being present in PATH and the PATH and library path being the same -# (so fixing it is harder). See #57765 for context -ifndef IS_WINDOWS - -# This test makes sure that the object files we generate are actually -# LLVM bitcode files (as used by linker LTO plugins) when compiling with -# -Clinker-plugin-lto. - -# this only succeeds for bitcode files -ASSERT_IS_BITCODE_OBJ=("$(LLVM_BIN_DIR)"/llvm-bcanalyzer $(1)) -EXTRACT_OBJS=(cd $(TMPDIR); rm -f ./*.o; "$(LLVM_BIN_DIR)"/llvm-ar x $(1)) - -BUILD_LIB=$(RUSTC) lib.rs -Copt-level=2 -Clinker-plugin-lto -Ccodegen-units=1 -BUILD_EXE=$(RUSTC) main.rs -Copt-level=2 -Clinker-plugin-lto -Ccodegen-units=1 --emit=obj - -all: staticlib staticlib-fat-lto staticlib-thin-lto rlib exe cdylib rdylib - -staticlib: lib.rs - $(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib.a - $(call EXTRACT_OBJS, liblib.a) - for file in $(TMPDIR)/liblib.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done - -staticlib-fat-lto: lib.rs - $(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib-fat-lto.a -Clto=fat - $(call EXTRACT_OBJS, liblib-fat-lto.a) - for file in $(TMPDIR)/liblib-fat-lto.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done - -staticlib-thin-lto: lib.rs - $(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib-thin-lto.a -Clto=thin - $(call EXTRACT_OBJS, liblib-thin-lto.a) - for file in $(TMPDIR)/liblib-thin-lto.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done - -rlib: lib.rs - $(BUILD_LIB) --crate-type=rlib -o $(TMPDIR)/liblib.rlib - $(call EXTRACT_OBJS, liblib.rlib) - for file in $(TMPDIR)/liblib.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done - -cdylib: lib.rs - $(BUILD_LIB) --crate-type=cdylib --emit=obj -o $(TMPDIR)/cdylib.o - $(call ASSERT_IS_BITCODE_OBJ, $(TMPDIR)/cdylib.o) - -rdylib: lib.rs - $(BUILD_LIB) --crate-type=dylib --emit=obj -o $(TMPDIR)/rdylib.o - $(call ASSERT_IS_BITCODE_OBJ, $(TMPDIR)/rdylib.o) - -exe: lib.rs - $(BUILD_EXE) -o $(TMPDIR)/exe.o - $(call ASSERT_IS_BITCODE_OBJ, $(TMPDIR)/exe.o) - -else - -all: - -endif diff --git a/tests/run-make-fulldeps/cross-lang-lto/lib.rs b/tests/run-make-fulldeps/cross-lang-lto/lib.rs deleted file mode 100644 index 94cfef6ad..000000000 --- a/tests/run-make-fulldeps/cross-lang-lto/lib.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[no_mangle] -pub extern "C" fn foo() { - println!("abc"); -} diff --git a/tests/run-make-fulldeps/cross-lang-lto/main.rs b/tests/run-make-fulldeps/cross-lang-lto/main.rs deleted file mode 100644 index f6320bcb0..000000000 --- a/tests/run-make-fulldeps/cross-lang-lto/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello World"); -} diff --git a/tests/run-make-fulldeps/debug-assertions/Makefile b/tests/run-make-fulldeps/debug-assertions/Makefile deleted file mode 100644 index 73beb4b03..000000000 --- a/tests/run-make-fulldeps/debug-assertions/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) debug.rs -C debug-assertions=no - $(call RUN,debug) good - $(RUSTC) debug.rs -C opt-level=0 - $(call RUN,debug) bad - $(RUSTC) debug.rs -C opt-level=1 - $(call RUN,debug) good - $(RUSTC) debug.rs -C opt-level=2 - $(call RUN,debug) good - $(RUSTC) debug.rs -C opt-level=3 - $(call RUN,debug) good - $(RUSTC) debug.rs -C opt-level=s - $(call RUN,debug) good - $(RUSTC) debug.rs -C opt-level=z - $(call RUN,debug) good - $(RUSTC) debug.rs -O - $(call RUN,debug) good - $(RUSTC) debug.rs - $(call RUN,debug) bad - $(RUSTC) debug.rs -C debug-assertions=yes -O - $(call RUN,debug) bad - $(RUSTC) debug.rs -C debug-assertions=yes -C opt-level=1 - $(call RUN,debug) bad diff --git a/tests/run-make-fulldeps/debug-assertions/debug.rs b/tests/run-make-fulldeps/debug-assertions/debug.rs deleted file mode 100644 index 76ca60a71..000000000 --- a/tests/run-make-fulldeps/debug-assertions/debug.rs +++ /dev/null @@ -1,33 +0,0 @@ -#![feature(rustc_attrs)] -#![deny(warnings)] - -use std::env; -use std::thread; - -fn main() { - let should_fail = env::args().nth(1) == Some("bad".to_string()); - - assert_eq!(thread::spawn(debug_assert_eq).join().is_err(), should_fail); - assert_eq!(thread::spawn(debug_assert).join().is_err(), should_fail); - assert_eq!(thread::spawn(overflow).join().is_err(), should_fail); -} - -fn debug_assert_eq() { - let mut hit1 = false; - let mut hit2 = false; - debug_assert_eq!({ hit1 = true; 1 }, { hit2 = true; 2 }); - assert!(!hit1); - assert!(!hit2); -} - -fn debug_assert() { - let mut hit = false; - debug_assert!({ hit = true; false }); - assert!(!hit); -} - -fn overflow() { - fn add(a: u8, b: u8) -> u8 { a + b } - - add(200u8, 200u8); -} diff --git a/tests/run-make-fulldeps/dep-info-doesnt-run-much/Makefile b/tests/run-make-fulldeps/dep-info-doesnt-run-much/Makefile deleted file mode 100644 index b4dc44ad2..000000000 --- a/tests/run-make-fulldeps/dep-info-doesnt-run-much/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs --emit dep-info diff --git a/tests/run-make-fulldeps/dep-info-doesnt-run-much/foo.rs b/tests/run-make-fulldeps/dep-info-doesnt-run-much/foo.rs deleted file mode 100644 index 316e68129..000000000 --- a/tests/run-make-fulldeps/dep-info-doesnt-run-much/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -// We're only emitting dep info, so we shouldn't be running static analysis to -// figure out that this program is erroneous. -fn main() { - let a: u8 = "a"; -} diff --git a/tests/run-make-fulldeps/dep-info-spaces/Makefile b/tests/run-make-fulldeps/dep-info-spaces/Makefile deleted file mode 100644 index 0cfe513e4..000000000 --- a/tests/run-make-fulldeps/dep-info-spaces/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -include ../tools.mk - -# ignore-windows -# ignore-freebsd -# FIXME: (windows: see `../dep-info/Makefile`) - -all: - cp lib.rs $(TMPDIR)/ - cp 'foo foo.rs' $(TMPDIR)/ - cp bar.rs $(TMPDIR)/ - $(RUSTC) --emit link,dep-info --crate-type=lib $(TMPDIR)/lib.rs - sleep 1 - touch $(TMPDIR)/'foo foo.rs' - -rm -f $(TMPDIR)/done - $(MAKE) -drf Makefile.foo - rm $(TMPDIR)/done - pwd - $(MAKE) -drf Makefile.foo - rm $(TMPDIR)/done && exit 1 || exit 0 diff --git a/tests/run-make-fulldeps/dep-info-spaces/Makefile.foo b/tests/run-make-fulldeps/dep-info-spaces/Makefile.foo deleted file mode 100644 index 80a5d4333..000000000 --- a/tests/run-make-fulldeps/dep-info-spaces/Makefile.foo +++ /dev/null @@ -1,7 +0,0 @@ -LIB := $(shell $(RUSTC) --print file-names --crate-type=lib $(TMPDIR)/lib.rs) - -$(TMPDIR)/$(LIB): - $(RUSTC) --emit link,dep-info --crate-type=lib $(TMPDIR)/lib.rs - touch $(TMPDIR)/done - --include $(TMPDIR)/lib.d diff --git a/tests/run-make-fulldeps/dep-info-spaces/bar.rs b/tests/run-make-fulldeps/dep-info-spaces/bar.rs deleted file mode 100644 index c5c0bc606..000000000 --- a/tests/run-make-fulldeps/dep-info-spaces/bar.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn bar() {} diff --git a/tests/run-make-fulldeps/dep-info-spaces/foo foo.rs b/tests/run-make-fulldeps/dep-info-spaces/foo foo.rs deleted file mode 100644 index b76b4321d..000000000 --- a/tests/run-make-fulldeps/dep-info-spaces/foo foo.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn foo() {} diff --git a/tests/run-make-fulldeps/dep-info-spaces/lib.rs b/tests/run-make-fulldeps/dep-info-spaces/lib.rs deleted file mode 100644 index 6264e7b67..000000000 --- a/tests/run-make-fulldeps/dep-info-spaces/lib.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[path="foo foo.rs"] -pub mod foo; - -pub mod bar; diff --git a/tests/run-make-fulldeps/dep-info/Makefile b/tests/run-make-fulldeps/dep-info/Makefile deleted file mode 100644 index c76f43a8e..000000000 --- a/tests/run-make-fulldeps/dep-info/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -include ../tools.mk - -# ignore-windows -# ignore-freebsd -# FIXME: on windows `rustc --dep-info` produces Makefile dependency with -# windows native paths (e.g. `c:\path\to\libfoo.a`) -# but msys make seems to fail to recognize such paths, so test fails. - -all: - cp *.rs $(TMPDIR) - $(RUSTC) --emit dep-info,link --crate-type=lib $(TMPDIR)/lib.rs - sleep 2 - touch $(TMPDIR)/foo.rs - -rm -f $(TMPDIR)/done - $(MAKE) -drf Makefile.foo - sleep 2 - rm $(TMPDIR)/done - pwd - $(MAKE) -drf Makefile.foo - rm $(TMPDIR)/done && exit 1 || exit 0 - - # When a source file is deleted `make` should still work - rm $(TMPDIR)/bar.rs - cp $(TMPDIR)/lib2.rs $(TMPDIR)/lib.rs - $(MAKE) -drf Makefile.foo diff --git a/tests/run-make-fulldeps/dep-info/Makefile.foo b/tests/run-make-fulldeps/dep-info/Makefile.foo deleted file mode 100644 index e5df31f88..000000000 --- a/tests/run-make-fulldeps/dep-info/Makefile.foo +++ /dev/null @@ -1,7 +0,0 @@ -LIB := $(shell $(RUSTC) --print file-names --crate-type=lib lib.rs) - -$(TMPDIR)/$(LIB): - $(RUSTC) --emit dep-info,link --crate-type=lib lib.rs - touch $(TMPDIR)/done - --include $(TMPDIR)/foo.d diff --git a/tests/run-make-fulldeps/dep-info/bar.rs b/tests/run-make-fulldeps/dep-info/bar.rs deleted file mode 100644 index c5c0bc606..000000000 --- a/tests/run-make-fulldeps/dep-info/bar.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn bar() {} diff --git a/tests/run-make-fulldeps/dep-info/foo.rs b/tests/run-make-fulldeps/dep-info/foo.rs deleted file mode 100644 index b76b4321d..000000000 --- a/tests/run-make-fulldeps/dep-info/foo.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn foo() {} diff --git a/tests/run-make-fulldeps/dep-info/lib.rs b/tests/run-make-fulldeps/dep-info/lib.rs deleted file mode 100644 index eb8631259..000000000 --- a/tests/run-make-fulldeps/dep-info/lib.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_name = "foo"] - -pub mod foo; -pub mod bar; diff --git a/tests/run-make-fulldeps/dep-info/lib2.rs b/tests/run-make-fulldeps/dep-info/lib2.rs deleted file mode 100644 index f4fda9c93..000000000 --- a/tests/run-make-fulldeps/dep-info/lib2.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_name = "foo"] - -pub mod foo; diff --git a/tests/run-make-fulldeps/doctests-keep-binaries/Makefile b/tests/run-make-fulldeps/doctests-keep-binaries/Makefile deleted file mode 100644 index 273c8980b..000000000 --- a/tests/run-make-fulldeps/doctests-keep-binaries/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -include ../../run-make-fulldeps/tools.mk - -# Check that valid binaries are persisted by running them, regardless of whether the --run or --no-run option is used. - -all: run no_run - -run: - mkdir -p $(TMPDIR)/doctests - $(RUSTC) --crate-type rlib t.rs - $(RUSTDOC) -Zunstable-options --test --persist-doctests $(TMPDIR)/doctests --extern t=$(TMPDIR)/libt.rlib t.rs - $(TMPDIR)/doctests/t_rs_2_0/rust_out - $(TMPDIR)/doctests/t_rs_8_0/rust_out - rm -rf $(TMPDIR)/doctests - -no_run: - mkdir -p $(TMPDIR)/doctests - $(RUSTC) --crate-type rlib t.rs - $(RUSTDOC) -Zunstable-options --test --persist-doctests $(TMPDIR)/doctests --extern t=$(TMPDIR)/libt.rlib t.rs --no-run - $(TMPDIR)/doctests/t_rs_2_0/rust_out - $(TMPDIR)/doctests/t_rs_8_0/rust_out - rm -rf $(TMPDIR)/doctests diff --git a/tests/run-make-fulldeps/doctests-keep-binaries/t.rs b/tests/run-make-fulldeps/doctests-keep-binaries/t.rs deleted file mode 100644 index c38cf0a0b..000000000 --- a/tests/run-make-fulldeps/doctests-keep-binaries/t.rs +++ /dev/null @@ -1,11 +0,0 @@ -/// Fungle the foople. -/// ``` -/// t::foople(); -/// ``` -pub fn foople() {} - -/// Flomble the florp -/// ``` -/// t::florp(); -/// ``` -pub fn florp() {} diff --git a/tests/run-make-fulldeps/duplicate-output-flavors/Makefile b/tests/run-make-fulldeps/duplicate-output-flavors/Makefile deleted file mode 100644 index e33279966..000000000 --- a/tests/run-make-fulldeps/duplicate-output-flavors/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --crate-type=rlib foo.rs - $(RUSTC) --crate-type=rlib,rlib foo.rs diff --git a/tests/run-make-fulldeps/duplicate-output-flavors/foo.rs b/tests/run-make-fulldeps/duplicate-output-flavors/foo.rs deleted file mode 100644 index c1bfaa6ca..000000000 --- a/tests/run-make-fulldeps/duplicate-output-flavors/foo.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "rlib"] diff --git a/tests/run-make-fulldeps/dylib-chain/Makefile b/tests/run-make-fulldeps/dylib-chain/Makefile deleted file mode 100644 index 1139822f4..000000000 --- a/tests/run-make-fulldeps/dylib-chain/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) m1.rs -C prefer-dynamic - $(RUSTC) m2.rs -C prefer-dynamic - $(RUSTC) m3.rs -C prefer-dynamic - $(RUSTC) m4.rs - $(call RUN,m4) - $(call REMOVE_DYLIBS,m1) - $(call REMOVE_DYLIBS,m2) - $(call REMOVE_DYLIBS,m3) - $(call FAIL,m4) diff --git a/tests/run-make-fulldeps/dylib-chain/m1.rs b/tests/run-make-fulldeps/dylib-chain/m1.rs deleted file mode 100644 index 08c3f3752..000000000 --- a/tests/run-make-fulldeps/dylib-chain/m1.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "dylib"] -pub fn m1() {} diff --git a/tests/run-make-fulldeps/dylib-chain/m2.rs b/tests/run-make-fulldeps/dylib-chain/m2.rs deleted file mode 100644 index 62176ddc9..000000000 --- a/tests/run-make-fulldeps/dylib-chain/m2.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "dylib"] -extern crate m1; - -pub fn m2() { m1::m1() } diff --git a/tests/run-make-fulldeps/dylib-chain/m3.rs b/tests/run-make-fulldeps/dylib-chain/m3.rs deleted file mode 100644 index d213aeda9..000000000 --- a/tests/run-make-fulldeps/dylib-chain/m3.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "dylib"] -extern crate m2; - -pub fn m3() { m2::m2() } diff --git a/tests/run-make-fulldeps/dylib-chain/m4.rs b/tests/run-make-fulldeps/dylib-chain/m4.rs deleted file mode 100644 index fa8ec6079..000000000 --- a/tests/run-make-fulldeps/dylib-chain/m4.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate m3; - -fn main() { m3::m3() } diff --git a/tests/run-make-fulldeps/emit-stack-sizes/Makefile b/tests/run-make-fulldeps/emit-stack-sizes/Makefile deleted file mode 100644 index f636ebd28..000000000 --- a/tests/run-make-fulldeps/emit-stack-sizes/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include ../tools.mk - -# ignore-windows -# ignore-macos -# -# This feature only works when the output object format is ELF so we ignore -# macOS and Windows - -# check that the .stack_sizes section is generated -all: - $(RUSTC) -C opt-level=3 -Z emit-stack-sizes --emit=obj foo.rs - size -A $(TMPDIR)/foo.o | $(CGREP) .stack_sizes diff --git a/tests/run-make-fulldeps/emit-stack-sizes/foo.rs b/tests/run-make-fulldeps/emit-stack-sizes/foo.rs deleted file mode 100644 index ee51ae328..000000000 --- a/tests/run-make-fulldeps/emit-stack-sizes/foo.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type = "lib"] - -pub fn foo() {} diff --git a/tests/run-make-fulldeps/emit/Makefile b/tests/run-make-fulldeps/emit/Makefile deleted file mode 100644 index 78e68bd61..000000000 --- a/tests/run-make-fulldeps/emit/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) -Copt-level=0 --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs - $(RUSTC) -Copt-level=1 --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs - $(RUSTC) -Copt-level=2 --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs - $(RUSTC) -Copt-level=3 --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs - $(RUSTC) -Copt-level=s --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs - $(RUSTC) -Copt-level=z --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs - $(RUSTC) -Copt-level=0 --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs - $(call RUN,test-26235) || exit 1 - $(RUSTC) -Copt-level=1 --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs - $(call RUN,test-26235) || exit 1 - $(RUSTC) -Copt-level=2 --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs - $(call RUN,test-26235) || exit 1 - $(RUSTC) -Copt-level=3 --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs - $(call RUN,test-26235) || exit 1 - $(RUSTC) -Copt-level=s --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs - $(call RUN,test-26235) || exit 1 - $(RUSTC) -Copt-level=z --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs - $(call RUN,test-26235) || exit 1 diff --git a/tests/run-make-fulldeps/emit/test-24876.rs b/tests/run-make-fulldeps/emit/test-24876.rs deleted file mode 100644 index 734e2ee4b..000000000 --- a/tests/run-make-fulldeps/emit/test-24876.rs +++ /dev/null @@ -1,9 +0,0 @@ -// Checks for issue #24876 - -fn main() { - let mut v = 0; - for i in 0..0 { - v += i; - } - println!("{}", v) -} diff --git a/tests/run-make-fulldeps/emit/test-26235.rs b/tests/run-make-fulldeps/emit/test-26235.rs deleted file mode 100644 index 07d975f33..000000000 --- a/tests/run-make-fulldeps/emit/test-26235.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Checks for issue #26235 - -fn main() { - use std::thread; - - type Key = u32; - const NUM_THREADS: usize = 2; - - #[derive(Clone,Copy)] - struct Stats { - upsert: S, - delete: S, - insert: S, - update: S - }; - - impl Stats where S: Copy { - fn dot(self, s: Stats, f: F) -> Stats where F: Fn(S, T) -> B { - let Stats { upsert: u1, delete: d1, insert: i1, update: p1 } = self; - let Stats { upsert: u2, delete: d2, insert: i2, update: p2 } = s; - Stats { upsert: f(u1, u2), delete: f(d1, d2), insert: f(i1, i2), update: f(p1, p2) } - } - - fn new(init: S) -> Self { - Stats { upsert: init, delete: init, insert: init, update: init } - } - } - - fn make_threads() -> Vec> { - let mut t = Vec::with_capacity(NUM_THREADS); - for _ in 0..NUM_THREADS { - t.push(thread::spawn(move || {})); - } - t - } - - let stats = [Stats::new(0); NUM_THREADS]; - make_threads(); - - { - let Stats { ref upsert, ref delete, ref insert, ref update } = stats.iter().fold( - Stats::new(0), |res, &s| res.dot(s, |x: Key, y: Key| x.wrapping_add(y))); - println!("upserts: {}, deletes: {}, inserts: {}, updates: {}", - upsert, delete, insert, update); - } -} diff --git a/tests/run-make-fulldeps/error-found-staticlib-instead-crate/Makefile b/tests/run-make-fulldeps/error-found-staticlib-instead-crate/Makefile deleted file mode 100644 index 0eae41d72..000000000 --- a/tests/run-make-fulldeps/error-found-staticlib-instead-crate/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs --crate-type staticlib - $(RUSTC) bar.rs 2>&1 | $(CGREP) "found staticlib" diff --git a/tests/run-make-fulldeps/error-found-staticlib-instead-crate/bar.rs b/tests/run-make-fulldeps/error-found-staticlib-instead-crate/bar.rs deleted file mode 100644 index fe35f1f8e..000000000 --- a/tests/run-make-fulldeps/error-found-staticlib-instead-crate/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate foo; - -fn main() { - foo::foo(); -} diff --git a/tests/run-make-fulldeps/error-found-staticlib-instead-crate/foo.rs b/tests/run-make-fulldeps/error-found-staticlib-instead-crate/foo.rs deleted file mode 100644 index b76b4321d..000000000 --- a/tests/run-make-fulldeps/error-found-staticlib-instead-crate/foo.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn foo() {} diff --git a/tests/run-make-fulldeps/error-writing-dependencies/Makefile b/tests/run-make-fulldeps/error-writing-dependencies/Makefile deleted file mode 100644 index a5d30a647..000000000 --- a/tests/run-make-fulldeps/error-writing-dependencies/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -all: - # Let's get a nice error message - $(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | \ - $(CGREP) "error writing dependencies" - # Make sure the filename shows up - $(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | $(CGREP) "baz" diff --git a/tests/run-make-fulldeps/error-writing-dependencies/foo.rs b/tests/run-make-fulldeps/error-writing-dependencies/foo.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/tests/run-make-fulldeps/error-writing-dependencies/foo.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/exit-code/Makefile b/tests/run-make-fulldeps/exit-code/Makefile deleted file mode 100644 index 3ffaafe90..000000000 --- a/tests/run-make-fulldeps/exit-code/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) success.rs; [ $$? -eq 0 ] - $(RUSTC) --invalid-arg-foo; [ $$? -eq 1 ] - $(RUSTC) compile-error.rs; [ $$? -eq 1 ] - $(RUSTC) -Ztreat-err-as-bug compile-error.rs; [ $$? -eq 101 ] - $(RUSTDOC) -o $(TMPDIR)/exit-code success.rs; [ $$? -eq 0 ] - $(RUSTDOC) --invalid-arg-foo; [ $$? -eq 1 ] - $(RUSTDOC) compile-error.rs; [ $$? -eq 1 ] - $(RUSTDOC) lint-failure.rs; [ $$? -eq 1 ] diff --git a/tests/run-make-fulldeps/exit-code/compile-error.rs b/tests/run-make-fulldeps/exit-code/compile-error.rs deleted file mode 100644 index a96c19760..000000000 --- a/tests/run-make-fulldeps/exit-code/compile-error.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - compile_error!("kaboom"); -} diff --git a/tests/run-make-fulldeps/exit-code/lint-failure.rs b/tests/run-make-fulldeps/exit-code/lint-failure.rs deleted file mode 100644 index df876ec23..000000000 --- a/tests/run-make-fulldeps/exit-code/lint-failure.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![deny(broken_intra_doc_links)] - -/// [intradoc::failure] -pub fn main() { - println!("Hello, world!"); -} diff --git a/tests/run-make-fulldeps/exit-code/success.rs b/tests/run-make-fulldeps/exit-code/success.rs deleted file mode 100644 index 55b8e42b6..000000000 --- a/tests/run-make-fulldeps/exit-code/success.rs +++ /dev/null @@ -1,4 +0,0 @@ -/// Main function -fn main() { - println!("Hello, world!"); -} diff --git a/tests/run-make-fulldeps/extern-diff-internal-name/Makefile b/tests/run-make-fulldeps/extern-diff-internal-name/Makefile deleted file mode 100644 index 54596c2f0..000000000 --- a/tests/run-make-fulldeps/extern-diff-internal-name/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) lib.rs - $(RUSTC) test.rs --extern foo=$(TMPDIR)/libbar.rlib diff --git a/tests/run-make-fulldeps/extern-diff-internal-name/lib.rs b/tests/run-make-fulldeps/extern-diff-internal-name/lib.rs deleted file mode 100644 index ad96f7086..000000000 --- a/tests/run-make-fulldeps/extern-diff-internal-name/lib.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_name = "bar"] -#![crate_type = "rlib"] diff --git a/tests/run-make-fulldeps/extern-diff-internal-name/test.rs b/tests/run-make-fulldeps/extern-diff-internal-name/test.rs deleted file mode 100644 index 4c53dc28a..000000000 --- a/tests/run-make-fulldeps/extern-diff-internal-name/test.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[macro_use] -extern crate foo; - -fn main() { -} diff --git a/tests/run-make-fulldeps/extern-flag-disambiguates/Makefile b/tests/run-make-fulldeps/extern-flag-disambiguates/Makefile deleted file mode 100644 index a8f142a64..000000000 --- a/tests/run-make-fulldeps/extern-flag-disambiguates/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -include ../tools.mk - -# Attempt to build this dependency tree: -# -# A.1 A.2 -# |\ | -# | \ | -# B \ C -# \ | / -# \|/ -# D -# -# Note that A.1 and A.2 are crates with the same name. - -all: - $(RUSTC) -C metadata=1 -C extra-filename=-1 a.rs - $(RUSTC) -C metadata=2 -C extra-filename=-2 a.rs - $(RUSTC) b.rs --extern a=$(TMPDIR)/liba-1.rlib - $(RUSTC) c.rs --extern a=$(TMPDIR)/liba-2.rlib - @echo before - $(RUSTC) --cfg before d.rs --extern a=$(TMPDIR)/liba-1.rlib - $(call RUN,d) - @echo after - $(RUSTC) --cfg after d.rs --extern a=$(TMPDIR)/liba-1.rlib - $(call RUN,d) diff --git a/tests/run-make-fulldeps/extern-flag-disambiguates/a.rs b/tests/run-make-fulldeps/extern-flag-disambiguates/a.rs deleted file mode 100644 index 2b1a31901..000000000 --- a/tests/run-make-fulldeps/extern-flag-disambiguates/a.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_name = "a"] -#![crate_type = "rlib"] - -static FOO: usize = 3; - -pub fn token() -> &'static usize { &FOO } diff --git a/tests/run-make-fulldeps/extern-flag-disambiguates/b.rs b/tests/run-make-fulldeps/extern-flag-disambiguates/b.rs deleted file mode 100644 index 1d7a7339c..000000000 --- a/tests/run-make-fulldeps/extern-flag-disambiguates/b.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![crate_name = "b"] -#![crate_type = "rlib"] - -extern crate a; - -static FOO: usize = 3; - -pub fn token() -> &'static usize { &FOO } -pub fn a_token() -> &'static usize { a::token() } diff --git a/tests/run-make-fulldeps/extern-flag-disambiguates/c.rs b/tests/run-make-fulldeps/extern-flag-disambiguates/c.rs deleted file mode 100644 index 3f9d143ed..000000000 --- a/tests/run-make-fulldeps/extern-flag-disambiguates/c.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![crate_name = "c"] -#![crate_type = "rlib"] - -extern crate a; - -static FOO: usize = 3; - -pub fn token() -> &'static usize { &FOO } -pub fn a_token() -> &'static usize { a::token() } diff --git a/tests/run-make-fulldeps/extern-flag-disambiguates/d.rs b/tests/run-make-fulldeps/extern-flag-disambiguates/d.rs deleted file mode 100644 index 249c6a107..000000000 --- a/tests/run-make-fulldeps/extern-flag-disambiguates/d.rs +++ /dev/null @@ -1,11 +0,0 @@ -#[cfg(before)] extern crate a; -extern crate b; -extern crate c; -#[cfg(after)] extern crate a; - -fn t(a: &'static usize) -> usize { a as *const _ as usize } - -fn main() { - assert_eq!(t(a::token()), t(b::a_token())); - assert!(t(a::token()) != t(c::a_token())); -} diff --git a/tests/run-make-fulldeps/extern-flag-fun/Makefile b/tests/run-make-fulldeps/extern-flag-fun/Makefile deleted file mode 100644 index a0b7c15ed..000000000 --- a/tests/run-make-fulldeps/extern-flag-fun/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) bar.rs --crate-type=rlib - $(RUSTC) bar.rs --crate-type=rlib -C extra-filename=-a - $(RUSTC) bar-alt.rs --crate-type=rlib - $(RUSTC) foo.rs --extern bar=no-exist && exit 1 || exit 0 - $(RUSTC) foo.rs --extern bar=foo.rs && exit 1 || exit 0 - $(RUSTC) foo.rs \ - --extern bar=$(TMPDIR)/libbar.rlib \ - --extern bar=$(TMPDIR)/libbar-alt.rlib \ - && exit 1 || exit 0 - $(RUSTC) foo.rs \ - --extern bar=$(TMPDIR)/libbar.rlib \ - --extern bar=$(TMPDIR)/libbar-a.rlib - $(RUSTC) foo.rs --extern bar=$(TMPDIR)/libbar.rlib - # Try to be sneaky and load a private crate from with a non-private name. - $(RUSTC) rustc.rs -Zforce-unstable-if-unmarked --crate-type=rlib - $(RUSTC) gated_unstable.rs --extern alloc=$(TMPDIR)/librustc.rlib 2>&1 | $(CGREP) 'rustc_private' diff --git a/tests/run-make-fulldeps/extern-flag-fun/bar-alt.rs b/tests/run-make-fulldeps/extern-flag-fun/bar-alt.rs deleted file mode 100644 index cdc6c27d8..000000000 --- a/tests/run-make-fulldeps/extern-flag-fun/bar-alt.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn f() {} diff --git a/tests/run-make-fulldeps/extern-flag-fun/bar.rs b/tests/run-make-fulldeps/extern-flag-fun/bar.rs deleted file mode 100644 index d11c69f81..000000000 --- a/tests/run-make-fulldeps/extern-flag-fun/bar.rs +++ /dev/null @@ -1 +0,0 @@ -// intentionally empty diff --git a/tests/run-make-fulldeps/extern-flag-fun/foo.rs b/tests/run-make-fulldeps/extern-flag-fun/foo.rs deleted file mode 100644 index 0edda7d7b..000000000 --- a/tests/run-make-fulldeps/extern-flag-fun/foo.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate bar; - -fn main() {} diff --git a/tests/run-make-fulldeps/extern-flag-fun/gated_unstable.rs b/tests/run-make-fulldeps/extern-flag-fun/gated_unstable.rs deleted file mode 100644 index 03600c830..000000000 --- a/tests/run-make-fulldeps/extern-flag-fun/gated_unstable.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate alloc; - -fn main() {} diff --git a/tests/run-make-fulldeps/extern-flag-fun/rustc.rs b/tests/run-make-fulldeps/extern-flag-fun/rustc.rs deleted file mode 100644 index b76b4321d..000000000 --- a/tests/run-make-fulldeps/extern-flag-fun/rustc.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn foo() {} diff --git a/tests/run-make-fulldeps/extern-flag-pathless/Makefile b/tests/run-make-fulldeps/extern-flag-pathless/Makefile deleted file mode 100644 index 0f23815b6..000000000 --- a/tests/run-make-fulldeps/extern-flag-pathless/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -include ../tools.mk - -# Test mixing pathless --extern with paths. - -all: - $(RUSTC) bar-static.rs --crate-name=bar --crate-type=rlib - $(RUSTC) bar-dynamic.rs --crate-name=bar --crate-type=dylib -C prefer-dynamic - # rlib preferred over dylib - $(RUSTC) foo.rs --extern bar - $(call RUN,foo) | $(CGREP) 'static' - $(RUSTC) foo.rs --extern bar=$(TMPDIR)/libbar.rlib --extern bar - $(call RUN,foo) | $(CGREP) 'static' - # explicit --extern overrides pathless - $(RUSTC) foo.rs --extern bar=$(call DYLIB,bar) --extern bar - $(call RUN,foo) | $(CGREP) 'dynamic' - # prefer-dynamic does what it says - $(RUSTC) foo.rs --extern bar -C prefer-dynamic - $(call RUN,foo) | $(CGREP) 'dynamic' diff --git a/tests/run-make-fulldeps/extern-flag-pathless/bar-dynamic.rs b/tests/run-make-fulldeps/extern-flag-pathless/bar-dynamic.rs deleted file mode 100644 index e2d68d517..000000000 --- a/tests/run-make-fulldeps/extern-flag-pathless/bar-dynamic.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub fn f() { - println!("dynamic"); -} diff --git a/tests/run-make-fulldeps/extern-flag-pathless/bar-static.rs b/tests/run-make-fulldeps/extern-flag-pathless/bar-static.rs deleted file mode 100644 index 240d8bde4..000000000 --- a/tests/run-make-fulldeps/extern-flag-pathless/bar-static.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub fn f() { - println!("static"); -} diff --git a/tests/run-make-fulldeps/extern-flag-pathless/foo.rs b/tests/run-make-fulldeps/extern-flag-pathless/foo.rs deleted file mode 100644 index 1ea64da7d..000000000 --- a/tests/run-make-fulldeps/extern-flag-pathless/foo.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - bar::f(); -} diff --git a/tests/run-make-fulldeps/extern-flag-rename-transitive/Makefile b/tests/run-make-fulldeps/extern-flag-rename-transitive/Makefile deleted file mode 100644 index d16a8e208..000000000 --- a/tests/run-make-fulldeps/extern-flag-rename-transitive/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs - $(RUSTC) bar.rs - $(RUSTC) baz.rs --extern a=$(TMPDIR)/libfoo.rlib - diff --git a/tests/run-make-fulldeps/extern-flag-rename-transitive/bar.rs b/tests/run-make-fulldeps/extern-flag-rename-transitive/bar.rs deleted file mode 100644 index 94446a07d..000000000 --- a/tests/run-make-fulldeps/extern-flag-rename-transitive/bar.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type = "rlib"] - -extern crate foo; diff --git a/tests/run-make-fulldeps/extern-flag-rename-transitive/baz.rs b/tests/run-make-fulldeps/extern-flag-rename-transitive/baz.rs deleted file mode 100644 index c3908db34..000000000 --- a/tests/run-make-fulldeps/extern-flag-rename-transitive/baz.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "rlib"] - -extern crate a; -extern crate bar; diff --git a/tests/run-make-fulldeps/extern-flag-rename-transitive/foo.rs b/tests/run-make-fulldeps/extern-flag-rename-transitive/foo.rs deleted file mode 100644 index c1bfaa6ca..000000000 --- a/tests/run-make-fulldeps/extern-flag-rename-transitive/foo.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "rlib"] diff --git a/tests/run-make-fulldeps/extern-fn-generic/Makefile b/tests/run-make-fulldeps/extern-fn-generic/Makefile deleted file mode 100644 index 71746fb10..000000000 --- a/tests/run-make-fulldeps/extern-fn-generic/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,test) - $(RUSTC) testcrate.rs - $(RUSTC) test.rs - $(call RUN,test) || exit 1 diff --git a/tests/run-make-fulldeps/extern-fn-generic/test.c b/tests/run-make-fulldeps/extern-fn-generic/test.c deleted file mode 100644 index a8504ff2a..000000000 --- a/tests/run-make-fulldeps/extern-fn-generic/test.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -typedef struct TestStruct { - uint8_t x; - int32_t y; -} TestStruct; - -typedef int callback(TestStruct s); - -uint32_t call(callback *c) { - TestStruct s; - s.x = 'a'; - s.y = 3; - - return c(s); -} diff --git a/tests/run-make-fulldeps/extern-fn-generic/test.rs b/tests/run-make-fulldeps/extern-fn-generic/test.rs deleted file mode 100644 index c9baa4898..000000000 --- a/tests/run-make-fulldeps/extern-fn-generic/test.rs +++ /dev/null @@ -1,20 +0,0 @@ -extern crate testcrate; - -extern "C" fn bar(ts: testcrate::TestStruct) -> T { - ts.y -} - -#[link(name = "test", kind = "static")] -extern "C" { - fn call(c: extern "C" fn(testcrate::TestStruct) -> i32) -> i32; -} - -fn main() { - // Let's test calling it cross crate - let back = unsafe { testcrate::call(testcrate::foo::) }; - assert_eq!(3, back); - - // And just within this crate - let back = unsafe { call(bar::) }; - assert_eq!(3, back); -} diff --git a/tests/run-make-fulldeps/extern-fn-generic/testcrate.rs b/tests/run-make-fulldeps/extern-fn-generic/testcrate.rs deleted file mode 100644 index 39f76e59c..000000000 --- a/tests/run-make-fulldeps/extern-fn-generic/testcrate.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![crate_type = "lib"] - -#[repr(C)] -pub struct TestStruct { - pub x: u8, - pub y: T, -} - -pub extern "C" fn foo(ts: TestStruct) -> T { - ts.y -} - -#[link(name = "test", kind = "static")] -extern "C" { - pub fn call(c: extern "C" fn(TestStruct) -> i32) -> i32; -} diff --git a/tests/run-make-fulldeps/extern-fn-mangle/Makefile b/tests/run-make-fulldeps/extern-fn-mangle/Makefile deleted file mode 100644 index 4f5d026f2..000000000 --- a/tests/run-make-fulldeps/extern-fn-mangle/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,test) - $(RUSTC) test.rs - $(call RUN,test) || exit 1 diff --git a/tests/run-make-fulldeps/extern-fn-mangle/test.c b/tests/run-make-fulldeps/extern-fn-mangle/test.c deleted file mode 100644 index e94d75083..000000000 --- a/tests/run-make-fulldeps/extern-fn-mangle/test.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -uint32_t foo(); -uint32_t bar(); - -uint32_t add() { - return foo() + bar(); -} diff --git a/tests/run-make-fulldeps/extern-fn-mangle/test.rs b/tests/run-make-fulldeps/extern-fn-mangle/test.rs deleted file mode 100644 index 40b08f1ed..000000000 --- a/tests/run-make-fulldeps/extern-fn-mangle/test.rs +++ /dev/null @@ -1,19 +0,0 @@ -#[no_mangle] -pub extern "C" fn foo() -> i32 { - 3 -} - -#[no_mangle] -pub extern "C" fn bar() -> i32 { - 5 -} - -#[link(name = "test", kind = "static")] -extern "C" { - fn add() -> i32; -} - -fn main() { - let back = unsafe { add() }; - assert_eq!(8, back); -} diff --git a/tests/run-make-fulldeps/extern-fn-reachable/Makefile b/tests/run-make-fulldeps/extern-fn-reachable/Makefile deleted file mode 100644 index 05bdb8d65..000000000 --- a/tests/run-make-fulldeps/extern-fn-reachable/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -include ../tools.mk - -# ignore-windows-msvc - -NM=nm -D - -ifeq ($(UNAME),Darwin) -NM=nm -gU -endif - -ifdef IS_WINDOWS -NM=nm -g -endif - -# This overrides the LD_LIBRARY_PATH for RUN -TARGET_RPATH_DIR:=$(TARGET_RPATH_DIR):$(TMPDIR) - -all: - $(RUSTC) dylib.rs -o $(TMPDIR)/libdylib.so -C prefer-dynamic - - [ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun1)" -eq "1" ] - [ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun2)" -eq "1" ] - [ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun3)" -eq "1" ] - [ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun4)" -eq "1" ] - [ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun5)" -eq "1" ] diff --git a/tests/run-make-fulldeps/extern-fn-reachable/dylib.rs b/tests/run-make-fulldeps/extern-fn-reachable/dylib.rs deleted file mode 100644 index cd0179348..000000000 --- a/tests/run-make-fulldeps/extern-fn-reachable/dylib.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![crate_type = "dylib"] -#![allow(dead_code)] - -#[no_mangle] pub extern "C" fn fun1() {} -#[no_mangle] extern "C" fn fun2() {} - -mod foo { - #[no_mangle] pub extern "C" fn fun3() {} -} -pub mod bar { - #[no_mangle] pub extern "C" fn fun4() {} -} - -#[no_mangle] pub fn fun5() {} diff --git a/tests/run-make-fulldeps/extern-fn-struct-passing-abi/Makefile b/tests/run-make-fulldeps/extern-fn-struct-passing-abi/Makefile deleted file mode 100644 index 4f5d026f2..000000000 --- a/tests/run-make-fulldeps/extern-fn-struct-passing-abi/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,test) - $(RUSTC) test.rs - $(call RUN,test) || exit 1 diff --git a/tests/run-make-fulldeps/extern-fn-struct-passing-abi/test.c b/tests/run-make-fulldeps/extern-fn-struct-passing-abi/test.c deleted file mode 100644 index 136b07129..000000000 --- a/tests/run-make-fulldeps/extern-fn-struct-passing-abi/test.c +++ /dev/null @@ -1,314 +0,0 @@ -#include -#include - -struct Rect { - int32_t a; - int32_t b; - int32_t c; - int32_t d; -}; - -struct BiggerRect { - struct Rect s; - int32_t a; - int32_t b; -}; - -struct FloatRect { - int32_t a; - int32_t b; - double c; -}; - -struct Huge { - int32_t a; - int32_t b; - int32_t c; - int32_t d; - int32_t e; -}; - -struct FloatPoint { - double x; - double y; -}; - -struct FloatOne { - double x; -}; - -struct IntOdd { - int8_t a; - int8_t b; - int8_t c; -}; - -// System V x86_64 ABI: -// a, b, c, d, e should be in registers -// s should be byval pointer -// -// Win64 ABI: -// a, b, c, d should be in registers -// e should be on the stack -// s should be byval pointer -void byval_rect(int32_t a, int32_t b, int32_t c, int32_t d, int32_t e, struct Rect s) { - assert(a == 1); - assert(b == 2); - assert(c == 3); - assert(d == 4); - assert(e == 5); - assert(s.a == 553); - assert(s.b == 554); - assert(s.c == 555); - assert(s.d == 556); -} - -// System V x86_64 ABI: -// a, b, c, d, e, f should be in registers -// s should be byval pointer on the stack -// -// Win64 ABI: -// a, b, c, d should be in registers -// e, f should be on the stack -// s should be byval pointer on the stack -void byval_many_rect(int32_t a, int32_t b, int32_t c, int32_t d, int32_t e, - int32_t f, struct Rect s) { - assert(a == 1); - assert(b == 2); - assert(c == 3); - assert(d == 4); - assert(e == 5); - assert(f == 6); - assert(s.a == 553); - assert(s.b == 554); - assert(s.c == 555); - assert(s.d == 556); -} - -// System V x86_64 ABI: -// a, b, c, d, e, f, g should be in sse registers -// s should be split across 2 registers -// t should be byval pointer -// -// Win64 ABI: -// a, b, c, d should be in sse registers -// e, f, g should be on the stack -// s should be on the stack (treated as 2 i64's) -// t should be on the stack (treated as an i64 and a double) -void byval_rect_floats(float a, float b, double c, float d, float e, - float f, double g, struct Rect s, struct FloatRect t) { - assert(a == 1.); - assert(b == 2.); - assert(c == 3.); - assert(d == 4.); - assert(e == 5.); - assert(f == 6.); - assert(g == 7.); - assert(s.a == 553); - assert(s.b == 554); - assert(s.c == 555); - assert(s.d == 556); - assert(t.a == 3489); - assert(t.b == 3490); - assert(t.c == 8.); -} - -// System V x86_64 ABI: -// a, b, d, e, f should be in registers -// c passed via sse registers -// s should be byval pointer -// -// Win64 ABI: -// a, b, d should be in registers -// c passed via sse registers -// e, f should be on the stack -// s should be byval pointer -void byval_rect_with_float(int32_t a, int32_t b, float c, int32_t d, - int32_t e, int32_t f, struct Rect s) { - assert(a == 1); - assert(b == 2); - assert(c == 3.); - assert(d == 4); - assert(e == 5); - assert(f == 6); - assert(s.a == 553); - assert(s.b == 554); - assert(s.c == 555); - assert(s.d == 556); -} - -// System V x86_64 ABI: -// a, b, d, e, f should be byval pointer (on the stack) -// g passed via register (fixes #41375) -// -// Win64 ABI: -// a, b, d, e, f, g should be byval pointer -void byval_rect_with_many_huge(struct Huge a, struct Huge b, struct Huge c, - struct Huge d, struct Huge e, struct Huge f, - struct Rect g) { - assert(g.a == 123); - assert(g.b == 456); - assert(g.c == 789); - assert(g.d == 420); -} - -// System V x86_64 & Win64 ABI: -// a, b should be in registers -// s should be split across 2 integer registers -void split_rect(int32_t a, int32_t b, struct Rect s) { - assert(a == 1); - assert(b == 2); - assert(s.a == 553); - assert(s.b == 554); - assert(s.c == 555); - assert(s.d == 556); -} - -// System V x86_64 & Win64 ABI: -// a, b should be in sse registers -// s should be split across integer & sse registers -void split_rect_floats(float a, float b, struct FloatRect s) { - assert(a == 1.); - assert(b == 2.); - assert(s.a == 3489); - assert(s.b == 3490); - assert(s.c == 8.); -} - -// System V x86_64 ABI: -// a, b, d, f should be in registers -// c, e passed via sse registers -// s should be split across 2 registers -// -// Win64 ABI: -// a, b, d should be in registers -// c passed via sse registers -// e, f should be on the stack -// s should be on the stack (treated as 2 i64's) -void split_rect_with_floats(int32_t a, int32_t b, float c, - int32_t d, float e, int32_t f, struct Rect s) { - assert(a == 1); - assert(b == 2); - assert(c == 3.); - assert(d == 4); - assert(e == 5.); - assert(f == 6); - assert(s.a == 553); - assert(s.b == 554); - assert(s.c == 555); - assert(s.d == 556); -} - -// System V x86_64 & Win64 ABI: -// a, b, c should be in registers -// s should be split across 2 registers -// t should be a byval pointer -void split_and_byval_rect(int32_t a, int32_t b, int32_t c, struct Rect s, struct Rect t) { - assert(a == 1); - assert(b == 2); - assert(c == 3); - assert(s.a == 553); - assert(s.b == 554); - assert(s.c == 555); - assert(s.d == 556); - assert(t.a == 553); - assert(t.b == 554); - assert(t.c == 555); - assert(t.d == 556); -} - -// System V x86_64 & Win64 ABI: -// a, b should in registers -// s and return should be split across 2 registers -struct Rect split_ret_byval_struct(int32_t a, int32_t b, struct Rect s) { - assert(a == 1); - assert(b == 2); - assert(s.a == 553); - assert(s.b == 554); - assert(s.c == 555); - assert(s.d == 556); - return s; -} - -// System V x86_64 & Win64 ABI: -// a, b, c, d should be in registers -// return should be in a hidden sret pointer -// s should be a byval pointer -struct BiggerRect sret_byval_struct(int32_t a, int32_t b, int32_t c, int32_t d, struct Rect s) { - assert(a == 1); - assert(b == 2); - assert(c == 3); - assert(d == 4); - assert(s.a == 553); - assert(s.b == 554); - assert(s.c == 555); - assert(s.d == 556); - - struct BiggerRect t; - t.s = s; t.a = 27834; t.b = 7657; - return t; -} - -// System V x86_64 & Win64 ABI: -// a, b should be in registers -// return should be in a hidden sret pointer -// s should be split across 2 registers -struct BiggerRect sret_split_struct(int32_t a, int32_t b, struct Rect s) { - assert(a == 1); - assert(b == 2); - assert(s.a == 553); - assert(s.b == 554); - assert(s.c == 555); - assert(s.d == 556); - - struct BiggerRect t; - t.s = s; t.a = 27834; t.b = 7657; - return t; -} - -// System V x86_64 & Win64 ABI: -// s should be byval pointer (since sizeof(s) > 16) -// return should in a hidden sret pointer -struct Huge huge_struct(struct Huge s) { - assert(s.a == 5647); - assert(s.b == 5648); - assert(s.c == 5649); - assert(s.d == 5650); - assert(s.e == 5651); - - return s; -} - -// System V x86_64 ABI: -// p should be in registers -// return should be in registers -// -// Win64 ABI and 64-bit PowerPC ELFv1 ABI: -// p should be a byval pointer -// return should be in a hidden sret pointer -struct FloatPoint float_point(struct FloatPoint p) { - assert(p.x == 5.); - assert(p.y == -3.); - - return p; -} - -// 64-bit PowerPC ELFv1 ABI: -// f1 should be in a register -// return should be in a hidden sret pointer -struct FloatOne float_one(struct FloatOne f1) { - assert(f1.x == 7.); - - return f1; -} - -// 64-bit PowerPC ELFv1 ABI: -// i should be in the least-significant bits of a register -// return should be in a hidden sret pointer -struct IntOdd int_odd(struct IntOdd i) { - assert(i.a == 1); - assert(i.b == 2); - assert(i.c == 3); - - return i; -} diff --git a/tests/run-make-fulldeps/extern-fn-struct-passing-abi/test.rs b/tests/run-make-fulldeps/extern-fn-struct-passing-abi/test.rs deleted file mode 100644 index afe0f52ef..000000000 --- a/tests/run-make-fulldeps/extern-fn-struct-passing-abi/test.rs +++ /dev/null @@ -1,138 +0,0 @@ -// Passing structs via FFI should work regardless of whether -// they get passed in multiple registers, byval pointers or the stack - -#[derive(Clone, Copy, Debug, PartialEq)] -#[repr(C)] -struct Rect { - a: i32, - b: i32, - c: i32, - d: i32, -} - -#[derive(Clone, Copy, Debug, PartialEq)] -#[repr(C)] -struct BiggerRect { - s: Rect, - a: i32, - b: i32, -} - -#[derive(Clone, Copy, Debug, PartialEq)] -#[repr(C)] -struct FloatRect { - a: i32, - b: i32, - c: f64, -} - -#[derive(Clone, Copy, Debug, PartialEq)] -#[repr(C)] -struct Huge { - a: i32, - b: i32, - c: i32, - d: i32, - e: i32, -} - -#[derive(Clone, Copy, Debug, PartialEq)] -#[repr(C)] -struct FloatPoint { - x: f64, - y: f64, -} - -#[derive(Clone, Copy, Debug, PartialEq)] -#[repr(C)] -struct FloatOne { - x: f64, -} - -#[derive(Clone, Copy, Debug, PartialEq)] -#[repr(C)] -struct IntOdd { - a: i8, - b: i8, - c: i8, -} - -#[link(name = "test", kind = "static")] -extern "C" { - fn byval_rect(a: i32, b: i32, c: i32, d: i32, e: i32, s: Rect); - - fn byval_many_rect(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32, s: Rect); - - fn byval_rect_floats( - a: f32, - b: f32, - c: f64, - d: f32, - e: f32, - f: f32, - g: f64, - s: Rect, - t: FloatRect, - ); - - fn byval_rect_with_float(a: i32, b: i32, c: f32, d: i32, e: i32, f: i32, s: Rect); - - fn byval_rect_with_many_huge(a: Huge, b: Huge, c: Huge, d: Huge, e: Huge, f: Huge, g: Rect); - - fn split_rect(a: i32, b: i32, s: Rect); - - fn split_rect_floats(a: f32, b: f32, s: FloatRect); - - fn split_rect_with_floats(a: i32, b: i32, c: f32, d: i32, e: f32, f: i32, s: Rect); - - fn split_and_byval_rect(a: i32, b: i32, c: i32, s: Rect, t: Rect); - - fn split_ret_byval_struct(a: i32, b: i32, s: Rect) -> Rect; - - fn sret_byval_struct(a: i32, b: i32, c: i32, d: i32, s: Rect) -> BiggerRect; - - fn sret_split_struct(a: i32, b: i32, s: Rect) -> BiggerRect; - - fn huge_struct(s: Huge) -> Huge; - - fn float_point(p: FloatPoint) -> FloatPoint; - - fn float_one(f: FloatOne) -> FloatOne; - - fn int_odd(i: IntOdd) -> IntOdd; -} - -fn main() { - let s = Rect { a: 553, b: 554, c: 555, d: 556 }; - let t = BiggerRect { s: s, a: 27834, b: 7657 }; - let u = FloatRect { a: 3489, b: 3490, c: 8. }; - let v = Huge { a: 5647, b: 5648, c: 5649, d: 5650, e: 5651 }; - let p = FloatPoint { x: 5., y: -3. }; - let f1 = FloatOne { x: 7. }; - let i = IntOdd { a: 1, b: 2, c: 3 }; - - unsafe { - byval_rect(1, 2, 3, 4, 5, s); - byval_many_rect(1, 2, 3, 4, 5, 6, s); - byval_rect_floats(1., 2., 3., 4., 5., 6., 7., s, u); - byval_rect_with_float(1, 2, 3.0, 4, 5, 6, s); - byval_rect_with_many_huge(v, v, v, v, v, v, Rect { a: 123, b: 456, c: 789, d: 420 }); - split_rect(1, 2, s); - split_rect_floats(1., 2., u); - split_rect_with_floats(1, 2, 3.0, 4, 5.0, 6, s); - split_and_byval_rect(1, 2, 3, s, s); - split_rect(1, 2, s); - assert_eq!(huge_struct(v), v); - assert_eq!(split_ret_byval_struct(1, 2, s), s); - assert_eq!(sret_byval_struct(1, 2, 3, 4, s), t); - assert_eq!(sret_split_struct(1, 2, s), t); - assert_eq!(float_point(p), p); - assert_eq!(int_odd(i), i); - - // MSVC/GCC/Clang are not consistent in the ABI of single-float aggregates. - // x86_64: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82028 - // i686: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82041 - #[cfg(not(all(windows, target_env = "gnu")))] - assert_eq!(float_one(f1), f1); - } -} diff --git a/tests/run-make-fulldeps/extern-fn-with-extern-types/Makefile b/tests/run-make-fulldeps/extern-fn-with-extern-types/Makefile deleted file mode 100644 index 1fa708950..000000000 --- a/tests/run-make-fulldeps/extern-fn-with-extern-types/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,ctest) - $(RUSTC) test.rs - $(call RUN,test) || exit 1 diff --git a/tests/run-make-fulldeps/extern-fn-with-extern-types/ctest.c b/tests/run-make-fulldeps/extern-fn-with-extern-types/ctest.c deleted file mode 100644 index 3b6fb4cfc..000000000 --- a/tests/run-make-fulldeps/extern-fn-with-extern-types/ctest.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -typedef struct data { - uint32_t magic; -} data; - -data* data_create(uint32_t magic) { - static data d; - d.magic = magic; - return &d; -} - -uint32_t data_get(data* p) { - return p->magic; -} diff --git a/tests/run-make-fulldeps/extern-fn-with-extern-types/test.rs b/tests/run-make-fulldeps/extern-fn-with-extern-types/test.rs deleted file mode 100644 index 90a6ebaf1..000000000 --- a/tests/run-make-fulldeps/extern-fn-with-extern-types/test.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![feature(extern_types)] - -#[link(name = "ctest", kind = "static")] -extern "C" { - type data; - - fn data_create(magic: u32) -> *mut data; - fn data_get(data: *mut data) -> u32; -} - -const MAGIC: u32 = 0xdeadbeef; -fn main() { - unsafe { - let data = data_create(MAGIC); - assert_eq!(data_get(data), MAGIC); - } -} diff --git a/tests/run-make-fulldeps/extern-fn-with-packed-struct/Makefile b/tests/run-make-fulldeps/extern-fn-with-packed-struct/Makefile deleted file mode 100644 index 4f5d026f2..000000000 --- a/tests/run-make-fulldeps/extern-fn-with-packed-struct/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,test) - $(RUSTC) test.rs - $(call RUN,test) || exit 1 diff --git a/tests/run-make-fulldeps/extern-fn-with-packed-struct/test.c b/tests/run-make-fulldeps/extern-fn-with-packed-struct/test.c deleted file mode 100644 index c89f8272b..000000000 --- a/tests/run-make-fulldeps/extern-fn-with-packed-struct/test.c +++ /dev/null @@ -1,26 +0,0 @@ -// Pragma needed cause of gcc bug on windows: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991 - -#include - -#ifdef _MSC_VER -#pragma pack(push,1) -struct Foo { - char a; - short b; - char c; -}; -#else -#pragma pack(1) -struct __attribute__((packed)) Foo { - char a; - short b; - char c; -}; -#endif - -struct Foo foo(struct Foo foo) { - assert(foo.a == 1); - assert(foo.b == 2); - assert(foo.c == 3); - return foo; -} diff --git a/tests/run-make-fulldeps/extern-fn-with-packed-struct/test.rs b/tests/run-make-fulldeps/extern-fn-with-packed-struct/test.rs deleted file mode 100644 index 2f261efb5..000000000 --- a/tests/run-make-fulldeps/extern-fn-with-packed-struct/test.rs +++ /dev/null @@ -1,20 +0,0 @@ -#[repr(C, packed)] -#[derive(Copy, Clone, Debug, PartialEq)] -struct Foo { - a: i8, - b: i16, - c: i8, -} - -#[link(name = "test", kind = "static")] -extern "C" { - fn foo(f: Foo) -> Foo; -} - -fn main() { - unsafe { - let a = Foo { a: 1, b: 2, c: 3 }; - let b = foo(a); - assert_eq!(a, b); - } -} diff --git a/tests/run-make-fulldeps/extern-fn-with-union/Makefile b/tests/run-make-fulldeps/extern-fn-with-union/Makefile deleted file mode 100644 index 40bae923e..000000000 --- a/tests/run-make-fulldeps/extern-fn-with-union/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,ctest) - $(RUSTC) testcrate.rs - $(RUSTC) test.rs - $(call RUN,test) || exit 1 diff --git a/tests/run-make-fulldeps/extern-fn-with-union/ctest.c b/tests/run-make-fulldeps/extern-fn-with-union/ctest.c deleted file mode 100644 index 86cb64537..000000000 --- a/tests/run-make-fulldeps/extern-fn-with-union/ctest.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include - -typedef union TestUnion { - uint64_t bits; -} TestUnion; - -uint64_t give_back(TestUnion tu) { - return tu.bits; -} diff --git a/tests/run-make-fulldeps/extern-fn-with-union/test.rs b/tests/run-make-fulldeps/extern-fn-with-union/test.rs deleted file mode 100644 index 438fbddf3..000000000 --- a/tests/run-make-fulldeps/extern-fn-with-union/test.rs +++ /dev/null @@ -1,19 +0,0 @@ -extern crate testcrate; - -use std::mem; - -extern "C" { - fn give_back(tu: testcrate::TestUnion) -> u64; -} - -fn main() { - let magic: u64 = 0xDEADBEEF; - - // Let's test calling it cross crate - let back = unsafe { testcrate::give_back(mem::transmute(magic)) }; - assert_eq!(magic, back); - - // And just within this crate - let back = unsafe { give_back(mem::transmute(magic)) }; - assert_eq!(magic, back); -} diff --git a/tests/run-make-fulldeps/extern-fn-with-union/testcrate.rs b/tests/run-make-fulldeps/extern-fn-with-union/testcrate.rs deleted file mode 100644 index 28d91ff37..000000000 --- a/tests/run-make-fulldeps/extern-fn-with-union/testcrate.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![crate_type = "lib"] - -#[repr(C)] -pub struct TestUnion { - _val: u64, -} - -#[link(name = "ctest", kind = "static")] -extern "C" { - pub fn give_back(tu: TestUnion) -> u64; -} diff --git a/tests/run-make-fulldeps/extern-multiple-copies/Makefile b/tests/run-make-fulldeps/extern-multiple-copies/Makefile deleted file mode 100644 index 00668a6bc..000000000 --- a/tests/run-make-fulldeps/extern-multiple-copies/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo1.rs - $(RUSTC) foo2.rs - mkdir $(TMPDIR)/foo - cp $(TMPDIR)/libfoo1.rlib $(TMPDIR)/foo/libfoo1.rlib - $(RUSTC) bar.rs --extern foo1=$(TMPDIR)/libfoo1.rlib -L $(TMPDIR)/foo diff --git a/tests/run-make-fulldeps/extern-multiple-copies/bar.rs b/tests/run-make-fulldeps/extern-multiple-copies/bar.rs deleted file mode 100644 index c6b3595f6..000000000 --- a/tests/run-make-fulldeps/extern-multiple-copies/bar.rs +++ /dev/null @@ -1,6 +0,0 @@ -extern crate foo2; // foo2 first to exhibit the bug -extern crate foo1; - -fn main() { - /* ... */ -} diff --git a/tests/run-make-fulldeps/extern-multiple-copies/foo1.rs b/tests/run-make-fulldeps/extern-multiple-copies/foo1.rs deleted file mode 100644 index c1bfaa6ca..000000000 --- a/tests/run-make-fulldeps/extern-multiple-copies/foo1.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "rlib"] diff --git a/tests/run-make-fulldeps/extern-multiple-copies/foo2.rs b/tests/run-make-fulldeps/extern-multiple-copies/foo2.rs deleted file mode 100644 index c1bfaa6ca..000000000 --- a/tests/run-make-fulldeps/extern-multiple-copies/foo2.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "rlib"] diff --git a/tests/run-make-fulldeps/extern-multiple-copies2/Makefile b/tests/run-make-fulldeps/extern-multiple-copies2/Makefile deleted file mode 100644 index 84de2ebf3..000000000 --- a/tests/run-make-fulldeps/extern-multiple-copies2/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo1.rs - $(RUSTC) foo2.rs - mkdir $(TMPDIR)/foo - cp $(TMPDIR)/libfoo1.rlib $(TMPDIR)/foo/libfoo1.rlib - $(RUSTC) bar.rs \ - --extern foo1=$(TMPDIR)/foo/libfoo1.rlib \ - --extern foo2=$(TMPDIR)/libfoo2.rlib diff --git a/tests/run-make-fulldeps/extern-multiple-copies2/bar.rs b/tests/run-make-fulldeps/extern-multiple-copies2/bar.rs deleted file mode 100644 index b3088152d..000000000 --- a/tests/run-make-fulldeps/extern-multiple-copies2/bar.rs +++ /dev/null @@ -1,8 +0,0 @@ -#[macro_use] -extern crate foo2; // foo2 first to exhibit the bug -#[macro_use] -extern crate foo1; - -fn main() { - foo2::foo2(foo1::A); -} diff --git a/tests/run-make-fulldeps/extern-multiple-copies2/foo1.rs b/tests/run-make-fulldeps/extern-multiple-copies2/foo1.rs deleted file mode 100644 index 4c778e52f..000000000 --- a/tests/run-make-fulldeps/extern-multiple-copies2/foo1.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![crate_type = "rlib"] - -pub struct A; - -pub fn foo1(a: A) { - drop(a); -} diff --git a/tests/run-make-fulldeps/extern-multiple-copies2/foo2.rs b/tests/run-make-fulldeps/extern-multiple-copies2/foo2.rs deleted file mode 100644 index 2be103507..000000000 --- a/tests/run-make-fulldeps/extern-multiple-copies2/foo2.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![crate_type = "rlib"] - -#[macro_use] -extern crate foo1; - -pub fn foo2(a: foo1::A) { - foo1::foo1(a); -} diff --git a/tests/run-make-fulldeps/extern-overrides-distribution/Makefile b/tests/run-make-fulldeps/extern-overrides-distribution/Makefile deleted file mode 100644 index c57b062cd..000000000 --- a/tests/run-make-fulldeps/extern-overrides-distribution/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) libc.rs -Cmetadata=foo - $(RUSTC) main.rs --extern libc=$(TMPDIR)/liblibc.rlib diff --git a/tests/run-make-fulldeps/extern-overrides-distribution/libc.rs b/tests/run-make-fulldeps/extern-overrides-distribution/libc.rs deleted file mode 100644 index ee51ae328..000000000 --- a/tests/run-make-fulldeps/extern-overrides-distribution/libc.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type = "lib"] - -pub fn foo() {} diff --git a/tests/run-make-fulldeps/extern-overrides-distribution/main.rs b/tests/run-make-fulldeps/extern-overrides-distribution/main.rs deleted file mode 100644 index 1290a8c56..000000000 --- a/tests/run-make-fulldeps/extern-overrides-distribution/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate libc; - -fn main() { - libc::foo(); -} diff --git a/tests/run-make-fulldeps/extra-filename-with-temp-outputs/Makefile b/tests/run-make-fulldeps/extra-filename-with-temp-outputs/Makefile deleted file mode 100644 index 470448cf5..000000000 --- a/tests/run-make-fulldeps/extra-filename-with-temp-outputs/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) -C extra-filename=bar foo.rs -C save-temps - rm $(TMPDIR)/foobar.foo*0.rcgu.o - rm $(TMPDIR)/$(call BIN,foobar) diff --git a/tests/run-make-fulldeps/extra-filename-with-temp-outputs/foo.rs b/tests/run-make-fulldeps/extra-filename-with-temp-outputs/foo.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/tests/run-make-fulldeps/extra-filename-with-temp-outputs/foo.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/foreign-double-unwind/Makefile b/tests/run-make-fulldeps/foreign-double-unwind/Makefile deleted file mode 100644 index ea2fe9ff8..000000000 --- a/tests/run-make-fulldeps/foreign-double-unwind/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -all: foo - $(call RUN,foo) | $(CGREP) -v unreachable - -foo: foo.rs $(call NATIVE_STATICLIB,foo) - $(RUSTC) $< -lfoo $(EXTRARSCXXFLAGS) - -$(TMPDIR)/libfoo.o: foo.cpp - $(call COMPILE_OBJ_CXX,$@,$<) diff --git a/tests/run-make-fulldeps/foreign-double-unwind/foo.cpp b/tests/run-make-fulldeps/foreign-double-unwind/foo.cpp deleted file mode 100644 index 69a8f11c2..000000000 --- a/tests/run-make-fulldeps/foreign-double-unwind/foo.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include - -void println(const char* s) { - puts(s); - fflush(stdout); -} - -struct outer_exception {}; -struct inner_exception {}; - -extern "C" { - void throw_cxx_exception() { - if (std::uncaught_exception()) { - println("throwing inner C++ exception"); - throw inner_exception(); - } else { - println("throwing outer C++ exception"); - throw outer_exception(); - } - } - - void cxx_catch_callback(void (*cb)()) { - try { - cb(); - println("unreachable: callback returns"); - } catch (outer_exception) { - println("unreachable: caught outer exception in catch (...)"); - } catch (inner_exception) { - println("unreachable: caught inner exception in catch (...)"); - } - } -} diff --git a/tests/run-make-fulldeps/foreign-double-unwind/foo.rs b/tests/run-make-fulldeps/foreign-double-unwind/foo.rs deleted file mode 100644 index cae8aa940..000000000 --- a/tests/run-make-fulldeps/foreign-double-unwind/foo.rs +++ /dev/null @@ -1,26 +0,0 @@ -// 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()); -} - -struct ThrowOnDrop; - -impl Drop for ThrowOnDrop { - fn drop(&mut self) { - unsafe { throw_cxx_exception() }; - } -} - -extern "C-unwind" fn test_double_unwind() { - let _a = ThrowOnDrop; - let _b = ThrowOnDrop; -} - -fn main() { - unsafe { cxx_catch_callback(test_double_unwind) }; -} diff --git a/tests/run-make-fulldeps/foreign-exceptions/Makefile b/tests/run-make-fulldeps/foreign-exceptions/Makefile deleted file mode 100644 index 38fe2773d..000000000 --- a/tests/run-make-fulldeps/foreign-exceptions/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -all: foo - $(call RUN,foo) - -foo: foo.rs $(call NATIVE_STATICLIB,foo) - $(RUSTC) $< -lfoo $(EXTRARSCXXFLAGS) - -$(TMPDIR)/libfoo.o: foo.cpp - $(call COMPILE_OBJ_CXX,$@,$<) diff --git a/tests/run-make-fulldeps/foreign-exceptions/foo.cpp b/tests/run-make-fulldeps/foreign-exceptions/foo.cpp deleted file mode 100644 index 8182021a2..000000000 --- a/tests/run-make-fulldeps/foreign-exceptions/foo.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include -#include -#include - -void println(const char* s) { - puts(s); - fflush(stdout); -} - -struct exception {}; -struct rust_panic {}; - -struct drop_check { - bool* ok; - ~drop_check() { - println("~drop_check"); - - if (ok) - *ok = true; - } -}; - -extern "C" { - void rust_catch_callback(void (*cb)(), bool* rust_ok); - - void throw_cxx_exception() { - println("throwing C++ exception"); - throw exception(); - } - - void test_cxx_exception() { - bool rust_ok = false; - try { - rust_catch_callback(throw_cxx_exception, &rust_ok); - assert(false && "unreachable"); - } catch (exception e) { - println("caught C++ exception"); - assert(rust_ok); - return; - } - assert(false && "did not catch thrown C++ exception"); - } - - void cxx_catch_callback(void (*cb)(), bool* cxx_ok) { - drop_check x; - x.ok = NULL; - try { - cb(); - } catch (rust_panic e) { - assert(false && "shouldn't be able to catch a rust panic"); - } catch (...) { - println("caught foreign exception in catch (...)"); - // Foreign exceptions are caught by catch (...). We only set the ok - // flag if we successfully caught the panic. The destructor of - // drop_check will then set the flag to true if it is executed. - x.ok = cxx_ok; - throw; - } - } -} diff --git a/tests/run-make-fulldeps/foreign-exceptions/foo.rs b/tests/run-make-fulldeps/foreign-exceptions/foo.rs deleted file mode 100644 index dd3b7c76f..000000000 --- a/tests/run-make-fulldeps/foreign-exceptions/foo.rs +++ /dev/null @@ -1,59 +0,0 @@ -// Tests that C++ exceptions can unwind through Rust code run destructors and -// 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); -impl<'a> Drop for DropCheck<'a> { - fn drop(&mut self) { - println!("DropCheck::drop"); - *self.0 = true; - } -} - -extern "C" { - fn test_cxx_exception(); -} - -extern "C-unwind" { - fn cxx_catch_callback(cb: extern "C-unwind" fn(), ok: *mut bool); -} - -#[no_mangle] -extern "C-unwind" fn rust_catch_callback(cb: extern "C-unwind" fn(), rust_ok: &mut bool) { - let _drop = DropCheck(rust_ok); - cb(); - unreachable!("should have unwound instead of returned"); -} - -fn test_rust_panic() { - extern "C-unwind" fn callback() { - println!("throwing rust panic"); - panic!(1234i32); - } - - let mut dropped = false; - let mut cxx_ok = false; - let caught_unwind = catch_unwind(AssertUnwindSafe(|| { - let _drop = DropCheck(&mut dropped); - unsafe { - cxx_catch_callback(callback, &mut cxx_ok); - } - unreachable!("should have unwound instead of returned"); - })); - println!("caught rust panic"); - assert!(dropped); - assert!(caught_unwind.is_err()); - let panic_obj = caught_unwind.unwrap_err(); - let panic_int = *panic_obj.downcast_ref::().unwrap(); - assert_eq!(panic_int, 1234); - assert!(cxx_ok); -} - -fn main() { - unsafe { test_cxx_exception() }; - test_rust_panic(); -} diff --git a/tests/run-make-fulldeps/foreign-rust-exceptions/Makefile b/tests/run-make-fulldeps/foreign-rust-exceptions/Makefile deleted file mode 100644 index 50fca7f24..000000000 --- a/tests/run-make-fulldeps/foreign-rust-exceptions/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# ignore-i686-pc-windows-gnu - -# This test doesn't work on 32-bit MinGW as cdylib has its own copy of unwinder -# so cross-DLL unwinding does not work. - -include ../tools.mk - -all: - $(RUSTC) bar.rs --crate-type=cdylib - $(RUSTC) foo.rs - $(call RUN,foo) 2>&1 | $(CGREP) "Rust cannot catch foreign exceptions" diff --git a/tests/run-make-fulldeps/foreign-rust-exceptions/bar.rs b/tests/run-make-fulldeps/foreign-rust-exceptions/bar.rs deleted file mode 100644 index 5f9efe323..000000000 --- a/tests/run-make-fulldeps/foreign-rust-exceptions/bar.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![crate_type = "cdylib"] -#![feature(c_unwind)] - -#[no_mangle] -extern "C-unwind" fn panic() { - panic!(); -} diff --git a/tests/run-make-fulldeps/foreign-rust-exceptions/foo.rs b/tests/run-make-fulldeps/foreign-rust-exceptions/foo.rs deleted file mode 100644 index 266987c5b..000000000 --- a/tests/run-make-fulldeps/foreign-rust-exceptions/foo.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![feature(c_unwind)] - -#[cfg_attr(not(windows), link(name = "bar"))] -#[cfg_attr(windows, link(name = "bar.dll"))] -extern "C-unwind" { - fn panic(); -} - -fn main() { - let _ = std::panic::catch_unwind(|| { - unsafe { panic() }; - }); -} diff --git a/tests/run-make-fulldeps/fpic/Makefile b/tests/run-make-fulldeps/fpic/Makefile deleted file mode 100644 index 5986de366..000000000 --- a/tests/run-make-fulldeps/fpic/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -# ignore-windows -# ignore-macos - -# Test for #39529. -# `-z text` causes ld to error if there are any non-PIC sections - -all: - $(RUSTC) hello.rs -C link-args=-Wl,-z,text diff --git a/tests/run-make-fulldeps/fpic/hello.rs b/tests/run-make-fulldeps/fpic/hello.rs deleted file mode 100644 index 45590d86b..000000000 --- a/tests/run-make-fulldeps/fpic/hello.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() { } diff --git a/tests/run-make-fulldeps/glibc-staticlib-args/Makefile b/tests/run-make-fulldeps/glibc-staticlib-args/Makefile deleted file mode 100644 index 39e64bacf..000000000 --- a/tests/run-make-fulldeps/glibc-staticlib-args/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# only-gnu -# only-linux - -include ../tools.mk - -# This ensures that std::env::args works in a library called from C on glibc Linux. - -all: - $(RUSTC) --crate-type=staticlib library.rs - $(CC) program.c $(call STATICLIB,library) $(call OUT_EXE,program) \ - $(EXTRACFLAGS) $(EXTRACXXFLAGS) - $(call RUN,program) diff --git a/tests/run-make-fulldeps/glibc-staticlib-args/library.rs b/tests/run-make-fulldeps/glibc-staticlib-args/library.rs deleted file mode 100644 index 5ab627a2a..000000000 --- a/tests/run-make-fulldeps/glibc-staticlib-args/library.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[no_mangle] -pub extern "C" fn args_check() { - assert_ne!(std::env::args_os().count(), 0); -} diff --git a/tests/run-make-fulldeps/glibc-staticlib-args/program.c b/tests/run-make-fulldeps/glibc-staticlib-args/program.c deleted file mode 100644 index 30f6974b7..000000000 --- a/tests/run-make-fulldeps/glibc-staticlib-args/program.c +++ /dev/null @@ -1,6 +0,0 @@ -void args_check(); - -int main() { - args_check(); - return 0; -} diff --git a/tests/run-make-fulldeps/hir-tree/Makefile b/tests/run-make-fulldeps/hir-tree/Makefile deleted file mode 100644 index b0450ea4b..000000000 --- a/tests/run-make-fulldeps/hir-tree/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -# Test that hir-tree output doesn't crash and includes -# the string constant we would expect to see. - -all: - $(RUSTC) -o $(TMPDIR)/input.hir -Z unpretty=hir-tree input.rs - $(CGREP) '"Hello, Rustaceans!\n"' < $(TMPDIR)/input.hir diff --git a/tests/run-make-fulldeps/hir-tree/input.rs b/tests/run-make-fulldeps/hir-tree/input.rs deleted file mode 100644 index 9d1a4e9e4..000000000 --- a/tests/run-make-fulldeps/hir-tree/input.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, Rustaceans!"); -} diff --git a/tests/run-make-fulldeps/hotplug_codegen_backend/Makefile b/tests/run-make-fulldeps/hotplug_codegen_backend/Makefile index 4cda243ff..6752091e6 100644 --- a/tests/run-make-fulldeps/hotplug_codegen_backend/Makefile +++ b/tests/run-make-fulldeps/hotplug_codegen_backend/Makefile @@ -1,4 +1,4 @@ -include ../tools.mk +include ../../run-make/tools.mk # ignore-stage1 diff --git a/tests/run-make-fulldeps/include_bytes_deps/Makefile b/tests/run-make-fulldeps/include_bytes_deps/Makefile deleted file mode 100644 index 696dfd207..000000000 --- a/tests/run-make-fulldeps/include_bytes_deps/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -# ignore-freebsd - -all: - $(RUSTC) --emit dep-info main.rs - $(CGREP) "input.txt" "input.bin" "input.md" < $(TMPDIR)/main.d diff --git a/tests/run-make-fulldeps/include_bytes_deps/input.bin b/tests/run-make-fulldeps/include_bytes_deps/input.bin deleted file mode 100644 index cd0875583..000000000 --- a/tests/run-make-fulldeps/include_bytes_deps/input.bin +++ /dev/null @@ -1 +0,0 @@ -Hello world! diff --git a/tests/run-make-fulldeps/include_bytes_deps/input.md b/tests/run-make-fulldeps/include_bytes_deps/input.md deleted file mode 100644 index 2a19b7405..000000000 --- a/tests/run-make-fulldeps/include_bytes_deps/input.md +++ /dev/null @@ -1 +0,0 @@ -# Hello, world! diff --git a/tests/run-make-fulldeps/include_bytes_deps/input.txt b/tests/run-make-fulldeps/include_bytes_deps/input.txt deleted file mode 100644 index cd0875583..000000000 --- a/tests/run-make-fulldeps/include_bytes_deps/input.txt +++ /dev/null @@ -1 +0,0 @@ -Hello world! diff --git a/tests/run-make-fulldeps/include_bytes_deps/main.rs b/tests/run-make-fulldeps/include_bytes_deps/main.rs deleted file mode 100644 index 2fd55699d..000000000 --- a/tests/run-make-fulldeps/include_bytes_deps/main.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[doc = include_str!("input.md")] -pub struct SomeStruct; - -pub fn main() { - const INPUT_TXT: &'static str = include_str!("input.txt"); - const INPUT_BIN: &'static [u8] = include_bytes!("input.bin"); - - println!("{}", INPUT_TXT); - println!("{:?}", INPUT_BIN); -} diff --git a/tests/run-make-fulldeps/incr-add-rust-src-component/Makefile b/tests/run-make-fulldeps/incr-add-rust-src-component/Makefile deleted file mode 100644 index 5c1d953cc..000000000 --- a/tests/run-make-fulldeps/incr-add-rust-src-component/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -include ../tools.mk - -# rust-lang/rust#70924: Test that if we add rust-src component in between two -# incremental compiles, the compiler does not ICE on the second. - -# This test uses `ln -s` rather than copying to save testing time, but its -# usage doesn't work on windows. So ignore windows. - -# ignore-windows - -SYSROOT:=$(shell $(RUSTC) --print sysroot) -FAKEROOT=$(TMPDIR)/fakeroot -INCR=$(TMPDIR)/incr - -# Make a local copy of the sysroot; then remove the rust-src part of it, if -# present, for the *first* build. Then put in a facsimile of the rust-src -# component for the second build, in order to expose the ICE from issue #70924. -# -# Note that it is much easier to just do `cp -a $(SYSROOT)/* $(FAKEROOT)` as a -# first step, but I am concerned that would be too expensive in a unit test -# compared to making symbolic links. -# -# Anyway, the pattern you'll see here is: For every prefix in -# root/lib/rustlib/src, link all of prefix parent content, then remove the -# prefix, then loop on the next prefix. This way, we basically create a copy of -# the context around root/lib/rustlib/src, and can freely add/remove the src -# component itself. -all: - mkdir $(FAKEROOT) - ln -s $(SYSROOT)/* $(FAKEROOT) - rm -f $(FAKEROOT)/lib - mkdir $(FAKEROOT)/lib - ln -s $(SYSROOT)/lib/* $(FAKEROOT)/lib - rm -f $(FAKEROOT)/lib/rustlib - mkdir $(FAKEROOT)/lib/rustlib - ln -s $(SYSROOT)/lib/rustlib/* $(FAKEROOT)/lib/rustlib - rm -f $(FAKEROOT)/lib/rustlib/src - mkdir $(FAKEROOT)/lib/rustlib/src - ln -s $(SYSROOT)/lib/rustlib/src/* $(FAKEROOT)/lib/rustlib/src - rm -f $(FAKEROOT)/lib/rustlib/src/rust - $(RUSTC) --sysroot $(FAKEROOT) -C incremental=$(INCR) main.rs - mkdir -p $(FAKEROOT)/lib/rustlib/src/rust/src/libstd - touch $(FAKEROOT)/lib/rustlib/src/rust/src/libstd/lib.rs - $(RUSTC) --sysroot $(FAKEROOT) -C incremental=$(INCR) main.rs diff --git a/tests/run-make-fulldeps/incr-add-rust-src-component/main.rs b/tests/run-make-fulldeps/incr-add-rust-src-component/main.rs deleted file mode 100644 index f6320bcb0..000000000 --- a/tests/run-make-fulldeps/incr-add-rust-src-component/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello World"); -} diff --git a/tests/run-make-fulldeps/inline-always-many-cgu/Makefile b/tests/run-make-fulldeps/inline-always-many-cgu/Makefile deleted file mode 100644 index 9945821db..000000000 --- a/tests/run-make-fulldeps/inline-always-many-cgu/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs --emit llvm-ir -C codegen-units=2 - if cat $(TMPDIR)/*.ll | $(CGREP) -e '\bcall\b'; then \ - echo "found call instruction when one wasn't expected"; \ - exit 1; \ - fi diff --git a/tests/run-make-fulldeps/inline-always-many-cgu/foo.rs b/tests/run-make-fulldeps/inline-always-many-cgu/foo.rs deleted file mode 100644 index 65fe69c16..000000000 --- a/tests/run-make-fulldeps/inline-always-many-cgu/foo.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![crate_type = "lib"] - -pub mod a { - #[inline(always)] - pub fn foo() { - } - - pub fn bar() { - } -} - -#[no_mangle] -pub fn bar() { - a::foo(); -} diff --git a/tests/run-make-fulldeps/interdependent-c-libraries/Makefile b/tests/run-make-fulldeps/interdependent-c-libraries/Makefile deleted file mode 100644 index dc5b55a99..000000000 --- a/tests/run-make-fulldeps/interdependent-c-libraries/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -include ../tools.mk - -# The rust crate foo will link to the native library foo, while the rust crate -# bar will link to the native library bar. There is also a dependency between -# the native library bar to the natibe library foo. -# -# This test ensures that the ordering of -lfoo and -lbar on the command line is -# correct to complete the linkage. If passed as "-lfoo -lbar", then the 'foo' -# library will be stripped out, and the linkage will fail. - -all: $(call NATIVE_STATICLIB,foo) $(call NATIVE_STATICLIB,bar) - $(RUSTC) foo.rs - $(RUSTC) bar.rs - $(RUSTC) main.rs --print link-args diff --git a/tests/run-make-fulldeps/interdependent-c-libraries/bar.c b/tests/run-make-fulldeps/interdependent-c-libraries/bar.c deleted file mode 100644 index 812c97535..000000000 --- a/tests/run-make-fulldeps/interdependent-c-libraries/bar.c +++ /dev/null @@ -1,3 +0,0 @@ -void foo(); - -void bar() { foo(); } diff --git a/tests/run-make-fulldeps/interdependent-c-libraries/bar.rs b/tests/run-make-fulldeps/interdependent-c-libraries/bar.rs deleted file mode 100644 index 3c2c3f218..000000000 --- a/tests/run-make-fulldeps/interdependent-c-libraries/bar.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![crate_type = "rlib"] - -extern crate foo; - -#[link(name = "bar", kind = "static")] -extern "C" { - fn bar(); -} - -pub fn doit() { - unsafe { - bar(); - } -} diff --git a/tests/run-make-fulldeps/interdependent-c-libraries/foo.c b/tests/run-make-fulldeps/interdependent-c-libraries/foo.c deleted file mode 100644 index 85e6cd8c3..000000000 --- a/tests/run-make-fulldeps/interdependent-c-libraries/foo.c +++ /dev/null @@ -1 +0,0 @@ -void foo() {} diff --git a/tests/run-make-fulldeps/interdependent-c-libraries/foo.rs b/tests/run-make-fulldeps/interdependent-c-libraries/foo.rs deleted file mode 100644 index a69809726..000000000 --- a/tests/run-make-fulldeps/interdependent-c-libraries/foo.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![crate_type = "rlib"] - -#[link(name = "foo", kind = "static")] -extern "C" { - fn foo(); -} - -pub fn doit() { - unsafe { - foo(); - } -} diff --git a/tests/run-make-fulldeps/interdependent-c-libraries/main.rs b/tests/run-make-fulldeps/interdependent-c-libraries/main.rs deleted file mode 100644 index 2aba427df..000000000 --- a/tests/run-make-fulldeps/interdependent-c-libraries/main.rs +++ /dev/null @@ -1,6 +0,0 @@ -extern crate foo; -extern crate bar; - -fn main() { - bar::doit(); -} diff --git a/tests/run-make-fulldeps/intrinsic-unreachable/Makefile b/tests/run-make-fulldeps/intrinsic-unreachable/Makefile deleted file mode 100644 index ff9cc5709..000000000 --- a/tests/run-make-fulldeps/intrinsic-unreachable/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include ../tools.mk - -# needs-asm-support -# ignore-windows-msvc -# -# Because of Windows exception handling, the code is not necessarily any shorter. -# https://github.com/llvm-mirror/llvm/commit/64b2297786f7fd6f5fa24cdd4db0298fbf211466 - -all: - $(RUSTC) -O --emit asm exit-ret.rs - $(RUSTC) -O --emit asm exit-unreachable.rs - test `wc -l < $(TMPDIR)/exit-unreachable.s` -lt `wc -l < $(TMPDIR)/exit-ret.s` diff --git a/tests/run-make-fulldeps/intrinsic-unreachable/exit-ret.rs b/tests/run-make-fulldeps/intrinsic-unreachable/exit-ret.rs deleted file mode 100644 index e7b9694d9..000000000 --- a/tests/run-make-fulldeps/intrinsic-unreachable/exit-ret.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![crate_type="lib"] -use std::arch::asm; - -#[deny(unreachable_code)] -pub fn exit(n: usize) -> i32 { - unsafe { - // Pretend this asm is an exit() syscall. - asm!("/*{0}*/", in(reg) n); - } - // This return value is just here to generate some extra code for a return - // value, making it easier for the test script to detect whether the - // compiler deleted it. - 42 -} diff --git a/tests/run-make-fulldeps/intrinsic-unreachable/exit-unreachable.rs b/tests/run-make-fulldeps/intrinsic-unreachable/exit-unreachable.rs deleted file mode 100644 index ec85db733..000000000 --- a/tests/run-make-fulldeps/intrinsic-unreachable/exit-unreachable.rs +++ /dev/null @@ -1,18 +0,0 @@ -#![feature(core_intrinsics)] -#![crate_type="lib"] -use std::arch::asm; - -use std::intrinsics; - -#[allow(unreachable_code)] -pub fn exit(n: usize) -> i32 { - unsafe { - // Pretend this asm is an exit() syscall. - asm!("/*{0}*/", in(reg) n); - intrinsics::unreachable() - } - // This return value is just here to generate some extra code for a return - // value, making it easier for the test script to detect whether the - // compiler deleted it. - 42 -} diff --git a/tests/run-make-fulldeps/invalid-library/Makefile b/tests/run-make-fulldeps/invalid-library/Makefile deleted file mode 100644 index 910d9af7b..000000000 --- a/tests/run-make-fulldeps/invalid-library/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - touch $(TMPDIR)/lib.rmeta - $(AR) crus $(TMPDIR)/libfoo-ffffffff-1.0.rlib $(TMPDIR)/lib.rmeta - $(RUSTC) foo.rs 2>&1 | $(CGREP) "found invalid metadata" diff --git a/tests/run-make-fulldeps/invalid-library/foo.rs b/tests/run-make-fulldeps/invalid-library/foo.rs deleted file mode 100644 index bb7b36c49..000000000 --- a/tests/run-make-fulldeps/invalid-library/foo.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate foo; - -fn main() {} diff --git a/tests/run-make-fulldeps/invalid-staticlib/Makefile b/tests/run-make-fulldeps/invalid-staticlib/Makefile deleted file mode 100644 index 3f0f74ce3..000000000 --- a/tests/run-make-fulldeps/invalid-staticlib/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - touch $(TMPDIR)/libfoo.a - echo | $(RUSTC) - --crate-type=rlib -lstatic=foo 2>&1 | $(CGREP) "failed to add native library" diff --git a/tests/run-make-fulldeps/issue-11908/Makefile b/tests/run-make-fulldeps/issue-11908/Makefile deleted file mode 100644 index 47005537e..000000000 --- a/tests/run-make-fulldeps/issue-11908/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# This test ensures that if you have the same rlib or dylib at two locations -# in the same path that you don't hit an assertion in the compiler. -# -# Note that this relies on `liburl` to be in the path somewhere else, -# and then our aux-built libraries will collide with liburl (they have -# the same version listed) - -include ../tools.mk - -all: - mkdir $(TMPDIR)/other - $(RUSTC) foo.rs --crate-type=dylib -C prefer-dynamic - mv $(call DYLIB,foo) $(TMPDIR)/other - $(RUSTC) foo.rs --crate-type=dylib -C prefer-dynamic - $(RUSTC) bar.rs -L $(TMPDIR)/other - rm -rf $(TMPDIR) - mkdir -p $(TMPDIR)/other - $(RUSTC) foo.rs --crate-type=rlib - mv $(TMPDIR)/libfoo.rlib $(TMPDIR)/other - $(RUSTC) foo.rs --crate-type=rlib - $(RUSTC) bar.rs -L $(TMPDIR)/other diff --git a/tests/run-make-fulldeps/issue-11908/bar.rs b/tests/run-make-fulldeps/issue-11908/bar.rs deleted file mode 100644 index bb7b36c49..000000000 --- a/tests/run-make-fulldeps/issue-11908/bar.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate foo; - -fn main() {} diff --git a/tests/run-make-fulldeps/issue-11908/foo.rs b/tests/run-make-fulldeps/issue-11908/foo.rs deleted file mode 100644 index 82b2dfe9f..000000000 --- a/tests/run-make-fulldeps/issue-11908/foo.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_name = "foo"] diff --git a/tests/run-make-fulldeps/issue-14500/Makefile b/tests/run-make-fulldeps/issue-14500/Makefile deleted file mode 100644 index 52550e570..000000000 --- a/tests/run-make-fulldeps/issue-14500/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -include ../tools.mk - -# Test to make sure that reachable extern fns are always available in final -# productcs, including when LTO is used. In this test, the `foo` crate has a -# reahable symbol, and is a dependency of the `bar` crate. When the `bar` crate -# is compiled with LTO, it shouldn't strip the symbol from `foo`, and that's the -# only way that `foo.c` will successfully compile. - -all: - $(RUSTC) foo.rs --crate-type=rlib - $(RUSTC) bar.rs --crate-type=staticlib -C lto -L. -o $(TMPDIR)/libbar.a - $(CC) foo.c $(TMPDIR)/libbar.a $(EXTRACFLAGS) $(call OUT_EXE,foo) - $(call RUN,foo) diff --git a/tests/run-make-fulldeps/issue-14500/bar.rs b/tests/run-make-fulldeps/issue-14500/bar.rs deleted file mode 100644 index 49af74e1b..000000000 --- a/tests/run-make-fulldeps/issue-14500/bar.rs +++ /dev/null @@ -1 +0,0 @@ -extern crate foo; diff --git a/tests/run-make-fulldeps/issue-14500/foo.c b/tests/run-make-fulldeps/issue-14500/foo.c deleted file mode 100644 index 2353d400d..000000000 --- a/tests/run-make-fulldeps/issue-14500/foo.c +++ /dev/null @@ -1,7 +0,0 @@ -extern void foo(); -extern char FOO_STATIC; - -int main() { - foo(); - return (int)FOO_STATIC; -} diff --git a/tests/run-make-fulldeps/issue-14500/foo.rs b/tests/run-make-fulldeps/issue-14500/foo.rs deleted file mode 100644 index 7c19c1f2c..000000000 --- a/tests/run-make-fulldeps/issue-14500/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[no_mangle] -pub extern "C" fn foo() {} - -#[no_mangle] -pub static FOO_STATIC: u8 = 0; diff --git a/tests/run-make-fulldeps/issue-14698/Makefile b/tests/run-make-fulldeps/issue-14698/Makefile deleted file mode 100644 index a1cfb5aba..000000000 --- a/tests/run-make-fulldeps/issue-14698/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - TMP=fake TMPDIR=fake $(RUSTC) foo.rs 2>&1 | $(CGREP) "couldn't create a temp dir:" diff --git a/tests/run-make-fulldeps/issue-14698/foo.rs b/tests/run-make-fulldeps/issue-14698/foo.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/tests/run-make-fulldeps/issue-14698/foo.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/issue-15460/Makefile b/tests/run-make-fulldeps/issue-15460/Makefile deleted file mode 100644 index 1648d0c0c..000000000 --- a/tests/run-make-fulldeps/issue-15460/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,foo) - $(RUSTC) foo.rs -C extra-filename=-383hf8 -C prefer-dynamic - $(RUSTC) bar.rs - $(call RUN,bar) diff --git a/tests/run-make-fulldeps/issue-15460/bar.rs b/tests/run-make-fulldeps/issue-15460/bar.rs deleted file mode 100644 index e66aeb6bd..000000000 --- a/tests/run-make-fulldeps/issue-15460/bar.rs +++ /dev/null @@ -1,4 +0,0 @@ -extern crate foo; -fn main() { - unsafe { foo::foo() } -} diff --git a/tests/run-make-fulldeps/issue-15460/foo.c b/tests/run-make-fulldeps/issue-15460/foo.c deleted file mode 100644 index fdf595b57..000000000 --- a/tests/run-make-fulldeps/issue-15460/foo.c +++ /dev/null @@ -1,6 +0,0 @@ -// ignore-license - -#ifdef _WIN32 -__declspec(dllexport) -#endif -void foo() {} diff --git a/tests/run-make-fulldeps/issue-15460/foo.rs b/tests/run-make-fulldeps/issue-15460/foo.rs deleted file mode 100644 index b4eaa0b31..000000000 --- a/tests/run-make-fulldeps/issue-15460/foo.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_type = "dylib"] - -#[link(name = "foo", kind = "static")] -extern "C" { - pub fn foo(); -} diff --git a/tests/run-make-fulldeps/issue-18943/Makefile b/tests/run-make-fulldeps/issue-18943/Makefile deleted file mode 100644 index fc40d756d..000000000 --- a/tests/run-make-fulldeps/issue-18943/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -# Regression test for ICE #18943 when compiling as lib - -all: - $(RUSTC) foo.rs --crate-type lib - $(call REMOVE_RLIBS,foo) && exit 0 || exit 1 diff --git a/tests/run-make-fulldeps/issue-18943/foo.rs b/tests/run-make-fulldeps/issue-18943/foo.rs deleted file mode 100644 index d18400dd3..000000000 --- a/tests/run-make-fulldeps/issue-18943/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -trait Foo { } - -trait Bar { } - -impl<'a> Foo for Bar + 'a { } diff --git a/tests/run-make-fulldeps/issue-19371/Makefile b/tests/run-make-fulldeps/issue-19371/Makefile index 994e50801..edec68f08 100644 --- a/tests/run-make-fulldeps/issue-19371/Makefile +++ b/tests/run-make-fulldeps/issue-19371/Makefile @@ -1,4 +1,4 @@ -include ../tools.mk +include ../../run-make/tools.mk # This test ensures that rustc compile_input can be called twice in one task # without causing a panic. diff --git a/tests/run-make-fulldeps/issue-20626/Makefile b/tests/run-make-fulldeps/issue-20626/Makefile deleted file mode 100644 index f76f31e79..000000000 --- a/tests/run-make-fulldeps/issue-20626/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -# Test output to be four -# The original error only occurred when printing, not when comparing using assert! - -all: - $(RUSTC) foo.rs -O - [ `$(call RUN,foo)` = "4" ] diff --git a/tests/run-make-fulldeps/issue-20626/foo.rs b/tests/run-make-fulldeps/issue-20626/foo.rs deleted file mode 100644 index a474e234e..000000000 --- a/tests/run-make-fulldeps/issue-20626/foo.rs +++ /dev/null @@ -1,13 +0,0 @@ -fn identity(a: &u32) -> &u32 { a } - -fn print_foo(f: &fn(&u32) -> &u32, x: &u32) { - print!("{}", (*f)(x)); -} - -fn main() { - let x = &4; - let f: fn(&u32) -> &u32 = identity; - - // Didn't print 4 on optimized builds - print_foo(&f, x); -} diff --git a/tests/run-make-fulldeps/issue-22131/Makefile b/tests/run-make-fulldeps/issue-22131/Makefile deleted file mode 100644 index 770f4b04e..000000000 --- a/tests/run-make-fulldeps/issue-22131/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: foo.rs - $(RUSTC) --cfg 'feature="bar"' --crate-type lib foo.rs - $(RUSTDOC) --test --cfg 'feature="bar"' \ - -L $(TMPDIR) foo.rs |\ - $(CGREP) 'foo.rs - foo (line 1) ... ok' diff --git a/tests/run-make-fulldeps/issue-22131/foo.rs b/tests/run-make-fulldeps/issue-22131/foo.rs deleted file mode 100644 index 33255d768..000000000 --- a/tests/run-make-fulldeps/issue-22131/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -/// ```rust -/// assert_eq!(foo::foo(), 1); -/// ``` -#[cfg(feature = "bar")] -pub fn foo() -> i32 { 1 } diff --git a/tests/run-make-fulldeps/issue-24445/Makefile b/tests/run-make-fulldeps/issue-24445/Makefile deleted file mode 100644 index 2a12226a6..000000000 --- a/tests/run-make-fulldeps/issue-24445/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -# only-linux - -all: - $(RUSTC) foo.rs - $(CC) foo.c -lfoo -L $(TMPDIR) -Wl,--gc-sections -lpthread -ldl -o $(TMPDIR)/foo - $(call RUN,foo) - $(CC) foo.c -lfoo -L $(TMPDIR) -Wl,--gc-sections -lpthread -ldl -pie -fPIC -o $(TMPDIR)/foo - $(call RUN,foo) diff --git a/tests/run-make-fulldeps/issue-24445/foo.c b/tests/run-make-fulldeps/issue-24445/foo.c deleted file mode 100644 index bb4036b06..000000000 --- a/tests/run-make-fulldeps/issue-24445/foo.c +++ /dev/null @@ -1,6 +0,0 @@ -void foo(); - -int main() { - foo(); - return 0; -} diff --git a/tests/run-make-fulldeps/issue-24445/foo.rs b/tests/run-make-fulldeps/issue-24445/foo.rs deleted file mode 100644 index b67f3847c..000000000 --- a/tests/run-make-fulldeps/issue-24445/foo.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![crate_type = "staticlib"] - -struct Destroy; -impl Drop for Destroy { - fn drop(&mut self) { println!("drop"); } -} - -thread_local! { - static X: Destroy = Destroy -} - -#[no_mangle] -pub extern "C" fn foo() { - X.with(|_| ()); -} diff --git a/tests/run-make-fulldeps/issue-25581/Makefile b/tests/run-make-fulldeps/issue-25581/Makefile deleted file mode 100644 index 4f5d026f2..000000000 --- a/tests/run-make-fulldeps/issue-25581/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,test) - $(RUSTC) test.rs - $(call RUN,test) || exit 1 diff --git a/tests/run-make-fulldeps/issue-25581/test.c b/tests/run-make-fulldeps/issue-25581/test.c deleted file mode 100644 index 52fbf7851..000000000 --- a/tests/run-make-fulldeps/issue-25581/test.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include - -struct ByteSlice { - uint8_t *data; - size_t len; -}; - -size_t slice_len(struct ByteSlice bs) { - return bs.len; -} - -uint8_t slice_elem(struct ByteSlice bs, size_t idx) { - return bs.data[idx]; -} diff --git a/tests/run-make-fulldeps/issue-25581/test.rs b/tests/run-make-fulldeps/issue-25581/test.rs deleted file mode 100644 index ba6749c97..000000000 --- a/tests/run-make-fulldeps/issue-25581/test.rs +++ /dev/null @@ -1,18 +0,0 @@ -#[link(name = "test", kind = "static")] -extern "C" { - fn slice_len(s: &[u8]) -> usize; - fn slice_elem(s: &[u8], idx: usize) -> u8; -} - -fn main() { - let data = [1, 2, 3, 4, 5]; - - unsafe { - assert_eq!(data.len(), slice_len(&data) as usize); - assert_eq!(data[0], slice_elem(&data, 0)); - assert_eq!(data[1], slice_elem(&data, 1)); - assert_eq!(data[2], slice_elem(&data, 2)); - assert_eq!(data[3], slice_elem(&data, 3)); - assert_eq!(data[4], slice_elem(&data, 4)); - } -} diff --git a/tests/run-make-fulldeps/issue-26006/Makefile b/tests/run-make-fulldeps/issue-26006/Makefile deleted file mode 100644 index 0ff073020..000000000 --- a/tests/run-make-fulldeps/issue-26006/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -include ../tools.mk - -# ignore-windows - -OUT := $(TMPDIR)/out - -all: time - -time: libc - mkdir -p $(OUT)/time $(OUT)/time/deps - ln -sf $(OUT)/libc/liblibc.rlib $(OUT)/time/deps/ - $(RUSTC) in/time/lib.rs -Ldependency=$(OUT)/time/deps/ - -libc: - mkdir -p $(OUT)/libc - $(RUSTC) in/libc/lib.rs --crate-name=libc -Cmetadata=foo -o $(OUT)/libc/liblibc.rlib diff --git a/tests/run-make-fulldeps/issue-26006/in/libc/lib.rs b/tests/run-make-fulldeps/issue-26006/in/libc/lib.rs deleted file mode 100644 index 23f2bf518..000000000 --- a/tests/run-make-fulldeps/issue-26006/in/libc/lib.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type="rlib"] - -pub fn something(){} diff --git a/tests/run-make-fulldeps/issue-26006/in/time/lib.rs b/tests/run-make-fulldeps/issue-26006/in/time/lib.rs deleted file mode 100644 index 87f2f824a..000000000 --- a/tests/run-make-fulldeps/issue-26006/in/time/lib.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![feature(rustc_private)] -extern crate libc; - -fn main(){} diff --git a/tests/run-make-fulldeps/issue-26092/Makefile b/tests/run-make-fulldeps/issue-26092/Makefile deleted file mode 100644 index 96822e769..000000000 --- a/tests/run-make-fulldeps/issue-26092/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -# This test ensures that rustc does not panic with `-o ""` option. - -all: - $(RUSTC) -o "" blank.rs 2>&1 | $(CGREP) -i 'panic' && exit 1 || exit 0 diff --git a/tests/run-make-fulldeps/issue-26092/blank.rs b/tests/run-make-fulldeps/issue-26092/blank.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/tests/run-make-fulldeps/issue-26092/blank.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/issue-28595/Makefile b/tests/run-make-fulldeps/issue-28595/Makefile deleted file mode 100644 index 30a1d9c56..000000000 --- a/tests/run-make-fulldeps/issue-28595/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,a) $(call NATIVE_STATICLIB,b) - $(RUSTC) a.rs - $(RUSTC) b.rs - $(call RUN,b) diff --git a/tests/run-make-fulldeps/issue-28595/a.c b/tests/run-make-fulldeps/issue-28595/a.c deleted file mode 100644 index 7bfd83cca..000000000 --- a/tests/run-make-fulldeps/issue-28595/a.c +++ /dev/null @@ -1 +0,0 @@ -void a(void) {} diff --git a/tests/run-make-fulldeps/issue-28595/a.rs b/tests/run-make-fulldeps/issue-28595/a.rs deleted file mode 100644 index 07863cf64..000000000 --- a/tests/run-make-fulldeps/issue-28595/a.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_type = "rlib"] - -#[link(name = "a", kind = "static")] -extern "C" { - pub fn a(); -} diff --git a/tests/run-make-fulldeps/issue-28595/b.c b/tests/run-make-fulldeps/issue-28595/b.c deleted file mode 100644 index 6aecb5f9e..000000000 --- a/tests/run-make-fulldeps/issue-28595/b.c +++ /dev/null @@ -1,5 +0,0 @@ -extern void a(void); - -void b(void) { - a(); -} diff --git a/tests/run-make-fulldeps/issue-28595/b.rs b/tests/run-make-fulldeps/issue-28595/b.rs deleted file mode 100644 index 1f389859f..000000000 --- a/tests/run-make-fulldeps/issue-28595/b.rs +++ /dev/null @@ -1,12 +0,0 @@ -extern crate a; - -#[link(name = "b", kind = "static")] -extern "C" { - pub fn b(); -} - -fn main() { - unsafe { - b(); - } -} diff --git a/tests/run-make-fulldeps/issue-28766/Makefile b/tests/run-make-fulldeps/issue-28766/Makefile deleted file mode 100644 index 96d0bdc2b..000000000 --- a/tests/run-make-fulldeps/issue-28766/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) -O foo.rs - $(RUSTC) -O -L $(TMPDIR) main.rs diff --git a/tests/run-make-fulldeps/issue-28766/foo.rs b/tests/run-make-fulldeps/issue-28766/foo.rs deleted file mode 100644 index 1dcabe42d..000000000 --- a/tests/run-make-fulldeps/issue-28766/foo.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![crate_type="lib"] -pub struct Foo(()); - -impl Foo { - pub fn new() -> Foo { - Foo(()) - } -} diff --git a/tests/run-make-fulldeps/issue-28766/main.rs b/tests/run-make-fulldeps/issue-28766/main.rs deleted file mode 100644 index de12b1fd9..000000000 --- a/tests/run-make-fulldeps/issue-28766/main.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![crate_type="lib"] -extern crate foo; -use foo::Foo; - -pub fn crash() -> Box { - Box::new(Foo::new()) -} diff --git a/tests/run-make-fulldeps/issue-30063/Makefile b/tests/run-make-fulldeps/issue-30063/Makefile deleted file mode 100644 index e4ede598f..000000000 --- a/tests/run-make-fulldeps/issue-30063/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -include ../tools.mk - -all: - rm -f $(TMPDIR)/foo-output - $(RUSTC) -C codegen-units=4 -o $(TMPDIR)/foo-output foo.rs - rm $(TMPDIR)/foo-output - - rm -f $(TMPDIR)/asm-output - $(RUSTC) -C codegen-units=4 --emit=asm -o $(TMPDIR)/asm-output foo.rs - rm $(TMPDIR)/asm-output - - rm -f $(TMPDIR)/bc-output - $(RUSTC) -C codegen-units=4 --emit=llvm-bc -o $(TMPDIR)/bc-output foo.rs - rm $(TMPDIR)/bc-output - - rm -f $(TMPDIR)/ir-output - $(RUSTC) -C codegen-units=4 --emit=llvm-ir -o $(TMPDIR)/ir-output foo.rs - rm $(TMPDIR)/ir-output - - rm -f $(TMPDIR)/link-output - $(RUSTC) -C codegen-units=4 --emit=link -o $(TMPDIR)/link-output foo.rs - rm $(TMPDIR)/link-output - - rm -f $(TMPDIR)/obj-output - $(RUSTC) -C codegen-units=4 --emit=obj -o $(TMPDIR)/obj-output foo.rs - rm $(TMPDIR)/obj-output - - rm -f $(TMPDIR)/dep-output - $(RUSTC) -C codegen-units=4 --emit=dep-info -o $(TMPDIR)/dep-output foo.rs - rm $(TMPDIR)/dep-output - -# # (This case doesn't work yet, and may be fundamentally wrong-headed anyway.) -# rm -f $(TMPDIR)/multi-output -# $(RUSTC) -C codegen-units=4 --emit=asm,obj -o $(TMPDIR)/multi-output foo.rs -# rm $(TMPDIR)/multi-output diff --git a/tests/run-make-fulldeps/issue-30063/foo.rs b/tests/run-make-fulldeps/issue-30063/foo.rs deleted file mode 100644 index 45590d86b..000000000 --- a/tests/run-make-fulldeps/issue-30063/foo.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() { } diff --git a/tests/run-make-fulldeps/issue-33329/Makefile b/tests/run-make-fulldeps/issue-33329/Makefile deleted file mode 100644 index 9c149440d..000000000 --- a/tests/run-make-fulldeps/issue-33329/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --target x86_64_unknown-linux-musl main.rs 2>&1 | $(CGREP) \ - "error: Error loading target specification: Could not find specification for target" diff --git a/tests/run-make-fulldeps/issue-33329/main.rs b/tests/run-make-fulldeps/issue-33329/main.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/tests/run-make-fulldeps/issue-33329/main.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/issue-35164/Makefile b/tests/run-make-fulldeps/issue-35164/Makefile deleted file mode 100644 index 38aa6f126..000000000 --- a/tests/run-make-fulldeps/issue-35164/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) main.rs --error-format json 2>&1 | $(CGREP) -e '"byte_start":23\b' '"byte_end":29\b' diff --git a/tests/run-make-fulldeps/issue-35164/main.rs b/tests/run-make-fulldeps/issue-35164/main.rs deleted file mode 100644 index 1333d6322..000000000 --- a/tests/run-make-fulldeps/issue-35164/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -mod submodule; - -fn main() { - submodule::foo(); -} diff --git a/tests/run-make-fulldeps/issue-35164/submodule/mod.rs b/tests/run-make-fulldeps/issue-35164/submodule/mod.rs deleted file mode 100644 index a9045b242..000000000 --- a/tests/run-make-fulldeps/issue-35164/submodule/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub fn foo() { - let _MyFoo = 2; -} diff --git a/tests/run-make-fulldeps/issue-37839/Makefile b/tests/run-make-fulldeps/issue-37839/Makefile deleted file mode 100644 index de50bd713..000000000 --- a/tests/run-make-fulldeps/issue-37839/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) a.rs && $(RUSTC) b.rs - $(BARE_RUSTC) c.rs -L dependency=$(TMPDIR) --extern b=$(TMPDIR)/libb.rlib \ - --out-dir=$(TMPDIR) diff --git a/tests/run-make-fulldeps/issue-37839/a.rs b/tests/run-make-fulldeps/issue-37839/a.rs deleted file mode 100644 index b5dffac3f..000000000 --- a/tests/run-make-fulldeps/issue-37839/a.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![allow(unused)] -#![crate_type = "proc-macro"] diff --git a/tests/run-make-fulldeps/issue-37839/b.rs b/tests/run-make-fulldeps/issue-37839/b.rs deleted file mode 100644 index 355d2b165..000000000 --- a/tests/run-make-fulldeps/issue-37839/b.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "lib"] -#[macro_use] extern crate a; diff --git a/tests/run-make-fulldeps/issue-37839/c.rs b/tests/run-make-fulldeps/issue-37839/c.rs deleted file mode 100644 index 4c7ce01b6..000000000 --- a/tests/run-make-fulldeps/issue-37839/c.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "lib"] -extern crate b; diff --git a/tests/run-make-fulldeps/issue-37893/Makefile b/tests/run-make-fulldeps/issue-37893/Makefile deleted file mode 100644 index 33a60830e..000000000 --- a/tests/run-make-fulldeps/issue-37893/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) a.rs && $(RUSTC) b.rs && $(RUSTC) c.rs diff --git a/tests/run-make-fulldeps/issue-37893/a.rs b/tests/run-make-fulldeps/issue-37893/a.rs deleted file mode 100644 index b5dffac3f..000000000 --- a/tests/run-make-fulldeps/issue-37893/a.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![allow(unused)] -#![crate_type = "proc-macro"] diff --git a/tests/run-make-fulldeps/issue-37893/b.rs b/tests/run-make-fulldeps/issue-37893/b.rs deleted file mode 100644 index 355d2b165..000000000 --- a/tests/run-make-fulldeps/issue-37893/b.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "lib"] -#[macro_use] extern crate a; diff --git a/tests/run-make-fulldeps/issue-37893/c.rs b/tests/run-make-fulldeps/issue-37893/c.rs deleted file mode 100644 index b9c215572..000000000 --- a/tests/run-make-fulldeps/issue-37893/c.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type = "staticlib"] -extern crate b; -extern crate a; diff --git a/tests/run-make-fulldeps/issue-38237/Makefile b/tests/run-make-fulldeps/issue-38237/Makefile deleted file mode 100644 index 75121d040..000000000 --- a/tests/run-make-fulldeps/issue-38237/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs; $(RUSTC) bar.rs - $(RUSTDOC) baz.rs -L $(TMPDIR) -o $(TMPDIR) diff --git a/tests/run-make-fulldeps/issue-38237/bar.rs b/tests/run-make-fulldeps/issue-38237/bar.rs deleted file mode 100644 index 2b839f3a3..000000000 --- a/tests/run-make-fulldeps/issue-38237/bar.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "lib"] - -#[derive(Debug)] -pub struct S; diff --git a/tests/run-make-fulldeps/issue-38237/baz.rs b/tests/run-make-fulldeps/issue-38237/baz.rs deleted file mode 100644 index cd2425f9b..000000000 --- a/tests/run-make-fulldeps/issue-38237/baz.rs +++ /dev/null @@ -1,8 +0,0 @@ -extern crate foo; -extern crate bar; - -pub struct Bar; -impl ::std::ops::Deref for Bar { - type Target = bar::S; - fn deref(&self) -> &Self::Target { unimplemented!() } -} diff --git a/tests/run-make-fulldeps/issue-38237/foo.rs b/tests/run-make-fulldeps/issue-38237/foo.rs deleted file mode 100644 index a106e4fde..000000000 --- a/tests/run-make-fulldeps/issue-38237/foo.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -#[proc_macro_derive(A)] -pub fn derive(ts: proc_macro::TokenStream) -> proc_macro::TokenStream { ts } - -#[derive(Debug)] -struct S; diff --git a/tests/run-make-fulldeps/issue-40535/Makefile b/tests/run-make-fulldeps/issue-40535/Makefile deleted file mode 100644 index 155c88252..000000000 --- a/tests/run-make-fulldeps/issue-40535/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -include ../tools.mk - -# The ICE occurred in the following situation: -# * `foo` declares `extern crate bar, baz`, depends only on `bar` (forgetting `baz` in `Cargo.toml`) -# * `bar` declares and depends on `extern crate baz` -# * All crates built in metadata-only mode (`cargo check`) -all: - # cc https://github.com/rust-lang/rust/issues/40623 - $(RUSTC) baz.rs --emit=metadata - $(RUSTC) bar.rs --emit=metadata --extern baz=$(TMPDIR)/libbaz.rmeta - $(RUSTC) foo.rs --emit=metadata --extern bar=$(TMPDIR)/libbar.rmeta 2>&1 | \ - $(CGREP) -v "unexpectedly panicked" - # ^ Succeeds if it doesn't find the ICE message diff --git a/tests/run-make-fulldeps/issue-40535/bar.rs b/tests/run-make-fulldeps/issue-40535/bar.rs deleted file mode 100644 index b02b28f59..000000000 --- a/tests/run-make-fulldeps/issue-40535/bar.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type = "lib"] - -extern crate baz; diff --git a/tests/run-make-fulldeps/issue-40535/baz.rs b/tests/run-make-fulldeps/issue-40535/baz.rs deleted file mode 100644 index 83be6e807..000000000 --- a/tests/run-make-fulldeps/issue-40535/baz.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "lib"] diff --git a/tests/run-make-fulldeps/issue-40535/foo.rs b/tests/run-make-fulldeps/issue-40535/foo.rs deleted file mode 100644 index 270202664..000000000 --- a/tests/run-make-fulldeps/issue-40535/foo.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "lib"] - -extern crate bar; -extern crate baz; diff --git a/tests/run-make-fulldeps/issue-46239/Makefile b/tests/run-make-fulldeps/issue-46239/Makefile deleted file mode 100644 index a93ef3212..000000000 --- a/tests/run-make-fulldeps/issue-46239/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) main.rs -C opt-level=1 - $(call RUN,main) diff --git a/tests/run-make-fulldeps/issue-46239/main.rs b/tests/run-make-fulldeps/issue-46239/main.rs deleted file mode 100644 index b7df5cf4d..000000000 --- a/tests/run-make-fulldeps/issue-46239/main.rs +++ /dev/null @@ -1,8 +0,0 @@ -fn project(x: &(T,)) -> &T { &x.0 } - -fn dummy() {} - -fn main() { - let f = (dummy as fn(),); - (*project(&f))(); -} diff --git a/tests/run-make-fulldeps/issue-47551/Makefile b/tests/run-make-fulldeps/issue-47551/Makefile deleted file mode 100644 index 5a6ac7257..000000000 --- a/tests/run-make-fulldeps/issue-47551/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# only-linux -# ignore-32bit - -include ../tools.mk - -all: - $(RUSTC) eh_frame-terminator.rs - $(call RUN,eh_frame-terminator) | $(CGREP) '1122334455667788' - objdump --dwarf=frames $(TMPDIR)/eh_frame-terminator | $(CGREP) 'ZERO terminator' diff --git a/tests/run-make-fulldeps/issue-47551/eh_frame-terminator.rs b/tests/run-make-fulldeps/issue-47551/eh_frame-terminator.rs deleted file mode 100644 index a2c7a31b7..000000000 --- a/tests/run-make-fulldeps/issue-47551/eh_frame-terminator.rs +++ /dev/null @@ -1,22 +0,0 @@ -// run-pass - -#[derive(Clone, Copy)] -struct Foo { - array: [u64; 10240], -} - -impl Foo { - const fn new() -> Self { - Self { - array: [0x1122_3344_5566_7788; 10240] - } - } -} - -static BAR: [Foo; 10240] = [Foo::new(); 10240]; - -fn main() { - let bt = std::backtrace::Backtrace::force_capture(); - println!("Hello, world! {:?}", bt); - println!("{:x}", BAR[0].array[0]); -} diff --git a/tests/run-make-fulldeps/issue-51671/Makefile b/tests/run-make-fulldeps/issue-51671/Makefile deleted file mode 100644 index c93645369..000000000 --- a/tests/run-make-fulldeps/issue-51671/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -# ignore-windows-msvc - -all: - $(RUSTC) --emit=obj app.rs - nm $(TMPDIR)/app.o | $(CGREP) rust_begin_unwind - nm $(TMPDIR)/app.o | $(CGREP) rust_eh_personality - nm $(TMPDIR)/app.o | $(CGREP) __rg_oom diff --git a/tests/run-make-fulldeps/issue-51671/app.rs b/tests/run-make-fulldeps/issue-51671/app.rs deleted file mode 100644 index e9dc1e974..000000000 --- a/tests/run-make-fulldeps/issue-51671/app.rs +++ /dev/null @@ -1,20 +0,0 @@ -#![crate_type = "bin"] -#![feature(lang_items, alloc_error_handler)] -#![no_main] -#![no_std] - -use core::alloc::Layout; -use core::panic::PanicInfo; - -#[panic_handler] -fn panic(_: &PanicInfo) -> ! { - loop {} -} - -#[lang = "eh_personality"] -fn eh() {} - -#[alloc_error_handler] -fn oom(_: Layout) -> ! { - loop {} -} diff --git a/tests/run-make-fulldeps/issue-53964/Makefile b/tests/run-make-fulldeps/issue-53964/Makefile deleted file mode 100644 index 6bd830213..000000000 --- a/tests/run-make-fulldeps/issue-53964/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) panic.rs - $(RUSTC) -C panic=abort --emit=obj app.rs -L $(TMPDIR) diff --git a/tests/run-make-fulldeps/issue-53964/app.rs b/tests/run-make-fulldeps/issue-53964/app.rs deleted file mode 100644 index 8127b9578..000000000 --- a/tests/run-make-fulldeps/issue-53964/app.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![crate_type = "bin"] -#![no_main] -#![no_std] - -#![deny(unused_extern_crates)] - -// `panic` provides a `panic_handler` so it shouldn't trip the `unused_extern_crates` lint -extern crate panic; diff --git a/tests/run-make-fulldeps/issue-53964/panic.rs b/tests/run-make-fulldeps/issue-53964/panic.rs deleted file mode 100644 index a87812050..000000000 --- a/tests/run-make-fulldeps/issue-53964/panic.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![crate_type = "lib"] -#![feature(panic_handler)] -#![no_std] - -use core::panic::PanicInfo; - -#[panic_handler] -fn panic(_: &PanicInfo) -> ! { - loop {} -} diff --git a/tests/run-make-fulldeps/issue-64153/Makefile b/tests/run-make-fulldeps/issue-64153/Makefile deleted file mode 100644 index f42ea620f..000000000 --- a/tests/run-make-fulldeps/issue-64153/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -include ../tools.mk - -# `llvm-objdump`'s output looks different on windows than on other platforms. -# It should be enough to check on Unix platforms, so: -# ignore-windows - -# Staticlibs don't include Rust object files from upstream crates if the same -# code was already pulled into the lib via LTO. However, the bug described in -# https://github.com/rust-lang/rust/issues/64153 lead to this exclusion not -# working properly if the upstream crate was compiled with an explicit filename -# (via `-o`). -# -# This test makes sure that functions defined in the upstream crates do not -# appear twice in the final staticlib when listing all the symbols from it. - -all: - $(RUSTC) --crate-type rlib upstream.rs -o $(TMPDIR)/libupstream.rlib -Ccodegen-units=1 - $(RUSTC) --crate-type staticlib downstream.rs -Clto -Ccodegen-units=1 -o $(TMPDIR)/libdownstream.a - # Dump all the symbols from the staticlib into `syms` - "$(LLVM_BIN_DIR)"/llvm-objdump -t $(TMPDIR)/libdownstream.a > $(TMPDIR)/syms - # Count the global instances of `issue64153_test_function`. There'll be 2 - # if the `upstream` object file got erroneously included twice. - # The line we are testing for with the regex looks something like: - # 0000000000000000 g F .text.issue64153_test_function 00000023 issue64153_test_function - grep -c -e "[[:space:]]g[[:space:]]*F[[:space:]].*issue64153_test_function" $(TMPDIR)/syms > $(TMPDIR)/count - [ "$$(cat $(TMPDIR)/count)" -eq "1" ] diff --git a/tests/run-make-fulldeps/issue-64153/downstream.rs b/tests/run-make-fulldeps/issue-64153/downstream.rs deleted file mode 100644 index e03704665..000000000 --- a/tests/run-make-fulldeps/issue-64153/downstream.rs +++ /dev/null @@ -1,6 +0,0 @@ -extern crate upstream; - -#[no_mangle] -pub extern "C" fn foo() { - print!("1 + 1 = {}", upstream::issue64153_test_function(1)); -} diff --git a/tests/run-make-fulldeps/issue-64153/upstream.rs b/tests/run-make-fulldeps/issue-64153/upstream.rs deleted file mode 100644 index 861a00298..000000000 --- a/tests/run-make-fulldeps/issue-64153/upstream.rs +++ /dev/null @@ -1,6 +0,0 @@ -// Make this function extern "C", public, and no-mangle, so that it gets -// exported from the downstream staticlib. -#[no_mangle] -pub extern "C" fn issue64153_test_function(x: u32) -> u32 { - x + 1 -} diff --git a/tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/Makefile b/tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/Makefile deleted file mode 100644 index 13983f4ff..000000000 --- a/tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# Regression test for issue #68794 -# -# Verify that no text relocations are accidentally introduced by linking a -# minimal rust staticlib. -# -# The test links a rust static library into a shared library, and checks that -# the linker doesn't have to flag the resulting file as containing TEXTRELs. - -include ../tools.mk - -# only-linux - -all: - $(RUSTC) foo.rs - $(CC) bar.c $(call STATICLIB,foo) -fPIC -shared -o $(call DYLIB,bar) \ - $(EXTRACFLAGS) $(EXTRACXXFLAGS) - readelf -d $(call DYLIB,bar) | grep TEXTREL; test $$? -eq 1 diff --git a/tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/bar.c b/tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/bar.c deleted file mode 100644 index bb4036b06..000000000 --- a/tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/bar.c +++ /dev/null @@ -1,6 +0,0 @@ -void foo(); - -int main() { - foo(); - return 0; -} diff --git a/tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/foo.rs b/tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/foo.rs deleted file mode 100644 index a3e865b63..000000000 --- a/tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/foo.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![crate_type = "staticlib"] - -#[no_mangle] -pub extern "C" fn foo(x: u32) { - // using the println! makes it so that enough code from the standard - // library is included (see issue #68794) - println!("foo: {}", x); -} diff --git a/tests/run-make-fulldeps/issue-69368/Makefile b/tests/run-make-fulldeps/issue-69368/Makefile deleted file mode 100644 index 41770475d..000000000 --- a/tests/run-make-fulldeps/issue-69368/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -include ../tools.mk - -# Test that previously triggered a linker failure with root cause -# similar to one found in the issue #69368. -# -# The crate that provides oom lang item is missing some other lang -# items. Necessary to prevent the use of start-group / end-group. -# -# The weak lang items are defined in a separate compilation units, -# so that linker could omit them if not used. -# -# The crates that need those weak lang items are dependencies of -# crates that provide them. - -all: - $(RUSTC) a.rs - $(RUSTC) b.rs - $(RUSTC) c.rs diff --git a/tests/run-make-fulldeps/issue-69368/a.rs b/tests/run-make-fulldeps/issue-69368/a.rs deleted file mode 100644 index a54f42955..000000000 --- a/tests/run-make-fulldeps/issue-69368/a.rs +++ /dev/null @@ -1,26 +0,0 @@ -#![crate_type = "rlib"] -#![feature(lang_items)] -#![feature(panic_unwind)] -#![no_std] - -extern crate panic_unwind; - -#[panic_handler] -pub fn panic_handler(_: &core::panic::PanicInfo) -> ! { - loop {} -} - -#[no_mangle] -extern "C" fn __rust_drop_panic() -> ! { - loop {} -} - -#[no_mangle] -extern "C" fn __rust_foreign_exception() -> ! { - loop {} -} - -#[lang = "eh_personality"] -fn eh_personality() { - loop {} -} diff --git a/tests/run-make-fulldeps/issue-69368/b.rs b/tests/run-make-fulldeps/issue-69368/b.rs deleted file mode 100644 index 4d6af0266..000000000 --- a/tests/run-make-fulldeps/issue-69368/b.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![crate_type = "rlib"] -#![feature(alloc_error_handler)] -#![no_std] - -#[alloc_error_handler] -pub fn error_handler(_: core::alloc::Layout) -> ! { - panic!(); -} diff --git a/tests/run-make-fulldeps/issue-69368/c.rs b/tests/run-make-fulldeps/issue-69368/c.rs deleted file mode 100644 index 729c4249a..000000000 --- a/tests/run-make-fulldeps/issue-69368/c.rs +++ /dev/null @@ -1,34 +0,0 @@ -#![crate_type = "bin"] -#![feature(start)] -#![no_std] - -extern crate alloc; -extern crate a; -extern crate b; - -use alloc::vec::Vec; -use core::alloc::*; - -struct Allocator; - -unsafe impl GlobalAlloc for Allocator { - unsafe fn alloc(&self, _: Layout) -> *mut u8 { - loop {} - } - - unsafe fn dealloc(&self, _: *mut u8, _: Layout) { - loop {} - } -} - -#[global_allocator] -static ALLOCATOR: Allocator = Allocator; - -#[start] -fn main(argc: isize, _argv: *const *const u8) -> isize { - let mut v = Vec::new(); - for i in 0..argc { - v.push(i); - } - v.iter().sum() -} diff --git a/tests/run-make-fulldeps/issue-7349/Makefile b/tests/run-make-fulldeps/issue-7349/Makefile deleted file mode 100644 index dc073b77f..000000000 --- a/tests/run-make-fulldeps/issue-7349/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include ../tools.mk - -# Test to make sure that inner functions within a polymorphic outer function -# don't get re-codegened when the outer function is monomorphized. The test -# code monomorphizes the outer functions several times, but the magic constants -# used in the inner functions should each appear only once in the generated IR. - -all: - $(RUSTC) foo.rs --emit=llvm-ir - [ "$$(grep -c 'ret i32 8675309' "$(TMPDIR)/foo.ll")" -eq "1" ] - [ "$$(grep -c 'ret i32 11235813' "$(TMPDIR)/foo.ll")" -eq "1" ] diff --git a/tests/run-make-fulldeps/issue-7349/foo.rs b/tests/run-make-fulldeps/issue-7349/foo.rs deleted file mode 100644 index 246a12595..000000000 --- a/tests/run-make-fulldeps/issue-7349/foo.rs +++ /dev/null @@ -1,22 +0,0 @@ -fn outer() { - #[allow(dead_code)] - fn inner() -> u32 { - 8675309 - } - inner(); -} - -extern "C" fn outer_foreign() { - #[allow(dead_code)] - fn inner() -> u32 { - 11235813 - } - inner(); -} - -fn main() { - outer::(); - outer::(); - outer_foreign::(); - outer_foreign::(); -} diff --git a/tests/run-make-fulldeps/issue-83045/Makefile b/tests/run-make-fulldeps/issue-83045/Makefile deleted file mode 100644 index 34853cb1d..000000000 --- a/tests/run-make-fulldeps/issue-83045/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -include ../../run-make-fulldeps/tools.mk - -# This test case creates a situation where the crate loader would run -# into an ICE when confronted with an invalid setup where it cannot -# find the dependency of a direct dependency. -# -# The test case makes sure that the compiler produces the expected -# error message but does not ICE immediately after. -# -# See https://github.com/rust-lang/rust/issues/83045 - -# This is a platform-independent issue, no need to waste time testing -# everywhere. -# only-x86_64 -# only-linux - -# NOTE: We use BARE_RUSTC below so that the compiler can't find liba.rlib -# If we used RUSTC the additional '-L TMPDIR' option would allow rustc to -# actually find the crate. -# -# We check that we get the expected error message -# But that we do not get an ICE - -all: - $(RUSTC) --crate-name=a --crate-type=rlib a.rs --verbose - $(RUSTC) --crate-name=b --crate-type=rlib --extern a=$(TMPDIR)/liba.rlib b.rs --verbose - $(BARE_RUSTC) --out-dir $(TMPDIR) \ - --extern b=$(TMPDIR)/libb.rlib \ - --crate-type=rlib \ - --edition=2018 \ - c.rs 2>&1 | tee $(TMPDIR)/output.txt || exit 0 - $(CGREP) E0463 < $(TMPDIR)/output.txt - $(CGREP) -v "internal compiler error" < $(TMPDIR)/output.txt diff --git a/tests/run-make-fulldeps/issue-83045/a.rs b/tests/run-make-fulldeps/issue-83045/a.rs deleted file mode 100644 index 66d9f758e..000000000 --- a/tests/run-make-fulldeps/issue-83045/a.rs +++ /dev/null @@ -1 +0,0 @@ -// empty on purpose diff --git a/tests/run-make-fulldeps/issue-83045/b.rs b/tests/run-make-fulldeps/issue-83045/b.rs deleted file mode 100644 index f4876cfa4..000000000 --- a/tests/run-make-fulldeps/issue-83045/b.rs +++ /dev/null @@ -1 +0,0 @@ -extern crate a; diff --git a/tests/run-make-fulldeps/issue-83045/c.rs b/tests/run-make-fulldeps/issue-83045/c.rs deleted file mode 100644 index e0c452549..000000000 --- a/tests/run-make-fulldeps/issue-83045/c.rs +++ /dev/null @@ -1 +0,0 @@ -use b as _; diff --git a/tests/run-make-fulldeps/issue-84395-lto-embed-bitcode/Makefile b/tests/run-make-fulldeps/issue-84395-lto-embed-bitcode/Makefile deleted file mode 100644 index 879ce1743..000000000 --- a/tests/run-make-fulldeps/issue-84395-lto-embed-bitcode/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# needs-matching-clang - -# This test makes sure the embed bitcode in elf created with -# lto-embed-bitcode=optimized is valid llvm BC module. - -include ../../run-make-fulldeps/tools.mk - -all: - $(RUSTC) test.rs --target $(TARGET) -Clink-arg=-fuse-ld=lld -Clinker-plugin-lto -Clinker=$(CLANG) -Clink-arg=-Wl,--plugin-opt=-lto-embed-bitcode=optimized -Zemit-thin-lto=no - $(LLVM_BIN_DIR)/objcopy --dump-section .llvmbc=$(TMPDIR)/test.bc $(TMPDIR)/test - $(LLVM_BIN_DIR)/llvm-dis $(TMPDIR)/test.bc diff --git a/tests/run-make-fulldeps/issue-84395-lto-embed-bitcode/test.rs b/tests/run-make-fulldeps/issue-84395-lto-embed-bitcode/test.rs deleted file mode 100644 index 47ad8c634..000000000 --- a/tests/run-make-fulldeps/issue-84395-lto-embed-bitcode/test.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello World!"); -} diff --git a/tests/run-make-fulldeps/issue-97463-abi-param-passing/Makefile b/tests/run-make-fulldeps/issue-97463-abi-param-passing/Makefile deleted file mode 100644 index db1b53e15..000000000 --- a/tests/run-make-fulldeps/issue-97463-abi-param-passing/Makefile +++ /dev/null @@ -1,14 +0,0 @@ --include ../tools.mk - -# ignore-msvc - -# The issue exercised by this test, rust-lang/rust#97463, explicitly needs `-O` -# flags (like `-O3`) to reproduce. Thus, we call $(CC) instead of nicer -# alternatives provided by tools.mk like using `COMPILE_OBJ` or using a -# `NATIVE_STATICLIB` dependency. - -all: - $(CC) -c -O3 -o $(TMPDIR)/bad.o bad.c - $(AR) rcs $(TMPDIR)/libbad.a $(TMPDIR)/bad.o - $(RUSTC) param_passing.rs -L$(TMPDIR) -lbad -C opt-level=3 - $(call RUN,param_passing) diff --git a/tests/run-make-fulldeps/issue-97463-abi-param-passing/bad.c b/tests/run-make-fulldeps/issue-97463-abi-param-passing/bad.c deleted file mode 100644 index 013314ab2..000000000 --- a/tests/run-make-fulldeps/issue-97463-abi-param-passing/bad.c +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include -#include - - -struct bloc { - uint16_t a; - uint16_t b; - uint16_t c; -}; - -uint16_t c_read_value(uint32_t a, uint32_t b, uint32_t c) { - struct bloc *data = malloc(sizeof(struct bloc)); - - data->a = a & 0xFFFF; - data->b = b & 0xFFFF; - data->c = c & 0xFFFF; - - printf("C struct: a = %u, b = %u, c = %u\n", - (unsigned) data->a, (unsigned) data->b, (unsigned) data->c); - printf("C function returns %u\n", (unsigned) data->b); - - return data->b; /* leak data */ -} diff --git a/tests/run-make-fulldeps/issue-97463-abi-param-passing/param_passing.rs b/tests/run-make-fulldeps/issue-97463-abi-param-passing/param_passing.rs deleted file mode 100644 index c11f3cc72..000000000 --- a/tests/run-make-fulldeps/issue-97463-abi-param-passing/param_passing.rs +++ /dev/null @@ -1,38 +0,0 @@ -// NOTE: Exposing the bug encoded in this test is sensitive to -// LLVM optimization choices. See additional note below for an -// example. - -#[link(name = "bad")] -extern "C" { - pub fn c_read_value(a: u32, b: u32, c: u32) -> u16; -} - -fn main() { - const C1: usize = 0x327b23c6; - const C2: usize = C1 & 0xFFFF; - - let r1: usize = 0x0; - let r2: usize = C1; - let r3: usize = 0x0; - let value: u16 = unsafe { c_read_value(r1 as u32, r2 as u32, r3 as u32) }; - - // NOTE: as an example of the sensitivity of this test to optimization choices, - // uncommenting this block of code makes the bug go away on pnkfelix's machine. - // (But observing via `dbg!` doesn't hide the bug. At least sometimes.) - /* - println!("{}", value); - println!("{}", value as usize); - println!("{}", usize::from(value)); - println!("{}", (value as usize) & 0xFFFF); - */ - - let d1 = value; - let d2 = value as usize; - let d3 = usize::from(value); - let d4 = (value as usize) & 0xFFFF; - - let d = (&d1, &d2, &d3, &d4); - let d_ = (d1, d2, d3, d4); - - assert_eq!(((&(C2 as u16), &C2, &C2, &C2), (C2 as u16, C2, C2, C2)), (d, d_)); -} diff --git a/tests/run-make-fulldeps/issue64319/Makefile b/tests/run-make-fulldeps/issue64319/Makefile deleted file mode 100644 index ee0d177ab..000000000 --- a/tests/run-make-fulldeps/issue64319/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -include ../../run-make-fulldeps/tools.mk - -# Different optimization levels imply different values for `-Zshare-generics`, -# so try out a whole bunch of combinations to make sure everything is compatible -all: - # First up, try some defaults - $(RUSTC) --crate-type rlib foo.rs - $(RUSTC) --crate-type dylib bar.rs -C opt-level=3 - - # Next try mixing up some things explicitly - $(RUSTC) --crate-type rlib foo.rs -Z share-generics=no - $(RUSTC) --crate-type dylib bar.rs -Z share-generics=no - $(RUSTC) --crate-type rlib foo.rs -Z share-generics=no - $(RUSTC) --crate-type dylib bar.rs -Z share-generics=yes - $(RUSTC) --crate-type rlib foo.rs -Z share-generics=yes - $(RUSTC) --crate-type dylib bar.rs -Z share-generics=no - $(RUSTC) --crate-type rlib foo.rs -Z share-generics=yes - $(RUSTC) --crate-type dylib bar.rs -Z share-generics=yes - - # Now combine a whole bunch of options together - $(RUSTC) --crate-type rlib foo.rs - $(RUSTC) --crate-type dylib bar.rs - $(RUSTC) --crate-type dylib bar.rs -Z share-generics=no - $(RUSTC) --crate-type dylib bar.rs -Z share-generics=yes - $(RUSTC) --crate-type dylib bar.rs -C opt-level=1 - $(RUSTC) --crate-type dylib bar.rs -C opt-level=1 -Z share-generics=no - $(RUSTC) --crate-type dylib bar.rs -C opt-level=1 -Z share-generics=yes - $(RUSTC) --crate-type dylib bar.rs -C opt-level=2 - $(RUSTC) --crate-type dylib bar.rs -C opt-level=2 -Z share-generics=no - $(RUSTC) --crate-type dylib bar.rs -C opt-level=2 -Z share-generics=yes - $(RUSTC) --crate-type dylib bar.rs -C opt-level=3 - $(RUSTC) --crate-type dylib bar.rs -C opt-level=3 -Z share-generics=no - $(RUSTC) --crate-type dylib bar.rs -C opt-level=3 -Z share-generics=yes - $(RUSTC) --crate-type dylib bar.rs -C opt-level=s - $(RUSTC) --crate-type dylib bar.rs -C opt-level=s -Z share-generics=no - $(RUSTC) --crate-type dylib bar.rs -C opt-level=s -Z share-generics=yes - $(RUSTC) --crate-type dylib bar.rs -C opt-level=z - $(RUSTC) --crate-type dylib bar.rs -C opt-level=z -Z share-generics=no - $(RUSTC) --crate-type dylib bar.rs -C opt-level=z -Z share-generics=yes diff --git a/tests/run-make-fulldeps/issue64319/bar.rs b/tests/run-make-fulldeps/issue64319/bar.rs deleted file mode 100644 index 3895c0b6c..000000000 --- a/tests/run-make-fulldeps/issue64319/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate foo; - -pub fn bar() { - foo::foo(); -} diff --git a/tests/run-make-fulldeps/issue64319/foo.rs b/tests/run-make-fulldeps/issue64319/foo.rs deleted file mode 100644 index c54a238e9..000000000 --- a/tests/run-make-fulldeps/issue64319/foo.rs +++ /dev/null @@ -1,9 +0,0 @@ -pub fn foo() { - bar::(); -} - -pub fn bar() { - baz(); -} - -fn baz() {} diff --git a/tests/run-make-fulldeps/libs-through-symlinks/Makefile b/tests/run-make-fulldeps/libs-through-symlinks/Makefile deleted file mode 100644 index 45deaecb8..000000000 --- a/tests/run-make-fulldeps/libs-through-symlinks/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include ../tools.mk - -# ignore-windows - -NAME := $(shell $(RUSTC) --print file-names foo.rs) - -all: - mkdir -p $(TMPDIR)/outdir - $(RUSTC) foo.rs -o $(TMPDIR)/outdir/$(NAME) - ln -nsf outdir/$(NAME) $(TMPDIR) - RUSTC_LOG=rustc_metadata::loader $(RUSTC) bar.rs diff --git a/tests/run-make-fulldeps/libs-through-symlinks/bar.rs b/tests/run-make-fulldeps/libs-through-symlinks/bar.rs deleted file mode 100644 index bb7b36c49..000000000 --- a/tests/run-make-fulldeps/libs-through-symlinks/bar.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate foo; - -fn main() {} diff --git a/tests/run-make-fulldeps/libs-through-symlinks/foo.rs b/tests/run-make-fulldeps/libs-through-symlinks/foo.rs deleted file mode 100644 index 8e3df2c6d..000000000 --- a/tests/run-make-fulldeps/libs-through-symlinks/foo.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "rlib"] -#![crate_name = "foo"] diff --git a/tests/run-make-fulldeps/libtest-json/Makefile b/tests/run-make-fulldeps/libtest-json/Makefile deleted file mode 100644 index 37b6cb9e2..000000000 --- a/tests/run-make-fulldeps/libtest-json/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -include ../tools.mk - -# Test expected libtest's JSON output - -OUTPUT_FILE_DEFAULT := $(TMPDIR)/libtest-json-output-default.json -OUTPUT_FILE_STDOUT_SUCCESS := $(TMPDIR)/libtest-json-output-stdout-success.json - -all: f.rs validate_json.py output-default.json output-stdout-success.json - $(RUSTC) --test f.rs - RUST_BACKTRACE=0 $(call RUN,f) -Z unstable-options --test-threads=1 --format=json > $(OUTPUT_FILE_DEFAULT) || true - RUST_BACKTRACE=0 $(call RUN,f) -Z unstable-options --test-threads=1 --format=json --show-output > $(OUTPUT_FILE_STDOUT_SUCCESS) || true - - cat $(OUTPUT_FILE_DEFAULT) | "$(PYTHON)" validate_json.py - cat $(OUTPUT_FILE_STDOUT_SUCCESS) | "$(PYTHON)" validate_json.py - - # Normalize the actual output and compare to expected output file - cat $(OUTPUT_FILE_DEFAULT) | sed 's/"exec_time": [0-9.]*/"exec_time": $$TIME/' | diff output-default.json - - cat $(OUTPUT_FILE_STDOUT_SUCCESS) | sed 's/"exec_time": [0-9.]*/"exec_time": $$TIME/' | diff output-stdout-success.json - diff --git a/tests/run-make-fulldeps/libtest-json/f.rs b/tests/run-make-fulldeps/libtest-json/f.rs deleted file mode 100644 index edfe25086..000000000 --- a/tests/run-make-fulldeps/libtest-json/f.rs +++ /dev/null @@ -1,22 +0,0 @@ -#[test] -fn a() { - println!("print from successful test"); - // Should pass -} - -#[test] -fn b() { - assert!(false); -} - -#[test] -#[should_panic] -fn c() { - assert!(false); -} - -#[test] -#[ignore = "msg"] -fn d() { - assert!(false); -} diff --git a/tests/run-make-fulldeps/libtest-json/output-default.json b/tests/run-make-fulldeps/libtest-json/output-default.json deleted file mode 100644 index ad22b66ed..000000000 --- a/tests/run-make-fulldeps/libtest-json/output-default.json +++ /dev/null @@ -1,10 +0,0 @@ -{ "type": "suite", "event": "started", "test_count": 4 } -{ "type": "test", "event": "started", "name": "a" } -{ "type": "test", "name": "a", "event": "ok" } -{ "type": "test", "event": "started", "name": "b" } -{ "type": "test", "name": "b", "event": "failed", "stdout": "thread 'b' panicked at 'assertion failed: false', f.rs:9:5\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" } -{ "type": "test", "event": "started", "name": "c" } -{ "type": "test", "name": "c", "event": "ok" } -{ "type": "test", "event": "started", "name": "d" } -{ "type": "test", "name": "d", "event": "ignored", "message": "msg" } -{ "type": "suite", "event": "failed", "passed": 2, "failed": 1, "ignored": 1, "measured": 0, "filtered_out": 0, "exec_time": $TIME } diff --git a/tests/run-make-fulldeps/libtest-json/output-stdout-success.json b/tests/run-make-fulldeps/libtest-json/output-stdout-success.json deleted file mode 100644 index ec98172eb..000000000 --- a/tests/run-make-fulldeps/libtest-json/output-stdout-success.json +++ /dev/null @@ -1,10 +0,0 @@ -{ "type": "suite", "event": "started", "test_count": 4 } -{ "type": "test", "event": "started", "name": "a" } -{ "type": "test", "name": "a", "event": "ok", "stdout": "print from successful test\n" } -{ "type": "test", "event": "started", "name": "b" } -{ "type": "test", "name": "b", "event": "failed", "stdout": "thread 'b' panicked at 'assertion failed: false', f.rs:9:5\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" } -{ "type": "test", "event": "started", "name": "c" } -{ "type": "test", "name": "c", "event": "ok", "stdout": "thread 'c' panicked at 'assertion failed: false', f.rs:15:5\n" } -{ "type": "test", "event": "started", "name": "d" } -{ "type": "test", "name": "d", "event": "ignored", "message": "msg" } -{ "type": "suite", "event": "failed", "passed": 2, "failed": 1, "ignored": 1, "measured": 0, "filtered_out": 0, "exec_time": $TIME } diff --git a/tests/run-make-fulldeps/libtest-json/validate_json.py b/tests/run-make-fulldeps/libtest-json/validate_json.py deleted file mode 100755 index 657f732f2..000000000 --- a/tests/run-make-fulldeps/libtest-json/validate_json.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env python - -import sys -import json - -# Try to decode line in order to ensure it is a valid JSON document -for line in sys.stdin: - json.loads(line) diff --git a/tests/run-make-fulldeps/link-arg/Makefile b/tests/run-make-fulldeps/link-arg/Makefile deleted file mode 100644 index 103527c3e..000000000 --- a/tests/run-make-fulldeps/link-arg/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk -RUSTC_FLAGS = -C link-arg="-lfoo" -C link-arg="-lbar" --print link-args - -all: - $(RUSTC) $(RUSTC_FLAGS) empty.rs | $(CGREP) lfoo lbar diff --git a/tests/run-make-fulldeps/link-arg/empty.rs b/tests/run-make-fulldeps/link-arg/empty.rs deleted file mode 100644 index 45590d86b..000000000 --- a/tests/run-make-fulldeps/link-arg/empty.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() { } diff --git a/tests/run-make-fulldeps/link-args-order/Makefile b/tests/run-make-fulldeps/link-args-order/Makefile deleted file mode 100644 index c562cc1b3..000000000 --- a/tests/run-make-fulldeps/link-args-order/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# ignore-msvc - -include ../tools.mk - -RUSTC_FLAGS = -C linker-flavor=ld -C link-arg=a -C link-args="b c" -C link-args="d e" -C link-arg=f -RUSTC_FLAGS_PRE = -C linker-flavor=ld -Z pre-link-arg=a -Z pre-link-args="b c" -Z pre-link-args="d e" -Z pre-link-arg=f - -all: - $(RUSTC) $(RUSTC_FLAGS) empty.rs 2>&1 | $(CGREP) '"a" "b" "c" "d" "e" "f"' - $(RUSTC) $(RUSTC_FLAGS_PRE) empty.rs 2>&1 | $(CGREP) '"a" "b" "c" "d" "e" "f"' diff --git a/tests/run-make-fulldeps/link-args-order/empty.rs b/tests/run-make-fulldeps/link-args-order/empty.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/tests/run-make-fulldeps/link-args-order/empty.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/link-cfg/Makefile b/tests/run-make-fulldeps/link-cfg/Makefile deleted file mode 100644 index 0b25ccded..000000000 --- a/tests/run-make-fulldeps/link-cfg/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -include ../tools.mk - -all: $(call DYLIB,return1) $(call DYLIB,return2) $(call NATIVE_STATICLIB,return3) - ls $(TMPDIR) - $(BARE_RUSTC) --print cfg --target x86_64-unknown-linux-musl | $(CGREP) crt-static - - $(RUSTC) no-deps.rs --cfg foo - $(call RUN,no-deps) - $(RUSTC) no-deps.rs --cfg bar - $(call RUN,no-deps) - - $(RUSTC) dep.rs - $(RUSTC) with-deps.rs --cfg foo - $(call RUN,with-deps) - $(RUSTC) with-deps.rs --cfg bar - $(call RUN,with-deps) - - $(RUSTC) dep-with-staticlib.rs - $(RUSTC) with-staticlib-deps.rs --cfg foo - $(call RUN,with-staticlib-deps) - $(RUSTC) with-staticlib-deps.rs --cfg bar - $(call RUN,with-staticlib-deps) diff --git a/tests/run-make-fulldeps/link-cfg/dep-with-staticlib.rs b/tests/run-make-fulldeps/link-cfg/dep-with-staticlib.rs deleted file mode 100644 index 5ad66475d..000000000 --- a/tests/run-make-fulldeps/link-cfg/dep-with-staticlib.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![feature(link_cfg)] -#![crate_type = "rlib"] - -#[link(name = "return1", cfg(foo))] -#[link(name = "return3", kind = "static", cfg(bar))] -extern "C" { - pub fn my_function() -> i32; -} diff --git a/tests/run-make-fulldeps/link-cfg/dep.rs b/tests/run-make-fulldeps/link-cfg/dep.rs deleted file mode 100644 index 40de77f05..000000000 --- a/tests/run-make-fulldeps/link-cfg/dep.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![feature(link_cfg)] -#![crate_type = "rlib"] - -#[link(name = "return1", cfg(foo))] -#[link(name = "return2", cfg(bar))] -extern "C" { - pub fn my_function() -> i32; -} diff --git a/tests/run-make-fulldeps/link-cfg/no-deps.rs b/tests/run-make-fulldeps/link-cfg/no-deps.rs deleted file mode 100644 index ba5a8711a..000000000 --- a/tests/run-make-fulldeps/link-cfg/no-deps.rs +++ /dev/null @@ -1,20 +0,0 @@ -#![feature(link_cfg)] - -#[link(name = "return1", cfg(foo))] -#[link(name = "return2", cfg(bar))] -extern "C" { - fn my_function() -> i32; -} - -fn main() { - unsafe { - let v = my_function(); - if cfg!(foo) { - assert_eq!(v, 1); - } else if cfg!(bar) { - assert_eq!(v, 2); - } else { - panic!("unknown"); - } - } -} diff --git a/tests/run-make-fulldeps/link-cfg/return1.c b/tests/run-make-fulldeps/link-cfg/return1.c deleted file mode 100644 index 41c2809ad..000000000 --- a/tests/run-make-fulldeps/link-cfg/return1.c +++ /dev/null @@ -1,6 +0,0 @@ -#ifdef _WIN32 -__declspec(dllexport) -#endif -int my_function() { - return 1; -} diff --git a/tests/run-make-fulldeps/link-cfg/return2.c b/tests/run-make-fulldeps/link-cfg/return2.c deleted file mode 100644 index 622aeaa29..000000000 --- a/tests/run-make-fulldeps/link-cfg/return2.c +++ /dev/null @@ -1,6 +0,0 @@ -#ifdef _WIN32 -__declspec(dllexport) -#endif -int my_function() { - return 2; -} diff --git a/tests/run-make-fulldeps/link-cfg/return3.c b/tests/run-make-fulldeps/link-cfg/return3.c deleted file mode 100644 index f29dc60d5..000000000 --- a/tests/run-make-fulldeps/link-cfg/return3.c +++ /dev/null @@ -1,6 +0,0 @@ -#ifdef _WIN32 -__declspec(dllexport) -#endif -int my_function() { - return 3; -} diff --git a/tests/run-make-fulldeps/link-cfg/with-deps.rs b/tests/run-make-fulldeps/link-cfg/with-deps.rs deleted file mode 100644 index 48b782815..000000000 --- a/tests/run-make-fulldeps/link-cfg/with-deps.rs +++ /dev/null @@ -1,14 +0,0 @@ -extern crate dep; - -fn main() { - unsafe { - let v = dep::my_function(); - if cfg!(foo) { - assert_eq!(v, 1); - } else if cfg!(bar) { - assert_eq!(v, 2); - } else { - panic!("unknown"); - } - } -} diff --git a/tests/run-make-fulldeps/link-cfg/with-staticlib-deps.rs b/tests/run-make-fulldeps/link-cfg/with-staticlib-deps.rs deleted file mode 100644 index 23e5926a7..000000000 --- a/tests/run-make-fulldeps/link-cfg/with-staticlib-deps.rs +++ /dev/null @@ -1,14 +0,0 @@ -extern crate dep_with_staticlib; - -fn main() { - unsafe { - let v = dep_with_staticlib::my_function(); - if cfg!(foo) { - assert_eq!(v, 1); - } else if cfg!(bar) { - assert_eq!(v, 3); - } else { - panic!("unknown"); - } - } -} diff --git a/tests/run-make-fulldeps/link-dedup/Makefile b/tests/run-make-fulldeps/link-dedup/Makefile deleted file mode 100644 index eff18ab48..000000000 --- a/tests/run-make-fulldeps/link-dedup/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# ignore-msvc - -include ../tools.mk - -all: - $(RUSTC) depa.rs - $(RUSTC) depb.rs - $(RUSTC) depc.rs - $(RUSTC) empty.rs --cfg bar 2>&1 | $(CGREP) '"-ltesta" "-ltestb" "-ltesta"' - $(RUSTC) empty.rs 2>&1 | $(CGREP) '"-ltesta"' - $(RUSTC) empty.rs 2>&1 | $(CGREP) -v '"-ltestb"' - $(RUSTC) empty.rs 2>&1 | $(CGREP) -v '"-ltesta" "-ltesta" "-ltesta"' diff --git a/tests/run-make-fulldeps/link-dedup/depa.rs b/tests/run-make-fulldeps/link-dedup/depa.rs deleted file mode 100644 index 19178c5bd..000000000 --- a/tests/run-make-fulldeps/link-dedup/depa.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![crate_type = "rlib"] - -#[link(name = "testa")] -extern "C" {} - -#[link(name = "testa")] -extern "C" {} - -#[link(name = "testa")] -extern "C" {} diff --git a/tests/run-make-fulldeps/link-dedup/depb.rs b/tests/run-make-fulldeps/link-dedup/depb.rs deleted file mode 100644 index b1be21fe0..000000000 --- a/tests/run-make-fulldeps/link-dedup/depb.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![feature(link_cfg)] -#![crate_type = "rlib"] - -#[link(name = "testb", cfg(foo))] -extern "C" {} - -#[link(name = "testb", cfg(bar))] -extern "C" {} diff --git a/tests/run-make-fulldeps/link-dedup/depc.rs b/tests/run-make-fulldeps/link-dedup/depc.rs deleted file mode 100644 index 8dcb3dee5..000000000 --- a/tests/run-make-fulldeps/link-dedup/depc.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "rlib"] - -#[link(name = "testa")] -extern "C" {} diff --git a/tests/run-make-fulldeps/link-dedup/empty.rs b/tests/run-make-fulldeps/link-dedup/empty.rs deleted file mode 100644 index e00ae18f4..000000000 --- a/tests/run-make-fulldeps/link-dedup/empty.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate depa; -extern crate depb; -extern crate depc; - -fn main() {} diff --git a/tests/run-make-fulldeps/link-path-order/Makefile b/tests/run-make-fulldeps/link-path-order/Makefile deleted file mode 100644 index ed7c299e6..000000000 --- a/tests/run-make-fulldeps/link-path-order/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -include ../tools.mk - -# Verifies that the -L arguments given to the linker is in the same order -# as the -L arguments on the rustc command line. - -CORRECT_DIR=$(TMPDIR)/correct -WRONG_DIR=$(TMPDIR)/wrong - -F := $(call NATIVE_STATICLIB_FILE,foo) - -all: $(call NATIVE_STATICLIB,correct) $(call NATIVE_STATICLIB,wrong) - mkdir -p $(CORRECT_DIR) $(WRONG_DIR) - mv $(call NATIVE_STATICLIB,correct) $(CORRECT_DIR)/$(F) - mv $(call NATIVE_STATICLIB,wrong) $(WRONG_DIR)/$(F) - $(RUSTC) main.rs -o $(TMPDIR)/should_succeed -L $(CORRECT_DIR) -L $(WRONG_DIR) - $(call RUN,should_succeed) - $(RUSTC) main.rs -o $(TMPDIR)/should_fail -L $(WRONG_DIR) -L $(CORRECT_DIR) - $(call FAIL,should_fail) diff --git a/tests/run-make-fulldeps/link-path-order/correct.c b/tests/run-make-fulldeps/link-path-order/correct.c deleted file mode 100644 index 3064af952..000000000 --- a/tests/run-make-fulldeps/link-path-order/correct.c +++ /dev/null @@ -1 +0,0 @@ -int should_return_one() { return 1; } diff --git a/tests/run-make-fulldeps/link-path-order/main.rs b/tests/run-make-fulldeps/link-path-order/main.rs deleted file mode 100644 index 8024e343d..000000000 --- a/tests/run-make-fulldeps/link-path-order/main.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![feature(rustc_private)] - -extern crate libc; - -#[link(name = "foo", kind = "static")] -extern "C" { - fn should_return_one() -> libc::c_int; -} - -fn main() { - let result = unsafe { should_return_one() }; - - if result != 1 { - std::process::exit(255); - } -} diff --git a/tests/run-make-fulldeps/link-path-order/wrong.c b/tests/run-make-fulldeps/link-path-order/wrong.c deleted file mode 100644 index 64275b3ad..000000000 --- a/tests/run-make-fulldeps/link-path-order/wrong.c +++ /dev/null @@ -1 +0,0 @@ -int should_return_one() { return 0; } diff --git a/tests/run-make-fulldeps/linkage-attr-on-static/Makefile b/tests/run-make-fulldeps/linkage-attr-on-static/Makefile deleted file mode 100644 index 7cc54e40a..000000000 --- a/tests/run-make-fulldeps/linkage-attr-on-static/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,foo) - $(RUSTC) bar.rs - $(call RUN,bar) || exit 1 diff --git a/tests/run-make-fulldeps/linkage-attr-on-static/bar.rs b/tests/run-make-fulldeps/linkage-attr-on-static/bar.rs deleted file mode 100644 index 68607cbb6..000000000 --- a/tests/run-make-fulldeps/linkage-attr-on-static/bar.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![feature(linkage)] - -#[no_mangle] -#[linkage = "external"] -static BAZ: i32 = 21; - -#[link(name = "foo", kind = "static")] -extern "C" { - fn what() -> i32; -} - -fn main() { - unsafe { - assert_eq!(what(), BAZ); - } -} diff --git a/tests/run-make-fulldeps/linkage-attr-on-static/foo.c b/tests/run-make-fulldeps/linkage-attr-on-static/foo.c deleted file mode 100644 index 78a6934f5..000000000 --- a/tests/run-make-fulldeps/linkage-attr-on-static/foo.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -extern int32_t BAZ; - -int32_t what() { - return BAZ; -} diff --git a/tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/Makefile b/tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/Makefile deleted file mode 100644 index a38f4fe5d..000000000 --- a/tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs -g - cp foo.bat $(TMPDIR)/ - OUT_DIR="$(TMPDIR)" RUSTC="$(RUSTC_ORIGINAL)" $(call RUN,foo) diff --git a/tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/foo.bat b/tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/foo.bat deleted file mode 100644 index a9350f12b..000000000 --- a/tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/foo.bat +++ /dev/null @@ -1 +0,0 @@ -%MY_LINKER% %* diff --git a/tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/foo.rs b/tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/foo.rs deleted file mode 100644 index 74d7b9b07..000000000 --- a/tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/foo.rs +++ /dev/null @@ -1,101 +0,0 @@ -// Like the `long-linker-command-lines` test this test attempts to blow -// a command line limit for running the linker. Unlike that test, however, -// this test is testing `cmd.exe` specifically rather than the OS. -// -// Unfortunately `cmd.exe` has a 8192 limit which is relatively small -// in the grand scheme of things and anyone sripting rustc's linker -// is probably using a `*.bat` script and is likely to hit this limit. -// -// This test uses a `foo.bat` script as the linker which just simply -// delegates back to this program. The compiler should use a lower -// limit for arguments before passing everything via `@`, which -// means that everything should still succeed here. - -use std::env; -use std::fs::{self, File}; -use std::io::{BufWriter, Write, Read}; -use std::path::PathBuf; -use std::process::Command; - -fn main() { - if !cfg!(windows) { - return - } - - let tmpdir = PathBuf::from(env::var_os("OUT_DIR").unwrap()); - let ok = tmpdir.join("ok"); - let not_ok = tmpdir.join("not_ok"); - if env::var("YOU_ARE_A_LINKER").is_ok() { - match env::args_os().find(|a| a.to_string_lossy().contains("@")) { - Some(file) => { - let file = file.to_str().unwrap(); - fs::copy(&file[1..], &ok).unwrap(); - } - None => { File::create(¬_ok).unwrap(); } - } - return - } - - let rustc = env::var_os("RUSTC").unwrap_or("rustc".into()); - let me = env::current_exe().unwrap(); - let bat = me.parent() - .unwrap() - .join("foo.bat"); - let bat_linker = format!("linker={}", bat.display()); - for i in (1..).map(|i| i * 10) { - println!("attempt: {}", i); - - let file = tmpdir.join("bar.rs"); - let mut f = BufWriter::new(File::create(&file).unwrap()); - let mut lib_name = String::new(); - for _ in 0..i { - lib_name.push_str("foo"); - } - for j in 0..i { - writeln!(f, "#[link(name = \"{}{}\")]", lib_name, j).unwrap(); - } - writeln!(f, "extern {{}}\nfn main() {{}}").unwrap(); - f.into_inner().unwrap(); - - drop(fs::remove_file(&ok)); - drop(fs::remove_file(¬_ok)); - let status = Command::new(&rustc) - .arg(&file) - .arg("-C").arg(&bat_linker) - .arg("--out-dir").arg(&tmpdir) - .env("YOU_ARE_A_LINKER", "1") - .env("MY_LINKER", &me) - .status() - .unwrap(); - - if !status.success() { - panic!("rustc didn't succeed: {}", status); - } - - if !ok.exists() { - assert!(not_ok.exists()); - continue - } - - let mut contents = Vec::new(); - File::open(&ok).unwrap().read_to_end(&mut contents).unwrap(); - - for j in 0..i { - let exp = format!("{}{}", lib_name, j); - let exp = if cfg!(target_env = "msvc") { - let mut out = Vec::with_capacity(exp.len() * 2); - for c in exp.encode_utf16() { - // encode in little endian - out.push(c as u8); - out.push((c >> 8) as u8); - } - out - } else { - exp.into_bytes() - }; - assert!(contents.windows(exp.len()).any(|w| w == &exp[..])); - } - - break - } -} diff --git a/tests/run-make-fulldeps/long-linker-command-lines/Makefile b/tests/run-make-fulldeps/long-linker-command-lines/Makefile deleted file mode 100644 index 00199ca97..000000000 --- a/tests/run-make-fulldeps/long-linker-command-lines/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs -g -O - RUSTC="$(RUSTC_ORIGINAL)" $(call RUN,foo) diff --git a/tests/run-make-fulldeps/long-linker-command-lines/foo.rs b/tests/run-make-fulldeps/long-linker-command-lines/foo.rs deleted file mode 100644 index db238c0cf..000000000 --- a/tests/run-make-fulldeps/long-linker-command-lines/foo.rs +++ /dev/null @@ -1,106 +0,0 @@ -// This is a test which attempts to blow out the system limit with how many -// arguments can be passed to a process. This'll successively call rustc with -// larger and larger argument lists in an attempt to find one that's way too -// big for the system at hand. This file itself is then used as a "linker" to -// detect when the process creation succeeds. -// -// Eventually we should see an argument that looks like `@` as we switch from -// passing literal arguments to passing everything in the file. - -use std::collections::HashSet; -use std::env; -use std::fs::{self, File}; -use std::io::{BufWriter, Write}; -use std::path::{Path, PathBuf}; -use std::process::Command; - -fn write_test_case(file: &Path, n: usize) -> HashSet { - let mut libs = HashSet::new(); - let mut f = BufWriter::new(File::create(&file).unwrap()); - let mut prefix = String::new(); - for _ in 0..n { - prefix.push_str("foo"); - } - for i in 0..n { - writeln!(f, "#[link(name = \"S{}{}S\")]", prefix, i).unwrap(); - libs.insert(format!("{}{}", prefix, i)); - } - writeln!(f, "extern \"C\" {{}}\nfn main() {{}}").unwrap(); - f.into_inner().unwrap(); - - libs -} - -fn read_linker_args(path: &Path) -> String { - let contents = fs::read(path).unwrap(); - if cfg!(target_env = "msvc") { - let mut i = contents.chunks(2).map(|c| { - c[0] as u16 | ((c[1] as u16) << 8) - }); - assert_eq!(i.next(), Some(0xfeff), "Expected UTF-16 BOM"); - String::from_utf16(&i.collect::>()).unwrap() - } else { - String::from_utf8(contents).unwrap() - } -} - -fn main() { - let tmpdir = PathBuf::from(env::var_os("TMPDIR").unwrap()); - let ok = tmpdir.join("ok"); - if env::var("YOU_ARE_A_LINKER").is_ok() { - if let Some(file) = env::args_os().find(|a| a.to_string_lossy().contains("@")) { - let file = file.to_str().expect("non-utf8 file argument"); - fs::copy(&file[1..], &ok).unwrap(); - } - return - } - - let rustc = env::var_os("RUSTC").unwrap_or("rustc".into()); - let me_as_linker = format!("linker={}", env::current_exe().unwrap().display()); - for i in (1..).map(|i| i * 100) { - println!("attempt: {}", i); - let file = tmpdir.join("bar.rs"); - let mut expected_libs = write_test_case(&file, i); - - drop(fs::remove_file(&ok)); - let output = Command::new(&rustc) - .arg(&file) - .arg("-C").arg(&me_as_linker) - .arg("--out-dir").arg(&tmpdir) - .env("YOU_ARE_A_LINKER", "1") - .output() - .unwrap(); - - if !output.status.success() { - let stderr = String::from_utf8_lossy(&output.stderr); - panic!("status: {}\nstdout:\n{}\nstderr:\n{}", - output.status, - String::from_utf8_lossy(&output.stdout), - stderr.lines().map(|l| { - if l.len() > 200 { - format!("{}...\n", &l[..200]) - } else { - format!("{}\n", l) - } - }).collect::()); - } - - if !ok.exists() { - continue - } - - let linker_args = read_linker_args(&ok); - for arg in linker_args.split('S') { - expected_libs.remove(arg); - } - - assert!( - expected_libs.is_empty(), - "expected but missing libraries: {:#?}\nlinker arguments: \n{}", - expected_libs, - linker_args, - ); - - break - } -} diff --git a/tests/run-make-fulldeps/longjmp-across-rust/Makefile b/tests/run-make-fulldeps/longjmp-across-rust/Makefile deleted file mode 100644 index 848638d82..000000000 --- a/tests/run-make-fulldeps/longjmp-across-rust/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,foo) - $(RUSTC) main.rs - $(call RUN,main) diff --git a/tests/run-make-fulldeps/longjmp-across-rust/foo.c b/tests/run-make-fulldeps/longjmp-across-rust/foo.c deleted file mode 100644 index bd71cc4d7..000000000 --- a/tests/run-make-fulldeps/longjmp-across-rust/foo.c +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include - -static jmp_buf ENV; - -extern void test_middle(); - -void test_start(void(*f)()) { - if (setjmp(ENV) != 0) - return; - f(); - assert(0); -} - -void test_end() { - longjmp(ENV, 1); - assert(0); -} diff --git a/tests/run-make-fulldeps/longjmp-across-rust/main.rs b/tests/run-make-fulldeps/longjmp-across-rust/main.rs deleted file mode 100644 index cc1d5b126..000000000 --- a/tests/run-make-fulldeps/longjmp-across-rust/main.rs +++ /dev/null @@ -1,29 +0,0 @@ -#[link(name = "foo", kind = "static")] -extern "C" { - fn test_start(f: extern "C" fn()); - fn test_end(); -} - -fn main() { - unsafe { - test_start(test_middle); - } -} - -struct A; - -impl Drop for A { - fn drop(&mut self) {} -} - -extern "C" fn test_middle() { - let _a = A; - foo(); -} - -fn foo() { - let _a = A; - unsafe { - test_end(); - } -} diff --git a/tests/run-make-fulldeps/ls-metadata/Makefile b/tests/run-make-fulldeps/ls-metadata/Makefile deleted file mode 100644 index e0f916a24..000000000 --- a/tests/run-make-fulldeps/ls-metadata/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs - $(RUSTC) -Z ls $(TMPDIR)/foo - touch $(TMPDIR)/bar - $(RUSTC) -Z ls $(TMPDIR)/bar diff --git a/tests/run-make-fulldeps/ls-metadata/foo.rs b/tests/run-make-fulldeps/ls-metadata/foo.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/tests/run-make-fulldeps/ls-metadata/foo.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/lto-dylib-dep/Makefile b/tests/run-make-fulldeps/lto-dylib-dep/Makefile deleted file mode 100644 index 41487b23c..000000000 --- a/tests/run-make-fulldeps/lto-dylib-dep/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -# Test that we don't run into an assertion when using a Rust dylib dependency -# while compiling with full LTO. -# See https://github.com/rust-lang/rust/issues/59137 - -all: - $(RUSTC) a_dylib.rs --crate-type=dylib -C prefer-dynamic - $(RUSTC) main.rs -C lto - $(call RUN,main) diff --git a/tests/run-make-fulldeps/lto-dylib-dep/a_dylib.rs b/tests/run-make-fulldeps/lto-dylib-dep/a_dylib.rs deleted file mode 100644 index e63457e6e..000000000 --- a/tests/run-make-fulldeps/lto-dylib-dep/a_dylib.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub fn foo() { - println!("bar"); -} diff --git a/tests/run-make-fulldeps/lto-dylib-dep/main.rs b/tests/run-make-fulldeps/lto-dylib-dep/main.rs deleted file mode 100644 index 4fb3c4730..000000000 --- a/tests/run-make-fulldeps/lto-dylib-dep/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate a_dylib; - -fn main() { - a_dylib::foo(); -} diff --git a/tests/run-make-fulldeps/lto-empty/Makefile b/tests/run-make-fulldeps/lto-empty/Makefile deleted file mode 100644 index b4345ba18..000000000 --- a/tests/run-make-fulldeps/lto-empty/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include ../tools.mk - -all: cdylib-fat cdylib-thin - -cdylib-fat: - $(RUSTC) lib.rs -C lto=fat -C opt-level=3 -C incremental=$(TMPDIR)/inc-fat - $(RUSTC) lib.rs -C lto=fat -C opt-level=3 -C incremental=$(TMPDIR)/inc-fat - -cdylib-thin: - $(RUSTC) lib.rs -C lto=thin -C opt-level=3 -C incremental=$(TMPDIR)/inc-thin - $(RUSTC) lib.rs -C lto=thin -C opt-level=3 -C incremental=$(TMPDIR)/inc-thin - diff --git a/tests/run-make-fulldeps/lto-empty/lib.rs b/tests/run-make-fulldeps/lto-empty/lib.rs deleted file mode 100644 index e3663c790..000000000 --- a/tests/run-make-fulldeps/lto-empty/lib.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "cdylib"] diff --git a/tests/run-make-fulldeps/lto-no-link-whole-rlib/Makefile b/tests/run-make-fulldeps/lto-no-link-whole-rlib/Makefile deleted file mode 100644 index e576ee37c..000000000 --- a/tests/run-make-fulldeps/lto-no-link-whole-rlib/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,foo) $(call NATIVE_STATICLIB,bar) - $(RUSTC) lib1.rs - $(RUSTC) lib2.rs - $(RUSTC) main.rs -Clto - $(call RUN,main) - diff --git a/tests/run-make-fulldeps/lto-no-link-whole-rlib/bar.c b/tests/run-make-fulldeps/lto-no-link-whole-rlib/bar.c deleted file mode 100644 index b25011930..000000000 --- a/tests/run-make-fulldeps/lto-no-link-whole-rlib/bar.c +++ /dev/null @@ -1,3 +0,0 @@ -int foo() { - return 2; -} diff --git a/tests/run-make-fulldeps/lto-no-link-whole-rlib/foo.c b/tests/run-make-fulldeps/lto-no-link-whole-rlib/foo.c deleted file mode 100644 index 75010458e..000000000 --- a/tests/run-make-fulldeps/lto-no-link-whole-rlib/foo.c +++ /dev/null @@ -1,3 +0,0 @@ -int foo() { - return 1; -} diff --git a/tests/run-make-fulldeps/lto-no-link-whole-rlib/lib1.rs b/tests/run-make-fulldeps/lto-no-link-whole-rlib/lib1.rs deleted file mode 100644 index f70bb3382..000000000 --- a/tests/run-make-fulldeps/lto-no-link-whole-rlib/lib1.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![crate_type = "rlib"] - -#[link(name = "foo", kind = "static")] -extern "C" { - fn foo() -> i32; -} - -pub fn foo1() -> i32 { - unsafe { foo() } -} diff --git a/tests/run-make-fulldeps/lto-no-link-whole-rlib/lib2.rs b/tests/run-make-fulldeps/lto-no-link-whole-rlib/lib2.rs deleted file mode 100644 index 2dec2a271..000000000 --- a/tests/run-make-fulldeps/lto-no-link-whole-rlib/lib2.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![crate_type = "rlib"] - -extern crate lib1; - -#[link(name = "bar", kind = "static")] -extern "C" { - fn foo() -> i32; -} - -pub fn foo2() -> i32 { - unsafe { foo() } -} diff --git a/tests/run-make-fulldeps/lto-no-link-whole-rlib/main.rs b/tests/run-make-fulldeps/lto-no-link-whole-rlib/main.rs deleted file mode 100644 index 0c658808e..000000000 --- a/tests/run-make-fulldeps/lto-no-link-whole-rlib/main.rs +++ /dev/null @@ -1,7 +0,0 @@ -extern crate lib1; -extern crate lib2; - -fn main() { - assert_eq!(lib1::foo1(), 2); - assert_eq!(lib2::foo2(), 2); -} diff --git a/tests/run-make-fulldeps/lto-readonly-lib/Makefile b/tests/run-make-fulldeps/lto-readonly-lib/Makefile deleted file mode 100644 index a20ecea88..000000000 --- a/tests/run-make-fulldeps/lto-readonly-lib/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) lib.rs - - # the compiler needs to copy and modify the rlib file when performing - # LTO, so we should ensure that it can cope with the original rlib - # being read-only. - chmod 444 $(TMPDIR)/*.rlib - - $(RUSTC) main.rs -C lto - $(call RUN,main) diff --git a/tests/run-make-fulldeps/lto-readonly-lib/lib.rs b/tests/run-make-fulldeps/lto-readonly-lib/lib.rs deleted file mode 100644 index c1bfaa6ca..000000000 --- a/tests/run-make-fulldeps/lto-readonly-lib/lib.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "rlib"] diff --git a/tests/run-make-fulldeps/lto-readonly-lib/main.rs b/tests/run-make-fulldeps/lto-readonly-lib/main.rs deleted file mode 100644 index 69da798b3..000000000 --- a/tests/run-make-fulldeps/lto-readonly-lib/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate lib; - -fn main() {} diff --git a/tests/run-make-fulldeps/lto-smoke-c/Makefile b/tests/run-make-fulldeps/lto-smoke-c/Makefile deleted file mode 100644 index 7c6ee3be8..000000000 --- a/tests/run-make-fulldeps/lto-smoke-c/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include ../tools.mk - -# Apparently older versions of GCC segfault if -g is passed... -CC := $(CC:-g=) - -all: - $(RUSTC) foo.rs -C lto - $(CC) bar.c $(call STATICLIB,foo) \ - $(call OUT_EXE,bar) \ - $(EXTRACFLAGS) $(EXTRACXXFLAGS) - $(call RUN,bar) diff --git a/tests/run-make-fulldeps/lto-smoke-c/bar.c b/tests/run-make-fulldeps/lto-smoke-c/bar.c deleted file mode 100644 index bb4036b06..000000000 --- a/tests/run-make-fulldeps/lto-smoke-c/bar.c +++ /dev/null @@ -1,6 +0,0 @@ -void foo(); - -int main() { - foo(); - return 0; -} diff --git a/tests/run-make-fulldeps/lto-smoke-c/foo.rs b/tests/run-make-fulldeps/lto-smoke-c/foo.rs deleted file mode 100644 index 2e59432cd..000000000 --- a/tests/run-make-fulldeps/lto-smoke-c/foo.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "staticlib"] - -#[no_mangle] -pub extern "C" fn foo() {} diff --git a/tests/run-make-fulldeps/lto-smoke/Makefile b/tests/run-make-fulldeps/lto-smoke/Makefile deleted file mode 100644 index 8bce708b4..000000000 --- a/tests/run-make-fulldeps/lto-smoke/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -include ../tools.mk - -all: noparam bool_true bool_false thin fat - -noparam: - $(RUSTC) lib.rs - $(RUSTC) main.rs -C lto - $(call RUN,main) - -bool_true: - $(RUSTC) lib.rs - $(RUSTC) main.rs -C lto=yes - $(call RUN,main) - - -bool_false: - $(RUSTC) lib.rs - $(RUSTC) main.rs -C lto=off - $(call RUN,main) - -thin: - $(RUSTC) lib.rs - $(RUSTC) main.rs -C lto=thin - $(call RUN,main) - -fat: - $(RUSTC) lib.rs - $(RUSTC) main.rs -C lto=fat - $(call RUN,main) - diff --git a/tests/run-make-fulldeps/lto-smoke/lib.rs b/tests/run-make-fulldeps/lto-smoke/lib.rs deleted file mode 100644 index c1bfaa6ca..000000000 --- a/tests/run-make-fulldeps/lto-smoke/lib.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "rlib"] diff --git a/tests/run-make-fulldeps/lto-smoke/main.rs b/tests/run-make-fulldeps/lto-smoke/main.rs deleted file mode 100644 index 69da798b3..000000000 --- a/tests/run-make-fulldeps/lto-smoke/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate lib; - -fn main() {} diff --git a/tests/run-make-fulldeps/manual-crate-name/Makefile b/tests/run-make-fulldeps/manual-crate-name/Makefile deleted file mode 100644 index c00e20c7c..000000000 --- a/tests/run-make-fulldeps/manual-crate-name/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --crate-name foo bar.rs - rm $(TMPDIR)/libfoo.rlib diff --git a/tests/run-make-fulldeps/manual-crate-name/bar.rs b/tests/run-make-fulldeps/manual-crate-name/bar.rs deleted file mode 100644 index c1bfaa6ca..000000000 --- a/tests/run-make-fulldeps/manual-crate-name/bar.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "rlib"] diff --git a/tests/run-make-fulldeps/manual-link/Makefile b/tests/run-make-fulldeps/manual-link/Makefile deleted file mode 100644 index 401f6eb44..000000000 --- a/tests/run-make-fulldeps/manual-link/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: $(TMPDIR)/libbar.a - $(RUSTC) foo.rs -lstatic=bar - $(RUSTC) main.rs - $(call RUN,main) diff --git a/tests/run-make-fulldeps/manual-link/bar.c b/tests/run-make-fulldeps/manual-link/bar.c deleted file mode 100644 index e42599986..000000000 --- a/tests/run-make-fulldeps/manual-link/bar.c +++ /dev/null @@ -1 +0,0 @@ -void bar() {} diff --git a/tests/run-make-fulldeps/manual-link/foo.c b/tests/run-make-fulldeps/manual-link/foo.c deleted file mode 100644 index e42599986..000000000 --- a/tests/run-make-fulldeps/manual-link/foo.c +++ /dev/null @@ -1 +0,0 @@ -void bar() {} diff --git a/tests/run-make-fulldeps/manual-link/foo.rs b/tests/run-make-fulldeps/manual-link/foo.rs deleted file mode 100644 index c1f28236f..000000000 --- a/tests/run-make-fulldeps/manual-link/foo.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![crate_type = "rlib"] - -extern "C" { - fn bar(); -} - -pub fn foo() { - unsafe { - bar(); - } -} diff --git a/tests/run-make-fulldeps/manual-link/main.rs b/tests/run-make-fulldeps/manual-link/main.rs deleted file mode 100644 index fe35f1f8e..000000000 --- a/tests/run-make-fulldeps/manual-link/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate foo; - -fn main() { - foo::foo(); -} diff --git a/tests/run-make-fulldeps/many-crates-but-no-match/Makefile b/tests/run-make-fulldeps/many-crates-but-no-match/Makefile deleted file mode 100644 index ca0ab8e9e..000000000 --- a/tests/run-make-fulldeps/many-crates-but-no-match/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -include ../tools.mk - -# Modelled after ui/changing-crates.rs test, but this one puts -# more than one (mismatching) candidate crate into the search path, -# which did not appear directly expressible in UI testing infrastructure. -# -# Note that we move the built libraries into target direcrtories rather than -# use the `--out-dir` option because the `../tools.mk` file already bakes a -# use of `--out-dir` into the definition of $(RUSTC). - -A1=$(TMPDIR)/a1 -A2=$(TMPDIR)/a2 -A3=$(TMPDIR)/a3 - -# A hack to match distinct lines of output from a single run. -LOG=$(TMPDIR)/log.txt - -all: - mkdir -p $(A1) $(A2) $(A3) - $(RUSTC) --crate-type=rlib crateA1.rs - mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A1) - $(RUSTC) --crate-type=rlib -L $(A1) crateB.rs - $(RUSTC) --crate-type=rlib crateA2.rs - mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A2) - $(RUSTC) --crate-type=rlib crateA3.rs - mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A3) - # Ensure crateC fails to compile since A1 is "missing" and A2/A3 hashes do not match - $(RUSTC) -L $(A2) -L $(A3) crateC.rs >$(LOG) 2>&1 || true - $(CGREP) \ - 'found possibly newer version of crate `crateA` which `crateB` depends on' \ - 'note: perhaps that crate needs to be recompiled?' \ - 'crate `crateA`:' \ - 'crate `crateB`:' \ - < $(LOG) - # the 'crate `crateA`' will match two entries. diff --git a/tests/run-make-fulldeps/many-crates-but-no-match/crateA1.rs b/tests/run-make-fulldeps/many-crates-but-no-match/crateA1.rs deleted file mode 100644 index 3fed5a38e..000000000 --- a/tests/run-make-fulldeps/many-crates-but-no-match/crateA1.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_name="crateA"] - -// Base crate -pub fn func() {} diff --git a/tests/run-make-fulldeps/many-crates-but-no-match/crateA2.rs b/tests/run-make-fulldeps/many-crates-but-no-match/crateA2.rs deleted file mode 100644 index 8db07a015..000000000 --- a/tests/run-make-fulldeps/many-crates-but-no-match/crateA2.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_name="crateA"] - -// Base crate -pub fn func() { println!("hello"); } diff --git a/tests/run-make-fulldeps/many-crates-but-no-match/crateA3.rs b/tests/run-make-fulldeps/many-crates-but-no-match/crateA3.rs deleted file mode 100644 index a1e8e40a3..000000000 --- a/tests/run-make-fulldeps/many-crates-but-no-match/crateA3.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_name="crateA"] - -// Base crate -pub fn foo() { println!("world!"); } diff --git a/tests/run-make-fulldeps/many-crates-but-no-match/crateB.rs b/tests/run-make-fulldeps/many-crates-but-no-match/crateB.rs deleted file mode 100644 index 4ccd65d65..000000000 --- a/tests/run-make-fulldeps/many-crates-but-no-match/crateB.rs +++ /dev/null @@ -1 +0,0 @@ -extern crate crateA; diff --git a/tests/run-make-fulldeps/many-crates-but-no-match/crateC.rs b/tests/run-make-fulldeps/many-crates-but-no-match/crateC.rs deleted file mode 100644 index a8b817ec6..000000000 --- a/tests/run-make-fulldeps/many-crates-but-no-match/crateC.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate crateB; - -fn main() {} diff --git a/tests/run-make-fulldeps/metadata-flag-frobs-symbols/Makefile b/tests/run-make-fulldeps/metadata-flag-frobs-symbols/Makefile deleted file mode 100644 index dc6b10f4e..000000000 --- a/tests/run-make-fulldeps/metadata-flag-frobs-symbols/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs -C metadata=a -C extra-filename=-a - $(RUSTC) foo.rs -C metadata=b -C extra-filename=-b - $(RUSTC) bar.rs \ - --extern foo1=$(TMPDIR)/libfoo-a.rlib \ - --extern foo2=$(TMPDIR)/libfoo-b.rlib \ - --print link-args - $(call RUN,bar) diff --git a/tests/run-make-fulldeps/metadata-flag-frobs-symbols/bar.rs b/tests/run-make-fulldeps/metadata-flag-frobs-symbols/bar.rs deleted file mode 100644 index 1e6957a36..000000000 --- a/tests/run-make-fulldeps/metadata-flag-frobs-symbols/bar.rs +++ /dev/null @@ -1,8 +0,0 @@ -extern crate foo1; -extern crate foo2; - -fn main() { - let a = foo1::foo(); - let b = foo2::foo(); - assert!(a as *const _ != b as *const _); -} diff --git a/tests/run-make-fulldeps/metadata-flag-frobs-symbols/foo.rs b/tests/run-make-fulldeps/metadata-flag-frobs-symbols/foo.rs deleted file mode 100644 index 696aed2fa..000000000 --- a/tests/run-make-fulldeps/metadata-flag-frobs-symbols/foo.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_name = "foo"] -#![crate_type = "rlib"] - -static FOO: usize = 3; - -pub fn foo() -> &'static usize { &FOO } diff --git a/tests/run-make-fulldeps/min-global-align/Makefile b/tests/run-make-fulldeps/min-global-align/Makefile deleted file mode 100644 index 82f38749e..000000000 --- a/tests/run-make-fulldeps/min-global-align/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -include ../tools.mk - -# only-linux - -# This tests ensure that global variables respect the target minimum alignment. -# The three bools `STATIC_BOOL`, `STATIC_MUT_BOOL`, and `CONST_BOOL` all have -# type-alignment of 1, but some targets require greater global alignment. - -SRC = min_global_align.rs -LL = $(TMPDIR)/min_global_align.ll - -all: -# Most targets are happy with default alignment -- take i686 for example. -ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86) - $(RUSTC) --target=i686-unknown-linux-gnu --emit=llvm-ir $(SRC) - [ "$$(grep -c 'align 1' "$(LL)")" -eq "3" ] -endif -# SystemZ requires even alignment for PC-relative addressing. -ifeq ($(filter systemz,$(LLVM_COMPONENTS)),systemz) - $(RUSTC) --target=s390x-unknown-linux-gnu --emit=llvm-ir $(SRC) - [ "$$(grep -c 'align 2' "$(LL)")" -eq "3" ] -endif diff --git a/tests/run-make-fulldeps/min-global-align/min_global_align.rs b/tests/run-make-fulldeps/min-global-align/min_global_align.rs deleted file mode 100644 index 135792e93..000000000 --- a/tests/run-make-fulldeps/min-global-align/min_global_align.rs +++ /dev/null @@ -1,32 +0,0 @@ -#![feature(no_core, lang_items)] -#![crate_type = "rlib"] -#![no_core] - -pub static STATIC_BOOL: bool = true; - -pub static mut STATIC_MUT_BOOL: bool = true; - -const CONST_BOOL: bool = true; -pub static CONST_BOOL_REF: &'static bool = &CONST_BOOL; - -#[lang = "sized"] -trait Sized {} - -#[lang = "copy"] -trait Copy {} -impl Copy for bool {} -impl Copy for &bool {} - -#[lang = "freeze"] -trait Freeze {} - -// No `UnsafeCell`, so everything is `Freeze`. -impl Freeze for T {} - -#[lang = "sync"] -trait Sync {} -impl Sync for bool {} -impl Sync for &'static bool {} - -#[lang = "drop_in_place"] -pub unsafe fn drop_in_place(_: *mut T) {} diff --git a/tests/run-make-fulldeps/mingw-export-call-convention/Makefile b/tests/run-make-fulldeps/mingw-export-call-convention/Makefile deleted file mode 100644 index 4a60059cc..000000000 --- a/tests/run-make-fulldeps/mingw-export-call-convention/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -# only-windows-gnu - -all: - $(RUSTC) foo.rs - # FIXME: we should make sure __stdcall calling convention is used here - # but that only works with LLD right now - nm -g "$(call IMPLIB,foo)" | $(CGREP) bar diff --git a/tests/run-make-fulldeps/mingw-export-call-convention/foo.rs b/tests/run-make-fulldeps/mingw-export-call-convention/foo.rs deleted file mode 100644 index 1fec00311..000000000 --- a/tests/run-make-fulldeps/mingw-export-call-convention/foo.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "cdylib"] - -#[no_mangle] -pub extern "system" fn bar() {} diff --git a/tests/run-make-fulldeps/mismatching-target-triples/Makefile b/tests/run-make-fulldeps/mismatching-target-triples/Makefile deleted file mode 100644 index 409388e04..000000000 --- a/tests/run-make-fulldeps/mismatching-target-triples/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include ../tools.mk - -# Issue #10814 -# -# these are no_std to avoid having to have the standard library or any -# linkers/assemblers for the relevant platform - -all: - $(RUSTC) foo.rs --target=i686-unknown-linux-gnu - $(RUSTC) bar.rs --target=x86_64-unknown-linux-gnu 2>&1 \ - | $(CGREP) 'couldn'"'"'t find crate `foo` with expected target triple x86_64-unknown-linux-gnu' diff --git a/tests/run-make-fulldeps/mismatching-target-triples/bar.rs b/tests/run-make-fulldeps/mismatching-target-triples/bar.rs deleted file mode 100644 index b2c2fc1c4..000000000 --- a/tests/run-make-fulldeps/mismatching-target-triples/bar.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![feature(no_core)] -#![no_core] -extern crate foo; diff --git a/tests/run-make-fulldeps/mismatching-target-triples/foo.rs b/tests/run-make-fulldeps/mismatching-target-triples/foo.rs deleted file mode 100644 index 6fa054914..000000000 --- a/tests/run-make-fulldeps/mismatching-target-triples/foo.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![feature(no_core)] -#![no_core] -#![crate_type = "lib"] diff --git a/tests/run-make-fulldeps/missing-crate-dependency/Makefile b/tests/run-make-fulldeps/missing-crate-dependency/Makefile deleted file mode 100644 index 7c271ab8a..000000000 --- a/tests/run-make-fulldeps/missing-crate-dependency/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --crate-type=rlib crateA.rs - $(RUSTC) --crate-type=rlib crateB.rs - $(call REMOVE_RLIBS,crateA) - # Ensure crateC fails to compile since dependency crateA is missing - $(RUSTC) crateC.rs 2>&1 | \ - $(CGREP) 'can'"'"'t find crate for `crateA` which `crateB` depends on' diff --git a/tests/run-make-fulldeps/missing-crate-dependency/crateA.rs b/tests/run-make-fulldeps/missing-crate-dependency/crateA.rs deleted file mode 100644 index 31433cb60..000000000 --- a/tests/run-make-fulldeps/missing-crate-dependency/crateA.rs +++ /dev/null @@ -1,2 +0,0 @@ -// Base crate -pub fn func() {} diff --git a/tests/run-make-fulldeps/missing-crate-dependency/crateB.rs b/tests/run-make-fulldeps/missing-crate-dependency/crateB.rs deleted file mode 100644 index 4ccd65d65..000000000 --- a/tests/run-make-fulldeps/missing-crate-dependency/crateB.rs +++ /dev/null @@ -1 +0,0 @@ -extern crate crateA; diff --git a/tests/run-make-fulldeps/missing-crate-dependency/crateC.rs b/tests/run-make-fulldeps/missing-crate-dependency/crateC.rs deleted file mode 100644 index a8b817ec6..000000000 --- a/tests/run-make-fulldeps/missing-crate-dependency/crateC.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate crateB; - -fn main() {} diff --git a/tests/run-make-fulldeps/mixing-deps/Makefile b/tests/run-make-fulldeps/mixing-deps/Makefile deleted file mode 100644 index 956e704ee..000000000 --- a/tests/run-make-fulldeps/mixing-deps/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) both.rs -C prefer-dynamic - $(RUSTC) dylib.rs -C prefer-dynamic - $(RUSTC) prog.rs - $(call RUN,prog) diff --git a/tests/run-make-fulldeps/mixing-deps/both.rs b/tests/run-make-fulldeps/mixing-deps/both.rs deleted file mode 100644 index 6a5818763..000000000 --- a/tests/run-make-fulldeps/mixing-deps/both.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "rlib"] -#![crate_type = "dylib"] - -pub static foo: isize = 4; diff --git a/tests/run-make-fulldeps/mixing-deps/dylib.rs b/tests/run-make-fulldeps/mixing-deps/dylib.rs deleted file mode 100644 index 88976d5b6..000000000 --- a/tests/run-make-fulldeps/mixing-deps/dylib.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_type = "dylib"] -extern crate both; - -use std::mem; - -pub fn addr() -> usize { unsafe { mem::transmute(&both::foo) } } diff --git a/tests/run-make-fulldeps/mixing-deps/prog.rs b/tests/run-make-fulldeps/mixing-deps/prog.rs deleted file mode 100644 index 188981dc1..000000000 --- a/tests/run-make-fulldeps/mixing-deps/prog.rs +++ /dev/null @@ -1,9 +0,0 @@ -extern crate dylib; -extern crate both; - -use std::mem; - -fn main() { - assert_eq!(unsafe { mem::transmute::<&isize, usize>(&both::foo) }, - dylib::addr()); -} diff --git a/tests/run-make-fulldeps/mixing-formats/Makefile b/tests/run-make-fulldeps/mixing-formats/Makefile deleted file mode 100644 index b27e54257..000000000 --- a/tests/run-make-fulldeps/mixing-formats/Makefile +++ /dev/null @@ -1,74 +0,0 @@ -include ../tools.mk - -# Testing various mixings of rlibs and dylibs. Makes sure that it's possible to -# link an rlib to a dylib. The dependency tree among the file looks like: -# -# foo -# / \ -# bar1 bar2 -# / \ / -# baz baz2 -# -# This is generally testing the permutations of the foo/bar1/bar2 layer against -# the baz/baz2 layer - -all: - # Building just baz - $(RUSTC) --crate-type=rlib foo.rs - $(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic - $(RUSTC) --crate-type=dylib,rlib baz.rs -C prefer-dynamic - $(RUSTC) --crate-type=bin baz.rs - rm $(TMPDIR)/* - $(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic - $(RUSTC) --crate-type=rlib bar1.rs - $(RUSTC) --crate-type=dylib,rlib baz.rs -C prefer-dynamic - $(RUSTC) --crate-type=bin baz.rs - rm $(TMPDIR)/* - # Building baz2 - $(RUSTC) --crate-type=rlib foo.rs - $(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic - $(RUSTC) --crate-type=dylib bar2.rs -C prefer-dynamic - $(RUSTC) --crate-type=dylib baz2.rs && exit 1 || exit 0 - $(RUSTC) --crate-type=bin baz2.rs && exit 1 || exit 0 - rm $(TMPDIR)/* - $(RUSTC) --crate-type=rlib foo.rs - $(RUSTC) --crate-type=rlib bar1.rs - $(RUSTC) --crate-type=dylib bar2.rs -C prefer-dynamic - $(RUSTC) --crate-type=dylib,rlib baz2.rs - $(RUSTC) --crate-type=bin baz2.rs - rm $(TMPDIR)/* - $(RUSTC) --crate-type=rlib foo.rs - $(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic - $(RUSTC) --crate-type=rlib bar2.rs - $(RUSTC) --crate-type=dylib,rlib baz2.rs -C prefer-dynamic - $(RUSTC) --crate-type=bin baz2.rs - rm $(TMPDIR)/* - $(RUSTC) --crate-type=rlib foo.rs - $(RUSTC) --crate-type=rlib bar1.rs - $(RUSTC) --crate-type=rlib bar2.rs - $(RUSTC) --crate-type=dylib,rlib baz2.rs -C prefer-dynamic - $(RUSTC) --crate-type=bin baz2.rs - rm $(TMPDIR)/* - $(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic - $(RUSTC) --crate-type=rlib bar1.rs - $(RUSTC) --crate-type=rlib bar2.rs - $(RUSTC) --crate-type=dylib,rlib baz2.rs -C prefer-dynamic - $(RUSTC) --crate-type=bin baz2.rs - rm $(TMPDIR)/* - $(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic - $(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic - $(RUSTC) --crate-type=rlib bar2.rs - $(RUSTC) --crate-type=dylib,rlib baz2.rs - $(RUSTC) --crate-type=bin baz2.rs - rm $(TMPDIR)/* - $(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic - $(RUSTC) --crate-type=rlib bar1.rs - $(RUSTC) --crate-type=dylib bar2.rs -C prefer-dynamic - $(RUSTC) --crate-type=dylib,rlib baz2.rs - $(RUSTC) --crate-type=bin baz2.rs - rm $(TMPDIR)/* - $(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic - $(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic - $(RUSTC) --crate-type=dylib bar2.rs -C prefer-dynamic - $(RUSTC) --crate-type=dylib,rlib baz2.rs - $(RUSTC) --crate-type=bin baz2.rs diff --git a/tests/run-make-fulldeps/mixing-formats/bar1.rs b/tests/run-make-fulldeps/mixing-formats/bar1.rs deleted file mode 100644 index 49af74e1b..000000000 --- a/tests/run-make-fulldeps/mixing-formats/bar1.rs +++ /dev/null @@ -1 +0,0 @@ -extern crate foo; diff --git a/tests/run-make-fulldeps/mixing-formats/bar2.rs b/tests/run-make-fulldeps/mixing-formats/bar2.rs deleted file mode 100644 index 49af74e1b..000000000 --- a/tests/run-make-fulldeps/mixing-formats/bar2.rs +++ /dev/null @@ -1 +0,0 @@ -extern crate foo; diff --git a/tests/run-make-fulldeps/mixing-formats/baz.rs b/tests/run-make-fulldeps/mixing-formats/baz.rs deleted file mode 100644 index 99a73159e..000000000 --- a/tests/run-make-fulldeps/mixing-formats/baz.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate bar1; - -fn main() {} diff --git a/tests/run-make-fulldeps/mixing-formats/baz2.rs b/tests/run-make-fulldeps/mixing-formats/baz2.rs deleted file mode 100644 index d0fab1e4c..000000000 --- a/tests/run-make-fulldeps/mixing-formats/baz2.rs +++ /dev/null @@ -1,4 +0,0 @@ -extern crate bar1; -extern crate bar2; - -fn main() {} diff --git a/tests/run-make-fulldeps/mixing-formats/foo.rs b/tests/run-make-fulldeps/mixing-formats/foo.rs deleted file mode 100644 index d11c69f81..000000000 --- a/tests/run-make-fulldeps/mixing-formats/foo.rs +++ /dev/null @@ -1 +0,0 @@ -// intentionally empty diff --git a/tests/run-make-fulldeps/mixing-libs/Makefile b/tests/run-make-fulldeps/mixing-libs/Makefile deleted file mode 100644 index 39cc0708c..000000000 --- a/tests/run-make-fulldeps/mixing-libs/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) rlib.rs - $(RUSTC) dylib.rs - $(RUSTC) rlib.rs --crate-type=dylib - $(RUSTC) dylib.rs - $(call REMOVE_DYLIBS,rlib) - $(RUSTC) prog.rs && exit 1 || exit 0 diff --git a/tests/run-make-fulldeps/mixing-libs/dylib.rs b/tests/run-make-fulldeps/mixing-libs/dylib.rs deleted file mode 100644 index 685688750..000000000 --- a/tests/run-make-fulldeps/mixing-libs/dylib.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "dylib"] -extern crate rlib; - -pub fn dylib() { rlib::rlib() } diff --git a/tests/run-make-fulldeps/mixing-libs/prog.rs b/tests/run-make-fulldeps/mixing-libs/prog.rs deleted file mode 100644 index 14ce5c951..000000000 --- a/tests/run-make-fulldeps/mixing-libs/prog.rs +++ /dev/null @@ -1,7 +0,0 @@ -extern crate dylib; -extern crate rlib; - -fn main() { - dylib::dylib(); - rlib::rlib(); -} diff --git a/tests/run-make-fulldeps/mixing-libs/rlib.rs b/tests/run-make-fulldeps/mixing-libs/rlib.rs deleted file mode 100644 index 96dcd16bb..000000000 --- a/tests/run-make-fulldeps/mixing-libs/rlib.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "rlib"] -pub fn rlib() {} diff --git a/tests/run-make-fulldeps/msvc-opt-minsize/Makefile b/tests/run-make-fulldeps/msvc-opt-minsize/Makefile deleted file mode 100644 index a5f019f24..000000000 --- a/tests/run-make-fulldeps/msvc-opt-minsize/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs -Copt-level=z 2>&1 - $(call RUN,foo) diff --git a/tests/run-make-fulldeps/msvc-opt-minsize/foo.rs b/tests/run-make-fulldeps/msvc-opt-minsize/foo.rs deleted file mode 100644 index 3f5496c08..000000000 --- a/tests/run-make-fulldeps/msvc-opt-minsize/foo.rs +++ /dev/null @@ -1,19 +0,0 @@ -#![feature(test)] -extern crate test; - -fn foo(x: i32, y: i32) -> i64 { - (x + y) as i64 -} - -#[inline(never)] -fn bar() { - let _f = Box::new(0); - // This call used to trigger an LLVM bug in opt-level z where the base - // pointer gets corrupted, see issue #45034 - let y: fn(i32, i32) -> i64 = test::black_box(foo); - test::black_box(y(1, 2)); -} - -fn main() { - bar(); -} diff --git a/tests/run-make-fulldeps/multiple-emits/Makefile b/tests/run-make-fulldeps/multiple-emits/Makefile deleted file mode 100644 index d1f297644..000000000 --- a/tests/run-make-fulldeps/multiple-emits/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs --emit=asm,llvm-ir -o $(TMPDIR)/out 2>&1 - rm $(TMPDIR)/out.ll $(TMPDIR)/out.s - $(RUSTC) foo.rs --emit=asm,llvm-ir -o $(TMPDIR)/out2.ext 2>&1 - rm $(TMPDIR)/out2.ll $(TMPDIR)/out2.s diff --git a/tests/run-make-fulldeps/multiple-emits/foo.rs b/tests/run-make-fulldeps/multiple-emits/foo.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/tests/run-make-fulldeps/multiple-emits/foo.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/no-builtins-lto/Makefile b/tests/run-make-fulldeps/no-builtins-lto/Makefile deleted file mode 100644 index c8f05d991..000000000 --- a/tests/run-make-fulldeps/no-builtins-lto/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -all: - # Compile a `#![no_builtins]` rlib crate - $(RUSTC) no_builtins.rs - # Build an executable that depends on that crate using LTO. The no_builtins crate doesn't - # participate in LTO, so its rlib must be explicitly linked into the final binary. Verify this by - # grepping the linker arguments. - $(RUSTC) main.rs -C lto --print link-args | $(CGREP) 'libno_builtins.rlib' diff --git a/tests/run-make-fulldeps/no-builtins-lto/main.rs b/tests/run-make-fulldeps/no-builtins-lto/main.rs deleted file mode 100644 index 890c999c8..000000000 --- a/tests/run-make-fulldeps/no-builtins-lto/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate no_builtins; - -fn main() {} diff --git a/tests/run-make-fulldeps/no-builtins-lto/no_builtins.rs b/tests/run-make-fulldeps/no-builtins-lto/no_builtins.rs deleted file mode 100644 index 5d001031a..000000000 --- a/tests/run-make-fulldeps/no-builtins-lto/no_builtins.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "lib"] -#![no_builtins] diff --git a/tests/run-make-fulldeps/no-duplicate-libs/Makefile b/tests/run-make-fulldeps/no-duplicate-libs/Makefile deleted file mode 100644 index b05aff782..000000000 --- a/tests/run-make-fulldeps/no-duplicate-libs/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -ifdef IS_MSVC -# FIXME(#27979) -all: -else -all: $(call STATICLIB,foo) $(call STATICLIB,bar) - $(RUSTC) main.rs - $(call RUN,main) -endif diff --git a/tests/run-make-fulldeps/no-duplicate-libs/bar.c b/tests/run-make-fulldeps/no-duplicate-libs/bar.c deleted file mode 100644 index e36952657..000000000 --- a/tests/run-make-fulldeps/no-duplicate-libs/bar.c +++ /dev/null @@ -1,5 +0,0 @@ -extern void foo(); - -void bar() { - foo(); -} diff --git a/tests/run-make-fulldeps/no-duplicate-libs/foo.c b/tests/run-make-fulldeps/no-duplicate-libs/foo.c deleted file mode 100644 index 85e6cd8c3..000000000 --- a/tests/run-make-fulldeps/no-duplicate-libs/foo.c +++ /dev/null @@ -1 +0,0 @@ -void foo() {} diff --git a/tests/run-make-fulldeps/no-duplicate-libs/main.rs b/tests/run-make-fulldeps/no-duplicate-libs/main.rs deleted file mode 100644 index b25ef35ad..000000000 --- a/tests/run-make-fulldeps/no-duplicate-libs/main.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[link(name = "foo")] // linker should drop this library, no symbols used -#[link(name = "bar")] // symbol comes from this library -#[link(name = "foo")] // now linker picks up `foo` b/c `bar` library needs it -extern "C" { - fn bar(); -} - -fn main() { - unsafe { bar() } -} diff --git a/tests/run-make-fulldeps/no-intermediate-extras/Makefile b/tests/run-make-fulldeps/no-intermediate-extras/Makefile deleted file mode 100644 index 4116aac1b..000000000 --- a/tests/run-make-fulldeps/no-intermediate-extras/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# Regression test for issue #10973 - -include ../tools.mk - -all: - $(RUSTC) --crate-type=rlib --test foo.rs - rm $(TMPDIR)/foo.bc && exit 1 || exit 0 diff --git a/tests/run-make-fulldeps/no-intermediate-extras/foo.rs b/tests/run-make-fulldeps/no-intermediate-extras/foo.rs deleted file mode 100644 index d11c69f81..000000000 --- a/tests/run-make-fulldeps/no-intermediate-extras/foo.rs +++ /dev/null @@ -1 +0,0 @@ -// intentionally empty diff --git a/tests/run-make-fulldeps/obey-crate-type-flag/Makefile b/tests/run-make-fulldeps/obey-crate-type-flag/Makefile deleted file mode 100644 index effcfc94c..000000000 --- a/tests/run-make-fulldeps/obey-crate-type-flag/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -include ../tools.mk - -# check that rustc builds all crate_type attributes -# delete rlib -# delete whatever dylib is made for this system -# check that rustc only builds --crate-type flags, ignoring attributes -# fail if an rlib was built -all: - $(RUSTC) test.rs - $(call REMOVE_RLIBS,test) - $(call REMOVE_DYLIBS,test) - $(RUSTC) --crate-type dylib test.rs - $(call REMOVE_RLIBS,test) && exit 1 || exit 0 diff --git a/tests/run-make-fulldeps/obey-crate-type-flag/test.rs b/tests/run-make-fulldeps/obey-crate-type-flag/test.rs deleted file mode 100644 index 8a768f9de..000000000 --- a/tests/run-make-fulldeps/obey-crate-type-flag/test.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "rlib"] -#![crate_type = "dylib"] diff --git a/tests/run-make-fulldeps/obtain-borrowck/Makefile b/tests/run-make-fulldeps/obtain-borrowck/Makefile index 212d0f67d..233f5c9ea 100644 --- a/tests/run-make-fulldeps/obtain-borrowck/Makefile +++ b/tests/run-make-fulldeps/obtain-borrowck/Makefile @@ -1,4 +1,4 @@ -include ../tools.mk +include ../../run-make/tools.mk # This example shows how to implement a rustc driver that retrieves MIR bodies # together with the borrow checker information. diff --git a/tests/run-make-fulldeps/output-filename-conflicts-with-directory/Makefile b/tests/run-make-fulldeps/output-filename-conflicts-with-directory/Makefile deleted file mode 100644 index 45221356c..000000000 --- a/tests/run-make-fulldeps/output-filename-conflicts-with-directory/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - cp foo.rs $(TMPDIR)/foo.rs - mkdir $(TMPDIR)/foo - $(RUSTC) $(TMPDIR)/foo.rs -o $(TMPDIR)/foo 2>&1 \ - | $(CGREP) -e "the generated executable for the input file \".*foo\.rs\" conflicts with the existing directory \".*foo\"" diff --git a/tests/run-make-fulldeps/output-filename-conflicts-with-directory/foo.rs b/tests/run-make-fulldeps/output-filename-conflicts-with-directory/foo.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/tests/run-make-fulldeps/output-filename-conflicts-with-directory/foo.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/output-filename-overwrites-input/Makefile b/tests/run-make-fulldeps/output-filename-overwrites-input/Makefile deleted file mode 100644 index 33069c06f..000000000 --- a/tests/run-make-fulldeps/output-filename-overwrites-input/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -include ../tools.mk - -all: - cp foo.rs $(TMPDIR)/foo - $(RUSTC) $(TMPDIR)/foo -o $(TMPDIR)/foo 2>&1 \ - | $(CGREP) -e "the input file \".*foo\" would be overwritten by the generated executable" - cp bar.rs $(TMPDIR)/bar.rlib - $(RUSTC) $(TMPDIR)/bar.rlib -o $(TMPDIR)/bar.rlib 2>&1 \ - | $(CGREP) -e "the input file \".*bar.rlib\" would be overwritten by the generated executable" - $(RUSTC) foo.rs 2>&1 && $(RUSTC) -Z ls $(TMPDIR)/foo 2>&1 - cp foo.rs $(TMPDIR)/foo.rs - $(RUSTC) $(TMPDIR)/foo.rs -o $(TMPDIR)/foo.rs 2>&1 \ - | $(CGREP) -e "the input file \".*foo.rs\" would be overwritten by the generated executable" diff --git a/tests/run-make-fulldeps/output-filename-overwrites-input/bar.rs b/tests/run-make-fulldeps/output-filename-overwrites-input/bar.rs deleted file mode 100644 index 83be6e807..000000000 --- a/tests/run-make-fulldeps/output-filename-overwrites-input/bar.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "lib"] diff --git a/tests/run-make-fulldeps/output-filename-overwrites-input/foo.rs b/tests/run-make-fulldeps/output-filename-overwrites-input/foo.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/tests/run-make-fulldeps/output-filename-overwrites-input/foo.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/output-type-permutations/Makefile b/tests/run-make-fulldeps/output-type-permutations/Makefile deleted file mode 100644 index 791606c64..000000000 --- a/tests/run-make-fulldeps/output-type-permutations/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs --crate-type=rlib,dylib,staticlib - $(call REMOVE_RLIBS,bar) - $(call REMOVE_DYLIBS,bar) - rm $(call STATICLIB,bar) - rm -f $(TMPDIR)/{lib,}bar.{dll.exp,dll.lib,pdb,dll.a} - # Check that $(TMPDIR) is empty. - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --crate-type=bin - rm $(TMPDIR)/$(call BIN,bar) - rm -f $(TMPDIR)/bar.pdb - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --emit=asm,llvm-ir,llvm-bc,obj,link - rm $(TMPDIR)/bar.ll - rm $(TMPDIR)/bar.bc - rm $(TMPDIR)/bar.s - rm $(TMPDIR)/bar.o - rm $(TMPDIR)/$(call BIN,bar) - rm -f $(TMPDIR)/bar.pdb - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --emit asm -o $(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --emit asm=$(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --emit=asm=$(TMPDIR)/foo - rm $(TMPDIR)/foo - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --emit llvm-bc -o $(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --emit llvm-bc=$(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --emit=llvm-bc=$(TMPDIR)/foo - rm $(TMPDIR)/foo - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --emit llvm-ir -o $(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --emit llvm-ir=$(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --emit=llvm-ir=$(TMPDIR)/foo - rm $(TMPDIR)/foo - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --emit obj -o $(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --emit obj=$(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --emit=obj=$(TMPDIR)/foo - rm $(TMPDIR)/foo - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --emit link -o $(TMPDIR)/$(call BIN,foo) - rm $(TMPDIR)/$(call BIN,foo) - $(RUSTC) foo.rs --emit link=$(TMPDIR)/$(call BIN,foo) - rm $(TMPDIR)/$(call BIN,foo) - $(RUSTC) foo.rs --emit=link=$(TMPDIR)/$(call BIN,foo) - rm $(TMPDIR)/$(call BIN,foo) - rm -f $(TMPDIR)/foo.pdb - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --crate-type=rlib -o $(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --crate-type=rlib --emit link=$(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --crate-type=rlib --emit=link=$(TMPDIR)/foo - rm $(TMPDIR)/foo - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --crate-type=dylib -o $(TMPDIR)/$(call BIN,foo) - rm $(TMPDIR)/$(call BIN,foo) - $(RUSTC) foo.rs --crate-type=dylib --emit link=$(TMPDIR)/$(call BIN,foo) - rm $(TMPDIR)/$(call BIN,foo) - $(RUSTC) foo.rs --crate-type=dylib --emit=link=$(TMPDIR)/$(call BIN,foo) - rm $(TMPDIR)/$(call BIN,foo) - rm -f $(TMPDIR)/{lib,}foo.{dll.exp,dll.lib,pdb,dll.a,exe.a} - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] || (ls -1 $(TMPDIR) && exit 1) - - $(RUSTC) foo.rs --crate-type=staticlib -o $(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --crate-type=staticlib --emit link=$(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --crate-type=staticlib --emit=link=$(TMPDIR)/foo - rm $(TMPDIR)/foo - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --crate-type=bin -o $(TMPDIR)/$(call BIN,foo) - rm $(TMPDIR)/$(call BIN,foo) - $(RUSTC) foo.rs --crate-type=bin --emit link=$(TMPDIR)/$(call BIN,foo) - rm $(TMPDIR)/$(call BIN,foo) - $(RUSTC) foo.rs --crate-type=bin --emit=link=$(TMPDIR)/$(call BIN,foo) - rm $(TMPDIR)/$(call BIN,foo) - rm -f $(TMPDIR)/foo.pdb - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --emit llvm-ir=$(TMPDIR)/ir \ - --emit link \ - --crate-type=rlib - rm $(TMPDIR)/ir - rm $(TMPDIR)/libbar.rlib - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --emit asm=$(TMPDIR)/asm \ - --emit llvm-ir=$(TMPDIR)/ir \ - --emit llvm-bc=$(TMPDIR)/bc \ - --emit obj=$(TMPDIR)/obj \ - --emit link=$(TMPDIR)/link \ - --crate-type=staticlib - rm $(TMPDIR)/asm - rm $(TMPDIR)/ir - rm $(TMPDIR)/bc - rm $(TMPDIR)/obj - rm $(TMPDIR)/link - $(RUSTC) foo.rs --emit=asm=$(TMPDIR)/asm \ - --emit llvm-ir=$(TMPDIR)/ir \ - --emit=llvm-bc=$(TMPDIR)/bc \ - --emit obj=$(TMPDIR)/obj \ - --emit=link=$(TMPDIR)/link \ - --crate-type=staticlib - rm $(TMPDIR)/asm - rm $(TMPDIR)/ir - rm $(TMPDIR)/bc - rm $(TMPDIR)/obj - rm $(TMPDIR)/link - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --emit=asm,llvm-ir,llvm-bc,obj,link --crate-type=staticlib - rm $(TMPDIR)/bar.ll - rm $(TMPDIR)/bar.s - rm $(TMPDIR)/bar.o - rm $(call STATICLIB,bar) - mv $(TMPDIR)/bar.bc $(TMPDIR)/foo.bc - # Don't check that the $(TMPDIR) is empty - we left `foo.bc` for later - # comparison. - - $(RUSTC) foo.rs --emit=llvm-bc,link --crate-type=rlib - cmp $(TMPDIR)/foo.bc $(TMPDIR)/bar.bc - rm $(TMPDIR)/bar.bc - rm $(TMPDIR)/foo.bc - $(call REMOVE_RLIBS,bar) - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] diff --git a/tests/run-make-fulldeps/output-type-permutations/foo.rs b/tests/run-make-fulldeps/output-type-permutations/foo.rs deleted file mode 100644 index f0a2cc6ad..000000000 --- a/tests/run-make-fulldeps/output-type-permutations/foo.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_name = "bar"] - -fn main() {} diff --git a/tests/run-make-fulldeps/output-with-hyphens/Makefile b/tests/run-make-fulldeps/output-with-hyphens/Makefile deleted file mode 100644 index 365fb6e59..000000000 --- a/tests/run-make-fulldeps/output-with-hyphens/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo-bar.rs --crate-type bin - [ -f $(TMPDIR)/$(call BIN,foo-bar) ] - $(RUSTC) foo-bar.rs --crate-type lib - [ -f $(TMPDIR)/libfoo_bar.rlib ] diff --git a/tests/run-make-fulldeps/output-with-hyphens/foo-bar.rs b/tests/run-make-fulldeps/output-with-hyphens/foo-bar.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/tests/run-make-fulldeps/output-with-hyphens/foo-bar.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/override-aliased-flags/Makefile b/tests/run-make-fulldeps/override-aliased-flags/Makefile deleted file mode 100644 index 186b8c7c8..000000000 --- a/tests/run-make-fulldeps/override-aliased-flags/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -include ../tools.mk - -# FIXME: it would be good to check that it's actually the rightmost flags -# that are used when multiple flags are specified, but I can't think of a -# reliable way to check this. - -all: - # Test that `-O` and `-C opt-level` can be specified multiple times. - # The rightmost flag will be used over any previous flags. - $(RUSTC) -O -O main.rs - $(RUSTC) -O -C opt-level=0 main.rs - $(RUSTC) -C opt-level=0 -O main.rs - $(RUSTC) -C opt-level=0 -C opt-level=2 main.rs - $(RUSTC) -C opt-level=2 -C opt-level=0 main.rs - - # Test that `-g` and `-C debuginfo` can be specified multiple times. - # The rightmost flag will be used over any previous flags. - $(RUSTC) -g -g main.rs - $(RUSTC) -g -C debuginfo=0 main.rs - $(RUSTC) -C debuginfo=0 -g main.rs - $(RUSTC) -C debuginfo=0 -C debuginfo=2 main.rs - $(RUSTC) -C debuginfo=2 -C debuginfo=0 main.rs diff --git a/tests/run-make-fulldeps/override-aliased-flags/main.rs b/tests/run-make-fulldeps/override-aliased-flags/main.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/tests/run-make-fulldeps/override-aliased-flags/main.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/panic-impl-transitive/Makefile b/tests/run-make-fulldeps/panic-impl-transitive/Makefile deleted file mode 100644 index c3192efcb..000000000 --- a/tests/run-make-fulldeps/panic-impl-transitive/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../../run-make-fulldeps/tools.mk - -# NOTE we use --emit=llvm-ir to avoid running the linker (linking will fail because there's no main -# in this crate) -all: - $(RUSTC) panic-impl-provider.rs - $(RUSTC) panic-impl-consumer.rs -C panic=abort --emit=llvm-ir -L $(TMPDIR) diff --git a/tests/run-make-fulldeps/panic-impl-transitive/panic-impl-consumer.rs b/tests/run-make-fulldeps/panic-impl-transitive/panic-impl-consumer.rs deleted file mode 100644 index 82a98b12d..000000000 --- a/tests/run-make-fulldeps/panic-impl-transitive/panic-impl-consumer.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![no_std] -#![no_main] - -// this crate provides the `panic_impl` lang item so we don't need to define it here -extern crate panic_impl_provider; diff --git a/tests/run-make-fulldeps/panic-impl-transitive/panic-impl-provider.rs b/tests/run-make-fulldeps/panic-impl-transitive/panic-impl-provider.rs deleted file mode 100644 index f1b9873c8..000000000 --- a/tests/run-make-fulldeps/panic-impl-transitive/panic-impl-provider.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![crate_type = "rlib"] -#![no_std] - -use core::panic::PanicInfo; - -#[panic_handler] -fn panic(info: &PanicInfo) -> ! { - loop {} -} diff --git a/tests/run-make-fulldeps/pass-non-c-like-enum-to-c/Makefile b/tests/run-make-fulldeps/pass-non-c-like-enum-to-c/Makefile deleted file mode 100644 index 42d3c977f..000000000 --- a/tests/run-make-fulldeps/pass-non-c-like-enum-to-c/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,test) - $(RUSTC) nonclike.rs -L$(TMPDIR) -ltest - $(call RUN,nonclike) diff --git a/tests/run-make-fulldeps/pass-non-c-like-enum-to-c/nonclike.rs b/tests/run-make-fulldeps/pass-non-c-like-enum-to-c/nonclike.rs deleted file mode 100644 index 517286a86..000000000 --- a/tests/run-make-fulldeps/pass-non-c-like-enum-to-c/nonclike.rs +++ /dev/null @@ -1,21 +0,0 @@ -#[repr(C, u8)] -pub enum TT { - AA(u64, u64), - BB, -} - -#[repr(C,u8)] -pub enum T { - A(u64), - B, -} - -extern "C" { - pub fn t_add(a: T, b: T) -> u64; - pub fn tt_add(a: TT, b: TT) -> u64; -} - -fn main() { - assert_eq!(33, unsafe { tt_add(TT::AA(1,2), TT::AA(10,20)) }); - assert_eq!(11, unsafe { t_add(T::A(1), T::A(10)) }); -} diff --git a/tests/run-make-fulldeps/pass-non-c-like-enum-to-c/test.c b/tests/run-make-fulldeps/pass-non-c-like-enum-to-c/test.c deleted file mode 100644 index 99511b253..000000000 --- a/tests/run-make-fulldeps/pass-non-c-like-enum-to-c/test.c +++ /dev/null @@ -1,85 +0,0 @@ -#include - -/* This is the code generated by cbindgen 0.12.1 for the `enum TT` - * type in nonclike.rs . */ -enum TT_Tag { - AA, - BB, -}; -typedef uint8_t TT_Tag; - -typedef struct { - uint64_t _0; - uint64_t _1; -} AA_Body; - -typedef struct { - TT_Tag tag; - union { - AA_Body aa; - }; -} TT; - -/* This is the code generated by cbindgen 0.12.1 for the `enum T` type - * in nonclike.rs . */ -enum T_Tag { - A, - B, -}; -typedef uint8_t T_Tag; - -typedef struct { - uint64_t _0; -} A_Body; - -typedef struct { - T_Tag tag; - union { - A_Body a; - }; -} T; - -uint64_t tt_add(TT a, TT b) { - if (a.tag == AA && b.tag == AA) { - return a.aa._0 + a.aa._1 + b.aa._0 + b.aa._1; - } else if (a.tag == AA) { - return a.aa._0 + a.aa._1; - } else if (b.tag == BB) { - return b.aa._0 + b.aa._1; - } else { - return 0; - } -} - -uint64_t t_add(T a, T b) { - if (a.tag == A && b.tag == A) { - return a.a._0 + b.a._0; - } else if (a.tag == AA) { - return a.a._0; - } else if (b.tag == BB) { - return b.a._0; - } else { - return 0; - } -} - -TT tt_new(uint64_t a, uint64_t b) { - TT tt = { - .tag = AA, - .aa = { - ._0 = a, - ._1 = b, - }, - }; - return tt; -} - -T t_new(uint64_t a) { - T t = { - .tag = A, - .a = { - ._0 = a, - }, - }; - return t; -} diff --git a/tests/run-make-fulldeps/pgo-branch-weights/Makefile b/tests/run-make-fulldeps/pgo-branch-weights/Makefile deleted file mode 100644 index c60206a1f..000000000 --- a/tests/run-make-fulldeps/pgo-branch-weights/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -# needs-profiler-support -# ignore-windows-gnu - -# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works -# properly. Since we only have GCC on the CI ignore the test for now. - -include ../tools.mk - -# For some very small programs GNU ld seems to not properly handle -# instrumentation sections correctly. Neither Gold nor LLD have that problem. -ifeq ($(UNAME),Linux) -ifneq (,$(findstring x86,$(TARGET))) -COMMON_FLAGS=-Clink-args=-fuse-ld=gold -endif -endif - - -all: - # We don't compile `opaque` with either optimizations or instrumentation. - $(RUSTC) $(COMMON_FLAGS) opaque.rs || exit 1 - # Compile the test program with instrumentation - mkdir -p "$(TMPDIR)/prof_data_dir" || exit 1 - $(RUSTC) $(COMMON_FLAGS) interesting.rs \ - -Cprofile-generate="$(TMPDIR)/prof_data_dir" -O -Ccodegen-units=1 || exit 1 - $(RUSTC) $(COMMON_FLAGS) main.rs -Cprofile-generate="$(TMPDIR)/prof_data_dir" -O || exit 1 - # The argument below generates to the expected branch weights - $(call RUN,main aaaaaaaaaaaa2bbbbbbbbbbbb2bbbbbbbbbbbbbbbbcc) || exit 1 - "$(LLVM_BIN_DIR)/llvm-profdata" merge \ - -o "$(TMPDIR)/prof_data_dir/merged.profdata" \ - "$(TMPDIR)/prof_data_dir" || exit 1 - $(RUSTC) $(COMMON_FLAGS) interesting.rs \ - -Cprofile-use="$(TMPDIR)/prof_data_dir/merged.profdata" -O \ - -Ccodegen-units=1 --emit=llvm-ir || exit 1 - cat "$(TMPDIR)/interesting.ll" | "$(LLVM_FILECHECK)" filecheck-patterns.txt diff --git a/tests/run-make-fulldeps/pgo-branch-weights/filecheck-patterns.txt b/tests/run-make-fulldeps/pgo-branch-weights/filecheck-patterns.txt deleted file mode 100644 index 70d5a645c..000000000 --- a/tests/run-make-fulldeps/pgo-branch-weights/filecheck-patterns.txt +++ /dev/null @@ -1,24 +0,0 @@ - -# First, establish that certain !prof labels are attached to the expected -# functions and branching instructions. - -CHECK: define void @function_called_twice(i32 {{.*}} !prof [[function_called_twice_id:![0-9]+]] { -CHECK: br i1 {{.*}}, label {{.*}}, label {{.*}}, !prof [[branch_weights0:![0-9]+]] - -CHECK: define void @function_called_42_times(i32{{.*}} %c) {{.*}} !prof [[function_called_42_times_id:![0-9]+]] { -CHECK: switch i32 %c, label {{.*}} [ -CHECK-NEXT: i32 97, label {{.*}} -CHECK-NEXT: i32 98, label {{.*}} -CHECK-NEXT: ], !prof [[branch_weights1:![0-9]+]] - -CHECK: define void @function_called_never(i32 {{.*}} !prof [[function_called_never_id:![0-9]+]] { - - - -# Now check that those !prof tags hold the expected counts - -CHECK: [[function_called_twice_id]] = !{!"function_entry_count", i64 2} -CHECK: [[branch_weights0]] = !{!"branch_weights", i32 2, i32 0} -CHECK: [[function_called_42_times_id]] = !{!"function_entry_count", i64 42} -CHECK: [[branch_weights1]] = !{!"branch_weights", i32 2, i32 12, i32 28} -CHECK: [[function_called_never_id]] = !{!"function_entry_count", i64 0} diff --git a/tests/run-make-fulldeps/pgo-branch-weights/interesting.rs b/tests/run-make-fulldeps/pgo-branch-weights/interesting.rs deleted file mode 100644 index a26d6fd69..000000000 --- a/tests/run-make-fulldeps/pgo-branch-weights/interesting.rs +++ /dev/null @@ -1,40 +0,0 @@ -#![crate_name="interesting"] -#![crate_type="rlib"] - -extern crate opaque; - -#[no_mangle] -#[inline(never)] -pub fn function_called_twice(c: char) { - if c == '2' { - // This branch is taken twice - opaque::f1(); - } else { - // This branch is never taken - opaque::f2(); - } -} - -#[no_mangle] -#[inline(never)] -pub fn function_called_42_times(c: char) { - if c == 'a' { - // This branch is taken 12 times - opaque::f1(); - } else { - - if c == 'b' { - // This branch is taken 28 times - opaque::f2(); - } else { - // This branch is taken 2 times - opaque::f3(); - } - } -} - -#[no_mangle] -#[inline(never)] -pub fn function_called_never(_: char) { - opaque::f1(); -} diff --git a/tests/run-make-fulldeps/pgo-branch-weights/main.rs b/tests/run-make-fulldeps/pgo-branch-weights/main.rs deleted file mode 100644 index 619cf9c69..000000000 --- a/tests/run-make-fulldeps/pgo-branch-weights/main.rs +++ /dev/null @@ -1,17 +0,0 @@ -extern crate interesting; - -fn main() { - let arg = std::env::args().skip(1).next().unwrap(); - - for c in arg.chars() { - if c == '2' { - interesting::function_called_twice(c); - } else { - interesting::function_called_42_times(c); - } - - if c == '0' { - interesting::function_called_never(c); - } - } -} diff --git a/tests/run-make-fulldeps/pgo-branch-weights/opaque.rs b/tests/run-make-fulldeps/pgo-branch-weights/opaque.rs deleted file mode 100644 index 72f93c9fe..000000000 --- a/tests/run-make-fulldeps/pgo-branch-weights/opaque.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_name="opaque"] -#![crate_type="rlib"] - -pub fn f1() {} -pub fn f2() {} -pub fn f3() {} diff --git a/tests/run-make-fulldeps/pgo-gen-lto/Makefile b/tests/run-make-fulldeps/pgo-gen-lto/Makefile deleted file mode 100644 index 3f2f6a838..000000000 --- a/tests/run-make-fulldeps/pgo-gen-lto/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# needs-profiler-support -# ignore-windows-gnu - -# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works -# properly. Since we only have GCC on the CI ignore the test for now. - -include ../tools.mk - -COMPILE_FLAGS=-Copt-level=3 -Clto=fat -Cprofile-generate="$(TMPDIR)" - -all: - $(RUSTC) $(COMPILE_FLAGS) test.rs - $(call RUN,test) || exit 1 - [ -e "$(TMPDIR)"/default_*.profraw ] || (echo "No .profraw file"; exit 1) diff --git a/tests/run-make-fulldeps/pgo-gen-lto/test.rs b/tests/run-make-fulldeps/pgo-gen-lto/test.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/tests/run-make-fulldeps/pgo-gen-lto/test.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/pgo-gen-no-imp-symbols/Makefile b/tests/run-make-fulldeps/pgo-gen-no-imp-symbols/Makefile deleted file mode 100644 index 7f72b11b6..000000000 --- a/tests/run-make-fulldeps/pgo-gen-no-imp-symbols/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# needs-profiler-support - -include ../tools.mk - -COMPILE_FLAGS=-O -Ccodegen-units=1 -Cprofile-generate="$(TMPDIR)" - -all: - $(RUSTC) $(COMPILE_FLAGS) --emit=llvm-ir test.rs - # We expect symbols starting with "__llvm_profile_". - $(CGREP) "__llvm_profile_" < $(TMPDIR)/test.ll - # We do NOT expect the "__imp_" version of these symbols. - $(CGREP) -v "__imp___llvm_profile_" < $(TMPDIR)/test.ll # 64 bit - $(CGREP) -v "__imp____llvm_profile_" < $(TMPDIR)/test.ll # 32 bit diff --git a/tests/run-make-fulldeps/pgo-gen-no-imp-symbols/test.rs b/tests/run-make-fulldeps/pgo-gen-no-imp-symbols/test.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/tests/run-make-fulldeps/pgo-gen-no-imp-symbols/test.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/pgo-gen/Makefile b/tests/run-make-fulldeps/pgo-gen/Makefile deleted file mode 100644 index 4623a7495..000000000 --- a/tests/run-make-fulldeps/pgo-gen/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# needs-profiler-support -# ignore-windows-gnu - -# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works -# properly. Since we only have GCC on the CI ignore the test for now. - -include ../tools.mk - -COMPILE_FLAGS=-g -Cprofile-generate="$(TMPDIR)" - -all: - $(RUSTC) $(COMPILE_FLAGS) test.rs - $(call RUN,test) || exit 1 - [ -e "$(TMPDIR)"/default_*.profraw ] || (echo "No .profraw file"; exit 1) diff --git a/tests/run-make-fulldeps/pgo-gen/test.rs b/tests/run-make-fulldeps/pgo-gen/test.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/tests/run-make-fulldeps/pgo-gen/test.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/pgo-indirect-call-promotion/Makefile b/tests/run-make-fulldeps/pgo-indirect-call-promotion/Makefile deleted file mode 100644 index 45302215c..000000000 --- a/tests/run-make-fulldeps/pgo-indirect-call-promotion/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# needs-profiler-support -# ignore-windows-gnu - -# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works -# properly. Since we only have GCC on the CI ignore the test for now. - -include ../tools.mk - -all: - # We don't compile `opaque` with either optimizations or instrumentation. - # We don't compile `opaque` with either optimizations or instrumentation. - $(RUSTC) $(COMMON_FLAGS) opaque.rs - # Compile the test program with instrumentation - mkdir -p "$(TMPDIR)"/prof_data_dir - $(RUSTC) $(COMMON_FLAGS) interesting.rs \ - -Cprofile-generate="$(TMPDIR)"/prof_data_dir -O -Ccodegen-units=1 - $(RUSTC) $(COMMON_FLAGS) main.rs -Cprofile-generate="$(TMPDIR)"/prof_data_dir -O - # The argument below generates to the expected branch weights - $(call RUN,main) || exit 1 - "$(LLVM_BIN_DIR)"/llvm-profdata merge \ - -o "$(TMPDIR)"/prof_data_dir/merged.profdata \ - "$(TMPDIR)"/prof_data_dir - $(RUSTC) $(COMMON_FLAGS) interesting.rs \ - -Cprofile-use="$(TMPDIR)"/prof_data_dir/merged.profdata -O \ - -Ccodegen-units=1 --emit=llvm-ir - cat "$(TMPDIR)"/interesting.ll | "$(LLVM_FILECHECK)" filecheck-patterns.txt diff --git a/tests/run-make-fulldeps/pgo-indirect-call-promotion/filecheck-patterns.txt b/tests/run-make-fulldeps/pgo-indirect-call-promotion/filecheck-patterns.txt deleted file mode 100644 index e19c78350..000000000 --- a/tests/run-make-fulldeps/pgo-indirect-call-promotion/filecheck-patterns.txt +++ /dev/null @@ -1,16 +0,0 @@ -CHECK: define void @call_a_bunch_of_functions({{.*}} { - -# Make sure that indirect call promotion inserted a check against the most -# frequently called function. -CHECK: %{{.*}} = icmp eq {{void \(\)\*|ptr}} %{{.*}}, @function_called_always - -# Check that the call to `function_called_always` was inlined, so that we -# directly call `opaque_f1` from the upstream crate. -CHECK: call void @opaque_f1() - - -# Same checks as above, repeated for the trait object case - -CHECK: define void @call_a_bunch_of_trait_methods({{.*}} -CHECK: %{{.*}} = icmp eq {{void \(\{\}\*\)\*|ptr}} %{{.*}}, {{.*}}@foo -CHECK: tail call void @opaque_f2() diff --git a/tests/run-make-fulldeps/pgo-indirect-call-promotion/interesting.rs b/tests/run-make-fulldeps/pgo-indirect-call-promotion/interesting.rs deleted file mode 100644 index 4fd096d62..000000000 --- a/tests/run-make-fulldeps/pgo-indirect-call-promotion/interesting.rs +++ /dev/null @@ -1,56 +0,0 @@ -#![crate_name="interesting"] -#![crate_type="rlib"] - -extern crate opaque; - -#[no_mangle] -pub fn function_called_always() { - opaque::opaque_f1(); -} - -#[no_mangle] -pub fn function_called_never() { - opaque::opaque_f2(); -} - -#[no_mangle] -pub fn call_a_bunch_of_functions(fns: &[fn()]) { - - // Indirect call promotion transforms the below into something like - // - // for f in fns { - // if f == function_called_always { - // function_called_always() - // } else { - // f(); - // } - // } - // - // where `function_called_always` actually gets inlined too. - - for f in fns { - f(); - } -} - - -pub trait Foo { - fn foo(&self); -} - -impl Foo for u32 { - - #[no_mangle] - fn foo(&self) { - opaque::opaque_f2(); - } -} - -#[no_mangle] -pub fn call_a_bunch_of_trait_methods(trait_objects: &[&dyn Foo]) { - - // Same as above, just with vtables in between - for x in trait_objects { - x.foo(); - } -} diff --git a/tests/run-make-fulldeps/pgo-indirect-call-promotion/main.rs b/tests/run-make-fulldeps/pgo-indirect-call-promotion/main.rs deleted file mode 100644 index 27181f307..000000000 --- a/tests/run-make-fulldeps/pgo-indirect-call-promotion/main.rs +++ /dev/null @@ -1,14 +0,0 @@ -extern crate interesting; - -fn main() { - // function pointer case - let fns: Vec<_> = std::iter::repeat(interesting::function_called_always as fn()) - .take(1000) - .collect(); - interesting::call_a_bunch_of_functions(&fns[..]); - - // Trait object case - let trait_objects = vec![0u32; 1000]; - let trait_objects: Vec<_> = trait_objects.iter().map(|x| x as &dyn interesting::Foo).collect(); - interesting::call_a_bunch_of_trait_methods(&trait_objects[..]); -} diff --git a/tests/run-make-fulldeps/pgo-indirect-call-promotion/opaque.rs b/tests/run-make-fulldeps/pgo-indirect-call-promotion/opaque.rs deleted file mode 100644 index 9628d711c..000000000 --- a/tests/run-make-fulldeps/pgo-indirect-call-promotion/opaque.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![crate_name="opaque"] -#![crate_type="rlib"] - -#[no_mangle] -pub fn opaque_f1() {} -#[no_mangle] -pub fn opaque_f2() {} diff --git a/tests/run-make-fulldeps/pgo-use/Makefile b/tests/run-make-fulldeps/pgo-use/Makefile deleted file mode 100644 index 3bac9b77a..000000000 --- a/tests/run-make-fulldeps/pgo-use/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# needs-profiler-support -# ignore-windows-gnu - -# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works -# properly. Since we only have GCC on the CI ignore the test for now. - -include ../tools.mk - -# This test makes sure that PGO profiling data leads to cold functions being -# marked as `cold` and hot functions with `inlinehint`. -# The test program contains an `if` were actual execution only ever takes the -# `else` branch. Accordingly, we expect the function that is never called to -# be marked as cold. -# -# Disable the pre-inlining pass (i.e. a pass that does some inlining before -# it adds the profiling instrumentation). Disabling this pass leads to -# rather predictable IR which we need for this test to be stable. - -COMMON_FLAGS=-Copt-level=2 -Ccodegen-units=1 -Cllvm-args=-disable-preinline - -ifeq ($(UNAME),Darwin) -# macOS does not have the `tac` command, but `tail -r` does the same thing -TAC := tail -r -else -# some other platforms don't support the `-r` flag for `tail`, so use `tac` -TAC := tac -endif - -all: - # Compile the test program with instrumentation - $(RUSTC) $(COMMON_FLAGS) -Cprofile-generate="$(TMPDIR)" main.rs - # Run it in order to generate some profiling data - $(call RUN,main some-argument) || exit 1 - # Postprocess the profiling data so it can be used by the compiler - "$(LLVM_BIN_DIR)"/llvm-profdata merge \ - -o "$(TMPDIR)"/merged.profdata \ - "$(TMPDIR)"/default_*.profraw - # Compile the test program again, making use of the profiling data - $(RUSTC) $(COMMON_FLAGS) -Cprofile-use="$(TMPDIR)"/merged.profdata --emit=llvm-ir main.rs - # Check that the generate IR contains some things that we expect - # - # We feed the file into LLVM FileCheck tool *in reverse* so that we see the - # line with the function name before the line with the function attributes. - # FileCheck only supports checking that something matches on the next line, - # but not if something matches on the previous line. - $(TAC) "$(TMPDIR)"/main.ll | "$(LLVM_FILECHECK)" filecheck-patterns.txt diff --git a/tests/run-make-fulldeps/pgo-use/filecheck-patterns.txt b/tests/run-make-fulldeps/pgo-use/filecheck-patterns.txt deleted file mode 100644 index 6da34f88f..000000000 --- a/tests/run-make-fulldeps/pgo-use/filecheck-patterns.txt +++ /dev/null @@ -1,11 +0,0 @@ -# Add a check that the IR contains some expected metadata -CHECK: !{!"ProfileFormat", !"InstrProf"} -CHECK: !"ProfileSummary" - -# Make sure that the hot function is marked with `inlinehint` -CHECK: define {{.*}} @hot_function -CHECK-NEXT: Function Attrs:{{.*}}inlinehint - -# Make sure that the cold function is marked with `cold` -CHECK: define {{.*}} @cold_function -CHECK-NEXT: Function Attrs:{{.*}}cold diff --git a/tests/run-make-fulldeps/pgo-use/main.rs b/tests/run-make-fulldeps/pgo-use/main.rs deleted file mode 100644 index eb9192c87..000000000 --- a/tests/run-make-fulldeps/pgo-use/main.rs +++ /dev/null @@ -1,23 +0,0 @@ -#[no_mangle] -pub fn cold_function(c: u8) { - println!("cold {}", c); -} - -#[no_mangle] -pub fn hot_function(c: u8) { - std::env::set_var(format!("var{}", c), format!("hot {}", c)); -} - -fn main() { - let arg = std::env::args().skip(1).next().unwrap(); - - for i in 0 .. 1000_000 { - let some_value = arg.as_bytes()[i % arg.len()]; - if some_value == b'!' { - // This branch is never taken at runtime - cold_function(some_value); - } else { - hot_function(some_value); - } - } -} diff --git a/tests/run-make-fulldeps/pointer-auth-link-with-c/Makefile b/tests/run-make-fulldeps/pointer-auth-link-with-c/Makefile deleted file mode 100644 index 7acea0380..000000000 --- a/tests/run-make-fulldeps/pointer-auth-link-with-c/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -include ../tools.mk - -# only-aarch64 - -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 - $(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 - $(call RUN,test) diff --git a/tests/run-make-fulldeps/pointer-auth-link-with-c/test.c b/tests/run-make-fulldeps/pointer-auth-link-with-c/test.c deleted file mode 100644 index 9fe07f82f..000000000 --- a/tests/run-make-fulldeps/pointer-auth-link-with-c/test.c +++ /dev/null @@ -1 +0,0 @@ -int foo() { return 0; } diff --git a/tests/run-make-fulldeps/pointer-auth-link-with-c/test.rs b/tests/run-make-fulldeps/pointer-auth-link-with-c/test.rs deleted file mode 100644 index 615ad0aeb..000000000 --- a/tests/run-make-fulldeps/pointer-auth-link-with-c/test.rs +++ /dev/null @@ -1,8 +0,0 @@ -#[link(name = "test")] -extern "C" { - fn foo() -> i32; -} - -fn main() { - unsafe {foo();} -} diff --git a/tests/run-make-fulldeps/prefer-dylib/Makefile b/tests/run-make-fulldeps/prefer-dylib/Makefile deleted file mode 100644 index 3817ca195..000000000 --- a/tests/run-make-fulldeps/prefer-dylib/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) bar.rs --crate-type=dylib --crate-type=rlib -C prefer-dynamic - $(RUSTC) foo.rs -C prefer-dynamic - $(call RUN,foo) - rm $(TMPDIR)/*bar* - $(call FAIL,foo) diff --git a/tests/run-make-fulldeps/prefer-dylib/bar.rs b/tests/run-make-fulldeps/prefer-dylib/bar.rs deleted file mode 100644 index c5c0bc606..000000000 --- a/tests/run-make-fulldeps/prefer-dylib/bar.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn bar() {} diff --git a/tests/run-make-fulldeps/prefer-dylib/foo.rs b/tests/run-make-fulldeps/prefer-dylib/foo.rs deleted file mode 100644 index 8d68535e3..000000000 --- a/tests/run-make-fulldeps/prefer-dylib/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate bar; - -fn main() { - bar::bar(); -} diff --git a/tests/run-make-fulldeps/prefer-rlib/Makefile b/tests/run-make-fulldeps/prefer-rlib/Makefile deleted file mode 100644 index adc345d76..000000000 --- a/tests/run-make-fulldeps/prefer-rlib/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) bar.rs --crate-type=dylib --crate-type=rlib - ls $(TMPDIR)/$(call RLIB_GLOB,bar) - $(RUSTC) foo.rs - rm $(TMPDIR)/*bar* - $(call RUN,foo) diff --git a/tests/run-make-fulldeps/prefer-rlib/bar.rs b/tests/run-make-fulldeps/prefer-rlib/bar.rs deleted file mode 100644 index c5c0bc606..000000000 --- a/tests/run-make-fulldeps/prefer-rlib/bar.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn bar() {} diff --git a/tests/run-make-fulldeps/prefer-rlib/foo.rs b/tests/run-make-fulldeps/prefer-rlib/foo.rs deleted file mode 100644 index 8d68535e3..000000000 --- a/tests/run-make-fulldeps/prefer-rlib/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate bar; - -fn main() { - bar::bar(); -} diff --git a/tests/run-make-fulldeps/pretty-expanded/Makefile b/tests/run-make-fulldeps/pretty-expanded/Makefile index 5a0097a83..48199179e 100644 --- a/tests/run-make-fulldeps/pretty-expanded/Makefile +++ b/tests/run-make-fulldeps/pretty-expanded/Makefile @@ -1,4 +1,4 @@ -include ../tools.mk +include ../../run-make/tools.mk all: $(RUSTC) -o $(TMPDIR)/input.expanded.rs -Zunpretty=expanded input.rs diff --git a/tests/run-make-fulldeps/pretty-print-to-file/Makefile b/tests/run-make-fulldeps/pretty-print-to-file/Makefile deleted file mode 100644 index ca11b8c47..000000000 --- a/tests/run-make-fulldeps/pretty-print-to-file/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) -o $(TMPDIR)/input.out -Zunpretty=normal input.rs - diff -u $(TMPDIR)/input.out input.pp diff --git a/tests/run-make-fulldeps/pretty-print-to-file/input.pp b/tests/run-make-fulldeps/pretty-print-to-file/input.pp deleted file mode 100644 index e3f03242a..000000000 --- a/tests/run-make-fulldeps/pretty-print-to-file/input.pp +++ /dev/null @@ -1,3 +0,0 @@ - -#[crate_type = "lib"] -pub fn foo() -> i32 { 45 } diff --git a/tests/run-make-fulldeps/pretty-print-to-file/input.rs b/tests/run-make-fulldeps/pretty-print-to-file/input.rs deleted file mode 100644 index aa828155b..000000000 --- a/tests/run-make-fulldeps/pretty-print-to-file/input.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[crate_type="lib"] - -pub fn -foo() -> i32 -{ 45 } diff --git a/tests/run-make-fulldeps/print-calling-conventions/Makefile b/tests/run-make-fulldeps/print-calling-conventions/Makefile deleted file mode 100644 index d3fd06392..000000000 --- a/tests/run-make-fulldeps/print-calling-conventions/Makefile +++ /dev/null @@ -1,4 +0,0 @@ --include ../tools.mk - -all: - $(RUSTC) --print calling-conventions diff --git a/tests/run-make-fulldeps/print-cfg/Makefile b/tests/run-make-fulldeps/print-cfg/Makefile deleted file mode 100644 index 126f5768c..000000000 --- a/tests/run-make-fulldeps/print-cfg/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# needs-llvm-components: x86 arm - -include ../tools.mk - -all: default - $(RUSTC) --target x86_64-pc-windows-gnu --print cfg | $(CGREP) windows - $(RUSTC) --target x86_64-pc-windows-gnu --print cfg | $(CGREP) x86_64 - $(RUSTC) --target i686-pc-windows-msvc --print cfg | $(CGREP) msvc - $(RUSTC) --target i686-apple-darwin --print cfg | $(CGREP) macos - $(RUSTC) --target i686-unknown-linux-gnu --print cfg | $(CGREP) gnu - $(RUSTC) --target arm-unknown-linux-gnueabihf --print cfg | $(CGREP) target_abi= - $(RUSTC) --target arm-unknown-linux-gnueabihf --print cfg | $(CGREP) eabihf - -ifdef IS_WINDOWS -default: - $(RUSTC) --print cfg | $(CGREP) windows -else -default: - $(RUSTC) --print cfg | $(CGREP) unix -endif diff --git a/tests/run-make-fulldeps/print-target-list/Makefile b/tests/run-make-fulldeps/print-target-list/Makefile deleted file mode 100644 index f23c40d42..000000000 --- a/tests/run-make-fulldeps/print-target-list/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -# Checks that all the targets returned by `rustc --print target-list` are valid -# target specifications -all: - for target in $(shell $(BARE_RUSTC) --print target-list); do \ - $(BARE_RUSTC) --target $$target --print sysroot; \ - done diff --git a/tests/run-make-fulldeps/profile/Makefile b/tests/run-make-fulldeps/profile/Makefile deleted file mode 100644 index fffc051ad..000000000 --- a/tests/run-make-fulldeps/profile/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# needs-profiler-support - -include ../tools.mk - -all: - $(RUSTC) -g -Z profile test.rs - $(call RUN,test) || exit 1 - [ -e "$(TMPDIR)/test.gcno" ] || (echo "No .gcno file"; exit 1) - [ -e "$(TMPDIR)/test.gcda" ] || (echo "No .gcda file"; exit 1) - $(RUSTC) -g -Z profile -Z profile-emit=$(TMPDIR)/abc/abc.gcda test.rs - $(call RUN,test) || exit 1 - [ -e "$(TMPDIR)/abc/abc.gcda" ] || (echo "gcda file not emitted to defined path"; exit 1) diff --git a/tests/run-make-fulldeps/profile/test.rs b/tests/run-make-fulldeps/profile/test.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/tests/run-make-fulldeps/profile/test.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/prune-link-args/Makefile b/tests/run-make-fulldeps/prune-link-args/Makefile deleted file mode 100644 index a359dc5ae..000000000 --- a/tests/run-make-fulldeps/prune-link-args/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -# ignore-windows - -# Notice the space in the end, this emulates the output of pkg-config -RUSTC_FLAGS = -C link-args="-lc " - -all: - $(RUSTC) $(RUSTC_FLAGS) empty.rs diff --git a/tests/run-make-fulldeps/prune-link-args/empty.rs b/tests/run-make-fulldeps/prune-link-args/empty.rs deleted file mode 100644 index 45590d86b..000000000 --- a/tests/run-make-fulldeps/prune-link-args/empty.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() { } diff --git a/tests/run-make-fulldeps/redundant-libs/Makefile b/tests/run-make-fulldeps/redundant-libs/Makefile deleted file mode 100644 index b2dff05d1..000000000 --- a/tests/run-make-fulldeps/redundant-libs/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -include ../tools.mk - -# ignore-windows-msvc - -# rustc will remove one of the two redundant references to foo below. Depending -# on which one gets removed, we'll get a linker error on SOME platforms (like -# Linux). On these platforms, when a library is referenced, the linker will -# only pull in the symbols needed _at that point in time_. If a later library -# depends on additional symbols from the library, they will not have been pulled -# in, and you'll get undefined symbols errors. -# -# So in this example, we need to ensure that rustc keeps the _later_ reference -# to foo, and not the former one. -RUSTC_FLAGS = \ - -l static=bar \ - -l foo \ - -l static=baz \ - -l foo \ - --print link-args - -all: $(call DYLIB,foo) $(call STATICLIB,bar) $(call STATICLIB,baz) - $(RUSTC) $(RUSTC_FLAGS) main.rs - $(call RUN,main) diff --git a/tests/run-make-fulldeps/redundant-libs/bar.c b/tests/run-make-fulldeps/redundant-libs/bar.c deleted file mode 100644 index e42599986..000000000 --- a/tests/run-make-fulldeps/redundant-libs/bar.c +++ /dev/null @@ -1 +0,0 @@ -void bar() {} diff --git a/tests/run-make-fulldeps/redundant-libs/baz.c b/tests/run-make-fulldeps/redundant-libs/baz.c deleted file mode 100644 index a4e2c2b71..000000000 --- a/tests/run-make-fulldeps/redundant-libs/baz.c +++ /dev/null @@ -1,7 +0,0 @@ -extern void foo1(); -extern void foo2(); - -void baz() { - foo1(); - foo2(); -} diff --git a/tests/run-make-fulldeps/redundant-libs/foo.c b/tests/run-make-fulldeps/redundant-libs/foo.c deleted file mode 100644 index 339ee86c9..000000000 --- a/tests/run-make-fulldeps/redundant-libs/foo.c +++ /dev/null @@ -1,2 +0,0 @@ -void foo1() {} -void foo2() {} diff --git a/tests/run-make-fulldeps/redundant-libs/main.rs b/tests/run-make-fulldeps/redundant-libs/main.rs deleted file mode 100644 index 90d185ff5..000000000 --- a/tests/run-make-fulldeps/redundant-libs/main.rs +++ /dev/null @@ -1,11 +0,0 @@ -extern "C" { - fn bar(); - fn baz(); -} - -fn main() { - unsafe { - bar(); - baz(); - } -} diff --git a/tests/run-make-fulldeps/relocation-model/Makefile b/tests/run-make-fulldeps/relocation-model/Makefile deleted file mode 100644 index a31dbfd91..000000000 --- a/tests/run-make-fulldeps/relocation-model/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -include ../tools.mk - -all: others - $(RUSTC) -C relocation-model=dynamic-no-pic foo.rs - $(call RUN,foo) - - $(RUSTC) -C relocation-model=default foo.rs - $(call RUN,foo) - - $(RUSTC) -C relocation-model=dynamic-no-pic --crate-type=dylib foo.rs --emit=link,obj - -ifdef IS_MSVC -# FIXME(#28026) -others: -else -others: - $(RUSTC) -C relocation-model=static foo.rs - $(call RUN,foo) -endif diff --git a/tests/run-make-fulldeps/relocation-model/foo.rs b/tests/run-make-fulldeps/relocation-model/foo.rs deleted file mode 100644 index da0f5d925..000000000 --- a/tests/run-make-fulldeps/relocation-model/foo.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn main() {} diff --git a/tests/run-make-fulldeps/relro-levels/Makefile b/tests/run-make-fulldeps/relro-levels/Makefile deleted file mode 100644 index 6176fc1a5..000000000 --- a/tests/run-make-fulldeps/relro-levels/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -include ../tools.mk - -# only-linux -# -# This tests the different -Zrelro-level values, and makes sure that they work properly. - -all: - # Ensure that binaries built with the full relro level links them with both - # RELRO and BIND_NOW for doing eager symbol resolving. - $(RUSTC) -Zrelro-level=full hello.rs - readelf -l $(TMPDIR)/hello | grep -q GNU_RELRO - readelf -d $(TMPDIR)/hello | grep -q BIND_NOW - - $(RUSTC) -Zrelro-level=partial hello.rs - readelf -l $(TMPDIR)/hello | grep -q GNU_RELRO - - # Ensure that we're *not* built with RELRO when setting it to off. We do - # not want to check for BIND_NOW however, as the linker might have that - # enabled by default. - $(RUSTC) -Zrelro-level=off hello.rs - ! readelf -l $(TMPDIR)/hello | grep -q GNU_RELRO diff --git a/tests/run-make-fulldeps/relro-levels/hello.rs b/tests/run-make-fulldeps/relro-levels/hello.rs deleted file mode 100644 index e7a11a969..000000000 --- a/tests/run-make-fulldeps/relro-levels/hello.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world!"); -} diff --git a/tests/run-make-fulldeps/remap-path-prefix/Makefile b/tests/run-make-fulldeps/remap-path-prefix/Makefile deleted file mode 100644 index 2a7378fdf..000000000 --- a/tests/run-make-fulldeps/remap-path-prefix/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -# ignore-windows - -# Checks if remapping works if the remap-from string contains path to the working directory plus more -all: - $(RUSTC) --remap-path-prefix $$PWD/auxiliary=/the/aux --crate-type=lib --emit=metadata auxiliary/lib.rs - grep "/the/aux/lib.rs" $(TMPDIR)/liblib.rmeta || exit 1 - ! grep "$$PWD/auxiliary" $(TMPDIR)/liblib.rmeta || exit 1 diff --git a/tests/run-make-fulldeps/remap-path-prefix/auxiliary/lib.rs b/tests/run-make-fulldeps/remap-path-prefix/auxiliary/lib.rs deleted file mode 100644 index 019c786a9..000000000 --- a/tests/run-make-fulldeps/remap-path-prefix/auxiliary/lib.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub fn lib() { - panic!("calm"); -} diff --git a/tests/run-make-fulldeps/reproducible-build-2/Makefile b/tests/run-make-fulldeps/reproducible-build-2/Makefile deleted file mode 100644 index 1df5e102c..000000000 --- a/tests/run-make-fulldeps/reproducible-build-2/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -include ../tools.mk - -# ignore-musl -# ignore-windows -# Objects are reproducible but their path is not. - -all: \ - fat_lto \ - sysroot - -fat_lto: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - $(RUSTC) reproducible-build.rs -C lto=fat - cp $(TMPDIR)/reproducible-build $(TMPDIR)/reproducible-build-a - $(RUSTC) reproducible-build.rs -C lto=fat - cmp "$(TMPDIR)/reproducible-build-a" "$(TMPDIR)/reproducible-build" || exit 1 - -sysroot: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - $(RUSTC) reproducible-build.rs --crate-type rlib --sysroot $(shell $(RUSTC) --print sysroot) --remap-path-prefix=$(shell $(RUSTC) --print sysroot)=/sysroot - cp -R $(shell $(RUSTC) --print sysroot) $(TMPDIR)/sysroot - cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib - $(RUSTC) reproducible-build.rs --crate-type rlib --sysroot $(TMPDIR)/sysroot --remap-path-prefix=$(TMPDIR)/sysroot=/sysroot - cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 diff --git a/tests/run-make-fulldeps/reproducible-build-2/linker.rs b/tests/run-make-fulldeps/reproducible-build-2/linker.rs deleted file mode 100644 index 998d1f328..000000000 --- a/tests/run-make-fulldeps/reproducible-build-2/linker.rs +++ /dev/null @@ -1,44 +0,0 @@ -use std::env; -use std::path::Path; -use std::fs::File; -use std::io::{Read, Write}; - -fn main() { - let mut dst = env::current_exe().unwrap(); - dst.pop(); - dst.push("linker-arguments1"); - if dst.exists() { - dst.pop(); - dst.push("linker-arguments2"); - assert!(!dst.exists()); - } - - let mut out = String::new(); - for arg in env::args().skip(1) { - let path = Path::new(&arg); - if !path.is_file() { - out.push_str(&arg); - out.push_str("\n"); - continue - } - - let mut contents = Vec::new(); - File::open(path).unwrap().read_to_end(&mut contents).unwrap(); - - out.push_str(&format!("{}: {}\n", arg, hash(&contents))); - } - - File::create(dst).unwrap().write_all(out.as_bytes()).unwrap(); -} - -// fnv hash for now -fn hash(contents: &[u8]) -> u64 { - let mut hash = 0xcbf29ce484222325; - - for byte in contents { - hash = hash ^ (*byte as u64); - hash = hash.wrapping_mul(0x100000001b3); - } - - hash -} diff --git a/tests/run-make-fulldeps/reproducible-build-2/reproducible-build-aux.rs b/tests/run-make-fulldeps/reproducible-build-2/reproducible-build-aux.rs deleted file mode 100644 index 8105b3d2b..000000000 --- a/tests/run-make-fulldeps/reproducible-build-2/reproducible-build-aux.rs +++ /dev/null @@ -1,28 +0,0 @@ -#![crate_type="lib"] - -pub static STATIC: i32 = 1234; - -pub struct Struct { - _t1: std::marker::PhantomData, - _t2: std::marker::PhantomData, -} - -pub fn regular_fn(_: i32) {} - -pub fn generic_fn() {} - -impl Drop for Struct { - fn drop(&mut self) {} -} - -pub enum Enum { - Variant1, - Variant2(u32), - Variant3 { x: u32 } -} - -pub struct TupleStruct(pub i8, pub i16, pub i32, pub i64); - -pub trait Trait { - fn foo(&self); -} diff --git a/tests/run-make-fulldeps/reproducible-build-2/reproducible-build.rs b/tests/run-make-fulldeps/reproducible-build-2/reproducible-build.rs deleted file mode 100644 index a6c04774c..000000000 --- a/tests/run-make-fulldeps/reproducible-build-2/reproducible-build.rs +++ /dev/null @@ -1,116 +0,0 @@ -// This test case makes sure that two identical invocations of the compiler -// (i.e., same code base, same compile-flags, same compiler-versions, etc.) -// produce the same output. In the past, symbol names of monomorphized functions -// were not deterministic (which we want to avoid). -// -// The test tries to exercise as many different paths into symbol name -// generation as possible: -// -// - regular functions -// - generic functions -// - methods -// - statics -// - closures -// - enum variant constructors -// - tuple struct constructors -// - drop glue -// - FnOnce adapters -// - Trait object shims -// - Fn Pointer shims - -#![allow(dead_code, warnings)] - -extern crate reproducible_build_aux; - -static STATIC: i32 = 1234; - -pub struct Struct { - x: T1, - y: T2, -} - -fn regular_fn(_: i32) {} - -fn generic_fn() {} - -impl Drop for Struct { - fn drop(&mut self) {} -} - -pub enum Enum { - Variant1, - Variant2(u32), - Variant3 { x: u32 } -} - -struct TupleStruct(i8, i16, i32, i64); - -impl TupleStruct { - pub fn bar(&self) {} -} - -trait Trait { - fn foo(&self); -} - -impl Trait for u64 { - fn foo(&self) {} -} - -impl reproducible_build_aux::Trait for TupleStruct { - fn foo(&self) {} -} - -fn main() { - regular_fn(STATIC); - generic_fn::(); - generic_fn::>(); - generic_fn::, reproducible_build_aux::Struct>(); - - let dropped = Struct { - x: "", - y: 'a', - }; - - let _ = Enum::Variant1; - let _ = Enum::Variant2(0); - let _ = Enum::Variant3 { x: 0 }; - let _ = TupleStruct(1, 2, 3, 4); - - let closure = |x| { - x + 1i32 - }; - - fn inner i32>(f: F) -> i32 { - f(STATIC) - } - - println!("{}", inner(closure)); - - let object_shim: &Trait = &0u64; - object_shim.foo(); - - fn with_fn_once_adapter(f: F) { - f(0); - } - - with_fn_once_adapter(|_:i32| { }); - - reproducible_build_aux::regular_fn(STATIC); - reproducible_build_aux::generic_fn::(); - reproducible_build_aux::generic_fn::>(); - reproducible_build_aux::generic_fn::, - reproducible_build_aux::Struct>(); - - let _ = reproducible_build_aux::Enum::Variant1; - let _ = reproducible_build_aux::Enum::Variant2(0); - let _ = reproducible_build_aux::Enum::Variant3 { x: 0 }; - let _ = reproducible_build_aux::TupleStruct(1, 2, 3, 4); - - let object_shim: &reproducible_build_aux::Trait = &TupleStruct(0, 1, 2, 3); - object_shim.foo(); - - let pointer_shim: &Fn(i32) = ®ular_fn; - - TupleStruct(1, 2, 3, 4).bar(); -} diff --git a/tests/run-make-fulldeps/reproducible-build/Makefile b/tests/run-make-fulldeps/reproducible-build/Makefile deleted file mode 100644 index 642a48081..000000000 --- a/tests/run-make-fulldeps/reproducible-build/Makefile +++ /dev/null @@ -1,139 +0,0 @@ -include ../tools.mk - -# ignore-musl -# Objects are reproducible but their path is not. - -all: \ - smoke \ - debug \ - opt \ - link_paths \ - remap_paths \ - different_source_dirs_rlib \ - remap_cwd_rlib \ - remap_cwd_to_empty \ - extern_flags - -# TODO: Builds of `bin` crate types are not deterministic with debuginfo=2 on -# Windows. -# See: https://github.com/rust-lang/rust/pull/87320#issuecomment-920105533 -# Issue: https://github.com/rust-lang/rust/issues/88982 -# -# different_source_dirs_bin \ -# remap_cwd_bin \ - -smoke: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) linker.rs -O - $(RUSTC) reproducible-build-aux.rs - $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) - $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) - diff -u "$(TMPDIR)/linker-arguments1" "$(TMPDIR)/linker-arguments2" - -debug: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) linker.rs -O - $(RUSTC) reproducible-build-aux.rs -g - $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -g - $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -g - diff -u "$(TMPDIR)/linker-arguments1" "$(TMPDIR)/linker-arguments2" - -opt: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) linker.rs -O - $(RUSTC) reproducible-build-aux.rs -O - $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -O - $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -O - diff -u "$(TMPDIR)/linker-arguments1" "$(TMPDIR)/linker-arguments2" - -link_paths: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - $(RUSTC) reproducible-build.rs --crate-type rlib -L /b - cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib - $(RUSTC) reproducible-build.rs --crate-type rlib -L /a - cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 - -remap_paths: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - $(RUSTC) reproducible-build.rs --crate-type rlib --remap-path-prefix=/a=/c - cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib - $(RUSTC) reproducible-build.rs --crate-type rlib --remap-path-prefix=/b=/c - cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 - -different_source_dirs_bin: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - mkdir $(TMPDIR)/test - cp reproducible-build.rs $(TMPDIR)/test - $(RUSTC) reproducible-build.rs --crate-type bin --remap-path-prefix=$$PWD=/b - cp $(TMPDIR)/reproducible-build $(TMPDIR)/foo - (cd $(TMPDIR)/test && $(RUSTC) reproducible-build.rs \ - --remap-path-prefix=$(TMPDIR)/test=/b \ - --crate-type bin) - cmp "$(TMPDIR)/reproducible-build" "$(TMPDIR)/foo" || exit 1 - -different_source_dirs_rlib: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - mkdir $(TMPDIR)/test - cp reproducible-build.rs $(TMPDIR)/test - $(RUSTC) reproducible-build.rs --crate-type rlib --remap-path-prefix=$$PWD=/b - cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib - (cd $(TMPDIR)/test && $(RUSTC) reproducible-build.rs \ - --remap-path-prefix=$(TMPDIR)/test=/b \ - --crate-type rlib) - cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 - -remap_cwd_bin: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - mkdir $(TMPDIR)/test - cp reproducible-build.rs $(TMPDIR)/test - $(RUSTC) reproducible-build.rs --crate-type bin -C debuginfo=2 \ - -Z remap-cwd-prefix=. - cp $(TMPDIR)/reproducible-build $(TMPDIR)/first - (cd $(TMPDIR)/test && \ - $(RUSTC) reproducible-build.rs --crate-type bin -C debuginfo=2 \ - -Z remap-cwd-prefix=.) - cmp "$(TMPDIR)/first" "$(TMPDIR)/reproducible-build" || exit 1 - -remap_cwd_rlib: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - mkdir $(TMPDIR)/test - cp reproducible-build.rs $(TMPDIR)/test - $(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \ - -Z remap-cwd-prefix=. - cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfirst.rlib - (cd $(TMPDIR)/test && \ - $(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \ - -Z remap-cwd-prefix=.) - cmp "$(TMPDIR)/libfirst.rlib" "$(TMPDIR)/libreproducible_build.rlib" || exit 1 - -remap_cwd_to_empty: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - mkdir $(TMPDIR)/test - cp reproducible-build.rs $(TMPDIR)/test - $(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \ - -Z remap-cwd-prefix= - cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfirst.rlib - (cd $(TMPDIR)/test && \ - $(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \ - -Z remap-cwd-prefix=) - cmp "$(TMPDIR)/libfirst.rlib" "$(TMPDIR)/libreproducible_build.rlib" || exit 1 - -extern_flags: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - $(RUSTC) reproducible-build.rs \ - --extern reproducible_build_aux=$(TMPDIR)/libreproducible_build_aux.rlib \ - --crate-type rlib - cp $(TMPDIR)/libreproducible_build_aux.rlib $(TMPDIR)/libbar.rlib - cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib - $(RUSTC) reproducible-build.rs \ - --extern reproducible_build_aux=$(TMPDIR)/libbar.rlib \ - --crate-type rlib - cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 diff --git a/tests/run-make-fulldeps/reproducible-build/linker.rs b/tests/run-make-fulldeps/reproducible-build/linker.rs deleted file mode 100644 index 3dda6f190..000000000 --- a/tests/run-make-fulldeps/reproducible-build/linker.rs +++ /dev/null @@ -1,50 +0,0 @@ -use std::env; -use std::path::Path; -use std::fs::File; -use std::io::{Read, Write}; - -fn main() { - let mut dst = env::current_exe().unwrap(); - dst.pop(); - dst.push("linker-arguments1"); - if dst.exists() { - dst.pop(); - dst.push("linker-arguments2"); - assert!(!dst.exists()); - } - - let mut out = String::new(); - for arg in env::args().skip(1) { - let path = Path::new(&arg); - if !path.is_file() { - out.push_str(&arg); - out.push_str("\n"); - continue - } - - let mut contents = Vec::new(); - File::open(path).unwrap().read_to_end(&mut contents).unwrap(); - - // This file is produced during linking in a temporary directory. - let arg = if arg.ends_with("/symbols.o") || arg.ends_with("\\symbols.o") { - "symbols.o" - } else { - &*arg - }; - out.push_str(&format!("{}: {}\n", arg, hash(&contents))); - } - - File::create(dst).unwrap().write_all(out.as_bytes()).unwrap(); -} - -// fnv hash for now -fn hash(contents: &[u8]) -> u64 { - let mut hash = 0xcbf29ce484222325; - - for byte in contents { - hash = hash ^ (*byte as u64); - hash = hash.wrapping_mul(0x100000001b3); - } - - hash -} diff --git a/tests/run-make-fulldeps/reproducible-build/reproducible-build-aux.rs b/tests/run-make-fulldeps/reproducible-build/reproducible-build-aux.rs deleted file mode 100644 index 8105b3d2b..000000000 --- a/tests/run-make-fulldeps/reproducible-build/reproducible-build-aux.rs +++ /dev/null @@ -1,28 +0,0 @@ -#![crate_type="lib"] - -pub static STATIC: i32 = 1234; - -pub struct Struct { - _t1: std::marker::PhantomData, - _t2: std::marker::PhantomData, -} - -pub fn regular_fn(_: i32) {} - -pub fn generic_fn() {} - -impl Drop for Struct { - fn drop(&mut self) {} -} - -pub enum Enum { - Variant1, - Variant2(u32), - Variant3 { x: u32 } -} - -pub struct TupleStruct(pub i8, pub i16, pub i32, pub i64); - -pub trait Trait { - fn foo(&self); -} diff --git a/tests/run-make-fulldeps/reproducible-build/reproducible-build.rs b/tests/run-make-fulldeps/reproducible-build/reproducible-build.rs deleted file mode 100644 index a6c04774c..000000000 --- a/tests/run-make-fulldeps/reproducible-build/reproducible-build.rs +++ /dev/null @@ -1,116 +0,0 @@ -// This test case makes sure that two identical invocations of the compiler -// (i.e., same code base, same compile-flags, same compiler-versions, etc.) -// produce the same output. In the past, symbol names of monomorphized functions -// were not deterministic (which we want to avoid). -// -// The test tries to exercise as many different paths into symbol name -// generation as possible: -// -// - regular functions -// - generic functions -// - methods -// - statics -// - closures -// - enum variant constructors -// - tuple struct constructors -// - drop glue -// - FnOnce adapters -// - Trait object shims -// - Fn Pointer shims - -#![allow(dead_code, warnings)] - -extern crate reproducible_build_aux; - -static STATIC: i32 = 1234; - -pub struct Struct { - x: T1, - y: T2, -} - -fn regular_fn(_: i32) {} - -fn generic_fn() {} - -impl Drop for Struct { - fn drop(&mut self) {} -} - -pub enum Enum { - Variant1, - Variant2(u32), - Variant3 { x: u32 } -} - -struct TupleStruct(i8, i16, i32, i64); - -impl TupleStruct { - pub fn bar(&self) {} -} - -trait Trait { - fn foo(&self); -} - -impl Trait for u64 { - fn foo(&self) {} -} - -impl reproducible_build_aux::Trait for TupleStruct { - fn foo(&self) {} -} - -fn main() { - regular_fn(STATIC); - generic_fn::(); - generic_fn::>(); - generic_fn::, reproducible_build_aux::Struct>(); - - let dropped = Struct { - x: "", - y: 'a', - }; - - let _ = Enum::Variant1; - let _ = Enum::Variant2(0); - let _ = Enum::Variant3 { x: 0 }; - let _ = TupleStruct(1, 2, 3, 4); - - let closure = |x| { - x + 1i32 - }; - - fn inner i32>(f: F) -> i32 { - f(STATIC) - } - - println!("{}", inner(closure)); - - let object_shim: &Trait = &0u64; - object_shim.foo(); - - fn with_fn_once_adapter(f: F) { - f(0); - } - - with_fn_once_adapter(|_:i32| { }); - - reproducible_build_aux::regular_fn(STATIC); - reproducible_build_aux::generic_fn::(); - reproducible_build_aux::generic_fn::>(); - reproducible_build_aux::generic_fn::, - reproducible_build_aux::Struct>(); - - let _ = reproducible_build_aux::Enum::Variant1; - let _ = reproducible_build_aux::Enum::Variant2(0); - let _ = reproducible_build_aux::Enum::Variant3 { x: 0 }; - let _ = reproducible_build_aux::TupleStruct(1, 2, 3, 4); - - let object_shim: &reproducible_build_aux::Trait = &TupleStruct(0, 1, 2, 3); - object_shim.foo(); - - let pointer_shim: &Fn(i32) = ®ular_fn; - - TupleStruct(1, 2, 3, 4).bar(); -} diff --git a/tests/run-make-fulldeps/resolve-rename/Makefile b/tests/run-make-fulldeps/resolve-rename/Makefile deleted file mode 100644 index 00f83a5d6..000000000 --- a/tests/run-make-fulldeps/resolve-rename/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) -C extra-filename=-hash foo.rs - $(RUSTC) bar.rs - mv $(TMPDIR)/libfoo-hash.rlib $(TMPDIR)/libfoo-another-hash.rlib - $(RUSTC) baz.rs diff --git a/tests/run-make-fulldeps/resolve-rename/bar.rs b/tests/run-make-fulldeps/resolve-rename/bar.rs deleted file mode 100644 index 4a09ce355..000000000 --- a/tests/run-make-fulldeps/resolve-rename/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![crate_type = "rlib"] - -extern crate foo; - -pub fn bar() { foo::foo() } diff --git a/tests/run-make-fulldeps/resolve-rename/baz.rs b/tests/run-make-fulldeps/resolve-rename/baz.rs deleted file mode 100644 index 9176073ef..000000000 --- a/tests/run-make-fulldeps/resolve-rename/baz.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![crate_type = "rlib"] - -extern crate bar; - -pub fn baz() { bar::bar() } diff --git a/tests/run-make-fulldeps/resolve-rename/foo.rs b/tests/run-make-fulldeps/resolve-rename/foo.rs deleted file mode 100644 index bd6820098..000000000 --- a/tests/run-make-fulldeps/resolve-rename/foo.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type = "rlib"] - -pub fn foo() {} diff --git a/tests/run-make-fulldeps/return-non-c-like-enum-from-c/Makefile b/tests/run-make-fulldeps/return-non-c-like-enum-from-c/Makefile deleted file mode 100644 index 42d3c977f..000000000 --- a/tests/run-make-fulldeps/return-non-c-like-enum-from-c/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,test) - $(RUSTC) nonclike.rs -L$(TMPDIR) -ltest - $(call RUN,nonclike) diff --git a/tests/run-make-fulldeps/return-non-c-like-enum-from-c/nonclike.rs b/tests/run-make-fulldeps/return-non-c-like-enum-from-c/nonclike.rs deleted file mode 100644 index ea22a2a56..000000000 --- a/tests/run-make-fulldeps/return-non-c-like-enum-from-c/nonclike.rs +++ /dev/null @@ -1,31 +0,0 @@ -#[repr(C, u8)] -pub enum TT { - AA(u64, u64), - BB, -} - -#[repr(C,u8)] -pub enum T { - A(u64), - B, -} - -extern "C" { - pub fn t_new(a: u64) -> T; - pub fn tt_new(a: u64, b: u64) -> TT; -} - -fn main() { - if let TT::AA(a, b) = unsafe { tt_new(10, 11) } { - assert_eq!(10, a); - assert_eq!(11, b); - } else { - panic!("expected TT::AA"); - } - - if let T::A(a) = unsafe { t_new(10) } { - assert_eq!(10, a); - } else { - panic!("expected T::A"); - } -} diff --git a/tests/run-make-fulldeps/return-non-c-like-enum-from-c/test.c b/tests/run-make-fulldeps/return-non-c-like-enum-from-c/test.c deleted file mode 100644 index 3ad135bab..000000000 --- a/tests/run-make-fulldeps/return-non-c-like-enum-from-c/test.c +++ /dev/null @@ -1,61 +0,0 @@ -#include - -/* This is the code generated by cbindgen 0.12.1 for the `enum TT` - * type in nonclike.rs . */ -enum TT_Tag { - AA, - BB, -}; -typedef uint8_t TT_Tag; - -typedef struct { - uint64_t _0; - uint64_t _1; -} AA_Body; - -typedef struct { - TT_Tag tag; - union { - AA_Body aa; - }; -} TT; - -/* This is the code generated by cbindgen 0.12.1 for the `enum T` type - * in nonclike.rs . */ -enum T_Tag { - A, - B, -}; -typedef uint8_t T_Tag; - -typedef struct { - uint64_t _0; -} A_Body; - -typedef struct { - T_Tag tag; - union { - A_Body a; - }; -} T; - -TT tt_new(uint64_t a, uint64_t b) { - TT tt = { - .tag = AA, - .aa = { - ._0 = a, - ._1 = b, - }, - }; - return tt; -} - -T t_new(uint64_t a) { - T t = { - .tag = A, - .a = { - ._0 = a, - }, - }; - return t; -} diff --git a/tests/run-make-fulldeps/return-non-c-like-enum/Makefile b/tests/run-make-fulldeps/return-non-c-like-enum/Makefile deleted file mode 100644 index 513311c82..000000000 --- a/tests/run-make-fulldeps/return-non-c-like-enum/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --crate-type=staticlib nonclike.rs - $(CC) test.c $(call STATICLIB,nonclike) $(call OUT_EXE,test) \ - $(EXTRACFLAGS) $(EXTRACXXFLAGS) - $(call RUN,test) diff --git a/tests/run-make-fulldeps/return-non-c-like-enum/nonclike.rs b/tests/run-make-fulldeps/return-non-c-like-enum/nonclike.rs deleted file mode 100644 index de529cf64..000000000 --- a/tests/run-make-fulldeps/return-non-c-like-enum/nonclike.rs +++ /dev/null @@ -1,21 +0,0 @@ -#[repr(C, u8)] -pub enum TT { - AA(u64, u64), - BB, -} - -#[no_mangle] -pub extern "C" fn tt_new(a: u64, b: u64) -> TT { - TT::AA(a, b) -} - -#[repr(C,u8)] -pub enum T { - A(u64), - B, -} - -#[no_mangle] -pub extern "C" fn t_new(a: u64) -> T { - T::A(a) -} diff --git a/tests/run-make-fulldeps/return-non-c-like-enum/test.c b/tests/run-make-fulldeps/return-non-c-like-enum/test.c deleted file mode 100644 index afadd3c10..000000000 --- a/tests/run-make-fulldeps/return-non-c-like-enum/test.c +++ /dev/null @@ -1,63 +0,0 @@ -#include -#include - -/* This is the code generated by cbindgen 0.12.1 for the `enum TT` - * type in nonclike.rs . */ -enum TT_Tag { - AA, - BB, -}; -typedef uint8_t TT_Tag; - -typedef struct { - uint64_t _0; - uint64_t _1; -} AA_Body; - -typedef struct { - TT_Tag tag; - union { - AA_Body aa; - }; -} TT; - -/* This is the code generated by cbindgen 0.12.1 for the `enum T` type - * in nonclike.rs . */ -enum T_Tag { - A, - B, -}; -typedef uint8_t T_Tag; - -typedef struct { - uint64_t _0; -} A_Body; - -typedef struct { - T_Tag tag; - union { - A_Body a; - }; -} T; - -/* These symbols are defined by the Rust staticlib built from - * nonclike.rs. */ -extern TT tt_new(uint64_t a, uint64_t b); -extern T t_new(uint64_t v); - -int main(int argc, char *argv[]) { - (void)argc; (void)argv; - - /* This example works. */ - TT tt = tt_new(10, 20); - assert(AA == tt.tag); - assert(10 == tt.aa._0); - assert(20 == tt.aa._1); - - /* This one used to segfault (see issue #68190). */ - T t = t_new(10); - assert(A == t.tag); - assert(10 == t.a._0); - - return 0; -} diff --git a/tests/run-make-fulldeps/rlib-chain/Makefile b/tests/run-make-fulldeps/rlib-chain/Makefile deleted file mode 100644 index 236943a2a..000000000 --- a/tests/run-make-fulldeps/rlib-chain/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) m1.rs - $(RUSTC) m2.rs - $(RUSTC) m3.rs - $(RUSTC) m4.rs - $(call RUN,m4) - rm $(TMPDIR)/*lib - $(call RUN,m4) diff --git a/tests/run-make-fulldeps/rlib-chain/m1.rs b/tests/run-make-fulldeps/rlib-chain/m1.rs deleted file mode 100644 index 665b206cc..000000000 --- a/tests/run-make-fulldeps/rlib-chain/m1.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "rlib"] -pub fn m1() {} diff --git a/tests/run-make-fulldeps/rlib-chain/m2.rs b/tests/run-make-fulldeps/rlib-chain/m2.rs deleted file mode 100644 index eba12fe12..000000000 --- a/tests/run-make-fulldeps/rlib-chain/m2.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "rlib"] -extern crate m1; - -pub fn m2() { m1::m1() } diff --git a/tests/run-make-fulldeps/rlib-chain/m3.rs b/tests/run-make-fulldeps/rlib-chain/m3.rs deleted file mode 100644 index ade191db4..000000000 --- a/tests/run-make-fulldeps/rlib-chain/m3.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "rlib"] -extern crate m2; - -pub fn m3() { m2::m2() } diff --git a/tests/run-make-fulldeps/rlib-chain/m4.rs b/tests/run-make-fulldeps/rlib-chain/m4.rs deleted file mode 100644 index fa8ec6079..000000000 --- a/tests/run-make-fulldeps/rlib-chain/m4.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate m3; - -fn main() { m3::m3() } diff --git a/tests/run-make-fulldeps/rustdoc-determinism/Makefile b/tests/run-make-fulldeps/rustdoc-determinism/Makefile deleted file mode 100644 index a3ef16906..000000000 --- a/tests/run-make-fulldeps/rustdoc-determinism/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -include ../tools.mk - -# Assert that the search index is generated deterministically, regardless of the -# order that crates are documented in. - -# ignore-windows -# Uses `diff`. - -all: - $(RUSTDOC) foo.rs -o $(TMPDIR)/foo_first - $(RUSTDOC) bar.rs -o $(TMPDIR)/foo_first - - $(RUSTDOC) bar.rs -o $(TMPDIR)/bar_first - $(RUSTDOC) foo.rs -o $(TMPDIR)/bar_first - - diff $(TMPDIR)/foo_first/search-index.js $(TMPDIR)/bar_first/search-index.js diff --git a/tests/run-make-fulldeps/rustdoc-determinism/bar.rs b/tests/run-make-fulldeps/rustdoc-determinism/bar.rs deleted file mode 100644 index ca05a6a90..000000000 --- a/tests/run-make-fulldeps/rustdoc-determinism/bar.rs +++ /dev/null @@ -1 +0,0 @@ -pub struct Bar; diff --git a/tests/run-make-fulldeps/rustdoc-determinism/foo.rs b/tests/run-make-fulldeps/rustdoc-determinism/foo.rs deleted file mode 100644 index 4a835673a..000000000 --- a/tests/run-make-fulldeps/rustdoc-determinism/foo.rs +++ /dev/null @@ -1 +0,0 @@ -pub struct Foo; diff --git a/tests/run-make-fulldeps/rustdoc-error-lines/Makefile b/tests/run-make-fulldeps/rustdoc-error-lines/Makefile deleted file mode 100644 index 2dc30f56b..000000000 --- a/tests/run-make-fulldeps/rustdoc-error-lines/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -include ../tools.mk - -# Test that hir-tree output doesn't crash and includes -# the string constant we would expect to see. - -all: - $(RUSTDOC) --test input.rs > $(TMPDIR)/output || true - $(CGREP) 'input.rs - foo (line 5)' < $(TMPDIR)/output - $(CGREP) 'input.rs:7:15' < $(TMPDIR)/output - $(CGREP) 'input.rs - bar (line 15)' < $(TMPDIR)/output - $(CGREP) 'input.rs:17:15' < $(TMPDIR)/output - $(CGREP) 'input.rs - bar (line 24)' < $(TMPDIR)/output - $(CGREP) 'input.rs:26:15' < $(TMPDIR)/output diff --git a/tests/run-make-fulldeps/rustdoc-error-lines/input.rs b/tests/run-make-fulldeps/rustdoc-error-lines/input.rs deleted file mode 100644 index b4db182e8..000000000 --- a/tests/run-make-fulldeps/rustdoc-error-lines/input.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Test for #45868 - -// random #![feature] to ensure that crate attrs -// do not offset things -/// ```rust -/// #![feature(bool_to_option)] -/// let x: char = 1; -/// ``` -pub fn foo() { - -} - -/// Add some text around the test... -/// -/// ```rust -/// #![feature(bool_to_option)] -/// let x: char = 1; -/// ``` -/// -/// ...to make sure that the line number is still correct. -/// -/// Let's also add a second test in the same doc comment. -/// -/// ```rust -/// #![feature(bool_to_option)] -/// let x: char = 1; -/// ``` -pub fn bar() {} diff --git a/tests/run-make-fulldeps/rustdoc-io-error/Makefile b/tests/run-make-fulldeps/rustdoc-io-error/Makefile deleted file mode 100644 index 27f5ecf94..000000000 --- a/tests/run-make-fulldeps/rustdoc-io-error/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -include ../tools.mk - -# This test verifies that rustdoc doesn't ICE when it encounters an IO error -# while generating files. Ideally this would be a rustdoc-ui test, so we could -# verify the error message as well. - -# ignore-windows -# The test uses `chmod`. - -OUTPUT_DIR := "$(TMPDIR)/rustdoc-io-error" - -# This test operates by creating a temporary directory and modifying its -# permissions so that it is not writable. We have to take special care to set -# the permissions back to normal so that it's able to be deleted later. -all: - mkdir -p $(OUTPUT_DIR) - chmod u-w $(OUTPUT_DIR) - -$(shell $(RUSTDOC) -o $(OUTPUT_DIR) foo.rs) - chmod u+w $(OUTPUT_DIR) - exit $($(.SHELLSTATUS) -eq 1) diff --git a/tests/run-make-fulldeps/rustdoc-io-error/foo.rs b/tests/run-make-fulldeps/rustdoc-io-error/foo.rs deleted file mode 100644 index 4a835673a..000000000 --- a/tests/run-make-fulldeps/rustdoc-io-error/foo.rs +++ /dev/null @@ -1 +0,0 @@ -pub struct Foo; diff --git a/tests/run-make-fulldeps/rustdoc-map-file/Makefile b/tests/run-make-fulldeps/rustdoc-map-file/Makefile deleted file mode 100644 index 5cbf7747a..000000000 --- a/tests/run-make-fulldeps/rustdoc-map-file/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTDOC) -Z unstable-options --generate-redirect-map foo.rs -o "$(TMPDIR)/out" - "$(PYTHON)" validate_json.py "$(TMPDIR)/out" diff --git a/tests/run-make-fulldeps/rustdoc-map-file/expected.json b/tests/run-make-fulldeps/rustdoc-map-file/expected.json deleted file mode 100644 index 6b1ccbeac..000000000 --- a/tests/run-make-fulldeps/rustdoc-map-file/expected.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "foo/macro.foo!.html": "foo/macro.foo.html", - "foo/private/struct.Quz.html": "foo/struct.Quz.html", - "foo/hidden/struct.Bar.html": "foo/struct.Bar.html" -} diff --git a/tests/run-make-fulldeps/rustdoc-map-file/foo.rs b/tests/run-make-fulldeps/rustdoc-map-file/foo.rs deleted file mode 100644 index e12b9d229..000000000 --- a/tests/run-make-fulldeps/rustdoc-map-file/foo.rs +++ /dev/null @@ -1,16 +0,0 @@ -pub use private::Quz; -pub use hidden::Bar; - -mod private { - pub struct Quz; -} - -#[doc(hidden)] -pub mod hidden { - pub struct Bar; -} - -#[macro_export] -macro_rules! foo { - () => {} -} diff --git a/tests/run-make-fulldeps/rustdoc-map-file/validate_json.py b/tests/run-make-fulldeps/rustdoc-map-file/validate_json.py deleted file mode 100755 index 5c14c90b7..000000000 --- a/tests/run-make-fulldeps/rustdoc-map-file/validate_json.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python - -import os -import sys -import json - - -def find_redirect_map_file(folder, errors): - for root, dirs, files in os.walk(folder): - for name in files: - if not name.endswith("redirect-map.json"): - continue - with open(os.path.join(root, name)) as f: - data = json.load(f) - with open("expected.json") as f: - expected = json.load(f) - for key in expected: - if expected[key] != data.get(key): - errors.append("Expected `{}` for key `{}`, found: `{}`".format( - expected[key], key, data.get(key))) - else: - del data[key] - for key in data: - errors.append("Extra data not expected: key: `{}`, data: `{}`".format( - key, data[key])) - return True - return False - - -if len(sys.argv) != 2: - print("Expected doc directory to check!") - sys.exit(1) - -errors = [] -if not find_redirect_map_file(sys.argv[1], errors): - print("Didn't find the map file in `{}`...".format(sys.argv[1])) - sys.exit(1) -for err in errors: - print("=> {}".format(err)) -if len(errors) != 0: - sys.exit(1) diff --git a/tests/run-make-fulldeps/rustdoc-output-path/Makefile b/tests/run-make-fulldeps/rustdoc-output-path/Makefile deleted file mode 100644 index 8f5cda9e5..000000000 --- a/tests/run-make-fulldeps/rustdoc-output-path/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - $(RUSTDOC) -o "$(TMPDIR)/foo/bar/doc" foo.rs diff --git a/tests/run-make-fulldeps/rustdoc-output-path/foo.rs b/tests/run-make-fulldeps/rustdoc-output-path/foo.rs deleted file mode 100644 index 4a835673a..000000000 --- a/tests/run-make-fulldeps/rustdoc-output-path/foo.rs +++ /dev/null @@ -1 +0,0 @@ -pub struct Foo; diff --git a/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/Makefile b/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/Makefile deleted file mode 100644 index c857aa4b9..000000000 --- a/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -include ../../run-make-fulldeps/tools.mk - -OUTPUT_DIR := "$(TMPDIR)/rustdoc" -DYLIB_NAME := $(shell echo | $(RUSTC) --crate-name foobar_macro --crate-type dylib --print file-names -) - -all: - $(RUSTC) src/proc.rs --crate-name foobar_macro --edition=2021 --crate-type proc-macro --emit=dep-info,link - - $(RUSTC) src/lib.rs --crate-name foobar --edition=2021 --crate-type lib --emit=dep-info,link - - $(RUSTDOC) examples/ex.rs --crate-name ex --crate-type bin --output $(OUTPUT_DIR) \ - --extern foobar=$(TMPDIR)/libfoobar.rlib --extern foobar_macro=$(TMPDIR)/$(DYLIB_NAME) \ - -Z unstable-options --scrape-examples-output-path $(TMPDIR)/ex.calls --scrape-examples-target-crate foobar - - $(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --output $(OUTPUT_DIR) \ - -Z unstable-options --with-examples $(TMPDIR)/ex.calls - - $(HTMLDOCCK) $(OUTPUT_DIR) src/lib.rs diff --git a/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/examples/ex.rs b/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/examples/ex.rs deleted file mode 100644 index 4d8c8b30e..000000000 --- a/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/examples/ex.rs +++ /dev/null @@ -1,27 +0,0 @@ -extern crate foobar; -extern crate foobar_macro; - -use foobar::*; -use foobar_macro::*; - -a_proc_macro!(); // no - -#[an_attr_macro] -fn a() { - f(); // no -} - -#[an_attr_macro(with_span)] -fn b() { - f(); // yes -} - -fn c() { - a_rules_macro!(f()); // yes -} - -fn d() { - a_rules_macro!(()); // no -} - -fn main(){} diff --git a/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/src/lib.rs b/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/src/lib.rs deleted file mode 100644 index d8658a0f2..000000000 --- a/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/src/lib.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Scraped example should only include line numbers for items b and c in ex.rs -// @!has foobar/fn.f.html '//*[@class="src-line-numbers"]' '14' -// @has foobar/fn.f.html '//*[@class="src-line-numbers"]' '15' -// @has foobar/fn.f.html '//*[@class="src-line-numbers"]' '21' -// @!has foobar/fn.f.html '//*[@class="src-line-numbers"]' '22' - -pub fn f() {} - -#[macro_export] -macro_rules! a_rules_macro { - ($e:expr) => { ($e, foobar::f()); } -} diff --git a/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/src/proc.rs b/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/src/proc.rs deleted file mode 100644 index 46e518fdf..000000000 --- a/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/src/proc.rs +++ /dev/null @@ -1,39 +0,0 @@ -extern crate proc_macro; -use proc_macro::*; - -#[proc_macro] -pub fn a_proc_macro(_item: TokenStream) -> TokenStream { - "fn ex() { foobar::f(); }".parse().unwrap() -} - -// inserts foobar::f() to the end of the function -#[proc_macro_attribute] -pub fn an_attr_macro(attr: TokenStream, item: TokenStream) -> TokenStream { - let new_call: TokenStream = "foobar::f();".parse().unwrap(); - - let mut tokens = item.into_iter(); - - let fn_tok = tokens.next().unwrap(); - let ident_tok = tokens.next().unwrap(); - let args_tok = tokens.next().unwrap(); - let body = match tokens.next().unwrap() { - TokenTree::Group(g) => { - let new_g = Group::new(g.delimiter(), new_call); - let mut outer_g = Group::new( - g.delimiter(), - [TokenTree::Group(g.clone()), TokenTree::Group(new_g)].into_iter().collect(), - ); - - if attr.to_string() == "with_span" { - outer_g.set_span(g.span()); - } - - TokenTree::Group(outer_g) - } - _ => unreachable!(), - }; - - let tokens = vec![fn_tok, ident_tok, args_tok, body].into_iter().collect::(); - - tokens -} diff --git a/tests/run-make-fulldeps/rustdoc-target-spec-json-path/Makefile b/tests/run-make-fulldeps/rustdoc-target-spec-json-path/Makefile deleted file mode 100644 index 6d0bc4186..000000000 --- a/tests/run-make-fulldeps/rustdoc-target-spec-json-path/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -# Test that rustdoc will properly canonicalize the target spec json path just like rustc - -OUTPUT_DIR := "$(TMPDIR)/rustdoc-target-spec-json-path" - -all: - $(RUSTC) --crate-type lib dummy_core.rs --target target.json - $(RUSTDOC) -o $(OUTPUT_DIR) -L $(TMPDIR) my_crate.rs --target target.json diff --git a/tests/run-make-fulldeps/rustdoc-target-spec-json-path/dummy_core.rs b/tests/run-make-fulldeps/rustdoc-target-spec-json-path/dummy_core.rs deleted file mode 100644 index da27b7f34..000000000 --- a/tests/run-make-fulldeps/rustdoc-target-spec-json-path/dummy_core.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![feature(no_core)] -#![no_core] diff --git a/tests/run-make-fulldeps/rustdoc-target-spec-json-path/my_crate.rs b/tests/run-make-fulldeps/rustdoc-target-spec-json-path/my_crate.rs deleted file mode 100644 index 12aa08220..000000000 --- a/tests/run-make-fulldeps/rustdoc-target-spec-json-path/my_crate.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![feature(no_core)] -#![no_core] -extern crate dummy_core; diff --git a/tests/run-make-fulldeps/rustdoc-target-spec-json-path/target.json b/tests/run-make-fulldeps/rustdoc-target-spec-json-path/target.json deleted file mode 100644 index 34357182c..000000000 --- a/tests/run-make-fulldeps/rustdoc-target-spec-json-path/target.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "arch": "x86_64", - "cpu": "x86-64", - "crt-static-respected": true, - "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", - "dynamic-linking": true, - "env": "gnu", - "executables": true, - "has-elf-tls": true, - "has-rpath": true, - "linker-is-gnu": true, - "llvm-target": "x86_64-unknown-linux-gnu", - "max-atomic-width": 64, - "os": "linux", - "position-independent-executables": true, - "pre-link-args": { - "gcc": [ - "-m64" - ] - }, - "relro-level": "full", - "stack-probes": { - "kind": "inline-or-call", - "min-llvm-version-for-inline": [ - 11, - 0, - 1 - ] - }, - "supported-sanitizers": [ - "address", - "leak", - "memory", - "thread" - ], - "target-family": "unix", - "target-pointer-width": "64" -} diff --git a/tests/run-make-fulldeps/rustdoc-themes/Makefile b/tests/run-make-fulldeps/rustdoc-themes/Makefile deleted file mode 100644 index a6d9a43ad..000000000 --- a/tests/run-make-fulldeps/rustdoc-themes/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -# Test that rustdoc will properly load in a theme file and display it in the theme selector. - -OUTPUT_DIR := "$(TMPDIR)/rustdoc-themes" - -all: - cp $(S)/src/librustdoc/html/static/css/themes/light.css $(TMPDIR)/test.css - $(RUSTDOC) -o $(OUTPUT_DIR) foo.rs --theme $(TMPDIR)/test.css - $(HTMLDOCCK) $(OUTPUT_DIR) foo.rs diff --git a/tests/run-make-fulldeps/rustdoc-themes/foo.rs b/tests/run-make-fulldeps/rustdoc-themes/foo.rs deleted file mode 100644 index 58efaf7d5..000000000 --- a/tests/run-make-fulldeps/rustdoc-themes/foo.rs +++ /dev/null @@ -1,4 +0,0 @@ -// @has test.css -// @has foo/struct.Foo.html -// @has - '//link[@rel="stylesheet"]/@href' '../test.css' -pub struct Foo; diff --git a/tests/run-make-fulldeps/sanitizer-cdylib-link/Makefile b/tests/run-make-fulldeps/sanitizer-cdylib-link/Makefile deleted file mode 100644 index 691585268..000000000 --- a/tests/run-make-fulldeps/sanitizer-cdylib-link/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# needs-sanitizer-support -# needs-sanitizer-address - -include ../tools.mk - -LOG := $(TMPDIR)/log.txt - -# This test builds a shared object, then an executable that links it as a native -# rust library (contrast to an rlib). The shared library and executable both -# are compiled with address sanitizer, and we assert that a fault in the cdylib -# is correctly detected. - -all: - $(RUSTC) -g -Z sanitizer=address --crate-type cdylib --target $(TARGET) library.rs - $(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) -llibrary program.rs - LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow diff --git a/tests/run-make-fulldeps/sanitizer-cdylib-link/library.rs b/tests/run-make-fulldeps/sanitizer-cdylib-link/library.rs deleted file mode 100644 index f2a52cb5c..000000000 --- a/tests/run-make-fulldeps/sanitizer-cdylib-link/library.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[no_mangle] -pub extern "C" fn overflow() { - let xs = [0, 1, 2, 3]; - let _y = unsafe { *xs.as_ptr().offset(4) }; -} diff --git a/tests/run-make-fulldeps/sanitizer-cdylib-link/program.rs b/tests/run-make-fulldeps/sanitizer-cdylib-link/program.rs deleted file mode 100644 index ef053aa2e..000000000 --- a/tests/run-make-fulldeps/sanitizer-cdylib-link/program.rs +++ /dev/null @@ -1,7 +0,0 @@ -extern "C" { - fn overflow(); -} - -fn main() { - unsafe { overflow() } -} diff --git a/tests/run-make-fulldeps/sanitizer-dylib-link/Makefile b/tests/run-make-fulldeps/sanitizer-dylib-link/Makefile deleted file mode 100644 index b0a91e5b1..000000000 --- a/tests/run-make-fulldeps/sanitizer-dylib-link/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# needs-sanitizer-support -# needs-sanitizer-address - -include ../tools.mk - -LOG := $(TMPDIR)/log.txt - -# This test builds a shared object, then an executable that links it as a native -# rust library (contrast to an rlib). The shared library and executable both -# are compiled with address sanitizer, and we assert that a fault in the dylib -# is correctly detected. - -all: - $(RUSTC) -g -Z sanitizer=address --crate-type dylib --target $(TARGET) library.rs - $(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) -llibrary program.rs - LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow diff --git a/tests/run-make-fulldeps/sanitizer-dylib-link/library.rs b/tests/run-make-fulldeps/sanitizer-dylib-link/library.rs deleted file mode 100644 index f2a52cb5c..000000000 --- a/tests/run-make-fulldeps/sanitizer-dylib-link/library.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[no_mangle] -pub extern "C" fn overflow() { - let xs = [0, 1, 2, 3]; - let _y = unsafe { *xs.as_ptr().offset(4) }; -} diff --git a/tests/run-make-fulldeps/sanitizer-dylib-link/program.rs b/tests/run-make-fulldeps/sanitizer-dylib-link/program.rs deleted file mode 100644 index ef053aa2e..000000000 --- a/tests/run-make-fulldeps/sanitizer-dylib-link/program.rs +++ /dev/null @@ -1,7 +0,0 @@ -extern "C" { - fn overflow(); -} - -fn main() { - unsafe { overflow() } -} diff --git a/tests/run-make-fulldeps/sanitizer-staticlib-link/Makefile b/tests/run-make-fulldeps/sanitizer-staticlib-link/Makefile deleted file mode 100644 index 7b1a286ed..000000000 --- a/tests/run-make-fulldeps/sanitizer-staticlib-link/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# needs-sanitizer-support -# needs-sanitizer-address - -include ../tools.mk - -# This test first builds a staticlib with AddressSanitizer and checks that -# linking it to an executable fails due to the missing sanitizer runtime. -# It then builds an executable linking to the staticlib and checks that -# the fault in the staticlib is detected correctly. - -# Note that checking for the link failure actually checks two things at once: -# 1) That the library has the sanitizer intrumentation -# 2) and that library does not have the sanitizer runtime - -all: - $(RUSTC) -g -Z sanitizer=address --crate-type staticlib --target $(TARGET) library.rs - ! $(CC) program.c $(call STATICLIB,library) $(call OUT_EXE,program) $(EXTRACFLAGS) $(EXTRACXXFLAGS) - $(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) -L . program.rs - LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow - diff --git a/tests/run-make-fulldeps/sanitizer-staticlib-link/library.rs b/tests/run-make-fulldeps/sanitizer-staticlib-link/library.rs deleted file mode 100644 index f2a52cb5c..000000000 --- a/tests/run-make-fulldeps/sanitizer-staticlib-link/library.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[no_mangle] -pub extern "C" fn overflow() { - let xs = [0, 1, 2, 3]; - let _y = unsafe { *xs.as_ptr().offset(4) }; -} diff --git a/tests/run-make-fulldeps/sanitizer-staticlib-link/program.c b/tests/run-make-fulldeps/sanitizer-staticlib-link/program.c deleted file mode 100644 index 735e2b147..000000000 --- a/tests/run-make-fulldeps/sanitizer-staticlib-link/program.c +++ /dev/null @@ -1,6 +0,0 @@ -void overflow(); - -int main() { - overflow(); - return 0; -} diff --git a/tests/run-make-fulldeps/sanitizer-staticlib-link/program.rs b/tests/run-make-fulldeps/sanitizer-staticlib-link/program.rs deleted file mode 100644 index ec59bdb11..000000000 --- a/tests/run-make-fulldeps/sanitizer-staticlib-link/program.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[link(name = "library")] -extern "C" { - fn overflow(); -} - -fn main() { - unsafe { - overflow(); - } -} diff --git a/tests/run-make-fulldeps/separate-link-fail/Makefile b/tests/run-make-fulldeps/separate-link-fail/Makefile deleted file mode 100644 index bfd18fbf9..000000000 --- a/tests/run-make-fulldeps/separate-link-fail/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - echo 'fn main(){}' > $(TMPDIR)/main.rs - # Make sure that this fails - ! $(RUSTC) -Z link-only $(TMPDIR)/main.rs 2> $(TMPDIR)/stderr.txt - $(CGREP) "The input does not look like a .rlink file" < $(TMPDIR)/stderr.txt diff --git a/tests/run-make-fulldeps/separate-link/Makefile b/tests/run-make-fulldeps/separate-link/Makefile deleted file mode 100644 index 3ccdb6275..000000000 --- a/tests/run-make-fulldeps/separate-link/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - echo 'fn main(){}' | $(RUSTC) -Z no-link - - $(RUSTC) -Z link-only $(TMPDIR)/rust_out.rlink - $(call RUN,rust_out) diff --git a/tests/run-make-fulldeps/sepcomp-cci-copies/Makefile b/tests/run-make-fulldeps/sepcomp-cci-copies/Makefile deleted file mode 100644 index df289d0b0..000000000 --- a/tests/run-make-fulldeps/sepcomp-cci-copies/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include ../tools.mk - -# Check that cross-crate inlined items are inlined in all compilation units -# that refer to them, and not in any other compilation units. -# Note that we have to pass `-C codegen-units=6` because up to two CGUs may be -# created for each source module (see `rustc_const_eval::monomorphize::partitioning`). - -all: - $(RUSTC) cci_lib.rs - $(RUSTC) foo.rs --emit=llvm-ir -C codegen-units=6 \ - -Z inline-in-all-cgus - [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c define\ .*cci_fn)" -eq "2" ] diff --git a/tests/run-make-fulldeps/sepcomp-cci-copies/cci_lib.rs b/tests/run-make-fulldeps/sepcomp-cci-copies/cci_lib.rs deleted file mode 100644 index 869d4a6cd..000000000 --- a/tests/run-make-fulldeps/sepcomp-cci-copies/cci_lib.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_type = "rlib"] - -#[inline] -pub fn cci_fn() -> usize { - 1234 -} diff --git a/tests/run-make-fulldeps/sepcomp-cci-copies/foo.rs b/tests/run-make-fulldeps/sepcomp-cci-copies/foo.rs deleted file mode 100644 index ba251fcb0..000000000 --- a/tests/run-make-fulldeps/sepcomp-cci-copies/foo.rs +++ /dev/null @@ -1,25 +0,0 @@ -extern crate cci_lib; -use cci_lib::cci_fn; - -fn call1() -> usize { - cci_fn() -} - -mod a { - use cci_lib::cci_fn; - pub fn call2() -> usize { - cci_fn() - } -} - -mod b { - pub fn call3() -> usize { - 0 - } -} - -fn main() { - call1(); - a::call2(); - b::call3(); -} diff --git a/tests/run-make-fulldeps/sepcomp-inlining/Makefile b/tests/run-make-fulldeps/sepcomp-inlining/Makefile deleted file mode 100644 index 327aeb75e..000000000 --- a/tests/run-make-fulldeps/sepcomp-inlining/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -include ../tools.mk - -# Test that #[inline] functions still get inlined across compilation unit -# boundaries. Compilation should produce three IR files, but only the two -# compilation units that have a usage of the #[inline] function should -# contain a definition. Also, the non-#[inline] function should be defined -# in only one compilation unit. - -all: - $(RUSTC) foo.rs --emit=llvm-ir -C codegen-units=3 \ - -Z inline-in-all-cgus - [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c define\ i32\ .*inlined)" -eq "0" ] - [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c define\ internal\ i32\ .*inlined)" -eq "2" ] - [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c define\ hidden\ i32\ .*normal)" -eq "1" ] - [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c declare\ hidden\ i32\ .*normal)" -eq "2" ] diff --git a/tests/run-make-fulldeps/sepcomp-inlining/foo.rs b/tests/run-make-fulldeps/sepcomp-inlining/foo.rs deleted file mode 100644 index 2fe5f9cb7..000000000 --- a/tests/run-make-fulldeps/sepcomp-inlining/foo.rs +++ /dev/null @@ -1,30 +0,0 @@ -#![feature(start)] - -#[inline] -fn inlined() -> u32 { - 1234 -} - -fn normal() -> u32 { - 2345 -} - -mod a { - pub fn f() -> u32 { - ::inlined() + ::normal() - } -} - -mod b { - pub fn f() -> u32 { - ::inlined() + ::normal() - } -} - -#[start] -fn start(_: isize, _: *const *const u8) -> isize { - a::f(); - b::f(); - - 0 -} diff --git a/tests/run-make-fulldeps/sepcomp-separate/Makefile b/tests/run-make-fulldeps/sepcomp-separate/Makefile deleted file mode 100644 index 62cf54a88..000000000 --- a/tests/run-make-fulldeps/sepcomp-separate/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -# Test that separate compilation actually puts code into separate compilation -# units. `foo.rs` defines `magic_fn` in three different modules, which should -# wind up in three different compilation units. - -all: - $(RUSTC) foo.rs --emit=llvm-ir -C codegen-units=3 - [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c define\ .*magic_fn)" -eq "3" ] diff --git a/tests/run-make-fulldeps/sepcomp-separate/foo.rs b/tests/run-make-fulldeps/sepcomp-separate/foo.rs deleted file mode 100644 index 169bafa9b..000000000 --- a/tests/run-make-fulldeps/sepcomp-separate/foo.rs +++ /dev/null @@ -1,21 +0,0 @@ -fn magic_fn() -> usize { - 1234 -} - -mod a { - pub fn magic_fn() -> usize { - 2345 - } -} - -mod b { - pub fn magic_fn() -> usize { - 3456 - } -} - -fn main() { - magic_fn(); - a::magic_fn(); - b::magic_fn(); -} diff --git a/tests/run-make-fulldeps/share-generics-dylib/Makefile b/tests/run-make-fulldeps/share-generics-dylib/Makefile deleted file mode 100644 index 065fb574c..000000000 --- a/tests/run-make-fulldeps/share-generics-dylib/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -# This test makes sure all generic instances get re-exported from Rust dylibs for use by -# `-Zshare-generics`. There are two rlibs (`instance_provider_a` and `instance_provider_b`) -# which both provide an instance of `Cell::set`. There is `instance_user_dylib` which is -# supposed to re-export both these instances, and then there are `instance_user_a_rlib` and -# `instance_user_b_rlib` which each rely on a specific instance to be available. -# -# In the end everything is linked together into `linked_leaf`. If `instance_user_dylib` does -# not export both then we'll get an `undefined reference` error for one of the instances. -# -# This is regression test for https://github.com/rust-lang/rust/issues/67276. - -include ../../run-make-fulldeps/tools.mk - -COMMON_ARGS=-Cprefer-dynamic -Zshare-generics=yes -Ccodegen-units=1 -Csymbol-mangling-version=v0 - -all: - $(RUSTC) instance_provider_a.rs $(COMMON_ARGS) --crate-type=rlib - $(RUSTC) instance_provider_b.rs $(COMMON_ARGS) --crate-type=rlib - $(RUSTC) instance_user_dylib.rs $(COMMON_ARGS) --crate-type=dylib - $(RUSTC) instance_user_a_rlib.rs $(COMMON_ARGS) --crate-type=rlib - $(RUSTC) instance_user_b_rlib.rs $(COMMON_ARGS) --crate-type=rlib - $(RUSTC) linked_leaf.rs $(COMMON_ARGS) --crate-type=bin diff --git a/tests/run-make-fulldeps/share-generics-dylib/instance_provider_a.rs b/tests/run-make-fulldeps/share-generics-dylib/instance_provider_a.rs deleted file mode 100644 index b4e125ac0..000000000 --- a/tests/run-make-fulldeps/share-generics-dylib/instance_provider_a.rs +++ /dev/null @@ -1,6 +0,0 @@ -use std::cell::Cell; - -pub fn foo() { - let a: Cell = Cell::new(1); - a.set(123); -} diff --git a/tests/run-make-fulldeps/share-generics-dylib/instance_provider_b.rs b/tests/run-make-fulldeps/share-generics-dylib/instance_provider_b.rs deleted file mode 100644 index f613db873..000000000 --- a/tests/run-make-fulldeps/share-generics-dylib/instance_provider_b.rs +++ /dev/null @@ -1,6 +0,0 @@ -use std::cell::Cell; - -pub fn foo() { - let b: Cell = Cell::new(1); - b.set(123); -} diff --git a/tests/run-make-fulldeps/share-generics-dylib/instance_user_a_rlib.rs b/tests/run-make-fulldeps/share-generics-dylib/instance_user_a_rlib.rs deleted file mode 100644 index c8e6ab95c..000000000 --- a/tests/run-make-fulldeps/share-generics-dylib/instance_user_a_rlib.rs +++ /dev/null @@ -1,9 +0,0 @@ -extern crate instance_provider_a as upstream; -use std::cell::Cell; - -pub fn foo() { - upstream::foo(); - - let b: Cell = Cell::new(1); - b.set(123); -} diff --git a/tests/run-make-fulldeps/share-generics-dylib/instance_user_b_rlib.rs b/tests/run-make-fulldeps/share-generics-dylib/instance_user_b_rlib.rs deleted file mode 100644 index 7c34af6d0..000000000 --- a/tests/run-make-fulldeps/share-generics-dylib/instance_user_b_rlib.rs +++ /dev/null @@ -1,9 +0,0 @@ -extern crate instance_provider_b as upstream; -use std::cell::Cell; - -pub fn foo() { - upstream::foo(); - - let b: Cell = Cell::new(1); - b.set(123); -} diff --git a/tests/run-make-fulldeps/share-generics-dylib/instance_user_dylib.rs b/tests/run-make-fulldeps/share-generics-dylib/instance_user_dylib.rs deleted file mode 100644 index 7c8368eec..000000000 --- a/tests/run-make-fulldeps/share-generics-dylib/instance_user_dylib.rs +++ /dev/null @@ -1,7 +0,0 @@ -extern crate instance_provider_a; -extern crate instance_provider_b; - -pub fn foo() { - instance_provider_a::foo(); - instance_provider_b::foo(); -} diff --git a/tests/run-make-fulldeps/share-generics-dylib/linked_leaf.rs b/tests/run-make-fulldeps/share-generics-dylib/linked_leaf.rs deleted file mode 100644 index e510dad69..000000000 --- a/tests/run-make-fulldeps/share-generics-dylib/linked_leaf.rs +++ /dev/null @@ -1,15 +0,0 @@ -extern crate instance_user_dylib; -extern crate instance_user_a_rlib; -extern crate instance_user_b_rlib; - -use std::cell::Cell; - -fn main() { - - instance_user_a_rlib::foo(); - instance_user_b_rlib::foo(); - instance_user_dylib::foo(); - - let a: Cell = Cell::new(1); - a.set(123); -} diff --git a/tests/run-make-fulldeps/simd-ffi/Makefile b/tests/run-make-fulldeps/simd-ffi/Makefile deleted file mode 100644 index 297353470..000000000 --- a/tests/run-make-fulldeps/simd-ffi/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -include ../tools.mk - -TARGETS = -ifeq ($(filter arm,$(LLVM_COMPONENTS)),arm) -# construct a fairly exhaustive list of platforms that we -# support. These ones don't follow a pattern -TARGETS += arm-linux-androideabi arm-unknown-linux-gnueabihf arm-unknown-linux-gnueabi -endif - -ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86) -X86_ARCHS = i686 x86_64 -else -X86_ARCHS = -endif - -# these ones do, each OS lists the architectures it supports -LINUX=$(filter aarch64 mips,$(LLVM_COMPONENTS)) $(X86_ARCHS) -ifeq ($(filter mips,$(LLVM_COMPONENTS)),mips) -LINUX += mipsel -endif - -WINDOWS=$(X86_ARCHS) -# fails with: failed to get iphonesimulator SDK path: no such file or directory -#IOS=i386 aarch64 armv7 -DARWIN=$(X86_ARCHS) - -$(foreach arch,$(LINUX),$(eval TARGETS += $(arch)-unknown-linux-gnu)) -$(foreach arch,$(WINDOWS),$(eval TARGETS += $(arch)-pc-windows-gnu)) -#$(foreach arch,$(IOS),$(eval TARGETS += $(arch)-apple-ios)) -$(foreach arch,$(DARWIN),$(eval TARGETS += $(arch)-apple-darwin)) - -all: $(TARGETS) - -define MK_TARGETS -# compile the rust file to the given target, but only to asm and IR -# form, to avoid having to have an appropriate linker. -# -# we need some features because the integer SIMD instructions are not -# enabled by-default for i686 and ARM; these features will be invalid -# on some platforms, but LLVM just prints a warning so that's fine for -# now. -$(1): simd.rs - $$(RUSTC) --target=$(1) --emit=llvm-ir,asm simd.rs \ - -C target-feature='+neon,+sse2' -C extra-filename=-$(1) -endef - -$(foreach targetxxx,$(TARGETS),$(eval $(call MK_TARGETS,$(targetxxx)))) diff --git a/tests/run-make-fulldeps/simd-ffi/simd.rs b/tests/run-make-fulldeps/simd-ffi/simd.rs deleted file mode 100644 index d11cfd77c..000000000 --- a/tests/run-make-fulldeps/simd-ffi/simd.rs +++ /dev/null @@ -1,82 +0,0 @@ -// ensures that public symbols are not removed completely -#![crate_type = "lib"] -// we can compile to a variety of platforms, because we don't need -// cross-compiled standard libraries. -#![feature(no_core, auto_traits)] -#![no_core] -#![feature(repr_simd, simd_ffi, link_llvm_intrinsics, lang_items, rustc_attrs)] - -#[derive(Copy)] -#[repr(simd)] -pub struct f32x4(f32, f32, f32, f32); - -extern "C" { - #[link_name = "llvm.sqrt.v4f32"] - fn vsqrt(x: f32x4) -> f32x4; -} - -pub fn foo(x: f32x4) -> f32x4 { - unsafe { vsqrt(x) } -} - -#[derive(Copy)] -#[repr(simd)] -pub struct i32x4(i32, i32, i32, i32); - -extern "C" { - // _mm_sll_epi32 - #[cfg(any(target_arch = "x86", target_arch = "x86-64"))] - #[link_name = "llvm.x86.sse2.psll.d"] - fn integer(a: i32x4, b: i32x4) -> i32x4; - - // vmaxq_s32 - #[cfg(target_arch = "arm")] - #[link_name = "llvm.arm.neon.vmaxs.v4i32"] - fn integer(a: i32x4, b: i32x4) -> i32x4; - // vmaxq_s32 - #[cfg(target_arch = "aarch64")] - #[link_name = "llvm.aarch64.neon.maxs.v4i32"] - fn integer(a: i32x4, b: i32x4) -> i32x4; - - // just some substitute foreign symbol, not an LLVM intrinsic; so - // we still get type checking, but not as detailed as (ab)using - // LLVM. - #[cfg(not(any( - target_arch = "x86", - target_arch = "x86-64", - target_arch = "arm", - target_arch = "aarch64" - )))] - fn integer(a: i32x4, b: i32x4) -> i32x4; -} - -pub fn bar(a: i32x4, b: i32x4) -> i32x4 { - unsafe { integer(a, b) } -} - -#[lang = "sized"] -pub trait Sized {} - -#[lang = "copy"] -pub trait Copy {} - -impl Copy for f32 {} -impl Copy for i32 {} - -pub mod marker { - pub use Copy; -} - -#[lang = "freeze"] -auto trait Freeze {} - -#[macro_export] -#[rustc_builtin_macro] -macro_rules! Copy { - () => {}; -} -#[macro_export] -#[rustc_builtin_macro] -macro_rules! derive { - () => {}; -} diff --git a/tests/run-make-fulldeps/simple-dylib/Makefile b/tests/run-make-fulldeps/simple-dylib/Makefile deleted file mode 100644 index 5dda5d66d..000000000 --- a/tests/run-make-fulldeps/simple-dylib/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk -all: - $(RUSTC) bar.rs --crate-type=dylib -C prefer-dynamic - $(RUSTC) foo.rs - $(call RUN,foo) diff --git a/tests/run-make-fulldeps/simple-dylib/bar.rs b/tests/run-make-fulldeps/simple-dylib/bar.rs deleted file mode 100644 index c5c0bc606..000000000 --- a/tests/run-make-fulldeps/simple-dylib/bar.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn bar() {} diff --git a/tests/run-make-fulldeps/simple-dylib/foo.rs b/tests/run-make-fulldeps/simple-dylib/foo.rs deleted file mode 100644 index 8d68535e3..000000000 --- a/tests/run-make-fulldeps/simple-dylib/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate bar; - -fn main() { - bar::bar(); -} diff --git a/tests/run-make-fulldeps/simple-rlib/Makefile b/tests/run-make-fulldeps/simple-rlib/Makefile deleted file mode 100644 index d912b8a7b..000000000 --- a/tests/run-make-fulldeps/simple-rlib/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk -all: - $(RUSTC) bar.rs --crate-type=rlib - $(RUSTC) foo.rs - $(call RUN,foo) diff --git a/tests/run-make-fulldeps/simple-rlib/bar.rs b/tests/run-make-fulldeps/simple-rlib/bar.rs deleted file mode 100644 index c5c0bc606..000000000 --- a/tests/run-make-fulldeps/simple-rlib/bar.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn bar() {} diff --git a/tests/run-make-fulldeps/simple-rlib/foo.rs b/tests/run-make-fulldeps/simple-rlib/foo.rs deleted file mode 100644 index 8d68535e3..000000000 --- a/tests/run-make-fulldeps/simple-rlib/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate bar; - -fn main() { - bar::bar(); -} diff --git a/tests/run-make-fulldeps/split-debuginfo/Makefile b/tests/run-make-fulldeps/split-debuginfo/Makefile deleted file mode 100644 index 44cda0d3d..000000000 --- a/tests/run-make-fulldeps/split-debuginfo/Makefile +++ /dev/null @@ -1,308 +0,0 @@ -include ../tools.mk - -all: off packed unpacked - -ifeq ($(UNAME),Darwin) -# If disabled, don't run `dsymutil`. -off: - rm -rf $(TMPDIR)/*.dSYM - $(RUSTC) foo.rs -g -C split-debuginfo=off - [ ! -d $(TMPDIR)/foo.dSYM ] - -# Packed by default, but only if debuginfo is requested -packed: - rm -rf $(TMPDIR)/*.dSYM - $(RUSTC) foo.rs - [ ! -d $(TMPDIR)/foo.dSYM ] - rm -rf $(TMPDIR)/*.dSYM - $(RUSTC) foo.rs -g - [ -d $(TMPDIR)/foo.dSYM ] - rm -rf $(TMPDIR)/*.dSYM - $(RUSTC) foo.rs -g -C split-debuginfo=packed - [ -d $(TMPDIR)/foo.dSYM ] - rm -rf $(TMPDIR)/*.dSYM - -# Object files are preserved with unpacked and `dsymutil` isn't run -unpacked: - $(RUSTC) foo.rs -g -C split-debuginfo=unpacked - ls $(TMPDIR)/*.o - [ ! -d $(TMPDIR)/foo.dSYM ] -else -ifdef IS_WINDOWS -# Windows only supports packed debuginfo - nothing to test. -off: -packed: -unpacked: -else -# Some non-Windows, non-Darwin platforms are not stable, and some are. -ifeq ($(UNAME),Linux) - UNSTABLEOPTS := -else - UNSTABLEOPTS := -Zunstable-options -endif - -# - Debuginfo in `.o` files -# - `.o` deleted -# - `.dwo` never created -# - `.dwp` never created -off: - $(RUSTC) foo.rs -g -C $(UNSTABLEOPTS) split-debuginfo=off - [ ! -f $(TMPDIR)/*.dwp ] - [ ! -f $(TMPDIR)/*.dwo ] - $(RUSTC) foo.rs -g - [ ! -f $(TMPDIR)/*.dwp ] - [ ! -f $(TMPDIR)/*.dwo ] - -packed: packed-split packed-single packed-lto packed-remapped packed-crosscrate - -# - Debuginfo in `.dwo` files -# - `.o` deleted -# - `.dwo` deleted -# - `.dwp` present -packed-split: - $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=packed -Zsplit-dwarf-kind=split - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - rm $(TMPDIR)/foo.dwp - rm $(TMPDIR)/$(call BIN,foo) - -# - Debuginfo in `.o` files -# - `.o` deleted -# - `.dwo` never created -# - `.dwp` present -packed-single: - $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=packed -Zsplit-dwarf-kind=single - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - rm $(TMPDIR)/foo.dwp - rm $(TMPDIR)/$(call BIN,foo) - -packed-lto: packed-lto-split packed-lto-single - -# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated -# - `.o` never created -# - `.dwo` never created -# - `.dwp` never created -packed-lto-split: - $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=packed -Zsplit-dwarf-kind=split \ - --crate-type=rlib -Clinker-plugin-lto - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/libbaz.rlib - -# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated -# - `.o` never created -# - `.dwo` never created -# - `.dwp` never created -packed-lto-single: - $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=packed -Zsplit-dwarf-kind=single \ - --crate-type=rlib -Clinker-plugin-lto - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/libbaz.rlib - -packed-remapped: packed-remapped-split packed-remapped-single - -# - Debuginfo in `.dwo` files -# - `.o` and binary refer to remapped `.dwo` paths which do not exist -# - `.o` deleted -# - `.dwo` deleted -# - `.dwp` present -packed-remapped-split: - $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \ - -Z split-dwarf-kind=split --remap-path-prefix $(TMPDIR)=/a foo.rs -g - objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - rm $(TMPDIR)/foo.dwp - rm $(TMPDIR)/$(call BIN,foo) - -# - Debuginfo in `.o` files -# - `.o` and binary refer to remapped `.o` paths which do not exist -# - `.o` deleted -# - `.dwo` never created -# - `.dwp` present -packed-remapped-single: - $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \ - -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a foo.rs -g - objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - rm $(TMPDIR)/foo.dwp - rm $(TMPDIR)/$(call BIN,foo) - -packed-crosscrate: packed-crosscrate-split packed-crosscrate-single - -# - Debuginfo in `.dwo` files -# - (bar) `.rlib` file created, contains `.dwo` -# - (bar) `.o` deleted -# - (bar) `.dwo` deleted -# - (bar) `.dwp` never created -# - (main) `.o` deleted -# - (main) `.dwo` deleted -# - (main) `.dwp` present -packed-crosscrate-split: - $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=packed \ - -Zsplit-dwarf-kind=split -C debuginfo=2 -g bar.rs - ls $(TMPDIR)/*.rlib - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \ - -C split-debuginfo=packed -Zsplit-dwarf-kind=split -C debuginfo=2 -g main.rs - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - rm $(TMPDIR)/main.dwp - rm $(TMPDIR)/$(call BIN,main) - -# - Debuginfo in `.o` files -# - (bar) `.rlib` file created, contains `.o` -# - (bar) `.o` deleted -# - (bar) `.dwo` never created -# - (bar) `.dwp` never created -# - (main) `.o` deleted -# - (main) `.dwo` never created -# - (main) `.dwp` present -packed-crosscrate-single: - $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=packed \ - -Zsplit-dwarf-kind=single -C debuginfo=2 -g bar.rs - ls $(TMPDIR)/*.rlib - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \ - -C split-debuginfo=packed -Zsplit-dwarf-kind=single -C debuginfo=2 -g main.rs - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - rm $(TMPDIR)/main.dwp - rm $(TMPDIR)/$(call BIN,main) - -unpacked: unpacked-split unpacked-single unpacked-lto unpacked-remapped unpacked-crosscrate - -# - Debuginfo in `.dwo` files -# - `.o` deleted -# - `.dwo` present -# - `.dwp` never created -unpacked-split: - $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=unpacked -Zsplit-dwarf-kind=split - ls $(TMPDIR)/*.o && exit 1 || exit 0 - rm $(TMPDIR)/*.dwo - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/$(call BIN,foo) - -# - Debuginfo in `.o` files -# - `.o` present -# - `.dwo` never created -# - `.dwp` never created -unpacked-single: - $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=unpacked -Zsplit-dwarf-kind=single - ls $(TMPDIR)/*.o - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/$(call BIN,foo) - -unpacked-lto: packed-lto-split packed-lto-single - -# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated -# - `.o` never created -# - `.dwo` never created -# - `.dwp` never created -unpacked-lto-split: - $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=unpacked -Zsplit-dwarf-kind=split \ - --crate-type=rlib -Clinker-plugin-lto - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/libbaz.rlib - -# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated -# - `.o` never created -# - `.dwo` never created -# - `.dwp` never created -unpacked-lto-single: - $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=unpacked -Zsplit-dwarf-kind=single \ - --crate-type=rlib -Clinker-plugin-lto - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/libbaz.rlib - -unpacked-remapped: unpacked-remapped-split unpacked-remapped-single - -# - Debuginfo in `.dwo` files -# - `.o` and binary refer to remapped `.dwo` paths which do not exist -# - `.o` deleted -# - `.dwo` present -# - `.dwp` never created -unpacked-remapped-split: - $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \ - -Z split-dwarf-kind=split --remap-path-prefix $(TMPDIR)=/a foo.rs -g - objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 - ls $(TMPDIR)/*.o && exit 1 || exit 0 - rm $(TMPDIR)/*.dwo - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/$(call BIN,foo) - -# - Debuginfo in `.o` files -# - `.o` and binary refer to remapped `.o` paths which do not exist -# - `.o` present -# - `.dwo` never created -# - `.dwp` never created -unpacked-remapped-single: - $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \ - -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a foo.rs -g - objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 - rm $(TMPDIR)/*.o - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/$(call BIN,foo) - -unpacked-crosscrate: unpacked-crosscrate-split unpacked-crosscrate-single - -# - Debuginfo in `.dwo` files -# - (bar) `.rlib` file created, contains `.dwo` -# - (bar) `.o` deleted -# - (bar) `.dwo` present -# - (bar) `.dwp` never created -# - (main) `.o` deleted -# - (main) `.dwo` present -# - (main) `.dwp` never created -unpacked-crosscrate-split: - $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=unpacked \ - -Zsplit-dwarf-kind=split -C debuginfo=2 -g bar.rs - ls $(TMPDIR)/*.rlib - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \ - -C split-debuginfo=unpacked -Zsplit-dwarf-kind=split -C debuginfo=2 -g main.rs - ls $(TMPDIR)/*.o && exit 1 || exit 0 - rm $(TMPDIR)/*.dwo - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/$(call BIN,main) - -# - Debuginfo in `.o` files -# - (bar) `.rlib` file created, contains `.o` -# - (bar) `.o` present -# - (bar) `.dwo` never created -# - (bar) `.dwp` never created -# - (main) `.o` present -# - (main) `.dwo` never created -# - (main) `.dwp` never created -unpacked-crosscrate-single: - $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=unpacked \ - -Zsplit-dwarf-kind=single -C debuginfo=2 -g bar.rs - ls $(TMPDIR)/*.rlib - ls $(TMPDIR)/*.o - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \ - -C split-debuginfo=unpacked -Zsplit-dwarf-kind=single -C debuginfo=2 -g main.rs - ls $(TMPDIR)/*.o - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/$(call BIN,main) -endif -endif diff --git a/tests/run-make-fulldeps/split-debuginfo/bar.rs b/tests/run-make-fulldeps/split-debuginfo/bar.rs deleted file mode 100644 index 07dd07152..000000000 --- a/tests/run-make-fulldeps/split-debuginfo/bar.rs +++ /dev/null @@ -1,13 +0,0 @@ -pub struct Bar { - x: u32, -} - -impl Bar { - pub fn print(&self) { - println!("{}", self.x); - } -} - -pub fn make_bar(x: u32) -> Bar { - Bar { x } -} diff --git a/tests/run-make-fulldeps/split-debuginfo/baz.rs b/tests/run-make-fulldeps/split-debuginfo/baz.rs deleted file mode 100644 index 8b1a39374..000000000 --- a/tests/run-make-fulldeps/split-debuginfo/baz.rs +++ /dev/null @@ -1 +0,0 @@ -// empty diff --git a/tests/run-make-fulldeps/split-debuginfo/foo.rs b/tests/run-make-fulldeps/split-debuginfo/foo.rs deleted file mode 100644 index b058e5408..000000000 --- a/tests/run-make-fulldeps/split-debuginfo/foo.rs +++ /dev/null @@ -1,15 +0,0 @@ -pub struct Foo { - x: u32, -} - -impl Foo { - pub fn print(&self) { - println!("{}", self.x); - } -} - -pub fn make_foo(x: u32) -> Foo { - Foo { x } -} - -fn main() {} diff --git a/tests/run-make-fulldeps/split-debuginfo/main.rs b/tests/run-make-fulldeps/split-debuginfo/main.rs deleted file mode 100644 index 21fa16e40..000000000 --- a/tests/run-make-fulldeps/split-debuginfo/main.rs +++ /dev/null @@ -1,8 +0,0 @@ -extern crate bar; - -use bar::{Bar, make_bar}; - -fn main() { - let b = make_bar(3); - b.print(); -} diff --git a/tests/run-make-fulldeps/stable-symbol-names/Makefile b/tests/run-make-fulldeps/stable-symbol-names/Makefile deleted file mode 100644 index bbfb8e388..000000000 --- a/tests/run-make-fulldeps/stable-symbol-names/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -include ../tools.mk - -# The following command will: -# 1. dump the symbols of a library using `nm` -# 2. extract only those lines that we are interested in via `grep` -# 3. from those lines, extract just the symbol name via `sed`, which: -# * always starts with "_ZN" and ends with "E" (`legacy` mangling) -# * always starts with "_R" (`v0` mangling) -# 4. sort those symbol names for deterministic comparison -# 5. write the result into a file - -dump-symbols = nm "$(TMPDIR)/lib$(1).rlib" \ - | grep -E "$(2)" \ - | sed -E "s/.*(_ZN.*E|_R[a-zA-Z0-9_]*).*/\1/" \ - | sort \ - > "$(TMPDIR)/$(1)$(3).nm" - -# This test -# - compiles each of the two crates 2 times and makes sure each time we get -# exactly the same symbol names -# - makes sure that both crates agree on the same symbol names for monomorphic -# functions - -all: - $(RUSTC) stable-symbol-names1.rs - $(call dump-symbols,stable_symbol_names1,generic_|mono_,_v1) - rm $(TMPDIR)/libstable_symbol_names1.rlib - $(RUSTC) stable-symbol-names1.rs - $(call dump-symbols,stable_symbol_names1,generic_|mono_,_v2) - cmp "$(TMPDIR)/stable_symbol_names1_v1.nm" "$(TMPDIR)/stable_symbol_names1_v2.nm" - - $(RUSTC) stable-symbol-names2.rs - $(call dump-symbols,stable_symbol_names2,generic_|mono_,_v1) - rm $(TMPDIR)/libstable_symbol_names2.rlib - $(RUSTC) stable-symbol-names2.rs - $(call dump-symbols,stable_symbol_names2,generic_|mono_,_v2) - cmp "$(TMPDIR)/stable_symbol_names2_v1.nm" "$(TMPDIR)/stable_symbol_names2_v2.nm" - - $(call dump-symbols,stable_symbol_names1,mono_,_cross) - $(call dump-symbols,stable_symbol_names2,mono_,_cross) - cmp "$(TMPDIR)/stable_symbol_names1_cross.nm" "$(TMPDIR)/stable_symbol_names2_cross.nm" diff --git a/tests/run-make-fulldeps/stable-symbol-names/stable-symbol-names1.rs b/tests/run-make-fulldeps/stable-symbol-names/stable-symbol-names1.rs deleted file mode 100644 index b85a42827..000000000 --- a/tests/run-make-fulldeps/stable-symbol-names/stable-symbol-names1.rs +++ /dev/null @@ -1,31 +0,0 @@ -#![crate_type="rlib"] - -pub trait Foo { - fn generic_method(); -} - -pub struct Bar; - -impl Foo for Bar { - fn generic_method() {} -} - -pub fn mono_function() { - Bar::generic_method::(); -} - -pub fn mono_function_lifetime<'a>(x: &'a u64) -> u64 { - *x -} - -pub fn generic_function(t: T) -> T { - t -} - -pub fn user() { - generic_function(0u32); - generic_function("abc"); - let x = 2u64; - generic_function(&x); - let _ = mono_function_lifetime(&x); -} diff --git a/tests/run-make-fulldeps/stable-symbol-names/stable-symbol-names2.rs b/tests/run-make-fulldeps/stable-symbol-names/stable-symbol-names2.rs deleted file mode 100644 index 33df9d6c6..000000000 --- a/tests/run-make-fulldeps/stable-symbol-names/stable-symbol-names2.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![crate_type="rlib"] - -extern crate stable_symbol_names1; - -pub fn user() { - stable_symbol_names1::generic_function(1u32); - stable_symbol_names1::generic_function("def"); - let x = 2u64; - stable_symbol_names1::generic_function(&x); - stable_symbol_names1::mono_function(); - stable_symbol_names1::mono_function_lifetime(&0); -} - -pub fn trait_impl_test_function() { - use stable_symbol_names1::*; - Bar::generic_method::(); -} diff --git a/tests/run-make-fulldeps/static-dylib-by-default/Makefile b/tests/run-make-fulldeps/static-dylib-by-default/Makefile deleted file mode 100644 index eedd0b320..000000000 --- a/tests/run-make-fulldeps/static-dylib-by-default/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -include ../tools.mk - -TO_LINK := $(call DYLIB,bar) -ifdef IS_MSVC -LINK_ARG = $(TO_LINK:dll=dll.lib) -else -LINK_ARG = $(TO_LINK) -endif - -all: - $(RUSTC) foo.rs - $(RUSTC) bar.rs - $(CC) main.c $(call OUT_EXE,main) $(LINK_ARG) $(EXTRACFLAGS) - rm $(TMPDIR)/*.rlib - rm $(call DYLIB,foo) - $(call RUN,main) diff --git a/tests/run-make-fulldeps/static-dylib-by-default/bar.rs b/tests/run-make-fulldeps/static-dylib-by-default/bar.rs deleted file mode 100644 index 14421165e..000000000 --- a/tests/run-make-fulldeps/static-dylib-by-default/bar.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![crate_type = "dylib"] - -extern crate foo; - -#[no_mangle] -pub extern "C" fn bar() { - foo::foo(); -} diff --git a/tests/run-make-fulldeps/static-dylib-by-default/foo.rs b/tests/run-make-fulldeps/static-dylib-by-default/foo.rs deleted file mode 100644 index 7ebec8720..000000000 --- a/tests/run-make-fulldeps/static-dylib-by-default/foo.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "rlib"] -#![crate_type = "dylib"] - -pub fn foo() {} diff --git a/tests/run-make-fulldeps/static-dylib-by-default/main.c b/tests/run-make-fulldeps/static-dylib-by-default/main.c deleted file mode 100644 index 5f7f2c27c..000000000 --- a/tests/run-make-fulldeps/static-dylib-by-default/main.c +++ /dev/null @@ -1,6 +0,0 @@ -extern void bar(); - -int main() { - bar(); - return 0; -} diff --git a/tests/run-make-fulldeps/static-extern-type/Makefile b/tests/run-make-fulldeps/static-extern-type/Makefile deleted file mode 100644 index e9aa95e63..000000000 --- a/tests/run-make-fulldeps/static-extern-type/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,define-foo) - $(RUSTC) -ldefine-foo use-foo.rs - $(call RUN,use-foo) || exit 1 diff --git a/tests/run-make-fulldeps/static-extern-type/define-foo.c b/tests/run-make-fulldeps/static-extern-type/define-foo.c deleted file mode 100644 index 39be5acfa..000000000 --- a/tests/run-make-fulldeps/static-extern-type/define-foo.c +++ /dev/null @@ -1,11 +0,0 @@ -#include - -struct Foo { - uint8_t x; -}; - -struct Foo FOO = { 42 }; - -uint8_t bar(const struct Foo* foo) { - return foo->x; -} diff --git a/tests/run-make-fulldeps/static-extern-type/use-foo.rs b/tests/run-make-fulldeps/static-extern-type/use-foo.rs deleted file mode 100644 index 932b5b594..000000000 --- a/tests/run-make-fulldeps/static-extern-type/use-foo.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![feature(extern_types)] - -extern "C" { - type Foo; - static FOO: Foo; - fn bar(foo: *const Foo) -> u8; -} - -fn main() { - unsafe { - let foo = &FOO; - assert_eq!(bar(foo), 42); - } -} diff --git a/tests/run-make-fulldeps/static-unwinding/Makefile b/tests/run-make-fulldeps/static-unwinding/Makefile deleted file mode 100644 index 9c755d4ab..000000000 --- a/tests/run-make-fulldeps/static-unwinding/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) lib.rs - $(RUSTC) main.rs - $(call RUN,main) diff --git a/tests/run-make-fulldeps/static-unwinding/lib.rs b/tests/run-make-fulldeps/static-unwinding/lib.rs deleted file mode 100644 index 3fb1117a1..000000000 --- a/tests/run-make-fulldeps/static-unwinding/lib.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![crate_type = "rlib"] - -pub static mut statik: isize = 0; - -struct A; -impl Drop for A { - fn drop(&mut self) { - unsafe { statik = 1; } - } -} - -pub fn callback(f: F) where F: FnOnce() { - let _a = A; - f(); -} diff --git a/tests/run-make-fulldeps/static-unwinding/main.rs b/tests/run-make-fulldeps/static-unwinding/main.rs deleted file mode 100644 index 0c66ea1aa..000000000 --- a/tests/run-make-fulldeps/static-unwinding/main.rs +++ /dev/null @@ -1,24 +0,0 @@ -extern crate lib; - -use std::thread; - -static mut statik: isize = 0; - -struct A; -impl Drop for A { - fn drop(&mut self) { - unsafe { statik = 1; } - } -} - -fn main() { - thread::spawn(move|| { - let _a = A; - lib::callback(|| panic!()); - }).join().unwrap_err(); - - unsafe { - assert_eq!(lib::statik, 1); - assert_eq!(statik, 1); - } -} diff --git a/tests/run-make-fulldeps/staticlib-blank-lib/Makefile b/tests/run-make-fulldeps/staticlib-blank-lib/Makefile deleted file mode 100644 index fcbf87758..000000000 --- a/tests/run-make-fulldeps/staticlib-blank-lib/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - $(AR) crus $(TMPDIR)/libfoo.a foo.rs - $(AR) d $(TMPDIR)/libfoo.a foo.rs - $(RUSTC) foo.rs diff --git a/tests/run-make-fulldeps/staticlib-blank-lib/foo.rs b/tests/run-make-fulldeps/staticlib-blank-lib/foo.rs deleted file mode 100644 index bf48d069d..000000000 --- a/tests/run-make-fulldeps/staticlib-blank-lib/foo.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_type = "staticlib"] - -#[link(name = "foo", kind = "static")] -extern "C" {} - -fn main() {} diff --git a/tests/run-make-fulldeps/std-core-cycle/Makefile b/tests/run-make-fulldeps/std-core-cycle/Makefile deleted file mode 100644 index 4f2528637..000000000 --- a/tests/run-make-fulldeps/std-core-cycle/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -include ../tools.mk - -ifeq ($(UNAME),Darwin) -FLAGS := -else -ifdef IS_WINDOWS -FLAGS := -else -FLAGS := -C link-args=-Wl,--no-undefined -endif -endif - -all: - $(RUSTC) bar.rs - $(RUSTC) foo.rs $(FLAGS) - $(RUSTC) foo.rs $(FLAGS) -C panic=abort diff --git a/tests/run-make-fulldeps/std-core-cycle/bar.rs b/tests/run-make-fulldeps/std-core-cycle/bar.rs deleted file mode 100644 index 9f5e7c29b..000000000 --- a/tests/run-make-fulldeps/std-core-cycle/bar.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![feature(allocator_api)] -#![crate_type = "rlib"] - -use std::alloc::*; - -pub struct A; - -unsafe impl GlobalAlloc for A { - unsafe fn alloc(&self, _: Layout) -> *mut u8 { - loop {} - } - - unsafe fn dealloc(&self, _ptr: *mut u8, _: Layout) { - loop {} - } -} diff --git a/tests/run-make-fulldeps/std-core-cycle/foo.rs b/tests/run-make-fulldeps/std-core-cycle/foo.rs deleted file mode 100644 index 6aa6e1ac3..000000000 --- a/tests/run-make-fulldeps/std-core-cycle/foo.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![crate_type = "cdylib"] - -extern crate bar; - -#[global_allocator] -static A: bar::A = bar::A; - -#[no_mangle] -pub extern "C" fn a(a: u32, b: u32) -> u32 { - a / b -} diff --git a/tests/run-make-fulldeps/stdin-non-utf8/Makefile b/tests/run-make-fulldeps/stdin-non-utf8/Makefile deleted file mode 100644 index 709d4cf14..000000000 --- a/tests/run-make-fulldeps/stdin-non-utf8/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - cp non-utf8 $(TMPDIR)/non-utf.rs - cat $(TMPDIR)/non-utf.rs | $(RUSTC) - 2>&1 \ - | $(CGREP) "error: couldn't read from stdin, as it did not contain valid UTF-8" diff --git a/tests/run-make-fulldeps/stdin-non-utf8/non-utf8 b/tests/run-make-fulldeps/stdin-non-utf8/non-utf8 deleted file mode 100644 index bc87051a8..000000000 --- a/tests/run-make-fulldeps/stdin-non-utf8/non-utf8 +++ /dev/null @@ -1 +0,0 @@ -Ò diff --git a/tests/run-make-fulldeps/suspicious-library/Makefile b/tests/run-make-fulldeps/suspicious-library/Makefile deleted file mode 100644 index 2af9e85c2..000000000 --- a/tests/run-make-fulldeps/suspicious-library/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs -C prefer-dynamic - touch $(call DYLIB,foo-something-special) - touch $(call DYLIB,foo-something-special2) - $(RUSTC) bar.rs diff --git a/tests/run-make-fulldeps/suspicious-library/bar.rs b/tests/run-make-fulldeps/suspicious-library/bar.rs deleted file mode 100644 index 550c94cd0..000000000 --- a/tests/run-make-fulldeps/suspicious-library/bar.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate foo; - -fn main() { foo::foo() } diff --git a/tests/run-make-fulldeps/suspicious-library/foo.rs b/tests/run-make-fulldeps/suspicious-library/foo.rs deleted file mode 100644 index a382d8f2c..000000000 --- a/tests/run-make-fulldeps/suspicious-library/foo.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type = "dylib"] - -pub fn foo() {} diff --git a/tests/run-make-fulldeps/symbol-visibility/Makefile b/tests/run-make-fulldeps/symbol-visibility/Makefile deleted file mode 100644 index 17052ef4e..000000000 --- a/tests/run-make-fulldeps/symbol-visibility/Makefile +++ /dev/null @@ -1,122 +0,0 @@ -include ../tools.mk - -# ignore-windows-msvc - -NM=nm -D -CDYLIB_NAME=liba_cdylib.so -RDYLIB_NAME=liba_rust_dylib.so -PROC_MACRO_NAME=liba_proc_macro.so -EXE_NAME=an_executable -COMBINED_CDYLIB_NAME=libcombined_rlib_dylib.so - -ifeq ($(UNAME),Darwin) -NM=nm -gU -CDYLIB_NAME=liba_cdylib.dylib -RDYLIB_NAME=liba_rust_dylib.dylib -PROC_MACRO_NAME=liba_proc_macro.dylib -EXE_NAME=an_executable -COMBINED_CDYLIB_NAME=libcombined_rlib_dylib.dylib -endif - -ifdef IS_WINDOWS -NM=nm -g -CDYLIB_NAME=liba_cdylib.dll.a -RDYLIB_NAME=liba_rust_dylib.dll.a -PROC_MACRO_NAME=liba_proc_macro.dll -EXE_NAME=an_executable.exe -COMBINED_CDYLIB_NAME=libcombined_rlib_dylib.dll.a -endif - -# `grep` regex for symbols produced by either `legacy` or `v0` mangling -RE_ANY_RUST_SYMBOL="_ZN.*h.*E\|_R[a-zA-Z0-9_]+" - -all: - $(RUSTC) -Zshare-generics=no an_rlib.rs - $(RUSTC) -Zshare-generics=no a_cdylib.rs - $(RUSTC) -Zshare-generics=no a_rust_dylib.rs - $(RUSTC) -Zshare-generics=no a_proc_macro.rs - $(RUSTC) -Zshare-generics=no an_executable.rs - $(RUSTC) -Zshare-generics=no a_cdylib.rs --crate-name combined_rlib_dylib --crate-type=rlib,cdylib - - # Check that a cdylib exports its public #[no_mangle] functions - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_cdylib)" -eq "1" ] - # Check that a cdylib exports the public #[no_mangle] functions of dependencies - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] - # Check that a cdylib DOES NOT export any public Rust functions - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c $(RE_ANY_RUST_SYMBOL))" -eq "0" ] - - # Check that a Rust dylib exports its monomorphic functions - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rust_dylib)" -eq "1" ] - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_rust_function_from_rust_dylib)" -eq "1" ] - # Check that a Rust dylib does not export generics if -Zshare-generics=no - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_generic_function_from_rust_dylib)" -eq "0" ] - - - # Check that a Rust dylib exports the monomorphic functions from its dependencies - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_rust_function_from_rlib)" -eq "1" ] - # Check that a Rust dylib does not export generics if -Zshare-generics=no - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_generic_function_from_rlib)" -eq "0" ] - - # Check that a proc macro exports its public #[no_mangle] functions - # FIXME(#99978) avoid exporting #[no_mangle] symbols for proc macros - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_cdylib)" -eq "1" ] - # Check that a proc macro exports the public #[no_mangle] functions of dependencies - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] - # Check that a proc macro DOES NOT export any public Rust functions - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c $(RE_ANY_RUST_SYMBOL))" -eq "0" ] - -# FIXME(nbdd0121): This is broken in MinGW, see https://github.com/rust-lang/rust/pull/95604#issuecomment-1101564032 -ifndef IS_WINDOWS - # Check that an executable does not export any dynamic symbols - [ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "0" ] - [ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -v __imp_ | grep -c public_rust_function_from_exe)" -eq "0" ] -endif - - - # Check the combined case, where we generate a cdylib and an rlib in the same - # compilation session: - # Check that a cdylib exports its public #[no_mangle] functions - [ "$$($(NM) $(TMPDIR)/$(COMBINED_CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_cdylib)" -eq "1" ] - # Check that a cdylib exports the public #[no_mangle] functions of dependencies - [ "$$($(NM) $(TMPDIR)/$(COMBINED_CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] - # Check that a cdylib DOES NOT export any public Rust functions - [ "$$($(NM) $(TMPDIR)/$(COMBINED_CDYLIB_NAME) | grep -v __imp_ | grep -c $(RE_ANY_RUST_SYMBOL))" -eq "0" ] - - - $(RUSTC) -Zshare-generics=yes an_rlib.rs - $(RUSTC) -Zshare-generics=yes a_cdylib.rs - $(RUSTC) -Zshare-generics=yes a_rust_dylib.rs - $(RUSTC) -Zshare-generics=yes a_proc_macro.rs - $(RUSTC) -Zshare-generics=yes an_executable.rs - - # Check that a cdylib exports its public #[no_mangle] functions - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_cdylib)" -eq "1" ] - # Check that a cdylib exports the public #[no_mangle] functions of dependencies - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] - # Check that a cdylib DOES NOT export any public Rust functions - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c $(RE_ANY_RUST_SYMBOL))" -eq "0" ] - - # Check that a Rust dylib exports its monomorphic functions, including generics this time - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rust_dylib)" -eq "1" ] - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_rust_function_from_rust_dylib)" -eq "1" ] - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_generic_function_from_rust_dylib)" -eq "1" ] - - # Check that a Rust dylib exports the monomorphic functions from its dependencies - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_rust_function_from_rlib)" -eq "1" ] - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_generic_function_from_rlib)" -eq "1" ] - - # Check that a proc macro exports its public #[no_mangle] functions - # FIXME(#99978) avoid exporting #[no_mangle] symbols for proc macros - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_cdylib)" -eq "1" ] - # Check that a proc macro exports the public #[no_mangle] functions of dependencies - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] - # Check that a proc macro DOES NOT export any public Rust functions - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c $(RE_ANY_RUST_SYMBOL))" -eq "0" ] - -ifndef IS_WINDOWS - # Check that an executable does not export any dynamic symbols - [ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "0" ] - [ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -v __imp_ | grep -c public_rust_function_from_exe)" -eq "0" ] -endif diff --git a/tests/run-make-fulldeps/symbol-visibility/a_cdylib.rs b/tests/run-make-fulldeps/symbol-visibility/a_cdylib.rs deleted file mode 100644 index d4fbff85b..000000000 --- a/tests/run-make-fulldeps/symbol-visibility/a_cdylib.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![crate_type="cdylib"] - -extern crate an_rlib; - -// This should not be exported -pub fn public_rust_function_from_cdylib() {} - -// This should be exported -#[no_mangle] -pub extern "C" fn public_c_function_from_cdylib() { - an_rlib::public_c_function_from_rlib(); -} diff --git a/tests/run-make-fulldeps/symbol-visibility/a_proc_macro.rs b/tests/run-make-fulldeps/symbol-visibility/a_proc_macro.rs deleted file mode 100644 index 9fd1a8a67..000000000 --- a/tests/run-make-fulldeps/symbol-visibility/a_proc_macro.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![crate_type = "proc-macro"] - -extern crate an_rlib; - -// This should not be exported -#[no_mangle] -extern "C" fn public_c_function_from_cdylib() { - an_rlib::public_c_function_from_rlib(); -} diff --git a/tests/run-make-fulldeps/symbol-visibility/a_rust_dylib.rs b/tests/run-make-fulldeps/symbol-visibility/a_rust_dylib.rs deleted file mode 100644 index a47df0ab7..000000000 --- a/tests/run-make-fulldeps/symbol-visibility/a_rust_dylib.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![crate_type="dylib"] - -extern crate an_rlib; - -// This should be exported -pub fn public_rust_function_from_rust_dylib() {} - -// This should be exported -#[no_mangle] -pub extern "C" fn public_c_function_from_rust_dylib() { - let _ = public_generic_function_from_rust_dylib(1u16); -} - -// This should be exported if -Zshare-generics=yes -pub fn public_generic_function_from_rust_dylib(x: T) -> T { x } diff --git a/tests/run-make-fulldeps/symbol-visibility/an_executable.rs b/tests/run-make-fulldeps/symbol-visibility/an_executable.rs deleted file mode 100644 index 3f5e125ad..000000000 --- a/tests/run-make-fulldeps/symbol-visibility/an_executable.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![crate_type="bin"] - -extern crate an_rlib; - -pub fn public_rust_function_from_exe() {} - -fn main() {} diff --git a/tests/run-make-fulldeps/symbol-visibility/an_rlib.rs b/tests/run-make-fulldeps/symbol-visibility/an_rlib.rs deleted file mode 100644 index 3696422b1..000000000 --- a/tests/run-make-fulldeps/symbol-visibility/an_rlib.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![crate_type="rlib"] - -pub fn public_rust_function_from_rlib() {} - -#[no_mangle] -pub extern "C" fn public_c_function_from_rlib() { - let _ = public_generic_function_from_rlib(0u64); -} - -pub fn public_generic_function_from_rlib(x: T) -> T { - x -} diff --git a/tests/run-make-fulldeps/symbols-include-type-name/Makefile b/tests/run-make-fulldeps/symbols-include-type-name/Makefile deleted file mode 100644 index ac26a852e..000000000 --- a/tests/run-make-fulldeps/symbols-include-type-name/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -# Check that symbol names for methods include type names, instead of . - -OUT=$(TMPDIR)/lib.s - -all: - $(RUSTC) --crate-type staticlib --emit asm lib.rs - $(CGREP) Def < $(OUT) diff --git a/tests/run-make-fulldeps/symbols-include-type-name/lib.rs b/tests/run-make-fulldeps/symbols-include-type-name/lib.rs deleted file mode 100644 index 37d445917..000000000 --- a/tests/run-make-fulldeps/symbols-include-type-name/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub struct Def { - pub id: i32, -} - -impl Def { - pub fn new(id: i32) -> Def { - Def { id: id } - } -} - -#[no_mangle] -pub fn user() { - let _ = Def::new(0); -} diff --git a/tests/run-make-fulldeps/symlinked-extern/Makefile b/tests/run-make-fulldeps/symlinked-extern/Makefile deleted file mode 100644 index 058f43e85..000000000 --- a/tests/run-make-fulldeps/symlinked-extern/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include ../tools.mk - -# ignore-windows -# `ln` is actually `cp` on msys. - -all: - $(RUSTC) foo.rs - mkdir -p $(TMPDIR)/other - ln -nsf $(TMPDIR)/libfoo.rlib $(TMPDIR)/other - $(RUSTC) bar.rs -L $(TMPDIR) - $(RUSTC) baz.rs --extern foo=$(TMPDIR)/other/libfoo.rlib -L $(TMPDIR) diff --git a/tests/run-make-fulldeps/symlinked-extern/bar.rs b/tests/run-make-fulldeps/symlinked-extern/bar.rs deleted file mode 100644 index cd9c959d5..000000000 --- a/tests/run-make-fulldeps/symlinked-extern/bar.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_type = "rlib"] - -extern crate foo; - -pub fn bar(_s: foo::S) { -} diff --git a/tests/run-make-fulldeps/symlinked-extern/baz.rs b/tests/run-make-fulldeps/symlinked-extern/baz.rs deleted file mode 100644 index cd433a3ac..000000000 --- a/tests/run-make-fulldeps/symlinked-extern/baz.rs +++ /dev/null @@ -1,6 +0,0 @@ -extern crate bar; -extern crate foo; - -fn main() { - bar::bar(foo::foo()); -} diff --git a/tests/run-make-fulldeps/symlinked-extern/foo.rs b/tests/run-make-fulldeps/symlinked-extern/foo.rs deleted file mode 100644 index c00700b8c..000000000 --- a/tests/run-make-fulldeps/symlinked-extern/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![crate_type = "rlib"] - -pub struct S; - -pub fn foo() -> S { S } diff --git a/tests/run-make-fulldeps/symlinked-libraries/Makefile b/tests/run-make-fulldeps/symlinked-libraries/Makefile deleted file mode 100644 index 576bf7e54..000000000 --- a/tests/run-make-fulldeps/symlinked-libraries/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -# ignore-windows -# `ln` is actually `cp` on msys. - -all: - $(RUSTC) foo.rs -C prefer-dynamic - mkdir -p $(TMPDIR)/other - ln -nsf $(TMPDIR)/$(call DYLIB_GLOB,foo) $(TMPDIR)/other - $(RUSTC) bar.rs -L $(TMPDIR)/other diff --git a/tests/run-make-fulldeps/symlinked-libraries/bar.rs b/tests/run-make-fulldeps/symlinked-libraries/bar.rs deleted file mode 100644 index fde0d7466..000000000 --- a/tests/run-make-fulldeps/symlinked-libraries/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate foo; - -fn main() { - foo::bar(); -} diff --git a/tests/run-make-fulldeps/symlinked-libraries/foo.rs b/tests/run-make-fulldeps/symlinked-libraries/foo.rs deleted file mode 100644 index cde9e291b..000000000 --- a/tests/run-make-fulldeps/symlinked-libraries/foo.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type = "dylib"] - -pub fn bar() {} diff --git a/tests/run-make-fulldeps/symlinked-rlib/Makefile b/tests/run-make-fulldeps/symlinked-rlib/Makefile deleted file mode 100644 index 49d3f220a..000000000 --- a/tests/run-make-fulldeps/symlinked-rlib/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -# ignore-windows -# `ln` is actually `cp` on msys. - -all: - $(RUSTC) foo.rs --crate-type=rlib -o $(TMPDIR)/foo.xxx - ln -nsf $(TMPDIR)/foo.xxx $(TMPDIR)/libfoo.rlib - $(RUSTC) bar.rs -L $(TMPDIR) diff --git a/tests/run-make-fulldeps/symlinked-rlib/bar.rs b/tests/run-make-fulldeps/symlinked-rlib/bar.rs deleted file mode 100644 index fde0d7466..000000000 --- a/tests/run-make-fulldeps/symlinked-rlib/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate foo; - -fn main() { - foo::bar(); -} diff --git a/tests/run-make-fulldeps/symlinked-rlib/foo.rs b/tests/run-make-fulldeps/symlinked-rlib/foo.rs deleted file mode 100644 index c5c0bc606..000000000 --- a/tests/run-make-fulldeps/symlinked-rlib/foo.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn bar() {} diff --git a/tests/run-make-fulldeps/sysroot-crates-are-unstable/Makefile b/tests/run-make-fulldeps/sysroot-crates-are-unstable/Makefile deleted file mode 100644 index 1e267fb95..000000000 --- a/tests/run-make-fulldeps/sysroot-crates-are-unstable/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -all: - '$(PYTHON)' test.py diff --git a/tests/run-make-fulldeps/sysroot-crates-are-unstable/test.py b/tests/run-make-fulldeps/sysroot-crates-are-unstable/test.py deleted file mode 100644 index cb77eb34f..000000000 --- a/tests/run-make-fulldeps/sysroot-crates-are-unstable/test.py +++ /dev/null @@ -1,74 +0,0 @@ -import sys -import os -from os import listdir -from os.path import isfile, join -from subprocess import PIPE, Popen - - -# This is n list of files which are stable crates or simply are not crates, -# we don't check for the instability of these crates as they're all stable! -STABLE_CRATES = ['std', 'alloc', 'core', 'proc_macro', - 'rsbegin.o', 'rsend.o', 'dllcrt2.o', 'crt2.o', 'clang_rt'] - - -def convert_to_string(s): - if s.__class__.__name__ == 'bytes': - return s.decode('utf-8') - return s - - -def set_ld_lib_path(): - var = os.environ.get("LD_LIB_PATH_ENVVAR") - rpath = os.environ.get("HOST_RPATH_DIR") - if var and rpath: - path = os.environ.get(var) - if path: - os.environ[var] = rpath + os.pathsep + path - else: - os.environ[var] = rpath - - -def exec_command(command, to_input=None): - child = None - if to_input is None: - child = Popen(command, stdout=PIPE, stderr=PIPE) - else: - child = Popen(command, stdout=PIPE, stderr=PIPE, stdin=PIPE) - stdout, stderr = child.communicate(input=to_input) - return (convert_to_string(stdout), convert_to_string(stderr)) - - -def check_lib(lib): - if lib['name'] in STABLE_CRATES: - return True - print('verifying if {} is an unstable crate'.format(lib['name'])) - stdout, stderr = exec_command([os.environ['RUSTC'], '-', '--crate-type', 'rlib', - '--extern', '{}={}'.format(lib['name'], lib['path'])], - to_input=('extern crate {};'.format(lib['name'])).encode('utf-8')) - if not 'use of unstable library feature' in '{}{}'.format(stdout, stderr): - print('crate {} "{}" is not unstable'.format(lib['name'], lib['path'])) - print('{}{}'.format(stdout, stderr)) - print('') - return False - return True - -# Generate a list of all crates in the sysroot. To do this we list all files in -# rustc's sysroot, look at the filename, strip everything after the `-`, and -# strip the leading `lib` (if present) -def get_all_libs(dir_path): - return [{ 'path': join(dir_path, f), 'name': f[3:].split('-')[0] } - for f in listdir(dir_path) - if isfile(join(dir_path, f)) and f.endswith('.rlib') and f not in STABLE_CRATES] - - -set_ld_lib_path() -sysroot = exec_command([os.environ['RUSTC'], '--print', 'sysroot'])[0].replace('\n', '') -assert sysroot, "Could not read the rustc sysroot!" -libs = get_all_libs(join(sysroot, 'lib/rustlib/{}/lib'.format(os.environ['TARGET']))) - -ret = 0 -for lib in libs: - if not check_lib(lib): - # We continue so users can see all the not unstable crates. - ret = 1 -sys.exit(ret) diff --git a/tests/run-make-fulldeps/target-cpu-native/Makefile b/tests/run-make-fulldeps/target-cpu-native/Makefile deleted file mode 100644 index eb3ca1e13..000000000 --- a/tests/run-make-fulldeps/target-cpu-native/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -include ../tools.mk - -# only-linux -# only-x86_64 -# -# I *really* don't want to deal with a cross-platform way to compare file sizes, -# tests in `make` sort of are awful - -all: $(TMPDIR)/out.log - # Make sure no warnings about "unknown CPU `native`" were emitted - if [ "$$(wc -c $(TMPDIR)/out.log | cut -d' ' -f 1)" = "0" ]; then \ - echo no warnings generated; \ - else \ - exit 1; \ - fi - - -$(TMPDIR)/out.log: - $(RUSTC) foo.rs -C target-cpu=native 2>&1 | tee $(TMPDIR)/out.log - $(call RUN,foo) diff --git a/tests/run-make-fulldeps/target-cpu-native/foo.rs b/tests/run-make-fulldeps/target-cpu-native/foo.rs deleted file mode 100644 index f79c691f0..000000000 --- a/tests/run-make-fulldeps/target-cpu-native/foo.rs +++ /dev/null @@ -1,2 +0,0 @@ -fn main() { -} diff --git a/tests/run-make-fulldeps/target-specs/Makefile b/tests/run-make-fulldeps/target-specs/Makefile deleted file mode 100644 index a33f5368e..000000000 --- a/tests/run-make-fulldeps/target-specs/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include ../tools.mk -all: - $(RUSTC) foo.rs --target=my-awesome-platform.json --crate-type=lib --emit=asm - $(CGREP) -v morestack < $(TMPDIR)/foo.s - $(RUSTC) foo.rs --target=my-invalid-platform.json 2>&1 | $(CGREP) "Error loading target specification" - $(RUSTC) foo.rs --target=my-incomplete-platform.json 2>&1 | $(CGREP) 'Field llvm-target' - RUST_TARGET_PATH=. $(RUSTC) foo.rs --target=my-awesome-platform --crate-type=lib --emit=asm - RUST_TARGET_PATH=. $(RUSTC) foo.rs --target=my-x86_64-unknown-linux-gnu-platform --crate-type=lib --emit=asm - $(RUSTC) -Z unstable-options --target=my-awesome-platform.json --print target-spec-json > $(TMPDIR)/test-platform.json && $(RUSTC) -Z unstable-options --target=$(TMPDIR)/test-platform.json --print target-spec-json | diff -q $(TMPDIR)/test-platform.json - - $(RUSTC) foo.rs --target=definitely-not-builtin-target 2>&1 | $(CGREP) 'may not set is_builtin' - $(RUSTC) foo.rs --target=mismatching-data-layout --crate-type=lib diff --git a/tests/run-make-fulldeps/target-specs/definitely-not-builtin-target.json b/tests/run-make-fulldeps/target-specs/definitely-not-builtin-target.json deleted file mode 100644 index b36fa993d..000000000 --- a/tests/run-make-fulldeps/target-specs/definitely-not-builtin-target.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "arch": "x86_64", - "is-builtin": true, - "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128", - "llvm-target": "x86_64-unknown-unknown-gnu", - "target-pointer-width": "64" -} diff --git a/tests/run-make-fulldeps/target-specs/foo.rs b/tests/run-make-fulldeps/target-specs/foo.rs deleted file mode 100644 index 22939e879..000000000 --- a/tests/run-make-fulldeps/target-specs/foo.rs +++ /dev/null @@ -1,24 +0,0 @@ -#![feature(lang_items, no_core, auto_traits)] -#![no_core] - -#[lang = "copy"] -trait Copy {} - -#[lang = "sized"] -trait Sized {} - -#[lang = "freeze"] -auto trait Freeze {} - -#[lang = "start"] -fn start(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize { - 0 -} - -extern "C" { - fn _foo() -> [u8; 16]; -} - -fn _main() { - let _a = unsafe { _foo() }; -} diff --git a/tests/run-make-fulldeps/target-specs/mismatching-data-layout.json b/tests/run-make-fulldeps/target-specs/mismatching-data-layout.json deleted file mode 100644 index d12caaad1..000000000 --- a/tests/run-make-fulldeps/target-specs/mismatching-data-layout.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "arch": "x86_64", - "data-layout": "e-m:e-i64:16:32:64", - "llvm-target": "x86_64-unknown-unknown-gnu", - "target-pointer-width": "64" -} diff --git a/tests/run-make-fulldeps/target-specs/my-awesome-platform.json b/tests/run-make-fulldeps/target-specs/my-awesome-platform.json deleted file mode 100644 index 00de3de05..000000000 --- a/tests/run-make-fulldeps/target-specs/my-awesome-platform.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128", - "linker-flavor": "gcc", - "llvm-target": "i686-unknown-linux-gnu", - "target-endian": "little", - "target-pointer-width": "32", - "target-c-int-width": "32", - "arch": "x86", - "os": "linux", - "morestack": false -} diff --git a/tests/run-make-fulldeps/target-specs/my-incomplete-platform.json b/tests/run-make-fulldeps/target-specs/my-incomplete-platform.json deleted file mode 100644 index ceaa25cdf..000000000 --- a/tests/run-make-fulldeps/target-specs/my-incomplete-platform.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "data-layout": "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32", - "linker-flavor": "gcc", - "target-endian": "little", - "target-pointer-width": "32", - "target-c-int-width": "32", - "arch": "x86", - "os": "foo", - "morestack": false -} diff --git a/tests/run-make-fulldeps/target-specs/my-invalid-platform.json b/tests/run-make-fulldeps/target-specs/my-invalid-platform.json deleted file mode 100644 index 3feac45b7..000000000 --- a/tests/run-make-fulldeps/target-specs/my-invalid-platform.json +++ /dev/null @@ -1 +0,0 @@ -wow this json is really broke! diff --git a/tests/run-make-fulldeps/target-specs/my-x86_64-unknown-linux-gnu-platform.json b/tests/run-make-fulldeps/target-specs/my-x86_64-unknown-linux-gnu-platform.json deleted file mode 100644 index 6d5e964ed..000000000 --- a/tests/run-make-fulldeps/target-specs/my-x86_64-unknown-linux-gnu-platform.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "pre-link-args": {"gcc": ["-m64"]}, - "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", - "linker-flavor": "gcc", - "llvm-target": "x86_64-unknown-linux-gnu", - "target-endian": "little", - "target-pointer-width": "64", - "target-c-int-width": "32", - "arch": "x86_64", - "os": "linux", - "morestack": false -} diff --git a/tests/run-make-fulldeps/target-without-atomic-cas/Makefile b/tests/run-make-fulldeps/target-without-atomic-cas/Makefile deleted file mode 100644 index 451f03d66..000000000 --- a/tests/run-make-fulldeps/target-without-atomic-cas/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -# The target used below doesn't support atomic CAS operations. Verify that's the case -all: - $(RUSTC) --print cfg --target thumbv6m-none-eabi | $(CGREP) -v 'target_has_atomic="ptr"' diff --git a/tests/run-make-fulldeps/test-harness/Makefile b/tests/run-make-fulldeps/test-harness/Makefile deleted file mode 100644 index 1fe059b07..000000000 --- a/tests/run-make-fulldeps/test-harness/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -all: - # check that #[cfg_attr(..., ignore)] does the right thing. - $(RUSTC) --test test-ignore-cfg.rs --cfg ignorecfg - $(call RUN,test-ignore-cfg) | $(CGREP) 'shouldnotignore ... ok' 'shouldignore ... ignored' - $(call RUN,test-ignore-cfg --quiet) | $(CGREP) -e "^i\.$$" - $(call RUN,test-ignore-cfg --quiet) | $(CGREP) -v 'should' diff --git a/tests/run-make-fulldeps/test-harness/test-ignore-cfg.rs b/tests/run-make-fulldeps/test-harness/test-ignore-cfg.rs deleted file mode 100644 index 31ef131f2..000000000 --- a/tests/run-make-fulldeps/test-harness/test-ignore-cfg.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -#[cfg_attr(ignorecfg, ignore)] -fn shouldignore() { -} - -#[test] -#[cfg_attr(noignorecfg, ignore)] -fn shouldnotignore() { -} diff --git a/tests/run-make-fulldeps/tools.mk b/tests/run-make-fulldeps/tools.mk deleted file mode 100644 index 0f5425daa..000000000 --- a/tests/run-make-fulldeps/tools.mk +++ /dev/null @@ -1,187 +0,0 @@ -# These deliberately use `=` and not `:=` so that client makefiles can -# augment HOST_RPATH_DIR / TARGET_RPATH_DIR. -HOST_RPATH_ENV = \ - $(LD_LIB_PATH_ENVVAR)="$(TMPDIR):$(HOST_RPATH_DIR):$($(LD_LIB_PATH_ENVVAR))" -TARGET_RPATH_ENV = \ - $(LD_LIB_PATH_ENVVAR)="$(TMPDIR):$(TARGET_RPATH_DIR):$($(LD_LIB_PATH_ENVVAR))" - -RUSTC_ORIGINAL := $(RUSTC) -BARE_RUSTC := $(HOST_RPATH_ENV) '$(RUSTC)' -BARE_RUSTDOC := $(HOST_RPATH_ENV) '$(RUSTDOC)' -RUSTC := $(BARE_RUSTC) --out-dir $(TMPDIR) -L $(TMPDIR) $(RUSTFLAGS) -RUSTDOC := $(BARE_RUSTDOC) -L $(TARGET_RPATH_DIR) -ifdef RUSTC_LINKER -RUSTC := $(RUSTC) -Clinker='$(RUSTC_LINKER)' -RUSTDOC := $(RUSTDOC) -Clinker='$(RUSTC_LINKER)' -endif -#CC := $(CC) -L $(TMPDIR) -HTMLDOCCK := '$(PYTHON)' '$(S)/src/etc/htmldocck.py' -CGREP := "$(S)/src/etc/cat-and-grep.sh" - -# diff with common flags for multi-platform diffs against text output -DIFF := diff -u --strip-trailing-cr - -# Some of the Rust CI platforms use `/bin/dash` to run `shell` script in -# Makefiles. Other platforms, including many developer platforms, default to -# `/bin/bash`. (In many cases, `make` is actually using `/bin/sh`, but `sh` -# is configured to execute one or the other shell binary). `dash` features -# support only a small subset of `bash` features, so `dash` can be thought of as -# the lowest common denominator, and tests should be validated against `dash` -# whenever possible. Most developer platforms include `/bin/dash`, but to ensure -# tests still work when `/bin/dash`, if not available, this `SHELL` override is -# conditional: -ifndef IS_WINDOWS # dash interprets backslashes in executable paths incorrectly -ifneq (,$(wildcard /bin/dash)) -SHELL := /bin/dash -endif -endif - -# This is the name of the binary we will generate and run; use this -# e.g. for `$(CC) -o $(RUN_BINFILE)`. -RUN_BINFILE = $(TMPDIR)/$(1) - -# Invoke the generated binary on the remote machine if compiletest was -# configured to use a remote test device, otherwise run it on the current host. -ifdef REMOTE_TEST_CLIENT -# FIXME: if a test requires additional files, this will need to be changed to -# also push them (by changing the 0 to the number of additional files, and -# providing the path of the additional files as the last arguments). -EXECUTE = $(REMOTE_TEST_CLIENT) run 0 $(RUN_BINFILE) -else -EXECUTE = $(RUN_BINFILE) -endif - -# RUN and FAIL are basic way we will invoke the generated binary. On -# non-windows platforms, they set the LD_LIBRARY_PATH environment -# variable before running the binary. - -RLIB_GLOB = lib$(1)*.rlib -BIN = $(1) - -UNAME = $(shell uname) - -ifeq ($(UNAME),Darwin) -RUN = $(TARGET_RPATH_ENV) $(EXECUTE) -FAIL = $(TARGET_RPATH_ENV) $(EXECUTE) && exit 1 || exit 0 -DYLIB_GLOB = lib$(1)*.dylib -DYLIB = $(TMPDIR)/lib$(1).dylib -STATICLIB = $(TMPDIR)/lib$(1).a -STATICLIB_GLOB = lib$(1)*.a -else -ifdef IS_WINDOWS -RUN = PATH="$(PATH):$(TARGET_RPATH_DIR)" $(EXECUTE) -FAIL = PATH="$(PATH):$(TARGET_RPATH_DIR)" $(EXECUTE) && exit 1 || exit 0 -DYLIB_GLOB = $(1)*.dll -DYLIB = $(TMPDIR)/$(1).dll -ifdef IS_MSVC -STATICLIB = $(TMPDIR)/$(1).lib -STATICLIB_GLOB = $(1)*.lib -else -IMPLIB = $(TMPDIR)/lib$(1).dll.a -STATICLIB = $(TMPDIR)/lib$(1).a -STATICLIB_GLOB = lib$(1)*.a -endif -BIN = $(1).exe -LLVM_FILECHECK := $(shell cygpath -u "$(LLVM_FILECHECK)") -else -RUN = $(TARGET_RPATH_ENV) $(EXECUTE) -FAIL = $(TARGET_RPATH_ENV) $(EXECUTE) && exit 1 || exit 0 -DYLIB_GLOB = lib$(1)*.so -DYLIB = $(TMPDIR)/lib$(1).so -STATICLIB = $(TMPDIR)/lib$(1).a -STATICLIB_GLOB = lib$(1)*.a -endif -endif - -ifdef IS_MSVC -COMPILE_OBJ = $(CC) -c -Fo:`cygpath -w $(1)` $(2) -COMPILE_OBJ_CXX = $(CXX) -EHs -c -Fo:`cygpath -w $(1)` $(2) -NATIVE_STATICLIB_FILE = $(1).lib -NATIVE_STATICLIB = $(TMPDIR)/$(call NATIVE_STATICLIB_FILE,$(1)) -OUT_EXE=-Fe:`cygpath -w $(TMPDIR)/$(call BIN,$(1))` \ - -Fo:`cygpath -w $(TMPDIR)/$(1).obj` -else -COMPILE_OBJ = $(CC) -v -c -o $(1) $(2) -COMPILE_OBJ_CXX = $(CXX) -c -o $(1) $(2) -NATIVE_STATICLIB_FILE = lib$(1).a -NATIVE_STATICLIB = $(call STATICLIB,$(1)) -OUT_EXE=-o $(TMPDIR)/$(1) -endif - - -# Extra flags needed to compile a working executable with the standard library -ifdef IS_WINDOWS -ifdef IS_MSVC - EXTRACFLAGS := ws2_32.lib userenv.lib advapi32.lib bcrypt.lib -else - EXTRACFLAGS := -lws2_32 -luserenv -lbcrypt - EXTRACXXFLAGS := -lstdc++ - # So this is a bit hacky: we can't use the DLL version of libstdc++ because - # it pulls in the DLL version of libgcc, which means that we end up with 2 - # instances of the DW2 unwinding implementation. This is a problem on - # i686-pc-windows-gnu because each module (DLL/EXE) needs to register its - # unwind information with the unwinding implementation, and libstdc++'s - # __cxa_throw won't see the unwinding info we registered with our statically - # linked libgcc. - # - # Now, simply statically linking libstdc++ would fix this problem, except - # that it is compiled with the expectation that pthreads is dynamically - # linked as a DLL and will fail to link with a statically linked libpthread. - # - # So we end up with the following hack: we link use static:-bundle to only - # link the parts of libstdc++ that we actually use, which doesn't include - # the dependency on the pthreads DLL. - EXTRARSCXXFLAGS := -l static:-bundle=stdc++ -endif -else -ifeq ($(UNAME),Darwin) - EXTRACFLAGS := -lresolv - EXTRACXXFLAGS := -lc++ - EXTRARSCXXFLAGS := -lc++ -else -ifeq ($(UNAME),FreeBSD) - EXTRACFLAGS := -lm -lpthread -lgcc_s -else -ifeq ($(UNAME),SunOS) - EXTRACFLAGS := -lm -lpthread -lposix4 -lsocket -lresolv -else -ifeq ($(UNAME),OpenBSD) - EXTRACFLAGS := -lm -lpthread -lc++abi - RUSTC := $(RUSTC) -C linker="$(word 1,$(CC:ccache=))" -else - EXTRACFLAGS := -lm -lrt -ldl -lpthread - EXTRACXXFLAGS := -lstdc++ - EXTRARSCXXFLAGS := -lstdc++ -endif -endif -endif -endif -endif - -REMOVE_DYLIBS = rm $(TMPDIR)/$(call DYLIB_GLOB,$(1)) -REMOVE_RLIBS = rm $(TMPDIR)/$(call RLIB_GLOB,$(1)) - -%.a: %.o - $(AR) crus $@ $< -ifdef IS_MSVC -%.lib: lib%.o - $(MSVC_LIB) -out:`cygpath -w $@` $< -else -%.lib: lib%.o - $(AR) crus $@ $< -endif -%.dylib: %.o - $(CC) -dynamiclib -Wl,-dylib -o $@ $< -%.so: %.o - $(CC) -o $@ $< -shared - -ifdef IS_MSVC -%.dll: lib%.o - $(CC) $< -link -dll -out:`cygpath -w $@` -else -%.dll: lib%.o - $(CC) -o $@ $< -shared -Wl,--out-implib=$@.a -endif - -$(TMPDIR)/lib%.o: %.c - $(call COMPILE_OBJ,$@,$<) diff --git a/tests/run-make-fulldeps/type-mismatch-same-crate-name/Makefile b/tests/run-make-fulldeps/type-mismatch-same-crate-name/Makefile deleted file mode 100644 index a2a2a41c7..000000000 --- a/tests/run-make-fulldeps/type-mismatch-same-crate-name/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -include ../tools.mk - -all: - # compile two different versions of crateA - $(RUSTC) --crate-type=rlib crateA.rs -C metadata=-1 -C extra-filename=-1 - $(RUSTC) --crate-type=rlib crateA.rs -C metadata=-2 -C extra-filename=-2 - # make crateB depend on version 1 of crateA - $(RUSTC) --crate-type=rlib crateB.rs --extern crateA=$(TMPDIR)/libcrateA-1.rlib - # make crateC depend on version 2 of crateA - $(RUSTC) crateC.rs --extern crateA=$(TMPDIR)/libcrateA-2.rlib 2>&1 | \ - tr -d '\r\n' | $(CGREP) -e \ - "mismatched types.*\ - crateB::try_foo\(foo2\);.*\ - expected \`crateA::foo::Foo\`, found \`Foo\`.*\ - different versions of crate \`crateA\`.*\ - mismatched types.*\ - crateB::try_bar\(bar2\);.*\ - expected trait \`crateA::bar::Bar\`, found trait \`Bar\`.*\ - different versions of crate \`crateA\`" diff --git a/tests/run-make-fulldeps/type-mismatch-same-crate-name/crateA.rs b/tests/run-make-fulldeps/type-mismatch-same-crate-name/crateA.rs deleted file mode 100644 index 4871c8c2e..000000000 --- a/tests/run-make-fulldeps/type-mismatch-same-crate-name/crateA.rs +++ /dev/null @@ -1,16 +0,0 @@ -mod foo { - pub struct Foo; -} - -mod bar { - pub trait Bar{} - - pub fn bar() -> Box { - unimplemented!() - } -} - -// This makes the publicly accessible path -// differ from the internal one. -pub use foo::Foo; -pub use bar::{Bar, bar}; diff --git a/tests/run-make-fulldeps/type-mismatch-same-crate-name/crateB.rs b/tests/run-make-fulldeps/type-mismatch-same-crate-name/crateB.rs deleted file mode 100644 index 24fcc7cad..000000000 --- a/tests/run-make-fulldeps/type-mismatch-same-crate-name/crateB.rs +++ /dev/null @@ -1,4 +0,0 @@ -extern crate crateA; - -pub fn try_foo(x: crateA::Foo){} -pub fn try_bar(x: Box){} diff --git a/tests/run-make-fulldeps/type-mismatch-same-crate-name/crateC.rs b/tests/run-make-fulldeps/type-mismatch-same-crate-name/crateC.rs deleted file mode 100644 index 71b38a9f8..000000000 --- a/tests/run-make-fulldeps/type-mismatch-same-crate-name/crateC.rs +++ /dev/null @@ -1,25 +0,0 @@ -// This tests the extra note reported when a type error deals with -// seemingly identical types. -// The main use case of this error is when there are two crates -// (generally different versions of the same crate) with the same name -// causing a type mismatch. - -// The test is nearly the same as the one in -// ui/type/type-mismatch-same-crate-name.rs -// but deals with the case where one of the crates -// is only introduced as an indirect dependency. -// and the type is accessed via a re-export. -// This is similar to how the error can be introduced -// when using cargo's automatic dependency resolution. - -extern crate crateA; - -fn main() { - let foo2 = crateA::Foo; - let bar2 = crateA::bar(); - { - extern crate crateB; - crateB::try_foo(foo2); - crateB::try_bar(bar2); - } -} diff --git a/tests/run-make-fulldeps/use-extern-for-plugins/Makefile b/tests/run-make-fulldeps/use-extern-for-plugins/Makefile deleted file mode 100644 index 6ae53afad..000000000 --- a/tests/run-make-fulldeps/use-extern-for-plugins/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -include ../tools.mk - -# ignore-freebsd -# ignore-openbsd -# ignore-sunos - -HOST := $(shell $(RUSTC) -vV | grep 'host:' | sed 's/host: //') -ifeq ($(findstring i686,$(HOST)),i686) -TARGET := $(subst i686,x86_64,$(HOST)) -else -TARGET := $(subst x86_64,i686,$(HOST)) -endif - -all: - $(RUSTC) foo.rs -C extra-filename=-host - $(RUSTC) bar.rs -C extra-filename=-targ --target $(TARGET) - $(RUSTC) baz.rs --extern a=$(TMPDIR)/liba-targ.rlib --target $(TARGET) diff --git a/tests/run-make-fulldeps/use-extern-for-plugins/bar.rs b/tests/run-make-fulldeps/use-extern-for-plugins/bar.rs deleted file mode 100644 index 704d21203..000000000 --- a/tests/run-make-fulldeps/use-extern-for-plugins/bar.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![feature(no_core)] -#![no_core] -#![crate_type = "lib"] -#![crate_name = "a"] - -#[macro_export] -macro_rules! bar { - () => () -} diff --git a/tests/run-make-fulldeps/use-extern-for-plugins/baz.rs b/tests/run-make-fulldeps/use-extern-for-plugins/baz.rs deleted file mode 100644 index 49a96a0c8..000000000 --- a/tests/run-make-fulldeps/use-extern-for-plugins/baz.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![feature(no_core)] -#![no_core] -#![crate_type = "lib"] - -#[macro_use] -extern crate a; - -bar!(); diff --git a/tests/run-make-fulldeps/use-extern-for-plugins/foo.rs b/tests/run-make-fulldeps/use-extern-for-plugins/foo.rs deleted file mode 100644 index dffdc0798..000000000 --- a/tests/run-make-fulldeps/use-extern-for-plugins/foo.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![no_std] -#![crate_type = "lib"] -#![crate_name = "a"] - -#[macro_export] -macro_rules! foo { - () => () -} diff --git a/tests/run-make-fulldeps/use-suggestions-rust-2018/Makefile b/tests/run-make-fulldeps/use-suggestions-rust-2018/Makefile deleted file mode 100644 index 37cd6283c..000000000 --- a/tests/run-make-fulldeps/use-suggestions-rust-2018/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) ep-nested-lib.rs - - $(RUSTC) use-suggestions.rs --edition=2018 --extern ep_nested_lib=$(TMPDIR)/libep_nested_lib.rlib 2>&1 | $(CGREP) "use ep_nested_lib::foo::bar::Baz" - diff --git a/tests/run-make-fulldeps/use-suggestions-rust-2018/ep-nested-lib.rs b/tests/run-make-fulldeps/use-suggestions-rust-2018/ep-nested-lib.rs deleted file mode 100644 index 62a0a9d8f..000000000 --- a/tests/run-make-fulldeps/use-suggestions-rust-2018/ep-nested-lib.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![crate_type = "rlib"] - -pub mod foo { - pub mod bar { - pub struct Baz; - } -} diff --git a/tests/run-make-fulldeps/use-suggestions-rust-2018/use-suggestions.rs b/tests/run-make-fulldeps/use-suggestions-rust-2018/use-suggestions.rs deleted file mode 100644 index d262d6f98..000000000 --- a/tests/run-make-fulldeps/use-suggestions-rust-2018/use-suggestions.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - let x = Baz{}; -} diff --git a/tests/run-make-fulldeps/used-cdylib-macos/Makefile b/tests/run-make-fulldeps/used-cdylib-macos/Makefile deleted file mode 100644 index 38a4c31c7..000000000 --- a/tests/run-make-fulldeps/used-cdylib-macos/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include ../tools.mk - -# only-macos -# -# This checks that `#[used]` passes through to the linker on -# darwin. This is subject to change in the future, see -# https://github.com/rust-lang/rust/pull/93718 for discussion - -all: - $(RUSTC) -Copt-level=3 dylib_used.rs - nm $(TMPDIR)/libdylib_used.dylib | $(CGREP) VERY_IMPORTANT_SYMBOL diff --git a/tests/run-make-fulldeps/used-cdylib-macos/dylib_used.rs b/tests/run-make-fulldeps/used-cdylib-macos/dylib_used.rs deleted file mode 100644 index 85f0ff92f..000000000 --- a/tests/run-make-fulldeps/used-cdylib-macos/dylib_used.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "cdylib"] - -#[used] -static VERY_IMPORTANT_SYMBOL: u32 = 12345; diff --git a/tests/run-make-fulldeps/used/Makefile b/tests/run-make-fulldeps/used/Makefile deleted file mode 100644 index e80eb9e40..000000000 --- a/tests/run-make-fulldeps/used/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -# ignore-windows-msvc - -all: - $(RUSTC) -C opt-level=3 --emit=obj used.rs - nm $(TMPDIR)/used.o | $(CGREP) FOO diff --git a/tests/run-make-fulldeps/used/used.rs b/tests/run-make-fulldeps/used/used.rs deleted file mode 100644 index dca0a5e11..000000000 --- a/tests/run-make-fulldeps/used/used.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_type = "lib"] - -#[used] -static FOO: u32 = 0; - -static BAR: u32 = 0; diff --git a/tests/run-make-fulldeps/version/Makefile b/tests/run-make-fulldeps/version/Makefile deleted file mode 100644 index 3a130545d..000000000 --- a/tests/run-make-fulldeps/version/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) -V - $(RUSTC) -vV - $(RUSTC) --version --verbose diff --git a/tests/run-make-fulldeps/volatile-intrinsics/Makefile b/tests/run-make-fulldeps/volatile-intrinsics/Makefile deleted file mode 100644 index 2a78c7b9c..000000000 --- a/tests/run-make-fulldeps/volatile-intrinsics/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -all: - # The tests must pass... - $(RUSTC) main.rs - $(call RUN,main) - # ... and the loads/stores must not be optimized out. - $(RUSTC) main.rs --emit=llvm-ir - $(CGREP) "load volatile" "store volatile" < $(TMPDIR)/main.ll diff --git a/tests/run-make-fulldeps/volatile-intrinsics/main.rs b/tests/run-make-fulldeps/volatile-intrinsics/main.rs deleted file mode 100644 index 4295d95f3..000000000 --- a/tests/run-make-fulldeps/volatile-intrinsics/main.rs +++ /dev/null @@ -1,24 +0,0 @@ -#![feature(core_intrinsics, volatile)] - -use std::intrinsics::{ - unaligned_volatile_load, unaligned_volatile_store, volatile_load, volatile_store, -}; -use std::ptr::{read_volatile, write_volatile}; - -pub fn main() { - unsafe { - let mut i: isize = 1; - volatile_store(&mut i, 2); - assert_eq!(volatile_load(&i), 2); - } - unsafe { - let mut i: isize = 1; - unaligned_volatile_store(&mut i, 2); - assert_eq!(unaligned_volatile_load(&i), 2); - } - unsafe { - let mut i: isize = 1; - write_volatile(&mut i, 2); - assert_eq!(read_volatile(&i), 2); - } -} diff --git a/tests/run-make-fulldeps/weird-output-filenames/Makefile b/tests/run-make-fulldeps/weird-output-filenames/Makefile deleted file mode 100644 index d3a34e3b4..000000000 --- a/tests/run-make-fulldeps/weird-output-filenames/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -include ../tools.mk - -all: - cp foo.rs $(TMPDIR)/.foo.rs - $(RUSTC) $(TMPDIR)/.foo.rs 2>&1 \ - | $(CGREP) -e "invalid character.*in crate name:" - cp foo.rs $(TMPDIR)/.foo.bar - $(RUSTC) $(TMPDIR)/.foo.bar 2>&1 \ - | $(CGREP) -e "invalid character.*in crate name:" - cp foo.rs $(TMPDIR)/+foo+bar.rs - $(RUSTC) $(TMPDIR)/+foo+bar.rs 2>&1 \ - | $(CGREP) -e "invalid character.*in crate name:" - cp foo.rs $(TMPDIR)/-foo.rs - $(RUSTC) $(TMPDIR)/-foo.rs 2>&1 \ - | $(CGREP) 'crate names cannot start with a `-`' diff --git a/tests/run-make-fulldeps/weird-output-filenames/foo.rs b/tests/run-make-fulldeps/weird-output-filenames/foo.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/tests/run-make-fulldeps/weird-output-filenames/foo.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/windows-binary-no-external-deps/Makefile b/tests/run-make-fulldeps/windows-binary-no-external-deps/Makefile deleted file mode 100644 index 8960020fe..000000000 --- a/tests/run-make-fulldeps/windows-binary-no-external-deps/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -# only-windows - -PATH=$(SYSTEMROOT)/system32 - -all: - $(RUSTC) hello.rs - $(TMPDIR)/hello.exe diff --git a/tests/run-make-fulldeps/windows-binary-no-external-deps/hello.rs b/tests/run-make-fulldeps/windows-binary-no-external-deps/hello.rs deleted file mode 100644 index 47ad8c634..000000000 --- a/tests/run-make-fulldeps/windows-binary-no-external-deps/hello.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello World!"); -} diff --git a/tests/run-make-fulldeps/windows-spawn/Makefile b/tests/run-make-fulldeps/windows-spawn/Makefile deleted file mode 100644 index b6cdb169b..000000000 --- a/tests/run-make-fulldeps/windows-spawn/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -# only-windows - -all: - $(RUSTC) -o "$(TMPDIR)/hopefullydoesntexist bar.exe" hello.rs - $(RUSTC) spawn.rs - $(TMPDIR)/spawn.exe diff --git a/tests/run-make-fulldeps/windows-spawn/hello.rs b/tests/run-make-fulldeps/windows-spawn/hello.rs deleted file mode 100644 index 47ad8c634..000000000 --- a/tests/run-make-fulldeps/windows-spawn/hello.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello World!"); -} diff --git a/tests/run-make-fulldeps/windows-spawn/spawn.rs b/tests/run-make-fulldeps/windows-spawn/spawn.rs deleted file mode 100644 index c34da3d5f..000000000 --- a/tests/run-make-fulldeps/windows-spawn/spawn.rs +++ /dev/null @@ -1,12 +0,0 @@ -use std::io::ErrorKind; -use std::process::Command; - -fn main() { - // Make sure it doesn't try to run "hopefullydoesntexist bar.exe". - assert_eq!(Command::new("hopefullydoesntexist") - .arg("bar") - .spawn() - .unwrap_err() - .kind(), - ErrorKind::NotFound); -} diff --git a/tests/run-make-fulldeps/windows-subsystem/Makefile b/tests/run-make-fulldeps/windows-subsystem/Makefile deleted file mode 100644 index 78c4e2ac1..000000000 --- a/tests/run-make-fulldeps/windows-subsystem/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) windows.rs - $(RUSTC) console.rs diff --git a/tests/run-make-fulldeps/windows-subsystem/console.rs b/tests/run-make-fulldeps/windows-subsystem/console.rs deleted file mode 100644 index 61a92eb6a..000000000 --- a/tests/run-make-fulldeps/windows-subsystem/console.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![windows_subsystem = "console"] - -fn main() {} diff --git a/tests/run-make-fulldeps/windows-subsystem/windows.rs b/tests/run-make-fulldeps/windows-subsystem/windows.rs deleted file mode 100644 index 1138248f0..000000000 --- a/tests/run-make-fulldeps/windows-subsystem/windows.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![windows_subsystem = "windows"] - -fn main() {} diff --git a/tests/run-make/a-b-a-linker-guard/Makefile b/tests/run-make/a-b-a-linker-guard/Makefile new file mode 100644 index 000000000..43282eae0 --- /dev/null +++ b/tests/run-make/a-b-a-linker-guard/Makefile @@ -0,0 +1,16 @@ +# ignore-cross-compile +include ../tools.mk + +# Test that if we build `b` against a version of `a` that has one set +# of types, it will not run with a dylib that has a different set of +# types. + +# NOTE(eddyb) this test only works with the `legacy` mangling, +# and will probably get removed once `legacy` is gone. + +all: + $(RUSTC) a.rs --cfg x -C prefer-dynamic -Z unstable-options -C symbol-mangling-version=legacy + $(RUSTC) b.rs -C prefer-dynamic -Z unstable-options -C symbol-mangling-version=legacy + $(call RUN,b) + $(RUSTC) a.rs --cfg y -C prefer-dynamic -Z unstable-options -C symbol-mangling-version=legacy + $(call FAIL,b) diff --git a/tests/run-make/a-b-a-linker-guard/a.rs b/tests/run-make/a-b-a-linker-guard/a.rs new file mode 100644 index 000000000..aa07b1e71 --- /dev/null +++ b/tests/run-make/a-b-a-linker-guard/a.rs @@ -0,0 +1,8 @@ +#![crate_name = "a"] +#![crate_type = "dylib"] + +#[cfg(x)] +pub fn foo(x: u32) { } + +#[cfg(y)] +pub fn foo(x: i32) { } diff --git a/tests/run-make/a-b-a-linker-guard/b.rs b/tests/run-make/a-b-a-linker-guard/b.rs new file mode 100644 index 000000000..f30df120a --- /dev/null +++ b/tests/run-make/a-b-a-linker-guard/b.rs @@ -0,0 +1,7 @@ +#![crate_name = "b"] + +extern crate a; + +fn main() { + a::foo(22_u32); +} diff --git a/tests/run-make/alloc-no-oom-handling/Makefile b/tests/run-make/alloc-no-oom-handling/Makefile new file mode 100644 index 000000000..87f74c69c --- /dev/null +++ b/tests/run-make/alloc-no-oom-handling/Makefile @@ -0,0 +1,4 @@ +include ../tools.mk + +all: + $(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/alloc/src/lib.rs --cfg no_global_oom_handling diff --git a/tests/run-make/alloc-no-rc/Makefile b/tests/run-make/alloc-no-rc/Makefile new file mode 100644 index 000000000..9824b17e6 --- /dev/null +++ b/tests/run-make/alloc-no-rc/Makefile @@ -0,0 +1,4 @@ +include ../tools.mk + +all: + $(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/alloc/src/lib.rs --cfg no_rc diff --git a/tests/run-make/alloc-no-sync/Makefile b/tests/run-make/alloc-no-sync/Makefile new file mode 100644 index 000000000..04ec4c7d8 --- /dev/null +++ b/tests/run-make/alloc-no-sync/Makefile @@ -0,0 +1,4 @@ +include ../tools.mk + +all: + $(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/alloc/src/lib.rs --cfg no_sync diff --git a/tests/run-make/allow-non-lint-warnings-cmdline/Makefile b/tests/run-make/allow-non-lint-warnings-cmdline/Makefile new file mode 100644 index 000000000..78b9a7b98 --- /dev/null +++ b/tests/run-make/allow-non-lint-warnings-cmdline/Makefile @@ -0,0 +1,12 @@ +# ignore-cross-compile +include ../tools.mk + +# Test that -A warnings makes the 'empty trait list for derive' warning go away +OUT=$(shell $(RUSTC) foo.rs -A warnings 2>&1 | grep "warning" ) + +all: foo + test -z '$(OUT)' + +# This is just to make sure the above command actually succeeds +foo: + $(RUSTC) foo.rs -A warnings diff --git a/tests/run-make/allow-non-lint-warnings-cmdline/foo.rs b/tests/run-make/allow-non-lint-warnings-cmdline/foo.rs new file mode 100644 index 000000000..46e72da2d --- /dev/null +++ b/tests/run-make/allow-non-lint-warnings-cmdline/foo.rs @@ -0,0 +1,5 @@ +#[derive()] +#[derive(Copy, Clone)] +pub struct Foo; + +pub fn main() { } diff --git a/tests/run-make/allow-warnings-cmdline-stability/Makefile b/tests/run-make/allow-warnings-cmdline-stability/Makefile new file mode 100644 index 000000000..368a39af6 --- /dev/null +++ b/tests/run-make/allow-warnings-cmdline-stability/Makefile @@ -0,0 +1,16 @@ +# ignore-cross-compile +include ../tools.mk + +# Test that -A warnings makes the 'empty trait list for derive' warning go away +DEP=$(shell $(RUSTC) bar.rs) +OUT=$(shell $(RUSTC) foo.rs -A warnings 2>&1 | grep "warning" ) + +all: foo bar + test -z '$(OUT)' + +# These are just to ensure that the above commands actually work +bar: + $(RUSTC) bar.rs + +foo: bar + $(RUSTC) foo.rs -A warnings diff --git a/tests/run-make/allow-warnings-cmdline-stability/bar.rs b/tests/run-make/allow-warnings-cmdline-stability/bar.rs new file mode 100644 index 000000000..3dcfb9dad --- /dev/null +++ b/tests/run-make/allow-warnings-cmdline-stability/bar.rs @@ -0,0 +1,5 @@ +#![crate_type = "lib"] +#![feature(staged_api)] +#![unstable(feature = "unstable_test_feature", issue = "none")] + +pub fn baz() {} diff --git a/tests/run-make/allow-warnings-cmdline-stability/foo.rs b/tests/run-make/allow-warnings-cmdline-stability/foo.rs new file mode 100644 index 000000000..869b54354 --- /dev/null +++ b/tests/run-make/allow-warnings-cmdline-stability/foo.rs @@ -0,0 +1,5 @@ +#![feature(unstable_test_feature)] + +extern crate bar; + +pub fn main() { bar::baz() } diff --git a/tests/run-make/archive-duplicate-names/Makefile b/tests/run-make/archive-duplicate-names/Makefile new file mode 100644 index 000000000..5433a42d2 --- /dev/null +++ b/tests/run-make/archive-duplicate-names/Makefile @@ -0,0 +1,12 @@ +# ignore-cross-compile +include ../tools.mk + +all: + mkdir $(TMPDIR)/a + mkdir $(TMPDIR)/b + $(call COMPILE_OBJ,$(TMPDIR)/a/foo.o,foo.c) + $(call COMPILE_OBJ,$(TMPDIR)/b/foo.o,bar.c) + $(AR) crus $(TMPDIR)/libfoo.a $(TMPDIR)/a/foo.o $(TMPDIR)/b/foo.o + $(RUSTC) foo.rs + $(RUSTC) bar.rs + $(call RUN,bar) diff --git a/tests/run-make/archive-duplicate-names/bar.c b/tests/run-make/archive-duplicate-names/bar.c new file mode 100644 index 000000000..e42599986 --- /dev/null +++ b/tests/run-make/archive-duplicate-names/bar.c @@ -0,0 +1 @@ +void bar() {} diff --git a/tests/run-make/archive-duplicate-names/bar.rs b/tests/run-make/archive-duplicate-names/bar.rs new file mode 100644 index 000000000..994a98c2c --- /dev/null +++ b/tests/run-make/archive-duplicate-names/bar.rs @@ -0,0 +1,5 @@ +extern crate foo; + +fn main() { + foo::baz(); +} diff --git a/tests/run-make/archive-duplicate-names/foo.c b/tests/run-make/archive-duplicate-names/foo.c new file mode 100644 index 000000000..85e6cd8c3 --- /dev/null +++ b/tests/run-make/archive-duplicate-names/foo.c @@ -0,0 +1 @@ +void foo() {} diff --git a/tests/run-make/archive-duplicate-names/foo.rs b/tests/run-make/archive-duplicate-names/foo.rs new file mode 100644 index 000000000..0bf13c406 --- /dev/null +++ b/tests/run-make/archive-duplicate-names/foo.rs @@ -0,0 +1,14 @@ +#![crate_type = "rlib"] + +#[link(name = "foo", kind = "static")] +extern "C" { + fn foo(); + fn bar(); +} + +pub fn baz() { + unsafe { + foo(); + bar(); + } +} diff --git a/tests/run-make/arguments-non-c-like-enum/Makefile b/tests/run-make/arguments-non-c-like-enum/Makefile new file mode 100644 index 000000000..0c8d8bf3a --- /dev/null +++ b/tests/run-make/arguments-non-c-like-enum/Makefile @@ -0,0 +1,8 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) --crate-type=staticlib nonclike.rs + $(CC) test.c $(call STATICLIB,nonclike) $(call OUT_EXE,test) \ + $(EXTRACFLAGS) $(EXTRACXXFLAGS) + $(call RUN,test) diff --git a/tests/run-make/arguments-non-c-like-enum/nonclike.rs b/tests/run-make/arguments-non-c-like-enum/nonclike.rs new file mode 100644 index 000000000..57c2c6127 --- /dev/null +++ b/tests/run-make/arguments-non-c-like-enum/nonclike.rs @@ -0,0 +1,31 @@ +#[repr(C, u8)] +pub enum TT { + AA(u64, u64), + BB, +} + +#[no_mangle] +pub extern "C" fn tt_add(a: TT, b: TT) -> u64 { + match (a, b) { + (TT::AA(a1, b1), TT::AA(a2, b2)) => a1 + a2 + b1 + b2, + (TT::AA(a1, b1), TT::BB) => a1 + b1, + (TT::BB, TT::AA(a1, b1)) => a1 + b1, + _ => 0, + } +} + +#[repr(C, u8)] +pub enum T { + A(u64), + B, +} + +#[no_mangle] +pub extern "C" fn t_add(a: T, b: T) -> u64 { + match (a, b) { + (T::A(a), T::A(b)) => a + b, + (T::A(a), T::B) => a, + (T::B, T::A(b)) => b, + _ => 0, + } +} diff --git a/tests/run-make/arguments-non-c-like-enum/test.c b/tests/run-make/arguments-non-c-like-enum/test.c new file mode 100644 index 000000000..0a1621e49 --- /dev/null +++ b/tests/run-make/arguments-non-c-like-enum/test.c @@ -0,0 +1,66 @@ +#include +#include + +#include + +/* This is the code generated by cbindgen 0.12.1 for the `enum TT` + * type in nonclike.rs . */ +enum TT_Tag { + AA, + BB, +}; +typedef uint8_t TT_Tag; + +typedef struct { + uint64_t _0; + uint64_t _1; +} AA_Body; + +typedef struct { + TT_Tag tag; + union { + AA_Body aa; + }; +} TT; + +/* This is the code generated by cbindgen 0.12.1 for the `enum T` type + * in nonclike.rs . */ +enum T_Tag { + A, + B, +}; +typedef uint8_t T_Tag; + +typedef struct { + uint64_t _0; +} A_Body; + +typedef struct { + T_Tag tag; + union { + A_Body a; + }; +} T; + +/* These symbols are defined by the Rust staticlib built from + * nonclike.rs. */ +extern uint64_t t_add(T a, T b); +extern uint64_t tt_add(TT a, TT b); + +int main(int argc, char *argv[]) { + (void)argc; (void)argv; + + /* This example works. */ + TT xx = { .tag = AA, .aa = { ._0 = 1, ._1 = 2 } }; + TT yy = { .tag = AA, .aa = { ._0 = 10, ._1 = 20 } }; + uint64_t rr = tt_add(xx, yy); + assert(33 == rr); + + /* This one used to return an incorrect result (see issue #68190). */ + T x = { .tag = A, .a = { ._0 = 1 } }; + T y = { .tag = A, .a = { ._0 = 10 } }; + uint64_t r = t_add(x, y); + assert(11 == r); + + return 0; +} diff --git a/tests/run-make/atomic-lock-free/Makefile b/tests/run-make/atomic-lock-free/Makefile new file mode 100644 index 000000000..37e59624a --- /dev/null +++ b/tests/run-make/atomic-lock-free/Makefile @@ -0,0 +1,48 @@ +include ../tools.mk + +# This tests ensure that atomic types are never lowered into runtime library calls that are not +# guaranteed to be lock-free. + +all: +ifeq ($(UNAME),Linux) +ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86) + $(RUSTC) --target=i686-unknown-linux-gnu atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add + $(RUSTC) --target=x86_64-unknown-linux-gnu atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add +endif +ifeq ($(filter arm,$(LLVM_COMPONENTS)),arm) + $(RUSTC) --target=arm-unknown-linux-gnueabi atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add + $(RUSTC) --target=arm-unknown-linux-gnueabihf atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add + $(RUSTC) --target=armv7-unknown-linux-gnueabihf atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add + $(RUSTC) --target=thumbv7neon-unknown-linux-gnueabihf atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add +endif +ifeq ($(filter aarch64,$(LLVM_COMPONENTS)),aarch64) + $(RUSTC) --target=aarch64-unknown-linux-gnu atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add +endif +ifeq ($(filter mips,$(LLVM_COMPONENTS)),mips) + $(RUSTC) --target=mips-unknown-linux-gnu atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add + $(RUSTC) --target=mipsel-unknown-linux-gnu atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add +endif +ifeq ($(filter powerpc,$(LLVM_COMPONENTS)),powerpc) + $(RUSTC) --target=powerpc-unknown-linux-gnu atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add + $(RUSTC) --target=powerpc-unknown-linux-gnuspe atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add + $(RUSTC) --target=powerpc64-unknown-linux-gnu atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add + $(RUSTC) --target=powerpc64le-unknown-linux-gnu atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add +endif +ifeq ($(filter systemz,$(LLVM_COMPONENTS)),systemz) + $(RUSTC) --target=s390x-unknown-linux-gnu atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add +endif +endif diff --git a/tests/run-make/atomic-lock-free/atomic_lock_free.rs b/tests/run-make/atomic-lock-free/atomic_lock_free.rs new file mode 100644 index 000000000..47d90b185 --- /dev/null +++ b/tests/run-make/atomic-lock-free/atomic_lock_free.rs @@ -0,0 +1,66 @@ +#![feature(no_core, intrinsics, lang_items)] +#![crate_type="rlib"] +#![no_core] + +extern "rust-intrinsic" { + fn atomic_xadd_seqcst(dst: *mut T, src: T) -> T; +} + +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} +#[lang = "freeze"] +trait Freeze {} + +impl Copy for *mut T {} + +#[cfg(target_has_atomic = "8")] +pub unsafe fn atomic_u8(x: *mut u8) { + atomic_xadd_seqcst(x, 1); + atomic_xadd_seqcst(x, 1); +} +#[cfg(target_has_atomic = "8")] +pub unsafe fn atomic_i8(x: *mut i8) { + atomic_xadd_seqcst(x, 1); +} +#[cfg(target_has_atomic = "16")] +pub unsafe fn atomic_u16(x: *mut u16) { + atomic_xadd_seqcst(x, 1); +} +#[cfg(target_has_atomic = "16")] +pub unsafe fn atomic_i16(x: *mut i16) { + atomic_xadd_seqcst(x, 1); +} +#[cfg(target_has_atomic = "32")] +pub unsafe fn atomic_u32(x: *mut u32) { + atomic_xadd_seqcst(x, 1); +} +#[cfg(target_has_atomic = "32")] +pub unsafe fn atomic_i32(x: *mut i32) { + atomic_xadd_seqcst(x, 1); +} +#[cfg(target_has_atomic = "64")] +pub unsafe fn atomic_u64(x: *mut u64) { + atomic_xadd_seqcst(x, 1); +} +#[cfg(target_has_atomic = "64")] +pub unsafe fn atomic_i64(x: *mut i64) { + atomic_xadd_seqcst(x, 1); +} +#[cfg(target_has_atomic = "128")] +pub unsafe fn atomic_u128(x: *mut u128) { + atomic_xadd_seqcst(x, 1); +} +#[cfg(target_has_atomic = "128")] +pub unsafe fn atomic_i128(x: *mut i128) { + atomic_xadd_seqcst(x, 1); +} +#[cfg(target_has_atomic = "ptr")] +pub unsafe fn atomic_usize(x: *mut usize) { + atomic_xadd_seqcst(x, 1); +} +#[cfg(target_has_atomic = "ptr")] +pub unsafe fn atomic_isize(x: *mut isize) { + atomic_xadd_seqcst(x, 1); +} diff --git a/tests/run-make/bare-outfile/Makefile b/tests/run-make/bare-outfile/Makefile new file mode 100644 index 000000000..23b619ea0 --- /dev/null +++ b/tests/run-make/bare-outfile/Makefile @@ -0,0 +1,7 @@ +# ignore-cross-compile +include ../tools.mk + +all: + cp foo.rs $(TMPDIR) + cd $(TMPDIR) && $(RUSTC) -o foo foo.rs + $(call RUN,foo) diff --git a/tests/run-make/bare-outfile/foo.rs b/tests/run-make/bare-outfile/foo.rs new file mode 100644 index 000000000..f79c691f0 --- /dev/null +++ b/tests/run-make/bare-outfile/foo.rs @@ -0,0 +1,2 @@ +fn main() { +} diff --git a/tests/run-make/c-dynamic-dylib/Makefile b/tests/run-make/c-dynamic-dylib/Makefile new file mode 100644 index 000000000..b5bfbc765 --- /dev/null +++ b/tests/run-make/c-dynamic-dylib/Makefile @@ -0,0 +1,13 @@ +# ignore-cross-compile +include ../tools.mk + +# ignore-macos +# +# This hits an assertion in the linker on older versions of osx apparently + +all: $(call DYLIB,cfoo) + $(RUSTC) foo.rs -C prefer-dynamic + $(RUSTC) bar.rs + $(call RUN,bar) + $(call REMOVE_DYLIBS,cfoo) + $(call FAIL,bar) diff --git a/tests/run-make/c-dynamic-dylib/bar.rs b/tests/run-make/c-dynamic-dylib/bar.rs new file mode 100644 index 000000000..b8c798ffd --- /dev/null +++ b/tests/run-make/c-dynamic-dylib/bar.rs @@ -0,0 +1,5 @@ +extern crate foo; + +fn main() { + foo::rsfoo(); +} diff --git a/tests/run-make/c-dynamic-dylib/cfoo.c b/tests/run-make/c-dynamic-dylib/cfoo.c new file mode 100644 index 000000000..fea490cf9 --- /dev/null +++ b/tests/run-make/c-dynamic-dylib/cfoo.c @@ -0,0 +1,4 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int foo() { return 0; } diff --git a/tests/run-make/c-dynamic-dylib/foo.rs b/tests/run-make/c-dynamic-dylib/foo.rs new file mode 100644 index 000000000..9f7a9e221 --- /dev/null +++ b/tests/run-make/c-dynamic-dylib/foo.rs @@ -0,0 +1,10 @@ +#![crate_type = "dylib"] + +#[link(name = "cfoo")] +extern "C" { + fn foo(); +} + +pub fn rsfoo() { + unsafe { foo() } +} diff --git a/tests/run-make/c-dynamic-rlib/Makefile b/tests/run-make/c-dynamic-rlib/Makefile new file mode 100644 index 000000000..0475bd8ac --- /dev/null +++ b/tests/run-make/c-dynamic-rlib/Makefile @@ -0,0 +1,16 @@ +# ignore-cross-compile +include ../tools.mk + +# ignore-macos +# +# This hits an assertion in the linker on older versions of osx apparently + +# This overrides the LD_LIBRARY_PATH for RUN +TARGET_RPATH_DIR:=$(TARGET_RPATH_DIR):$(TMPDIR) + +all: $(call DYLIB,cfoo) + $(RUSTC) foo.rs + $(RUSTC) bar.rs + $(call RUN,bar) + $(call REMOVE_DYLIBS,cfoo) + $(call FAIL,bar) diff --git a/tests/run-make/c-dynamic-rlib/bar.rs b/tests/run-make/c-dynamic-rlib/bar.rs new file mode 100644 index 000000000..b8c798ffd --- /dev/null +++ b/tests/run-make/c-dynamic-rlib/bar.rs @@ -0,0 +1,5 @@ +extern crate foo; + +fn main() { + foo::rsfoo(); +} diff --git a/tests/run-make/c-dynamic-rlib/cfoo.c b/tests/run-make/c-dynamic-rlib/cfoo.c new file mode 100644 index 000000000..fea490cf9 --- /dev/null +++ b/tests/run-make/c-dynamic-rlib/cfoo.c @@ -0,0 +1,4 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int foo() { return 0; } diff --git a/tests/run-make/c-dynamic-rlib/foo.rs b/tests/run-make/c-dynamic-rlib/foo.rs new file mode 100644 index 000000000..3dd376f1f --- /dev/null +++ b/tests/run-make/c-dynamic-rlib/foo.rs @@ -0,0 +1,10 @@ +#![crate_type = "rlib"] + +#[link(name = "cfoo")] +extern "C" { + fn foo(); +} + +pub fn rsfoo() { + unsafe { foo() } +} diff --git a/tests/run-make/c-link-to-rust-dylib/Makefile b/tests/run-make/c-link-to-rust-dylib/Makefile new file mode 100644 index 000000000..2763cb6ed --- /dev/null +++ b/tests/run-make/c-link-to-rust-dylib/Makefile @@ -0,0 +1,18 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(TMPDIR)/$(call BIN,bar) + $(call RUN,bar) + $(call REMOVE_DYLIBS,foo) + $(call FAIL,bar) + +ifdef IS_MSVC +$(TMPDIR)/$(call BIN,bar): $(call DYLIB,foo) + $(CC) bar.c $(TMPDIR)/foo.dll.lib $(call OUT_EXE,bar) +else +$(TMPDIR)/$(call BIN,bar): $(call DYLIB,foo) + $(CC) bar.c -lfoo -o $(call RUN_BINFILE,bar) -L $(TMPDIR) +endif + +$(call DYLIB,foo): foo.rs + $(RUSTC) foo.rs diff --git a/tests/run-make/c-link-to-rust-dylib/bar.c b/tests/run-make/c-link-to-rust-dylib/bar.c new file mode 100644 index 000000000..bb4036b06 --- /dev/null +++ b/tests/run-make/c-link-to-rust-dylib/bar.c @@ -0,0 +1,6 @@ +void foo(); + +int main() { + foo(); + return 0; +} diff --git a/tests/run-make/c-link-to-rust-dylib/foo.rs b/tests/run-make/c-link-to-rust-dylib/foo.rs new file mode 100644 index 000000000..f197fa513 --- /dev/null +++ b/tests/run-make/c-link-to-rust-dylib/foo.rs @@ -0,0 +1,4 @@ +#![crate_type = "dylib"] + +#[no_mangle] +pub extern "C" fn foo() {} diff --git a/tests/run-make/c-link-to-rust-staticlib/Makefile b/tests/run-make/c-link-to-rust-staticlib/Makefile new file mode 100644 index 000000000..e14775f5c --- /dev/null +++ b/tests/run-make/c-link-to-rust-staticlib/Makefile @@ -0,0 +1,13 @@ +# ignore-cross-compile +include ../tools.mk + +# ignore-freebsd +# FIXME + +all: + $(RUSTC) foo.rs + $(CC) bar.c $(call STATICLIB,foo) $(call OUT_EXE,bar) \ + $(EXTRACFLAGS) $(EXTRACXXFLAGS) + $(call RUN,bar) + rm $(call STATICLIB,foo) + $(call RUN,bar) diff --git a/tests/run-make/c-link-to-rust-staticlib/bar.c b/tests/run-make/c-link-to-rust-staticlib/bar.c new file mode 100644 index 000000000..bb4036b06 --- /dev/null +++ b/tests/run-make/c-link-to-rust-staticlib/bar.c @@ -0,0 +1,6 @@ +void foo(); + +int main() { + foo(); + return 0; +} diff --git a/tests/run-make/c-link-to-rust-staticlib/foo.rs b/tests/run-make/c-link-to-rust-staticlib/foo.rs new file mode 100644 index 000000000..2e59432cd --- /dev/null +++ b/tests/run-make/c-link-to-rust-staticlib/foo.rs @@ -0,0 +1,4 @@ +#![crate_type = "staticlib"] + +#[no_mangle] +pub extern "C" fn foo() {} diff --git a/tests/run-make/c-link-to-rust-va-list-fn/Makefile b/tests/run-make/c-link-to-rust-va-list-fn/Makefile new file mode 100644 index 000000000..596c0fce3 --- /dev/null +++ b/tests/run-make/c-link-to-rust-va-list-fn/Makefile @@ -0,0 +1,7 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) checkrust.rs + $(CC) test.c $(call STATICLIB,checkrust) $(call OUT_EXE,test) $(EXTRACFLAGS) + $(call RUN,test) diff --git a/tests/run-make/c-link-to-rust-va-list-fn/checkrust.rs b/tests/run-make/c-link-to-rust-va-list-fn/checkrust.rs new file mode 100644 index 000000000..5830ef033 --- /dev/null +++ b/tests/run-make/c-link-to-rust-va-list-fn/checkrust.rs @@ -0,0 +1,148 @@ +#![crate_type = "staticlib"] +#![feature(c_variadic)] +#![feature(rustc_private)] + +extern crate libc; + +use libc::{c_char, c_double, c_int, c_long, c_longlong}; +use std::ffi::VaList; +use std::ffi::{CString, CStr}; + +macro_rules! continue_if { + ($cond:expr) => { + if !($cond) { + return 0xff; + } + } +} + +unsafe fn compare_c_str(ptr: *const c_char, val: &str) -> bool { + let cstr0 = CStr::from_ptr(ptr); + match CString::new(val) { + Ok(cstr1) => &*cstr1 == cstr0, + Err(_) => false, + } +} + +#[no_mangle] +pub unsafe extern "C" fn check_list_0(mut ap: VaList) -> usize { + continue_if!(ap.arg::() == 1); + continue_if!(ap.arg::() == 2); + continue_if!(ap.arg::() == 3); + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_list_1(mut ap: VaList) -> usize { + continue_if!(ap.arg::() == -1); + continue_if!(ap.arg::() == 'A' as c_char); + continue_if!(ap.arg::() == '4' as c_char); + continue_if!(ap.arg::() == ';' as c_char); + continue_if!(ap.arg::() == 0x32); + continue_if!(ap.arg::() == 0x10000001); + continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Valid!")); + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_list_2(mut ap: VaList) -> usize { + continue_if!(ap.arg::().floor() == 3.14f64.floor()); + continue_if!(ap.arg::() == 12); + continue_if!(ap.arg::() == 'a' as c_char); + continue_if!(ap.arg::().floor() == 6.18f64.floor()); + continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Hello")); + continue_if!(ap.arg::() == 42); + continue_if!(compare_c_str(ap.arg::<*const c_char>(), "World")); + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_list_copy_0(mut ap: VaList) -> usize { + continue_if!(ap.arg::().floor() == 6.28f64.floor()); + continue_if!(ap.arg::() == 16); + continue_if!(ap.arg::() == 'A' as c_char); + continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Skip Me!")); + ap.with_copy(|mut ap| { + if compare_c_str(ap.arg::<*const c_char>(), "Correct") { + 0 + } else { + 0xff + } + }) +} + +#[no_mangle] +pub unsafe extern "C" fn check_varargs_0(_: c_int, mut ap: ...) -> usize { + continue_if!(ap.arg::() == 42); + continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Hello, World!")); + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_varargs_1(_: c_int, mut ap: ...) -> usize { + continue_if!(ap.arg::().floor() == 3.14f64.floor()); + continue_if!(ap.arg::() == 12); + continue_if!(ap.arg::() == 'A' as c_char); + continue_if!(ap.arg::() == 1); + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_varargs_2(_: c_int, _ap: ...) -> usize { + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_varargs_3(_: c_int, mut ap: ...) -> usize { + continue_if!(ap.arg::() == 1); + continue_if!(ap.arg::() == 2); + continue_if!(ap.arg::() == 3); + continue_if!(ap.arg::() == 4); + continue_if!(ap.arg::() == 5); + continue_if!(ap.arg::() == 6); + continue_if!(ap.arg::() == 7); + continue_if!(ap.arg::() == 8); + continue_if!(ap.arg::() == 9); + continue_if!(ap.arg::() == 10); + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_varargs_4(_: c_double, mut ap: ...) -> usize { + continue_if!(ap.arg::() == 1.0); + continue_if!(ap.arg::() == 2.0); + continue_if!(ap.arg::() == 3.0); + continue_if!(ap.arg::() == 4.0); + continue_if!(ap.arg::() == 5.0); + continue_if!(ap.arg::() == 6.0); + continue_if!(ap.arg::() == 7.0); + continue_if!(ap.arg::() == 8.0); + continue_if!(ap.arg::() == 9.0); + continue_if!(ap.arg::() == 10.0); + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_varargs_5(_: c_int, mut ap: ...) -> usize { + continue_if!(ap.arg::() == 1.0); + continue_if!(ap.arg::() == 1); + continue_if!(ap.arg::() == 2.0); + continue_if!(ap.arg::() == 2); + continue_if!(ap.arg::() == 3.0); + continue_if!(ap.arg::() == 3); + continue_if!(ap.arg::() == 4.0); + continue_if!(ap.arg::() == 4); + continue_if!(ap.arg::() == 5); + continue_if!(ap.arg::() == 5.0); + continue_if!(ap.arg::() == 6); + continue_if!(ap.arg::() == 6.0); + continue_if!(ap.arg::() == 7); + continue_if!(ap.arg::() == 7.0); + continue_if!(ap.arg::() == 8); + continue_if!(ap.arg::() == 8.0); + continue_if!(ap.arg::() == 9); + continue_if!(ap.arg::() == 9.0); + continue_if!(ap.arg::() == 10); + continue_if!(ap.arg::() == 10.0); + 0 +} diff --git a/tests/run-make/c-link-to-rust-va-list-fn/test.c b/tests/run-make/c-link-to-rust-va-list-fn/test.c new file mode 100644 index 000000000..5bdb51680 --- /dev/null +++ b/tests/run-make/c-link-to-rust-va-list-fn/test.c @@ -0,0 +1,50 @@ +#include +#include +#include +#include +#include + +extern size_t check_list_0(va_list ap); +extern size_t check_list_1(va_list ap); +extern size_t check_list_2(va_list ap); +extern size_t check_list_copy_0(va_list ap); +extern size_t check_varargs_0(int fixed, ...); +extern size_t check_varargs_1(int fixed, ...); +extern size_t check_varargs_2(int fixed, ...); +extern size_t check_varargs_3(int fixed, ...); +extern size_t check_varargs_4(double fixed, ...); +extern size_t check_varargs_5(int fixed, ...); + +int test_rust(size_t (*fn)(va_list), ...) { + size_t ret = 0; + va_list ap; + va_start(ap, fn); + ret = fn(ap); + va_end(ap); + return ret; +} + +int main(int argc, char* argv[]) { + assert(test_rust(check_list_0, 0x01LL, 0x02, 0x03LL) == 0); + + assert(test_rust(check_list_1, -1, 'A', '4', ';', 0x32, 0x10000001, "Valid!") == 0); + + assert(test_rust(check_list_2, 3.14, 12l, 'a', 6.28, "Hello", 42, "World") == 0); + + assert(test_rust(check_list_copy_0, 6.28, 16, 'A', "Skip Me!", "Correct") == 0); + + assert(check_varargs_0(0, 42, "Hello, World!") == 0); + + assert(check_varargs_1(0, 3.14, 12l, 'A', 0x1LL) == 0); + + assert(check_varargs_2(0, "All", "of", "these", "are", "ignored", ".") == 0); + + assert(check_varargs_3(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) == 0); + + assert(check_varargs_4(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0) == 0); + + assert(check_varargs_5(0, 1.0, 1, 2.0, 2, 3.0, 3, 4.0, 4, 5, 5.0, 6, 6.0, 7, 7.0, 8, 8.0, + 9, 9.0, 10, 10.0) == 0); + + return 0; +} diff --git a/tests/run-make/c-static-dylib/Makefile b/tests/run-make/c-static-dylib/Makefile new file mode 100644 index 000000000..4e23edb6c --- /dev/null +++ b/tests/run-make/c-static-dylib/Makefile @@ -0,0 +1,10 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(call NATIVE_STATICLIB,cfoo) + $(RUSTC) foo.rs -C prefer-dynamic + $(RUSTC) bar.rs + rm $(call NATIVE_STATICLIB,cfoo) + $(call RUN,bar) + $(call REMOVE_DYLIBS,foo) + $(call FAIL,bar) diff --git a/tests/run-make/c-static-dylib/bar.rs b/tests/run-make/c-static-dylib/bar.rs new file mode 100644 index 000000000..b8c798ffd --- /dev/null +++ b/tests/run-make/c-static-dylib/bar.rs @@ -0,0 +1,5 @@ +extern crate foo; + +fn main() { + foo::rsfoo(); +} diff --git a/tests/run-make/c-static-dylib/cfoo.c b/tests/run-make/c-static-dylib/cfoo.c new file mode 100644 index 000000000..9fe07f82f --- /dev/null +++ b/tests/run-make/c-static-dylib/cfoo.c @@ -0,0 +1 @@ +int foo() { return 0; } diff --git a/tests/run-make/c-static-dylib/foo.rs b/tests/run-make/c-static-dylib/foo.rs new file mode 100644 index 000000000..1e8af4d44 --- /dev/null +++ b/tests/run-make/c-static-dylib/foo.rs @@ -0,0 +1,10 @@ +#![crate_type = "dylib"] + +#[link(name = "cfoo", kind = "static")] +extern "C" { + fn foo(); +} + +pub fn rsfoo() { + unsafe { foo() } +} diff --git a/tests/run-make/c-static-rlib/Makefile b/tests/run-make/c-static-rlib/Makefile new file mode 100644 index 000000000..4e351127c --- /dev/null +++ b/tests/run-make/c-static-rlib/Makefile @@ -0,0 +1,9 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(call NATIVE_STATICLIB,cfoo) + $(RUSTC) foo.rs + $(RUSTC) bar.rs + $(call REMOVE_RLIBS,foo) + rm $(call NATIVE_STATICLIB,cfoo) + $(call RUN,bar) diff --git a/tests/run-make/c-static-rlib/bar.rs b/tests/run-make/c-static-rlib/bar.rs new file mode 100644 index 000000000..b8c798ffd --- /dev/null +++ b/tests/run-make/c-static-rlib/bar.rs @@ -0,0 +1,5 @@ +extern crate foo; + +fn main() { + foo::rsfoo(); +} diff --git a/tests/run-make/c-static-rlib/cfoo.c b/tests/run-make/c-static-rlib/cfoo.c new file mode 100644 index 000000000..9fe07f82f --- /dev/null +++ b/tests/run-make/c-static-rlib/cfoo.c @@ -0,0 +1 @@ +int foo() { return 0; } diff --git a/tests/run-make/c-static-rlib/foo.rs b/tests/run-make/c-static-rlib/foo.rs new file mode 100644 index 000000000..9c6d2080e --- /dev/null +++ b/tests/run-make/c-static-rlib/foo.rs @@ -0,0 +1,10 @@ +#![crate_type = "rlib"] + +#[link(name = "cfoo", kind = "static")] +extern "C" { + fn foo(); +} + +pub fn rsfoo() { + unsafe { foo() } +} diff --git a/tests/run-make/c-unwind-abi-catch-lib-panic/Makefile b/tests/run-make/c-unwind-abi-catch-lib-panic/Makefile new file mode 100644 index 000000000..9c41a5a71 --- /dev/null +++ b/tests/run-make/c-unwind-abi-catch-lib-panic/Makefile @@ -0,0 +1,31 @@ +# ignore-cross-compile +include ../tools.mk + +all: archive + # Compile `main.rs`, which will link into our library, and run it. + $(RUSTC) main.rs + $(call RUN,main) + +ifdef IS_MSVC +archive: add.o panic.o + # Now, create an archive using these two objects. + $(AR) crus $(TMPDIR)/add.lib $(TMPDIR)/add.o $(TMPDIR)/panic.o +else +archive: add.o panic.o + # Now, create an archive using these two objects. + $(AR) crus $(TMPDIR)/libadd.a $(TMPDIR)/add.o $(TMPDIR)/panic.o +endif + +# Compile `panic.rs` into an object file. +# +# Note that we invoke `rustc` directly, so we may emit an object rather +# than an archive. We'll do that later. +panic.o: + $(BARE_RUSTC) $(RUSTFLAGS) \ + --out-dir $(TMPDIR) \ + --emit=obj panic.rs + +# Compile `add.c` into an object file. +add.o: + $(call COMPILE_OBJ,$(TMPDIR)/add.o,add.c) + diff --git a/tests/run-make/c-unwind-abi-catch-lib-panic/add.c b/tests/run-make/c-unwind-abi-catch-lib-panic/add.c new file mode 100644 index 000000000..444359451 --- /dev/null +++ b/tests/run-make/c-unwind-abi-catch-lib-panic/add.c @@ -0,0 +1,12 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + +// An external function, defined in Rust. +extern void panic_if_greater_than_10(unsigned x); + +unsigned add_small_numbers(unsigned a, unsigned b) { + unsigned c = a + b; + panic_if_greater_than_10(c); + return c; +} 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 new file mode 100644 index 000000000..78a71219c --- /dev/null +++ b/tests/run-make/c-unwind-abi-catch-lib-panic/main.rs @@ -0,0 +1,35 @@ +//! A test for calling `C-unwind` functions across foreign function boundaries. +//! +//! 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}; + +fn main() { + // Call `add_small_numbers`, passing arguments that will NOT trigger a panic. + let (a, b) = (9, 1); + let c = unsafe { add_small_numbers(a, b) }; + assert_eq!(c, 10); + + // Call `add_small_numbers`, passing arguments that will trigger a panic, and catch it. + let caught_unwind = catch_unwind(AssertUnwindSafe(|| { + let (a, b) = (10, 1); + let _c = unsafe { add_small_numbers(a, b) }; + unreachable!("should have unwound instead of returned"); + })); + + // Assert that we did indeed panic, then unwrap and downcast the panic into the sum. + assert!(caught_unwind.is_err()); + let panic_obj = caught_unwind.unwrap_err(); + let msg = panic_obj.downcast_ref::().unwrap(); + assert_eq!(msg, "11"); +} + +#[link(name = "add", kind = "static")] +extern "C-unwind" { + /// An external function, defined in C. + /// + /// Returns the sum of two numbers, or panics if the sum is greater than 10. + fn add_small_numbers(a: u32, b: u32) -> u32; +} 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 new file mode 100644 index 000000000..a99a04d5c --- /dev/null +++ b/tests/run-make/c-unwind-abi-catch-lib-panic/panic.rs @@ -0,0 +1,12 @@ +#![crate_type = "staticlib"] +#![feature(c_unwind)] + +/// This function will panic if `x` is greater than 10. +/// +/// This function is called by `add_small_numbers`. +#[no_mangle] +pub extern "C-unwind" fn panic_if_greater_than_10(x: u32) { + if x > 10 { + panic!("{}", x); // That is too big! + } +} diff --git a/tests/run-make/c-unwind-abi-catch-panic/Makefile b/tests/run-make/c-unwind-abi-catch-panic/Makefile new file mode 100644 index 000000000..4398ac2ee --- /dev/null +++ b/tests/run-make/c-unwind-abi-catch-panic/Makefile @@ -0,0 +1,6 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(call NATIVE_STATICLIB,add) + $(RUSTC) main.rs + $(call RUN,main) || exit 1 diff --git a/tests/run-make/c-unwind-abi-catch-panic/add.c b/tests/run-make/c-unwind-abi-catch-panic/add.c new file mode 100644 index 000000000..444359451 --- /dev/null +++ b/tests/run-make/c-unwind-abi-catch-panic/add.c @@ -0,0 +1,12 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + +// An external function, defined in Rust. +extern void panic_if_greater_than_10(unsigned x); + +unsigned add_small_numbers(unsigned a, unsigned b) { + unsigned c = a + b; + panic_if_greater_than_10(c); + return c; +} diff --git a/tests/run-make/c-unwind-abi-catch-panic/main.rs b/tests/run-make/c-unwind-abi-catch-panic/main.rs new file mode 100644 index 000000000..15d38d721 --- /dev/null +++ b/tests/run-make/c-unwind-abi-catch-panic/main.rs @@ -0,0 +1,44 @@ +//! 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}; + +fn main() { + // Call `add_small_numbers`, passing arguments that will NOT trigger a panic. + let (a, b) = (9, 1); + let c = unsafe { add_small_numbers(a, b) }; + assert_eq!(c, 10); + + // Call `add_small_numbers`, passing arguments that will trigger a panic, and catch it. + let caught_unwind = catch_unwind(AssertUnwindSafe(|| { + let (a, b) = (10, 1); + let _c = unsafe { add_small_numbers(a, b) }; + unreachable!("should have unwound instead of returned"); + })); + + // Assert that we did indeed panic, then unwrap and downcast the panic into the sum. + assert!(caught_unwind.is_err()); + let panic_obj = caught_unwind.unwrap_err(); + let msg = panic_obj.downcast_ref::().unwrap(); + assert_eq!(msg, "11"); +} + +#[link(name = "add", kind = "static")] +extern "C-unwind" { + /// An external function, defined in C. + /// + /// Returns the sum of two numbers, or panics if the sum is greater than 10. + fn add_small_numbers(a: u32, b: u32) -> u32; +} + +/// This function will panic if `x` is greater than 10. +/// +/// This function is called by `add_small_numbers`. +#[no_mangle] +pub extern "C-unwind" fn panic_if_greater_than_10(x: u32) { + if x > 10 { + panic!("{}", x); // That is too big! + } +} diff --git a/tests/run-make/cat-and-grep-sanity-check/Makefile b/tests/run-make/cat-and-grep-sanity-check/Makefile new file mode 100644 index 000000000..82351e220 --- /dev/null +++ b/tests/run-make/cat-and-grep-sanity-check/Makefile @@ -0,0 +1,46 @@ +include ../tools.mk + +all: + echo a | $(CGREP) a + ! echo b | $(CGREP) a + echo xyz | $(CGREP) x y z + ! echo abc | $(CGREP) b c d + printf "x\ny\nz" | $(CGREP) x y z + + echo AbCd | $(CGREP) -i a b C D + ! echo AbCd | $(CGREP) a b C D + + true | $(CGREP) -v nothing + ! echo nothing | $(CGREP) -v nothing + ! echo xyz | $(CGREP) -v w x y + ! echo xyz | $(CGREP) -v x y z + echo xyz | $(CGREP) -v a b c + + ! echo 'foo bar baz' | $(CGREP) 'foo baz' + echo 'foo bar baz' | $(CGREP) foo baz + echo 'x a `b` c y z' | $(CGREP) 'a `b` c' + + echo baaac | $(CGREP) -e 'ba*c' + echo bc | $(CGREP) -e 'ba*c' + ! echo aaac | $(CGREP) -e 'ba*c' + + echo aaa | $(CGREP) -e 'a+' + ! echo bbb | $(CGREP) -e 'a+' + + echo abc | $(CGREP) -e 'a|e|i|o|u' + ! echo fgh | $(CGREP) -e 'a|e|i|o|u' + echo abc | $(CGREP) -e '[aeiou]' + ! echo fgh | $(CGREP) -e '[aeiou]' + ! echo abc | $(CGREP) -e '[^aeiou]{3}' + echo fgh | $(CGREP) -e '[^aeiou]{3}' + echo ab cd ef gh | $(CGREP) -e '\bcd\b' + ! echo abcdefgh | $(CGREP) -e '\bcd\b' + echo xyz | $(CGREP) -e '...' + ! echo xy | $(CGREP) -e '...' + ! echo xyz | $(CGREP) -e '\.\.\.' + echo ... | $(CGREP) -e '\.\.\.' + + echo foo bar baz | $(CGREP) -e 'foo.*baz' + ! echo foo bar baz | $(CGREP) -ve 'foo.*baz' + ! echo foo bar baz | $(CGREP) -e 'baz.*foo' + echo foo bar baz | $(CGREP) -ve 'baz.*foo' diff --git a/tests/run-make/cdylib-dylib-linkage/Makefile b/tests/run-make/cdylib-dylib-linkage/Makefile new file mode 100644 index 000000000..51fbfef2d --- /dev/null +++ b/tests/run-make/cdylib-dylib-linkage/Makefile @@ -0,0 +1,28 @@ +# ignore-cross-compile +include ../tools.mk + +TARGET_SYSROOT := $(shell $(RUSTC) --print sysroot)/lib/rustlib/$(TARGET)/lib + +ifdef IS_MSVC +LIBSTD := $(wildcard $(TARGET_SYSROOT)/libstd-*.dll.lib) +else +LIBSTD := $(wildcard $(TARGET_SYSROOT)/$(call DYLIB_GLOB,std)) +STD := $(basename $(patsubst lib%,%, $(notdir $(LIBSTD)))) +endif + +all: $(call RUN_BINFILE,foo) + $(call RUN,foo) + +ifdef IS_MSVC +CLIBS := $(TMPDIR)/foo.dll.lib $(TMPDIR)/bar.dll.lib $(LIBSTD) +$(call RUN_BINFILE,foo): $(call DYLIB,foo) + $(CC) $(CFLAGS) foo.c $(CLIBS) $(call OUT_EXE,foo) +else +CLIBS := -lfoo -lbar -l$(STD) -L $(TMPDIR) -L $(TARGET_SYSROOT) +$(call RUN_BINFILE,foo): $(call DYLIB,foo) + $(CC) $(CFLAGS) foo.c $(CLIBS) -o $(call RUN_BINFILE,foo) +endif + +$(call DYLIB,foo): + $(RUSTC) -C prefer-dynamic bar.rs + $(RUSTC) foo.rs diff --git a/tests/run-make/cdylib-dylib-linkage/bar.rs b/tests/run-make/cdylib-dylib-linkage/bar.rs new file mode 100644 index 000000000..b3a7539ab --- /dev/null +++ b/tests/run-make/cdylib-dylib-linkage/bar.rs @@ -0,0 +1,5 @@ +#![crate_type = "dylib"] + +pub fn bar() { + println!("hello!"); +} diff --git a/tests/run-make/cdylib-dylib-linkage/foo.c b/tests/run-make/cdylib-dylib-linkage/foo.c new file mode 100644 index 000000000..154f9682e --- /dev/null +++ b/tests/run-make/cdylib-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/cdylib-dylib-linkage/foo.rs b/tests/run-make/cdylib-dylib-linkage/foo.rs new file mode 100644 index 000000000..c4069495a --- /dev/null +++ b/tests/run-make/cdylib-dylib-linkage/foo.rs @@ -0,0 +1,13 @@ +#![crate_type = "cdylib"] + +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/cdylib-fewer-symbols/Makefile b/tests/run-make/cdylib-fewer-symbols/Makefile new file mode 100644 index 000000000..4e08f979c --- /dev/null +++ b/tests/run-make/cdylib-fewer-symbols/Makefile @@ -0,0 +1,13 @@ +# ignore-cross-compile +# Test that allocator-related symbols don't show up as exported from a cdylib as +# they're internal to Rust and not part of the public ABI. + +include ../tools.mk + +# ignore-windows +# FIXME: The __rdl_ and __rust_ symbol still remains, no matter using MSVC or GNU +# See https://github.com/rust-lang/rust/pull/46207#issuecomment-347561753 + +all: + $(RUSTC) foo.rs + nm -g "$(call DYLIB,foo)" | $(CGREP) -v __rdl_ __rde_ __rg_ __rust_ diff --git a/tests/run-make/cdylib-fewer-symbols/foo.rs b/tests/run-make/cdylib-fewer-symbols/foo.rs new file mode 100644 index 000000000..af37bc8e9 --- /dev/null +++ b/tests/run-make/cdylib-fewer-symbols/foo.rs @@ -0,0 +1,6 @@ +#![crate_type = "cdylib"] + +#[no_mangle] +pub extern "C" fn foo() -> u32 { + 3 +} diff --git a/tests/run-make/cdylib/Makefile b/tests/run-make/cdylib/Makefile new file mode 100644 index 000000000..3c8b52695 --- /dev/null +++ b/tests/run-make/cdylib/Makefile @@ -0,0 +1,20 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(call RUN_BINFILE,foo) + $(call RUN,foo) + rm $(call DYLIB,foo) + $(RUSTC) foo.rs -C lto + $(call RUN,foo) + +ifdef IS_MSVC +$(call RUN_BINFILE,foo): $(call DYLIB,foo) + $(CC) $(CFLAGS) foo.c $(TMPDIR)/foo.dll.lib $(call OUT_EXE,foo) +else +$(call RUN_BINFILE,foo): $(call DYLIB,foo) + $(CC) $(CFLAGS) foo.c -lfoo -o $(call RUN_BINFILE,foo) -L $(TMPDIR) +endif + +$(call DYLIB,foo): + $(RUSTC) bar.rs + $(RUSTC) foo.rs diff --git a/tests/run-make/cdylib/bar.rs b/tests/run-make/cdylib/bar.rs new file mode 100644 index 000000000..fe665abc7 --- /dev/null +++ b/tests/run-make/cdylib/bar.rs @@ -0,0 +1,5 @@ +#![crate_type = "rlib"] + +pub fn bar() { + println!("hello!"); +} diff --git a/tests/run-make/cdylib/foo.c b/tests/run-make/cdylib/foo.c new file mode 100644 index 000000000..154f9682e --- /dev/null +++ b/tests/run-make/cdylib/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/cdylib/foo.rs b/tests/run-make/cdylib/foo.rs new file mode 100644 index 000000000..c4069495a --- /dev/null +++ b/tests/run-make/cdylib/foo.rs @@ -0,0 +1,13 @@ +#![crate_type = "cdylib"] + +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/codegen-options-parsing/Makefile b/tests/run-make/codegen-options-parsing/Makefile new file mode 100644 index 000000000..56bb900b7 --- /dev/null +++ b/tests/run-make/codegen-options-parsing/Makefile @@ -0,0 +1,32 @@ +# ignore-cross-compile +include ../tools.mk + +all: + #Option taking a number + $(RUSTC) -C codegen-units dummy.rs 2>&1 | \ + $(CGREP) 'codegen option `codegen-units` requires a number' + $(RUSTC) -C codegen-units= dummy.rs 2>&1 | \ + $(CGREP) 'incorrect value `` for codegen option `codegen-units` - a number was expected' + $(RUSTC) -C codegen-units=foo dummy.rs 2>&1 | \ + $(CGREP) 'incorrect value `foo` for codegen option `codegen-units` - a number was expected' + $(RUSTC) -C codegen-units=1 dummy.rs + #Option taking a string + $(RUSTC) -C extra-filename dummy.rs 2>&1 | \ + $(CGREP) 'codegen option `extra-filename` requires a string' + $(RUSTC) -C extra-filename= dummy.rs 2>&1 + $(RUSTC) -C extra-filename=foo dummy.rs 2>&1 + #Option taking no argument + $(RUSTC) -C lto= dummy.rs 2>&1 | \ + $(CGREP) 'codegen option `lto` - either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, `fat`, or omitted' + $(RUSTC) -C lto=1 dummy.rs 2>&1 | \ + $(CGREP) 'codegen option `lto` - either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, `fat`, or omitted' + $(RUSTC) -C lto=foo dummy.rs 2>&1 | \ + $(CGREP) 'codegen option `lto` - either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, `fat`, or omitted' + $(RUSTC) -C lto dummy.rs + + # Should not link dead code... + $(RUSTC) --print link-args dummy.rs 2>&1 | \ + $(CGREP) -e '--gc-sections|-z[^ ]* [^ ]*|-dead_strip|/OPT:REF' + # ... unless you specifically ask to keep it + $(RUSTC) --print link-args -C link-dead-code dummy.rs 2>&1 | \ + $(CGREP) -ve '--gc-sections|-z[^ ]* [^ ]*|-dead_strip|/OPT:REF' diff --git a/tests/run-make/codegen-options-parsing/dummy.rs b/tests/run-make/codegen-options-parsing/dummy.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/tests/run-make/codegen-options-parsing/dummy.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/compile-stdin/Makefile b/tests/run-make/compile-stdin/Makefile new file mode 100644 index 000000000..2a495281c --- /dev/null +++ b/tests/run-make/compile-stdin/Makefile @@ -0,0 +1,6 @@ +# ignore-cross-compile +include ../tools.mk + +all: + echo 'fn main(){}' | $(RUSTC) - + $(call RUN,rust_out) diff --git a/tests/run-make/compiler-lookup-paths-2/Makefile b/tests/run-make/compiler-lookup-paths-2/Makefile new file mode 100644 index 000000000..d4ff7d8da --- /dev/null +++ b/tests/run-make/compiler-lookup-paths-2/Makefile @@ -0,0 +1,8 @@ +include ../tools.mk + +all: + mkdir -p $(TMPDIR)/a $(TMPDIR)/b + $(RUSTC) a.rs && mv $(TMPDIR)/liba.rlib $(TMPDIR)/a + $(RUSTC) b.rs -L $(TMPDIR)/a && mv $(TMPDIR)/libb.rlib $(TMPDIR)/b + $(RUSTC) c.rs -L crate=$(TMPDIR)/b -L dependency=$(TMPDIR)/a \ + && exit 1 || exit 0 diff --git a/tests/run-make/compiler-lookup-paths-2/a.rs b/tests/run-make/compiler-lookup-paths-2/a.rs new file mode 100644 index 000000000..83be6e807 --- /dev/null +++ b/tests/run-make/compiler-lookup-paths-2/a.rs @@ -0,0 +1 @@ +#![crate_type = "lib"] diff --git a/tests/run-make/compiler-lookup-paths-2/b.rs b/tests/run-make/compiler-lookup-paths-2/b.rs new file mode 100644 index 000000000..1be6cbc91 --- /dev/null +++ b/tests/run-make/compiler-lookup-paths-2/b.rs @@ -0,0 +1,2 @@ +#![crate_type = "lib"] +extern crate a; diff --git a/tests/run-make/compiler-lookup-paths-2/c.rs b/tests/run-make/compiler-lookup-paths-2/c.rs new file mode 100644 index 000000000..e37bc2e1d --- /dev/null +++ b/tests/run-make/compiler-lookup-paths-2/c.rs @@ -0,0 +1,3 @@ +#![crate_type = "lib"] +extern crate b; +extern crate a; diff --git a/tests/run-make/compiler-lookup-paths/Makefile b/tests/run-make/compiler-lookup-paths/Makefile new file mode 100644 index 000000000..310d6772c --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/Makefile @@ -0,0 +1,41 @@ +include ../tools.mk + +# ignore-wasm32 (need a C compiler) +# ignore-wasm64 (need a C compiler) + +all: $(TMPDIR)/libnative.a + mkdir -p $(TMPDIR)/crate + mkdir -p $(TMPDIR)/native + mv $(TMPDIR)/libnative.a $(TMPDIR)/native + $(RUSTC) a.rs + mv $(TMPDIR)/liba.rlib $(TMPDIR)/crate + $(RUSTC) b.rs -L native=$(TMPDIR)/crate && exit 1 || exit 0 + $(RUSTC) b.rs -L dependency=$(TMPDIR)/crate && exit 1 || exit 0 + $(RUSTC) b.rs -L crate=$(TMPDIR)/crate + $(RUSTC) b.rs -L all=$(TMPDIR)/crate + $(RUSTC) c.rs -L native=$(TMPDIR)/crate && exit 1 || exit 0 + $(RUSTC) c.rs -L crate=$(TMPDIR)/crate && exit 1 || exit 0 + $(RUSTC) c.rs -L dependency=$(TMPDIR)/crate + $(RUSTC) c.rs -L all=$(TMPDIR)/crate + $(RUSTC) d.rs -L dependency=$(TMPDIR)/native && exit 1 || exit 0 + $(RUSTC) d.rs -L crate=$(TMPDIR)/native && exit 1 || exit 0 + $(RUSTC) d.rs -L native=$(TMPDIR)/native + $(RUSTC) d.rs -L all=$(TMPDIR)/native + # Deduplication tests: + # Same hash, no errors. + mkdir -p $(TMPDIR)/e1 + mkdir -p $(TMPDIR)/e2 + $(RUSTC) e.rs -o $(TMPDIR)/e1/libe.rlib + $(RUSTC) e.rs -o $(TMPDIR)/e2/libe.rlib + $(RUSTC) f.rs -L $(TMPDIR)/e1 -L $(TMPDIR)/e2 + $(RUSTC) f.rs -L crate=$(TMPDIR)/e1 -L $(TMPDIR)/e2 + $(RUSTC) f.rs -L crate=$(TMPDIR)/e1 -L crate=$(TMPDIR)/e2 + # Different hash, errors. + $(RUSTC) e2.rs -o $(TMPDIR)/e2/libe.rlib + $(RUSTC) f.rs -L $(TMPDIR)/e1 -L $(TMPDIR)/e2 && exit 1 || exit 0 + $(RUSTC) f.rs -L crate=$(TMPDIR)/e1 -L $(TMPDIR)/e2 && exit 1 || exit 0 + $(RUSTC) f.rs -L crate=$(TMPDIR)/e1 -L crate=$(TMPDIR)/e2 && exit 1 || exit 0 + # Native/dependency paths don't cause errors. + $(RUSTC) f.rs -L native=$(TMPDIR)/e1 -L $(TMPDIR)/e2 + $(RUSTC) f.rs -L dependency=$(TMPDIR)/e1 -L $(TMPDIR)/e2 + $(RUSTC) f.rs -L dependency=$(TMPDIR)/e1 -L crate=$(TMPDIR)/e2 diff --git a/tests/run-make/compiler-lookup-paths/a.rs b/tests/run-make/compiler-lookup-paths/a.rs new file mode 100644 index 000000000..83be6e807 --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/a.rs @@ -0,0 +1 @@ +#![crate_type = "lib"] diff --git a/tests/run-make/compiler-lookup-paths/b.rs b/tests/run-make/compiler-lookup-paths/b.rs new file mode 100644 index 000000000..1be6cbc91 --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/b.rs @@ -0,0 +1,2 @@ +#![crate_type = "lib"] +extern crate a; diff --git a/tests/run-make/compiler-lookup-paths/c.rs b/tests/run-make/compiler-lookup-paths/c.rs new file mode 100644 index 000000000..4c7ce01b6 --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/c.rs @@ -0,0 +1,2 @@ +#![crate_type = "lib"] +extern crate b; diff --git a/tests/run-make/compiler-lookup-paths/d.rs b/tests/run-make/compiler-lookup-paths/d.rs new file mode 100644 index 000000000..6cd9916b6 --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/d.rs @@ -0,0 +1,4 @@ +#![crate_type = "rlib"] + +#[link(name = "native", kind = "static")] +extern "C" {} diff --git a/tests/run-make/compiler-lookup-paths/e.rs b/tests/run-make/compiler-lookup-paths/e.rs new file mode 100644 index 000000000..18eb60aca --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/e.rs @@ -0,0 +1,2 @@ +#![crate_name = "e"] +#![crate_type = "rlib"] diff --git a/tests/run-make/compiler-lookup-paths/e2.rs b/tests/run-make/compiler-lookup-paths/e2.rs new file mode 100644 index 000000000..cbf08b98e --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/e2.rs @@ -0,0 +1,4 @@ +#![crate_name = "e"] +#![crate_type = "rlib"] + +pub fn f() {} diff --git a/tests/run-make/compiler-lookup-paths/f.rs b/tests/run-make/compiler-lookup-paths/f.rs new file mode 100644 index 000000000..483deaaea --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/f.rs @@ -0,0 +1,2 @@ +#![crate_type = "rlib"] +extern crate e; diff --git a/tests/run-make/compiler-lookup-paths/native.c b/tests/run-make/compiler-lookup-paths/native.c new file mode 100644 index 000000000..d11c69f81 --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/native.c @@ -0,0 +1 @@ +// intentionally empty diff --git a/tests/run-make/compiler-rt-works-on-mingw/Makefile b/tests/run-make/compiler-rt-works-on-mingw/Makefile new file mode 100644 index 000000000..74917570a --- /dev/null +++ b/tests/run-make/compiler-rt-works-on-mingw/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +# only-windows-gnu + +all: + $(CXX) foo.cpp -c -o $(TMPDIR)/foo.o + $(AR) crus $(TMPDIR)/libfoo.a $(TMPDIR)/foo.o + $(RUSTC) foo.rs -lfoo -lstdc++ + $(call RUN,foo) diff --git a/tests/run-make/compiler-rt-works-on-mingw/foo.cpp b/tests/run-make/compiler-rt-works-on-mingw/foo.cpp new file mode 100644 index 000000000..4c2fb9cdb --- /dev/null +++ b/tests/run-make/compiler-rt-works-on-mingw/foo.cpp @@ -0,0 +1,4 @@ +extern "C" void foo() { + int *a = new int(3); + delete a; +} diff --git a/tests/run-make/compiler-rt-works-on-mingw/foo.rs b/tests/run-make/compiler-rt-works-on-mingw/foo.rs new file mode 100644 index 000000000..7fdb81588 --- /dev/null +++ b/tests/run-make/compiler-rt-works-on-mingw/foo.rs @@ -0,0 +1,10 @@ +extern "C" { + fn foo(); +} + +pub fn main() { + unsafe { + foo(); + } + assert_eq!(7f32.powi(3), 343f32); +} diff --git a/tests/run-make/const_fn_mir/Makefile b/tests/run-make/const_fn_mir/Makefile index ad5695093..b2c268f04 100644 --- a/tests/run-make/const_fn_mir/Makefile +++ b/tests/run-make/const_fn_mir/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk all: $(RUSTC) main.rs --emit=mir -o "$(TMPDIR)"/dump.mir diff --git a/tests/run-make/const_fn_mir/dump.mir b/tests/run-make/const_fn_mir/dump.mir index ab4084c95..9cc70d3b0 100644 --- a/tests/run-make/const_fn_mir/dump.mir +++ b/tests/run-make/const_fn_mir/dump.mir @@ -2,9 +2,15 @@ // and is subject to change without notice. Knock yourself out. fn foo() -> i32 { let mut _0: i32; // return place in scope 0 at main.rs:4:19: 4:22 + let mut _1: (i32, bool); // in scope 0 at main.rs:5:5: 5:10 bb0: { - _0 = const 11_i32; // scope 0 at main.rs:5:5: 5:10 + _1 = CheckedAdd(const 5_i32, const 6_i32); // scope 0 at main.rs:5:5: 5:10 + assert(!move (_1.1: bool), "attempt to compute `{} + {}`, which would overflow", const 5_i32, const 6_i32) -> bb1; // scope 0 at main.rs:5:5: 5:10 + } + + bb1: { + _0 = move (_1.0: i32); // scope 0 at main.rs:5:5: 5:10 return; // scope 0 at main.rs:6:2: 6:2 } } diff --git a/tests/run-make/core-no-fp-fmt-parse/Makefile b/tests/run-make/core-no-fp-fmt-parse/Makefile new file mode 100644 index 000000000..837664d92 --- /dev/null +++ b/tests/run-make/core-no-fp-fmt-parse/Makefile @@ -0,0 +1,4 @@ +include ../tools.mk + +all: + $(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/core/src/lib.rs --cfg no_fp_fmt_parse diff --git a/tests/run-make/coverage-reports/expected_show_coverage.abort.txt b/tests/run-make/coverage-reports/expected_show_coverage.abort.txt index 00f46f42a..a71c58d61 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.abort.txt +++ b/tests/run-make/coverage-reports/expected_show_coverage.abort.txt @@ -32,7 +32,7 @@ 30| |// Notes: 31| |// 1. Compare this program and its coverage results to those of the similar tests 32| |// `panic_unwind.rs` and `try_error_result.rs`. - 33| |// 2. This test confirms the coverage generated when a program includes `TerminatorKind::Abort`. + 33| |// 2. This test confirms the coverage generated when a program includes `UnwindAction::Terminate`. 34| |// 3. The test does not invoke the abort. By executing to a successful completion, the coverage 35| |// results show where the program did and did not execute. 36| |// 4. If the program actually aborted, the coverage counters would not be saved (which "works as diff --git a/tests/run-make/coverage-reports/expected_show_coverage.closure.txt b/tests/run-make/coverage-reports/expected_show_coverage.closure.txt index e463099a5..002ecec3b 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.closure.txt +++ b/tests/run-make/coverage-reports/expected_show_coverage.closure.txt @@ -29,8 +29,8 @@ 29| 1| some_string = Some(String::from("the string content")); 30| 1| let 31| 1| a - 32| 1| = - 33| 1| || + 32| | = + 33| | || 34| 0| { 35| 0| let mut countdown = 0; 36| 0| if is_false { diff --git a/tests/run-make/coverage-reports/expected_show_coverage.continue.txt b/tests/run-make/coverage-reports/expected_show_coverage.continue.txt index 1c64ead9f..bf42924b1 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.continue.txt +++ b/tests/run-make/coverage-reports/expected_show_coverage.continue.txt @@ -65,6 +65,6 @@ 65| | } 66| 0| x = 3; 67| | } - 68| | let _ = x; + 68| 1| let _ = x; 69| 1|} diff --git a/tests/run-make/coverage/abort.rs b/tests/run-make/coverage/abort.rs index 3dac43df8..98264bdc1 100644 --- a/tests/run-make/coverage/abort.rs +++ b/tests/run-make/coverage/abort.rs @@ -30,7 +30,7 @@ fn main() -> Result<(), u8> { // Notes: // 1. Compare this program and its coverage results to those of the similar tests // `panic_unwind.rs` and `try_error_result.rs`. -// 2. This test confirms the coverage generated when a program includes `TerminatorKind::Abort`. +// 2. This test confirms the coverage generated when a program includes `UnwindAction::Terminate`. // 3. The test does not invoke the abort. By executing to a successful completion, the coverage // results show where the program did and did not execute. // 4. If the program actually aborted, the coverage counters would not be saved (which "works as diff --git a/tests/run-make/coverage/coverage_tools.mk b/tests/run-make/coverage/coverage_tools.mk index 0b6bbc331..028c020a4 100644 --- a/tests/run-make/coverage/coverage_tools.mk +++ b/tests/run-make/coverage/coverage_tools.mk @@ -3,4 +3,4 @@ # # include ../coverage/coverage_tools.mk -include ../../run-make-fulldeps/tools.mk +include ../tools.mk diff --git a/tests/run-make/crate-data-smoke/Makefile b/tests/run-make/crate-data-smoke/Makefile new file mode 100644 index 000000000..a453f65ff --- /dev/null +++ b/tests/run-make/crate-data-smoke/Makefile @@ -0,0 +1,10 @@ +include ../tools.mk + +all: + [ `$(RUSTC) --print crate-name crate.rs` = "foo" ] + [ `$(RUSTC) --print file-names crate.rs` = "$(call BIN,foo)" ] + [ `$(RUSTC) --print file-names --crate-type=lib \ + --test crate.rs` = "$(call BIN,foo)" ] + [ `$(RUSTC) --print file-names --test lib.rs` = "$(call BIN,mylib)" ] + $(RUSTC) --print file-names lib.rs + $(RUSTC) --print file-names rlib.rs diff --git a/tests/run-make/crate-data-smoke/crate.rs b/tests/run-make/crate-data-smoke/crate.rs new file mode 100644 index 000000000..a48a6f51c --- /dev/null +++ b/tests/run-make/crate-data-smoke/crate.rs @@ -0,0 +1,7 @@ +#![crate_name = "foo"] + +// Querying about the crate metadata should *not* parse the entire crate, it +// only needs the crate attributes (which are guaranteed to be at the top) be +// sure that if we have an error like a missing module that we can still query +// about the crate id. +mod error; diff --git a/tests/run-make/crate-data-smoke/lib.rs b/tests/run-make/crate-data-smoke/lib.rs new file mode 100644 index 000000000..8002f11ec --- /dev/null +++ b/tests/run-make/crate-data-smoke/lib.rs @@ -0,0 +1,2 @@ +#![crate_name = "mylib"] +#![crate_type = "lib"] diff --git a/tests/run-make/crate-data-smoke/rlib.rs b/tests/run-make/crate-data-smoke/rlib.rs new file mode 100644 index 000000000..47fcce4a7 --- /dev/null +++ b/tests/run-make/crate-data-smoke/rlib.rs @@ -0,0 +1,2 @@ +#![crate_name = "mylib"] +#![crate_type = "rlib"] diff --git a/tests/run-make/crate-hash-rustc-version/Makefile b/tests/run-make/crate-hash-rustc-version/Makefile new file mode 100644 index 000000000..f1d2a3604 --- /dev/null +++ b/tests/run-make/crate-hash-rustc-version/Makefile @@ -0,0 +1,38 @@ +# ignore-cross-compile +include ../tools.mk + +# Ensure that crates compiled with different rustc versions cannot +# be dynamically linked. + +FLAGS := -Cprefer-dynamic -Zsymbol-mangling-version=v0 +UNAME := $(shell uname) +ifeq ($(UNAME),Linux) + EXT=".so" + NM_CMD := nm -D +endif +ifeq ($(UNAME),Darwin) + EXT=".dylib" + NM_CMD := nm +endif + +ifndef NM_CMD +all: + exit 0 +else +all: + # a.rs is a dylib + $(RUSTC) a.rs --crate-type=dylib $(FLAGS) + # Write symbols to disk. + $(NM_CMD) $(call DYLIB,a) > $(TMPDIR)/symbolsbefore + # b.rs is a binary + $(RUSTC) b.rs --extern a=$(TMPDIR)/liba$(EXT) --crate-type=bin -Crpath $(FLAGS) + $(call RUN,b) + # Now re-compile a.rs with another rustc version + RUSTC_FORCE_RUSTC_VERSION=deadfeed $(RUSTC) a.rs --crate-type=dylib $(FLAGS) + # After compiling with a different rustc version, write symbols to disk again. + $(NM_CMD) $(call DYLIB,a) > $(TMPDIR)/symbolsafter + # As a sanity check, test if the symbols changed: + # If the symbols are identical, there's been an error. + if diff $(TMPDIR)/symbolsbefore $(TMPDIR)/symbolsafter; then exit 1; fi + $(call FAIL,b) +endif diff --git a/tests/run-make/crate-hash-rustc-version/a.rs b/tests/run-make/crate-hash-rustc-version/a.rs new file mode 100644 index 000000000..d65b5ce8e --- /dev/null +++ b/tests/run-make/crate-hash-rustc-version/a.rs @@ -0,0 +1,4 @@ +pub fn foo(mut x: String) -> String { + x.push_str(", world!"); + x +} diff --git a/tests/run-make/crate-hash-rustc-version/b.rs b/tests/run-make/crate-hash-rustc-version/b.rs new file mode 100644 index 000000000..316ac26e7 --- /dev/null +++ b/tests/run-make/crate-hash-rustc-version/b.rs @@ -0,0 +1,8 @@ +extern crate a; + +use a::foo; + +fn main() { + let x = String::from("Hello"); + println!("{}", foo(x)); +} diff --git a/tests/run-make/crate-name-priority/Makefile b/tests/run-make/crate-name-priority/Makefile new file mode 100644 index 000000000..4adaa75a7 --- /dev/null +++ b/tests/run-make/crate-name-priority/Makefile @@ -0,0 +1,12 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) foo.rs + rm $(TMPDIR)/$(call BIN,foo) + $(RUSTC) foo.rs --crate-name bar + rm $(TMPDIR)/$(call BIN,bar) + $(RUSTC) foo1.rs + rm $(TMPDIR)/$(call BIN,foo) + $(RUSTC) foo1.rs -o $(TMPDIR)/$(call BIN,bar1) + rm $(TMPDIR)/$(call BIN,bar1) diff --git a/tests/run-make/crate-name-priority/foo.rs b/tests/run-make/crate-name-priority/foo.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/tests/run-make/crate-name-priority/foo.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/crate-name-priority/foo1.rs b/tests/run-make/crate-name-priority/foo1.rs new file mode 100644 index 000000000..4ff3bd951 --- /dev/null +++ b/tests/run-make/crate-name-priority/foo1.rs @@ -0,0 +1,3 @@ +#![crate_name = "foo"] + +fn main() {} diff --git a/tests/run-make/cross-lang-lto-clang/Makefile b/tests/run-make/cross-lang-lto-clang/Makefile new file mode 100644 index 000000000..acaebf439 --- /dev/null +++ b/tests/run-make/cross-lang-lto-clang/Makefile @@ -0,0 +1,25 @@ +# needs-matching-clang + +# This test makes sure that cross-language inlining actually works by checking +# the generated machine code. + +include ../tools.mk + +all: cpp-executable rust-executable + +cpp-executable: + $(RUSTC) -Clinker-plugin-lto=on -o $(TMPDIR)/librustlib-xlto.a -Copt-level=2 -Ccodegen-units=1 ./rustlib.rs + $(CLANG) -flto=thin -fuse-ld=lld -L $(TMPDIR) -lrustlib-xlto -o $(TMPDIR)/cmain ./cmain.c -O3 + # Make sure we don't find a call instruction to the function we expect to + # always be inlined. + "$(LLVM_BIN_DIR)"/llvm-objdump -d $(TMPDIR)/cmain | $(CGREP) -v -e "call.*rust_always_inlined" + # As a sanity check, make sure we do find a call instruction to a + # non-inlined function + "$(LLVM_BIN_DIR)"/llvm-objdump -d $(TMPDIR)/cmain | $(CGREP) -e "call.*rust_never_inlined" + +rust-executable: + $(CLANG) ./clib.c -flto=thin -c -o $(TMPDIR)/clib.o -O2 + (cd $(TMPDIR); $(AR) crus ./libxyz.a ./clib.o) + $(RUSTC) -Clinker-plugin-lto=on -L$(TMPDIR) -Copt-level=2 -Clinker=$(CLANG) -Clink-arg=-fuse-ld=lld ./main.rs -o $(TMPDIR)/rsmain + "$(LLVM_BIN_DIR)"/llvm-objdump -d $(TMPDIR)/rsmain | $(CGREP) -e "call.*c_never_inlined" + "$(LLVM_BIN_DIR)"/llvm-objdump -d $(TMPDIR)/rsmain | $(CGREP) -v -e "call.*c_always_inlined" diff --git a/tests/run-make/cross-lang-lto-clang/clib.c b/tests/run-make/cross-lang-lto-clang/clib.c new file mode 100644 index 000000000..90f33f24d --- /dev/null +++ b/tests/run-make/cross-lang-lto-clang/clib.c @@ -0,0 +1,9 @@ +#include + +uint32_t c_always_inlined() { + return 1234; +} + +__attribute__((noinline)) uint32_t c_never_inlined() { + return 12345; +} diff --git a/tests/run-make/cross-lang-lto-clang/cmain.c b/tests/run-make/cross-lang-lto-clang/cmain.c new file mode 100644 index 000000000..e62a40117 --- /dev/null +++ b/tests/run-make/cross-lang-lto-clang/cmain.c @@ -0,0 +1,12 @@ +#include + +// A trivial function defined in Rust, returning a constant value. This should +// always be inlined. +uint32_t rust_always_inlined(); + + +uint32_t rust_never_inlined(); + +int main(int argc, char** argv) { + return rust_never_inlined() + rust_always_inlined(); +} diff --git a/tests/run-make/cross-lang-lto-clang/main.rs b/tests/run-make/cross-lang-lto-clang/main.rs new file mode 100644 index 000000000..8129dcb85 --- /dev/null +++ b/tests/run-make/cross-lang-lto-clang/main.rs @@ -0,0 +1,11 @@ +#[link(name = "xyz")] +extern "C" { + fn c_always_inlined() -> u32; + fn c_never_inlined() -> u32; +} + +fn main() { + unsafe { + println!("blub: {}", c_always_inlined() + c_never_inlined()); + } +} diff --git a/tests/run-make/cross-lang-lto-clang/rustlib.rs b/tests/run-make/cross-lang-lto-clang/rustlib.rs new file mode 100644 index 000000000..8a74d74a4 --- /dev/null +++ b/tests/run-make/cross-lang-lto-clang/rustlib.rs @@ -0,0 +1,12 @@ +#![crate_type="staticlib"] + +#[no_mangle] +pub extern "C" fn rust_always_inlined() -> u32 { + 42 +} + +#[no_mangle] +#[inline(never)] +pub extern "C" fn rust_never_inlined() -> u32 { + 421 +} diff --git a/tests/run-make/cross-lang-lto-pgo-smoketest/Makefile b/tests/run-make/cross-lang-lto-pgo-smoketest/Makefile new file mode 100644 index 000000000..70085d9bd --- /dev/null +++ b/tests/run-make/cross-lang-lto-pgo-smoketest/Makefile @@ -0,0 +1,87 @@ +# needs-matching-clang + +# This test makes sure that cross-language inlining can be used in conjunction +# with profile-guided optimization. The test only tests that the whole workflow +# can be executed without anything crashing. It does not test whether PGO or +# xLTO have any specific effect on the generated code. + +include ../tools.mk + +COMMON_FLAGS=-Copt-level=3 -Ccodegen-units=1 + +# LLVM doesn't support instrumenting binaries that use SEH: +# https://bugs.llvm.org/show_bug.cgi?id=41279 +# +# Things work fine with -Cpanic=abort though. +ifdef IS_MSVC +COMMON_FLAGS+= -Cpanic=abort +endif + +all: cpp-executable rust-executable + +cpp-executable: + $(RUSTC) -Clinker-plugin-lto=on \ + -Cprofile-generate="$(TMPDIR)"/cpp-profdata \ + -o "$(TMPDIR)"/librustlib-xlto.a \ + $(COMMON_FLAGS) \ + ./rustlib.rs + $(CLANG) -flto=thin \ + -fprofile-generate="$(TMPDIR)"/cpp-profdata \ + -fuse-ld=lld \ + -L "$(TMPDIR)" \ + -lrustlib-xlto \ + -o "$(TMPDIR)"/cmain \ + -O3 \ + ./cmain.c + $(TMPDIR)/cmain + # Postprocess the profiling data so it can be used by the compiler + "$(LLVM_BIN_DIR)"/llvm-profdata merge \ + -o "$(TMPDIR)"/cpp-profdata/merged.profdata \ + "$(TMPDIR)"/cpp-profdata/default_*.profraw + $(RUSTC) -Clinker-plugin-lto=on \ + -Cprofile-use="$(TMPDIR)"/cpp-profdata/merged.profdata \ + -o "$(TMPDIR)"/librustlib-xlto.a \ + $(COMMON_FLAGS) \ + ./rustlib.rs + $(CLANG) -flto=thin \ + -fprofile-use="$(TMPDIR)"/cpp-profdata/merged.profdata \ + -fuse-ld=lld \ + -L "$(TMPDIR)" \ + -lrustlib-xlto \ + -o "$(TMPDIR)"/cmain \ + -O3 \ + ./cmain.c + +rust-executable: + exit + $(CLANG) ./clib.c -fprofile-generate="$(TMPDIR)"/rs-profdata -flto=thin -c -o $(TMPDIR)/clib.o -O3 + (cd $(TMPDIR); $(AR) crus ./libxyz.a ./clib.o) + $(RUSTC) -Clinker-plugin-lto=on \ + -Cprofile-generate="$(TMPDIR)"/rs-profdata \ + -L$(TMPDIR) \ + $(COMMON_FLAGS) \ + -Clinker=$(CLANG) \ + -Clink-arg=-fuse-ld=lld \ + -o $(TMPDIR)/rsmain \ + ./main.rs + $(TMPDIR)/rsmain + # Postprocess the profiling data so it can be used by the compiler + "$(LLVM_BIN_DIR)"/llvm-profdata merge \ + -o "$(TMPDIR)"/rs-profdata/merged.profdata \ + "$(TMPDIR)"/rs-profdata/default_*.profraw + $(CLANG) ./clib.c \ + -fprofile-use="$(TMPDIR)"/rs-profdata/merged.profdata \ + -flto=thin \ + -c \ + -o $(TMPDIR)/clib.o \ + -O3 + rm "$(TMPDIR)"/libxyz.a + (cd $(TMPDIR); $(AR) crus ./libxyz.a ./clib.o) + $(RUSTC) -Clinker-plugin-lto=on \ + -Cprofile-use="$(TMPDIR)"/rs-profdata/merged.profdata \ + -L$(TMPDIR) \ + $(COMMON_FLAGS) \ + -Clinker=$(CLANG) \ + -Clink-arg=-fuse-ld=lld \ + -o $(TMPDIR)/rsmain \ + ./main.rs diff --git a/tests/run-make/cross-lang-lto-pgo-smoketest/clib.c b/tests/run-make/cross-lang-lto-pgo-smoketest/clib.c new file mode 100644 index 000000000..90f33f24d --- /dev/null +++ b/tests/run-make/cross-lang-lto-pgo-smoketest/clib.c @@ -0,0 +1,9 @@ +#include + +uint32_t c_always_inlined() { + return 1234; +} + +__attribute__((noinline)) uint32_t c_never_inlined() { + return 12345; +} diff --git a/tests/run-make/cross-lang-lto-pgo-smoketest/cmain.c b/tests/run-make/cross-lang-lto-pgo-smoketest/cmain.c new file mode 100644 index 000000000..e3f24828b --- /dev/null +++ b/tests/run-make/cross-lang-lto-pgo-smoketest/cmain.c @@ -0,0 +1,12 @@ +#include + +// A trivial function defined in Rust, returning a constant value. This should +// always be inlined. +uint32_t rust_always_inlined(); + + +uint32_t rust_never_inlined(); + +int main(int argc, char** argv) { + return (rust_never_inlined() + rust_always_inlined()) * 0; +} diff --git a/tests/run-make/cross-lang-lto-pgo-smoketest/main.rs b/tests/run-make/cross-lang-lto-pgo-smoketest/main.rs new file mode 100644 index 000000000..8129dcb85 --- /dev/null +++ b/tests/run-make/cross-lang-lto-pgo-smoketest/main.rs @@ -0,0 +1,11 @@ +#[link(name = "xyz")] +extern "C" { + fn c_always_inlined() -> u32; + fn c_never_inlined() -> u32; +} + +fn main() { + unsafe { + println!("blub: {}", c_always_inlined() + c_never_inlined()); + } +} diff --git a/tests/run-make/cross-lang-lto-pgo-smoketest/rustlib.rs b/tests/run-make/cross-lang-lto-pgo-smoketest/rustlib.rs new file mode 100644 index 000000000..8a74d74a4 --- /dev/null +++ b/tests/run-make/cross-lang-lto-pgo-smoketest/rustlib.rs @@ -0,0 +1,12 @@ +#![crate_type="staticlib"] + +#[no_mangle] +pub extern "C" fn rust_always_inlined() -> u32 { + 42 +} + +#[no_mangle] +#[inline(never)] +pub extern "C" fn rust_never_inlined() -> u32 { + 421 +} diff --git a/tests/run-make/cross-lang-lto-upstream-rlibs/Makefile b/tests/run-make/cross-lang-lto-upstream-rlibs/Makefile new file mode 100644 index 000000000..6f1caa31a --- /dev/null +++ b/tests/run-make/cross-lang-lto-upstream-rlibs/Makefile @@ -0,0 +1,32 @@ +include ../tools.mk + +# ignore windows due to libLLVM being present in PATH and the PATH and library path being the same +# (so fixing it is harder). See #57765 for context +ifndef IS_WINDOWS + +# This test makes sure that we don't loose upstream object files when compiling +# staticlibs with -C linker-plugin-lto + +all: staticlib.rs upstream.rs + $(RUSTC) upstream.rs -C linker-plugin-lto -Ccodegen-units=1 + + # Check No LTO + $(RUSTC) staticlib.rs -C linker-plugin-lto -Ccodegen-units=1 -L. -o $(TMPDIR)/staticlib.a + (cd $(TMPDIR); "$(LLVM_BIN_DIR)"/llvm-ar x ./staticlib.a) + # Make sure the upstream object file was included + ls $(TMPDIR)/upstream.*.rcgu.o + + # Cleanup + rm $(TMPDIR)/* + + # Check ThinLTO + $(RUSTC) upstream.rs -C linker-plugin-lto -Ccodegen-units=1 -Clto=thin + $(RUSTC) staticlib.rs -C linker-plugin-lto -Ccodegen-units=1 -Clto=thin -L. -o $(TMPDIR)/staticlib.a + (cd $(TMPDIR); "$(LLVM_BIN_DIR)"/llvm-ar x ./staticlib.a) + ls $(TMPDIR)/upstream.*.rcgu.o + +else + +all: + +endif diff --git a/tests/run-make/cross-lang-lto-upstream-rlibs/staticlib.rs b/tests/run-make/cross-lang-lto-upstream-rlibs/staticlib.rs new file mode 100644 index 000000000..34951dda3 --- /dev/null +++ b/tests/run-make/cross-lang-lto-upstream-rlibs/staticlib.rs @@ -0,0 +1,8 @@ +#![crate_type="staticlib"] + +extern crate upstream; + +#[no_mangle] +pub extern "C" fn bar() { + upstream::foo(); +} diff --git a/tests/run-make/cross-lang-lto-upstream-rlibs/upstream.rs b/tests/run-make/cross-lang-lto-upstream-rlibs/upstream.rs new file mode 100644 index 000000000..bd6820098 --- /dev/null +++ b/tests/run-make/cross-lang-lto-upstream-rlibs/upstream.rs @@ -0,0 +1,3 @@ +#![crate_type = "rlib"] + +pub fn foo() {} diff --git a/tests/run-make/cross-lang-lto/Makefile b/tests/run-make/cross-lang-lto/Makefile new file mode 100644 index 000000000..92058f952 --- /dev/null +++ b/tests/run-make/cross-lang-lto/Makefile @@ -0,0 +1,57 @@ + +include ../tools.mk + +# ignore windows due to libLLVM being present in PATH and the PATH and library path being the same +# (so fixing it is harder). See #57765 for context +ifndef IS_WINDOWS + +# This test makes sure that the object files we generate are actually +# LLVM bitcode files (as used by linker LTO plugins) when compiling with +# -Clinker-plugin-lto. + +# this only succeeds for bitcode files +ASSERT_IS_BITCODE_OBJ=("$(LLVM_BIN_DIR)"/llvm-bcanalyzer $(1)) +EXTRACT_OBJS=(cd $(TMPDIR); rm -f ./*.o; "$(LLVM_BIN_DIR)"/llvm-ar x $(1)) + +BUILD_LIB=$(RUSTC) lib.rs -Copt-level=2 -Clinker-plugin-lto -Ccodegen-units=1 +BUILD_EXE=$(RUSTC) main.rs -Copt-level=2 -Clinker-plugin-lto -Ccodegen-units=1 --emit=obj + +all: staticlib staticlib-fat-lto staticlib-thin-lto rlib exe cdylib rdylib + +staticlib: lib.rs + $(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib.a + $(call EXTRACT_OBJS, liblib.a) + for file in $(TMPDIR)/liblib.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done + +staticlib-fat-lto: lib.rs + $(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib-fat-lto.a -Clto=fat + $(call EXTRACT_OBJS, liblib-fat-lto.a) + for file in $(TMPDIR)/liblib-fat-lto.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done + +staticlib-thin-lto: lib.rs + $(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib-thin-lto.a -Clto=thin + $(call EXTRACT_OBJS, liblib-thin-lto.a) + for file in $(TMPDIR)/liblib-thin-lto.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done + +rlib: lib.rs + $(BUILD_LIB) --crate-type=rlib -o $(TMPDIR)/liblib.rlib + $(call EXTRACT_OBJS, liblib.rlib) + for file in $(TMPDIR)/liblib.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done + +cdylib: lib.rs + $(BUILD_LIB) --crate-type=cdylib --emit=obj -o $(TMPDIR)/cdylib.o + $(call ASSERT_IS_BITCODE_OBJ, $(TMPDIR)/cdylib.o) + +rdylib: lib.rs + $(BUILD_LIB) --crate-type=dylib --emit=obj -o $(TMPDIR)/rdylib.o + $(call ASSERT_IS_BITCODE_OBJ, $(TMPDIR)/rdylib.o) + +exe: lib.rs + $(BUILD_EXE) -o $(TMPDIR)/exe.o + $(call ASSERT_IS_BITCODE_OBJ, $(TMPDIR)/exe.o) + +else + +all: + +endif diff --git a/tests/run-make/cross-lang-lto/lib.rs b/tests/run-make/cross-lang-lto/lib.rs new file mode 100644 index 000000000..94cfef6ad --- /dev/null +++ b/tests/run-make/cross-lang-lto/lib.rs @@ -0,0 +1,4 @@ +#[no_mangle] +pub extern "C" fn foo() { + println!("abc"); +} diff --git a/tests/run-make/cross-lang-lto/main.rs b/tests/run-make/cross-lang-lto/main.rs new file mode 100644 index 000000000..f6320bcb0 --- /dev/null +++ b/tests/run-make/cross-lang-lto/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello World"); +} diff --git a/tests/run-make/debug-assertions/Makefile b/tests/run-make/debug-assertions/Makefile new file mode 100644 index 000000000..e83337c59 --- /dev/null +++ b/tests/run-make/debug-assertions/Makefile @@ -0,0 +1,26 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) debug.rs -C debug-assertions=no + $(call RUN,debug) good + $(RUSTC) debug.rs -C opt-level=0 + $(call RUN,debug) bad + $(RUSTC) debug.rs -C opt-level=1 + $(call RUN,debug) good + $(RUSTC) debug.rs -C opt-level=2 + $(call RUN,debug) good + $(RUSTC) debug.rs -C opt-level=3 + $(call RUN,debug) good + $(RUSTC) debug.rs -C opt-level=s + $(call RUN,debug) good + $(RUSTC) debug.rs -C opt-level=z + $(call RUN,debug) good + $(RUSTC) debug.rs -O + $(call RUN,debug) good + $(RUSTC) debug.rs + $(call RUN,debug) bad + $(RUSTC) debug.rs -C debug-assertions=yes -O + $(call RUN,debug) bad + $(RUSTC) debug.rs -C debug-assertions=yes -C opt-level=1 + $(call RUN,debug) bad diff --git a/tests/run-make/debug-assertions/debug.rs b/tests/run-make/debug-assertions/debug.rs new file mode 100644 index 000000000..76ca60a71 --- /dev/null +++ b/tests/run-make/debug-assertions/debug.rs @@ -0,0 +1,33 @@ +#![feature(rustc_attrs)] +#![deny(warnings)] + +use std::env; +use std::thread; + +fn main() { + let should_fail = env::args().nth(1) == Some("bad".to_string()); + + assert_eq!(thread::spawn(debug_assert_eq).join().is_err(), should_fail); + assert_eq!(thread::spawn(debug_assert).join().is_err(), should_fail); + assert_eq!(thread::spawn(overflow).join().is_err(), should_fail); +} + +fn debug_assert_eq() { + let mut hit1 = false; + let mut hit2 = false; + debug_assert_eq!({ hit1 = true; 1 }, { hit2 = true; 2 }); + assert!(!hit1); + assert!(!hit2); +} + +fn debug_assert() { + let mut hit = false; + debug_assert!({ hit = true; false }); + assert!(!hit); +} + +fn overflow() { + fn add(a: u8, b: u8) -> u8 { a + b } + + add(200u8, 200u8); +} diff --git a/tests/run-make/dep-graph/Makefile b/tests/run-make/dep-graph/Makefile index ae97b1672..d06333f44 100644 --- a/tests/run-make/dep-graph/Makefile +++ b/tests/run-make/dep-graph/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # ignore-cross-compile diff --git a/tests/run-make/dep-info-doesnt-run-much/Makefile b/tests/run-make/dep-info-doesnt-run-much/Makefile new file mode 100644 index 000000000..b4dc44ad2 --- /dev/null +++ b/tests/run-make/dep-info-doesnt-run-much/Makefile @@ -0,0 +1,4 @@ +include ../tools.mk + +all: + $(RUSTC) foo.rs --emit dep-info diff --git a/tests/run-make/dep-info-doesnt-run-much/foo.rs b/tests/run-make/dep-info-doesnt-run-much/foo.rs new file mode 100644 index 000000000..316e68129 --- /dev/null +++ b/tests/run-make/dep-info-doesnt-run-much/foo.rs @@ -0,0 +1,5 @@ +// We're only emitting dep info, so we shouldn't be running static analysis to +// figure out that this program is erroneous. +fn main() { + let a: u8 = "a"; +} diff --git a/tests/run-make/dep-info-spaces/Makefile b/tests/run-make/dep-info-spaces/Makefile new file mode 100644 index 000000000..0cfe513e4 --- /dev/null +++ b/tests/run-make/dep-info-spaces/Makefile @@ -0,0 +1,19 @@ +include ../tools.mk + +# ignore-windows +# ignore-freebsd +# FIXME: (windows: see `../dep-info/Makefile`) + +all: + cp lib.rs $(TMPDIR)/ + cp 'foo foo.rs' $(TMPDIR)/ + cp bar.rs $(TMPDIR)/ + $(RUSTC) --emit link,dep-info --crate-type=lib $(TMPDIR)/lib.rs + sleep 1 + touch $(TMPDIR)/'foo foo.rs' + -rm -f $(TMPDIR)/done + $(MAKE) -drf Makefile.foo + rm $(TMPDIR)/done + pwd + $(MAKE) -drf Makefile.foo + rm $(TMPDIR)/done && exit 1 || exit 0 diff --git a/tests/run-make/dep-info-spaces/Makefile.foo b/tests/run-make/dep-info-spaces/Makefile.foo new file mode 100644 index 000000000..80a5d4333 --- /dev/null +++ b/tests/run-make/dep-info-spaces/Makefile.foo @@ -0,0 +1,7 @@ +LIB := $(shell $(RUSTC) --print file-names --crate-type=lib $(TMPDIR)/lib.rs) + +$(TMPDIR)/$(LIB): + $(RUSTC) --emit link,dep-info --crate-type=lib $(TMPDIR)/lib.rs + touch $(TMPDIR)/done + +-include $(TMPDIR)/lib.d diff --git a/tests/run-make/dep-info-spaces/bar.rs b/tests/run-make/dep-info-spaces/bar.rs new file mode 100644 index 000000000..c5c0bc606 --- /dev/null +++ b/tests/run-make/dep-info-spaces/bar.rs @@ -0,0 +1 @@ +pub fn bar() {} diff --git a/tests/run-make/dep-info-spaces/foo foo.rs b/tests/run-make/dep-info-spaces/foo foo.rs new file mode 100644 index 000000000..b76b4321d --- /dev/null +++ b/tests/run-make/dep-info-spaces/foo foo.rs @@ -0,0 +1 @@ +pub fn foo() {} diff --git a/tests/run-make/dep-info-spaces/lib.rs b/tests/run-make/dep-info-spaces/lib.rs new file mode 100644 index 000000000..6264e7b67 --- /dev/null +++ b/tests/run-make/dep-info-spaces/lib.rs @@ -0,0 +1,4 @@ +#[path="foo foo.rs"] +pub mod foo; + +pub mod bar; diff --git a/tests/run-make/dep-info/Makefile b/tests/run-make/dep-info/Makefile new file mode 100644 index 000000000..c76f43a8e --- /dev/null +++ b/tests/run-make/dep-info/Makefile @@ -0,0 +1,25 @@ +include ../tools.mk + +# ignore-windows +# ignore-freebsd +# FIXME: on windows `rustc --dep-info` produces Makefile dependency with +# windows native paths (e.g. `c:\path\to\libfoo.a`) +# but msys make seems to fail to recognize such paths, so test fails. + +all: + cp *.rs $(TMPDIR) + $(RUSTC) --emit dep-info,link --crate-type=lib $(TMPDIR)/lib.rs + sleep 2 + touch $(TMPDIR)/foo.rs + -rm -f $(TMPDIR)/done + $(MAKE) -drf Makefile.foo + sleep 2 + rm $(TMPDIR)/done + pwd + $(MAKE) -drf Makefile.foo + rm $(TMPDIR)/done && exit 1 || exit 0 + + # When a source file is deleted `make` should still work + rm $(TMPDIR)/bar.rs + cp $(TMPDIR)/lib2.rs $(TMPDIR)/lib.rs + $(MAKE) -drf Makefile.foo diff --git a/tests/run-make/dep-info/Makefile.foo b/tests/run-make/dep-info/Makefile.foo new file mode 100644 index 000000000..e5df31f88 --- /dev/null +++ b/tests/run-make/dep-info/Makefile.foo @@ -0,0 +1,7 @@ +LIB := $(shell $(RUSTC) --print file-names --crate-type=lib lib.rs) + +$(TMPDIR)/$(LIB): + $(RUSTC) --emit dep-info,link --crate-type=lib lib.rs + touch $(TMPDIR)/done + +-include $(TMPDIR)/foo.d diff --git a/tests/run-make/dep-info/bar.rs b/tests/run-make/dep-info/bar.rs new file mode 100644 index 000000000..c5c0bc606 --- /dev/null +++ b/tests/run-make/dep-info/bar.rs @@ -0,0 +1 @@ +pub fn bar() {} diff --git a/tests/run-make/dep-info/foo.rs b/tests/run-make/dep-info/foo.rs new file mode 100644 index 000000000..b76b4321d --- /dev/null +++ b/tests/run-make/dep-info/foo.rs @@ -0,0 +1 @@ +pub fn foo() {} diff --git a/tests/run-make/dep-info/lib.rs b/tests/run-make/dep-info/lib.rs new file mode 100644 index 000000000..eb8631259 --- /dev/null +++ b/tests/run-make/dep-info/lib.rs @@ -0,0 +1,4 @@ +#![crate_name = "foo"] + +pub mod foo; +pub mod bar; diff --git a/tests/run-make/dep-info/lib2.rs b/tests/run-make/dep-info/lib2.rs new file mode 100644 index 000000000..f4fda9c93 --- /dev/null +++ b/tests/run-make/dep-info/lib2.rs @@ -0,0 +1,3 @@ +#![crate_name = "foo"] + +pub mod foo; diff --git a/tests/run-make/doctests-keep-binaries/Makefile b/tests/run-make/doctests-keep-binaries/Makefile new file mode 100644 index 000000000..6254e93d3 --- /dev/null +++ b/tests/run-make/doctests-keep-binaries/Makefile @@ -0,0 +1,22 @@ +# ignore-cross-compile +include ../tools.mk + +# Check that valid binaries are persisted by running them, regardless of whether the --run or --no-run option is used. + +all: run no_run + +run: + mkdir -p $(TMPDIR)/doctests + $(RUSTC) --crate-type rlib t.rs + $(RUSTDOC) -Zunstable-options --test --persist-doctests $(TMPDIR)/doctests --extern t=$(TMPDIR)/libt.rlib t.rs + $(TMPDIR)/doctests/t_rs_2_0/rust_out + $(TMPDIR)/doctests/t_rs_8_0/rust_out + rm -rf $(TMPDIR)/doctests + +no_run: + mkdir -p $(TMPDIR)/doctests + $(RUSTC) --crate-type rlib t.rs + $(RUSTDOC) -Zunstable-options --test --persist-doctests $(TMPDIR)/doctests --extern t=$(TMPDIR)/libt.rlib t.rs --no-run + $(TMPDIR)/doctests/t_rs_2_0/rust_out + $(TMPDIR)/doctests/t_rs_8_0/rust_out + rm -rf $(TMPDIR)/doctests diff --git a/tests/run-make/doctests-keep-binaries/t.rs b/tests/run-make/doctests-keep-binaries/t.rs new file mode 100644 index 000000000..c38cf0a0b --- /dev/null +++ b/tests/run-make/doctests-keep-binaries/t.rs @@ -0,0 +1,11 @@ +/// Fungle the foople. +/// ``` +/// t::foople(); +/// ``` +pub fn foople() {} + +/// Flomble the florp +/// ``` +/// t::florp(); +/// ``` +pub fn florp() {} diff --git a/tests/run-make/dump-mono-stats/Makefile b/tests/run-make/dump-mono-stats/Makefile index fe1112fb0..196f84be6 100644 --- a/tests/run-make/dump-mono-stats/Makefile +++ b/tests/run-make/dump-mono-stats/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk all: $(RUSTC) --crate-type lib foo.rs -Z dump-mono-stats=$(TMPDIR) -Zdump-mono-stats-format=json diff --git a/tests/run-make/duplicate-output-flavors/Makefile b/tests/run-make/duplicate-output-flavors/Makefile new file mode 100644 index 000000000..e33279966 --- /dev/null +++ b/tests/run-make/duplicate-output-flavors/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + $(RUSTC) --crate-type=rlib foo.rs + $(RUSTC) --crate-type=rlib,rlib foo.rs diff --git a/tests/run-make/duplicate-output-flavors/foo.rs b/tests/run-make/duplicate-output-flavors/foo.rs new file mode 100644 index 000000000..c1bfaa6ca --- /dev/null +++ b/tests/run-make/duplicate-output-flavors/foo.rs @@ -0,0 +1 @@ +#![crate_type = "rlib"] diff --git a/tests/run-make/dylib-chain/Makefile b/tests/run-make/dylib-chain/Makefile new file mode 100644 index 000000000..f1fea99c5 --- /dev/null +++ b/tests/run-make/dylib-chain/Makefile @@ -0,0 +1,13 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) m1.rs -C prefer-dynamic + $(RUSTC) m2.rs -C prefer-dynamic + $(RUSTC) m3.rs -C prefer-dynamic + $(RUSTC) m4.rs + $(call RUN,m4) + $(call REMOVE_DYLIBS,m1) + $(call REMOVE_DYLIBS,m2) + $(call REMOVE_DYLIBS,m3) + $(call FAIL,m4) diff --git a/tests/run-make/dylib-chain/m1.rs b/tests/run-make/dylib-chain/m1.rs new file mode 100644 index 000000000..08c3f3752 --- /dev/null +++ b/tests/run-make/dylib-chain/m1.rs @@ -0,0 +1,2 @@ +#![crate_type = "dylib"] +pub fn m1() {} diff --git a/tests/run-make/dylib-chain/m2.rs b/tests/run-make/dylib-chain/m2.rs new file mode 100644 index 000000000..62176ddc9 --- /dev/null +++ b/tests/run-make/dylib-chain/m2.rs @@ -0,0 +1,4 @@ +#![crate_type = "dylib"] +extern crate m1; + +pub fn m2() { m1::m1() } diff --git a/tests/run-make/dylib-chain/m3.rs b/tests/run-make/dylib-chain/m3.rs new file mode 100644 index 000000000..d213aeda9 --- /dev/null +++ b/tests/run-make/dylib-chain/m3.rs @@ -0,0 +1,4 @@ +#![crate_type = "dylib"] +extern crate m2; + +pub fn m3() { m2::m2() } diff --git a/tests/run-make/dylib-chain/m4.rs b/tests/run-make/dylib-chain/m4.rs new file mode 100644 index 000000000..fa8ec6079 --- /dev/null +++ b/tests/run-make/dylib-chain/m4.rs @@ -0,0 +1,3 @@ +extern crate m3; + +fn main() { m3::m3() } diff --git a/tests/run-make/emit-named-files/Makefile b/tests/run-make/emit-named-files/Makefile index e081fa479..2b97b841f 100644 --- a/tests/run-make/emit-named-files/Makefile +++ b/tests/run-make/emit-named-files/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk OUT=$(TMPDIR)/emit diff --git a/tests/run-make/emit-path-unhashed/Makefile b/tests/run-make/emit-path-unhashed/Makefile index c144d4aa9..74047fe5f 100644 --- a/tests/run-make/emit-path-unhashed/Makefile +++ b/tests/run-make/emit-path-unhashed/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk OUT=$(TMPDIR)/emit diff --git a/tests/run-make/emit-shared-files/Makefile b/tests/run-make/emit-shared-files/Makefile index cad0c9e5b..27c72b003 100644 --- a/tests/run-make/emit-shared-files/Makefile +++ b/tests/run-make/emit-shared-files/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk INVOCATION_ONLY = $(TMPDIR)/invocation-only TOOLCHAIN_ONLY = $(TMPDIR)/toolchain-only diff --git a/tests/run-make/emit-stack-sizes/Makefile b/tests/run-make/emit-stack-sizes/Makefile new file mode 100644 index 000000000..f636ebd28 --- /dev/null +++ b/tests/run-make/emit-stack-sizes/Makefile @@ -0,0 +1,12 @@ +include ../tools.mk + +# ignore-windows +# ignore-macos +# +# This feature only works when the output object format is ELF so we ignore +# macOS and Windows + +# check that the .stack_sizes section is generated +all: + $(RUSTC) -C opt-level=3 -Z emit-stack-sizes --emit=obj foo.rs + size -A $(TMPDIR)/foo.o | $(CGREP) .stack_sizes diff --git a/tests/run-make/emit-stack-sizes/foo.rs b/tests/run-make/emit-stack-sizes/foo.rs new file mode 100644 index 000000000..ee51ae328 --- /dev/null +++ b/tests/run-make/emit-stack-sizes/foo.rs @@ -0,0 +1,3 @@ +#![crate_type = "lib"] + +pub fn foo() {} diff --git a/tests/run-make/emit/Makefile b/tests/run-make/emit/Makefile new file mode 100644 index 000000000..b3ca0b79f --- /dev/null +++ b/tests/run-make/emit/Makefile @@ -0,0 +1,22 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) -Copt-level=0 --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs + $(RUSTC) -Copt-level=1 --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs + $(RUSTC) -Copt-level=2 --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs + $(RUSTC) -Copt-level=3 --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs + $(RUSTC) -Copt-level=s --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs + $(RUSTC) -Copt-level=z --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs + $(RUSTC) -Copt-level=0 --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs + $(call RUN,test-26235) || exit 1 + $(RUSTC) -Copt-level=1 --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs + $(call RUN,test-26235) || exit 1 + $(RUSTC) -Copt-level=2 --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs + $(call RUN,test-26235) || exit 1 + $(RUSTC) -Copt-level=3 --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs + $(call RUN,test-26235) || exit 1 + $(RUSTC) -Copt-level=s --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs + $(call RUN,test-26235) || exit 1 + $(RUSTC) -Copt-level=z --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs + $(call RUN,test-26235) || exit 1 diff --git a/tests/run-make/emit/test-24876.rs b/tests/run-make/emit/test-24876.rs new file mode 100644 index 000000000..734e2ee4b --- /dev/null +++ b/tests/run-make/emit/test-24876.rs @@ -0,0 +1,9 @@ +// Checks for issue #24876 + +fn main() { + let mut v = 0; + for i in 0..0 { + v += i; + } + println!("{}", v) +} diff --git a/tests/run-make/emit/test-26235.rs b/tests/run-make/emit/test-26235.rs new file mode 100644 index 000000000..07d975f33 --- /dev/null +++ b/tests/run-make/emit/test-26235.rs @@ -0,0 +1,46 @@ +// Checks for issue #26235 + +fn main() { + use std::thread; + + type Key = u32; + const NUM_THREADS: usize = 2; + + #[derive(Clone,Copy)] + struct Stats { + upsert: S, + delete: S, + insert: S, + update: S + }; + + impl Stats where S: Copy { + fn dot(self, s: Stats, f: F) -> Stats where F: Fn(S, T) -> B { + let Stats { upsert: u1, delete: d1, insert: i1, update: p1 } = self; + let Stats { upsert: u2, delete: d2, insert: i2, update: p2 } = s; + Stats { upsert: f(u1, u2), delete: f(d1, d2), insert: f(i1, i2), update: f(p1, p2) } + } + + fn new(init: S) -> Self { + Stats { upsert: init, delete: init, insert: init, update: init } + } + } + + fn make_threads() -> Vec> { + let mut t = Vec::with_capacity(NUM_THREADS); + for _ in 0..NUM_THREADS { + t.push(thread::spawn(move || {})); + } + t + } + + let stats = [Stats::new(0); NUM_THREADS]; + make_threads(); + + { + let Stats { ref upsert, ref delete, ref insert, ref update } = stats.iter().fold( + Stats::new(0), |res, &s| res.dot(s, |x: Key, y: Key| x.wrapping_add(y))); + println!("upserts: {}, deletes: {}, inserts: {}, updates: {}", + upsert, delete, insert, update); + } +} diff --git a/tests/run-make/env-dep-info/Makefile b/tests/run-make/env-dep-info/Makefile index 1675a61b1..bc0ffc2df 100644 --- a/tests/run-make/env-dep-info/Makefile +++ b/tests/run-make/env-dep-info/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # FIXME(eddyb) provide `HOST_RUSTC` and `TARGET_RUSTC` # instead of hardcoding them everywhere they're needed. diff --git a/tests/run-make/error-found-staticlib-instead-crate/Makefile b/tests/run-make/error-found-staticlib-instead-crate/Makefile new file mode 100644 index 000000000..0eae41d72 --- /dev/null +++ b/tests/run-make/error-found-staticlib-instead-crate/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + $(RUSTC) foo.rs --crate-type staticlib + $(RUSTC) bar.rs 2>&1 | $(CGREP) "found staticlib" diff --git a/tests/run-make/error-found-staticlib-instead-crate/bar.rs b/tests/run-make/error-found-staticlib-instead-crate/bar.rs new file mode 100644 index 000000000..fe35f1f8e --- /dev/null +++ b/tests/run-make/error-found-staticlib-instead-crate/bar.rs @@ -0,0 +1,5 @@ +extern crate foo; + +fn main() { + foo::foo(); +} diff --git a/tests/run-make/error-found-staticlib-instead-crate/foo.rs b/tests/run-make/error-found-staticlib-instead-crate/foo.rs new file mode 100644 index 000000000..b76b4321d --- /dev/null +++ b/tests/run-make/error-found-staticlib-instead-crate/foo.rs @@ -0,0 +1 @@ +pub fn foo() {} diff --git a/tests/run-make/error-writing-dependencies/Makefile b/tests/run-make/error-writing-dependencies/Makefile new file mode 100644 index 000000000..a5d30a647 --- /dev/null +++ b/tests/run-make/error-writing-dependencies/Makefile @@ -0,0 +1,8 @@ +include ../tools.mk + +all: + # Let's get a nice error message + $(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | \ + $(CGREP) "error writing dependencies" + # Make sure the filename shows up + $(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | $(CGREP) "baz" diff --git a/tests/run-make/error-writing-dependencies/foo.rs b/tests/run-make/error-writing-dependencies/foo.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/tests/run-make/error-writing-dependencies/foo.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/exit-code/Makefile b/tests/run-make/exit-code/Makefile new file mode 100644 index 000000000..6458b7168 --- /dev/null +++ b/tests/run-make/exit-code/Makefile @@ -0,0 +1,12 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) success.rs; [ $$? -eq 0 ] + $(RUSTC) --invalid-arg-foo; [ $$? -eq 1 ] + $(RUSTC) compile-error.rs; [ $$? -eq 1 ] + $(RUSTC) -Ztreat-err-as-bug compile-error.rs; [ $$? -eq 101 ] + $(RUSTDOC) -o $(TMPDIR)/exit-code success.rs; [ $$? -eq 0 ] + $(RUSTDOC) --invalid-arg-foo; [ $$? -eq 1 ] + $(RUSTDOC) compile-error.rs; [ $$? -eq 1 ] + $(RUSTDOC) lint-failure.rs; [ $$? -eq 1 ] diff --git a/tests/run-make/exit-code/compile-error.rs b/tests/run-make/exit-code/compile-error.rs new file mode 100644 index 000000000..a96c19760 --- /dev/null +++ b/tests/run-make/exit-code/compile-error.rs @@ -0,0 +1,3 @@ +fn main() { + compile_error!("kaboom"); +} diff --git a/tests/run-make/exit-code/lint-failure.rs b/tests/run-make/exit-code/lint-failure.rs new file mode 100644 index 000000000..df876ec23 --- /dev/null +++ b/tests/run-make/exit-code/lint-failure.rs @@ -0,0 +1,6 @@ +#![deny(broken_intra_doc_links)] + +/// [intradoc::failure] +pub fn main() { + println!("Hello, world!"); +} diff --git a/tests/run-make/exit-code/success.rs b/tests/run-make/exit-code/success.rs new file mode 100644 index 000000000..55b8e42b6 --- /dev/null +++ b/tests/run-make/exit-code/success.rs @@ -0,0 +1,4 @@ +/// Main function +fn main() { + println!("Hello, world!"); +} diff --git a/tests/run-make/export-executable-symbols/Makefile b/tests/run-make/export-executable-symbols/Makefile index daa77c99d..c4d29aa2b 100644 --- a/tests/run-make/export-executable-symbols/Makefile +++ b/tests/run-make/export-executable-symbols/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # ignore-wasm32 # ignore-wasm64 diff --git a/tests/run-make/extern-diff-internal-name/Makefile b/tests/run-make/extern-diff-internal-name/Makefile new file mode 100644 index 000000000..250f82dfa --- /dev/null +++ b/tests/run-make/extern-diff-internal-name/Makefile @@ -0,0 +1,6 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) lib.rs + $(RUSTC) test.rs --extern foo=$(TMPDIR)/libbar.rlib diff --git a/tests/run-make/extern-diff-internal-name/lib.rs b/tests/run-make/extern-diff-internal-name/lib.rs new file mode 100644 index 000000000..ad96f7086 --- /dev/null +++ b/tests/run-make/extern-diff-internal-name/lib.rs @@ -0,0 +1,2 @@ +#![crate_name = "bar"] +#![crate_type = "rlib"] diff --git a/tests/run-make/extern-diff-internal-name/test.rs b/tests/run-make/extern-diff-internal-name/test.rs new file mode 100644 index 000000000..4c53dc28a --- /dev/null +++ b/tests/run-make/extern-diff-internal-name/test.rs @@ -0,0 +1,5 @@ +#[macro_use] +extern crate foo; + +fn main() { +} diff --git a/tests/run-make/extern-flag-disambiguates/Makefile b/tests/run-make/extern-flag-disambiguates/Makefile new file mode 100644 index 000000000..e54a537ec --- /dev/null +++ b/tests/run-make/extern-flag-disambiguates/Makefile @@ -0,0 +1,26 @@ +# ignore-cross-compile +include ../tools.mk + +# Attempt to build this dependency tree: +# +# A.1 A.2 +# |\ | +# | \ | +# B \ C +# \ | / +# \|/ +# D +# +# Note that A.1 and A.2 are crates with the same name. + +all: + $(RUSTC) -C metadata=1 -C extra-filename=-1 a.rs + $(RUSTC) -C metadata=2 -C extra-filename=-2 a.rs + $(RUSTC) b.rs --extern a=$(TMPDIR)/liba-1.rlib + $(RUSTC) c.rs --extern a=$(TMPDIR)/liba-2.rlib + @echo before + $(RUSTC) --cfg before d.rs --extern a=$(TMPDIR)/liba-1.rlib + $(call RUN,d) + @echo after + $(RUSTC) --cfg after d.rs --extern a=$(TMPDIR)/liba-1.rlib + $(call RUN,d) diff --git a/tests/run-make/extern-flag-disambiguates/a.rs b/tests/run-make/extern-flag-disambiguates/a.rs new file mode 100644 index 000000000..2b1a31901 --- /dev/null +++ b/tests/run-make/extern-flag-disambiguates/a.rs @@ -0,0 +1,6 @@ +#![crate_name = "a"] +#![crate_type = "rlib"] + +static FOO: usize = 3; + +pub fn token() -> &'static usize { &FOO } diff --git a/tests/run-make/extern-flag-disambiguates/b.rs b/tests/run-make/extern-flag-disambiguates/b.rs new file mode 100644 index 000000000..1d7a7339c --- /dev/null +++ b/tests/run-make/extern-flag-disambiguates/b.rs @@ -0,0 +1,9 @@ +#![crate_name = "b"] +#![crate_type = "rlib"] + +extern crate a; + +static FOO: usize = 3; + +pub fn token() -> &'static usize { &FOO } +pub fn a_token() -> &'static usize { a::token() } diff --git a/tests/run-make/extern-flag-disambiguates/c.rs b/tests/run-make/extern-flag-disambiguates/c.rs new file mode 100644 index 000000000..3f9d143ed --- /dev/null +++ b/tests/run-make/extern-flag-disambiguates/c.rs @@ -0,0 +1,9 @@ +#![crate_name = "c"] +#![crate_type = "rlib"] + +extern crate a; + +static FOO: usize = 3; + +pub fn token() -> &'static usize { &FOO } +pub fn a_token() -> &'static usize { a::token() } diff --git a/tests/run-make/extern-flag-disambiguates/d.rs b/tests/run-make/extern-flag-disambiguates/d.rs new file mode 100644 index 000000000..249c6a107 --- /dev/null +++ b/tests/run-make/extern-flag-disambiguates/d.rs @@ -0,0 +1,11 @@ +#[cfg(before)] extern crate a; +extern crate b; +extern crate c; +#[cfg(after)] extern crate a; + +fn t(a: &'static usize) -> usize { a as *const _ as usize } + +fn main() { + assert_eq!(t(a::token()), t(b::a_token())); + assert!(t(a::token()) != t(c::a_token())); +} diff --git a/tests/run-make/extern-flag-fun/Makefile b/tests/run-make/extern-flag-fun/Makefile new file mode 100644 index 000000000..687cdfd76 --- /dev/null +++ b/tests/run-make/extern-flag-fun/Makefile @@ -0,0 +1,20 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) bar.rs --crate-type=rlib + $(RUSTC) bar.rs --crate-type=rlib -C extra-filename=-a + $(RUSTC) bar-alt.rs --crate-type=rlib + $(RUSTC) foo.rs --extern bar=no-exist && exit 1 || exit 0 + $(RUSTC) foo.rs --extern bar=foo.rs && exit 1 || exit 0 + $(RUSTC) foo.rs \ + --extern bar=$(TMPDIR)/libbar.rlib \ + --extern bar=$(TMPDIR)/libbar-alt.rlib \ + && exit 1 || exit 0 + $(RUSTC) foo.rs \ + --extern bar=$(TMPDIR)/libbar.rlib \ + --extern bar=$(TMPDIR)/libbar-a.rlib + $(RUSTC) foo.rs --extern bar=$(TMPDIR)/libbar.rlib + # Try to be sneaky and load a private crate from with a non-private name. + $(RUSTC) rustc.rs -Zforce-unstable-if-unmarked --crate-type=rlib + $(RUSTC) gated_unstable.rs --extern alloc=$(TMPDIR)/librustc.rlib 2>&1 | $(CGREP) 'rustc_private' diff --git a/tests/run-make/extern-flag-fun/bar-alt.rs b/tests/run-make/extern-flag-fun/bar-alt.rs new file mode 100644 index 000000000..cdc6c27d8 --- /dev/null +++ b/tests/run-make/extern-flag-fun/bar-alt.rs @@ -0,0 +1 @@ +pub fn f() {} diff --git a/tests/run-make/extern-flag-fun/bar.rs b/tests/run-make/extern-flag-fun/bar.rs new file mode 100644 index 000000000..d11c69f81 --- /dev/null +++ b/tests/run-make/extern-flag-fun/bar.rs @@ -0,0 +1 @@ +// intentionally empty diff --git a/tests/run-make/extern-flag-fun/foo.rs b/tests/run-make/extern-flag-fun/foo.rs new file mode 100644 index 000000000..0edda7d7b --- /dev/null +++ b/tests/run-make/extern-flag-fun/foo.rs @@ -0,0 +1,3 @@ +extern crate bar; + +fn main() {} diff --git a/tests/run-make/extern-flag-fun/gated_unstable.rs b/tests/run-make/extern-flag-fun/gated_unstable.rs new file mode 100644 index 000000000..03600c830 --- /dev/null +++ b/tests/run-make/extern-flag-fun/gated_unstable.rs @@ -0,0 +1,3 @@ +extern crate alloc; + +fn main() {} diff --git a/tests/run-make/extern-flag-fun/rustc.rs b/tests/run-make/extern-flag-fun/rustc.rs new file mode 100644 index 000000000..b76b4321d --- /dev/null +++ b/tests/run-make/extern-flag-fun/rustc.rs @@ -0,0 +1 @@ +pub fn foo() {} diff --git a/tests/run-make/extern-flag-pathless/Makefile b/tests/run-make/extern-flag-pathless/Makefile new file mode 100644 index 000000000..701bfcd28 --- /dev/null +++ b/tests/run-make/extern-flag-pathless/Makefile @@ -0,0 +1,19 @@ +# ignore-cross-compile +include ../tools.mk + +# Test mixing pathless --extern with paths. + +all: + $(RUSTC) bar-static.rs --crate-name=bar --crate-type=rlib + $(RUSTC) bar-dynamic.rs --crate-name=bar --crate-type=dylib -C prefer-dynamic + # rlib preferred over dylib + $(RUSTC) foo.rs --extern bar + $(call RUN,foo) | $(CGREP) 'static' + $(RUSTC) foo.rs --extern bar=$(TMPDIR)/libbar.rlib --extern bar + $(call RUN,foo) | $(CGREP) 'static' + # explicit --extern overrides pathless + $(RUSTC) foo.rs --extern bar=$(call DYLIB,bar) --extern bar + $(call RUN,foo) | $(CGREP) 'dynamic' + # prefer-dynamic does what it says + $(RUSTC) foo.rs --extern bar -C prefer-dynamic + $(call RUN,foo) | $(CGREP) 'dynamic' diff --git a/tests/run-make/extern-flag-pathless/bar-dynamic.rs b/tests/run-make/extern-flag-pathless/bar-dynamic.rs new file mode 100644 index 000000000..e2d68d517 --- /dev/null +++ b/tests/run-make/extern-flag-pathless/bar-dynamic.rs @@ -0,0 +1,3 @@ +pub fn f() { + println!("dynamic"); +} diff --git a/tests/run-make/extern-flag-pathless/bar-static.rs b/tests/run-make/extern-flag-pathless/bar-static.rs new file mode 100644 index 000000000..240d8bde4 --- /dev/null +++ b/tests/run-make/extern-flag-pathless/bar-static.rs @@ -0,0 +1,3 @@ +pub fn f() { + println!("static"); +} diff --git a/tests/run-make/extern-flag-pathless/foo.rs b/tests/run-make/extern-flag-pathless/foo.rs new file mode 100644 index 000000000..1ea64da7d --- /dev/null +++ b/tests/run-make/extern-flag-pathless/foo.rs @@ -0,0 +1,3 @@ +fn main() { + bar::f(); +} diff --git a/tests/run-make/extern-flag-rename-transitive/Makefile b/tests/run-make/extern-flag-rename-transitive/Makefile new file mode 100644 index 000000000..d16a8e208 --- /dev/null +++ b/tests/run-make/extern-flag-rename-transitive/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +all: + $(RUSTC) foo.rs + $(RUSTC) bar.rs + $(RUSTC) baz.rs --extern a=$(TMPDIR)/libfoo.rlib + diff --git a/tests/run-make/extern-flag-rename-transitive/bar.rs b/tests/run-make/extern-flag-rename-transitive/bar.rs new file mode 100644 index 000000000..94446a07d --- /dev/null +++ b/tests/run-make/extern-flag-rename-transitive/bar.rs @@ -0,0 +1,3 @@ +#![crate_type = "rlib"] + +extern crate foo; diff --git a/tests/run-make/extern-flag-rename-transitive/baz.rs b/tests/run-make/extern-flag-rename-transitive/baz.rs new file mode 100644 index 000000000..c3908db34 --- /dev/null +++ b/tests/run-make/extern-flag-rename-transitive/baz.rs @@ -0,0 +1,4 @@ +#![crate_type = "rlib"] + +extern crate a; +extern crate bar; diff --git a/tests/run-make/extern-flag-rename-transitive/foo.rs b/tests/run-make/extern-flag-rename-transitive/foo.rs new file mode 100644 index 000000000..c1bfaa6ca --- /dev/null +++ b/tests/run-make/extern-flag-rename-transitive/foo.rs @@ -0,0 +1 @@ +#![crate_type = "rlib"] diff --git a/tests/run-make/extern-fn-generic/Makefile b/tests/run-make/extern-fn-generic/Makefile new file mode 100644 index 000000000..7dceea6cb --- /dev/null +++ b/tests/run-make/extern-fn-generic/Makefile @@ -0,0 +1,7 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(call NATIVE_STATICLIB,test) + $(RUSTC) testcrate.rs + $(RUSTC) test.rs + $(call RUN,test) || exit 1 diff --git a/tests/run-make/extern-fn-generic/test.c b/tests/run-make/extern-fn-generic/test.c new file mode 100644 index 000000000..a8504ff2a --- /dev/null +++ b/tests/run-make/extern-fn-generic/test.c @@ -0,0 +1,16 @@ +#include + +typedef struct TestStruct { + uint8_t x; + int32_t y; +} TestStruct; + +typedef int callback(TestStruct s); + +uint32_t call(callback *c) { + TestStruct s; + s.x = 'a'; + s.y = 3; + + return c(s); +} diff --git a/tests/run-make/extern-fn-generic/test.rs b/tests/run-make/extern-fn-generic/test.rs new file mode 100644 index 000000000..c9baa4898 --- /dev/null +++ b/tests/run-make/extern-fn-generic/test.rs @@ -0,0 +1,20 @@ +extern crate testcrate; + +extern "C" fn bar(ts: testcrate::TestStruct) -> T { + ts.y +} + +#[link(name = "test", kind = "static")] +extern "C" { + fn call(c: extern "C" fn(testcrate::TestStruct) -> i32) -> i32; +} + +fn main() { + // Let's test calling it cross crate + let back = unsafe { testcrate::call(testcrate::foo::) }; + assert_eq!(3, back); + + // And just within this crate + let back = unsafe { call(bar::) }; + assert_eq!(3, back); +} diff --git a/tests/run-make/extern-fn-generic/testcrate.rs b/tests/run-make/extern-fn-generic/testcrate.rs new file mode 100644 index 000000000..39f76e59c --- /dev/null +++ b/tests/run-make/extern-fn-generic/testcrate.rs @@ -0,0 +1,16 @@ +#![crate_type = "lib"] + +#[repr(C)] +pub struct TestStruct { + pub x: u8, + pub y: T, +} + +pub extern "C" fn foo(ts: TestStruct) -> T { + ts.y +} + +#[link(name = "test", kind = "static")] +extern "C" { + pub fn call(c: extern "C" fn(TestStruct) -> i32) -> i32; +} diff --git a/tests/run-make/extern-fn-mangle/Makefile b/tests/run-make/extern-fn-mangle/Makefile new file mode 100644 index 000000000..3cbbf3839 --- /dev/null +++ b/tests/run-make/extern-fn-mangle/Makefile @@ -0,0 +1,6 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(call NATIVE_STATICLIB,test) + $(RUSTC) test.rs + $(call RUN,test) || exit 1 diff --git a/tests/run-make/extern-fn-mangle/test.c b/tests/run-make/extern-fn-mangle/test.c new file mode 100644 index 000000000..e94d75083 --- /dev/null +++ b/tests/run-make/extern-fn-mangle/test.c @@ -0,0 +1,8 @@ +#include + +uint32_t foo(); +uint32_t bar(); + +uint32_t add() { + return foo() + bar(); +} diff --git a/tests/run-make/extern-fn-mangle/test.rs b/tests/run-make/extern-fn-mangle/test.rs new file mode 100644 index 000000000..40b08f1ed --- /dev/null +++ b/tests/run-make/extern-fn-mangle/test.rs @@ -0,0 +1,19 @@ +#[no_mangle] +pub extern "C" fn foo() -> i32 { + 3 +} + +#[no_mangle] +pub extern "C" fn bar() -> i32 { + 5 +} + +#[link(name = "test", kind = "static")] +extern "C" { + fn add() -> i32; +} + +fn main() { + let back = unsafe { add() }; + assert_eq!(8, back); +} diff --git a/tests/run-make/extern-fn-reachable/Makefile b/tests/run-make/extern-fn-reachable/Makefile new file mode 100644 index 000000000..3297251bf --- /dev/null +++ b/tests/run-make/extern-fn-reachable/Makefile @@ -0,0 +1,26 @@ +# ignore-cross-compile +include ../tools.mk + +# ignore-windows-msvc + +NM=nm -D + +ifeq ($(UNAME),Darwin) +NM=nm -gU +endif + +ifdef IS_WINDOWS +NM=nm -g +endif + +# This overrides the LD_LIBRARY_PATH for RUN +TARGET_RPATH_DIR:=$(TARGET_RPATH_DIR):$(TMPDIR) + +all: + $(RUSTC) dylib.rs -o $(TMPDIR)/libdylib.so -C prefer-dynamic + + [ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun1)" -eq "1" ] + [ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun2)" -eq "1" ] + [ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun3)" -eq "1" ] + [ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun4)" -eq "1" ] + [ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun5)" -eq "1" ] diff --git a/tests/run-make/extern-fn-reachable/dylib.rs b/tests/run-make/extern-fn-reachable/dylib.rs new file mode 100644 index 000000000..cd0179348 --- /dev/null +++ b/tests/run-make/extern-fn-reachable/dylib.rs @@ -0,0 +1,14 @@ +#![crate_type = "dylib"] +#![allow(dead_code)] + +#[no_mangle] pub extern "C" fn fun1() {} +#[no_mangle] extern "C" fn fun2() {} + +mod foo { + #[no_mangle] pub extern "C" fn fun3() {} +} +pub mod bar { + #[no_mangle] pub extern "C" fn fun4() {} +} + +#[no_mangle] pub fn fun5() {} diff --git a/tests/run-make/extern-fn-struct-passing-abi/Makefile b/tests/run-make/extern-fn-struct-passing-abi/Makefile new file mode 100644 index 000000000..3cbbf3839 --- /dev/null +++ b/tests/run-make/extern-fn-struct-passing-abi/Makefile @@ -0,0 +1,6 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(call NATIVE_STATICLIB,test) + $(RUSTC) test.rs + $(call RUN,test) || exit 1 diff --git a/tests/run-make/extern-fn-struct-passing-abi/test.c b/tests/run-make/extern-fn-struct-passing-abi/test.c new file mode 100644 index 000000000..136b07129 --- /dev/null +++ b/tests/run-make/extern-fn-struct-passing-abi/test.c @@ -0,0 +1,314 @@ +#include +#include + +struct Rect { + int32_t a; + int32_t b; + int32_t c; + int32_t d; +}; + +struct BiggerRect { + struct Rect s; + int32_t a; + int32_t b; +}; + +struct FloatRect { + int32_t a; + int32_t b; + double c; +}; + +struct Huge { + int32_t a; + int32_t b; + int32_t c; + int32_t d; + int32_t e; +}; + +struct FloatPoint { + double x; + double y; +}; + +struct FloatOne { + double x; +}; + +struct IntOdd { + int8_t a; + int8_t b; + int8_t c; +}; + +// System V x86_64 ABI: +// a, b, c, d, e should be in registers +// s should be byval pointer +// +// Win64 ABI: +// a, b, c, d should be in registers +// e should be on the stack +// s should be byval pointer +void byval_rect(int32_t a, int32_t b, int32_t c, int32_t d, int32_t e, struct Rect s) { + assert(a == 1); + assert(b == 2); + assert(c == 3); + assert(d == 4); + assert(e == 5); + assert(s.a == 553); + assert(s.b == 554); + assert(s.c == 555); + assert(s.d == 556); +} + +// System V x86_64 ABI: +// a, b, c, d, e, f should be in registers +// s should be byval pointer on the stack +// +// Win64 ABI: +// a, b, c, d should be in registers +// e, f should be on the stack +// s should be byval pointer on the stack +void byval_many_rect(int32_t a, int32_t b, int32_t c, int32_t d, int32_t e, + int32_t f, struct Rect s) { + assert(a == 1); + assert(b == 2); + assert(c == 3); + assert(d == 4); + assert(e == 5); + assert(f == 6); + assert(s.a == 553); + assert(s.b == 554); + assert(s.c == 555); + assert(s.d == 556); +} + +// System V x86_64 ABI: +// a, b, c, d, e, f, g should be in sse registers +// s should be split across 2 registers +// t should be byval pointer +// +// Win64 ABI: +// a, b, c, d should be in sse registers +// e, f, g should be on the stack +// s should be on the stack (treated as 2 i64's) +// t should be on the stack (treated as an i64 and a double) +void byval_rect_floats(float a, float b, double c, float d, float e, + float f, double g, struct Rect s, struct FloatRect t) { + assert(a == 1.); + assert(b == 2.); + assert(c == 3.); + assert(d == 4.); + assert(e == 5.); + assert(f == 6.); + assert(g == 7.); + assert(s.a == 553); + assert(s.b == 554); + assert(s.c == 555); + assert(s.d == 556); + assert(t.a == 3489); + assert(t.b == 3490); + assert(t.c == 8.); +} + +// System V x86_64 ABI: +// a, b, d, e, f should be in registers +// c passed via sse registers +// s should be byval pointer +// +// Win64 ABI: +// a, b, d should be in registers +// c passed via sse registers +// e, f should be on the stack +// s should be byval pointer +void byval_rect_with_float(int32_t a, int32_t b, float c, int32_t d, + int32_t e, int32_t f, struct Rect s) { + assert(a == 1); + assert(b == 2); + assert(c == 3.); + assert(d == 4); + assert(e == 5); + assert(f == 6); + assert(s.a == 553); + assert(s.b == 554); + assert(s.c == 555); + assert(s.d == 556); +} + +// System V x86_64 ABI: +// a, b, d, e, f should be byval pointer (on the stack) +// g passed via register (fixes #41375) +// +// Win64 ABI: +// a, b, d, e, f, g should be byval pointer +void byval_rect_with_many_huge(struct Huge a, struct Huge b, struct Huge c, + struct Huge d, struct Huge e, struct Huge f, + struct Rect g) { + assert(g.a == 123); + assert(g.b == 456); + assert(g.c == 789); + assert(g.d == 420); +} + +// System V x86_64 & Win64 ABI: +// a, b should be in registers +// s should be split across 2 integer registers +void split_rect(int32_t a, int32_t b, struct Rect s) { + assert(a == 1); + assert(b == 2); + assert(s.a == 553); + assert(s.b == 554); + assert(s.c == 555); + assert(s.d == 556); +} + +// System V x86_64 & Win64 ABI: +// a, b should be in sse registers +// s should be split across integer & sse registers +void split_rect_floats(float a, float b, struct FloatRect s) { + assert(a == 1.); + assert(b == 2.); + assert(s.a == 3489); + assert(s.b == 3490); + assert(s.c == 8.); +} + +// System V x86_64 ABI: +// a, b, d, f should be in registers +// c, e passed via sse registers +// s should be split across 2 registers +// +// Win64 ABI: +// a, b, d should be in registers +// c passed via sse registers +// e, f should be on the stack +// s should be on the stack (treated as 2 i64's) +void split_rect_with_floats(int32_t a, int32_t b, float c, + int32_t d, float e, int32_t f, struct Rect s) { + assert(a == 1); + assert(b == 2); + assert(c == 3.); + assert(d == 4); + assert(e == 5.); + assert(f == 6); + assert(s.a == 553); + assert(s.b == 554); + assert(s.c == 555); + assert(s.d == 556); +} + +// System V x86_64 & Win64 ABI: +// a, b, c should be in registers +// s should be split across 2 registers +// t should be a byval pointer +void split_and_byval_rect(int32_t a, int32_t b, int32_t c, struct Rect s, struct Rect t) { + assert(a == 1); + assert(b == 2); + assert(c == 3); + assert(s.a == 553); + assert(s.b == 554); + assert(s.c == 555); + assert(s.d == 556); + assert(t.a == 553); + assert(t.b == 554); + assert(t.c == 555); + assert(t.d == 556); +} + +// System V x86_64 & Win64 ABI: +// a, b should in registers +// s and return should be split across 2 registers +struct Rect split_ret_byval_struct(int32_t a, int32_t b, struct Rect s) { + assert(a == 1); + assert(b == 2); + assert(s.a == 553); + assert(s.b == 554); + assert(s.c == 555); + assert(s.d == 556); + return s; +} + +// System V x86_64 & Win64 ABI: +// a, b, c, d should be in registers +// return should be in a hidden sret pointer +// s should be a byval pointer +struct BiggerRect sret_byval_struct(int32_t a, int32_t b, int32_t c, int32_t d, struct Rect s) { + assert(a == 1); + assert(b == 2); + assert(c == 3); + assert(d == 4); + assert(s.a == 553); + assert(s.b == 554); + assert(s.c == 555); + assert(s.d == 556); + + struct BiggerRect t; + t.s = s; t.a = 27834; t.b = 7657; + return t; +} + +// System V x86_64 & Win64 ABI: +// a, b should be in registers +// return should be in a hidden sret pointer +// s should be split across 2 registers +struct BiggerRect sret_split_struct(int32_t a, int32_t b, struct Rect s) { + assert(a == 1); + assert(b == 2); + assert(s.a == 553); + assert(s.b == 554); + assert(s.c == 555); + assert(s.d == 556); + + struct BiggerRect t; + t.s = s; t.a = 27834; t.b = 7657; + return t; +} + +// System V x86_64 & Win64 ABI: +// s should be byval pointer (since sizeof(s) > 16) +// return should in a hidden sret pointer +struct Huge huge_struct(struct Huge s) { + assert(s.a == 5647); + assert(s.b == 5648); + assert(s.c == 5649); + assert(s.d == 5650); + assert(s.e == 5651); + + return s; +} + +// System V x86_64 ABI: +// p should be in registers +// return should be in registers +// +// Win64 ABI and 64-bit PowerPC ELFv1 ABI: +// p should be a byval pointer +// return should be in a hidden sret pointer +struct FloatPoint float_point(struct FloatPoint p) { + assert(p.x == 5.); + assert(p.y == -3.); + + return p; +} + +// 64-bit PowerPC ELFv1 ABI: +// f1 should be in a register +// return should be in a hidden sret pointer +struct FloatOne float_one(struct FloatOne f1) { + assert(f1.x == 7.); + + return f1; +} + +// 64-bit PowerPC ELFv1 ABI: +// i should be in the least-significant bits of a register +// return should be in a hidden sret pointer +struct IntOdd int_odd(struct IntOdd i) { + assert(i.a == 1); + assert(i.b == 2); + assert(i.c == 3); + + return i; +} diff --git a/tests/run-make/extern-fn-struct-passing-abi/test.rs b/tests/run-make/extern-fn-struct-passing-abi/test.rs new file mode 100644 index 000000000..afe0f52ef --- /dev/null +++ b/tests/run-make/extern-fn-struct-passing-abi/test.rs @@ -0,0 +1,138 @@ +// Passing structs via FFI should work regardless of whether +// they get passed in multiple registers, byval pointers or the stack + +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(C)] +struct Rect { + a: i32, + b: i32, + c: i32, + d: i32, +} + +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(C)] +struct BiggerRect { + s: Rect, + a: i32, + b: i32, +} + +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(C)] +struct FloatRect { + a: i32, + b: i32, + c: f64, +} + +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(C)] +struct Huge { + a: i32, + b: i32, + c: i32, + d: i32, + e: i32, +} + +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(C)] +struct FloatPoint { + x: f64, + y: f64, +} + +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(C)] +struct FloatOne { + x: f64, +} + +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(C)] +struct IntOdd { + a: i8, + b: i8, + c: i8, +} + +#[link(name = "test", kind = "static")] +extern "C" { + fn byval_rect(a: i32, b: i32, c: i32, d: i32, e: i32, s: Rect); + + fn byval_many_rect(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32, s: Rect); + + fn byval_rect_floats( + a: f32, + b: f32, + c: f64, + d: f32, + e: f32, + f: f32, + g: f64, + s: Rect, + t: FloatRect, + ); + + fn byval_rect_with_float(a: i32, b: i32, c: f32, d: i32, e: i32, f: i32, s: Rect); + + fn byval_rect_with_many_huge(a: Huge, b: Huge, c: Huge, d: Huge, e: Huge, f: Huge, g: Rect); + + fn split_rect(a: i32, b: i32, s: Rect); + + fn split_rect_floats(a: f32, b: f32, s: FloatRect); + + fn split_rect_with_floats(a: i32, b: i32, c: f32, d: i32, e: f32, f: i32, s: Rect); + + fn split_and_byval_rect(a: i32, b: i32, c: i32, s: Rect, t: Rect); + + fn split_ret_byval_struct(a: i32, b: i32, s: Rect) -> Rect; + + fn sret_byval_struct(a: i32, b: i32, c: i32, d: i32, s: Rect) -> BiggerRect; + + fn sret_split_struct(a: i32, b: i32, s: Rect) -> BiggerRect; + + fn huge_struct(s: Huge) -> Huge; + + fn float_point(p: FloatPoint) -> FloatPoint; + + fn float_one(f: FloatOne) -> FloatOne; + + fn int_odd(i: IntOdd) -> IntOdd; +} + +fn main() { + let s = Rect { a: 553, b: 554, c: 555, d: 556 }; + let t = BiggerRect { s: s, a: 27834, b: 7657 }; + let u = FloatRect { a: 3489, b: 3490, c: 8. }; + let v = Huge { a: 5647, b: 5648, c: 5649, d: 5650, e: 5651 }; + let p = FloatPoint { x: 5., y: -3. }; + let f1 = FloatOne { x: 7. }; + let i = IntOdd { a: 1, b: 2, c: 3 }; + + unsafe { + byval_rect(1, 2, 3, 4, 5, s); + byval_many_rect(1, 2, 3, 4, 5, 6, s); + byval_rect_floats(1., 2., 3., 4., 5., 6., 7., s, u); + byval_rect_with_float(1, 2, 3.0, 4, 5, 6, s); + byval_rect_with_many_huge(v, v, v, v, v, v, Rect { a: 123, b: 456, c: 789, d: 420 }); + split_rect(1, 2, s); + split_rect_floats(1., 2., u); + split_rect_with_floats(1, 2, 3.0, 4, 5.0, 6, s); + split_and_byval_rect(1, 2, 3, s, s); + split_rect(1, 2, s); + assert_eq!(huge_struct(v), v); + assert_eq!(split_ret_byval_struct(1, 2, s), s); + assert_eq!(sret_byval_struct(1, 2, 3, 4, s), t); + assert_eq!(sret_split_struct(1, 2, s), t); + assert_eq!(float_point(p), p); + assert_eq!(int_odd(i), i); + + // MSVC/GCC/Clang are not consistent in the ABI of single-float aggregates. + // x86_64: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82028 + // i686: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82041 + #[cfg(not(all(windows, target_env = "gnu")))] + assert_eq!(float_one(f1), f1); + } +} diff --git a/tests/run-make/extern-fn-with-extern-types/Makefile b/tests/run-make/extern-fn-with-extern-types/Makefile new file mode 100644 index 000000000..07ec503aa --- /dev/null +++ b/tests/run-make/extern-fn-with-extern-types/Makefile @@ -0,0 +1,6 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(call NATIVE_STATICLIB,ctest) + $(RUSTC) test.rs + $(call RUN,test) || exit 1 diff --git a/tests/run-make/extern-fn-with-extern-types/ctest.c b/tests/run-make/extern-fn-with-extern-types/ctest.c new file mode 100644 index 000000000..3b6fb4cfc --- /dev/null +++ b/tests/run-make/extern-fn-with-extern-types/ctest.c @@ -0,0 +1,16 @@ +#include +#include + +typedef struct data { + uint32_t magic; +} data; + +data* data_create(uint32_t magic) { + static data d; + d.magic = magic; + return &d; +} + +uint32_t data_get(data* p) { + return p->magic; +} diff --git a/tests/run-make/extern-fn-with-extern-types/test.rs b/tests/run-make/extern-fn-with-extern-types/test.rs new file mode 100644 index 000000000..90a6ebaf1 --- /dev/null +++ b/tests/run-make/extern-fn-with-extern-types/test.rs @@ -0,0 +1,17 @@ +#![feature(extern_types)] + +#[link(name = "ctest", kind = "static")] +extern "C" { + type data; + + fn data_create(magic: u32) -> *mut data; + fn data_get(data: *mut data) -> u32; +} + +const MAGIC: u32 = 0xdeadbeef; +fn main() { + unsafe { + let data = data_create(MAGIC); + assert_eq!(data_get(data), MAGIC); + } +} diff --git a/tests/run-make/extern-fn-with-packed-struct/Makefile b/tests/run-make/extern-fn-with-packed-struct/Makefile new file mode 100644 index 000000000..3cbbf3839 --- /dev/null +++ b/tests/run-make/extern-fn-with-packed-struct/Makefile @@ -0,0 +1,6 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(call NATIVE_STATICLIB,test) + $(RUSTC) test.rs + $(call RUN,test) || exit 1 diff --git a/tests/run-make/extern-fn-with-packed-struct/test.c b/tests/run-make/extern-fn-with-packed-struct/test.c new file mode 100644 index 000000000..c89f8272b --- /dev/null +++ b/tests/run-make/extern-fn-with-packed-struct/test.c @@ -0,0 +1,26 @@ +// Pragma needed cause of gcc bug on windows: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991 + +#include + +#ifdef _MSC_VER +#pragma pack(push,1) +struct Foo { + char a; + short b; + char c; +}; +#else +#pragma pack(1) +struct __attribute__((packed)) Foo { + char a; + short b; + char c; +}; +#endif + +struct Foo foo(struct Foo foo) { + assert(foo.a == 1); + assert(foo.b == 2); + assert(foo.c == 3); + return foo; +} diff --git a/tests/run-make/extern-fn-with-packed-struct/test.rs b/tests/run-make/extern-fn-with-packed-struct/test.rs new file mode 100644 index 000000000..2f261efb5 --- /dev/null +++ b/tests/run-make/extern-fn-with-packed-struct/test.rs @@ -0,0 +1,20 @@ +#[repr(C, packed)] +#[derive(Copy, Clone, Debug, PartialEq)] +struct Foo { + a: i8, + b: i16, + c: i8, +} + +#[link(name = "test", kind = "static")] +extern "C" { + fn foo(f: Foo) -> Foo; +} + +fn main() { + unsafe { + let a = Foo { a: 1, b: 2, c: 3 }; + let b = foo(a); + assert_eq!(a, b); + } +} diff --git a/tests/run-make/extern-fn-with-union/Makefile b/tests/run-make/extern-fn-with-union/Makefile new file mode 100644 index 000000000..e6c8c9936 --- /dev/null +++ b/tests/run-make/extern-fn-with-union/Makefile @@ -0,0 +1,7 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(call NATIVE_STATICLIB,ctest) + $(RUSTC) testcrate.rs + $(RUSTC) test.rs + $(call RUN,test) || exit 1 diff --git a/tests/run-make/extern-fn-with-union/ctest.c b/tests/run-make/extern-fn-with-union/ctest.c new file mode 100644 index 000000000..86cb64537 --- /dev/null +++ b/tests/run-make/extern-fn-with-union/ctest.c @@ -0,0 +1,10 @@ +#include +#include + +typedef union TestUnion { + uint64_t bits; +} TestUnion; + +uint64_t give_back(TestUnion tu) { + return tu.bits; +} diff --git a/tests/run-make/extern-fn-with-union/test.rs b/tests/run-make/extern-fn-with-union/test.rs new file mode 100644 index 000000000..438fbddf3 --- /dev/null +++ b/tests/run-make/extern-fn-with-union/test.rs @@ -0,0 +1,19 @@ +extern crate testcrate; + +use std::mem; + +extern "C" { + fn give_back(tu: testcrate::TestUnion) -> u64; +} + +fn main() { + let magic: u64 = 0xDEADBEEF; + + // Let's test calling it cross crate + let back = unsafe { testcrate::give_back(mem::transmute(magic)) }; + assert_eq!(magic, back); + + // And just within this crate + let back = unsafe { give_back(mem::transmute(magic)) }; + assert_eq!(magic, back); +} diff --git a/tests/run-make/extern-fn-with-union/testcrate.rs b/tests/run-make/extern-fn-with-union/testcrate.rs new file mode 100644 index 000000000..28d91ff37 --- /dev/null +++ b/tests/run-make/extern-fn-with-union/testcrate.rs @@ -0,0 +1,11 @@ +#![crate_type = "lib"] + +#[repr(C)] +pub struct TestUnion { + _val: u64, +} + +#[link(name = "ctest", kind = "static")] +extern "C" { + pub fn give_back(tu: TestUnion) -> u64; +} diff --git a/tests/run-make/extern-multiple-copies/Makefile b/tests/run-make/extern-multiple-copies/Makefile new file mode 100644 index 000000000..b0b84278e --- /dev/null +++ b/tests/run-make/extern-multiple-copies/Makefile @@ -0,0 +1,9 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) foo1.rs + $(RUSTC) foo2.rs + mkdir $(TMPDIR)/foo + cp $(TMPDIR)/libfoo1.rlib $(TMPDIR)/foo/libfoo1.rlib + $(RUSTC) bar.rs --extern foo1=$(TMPDIR)/libfoo1.rlib -L $(TMPDIR)/foo diff --git a/tests/run-make/extern-multiple-copies/bar.rs b/tests/run-make/extern-multiple-copies/bar.rs new file mode 100644 index 000000000..c6b3595f6 --- /dev/null +++ b/tests/run-make/extern-multiple-copies/bar.rs @@ -0,0 +1,6 @@ +extern crate foo2; // foo2 first to exhibit the bug +extern crate foo1; + +fn main() { + /* ... */ +} diff --git a/tests/run-make/extern-multiple-copies/foo1.rs b/tests/run-make/extern-multiple-copies/foo1.rs new file mode 100644 index 000000000..c1bfaa6ca --- /dev/null +++ b/tests/run-make/extern-multiple-copies/foo1.rs @@ -0,0 +1 @@ +#![crate_type = "rlib"] diff --git a/tests/run-make/extern-multiple-copies/foo2.rs b/tests/run-make/extern-multiple-copies/foo2.rs new file mode 100644 index 000000000..c1bfaa6ca --- /dev/null +++ b/tests/run-make/extern-multiple-copies/foo2.rs @@ -0,0 +1 @@ +#![crate_type = "rlib"] diff --git a/tests/run-make/extern-multiple-copies2/Makefile b/tests/run-make/extern-multiple-copies2/Makefile new file mode 100644 index 000000000..708b1c1b5 --- /dev/null +++ b/tests/run-make/extern-multiple-copies2/Makefile @@ -0,0 +1,11 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) foo1.rs + $(RUSTC) foo2.rs + mkdir $(TMPDIR)/foo + cp $(TMPDIR)/libfoo1.rlib $(TMPDIR)/foo/libfoo1.rlib + $(RUSTC) bar.rs \ + --extern foo1=$(TMPDIR)/foo/libfoo1.rlib \ + --extern foo2=$(TMPDIR)/libfoo2.rlib diff --git a/tests/run-make/extern-multiple-copies2/bar.rs b/tests/run-make/extern-multiple-copies2/bar.rs new file mode 100644 index 000000000..b3088152d --- /dev/null +++ b/tests/run-make/extern-multiple-copies2/bar.rs @@ -0,0 +1,8 @@ +#[macro_use] +extern crate foo2; // foo2 first to exhibit the bug +#[macro_use] +extern crate foo1; + +fn main() { + foo2::foo2(foo1::A); +} diff --git a/tests/run-make/extern-multiple-copies2/foo1.rs b/tests/run-make/extern-multiple-copies2/foo1.rs new file mode 100644 index 000000000..4c778e52f --- /dev/null +++ b/tests/run-make/extern-multiple-copies2/foo1.rs @@ -0,0 +1,7 @@ +#![crate_type = "rlib"] + +pub struct A; + +pub fn foo1(a: A) { + drop(a); +} diff --git a/tests/run-make/extern-multiple-copies2/foo2.rs b/tests/run-make/extern-multiple-copies2/foo2.rs new file mode 100644 index 000000000..2be103507 --- /dev/null +++ b/tests/run-make/extern-multiple-copies2/foo2.rs @@ -0,0 +1,8 @@ +#![crate_type = "rlib"] + +#[macro_use] +extern crate foo1; + +pub fn foo2(a: foo1::A) { + foo1::foo1(a); +} diff --git a/tests/run-make/extern-overrides-distribution/Makefile b/tests/run-make/extern-overrides-distribution/Makefile new file mode 100644 index 000000000..bfd0dd699 --- /dev/null +++ b/tests/run-make/extern-overrides-distribution/Makefile @@ -0,0 +1,6 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) libc.rs -Cmetadata=foo + $(RUSTC) main.rs --extern libc=$(TMPDIR)/liblibc.rlib diff --git a/tests/run-make/extern-overrides-distribution/libc.rs b/tests/run-make/extern-overrides-distribution/libc.rs new file mode 100644 index 000000000..ee51ae328 --- /dev/null +++ b/tests/run-make/extern-overrides-distribution/libc.rs @@ -0,0 +1,3 @@ +#![crate_type = "lib"] + +pub fn foo() {} diff --git a/tests/run-make/extern-overrides-distribution/main.rs b/tests/run-make/extern-overrides-distribution/main.rs new file mode 100644 index 000000000..1290a8c56 --- /dev/null +++ b/tests/run-make/extern-overrides-distribution/main.rs @@ -0,0 +1,5 @@ +extern crate libc; + +fn main() { + libc::foo(); +} diff --git a/tests/run-make/extra-filename-with-temp-outputs/Makefile b/tests/run-make/extra-filename-with-temp-outputs/Makefile new file mode 100644 index 000000000..64745bef5 --- /dev/null +++ b/tests/run-make/extra-filename-with-temp-outputs/Makefile @@ -0,0 +1,7 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) -C extra-filename=bar foo.rs -C save-temps + rm $(TMPDIR)/foobar.foo*0.rcgu.o + rm $(TMPDIR)/$(call BIN,foobar) diff --git a/tests/run-make/extra-filename-with-temp-outputs/foo.rs b/tests/run-make/extra-filename-with-temp-outputs/foo.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/tests/run-make/extra-filename-with-temp-outputs/foo.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/fmt-write-bloat/Makefile b/tests/run-make/fmt-write-bloat/Makefile index 07e6e025e..70e04b9af 100644 --- a/tests/run-make/fmt-write-bloat/Makefile +++ b/tests/run-make/fmt-write-bloat/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # ignore-windows @@ -11,11 +11,11 @@ else NM = nm -PANIC_SYMS = panic_bounds_check pad_integral Display Debug +PANIC_SYMS = panic_bounds_check Debug # Allow for debug_assert!() in debug builds of std. ifdef NO_DEBUG_ASSERTIONS -PANIC_SYMS += panicking panic_fmt +PANIC_SYMS += panicking panic_fmt pad_integral Display Debug endif all: main.rs diff --git a/tests/run-make/foreign-double-unwind/Makefile b/tests/run-make/foreign-double-unwind/Makefile new file mode 100644 index 000000000..f20fe3ce6 --- /dev/null +++ b/tests/run-make/foreign-double-unwind/Makefile @@ -0,0 +1,11 @@ +# ignore-cross-compile +include ../tools.mk + +all: foo + $(call RUN,foo) | $(CGREP) -v unreachable + +foo: foo.rs $(call NATIVE_STATICLIB,foo) + $(RUSTC) $< -lfoo $(EXTRARSCXXFLAGS) + +$(TMPDIR)/libfoo.o: foo.cpp + $(call COMPILE_OBJ_CXX,$@,$<) diff --git a/tests/run-make/foreign-double-unwind/foo.cpp b/tests/run-make/foreign-double-unwind/foo.cpp new file mode 100644 index 000000000..69a8f11c2 --- /dev/null +++ b/tests/run-make/foreign-double-unwind/foo.cpp @@ -0,0 +1,33 @@ +#include +#include + +void println(const char* s) { + puts(s); + fflush(stdout); +} + +struct outer_exception {}; +struct inner_exception {}; + +extern "C" { + void throw_cxx_exception() { + if (std::uncaught_exception()) { + println("throwing inner C++ exception"); + throw inner_exception(); + } else { + println("throwing outer C++ exception"); + throw outer_exception(); + } + } + + void cxx_catch_callback(void (*cb)()) { + try { + cb(); + println("unreachable: callback returns"); + } catch (outer_exception) { + println("unreachable: caught outer exception in catch (...)"); + } catch (inner_exception) { + println("unreachable: caught inner exception in catch (...)"); + } + } +} diff --git a/tests/run-make/foreign-double-unwind/foo.rs b/tests/run-make/foreign-double-unwind/foo.rs new file mode 100644 index 000000000..cae8aa940 --- /dev/null +++ b/tests/run-make/foreign-double-unwind/foo.rs @@ -0,0 +1,26 @@ +// 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()); +} + +struct ThrowOnDrop; + +impl Drop for ThrowOnDrop { + fn drop(&mut self) { + unsafe { throw_cxx_exception() }; + } +} + +extern "C-unwind" fn test_double_unwind() { + let _a = ThrowOnDrop; + let _b = ThrowOnDrop; +} + +fn main() { + unsafe { cxx_catch_callback(test_double_unwind) }; +} diff --git a/tests/run-make/foreign-exceptions/Makefile b/tests/run-make/foreign-exceptions/Makefile new file mode 100644 index 000000000..a8e20ffb1 --- /dev/null +++ b/tests/run-make/foreign-exceptions/Makefile @@ -0,0 +1,11 @@ +# ignore-cross-compile +include ../tools.mk + +all: foo + $(call RUN,foo) + +foo: foo.rs $(call NATIVE_STATICLIB,foo) + $(RUSTC) $< -lfoo $(EXTRARSCXXFLAGS) + +$(TMPDIR)/libfoo.o: foo.cpp + $(call COMPILE_OBJ_CXX,$@,$<) diff --git a/tests/run-make/foreign-exceptions/foo.cpp b/tests/run-make/foreign-exceptions/foo.cpp new file mode 100644 index 000000000..8182021a2 --- /dev/null +++ b/tests/run-make/foreign-exceptions/foo.cpp @@ -0,0 +1,60 @@ +#include +#include +#include + +void println(const char* s) { + puts(s); + fflush(stdout); +} + +struct exception {}; +struct rust_panic {}; + +struct drop_check { + bool* ok; + ~drop_check() { + println("~drop_check"); + + if (ok) + *ok = true; + } +}; + +extern "C" { + void rust_catch_callback(void (*cb)(), bool* rust_ok); + + void throw_cxx_exception() { + println("throwing C++ exception"); + throw exception(); + } + + void test_cxx_exception() { + bool rust_ok = false; + try { + rust_catch_callback(throw_cxx_exception, &rust_ok); + assert(false && "unreachable"); + } catch (exception e) { + println("caught C++ exception"); + assert(rust_ok); + return; + } + assert(false && "did not catch thrown C++ exception"); + } + + void cxx_catch_callback(void (*cb)(), bool* cxx_ok) { + drop_check x; + x.ok = NULL; + try { + cb(); + } catch (rust_panic e) { + assert(false && "shouldn't be able to catch a rust panic"); + } catch (...) { + println("caught foreign exception in catch (...)"); + // Foreign exceptions are caught by catch (...). We only set the ok + // flag if we successfully caught the panic. The destructor of + // drop_check will then set the flag to true if it is executed. + x.ok = cxx_ok; + throw; + } + } +} diff --git a/tests/run-make/foreign-exceptions/foo.rs b/tests/run-make/foreign-exceptions/foo.rs new file mode 100644 index 000000000..dd3b7c76f --- /dev/null +++ b/tests/run-make/foreign-exceptions/foo.rs @@ -0,0 +1,59 @@ +// Tests that C++ exceptions can unwind through Rust code run destructors and +// 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); +impl<'a> Drop for DropCheck<'a> { + fn drop(&mut self) { + println!("DropCheck::drop"); + *self.0 = true; + } +} + +extern "C" { + fn test_cxx_exception(); +} + +extern "C-unwind" { + fn cxx_catch_callback(cb: extern "C-unwind" fn(), ok: *mut bool); +} + +#[no_mangle] +extern "C-unwind" fn rust_catch_callback(cb: extern "C-unwind" fn(), rust_ok: &mut bool) { + let _drop = DropCheck(rust_ok); + cb(); + unreachable!("should have unwound instead of returned"); +} + +fn test_rust_panic() { + extern "C-unwind" fn callback() { + println!("throwing rust panic"); + panic!(1234i32); + } + + let mut dropped = false; + let mut cxx_ok = false; + let caught_unwind = catch_unwind(AssertUnwindSafe(|| { + let _drop = DropCheck(&mut dropped); + unsafe { + cxx_catch_callback(callback, &mut cxx_ok); + } + unreachable!("should have unwound instead of returned"); + })); + println!("caught rust panic"); + assert!(dropped); + assert!(caught_unwind.is_err()); + let panic_obj = caught_unwind.unwrap_err(); + let panic_int = *panic_obj.downcast_ref::().unwrap(); + assert_eq!(panic_int, 1234); + assert!(cxx_ok); +} + +fn main() { + unsafe { test_cxx_exception() }; + test_rust_panic(); +} diff --git a/tests/run-make/foreign-rust-exceptions/Makefile b/tests/run-make/foreign-rust-exceptions/Makefile new file mode 100644 index 000000000..0d007bf1c --- /dev/null +++ b/tests/run-make/foreign-rust-exceptions/Makefile @@ -0,0 +1,12 @@ +# ignore-cross-compile +# ignore-i686-pc-windows-gnu + +# This test doesn't work on 32-bit MinGW as cdylib has its own copy of unwinder +# so cross-DLL unwinding does not work. + +include ../tools.mk + +all: + $(RUSTC) bar.rs --crate-type=cdylib + $(RUSTC) foo.rs + $(call RUN,foo) 2>&1 | $(CGREP) "Rust cannot catch foreign exceptions" diff --git a/tests/run-make/foreign-rust-exceptions/bar.rs b/tests/run-make/foreign-rust-exceptions/bar.rs new file mode 100644 index 000000000..5f9efe323 --- /dev/null +++ b/tests/run-make/foreign-rust-exceptions/bar.rs @@ -0,0 +1,7 @@ +#![crate_type = "cdylib"] +#![feature(c_unwind)] + +#[no_mangle] +extern "C-unwind" fn panic() { + panic!(); +} diff --git a/tests/run-make/foreign-rust-exceptions/foo.rs b/tests/run-make/foreign-rust-exceptions/foo.rs new file mode 100644 index 000000000..266987c5b --- /dev/null +++ b/tests/run-make/foreign-rust-exceptions/foo.rs @@ -0,0 +1,13 @@ +#![feature(c_unwind)] + +#[cfg_attr(not(windows), link(name = "bar"))] +#[cfg_attr(windows, link(name = "bar.dll"))] +extern "C-unwind" { + fn panic(); +} + +fn main() { + let _ = std::panic::catch_unwind(|| { + unsafe { panic() }; + }); +} diff --git a/tests/run-make/fpic/Makefile b/tests/run-make/fpic/Makefile new file mode 100644 index 000000000..c38dd8d6e --- /dev/null +++ b/tests/run-make/fpic/Makefile @@ -0,0 +1,11 @@ +# ignore-cross-compile +include ../tools.mk + +# ignore-windows +# ignore-macos + +# Test for #39529. +# `-z text` causes ld to error if there are any non-PIC sections + +all: + $(RUSTC) hello.rs -C link-args=-Wl,-z,text diff --git a/tests/run-make/fpic/hello.rs b/tests/run-make/fpic/hello.rs new file mode 100644 index 000000000..45590d86b --- /dev/null +++ b/tests/run-make/fpic/hello.rs @@ -0,0 +1 @@ +fn main() { } diff --git a/tests/run-make/glibc-staticlib-args/Makefile b/tests/run-make/glibc-staticlib-args/Makefile new file mode 100644 index 000000000..cad6c049e --- /dev/null +++ b/tests/run-make/glibc-staticlib-args/Makefile @@ -0,0 +1,13 @@ +# ignore-cross-compile +# only-gnu +# only-linux + +include ../tools.mk + +# This ensures that std::env::args works in a library called from C on glibc Linux. + +all: + $(RUSTC) --crate-type=staticlib library.rs + $(CC) program.c $(call STATICLIB,library) $(call OUT_EXE,program) \ + $(EXTRACFLAGS) $(EXTRACXXFLAGS) + $(call RUN,program) diff --git a/tests/run-make/glibc-staticlib-args/library.rs b/tests/run-make/glibc-staticlib-args/library.rs new file mode 100644 index 000000000..5ab627a2a --- /dev/null +++ b/tests/run-make/glibc-staticlib-args/library.rs @@ -0,0 +1,4 @@ +#[no_mangle] +pub extern "C" fn args_check() { + assert_ne!(std::env::args_os().count(), 0); +} diff --git a/tests/run-make/glibc-staticlib-args/program.c b/tests/run-make/glibc-staticlib-args/program.c new file mode 100644 index 000000000..30f6974b7 --- /dev/null +++ b/tests/run-make/glibc-staticlib-args/program.c @@ -0,0 +1,6 @@ +void args_check(); + +int main() { + args_check(); + return 0; +} diff --git a/tests/run-make/hir-tree/Makefile b/tests/run-make/hir-tree/Makefile new file mode 100644 index 000000000..b0450ea4b --- /dev/null +++ b/tests/run-make/hir-tree/Makefile @@ -0,0 +1,8 @@ +include ../tools.mk + +# Test that hir-tree output doesn't crash and includes +# the string constant we would expect to see. + +all: + $(RUSTC) -o $(TMPDIR)/input.hir -Z unpretty=hir-tree input.rs + $(CGREP) '"Hello, Rustaceans!\n"' < $(TMPDIR)/input.hir diff --git a/tests/run-make/hir-tree/input.rs b/tests/run-make/hir-tree/input.rs new file mode 100644 index 000000000..9d1a4e9e4 --- /dev/null +++ b/tests/run-make/hir-tree/input.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, Rustaceans!"); +} diff --git a/tests/run-make/include_bytes_deps/Makefile b/tests/run-make/include_bytes_deps/Makefile new file mode 100644 index 000000000..696dfd207 --- /dev/null +++ b/tests/run-make/include_bytes_deps/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +# ignore-freebsd + +all: + $(RUSTC) --emit dep-info main.rs + $(CGREP) "input.txt" "input.bin" "input.md" < $(TMPDIR)/main.d diff --git a/tests/run-make/include_bytes_deps/input.bin b/tests/run-make/include_bytes_deps/input.bin new file mode 100644 index 000000000..cd0875583 --- /dev/null +++ b/tests/run-make/include_bytes_deps/input.bin @@ -0,0 +1 @@ +Hello world! diff --git a/tests/run-make/include_bytes_deps/input.md b/tests/run-make/include_bytes_deps/input.md new file mode 100644 index 000000000..2a19b7405 --- /dev/null +++ b/tests/run-make/include_bytes_deps/input.md @@ -0,0 +1 @@ +# Hello, world! diff --git a/tests/run-make/include_bytes_deps/input.txt b/tests/run-make/include_bytes_deps/input.txt new file mode 100644 index 000000000..cd0875583 --- /dev/null +++ b/tests/run-make/include_bytes_deps/input.txt @@ -0,0 +1 @@ +Hello world! diff --git a/tests/run-make/include_bytes_deps/main.rs b/tests/run-make/include_bytes_deps/main.rs new file mode 100644 index 000000000..2fd55699d --- /dev/null +++ b/tests/run-make/include_bytes_deps/main.rs @@ -0,0 +1,10 @@ +#[doc = include_str!("input.md")] +pub struct SomeStruct; + +pub fn main() { + const INPUT_TXT: &'static str = include_str!("input.txt"); + const INPUT_BIN: &'static [u8] = include_bytes!("input.bin"); + + println!("{}", INPUT_TXT); + println!("{:?}", INPUT_BIN); +} diff --git a/tests/run-make/incr-add-rust-src-component/Makefile b/tests/run-make/incr-add-rust-src-component/Makefile new file mode 100644 index 000000000..fd09c2299 --- /dev/null +++ b/tests/run-make/incr-add-rust-src-component/Makefile @@ -0,0 +1,45 @@ +# ignore-cross-compile +include ../tools.mk + +# rust-lang/rust#70924: Test that if we add rust-src component in between two +# incremental compiles, the compiler does not ICE on the second. + +# This test uses `ln -s` rather than copying to save testing time, but its +# usage doesn't work on windows. So ignore windows. + +# ignore-windows + +SYSROOT:=$(shell $(RUSTC) --print sysroot) +FAKEROOT=$(TMPDIR)/fakeroot +INCR=$(TMPDIR)/incr + +# Make a local copy of the sysroot; then remove the rust-src part of it, if +# present, for the *first* build. Then put in a facsimile of the rust-src +# component for the second build, in order to expose the ICE from issue #70924. +# +# Note that it is much easier to just do `cp -a $(SYSROOT)/* $(FAKEROOT)` as a +# first step, but I am concerned that would be too expensive in a unit test +# compared to making symbolic links. +# +# Anyway, the pattern you'll see here is: For every prefix in +# root/lib/rustlib/src, link all of prefix parent content, then remove the +# prefix, then loop on the next prefix. This way, we basically create a copy of +# the context around root/lib/rustlib/src, and can freely add/remove the src +# component itself. +all: + mkdir $(FAKEROOT) + ln -s $(SYSROOT)/* $(FAKEROOT) + rm -f $(FAKEROOT)/lib + mkdir $(FAKEROOT)/lib + ln -s $(SYSROOT)/lib/* $(FAKEROOT)/lib + rm -f $(FAKEROOT)/lib/rustlib + mkdir $(FAKEROOT)/lib/rustlib + ln -s $(SYSROOT)/lib/rustlib/* $(FAKEROOT)/lib/rustlib + rm -f $(FAKEROOT)/lib/rustlib/src + mkdir $(FAKEROOT)/lib/rustlib/src + ln -s $(SYSROOT)/lib/rustlib/src/* $(FAKEROOT)/lib/rustlib/src + rm -f $(FAKEROOT)/lib/rustlib/src/rust + $(RUSTC) --sysroot $(FAKEROOT) -C incremental=$(INCR) main.rs + mkdir -p $(FAKEROOT)/lib/rustlib/src/rust/src/libstd + touch $(FAKEROOT)/lib/rustlib/src/rust/src/libstd/lib.rs + $(RUSTC) --sysroot $(FAKEROOT) -C incremental=$(INCR) main.rs diff --git a/tests/run-make/incr-add-rust-src-component/main.rs b/tests/run-make/incr-add-rust-src-component/main.rs new file mode 100644 index 000000000..f6320bcb0 --- /dev/null +++ b/tests/run-make/incr-add-rust-src-component/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello World"); +} diff --git a/tests/run-make/incr-foreign-head-span/Makefile b/tests/run-make/incr-foreign-head-span/Makefile index 712965eaa..9d6102cdd 100644 --- a/tests/run-make/incr-foreign-head-span/Makefile +++ b/tests/run-make/incr-foreign-head-span/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # ignore-none no-std is not supported # ignore-nvptx64-nvidia-cuda FIXME: can't find crate for 'std' diff --git a/tests/run-make/incr-prev-body-beyond-eof/Makefile b/tests/run-make/incr-prev-body-beyond-eof/Makefile index 24eea3aca..aa47552f5 100644 --- a/tests/run-make/incr-prev-body-beyond-eof/Makefile +++ b/tests/run-make/incr-prev-body-beyond-eof/Makefile @@ -1,7 +1,7 @@ # ignore-none no-std is not supported # ignore-nvptx64-nvidia-cuda FIXME: can't find crate for `std` -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # Tests that we don't ICE during incremental compilation after modifying a # function span such that its previous end line exceeds the number of lines diff --git a/tests/run-make/incremental-session-fail/Makefile b/tests/run-make/incremental-session-fail/Makefile index 6ce137092..f43eece2e 100644 --- a/tests/run-make/incremental-session-fail/Makefile +++ b/tests/run-make/incremental-session-fail/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk SESSION_DIR := $(TMPDIR)/session OUTPUT_FILE := $(TMPDIR)/build-output diff --git a/tests/run-make/inline-always-many-cgu/Makefile b/tests/run-make/inline-always-many-cgu/Makefile new file mode 100644 index 000000000..9945821db --- /dev/null +++ b/tests/run-make/inline-always-many-cgu/Makefile @@ -0,0 +1,8 @@ +include ../tools.mk + +all: + $(RUSTC) foo.rs --emit llvm-ir -C codegen-units=2 + if cat $(TMPDIR)/*.ll | $(CGREP) -e '\bcall\b'; then \ + echo "found call instruction when one wasn't expected"; \ + exit 1; \ + fi diff --git a/tests/run-make/inline-always-many-cgu/foo.rs b/tests/run-make/inline-always-many-cgu/foo.rs new file mode 100644 index 000000000..65fe69c16 --- /dev/null +++ b/tests/run-make/inline-always-many-cgu/foo.rs @@ -0,0 +1,15 @@ +#![crate_type = "lib"] + +pub mod a { + #[inline(always)] + pub fn foo() { + } + + pub fn bar() { + } +} + +#[no_mangle] +pub fn bar() { + a::foo(); +} diff --git a/tests/run-make/interdependent-c-libraries/Makefile b/tests/run-make/interdependent-c-libraries/Makefile new file mode 100644 index 000000000..53a696d82 --- /dev/null +++ b/tests/run-make/interdependent-c-libraries/Makefile @@ -0,0 +1,15 @@ +# ignore-cross-compile +include ../tools.mk + +# The rust crate foo will link to the native library foo, while the rust crate +# bar will link to the native library bar. There is also a dependency between +# the native library bar to the natibe library foo. +# +# This test ensures that the ordering of -lfoo and -lbar on the command line is +# correct to complete the linkage. If passed as "-lfoo -lbar", then the 'foo' +# library will be stripped out, and the linkage will fail. + +all: $(call NATIVE_STATICLIB,foo) $(call NATIVE_STATICLIB,bar) + $(RUSTC) foo.rs + $(RUSTC) bar.rs + $(RUSTC) main.rs --print link-args diff --git a/tests/run-make/interdependent-c-libraries/bar.c b/tests/run-make/interdependent-c-libraries/bar.c new file mode 100644 index 000000000..812c97535 --- /dev/null +++ b/tests/run-make/interdependent-c-libraries/bar.c @@ -0,0 +1,3 @@ +void foo(); + +void bar() { foo(); } diff --git a/tests/run-make/interdependent-c-libraries/bar.rs b/tests/run-make/interdependent-c-libraries/bar.rs new file mode 100644 index 000000000..3c2c3f218 --- /dev/null +++ b/tests/run-make/interdependent-c-libraries/bar.rs @@ -0,0 +1,14 @@ +#![crate_type = "rlib"] + +extern crate foo; + +#[link(name = "bar", kind = "static")] +extern "C" { + fn bar(); +} + +pub fn doit() { + unsafe { + bar(); + } +} diff --git a/tests/run-make/interdependent-c-libraries/foo.c b/tests/run-make/interdependent-c-libraries/foo.c new file mode 100644 index 000000000..85e6cd8c3 --- /dev/null +++ b/tests/run-make/interdependent-c-libraries/foo.c @@ -0,0 +1 @@ +void foo() {} diff --git a/tests/run-make/interdependent-c-libraries/foo.rs b/tests/run-make/interdependent-c-libraries/foo.rs new file mode 100644 index 000000000..a69809726 --- /dev/null +++ b/tests/run-make/interdependent-c-libraries/foo.rs @@ -0,0 +1,12 @@ +#![crate_type = "rlib"] + +#[link(name = "foo", kind = "static")] +extern "C" { + fn foo(); +} + +pub fn doit() { + unsafe { + foo(); + } +} diff --git a/tests/run-make/interdependent-c-libraries/main.rs b/tests/run-make/interdependent-c-libraries/main.rs new file mode 100644 index 000000000..2aba427df --- /dev/null +++ b/tests/run-make/interdependent-c-libraries/main.rs @@ -0,0 +1,6 @@ +extern crate foo; +extern crate bar; + +fn main() { + bar::doit(); +} diff --git a/tests/run-make/intrinsic-unreachable/Makefile b/tests/run-make/intrinsic-unreachable/Makefile new file mode 100644 index 000000000..ff9cc5709 --- /dev/null +++ b/tests/run-make/intrinsic-unreachable/Makefile @@ -0,0 +1,12 @@ +include ../tools.mk + +# needs-asm-support +# ignore-windows-msvc +# +# Because of Windows exception handling, the code is not necessarily any shorter. +# https://github.com/llvm-mirror/llvm/commit/64b2297786f7fd6f5fa24cdd4db0298fbf211466 + +all: + $(RUSTC) -O --emit asm exit-ret.rs + $(RUSTC) -O --emit asm exit-unreachable.rs + test `wc -l < $(TMPDIR)/exit-unreachable.s` -lt `wc -l < $(TMPDIR)/exit-ret.s` diff --git a/tests/run-make/intrinsic-unreachable/exit-ret.rs b/tests/run-make/intrinsic-unreachable/exit-ret.rs new file mode 100644 index 000000000..e7b9694d9 --- /dev/null +++ b/tests/run-make/intrinsic-unreachable/exit-ret.rs @@ -0,0 +1,14 @@ +#![crate_type="lib"] +use std::arch::asm; + +#[deny(unreachable_code)] +pub fn exit(n: usize) -> i32 { + unsafe { + // Pretend this asm is an exit() syscall. + asm!("/*{0}*/", in(reg) n); + } + // This return value is just here to generate some extra code for a return + // value, making it easier for the test script to detect whether the + // compiler deleted it. + 42 +} diff --git a/tests/run-make/intrinsic-unreachable/exit-unreachable.rs b/tests/run-make/intrinsic-unreachable/exit-unreachable.rs new file mode 100644 index 000000000..ec85db733 --- /dev/null +++ b/tests/run-make/intrinsic-unreachable/exit-unreachable.rs @@ -0,0 +1,18 @@ +#![feature(core_intrinsics)] +#![crate_type="lib"] +use std::arch::asm; + +use std::intrinsics; + +#[allow(unreachable_code)] +pub fn exit(n: usize) -> i32 { + unsafe { + // Pretend this asm is an exit() syscall. + asm!("/*{0}*/", in(reg) n); + intrinsics::unreachable() + } + // This return value is just here to generate some extra code for a return + // value, making it easier for the test script to detect whether the + // compiler deleted it. + 42 +} diff --git a/tests/run-make/invalid-library/Makefile b/tests/run-make/invalid-library/Makefile new file mode 100644 index 000000000..910d9af7b --- /dev/null +++ b/tests/run-make/invalid-library/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +all: + touch $(TMPDIR)/lib.rmeta + $(AR) crus $(TMPDIR)/libfoo-ffffffff-1.0.rlib $(TMPDIR)/lib.rmeta + $(RUSTC) foo.rs 2>&1 | $(CGREP) "found invalid metadata" diff --git a/tests/run-make/invalid-library/foo.rs b/tests/run-make/invalid-library/foo.rs new file mode 100644 index 000000000..bb7b36c49 --- /dev/null +++ b/tests/run-make/invalid-library/foo.rs @@ -0,0 +1,3 @@ +extern crate foo; + +fn main() {} diff --git a/tests/run-make/invalid-so/Makefile b/tests/run-make/invalid-so/Makefile index 5b82ecd20..e36c7040b 100644 --- a/tests/run-make/invalid-so/Makefile +++ b/tests/run-make/invalid-so/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk DYLIB_NAME := $(shell echo | $(RUSTC) --crate-name foo --crate-type dylib --print file-names -) diff --git a/tests/run-make/invalid-staticlib/Makefile b/tests/run-make/invalid-staticlib/Makefile new file mode 100644 index 000000000..3f0f74ce3 --- /dev/null +++ b/tests/run-make/invalid-staticlib/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + touch $(TMPDIR)/libfoo.a + echo | $(RUSTC) - --crate-type=rlib -lstatic=foo 2>&1 | $(CGREP) "failed to add native library" diff --git a/tests/run-make/issue-10971-temps-dir/Makefile b/tests/run-make/issue-10971-temps-dir/Makefile index e589bbffe..6e1649a58 100644 --- a/tests/run-make/issue-10971-temps-dir/Makefile +++ b/tests/run-make/issue-10971-temps-dir/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # Regression test for issue #10971 # Running two invocations in parallel would overwrite each other's temp files. diff --git a/tests/run-make/issue-109934-lto-debuginfo/Makefile b/tests/run-make/issue-109934-lto-debuginfo/Makefile new file mode 100644 index 000000000..3b7a99d3d --- /dev/null +++ b/tests/run-make/issue-109934-lto-debuginfo/Makefile @@ -0,0 +1,12 @@ +# ignore-cross-compile +include ../tools.mk + +# With the upgrade to LLVM 16, this was getting: +# +# error: Cannot represent a difference across sections +# +# The error stemmed from DI function definitions under type scopes, fixed by +# only declaring in type scope and defining the subprogram elsewhere. + +all: + $(RUSTC) lib.rs --test -C lto=fat -C debuginfo=2 -C incremental=$(TMPDIR)/inc-fat diff --git a/tests/run-make/issue-109934-lto-debuginfo/lib.rs b/tests/run-make/issue-109934-lto-debuginfo/lib.rs new file mode 100644 index 000000000..c405928bd --- /dev/null +++ b/tests/run-make/issue-109934-lto-debuginfo/lib.rs @@ -0,0 +1,9 @@ +extern crate alloc; + +#[cfg(test)] +mod tests { + #[test] + fn something_alloc() { + assert_eq!(Vec::::new(), Vec::::new()); + } +} diff --git a/tests/run-make/issue-11908/Makefile b/tests/run-make/issue-11908/Makefile new file mode 100644 index 000000000..38586662f --- /dev/null +++ b/tests/run-make/issue-11908/Makefile @@ -0,0 +1,22 @@ +# ignore-cross-compile +# This test ensures that if you have the same rlib or dylib at two locations +# in the same path that you don't hit an assertion in the compiler. +# +# Note that this relies on `liburl` to be in the path somewhere else, +# and then our aux-built libraries will collide with liburl (they have +# the same version listed) + +include ../tools.mk + +all: + mkdir $(TMPDIR)/other + $(RUSTC) foo.rs --crate-type=dylib -C prefer-dynamic + mv $(call DYLIB,foo) $(TMPDIR)/other + $(RUSTC) foo.rs --crate-type=dylib -C prefer-dynamic + $(RUSTC) bar.rs -L $(TMPDIR)/other + rm -rf $(TMPDIR) + mkdir -p $(TMPDIR)/other + $(RUSTC) foo.rs --crate-type=rlib + mv $(TMPDIR)/libfoo.rlib $(TMPDIR)/other + $(RUSTC) foo.rs --crate-type=rlib + $(RUSTC) bar.rs -L $(TMPDIR)/other diff --git a/tests/run-make/issue-11908/bar.rs b/tests/run-make/issue-11908/bar.rs new file mode 100644 index 000000000..bb7b36c49 --- /dev/null +++ b/tests/run-make/issue-11908/bar.rs @@ -0,0 +1,3 @@ +extern crate foo; + +fn main() {} diff --git a/tests/run-make/issue-11908/foo.rs b/tests/run-make/issue-11908/foo.rs new file mode 100644 index 000000000..82b2dfe9f --- /dev/null +++ b/tests/run-make/issue-11908/foo.rs @@ -0,0 +1 @@ +#![crate_name = "foo"] diff --git a/tests/run-make/issue-14500/Makefile b/tests/run-make/issue-14500/Makefile new file mode 100644 index 000000000..eeab48de3 --- /dev/null +++ b/tests/run-make/issue-14500/Makefile @@ -0,0 +1,15 @@ +include ../tools.mk + +# ignore-cross-compile + +# Test to make sure that reachable extern fns are always available in final +# productcs, including when LTO is used. In this test, the `foo` crate has a +# reahable symbol, and is a dependency of the `bar` crate. When the `bar` crate +# is compiled with LTO, it shouldn't strip the symbol from `foo`, and that's the +# only way that `foo.c` will successfully compile. + +all: + $(RUSTC) foo.rs --crate-type=rlib + $(RUSTC) bar.rs --crate-type=staticlib -C lto -L. -o $(TMPDIR)/libbar.a + $(CC) foo.c $(TMPDIR)/libbar.a $(EXTRACFLAGS) $(call OUT_EXE,foo) + $(call RUN,foo) diff --git a/tests/run-make/issue-14500/bar.rs b/tests/run-make/issue-14500/bar.rs new file mode 100644 index 000000000..49af74e1b --- /dev/null +++ b/tests/run-make/issue-14500/bar.rs @@ -0,0 +1 @@ +extern crate foo; diff --git a/tests/run-make/issue-14500/foo.c b/tests/run-make/issue-14500/foo.c new file mode 100644 index 000000000..2353d400d --- /dev/null +++ b/tests/run-make/issue-14500/foo.c @@ -0,0 +1,7 @@ +extern void foo(); +extern char FOO_STATIC; + +int main() { + foo(); + return (int)FOO_STATIC; +} diff --git a/tests/run-make/issue-14500/foo.rs b/tests/run-make/issue-14500/foo.rs new file mode 100644 index 000000000..7c19c1f2c --- /dev/null +++ b/tests/run-make/issue-14500/foo.rs @@ -0,0 +1,5 @@ +#[no_mangle] +pub extern "C" fn foo() {} + +#[no_mangle] +pub static FOO_STATIC: u8 = 0; diff --git a/tests/run-make/issue-14698/Makefile b/tests/run-make/issue-14698/Makefile new file mode 100644 index 000000000..a1cfb5aba --- /dev/null +++ b/tests/run-make/issue-14698/Makefile @@ -0,0 +1,4 @@ +include ../tools.mk + +all: + TMP=fake TMPDIR=fake $(RUSTC) foo.rs 2>&1 | $(CGREP) "couldn't create a temp dir:" diff --git a/tests/run-make/issue-14698/foo.rs b/tests/run-make/issue-14698/foo.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/tests/run-make/issue-14698/foo.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/issue-15460/Makefile b/tests/run-make/issue-15460/Makefile new file mode 100644 index 000000000..a36a085fa --- /dev/null +++ b/tests/run-make/issue-15460/Makefile @@ -0,0 +1,7 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(call NATIVE_STATICLIB,foo) + $(RUSTC) foo.rs -C extra-filename=-383hf8 -C prefer-dynamic + $(RUSTC) bar.rs + $(call RUN,bar) diff --git a/tests/run-make/issue-15460/bar.rs b/tests/run-make/issue-15460/bar.rs new file mode 100644 index 000000000..e66aeb6bd --- /dev/null +++ b/tests/run-make/issue-15460/bar.rs @@ -0,0 +1,4 @@ +extern crate foo; +fn main() { + unsafe { foo::foo() } +} diff --git a/tests/run-make/issue-15460/foo.c b/tests/run-make/issue-15460/foo.c new file mode 100644 index 000000000..fdf595b57 --- /dev/null +++ b/tests/run-make/issue-15460/foo.c @@ -0,0 +1,6 @@ +// ignore-license + +#ifdef _WIN32 +__declspec(dllexport) +#endif +void foo() {} diff --git a/tests/run-make/issue-15460/foo.rs b/tests/run-make/issue-15460/foo.rs new file mode 100644 index 000000000..b4eaa0b31 --- /dev/null +++ b/tests/run-make/issue-15460/foo.rs @@ -0,0 +1,6 @@ +#![crate_type = "dylib"] + +#[link(name = "foo", kind = "static")] +extern "C" { + pub fn foo(); +} diff --git a/tests/run-make/issue-18943/Makefile b/tests/run-make/issue-18943/Makefile new file mode 100644 index 000000000..fc40d756d --- /dev/null +++ b/tests/run-make/issue-18943/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +# Regression test for ICE #18943 when compiling as lib + +all: + $(RUSTC) foo.rs --crate-type lib + $(call REMOVE_RLIBS,foo) && exit 0 || exit 1 diff --git a/tests/run-make/issue-18943/foo.rs b/tests/run-make/issue-18943/foo.rs new file mode 100644 index 000000000..d18400dd3 --- /dev/null +++ b/tests/run-make/issue-18943/foo.rs @@ -0,0 +1,5 @@ +trait Foo { } + +trait Bar { } + +impl<'a> Foo for Bar + 'a { } diff --git a/tests/run-make/issue-20626/Makefile b/tests/run-make/issue-20626/Makefile new file mode 100644 index 000000000..63eee910a --- /dev/null +++ b/tests/run-make/issue-20626/Makefile @@ -0,0 +1,9 @@ +# ignore-cross-compile +include ../tools.mk + +# Test output to be four +# The original error only occurred when printing, not when comparing using assert! + +all: + $(RUSTC) foo.rs -O + [ `$(call RUN,foo)` = "4" ] diff --git a/tests/run-make/issue-20626/foo.rs b/tests/run-make/issue-20626/foo.rs new file mode 100644 index 000000000..a474e234e --- /dev/null +++ b/tests/run-make/issue-20626/foo.rs @@ -0,0 +1,13 @@ +fn identity(a: &u32) -> &u32 { a } + +fn print_foo(f: &fn(&u32) -> &u32, x: &u32) { + print!("{}", (*f)(x)); +} + +fn main() { + let x = &4; + let f: fn(&u32) -> &u32 = identity; + + // Didn't print 4 on optimized builds + print_foo(&f, x); +} diff --git a/tests/run-make/issue-22131/Makefile b/tests/run-make/issue-22131/Makefile new file mode 100644 index 000000000..4f33a4659 --- /dev/null +++ b/tests/run-make/issue-22131/Makefile @@ -0,0 +1,8 @@ +# ignore-cross-compile +include ../tools.mk + +all: foo.rs + $(RUSTC) --cfg 'feature="bar"' --crate-type lib foo.rs + $(RUSTDOC) --test --cfg 'feature="bar"' \ + -L $(TMPDIR) foo.rs |\ + $(CGREP) 'foo.rs - foo (line 1) ... ok' diff --git a/tests/run-make/issue-22131/foo.rs b/tests/run-make/issue-22131/foo.rs new file mode 100644 index 000000000..33255d768 --- /dev/null +++ b/tests/run-make/issue-22131/foo.rs @@ -0,0 +1,5 @@ +/// ```rust +/// assert_eq!(foo::foo(), 1); +/// ``` +#[cfg(feature = "bar")] +pub fn foo() -> i32 { 1 } diff --git a/tests/run-make/issue-24445/Makefile b/tests/run-make/issue-24445/Makefile new file mode 100644 index 000000000..a13910aa7 --- /dev/null +++ b/tests/run-make/issue-24445/Makefile @@ -0,0 +1,11 @@ +# ignore-cross-compile +include ../tools.mk + +# only-linux + +all: + $(RUSTC) foo.rs + $(CC) foo.c -lfoo -L $(TMPDIR) -Wl,--gc-sections -lpthread -ldl -o $(TMPDIR)/foo + $(call RUN,foo) + $(CC) foo.c -lfoo -L $(TMPDIR) -Wl,--gc-sections -lpthread -ldl -pie -fPIC -o $(TMPDIR)/foo + $(call RUN,foo) diff --git a/tests/run-make/issue-24445/foo.c b/tests/run-make/issue-24445/foo.c new file mode 100644 index 000000000..bb4036b06 --- /dev/null +++ b/tests/run-make/issue-24445/foo.c @@ -0,0 +1,6 @@ +void foo(); + +int main() { + foo(); + return 0; +} diff --git a/tests/run-make/issue-24445/foo.rs b/tests/run-make/issue-24445/foo.rs new file mode 100644 index 000000000..b67f3847c --- /dev/null +++ b/tests/run-make/issue-24445/foo.rs @@ -0,0 +1,15 @@ +#![crate_type = "staticlib"] + +struct Destroy; +impl Drop for Destroy { + fn drop(&mut self) { println!("drop"); } +} + +thread_local! { + static X: Destroy = Destroy +} + +#[no_mangle] +pub extern "C" fn foo() { + X.with(|_| ()); +} diff --git a/tests/run-make/issue-25581/Makefile b/tests/run-make/issue-25581/Makefile new file mode 100644 index 000000000..3cbbf3839 --- /dev/null +++ b/tests/run-make/issue-25581/Makefile @@ -0,0 +1,6 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(call NATIVE_STATICLIB,test) + $(RUSTC) test.rs + $(call RUN,test) || exit 1 diff --git a/tests/run-make/issue-25581/test.c b/tests/run-make/issue-25581/test.c new file mode 100644 index 000000000..52fbf7851 --- /dev/null +++ b/tests/run-make/issue-25581/test.c @@ -0,0 +1,15 @@ +#include +#include + +struct ByteSlice { + uint8_t *data; + size_t len; +}; + +size_t slice_len(struct ByteSlice bs) { + return bs.len; +} + +uint8_t slice_elem(struct ByteSlice bs, size_t idx) { + return bs.data[idx]; +} diff --git a/tests/run-make/issue-25581/test.rs b/tests/run-make/issue-25581/test.rs new file mode 100644 index 000000000..ba6749c97 --- /dev/null +++ b/tests/run-make/issue-25581/test.rs @@ -0,0 +1,18 @@ +#[link(name = "test", kind = "static")] +extern "C" { + fn slice_len(s: &[u8]) -> usize; + fn slice_elem(s: &[u8], idx: usize) -> u8; +} + +fn main() { + let data = [1, 2, 3, 4, 5]; + + unsafe { + assert_eq!(data.len(), slice_len(&data) as usize); + assert_eq!(data[0], slice_elem(&data, 0)); + assert_eq!(data[1], slice_elem(&data, 1)); + assert_eq!(data[2], slice_elem(&data, 2)); + assert_eq!(data[3], slice_elem(&data, 3)); + assert_eq!(data[4], slice_elem(&data, 4)); + } +} diff --git a/tests/run-make/issue-26006/Makefile b/tests/run-make/issue-26006/Makefile new file mode 100644 index 000000000..b679c1215 --- /dev/null +++ b/tests/run-make/issue-26006/Makefile @@ -0,0 +1,17 @@ +# ignore-cross-compile +include ../tools.mk + +# ignore-windows + +OUT := $(TMPDIR)/out + +all: time + +time: libc + mkdir -p $(OUT)/time $(OUT)/time/deps + ln -sf $(OUT)/libc/liblibc.rlib $(OUT)/time/deps/ + $(RUSTC) in/time/lib.rs -Ldependency=$(OUT)/time/deps/ + +libc: + mkdir -p $(OUT)/libc + $(RUSTC) in/libc/lib.rs --crate-name=libc -Cmetadata=foo -o $(OUT)/libc/liblibc.rlib diff --git a/tests/run-make/issue-26006/in/libc/lib.rs b/tests/run-make/issue-26006/in/libc/lib.rs new file mode 100644 index 000000000..23f2bf518 --- /dev/null +++ b/tests/run-make/issue-26006/in/libc/lib.rs @@ -0,0 +1,3 @@ +#![crate_type="rlib"] + +pub fn something(){} diff --git a/tests/run-make/issue-26006/in/time/lib.rs b/tests/run-make/issue-26006/in/time/lib.rs new file mode 100644 index 000000000..87f2f824a --- /dev/null +++ b/tests/run-make/issue-26006/in/time/lib.rs @@ -0,0 +1,4 @@ +#![feature(rustc_private)] +extern crate libc; + +fn main(){} diff --git a/tests/run-make/issue-26092/Makefile b/tests/run-make/issue-26092/Makefile new file mode 100644 index 000000000..96822e769 --- /dev/null +++ b/tests/run-make/issue-26092/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +# This test ensures that rustc does not panic with `-o ""` option. + +all: + $(RUSTC) -o "" blank.rs 2>&1 | $(CGREP) -i 'panic' && exit 1 || exit 0 diff --git a/tests/run-make/issue-26092/blank.rs b/tests/run-make/issue-26092/blank.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/tests/run-make/issue-26092/blank.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/issue-28595/Makefile b/tests/run-make/issue-28595/Makefile new file mode 100644 index 000000000..258f9788a --- /dev/null +++ b/tests/run-make/issue-28595/Makefile @@ -0,0 +1,7 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(call NATIVE_STATICLIB,a) $(call NATIVE_STATICLIB,b) + $(RUSTC) a.rs + $(RUSTC) b.rs + $(call RUN,b) diff --git a/tests/run-make/issue-28595/a.c b/tests/run-make/issue-28595/a.c new file mode 100644 index 000000000..7bfd83cca --- /dev/null +++ b/tests/run-make/issue-28595/a.c @@ -0,0 +1 @@ +void a(void) {} diff --git a/tests/run-make/issue-28595/a.rs b/tests/run-make/issue-28595/a.rs new file mode 100644 index 000000000..07863cf64 --- /dev/null +++ b/tests/run-make/issue-28595/a.rs @@ -0,0 +1,6 @@ +#![crate_type = "rlib"] + +#[link(name = "a", kind = "static")] +extern "C" { + pub fn a(); +} diff --git a/tests/run-make/issue-28595/b.c b/tests/run-make/issue-28595/b.c new file mode 100644 index 000000000..6aecb5f9e --- /dev/null +++ b/tests/run-make/issue-28595/b.c @@ -0,0 +1,5 @@ +extern void a(void); + +void b(void) { + a(); +} diff --git a/tests/run-make/issue-28595/b.rs b/tests/run-make/issue-28595/b.rs new file mode 100644 index 000000000..1f389859f --- /dev/null +++ b/tests/run-make/issue-28595/b.rs @@ -0,0 +1,12 @@ +extern crate a; + +#[link(name = "b", kind = "static")] +extern "C" { + pub fn b(); +} + +fn main() { + unsafe { + b(); + } +} diff --git a/tests/run-make/issue-28766/Makefile b/tests/run-make/issue-28766/Makefile new file mode 100644 index 000000000..96d0bdc2b --- /dev/null +++ b/tests/run-make/issue-28766/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + $(RUSTC) -O foo.rs + $(RUSTC) -O -L $(TMPDIR) main.rs diff --git a/tests/run-make/issue-28766/foo.rs b/tests/run-make/issue-28766/foo.rs new file mode 100644 index 000000000..1dcabe42d --- /dev/null +++ b/tests/run-make/issue-28766/foo.rs @@ -0,0 +1,8 @@ +#![crate_type="lib"] +pub struct Foo(()); + +impl Foo { + pub fn new() -> Foo { + Foo(()) + } +} diff --git a/tests/run-make/issue-28766/main.rs b/tests/run-make/issue-28766/main.rs new file mode 100644 index 000000000..de12b1fd9 --- /dev/null +++ b/tests/run-make/issue-28766/main.rs @@ -0,0 +1,7 @@ +#![crate_type="lib"] +extern crate foo; +use foo::Foo; + +pub fn crash() -> Box { + Box::new(Foo::new()) +} diff --git a/tests/run-make/issue-30063/Makefile b/tests/run-make/issue-30063/Makefile new file mode 100644 index 000000000..8a69ca79f --- /dev/null +++ b/tests/run-make/issue-30063/Makefile @@ -0,0 +1,36 @@ +# ignore-cross-compile +include ../tools.mk + +all: + rm -f $(TMPDIR)/foo-output + $(RUSTC) -C codegen-units=4 -o $(TMPDIR)/foo-output foo.rs + rm $(TMPDIR)/foo-output + + rm -f $(TMPDIR)/asm-output + $(RUSTC) -C codegen-units=4 --emit=asm -o $(TMPDIR)/asm-output foo.rs + rm $(TMPDIR)/asm-output + + rm -f $(TMPDIR)/bc-output + $(RUSTC) -C codegen-units=4 --emit=llvm-bc -o $(TMPDIR)/bc-output foo.rs + rm $(TMPDIR)/bc-output + + rm -f $(TMPDIR)/ir-output + $(RUSTC) -C codegen-units=4 --emit=llvm-ir -o $(TMPDIR)/ir-output foo.rs + rm $(TMPDIR)/ir-output + + rm -f $(TMPDIR)/link-output + $(RUSTC) -C codegen-units=4 --emit=link -o $(TMPDIR)/link-output foo.rs + rm $(TMPDIR)/link-output + + rm -f $(TMPDIR)/obj-output + $(RUSTC) -C codegen-units=4 --emit=obj -o $(TMPDIR)/obj-output foo.rs + rm $(TMPDIR)/obj-output + + rm -f $(TMPDIR)/dep-output + $(RUSTC) -C codegen-units=4 --emit=dep-info -o $(TMPDIR)/dep-output foo.rs + rm $(TMPDIR)/dep-output + +# # (This case doesn't work yet, and may be fundamentally wrong-headed anyway.) +# rm -f $(TMPDIR)/multi-output +# $(RUSTC) -C codegen-units=4 --emit=asm,obj -o $(TMPDIR)/multi-output foo.rs +# rm $(TMPDIR)/multi-output diff --git a/tests/run-make/issue-30063/foo.rs b/tests/run-make/issue-30063/foo.rs new file mode 100644 index 000000000..45590d86b --- /dev/null +++ b/tests/run-make/issue-30063/foo.rs @@ -0,0 +1 @@ +fn main() { } diff --git a/tests/run-make/issue-33329/Makefile b/tests/run-make/issue-33329/Makefile new file mode 100644 index 000000000..9c149440d --- /dev/null +++ b/tests/run-make/issue-33329/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + $(RUSTC) --target x86_64_unknown-linux-musl main.rs 2>&1 | $(CGREP) \ + "error: Error loading target specification: Could not find specification for target" diff --git a/tests/run-make/issue-33329/main.rs b/tests/run-make/issue-33329/main.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/tests/run-make/issue-33329/main.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/issue-35164/Makefile b/tests/run-make/issue-35164/Makefile new file mode 100644 index 000000000..38aa6f126 --- /dev/null +++ b/tests/run-make/issue-35164/Makefile @@ -0,0 +1,4 @@ +include ../tools.mk + +all: + $(RUSTC) main.rs --error-format json 2>&1 | $(CGREP) -e '"byte_start":23\b' '"byte_end":29\b' diff --git a/tests/run-make/issue-35164/main.rs b/tests/run-make/issue-35164/main.rs new file mode 100644 index 000000000..1333d6322 --- /dev/null +++ b/tests/run-make/issue-35164/main.rs @@ -0,0 +1,5 @@ +mod submodule; + +fn main() { + submodule::foo(); +} diff --git a/tests/run-make/issue-35164/submodule/mod.rs b/tests/run-make/issue-35164/submodule/mod.rs new file mode 100644 index 000000000..a9045b242 --- /dev/null +++ b/tests/run-make/issue-35164/submodule/mod.rs @@ -0,0 +1,3 @@ +pub fn foo() { + let _MyFoo = 2; +} diff --git a/tests/run-make/issue-36710/Makefile b/tests/run-make/issue-36710/Makefile index d6145c071..7b91107a2 100644 --- a/tests/run-make/issue-36710/Makefile +++ b/tests/run-make/issue-36710/Makefile @@ -1,11 +1,13 @@ +# ignore-cross-compile # ignore-none no-std is not supported # ignore-wasm32 FIXME: don't attempt to compile C++ to WASM # ignore-wasm64 FIXME: don't attempt to compile C++ to WASM # ignore-nvptx64-nvidia-cuda FIXME: can't find crate for `std` # ignore-musl FIXME: this makefile needs teaching how to use a musl toolchain # (see dist-i586-gnu-i586-i686-musl Dockerfile) +# ignore-sgx -include ../../run-make-fulldeps/tools.mk +include ../tools.mk all: foo $(call RUN,foo) diff --git a/tests/run-make/issue-37839/Makefile b/tests/run-make/issue-37839/Makefile new file mode 100644 index 000000000..6bad27b7b --- /dev/null +++ b/tests/run-make/issue-37839/Makefile @@ -0,0 +1,7 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) a.rs && $(RUSTC) b.rs + $(BARE_RUSTC) c.rs -L dependency=$(TMPDIR) --extern b=$(TMPDIR)/libb.rlib \ + --out-dir=$(TMPDIR) diff --git a/tests/run-make/issue-37839/a.rs b/tests/run-make/issue-37839/a.rs new file mode 100644 index 000000000..b5dffac3f --- /dev/null +++ b/tests/run-make/issue-37839/a.rs @@ -0,0 +1,2 @@ +#![allow(unused)] +#![crate_type = "proc-macro"] diff --git a/tests/run-make/issue-37839/b.rs b/tests/run-make/issue-37839/b.rs new file mode 100644 index 000000000..355d2b165 --- /dev/null +++ b/tests/run-make/issue-37839/b.rs @@ -0,0 +1,2 @@ +#![crate_type = "lib"] +#[macro_use] extern crate a; diff --git a/tests/run-make/issue-37839/c.rs b/tests/run-make/issue-37839/c.rs new file mode 100644 index 000000000..4c7ce01b6 --- /dev/null +++ b/tests/run-make/issue-37839/c.rs @@ -0,0 +1,2 @@ +#![crate_type = "lib"] +extern crate b; diff --git a/tests/run-make/issue-37893/Makefile b/tests/run-make/issue-37893/Makefile new file mode 100644 index 000000000..44e4a321a --- /dev/null +++ b/tests/run-make/issue-37893/Makefile @@ -0,0 +1,5 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) a.rs && $(RUSTC) b.rs && $(RUSTC) c.rs diff --git a/tests/run-make/issue-37893/a.rs b/tests/run-make/issue-37893/a.rs new file mode 100644 index 000000000..b5dffac3f --- /dev/null +++ b/tests/run-make/issue-37893/a.rs @@ -0,0 +1,2 @@ +#![allow(unused)] +#![crate_type = "proc-macro"] diff --git a/tests/run-make/issue-37893/b.rs b/tests/run-make/issue-37893/b.rs new file mode 100644 index 000000000..355d2b165 --- /dev/null +++ b/tests/run-make/issue-37893/b.rs @@ -0,0 +1,2 @@ +#![crate_type = "lib"] +#[macro_use] extern crate a; diff --git a/tests/run-make/issue-37893/c.rs b/tests/run-make/issue-37893/c.rs new file mode 100644 index 000000000..b9c215572 --- /dev/null +++ b/tests/run-make/issue-37893/c.rs @@ -0,0 +1,3 @@ +#![crate_type = "staticlib"] +extern crate b; +extern crate a; diff --git a/tests/run-make/issue-38237/Makefile b/tests/run-make/issue-38237/Makefile new file mode 100644 index 000000000..80dddc5bd --- /dev/null +++ b/tests/run-make/issue-38237/Makefile @@ -0,0 +1,6 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) foo.rs; $(RUSTC) bar.rs + $(RUSTDOC) baz.rs -L $(TMPDIR) -o $(TMPDIR) diff --git a/tests/run-make/issue-38237/bar.rs b/tests/run-make/issue-38237/bar.rs new file mode 100644 index 000000000..2b839f3a3 --- /dev/null +++ b/tests/run-make/issue-38237/bar.rs @@ -0,0 +1,4 @@ +#![crate_type = "lib"] + +#[derive(Debug)] +pub struct S; diff --git a/tests/run-make/issue-38237/baz.rs b/tests/run-make/issue-38237/baz.rs new file mode 100644 index 000000000..cd2425f9b --- /dev/null +++ b/tests/run-make/issue-38237/baz.rs @@ -0,0 +1,8 @@ +extern crate foo; +extern crate bar; + +pub struct Bar; +impl ::std::ops::Deref for Bar { + type Target = bar::S; + fn deref(&self) -> &Self::Target { unimplemented!() } +} diff --git a/tests/run-make/issue-38237/foo.rs b/tests/run-make/issue-38237/foo.rs new file mode 100644 index 000000000..a106e4fde --- /dev/null +++ b/tests/run-make/issue-38237/foo.rs @@ -0,0 +1,9 @@ +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +#[proc_macro_derive(A)] +pub fn derive(ts: proc_macro::TokenStream) -> proc_macro::TokenStream { ts } + +#[derive(Debug)] +struct S; diff --git a/tests/run-make/issue-40535/Makefile b/tests/run-make/issue-40535/Makefile new file mode 100644 index 000000000..155c88252 --- /dev/null +++ b/tests/run-make/issue-40535/Makefile @@ -0,0 +1,13 @@ +include ../tools.mk + +# The ICE occurred in the following situation: +# * `foo` declares `extern crate bar, baz`, depends only on `bar` (forgetting `baz` in `Cargo.toml`) +# * `bar` declares and depends on `extern crate baz` +# * All crates built in metadata-only mode (`cargo check`) +all: + # cc https://github.com/rust-lang/rust/issues/40623 + $(RUSTC) baz.rs --emit=metadata + $(RUSTC) bar.rs --emit=metadata --extern baz=$(TMPDIR)/libbaz.rmeta + $(RUSTC) foo.rs --emit=metadata --extern bar=$(TMPDIR)/libbar.rmeta 2>&1 | \ + $(CGREP) -v "unexpectedly panicked" + # ^ Succeeds if it doesn't find the ICE message diff --git a/tests/run-make/issue-40535/bar.rs b/tests/run-make/issue-40535/bar.rs new file mode 100644 index 000000000..b02b28f59 --- /dev/null +++ b/tests/run-make/issue-40535/bar.rs @@ -0,0 +1,3 @@ +#![crate_type = "lib"] + +extern crate baz; diff --git a/tests/run-make/issue-40535/baz.rs b/tests/run-make/issue-40535/baz.rs new file mode 100644 index 000000000..83be6e807 --- /dev/null +++ b/tests/run-make/issue-40535/baz.rs @@ -0,0 +1 @@ +#![crate_type = "lib"] diff --git a/tests/run-make/issue-40535/foo.rs b/tests/run-make/issue-40535/foo.rs new file mode 100644 index 000000000..270202664 --- /dev/null +++ b/tests/run-make/issue-40535/foo.rs @@ -0,0 +1,4 @@ +#![crate_type = "lib"] + +extern crate bar; +extern crate baz; diff --git a/tests/run-make/issue-46239/Makefile b/tests/run-make/issue-46239/Makefile new file mode 100644 index 000000000..0006ced25 --- /dev/null +++ b/tests/run-make/issue-46239/Makefile @@ -0,0 +1,6 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) main.rs -C opt-level=1 + $(call RUN,main) diff --git a/tests/run-make/issue-46239/main.rs b/tests/run-make/issue-46239/main.rs new file mode 100644 index 000000000..b7df5cf4d --- /dev/null +++ b/tests/run-make/issue-46239/main.rs @@ -0,0 +1,8 @@ +fn project(x: &(T,)) -> &T { &x.0 } + +fn dummy() {} + +fn main() { + let f = (dummy as fn(),); + (*project(&f))(); +} diff --git a/tests/run-make/issue-47384/Makefile b/tests/run-make/issue-47384/Makefile index 0aadf6c88..afc77cb27 100644 --- a/tests/run-make/issue-47384/Makefile +++ b/tests/run-make/issue-47384/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # only-linux # ignore-cross-compile diff --git a/tests/run-make/issue-47551/Makefile b/tests/run-make/issue-47551/Makefile new file mode 100644 index 000000000..5a6ac7257 --- /dev/null +++ b/tests/run-make/issue-47551/Makefile @@ -0,0 +1,9 @@ +# only-linux +# ignore-32bit + +include ../tools.mk + +all: + $(RUSTC) eh_frame-terminator.rs + $(call RUN,eh_frame-terminator) | $(CGREP) '1122334455667788' + objdump --dwarf=frames $(TMPDIR)/eh_frame-terminator | $(CGREP) 'ZERO terminator' diff --git a/tests/run-make/issue-47551/eh_frame-terminator.rs b/tests/run-make/issue-47551/eh_frame-terminator.rs new file mode 100644 index 000000000..a2c7a31b7 --- /dev/null +++ b/tests/run-make/issue-47551/eh_frame-terminator.rs @@ -0,0 +1,22 @@ +// run-pass + +#[derive(Clone, Copy)] +struct Foo { + array: [u64; 10240], +} + +impl Foo { + const fn new() -> Self { + Self { + array: [0x1122_3344_5566_7788; 10240] + } + } +} + +static BAR: [Foo; 10240] = [Foo::new(); 10240]; + +fn main() { + let bt = std::backtrace::Backtrace::force_capture(); + println!("Hello, world! {:?}", bt); + println!("{:x}", BAR[0].array[0]); +} diff --git a/tests/run-make/issue-51671/Makefile b/tests/run-make/issue-51671/Makefile new file mode 100644 index 000000000..c93645369 --- /dev/null +++ b/tests/run-make/issue-51671/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +# ignore-windows-msvc + +all: + $(RUSTC) --emit=obj app.rs + nm $(TMPDIR)/app.o | $(CGREP) rust_begin_unwind + nm $(TMPDIR)/app.o | $(CGREP) rust_eh_personality + nm $(TMPDIR)/app.o | $(CGREP) __rg_oom diff --git a/tests/run-make/issue-51671/app.rs b/tests/run-make/issue-51671/app.rs new file mode 100644 index 000000000..e9dc1e974 --- /dev/null +++ b/tests/run-make/issue-51671/app.rs @@ -0,0 +1,20 @@ +#![crate_type = "bin"] +#![feature(lang_items, alloc_error_handler)] +#![no_main] +#![no_std] + +use core::alloc::Layout; +use core::panic::PanicInfo; + +#[panic_handler] +fn panic(_: &PanicInfo) -> ! { + loop {} +} + +#[lang = "eh_personality"] +fn eh() {} + +#[alloc_error_handler] +fn oom(_: Layout) -> ! { + loop {} +} diff --git a/tests/run-make/issue-53964/Makefile b/tests/run-make/issue-53964/Makefile new file mode 100644 index 000000000..6bd830213 --- /dev/null +++ b/tests/run-make/issue-53964/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + $(RUSTC) panic.rs + $(RUSTC) -C panic=abort --emit=obj app.rs -L $(TMPDIR) diff --git a/tests/run-make/issue-53964/app.rs b/tests/run-make/issue-53964/app.rs new file mode 100644 index 000000000..8127b9578 --- /dev/null +++ b/tests/run-make/issue-53964/app.rs @@ -0,0 +1,8 @@ +#![crate_type = "bin"] +#![no_main] +#![no_std] + +#![deny(unused_extern_crates)] + +// `panic` provides a `panic_handler` so it shouldn't trip the `unused_extern_crates` lint +extern crate panic; diff --git a/tests/run-make/issue-53964/panic.rs b/tests/run-make/issue-53964/panic.rs new file mode 100644 index 000000000..a87812050 --- /dev/null +++ b/tests/run-make/issue-53964/panic.rs @@ -0,0 +1,10 @@ +#![crate_type = "lib"] +#![feature(panic_handler)] +#![no_std] + +use core::panic::PanicInfo; + +#[panic_handler] +fn panic(_: &PanicInfo) -> ! { + loop {} +} diff --git a/tests/run-make/issue-64153/Makefile b/tests/run-make/issue-64153/Makefile new file mode 100644 index 000000000..f42ea620f --- /dev/null +++ b/tests/run-make/issue-64153/Makefile @@ -0,0 +1,26 @@ +include ../tools.mk + +# `llvm-objdump`'s output looks different on windows than on other platforms. +# It should be enough to check on Unix platforms, so: +# ignore-windows + +# Staticlibs don't include Rust object files from upstream crates if the same +# code was already pulled into the lib via LTO. However, the bug described in +# https://github.com/rust-lang/rust/issues/64153 lead to this exclusion not +# working properly if the upstream crate was compiled with an explicit filename +# (via `-o`). +# +# This test makes sure that functions defined in the upstream crates do not +# appear twice in the final staticlib when listing all the symbols from it. + +all: + $(RUSTC) --crate-type rlib upstream.rs -o $(TMPDIR)/libupstream.rlib -Ccodegen-units=1 + $(RUSTC) --crate-type staticlib downstream.rs -Clto -Ccodegen-units=1 -o $(TMPDIR)/libdownstream.a + # Dump all the symbols from the staticlib into `syms` + "$(LLVM_BIN_DIR)"/llvm-objdump -t $(TMPDIR)/libdownstream.a > $(TMPDIR)/syms + # Count the global instances of `issue64153_test_function`. There'll be 2 + # if the `upstream` object file got erroneously included twice. + # The line we are testing for with the regex looks something like: + # 0000000000000000 g F .text.issue64153_test_function 00000023 issue64153_test_function + grep -c -e "[[:space:]]g[[:space:]]*F[[:space:]].*issue64153_test_function" $(TMPDIR)/syms > $(TMPDIR)/count + [ "$$(cat $(TMPDIR)/count)" -eq "1" ] diff --git a/tests/run-make/issue-64153/downstream.rs b/tests/run-make/issue-64153/downstream.rs new file mode 100644 index 000000000..e03704665 --- /dev/null +++ b/tests/run-make/issue-64153/downstream.rs @@ -0,0 +1,6 @@ +extern crate upstream; + +#[no_mangle] +pub extern "C" fn foo() { + print!("1 + 1 = {}", upstream::issue64153_test_function(1)); +} diff --git a/tests/run-make/issue-64153/upstream.rs b/tests/run-make/issue-64153/upstream.rs new file mode 100644 index 000000000..861a00298 --- /dev/null +++ b/tests/run-make/issue-64153/upstream.rs @@ -0,0 +1,6 @@ +// Make this function extern "C", public, and no-mangle, so that it gets +// exported from the downstream staticlib. +#[no_mangle] +pub extern "C" fn issue64153_test_function(x: u32) -> u32 { + x + 1 +} diff --git a/tests/run-make/issue-68794-textrel-on-minimal-lib/Makefile b/tests/run-make/issue-68794-textrel-on-minimal-lib/Makefile new file mode 100644 index 000000000..6140b39c0 --- /dev/null +++ b/tests/run-make/issue-68794-textrel-on-minimal-lib/Makefile @@ -0,0 +1,18 @@ +# ignore-cross-compile +# Regression test for issue #68794 +# +# Verify that no text relocations are accidentally introduced by linking a +# minimal rust staticlib. +# +# The test links a rust static library into a shared library, and checks that +# the linker doesn't have to flag the resulting file as containing TEXTRELs. + +include ../tools.mk + +# only-linux + +all: + $(RUSTC) foo.rs + $(CC) bar.c $(call STATICLIB,foo) -fPIC -shared -o $(call DYLIB,bar) \ + $(EXTRACFLAGS) $(EXTRACXXFLAGS) + readelf -d $(call DYLIB,bar) | grep TEXTREL; test $$? -eq 1 diff --git a/tests/run-make/issue-68794-textrel-on-minimal-lib/bar.c b/tests/run-make/issue-68794-textrel-on-minimal-lib/bar.c new file mode 100644 index 000000000..bb4036b06 --- /dev/null +++ b/tests/run-make/issue-68794-textrel-on-minimal-lib/bar.c @@ -0,0 +1,6 @@ +void foo(); + +int main() { + foo(); + return 0; +} diff --git a/tests/run-make/issue-68794-textrel-on-minimal-lib/foo.rs b/tests/run-make/issue-68794-textrel-on-minimal-lib/foo.rs new file mode 100644 index 000000000..a3e865b63 --- /dev/null +++ b/tests/run-make/issue-68794-textrel-on-minimal-lib/foo.rs @@ -0,0 +1,8 @@ +#![crate_type = "staticlib"] + +#[no_mangle] +pub extern "C" fn foo(x: u32) { + // using the println! makes it so that enough code from the standard + // library is included (see issue #68794) + println!("foo: {}", x); +} diff --git a/tests/run-make/issue-69368/Makefile b/tests/run-make/issue-69368/Makefile new file mode 100644 index 000000000..b1229d1b0 --- /dev/null +++ b/tests/run-make/issue-69368/Makefile @@ -0,0 +1,19 @@ +# ignore-cross-compile +include ../tools.mk + +# Test that previously triggered a linker failure with root cause +# similar to one found in the issue #69368. +# +# The crate that provides oom lang item is missing some other lang +# items. Necessary to prevent the use of start-group / end-group. +# +# The weak lang items are defined in a separate compilation units, +# so that linker could omit them if not used. +# +# The crates that need those weak lang items are dependencies of +# crates that provide them. + +all: + $(RUSTC) a.rs + $(RUSTC) b.rs + $(RUSTC) c.rs diff --git a/tests/run-make/issue-69368/a.rs b/tests/run-make/issue-69368/a.rs new file mode 100644 index 000000000..a54f42955 --- /dev/null +++ b/tests/run-make/issue-69368/a.rs @@ -0,0 +1,26 @@ +#![crate_type = "rlib"] +#![feature(lang_items)] +#![feature(panic_unwind)] +#![no_std] + +extern crate panic_unwind; + +#[panic_handler] +pub fn panic_handler(_: &core::panic::PanicInfo) -> ! { + loop {} +} + +#[no_mangle] +extern "C" fn __rust_drop_panic() -> ! { + loop {} +} + +#[no_mangle] +extern "C" fn __rust_foreign_exception() -> ! { + loop {} +} + +#[lang = "eh_personality"] +fn eh_personality() { + loop {} +} diff --git a/tests/run-make/issue-69368/b.rs b/tests/run-make/issue-69368/b.rs new file mode 100644 index 000000000..4d6af0266 --- /dev/null +++ b/tests/run-make/issue-69368/b.rs @@ -0,0 +1,8 @@ +#![crate_type = "rlib"] +#![feature(alloc_error_handler)] +#![no_std] + +#[alloc_error_handler] +pub fn error_handler(_: core::alloc::Layout) -> ! { + panic!(); +} diff --git a/tests/run-make/issue-69368/c.rs b/tests/run-make/issue-69368/c.rs new file mode 100644 index 000000000..729c4249a --- /dev/null +++ b/tests/run-make/issue-69368/c.rs @@ -0,0 +1,34 @@ +#![crate_type = "bin"] +#![feature(start)] +#![no_std] + +extern crate alloc; +extern crate a; +extern crate b; + +use alloc::vec::Vec; +use core::alloc::*; + +struct Allocator; + +unsafe impl GlobalAlloc for Allocator { + unsafe fn alloc(&self, _: Layout) -> *mut u8 { + loop {} + } + + unsafe fn dealloc(&self, _: *mut u8, _: Layout) { + loop {} + } +} + +#[global_allocator] +static ALLOCATOR: Allocator = Allocator; + +#[start] +fn main(argc: isize, _argv: *const *const u8) -> isize { + let mut v = Vec::new(); + for i in 0..argc { + v.push(i); + } + v.iter().sum() +} diff --git a/tests/run-make/issue-71519/Makefile b/tests/run-make/issue-71519/Makefile index 57497f520..0ee83328b 100644 --- a/tests/run-make/issue-71519/Makefile +++ b/tests/run-make/issue-71519/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # ignore-msvc # needs-rust-lld diff --git a/tests/run-make/issue-7349/Makefile b/tests/run-make/issue-7349/Makefile new file mode 100644 index 000000000..dc073b77f --- /dev/null +++ b/tests/run-make/issue-7349/Makefile @@ -0,0 +1,11 @@ +include ../tools.mk + +# Test to make sure that inner functions within a polymorphic outer function +# don't get re-codegened when the outer function is monomorphized. The test +# code monomorphizes the outer functions several times, but the magic constants +# used in the inner functions should each appear only once in the generated IR. + +all: + $(RUSTC) foo.rs --emit=llvm-ir + [ "$$(grep -c 'ret i32 8675309' "$(TMPDIR)/foo.ll")" -eq "1" ] + [ "$$(grep -c 'ret i32 11235813' "$(TMPDIR)/foo.ll")" -eq "1" ] diff --git a/tests/run-make/issue-7349/foo.rs b/tests/run-make/issue-7349/foo.rs new file mode 100644 index 000000000..246a12595 --- /dev/null +++ b/tests/run-make/issue-7349/foo.rs @@ -0,0 +1,22 @@ +fn outer() { + #[allow(dead_code)] + fn inner() -> u32 { + 8675309 + } + inner(); +} + +extern "C" fn outer_foreign() { + #[allow(dead_code)] + fn inner() -> u32 { + 11235813 + } + inner(); +} + +fn main() { + outer::(); + outer::(); + outer_foreign::(); + outer_foreign::(); +} diff --git a/tests/run-make/issue-83045/Makefile b/tests/run-make/issue-83045/Makefile new file mode 100644 index 000000000..7053da00f --- /dev/null +++ b/tests/run-make/issue-83045/Makefile @@ -0,0 +1,33 @@ +include ../tools.mk + +# This test case creates a situation where the crate loader would run +# into an ICE when confronted with an invalid setup where it cannot +# find the dependency of a direct dependency. +# +# The test case makes sure that the compiler produces the expected +# error message but does not ICE immediately after. +# +# See https://github.com/rust-lang/rust/issues/83045 + +# This is a platform-independent issue, no need to waste time testing +# everywhere. +# only-x86_64 +# only-linux + +# NOTE: We use BARE_RUSTC below so that the compiler can't find liba.rlib +# If we used RUSTC the additional '-L TMPDIR' option would allow rustc to +# actually find the crate. +# +# We check that we get the expected error message +# But that we do not get an ICE + +all: + $(RUSTC) --crate-name=a --crate-type=rlib a.rs --verbose + $(RUSTC) --crate-name=b --crate-type=rlib --extern a=$(TMPDIR)/liba.rlib b.rs --verbose + $(BARE_RUSTC) --out-dir $(TMPDIR) \ + --extern b=$(TMPDIR)/libb.rlib \ + --crate-type=rlib \ + --edition=2018 \ + c.rs 2>&1 | tee $(TMPDIR)/output.txt || exit 0 + $(CGREP) E0519 < $(TMPDIR)/output.txt + $(CGREP) -v "internal compiler error" < $(TMPDIR)/output.txt diff --git a/tests/run-make/issue-83045/a.rs b/tests/run-make/issue-83045/a.rs new file mode 100644 index 000000000..66d9f758e --- /dev/null +++ b/tests/run-make/issue-83045/a.rs @@ -0,0 +1 @@ +// empty on purpose diff --git a/tests/run-make/issue-83045/b.rs b/tests/run-make/issue-83045/b.rs new file mode 100644 index 000000000..f4876cfa4 --- /dev/null +++ b/tests/run-make/issue-83045/b.rs @@ -0,0 +1 @@ +extern crate a; diff --git a/tests/run-make/issue-83045/c.rs b/tests/run-make/issue-83045/c.rs new file mode 100644 index 000000000..e0c452549 --- /dev/null +++ b/tests/run-make/issue-83045/c.rs @@ -0,0 +1 @@ +use b as _; diff --git a/tests/run-make/issue-83112-incr-test-moved-file/Makefile b/tests/run-make/issue-83112-incr-test-moved-file/Makefile index 2f796e5b2..a00088cd9 100644 --- a/tests/run-make/issue-83112-incr-test-moved-file/Makefile +++ b/tests/run-make/issue-83112-incr-test-moved-file/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # ignore-none no-std is not supported # ignore-nvptx64-nvidia-cuda FIXME: can't find crate for 'std' diff --git a/tests/run-make/issue-84395-lto-embed-bitcode/Makefile b/tests/run-make/issue-84395-lto-embed-bitcode/Makefile new file mode 100644 index 000000000..95c8d08a1 --- /dev/null +++ b/tests/run-make/issue-84395-lto-embed-bitcode/Makefile @@ -0,0 +1,11 @@ +# needs-matching-clang + +# This test makes sure the embed bitcode in elf created with +# lto-embed-bitcode=optimized is valid llvm BC module. + +include ../tools.mk + +all: + $(RUSTC) test.rs --target $(TARGET) -Clink-arg=-fuse-ld=lld -Clinker-plugin-lto -Clinker=$(CLANG) -Clink-arg=-Wl,--plugin-opt=-lto-embed-bitcode=optimized -Zemit-thin-lto=no + $(LLVM_BIN_DIR)/objcopy --dump-section .llvmbc=$(TMPDIR)/test.bc $(TMPDIR)/test + $(LLVM_BIN_DIR)/llvm-dis $(TMPDIR)/test.bc diff --git a/tests/run-make/issue-84395-lto-embed-bitcode/test.rs b/tests/run-make/issue-84395-lto-embed-bitcode/test.rs new file mode 100644 index 000000000..47ad8c634 --- /dev/null +++ b/tests/run-make/issue-84395-lto-embed-bitcode/test.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello World!"); +} diff --git a/tests/run-make/issue-85019-moved-src-dir/Makefile b/tests/run-make/issue-85019-moved-src-dir/Makefile index 3606d4fdf..dec289058 100644 --- a/tests/run-make/issue-85019-moved-src-dir/Makefile +++ b/tests/run-make/issue-85019-moved-src-dir/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk INCR=$(TMPDIR)/incr FIRST_SRC=$(TMPDIR)/first_src diff --git a/tests/run-make/issue-85401-static-mir/Makefile b/tests/run-make/issue-85401-static-mir/Makefile index 99590166b..47a36b6e4 100644 --- a/tests/run-make/issue-85401-static-mir/Makefile +++ b/tests/run-make/issue-85401-static-mir/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # Regression test for issue #85401 # Verify that we do not ICE when trying to access MIR for statics, diff --git a/tests/run-make/issue-85441/Makefile b/tests/run-make/issue-85441/Makefile index f04b07d51..987d7f7d4 100644 --- a/tests/run-make/issue-85441/Makefile +++ b/tests/run-make/issue-85441/Makefile @@ -1,6 +1,6 @@ # only-windows-msvc -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # Tests that WS2_32.dll is not unnecessarily linked, see issue #85441 diff --git a/tests/run-make/issue-88756-default-output/Makefile b/tests/run-make/issue-88756-default-output/Makefile index 275c35c26..d1c3d0fe0 100644 --- a/tests/run-make/issue-88756-default-output/Makefile +++ b/tests/run-make/issue-88756-default-output/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk all: $(BARE_RUSTDOC) 2>&1 | sed -E 's@/nightly/|/beta/|/stable/|/1\.[0-9]+\.[0-9]+/@/$$CHANNEL/@g' | diff - output-default.stdout diff --git a/tests/run-make/issue-96498/Makefile b/tests/run-make/issue-96498/Makefile index ce2b1b1ff..efdd328c6 100644 --- a/tests/run-make/issue-96498/Makefile +++ b/tests/run-make/issue-96498/Makefile @@ -1,7 +1,7 @@ # only-windows # needs-rust-lld -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # Ensure that LLD can link all: diff --git a/tests/run-make/issue-97463-abi-param-passing/Makefile b/tests/run-make/issue-97463-abi-param-passing/Makefile new file mode 100644 index 000000000..7ce7aaeec --- /dev/null +++ b/tests/run-make/issue-97463-abi-param-passing/Makefile @@ -0,0 +1,15 @@ +# ignore-cross-compile +include ../tools.mk + +# ignore-msvc + +# The issue exercised by this test, rust-lang/rust#97463, explicitly needs `-O` +# flags (like `-O3`) to reproduce. Thus, we call $(CC) instead of nicer +# alternatives provided by tools.mk like using `COMPILE_OBJ` or using a +# `NATIVE_STATICLIB` dependency. + +all: + $(CC) -c -O3 -o $(TMPDIR)/bad.o bad.c + $(AR) rcs $(TMPDIR)/libbad.a $(TMPDIR)/bad.o + $(RUSTC) param_passing.rs -L$(TMPDIR) -lbad -C opt-level=3 + $(call RUN,param_passing) diff --git a/tests/run-make/issue-97463-abi-param-passing/bad.c b/tests/run-make/issue-97463-abi-param-passing/bad.c new file mode 100644 index 000000000..013314ab2 --- /dev/null +++ b/tests/run-make/issue-97463-abi-param-passing/bad.c @@ -0,0 +1,24 @@ +#include +#include +#include + + +struct bloc { + uint16_t a; + uint16_t b; + uint16_t c; +}; + +uint16_t c_read_value(uint32_t a, uint32_t b, uint32_t c) { + struct bloc *data = malloc(sizeof(struct bloc)); + + data->a = a & 0xFFFF; + data->b = b & 0xFFFF; + data->c = c & 0xFFFF; + + printf("C struct: a = %u, b = %u, c = %u\n", + (unsigned) data->a, (unsigned) data->b, (unsigned) data->c); + printf("C function returns %u\n", (unsigned) data->b); + + return data->b; /* leak data */ +} diff --git a/tests/run-make/issue-97463-abi-param-passing/param_passing.rs b/tests/run-make/issue-97463-abi-param-passing/param_passing.rs new file mode 100644 index 000000000..c11f3cc72 --- /dev/null +++ b/tests/run-make/issue-97463-abi-param-passing/param_passing.rs @@ -0,0 +1,38 @@ +// NOTE: Exposing the bug encoded in this test is sensitive to +// LLVM optimization choices. See additional note below for an +// example. + +#[link(name = "bad")] +extern "C" { + pub fn c_read_value(a: u32, b: u32, c: u32) -> u16; +} + +fn main() { + const C1: usize = 0x327b23c6; + const C2: usize = C1 & 0xFFFF; + + let r1: usize = 0x0; + let r2: usize = C1; + let r3: usize = 0x0; + let value: u16 = unsafe { c_read_value(r1 as u32, r2 as u32, r3 as u32) }; + + // NOTE: as an example of the sensitivity of this test to optimization choices, + // uncommenting this block of code makes the bug go away on pnkfelix's machine. + // (But observing via `dbg!` doesn't hide the bug. At least sometimes.) + /* + println!("{}", value); + println!("{}", value as usize); + println!("{}", usize::from(value)); + println!("{}", (value as usize) & 0xFFFF); + */ + + let d1 = value; + let d2 = value as usize; + let d3 = usize::from(value); + let d4 = (value as usize) & 0xFFFF; + + let d = (&d1, &d2, &d3, &d4); + let d_ = (d1, d2, d3, d4); + + assert_eq!(((&(C2 as u16), &C2, &C2, &C2), (C2 as u16, C2, C2, C2)), (d, d_)); +} diff --git a/tests/run-make/issue64319/Makefile b/tests/run-make/issue64319/Makefile new file mode 100644 index 000000000..56346cbcc --- /dev/null +++ b/tests/run-make/issue64319/Makefile @@ -0,0 +1,40 @@ +# ignore-cross-compile +include ../tools.mk + +# Different optimization levels imply different values for `-Zshare-generics`, +# so try out a whole bunch of combinations to make sure everything is compatible +all: + # First up, try some defaults + $(RUSTC) --crate-type rlib foo.rs + $(RUSTC) --crate-type dylib bar.rs -C opt-level=3 + + # Next try mixing up some things explicitly + $(RUSTC) --crate-type rlib foo.rs -Z share-generics=no + $(RUSTC) --crate-type dylib bar.rs -Z share-generics=no + $(RUSTC) --crate-type rlib foo.rs -Z share-generics=no + $(RUSTC) --crate-type dylib bar.rs -Z share-generics=yes + $(RUSTC) --crate-type rlib foo.rs -Z share-generics=yes + $(RUSTC) --crate-type dylib bar.rs -Z share-generics=no + $(RUSTC) --crate-type rlib foo.rs -Z share-generics=yes + $(RUSTC) --crate-type dylib bar.rs -Z share-generics=yes + + # Now combine a whole bunch of options together + $(RUSTC) --crate-type rlib foo.rs + $(RUSTC) --crate-type dylib bar.rs + $(RUSTC) --crate-type dylib bar.rs -Z share-generics=no + $(RUSTC) --crate-type dylib bar.rs -Z share-generics=yes + $(RUSTC) --crate-type dylib bar.rs -C opt-level=1 + $(RUSTC) --crate-type dylib bar.rs -C opt-level=1 -Z share-generics=no + $(RUSTC) --crate-type dylib bar.rs -C opt-level=1 -Z share-generics=yes + $(RUSTC) --crate-type dylib bar.rs -C opt-level=2 + $(RUSTC) --crate-type dylib bar.rs -C opt-level=2 -Z share-generics=no + $(RUSTC) --crate-type dylib bar.rs -C opt-level=2 -Z share-generics=yes + $(RUSTC) --crate-type dylib bar.rs -C opt-level=3 + $(RUSTC) --crate-type dylib bar.rs -C opt-level=3 -Z share-generics=no + $(RUSTC) --crate-type dylib bar.rs -C opt-level=3 -Z share-generics=yes + $(RUSTC) --crate-type dylib bar.rs -C opt-level=s + $(RUSTC) --crate-type dylib bar.rs -C opt-level=s -Z share-generics=no + $(RUSTC) --crate-type dylib bar.rs -C opt-level=s -Z share-generics=yes + $(RUSTC) --crate-type dylib bar.rs -C opt-level=z + $(RUSTC) --crate-type dylib bar.rs -C opt-level=z -Z share-generics=no + $(RUSTC) --crate-type dylib bar.rs -C opt-level=z -Z share-generics=yes diff --git a/tests/run-make/issue64319/bar.rs b/tests/run-make/issue64319/bar.rs new file mode 100644 index 000000000..3895c0b6c --- /dev/null +++ b/tests/run-make/issue64319/bar.rs @@ -0,0 +1,5 @@ +extern crate foo; + +pub fn bar() { + foo::foo(); +} diff --git a/tests/run-make/issue64319/foo.rs b/tests/run-make/issue64319/foo.rs new file mode 100644 index 000000000..c54a238e9 --- /dev/null +++ b/tests/run-make/issue64319/foo.rs @@ -0,0 +1,9 @@ +pub fn foo() { + bar::(); +} + +pub fn bar() { + baz(); +} + +fn baz() {} diff --git a/tests/run-make/jobserver-error/Makefile b/tests/run-make/jobserver-error/Makefile new file mode 100644 index 000000000..4a1699cc7 --- /dev/null +++ b/tests/run-make/jobserver-error/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +# only-linux +# ignore-test: This test randomly fails, see https://github.com/rust-lang/rust/issues/110321 + +# Test compiler behavior in case: `jobserver-auth` points to correct pipe which is not jobserver. + +all: + bash -c 'echo "fn main() {}" | MAKEFLAGS="--jobserver-auth=3,3" $(RUSTC) - 3&1 | diff jobserver.stderr - diff --git a/tests/run-make/jobserver-error/jobserver.stderr b/tests/run-make/jobserver-error/jobserver.stderr new file mode 100644 index 000000000..d18e15a26 --- /dev/null +++ b/tests/run-make/jobserver-error/jobserver.stderr @@ -0,0 +1,4 @@ +error: failed to acquire jobserver token: early EOF on jobserver pipe + +error: aborting due to previous error + diff --git a/tests/run-make/libs-through-symlinks/Makefile b/tests/run-make/libs-through-symlinks/Makefile new file mode 100644 index 000000000..592eae663 --- /dev/null +++ b/tests/run-make/libs-through-symlinks/Makefile @@ -0,0 +1,12 @@ +# ignore-cross-compile +include ../tools.mk + +# ignore-windows + +NAME := $(shell $(RUSTC) --print file-names foo.rs) + +all: + mkdir -p $(TMPDIR)/outdir + $(RUSTC) foo.rs -o $(TMPDIR)/outdir/$(NAME) + ln -nsf outdir/$(NAME) $(TMPDIR) + RUSTC_LOG=rustc_metadata::loader $(RUSTC) bar.rs diff --git a/tests/run-make/libs-through-symlinks/bar.rs b/tests/run-make/libs-through-symlinks/bar.rs new file mode 100644 index 000000000..bb7b36c49 --- /dev/null +++ b/tests/run-make/libs-through-symlinks/bar.rs @@ -0,0 +1,3 @@ +extern crate foo; + +fn main() {} diff --git a/tests/run-make/libs-through-symlinks/foo.rs b/tests/run-make/libs-through-symlinks/foo.rs new file mode 100644 index 000000000..8e3df2c6d --- /dev/null +++ b/tests/run-make/libs-through-symlinks/foo.rs @@ -0,0 +1,2 @@ +#![crate_type = "rlib"] +#![crate_name = "foo"] diff --git a/tests/run-make/libtest-json/Makefile b/tests/run-make/libtest-json/Makefile new file mode 100644 index 000000000..417637cf0 --- /dev/null +++ b/tests/run-make/libtest-json/Makefile @@ -0,0 +1,19 @@ +# ignore-cross-compile +include ../tools.mk + +# Test expected libtest's JSON output + +OUTPUT_FILE_DEFAULT := $(TMPDIR)/libtest-json-output-default.json +OUTPUT_FILE_STDOUT_SUCCESS := $(TMPDIR)/libtest-json-output-stdout-success.json + +all: f.rs validate_json.py output-default.json output-stdout-success.json + $(RUSTC) --test f.rs + RUST_BACKTRACE=0 $(call RUN,f) -Z unstable-options --test-threads=1 --format=json > $(OUTPUT_FILE_DEFAULT) || true + RUST_BACKTRACE=0 $(call RUN,f) -Z unstable-options --test-threads=1 --format=json --show-output > $(OUTPUT_FILE_STDOUT_SUCCESS) || true + + cat $(OUTPUT_FILE_DEFAULT) | "$(PYTHON)" validate_json.py + cat $(OUTPUT_FILE_STDOUT_SUCCESS) | "$(PYTHON)" validate_json.py + + # Normalize the actual output and compare to expected output file + cat $(OUTPUT_FILE_DEFAULT) | sed 's/"exec_time": [0-9.]*/"exec_time": $$TIME/' | diff output-default.json - + cat $(OUTPUT_FILE_STDOUT_SUCCESS) | sed 's/"exec_time": [0-9.]*/"exec_time": $$TIME/' | diff output-stdout-success.json - diff --git a/tests/run-make/libtest-json/f.rs b/tests/run-make/libtest-json/f.rs new file mode 100644 index 000000000..edfe25086 --- /dev/null +++ b/tests/run-make/libtest-json/f.rs @@ -0,0 +1,22 @@ +#[test] +fn a() { + println!("print from successful test"); + // Should pass +} + +#[test] +fn b() { + assert!(false); +} + +#[test] +#[should_panic] +fn c() { + assert!(false); +} + +#[test] +#[ignore = "msg"] +fn d() { + assert!(false); +} diff --git a/tests/run-make/libtest-json/output-default.json b/tests/run-make/libtest-json/output-default.json new file mode 100644 index 000000000..ad22b66ed --- /dev/null +++ b/tests/run-make/libtest-json/output-default.json @@ -0,0 +1,10 @@ +{ "type": "suite", "event": "started", "test_count": 4 } +{ "type": "test", "event": "started", "name": "a" } +{ "type": "test", "name": "a", "event": "ok" } +{ "type": "test", "event": "started", "name": "b" } +{ "type": "test", "name": "b", "event": "failed", "stdout": "thread 'b' panicked at 'assertion failed: false', f.rs:9:5\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" } +{ "type": "test", "event": "started", "name": "c" } +{ "type": "test", "name": "c", "event": "ok" } +{ "type": "test", "event": "started", "name": "d" } +{ "type": "test", "name": "d", "event": "ignored", "message": "msg" } +{ "type": "suite", "event": "failed", "passed": 2, "failed": 1, "ignored": 1, "measured": 0, "filtered_out": 0, "exec_time": $TIME } diff --git a/tests/run-make/libtest-json/output-stdout-success.json b/tests/run-make/libtest-json/output-stdout-success.json new file mode 100644 index 000000000..ec98172eb --- /dev/null +++ b/tests/run-make/libtest-json/output-stdout-success.json @@ -0,0 +1,10 @@ +{ "type": "suite", "event": "started", "test_count": 4 } +{ "type": "test", "event": "started", "name": "a" } +{ "type": "test", "name": "a", "event": "ok", "stdout": "print from successful test\n" } +{ "type": "test", "event": "started", "name": "b" } +{ "type": "test", "name": "b", "event": "failed", "stdout": "thread 'b' panicked at 'assertion failed: false', f.rs:9:5\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" } +{ "type": "test", "event": "started", "name": "c" } +{ "type": "test", "name": "c", "event": "ok", "stdout": "thread 'c' panicked at 'assertion failed: false', f.rs:15:5\n" } +{ "type": "test", "event": "started", "name": "d" } +{ "type": "test", "name": "d", "event": "ignored", "message": "msg" } +{ "type": "suite", "event": "failed", "passed": 2, "failed": 1, "ignored": 1, "measured": 0, "filtered_out": 0, "exec_time": $TIME } diff --git a/tests/run-make/libtest-json/validate_json.py b/tests/run-make/libtest-json/validate_json.py new file mode 100755 index 000000000..657f732f2 --- /dev/null +++ b/tests/run-make/libtest-json/validate_json.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python + +import sys +import json + +# Try to decode line in order to ensure it is a valid JSON document +for line in sys.stdin: + json.loads(line) diff --git a/tests/run-make/libtest-thread-limit/Makefile b/tests/run-make/libtest-thread-limit/Makefile index d43a89e60..9496fa301 100644 --- a/tests/run-make/libtest-thread-limit/Makefile +++ b/tests/run-make/libtest-thread-limit/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # only-linux diff --git a/tests/run-make/libtest-thread-limit/test.rs b/tests/run-make/libtest-thread-limit/test.rs index 26bc29216..88e8a498a 100644 --- a/tests/run-make/libtest-thread-limit/test.rs +++ b/tests/run-make/libtest-thread-limit/test.rs @@ -1,5 +1,3 @@ -#![feature(once_cell)] - use std::{ io::ErrorKind, sync::OnceLock, diff --git a/tests/run-make/link-arg/Makefile b/tests/run-make/link-arg/Makefile new file mode 100644 index 000000000..103527c3e --- /dev/null +++ b/tests/run-make/link-arg/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk +RUSTC_FLAGS = -C link-arg="-lfoo" -C link-arg="-lbar" --print link-args + +all: + $(RUSTC) $(RUSTC_FLAGS) empty.rs | $(CGREP) lfoo lbar diff --git a/tests/run-make/link-arg/empty.rs b/tests/run-make/link-arg/empty.rs new file mode 100644 index 000000000..45590d86b --- /dev/null +++ b/tests/run-make/link-arg/empty.rs @@ -0,0 +1 @@ +fn main() { } diff --git a/tests/run-make/link-args-order/Makefile b/tests/run-make/link-args-order/Makefile new file mode 100644 index 000000000..c562cc1b3 --- /dev/null +++ b/tests/run-make/link-args-order/Makefile @@ -0,0 +1,10 @@ +# ignore-msvc + +include ../tools.mk + +RUSTC_FLAGS = -C linker-flavor=ld -C link-arg=a -C link-args="b c" -C link-args="d e" -C link-arg=f +RUSTC_FLAGS_PRE = -C linker-flavor=ld -Z pre-link-arg=a -Z pre-link-args="b c" -Z pre-link-args="d e" -Z pre-link-arg=f + +all: + $(RUSTC) $(RUSTC_FLAGS) empty.rs 2>&1 | $(CGREP) '"a" "b" "c" "d" "e" "f"' + $(RUSTC) $(RUSTC_FLAGS_PRE) empty.rs 2>&1 | $(CGREP) '"a" "b" "c" "d" "e" "f"' diff --git a/tests/run-make/link-args-order/empty.rs b/tests/run-make/link-args-order/empty.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/tests/run-make/link-args-order/empty.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/link-cfg/Makefile b/tests/run-make/link-cfg/Makefile new file mode 100644 index 000000000..a40997011 --- /dev/null +++ b/tests/run-make/link-cfg/Makefile @@ -0,0 +1,23 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(call DYLIB,return1) $(call DYLIB,return2) $(call NATIVE_STATICLIB,return3) + ls $(TMPDIR) + $(BARE_RUSTC) --print cfg --target x86_64-unknown-linux-musl | $(CGREP) crt-static + + $(RUSTC) no-deps.rs --cfg foo + $(call RUN,no-deps) + $(RUSTC) no-deps.rs --cfg bar + $(call RUN,no-deps) + + $(RUSTC) dep.rs + $(RUSTC) with-deps.rs --cfg foo + $(call RUN,with-deps) + $(RUSTC) with-deps.rs --cfg bar + $(call RUN,with-deps) + + $(RUSTC) dep-with-staticlib.rs + $(RUSTC) with-staticlib-deps.rs --cfg foo + $(call RUN,with-staticlib-deps) + $(RUSTC) with-staticlib-deps.rs --cfg bar + $(call RUN,with-staticlib-deps) diff --git a/tests/run-make/link-cfg/dep-with-staticlib.rs b/tests/run-make/link-cfg/dep-with-staticlib.rs new file mode 100644 index 000000000..5ad66475d --- /dev/null +++ b/tests/run-make/link-cfg/dep-with-staticlib.rs @@ -0,0 +1,8 @@ +#![feature(link_cfg)] +#![crate_type = "rlib"] + +#[link(name = "return1", cfg(foo))] +#[link(name = "return3", kind = "static", cfg(bar))] +extern "C" { + pub fn my_function() -> i32; +} diff --git a/tests/run-make/link-cfg/dep.rs b/tests/run-make/link-cfg/dep.rs new file mode 100644 index 000000000..40de77f05 --- /dev/null +++ b/tests/run-make/link-cfg/dep.rs @@ -0,0 +1,8 @@ +#![feature(link_cfg)] +#![crate_type = "rlib"] + +#[link(name = "return1", cfg(foo))] +#[link(name = "return2", cfg(bar))] +extern "C" { + pub fn my_function() -> i32; +} diff --git a/tests/run-make/link-cfg/no-deps.rs b/tests/run-make/link-cfg/no-deps.rs new file mode 100644 index 000000000..ba5a8711a --- /dev/null +++ b/tests/run-make/link-cfg/no-deps.rs @@ -0,0 +1,20 @@ +#![feature(link_cfg)] + +#[link(name = "return1", cfg(foo))] +#[link(name = "return2", cfg(bar))] +extern "C" { + fn my_function() -> i32; +} + +fn main() { + unsafe { + let v = my_function(); + if cfg!(foo) { + assert_eq!(v, 1); + } else if cfg!(bar) { + assert_eq!(v, 2); + } else { + panic!("unknown"); + } + } +} diff --git a/tests/run-make/link-cfg/return1.c b/tests/run-make/link-cfg/return1.c new file mode 100644 index 000000000..41c2809ad --- /dev/null +++ b/tests/run-make/link-cfg/return1.c @@ -0,0 +1,6 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int my_function() { + return 1; +} diff --git a/tests/run-make/link-cfg/return2.c b/tests/run-make/link-cfg/return2.c new file mode 100644 index 000000000..622aeaa29 --- /dev/null +++ b/tests/run-make/link-cfg/return2.c @@ -0,0 +1,6 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int my_function() { + return 2; +} diff --git a/tests/run-make/link-cfg/return3.c b/tests/run-make/link-cfg/return3.c new file mode 100644 index 000000000..f29dc60d5 --- /dev/null +++ b/tests/run-make/link-cfg/return3.c @@ -0,0 +1,6 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int my_function() { + return 3; +} diff --git a/tests/run-make/link-cfg/with-deps.rs b/tests/run-make/link-cfg/with-deps.rs new file mode 100644 index 000000000..48b782815 --- /dev/null +++ b/tests/run-make/link-cfg/with-deps.rs @@ -0,0 +1,14 @@ +extern crate dep; + +fn main() { + unsafe { + let v = dep::my_function(); + if cfg!(foo) { + assert_eq!(v, 1); + } else if cfg!(bar) { + assert_eq!(v, 2); + } else { + panic!("unknown"); + } + } +} diff --git a/tests/run-make/link-cfg/with-staticlib-deps.rs b/tests/run-make/link-cfg/with-staticlib-deps.rs new file mode 100644 index 000000000..23e5926a7 --- /dev/null +++ b/tests/run-make/link-cfg/with-staticlib-deps.rs @@ -0,0 +1,14 @@ +extern crate dep_with_staticlib; + +fn main() { + unsafe { + let v = dep_with_staticlib::my_function(); + if cfg!(foo) { + assert_eq!(v, 1); + } else if cfg!(bar) { + assert_eq!(v, 3); + } else { + panic!("unknown"); + } + } +} diff --git a/tests/run-make/link-dedup/Makefile b/tests/run-make/link-dedup/Makefile new file mode 100644 index 000000000..eff18ab48 --- /dev/null +++ b/tests/run-make/link-dedup/Makefile @@ -0,0 +1,12 @@ +# ignore-msvc + +include ../tools.mk + +all: + $(RUSTC) depa.rs + $(RUSTC) depb.rs + $(RUSTC) depc.rs + $(RUSTC) empty.rs --cfg bar 2>&1 | $(CGREP) '"-ltesta" "-ltestb" "-ltesta"' + $(RUSTC) empty.rs 2>&1 | $(CGREP) '"-ltesta"' + $(RUSTC) empty.rs 2>&1 | $(CGREP) -v '"-ltestb"' + $(RUSTC) empty.rs 2>&1 | $(CGREP) -v '"-ltesta" "-ltesta" "-ltesta"' diff --git a/tests/run-make/link-dedup/depa.rs b/tests/run-make/link-dedup/depa.rs new file mode 100644 index 000000000..19178c5bd --- /dev/null +++ b/tests/run-make/link-dedup/depa.rs @@ -0,0 +1,10 @@ +#![crate_type = "rlib"] + +#[link(name = "testa")] +extern "C" {} + +#[link(name = "testa")] +extern "C" {} + +#[link(name = "testa")] +extern "C" {} diff --git a/tests/run-make/link-dedup/depb.rs b/tests/run-make/link-dedup/depb.rs new file mode 100644 index 000000000..b1be21fe0 --- /dev/null +++ b/tests/run-make/link-dedup/depb.rs @@ -0,0 +1,8 @@ +#![feature(link_cfg)] +#![crate_type = "rlib"] + +#[link(name = "testb", cfg(foo))] +extern "C" {} + +#[link(name = "testb", cfg(bar))] +extern "C" {} diff --git a/tests/run-make/link-dedup/depc.rs b/tests/run-make/link-dedup/depc.rs new file mode 100644 index 000000000..8dcb3dee5 --- /dev/null +++ b/tests/run-make/link-dedup/depc.rs @@ -0,0 +1,4 @@ +#![crate_type = "rlib"] + +#[link(name = "testa")] +extern "C" {} diff --git a/tests/run-make/link-dedup/empty.rs b/tests/run-make/link-dedup/empty.rs new file mode 100644 index 000000000..e00ae18f4 --- /dev/null +++ b/tests/run-make/link-dedup/empty.rs @@ -0,0 +1,5 @@ +extern crate depa; +extern crate depb; +extern crate depc; + +fn main() {} diff --git a/tests/run-make/link-path-order/Makefile b/tests/run-make/link-path-order/Makefile new file mode 100644 index 000000000..a3831a63a --- /dev/null +++ b/tests/run-make/link-path-order/Makefile @@ -0,0 +1,19 @@ +# ignore-cross-compile +include ../tools.mk + +# Verifies that the -L arguments given to the linker is in the same order +# as the -L arguments on the rustc command line. + +CORRECT_DIR=$(TMPDIR)/correct +WRONG_DIR=$(TMPDIR)/wrong + +F := $(call NATIVE_STATICLIB_FILE,foo) + +all: $(call NATIVE_STATICLIB,correct) $(call NATIVE_STATICLIB,wrong) + mkdir -p $(CORRECT_DIR) $(WRONG_DIR) + mv $(call NATIVE_STATICLIB,correct) $(CORRECT_DIR)/$(F) + mv $(call NATIVE_STATICLIB,wrong) $(WRONG_DIR)/$(F) + $(RUSTC) main.rs -o $(TMPDIR)/should_succeed -L $(CORRECT_DIR) -L $(WRONG_DIR) + $(call RUN,should_succeed) + $(RUSTC) main.rs -o $(TMPDIR)/should_fail -L $(WRONG_DIR) -L $(CORRECT_DIR) + $(call FAIL,should_fail) diff --git a/tests/run-make/link-path-order/correct.c b/tests/run-make/link-path-order/correct.c new file mode 100644 index 000000000..3064af952 --- /dev/null +++ b/tests/run-make/link-path-order/correct.c @@ -0,0 +1 @@ +int should_return_one() { return 1; } diff --git a/tests/run-make/link-path-order/main.rs b/tests/run-make/link-path-order/main.rs new file mode 100644 index 000000000..8024e343d --- /dev/null +++ b/tests/run-make/link-path-order/main.rs @@ -0,0 +1,16 @@ +#![feature(rustc_private)] + +extern crate libc; + +#[link(name = "foo", kind = "static")] +extern "C" { + fn should_return_one() -> libc::c_int; +} + +fn main() { + let result = unsafe { should_return_one() }; + + if result != 1 { + std::process::exit(255); + } +} diff --git a/tests/run-make/link-path-order/wrong.c b/tests/run-make/link-path-order/wrong.c new file mode 100644 index 000000000..64275b3ad --- /dev/null +++ b/tests/run-make/link-path-order/wrong.c @@ -0,0 +1 @@ +int should_return_one() { return 0; } diff --git a/tests/run-make/linkage-attr-on-static/Makefile b/tests/run-make/linkage-attr-on-static/Makefile new file mode 100644 index 000000000..ef50a7ef9 --- /dev/null +++ b/tests/run-make/linkage-attr-on-static/Makefile @@ -0,0 +1,6 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(call NATIVE_STATICLIB,foo) + $(RUSTC) bar.rs + $(call RUN,bar) || exit 1 diff --git a/tests/run-make/linkage-attr-on-static/bar.rs b/tests/run-make/linkage-attr-on-static/bar.rs new file mode 100644 index 000000000..68607cbb6 --- /dev/null +++ b/tests/run-make/linkage-attr-on-static/bar.rs @@ -0,0 +1,16 @@ +#![feature(linkage)] + +#[no_mangle] +#[linkage = "external"] +static BAZ: i32 = 21; + +#[link(name = "foo", kind = "static")] +extern "C" { + fn what() -> i32; +} + +fn main() { + unsafe { + assert_eq!(what(), BAZ); + } +} diff --git a/tests/run-make/linkage-attr-on-static/foo.c b/tests/run-make/linkage-attr-on-static/foo.c new file mode 100644 index 000000000..78a6934f5 --- /dev/null +++ b/tests/run-make/linkage-attr-on-static/foo.c @@ -0,0 +1,7 @@ +#include + +extern int32_t BAZ; + +int32_t what() { + return BAZ; +} diff --git a/tests/run-make/llvm-outputs/Makefile b/tests/run-make/llvm-outputs/Makefile index a3f25eba0..cccf1dd66 100644 --- a/tests/run-make/llvm-outputs/Makefile +++ b/tests/run-make/llvm-outputs/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk all: echo 'fn main() {}' | $(BARE_RUSTC) - --out-dir=$(TMPDIR)/random_directory_that_does_not_exist_ir/ --emit=llvm-ir diff --git a/tests/run-make/long-linker-command-lines-cmd-exe/Makefile b/tests/run-make/long-linker-command-lines-cmd-exe/Makefile new file mode 100644 index 000000000..e43aab7f8 --- /dev/null +++ b/tests/run-make/long-linker-command-lines-cmd-exe/Makefile @@ -0,0 +1,7 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) foo.rs -g + cp foo.bat $(TMPDIR)/ + OUT_DIR="$(TMPDIR)" RUSTC="$(RUSTC_ORIGINAL)" $(call RUN,foo) diff --git a/tests/run-make/long-linker-command-lines-cmd-exe/foo.bat b/tests/run-make/long-linker-command-lines-cmd-exe/foo.bat new file mode 100644 index 000000000..a9350f12b --- /dev/null +++ b/tests/run-make/long-linker-command-lines-cmd-exe/foo.bat @@ -0,0 +1 @@ +%MY_LINKER% %* diff --git a/tests/run-make/long-linker-command-lines-cmd-exe/foo.rs b/tests/run-make/long-linker-command-lines-cmd-exe/foo.rs new file mode 100644 index 000000000..74d7b9b07 --- /dev/null +++ b/tests/run-make/long-linker-command-lines-cmd-exe/foo.rs @@ -0,0 +1,101 @@ +// Like the `long-linker-command-lines` test this test attempts to blow +// a command line limit for running the linker. Unlike that test, however, +// this test is testing `cmd.exe` specifically rather than the OS. +// +// Unfortunately `cmd.exe` has a 8192 limit which is relatively small +// in the grand scheme of things and anyone sripting rustc's linker +// is probably using a `*.bat` script and is likely to hit this limit. +// +// This test uses a `foo.bat` script as the linker which just simply +// delegates back to this program. The compiler should use a lower +// limit for arguments before passing everything via `@`, which +// means that everything should still succeed here. + +use std::env; +use std::fs::{self, File}; +use std::io::{BufWriter, Write, Read}; +use std::path::PathBuf; +use std::process::Command; + +fn main() { + if !cfg!(windows) { + return + } + + let tmpdir = PathBuf::from(env::var_os("OUT_DIR").unwrap()); + let ok = tmpdir.join("ok"); + let not_ok = tmpdir.join("not_ok"); + if env::var("YOU_ARE_A_LINKER").is_ok() { + match env::args_os().find(|a| a.to_string_lossy().contains("@")) { + Some(file) => { + let file = file.to_str().unwrap(); + fs::copy(&file[1..], &ok).unwrap(); + } + None => { File::create(¬_ok).unwrap(); } + } + return + } + + let rustc = env::var_os("RUSTC").unwrap_or("rustc".into()); + let me = env::current_exe().unwrap(); + let bat = me.parent() + .unwrap() + .join("foo.bat"); + let bat_linker = format!("linker={}", bat.display()); + for i in (1..).map(|i| i * 10) { + println!("attempt: {}", i); + + let file = tmpdir.join("bar.rs"); + let mut f = BufWriter::new(File::create(&file).unwrap()); + let mut lib_name = String::new(); + for _ in 0..i { + lib_name.push_str("foo"); + } + for j in 0..i { + writeln!(f, "#[link(name = \"{}{}\")]", lib_name, j).unwrap(); + } + writeln!(f, "extern {{}}\nfn main() {{}}").unwrap(); + f.into_inner().unwrap(); + + drop(fs::remove_file(&ok)); + drop(fs::remove_file(¬_ok)); + let status = Command::new(&rustc) + .arg(&file) + .arg("-C").arg(&bat_linker) + .arg("--out-dir").arg(&tmpdir) + .env("YOU_ARE_A_LINKER", "1") + .env("MY_LINKER", &me) + .status() + .unwrap(); + + if !status.success() { + panic!("rustc didn't succeed: {}", status); + } + + if !ok.exists() { + assert!(not_ok.exists()); + continue + } + + let mut contents = Vec::new(); + File::open(&ok).unwrap().read_to_end(&mut contents).unwrap(); + + for j in 0..i { + let exp = format!("{}{}", lib_name, j); + let exp = if cfg!(target_env = "msvc") { + let mut out = Vec::with_capacity(exp.len() * 2); + for c in exp.encode_utf16() { + // encode in little endian + out.push(c as u8); + out.push((c >> 8) as u8); + } + out + } else { + exp.into_bytes() + }; + assert!(contents.windows(exp.len()).any(|w| w == &exp[..])); + } + + break + } +} diff --git a/tests/run-make/long-linker-command-lines/Makefile b/tests/run-make/long-linker-command-lines/Makefile new file mode 100644 index 000000000..f864ea74f --- /dev/null +++ b/tests/run-make/long-linker-command-lines/Makefile @@ -0,0 +1,6 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) foo.rs -g -O + RUSTC="$(RUSTC_ORIGINAL)" $(call RUN,foo) diff --git a/tests/run-make/long-linker-command-lines/foo.rs b/tests/run-make/long-linker-command-lines/foo.rs new file mode 100644 index 000000000..db238c0cf --- /dev/null +++ b/tests/run-make/long-linker-command-lines/foo.rs @@ -0,0 +1,106 @@ +// This is a test which attempts to blow out the system limit with how many +// arguments can be passed to a process. This'll successively call rustc with +// larger and larger argument lists in an attempt to find one that's way too +// big for the system at hand. This file itself is then used as a "linker" to +// detect when the process creation succeeds. +// +// Eventually we should see an argument that looks like `@` as we switch from +// passing literal arguments to passing everything in the file. + +use std::collections::HashSet; +use std::env; +use std::fs::{self, File}; +use std::io::{BufWriter, Write}; +use std::path::{Path, PathBuf}; +use std::process::Command; + +fn write_test_case(file: &Path, n: usize) -> HashSet { + let mut libs = HashSet::new(); + let mut f = BufWriter::new(File::create(&file).unwrap()); + let mut prefix = String::new(); + for _ in 0..n { + prefix.push_str("foo"); + } + for i in 0..n { + writeln!(f, "#[link(name = \"S{}{}S\")]", prefix, i).unwrap(); + libs.insert(format!("{}{}", prefix, i)); + } + writeln!(f, "extern \"C\" {{}}\nfn main() {{}}").unwrap(); + f.into_inner().unwrap(); + + libs +} + +fn read_linker_args(path: &Path) -> String { + let contents = fs::read(path).unwrap(); + if cfg!(target_env = "msvc") { + let mut i = contents.chunks(2).map(|c| { + c[0] as u16 | ((c[1] as u16) << 8) + }); + assert_eq!(i.next(), Some(0xfeff), "Expected UTF-16 BOM"); + String::from_utf16(&i.collect::>()).unwrap() + } else { + String::from_utf8(contents).unwrap() + } +} + +fn main() { + let tmpdir = PathBuf::from(env::var_os("TMPDIR").unwrap()); + let ok = tmpdir.join("ok"); + if env::var("YOU_ARE_A_LINKER").is_ok() { + if let Some(file) = env::args_os().find(|a| a.to_string_lossy().contains("@")) { + let file = file.to_str().expect("non-utf8 file argument"); + fs::copy(&file[1..], &ok).unwrap(); + } + return + } + + let rustc = env::var_os("RUSTC").unwrap_or("rustc".into()); + let me_as_linker = format!("linker={}", env::current_exe().unwrap().display()); + for i in (1..).map(|i| i * 100) { + println!("attempt: {}", i); + let file = tmpdir.join("bar.rs"); + let mut expected_libs = write_test_case(&file, i); + + drop(fs::remove_file(&ok)); + let output = Command::new(&rustc) + .arg(&file) + .arg("-C").arg(&me_as_linker) + .arg("--out-dir").arg(&tmpdir) + .env("YOU_ARE_A_LINKER", "1") + .output() + .unwrap(); + + if !output.status.success() { + let stderr = String::from_utf8_lossy(&output.stderr); + panic!("status: {}\nstdout:\n{}\nstderr:\n{}", + output.status, + String::from_utf8_lossy(&output.stdout), + stderr.lines().map(|l| { + if l.len() > 200 { + format!("{}...\n", &l[..200]) + } else { + format!("{}\n", l) + } + }).collect::()); + } + + if !ok.exists() { + continue + } + + let linker_args = read_linker_args(&ok); + for arg in linker_args.split('S') { + expected_libs.remove(arg); + } + + assert!( + expected_libs.is_empty(), + "expected but missing libraries: {:#?}\nlinker arguments: \n{}", + expected_libs, + linker_args, + ); + + break + } +} diff --git a/tests/run-make/longjmp-across-rust/Makefile b/tests/run-make/longjmp-across-rust/Makefile new file mode 100644 index 000000000..5fd2d4f85 --- /dev/null +++ b/tests/run-make/longjmp-across-rust/Makefile @@ -0,0 +1,6 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(call NATIVE_STATICLIB,foo) + $(RUSTC) main.rs + $(call RUN,main) diff --git a/tests/run-make/longjmp-across-rust/foo.c b/tests/run-make/longjmp-across-rust/foo.c new file mode 100644 index 000000000..bd71cc4d7 --- /dev/null +++ b/tests/run-make/longjmp-across-rust/foo.c @@ -0,0 +1,18 @@ +#include +#include + +static jmp_buf ENV; + +extern void test_middle(); + +void test_start(void(*f)()) { + if (setjmp(ENV) != 0) + return; + f(); + assert(0); +} + +void test_end() { + longjmp(ENV, 1); + assert(0); +} diff --git a/tests/run-make/longjmp-across-rust/main.rs b/tests/run-make/longjmp-across-rust/main.rs new file mode 100644 index 000000000..cc1d5b126 --- /dev/null +++ b/tests/run-make/longjmp-across-rust/main.rs @@ -0,0 +1,29 @@ +#[link(name = "foo", kind = "static")] +extern "C" { + fn test_start(f: extern "C" fn()); + fn test_end(); +} + +fn main() { + unsafe { + test_start(test_middle); + } +} + +struct A; + +impl Drop for A { + fn drop(&mut self) {} +} + +extern "C" fn test_middle() { + let _a = A; + foo(); +} + +fn foo() { + let _a = A; + unsafe { + test_end(); + } +} diff --git a/tests/run-make/ls-metadata/Makefile b/tests/run-make/ls-metadata/Makefile new file mode 100644 index 000000000..123dd64e1 --- /dev/null +++ b/tests/run-make/ls-metadata/Makefile @@ -0,0 +1,8 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) foo.rs + $(RUSTC) -Z ls $(TMPDIR)/foo + touch $(TMPDIR)/bar + $(RUSTC) -Z ls $(TMPDIR)/bar diff --git a/tests/run-make/ls-metadata/foo.rs b/tests/run-make/ls-metadata/foo.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/tests/run-make/ls-metadata/foo.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/lto-dylib-dep/Makefile b/tests/run-make/lto-dylib-dep/Makefile new file mode 100644 index 000000000..a9344597d --- /dev/null +++ b/tests/run-make/lto-dylib-dep/Makefile @@ -0,0 +1,11 @@ +# ignore-cross-compile +include ../tools.mk + +# Test that we don't run into an assertion when using a Rust dylib dependency +# while compiling with full LTO. +# See https://github.com/rust-lang/rust/issues/59137 + +all: + $(RUSTC) a_dylib.rs --crate-type=dylib -C prefer-dynamic + $(RUSTC) main.rs -C lto + $(call RUN,main) diff --git a/tests/run-make/lto-dylib-dep/a_dylib.rs b/tests/run-make/lto-dylib-dep/a_dylib.rs new file mode 100644 index 000000000..e63457e6e --- /dev/null +++ b/tests/run-make/lto-dylib-dep/a_dylib.rs @@ -0,0 +1,3 @@ +pub fn foo() { + println!("bar"); +} diff --git a/tests/run-make/lto-dylib-dep/main.rs b/tests/run-make/lto-dylib-dep/main.rs new file mode 100644 index 000000000..4fb3c4730 --- /dev/null +++ b/tests/run-make/lto-dylib-dep/main.rs @@ -0,0 +1,5 @@ +extern crate a_dylib; + +fn main() { + a_dylib::foo(); +} diff --git a/tests/run-make/lto-empty/Makefile b/tests/run-make/lto-empty/Makefile new file mode 100644 index 000000000..1b795c4b7 --- /dev/null +++ b/tests/run-make/lto-empty/Makefile @@ -0,0 +1,13 @@ +# ignore-cross-compile +include ../tools.mk + +all: cdylib-fat cdylib-thin + +cdylib-fat: + $(RUSTC) lib.rs -C lto=fat -C opt-level=3 -C incremental=$(TMPDIR)/inc-fat + $(RUSTC) lib.rs -C lto=fat -C opt-level=3 -C incremental=$(TMPDIR)/inc-fat + +cdylib-thin: + $(RUSTC) lib.rs -C lto=thin -C opt-level=3 -C incremental=$(TMPDIR)/inc-thin + $(RUSTC) lib.rs -C lto=thin -C opt-level=3 -C incremental=$(TMPDIR)/inc-thin + diff --git a/tests/run-make/lto-empty/lib.rs b/tests/run-make/lto-empty/lib.rs new file mode 100644 index 000000000..e3663c790 --- /dev/null +++ b/tests/run-make/lto-empty/lib.rs @@ -0,0 +1 @@ +#![crate_type = "cdylib"] diff --git a/tests/run-make/lto-no-link-whole-rlib/Makefile b/tests/run-make/lto-no-link-whole-rlib/Makefile new file mode 100644 index 000000000..3e82322e7 --- /dev/null +++ b/tests/run-make/lto-no-link-whole-rlib/Makefile @@ -0,0 +1,9 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(call NATIVE_STATICLIB,foo) $(call NATIVE_STATICLIB,bar) + $(RUSTC) lib1.rs + $(RUSTC) lib2.rs + $(RUSTC) main.rs -Clto + $(call RUN,main) + diff --git a/tests/run-make/lto-no-link-whole-rlib/bar.c b/tests/run-make/lto-no-link-whole-rlib/bar.c new file mode 100644 index 000000000..b25011930 --- /dev/null +++ b/tests/run-make/lto-no-link-whole-rlib/bar.c @@ -0,0 +1,3 @@ +int foo() { + return 2; +} diff --git a/tests/run-make/lto-no-link-whole-rlib/foo.c b/tests/run-make/lto-no-link-whole-rlib/foo.c new file mode 100644 index 000000000..75010458e --- /dev/null +++ b/tests/run-make/lto-no-link-whole-rlib/foo.c @@ -0,0 +1,3 @@ +int foo() { + return 1; +} diff --git a/tests/run-make/lto-no-link-whole-rlib/lib1.rs b/tests/run-make/lto-no-link-whole-rlib/lib1.rs new file mode 100644 index 000000000..f70bb3382 --- /dev/null +++ b/tests/run-make/lto-no-link-whole-rlib/lib1.rs @@ -0,0 +1,10 @@ +#![crate_type = "rlib"] + +#[link(name = "foo", kind = "static")] +extern "C" { + fn foo() -> i32; +} + +pub fn foo1() -> i32 { + unsafe { foo() } +} diff --git a/tests/run-make/lto-no-link-whole-rlib/lib2.rs b/tests/run-make/lto-no-link-whole-rlib/lib2.rs new file mode 100644 index 000000000..2dec2a271 --- /dev/null +++ b/tests/run-make/lto-no-link-whole-rlib/lib2.rs @@ -0,0 +1,12 @@ +#![crate_type = "rlib"] + +extern crate lib1; + +#[link(name = "bar", kind = "static")] +extern "C" { + fn foo() -> i32; +} + +pub fn foo2() -> i32 { + unsafe { foo() } +} diff --git a/tests/run-make/lto-no-link-whole-rlib/main.rs b/tests/run-make/lto-no-link-whole-rlib/main.rs new file mode 100644 index 000000000..0c658808e --- /dev/null +++ b/tests/run-make/lto-no-link-whole-rlib/main.rs @@ -0,0 +1,7 @@ +extern crate lib1; +extern crate lib2; + +fn main() { + assert_eq!(lib1::foo1(), 2); + assert_eq!(lib2::foo2(), 2); +} diff --git a/tests/run-make/lto-readonly-lib/Makefile b/tests/run-make/lto-readonly-lib/Makefile new file mode 100644 index 000000000..11d944e3e --- /dev/null +++ b/tests/run-make/lto-readonly-lib/Makefile @@ -0,0 +1,13 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) lib.rs + + # the compiler needs to copy and modify the rlib file when performing + # LTO, so we should ensure that it can cope with the original rlib + # being read-only. + chmod 444 $(TMPDIR)/*.rlib + + $(RUSTC) main.rs -C lto + $(call RUN,main) diff --git a/tests/run-make/lto-readonly-lib/lib.rs b/tests/run-make/lto-readonly-lib/lib.rs new file mode 100644 index 000000000..c1bfaa6ca --- /dev/null +++ b/tests/run-make/lto-readonly-lib/lib.rs @@ -0,0 +1 @@ +#![crate_type = "rlib"] diff --git a/tests/run-make/lto-readonly-lib/main.rs b/tests/run-make/lto-readonly-lib/main.rs new file mode 100644 index 000000000..69da798b3 --- /dev/null +++ b/tests/run-make/lto-readonly-lib/main.rs @@ -0,0 +1,3 @@ +extern crate lib; + +fn main() {} diff --git a/tests/run-make/lto-smoke-c/Makefile b/tests/run-make/lto-smoke-c/Makefile new file mode 100644 index 000000000..f1ba3d95d --- /dev/null +++ b/tests/run-make/lto-smoke-c/Makefile @@ -0,0 +1,12 @@ +# ignore-cross-compile +include ../tools.mk + +# Apparently older versions of GCC segfault if -g is passed... +CC := $(CC:-g=) + +all: + $(RUSTC) foo.rs -C lto + $(CC) bar.c $(call STATICLIB,foo) \ + $(call OUT_EXE,bar) \ + $(EXTRACFLAGS) $(EXTRACXXFLAGS) + $(call RUN,bar) diff --git a/tests/run-make/lto-smoke-c/bar.c b/tests/run-make/lto-smoke-c/bar.c new file mode 100644 index 000000000..bb4036b06 --- /dev/null +++ b/tests/run-make/lto-smoke-c/bar.c @@ -0,0 +1,6 @@ +void foo(); + +int main() { + foo(); + return 0; +} diff --git a/tests/run-make/lto-smoke-c/foo.rs b/tests/run-make/lto-smoke-c/foo.rs new file mode 100644 index 000000000..2e59432cd --- /dev/null +++ b/tests/run-make/lto-smoke-c/foo.rs @@ -0,0 +1,4 @@ +#![crate_type = "staticlib"] + +#[no_mangle] +pub extern "C" fn foo() {} diff --git a/tests/run-make/lto-smoke/Makefile b/tests/run-make/lto-smoke/Makefile new file mode 100644 index 000000000..13a09fce7 --- /dev/null +++ b/tests/run-make/lto-smoke/Makefile @@ -0,0 +1,31 @@ +# ignore-cross-compile +include ../tools.mk + +all: noparam bool_true bool_false thin fat + +noparam: + $(RUSTC) lib.rs + $(RUSTC) main.rs -C lto + $(call RUN,main) + +bool_true: + $(RUSTC) lib.rs + $(RUSTC) main.rs -C lto=yes + $(call RUN,main) + + +bool_false: + $(RUSTC) lib.rs + $(RUSTC) main.rs -C lto=off + $(call RUN,main) + +thin: + $(RUSTC) lib.rs + $(RUSTC) main.rs -C lto=thin + $(call RUN,main) + +fat: + $(RUSTC) lib.rs + $(RUSTC) main.rs -C lto=fat + $(call RUN,main) + diff --git a/tests/run-make/lto-smoke/lib.rs b/tests/run-make/lto-smoke/lib.rs new file mode 100644 index 000000000..c1bfaa6ca --- /dev/null +++ b/tests/run-make/lto-smoke/lib.rs @@ -0,0 +1 @@ +#![crate_type = "rlib"] diff --git a/tests/run-make/lto-smoke/main.rs b/tests/run-make/lto-smoke/main.rs new file mode 100644 index 000000000..69da798b3 --- /dev/null +++ b/tests/run-make/lto-smoke/main.rs @@ -0,0 +1,3 @@ +extern crate lib; + +fn main() {} diff --git a/tests/run-make/macos-deployment-target/Makefile b/tests/run-make/macos-deployment-target/Makefile index 70fca0436..d0cf836bc 100644 --- a/tests/run-make/macos-deployment-target/Makefile +++ b/tests/run-make/macos-deployment-target/Makefile @@ -4,7 +4,7 @@ # This is important since its a compatibility hazard. The linker will # generate load commands differently based on what minimum OS it can assume. -include ../../run-make-fulldeps/tools.mk +include ../tools.mk ifeq ($(strip $(shell uname -m)),arm64) GREP_PATTERN = "minos 11.0" diff --git a/tests/run-make/macos-fat-archive/Makefile b/tests/run-make/macos-fat-archive/Makefile index cc99375db..b6582c809 100644 --- a/tests/run-make/macos-fat-archive/Makefile +++ b/tests/run-make/macos-fat-archive/Makefile @@ -1,6 +1,6 @@ # only-macos --include ../../run-make-fulldeps/tools.mk +include ../tools.mk "$(TMPDIR)"/libnative-library.a: native-library.c $(CC) -arch arm64 -arch x86_64 native-library.c -c -o "$(TMPDIR)"/native-library.o diff --git a/tests/run-make/manual-crate-name/Makefile b/tests/run-make/manual-crate-name/Makefile new file mode 100644 index 000000000..c00e20c7c --- /dev/null +++ b/tests/run-make/manual-crate-name/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + $(RUSTC) --crate-name foo bar.rs + rm $(TMPDIR)/libfoo.rlib diff --git a/tests/run-make/manual-crate-name/bar.rs b/tests/run-make/manual-crate-name/bar.rs new file mode 100644 index 000000000..c1bfaa6ca --- /dev/null +++ b/tests/run-make/manual-crate-name/bar.rs @@ -0,0 +1 @@ +#![crate_type = "rlib"] diff --git a/tests/run-make/manual-link/Makefile b/tests/run-make/manual-link/Makefile new file mode 100644 index 000000000..8dbf0460f --- /dev/null +++ b/tests/run-make/manual-link/Makefile @@ -0,0 +1,7 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(TMPDIR)/libbar.a + $(RUSTC) foo.rs -lstatic=bar + $(RUSTC) main.rs + $(call RUN,main) diff --git a/tests/run-make/manual-link/bar.c b/tests/run-make/manual-link/bar.c new file mode 100644 index 000000000..e42599986 --- /dev/null +++ b/tests/run-make/manual-link/bar.c @@ -0,0 +1 @@ +void bar() {} diff --git a/tests/run-make/manual-link/foo.c b/tests/run-make/manual-link/foo.c new file mode 100644 index 000000000..e42599986 --- /dev/null +++ b/tests/run-make/manual-link/foo.c @@ -0,0 +1 @@ +void bar() {} diff --git a/tests/run-make/manual-link/foo.rs b/tests/run-make/manual-link/foo.rs new file mode 100644 index 000000000..c1f28236f --- /dev/null +++ b/tests/run-make/manual-link/foo.rs @@ -0,0 +1,11 @@ +#![crate_type = "rlib"] + +extern "C" { + fn bar(); +} + +pub fn foo() { + unsafe { + bar(); + } +} diff --git a/tests/run-make/manual-link/main.rs b/tests/run-make/manual-link/main.rs new file mode 100644 index 000000000..fe35f1f8e --- /dev/null +++ b/tests/run-make/manual-link/main.rs @@ -0,0 +1,5 @@ +extern crate foo; + +fn main() { + foo::foo(); +} diff --git a/tests/run-make/many-crates-but-no-match/Makefile b/tests/run-make/many-crates-but-no-match/Makefile new file mode 100644 index 000000000..ca0ab8e9e --- /dev/null +++ b/tests/run-make/many-crates-but-no-match/Makefile @@ -0,0 +1,35 @@ +include ../tools.mk + +# Modelled after ui/changing-crates.rs test, but this one puts +# more than one (mismatching) candidate crate into the search path, +# which did not appear directly expressible in UI testing infrastructure. +# +# Note that we move the built libraries into target direcrtories rather than +# use the `--out-dir` option because the `../tools.mk` file already bakes a +# use of `--out-dir` into the definition of $(RUSTC). + +A1=$(TMPDIR)/a1 +A2=$(TMPDIR)/a2 +A3=$(TMPDIR)/a3 + +# A hack to match distinct lines of output from a single run. +LOG=$(TMPDIR)/log.txt + +all: + mkdir -p $(A1) $(A2) $(A3) + $(RUSTC) --crate-type=rlib crateA1.rs + mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A1) + $(RUSTC) --crate-type=rlib -L $(A1) crateB.rs + $(RUSTC) --crate-type=rlib crateA2.rs + mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A2) + $(RUSTC) --crate-type=rlib crateA3.rs + mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A3) + # Ensure crateC fails to compile since A1 is "missing" and A2/A3 hashes do not match + $(RUSTC) -L $(A2) -L $(A3) crateC.rs >$(LOG) 2>&1 || true + $(CGREP) \ + 'found possibly newer version of crate `crateA` which `crateB` depends on' \ + 'note: perhaps that crate needs to be recompiled?' \ + 'crate `crateA`:' \ + 'crate `crateB`:' \ + < $(LOG) + # the 'crate `crateA`' will match two entries. diff --git a/tests/run-make/many-crates-but-no-match/crateA1.rs b/tests/run-make/many-crates-but-no-match/crateA1.rs new file mode 100644 index 000000000..3fed5a38e --- /dev/null +++ b/tests/run-make/many-crates-but-no-match/crateA1.rs @@ -0,0 +1,4 @@ +#![crate_name="crateA"] + +// Base crate +pub fn func() {} diff --git a/tests/run-make/many-crates-but-no-match/crateA2.rs b/tests/run-make/many-crates-but-no-match/crateA2.rs new file mode 100644 index 000000000..8db07a015 --- /dev/null +++ b/tests/run-make/many-crates-but-no-match/crateA2.rs @@ -0,0 +1,4 @@ +#![crate_name="crateA"] + +// Base crate +pub fn func() { println!("hello"); } diff --git a/tests/run-make/many-crates-but-no-match/crateA3.rs b/tests/run-make/many-crates-but-no-match/crateA3.rs new file mode 100644 index 000000000..a1e8e40a3 --- /dev/null +++ b/tests/run-make/many-crates-but-no-match/crateA3.rs @@ -0,0 +1,4 @@ +#![crate_name="crateA"] + +// Base crate +pub fn foo() { println!("world!"); } diff --git a/tests/run-make/many-crates-but-no-match/crateB.rs b/tests/run-make/many-crates-but-no-match/crateB.rs new file mode 100644 index 000000000..4ccd65d65 --- /dev/null +++ b/tests/run-make/many-crates-but-no-match/crateB.rs @@ -0,0 +1 @@ +extern crate crateA; diff --git a/tests/run-make/many-crates-but-no-match/crateC.rs b/tests/run-make/many-crates-but-no-match/crateC.rs new file mode 100644 index 000000000..a8b817ec6 --- /dev/null +++ b/tests/run-make/many-crates-but-no-match/crateC.rs @@ -0,0 +1,3 @@ +extern crate crateB; + +fn main() {} diff --git a/tests/run-make/metadata-flag-frobs-symbols/Makefile b/tests/run-make/metadata-flag-frobs-symbols/Makefile new file mode 100644 index 000000000..53d7d0657 --- /dev/null +++ b/tests/run-make/metadata-flag-frobs-symbols/Makefile @@ -0,0 +1,11 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) foo.rs -C metadata=a -C extra-filename=-a + $(RUSTC) foo.rs -C metadata=b -C extra-filename=-b + $(RUSTC) bar.rs \ + --extern foo1=$(TMPDIR)/libfoo-a.rlib \ + --extern foo2=$(TMPDIR)/libfoo-b.rlib \ + --print link-args + $(call RUN,bar) diff --git a/tests/run-make/metadata-flag-frobs-symbols/bar.rs b/tests/run-make/metadata-flag-frobs-symbols/bar.rs new file mode 100644 index 000000000..1e6957a36 --- /dev/null +++ b/tests/run-make/metadata-flag-frobs-symbols/bar.rs @@ -0,0 +1,8 @@ +extern crate foo1; +extern crate foo2; + +fn main() { + let a = foo1::foo(); + let b = foo2::foo(); + assert!(a as *const _ != b as *const _); +} diff --git a/tests/run-make/metadata-flag-frobs-symbols/foo.rs b/tests/run-make/metadata-flag-frobs-symbols/foo.rs new file mode 100644 index 000000000..696aed2fa --- /dev/null +++ b/tests/run-make/metadata-flag-frobs-symbols/foo.rs @@ -0,0 +1,6 @@ +#![crate_name = "foo"] +#![crate_type = "rlib"] + +static FOO: usize = 3; + +pub fn foo() -> &'static usize { &FOO } diff --git a/tests/run-make/min-global-align/Makefile b/tests/run-make/min-global-align/Makefile new file mode 100644 index 000000000..82f38749e --- /dev/null +++ b/tests/run-make/min-global-align/Makefile @@ -0,0 +1,22 @@ +include ../tools.mk + +# only-linux + +# This tests ensure that global variables respect the target minimum alignment. +# The three bools `STATIC_BOOL`, `STATIC_MUT_BOOL`, and `CONST_BOOL` all have +# type-alignment of 1, but some targets require greater global alignment. + +SRC = min_global_align.rs +LL = $(TMPDIR)/min_global_align.ll + +all: +# Most targets are happy with default alignment -- take i686 for example. +ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86) + $(RUSTC) --target=i686-unknown-linux-gnu --emit=llvm-ir $(SRC) + [ "$$(grep -c 'align 1' "$(LL)")" -eq "3" ] +endif +# SystemZ requires even alignment for PC-relative addressing. +ifeq ($(filter systemz,$(LLVM_COMPONENTS)),systemz) + $(RUSTC) --target=s390x-unknown-linux-gnu --emit=llvm-ir $(SRC) + [ "$$(grep -c 'align 2' "$(LL)")" -eq "3" ] +endif diff --git a/tests/run-make/min-global-align/min_global_align.rs b/tests/run-make/min-global-align/min_global_align.rs new file mode 100644 index 000000000..135792e93 --- /dev/null +++ b/tests/run-make/min-global-align/min_global_align.rs @@ -0,0 +1,32 @@ +#![feature(no_core, lang_items)] +#![crate_type = "rlib"] +#![no_core] + +pub static STATIC_BOOL: bool = true; + +pub static mut STATIC_MUT_BOOL: bool = true; + +const CONST_BOOL: bool = true; +pub static CONST_BOOL_REF: &'static bool = &CONST_BOOL; + +#[lang = "sized"] +trait Sized {} + +#[lang = "copy"] +trait Copy {} +impl Copy for bool {} +impl Copy for &bool {} + +#[lang = "freeze"] +trait Freeze {} + +// No `UnsafeCell`, so everything is `Freeze`. +impl Freeze for T {} + +#[lang = "sync"] +trait Sync {} +impl Sync for bool {} +impl Sync for &'static bool {} + +#[lang = "drop_in_place"] +pub unsafe fn drop_in_place(_: *mut T) {} diff --git a/tests/run-make/mingw-export-call-convention/Makefile b/tests/run-make/mingw-export-call-convention/Makefile new file mode 100644 index 000000000..4a60059cc --- /dev/null +++ b/tests/run-make/mingw-export-call-convention/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +# only-windows-gnu + +all: + $(RUSTC) foo.rs + # FIXME: we should make sure __stdcall calling convention is used here + # but that only works with LLD right now + nm -g "$(call IMPLIB,foo)" | $(CGREP) bar diff --git a/tests/run-make/mingw-export-call-convention/foo.rs b/tests/run-make/mingw-export-call-convention/foo.rs new file mode 100644 index 000000000..1fec00311 --- /dev/null +++ b/tests/run-make/mingw-export-call-convention/foo.rs @@ -0,0 +1,4 @@ +#![crate_type = "cdylib"] + +#[no_mangle] +pub extern "system" fn bar() {} diff --git a/tests/run-make/mismatching-target-triples/Makefile b/tests/run-make/mismatching-target-triples/Makefile new file mode 100644 index 000000000..409388e04 --- /dev/null +++ b/tests/run-make/mismatching-target-triples/Makefile @@ -0,0 +1,11 @@ +include ../tools.mk + +# Issue #10814 +# +# these are no_std to avoid having to have the standard library or any +# linkers/assemblers for the relevant platform + +all: + $(RUSTC) foo.rs --target=i686-unknown-linux-gnu + $(RUSTC) bar.rs --target=x86_64-unknown-linux-gnu 2>&1 \ + | $(CGREP) 'couldn'"'"'t find crate `foo` with expected target triple x86_64-unknown-linux-gnu' diff --git a/tests/run-make/mismatching-target-triples/bar.rs b/tests/run-make/mismatching-target-triples/bar.rs new file mode 100644 index 000000000..b2c2fc1c4 --- /dev/null +++ b/tests/run-make/mismatching-target-triples/bar.rs @@ -0,0 +1,3 @@ +#![feature(no_core)] +#![no_core] +extern crate foo; diff --git a/tests/run-make/mismatching-target-triples/foo.rs b/tests/run-make/mismatching-target-triples/foo.rs new file mode 100644 index 000000000..6fa054914 --- /dev/null +++ b/tests/run-make/mismatching-target-triples/foo.rs @@ -0,0 +1,3 @@ +#![feature(no_core)] +#![no_core] +#![crate_type = "lib"] diff --git a/tests/run-make/missing-crate-dependency/Makefile b/tests/run-make/missing-crate-dependency/Makefile new file mode 100644 index 000000000..7c271ab8a --- /dev/null +++ b/tests/run-make/missing-crate-dependency/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +all: + $(RUSTC) --crate-type=rlib crateA.rs + $(RUSTC) --crate-type=rlib crateB.rs + $(call REMOVE_RLIBS,crateA) + # Ensure crateC fails to compile since dependency crateA is missing + $(RUSTC) crateC.rs 2>&1 | \ + $(CGREP) 'can'"'"'t find crate for `crateA` which `crateB` depends on' diff --git a/tests/run-make/missing-crate-dependency/crateA.rs b/tests/run-make/missing-crate-dependency/crateA.rs new file mode 100644 index 000000000..31433cb60 --- /dev/null +++ b/tests/run-make/missing-crate-dependency/crateA.rs @@ -0,0 +1,2 @@ +// Base crate +pub fn func() {} diff --git a/tests/run-make/missing-crate-dependency/crateB.rs b/tests/run-make/missing-crate-dependency/crateB.rs new file mode 100644 index 000000000..4ccd65d65 --- /dev/null +++ b/tests/run-make/missing-crate-dependency/crateB.rs @@ -0,0 +1 @@ +extern crate crateA; diff --git a/tests/run-make/missing-crate-dependency/crateC.rs b/tests/run-make/missing-crate-dependency/crateC.rs new file mode 100644 index 000000000..a8b817ec6 --- /dev/null +++ b/tests/run-make/missing-crate-dependency/crateC.rs @@ -0,0 +1,3 @@ +extern crate crateB; + +fn main() {} diff --git a/tests/run-make/mixing-deps/Makefile b/tests/run-make/mixing-deps/Makefile new file mode 100644 index 000000000..c2a5a2a0a --- /dev/null +++ b/tests/run-make/mixing-deps/Makefile @@ -0,0 +1,8 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) both.rs -C prefer-dynamic + $(RUSTC) dylib.rs -C prefer-dynamic + $(RUSTC) prog.rs + $(call RUN,prog) diff --git a/tests/run-make/mixing-deps/both.rs b/tests/run-make/mixing-deps/both.rs new file mode 100644 index 000000000..6a5818763 --- /dev/null +++ b/tests/run-make/mixing-deps/both.rs @@ -0,0 +1,4 @@ +#![crate_type = "rlib"] +#![crate_type = "dylib"] + +pub static foo: isize = 4; diff --git a/tests/run-make/mixing-deps/dylib.rs b/tests/run-make/mixing-deps/dylib.rs new file mode 100644 index 000000000..88976d5b6 --- /dev/null +++ b/tests/run-make/mixing-deps/dylib.rs @@ -0,0 +1,6 @@ +#![crate_type = "dylib"] +extern crate both; + +use std::mem; + +pub fn addr() -> usize { unsafe { mem::transmute(&both::foo) } } diff --git a/tests/run-make/mixing-deps/prog.rs b/tests/run-make/mixing-deps/prog.rs new file mode 100644 index 000000000..188981dc1 --- /dev/null +++ b/tests/run-make/mixing-deps/prog.rs @@ -0,0 +1,9 @@ +extern crate dylib; +extern crate both; + +use std::mem; + +fn main() { + assert_eq!(unsafe { mem::transmute::<&isize, usize>(&both::foo) }, + dylib::addr()); +} diff --git a/tests/run-make/mixing-formats/Makefile b/tests/run-make/mixing-formats/Makefile new file mode 100644 index 000000000..d01978a15 --- /dev/null +++ b/tests/run-make/mixing-formats/Makefile @@ -0,0 +1,75 @@ +# ignore-cross-compile +include ../tools.mk + +# Testing various mixings of rlibs and dylibs. Makes sure that it's possible to +# link an rlib to a dylib. The dependency tree among the file looks like: +# +# foo +# / \ +# bar1 bar2 +# / \ / +# baz baz2 +# +# This is generally testing the permutations of the foo/bar1/bar2 layer against +# the baz/baz2 layer + +all: + # Building just baz + $(RUSTC) --crate-type=rlib foo.rs + $(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic + $(RUSTC) --crate-type=dylib,rlib baz.rs -C prefer-dynamic + $(RUSTC) --crate-type=bin baz.rs + rm $(TMPDIR)/* + $(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic + $(RUSTC) --crate-type=rlib bar1.rs + $(RUSTC) --crate-type=dylib,rlib baz.rs -C prefer-dynamic + $(RUSTC) --crate-type=bin baz.rs + rm $(TMPDIR)/* + # Building baz2 + $(RUSTC) --crate-type=rlib foo.rs + $(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic + $(RUSTC) --crate-type=dylib bar2.rs -C prefer-dynamic + $(RUSTC) --crate-type=dylib baz2.rs && exit 1 || exit 0 + $(RUSTC) --crate-type=bin baz2.rs && exit 1 || exit 0 + rm $(TMPDIR)/* + $(RUSTC) --crate-type=rlib foo.rs + $(RUSTC) --crate-type=rlib bar1.rs + $(RUSTC) --crate-type=dylib bar2.rs -C prefer-dynamic + $(RUSTC) --crate-type=dylib,rlib baz2.rs + $(RUSTC) --crate-type=bin baz2.rs + rm $(TMPDIR)/* + $(RUSTC) --crate-type=rlib foo.rs + $(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic + $(RUSTC) --crate-type=rlib bar2.rs + $(RUSTC) --crate-type=dylib,rlib baz2.rs -C prefer-dynamic + $(RUSTC) --crate-type=bin baz2.rs + rm $(TMPDIR)/* + $(RUSTC) --crate-type=rlib foo.rs + $(RUSTC) --crate-type=rlib bar1.rs + $(RUSTC) --crate-type=rlib bar2.rs + $(RUSTC) --crate-type=dylib,rlib baz2.rs -C prefer-dynamic + $(RUSTC) --crate-type=bin baz2.rs + rm $(TMPDIR)/* + $(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic + $(RUSTC) --crate-type=rlib bar1.rs + $(RUSTC) --crate-type=rlib bar2.rs + $(RUSTC) --crate-type=dylib,rlib baz2.rs -C prefer-dynamic + $(RUSTC) --crate-type=bin baz2.rs + rm $(TMPDIR)/* + $(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic + $(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic + $(RUSTC) --crate-type=rlib bar2.rs + $(RUSTC) --crate-type=dylib,rlib baz2.rs + $(RUSTC) --crate-type=bin baz2.rs + rm $(TMPDIR)/* + $(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic + $(RUSTC) --crate-type=rlib bar1.rs + $(RUSTC) --crate-type=dylib bar2.rs -C prefer-dynamic + $(RUSTC) --crate-type=dylib,rlib baz2.rs + $(RUSTC) --crate-type=bin baz2.rs + rm $(TMPDIR)/* + $(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic + $(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic + $(RUSTC) --crate-type=dylib bar2.rs -C prefer-dynamic + $(RUSTC) --crate-type=dylib,rlib baz2.rs + $(RUSTC) --crate-type=bin baz2.rs diff --git a/tests/run-make/mixing-formats/bar1.rs b/tests/run-make/mixing-formats/bar1.rs new file mode 100644 index 000000000..49af74e1b --- /dev/null +++ b/tests/run-make/mixing-formats/bar1.rs @@ -0,0 +1 @@ +extern crate foo; diff --git a/tests/run-make/mixing-formats/bar2.rs b/tests/run-make/mixing-formats/bar2.rs new file mode 100644 index 000000000..49af74e1b --- /dev/null +++ b/tests/run-make/mixing-formats/bar2.rs @@ -0,0 +1 @@ +extern crate foo; diff --git a/tests/run-make/mixing-formats/baz.rs b/tests/run-make/mixing-formats/baz.rs new file mode 100644 index 000000000..99a73159e --- /dev/null +++ b/tests/run-make/mixing-formats/baz.rs @@ -0,0 +1,3 @@ +extern crate bar1; + +fn main() {} diff --git a/tests/run-make/mixing-formats/baz2.rs b/tests/run-make/mixing-formats/baz2.rs new file mode 100644 index 000000000..d0fab1e4c --- /dev/null +++ b/tests/run-make/mixing-formats/baz2.rs @@ -0,0 +1,4 @@ +extern crate bar1; +extern crate bar2; + +fn main() {} diff --git a/tests/run-make/mixing-formats/foo.rs b/tests/run-make/mixing-formats/foo.rs new file mode 100644 index 000000000..d11c69f81 --- /dev/null +++ b/tests/run-make/mixing-formats/foo.rs @@ -0,0 +1 @@ +// intentionally empty diff --git a/tests/run-make/mixing-libs/Makefile b/tests/run-make/mixing-libs/Makefile new file mode 100644 index 000000000..e8262b284 --- /dev/null +++ b/tests/run-make/mixing-libs/Makefile @@ -0,0 +1,10 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) rlib.rs + $(RUSTC) dylib.rs + $(RUSTC) rlib.rs --crate-type=dylib + $(RUSTC) dylib.rs + $(call REMOVE_DYLIBS,rlib) + $(RUSTC) prog.rs && exit 1 || exit 0 diff --git a/tests/run-make/mixing-libs/dylib.rs b/tests/run-make/mixing-libs/dylib.rs new file mode 100644 index 000000000..685688750 --- /dev/null +++ b/tests/run-make/mixing-libs/dylib.rs @@ -0,0 +1,4 @@ +#![crate_type = "dylib"] +extern crate rlib; + +pub fn dylib() { rlib::rlib() } diff --git a/tests/run-make/mixing-libs/prog.rs b/tests/run-make/mixing-libs/prog.rs new file mode 100644 index 000000000..14ce5c951 --- /dev/null +++ b/tests/run-make/mixing-libs/prog.rs @@ -0,0 +1,7 @@ +extern crate dylib; +extern crate rlib; + +fn main() { + dylib::dylib(); + rlib::rlib(); +} diff --git a/tests/run-make/mixing-libs/rlib.rs b/tests/run-make/mixing-libs/rlib.rs new file mode 100644 index 000000000..96dcd16bb --- /dev/null +++ b/tests/run-make/mixing-libs/rlib.rs @@ -0,0 +1,2 @@ +#![crate_type = "rlib"] +pub fn rlib() {} diff --git a/tests/run-make/msvc-opt-minsize/Makefile b/tests/run-make/msvc-opt-minsize/Makefile new file mode 100644 index 000000000..32e6e2801 --- /dev/null +++ b/tests/run-make/msvc-opt-minsize/Makefile @@ -0,0 +1,6 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) foo.rs -Copt-level=z 2>&1 + $(call RUN,foo) diff --git a/tests/run-make/msvc-opt-minsize/foo.rs b/tests/run-make/msvc-opt-minsize/foo.rs new file mode 100644 index 000000000..3f5496c08 --- /dev/null +++ b/tests/run-make/msvc-opt-minsize/foo.rs @@ -0,0 +1,19 @@ +#![feature(test)] +extern crate test; + +fn foo(x: i32, y: i32) -> i64 { + (x + y) as i64 +} + +#[inline(never)] +fn bar() { + let _f = Box::new(0); + // This call used to trigger an LLVM bug in opt-level z where the base + // pointer gets corrupted, see issue #45034 + let y: fn(i32, i32) -> i64 = test::black_box(foo); + test::black_box(y(1, 2)); +} + +fn main() { + bar(); +} diff --git a/tests/run-make/multiple-emits/Makefile b/tests/run-make/multiple-emits/Makefile new file mode 100644 index 000000000..d1f297644 --- /dev/null +++ b/tests/run-make/multiple-emits/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +all: + $(RUSTC) foo.rs --emit=asm,llvm-ir -o $(TMPDIR)/out 2>&1 + rm $(TMPDIR)/out.ll $(TMPDIR)/out.s + $(RUSTC) foo.rs --emit=asm,llvm-ir -o $(TMPDIR)/out2.ext 2>&1 + rm $(TMPDIR)/out2.ll $(TMPDIR)/out2.s diff --git a/tests/run-make/multiple-emits/foo.rs b/tests/run-make/multiple-emits/foo.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/tests/run-make/multiple-emits/foo.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/native-link-modifier-bundle/Makefile b/tests/run-make/native-link-modifier-bundle/Makefile index e8a1121bf..527720922 100644 --- a/tests/run-make/native-link-modifier-bundle/Makefile +++ b/tests/run-make/native-link-modifier-bundle/Makefile @@ -1,7 +1,7 @@ # ignore-cross-compile # ignore-windows-msvc -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # We're using the llvm-nm instead of the system nm to ensure it is compatible # with the LLVM bitcode generated by rustc. diff --git a/tests/run-make/native-link-modifier-verbatim-linker/Makefile b/tests/run-make/native-link-modifier-verbatim-linker/Makefile index 666e4084c..256dc2d06 100644 --- a/tests/run-make/native-link-modifier-verbatim-linker/Makefile +++ b/tests/run-make/native-link-modifier-verbatim-linker/Makefile @@ -1,7 +1,7 @@ # ignore-cross-compile # ignore-macos -include ../../run-make-fulldeps/tools.mk +include ../tools.mk all: # Verbatim allows specify precise name. diff --git a/tests/run-make/native-link-modifier-verbatim-rustc/Makefile b/tests/run-make/native-link-modifier-verbatim-rustc/Makefile index 6f01f3780..dfd6ec50f 100644 --- a/tests/run-make/native-link-modifier-verbatim-rustc/Makefile +++ b/tests/run-make/native-link-modifier-verbatim-rustc/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk all: # Verbatim allows specify precise name. diff --git a/tests/run-make/native-link-modifier-whole-archive/Makefile b/tests/run-make/native-link-modifier-whole-archive/Makefile index f26bd864c..5eb7a416f 100644 --- a/tests/run-make/native-link-modifier-whole-archive/Makefile +++ b/tests/run-make/native-link-modifier-whole-archive/Makefile @@ -8,7 +8,7 @@ # that code would never make it into the final executable and we'd thus be missing some # of the output. -include ../../run-make-fulldeps/tools.mk +include ../tools.mk all: $(TMPDIR)/$(call BIN,directly_linked) \ $(TMPDIR)/$(call BIN,directly_linked_test_plus_whole_archive) \ diff --git a/tests/run-make/no-builtins-lto/Makefile b/tests/run-make/no-builtins-lto/Makefile new file mode 100644 index 000000000..c8f05d991 --- /dev/null +++ b/tests/run-make/no-builtins-lto/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +all: + # Compile a `#![no_builtins]` rlib crate + $(RUSTC) no_builtins.rs + # Build an executable that depends on that crate using LTO. The no_builtins crate doesn't + # participate in LTO, so its rlib must be explicitly linked into the final binary. Verify this by + # grepping the linker arguments. + $(RUSTC) main.rs -C lto --print link-args | $(CGREP) 'libno_builtins.rlib' diff --git a/tests/run-make/no-builtins-lto/main.rs b/tests/run-make/no-builtins-lto/main.rs new file mode 100644 index 000000000..890c999c8 --- /dev/null +++ b/tests/run-make/no-builtins-lto/main.rs @@ -0,0 +1,3 @@ +extern crate no_builtins; + +fn main() {} diff --git a/tests/run-make/no-builtins-lto/no_builtins.rs b/tests/run-make/no-builtins-lto/no_builtins.rs new file mode 100644 index 000000000..5d001031a --- /dev/null +++ b/tests/run-make/no-builtins-lto/no_builtins.rs @@ -0,0 +1,2 @@ +#![crate_type = "lib"] +#![no_builtins] diff --git a/tests/run-make/no-duplicate-libs/Makefile b/tests/run-make/no-duplicate-libs/Makefile new file mode 100644 index 000000000..4be8c0262 --- /dev/null +++ b/tests/run-make/no-duplicate-libs/Makefile @@ -0,0 +1,11 @@ +# ignore-cross-compile +include ../tools.mk + +ifdef IS_MSVC +# FIXME(#27979) +all: +else +all: $(call STATICLIB,foo) $(call STATICLIB,bar) + $(RUSTC) main.rs + $(call RUN,main) +endif diff --git a/tests/run-make/no-duplicate-libs/bar.c b/tests/run-make/no-duplicate-libs/bar.c new file mode 100644 index 000000000..e36952657 --- /dev/null +++ b/tests/run-make/no-duplicate-libs/bar.c @@ -0,0 +1,5 @@ +extern void foo(); + +void bar() { + foo(); +} diff --git a/tests/run-make/no-duplicate-libs/foo.c b/tests/run-make/no-duplicate-libs/foo.c new file mode 100644 index 000000000..85e6cd8c3 --- /dev/null +++ b/tests/run-make/no-duplicate-libs/foo.c @@ -0,0 +1 @@ +void foo() {} diff --git a/tests/run-make/no-duplicate-libs/main.rs b/tests/run-make/no-duplicate-libs/main.rs new file mode 100644 index 000000000..b25ef35ad --- /dev/null +++ b/tests/run-make/no-duplicate-libs/main.rs @@ -0,0 +1,10 @@ +#[link(name = "foo")] // linker should drop this library, no symbols used +#[link(name = "bar")] // symbol comes from this library +#[link(name = "foo")] // now linker picks up `foo` b/c `bar` library needs it +extern "C" { + fn bar(); +} + +fn main() { + unsafe { bar() } +} diff --git a/tests/run-make/no-input-file/Makefile b/tests/run-make/no-input-file/Makefile index 2f0215922..a754573a5 100644 --- a/tests/run-make/no-input-file/Makefile +++ b/tests/run-make/no-input-file/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk all: $(RUSTC) --print crate-name 2>&1 | diff - no-input-file.stderr diff --git a/tests/run-make/no-intermediate-extras/Makefile b/tests/run-make/no-intermediate-extras/Makefile new file mode 100644 index 000000000..83b5cedcf --- /dev/null +++ b/tests/run-make/no-intermediate-extras/Makefile @@ -0,0 +1,8 @@ +# ignore-cross-compile +# Regression test for issue #10973 + +include ../tools.mk + +all: + $(RUSTC) --crate-type=rlib --test foo.rs + rm $(TMPDIR)/foo.bc && exit 1 || exit 0 diff --git a/tests/run-make/no-intermediate-extras/foo.rs b/tests/run-make/no-intermediate-extras/foo.rs new file mode 100644 index 000000000..d11c69f81 --- /dev/null +++ b/tests/run-make/no-intermediate-extras/foo.rs @@ -0,0 +1 @@ +// intentionally empty diff --git a/tests/run-make/obey-crate-type-flag/Makefile b/tests/run-make/obey-crate-type-flag/Makefile new file mode 100644 index 000000000..ecbb2e620 --- /dev/null +++ b/tests/run-make/obey-crate-type-flag/Makefile @@ -0,0 +1,14 @@ +# ignore-cross-compile +include ../tools.mk + +# check that rustc builds all crate_type attributes +# delete rlib +# delete whatever dylib is made for this system +# check that rustc only builds --crate-type flags, ignoring attributes +# fail if an rlib was built +all: + $(RUSTC) test.rs + $(call REMOVE_RLIBS,test) + $(call REMOVE_DYLIBS,test) + $(RUSTC) --crate-type dylib test.rs + $(call REMOVE_RLIBS,test) && exit 1 || exit 0 diff --git a/tests/run-make/obey-crate-type-flag/test.rs b/tests/run-make/obey-crate-type-flag/test.rs new file mode 100644 index 000000000..8a768f9de --- /dev/null +++ b/tests/run-make/obey-crate-type-flag/test.rs @@ -0,0 +1,2 @@ +#![crate_type = "rlib"] +#![crate_type = "dylib"] diff --git a/tests/run-make/output-filename-conflicts-with-directory/Makefile b/tests/run-make/output-filename-conflicts-with-directory/Makefile new file mode 100644 index 000000000..45221356c --- /dev/null +++ b/tests/run-make/output-filename-conflicts-with-directory/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +all: + cp foo.rs $(TMPDIR)/foo.rs + mkdir $(TMPDIR)/foo + $(RUSTC) $(TMPDIR)/foo.rs -o $(TMPDIR)/foo 2>&1 \ + | $(CGREP) -e "the generated executable for the input file \".*foo\.rs\" conflicts with the existing directory \".*foo\"" diff --git a/tests/run-make/output-filename-conflicts-with-directory/foo.rs b/tests/run-make/output-filename-conflicts-with-directory/foo.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/tests/run-make/output-filename-conflicts-with-directory/foo.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/output-filename-overwrites-input/Makefile b/tests/run-make/output-filename-overwrites-input/Makefile new file mode 100644 index 000000000..605b86b25 --- /dev/null +++ b/tests/run-make/output-filename-overwrites-input/Makefile @@ -0,0 +1,14 @@ +# ignore-cross-compile +include ../tools.mk + +all: + cp foo.rs $(TMPDIR)/foo + $(RUSTC) $(TMPDIR)/foo -o $(TMPDIR)/foo 2>&1 \ + | $(CGREP) -e "the input file \".*foo\" would be overwritten by the generated executable" + cp bar.rs $(TMPDIR)/bar.rlib + $(RUSTC) $(TMPDIR)/bar.rlib -o $(TMPDIR)/bar.rlib 2>&1 \ + | $(CGREP) -e "the input file \".*bar.rlib\" would be overwritten by the generated executable" + $(RUSTC) foo.rs 2>&1 && $(RUSTC) -Z ls $(TMPDIR)/foo 2>&1 + cp foo.rs $(TMPDIR)/foo.rs + $(RUSTC) $(TMPDIR)/foo.rs -o $(TMPDIR)/foo.rs 2>&1 \ + | $(CGREP) -e "the input file \".*foo.rs\" would be overwritten by the generated executable" diff --git a/tests/run-make/output-filename-overwrites-input/bar.rs b/tests/run-make/output-filename-overwrites-input/bar.rs new file mode 100644 index 000000000..83be6e807 --- /dev/null +++ b/tests/run-make/output-filename-overwrites-input/bar.rs @@ -0,0 +1 @@ +#![crate_type = "lib"] diff --git a/tests/run-make/output-filename-overwrites-input/foo.rs b/tests/run-make/output-filename-overwrites-input/foo.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/tests/run-make/output-filename-overwrites-input/foo.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/output-type-permutations/Makefile b/tests/run-make/output-type-permutations/Makefile new file mode 100644 index 000000000..035033b9f --- /dev/null +++ b/tests/run-make/output-type-permutations/Makefile @@ -0,0 +1,147 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) foo.rs --crate-type=rlib,dylib,staticlib + $(call REMOVE_RLIBS,bar) + $(call REMOVE_DYLIBS,bar) + rm $(call STATICLIB,bar) + rm -f $(TMPDIR)/{lib,}bar.{dll.exp,dll.lib,pdb,dll.a} + # Check that $(TMPDIR) is empty. + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --crate-type=bin + rm $(TMPDIR)/$(call BIN,bar) + rm -f $(TMPDIR)/bar.pdb + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --emit=asm,llvm-ir,llvm-bc,obj,link + rm $(TMPDIR)/bar.ll + rm $(TMPDIR)/bar.bc + rm $(TMPDIR)/bar.s + rm $(TMPDIR)/bar.o + rm $(TMPDIR)/$(call BIN,bar) + rm -f $(TMPDIR)/bar.pdb + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --emit asm -o $(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --emit asm=$(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --emit=asm=$(TMPDIR)/foo + rm $(TMPDIR)/foo + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --emit llvm-bc -o $(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --emit llvm-bc=$(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --emit=llvm-bc=$(TMPDIR)/foo + rm $(TMPDIR)/foo + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --emit llvm-ir -o $(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --emit llvm-ir=$(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --emit=llvm-ir=$(TMPDIR)/foo + rm $(TMPDIR)/foo + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --emit obj -o $(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --emit obj=$(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --emit=obj=$(TMPDIR)/foo + rm $(TMPDIR)/foo + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --emit link -o $(TMPDIR)/$(call BIN,foo) + rm $(TMPDIR)/$(call BIN,foo) + $(RUSTC) foo.rs --emit link=$(TMPDIR)/$(call BIN,foo) + rm $(TMPDIR)/$(call BIN,foo) + $(RUSTC) foo.rs --emit=link=$(TMPDIR)/$(call BIN,foo) + rm $(TMPDIR)/$(call BIN,foo) + rm -f $(TMPDIR)/foo.pdb + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --crate-type=rlib -o $(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --crate-type=rlib --emit link=$(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --crate-type=rlib --emit=link=$(TMPDIR)/foo + rm $(TMPDIR)/foo + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --crate-type=dylib -o $(TMPDIR)/$(call BIN,foo) + rm $(TMPDIR)/$(call BIN,foo) + $(RUSTC) foo.rs --crate-type=dylib --emit link=$(TMPDIR)/$(call BIN,foo) + rm $(TMPDIR)/$(call BIN,foo) + $(RUSTC) foo.rs --crate-type=dylib --emit=link=$(TMPDIR)/$(call BIN,foo) + rm $(TMPDIR)/$(call BIN,foo) + rm -f $(TMPDIR)/{lib,}foo.{dll.exp,dll.lib,pdb,dll.a,exe.a} + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] || (ls -1 $(TMPDIR) && exit 1) + + $(RUSTC) foo.rs --crate-type=staticlib -o $(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --crate-type=staticlib --emit link=$(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --crate-type=staticlib --emit=link=$(TMPDIR)/foo + rm $(TMPDIR)/foo + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --crate-type=bin -o $(TMPDIR)/$(call BIN,foo) + rm $(TMPDIR)/$(call BIN,foo) + $(RUSTC) foo.rs --crate-type=bin --emit link=$(TMPDIR)/$(call BIN,foo) + rm $(TMPDIR)/$(call BIN,foo) + $(RUSTC) foo.rs --crate-type=bin --emit=link=$(TMPDIR)/$(call BIN,foo) + rm $(TMPDIR)/$(call BIN,foo) + rm -f $(TMPDIR)/foo.pdb + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --emit llvm-ir=$(TMPDIR)/ir \ + --emit link \ + --crate-type=rlib + rm $(TMPDIR)/ir + rm $(TMPDIR)/libbar.rlib + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --emit asm=$(TMPDIR)/asm \ + --emit llvm-ir=$(TMPDIR)/ir \ + --emit llvm-bc=$(TMPDIR)/bc \ + --emit obj=$(TMPDIR)/obj \ + --emit link=$(TMPDIR)/link \ + --crate-type=staticlib + rm $(TMPDIR)/asm + rm $(TMPDIR)/ir + rm $(TMPDIR)/bc + rm $(TMPDIR)/obj + rm $(TMPDIR)/link + $(RUSTC) foo.rs --emit=asm=$(TMPDIR)/asm \ + --emit llvm-ir=$(TMPDIR)/ir \ + --emit=llvm-bc=$(TMPDIR)/bc \ + --emit obj=$(TMPDIR)/obj \ + --emit=link=$(TMPDIR)/link \ + --crate-type=staticlib + rm $(TMPDIR)/asm + rm $(TMPDIR)/ir + rm $(TMPDIR)/bc + rm $(TMPDIR)/obj + rm $(TMPDIR)/link + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --emit=asm,llvm-ir,llvm-bc,obj,link --crate-type=staticlib + rm $(TMPDIR)/bar.ll + rm $(TMPDIR)/bar.s + rm $(TMPDIR)/bar.o + rm $(call STATICLIB,bar) + mv $(TMPDIR)/bar.bc $(TMPDIR)/foo.bc + # Don't check that the $(TMPDIR) is empty - we left `foo.bc` for later + # comparison. + + $(RUSTC) foo.rs --emit=llvm-bc,link --crate-type=rlib + cmp $(TMPDIR)/foo.bc $(TMPDIR)/bar.bc + rm $(TMPDIR)/bar.bc + rm $(TMPDIR)/foo.bc + $(call REMOVE_RLIBS,bar) + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] diff --git a/tests/run-make/output-type-permutations/foo.rs b/tests/run-make/output-type-permutations/foo.rs new file mode 100644 index 000000000..f0a2cc6ad --- /dev/null +++ b/tests/run-make/output-type-permutations/foo.rs @@ -0,0 +1,3 @@ +#![crate_name = "bar"] + +fn main() {} diff --git a/tests/run-make/output-with-hyphens/Makefile b/tests/run-make/output-with-hyphens/Makefile new file mode 100644 index 000000000..846c9a66a --- /dev/null +++ b/tests/run-make/output-with-hyphens/Makefile @@ -0,0 +1,8 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) foo-bar.rs --crate-type bin + [ -f $(TMPDIR)/$(call BIN,foo-bar) ] + $(RUSTC) foo-bar.rs --crate-type lib + [ -f $(TMPDIR)/libfoo_bar.rlib ] diff --git a/tests/run-make/output-with-hyphens/foo-bar.rs b/tests/run-make/output-with-hyphens/foo-bar.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/tests/run-make/output-with-hyphens/foo-bar.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/override-aliased-flags/Makefile b/tests/run-make/override-aliased-flags/Makefile new file mode 100644 index 000000000..db1ff1ff9 --- /dev/null +++ b/tests/run-make/override-aliased-flags/Makefile @@ -0,0 +1,23 @@ +# ignore-cross-compile +include ../tools.mk + +# FIXME: it would be good to check that it's actually the rightmost flags +# that are used when multiple flags are specified, but I can't think of a +# reliable way to check this. + +all: + # Test that `-O` and `-C opt-level` can be specified multiple times. + # The rightmost flag will be used over any previous flags. + $(RUSTC) -O -O main.rs + $(RUSTC) -O -C opt-level=0 main.rs + $(RUSTC) -C opt-level=0 -O main.rs + $(RUSTC) -C opt-level=0 -C opt-level=2 main.rs + $(RUSTC) -C opt-level=2 -C opt-level=0 main.rs + + # Test that `-g` and `-C debuginfo` can be specified multiple times. + # The rightmost flag will be used over any previous flags. + $(RUSTC) -g -g main.rs + $(RUSTC) -g -C debuginfo=0 main.rs + $(RUSTC) -C debuginfo=0 -g main.rs + $(RUSTC) -C debuginfo=0 -C debuginfo=2 main.rs + $(RUSTC) -C debuginfo=2 -C debuginfo=0 main.rs diff --git a/tests/run-make/override-aliased-flags/main.rs b/tests/run-make/override-aliased-flags/main.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/tests/run-make/override-aliased-flags/main.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/overwrite-input/Makefile b/tests/run-make/overwrite-input/Makefile index 03b03eb14..c62b5aab1 100644 --- a/tests/run-make/overwrite-input/Makefile +++ b/tests/run-make/overwrite-input/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk all: $(RUSTC) main.rs -o main.rs 2> $(TMPDIR)/file.stderr || echo "failed successfully" diff --git a/tests/run-make/panic-impl-transitive/Makefile b/tests/run-make/panic-impl-transitive/Makefile new file mode 100644 index 000000000..9a271a22e --- /dev/null +++ b/tests/run-make/panic-impl-transitive/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +# NOTE we use --emit=llvm-ir to avoid running the linker (linking will fail because there's no main +# in this crate) +all: + $(RUSTC) panic-impl-provider.rs + $(RUSTC) panic-impl-consumer.rs -C panic=abort --emit=llvm-ir -L $(TMPDIR) diff --git a/tests/run-make/panic-impl-transitive/panic-impl-consumer.rs b/tests/run-make/panic-impl-transitive/panic-impl-consumer.rs new file mode 100644 index 000000000..82a98b12d --- /dev/null +++ b/tests/run-make/panic-impl-transitive/panic-impl-consumer.rs @@ -0,0 +1,5 @@ +#![no_std] +#![no_main] + +// this crate provides the `panic_impl` lang item so we don't need to define it here +extern crate panic_impl_provider; diff --git a/tests/run-make/panic-impl-transitive/panic-impl-provider.rs b/tests/run-make/panic-impl-transitive/panic-impl-provider.rs new file mode 100644 index 000000000..f1b9873c8 --- /dev/null +++ b/tests/run-make/panic-impl-transitive/panic-impl-provider.rs @@ -0,0 +1,9 @@ +#![crate_type = "rlib"] +#![no_std] + +use core::panic::PanicInfo; + +#[panic_handler] +fn panic(info: &PanicInfo) -> ! { + loop {} +} diff --git a/tests/run-make/pass-linker-flags-from-dep/Makefile b/tests/run-make/pass-linker-flags-from-dep/Makefile index b9426326a..b57389bb7 100644 --- a/tests/run-make/pass-linker-flags-from-dep/Makefile +++ b/tests/run-make/pass-linker-flags-from-dep/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk all: # Build deps diff --git a/tests/run-make/pass-linker-flags/Makefile b/tests/run-make/pass-linker-flags/Makefile index a3efb8df6..6ddbcbb1b 100644 --- a/tests/run-make/pass-linker-flags/Makefile +++ b/tests/run-make/pass-linker-flags/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk all: $(RUSTC) rs.rs -Z unstable-options -l static=l1 -l link-arg=a1 -l static=l2 -l link-arg=a2 -l dylib=d1 -l link-arg=a3 --print link-args | $(CGREP) -e 'l1.*a1.*l2.*a2.*d1.*a3' diff --git a/tests/run-make/pass-non-c-like-enum-to-c/Makefile b/tests/run-make/pass-non-c-like-enum-to-c/Makefile new file mode 100644 index 000000000..bd441d321 --- /dev/null +++ b/tests/run-make/pass-non-c-like-enum-to-c/Makefile @@ -0,0 +1,6 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(call NATIVE_STATICLIB,test) + $(RUSTC) nonclike.rs -L$(TMPDIR) -ltest + $(call RUN,nonclike) diff --git a/tests/run-make/pass-non-c-like-enum-to-c/nonclike.rs b/tests/run-make/pass-non-c-like-enum-to-c/nonclike.rs new file mode 100644 index 000000000..517286a86 --- /dev/null +++ b/tests/run-make/pass-non-c-like-enum-to-c/nonclike.rs @@ -0,0 +1,21 @@ +#[repr(C, u8)] +pub enum TT { + AA(u64, u64), + BB, +} + +#[repr(C,u8)] +pub enum T { + A(u64), + B, +} + +extern "C" { + pub fn t_add(a: T, b: T) -> u64; + pub fn tt_add(a: TT, b: TT) -> u64; +} + +fn main() { + assert_eq!(33, unsafe { tt_add(TT::AA(1,2), TT::AA(10,20)) }); + assert_eq!(11, unsafe { t_add(T::A(1), T::A(10)) }); +} diff --git a/tests/run-make/pass-non-c-like-enum-to-c/test.c b/tests/run-make/pass-non-c-like-enum-to-c/test.c new file mode 100644 index 000000000..99511b253 --- /dev/null +++ b/tests/run-make/pass-non-c-like-enum-to-c/test.c @@ -0,0 +1,85 @@ +#include + +/* This is the code generated by cbindgen 0.12.1 for the `enum TT` + * type in nonclike.rs . */ +enum TT_Tag { + AA, + BB, +}; +typedef uint8_t TT_Tag; + +typedef struct { + uint64_t _0; + uint64_t _1; +} AA_Body; + +typedef struct { + TT_Tag tag; + union { + AA_Body aa; + }; +} TT; + +/* This is the code generated by cbindgen 0.12.1 for the `enum T` type + * in nonclike.rs . */ +enum T_Tag { + A, + B, +}; +typedef uint8_t T_Tag; + +typedef struct { + uint64_t _0; +} A_Body; + +typedef struct { + T_Tag tag; + union { + A_Body a; + }; +} T; + +uint64_t tt_add(TT a, TT b) { + if (a.tag == AA && b.tag == AA) { + return a.aa._0 + a.aa._1 + b.aa._0 + b.aa._1; + } else if (a.tag == AA) { + return a.aa._0 + a.aa._1; + } else if (b.tag == BB) { + return b.aa._0 + b.aa._1; + } else { + return 0; + } +} + +uint64_t t_add(T a, T b) { + if (a.tag == A && b.tag == A) { + return a.a._0 + b.a._0; + } else if (a.tag == AA) { + return a.a._0; + } else if (b.tag == BB) { + return b.a._0; + } else { + return 0; + } +} + +TT tt_new(uint64_t a, uint64_t b) { + TT tt = { + .tag = AA, + .aa = { + ._0 = a, + ._1 = b, + }, + }; + return tt; +} + +T t_new(uint64_t a) { + T t = { + .tag = A, + .a = { + ._0 = a, + }, + }; + return t; +} diff --git a/tests/run-make/pgo-branch-weights/Makefile b/tests/run-make/pgo-branch-weights/Makefile new file mode 100644 index 000000000..c60206a1f --- /dev/null +++ b/tests/run-make/pgo-branch-weights/Makefile @@ -0,0 +1,34 @@ +# needs-profiler-support +# ignore-windows-gnu + +# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works +# properly. Since we only have GCC on the CI ignore the test for now. + +include ../tools.mk + +# For some very small programs GNU ld seems to not properly handle +# instrumentation sections correctly. Neither Gold nor LLD have that problem. +ifeq ($(UNAME),Linux) +ifneq (,$(findstring x86,$(TARGET))) +COMMON_FLAGS=-Clink-args=-fuse-ld=gold +endif +endif + + +all: + # We don't compile `opaque` with either optimizations or instrumentation. + $(RUSTC) $(COMMON_FLAGS) opaque.rs || exit 1 + # Compile the test program with instrumentation + mkdir -p "$(TMPDIR)/prof_data_dir" || exit 1 + $(RUSTC) $(COMMON_FLAGS) interesting.rs \ + -Cprofile-generate="$(TMPDIR)/prof_data_dir" -O -Ccodegen-units=1 || exit 1 + $(RUSTC) $(COMMON_FLAGS) main.rs -Cprofile-generate="$(TMPDIR)/prof_data_dir" -O || exit 1 + # The argument below generates to the expected branch weights + $(call RUN,main aaaaaaaaaaaa2bbbbbbbbbbbb2bbbbbbbbbbbbbbbbcc) || exit 1 + "$(LLVM_BIN_DIR)/llvm-profdata" merge \ + -o "$(TMPDIR)/prof_data_dir/merged.profdata" \ + "$(TMPDIR)/prof_data_dir" || exit 1 + $(RUSTC) $(COMMON_FLAGS) interesting.rs \ + -Cprofile-use="$(TMPDIR)/prof_data_dir/merged.profdata" -O \ + -Ccodegen-units=1 --emit=llvm-ir || exit 1 + cat "$(TMPDIR)/interesting.ll" | "$(LLVM_FILECHECK)" filecheck-patterns.txt diff --git a/tests/run-make/pgo-branch-weights/filecheck-patterns.txt b/tests/run-make/pgo-branch-weights/filecheck-patterns.txt new file mode 100644 index 000000000..70d5a645c --- /dev/null +++ b/tests/run-make/pgo-branch-weights/filecheck-patterns.txt @@ -0,0 +1,24 @@ + +# First, establish that certain !prof labels are attached to the expected +# functions and branching instructions. + +CHECK: define void @function_called_twice(i32 {{.*}} !prof [[function_called_twice_id:![0-9]+]] { +CHECK: br i1 {{.*}}, label {{.*}}, label {{.*}}, !prof [[branch_weights0:![0-9]+]] + +CHECK: define void @function_called_42_times(i32{{.*}} %c) {{.*}} !prof [[function_called_42_times_id:![0-9]+]] { +CHECK: switch i32 %c, label {{.*}} [ +CHECK-NEXT: i32 97, label {{.*}} +CHECK-NEXT: i32 98, label {{.*}} +CHECK-NEXT: ], !prof [[branch_weights1:![0-9]+]] + +CHECK: define void @function_called_never(i32 {{.*}} !prof [[function_called_never_id:![0-9]+]] { + + + +# Now check that those !prof tags hold the expected counts + +CHECK: [[function_called_twice_id]] = !{!"function_entry_count", i64 2} +CHECK: [[branch_weights0]] = !{!"branch_weights", i32 2, i32 0} +CHECK: [[function_called_42_times_id]] = !{!"function_entry_count", i64 42} +CHECK: [[branch_weights1]] = !{!"branch_weights", i32 2, i32 12, i32 28} +CHECK: [[function_called_never_id]] = !{!"function_entry_count", i64 0} diff --git a/tests/run-make/pgo-branch-weights/interesting.rs b/tests/run-make/pgo-branch-weights/interesting.rs new file mode 100644 index 000000000..a26d6fd69 --- /dev/null +++ b/tests/run-make/pgo-branch-weights/interesting.rs @@ -0,0 +1,40 @@ +#![crate_name="interesting"] +#![crate_type="rlib"] + +extern crate opaque; + +#[no_mangle] +#[inline(never)] +pub fn function_called_twice(c: char) { + if c == '2' { + // This branch is taken twice + opaque::f1(); + } else { + // This branch is never taken + opaque::f2(); + } +} + +#[no_mangle] +#[inline(never)] +pub fn function_called_42_times(c: char) { + if c == 'a' { + // This branch is taken 12 times + opaque::f1(); + } else { + + if c == 'b' { + // This branch is taken 28 times + opaque::f2(); + } else { + // This branch is taken 2 times + opaque::f3(); + } + } +} + +#[no_mangle] +#[inline(never)] +pub fn function_called_never(_: char) { + opaque::f1(); +} diff --git a/tests/run-make/pgo-branch-weights/main.rs b/tests/run-make/pgo-branch-weights/main.rs new file mode 100644 index 000000000..619cf9c69 --- /dev/null +++ b/tests/run-make/pgo-branch-weights/main.rs @@ -0,0 +1,17 @@ +extern crate interesting; + +fn main() { + let arg = std::env::args().skip(1).next().unwrap(); + + for c in arg.chars() { + if c == '2' { + interesting::function_called_twice(c); + } else { + interesting::function_called_42_times(c); + } + + if c == '0' { + interesting::function_called_never(c); + } + } +} diff --git a/tests/run-make/pgo-branch-weights/opaque.rs b/tests/run-make/pgo-branch-weights/opaque.rs new file mode 100644 index 000000000..72f93c9fe --- /dev/null +++ b/tests/run-make/pgo-branch-weights/opaque.rs @@ -0,0 +1,6 @@ +#![crate_name="opaque"] +#![crate_type="rlib"] + +pub fn f1() {} +pub fn f2() {} +pub fn f3() {} diff --git a/tests/run-make/pgo-gen-lto/Makefile b/tests/run-make/pgo-gen-lto/Makefile new file mode 100644 index 000000000..3f2f6a838 --- /dev/null +++ b/tests/run-make/pgo-gen-lto/Makefile @@ -0,0 +1,14 @@ +# needs-profiler-support +# ignore-windows-gnu + +# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works +# properly. Since we only have GCC on the CI ignore the test for now. + +include ../tools.mk + +COMPILE_FLAGS=-Copt-level=3 -Clto=fat -Cprofile-generate="$(TMPDIR)" + +all: + $(RUSTC) $(COMPILE_FLAGS) test.rs + $(call RUN,test) || exit 1 + [ -e "$(TMPDIR)"/default_*.profraw ] || (echo "No .profraw file"; exit 1) diff --git a/tests/run-make/pgo-gen-lto/test.rs b/tests/run-make/pgo-gen-lto/test.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/tests/run-make/pgo-gen-lto/test.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/pgo-gen-no-imp-symbols/Makefile b/tests/run-make/pgo-gen-no-imp-symbols/Makefile new file mode 100644 index 000000000..7f72b11b6 --- /dev/null +++ b/tests/run-make/pgo-gen-no-imp-symbols/Makefile @@ -0,0 +1,13 @@ +# needs-profiler-support + +include ../tools.mk + +COMPILE_FLAGS=-O -Ccodegen-units=1 -Cprofile-generate="$(TMPDIR)" + +all: + $(RUSTC) $(COMPILE_FLAGS) --emit=llvm-ir test.rs + # We expect symbols starting with "__llvm_profile_". + $(CGREP) "__llvm_profile_" < $(TMPDIR)/test.ll + # We do NOT expect the "__imp_" version of these symbols. + $(CGREP) -v "__imp___llvm_profile_" < $(TMPDIR)/test.ll # 64 bit + $(CGREP) -v "__imp____llvm_profile_" < $(TMPDIR)/test.ll # 32 bit diff --git a/tests/run-make/pgo-gen-no-imp-symbols/test.rs b/tests/run-make/pgo-gen-no-imp-symbols/test.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/tests/run-make/pgo-gen-no-imp-symbols/test.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/pgo-gen/Makefile b/tests/run-make/pgo-gen/Makefile new file mode 100644 index 000000000..4623a7495 --- /dev/null +++ b/tests/run-make/pgo-gen/Makefile @@ -0,0 +1,14 @@ +# needs-profiler-support +# ignore-windows-gnu + +# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works +# properly. Since we only have GCC on the CI ignore the test for now. + +include ../tools.mk + +COMPILE_FLAGS=-g -Cprofile-generate="$(TMPDIR)" + +all: + $(RUSTC) $(COMPILE_FLAGS) test.rs + $(call RUN,test) || exit 1 + [ -e "$(TMPDIR)"/default_*.profraw ] || (echo "No .profraw file"; exit 1) diff --git a/tests/run-make/pgo-gen/test.rs b/tests/run-make/pgo-gen/test.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/tests/run-make/pgo-gen/test.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/pgo-indirect-call-promotion/Makefile b/tests/run-make/pgo-indirect-call-promotion/Makefile new file mode 100644 index 000000000..45302215c --- /dev/null +++ b/tests/run-make/pgo-indirect-call-promotion/Makefile @@ -0,0 +1,26 @@ +# needs-profiler-support +# ignore-windows-gnu + +# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works +# properly. Since we only have GCC on the CI ignore the test for now. + +include ../tools.mk + +all: + # We don't compile `opaque` with either optimizations or instrumentation. + # We don't compile `opaque` with either optimizations or instrumentation. + $(RUSTC) $(COMMON_FLAGS) opaque.rs + # Compile the test program with instrumentation + mkdir -p "$(TMPDIR)"/prof_data_dir + $(RUSTC) $(COMMON_FLAGS) interesting.rs \ + -Cprofile-generate="$(TMPDIR)"/prof_data_dir -O -Ccodegen-units=1 + $(RUSTC) $(COMMON_FLAGS) main.rs -Cprofile-generate="$(TMPDIR)"/prof_data_dir -O + # The argument below generates to the expected branch weights + $(call RUN,main) || exit 1 + "$(LLVM_BIN_DIR)"/llvm-profdata merge \ + -o "$(TMPDIR)"/prof_data_dir/merged.profdata \ + "$(TMPDIR)"/prof_data_dir + $(RUSTC) $(COMMON_FLAGS) interesting.rs \ + -Cprofile-use="$(TMPDIR)"/prof_data_dir/merged.profdata -O \ + -Ccodegen-units=1 --emit=llvm-ir + cat "$(TMPDIR)"/interesting.ll | "$(LLVM_FILECHECK)" filecheck-patterns.txt diff --git a/tests/run-make/pgo-indirect-call-promotion/filecheck-patterns.txt b/tests/run-make/pgo-indirect-call-promotion/filecheck-patterns.txt new file mode 100644 index 000000000..e19c78350 --- /dev/null +++ b/tests/run-make/pgo-indirect-call-promotion/filecheck-patterns.txt @@ -0,0 +1,16 @@ +CHECK: define void @call_a_bunch_of_functions({{.*}} { + +# Make sure that indirect call promotion inserted a check against the most +# frequently called function. +CHECK: %{{.*}} = icmp eq {{void \(\)\*|ptr}} %{{.*}}, @function_called_always + +# Check that the call to `function_called_always` was inlined, so that we +# directly call `opaque_f1` from the upstream crate. +CHECK: call void @opaque_f1() + + +# Same checks as above, repeated for the trait object case + +CHECK: define void @call_a_bunch_of_trait_methods({{.*}} +CHECK: %{{.*}} = icmp eq {{void \(\{\}\*\)\*|ptr}} %{{.*}}, {{.*}}@foo +CHECK: tail call void @opaque_f2() diff --git a/tests/run-make/pgo-indirect-call-promotion/interesting.rs b/tests/run-make/pgo-indirect-call-promotion/interesting.rs new file mode 100644 index 000000000..4fd096d62 --- /dev/null +++ b/tests/run-make/pgo-indirect-call-promotion/interesting.rs @@ -0,0 +1,56 @@ +#![crate_name="interesting"] +#![crate_type="rlib"] + +extern crate opaque; + +#[no_mangle] +pub fn function_called_always() { + opaque::opaque_f1(); +} + +#[no_mangle] +pub fn function_called_never() { + opaque::opaque_f2(); +} + +#[no_mangle] +pub fn call_a_bunch_of_functions(fns: &[fn()]) { + + // Indirect call promotion transforms the below into something like + // + // for f in fns { + // if f == function_called_always { + // function_called_always() + // } else { + // f(); + // } + // } + // + // where `function_called_always` actually gets inlined too. + + for f in fns { + f(); + } +} + + +pub trait Foo { + fn foo(&self); +} + +impl Foo for u32 { + + #[no_mangle] + fn foo(&self) { + opaque::opaque_f2(); + } +} + +#[no_mangle] +pub fn call_a_bunch_of_trait_methods(trait_objects: &[&dyn Foo]) { + + // Same as above, just with vtables in between + for x in trait_objects { + x.foo(); + } +} diff --git a/tests/run-make/pgo-indirect-call-promotion/main.rs b/tests/run-make/pgo-indirect-call-promotion/main.rs new file mode 100644 index 000000000..27181f307 --- /dev/null +++ b/tests/run-make/pgo-indirect-call-promotion/main.rs @@ -0,0 +1,14 @@ +extern crate interesting; + +fn main() { + // function pointer case + let fns: Vec<_> = std::iter::repeat(interesting::function_called_always as fn()) + .take(1000) + .collect(); + interesting::call_a_bunch_of_functions(&fns[..]); + + // Trait object case + let trait_objects = vec![0u32; 1000]; + let trait_objects: Vec<_> = trait_objects.iter().map(|x| x as &dyn interesting::Foo).collect(); + interesting::call_a_bunch_of_trait_methods(&trait_objects[..]); +} diff --git a/tests/run-make/pgo-indirect-call-promotion/opaque.rs b/tests/run-make/pgo-indirect-call-promotion/opaque.rs new file mode 100644 index 000000000..9628d711c --- /dev/null +++ b/tests/run-make/pgo-indirect-call-promotion/opaque.rs @@ -0,0 +1,7 @@ +#![crate_name="opaque"] +#![crate_type="rlib"] + +#[no_mangle] +pub fn opaque_f1() {} +#[no_mangle] +pub fn opaque_f2() {} diff --git a/tests/run-make/pgo-use/Makefile b/tests/run-make/pgo-use/Makefile new file mode 100644 index 000000000..3bac9b77a --- /dev/null +++ b/tests/run-make/pgo-use/Makefile @@ -0,0 +1,46 @@ +# needs-profiler-support +# ignore-windows-gnu + +# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works +# properly. Since we only have GCC on the CI ignore the test for now. + +include ../tools.mk + +# This test makes sure that PGO profiling data leads to cold functions being +# marked as `cold` and hot functions with `inlinehint`. +# The test program contains an `if` were actual execution only ever takes the +# `else` branch. Accordingly, we expect the function that is never called to +# be marked as cold. +# +# Disable the pre-inlining pass (i.e. a pass that does some inlining before +# it adds the profiling instrumentation). Disabling this pass leads to +# rather predictable IR which we need for this test to be stable. + +COMMON_FLAGS=-Copt-level=2 -Ccodegen-units=1 -Cllvm-args=-disable-preinline + +ifeq ($(UNAME),Darwin) +# macOS does not have the `tac` command, but `tail -r` does the same thing +TAC := tail -r +else +# some other platforms don't support the `-r` flag for `tail`, so use `tac` +TAC := tac +endif + +all: + # Compile the test program with instrumentation + $(RUSTC) $(COMMON_FLAGS) -Cprofile-generate="$(TMPDIR)" main.rs + # Run it in order to generate some profiling data + $(call RUN,main some-argument) || exit 1 + # Postprocess the profiling data so it can be used by the compiler + "$(LLVM_BIN_DIR)"/llvm-profdata merge \ + -o "$(TMPDIR)"/merged.profdata \ + "$(TMPDIR)"/default_*.profraw + # Compile the test program again, making use of the profiling data + $(RUSTC) $(COMMON_FLAGS) -Cprofile-use="$(TMPDIR)"/merged.profdata --emit=llvm-ir main.rs + # Check that the generate IR contains some things that we expect + # + # We feed the file into LLVM FileCheck tool *in reverse* so that we see the + # line with the function name before the line with the function attributes. + # FileCheck only supports checking that something matches on the next line, + # but not if something matches on the previous line. + $(TAC) "$(TMPDIR)"/main.ll | "$(LLVM_FILECHECK)" filecheck-patterns.txt diff --git a/tests/run-make/pgo-use/filecheck-patterns.txt b/tests/run-make/pgo-use/filecheck-patterns.txt new file mode 100644 index 000000000..6da34f88f --- /dev/null +++ b/tests/run-make/pgo-use/filecheck-patterns.txt @@ -0,0 +1,11 @@ +# Add a check that the IR contains some expected metadata +CHECK: !{!"ProfileFormat", !"InstrProf"} +CHECK: !"ProfileSummary" + +# Make sure that the hot function is marked with `inlinehint` +CHECK: define {{.*}} @hot_function +CHECK-NEXT: Function Attrs:{{.*}}inlinehint + +# Make sure that the cold function is marked with `cold` +CHECK: define {{.*}} @cold_function +CHECK-NEXT: Function Attrs:{{.*}}cold diff --git a/tests/run-make/pgo-use/main.rs b/tests/run-make/pgo-use/main.rs new file mode 100644 index 000000000..eb9192c87 --- /dev/null +++ b/tests/run-make/pgo-use/main.rs @@ -0,0 +1,23 @@ +#[no_mangle] +pub fn cold_function(c: u8) { + println!("cold {}", c); +} + +#[no_mangle] +pub fn hot_function(c: u8) { + std::env::set_var(format!("var{}", c), format!("hot {}", c)); +} + +fn main() { + let arg = std::env::args().skip(1).next().unwrap(); + + for i in 0 .. 1000_000 { + let some_value = arg.as_bytes()[i % arg.len()]; + if some_value == b'!' { + // This branch is never taken at runtime + cold_function(some_value); + } else { + hot_function(some_value); + } + } +} diff --git a/tests/run-make/pointer-auth-link-with-c/Makefile b/tests/run-make/pointer-auth-link-with-c/Makefile new file mode 100644 index 000000000..7acea0380 --- /dev/null +++ b/tests/run-make/pointer-auth-link-with-c/Makefile @@ -0,0 +1,14 @@ +include ../tools.mk + +# only-aarch64 + +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 + $(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 + $(call RUN,test) diff --git a/tests/run-make/pointer-auth-link-with-c/test.c b/tests/run-make/pointer-auth-link-with-c/test.c new file mode 100644 index 000000000..9fe07f82f --- /dev/null +++ b/tests/run-make/pointer-auth-link-with-c/test.c @@ -0,0 +1 @@ +int foo() { return 0; } diff --git a/tests/run-make/pointer-auth-link-with-c/test.rs b/tests/run-make/pointer-auth-link-with-c/test.rs new file mode 100644 index 000000000..615ad0aeb --- /dev/null +++ b/tests/run-make/pointer-auth-link-with-c/test.rs @@ -0,0 +1,8 @@ +#[link(name = "test")] +extern "C" { + fn foo() -> i32; +} + +fn main() { + unsafe {foo();} +} diff --git a/tests/run-make/prefer-dylib/Makefile b/tests/run-make/prefer-dylib/Makefile new file mode 100644 index 000000000..cc26e70ae --- /dev/null +++ b/tests/run-make/prefer-dylib/Makefile @@ -0,0 +1,9 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) bar.rs --crate-type=dylib --crate-type=rlib -C prefer-dynamic + $(RUSTC) foo.rs -C prefer-dynamic + $(call RUN,foo) + rm $(TMPDIR)/*bar* + $(call FAIL,foo) diff --git a/tests/run-make/prefer-dylib/bar.rs b/tests/run-make/prefer-dylib/bar.rs new file mode 100644 index 000000000..c5c0bc606 --- /dev/null +++ b/tests/run-make/prefer-dylib/bar.rs @@ -0,0 +1 @@ +pub fn bar() {} diff --git a/tests/run-make/prefer-dylib/foo.rs b/tests/run-make/prefer-dylib/foo.rs new file mode 100644 index 000000000..8d68535e3 --- /dev/null +++ b/tests/run-make/prefer-dylib/foo.rs @@ -0,0 +1,5 @@ +extern crate bar; + +fn main() { + bar::bar(); +} diff --git a/tests/run-make/prefer-rlib/Makefile b/tests/run-make/prefer-rlib/Makefile new file mode 100644 index 000000000..2e86b9c1d --- /dev/null +++ b/tests/run-make/prefer-rlib/Makefile @@ -0,0 +1,9 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) bar.rs --crate-type=dylib --crate-type=rlib + ls $(TMPDIR)/$(call RLIB_GLOB,bar) + $(RUSTC) foo.rs + rm $(TMPDIR)/*bar* + $(call RUN,foo) diff --git a/tests/run-make/prefer-rlib/bar.rs b/tests/run-make/prefer-rlib/bar.rs new file mode 100644 index 000000000..c5c0bc606 --- /dev/null +++ b/tests/run-make/prefer-rlib/bar.rs @@ -0,0 +1 @@ +pub fn bar() {} diff --git a/tests/run-make/prefer-rlib/foo.rs b/tests/run-make/prefer-rlib/foo.rs new file mode 100644 index 000000000..8d68535e3 --- /dev/null +++ b/tests/run-make/prefer-rlib/foo.rs @@ -0,0 +1,5 @@ +extern crate bar; + +fn main() { + bar::bar(); +} diff --git a/tests/run-make/pretty-print-to-file/Makefile b/tests/run-make/pretty-print-to-file/Makefile new file mode 100644 index 000000000..ca11b8c47 --- /dev/null +++ b/tests/run-make/pretty-print-to-file/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + $(RUSTC) -o $(TMPDIR)/input.out -Zunpretty=normal input.rs + diff -u $(TMPDIR)/input.out input.pp diff --git a/tests/run-make/pretty-print-to-file/input.pp b/tests/run-make/pretty-print-to-file/input.pp new file mode 100644 index 000000000..e3f03242a --- /dev/null +++ b/tests/run-make/pretty-print-to-file/input.pp @@ -0,0 +1,3 @@ + +#[crate_type = "lib"] +pub fn foo() -> i32 { 45 } diff --git a/tests/run-make/pretty-print-to-file/input.rs b/tests/run-make/pretty-print-to-file/input.rs new file mode 100644 index 000000000..aa828155b --- /dev/null +++ b/tests/run-make/pretty-print-to-file/input.rs @@ -0,0 +1,5 @@ +#[crate_type="lib"] + +pub fn +foo() -> i32 +{ 45 } diff --git a/tests/run-make/print-calling-conventions/Makefile b/tests/run-make/print-calling-conventions/Makefile new file mode 100644 index 000000000..27b87e610 --- /dev/null +++ b/tests/run-make/print-calling-conventions/Makefile @@ -0,0 +1,4 @@ +include ../tools.mk + +all: + $(RUSTC) --print calling-conventions diff --git a/tests/run-make/print-cfg/Makefile b/tests/run-make/print-cfg/Makefile new file mode 100644 index 000000000..126f5768c --- /dev/null +++ b/tests/run-make/print-cfg/Makefile @@ -0,0 +1,20 @@ +# needs-llvm-components: x86 arm + +include ../tools.mk + +all: default + $(RUSTC) --target x86_64-pc-windows-gnu --print cfg | $(CGREP) windows + $(RUSTC) --target x86_64-pc-windows-gnu --print cfg | $(CGREP) x86_64 + $(RUSTC) --target i686-pc-windows-msvc --print cfg | $(CGREP) msvc + $(RUSTC) --target i686-apple-darwin --print cfg | $(CGREP) macos + $(RUSTC) --target i686-unknown-linux-gnu --print cfg | $(CGREP) gnu + $(RUSTC) --target arm-unknown-linux-gnueabihf --print cfg | $(CGREP) target_abi= + $(RUSTC) --target arm-unknown-linux-gnueabihf --print cfg | $(CGREP) eabihf + +ifdef IS_WINDOWS +default: + $(RUSTC) --print cfg | $(CGREP) windows +else +default: + $(RUSTC) --print cfg | $(CGREP) unix +endif diff --git a/tests/run-make/print-target-list/Makefile b/tests/run-make/print-target-list/Makefile new file mode 100644 index 000000000..f23c40d42 --- /dev/null +++ b/tests/run-make/print-target-list/Makefile @@ -0,0 +1,8 @@ +include ../tools.mk + +# Checks that all the targets returned by `rustc --print target-list` are valid +# target specifications +all: + for target in $(shell $(BARE_RUSTC) --print target-list); do \ + $(BARE_RUSTC) --target $$target --print sysroot; \ + done diff --git a/tests/run-make/profile/Makefile b/tests/run-make/profile/Makefile new file mode 100644 index 000000000..fffc051ad --- /dev/null +++ b/tests/run-make/profile/Makefile @@ -0,0 +1,12 @@ +# needs-profiler-support + +include ../tools.mk + +all: + $(RUSTC) -g -Z profile test.rs + $(call RUN,test) || exit 1 + [ -e "$(TMPDIR)/test.gcno" ] || (echo "No .gcno file"; exit 1) + [ -e "$(TMPDIR)/test.gcda" ] || (echo "No .gcda file"; exit 1) + $(RUSTC) -g -Z profile -Z profile-emit=$(TMPDIR)/abc/abc.gcda test.rs + $(call RUN,test) || exit 1 + [ -e "$(TMPDIR)/abc/abc.gcda" ] || (echo "gcda file not emitted to defined path"; exit 1) diff --git a/tests/run-make/profile/test.rs b/tests/run-make/profile/test.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/tests/run-make/profile/test.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/prune-link-args/Makefile b/tests/run-make/prune-link-args/Makefile new file mode 100644 index 000000000..c21ba6ace --- /dev/null +++ b/tests/run-make/prune-link-args/Makefile @@ -0,0 +1,10 @@ +# ignore-cross-compile +include ../tools.mk + +# ignore-windows + +# Notice the space in the end, this emulates the output of pkg-config +RUSTC_FLAGS = -C link-args="-lc " + +all: + $(RUSTC) $(RUSTC_FLAGS) empty.rs diff --git a/tests/run-make/prune-link-args/empty.rs b/tests/run-make/prune-link-args/empty.rs new file mode 100644 index 000000000..45590d86b --- /dev/null +++ b/tests/run-make/prune-link-args/empty.rs @@ -0,0 +1 @@ +fn main() { } diff --git a/tests/run-make/raw-dylib-alt-calling-convention/Makefile b/tests/run-make/raw-dylib-alt-calling-convention/Makefile index 03f8778d2..1744c431f 100644 --- a/tests/run-make/raw-dylib-alt-calling-convention/Makefile +++ b/tests/run-make/raw-dylib-alt-calling-convention/Makefile @@ -3,7 +3,7 @@ # only-x86 # only-windows -include ../../run-make-fulldeps/tools.mk +include ../tools.mk all: $(RUSTC) --crate-type lib --crate-name raw_dylib_alt_calling_convention_test lib.rs diff --git a/tests/run-make/raw-dylib-c/Makefile b/tests/run-make/raw-dylib-c/Makefile index f47ab24f4..06e7935c0 100644 --- a/tests/run-make/raw-dylib-c/Makefile +++ b/tests/run-make/raw-dylib-c/Makefile @@ -2,7 +2,7 @@ # only-windows -include ../../run-make-fulldeps/tools.mk +include ../tools.mk all: $(RUSTC) --crate-type lib --crate-name raw_dylib_test lib.rs diff --git a/tests/run-make/raw-dylib-cross-compilation/Makefile b/tests/run-make/raw-dylib-cross-compilation/Makefile new file mode 100644 index 000000000..a8f97edd6 --- /dev/null +++ b/tests/run-make/raw-dylib-cross-compilation/Makefile @@ -0,0 +1,22 @@ +# Tests that raw-dylib cross compilation works correctly + +# only-gnu +# needs-i686-dlltool +# needs-x86_64-dlltool + +# i686 dlltool.exe can't product x64 binaries. +# ignore-i686-pc-windows-gnu + +include ../tools.mk + +all: + # Build as x86 and make sure that we have x86 objects only. + $(RUSTC) --crate-type lib --crate-name i686_raw_dylib_test --target i686-pc-windows-gnu lib.rs + "$(LLVM_BIN_DIR)"/llvm-objdump -a $(TMPDIR)/libi686_raw_dylib_test.rlib > $(TMPDIR)/i686.objdump.txt + $(CGREP) "file format coff-i386" < $(TMPDIR)/i686.objdump.txt + $(CGREP) -v "file format coff-x86-64" < $(TMPDIR)/i686.objdump.txt + # Build as x64 and make sure that we have x64 objects only. + $(RUSTC) --crate-type lib --crate-name x64_raw_dylib_test --target x86_64-pc-windows-gnu lib.rs + "$(LLVM_BIN_DIR)"/llvm-objdump -a $(TMPDIR)/libx64_raw_dylib_test.rlib > $(TMPDIR)/x64.objdump.txt + $(CGREP) "file format coff-x86-64" < $(TMPDIR)/x64.objdump.txt + $(CGREP) -v "file format coff-i386" < $(TMPDIR)/x64.objdump.txt diff --git a/tests/run-make/raw-dylib-cross-compilation/lib.rs b/tests/run-make/raw-dylib-cross-compilation/lib.rs new file mode 100644 index 000000000..51bf2ec6b --- /dev/null +++ b/tests/run-make/raw-dylib-cross-compilation/lib.rs @@ -0,0 +1,20 @@ +#![feature(raw_dylib)] +#![feature(no_core, lang_items)] +#![no_std] +#![no_core] +#![crate_type = "lib"] + +// This is needed because of #![no_core]: +#[lang = "sized"] +trait Sized {} + +#[link(name = "extern_1", kind = "raw-dylib")] +extern { + fn extern_fn(); +} + +pub fn extern_fn_caller() { + unsafe { + extern_fn(); + } +} diff --git a/tests/run-make/raw-dylib-import-name-type/Makefile b/tests/run-make/raw-dylib-import-name-type/Makefile index fcc60e88e..671523298 100644 --- a/tests/run-make/raw-dylib-import-name-type/Makefile +++ b/tests/run-make/raw-dylib-import-name-type/Makefile @@ -3,7 +3,7 @@ # only-x86 # only-windows --include ../../run-make-fulldeps/tools.mk +include ../tools.mk all: $(RUSTC) --crate-type bin driver.rs -L "$(TMPDIR)" diff --git a/tests/run-make/raw-dylib-inline-cross-dylib/Makefile b/tests/run-make/raw-dylib-inline-cross-dylib/Makefile index 722a49b02..6d1d04bfd 100644 --- a/tests/run-make/raw-dylib-inline-cross-dylib/Makefile +++ b/tests/run-make/raw-dylib-inline-cross-dylib/Makefile @@ -2,7 +2,7 @@ # only-windows -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # We'd be using the llvm-objdump instead of the system objdump to ensure compatibility # with the LLVM bitcode generated by rustc but on Windows piping/IO redirection under MSYS2 is wonky with llvm-objdump. diff --git a/tests/run-make/raw-dylib-link-ordinal/Makefile b/tests/run-make/raw-dylib-link-ordinal/Makefile index b55a94dbc..374a0b59d 100644 --- a/tests/run-make/raw-dylib-link-ordinal/Makefile +++ b/tests/run-make/raw-dylib-link-ordinal/Makefile @@ -2,7 +2,7 @@ # only-windows -include ../../run-make-fulldeps/tools.mk +include ../tools.mk all: $(RUSTC) --crate-type lib --crate-name raw_dylib_test lib.rs diff --git a/tests/run-make/raw-dylib-stdcall-ordinal/Makefile b/tests/run-make/raw-dylib-stdcall-ordinal/Makefile index b9deb7729..178c15ab3 100644 --- a/tests/run-make/raw-dylib-stdcall-ordinal/Makefile +++ b/tests/run-make/raw-dylib-stdcall-ordinal/Makefile @@ -3,7 +3,7 @@ # only-x86 # only-windows -include ../../run-make-fulldeps/tools.mk +include ../tools.mk all: $(RUSTC) --crate-type lib --crate-name raw_dylib_test lib.rs diff --git a/tests/run-make/redundant-libs/Makefile b/tests/run-make/redundant-libs/Makefile new file mode 100644 index 000000000..0a48b2b28 --- /dev/null +++ b/tests/run-make/redundant-libs/Makefile @@ -0,0 +1,24 @@ +# ignore-cross-compile +include ../tools.mk + +# ignore-windows-msvc + +# rustc will remove one of the two redundant references to foo below. Depending +# on which one gets removed, we'll get a linker error on SOME platforms (like +# Linux). On these platforms, when a library is referenced, the linker will +# only pull in the symbols needed _at that point in time_. If a later library +# depends on additional symbols from the library, they will not have been pulled +# in, and you'll get undefined symbols errors. +# +# So in this example, we need to ensure that rustc keeps the _later_ reference +# to foo, and not the former one. +RUSTC_FLAGS = \ + -l static=bar \ + -l foo \ + -l static=baz \ + -l foo \ + --print link-args + +all: $(call DYLIB,foo) $(call STATICLIB,bar) $(call STATICLIB,baz) + $(RUSTC) $(RUSTC_FLAGS) main.rs + $(call RUN,main) diff --git a/tests/run-make/redundant-libs/bar.c b/tests/run-make/redundant-libs/bar.c new file mode 100644 index 000000000..e42599986 --- /dev/null +++ b/tests/run-make/redundant-libs/bar.c @@ -0,0 +1 @@ +void bar() {} diff --git a/tests/run-make/redundant-libs/baz.c b/tests/run-make/redundant-libs/baz.c new file mode 100644 index 000000000..a4e2c2b71 --- /dev/null +++ b/tests/run-make/redundant-libs/baz.c @@ -0,0 +1,7 @@ +extern void foo1(); +extern void foo2(); + +void baz() { + foo1(); + foo2(); +} diff --git a/tests/run-make/redundant-libs/foo.c b/tests/run-make/redundant-libs/foo.c new file mode 100644 index 000000000..339ee86c9 --- /dev/null +++ b/tests/run-make/redundant-libs/foo.c @@ -0,0 +1,2 @@ +void foo1() {} +void foo2() {} diff --git a/tests/run-make/redundant-libs/main.rs b/tests/run-make/redundant-libs/main.rs new file mode 100644 index 000000000..90d185ff5 --- /dev/null +++ b/tests/run-make/redundant-libs/main.rs @@ -0,0 +1,11 @@ +extern "C" { + fn bar(); + fn baz(); +} + +fn main() { + unsafe { + bar(); + baz(); + } +} diff --git a/tests/run-make/relocation-model/Makefile b/tests/run-make/relocation-model/Makefile new file mode 100644 index 000000000..8cc5205ed --- /dev/null +++ b/tests/run-make/relocation-model/Makefile @@ -0,0 +1,20 @@ +# ignore-cross-compile +include ../tools.mk + +all: others + $(RUSTC) -C relocation-model=dynamic-no-pic foo.rs + $(call RUN,foo) + + $(RUSTC) -C relocation-model=default foo.rs + $(call RUN,foo) + + $(RUSTC) -C relocation-model=dynamic-no-pic --crate-type=dylib foo.rs --emit=link,obj + +ifdef IS_MSVC +# FIXME(#28026) +others: +else +others: + $(RUSTC) -C relocation-model=static foo.rs + $(call RUN,foo) +endif diff --git a/tests/run-make/relocation-model/foo.rs b/tests/run-make/relocation-model/foo.rs new file mode 100644 index 000000000..da0f5d925 --- /dev/null +++ b/tests/run-make/relocation-model/foo.rs @@ -0,0 +1 @@ +pub fn main() {} diff --git a/tests/run-make/relro-levels/Makefile b/tests/run-make/relro-levels/Makefile new file mode 100644 index 000000000..e0402f59f --- /dev/null +++ b/tests/run-make/relro-levels/Makefile @@ -0,0 +1,22 @@ +# ignore-cross-compile +include ../tools.mk + +# only-linux +# +# This tests the different -Zrelro-level values, and makes sure that they work properly. + +all: + # Ensure that binaries built with the full relro level links them with both + # RELRO and BIND_NOW for doing eager symbol resolving. + $(RUSTC) -Zrelro-level=full hello.rs + readelf -l $(TMPDIR)/hello | grep -q GNU_RELRO + readelf -d $(TMPDIR)/hello | grep -q BIND_NOW + + $(RUSTC) -Zrelro-level=partial hello.rs + readelf -l $(TMPDIR)/hello | grep -q GNU_RELRO + + # Ensure that we're *not* built with RELRO when setting it to off. We do + # not want to check for BIND_NOW however, as the linker might have that + # enabled by default. + $(RUSTC) -Zrelro-level=off hello.rs + ! readelf -l $(TMPDIR)/hello | grep -q GNU_RELRO diff --git a/tests/run-make/relro-levels/hello.rs b/tests/run-make/relro-levels/hello.rs new file mode 100644 index 000000000..e7a11a969 --- /dev/null +++ b/tests/run-make/relro-levels/hello.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/tests/run-make/remap-path-prefix-dwarf/Makefile b/tests/run-make/remap-path-prefix-dwarf/Makefile index fbaea7b68..c9ede1b60 100644 --- a/tests/run-make/remap-path-prefix-dwarf/Makefile +++ b/tests/run-make/remap-path-prefix-dwarf/Makefile @@ -6,7 +6,7 @@ SRC_DIR := $(abspath .) SRC_DIR_PARENT := $(abspath ..) -include ../../run-make-fulldeps/tools.mk +include ../tools.mk all: \ abs_input_outside_working_dir \ diff --git a/tests/run-make/remap-path-prefix/Makefile b/tests/run-make/remap-path-prefix/Makefile new file mode 100644 index 000000000..2a7378fdf --- /dev/null +++ b/tests/run-make/remap-path-prefix/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +# ignore-windows + +# Checks if remapping works if the remap-from string contains path to the working directory plus more +all: + $(RUSTC) --remap-path-prefix $$PWD/auxiliary=/the/aux --crate-type=lib --emit=metadata auxiliary/lib.rs + grep "/the/aux/lib.rs" $(TMPDIR)/liblib.rmeta || exit 1 + ! grep "$$PWD/auxiliary" $(TMPDIR)/liblib.rmeta || exit 1 diff --git a/tests/run-make/remap-path-prefix/auxiliary/lib.rs b/tests/run-make/remap-path-prefix/auxiliary/lib.rs new file mode 100644 index 000000000..019c786a9 --- /dev/null +++ b/tests/run-make/remap-path-prefix/auxiliary/lib.rs @@ -0,0 +1,3 @@ +pub fn lib() { + panic!("calm"); +} diff --git a/tests/run-make/repr128-dwarf/Makefile b/tests/run-make/repr128-dwarf/Makefile index 2b03c22c0..3f9330427 100644 --- a/tests/run-make/repr128-dwarf/Makefile +++ b/tests/run-make/repr128-dwarf/Makefile @@ -2,7 +2,7 @@ # This test should be replaced with one in tests/debuginfo once GDB or LLDB support 128-bit # enums. -include ../../run-make-fulldeps/tools.mk +include ../tools.mk all: $(RUSTC) -Cdebuginfo=2 lib.rs -o $(TMPDIR)/repr128.rlib diff --git a/tests/run-make/reproducible-build-2/Makefile b/tests/run-make/reproducible-build-2/Makefile new file mode 100644 index 000000000..68fcac8b4 --- /dev/null +++ b/tests/run-make/reproducible-build-2/Makefile @@ -0,0 +1,27 @@ +# ignore-cross-compile +include ../tools.mk + +# ignore-musl +# ignore-windows +# Objects are reproducible but their path is not. + +all: \ + fat_lto \ + sysroot + +fat_lto: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) reproducible-build-aux.rs + $(RUSTC) reproducible-build.rs -C lto=fat + cp $(TMPDIR)/reproducible-build $(TMPDIR)/reproducible-build-a + $(RUSTC) reproducible-build.rs -C lto=fat + cmp "$(TMPDIR)/reproducible-build-a" "$(TMPDIR)/reproducible-build" || exit 1 + +sysroot: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) reproducible-build-aux.rs + $(RUSTC) reproducible-build.rs --crate-type rlib --sysroot $(shell $(RUSTC) --print sysroot) --remap-path-prefix=$(shell $(RUSTC) --print sysroot)=/sysroot + cp -R $(shell $(RUSTC) --print sysroot) $(TMPDIR)/sysroot + cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib + $(RUSTC) reproducible-build.rs --crate-type rlib --sysroot $(TMPDIR)/sysroot --remap-path-prefix=$(TMPDIR)/sysroot=/sysroot + cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 diff --git a/tests/run-make/reproducible-build-2/linker.rs b/tests/run-make/reproducible-build-2/linker.rs new file mode 100644 index 000000000..998d1f328 --- /dev/null +++ b/tests/run-make/reproducible-build-2/linker.rs @@ -0,0 +1,44 @@ +use std::env; +use std::path::Path; +use std::fs::File; +use std::io::{Read, Write}; + +fn main() { + let mut dst = env::current_exe().unwrap(); + dst.pop(); + dst.push("linker-arguments1"); + if dst.exists() { + dst.pop(); + dst.push("linker-arguments2"); + assert!(!dst.exists()); + } + + let mut out = String::new(); + for arg in env::args().skip(1) { + let path = Path::new(&arg); + if !path.is_file() { + out.push_str(&arg); + out.push_str("\n"); + continue + } + + let mut contents = Vec::new(); + File::open(path).unwrap().read_to_end(&mut contents).unwrap(); + + out.push_str(&format!("{}: {}\n", arg, hash(&contents))); + } + + File::create(dst).unwrap().write_all(out.as_bytes()).unwrap(); +} + +// fnv hash for now +fn hash(contents: &[u8]) -> u64 { + let mut hash = 0xcbf29ce484222325; + + for byte in contents { + hash = hash ^ (*byte as u64); + hash = hash.wrapping_mul(0x100000001b3); + } + + hash +} diff --git a/tests/run-make/reproducible-build-2/reproducible-build-aux.rs b/tests/run-make/reproducible-build-2/reproducible-build-aux.rs new file mode 100644 index 000000000..8105b3d2b --- /dev/null +++ b/tests/run-make/reproducible-build-2/reproducible-build-aux.rs @@ -0,0 +1,28 @@ +#![crate_type="lib"] + +pub static STATIC: i32 = 1234; + +pub struct Struct { + _t1: std::marker::PhantomData, + _t2: std::marker::PhantomData, +} + +pub fn regular_fn(_: i32) {} + +pub fn generic_fn() {} + +impl Drop for Struct { + fn drop(&mut self) {} +} + +pub enum Enum { + Variant1, + Variant2(u32), + Variant3 { x: u32 } +} + +pub struct TupleStruct(pub i8, pub i16, pub i32, pub i64); + +pub trait Trait { + fn foo(&self); +} diff --git a/tests/run-make/reproducible-build-2/reproducible-build.rs b/tests/run-make/reproducible-build-2/reproducible-build.rs new file mode 100644 index 000000000..a6c04774c --- /dev/null +++ b/tests/run-make/reproducible-build-2/reproducible-build.rs @@ -0,0 +1,116 @@ +// This test case makes sure that two identical invocations of the compiler +// (i.e., same code base, same compile-flags, same compiler-versions, etc.) +// produce the same output. In the past, symbol names of monomorphized functions +// were not deterministic (which we want to avoid). +// +// The test tries to exercise as many different paths into symbol name +// generation as possible: +// +// - regular functions +// - generic functions +// - methods +// - statics +// - closures +// - enum variant constructors +// - tuple struct constructors +// - drop glue +// - FnOnce adapters +// - Trait object shims +// - Fn Pointer shims + +#![allow(dead_code, warnings)] + +extern crate reproducible_build_aux; + +static STATIC: i32 = 1234; + +pub struct Struct { + x: T1, + y: T2, +} + +fn regular_fn(_: i32) {} + +fn generic_fn() {} + +impl Drop for Struct { + fn drop(&mut self) {} +} + +pub enum Enum { + Variant1, + Variant2(u32), + Variant3 { x: u32 } +} + +struct TupleStruct(i8, i16, i32, i64); + +impl TupleStruct { + pub fn bar(&self) {} +} + +trait Trait { + fn foo(&self); +} + +impl Trait for u64 { + fn foo(&self) {} +} + +impl reproducible_build_aux::Trait for TupleStruct { + fn foo(&self) {} +} + +fn main() { + regular_fn(STATIC); + generic_fn::(); + generic_fn::>(); + generic_fn::, reproducible_build_aux::Struct>(); + + let dropped = Struct { + x: "", + y: 'a', + }; + + let _ = Enum::Variant1; + let _ = Enum::Variant2(0); + let _ = Enum::Variant3 { x: 0 }; + let _ = TupleStruct(1, 2, 3, 4); + + let closure = |x| { + x + 1i32 + }; + + fn inner i32>(f: F) -> i32 { + f(STATIC) + } + + println!("{}", inner(closure)); + + let object_shim: &Trait = &0u64; + object_shim.foo(); + + fn with_fn_once_adapter(f: F) { + f(0); + } + + with_fn_once_adapter(|_:i32| { }); + + reproducible_build_aux::regular_fn(STATIC); + reproducible_build_aux::generic_fn::(); + reproducible_build_aux::generic_fn::>(); + reproducible_build_aux::generic_fn::, + reproducible_build_aux::Struct>(); + + let _ = reproducible_build_aux::Enum::Variant1; + let _ = reproducible_build_aux::Enum::Variant2(0); + let _ = reproducible_build_aux::Enum::Variant3 { x: 0 }; + let _ = reproducible_build_aux::TupleStruct(1, 2, 3, 4); + + let object_shim: &reproducible_build_aux::Trait = &TupleStruct(0, 1, 2, 3); + object_shim.foo(); + + let pointer_shim: &Fn(i32) = ®ular_fn; + + TupleStruct(1, 2, 3, 4).bar(); +} diff --git a/tests/run-make/reproducible-build/Makefile b/tests/run-make/reproducible-build/Makefile new file mode 100644 index 000000000..f5d17a234 --- /dev/null +++ b/tests/run-make/reproducible-build/Makefile @@ -0,0 +1,140 @@ +# ignore-cross-compile +include ../tools.mk + +# ignore-musl +# Objects are reproducible but their path is not. + +all: \ + smoke \ + debug \ + opt \ + link_paths \ + remap_paths \ + different_source_dirs_rlib \ + remap_cwd_rlib \ + remap_cwd_to_empty \ + extern_flags + +# TODO: Builds of `bin` crate types are not deterministic with debuginfo=2 on +# Windows. +# See: https://github.com/rust-lang/rust/pull/87320#issuecomment-920105533 +# Issue: https://github.com/rust-lang/rust/issues/88982 +# +# different_source_dirs_bin \ +# remap_cwd_bin \ + +smoke: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) linker.rs -O + $(RUSTC) reproducible-build-aux.rs + $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) + $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) + diff -u "$(TMPDIR)/linker-arguments1" "$(TMPDIR)/linker-arguments2" + +debug: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) linker.rs -O + $(RUSTC) reproducible-build-aux.rs -g + $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -g + $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -g + diff -u "$(TMPDIR)/linker-arguments1" "$(TMPDIR)/linker-arguments2" + +opt: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) linker.rs -O + $(RUSTC) reproducible-build-aux.rs -O + $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -O + $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -O + diff -u "$(TMPDIR)/linker-arguments1" "$(TMPDIR)/linker-arguments2" + +link_paths: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) reproducible-build-aux.rs + $(RUSTC) reproducible-build.rs --crate-type rlib -L /b + cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib + $(RUSTC) reproducible-build.rs --crate-type rlib -L /a + cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 + +remap_paths: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) reproducible-build-aux.rs + $(RUSTC) reproducible-build.rs --crate-type rlib --remap-path-prefix=/a=/c + cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib + $(RUSTC) reproducible-build.rs --crate-type rlib --remap-path-prefix=/b=/c + cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 + +different_source_dirs_bin: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) reproducible-build-aux.rs + mkdir $(TMPDIR)/test + cp reproducible-build.rs $(TMPDIR)/test + $(RUSTC) reproducible-build.rs --crate-type bin --remap-path-prefix=$$PWD=/b + cp $(TMPDIR)/reproducible-build $(TMPDIR)/foo + (cd $(TMPDIR)/test && $(RUSTC) reproducible-build.rs \ + --remap-path-prefix=$(TMPDIR)/test=/b \ + --crate-type bin) + cmp "$(TMPDIR)/reproducible-build" "$(TMPDIR)/foo" || exit 1 + +different_source_dirs_rlib: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) reproducible-build-aux.rs + mkdir $(TMPDIR)/test + cp reproducible-build.rs $(TMPDIR)/test + $(RUSTC) reproducible-build.rs --crate-type rlib --remap-path-prefix=$$PWD=/b + cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib + (cd $(TMPDIR)/test && $(RUSTC) reproducible-build.rs \ + --remap-path-prefix=$(TMPDIR)/test=/b \ + --crate-type rlib) + cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 + +remap_cwd_bin: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) reproducible-build-aux.rs + mkdir $(TMPDIR)/test + cp reproducible-build.rs $(TMPDIR)/test + $(RUSTC) reproducible-build.rs --crate-type bin -C debuginfo=2 \ + -Z remap-cwd-prefix=. + cp $(TMPDIR)/reproducible-build $(TMPDIR)/first + (cd $(TMPDIR)/test && \ + $(RUSTC) reproducible-build.rs --crate-type bin -C debuginfo=2 \ + -Z remap-cwd-prefix=.) + cmp "$(TMPDIR)/first" "$(TMPDIR)/reproducible-build" || exit 1 + +remap_cwd_rlib: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) reproducible-build-aux.rs + mkdir $(TMPDIR)/test + cp reproducible-build.rs $(TMPDIR)/test + $(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \ + -Z remap-cwd-prefix=. + cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfirst.rlib + (cd $(TMPDIR)/test && \ + $(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \ + -Z remap-cwd-prefix=.) + cmp "$(TMPDIR)/libfirst.rlib" "$(TMPDIR)/libreproducible_build.rlib" || exit 1 + +remap_cwd_to_empty: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) reproducible-build-aux.rs + mkdir $(TMPDIR)/test + cp reproducible-build.rs $(TMPDIR)/test + $(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \ + -Z remap-cwd-prefix= + cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfirst.rlib + (cd $(TMPDIR)/test && \ + $(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \ + -Z remap-cwd-prefix=) + cmp "$(TMPDIR)/libfirst.rlib" "$(TMPDIR)/libreproducible_build.rlib" || exit 1 + +extern_flags: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) reproducible-build-aux.rs + $(RUSTC) reproducible-build.rs \ + --extern reproducible_build_aux=$(TMPDIR)/libreproducible_build_aux.rlib \ + --crate-type rlib + cp $(TMPDIR)/libreproducible_build_aux.rlib $(TMPDIR)/libbar.rlib + cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib + $(RUSTC) reproducible-build.rs \ + --extern reproducible_build_aux=$(TMPDIR)/libbar.rlib \ + --crate-type rlib + cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 diff --git a/tests/run-make/reproducible-build/linker.rs b/tests/run-make/reproducible-build/linker.rs new file mode 100644 index 000000000..3dda6f190 --- /dev/null +++ b/tests/run-make/reproducible-build/linker.rs @@ -0,0 +1,50 @@ +use std::env; +use std::path::Path; +use std::fs::File; +use std::io::{Read, Write}; + +fn main() { + let mut dst = env::current_exe().unwrap(); + dst.pop(); + dst.push("linker-arguments1"); + if dst.exists() { + dst.pop(); + dst.push("linker-arguments2"); + assert!(!dst.exists()); + } + + let mut out = String::new(); + for arg in env::args().skip(1) { + let path = Path::new(&arg); + if !path.is_file() { + out.push_str(&arg); + out.push_str("\n"); + continue + } + + let mut contents = Vec::new(); + File::open(path).unwrap().read_to_end(&mut contents).unwrap(); + + // This file is produced during linking in a temporary directory. + let arg = if arg.ends_with("/symbols.o") || arg.ends_with("\\symbols.o") { + "symbols.o" + } else { + &*arg + }; + out.push_str(&format!("{}: {}\n", arg, hash(&contents))); + } + + File::create(dst).unwrap().write_all(out.as_bytes()).unwrap(); +} + +// fnv hash for now +fn hash(contents: &[u8]) -> u64 { + let mut hash = 0xcbf29ce484222325; + + for byte in contents { + hash = hash ^ (*byte as u64); + hash = hash.wrapping_mul(0x100000001b3); + } + + hash +} diff --git a/tests/run-make/reproducible-build/reproducible-build-aux.rs b/tests/run-make/reproducible-build/reproducible-build-aux.rs new file mode 100644 index 000000000..8105b3d2b --- /dev/null +++ b/tests/run-make/reproducible-build/reproducible-build-aux.rs @@ -0,0 +1,28 @@ +#![crate_type="lib"] + +pub static STATIC: i32 = 1234; + +pub struct Struct { + _t1: std::marker::PhantomData, + _t2: std::marker::PhantomData, +} + +pub fn regular_fn(_: i32) {} + +pub fn generic_fn() {} + +impl Drop for Struct { + fn drop(&mut self) {} +} + +pub enum Enum { + Variant1, + Variant2(u32), + Variant3 { x: u32 } +} + +pub struct TupleStruct(pub i8, pub i16, pub i32, pub i64); + +pub trait Trait { + fn foo(&self); +} diff --git a/tests/run-make/reproducible-build/reproducible-build.rs b/tests/run-make/reproducible-build/reproducible-build.rs new file mode 100644 index 000000000..a6c04774c --- /dev/null +++ b/tests/run-make/reproducible-build/reproducible-build.rs @@ -0,0 +1,116 @@ +// This test case makes sure that two identical invocations of the compiler +// (i.e., same code base, same compile-flags, same compiler-versions, etc.) +// produce the same output. In the past, symbol names of monomorphized functions +// were not deterministic (which we want to avoid). +// +// The test tries to exercise as many different paths into symbol name +// generation as possible: +// +// - regular functions +// - generic functions +// - methods +// - statics +// - closures +// - enum variant constructors +// - tuple struct constructors +// - drop glue +// - FnOnce adapters +// - Trait object shims +// - Fn Pointer shims + +#![allow(dead_code, warnings)] + +extern crate reproducible_build_aux; + +static STATIC: i32 = 1234; + +pub struct Struct { + x: T1, + y: T2, +} + +fn regular_fn(_: i32) {} + +fn generic_fn() {} + +impl Drop for Struct { + fn drop(&mut self) {} +} + +pub enum Enum { + Variant1, + Variant2(u32), + Variant3 { x: u32 } +} + +struct TupleStruct(i8, i16, i32, i64); + +impl TupleStruct { + pub fn bar(&self) {} +} + +trait Trait { + fn foo(&self); +} + +impl Trait for u64 { + fn foo(&self) {} +} + +impl reproducible_build_aux::Trait for TupleStruct { + fn foo(&self) {} +} + +fn main() { + regular_fn(STATIC); + generic_fn::(); + generic_fn::>(); + generic_fn::, reproducible_build_aux::Struct>(); + + let dropped = Struct { + x: "", + y: 'a', + }; + + let _ = Enum::Variant1; + let _ = Enum::Variant2(0); + let _ = Enum::Variant3 { x: 0 }; + let _ = TupleStruct(1, 2, 3, 4); + + let closure = |x| { + x + 1i32 + }; + + fn inner i32>(f: F) -> i32 { + f(STATIC) + } + + println!("{}", inner(closure)); + + let object_shim: &Trait = &0u64; + object_shim.foo(); + + fn with_fn_once_adapter(f: F) { + f(0); + } + + with_fn_once_adapter(|_:i32| { }); + + reproducible_build_aux::regular_fn(STATIC); + reproducible_build_aux::generic_fn::(); + reproducible_build_aux::generic_fn::>(); + reproducible_build_aux::generic_fn::, + reproducible_build_aux::Struct>(); + + let _ = reproducible_build_aux::Enum::Variant1; + let _ = reproducible_build_aux::Enum::Variant2(0); + let _ = reproducible_build_aux::Enum::Variant3 { x: 0 }; + let _ = reproducible_build_aux::TupleStruct(1, 2, 3, 4); + + let object_shim: &reproducible_build_aux::Trait = &TupleStruct(0, 1, 2, 3); + object_shim.foo(); + + let pointer_shim: &Fn(i32) = ®ular_fn; + + TupleStruct(1, 2, 3, 4).bar(); +} diff --git a/tests/run-make/resolve-rename/Makefile b/tests/run-make/resolve-rename/Makefile new file mode 100644 index 000000000..00f83a5d6 --- /dev/null +++ b/tests/run-make/resolve-rename/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +all: + $(RUSTC) -C extra-filename=-hash foo.rs + $(RUSTC) bar.rs + mv $(TMPDIR)/libfoo-hash.rlib $(TMPDIR)/libfoo-another-hash.rlib + $(RUSTC) baz.rs diff --git a/tests/run-make/resolve-rename/bar.rs b/tests/run-make/resolve-rename/bar.rs new file mode 100644 index 000000000..4a09ce355 --- /dev/null +++ b/tests/run-make/resolve-rename/bar.rs @@ -0,0 +1,5 @@ +#![crate_type = "rlib"] + +extern crate foo; + +pub fn bar() { foo::foo() } diff --git a/tests/run-make/resolve-rename/baz.rs b/tests/run-make/resolve-rename/baz.rs new file mode 100644 index 000000000..9176073ef --- /dev/null +++ b/tests/run-make/resolve-rename/baz.rs @@ -0,0 +1,5 @@ +#![crate_type = "rlib"] + +extern crate bar; + +pub fn baz() { bar::bar() } diff --git a/tests/run-make/resolve-rename/foo.rs b/tests/run-make/resolve-rename/foo.rs new file mode 100644 index 000000000..bd6820098 --- /dev/null +++ b/tests/run-make/resolve-rename/foo.rs @@ -0,0 +1,3 @@ +#![crate_type = "rlib"] + +pub fn foo() {} diff --git a/tests/run-make/return-non-c-like-enum-from-c/Makefile b/tests/run-make/return-non-c-like-enum-from-c/Makefile new file mode 100644 index 000000000..bd441d321 --- /dev/null +++ b/tests/run-make/return-non-c-like-enum-from-c/Makefile @@ -0,0 +1,6 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(call NATIVE_STATICLIB,test) + $(RUSTC) nonclike.rs -L$(TMPDIR) -ltest + $(call RUN,nonclike) diff --git a/tests/run-make/return-non-c-like-enum-from-c/nonclike.rs b/tests/run-make/return-non-c-like-enum-from-c/nonclike.rs new file mode 100644 index 000000000..ea22a2a56 --- /dev/null +++ b/tests/run-make/return-non-c-like-enum-from-c/nonclike.rs @@ -0,0 +1,31 @@ +#[repr(C, u8)] +pub enum TT { + AA(u64, u64), + BB, +} + +#[repr(C,u8)] +pub enum T { + A(u64), + B, +} + +extern "C" { + pub fn t_new(a: u64) -> T; + pub fn tt_new(a: u64, b: u64) -> TT; +} + +fn main() { + if let TT::AA(a, b) = unsafe { tt_new(10, 11) } { + assert_eq!(10, a); + assert_eq!(11, b); + } else { + panic!("expected TT::AA"); + } + + if let T::A(a) = unsafe { t_new(10) } { + assert_eq!(10, a); + } else { + panic!("expected T::A"); + } +} diff --git a/tests/run-make/return-non-c-like-enum-from-c/test.c b/tests/run-make/return-non-c-like-enum-from-c/test.c new file mode 100644 index 000000000..3ad135bab --- /dev/null +++ b/tests/run-make/return-non-c-like-enum-from-c/test.c @@ -0,0 +1,61 @@ +#include + +/* This is the code generated by cbindgen 0.12.1 for the `enum TT` + * type in nonclike.rs . */ +enum TT_Tag { + AA, + BB, +}; +typedef uint8_t TT_Tag; + +typedef struct { + uint64_t _0; + uint64_t _1; +} AA_Body; + +typedef struct { + TT_Tag tag; + union { + AA_Body aa; + }; +} TT; + +/* This is the code generated by cbindgen 0.12.1 for the `enum T` type + * in nonclike.rs . */ +enum T_Tag { + A, + B, +}; +typedef uint8_t T_Tag; + +typedef struct { + uint64_t _0; +} A_Body; + +typedef struct { + T_Tag tag; + union { + A_Body a; + }; +} T; + +TT tt_new(uint64_t a, uint64_t b) { + TT tt = { + .tag = AA, + .aa = { + ._0 = a, + ._1 = b, + }, + }; + return tt; +} + +T t_new(uint64_t a) { + T t = { + .tag = A, + .a = { + ._0 = a, + }, + }; + return t; +} diff --git a/tests/run-make/return-non-c-like-enum/Makefile b/tests/run-make/return-non-c-like-enum/Makefile new file mode 100644 index 000000000..0c8d8bf3a --- /dev/null +++ b/tests/run-make/return-non-c-like-enum/Makefile @@ -0,0 +1,8 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) --crate-type=staticlib nonclike.rs + $(CC) test.c $(call STATICLIB,nonclike) $(call OUT_EXE,test) \ + $(EXTRACFLAGS) $(EXTRACXXFLAGS) + $(call RUN,test) diff --git a/tests/run-make/return-non-c-like-enum/nonclike.rs b/tests/run-make/return-non-c-like-enum/nonclike.rs new file mode 100644 index 000000000..de529cf64 --- /dev/null +++ b/tests/run-make/return-non-c-like-enum/nonclike.rs @@ -0,0 +1,21 @@ +#[repr(C, u8)] +pub enum TT { + AA(u64, u64), + BB, +} + +#[no_mangle] +pub extern "C" fn tt_new(a: u64, b: u64) -> TT { + TT::AA(a, b) +} + +#[repr(C,u8)] +pub enum T { + A(u64), + B, +} + +#[no_mangle] +pub extern "C" fn t_new(a: u64) -> T { + T::A(a) +} diff --git a/tests/run-make/return-non-c-like-enum/test.c b/tests/run-make/return-non-c-like-enum/test.c new file mode 100644 index 000000000..afadd3c10 --- /dev/null +++ b/tests/run-make/return-non-c-like-enum/test.c @@ -0,0 +1,63 @@ +#include +#include + +/* This is the code generated by cbindgen 0.12.1 for the `enum TT` + * type in nonclike.rs . */ +enum TT_Tag { + AA, + BB, +}; +typedef uint8_t TT_Tag; + +typedef struct { + uint64_t _0; + uint64_t _1; +} AA_Body; + +typedef struct { + TT_Tag tag; + union { + AA_Body aa; + }; +} TT; + +/* This is the code generated by cbindgen 0.12.1 for the `enum T` type + * in nonclike.rs . */ +enum T_Tag { + A, + B, +}; +typedef uint8_t T_Tag; + +typedef struct { + uint64_t _0; +} A_Body; + +typedef struct { + T_Tag tag; + union { + A_Body a; + }; +} T; + +/* These symbols are defined by the Rust staticlib built from + * nonclike.rs. */ +extern TT tt_new(uint64_t a, uint64_t b); +extern T t_new(uint64_t v); + +int main(int argc, char *argv[]) { + (void)argc; (void)argv; + + /* This example works. */ + TT tt = tt_new(10, 20); + assert(AA == tt.tag); + assert(10 == tt.aa._0); + assert(20 == tt.aa._1); + + /* This one used to segfault (see issue #68190). */ + T t = t_new(10); + assert(A == t.tag); + assert(10 == t.a._0); + + return 0; +} diff --git a/tests/run-make/rlib-chain/Makefile b/tests/run-make/rlib-chain/Makefile new file mode 100644 index 000000000..7a1f887fa --- /dev/null +++ b/tests/run-make/rlib-chain/Makefile @@ -0,0 +1,11 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) m1.rs + $(RUSTC) m2.rs + $(RUSTC) m3.rs + $(RUSTC) m4.rs + $(call RUN,m4) + rm $(TMPDIR)/*lib + $(call RUN,m4) diff --git a/tests/run-make/rlib-chain/m1.rs b/tests/run-make/rlib-chain/m1.rs new file mode 100644 index 000000000..665b206cc --- /dev/null +++ b/tests/run-make/rlib-chain/m1.rs @@ -0,0 +1,2 @@ +#![crate_type = "rlib"] +pub fn m1() {} diff --git a/tests/run-make/rlib-chain/m2.rs b/tests/run-make/rlib-chain/m2.rs new file mode 100644 index 000000000..eba12fe12 --- /dev/null +++ b/tests/run-make/rlib-chain/m2.rs @@ -0,0 +1,4 @@ +#![crate_type = "rlib"] +extern crate m1; + +pub fn m2() { m1::m1() } diff --git a/tests/run-make/rlib-chain/m3.rs b/tests/run-make/rlib-chain/m3.rs new file mode 100644 index 000000000..ade191db4 --- /dev/null +++ b/tests/run-make/rlib-chain/m3.rs @@ -0,0 +1,4 @@ +#![crate_type = "rlib"] +extern crate m2; + +pub fn m3() { m2::m2() } diff --git a/tests/run-make/rlib-chain/m4.rs b/tests/run-make/rlib-chain/m4.rs new file mode 100644 index 000000000..fa8ec6079 --- /dev/null +++ b/tests/run-make/rlib-chain/m4.rs @@ -0,0 +1,3 @@ +extern crate m3; + +fn main() { m3::m3() } diff --git a/tests/run-make/rlib-format-packed-bundled-libs-2/Makefile b/tests/run-make/rlib-format-packed-bundled-libs-2/Makefile index 37b8d809a..d2a740b06 100644 --- a/tests/run-make/rlib-format-packed-bundled-libs-2/Makefile +++ b/tests/run-make/rlib-format-packed-bundled-libs-2/Makefile @@ -1,4 +1,4 @@ --include ../../run-make-fulldeps/tools.mk +include ../tools.mk # ignore-cross-compile diff --git a/tests/run-make/rlib-format-packed-bundled-libs-3/Makefile b/tests/run-make/rlib-format-packed-bundled-libs-3/Makefile index 62dc1b5f6..1f2812cb0 100644 --- a/tests/run-make/rlib-format-packed-bundled-libs-3/Makefile +++ b/tests/run-make/rlib-format-packed-bundled-libs-3/Makefile @@ -1,4 +1,4 @@ --include ../../run-make-fulldeps/tools.mk +include ../tools.mk # ignore-cross-compile # only-linux diff --git a/tests/run-make/rlib-format-packed-bundled-libs/Makefile b/tests/run-make/rlib-format-packed-bundled-libs/Makefile index 7fb6ce8d1..f454da678 100644 --- a/tests/run-make/rlib-format-packed-bundled-libs/Makefile +++ b/tests/run-make/rlib-format-packed-bundled-libs/Makefile @@ -1,4 +1,4 @@ --include ../../run-make-fulldeps/tools.mk +include ../tools.mk # ignore-cross-compile diff --git a/tests/run-make/rustc-macro-dep-files/Makefile b/tests/run-make/rustc-macro-dep-files/Makefile index 6ae659db2..76d713c4b 100644 --- a/tests/run-make/rustc-macro-dep-files/Makefile +++ b/tests/run-make/rustc-macro-dep-files/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # FIXME(eddyb) provide `HOST_RUSTC` and `TARGET_RUSTC` # instead of hardcoding them everywhere they're needed. diff --git a/tests/run-make/rustdoc-determinism/Makefile b/tests/run-make/rustdoc-determinism/Makefile new file mode 100644 index 000000000..a3ef16906 --- /dev/null +++ b/tests/run-make/rustdoc-determinism/Makefile @@ -0,0 +1,16 @@ +include ../tools.mk + +# Assert that the search index is generated deterministically, regardless of the +# order that crates are documented in. + +# ignore-windows +# Uses `diff`. + +all: + $(RUSTDOC) foo.rs -o $(TMPDIR)/foo_first + $(RUSTDOC) bar.rs -o $(TMPDIR)/foo_first + + $(RUSTDOC) bar.rs -o $(TMPDIR)/bar_first + $(RUSTDOC) foo.rs -o $(TMPDIR)/bar_first + + diff $(TMPDIR)/foo_first/search-index.js $(TMPDIR)/bar_first/search-index.js diff --git a/tests/run-make/rustdoc-determinism/bar.rs b/tests/run-make/rustdoc-determinism/bar.rs new file mode 100644 index 000000000..ca05a6a90 --- /dev/null +++ b/tests/run-make/rustdoc-determinism/bar.rs @@ -0,0 +1 @@ +pub struct Bar; diff --git a/tests/run-make/rustdoc-determinism/foo.rs b/tests/run-make/rustdoc-determinism/foo.rs new file mode 100644 index 000000000..4a835673a --- /dev/null +++ b/tests/run-make/rustdoc-determinism/foo.rs @@ -0,0 +1 @@ +pub struct Foo; diff --git a/tests/run-make/rustdoc-error-lines/Makefile b/tests/run-make/rustdoc-error-lines/Makefile new file mode 100644 index 000000000..2dc30f56b --- /dev/null +++ b/tests/run-make/rustdoc-error-lines/Makefile @@ -0,0 +1,13 @@ +include ../tools.mk + +# Test that hir-tree output doesn't crash and includes +# the string constant we would expect to see. + +all: + $(RUSTDOC) --test input.rs > $(TMPDIR)/output || true + $(CGREP) 'input.rs - foo (line 5)' < $(TMPDIR)/output + $(CGREP) 'input.rs:7:15' < $(TMPDIR)/output + $(CGREP) 'input.rs - bar (line 15)' < $(TMPDIR)/output + $(CGREP) 'input.rs:17:15' < $(TMPDIR)/output + $(CGREP) 'input.rs - bar (line 24)' < $(TMPDIR)/output + $(CGREP) 'input.rs:26:15' < $(TMPDIR)/output diff --git a/tests/run-make/rustdoc-error-lines/input.rs b/tests/run-make/rustdoc-error-lines/input.rs new file mode 100644 index 000000000..b4db182e8 --- /dev/null +++ b/tests/run-make/rustdoc-error-lines/input.rs @@ -0,0 +1,28 @@ +// Test for #45868 + +// random #![feature] to ensure that crate attrs +// do not offset things +/// ```rust +/// #![feature(bool_to_option)] +/// let x: char = 1; +/// ``` +pub fn foo() { + +} + +/// Add some text around the test... +/// +/// ```rust +/// #![feature(bool_to_option)] +/// let x: char = 1; +/// ``` +/// +/// ...to make sure that the line number is still correct. +/// +/// Let's also add a second test in the same doc comment. +/// +/// ```rust +/// #![feature(bool_to_option)] +/// let x: char = 1; +/// ``` +pub fn bar() {} diff --git a/tests/run-make/rustdoc-io-error/Makefile b/tests/run-make/rustdoc-io-error/Makefile new file mode 100644 index 000000000..27f5ecf94 --- /dev/null +++ b/tests/run-make/rustdoc-io-error/Makefile @@ -0,0 +1,20 @@ +include ../tools.mk + +# This test verifies that rustdoc doesn't ICE when it encounters an IO error +# while generating files. Ideally this would be a rustdoc-ui test, so we could +# verify the error message as well. + +# ignore-windows +# The test uses `chmod`. + +OUTPUT_DIR := "$(TMPDIR)/rustdoc-io-error" + +# This test operates by creating a temporary directory and modifying its +# permissions so that it is not writable. We have to take special care to set +# the permissions back to normal so that it's able to be deleted later. +all: + mkdir -p $(OUTPUT_DIR) + chmod u-w $(OUTPUT_DIR) + -$(shell $(RUSTDOC) -o $(OUTPUT_DIR) foo.rs) + chmod u+w $(OUTPUT_DIR) + exit $($(.SHELLSTATUS) -eq 1) diff --git a/tests/run-make/rustdoc-io-error/foo.rs b/tests/run-make/rustdoc-io-error/foo.rs new file mode 100644 index 000000000..4a835673a --- /dev/null +++ b/tests/run-make/rustdoc-io-error/foo.rs @@ -0,0 +1 @@ +pub struct Foo; diff --git a/tests/run-make/rustdoc-map-file/Makefile b/tests/run-make/rustdoc-map-file/Makefile new file mode 100644 index 000000000..5cbf7747a --- /dev/null +++ b/tests/run-make/rustdoc-map-file/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + $(RUSTDOC) -Z unstable-options --generate-redirect-map foo.rs -o "$(TMPDIR)/out" + "$(PYTHON)" validate_json.py "$(TMPDIR)/out" diff --git a/tests/run-make/rustdoc-map-file/expected.json b/tests/run-make/rustdoc-map-file/expected.json new file mode 100644 index 000000000..6b1ccbeac --- /dev/null +++ b/tests/run-make/rustdoc-map-file/expected.json @@ -0,0 +1,5 @@ +{ + "foo/macro.foo!.html": "foo/macro.foo.html", + "foo/private/struct.Quz.html": "foo/struct.Quz.html", + "foo/hidden/struct.Bar.html": "foo/struct.Bar.html" +} diff --git a/tests/run-make/rustdoc-map-file/foo.rs b/tests/run-make/rustdoc-map-file/foo.rs new file mode 100644 index 000000000..e12b9d229 --- /dev/null +++ b/tests/run-make/rustdoc-map-file/foo.rs @@ -0,0 +1,16 @@ +pub use private::Quz; +pub use hidden::Bar; + +mod private { + pub struct Quz; +} + +#[doc(hidden)] +pub mod hidden { + pub struct Bar; +} + +#[macro_export] +macro_rules! foo { + () => {} +} diff --git a/tests/run-make/rustdoc-map-file/validate_json.py b/tests/run-make/rustdoc-map-file/validate_json.py new file mode 100755 index 000000000..5c14c90b7 --- /dev/null +++ b/tests/run-make/rustdoc-map-file/validate_json.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +import os +import sys +import json + + +def find_redirect_map_file(folder, errors): + for root, dirs, files in os.walk(folder): + for name in files: + if not name.endswith("redirect-map.json"): + continue + with open(os.path.join(root, name)) as f: + data = json.load(f) + with open("expected.json") as f: + expected = json.load(f) + for key in expected: + if expected[key] != data.get(key): + errors.append("Expected `{}` for key `{}`, found: `{}`".format( + expected[key], key, data.get(key))) + else: + del data[key] + for key in data: + errors.append("Extra data not expected: key: `{}`, data: `{}`".format( + key, data[key])) + return True + return False + + +if len(sys.argv) != 2: + print("Expected doc directory to check!") + sys.exit(1) + +errors = [] +if not find_redirect_map_file(sys.argv[1], errors): + print("Didn't find the map file in `{}`...".format(sys.argv[1])) + sys.exit(1) +for err in errors: + print("=> {}".format(err)) +if len(errors) != 0: + sys.exit(1) diff --git a/tests/run-make/rustdoc-output-path/Makefile b/tests/run-make/rustdoc-output-path/Makefile new file mode 100644 index 000000000..8f5cda9e5 --- /dev/null +++ b/tests/run-make/rustdoc-output-path/Makefile @@ -0,0 +1,4 @@ +include ../tools.mk + +all: + $(RUSTDOC) -o "$(TMPDIR)/foo/bar/doc" foo.rs diff --git a/tests/run-make/rustdoc-output-path/foo.rs b/tests/run-make/rustdoc-output-path/foo.rs new file mode 100644 index 000000000..4a835673a --- /dev/null +++ b/tests/run-make/rustdoc-output-path/foo.rs @@ -0,0 +1 @@ +pub struct Foo; diff --git a/tests/run-make/rustdoc-scrape-examples-macros/Makefile b/tests/run-make/rustdoc-scrape-examples-macros/Makefile new file mode 100644 index 000000000..edc19d8cb --- /dev/null +++ b/tests/run-make/rustdoc-scrape-examples-macros/Makefile @@ -0,0 +1,19 @@ +# ignore-cross-compile +include ../../run-make/tools.mk + +OUTPUT_DIR := "$(TMPDIR)/rustdoc" +DYLIB_NAME := $(shell echo | $(RUSTC) --crate-name foobar_macro --crate-type dylib --print file-names -) + +all: + $(RUSTC) src/proc.rs --crate-name foobar_macro --edition=2021 --crate-type proc-macro --emit=dep-info,link + + $(RUSTC) src/lib.rs --crate-name foobar --edition=2021 --crate-type lib --emit=dep-info,link + + $(RUSTDOC) examples/ex.rs --crate-name ex --crate-type bin --output $(OUTPUT_DIR) \ + --extern foobar=$(TMPDIR)/libfoobar.rlib --extern foobar_macro=$(TMPDIR)/$(DYLIB_NAME) \ + -Z unstable-options --scrape-examples-output-path $(TMPDIR)/ex.calls --scrape-examples-target-crate foobar + + $(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --output $(OUTPUT_DIR) \ + -Z unstable-options --with-examples $(TMPDIR)/ex.calls + + $(HTMLDOCCK) $(OUTPUT_DIR) src/lib.rs diff --git a/tests/run-make/rustdoc-scrape-examples-macros/examples/ex.rs b/tests/run-make/rustdoc-scrape-examples-macros/examples/ex.rs new file mode 100644 index 000000000..4d8c8b30e --- /dev/null +++ b/tests/run-make/rustdoc-scrape-examples-macros/examples/ex.rs @@ -0,0 +1,27 @@ +extern crate foobar; +extern crate foobar_macro; + +use foobar::*; +use foobar_macro::*; + +a_proc_macro!(); // no + +#[an_attr_macro] +fn a() { + f(); // no +} + +#[an_attr_macro(with_span)] +fn b() { + f(); // yes +} + +fn c() { + a_rules_macro!(f()); // yes +} + +fn d() { + a_rules_macro!(()); // no +} + +fn main(){} diff --git a/tests/run-make/rustdoc-scrape-examples-macros/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-macros/src/lib.rs new file mode 100644 index 000000000..d8658a0f2 --- /dev/null +++ b/tests/run-make/rustdoc-scrape-examples-macros/src/lib.rs @@ -0,0 +1,12 @@ +// Scraped example should only include line numbers for items b and c in ex.rs +// @!has foobar/fn.f.html '//*[@class="src-line-numbers"]' '14' +// @has foobar/fn.f.html '//*[@class="src-line-numbers"]' '15' +// @has foobar/fn.f.html '//*[@class="src-line-numbers"]' '21' +// @!has foobar/fn.f.html '//*[@class="src-line-numbers"]' '22' + +pub fn f() {} + +#[macro_export] +macro_rules! a_rules_macro { + ($e:expr) => { ($e, foobar::f()); } +} diff --git a/tests/run-make/rustdoc-scrape-examples-macros/src/proc.rs b/tests/run-make/rustdoc-scrape-examples-macros/src/proc.rs new file mode 100644 index 000000000..46e518fdf --- /dev/null +++ b/tests/run-make/rustdoc-scrape-examples-macros/src/proc.rs @@ -0,0 +1,39 @@ +extern crate proc_macro; +use proc_macro::*; + +#[proc_macro] +pub fn a_proc_macro(_item: TokenStream) -> TokenStream { + "fn ex() { foobar::f(); }".parse().unwrap() +} + +// inserts foobar::f() to the end of the function +#[proc_macro_attribute] +pub fn an_attr_macro(attr: TokenStream, item: TokenStream) -> TokenStream { + let new_call: TokenStream = "foobar::f();".parse().unwrap(); + + let mut tokens = item.into_iter(); + + let fn_tok = tokens.next().unwrap(); + let ident_tok = tokens.next().unwrap(); + let args_tok = tokens.next().unwrap(); + let body = match tokens.next().unwrap() { + TokenTree::Group(g) => { + let new_g = Group::new(g.delimiter(), new_call); + let mut outer_g = Group::new( + g.delimiter(), + [TokenTree::Group(g.clone()), TokenTree::Group(new_g)].into_iter().collect(), + ); + + if attr.to_string() == "with_span" { + outer_g.set_span(g.span()); + } + + TokenTree::Group(outer_g) + } + _ => unreachable!(), + }; + + let tokens = vec![fn_tok, ident_tok, args_tok, body].into_iter().collect::(); + + tokens +} diff --git a/tests/run-make/rustdoc-scrape-examples-multiple/scrape.mk b/tests/run-make/rustdoc-scrape-examples-multiple/scrape.mk index 7a28d2145..57220bc66 100644 --- a/tests/run-make/rustdoc-scrape-examples-multiple/scrape.mk +++ b/tests/run-make/rustdoc-scrape-examples-multiple/scrape.mk @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk OUTPUT_DIR := "$(TMPDIR)/rustdoc" diff --git a/tests/run-make/rustdoc-shared-flags/Makefile b/tests/run-make/rustdoc-shared-flags/Makefile new file mode 100644 index 000000000..a2a7d7b36 --- /dev/null +++ b/tests/run-make/rustdoc-shared-flags/Makefile @@ -0,0 +1,18 @@ +include ../tools.mk + +all: z_help c_help list_passes + +c_help: + $(RUSTC) -C help > $(TMPDIR)/rustc.c_help.txt + $(RUSTDOC) -C help > $(TMPDIR)/rustdoc.c_help.txt + $(DIFF) $(TMPDIR)/rustc.c_help.txt $(TMPDIR)/rustdoc.c_help.txt + +z_help: + $(RUSTC) -Z help > $(TMPDIR)/rustc.z_help.txt + $(RUSTDOC) -Z help > $(TMPDIR)/rustdoc.z_help.txt + $(DIFF) $(TMPDIR)/rustc.z_help.txt $(TMPDIR)/rustdoc.z_help.txt + +list_passes: + $(RUSTC) -C passes=list > $(TMPDIR)/rustc.passes.txt + $(RUSTDOC) -C passes=list > $(TMPDIR)/rustdoc.passes.txt + $(DIFF) $(TMPDIR)/rustc.passes.txt $(TMPDIR)/rustdoc.passes.txt diff --git a/tests/run-make/rustdoc-target-spec-json-path/Makefile b/tests/run-make/rustdoc-target-spec-json-path/Makefile new file mode 100644 index 000000000..6d0bc4186 --- /dev/null +++ b/tests/run-make/rustdoc-target-spec-json-path/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +# Test that rustdoc will properly canonicalize the target spec json path just like rustc + +OUTPUT_DIR := "$(TMPDIR)/rustdoc-target-spec-json-path" + +all: + $(RUSTC) --crate-type lib dummy_core.rs --target target.json + $(RUSTDOC) -o $(OUTPUT_DIR) -L $(TMPDIR) my_crate.rs --target target.json diff --git a/tests/run-make/rustdoc-target-spec-json-path/dummy_core.rs b/tests/run-make/rustdoc-target-spec-json-path/dummy_core.rs new file mode 100644 index 000000000..da27b7f34 --- /dev/null +++ b/tests/run-make/rustdoc-target-spec-json-path/dummy_core.rs @@ -0,0 +1,2 @@ +#![feature(no_core)] +#![no_core] diff --git a/tests/run-make/rustdoc-target-spec-json-path/my_crate.rs b/tests/run-make/rustdoc-target-spec-json-path/my_crate.rs new file mode 100644 index 000000000..12aa08220 --- /dev/null +++ b/tests/run-make/rustdoc-target-spec-json-path/my_crate.rs @@ -0,0 +1,3 @@ +#![feature(no_core)] +#![no_core] +extern crate dummy_core; diff --git a/tests/run-make/rustdoc-target-spec-json-path/target.json b/tests/run-make/rustdoc-target-spec-json-path/target.json new file mode 100644 index 000000000..34357182c --- /dev/null +++ b/tests/run-make/rustdoc-target-spec-json-path/target.json @@ -0,0 +1,38 @@ +{ + "arch": "x86_64", + "cpu": "x86-64", + "crt-static-respected": true, + "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", + "dynamic-linking": true, + "env": "gnu", + "executables": true, + "has-elf-tls": true, + "has-rpath": true, + "linker-is-gnu": true, + "llvm-target": "x86_64-unknown-linux-gnu", + "max-atomic-width": 64, + "os": "linux", + "position-independent-executables": true, + "pre-link-args": { + "gcc": [ + "-m64" + ] + }, + "relro-level": "full", + "stack-probes": { + "kind": "inline-or-call", + "min-llvm-version-for-inline": [ + 11, + 0, + 1 + ] + }, + "supported-sanitizers": [ + "address", + "leak", + "memory", + "thread" + ], + "target-family": "unix", + "target-pointer-width": "64" +} diff --git a/tests/run-make/rustdoc-themes/Makefile b/tests/run-make/rustdoc-themes/Makefile new file mode 100644 index 000000000..a6d9a43ad --- /dev/null +++ b/tests/run-make/rustdoc-themes/Makefile @@ -0,0 +1,10 @@ +include ../tools.mk + +# Test that rustdoc will properly load in a theme file and display it in the theme selector. + +OUTPUT_DIR := "$(TMPDIR)/rustdoc-themes" + +all: + cp $(S)/src/librustdoc/html/static/css/themes/light.css $(TMPDIR)/test.css + $(RUSTDOC) -o $(OUTPUT_DIR) foo.rs --theme $(TMPDIR)/test.css + $(HTMLDOCCK) $(OUTPUT_DIR) foo.rs diff --git a/tests/run-make/rustdoc-themes/foo.rs b/tests/run-make/rustdoc-themes/foo.rs new file mode 100644 index 000000000..995544aef --- /dev/null +++ b/tests/run-make/rustdoc-themes/foo.rs @@ -0,0 +1,4 @@ +// @has test.css +// @has foo/struct.Foo.html +// @has - '//*[@id="rustdoc-vars"]/@data-themes' 'test' +pub struct Foo; diff --git a/tests/run-make/rustdoc-verify-output-files/Makefile b/tests/run-make/rustdoc-verify-output-files/Makefile index bfabbbc65..76f233ab4 100644 --- a/tests/run-make/rustdoc-verify-output-files/Makefile +++ b/tests/run-make/rustdoc-verify-output-files/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk OUTPUT_DIR := "$(TMPDIR)/rustdoc" TMP_OUTPUT_DIR := "$(TMPDIR)/tmp-rustdoc" @@ -14,7 +14,7 @@ all: $(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --out-dir $(OUTPUT_DIR) # Check if everything exactly same - $(DIFF) -r -q $(OUTPUT_DIR) $(TMP_OUTPUT_DIR) + $(DIFF) -r $(OUTPUT_DIR) $(TMP_OUTPUT_DIR) # Generate json doc on the same output $(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --out-dir $(OUTPUT_DIR) -Z unstable-options --output-format json @@ -22,15 +22,11 @@ all: # Check if expected json file is generated [ -e $(OUTPUT_DIR)/foobar.json ] - # TODO - # We should re-generate json doc once again and compare the diff with previously - # generated one. Because layout of json docs changes in each compilation, we can't - # do that currently. - # - # See https://github.com/rust-lang/rust/issues/103785#issuecomment-1307425590 for details. + # Copy first json output to check if it's exactly same after second compilation + cp -R $(OUTPUT_DIR)/foobar.json $(TMP_OUTPUT_DIR)/foobar.json - # remove generated json doc - rm $(OUTPUT_DIR)/foobar.json + # Generate json doc on the same output + $(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --out-dir $(OUTPUT_DIR) -Z unstable-options --output-format json - # Check if json doc compilation broke any of the html files generated previously - $(DIFF) -r -q $(OUTPUT_DIR) $(TMP_OUTPUT_DIR) + # Check if all docs(including both json and html formats) are still the same after multiple compilations + $(DIFF) -r $(OUTPUT_DIR) $(TMP_OUTPUT_DIR) diff --git a/tests/run-make/rustdoc-with-out-dir-option/Makefile b/tests/run-make/rustdoc-with-out-dir-option/Makefile index b3c3f5230..f5d5060ed 100644 --- a/tests/run-make/rustdoc-with-out-dir-option/Makefile +++ b/tests/run-make/rustdoc-with-out-dir-option/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk OUTPUT_DIR := "$(TMPDIR)/rustdoc" diff --git a/tests/run-make/rustdoc-with-output-option/Makefile b/tests/run-make/rustdoc-with-output-option/Makefile index 02093a35c..d0a8205a8 100644 --- a/tests/run-make/rustdoc-with-output-option/Makefile +++ b/tests/run-make/rustdoc-with-output-option/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk OUTPUT_DIR := "$(TMPDIR)/rustdoc" diff --git a/tests/run-make/rustdoc-with-short-out-dir-option/Makefile b/tests/run-make/rustdoc-with-short-out-dir-option/Makefile index dc5056a86..1b9327bce 100644 --- a/tests/run-make/rustdoc-with-short-out-dir-option/Makefile +++ b/tests/run-make/rustdoc-with-short-out-dir-option/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk OUTPUT_DIR := "$(TMPDIR)/rustdoc" diff --git a/tests/run-make/sanitizer-cdylib-link/Makefile b/tests/run-make/sanitizer-cdylib-link/Makefile new file mode 100644 index 000000000..691585268 --- /dev/null +++ b/tests/run-make/sanitizer-cdylib-link/Makefile @@ -0,0 +1,16 @@ +# needs-sanitizer-support +# needs-sanitizer-address + +include ../tools.mk + +LOG := $(TMPDIR)/log.txt + +# This test builds a shared object, then an executable that links it as a native +# rust library (contrast to an rlib). The shared library and executable both +# are compiled with address sanitizer, and we assert that a fault in the cdylib +# is correctly detected. + +all: + $(RUSTC) -g -Z sanitizer=address --crate-type cdylib --target $(TARGET) library.rs + $(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) -llibrary program.rs + LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow diff --git a/tests/run-make/sanitizer-cdylib-link/library.rs b/tests/run-make/sanitizer-cdylib-link/library.rs new file mode 100644 index 000000000..f2a52cb5c --- /dev/null +++ b/tests/run-make/sanitizer-cdylib-link/library.rs @@ -0,0 +1,5 @@ +#[no_mangle] +pub extern "C" fn overflow() { + let xs = [0, 1, 2, 3]; + let _y = unsafe { *xs.as_ptr().offset(4) }; +} diff --git a/tests/run-make/sanitizer-cdylib-link/program.rs b/tests/run-make/sanitizer-cdylib-link/program.rs new file mode 100644 index 000000000..ef053aa2e --- /dev/null +++ b/tests/run-make/sanitizer-cdylib-link/program.rs @@ -0,0 +1,7 @@ +extern "C" { + fn overflow(); +} + +fn main() { + unsafe { overflow() } +} diff --git a/tests/run-make/sanitizer-dylib-link/Makefile b/tests/run-make/sanitizer-dylib-link/Makefile new file mode 100644 index 000000000..b0a91e5b1 --- /dev/null +++ b/tests/run-make/sanitizer-dylib-link/Makefile @@ -0,0 +1,16 @@ +# needs-sanitizer-support +# needs-sanitizer-address + +include ../tools.mk + +LOG := $(TMPDIR)/log.txt + +# This test builds a shared object, then an executable that links it as a native +# rust library (contrast to an rlib). The shared library and executable both +# are compiled with address sanitizer, and we assert that a fault in the dylib +# is correctly detected. + +all: + $(RUSTC) -g -Z sanitizer=address --crate-type dylib --target $(TARGET) library.rs + $(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) -llibrary program.rs + LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow diff --git a/tests/run-make/sanitizer-dylib-link/library.rs b/tests/run-make/sanitizer-dylib-link/library.rs new file mode 100644 index 000000000..f2a52cb5c --- /dev/null +++ b/tests/run-make/sanitizer-dylib-link/library.rs @@ -0,0 +1,5 @@ +#[no_mangle] +pub extern "C" fn overflow() { + let xs = [0, 1, 2, 3]; + let _y = unsafe { *xs.as_ptr().offset(4) }; +} diff --git a/tests/run-make/sanitizer-dylib-link/program.rs b/tests/run-make/sanitizer-dylib-link/program.rs new file mode 100644 index 000000000..ef053aa2e --- /dev/null +++ b/tests/run-make/sanitizer-dylib-link/program.rs @@ -0,0 +1,7 @@ +extern "C" { + fn overflow(); +} + +fn main() { + unsafe { overflow() } +} diff --git a/tests/run-make/sanitizer-staticlib-link/Makefile b/tests/run-make/sanitizer-staticlib-link/Makefile new file mode 100644 index 000000000..7b1a286ed --- /dev/null +++ b/tests/run-make/sanitizer-staticlib-link/Makefile @@ -0,0 +1,20 @@ +# needs-sanitizer-support +# needs-sanitizer-address + +include ../tools.mk + +# This test first builds a staticlib with AddressSanitizer and checks that +# linking it to an executable fails due to the missing sanitizer runtime. +# It then builds an executable linking to the staticlib and checks that +# the fault in the staticlib is detected correctly. + +# Note that checking for the link failure actually checks two things at once: +# 1) That the library has the sanitizer intrumentation +# 2) and that library does not have the sanitizer runtime + +all: + $(RUSTC) -g -Z sanitizer=address --crate-type staticlib --target $(TARGET) library.rs + ! $(CC) program.c $(call STATICLIB,library) $(call OUT_EXE,program) $(EXTRACFLAGS) $(EXTRACXXFLAGS) + $(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) -L . program.rs + LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow + diff --git a/tests/run-make/sanitizer-staticlib-link/library.rs b/tests/run-make/sanitizer-staticlib-link/library.rs new file mode 100644 index 000000000..f2a52cb5c --- /dev/null +++ b/tests/run-make/sanitizer-staticlib-link/library.rs @@ -0,0 +1,5 @@ +#[no_mangle] +pub extern "C" fn overflow() { + let xs = [0, 1, 2, 3]; + let _y = unsafe { *xs.as_ptr().offset(4) }; +} diff --git a/tests/run-make/sanitizer-staticlib-link/program.c b/tests/run-make/sanitizer-staticlib-link/program.c new file mode 100644 index 000000000..735e2b147 --- /dev/null +++ b/tests/run-make/sanitizer-staticlib-link/program.c @@ -0,0 +1,6 @@ +void overflow(); + +int main() { + overflow(); + return 0; +} diff --git a/tests/run-make/sanitizer-staticlib-link/program.rs b/tests/run-make/sanitizer-staticlib-link/program.rs new file mode 100644 index 000000000..ec59bdb11 --- /dev/null +++ b/tests/run-make/sanitizer-staticlib-link/program.rs @@ -0,0 +1,10 @@ +#[link(name = "library")] +extern "C" { + fn overflow(); +} + +fn main() { + unsafe { + overflow(); + } +} diff --git a/tests/run-make/separate-link-fail/Makefile b/tests/run-make/separate-link-fail/Makefile new file mode 100644 index 000000000..bfd18fbf9 --- /dev/null +++ b/tests/run-make/separate-link-fail/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +all: + echo 'fn main(){}' > $(TMPDIR)/main.rs + # Make sure that this fails + ! $(RUSTC) -Z link-only $(TMPDIR)/main.rs 2> $(TMPDIR)/stderr.txt + $(CGREP) "The input does not look like a .rlink file" < $(TMPDIR)/stderr.txt diff --git a/tests/run-make/separate-link/Makefile b/tests/run-make/separate-link/Makefile new file mode 100644 index 000000000..d01158d9f --- /dev/null +++ b/tests/run-make/separate-link/Makefile @@ -0,0 +1,7 @@ +# ignore-cross-compile +include ../tools.mk + +all: + echo 'fn main(){}' | $(RUSTC) -Z no-link - + $(RUSTC) -Z link-only $(TMPDIR)/rust_out.rlink + $(call RUN,rust_out) diff --git a/tests/run-make/sepcomp-cci-copies/Makefile b/tests/run-make/sepcomp-cci-copies/Makefile new file mode 100644 index 000000000..df289d0b0 --- /dev/null +++ b/tests/run-make/sepcomp-cci-copies/Makefile @@ -0,0 +1,12 @@ +include ../tools.mk + +# Check that cross-crate inlined items are inlined in all compilation units +# that refer to them, and not in any other compilation units. +# Note that we have to pass `-C codegen-units=6` because up to two CGUs may be +# created for each source module (see `rustc_const_eval::monomorphize::partitioning`). + +all: + $(RUSTC) cci_lib.rs + $(RUSTC) foo.rs --emit=llvm-ir -C codegen-units=6 \ + -Z inline-in-all-cgus + [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c define\ .*cci_fn)" -eq "2" ] diff --git a/tests/run-make/sepcomp-cci-copies/cci_lib.rs b/tests/run-make/sepcomp-cci-copies/cci_lib.rs new file mode 100644 index 000000000..869d4a6cd --- /dev/null +++ b/tests/run-make/sepcomp-cci-copies/cci_lib.rs @@ -0,0 +1,6 @@ +#![crate_type = "rlib"] + +#[inline] +pub fn cci_fn() -> usize { + 1234 +} diff --git a/tests/run-make/sepcomp-cci-copies/foo.rs b/tests/run-make/sepcomp-cci-copies/foo.rs new file mode 100644 index 000000000..ba251fcb0 --- /dev/null +++ b/tests/run-make/sepcomp-cci-copies/foo.rs @@ -0,0 +1,25 @@ +extern crate cci_lib; +use cci_lib::cci_fn; + +fn call1() -> usize { + cci_fn() +} + +mod a { + use cci_lib::cci_fn; + pub fn call2() -> usize { + cci_fn() + } +} + +mod b { + pub fn call3() -> usize { + 0 + } +} + +fn main() { + call1(); + a::call2(); + b::call3(); +} diff --git a/tests/run-make/sepcomp-inlining/Makefile b/tests/run-make/sepcomp-inlining/Makefile new file mode 100644 index 000000000..327aeb75e --- /dev/null +++ b/tests/run-make/sepcomp-inlining/Makefile @@ -0,0 +1,15 @@ +include ../tools.mk + +# Test that #[inline] functions still get inlined across compilation unit +# boundaries. Compilation should produce three IR files, but only the two +# compilation units that have a usage of the #[inline] function should +# contain a definition. Also, the non-#[inline] function should be defined +# in only one compilation unit. + +all: + $(RUSTC) foo.rs --emit=llvm-ir -C codegen-units=3 \ + -Z inline-in-all-cgus + [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c define\ i32\ .*inlined)" -eq "0" ] + [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c define\ internal\ i32\ .*inlined)" -eq "2" ] + [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c define\ hidden\ i32\ .*normal)" -eq "1" ] + [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c declare\ hidden\ i32\ .*normal)" -eq "2" ] diff --git a/tests/run-make/sepcomp-inlining/foo.rs b/tests/run-make/sepcomp-inlining/foo.rs new file mode 100644 index 000000000..2fe5f9cb7 --- /dev/null +++ b/tests/run-make/sepcomp-inlining/foo.rs @@ -0,0 +1,30 @@ +#![feature(start)] + +#[inline] +fn inlined() -> u32 { + 1234 +} + +fn normal() -> u32 { + 2345 +} + +mod a { + pub fn f() -> u32 { + ::inlined() + ::normal() + } +} + +mod b { + pub fn f() -> u32 { + ::inlined() + ::normal() + } +} + +#[start] +fn start(_: isize, _: *const *const u8) -> isize { + a::f(); + b::f(); + + 0 +} diff --git a/tests/run-make/sepcomp-separate/Makefile b/tests/run-make/sepcomp-separate/Makefile new file mode 100644 index 000000000..62cf54a88 --- /dev/null +++ b/tests/run-make/sepcomp-separate/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +# Test that separate compilation actually puts code into separate compilation +# units. `foo.rs` defines `magic_fn` in three different modules, which should +# wind up in three different compilation units. + +all: + $(RUSTC) foo.rs --emit=llvm-ir -C codegen-units=3 + [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c define\ .*magic_fn)" -eq "3" ] diff --git a/tests/run-make/sepcomp-separate/foo.rs b/tests/run-make/sepcomp-separate/foo.rs new file mode 100644 index 000000000..169bafa9b --- /dev/null +++ b/tests/run-make/sepcomp-separate/foo.rs @@ -0,0 +1,21 @@ +fn magic_fn() -> usize { + 1234 +} + +mod a { + pub fn magic_fn() -> usize { + 2345 + } +} + +mod b { + pub fn magic_fn() -> usize { + 3456 + } +} + +fn main() { + magic_fn(); + a::magic_fn(); + b::magic_fn(); +} diff --git a/tests/run-make/share-generics-dylib/Makefile b/tests/run-make/share-generics-dylib/Makefile new file mode 100644 index 000000000..9d97eca80 --- /dev/null +++ b/tests/run-make/share-generics-dylib/Makefile @@ -0,0 +1,23 @@ +# ignore-cross-compile +# This test makes sure all generic instances get re-exported from Rust dylibs for use by +# `-Zshare-generics`. There are two rlibs (`instance_provider_a` and `instance_provider_b`) +# which both provide an instance of `Cell::set`. There is `instance_user_dylib` which is +# supposed to re-export both these instances, and then there are `instance_user_a_rlib` and +# `instance_user_b_rlib` which each rely on a specific instance to be available. +# +# In the end everything is linked together into `linked_leaf`. If `instance_user_dylib` does +# not export both then we'll get an `undefined reference` error for one of the instances. +# +# This is regression test for https://github.com/rust-lang/rust/issues/67276. + +include ../tools.mk + +COMMON_ARGS=-Cprefer-dynamic -Zshare-generics=yes -Ccodegen-units=1 -Csymbol-mangling-version=v0 + +all: + $(RUSTC) instance_provider_a.rs $(COMMON_ARGS) --crate-type=rlib + $(RUSTC) instance_provider_b.rs $(COMMON_ARGS) --crate-type=rlib + $(RUSTC) instance_user_dylib.rs $(COMMON_ARGS) --crate-type=dylib + $(RUSTC) instance_user_a_rlib.rs $(COMMON_ARGS) --crate-type=rlib + $(RUSTC) instance_user_b_rlib.rs $(COMMON_ARGS) --crate-type=rlib + $(RUSTC) linked_leaf.rs $(COMMON_ARGS) --crate-type=bin diff --git a/tests/run-make/share-generics-dylib/instance_provider_a.rs b/tests/run-make/share-generics-dylib/instance_provider_a.rs new file mode 100644 index 000000000..b4e125ac0 --- /dev/null +++ b/tests/run-make/share-generics-dylib/instance_provider_a.rs @@ -0,0 +1,6 @@ +use std::cell::Cell; + +pub fn foo() { + let a: Cell = Cell::new(1); + a.set(123); +} diff --git a/tests/run-make/share-generics-dylib/instance_provider_b.rs b/tests/run-make/share-generics-dylib/instance_provider_b.rs new file mode 100644 index 000000000..f613db873 --- /dev/null +++ b/tests/run-make/share-generics-dylib/instance_provider_b.rs @@ -0,0 +1,6 @@ +use std::cell::Cell; + +pub fn foo() { + let b: Cell = Cell::new(1); + b.set(123); +} diff --git a/tests/run-make/share-generics-dylib/instance_user_a_rlib.rs b/tests/run-make/share-generics-dylib/instance_user_a_rlib.rs new file mode 100644 index 000000000..c8e6ab95c --- /dev/null +++ b/tests/run-make/share-generics-dylib/instance_user_a_rlib.rs @@ -0,0 +1,9 @@ +extern crate instance_provider_a as upstream; +use std::cell::Cell; + +pub fn foo() { + upstream::foo(); + + let b: Cell = Cell::new(1); + b.set(123); +} diff --git a/tests/run-make/share-generics-dylib/instance_user_b_rlib.rs b/tests/run-make/share-generics-dylib/instance_user_b_rlib.rs new file mode 100644 index 000000000..7c34af6d0 --- /dev/null +++ b/tests/run-make/share-generics-dylib/instance_user_b_rlib.rs @@ -0,0 +1,9 @@ +extern crate instance_provider_b as upstream; +use std::cell::Cell; + +pub fn foo() { + upstream::foo(); + + let b: Cell = Cell::new(1); + b.set(123); +} diff --git a/tests/run-make/share-generics-dylib/instance_user_dylib.rs b/tests/run-make/share-generics-dylib/instance_user_dylib.rs new file mode 100644 index 000000000..7c8368eec --- /dev/null +++ b/tests/run-make/share-generics-dylib/instance_user_dylib.rs @@ -0,0 +1,7 @@ +extern crate instance_provider_a; +extern crate instance_provider_b; + +pub fn foo() { + instance_provider_a::foo(); + instance_provider_b::foo(); +} diff --git a/tests/run-make/share-generics-dylib/linked_leaf.rs b/tests/run-make/share-generics-dylib/linked_leaf.rs new file mode 100644 index 000000000..e510dad69 --- /dev/null +++ b/tests/run-make/share-generics-dylib/linked_leaf.rs @@ -0,0 +1,15 @@ +extern crate instance_user_dylib; +extern crate instance_user_a_rlib; +extern crate instance_user_b_rlib; + +use std::cell::Cell; + +fn main() { + + instance_user_a_rlib::foo(); + instance_user_b_rlib::foo(); + instance_user_dylib::foo(); + + let a: Cell = Cell::new(1); + a.set(123); +} diff --git a/tests/run-make/simd-ffi/Makefile b/tests/run-make/simd-ffi/Makefile new file mode 100644 index 000000000..297353470 --- /dev/null +++ b/tests/run-make/simd-ffi/Makefile @@ -0,0 +1,47 @@ +include ../tools.mk + +TARGETS = +ifeq ($(filter arm,$(LLVM_COMPONENTS)),arm) +# construct a fairly exhaustive list of platforms that we +# support. These ones don't follow a pattern +TARGETS += arm-linux-androideabi arm-unknown-linux-gnueabihf arm-unknown-linux-gnueabi +endif + +ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86) +X86_ARCHS = i686 x86_64 +else +X86_ARCHS = +endif + +# these ones do, each OS lists the architectures it supports +LINUX=$(filter aarch64 mips,$(LLVM_COMPONENTS)) $(X86_ARCHS) +ifeq ($(filter mips,$(LLVM_COMPONENTS)),mips) +LINUX += mipsel +endif + +WINDOWS=$(X86_ARCHS) +# fails with: failed to get iphonesimulator SDK path: no such file or directory +#IOS=i386 aarch64 armv7 +DARWIN=$(X86_ARCHS) + +$(foreach arch,$(LINUX),$(eval TARGETS += $(arch)-unknown-linux-gnu)) +$(foreach arch,$(WINDOWS),$(eval TARGETS += $(arch)-pc-windows-gnu)) +#$(foreach arch,$(IOS),$(eval TARGETS += $(arch)-apple-ios)) +$(foreach arch,$(DARWIN),$(eval TARGETS += $(arch)-apple-darwin)) + +all: $(TARGETS) + +define MK_TARGETS +# compile the rust file to the given target, but only to asm and IR +# form, to avoid having to have an appropriate linker. +# +# we need some features because the integer SIMD instructions are not +# enabled by-default for i686 and ARM; these features will be invalid +# on some platforms, but LLVM just prints a warning so that's fine for +# now. +$(1): simd.rs + $$(RUSTC) --target=$(1) --emit=llvm-ir,asm simd.rs \ + -C target-feature='+neon,+sse2' -C extra-filename=-$(1) +endef + +$(foreach targetxxx,$(TARGETS),$(eval $(call MK_TARGETS,$(targetxxx)))) diff --git a/tests/run-make/simd-ffi/simd.rs b/tests/run-make/simd-ffi/simd.rs new file mode 100644 index 000000000..d11cfd77c --- /dev/null +++ b/tests/run-make/simd-ffi/simd.rs @@ -0,0 +1,82 @@ +// ensures that public symbols are not removed completely +#![crate_type = "lib"] +// we can compile to a variety of platforms, because we don't need +// cross-compiled standard libraries. +#![feature(no_core, auto_traits)] +#![no_core] +#![feature(repr_simd, simd_ffi, link_llvm_intrinsics, lang_items, rustc_attrs)] + +#[derive(Copy)] +#[repr(simd)] +pub struct f32x4(f32, f32, f32, f32); + +extern "C" { + #[link_name = "llvm.sqrt.v4f32"] + fn vsqrt(x: f32x4) -> f32x4; +} + +pub fn foo(x: f32x4) -> f32x4 { + unsafe { vsqrt(x) } +} + +#[derive(Copy)] +#[repr(simd)] +pub struct i32x4(i32, i32, i32, i32); + +extern "C" { + // _mm_sll_epi32 + #[cfg(any(target_arch = "x86", target_arch = "x86-64"))] + #[link_name = "llvm.x86.sse2.psll.d"] + fn integer(a: i32x4, b: i32x4) -> i32x4; + + // vmaxq_s32 + #[cfg(target_arch = "arm")] + #[link_name = "llvm.arm.neon.vmaxs.v4i32"] + fn integer(a: i32x4, b: i32x4) -> i32x4; + // vmaxq_s32 + #[cfg(target_arch = "aarch64")] + #[link_name = "llvm.aarch64.neon.maxs.v4i32"] + fn integer(a: i32x4, b: i32x4) -> i32x4; + + // just some substitute foreign symbol, not an LLVM intrinsic; so + // we still get type checking, but not as detailed as (ab)using + // LLVM. + #[cfg(not(any( + target_arch = "x86", + target_arch = "x86-64", + target_arch = "arm", + target_arch = "aarch64" + )))] + fn integer(a: i32x4, b: i32x4) -> i32x4; +} + +pub fn bar(a: i32x4, b: i32x4) -> i32x4 { + unsafe { integer(a, b) } +} + +#[lang = "sized"] +pub trait Sized {} + +#[lang = "copy"] +pub trait Copy {} + +impl Copy for f32 {} +impl Copy for i32 {} + +pub mod marker { + pub use Copy; +} + +#[lang = "freeze"] +auto trait Freeze {} + +#[macro_export] +#[rustc_builtin_macro] +macro_rules! Copy { + () => {}; +} +#[macro_export] +#[rustc_builtin_macro] +macro_rules! derive { + () => {}; +} diff --git a/tests/run-make/simple-dylib/Makefile b/tests/run-make/simple-dylib/Makefile new file mode 100644 index 000000000..f3e1c1da8 --- /dev/null +++ b/tests/run-make/simple-dylib/Makefile @@ -0,0 +1,6 @@ +# ignore-cross-compile +include ../tools.mk +all: + $(RUSTC) bar.rs --crate-type=dylib -C prefer-dynamic + $(RUSTC) foo.rs + $(call RUN,foo) diff --git a/tests/run-make/simple-dylib/bar.rs b/tests/run-make/simple-dylib/bar.rs new file mode 100644 index 000000000..c5c0bc606 --- /dev/null +++ b/tests/run-make/simple-dylib/bar.rs @@ -0,0 +1 @@ +pub fn bar() {} diff --git a/tests/run-make/simple-dylib/foo.rs b/tests/run-make/simple-dylib/foo.rs new file mode 100644 index 000000000..8d68535e3 --- /dev/null +++ b/tests/run-make/simple-dylib/foo.rs @@ -0,0 +1,5 @@ +extern crate bar; + +fn main() { + bar::bar(); +} diff --git a/tests/run-make/simple-rlib/Makefile b/tests/run-make/simple-rlib/Makefile new file mode 100644 index 000000000..28df61a15 --- /dev/null +++ b/tests/run-make/simple-rlib/Makefile @@ -0,0 +1,6 @@ +# ignore-cross-compile +include ../tools.mk +all: + $(RUSTC) bar.rs --crate-type=rlib + $(RUSTC) foo.rs + $(call RUN,foo) diff --git a/tests/run-make/simple-rlib/bar.rs b/tests/run-make/simple-rlib/bar.rs new file mode 100644 index 000000000..c5c0bc606 --- /dev/null +++ b/tests/run-make/simple-rlib/bar.rs @@ -0,0 +1 @@ +pub fn bar() {} diff --git a/tests/run-make/simple-rlib/foo.rs b/tests/run-make/simple-rlib/foo.rs new file mode 100644 index 000000000..8d68535e3 --- /dev/null +++ b/tests/run-make/simple-rlib/foo.rs @@ -0,0 +1,5 @@ +extern crate bar; + +fn main() { + bar::bar(); +} diff --git a/tests/run-make/split-debuginfo/Makefile b/tests/run-make/split-debuginfo/Makefile new file mode 100644 index 000000000..71e014c1f --- /dev/null +++ b/tests/run-make/split-debuginfo/Makefile @@ -0,0 +1,309 @@ +# ignore-cross-compile +include ../tools.mk + +all: off packed unpacked + +ifeq ($(UNAME),Darwin) +# If disabled, don't run `dsymutil`. +off: + rm -rf $(TMPDIR)/*.dSYM + $(RUSTC) foo.rs -g -C split-debuginfo=off + [ ! -d $(TMPDIR)/foo.dSYM ] + +# Packed by default, but only if debuginfo is requested +packed: + rm -rf $(TMPDIR)/*.dSYM + $(RUSTC) foo.rs + [ ! -d $(TMPDIR)/foo.dSYM ] + rm -rf $(TMPDIR)/*.dSYM + $(RUSTC) foo.rs -g + [ -d $(TMPDIR)/foo.dSYM ] + rm -rf $(TMPDIR)/*.dSYM + $(RUSTC) foo.rs -g -C split-debuginfo=packed + [ -d $(TMPDIR)/foo.dSYM ] + rm -rf $(TMPDIR)/*.dSYM + +# Object files are preserved with unpacked and `dsymutil` isn't run +unpacked: + $(RUSTC) foo.rs -g -C split-debuginfo=unpacked + ls $(TMPDIR)/*.o + [ ! -d $(TMPDIR)/foo.dSYM ] +else +ifdef IS_WINDOWS +# Windows only supports packed debuginfo - nothing to test. +off: +packed: +unpacked: +else +# Some non-Windows, non-Darwin platforms are not stable, and some are. +ifeq ($(UNAME),Linux) + UNSTABLEOPTS := +else + UNSTABLEOPTS := -Zunstable-options +endif + +# - Debuginfo in `.o` files +# - `.o` deleted +# - `.dwo` never created +# - `.dwp` never created +off: + $(RUSTC) foo.rs -g -C $(UNSTABLEOPTS) split-debuginfo=off + [ ! -f $(TMPDIR)/*.dwp ] + [ ! -f $(TMPDIR)/*.dwo ] + $(RUSTC) foo.rs -g + [ ! -f $(TMPDIR)/*.dwp ] + [ ! -f $(TMPDIR)/*.dwo ] + +packed: packed-split packed-single packed-lto packed-remapped packed-crosscrate + +# - Debuginfo in `.dwo` files +# - `.o` deleted +# - `.dwo` deleted +# - `.dwp` present +packed-split: + $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=packed -Zsplit-dwarf-kind=split + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + rm $(TMPDIR)/foo.dwp + rm $(TMPDIR)/$(call BIN,foo) + +# - Debuginfo in `.o` files +# - `.o` deleted +# - `.dwo` never created +# - `.dwp` present +packed-single: + $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=packed -Zsplit-dwarf-kind=single + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + rm $(TMPDIR)/foo.dwp + rm $(TMPDIR)/$(call BIN,foo) + +packed-lto: packed-lto-split packed-lto-single + +# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated +# - `.o` never created +# - `.dwo` never created +# - `.dwp` never created +packed-lto-split: + $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=packed -Zsplit-dwarf-kind=split \ + --crate-type=rlib -Clinker-plugin-lto + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + rm $(TMPDIR)/libbaz.rlib + +# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated +# - `.o` never created +# - `.dwo` never created +# - `.dwp` never created +packed-lto-single: + $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=packed -Zsplit-dwarf-kind=single \ + --crate-type=rlib -Clinker-plugin-lto + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + rm $(TMPDIR)/libbaz.rlib + +packed-remapped: packed-remapped-split packed-remapped-single + +# - Debuginfo in `.dwo` files +# - `.o` and binary refer to remapped `.dwo` paths which do not exist +# - `.o` deleted +# - `.dwo` deleted +# - `.dwp` present +packed-remapped-split: + $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \ + -Z split-dwarf-kind=split --remap-path-prefix $(TMPDIR)=/a foo.rs -g + objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + rm $(TMPDIR)/foo.dwp + rm $(TMPDIR)/$(call BIN,foo) + +# - Debuginfo in `.o` files +# - `.o` and binary refer to remapped `.o` paths which do not exist +# - `.o` deleted +# - `.dwo` never created +# - `.dwp` present +packed-remapped-single: + $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \ + -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a foo.rs -g + objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + rm $(TMPDIR)/foo.dwp + rm $(TMPDIR)/$(call BIN,foo) + +packed-crosscrate: packed-crosscrate-split packed-crosscrate-single + +# - Debuginfo in `.dwo` files +# - (bar) `.rlib` file created, contains `.dwo` +# - (bar) `.o` deleted +# - (bar) `.dwo` deleted +# - (bar) `.dwp` never created +# - (main) `.o` deleted +# - (main) `.dwo` deleted +# - (main) `.dwp` present +packed-crosscrate-split: + $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=packed \ + -Zsplit-dwarf-kind=split -C debuginfo=2 -g bar.rs + ls $(TMPDIR)/*.rlib + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \ + -C split-debuginfo=packed -Zsplit-dwarf-kind=split -C debuginfo=2 -g main.rs + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + rm $(TMPDIR)/main.dwp + rm $(TMPDIR)/$(call BIN,main) + +# - Debuginfo in `.o` files +# - (bar) `.rlib` file created, contains `.o` +# - (bar) `.o` deleted +# - (bar) `.dwo` never created +# - (bar) `.dwp` never created +# - (main) `.o` deleted +# - (main) `.dwo` never created +# - (main) `.dwp` present +packed-crosscrate-single: + $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=packed \ + -Zsplit-dwarf-kind=single -C debuginfo=2 -g bar.rs + ls $(TMPDIR)/*.rlib + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \ + -C split-debuginfo=packed -Zsplit-dwarf-kind=single -C debuginfo=2 -g main.rs + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + rm $(TMPDIR)/main.dwp + rm $(TMPDIR)/$(call BIN,main) + +unpacked: unpacked-split unpacked-single unpacked-lto unpacked-remapped unpacked-crosscrate + +# - Debuginfo in `.dwo` files +# - `.o` deleted +# - `.dwo` present +# - `.dwp` never created +unpacked-split: + $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=unpacked -Zsplit-dwarf-kind=split + ls $(TMPDIR)/*.o && exit 1 || exit 0 + rm $(TMPDIR)/*.dwo + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + rm $(TMPDIR)/$(call BIN,foo) + +# - Debuginfo in `.o` files +# - `.o` present +# - `.dwo` never created +# - `.dwp` never created +unpacked-single: + $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=unpacked -Zsplit-dwarf-kind=single + ls $(TMPDIR)/*.o + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + rm $(TMPDIR)/$(call BIN,foo) + +unpacked-lto: packed-lto-split packed-lto-single + +# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated +# - `.o` never created +# - `.dwo` never created +# - `.dwp` never created +unpacked-lto-split: + $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=unpacked -Zsplit-dwarf-kind=split \ + --crate-type=rlib -Clinker-plugin-lto + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + rm $(TMPDIR)/libbaz.rlib + +# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated +# - `.o` never created +# - `.dwo` never created +# - `.dwp` never created +unpacked-lto-single: + $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=unpacked -Zsplit-dwarf-kind=single \ + --crate-type=rlib -Clinker-plugin-lto + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + rm $(TMPDIR)/libbaz.rlib + +unpacked-remapped: unpacked-remapped-split unpacked-remapped-single + +# - Debuginfo in `.dwo` files +# - `.o` and binary refer to remapped `.dwo` paths which do not exist +# - `.o` deleted +# - `.dwo` present +# - `.dwp` never created +unpacked-remapped-split: + $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \ + -Z split-dwarf-kind=split --remap-path-prefix $(TMPDIR)=/a foo.rs -g + objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 + ls $(TMPDIR)/*.o && exit 1 || exit 0 + rm $(TMPDIR)/*.dwo + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + rm $(TMPDIR)/$(call BIN,foo) + +# - Debuginfo in `.o` files +# - `.o` and binary refer to remapped `.o` paths which do not exist +# - `.o` present +# - `.dwo` never created +# - `.dwp` never created +unpacked-remapped-single: + $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \ + -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a foo.rs -g + objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 + rm $(TMPDIR)/*.o + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + rm $(TMPDIR)/$(call BIN,foo) + +unpacked-crosscrate: unpacked-crosscrate-split unpacked-crosscrate-single + +# - Debuginfo in `.dwo` files +# - (bar) `.rlib` file created, contains `.dwo` +# - (bar) `.o` deleted +# - (bar) `.dwo` present +# - (bar) `.dwp` never created +# - (main) `.o` deleted +# - (main) `.dwo` present +# - (main) `.dwp` never created +unpacked-crosscrate-split: + $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=unpacked \ + -Zsplit-dwarf-kind=split -C debuginfo=2 -g bar.rs + ls $(TMPDIR)/*.rlib + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \ + -C split-debuginfo=unpacked -Zsplit-dwarf-kind=split -C debuginfo=2 -g main.rs + ls $(TMPDIR)/*.o && exit 1 || exit 0 + rm $(TMPDIR)/*.dwo + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + rm $(TMPDIR)/$(call BIN,main) + +# - Debuginfo in `.o` files +# - (bar) `.rlib` file created, contains `.o` +# - (bar) `.o` present +# - (bar) `.dwo` never created +# - (bar) `.dwp` never created +# - (main) `.o` present +# - (main) `.dwo` never created +# - (main) `.dwp` never created +unpacked-crosscrate-single: + $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=unpacked \ + -Zsplit-dwarf-kind=single -C debuginfo=2 -g bar.rs + ls $(TMPDIR)/*.rlib + ls $(TMPDIR)/*.o + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \ + -C split-debuginfo=unpacked -Zsplit-dwarf-kind=single -C debuginfo=2 -g main.rs + ls $(TMPDIR)/*.o + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + rm $(TMPDIR)/$(call BIN,main) +endif +endif diff --git a/tests/run-make/split-debuginfo/bar.rs b/tests/run-make/split-debuginfo/bar.rs new file mode 100644 index 000000000..07dd07152 --- /dev/null +++ b/tests/run-make/split-debuginfo/bar.rs @@ -0,0 +1,13 @@ +pub struct Bar { + x: u32, +} + +impl Bar { + pub fn print(&self) { + println!("{}", self.x); + } +} + +pub fn make_bar(x: u32) -> Bar { + Bar { x } +} diff --git a/tests/run-make/split-debuginfo/baz.rs b/tests/run-make/split-debuginfo/baz.rs new file mode 100644 index 000000000..8b1a39374 --- /dev/null +++ b/tests/run-make/split-debuginfo/baz.rs @@ -0,0 +1 @@ +// empty diff --git a/tests/run-make/split-debuginfo/foo.rs b/tests/run-make/split-debuginfo/foo.rs new file mode 100644 index 000000000..b058e5408 --- /dev/null +++ b/tests/run-make/split-debuginfo/foo.rs @@ -0,0 +1,15 @@ +pub struct Foo { + x: u32, +} + +impl Foo { + pub fn print(&self) { + println!("{}", self.x); + } +} + +pub fn make_foo(x: u32) -> Foo { + Foo { x } +} + +fn main() {} diff --git a/tests/run-make/split-debuginfo/main.rs b/tests/run-make/split-debuginfo/main.rs new file mode 100644 index 000000000..21fa16e40 --- /dev/null +++ b/tests/run-make/split-debuginfo/main.rs @@ -0,0 +1,8 @@ +extern crate bar; + +use bar::{Bar, make_bar}; + +fn main() { + let b = make_bar(3); + b.print(); +} diff --git a/tests/run-make/stable-symbol-names/Makefile b/tests/run-make/stable-symbol-names/Makefile new file mode 100644 index 000000000..bbfb8e388 --- /dev/null +++ b/tests/run-make/stable-symbol-names/Makefile @@ -0,0 +1,41 @@ +include ../tools.mk + +# The following command will: +# 1. dump the symbols of a library using `nm` +# 2. extract only those lines that we are interested in via `grep` +# 3. from those lines, extract just the symbol name via `sed`, which: +# * always starts with "_ZN" and ends with "E" (`legacy` mangling) +# * always starts with "_R" (`v0` mangling) +# 4. sort those symbol names for deterministic comparison +# 5. write the result into a file + +dump-symbols = nm "$(TMPDIR)/lib$(1).rlib" \ + | grep -E "$(2)" \ + | sed -E "s/.*(_ZN.*E|_R[a-zA-Z0-9_]*).*/\1/" \ + | sort \ + > "$(TMPDIR)/$(1)$(3).nm" + +# This test +# - compiles each of the two crates 2 times and makes sure each time we get +# exactly the same symbol names +# - makes sure that both crates agree on the same symbol names for monomorphic +# functions + +all: + $(RUSTC) stable-symbol-names1.rs + $(call dump-symbols,stable_symbol_names1,generic_|mono_,_v1) + rm $(TMPDIR)/libstable_symbol_names1.rlib + $(RUSTC) stable-symbol-names1.rs + $(call dump-symbols,stable_symbol_names1,generic_|mono_,_v2) + cmp "$(TMPDIR)/stable_symbol_names1_v1.nm" "$(TMPDIR)/stable_symbol_names1_v2.nm" + + $(RUSTC) stable-symbol-names2.rs + $(call dump-symbols,stable_symbol_names2,generic_|mono_,_v1) + rm $(TMPDIR)/libstable_symbol_names2.rlib + $(RUSTC) stable-symbol-names2.rs + $(call dump-symbols,stable_symbol_names2,generic_|mono_,_v2) + cmp "$(TMPDIR)/stable_symbol_names2_v1.nm" "$(TMPDIR)/stable_symbol_names2_v2.nm" + + $(call dump-symbols,stable_symbol_names1,mono_,_cross) + $(call dump-symbols,stable_symbol_names2,mono_,_cross) + cmp "$(TMPDIR)/stable_symbol_names1_cross.nm" "$(TMPDIR)/stable_symbol_names2_cross.nm" diff --git a/tests/run-make/stable-symbol-names/stable-symbol-names1.rs b/tests/run-make/stable-symbol-names/stable-symbol-names1.rs new file mode 100644 index 000000000..b85a42827 --- /dev/null +++ b/tests/run-make/stable-symbol-names/stable-symbol-names1.rs @@ -0,0 +1,31 @@ +#![crate_type="rlib"] + +pub trait Foo { + fn generic_method(); +} + +pub struct Bar; + +impl Foo for Bar { + fn generic_method() {} +} + +pub fn mono_function() { + Bar::generic_method::(); +} + +pub fn mono_function_lifetime<'a>(x: &'a u64) -> u64 { + *x +} + +pub fn generic_function(t: T) -> T { + t +} + +pub fn user() { + generic_function(0u32); + generic_function("abc"); + let x = 2u64; + generic_function(&x); + let _ = mono_function_lifetime(&x); +} diff --git a/tests/run-make/stable-symbol-names/stable-symbol-names2.rs b/tests/run-make/stable-symbol-names/stable-symbol-names2.rs new file mode 100644 index 000000000..33df9d6c6 --- /dev/null +++ b/tests/run-make/stable-symbol-names/stable-symbol-names2.rs @@ -0,0 +1,17 @@ +#![crate_type="rlib"] + +extern crate stable_symbol_names1; + +pub fn user() { + stable_symbol_names1::generic_function(1u32); + stable_symbol_names1::generic_function("def"); + let x = 2u64; + stable_symbol_names1::generic_function(&x); + stable_symbol_names1::mono_function(); + stable_symbol_names1::mono_function_lifetime(&0); +} + +pub fn trait_impl_test_function() { + use stable_symbol_names1::*; + Bar::generic_method::(); +} diff --git a/tests/run-make/static-dylib-by-default/Makefile b/tests/run-make/static-dylib-by-default/Makefile new file mode 100644 index 000000000..cdaab42d0 --- /dev/null +++ b/tests/run-make/static-dylib-by-default/Makefile @@ -0,0 +1,17 @@ +# ignore-cross-compile +include ../tools.mk + +TO_LINK := $(call DYLIB,bar) +ifdef IS_MSVC +LINK_ARG = $(TO_LINK:dll=dll.lib) +else +LINK_ARG = $(TO_LINK) +endif + +all: + $(RUSTC) foo.rs + $(RUSTC) bar.rs + $(CC) main.c $(call OUT_EXE,main) $(LINK_ARG) $(EXTRACFLAGS) + rm $(TMPDIR)/*.rlib + rm $(call DYLIB,foo) + $(call RUN,main) diff --git a/tests/run-make/static-dylib-by-default/bar.rs b/tests/run-make/static-dylib-by-default/bar.rs new file mode 100644 index 000000000..14421165e --- /dev/null +++ b/tests/run-make/static-dylib-by-default/bar.rs @@ -0,0 +1,8 @@ +#![crate_type = "dylib"] + +extern crate foo; + +#[no_mangle] +pub extern "C" fn bar() { + foo::foo(); +} diff --git a/tests/run-make/static-dylib-by-default/foo.rs b/tests/run-make/static-dylib-by-default/foo.rs new file mode 100644 index 000000000..7ebec8720 --- /dev/null +++ b/tests/run-make/static-dylib-by-default/foo.rs @@ -0,0 +1,4 @@ +#![crate_type = "rlib"] +#![crate_type = "dylib"] + +pub fn foo() {} diff --git a/tests/run-make/static-dylib-by-default/main.c b/tests/run-make/static-dylib-by-default/main.c new file mode 100644 index 000000000..5f7f2c27c --- /dev/null +++ b/tests/run-make/static-dylib-by-default/main.c @@ -0,0 +1,6 @@ +extern void bar(); + +int main() { + bar(); + return 0; +} diff --git a/tests/run-make/static-extern-type/Makefile b/tests/run-make/static-extern-type/Makefile new file mode 100644 index 000000000..778971543 --- /dev/null +++ b/tests/run-make/static-extern-type/Makefile @@ -0,0 +1,6 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(call NATIVE_STATICLIB,define-foo) + $(RUSTC) -ldefine-foo use-foo.rs + $(call RUN,use-foo) || exit 1 diff --git a/tests/run-make/static-extern-type/define-foo.c b/tests/run-make/static-extern-type/define-foo.c new file mode 100644 index 000000000..39be5acfa --- /dev/null +++ b/tests/run-make/static-extern-type/define-foo.c @@ -0,0 +1,11 @@ +#include + +struct Foo { + uint8_t x; +}; + +struct Foo FOO = { 42 }; + +uint8_t bar(const struct Foo* foo) { + return foo->x; +} diff --git a/tests/run-make/static-extern-type/use-foo.rs b/tests/run-make/static-extern-type/use-foo.rs new file mode 100644 index 000000000..932b5b594 --- /dev/null +++ b/tests/run-make/static-extern-type/use-foo.rs @@ -0,0 +1,14 @@ +#![feature(extern_types)] + +extern "C" { + type Foo; + static FOO: Foo; + fn bar(foo: *const Foo) -> u8; +} + +fn main() { + unsafe { + let foo = &FOO; + assert_eq!(bar(foo), 42); + } +} diff --git a/tests/run-make/static-pie/Makefile b/tests/run-make/static-pie/Makefile index f4e6adf1b..8379730cc 100644 --- a/tests/run-make/static-pie/Makefile +++ b/tests/run-make/static-pie/Makefile @@ -1,8 +1,8 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # only-x86_64 # only-linux -# ignore-gnux32 +# ignore-32bit # How to manually run this # $ ./x.py test --target x86_64-unknown-linux-[musl,gnu] tests/run-make/static-pie diff --git a/tests/run-make/static-unwinding/Makefile b/tests/run-make/static-unwinding/Makefile new file mode 100644 index 000000000..dec94fb16 --- /dev/null +++ b/tests/run-make/static-unwinding/Makefile @@ -0,0 +1,7 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) lib.rs + $(RUSTC) main.rs + $(call RUN,main) diff --git a/tests/run-make/static-unwinding/lib.rs b/tests/run-make/static-unwinding/lib.rs new file mode 100644 index 000000000..3fb1117a1 --- /dev/null +++ b/tests/run-make/static-unwinding/lib.rs @@ -0,0 +1,15 @@ +#![crate_type = "rlib"] + +pub static mut statik: isize = 0; + +struct A; +impl Drop for A { + fn drop(&mut self) { + unsafe { statik = 1; } + } +} + +pub fn callback(f: F) where F: FnOnce() { + let _a = A; + f(); +} diff --git a/tests/run-make/static-unwinding/main.rs b/tests/run-make/static-unwinding/main.rs new file mode 100644 index 000000000..0c66ea1aa --- /dev/null +++ b/tests/run-make/static-unwinding/main.rs @@ -0,0 +1,24 @@ +extern crate lib; + +use std::thread; + +static mut statik: isize = 0; + +struct A; +impl Drop for A { + fn drop(&mut self) { + unsafe { statik = 1; } + } +} + +fn main() { + thread::spawn(move|| { + let _a = A; + lib::callback(|| panic!()); + }).join().unwrap_err(); + + unsafe { + assert_eq!(lib::statik, 1); + assert_eq!(statik, 1); + } +} diff --git a/tests/run-make/staticlib-blank-lib/Makefile b/tests/run-make/staticlib-blank-lib/Makefile new file mode 100644 index 000000000..fcbf87758 --- /dev/null +++ b/tests/run-make/staticlib-blank-lib/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +all: + $(AR) crus $(TMPDIR)/libfoo.a foo.rs + $(AR) d $(TMPDIR)/libfoo.a foo.rs + $(RUSTC) foo.rs diff --git a/tests/run-make/staticlib-blank-lib/foo.rs b/tests/run-make/staticlib-blank-lib/foo.rs new file mode 100644 index 000000000..bf48d069d --- /dev/null +++ b/tests/run-make/staticlib-blank-lib/foo.rs @@ -0,0 +1,6 @@ +#![crate_type = "staticlib"] + +#[link(name = "foo", kind = "static")] +extern "C" {} + +fn main() {} diff --git a/tests/run-make/std-core-cycle/Makefile b/tests/run-make/std-core-cycle/Makefile new file mode 100644 index 000000000..5ed6be905 --- /dev/null +++ b/tests/run-make/std-core-cycle/Makefile @@ -0,0 +1,17 @@ +# ignore-cross-compile +include ../tools.mk + +ifeq ($(UNAME),Darwin) +FLAGS := +else +ifdef IS_WINDOWS +FLAGS := +else +FLAGS := -C link-args=-Wl,--no-undefined +endif +endif + +all: + $(RUSTC) bar.rs + $(RUSTC) foo.rs $(FLAGS) + $(RUSTC) foo.rs $(FLAGS) -C panic=abort diff --git a/tests/run-make/std-core-cycle/bar.rs b/tests/run-make/std-core-cycle/bar.rs new file mode 100644 index 000000000..9f5e7c29b --- /dev/null +++ b/tests/run-make/std-core-cycle/bar.rs @@ -0,0 +1,16 @@ +#![feature(allocator_api)] +#![crate_type = "rlib"] + +use std::alloc::*; + +pub struct A; + +unsafe impl GlobalAlloc for A { + unsafe fn alloc(&self, _: Layout) -> *mut u8 { + loop {} + } + + unsafe fn dealloc(&self, _ptr: *mut u8, _: Layout) { + loop {} + } +} diff --git a/tests/run-make/std-core-cycle/foo.rs b/tests/run-make/std-core-cycle/foo.rs new file mode 100644 index 000000000..6aa6e1ac3 --- /dev/null +++ b/tests/run-make/std-core-cycle/foo.rs @@ -0,0 +1,11 @@ +#![crate_type = "cdylib"] + +extern crate bar; + +#[global_allocator] +static A: bar::A = bar::A; + +#[no_mangle] +pub extern "C" fn a(a: u32, b: u32) -> u32 { + a / b +} diff --git a/tests/run-make/stdin-non-utf8/Makefile b/tests/run-make/stdin-non-utf8/Makefile new file mode 100644 index 000000000..709d4cf14 --- /dev/null +++ b/tests/run-make/stdin-non-utf8/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +all: + cp non-utf8 $(TMPDIR)/non-utf.rs + cat $(TMPDIR)/non-utf.rs | $(RUSTC) - 2>&1 \ + | $(CGREP) "error: couldn't read from stdin, as it did not contain valid UTF-8" diff --git a/tests/run-make/stdin-non-utf8/non-utf8 b/tests/run-make/stdin-non-utf8/non-utf8 new file mode 100644 index 000000000..bc87051a8 --- /dev/null +++ b/tests/run-make/stdin-non-utf8/non-utf8 @@ -0,0 +1 @@ +Ò diff --git a/tests/run-make/suspicious-library/Makefile b/tests/run-make/suspicious-library/Makefile new file mode 100644 index 000000000..3b5ab3c53 --- /dev/null +++ b/tests/run-make/suspicious-library/Makefile @@ -0,0 +1,8 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) foo.rs -C prefer-dynamic + touch $(call DYLIB,foo-something-special) + touch $(call DYLIB,foo-something-special2) + $(RUSTC) bar.rs diff --git a/tests/run-make/suspicious-library/bar.rs b/tests/run-make/suspicious-library/bar.rs new file mode 100644 index 000000000..550c94cd0 --- /dev/null +++ b/tests/run-make/suspicious-library/bar.rs @@ -0,0 +1,3 @@ +extern crate foo; + +fn main() { foo::foo() } diff --git a/tests/run-make/suspicious-library/foo.rs b/tests/run-make/suspicious-library/foo.rs new file mode 100644 index 000000000..a382d8f2c --- /dev/null +++ b/tests/run-make/suspicious-library/foo.rs @@ -0,0 +1,3 @@ +#![crate_type = "dylib"] + +pub fn foo() {} diff --git a/tests/run-make/symbol-visibility/Makefile b/tests/run-make/symbol-visibility/Makefile new file mode 100644 index 000000000..9159af214 --- /dev/null +++ b/tests/run-make/symbol-visibility/Makefile @@ -0,0 +1,123 @@ +# ignore-cross-compile +include ../tools.mk + +# ignore-windows-msvc + +NM=nm -D +CDYLIB_NAME=liba_cdylib.so +RDYLIB_NAME=liba_rust_dylib.so +PROC_MACRO_NAME=liba_proc_macro.so +EXE_NAME=an_executable +COMBINED_CDYLIB_NAME=libcombined_rlib_dylib.so + +ifeq ($(UNAME),Darwin) +NM=nm -gU +CDYLIB_NAME=liba_cdylib.dylib +RDYLIB_NAME=liba_rust_dylib.dylib +PROC_MACRO_NAME=liba_proc_macro.dylib +EXE_NAME=an_executable +COMBINED_CDYLIB_NAME=libcombined_rlib_dylib.dylib +endif + +ifdef IS_WINDOWS +NM=nm -g +CDYLIB_NAME=liba_cdylib.dll.a +RDYLIB_NAME=liba_rust_dylib.dll.a +PROC_MACRO_NAME=liba_proc_macro.dll +EXE_NAME=an_executable.exe +COMBINED_CDYLIB_NAME=libcombined_rlib_dylib.dll.a +endif + +# `grep` regex for symbols produced by either `legacy` or `v0` mangling +RE_ANY_RUST_SYMBOL="_ZN.*h.*E\|_R[a-zA-Z0-9_]+" + +all: + $(RUSTC) -Zshare-generics=no an_rlib.rs + $(RUSTC) -Zshare-generics=no a_cdylib.rs + $(RUSTC) -Zshare-generics=no a_rust_dylib.rs + $(RUSTC) -Zshare-generics=no a_proc_macro.rs + $(RUSTC) -Zshare-generics=no an_executable.rs + $(RUSTC) -Zshare-generics=no a_cdylib.rs --crate-name combined_rlib_dylib --crate-type=rlib,cdylib + + # Check that a cdylib exports its public #[no_mangle] functions + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_cdylib)" -eq "1" ] + # Check that a cdylib exports the public #[no_mangle] functions of dependencies + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] + # Check that a cdylib DOES NOT export any public Rust functions + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c $(RE_ANY_RUST_SYMBOL))" -eq "0" ] + + # Check that a Rust dylib exports its monomorphic functions + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rust_dylib)" -eq "1" ] + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_rust_function_from_rust_dylib)" -eq "1" ] + # Check that a Rust dylib does not export generics if -Zshare-generics=no + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_generic_function_from_rust_dylib)" -eq "0" ] + + + # Check that a Rust dylib exports the monomorphic functions from its dependencies + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_rust_function_from_rlib)" -eq "1" ] + # Check that a Rust dylib does not export generics if -Zshare-generics=no + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_generic_function_from_rlib)" -eq "0" ] + + # Check that a proc macro exports its public #[no_mangle] functions + # FIXME(#99978) avoid exporting #[no_mangle] symbols for proc macros + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_cdylib)" -eq "1" ] + # Check that a proc macro exports the public #[no_mangle] functions of dependencies + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] + # Check that a proc macro DOES NOT export any public Rust functions + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c $(RE_ANY_RUST_SYMBOL))" -eq "0" ] + +# FIXME(nbdd0121): This is broken in MinGW, see https://github.com/rust-lang/rust/pull/95604#issuecomment-1101564032 +ifndef IS_WINDOWS + # Check that an executable does not export any dynamic symbols + [ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "0" ] + [ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -v __imp_ | grep -c public_rust_function_from_exe)" -eq "0" ] +endif + + + # Check the combined case, where we generate a cdylib and an rlib in the same + # compilation session: + # Check that a cdylib exports its public #[no_mangle] functions + [ "$$($(NM) $(TMPDIR)/$(COMBINED_CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_cdylib)" -eq "1" ] + # Check that a cdylib exports the public #[no_mangle] functions of dependencies + [ "$$($(NM) $(TMPDIR)/$(COMBINED_CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] + # Check that a cdylib DOES NOT export any public Rust functions + [ "$$($(NM) $(TMPDIR)/$(COMBINED_CDYLIB_NAME) | grep -v __imp_ | grep -c $(RE_ANY_RUST_SYMBOL))" -eq "0" ] + + + $(RUSTC) -Zshare-generics=yes an_rlib.rs + $(RUSTC) -Zshare-generics=yes a_cdylib.rs + $(RUSTC) -Zshare-generics=yes a_rust_dylib.rs + $(RUSTC) -Zshare-generics=yes a_proc_macro.rs + $(RUSTC) -Zshare-generics=yes an_executable.rs + + # Check that a cdylib exports its public #[no_mangle] functions + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_cdylib)" -eq "1" ] + # Check that a cdylib exports the public #[no_mangle] functions of dependencies + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] + # Check that a cdylib DOES NOT export any public Rust functions + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c $(RE_ANY_RUST_SYMBOL))" -eq "0" ] + + # Check that a Rust dylib exports its monomorphic functions, including generics this time + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rust_dylib)" -eq "1" ] + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_rust_function_from_rust_dylib)" -eq "1" ] + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_generic_function_from_rust_dylib)" -eq "1" ] + + # Check that a Rust dylib exports the monomorphic functions from its dependencies + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_rust_function_from_rlib)" -eq "1" ] + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_generic_function_from_rlib)" -eq "1" ] + + # Check that a proc macro exports its public #[no_mangle] functions + # FIXME(#99978) avoid exporting #[no_mangle] symbols for proc macros + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_cdylib)" -eq "1" ] + # Check that a proc macro exports the public #[no_mangle] functions of dependencies + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] + # Check that a proc macro DOES NOT export any public Rust functions + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c $(RE_ANY_RUST_SYMBOL))" -eq "0" ] + +ifndef IS_WINDOWS + # Check that an executable does not export any dynamic symbols + [ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "0" ] + [ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -v __imp_ | grep -c public_rust_function_from_exe)" -eq "0" ] +endif diff --git a/tests/run-make/symbol-visibility/a_cdylib.rs b/tests/run-make/symbol-visibility/a_cdylib.rs new file mode 100644 index 000000000..d4fbff85b --- /dev/null +++ b/tests/run-make/symbol-visibility/a_cdylib.rs @@ -0,0 +1,12 @@ +#![crate_type="cdylib"] + +extern crate an_rlib; + +// This should not be exported +pub fn public_rust_function_from_cdylib() {} + +// This should be exported +#[no_mangle] +pub extern "C" fn public_c_function_from_cdylib() { + an_rlib::public_c_function_from_rlib(); +} diff --git a/tests/run-make/symbol-visibility/a_proc_macro.rs b/tests/run-make/symbol-visibility/a_proc_macro.rs new file mode 100644 index 000000000..9fd1a8a67 --- /dev/null +++ b/tests/run-make/symbol-visibility/a_proc_macro.rs @@ -0,0 +1,9 @@ +#![crate_type = "proc-macro"] + +extern crate an_rlib; + +// This should not be exported +#[no_mangle] +extern "C" fn public_c_function_from_cdylib() { + an_rlib::public_c_function_from_rlib(); +} diff --git a/tests/run-make/symbol-visibility/a_rust_dylib.rs b/tests/run-make/symbol-visibility/a_rust_dylib.rs new file mode 100644 index 000000000..a47df0ab7 --- /dev/null +++ b/tests/run-make/symbol-visibility/a_rust_dylib.rs @@ -0,0 +1,15 @@ +#![crate_type="dylib"] + +extern crate an_rlib; + +// This should be exported +pub fn public_rust_function_from_rust_dylib() {} + +// This should be exported +#[no_mangle] +pub extern "C" fn public_c_function_from_rust_dylib() { + let _ = public_generic_function_from_rust_dylib(1u16); +} + +// This should be exported if -Zshare-generics=yes +pub fn public_generic_function_from_rust_dylib(x: T) -> T { x } diff --git a/tests/run-make/symbol-visibility/an_executable.rs b/tests/run-make/symbol-visibility/an_executable.rs new file mode 100644 index 000000000..3f5e125ad --- /dev/null +++ b/tests/run-make/symbol-visibility/an_executable.rs @@ -0,0 +1,7 @@ +#![crate_type="bin"] + +extern crate an_rlib; + +pub fn public_rust_function_from_exe() {} + +fn main() {} diff --git a/tests/run-make/symbol-visibility/an_rlib.rs b/tests/run-make/symbol-visibility/an_rlib.rs new file mode 100644 index 000000000..3696422b1 --- /dev/null +++ b/tests/run-make/symbol-visibility/an_rlib.rs @@ -0,0 +1,12 @@ +#![crate_type="rlib"] + +pub fn public_rust_function_from_rlib() {} + +#[no_mangle] +pub extern "C" fn public_c_function_from_rlib() { + let _ = public_generic_function_from_rlib(0u64); +} + +pub fn public_generic_function_from_rlib(x: T) -> T { + x +} diff --git a/tests/run-make/symbols-include-type-name/Makefile b/tests/run-make/symbols-include-type-name/Makefile new file mode 100644 index 000000000..ac26a852e --- /dev/null +++ b/tests/run-make/symbols-include-type-name/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +# Check that symbol names for methods include type names, instead of . + +OUT=$(TMPDIR)/lib.s + +all: + $(RUSTC) --crate-type staticlib --emit asm lib.rs + $(CGREP) Def < $(OUT) diff --git a/tests/run-make/symbols-include-type-name/lib.rs b/tests/run-make/symbols-include-type-name/lib.rs new file mode 100644 index 000000000..37d445917 --- /dev/null +++ b/tests/run-make/symbols-include-type-name/lib.rs @@ -0,0 +1,14 @@ +pub struct Def { + pub id: i32, +} + +impl Def { + pub fn new(id: i32) -> Def { + Def { id: id } + } +} + +#[no_mangle] +pub fn user() { + let _ = Def::new(0); +} diff --git a/tests/run-make/symlinked-extern/Makefile b/tests/run-make/symlinked-extern/Makefile new file mode 100644 index 000000000..28c764b84 --- /dev/null +++ b/tests/run-make/symlinked-extern/Makefile @@ -0,0 +1,12 @@ +# ignore-cross-compile +include ../tools.mk + +# ignore-windows +# `ln` is actually `cp` on msys. + +all: + $(RUSTC) foo.rs + mkdir -p $(TMPDIR)/other + ln -nsf $(TMPDIR)/libfoo.rlib $(TMPDIR)/other + $(RUSTC) bar.rs -L $(TMPDIR) + $(RUSTC) baz.rs --extern foo=$(TMPDIR)/other/libfoo.rlib -L $(TMPDIR) diff --git a/tests/run-make/symlinked-extern/bar.rs b/tests/run-make/symlinked-extern/bar.rs new file mode 100644 index 000000000..cd9c959d5 --- /dev/null +++ b/tests/run-make/symlinked-extern/bar.rs @@ -0,0 +1,6 @@ +#![crate_type = "rlib"] + +extern crate foo; + +pub fn bar(_s: foo::S) { +} diff --git a/tests/run-make/symlinked-extern/baz.rs b/tests/run-make/symlinked-extern/baz.rs new file mode 100644 index 000000000..cd433a3ac --- /dev/null +++ b/tests/run-make/symlinked-extern/baz.rs @@ -0,0 +1,6 @@ +extern crate bar; +extern crate foo; + +fn main() { + bar::bar(foo::foo()); +} diff --git a/tests/run-make/symlinked-extern/foo.rs b/tests/run-make/symlinked-extern/foo.rs new file mode 100644 index 000000000..c00700b8c --- /dev/null +++ b/tests/run-make/symlinked-extern/foo.rs @@ -0,0 +1,5 @@ +#![crate_type = "rlib"] + +pub struct S; + +pub fn foo() -> S { S } diff --git a/tests/run-make/symlinked-libraries/Makefile b/tests/run-make/symlinked-libraries/Makefile new file mode 100644 index 000000000..fb0b6127e --- /dev/null +++ b/tests/run-make/symlinked-libraries/Makefile @@ -0,0 +1,11 @@ +# ignore-cross-compile +include ../tools.mk + +# ignore-windows +# `ln` is actually `cp` on msys. + +all: + $(RUSTC) foo.rs -C prefer-dynamic + mkdir -p $(TMPDIR)/other + ln -nsf $(TMPDIR)/$(call DYLIB_GLOB,foo) $(TMPDIR)/other + $(RUSTC) bar.rs -L $(TMPDIR)/other diff --git a/tests/run-make/symlinked-libraries/bar.rs b/tests/run-make/symlinked-libraries/bar.rs new file mode 100644 index 000000000..fde0d7466 --- /dev/null +++ b/tests/run-make/symlinked-libraries/bar.rs @@ -0,0 +1,5 @@ +extern crate foo; + +fn main() { + foo::bar(); +} diff --git a/tests/run-make/symlinked-libraries/foo.rs b/tests/run-make/symlinked-libraries/foo.rs new file mode 100644 index 000000000..cde9e291b --- /dev/null +++ b/tests/run-make/symlinked-libraries/foo.rs @@ -0,0 +1,3 @@ +#![crate_type = "dylib"] + +pub fn bar() {} diff --git a/tests/run-make/symlinked-rlib/Makefile b/tests/run-make/symlinked-rlib/Makefile new file mode 100644 index 000000000..a8565f683 --- /dev/null +++ b/tests/run-make/symlinked-rlib/Makefile @@ -0,0 +1,10 @@ +# ignore-cross-compile +include ../tools.mk + +# ignore-windows +# `ln` is actually `cp` on msys. + +all: + $(RUSTC) foo.rs --crate-type=rlib -o $(TMPDIR)/foo.xxx + ln -nsf $(TMPDIR)/foo.xxx $(TMPDIR)/libfoo.rlib + $(RUSTC) bar.rs -L $(TMPDIR) diff --git a/tests/run-make/symlinked-rlib/bar.rs b/tests/run-make/symlinked-rlib/bar.rs new file mode 100644 index 000000000..fde0d7466 --- /dev/null +++ b/tests/run-make/symlinked-rlib/bar.rs @@ -0,0 +1,5 @@ +extern crate foo; + +fn main() { + foo::bar(); +} diff --git a/tests/run-make/symlinked-rlib/foo.rs b/tests/run-make/symlinked-rlib/foo.rs new file mode 100644 index 000000000..c5c0bc606 --- /dev/null +++ b/tests/run-make/symlinked-rlib/foo.rs @@ -0,0 +1 @@ +pub fn bar() {} diff --git a/tests/run-make/sysroot-crates-are-unstable/Makefile b/tests/run-make/sysroot-crates-are-unstable/Makefile new file mode 100644 index 000000000..1e267fb95 --- /dev/null +++ b/tests/run-make/sysroot-crates-are-unstable/Makefile @@ -0,0 +1,2 @@ +all: + '$(PYTHON)' test.py diff --git a/tests/run-make/sysroot-crates-are-unstable/test.py b/tests/run-make/sysroot-crates-are-unstable/test.py new file mode 100644 index 000000000..cab4faa4e --- /dev/null +++ b/tests/run-make/sysroot-crates-are-unstable/test.py @@ -0,0 +1,75 @@ +import sys +import os +from os import listdir +from os.path import isfile, join +from subprocess import PIPE, Popen + + +# This is n list of files which are stable crates or simply are not crates, +# we don't check for the instability of these crates as they're all stable! +STABLE_CRATES = ['std', 'alloc', 'core', 'proc_macro', + 'rsbegin.o', 'rsend.o', 'dllcrt2.o', 'crt2.o', 'clang_rt'] + + +def convert_to_string(s): + if s.__class__.__name__ == 'bytes': + return s.decode('utf-8') + return s + + +def set_ld_lib_path(): + var = os.environ.get("LD_LIB_PATH_ENVVAR") + rpath = os.environ.get("HOST_RPATH_DIR") + if var and rpath: + path = os.environ.get(var) + if path: + os.environ[var] = rpath + os.pathsep + path + else: + os.environ[var] = rpath + + +def exec_command(command, to_input=None): + child = None + if to_input is None: + child = Popen(command, stdout=PIPE, stderr=PIPE) + else: + child = Popen(command, stdout=PIPE, stderr=PIPE, stdin=PIPE) + stdout, stderr = child.communicate(input=to_input) + return (convert_to_string(stdout), convert_to_string(stderr)) + + +def check_lib(lib): + if lib['name'] in STABLE_CRATES: + return True + print('verifying if {} is an unstable crate'.format(lib['name'])) + stdout, stderr = exec_command([os.environ['RUSTC'], '-', '--crate-type', 'rlib', + '--target', os.environ['TARGET'], + '--extern', '{}={}'.format(lib['name'], lib['path'])], + to_input=('extern crate {};'.format(lib['name'])).encode('utf-8')) + if not 'use of unstable library feature' in '{}{}'.format(stdout, stderr): + print('crate {} "{}" is not unstable'.format(lib['name'], lib['path'])) + print('{}{}'.format(stdout, stderr)) + print('') + return False + return True + +# Generate a list of all crates in the sysroot. To do this we list all files in +# rustc's sysroot, look at the filename, strip everything after the `-`, and +# strip the leading `lib` (if present) +def get_all_libs(dir_path): + return [{ 'path': join(dir_path, f), 'name': f[3:].split('-')[0] } + for f in listdir(dir_path) + if isfile(join(dir_path, f)) and f.endswith('.rlib') and f not in STABLE_CRATES] + + +set_ld_lib_path() +sysroot = exec_command([os.environ['RUSTC'], '--print', 'sysroot'])[0].replace('\n', '') +assert sysroot, "Could not read the rustc sysroot!" +libs = get_all_libs(join(sysroot, 'lib/rustlib/{}/lib'.format(os.environ['TARGET']))) + +ret = 0 +for lib in libs: + if not check_lib(lib): + # We continue so users can see all the not unstable crates. + ret = 1 +sys.exit(ret) diff --git a/tests/run-make/target-cpu-native/Makefile b/tests/run-make/target-cpu-native/Makefile new file mode 100644 index 000000000..eb3ca1e13 --- /dev/null +++ b/tests/run-make/target-cpu-native/Makefile @@ -0,0 +1,20 @@ +include ../tools.mk + +# only-linux +# only-x86_64 +# +# I *really* don't want to deal with a cross-platform way to compare file sizes, +# tests in `make` sort of are awful + +all: $(TMPDIR)/out.log + # Make sure no warnings about "unknown CPU `native`" were emitted + if [ "$$(wc -c $(TMPDIR)/out.log | cut -d' ' -f 1)" = "0" ]; then \ + echo no warnings generated; \ + else \ + exit 1; \ + fi + + +$(TMPDIR)/out.log: + $(RUSTC) foo.rs -C target-cpu=native 2>&1 | tee $(TMPDIR)/out.log + $(call RUN,foo) diff --git a/tests/run-make/target-cpu-native/foo.rs b/tests/run-make/target-cpu-native/foo.rs new file mode 100644 index 000000000..f79c691f0 --- /dev/null +++ b/tests/run-make/target-cpu-native/foo.rs @@ -0,0 +1,2 @@ +fn main() { +} diff --git a/tests/run-make/target-specs/Makefile b/tests/run-make/target-specs/Makefile new file mode 100644 index 000000000..a33f5368e --- /dev/null +++ b/tests/run-make/target-specs/Makefile @@ -0,0 +1,11 @@ +include ../tools.mk +all: + $(RUSTC) foo.rs --target=my-awesome-platform.json --crate-type=lib --emit=asm + $(CGREP) -v morestack < $(TMPDIR)/foo.s + $(RUSTC) foo.rs --target=my-invalid-platform.json 2>&1 | $(CGREP) "Error loading target specification" + $(RUSTC) foo.rs --target=my-incomplete-platform.json 2>&1 | $(CGREP) 'Field llvm-target' + RUST_TARGET_PATH=. $(RUSTC) foo.rs --target=my-awesome-platform --crate-type=lib --emit=asm + RUST_TARGET_PATH=. $(RUSTC) foo.rs --target=my-x86_64-unknown-linux-gnu-platform --crate-type=lib --emit=asm + $(RUSTC) -Z unstable-options --target=my-awesome-platform.json --print target-spec-json > $(TMPDIR)/test-platform.json && $(RUSTC) -Z unstable-options --target=$(TMPDIR)/test-platform.json --print target-spec-json | diff -q $(TMPDIR)/test-platform.json - + $(RUSTC) foo.rs --target=definitely-not-builtin-target 2>&1 | $(CGREP) 'may not set is_builtin' + $(RUSTC) foo.rs --target=mismatching-data-layout --crate-type=lib diff --git a/tests/run-make/target-specs/definitely-not-builtin-target.json b/tests/run-make/target-specs/definitely-not-builtin-target.json new file mode 100644 index 000000000..b36fa993d --- /dev/null +++ b/tests/run-make/target-specs/definitely-not-builtin-target.json @@ -0,0 +1,7 @@ +{ + "arch": "x86_64", + "is-builtin": true, + "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128", + "llvm-target": "x86_64-unknown-unknown-gnu", + "target-pointer-width": "64" +} diff --git a/tests/run-make/target-specs/foo.rs b/tests/run-make/target-specs/foo.rs new file mode 100644 index 000000000..22939e879 --- /dev/null +++ b/tests/run-make/target-specs/foo.rs @@ -0,0 +1,24 @@ +#![feature(lang_items, no_core, auto_traits)] +#![no_core] + +#[lang = "copy"] +trait Copy {} + +#[lang = "sized"] +trait Sized {} + +#[lang = "freeze"] +auto trait Freeze {} + +#[lang = "start"] +fn start(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize { + 0 +} + +extern "C" { + fn _foo() -> [u8; 16]; +} + +fn _main() { + let _a = unsafe { _foo() }; +} diff --git a/tests/run-make/target-specs/mismatching-data-layout.json b/tests/run-make/target-specs/mismatching-data-layout.json new file mode 100644 index 000000000..d12caaad1 --- /dev/null +++ b/tests/run-make/target-specs/mismatching-data-layout.json @@ -0,0 +1,6 @@ +{ + "arch": "x86_64", + "data-layout": "e-m:e-i64:16:32:64", + "llvm-target": "x86_64-unknown-unknown-gnu", + "target-pointer-width": "64" +} diff --git a/tests/run-make/target-specs/my-awesome-platform.json b/tests/run-make/target-specs/my-awesome-platform.json new file mode 100644 index 000000000..00de3de05 --- /dev/null +++ b/tests/run-make/target-specs/my-awesome-platform.json @@ -0,0 +1,11 @@ +{ + "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128", + "linker-flavor": "gcc", + "llvm-target": "i686-unknown-linux-gnu", + "target-endian": "little", + "target-pointer-width": "32", + "target-c-int-width": "32", + "arch": "x86", + "os": "linux", + "morestack": false +} diff --git a/tests/run-make/target-specs/my-incomplete-platform.json b/tests/run-make/target-specs/my-incomplete-platform.json new file mode 100644 index 000000000..ceaa25cdf --- /dev/null +++ b/tests/run-make/target-specs/my-incomplete-platform.json @@ -0,0 +1,10 @@ +{ + "data-layout": "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32", + "linker-flavor": "gcc", + "target-endian": "little", + "target-pointer-width": "32", + "target-c-int-width": "32", + "arch": "x86", + "os": "foo", + "morestack": false +} diff --git a/tests/run-make/target-specs/my-invalid-platform.json b/tests/run-make/target-specs/my-invalid-platform.json new file mode 100644 index 000000000..3feac45b7 --- /dev/null +++ b/tests/run-make/target-specs/my-invalid-platform.json @@ -0,0 +1 @@ +wow this json is really broke! diff --git a/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json b/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json new file mode 100644 index 000000000..6d5e964ed --- /dev/null +++ b/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json @@ -0,0 +1,12 @@ +{ + "pre-link-args": {"gcc": ["-m64"]}, + "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", + "linker-flavor": "gcc", + "llvm-target": "x86_64-unknown-linux-gnu", + "target-endian": "little", + "target-pointer-width": "64", + "target-c-int-width": "32", + "arch": "x86_64", + "os": "linux", + "morestack": false +} diff --git a/tests/run-make/target-without-atomic-cas/Makefile b/tests/run-make/target-without-atomic-cas/Makefile new file mode 100644 index 000000000..451f03d66 --- /dev/null +++ b/tests/run-make/target-without-atomic-cas/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +# The target used below doesn't support atomic CAS operations. Verify that's the case +all: + $(RUSTC) --print cfg --target thumbv6m-none-eabi | $(CGREP) -v 'target_has_atomic="ptr"' diff --git a/tests/run-make/test-benches/Makefile b/tests/run-make/test-benches/Makefile index 8fc122515..0253a5263 100644 --- a/tests/run-make/test-benches/Makefile +++ b/tests/run-make/test-benches/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # ignore-cross-compile diff --git a/tests/run-make/test-harness/Makefile b/tests/run-make/test-harness/Makefile new file mode 100644 index 000000000..ee8c9294f --- /dev/null +++ b/tests/run-make/test-harness/Makefile @@ -0,0 +1,9 @@ +# ignore-cross-compile +include ../tools.mk + +all: + # check that #[cfg_attr(..., ignore)] does the right thing. + $(RUSTC) --test test-ignore-cfg.rs --cfg ignorecfg + $(call RUN,test-ignore-cfg) | $(CGREP) 'shouldnotignore ... ok' 'shouldignore ... ignored' + $(call RUN,test-ignore-cfg --quiet) | $(CGREP) -e "^i\.$$" + $(call RUN,test-ignore-cfg --quiet) | $(CGREP) -v 'should' diff --git a/tests/run-make/test-harness/test-ignore-cfg.rs b/tests/run-make/test-harness/test-ignore-cfg.rs new file mode 100644 index 000000000..31ef131f2 --- /dev/null +++ b/tests/run-make/test-harness/test-ignore-cfg.rs @@ -0,0 +1,9 @@ +#[test] +#[cfg_attr(ignorecfg, ignore)] +fn shouldignore() { +} + +#[test] +#[cfg_attr(noignorecfg, ignore)] +fn shouldnotignore() { +} diff --git a/tests/run-make/thumb-none-cortex-m/Makefile b/tests/run-make/thumb-none-cortex-m/Makefile index 3065141c0..e941fc4a7 100644 --- a/tests/run-make/thumb-none-cortex-m/Makefile +++ b/tests/run-make/thumb-none-cortex-m/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # How to run this # $ ./x.py clean diff --git a/tests/run-make/thumb-none-qemu/Makefile b/tests/run-make/thumb-none-qemu/Makefile index a1c2ba12c..eea6ca349 100644 --- a/tests/run-make/thumb-none-qemu/Makefile +++ b/tests/run-make/thumb-none-qemu/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # only-thumb diff --git a/tests/run-make/tools.mk b/tests/run-make/tools.mk new file mode 100644 index 000000000..ea06b620c --- /dev/null +++ b/tests/run-make/tools.mk @@ -0,0 +1,187 @@ +# These deliberately use `=` and not `:=` so that client makefiles can +# augment HOST_RPATH_DIR / TARGET_RPATH_DIR. +HOST_RPATH_ENV = \ + $(LD_LIB_PATH_ENVVAR)="$(TMPDIR):$(HOST_RPATH_DIR):$($(LD_LIB_PATH_ENVVAR))" +TARGET_RPATH_ENV = \ + $(LD_LIB_PATH_ENVVAR)="$(TMPDIR):$(TARGET_RPATH_DIR):$($(LD_LIB_PATH_ENVVAR))" + +RUSTC_ORIGINAL := $(RUSTC) +BARE_RUSTC := $(HOST_RPATH_ENV) '$(RUSTC)' +BARE_RUSTDOC := $(HOST_RPATH_ENV) '$(RUSTDOC)' +RUSTC := $(BARE_RUSTC) --out-dir $(TMPDIR) -L $(TMPDIR) $(RUSTFLAGS) +RUSTDOC := $(BARE_RUSTDOC) -L $(TARGET_RPATH_DIR) +ifdef RUSTC_LINKER +RUSTC := $(RUSTC) -Clinker='$(RUSTC_LINKER)' +RUSTDOC := $(RUSTDOC) -Clinker='$(RUSTC_LINKER)' +endif +#CC := $(CC) -L $(TMPDIR) +HTMLDOCCK := '$(PYTHON)' '$(S)/src/etc/htmldocck.py' +CGREP := "$(S)/src/etc/cat-and-grep.sh" + +# diff with common flags for multi-platform diffs against text output +DIFF := diff -u --strip-trailing-cr + +# Some of the Rust CI platforms use `/bin/dash` to run `shell` script in +# Makefiles. Other platforms, including many developer platforms, default to +# `/bin/bash`. (In many cases, `make` is actually using `/bin/sh`, but `sh` +# is configured to execute one or the other shell binary). `dash` features +# support only a small subset of `bash` features, so `dash` can be thought of as +# the lowest common denominator, and tests should be validated against `dash` +# whenever possible. Most developer platforms include `/bin/dash`, but to ensure +# tests still work when `/bin/dash`, if not available, this `SHELL` override is +# conditional: +ifndef IS_WINDOWS # dash interprets backslashes in executable paths incorrectly +ifneq (,$(wildcard /bin/dash)) +SHELL := /bin/dash +endif +endif + +# This is the name of the binary we will generate and run; use this +# e.g. for `$(CC) -o $(RUN_BINFILE)`. +RUN_BINFILE = $(TMPDIR)/$(1) + +# Invoke the generated binary on the remote machine if compiletest was +# configured to use a remote test device, otherwise run it on the current host. +ifdef REMOTE_TEST_CLIENT +# FIXME: if a test requires additional files, this will need to be changed to +# also push them (by changing the 0 to the number of additional files, and +# providing the path of the additional files as the last arguments). +EXECUTE = $(REMOTE_TEST_CLIENT) run 0 $(RUN_BINFILE) +else +EXECUTE = $(RUN_BINFILE) +endif + +# RUN and FAIL are basic way we will invoke the generated binary. On +# non-windows platforms, they set the LD_LIBRARY_PATH environment +# variable before running the binary. + +RLIB_GLOB = lib$(1)*.rlib +BIN = $(1) + +UNAME = $(shell uname) + +ifeq ($(UNAME),Darwin) +RUN = $(TARGET_RPATH_ENV) $(EXECUTE) +FAIL = $(TARGET_RPATH_ENV) $(EXECUTE) && exit 1 || exit 0 +DYLIB_GLOB = lib$(1)*.dylib +DYLIB = $(TMPDIR)/lib$(1).dylib +STATICLIB = $(TMPDIR)/lib$(1).a +STATICLIB_GLOB = lib$(1)*.a +else +ifdef IS_WINDOWS +RUN = PATH="$(PATH):$(TARGET_RPATH_DIR)" $(EXECUTE) +FAIL = PATH="$(PATH):$(TARGET_RPATH_DIR)" $(EXECUTE) && exit 1 || exit 0 +DYLIB_GLOB = $(1)*.dll +DYLIB = $(TMPDIR)/$(1).dll +ifdef IS_MSVC +STATICLIB = $(TMPDIR)/$(1).lib +STATICLIB_GLOB = $(1)*.lib +else +IMPLIB = $(TMPDIR)/lib$(1).dll.a +STATICLIB = $(TMPDIR)/lib$(1).a +STATICLIB_GLOB = lib$(1)*.a +endif +BIN = $(1).exe +LLVM_FILECHECK := $(shell cygpath -u "$(LLVM_FILECHECK)") +else +RUN = $(TARGET_RPATH_ENV) $(EXECUTE) +FAIL = $(TARGET_RPATH_ENV) $(EXECUTE) && exit 1 || exit 0 +DYLIB_GLOB = lib$(1)*.so +DYLIB = $(TMPDIR)/lib$(1).so +STATICLIB = $(TMPDIR)/lib$(1).a +STATICLIB_GLOB = lib$(1)*.a +endif +endif + +ifdef IS_MSVC +COMPILE_OBJ = $(CC) -c -Fo:`cygpath -w $(1)` $(2) +COMPILE_OBJ_CXX = $(CXX) -EHs -c -Fo:`cygpath -w $(1)` $(2) +NATIVE_STATICLIB_FILE = $(1).lib +NATIVE_STATICLIB = $(TMPDIR)/$(call NATIVE_STATICLIB_FILE,$(1)) +OUT_EXE=-Fe:`cygpath -w $(TMPDIR)/$(call BIN,$(1))` \ + -Fo:`cygpath -w $(TMPDIR)/$(1).obj` +else +COMPILE_OBJ = $(CC) -v -c -o $(1) $(2) +COMPILE_OBJ_CXX = $(CXX) -c -o $(1) $(2) +NATIVE_STATICLIB_FILE = lib$(1).a +NATIVE_STATICLIB = $(call STATICLIB,$(1)) +OUT_EXE=-o $(TMPDIR)/$(1) +endif + + +# Extra flags needed to compile a working executable with the standard library +ifdef IS_WINDOWS +ifdef IS_MSVC + EXTRACFLAGS := ws2_32.lib userenv.lib advapi32.lib bcrypt.lib ntdll.lib +else + EXTRACFLAGS := -lws2_32 -luserenv -lbcrypt -lntdll + EXTRACXXFLAGS := -lstdc++ + # So this is a bit hacky: we can't use the DLL version of libstdc++ because + # it pulls in the DLL version of libgcc, which means that we end up with 2 + # instances of the DW2 unwinding implementation. This is a problem on + # i686-pc-windows-gnu because each module (DLL/EXE) needs to register its + # unwind information with the unwinding implementation, and libstdc++'s + # __cxa_throw won't see the unwinding info we registered with our statically + # linked libgcc. + # + # Now, simply statically linking libstdc++ would fix this problem, except + # that it is compiled with the expectation that pthreads is dynamically + # linked as a DLL and will fail to link with a statically linked libpthread. + # + # So we end up with the following hack: we link use static:-bundle to only + # link the parts of libstdc++ that we actually use, which doesn't include + # the dependency on the pthreads DLL. + EXTRARSCXXFLAGS := -l static:-bundle=stdc++ +endif +else +ifeq ($(UNAME),Darwin) + EXTRACFLAGS := -lresolv + EXTRACXXFLAGS := -lc++ + EXTRARSCXXFLAGS := -lc++ +else +ifeq ($(UNAME),FreeBSD) + EXTRACFLAGS := -lm -lpthread -lgcc_s +else +ifeq ($(UNAME),SunOS) + EXTRACFLAGS := -lm -lpthread -lposix4 -lsocket -lresolv +else +ifeq ($(UNAME),OpenBSD) + EXTRACFLAGS := -lm -lpthread -lc++abi + RUSTC := $(RUSTC) -C linker="$(word 1,$(CC:ccache=))" +else + EXTRACFLAGS := -lm -lrt -ldl -lpthread + EXTRACXXFLAGS := -lstdc++ + EXTRARSCXXFLAGS := -lstdc++ +endif +endif +endif +endif +endif + +REMOVE_DYLIBS = rm $(TMPDIR)/$(call DYLIB_GLOB,$(1)) +REMOVE_RLIBS = rm $(TMPDIR)/$(call RLIB_GLOB,$(1)) + +%.a: %.o + $(AR) crus $@ $< +ifdef IS_MSVC +%.lib: lib%.o + $(MSVC_LIB) -out:`cygpath -w $@` $< +else +%.lib: lib%.o + $(AR) crus $@ $< +endif +%.dylib: %.o + $(CC) -dynamiclib -Wl,-dylib -o $@ $< +%.so: %.o + $(CC) -o $@ $< -shared + +ifdef IS_MSVC +%.dll: lib%.o + $(CC) $< -link -dll -out:`cygpath -w $@` +else +%.dll: lib%.o + $(CC) -o $@ $< -shared -Wl,--out-implib=$@.a +endif + +$(TMPDIR)/lib%.o: %.c + $(call COMPILE_OBJ,$@,$<) diff --git a/tests/run-make/track-path-dep-info/Makefile b/tests/run-make/track-path-dep-info/Makefile index ee853943f..0d6c9b1d2 100644 --- a/tests/run-make/track-path-dep-info/Makefile +++ b/tests/run-make/track-path-dep-info/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # FIXME(eddyb) provide `HOST_RUSTC` and `TARGET_RUSTC` # instead of hardcoding them everywhere they're needed. diff --git a/tests/run-make/track-pgo-dep-info/Makefile b/tests/run-make/track-pgo-dep-info/Makefile index 60b59c04a..6c7f67d0f 100644 --- a/tests/run-make/track-pgo-dep-info/Makefile +++ b/tests/run-make/track-pgo-dep-info/Makefile @@ -1,7 +1,7 @@ # needs-profiler-support # ignore-windows-gnu --include ../../run-make-fulldeps/tools.mk +include ../tools.mk # FIXME(eddyb) provide `HOST_RUSTC` and `TARGET_RUSTC` # instead of hardcoding them everywhere they're needed. diff --git a/tests/run-make/translation/Makefile b/tests/run-make/translation/Makefile index 5b0b331ca..0acf64e5d 100644 --- a/tests/run-make/translation/Makefile +++ b/tests/run-make/translation/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # This test uses `ln -s` rather than copying to save testing time, but its # usage doesn't work on Windows. @@ -13,22 +13,22 @@ all: normal custom missing broken sysroot sysroot-invalid sysroot-missing # Check that the test works normally, using the built-in fallback bundle. normal: test.rs - $(RUSTC) $< 2>&1 | grep "struct literal body without path" + $(RUSTC) $< 2>&1 | $(CGREP) "struct literal body without path" # Check that a primary bundle can be loaded and will be preferentially used # where possible. custom: test.rs working.ftl - $(RUSTC) $< -Ztranslate-additional-ftl=$(CURDIR)/working.ftl 2>&1 | grep "this is a test message" + $(RUSTC) $< -Ztranslate-additional-ftl=$(CURDIR)/working.ftl 2>&1 | $(CGREP) "this is a test message" # Check that a primary bundle with a broken message (e.g. a interpolated # variable is missing) will use the fallback bundle. missing: test.rs missing.ftl - $(RUSTC) $< -Ztranslate-additional-ftl=$(CURDIR)/missing.ftl 2>&1 | grep "struct literal body without path" + $(RUSTC) $< -Ztranslate-additional-ftl=$(CURDIR)/missing.ftl 2>&1 | $(CGREP) "struct literal body without path" # Check that a primary bundle without the desired message will use the fallback # bundle. broken: test.rs broken.ftl - $(RUSTC) $< -Ztranslate-additional-ftl=$(CURDIR)/broken.ftl 2>&1 | grep "struct literal body without path" + $(RUSTC) $< -Ztranslate-additional-ftl=$(CURDIR)/broken.ftl 2>&1 | $(CGREP) "struct literal body without path" # Check that a locale can be loaded from the sysroot given a language # identifier by making a local copy of the sysroot and adding the custom locale @@ -48,13 +48,13 @@ sysroot: test.rs working.ftl ln -s $(SYSROOT)/lib/rustlib/src/* $(FAKEROOT)/lib/rustlib/src 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 | grep "this is a test message" + $(RUSTC) $< --sysroot $(FAKEROOT) -Ztranslate-lang=zh-CN 2>&1 | $(CGREP) "this is a test message" # Check that the compiler errors out when the sysroot requested cannot be # found. This test might start failing if there actually exists a Klingon # translation of rustc's error messages. -sysroot-missing: - $(RUSTC) $< -Ztranslate-lang=tlh 2>&1 | grep "missing locale directory" +sysroot-missing: + $(RUSTC) $< -Ztranslate-lang=tlh 2>&1 | $(CGREP) "missing locale directory" # Check that the compiler errors out when the directory for the locale in the # sysroot is actually a file. @@ -73,4 +73,4 @@ sysroot-invalid: test.rs working.ftl ln -s $(SYSROOT)/lib/rustlib/src/* $(FAKEROOT)/lib/rustlib/src mkdir -p $(FAKEROOT)/share/locale touch $(FAKEROOT)/share/locale/zh-CN - $(RUSTC) $< --sysroot $(FAKEROOT) -Ztranslate-lang=zh-CN 2>&1 | grep "`\$sysroot/share/locales/\$locale` is not a directory" + $(RUSTC) $< --sysroot $(FAKEROOT) -Ztranslate-lang=zh-CN 2>&1 | $(CGREP) "`\$sysroot/share/locales/\$locale` is not a directory" diff --git a/tests/run-make/type-mismatch-same-crate-name/Makefile b/tests/run-make/type-mismatch-same-crate-name/Makefile new file mode 100644 index 000000000..a2a2a41c7 --- /dev/null +++ b/tests/run-make/type-mismatch-same-crate-name/Makefile @@ -0,0 +1,19 @@ +include ../tools.mk + +all: + # compile two different versions of crateA + $(RUSTC) --crate-type=rlib crateA.rs -C metadata=-1 -C extra-filename=-1 + $(RUSTC) --crate-type=rlib crateA.rs -C metadata=-2 -C extra-filename=-2 + # make crateB depend on version 1 of crateA + $(RUSTC) --crate-type=rlib crateB.rs --extern crateA=$(TMPDIR)/libcrateA-1.rlib + # make crateC depend on version 2 of crateA + $(RUSTC) crateC.rs --extern crateA=$(TMPDIR)/libcrateA-2.rlib 2>&1 | \ + tr -d '\r\n' | $(CGREP) -e \ + "mismatched types.*\ + crateB::try_foo\(foo2\);.*\ + expected \`crateA::foo::Foo\`, found \`Foo\`.*\ + different versions of crate \`crateA\`.*\ + mismatched types.*\ + crateB::try_bar\(bar2\);.*\ + expected trait \`crateA::bar::Bar\`, found trait \`Bar\`.*\ + different versions of crate \`crateA\`" diff --git a/tests/run-make/type-mismatch-same-crate-name/crateA.rs b/tests/run-make/type-mismatch-same-crate-name/crateA.rs new file mode 100644 index 000000000..4871c8c2e --- /dev/null +++ b/tests/run-make/type-mismatch-same-crate-name/crateA.rs @@ -0,0 +1,16 @@ +mod foo { + pub struct Foo; +} + +mod bar { + pub trait Bar{} + + pub fn bar() -> Box { + unimplemented!() + } +} + +// This makes the publicly accessible path +// differ from the internal one. +pub use foo::Foo; +pub use bar::{Bar, bar}; diff --git a/tests/run-make/type-mismatch-same-crate-name/crateB.rs b/tests/run-make/type-mismatch-same-crate-name/crateB.rs new file mode 100644 index 000000000..24fcc7cad --- /dev/null +++ b/tests/run-make/type-mismatch-same-crate-name/crateB.rs @@ -0,0 +1,4 @@ +extern crate crateA; + +pub fn try_foo(x: crateA::Foo){} +pub fn try_bar(x: Box){} diff --git a/tests/run-make/type-mismatch-same-crate-name/crateC.rs b/tests/run-make/type-mismatch-same-crate-name/crateC.rs new file mode 100644 index 000000000..71b38a9f8 --- /dev/null +++ b/tests/run-make/type-mismatch-same-crate-name/crateC.rs @@ -0,0 +1,25 @@ +// This tests the extra note reported when a type error deals with +// seemingly identical types. +// The main use case of this error is when there are two crates +// (generally different versions of the same crate) with the same name +// causing a type mismatch. + +// The test is nearly the same as the one in +// ui/type/type-mismatch-same-crate-name.rs +// but deals with the case where one of the crates +// is only introduced as an indirect dependency. +// and the type is accessed via a re-export. +// This is similar to how the error can be introduced +// when using cargo's automatic dependency resolution. + +extern crate crateA; + +fn main() { + let foo2 = crateA::Foo; + let bar2 = crateA::bar(); + { + extern crate crateB; + crateB::try_foo(foo2); + crateB::try_bar(bar2); + } +} diff --git a/tests/run-make/unstable-flag-required/Makefile b/tests/run-make/unstable-flag-required/Makefile index d3a734fae..17dd15b07 100644 --- a/tests/run-make/unstable-flag-required/Makefile +++ b/tests/run-make/unstable-flag-required/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk all: $(RUSTDOC) --output-format=json x.html 2>&1 | diff - output-format-json.stderr diff --git a/tests/run-make/use-extern-for-plugins/Makefile b/tests/run-make/use-extern-for-plugins/Makefile new file mode 100644 index 000000000..b8ec7e8dc --- /dev/null +++ b/tests/run-make/use-extern-for-plugins/Makefile @@ -0,0 +1,17 @@ +include ../tools.mk + +# ignore-freebsd +# ignore-openbsd +# ignore-solaris + +HOST := $(shell $(RUSTC) -vV | grep 'host:' | sed 's/host: //') +ifeq ($(findstring i686,$(HOST)),i686) +TARGET := $(subst i686,x86_64,$(HOST)) +else +TARGET := $(subst x86_64,i686,$(HOST)) +endif + +all: + $(RUSTC) foo.rs -C extra-filename=-host + $(RUSTC) bar.rs -C extra-filename=-targ --target $(TARGET) + $(RUSTC) baz.rs --extern a=$(TMPDIR)/liba-targ.rlib --target $(TARGET) diff --git a/tests/run-make/use-extern-for-plugins/bar.rs b/tests/run-make/use-extern-for-plugins/bar.rs new file mode 100644 index 000000000..704d21203 --- /dev/null +++ b/tests/run-make/use-extern-for-plugins/bar.rs @@ -0,0 +1,9 @@ +#![feature(no_core)] +#![no_core] +#![crate_type = "lib"] +#![crate_name = "a"] + +#[macro_export] +macro_rules! bar { + () => () +} diff --git a/tests/run-make/use-extern-for-plugins/baz.rs b/tests/run-make/use-extern-for-plugins/baz.rs new file mode 100644 index 000000000..49a96a0c8 --- /dev/null +++ b/tests/run-make/use-extern-for-plugins/baz.rs @@ -0,0 +1,8 @@ +#![feature(no_core)] +#![no_core] +#![crate_type = "lib"] + +#[macro_use] +extern crate a; + +bar!(); diff --git a/tests/run-make/use-extern-for-plugins/foo.rs b/tests/run-make/use-extern-for-plugins/foo.rs new file mode 100644 index 000000000..dffdc0798 --- /dev/null +++ b/tests/run-make/use-extern-for-plugins/foo.rs @@ -0,0 +1,8 @@ +#![no_std] +#![crate_type = "lib"] +#![crate_name = "a"] + +#[macro_export] +macro_rules! foo { + () => () +} diff --git a/tests/run-make/use-suggestions-rust-2018/Makefile b/tests/run-make/use-suggestions-rust-2018/Makefile new file mode 100644 index 000000000..37cd6283c --- /dev/null +++ b/tests/run-make/use-suggestions-rust-2018/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +all: + $(RUSTC) ep-nested-lib.rs + + $(RUSTC) use-suggestions.rs --edition=2018 --extern ep_nested_lib=$(TMPDIR)/libep_nested_lib.rlib 2>&1 | $(CGREP) "use ep_nested_lib::foo::bar::Baz" + diff --git a/tests/run-make/use-suggestions-rust-2018/ep-nested-lib.rs b/tests/run-make/use-suggestions-rust-2018/ep-nested-lib.rs new file mode 100644 index 000000000..62a0a9d8f --- /dev/null +++ b/tests/run-make/use-suggestions-rust-2018/ep-nested-lib.rs @@ -0,0 +1,7 @@ +#![crate_type = "rlib"] + +pub mod foo { + pub mod bar { + pub struct Baz; + } +} diff --git a/tests/run-make/use-suggestions-rust-2018/use-suggestions.rs b/tests/run-make/use-suggestions-rust-2018/use-suggestions.rs new file mode 100644 index 000000000..d262d6f98 --- /dev/null +++ b/tests/run-make/use-suggestions-rust-2018/use-suggestions.rs @@ -0,0 +1,3 @@ +fn main() { + let x = Baz{}; +} diff --git a/tests/run-make/used-cdylib-macos/Makefile b/tests/run-make/used-cdylib-macos/Makefile new file mode 100644 index 000000000..38a4c31c7 --- /dev/null +++ b/tests/run-make/used-cdylib-macos/Makefile @@ -0,0 +1,11 @@ +include ../tools.mk + +# only-macos +# +# This checks that `#[used]` passes through to the linker on +# darwin. This is subject to change in the future, see +# https://github.com/rust-lang/rust/pull/93718 for discussion + +all: + $(RUSTC) -Copt-level=3 dylib_used.rs + nm $(TMPDIR)/libdylib_used.dylib | $(CGREP) VERY_IMPORTANT_SYMBOL diff --git a/tests/run-make/used-cdylib-macos/dylib_used.rs b/tests/run-make/used-cdylib-macos/dylib_used.rs new file mode 100644 index 000000000..85f0ff92f --- /dev/null +++ b/tests/run-make/used-cdylib-macos/dylib_used.rs @@ -0,0 +1,4 @@ +#![crate_type = "cdylib"] + +#[used] +static VERY_IMPORTANT_SYMBOL: u32 = 12345; diff --git a/tests/run-make/used/Makefile b/tests/run-make/used/Makefile new file mode 100644 index 000000000..e80eb9e40 --- /dev/null +++ b/tests/run-make/used/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +# ignore-windows-msvc + +all: + $(RUSTC) -C opt-level=3 --emit=obj used.rs + nm $(TMPDIR)/used.o | $(CGREP) FOO diff --git a/tests/run-make/used/used.rs b/tests/run-make/used/used.rs new file mode 100644 index 000000000..dca0a5e11 --- /dev/null +++ b/tests/run-make/used/used.rs @@ -0,0 +1,6 @@ +#![crate_type = "lib"] + +#[used] +static FOO: u32 = 0; + +static BAR: u32 = 0; diff --git a/tests/run-make/valid-print-requests/Makefile b/tests/run-make/valid-print-requests/Makefile index c325e536e..99430e98d 100644 --- a/tests/run-make/valid-print-requests/Makefile +++ b/tests/run-make/valid-print-requests/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk all: $(RUSTC) --print uwu 2>&1 | diff - valid-print-requests.stderr 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 5191e4676..bea6ce067 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`, `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` diff --git a/tests/run-make/version/Makefile b/tests/run-make/version/Makefile new file mode 100644 index 000000000..3a130545d --- /dev/null +++ b/tests/run-make/version/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +all: + $(RUSTC) -V + $(RUSTC) -vV + $(RUSTC) --version --verbose diff --git a/tests/run-make/volatile-intrinsics/Makefile b/tests/run-make/volatile-intrinsics/Makefile new file mode 100644 index 000000000..5672a0458 --- /dev/null +++ b/tests/run-make/volatile-intrinsics/Makefile @@ -0,0 +1,10 @@ +# ignore-cross-compile +include ../tools.mk + +all: + # The tests must pass... + $(RUSTC) main.rs + $(call RUN,main) + # ... and the loads/stores must not be optimized out. + $(RUSTC) main.rs --emit=llvm-ir + $(CGREP) "load volatile" "store volatile" < $(TMPDIR)/main.ll diff --git a/tests/run-make/volatile-intrinsics/main.rs b/tests/run-make/volatile-intrinsics/main.rs new file mode 100644 index 000000000..4295d95f3 --- /dev/null +++ b/tests/run-make/volatile-intrinsics/main.rs @@ -0,0 +1,24 @@ +#![feature(core_intrinsics, volatile)] + +use std::intrinsics::{ + unaligned_volatile_load, unaligned_volatile_store, volatile_load, volatile_store, +}; +use std::ptr::{read_volatile, write_volatile}; + +pub fn main() { + unsafe { + let mut i: isize = 1; + volatile_store(&mut i, 2); + assert_eq!(volatile_load(&i), 2); + } + unsafe { + let mut i: isize = 1; + unaligned_volatile_store(&mut i, 2); + assert_eq!(unaligned_volatile_load(&i), 2); + } + unsafe { + let mut i: isize = 1; + write_volatile(&mut i, 2); + assert_eq!(read_volatile(&i), 2); + } +} diff --git a/tests/run-make/wasm-abi/Makefile b/tests/run-make/wasm-abi/Makefile index e713ca187..ed95464ef 100644 --- a/tests/run-make/wasm-abi/Makefile +++ b/tests/run-make/wasm-abi/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # only-wasm32-bare diff --git a/tests/run-make/wasm-custom-section/Makefile b/tests/run-make/wasm-custom-section/Makefile index 92b0802e3..2f7d38c27 100644 --- a/tests/run-make/wasm-custom-section/Makefile +++ b/tests/run-make/wasm-custom-section/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # only-wasm32-bare diff --git a/tests/run-make/wasm-custom-sections-opt/Makefile b/tests/run-make/wasm-custom-sections-opt/Makefile index e5b45d963..a0d437813 100644 --- a/tests/run-make/wasm-custom-sections-opt/Makefile +++ b/tests/run-make/wasm-custom-sections-opt/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # only-wasm32-bare diff --git a/tests/run-make/wasm-export-all-symbols/Makefile b/tests/run-make/wasm-export-all-symbols/Makefile index 834f4d258..86713bc80 100644 --- a/tests/run-make/wasm-export-all-symbols/Makefile +++ b/tests/run-make/wasm-export-all-symbols/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # only-wasm32-bare diff --git a/tests/run-make/wasm-import-module/Makefile b/tests/run-make/wasm-import-module/Makefile index 18cef16aa..a0b4d920b 100644 --- a/tests/run-make/wasm-import-module/Makefile +++ b/tests/run-make/wasm-import-module/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # only-wasm32-bare diff --git a/tests/run-make/wasm-panic-small/Makefile b/tests/run-make/wasm-panic-small/Makefile index 2af9f7135..16f545218 100644 --- a/tests/run-make/wasm-panic-small/Makefile +++ b/tests/run-make/wasm-panic-small/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # only-wasm32-bare diff --git a/tests/run-make/wasm-spurious-import/Makefile b/tests/run-make/wasm-spurious-import/Makefile index 6f50e6e55..ff9dfeac6 100644 --- a/tests/run-make/wasm-spurious-import/Makefile +++ b/tests/run-make/wasm-spurious-import/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # only-wasm32-bare diff --git a/tests/run-make/wasm-stringify-ints-small/Makefile b/tests/run-make/wasm-stringify-ints-small/Makefile index 2fa2c954d..f959dbd42 100644 --- a/tests/run-make/wasm-stringify-ints-small/Makefile +++ b/tests/run-make/wasm-stringify-ints-small/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk ifeq ($(TARGET),wasm32-unknown-unknown) all: diff --git a/tests/run-make/wasm-symbols-different-module/Makefile b/tests/run-make/wasm-symbols-different-module/Makefile index 9e657222d..0f86914c7 100644 --- a/tests/run-make/wasm-symbols-different-module/Makefile +++ b/tests/run-make/wasm-symbols-different-module/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # only-wasm32-bare diff --git a/tests/run-make/wasm-symbols-not-exported/Makefile b/tests/run-make/wasm-symbols-not-exported/Makefile index 60b0dee00..024ad7797 100644 --- a/tests/run-make/wasm-symbols-not-exported/Makefile +++ b/tests/run-make/wasm-symbols-not-exported/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # only-wasm32-bare diff --git a/tests/run-make/wasm-symbols-not-imported/Makefile b/tests/run-make/wasm-symbols-not-imported/Makefile index dc7618c19..38440a8b0 100644 --- a/tests/run-make/wasm-symbols-not-imported/Makefile +++ b/tests/run-make/wasm-symbols-not-imported/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk # only-wasm32-bare diff --git a/tests/run-make/weird-output-filenames/Makefile b/tests/run-make/weird-output-filenames/Makefile new file mode 100644 index 000000000..d3a34e3b4 --- /dev/null +++ b/tests/run-make/weird-output-filenames/Makefile @@ -0,0 +1,15 @@ +include ../tools.mk + +all: + cp foo.rs $(TMPDIR)/.foo.rs + $(RUSTC) $(TMPDIR)/.foo.rs 2>&1 \ + | $(CGREP) -e "invalid character.*in crate name:" + cp foo.rs $(TMPDIR)/.foo.bar + $(RUSTC) $(TMPDIR)/.foo.bar 2>&1 \ + | $(CGREP) -e "invalid character.*in crate name:" + cp foo.rs $(TMPDIR)/+foo+bar.rs + $(RUSTC) $(TMPDIR)/+foo+bar.rs 2>&1 \ + | $(CGREP) -e "invalid character.*in crate name:" + cp foo.rs $(TMPDIR)/-foo.rs + $(RUSTC) $(TMPDIR)/-foo.rs 2>&1 \ + | $(CGREP) 'crate names cannot start with a `-`' diff --git a/tests/run-make/weird-output-filenames/foo.rs b/tests/run-make/weird-output-filenames/foo.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/tests/run-make/weird-output-filenames/foo.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/windows-binary-no-external-deps/Makefile b/tests/run-make/windows-binary-no-external-deps/Makefile new file mode 100644 index 000000000..8960020fe --- /dev/null +++ b/tests/run-make/windows-binary-no-external-deps/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +# only-windows + +PATH=$(SYSTEMROOT)/system32 + +all: + $(RUSTC) hello.rs + $(TMPDIR)/hello.exe diff --git a/tests/run-make/windows-binary-no-external-deps/hello.rs b/tests/run-make/windows-binary-no-external-deps/hello.rs new file mode 100644 index 000000000..47ad8c634 --- /dev/null +++ b/tests/run-make/windows-binary-no-external-deps/hello.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello World!"); +} diff --git a/tests/run-make/windows-spawn/Makefile b/tests/run-make/windows-spawn/Makefile new file mode 100644 index 000000000..b6cdb169b --- /dev/null +++ b/tests/run-make/windows-spawn/Makefile @@ -0,0 +1,8 @@ +include ../tools.mk + +# only-windows + +all: + $(RUSTC) -o "$(TMPDIR)/hopefullydoesntexist bar.exe" hello.rs + $(RUSTC) spawn.rs + $(TMPDIR)/spawn.exe diff --git a/tests/run-make/windows-spawn/hello.rs b/tests/run-make/windows-spawn/hello.rs new file mode 100644 index 000000000..47ad8c634 --- /dev/null +++ b/tests/run-make/windows-spawn/hello.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello World!"); +} diff --git a/tests/run-make/windows-spawn/spawn.rs b/tests/run-make/windows-spawn/spawn.rs new file mode 100644 index 000000000..c34da3d5f --- /dev/null +++ b/tests/run-make/windows-spawn/spawn.rs @@ -0,0 +1,12 @@ +use std::io::ErrorKind; +use std::process::Command; + +fn main() { + // Make sure it doesn't try to run "hopefullydoesntexist bar.exe". + assert_eq!(Command::new("hopefullydoesntexist") + .arg("bar") + .spawn() + .unwrap_err() + .kind(), + ErrorKind::NotFound); +} diff --git a/tests/run-make/windows-subsystem/Makefile b/tests/run-make/windows-subsystem/Makefile new file mode 100644 index 000000000..e3cf9181d --- /dev/null +++ b/tests/run-make/windows-subsystem/Makefile @@ -0,0 +1,6 @@ +# ignore-cross-compile +include ../tools.mk + +all: + $(RUSTC) windows.rs + $(RUSTC) console.rs diff --git a/tests/run-make/windows-subsystem/console.rs b/tests/run-make/windows-subsystem/console.rs new file mode 100644 index 000000000..61a92eb6a --- /dev/null +++ b/tests/run-make/windows-subsystem/console.rs @@ -0,0 +1,3 @@ +#![windows_subsystem = "console"] + +fn main() {} diff --git a/tests/run-make/windows-subsystem/windows.rs b/tests/run-make/windows-subsystem/windows.rs new file mode 100644 index 000000000..1138248f0 --- /dev/null +++ b/tests/run-make/windows-subsystem/windows.rs @@ -0,0 +1,3 @@ +#![windows_subsystem = "windows"] + +fn main() {} diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/Makefile b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/Makefile index 84dcd2393..3c88ec34f 100644 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/Makefile +++ b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +include ../tools.mk #only-x86_64-fortanix-unknown-sgx diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_asm.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_asm.checks index e839c200b..d2e53bee0 100644 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_asm.checks +++ b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_asm.checks @@ -1,8 +1,7 @@ CHECK: cc_plus_one_asm CHECK-NEXT: movl CHECK-NEXT: lfence -CHECK-NEXT: inc -CHECK-NEXT: notq (%rsp) -CHECK-NEXT: notq (%rsp) +CHECK-NEXT: incl +CHECK-NEXT: shlq $0x0, (%rsp) CHECK-NEXT: lfence CHECK-NEXT: retq diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_c_asm.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_c_asm.checks index d1fae3d49..0a3d1dced 100644 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_c_asm.checks +++ b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_c_asm.checks @@ -6,7 +6,7 @@ CHECK: lfence CHECK: lfence CHECK-NEXT: incl CHECK-NEXT: jmp -CHECK-NEXT: shlq $0, (%rsp) +CHECK-NEXT: shlq $0x0, (%rsp) CHECK-NEXT: lfence CHECK-NEXT: retq CHECK: popq diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx_asm.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx_asm.checks index e704bf417..0126cd8ee 100644 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx_asm.checks +++ b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx_asm.checks @@ -7,7 +7,7 @@ CHECK: lfence CHECK: lfence CHECK-NEXT: incl CHECK-NEXT: jmp 0x{{[[:xdigit:]]+}} -CHECK-NEXT: shlq $0, (%rsp) +CHECK-NEXT: shlq $0x0, (%rsp) CHECK-NEXT: lfence CHECK-NEXT: retq CHECK: popq diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_asm.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_asm.checks index 78b18ccbf..615675488 100644 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_asm.checks +++ b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_asm.checks @@ -2,6 +2,6 @@ CHECK: cmake_plus_one_asm CHECK-NEXT: movl CHECK-NEXT: lfence CHECK-NEXT: incl -CHECK-NEXT: shlq $0, (%rsp) +CHECK-NEXT: shlq $0x0, (%rsp) CHECK-NEXT: lfence CHECK-NEXT: retq diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c_asm.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c_asm.checks index 87c806f13..17312b912 100644 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c_asm.checks +++ b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c_asm.checks @@ -7,7 +7,7 @@ CHECK: movl CHECK: lfence CHECK-NEXT: incl CHECK-NEXT: jmp 0x{{[[:xdigit:]]+}} -CHECK-NEXT: shlq $0, (%rsp) +CHECK-NEXT: shlq $0x0, (%rsp) CHECK-NEXT: lfence CHECK-NEXT: retq CHECK: popq diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_asm.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_asm.checks index 9cac8711e..222e4ef79 100644 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_asm.checks +++ b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_asm.checks @@ -7,7 +7,7 @@ CHECK: movl CHECK: lfence CHECK-NEXT: incl CHECK-NEXT: jmp 0x{{[[:xdigit:]]+}} -CHECK-NEXT: shlq $0, (%rsp) +CHECK-NEXT: shlq $0x0, (%rsp) CHECK-NEXT: lfence CHECK-NEXT: retq CHECK: popq diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/jumpto.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/jumpto.checks index 15211e3ad..885bf461b 100644 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/jumpto.checks +++ b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/jumpto.checks @@ -1,8 +1,24 @@ -CHECK: libunwind::Registers_x86_64::jumpto +CHECK: __libunwind_Registers_x86_64_jumpto CHECK: lfence CHECK: lfence CHECK: lfence CHECK: lfence -CHECK: shlq $0, (%rsp) +CHECK: lfence +CHECK: lfence +CHECK: lfence +CHECK: lfence +CHECK: lfence +CHECK: lfence +CHECK: lfence +CHECK: lfence +CHECK: lfence +CHECK: lfence +CHECK: lfence +CHECK: lfence +CHECK: lfence +CHECK: lfence +CHECK-NEXT: popq [[REGISTER:%[a-z]+]] +CHECK-NEXT: lfence +CHECK-NEXT: popq [[REGISTER:%[a-z]+]] CHECK-NEXT: lfence -CHECK-NEXT: retq +CHECK-NEXT: jmpq *[[REGISTER]] diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.checks index 0fe88141b..8a5493650 100644 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.checks +++ b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.checks @@ -2,6 +2,5 @@ CHECK: print CHECK: lfence CHECK: lfence CHECK: lfence -CHECK: popq CHECK: callq 0x{{[[:xdigit:]]*}} <_Unwind_Resume> CHECK-NEXT: ud2 diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh index 944343df6..235bb603b 100644 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh +++ b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh @@ -20,39 +20,38 @@ function build { } function check { - local func=$1 + local func_re="$1" local checks="${TEST_DIR}/$2" local asm=$(mktemp) - local objdump="${BUILD_DIR}/x86_64-unknown-linux-gnu/llvm/build/bin/llvm-objdump" - local filecheck="${BUILD_DIR}/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck" - - ${objdump} --disassemble-symbols=${func} --demangle \ - ${WORK_DIR}/enclave/target/x86_64-fortanix-unknown-sgx/debug/enclave > ${asm} + local objdump="${LLVM_BIN_DIR}/llvm-objdump" + local filecheck="${LLVM_BIN_DIR}/FileCheck" + local enclave=${WORK_DIR}/enclave/target/x86_64-fortanix-unknown-sgx/debug/enclave + + func="$(${objdump} --syms --demangle ${enclave} | \ + grep --only-matching -E "[[:blank:]]+${func_re}\$" | \ + sed -e 's/^[[:space:]]*//' )" + ${objdump} --disassemble-symbols="${func}" --demangle \ + ${enclave} > ${asm} ${filecheck} --input-file ${asm} ${checks} } build -check unw_getcontext unw_getcontext.checks -check "libunwind::Registers_x86_64::jumpto()" jumpto.checks -check "std::io::stdio::_print::h87f0c238421c45bc" print.checks -check rust_plus_one_global_asm rust_plus_one_global_asm.checks \ - || echo "warning: module level assembly currently not hardened" +check "unw_getcontext" unw_getcontext.checks +check "__libunwind_Registers_x86_64_jumpto" jumpto.checks +check 'std::io::stdio::_print::[[:alnum:]]+' print.checks +check rust_plus_one_global_asm rust_plus_one_global_asm.checks check cc_plus_one_c cc_plus_one_c.checks check cc_plus_one_c_asm cc_plus_one_c_asm.checks check cc_plus_one_cxx cc_plus_one_cxx.checks check cc_plus_one_cxx_asm cc_plus_one_cxx_asm.checks -check cc_plus_one_asm cc_plus_one_asm.checks \ - || echo "warning: the cc crate forwards assembly files to the CC compiler." \ - "Clang uses its own integrated assembler, which does not include the LVI passes." +check cc_plus_one_asm cc_plus_one_asm.checks check cmake_plus_one_c cmake_plus_one_c.checks check cmake_plus_one_c_asm cmake_plus_one_c_asm.checks -check cmake_plus_one_c_global_asm cmake_plus_one_c_global_asm.checks \ - || echo "warning: module level assembly currently not hardened" +check cmake_plus_one_c_global_asm cmake_plus_one_c_global_asm.checks check cmake_plus_one_cxx cmake_plus_one_cxx.checks check cmake_plus_one_cxx_asm cmake_plus_one_cxx_asm.checks -check cmake_plus_one_cxx_global_asm cmake_plus_one_cxx_global_asm.checks \ - || echo "warning: module level assembly currently not hardened" +check cmake_plus_one_cxx_global_asm cmake_plus_one_cxx_global_asm.checks check cmake_plus_one_asm cmake_plus_one_asm.checks diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/unw_getcontext.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/unw_getcontext.checks index 4b7615b11..b46cf7583 100644 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/unw_getcontext.checks +++ b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/unw_getcontext.checks @@ -1,6 +1,6 @@ CHECK: unw_getcontext CHECK: lfence CHECK: lfence -CHECK: shlq $0, (%rsp) +CHECK: shlq $0x0, (%rsp) CHECK-NEXT: lfence CHECK-NEXT: retq diff --git a/tests/rustdoc-gui/anchor-navigable.goml b/tests/rustdoc-gui/anchor-navigable.goml index 9d5c55a1e..61d7c89d4 100644 --- a/tests/rustdoc-gui/anchor-navigable.goml +++ b/tests/rustdoc-gui/anchor-navigable.goml @@ -4,7 +4,7 @@ // anchor and the `impl Foo`. If there were a gap, this would cause an annoying // problem: you hover `impl Foo` to see the anchor, then when you move your // mouse to the left, the anchor disappears before you reach it. -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" // We check that ".item-info" is bigger than its content. move-cursor-to: ".impl" assert-property: (".impl > a.anchor", {"offsetWidth": "8"}) diff --git a/tests/rustdoc-gui/anchors.goml b/tests/rustdoc-gui/anchors.goml index 85cb72274..0904aa90e 100644 --- a/tests/rustdoc-gui/anchors.goml +++ b/tests/rustdoc-gui/anchors.goml @@ -4,12 +4,12 @@ define-function: ( "check-colors", (theme, main_color, title_color, main_heading_color, main_heading_type_color, src_link_color, sidebar_link_color), block { - goto: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html" + go-to: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html" // This is needed to ensure that the text color is computed. show-text: true // Setting the theme. - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} // We reload the page so the local storage settings are being used. reload: @@ -48,9 +48,9 @@ define-function: ( {"color": |src_link_color|, "text-decoration": "none solid " + |src_link_color|}, ) - goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" + go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" // Since we changed page, we need to set the theme again. - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} // We reload the page so the local storage settings are being used. reload: diff --git a/tests/rustdoc-gui/auto-hide-trait-implementations.goml b/tests/rustdoc-gui/auto-hide-trait-implementations.goml deleted file mode 100644 index 0a619c352..000000000 --- a/tests/rustdoc-gui/auto-hide-trait-implementations.goml +++ /dev/null @@ -1,13 +0,0 @@ -// Checks that the setting "auto hide trait implementations" is working as expected. -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" - -// By default, the trait implementations are not collapsed. -assert-attribute: ("#trait-implementations-list > details", {"open": ""}, ALL) - -// We now set the setting to auto hide all trait implementations. -local-storage: {"rustdoc-auto-hide-trait-implementations": "true" } -// We reload to ensure the trait implementations are collapsed as expected. -reload: - -// We now check that all matching elements don't have the open attributes. -assert-attribute-false: ("#trait-implementations-list > details", {"open": ""}, ALL) diff --git a/tests/rustdoc-gui/basic-code.goml b/tests/rustdoc-gui/basic-code.goml index 971c2f948..e372f7119 100644 --- a/tests/rustdoc-gui/basic-code.goml +++ b/tests/rustdoc-gui/basic-code.goml @@ -1,6 +1,6 @@ // Small test to ensure the "src-line-numbers" element is only present once on // the page. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" click: ".srclink" wait-for: ".src-line-numbers" assert-count: (".src-line-numbers", 1) diff --git a/tests/rustdoc-gui/check-code-blocks-margin.goml b/tests/rustdoc-gui/check-code-blocks-margin.goml index c2cec0020..8c2cbc4d9 100644 --- a/tests/rustdoc-gui/check-code-blocks-margin.goml +++ b/tests/rustdoc-gui/check-code-blocks-margin.goml @@ -1,5 +1,5 @@ // This test ensures that the docblock elements have the appropriate left margin. -goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" // The top docblock elements shouldn't have left margin... assert-css: ("#main-content .item-decl", {"margin-left": "0px"}) // ... but all the others should! diff --git a/tests/rustdoc-gui/check-stab-in-docblock.goml b/tests/rustdoc-gui/check-stab-in-docblock.goml index 266fa9997..2f6263621 100644 --- a/tests/rustdoc-gui/check-stab-in-docblock.goml +++ b/tests/rustdoc-gui/check-stab-in-docblock.goml @@ -1,9 +1,9 @@ // This test checks that using `.stab` attributes in `.docblock` elements doesn't // create scrollable paragraphs. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // Needs the text to be display to check for scrollable content. show-text: true -size: (786, 600) +set-window-size: (786, 600) // Confirms that there 3 paragraphs. assert-count: (".top-doc .docblock p", 3) // Checking that there is no scrollable content. diff --git a/tests/rustdoc-gui/check_info_sign_position.goml b/tests/rustdoc-gui/check_info_sign_position.goml index f36e73fc5..c9a4ea94c 100644 --- a/tests/rustdoc-gui/check_info_sign_position.goml +++ b/tests/rustdoc-gui/check_info_sign_position.goml @@ -1,7 +1,7 @@ // This test checks the position of the information on the code blocks (like // `compile_fail` or `ignore`). -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" -goto: "./fn.check_list_code_block.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "./fn.check_list_code_block.html" // If the codeblock is the first element of the docblock, the information tooltip must have // have some top margin to avoid going over the toggle (the "[+]"). assert-css: (".docblock > .example-wrap.compile_fail .tooltip", { "margin-top": "16px" }) diff --git a/tests/rustdoc-gui/code-blocks-overflow.goml b/tests/rustdoc-gui/code-blocks-overflow.goml index fbf0e890b..a23136f4b 100644 --- a/tests/rustdoc-gui/code-blocks-overflow.goml +++ b/tests/rustdoc-gui/code-blocks-overflow.goml @@ -1,6 +1,6 @@ // This test ensures that codeblocks content don't overflow. -goto: "file://" + |DOC_PATH| + "/lib2/sub_mod/struct.Foo.html" -size: (1080, 600) +go-to: "file://" + |DOC_PATH| + "/lib2/sub_mod/struct.Foo.html" +set-window-size: (1080, 600) // There should be two codeblocks: a rust one and a non-rust one. assert-count: (".docblock > .example-wrap", 2) assert: ".docblock > .example-wrap > .language-txt" diff --git a/tests/rustdoc-gui/code-color.goml b/tests/rustdoc-gui/code-color.goml index cb550a457..833fa05db 100644 --- a/tests/rustdoc-gui/code-color.goml +++ b/tests/rustdoc-gui/code-color.goml @@ -2,7 +2,7 @@ // check that the rule isn't applied on other "" elements. // // While we're at it, we also check it for the other themes. -goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" // If the text isn't displayed, the browser doesn't compute color style correctly... show-text: true @@ -11,7 +11,7 @@ define-function: ( (theme, doc_code_color, doc_inline_code_color), block { // Set the theme. - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} // We reload the page so the local storage settings are being used. reload: assert-css: (".docblock pre > code", {"color": |doc_code_color|}, ALL) diff --git a/tests/rustdoc-gui/code-sidebar-toggle.goml b/tests/rustdoc-gui/code-sidebar-toggle.goml index df665bd46..28c3712f3 100644 --- a/tests/rustdoc-gui/code-sidebar-toggle.goml +++ b/tests/rustdoc-gui/code-sidebar-toggle.goml @@ -1,7 +1,7 @@ // This test checks that the source code pages sidebar toggle is working as expected. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" click: ".srclink" wait-for: "#src-sidebar-toggle" click: "#src-sidebar-toggle" -fail: true +expect-failure: true assert-css: ("#source-sidebar", { "left": "-300px" }) diff --git a/tests/rustdoc-gui/code-tags.goml b/tests/rustdoc-gui/code-tags.goml index ca337cbc3..3405d3295 100644 --- a/tests/rustdoc-gui/code-tags.goml +++ b/tests/rustdoc-gui/code-tags.goml @@ -3,22 +3,22 @@ // We need to disable this check because `implementors/test_docs/trait.AnotherOne.js` // doesn't exist. fail-on-request-error: false -goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" -size: (1080, 600) +go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" +set-window-size: (1080, 600) // There should be four doc codeblocks. // Check that their content is inside

 assert-count: (".example-wrap pre > code", 4)
 // Check that function signature is inside 

 assert: "pre.rust.item-decl > code"
 
-goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
+go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
 assert: "pre.rust.item-decl > code"
 
-goto: "file://" + |DOC_PATH| + "/test_docs/enum.AnEnum.html"
+go-to: "file://" + |DOC_PATH| + "/test_docs/enum.AnEnum.html"
 assert: "pre.rust.item-decl > code"
 
-goto: "file://" + |DOC_PATH| + "/test_docs/trait.AnotherOne.html"
+go-to: "file://" + |DOC_PATH| + "/test_docs/trait.AnotherOne.html"
 assert: "pre.rust.item-decl > code"
 
-goto: "file://" + |DOC_PATH| + "/test_docs/type.SomeType.html"
+go-to: "file://" + |DOC_PATH| + "/test_docs/type.SomeType.html"
 assert: "pre.rust.item-decl > code"
diff --git a/tests/rustdoc-gui/codeblock-sub.goml b/tests/rustdoc-gui/codeblock-sub.goml
index cbd314d27..03575cc6a 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.
-goto: "file://" + |DOC_PATH| + "/test_docs/codeblock_sub/index.html"
+go-to: "file://" + |DOC_PATH| + "/test_docs/codeblock_sub/index.html"
 
 store-property: (codeblock_sub_1, "#codeblock-sub-1", "offsetHeight")
 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 36b67073a..2ed0579d3 100644
--- a/tests/rustdoc-gui/codeblock-tooltip.goml
+++ b/tests/rustdoc-gui/codeblock-tooltip.goml
@@ -1,5 +1,5 @@
 // Checking the colors of the codeblocks tooltips.
-goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
+go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
 show-text: true
 
 define-function: (
@@ -7,7 +7,7 @@ define-function: (
     (theme, background, color, border),
     block {
         // Setting the theme.
-        local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
+        set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
         reload:
 
         // compile_fail block
diff --git a/tests/rustdoc-gui/cursor.goml b/tests/rustdoc-gui/cursor.goml
index 59b139797..f318b05ce 100644
--- a/tests/rustdoc-gui/cursor.goml
+++ b/tests/rustdoc-gui/cursor.goml
@@ -1,5 +1,5 @@
 // This test ensures that several clickable items actually have the pointer cursor.
-goto: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html"
+go-to: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html"
 
 // the `[+]/[-]` button
 assert-css: ("#toggle-all-docs", {"cursor": "pointer"})
@@ -16,9 +16,9 @@ wait-for: "#search-tabs"
 assert-css: ("#search-tabs > button", {"cursor": "pointer"})
 
 // mobile sidebar toggle button
-size: (500, 700)
+set-window-size: (500, 700)
 assert-css: (".sidebar-menu-toggle", {"cursor": "pointer"})
 
 // the sidebar toggle button on the source code pages
-goto: "file://" + |DOC_PATH| + "/src/lib2/lib.rs.html"
+go-to: "file://" + |DOC_PATH| + "/src/lib2/lib.rs.html"
 assert-css: ("#src-sidebar-toggle > button", {"cursor": "pointer"})
diff --git a/tests/rustdoc-gui/default-settings.goml b/tests/rustdoc-gui/default-settings.goml
index ab27b001e..3466f3693 100644
--- a/tests/rustdoc-gui/default-settings.goml
+++ b/tests/rustdoc-gui/default-settings.goml
@@ -2,7 +2,7 @@
 //
 // The "settings" crate uses "ayu" as default setting, which is what we will
 // check.
-goto: "file://" + |DOC_PATH| + "/settings/index.html"
+go-to: "file://" + |DOC_PATH| + "/settings/index.html"
 // Wait a bit to be sure the default theme is applied.
 // If the theme isn't applied, the command will time out.
 wait-for-css: ("body", {"background-color": "rgb(15, 20, 25)"})
diff --git a/tests/rustdoc-gui/docblock-big-code-mobile.goml b/tests/rustdoc-gui/docblock-big-code-mobile.goml
index 3ce921c2c..6fc683476 100644
--- a/tests/rustdoc-gui/docblock-big-code-mobile.goml
+++ b/tests/rustdoc-gui/docblock-big-code-mobile.goml
@@ -1,7 +1,7 @@
 // If we have a long ``, we need to ensure that it'll be fully displayed on mobile, meaning
 // that it'll be on two lines.
 emulate: "iPhone 8" // it has the following size: (375, 667)
-goto: "file://" + |DOC_PATH| + "/test_docs/long_code_block/index.html"
+go-to: "file://" + |DOC_PATH| + "/test_docs/long_code_block/index.html"
 // We now check that the block is on two lines:
 show-text: true // We need to enable text draw to be able to have the "real" size
 // Little explanations for this test: if the text wasn't displayed on two lines, it would take
@@ -9,5 +9,5 @@ show-text: true // We need to enable text draw to be able to have the "real" siz
 assert-property: (".docblock p > code", {"offsetHeight": "44"})
 
 // Same check, but where the long code block is also a link
-goto: "file://" + |DOC_PATH| + "/test_docs/long_code_block_link/index.html"
+go-to: "file://" + |DOC_PATH| + "/test_docs/long_code_block_link/index.html"
 assert-property: (".docblock p > a > code", {"offsetHeight": "44"})
diff --git a/tests/rustdoc-gui/docblock-code-block-line-number.goml b/tests/rustdoc-gui/docblock-code-block-line-number.goml
index 69bcf5339..4c36394a3 100644
--- a/tests/rustdoc-gui/docblock-code-block-line-number.goml
+++ b/tests/rustdoc-gui/docblock-code-block-line-number.goml
@@ -1,5 +1,5 @@
 // Checks that the setting "line numbers" is working as expected.
-goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
+go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
 
 // Otherwise, we can't check text color
 show-text: true
@@ -13,7 +13,7 @@ define-function: (
     (theme, color),
     block {
         // We now set the setting to show the line numbers on code examples.
-        local-storage: {
+        set-local-storage: {
             "rustdoc-theme": |theme|,
             "rustdoc-use-system-theme": "false",
             "rustdoc-line-numbers": "true"
diff --git a/tests/rustdoc-gui/docblock-details.goml b/tests/rustdoc-gui/docblock-details.goml
index 9ae571efb..58ff17619 100644
--- a/tests/rustdoc-gui/docblock-details.goml
+++ b/tests/rustdoc-gui/docblock-details.goml
@@ -1,7 +1,7 @@
 // This ensures that the `
`/`` elements are displayed as expected. -goto: "file://" + |DOC_PATH| + "/test_docs/details/struct.Details.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/details/struct.Details.html" show-text: true -local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"} +set-local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"} reload: // We first check that the headers in the `.top-doc` doc block still have their diff --git a/tests/rustdoc-gui/docblock-table-overflow.goml b/tests/rustdoc-gui/docblock-table-overflow.goml index d8670089a..1ca919d1e 100644 --- a/tests/rustdoc-gui/docblock-table-overflow.goml +++ b/tests/rustdoc-gui/docblock-table-overflow.goml @@ -1,7 +1,7 @@ // This test ensures that the type declaration content overflow is handled inside the
 directly.
-goto: "file://" + |DOC_PATH| + "/lib2/long_table/struct.Foo.html"
+go-to: "file://" + |DOC_PATH| + "/lib2/long_table/struct.Foo.html"
 // We set a fixed size so there is no chance of "random" resize.
-size: (1100, 800)
+set-window-size: (1100, 800)
 // Logically, the ".docblock" and the "

" should have the same scroll width. compare-elements-property: (".top-doc .docblock", ".top-doc .docblock > p", ["scrollWidth"]) assert-property: (".top-doc .docblock", {"scrollWidth": "816"}) diff --git a/tests/rustdoc-gui/docblock-table.goml b/tests/rustdoc-gui/docblock-table.goml index 3dcb8abd4..011451ef4 100644 --- a/tests/rustdoc-gui/docblock-table.goml +++ b/tests/rustdoc-gui/docblock-table.goml @@ -1,5 +1,5 @@ // This test checks the appearance of the tables in the doc comments. -goto: "file://" + |DOC_PATH| + "/test_docs/doc_block_table/struct.DocBlockTable.html#method.func" +go-to: "file://" + |DOC_PATH| + "/test_docs/doc_block_table/struct.DocBlockTable.html#method.func" compare-elements-css: (".impl-items .docblock table th", ".top-doc .docblock table th", ["border"]) compare-elements-css: (".impl-items .docblock table td", ".top-doc .docblock table td", ["border"]) @@ -8,7 +8,7 @@ define-function: ( "check-colors", (theme, border_color, zebra_stripe_color), block { - local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|} + set-local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|} reload: assert-css: (".top-doc .docblock table tbody tr:nth-child(1)", { "background-color": "rgba(0, 0, 0, 0)", diff --git a/tests/rustdoc-gui/duplicate-macro-reexport.goml b/tests/rustdoc-gui/duplicate-macro-reexport.goml index 496203c12..7d01c88f3 100644 --- a/tests/rustdoc-gui/duplicate-macro-reexport.goml +++ b/tests/rustdoc-gui/duplicate-macro-reexport.goml @@ -1,5 +1,5 @@ // This test ensures that there is no macro duplicates in the sidebar. -goto: "file://" + |DOC_PATH| + "/test_docs/macro.a.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/macro.a.html" // Waiting for the elements in the sidebar to be rendered. wait-for: ".sidebar-elems .macro" // Check there is only one macro named "a" listed in the sidebar. diff --git a/tests/rustdoc-gui/enum-variants.goml b/tests/rustdoc-gui/enum-variants.goml index 8dfc49285..a1f60986a 100644 --- a/tests/rustdoc-gui/enum-variants.goml +++ b/tests/rustdoc-gui/enum-variants.goml @@ -1,5 +1,5 @@ // Verifies that there is non-zero margin on variants and their docblocks. -goto: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html" assert-css: (".variants > .variant", {"margin": "0px 0px 12px"}) assert-css: (".variants > .docblock", {"margin": "0px 0px 32px 24px"}) diff --git a/tests/rustdoc-gui/escape-key.goml b/tests/rustdoc-gui/escape-key.goml index 5d80d2496..3ea20fd11 100644 --- a/tests/rustdoc-gui/escape-key.goml +++ b/tests/rustdoc-gui/escape-key.goml @@ -1,6 +1,6 @@ // This test ensures that the "Escape" shortcut is handled correctly based on the // current content displayed. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // First, we check that the search results are hidden when the Escape key is pressed. write: (".search-input", "test") // To be SURE that the search will be run. diff --git a/tests/rustdoc-gui/extend-css.goml b/tests/rustdoc-gui/extend-css.goml new file mode 100644 index 000000000..fb34469df --- /dev/null +++ b/tests/rustdoc-gui/extend-css.goml @@ -0,0 +1,5 @@ +// Test to ensure that the `--extend-css` option is working as expected. +go-to: "file://" + |DOC_PATH| + "/extend_css/index.html" +show-text: true +// The text from the `.extend` element should be red. +assert-css: (".extend", {"color": "rgb(255, 0, 0)"}) diff --git a/tests/rustdoc-gui/font-weight.goml b/tests/rustdoc-gui/font-weight.goml index aad334d2b..6fad128da 100644 --- a/tests/rustdoc-gui/font-weight.goml +++ b/tests/rustdoc-gui/font-weight.goml @@ -1,5 +1,5 @@ // This test checks that the font weight is correctly applied. -goto: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html" assert-css: ("//*[@class='rust item-decl']//a[text()='Alias']", {"font-weight": "400"}) assert-css: ( "//*[@class='structfield small-section-header']//a[text()='Alias']", @@ -9,13 +9,13 @@ assert-css: ("#method\.a_method > .code-header", {"font-weight": "600"}) assert-css: ("#associatedtype\.X > .code-header", {"font-weight": "600"}) assert-css: ("#associatedconstant\.Y > .code-header", {"font-weight": "600"}) -goto: "file://" + |DOC_PATH| + "/test_docs/type.SomeType.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/type.SomeType.html" assert-css: (".top-doc .docblock p", {"font-weight": "400"}, ALL) -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" assert-css: (".impl-items .method > .code-header", {"font-weight": "600"}, ALL) -goto: "file://" + |DOC_PATH| + "/lib2/trait.Trait.html" +go-to: "file://" + |DOC_PATH| + "/lib2/trait.Trait.html" // This is a complex selector, so here's how it works: // diff --git a/tests/rustdoc-gui/go-to-collapsed-elem.goml b/tests/rustdoc-gui/go-to-collapsed-elem.goml new file mode 100644 index 000000000..80e979177 --- /dev/null +++ b/tests/rustdoc-gui/go-to-collapsed-elem.goml @@ -0,0 +1,40 @@ +// This test ensures that when clicking on a link which leads to an item inside a collapsed element, +// the collapsed element will be expanded. +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" +// We check that the implementors block is expanded. +assert-property: ("#implementations-list .implementors-toggle", {"open": "true"}) +// We now collapse the implementors block. +set-property: ("#implementations-list .implementors-toggle", {"open": "false"}) +// And now we click on the link to the method to ensure it'll expand the implementors block. +click: "//*[@class='sidebar']//a[@href='#method.must_use']" +assert-property: ("#implementations-list .implementors-toggle", {"open": "true"}) + +define-function: ("collapsed-from-search", (), block { + // Now we do the same through search result. + // First we reload the page without the anchor in the URL. + go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" + // Then we collapse the section again... + set-property: ("#implementations-list .implementors-toggle", {"open": "false"}) + // Then we run the search. + write: (".search-input", "foo::must_use") + wait-for: "//*[@id='search']//a[@href='../test_docs/struct.Foo.html#method.must_use']" + click: "//*[@id='search']//a[@href='../test_docs/struct.Foo.html#method.must_use']" + assert-property: ("#implementations-list .implementors-toggle", {"open": "true"}) +}) + +call-function: ("collapsed-from-search", {}) + +// Now running the same check but with mobile. +set-window-size: (600, 600) +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" +// We check that the implementors block is expanded. +assert-property: ("#implementations-list .implementors-toggle", {"open": "true"}) +// We now collapse the implementors block. +set-property: ("#implementations-list .implementors-toggle", {"open": "false"}) +// First we expand the mobile menu. +click: ".sidebar-menu-toggle" +// Then we click on the link to the method to ensure it'll expand the implementors block. +click: "//*[@class='sidebar shown']//a[@href='#method.must_use']" +assert-property: ("#implementations-list .implementors-toggle", {"open": "true"}) + +call-function: ("collapsed-from-search", {}) diff --git a/tests/rustdoc-gui/hash-item-expansion.goml b/tests/rustdoc-gui/hash-item-expansion.goml index 3cf94f624..a7a5c3cb4 100644 --- a/tests/rustdoc-gui/hash-item-expansion.goml +++ b/tests/rustdoc-gui/hash-item-expansion.goml @@ -1,5 +1,5 @@ // This test ensures that the element corresponding to the hash is displayed. -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.borrow" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.borrow" // In the blanket implementations list, "Borrow" is the second one, hence the ":nth(2)". assert-attribute: ("#blanket-implementations-list > details:nth-child(2)", {"open": ""}) // We first check that the impl block is open by default. diff --git a/tests/rustdoc-gui/headers-color.goml b/tests/rustdoc-gui/headers-color.goml index 92cf050a5..7d83833a8 100644 --- a/tests/rustdoc-gui/headers-color.goml +++ b/tests/rustdoc-gui/headers-color.goml @@ -4,10 +4,10 @@ define-function: ( "check-colors", (theme, color, code_header_color, focus_background_color, headings_color), block { - goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" + go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" // This is needed so that the text color is computed. show-text: true - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: assert-css: ( ".impl", @@ -19,20 +19,20 @@ define-function: ( {"color": |code_header_color|, "background-color": "rgba(0, 0, 0, 0)"}, ALL, ) - goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo" + go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo" assert-css: ( "#impl-Foo", {"color": |color|, "background-color": |focus_background_color|}, ) - goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use" + go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use" assert-css: ( "#method\.must_use", {"color": |color|, "background-color": |focus_background_color|}, ALL, ) - goto: "file://" + |DOC_PATH| + "/test_docs/index.html" + go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" assert-css: (".small-section-header a", {"color": |color|}, ALL) - goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" + go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" // We select headings (h2, h3, h...). assert-css: (".docblock > :not(p) > a", {"color": |headings_color|}, ALL) }, diff --git a/tests/rustdoc-gui/headings.goml b/tests/rustdoc-gui/headings.goml index e4ba5f124..089e2203a 100644 --- a/tests/rustdoc-gui/headings.goml +++ b/tests/rustdoc-gui/headings.goml @@ -11,7 +11,7 @@ // 18px 1.125em // 16px 1rem // 14px 0.875rem -goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" assert-css: (".main-heading h1", {"font-size": "24px"}) @@ -50,7 +50,7 @@ assert-css: ("h6#sub-heading-for-struct-impl-item-doc", {"font-size": "14px"}) assert-css: ("h6#sub-heading-for-struct-impl-item-doc", {"border-bottom-width": "0px"}) assert-css: ("h6#sub-sub-heading-for-struct-impl-item-doc", {"font-size": "14px"}) -goto: "file://" + |DOC_PATH| + "/test_docs/enum.HeavilyDocumentedEnum.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/enum.HeavilyDocumentedEnum.html" assert-css: (".main-heading h1", {"font-size": "24px"}) @@ -109,7 +109,7 @@ assert-css: ("h6#sub-sub-heading-for-enum-impl-item-doc", {"border-bottom-width" assert-text: ("//ul[@class='block mod']/preceding-sibling::h3", "Modules") assert-css: ("//ul[@class='block mod']/preceding-sibling::h3", {"border-bottom-width": "0px"}, ALL) -goto: "file://" + |DOC_PATH| + "/test_docs/union.HeavilyDocumentedUnion.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/union.HeavilyDocumentedUnion.html" assert-css: (".main-heading h1", {"font-size": "24px"}) @@ -141,7 +141,7 @@ assert-css: ("h5#title-for-union-impl-item-doc", {"border-bottom-width": "0px"}) assert-css: ("h6#sub-heading-for-union-impl-item-doc", {"font-size": "14px"}) assert-css: ("h6#sub-heading-for-union-impl-item-doc", {"border-bottom-width": "0px"}) -goto: "file://" + |DOC_PATH| + "/test_docs/macro.heavily_documented_macro.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/macro.heavily_documented_macro.html" assert-css: (".main-heading h1", {"font-size": "24px"}) @@ -152,13 +152,13 @@ assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"}) // Needed to check colors show-text: true -goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" define-function: ( "check-colors", (theme, heading_color, small_heading_color, heading_border_color), block { - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: assert-css: ( ".top-doc .docblock h2", @@ -222,13 +222,13 @@ define-function: ( "check-since-color", (theme), block { - local-storage: {"rustdoc-theme": |theme|} + set-local-storage: {"rustdoc-theme": |theme|} reload: assert-css: (".since", {"color": "rgb(128, 128, 128)"}, ALL) }, ) -goto: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html" call-function: ("check-since-color", ("ayu")) call-function: ("check-since-color", ("dark")) call-function: ("check-since-color", ("light")) diff --git a/tests/rustdoc-gui/help-page.goml b/tests/rustdoc-gui/help-page.goml index 6e2321a69..1a1c1b28f 100644 --- a/tests/rustdoc-gui/help-page.goml +++ b/tests/rustdoc-gui/help-page.goml @@ -1,6 +1,6 @@ // This test ensures that opening the help page in its own tab works. -goto: "file://" + |DOC_PATH| + "/help.html" -size: (1000, 1000) // Try desktop size first. +go-to: "file://" + |DOC_PATH| + "/help.html" +set-window-size: (1000, 1000) // Try desktop size first. wait-for: "#help" assert-css: ("#help", {"display": "block"}) assert-css: ("#help dd", {"font-size": "16px"}) @@ -8,7 +8,7 @@ click: "#help-button > a" assert-css: ("#help", {"display": "block"}) compare-elements-property: (".sub", "#help", ["offsetWidth"]) compare-elements-position: (".sub", "#help", ("x")) -size: (500, 1000) // Try mobile next. +set-window-size: (500, 1000) // Try mobile next. assert-css: ("#help", {"display": "block"}) compare-elements-property: (".sub", "#help", ["offsetWidth"]) compare-elements-position: (".sub", "#help", ("x")) @@ -20,7 +20,7 @@ define-function: ( (theme, color, background, box_shadow), block { // Setting the theme. - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} // We reload the page so the local storage settings are being used. reload: assert-css: ("#help kbd", { @@ -51,8 +51,8 @@ call-function: ("check-colors", { }) // This test ensures that opening the help popover without switching pages works. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" -size: (1000, 1000) // Only supported on desktop. +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +set-window-size: (1000, 1000) // Only supported on desktop. assert-false: "#help" click: "#help-button > a" assert-css: ("#help", {"display": "block"}) @@ -63,8 +63,8 @@ compare-elements-property-false: (".sub", "#help", ["offsetWidth"]) compare-elements-position-false: (".sub", "#help", ("x")) // This test ensures that the "the rustdoc book" anchor link within the help popover works. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" -size: (1000, 1000) // Popover only appears when the screen width is >700px. +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +set-window-size: (1000, 1000) // Popover only appears when the screen width is >700px. assert-false: "#help" click: "#help-button > a" click: ".popover a[href='https://doc.rust-lang.org/rustdoc/']" diff --git a/tests/rustdoc-gui/highlight-colors.goml b/tests/rustdoc-gui/highlight-colors.goml index b182150a5..4f5e1c110 100644 --- a/tests/rustdoc-gui/highlight-colors.goml +++ b/tests/rustdoc-gui/highlight-colors.goml @@ -1,5 +1,5 @@ // This test checks the highlight colors in the source code pages. -goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" +go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" show-text: true define-function: ( @@ -22,7 +22,7 @@ define-function: ( doc_comment, ), block { - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: assert-css: ("pre.rust .kw", {"color": |kw|}, ALL) assert-css: ("pre.rust .kw-2", {"color": |kw2|}, ALL) diff --git a/tests/rustdoc-gui/huge-collection-of-constants.goml b/tests/rustdoc-gui/huge-collection-of-constants.goml index 636382a91..387aca6f6 100644 --- a/tests/rustdoc-gui/huge-collection-of-constants.goml +++ b/tests/rustdoc-gui/huge-collection-of-constants.goml @@ -1,6 +1,6 @@ // Make sure that the last two entries are more than 12 pixels apart and not stacked on each other. -goto: "file://" + |DOC_PATH| + "/test_docs/huge_amount_of_consts/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/huge_amount_of_consts/index.html" compare-elements-position-near-false: ( "//ul[@class='item-table']/li[last()-1]", diff --git a/tests/rustdoc-gui/huge-logo.goml b/tests/rustdoc-gui/huge-logo.goml index 01f06771c..6d3eb6606 100644 --- a/tests/rustdoc-gui/huge-logo.goml +++ b/tests/rustdoc-gui/huge-logo.goml @@ -1,21 +1,23 @@ // huge_logo crate has a custom 712x860 logo // test to ensure the maximum size in the layout works correctly -goto: "file://" + |DOC_PATH| + "/huge_logo/index.html" +go-to: "file://" + |DOC_PATH| + "/huge_logo/index.html" -size: (1280, 1024) +set-window-size: (1280, 1024) // offsetWidth = width of sidebar assert-property: (".sidebar .logo-container", {"offsetWidth": "200", "offsetHeight": 100}) assert-property: (".sidebar .logo-container img", {"offsetWidth": "100", "offsetHeight": 100}) -size: (400, 600) +set-window-size: (400, 600) // offset = size + margin assert-property: (".mobile-topbar .logo-container", {"offsetWidth": "55", "offsetHeight": 45}) assert-property: (".mobile-topbar .logo-container img", {"offsetWidth": "35", "offsetHeight": 35}) -goto: "file://" + |DOC_PATH| + "/src/huge_logo/lib.rs.html" +go-to: "file://" + |DOC_PATH| + "/src/huge_logo/lib.rs.html" -size: (1280, 1024) +set-window-size: (1280, 1024) assert-property: (".sub-logo-container", {"offsetWidth": "60", "offsetHeight": 60}) -size: (400, 600) -assert-property: (".sub-logo-container", {"offsetWidth": "35", "offsetHeight": 35}) +set-window-size: (400, 600) +// 43 because 35px + 8px of margin +assert-css: (".sub-logo-container > img", {"margin-bottom": "8px"}) +assert-property: (".sub-logo-container", {"offsetWidth": "35", "offsetHeight": 43}) diff --git a/tests/rustdoc-gui/impl-default-expansion.goml b/tests/rustdoc-gui/impl-default-expansion.goml index c3f9240cc..45bd7beb6 100644 --- a/tests/rustdoc-gui/impl-default-expansion.goml +++ b/tests/rustdoc-gui/impl-default-expansion.goml @@ -1,3 +1,3 @@ // This test ensures that the impl blocks are open by default. -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" assert-attribute: ("#implementations-list details.implementors-toggle", {"open": ""}) diff --git a/tests/rustdoc-gui/impl-doc.goml b/tests/rustdoc-gui/impl-doc.goml index 6caffb9c3..4ec46de40 100644 --- a/tests/rustdoc-gui/impl-doc.goml +++ b/tests/rustdoc-gui/impl-doc.goml @@ -1,5 +1,5 @@ // A docblock on an impl must have a margin to separate it from the contents. -goto: "file://" + |DOC_PATH| + "/test_docs/struct.TypeWithImplDoc.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.TypeWithImplDoc.html" // The text is about 24px tall, so if there's a margin, then their position will be >24px apart compare-elements-position-near-false: ( diff --git a/tests/rustdoc-gui/implementors.goml b/tests/rustdoc-gui/implementors.goml index 997c0ed8f..b39b95c1a 100644 --- a/tests/rustdoc-gui/implementors.goml +++ b/tests/rustdoc-gui/implementors.goml @@ -1,6 +1,6 @@ // The goal of this test is to check that the external trait implementors, generated with JS, // have the same display than the "local" ones. -goto: "file://" + |DOC_PATH| + "/implementors/trait.Whatever.html" +go-to: "file://" + |DOC_PATH| + "/implementors/trait.Whatever.html" assert: "#implementors-list" // There are supposed to be two implementors listed. assert-count: ("#implementors-list .impl", 2) @@ -15,7 +15,7 @@ assert-attribute: ("#implementors-list .impl:nth-child(2)", {"id": "impl-Whateve assert-attribute: ("#implementors-list .impl:nth-child(2) > a.anchor", {"href": "#impl-Whatever-1"}) assert: "#implementors-list .impl:nth-child(2) > .code-header" -goto: "file://" + |DOC_PATH| + "/test_docs/struct.HasEmptyTraits.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HasEmptyTraits.html" compare-elements-position-near-false: ( "#impl-EmptyTrait1-for-HasEmptyTraits", "#impl-EmptyTrait2-for-HasEmptyTraits", @@ -29,13 +29,13 @@ compare-elements-position-near: ( // Now check that re-exports work correctly. // There should be exactly one impl shown on both of these pages. -goto: "file://" + |DOC_PATH| + "/lib2/trait.TraitToReexport.html" +go-to: "file://" + |DOC_PATH| + "/lib2/trait.TraitToReexport.html" assert-count: ("#implementors-list .impl", 1) -goto: "file://" + |DOC_PATH| + "/implementors/trait.TraitToReexport.html" +go-to: "file://" + |DOC_PATH| + "/implementors/trait.TraitToReexport.html" assert-count: ("#implementors-list .impl", 1) // Now check that the link is properly rewritten for a crate called `http`. // An older version of rustdoc had a buggy check for absolute links. -goto: "file://" + |DOC_PATH| + "/http/trait.HttpTrait.html" +go-to: "file://" + |DOC_PATH| + "/http/trait.HttpTrait.html" assert-count: ("#implementors-list .impl", 1) assert-attribute: ("#implementors-list .impl a.trait", {"href": "../http/trait.HttpTrait.html"}) diff --git a/tests/rustdoc-gui/item-decl-colors.goml b/tests/rustdoc-gui/item-decl-colors.goml index c58e3eb7c..5732dd8ee 100644 --- a/tests/rustdoc-gui/item-decl-colors.goml +++ b/tests/rustdoc-gui/item-decl-colors.goml @@ -18,9 +18,9 @@ define-function: ( assoc_type_color, ), block { - goto: "file://" + |DOC_PATH| + "/test_docs/struct.WithGenerics.html" + go-to: "file://" + |DOC_PATH| + "/test_docs/struct.WithGenerics.html" show-text: true - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: assert-css: (".item-decl .code-attribute", {"color": |attr_color|}, ALL) assert-css: (".item-decl .trait", {"color": |trait_color|}, ALL) @@ -29,7 +29,7 @@ define-function: ( assert-css: (".item-decl .enum", {"color": |enum_color|}, ALL) assert-css: (".item-decl .primitive", {"color": |primitive_color|}, ALL) - goto: "file://" + |DOC_PATH| + "/test_docs/trait.TraitWithoutGenerics.html" + go-to: "file://" + |DOC_PATH| + "/test_docs/trait.TraitWithoutGenerics.html" assert-css: (".item-decl .constant", {"color": |constant_color|}, ALL) assert-css: (".item-decl .fn", {"color": |fn_color|}, ALL) assert-css: (".item-decl .associatedtype", {"color": |assoc_type_color|}, ALL) diff --git a/tests/rustdoc-gui/item-info-alignment.goml b/tests/rustdoc-gui/item-info-alignment.goml index 94b52f005..6fc365d1f 100644 --- a/tests/rustdoc-gui/item-info-alignment.goml +++ b/tests/rustdoc-gui/item-info-alignment.goml @@ -1,10 +1,10 @@ // This test ensures that the "item-info" looks about the same // whether or not it's inside a toggle. -goto: "file://" + |DOC_PATH| + "/lib2/struct.ItemInfoAlignmentTest.html" +go-to: "file://" + |DOC_PATH| + "/lib2/struct.ItemInfoAlignmentTest.html" // First, we try it in "desktop" mode. -size: (1200, 870) +set-window-size: (1200, 870) compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ("x")) // Next, we try it in "mobile" mode (max-width: 700px). -size: (650, 650) +set-window-size: (650, 650) compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ("x")) diff --git a/tests/rustdoc-gui/item-info-overflow.goml b/tests/rustdoc-gui/item-info-overflow.goml index 8ea14621c..23c53c037 100644 --- a/tests/rustdoc-gui/item-info-overflow.goml +++ b/tests/rustdoc-gui/item-info-overflow.goml @@ -1,7 +1,7 @@ // This test ensures that the "item-info" elements don't overflow. -goto: "file://" + |DOC_PATH| + "/lib2/struct.LongItemInfo.html" +go-to: "file://" + |DOC_PATH| + "/lib2/struct.LongItemInfo.html" // We set a fixed size so there is no chance of "random" resize. -size: (1200, 870) +set-window-size: (1200, 870) // Logically, the "item-decl" and the "item-info" should have the same scroll width. compare-elements-property: (".item-decl", ".item-info", ["scrollWidth"]) assert-property: (".item-info", {"scrollWidth": "940"}) @@ -13,7 +13,7 @@ assert-text: ( ) // Checking the "item-info" on an impl block as well: -goto: "file://" + |DOC_PATH| + "/lib2/struct.LongItemInfo2.html" +go-to: "file://" + |DOC_PATH| + "/lib2/struct.LongItemInfo2.html" compare-elements-property: ( "#impl-SimpleTrait-for-LongItemInfo2 .item-info", "#impl-SimpleTrait-for-LongItemInfo2 + .docblock", diff --git a/tests/rustdoc-gui/item-info.goml b/tests/rustdoc-gui/item-info.goml index 6780dfca6..60fd7c4e1 100644 --- a/tests/rustdoc-gui/item-info.goml +++ b/tests/rustdoc-gui/item-info.goml @@ -1,15 +1,15 @@ // This test ensures a few things for item info elements. -goto: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html" // Ensuring that the item information don't take 100% of the width if unnecessary. // We set a fixed size so there is no chance of "random" resize. -size: (1100, 800) +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-position: (".item-info .stab", {"x": 245}) // Now we ensure that they're not rendered on the same line. -goto: "file://" + |DOC_PATH| + "/lib2/trait.Trait.html" +go-to: "file://" + |DOC_PATH| + "/lib2/trait.Trait.html" // We first ensure that there are two item info on the trait. assert-count: ("#main-content > .item-info .stab", 2) // They should not have the same `y` position! diff --git a/tests/rustdoc-gui/item-summary-table.goml b/tests/rustdoc-gui/item-summary-table.goml index 7a219bd54..893060303 100644 --- a/tests/rustdoc-gui/item-summary-table.goml +++ b/tests/rustdoc-gui/item-summary-table.goml @@ -1,5 +1,5 @@ // This test ensures that elements aren't display in items summary. -goto: "file://" + |DOC_PATH| + "/lib2/summary_table/index.html" +go-to: "file://" + |DOC_PATH| + "/lib2/summary_table/index.html" // We check that we picked the right item first. assert-text: (".item-table .item-name", "Foo") // Then we check that its summary is empty. diff --git a/tests/rustdoc-gui/javascript-disabled.goml b/tests/rustdoc-gui/javascript-disabled.goml index edf179d0d..a0872d553 100644 --- a/tests/rustdoc-gui/javascript-disabled.goml +++ b/tests/rustdoc-gui/javascript-disabled.goml @@ -2,5 +2,5 @@ // can't be used without JS. javascript: false -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" assert-css: (".sub", {"display": "none"}) diff --git a/tests/rustdoc-gui/jump-to-def-background.goml b/tests/rustdoc-gui/jump-to-def-background.goml index 8ee3ccf4a..3a7d48284 100644 --- a/tests/rustdoc-gui/jump-to-def-background.goml +++ b/tests/rustdoc-gui/jump-to-def-background.goml @@ -1,12 +1,12 @@ // We check the background color on the jump to definition links in the source code page. -goto: "file://" + |DOC_PATH| + "/src/link_to_definition/lib.rs.html" +go-to: "file://" + |DOC_PATH| + "/src/link_to_definition/lib.rs.html" define-function: ( "check-background-color", (theme, background_color), block { // Set the theme. - local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false" } + set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false" } // We reload the page so the local storage settings are being used. reload: assert-css: ( diff --git a/tests/rustdoc-gui/label-next-to-symbol.goml b/tests/rustdoc-gui/label-next-to-symbol.goml index 412e475dc..6c6380256 100644 --- a/tests/rustdoc-gui/label-next-to-symbol.goml +++ b/tests/rustdoc-gui/label-next-to-symbol.goml @@ -1,9 +1,9 @@ // These tests verify that labels like "UNIX" and "Deprecated" stay on the same line as their symbol. // It also verifies the staggered layout on mobile. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // Desktop view -size: (1080, 600) +set-window-size: (1080, 600) assert: (".stab.deprecated") assert: (".stab.portability") @@ -39,7 +39,7 @@ compare-elements-position: ( // Mobile view -size: (600, 600) +set-window-size: (600, 600) // staggered layout with 2em spacing assert-css: (".desc.docblock-short", { "padding-left": "32px" }) compare-elements-position-near: ( diff --git a/tests/rustdoc-gui/links-color.goml b/tests/rustdoc-gui/links-color.goml index 14f7d9935..2ee4bce10 100644 --- a/tests/rustdoc-gui/links-color.goml +++ b/tests/rustdoc-gui/links-color.goml @@ -1,5 +1,5 @@ // This test checks links colors. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // This is needed so that the text color is computed. show-text: true @@ -9,7 +9,7 @@ define-function: ( (theme, mod, macro, struct, enum, trait, fn, type, union, keyword, sidebar, sidebar_current, sidebar_current_background), block { - local-storage: { + set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", } diff --git a/tests/rustdoc-gui/list_code_block.goml b/tests/rustdoc-gui/list_code_block.goml index 4c477d70c..25ddea319 100644 --- a/tests/rustdoc-gui/list_code_block.goml +++ b/tests/rustdoc-gui/list_code_block.goml @@ -1,4 +1,4 @@ // This test checks that code blocks in list are supported. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" -goto: "./fn.check_list_code_block.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "./fn.check_list_code_block.html" assert: ("pre.rust.item-decl") diff --git a/tests/rustdoc-gui/method-margins.goml b/tests/rustdoc-gui/method-margins.goml index 720268a9e..ac3caeb23 100644 --- a/tests/rustdoc-gui/method-margins.goml +++ b/tests/rustdoc-gui/method-margins.goml @@ -1,5 +1,5 @@ // This test ensures that the margins on methods are coherent inside an impl block. -goto: "file://" + |DOC_PATH| + "/test_docs/trait_members/struct.HasTrait.html#impl-TraitMembers-for-HasTrait" +go-to: "file://" + |DOC_PATH| + "/test_docs/trait_members/struct.HasTrait.html#impl-TraitMembers-for-HasTrait" assert-count: ("#trait-implementations-list > .toggle", 1) diff --git a/tests/rustdoc-gui/mobile.goml b/tests/rustdoc-gui/mobile.goml index 8c8516ebf..e576385cd 100644 --- a/tests/rustdoc-gui/mobile.goml +++ b/tests/rustdoc-gui/mobile.goml @@ -1,8 +1,8 @@ // Test various properties of the mobile UI -goto: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html" -size: (400, 600) +go-to: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html" +set-window-size: (400, 600) -font-size: 18 +set-font-size: 18 wait-for: 100 // wait a bit for the resize and the font-size change to be fully taken into account. // The out-of-band info (source, stable version, collapse) should be below the @@ -18,14 +18,14 @@ assert-property: (".mobile-topbar h2", {"offsetHeight": 33}) // is therefore not part of the DOM. assert-css: (".content .out-of-band .since::before", { "content": "\"Since \"" }) -size: (1000, 1000) +set-window-size: (1000, 1000) wait-for: 100 // wait a bit for the resize to be fully taken into account. assert-css-false: (".content .out-of-band .since::before", { "content": "\"Since \"" }) // On the settings page, the theme buttons should not line-wrap. Instead, they should // all be placed as a group on a line below the setting name "Theme." -goto: "file://" + |DOC_PATH| + "/settings.html" -size: (400, 600) +go-to: "file://" + |DOC_PATH| + "/settings.html" +set-window-size: (400, 600) // Ignored for now https://github.com/rust-lang/rust/issues/93784. // compare-elements-position-near-false: ( // "#preferred-light-theme .setting-radio-name", diff --git a/tests/rustdoc-gui/module-items-font.goml b/tests/rustdoc-gui/module-items-font.goml index 23823f8b6..54c8131c3 100644 --- a/tests/rustdoc-gui/module-items-font.goml +++ b/tests/rustdoc-gui/module-items-font.goml @@ -1,5 +1,5 @@ // This test checks that the correct font is used on module items (in index.html pages). -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" assert-css: ( ".item-table .item-name > a", {"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'}, diff --git a/tests/rustdoc-gui/no-docblock.goml b/tests/rustdoc-gui/no-docblock.goml index 17a955064..1b4638ef0 100644 --- a/tests/rustdoc-gui/no-docblock.goml +++ b/tests/rustdoc-gui/no-docblock.goml @@ -4,10 +4,10 @@ // doesn't exist. fail-on-request-error: false -goto: "file://" + |DOC_PATH| + "/test_docs/trait.TraitWithNoDocblocks.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/trait.TraitWithNoDocblocks.html" // Check that the two methods are more than 24px apart. compare-elements-position-near-false: ("//*[@id='tymethod.first_fn']", "//*[@id='tymethod.second_fn']", {"y": 24}) -goto: "file://" + |DOC_PATH| + "/test_docs/struct.TypeWithNoDocblocks.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.TypeWithNoDocblocks.html" // Check that the two methods are more than 24px apart. compare-elements-position-near-false: ("//*[@id='method.first_fn']", "//*[@id='method.second_fn']", {"y": 24}) diff --git a/tests/rustdoc-gui/notable-trait.goml b/tests/rustdoc-gui/notable-trait.goml index 207289151..f65da5774 100644 --- a/tests/rustdoc-gui/notable-trait.goml +++ b/tests/rustdoc-gui/notable-trait.goml @@ -1,8 +1,8 @@ // This test checks the position of the `i` for the notable traits. -goto: "file://" + |DOC_PATH| + "/test_docs/struct.NotableStructWithLongName.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.NotableStructWithLongName.html" show-text: true // We start with a wide screen. -size: (1100, 600) +set-window-size: (1100, 600) // Checking they have the same y position. compare-elements-position: ( "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']", @@ -44,7 +44,7 @@ move-cursor-to: "//h1" assert-count: ("//*[@class='tooltip popover']", 0) // Now only the `i` should be on the next line. -size: (1055, 600) +set-window-size: (1055, 600) compare-elements-position-false: ( "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']", "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']", @@ -52,7 +52,7 @@ compare-elements-position-false: ( ) // Now both the `i` and the struct name should be on the next line. -size: (980, 600) +set-window-size: (980, 600) // Checking they have the same y position. compare-elements-position: ( "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']", @@ -76,7 +76,7 @@ assert-position: ( ) // Checking on mobile now. -size: (650, 600) +set-window-size: (650, 600) // Checking they have the same y position. compare-elements-position: ( "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']", @@ -124,12 +124,12 @@ define-function: ( "check-colors", (theme, header_color, content_color, type_color, trait_color), block { - goto: "file://" + |DOC_PATH| + "/test_docs/struct.NotableStructWithLongName.html" + go-to: "file://" + |DOC_PATH| + "/test_docs/struct.NotableStructWithLongName.html" // This is needed to ensure that the text color is computed. show-text: true // Setting the theme. - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} // We reload the page so the local storage settings are being used. reload: @@ -253,7 +253,7 @@ press-key: "Escape" assert-window-property-false: {"scrollY": |scroll|} // Opening the mobile sidebar should close the popover. -size: (650, 600) +set-window-size: (650, 600) click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']" assert-count: ("//*[@class='tooltip popover']", 1) click: ".sidebar-menu-toggle" @@ -266,7 +266,7 @@ assert-count: ("//*[@class='tooltip popover']", 1) assert-false: "//*[@class='sidebar shown']" // Also check the focus handling for the help button. -size: (1100, 600) +set-window-size: (1100, 600) reload: assert-count: ("//*[@class='tooltip popover']", 0) click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']" diff --git a/tests/rustdoc-gui/overflow-tooltip-information.goml b/tests/rustdoc-gui/overflow-tooltip-information.goml index 09ad6cdd7..ab7ffc24c 100644 --- a/tests/rustdoc-gui/overflow-tooltip-information.goml +++ b/tests/rustdoc-gui/overflow-tooltip-information.goml @@ -1,7 +1,7 @@ // The goal of this test is to ensure that the tooltip `.information` class doesn't // have overflow and max-width CSS rules set because they create a bug in firefox on // mac. For more information: https://github.com/rust-lang/rust/issues/89185 -goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" assert-css: (".docblock > .example-wrap .tooltip", { "overflow-x": "visible", "max-width": "none" diff --git a/tests/rustdoc-gui/pocket-menu.goml b/tests/rustdoc-gui/pocket-menu.goml index c3649dc7b..4bdf31ecb 100644 --- a/tests/rustdoc-gui/pocket-menu.goml +++ b/tests/rustdoc-gui/pocket-menu.goml @@ -1,5 +1,5 @@ // This test ensures that the "pocket menus" are working as expected. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // First we check that the help menu doesn't exist yet. assert-false: "#help-button .popover" // Then we display the help menu. @@ -32,7 +32,7 @@ assert-css: ("#settings-menu .popover", {"display": "none"}) // We check the borders color now: // Ayu theme -local-storage: { +set-local-storage: { "rustdoc-theme": "ayu", "rustdoc-use-system-theme": "false", } @@ -47,7 +47,7 @@ compare-elements-css: ("#help-button .popover", "#help-button .top", ["border-co compare-elements-css: ("#help-button .popover", "#help-button .bottom", ["border-color"]) // Dark theme -local-storage: { +set-local-storage: { "rustdoc-theme": "dark", "rustdoc-use-system-theme": "false", } @@ -62,7 +62,7 @@ compare-elements-css: ("#help-button .popover", "#help-button .top", ["border-co compare-elements-css: ("#help-button .popover", "#help-button .bottom", ["border-color"]) // Light theme -local-storage: { +set-local-storage: { "rustdoc-theme": "light", "rustdoc-use-system-theme": "false", } @@ -77,7 +77,7 @@ compare-elements-css: ("#help-button .popover", "#help-button .top", ["border-co compare-elements-css: ("#help-button .popover", "#help-button .bottom", ["border-color"]) // Opening the mobile sidebar should close the settings popover. -size: (650, 600) +set-window-size: (650, 600) click: "#settings-menu a" assert-css: ("#settings-menu .popover", {"display": "block"}) click: ".sidebar-menu-toggle" diff --git a/tests/rustdoc-gui/run-on-hover.goml b/tests/rustdoc-gui/run-on-hover.goml index 8dcb62c10..b5fc49eac 100644 --- a/tests/rustdoc-gui/run-on-hover.goml +++ b/tests/rustdoc-gui/run-on-hover.goml @@ -2,14 +2,14 @@ // Playground. That button is hidden until the user hovers over the code block. // This test checks that it is hidden, and that it shows on hover. It also // checks for its color. -goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" show-text: true define-function: ( "check-run-button", (theme, color, background, hover_color, hover_background), block { - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: assert-css: (".test-arrow", {"visibility": "hidden"}) move-cursor-to: ".example-wrap" diff --git a/tests/rustdoc-gui/rust-logo.goml b/tests/rustdoc-gui/rust-logo.goml index 2d15e8b96..640ed152b 100644 --- a/tests/rustdoc-gui/rust-logo.goml +++ b/tests/rustdoc-gui/rust-logo.goml @@ -1,26 +1,26 @@ // This test ensures that the correct style is applied to the rust logo in the sidebar. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" define-function: ( "check-logo", (theme, filter), block { // Going to the doc page. - goto: "file://" + |DOC_PATH| + "/test_docs/index.html" + go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // Changing theme. - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: assert-css: (".rust-logo", {"filter": |filter|}) // Going to the source code page. - goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" + go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" // Changing theme (since it's local files, the local storage works by folder). - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: assert-css: (".rust-logo", {"filter": |filter|}) // Now we check that the non-rust logos don't have a CSS filter set. - goto: "file://" + |DOC_PATH| + "/huge_logo/index.html" + go-to: "file://" + |DOC_PATH| + "/huge_logo/index.html" // Changing theme on the new page (again...). - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: // Check there is no rust logo assert-false: ".rust-logo" diff --git a/tests/rustdoc-gui/scrape-examples-button-focus.goml b/tests/rustdoc-gui/scrape-examples-button-focus.goml index 1b5c3a0d2..77061ea2a 100644 --- a/tests/rustdoc-gui/scrape-examples-button-focus.goml +++ b/tests/rustdoc-gui/scrape-examples-button-focus.goml @@ -1,6 +1,6 @@ // This test ensures that the scraped examples buttons are working as expecting // when 'Enter' key is pressed when they're focused. -goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html" +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") @@ -8,24 +8,24 @@ focus: ".scraped-example-list > .scraped-example .next" press-key: "Enter" assert-property-false: (".scraped-example-list > .scraped-example pre", { "scrollTop": |initialScrollTop| -}) +}, NEAR) focus: ".scraped-example-list > .scraped-example .prev" press-key: "Enter" assert-property: (".scraped-example-list > .scraped-example pre", { "scrollTop": |initialScrollTop| -}) +}, NEAR) // The expand button increases the scrollHeight of the minimized code viewport store-property: (smallOffsetHeight, ".scraped-example-list > .scraped-example pre", "offsetHeight") assert-property-false: (".scraped-example-list > .scraped-example pre", { "scrollHeight": |smallOffsetHeight| -}) +}, NEAR) focus: ".scraped-example-list > .scraped-example .expand" 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") 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 67c58826e..8ddb06fcc 100644 --- a/tests/rustdoc-gui/scrape-examples-color.goml +++ b/tests/rustdoc-gui/scrape-examples-color.goml @@ -1,5 +1,5 @@ // Check that scrape example code blocks have the expected colors. -goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" +go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" show-text: true define-function: ( @@ -7,7 +7,7 @@ define-function: ( (theme, highlight, highlight_focus, help_border, help_color, help_hover_border, help_hover_color), block { - local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", } + set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", } reload: wait-for: ".more-examples-toggle" assert-css: (".scraped-example .example-wrap .rust span.highlight:not(.focus)", { @@ -60,13 +60,13 @@ call-function: ("check-colors", { }) // Now testing the top and bottom background in case there is only one scraped examples. -goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html" +go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html" define-function: ( "check-background", (theme, background_color_start, background_color_end), block { - local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", } + set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", } reload: assert-css: (".scraped-example:not(.expanded) .code-wrapper::before", { "background-image": "linear-gradient(" + |background_color_start| + ", " + diff --git a/tests/rustdoc-gui/scrape-examples-fonts.goml b/tests/rustdoc-gui/scrape-examples-fonts.goml index 142f337cb..4c325bace 100644 --- a/tests/rustdoc-gui/scrape-examples-fonts.goml +++ b/tests/rustdoc-gui/scrape-examples-fonts.goml @@ -1,5 +1,5 @@ // This test ensures that the correct font is used in scraped examples. -goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" +go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" store-value: (font, '"Fira Sans", Arial, NanumBarunGothic, sans-serif') diff --git a/tests/rustdoc-gui/scrape-examples-layout.goml b/tests/rustdoc-gui/scrape-examples-layout.goml index dad727c77..160056d6d 100644 --- a/tests/rustdoc-gui/scrape-examples-layout.goml +++ b/tests/rustdoc-gui/scrape-examples-layout.goml @@ -1,5 +1,5 @@ // Check that the line number column has the correct layout. -goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" +go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" // Check that it's not zero. assert-property-false: ( @@ -44,6 +44,6 @@ assert-position: (".scraped-example .code-wrapper", {"y": 253}) assert-position: (".scraped-example .code-wrapper .prev", {"y": 253 + |offset_y|}) // Then with mobile -size: (600, 600) +set-window-size: (600, 600) assert-position: (".scraped-example .code-wrapper", {"y": 308}) assert-position: (".scraped-example .code-wrapper .prev", {"y": 308 + |offset_y|}) diff --git a/tests/rustdoc-gui/scrape-examples-toggle.goml b/tests/rustdoc-gui/scrape-examples-toggle.goml index 2d5df6a5d..9cec6d2bb 100644 --- a/tests/rustdoc-gui/scrape-examples-toggle.goml +++ b/tests/rustdoc-gui/scrape-examples-toggle.goml @@ -1,5 +1,5 @@ // This tests checks that the "scraped examples" toggle is working as expected. -goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" +go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" // Checking the color of the toggle line. show-text: true @@ -7,7 +7,7 @@ define-function: ( "check-color", (theme, toggle_line_color, toggle_line_hover_color), block { - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: // Clicking "More examples..." will open additional examples diff --git a/tests/rustdoc-gui/search-error.goml b/tests/rustdoc-gui/search-error.goml index 2a10a647b..d21905e90 100644 --- a/tests/rustdoc-gui/search-error.goml +++ b/tests/rustdoc-gui/search-error.goml @@ -1,5 +1,5 @@ // Checks that the crate search filtering is handled correctly and changes the results. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html?search=sa'%3Bda'%3Bds" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=sa'%3Bda'%3Bds" show-text: true define-function: ( @@ -7,7 +7,7 @@ define-function: ( (theme, error_background), block { // Setting the theme. - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} // We reload the page so the local storage settings are being used. reload: diff --git a/tests/rustdoc-gui/search-filter.goml b/tests/rustdoc-gui/search-filter.goml index 5bc6e87d6..d739471a6 100644 --- a/tests/rustdoc-gui/search-filter.goml +++ b/tests/rustdoc-gui/search-filter.goml @@ -1,5 +1,5 @@ // Checks that the crate search filtering is handled correctly and changes the results. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" show-text: true write: (".search-input", "test") // To be SURE that the search will be run. @@ -16,6 +16,7 @@ press-key: "ArrowDown" press-key: "ArrowDown" press-key: "ArrowDown" press-key: "ArrowDown" +press-key: "ArrowDown" press-key: "Enter" // Waiting for the search results to appear... wait-for: "#search-tabs" @@ -41,13 +42,14 @@ press-key: "ArrowUp" press-key: "ArrowUp" press-key: "ArrowUp" press-key: "ArrowUp" +press-key: "ArrowUp" press-key: "Enter" // Waiting for the search results to appear... wait-for: "#search-tabs" assert-property: ("#crate-search", {"value": "all crates"}) // Checking that the URL parameter is taken into account for crate filtering. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html?search=test&filter-crate=lib2" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=test&filter-crate=lib2" wait-for: "#crate-search" assert-property: ("#crate-search", {"value": "lib2"}) assert-false: "#results .externcrate" @@ -57,10 +59,10 @@ assert-text: (".search-results-title", "Results in all crates", STARTS_WITH) // Checking the display of the crate filter. // We start with the light theme. -local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"} +set-local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"} reload: -timeout: 2000 +set-timeout: 2000 wait-for: "#crate-search" assert-css: ("#crate-search", { "border": "1px solid rgb(224, 224, 224)", diff --git a/tests/rustdoc-gui/search-form-elements.goml b/tests/rustdoc-gui/search-form-elements.goml index 542db348c..83c698090 100644 --- a/tests/rustdoc-gui/search-form-elements.goml +++ b/tests/rustdoc-gui/search-form-elements.goml @@ -1,9 +1,9 @@ // This test ensures that the elements in ".search-form" have the expected display. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" show-text: true // Ayu theme -local-storage: { +set-local-storage: { "rustdoc-theme": "ayu", "rustdoc-use-system-theme": "false", } @@ -89,7 +89,7 @@ assert-css: ( ) // Dark theme -local-storage: { +set-local-storage: { "rustdoc-theme": "dark", "rustdoc-use-system-theme": "false", } @@ -176,7 +176,7 @@ assert-css: ( ) // Light theme -local-storage: { +set-local-storage: { "rustdoc-theme": "light", "rustdoc-use-system-theme": "false", } diff --git a/tests/rustdoc-gui/search-input-mobile.goml b/tests/rustdoc-gui/search-input-mobile.goml index ce0cef77c..adcb3658a 100644 --- a/tests/rustdoc-gui/search-input-mobile.goml +++ b/tests/rustdoc-gui/search-input-mobile.goml @@ -1,11 +1,11 @@ // Test to ensure that you can click on the search input, whatever the width. // The PR which fixed it is: https://github.com/rust-lang/rust/pull/81592 -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" -size: (463, 700) +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +set-window-size: (463, 700) // We first check that the search input isn't already focused. assert-false: ("input.search-input:focus") click: "input.search-input" reload: -size: (750, 700) +set-window-size: (750, 700) click: "input.search-input" assert: ("input.search-input:focus") diff --git a/tests/rustdoc-gui/search-keyboard.goml b/tests/rustdoc-gui/search-keyboard.goml index ed975664c..f1d802461 100644 --- a/tests/rustdoc-gui/search-keyboard.goml +++ b/tests/rustdoc-gui/search-keyboard.goml @@ -1,6 +1,6 @@ // Checks that the search tab results work correctly with function signature syntax // First, try a search-by-name -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" write: (".search-input", "Foo") // To be SURE that the search will be run. press-key: 'Enter' diff --git a/tests/rustdoc-gui/search-no-result.goml b/tests/rustdoc-gui/search-no-result.goml index b76a44fa9..46d1856b4 100644 --- a/tests/rustdoc-gui/search-no-result.goml +++ b/tests/rustdoc-gui/search-no-result.goml @@ -1,5 +1,5 @@ // The goal of this test is to check the color of the "no result" links. -goto: "file://" + |DOC_PATH| + "/lib2/index.html?search=sdkfskjfsdks" +go-to: "file://" + |DOC_PATH| + "/lib2/index.html?search=sdkfskjfsdks" show-text: true define-function: ( @@ -7,7 +7,7 @@ define-function: ( (theme, link, link_hover), block { // Changing theme. - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: wait-for: "#results" assert: ".search-failed.active" diff --git a/tests/rustdoc-gui/search-reexport.goml b/tests/rustdoc-gui/search-reexport.goml index dd19f03bd..fd817b589 100644 --- a/tests/rustdoc-gui/search-reexport.goml +++ b/tests/rustdoc-gui/search-reexport.goml @@ -1,7 +1,7 @@ // Checks that the reexports are present in the search index, can have // doc aliases and are highligted when their ID is the hash of the page. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" -local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"} +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +set-local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"} reload: // First we check that the reexport has the correct ID and no background color. assert-text: ("//*[@id='reexport.TheStdReexport']", "pub use ::std as TheStdReexport;") diff --git a/tests/rustdoc-gui/search-result-color.goml b/tests/rustdoc-gui/search-result-color.goml index d6d54ec4b..da46a90df 100644 --- a/tests/rustdoc-gui/search-result-color.goml +++ b/tests/rustdoc-gui/search-result-color.goml @@ -31,13 +31,13 @@ define-function: ( }, ) -goto: "file://" + |DOC_PATH| + "/test_docs/index.html?search=coo" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=coo" // This is needed so that the text color is computed. show-text: true // Ayu theme -local-storage: { +set-local-storage: { "rustdoc-theme": "ayu", "rustdoc-use-system-theme": "false", } @@ -154,7 +154,7 @@ assert-css: ( ) // Dark theme -local-storage: { +set-local-storage: { "rustdoc-theme": "dark", "rustdoc-use-system-theme": "false", } @@ -259,7 +259,7 @@ assert-css: ( ) // Light theme -local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"} +set-local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"} reload: // Waiting for the search results to appear... @@ -361,7 +361,7 @@ assert-css: ( ) // Check the alias. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // If the text isn't displayed, the browser doesn't compute color style correctly... show-text: true @@ -369,7 +369,7 @@ define-function: ( "check-alias", (theme, alias, grey), block { - local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} + set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: write: (".search-input", "thisisanalias") // To be SURE that the search will be run. diff --git a/tests/rustdoc-gui/search-result-description.goml b/tests/rustdoc-gui/search-result-description.goml index 9fa210804..745ef31e6 100644 --- a/tests/rustdoc-gui/search-result-description.goml +++ b/tests/rustdoc-gui/search-result-description.goml @@ -1,5 +1,5 @@ // This test is to ensure that the codeblocks are correctly rendered in the search results. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html?search=some_more_function" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=some_more_function" // Waiting for the search results to appear... wait-for: "#search-tabs" assert-text: (".search-results .desc code", "format!") diff --git a/tests/rustdoc-gui/search-result-display.goml b/tests/rustdoc-gui/search-result-display.goml index 20a88c36e..93c71f23f 100644 --- a/tests/rustdoc-gui/search-result-display.goml +++ b/tests/rustdoc-gui/search-result-display.goml @@ -1,6 +1,6 @@ // Checks that the search results have the expected width. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" -size: (900, 1000) +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +set-window-size: (900, 1000) write: (".search-input", "test") // To be SURE that the search will be run. press-key: 'Enter' @@ -8,7 +8,7 @@ wait-for: "#crate-search" // The width is returned by "getComputedStyle" which returns the exact number instead of the // CSS rule which is "50%"... assert-css: (".search-results div.desc", {"width": "310px"}) -size: (600, 100) +set-window-size: (600, 100) // As counter-intuitive as it may seem, in this width, the width is "100%", which is why // when computed it's larger. assert-css: (".search-results div.desc", {"width": "566px"}) @@ -18,7 +18,7 @@ assert-css: (".search-results .result-name > span", {"display": "inline"}) // Check that the crate filter ` { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: ...which immediately requires computing the super traits of `Processor` with associated type name `Input` again -note: cycle used when computing the super traits of `Processor` +note: cycle used when computing the super predicates of `Processor` --> $DIR/issue-20825.rs:5:1 | LL | pub trait Processor: Subscriber { diff --git a/tests/ui/associated-types/issue-63591.rs b/tests/ui/associated-types/issue-63591.rs index 4d2e39f4d..d07c12349 100644 --- a/tests/ui/associated-types/issue-63591.rs +++ b/tests/ui/associated-types/issue-63591.rs @@ -1,11 +1,13 @@ // check-pass #![feature(associated_type_bounds)] -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] fn main() {} -trait Bar { type Assoc; } +trait Bar { + type Assoc; +} trait Thing { type Out; @@ -13,7 +15,9 @@ trait Thing { } struct AssocIsCopy; -impl Bar for AssocIsCopy { type Assoc = u8; } +impl Bar for AssocIsCopy { + type Assoc = u8; +} impl Thing for AssocIsCopy { type Out = impl Bar; diff --git a/tests/ui/associated-types/issue-67684.rs b/tests/ui/associated-types/issue-67684.rs index 49efe8a1b..c6920cf8d 100644 --- a/tests/ui/associated-types/issue-67684.rs +++ b/tests/ui/associated-types/issue-67684.rs @@ -1,4 +1,10 @@ -// check-pass +// revisions: check build +// [check]check-pass +// +// This second configuration aims to verify that we do not ICE in ConstProp because of +// normalization failure. +// [build]build-pass +// [build]compile-flags: -Zmir-opt-level=3 --emit=mir #![allow(dead_code)] diff --git a/tests/ui/async-await/async-trait-fn.current.stderr b/tests/ui/async-await/async-trait-fn.current.stderr new file mode 100644 index 000000000..7ccf2f230 --- /dev/null +++ b/tests/ui/async-await/async-trait-fn.current.stderr @@ -0,0 +1,42 @@ +error[E0706]: functions in traits cannot be declared `async` + --> $DIR/async-trait-fn.rs:6:5 + | +LL | async fn foo() {} + | -----^^^^^^^^^ + | | + | `async` because of this + | + = note: `async` trait functions are not currently supported + = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait + = note: see issue #91611 for more information + = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable + +error[E0706]: functions in traits cannot be declared `async` + --> $DIR/async-trait-fn.rs:7:5 + | +LL | async fn bar(&self) {} + | -----^^^^^^^^^^^^^^ + | | + | `async` because of this + | + = note: `async` trait functions are not currently supported + = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait + = note: see issue #91611 for more information + = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable + +error[E0706]: functions in traits cannot be declared `async` + --> $DIR/async-trait-fn.rs:8:5 + | +LL | async fn baz() { + | -----^^^^^^^^^ + | | + | `async` because of this + | + = note: `async` trait functions are not currently supported + = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait + = note: see issue #91611 for more information + = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0706`. diff --git a/tests/ui/async-await/async-trait-fn.next.stderr b/tests/ui/async-await/async-trait-fn.next.stderr new file mode 100644 index 000000000..7ccf2f230 --- /dev/null +++ b/tests/ui/async-await/async-trait-fn.next.stderr @@ -0,0 +1,42 @@ +error[E0706]: functions in traits cannot be declared `async` + --> $DIR/async-trait-fn.rs:6:5 + | +LL | async fn foo() {} + | -----^^^^^^^^^ + | | + | `async` because of this + | + = note: `async` trait functions are not currently supported + = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait + = note: see issue #91611 for more information + = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable + +error[E0706]: functions in traits cannot be declared `async` + --> $DIR/async-trait-fn.rs:7:5 + | +LL | async fn bar(&self) {} + | -----^^^^^^^^^^^^^^ + | | + | `async` because of this + | + = note: `async` trait functions are not currently supported + = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait + = note: see issue #91611 for more information + = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable + +error[E0706]: functions in traits cannot be declared `async` + --> $DIR/async-trait-fn.rs:8:5 + | +LL | async fn baz() { + | -----^^^^^^^^^ + | | + | `async` because of this + | + = note: `async` trait functions are not currently supported + = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait + = note: see issue #91611 for more information + = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0706`. diff --git a/tests/ui/async-await/async-trait-fn.rs b/tests/ui/async-await/async-trait-fn.rs index e2062e827..04123badb 100644 --- a/tests/ui/async-await/async-trait-fn.rs +++ b/tests/ui/async-await/async-trait-fn.rs @@ -1,4 +1,5 @@ // edition:2018 + trait T { async fn foo() {} //~ ERROR functions in traits cannot be declared `async` async fn bar(&self) {} //~ ERROR functions in traits cannot be declared `async` diff --git a/tests/ui/async-await/async-trait-fn.stderr b/tests/ui/async-await/async-trait-fn.stderr index afbe25cf7..68ebe3507 100644 --- a/tests/ui/async-await/async-trait-fn.stderr +++ b/tests/ui/async-await/async-trait-fn.stderr @@ -1,5 +1,5 @@ error[E0706]: functions in traits cannot be declared `async` - --> $DIR/async-trait-fn.rs:3:5 + --> $DIR/async-trait-fn.rs:4:5 | LL | async fn foo() {} | -----^^^^^^^^^ @@ -12,7 +12,7 @@ LL | async fn foo() {} = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable error[E0706]: functions in traits cannot be declared `async` - --> $DIR/async-trait-fn.rs:4:5 + --> $DIR/async-trait-fn.rs:5:5 | LL | async fn bar(&self) {} | -----^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL | async fn bar(&self) {} = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable error[E0706]: functions in traits cannot be declared `async` - --> $DIR/async-trait-fn.rs:5:5 + --> $DIR/async-trait-fn.rs:6:5 | LL | async fn baz() { | -----^^^^^^^^^ diff --git a/tests/ui/async-await/edition-deny-async-fns-2015.current.stderr b/tests/ui/async-await/edition-deny-async-fns-2015.current.stderr new file mode 100644 index 000000000..c47b99e65 --- /dev/null +++ b/tests/ui/async-await/edition-deny-async-fns-2015.current.stderr @@ -0,0 +1,98 @@ +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/edition-deny-async-fns-2015.rs:5:1 + | +LL | async fn foo() {} + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2021` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/edition-deny-async-fns-2015.rs:7:12 + | +LL | fn baz() { async fn foo() {} } + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2021` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/edition-deny-async-fns-2015.rs:9:1 + | +LL | async fn async_baz() { + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2021` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/edition-deny-async-fns-2015.rs:10:5 + | +LL | async fn bar() {} + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2021` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/edition-deny-async-fns-2015.rs:16:5 + | +LL | async fn foo() {} + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2021` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/edition-deny-async-fns-2015.rs:20:5 + | +LL | async fn foo() {} + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2021` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/edition-deny-async-fns-2015.rs:38:9 + | +LL | async fn bar() {} + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2021` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/edition-deny-async-fns-2015.rs:28:9 + | +LL | async fn foo() {} + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2021` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/edition-deny-async-fns-2015.rs:33:13 + | +LL | async fn bar() {} + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2021` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0706]: functions in traits cannot be declared `async` + --> $DIR/edition-deny-async-fns-2015.rs:20:5 + | +LL | async fn foo() {} + | -----^^^^^^^^^ + | | + | `async` because of this + | + = note: `async` trait functions are not currently supported + = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait + = note: see issue #91611 for more information + = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable + +error: aborting due to 10 previous errors + +Some errors have detailed explanations: E0670, E0706. +For more information about an error, try `rustc --explain E0670`. diff --git a/tests/ui/async-await/edition-deny-async-fns-2015.next.stderr b/tests/ui/async-await/edition-deny-async-fns-2015.next.stderr new file mode 100644 index 000000000..c47b99e65 --- /dev/null +++ b/tests/ui/async-await/edition-deny-async-fns-2015.next.stderr @@ -0,0 +1,98 @@ +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/edition-deny-async-fns-2015.rs:5:1 + | +LL | async fn foo() {} + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2021` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/edition-deny-async-fns-2015.rs:7:12 + | +LL | fn baz() { async fn foo() {} } + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2021` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/edition-deny-async-fns-2015.rs:9:1 + | +LL | async fn async_baz() { + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2021` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/edition-deny-async-fns-2015.rs:10:5 + | +LL | async fn bar() {} + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2021` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/edition-deny-async-fns-2015.rs:16:5 + | +LL | async fn foo() {} + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2021` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/edition-deny-async-fns-2015.rs:20:5 + | +LL | async fn foo() {} + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2021` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/edition-deny-async-fns-2015.rs:38:9 + | +LL | async fn bar() {} + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2021` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/edition-deny-async-fns-2015.rs:28:9 + | +LL | async fn foo() {} + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2021` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/edition-deny-async-fns-2015.rs:33:13 + | +LL | async fn bar() {} + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2021` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0706]: functions in traits cannot be declared `async` + --> $DIR/edition-deny-async-fns-2015.rs:20:5 + | +LL | async fn foo() {} + | -----^^^^^^^^^ + | | + | `async` because of this + | + = note: `async` trait functions are not currently supported + = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait + = note: see issue #91611 for more information + = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable + +error: aborting due to 10 previous errors + +Some errors have detailed explanations: E0670, E0706. +For more information about an error, try `rustc --explain E0670`. diff --git a/tests/ui/async-await/edition-deny-async-fns-2015.rs b/tests/ui/async-await/edition-deny-async-fns-2015.rs index 6bd6d879a..d4c30dc9d 100644 --- a/tests/ui/async-await/edition-deny-async-fns-2015.rs +++ b/tests/ui/async-await/edition-deny-async-fns-2015.rs @@ -1,4 +1,6 @@ // edition:2015 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015 diff --git a/tests/ui/async-await/edition-deny-async-fns-2015.stderr b/tests/ui/async-await/edition-deny-async-fns-2015.stderr deleted file mode 100644 index ba918eb28..000000000 --- a/tests/ui/async-await/edition-deny-async-fns-2015.stderr +++ /dev/null @@ -1,98 +0,0 @@ -error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/edition-deny-async-fns-2015.rs:3:1 - | -LL | async fn foo() {} - | ^^^^^ to use `async fn`, switch to Rust 2018 or later - | - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/edition-deny-async-fns-2015.rs:5:12 - | -LL | fn baz() { async fn foo() {} } - | ^^^^^ to use `async fn`, switch to Rust 2018 or later - | - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/edition-deny-async-fns-2015.rs:7:1 - | -LL | async fn async_baz() { - | ^^^^^ to use `async fn`, switch to Rust 2018 or later - | - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/edition-deny-async-fns-2015.rs:8:5 - | -LL | async fn bar() {} - | ^^^^^ to use `async fn`, switch to Rust 2018 or later - | - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/edition-deny-async-fns-2015.rs:14:5 - | -LL | async fn foo() {} - | ^^^^^ to use `async fn`, switch to Rust 2018 or later - | - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/edition-deny-async-fns-2015.rs:18:5 - | -LL | async fn foo() {} - | ^^^^^ to use `async fn`, switch to Rust 2018 or later - | - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/edition-deny-async-fns-2015.rs:36:9 - | -LL | async fn bar() {} - | ^^^^^ to use `async fn`, switch to Rust 2018 or later - | - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/edition-deny-async-fns-2015.rs:26:9 - | -LL | async fn foo() {} - | ^^^^^ to use `async fn`, switch to Rust 2018 or later - | - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/edition-deny-async-fns-2015.rs:31:13 - | -LL | async fn bar() {} - | ^^^^^ to use `async fn`, switch to Rust 2018 or later - | - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0706]: functions in traits cannot be declared `async` - --> $DIR/edition-deny-async-fns-2015.rs:18:5 - | -LL | async fn foo() {} - | -----^^^^^^^^^ - | | - | `async` because of this - | - = note: `async` trait functions are not currently supported - = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait - = note: see issue #91611 for more information - = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable - -error: aborting due to 10 previous errors - -Some errors have detailed explanations: E0670, E0706. -For more information about an error, try `rustc --explain E0670`. diff --git a/tests/ui/async-await/generator-desc.stderr b/tests/ui/async-await/generator-desc.stderr index 51ac9d86b..042766f19 100644 --- a/tests/ui/async-await/generator-desc.stderr +++ b/tests/ui/async-await/generator-desc.stderr @@ -2,16 +2,18 @@ error[E0308]: mismatched types --> $DIR/generator-desc.rs:10:19 | LL | fun(async {}, async {}); - | -------- ^^^^^^^^ - | | | - | | expected `async` block, found a different `async` block - | | arguments to this function are incorrect - | the expected `async` block + | --- -------- ^^^^^^^^ expected `async` block, found a different `async` block + | | | + | | the expected `async` block + | arguments to this function are incorrect | = note: expected `async` block `[async block@$DIR/generator-desc.rs:10:9: 10:17]` found `async` block `[async block@$DIR/generator-desc.rs:10:19: 10:27]` note: function defined here - --> $SRC_DIR/core/src/future/mod.rs:LL:COL + --> $DIR/generator-desc.rs:8:4 + | +LL | fn fun>(f1: F, f2: F) {} + | ^^^ ----- error[E0308]: mismatched types --> $DIR/generator-desc.rs:12:16 diff --git a/tests/ui/async-await/in-trait/async-associated-types.rs b/tests/ui/async-await/in-trait/async-associated-types.rs index 974f5aaff..89ca4039b 100644 --- a/tests/ui/async-await/in-trait/async-associated-types.rs +++ b/tests/ui/async-await/in-trait/async-associated-types.rs @@ -1,5 +1,7 @@ // check-pass // edition: 2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] #![feature(impl_trait_projections)] diff --git a/tests/ui/async-await/in-trait/async-associated-types2.rs b/tests/ui/async-await/in-trait/async-associated-types2.rs index e546a0579..b889f616a 100644 --- a/tests/ui/async-await/in-trait/async-associated-types2.rs +++ b/tests/ui/async-await/in-trait/async-associated-types2.rs @@ -1,8 +1,10 @@ // check-pass // edition: 2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] #![allow(incomplete_features)] use std::future::Future; @@ -21,9 +23,7 @@ impl MyTrait for i32 { Self: 'a; fn foo<'a>(&'a self) -> Self::Fut<'a> { - async { - *self - } + async { *self } } } diff --git a/tests/ui/async-await/in-trait/async-default-fn-overridden.current.stderr b/tests/ui/async-await/in-trait/async-default-fn-overridden.current.stderr new file mode 100644 index 000000000..2142ee232 --- /dev/null +++ b/tests/ui/async-await/in-trait/async-default-fn-overridden.current.stderr @@ -0,0 +1,11 @@ +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/async-default-fn-overridden.rs:6:12 + | +LL | #![feature(async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/async-await/in-trait/async-default-fn-overridden.next.stderr b/tests/ui/async-await/in-trait/async-default-fn-overridden.next.stderr new file mode 100644 index 000000000..2142ee232 --- /dev/null +++ b/tests/ui/async-await/in-trait/async-default-fn-overridden.next.stderr @@ -0,0 +1,11 @@ +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/async-default-fn-overridden.rs:6:12 + | +LL | #![feature(async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/async-await/in-trait/async-default-fn-overridden.rs b/tests/ui/async-await/in-trait/async-default-fn-overridden.rs index 0fd1a2703..dd1af93d7 100644 --- a/tests/ui/async-await/in-trait/async-default-fn-overridden.rs +++ b/tests/ui/async-await/in-trait/async-default-fn-overridden.rs @@ -1,5 +1,7 @@ // run-pass // edition:2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] //~^ WARN the feature `async_fn_in_trait` is incomplete and may not be safe to use diff --git a/tests/ui/async-await/in-trait/async-default-fn-overridden.stderr b/tests/ui/async-await/in-trait/async-default-fn-overridden.stderr deleted file mode 100644 index 61a826258..000000000 --- a/tests/ui/async-await/in-trait/async-default-fn-overridden.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/async-default-fn-overridden.rs:4:12 - | -LL | #![feature(async_fn_in_trait)] - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #91611 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.current.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.current.stderr new file mode 100644 index 000000000..b5ace9ada --- /dev/null +++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.current.stderr @@ -0,0 +1,17 @@ +error[E0053]: method `foo` has an incompatible type for trait + --> $DIR/async-example-desugared-boxed-in-trait.rs:17:28 + | +LL | async fn foo(&self) -> i32 { + | ^^^ expected `Pin>>`, found future + | +note: type in trait + --> $DIR/async-example-desugared-boxed-in-trait.rs:13:22 + | +LL | fn foo(&self) -> Pin + '_>>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: expected signature `fn(&i32) -> Pin>>` + found signature `fn(&i32) -> impl Future` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0053`. diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.next.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.next.stderr new file mode 100644 index 000000000..b5ace9ada --- /dev/null +++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.next.stderr @@ -0,0 +1,17 @@ +error[E0053]: method `foo` has an incompatible type for trait + --> $DIR/async-example-desugared-boxed-in-trait.rs:17:28 + | +LL | async fn foo(&self) -> i32 { + | ^^^ expected `Pin>>`, found future + | +note: type in trait + --> $DIR/async-example-desugared-boxed-in-trait.rs:13:22 + | +LL | fn foo(&self) -> Pin + '_>>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: expected signature `fn(&i32) -> Pin>>` + found signature `fn(&i32) -> impl Future` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0053`. diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs index 38ba29718..7b53379b2 100644 --- a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs +++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs @@ -1,4 +1,6 @@ // edition: 2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] #![feature(return_position_impl_trait_in_trait)] diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr deleted file mode 100644 index 168ef8e9e..000000000 --- a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0053]: method `foo` has an incompatible type for trait - --> $DIR/async-example-desugared-boxed-in-trait.rs:15:28 - | -LL | async fn foo(&self) -> i32 { - | ^^^ expected `Pin>>`, found future - | -note: type in trait - --> $DIR/async-example-desugared-boxed-in-trait.rs:11:22 - | -LL | fn foo(&self) -> Pin + '_>>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: expected signature `fn(&i32) -> Pin>>` - found signature `fn(&i32) -> impl Future` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0053`. diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed.current.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed.current.stderr new file mode 100644 index 000000000..6c0b58591 --- /dev/null +++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed.current.stderr @@ -0,0 +1,11 @@ +error: method `foo` should be async because the method from the trait is async + --> $DIR/async-example-desugared-boxed.rs:17:5 + | +LL | async fn foo(&self) -> i32; + | --------------------------- required because the trait method is async +... +LL | fn foo(&self) -> Pin + '_>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed.next.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed.next.stderr new file mode 100644 index 000000000..6c0b58591 --- /dev/null +++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed.next.stderr @@ -0,0 +1,11 @@ +error: method `foo` should be async because the method from the trait is async + --> $DIR/async-example-desugared-boxed.rs:17:5 + | +LL | async fn foo(&self) -> i32; + | --------------------------- required because the trait method is async +... +LL | fn foo(&self) -> Pin + '_>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed.rs b/tests/ui/async-await/in-trait/async-example-desugared-boxed.rs index 1b1b3cffd..916488ffa 100644 --- a/tests/ui/async-await/in-trait/async-example-desugared-boxed.rs +++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed.rs @@ -1,4 +1,6 @@ // edition: 2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] #![feature(return_position_impl_trait_in_trait)] diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr deleted file mode 100644 index 60fa534a6..000000000 --- a/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: method `foo` should be async because the method from the trait is async - --> $DIR/async-example-desugared-boxed.rs:15:5 - | -LL | async fn foo(&self) -> i32; - | --------------------------- required because the trait method is async -... -LL | fn foo(&self) -> Pin + '_>> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/tests/ui/async-await/in-trait/async-example-desugared-extra.rs b/tests/ui/async-await/in-trait/async-example-desugared-extra.rs index 81e1e59a3..edac0b374 100644 --- a/tests/ui/async-await/in-trait/async-example-desugared-extra.rs +++ b/tests/ui/async-await/in-trait/async-example-desugared-extra.rs @@ -1,5 +1,7 @@ // check-pass // edition: 2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] #![feature(return_position_impl_trait_in_trait)] diff --git a/tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs b/tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs index feeda719e..934f7643d 100644 --- a/tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs +++ b/tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs @@ -1,5 +1,7 @@ // check-pass // edition: 2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] #![feature(return_position_impl_trait_in_trait)] diff --git a/tests/ui/async-await/in-trait/async-example-desugared-manual.current.stderr b/tests/ui/async-await/in-trait/async-example-desugared-manual.current.stderr new file mode 100644 index 000000000..0d2551ab8 --- /dev/null +++ b/tests/ui/async-await/in-trait/async-example-desugared-manual.current.stderr @@ -0,0 +1,11 @@ +error: method `foo` should be async because the method from the trait is async + --> $DIR/async-example-desugared-manual.rs:25:5 + | +LL | async fn foo(&self) -> i32; + | --------------------------- required because the trait method is async +... +LL | fn foo(&self) -> MyFuture { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/async-await/in-trait/async-example-desugared-manual.next.stderr b/tests/ui/async-await/in-trait/async-example-desugared-manual.next.stderr new file mode 100644 index 000000000..0d2551ab8 --- /dev/null +++ b/tests/ui/async-await/in-trait/async-example-desugared-manual.next.stderr @@ -0,0 +1,11 @@ +error: method `foo` should be async because the method from the trait is async + --> $DIR/async-example-desugared-manual.rs:25:5 + | +LL | async fn foo(&self) -> i32; + | --------------------------- required because the trait method is async +... +LL | fn foo(&self) -> MyFuture { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/async-await/in-trait/async-example-desugared-manual.rs b/tests/ui/async-await/in-trait/async-example-desugared-manual.rs index 71473e745..4883828d3 100644 --- a/tests/ui/async-await/in-trait/async-example-desugared-manual.rs +++ b/tests/ui/async-await/in-trait/async-example-desugared-manual.rs @@ -1,4 +1,6 @@ // edition: 2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] #![feature(return_position_impl_trait_in_trait)] diff --git a/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr b/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr deleted file mode 100644 index 567a36a86..000000000 --- a/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: method `foo` should be async because the method from the trait is async - --> $DIR/async-example-desugared-manual.rs:23:5 - | -LL | async fn foo(&self) -> i32; - | --------------------------- required because the trait method is async -... -LL | fn foo(&self) -> MyFuture { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/tests/ui/async-await/in-trait/async-example-desugared.rs b/tests/ui/async-await/in-trait/async-example-desugared.rs index fb92ec786..214171b2e 100644 --- a/tests/ui/async-await/in-trait/async-example-desugared.rs +++ b/tests/ui/async-await/in-trait/async-example-desugared.rs @@ -1,5 +1,7 @@ // check-pass // edition: 2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] #![feature(return_position_impl_trait_in_trait)] diff --git a/tests/ui/async-await/in-trait/async-generics-and-bounds.current.stderr b/tests/ui/async-await/in-trait/async-generics-and-bounds.current.stderr new file mode 100644 index 000000000..780da0689 --- /dev/null +++ b/tests/ui/async-await/in-trait/async-generics-and-bounds.current.stderr @@ -0,0 +1,37 @@ +error[E0311]: the parameter type `U` may not live long enough + --> $DIR/async-generics-and-bounds.rs:14:28 + | +LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; + | ^^^^^^^ + | +note: the parameter type `U` must be valid for the anonymous lifetime defined here... + --> $DIR/async-generics-and-bounds.rs:14:18 + | +LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; + | ^^^^^ +note: ...so that the reference type `&(T, U)` does not outlive the data it points at + --> $DIR/async-generics-and-bounds.rs:14:28 + | +LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; + | ^^^^^^^ + +error[E0311]: the parameter type `T` may not live long enough + --> $DIR/async-generics-and-bounds.rs:14:28 + | +LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; + | ^^^^^^^ + | +note: the parameter type `T` must be valid for the anonymous lifetime defined here... + --> $DIR/async-generics-and-bounds.rs:14:18 + | +LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; + | ^^^^^ +note: ...so that the reference type `&(T, U)` does not outlive the data it points at + --> $DIR/async-generics-and-bounds.rs:14:28 + | +LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; + | ^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0311`. diff --git a/tests/ui/async-await/in-trait/async-generics-and-bounds.next.stderr b/tests/ui/async-await/in-trait/async-generics-and-bounds.next.stderr new file mode 100644 index 000000000..780da0689 --- /dev/null +++ b/tests/ui/async-await/in-trait/async-generics-and-bounds.next.stderr @@ -0,0 +1,37 @@ +error[E0311]: the parameter type `U` may not live long enough + --> $DIR/async-generics-and-bounds.rs:14:28 + | +LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; + | ^^^^^^^ + | +note: the parameter type `U` must be valid for the anonymous lifetime defined here... + --> $DIR/async-generics-and-bounds.rs:14:18 + | +LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; + | ^^^^^ +note: ...so that the reference type `&(T, U)` does not outlive the data it points at + --> $DIR/async-generics-and-bounds.rs:14:28 + | +LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; + | ^^^^^^^ + +error[E0311]: the parameter type `T` may not live long enough + --> $DIR/async-generics-and-bounds.rs:14:28 + | +LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; + | ^^^^^^^ + | +note: the parameter type `T` must be valid for the anonymous lifetime defined here... + --> $DIR/async-generics-and-bounds.rs:14:18 + | +LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; + | ^^^^^ +note: ...so that the reference type `&(T, U)` does not outlive the data it points at + --> $DIR/async-generics-and-bounds.rs:14:28 + | +LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; + | ^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0311`. diff --git a/tests/ui/async-await/in-trait/async-generics-and-bounds.rs b/tests/ui/async-await/in-trait/async-generics-and-bounds.rs index a73d55adf..146e74ec2 100644 --- a/tests/ui/async-await/in-trait/async-generics-and-bounds.rs +++ b/tests/ui/async-await/in-trait/async-generics-and-bounds.rs @@ -1,6 +1,8 @@ // check-fail // known-bug: #102682 // edition: 2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr b/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr deleted file mode 100644 index f1f0d7e59..000000000 --- a/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr +++ /dev/null @@ -1,37 +0,0 @@ -error[E0311]: the parameter type `U` may not live long enough - --> $DIR/async-generics-and-bounds.rs:12:28 - | -LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; - | ^^^^^^^ - | -note: the parameter type `U` must be valid for the anonymous lifetime defined here... - --> $DIR/async-generics-and-bounds.rs:12:18 - | -LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; - | ^^^^^ -note: ...so that the reference type `&(T, U)` does not outlive the data it points at - --> $DIR/async-generics-and-bounds.rs:12:28 - | -LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; - | ^^^^^^^ - -error[E0311]: the parameter type `T` may not live long enough - --> $DIR/async-generics-and-bounds.rs:12:28 - | -LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; - | ^^^^^^^ - | -note: the parameter type `T` must be valid for the anonymous lifetime defined here... - --> $DIR/async-generics-and-bounds.rs:12:18 - | -LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; - | ^^^^^ -note: ...so that the reference type `&(T, U)` does not outlive the data it points at - --> $DIR/async-generics-and-bounds.rs:12:28 - | -LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; - | ^^^^^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0311`. diff --git a/tests/ui/async-await/in-trait/async-generics.current.stderr b/tests/ui/async-await/in-trait/async-generics.current.stderr new file mode 100644 index 000000000..04e1ab6d7 --- /dev/null +++ b/tests/ui/async-await/in-trait/async-generics.current.stderr @@ -0,0 +1,37 @@ +error[E0311]: the parameter type `U` may not live long enough + --> $DIR/async-generics.rs:11:28 + | +LL | async fn foo(&self) -> &(T, U); + | ^^^^^^^ + | +note: the parameter type `U` must be valid for the anonymous lifetime defined here... + --> $DIR/async-generics.rs:11:18 + | +LL | async fn foo(&self) -> &(T, U); + | ^^^^^ +note: ...so that the reference type `&(T, U)` does not outlive the data it points at + --> $DIR/async-generics.rs:11:28 + | +LL | async fn foo(&self) -> &(T, U); + | ^^^^^^^ + +error[E0311]: the parameter type `T` may not live long enough + --> $DIR/async-generics.rs:11:28 + | +LL | async fn foo(&self) -> &(T, U); + | ^^^^^^^ + | +note: the parameter type `T` must be valid for the anonymous lifetime defined here... + --> $DIR/async-generics.rs:11:18 + | +LL | async fn foo(&self) -> &(T, U); + | ^^^^^ +note: ...so that the reference type `&(T, U)` does not outlive the data it points at + --> $DIR/async-generics.rs:11:28 + | +LL | async fn foo(&self) -> &(T, U); + | ^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0311`. diff --git a/tests/ui/async-await/in-trait/async-generics.next.stderr b/tests/ui/async-await/in-trait/async-generics.next.stderr new file mode 100644 index 000000000..04e1ab6d7 --- /dev/null +++ b/tests/ui/async-await/in-trait/async-generics.next.stderr @@ -0,0 +1,37 @@ +error[E0311]: the parameter type `U` may not live long enough + --> $DIR/async-generics.rs:11:28 + | +LL | async fn foo(&self) -> &(T, U); + | ^^^^^^^ + | +note: the parameter type `U` must be valid for the anonymous lifetime defined here... + --> $DIR/async-generics.rs:11:18 + | +LL | async fn foo(&self) -> &(T, U); + | ^^^^^ +note: ...so that the reference type `&(T, U)` does not outlive the data it points at + --> $DIR/async-generics.rs:11:28 + | +LL | async fn foo(&self) -> &(T, U); + | ^^^^^^^ + +error[E0311]: the parameter type `T` may not live long enough + --> $DIR/async-generics.rs:11:28 + | +LL | async fn foo(&self) -> &(T, U); + | ^^^^^^^ + | +note: the parameter type `T` must be valid for the anonymous lifetime defined here... + --> $DIR/async-generics.rs:11:18 + | +LL | async fn foo(&self) -> &(T, U); + | ^^^^^ +note: ...so that the reference type `&(T, U)` does not outlive the data it points at + --> $DIR/async-generics.rs:11:28 + | +LL | async fn foo(&self) -> &(T, U); + | ^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0311`. diff --git a/tests/ui/async-await/in-trait/async-generics.rs b/tests/ui/async-await/in-trait/async-generics.rs index 67000e577..507500abf 100644 --- a/tests/ui/async-await/in-trait/async-generics.rs +++ b/tests/ui/async-await/in-trait/async-generics.rs @@ -1,6 +1,8 @@ // check-fail // known-bug: #102682 // edition: 2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/async-await/in-trait/async-generics.stderr b/tests/ui/async-await/in-trait/async-generics.stderr deleted file mode 100644 index 2f0556456..000000000 --- a/tests/ui/async-await/in-trait/async-generics.stderr +++ /dev/null @@ -1,37 +0,0 @@ -error[E0311]: the parameter type `U` may not live long enough - --> $DIR/async-generics.rs:9:28 - | -LL | async fn foo(&self) -> &(T, U); - | ^^^^^^^ - | -note: the parameter type `U` must be valid for the anonymous lifetime defined here... - --> $DIR/async-generics.rs:9:18 - | -LL | async fn foo(&self) -> &(T, U); - | ^^^^^ -note: ...so that the reference type `&(T, U)` does not outlive the data it points at - --> $DIR/async-generics.rs:9:28 - | -LL | async fn foo(&self) -> &(T, U); - | ^^^^^^^ - -error[E0311]: the parameter type `T` may not live long enough - --> $DIR/async-generics.rs:9:28 - | -LL | async fn foo(&self) -> &(T, U); - | ^^^^^^^ - | -note: the parameter type `T` must be valid for the anonymous lifetime defined here... - --> $DIR/async-generics.rs:9:18 - | -LL | async fn foo(&self) -> &(T, U); - | ^^^^^ -note: ...so that the reference type `&(T, U)` does not outlive the data it points at - --> $DIR/async-generics.rs:9:28 - | -LL | async fn foo(&self) -> &(T, U); - | ^^^^^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0311`. diff --git a/tests/ui/async-await/in-trait/async-recursive-generic.current.stderr b/tests/ui/async-await/in-trait/async-recursive-generic.current.stderr new file mode 100644 index 000000000..67b491f19 --- /dev/null +++ b/tests/ui/async-await/in-trait/async-recursive-generic.current.stderr @@ -0,0 +1,12 @@ +error[E0733]: recursion in an `async fn` requires boxing + --> $DIR/async-recursive-generic.rs:13:48 + | +LL | async fn foo_recursive(&self, n: usize) -> T { + | ^ recursive `async fn` + | + = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` + = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0733`. diff --git a/tests/ui/async-await/in-trait/async-recursive-generic.next.stderr b/tests/ui/async-await/in-trait/async-recursive-generic.next.stderr new file mode 100644 index 000000000..67b491f19 --- /dev/null +++ b/tests/ui/async-await/in-trait/async-recursive-generic.next.stderr @@ -0,0 +1,12 @@ +error[E0733]: recursion in an `async fn` requires boxing + --> $DIR/async-recursive-generic.rs:13:48 + | +LL | async fn foo_recursive(&self, n: usize) -> T { + | ^ recursive `async fn` + | + = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` + = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0733`. diff --git a/tests/ui/async-await/in-trait/async-recursive-generic.rs b/tests/ui/async-await/in-trait/async-recursive-generic.rs index 6839abd38..64c6ba15c 100644 --- a/tests/ui/async-await/in-trait/async-recursive-generic.rs +++ b/tests/ui/async-await/in-trait/async-recursive-generic.rs @@ -1,4 +1,6 @@ // edition: 2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/async-await/in-trait/async-recursive-generic.stderr b/tests/ui/async-await/in-trait/async-recursive-generic.stderr deleted file mode 100644 index cab173bdd..000000000 --- a/tests/ui/async-await/in-trait/async-recursive-generic.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0733]: recursion in an `async fn` requires boxing - --> $DIR/async-recursive-generic.rs:11:48 - | -LL | async fn foo_recursive(&self, n: usize) -> T { - | ^ recursive `async fn` - | - = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` - = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0733`. diff --git a/tests/ui/async-await/in-trait/async-recursive.current.stderr b/tests/ui/async-await/in-trait/async-recursive.current.stderr new file mode 100644 index 000000000..85af27e37 --- /dev/null +++ b/tests/ui/async-await/in-trait/async-recursive.current.stderr @@ -0,0 +1,12 @@ +error[E0733]: recursion in an `async fn` requires boxing + --> $DIR/async-recursive.rs:13:48 + | +LL | async fn foo_recursive(&self, n: usize) -> i32 { + | ^^^ recursive `async fn` + | + = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` + = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0733`. diff --git a/tests/ui/async-await/in-trait/async-recursive.next.stderr b/tests/ui/async-await/in-trait/async-recursive.next.stderr new file mode 100644 index 000000000..85af27e37 --- /dev/null +++ b/tests/ui/async-await/in-trait/async-recursive.next.stderr @@ -0,0 +1,12 @@ +error[E0733]: recursion in an `async fn` requires boxing + --> $DIR/async-recursive.rs:13:48 + | +LL | async fn foo_recursive(&self, n: usize) -> i32 { + | ^^^ recursive `async fn` + | + = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` + = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0733`. diff --git a/tests/ui/async-await/in-trait/async-recursive.rs b/tests/ui/async-await/in-trait/async-recursive.rs index 61119f809..d928909e3 100644 --- a/tests/ui/async-await/in-trait/async-recursive.rs +++ b/tests/ui/async-await/in-trait/async-recursive.rs @@ -1,4 +1,6 @@ // edition: 2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/async-await/in-trait/async-recursive.stderr b/tests/ui/async-await/in-trait/async-recursive.stderr deleted file mode 100644 index 9feff37b3..000000000 --- a/tests/ui/async-await/in-trait/async-recursive.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0733]: recursion in an `async fn` requires boxing - --> $DIR/async-recursive.rs:11:48 - | -LL | async fn foo_recursive(&self, n: usize) -> i32 { - | ^^^ recursive `async fn` - | - = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` - = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0733`. diff --git a/tests/ui/async-await/in-trait/bad-signatures.current.stderr b/tests/ui/async-await/in-trait/bad-signatures.current.stderr new file mode 100644 index 000000000..5a05b080c --- /dev/null +++ b/tests/ui/async-await/in-trait/bad-signatures.current.stderr @@ -0,0 +1,26 @@ +error: expected identifier, found keyword `self` + --> $DIR/bad-signatures.rs:9:23 + | +LL | async fn bar(&abc self); + | ^^^^ expected identifier, found keyword + +error: expected one of `:`, `@`, or `|`, found keyword `self` + --> $DIR/bad-signatures.rs:9:23 + | +LL | async fn bar(&abc self); + | -----^^^^ + | | | + | | expected one of `:`, `@`, or `|` + | help: declare the type after the parameter binding: `: ` + +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/bad-signatures.rs:5:12 + | +LL | #![feature(async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +error: aborting due to 2 previous errors; 1 warning emitted + diff --git a/tests/ui/async-await/in-trait/bad-signatures.next.stderr b/tests/ui/async-await/in-trait/bad-signatures.next.stderr new file mode 100644 index 000000000..5a05b080c --- /dev/null +++ b/tests/ui/async-await/in-trait/bad-signatures.next.stderr @@ -0,0 +1,26 @@ +error: expected identifier, found keyword `self` + --> $DIR/bad-signatures.rs:9:23 + | +LL | async fn bar(&abc self); + | ^^^^ expected identifier, found keyword + +error: expected one of `:`, `@`, or `|`, found keyword `self` + --> $DIR/bad-signatures.rs:9:23 + | +LL | async fn bar(&abc self); + | -----^^^^ + | | | + | | expected one of `:`, `@`, or `|` + | help: declare the type after the parameter binding: `: ` + +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/bad-signatures.rs:5:12 + | +LL | #![feature(async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +error: aborting due to 2 previous errors; 1 warning emitted + diff --git a/tests/ui/async-await/in-trait/bad-signatures.rs b/tests/ui/async-await/in-trait/bad-signatures.rs index b86f1d1c1..e0093be8c 100644 --- a/tests/ui/async-await/in-trait/bad-signatures.rs +++ b/tests/ui/async-await/in-trait/bad-signatures.rs @@ -1,4 +1,6 @@ // edition:2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] //~^ WARN the feature `async_fn_in_trait` is incomplete diff --git a/tests/ui/async-await/in-trait/bad-signatures.stderr b/tests/ui/async-await/in-trait/bad-signatures.stderr deleted file mode 100644 index e0ba7b53e..000000000 --- a/tests/ui/async-await/in-trait/bad-signatures.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: expected identifier, found keyword `self` - --> $DIR/bad-signatures.rs:7:23 - | -LL | async fn bar(&abc self); - | ^^^^ expected identifier, found keyword - -error: expected one of `:`, `@`, or `|`, found keyword `self` - --> $DIR/bad-signatures.rs:7:23 - | -LL | async fn bar(&abc self); - | -----^^^^ - | | | - | | expected one of `:`, `@`, or `|` - | help: declare the type after the parameter binding: `: ` - -warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/bad-signatures.rs:3:12 - | -LL | #![feature(async_fn_in_trait)] - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #91611 for more information - = note: `#[warn(incomplete_features)]` on by default - -error: aborting due to 2 previous errors; 1 warning emitted - diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.current.stderr b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.current.stderr new file mode 100644 index 000000000..1e67cdca2 --- /dev/null +++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.current.stderr @@ -0,0 +1,19 @@ +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/dont-project-to-specializable-projection.rs:6:12 + | +LL | #![feature(async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +error: async associated function in trait cannot be specialized + --> $DIR/dont-project-to-specializable-projection.rs:16:5 + | +LL | default async fn foo(_: T) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: specialization behaves in inconsistent and surprising ways with `#![feature(async_fn_in_trait)]`, and for now is disallowed + +error: aborting due to previous error; 1 warning emitted + diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.next.stderr b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.next.stderr new file mode 100644 index 000000000..fa89c6b77 --- /dev/null +++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.next.stderr @@ -0,0 +1,34 @@ +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/dont-project-to-specializable-projection.rs:6:12 + | +LL | #![feature(async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0053]: method `foo` has an incompatible type for trait + --> $DIR/dont-project-to-specializable-projection.rs:16:35 + | +LL | default async fn foo(_: T) -> &'static str { + | ^^^^^^^^^^^^ expected associated type, found future + | +note: type in trait + --> $DIR/dont-project-to-specializable-projection.rs:12:27 + | +LL | async fn foo(_: T) -> &'static str; + | ^^^^^^^^^^^^ + = note: expected signature `fn(_) -> impl Future` + found signature `fn(_) -> impl Future` + +error: async associated function in trait cannot be specialized + --> $DIR/dont-project-to-specializable-projection.rs:16:5 + | +LL | default async fn foo(_: T) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: specialization behaves in inconsistent and surprising ways with `#![feature(async_fn_in_trait)]`, and for now is disallowed + +error: aborting due to 2 previous errors; 1 warning emitted + +For more information about this error, try `rustc --explain E0053`. diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs index afd3db5e0..7183eaccc 100644 --- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs +++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs @@ -1,5 +1,7 @@ // edition: 2021 // known-bug: #108309 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] #![feature(min_specialization)] diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr deleted file mode 100644 index f71fd9980..000000000 --- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr +++ /dev/null @@ -1,19 +0,0 @@ -warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/dont-project-to-specializable-projection.rs:4:12 - | -LL | #![feature(async_fn_in_trait)] - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #91611 for more information - = note: `#[warn(incomplete_features)]` on by default - -error: async associated function in trait cannot be specialized - --> $DIR/dont-project-to-specializable-projection.rs:14:5 - | -LL | default async fn foo(_: T) -> &'static str { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: specialization behaves in inconsistent and surprising ways with `#![feature(async_fn_in_trait)]`, and for now is disallowed - -error: aborting due to previous error; 1 warning emitted - diff --git a/tests/ui/async-await/in-trait/early-bound-1.rs b/tests/ui/async-await/in-trait/early-bound-1.rs index 6b3b14201..30843473d 100644 --- a/tests/ui/async-await/in-trait/early-bound-1.rs +++ b/tests/ui/async-await/in-trait/early-bound-1.rs @@ -1,5 +1,7 @@ // check-pass // edition:2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/async-await/in-trait/early-bound-2.rs b/tests/ui/async-await/in-trait/early-bound-2.rs index 270443229..1c5a68c2a 100644 --- a/tests/ui/async-await/in-trait/early-bound-2.rs +++ b/tests/ui/async-await/in-trait/early-bound-2.rs @@ -1,5 +1,7 @@ // check-pass // edition:2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/async-await/in-trait/fn-not-async-err2.current.stderr b/tests/ui/async-await/in-trait/fn-not-async-err2.current.stderr new file mode 100644 index 000000000..1a7495149 --- /dev/null +++ b/tests/ui/async-await/in-trait/fn-not-async-err2.current.stderr @@ -0,0 +1,12 @@ +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types + --> $DIR/fn-not-async-err2.rs:15:22 + | +LL | fn foo(&self) -> impl Future { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0562`. diff --git a/tests/ui/async-await/in-trait/fn-not-async-err2.next.stderr b/tests/ui/async-await/in-trait/fn-not-async-err2.next.stderr new file mode 100644 index 000000000..1a7495149 --- /dev/null +++ b/tests/ui/async-await/in-trait/fn-not-async-err2.next.stderr @@ -0,0 +1,12 @@ +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types + --> $DIR/fn-not-async-err2.rs:15:22 + | +LL | fn foo(&self) -> impl Future { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0562`. diff --git a/tests/ui/async-await/in-trait/fn-not-async-err2.rs b/tests/ui/async-await/in-trait/fn-not-async-err2.rs index 78017429f..5fdb7296a 100644 --- a/tests/ui/async-await/in-trait/fn-not-async-err2.rs +++ b/tests/ui/async-await/in-trait/fn-not-async-err2.rs @@ -1,4 +1,6 @@ // edition: 2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/async-await/in-trait/fn-not-async-err2.stderr b/tests/ui/async-await/in-trait/fn-not-async-err2.stderr deleted file mode 100644 index 37d9669c0..000000000 --- a/tests/ui/async-await/in-trait/fn-not-async-err2.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types - --> $DIR/fn-not-async-err2.rs:13:22 - | -LL | fn foo(&self) -> impl Future { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #91611 for more information - = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0562`. diff --git a/tests/ui/async-await/in-trait/generics-mismatch.current.stderr b/tests/ui/async-await/in-trait/generics-mismatch.current.stderr new file mode 100644 index 000000000..be23384e0 --- /dev/null +++ b/tests/ui/async-await/in-trait/generics-mismatch.current.stderr @@ -0,0 +1,16 @@ +error[E0053]: method `foo` has an incompatible generic parameter for trait `Foo` + --> $DIR/generics-mismatch.rs:13:18 + | +LL | trait Foo { + | --- +LL | async fn foo(); + | - expected type parameter +... +LL | impl Foo for () { + | --------------- +LL | async fn foo() {} + | ^^^^^^^^^^^^^^ found const parameter of type `usize` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0053`. diff --git a/tests/ui/async-await/in-trait/generics-mismatch.next.stderr b/tests/ui/async-await/in-trait/generics-mismatch.next.stderr new file mode 100644 index 000000000..be23384e0 --- /dev/null +++ b/tests/ui/async-await/in-trait/generics-mismatch.next.stderr @@ -0,0 +1,16 @@ +error[E0053]: method `foo` has an incompatible generic parameter for trait `Foo` + --> $DIR/generics-mismatch.rs:13:18 + | +LL | trait Foo { + | --- +LL | async fn foo(); + | - expected type parameter +... +LL | impl Foo for () { + | --------------- +LL | async fn foo() {} + | ^^^^^^^^^^^^^^ found const parameter of type `usize` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0053`. diff --git a/tests/ui/async-await/in-trait/generics-mismatch.rs b/tests/ui/async-await/in-trait/generics-mismatch.rs new file mode 100644 index 000000000..fc29783c0 --- /dev/null +++ b/tests/ui/async-await/in-trait/generics-mismatch.rs @@ -0,0 +1,15 @@ +// edition: 2021 + +#![feature(async_fn_in_trait)] +#![allow(incomplete_features)] + +trait Foo { + async fn foo(); +} + +impl Foo for () { + async fn foo() {} + //~^ ERROR: method `foo` has an incompatible generic parameter for trait `Foo` [E0053] +} + +fn main() {} diff --git a/tests/ui/async-await/in-trait/generics-mismatch.stderr b/tests/ui/async-await/in-trait/generics-mismatch.stderr new file mode 100644 index 000000000..3518aa05c --- /dev/null +++ b/tests/ui/async-await/in-trait/generics-mismatch.stderr @@ -0,0 +1,16 @@ +error[E0053]: method `foo` has an incompatible generic parameter for trait `Foo` + --> $DIR/generics-mismatch.rs:11:18 + | +LL | trait Foo { + | --- +LL | async fn foo(); + | - expected type parameter +... +LL | impl Foo for () { + | --------------- +LL | async fn foo() {} + | ^^^^^^^^^^^^^^ found const parameter of type `usize` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0053`. diff --git a/tests/ui/async-await/in-trait/implied-bounds.rs b/tests/ui/async-await/in-trait/implied-bounds.rs index 52bceb3cc..45ada1d84 100644 --- a/tests/ui/async-await/in-trait/implied-bounds.rs +++ b/tests/ui/async-await/in-trait/implied-bounds.rs @@ -1,5 +1,7 @@ // check-pass // edition: 2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/async-await/in-trait/issue-102138.rs b/tests/ui/async-await/in-trait/issue-102138.rs index f61b34ed9..ced30b7e4 100644 --- a/tests/ui/async-await/in-trait/issue-102138.rs +++ b/tests/ui/async-await/in-trait/issue-102138.rs @@ -1,5 +1,7 @@ // check-pass // edition:2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/async-await/in-trait/issue-102219.rs b/tests/ui/async-await/in-trait/issue-102219.rs index 9a35f6515..f3fdfa345 100644 --- a/tests/ui/async-await/in-trait/issue-102219.rs +++ b/tests/ui/async-await/in-trait/issue-102219.rs @@ -1,6 +1,8 @@ // compile-flags:--crate-type=lib // edition:2021 // check-pass +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/async-await/in-trait/issue-102310.rs b/tests/ui/async-await/in-trait/issue-102310.rs index 49c3e9fee..8e5dbd08e 100644 --- a/tests/ui/async-await/in-trait/issue-102310.rs +++ b/tests/ui/async-await/in-trait/issue-102310.rs @@ -1,5 +1,7 @@ // check-pass // edition:2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/async-await/in-trait/issue-104678.rs b/tests/ui/async-await/in-trait/issue-104678.rs index e396df4e5..3d010f180 100644 --- a/tests/ui/async-await/in-trait/issue-104678.rs +++ b/tests/ui/async-await/in-trait/issue-104678.rs @@ -1,5 +1,7 @@ // edition:2021 // check-pass +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/async-await/in-trait/lifetime-mismatch.current.stderr b/tests/ui/async-await/in-trait/lifetime-mismatch.current.stderr new file mode 100644 index 000000000..0e9477544 --- /dev/null +++ b/tests/ui/async-await/in-trait/lifetime-mismatch.current.stderr @@ -0,0 +1,21 @@ +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/lifetime-mismatch.rs:5:12 + | +LL | #![feature(async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration + --> $DIR/lifetime-mismatch.rs:14:17 + | +LL | async fn foo<'a>(&self); + | ---- lifetimes in impl do not match this method in trait +... +LL | async fn foo(&self) {} + | ^ lifetimes do not match method in trait + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0195`. diff --git a/tests/ui/async-await/in-trait/lifetime-mismatch.next.stderr b/tests/ui/async-await/in-trait/lifetime-mismatch.next.stderr new file mode 100644 index 000000000..0e9477544 --- /dev/null +++ b/tests/ui/async-await/in-trait/lifetime-mismatch.next.stderr @@ -0,0 +1,21 @@ +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/lifetime-mismatch.rs:5:12 + | +LL | #![feature(async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration + --> $DIR/lifetime-mismatch.rs:14:17 + | +LL | async fn foo<'a>(&self); + | ---- lifetimes in impl do not match this method in trait +... +LL | async fn foo(&self) {} + | ^ lifetimes do not match method in trait + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0195`. diff --git a/tests/ui/async-await/in-trait/lifetime-mismatch.rs b/tests/ui/async-await/in-trait/lifetime-mismatch.rs index 45ede193c..5ff5a01a1 100644 --- a/tests/ui/async-await/in-trait/lifetime-mismatch.rs +++ b/tests/ui/async-await/in-trait/lifetime-mismatch.rs @@ -1,4 +1,6 @@ // edition:2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] //~^ WARN the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes diff --git a/tests/ui/async-await/in-trait/lifetime-mismatch.stderr b/tests/ui/async-await/in-trait/lifetime-mismatch.stderr deleted file mode 100644 index d87adcc78..000000000 --- a/tests/ui/async-await/in-trait/lifetime-mismatch.stderr +++ /dev/null @@ -1,21 +0,0 @@ -warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/lifetime-mismatch.rs:3:12 - | -LL | #![feature(async_fn_in_trait)] - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #91611 for more information - = note: `#[warn(incomplete_features)]` on by default - -error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration - --> $DIR/lifetime-mismatch.rs:12:17 - | -LL | async fn foo<'a>(&self); - | ---- lifetimes in impl do not match this method in trait -... -LL | async fn foo(&self) {} - | ^ lifetimes do not match method in trait - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0195`. diff --git a/tests/ui/async-await/in-trait/missing-send-bound.current.stderr b/tests/ui/async-await/in-trait/missing-send-bound.current.stderr new file mode 100644 index 000000000..319ed582e --- /dev/null +++ b/tests/ui/async-await/in-trait/missing-send-bound.current.stderr @@ -0,0 +1,29 @@ +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/missing-send-bound.rs:5:12 + | +LL | #![feature(async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +error: future cannot be sent between threads safely + --> $DIR/missing-send-bound.rs:17:20 + | +LL | assert_is_send(test::()); + | ^^^^^^^^^^^ future returned by `test` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `impl Future` +note: future is not `Send` as it awaits another future which is not `Send` + --> $DIR/missing-send-bound.rs:13:5 + | +LL | T::bar().await; + | ^^^^^^^^ await occurs here on type `impl Future`, which is not `Send` +note: required by a bound in `assert_is_send` + --> $DIR/missing-send-bound.rs:21:27 + | +LL | fn assert_is_send(_: impl Send) {} + | ^^^^ required by this bound in `assert_is_send` + +error: aborting due to previous error; 1 warning emitted + diff --git a/tests/ui/async-await/in-trait/missing-send-bound.next.stderr b/tests/ui/async-await/in-trait/missing-send-bound.next.stderr new file mode 100644 index 000000000..319ed582e --- /dev/null +++ b/tests/ui/async-await/in-trait/missing-send-bound.next.stderr @@ -0,0 +1,29 @@ +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/missing-send-bound.rs:5:12 + | +LL | #![feature(async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +error: future cannot be sent between threads safely + --> $DIR/missing-send-bound.rs:17:20 + | +LL | assert_is_send(test::()); + | ^^^^^^^^^^^ future returned by `test` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `impl Future` +note: future is not `Send` as it awaits another future which is not `Send` + --> $DIR/missing-send-bound.rs:13:5 + | +LL | T::bar().await; + | ^^^^^^^^ await occurs here on type `impl Future`, which is not `Send` +note: required by a bound in `assert_is_send` + --> $DIR/missing-send-bound.rs:21:27 + | +LL | fn assert_is_send(_: impl Send) {} + | ^^^^ required by this bound in `assert_is_send` + +error: aborting due to previous error; 1 warning emitted + diff --git a/tests/ui/async-await/in-trait/missing-send-bound.rs b/tests/ui/async-await/in-trait/missing-send-bound.rs index 78922b59b..705fcf322 100644 --- a/tests/ui/async-await/in-trait/missing-send-bound.rs +++ b/tests/ui/async-await/in-trait/missing-send-bound.rs @@ -1,4 +1,6 @@ // edition:2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] //~^ WARN the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes diff --git a/tests/ui/async-await/in-trait/missing-send-bound.stderr b/tests/ui/async-await/in-trait/missing-send-bound.stderr deleted file mode 100644 index 5cedf3ddb..000000000 --- a/tests/ui/async-await/in-trait/missing-send-bound.stderr +++ /dev/null @@ -1,29 +0,0 @@ -warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/missing-send-bound.rs:3:12 - | -LL | #![feature(async_fn_in_trait)] - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #91611 for more information - = note: `#[warn(incomplete_features)]` on by default - -error: future cannot be sent between threads safely - --> $DIR/missing-send-bound.rs:15:20 - | -LL | assert_is_send(test::()); - | ^^^^^^^^^^^ future returned by `test` is not `Send` - | - = help: within `impl Future`, the trait `Send` is not implemented for `impl Future` -note: future is not `Send` as it awaits another future which is not `Send` - --> $DIR/missing-send-bound.rs:11:5 - | -LL | T::bar().await; - | ^^^^^^^^ await occurs here on type `impl Future`, which is not `Send` -note: required by a bound in `assert_is_send` - --> $DIR/missing-send-bound.rs:19:27 - | -LL | fn assert_is_send(_: impl Send) {} - | ^^^^ required by this bound in `assert_is_send` - -error: aborting due to previous error; 1 warning emitted - diff --git a/tests/ui/async-await/in-trait/object-safety.current.stderr b/tests/ui/async-await/in-trait/object-safety.current.stderr new file mode 100644 index 000000000..90e049a99 --- /dev/null +++ b/tests/ui/async-await/in-trait/object-safety.current.stderr @@ -0,0 +1,27 @@ +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/object-safety.rs:5:12 + | +LL | #![feature(async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/object-safety.rs:13:12 + | +LL | let x: &dyn Foo = todo!(); + | ^^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/object-safety.rs:9:14 + | +LL | trait Foo { + | --- this trait cannot be made into an object... +LL | async fn foo(&self); + | ^^^ ...because method `foo` is `async` + = help: consider moving `foo` to another trait + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/async-await/in-trait/object-safety.next.stderr b/tests/ui/async-await/in-trait/object-safety.next.stderr new file mode 100644 index 000000000..90e049a99 --- /dev/null +++ b/tests/ui/async-await/in-trait/object-safety.next.stderr @@ -0,0 +1,27 @@ +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/object-safety.rs:5:12 + | +LL | #![feature(async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/object-safety.rs:13:12 + | +LL | let x: &dyn Foo = todo!(); + | ^^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/object-safety.rs:9:14 + | +LL | trait Foo { + | --- this trait cannot be made into an object... +LL | async fn foo(&self); + | ^^^ ...because method `foo` is `async` + = help: consider moving `foo` to another trait + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/async-await/in-trait/object-safety.rs b/tests/ui/async-await/in-trait/object-safety.rs index a8bc35f7e..f67286a20 100644 --- a/tests/ui/async-await/in-trait/object-safety.rs +++ b/tests/ui/async-await/in-trait/object-safety.rs @@ -1,4 +1,6 @@ // edition:2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] //~^ WARN the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes diff --git a/tests/ui/async-await/in-trait/object-safety.stderr b/tests/ui/async-await/in-trait/object-safety.stderr deleted file mode 100644 index 0b318f71f..000000000 --- a/tests/ui/async-await/in-trait/object-safety.stderr +++ /dev/null @@ -1,27 +0,0 @@ -warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/object-safety.rs:3:12 - | -LL | #![feature(async_fn_in_trait)] - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #91611 for more information - = note: `#[warn(incomplete_features)]` on by default - -error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/object-safety.rs:11:12 - | -LL | let x: &dyn Foo = todo!(); - | ^^^^^^^^ `Foo` cannot be made into an object - | -note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit - --> $DIR/object-safety.rs:7:14 - | -LL | trait Foo { - | --- this trait cannot be made into an object... -LL | async fn foo(&self); - | ^^^ ...because method `foo` is `async` - = help: consider moving `foo` to another trait - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/async-await/in-trait/return-type-suggestion.current.stderr b/tests/ui/async-await/in-trait/return-type-suggestion.current.stderr new file mode 100644 index 000000000..a5efc7571 --- /dev/null +++ b/tests/ui/async-await/in-trait/return-type-suggestion.current.stderr @@ -0,0 +1,23 @@ +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/return-type-suggestion.rs:5:12 + | +LL | #![feature(async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0308]: mismatched types + --> $DIR/return-type-suggestion.rs:10:9 + | +LL | Ok(()) + | ^^^^^^- help: consider using a semicolon here: `;` + | | + | expected `()`, found `Result<(), _>` + | + = note: expected unit type `()` + found enum `Result<(), _>` + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/async-await/in-trait/return-type-suggestion.next.stderr b/tests/ui/async-await/in-trait/return-type-suggestion.next.stderr new file mode 100644 index 000000000..a5efc7571 --- /dev/null +++ b/tests/ui/async-await/in-trait/return-type-suggestion.next.stderr @@ -0,0 +1,23 @@ +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/return-type-suggestion.rs:5:12 + | +LL | #![feature(async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0308]: mismatched types + --> $DIR/return-type-suggestion.rs:10:9 + | +LL | Ok(()) + | ^^^^^^- help: consider using a semicolon here: `;` + | | + | expected `()`, found `Result<(), _>` + | + = note: expected unit type `()` + found enum `Result<(), _>` + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/async-await/in-trait/return-type-suggestion.rs b/tests/ui/async-await/in-trait/return-type-suggestion.rs index 3446761d1..3de66306d 100644 --- a/tests/ui/async-await/in-trait/return-type-suggestion.rs +++ b/tests/ui/async-await/in-trait/return-type-suggestion.rs @@ -1,4 +1,6 @@ // edition: 2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] //~^ WARN the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes diff --git a/tests/ui/async-await/in-trait/return-type-suggestion.stderr b/tests/ui/async-await/in-trait/return-type-suggestion.stderr deleted file mode 100644 index b8d83d0f2..000000000 --- a/tests/ui/async-await/in-trait/return-type-suggestion.stderr +++ /dev/null @@ -1,23 +0,0 @@ -warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/return-type-suggestion.rs:3:12 - | -LL | #![feature(async_fn_in_trait)] - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #91611 for more information - = note: `#[warn(incomplete_features)]` on by default - -error[E0308]: mismatched types - --> $DIR/return-type-suggestion.rs:8:9 - | -LL | Ok(()) - | ^^^^^^- help: consider using a semicolon here: `;` - | | - | expected `()`, found `Result<(), _>` - | - = note: expected unit type `()` - found enum `Result<(), _>` - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/async-await/issue-108572.rs b/tests/ui/async-await/issue-108572.rs new file mode 100644 index 000000000..efcb8b8eb --- /dev/null +++ b/tests/ui/async-await/issue-108572.rs @@ -0,0 +1,12 @@ +// edition: 2021 + +use std::future::Future; +fn foo() -> impl Future { + async { } +} + +fn main() { + let fut = foo(); + fut.poll(); + //~^ ERROR no method named `poll` found for opaque type `impl Future` in the current scope [E0599] +} diff --git a/tests/ui/async-await/issue-108572.stderr b/tests/ui/async-await/issue-108572.stderr new file mode 100644 index 000000000..0dbcf4d66 --- /dev/null +++ b/tests/ui/async-await/issue-108572.stderr @@ -0,0 +1,12 @@ +error[E0599]: no method named `poll` found for opaque type `impl Future` in the current scope + --> $DIR/issue-108572.rs:10:9 + | +LL | fut.poll(); + | ^^^^ method not found in `impl Future` + | + = help: method `poll` found on `Pin<&mut impl Future>`, see documentation for `std::pin::Pin` + = help: self type must be pinned to call `Future::poll`, see https://rust-lang.github.io/async-book/04_pinning/01_chapter.html#pinning-in-practice + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/async-await/large_moves.attribute.stderr b/tests/ui/async-await/large_moves.attribute.stderr index 0c5452475..94f61caa2 100644 --- a/tests/ui/async-await/large_moves.attribute.stderr +++ b/tests/ui/async-await/large_moves.attribute.stderr @@ -1,14 +1,8 @@ error: moving 10024 bytes - --> $DIR/large_moves.rs:13:13 + --> $DIR/large_moves.rs:19:14 | -LL | let x = async { - | _____________^ -LL | | let y = [0; 9999]; -LL | | dbg!(y); -LL | | thing(&y).await; -LL | | dbg!(y); -LL | | }; - | |_____^ value moved from here +LL | let z = (x, 42); + | ^ value moved from here | = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` note: the lint level is defined here @@ -17,14 +11,6 @@ note: the lint level is defined here LL | #![deny(large_assignments)] | ^^^^^^^^^^^^^^^^^ -error: moving 10024 bytes - --> $DIR/large_moves.rs:19:14 - | -LL | let z = (x, 42); - | ^ value moved from here - | - = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` - error: moving 10024 bytes --> $DIR/large_moves.rs:19:13 | @@ -41,5 +27,5 @@ LL | let a = z.0; | = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors diff --git a/tests/ui/async-await/large_moves.option.stderr b/tests/ui/async-await/large_moves.option.stderr index 0c5452475..94f61caa2 100644 --- a/tests/ui/async-await/large_moves.option.stderr +++ b/tests/ui/async-await/large_moves.option.stderr @@ -1,14 +1,8 @@ error: moving 10024 bytes - --> $DIR/large_moves.rs:13:13 + --> $DIR/large_moves.rs:19:14 | -LL | let x = async { - | _____________^ -LL | | let y = [0; 9999]; -LL | | dbg!(y); -LL | | thing(&y).await; -LL | | dbg!(y); -LL | | }; - | |_____^ value moved from here +LL | let z = (x, 42); + | ^ value moved from here | = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` note: the lint level is defined here @@ -17,14 +11,6 @@ note: the lint level is defined here LL | #![deny(large_assignments)] | ^^^^^^^^^^^^^^^^^ -error: moving 10024 bytes - --> $DIR/large_moves.rs:19:14 - | -LL | let z = (x, 42); - | ^ value moved from here - | - = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` - error: moving 10024 bytes --> $DIR/large_moves.rs:19:13 | @@ -41,5 +27,5 @@ LL | let a = z.0; | = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors diff --git a/tests/ui/async-await/large_moves.rs b/tests/ui/async-await/large_moves.rs index d43d0eec0..c8ed6bafe 100644 --- a/tests/ui/async-await/large_moves.rs +++ b/tests/ui/async-await/large_moves.rs @@ -10,7 +10,7 @@ // compile-flags: -Zmir-opt-level=0 fn main() { - let x = async { //~ ERROR large_assignments + let x = async { let y = [0; 9999]; dbg!(y); thing(&y).await; diff --git a/tests/ui/async-await/missed-capture-issue-107414.rs b/tests/ui/async-await/missed-capture-issue-107414.rs new file mode 100644 index 000000000..0ab4f5ade --- /dev/null +++ b/tests/ui/async-await/missed-capture-issue-107414.rs @@ -0,0 +1,24 @@ +// check-pass +// edition:2018 + +fn main() {} + +struct StructA {} +struct StructB {} + +impl StructA { + fn fn_taking_struct_b(&self, struct_b: &StructB) -> bool { + true + } +} + +async fn get_struct_a_async() -> StructA { + StructA {} +} + +async fn ice() { + match Some(StructB {}) { + Some(struct_b) if get_struct_a_async().await.fn_taking_struct_b(&struct_b) => {} + _ => {} + } +} diff --git a/tests/ui/async-await/no-const-async.rs b/tests/ui/async-await/no-const-async.rs index cfb0ef1b3..b3c59734e 100644 --- a/tests/ui/async-await/no-const-async.rs +++ b/tests/ui/async-await/no-const-async.rs @@ -3,4 +3,3 @@ pub const async fn x() {} //~^ ERROR functions cannot be both `const` and `async` -//~| ERROR cycle detected diff --git a/tests/ui/async-await/no-const-async.stderr b/tests/ui/async-await/no-const-async.stderr index 71c228958..90ec646c8 100644 --- a/tests/ui/async-await/no-const-async.stderr +++ b/tests/ui/async-await/no-const-async.stderr @@ -7,36 +7,5 @@ LL | pub const async fn x() {} | | `async` because of this | `const` because of this -error[E0391]: cycle detected when computing type of `x::{opaque#0}` - --> $DIR/no-const-async.rs:4:24 - | -LL | pub const async fn x() {} - | ^ - | -note: ...which requires borrow-checking `x`... - --> $DIR/no-const-async.rs:4:1 - | -LL | pub const async fn x() {} - | ^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires processing MIR for `x`... - --> $DIR/no-const-async.rs:4:1 - | -LL | pub const async fn x() {} - | ^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires const checking `x`... - --> $DIR/no-const-async.rs:4:1 - | -LL | pub const async fn x() {} - | ^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which requires computing whether `x::{opaque#0}` is freeze... - = note: ...which requires evaluating trait selection obligation `x::{opaque#0}: core::marker::Freeze`... - = note: ...which again requires computing type of `x::{opaque#0}`, completing the cycle -note: cycle used when checking item types in top-level module - --> $DIR/no-const-async.rs:4:1 - | -LL | pub const async fn x() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/async-await/pin-needed-to-poll-2.stderr b/tests/ui/async-await/pin-needed-to-poll-2.stderr index 0a6f705e2..61126faf8 100644 --- a/tests/ui/async-await/pin-needed-to-poll-2.stderr +++ b/tests/ui/async-await/pin-needed-to-poll-2.stderr @@ -6,7 +6,8 @@ LL | Pin::new(&mut self.sleep).poll(cx) | | | required by a bound introduced by this call | - = note: consider using `Box::pin` + = note: consider using the `pin!` macro + consider using `Box::pin` if you need to access the pinned value outside of the current scope note: required because it appears within the type `Sleep` --> $DIR/pin-needed-to-poll-2.rs:8:8 | diff --git a/tests/ui/async-await/task-context-arg.rs b/tests/ui/async-await/task-context-arg.rs new file mode 100644 index 000000000..937723ca7 --- /dev/null +++ b/tests/ui/async-await/task-context-arg.rs @@ -0,0 +1,25 @@ +// Checks that we don't get conflicting arguments in our debug info with a particular async function +// structure. + +// edition:2021 +// compile-flags: -Cdebuginfo=2 +// build-pass + +#![crate_type = "lib"] + +use std::future::Future; + +// The compiler produces a closure as part of this function. That closure initially takes an +// argument _task_context. Later, when the MIR for that closure is transformed into a generator +// state machine, _task_context is demoted to not be an argument, but just part of an unnamed +// argument. If we emit debug info saying that both _task_context and the unnamed argument are both +// argument number 2, then LLVM will fail with "conflicting debug info for argument". See +// https://github.com/rust-lang/rust/pull/109466#issuecomment-1500879195 for details. +async fn recv_unit() { + std::future::ready(()).await; +} + +pub fn poll_recv() { + // This box is necessary in order to reproduce the problem. + let _: Box> = Box::new(recv_unit()); +} diff --git a/tests/ui/async-await/track-caller/async-block.rs b/tests/ui/async-await/track-caller/async-block.rs index 8e81387c3..8ddd4ab11 100644 --- a/tests/ui/async-await/track-caller/async-block.rs +++ b/tests/ui/async-await/track-caller/async-block.rs @@ -1,9 +1,9 @@ // edition:2021 -#![feature(closure_track_caller, stmt_expr_attributes)] +#![feature(stmt_expr_attributes)] fn main() { let _ = #[track_caller] async { - //~^ ERROR attribute should be applied to a function definition [E0739] + //~^ ERROR `#[track_caller]` on closures is currently unstable [E0658] }; } diff --git a/tests/ui/async-await/track-caller/async-block.stderr b/tests/ui/async-await/track-caller/async-block.stderr index 407439921..21d1054d2 100644 --- a/tests/ui/async-await/track-caller/async-block.stderr +++ b/tests/ui/async-await/track-caller/async-block.stderr @@ -1,12 +1,12 @@ -error[E0739]: attribute should be applied to a function definition +error[E0658]: `#[track_caller]` on closures is currently unstable --> $DIR/async-block.rs:6:13 | -LL | let _ = #[track_caller] async { - | _____________^^^^^^^^^^^^^^^_- -LL | | -LL | | }; - | |_____- not a function definition +LL | let _ = #[track_caller] async { + | ^^^^^^^^^^^^^^^ + | + = note: see issue #87417 for more information + = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable error: aborting due to previous error -For more information about this error, try `rustc --explain E0739`. +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/async-await/track-caller/panic-track-caller.rs b/tests/ui/async-await/track-caller/panic-track-caller.rs index f45243b0e..65bb23e0b 100644 --- a/tests/ui/async-await/track-caller/panic-track-caller.rs +++ b/tests/ui/async-await/track-caller/panic-track-caller.rs @@ -79,6 +79,16 @@ async fn foo_closure() { c().await } +// Since compilation is expected to fail for this fn when using +// `nofeat`, we test that separately in `async-block.rs` +#[cfg(feat)] +async fn foo_block() { + let a = #[track_caller] async { + panic!(); + }; + a.await +} + fn panicked_at(f: impl FnOnce() + panic::UnwindSafe) -> u32 { let loc = Arc::new(Mutex::new(None)); @@ -110,4 +120,7 @@ fn main() { #[cfg(feat)] assert_eq!(panicked_at(|| block_on(foo_closure())), 79); + + #[cfg(feat)] + assert_eq!(panicked_at(|| block_on(foo_block())), 89); } diff --git a/tests/ui/attributes/issue-105594-invalid-attr-validation.rs b/tests/ui/attributes/issue-105594-invalid-attr-validation.rs index 6c68e6b04..096ce97ab 100644 --- a/tests/ui/attributes/issue-105594-invalid-attr-validation.rs +++ b/tests/ui/attributes/issue-105594-invalid-attr-validation.rs @@ -1,7 +1,7 @@ // This checks that the attribute validation ICE in issue #105594 doesn't // recur. // -// ignore-thumbv8m.base +// ignore-thumbv8m.base-none-eabi #![feature(cmse_nonsecure_entry)] fn main() {} diff --git a/tests/ui/attributes/no-mangle-closure.rs b/tests/ui/attributes/no-mangle-closure.rs new file mode 100644 index 000000000..c76baa27f --- /dev/null +++ b/tests/ui/attributes/no-mangle-closure.rs @@ -0,0 +1,11 @@ +// Check that we do not ICE when `no_mangle` is applied to something that has no name. + +#![crate_type = "lib"] +#![feature(stmt_expr_attributes)] + +pub struct S([usize; 8]); + +pub fn outer_function(x: S, y: S) -> usize { + (#[no_mangle] || y.0[0])() + //~^ ERROR `#[no_mangle]` cannot be used on a closure as it has no name +} diff --git a/tests/ui/attributes/no-mangle-closure.stderr b/tests/ui/attributes/no-mangle-closure.stderr new file mode 100644 index 000000000..949eb7051 --- /dev/null +++ b/tests/ui/attributes/no-mangle-closure.stderr @@ -0,0 +1,8 @@ +error: `#[no_mangle]` cannot be used on a closure as it has no name + --> $DIR/no-mangle-closure.rs:9:6 + | +LL | (#[no_mangle] || y.0[0])() + | ^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/auto-traits/suspicious-negative-impls-lint.rs b/tests/ui/auto-traits/suspicious-negative-impls-lint.rs new file mode 100644 index 000000000..34842e594 --- /dev/null +++ b/tests/ui/auto-traits/suspicious-negative-impls-lint.rs @@ -0,0 +1,21 @@ +#![feature(negative_impls)] +#![deny(suspicious_auto_trait_impls)] + +use std::marker::PhantomData; + +struct ContainsVec(Vec); +impl !Send for ContainsVec {} +//~^ ERROR +//~| WARNING this will change its meaning + +pub struct WithPhantomDataSend(PhantomData, U); +impl !Send for WithPhantomDataSend<*const T, u8> {} +//~^ ERROR +//~| WARNING this will change its meaning + +pub struct WithLifetime<'a, T>(&'a (), T); +impl !Sync for WithLifetime<'static, Option> {} +//~^ ERROR +//~| WARNING this will change its meaning + +fn main() {} diff --git a/tests/ui/auto-traits/suspicious-negative-impls-lint.stderr b/tests/ui/auto-traits/suspicious-negative-impls-lint.stderr new file mode 100644 index 000000000..ee03ea125 --- /dev/null +++ b/tests/ui/auto-traits/suspicious-negative-impls-lint.stderr @@ -0,0 +1,52 @@ +error: cross-crate traits with a default impl, like `Send`, should not be specialized + --> $DIR/suspicious-negative-impls-lint.rs:7:1 + | +LL | impl !Send for ContainsVec {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this will change its meaning in a future release! + = note: for more information, see issue #93367 + = note: `u32` is not a generic parameter +note: try using the same sequence of generic parameters as the struct definition + --> $DIR/suspicious-negative-impls-lint.rs:6:1 + | +LL | struct ContainsVec(Vec); + | ^^^^^^^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/suspicious-negative-impls-lint.rs:2:9 + | +LL | #![deny(suspicious_auto_trait_impls)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: cross-crate traits with a default impl, like `Send`, should not be specialized + --> $DIR/suspicious-negative-impls-lint.rs:12:1 + | +LL | impl !Send for WithPhantomDataSend<*const T, u8> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this will change its meaning in a future release! + = note: for more information, see issue #93367 + = note: `*const T` is not a generic parameter +note: try using the same sequence of generic parameters as the struct definition + --> $DIR/suspicious-negative-impls-lint.rs:11:1 + | +LL | pub struct WithPhantomDataSend(PhantomData, U); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: cross-crate traits with a default impl, like `Sync`, should not be specialized + --> $DIR/suspicious-negative-impls-lint.rs:17:1 + | +LL | impl !Sync for WithLifetime<'static, Option> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this will change its meaning in a future release! + = note: for more information, see issue #93367 + = note: `Option` is not a generic parameter +note: try using the same sequence of generic parameters as the struct definition + --> $DIR/suspicious-negative-impls-lint.rs:16:1 + | +LL | pub struct WithLifetime<'a, T>(&'a (), T); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/tests/ui/autoref-autoderef/issue-38940.rs b/tests/ui/autoref-autoderef/issue-38940.rs deleted file mode 100644 index d2f1c6e32..000000000 --- a/tests/ui/autoref-autoderef/issue-38940.rs +++ /dev/null @@ -1,52 +0,0 @@ -// issue-38940: error printed twice for deref recursion limit exceeded -// Test that the recursion limit can be changed. In this case, we have -// deeply nested types that will fail the `Send` check by overflow -// when the recursion limit is set very low. -// compile-flags: -Zdeduplicate-diagnostics=yes - -#![allow(dead_code)] -#![recursion_limit = "10"] -macro_rules! link { - ($outer:ident, $inner:ident) => { - struct $outer($inner); - impl $outer { - fn new() -> $outer { - $outer($inner::new()) - } - } - impl std::ops::Deref for $outer { - type Target = $inner; - fn deref(&self) -> &$inner { - &self.0 - } - } - }; -} - -struct Bottom; - -impl Bottom { - fn new() -> Bottom { - Bottom - } -} - -link!(Top, A); -link!(A, B); -link!(B, C); -link!(C, D); -link!(D, E); -link!(E, F); -link!(F, G); -link!(G, H); -link!(H, I); -link!(I, J); -link!(J, K); -link!(K, Bottom); - -fn main() { - let t = Top::new(); - let x: &Bottom = &t; - //~^ ERROR mismatched types - //~| ERROR reached the recursion limit while auto-dereferencing `J` -} diff --git a/tests/ui/autoref-autoderef/issue-38940.stderr b/tests/ui/autoref-autoderef/issue-38940.stderr deleted file mode 100644 index 8e98bfcd9..000000000 --- a/tests/ui/autoref-autoderef/issue-38940.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0055]: reached the recursion limit while auto-dereferencing `J` - --> $DIR/issue-38940.rs:49:22 - | -LL | let x: &Bottom = &t; - | ^^ deref recursion limit reached - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "20"]` attribute to your crate (`issue_38940`) - -error[E0308]: mismatched types - --> $DIR/issue-38940.rs:49:22 - | -LL | let x: &Bottom = &t; - | ------- ^^ expected `&Bottom`, found `&Top` - | | - | expected due to this - | - = note: expected reference `&Bottom` - found reference `&Top` - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0055, E0308. -For more information about an error, try `rustc --explain E0055`. diff --git a/tests/ui/auxiliary/issue-13560-1.rs b/tests/ui/auxiliary/issue-13560-1.rs new file mode 100644 index 000000000..c3a2ae679 --- /dev/null +++ b/tests/ui/auxiliary/issue-13560-1.rs @@ -0,0 +1,3 @@ +// no-prefer-dynamic + +#![crate_type = "dylib"] diff --git a/tests/ui/auxiliary/issue-13560-2.rs b/tests/ui/auxiliary/issue-13560-2.rs new file mode 100644 index 000000000..39c261e11 --- /dev/null +++ b/tests/ui/auxiliary/issue-13560-2.rs @@ -0,0 +1,3 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] diff --git a/tests/ui/auxiliary/issue-13560-3.rs b/tests/ui/auxiliary/issue-13560-3.rs new file mode 100644 index 000000000..e991bcc1a --- /dev/null +++ b/tests/ui/auxiliary/issue-13560-3.rs @@ -0,0 +1,6 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] + +#[macro_use] #[no_link] extern crate issue_13560_1 as t1; +#[macro_use] extern crate issue_13560_2 as t2; diff --git a/tests/ui/auxiliary/issue-16822.rs b/tests/ui/auxiliary/issue-16822.rs new file mode 100644 index 000000000..9042dd391 --- /dev/null +++ b/tests/ui/auxiliary/issue-16822.rs @@ -0,0 +1,20 @@ +#![crate_type="lib"] + +use std::cell::RefCell; + +pub struct Window{ + pub data: RefCell +} + +impl Window { + pub fn update(&self, e: i32) { + match e { + 1 => self.data.borrow_mut().update(), + _ => {} + } + } +} + +pub trait Update { + fn update(&mut self); +} diff --git a/tests/ui/auxiliary/issue-18502.rs b/tests/ui/auxiliary/issue-18502.rs new file mode 100644 index 000000000..4d4230607 --- /dev/null +++ b/tests/ui/auxiliary/issue-18502.rs @@ -0,0 +1,21 @@ +#![crate_type="lib"] + +struct Foo; +// This is the ICE trigger +struct Formatter; + +trait Show { + fn fmt(&self); +} + +impl Show for Foo { + fn fmt(&self) {} +} + +fn bar(f: extern "Rust" fn(&T), t: &T) { } + +// ICE requirement: this has to be marked as inline +#[inline] +pub fn baz() { + bar(Show::fmt, &Foo); +} diff --git a/tests/ui/auxiliary/issue-24106.rs b/tests/ui/auxiliary/issue-24106.rs new file mode 100644 index 000000000..2c6a60348 --- /dev/null +++ b/tests/ui/auxiliary/issue-24106.rs @@ -0,0 +1,13 @@ +#![crate_type="lib"] + +enum E { E0 = 0, E1 = 1 } +const E0_U8: u8 = E::E0 as u8; +const E1_U8: u8 = E::E1 as u8; + +pub fn go() { + match 0 { + E0_U8 => (), + E1_U8 => (), + _ => (), + } +} diff --git a/tests/ui/auxiliary/xc-private-method-lib.rs b/tests/ui/auxiliary/xc-private-method-lib.rs deleted file mode 100644 index 4d5ec6de3..000000000 --- a/tests/ui/auxiliary/xc-private-method-lib.rs +++ /dev/null @@ -1,33 +0,0 @@ -#![crate_type="lib"] - -pub struct Struct { - pub x: isize -} - -impl Struct { - fn static_meth_struct() -> Struct { - Struct { x: 1 } - } - - fn meth_struct(&self) -> isize { - self.x - } -} - -pub enum Enum { - Variant1(isize), - Variant2(isize) -} - -impl Enum { - fn static_meth_enum() -> Enum { - Enum::Variant2(10) - } - - fn meth_enum(&self) -> isize { - match *self { - Enum::Variant1(x) | - Enum::Variant2(x) => x - } - } -} diff --git a/tests/ui/binding/issue-53114-safety-checks.rs b/tests/ui/binding/issue-53114-safety-checks.rs index e234db516..f4be2b482 100644 --- a/tests/ui/binding/issue-53114-safety-checks.rs +++ b/tests/ui/binding/issue-53114-safety-checks.rs @@ -21,7 +21,7 @@ fn let_wild_gets_unsafe_field() { let u2 = U { a: I(1) }; let p = P { a: &2, b: &3 }; let _ = &p.b; //~ ERROR reference to packed field - let _ = u1.a; // #53114: should eventually signal error as well + let _ = u1.a; //~ ERROR [E0133] let _ = &u2.a; //~ ERROR [E0133] // variation on above with `_` in substructure @@ -30,6 +30,20 @@ fn let_wild_gets_unsafe_field() { let (_,) = (&u2.a,); //~ ERROR [E0133] } +fn let_ascribe_gets_unsafe_field() { + let u1 = U { a: I(0) }; + let u2 = U { a: I(1) }; + let p = P { a: &2, b: &3 }; + let _: _ = &p.b; //~ ERROR reference to packed field + let _: _ = u1.a; //~ ERROR [E0133] + let _: _ = &u2.a; //~ ERROR [E0133] + + // variation on above with `_` in substructure + let (_,): _ = (&p.b,); //~ ERROR reference to packed field + let (_,): _ = (u1.a,); //~ ERROR [E0133] + let (_,): _ = (&u2.a,); //~ ERROR [E0133] +} + fn match_unsafe_field_to_wild() { let u1 = U { a: I(0) }; let u2 = U { a: I(1) }; diff --git a/tests/ui/binding/issue-53114-safety-checks.stderr b/tests/ui/binding/issue-53114-safety-checks.stderr index 5c9d78772..41318d0a3 100644 --- a/tests/ui/binding/issue-53114-safety-checks.stderr +++ b/tests/ui/binding/issue-53114-safety-checks.stderr @@ -17,7 +17,25 @@ LL | let (_,) = (&p.b,); = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error[E0793]: reference to packed field is unaligned - --> $DIR/issue-53114-safety-checks.rs:37:11 + --> $DIR/issue-53114-safety-checks.rs:37:16 + | +LL | let _: _ = &p.b; + | ^^^^ + | + = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) + +error[E0793]: reference to packed field is unaligned + --> $DIR/issue-53114-safety-checks.rs:42:20 + | +LL | let (_,): _ = (&p.b,); + | ^^^^ + | + = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) + +error[E0793]: reference to packed field is unaligned + --> $DIR/issue-53114-safety-checks.rs:51:11 | LL | match &p.b { _ => { } } | ^^^^ @@ -26,7 +44,7 @@ LL | match &p.b { _ => { } } = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error[E0793]: reference to packed field is unaligned - --> $DIR/issue-53114-safety-checks.rs:42:12 + --> $DIR/issue-53114-safety-checks.rs:56:12 | LL | match (&p.b,) { (_,) => { } } | ^^^^ @@ -34,6 +52,14 @@ LL | match (&p.b,) { (_,) => { } } = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) +error[E0133]: access to union field is unsafe and requires unsafe function or block + --> $DIR/issue-53114-safety-checks.rs:24:13 + | +LL | let _ = u1.a; + | ^^^^ access to union field + | + = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior + error[E0133]: access to union field is unsafe and requires unsafe function or block --> $DIR/issue-53114-safety-checks.rs:25:13 | @@ -59,7 +85,39 @@ LL | let (_,) = (&u2.a,); = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/issue-53114-safety-checks.rs:38:11 + --> $DIR/issue-53114-safety-checks.rs:38:16 + | +LL | let _: _ = u1.a; + | ^^^^ access to union field + | + = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior + +error[E0133]: access to union field is unsafe and requires unsafe function or block + --> $DIR/issue-53114-safety-checks.rs:39:16 + | +LL | let _: _ = &u2.a; + | ^^^^^ access to union field + | + = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior + +error[E0133]: access to union field is unsafe and requires unsafe function or block + --> $DIR/issue-53114-safety-checks.rs:43:20 + | +LL | let (_,): _ = (u1.a,); + | ^^^^ access to union field + | + = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior + +error[E0133]: access to union field is unsafe and requires unsafe function or block + --> $DIR/issue-53114-safety-checks.rs:44:20 + | +LL | let (_,): _ = (&u2.a,); + | ^^^^^ access to union field + | + = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior + +error[E0133]: access to union field is unsafe and requires unsafe function or block + --> $DIR/issue-53114-safety-checks.rs:52:11 | LL | match u1.a { _ => { } } | ^^^^ access to union field @@ -67,7 +125,7 @@ LL | match u1.a { _ => { } } = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/issue-53114-safety-checks.rs:39:11 + --> $DIR/issue-53114-safety-checks.rs:53:11 | LL | match &u2.a { _ => { } } | ^^^^^ access to union field @@ -75,7 +133,7 @@ LL | match &u2.a { _ => { } } = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/issue-53114-safety-checks.rs:43:12 + --> $DIR/issue-53114-safety-checks.rs:57:12 | LL | match (u1.a,) { (_,) => { } } | ^^^^ access to union field @@ -83,14 +141,14 @@ LL | match (u1.a,) { (_,) => { } } = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/issue-53114-safety-checks.rs:44:12 + --> $DIR/issue-53114-safety-checks.rs:58:12 | LL | match (&u2.a,) { (_,) => { } } | ^^^^^ access to union field | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior -error: aborting due to 11 previous errors +error: aborting due to 18 previous errors Some errors have detailed explanations: E0133, E0793. For more information about an error, try `rustc --explain E0133`. diff --git a/tests/ui/binding/optional_comma_in_match_arm.rs b/tests/ui/binding/optional_comma_in_match_arm.rs index fc268bf2a..71e2f07bb 100644 --- a/tests/ui/binding/optional_comma_in_match_arm.rs +++ b/tests/ui/binding/optional_comma_in_match_arm.rs @@ -1,6 +1,5 @@ // run-pass #![allow(unused_unsafe)] -// ignore-pretty issue #37199 #![allow(while_true)] fn main() { diff --git a/tests/ui/binop/issue-28837.stderr b/tests/ui/binop/issue-28837.stderr index cca1da3b6..bb9f3b8af 100644 --- a/tests/ui/binop/issue-28837.stderr +++ b/tests/ui/binop/issue-28837.stderr @@ -157,7 +157,8 @@ LL | struct A; | ^^^^^^^^ must implement `PartialEq<_>` help: consider annotating `A` with `#[derive(PartialEq)]` | -LL | #[derive(PartialEq)] +LL + #[derive(PartialEq)] +LL | struct A; | error[E0369]: binary operation `!=` cannot be applied to type `A` @@ -175,7 +176,8 @@ LL | struct A; | ^^^^^^^^ must implement `PartialEq<_>` help: consider annotating `A` with `#[derive(PartialEq)]` | -LL | #[derive(PartialEq)] +LL + #[derive(PartialEq)] +LL | struct A; | error[E0369]: binary operation `<` cannot be applied to type `A` @@ -193,7 +195,8 @@ LL | struct A; | ^^^^^^^^ must implement `PartialOrd<_>` help: consider annotating `A` with `#[derive(PartialEq, PartialOrd)]` | -LL | #[derive(PartialEq, PartialOrd)] +LL + #[derive(PartialEq, PartialOrd)] +LL | struct A; | error[E0369]: binary operation `<=` cannot be applied to type `A` @@ -211,7 +214,8 @@ LL | struct A; | ^^^^^^^^ must implement `PartialOrd<_>` help: consider annotating `A` with `#[derive(PartialEq, PartialOrd)]` | -LL | #[derive(PartialEq, PartialOrd)] +LL + #[derive(PartialEq, PartialOrd)] +LL | struct A; | error[E0369]: binary operation `>` cannot be applied to type `A` @@ -229,7 +233,8 @@ LL | struct A; | ^^^^^^^^ must implement `PartialOrd<_>` help: consider annotating `A` with `#[derive(PartialEq, PartialOrd)]` | -LL | #[derive(PartialEq, PartialOrd)] +LL + #[derive(PartialEq, PartialOrd)] +LL | struct A; | error[E0369]: binary operation `>=` cannot be applied to type `A` @@ -247,7 +252,8 @@ LL | struct A; | ^^^^^^^^ must implement `PartialOrd<_>` help: consider annotating `A` with `#[derive(PartialEq, PartialOrd)]` | -LL | #[derive(PartialEq, PartialOrd)] +LL + #[derive(PartialEq, PartialOrd)] +LL | struct A; | error: aborting due to 15 previous errors diff --git a/tests/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr b/tests/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr index 5835f0675..0ca14c3f3 100644 --- a/tests/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr +++ b/tests/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr @@ -2,18 +2,16 @@ error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:36:9 | LL | ref foo @ [.., ref mut bar] => (), - | -------^^^^^^^^-----------^ - | | | - | | value is mutably borrowed by `bar` here + | ^^^^^^^ ----------- value is mutably borrowed by `bar` here + | | | value is borrowed by `foo` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:120:9 | LL | ref foo @ Some(box ref mut s) => (), - | -------^^^^^^^^^^^^---------^ - | | | - | | value is mutably borrowed by `s` here + | ^^^^^^^ --------- value is mutably borrowed by `s` here + | | | value is borrowed by `foo` here error[E0382]: borrow of moved value: `x` diff --git a/tests/ui/borrowck/borrowck-pat-enum.rs b/tests/ui/borrowck/borrowck-pat-enum.rs index 7f9c5544d..6e51a2b2e 100644 --- a/tests/ui/borrowck/borrowck-pat-enum.rs +++ b/tests/ui/borrowck/borrowck-pat-enum.rs @@ -1,6 +1,5 @@ // run-pass #![allow(dead_code)] -// ignore-pretty issue #37199 fn match_ref(v: Option) -> isize { match v { diff --git a/tests/ui/borrowck/borrowck-vec-pattern-nesting.rs b/tests/ui/borrowck/borrowck-vec-pattern-nesting.rs index 1bda7a497..127a3f5b2 100644 --- a/tests/ui/borrowck/borrowck-vec-pattern-nesting.rs +++ b/tests/ui/borrowck/borrowck-vec-pattern-nesting.rs @@ -8,6 +8,7 @@ fn a() { //~^ NOTE `vec[_]` is borrowed here vec[0] = Box::new(4); //~ ERROR cannot assign //~^ NOTE `vec[_]` is assigned to here + //~| NOTE in this expansion of desugaring of drop and replace _a.use_ref(); //~^ NOTE borrow later used here } @@ -22,6 +23,7 @@ fn b() { //~^ `vec[_]` is borrowed here vec[0] = Box::new(4); //~ ERROR cannot assign //~^ NOTE `vec[_]` is assigned to here + //~| NOTE in this expansion of desugaring of drop and replace _b.use_ref(); //~^ NOTE borrow later used here } diff --git a/tests/ui/borrowck/borrowck-vec-pattern-nesting.stderr b/tests/ui/borrowck/borrowck-vec-pattern-nesting.stderr index 70b9e4f44..5e1251b05 100644 --- a/tests/ui/borrowck/borrowck-vec-pattern-nesting.stderr +++ b/tests/ui/borrowck/borrowck-vec-pattern-nesting.stderr @@ -6,24 +6,24 @@ LL | [box ref _a, _, _] => { LL | LL | vec[0] = Box::new(4); | ^^^^^^ `vec[_]` is assigned to here but it was already borrowed -LL | +... LL | _a.use_ref(); | ------------ borrow later used here error[E0506]: cannot assign to `vec[_]` because it is borrowed - --> $DIR/borrowck-vec-pattern-nesting.rs:23:13 + --> $DIR/borrowck-vec-pattern-nesting.rs:24:13 | LL | &mut [ref _b @ ..] => { | ------ `vec[_]` is borrowed here LL | LL | vec[0] = Box::new(4); | ^^^^^^ `vec[_]` is assigned to here but it was already borrowed -LL | +... LL | _b.use_ref(); | ------------ borrow later used here error[E0508]: cannot move out of type `[Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:34:11 + --> $DIR/borrowck-vec-pattern-nesting.rs:36:11 | LL | match vec { | ^^^ cannot move out of here @@ -41,7 +41,7 @@ LL + [_a, | error[E0508]: cannot move out of type `[Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:46:13 + --> $DIR/borrowck-vec-pattern-nesting.rs:48:13 | LL | let a = vec[0]; | ^^^^^^ @@ -55,7 +55,7 @@ LL | let a = &vec[0]; | + error[E0508]: cannot move out of type `[Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:55:11 + --> $DIR/borrowck-vec-pattern-nesting.rs:57:11 | LL | match vec { | ^^^ cannot move out of here @@ -73,7 +73,7 @@ LL + [ | error[E0508]: cannot move out of type `[Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:65:13 + --> $DIR/borrowck-vec-pattern-nesting.rs:67:13 | LL | let a = vec[0]; | ^^^^^^ @@ -87,7 +87,7 @@ LL | let a = &vec[0]; | + error[E0508]: cannot move out of type `[Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:74:11 + --> $DIR/borrowck-vec-pattern-nesting.rs:76:11 | LL | match vec { | ^^^ cannot move out of here @@ -106,7 +106,7 @@ LL + [_a, _b, _c] => {} | error[E0508]: cannot move out of type `[Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:85:13 + --> $DIR/borrowck-vec-pattern-nesting.rs:87:13 | LL | let a = vec[0]; | ^^^^^^ diff --git a/tests/ui/borrowck/drop-in-loop.rs b/tests/ui/borrowck/drop-in-loop.rs new file mode 100644 index 000000000..866c27ef2 --- /dev/null +++ b/tests/ui/borrowck/drop-in-loop.rs @@ -0,0 +1,24 @@ +// A version of `issue-70919-drop-in-loop`, but without +// the necessary `drop` call. +// +// This should fail to compile, since the `Drop` impl +// for `WrapperWithDrop` could observe the changed +// `base` value. + +struct WrapperWithDrop<'a>(&'a mut bool); +impl<'a> Drop for WrapperWithDrop<'a> { + fn drop(&mut self) { + } +} + +fn drop_in_loop() { + let mut base = true; + let mut wrapper = WrapperWithDrop(&mut base); + loop { + base = false; //~ ERROR: cannot assign to `base` + wrapper = WrapperWithDrop(&mut base); + } +} + +fn main() { +} diff --git a/tests/ui/borrowck/drop-in-loop.stderr b/tests/ui/borrowck/drop-in-loop.stderr new file mode 100644 index 000000000..d5734e7ec --- /dev/null +++ b/tests/ui/borrowck/drop-in-loop.stderr @@ -0,0 +1,14 @@ +error[E0506]: cannot assign to `base` because it is borrowed + --> $DIR/drop-in-loop.rs:18:9 + | +LL | let mut wrapper = WrapperWithDrop(&mut base); + | --------- `base` is borrowed here +LL | loop { +LL | base = false; + | ^^^^^^^^^^^^ `base` is assigned to here but it was already borrowed +LL | wrapper = WrapperWithDrop(&mut base); + | ------- borrow might be used here, when `wrapper` is dropped and runs the `Drop` code for type `WrapperWithDrop` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/borrowck/issue-45199.rs b/tests/ui/borrowck/issue-45199.rs index ded46e56e..6a6b25541 100644 --- a/tests/ui/borrowck/issue-45199.rs +++ b/tests/ui/borrowck/issue-45199.rs @@ -5,6 +5,7 @@ fn test_drop_replace() { b = Box::new(1); //~ NOTE first assignment b = Box::new(2); //~ ERROR cannot assign twice to immutable variable `b` //~| NOTE cannot assign twice to immutable + //~| NOTE in this expansion of desugaring of drop and replace } fn test_call() { @@ -13,12 +14,14 @@ fn test_call() { //~| SUGGESTION mut b b = Box::new(2); //~ ERROR cannot assign twice to immutable variable `b` //~| NOTE cannot assign twice to immutable + //~| NOTE in this expansion of desugaring of drop and replace } fn test_args(b: Box) { //~ HELP consider making this binding mutable //~| SUGGESTION mut b b = Box::new(2); //~ ERROR cannot assign to immutable argument `b` //~| NOTE cannot assign to immutable argument + //~| NOTE in this expansion of desugaring of drop and replace } fn main() {} diff --git a/tests/ui/borrowck/issue-45199.stderr b/tests/ui/borrowck/issue-45199.stderr index 47aa30908..163f2370b 100644 --- a/tests/ui/borrowck/issue-45199.stderr +++ b/tests/ui/borrowck/issue-45199.stderr @@ -10,7 +10,7 @@ LL | b = Box::new(2); | ^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `b` - --> $DIR/issue-45199.rs:14:5 + --> $DIR/issue-45199.rs:15:5 | LL | let b = Box::new(1); | - @@ -22,7 +22,7 @@ LL | b = Box::new(2); | ^ cannot assign twice to immutable variable error[E0384]: cannot assign to immutable argument `b` - --> $DIR/issue-45199.rs:20:5 + --> $DIR/issue-45199.rs:22:5 | LL | fn test_args(b: Box) { | - help: consider making this binding mutable: `mut b` diff --git a/tests/ui/borrowck/issue-58776-borrowck-scans-children.rs b/tests/ui/borrowck/issue-58776-borrowck-scans-children.rs index efa313a9d..0b2372d12 100644 --- a/tests/ui/borrowck/issue-58776-borrowck-scans-children.rs +++ b/tests/ui/borrowck/issue-58776-borrowck-scans-children.rs @@ -5,7 +5,6 @@ fn main() { greeting = "DEALLOCATED".to_string(); //~^ ERROR cannot assign drop(greeting); - //~^ ERROR cannot move println!("thread result: {:?}", res); } diff --git a/tests/ui/borrowck/issue-58776-borrowck-scans-children.stderr b/tests/ui/borrowck/issue-58776-borrowck-scans-children.stderr index 0870b4237..967451c68 100644 --- a/tests/ui/borrowck/issue-58776-borrowck-scans-children.stderr +++ b/tests/ui/borrowck/issue-58776-borrowck-scans-children.stderr @@ -12,21 +12,6 @@ LL | greeting = "DEALLOCATED".to_string(); LL | println!("thread result: {:?}", res); | --- borrow later used here -error[E0505]: cannot move out of `greeting` because it is borrowed - --> $DIR/issue-58776-borrowck-scans-children.rs:7:10 - | -LL | let res = (|| (|| &greeting)())(); - | -- -------- borrow occurs due to use in closure - | | - | borrow of `greeting` occurs here -... -LL | drop(greeting); - | ^^^^^^^^ move out of `greeting` occurs here -... -LL | println!("thread result: {:?}", res); - | --- borrow later used here - -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors have detailed explanations: E0505, E0506. -For more information about an error, try `rustc --explain E0505`. +For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/borrowck/issue-64453.stderr b/tests/ui/borrowck/issue-64453.stderr index 245c3a40e..f032ea779 100644 --- a/tests/ui/borrowck/issue-64453.stderr +++ b/tests/ui/borrowck/issue-64453.stderr @@ -1,4 +1,4 @@ -error: `Arguments::<'a>::new_v1` is not yet stable as a const fn +error: `Arguments::<'a>::new_const` is not yet stable as a const fn --> $DIR/issue-64453.rs:4:31 | LL | static settings_dir: String = format!(""); diff --git a/tests/ui/borrowck/issue-70919-drop-in-loop.rs b/tests/ui/borrowck/issue-70919-drop-in-loop.rs new file mode 100644 index 000000000..a8d5849a3 --- /dev/null +++ b/tests/ui/borrowck/issue-70919-drop-in-loop.rs @@ -0,0 +1,25 @@ +// Regression test for issue #70919 +// Tests that we don't emit a spurious "borrow might be used" error +// when we have an explicit `drop` in a loop + +// check-pass + +struct WrapperWithDrop<'a>(&'a mut bool); +impl<'a> Drop for WrapperWithDrop<'a> { + fn drop(&mut self) { + } +} + +fn drop_in_loop() { + let mut base = true; + let mut wrapper = WrapperWithDrop(&mut base); + loop { + drop(wrapper); + + base = false; + wrapper = WrapperWithDrop(&mut base); + } +} + +fn main() { +} diff --git a/tests/ui/borrowck/let_underscore_temporary.rs b/tests/ui/borrowck/let_underscore_temporary.rs new file mode 100644 index 000000000..37b5c5d9d --- /dev/null +++ b/tests/ui/borrowck/let_underscore_temporary.rs @@ -0,0 +1,27 @@ +// check-pass + +fn let_underscore(string: &Option<&str>, mut num: Option) { + let _ = if let Some(s) = *string { s.len() } else { 0 }; + let _ = if let Some(s) = &num { s } else { &0 }; + let _ = if let Some(s) = &mut num { + *s += 1; + s + } else { + &mut 0 + }; + let _ = if let Some(ref s) = num { s } else { &0 }; + let _ = if let Some(mut s) = num { + s += 1; + s + } else { + 0 + }; + let _ = if let Some(ref mut s) = num { + *s += 1; + s + } else { + &mut 0 + }; +} + +fn main() {} diff --git a/tests/ui/box/unit/expr-block-generic-unique1.rs b/tests/ui/box/unit/expr-block-generic-unique1.rs new file mode 100644 index 000000000..14603a2c7 --- /dev/null +++ b/tests/ui/box/unit/expr-block-generic-unique1.rs @@ -0,0 +1,18 @@ +// run-pass +#![allow(unused_braces)] + +fn test_generic(expected: Box, eq: F) where T: Clone, F: FnOnce(Box, Box) -> bool { + let actual: Box = { expected.clone() }; + assert!(eq(expected, actual)); +} + +fn test_box() { + fn compare_box(b1: Box, b2: Box) -> bool { + println!("{}", *b1); + println!("{}", *b2); + return *b1 == *b2; + } + test_generic::(Box::new(true), compare_box); +} + +pub fn main() { test_box(); } diff --git a/tests/ui/box/unit/expr-block-generic-unique2.rs b/tests/ui/box/unit/expr-block-generic-unique2.rs new file mode 100644 index 000000000..7879c144b --- /dev/null +++ b/tests/ui/box/unit/expr-block-generic-unique2.rs @@ -0,0 +1,14 @@ +// run-pass +#![allow(unused_braces)] + +fn test_generic(expected: T, eq: F) where T: Clone, F: FnOnce(T, T) -> bool { + let actual: T = { expected.clone() }; + assert!(eq(expected, actual)); +} + +fn test_vec() { + fn compare_vec(v1: Box, v2: Box) -> bool { return v1 == v2; } + test_generic::, _>(Box::new(1), compare_vec); +} + +pub fn main() { test_vec(); } diff --git a/tests/ui/box/unit/expr-if-unique.rs b/tests/ui/box/unit/expr-if-unique.rs new file mode 100644 index 000000000..862326835 --- /dev/null +++ b/tests/ui/box/unit/expr-if-unique.rs @@ -0,0 +1,9 @@ +// run-pass + +// Tests for if as expressions returning boxed types +fn test_box() { + let rs: Box<_> = if true { Box::new(100) } else { Box::new(101) }; + assert_eq!(*rs, 100); +} + +pub fn main() { test_box(); } diff --git a/tests/ui/box/unit/unique-assign-copy.rs b/tests/ui/box/unit/unique-assign-copy.rs new file mode 100644 index 000000000..b742973ce --- /dev/null +++ b/tests/ui/box/unit/unique-assign-copy.rs @@ -0,0 +1,12 @@ +// run-pass + +pub fn main() { + let mut i: Box<_> = Box::new(1); + // Should be a copy + let mut j; + j = i.clone(); + *i = 2; + *j = 3; + assert_eq!(*i, 2); + assert_eq!(*j, 3); +} diff --git a/tests/ui/box/unit/unique-assign-drop.rs b/tests/ui/box/unit/unique-assign-drop.rs new file mode 100644 index 000000000..e7685b589 --- /dev/null +++ b/tests/ui/box/unit/unique-assign-drop.rs @@ -0,0 +1,10 @@ +// run-pass +#![allow(unused_assignments)] + +pub fn main() { + let i: Box<_> = Box::new(1); + let mut j: Box<_> = Box::new(2); + // Should drop the previous value of j + j = i; + assert_eq!(*j, 1); +} diff --git a/tests/ui/box/unit/unique-assign-generic.rs b/tests/ui/box/unit/unique-assign-generic.rs new file mode 100644 index 000000000..d4932d833 --- /dev/null +++ b/tests/ui/box/unit/unique-assign-generic.rs @@ -0,0 +1,11 @@ +// run-pass + +fn f(t: T) -> T { + let t1 = t; + t1 +} + +pub fn main() { + let t = f::>(Box::new(100)); + assert_eq!(t, Box::new(100)); +} diff --git a/tests/ui/box/unit/unique-assign.rs b/tests/ui/box/unit/unique-assign.rs new file mode 100644 index 000000000..d598744f1 --- /dev/null +++ b/tests/ui/box/unit/unique-assign.rs @@ -0,0 +1,8 @@ +// run-pass +#![allow(unused_mut)] + +pub fn main() { + let mut i: Box<_>; + i = Box::new(1); + assert_eq!(*i, 1); +} diff --git a/tests/ui/box/unit/unique-autoderef-field.rs b/tests/ui/box/unit/unique-autoderef-field.rs new file mode 100644 index 000000000..64147e11f --- /dev/null +++ b/tests/ui/box/unit/unique-autoderef-field.rs @@ -0,0 +1,10 @@ +// run-pass + +struct J { j: isize } + +pub fn main() { + let i: Box<_> = Box::new(J { + j: 100 + }); + assert_eq!(i.j, 100); +} diff --git a/tests/ui/box/unit/unique-autoderef-index.rs b/tests/ui/box/unit/unique-autoderef-index.rs new file mode 100644 index 000000000..ea6598a7f --- /dev/null +++ b/tests/ui/box/unit/unique-autoderef-index.rs @@ -0,0 +1,6 @@ +// run-pass + +pub fn main() { + let i: Box<_> = Box::new(vec![100]); + assert_eq!((*i)[0], 100); +} diff --git a/tests/ui/box/unit/unique-cmp.rs b/tests/ui/box/unit/unique-cmp.rs new file mode 100644 index 000000000..ee05dd5a3 --- /dev/null +++ b/tests/ui/box/unit/unique-cmp.rs @@ -0,0 +1,11 @@ +// run-pass +#![allow(unused_allocation)] + +pub fn main() { + let i: Box<_> = Box::new(100); + assert_eq!(i, Box::new(100)); + assert!(i < Box::new(101)); + assert!(i <= Box::new(100)); + assert!(i > Box::new(99)); + assert!(i >= Box::new(99)); +} diff --git a/tests/ui/box/unit/unique-containing-tag.rs b/tests/ui/box/unit/unique-containing-tag.rs new file mode 100644 index 000000000..6c31ae99b --- /dev/null +++ b/tests/ui/box/unit/unique-containing-tag.rs @@ -0,0 +1,25 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +pub fn main() { + enum t { t1(isize), t2(isize), } + + let _x: Box<_> = Box::new(t::t1(10)); + + /*alt *x { + t1(a) { + assert_eq!(a, 10); + } + _ { panic!(); } + }*/ + + /*alt x { + Box::new(t1(a) { + assert_eq!(a, 10); + }) + _ { panic!(); } + }*/ +} diff --git a/tests/ui/box/unit/unique-create.rs b/tests/ui/box/unit/unique-create.rs new file mode 100644 index 000000000..c566e7962 --- /dev/null +++ b/tests/ui/box/unit/unique-create.rs @@ -0,0 +1,11 @@ +// run-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +pub fn main() { + let _: Box<_> = Box::new(100); +} + +fn vec() { + vec![0]; +} diff --git a/tests/ui/box/unit/unique-decl-init-copy.rs b/tests/ui/box/unit/unique-decl-init-copy.rs new file mode 100644 index 000000000..5b9576fcc --- /dev/null +++ b/tests/ui/box/unit/unique-decl-init-copy.rs @@ -0,0 +1,11 @@ +// run-pass + +pub fn main() { + let mut i: Box<_> = Box::new(1); + // Should be a copy + let mut j = i.clone(); + *i = 2; + *j = 3; + assert_eq!(*i, 2); + assert_eq!(*j, 3); +} diff --git a/tests/ui/box/unit/unique-decl-init.rs b/tests/ui/box/unit/unique-decl-init.rs new file mode 100644 index 000000000..1d70860c7 --- /dev/null +++ b/tests/ui/box/unit/unique-decl-init.rs @@ -0,0 +1,7 @@ +// run-pass + +pub fn main() { + let i: Box<_> = Box::new(1); + let j = i; + assert_eq!(*j, 1); +} diff --git a/tests/ui/box/unit/unique-decl-move.rs b/tests/ui/box/unit/unique-decl-move.rs new file mode 100644 index 000000000..21187510f --- /dev/null +++ b/tests/ui/box/unit/unique-decl-move.rs @@ -0,0 +1,7 @@ +// run-pass + +pub fn main() { + let i: Box<_> = Box::new(100); + let j = i; + assert_eq!(*j, 100); +} diff --git a/tests/ui/box/unit/unique-decl.rs b/tests/ui/box/unit/unique-decl.rs new file mode 100644 index 000000000..84a1b2a5b --- /dev/null +++ b/tests/ui/box/unit/unique-decl.rs @@ -0,0 +1,11 @@ +// run-pass +#![allow(dead_code)] + + +pub fn main() { + let _: Box; +} + +fn f(_i: Box) -> Box { + panic!(); +} diff --git a/tests/ui/box/unit/unique-deref.rs b/tests/ui/box/unit/unique-deref.rs new file mode 100644 index 000000000..33a1e9932 --- /dev/null +++ b/tests/ui/box/unit/unique-deref.rs @@ -0,0 +1,6 @@ +// run-pass + +pub fn main() { + let i: Box<_> = Box::new(100); + assert_eq!(*i, 100); +} diff --git a/tests/ui/box/unit/unique-destructure.rs b/tests/ui/box/unit/unique-destructure.rs new file mode 100644 index 000000000..7207ac962 --- /dev/null +++ b/tests/ui/box/unit/unique-destructure.rs @@ -0,0 +1,9 @@ +// run-pass +#![feature(box_patterns)] + +struct Foo { a: isize, b: isize } + +pub fn main() { + let box Foo{ a, b } = Box::new(Foo { a: 100, b: 200 }); + assert_eq!(a + b, 300); +} diff --git a/tests/ui/box/unit/unique-drop-complex.rs b/tests/ui/box/unit/unique-drop-complex.rs new file mode 100644 index 000000000..2324f1e1a --- /dev/null +++ b/tests/ui/box/unit/unique-drop-complex.rs @@ -0,0 +1,6 @@ +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main() { + let _x: Box<_> = Box::new(vec![0,0,0,0,0]); +} diff --git a/tests/ui/box/unit/unique-ffi-symbols.rs b/tests/ui/box/unit/unique-ffi-symbols.rs new file mode 100644 index 000000000..77b5ead26 --- /dev/null +++ b/tests/ui/box/unit/unique-ffi-symbols.rs @@ -0,0 +1,16 @@ +// run-pass +// We used to have a __rust_abi shim that resulted in duplicated symbols +// whenever the item path wasn't enough to disambiguate between them. +fn main() { + let a = { + extern "C" fn good() -> i32 { return 0; } + good as extern "C" fn() -> i32 + }; + let b = { + extern "C" fn good() -> i32 { return 5; } + good as extern "C" fn() -> i32 + }; + + assert!(a != b); + assert_eq!((a(), b()), (0, 5)); +} diff --git a/tests/ui/box/unit/unique-fn-arg-move.rs b/tests/ui/box/unit/unique-fn-arg-move.rs new file mode 100644 index 000000000..6d42df218 --- /dev/null +++ b/tests/ui/box/unit/unique-fn-arg-move.rs @@ -0,0 +1,10 @@ +// run-pass + +fn f(i: Box) { + assert_eq!(*i, 100); +} + +pub fn main() { + let i = Box::new(100); + f(i); +} diff --git a/tests/ui/box/unit/unique-fn-arg-mut.rs b/tests/ui/box/unit/unique-fn-arg-mut.rs new file mode 100644 index 000000000..01510200b --- /dev/null +++ b/tests/ui/box/unit/unique-fn-arg-mut.rs @@ -0,0 +1,11 @@ +// run-pass + +fn f(i: &mut Box) { + *i = Box::new(200); +} + +pub fn main() { + let mut i = Box::new(100); + f(&mut i); + assert_eq!(*i, 200); +} diff --git a/tests/ui/box/unit/unique-fn-arg.rs b/tests/ui/box/unit/unique-fn-arg.rs new file mode 100644 index 000000000..b4f3bc4b2 --- /dev/null +++ b/tests/ui/box/unit/unique-fn-arg.rs @@ -0,0 +1,11 @@ +// run-pass + +fn f(i: Box) { + assert_eq!(*i, 100); +} + +pub fn main() { + f(Box::new(100)); + let i = Box::new(100); + f(i); +} diff --git a/tests/ui/box/unit/unique-fn-ret.rs b/tests/ui/box/unit/unique-fn-ret.rs new file mode 100644 index 000000000..773a9bce1 --- /dev/null +++ b/tests/ui/box/unit/unique-fn-ret.rs @@ -0,0 +1,9 @@ +// run-pass + +fn f() -> Box { + Box::new(100) +} + +pub fn main() { + assert_eq!(f(), Box::new(100)); +} diff --git a/tests/ui/box/unit/unique-generic-assign.rs b/tests/ui/box/unit/unique-generic-assign.rs new file mode 100644 index 000000000..9c4405aa8 --- /dev/null +++ b/tests/ui/box/unit/unique-generic-assign.rs @@ -0,0 +1,11 @@ +// run-pass +#![allow(dead_code)] +// Issue #976 + + +// pretty-expanded FIXME #23616 + +fn f(x: Box) { + let _x2 = x; +} +pub fn main() { } diff --git a/tests/ui/box/unit/unique-in-tag.rs b/tests/ui/box/unit/unique-in-tag.rs new file mode 100644 index 000000000..6daa06fb1 --- /dev/null +++ b/tests/ui/box/unit/unique-in-tag.rs @@ -0,0 +1,20 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] + +fn test1() { + enum bar { u(Box), w(isize), } + + let x = bar::u(Box::new(10)); + assert!(match x { + bar::u(a) => { + println!("{}", a); + *a + } + _ => { 66 } + } == 10); +} + +pub fn main() { + test1(); +} diff --git a/tests/ui/box/unit/unique-in-vec-copy.rs b/tests/ui/box/unit/unique-in-vec-copy.rs new file mode 100644 index 000000000..ce52d15ef --- /dev/null +++ b/tests/ui/box/unit/unique-in-vec-copy.rs @@ -0,0 +1,15 @@ +// run-pass + +pub fn main() { + let mut a: Vec> = vec![Box::new(10)]; + let b = a.clone(); + + assert_eq!(*a[0], 10); + assert_eq!(*b[0], 10); + + // This should only modify the value in a, not b + *a[0] = 20; + + assert_eq!(*a[0], 20); + assert_eq!(*b[0], 10); +} diff --git a/tests/ui/box/unit/unique-in-vec.rs b/tests/ui/box/unit/unique-in-vec.rs new file mode 100644 index 000000000..1e8d05e3d --- /dev/null +++ b/tests/ui/box/unit/unique-in-vec.rs @@ -0,0 +1,6 @@ +// run-pass + +pub fn main() { + let vect : Vec> = vec![Box::new(100)]; + assert_eq!(vect[0], Box::new(100)); +} diff --git a/tests/ui/box/unit/unique-init.rs b/tests/ui/box/unit/unique-init.rs new file mode 100644 index 000000000..d19605046 --- /dev/null +++ b/tests/ui/box/unit/unique-init.rs @@ -0,0 +1,6 @@ +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main() { + let _i: Box<_> = Box::new(100); +} diff --git a/tests/ui/box/unit/unique-kinds.rs b/tests/ui/box/unit/unique-kinds.rs new file mode 100644 index 000000000..f02d0b507 --- /dev/null +++ b/tests/ui/box/unit/unique-kinds.rs @@ -0,0 +1,64 @@ +// run-pass + +use std::cmp::PartialEq; +use std::fmt::Debug; + +fn sendable() { + + fn f(i: T, j: T) { + assert_eq!(i, j); + } + + fn g(i: T, j: T) { + assert!(i != j); + } + + let i: Box<_> = Box::new(100); + let j: Box<_> = Box::new(100); + f(i, j); + let i: Box<_> = Box::new(100); + let j: Box<_> = Box::new(101); + g(i, j); +} + +fn copyable() { + + fn f(i: T, j: T) { + assert_eq!(i, j); + } + + fn g(i: T, j: T) { + assert!(i != j); + } + + let i: Box<_> = Box::new(100); + let j: Box<_> = Box::new(100); + f(i, j); + let i: Box<_> = Box::new(100); + let j: Box<_> = Box::new(101); + g(i, j); +} + +fn noncopyable() { + + fn f(i: T, j: T) { + assert_eq!(i, j); + } + + fn g(i: T, j: T) { + assert!(i != j); + } + + let i: Box<_> = Box::new(100); + let j: Box<_> = Box::new(100); + f(i, j); + let i: Box<_> = Box::new(100); + let j: Box<_> = Box::new(101); + g(i, j); +} + +pub fn main() { + sendable(); + copyable(); + noncopyable(); +} diff --git a/tests/ui/box/unit/unique-log.rs b/tests/ui/box/unit/unique-log.rs new file mode 100644 index 000000000..0715d1662 --- /dev/null +++ b/tests/ui/box/unit/unique-log.rs @@ -0,0 +1,6 @@ +// run-pass + +pub fn main() { + let i: Box<_> = Box::new(100); + println!("{}", i); +} diff --git a/tests/ui/box/unit/unique-match-discrim.rs b/tests/ui/box/unit/unique-match-discrim.rs new file mode 100644 index 000000000..6e6d74322 --- /dev/null +++ b/tests/ui/box/unit/unique-match-discrim.rs @@ -0,0 +1,12 @@ +// run-pass +#![allow(dead_code)] +// Issue #961 + +// pretty-expanded FIXME #23616 + +fn altsimple() { + match Box::new(true) { + _ => { } + } +} +pub fn main() { } diff --git a/tests/ui/box/unit/unique-move-drop.rs b/tests/ui/box/unit/unique-move-drop.rs new file mode 100644 index 000000000..c0f5d8f90 --- /dev/null +++ b/tests/ui/box/unit/unique-move-drop.rs @@ -0,0 +1,10 @@ +// run-pass + +#![allow(unused_variables)] + +pub fn main() { + let i: Box<_> = Box::new(100); + let j: Box<_> = Box::new(200); + let j = i; + assert_eq!(*j, 100); +} diff --git a/tests/ui/box/unit/unique-move-temp.rs b/tests/ui/box/unit/unique-move-temp.rs new file mode 100644 index 000000000..103af8e1f --- /dev/null +++ b/tests/ui/box/unit/unique-move-temp.rs @@ -0,0 +1,8 @@ +// run-pass +#![allow(unused_mut)] + +pub fn main() { + let mut i: Box<_>; + i = Box::new(100); + assert_eq!(*i, 100); +} diff --git a/tests/ui/box/unit/unique-move.rs b/tests/ui/box/unit/unique-move.rs new file mode 100644 index 000000000..40a2718e4 --- /dev/null +++ b/tests/ui/box/unit/unique-move.rs @@ -0,0 +1,9 @@ +// run-pass +#![allow(unused_mut)] + +pub fn main() { + let i: Box<_> = Box::new(100); + let mut j; + j = i; + assert_eq!(*j, 100); +} diff --git a/tests/ui/box/unit/unique-mutable.rs b/tests/ui/box/unit/unique-mutable.rs new file mode 100644 index 000000000..0367c0809 --- /dev/null +++ b/tests/ui/box/unit/unique-mutable.rs @@ -0,0 +1,7 @@ +// run-pass + +pub fn main() { + let mut i: Box<_> = Box::new(0); + *i = 1; + assert_eq!(*i, 1); +} diff --git a/tests/ui/box/unit/unique-object-move.rs b/tests/ui/box/unit/unique-object-move.rs new file mode 100644 index 000000000..bb35a9b2d --- /dev/null +++ b/tests/ui/box/unit/unique-object-move.rs @@ -0,0 +1,18 @@ +// run-pass +#![allow(dead_code)] +// Issue #5192 + +// pretty-expanded FIXME #23616 + +pub trait EventLoop { fn foo(&self) {} } + +pub struct UvEventLoop { + uvio: isize +} + +impl EventLoop for UvEventLoop { } + +pub fn main() { + let loop_: Box = Box::new(UvEventLoop { uvio: 0 }) as Box; + let _loop2_ = loop_; +} diff --git a/tests/ui/box/unit/unique-object-noncopyable.rs b/tests/ui/box/unit/unique-object-noncopyable.rs new file mode 100644 index 000000000..2c40dfc7a --- /dev/null +++ b/tests/ui/box/unit/unique-object-noncopyable.rs @@ -0,0 +1,25 @@ +trait Foo { + fn f(&self); +} + +struct Bar { + x: isize, +} + +impl Drop for Bar { + fn drop(&mut self) {} +} + +impl Foo for Bar { + fn f(&self) { + println!("hi"); + } +} + + + +fn main() { + let x = Box::new(Bar { x: 10 }); + let y: Box = x as Box; + let _z = y.clone(); //~ ERROR the method +} diff --git a/tests/ui/box/unit/unique-object-noncopyable.stderr b/tests/ui/box/unit/unique-object-noncopyable.stderr new file mode 100644 index 000000000..db42ed9ba --- /dev/null +++ b/tests/ui/box/unit/unique-object-noncopyable.stderr @@ -0,0 +1,25 @@ +error[E0599]: the method `clone` exists for struct `Box`, but its trait bounds were not satisfied + --> $DIR/unique-object-noncopyable.rs:24:16 + | +LL | trait Foo { + | --------- + | | + | doesn't satisfy `dyn Foo: Clone` + | doesn't satisfy `dyn Foo: Sized` +... +LL | let _z = y.clone(); + | ^^^^^ method cannot be called on `Box` due to unsatisfied trait bounds + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL + ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL + | + = note: doesn't satisfy `Box: Clone` + | + = note: the following trait bounds were not satisfied: + `dyn Foo: Sized` + which is required by `Box: Clone` + `dyn Foo: Clone` + which is required by `Box: Clone` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/box/unit/unique-pat-2.rs b/tests/ui/box/unit/unique-pat-2.rs new file mode 100644 index 000000000..9c73fd220 --- /dev/null +++ b/tests/ui/box/unit/unique-pat-2.rs @@ -0,0 +1,18 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] +#![allow(non_shorthand_field_patterns)] + +#![feature(box_patterns)] + +struct Foo {a: isize, b: usize} + +enum bar { u(Box), w(isize), } + +pub fn main() { + let v = match bar::u(Box::new(Foo{ a: 10, b: 40 })) { + bar::u(box Foo{ a: a, b: b }) => { a + (b as isize) } + _ => { 66 } + }; + assert_eq!(v, 50); +} diff --git a/tests/ui/box/unit/unique-pat-3.rs b/tests/ui/box/unit/unique-pat-3.rs new file mode 100644 index 000000000..2e81f898d --- /dev/null +++ b/tests/ui/box/unit/unique-pat-3.rs @@ -0,0 +1,16 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] + +enum bar { u(Box), w(isize), } + +pub fn main() { + let v = match bar::u(10.into()) { + bar::u(a) => { + println!("{}", a); + *a + } + _ => { 66 } + }; + assert_eq!(v, 10); +} diff --git a/tests/ui/box/unit/unique-pat.rs b/tests/ui/box/unit/unique-pat.rs new file mode 100644 index 000000000..c2474d0e7 --- /dev/null +++ b/tests/ui/box/unit/unique-pat.rs @@ -0,0 +1,14 @@ +// run-pass + +#![feature(box_patterns)] + +fn simple() { + match Box::new(true) { + box true => { } + _ => { panic!(); } + } +} + +pub fn main() { + simple(); +} diff --git a/tests/ui/box/unit/unique-pinned-nocopy.rs b/tests/ui/box/unit/unique-pinned-nocopy.rs new file mode 100644 index 000000000..8edaeef51 --- /dev/null +++ b/tests/ui/box/unit/unique-pinned-nocopy.rs @@ -0,0 +1,14 @@ +#[derive(Debug)] +struct R { + b: bool, +} + +impl Drop for R { + fn drop(&mut self) {} +} + +fn main() { + let i = Box::new(R { b: true }); + let _j = i.clone(); //~ ERROR the method + println!("{:?}", i); +} diff --git a/tests/ui/box/unit/unique-pinned-nocopy.stderr b/tests/ui/box/unit/unique-pinned-nocopy.stderr new file mode 100644 index 000000000..2fd5b0d82 --- /dev/null +++ b/tests/ui/box/unit/unique-pinned-nocopy.stderr @@ -0,0 +1,28 @@ +error[E0599]: the method `clone` exists for struct `Box`, but its trait bounds were not satisfied + --> $DIR/unique-pinned-nocopy.rs:12:16 + | +LL | struct R { + | -------- doesn't satisfy `R: Clone` +... +LL | let _j = i.clone(); + | ^^^^^ method cannot be called on `Box` due to unsatisfied trait bounds + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL + ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL + | + = note: doesn't satisfy `Box: Clone` + | + = note: the following trait bounds were not satisfied: + `R: Clone` + which is required by `Box: Clone` + = help: items from traits can only be used if the trait is implemented and in scope + = note: the following trait defines an item `clone`, perhaps you need to implement it: + candidate #1: `Clone` +help: consider annotating `R` with `#[derive(Clone)]` + | +LL + #[derive(Clone)] +LL | struct R { + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/box/unit/unique-rec.rs b/tests/ui/box/unit/unique-rec.rs new file mode 100644 index 000000000..9f8ad9bb0 --- /dev/null +++ b/tests/ui/box/unit/unique-rec.rs @@ -0,0 +1,9 @@ +// run-pass + +struct X { x: isize } + +pub fn main() { + let x: Box<_> = Box::new(X {x: 1}); + let bar = x; + assert_eq!(bar.x, 1); +} diff --git a/tests/ui/box/unit/unique-send-2.rs b/tests/ui/box/unit/unique-send-2.rs new file mode 100644 index 000000000..23ddd2cdc --- /dev/null +++ b/tests/ui/box/unit/unique-send-2.rs @@ -0,0 +1,33 @@ +// run-pass +#![allow(unused_must_use)] +// ignore-emscripten no threads support + +use std::sync::mpsc::{channel, Sender}; +use std::thread; + +fn child(tx: &Sender>, i: usize) { + tx.send(Box::new(i)).unwrap(); +} + +pub fn main() { + let (tx, rx) = channel(); + let n = 100; + let mut expected = 0; + let ts = (0..n).map(|i| { + expected += i; + let tx = tx.clone(); + thread::spawn(move|| { + child(&tx, i) + }) + }).collect::>(); + + let mut actual = 0; + for _ in 0..n { + let j = rx.recv().unwrap(); + actual += *j; + } + + assert_eq!(expected, actual); + + for t in ts { t.join(); } +} diff --git a/tests/ui/box/unit/unique-send.rs b/tests/ui/box/unit/unique-send.rs new file mode 100644 index 000000000..431cc2be5 --- /dev/null +++ b/tests/ui/box/unit/unique-send.rs @@ -0,0 +1,10 @@ +// run-pass + +use std::sync::mpsc::channel; + +pub fn main() { + let (tx, rx) = channel::>(); + tx.send(Box::new(100)).unwrap(); + let v = rx.recv().unwrap(); + assert_eq!(v, Box::new(100)); +} diff --git a/tests/ui/box/unit/unique-swap.rs b/tests/ui/box/unit/unique-swap.rs new file mode 100644 index 000000000..4f33ff9a8 --- /dev/null +++ b/tests/ui/box/unit/unique-swap.rs @@ -0,0 +1,11 @@ +// run-pass + +use std::mem::swap; + +pub fn main() { + let mut i: Box<_> = Box::new(100); + let mut j: Box<_> = Box::new(200); + swap(&mut i, &mut j); + assert_eq!(i, Box::new(200)); + assert_eq!(j, Box::new(100)); +} diff --git a/tests/ui/box/unit/unwind-unique.rs b/tests/ui/box/unit/unwind-unique.rs new file mode 100644 index 000000000..50ecf751a --- /dev/null +++ b/tests/ui/box/unit/unwind-unique.rs @@ -0,0 +1,15 @@ +// run-pass +// needs-unwind +// ignore-emscripten no threads support + +use std::thread; + +fn f() { + let _a: Box<_> = Box::new(0); + panic!(); +} + +pub fn main() { + let t = thread::spawn(f); + drop(t.join()); +} diff --git a/tests/ui/cfg/auxiliary/cfg_false_lib.rs b/tests/ui/cfg/auxiliary/cfg_false_lib.rs new file mode 100644 index 000000000..3c011d72b --- /dev/null +++ b/tests/ui/cfg/auxiliary/cfg_false_lib.rs @@ -0,0 +1,6 @@ +// It is unclear whether a fully unconfigured crate should link to standard library, +// or what its `no_std`/`no_core`/`compiler_builtins` status, more precisely. +// Currently the usual standard library prelude is added to such crates, +// and therefore they link to libstd. + +#![cfg(FALSE)] diff --git a/tests/ui/cfg/cfg-false-feature.rs b/tests/ui/cfg/cfg-false-feature.rs new file mode 100644 index 000000000..21ea3ec79 --- /dev/null +++ b/tests/ui/cfg/cfg-false-feature.rs @@ -0,0 +1,20 @@ +// It is unclear which features should be in effect in a fully unconfigured crate (issue #104633). +// Currently none on the features are in effect, so we get the feature gates reported. + +// check-pass +// compile-flags: --crate-type lib + +#![feature(decl_macro)] +#![cfg(FALSE)] +#![feature(box_syntax)] + +macro mac() {} //~ WARN `macro` is experimental + //~| WARN unstable syntax can change at any point in the future + +trait A = Clone; //~ WARN trait aliases are experimental + //~| WARN unstable syntax can change at any point in the future + +fn main() { + let box _ = Box::new(0); //~ WARN box pattern syntax is experimental + //~| WARN unstable syntax can change at any point in the future +} diff --git a/tests/ui/cfg/cfg-false-feature.stderr b/tests/ui/cfg/cfg-false-feature.stderr new file mode 100644 index 000000000..14673fbdb --- /dev/null +++ b/tests/ui/cfg/cfg-false-feature.stderr @@ -0,0 +1,35 @@ +warning: trait aliases are experimental + --> $DIR/cfg-false-feature.rs:14:1 + | +LL | trait A = Clone; + | ^^^^^^^^^^^^^^^^ + | + = note: see issue #41517 for more information + = help: add `#![feature(trait_alias)]` to the crate attributes to enable + = warning: unstable syntax can change at any point in the future, causing a hard error! + = note: for more information, see issue #65860 + +warning: `macro` is experimental + --> $DIR/cfg-false-feature.rs:11:1 + | +LL | macro mac() {} + | ^^^^^^^^^^^^^^ + | + = note: see issue #39412 for more information + = help: add `#![feature(decl_macro)]` to the crate attributes to enable + = warning: unstable syntax can change at any point in the future, causing a hard error! + = note: for more information, see issue #65860 + +warning: box pattern syntax is experimental + --> $DIR/cfg-false-feature.rs:18:9 + | +LL | let box _ = Box::new(0); + | ^^^^^ + | + = note: see issue #29641 for more information + = help: add `#![feature(box_patterns)]` to the crate attributes to enable + = warning: unstable syntax can change at any point in the future, causing a hard error! + = note: for more information, see issue #65860 + +warning: 3 warnings emitted + diff --git a/tests/ui/cfg/cfg_false_no_std.rs b/tests/ui/cfg/cfg_false_no_std.rs new file mode 100644 index 000000000..319ea0781 --- /dev/null +++ b/tests/ui/cfg/cfg_false_no_std.rs @@ -0,0 +1,11 @@ +// Currently no error because the panic handler is supplied by libstd linked though the empty +// library, but the desirable behavior is unclear (see comments in cfg_false_lib.rs). + +// check-pass +// aux-build: cfg_false_lib.rs + +#![no_std] + +extern crate cfg_false_lib as _; + +fn main() {} diff --git a/tests/ui/chalkify/bugs/async.rs b/tests/ui/chalkify/bugs/async.rs index 3169e4781..a1ef4732b 100644 --- a/tests/ui/chalkify/bugs/async.rs +++ b/tests/ui/chalkify/bugs/async.rs @@ -4,7 +4,7 @@ // compile-flags:-Z trait-solver=chalk // error-pattern:internal compiler error // failure-status:101 -// normalize-stderr-test "DefId([^)]*)" -> "..." +// normalize-stderr-test "DefId\([^)]*\)" -> "..." // normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> "" // normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> "" // normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> "" diff --git a/tests/ui/chalkify/bugs/async.stderr b/tests/ui/chalkify/bugs/async.stderr index 8043f1e5a..36606fd49 100644 --- a/tests/ui/chalkify/bugs/async.stderr +++ b/tests/ui/chalkify/bugs/async.stderr @@ -1,33 +1,3 @@ -error[E0277]: `[async fn body@$DIR/async.rs:23:29: 25:2]` is not a future - --> $DIR/async.rs:23:29 - | -LL | async fn foo(x: u32) -> u32 { - | _____________________________- -LL | | x -LL | | } - | | ^ - | | | - | |_`[async fn body@$DIR/async.rs:23:29: 25:2]` is not a future - | required by a bound introduced by this call - | - = help: the trait `Future` is not implemented for `[async fn body@$DIR/async.rs:23:29: 25:2]` - = note: [async fn body@$DIR/async.rs:23:29: 25:2] must be a future or must implement `IntoFuture` to be awaited -note: required by a bound in `identity_future` - --> $SRC_DIR/core/src/future/mod.rs:LL:COL - -error[E0277]: the size for values of type `<[async fn body@$DIR/async.rs:23:29: 25:2] as Future>::Output` cannot be known at compilation time - --> $DIR/async.rs:23:29 - | -LL | async fn foo(x: u32) -> u32 { - | _____________________________^ -LL | | x -LL | | } - | |_^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `<[async fn body@$DIR/async.rs:23:29: 25:2] as Future>::Output` -note: required by a bound in `identity_future` - --> $SRC_DIR/core/src/future/mod.rs:LL:COL - error[E0277]: `[async fn body@$DIR/async.rs:23:29: 25:2]` is not a future --> $DIR/async.rs:23:25 | @@ -37,22 +7,23 @@ LL | async fn foo(x: u32) -> u32 { = help: the trait `Future` is not implemented for `[async fn body@$DIR/async.rs:23:29: 25:2]` = note: [async fn body@$DIR/async.rs:23:29: 25:2] must be a future or must implement `IntoFuture` to be awaited -error: internal compiler error: projection clauses should be implied from elsewhere. obligation: `Obligation(predicate=Binder(ProjectionPredicate(AliasTy { substs: [[async fn body@$DIR/async.rs:23:29: 25:2]], def_id: ...) }, Term::Ty(u32)), []), depth=0)` +error: internal compiler error: projection clauses should be implied from elsewhere. obligation: `Obligation(predicate=Binder(ProjectionPredicate(AliasTy { substs: [[async fn body@$DIR/async.rs:23:29: 25:2]], def_id: ... }, Term::Ty(u32)), []), depth=0)` --> $DIR/async.rs:23:25 | LL | async fn foo(x: u32) -> u32 { | ^^^query stack during panic: #0 [typeck] type-checking `foo` #1 [thir_body] building THIR for `foo` -#2 [mir_built] building MIR for `foo` -#3 [unsafety_check_result] unsafety-checking `foo` -#4 [mir_const] preparing `foo` for borrow checking -#5 [mir_promoted] processing MIR for `foo` -#6 [mir_borrowck] borrow-checking `foo` -#7 [type_of] computing type of `foo::{opaque#0}` -#8 [check_mod_item_types] checking item types in top-level module -#9 [analysis] running analysis passes on this crate +#2 [check_match] match-checking `foo` +#3 [mir_built] building MIR for `foo` +#4 [unsafety_check_result] unsafety-checking `foo` +#5 [mir_const] preparing `foo` for borrow checking +#6 [mir_promoted] processing MIR for `foo` +#7 [mir_borrowck] borrow-checking `foo` +#8 [type_of] computing type of `foo::{opaque#0}` +#9 [check_mod_item_types] checking item types in top-level module +#10 [analysis] running analysis passes on this crate end of query stack -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/check-cfg/compact-values.stderr b/tests/ui/check-cfg/compact-values.stderr index 9864aa385..5ca4d3b3d 100644 --- a/tests/ui/check-cfg/compact-values.stderr +++ b/tests/ui/check-cfg/compact-values.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition value LL | #[cfg(target(os = "linux", arch = "X"))] | ^^^^^^^^^^ | - = note: expected values for `target_arch` are: aarch64, arm, avr, bpf, hexagon, m68k, mips, mips64, msp430, nvptx64, powerpc, powerpc64, riscv32, riscv64, s390x, sparc, sparc64, wasm32, wasm64, x86, x86_64 + = note: expected values for `target_arch` are: aarch64, arm, avr, bpf, hexagon, loongarch64, m68k, mips, mips64, msp430, nvptx64, powerpc, powerpc64, riscv32, riscv64, s390x, sparc, sparc64, wasm32, wasm64, x86, x86_64 = note: `#[warn(unexpected_cfgs)]` on by default warning: 1 warning emitted diff --git a/tests/ui/check-cfg/my-awesome-platform.json b/tests/ui/check-cfg/my-awesome-platform.json new file mode 100644 index 000000000..5e9ab8f1a --- /dev/null +++ b/tests/ui/check-cfg/my-awesome-platform.json @@ -0,0 +1,12 @@ +{ + "llvm-target": "x86_64-unknown-none-gnu", + "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128", + "arch": "x86_64", + "target-endian": "little", + "target-pointer-width": "64", + "target-c-int-width": "32", + "os": "ericos", + "linker-flavor": "ld.lld", + "linker": "rust-lld", + "executables": true +} diff --git a/tests/ui/check-cfg/values-target-json.rs b/tests/ui/check-cfg/values-target-json.rs new file mode 100644 index 000000000..2ef5a4459 --- /dev/null +++ b/tests/ui/check-cfg/values-target-json.rs @@ -0,0 +1,21 @@ +// This test checks that we don't lint values defined by a custom target (target json) +// +// check-pass +// needs-llvm-components: x86 +// compile-flags: --crate-type=lib --check-cfg=values() --target={{src-base}}/check-cfg/my-awesome-platform.json -Z unstable-options + +#![feature(lang_items, no_core, auto_traits)] +#![no_core] + +#[lang = "sized"] +trait Sized {} + +#[cfg(target_os = "linuz")] +//~^ WARNING unexpected `cfg` condition value +fn target_os_linux_misspell() {} + +#[cfg(target_os = "linux")] +fn target_os_linux() {} + +#[cfg(target_os = "ericos")] +fn target_os_ericos() {} diff --git a/tests/ui/check-cfg/values-target-json.stderr b/tests/ui/check-cfg/values-target-json.stderr new file mode 100644 index 000000000..b58d29707 --- /dev/null +++ b/tests/ui/check-cfg/values-target-json.stderr @@ -0,0 +1,13 @@ +warning: unexpected `cfg` condition value + --> $DIR/values-target-json.rs:13:7 + | +LL | #[cfg(target_os = "linuz")] + | ^^^^^^^^^^^^------- + | | + | help: did you mean: `"linux"` + | + = note: expected values for `target_os` are: aix, android, cuda, dragonfly, emscripten, ericos, espidf, freebsd, fuchsia, haiku, hermit, horizon, illumos, ios, l4re, linux, macos, netbsd, none, nto, openbsd, psp, redox, solaris, solid_asp3, tvos, uefi, unknown, vita, vxworks, wasi, watchos, windows, xous + = note: `#[warn(unexpected_cfgs)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/check-static-values-constraints.rs b/tests/ui/check-static-values-constraints.rs index f6a577d0d..005a77988 100644 --- a/tests/ui/check-static-values-constraints.rs +++ b/tests/ui/check-static-values-constraints.rs @@ -1,7 +1,6 @@ // Verifies all possible restrictions for statics values. #![allow(warnings)] -#![feature(box_syntax)] use std::marker; @@ -19,7 +18,7 @@ enum SafeEnum { Variant1, Variant2(isize), Variant3(WithDtor), - Variant4(String) + Variant4(String), } // These should be ok @@ -29,42 +28,45 @@ static STATIC3: SafeEnum = SafeEnum::Variant3(WithDtor); enum UnsafeEnum { Variant5, - Variant6(isize) + Variant6(isize), } impl Drop for UnsafeEnum { fn drop(&mut self) {} } - static STATIC4: UnsafeEnum = UnsafeEnum::Variant5; static STATIC5: UnsafeEnum = UnsafeEnum::Variant6(0); - struct SafeStruct { field1: SafeEnum, field2: SafeEnum, } - // Struct fields are safe, hence this static should be safe -static STATIC6: SafeStruct = SafeStruct{field1: SafeEnum::Variant1, field2: SafeEnum::Variant2(0)}; +static STATIC6: SafeStruct = + SafeStruct { field1: SafeEnum::Variant1, field2: SafeEnum::Variant2(0) }; -static STATIC7: SafeStruct = SafeStruct{field1: SafeEnum::Variant1, - field2: SafeEnum::Variant3(WithDtor)}; +static STATIC7: SafeStruct = + SafeStruct { field1: SafeEnum::Variant1, field2: SafeEnum::Variant3(WithDtor) }; // Test variadic constructor for structs. The base struct should be examined // as well as every field present in the constructor. // This example shouldn't fail because all the fields are safe. -static STATIC8: SafeStruct = SafeStruct{field1: SafeEnum::Variant1, - ..SafeStruct{field1: SafeEnum::Variant1, - field2: SafeEnum::Variant1}}; +static STATIC8: SafeStruct = SafeStruct { + field1: SafeEnum::Variant1, + ..SafeStruct { field1: SafeEnum::Variant1, field2: SafeEnum::Variant1 } +}; // This example should fail because field1 in the base struct is not safe -static STATIC9: SafeStruct = SafeStruct{field1: SafeEnum::Variant1, - ..SafeStruct{field1: SafeEnum::Variant3(WithDtor), -//~^ ERROR destructor of - field2: SafeEnum::Variant1}}; +static STATIC9: SafeStruct = SafeStruct { + field1: SafeEnum::Variant1, + ..SafeStruct { + //~^ ERROR destructor of + field1: SafeEnum::Variant3(WithDtor), + field2: SafeEnum::Variant1, + } +}; struct UnsafeStruct; @@ -76,38 +78,45 @@ static STATIC10: UnsafeStruct = UnsafeStruct; struct MyOwned; -static STATIC11: Box = box MyOwned; +static STATIC11: Vec = vec![MyOwned]; //~^ ERROR allocations are not allowed in statics +//~^^ ERROR cannot call non-const static mut STATIC12: UnsafeStruct = UnsafeStruct; -static mut STATIC13: SafeStruct = SafeStruct{field1: SafeEnum::Variant1, - field2: SafeEnum::Variant3(WithDtor)}; +static mut STATIC13: SafeStruct = + SafeStruct { field1: SafeEnum::Variant1, field2: SafeEnum::Variant3(WithDtor) }; static mut STATIC14: SafeStruct = SafeStruct { field1: SafeEnum::Variant1, - field2: SafeEnum::Variant4("str".to_string()) -//~^ ERROR cannot call non-const fn + field2: SafeEnum::Variant4("str".to_string()), //~ ERROR cannot call non-const fn }; -static STATIC15: &'static [Box] = &[ - box MyOwned, //~ ERROR allocations are not allowed in statics - box MyOwned, //~ ERROR allocations are not allowed in statics +static STATIC15: &'static [Vec] = &[ + vec![MyOwned], //~ ERROR allocations are not allowed in statics + //~^ ERROR cannot call non-const + vec![MyOwned], //~ ERROR allocations are not allowed in statics + //~^ ERROR cannot call non-const ]; -static STATIC16: (&'static Box, &'static Box) = ( - &box MyOwned, //~ ERROR allocations are not allowed in statics - &box MyOwned, //~ ERROR allocations are not allowed in statics +static STATIC16: (&'static Vec, &'static Vec) = ( + &vec![MyOwned], //~ ERROR allocations are not allowed in statics + //~^ ERROR cannot call non-const + &vec![MyOwned], //~ ERROR allocations are not allowed in statics + //~^ ERROR cannot call non-const ); static mut STATIC17: SafeEnum = SafeEnum::Variant1; -static STATIC19: Box = - box 3; +static STATIC19: Vec = vec![3]; //~^ ERROR allocations are not allowed in statics +//~^^ ERROR cannot call non-const pub fn main() { - let y = { static x: Box = box 3; x }; - //~^ ERROR allocations are not allowed in statics - //~| ERROR cannot move out of static item + let y = { + static x: Vec = vec![3]; //~ ERROR allocations are not allowed in statics + //~^ ERROR cannot call non-const + x + //~^ ERROR cannot move out of static + }; } diff --git a/tests/ui/check-static-values-constraints.stderr b/tests/ui/check-static-values-constraints.stderr index 490566784..064eb4b8a 100644 --- a/tests/ui/check-static-values-constraints.stderr +++ b/tests/ui/check-static-values-constraints.stderr @@ -1,24 +1,38 @@ error[E0493]: destructor of `SafeStruct` cannot be evaluated at compile-time - --> $DIR/check-static-values-constraints.rs:65:43 + --> $DIR/check-static-values-constraints.rs:64:7 | -LL | ..SafeStruct{field1: SafeEnum::Variant3(WithDtor), - | ___________________________________________^ +LL | ..SafeStruct { + | _______^ LL | | -LL | | field2: SafeEnum::Variant1}}; - | | ^- value is dropped here - | |________________________________________________________________________________| - | the destructor for this type cannot be evaluated in statics +LL | | field1: SafeEnum::Variant3(WithDtor), +LL | | field2: SafeEnum::Variant1, +LL | | } + | |_____^ the destructor for this type cannot be evaluated in statics +LL | }; + | - value is dropped here error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:79:33 + --> $DIR/check-static-values-constraints.rs:81:33 | -LL | static STATIC11: Box = box MyOwned; - | ^^^^^^^^^^^ allocation not allowed in statics +LL | static STATIC11: Vec = vec![MyOwned]; + | ^^^^^^^^^^^^^ allocation not allowed in statics + | + = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0015]: cannot call non-const fn `slice::::into_vec::` in statics + --> $DIR/check-static-values-constraints.rs:81:33 + | +LL | static STATIC11: Vec = vec![MyOwned]; + | ^^^^^^^^^^^^^ + | + = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell + = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0015]: cannot call non-const fn `::to_string` in statics - --> $DIR/check-static-values-constraints.rs:89:38 + --> $DIR/check-static-values-constraints.rs:92:38 | -LL | field2: SafeEnum::Variant4("str".to_string()) +LL | field2: SafeEnum::Variant4("str".to_string()), | ^^^^^^^^^^^ | = note: calls in statics are limited to constant functions, tuple structs and tuple variants @@ -26,53 +40,125 @@ LL | field2: SafeEnum::Variant4("str".to_string()) = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:94:5 + --> $DIR/check-static-values-constraints.rs:96:5 | -LL | box MyOwned, - | ^^^^^^^^^^^ allocation not allowed in statics +LL | vec![MyOwned], + | ^^^^^^^^^^^^^ allocation not allowed in statics + | + = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0015]: cannot call non-const fn `slice::::into_vec::` in statics + --> $DIR/check-static-values-constraints.rs:96:5 + | +LL | vec![MyOwned], + | ^^^^^^^^^^^^^ + | + = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell + = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:95:5 + --> $DIR/check-static-values-constraints.rs:98:5 + | +LL | vec![MyOwned], + | ^^^^^^^^^^^^^ allocation not allowed in statics + | + = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0015]: cannot call non-const fn `slice::::into_vec::` in statics + --> $DIR/check-static-values-constraints.rs:98:5 + | +LL | vec![MyOwned], + | ^^^^^^^^^^^^^ | -LL | box MyOwned, - | ^^^^^^^^^^^ allocation not allowed in statics + = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell + = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:99:6 + --> $DIR/check-static-values-constraints.rs:103:6 + | +LL | &vec![MyOwned], + | ^^^^^^^^^^^^^ allocation not allowed in statics + | + = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0015]: cannot call non-const fn `slice::::into_vec::` in statics + --> $DIR/check-static-values-constraints.rs:103:6 | -LL | &box MyOwned, - | ^^^^^^^^^^^ allocation not allowed in statics +LL | &vec![MyOwned], + | ^^^^^^^^^^^^^ + | + = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell + = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:100:6 + --> $DIR/check-static-values-constraints.rs:105:6 | -LL | &box MyOwned, - | ^^^^^^^^^^^ allocation not allowed in statics +LL | &vec![MyOwned], + | ^^^^^^^^^^^^^ allocation not allowed in statics + | + = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0015]: cannot call non-const fn `slice::::into_vec::` in statics + --> $DIR/check-static-values-constraints.rs:105:6 + | +LL | &vec![MyOwned], + | ^^^^^^^^^^^^^ + | + = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell + = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:106:5 + --> $DIR/check-static-values-constraints.rs:111:31 | -LL | box 3; - | ^^^^^ allocation not allowed in statics +LL | static STATIC19: Vec = vec![3]; + | ^^^^^^^ allocation not allowed in statics + | + = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0015]: cannot call non-const fn `slice::::into_vec::` in statics + --> $DIR/check-static-values-constraints.rs:111:31 + | +LL | static STATIC19: Vec = vec![3]; + | ^^^^^^^ + | + = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell + = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0507]: cannot move out of static item `x` - --> $DIR/check-static-values-constraints.rs:110:45 + --> $DIR/check-static-values-constraints.rs:119:9 | -LL | let y = { static x: Box = box 3; x }; - | ^ move occurs because `x` has type `Box`, which does not implement the `Copy` trait +LL | x + | ^ move occurs because `x` has type `Vec`, which does not implement the `Copy` trait | help: consider borrowing here | -LL | let y = { static x: Box = box 3; &x }; - | + +LL | &x + | + error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:110:38 + --> $DIR/check-static-values-constraints.rs:117:32 + | +LL | static x: Vec = vec![3]; + | ^^^^^^^ allocation not allowed in statics | -LL | let y = { static x: Box = box 3; x }; - | ^^^^^ allocation not allowed in statics + = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0015]: cannot call non-const fn `slice::::into_vec::` in statics + --> $DIR/check-static-values-constraints.rs:117:32 + | +LL | static x: Vec = vec![3]; + | ^^^^^^^ + | + = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell + = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 10 previous errors +error: aborting due to 17 previous errors Some errors have detailed explanations: E0010, E0015, E0493, E0507. For more information about an error, try `rustc --explain E0010`. diff --git a/tests/ui/closures/2229_closure_analysis/array_subslice.rs b/tests/ui/closures/2229_closure_analysis/array_subslice.rs new file mode 100644 index 000000000..5f244ea89 --- /dev/null +++ b/tests/ui/closures/2229_closure_analysis/array_subslice.rs @@ -0,0 +1,13 @@ +// regression test for #109298 +// edition: 2021 + +pub fn subslice_array(x: [u8; 3]) { + let f = || { + let [_x @ ..] = x; + let [ref y, ref mut z @ ..] = x; //~ ERROR cannot borrow `x[..]` as mutable + }; + + f(); //~ ERROR cannot borrow `f` as mutable +} + +fn main() {} diff --git a/tests/ui/closures/2229_closure_analysis/array_subslice.stderr b/tests/ui/closures/2229_closure_analysis/array_subslice.stderr new file mode 100644 index 000000000..888c60d5e --- /dev/null +++ b/tests/ui/closures/2229_closure_analysis/array_subslice.stderr @@ -0,0 +1,26 @@ +error[E0596]: cannot borrow `x[..]` as mutable, as `x` is not declared as mutable + --> $DIR/array_subslice.rs:7:21 + | +LL | pub fn subslice_array(x: [u8; 3]) { + | - help: consider changing this to be mutable: `mut x` +... +LL | let [ref y, ref mut z @ ..] = x; + | ^^^^^^^^^ cannot borrow as mutable + +error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable + --> $DIR/array_subslice.rs:10:5 + | +LL | let [ref y, ref mut z @ ..] = x; + | - calling `f` requires mutable binding due to mutable borrow of `x` +... +LL | f(); + | ^ cannot borrow as mutable + | +help: consider changing this to be mutable + | +LL | let mut f = || { + | +++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/closures/2229_closure_analysis/unique-borrows-are-invariant-1.rs b/tests/ui/closures/2229_closure_analysis/unique-borrows-are-invariant-1.rs new file mode 100644 index 000000000..f21ef43fb --- /dev/null +++ b/tests/ui/closures/2229_closure_analysis/unique-borrows-are-invariant-1.rs @@ -0,0 +1,18 @@ +// edition:2021 + +// regression test for #112056 + +fn extend_lifetime<'a, 'b>(x: &mut (&'a str,), y: &'b str) { + let mut closure = |input| x.0 = input; + //~^ ERROR: lifetime may not live long enough + closure(y); +} + +fn main() { + let mut tuple = ("static",); + { + let x = String::from("temporary"); + extend_lifetime(&mut tuple, &x); + } + println!("{}", tuple.0); +} diff --git a/tests/ui/closures/2229_closure_analysis/unique-borrows-are-invariant-1.stderr b/tests/ui/closures/2229_closure_analysis/unique-borrows-are-invariant-1.stderr new file mode 100644 index 000000000..730823281 --- /dev/null +++ b/tests/ui/closures/2229_closure_analysis/unique-borrows-are-invariant-1.stderr @@ -0,0 +1,14 @@ +error: lifetime may not live long enough + --> $DIR/unique-borrows-are-invariant-1.rs:6:31 + | +LL | fn extend_lifetime<'a, 'b>(x: &mut (&'a str,), y: &'b str) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | let mut closure = |input| x.0 = input; + | ^^^^^^^^^^^ assignment requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` + +error: aborting due to previous error + diff --git a/tests/ui/closures/2229_closure_analysis/unique-borrows-are-invariant-2.rs b/tests/ui/closures/2229_closure_analysis/unique-borrows-are-invariant-2.rs new file mode 100644 index 000000000..dd9d986c2 --- /dev/null +++ b/tests/ui/closures/2229_closure_analysis/unique-borrows-are-invariant-2.rs @@ -0,0 +1,31 @@ +// edition:2021 + +// regression test for #112056 + +struct Spooky<'b> { + owned: Option<&'static u32>, + borrowed: &'b &'static u32, +} + +impl<'b> Spooky<'b> { + fn create_self_reference<'a>(&'a mut self) { + let mut closure = || { + if let Some(owned) = &self.owned { + let borrow: &'a &'static u32 = owned; + self.borrowed = borrow; + //~^ ERROR: lifetime may not live long enough + } + }; + closure(); + } +} + +fn main() { + let mut spooky: Spooky<'static> = Spooky { + owned: Some(&1), + borrowed: &&1, + }; + spooky.create_self_reference(); + spooky.owned = None; + println!("{}", **spooky.borrowed); +} diff --git a/tests/ui/closures/2229_closure_analysis/unique-borrows-are-invariant-2.stderr b/tests/ui/closures/2229_closure_analysis/unique-borrows-are-invariant-2.stderr new file mode 100644 index 000000000..66ba0fe35 --- /dev/null +++ b/tests/ui/closures/2229_closure_analysis/unique-borrows-are-invariant-2.stderr @@ -0,0 +1,15 @@ +error: lifetime may not live long enough + --> $DIR/unique-borrows-are-invariant-2.rs:15:17 + | +LL | impl<'b> Spooky<'b> { + | -- lifetime `'b` defined here +LL | fn create_self_reference<'a>(&'a mut self) { + | -- lifetime `'a` defined here +... +LL | self.borrowed = borrow; + | ^^^^^^^^^^^^^^^^^^^^^^ assignment requires that `'a` must outlive `'b` + | + = help: consider adding the following bound: `'a: 'b` + +error: aborting due to previous error + diff --git a/tests/ui/closures/issue-109188.rs b/tests/ui/closures/issue-109188.rs new file mode 100644 index 000000000..cae1ced99 --- /dev/null +++ b/tests/ui/closures/issue-109188.rs @@ -0,0 +1,22 @@ +enum Either { + One(X), + Two(X), +} + +struct X(Y); + +struct Y; + +fn consume_fnmut(f: &dyn FnMut()) { + f(); +} + +fn move_into_fnmut() { + let x = move_into_fnmut(); + consume_fnmut(&|| { + let Either::One(_t) = x; //~ ERROR mismatched types + let Either::Two(_t) = x; //~ ERROR mismatched types + }); +} + +fn main() { } diff --git a/tests/ui/closures/issue-109188.stderr b/tests/ui/closures/issue-109188.stderr new file mode 100644 index 000000000..d52b51629 --- /dev/null +++ b/tests/ui/closures/issue-109188.stderr @@ -0,0 +1,19 @@ +error[E0308]: mismatched types + --> $DIR/issue-109188.rs:17:13 + | +LL | let Either::One(_t) = x; + | ^^^^^^^^^^^^^^^ - this expression has type `()` + | | + | expected `()`, found `Either` + +error[E0308]: mismatched types + --> $DIR/issue-109188.rs:18:13 + | +LL | let Either::Two(_t) = x; + | ^^^^^^^^^^^^^^^ - this expression has type `()` + | | + | expected `()`, found `Either` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/closures/self-supertrait-bounds.rs b/tests/ui/closures/self-supertrait-bounds.rs new file mode 100644 index 000000000..f4f1cea6b --- /dev/null +++ b/tests/ui/closures/self-supertrait-bounds.rs @@ -0,0 +1,14 @@ +// check-pass + +// Makes sure that we only consider `Self` supertrait predicates while +// elaborating during closure signature deduction. + +#![feature(trait_alias)] + +trait Confusing = Fn(i32) where F: Fn(u32); + +fn alias, F>(_: T, _: F) {} + +fn main() { + alias(|_| {}, |_| {}); +} diff --git a/tests/ui/codegen/mono-impossible-2.rs b/tests/ui/codegen/mono-impossible-2.rs new file mode 100644 index 000000000..21eb2c9b2 --- /dev/null +++ b/tests/ui/codegen/mono-impossible-2.rs @@ -0,0 +1,19 @@ +//compile-flags: --crate-type=lib -Clink-dead-code=on +// build-pass + +// Make sure that we don't monomorphize the impossible method `<() as Visit>::visit`, +// which does not hold under a reveal-all param env. + +pub trait Visit { + fn visit() {} +} + +pub trait Array { + type Element; +} + +impl<'a> Visit for () where (): Array {} + +impl Array for () { + type Element = (); +} diff --git a/tests/ui/codegen/mono-impossible.rs b/tests/ui/codegen/mono-impossible.rs new file mode 100644 index 000000000..1ea32ed2c --- /dev/null +++ b/tests/ui/codegen/mono-impossible.rs @@ -0,0 +1,13 @@ +// compile-flags: -Clink-dead-code=on --crate-type=lib +// build-pass + +// Make sure that we don't monomorphize the impossible method `<() as Visit>::visit`, +// which does not hold under a reveal-all param env. + +pub trait Visit { + fn visit() {} +} + +pub trait Array<'a> {} + +impl Visit for () where (): for<'a> Array<'a> {} diff --git a/tests/ui/coercion/coerce-expect-unsized-ascribed.rs b/tests/ui/coercion/coerce-expect-unsized-ascribed.rs index d7b11317a..43b0b375a 100644 --- a/tests/ui/coercion/coerce-expect-unsized-ascribed.rs +++ b/tests/ui/coercion/coerce-expect-unsized-ascribed.rs @@ -1,18 +1,19 @@ // A version of coerce-expect-unsized that uses type ascription. // Doesn't work so far, but supposed to work eventually -#![feature(box_syntax, type_ascription)] +#![feature(type_ascription)] use std::fmt::Debug; pub fn main() { - let _ = type_ascribe!(box { [1, 2, 3] }, Box<[i32]>); //~ ERROR mismatched types - let _ = type_ascribe!(box if true { [1, 2, 3] } else { [1, 3, 4] }, Box<[i32]>); //~ ERROR mismatched types - let _ = type_ascribe!(box match true { true => [1, 2, 3], false => [1, 3, 4] }, Box<[i32]>); + let _ = type_ascribe!(Box::new({ [1, 2, 3] }), Box<[i32]>); //~ ERROR mismatched types + let _ = type_ascribe!(Box::new( if true { [1, 2, 3] } else { [1, 3, 4] }), Box<[i32]>); //~ ERROR mismatched types + let _ = type_ascribe!( + Box::new( match true { true => [1, 2, 3], false => [1, 3, 4] }), Box<[i32]>); //~^ ERROR mismatched types - let _ = type_ascribe!(box { |x| (x as u8) }, Box _>); //~ ERROR mismatched types - let _ = type_ascribe!(box if true { false } else { true }, Box); //~ ERROR mismatched types - let _ = type_ascribe!(box match true { true => 'a', false => 'b' }, Box); //~ ERROR mismatched types + let _ = type_ascribe!(Box::new( { |x| (x as u8) }), Box _>); //~ ERROR mismatched types + let _ = type_ascribe!(Box::new( if true { false } else { true }), Box); //~ ERROR mismatched types + let _ = type_ascribe!(Box::new( match true { true => 'a', false => 'b' }), Box); //~ ERROR mismatched types let _ = type_ascribe!(&{ [1, 2, 3] }, &[i32]); //~ ERROR mismatched types let _ = type_ascribe!(&if true { [1, 2, 3] } else { [1, 3, 4] }, &[i32]); //~ ERROR mismatched types @@ -27,6 +28,6 @@ pub fn main() { let _ = type_ascribe!(vec![ Box::new(|x| (x as u8)), - box |x| (x as i16 as u8), + Box::new(|x| (x as i16 as u8)), ], Vec _>>); } diff --git a/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr b/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr index f94422a92..aa5ec6b5a 100644 --- a/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr +++ b/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:9:27 | -LL | let _ = type_ascribe!(box { [1, 2, 3] }, Box<[i32]>); - | ^^^^^^^^^^^^^^^^^ expected `Box<[i32]>`, found `Box<[i32; 3]>` +LL | let _ = type_ascribe!(Box::new({ [1, 2, 3] }), Box<[i32]>); + | ^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<[i32]>`, found `Box<[i32; 3]>` | = note: expected struct `Box<[i32]>` found struct `Box<[i32; 3]>` @@ -10,50 +10,50 @@ LL | let _ = type_ascribe!(box { [1, 2, 3] }, Box<[i32]>); error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:10:27 | -LL | let _ = type_ascribe!(box if true { [1, 2, 3] } else { [1, 3, 4] }, Box<[i32]>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<[i32]>`, found `Box<[i32; 3]>` +LL | let _ = type_ascribe!(Box::new( if true { [1, 2, 3] } else { [1, 3, 4] }), Box<[i32]>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<[i32]>`, found `Box<[i32; 3]>` | = note: expected struct `Box<[i32]>` found struct `Box<[i32; 3]>` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:11:27 + --> $DIR/coerce-expect-unsized-ascribed.rs:12:9 | -LL | let _ = type_ascribe!(box match true { true => [1, 2, 3], false => [1, 3, 4] }, Box<[i32]>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<[i32]>`, found `Box<[i32; 3]>` +LL | Box::new( match true { true => [1, 2, 3], false => [1, 3, 4] }), Box<[i32]>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<[i32]>`, found `Box<[i32; 3]>` | = note: expected struct `Box<[i32]>` found struct `Box<[i32; 3]>` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:13:27 + --> $DIR/coerce-expect-unsized-ascribed.rs:14:27 | -LL | let _ = type_ascribe!(box { |x| (x as u8) }, Box _>); - | ^^^^^^^^^^^^^^^^^^^^^ expected `Box u8>`, found `Box<[closure@coerce-expect-unsized-ascribed.rs:13:33]>` +LL | let _ = type_ascribe!(Box::new( { |x| (x as u8) }), Box _>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box u8>`, found `Box<[closure@coerce-expect-unsized-ascribed.rs:14:39]>` | = note: expected struct `Box u8>` - found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:13:33: 13:36]>` + found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:14:39: 14:42]>` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:14:27 + --> $DIR/coerce-expect-unsized-ascribed.rs:15:27 | -LL | let _ = type_ascribe!(box if true { false } else { true }, Box); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box`, found `Box` +LL | let _ = type_ascribe!(Box::new( if true { false } else { true }), Box); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box`, found `Box` | = note: expected struct `Box` found struct `Box` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:15:27 + --> $DIR/coerce-expect-unsized-ascribed.rs:16:27 | -LL | let _ = type_ascribe!(box match true { true => 'a', false => 'b' }, Box); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box`, found `Box` +LL | let _ = type_ascribe!(Box::new( match true { true => 'a', false => 'b' }), Box); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box`, found `Box` | = note: expected struct `Box` found struct `Box` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:17:27 + --> $DIR/coerce-expect-unsized-ascribed.rs:18:27 | LL | let _ = type_ascribe!(&{ [1, 2, 3] }, &[i32]); | ^^^^^^^^^^^^^^ expected `&[i32]`, found `&[i32; 3]` @@ -62,7 +62,7 @@ LL | let _ = type_ascribe!(&{ [1, 2, 3] }, &[i32]); found reference `&[i32; 3]` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:18:27 + --> $DIR/coerce-expect-unsized-ascribed.rs:19:27 | LL | let _ = type_ascribe!(&if true { [1, 2, 3] } else { [1, 3, 4] }, &[i32]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&[i32]`, found `&[i32; 3]` @@ -71,7 +71,7 @@ LL | let _ = type_ascribe!(&if true { [1, 2, 3] } else { [1, 3, 4] }, &[i32] found reference `&[i32; 3]` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:19:27 + --> $DIR/coerce-expect-unsized-ascribed.rs:20:27 | LL | let _ = type_ascribe!(&match true { true => [1, 2, 3], false => [1, 3, 4] }, &[i32]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&[i32]`, found `&[i32; 3]` @@ -80,16 +80,16 @@ LL | let _ = type_ascribe!(&match true { true => [1, 2, 3], false => [1, 3, found reference `&[i32; 3]` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:21:27 + --> $DIR/coerce-expect-unsized-ascribed.rs:22:27 | LL | let _ = type_ascribe!(&{ |x| (x as u8) }, &dyn Fn(i32) -> _); - | ^^^^^^^^^^^^^^^^^^ expected `&dyn Fn(i32) -> u8`, found `&[closure@coerce-expect-unsized-ascribed.rs:21:30]` + | ^^^^^^^^^^^^^^^^^^ expected `&dyn Fn(i32) -> u8`, found `&[closure@coerce-expect-unsized-ascribed.rs:22:30]` | = note: expected reference `&dyn Fn(i32) -> u8` - found reference `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:21:30: 21:33]` + found reference `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:22:30: 22:33]` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:22:27 + --> $DIR/coerce-expect-unsized-ascribed.rs:23:27 | LL | let _ = type_ascribe!(&if true { false } else { true }, &dyn Debug); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&dyn Debug`, found `&bool` @@ -98,7 +98,7 @@ LL | let _ = type_ascribe!(&if true { false } else { true }, &dyn Debug); found reference `&bool` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:23:27 + --> $DIR/coerce-expect-unsized-ascribed.rs:24:27 | LL | let _ = type_ascribe!(&match true { true => 'a', false => 'b' }, &dyn Debug); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&dyn Debug`, found `&char` @@ -107,7 +107,7 @@ LL | let _ = type_ascribe!(&match true { true => 'a', false => 'b' }, &dyn D found reference `&char` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:25:27 + --> $DIR/coerce-expect-unsized-ascribed.rs:26:27 | LL | let _ = type_ascribe!(Box::new([1, 2, 3]), Box<[i32]>); | ^^^^^^^^^^^^^^^^^^^ expected `Box<[i32]>`, found `Box<[i32; 3]>` @@ -116,13 +116,13 @@ LL | let _ = type_ascribe!(Box::new([1, 2, 3]), Box<[i32]>); found struct `Box<[i32; 3]>` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:26:27 + --> $DIR/coerce-expect-unsized-ascribed.rs:27:27 | LL | let _ = type_ascribe!(Box::new(|x| (x as u8)), Box _>); - | ^^^^^^^^^^^^^^^^^^^^^^^ expected `Box u8>`, found `Box<[closure@coerce-expect-unsized-ascribed.rs:26:36]>` + | ^^^^^^^^^^^^^^^^^^^^^^^ expected `Box u8>`, found `Box<[closure@coerce-expect-unsized-ascribed.rs:27:36]>` | = note: expected struct `Box u8>` - found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:26:36: 26:39]>` + found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:27:36: 27:39]>` error: aborting due to 14 previous errors diff --git a/tests/ui/coherence/coherence-conflicting-negative-trait-impl.rs b/tests/ui/coherence/coherence-conflicting-negative-trait-impl.rs index 24b878927..76a57936e 100644 --- a/tests/ui/coherence/coherence-conflicting-negative-trait-impl.rs +++ b/tests/ui/coherence/coherence-conflicting-negative-trait-impl.rs @@ -13,5 +13,7 @@ impl !Send for TestType {} //~ ERROR found both positive and nega unsafe impl Send for TestType {} //~ ERROR conflicting implementations impl !Send for TestType {} +//~^ WARNING +//~| WARNING this will change its meaning fn main() {} diff --git a/tests/ui/coherence/coherence-conflicting-negative-trait-impl.stderr b/tests/ui/coherence/coherence-conflicting-negative-trait-impl.stderr index 2463f38a9..020199da9 100644 --- a/tests/ui/coherence/coherence-conflicting-negative-trait-impl.stderr +++ b/tests/ui/coherence/coherence-conflicting-negative-trait-impl.stderr @@ -16,7 +16,23 @@ LL | unsafe impl Send for TestType {} LL | unsafe impl Send for TestType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>` -error: aborting due to 2 previous errors +warning: cross-crate traits with a default impl, like `Send`, should not be specialized + --> $DIR/coherence-conflicting-negative-trait-impl.rs:15:1 + | +LL | impl !Send for TestType {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this will change its meaning in a future release! + = note: for more information, see issue #93367 + = note: `i32` is not a generic parameter +note: try using the same sequence of generic parameters as the struct definition + --> $DIR/coherence-conflicting-negative-trait-impl.rs:7:1 + | +LL | struct TestType(::std::marker::PhantomData); + | ^^^^^^^^^^^^^^^^^^ + = note: `#[warn(suspicious_auto_trait_impls)]` on by default + +error: aborting due to 2 previous errors; 1 warning emitted Some errors have detailed explanations: E0119, E0751. For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/coherence-impls-copy.stderr b/tests/ui/coherence/coherence-impls-copy.stderr index d40ffc48a..21dbc6063 100644 --- a/tests/ui/coherence/coherence-impls-copy.stderr +++ b/tests/ui/coherence/coherence-impls-copy.stderr @@ -52,19 +52,19 @@ LL | impl Copy for [MyType] {} | = note: define and implement a trait or new type instead -error[E0206]: the trait `Copy` may not be implemented for this type +error[E0206]: the trait `Copy` cannot be implemented for this type --> $DIR/coherence-impls-copy.rs:21:15 | LL | impl Copy for &'static mut MyType {} | ^^^^^^^^^^^^^^^^^^^ type is not a structure or enumeration -error[E0206]: the trait `Copy` may not be implemented for this type +error[E0206]: the trait `Copy` cannot be implemented for this type --> $DIR/coherence-impls-copy.rs:25:15 | LL | impl Copy for (MyType, MyType) {} | ^^^^^^^^^^^^^^^^ type is not a structure or enumeration -error[E0206]: the trait `Copy` may not be implemented for this type +error[E0206]: the trait `Copy` cannot be implemented for this type --> $DIR/coherence-impls-copy.rs:30:15 | LL | impl Copy for [MyType] {} diff --git a/tests/ui/coherence/coherence-orphan.rs b/tests/ui/coherence/coherence-orphan.rs index 3beac04c7..bed782203 100644 --- a/tests/ui/coherence/coherence-orphan.rs +++ b/tests/ui/coherence/coherence-orphan.rs @@ -14,7 +14,8 @@ impl TheTrait for isize { } impl TheTrait for TheType { } -impl !Send for Vec { } -//~^ ERROR E0117 +impl !Send for Vec { } //~ ERROR E0117 +//~^ WARNING +//~| WARNING this will change its meaning fn main() { } diff --git a/tests/ui/coherence/coherence-orphan.stderr b/tests/ui/coherence/coherence-orphan.stderr index 01f166a21..9ec1d0dc3 100644 --- a/tests/ui/coherence/coherence-orphan.stderr +++ b/tests/ui/coherence/coherence-orphan.stderr @@ -21,6 +21,19 @@ LL | impl !Send for Vec { } | = note: define and implement a trait or new type instead -error: aborting due to 2 previous errors +warning: cross-crate traits with a default impl, like `Send`, should not be specialized + --> $DIR/coherence-orphan.rs:17:1 + | +LL | impl !Send for Vec { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this will change its meaning in a future release! + = note: for more information, see issue #93367 + = note: `isize` is not a generic parameter +note: try using the same sequence of generic parameters as the struct definition + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + = note: `#[warn(suspicious_auto_trait_impls)]` on by default + +error: aborting due to 2 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0117`. diff --git a/tests/ui/coherence/coherence_inherent.stderr b/tests/ui/coherence/coherence_inherent.stderr index 46b128c08..b381b0680 100644 --- a/tests/ui/coherence/coherence_inherent.stderr +++ b/tests/ui/coherence/coherence_inherent.stderr @@ -7,7 +7,7 @@ LL | s.the_fn(); = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use Lib::TheTrait; +LL + use Lib::TheTrait; | error: aborting due to previous error diff --git a/tests/ui/coherence/coherence_inherent_cc.stderr b/tests/ui/coherence/coherence_inherent_cc.stderr index af0ef3b69..7b6cb7d43 100644 --- a/tests/ui/coherence/coherence_inherent_cc.stderr +++ b/tests/ui/coherence/coherence_inherent_cc.stderr @@ -7,7 +7,7 @@ LL | s.the_fn(); = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use coherence_inherent_cc_lib::TheTrait; +LL + use coherence_inherent_cc_lib::TheTrait; | error: aborting due to previous error diff --git a/tests/ui/coherence/deep-bad-copy-reason.rs b/tests/ui/coherence/deep-bad-copy-reason.rs index 80bbe387a..97fd3f719 100644 --- a/tests/ui/coherence/deep-bad-copy-reason.rs +++ b/tests/ui/coherence/deep-bad-copy-reason.rs @@ -31,7 +31,7 @@ impl<'tcx, T> Clone for List<'tcx, T> { } impl<'tcx, T> Copy for List<'tcx, T> {} -//~^ ERROR the trait `Copy` may not be implemented for this type +//~^ ERROR the trait `Copy` cannot be implemented for this type fn assert_is_copy() {} diff --git a/tests/ui/coherence/deep-bad-copy-reason.stderr b/tests/ui/coherence/deep-bad-copy-reason.stderr index 168ee5726..7b6dd4b38 100644 --- a/tests/ui/coherence/deep-bad-copy-reason.stderr +++ b/tests/ui/coherence/deep-bad-copy-reason.stderr @@ -1,4 +1,4 @@ -error[E0204]: the trait `Copy` may not be implemented for this type +error[E0204]: the trait `Copy` cannot be implemented for this type --> $DIR/deep-bad-copy-reason.rs:33:24 | LL | pub struct List<'tcx, T>(Interned<'tcx, ListS>); diff --git a/tests/ui/coherence/illegal-copy-bad-projection.rs b/tests/ui/coherence/illegal-copy-bad-projection.rs new file mode 100644 index 000000000..797443a0a --- /dev/null +++ b/tests/ui/coherence/illegal-copy-bad-projection.rs @@ -0,0 +1,16 @@ +trait AsPtr { + type Ptr; +} + +impl AsPtr for () { + type Ptr = *const void; + //~^ ERROR cannot find type `void` in this scope +} + +#[derive(Copy, Clone)] +struct Foo { + p: <() as AsPtr>::Ptr, + // Do not report a "`Copy` cannot be implemented" here. +} + +fn main() {} diff --git a/tests/ui/coherence/illegal-copy-bad-projection.stderr b/tests/ui/coherence/illegal-copy-bad-projection.stderr new file mode 100644 index 000000000..8fed9ba23 --- /dev/null +++ b/tests/ui/coherence/illegal-copy-bad-projection.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `void` in this scope + --> $DIR/illegal-copy-bad-projection.rs:6:23 + | +LL | type Ptr = *const void; + | ^^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/command/command-exec.rs b/tests/ui/command/command-exec.rs index 032dad184..edc33446d 100644 --- a/tests/ui/command/command-exec.rs +++ b/tests/ui/command/command-exec.rs @@ -2,7 +2,6 @@ #![allow(stable_features)] // ignore-windows - this is a unix-specific test -// ignore-pretty issue #37199 // ignore-emscripten no processes // ignore-sgx no processes // ignore-fuchsia no execvp syscall provided diff --git a/tests/ui/conditional-compilation/cfg-attr-multi-true.stderr b/tests/ui/conditional-compilation/cfg-attr-multi-true.stderr index fbfcd4565..123ce7172 100644 --- a/tests/ui/conditional-compilation/cfg-attr-multi-true.stderr +++ b/tests/ui/conditional-compilation/cfg-attr-multi-true.stderr @@ -35,6 +35,10 @@ note: the lint level is defined here | LL | #![warn(unused_must_use)] | ^^^^^^^^^^^^^^^ +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = MustUseDeprecated::new(); + | +++++++ warning: 5 warnings emitted diff --git a/tests/ui/const-generics/bad-generic-in-copy-impl.rs b/tests/ui/const-generics/bad-generic-in-copy-impl.rs new file mode 100644 index 000000000..b5663464c --- /dev/null +++ b/tests/ui/const-generics/bad-generic-in-copy-impl.rs @@ -0,0 +1,9 @@ +#[derive(Copy, Clone)] +pub struct Foo { + x: [u8; SIZE], + //~^ ERROR mismatched types +} + +const SIZE: u32 = 1; + +fn main() {} diff --git a/tests/ui/const-generics/bad-generic-in-copy-impl.stderr b/tests/ui/const-generics/bad-generic-in-copy-impl.stderr new file mode 100644 index 000000000..25701ce68 --- /dev/null +++ b/tests/ui/const-generics/bad-generic-in-copy-impl.stderr @@ -0,0 +1,9 @@ +error[E0308]: mismatched types + --> $DIR/bad-generic-in-copy-impl.rs:3:13 + | +LL | x: [u8; SIZE], + | ^^^^ expected `usize`, found `u32` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/const-generics/bad-subst-const-kind.rs b/tests/ui/const-generics/bad-subst-const-kind.rs new file mode 100644 index 000000000..e13dfbacd --- /dev/null +++ b/tests/ui/const-generics/bad-subst-const-kind.rs @@ -0,0 +1,13 @@ +// incremental +#![crate_type = "lib"] + +trait Q { + const ASSOC: usize; +} + +impl Q for [u8; N] { + //~^ ERROR mismatched types + const ASSOC: usize = 1; +} + +pub fn test() -> [u8; <[u8; 13] as Q>::ASSOC] { todo!() } diff --git a/tests/ui/const-generics/bad-subst-const-kind.stderr b/tests/ui/const-generics/bad-subst-const-kind.stderr new file mode 100644 index 000000000..bd24f9140 --- /dev/null +++ b/tests/ui/const-generics/bad-subst-const-kind.stderr @@ -0,0 +1,9 @@ +error[E0308]: mismatched types + --> $DIR/bad-subst-const-kind.rs:8:31 + | +LL | impl Q for [u8; N] { + | ^ expected `usize`, found `u64` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/const-generics/const-arg-in-const-arg.full.stderr b/tests/ui/const-generics/const-arg-in-const-arg.full.stderr index 8672e79b3..463a37d7e 100644 --- a/tests/ui/const-generics/const-arg-in-const-arg.full.stderr +++ b/tests/ui/const-generics/const-arg-in-const-arg.full.stderr @@ -1,4 +1,4 @@ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/const-arg-in-const-arg.rs:18:23 | LL | let _: [u8; faz::<'a>(&())]; @@ -10,7 +10,7 @@ note: the late bound lifetime parameter is introduced here LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/const-arg-in-const-arg.rs:21:23 | LL | let _: [u8; faz::<'b>(&())]; @@ -22,7 +22,7 @@ note: the late bound lifetime parameter is introduced here LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/const-arg-in-const-arg.rs:41:24 | LL | let _: Foo<{ faz::<'a>(&()) }>; @@ -34,7 +34,7 @@ note: the late bound lifetime parameter is introduced here LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/const-arg-in-const-arg.rs:44:24 | LL | let _: Foo<{ faz::<'b>(&()) }>; @@ -94,7 +94,7 @@ LL | let _ = [0; bar::()]; | = help: try adding a `where` bound using this expression: `where [(); bar::()]:` -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/const-arg-in-const-arg.rs:30:23 | LL | let _ = [0; faz::<'a>(&())]; @@ -106,7 +106,7 @@ note: the late bound lifetime parameter is introduced here LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/const-arg-in-const-arg.rs:33:23 | LL | let _ = [0; faz::<'b>(&())]; @@ -134,7 +134,7 @@ LL | let _ = Foo::<{ bar::() }>; | = help: try adding a `where` bound using this expression: `where [(); { bar::() }]:` -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/const-arg-in-const-arg.rs:52:27 | LL | let _ = Foo::<{ faz::<'a>(&()) }>; @@ -146,7 +146,7 @@ note: the late bound lifetime parameter is introduced here LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/const-arg-in-const-arg.rs:55:27 | LL | let _ = Foo::<{ faz::<'b>(&()) }>; @@ -160,3 +160,4 @@ LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } error: aborting due to 16 previous errors +For more information about this error, try `rustc --explain E0794`. diff --git a/tests/ui/const-generics/const-arg-in-const-arg.min.stderr b/tests/ui/const-generics/const-arg-in-const-arg.min.stderr index f1353aa99..a7bd9c62b 100644 --- a/tests/ui/const-generics/const-arg-in-const-arg.min.stderr +++ b/tests/ui/const-generics/const-arg-in-const-arg.min.stderr @@ -216,7 +216,7 @@ help: if this generic argument was intended as a const parameter, surround it wi LL | let _: [u8; bar::<{ N }>()]; | + + -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/const-arg-in-const-arg.rs:18:23 | LL | let _: [u8; faz::<'a>(&())]; @@ -228,7 +228,7 @@ note: the late bound lifetime parameter is introduced here LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/const-arg-in-const-arg.rs:21:23 | LL | let _: [u8; faz::<'b>(&())]; @@ -251,7 +251,7 @@ help: if this generic argument was intended as a const parameter, surround it wi LL | let _: Foo<{ bar::<{ N }>() }>; | + + -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/const-arg-in-const-arg.rs:41:24 | LL | let _: Foo<{ faz::<'a>(&()) }>; @@ -263,7 +263,7 @@ note: the late bound lifetime parameter is introduced here LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/const-arg-in-const-arg.rs:44:24 | LL | let _: Foo<{ faz::<'b>(&()) }>; @@ -294,7 +294,7 @@ help: if this generic argument was intended as a const parameter, surround it wi LL | let _ = [0; bar::<{ N }>()]; | + + -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/const-arg-in-const-arg.rs:30:23 | LL | let _ = [0; faz::<'a>(&())]; @@ -306,7 +306,7 @@ note: the late bound lifetime parameter is introduced here LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/const-arg-in-const-arg.rs:33:23 | LL | let _ = [0; faz::<'b>(&())]; @@ -329,7 +329,7 @@ help: if this generic argument was intended as a const parameter, surround it wi LL | let _ = Foo::<{ bar::<{ N }>() }>; | + + -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/const-arg-in-const-arg.rs:52:27 | LL | let _ = Foo::<{ faz::<'a>(&()) }>; @@ -341,7 +341,7 @@ note: the late bound lifetime parameter is introduced here LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/const-arg-in-const-arg.rs:55:27 | LL | let _ = Foo::<{ faz::<'b>(&()) }>; @@ -355,5 +355,5 @@ LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } error: aborting due to 36 previous errors -Some errors have detailed explanations: E0658, E0747. +Some errors have detailed explanations: E0658, E0747, E0794. For more information about an error, try `rustc --explain E0658`. diff --git a/tests/ui/const-generics/defaults/doesnt_infer.stderr b/tests/ui/const-generics/defaults/doesnt_infer.stderr index 227b2f402..a61411d6e 100644 --- a/tests/ui/const-generics/defaults/doesnt_infer.stderr +++ b/tests/ui/const-generics/defaults/doesnt_infer.stderr @@ -4,7 +4,7 @@ error[E0282]: type annotations needed for `Foo` LL | let foo = Foo::foo(); | ^^^ | -help: consider giving `foo` an explicit type, where the the value of const parameter `N` is specified +help: consider giving `foo` an explicit type, where the value of const parameter `N` is specified | LL | let foo: Foo = Foo::foo(); | ++++++++ diff --git a/tests/ui/const-generics/generic_const_exprs/cross_crate_predicate.stderr b/tests/ui/const-generics/generic_const_exprs/cross_crate_predicate.stderr index 7b4d46b82..6b3396a25 100644 --- a/tests/ui/const-generics/generic_const_exprs/cross_crate_predicate.stderr +++ b/tests/ui/const-generics/generic_const_exprs/cross_crate_predicate.stderr @@ -1,8 +1,8 @@ error: unconstrained generic constant - --> $DIR/cross_crate_predicate.rs:7:13 + --> $DIR/cross_crate_predicate.rs:7:44 | LL | let _ = const_evaluatable_lib::test1::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ | = help: try adding a `where` bound using this expression: `where [(); std::mem::size_of::() - 1]:` note: required by a bound in `test1` @@ -12,10 +12,10 @@ LL | [u8; std::mem::size_of::() - 1]: Sized, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `test1` error: unconstrained generic constant - --> $DIR/cross_crate_predicate.rs:7:13 + --> $DIR/cross_crate_predicate.rs:7:44 | LL | let _ = const_evaluatable_lib::test1::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ | = help: try adding a `where` bound using this expression: `where [(); std::mem::size_of::() - 1]:` note: required by a bound in `test1` diff --git a/tests/ui/const-generics/generic_const_exprs/issue-94287.stderr b/tests/ui/const-generics/generic_const_exprs/issue-94287.stderr index 7390a0077..dc7d0c54f 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-94287.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-94287.stderr @@ -8,7 +8,7 @@ LL | If<{ FRAC <= 32 }>: True, help: consider enabling this feature --> $DIR/issue-94287.rs:1:1 | -LL | #![feature(generic_const_exprs)] +LL + #![feature(generic_const_exprs)] | error: aborting due to previous error diff --git a/tests/ui/const-generics/generic_const_exprs/mismatched-gat-subst-kind.rs b/tests/ui/const-generics/generic_const_exprs/mismatched-gat-subst-kind.rs new file mode 100644 index 000000000..734a37862 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/mismatched-gat-subst-kind.rs @@ -0,0 +1,11 @@ +#![feature(generic_const_exprs)] +//~^ WARN the feature `generic_const_exprs` is incomplete + +trait B { + type U; +} + +fn f = ()>>() {} +//~^ ERROR constant provided when a type was expected + +fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/mismatched-gat-subst-kind.stderr b/tests/ui/const-generics/generic_const_exprs/mismatched-gat-subst-kind.stderr new file mode 100644 index 000000000..8b6eb5b75 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/mismatched-gat-subst-kind.stderr @@ -0,0 +1,18 @@ +warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/mismatched-gat-subst-kind.rs:1:12 + | +LL | #![feature(generic_const_exprs)] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #76560 for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0747]: constant provided when a type was expected + --> $DIR/mismatched-gat-subst-kind.rs:8:13 + | +LL | fn f = ()>>() {} + | ^^^^ + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0747`. diff --git a/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.rs b/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.rs new file mode 100644 index 000000000..85345d65c --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.rs @@ -0,0 +1,52 @@ +// check-pass +// known-bug: #97156 + +#![feature(const_type_id, generic_const_exprs)] +#![allow(incomplete_features)] + +use std::any::TypeId; +// `One` and `Two` are currently considered equal types, as both +// `One <: Two` and `One :> Two` holds. +type One = for<'a> fn(&'a (), &'a ()); +type Two = for<'a, 'b> fn(&'a (), &'b ()); +trait AssocCt { + const ASSOC: usize; +} +const fn to_usize() -> usize { + const WHAT_A_TYPE: TypeId = TypeId::of::(); + match TypeId::of::() { + WHAT_A_TYPE => 0, + _ => 1000, + } +} +impl AssocCt for T { + const ASSOC: usize = to_usize::(); +} + +trait WithAssoc { + type Assoc; +} +impl WithAssoc<()> for T where [(); ::ASSOC]: { + type Assoc = [u8; ::ASSOC]; +} + +fn generic(x: >::Assoc) -> >::Assoc +where + [(); ::ASSOC]:, + T: WithAssoc, +{ + x +} + + +fn unsound(x: >::Assoc) -> >::Assoc +where + One: WithAssoc, +{ + let x: >::Assoc = generic::(x); + x +} + +fn main() { + println!("{:?}", unsound::<()>([])); +} diff --git a/tests/ui/const-generics/issue-93647.rs b/tests/ui/const-generics/issue-93647.rs index 806540e17..a0083a0c6 100644 --- a/tests/ui/const-generics/issue-93647.rs +++ b/tests/ui/const-generics/issue-93647.rs @@ -1,6 +1,7 @@ struct X; fn main() {} diff --git a/tests/ui/const-generics/issue-93647.stderr b/tests/ui/const-generics/issue-93647.stderr index 18370eea5..20a6af5c5 100644 --- a/tests/ui/const-generics/issue-93647.stderr +++ b/tests/ui/const-generics/issue-93647.stderr @@ -1,3 +1,17 @@ +error[E0277]: the trait bound `[closure@$DIR/issue-93647.rs:2:6: 2:8]: Fn<()>` is not satisfied + --> $DIR/issue-93647.rs:2:5 + | +LL | (||1usize)() + | ^^^^^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-93647.rs:2:6: 2:8]` + | + = help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-93647.rs:2:6: 2:8]` +note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-93647.rs:2:6: 2:8]`, but that implementation is not `const` + --> $DIR/issue-93647.rs:2:5 + | +LL | (||1usize)() + | ^^^^^^^^^^^^ + = note: wrap the `[closure@$DIR/issue-93647.rs:2:6: 2:8]` in a closure with no arguments: `|| { /* code */ }` + error[E0015]: cannot call non-const closure in constants --> $DIR/issue-93647.rs:2:5 | @@ -8,6 +22,7 @@ LL | (||1usize)() = note: calls in constants are limited to constant functions, tuple structs and tuple variants = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable -error: aborting due to previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0015`. +Some errors have detailed explanations: E0015, E0277. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/const-generics/issues/issue-82956.stderr b/tests/ui/const-generics/issues/issue-82956.stderr index d2320293e..d70c8d0bf 100644 --- a/tests/ui/const-generics/issues/issue-82956.stderr +++ b/tests/ui/const-generics/issues/issue-82956.stderr @@ -6,13 +6,13 @@ LL | let mut iter = IntoIter::new(self); | help: consider importing one of these items | -LL | use std::array::IntoIter; +LL + use std::array::IntoIter; | -LL | use std::collections::binary_heap::IntoIter; +LL + use std::collections::binary_heap::IntoIter; | -LL | use std::collections::btree_map::IntoIter; +LL + use std::collections::btree_map::IntoIter; | -LL | use std::collections::btree_set::IntoIter; +LL + use std::collections::btree_set::IntoIter; | and 8 other candidates diff --git a/tests/ui/const-generics/transmute-fail.rs b/tests/ui/const-generics/transmute-fail.rs new file mode 100644 index 000000000..d7bf1b47f --- /dev/null +++ b/tests/ui/const-generics/transmute-fail.rs @@ -0,0 +1,35 @@ +#![feature(transmute_generic_consts)] +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +fn foo(v: [[u32;H+1]; W]) -> [[u32; W+1]; H] { + unsafe { + std::mem::transmute(v) + //~^ ERROR cannot transmute + } +} + +fn bar(v: [[u32; H]; W]) -> [[u32; W]; H] { + //~^ ERROR mismatched types + //~| ERROR mismatched types + unsafe { + std::mem::transmute(v) + //~^ ERROR cannot transmute between types + } +} + +fn baz(v: [[u32; H]; W]) -> [u32; W * H * H] { + unsafe { + std::mem::transmute(v) + //~^ ERROR cannot transmute + } +} + +fn overflow(v: [[[u32; 8888888]; 9999999]; 777777777]) -> [[[u32; 9999999]; 777777777]; 8888888] { + unsafe { + std::mem::transmute(v) + //~^ ERROR cannot transmute + } +} + +fn main() {} diff --git a/tests/ui/const-generics/transmute-fail.stderr b/tests/ui/const-generics/transmute-fail.stderr new file mode 100644 index 000000000..41b098135 --- /dev/null +++ b/tests/ui/const-generics/transmute-fail.stderr @@ -0,0 +1,52 @@ +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-fail.rs:7:5 + | +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `[[u32; H+1]; W]` (generic size [const expr]) + = note: target type: `[[u32; W+1]; H]` (generic size [const expr]) + +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-fail.rs:16:5 + | +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `[[u32; H]; W]` (this type does not have a fixed size) + = note: target type: `[[u32; W]; H]` (size can vary because of [u32; W]) + +error[E0308]: mismatched types + --> $DIR/transmute-fail.rs:12:53 + | +LL | fn bar(v: [[u32; H]; W]) -> [[u32; W]; H] { + | ^ expected `usize`, found `bool` + +error[E0308]: mismatched types + --> $DIR/transmute-fail.rs:12:67 + | +LL | fn bar(v: [[u32; H]; W]) -> [[u32; W]; H] { + | ^ expected `usize`, found `bool` + +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-fail.rs:23:5 + | +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `[[u32; H]; W]` (generic size [const expr]) + = note: target type: `[u32; W * H * H]` (generic size [const expr]) + +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-fail.rs:30:5 + | +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `[[[u32; 8888888]; 9999999]; 777777777]` (values of the type `[[[u32; 8888888]; 9999999]; 777777777]` are too big for the current architecture) + = note: target type: `[[[u32; 9999999]; 777777777]; 8888888]` (values of the type `[[[u32; 9999999]; 777777777]; 8888888]` are too big for the current architecture) + +error: aborting due to 6 previous errors + +Some errors have detailed explanations: E0308, E0512. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/const-generics/transmute.rs b/tests/ui/const-generics/transmute.rs new file mode 100644 index 000000000..30560a95b --- /dev/null +++ b/tests/ui/const-generics/transmute.rs @@ -0,0 +1,83 @@ +// run-pass +#![feature(generic_const_exprs)] +#![feature(transmute_generic_consts)] +#![allow(incomplete_features)] + +fn transpose(v: [[u32;H]; W]) -> [[u32; W]; H] { + unsafe { + std::mem::transmute(v) + } +} + +fn ident(v: [[u32; H]; W]) -> [[u32; H]; W] { + unsafe { + std::mem::transmute(v) + } +} + +fn flatten(v: [[u32; H]; W]) -> [u32; W * H] { + unsafe { + std::mem::transmute(v) + } +} + +fn coagulate(v: [u32; H*W]) -> [[u32; W];H] { + unsafe { + std::mem::transmute(v) + } +} + +fn flatten_3d( + v: [[[u32; D]; H]; W] +) -> [u32; D * W * H] { + unsafe { + std::mem::transmute(v) + } +} + +fn flatten_somewhat( + v: [[[u32; D]; H]; W] +) -> [[u32; D * W]; H] { + unsafe { + std::mem::transmute(v) + } +} + +fn known_size(v: [u16; L]) -> [u8; L * 2] { + unsafe { + std::mem::transmute(v) + } +} + +fn condense_bytes(v: [u8; L * 2]) -> [u16; L] { + unsafe { + std::mem::transmute(v) + } +} + +fn singleton_each(v: [u8; L]) -> [[u8;1]; L] { + unsafe { + std::mem::transmute(v) + } +} + +fn transpose_with_const( + v: [[u32; 2 * H]; W + W] +) -> [[u32; W + W]; 2 * H] { + unsafe { + std::mem::transmute(v) + } +} + +fn main() { + let _ = transpose([[0; 8]; 16]); + let _ = transpose_with_const::<8,4>([[0; 8]; 16]); + let _ = ident([[0; 8]; 16]); + let _ = flatten([[0; 13]; 5]); + let _: [[_; 5]; 13] = coagulate([0; 65]); + let _ = flatten_3d([[[0; 3]; 13]; 5]); + let _ = flatten_somewhat([[[0; 3]; 13]; 5]); + let _ = known_size([16; 13]); + let _: [u16; 5] = condense_bytes([16u8; 10]); + let _ = singleton_each([16; 10]); +} diff --git a/tests/ui/const-generics/transmute_no_gate.rs b/tests/ui/const-generics/transmute_no_gate.rs new file mode 100644 index 000000000..e1ac44390 --- /dev/null +++ b/tests/ui/const-generics/transmute_no_gate.rs @@ -0,0 +1,91 @@ +// gate-test-transmute_generic_consts +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +fn transpose(v: [[u32;H]; W]) -> [[u32; W]; H] { + unsafe { + std::mem::transmute(v) + //~^ ERROR cannot transmute + } +} + +fn ident(v: [[u32; H]; W]) -> [[u32; H]; W] { + unsafe { + std::mem::transmute(v) + } +} + +fn flatten(v: [[u32; H]; W]) -> [u32; W * H] { + unsafe { + std::mem::transmute(v) + //~^ ERROR cannot transmute + } +} + +fn coagulate(v: [u32; H*W]) -> [[u32; W];H] { + unsafe { + std::mem::transmute(v) + //~^ ERROR cannot transmute + } +} + +fn flatten_3d( + v: [[[u32; D]; H]; W] +) -> [u32; D * W * H] { + unsafe { + std::mem::transmute(v) + //~^ ERROR cannot transmute + } +} + +fn flatten_somewhat( + v: [[[u32; D]; H]; W] +) -> [[u32; D * W]; H] { + unsafe { + std::mem::transmute(v) + //~^ ERROR cannot transmute + } +} + +fn known_size(v: [u16; L]) -> [u8; L * 2] { + unsafe { + std::mem::transmute(v) + //~^ ERROR cannot transmute + } +} + +fn condense_bytes(v: [u8; L * 2]) -> [u16; L] { + unsafe { + std::mem::transmute(v) + //~^ ERROR cannot transmute + } +} + +fn singleton_each(v: [u8; L]) -> [[u8;1]; L] { + unsafe { + std::mem::transmute(v) + //~^ ERROR cannot transmute + } +} + +fn transpose_with_const( + v: [[u32; 2 * H]; W + W] +) -> [[u32; W + W]; 2 * H] { + unsafe { + std::mem::transmute(v) + //~^ ERROR cannot transmute + } +} + +fn main() { + let _ = transpose([[0; 8]; 16]); + let _ = transpose_with_const::<8,4>([[0; 8]; 16]); + let _ = ident([[0; 8]; 16]); + let _ = flatten([[0; 13]; 5]); + let _: [[_; 5]; 13] = coagulate([0; 65]); + let _ = flatten_3d([[[0; 3]; 13]; 5]); + let _ = flatten_somewhat([[[0; 3]; 13]; 5]); + let _ = known_size([16; 13]); + let _: [u16; 5] = condense_bytes([16u8; 10]); + let _ = singleton_each([16; 10]); +} diff --git a/tests/ui/const-generics/transmute_no_gate.stderr b/tests/ui/const-generics/transmute_no_gate.stderr new file mode 100644 index 000000000..9c271b348 --- /dev/null +++ b/tests/ui/const-generics/transmute_no_gate.stderr @@ -0,0 +1,84 @@ +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute_no_gate.rs:7:5 + | +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `[[u32; H]; W]` (this type does not have a fixed size) + = note: target type: `[[u32; W]; H]` (this type does not have a fixed size) + +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute_no_gate.rs:20:5 + | +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `[[u32; H]; W]` (this type does not have a fixed size) + = note: target type: `[u32; W * H]` (this type does not have a fixed size) + +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute_no_gate.rs:27:5 + | +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `[u32; H*W]` (this type does not have a fixed size) + = note: target type: `[[u32; W]; H]` (this type does not have a fixed size) + +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute_no_gate.rs:36:5 + | +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `[[[u32; D]; H]; W]` (this type does not have a fixed size) + = note: target type: `[u32; D * W * H]` (this type does not have a fixed size) + +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute_no_gate.rs:45:5 + | +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `[[[u32; D]; H]; W]` (this type does not have a fixed size) + = note: target type: `[[u32; D * W]; H]` (this type does not have a fixed size) + +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute_no_gate.rs:52:5 + | +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `[u16; L]` (this type does not have a fixed size) + = note: target type: `[u8; L * 2]` (this type does not have a fixed size) + +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute_no_gate.rs:59:5 + | +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `[u8; L * 2]` (this type does not have a fixed size) + = note: target type: `[u16; L]` (this type does not have a fixed size) + +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute_no_gate.rs:66:5 + | +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `[u8; L]` (this type does not have a fixed size) + = note: target type: `[[u8; 1]; L]` (this type does not have a fixed size) + +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute_no_gate.rs:75:5 + | +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `[[u32; 2 * H]; W + W]` (this type does not have a fixed size) + = note: target type: `[[u32; W + W]; 2 * H]` (this type does not have a fixed size) + +error: aborting due to 9 previous errors + +For more information about this error, try `rustc --explain E0512`. diff --git a/tests/ui/const-generics/type_mismatch.rs b/tests/ui/const-generics/type_mismatch.rs index 4a7534e37..daa13277b 100644 --- a/tests/ui/const-generics/type_mismatch.rs +++ b/tests/ui/const-generics/type_mismatch.rs @@ -1,5 +1,6 @@ fn foo() -> [u8; N] { bar::() //~ ERROR mismatched types + //~^ ERROR the constant `N` is not of type `u8` } fn bar() -> [u8; N] {} diff --git a/tests/ui/const-generics/type_mismatch.stderr b/tests/ui/const-generics/type_mismatch.stderr index b28ae8f7e..394dd44d4 100644 --- a/tests/ui/const-generics/type_mismatch.stderr +++ b/tests/ui/const-generics/type_mismatch.stderr @@ -1,3 +1,15 @@ +error: the constant `N` is not of type `u8` + --> $DIR/type_mismatch.rs:2:11 + | +LL | bar::() + | ^ expected `u8`, found `usize` + | +note: required by a bound in `bar` + --> $DIR/type_mismatch.rs:6:8 + | +LL | fn bar() -> [u8; N] {} + | ^^^^^^^^^^^ required by this bound in `bar` + error[E0308]: mismatched types --> $DIR/type_mismatch.rs:2:11 | @@ -5,7 +17,7 @@ LL | bar::() | ^ expected `u8`, found `usize` error[E0308]: mismatched types - --> $DIR/type_mismatch.rs:5:26 + --> $DIR/type_mismatch.rs:6:26 | LL | fn bar() -> [u8; N] {} | --- ^^^^^^^ expected `[u8; N]`, found `()` @@ -13,11 +25,11 @@ LL | fn bar() -> [u8; N] {} | implicitly returns `()` as its body has no tail or `return` expression error[E0308]: mismatched types - --> $DIR/type_mismatch.rs:5:31 + --> $DIR/type_mismatch.rs:6:31 | LL | fn bar() -> [u8; N] {} | ^ expected `usize`, found `u8` -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/const-generics/type_not_in_scope.rs b/tests/ui/const-generics/type_not_in_scope.rs index 593370180..917abaed1 100644 --- a/tests/ui/const-generics/type_not_in_scope.rs +++ b/tests/ui/const-generics/type_not_in_scope.rs @@ -6,6 +6,5 @@ impl X { } fn getn() -> [u8; N] {} //~^ ERROR expected type, found built-in attribute `cfg_attr` -//~| ERROR mismatched types fn main() {} diff --git a/tests/ui/const-generics/type_not_in_scope.stderr b/tests/ui/const-generics/type_not_in_scope.stderr index 5f45550a6..5eb81ca05 100644 --- a/tests/ui/const-generics/type_not_in_scope.stderr +++ b/tests/ui/const-generics/type_not_in_scope.stderr @@ -10,15 +10,7 @@ error[E0573]: expected type, found built-in attribute `cfg_attr` LL | fn getn() -> [u8; N] {} | ^^^^^^^^ not a type -error[E0308]: mismatched types - --> $DIR/type_not_in_scope.rs:7:33 - | -LL | fn getn() -> [u8; N] {} - | ---- ^^^^^^^ expected `[u8; N]`, found `()` - | | - | implicitly returns `()` as its body has no tail or `return` expression - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0308, E0412, E0573. -For more information about an error, try `rustc --explain E0308`. +Some errors have detailed explanations: E0412, E0573. +For more information about an error, try `rustc --explain E0412`. diff --git a/tests/ui/const-ptr/out_of_bounds_read.stderr b/tests/ui/const-ptr/out_of_bounds_read.stderr index 3e7b09a59..89536f53f 100644 --- a/tests/ui/const-ptr/out_of_bounds_read.stderr +++ b/tests/ui/const-ptr/out_of_bounds_read.stderr @@ -1,7 +1,7 @@ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL | - = note: memory access failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds + = note: dereferencing pointer failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds | note: inside `std::ptr::read::` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL @@ -14,7 +14,7 @@ LL | const _READ: u32 = unsafe { ptr::read(PAST_END_PTR) }; error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL | - = note: memory access failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds + = note: dereferencing pointer failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds | note: inside `std::ptr::read::` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL @@ -29,7 +29,7 @@ LL | const _CONST_READ: u32 = unsafe { PAST_END_PTR.read() }; error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL | - = note: memory access failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds + = note: dereferencing pointer failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds | note: inside `std::ptr::read::` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL diff --git a/tests/ui/const_prop/issue-86351.rs b/tests/ui/const_prop/issue-86351.rs new file mode 100644 index 000000000..b5f1e7f74 --- /dev/null +++ b/tests/ui/const_prop/issue-86351.rs @@ -0,0 +1,22 @@ +// compile-flags: --crate-type=lib -Zmir-opt-level=2 +// build-pass +// ^-- Must be build-pass, because check-pass will not run const prop. + +pub trait TestTrait { + type MyType; + fn func() -> Option + where + Self: Sized; +} + +impl dyn TestTrait +where + Self: Sized, +{ + pub fn other_func() -> Option { + match Self::func() { + Some(me) => Some(me), + None => None, + } + } +} diff --git a/tests/ui/const_prop/unreachable-bounds.rs b/tests/ui/const_prop/unreachable-bounds.rs new file mode 100644 index 000000000..8cf98e154 --- /dev/null +++ b/tests/ui/const_prop/unreachable-bounds.rs @@ -0,0 +1,6 @@ +// Use `build-pass` to ensure const-prop lint runs. +// build-pass + +fn main() { + [()][if false { 1 } else { return }] +} diff --git a/tests/ui/const_prop/unreachable-overflow.rs b/tests/ui/const_prop/unreachable-overflow.rs new file mode 100644 index 000000000..287513542 --- /dev/null +++ b/tests/ui/const_prop/unreachable-overflow.rs @@ -0,0 +1,10 @@ +// Use `build-pass` to ensure const-prop lint runs. +// build-pass + +fn main() { + let x = 2u32; + let y = 3u32; + if y <= x { + dbg!(x - y); + } +} diff --git a/tests/ui/consts/const-block-const-bound.stderr b/tests/ui/consts/const-block-const-bound.stderr index b9c4d8866..fef4914fa 100644 --- a/tests/ui/consts/const-block-const-bound.stderr +++ b/tests/ui/consts/const-block-const-bound.stderr @@ -1,44 +1,30 @@ error[E0277]: can't drop `UnconstDrop` in const contexts - --> $DIR/const-block-const-bound.rs:20:11 + --> $DIR/const-block-const-bound.rs:20:9 | LL | f(UnconstDrop); - | - ^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `UnconstDrop` - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `UnconstDrop` | = note: the trait bound `UnconstDrop: ~const Destruct` is not satisfied -note: required by a bound in `f` - --> $DIR/const-block-const-bound.rs:6:15 - | -LL | const fn f(x: T) {} - | ^^^^^^^^^^^^^^^ required by this bound in `f` help: consider borrowing here | -LL | f(&UnconstDrop); - | + -LL | f(&mut UnconstDrop); - | ++++ +LL | &f(UnconstDrop); + | + +LL | &mut f(UnconstDrop); + | ++++ error[E0277]: can't drop `NonDrop` in const contexts - --> $DIR/const-block-const-bound.rs:22:11 + --> $DIR/const-block-const-bound.rs:22:9 | LL | f(NonDrop); - | - ^^^^^^^ the trait `~const Destruct` is not implemented for `NonDrop` - | | - | required by a bound introduced by this call + | ^^^^^^^^^^ the trait `~const Destruct` is not implemented for `NonDrop` | = note: the trait bound `NonDrop: ~const Destruct` is not satisfied -note: required by a bound in `f` - --> $DIR/const-block-const-bound.rs:6:15 - | -LL | const fn f(x: T) {} - | ^^^^^^^^^^^^^^^ required by this bound in `f` help: consider borrowing here | -LL | f(&NonDrop); - | + -LL | f(&mut NonDrop); - | ++++ +LL | &f(NonDrop); + | + +LL | &mut f(NonDrop); + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr b/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr index ee352700c..174103eeb 100644 --- a/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr +++ b/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr @@ -10,7 +10,8 @@ LL | let _: [Option; 2] = [no_copy(); 2]; = help: create an inline `const` block, see RFC #2920 for more information help: consider annotating `Bar` with `#[derive(Copy)]` | -LL | #[derive(Copy)] +LL + #[derive(Copy)] +LL | struct Bar; | error: aborting due to previous error diff --git a/tests/ui/consts/const-blocks/migrate-fail.stderr b/tests/ui/consts/const-blocks/migrate-fail.stderr index 928ffd083..d1896f755 100644 --- a/tests/ui/consts/const-blocks/migrate-fail.stderr +++ b/tests/ui/consts/const-blocks/migrate-fail.stderr @@ -8,7 +8,8 @@ LL | let arr: [Option; 2] = [x; 2]; = note: the `Copy` trait is required because this value will be copied for each element of the array help: consider annotating `Bar` with `#[derive(Copy)]` | -LL | #[derive(Copy)] +LL + #[derive(Copy)] +LL | struct Bar; | error[E0277]: the trait bound `Bar: Copy` is not satisfied @@ -21,7 +22,8 @@ LL | let arr: [Option; 2] = [x; 2]; = note: the `Copy` trait is required because this value will be copied for each element of the array help: consider annotating `Bar` with `#[derive(Copy)]` | -LL | #[derive(Copy)] +LL + #[derive(Copy)] +LL | struct Bar; | error: aborting due to 2 previous errors diff --git a/tests/ui/consts/const-blocks/nll-fail.stderr b/tests/ui/consts/const-blocks/nll-fail.stderr index fede00845..807c964a5 100644 --- a/tests/ui/consts/const-blocks/nll-fail.stderr +++ b/tests/ui/consts/const-blocks/nll-fail.stderr @@ -8,7 +8,8 @@ LL | let arr: [Option; 2] = [x; 2]; = note: the `Copy` trait is required because this value will be copied for each element of the array help: consider annotating `Bar` with `#[derive(Copy)]` | -LL | #[derive(Copy)] +LL + #[derive(Copy)] +LL | struct Bar; | error[E0277]: the trait bound `Bar: Copy` is not satisfied @@ -21,7 +22,8 @@ LL | let arr: [Option; 2] = [x; 2]; = note: the `Copy` trait is required because this value will be copied for each element of the array help: consider annotating `Bar` with `#[derive(Copy)]` | -LL | #[derive(Copy)] +LL + #[derive(Copy)] +LL | struct Bar; | error: aborting due to 2 previous errors diff --git a/tests/ui/consts/const-err-late.stderr b/tests/ui/consts/const-err-late.stderr index cb0cab244..149d3b523 100644 --- a/tests/ui/consts/const-err-late.stderr +++ b/tests/ui/consts/const-err-late.stderr @@ -10,12 +10,6 @@ note: erroneous constant used LL | black_box((S::::FOO, S::::FOO)); | ^^^^^^^^^^^^^ -note: erroneous constant used - --> $DIR/const-err-late.rs:19:16 - | -LL | black_box((S::::FOO, S::::FOO)); - | ^^^^^^^^^^^^^ - error[E0080]: evaluation of `S::::FOO` failed --> $DIR/const-err-late.rs:13:21 | diff --git a/tests/ui/consts/const-eval/const-eval-overflow-2.rs b/tests/ui/consts/const-eval/const-eval-overflow-2.rs index 535d91359..c19a0c443 100644 --- a/tests/ui/consts/const-eval/const-eval-overflow-2.rs +++ b/tests/ui/consts/const-eval/const-eval-overflow-2.rs @@ -14,7 +14,6 @@ fn main() { match -128i8 { NEG_NEG_128 => println!("A"), //~^ ERROR could not evaluate constant pattern - //~| ERROR could not evaluate constant pattern _ => println!("B"), } } diff --git a/tests/ui/consts/const-eval/const-eval-overflow-2.stderr b/tests/ui/consts/const-eval/const-eval-overflow-2.stderr index 7b1fe49d4..fc0baf110 100644 --- a/tests/ui/consts/const-eval/const-eval-overflow-2.stderr +++ b/tests/ui/consts/const-eval/const-eval-overflow-2.stderr @@ -10,12 +10,6 @@ error: could not evaluate constant pattern LL | NEG_NEG_128 => println!("A"), | ^^^^^^^^^^^ -error: could not evaluate constant pattern - --> $DIR/const-eval-overflow-2.rs:15:9 - | -LL | NEG_NEG_128 => println!("A"), - | ^^^^^^^^^^^ - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const-eval/format.rs b/tests/ui/consts/const-eval/format.rs index 0d8b7c12d..5bdb2bf19 100644 --- a/tests/ui/consts/const-eval/format.rs +++ b/tests/ui/consts/const-eval/format.rs @@ -1,12 +1,13 @@ const fn failure() { panic!("{:?}", 0); //~^ ERROR cannot call non-const formatting macro in constant functions + //~| ERROR cannot call non-const fn `Arguments::<'_>::new_v1` in constant functions } const fn print() { println!("{:?}", 0); //~^ ERROR cannot call non-const formatting macro in constant functions - //~| ERROR `Arguments::<'a>::new_v1` is not yet stable as a const fn + //~| ERROR cannot call non-const fn `Arguments::<'_>::new_v1` in constant functions //~| ERROR cannot call non-const fn `_print` in constant functions } diff --git a/tests/ui/consts/const-eval/format.stderr b/tests/ui/consts/const-eval/format.stderr index 4bf39db58..70a1abb0a 100644 --- a/tests/ui/consts/const-eval/format.stderr +++ b/tests/ui/consts/const-eval/format.stderr @@ -1,32 +1,41 @@ error[E0015]: cannot call non-const formatting macro in constant functions - --> $DIR/format.rs:2:20 + --> $DIR/format.rs:2:13 | LL | panic!("{:?}", 0); - | ^ + | ^^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + = note: this error originates in the macro `$crate::const_format_args` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0015]: cannot call non-const fn `Arguments::<'_>::new_v1` in constant functions + --> $DIR/format.rs:2:5 + | +LL | panic!("{:?}", 0); + | ^^^^^^^^^^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants = note: this error originates in the macro `$crate::const_format_args` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0015]: cannot call non-const formatting macro in constant functions - --> $DIR/format.rs:7:22 + --> $DIR/format.rs:8:15 | LL | println!("{:?}", 0); - | ^ + | ^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) -error: `Arguments::<'a>::new_v1` is not yet stable as a const fn - --> $DIR/format.rs:7:5 +error[E0015]: cannot call non-const fn `Arguments::<'_>::new_v1` in constant functions + --> $DIR/format.rs:8:5 | LL | println!("{:?}", 0); | ^^^^^^^^^^^^^^^^^^^ | - = help: add `#![feature(const_fmt_arguments_new)]` to the crate attributes to enable + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0015]: cannot call non-const fn `_print` in constant functions - --> $DIR/format.rs:7:5 + --> $DIR/format.rs:8:5 | LL | println!("{:?}", 0); | ^^^^^^^^^^^^^^^^^^^ @@ -63,19 +72,19 @@ LL | panic!("{:?}", 0); = note: this note originates in the macro `$crate::const_format_args` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) note: erroneous constant used - --> $DIR/format.rs:7:14 + --> $DIR/format.rs:8:14 | LL | println!("{:?}", 0); | ^^^^^^ note: erroneous constant used - --> $DIR/format.rs:7:14 + --> $DIR/format.rs:8:14 | LL | println!("{:?}", 0); | ^^^^^^ note: erroneous constant used - --> $DIR/format.rs:7:22 + --> $DIR/format.rs:8:22 | LL | println!("{:?}", 0); | ^ @@ -83,13 +92,13 @@ LL | println!("{:?}", 0); = note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) note: erroneous constant used - --> $DIR/format.rs:7:22 + --> $DIR/format.rs:8:22 | LL | println!("{:?}", 0); | ^ | = note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 4 previous errors +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/consts/const-eval/issue-44578.stderr b/tests/ui/consts/const-eval/issue-44578.stderr index 0cbf54480..f3952809e 100644 --- a/tests/ui/consts/const-eval/issue-44578.stderr +++ b/tests/ui/consts/const-eval/issue-44578.stderr @@ -26,14 +26,6 @@ LL | println!("{}", as Foo>::AMT); | = note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) -note: erroneous constant used - --> $DIR/issue-44578.rs:25:20 - | -LL | println!("{}", as Foo>::AMT); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) - error: aborting due to previous error For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const-eval/panic-assoc-never-type.rs b/tests/ui/consts/const-eval/panic-assoc-never-type.rs index 28edf5144..1abe708d1 100644 --- a/tests/ui/consts/const-eval/panic-assoc-never-type.rs +++ b/tests/ui/consts/const-eval/panic-assoc-never-type.rs @@ -11,5 +11,5 @@ impl PrintName { } fn main() { - let _ = PrintName::VOID; //~ constant + let _ = PrintName::VOID; //~ erroneous constant used } diff --git a/tests/ui/consts/const-eval/ref_to_int_match.32bit.stderr b/tests/ui/consts/const-eval/ref_to_int_match.32bit.stderr index 032ceb246..eaa2d6b27 100644 --- a/tests/ui/consts/const-eval/ref_to_int_match.32bit.stderr +++ b/tests/ui/consts/const-eval/ref_to_int_match.32bit.stderr @@ -1,5 +1,5 @@ error[E0080]: evaluation of constant value failed - --> $DIR/ref_to_int_match.rs:25:27 + --> $DIR/ref_to_int_match.rs:24:27 | LL | const BAR: Int = unsafe { Foo { r: &42 }.f }; | ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -13,12 +13,6 @@ error: could not evaluate constant pattern LL | 10..=BAR => {}, | ^^^ -error: could not evaluate constant pattern - --> $DIR/ref_to_int_match.rs:7:14 - | -LL | 10..=BAR => {}, - | ^^^ - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const-eval/ref_to_int_match.64bit.stderr b/tests/ui/consts/const-eval/ref_to_int_match.64bit.stderr index 032ceb246..eaa2d6b27 100644 --- a/tests/ui/consts/const-eval/ref_to_int_match.64bit.stderr +++ b/tests/ui/consts/const-eval/ref_to_int_match.64bit.stderr @@ -1,5 +1,5 @@ error[E0080]: evaluation of constant value failed - --> $DIR/ref_to_int_match.rs:25:27 + --> $DIR/ref_to_int_match.rs:24:27 | LL | const BAR: Int = unsafe { Foo { r: &42 }.f }; | ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -13,12 +13,6 @@ error: could not evaluate constant pattern LL | 10..=BAR => {}, | ^^^ -error: could not evaluate constant pattern - --> $DIR/ref_to_int_match.rs:7:14 - | -LL | 10..=BAR => {}, - | ^^^ - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const-eval/ref_to_int_match.rs b/tests/ui/consts/const-eval/ref_to_int_match.rs index 70c6e7d94..a2dabde25 100644 --- a/tests/ui/consts/const-eval/ref_to_int_match.rs +++ b/tests/ui/consts/const-eval/ref_to_int_match.rs @@ -5,7 +5,6 @@ fn main() { match n { 0..=10 => {}, 10..=BAR => {}, //~ ERROR could not evaluate constant pattern - //~| ERROR could not evaluate constant pattern _ => {}, } } diff --git a/tests/ui/consts/const-eval/transmute-size-mismatch.rs b/tests/ui/consts/const-eval/transmute-size-mismatch.rs new file mode 100644 index 000000000..2410baea2 --- /dev/null +++ b/tests/ui/consts/const-eval/transmute-size-mismatch.rs @@ -0,0 +1,24 @@ +#![feature(core_intrinsics)] +#![feature(custom_mir)] + +// These cases are statically rejected by `mem::transmute`, so we need custom +// MIR to be able to get to constant evaluation. +use std::intrinsics::mir::*; + +#[custom_mir(dialect = "runtime", phase = "initial")] +const unsafe fn mir_transmute(x: T) -> U { + mir!{ + { + RET = CastTransmute(x); + //~^ ERROR evaluation of constant value failed + //~| ERROR evaluation of constant value failed + Return() + } + } +} + +const FROM_BIGGER: u16 = unsafe { mir_transmute(123_i32) }; + +const FROM_SMALLER: u32 = unsafe { mir_transmute(123_i16) }; + +fn main() {} diff --git a/tests/ui/consts/const-eval/transmute-size-mismatch.stderr b/tests/ui/consts/const-eval/transmute-size-mismatch.stderr new file mode 100644 index 000000000..e051491d3 --- /dev/null +++ b/tests/ui/consts/const-eval/transmute-size-mismatch.stderr @@ -0,0 +1,37 @@ +error[E0080]: evaluation of constant value failed + --> $DIR/transmute-size-mismatch.rs:12:13 + | +LL | RET = CastTransmute(x); + | ^^^^^^^^^^^^^^^^^^^^^^ transmuting from 4-byte type to 2-byte type: `i32` -> `u16` + | +note: inside `mir_transmute::` + --> $DIR/transmute-size-mismatch.rs:12:13 + | +LL | RET = CastTransmute(x); + | ^^^^^^^^^^^^^^^^^^^^^^ +note: inside `FROM_BIGGER` + --> $DIR/transmute-size-mismatch.rs:20:35 + | +LL | const FROM_BIGGER: u16 = unsafe { mir_transmute(123_i32) }; + | ^^^^^^^^^^^^^^^^^^^^^^ + +error[E0080]: evaluation of constant value failed + --> $DIR/transmute-size-mismatch.rs:12:13 + | +LL | RET = CastTransmute(x); + | ^^^^^^^^^^^^^^^^^^^^^^ transmuting from 2-byte type to 4-byte type: `i16` -> `u32` + | +note: inside `mir_transmute::` + --> $DIR/transmute-size-mismatch.rs:12:13 + | +LL | RET = CastTransmute(x); + | ^^^^^^^^^^^^^^^^^^^^^^ +note: inside `FROM_SMALLER` + --> $DIR/transmute-size-mismatch.rs:22:36 + | +LL | const FROM_SMALLER: u32 = unsafe { mir_transmute(123_i16) }; + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const-eval/ub-enum.32bit.stderr b/tests/ui/consts/const-eval/ub-enum.32bit.stderr index 2d86bd88f..3ad1ac974 100644 --- a/tests/ui/consts/const-eval/ub-enum.32bit.stderr +++ b/tests/ui/consts/const-eval/ub-enum.32bit.stderr @@ -108,13 +108,13 @@ error[E0080]: evaluation of constant value failed --> $DIR/ub-enum.rs:96:77 | LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) }; - | ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type + | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0.1: encountered a value of uninhabited type Never error[E0080]: evaluation of constant value failed --> $DIR/ub-enum.rs:98:77 | LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) }; - | ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type + | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0.1: encountered a value of the never type `!` error: aborting due to 13 previous errors diff --git a/tests/ui/consts/const-eval/ub-enum.64bit.stderr b/tests/ui/consts/const-eval/ub-enum.64bit.stderr index a89d7ec5f..a66706d1a 100644 --- a/tests/ui/consts/const-eval/ub-enum.64bit.stderr +++ b/tests/ui/consts/const-eval/ub-enum.64bit.stderr @@ -108,13 +108,13 @@ error[E0080]: evaluation of constant value failed --> $DIR/ub-enum.rs:96:77 | LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) }; - | ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type + | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0.1: encountered a value of uninhabited type Never error[E0080]: evaluation of constant value failed --> $DIR/ub-enum.rs:98:77 | LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) }; - | ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type + | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0.1: encountered a value of the never type `!` error: aborting due to 13 previous errors diff --git a/tests/ui/consts/const-eval/ub-ref-ptr.stderr b/tests/ui/consts/const-eval/ub-ref-ptr.stderr index 6bd367b64..080568b51 100644 --- a/tests/ui/consts/const-eval/ub-ref-ptr.stderr +++ b/tests/ui/consts/const-eval/ub-ref-ptr.stderr @@ -148,11 +148,11 @@ LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) }; HEX_DUMP } -error: accessing memory with alignment 1, but alignment 4 is required +error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #68585 + = note: accessing memory with alignment 1, but alignment 4 is required + | note: inside `std::ptr::read::` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL note: inside `ptr::const_ptr::::read` @@ -162,25 +162,7 @@ note: inside `UNALIGNED_READ` | LL | ptr.read(); | ^^^^^^^^^^ - = note: `#[deny(invalid_alignment)]` on by default error: aborting due to 15 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -error: accessing memory with alignment 1, but alignment 4 is required - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #68585 -note: inside `std::ptr::read::` - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL -note: inside `ptr::const_ptr::::read` - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -note: inside `UNALIGNED_READ` - --> $DIR/ub-ref-ptr.rs:67:5 - | -LL | ptr.read(); - | ^^^^^^^^^^ - = note: `#[deny(invalid_alignment)]` on by default - diff --git a/tests/ui/consts/const-eval/ub-slice-get-unchecked.rs b/tests/ui/consts/const-eval/ub-slice-get-unchecked.rs new file mode 100644 index 000000000..d9a74b4f3 --- /dev/null +++ b/tests/ui/consts/const-eval/ub-slice-get-unchecked.rs @@ -0,0 +1,9 @@ +#![feature(const_slice_index)] + +const A: [(); 5] = [(), (), (), (), ()]; + +// Since the indexing is on a ZST, the addresses are all fine, +// but we should still catch the bad range. +const B: &[()] = unsafe { A.get_unchecked(3..1) }; + +fn main() {} diff --git a/tests/ui/consts/const-eval/ub-slice-get-unchecked.stderr b/tests/ui/consts/const-eval/ub-slice-get-unchecked.stderr new file mode 100644 index 000000000..775e475df --- /dev/null +++ b/tests/ui/consts/const-eval/ub-slice-get-unchecked.stderr @@ -0,0 +1,18 @@ +error[E0080]: evaluation of constant value failed + --> $SRC_DIR/core/src/slice/index.rs:LL:COL + | + = note: overflow executing `unchecked_sub` + | +note: inside ` as SliceIndex<[()]>>::get_unchecked` + --> $SRC_DIR/core/src/slice/index.rs:LL:COL +note: inside `core::slice::::get_unchecked::>` + --> $SRC_DIR/core/src/slice/mod.rs:LL:COL +note: inside `B` + --> $DIR/ub-slice-get-unchecked.rs:7:27 + | +LL | const B: &[()] = unsafe { A.get_unchecked(3..1) }; + | ^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const-eval/ub-uninhabit.rs b/tests/ui/consts/const-eval/ub-uninhabit.rs index 4c4ef216d..10edae437 100644 --- a/tests/ui/consts/const-eval/ub-uninhabit.rs +++ b/tests/ui/consts/const-eval/ub-uninhabit.rs @@ -14,12 +14,12 @@ union MaybeUninit { } const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init }; -//~^ ERROR it is undefined behavior to use this value +//~^ ERROR evaluation of constant value failed const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) }; //~^ ERROR it is undefined behavior to use this value const BAD_BAD_ARRAY: [Bar; 1] = unsafe { MaybeUninit { uninit: () }.init }; -//~^ ERROR it is undefined behavior to use this value +//~^ ERROR evaluation of constant value failed fn main() {} diff --git a/tests/ui/consts/const-eval/ub-uninhabit.stderr b/tests/ui/consts/const-eval/ub-uninhabit.stderr index 0ae376d03..733975fc0 100644 --- a/tests/ui/consts/const-eval/ub-uninhabit.stderr +++ b/tests/ui/consts/const-eval/ub-uninhabit.stderr @@ -1,11 +1,8 @@ -error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-uninhabit.rs:16:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-uninhabit.rs:16:35 | LL | const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init }; - | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of uninhabited type Bar - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of uninhabited type Bar error[E0080]: it is undefined behavior to use this value --> $DIR/ub-uninhabit.rs:19:1 @@ -18,14 +15,11 @@ LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) }; HEX_DUMP } -error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-uninhabit.rs:22:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-uninhabit.rs:22:42 | LL | const BAD_BAD_ARRAY: [Bar; 1] = unsafe { MaybeUninit { uninit: () }.init }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered a value of uninhabited type Bar - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered a value of uninhabited type Bar error: aborting due to 3 previous errors diff --git a/tests/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr b/tests/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr index 69fb1a59d..74bc6317c 100644 --- a/tests/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr +++ b/tests/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr @@ -11,7 +11,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/validate_uninhabited_zsts.rs:4:14 | LL | unsafe { std::mem::transmute(()) } - | ^^^^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type + | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of the never type `!` | note: inside `foo` --> $DIR/validate_uninhabited_zsts.rs:4:14 @@ -24,14 +24,11 @@ note: inside `FOO` LL | const FOO: [empty::Empty; 3] = [foo(); 3]; | ^^^^^ -error[E0080]: it is undefined behavior to use this value - --> $DIR/validate_uninhabited_zsts.rs:21:1 +error[E0080]: evaluation of constant value failed + --> $DIR/validate_uninhabited_zsts.rs:21:42 | LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0].0: encountered a value of uninhabited type empty::Void - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 0, align: 1) {} + | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered a value of uninhabited type empty::Void warning: the type `empty::Empty` does not permit zero-initialization --> $DIR/validate_uninhabited_zsts.rs:21:42 diff --git a/tests/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr b/tests/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr index 69fb1a59d..74bc6317c 100644 --- a/tests/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr +++ b/tests/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr @@ -11,7 +11,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/validate_uninhabited_zsts.rs:4:14 | LL | unsafe { std::mem::transmute(()) } - | ^^^^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type + | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of the never type `!` | note: inside `foo` --> $DIR/validate_uninhabited_zsts.rs:4:14 @@ -24,14 +24,11 @@ note: inside `FOO` LL | const FOO: [empty::Empty; 3] = [foo(); 3]; | ^^^^^ -error[E0080]: it is undefined behavior to use this value - --> $DIR/validate_uninhabited_zsts.rs:21:1 +error[E0080]: evaluation of constant value failed + --> $DIR/validate_uninhabited_zsts.rs:21:42 | LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0].0: encountered a value of uninhabited type empty::Void - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 0, align: 1) {} + | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered a value of uninhabited type empty::Void warning: the type `empty::Empty` does not permit zero-initialization --> $DIR/validate_uninhabited_zsts.rs:21:42 diff --git a/tests/ui/consts/const-eval/validate_uninhabited_zsts.rs b/tests/ui/consts/const-eval/validate_uninhabited_zsts.rs index c0b326215..b6783175d 100644 --- a/tests/ui/consts/const-eval/validate_uninhabited_zsts.rs +++ b/tests/ui/consts/const-eval/validate_uninhabited_zsts.rs @@ -19,7 +19,7 @@ pub mod empty { const FOO: [empty::Empty; 3] = [foo(); 3]; const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; -//~^ ERROR it is undefined behavior to use this value +//~^ ERROR evaluation of constant value failed //~| WARN the type `empty::Empty` does not permit zero-initialization fn main() { diff --git a/tests/ui/consts/const-fn-error.rs b/tests/ui/consts/const-fn-error.rs index 50b7ce1f8..dabbd58db 100644 --- a/tests/ui/consts/const-fn-error.rs +++ b/tests/ui/consts/const-fn-error.rs @@ -7,6 +7,7 @@ const fn f(x: usize) -> usize { //~| ERROR `for` is not allowed in a `const fn` //~| ERROR mutable references are not allowed in constant functions //~| ERROR cannot call non-const fn + //~| ERROR the trait bound sum += i; } sum diff --git a/tests/ui/consts/const-fn-error.stderr b/tests/ui/consts/const-fn-error.stderr index f735b3d53..73d235d6a 100644 --- a/tests/ui/consts/const-fn-error.stderr +++ b/tests/ui/consts/const-fn-error.stderr @@ -5,7 +5,7 @@ LL | / for i in 0..x { LL | | LL | | LL | | -LL | | +... | LL | | sum += i; LL | | } | |_____^ @@ -33,6 +33,19 @@ LL | for i in 0..x { = note: see issue #57349 for more information = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable +error[E0277]: the trait bound `std::ops::Range: Iterator` is not satisfied + --> $DIR/const-fn-error.rs:5:14 + | +LL | for i in 0..x { + | ^^^^ `std::ops::Range` is not an iterator + | + = help: the trait `~const Iterator` is not implemented for `std::ops::Range` +note: the trait `Iterator` is implemented for `std::ops::Range`, but that implementation is not `const` + --> $DIR/const-fn-error.rs:5:14 + | +LL | for i in 0..x { + | ^^^^ + error[E0015]: cannot call non-const fn ` as Iterator>::next` in constant functions --> $DIR/const-fn-error.rs:5:14 | @@ -42,7 +55,7 @@ LL | for i in 0..x { = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable -error: aborting due to 4 previous errors +error: aborting due to 5 previous errors -Some errors have detailed explanations: E0015, E0658. +Some errors have detailed explanations: E0015, E0277, E0658. For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/consts/const-for.rs b/tests/ui/consts/const-for.rs index 8db248535..ff9c977f7 100644 --- a/tests/ui/consts/const-for.rs +++ b/tests/ui/consts/const-for.rs @@ -5,6 +5,7 @@ const _: () = { for _ in 0..5 {} //~^ error: cannot call //~| error: cannot convert + //~| error: the trait bound }; fn main() {} diff --git a/tests/ui/consts/const-for.stderr b/tests/ui/consts/const-for.stderr index 3fb9787c0..64f2f603b 100644 --- a/tests/ui/consts/const-for.stderr +++ b/tests/ui/consts/const-for.stderr @@ -9,6 +9,19 @@ note: impl defined here, but it is not `const` = note: calls in constants are limited to constant functions, tuple structs and tuple variants = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable +error[E0277]: the trait bound `std::ops::Range: Iterator` is not satisfied + --> $DIR/const-for.rs:5:14 + | +LL | for _ in 0..5 {} + | ^^^^ `std::ops::Range` is not an iterator + | + = help: the trait `~const Iterator` is not implemented for `std::ops::Range` +note: the trait `Iterator` is implemented for `std::ops::Range`, but that implementation is not `const` + --> $DIR/const-for.rs:5:14 + | +LL | for _ in 0..5 {} + | ^^^^ + error[E0015]: cannot call non-const fn ` as Iterator>::next` in constants --> $DIR/const-for.rs:5:14 | @@ -18,6 +31,7 @@ LL | for _ in 0..5 {} = note: calls in constants are limited to constant functions, tuple structs and tuple variants = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0015`. +Some errors have detailed explanations: E0015, E0277. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/consts/const-match-check.eval1.stderr b/tests/ui/consts/const-match-check.eval1.stderr index 08fcd1dea..27ff5d4cd 100644 --- a/tests/ui/consts/const-match-check.eval1.stderr +++ b/tests/ui/consts/const-match-check.eval1.stderr @@ -9,8 +9,8 @@ LL | A = { let 0 = 0; 0 }, = note: the matched value is of type `i32` help: you might want to use `if let` to ignore the variants that aren't matched | -LL | A = { if let 0 = 0 { todo!() } 0 }, - | ++ ~~~~~~~~~~~ +LL | A = { if let 0 = 0 { todo!() }; 0 }, + | ++ +++++++++++ help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits | LL | A = { let _0 = 0; 0 }, diff --git a/tests/ui/consts/const-match-check.eval2.stderr b/tests/ui/consts/const-match-check.eval2.stderr index 5d86ca4bf..0c74a7b3d 100644 --- a/tests/ui/consts/const-match-check.eval2.stderr +++ b/tests/ui/consts/const-match-check.eval2.stderr @@ -9,8 +9,8 @@ LL | let x: [i32; { let 0 = 0; 0 }] = []; = note: the matched value is of type `i32` help: you might want to use `if let` to ignore the variants that aren't matched | -LL | let x: [i32; { if let 0 = 0 { todo!() } 0 }] = []; - | ++ ~~~~~~~~~~~ +LL | let x: [i32; { if let 0 = 0 { todo!() }; 0 }] = []; + | ++ +++++++++++ help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits | LL | let x: [i32; { let _0 = 0; 0 }] = []; diff --git a/tests/ui/consts/const-match-check.matchck.stderr b/tests/ui/consts/const-match-check.matchck.stderr index c8f66bb0f..bcca4c2a6 100644 --- a/tests/ui/consts/const-match-check.matchck.stderr +++ b/tests/ui/consts/const-match-check.matchck.stderr @@ -9,8 +9,8 @@ LL | const X: i32 = { let 0 = 0; 0 }; = note: the matched value is of type `i32` help: you might want to use `if let` to ignore the variants that aren't matched | -LL | const X: i32 = { if let 0 = 0 { todo!() } 0 }; - | ++ ~~~~~~~~~~~ +LL | const X: i32 = { if let 0 = 0 { todo!() }; 0 }; + | ++ +++++++++++ help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits | LL | const X: i32 = { let _0 = 0; 0 }; @@ -27,8 +27,8 @@ LL | static Y: i32 = { let 0 = 0; 0 }; = note: the matched value is of type `i32` help: you might want to use `if let` to ignore the variants that aren't matched | -LL | static Y: i32 = { if let 0 = 0 { todo!() } 0 }; - | ++ ~~~~~~~~~~~ +LL | static Y: i32 = { if let 0 = 0 { todo!() }; 0 }; + | ++ +++++++++++ help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits | LL | static Y: i32 = { let _0 = 0; 0 }; @@ -45,8 +45,8 @@ LL | const X: i32 = { let 0 = 0; 0 }; = note: the matched value is of type `i32` help: you might want to use `if let` to ignore the variants that aren't matched | -LL | const X: i32 = { if let 0 = 0 { todo!() } 0 }; - | ++ ~~~~~~~~~~~ +LL | const X: i32 = { if let 0 = 0 { todo!() }; 0 }; + | ++ +++++++++++ help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits | LL | const X: i32 = { let _0 = 0; 0 }; @@ -63,8 +63,8 @@ LL | const X: i32 = { let 0 = 0; 0 }; = note: the matched value is of type `i32` help: you might want to use `if let` to ignore the variants that aren't matched | -LL | const X: i32 = { if let 0 = 0 { todo!() } 0 }; - | ++ ~~~~~~~~~~~ +LL | const X: i32 = { if let 0 = 0 { todo!() }; 0 }; + | ++ +++++++++++ help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits | LL | const X: i32 = { let _0 = 0; 0 }; diff --git a/tests/ui/consts/const-pattern-irrefutable.stderr b/tests/ui/consts/const-pattern-irrefutable.stderr index c156ea161..2aed68bdd 100644 --- a/tests/ui/consts/const-pattern-irrefutable.stderr +++ b/tests/ui/consts/const-pattern-irrefutable.stderr @@ -1,9 +1,6 @@ error[E0005]: refutable pattern in local binding --> $DIR/const-pattern-irrefutable.rs:12:9 | -LL | const a: u8 = 2; - | ----------- constant defined here -... LL | let a = 4; | ^ | | @@ -11,14 +8,13 @@ LL | let a = 4; | missing patterns are not covered because `a` is interpreted as a constant pattern, not a new variable | help: introduce a variable instead: `a_var` | + = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant + = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: the matched value is of type `u8` error[E0005]: refutable pattern in local binding --> $DIR/const-pattern-irrefutable.rs:17:9 | -LL | pub const b: u8 = 2; - | --------------- constant defined here -... LL | let c = 4; | ^ | | @@ -26,14 +22,13 @@ LL | let c = 4; | missing patterns are not covered because `c` is interpreted as a constant pattern, not a new variable | help: introduce a variable instead: `c_var` | + = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant + = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: the matched value is of type `u8` error[E0005]: refutable pattern in local binding --> $DIR/const-pattern-irrefutable.rs:22:9 | -LL | pub const d: u8 = 2; - | --------------- constant defined here -... LL | let d = 4; | ^ | | @@ -41,6 +36,8 @@ LL | let d = 4; | missing patterns are not covered because `d` is interpreted as a constant pattern, not a new variable | help: introduce a variable instead: `d_var` | + = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant + = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: the matched value is of type `u8` error: aborting due to 3 previous errors diff --git a/tests/ui/consts/const_in_pattern/cross-crate-fail.stderr b/tests/ui/consts/const_in_pattern/cross-crate-fail.stderr index a8066a88c..2f6786999 100644 --- a/tests/ui/consts/const_in_pattern/cross-crate-fail.stderr +++ b/tests/ui/consts/const_in_pattern/cross-crate-fail.stderr @@ -3,12 +3,18 @@ error: to use a constant of type `CustomEq` in a pattern, `CustomEq` must be ann | LL | consts::SOME => panic!(), | ^^^^^^^^^^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: to use a constant of type `CustomEq` in a pattern, `CustomEq` must be annotated with `#[derive(PartialEq, Eq)]` --> $DIR/cross-crate-fail.rs:20:9 | LL | ::SOME => panic!(), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: aborting due to 2 previous errors diff --git a/tests/ui/consts/const_in_pattern/custom-eq-branch-warn.rs b/tests/ui/consts/const_in_pattern/custom-eq-branch-warn.rs index 856d20417..41de5e7b4 100644 --- a/tests/ui/consts/const_in_pattern/custom-eq-branch-warn.rs +++ b/tests/ui/consts/const_in_pattern/custom-eq-branch-warn.rs @@ -28,6 +28,8 @@ fn main() { match Foo::Qux(CustomEq) { BAR_BAZ => panic!(), //~^ WARN must be annotated with `#[derive(PartialEq, Eq)]` + //~| NOTE the traits must be derived + //~| NOTE StructuralEq.html for details //~| WARN this was previously accepted //~| NOTE see issue #73448 //~| NOTE `#[warn(nontrivial_structural_match)]` on by default diff --git a/tests/ui/consts/const_in_pattern/custom-eq-branch-warn.stderr b/tests/ui/consts/const_in_pattern/custom-eq-branch-warn.stderr index 223482722..3f19c67d2 100644 --- a/tests/ui/consts/const_in_pattern/custom-eq-branch-warn.stderr +++ b/tests/ui/consts/const_in_pattern/custom-eq-branch-warn.stderr @@ -6,6 +6,8 @@ LL | BAR_BAZ => panic!(), | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #73448 + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details = note: `#[warn(nontrivial_structural_match)]` on by default warning: 1 warning emitted diff --git a/tests/ui/consts/const_in_pattern/incomplete-slice.stderr b/tests/ui/consts/const_in_pattern/incomplete-slice.stderr index ddc576ced..be144a87b 100644 --- a/tests/ui/consts/const_in_pattern/incomplete-slice.stderr +++ b/tests/ui/consts/const_in_pattern/incomplete-slice.stderr @@ -6,6 +6,8 @@ LL | E_SL => {} | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #62411 + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details = note: `#[warn(indirect_structural_match)]` on by default error[E0004]: non-exhaustive patterns: `&_` not covered @@ -17,7 +19,7 @@ LL | match &[][..] { = note: the matched value is of type `&[E]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ E_SL => {} +LL ~ E_SL => {}, LL + &_ => todo!() | diff --git a/tests/ui/consts/const_in_pattern/issue-78057.stderr b/tests/ui/consts/const_in_pattern/issue-78057.stderr index 35619594f..df155bdb6 100644 --- a/tests/ui/consts/const_in_pattern/issue-78057.stderr +++ b/tests/ui/consts/const_in_pattern/issue-78057.stderr @@ -3,6 +3,9 @@ error: to use a constant of type `Opaque` in a pattern, `Opaque` must be annotat | LL | FOO => {}, | ^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: unreachable pattern --> $DIR/issue-78057.rs:14:9 diff --git a/tests/ui/consts/const_in_pattern/no-eq-branch-fail.stderr b/tests/ui/consts/const_in_pattern/no-eq-branch-fail.stderr index e505dad69..cced6af49 100644 --- a/tests/ui/consts/const_in_pattern/no-eq-branch-fail.stderr +++ b/tests/ui/consts/const_in_pattern/no-eq-branch-fail.stderr @@ -3,6 +3,9 @@ error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated wit | LL | BAR_BAZ => panic!(), | ^^^^^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: aborting due to previous error diff --git a/tests/ui/consts/const_in_pattern/reject_non_partial_eq.stderr b/tests/ui/consts/const_in_pattern/reject_non_partial_eq.stderr index 95cfa4a9e..958bf373c 100644 --- a/tests/ui/consts/const_in_pattern/reject_non_partial_eq.stderr +++ b/tests/ui/consts/const_in_pattern/reject_non_partial_eq.stderr @@ -3,6 +3,9 @@ error: to use a constant of type `NoPartialEq` in a pattern, `NoPartialEq` must | LL | NO_PARTIAL_EQ_NONE => println!("NO_PARTIAL_EQ_NONE"), | ^^^^^^^^^^^^^^^^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: aborting due to previous error diff --git a/tests/ui/consts/const_in_pattern/reject_non_structural.rs b/tests/ui/consts/const_in_pattern/reject_non_structural.rs index 75fde0d92..dc6b9a331 100644 --- a/tests/ui/consts/const_in_pattern/reject_non_structural.rs +++ b/tests/ui/consts/const_in_pattern/reject_non_structural.rs @@ -39,45 +39,67 @@ fn main() { const ENUM: Derive = Derive::Some(NoDerive); match Derive::Some(NoDerive) { ENUM => dbg!(ENUM), _ => panic!("whoops"), }; //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` + //~| NOTE the traits must be derived + //~| NOTE StructuralEq.html for details const FIELD: OND = TrivialEq(Some(NoDerive)).0; match Some(NoDerive) { FIELD => dbg!(FIELD), _ => panic!("whoops"), }; //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` + //~| NOTE the traits must be derived + //~| NOTE StructuralEq.html for details const NO_DERIVE_SOME: OND = Some(NoDerive); const INDIRECT: OND = NO_DERIVE_SOME; match Some(NoDerive) {INDIRECT => dbg!(INDIRECT), _ => panic!("whoops"), }; //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` + //~| NOTE the traits must be derived + //~| NOTE StructuralEq.html for details const TUPLE: (OND, OND) = (None, Some(NoDerive)); match (None, Some(NoDerive)) { TUPLE => dbg!(TUPLE), _ => panic!("whoops"), }; //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` + //~| NOTE the traits must be derived + //~| NOTE StructuralEq.html for details const TYPE_ASCRIPTION: OND = type_ascribe!(Some(NoDerive), OND); match Some(NoDerive) { TYPE_ASCRIPTION => dbg!(TYPE_ASCRIPTION), _ => panic!("whoops"), }; //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` + //~| NOTE the traits must be derived + //~| NOTE StructuralEq.html for details const ARRAY: [OND; 2] = [None, Some(NoDerive)]; match [None, Some(NoDerive)] { ARRAY => dbg!(ARRAY), _ => panic!("whoops"), }; //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` + //~| NOTE the traits must be derived + //~| NOTE StructuralEq.html for details const REPEAT: [OND; 2] = [Some(NoDerive); 2]; match [Some(NoDerive); 2] { REPEAT => dbg!(REPEAT), _ => panic!("whoops"), }; //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` + //~| NOTE the traits must be derived + //~| NOTE StructuralEq.html for details //~| ERROR must be annotated with `#[derive(PartialEq, Eq)]` + //~| NOTE the traits must be derived + //~| NOTE StructuralEq.html for details trait Trait: Sized { const ASSOC: Option; } impl Trait for NoDerive { const ASSOC: Option = Some(NoDerive); } match Some(NoDerive) { NoDerive::ASSOC => dbg!(NoDerive::ASSOC), _ => panic!("whoops"), }; //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` + //~| NOTE the traits must be derived + //~| NOTE StructuralEq.html for details const BLOCK: OND = { NoDerive; Some(NoDerive) }; match Some(NoDerive) { BLOCK => dbg!(BLOCK), _ => panic!("whoops"), }; //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` + //~| NOTE the traits must be derived + //~| NOTE StructuralEq.html for details const ADDR_OF: &OND = &Some(NoDerive); match &Some(NoDerive) { ADDR_OF => dbg!(ADDR_OF), _ => panic!("whoops"), }; //~^ WARN must be annotated with `#[derive(PartialEq, Eq)]` + //~| NOTE the traits must be derived + //~| NOTE StructuralEq.html for details //~| WARN previously accepted by the compiler but is being phased out //~| NOTE for more information, see issue #62411 } diff --git a/tests/ui/consts/const_in_pattern/reject_non_structural.stderr b/tests/ui/consts/const_in_pattern/reject_non_structural.stderr index 660198349..b6e439f21 100644 --- a/tests/ui/consts/const_in_pattern/reject_non_structural.stderr +++ b/tests/ui/consts/const_in_pattern/reject_non_structural.stderr @@ -3,69 +3,101 @@ error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be ann | LL | match Derive::Some(NoDerive) { ENUM => dbg!(ENUM), _ => panic!("whoops"), }; | ^^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/reject_non_structural.rs:44:28 + --> $DIR/reject_non_structural.rs:46:28 | LL | match Some(NoDerive) { FIELD => dbg!(FIELD), _ => panic!("whoops"), }; | ^^^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/reject_non_structural.rs:49:27 + --> $DIR/reject_non_structural.rs:53:27 | LL | match Some(NoDerive) {INDIRECT => dbg!(INDIRECT), _ => panic!("whoops"), }; | ^^^^^^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/reject_non_structural.rs:53:36 + --> $DIR/reject_non_structural.rs:59:36 | LL | match (None, Some(NoDerive)) { TUPLE => dbg!(TUPLE), _ => panic!("whoops"), }; | ^^^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/reject_non_structural.rs:57:28 + --> $DIR/reject_non_structural.rs:65:28 | LL | match Some(NoDerive) { TYPE_ASCRIPTION => dbg!(TYPE_ASCRIPTION), _ => panic!("whoops"), }; | ^^^^^^^^^^^^^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/reject_non_structural.rs:61:36 + --> $DIR/reject_non_structural.rs:71:36 | LL | match [None, Some(NoDerive)] { ARRAY => dbg!(ARRAY), _ => panic!("whoops"), }; | ^^^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/reject_non_structural.rs:65:33 + --> $DIR/reject_non_structural.rs:77:33 | LL | match [Some(NoDerive); 2] { REPEAT => dbg!(REPEAT), _ => panic!("whoops"), }; | ^^^^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/reject_non_structural.rs:65:33 + --> $DIR/reject_non_structural.rs:77:33 | LL | match [Some(NoDerive); 2] { REPEAT => dbg!(REPEAT), _ => panic!("whoops"), }; | ^^^^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/reject_non_structural.rs:71:28 + --> $DIR/reject_non_structural.rs:87:28 | LL | match Some(NoDerive) { NoDerive::ASSOC => dbg!(NoDerive::ASSOC), _ => panic!("whoops"), }; | ^^^^^^^^^^^^^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/reject_non_structural.rs:75:28 + --> $DIR/reject_non_structural.rs:93:28 | LL | match Some(NoDerive) { BLOCK => dbg!(BLOCK), _ => panic!("whoops"), }; | ^^^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/reject_non_structural.rs:79:29 + --> $DIR/reject_non_structural.rs:99:29 | LL | match &Some(NoDerive) { ADDR_OF => dbg!(ADDR_OF), _ => panic!("whoops"), }; | ^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #62411 + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details note: the lint level is defined here --> $DIR/reject_non_structural.rs:12:9 | diff --git a/tests/ui/consts/const_in_pattern/warn_corner_cases.stderr b/tests/ui/consts/const_in_pattern/warn_corner_cases.stderr index e957a43a1..8c01d2f65 100644 --- a/tests/ui/consts/const_in_pattern/warn_corner_cases.stderr +++ b/tests/ui/consts/const_in_pattern/warn_corner_cases.stderr @@ -6,6 +6,8 @@ LL | match None { Some(_) => panic!("whoops"), INDEX => dbg!(INDEX), }; | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #73448 + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details = note: `#[warn(nontrivial_structural_match)]` on by default warning: to use a constant of type `NoDerive` in a pattern, the constant's initializer must be trivial or `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]` @@ -16,6 +18,8 @@ LL | match None { Some(_) => panic!("whoops"), CALL => dbg!(CALL), }; | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #73448 + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details warning: to use a constant of type `NoDerive` in a pattern, the constant's initializer must be trivial or `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]` --> $DIR/warn_corner_cases.rs:38:47 @@ -25,6 +29,8 @@ LL | match None { Some(_) => panic!("whoops"), METHOD_CALL => dbg!(METHOD_CA | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #73448 + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details warning: 3 warnings emitted diff --git a/tests/ui/consts/invalid-inline-const-in-match-arm.rs b/tests/ui/consts/invalid-inline-const-in-match-arm.rs index 4d2d8fb13..17acb2d9d 100644 --- a/tests/ui/consts/invalid-inline-const-in-match-arm.rs +++ b/tests/ui/consts/invalid-inline-const-in-match-arm.rs @@ -5,5 +5,6 @@ fn main() { match () { const { (|| {})() } => {} //~^ ERROR cannot call non-const closure in constants + //~| ERROR the trait bound } } diff --git a/tests/ui/consts/invalid-inline-const-in-match-arm.stderr b/tests/ui/consts/invalid-inline-const-in-match-arm.stderr index 257ecd7f3..ac174849f 100644 --- a/tests/ui/consts/invalid-inline-const-in-match-arm.stderr +++ b/tests/ui/consts/invalid-inline-const-in-match-arm.stderr @@ -1,3 +1,17 @@ +error[E0277]: the trait bound `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]: Fn<()>` is not satisfied + --> $DIR/invalid-inline-const-in-match-arm.rs:6:17 + | +LL | const { (|| {})() } => {} + | ^^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]` + | + = help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]` +note: the trait `Fn<()>` is implemented for `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]`, but that implementation is not `const` + --> $DIR/invalid-inline-const-in-match-arm.rs:6:17 + | +LL | const { (|| {})() } => {} + | ^^^^^^^^^ + = note: wrap the `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]` in a closure with no arguments: `|| { /* code */ }` + error[E0015]: cannot call non-const closure in constants --> $DIR/invalid-inline-const-in-match-arm.rs:6:17 | @@ -8,6 +22,7 @@ LL | const { (|| {})() } => {} = note: calls in constants are limited to constant functions, tuple structs and tuple variants = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable -error: aborting due to previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0015`. +Some errors have detailed explanations: E0015, E0277. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/consts/issue-28113.rs b/tests/ui/consts/issue-28113.rs index f8131c9f3..e45c009d6 100644 --- a/tests/ui/consts/issue-28113.rs +++ b/tests/ui/consts/issue-28113.rs @@ -3,6 +3,7 @@ const X: u8 = || -> u8 { 5 }() //~^ ERROR cannot call non-const closure + //~| ERROR the trait bound ; fn main() {} diff --git a/tests/ui/consts/issue-28113.stderr b/tests/ui/consts/issue-28113.stderr index 1294cc99b..e177a3585 100644 --- a/tests/ui/consts/issue-28113.stderr +++ b/tests/ui/consts/issue-28113.stderr @@ -1,3 +1,17 @@ +error[E0277]: the trait bound `[closure@$DIR/issue-28113.rs:4:5: 4:13]: Fn<()>` is not satisfied + --> $DIR/issue-28113.rs:4:5 + | +LL | || -> u8 { 5 }() + | ^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-28113.rs:4:5: 4:13]` + | + = help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-28113.rs:4:5: 4:13]` +note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-28113.rs:4:5: 4:13]`, but that implementation is not `const` + --> $DIR/issue-28113.rs:4:5 + | +LL | || -> u8 { 5 }() + | ^^^^^^^^^^^^^^^^ + = note: wrap the `[closure@$DIR/issue-28113.rs:4:5: 4:13]` in a closure with no arguments: `|| { /* code */ }` + error[E0015]: cannot call non-const closure in constants --> $DIR/issue-28113.rs:4:5 | @@ -8,6 +22,7 @@ LL | || -> u8 { 5 }() = note: calls in constants are limited to constant functions, tuple structs and tuple variants = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable -error: aborting due to previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0015`. +Some errors have detailed explanations: E0015, E0277. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/consts/issue-43105.rs b/tests/ui/consts/issue-43105.rs index cac12b909..20b78d642 100644 --- a/tests/ui/consts/issue-43105.rs +++ b/tests/ui/consts/issue-43105.rs @@ -7,7 +7,6 @@ fn main() { match 1 { NUM => unimplemented!(), //~^ ERROR could not evaluate constant pattern - //~| ERROR could not evaluate constant pattern _ => unimplemented!(), } } diff --git a/tests/ui/consts/issue-43105.stderr b/tests/ui/consts/issue-43105.stderr index 2d1174af7..856a8f0da 100644 --- a/tests/ui/consts/issue-43105.stderr +++ b/tests/ui/consts/issue-43105.stderr @@ -12,12 +12,6 @@ error: could not evaluate constant pattern LL | NUM => unimplemented!(), | ^^^ -error: could not evaluate constant pattern - --> $DIR/issue-43105.rs:8:9 - | -LL | NUM => unimplemented!(), - | ^^^ - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/consts/issue-56164.rs b/tests/ui/consts/issue-56164.rs index 22c257d0b..00875c4b5 100644 --- a/tests/ui/consts/issue-56164.rs +++ b/tests/ui/consts/issue-56164.rs @@ -1,5 +1,6 @@ const fn foo() { (||{})() } //~^ ERROR cannot call non-const closure +//~| ERROR the trait bound const fn bad(input: fn()) { input() diff --git a/tests/ui/consts/issue-56164.stderr b/tests/ui/consts/issue-56164.stderr index 845b23d5d..003f84744 100644 --- a/tests/ui/consts/issue-56164.stderr +++ b/tests/ui/consts/issue-56164.stderr @@ -1,3 +1,17 @@ +error[E0277]: the trait bound `[closure@$DIR/issue-56164.rs:1:19: 1:21]: Fn<()>` is not satisfied + --> $DIR/issue-56164.rs:1:18 + | +LL | const fn foo() { (||{})() } + | ^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-56164.rs:1:19: 1:21]` + | + = help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-56164.rs:1:19: 1:21]` +note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-56164.rs:1:19: 1:21]`, but that implementation is not `const` + --> $DIR/issue-56164.rs:1:18 + | +LL | const fn foo() { (||{})() } + | ^^^^^^^^ + = note: wrap the `[closure@$DIR/issue-56164.rs:1:19: 1:21]` in a closure with no arguments: `|| { /* code */ }` + error[E0015]: cannot call non-const closure in constant functions --> $DIR/issue-56164.rs:1:18 | @@ -9,7 +23,7 @@ LL | const fn foo() { (||{})() } = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable error: function pointer calls are not allowed in constant functions - --> $DIR/issue-56164.rs:5:5 + --> $DIR/issue-56164.rs:6:5 | LL | input() | ^^^^^^^ @@ -26,6 +40,7 @@ note: erroneous constant used LL | const fn foo() { (||{})() } | ^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0015`. +Some errors have detailed explanations: E0015, E0277. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/consts/issue-64506.rs b/tests/ui/consts/issue-64506.rs index db3e85a7b..9275a8a07 100644 --- a/tests/ui/consts/issue-64506.rs +++ b/tests/ui/consts/issue-64506.rs @@ -1,4 +1,4 @@ -// check-pass +// check-fail #[derive(Copy, Clone)] pub struct ChildStdin { @@ -14,6 +14,7 @@ const FOO: () = { b: (), } let x = unsafe { Foo { b: () }.a }; + //~^ ERROR: evaluation of constant value failed let x = &x.inner; }; diff --git a/tests/ui/consts/issue-64506.stderr b/tests/ui/consts/issue-64506.stderr new file mode 100644 index 000000000..31a5b1df8 --- /dev/null +++ b/tests/ui/consts/issue-64506.stderr @@ -0,0 +1,9 @@ +error[E0080]: evaluation of constant value failed + --> $DIR/issue-64506.rs:16:22 + | +LL | let x = unsafe { Foo { b: () }.a }; + | ^^^^^^^^^^^^^^^ constructing invalid value at .inner: encountered a value of uninhabited type AnonPipe + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/issue-68542-closure-in-array-len.rs b/tests/ui/consts/issue-68542-closure-in-array-len.rs index 37958e791..a88e0cc60 100644 --- a/tests/ui/consts/issue-68542-closure-in-array-len.rs +++ b/tests/ui/consts/issue-68542-closure-in-array-len.rs @@ -4,6 +4,7 @@ struct Bug { a: [(); (|| { 0 })()] //~ ERROR cannot call non-const closure + //~^ ERROR the trait bound } fn main() {} diff --git a/tests/ui/consts/issue-68542-closure-in-array-len.stderr b/tests/ui/consts/issue-68542-closure-in-array-len.stderr index d23513ed7..ace62f09d 100644 --- a/tests/ui/consts/issue-68542-closure-in-array-len.stderr +++ b/tests/ui/consts/issue-68542-closure-in-array-len.stderr @@ -1,3 +1,17 @@ +error[E0277]: the trait bound `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]: Fn<()>` is not satisfied + --> $DIR/issue-68542-closure-in-array-len.rs:6:13 + | +LL | a: [(); (|| { 0 })()] + | ^^^^^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]` + | + = help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]` +note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]`, but that implementation is not `const` + --> $DIR/issue-68542-closure-in-array-len.rs:6:13 + | +LL | a: [(); (|| { 0 })()] + | ^^^^^^^^^^^^ + = note: wrap the `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]` in a closure with no arguments: `|| { /* code */ }` + error[E0015]: cannot call non-const closure in constants --> $DIR/issue-68542-closure-in-array-len.rs:6:13 | @@ -8,6 +22,7 @@ LL | a: [(); (|| { 0 })()] = note: calls in constants are limited to constant functions, tuple structs and tuple variants = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable -error: aborting due to previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0015`. +Some errors have detailed explanations: E0015, E0277. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/consts/issue-73976-polymorphic.rs b/tests/ui/consts/issue-73976-polymorphic.rs index 787462da9..2c576d1f9 100644 --- a/tests/ui/consts/issue-73976-polymorphic.rs +++ b/tests/ui/consts/issue-73976-polymorphic.rs @@ -19,7 +19,6 @@ impl GetTypeId { const fn check_type_id() -> bool { matches!(GetTypeId::::VALUE, GetTypeId::::VALUE) //~^ ERROR constant pattern depends on a generic parameter - //~| ERROR constant pattern depends on a generic parameter } pub struct GetTypeNameLen(T); @@ -31,7 +30,6 @@ impl GetTypeNameLen { const fn check_type_name_len() -> bool { matches!(GetTypeNameLen::::VALUE, GetTypeNameLen::::VALUE) //~^ ERROR constant pattern depends on a generic parameter - //~| ERROR constant pattern depends on a generic parameter } fn main() { diff --git a/tests/ui/consts/issue-73976-polymorphic.stderr b/tests/ui/consts/issue-73976-polymorphic.stderr index 442ad23f2..97a5fbc57 100644 --- a/tests/ui/consts/issue-73976-polymorphic.stderr +++ b/tests/ui/consts/issue-73976-polymorphic.stderr @@ -5,22 +5,10 @@ LL | matches!(GetTypeId::::VALUE, GetTypeId::::VALUE) | ^^^^^^^^^^^^^^^^^^^^^ error: constant pattern depends on a generic parameter - --> $DIR/issue-73976-polymorphic.rs:32:42 + --> $DIR/issue-73976-polymorphic.rs:31:42 | LL | matches!(GetTypeNameLen::::VALUE, GetTypeNameLen::::VALUE) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: constant pattern depends on a generic parameter - --> $DIR/issue-73976-polymorphic.rs:20:37 - | -LL | matches!(GetTypeId::::VALUE, GetTypeId::::VALUE) - | ^^^^^^^^^^^^^^^^^^^^^ - -error: constant pattern depends on a generic parameter - --> $DIR/issue-73976-polymorphic.rs:32:42 - | -LL | matches!(GetTypeNameLen::::VALUE, GetTypeNameLen::::VALUE) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors diff --git a/tests/ui/consts/issue-78655.rs b/tests/ui/consts/issue-78655.rs index 82d2d7c21..cd95ee32c 100644 --- a/tests/ui/consts/issue-78655.rs +++ b/tests/ui/consts/issue-78655.rs @@ -6,5 +6,4 @@ const FOO: *const u32 = { fn main() { let FOO = FOO; //~^ ERROR could not evaluate constant pattern - //~| ERROR could not evaluate constant pattern } diff --git a/tests/ui/consts/issue-78655.stderr b/tests/ui/consts/issue-78655.stderr index 6b83fa0e5..5a38d023d 100644 --- a/tests/ui/consts/issue-78655.stderr +++ b/tests/ui/consts/issue-78655.stderr @@ -17,12 +17,6 @@ error: could not evaluate constant pattern LL | let FOO = FOO; | ^^^ -error: could not evaluate constant pattern - --> $DIR/issue-78655.rs:7:9 - | -LL | let FOO = FOO; - | ^^^ - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/consts/issue-79137-toogeneric.rs b/tests/ui/consts/issue-79137-toogeneric.rs index 456035458..a80c9f48d 100644 --- a/tests/ui/consts/issue-79137-toogeneric.rs +++ b/tests/ui/consts/issue-79137-toogeneric.rs @@ -11,7 +11,6 @@ impl GetVariantCount { const fn check_variant_count() -> bool { matches!(GetVariantCount::::VALUE, GetVariantCount::::VALUE) //~^ ERROR constant pattern depends on a generic parameter - //~| ERROR constant pattern depends on a generic parameter } fn main() { diff --git a/tests/ui/consts/issue-79137-toogeneric.stderr b/tests/ui/consts/issue-79137-toogeneric.stderr index 579e6aa09..efe4fd22e 100644 --- a/tests/ui/consts/issue-79137-toogeneric.stderr +++ b/tests/ui/consts/issue-79137-toogeneric.stderr @@ -4,11 +4,5 @@ error: constant pattern depends on a generic parameter LL | matches!(GetVariantCount::::VALUE, GetVariantCount::::VALUE) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: constant pattern depends on a generic parameter - --> $DIR/issue-79137-toogeneric.rs:12:43 - | -LL | matches!(GetVariantCount::::VALUE, GetVariantCount::::VALUE) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/tests/ui/consts/issue-miri-1910.stderr b/tests/ui/consts/issue-miri-1910.stderr index 61865b1da..a10eea9de 100644 --- a/tests/ui/consts/issue-miri-1910.stderr +++ b/tests/ui/consts/issue-miri-1910.stderr @@ -1,7 +1,7 @@ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL | - = note: unable to copy parts of a pointer from memory at ALLOC + = note: unable to turn pointer into raw bytes | = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported diff --git a/tests/ui/consts/match_ice.stderr b/tests/ui/consts/match_ice.stderr index 699b4a5e2..342d94ed3 100644 --- a/tests/ui/consts/match_ice.stderr +++ b/tests/ui/consts/match_ice.stderr @@ -3,6 +3,9 @@ error: to use a constant of type `S` in a pattern, `S` must be annotated with `# | LL | C => {} | ^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: aborting due to previous error diff --git a/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr b/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr index 778b0e55f..7ec2508ca 100644 --- a/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr +++ b/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr @@ -22,11 +22,13 @@ LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 } | help: if it is not part of the public API, make this function unstably const | -LL | #[rustc_const_unstable(feature = "...", issue = "...")] +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 } | help: otherwise `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks | -LL | #[rustc_allow_const_fn_unstable(const_fn_floating_point_arithmetic)] +LL + #[rustc_allow_const_fn_unstable(const_fn_floating_point_arithmetic)] +LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 } | error: `foo2_gated` is not yet stable as a const fn diff --git a/tests/ui/consts/min_const_fn/min_const_fn_unsafe_bad.rs b/tests/ui/consts/min_const_fn/min_const_fn_unsafe_bad.rs index a6e1788bb..df20ff446 100644 --- a/tests/ui/consts/min_const_fn/min_const_fn_unsafe_bad.rs +++ b/tests/ui/consts/min_const_fn/min_const_fn_unsafe_bad.rs @@ -7,4 +7,7 @@ const unsafe fn bad_const_unsafe_deref_raw(x: *mut usize) -> usize { *x } const unsafe fn bad_const_unsafe_deref_raw_ref(x: *mut usize) -> &'static usize { &*x } //~^ dereferencing raw mutable pointers in constant functions +const unsafe fn bad_const_unsafe_deref_raw_underscore(x: *mut usize) { let _ = *x; } +//~^ dereferencing raw mutable pointers in constant functions + fn main() {} diff --git a/tests/ui/consts/min_const_fn/min_const_fn_unsafe_bad.stderr b/tests/ui/consts/min_const_fn/min_const_fn_unsafe_bad.stderr index 820b6433f..e68376e7b 100644 --- a/tests/ui/consts/min_const_fn/min_const_fn_unsafe_bad.stderr +++ b/tests/ui/consts/min_const_fn/min_const_fn_unsafe_bad.stderr @@ -25,6 +25,15 @@ LL | const unsafe fn bad_const_unsafe_deref_raw_ref(x: *mut usize) -> &'static u = note: see issue #57349 for more information = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable -error: aborting due to 3 previous errors +error[E0658]: dereferencing raw mutable pointers in constant functions is unstable + --> $DIR/min_const_fn_unsafe_bad.rs:10:80 + | +LL | const unsafe fn bad_const_unsafe_deref_raw_underscore(x: *mut usize) { let _ = *x; } + | ^^ + | + = note: see issue #57349 for more information + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr b/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr index 0174cb77f..72c1f175d 100644 --- a/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr +++ b/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr @@ -22,11 +22,13 @@ LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 } | help: if it is not part of the public API, make this function unstably const | -LL | #[rustc_const_unstable(feature = "...", issue = "...")] +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 } | help: otherwise `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks | -LL | #[rustc_allow_const_fn_unstable(const_fn_floating_point_arithmetic)] +LL + #[rustc_allow_const_fn_unstable(const_fn_floating_point_arithmetic)] +LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 } | error: `foo2_gated` is not yet stable as a const fn diff --git a/tests/ui/consts/miri_unleashed/assoc_const.stderr b/tests/ui/consts/miri_unleashed/assoc_const.stderr index e1da43c3a..8e22cb74b 100644 --- a/tests/ui/consts/miri_unleashed/assoc_const.stderr +++ b/tests/ui/consts/miri_unleashed/assoc_const.stderr @@ -25,12 +25,6 @@ note: erroneous constant used LL | let y = , String>>::F; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: erroneous constant used - --> $DIR/assoc_const.rs:29:13 - | -LL | let y = , String>>::F; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - warning: skipping const checks | help: skipping check that does not even have a feature gate diff --git a/tests/ui/consts/miri_unleashed/assoc_const_2.stderr b/tests/ui/consts/miri_unleashed/assoc_const_2.stderr index fc4b18056..ae7b03fc9 100644 --- a/tests/ui/consts/miri_unleashed/assoc_const_2.stderr +++ b/tests/ui/consts/miri_unleashed/assoc_const_2.stderr @@ -16,12 +16,6 @@ note: erroneous constant used LL | let y = >::F; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: erroneous constant used - --> $DIR/assoc_const_2.rs:27:13 - | -LL | let y = >::F; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - error: aborting due to previous error For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/miri_unleashed/box.rs b/tests/ui/consts/miri_unleashed/box.rs index c2a260aa1..39cddda2b 100644 --- a/tests/ui/consts/miri_unleashed/box.rs +++ b/tests/ui/consts/miri_unleashed/box.rs @@ -1,12 +1,11 @@ // compile-flags: -Zunleash-the-miri-inside-of-you -#![feature(box_syntax)] use std::mem::ManuallyDrop; fn main() {} static TEST_BAD: &mut i32 = { - &mut *(box 0) + &mut *(Box::new(0)) //~^ ERROR could not evaluate static initializer - //~| NOTE calling non-const function `alloc::alloc::exchange_malloc` + //~| NOTE calling non-const function `Box::::new` }; diff --git a/tests/ui/consts/miri_unleashed/box.stderr b/tests/ui/consts/miri_unleashed/box.stderr index bc5d4a257..407f5d8cb 100644 --- a/tests/ui/consts/miri_unleashed/box.stderr +++ b/tests/ui/consts/miri_unleashed/box.stderr @@ -1,31 +1,26 @@ error[E0080]: could not evaluate static initializer - --> $DIR/box.rs:9:11 + --> $DIR/box.rs:8:11 | -LL | &mut *(box 0) - | ^^^^^^^ calling non-const function `alloc::alloc::exchange_malloc` +LL | &mut *(Box::new(0)) + | ^^^^^^^^^^^^^ calling non-const function `Box::::new` warning: skipping const checks | help: skipping check that does not even have a feature gate - --> $DIR/box.rs:9:11 + --> $DIR/box.rs:8:11 | -LL | &mut *(box 0) - | ^^^^^^^ +LL | &mut *(Box::new(0)) + | ^^^^^^^^^^^^^ help: skipping check for `const_mut_refs` feature - --> $DIR/box.rs:9:16 + --> $DIR/box.rs:8:5 | -LL | &mut *(box 0) - | ^ -help: skipping check for `const_mut_refs` feature - --> $DIR/box.rs:9:5 - | -LL | &mut *(box 0) - | ^^^^^^^^^^^^^ +LL | &mut *(Box::new(0)) + | ^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/box.rs:9:5 + --> $DIR/box.rs:8:5 | -LL | &mut *(box 0) - | ^^^^^^^^^^^^^ +LL | &mut *(Box::new(0)) + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error; 1 warning emitted diff --git a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr index 6df2fe3d0..e3a0d93f0 100644 --- a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr +++ b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr @@ -27,7 +27,7 @@ LL | const U8_MUT: &u8 = { } error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:43:9 + --> $DIR/const_refers_to_static_cross_crate.rs:42:9 | LL | U8_MUT => true, | ^^^^^^ @@ -39,7 +39,7 @@ LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:54:9 + --> $DIR/const_refers_to_static_cross_crate.rs:52:9 | LL | U8_MUT2 => true, | ^^^^^^^ @@ -51,31 +51,7 @@ LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:62:9 - | -LL | U8_MUT3 => true, - | ^^^^^^^ - -error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:34:9 - | -LL | SLICE_MUT => true, - | ^^^^^^^^^ - -error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:43:9 - | -LL | U8_MUT => true, - | ^^^^^^ - -error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:54:9 - | -LL | U8_MUT2 => true, - | ^^^^^^^ - -error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:62:9 + --> $DIR/const_refers_to_static_cross_crate.rs:59:9 | LL | U8_MUT3 => true, | ^^^^^^^ @@ -133,6 +109,6 @@ help: skipping check that does not even have a feature gate LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 12 previous errors; 1 warning emitted +error: aborting due to 8 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr index 8802f3ada..a323e9a05 100644 --- a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr +++ b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr @@ -27,7 +27,7 @@ LL | const U8_MUT: &u8 = { } error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:43:9 + --> $DIR/const_refers_to_static_cross_crate.rs:42:9 | LL | U8_MUT => true, | ^^^^^^ @@ -39,7 +39,7 @@ LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:54:9 + --> $DIR/const_refers_to_static_cross_crate.rs:52:9 | LL | U8_MUT2 => true, | ^^^^^^^ @@ -51,31 +51,7 @@ LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:62:9 - | -LL | U8_MUT3 => true, - | ^^^^^^^ - -error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:34:9 - | -LL | SLICE_MUT => true, - | ^^^^^^^^^ - -error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:43:9 - | -LL | U8_MUT => true, - | ^^^^^^ - -error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:54:9 - | -LL | U8_MUT2 => true, - | ^^^^^^^ - -error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:62:9 + --> $DIR/const_refers_to_static_cross_crate.rs:59:9 | LL | U8_MUT3 => true, | ^^^^^^^ @@ -133,6 +109,6 @@ help: skipping check that does not even have a feature gate LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 12 previous errors; 1 warning emitted +error: aborting due to 8 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs index bf4f14f4d..bbaa32ddf 100644 --- a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs +++ b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs @@ -33,7 +33,6 @@ pub fn test(x: &[u8; 1]) -> bool { match x { SLICE_MUT => true, //~^ ERROR could not evaluate constant pattern - //~| ERROR could not evaluate constant pattern &[1..] => false, } } @@ -42,7 +41,6 @@ pub fn test2(x: &u8) -> bool { match x { U8_MUT => true, //~^ ERROR could not evaluate constant pattern - //~| ERROR could not evaluate constant pattern &(1..) => false, } } @@ -53,7 +51,6 @@ pub fn test3(x: &u8) -> bool { match x { U8_MUT2 => true, //~^ ERROR could not evaluate constant pattern - //~| ERROR could not evaluate constant pattern &(1..) => false, } } @@ -61,7 +58,6 @@ pub fn test4(x: &u8) -> bool { match x { U8_MUT3 => true, //~^ ERROR could not evaluate constant pattern - //~| ERROR could not evaluate constant pattern &(1..) => false, } } diff --git a/tests/ui/consts/miri_unleashed/tls.stderr b/tests/ui/consts/miri_unleashed/tls.stderr index 7aaeadd04..ec24527d6 100644 --- a/tests/ui/consts/miri_unleashed/tls.stderr +++ b/tests/ui/consts/miri_unleashed/tls.stderr @@ -2,13 +2,13 @@ error[E0080]: could not evaluate static initializer --> $DIR/tls.rs:11:25 | LL | unsafe { let _val = A; } - | ^ cannot access thread local static (DefId(0:4 ~ tls[78b0]::A)) + | ^ cannot access thread local static (DefId(0:4 ~ tls[ca29]::A)) error[E0080]: could not evaluate static initializer --> $DIR/tls.rs:18:26 | LL | unsafe { let _val = &A; } - | ^ cannot access thread local static (DefId(0:4 ~ tls[78b0]::A)) + | ^ cannot access thread local static (DefId(0:4 ~ tls[ca29]::A)) warning: skipping const checks | diff --git a/tests/ui/consts/offset_from_ub.stderr b/tests/ui/consts/offset_from_ub.stderr index fff472968..6530084a5 100644 --- a/tests/ui/consts/offset_from_ub.stderr +++ b/tests/ui/consts/offset_from_ub.stderr @@ -39,19 +39,19 @@ error[E0080]: evaluation of constant value failed --> $DIR/offset_from_ub.rs:53:14 | LL | unsafe { ptr_offset_from(end_ptr, start_ptr) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc18 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc17 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds error[E0080]: evaluation of constant value failed --> $DIR/offset_from_ub.rs:62:14 | LL | unsafe { ptr_offset_from(start_ptr, end_ptr) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc21 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc20 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds error[E0080]: evaluation of constant value failed --> $DIR/offset_from_ub.rs:70:14 | LL | unsafe { ptr_offset_from(end_ptr, end_ptr) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc24 has size 4, so pointer at offset 10 is out-of-bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc23 has size 4, so pointer at offset 10 is out-of-bounds error[E0080]: evaluation of constant value failed --> $DIR/offset_from_ub.rs:79:14 diff --git a/tests/ui/consts/uninhabited-const-issue-61744.stderr b/tests/ui/consts/uninhabited-const-issue-61744.stderr index 3a94e1931..adefbf336 100644 --- a/tests/ui/consts/uninhabited-const-issue-61744.stderr +++ b/tests/ui/consts/uninhabited-const-issue-61744.stderr @@ -657,12 +657,6 @@ note: erroneous constant used LL | dbg!(i32::CONSTANT); | ^^^^^^^^^^^^^ -note: erroneous constant used - --> $DIR/uninhabited-const-issue-61744.rs:18:10 - | -LL | dbg!(i32::CONSTANT); - | ^^^^^^^^^^^^^ - error: aborting due to previous error For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/cycle-trait/cycle-trait-supertrait-direct.stderr b/tests/ui/cycle-trait/cycle-trait-supertrait-direct.stderr index f6ffcc4b5..e2b2aac05 100644 --- a/tests/ui/cycle-trait/cycle-trait-supertrait-direct.stderr +++ b/tests/ui/cycle-trait/cycle-trait-supertrait-direct.stderr @@ -1,15 +1,10 @@ error[E0391]: cycle detected when computing the super predicates of `Chromosome` - --> $DIR/cycle-trait-supertrait-direct.rs:3:1 - | -LL | trait Chromosome: Chromosome { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: ...which requires computing the super traits of `Chromosome`... --> $DIR/cycle-trait-supertrait-direct.rs:3:19 | LL | trait Chromosome: Chromosome { | ^^^^^^^^^^ - = note: ...which again requires computing the super predicates of `Chromosome`, completing the cycle + | + = note: ...which immediately requires computing the super predicates of `Chromosome` again note: cycle used when collecting item types in top-level module --> $DIR/cycle-trait-supertrait-direct.rs:3:1 | diff --git a/tests/ui/cycle-trait/cycle-trait-supertrait-indirect.stderr b/tests/ui/cycle-trait/cycle-trait-supertrait-indirect.stderr index 0a2284e0e..c903e1146 100644 --- a/tests/ui/cycle-trait/cycle-trait-supertrait-indirect.stderr +++ b/tests/ui/cycle-trait/cycle-trait-supertrait-indirect.stderr @@ -1,26 +1,16 @@ error[E0391]: cycle detected when computing the super predicates of `B` - --> $DIR/cycle-trait-supertrait-indirect.rs:7:1 - | -LL | trait B: C { - | ^^^^^^^^^^ - | -note: ...which requires computing the super traits of `B`... --> $DIR/cycle-trait-supertrait-indirect.rs:7:10 | LL | trait B: C { | ^ -note: ...which requires computing the super predicates of `C`... - --> $DIR/cycle-trait-supertrait-indirect.rs:11:1 | -LL | trait C: B { } - | ^^^^^^^^^^ -note: ...which requires computing the super traits of `C`... +note: ...which requires computing the super predicates of `C`... --> $DIR/cycle-trait-supertrait-indirect.rs:11:10 | LL | trait C: B { } | ^ = note: ...which again requires computing the super predicates of `B`, completing the cycle -note: cycle used when computing the super traits of `A` +note: cycle used when computing the super predicates of `A` --> $DIR/cycle-trait-supertrait-indirect.rs:4:10 | LL | trait A: B { diff --git a/tests/ui/derived-errors/issue-31997-1.stderr b/tests/ui/derived-errors/issue-31997-1.stderr index 2f4aabf84..a0262f4c1 100644 --- a/tests/ui/derived-errors/issue-31997-1.stderr +++ b/tests/ui/derived-errors/issue-31997-1.stderr @@ -6,7 +6,7 @@ LL | let mut map = HashMap::new(); | help: consider importing this struct | -LL | use std::collections::HashMap; +LL + use std::collections::HashMap; | error: aborting due to previous error diff --git a/tests/ui/derives/derive-assoc-type-not-impl.stderr b/tests/ui/derives/derive-assoc-type-not-impl.stderr index 91b334b41..9f17c76c2 100644 --- a/tests/ui/derives/derive-assoc-type-not-impl.stderr +++ b/tests/ui/derives/derive-assoc-type-not-impl.stderr @@ -23,7 +23,8 @@ LL | #[derive(Clone)] candidate #1: `Clone` help: consider annotating `NotClone` with `#[derive(Clone)]` | -LL | #[derive(Clone)] +LL + #[derive(Clone)] +LL | struct NotClone; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-Clone-enum-struct-variant.stderr b/tests/ui/derives/derives-span-Clone-enum-struct-variant.stderr index 7326324b0..31ab589cf 100644 --- a/tests/ui/derives/derives-span-Clone-enum-struct-variant.stderr +++ b/tests/ui/derives/derives-span-Clone-enum-struct-variant.stderr @@ -10,7 +10,8 @@ LL | x: Error = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Clone)]` | -LL | #[derive(Clone)] +LL + #[derive(Clone)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-Clone-enum.stderr b/tests/ui/derives/derives-span-Clone-enum.stderr index 229a4f7d9..b5580c02f 100644 --- a/tests/ui/derives/derives-span-Clone-enum.stderr +++ b/tests/ui/derives/derives-span-Clone-enum.stderr @@ -10,7 +10,8 @@ LL | Error = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Clone)]` | -LL | #[derive(Clone)] +LL + #[derive(Clone)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-Clone-struct.stderr b/tests/ui/derives/derives-span-Clone-struct.stderr index 96bad9eda..fbe7e3f84 100644 --- a/tests/ui/derives/derives-span-Clone-struct.stderr +++ b/tests/ui/derives/derives-span-Clone-struct.stderr @@ -10,7 +10,8 @@ LL | x: Error = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Clone)]` | -LL | #[derive(Clone)] +LL + #[derive(Clone)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-Clone-tuple-struct.stderr b/tests/ui/derives/derives-span-Clone-tuple-struct.stderr index b61341e57..639f4d542 100644 --- a/tests/ui/derives/derives-span-Clone-tuple-struct.stderr +++ b/tests/ui/derives/derives-span-Clone-tuple-struct.stderr @@ -10,7 +10,8 @@ LL | Error = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Clone)]` | -LL | #[derive(Clone)] +LL + #[derive(Clone)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-Debug-enum-struct-variant.stderr b/tests/ui/derives/derives-span-Debug-enum-struct-variant.stderr index 58a64a4f5..7ff6851f6 100644 --- a/tests/ui/derives/derives-span-Debug-enum-struct-variant.stderr +++ b/tests/ui/derives/derives-span-Debug-enum-struct-variant.stderr @@ -12,7 +12,8 @@ LL | x: Error = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Debug)]` | -LL | #[derive(Debug)] +LL + #[derive(Debug)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-Debug-enum.stderr b/tests/ui/derives/derives-span-Debug-enum.stderr index e9bb5f960..346cbec90 100644 --- a/tests/ui/derives/derives-span-Debug-enum.stderr +++ b/tests/ui/derives/derives-span-Debug-enum.stderr @@ -12,7 +12,8 @@ LL | Error = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Debug)]` | -LL | #[derive(Debug)] +LL + #[derive(Debug)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-Debug-struct.stderr b/tests/ui/derives/derives-span-Debug-struct.stderr index 0a117c060..4b39eeb09 100644 --- a/tests/ui/derives/derives-span-Debug-struct.stderr +++ b/tests/ui/derives/derives-span-Debug-struct.stderr @@ -12,7 +12,8 @@ LL | x: Error = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Debug)]` | -LL | #[derive(Debug)] +LL + #[derive(Debug)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-Debug-tuple-struct.stderr b/tests/ui/derives/derives-span-Debug-tuple-struct.stderr index f2e90a418..f3043abca 100644 --- a/tests/ui/derives/derives-span-Debug-tuple-struct.stderr +++ b/tests/ui/derives/derives-span-Debug-tuple-struct.stderr @@ -12,7 +12,8 @@ LL | Error = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Debug)]` | -LL | #[derive(Debug)] +LL + #[derive(Debug)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-Default-struct.stderr b/tests/ui/derives/derives-span-Default-struct.stderr index d4affd535..4844b6359 100644 --- a/tests/ui/derives/derives-span-Default-struct.stderr +++ b/tests/ui/derives/derives-span-Default-struct.stderr @@ -10,7 +10,8 @@ LL | x: Error = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Default)]` | -LL | #[derive(Default)] +LL + #[derive(Default)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-Default-tuple-struct.stderr b/tests/ui/derives/derives-span-Default-tuple-struct.stderr index 129351f59..9cac7f107 100644 --- a/tests/ui/derives/derives-span-Default-tuple-struct.stderr +++ b/tests/ui/derives/derives-span-Default-tuple-struct.stderr @@ -10,7 +10,8 @@ LL | Error = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Default)]` | -LL | #[derive(Default)] +LL + #[derive(Default)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-Eq-enum-struct-variant.stderr b/tests/ui/derives/derives-span-Eq-enum-struct-variant.stderr index 2be69a30b..1a9ff9832 100644 --- a/tests/ui/derives/derives-span-Eq-enum-struct-variant.stderr +++ b/tests/ui/derives/derives-span-Eq-enum-struct-variant.stderr @@ -12,7 +12,8 @@ note: required by a bound in `AssertParamIsEq` = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Eq)]` | -LL | #[derive(Eq)] +LL + #[derive(Eq)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-Eq-enum.stderr b/tests/ui/derives/derives-span-Eq-enum.stderr index 4f4f821cc..8205657bb 100644 --- a/tests/ui/derives/derives-span-Eq-enum.stderr +++ b/tests/ui/derives/derives-span-Eq-enum.stderr @@ -12,7 +12,8 @@ note: required by a bound in `AssertParamIsEq` = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Eq)]` | -LL | #[derive(Eq)] +LL + #[derive(Eq)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-Eq-struct.stderr b/tests/ui/derives/derives-span-Eq-struct.stderr index f15659c3e..af510181d 100644 --- a/tests/ui/derives/derives-span-Eq-struct.stderr +++ b/tests/ui/derives/derives-span-Eq-struct.stderr @@ -12,7 +12,8 @@ note: required by a bound in `AssertParamIsEq` = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Eq)]` | -LL | #[derive(Eq)] +LL + #[derive(Eq)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-Eq-tuple-struct.stderr b/tests/ui/derives/derives-span-Eq-tuple-struct.stderr index 4e5659b35..f7c371d7d 100644 --- a/tests/ui/derives/derives-span-Eq-tuple-struct.stderr +++ b/tests/ui/derives/derives-span-Eq-tuple-struct.stderr @@ -12,7 +12,8 @@ note: required by a bound in `AssertParamIsEq` = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Eq)]` | -LL | #[derive(Eq)] +LL + #[derive(Eq)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-Hash-enum-struct-variant.stderr b/tests/ui/derives/derives-span-Hash-enum-struct-variant.stderr index fe5e0e96a..311edade0 100644 --- a/tests/ui/derives/derives-span-Hash-enum-struct-variant.stderr +++ b/tests/ui/derives/derives-span-Hash-enum-struct-variant.stderr @@ -10,7 +10,8 @@ LL | x: Error = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Hash)]` | -LL | #[derive(Hash)] +LL + #[derive(Hash)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-Hash-enum.stderr b/tests/ui/derives/derives-span-Hash-enum.stderr index 99785b87c..043aa954b 100644 --- a/tests/ui/derives/derives-span-Hash-enum.stderr +++ b/tests/ui/derives/derives-span-Hash-enum.stderr @@ -10,7 +10,8 @@ LL | Error = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Hash)]` | -LL | #[derive(Hash)] +LL + #[derive(Hash)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-Hash-struct.stderr b/tests/ui/derives/derives-span-Hash-struct.stderr index 4db83dd13..26d31b661 100644 --- a/tests/ui/derives/derives-span-Hash-struct.stderr +++ b/tests/ui/derives/derives-span-Hash-struct.stderr @@ -10,7 +10,8 @@ LL | x: Error = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Hash)]` | -LL | #[derive(Hash)] +LL + #[derive(Hash)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-Hash-tuple-struct.stderr b/tests/ui/derives/derives-span-Hash-tuple-struct.stderr index 8660c97e6..3155a023c 100644 --- a/tests/ui/derives/derives-span-Hash-tuple-struct.stderr +++ b/tests/ui/derives/derives-span-Hash-tuple-struct.stderr @@ -10,7 +10,8 @@ LL | Error = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Hash)]` | -LL | #[derive(Hash)] +LL + #[derive(Hash)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-Ord-enum-struct-variant.stderr b/tests/ui/derives/derives-span-Ord-enum-struct-variant.stderr index 6e48332c2..1a06aee52 100644 --- a/tests/ui/derives/derives-span-Ord-enum-struct-variant.stderr +++ b/tests/ui/derives/derives-span-Ord-enum-struct-variant.stderr @@ -10,7 +10,8 @@ LL | x: Error = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Ord)]` | -LL | #[derive(Ord)] +LL + #[derive(Ord)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-Ord-enum.stderr b/tests/ui/derives/derives-span-Ord-enum.stderr index b05cf0a05..377728e8a 100644 --- a/tests/ui/derives/derives-span-Ord-enum.stderr +++ b/tests/ui/derives/derives-span-Ord-enum.stderr @@ -10,7 +10,8 @@ LL | Error = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Ord)]` | -LL | #[derive(Ord)] +LL + #[derive(Ord)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-Ord-struct.stderr b/tests/ui/derives/derives-span-Ord-struct.stderr index c4def34a8..e00e990da 100644 --- a/tests/ui/derives/derives-span-Ord-struct.stderr +++ b/tests/ui/derives/derives-span-Ord-struct.stderr @@ -10,7 +10,8 @@ LL | x: Error = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Ord)]` | -LL | #[derive(Ord)] +LL + #[derive(Ord)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-Ord-tuple-struct.stderr b/tests/ui/derives/derives-span-Ord-tuple-struct.stderr index a3b288d0f..959d0b964 100644 --- a/tests/ui/derives/derives-span-Ord-tuple-struct.stderr +++ b/tests/ui/derives/derives-span-Ord-tuple-struct.stderr @@ -10,7 +10,8 @@ LL | Error = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Ord)]` | -LL | #[derive(Ord)] +LL + #[derive(Ord)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr b/tests/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr index 9953154fd..9fc25f2ad 100644 --- a/tests/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr +++ b/tests/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr @@ -15,7 +15,8 @@ LL | struct Error; = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(PartialEq)]` | -LL | #[derive(PartialEq)] +LL + #[derive(PartialEq)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-PartialEq-enum.stderr b/tests/ui/derives/derives-span-PartialEq-enum.stderr index 7c1304523..f56e78447 100644 --- a/tests/ui/derives/derives-span-PartialEq-enum.stderr +++ b/tests/ui/derives/derives-span-PartialEq-enum.stderr @@ -15,7 +15,8 @@ LL | struct Error; = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(PartialEq)]` | -LL | #[derive(PartialEq)] +LL + #[derive(PartialEq)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-PartialEq-struct.stderr b/tests/ui/derives/derives-span-PartialEq-struct.stderr index ba3d6ced3..76c0b0104 100644 --- a/tests/ui/derives/derives-span-PartialEq-struct.stderr +++ b/tests/ui/derives/derives-span-PartialEq-struct.stderr @@ -15,7 +15,8 @@ LL | struct Error; = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(PartialEq)]` | -LL | #[derive(PartialEq)] +LL + #[derive(PartialEq)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-PartialEq-tuple-struct.stderr b/tests/ui/derives/derives-span-PartialEq-tuple-struct.stderr index ab0b56a9e..7dae01dbb 100644 --- a/tests/ui/derives/derives-span-PartialEq-tuple-struct.stderr +++ b/tests/ui/derives/derives-span-PartialEq-tuple-struct.stderr @@ -15,7 +15,8 @@ LL | struct Error; = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(PartialEq)]` | -LL | #[derive(PartialEq)] +LL + #[derive(PartialEq)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr b/tests/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr index 2d19aaf68..746c1d5d2 100644 --- a/tests/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr +++ b/tests/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr @@ -11,7 +11,8 @@ LL | x: Error = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(PartialOrd)]` | -LL | #[derive(PartialOrd)] +LL + #[derive(PartialOrd)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-PartialOrd-enum.stderr b/tests/ui/derives/derives-span-PartialOrd-enum.stderr index dfbb8060f..8af1776da 100644 --- a/tests/ui/derives/derives-span-PartialOrd-enum.stderr +++ b/tests/ui/derives/derives-span-PartialOrd-enum.stderr @@ -11,7 +11,8 @@ LL | Error = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(PartialOrd)]` | -LL | #[derive(PartialOrd)] +LL + #[derive(PartialOrd)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-PartialOrd-struct.stderr b/tests/ui/derives/derives-span-PartialOrd-struct.stderr index ba63d86e8..11ea7f9dc 100644 --- a/tests/ui/derives/derives-span-PartialOrd-struct.stderr +++ b/tests/ui/derives/derives-span-PartialOrd-struct.stderr @@ -11,7 +11,8 @@ LL | x: Error = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(PartialOrd)]` | -LL | #[derive(PartialOrd)] +LL + #[derive(PartialOrd)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/derives-span-PartialOrd-tuple-struct.stderr b/tests/ui/derives/derives-span-PartialOrd-tuple-struct.stderr index 7686ed806..0a41a3db3 100644 --- a/tests/ui/derives/derives-span-PartialOrd-tuple-struct.stderr +++ b/tests/ui/derives/derives-span-PartialOrd-tuple-struct.stderr @@ -11,7 +11,8 @@ LL | Error = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(PartialOrd)]` | -LL | #[derive(PartialOrd)] +LL + #[derive(PartialOrd)] +LL | struct Error; | error: aborting due to previous error diff --git a/tests/ui/derives/deriving-no-inner-impl-error-message.stderr b/tests/ui/derives/deriving-no-inner-impl-error-message.stderr index ef8c44caa..10af5d36e 100644 --- a/tests/ui/derives/deriving-no-inner-impl-error-message.stderr +++ b/tests/ui/derives/deriving-no-inner-impl-error-message.stderr @@ -15,7 +15,8 @@ LL | struct NoCloneOrEq; = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `NoCloneOrEq` with `#[derive(PartialEq)]` | -LL | #[derive(PartialEq)] +LL + #[derive(PartialEq)] +LL | struct NoCloneOrEq; | error[E0277]: the trait bound `NoCloneOrEq: Clone` is not satisfied @@ -30,7 +31,8 @@ LL | x: NoCloneOrEq = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `NoCloneOrEq` with `#[derive(Clone)]` | -LL | #[derive(Clone)] +LL + #[derive(Clone)] +LL | struct NoCloneOrEq; | error: aborting due to 2 previous errors diff --git a/tests/ui/derives/deriving-with-repr-packed-2.stderr b/tests/ui/derives/deriving-with-repr-packed-2.stderr index ab3646057..afeca9fec 100644 --- a/tests/ui/derives/deriving-with-repr-packed-2.stderr +++ b/tests/ui/derives/deriving-with-repr-packed-2.stderr @@ -25,7 +25,8 @@ LL | #[derive(Copy, Clone, Default, PartialEq, Eq)] | ^^^^^ unsatisfied trait bound introduced in this `derive` macro help: consider annotating `NonCopy` with `#[derive(Clone, Copy)]` | -LL | #[derive(Clone, Copy)] +LL + #[derive(Clone, Copy)] +LL | struct NonCopy; | error: aborting due to previous error diff --git a/tests/ui/derives/issue-91492.stderr b/tests/ui/derives/issue-91492.stderr index cee30ac50..fc64828b1 100644 --- a/tests/ui/derives/issue-91492.stderr +++ b/tests/ui/derives/issue-91492.stderr @@ -11,7 +11,8 @@ LL | foo.extend_from_slice(bar); `NoDerives: Clone` help: consider annotating `NoDerives` with `#[derive(Clone)]` | -LL | #[derive(Clone)] +LL + #[derive(Clone)] +LL | pub struct NoDerives; | error[E0599]: the method `extend_from_slice` exists for mutable reference `&mut Vec`, but its trait bounds were not satisfied @@ -27,7 +28,8 @@ LL | foo.extend_from_slice(bar); `SomeDerives: Clone` help: consider annotating `SomeDerives` with `#[derive(Clone)]` | -LL | #[derive(Clone)] +LL + #[derive(Clone)] +LL | pub struct SomeDerives; | error[E0599]: the method `use_clone` exists for struct `Object`, but its trait bounds were not satisfied @@ -51,7 +53,8 @@ LL | impl Object { | unsatisfied trait bound introduced here help: consider annotating `NoDerives` with `#[derive(Clone)]` | -LL | #[derive(Clone)] +LL + #[derive(Clone)] +LL | pub struct NoDerives; | error: aborting due to 3 previous errors diff --git a/tests/ui/derives/issue-91550.stderr b/tests/ui/derives/issue-91550.stderr index af03f0e5e..1324b80b5 100644 --- a/tests/ui/derives/issue-91550.stderr +++ b/tests/ui/derives/issue-91550.stderr @@ -18,7 +18,8 @@ LL | hs.insert(Value(0)); `Value: Hash` help: consider annotating `Value` with `#[derive(Eq, Hash, PartialEq)]` | -LL | #[derive(Eq, Hash, PartialEq)] +LL + #[derive(Eq, Hash, PartialEq)] +LL | struct Value(u32); | error[E0599]: the method `use_eq` exists for struct `Object`, but its trait bounds were not satisfied @@ -48,7 +49,8 @@ LL | impl Object { which is required by `NoDerives: Eq` help: consider annotating `NoDerives` with `#[derive(Eq, PartialEq)]` | -LL | #[derive(Eq, PartialEq)] +LL + #[derive(Eq, PartialEq)] +LL | pub struct NoDerives; | error[E0599]: the method `use_ord` exists for struct `Object`, but its trait bounds were not satisfied @@ -84,7 +86,8 @@ LL | impl Object { which is required by `NoDerives: Ord` help: consider annotating `NoDerives` with `#[derive(Eq, Ord, PartialEq, PartialOrd)]` | -LL | #[derive(Eq, Ord, PartialEq, PartialOrd)] +LL + #[derive(Eq, Ord, PartialEq, PartialOrd)] +LL | pub struct NoDerives; | error[E0599]: the method `use_ord_and_partial_ord` exists for struct `Object`, but its trait bounds were not satisfied @@ -123,7 +126,8 @@ LL | impl Object { which is required by `NoDerives: PartialOrd` help: consider annotating `NoDerives` with `#[derive(Eq, Ord, PartialEq, PartialOrd)]` | -LL | #[derive(Eq, Ord, PartialEq, PartialOrd)] +LL + #[derive(Eq, Ord, PartialEq, PartialOrd)] +LL | pub struct NoDerives; | error: aborting due to 4 previous errors diff --git a/tests/ui/diagnostic-width/auxiliary/tab_column_numbers.rs b/tests/ui/diagnostic-width/auxiliary/tab_column_numbers.rs new file mode 100644 index 000000000..93418b765 --- /dev/null +++ b/tests/ui/diagnostic-width/auxiliary/tab_column_numbers.rs @@ -0,0 +1,6 @@ +// ignore-tidy-tab + +pub struct S; +impl S { + fn method(&self) {} +} diff --git a/tests/ui/diagnostic-width/tab-column-numbers.rs b/tests/ui/diagnostic-width/tab-column-numbers.rs new file mode 100644 index 000000000..2abb0bcde --- /dev/null +++ b/tests/ui/diagnostic-width/tab-column-numbers.rs @@ -0,0 +1,12 @@ +// Test for #109537: ensure that column numbers are correctly generated when using hard tabs. +// aux-build:tab_column_numbers.rs + +// ignore-tidy-tab + +extern crate tab_column_numbers; + +fn main() { + let s = tab_column_numbers::S; + s.method(); + //~^ ERROR method `method` is private +} diff --git a/tests/ui/diagnostic-width/tab-column-numbers.stderr b/tests/ui/diagnostic-width/tab-column-numbers.stderr new file mode 100644 index 000000000..ea4e1ff52 --- /dev/null +++ b/tests/ui/diagnostic-width/tab-column-numbers.stderr @@ -0,0 +1,14 @@ +error[E0624]: method `method` is private + --> $DIR/tab-column-numbers.rs:10:4 + | +LL | s.method(); + | ^^^^^^ private method + | + ::: $DIR/auxiliary/tab_column_numbers.rs:5:3 + | +LL | fn method(&self) {} + | ---------------- private method defined here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0624`. diff --git a/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr b/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr index abc040c05..5c610f363 100644 --- a/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr +++ b/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr @@ -24,13 +24,13 @@ LL | fn setup() -> Set { Set } | help: consider importing one of these items | -LL | use AffixHeart::Set; +LL + use AffixHeart::Set; | -LL | use CauseToBe::Set; +LL + use CauseToBe::Set; | -LL | use Determine::Set; +LL + use Determine::Set; | -LL | use PutDown::Set; +LL + use PutDown::Set; | and 3 other candidates diff --git a/tests/ui/did_you_mean/recursion_limit.stderr b/tests/ui/did_you_mean/recursion_limit.stderr index 247fe4b5b..70e49566a 100644 --- a/tests/ui/did_you_mean/recursion_limit.stderr +++ b/tests/ui/did_you_mean/recursion_limit.stderr @@ -1,15 +1,10 @@ -error[E0275]: overflow evaluating the requirement `K: Send` +error[E0275]: overflow evaluating the requirement `J: Send` --> $DIR/recursion_limit.rs:34:5 | LL | is_send::(); | ^^^^^^^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "20"]` attribute to your crate (`recursion_limit`) -note: required because it appears within the type `J` - --> $DIR/recursion_limit.rs:24:9 - | -LL | link! { J, K } - | ^ note: required because it appears within the type `I` --> $DIR/recursion_limit.rs:23:9 | diff --git a/tests/ui/did_you_mean/recursion_limit_deref.stderr b/tests/ui/did_you_mean/recursion_limit_deref.stderr index 32fb628c4..b0c493faf 100644 --- a/tests/ui/did_you_mean/recursion_limit_deref.stderr +++ b/tests/ui/did_you_mean/recursion_limit_deref.stderr @@ -1,3 +1,7 @@ +error: reached the recursion limit finding the struct tail for `Bottom` + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "20"]` + error[E0055]: reached the recursion limit while auto-dereferencing `J` --> $DIR/recursion_limit_deref.rs:51:22 | @@ -17,7 +21,7 @@ LL | let x: &Bottom = &t; = note: expected reference `&Bottom` found reference `&Top` -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors Some errors have detailed explanations: E0055, E0308. For more information about an error, try `rustc --explain E0055`. diff --git a/tests/ui/disambiguate-identical-names.rs b/tests/ui/disambiguate-identical-names.rs deleted file mode 100644 index 708d2cd76..000000000 --- a/tests/ui/disambiguate-identical-names.rs +++ /dev/null @@ -1,15 +0,0 @@ -pub mod submod { - // Create ambiguity with the std::vec::Vec item: - pub struct Vec; -} - -fn test(_v: &Vec>) { -} - -fn main() { - let v = std::collections::HashMap::new(); - v.insert(3u8, 1u8); - - test(&v); - //~^ ERROR mismatched types -} diff --git a/tests/ui/disambiguate-identical-names.stderr b/tests/ui/disambiguate-identical-names.stderr deleted file mode 100644 index 7d8293018..000000000 --- a/tests/ui/disambiguate-identical-names.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/disambiguate-identical-names.rs:13:10 - | -LL | test(&v); - | ---- ^^ expected `&Vec>`, found `&HashMap` - | | - | arguments to this function are incorrect - | - = note: expected reference `&std::vec::Vec>` - found reference `&HashMap` -note: function defined here - --> $DIR/disambiguate-identical-names.rs:6:4 - | -LL | fn test(_v: &Vec>) { - | ^^^^ ------------------ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/dst/issue-90528-unsizing-suggestion-1.rs b/tests/ui/dst/issue-90528-unsizing-suggestion-1.rs new file mode 100644 index 000000000..52863e22b --- /dev/null +++ b/tests/ui/dst/issue-90528-unsizing-suggestion-1.rs @@ -0,0 +1,20 @@ +// Issue #90528: provide helpful suggestions when a trait bound is unsatisfied +// due to a missed unsizing coercion. +// +// This test exercises array literals and a trait implemented on immutable slices. + +trait Read {} + +impl Read for &[u8] {} + +fn wants_read(_: impl Read) {} + +fn main() { + wants_read([0u8]); + //~^ ERROR the trait bound `[u8; 1]: Read` is not satisfied + wants_read(&[0u8]); + //~^ ERROR the trait bound `&[u8; 1]: Read` is not satisfied + wants_read(&[0u8][..]); + wants_read(&mut [0u8]); + //~^ ERROR the trait bound `&mut [u8; 1]: Read` is not satisfied +} diff --git a/tests/ui/dst/issue-90528-unsizing-suggestion-1.stderr b/tests/ui/dst/issue-90528-unsizing-suggestion-1.stderr new file mode 100644 index 000000000..27ef3fe97 --- /dev/null +++ b/tests/ui/dst/issue-90528-unsizing-suggestion-1.stderr @@ -0,0 +1,56 @@ +error[E0277]: the trait bound `[u8; 1]: Read` is not satisfied + --> $DIR/issue-90528-unsizing-suggestion-1.rs:13:16 + | +LL | wants_read([0u8]); + | ---------- ^^^^^ the trait `Read` is not implemented for `[u8; 1]` + | | + | required by a bound introduced by this call + | + = help: the trait `Read` is implemented for `&[u8]` +note: required by a bound in `wants_read` + --> $DIR/issue-90528-unsizing-suggestion-1.rs:10:23 + | +LL | fn wants_read(_: impl Read) {} + | ^^^^ required by this bound in `wants_read` +help: convert the array to a `&[u8]` slice instead + | +LL | wants_read(&[0u8][..]); + | + ++++ + +error[E0277]: the trait bound `&[u8; 1]: Read` is not satisfied + --> $DIR/issue-90528-unsizing-suggestion-1.rs:15:16 + | +LL | wants_read(&[0u8]); + | ---------- ^^^^^^ the trait `Read` is not implemented for `&[u8; 1]` + | | + | required by a bound introduced by this call + | + = help: the trait `Read` is implemented for `&[u8]` +note: required by a bound in `wants_read` + --> $DIR/issue-90528-unsizing-suggestion-1.rs:10:23 + | +LL | fn wants_read(_: impl Read) {} + | ^^^^ required by this bound in `wants_read` +help: convert the array to a `&[u8]` slice instead + | +LL | wants_read(&[0u8][..]); + | ++++ + +error[E0277]: the trait bound `&mut [u8; 1]: Read` is not satisfied + --> $DIR/issue-90528-unsizing-suggestion-1.rs:18:16 + | +LL | wants_read(&mut [0u8]); + | ---------- ^^^^^^^^^^ the trait `Read` is not implemented for `&mut [u8; 1]` + | | + | required by a bound introduced by this call + | + = help: the trait `Read` is implemented for `&[u8]` +note: required by a bound in `wants_read` + --> $DIR/issue-90528-unsizing-suggestion-1.rs:10:23 + | +LL | fn wants_read(_: impl Read) {} + | ^^^^ required by this bound in `wants_read` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/dst/issue-90528-unsizing-suggestion-2.rs b/tests/ui/dst/issue-90528-unsizing-suggestion-2.rs new file mode 100644 index 000000000..f2762ad42 --- /dev/null +++ b/tests/ui/dst/issue-90528-unsizing-suggestion-2.rs @@ -0,0 +1,28 @@ +// Issue #90528: provide helpful suggestions when a trait bound is unsatisfied +// due to a missed unsizing coercion. +// +// This test exercises array variables and a trait implemented on immmutable slices. + +trait Read {} + +impl Read for &[u8] {} + +fn wants_read(_: impl Read) {} + +fn main() { + let x = [0u8]; + wants_read(x); + //~^ ERROR the trait bound `[u8; 1]: Read` is not satisfied + wants_read(&x); + //~^ ERROR the trait bound `&[u8; 1]: Read` is not satisfied + wants_read(&x[..]); + + let x = &[0u8]; + wants_read(x); + //~^ ERROR the trait bound `&[u8; 1]: Read` is not satisfied + wants_read(&x); + //~^ ERROR the trait bound `&&[u8; 1]: Read` is not satisfied + wants_read(*x); + //~^ ERROR the trait bound `[u8; 1]: Read` is not satisfied + wants_read(&x[..]); +} diff --git a/tests/ui/dst/issue-90528-unsizing-suggestion-2.stderr b/tests/ui/dst/issue-90528-unsizing-suggestion-2.stderr new file mode 100644 index 000000000..ae0c4ca50 --- /dev/null +++ b/tests/ui/dst/issue-90528-unsizing-suggestion-2.stderr @@ -0,0 +1,94 @@ +error[E0277]: the trait bound `[u8; 1]: Read` is not satisfied + --> $DIR/issue-90528-unsizing-suggestion-2.rs:14:16 + | +LL | wants_read(x); + | ---------- ^ the trait `Read` is not implemented for `[u8; 1]` + | | + | required by a bound introduced by this call + | + = help: the trait `Read` is implemented for `&[u8]` +note: required by a bound in `wants_read` + --> $DIR/issue-90528-unsizing-suggestion-2.rs:10:23 + | +LL | fn wants_read(_: impl Read) {} + | ^^^^ required by this bound in `wants_read` +help: convert the array to a `&[u8]` slice instead + | +LL | wants_read(&x[..]); + | + ++++ + +error[E0277]: the trait bound `&[u8; 1]: Read` is not satisfied + --> $DIR/issue-90528-unsizing-suggestion-2.rs:16:16 + | +LL | wants_read(&x); + | ---------- ^^ the trait `Read` is not implemented for `&[u8; 1]` + | | + | required by a bound introduced by this call + | + = help: the trait `Read` is implemented for `&[u8]` +note: required by a bound in `wants_read` + --> $DIR/issue-90528-unsizing-suggestion-2.rs:10:23 + | +LL | fn wants_read(_: impl Read) {} + | ^^^^ required by this bound in `wants_read` +help: convert the array to a `&[u8]` slice instead + | +LL | wants_read(&x[..]); + | ++++ + +error[E0277]: the trait bound `&[u8; 1]: Read` is not satisfied + --> $DIR/issue-90528-unsizing-suggestion-2.rs:21:16 + | +LL | wants_read(x); + | ---------- ^ the trait `Read` is not implemented for `&[u8; 1]` + | | + | required by a bound introduced by this call + | + = help: the trait `Read` is implemented for `&[u8]` +note: required by a bound in `wants_read` + --> $DIR/issue-90528-unsizing-suggestion-2.rs:10:23 + | +LL | fn wants_read(_: impl Read) {} + | ^^^^ required by this bound in `wants_read` +help: convert the array to a `&[u8]` slice instead + | +LL | wants_read(&x[..]); + | + ++++ + +error[E0277]: the trait bound `&&[u8; 1]: Read` is not satisfied + --> $DIR/issue-90528-unsizing-suggestion-2.rs:23:16 + | +LL | wants_read(&x); + | ---------- ^^ the trait `Read` is not implemented for `&&[u8; 1]` + | | + | required by a bound introduced by this call + | + = help: the trait `Read` is implemented for `&[u8]` +note: required by a bound in `wants_read` + --> $DIR/issue-90528-unsizing-suggestion-2.rs:10:23 + | +LL | fn wants_read(_: impl Read) {} + | ^^^^ required by this bound in `wants_read` + +error[E0277]: the trait bound `[u8; 1]: Read` is not satisfied + --> $DIR/issue-90528-unsizing-suggestion-2.rs:25:16 + | +LL | wants_read(*x); + | ---------- ^^ the trait `Read` is not implemented for `[u8; 1]` + | | + | required by a bound introduced by this call + | + = help: the trait `Read` is implemented for `&[u8]` +note: required by a bound in `wants_read` + --> $DIR/issue-90528-unsizing-suggestion-2.rs:10:23 + | +LL | fn wants_read(_: impl Read) {} + | ^^^^ required by this bound in `wants_read` +help: convert the array to a `&[u8]` slice instead + | +LL | wants_read(&*x[..]); + | + ++++ + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/dst/issue-90528-unsizing-suggestion-3.rs b/tests/ui/dst/issue-90528-unsizing-suggestion-3.rs new file mode 100644 index 000000000..218843d05 --- /dev/null +++ b/tests/ui/dst/issue-90528-unsizing-suggestion-3.rs @@ -0,0 +1,22 @@ +// Issue #90528: provide helpful suggestions when a trait bound is unsatisfied +// due to a missed unsizing coercion. +// +// This test exercises array literals and a trait implemented on mutable slices. + +trait Write {} + +impl Write for &mut [u8] {} + +fn wants_write(_: impl Write) {} + +fn main() { + wants_write([0u8]); + //~^ ERROR the trait bound `[u8; 1]: Write` is not satisfied + wants_write(&mut [0u8]); + //~^ ERROR the trait bound `&mut [u8; 1]: Write` is not satisfied + wants_write(&mut [0u8][..]); + wants_write(&[0u8]); + //~^ ERROR the trait bound `&[u8; 1]: Write` is not satisfied + wants_write(&[0u8][..]); + //~^ ERROR the trait bound `&[u8]: Write` is not satisfied +} diff --git a/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr b/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr new file mode 100644 index 000000000..774d5ba3c --- /dev/null +++ b/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr @@ -0,0 +1,75 @@ +error[E0277]: the trait bound `[u8; 1]: Write` is not satisfied + --> $DIR/issue-90528-unsizing-suggestion-3.rs:13:17 + | +LL | wants_write([0u8]); + | ----------- ^^^^^ the trait `Write` is not implemented for `[u8; 1]` + | | + | required by a bound introduced by this call + | + = help: the trait `Write` is implemented for `&mut [u8]` +note: required by a bound in `wants_write` + --> $DIR/issue-90528-unsizing-suggestion-3.rs:10:24 + | +LL | fn wants_write(_: impl Write) {} + | ^^^^^ required by this bound in `wants_write` +help: convert the array to a `&mut [u8]` slice instead + | +LL | wants_write(&mut [0u8][..]); + | ++++ ++++ + +error[E0277]: the trait bound `&mut [u8; 1]: Write` is not satisfied + --> $DIR/issue-90528-unsizing-suggestion-3.rs:15:17 + | +LL | wants_write(&mut [0u8]); + | ----------- ^^^^^^^^^^ the trait `Write` is not implemented for `&mut [u8; 1]` + | | + | required by a bound introduced by this call + | + = help: the trait `Write` is implemented for `&mut [u8]` +note: required by a bound in `wants_write` + --> $DIR/issue-90528-unsizing-suggestion-3.rs:10:24 + | +LL | fn wants_write(_: impl Write) {} + | ^^^^^ required by this bound in `wants_write` +help: convert the array to a `&mut [u8]` slice instead + | +LL | wants_write(&mut [0u8][..]); + | ++++ + +error[E0277]: the trait bound `&[u8; 1]: Write` is not satisfied + --> $DIR/issue-90528-unsizing-suggestion-3.rs:18:17 + | +LL | wants_write(&[0u8]); + | ----------- ^^^^^^ the trait `Write` is not implemented for `&[u8; 1]` + | | + | required by a bound introduced by this call + | + = help: the trait `Write` is implemented for `&mut [u8]` +note: required by a bound in `wants_write` + --> $DIR/issue-90528-unsizing-suggestion-3.rs:10:24 + | +LL | fn wants_write(_: impl Write) {} + | ^^^^^ required by this bound in `wants_write` + +error[E0277]: the trait bound `&[u8]: Write` is not satisfied + --> $DIR/issue-90528-unsizing-suggestion-3.rs:20:17 + | +LL | wants_write(&[0u8][..]); + | ----------- ^^^^^^^^^^ the trait `Write` is not implemented for `&[u8]` + | | + | required by a bound introduced by this call + | + = help: the trait `Write` is implemented for `&mut [u8]` +note: required by a bound in `wants_write` + --> $DIR/issue-90528-unsizing-suggestion-3.rs:10:24 + | +LL | fn wants_write(_: impl Write) {} + | ^^^^^ required by this bound in `wants_write` +help: consider changing this borrow's mutability + | +LL | wants_write(&mut [0u8][..]); + | ~~~~ + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/dst/issue-90528-unsizing-suggestion-4.rs b/tests/ui/dst/issue-90528-unsizing-suggestion-4.rs new file mode 100644 index 000000000..eae953c61 --- /dev/null +++ b/tests/ui/dst/issue-90528-unsizing-suggestion-4.rs @@ -0,0 +1,26 @@ +// Issue #90528: provide helpful suggestions when a trait bound is unsatisfied +// due to a missed unsizing coercion. +// +// This test exercises array variables and a trait implemented on mutable slices. + +trait Write {} + +impl Write for &mut [u8] {} + +fn wants_write(_: impl Write) {} + +fn main() { + let mut x = [0u8]; + wants_write(x); + //~^ ERROR the trait bound `[u8; 1]: Write` is not satisfied + wants_write(&mut x); + //~^ ERROR the trait bound `&mut [u8; 1]: Write` is not satisfied + wants_write(&mut x[..]); + + let x = &mut [0u8]; + wants_write(x); + //~^ ERROR the trait bound `&mut [u8; 1]: Write` is not satisfied + wants_write(*x); + //~^ ERROR the trait bound `[u8; 1]: Write` is not satisfied + wants_write(&mut x[..]); +} diff --git a/tests/ui/dst/issue-90528-unsizing-suggestion-4.stderr b/tests/ui/dst/issue-90528-unsizing-suggestion-4.stderr new file mode 100644 index 000000000..a4020ee07 --- /dev/null +++ b/tests/ui/dst/issue-90528-unsizing-suggestion-4.stderr @@ -0,0 +1,79 @@ +error[E0277]: the trait bound `[u8; 1]: Write` is not satisfied + --> $DIR/issue-90528-unsizing-suggestion-4.rs:14:17 + | +LL | wants_write(x); + | ----------- ^ the trait `Write` is not implemented for `[u8; 1]` + | | + | required by a bound introduced by this call + | + = help: the trait `Write` is implemented for `&mut [u8]` +note: required by a bound in `wants_write` + --> $DIR/issue-90528-unsizing-suggestion-4.rs:10:24 + | +LL | fn wants_write(_: impl Write) {} + | ^^^^^ required by this bound in `wants_write` +help: convert the array to a `&mut [u8]` slice instead + | +LL | wants_write(&mut x[..]); + | ++++ ++++ + +error[E0277]: the trait bound `&mut [u8; 1]: Write` is not satisfied + --> $DIR/issue-90528-unsizing-suggestion-4.rs:16:17 + | +LL | wants_write(&mut x); + | ----------- ^^^^^^ the trait `Write` is not implemented for `&mut [u8; 1]` + | | + | required by a bound introduced by this call + | + = help: the trait `Write` is implemented for `&mut [u8]` +note: required by a bound in `wants_write` + --> $DIR/issue-90528-unsizing-suggestion-4.rs:10:24 + | +LL | fn wants_write(_: impl Write) {} + | ^^^^^ required by this bound in `wants_write` +help: convert the array to a `&mut [u8]` slice instead + | +LL | wants_write(&mut x[..]); + | ++++ + +error[E0277]: the trait bound `&mut [u8; 1]: Write` is not satisfied + --> $DIR/issue-90528-unsizing-suggestion-4.rs:21:17 + | +LL | wants_write(x); + | ----------- ^ the trait `Write` is not implemented for `&mut [u8; 1]` + | | + | required by a bound introduced by this call + | + = help: the trait `Write` is implemented for `&mut [u8]` +note: required by a bound in `wants_write` + --> $DIR/issue-90528-unsizing-suggestion-4.rs:10:24 + | +LL | fn wants_write(_: impl Write) {} + | ^^^^^ required by this bound in `wants_write` +help: convert the array to a `&mut [u8]` slice instead + | +LL | wants_write(&mut x[..]); + | ++++ ++++ + +error[E0277]: the trait bound `[u8; 1]: Write` is not satisfied + --> $DIR/issue-90528-unsizing-suggestion-4.rs:23:17 + | +LL | wants_write(*x); + | ----------- ^^ the trait `Write` is not implemented for `[u8; 1]` + | | + | required by a bound introduced by this call + | + = help: the trait `Write` is implemented for `&mut [u8]` +note: required by a bound in `wants_write` + --> $DIR/issue-90528-unsizing-suggestion-4.rs:10:24 + | +LL | fn wants_write(_: impl Write) {} + | ^^^^^ required by this bound in `wants_write` +help: convert the array to a `&mut [u8]` slice instead + | +LL | wants_write(&mut *x[..]); + | ++++ ++++ + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/dyn-star/align.normal.stderr b/tests/ui/dyn-star/align.normal.stderr index 53c2cbeac..42fa4fd6f 100644 --- a/tests/ui/dyn-star/align.normal.stderr +++ b/tests/ui/dyn-star/align.normal.stderr @@ -1,5 +1,5 @@ warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/align.rs:4:12 + --> $DIR/align.rs:3:12 | LL | #![feature(dyn_star)] | ^^^^^^^^ @@ -7,5 +7,14 @@ LL | #![feature(dyn_star)] = note: see issue #102425 for more information = note: `#[warn(incomplete_features)]` on by default -warning: 1 warning emitted +error[E0277]: `AlignedUsize` needs to have the same ABI as a pointer + --> $DIR/align.rs:14:13 + | +LL | let x = AlignedUsize(12) as dyn* Debug; + | ^^^^^^^^^^^^^^^^ `AlignedUsize` needs to be a pointer-like type + | + = help: the trait `PointerLike` is not implemented for `AlignedUsize` + +error: aborting due to previous error; 1 warning emitted +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/dyn-star/align.over_aligned.stderr b/tests/ui/dyn-star/align.over_aligned.stderr index 0365d87a6..42fa4fd6f 100644 --- a/tests/ui/dyn-star/align.over_aligned.stderr +++ b/tests/ui/dyn-star/align.over_aligned.stderr @@ -1,5 +1,5 @@ warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/align.rs:4:12 + --> $DIR/align.rs:3:12 | LL | #![feature(dyn_star)] | ^^^^^^^^ @@ -7,8 +7,8 @@ LL | #![feature(dyn_star)] = note: see issue #102425 for more information = note: `#[warn(incomplete_features)]` on by default -error[E0277]: `AlignedUsize` needs to have the same alignment and size as a pointer - --> $DIR/align.rs:15:13 +error[E0277]: `AlignedUsize` needs to have the same ABI as a pointer + --> $DIR/align.rs:14:13 | LL | let x = AlignedUsize(12) as dyn* Debug; | ^^^^^^^^^^^^^^^^ `AlignedUsize` needs to be a pointer-like type diff --git a/tests/ui/dyn-star/align.rs b/tests/ui/dyn-star/align.rs index 6679997a9..79cbaba0c 100644 --- a/tests/ui/dyn-star/align.rs +++ b/tests/ui/dyn-star/align.rs @@ -1,5 +1,4 @@ // revisions: normal over_aligned -//[normal] check-pass #![feature(dyn_star)] //~^ WARN the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes @@ -13,5 +12,5 @@ struct AlignedUsize(usize); fn main() { let x = AlignedUsize(12) as dyn* Debug; - //[over_aligned]~^ ERROR `AlignedUsize` needs to have the same alignment and size as a pointer + //~^ ERROR `AlignedUsize` needs to have the same ABI as a pointer } diff --git a/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.rs b/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.rs index 85749aa7b..913c2faac 100644 --- a/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.rs +++ b/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.rs @@ -9,7 +9,7 @@ fn dyn_debug(_: (dyn* Debug + '_)) { fn polymorphic(t: &T) { dyn_debug(t); - //~^ ERROR `&T` needs to have the same alignment and size as a pointer + //~^ ERROR `&T` needs to have the same ABI as a pointer } fn main() {} diff --git a/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.stderr b/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.stderr index 350630f79..8726fae79 100644 --- a/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.stderr +++ b/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.stderr @@ -1,4 +1,4 @@ -error[E0277]: `&T` needs to have the same alignment and size as a pointer +error[E0277]: `&T` needs to have the same ABI as a pointer --> $DIR/check-size-at-cast-polymorphic-bad.rs:11:15 | LL | dyn_debug(t); diff --git a/tests/ui/dyn-star/check-size-at-cast.rs b/tests/ui/dyn-star/check-size-at-cast.rs index 17bc4f303..e15e090b5 100644 --- a/tests/ui/dyn-star/check-size-at-cast.rs +++ b/tests/ui/dyn-star/check-size-at-cast.rs @@ -5,6 +5,6 @@ use std::fmt::Debug; fn main() { let i = [1, 2, 3, 4] as dyn* Debug; - //~^ ERROR `[i32; 4]` needs to have the same alignment and size as a pointer + //~^ ERROR `[i32; 4]` needs to have the same ABI as a pointer dbg!(i); } diff --git a/tests/ui/dyn-star/check-size-at-cast.stderr b/tests/ui/dyn-star/check-size-at-cast.stderr index 19700b406..e60b5c56f 100644 --- a/tests/ui/dyn-star/check-size-at-cast.stderr +++ b/tests/ui/dyn-star/check-size-at-cast.stderr @@ -1,4 +1,4 @@ -error[E0277]: `[i32; 4]` needs to have the same alignment and size as a pointer +error[E0277]: `[i32; 4]` needs to have the same ABI as a pointer --> $DIR/check-size-at-cast.rs:7:13 | LL | let i = [1, 2, 3, 4] as dyn* Debug; diff --git a/tests/ui/dyn-star/const-and-static.rs b/tests/ui/dyn-star/const-and-static.rs new file mode 100644 index 000000000..551b072ab --- /dev/null +++ b/tests/ui/dyn-star/const-and-static.rs @@ -0,0 +1,10 @@ +// check-pass + +#![feature(dyn_star)] +//~^ WARN the feature `dyn_star` is incomplete + +const C: dyn* Send + Sync = &(); + +static S: dyn* Send + Sync = &(); + +fn main() {} diff --git a/tests/ui/dyn-star/const-and-static.stderr b/tests/ui/dyn-star/const-and-static.stderr new file mode 100644 index 000000000..df8f42fb0 --- /dev/null +++ b/tests/ui/dyn-star/const-and-static.stderr @@ -0,0 +1,11 @@ +warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/const-and-static.rs:3:12 + | +LL | #![feature(dyn_star)] + | ^^^^^^^^ + | + = note: see issue #102425 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/dyn-star/feature-gate-dyn_star.rs b/tests/ui/dyn-star/feature-gate-dyn_star.rs index 4756661cf..41eed71cd 100644 --- a/tests/ui/dyn-star/feature-gate-dyn_star.rs +++ b/tests/ui/dyn-star/feature-gate-dyn_star.rs @@ -3,7 +3,7 @@ /// dyn* is not necessarily the final surface syntax (if we have one at all), /// but for now we will support it to aid in writing tests independently. pub fn dyn_star_parameter(_: &dyn* Send) { - //~^ dyn* trait objects are unstable + //~^ `dyn*` trait objects are experimental } fn main() {} diff --git a/tests/ui/dyn-star/feature-gate-dyn_star.stderr b/tests/ui/dyn-star/feature-gate-dyn_star.stderr index c3449b627..342e71c3a 100644 --- a/tests/ui/dyn-star/feature-gate-dyn_star.stderr +++ b/tests/ui/dyn-star/feature-gate-dyn_star.stderr @@ -1,8 +1,8 @@ -error[E0658]: dyn* trait objects are unstable +error[E0658]: `dyn*` trait objects are experimental --> $DIR/feature-gate-dyn_star.rs:5:31 | LL | pub fn dyn_star_parameter(_: &dyn* Send) { - | ^^^^^^^^^ + | ^^^^ | = note: see issue #102425 for more information = help: add `#![feature(dyn_star)]` to the crate attributes to enable diff --git a/tests/ui/dyn-star/gated-span.rs b/tests/ui/dyn-star/gated-span.rs new file mode 100644 index 000000000..a747987bd --- /dev/null +++ b/tests/ui/dyn-star/gated-span.rs @@ -0,0 +1,8 @@ +macro_rules! t { + ($t:ty) => {} +} + +t!(dyn* Send); +//~^ ERROR `dyn*` trait objects are experimental + +fn main() {} diff --git a/tests/ui/dyn-star/gated-span.stderr b/tests/ui/dyn-star/gated-span.stderr new file mode 100644 index 000000000..626b6cd1b --- /dev/null +++ b/tests/ui/dyn-star/gated-span.stderr @@ -0,0 +1,12 @@ +error[E0658]: `dyn*` trait objects are experimental + --> $DIR/gated-span.rs:5:4 + | +LL | t!(dyn* Send); + | ^^^^ + | + = note: see issue #102425 for more information + = help: add `#![feature(dyn_star)]` to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/dyn-star/no-explicit-dyn-star-cast.rs b/tests/ui/dyn-star/no-explicit-dyn-star-cast.rs index 67240c8e8..2d28f516a 100644 --- a/tests/ui/dyn-star/no-explicit-dyn-star-cast.rs +++ b/tests/ui/dyn-star/no-explicit-dyn-star-cast.rs @@ -4,8 +4,8 @@ fn make_dyn_star() { let i = 42usize; let dyn_i: dyn* Debug = i as dyn* Debug; //~^ ERROR casting `usize` as `dyn* Debug` is invalid - //~| ERROR dyn* trait objects are unstable - //~| ERROR dyn* trait objects are unstable + //~| ERROR `dyn*` trait objects are experimental + //~| ERROR `dyn*` trait objects are experimental } fn main() { diff --git a/tests/ui/dyn-star/no-explicit-dyn-star-cast.stderr b/tests/ui/dyn-star/no-explicit-dyn-star-cast.stderr index eb9c93305..78af9c7a3 100644 --- a/tests/ui/dyn-star/no-explicit-dyn-star-cast.stderr +++ b/tests/ui/dyn-star/no-explicit-dyn-star-cast.stderr @@ -1,17 +1,17 @@ -error[E0658]: dyn* trait objects are unstable +error[E0658]: `dyn*` trait objects are experimental --> $DIR/no-explicit-dyn-star-cast.rs:5:16 | LL | let dyn_i: dyn* Debug = i as dyn* Debug; - | ^^^^^^^^^^ + | ^^^^ | = note: see issue #102425 for more information = help: add `#![feature(dyn_star)]` to the crate attributes to enable -error[E0658]: dyn* trait objects are unstable +error[E0658]: `dyn*` trait objects are experimental --> $DIR/no-explicit-dyn-star-cast.rs:5:34 | LL | let dyn_i: dyn* Debug = i as dyn* Debug; - | ^^^^^^^^^^ + | ^^^^ | = note: see issue #102425 for more information = help: add `#![feature(dyn_star)]` to the crate attributes to enable diff --git a/tests/ui/dyn-star/upcast.stderr b/tests/ui/dyn-star/upcast.stderr index e60144fea..8b34c7f8b 100644 --- a/tests/ui/dyn-star/upcast.stderr +++ b/tests/ui/dyn-star/upcast.stderr @@ -7,7 +7,7 @@ LL | #![feature(dyn_star, trait_upcasting)] = note: see issue #102425 for more information = note: `#[warn(incomplete_features)]` on by default -error[E0277]: `dyn* Foo` needs to have the same alignment and size as a pointer +error[E0277]: `dyn* Foo` needs to have the same ABI as a pointer --> $DIR/upcast.rs:30:23 | LL | let w: dyn* Bar = w; diff --git a/tests/ui/empty/empty-struct-tuple-pat.stderr b/tests/ui/empty/empty-struct-tuple-pat.stderr index 8d0f75d20..45001c797 100644 --- a/tests/ui/empty/empty-struct-tuple-pat.stderr +++ b/tests/ui/empty/empty-struct-tuple-pat.stderr @@ -46,8 +46,8 @@ LL | XEmpty5(), | help: use the tuple variant pattern syntax instead | -LL | XE::XEmpty5(/* fields */) => (), - | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | XE::XEmpty5() => (), + | ~~~~~~~~~~~~~ help: a unit variant with a similar name exists | LL | XE::XEmpty4 => (), diff --git a/tests/ui/enum-discriminant/auxiliary/discr-foreign-dep.rs b/tests/ui/enum-discriminant/auxiliary/discr-foreign-dep.rs new file mode 100644 index 000000000..a2cc10a4b --- /dev/null +++ b/tests/ui/enum-discriminant/auxiliary/discr-foreign-dep.rs @@ -0,0 +1,7 @@ +#[derive(Default)] +pub enum Foo { + A(u32), + #[default] + B, + C(u32), +} diff --git a/tests/ui/enum-discriminant/discr-foreign.rs b/tests/ui/enum-discriminant/discr-foreign.rs new file mode 100644 index 000000000..e7123b344 --- /dev/null +++ b/tests/ui/enum-discriminant/discr-foreign.rs @@ -0,0 +1,11 @@ +// aux-build:discr-foreign-dep.rs +// build-pass + +extern crate discr_foreign_dep; + +fn main() { + match Default::default() { + discr_foreign_dep::Foo::A(_) => {} + _ => {} + } +} diff --git a/tests/ui/enum-discriminant/issue-104519.rs b/tests/ui/enum-discriminant/issue-104519.rs index c4630f76b..507c0988f 100644 --- a/tests/ui/enum-discriminant/issue-104519.rs +++ b/tests/ui/enum-discriminant/issue-104519.rs @@ -23,14 +23,4 @@ fn some_match(result: OpenResult) -> u8 { fn main() { let result = OpenResult::Ok(()); assert_eq!(some_match(result), 0); - - let result = OpenResult::Ok(()); - match result { - OpenResult::Ok(()) => (), - _ => unreachable!("message a"), - } - match result { - OpenResult::Ok(()) => (), - _ => unreachable!("message b"), - } } diff --git a/tests/ui/enum-discriminant/issue-61696.rs b/tests/ui/enum-discriminant/issue-61696.rs new file mode 100644 index 000000000..8a633a916 --- /dev/null +++ b/tests/ui/enum-discriminant/issue-61696.rs @@ -0,0 +1,77 @@ +// run-pass + +pub enum Infallible {} + +// The check that the `bool` field of `V1` is encoding a "niche variant" +// (i.e. not `V1`, so `V3` or `V4`) used to be mathematically incorrect, +// causing valid `V1` values to be interpreted as other variants. +pub enum E1 { + V1 { f: bool }, + V2 { f: Infallible }, + V3, + V4, +} + +// Computing the discriminant used to be done using the niche type (here `u8`, +// from the `bool` field of `V1`), overflowing for variants with large enough +// indices (`V3` and `V4`), causing them to be interpreted as other variants. +pub enum E2 { + V1 { f: bool }, + + /*_00*/ _01(X), _02(X), _03(X), _04(X), _05(X), _06(X), _07(X), + _08(X), _09(X), _0A(X), _0B(X), _0C(X), _0D(X), _0E(X), _0F(X), + _10(X), _11(X), _12(X), _13(X), _14(X), _15(X), _16(X), _17(X), + _18(X), _19(X), _1A(X), _1B(X), _1C(X), _1D(X), _1E(X), _1F(X), + _20(X), _21(X), _22(X), _23(X), _24(X), _25(X), _26(X), _27(X), + _28(X), _29(X), _2A(X), _2B(X), _2C(X), _2D(X), _2E(X), _2F(X), + _30(X), _31(X), _32(X), _33(X), _34(X), _35(X), _36(X), _37(X), + _38(X), _39(X), _3A(X), _3B(X), _3C(X), _3D(X), _3E(X), _3F(X), + _40(X), _41(X), _42(X), _43(X), _44(X), _45(X), _46(X), _47(X), + _48(X), _49(X), _4A(X), _4B(X), _4C(X), _4D(X), _4E(X), _4F(X), + _50(X), _51(X), _52(X), _53(X), _54(X), _55(X), _56(X), _57(X), + _58(X), _59(X), _5A(X), _5B(X), _5C(X), _5D(X), _5E(X), _5F(X), + _60(X), _61(X), _62(X), _63(X), _64(X), _65(X), _66(X), _67(X), + _68(X), _69(X), _6A(X), _6B(X), _6C(X), _6D(X), _6E(X), _6F(X), + _70(X), _71(X), _72(X), _73(X), _74(X), _75(X), _76(X), _77(X), + _78(X), _79(X), _7A(X), _7B(X), _7C(X), _7D(X), _7E(X), _7F(X), + _80(X), _81(X), _82(X), _83(X), _84(X), _85(X), _86(X), _87(X), + _88(X), _89(X), _8A(X), _8B(X), _8C(X), _8D(X), _8E(X), _8F(X), + _90(X), _91(X), _92(X), _93(X), _94(X), _95(X), _96(X), _97(X), + _98(X), _99(X), _9A(X), _9B(X), _9C(X), _9D(X), _9E(X), _9F(X), + _A0(X), _A1(X), _A2(X), _A3(X), _A4(X), _A5(X), _A6(X), _A7(X), + _A8(X), _A9(X), _AA(X), _AB(X), _AC(X), _AD(X), _AE(X), _AF(X), + _B0(X), _B1(X), _B2(X), _B3(X), _B4(X), _B5(X), _B6(X), _B7(X), + _B8(X), _B9(X), _BA(X), _BB(X), _BC(X), _BD(X), _BE(X), _BF(X), + _C0(X), _C1(X), _C2(X), _C3(X), _C4(X), _C5(X), _C6(X), _C7(X), + _C8(X), _C9(X), _CA(X), _CB(X), _CC(X), _CD(X), _CE(X), _CF(X), + _D0(X), _D1(X), _D2(X), _D3(X), _D4(X), _D5(X), _D6(X), _D7(X), + _D8(X), _D9(X), _DA(X), _DB(X), _DC(X), _DD(X), _DE(X), _DF(X), + _E0(X), _E1(X), _E2(X), _E3(X), _E4(X), _E5(X), _E6(X), _E7(X), + _E8(X), _E9(X), _EA(X), _EB(X), _EC(X), _ED(X), _EE(X), _EF(X), + _F0(X), _F1(X), _F2(X), _F3(X), _F4(X), _F5(X), _F6(X), _F7(X), + _F8(X), _F9(X), _FA(X), _FB(X), _FC(X), _FD(X), _FE(X), _FF(X), + + V3, + V4, +} + +#[inline(never)] +fn match_e1(y: E1) -> u8 { + match y { + E1::V2 { .. } => 1, + _ => 0, + } +} + +#[inline(never)] +fn match_e2(y: E2) -> u8 { + match y { + E2::V1 { .. } => 1, + _ => 0, + } +} + +fn main() { + assert_eq!(match_e1(E1::V1 { f: true }), 0); + assert_eq!(match_e2(E2::V3), 0); +} diff --git a/tests/ui/error-codes/E0004.stderr b/tests/ui/error-codes/E0004.stderr index 4ac8c904f..603bc5237 100644 --- a/tests/ui/error-codes/E0004.stderr +++ b/tests/ui/error-codes/E0004.stderr @@ -14,7 +14,7 @@ LL | HastaLaVistaBaby, = note: the matched value is of type `Terminator` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ Terminator::TalkToMyHand => {} +LL ~ Terminator::TalkToMyHand => {}, LL + Terminator::HastaLaVistaBaby => todo!() | diff --git a/tests/ui/error-codes/E0010-teach.rs b/tests/ui/error-codes/E0010-teach.rs index fc5dffb37..798fcda2a 100644 --- a/tests/ui/error-codes/E0010-teach.rs +++ b/tests/ui/error-codes/E0010-teach.rs @@ -1,8 +1,7 @@ // compile-flags: -Z teach -#![feature(box_syntax)] #![allow(warnings)] -const CON : Box = box 0; //~ ERROR E0010 - +const CON: Vec = vec![1, 2, 3]; //~ ERROR E0010 +//~| ERROR cannot call non-const fn fn main() {} diff --git a/tests/ui/error-codes/E0010-teach.stderr b/tests/ui/error-codes/E0010-teach.stderr index 33de9fd68..7634970f3 100644 --- a/tests/ui/error-codes/E0010-teach.stderr +++ b/tests/ui/error-codes/E0010-teach.stderr @@ -1,11 +1,22 @@ error[E0010]: allocations are not allowed in constants - --> $DIR/E0010-teach.rs:6:24 + --> $DIR/E0010-teach.rs:5:23 | -LL | const CON : Box = box 0; - | ^^^^^ allocation not allowed in constants +LL | const CON: Vec = vec![1, 2, 3]; + | ^^^^^^^^^^^^^ allocation not allowed in constants | = note: The value of statics and constants must be known at compile time, and they live for the entire lifetime of a program. Creating a boxed value allocates memory on the heap at runtime, and therefore cannot be done at compile time. + = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to previous error +error[E0015]: cannot call non-const fn `slice::::into_vec::` in constants + --> $DIR/E0010-teach.rs:5:23 + | +LL | const CON: Vec = vec![1, 2, 3]; + | ^^^^^^^^^^^^^ + | + = note: calls in constants are limited to constant functions, tuple structs and tuple variants + = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0010`. +Some errors have detailed explanations: E0010, E0015. +For more information about an error, try `rustc --explain E0010`. diff --git a/tests/ui/error-codes/E0010.rs b/tests/ui/error-codes/E0010.rs index e62997640..11721efff 100644 --- a/tests/ui/error-codes/E0010.rs +++ b/tests/ui/error-codes/E0010.rs @@ -1,6 +1,5 @@ -#![feature(box_syntax)] #![allow(warnings)] -const CON : Box = box 0; //~ ERROR E0010 - +const CON: Vec = vec![1, 2, 3]; //~ ERROR E0010 +//~| ERROR cannot call non-const fn fn main() {} diff --git a/tests/ui/error-codes/E0010.stderr b/tests/ui/error-codes/E0010.stderr index 0042333b9..089472224 100644 --- a/tests/ui/error-codes/E0010.stderr +++ b/tests/ui/error-codes/E0010.stderr @@ -1,9 +1,21 @@ error[E0010]: allocations are not allowed in constants - --> $DIR/E0010.rs:4:24 + --> $DIR/E0010.rs:3:23 | -LL | const CON : Box = box 0; - | ^^^^^ allocation not allowed in constants +LL | const CON: Vec = vec![1, 2, 3]; + | ^^^^^^^^^^^^^ allocation not allowed in constants + | + = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0015]: cannot call non-const fn `slice::::into_vec::` in constants + --> $DIR/E0010.rs:3:23 + | +LL | const CON: Vec = vec![1, 2, 3]; + | ^^^^^^^^^^^^^ + | + = note: calls in constants are limited to constant functions, tuple structs and tuple variants + = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0010`. +Some errors have detailed explanations: E0010, E0015. +For more information about an error, try `rustc --explain E0010`. diff --git a/tests/ui/error-codes/E0030-teach.rs b/tests/ui/error-codes/E0030-teach.rs index 8caa4f093..388064fb0 100644 --- a/tests/ui/error-codes/E0030-teach.rs +++ b/tests/ui/error-codes/E0030-teach.rs @@ -4,6 +4,5 @@ fn main() { match 5u32 { 1000 ..= 5 => {} //~^ ERROR lower range bound must be less than or equal to upper - //~| ERROR lower range bound must be less than or equal to upper } } diff --git a/tests/ui/error-codes/E0030-teach.stderr b/tests/ui/error-codes/E0030-teach.stderr index 800f66416..3f1ad4af3 100644 --- a/tests/ui/error-codes/E0030-teach.stderr +++ b/tests/ui/error-codes/E0030-teach.stderr @@ -6,12 +6,6 @@ LL | 1000 ..= 5 => {} | = note: When matching against a range, the compiler verifies that the range is non-empty. Range patterns include both end-points, so this is equivalent to requiring the start of the range to be less than or equal to the end of the range. -error[E0030]: lower range bound must be less than or equal to upper - --> $DIR/E0030-teach.rs:5:9 - | -LL | 1000 ..= 5 => {} - | ^^^^ lower bound larger than upper bound - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0030`. diff --git a/tests/ui/error-codes/E0030.rs b/tests/ui/error-codes/E0030.rs index a5d8f8726..58d856b7c 100644 --- a/tests/ui/error-codes/E0030.rs +++ b/tests/ui/error-codes/E0030.rs @@ -2,6 +2,5 @@ fn main() { match 5u32 { 1000 ..= 5 => {} //~^ ERROR lower range bound must be less than or equal to upper - //~| ERROR lower range bound must be less than or equal to upper } } diff --git a/tests/ui/error-codes/E0030.stderr b/tests/ui/error-codes/E0030.stderr index 8a6114024..db8161d8f 100644 --- a/tests/ui/error-codes/E0030.stderr +++ b/tests/ui/error-codes/E0030.stderr @@ -4,12 +4,6 @@ error[E0030]: lower range bound must be less than or equal to upper LL | 1000 ..= 5 => {} | ^^^^ lower bound larger than upper bound -error[E0030]: lower range bound must be less than or equal to upper - --> $DIR/E0030.rs:3:9 - | -LL | 1000 ..= 5 => {} - | ^^^^ lower bound larger than upper bound - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0030`. diff --git a/tests/ui/error-codes/E0184.stderr b/tests/ui/error-codes/E0184.stderr index bb3017b6e..52f1f30a4 100644 --- a/tests/ui/error-codes/E0184.stderr +++ b/tests/ui/error-codes/E0184.stderr @@ -1,4 +1,4 @@ -error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor +error[E0184]: the trait `Copy` cannot be implemented for this type; the type has a destructor --> $DIR/E0184.rs:1:10 | LL | #[derive(Copy)] diff --git a/tests/ui/error-codes/E0206.rs b/tests/ui/error-codes/E0206.rs index 0f3d427ce..74738d810 100644 --- a/tests/ui/error-codes/E0206.rs +++ b/tests/ui/error-codes/E0206.rs @@ -2,7 +2,7 @@ struct Bar; impl Copy for &'static mut Bar { } -//~^ ERROR the trait `Copy` may not be implemented for this type +//~^ ERROR the trait `Copy` cannot be implemented for this type fn main() { } diff --git a/tests/ui/error-codes/E0206.stderr b/tests/ui/error-codes/E0206.stderr index 57ae2647d..60d8d7bfe 100644 --- a/tests/ui/error-codes/E0206.stderr +++ b/tests/ui/error-codes/E0206.stderr @@ -1,4 +1,4 @@ -error[E0206]: the trait `Copy` may not be implemented for this type +error[E0206]: the trait `Copy` cannot be implemented for this type --> $DIR/E0206.rs:4:15 | LL | impl Copy for &'static mut Bar { } diff --git a/tests/ui/error-codes/E0275.stderr b/tests/ui/error-codes/E0275.stderr index cf9a7f69b..03c37d6f0 100644 --- a/tests/ui/error-codes/E0275.stderr +++ b/tests/ui/error-codes/E0275.stderr @@ -11,7 +11,7 @@ note: required for `Bar Foo for T where Bar: Foo {} | ^^^ ^ --- unsatisfied trait bound introduced here = note: the full type name has been written to '$TEST_BUILD_DIR/error-codes/E0275/E0275.long-type-hash.txt' - = note: 127 redundant requirements hidden + = note: 126 redundant requirements hidden = note: required for `Bar` to implement `Foo` error: aborting due to previous error diff --git a/tests/ui/error-codes/E0277-3.stderr b/tests/ui/error-codes/E0277-3.stderr index 0127e1ccc..0d4782935 100644 --- a/tests/ui/error-codes/E0277-3.stderr +++ b/tests/ui/error-codes/E0277-3.stderr @@ -14,7 +14,8 @@ LL | fn foo(_: T) {} | ^^^^^^^^^ required by this bound in `foo` help: consider annotating `S` with `#[derive(PartialEq)]` | -LL | #[derive(PartialEq)] +LL + #[derive(PartialEq)] +LL | struct S; | error: aborting due to previous error diff --git a/tests/ui/error-codes/E0449.stderr b/tests/ui/error-codes/E0449.stderr index 8221a5e0a..cf41bcce8 100644 --- a/tests/ui/error-codes/E0449.stderr +++ b/tests/ui/error-codes/E0449.stderr @@ -1,22 +1,26 @@ -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/E0449.rs:7:1 | LL | pub impl Bar {} - | ^^^ `pub` not permitted here because it's implied + | ^^^ | = note: place qualifiers on individual impl items instead -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/E0449.rs:9:1 | LL | pub impl Foo for Bar { - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/E0449.rs:10:5 | LL | pub fn foo() {} - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait error: aborting due to 3 previous errors diff --git a/tests/ui/exclusive-drop-and-copy.rs b/tests/ui/exclusive-drop-and-copy.rs index 7a251671e..210ecaed7 100644 --- a/tests/ui/exclusive-drop-and-copy.rs +++ b/tests/ui/exclusive-drop-and-copy.rs @@ -1,13 +1,13 @@ // issue #20126 -#[derive(Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented +#[derive(Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented struct Foo; impl Drop for Foo { fn drop(&mut self) {} } -#[derive(Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented +#[derive(Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented struct Bar(::std::marker::PhantomData); impl Drop for Bar { diff --git a/tests/ui/exclusive-drop-and-copy.stderr b/tests/ui/exclusive-drop-and-copy.stderr index 8649c8abb..546079422 100644 --- a/tests/ui/exclusive-drop-and-copy.stderr +++ b/tests/ui/exclusive-drop-and-copy.stderr @@ -1,4 +1,4 @@ -error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor +error[E0184]: the trait `Copy` cannot be implemented for this type; the type has a destructor --> $DIR/exclusive-drop-and-copy.rs:3:10 | LL | #[derive(Copy, Clone)] @@ -6,7 +6,7 @@ LL | #[derive(Copy, Clone)] | = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor +error[E0184]: the trait `Copy` cannot be implemented for this type; the type has a destructor --> $DIR/exclusive-drop-and-copy.rs:10:10 | LL | #[derive(Copy, Clone)] diff --git a/tests/ui/expr-block-generic-unique1.rs b/tests/ui/expr-block-generic-unique1.rs deleted file mode 100644 index 14603a2c7..000000000 --- a/tests/ui/expr-block-generic-unique1.rs +++ /dev/null @@ -1,18 +0,0 @@ -// run-pass -#![allow(unused_braces)] - -fn test_generic(expected: Box, eq: F) where T: Clone, F: FnOnce(Box, Box) -> bool { - let actual: Box = { expected.clone() }; - assert!(eq(expected, actual)); -} - -fn test_box() { - fn compare_box(b1: Box, b2: Box) -> bool { - println!("{}", *b1); - println!("{}", *b2); - return *b1 == *b2; - } - test_generic::(Box::new(true), compare_box); -} - -pub fn main() { test_box(); } diff --git a/tests/ui/expr-block-generic-unique2.rs b/tests/ui/expr-block-generic-unique2.rs deleted file mode 100644 index 7879c144b..000000000 --- a/tests/ui/expr-block-generic-unique2.rs +++ /dev/null @@ -1,14 +0,0 @@ -// run-pass -#![allow(unused_braces)] - -fn test_generic(expected: T, eq: F) where T: Clone, F: FnOnce(T, T) -> bool { - let actual: T = { expected.clone() }; - assert!(eq(expected, actual)); -} - -fn test_vec() { - fn compare_vec(v1: Box, v2: Box) -> bool { return v1 == v2; } - test_generic::, _>(Box::new(1), compare_vec); -} - -pub fn main() { test_vec(); } diff --git a/tests/ui/expr-if-unique.rs b/tests/ui/expr-if-unique.rs deleted file mode 100644 index 862326835..000000000 --- a/tests/ui/expr-if-unique.rs +++ /dev/null @@ -1,9 +0,0 @@ -// run-pass - -// Tests for if as expressions returning boxed types -fn test_box() { - let rs: Box<_> = if true { Box::new(100) } else { Box::new(101) }; - assert_eq!(*rs, 100); -} - -pub fn main() { test_box(); } diff --git a/tests/ui/extenv/extenv-no-args.rs b/tests/ui/extenv/extenv-no-args.rs index 9f221ed10..2ff6d242b 100644 --- a/tests/ui/extenv/extenv-no-args.rs +++ b/tests/ui/extenv/extenv-no-args.rs @@ -1 +1 @@ -fn main() { env!(); } //~ ERROR: env! takes 1 or 2 arguments +fn main() { env!(); } //~ ERROR: `env!()` takes 1 or 2 arguments diff --git a/tests/ui/extenv/extenv-no-args.stderr b/tests/ui/extenv/extenv-no-args.stderr index 318ed635b..70b85932c 100644 --- a/tests/ui/extenv/extenv-no-args.stderr +++ b/tests/ui/extenv/extenv-no-args.stderr @@ -1,4 +1,4 @@ -error: env! takes 1 or 2 arguments +error: `env!()` takes 1 or 2 arguments --> $DIR/extenv-no-args.rs:1:13 | LL | fn main() { env!(); } diff --git a/tests/ui/extenv/extenv-too-many-args.rs b/tests/ui/extenv/extenv-too-many-args.rs index 1adbee583..ffad1c513 100644 --- a/tests/ui/extenv/extenv-too-many-args.rs +++ b/tests/ui/extenv/extenv-too-many-args.rs @@ -1 +1 @@ -fn main() { env!("one", "two", "three"); } //~ ERROR: env! takes 1 or 2 arguments +fn main() { env!("one", "two", "three"); } //~ ERROR: `env!()` takes 1 or 2 arguments diff --git a/tests/ui/extenv/extenv-too-many-args.stderr b/tests/ui/extenv/extenv-too-many-args.stderr index 54150a332..47cf810b7 100644 --- a/tests/ui/extenv/extenv-too-many-args.stderr +++ b/tests/ui/extenv/extenv-too-many-args.stderr @@ -1,4 +1,4 @@ -error: env! takes 1 or 2 arguments +error: `env!()` takes 1 or 2 arguments --> $DIR/extenv-too-many-args.rs:1:13 | LL | fn main() { env!("one", "two", "three"); } diff --git a/tests/ui/extenv/issue-55897.stderr b/tests/ui/extenv/issue-55897.stderr index 5752a965e..401db8278 100644 --- a/tests/ui/extenv/issue-55897.stderr +++ b/tests/ui/extenv/issue-55897.stderr @@ -4,7 +4,7 @@ error: environment variable `NON_EXISTENT` not defined at compile time LL | include!(concat!(env!("NON_EXISTENT"), "/data.rs")); | ^^^^^^^^^^^^^^^^^^^^ | - = help: Use `std::env::var("NON_EXISTENT")` to read the variable at run time + = help: use `std::env::var("NON_EXISTENT")` to read the variable at run time = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info) error: suffixes on string literals are invalid diff --git a/tests/ui/extern-mod-syntax.rs b/tests/ui/extern-mod-syntax.rs new file mode 100644 index 000000000..65dfa6a0f --- /dev/null +++ b/tests/ui/extern-mod-syntax.rs @@ -0,0 +1,11 @@ +// run-pass + +#![allow(unused_imports)] +#![no_std] + +extern crate std; +use std::ffi::c_void; + +pub fn main() { + std::println!("Hello world!"); +} diff --git a/tests/ui/feature-gates/feature-gate-box-expr.rs b/tests/ui/feature-gates/feature-gate-box-expr.rs deleted file mode 100644 index 870253d2f..000000000 --- a/tests/ui/feature-gates/feature-gate-box-expr.rs +++ /dev/null @@ -1,14 +0,0 @@ -// gate-test-box_syntax - -// Check that `box EXPR` is feature-gated. -// -// See also feature-gate-placement-expr.rs -// -// (Note that the two tests are separated since the checks appear to -// be performed at distinct phases, with an abort_if_errors call -// separating them.) - -fn main() { - let x = box 'c'; //~ ERROR box expression syntax is experimental - println!("x: {}", x); -} diff --git a/tests/ui/feature-gates/feature-gate-box-expr.stderr b/tests/ui/feature-gates/feature-gate-box-expr.stderr deleted file mode 100644 index af864b25f..000000000 --- a/tests/ui/feature-gates/feature-gate-box-expr.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: box expression syntax is experimental; you can call `Box::new` instead - --> $DIR/feature-gate-box-expr.rs:12:13 - | -LL | let x = box 'c'; - | ^^^^^^^ - | - = note: see issue #49733 for more information - = help: add `#![feature(box_syntax)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-box_syntax.rs b/tests/ui/feature-gates/feature-gate-box_syntax.rs deleted file mode 100644 index 778660cc0..000000000 --- a/tests/ui/feature-gates/feature-gate-box_syntax.rs +++ /dev/null @@ -1,6 +0,0 @@ -// Test that the use of the box syntax is gated by `box_syntax` feature gate. - -fn main() { - let x = box 3; - //~^ ERROR box expression syntax is experimental; you can call `Box::new` instead -} diff --git a/tests/ui/feature-gates/feature-gate-box_syntax.stderr b/tests/ui/feature-gates/feature-gate-box_syntax.stderr deleted file mode 100644 index dcf8eeed7..000000000 --- a/tests/ui/feature-gates/feature-gate-box_syntax.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: box expression syntax is experimental; you can call `Box::new` instead - --> $DIR/feature-gate-box_syntax.rs:4:13 - | -LL | let x = box 3; - | ^^^^^ - | - = note: see issue #49733 for more information - = help: add `#![feature(box_syntax)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-closure_track_caller.rs b/tests/ui/feature-gates/feature-gate-closure_track_caller.rs index a8d63a814..a4c91f3bc 100644 --- a/tests/ui/feature-gates/feature-gate-closure_track_caller.rs +++ b/tests/ui/feature-gates/feature-gate-closure_track_caller.rs @@ -1,7 +1,9 @@ +// edition:2021 #![feature(stmt_expr_attributes)] #![feature(generators)] fn main() { let _closure = #[track_caller] || {}; //~ `#[track_caller]` on closures let _generator = #[track_caller] || { yield; }; //~ `#[track_caller]` on closures + let _future = #[track_caller] async {}; //~ `#[track_caller]` on closures } diff --git a/tests/ui/feature-gates/feature-gate-closure_track_caller.stderr b/tests/ui/feature-gates/feature-gate-closure_track_caller.stderr index ed63d74fe..cf2ea5fe1 100644 --- a/tests/ui/feature-gates/feature-gate-closure_track_caller.stderr +++ b/tests/ui/feature-gates/feature-gate-closure_track_caller.stderr @@ -1,5 +1,5 @@ error[E0658]: `#[track_caller]` on closures is currently unstable - --> $DIR/feature-gate-closure_track_caller.rs:5:20 + --> $DIR/feature-gate-closure_track_caller.rs:6:20 | LL | let _closure = #[track_caller] || {}; | ^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | let _closure = #[track_caller] || {}; = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable error[E0658]: `#[track_caller]` on closures is currently unstable - --> $DIR/feature-gate-closure_track_caller.rs:6:22 + --> $DIR/feature-gate-closure_track_caller.rs:7:22 | LL | let _generator = #[track_caller] || { yield; }; | ^^^^^^^^^^^^^^^ @@ -16,6 +16,15 @@ LL | let _generator = #[track_caller] || { yield; }; = note: see issue #87417 for more information = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable -error: aborting due to 2 previous errors +error[E0658]: `#[track_caller]` on closures is currently unstable + --> $DIR/feature-gate-closure_track_caller.rs:8:19 + | +LL | let _future = #[track_caller] async {}; + | ^^^^^^^^^^^^^^^ + | + = note: see issue #87417 for more information + = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.rs b/tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.rs new file mode 100644 index 000000000..de0487cdb --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.rs @@ -0,0 +1,18 @@ +trait Foo { + type Bar; +} + +impl Foo for () { + type Bar = impl std::fmt::Debug; + //~^ ERROR: `impl Trait` in associated types is unstable +} + +struct Mop; + +impl Mop { + type Bop = impl std::fmt::Debug; + //~^ ERROR: `impl Trait` in associated types is unstable + //~| ERROR: inherent associated types are unstable +} + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.stderr b/tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.stderr new file mode 100644 index 000000000..9a1ded968 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.stderr @@ -0,0 +1,30 @@ +error[E0658]: `impl Trait` in associated types is unstable + --> $DIR/feature-gate-impl_trait_in_assoc_type.rs:6:16 + | +LL | type Bar = impl std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #63063 for more information + = help: add `#![feature(impl_trait_in_assoc_type)]` to the crate attributes to enable + +error[E0658]: `impl Trait` in associated types is unstable + --> $DIR/feature-gate-impl_trait_in_assoc_type.rs:13:16 + | +LL | type Bop = impl std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #63063 for more information + = help: add `#![feature(impl_trait_in_assoc_type)]` to the crate attributes to enable + +error[E0658]: inherent associated types are unstable + --> $DIR/feature-gate-impl_trait_in_assoc_type.rs:13:5 + | +LL | type Bop = impl std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #8995 for more information + = help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-link_cfg.stderr b/tests/ui/feature-gates/feature-gate-link_cfg.stderr index 8f47d5965..97b6cbca4 100644 --- a/tests/ui/feature-gates/feature-gate-link_cfg.stderr +++ b/tests/ui/feature-gates/feature-gate-link_cfg.stderr @@ -4,7 +4,6 @@ error[E0658]: link cfg is unstable LL | #[link(name = "foo", cfg(foo))] | ^^^^^^^^ | - = note: see issue #37406 for more information = help: add `#![feature(link_cfg)]` to the crate attributes to enable error: aborting due to previous error diff --git a/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr b/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr index 4d79ce3c6..fb39c404c 100644 --- a/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr +++ b/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr @@ -115,7 +115,7 @@ LL | A, B, C, = note: the matched value is of type `Foo` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ Foo::B => {} +LL ~ Foo::B => {}, LL + Foo::C => todo!() | diff --git a/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr b/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr index b55106833..853b57052 100644 --- a/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr +++ b/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr @@ -9,7 +9,7 @@ LL | match 0usize { = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ 0..=usize::MAX => {} +LL ~ 0..=usize::MAX => {}, LL + _ => todo!() | @@ -24,7 +24,7 @@ LL | match 0isize { = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ isize::MIN..=isize::MAX => {} +LL ~ isize::MIN..=isize::MAX => {}, LL + _ => todo!() | diff --git a/tests/ui/feature-gates/feature-gate-return_type_notation.cfg.stderr b/tests/ui/feature-gates/feature-gate-return_type_notation.cfg.stderr new file mode 100644 index 000000000..c3a371e25 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-return_type_notation.cfg.stderr @@ -0,0 +1,36 @@ +error[E0658]: return type notation is experimental + --> $DIR/feature-gate-return_type_notation.rs:15:17 + | +LL | fn foo>() {} + | ^^^^^^^^^ + | + = note: see issue #109417 for more information + = help: add `#![feature(return_type_notation)]` to the crate attributes to enable + +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/feature-gate-return_type_notation.rs:7:12 + | +LL | #![feature(async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +error: parenthesized generic arguments cannot be used in associated type constraints + --> $DIR/feature-gate-return_type_notation.rs:15:17 + | +LL | fn foo>() {} + | ^-- + | | + | help: remove these parentheses + +error[E0220]: associated type `m` not found for `Trait` + --> $DIR/feature-gate-return_type_notation.rs:15:17 + | +LL | fn foo>() {} + | ^ associated type `m` not found + +error: aborting due to 3 previous errors; 1 warning emitted + +Some errors have detailed explanations: E0220, E0658. +For more information about an error, try `rustc --explain E0220`. diff --git a/tests/ui/feature-gates/feature-gate-return_type_notation.no.stderr b/tests/ui/feature-gates/feature-gate-return_type_notation.no.stderr new file mode 100644 index 000000000..52c90c156 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-return_type_notation.no.stderr @@ -0,0 +1,22 @@ +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/feature-gate-return_type_notation.rs:7:12 + | +LL | #![feature(async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: return type notation is experimental + --> $DIR/feature-gate-return_type_notation.rs:15:17 + | +LL | fn foo>() {} + | ^^^^^^^^^ + | + = note: see issue #109417 for more information + = help: add `#![feature(return_type_notation)]` to the crate attributes to enable + = warning: unstable syntax can change at any point in the future, causing a hard error! + = note: for more information, see issue #65860 + +warning: 2 warnings emitted + diff --git a/tests/ui/feature-gates/feature-gate-return_type_notation.rs b/tests/ui/feature-gates/feature-gate-return_type_notation.rs new file mode 100644 index 000000000..5028b9ec9 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-return_type_notation.rs @@ -0,0 +1,22 @@ +// edition: 2021 +// revisions: cfg no + +//[no] check-pass +// Since we're not adding new syntax, `cfg`'d out RTN must pass. + +#![feature(async_fn_in_trait)] +//~^ WARN the feature `async_fn_in_trait` is incomplete + +trait Trait { + async fn m(); +} + +#[cfg(cfg)] +fn foo>() {} +//[cfg]~^ ERROR return type notation is experimental +//[cfg]~| ERROR parenthesized generic arguments cannot be used in associated type constraints +//[cfg]~| ERROR associated type `m` not found for `Trait` +//[no]~^^^^ WARN return type notation is experimental +//[no]~| WARN unstable syntax can change at any point in the future, causing a hard error! + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr index f647380ef..b1613f638 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr @@ -64,6 +64,12 @@ error[E0229]: associated type bindings are not allowed here | LL | impl FnOnce() for Foo1 { | ^^^^^^^^ associated type not allowed here + | +help: parenthesized trait syntax expands to `FnOnce<(), Output=()>` + --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:16:6 + | +LL | impl FnOnce() for Foo1 { + | ^^^^^^^^ error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:23:6 diff --git a/tests/ui/feature-gates/test-listing-format-json.rs b/tests/ui/feature-gates/test-listing-format-json.rs new file mode 100644 index 000000000..2dd0e10b5 --- /dev/null +++ b/tests/ui/feature-gates/test-listing-format-json.rs @@ -0,0 +1,18 @@ +// no-prefer-dynamic +// compile-flags: --test +// run-flags: --list --format json -Zunstable-options +// run-fail +// check-run-results +// ignore-nightly +// unset-exec-env:RUSTC_BOOTSTRAP + +#![cfg(test)] +#[test] +fn m_test() {} + +#[test] +#[ignore = "not yet implemented"] +fn z_test() {} + +#[test] +fn a_test() {} diff --git a/tests/ui/feature-gates/test-listing-format-json.run.stderr b/tests/ui/feature-gates/test-listing-format-json.run.stderr new file mode 100644 index 000000000..e81cb81f3 --- /dev/null +++ b/tests/ui/feature-gates/test-listing-format-json.run.stderr @@ -0,0 +1 @@ +error: the option `Z` is only accepted on the nightly compiler diff --git a/tests/ui/fmt/auxiliary/format-string-proc-macro.rs b/tests/ui/fmt/auxiliary/format-string-proc-macro.rs index 1b7ef93f4..0c39ade72 100644 --- a/tests/ui/fmt/auxiliary/format-string-proc-macro.rs +++ b/tests/ui/fmt/auxiliary/format-string-proc-macro.rs @@ -28,25 +28,41 @@ pub fn err_with_input_span(input: TokenStream) -> TokenStream { TokenStream::from(TokenTree::Literal(lit)) } +fn build_format(args: impl Into) -> TokenStream { + TokenStream::from_iter([ + TokenTree::from(Ident::new("format", Span::call_site())), + TokenTree::from(Punct::new('!', Spacing::Alone)), + TokenTree::from(Group::new(Delimiter::Parenthesis, args.into())), + ]) +} #[proc_macro] pub fn respan_to_invalid_format_literal(input: TokenStream) -> TokenStream { let mut s = Literal::string("{"); s.set_span(input.into_iter().next().unwrap().span()); - TokenStream::from_iter([ - TokenTree::from(Ident::new("format", Span::call_site())), - TokenTree::from(Punct::new('!', Spacing::Alone)), - TokenTree::from(Group::new(Delimiter::Parenthesis, TokenTree::from(s).into())), - ]) + + build_format(TokenTree::from(s)) } #[proc_macro] pub fn capture_a_with_prepended_space_preserve_span(input: TokenStream) -> TokenStream { let mut s = Literal::string(" {a}"); s.set_span(input.into_iter().next().unwrap().span()); - TokenStream::from_iter([ - TokenTree::from(Ident::new("format", Span::call_site())), - TokenTree::from(Punct::new('!', Spacing::Alone)), - TokenTree::from(Group::new(Delimiter::Parenthesis, TokenTree::from(s).into())), - ]) + + build_format(TokenTree::from(s)) +} + +#[proc_macro] +pub fn format_args_captures(_: TokenStream) -> TokenStream { + r#"{ let x = 5; format!("{x}") }"#.parse().unwrap() +} + +#[proc_macro] +pub fn bad_format_args_captures(_: TokenStream) -> TokenStream { + r#"{ let x = 5; format!(concat!("{x}")) }"#.parse().unwrap() +} + +#[proc_macro] +pub fn identity_pm(input: TokenStream) -> TokenStream { + input } diff --git a/tests/ui/fmt/format-args-argument-span.rs b/tests/ui/fmt/format-args-argument-span.rs new file mode 100644 index 000000000..c7acb08f8 --- /dev/null +++ b/tests/ui/fmt/format-args-argument-span.rs @@ -0,0 +1,22 @@ +// check-compile + +struct DisplayOnly; + +impl std::fmt::Display for DisplayOnly { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + unimplemented!() + } +} + +fn main() { + let x = Some(1); + println!("{x:?} {x} {x:?}"); + //~^ ERROR: `Option<{integer}>` doesn't implement `std::fmt::Display` + println!("{x:?} {x} {x:?}", x = Some(1)); + //~^ ERROR: `Option<{integer}>` doesn't implement `std::fmt::Display` + let x = DisplayOnly; + println!("{x} {x:?} {x}"); + //~^ ERROR: `DisplayOnly` doesn't implement `Debug` + println!("{x} {x:?} {x}", x = DisplayOnly); + //~^ ERROR: `DisplayOnly` doesn't implement `Debug` +} diff --git a/tests/ui/fmt/format-args-argument-span.stderr b/tests/ui/fmt/format-args-argument-span.stderr new file mode 100644 index 000000000..4e2702383 --- /dev/null +++ b/tests/ui/fmt/format-args-argument-span.stderr @@ -0,0 +1,53 @@ +error[E0277]: `Option<{integer}>` doesn't implement `std::fmt::Display` + --> $DIR/format-args-argument-span.rs:13:21 + | +LL | println!("{x:?} {x} {x:?}"); + | ^^^ `Option<{integer}>` cannot be formatted with the default formatter + | + = help: the trait `std::fmt::Display` is not implemented for `Option<{integer}>` + = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: `Option<{integer}>` doesn't implement `std::fmt::Display` + --> $DIR/format-args-argument-span.rs:15:37 + | +LL | println!("{x:?} {x} {x:?}", x = Some(1)); + | ^^^^^^^ `Option<{integer}>` cannot be formatted with the default formatter + | + = help: the trait `std::fmt::Display` is not implemented for `Option<{integer}>` + = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: `DisplayOnly` doesn't implement `Debug` + --> $DIR/format-args-argument-span.rs:18:19 + | +LL | println!("{x} {x:?} {x}"); + | ^^^^^ `DisplayOnly` cannot be formatted using `{:?}` + | + = help: the trait `Debug` is not implemented for `DisplayOnly` + = note: add `#[derive(Debug)]` to `DisplayOnly` or manually `impl Debug for DisplayOnly` + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider annotating `DisplayOnly` with `#[derive(Debug)]` + | +LL + #[derive(Debug)] +LL | struct DisplayOnly; + | + +error[E0277]: `DisplayOnly` doesn't implement `Debug` + --> $DIR/format-args-argument-span.rs:20:35 + | +LL | println!("{x} {x:?} {x}", x = DisplayOnly); + | ^^^^^^^^^^^ `DisplayOnly` cannot be formatted using `{:?}` + | + = help: the trait `Debug` is not implemented for `DisplayOnly` + = note: add `#[derive(Debug)]` to `DisplayOnly` or manually `impl Debug for DisplayOnly` + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider annotating `DisplayOnly` with `#[derive(Debug)]` + | +LL + #[derive(Debug)] +LL | struct DisplayOnly; + | + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/fmt/format-args-capture-first-literal-is-macro.rs b/tests/ui/fmt/format-args-capture-first-literal-is-macro.rs new file mode 100644 index 000000000..bf5c0dcb5 --- /dev/null +++ b/tests/ui/fmt/format-args-capture-first-literal-is-macro.rs @@ -0,0 +1,21 @@ +// aux-build:format-string-proc-macro.rs + +#[macro_use] +extern crate format_string_proc_macro; + +macro_rules! identity_mbe { + ($tt:tt) => { + $tt + //~^ ERROR there is no argument named `a` + }; +} + +fn main() { + let a = 0; + + format!(identity_pm!("{a}")); + //~^ ERROR there is no argument named `a` + format!(identity_mbe!("{a}")); + format!(concat!("{a}")); + //~^ ERROR there is no argument named `a` +} diff --git a/tests/ui/fmt/format-args-capture-first-literal-is-macro.stderr b/tests/ui/fmt/format-args-capture-first-literal-is-macro.stderr new file mode 100644 index 000000000..4cf3afad7 --- /dev/null +++ b/tests/ui/fmt/format-args-capture-first-literal-is-macro.stderr @@ -0,0 +1,30 @@ +error: there is no argument named `a` + --> $DIR/format-args-capture-first-literal-is-macro.rs:16:26 + | +LL | format!(identity_pm!("{a}")); + | ^^^^^ + | + = note: did you intend to capture a variable `a` from the surrounding scope? + = note: to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro + +error: there is no argument named `a` + --> $DIR/format-args-capture-first-literal-is-macro.rs:8:9 + | +LL | $tt + | ^^^ + | + = note: did you intend to capture a variable `a` from the surrounding scope? + = note: to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro + +error: there is no argument named `a` + --> $DIR/format-args-capture-first-literal-is-macro.rs:19:13 + | +LL | format!(concat!("{a}")); + | ^^^^^^^^^^^^^^ + | + = note: did you intend to capture a variable `a` from the surrounding scope? + = note: to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro + = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 3 previous errors + diff --git a/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.rs b/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.rs new file mode 100644 index 000000000..f67edf5e1 --- /dev/null +++ b/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.rs @@ -0,0 +1,8 @@ +// aux-build:format-string-proc-macro.rs + +extern crate format_string_proc_macro; + +fn main() { + format_string_proc_macro::bad_format_args_captures!(); + //~^ ERROR there is no argument named `x` +} diff --git a/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.stderr b/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.stderr new file mode 100644 index 000000000..bb6a14d88 --- /dev/null +++ b/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.stderr @@ -0,0 +1,12 @@ +error: there is no argument named `x` + --> $DIR/format-args-capture-from-pm-first-arg-macro.rs:6:5 + | +LL | format_string_proc_macro::bad_format_args_captures!(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: did you intend to capture a variable `x` from the surrounding scope? + = note: to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro + = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + diff --git a/tests/ui/fmt/format-args-capture-issue-106408.rs b/tests/ui/fmt/format-args-capture-issue-106408.rs new file mode 100644 index 000000000..0fd195416 --- /dev/null +++ b/tests/ui/fmt/format-args-capture-issue-106408.rs @@ -0,0 +1,10 @@ +// check-pass +// aux-build:format-string-proc-macro.rs + +extern crate format_string_proc_macro; + +fn main() { + // While literal macros like `format_args!(concat!())` are not supposed to work with implicit + // captures, it should work if the whole invocation comes from a macro expansion (#106408). + format_string_proc_macro::format_args_captures!(); +} diff --git a/tests/ui/fmt/format-args-capture-macro-hygiene-pass.rs b/tests/ui/fmt/format-args-capture-macro-hygiene-pass.rs new file mode 100644 index 000000000..7553fcc4e --- /dev/null +++ b/tests/ui/fmt/format-args-capture-macro-hygiene-pass.rs @@ -0,0 +1,16 @@ +// run-pass + +macro_rules! format_mbe { + ($tt:tt) => { + { + #[allow(unused_variables)] + let a = 123; + format!($tt) + } + }; +} + +fn main() { + let a = 0; + assert_eq!(format_mbe!("{a}"), "0"); +} diff --git a/tests/ui/fmt/ifmt-bad-arg.stderr b/tests/ui/fmt/ifmt-bad-arg.stderr index d716bbe51..bf18fb315 100644 --- a/tests/ui/fmt/ifmt-bad-arg.stderr +++ b/tests/ui/fmt/ifmt-bad-arg.stderr @@ -300,10 +300,9 @@ error[E0308]: mismatched types --> $DIR/ifmt-bad-arg.rs:78:32 | LL | println!("{} {:.*} {}", 1, 3.2, 4); - | ^^^ - | | - | expected `&usize`, found `&{float}` - | arguments to this function are incorrect + | -- ^^^ expected `&usize`, found `&{float}` + | | + | arguments to this function are incorrect | = note: expected reference `&usize` found reference `&{float}` @@ -315,10 +314,9 @@ error[E0308]: mismatched types --> $DIR/ifmt-bad-arg.rs:81:35 | LL | println!("{} {:07$.*} {}", 1, 3.2, 4); - | ^^^ - | | - | expected `&usize`, found `&{float}` - | arguments to this function are incorrect + | -- ^^^ expected `&usize`, found `&{float}` + | | + | arguments to this function are incorrect | = note: expected reference `&usize` found reference `&{float}` diff --git a/tests/ui/fmt/ifmt-unimpl.stderr b/tests/ui/fmt/ifmt-unimpl.stderr index 3480a2ec8..dc2dee3f3 100644 --- a/tests/ui/fmt/ifmt-unimpl.stderr +++ b/tests/ui/fmt/ifmt-unimpl.stderr @@ -2,7 +2,9 @@ error[E0277]: the trait bound `str: UpperHex` is not satisfied --> $DIR/ifmt-unimpl.rs:2:21 | LL | format!("{:X}", "3"); - | ^^^ the trait `UpperHex` is not implemented for `str` + | ---- ^^^ the trait `UpperHex` is not implemented for `str` + | | + | required by a bound introduced by this call | = help: the following other types implement trait `UpperHex`: &T diff --git a/tests/ui/fmt/respanned-literal-issue-106191.rs b/tests/ui/fmt/respanned-literal-issue-106191.rs index 5a18983a3..44642a10f 100644 --- a/tests/ui/fmt/respanned-literal-issue-106191.rs +++ b/tests/ui/fmt/respanned-literal-issue-106191.rs @@ -1,15 +1,10 @@ // aux-build:format-string-proc-macro.rs -// check-fail -// known-bug: #106191 -// unset-rustc-env:RUST_BACKTRACE -// had to be reverted -// error-pattern:unexpectedly panicked -// failure-status:101 -// dont-check-compiler-stderr extern crate format_string_proc_macro; fn main() { format_string_proc_macro::respan_to_invalid_format_literal!("¡"); + //~^ ERROR invalid format string: expected `'}'` but string was terminated format_args!(r#concat!("¡ {")); + //~^ ERROR invalid format string: expected `'}'` but string was terminated } diff --git a/tests/ui/fmt/respanned-literal-issue-106191.stderr b/tests/ui/fmt/respanned-literal-issue-106191.stderr index 16717f422..73a3af65a 100644 --- a/tests/ui/fmt/respanned-literal-issue-106191.stderr +++ b/tests/ui/fmt/respanned-literal-issue-106191.stderr @@ -1,2 +1,19 @@ - query stack during panic: -end of query stack +error: invalid format string: expected `'}'` but string was terminated + --> $DIR/respanned-literal-issue-106191.rs:6:65 + | +LL | format_string_proc_macro::respan_to_invalid_format_literal!("¡"); + | ^^^ expected `'}'` in format string + | + = note: if you intended to print `{`, you can escape it using `{{` + +error: invalid format string: expected `'}'` but string was terminated + --> $DIR/respanned-literal-issue-106191.rs:8:18 + | +LL | format_args!(r#concat!("¡ {")); + | ^^^^^^^^^^^^^^^^^^^^^^^ expected `'}'` in format string + | + = note: if you intended to print `{`, you can escape it using `{{` + = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 2 previous errors + diff --git a/tests/ui/fn/fn-ptr-trait-int-float-infer-var.rs b/tests/ui/fn/fn-ptr-trait-int-float-infer-var.rs new file mode 100644 index 000000000..eec7da044 --- /dev/null +++ b/tests/ui/fn/fn-ptr-trait-int-float-infer-var.rs @@ -0,0 +1,10 @@ +// check-pass +trait MyCmp { + fn cmp(&self) {} +} +impl MyCmp for f32 {} + +fn main() { + // Ensure that `impl Ord for F` is never considered for int and float infer vars. + 0.0.cmp(); +} diff --git a/tests/ui/fn/fn-ptr-trait.rs b/tests/ui/fn/fn-ptr-trait.rs new file mode 100644 index 000000000..45918ae5b --- /dev/null +++ b/tests/ui/fn/fn-ptr-trait.rs @@ -0,0 +1,9 @@ +#![feature(fn_ptr_trait)] +// check-pass + +use std::marker::FnPtr; + +trait Foo {} +impl Foo for Vec where T: FnPtr {} + +fn main() {} diff --git a/tests/ui/fn/issue-39259.rs b/tests/ui/fn/issue-39259.rs new file mode 100644 index 000000000..5872f1007 --- /dev/null +++ b/tests/ui/fn/issue-39259.rs @@ -0,0 +1,13 @@ +#![feature(fn_traits)] +#![feature(unboxed_closures)] + +struct S; + +impl Fn(u32) -> u32 for S { +//~^ ERROR associated type bindings are not allowed here [E0229] + fn call(&self) -> u32 { + 5 + } +} + +fn main() {} diff --git a/tests/ui/fn/issue-39259.stderr b/tests/ui/fn/issue-39259.stderr new file mode 100644 index 000000000..b656b76bf --- /dev/null +++ b/tests/ui/fn/issue-39259.stderr @@ -0,0 +1,15 @@ +error[E0229]: associated type bindings are not allowed here + --> $DIR/issue-39259.rs:6:17 + | +LL | impl Fn(u32) -> u32 for S { + | ^^^ associated type not allowed here + | +help: parenthesized trait syntax expands to `Fn<(u32,), Output=u32>` + --> $DIR/issue-39259.rs:6:6 + | +LL | impl Fn(u32) -> u32 for S { + | ^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0229`. diff --git a/tests/ui/foreign-unsafe-fn-called.mir.stderr b/tests/ui/foreign-unsafe-fn-called.mir.stderr deleted file mode 100644 index d3cf5d84f..000000000 --- a/tests/ui/foreign-unsafe-fn-called.mir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/foreign-unsafe-fn-called.rs:11:5 - | -LL | test::free(); - | ^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/foreign-unsafe-fn-called.rs b/tests/ui/foreign-unsafe-fn-called.rs deleted file mode 100644 index 67302ea1b..000000000 --- a/tests/ui/foreign-unsafe-fn-called.rs +++ /dev/null @@ -1,14 +0,0 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - -mod test { - extern "C" { - pub fn free(); - } -} - -fn main() { - test::free(); - //[mir]~^ ERROR call to unsafe function is unsafe - //[thir]~^^ ERROR call to unsafe function `test::free` is unsafe -} diff --git a/tests/ui/foreign-unsafe-fn-called.thir.stderr b/tests/ui/foreign-unsafe-fn-called.thir.stderr deleted file mode 100644 index 00ba0f7a6..000000000 --- a/tests/ui/foreign-unsafe-fn-called.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function `test::free` is unsafe and requires unsafe function or block - --> $DIR/foreign-unsafe-fn-called.rs:11:5 - | -LL | test::free(); - | ^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/generator/clone-impl.stderr b/tests/ui/generator/clone-impl.stderr index a92646b19..64eb47c1a 100644 --- a/tests/ui/generator/clone-impl.stderr +++ b/tests/ui/generator/clone-impl.stderr @@ -110,7 +110,8 @@ LL | fn check_copy(_x: &T) {} | ^^^^ required by this bound in `check_copy` help: consider annotating `NonClone` with `#[derive(Copy)]` | -LL | #[derive(Copy)] +LL + #[derive(Copy)] +LL | struct NonClone; | error[E0277]: the trait bound `NonClone: Clone` is not satisfied in `[generator@$DIR/clone-impl.rs:62:25: 62:32]` @@ -134,7 +135,8 @@ LL | fn check_clone(_x: &T) {} | ^^^^^ required by this bound in `check_clone` help: consider annotating `NonClone` with `#[derive(Clone)]` | -LL | #[derive(Clone)] +LL + #[derive(Clone)] +LL | struct NonClone; | error: aborting due to 6 previous errors diff --git a/tests/ui/generator/issue-105084.drop_tracking_mir.stderr b/tests/ui/generator/issue-105084.drop_tracking_mir.stderr index cfc0cf7cd..1cd4c4e4d 100644 --- a/tests/ui/generator/issue-105084.drop_tracking_mir.stderr +++ b/tests/ui/generator/issue-105084.drop_tracking_mir.stderr @@ -1,5 +1,5 @@ error[E0382]: borrow of moved value: `g` - --> $DIR/issue-105084.rs:44:14 + --> $DIR/issue-105084.rs:45:14 | LL | let mut g = || { | ----- move occurs because `g` has type `[generator@$DIR/issue-105084.rs:22:17: 22:19]`, which does not implement the `Copy` trait @@ -23,7 +23,7 @@ LL | let mut h = copy(g.clone()); | ++++++++ error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `[generator@$DIR/issue-105084.rs:22:17: 22:19]` - --> $DIR/issue-105084.rs:38:17 + --> $DIR/issue-105084.rs:39:17 | LL | let mut g = || { | -- within this `[generator@$DIR/issue-105084.rs:22:17: 22:19]` @@ -32,13 +32,13 @@ LL | let mut h = copy(g); | ^^^^ within `[generator@$DIR/issue-105084.rs:22:17: 22:19]`, the trait `Copy` is not implemented for `Box<(i32, ())>` | note: generator does not implement `Copy` as this value is used across a yield - --> $DIR/issue-105084.rs:28:25 + --> $DIR/issue-105084.rs:29:22 | -LL | let t = box (5, yield); - | --------^^^^^- - | | | - | | yield occurs here, with `box (5, yield)` maybe used later - | has type `Box<(i32, ())>` which does not implement `Copy` +LL | Box::new((5, yield)); + | -------------^^^^^-- + | | | + | | yield occurs here, with `Box::new((5, yield))` maybe used later + | has type `Box<(i32, ())>` which does not implement `Copy` note: required by a bound in `copy` --> $DIR/issue-105084.rs:17:12 | diff --git a/tests/ui/generator/issue-105084.rs b/tests/ui/generator/issue-105084.rs index 7c9a97b40..ff9357b76 100644 --- a/tests/ui/generator/issue-105084.rs +++ b/tests/ui/generator/issue-105084.rs @@ -9,7 +9,7 @@ #![feature(generators)] #![feature(generator_clone)] #![feature(generator_trait)] -#![feature(box_syntax)] +#![feature(rustc_attrs, stmt_expr_attributes)] use std::ops::Generator; use std::pin::Pin; @@ -25,7 +25,8 @@ fn main() { // - create a Box that is ignored for trait computations; // - compute fields (and yields); // - assign to `t`. - let t = box (5, yield); + let t = #[rustc_box] + Box::new((5, yield)); drop(t); }; diff --git a/tests/ui/generator/issue-87142.rs b/tests/ui/generator/issue-87142.rs index fc10d04d4..7f670919e 100644 --- a/tests/ui/generator/issue-87142.rs +++ b/tests/ui/generator/issue-87142.rs @@ -4,7 +4,7 @@ // Regression test for #87142 // This test needs the above flags and the "lib" crate type. -#![feature(type_alias_impl_trait, generator_trait, generators)] +#![feature(impl_trait_in_assoc_type, generator_trait, generators)] #![crate_type = "lib"] use std::ops::Generator; diff --git a/tests/ui/generator/non-static-is-unpin.rs b/tests/ui/generator/non-static-is-unpin.rs index 96d0a8e28..17e23f5bc 100644 --- a/tests/ui/generator/non-static-is-unpin.rs +++ b/tests/ui/generator/non-static-is-unpin.rs @@ -1,3 +1,5 @@ +// revisions: current next +//[next] compile-flags: -Ztrait-solver=next // run-pass #![feature(generators, generator_trait)] diff --git a/tests/ui/generator/print/generator-print-verbose-1.drop_tracking.stderr b/tests/ui/generator/print/generator-print-verbose-1.drop_tracking.stderr index 7d0a20169..429b202f6 100644 --- a/tests/ui/generator/print/generator-print-verbose-1.drop_tracking.stderr +++ b/tests/ui/generator/print/generator-print-verbose-1.drop_tracking.stderr @@ -10,7 +10,7 @@ note: generator is not `Send` as this value is used across a yield --> $DIR/generator-print-verbose-1.rs:38:9 | LL | let _non_send_gen = make_non_send_generator(); - | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[749a]::make_non_send_generator::{opaque#0}), [])` which is not `Send` + | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[7d1d]::make_non_send_generator::{opaque#0}), [])` which is not `Send` LL | yield; | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later LL | }; @@ -37,17 +37,17 @@ note: required because it's used within this generator | LL | || { | ^^ -note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [Arc>])` +note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[7d1d]::make_gen2::{opaque#0}), [Arc>])` --> $DIR/generator-print-verbose-1.rs:44:30 | LL | pub fn make_gen2(t: T) -> impl Generator { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required because it appears within the type `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])` +note: required because it appears within the type `Opaque(DefId(0:36 ~ generator_print_verbose_1[7d1d]::make_non_send_generator2::{opaque#0}), [])` --> $DIR/generator-print-verbose-1.rs:50:34 | LL | fn make_non_send_generator2() -> impl Generator>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])`, `()` + = note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[7d1d]::make_non_send_generator2::{opaque#0}), [])`, `()` note: required because it's used within this generator --> $DIR/generator-print-verbose-1.rs:55:20 | diff --git a/tests/ui/generator/print/generator-print-verbose-1.drop_tracking_mir.stderr b/tests/ui/generator/print/generator-print-verbose-1.drop_tracking_mir.stderr index c045b1441..01a30fd2f 100644 --- a/tests/ui/generator/print/generator-print-verbose-1.drop_tracking_mir.stderr +++ b/tests/ui/generator/print/generator-print-verbose-1.drop_tracking_mir.stderr @@ -10,7 +10,7 @@ note: generator is not `Send` as this value is used across a yield --> $DIR/generator-print-verbose-1.rs:38:9 | LL | let _non_send_gen = make_non_send_generator(); - | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[749a]::make_non_send_generator::{opaque#0}), [])` which is not `Send` + | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[7d1d]::make_non_send_generator::{opaque#0}), [])` which is not `Send` LL | yield; | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later note: required by a bound in `require_send` @@ -33,17 +33,17 @@ note: required because it's used within this generator | LL | || { | ^^ -note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [Arc>])` +note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[7d1d]::make_gen2::{opaque#0}), [Arc>])` --> $DIR/generator-print-verbose-1.rs:44:30 | LL | pub fn make_gen2(t: T) -> impl Generator { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required because it appears within the type `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])` +note: required because it appears within the type `Opaque(DefId(0:36 ~ generator_print_verbose_1[7d1d]::make_non_send_generator2::{opaque#0}), [])` --> $DIR/generator-print-verbose-1.rs:50:34 | LL | fn make_non_send_generator2() -> impl Generator>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])` + = note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[7d1d]::make_non_send_generator2::{opaque#0}), [])` note: required because it's used within this generator --> $DIR/generator-print-verbose-1.rs:55:20 | diff --git a/tests/ui/generator/print/generator-print-verbose-1.no_drop_tracking.stderr b/tests/ui/generator/print/generator-print-verbose-1.no_drop_tracking.stderr index 7d0a20169..429b202f6 100644 --- a/tests/ui/generator/print/generator-print-verbose-1.no_drop_tracking.stderr +++ b/tests/ui/generator/print/generator-print-verbose-1.no_drop_tracking.stderr @@ -10,7 +10,7 @@ note: generator is not `Send` as this value is used across a yield --> $DIR/generator-print-verbose-1.rs:38:9 | LL | let _non_send_gen = make_non_send_generator(); - | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[749a]::make_non_send_generator::{opaque#0}), [])` which is not `Send` + | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[7d1d]::make_non_send_generator::{opaque#0}), [])` which is not `Send` LL | yield; | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later LL | }; @@ -37,17 +37,17 @@ note: required because it's used within this generator | LL | || { | ^^ -note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [Arc>])` +note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[7d1d]::make_gen2::{opaque#0}), [Arc>])` --> $DIR/generator-print-verbose-1.rs:44:30 | LL | pub fn make_gen2(t: T) -> impl Generator { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required because it appears within the type `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])` +note: required because it appears within the type `Opaque(DefId(0:36 ~ generator_print_verbose_1[7d1d]::make_non_send_generator2::{opaque#0}), [])` --> $DIR/generator-print-verbose-1.rs:50:34 | LL | fn make_non_send_generator2() -> impl Generator>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])`, `()` + = note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[7d1d]::make_non_send_generator2::{opaque#0}), [])`, `()` note: required because it's used within this generator --> $DIR/generator-print-verbose-1.rs:55:20 | diff --git a/tests/ui/generator/static-not-unpin.current.stderr b/tests/ui/generator/static-not-unpin.current.stderr new file mode 100644 index 000000000..ecd8ca60c --- /dev/null +++ b/tests/ui/generator/static-not-unpin.current.stderr @@ -0,0 +1,19 @@ +error[E0277]: `[static generator@$DIR/static-not-unpin.rs:14:25: 14:34]` cannot be unpinned + --> $DIR/static-not-unpin.rs:17:18 + | +LL | assert_unpin(generator); + | ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `[static generator@$DIR/static-not-unpin.rs:14:25: 14:34]` + | | + | required by a bound introduced by this call + | + = note: consider using the `pin!` macro + consider using `Box::pin` if you need to access the pinned value outside of the current scope +note: required by a bound in `assert_unpin` + --> $DIR/static-not-unpin.rs:10:20 + | +LL | fn assert_unpin(_: T) { + | ^^^^^ required by this bound in `assert_unpin` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/generator/static-not-unpin.next.stderr b/tests/ui/generator/static-not-unpin.next.stderr new file mode 100644 index 000000000..ecd8ca60c --- /dev/null +++ b/tests/ui/generator/static-not-unpin.next.stderr @@ -0,0 +1,19 @@ +error[E0277]: `[static generator@$DIR/static-not-unpin.rs:14:25: 14:34]` cannot be unpinned + --> $DIR/static-not-unpin.rs:17:18 + | +LL | assert_unpin(generator); + | ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `[static generator@$DIR/static-not-unpin.rs:14:25: 14:34]` + | | + | required by a bound introduced by this call + | + = note: consider using the `pin!` macro + consider using `Box::pin` if you need to access the pinned value outside of the current scope +note: required by a bound in `assert_unpin` + --> $DIR/static-not-unpin.rs:10:20 + | +LL | fn assert_unpin(_: T) { + | ^^^^^ required by this bound in `assert_unpin` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/generator/static-not-unpin.rs b/tests/ui/generator/static-not-unpin.rs index cfcb94737..30d3f2918 100644 --- a/tests/ui/generator/static-not-unpin.rs +++ b/tests/ui/generator/static-not-unpin.rs @@ -1,3 +1,6 @@ +// revisions: current next +//[next] compile-flags: -Ztrait-solver=next + #![feature(generators)] // normalize-stderr-test "std::pin::Unpin" -> "std::marker::Unpin" diff --git a/tests/ui/generator/static-not-unpin.stderr b/tests/ui/generator/static-not-unpin.stderr deleted file mode 100644 index e3859595f..000000000 --- a/tests/ui/generator/static-not-unpin.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0277]: `[static generator@$DIR/static-not-unpin.rs:11:25: 11:34]` cannot be unpinned - --> $DIR/static-not-unpin.rs:14:18 - | -LL | assert_unpin(generator); - | ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `[static generator@$DIR/static-not-unpin.rs:11:25: 11:34]` - | | - | required by a bound introduced by this call - | - = note: consider using `Box::pin` -note: required by a bound in `assert_unpin` - --> $DIR/static-not-unpin.rs:7:20 - | -LL | fn assert_unpin(_: T) { - | ^^^^^ required by this bound in `assert_unpin` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/generator/yield-in-box.rs b/tests/ui/generator/yield-in-box.rs deleted file mode 100644 index dd6fa7c15..000000000 --- a/tests/ui/generator/yield-in-box.rs +++ /dev/null @@ -1,24 +0,0 @@ -// run-pass -// Test that box-statements with yields in them work. - -#![feature(generators, box_syntax, generator_trait)] -use std::pin::Pin; -use std::ops::Generator; -use std::ops::GeneratorState; - -fn main() { - let x = 0i32; - || { //~ WARN unused generator that must be used - let y = 2u32; - { - let _t = box (&x, yield 0, &y); - } - match box (&x, yield 0, &y) { - _t => {} - } - }; - - let mut g = |_| box yield; - assert_eq!(Pin::new(&mut g).resume(1), GeneratorState::Yielded(())); - assert_eq!(Pin::new(&mut g).resume(2), GeneratorState::Complete(box 2)); -} diff --git a/tests/ui/generator/yield-in-box.stderr b/tests/ui/generator/yield-in-box.stderr deleted file mode 100644 index 9d03ee008..000000000 --- a/tests/ui/generator/yield-in-box.stderr +++ /dev/null @@ -1,17 +0,0 @@ -warning: unused generator that must be used - --> $DIR/yield-in-box.rs:11:5 - | -LL | / || { -LL | | let y = 2u32; -LL | | { -LL | | let _t = box (&x, yield 0, &y); -... | -LL | | } -LL | | }; - | |_____^ - | - = note: generators are lazy and do nothing unless resumed - = note: `#[warn(unused_must_use)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/generic-associated-types/bugs/issue-100013.stderr b/tests/ui/generic-associated-types/bugs/issue-100013.stderr index 9db124a81..86dbad84d 100644 --- a/tests/ui/generic-associated-types/bugs/issue-100013.stderr +++ b/tests/ui/generic-associated-types/bugs/issue-100013.stderr @@ -28,12 +28,12 @@ LL | | async {}.await; // a yield point LL | | } | |_____^ | -note: the lifetime defined here... +note: the lifetime `'b` defined here... --> $DIR/issue-100013.rs:21:14 | LL | fn call2<'a, 'b, I: FutureIterator>() -> impl Send { | ^^ -note: ...must outlive the lifetime defined here +note: ...must outlive the lifetime `'a` defined here --> $DIR/issue-100013.rs:21:10 | LL | fn call2<'a, 'b, I: FutureIterator>() -> impl Send { @@ -62,12 +62,12 @@ LL | | async {}.await; // a yield point LL | | } | |_____^ | -note: the lifetime defined here... +note: the lifetime `'b` defined here... --> $DIR/issue-100013.rs:28:18 | LL | fn call3<'a: 'b, 'b, I: FutureIterator>() -> impl Send { | ^^ -note: ...must outlive the lifetime defined here +note: ...must outlive the lifetime `'a` defined here --> $DIR/issue-100013.rs:28:10 | LL | fn call3<'a: 'b, 'b, I: FutureIterator>() -> impl Send { diff --git a/tests/ui/generic-associated-types/gat-bounds-normalize-pred.rs b/tests/ui/generic-associated-types/gat-bounds-normalize-pred.rs new file mode 100644 index 000000000..b43f98228 --- /dev/null +++ b/tests/ui/generic-associated-types/gat-bounds-normalize-pred.rs @@ -0,0 +1,17 @@ +// check-pass + +trait Foo { + type Assoc: PartialEq>; +} + +impl Foo for () { + type Assoc = Wrapper; +} + +struct Wrapper(T); + +impl PartialEq> for Wrapper { + fn eq(&self, _other: &Wrapper) -> bool { true } +} + +fn main() {} diff --git a/tests/ui/generic-associated-types/issue-86218-2.rs b/tests/ui/generic-associated-types/issue-86218-2.rs index 63c839ea8..8a5e4a0f3 100644 --- a/tests/ui/generic-associated-types/issue-86218-2.rs +++ b/tests/ui/generic-associated-types/issue-86218-2.rs @@ -1,6 +1,6 @@ // check-pass -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] pub trait Stream { type Item; @@ -17,7 +17,9 @@ trait Yay { impl Yay for () { type InnerStream<'s> = impl Stream + 's; - fn foo<'s>() -> Self::InnerStream<'s> { () } + fn foo<'s>() -> Self::InnerStream<'s> { + () + } } fn main() {} diff --git a/tests/ui/generic-associated-types/issue-86218.rs b/tests/ui/generic-associated-types/issue-86218.rs index b2c3071f0..61cfdd35a 100644 --- a/tests/ui/generic-associated-types/issue-86218.rs +++ b/tests/ui/generic-associated-types/issue-86218.rs @@ -1,6 +1,6 @@ // check-pass -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] pub trait Stream { type Item; @@ -18,7 +18,9 @@ trait Yay { impl<'a> Yay<&'a ()> for () { type InnerStream<'s> = impl Stream + 's; //^ ERROR does not fulfill the required lifetime - fn foo<'s>() -> Self::InnerStream<'s> { () } + fn foo<'s>() -> Self::InnerStream<'s> { + () + } } fn main() {} diff --git a/tests/ui/generic-associated-types/issue-87258_a.rs b/tests/ui/generic-associated-types/issue-87258_a.rs index 9ab683d3d..6f737b21f 100644 --- a/tests/ui/generic-associated-types/issue-87258_a.rs +++ b/tests/ui/generic-associated-types/issue-87258_a.rs @@ -1,4 +1,4 @@ -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] // See https://github.com/rust-lang/rust/issues/87258#issuecomment-883293367 diff --git a/tests/ui/generic-associated-types/issue-87429-associated-type-default.stderr b/tests/ui/generic-associated-types/issue-87429-associated-type-default.stderr index b1abe012b..a44bb6993 100644 --- a/tests/ui/generic-associated-types/issue-87429-associated-type-default.stderr +++ b/tests/ui/generic-associated-types/issue-87429-associated-type-default.stderr @@ -12,7 +12,8 @@ LL | type Member<'a>: for<'b> PartialEq> = Foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Family2::Member` help: consider annotating `Foo` with `#[derive(PartialEq)]` | -LL | #[derive(PartialEq)] +LL + #[derive(PartialEq)] +LL | struct Foo; | error: aborting due to previous error diff --git a/tests/ui/generic-associated-types/issue-87429-specialization.stderr b/tests/ui/generic-associated-types/issue-87429-specialization.stderr index 11c4ebf60..c259c89a7 100644 --- a/tests/ui/generic-associated-types/issue-87429-specialization.stderr +++ b/tests/ui/generic-associated-types/issue-87429-specialization.stderr @@ -22,7 +22,8 @@ LL | type Member<'a>: for<'b> PartialEq>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Family::Member` help: consider annotating `Foo` with `#[derive(PartialEq)]` | -LL | #[derive(PartialEq)] +LL + #[derive(PartialEq)] +LL | struct Foo; | error: aborting due to previous error; 1 warning emitted diff --git a/tests/ui/generic-associated-types/issue-88595.rs b/tests/ui/generic-associated-types/issue-88595.rs index 24641ee1f..5a40a6129 100644 --- a/tests/ui/generic-associated-types/issue-88595.rs +++ b/tests/ui/generic-associated-types/issue-88595.rs @@ -1,7 +1,8 @@ -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] fn main() {} +#[rustfmt::skip] trait A<'a> { type B<'b>: Clone // FIXME(generic_associated_types): Remove one of the below bounds diff --git a/tests/ui/generic-associated-types/issue-88595.stderr b/tests/ui/generic-associated-types/issue-88595.stderr index bcefc8066..79d3479af 100644 --- a/tests/ui/generic-associated-types/issue-88595.stderr +++ b/tests/ui/generic-associated-types/issue-88595.stderr @@ -1,11 +1,11 @@ error: non-defining opaque type use in defining scope - --> $DIR/issue-88595.rs:20:35 + --> $DIR/issue-88595.rs:21:35 | LL | fn a(&'a self) -> Self::B<'a> {} | ^^ | note: lifetime used multiple times - --> $DIR/issue-88595.rs:17:6 + --> $DIR/issue-88595.rs:18:6 | LL | impl<'a> A<'a> for C { | ^^ diff --git a/tests/ui/generic-associated-types/issue-89008.rs b/tests/ui/generic-associated-types/issue-89008.rs index 669dbafb5..94b07e674 100644 --- a/tests/ui/generic-associated-types/issue-89008.rs +++ b/tests/ui/generic-associated-types/issue-89008.rs @@ -1,7 +1,7 @@ // check-pass // edition:2021 -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] use std::future::Future; use std::marker::PhantomData; diff --git a/tests/ui/generic-associated-types/issue-90014.rs b/tests/ui/generic-associated-types/issue-90014.rs index 55db95a6d..c4d762796 100644 --- a/tests/ui/generic-associated-types/issue-90014.rs +++ b/tests/ui/generic-associated-types/issue-90014.rs @@ -1,11 +1,13 @@ // edition:2018 -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] use std::future::Future; trait MakeFut { - type Fut<'a> where Self: 'a; + type Fut<'a> + where + Self: 'a; fn make_fut<'a>(&'a self) -> Self::Fut<'a>; } diff --git a/tests/ui/generic-associated-types/issue-90014.stderr b/tests/ui/generic-associated-types/issue-90014.stderr index b4b1bc7da..0d49398ca 100644 --- a/tests/ui/generic-associated-types/issue-90014.stderr +++ b/tests/ui/generic-associated-types/issue-90014.stderr @@ -1,14 +1,14 @@ error[E0477]: the type `&mut ()` does not fulfill the required lifetime - --> $DIR/issue-90014.rs:13:20 + --> $DIR/issue-90014.rs:15:20 | -LL | type Fut<'a> where Self: 'a; +LL | type Fut<'a> | ------------ definition of `Fut` from trait ... LL | type Fut<'a> = impl Future; | ^^^^^^^^^^^^^^^^^^^^^^^^ | note: type must outlive the lifetime `'a` as defined here - --> $DIR/issue-90014.rs:13:14 + --> $DIR/issue-90014.rs:15:14 | LL | type Fut<'a> = impl Future; | ^^ diff --git a/tests/ui/generics/auxiliary/foreign-generic-mismatch.rs b/tests/ui/generics/auxiliary/foreign-generic-mismatch.rs new file mode 100644 index 000000000..d89c1e036 --- /dev/null +++ b/tests/ui/generics/auxiliary/foreign-generic-mismatch.rs @@ -0,0 +1,3 @@ +pub fn const_arg() {} + +pub fn lt_arg<'a: 'a>() {} diff --git a/tests/ui/generics/foreign-generic-mismatch.rs b/tests/ui/generics/foreign-generic-mismatch.rs new file mode 100644 index 000000000..403fd73d7 --- /dev/null +++ b/tests/ui/generics/foreign-generic-mismatch.rs @@ -0,0 +1,10 @@ +// aux-build: foreign-generic-mismatch.rs + +extern crate foreign_generic_mismatch; + +fn main() { + foreign_generic_mismatch::const_arg::<()>(); + //~^ ERROR function takes 2 generic arguments but 1 generic argument was supplied + foreign_generic_mismatch::lt_arg::<'static, 'static>(); + //~^ ERROR function takes 1 lifetime argument but 2 lifetime arguments were supplied +} diff --git a/tests/ui/generics/foreign-generic-mismatch.stderr b/tests/ui/generics/foreign-generic-mismatch.stderr new file mode 100644 index 000000000..5322b3f91 --- /dev/null +++ b/tests/ui/generics/foreign-generic-mismatch.stderr @@ -0,0 +1,35 @@ +error[E0107]: function takes 2 generic arguments but 1 generic argument was supplied + --> $DIR/foreign-generic-mismatch.rs:6:31 + | +LL | foreign_generic_mismatch::const_arg::<()>(); + | ^^^^^^^^^ -- supplied 1 generic argument + | | + | expected 2 generic arguments + | +note: function defined here, with 2 generic parameters: `N`, `T` + --> $DIR/auxiliary/foreign-generic-mismatch.rs:1:8 + | +LL | pub fn const_arg() {} + | ^^^^^^^^^ -------------- - +help: add missing generic argument + | +LL | foreign_generic_mismatch::const_arg::<(), T>(); + | +++ + +error[E0107]: function takes 1 lifetime argument but 2 lifetime arguments were supplied + --> $DIR/foreign-generic-mismatch.rs:8:31 + | +LL | foreign_generic_mismatch::lt_arg::<'static, 'static>(); + | ^^^^^^ ------- help: remove this lifetime argument + | | + | expected 1 lifetime argument + | +note: function defined here, with 1 lifetime parameter: `'a` + --> $DIR/auxiliary/foreign-generic-mismatch.rs:3:8 + | +LL | pub fn lt_arg<'a: 'a>() {} + | ^^^^^^ -- + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0107`. diff --git a/tests/ui/generics/slightly-nice-generic-literal-messages.rs b/tests/ui/generics/slightly-nice-generic-literal-messages.rs new file mode 100644 index 000000000..268009f65 --- /dev/null +++ b/tests/ui/generics/slightly-nice-generic-literal-messages.rs @@ -0,0 +1,14 @@ +use std::marker; + +struct Foo(T, marker::PhantomData); + +fn main() { + match Foo(1.1, marker::PhantomData) { + 1 => {} + //~^ ERROR mismatched types + //~| expected struct `Foo<{float}, _>` + //~| found type `{integer}` + //~| expected `Foo<{float}, _>`, found integer + } + +} diff --git a/tests/ui/generics/slightly-nice-generic-literal-messages.stderr b/tests/ui/generics/slightly-nice-generic-literal-messages.stderr new file mode 100644 index 000000000..83ef522ab --- /dev/null +++ b/tests/ui/generics/slightly-nice-generic-literal-messages.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/slightly-nice-generic-literal-messages.rs:7:9 + | +LL | match Foo(1.1, marker::PhantomData) { + | ----------------------------- this expression has type `Foo<{float}, _>` +LL | 1 => {} + | ^ expected `Foo<{float}, _>`, found integer + | + = note: expected struct `Foo<{float}, _>` + found type `{integer}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.rs b/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.rs index f55566602..4b14a314e 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.rs +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.rs @@ -10,44 +10,31 @@ macro_rules! m { fn main() { m!(0, ..u8::MIN); //~^ ERROR lower range bound must be less than upper - //~| ERROR lower range bound must be less than upper m!(0, ..u16::MIN); //~^ ERROR lower range bound must be less than upper - //~| ERROR lower range bound must be less than upper m!(0, ..u32::MIN); //~^ ERROR lower range bound must be less than upper - //~| ERROR lower range bound must be less than upper m!(0, ..u64::MIN); //~^ ERROR lower range bound must be less than upper - //~| ERROR lower range bound must be less than upper m!(0, ..u128::MIN); //~^ ERROR lower range bound must be less than upper - //~| ERROR lower range bound must be less than upper m!(0, ..i8::MIN); //~^ ERROR lower range bound must be less than upper - //~| ERROR lower range bound must be less than upper m!(0, ..i16::MIN); //~^ ERROR lower range bound must be less than upper - //~| ERROR lower range bound must be less than upper m!(0, ..i32::MIN); //~^ ERROR lower range bound must be less than upper - //~| ERROR lower range bound must be less than upper m!(0, ..i64::MIN); //~^ ERROR lower range bound must be less than upper - //~| ERROR lower range bound must be less than upper m!(0, ..i128::MIN); //~^ ERROR lower range bound must be less than upper - //~| ERROR lower range bound must be less than upper m!(0f32, ..f32::NEG_INFINITY); //~^ ERROR lower range bound must be less than upper - //~| ERROR lower range bound must be less than upper m!(0f64, ..f64::NEG_INFINITY); //~^ ERROR lower range bound must be less than upper - //~| ERROR lower range bound must be less than upper m!('a', ..'\u{0}'); //~^ ERROR lower range bound must be less than upper - //~| ERROR lower range bound must be less than upper } diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.stderr b/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.stderr index 56b224a85..e9702bb38 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.stderr +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.stderr @@ -5,155 +5,77 @@ LL | m!(0, ..u8::MIN); | ^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:14:11 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:13:11 | LL | m!(0, ..u16::MIN); | ^^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:17:11 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:15:11 | LL | m!(0, ..u32::MIN); | ^^^^^^^^^^ -error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:20:11 - | -LL | m!(0, ..u64::MIN); - | ^^^^^^^^^^ - -error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:23:11 - | -LL | m!(0, ..u128::MIN); - | ^^^^^^^^^^^ - -error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:27:11 - | -LL | m!(0, ..i8::MIN); - | ^^^^^^^^^ - -error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:30:11 - | -LL | m!(0, ..i16::MIN); - | ^^^^^^^^^^ - -error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:33:11 - | -LL | m!(0, ..i32::MIN); - | ^^^^^^^^^^ - -error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:36:11 - | -LL | m!(0, ..i64::MIN); - | ^^^^^^^^^^ - -error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:39:11 - | -LL | m!(0, ..i128::MIN); - | ^^^^^^^^^^^ - -error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:43:14 - | -LL | m!(0f32, ..f32::NEG_INFINITY); - | ^^^^^^^^^^^^^^^^^^^ - -error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:46:14 - | -LL | m!(0f64, ..f64::NEG_INFINITY); - | ^^^^^^^^^^^^^^^^^^^ - -error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:50:13 - | -LL | m!('a', ..'\u{0}'); - | ^^^^^^^^^ - -error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:11:11 - | -LL | m!(0, ..u8::MIN); - | ^^^^^^^^^ - -error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:14:11 - | -LL | m!(0, ..u16::MIN); - | ^^^^^^^^^^ - error[E0579]: lower range bound must be less than upper --> $DIR/half-open-range-pats-thir-lower-empty.rs:17:11 | -LL | m!(0, ..u32::MIN); - | ^^^^^^^^^^ - -error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:20:11 - | LL | m!(0, ..u64::MIN); | ^^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:23:11 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:19:11 | LL | m!(0, ..u128::MIN); | ^^^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:27:11 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:22:11 | LL | m!(0, ..i8::MIN); | ^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:30:11 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:24:11 | LL | m!(0, ..i16::MIN); | ^^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:33:11 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:26:11 | LL | m!(0, ..i32::MIN); | ^^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:36:11 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:28:11 | LL | m!(0, ..i64::MIN); | ^^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:39:11 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:30:11 | LL | m!(0, ..i128::MIN); | ^^^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:43:14 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:33:14 | LL | m!(0f32, ..f32::NEG_INFINITY); | ^^^^^^^^^^^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:46:14 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:35:14 | LL | m!(0f64, ..f64::NEG_INFINITY); | ^^^^^^^^^^^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:50:13 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:38:13 | LL | m!('a', ..'\u{0}'); | ^^^^^^^^^ -error: aborting due to 26 previous errors +error: aborting due to 13 previous errors For more information about this error, try `rustc --explain E0579`. diff --git a/tests/ui/higher-rank-trait-bounds/fn-ptr.classic.stderr b/tests/ui/higher-rank-trait-bounds/fn-ptr.classic.stderr new file mode 100644 index 000000000..9af6bc45c --- /dev/null +++ b/tests/ui/higher-rank-trait-bounds/fn-ptr.classic.stderr @@ -0,0 +1,19 @@ +error[E0277]: expected a `Fn<(&'w (),)>` closure, found `fn(&'w ())` + --> $DIR/fn-ptr.rs:12:5 + | +LL | ice(); + | ^^^ expected an `Fn<(&'w (),)>` closure, found `fn(&'w ())` + | + = help: the trait `for<'w> Fn<(&'w (),)>` is not implemented for `fn(&'w ())` +note: required by a bound in `ice` + --> $DIR/fn-ptr.rs:7:25 + | +LL | fn ice() + | --- required by a bound in this function +LL | where +LL | for<'w> fn(&'w ()): Fn(&'w ()), + | ^^^^^^^^^^ required by this bound in `ice` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/higher-rank-trait-bounds/fn-ptr.rs b/tests/ui/higher-rank-trait-bounds/fn-ptr.rs new file mode 100644 index 000000000..853160f96 --- /dev/null +++ b/tests/ui/higher-rank-trait-bounds/fn-ptr.rs @@ -0,0 +1,14 @@ +// revisions: classic next +//[next] compile-flags: -Ztrait-solver=next +//[next] check-pass + +fn ice() +where + for<'w> fn(&'w ()): Fn(&'w ()), +{ +} + +fn main() { + ice(); + //[classic]~^ ERROR expected a `Fn<(&'w (),)>` closure, found `fn(&'w ())` +} diff --git a/tests/ui/higher-rank-trait-bounds/issue-95230.new.stderr b/tests/ui/higher-rank-trait-bounds/issue-95230.new.stderr new file mode 100644 index 000000000..d4bc5b672 --- /dev/null +++ b/tests/ui/higher-rank-trait-bounds/issue-95230.new.stderr @@ -0,0 +1,19 @@ +error[E0275]: overflow evaluating the requirement `for<'a> &'a mut Bar well-formed` + --> $DIR/issue-95230.rs:9:13 + | +LL | for<'a> &'a mut Self:; + | ^^^^^^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_95230`) +note: required by a bound in `Bar` + --> $DIR/issue-95230.rs:9:13 + | +LL | pub struct Bar + | --- required by a bound in this struct +LL | where +LL | for<'a> &'a mut Self:; + | ^^^^^^^^^^^^ required by this bound in `Bar` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/higher-rank-trait-bounds/issue-95230.rs b/tests/ui/higher-rank-trait-bounds/issue-95230.rs index 92c506eab..769b6a925 100644 --- a/tests/ui/higher-rank-trait-bounds/issue-95230.rs +++ b/tests/ui/higher-rank-trait-bounds/issue-95230.rs @@ -1,4 +1,8 @@ -// check-pass +// revisions: old new +//[new] compile-flags: -Ztrait-solver=next +//[old] check-pass +//[new] known-bug: #109764 + pub struct Bar where diff --git a/tests/ui/hygiene/arguments.rs b/tests/ui/hygiene/arguments.rs index f0f732f4c..ab58301d4 100644 --- a/tests/ui/hygiene/arguments.rs +++ b/tests/ui/hygiene/arguments.rs @@ -1,5 +1,3 @@ -// ignore-pretty pretty-printing is unhygienic - #![feature(decl_macro)] macro m($t:ty, $e:expr) { diff --git a/tests/ui/hygiene/arguments.stderr b/tests/ui/hygiene/arguments.stderr index d072086e0..714178375 100644 --- a/tests/ui/hygiene/arguments.stderr +++ b/tests/ui/hygiene/arguments.stderr @@ -1,5 +1,5 @@ error[E0412]: cannot find type `S` in this scope - --> $DIR/arguments.rs:16:8 + --> $DIR/arguments.rs:14:8 | LL | m!(S, S); | ^ not found in this scope diff --git a/tests/ui/hygiene/assoc_item_ctxt.rs b/tests/ui/hygiene/assoc_item_ctxt.rs index 65593d1d5..f09f81a5d 100644 --- a/tests/ui/hygiene/assoc_item_ctxt.rs +++ b/tests/ui/hygiene/assoc_item_ctxt.rs @@ -1,5 +1,3 @@ -// ignore-pretty pretty-printing is unhygienic - #![feature(decl_macro)] #![allow(unused)] diff --git a/tests/ui/hygiene/assoc_item_ctxt.stderr b/tests/ui/hygiene/assoc_item_ctxt.stderr index d65716ec2..effa9e8d6 100644 --- a/tests/ui/hygiene/assoc_item_ctxt.stderr +++ b/tests/ui/hygiene/assoc_item_ctxt.stderr @@ -1,5 +1,5 @@ error[E0407]: method `method` is not a member of trait `Tr` - --> $DIR/assoc_item_ctxt.rs:35:13 + --> $DIR/assoc_item_ctxt.rs:33:13 | LL | fn method() {} | ^^^------^^^^^ @@ -13,7 +13,7 @@ LL | mac_trait_impl!(); = note: this error originates in the macro `mac_trait_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0046]: not all trait items implemented, missing: `method` - --> $DIR/assoc_item_ctxt.rs:34:9 + --> $DIR/assoc_item_ctxt.rs:32:9 | LL | fn method(); | ------------ `method` from trait diff --git a/tests/ui/hygiene/assoc_ty_bindings.rs b/tests/ui/hygiene/assoc_ty_bindings.rs index 0567beab9..a78612749 100644 --- a/tests/ui/hygiene/assoc_ty_bindings.rs +++ b/tests/ui/hygiene/assoc_ty_bindings.rs @@ -1,5 +1,4 @@ // check-pass -// ignore-pretty pretty-printing is unhygienic #![feature(decl_macro, associated_type_defaults)] diff --git a/tests/ui/hygiene/auxiliary/legacy_interaction.rs b/tests/ui/hygiene/auxiliary/legacy_interaction.rs index 90d5243b7..3293e346d 100644 --- a/tests/ui/hygiene/auxiliary/legacy_interaction.rs +++ b/tests/ui/hygiene/auxiliary/legacy_interaction.rs @@ -1,5 +1,3 @@ -// ignore-pretty pretty-printing is unhygienic - #[macro_export] macro_rules! m { () => { diff --git a/tests/ui/hygiene/fields.rs b/tests/ui/hygiene/fields.rs index 7a417b46f..86b3d8151 100644 --- a/tests/ui/hygiene/fields.rs +++ b/tests/ui/hygiene/fields.rs @@ -1,5 +1,3 @@ -// ignore-pretty pretty-printing is unhygienic - #![feature(decl_macro)] mod foo { diff --git a/tests/ui/hygiene/fields.stderr b/tests/ui/hygiene/fields.stderr index 978120b1f..99252c4b7 100644 --- a/tests/ui/hygiene/fields.stderr +++ b/tests/ui/hygiene/fields.stderr @@ -1,5 +1,5 @@ error: type `foo::S` is private - --> $DIR/fields.rs:15:17 + --> $DIR/fields.rs:13:17 | LL | let s = S { x: 0 }; | ^^^^^^^^^^ private type @@ -10,7 +10,7 @@ LL | let s = foo::m!(S, x); = note: this error originates in the macro `foo::m` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `foo::S` is private - --> $DIR/fields.rs:16:17 + --> $DIR/fields.rs:14:17 | LL | let _ = s.x; | ^ private type @@ -21,7 +21,7 @@ LL | let s = foo::m!(S, x); = note: this error originates in the macro `foo::m` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `T` is private - --> $DIR/fields.rs:18:17 + --> $DIR/fields.rs:16:17 | LL | let t = T(0); | ^^^^ private type @@ -32,7 +32,7 @@ LL | let s = foo::m!(S, x); = note: this error originates in the macro `foo::m` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `T` is private - --> $DIR/fields.rs:19:17 + --> $DIR/fields.rs:17:17 | LL | let _ = t.0; | ^ private type diff --git a/tests/ui/hygiene/generic_params.rs b/tests/ui/hygiene/generic_params.rs index 3b6216c3e..b42152955 100644 --- a/tests/ui/hygiene/generic_params.rs +++ b/tests/ui/hygiene/generic_params.rs @@ -1,7 +1,6 @@ // Ensure that generic parameters always have modern hygiene. // check-pass -// ignore-pretty pretty-printing is unhygienic #![feature(decl_macro, rustc_attrs)] diff --git a/tests/ui/hygiene/globs.stderr b/tests/ui/hygiene/globs.stderr index c01901be5..180172644 100644 --- a/tests/ui/hygiene/globs.stderr +++ b/tests/ui/hygiene/globs.stderr @@ -13,7 +13,7 @@ LL | g(); | ~ help: consider importing this function | -LL | use foo::f; +LL + use foo::f; | error[E0425]: cannot find function `g` in this scope @@ -39,7 +39,7 @@ LL | f(); | ~ help: consider importing this function | -LL | use bar::g; +LL + use bar::g; | error[E0425]: cannot find function `f` in this scope diff --git a/tests/ui/hygiene/impl_items.rs b/tests/ui/hygiene/impl_items.rs index ddb25c06b..51088e369 100644 --- a/tests/ui/hygiene/impl_items.rs +++ b/tests/ui/hygiene/impl_items.rs @@ -1,5 +1,3 @@ -// ignore-pretty pretty-printing is unhygienic - #![feature(decl_macro)] mod foo { diff --git a/tests/ui/hygiene/impl_items.stderr b/tests/ui/hygiene/impl_items.stderr index 46a250038..32ba3741a 100644 --- a/tests/ui/hygiene/impl_items.stderr +++ b/tests/ui/hygiene/impl_items.stderr @@ -1,5 +1,5 @@ error: type `for<'a> fn(&'a foo::S) {foo::S::f}` is private - --> $DIR/impl_items.rs:12:23 + --> $DIR/impl_items.rs:10:23 | LL | let _: () = S.f(); | ^ private type diff --git a/tests/ui/hygiene/intercrate.rs b/tests/ui/hygiene/intercrate.rs index d9b5b789e..2de62f6af 100644 --- a/tests/ui/hygiene/intercrate.rs +++ b/tests/ui/hygiene/intercrate.rs @@ -1,5 +1,3 @@ -// ignore-pretty pretty-printing is unhygienic - // aux-build:intercrate.rs #![feature(decl_macro)] diff --git a/tests/ui/hygiene/intercrate.stderr b/tests/ui/hygiene/intercrate.stderr index 91358b279..f108617fb 100644 --- a/tests/ui/hygiene/intercrate.stderr +++ b/tests/ui/hygiene/intercrate.stderr @@ -1,5 +1,5 @@ error: type `fn() -> u32 {foo::bar::f}` is private - --> $DIR/intercrate.rs:10:16 + --> $DIR/intercrate.rs:8:16 | LL | assert_eq!(intercrate::foo::m!(), 1); | ^^^^^^^^^^^^^^^^^^^^^ private type diff --git a/tests/ui/hygiene/issue-47311.rs b/tests/ui/hygiene/issue-47311.rs index 5c2379a8a..3f1b73973 100644 --- a/tests/ui/hygiene/issue-47311.rs +++ b/tests/ui/hygiene/issue-47311.rs @@ -1,5 +1,4 @@ // check-pass -// ignore-pretty pretty-printing is unhygienic #![feature(decl_macro)] #![allow(unused)] diff --git a/tests/ui/hygiene/issue-47312.rs b/tests/ui/hygiene/issue-47312.rs index bbcb3a7f3..c8b5c3676 100644 --- a/tests/ui/hygiene/issue-47312.rs +++ b/tests/ui/hygiene/issue-47312.rs @@ -1,5 +1,4 @@ // check-pass -// ignore-pretty pretty-printing is unhygienic #![feature(decl_macro)] #![allow(unused)] diff --git a/tests/ui/hygiene/items.rs b/tests/ui/hygiene/items.rs index 1c625a972..a7ed749f5 100644 --- a/tests/ui/hygiene/items.rs +++ b/tests/ui/hygiene/items.rs @@ -1,5 +1,4 @@ // check-pass -// ignore-pretty pretty-printing is unhygienic #![feature(decl_macro)] diff --git a/tests/ui/hygiene/legacy_interaction.rs b/tests/ui/hygiene/legacy_interaction.rs index 52008eed5..4d150baf5 100644 --- a/tests/ui/hygiene/legacy_interaction.rs +++ b/tests/ui/hygiene/legacy_interaction.rs @@ -1,6 +1,5 @@ // check-pass #![allow(dead_code)] -// ignore-pretty pretty-printing is unhygienic // aux-build:legacy_interaction.rs diff --git a/tests/ui/hygiene/lexical.rs b/tests/ui/hygiene/lexical.rs index 3d25c7209..81de974c2 100644 --- a/tests/ui/hygiene/lexical.rs +++ b/tests/ui/hygiene/lexical.rs @@ -1,5 +1,4 @@ // check-pass -// ignore-pretty pretty-printing is unhygienic #![feature(decl_macro)] diff --git a/tests/ui/hygiene/no_implicit_prelude.stderr b/tests/ui/hygiene/no_implicit_prelude.stderr index c48c84035..96187b1c5 100644 --- a/tests/ui/hygiene/no_implicit_prelude.stderr +++ b/tests/ui/hygiene/no_implicit_prelude.stderr @@ -10,7 +10,7 @@ LL | Vec::new(); = note: this error originates in the macro `::bar::m` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider importing this struct | -LL | use std::vec::Vec; +LL + use std::vec::Vec; | error[E0599]: no method named `clone` found for unit type `()` in the current scope @@ -26,7 +26,7 @@ LL | ().clone() = note: this error originates in the macro `::bar::m` (in Nightly builds, run with -Z macro-backtrace for more info) help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use std::clone::Clone; +LL + use std::clone::Clone; | error: aborting due to 2 previous errors diff --git a/tests/ui/hygiene/panic-location.run.stderr b/tests/ui/hygiene/panic-location.run.stderr index 1c6a7b02f..a7252a400 100644 --- a/tests/ui/hygiene/panic-location.run.stderr +++ b/tests/ui/hygiene/panic-location.run.stderr @@ -1,2 +1,2 @@ -thread 'main' panicked at 'capacity overflow', library/alloc/src/raw_vec.rs:525:5 +thread 'main' panicked at 'capacity overflow', library/alloc/src/raw_vec.rs:524:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/hygiene/specialization.rs b/tests/ui/hygiene/specialization.rs index 656aa880a..b8c4c1b0d 100644 --- a/tests/ui/hygiene/specialization.rs +++ b/tests/ui/hygiene/specialization.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty pretty-printing is unhygienic #![feature(decl_macro)] diff --git a/tests/ui/hygiene/trait_items-2.rs b/tests/ui/hygiene/trait_items-2.rs index 39edfc37d..cd9122656 100644 --- a/tests/ui/hygiene/trait_items-2.rs +++ b/tests/ui/hygiene/trait_items-2.rs @@ -1,5 +1,4 @@ // check-pass -// ignore-pretty pretty-printing is unhygienic #![feature(decl_macro)] diff --git a/tests/ui/hygiene/trait_items.stderr b/tests/ui/hygiene/trait_items.stderr index 80bdbe0e2..f303534c7 100644 --- a/tests/ui/hygiene/trait_items.stderr +++ b/tests/ui/hygiene/trait_items.stderr @@ -14,7 +14,7 @@ LL | pub macro m() { ().f() } = note: this error originates in the macro `::baz::m` (in Nightly builds, run with -Z macro-backtrace for more info) help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use foo::T; +LL + use foo::T; | error: aborting due to previous error diff --git a/tests/ui/hygiene/wrap_unhygienic_example.rs b/tests/ui/hygiene/wrap_unhygienic_example.rs index 50c6b35ab..f6b481568 100644 --- a/tests/ui/hygiene/wrap_unhygienic_example.rs +++ b/tests/ui/hygiene/wrap_unhygienic_example.rs @@ -1,5 +1,4 @@ // check-pass -// ignore-pretty pretty-printing is unhygienic // aux-build:my_crate.rs // aux-build:unhygienic_example.rs diff --git a/tests/ui/hygiene/xcrate.rs b/tests/ui/hygiene/xcrate.rs index 6981ce3f6..6366bebb5 100644 --- a/tests/ui/hygiene/xcrate.rs +++ b/tests/ui/hygiene/xcrate.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty pretty-printing is unhygienic // aux-build:xcrate.rs diff --git a/tests/ui/impl-trait/associated-impl-trait-type-generic-trait.rs b/tests/ui/impl-trait/associated-impl-trait-type-generic-trait.rs index 6c7c46b0e..0908a0bf3 100644 --- a/tests/ui/impl-trait/associated-impl-trait-type-generic-trait.rs +++ b/tests/ui/impl-trait/associated-impl-trait-type-generic-trait.rs @@ -1,4 +1,4 @@ -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] // build-pass (FIXME(62277): could be check-pass?) trait Bar {} diff --git a/tests/ui/impl-trait/associated-impl-trait-type-trivial.rs b/tests/ui/impl-trait/associated-impl-trait-type-trivial.rs index cdda341ca..b5ea90bb0 100644 --- a/tests/ui/impl-trait/associated-impl-trait-type-trivial.rs +++ b/tests/ui/impl-trait/associated-impl-trait-type-trivial.rs @@ -1,4 +1,4 @@ -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] // build-pass (FIXME(62277): could be check-pass?) trait Bar {} diff --git a/tests/ui/impl-trait/associated-impl-trait-type.rs b/tests/ui/impl-trait/associated-impl-trait-type.rs index d0661d66f..f5981261c 100644 --- a/tests/ui/impl-trait/associated-impl-trait-type.rs +++ b/tests/ui/impl-trait/associated-impl-trait-type.rs @@ -1,4 +1,4 @@ -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] // build-pass (FIXME(62277): could be check-pass?) trait Bar {} diff --git a/tests/ui/impl-trait/auto-trait-leak.stderr b/tests/ui/impl-trait/auto-trait-leak.stderr index fd0358421..e6c750d0e 100644 --- a/tests/ui/impl-trait/auto-trait-leak.stderr +++ b/tests/ui/impl-trait/auto-trait-leak.stderr @@ -29,6 +29,11 @@ note: ...which requires building MIR for `cycle1`... | LL | fn cycle1() -> impl Clone { | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires match-checking `cycle1`... + --> $DIR/auto-trait-leak.rs:12:1 + | +LL | fn cycle1() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...which requires building THIR for `cycle1`... --> $DIR/auto-trait-leak.rs:12:1 | @@ -70,6 +75,11 @@ note: ...which requires building MIR for `cycle2`... | LL | fn cycle2() -> impl Clone { | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires match-checking `cycle2`... + --> $DIR/auto-trait-leak.rs:19:1 + | +LL | fn cycle2() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...which requires building THIR for `cycle2`... --> $DIR/auto-trait-leak.rs:19:1 | diff --git a/tests/ui/impl-trait/impl-fn-hrtb-bounds-2.stderr b/tests/ui/impl-trait/impl-fn-hrtb-bounds-2.stderr index d56e1273f..835f7f765 100644 --- a/tests/ui/impl-trait/impl-fn-hrtb-bounds-2.stderr +++ b/tests/ui/impl-trait/impl-fn-hrtb-bounds-2.stderr @@ -6,7 +6,7 @@ LL | fn a() -> impl Fn(&u8) -> impl Debug { LL | |x| x | --- ^ | | - | hidden type `&u8` captures the anonymous lifetime #1 defined here + | hidden type `&u8` captures the anonymous lifetime as defined here error: aborting due to previous error diff --git a/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs b/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs index 74df300f8..ffeabe5c2 100644 --- a/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs +++ b/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs @@ -1,11 +1,14 @@ +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty + #![feature(return_position_impl_trait_in_trait)] +use std::ops::Deref; + pub trait Foo { - fn bar() -> impl Sized; + fn bar() -> impl Deref; } pub struct Foreign; - impl Foo for Foreign { - fn bar() {} + fn bar() -> &'static () { &() } } diff --git a/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.current.stderr b/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.current.stderr new file mode 100644 index 000000000..05c025cc1 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.current.stderr @@ -0,0 +1,11 @@ +warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/box-coerce-span-in-default.rs:5:12 + | +LL | #![feature(return_position_impl_trait_in_trait)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.next.stderr b/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.next.stderr new file mode 100644 index 000000000..05c025cc1 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.next.stderr @@ -0,0 +1,11 @@ +warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/box-coerce-span-in-default.rs:5:12 + | +LL | #![feature(return_position_impl_trait_in_trait)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs b/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs index a4d483dee..163bb4fcf 100644 --- a/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs +++ b/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs @@ -1,4 +1,6 @@ // check-pass +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(return_position_impl_trait_in_trait)] //~^ WARN the feature `return_position_impl_trait_in_trait` is incomplete diff --git a/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.stderr b/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.stderr deleted file mode 100644 index d681ecf25..000000000 --- a/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/box-coerce-span-in-default.rs:3:12 - | -LL | #![feature(return_position_impl_trait_in_trait)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #91611 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/impl-trait/in-trait/deep-match-works.rs b/tests/ui/impl-trait/in-trait/deep-match-works.rs index 772da845e..5c9d2e356 100644 --- a/tests/ui/impl-trait/in-trait/deep-match-works.rs +++ b/tests/ui/impl-trait/in-trait/deep-match-works.rs @@ -1,4 +1,6 @@ // check-pass +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(return_position_impl_trait_in_trait)] #![allow(incomplete_features)] @@ -10,7 +12,9 @@ trait Foo { } impl Foo for () { - fn bar() -> Wrapper { Wrapper(0) } + fn bar() -> Wrapper { + Wrapper(0) + } } fn main() {} diff --git a/tests/ui/impl-trait/in-trait/deep-match.current.stderr b/tests/ui/impl-trait/in-trait/deep-match.current.stderr new file mode 100644 index 000000000..400db20c7 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/deep-match.current.stderr @@ -0,0 +1,15 @@ +error[E0053]: method `bar` has an incompatible return type for trait + --> $DIR/deep-match.rs:14:17 + | +LL | fn bar() -> i32 { + | ^^^ + | | + | expected `Wrapper<_>`, found `i32` + | return type in trait + | + = note: expected struct `Wrapper<_>` + found type `i32` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0053`. diff --git a/tests/ui/impl-trait/in-trait/deep-match.next.stderr b/tests/ui/impl-trait/in-trait/deep-match.next.stderr new file mode 100644 index 000000000..400db20c7 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/deep-match.next.stderr @@ -0,0 +1,15 @@ +error[E0053]: method `bar` has an incompatible return type for trait + --> $DIR/deep-match.rs:14:17 + | +LL | fn bar() -> i32 { + | ^^^ + | | + | expected `Wrapper<_>`, found `i32` + | return type in trait + | + = note: expected struct `Wrapper<_>` + found type `i32` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0053`. diff --git a/tests/ui/impl-trait/in-trait/deep-match.rs b/tests/ui/impl-trait/in-trait/deep-match.rs index a6385147c..413d054e1 100644 --- a/tests/ui/impl-trait/in-trait/deep-match.rs +++ b/tests/ui/impl-trait/in-trait/deep-match.rs @@ -1,3 +1,6 @@ +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next + #![feature(return_position_impl_trait_in_trait)] #![allow(incomplete_features)] @@ -8,8 +11,10 @@ trait Foo { } impl Foo for () { - fn bar() -> i32 { 0 } - //~^ ERROR method `bar` has an incompatible return type for trait + fn bar() -> i32 { + //~^ ERROR method `bar` has an incompatible return type for trait + 0 + } } fn main() {} diff --git a/tests/ui/impl-trait/in-trait/deep-match.stderr b/tests/ui/impl-trait/in-trait/deep-match.stderr deleted file mode 100644 index 3eba419c0..000000000 --- a/tests/ui/impl-trait/in-trait/deep-match.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0053]: method `bar` has an incompatible return type for trait - --> $DIR/deep-match.rs:11:17 - | -LL | fn bar() -> i32 { 0 } - | ^^^ - | | - | expected `Wrapper<_>`, found `i32` - | return type in trait - | - = note: expected struct `Wrapper<_>` - found type `i32` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0053`. diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err-2.current.stderr b/tests/ui/impl-trait/in-trait/default-body-type-err-2.current.stderr new file mode 100644 index 000000000..85450e3b0 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/default-body-type-err-2.current.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/default-body-type-err-2.rs:10:9 + | +LL | 42 + | ^^- help: try using a conversion method: `.to_string()` + | | + | expected `String`, found integer + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err-2.next.stderr b/tests/ui/impl-trait/in-trait/default-body-type-err-2.next.stderr new file mode 100644 index 000000000..85450e3b0 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/default-body-type-err-2.next.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/default-body-type-err-2.rs:10:9 + | +LL | 42 + | ^^- help: try using a conversion method: `.to_string()` + | | + | expected `String`, found integer + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err-2.rs b/tests/ui/impl-trait/in-trait/default-body-type-err-2.rs index 45ae2b8ad..623237763 100644 --- a/tests/ui/impl-trait/in-trait/default-body-type-err-2.rs +++ b/tests/ui/impl-trait/in-trait/default-body-type-err-2.rs @@ -1,4 +1,6 @@ // edition:2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![allow(incomplete_features)] #![feature(async_fn_in_trait)] diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr b/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr deleted file mode 100644 index cc3bdf0e5..000000000 --- a/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/default-body-type-err-2.rs:8:9 - | -LL | 42 - | ^^- help: try using a conversion method: `.to_string()` - | | - | expected `String`, found integer - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err.current.stderr b/tests/ui/impl-trait/in-trait/default-body-type-err.current.stderr new file mode 100644 index 000000000..c949168a3 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/default-body-type-err.current.stderr @@ -0,0 +1,12 @@ +error[E0271]: type mismatch resolving `<&i32 as Deref>::Target == String` + --> $DIR/default-body-type-err.rs:10:22 + | +LL | fn lol(&self) -> impl Deref { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `String` +LL | +LL | &1i32 + | ----- return type was inferred to be `&i32` here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err.next.stderr b/tests/ui/impl-trait/in-trait/default-body-type-err.next.stderr new file mode 100644 index 000000000..c949168a3 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/default-body-type-err.next.stderr @@ -0,0 +1,12 @@ +error[E0271]: type mismatch resolving `<&i32 as Deref>::Target == String` + --> $DIR/default-body-type-err.rs:10:22 + | +LL | fn lol(&self) -> impl Deref { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `String` +LL | +LL | &1i32 + | ----- return type was inferred to be `&i32` here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err.rs b/tests/ui/impl-trait/in-trait/default-body-type-err.rs index ac9baf91c..9bd5b7779 100644 --- a/tests/ui/impl-trait/in-trait/default-body-type-err.rs +++ b/tests/ui/impl-trait/in-trait/default-body-type-err.rs @@ -1,3 +1,6 @@ +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next + #![allow(incomplete_features)] #![feature(return_position_impl_trait_in_trait)] diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err.stderr b/tests/ui/impl-trait/in-trait/default-body-type-err.stderr deleted file mode 100644 index 4742eb37d..000000000 --- a/tests/ui/impl-trait/in-trait/default-body-type-err.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0271]: type mismatch resolving `<&i32 as Deref>::Target == String` - --> $DIR/default-body-type-err.rs:7:22 - | -LL | fn lol(&self) -> impl Deref { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `String` -LL | -LL | &1i32 - | ----- return type was inferred to be `&i32` here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/impl-trait/in-trait/default-body-with-rpit.current.stderr b/tests/ui/impl-trait/in-trait/default-body-with-rpit.current.stderr new file mode 100644 index 000000000..3c24eff9a --- /dev/null +++ b/tests/ui/impl-trait/in-trait/default-body-with-rpit.current.stderr @@ -0,0 +1,24 @@ +error: concrete type differs from previous defining opaque type use + --> $DIR/default-body-with-rpit.rs:13:9 + | +LL | "" + | ^^ expected `impl Debug`, got `&'static str` + | +note: previous use here + --> $DIR/default-body-with-rpit.rs:12:39 + | +LL | async fn baz(&self) -> impl Debug { + | _______________________________________^ +LL | | "" +LL | | } + | |_____^ + +error[E0720]: cannot resolve opaque type + --> $DIR/default-body-with-rpit.rs:12:28 + | +LL | async fn baz(&self) -> impl Debug { + | ^^^^^^^^^^ cannot resolve opaque type + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0720`. diff --git a/tests/ui/impl-trait/in-trait/default-body-with-rpit.next.stderr b/tests/ui/impl-trait/in-trait/default-body-with-rpit.next.stderr new file mode 100644 index 000000000..3c24eff9a --- /dev/null +++ b/tests/ui/impl-trait/in-trait/default-body-with-rpit.next.stderr @@ -0,0 +1,24 @@ +error: concrete type differs from previous defining opaque type use + --> $DIR/default-body-with-rpit.rs:13:9 + | +LL | "" + | ^^ expected `impl Debug`, got `&'static str` + | +note: previous use here + --> $DIR/default-body-with-rpit.rs:12:39 + | +LL | async fn baz(&self) -> impl Debug { + | _______________________________________^ +LL | | "" +LL | | } + | |_____^ + +error[E0720]: cannot resolve opaque type + --> $DIR/default-body-with-rpit.rs:12:28 + | +LL | async fn baz(&self) -> impl Debug { + | ^^^^^^^^^^ cannot resolve opaque type + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0720`. diff --git a/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs b/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs index ad3cc7c25..6bcc7b9ef 100644 --- a/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs +++ b/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs @@ -1,5 +1,7 @@ -// check-pass // edition:2021 +// known-bug: #108304 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait, return_position_impl_trait_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/impl-trait/in-trait/default-body.rs b/tests/ui/impl-trait/in-trait/default-body.rs index b0baf5bb1..ab6a51c6b 100644 --- a/tests/ui/impl-trait/in-trait/default-body.rs +++ b/tests/ui/impl-trait/in-trait/default-body.rs @@ -1,5 +1,7 @@ // check-pass // edition:2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait, return_position_impl_trait_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/impl-trait/in-trait/default-method-binder-shifting.current.stderr b/tests/ui/impl-trait/in-trait/default-method-binder-shifting.current.stderr new file mode 100644 index 000000000..a0c0589b9 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/default-method-binder-shifting.current.stderr @@ -0,0 +1,11 @@ +warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/default-method-binder-shifting.rs:5:12 + | +LL | #![feature(return_position_impl_trait_in_trait)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/impl-trait/in-trait/default-method-binder-shifting.next.stderr b/tests/ui/impl-trait/in-trait/default-method-binder-shifting.next.stderr new file mode 100644 index 000000000..a0c0589b9 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/default-method-binder-shifting.next.stderr @@ -0,0 +1,11 @@ +warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/default-method-binder-shifting.rs:5:12 + | +LL | #![feature(return_position_impl_trait_in_trait)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs b/tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs new file mode 100644 index 000000000..de82544f2 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs @@ -0,0 +1,22 @@ +// check-pass +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next + +#![feature(return_position_impl_trait_in_trait)] +//~^ WARN the feature `return_position_impl_trait_in_trait` is incomplete + +trait Trait { + type Type; + + // Check that we're adjusting bound vars correctly when installing the default + // method projection assumptions. + fn method(&self) -> impl Trait; +} + +trait Trait2 { + type Type; + + fn method(&self) -> impl Trait2 + '_>; +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/default-method-constraint.current.stderr b/tests/ui/impl-trait/in-trait/default-method-constraint.current.stderr new file mode 100644 index 000000000..7bb79911f --- /dev/null +++ b/tests/ui/impl-trait/in-trait/default-method-constraint.current.stderr @@ -0,0 +1,11 @@ +warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/default-method-constraint.rs:7:12 + | +LL | #![feature(return_position_impl_trait_in_trait)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/impl-trait/in-trait/default-method-constraint.next.stderr b/tests/ui/impl-trait/in-trait/default-method-constraint.next.stderr new file mode 100644 index 000000000..7bb79911f --- /dev/null +++ b/tests/ui/impl-trait/in-trait/default-method-constraint.next.stderr @@ -0,0 +1,11 @@ +warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/default-method-constraint.rs:7:12 + | +LL | #![feature(return_position_impl_trait_in_trait)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/impl-trait/in-trait/default-method-constraint.rs b/tests/ui/impl-trait/in-trait/default-method-constraint.rs index 8c50cc295..e85fe3c86 100644 --- a/tests/ui/impl-trait/in-trait/default-method-constraint.rs +++ b/tests/ui/impl-trait/in-trait/default-method-constraint.rs @@ -1,4 +1,6 @@ // check-pass +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next // This didn't work in the previous default RPITIT method hack attempt diff --git a/tests/ui/impl-trait/in-trait/default-method-constraint.stderr b/tests/ui/impl-trait/in-trait/default-method-constraint.stderr deleted file mode 100644 index 5e18605aa..000000000 --- a/tests/ui/impl-trait/in-trait/default-method-constraint.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/default-method-constraint.rs:5:12 - | -LL | #![feature(return_position_impl_trait_in_trait)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #91611 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/impl-trait/in-trait/doesnt-satisfy.current.stderr b/tests/ui/impl-trait/in-trait/doesnt-satisfy.current.stderr new file mode 100644 index 000000000..653016cf0 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/doesnt-satisfy.current.stderr @@ -0,0 +1,17 @@ +error[E0277]: `()` doesn't implement `std::fmt::Display` + --> $DIR/doesnt-satisfy.rs:12:17 + | +LL | fn bar() -> () {} + | ^^ `()` cannot be formatted with the default formatter + | + = help: the trait `std::fmt::Display` is not implemented for `()` + = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead +note: required by a bound in `Foo::bar::{opaque#0}` + --> $DIR/doesnt-satisfy.rs:8:22 + | +LL | fn bar() -> impl std::fmt::Display; + | ^^^^^^^^^^^^^^^^^ required by this bound in `Foo::bar::{opaque#0}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/in-trait/doesnt-satisfy.next.stderr b/tests/ui/impl-trait/in-trait/doesnt-satisfy.next.stderr new file mode 100644 index 000000000..f0cd43bcf --- /dev/null +++ b/tests/ui/impl-trait/in-trait/doesnt-satisfy.next.stderr @@ -0,0 +1,17 @@ +error[E0277]: `()` doesn't implement `std::fmt::Display` + --> $DIR/doesnt-satisfy.rs:12:17 + | +LL | fn bar() -> () {} + | ^^ `()` cannot be formatted with the default formatter + | + = help: the trait `std::fmt::Display` is not implemented for `()` + = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead +note: required by a bound in `Foo::{opaque#0}` + --> $DIR/doesnt-satisfy.rs:8:22 + | +LL | fn bar() -> impl std::fmt::Display; + | ^^^^^^^^^^^^^^^^^ required by this bound in `Foo::{opaque#0}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/in-trait/doesnt-satisfy.rs b/tests/ui/impl-trait/in-trait/doesnt-satisfy.rs index bb4e0d44f..fcd0b51ee 100644 --- a/tests/ui/impl-trait/in-trait/doesnt-satisfy.rs +++ b/tests/ui/impl-trait/in-trait/doesnt-satisfy.rs @@ -1,3 +1,6 @@ +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next + #![feature(return_position_impl_trait_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr b/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr deleted file mode 100644 index aa5492d28..000000000 --- a/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0277]: `()` doesn't implement `std::fmt::Display` - --> $DIR/doesnt-satisfy.rs:9:17 - | -LL | fn bar() -> () {} - | ^^ `()` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `()` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `Foo::bar::{opaque#0}` - --> $DIR/doesnt-satisfy.rs:5:22 - | -LL | fn bar() -> impl std::fmt::Display; - | ^^^^^^^^^^^^^^^^^ required by this bound in `Foo::bar::{opaque#0}` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.current.stderr b/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.current.stderr new file mode 100644 index 000000000..b8a793e1a --- /dev/null +++ b/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.current.stderr @@ -0,0 +1,21 @@ +warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/dont-project-to-rpitit-with-no-value.rs:4:12 + | +LL | #![feature(return_position_impl_trait_in_trait)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0046]: not all trait items implemented, missing: `foo` + --> $DIR/dont-project-to-rpitit-with-no-value.rs:12:1 + | +LL | fn foo(&self) -> impl Sized; + | ---------------------------- `foo` from trait +... +LL | impl MyTrait for i32 { + | ^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0046`. diff --git a/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.next.stderr b/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.next.stderr new file mode 100644 index 000000000..b8a793e1a --- /dev/null +++ b/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.next.stderr @@ -0,0 +1,21 @@ +warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/dont-project-to-rpitit-with-no-value.rs:4:12 + | +LL | #![feature(return_position_impl_trait_in_trait)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0046]: not all trait items implemented, missing: `foo` + --> $DIR/dont-project-to-rpitit-with-no-value.rs:12:1 + | +LL | fn foo(&self) -> impl Sized; + | ---------------------------- `foo` from trait +... +LL | impl MyTrait for i32 { + | ^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0046`. diff --git a/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs b/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs new file mode 100644 index 000000000..8329ce1f8 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs @@ -0,0 +1,19 @@ +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next + +#![feature(return_position_impl_trait_in_trait)] +//~^ WARN the feature `return_position_impl_trait_in_trait` is incomplete + +trait MyTrait { + fn foo(&self) -> impl Sized; + fn bar(&self) -> impl Sized; +} + +impl MyTrait for i32 { + //~^ ERROR not all trait items implemented, missing: `foo` + fn bar(&self) -> impl Sized { + self.foo() + } +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/early.rs b/tests/ui/impl-trait/in-trait/early.rs index 9c1c2b503..831033a58 100644 --- a/tests/ui/impl-trait/in-trait/early.rs +++ b/tests/ui/impl-trait/in-trait/early.rs @@ -1,5 +1,7 @@ // check-pass // edition:2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait, return_position_impl_trait_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/impl-trait/in-trait/encode.rs b/tests/ui/impl-trait/in-trait/encode.rs index efb9f6498..98aaf4a65 100644 --- a/tests/ui/impl-trait/in-trait/encode.rs +++ b/tests/ui/impl-trait/in-trait/encode.rs @@ -1,5 +1,7 @@ // build-pass // compile-flags: --crate-type=lib +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(return_position_impl_trait_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/impl-trait/in-trait/foreign.rs b/tests/ui/impl-trait/in-trait/foreign.rs index 6341f5b42..f4972d948 100644 --- a/tests/ui/impl-trait/in-trait/foreign.rs +++ b/tests/ui/impl-trait/in-trait/foreign.rs @@ -1,9 +1,21 @@ // check-pass // aux-build: rpitit.rs +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next extern crate rpitit; +use std::sync::Arc; + +// Implement an RPITIT from another crate. +struct Local; +impl rpitit::Foo for Local { + fn bar() -> Arc { Arc::new(String::new()) } +} + fn main() { - // Witness an RPITIT from another crate - let () = ::bar(); + // Witness an RPITIT from another crate. + let &() = ::bar(); + + let x: Arc = ::bar(); } diff --git a/tests/ui/impl-trait/in-trait/generics-mismatch.current.stderr b/tests/ui/impl-trait/in-trait/generics-mismatch.current.stderr new file mode 100644 index 000000000..310edbcb6 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/generics-mismatch.current.stderr @@ -0,0 +1,12 @@ +error[E0049]: method `bar` has 1 type parameter but its trait declaration has 0 type parameters + --> $DIR/generics-mismatch.rs:14:12 + | +LL | fn bar(&self) -> impl Sized; + | - expected 0 type parameters +... +LL | fn bar(&self) {} + | ^ found 1 type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0049`. diff --git a/tests/ui/impl-trait/in-trait/generics-mismatch.next.stderr b/tests/ui/impl-trait/in-trait/generics-mismatch.next.stderr new file mode 100644 index 000000000..310edbcb6 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/generics-mismatch.next.stderr @@ -0,0 +1,12 @@ +error[E0049]: method `bar` has 1 type parameter but its trait declaration has 0 type parameters + --> $DIR/generics-mismatch.rs:14:12 + | +LL | fn bar(&self) -> impl Sized; + | - expected 0 type parameters +... +LL | fn bar(&self) {} + | ^ found 1 type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0049`. diff --git a/tests/ui/impl-trait/in-trait/generics-mismatch.rs b/tests/ui/impl-trait/in-trait/generics-mismatch.rs index cc0fc720e..9259ca193 100644 --- a/tests/ui/impl-trait/in-trait/generics-mismatch.rs +++ b/tests/ui/impl-trait/in-trait/generics-mismatch.rs @@ -1,3 +1,6 @@ +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next + #![feature(return_position_impl_trait_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/impl-trait/in-trait/generics-mismatch.stderr b/tests/ui/impl-trait/in-trait/generics-mismatch.stderr deleted file mode 100644 index cd42683e0..000000000 --- a/tests/ui/impl-trait/in-trait/generics-mismatch.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0049]: method `bar` has 1 type parameter but its trait declaration has 0 type parameters - --> $DIR/generics-mismatch.rs:11:12 - | -LL | fn bar(&self) -> impl Sized; - | - expected 0 type parameters -... -LL | fn bar(&self) {} - | ^ found 1 type parameter - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0049`. diff --git a/tests/ui/impl-trait/in-trait/issue-102140.current.stderr b/tests/ui/impl-trait/in-trait/issue-102140.current.stderr new file mode 100644 index 000000000..7aa7880e2 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/issue-102140.current.stderr @@ -0,0 +1,33 @@ +error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied + --> $DIR/issue-102140.rs:26:22 + | +LL | MyTrait::foo(&self) + | ------------ ^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait` + | | + | required by a bound introduced by this call + | +help: consider removing the leading `&`-reference + | +LL - MyTrait::foo(&self) +LL + MyTrait::foo(self) + | + +error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied + --> $DIR/issue-102140.rs:26:9 + | +LL | MyTrait::foo(&self) + | ^^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait` + | + = help: the trait `MyTrait` is implemented for `Outer` + +error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied + --> $DIR/issue-102140.rs:26:9 + | +LL | MyTrait::foo(&self) + | ^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait` + | + = help: the trait `MyTrait` is implemented for `Outer` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/in-trait/issue-102140.next.stderr b/tests/ui/impl-trait/in-trait/issue-102140.next.stderr new file mode 100644 index 000000000..7aa7880e2 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/issue-102140.next.stderr @@ -0,0 +1,33 @@ +error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied + --> $DIR/issue-102140.rs:26:22 + | +LL | MyTrait::foo(&self) + | ------------ ^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait` + | | + | required by a bound introduced by this call + | +help: consider removing the leading `&`-reference + | +LL - MyTrait::foo(&self) +LL + MyTrait::foo(self) + | + +error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied + --> $DIR/issue-102140.rs:26:9 + | +LL | MyTrait::foo(&self) + | ^^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait` + | + = help: the trait `MyTrait` is implemented for `Outer` + +error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied + --> $DIR/issue-102140.rs:26:9 + | +LL | MyTrait::foo(&self) + | ^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait` + | + = help: the trait `MyTrait` is implemented for `Outer` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/in-trait/issue-102140.rs b/tests/ui/impl-trait/in-trait/issue-102140.rs index be1e012ac..4dcac4f5b 100644 --- a/tests/ui/impl-trait/in-trait/issue-102140.rs +++ b/tests/ui/impl-trait/in-trait/issue-102140.rs @@ -1,3 +1,6 @@ +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next + #![feature(return_position_impl_trait_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/impl-trait/in-trait/issue-102140.stderr b/tests/ui/impl-trait/in-trait/issue-102140.stderr deleted file mode 100644 index 18bb63745..000000000 --- a/tests/ui/impl-trait/in-trait/issue-102140.stderr +++ /dev/null @@ -1,33 +0,0 @@ -error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied - --> $DIR/issue-102140.rs:23:22 - | -LL | MyTrait::foo(&self) - | ------------ ^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait` - | | - | required by a bound introduced by this call - | -help: consider removing the leading `&`-reference - | -LL - MyTrait::foo(&self) -LL + MyTrait::foo(self) - | - -error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied - --> $DIR/issue-102140.rs:23:9 - | -LL | MyTrait::foo(&self) - | ^^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait` - | - = help: the trait `MyTrait` is implemented for `Outer` - -error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied - --> $DIR/issue-102140.rs:23:9 - | -LL | MyTrait::foo(&self) - | ^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait` - | - = help: the trait `MyTrait` is implemented for `Outer` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/in-trait/issue-102301.rs b/tests/ui/impl-trait/in-trait/issue-102301.rs index a93714a65..1329ca29d 100644 --- a/tests/ui/impl-trait/in-trait/issue-102301.rs +++ b/tests/ui/impl-trait/in-trait/issue-102301.rs @@ -1,4 +1,6 @@ // check-pass +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(return_position_impl_trait_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/impl-trait/in-trait/issue-102571.current.stderr b/tests/ui/impl-trait/in-trait/issue-102571.current.stderr new file mode 100644 index 000000000..cac9a29f6 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/issue-102571.current.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/issue-102571.rs:23:9 + | +LL | let () = t.bar(); + | ^^ ------- this expression has type `impl Deref` + | | + | expected associated type, found `()` + | + = note: expected associated type `impl Deref` + found unit type `()` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/impl-trait/in-trait/issue-102571.next.stderr b/tests/ui/impl-trait/in-trait/issue-102571.next.stderr new file mode 100644 index 000000000..cac9a29f6 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/issue-102571.next.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/issue-102571.rs:23:9 + | +LL | let () = t.bar(); + | ^^ ------- this expression has type `impl Deref` + | | + | expected associated type, found `()` + | + = note: expected associated type `impl Deref` + found unit type `()` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/impl-trait/in-trait/issue-102571.rs b/tests/ui/impl-trait/in-trait/issue-102571.rs index 61c91e644..f0ddab5e7 100644 --- a/tests/ui/impl-trait/in-trait/issue-102571.rs +++ b/tests/ui/impl-trait/in-trait/issue-102571.rs @@ -1,3 +1,6 @@ +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next + #![feature(return_position_impl_trait_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/impl-trait/in-trait/issue-102571.stderr b/tests/ui/impl-trait/in-trait/issue-102571.stderr deleted file mode 100644 index 87219941d..000000000 --- a/tests/ui/impl-trait/in-trait/issue-102571.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-102571.rs:20:9 - | -LL | let () = t.bar(); - | ^^ ------- this expression has type `impl Deref` - | | - | expected associated type, found `()` - | - = note: expected associated type `impl Deref` - found unit type `()` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/impl-trait/in-trait/nested-rpitit.rs b/tests/ui/impl-trait/in-trait/nested-rpitit.rs index 65285e3a3..360207537 100644 --- a/tests/ui/impl-trait/in-trait/nested-rpitit.rs +++ b/tests/ui/impl-trait/in-trait/nested-rpitit.rs @@ -1,4 +1,6 @@ // check-pass +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(return_position_impl_trait_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/impl-trait/in-trait/new-lowering-strategy/simple-trait.rs b/tests/ui/impl-trait/in-trait/new-lowering-strategy/simple-trait.rs deleted file mode 100644 index dfce973d7..000000000 --- a/tests/ui/impl-trait/in-trait/new-lowering-strategy/simple-trait.rs +++ /dev/null @@ -1,11 +0,0 @@ -// check-pass -// compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty - -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -trait Foo { - fn foo() -> impl Sized; -} - -fn main() {} diff --git a/tests/ui/impl-trait/in-trait/object-safety.current.stderr b/tests/ui/impl-trait/in-trait/object-safety.current.stderr new file mode 100644 index 000000000..b7f2b019a --- /dev/null +++ b/tests/ui/impl-trait/in-trait/object-safety.current.stderr @@ -0,0 +1,50 @@ +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/object-safety.rs:20:33 + | +LL | let i = Box::new(42_u32) as Box; + | ^^^^^^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/object-safety.rs:10:22 + | +LL | trait Foo { + | --- this trait cannot be made into an object... +LL | fn baz(&self) -> impl Debug; + | ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type + = help: consider moving `baz` to another trait + +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/object-safety.rs:23:13 + | +LL | let s = i.baz(); + | ^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/object-safety.rs:10:22 + | +LL | trait Foo { + | --- this trait cannot be made into an object... +LL | fn baz(&self) -> impl Debug; + | ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type + = help: consider moving `baz` to another trait + +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/object-safety.rs:20:13 + | +LL | let i = Box::new(42_u32) as Box; + | ^^^^^^^^^^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/object-safety.rs:10:22 + | +LL | trait Foo { + | --- this trait cannot be made into an object... +LL | fn baz(&self) -> impl Debug; + | ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type + = help: consider moving `baz` to another trait + = note: required for `Box` to implement `CoerceUnsized>` + = note: required by cast to type `Box` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/impl-trait/in-trait/object-safety.next.stderr b/tests/ui/impl-trait/in-trait/object-safety.next.stderr new file mode 100644 index 000000000..b7f2b019a --- /dev/null +++ b/tests/ui/impl-trait/in-trait/object-safety.next.stderr @@ -0,0 +1,50 @@ +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/object-safety.rs:20:33 + | +LL | let i = Box::new(42_u32) as Box; + | ^^^^^^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/object-safety.rs:10:22 + | +LL | trait Foo { + | --- this trait cannot be made into an object... +LL | fn baz(&self) -> impl Debug; + | ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type + = help: consider moving `baz` to another trait + +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/object-safety.rs:23:13 + | +LL | let s = i.baz(); + | ^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/object-safety.rs:10:22 + | +LL | trait Foo { + | --- this trait cannot be made into an object... +LL | fn baz(&self) -> impl Debug; + | ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type + = help: consider moving `baz` to another trait + +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/object-safety.rs:20:13 + | +LL | let i = Box::new(42_u32) as Box; + | ^^^^^^^^^^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/object-safety.rs:10:22 + | +LL | trait Foo { + | --- this trait cannot be made into an object... +LL | fn baz(&self) -> impl Debug; + | ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type + = help: consider moving `baz` to another trait + = note: required for `Box` to implement `CoerceUnsized>` + = note: required by cast to type `Box` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/impl-trait/in-trait/object-safety.rs b/tests/ui/impl-trait/in-trait/object-safety.rs index dd35b9a2d..016a0aaae 100644 --- a/tests/ui/impl-trait/in-trait/object-safety.rs +++ b/tests/ui/impl-trait/in-trait/object-safety.rs @@ -1,3 +1,6 @@ +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next + #![feature(return_position_impl_trait_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/impl-trait/in-trait/object-safety.stderr b/tests/ui/impl-trait/in-trait/object-safety.stderr deleted file mode 100644 index ca0e760ff..000000000 --- a/tests/ui/impl-trait/in-trait/object-safety.stderr +++ /dev/null @@ -1,50 +0,0 @@ -error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/object-safety.rs:17:33 - | -LL | let i = Box::new(42_u32) as Box; - | ^^^^^^^^^^^^ `Foo` cannot be made into an object - | -note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit - --> $DIR/object-safety.rs:7:22 - | -LL | trait Foo { - | --- this trait cannot be made into an object... -LL | fn baz(&self) -> impl Debug; - | ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type - = help: consider moving `baz` to another trait - -error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/object-safety.rs:20:13 - | -LL | let s = i.baz(); - | ^^^^^^^ `Foo` cannot be made into an object - | -note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit - --> $DIR/object-safety.rs:7:22 - | -LL | trait Foo { - | --- this trait cannot be made into an object... -LL | fn baz(&self) -> impl Debug; - | ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type - = help: consider moving `baz` to another trait - -error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/object-safety.rs:17:13 - | -LL | let i = Box::new(42_u32) as Box; - | ^^^^^^^^^^^^^^^^ `Foo` cannot be made into an object - | -note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit - --> $DIR/object-safety.rs:7:22 - | -LL | trait Foo { - | --- this trait cannot be made into an object... -LL | fn baz(&self) -> impl Debug; - | ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type - = help: consider moving `baz` to another trait - = note: required for `Box` to implement `CoerceUnsized>` - = note: required by cast to type `Box` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.current.stderr b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.current.stderr new file mode 100644 index 000000000..a57653b2c --- /dev/null +++ b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.current.stderr @@ -0,0 +1,17 @@ +error[E0308]: mismatched types + --> $DIR/opaque-in-impl-is-opaque.rs:20:19 + | +LL | fn bar(&self) -> impl Display { + | ------------ the found opaque type +... +LL | let x: &str = ().bar(); + | ---- ^^^^^^^^ expected `&str`, found opaque type + | | + | expected due to this + | + = note: expected reference `&str` + found opaque type `impl std::fmt::Display` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.next.stderr b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.next.stderr new file mode 100644 index 000000000..a57653b2c --- /dev/null +++ b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.next.stderr @@ -0,0 +1,17 @@ +error[E0308]: mismatched types + --> $DIR/opaque-in-impl-is-opaque.rs:20:19 + | +LL | fn bar(&self) -> impl Display { + | ------------ the found opaque type +... +LL | let x: &str = ().bar(); + | ---- ^^^^^^^^ expected `&str`, found opaque type + | | + | expected due to this + | + = note: expected reference `&str` + found opaque type `impl std::fmt::Display` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs index 3ac264e8e..c07ece15a 100644 --- a/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs +++ b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs @@ -1,3 +1,6 @@ +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next + #![feature(return_position_impl_trait_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr deleted file mode 100644 index 15edda483..000000000 --- a/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/opaque-in-impl-is-opaque.rs:17:19 - | -LL | fn bar(&self) -> impl Display { - | ------------ the found opaque type -... -LL | let x: &str = ().bar(); - | ---- ^^^^^^^^ expected `&str`, found opaque type - | | - | expected due to this - | - = note: expected reference `&str` - found opaque type `impl std::fmt::Display` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/impl-trait/in-trait/opaque-in-impl.rs b/tests/ui/impl-trait/in-trait/opaque-in-impl.rs index 2e0662969..f48d9fa26 100644 --- a/tests/ui/impl-trait/in-trait/opaque-in-impl.rs +++ b/tests/ui/impl-trait/in-trait/opaque-in-impl.rs @@ -1,4 +1,6 @@ // check-pass +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(return_position_impl_trait_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/impl-trait/in-trait/reveal.rs b/tests/ui/impl-trait/in-trait/reveal.rs index d6ede1cc4..1f42ec744 100644 --- a/tests/ui/impl-trait/in-trait/reveal.rs +++ b/tests/ui/impl-trait/in-trait/reveal.rs @@ -1,4 +1,6 @@ // check-pass +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(return_position_impl_trait_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.current.stderr b/tests/ui/impl-trait/in-trait/signature-mismatch.current.stderr new file mode 100644 index 000000000..eba270af7 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/signature-mismatch.current.stderr @@ -0,0 +1,16 @@ +error: `impl` item signature doesn't match `trait` item signature + --> $DIR/signature-mismatch.rs:17:5 + | +LL | fn async_fn(&self, buff: &[u8]) -> impl Future>; + | ----------------------------------------------------------------- expected `fn(&'1 Struct, &'2 [u8]) -> impl Future> + '3` +... +LL | fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future> + 'a { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Struct, &'2 [u8]) -> impl Future> + '2` + | + = note: expected signature `fn(&'1 Struct, &'2 [u8]) -> impl Future> + '3` + found signature `fn(&'1 Struct, &'2 [u8]) -> impl Future> + '2` + = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` + = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output + +error: aborting due to previous error + diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.next.stderr b/tests/ui/impl-trait/in-trait/signature-mismatch.next.stderr new file mode 100644 index 000000000..eba270af7 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/signature-mismatch.next.stderr @@ -0,0 +1,16 @@ +error: `impl` item signature doesn't match `trait` item signature + --> $DIR/signature-mismatch.rs:17:5 + | +LL | fn async_fn(&self, buff: &[u8]) -> impl Future>; + | ----------------------------------------------------------------- expected `fn(&'1 Struct, &'2 [u8]) -> impl Future> + '3` +... +LL | fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future> + 'a { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Struct, &'2 [u8]) -> impl Future> + '2` + | + = note: expected signature `fn(&'1 Struct, &'2 [u8]) -> impl Future> + '3` + found signature `fn(&'1 Struct, &'2 [u8]) -> impl Future> + '2` + = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` + = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output + +error: aborting due to previous error + diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.rs b/tests/ui/impl-trait/in-trait/signature-mismatch.rs index 90682631a..38c902a97 100644 --- a/tests/ui/impl-trait/in-trait/signature-mismatch.rs +++ b/tests/ui/impl-trait/in-trait/signature-mismatch.rs @@ -1,4 +1,6 @@ // edition:2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(return_position_impl_trait_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.stderr b/tests/ui/impl-trait/in-trait/signature-mismatch.stderr deleted file mode 100644 index c4fcaabe4..000000000 --- a/tests/ui/impl-trait/in-trait/signature-mismatch.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error: `impl` item signature doesn't match `trait` item signature - --> $DIR/signature-mismatch.rs:15:5 - | -LL | fn async_fn(&self, buff: &[u8]) -> impl Future>; - | ----------------------------------------------------------------- expected `fn(&'1 Struct, &'2 [u8]) -> impl Future> + '3` -... -LL | fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future> + 'a { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Struct, &'2 [u8]) -> impl Future> + '2` - | - = note: expected signature `fn(&'1 Struct, &'2 [u8]) -> impl Future> + '3` - found signature `fn(&'1 Struct, &'2 [u8]) -> impl Future> + '2` - = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` - = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output - -error: aborting due to previous error - diff --git a/tests/ui/impl-trait/in-trait/specialization-broken.current.stderr b/tests/ui/impl-trait/in-trait/specialization-broken.current.stderr new file mode 100644 index 000000000..f48e7a1ed --- /dev/null +++ b/tests/ui/impl-trait/in-trait/specialization-broken.current.stderr @@ -0,0 +1,31 @@ +error[E0053]: method `bar` has an incompatible type for trait + --> $DIR/specialization-broken.rs:19:22 + | +LL | default impl Foo for U + | - this type parameter +... +LL | fn bar(&self) -> U { + | ^ + | | + | expected associated type, found type parameter `U` + | help: change the output type to match the trait: `impl Sized` + | +note: type in trait + --> $DIR/specialization-broken.rs:12:22 + | +LL | fn bar(&self) -> impl Sized; + | ^^^^^^^^^^ + = note: expected signature `fn(&U) -> impl Sized` + found signature `fn(&U) -> U` + +error: method with return-position `impl Trait` in trait cannot be specialized + --> $DIR/specialization-broken.rs:19:5 + | +LL | fn bar(&self) -> U { + | ^^^^^^^^^^^^^^^^^^ + | + = note: specialization behaves in inconsistent and surprising ways with `#![feature(return_position_impl_trait_in_trait)]`, and for now is disallowed + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0053`. diff --git a/tests/ui/impl-trait/in-trait/specialization-broken.next.stderr b/tests/ui/impl-trait/in-trait/specialization-broken.next.stderr new file mode 100644 index 000000000..f48e7a1ed --- /dev/null +++ b/tests/ui/impl-trait/in-trait/specialization-broken.next.stderr @@ -0,0 +1,31 @@ +error[E0053]: method `bar` has an incompatible type for trait + --> $DIR/specialization-broken.rs:19:22 + | +LL | default impl Foo for U + | - this type parameter +... +LL | fn bar(&self) -> U { + | ^ + | | + | expected associated type, found type parameter `U` + | help: change the output type to match the trait: `impl Sized` + | +note: type in trait + --> $DIR/specialization-broken.rs:12:22 + | +LL | fn bar(&self) -> impl Sized; + | ^^^^^^^^^^ + = note: expected signature `fn(&U) -> impl Sized` + found signature `fn(&U) -> U` + +error: method with return-position `impl Trait` in trait cannot be specialized + --> $DIR/specialization-broken.rs:19:5 + | +LL | fn bar(&self) -> U { + | ^^^^^^^^^^^^^^^^^^ + | + = note: specialization behaves in inconsistent and surprising ways with `#![feature(return_position_impl_trait_in_trait)]`, and for now is disallowed + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0053`. diff --git a/tests/ui/impl-trait/in-trait/specialization-broken.rs b/tests/ui/impl-trait/in-trait/specialization-broken.rs index 2fcffdf3f..658d07097 100644 --- a/tests/ui/impl-trait/in-trait/specialization-broken.rs +++ b/tests/ui/impl-trait/in-trait/specialization-broken.rs @@ -1,3 +1,6 @@ +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next + // FIXME(compiler-errors): I'm not exactly sure if this is expected to pass or not. // But we fixed an ICE anyways. diff --git a/tests/ui/impl-trait/in-trait/specialization-broken.stderr b/tests/ui/impl-trait/in-trait/specialization-broken.stderr deleted file mode 100644 index dc621d6b8..000000000 --- a/tests/ui/impl-trait/in-trait/specialization-broken.stderr +++ /dev/null @@ -1,31 +0,0 @@ -error[E0053]: method `bar` has an incompatible type for trait - --> $DIR/specialization-broken.rs:16:22 - | -LL | default impl Foo for U - | - this type parameter -... -LL | fn bar(&self) -> U { - | ^ - | | - | expected associated type, found type parameter `U` - | help: change the output type to match the trait: `impl Sized` - | -note: type in trait - --> $DIR/specialization-broken.rs:9:22 - | -LL | fn bar(&self) -> impl Sized; - | ^^^^^^^^^^ - = note: expected signature `fn(&U) -> impl Sized` - found signature `fn(&U) -> U` - -error: method with return-position `impl Trait` in trait cannot be specialized - --> $DIR/specialization-broken.rs:16:5 - | -LL | fn bar(&self) -> U { - | ^^^^^^^^^^^^^^^^^^ - | - = note: specialization behaves in inconsistent and surprising ways with `#![feature(return_position_impl_trait_in_trait)]`, and for now is disallowed - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0053`. diff --git a/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs b/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs index c9ee877db..dbc5d38f1 100644 --- a/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs +++ b/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs @@ -1,4 +1,6 @@ // check-pass +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(specialization)] #![feature(return_position_impl_trait_in_trait)] diff --git a/tests/ui/impl-trait/in-trait/success.rs b/tests/ui/impl-trait/in-trait/success.rs index 4cbe682b4..0e69e0490 100644 --- a/tests/ui/impl-trait/in-trait/success.rs +++ b/tests/ui/impl-trait/in-trait/success.rs @@ -1,4 +1,6 @@ // check-pass +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(return_position_impl_trait_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.current.stderr b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.current.stderr new file mode 100644 index 000000000..64c942705 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.current.stderr @@ -0,0 +1,12 @@ +error[E0049]: method `bar` has 0 type parameters but its trait declaration has 1 type parameter + --> $DIR/trait-more-generics-than-impl.rs:14:11 + | +LL | fn bar() -> impl Sized; + | - expected 1 type parameter +... +LL | fn bar() -> impl Sized {} + | ^ found 0 type parameters + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0049`. diff --git a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.next.stderr b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.next.stderr new file mode 100644 index 000000000..64c942705 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.next.stderr @@ -0,0 +1,12 @@ +error[E0049]: method `bar` has 0 type parameters but its trait declaration has 1 type parameter + --> $DIR/trait-more-generics-than-impl.rs:14:11 + | +LL | fn bar() -> impl Sized; + | - expected 1 type parameter +... +LL | fn bar() -> impl Sized {} + | ^ found 0 type parameters + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0049`. diff --git a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs index 0bbe50ea6..c2e394a1f 100644 --- a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs +++ b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs @@ -1,3 +1,6 @@ +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next + #![feature(return_position_impl_trait_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr deleted file mode 100644 index 8ff54cad9..000000000 --- a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0049]: method `bar` has 0 type parameters but its trait declaration has 1 type parameter - --> $DIR/trait-more-generics-than-impl.rs:11:11 - | -LL | fn bar() -> impl Sized; - | - expected 1 type parameter -... -LL | fn bar() -> impl Sized {} - | ^ found 0 type parameters - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0049`. diff --git a/tests/ui/impl-trait/in-trait/wf-bounds.current.stderr b/tests/ui/impl-trait/in-trait/wf-bounds.current.stderr new file mode 100644 index 000000000..1a7071612 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/wf-bounds.current.stderr @@ -0,0 +1,40 @@ +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/wf-bounds.rs:13:22 + | +LL | fn nya() -> impl Wf>; + | ^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[u8]` +note: required by a bound in `Vec` + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/wf-bounds.rs:16:23 + | +LL | fn nya2() -> impl Wf<[u8]>; + | ^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[u8]` +note: required by a bound in `Wf` + --> $DIR/wf-bounds.rs:8:10 + | +LL | trait Wf { + | ^ required by this bound in `Wf` +help: consider relaxing the implicit `Sized` restriction + | +LL | trait Wf { + | ++++++++ + +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/wf-bounds.rs:19:44 + | +LL | fn nya3() -> impl Wf<(), Output = impl Wf>>; + | ^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[u8]` +note: required by a bound in `Vec` + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/in-trait/wf-bounds.next.stderr b/tests/ui/impl-trait/in-trait/wf-bounds.next.stderr new file mode 100644 index 000000000..1a7071612 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/wf-bounds.next.stderr @@ -0,0 +1,40 @@ +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/wf-bounds.rs:13:22 + | +LL | fn nya() -> impl Wf>; + | ^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[u8]` +note: required by a bound in `Vec` + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/wf-bounds.rs:16:23 + | +LL | fn nya2() -> impl Wf<[u8]>; + | ^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[u8]` +note: required by a bound in `Wf` + --> $DIR/wf-bounds.rs:8:10 + | +LL | trait Wf { + | ^ required by this bound in `Wf` +help: consider relaxing the implicit `Sized` restriction + | +LL | trait Wf { + | ++++++++ + +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/wf-bounds.rs:19:44 + | +LL | fn nya3() -> impl Wf<(), Output = impl Wf>>; + | ^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[u8]` +note: required by a bound in `Vec` + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/in-trait/wf-bounds.rs b/tests/ui/impl-trait/in-trait/wf-bounds.rs index 2c71583b3..1c9590bd8 100644 --- a/tests/ui/impl-trait/in-trait/wf-bounds.rs +++ b/tests/ui/impl-trait/in-trait/wf-bounds.rs @@ -1,9 +1,13 @@ // issue #101663 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(return_position_impl_trait_in_trait)] #![allow(incomplete_features)] -trait Wf {} +trait Wf { + type Output; +} trait Uwu { fn nya() -> impl Wf>; @@ -11,6 +15,9 @@ trait Uwu { fn nya2() -> impl Wf<[u8]>; //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time + + fn nya3() -> impl Wf<(), Output = impl Wf>>; + //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time } fn main() {} diff --git a/tests/ui/impl-trait/in-trait/wf-bounds.stderr b/tests/ui/impl-trait/in-trait/wf-bounds.stderr deleted file mode 100644 index 03cc4c2b9..000000000 --- a/tests/ui/impl-trait/in-trait/wf-bounds.stderr +++ /dev/null @@ -1,30 +0,0 @@ -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/wf-bounds.rs:9:22 - | -LL | fn nya() -> impl Wf>; - | ^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `Vec` - --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/wf-bounds.rs:12:23 - | -LL | fn nya2() -> impl Wf<[u8]>; - | ^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `Wf` - --> $DIR/wf-bounds.rs:6:10 - | -LL | trait Wf {} - | ^ required by this bound in `Wf` -help: consider relaxing the implicit `Sized` restriction - | -LL | trait Wf {} - | ++++++++ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/in-trait/where-clause.rs b/tests/ui/impl-trait/in-trait/where-clause.rs index 87bac519c..88d86e2b5 100644 --- a/tests/ui/impl-trait/in-trait/where-clause.rs +++ b/tests/ui/impl-trait/in-trait/where-clause.rs @@ -1,5 +1,7 @@ // check-pass // edition: 2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(return_position_impl_trait_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/impl-trait/issue-55872-1.rs b/tests/ui/impl-trait/issue-55872-1.rs index 22ff7ffa2..f36a310dd 100644 --- a/tests/ui/impl-trait/issue-55872-1.rs +++ b/tests/ui/impl-trait/issue-55872-1.rs @@ -1,4 +1,4 @@ -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] pub trait Bar { type E: Copy; diff --git a/tests/ui/impl-trait/issue-55872-2.rs b/tests/ui/impl-trait/issue-55872-2.rs index cbc7b5d62..7a5cb3b3d 100644 --- a/tests/ui/impl-trait/issue-55872-2.rs +++ b/tests/ui/impl-trait/issue-55872-2.rs @@ -3,7 +3,7 @@ // [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // edition:2018 -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] pub trait Bar { type E: Send; diff --git a/tests/ui/impl-trait/issue-55872-2.stderr b/tests/ui/impl-trait/issue-55872-2.stderr deleted file mode 100644 index 477c964bd..000000000 --- a/tests/ui/impl-trait/issue-55872-2.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias - --> $DIR/issue-55872-2.rs:17:9 - | -LL | async {} - | ^^^^^^^^ - -error: aborting due to previous error - diff --git a/tests/ui/impl-trait/issue-55872-3.rs b/tests/ui/impl-trait/issue-55872-3.rs index 91811df93..d031271ac 100644 --- a/tests/ui/impl-trait/issue-55872-3.rs +++ b/tests/ui/impl-trait/issue-55872-3.rs @@ -1,7 +1,7 @@ // edition:2018 // ignore-compare-mode-chalk -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] pub trait Bar { type E: Copy; diff --git a/tests/ui/impl-trait/issue-55872.rs b/tests/ui/impl-trait/issue-55872.rs index c4e6f6436..10850f0a9 100644 --- a/tests/ui/impl-trait/issue-55872.rs +++ b/tests/ui/impl-trait/issue-55872.rs @@ -1,4 +1,4 @@ -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] pub trait Bar { type E: Copy; diff --git a/tests/ui/impl-trait/issues/issue-78722.rs b/tests/ui/impl-trait/issues/issue-78722.rs index 78233f300..7b5ab5f22 100644 --- a/tests/ui/impl-trait/issues/issue-78722.rs +++ b/tests/ui/impl-trait/issues/issue-78722.rs @@ -12,7 +12,6 @@ struct Bug { } let f: F = async { 1 }; //~^ ERROR `async` blocks are not allowed in constants - //~| ERROR destructor of 1 }], } diff --git a/tests/ui/impl-trait/issues/issue-78722.stderr b/tests/ui/impl-trait/issues/issue-78722.stderr index c00df8087..05a2c135c 100644 --- a/tests/ui/impl-trait/issues/issue-78722.stderr +++ b/tests/ui/impl-trait/issues/issue-78722.stderr @@ -7,22 +7,13 @@ LL | let f: F = async { 1 }; = note: see issue #85368 for more information = help: add `#![feature(const_async_blocks)]` to the crate attributes to enable -error[E0493]: destructor of `F` cannot be evaluated at compile-time - --> $DIR/issue-78722.rs:13:13 - | -LL | let f: F = async { 1 }; - | ^ the destructor for this type cannot be evaluated in constants -... -LL | }], - | - value is dropped here - error[E0271]: expected `[async block@$DIR/issue-78722.rs:11:13: 11:21]` to be a future that resolves to `u8`, but it resolves to `()` --> $DIR/issue-78722.rs:9:30 | LL | fn concrete_use() -> F { | ^ expected `()`, found `u8` -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0271, E0493, E0658. +Some errors have detailed explanations: E0271, E0658. For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/impl-trait/issues/issue-82139.rs b/tests/ui/impl-trait/issues/issue-82139.rs index cc9167b34..3f0b0f1a8 100644 --- a/tests/ui/impl-trait/issues/issue-82139.rs +++ b/tests/ui/impl-trait/issues/issue-82139.rs @@ -1,4 +1,4 @@ -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] trait Trait { type Associated; diff --git a/tests/ui/impl-trait/issues/issue-83919.rs b/tests/ui/impl-trait/issues/issue-83919.rs index e76443a65..4e699e7f3 100644 --- a/tests/ui/impl-trait/issues/issue-83919.rs +++ b/tests/ui/impl-trait/issues/issue-83919.rs @@ -1,4 +1,4 @@ -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] // edition:2021 @@ -6,8 +6,8 @@ use std::future::Future; trait Foo { type T; - type Fut2: Future; // ICE got triggered with traits other than Future here - type Fut: Future; + type Fut2: Future; // ICE got triggered with traits other than Future here + type Fut: Future; fn get_fut(&self) -> Self::Fut; } @@ -15,11 +15,11 @@ struct Implementor; impl Foo for Implementor { type T = u64; - type Fut2 = impl Future; - type Fut = impl Future; + type Fut2 = impl Future; + type Fut = impl Future; fn get_fut(&self) -> Self::Fut { - //~^ ERROR `{integer}` is not a future + //~^ ERROR `{integer}` is not a future async move { 42 // 42 does not impl Future and rustc does actually point out the error, diff --git a/tests/ui/impl-trait/issues/issue-86719.rs b/tests/ui/impl-trait/issues/issue-86719.rs index f4b0b3f33..7abab5bfb 100644 --- a/tests/ui/impl-trait/issues/issue-86719.rs +++ b/tests/ui/impl-trait/issues/issue-86719.rs @@ -1,11 +1,12 @@ -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] trait Bar { type E; } impl Bar for S { type E = impl ; //~ ERROR at least one trait must be specified - fn foo() -> Self::E { //~ ERROR `foo` is not a member + fn foo() -> Self::E { + //~^ ERROR `foo` is not a member |_| true //~ ERROR type annotations needed } } diff --git a/tests/ui/impl-trait/issues/issue-86719.stderr b/tests/ui/impl-trait/issues/issue-86719.stderr index 7592418fd..15893df5f 100644 --- a/tests/ui/impl-trait/issues/issue-86719.stderr +++ b/tests/ui/impl-trait/issues/issue-86719.stderr @@ -8,12 +8,13 @@ error[E0407]: method `foo` is not a member of trait `Bar` --> $DIR/issue-86719.rs:8:5 | LL | / fn foo() -> Self::E { +LL | | LL | | |_| true LL | | } | |_____^ not a member of trait `Bar` error[E0282]: type annotations needed - --> $DIR/issue-86719.rs:9:10 + --> $DIR/issue-86719.rs:10:10 | LL | |_| true | ^ diff --git a/tests/ui/impl-trait/issues/issue-87340.rs b/tests/ui/impl-trait/issues/issue-87340.rs index f0f6d2bb6..705a4addc 100644 --- a/tests/ui/impl-trait/issues/issue-87340.rs +++ b/tests/ui/impl-trait/issues/issue-87340.rs @@ -1,4 +1,4 @@ -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] trait X { type I; @@ -6,7 +6,7 @@ trait X { } impl X for () { -//~^ ERROR `T` is not constrained by the impl trait, self type, or predicates + //~^ ERROR `T` is not constrained by the impl trait, self type, or predicates type I = impl Sized; fn f() -> Self::I {} } diff --git a/tests/ui/impl-trait/multiple-lifetimes.rs b/tests/ui/impl-trait/multiple-lifetimes.rs deleted file mode 100644 index 5407fb6dd..000000000 --- a/tests/ui/impl-trait/multiple-lifetimes.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Test that multiple lifetimes are allowed in impl trait types. -// build-pass (FIXME(62277): could be check-pass?) - -trait X<'x>: Sized {} - -impl X<'_> for U {} - -fn multiple_lifeteimes<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl X<'b> + 'a { - x -} - -fn main() {} diff --git a/tests/ui/impl-trait/multiple-lifetimes/multiple-lifetimes.rs b/tests/ui/impl-trait/multiple-lifetimes/multiple-lifetimes.rs new file mode 100644 index 000000000..5407fb6dd --- /dev/null +++ b/tests/ui/impl-trait/multiple-lifetimes/multiple-lifetimes.rs @@ -0,0 +1,12 @@ +// Test that multiple lifetimes are allowed in impl trait types. +// build-pass (FIXME(62277): could be check-pass?) + +trait X<'x>: Sized {} + +impl X<'_> for U {} + +fn multiple_lifeteimes<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl X<'b> + 'a { + x +} + +fn main() {} diff --git a/tests/ui/impl-trait/nested-return-type2.rs b/tests/ui/impl-trait/nested-return-type2.rs index fe883ce6f..e1d551137 100644 --- a/tests/ui/impl-trait/nested-return-type2.rs +++ b/tests/ui/impl-trait/nested-return-type2.rs @@ -26,7 +26,6 @@ impl R> Trait for F { // Lazy TAIT would error out, but we inserted a hack to make it work again, // keeping backwards compatibility. fn foo() -> impl Trait { - //~^ WARN opaque type `impl Trait` does not satisfy its associated type bounds || 42 } diff --git a/tests/ui/impl-trait/nested-return-type2.stderr b/tests/ui/impl-trait/nested-return-type2.stderr deleted file mode 100644 index 09ad3bd05..000000000 --- a/tests/ui/impl-trait/nested-return-type2.stderr +++ /dev/null @@ -1,17 +0,0 @@ -warning: opaque type `impl Trait` does not satisfy its associated type bounds - --> $DIR/nested-return-type2.rs:28:24 - | -LL | type Assoc: Duh; - | --- this associated type bound is unsatisfied for `impl Send` -... -LL | fn foo() -> impl Trait { - | ^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(opaque_hidden_inferred_bound)]` on by default -help: add this bound - | -LL | fn foo() -> impl Trait { - | +++++ - -warning: 1 warning emitted - diff --git a/tests/ui/impl-trait/nested-return-type3.rs b/tests/ui/impl-trait/nested-return-type3.rs index 5a764fc4c..74b4dae22 100644 --- a/tests/ui/impl-trait/nested-return-type3.rs +++ b/tests/ui/impl-trait/nested-return-type3.rs @@ -13,7 +13,6 @@ impl Trait for F { } fn foo() -> impl Trait { - //~^ WARN opaque type `impl Trait` does not satisfy its associated type bounds 42 } diff --git a/tests/ui/impl-trait/nested-return-type3.stderr b/tests/ui/impl-trait/nested-return-type3.stderr deleted file mode 100644 index 632de71aa..000000000 --- a/tests/ui/impl-trait/nested-return-type3.stderr +++ /dev/null @@ -1,17 +0,0 @@ -warning: opaque type `impl Trait` does not satisfy its associated type bounds - --> $DIR/nested-return-type3.rs:15:24 - | -LL | type Assoc: Duh; - | --- this associated type bound is unsatisfied for `impl Send` -... -LL | fn foo() -> impl Trait { - | ^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(opaque_hidden_inferred_bound)]` on by default -help: add this bound - | -LL | fn foo() -> impl Trait { - | +++++ - -warning: 1 warning emitted - diff --git a/tests/ui/impl-trait/no-method-suggested-traits.stderr b/tests/ui/impl-trait/no-method-suggested-traits.stderr index 3c2c01dc2..160cc0440 100644 --- a/tests/ui/impl-trait/no-method-suggested-traits.stderr +++ b/tests/ui/impl-trait/no-method-suggested-traits.stderr @@ -7,13 +7,13 @@ LL | 1u32.method(); = help: items from traits can only be used if the trait is in scope help: the following traits are implemented but not in scope; perhaps add a `use` for one of them: | -LL | use foo::Bar; +LL + use foo::Bar; | -LL | use no_method_suggested_traits::Reexported; +LL + use no_method_suggested_traits::Reexported; | -LL | use no_method_suggested_traits::foo::PubPub; +LL + use no_method_suggested_traits::foo::PubPub; | -LL | use no_method_suggested_traits::qux::PrivPub; +LL + use no_method_suggested_traits::qux::PrivPub; | error[E0599]: no method named `method` found for struct `Rc<&mut Box<&u32>>` in the current scope @@ -25,13 +25,13 @@ LL | std::rc::Rc::new(&mut Box::new(&1u32)).method(); = help: items from traits can only be used if the trait is in scope help: the following traits are implemented but not in scope; perhaps add a `use` for one of them: | -LL | use foo::Bar; +LL + use foo::Bar; | -LL | use no_method_suggested_traits::Reexported; +LL + use no_method_suggested_traits::Reexported; | -LL | use no_method_suggested_traits::foo::PubPub; +LL + use no_method_suggested_traits::foo::PubPub; | -LL | use no_method_suggested_traits::qux::PrivPub; +LL + use no_method_suggested_traits::qux::PrivPub; | error[E0599]: no method named `method` found for type `char` in the current scope @@ -46,7 +46,7 @@ LL | 'a'.method(); = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use foo::Bar; +LL + use foo::Bar; | error[E0599]: no method named `method` found for struct `Rc<&mut Box<&char>>` in the current scope @@ -58,7 +58,7 @@ LL | std::rc::Rc::new(&mut Box::new(&'a')).method(); = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use foo::Bar; +LL + use foo::Bar; | error[E0599]: no method named `method` found for type `i32` in the current scope @@ -75,7 +75,7 @@ LL | fn method(&self) {} = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use no_method_suggested_traits::foo::PubPub; +LL + use no_method_suggested_traits::foo::PubPub; | error[E0599]: no method named `method` found for struct `Rc<&mut Box<&i32>>` in the current scope @@ -87,7 +87,7 @@ LL | std::rc::Rc::new(&mut Box::new(&1i32)).method(); = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use no_method_suggested_traits::foo::PubPub; +LL + use no_method_suggested_traits::foo::PubPub; | error[E0599]: no method named `method` found for struct `Foo` in the current scope diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking_mir.stderr b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking_mir.stderr index 662c74bcd..9c67f17e9 100644 --- a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking_mir.stderr +++ b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking_mir.stderr @@ -114,6 +114,9 @@ error[E0720]: cannot resolve opaque type | LL | fn generator_hold() -> impl Sized { | ^^^^^^^^^^ recursive opaque type +... +LL | let x = generator_hold(); + | - generator captures itself here error[E0720]: cannot resolve opaque type --> $DIR/recursive-impl-trait-type-indirect.rs:90:26 diff --git a/tests/ui/impl-trait/type-alias-generic-param.rs b/tests/ui/impl-trait/type-alias-generic-param.rs index 3499b2859..1211625da 100644 --- a/tests/ui/impl-trait/type-alias-generic-param.rs +++ b/tests/ui/impl-trait/type-alias-generic-param.rs @@ -3,7 +3,7 @@ // types in 'item' position when generic parameters are involved // // run-pass -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] trait Meow { type MeowType; diff --git a/tests/ui/impl-trait/universal_wrong_bounds.stderr b/tests/ui/impl-trait/universal_wrong_bounds.stderr index 3b1a5e5f4..464d68958 100644 --- a/tests/ui/impl-trait/universal_wrong_bounds.stderr +++ b/tests/ui/impl-trait/universal_wrong_bounds.stderr @@ -6,7 +6,7 @@ LL | fn wants_debug(g: impl Debug) { } | help: consider importing this trait instead | -LL | use std::fmt::Debug; +LL + use std::fmt::Debug; | error[E0404]: expected trait, found derive macro `Debug` @@ -17,7 +17,7 @@ LL | fn wants_display(g: impl Debug) { } | help: consider importing this trait instead | -LL | use std::fmt::Debug; +LL + use std::fmt::Debug; | error: aborting due to 2 previous errors diff --git a/tests/ui/impl-trait/where-allowed.rs b/tests/ui/impl-trait/where-allowed.rs index ff63b04c2..509d27166 100644 --- a/tests/ui/impl-trait/where-allowed.rs +++ b/tests/ui/impl-trait/where-allowed.rs @@ -1,6 +1,8 @@ //! A simple test for testing many permutations of allowedness of //! impl Trait #![feature(impl_trait_in_fn_trait_return)] +#![feature(custom_inner_attributes)] +#![rustfmt::skip] use std::fmt::Debug; // Allowed @@ -116,7 +118,7 @@ trait DummyTrait { } impl DummyTrait for () { type Out = impl Debug; - //~^ ERROR `impl Trait` in type aliases is unstable + //~^ ERROR `impl Trait` in associated types is unstable fn in_trait_impl_parameter(_: impl Debug) { } // Allowed diff --git a/tests/ui/impl-trait/where-allowed.stderr b/tests/ui/impl-trait/where-allowed.stderr index 1cae3f77c..3e2934379 100644 --- a/tests/ui/impl-trait/where-allowed.stderr +++ b/tests/ui/impl-trait/where-allowed.stderr @@ -1,5 +1,5 @@ error[E0666]: nested `impl Trait` is not allowed - --> $DIR/where-allowed.rs:47:51 + --> $DIR/where-allowed.rs:49:51 | LL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() } | --------^^^^^^^^^^- @@ -8,7 +8,7 @@ LL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() } | outer `impl Trait` error[E0666]: nested `impl Trait` is not allowed - --> $DIR/where-allowed.rs:56:57 + --> $DIR/where-allowed.rs:58:57 | LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() } | --------^^^^^^^^^^- @@ -16,17 +16,17 @@ LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic | | nested `impl Trait` here | outer `impl Trait` -error[E0658]: `impl Trait` in type aliases is unstable - --> $DIR/where-allowed.rs:118:16 +error[E0658]: `impl Trait` in associated types is unstable + --> $DIR/where-allowed.rs:120:16 | LL | type Out = impl Debug; | ^^^^^^^^^^ | = note: see issue #63063 for more information - = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable + = help: add `#![feature(impl_trait_in_assoc_type)]` to the crate attributes to enable error[E0658]: `impl Trait` in type aliases is unstable - --> $DIR/where-allowed.rs:153:23 + --> $DIR/where-allowed.rs:155:23 | LL | type InTypeAlias = impl Debug; | ^^^^^^^^^^ @@ -35,7 +35,7 @@ LL | type InTypeAlias = impl Debug; = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable error[E0658]: `impl Trait` in type aliases is unstable - --> $DIR/where-allowed.rs:156:39 + --> $DIR/where-allowed.rs:158:39 | LL | type InReturnInTypeAlias = fn() -> impl Debug; | ^^^^^^^^^^ @@ -44,109 +44,109 @@ LL | type InReturnInTypeAlias = fn() -> impl Debug; = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer params - --> $DIR/where-allowed.rs:16:40 + --> $DIR/where-allowed.rs:18:40 | LL | fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types - --> $DIR/where-allowed.rs:20:42 + --> $DIR/where-allowed.rs:22:42 | LL | fn in_fn_return_in_parameters(_: fn() -> impl Debug) { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer params - --> $DIR/where-allowed.rs:24:38 + --> $DIR/where-allowed.rs:26:38 | LL | fn in_fn_parameter_in_return() -> fn(impl Debug) { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types - --> $DIR/where-allowed.rs:28:40 + --> $DIR/where-allowed.rs:30:40 | LL | fn in_fn_return_in_return() -> fn() -> impl Debug { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params - --> $DIR/where-allowed.rs:32:49 + --> $DIR/where-allowed.rs:34:49 | LL | fn in_dyn_Fn_parameter_in_parameters(_: &dyn Fn(impl Debug)) { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types - --> $DIR/where-allowed.rs:36:51 + --> $DIR/where-allowed.rs:38:51 | LL | fn in_dyn_Fn_return_in_parameters(_: &dyn Fn() -> impl Debug) { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params - --> $DIR/where-allowed.rs:40:55 + --> $DIR/where-allowed.rs:42:55 | LL | fn in_dyn_Fn_parameter_in_return() -> &'static dyn Fn(impl Debug) { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params - --> $DIR/where-allowed.rs:47:51 + --> $DIR/where-allowed.rs:49:51 | LL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types - --> $DIR/where-allowed.rs:52:53 + --> $DIR/where-allowed.rs:54:53 | LL | fn in_impl_Fn_return_in_parameters(_: &impl Fn() -> impl Debug) { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params - --> $DIR/where-allowed.rs:56:57 + --> $DIR/where-allowed.rs:58:57 | LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params - --> $DIR/where-allowed.rs:64:38 + --> $DIR/where-allowed.rs:66:38 | LL | fn in_Fn_parameter_in_generics (_: F) { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types - --> $DIR/where-allowed.rs:68:40 + --> $DIR/where-allowed.rs:70:40 | LL | fn in_Fn_return_in_generics impl Debug> (_: F) { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types - --> $DIR/where-allowed.rs:81:32 + --> $DIR/where-allowed.rs:83:32 | LL | struct InBraceStructField { x: impl Debug } | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types - --> $DIR/where-allowed.rs:85:41 + --> $DIR/where-allowed.rs:87:41 | LL | struct InAdtInBraceStructField { x: Vec } | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types - --> $DIR/where-allowed.rs:89:27 + --> $DIR/where-allowed.rs:91:27 | LL | struct InTupleStructField(impl Debug); | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types - --> $DIR/where-allowed.rs:94:25 + --> $DIR/where-allowed.rs:96:25 | LL | InBraceVariant { x: impl Debug }, | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types - --> $DIR/where-allowed.rs:96:20 + --> $DIR/where-allowed.rs:98:20 | LL | InTupleVariant(impl Debug), | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types - --> $DIR/where-allowed.rs:107:23 + --> $DIR/where-allowed.rs:109:23 | LL | fn in_return() -> impl Debug; | ^^^^^^^^^^ @@ -155,7 +155,7 @@ LL | fn in_return() -> impl Debug; = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types - --> $DIR/where-allowed.rs:124:34 + --> $DIR/where-allowed.rs:126:34 | LL | fn in_trait_impl_return() -> impl Debug { () } | ^^^^^^^^^^ @@ -164,127 +164,127 @@ LL | fn in_trait_impl_return() -> impl Debug { () } = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `extern fn` params - --> $DIR/where-allowed.rs:137:33 + --> $DIR/where-allowed.rs:139:33 | LL | fn in_foreign_parameters(_: impl Debug); | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `extern fn` return types - --> $DIR/where-allowed.rs:140:31 + --> $DIR/where-allowed.rs:142:31 | LL | fn in_foreign_return() -> impl Debug; | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types - --> $DIR/where-allowed.rs:156:39 + --> $DIR/where-allowed.rs:158:39 | LL | type InReturnInTypeAlias = fn() -> impl Debug; | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in traits - --> $DIR/where-allowed.rs:161:16 + --> $DIR/where-allowed.rs:163:16 | LL | impl PartialEq for () { | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers - --> $DIR/where-allowed.rs:166:24 + --> $DIR/where-allowed.rs:168:24 | LL | impl PartialEq<()> for impl Debug { | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers - --> $DIR/where-allowed.rs:171:6 + --> $DIR/where-allowed.rs:173:6 | LL | impl impl Debug { | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers - --> $DIR/where-allowed.rs:177:24 + --> $DIR/where-allowed.rs:179:24 | LL | impl InInherentImplAdt { | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in bounds - --> $DIR/where-allowed.rs:183:11 + --> $DIR/where-allowed.rs:185:11 | LL | where impl Debug: Debug | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in bounds - --> $DIR/where-allowed.rs:190:15 + --> $DIR/where-allowed.rs:192:15 | LL | where Vec: Debug | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in bounds - --> $DIR/where-allowed.rs:197:24 + --> $DIR/where-allowed.rs:199:24 | LL | where T: PartialEq | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params - --> $DIR/where-allowed.rs:204:17 + --> $DIR/where-allowed.rs:206:17 | LL | where T: Fn(impl Debug) | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types - --> $DIR/where-allowed.rs:211:22 + --> $DIR/where-allowed.rs:213:22 | LL | where T: Fn() -> impl Debug | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults - --> $DIR/where-allowed.rs:217:40 + --> $DIR/where-allowed.rs:219:40 | LL | struct InStructGenericParamDefault(T); | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults - --> $DIR/where-allowed.rs:221:36 + --> $DIR/where-allowed.rs:223:36 | LL | enum InEnumGenericParamDefault { Variant(T) } | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults - --> $DIR/where-allowed.rs:225:38 + --> $DIR/where-allowed.rs:227:38 | LL | trait InTraitGenericParamDefault {} | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults - --> $DIR/where-allowed.rs:229:41 + --> $DIR/where-allowed.rs:231:41 | LL | type InTypeAliasGenericParamDefault = T; | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults - --> $DIR/where-allowed.rs:233:11 + --> $DIR/where-allowed.rs:235:11 | LL | impl T {} | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults - --> $DIR/where-allowed.rs:240:40 + --> $DIR/where-allowed.rs:242:40 | LL | fn in_method_generic_param_default(_: T) {} | ^^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings - --> $DIR/where-allowed.rs:246:29 + --> $DIR/where-allowed.rs:248:29 | LL | let _in_local_variable: impl Fn() = || {}; | ^^^^^^^^^ error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in closure return types - --> $DIR/where-allowed.rs:248:46 + --> $DIR/where-allowed.rs:250:46 | LL | let _in_return_in_local_variable = || -> impl Fn() { || {} }; | ^^^^^^^^^ error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions - --> $DIR/where-allowed.rs:233:7 + --> $DIR/where-allowed.rs:235:7 | LL | impl T {} | ^^^^^^^^^^^^^^ @@ -294,7 +294,7 @@ LL | impl T {} = note: `#[deny(invalid_type_param_default)]` on by default error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions - --> $DIR/where-allowed.rs:240:36 + --> $DIR/where-allowed.rs:242:36 | LL | fn in_method_generic_param_default(_: T) {} | ^^^^^^^^^^^^^^ @@ -303,7 +303,7 @@ LL | fn in_method_generic_param_default(_: T) {} = note: for more information, see issue #36887 error[E0118]: no nominal type found for inherent implementation - --> $DIR/where-allowed.rs:233:1 + --> $DIR/where-allowed.rs:235:1 | LL | impl T {} | ^^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type diff --git a/tests/ui/implied-bounds/ice-unbound-region-vars.rs b/tests/ui/implied-bounds/ice-unbound-region-vars.rs new file mode 100644 index 000000000..9e1e3feae --- /dev/null +++ b/tests/ui/implied-bounds/ice-unbound-region-vars.rs @@ -0,0 +1,24 @@ +// Because of #109628, we can have unbounded region vars in implied bounds. +// Make sure we don't ICE in this case! +// +// check-pass + +pub trait MapAccess { + type Error; + fn next_key_seed(&mut self) -> Option; +} + +struct Access<'a> { + _marker: std::marker::PhantomData<&'a ()>, +} + +// implied_bounds(Option) = ['?1: 'a, ] +// where '?1 is a fresh region var. +impl<'a, 'b: 'a> MapAccess for Access<'a> { + type Error = (); + fn next_key_seed(&mut self) -> Option { + unimplemented!() + } +} + +fn main() {} diff --git a/tests/ui/implied-bounds/normalization-nested.lifetime.stderr b/tests/ui/implied-bounds/normalization-nested.lifetime.stderr new file mode 100644 index 000000000..898e5e951 --- /dev/null +++ b/tests/ui/implied-bounds/normalization-nested.lifetime.stderr @@ -0,0 +1,18 @@ +error[E0759]: `fn` parameter has lifetime `'x` but it needs to satisfy a `'static` lifetime requirement + --> $DIR/normalization-nested.rs:35:20 + | +LL | pub fn test<'x>(_: Map>, s: &'x str) -> &'static str { + | ^^^^^^^^^^^^^^^^ + | | + | this data with lifetime `'x`... + | ...is used and required to live as long as `'static` here + | +note: `'static` lifetime requirement introduced by this bound + --> $DIR/normalization-nested.rs:33:14 + | +LL | I::Item: 'static; + | ^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0759`. diff --git a/tests/ui/implied-bounds/normalization-nested.rs b/tests/ui/implied-bounds/normalization-nested.rs new file mode 100644 index 000000000..5f1cbb3f6 --- /dev/null +++ b/tests/ui/implied-bounds/normalization-nested.rs @@ -0,0 +1,39 @@ +// Test for normalization of projections that appear in the item bounds +// (versus those that appear directly in the input types). +// Both revisions should pass. `lifetime` revision is a bug. +// +// revisions: param_ty lifetime +// [param_ty] check-pass +// [lifetime] check-fail +// [lifetime] known-bug: #109799 + +pub trait Iter { + type Item; +} + +#[cfg(param_ty)] +impl Iter for I +where + I: IntoIterator, +{ + type Item = X; +} + +#[cfg(lifetime)] +impl<'x, I> Iter for I +where + I: IntoIterator, +{ + type Item = &'x (); +} + +pub struct Map(I) +where + I: Iter, + I::Item: 'static; + +pub fn test<'x>(_: Map>, s: &'x str) -> &'static str { + s +} + +fn main() {} diff --git a/tests/ui/implied-bounds/normalization.rs b/tests/ui/implied-bounds/normalization.rs new file mode 100644 index 000000000..f776fc98a --- /dev/null +++ b/tests/ui/implied-bounds/normalization.rs @@ -0,0 +1,58 @@ +// Test that we get implied bounds from complex projections after normalization. + +// check-pass + +// implementations wil ensure that +// WF(>::Ty) implies T: 'a +trait Combine<'a> { + type Ty; +} + +impl<'a, T: 'a> Combine<'a> for Box { + type Ty = &'a T; +} + +// ======= Wrappers ====== + +// normalizes to a projection +struct WrapA(T); +impl<'a, T> Combine<'a> for WrapA +where + T: Combine<'a>, +{ + type Ty = T::Ty; +} + +// as Combine<'a>>::Ty normalizes to a type variable ?X +// with constraint `>::Ty == ?X` +struct WrapB(T); +impl<'a, X, T> Combine<'a> for WrapB +where + T: Combine<'a, Ty = X>, +{ + type Ty = X; +} + +// as Combine<'a>>::Ty normalizes to `&'a &'?x ()` +// with constraint `>::Ty == &'a &'?x ()` +struct WrapC(T); +impl<'a, 'x: 'a, T> Combine<'a> for WrapC +where + T: Combine<'a, Ty = &'a &'x ()>, +{ + type Ty = &'a &'x (); +} + +//==== Test implied bounds ====== + +fn test_wrap<'a, 'b, 'c1, 'c2, A, B>( + _: > as Combine<'a>>::Ty, // normalized: &'a A + _: > as Combine<'b>>::Ty, // normalized: &'b B + _: > as Combine<'c2>>::Ty, // normalized: &'c2 &'c1 () +) { + None::<&'a A>; + None::<&'b B>; + None::<&'c2 &'c1 ()>; +} + +fn main() {} diff --git a/tests/ui/imports/auxiliary/glob-conflict.rs b/tests/ui/imports/auxiliary/glob-conflict.rs index c83db64c6..8a146378b 100644 --- a/tests/ui/imports/auxiliary/glob-conflict.rs +++ b/tests/ui/imports/auxiliary/glob-conflict.rs @@ -1,3 +1,5 @@ +#![allow(ambiguous_glob_reexports)] + mod m1 { pub fn f() {} } diff --git a/tests/ui/imports/glob-resolve1.stderr b/tests/ui/imports/glob-resolve1.stderr index 3b66a5e31..4401ef587 100644 --- a/tests/ui/imports/glob-resolve1.stderr +++ b/tests/ui/imports/glob-resolve1.stderr @@ -60,7 +60,7 @@ LL | import(); | help: consider importing this function | -LL | use other::import; +LL + use other::import; | error[E0412]: cannot find type `A` in this scope diff --git a/tests/ui/imports/issue-26873-multifile/issue-26873-multifile.rs b/tests/ui/imports/issue-26873-multifile/issue-26873-multifile.rs index da2acf6c9..d369f1e71 100644 --- a/tests/ui/imports/issue-26873-multifile/issue-26873-multifile.rs +++ b/tests/ui/imports/issue-26873-multifile/issue-26873-multifile.rs @@ -3,7 +3,6 @@ #![allow(unused_imports)] #![allow(non_snake_case)] -// ignore-pretty issue #37195 #[path = "issue-26873-multifile/mod.rs"] mod multifile; diff --git a/tests/ui/imports/issue-38293.stderr b/tests/ui/imports/issue-38293.stderr index d2450ab12..1bb7ae29e 100644 --- a/tests/ui/imports/issue-38293.stderr +++ b/tests/ui/imports/issue-38293.stderr @@ -12,7 +12,7 @@ LL | baz(); | help: consider importing this function instead | -LL | use bar::baz; +LL + use bar::baz; | error: aborting due to 2 previous errors diff --git a/tests/ui/imports/issue-4366-2.stderr b/tests/ui/imports/issue-4366-2.stderr index 4c94634ee..412423f4d 100644 --- a/tests/ui/imports/issue-4366-2.stderr +++ b/tests/ui/imports/issue-4366-2.stderr @@ -18,7 +18,7 @@ LL | foo(); | help: consider importing this function instead | -LL | use foo::foo; +LL + use foo::foo; | error: aborting due to 2 previous errors diff --git a/tests/ui/imports/issue-4366.stderr b/tests/ui/imports/issue-4366.stderr index 469ea93e9..4d5b392a7 100644 --- a/tests/ui/imports/issue-4366.stderr +++ b/tests/ui/imports/issue-4366.stderr @@ -6,7 +6,7 @@ LL | fn sub() -> isize { foo(); 1 } | help: consider importing this function | -LL | use foo::foo; +LL + use foo::foo; | error: aborting due to previous error diff --git a/tests/ui/imports/local-modularized-tricky-fail-1.rs b/tests/ui/imports/local-modularized-tricky-fail-1.rs index 29e9b8ec8..ce700ae0d 100644 --- a/tests/ui/imports/local-modularized-tricky-fail-1.rs +++ b/tests/ui/imports/local-modularized-tricky-fail-1.rs @@ -1,4 +1,5 @@ #![feature(decl_macro)] +#![allow(ambiguous_glob_reexports)] macro_rules! define_exported { () => { #[macro_export] diff --git a/tests/ui/imports/local-modularized-tricky-fail-1.stderr b/tests/ui/imports/local-modularized-tricky-fail-1.stderr index 20eadaaaa..52a01e8bc 100644 --- a/tests/ui/imports/local-modularized-tricky-fail-1.stderr +++ b/tests/ui/imports/local-modularized-tricky-fail-1.stderr @@ -1,12 +1,12 @@ error[E0659]: `exported` is ambiguous - --> $DIR/local-modularized-tricky-fail-1.rs:28:1 + --> $DIR/local-modularized-tricky-fail-1.rs:29:1 | LL | exported!(); | ^^^^^^^^ ambiguous name | = note: ambiguous because of a conflict between a name from a glob import and a macro-expanded name in the same module during import or macro resolution note: `exported` could refer to the macro defined here - --> $DIR/local-modularized-tricky-fail-1.rs:5:5 + --> $DIR/local-modularized-tricky-fail-1.rs:6:5 | LL | / macro_rules! exported { LL | | () => () @@ -16,7 +16,7 @@ LL | | } LL | define_exported!(); | ------------------ in this macro invocation note: `exported` could also refer to the macro imported here - --> $DIR/local-modularized-tricky-fail-1.rs:22:5 + --> $DIR/local-modularized-tricky-fail-1.rs:23:5 | LL | use inner1::*; | ^^^^^^^^^ @@ -24,7 +24,7 @@ LL | use inner1::*; = note: this error originates in the macro `define_exported` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `panic` is ambiguous - --> $DIR/local-modularized-tricky-fail-1.rs:35:5 + --> $DIR/local-modularized-tricky-fail-1.rs:36:5 | LL | panic!(); | ^^^^^ ambiguous name @@ -32,7 +32,7 @@ LL | panic!(); = note: ambiguous because of a conflict between a macro-expanded name and a less macro-expanded name from outer scope during import or macro resolution = note: `panic` could refer to a macro from prelude note: `panic` could also refer to the macro defined here - --> $DIR/local-modularized-tricky-fail-1.rs:11:5 + --> $DIR/local-modularized-tricky-fail-1.rs:12:5 | LL | / macro_rules! panic { LL | | () => () @@ -45,7 +45,7 @@ LL | define_panic!(); = note: this error originates in the macro `define_panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `include` is ambiguous - --> $DIR/local-modularized-tricky-fail-1.rs:46:1 + --> $DIR/local-modularized-tricky-fail-1.rs:47:1 | LL | include!(); | ^^^^^^^ ambiguous name @@ -53,7 +53,7 @@ LL | include!(); = note: ambiguous because of a conflict between a macro-expanded name and a less macro-expanded name from outer scope during import or macro resolution = note: `include` could refer to a macro from prelude note: `include` could also refer to the macro defined here - --> $DIR/local-modularized-tricky-fail-1.rs:17:5 + --> $DIR/local-modularized-tricky-fail-1.rs:18:5 | LL | / macro_rules! include { LL | | () => () diff --git a/tests/ui/imports/overlapping_pub_trait.stderr b/tests/ui/imports/overlapping_pub_trait.stderr index d0c845a5e..490dccd3e 100644 --- a/tests/ui/imports/overlapping_pub_trait.stderr +++ b/tests/ui/imports/overlapping_pub_trait.stderr @@ -12,7 +12,7 @@ LL | pub trait Tr { fn method(&self); } = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use overlapping_pub_trait_source::m::Tr; +LL + use overlapping_pub_trait_source::m::Tr; | error: aborting due to previous error diff --git a/tests/ui/imports/unnamed_pub_trait.stderr b/tests/ui/imports/unnamed_pub_trait.stderr index 319dfd7e1..5133273c2 100644 --- a/tests/ui/imports/unnamed_pub_trait.stderr +++ b/tests/ui/imports/unnamed_pub_trait.stderr @@ -12,7 +12,7 @@ LL | pub trait Tr { fn method(&self); } = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use unnamed_pub_trait_source::prelude::*; // trait Tr +LL + use unnamed_pub_trait_source::prelude::*; // trait Tr | error: aborting due to previous error diff --git a/tests/ui/index_message.rs b/tests/ui/index_message.rs index 87e0cde59..88b848d6f 100644 --- a/tests/ui/index_message.rs +++ b/tests/ui/index_message.rs @@ -1,4 +1,4 @@ fn main() { - let z = (); - let _ = z[0]; //~ ERROR cannot index into a value of type `()` + let z = (10,); + let _ = z[0]; //~ ERROR cannot index into a value of type `({integer},)` } diff --git a/tests/ui/index_message.stderr b/tests/ui/index_message.stderr index 6c2b12673..56d1d7080 100644 --- a/tests/ui/index_message.stderr +++ b/tests/ui/index_message.stderr @@ -1,4 +1,4 @@ -error[E0608]: cannot index into a value of type `()` +error[E0608]: cannot index into a value of type `({integer},)` --> $DIR/index_message.rs:3:13 | LL | let _ = z[0]; diff --git a/tests/ui/inference/char-as-str-single.fixed b/tests/ui/inference/char-as-str-single.fixed index bab1854dc..1621a279f 100644 --- a/tests/ui/inference/char-as-str-single.fixed +++ b/tests/ui/inference/char-as-str-single.fixed @@ -10,3 +10,12 @@ fn main() { let _: char = '人'; //~ ERROR mismatched types let _: char = '\''; //~ ERROR mismatched types } + +// regression test for https://github.com/rust-lang/rust/issues/109586 +#[allow(dead_code)] +fn convert_c_to_str(c: char) { + match c { + 'A' => {} //~ ERROR mismatched types + _ => {} + } +} diff --git a/tests/ui/inference/char-as-str-single.rs b/tests/ui/inference/char-as-str-single.rs index 736920643..2903142f1 100644 --- a/tests/ui/inference/char-as-str-single.rs +++ b/tests/ui/inference/char-as-str-single.rs @@ -10,3 +10,12 @@ fn main() { let _: char = "人"; //~ ERROR mismatched types let _: char = "'"; //~ ERROR mismatched types } + +// regression test for https://github.com/rust-lang/rust/issues/109586 +#[allow(dead_code)] +fn convert_c_to_str(c: char) { + match c { + "A" => {} //~ ERROR mismatched types + _ => {} + } +} diff --git a/tests/ui/inference/char-as-str-single.stderr b/tests/ui/inference/char-as-str-single.stderr index 3375ec6ac..9149efe32 100644 --- a/tests/ui/inference/char-as-str-single.stderr +++ b/tests/ui/inference/char-as-str-single.stderr @@ -37,6 +37,19 @@ help: if you meant to write a `char` literal, use single quotes LL | let _: char = '\''; | ~~~~ -error: aborting due to 3 previous errors +error[E0308]: mismatched types + --> $DIR/char-as-str-single.rs:18:9 + | +LL | match c { + | - this expression has type `char` +LL | "A" => {} + | ^^^ expected `char`, found `&str` + | +help: if you meant to write a `char` literal, use single quotes + | +LL | 'A' => {} + | ~~~ + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/inference/issue-80409.rs b/tests/ui/inference/issue-80409.rs new file mode 100644 index 000000000..80cad6dfc --- /dev/null +++ b/tests/ui/inference/issue-80409.rs @@ -0,0 +1,36 @@ +// check-pass + +#![allow(unreachable_code, unused)] + +use std::marker::PhantomData; + +struct FsmBuilder { + _fsm: PhantomData, +} + +impl FsmBuilder { + fn state(&mut self) -> FsmStateBuilder { + todo!() + } +} + +struct FsmStateBuilder { + _state: PhantomData, +} + +impl FsmStateBuilder { + fn on_entry)>(&self, _action: TAction) {} +} + +trait Fsm { + type Context; +} + +struct StateContext<'a, TFsm: Fsm> { + context: &'a mut TFsm::Context, +} + +fn main() { + let mut builder: FsmBuilder = todo!(); + builder.state().on_entry(|_| {}); +} diff --git a/tests/ui/inference/issue-83606.stderr b/tests/ui/inference/issue-83606.stderr index f2ee8692e..97ed53fb3 100644 --- a/tests/ui/inference/issue-83606.stderr +++ b/tests/ui/inference/issue-83606.stderr @@ -4,7 +4,7 @@ error[E0282]: type annotations needed for `[usize; N]` LL | let _ = foo("foo"); | ^ | -help: consider giving this pattern a type, where the the value of const parameter `N` is specified +help: consider giving this pattern a type, where the value of const parameter `N` is specified | LL | let _: [usize; N] = foo("foo"); | ++++++++++++ diff --git a/tests/ui/inference/need_type_info/concrete-impl.rs b/tests/ui/inference/need_type_info/concrete-impl.rs index 72e0e74f3..fc79e6201 100644 --- a/tests/ui/inference/need_type_info/concrete-impl.rs +++ b/tests/ui/inference/need_type_info/concrete-impl.rs @@ -7,10 +7,13 @@ struct Two; struct Struct; impl Ambiguous for Struct {} +//~^ NOTE multiple `impl`s satisfying `Struct: Ambiguous<_>` found impl Ambiguous for Struct {} fn main() { >::method(); //~^ ERROR type annotations needed + //~| NOTE cannot infer type of the type parameter `A` //~| ERROR type annotations needed + //~| NOTE infer type of the type parameter `A` } diff --git a/tests/ui/inference/need_type_info/concrete-impl.stderr b/tests/ui/inference/need_type_info/concrete-impl.stderr index aa3296995..74c3f6cd5 100644 --- a/tests/ui/inference/need_type_info/concrete-impl.stderr +++ b/tests/ui/inference/need_type_info/concrete-impl.stderr @@ -1,20 +1,21 @@ error[E0282]: type annotations needed - --> $DIR/concrete-impl.rs:13:5 + --> $DIR/concrete-impl.rs:14:5 | LL | >::method(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `Self` declared on the trait `Ambiguous` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `A` declared on the trait `Ambiguous` error[E0283]: type annotations needed - --> $DIR/concrete-impl.rs:13:5 + --> $DIR/concrete-impl.rs:14:5 | LL | >::method(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `Self` declared on the trait `Ambiguous` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `A` declared on the trait `Ambiguous` | note: multiple `impl`s satisfying `Struct: Ambiguous<_>` found --> $DIR/concrete-impl.rs:9:1 | LL | impl Ambiguous for Struct {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | LL | impl Ambiguous for Struct {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/inference/need_type_info/issue-109905.rs b/tests/ui/inference/need_type_info/issue-109905.rs new file mode 100644 index 000000000..99d10a5ea --- /dev/null +++ b/tests/ui/inference/need_type_info/issue-109905.rs @@ -0,0 +1,25 @@ +// Test that we show the correct type parameter that couldn't be inferred and that we don't +// end up stating nonsense like "type parameter `'a`" which we used to do. + +trait Trait<'a, T> { + fn m(self); +} + +impl<'a, A> Trait<'a, A> for () { + fn m(self) {} +} + +fn qualified() { + <() as Trait<'static, _>>::m(()); + //~^ ERROR type annotations needed + //~| NOTE cannot infer type of the type parameter `T` + +} + +fn unqualified() { + Trait::<'static, _>::m(()); + //~^ ERROR type annotations needed + //~| NOTE cannot infer type of the type parameter `T` +} + +fn main() {} diff --git a/tests/ui/inference/need_type_info/issue-109905.stderr b/tests/ui/inference/need_type_info/issue-109905.stderr new file mode 100644 index 000000000..fcdd50f14 --- /dev/null +++ b/tests/ui/inference/need_type_info/issue-109905.stderr @@ -0,0 +1,15 @@ +error[E0282]: type annotations needed + --> $DIR/issue-109905.rs:13:5 + | +LL | <() as Trait<'static, _>>::m(()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the trait `Trait` + +error[E0282]: type annotations needed + --> $DIR/issue-109905.rs:20:5 + | +LL | Trait::<'static, _>::m(()); + | ^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the trait `Trait` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/infinite/infinite-trait-alias-recursion.stderr b/tests/ui/infinite/infinite-trait-alias-recursion.stderr index b925b3b01..683987b49 100644 --- a/tests/ui/infinite/infinite-trait-alias-recursion.stderr +++ b/tests/ui/infinite/infinite-trait-alias-recursion.stderr @@ -1,30 +1,15 @@ error[E0391]: cycle detected when computing the super predicates of `T1` - --> $DIR/infinite-trait-alias-recursion.rs:3:1 - | -LL | trait T1 = T2; - | ^^^^^^^^ - | -note: ...which requires computing the super traits of `T1`... --> $DIR/infinite-trait-alias-recursion.rs:3:12 | LL | trait T1 = T2; | ^^ -note: ...which requires computing the super predicates of `T2`... - --> $DIR/infinite-trait-alias-recursion.rs:6:1 | -LL | trait T2 = T3; - | ^^^^^^^^ -note: ...which requires computing the super traits of `T2`... +note: ...which requires computing the super predicates of `T2`... --> $DIR/infinite-trait-alias-recursion.rs:6:12 | LL | trait T2 = T3; | ^^ note: ...which requires computing the super predicates of `T3`... - --> $DIR/infinite-trait-alias-recursion.rs:8:1 - | -LL | trait T3 = T1 + T3; - | ^^^^^^^^ -note: ...which requires computing the super traits of `T3`... --> $DIR/infinite-trait-alias-recursion.rs:8:12 | LL | trait T3 = T1 + T3; diff --git a/tests/ui/inline-const/const-match-pat-generic.rs b/tests/ui/inline-const/const-match-pat-generic.rs index 7c0d83516..46e501abf 100644 --- a/tests/ui/inline-const/const-match-pat-generic.rs +++ b/tests/ui/inline-const/const-match-pat-generic.rs @@ -7,7 +7,6 @@ fn foo() { match 0 { const { V } => {}, //~^ ERROR constant pattern depends on a generic parameter - //~| ERROR constant pattern depends on a generic parameter _ => {}, } } @@ -20,7 +19,6 @@ fn bar() { match 0 { const { f(V) } => {}, //~^ ERROR constant pattern depends on a generic parameter - //~| ERROR constant pattern depends on a generic parameter _ => {}, } } diff --git a/tests/ui/inline-const/const-match-pat-generic.stderr b/tests/ui/inline-const/const-match-pat-generic.stderr index 77267f12f..4ffbde410 100644 --- a/tests/ui/inline-const/const-match-pat-generic.stderr +++ b/tests/ui/inline-const/const-match-pat-generic.stderr @@ -5,22 +5,10 @@ LL | const { V } => {}, | ^^^^^^^^^^^ error: constant pattern depends on a generic parameter - --> $DIR/const-match-pat-generic.rs:21:9 + --> $DIR/const-match-pat-generic.rs:20:9 | LL | const { f(V) } => {}, | ^^^^^^^^^^^^^^ -error: constant pattern depends on a generic parameter - --> $DIR/const-match-pat-generic.rs:8:9 - | -LL | const { V } => {}, - | ^^^^^^^^^^^ - -error: constant pattern depends on a generic parameter - --> $DIR/const-match-pat-generic.rs:21:9 - | -LL | const { f(V) } => {}, - | ^^^^^^^^^^^^^^ - -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors diff --git a/tests/ui/internal-lints/diagnostics_incorrect.rs b/tests/ui/internal-lints/diagnostics_incorrect.rs new file mode 100644 index 000000000..99f99ffcd --- /dev/null +++ b/tests/ui/internal-lints/diagnostics_incorrect.rs @@ -0,0 +1,15 @@ +// compile-flags: -Z unstable-options + +#![feature(rustc_attrs)] + +#[rustc_lint_diagnostics] +//~^ ERROR attribute should be applied to a function +struct Foo; + +impl Foo { + #[rustc_lint_diagnostics(a)] + //~^ ERROR malformed `rustc_lint_diagnostics` + fn bar() {} +} + +fn main() {} diff --git a/tests/ui/internal-lints/diagnostics_incorrect.stderr b/tests/ui/internal-lints/diagnostics_incorrect.stderr new file mode 100644 index 000000000..e849ca282 --- /dev/null +++ b/tests/ui/internal-lints/diagnostics_incorrect.stderr @@ -0,0 +1,17 @@ +error: malformed `rustc_lint_diagnostics` attribute input + --> $DIR/diagnostics_incorrect.rs:10:5 + | +LL | #[rustc_lint_diagnostics(a)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_lint_diagnostics]` + +error: attribute should be applied to a function definition + --> $DIR/diagnostics_incorrect.rs:5:1 + | +LL | #[rustc_lint_diagnostics] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | struct Foo; + | ----------- not a function definition + +error: aborting due to 2 previous errors + diff --git a/tests/ui/internal-lints/existing_doc_keyword.rs b/tests/ui/internal-lints/existing_doc_keyword.rs new file mode 100644 index 000000000..7783dc40f --- /dev/null +++ b/tests/ui/internal-lints/existing_doc_keyword.rs @@ -0,0 +1,11 @@ +// compile-flags: -Z unstable-options + +#![feature(rustc_private)] +#![feature(rustdoc_internals)] + +#![crate_type = "lib"] + +#![deny(rustc::existing_doc_keyword)] + +#[doc(keyword = "tadam")] //~ ERROR +mod tadam {} diff --git a/tests/ui/internal-lints/existing_doc_keyword.stderr b/tests/ui/internal-lints/existing_doc_keyword.stderr new file mode 100644 index 000000000..5110b9be0 --- /dev/null +++ b/tests/ui/internal-lints/existing_doc_keyword.stderr @@ -0,0 +1,15 @@ +error: found non-existing keyword `tadam` used in `#[doc(keyword = "...")]` + --> $DIR/existing_doc_keyword.rs:10:1 + | +LL | #[doc(keyword = "tadam")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: only existing keywords are allowed in core/std +note: the lint level is defined here + --> $DIR/existing_doc_keyword.rs:8:9 + | +LL | #![deny(rustc::existing_doc_keyword)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/internal-lints/query_stability_incorrect.rs b/tests/ui/internal-lints/query_stability_incorrect.rs new file mode 100644 index 000000000..f478b7332 --- /dev/null +++ b/tests/ui/internal-lints/query_stability_incorrect.rs @@ -0,0 +1,15 @@ +// compile-flags: -Z unstable-options + +#![feature(rustc_attrs)] + +#[rustc_lint_query_instability] +//~^ ERROR attribute should be applied to a function +struct Foo; + +impl Foo { + #[rustc_lint_query_instability(a)] + //~^ ERROR malformed `rustc_lint_query_instability` + fn bar() {} +} + +fn main() {} diff --git a/tests/ui/internal-lints/query_stability_incorrect.stderr b/tests/ui/internal-lints/query_stability_incorrect.stderr new file mode 100644 index 000000000..3f78b39ed --- /dev/null +++ b/tests/ui/internal-lints/query_stability_incorrect.stderr @@ -0,0 +1,17 @@ +error: malformed `rustc_lint_query_instability` attribute input + --> $DIR/query_stability_incorrect.rs:10:5 + | +LL | #[rustc_lint_query_instability(a)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_lint_query_instability]` + +error: attribute should be applied to a function definition + --> $DIR/query_stability_incorrect.rs:5:1 + | +LL | #[rustc_lint_query_instability] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | struct Foo; + | ----------- not a function definition + +error: aborting due to 2 previous errors + diff --git a/tests/ui/internal-lints/rustc_pass_by_value_self.rs b/tests/ui/internal-lints/rustc_pass_by_value_self.rs new file mode 100644 index 000000000..6ce67dcaf --- /dev/null +++ b/tests/ui/internal-lints/rustc_pass_by_value_self.rs @@ -0,0 +1,54 @@ +// compile-flags: -Z unstable-options +// NOTE: This test doesn't actually require `fulldeps` +// so we could instead use it as a `ui` test. +// +// Considering that all other `internal-lints` are tested here +// this seems like the cleaner solution though. +#![feature(rustc_attrs)] +#![deny(rustc::pass_by_value)] +#![allow(unused)] + +#[rustc_pass_by_value] +struct TyCtxt<'tcx> { + inner: &'tcx (), +} + +impl<'tcx> TyCtxt<'tcx> { + fn by_value(self) {} // OK + fn by_ref(&self) {} //~ ERROR passing `TyCtxt<'tcx>` by reference +} + +struct TyS<'tcx> { + inner: &'tcx (), +} + +#[rustc_pass_by_value] +type Ty<'tcx> = &'tcx TyS<'tcx>; + +impl<'tcx> TyS<'tcx> { + fn by_value(self: Ty<'tcx>) {} + fn by_ref(self: &Ty<'tcx>) {} //~ ERROR passing `Ty<'tcx>` by reference +} + +#[rustc_pass_by_value] +struct Foo; + +impl Foo { + fn with_ref(&self) {} //~ ERROR passing `Foo` by reference +} + +#[rustc_pass_by_value] +struct WithParameters { + slice: [T; N], + m: M, +} + +impl WithParameters { + fn with_ref(&self) {} //~ ERROR passing `WithParameters` by reference +} + +impl WithParameters { + fn with_ref(&self) {} //~ ERROR passing `WithParameters` by reference +} + +fn main() {} diff --git a/tests/ui/internal-lints/rustc_pass_by_value_self.stderr b/tests/ui/internal-lints/rustc_pass_by_value_self.stderr new file mode 100644 index 000000000..fb39ed60b --- /dev/null +++ b/tests/ui/internal-lints/rustc_pass_by_value_self.stderr @@ -0,0 +1,38 @@ +error: passing `TyCtxt<'tcx>` by reference + --> $DIR/rustc_pass_by_value_self.rs:18:15 + | +LL | fn by_ref(&self) {} + | ^^^^^ help: try passing by value: `TyCtxt<'tcx>` + | +note: the lint level is defined here + --> $DIR/rustc_pass_by_value_self.rs:8:9 + | +LL | #![deny(rustc::pass_by_value)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: passing `Ty<'tcx>` by reference + --> $DIR/rustc_pass_by_value_self.rs:30:21 + | +LL | fn by_ref(self: &Ty<'tcx>) {} + | ^^^^^^^^^ help: try passing by value: `Ty<'tcx>` + +error: passing `Foo` by reference + --> $DIR/rustc_pass_by_value_self.rs:37:17 + | +LL | fn with_ref(&self) {} + | ^^^^^ help: try passing by value: `Foo` + +error: passing `WithParameters` by reference + --> $DIR/rustc_pass_by_value_self.rs:47:17 + | +LL | fn with_ref(&self) {} + | ^^^^^ help: try passing by value: `WithParameters` + +error: passing `WithParameters` by reference + --> $DIR/rustc_pass_by_value_self.rs:51:17 + | +LL | fn with_ref(&self) {} + | ^^^^^ help: try passing by value: `WithParameters` + +error: aborting due to 5 previous errors + diff --git a/tests/ui/internal/internal-unstable-const.stderr b/tests/ui/internal/internal-unstable-const.stderr index 37d2ea6d2..5c63992d8 100644 --- a/tests/ui/internal/internal-unstable-const.stderr +++ b/tests/ui/internal/internal-unstable-const.stderr @@ -6,11 +6,13 @@ LL | 1.0 + 1.0 | help: if it is not part of the public API, make this function unstably const | -LL | #[rustc_const_unstable(feature = "...", issue = "...")] +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | pub const fn foo() -> f32 { | help: otherwise `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks | -LL | #[rustc_allow_const_fn_unstable(const_fn_floating_point_arithmetic)] +LL + #[rustc_allow_const_fn_unstable(const_fn_floating_point_arithmetic)] +LL | pub const fn foo() -> f32 { | error: aborting due to previous error diff --git a/tests/ui/issue-11881.rs b/tests/ui/issue-11881.rs new file mode 100644 index 000000000..f6360db9b --- /dev/null +++ b/tests/ui/issue-11881.rs @@ -0,0 +1,91 @@ +// run-pass + +#![allow(unused_must_use)] +#![allow(dead_code)] +#![allow(unused_imports)] + +use std::fmt; +use std::io::prelude::*; +use std::io::Cursor; +use std::slice; +use std::marker::PhantomData; + +trait Encoder { + type Error; +} + +trait Encodable { + fn encode(&self, s: &mut S) -> Result<(), S::Error>; +} + +struct JsonEncoder<'a>(PhantomData<&'a mut ()>); + +impl Encoder for JsonEncoder<'_> { + type Error = (); +} + +struct AsJson<'a, T> { + inner: &'a T, +} + +impl<'a, T: for<'r> Encodable>> fmt::Display for AsJson<'a, T> { + /// Encodes a json value into a string + fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result { + Ok(()) + } +} + +fn as_json(t: &T) -> AsJson<'_, T> { + AsJson { inner: t } +} + +struct OpaqueEncoder(Vec); + +impl Encoder for OpaqueEncoder { + type Error = (); +} + + +struct Foo { + baz: bool, +} + +impl Encodable for Foo { + fn encode(&self, _s: &mut S) -> Result<(), S::Error> { + Ok(()) + } +} + +struct Bar { + froboz: usize, +} + +impl Encodable for Bar { + fn encode(&self, _s: &mut S) -> Result<(), S::Error> { + Ok(()) + } +} + +enum WireProtocol { + JSON, + Opaque, + // ... +} + +fn encode_json Encodable>>(val: &T, wr: &mut Cursor>) { + write!(wr, "{}", as_json(val)); +} + +fn encode_opaque>(val: &T, wr: Vec) { + let mut encoder = OpaqueEncoder(wr); + val.encode(&mut encoder); +} + +pub fn main() { + let target = Foo { baz: false }; + let proto = WireProtocol::JSON; + match proto { + WireProtocol::JSON => encode_json(&target, &mut Cursor::new(Vec::new())), + WireProtocol::Opaque => encode_opaque(&target, Vec::new()), + } +} diff --git a/tests/ui/issue-13560.rs b/tests/ui/issue-13560.rs new file mode 100644 index 000000000..3397202be --- /dev/null +++ b/tests/ui/issue-13560.rs @@ -0,0 +1,13 @@ +// run-pass +// ignore-cross-compile (needs dylibs and compiletest doesn't have a more specific header) +// aux-build:issue-13560-1.rs +// aux-build:issue-13560-2.rs +// aux-build:issue-13560-3.rs + +// Regression test for issue #13560, the test itself is all in the dependent +// libraries. The fail which previously failed to compile is the one numbered 3. + +extern crate issue_13560_2 as t2; +extern crate issue_13560_3 as t3; + +fn main() {} diff --git a/tests/ui/issue-15924.rs b/tests/ui/issue-15924.rs new file mode 100644 index 000000000..d8b3914d0 --- /dev/null +++ b/tests/ui/issue-15924.rs @@ -0,0 +1,53 @@ +// run-pass + +#![allow(unused_imports)] +#![allow(unused_must_use)] +// pretty-expanded FIXME #23616 + +use std::fmt; +use std::marker::PhantomData; + +trait Encoder { + type Error; +} + +trait Encodable { + fn encode(&self, s: &mut S) -> Result<(), S::Error>; +} + +impl Encodable for i32 { + fn encode(&self, _s: &mut S) -> Result<(), S::Error> { + Ok(()) + } +} + +struct JsonEncoder<'a>(PhantomData<&'a mut ()>); + +impl Encoder for JsonEncoder<'_> { + type Error = (); +} + +fn encode_json Encodable>>( + object: &T, +) -> Result { + let s = String::new(); + { + let mut encoder = JsonEncoder(PhantomData); + object.encode(&mut encoder)?; + } + Ok(s) +} + +struct Foo Encodable>> { + v: T, +} + +impl Encodable>> Drop for Foo { + fn drop(&mut self) { + encode_json(&self.v); + } +} + +fn main() { + let _ = Foo { v: 10 }; +} diff --git a/tests/ui/issue-16822.rs b/tests/ui/issue-16822.rs new file mode 100644 index 000000000..c611c33af --- /dev/null +++ b/tests/ui/issue-16822.rs @@ -0,0 +1,22 @@ +// run-pass +// aux-build:issue-16822.rs + +extern crate issue_16822 as lib; + +use std::cell::RefCell; + +struct App { + i: isize +} + +impl lib::Update for App { + fn update(&mut self) { + self.i += 1; + } +} + +fn main(){ + let app = App { i: 5 }; + let window = lib::Window { data: RefCell::new(app) }; + window.update(1); +} diff --git a/tests/ui/issue-18502.rs b/tests/ui/issue-18502.rs new file mode 100644 index 000000000..2082ae7a9 --- /dev/null +++ b/tests/ui/issue-18502.rs @@ -0,0 +1,8 @@ +// run-pass +// aux-build:issue-18502.rs + +extern crate issue_18502 as fmt; + +fn main() { + ::fmt::baz(); +} diff --git a/tests/ui/issue-24106.rs b/tests/ui/issue-24106.rs new file mode 100644 index 000000000..45f0bd5b6 --- /dev/null +++ b/tests/ui/issue-24106.rs @@ -0,0 +1,8 @@ +// run-pass +// aux-build:issue-24106.rs + +extern crate issue_24106; + +fn main() { + issue_24106::go::<()>(); +} diff --git a/tests/ui/issue-2804.rs b/tests/ui/issue-2804.rs new file mode 100644 index 000000000..571028c5e --- /dev/null +++ b/tests/ui/issue-2804.rs @@ -0,0 +1,81 @@ +// run-pass + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +use std::collections::{BTreeMap, HashMap}; +use std::option; + +#[derive(Clone, Debug)] +enum Json { + I64(i64), + U64(u64), + F64(f64), + String(String), + Boolean(bool), + Array(Array), + Object(Object), + Null, +} + +type Array = Vec; +type Object = BTreeMap; + +enum object { + bool_value(bool), + int_value(i64), +} + +fn lookup(table: Object, key: String, default: String) -> String +{ + match table.get(&key) { + option::Option::Some(&Json::String(ref s)) => { + s.to_string() + } + option::Option::Some(value) => { + println!("{} was expected to be a string but is a {:?}", key, value); + default + } + option::Option::None => { + default + } + } +} + +fn add_interface(_store: isize, managed_ip: String, data: Json) -> (String, object) +{ + match &data { + &Json::Object(ref interface) => { + let name = lookup(interface.clone(), + "ifDescr".to_string(), + "".to_string()); + let label = format!("{}-{}", managed_ip, name); + + (label, object::bool_value(false)) + } + _ => { + println!("Expected dict for {} interfaces, found {:?}", managed_ip, data); + ("gnos:missing-interface".to_string(), object::bool_value(true)) + } + } +} + +fn add_interfaces(store: isize, managed_ip: String, device: HashMap) +-> Vec<(String, object)> { + match device["interfaces"] { + Json::Array(ref interfaces) => + { + interfaces.iter().map(|interface| { + add_interface(store, managed_ip.clone(), (*interface).clone()) + }).collect() + } + _ => + { + println!("Expected list for {} interfaces, found {:?}", managed_ip, + device["interfaces"]); + Vec::new() + } + } +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-10465.stderr b/tests/ui/issues/issue-10465.stderr index 0ccf69dc0..1b7b9d590 100644 --- a/tests/ui/issues/issue-10465.stderr +++ b/tests/ui/issues/issue-10465.stderr @@ -7,7 +7,7 @@ LL | b.foo(); = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use a::A; +LL + use a::A; | error: aborting due to previous error diff --git a/tests/ui/issues/issue-106755.rs b/tests/ui/issues/issue-106755.rs index 46ece725f..5eabc3bfb 100644 --- a/tests/ui/issues/issue-106755.rs +++ b/tests/ui/issues/issue-106755.rs @@ -15,5 +15,7 @@ impl !Send for TestType {} //~ ERROR found both positive and nega unsafe impl Send for TestType {} //~ ERROR conflicting implementations impl !Send for TestType {} +//~^ WARNING +//~| WARNING this will change its meaning fn main() {} diff --git a/tests/ui/issues/issue-106755.stderr b/tests/ui/issues/issue-106755.stderr index 543970340..6b3a8427e 100644 --- a/tests/ui/issues/issue-106755.stderr +++ b/tests/ui/issues/issue-106755.stderr @@ -16,7 +16,23 @@ LL | unsafe impl Send for TestType {} LL | unsafe impl Send for TestType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>` -error: aborting due to 2 previous errors +warning: cross-crate traits with a default impl, like `Send`, should not be specialized + --> $DIR/issue-106755.rs:17:1 + | +LL | impl !Send for TestType {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this will change its meaning in a future release! + = note: for more information, see issue #93367 + = note: `i32` is not a generic parameter +note: try using the same sequence of generic parameters as the struct definition + --> $DIR/issue-106755.rs:9:1 + | +LL | struct TestType(::std::marker::PhantomData); + | ^^^^^^^^^^^^^^^^^^ + = note: `#[warn(suspicious_auto_trait_impls)]` on by default + +error: aborting due to 2 previous errors; 1 warning emitted Some errors have detailed explanations: E0119, E0751. For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/issues/issue-11709.rs b/tests/ui/issues/issue-11709.rs index cb5e3dff3..58424f9e4 100644 --- a/tests/ui/issues/issue-11709.rs +++ b/tests/ui/issues/issue-11709.rs @@ -1,6 +1,5 @@ // run-pass #![allow(dead_code)] -// ignore-pretty issue #37199 // Don't panic on blocks without results // There are several tests in this run-pass that raised diff --git a/tests/ui/issues/issue-12511.stderr b/tests/ui/issues/issue-12511.stderr index 789a1141c..558aad109 100644 --- a/tests/ui/issues/issue-12511.stderr +++ b/tests/ui/issues/issue-12511.stderr @@ -1,20 +1,10 @@ error[E0391]: cycle detected when computing the super predicates of `T1` - --> $DIR/issue-12511.rs:1:1 - | -LL | trait T1 : T2 { - | ^^^^^^^^^^^^^ - | -note: ...which requires computing the super traits of `T1`... --> $DIR/issue-12511.rs:1:12 | LL | trait T1 : T2 { | ^^ -note: ...which requires computing the super predicates of `T2`... - --> $DIR/issue-12511.rs:5:1 | -LL | trait T2 : T1 { - | ^^^^^^^^^^^^^ -note: ...which requires computing the super traits of `T2`... +note: ...which requires computing the super predicates of `T2`... --> $DIR/issue-12511.rs:5:12 | LL | trait T2 : T1 { diff --git a/tests/ui/issues/issue-17546.stderr b/tests/ui/issues/issue-17546.stderr index 81592320a..cf7ed1bbd 100644 --- a/tests/ui/issues/issue-17546.stderr +++ b/tests/ui/issues/issue-17546.stderr @@ -24,13 +24,13 @@ LL | fn new() -> Result { | help: consider importing one of these items instead | -LL | use std::fmt::Result; +LL + use std::fmt::Result; | -LL | use std::io::Result; +LL + use std::io::Result; | -LL | use std::result::Result; +LL + use std::result::Result; | -LL | use std::thread::Result; +LL + use std::thread::Result; | error[E0573]: expected type, found variant `Result` @@ -41,13 +41,13 @@ LL | fn new() -> Result { | help: consider importing one of these items instead | -LL | use std::fmt::Result; +LL + use std::fmt::Result; | -LL | use std::io::Result; +LL + use std::io::Result; | -LL | use std::result::Result; +LL + use std::result::Result; | -LL | use std::thread::Result; +LL + use std::thread::Result; | error[E0573]: expected type, found variant `NoResult` diff --git a/tests/ui/issues/issue-19086.stderr b/tests/ui/issues/issue-19086.stderr index a3c06a725..90d0bb406 100644 --- a/tests/ui/issues/issue-19086.stderr +++ b/tests/ui/issues/issue-19086.stderr @@ -5,7 +5,7 @@ LL | FooB { x: i32, y: i32 } | ----------------------- `FooB` defined here ... LL | FooB(a, b) => println!("{} {}", a, b), - | ^^^^^^^^^^ help: use struct pattern syntax instead: `FooB { x, y }` + | ^^^^^^^^^^ help: use struct pattern syntax instead: `FooB { x: a, y: b }` error: aborting due to previous error diff --git a/tests/ui/issues/issue-20162.stderr b/tests/ui/issues/issue-20162.stderr index 1c5b76fbf..ebdf2528f 100644 --- a/tests/ui/issues/issue-20162.stderr +++ b/tests/ui/issues/issue-20162.stderr @@ -8,7 +8,8 @@ note: required by a bound in `slice::::sort` --> $SRC_DIR/alloc/src/slice.rs:LL:COL help: consider annotating `X` with `#[derive(Ord)]` | -LL | #[derive(Ord)] +LL + #[derive(Ord)] +LL | struct X { x: i32 } | error: aborting due to previous error diff --git a/tests/ui/issues/issue-20413.stderr b/tests/ui/issues/issue-20413.stderr index 202e84631..8891a2678 100644 --- a/tests/ui/issues/issue-20413.stderr +++ b/tests/ui/issues/issue-20413.stderr @@ -20,51 +20,51 @@ note: required for `NoData Foo for T where NoData: Foo { | ^^^ ^ --- unsatisfied trait bound introduced here = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt' - = note: 127 redundant requirements hidden + = note: 126 redundant requirements hidden = note: required for `NoData` to implement `Foo` -error[E0275]: overflow evaluating the requirement `EvenLessData>>>>>>: Baz` +error[E0275]: overflow evaluating the requirement `AlmostNoData>>>>>>: Bar` --> $DIR/issue-20413.rs:28:42 | LL | impl Bar for T where EvenLessData: Baz { | ^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`) -note: required for `AlmostNoData>>>>>>` to implement `Bar` - --> $DIR/issue-20413.rs:28:9 - | -LL | impl Bar for T where EvenLessData: Baz { - | ^^^ ^ --- unsatisfied trait bound introduced here - = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt' note: required for `EvenLessData>>>>>>` to implement `Baz` --> $DIR/issue-20413.rs:35:9 | LL | impl Baz for T where AlmostNoData: Bar { | ^^^ ^ --- unsatisfied trait bound introduced here = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt' - = note: 126 redundant requirements hidden +note: required for `AlmostNoData>>>>>>` to implement `Bar` + --> $DIR/issue-20413.rs:28:9 + | +LL | impl Bar for T where EvenLessData: Baz { + | ^^^ ^ --- unsatisfied trait bound introduced here + = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt' + = note: 125 redundant requirements hidden = note: required for `EvenLessData` to implement `Baz` -error[E0275]: overflow evaluating the requirement `AlmostNoData>>>>>>: Bar` +error[E0275]: overflow evaluating the requirement `EvenLessData>>>>>>: Baz` --> $DIR/issue-20413.rs:35:42 | LL | impl Baz for T where AlmostNoData: Bar { | ^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`) -note: required for `EvenLessData>>>>>>` to implement `Baz` - --> $DIR/issue-20413.rs:35:9 - | -LL | impl Baz for T where AlmostNoData: Bar { - | ^^^ ^ --- unsatisfied trait bound introduced here - = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt' note: required for `AlmostNoData>>>>>>` to implement `Bar` --> $DIR/issue-20413.rs:28:9 | LL | impl Bar for T where EvenLessData: Baz { | ^^^ ^ --- unsatisfied trait bound introduced here = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt' - = note: 126 redundant requirements hidden +note: required for `EvenLessData>>>>>>` to implement `Baz` + --> $DIR/issue-20413.rs:35:9 + | +LL | impl Baz for T where AlmostNoData: Bar { + | ^^^ ^ --- unsatisfied trait bound introduced here + = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt' + = note: 125 redundant requirements hidden = note: required for `AlmostNoData` to implement `Bar` error: aborting due to 4 previous errors diff --git a/tests/ui/issues/issue-20772.stderr b/tests/ui/issues/issue-20772.stderr index 22b9f5bd4..416fd8c06 100644 --- a/tests/ui/issues/issue-20772.stderr +++ b/tests/ui/issues/issue-20772.stderr @@ -5,7 +5,7 @@ LL | trait T : Iterator | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: ...which immediately requires computing the super traits of `T` with associated type name `Item` again -note: cycle used when computing the super traits of `T` +note: cycle used when computing the super predicates of `T` --> $DIR/issue-20772.rs:1:1 | LL | trait T : Iterator diff --git a/tests/ui/issues/issue-21160.stderr b/tests/ui/issues/issue-21160.stderr index 266749376..b39a3aad3 100644 --- a/tests/ui/issues/issue-21160.stderr +++ b/tests/ui/issues/issue-21160.stderr @@ -9,7 +9,8 @@ LL | struct Foo(Bar); = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Bar` with `#[derive(Hash)]` | -LL | #[derive(Hash)] +LL + #[derive(Hash)] +LL | struct Bar; | error: aborting due to previous error diff --git a/tests/ui/issues/issue-27340.rs b/tests/ui/issues/issue-27340.rs index 61c77cc1f..aff37d95a 100644 --- a/tests/ui/issues/issue-27340.rs +++ b/tests/ui/issues/issue-27340.rs @@ -1,6 +1,6 @@ struct Foo; #[derive(Copy, Clone)] -//~^ ERROR the trait `Copy` may not be implemented for this type +//~^ ERROR the trait `Copy` cannot be implemented for this type struct Bar(Foo); fn main() {} diff --git a/tests/ui/issues/issue-27340.stderr b/tests/ui/issues/issue-27340.stderr index 40889b866..9caaffd9c 100644 --- a/tests/ui/issues/issue-27340.stderr +++ b/tests/ui/issues/issue-27340.stderr @@ -1,4 +1,4 @@ -error[E0204]: the trait `Copy` may not be implemented for this type +error[E0204]: the trait `Copy` cannot be implemented for this type --> $DIR/issue-27340.rs:2:10 | LL | #[derive(Copy, Clone)] diff --git a/tests/ui/issues/issue-27842.rs b/tests/ui/issues/issue-27842.rs index 3bcfa1330..060d3b34e 100644 --- a/tests/ui/issues/issue-27842.rs +++ b/tests/ui/issues/issue-27842.rs @@ -8,4 +8,9 @@ fn main() { let i = 0_usize; let _ = tup[i]; //~^ ERROR cannot index into a value of type + + // the case where the index is out of bounds + let tup = (10,); + let _ = tup[3]; + //~^ ERROR cannot index into a value of type } diff --git a/tests/ui/issues/issue-27842.stderr b/tests/ui/issues/issue-27842.stderr index 784666a63..83333aa0c 100644 --- a/tests/ui/issues/issue-27842.stderr +++ b/tests/ui/issues/issue-27842.stderr @@ -8,10 +8,20 @@ error[E0608]: cannot index into a value of type `({integer}, {integer}, {integer --> $DIR/issue-27842.rs:9:13 | LL | let _ = tup[i]; + | ^^^^-^ + | | + | cannot access tuple elements at a variable index + | + = help: to access tuple elements, use tuple indexing syntax (e.g., `tuple.0`) + +error[E0608]: cannot index into a value of type `({integer},)` + --> $DIR/issue-27842.rs:14:13 + | +LL | let _ = tup[3]; | ^^^^^^ | = help: to access tuple elements, use tuple indexing syntax (e.g., `tuple.0`) -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0608`. diff --git a/tests/ui/issues/issue-28433.rs b/tests/ui/issues/issue-28433.rs index 8d05c32d5..2298ad240 100644 --- a/tests/ui/issues/issue-28433.rs +++ b/tests/ui/issues/issue-28433.rs @@ -1,9 +1,9 @@ enum Bird { pub Duck, - //~^ ERROR unnecessary visibility qualifier + //~^ ERROR visibility qualifiers are not permitted here Goose, pub(crate) Dove - //~^ ERROR unnecessary visibility qualifier + //~^ ERROR visibility qualifiers are not permitted here } diff --git a/tests/ui/issues/issue-28433.stderr b/tests/ui/issues/issue-28433.stderr index 9f5f63336..5fb8a8962 100644 --- a/tests/ui/issues/issue-28433.stderr +++ b/tests/ui/issues/issue-28433.stderr @@ -1,14 +1,18 @@ -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/issue-28433.rs:2:5 | LL | pub Duck, - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: enum variants and their fields always share the visibility of the enum they are in -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/issue-28433.rs:5:5 | LL | pub(crate) Dove | ^^^^^^^^^^ + | + = note: enum variants and their fields always share the visibility of the enum they are in error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-28839.rs b/tests/ui/issues/issue-28839.rs index 73be87a0c..c086f412a 100644 --- a/tests/ui/issues/issue-28839.rs +++ b/tests/ui/issues/issue-28839.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty issue #37199 pub struct Foo; diff --git a/tests/ui/issues/issue-3029.rs b/tests/ui/issues/issue-3029.rs index a5d30960a..43c8a0a23 100644 --- a/tests/ui/issues/issue-3029.rs +++ b/tests/ui/issues/issue-3029.rs @@ -2,9 +2,7 @@ // error-pattern:so long // ignore-emscripten no processes -#![allow(unused_allocation)] #![allow(unreachable_code)] -#![allow(unused_variables)] fn main() { let mut x = Vec::new(); diff --git a/tests/ui/issues/issue-35976.unimported.stderr b/tests/ui/issues/issue-35976.unimported.stderr index 5d61bb8ea..b31d2a315 100644 --- a/tests/ui/issues/issue-35976.unimported.stderr +++ b/tests/ui/issues/issue-35976.unimported.stderr @@ -9,7 +9,7 @@ LL | arg.wait(); | help: another candidate was found in the following trait, perhaps add a `use` for it: | -LL | use private::Future; +LL + use private::Future; | error: aborting due to previous error diff --git a/tests/ui/issues/issue-37534.stderr b/tests/ui/issues/issue-37534.stderr index 895479986..7d3dd8800 100644 --- a/tests/ui/issues/issue-37534.stderr +++ b/tests/ui/issues/issue-37534.stderr @@ -6,7 +6,7 @@ LL | struct Foo { } | help: consider importing this trait instead | -LL | use std::hash::Hash; +LL + use std::hash::Hash; | warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported diff --git a/tests/ui/issues/issue-38190.rs b/tests/ui/issues/issue-38190.rs index cfa0420c8..3bb4c7b98 100644 --- a/tests/ui/issues/issue-38190.rs +++ b/tests/ui/issues/issue-38190.rs @@ -1,6 +1,5 @@ // run-pass // aux-build:issue-38190.rs -// ignore-pretty issue #37195 #[macro_use] extern crate issue_38190; diff --git a/tests/ui/issues/issue-39175.stderr b/tests/ui/issues/issue-39175.stderr index afceae82e..3a1476ac0 100644 --- a/tests/ui/issues/issue-39175.stderr +++ b/tests/ui/issues/issue-39175.stderr @@ -7,7 +7,7 @@ LL | Command::new("echo").arg("hello").exec(); = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use std::os::unix::process::CommandExt; +LL + use std::os::unix::process::CommandExt; | error: aborting due to previous error diff --git a/tests/ui/issues/issue-50403.rs b/tests/ui/issues/issue-50403.rs index 012057fc2..ab22aff26 100644 --- a/tests/ui/issues/issue-50403.rs +++ b/tests/ui/issues/issue-50403.rs @@ -1,5 +1,5 @@ #![feature(concat_idents)] fn main() { - let x = concat_idents!(); //~ ERROR concat_idents! takes 1 or more arguments + let x = concat_idents!(); //~ ERROR `concat_idents!()` takes 1 or more arguments } diff --git a/tests/ui/issues/issue-50403.stderr b/tests/ui/issues/issue-50403.stderr index a3a2ed044..d50befa5e 100644 --- a/tests/ui/issues/issue-50403.stderr +++ b/tests/ui/issues/issue-50403.stderr @@ -1,4 +1,4 @@ -error: concat_idents! takes 1 or more arguments +error: `concat_idents!()` takes 1 or more arguments --> $DIR/issue-50403.rs:4:13 | LL | let x = concat_idents!(); diff --git a/tests/ui/issues/issue-56175.stderr b/tests/ui/issues/issue-56175.stderr index 013a440ed..1ddee1f48 100644 --- a/tests/ui/issues/issue-56175.stderr +++ b/tests/ui/issues/issue-56175.stderr @@ -12,7 +12,7 @@ LL | fn trait_method(&self) { = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use reexported_trait::Trait; +LL + use reexported_trait::Trait; | error[E0599]: no method named `trait_method_b` found for struct `FooStruct` in the current scope @@ -29,7 +29,7 @@ LL | fn trait_method_b(&self) { = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use reexported_trait::TraitBRename; +LL + use reexported_trait::TraitBRename; | error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-59488.stderr b/tests/ui/issues/issue-59488.stderr index d45beefa4..ac8862716 100644 --- a/tests/ui/issues/issue-59488.stderr +++ b/tests/ui/issues/issue-59488.stderr @@ -90,16 +90,6 @@ LL | assert_eq!(Foo::Bar, i); | ^^^^^^^^^^^^^^^^^^^^^^^ `fn(usize) -> Foo {Foo::Bar}` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = help: the trait `Debug` is not implemented for fn item `fn(usize) -> Foo {Foo::Bar}` - = help: the following other types implement trait `Debug`: - extern "C" fn() -> Ret - extern "C" fn(A, B) -> Ret - extern "C" fn(A, B, ...) -> Ret - extern "C" fn(A, B, C) -> Ret - extern "C" fn(A, B, C, ...) -> Ret - extern "C" fn(A, B, C, D) -> Ret - extern "C" fn(A, B, C, D, ...) -> Ret - extern "C" fn(A, B, C, D, E) -> Ret - and 118 others = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` @@ -109,16 +99,6 @@ LL | assert_eq!(Foo::Bar, i); | ^^^^^^^^^^^^^^^^^^^^^^^ `fn(usize) -> Foo {Foo::Bar}` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = help: the trait `Debug` is not implemented for fn item `fn(usize) -> Foo {Foo::Bar}` - = help: the following other types implement trait `Debug`: - extern "C" fn() -> Ret - extern "C" fn(A, B) -> Ret - extern "C" fn(A, B, ...) -> Ret - extern "C" fn(A, B, C) -> Ret - extern "C" fn(A, B, C, ...) -> Ret - extern "C" fn(A, B, C, D) -> Ret - extern "C" fn(A, B, C, D, ...) -> Ret - extern "C" fn(A, B, C, D, E) -> Ret - and 118 others = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 10 previous errors diff --git a/tests/ui/issues/issue-61696.rs b/tests/ui/issues/issue-61696.rs deleted file mode 100644 index dca52927f..000000000 --- a/tests/ui/issues/issue-61696.rs +++ /dev/null @@ -1,66 +0,0 @@ -// run-pass - -pub enum Infallible {} - -// The check that the `bool` field of `V1` is encoding a "niche variant" -// (i.e. not `V1`, so `V3` or `V4`) used to be mathematically incorrect, -// causing valid `V1` values to be interpreted as other variants. -pub enum E1 { - V1 { f: bool }, - V2 { f: Infallible }, - V3, - V4, -} - -// Computing the discriminant used to be done using the niche type (here `u8`, -// from the `bool` field of `V1`), overflowing for variants with large enough -// indices (`V3` and `V4`), causing them to be interpreted as other variants. -pub enum E2 { - V1 { f: bool }, - - /*_00*/ _01(X), _02(X), _03(X), _04(X), _05(X), _06(X), _07(X), - _08(X), _09(X), _0A(X), _0B(X), _0C(X), _0D(X), _0E(X), _0F(X), - _10(X), _11(X), _12(X), _13(X), _14(X), _15(X), _16(X), _17(X), - _18(X), _19(X), _1A(X), _1B(X), _1C(X), _1D(X), _1E(X), _1F(X), - _20(X), _21(X), _22(X), _23(X), _24(X), _25(X), _26(X), _27(X), - _28(X), _29(X), _2A(X), _2B(X), _2C(X), _2D(X), _2E(X), _2F(X), - _30(X), _31(X), _32(X), _33(X), _34(X), _35(X), _36(X), _37(X), - _38(X), _39(X), _3A(X), _3B(X), _3C(X), _3D(X), _3E(X), _3F(X), - _40(X), _41(X), _42(X), _43(X), _44(X), _45(X), _46(X), _47(X), - _48(X), _49(X), _4A(X), _4B(X), _4C(X), _4D(X), _4E(X), _4F(X), - _50(X), _51(X), _52(X), _53(X), _54(X), _55(X), _56(X), _57(X), - _58(X), _59(X), _5A(X), _5B(X), _5C(X), _5D(X), _5E(X), _5F(X), - _60(X), _61(X), _62(X), _63(X), _64(X), _65(X), _66(X), _67(X), - _68(X), _69(X), _6A(X), _6B(X), _6C(X), _6D(X), _6E(X), _6F(X), - _70(X), _71(X), _72(X), _73(X), _74(X), _75(X), _76(X), _77(X), - _78(X), _79(X), _7A(X), _7B(X), _7C(X), _7D(X), _7E(X), _7F(X), - _80(X), _81(X), _82(X), _83(X), _84(X), _85(X), _86(X), _87(X), - _88(X), _89(X), _8A(X), _8B(X), _8C(X), _8D(X), _8E(X), _8F(X), - _90(X), _91(X), _92(X), _93(X), _94(X), _95(X), _96(X), _97(X), - _98(X), _99(X), _9A(X), _9B(X), _9C(X), _9D(X), _9E(X), _9F(X), - _A0(X), _A1(X), _A2(X), _A3(X), _A4(X), _A5(X), _A6(X), _A7(X), - _A8(X), _A9(X), _AA(X), _AB(X), _AC(X), _AD(X), _AE(X), _AF(X), - _B0(X), _B1(X), _B2(X), _B3(X), _B4(X), _B5(X), _B6(X), _B7(X), - _B8(X), _B9(X), _BA(X), _BB(X), _BC(X), _BD(X), _BE(X), _BF(X), - _C0(X), _C1(X), _C2(X), _C3(X), _C4(X), _C5(X), _C6(X), _C7(X), - _C8(X), _C9(X), _CA(X), _CB(X), _CC(X), _CD(X), _CE(X), _CF(X), - _D0(X), _D1(X), _D2(X), _D3(X), _D4(X), _D5(X), _D6(X), _D7(X), - _D8(X), _D9(X), _DA(X), _DB(X), _DC(X), _DD(X), _DE(X), _DF(X), - _E0(X), _E1(X), _E2(X), _E3(X), _E4(X), _E5(X), _E6(X), _E7(X), - _E8(X), _E9(X), _EA(X), _EB(X), _EC(X), _ED(X), _EE(X), _EF(X), - _F0(X), _F1(X), _F2(X), _F3(X), _F4(X), _F5(X), _F6(X), _F7(X), - _F8(X), _F9(X), _FA(X), _FB(X), _FC(X), _FD(X), _FE(X), _FF(X), - - V3, - V4, -} - -fn main() { - if let E1::V2 { .. } = (E1::V1 { f: true }) { - unreachable!() - } - - if let E2::V1 { .. } = E2::V3:: { - unreachable!() - } -} diff --git a/tests/ui/issues/issue-62375.stderr b/tests/ui/issues/issue-62375.stderr index 478e025be..a6fd3700e 100644 --- a/tests/ui/issues/issue-62375.stderr +++ b/tests/ui/issues/issue-62375.stderr @@ -13,7 +13,8 @@ LL | enum A { | ^^^^^^ must implement `PartialEq<_>` help: consider annotating `A` with `#[derive(PartialEq)]` | -LL | #[derive(PartialEq)] +LL + #[derive(PartialEq)] +LL | enum A { | error: aborting due to previous error diff --git a/tests/ui/issues/issue-66667-function-cmp-cycle.rs b/tests/ui/issues/issue-66667-function-cmp-cycle.rs index 7b025be11..b4f09fbbb 100644 --- a/tests/ui/issues/issue-66667-function-cmp-cycle.rs +++ b/tests/ui/issues/issue-66667-function-cmp-cycle.rs @@ -1,16 +1,19 @@ fn first() { second == 1 //~ ERROR binary operation //~^ ERROR mismatched types + //~| ERROR mismatched types } fn second() { first == 1 //~ ERROR binary operation //~^ ERROR mismatched types + //~| ERROR mismatched types } fn bar() { bar == 1 //~ ERROR binary operation //~^ ERROR mismatched types + //~| ERROR mismatched types } fn main() {} diff --git a/tests/ui/issues/issue-66667-function-cmp-cycle.stderr b/tests/ui/issues/issue-66667-function-cmp-cycle.stderr index 887699ef5..d9a960ce1 100644 --- a/tests/ui/issues/issue-66667-function-cmp-cycle.stderr +++ b/tests/ui/issues/issue-66667-function-cmp-cycle.stderr @@ -15,8 +15,16 @@ LL | second == 1 = note: expected fn item `fn() {second}` found type `{integer}` +error[E0308]: mismatched types + --> $DIR/issue-66667-function-cmp-cycle.rs:2:5 + | +LL | fn first() { + | - help: try adding a return type: `-> bool` +LL | second == 1 + | ^^^^^^^^^^^ expected `()`, found `bool` + error[E0369]: binary operation `==` cannot be applied to type `fn() {first}` - --> $DIR/issue-66667-function-cmp-cycle.rs:7:11 + --> $DIR/issue-66667-function-cmp-cycle.rs:8:11 | LL | first == 1 | ----- ^^ - {integer} @@ -24,7 +32,7 @@ LL | first == 1 | fn() {first} error[E0308]: mismatched types - --> $DIR/issue-66667-function-cmp-cycle.rs:7:14 + --> $DIR/issue-66667-function-cmp-cycle.rs:8:14 | LL | first == 1 | ^ expected fn item, found integer @@ -32,8 +40,16 @@ LL | first == 1 = note: expected fn item `fn() {first}` found type `{integer}` +error[E0308]: mismatched types + --> $DIR/issue-66667-function-cmp-cycle.rs:8:5 + | +LL | fn second() { + | - help: try adding a return type: `-> bool` +LL | first == 1 + | ^^^^^^^^^^ expected `()`, found `bool` + error[E0369]: binary operation `==` cannot be applied to type `fn() {bar}` - --> $DIR/issue-66667-function-cmp-cycle.rs:12:9 + --> $DIR/issue-66667-function-cmp-cycle.rs:14:9 | LL | bar == 1 | --- ^^ - {integer} @@ -41,7 +57,7 @@ LL | bar == 1 | fn() {bar} error[E0308]: mismatched types - --> $DIR/issue-66667-function-cmp-cycle.rs:12:12 + --> $DIR/issue-66667-function-cmp-cycle.rs:14:12 | LL | bar == 1 | ^ expected fn item, found integer @@ -49,7 +65,15 @@ LL | bar == 1 = note: expected fn item `fn() {bar}` found type `{integer}` -error: aborting due to 6 previous errors +error[E0308]: mismatched types + --> $DIR/issue-66667-function-cmp-cycle.rs:14:5 + | +LL | fn bar() { + | - help: try adding a return type: `-> bool` +LL | bar == 1 + | ^^^^^^^^ expected `()`, found `bool` + +error: aborting due to 9 previous errors Some errors have detailed explanations: E0308, E0369. For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-77919.stderr b/tests/ui/issues/issue-77919.stderr index d154bfe0c..d6dcc8997 100644 --- a/tests/ui/issues/issue-77919.stderr +++ b/tests/ui/issues/issue-77919.stderr @@ -6,7 +6,7 @@ LL | _n: PhantomData, | help: consider importing this struct | -LL | use std::marker::PhantomData; +LL + use std::marker::PhantomData; | error[E0412]: cannot find type `VAL` in this scope diff --git a/tests/ui/issues/issue-9129.rs b/tests/ui/issues/issue-9129.rs index 04110b3ae..5d623ed54 100644 --- a/tests/ui/issues/issue-9129.rs +++ b/tests/ui/issues/issue-9129.rs @@ -2,7 +2,6 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] -// ignore-pretty unreported pub trait bomb { fn boom(&self, _: Ident); } pub struct S; diff --git a/tests/ui/issues/issue-98299.stderr b/tests/ui/issues/issue-98299.stderr index fd905392a..4fd9f3030 100644 --- a/tests/ui/issues/issue-98299.stderr +++ b/tests/ui/issues/issue-98299.stderr @@ -4,7 +4,7 @@ error[E0282]: type annotations needed for `SmallCString` LL | SmallCString::try_from(p).map(|cstr| cstr); | ^^^^ | -help: consider giving this closure parameter an explicit type, where the the value of const parameter `N` is specified +help: consider giving this closure parameter an explicit type, where the value of const parameter `N` is specified | LL | SmallCString::try_from(p).map(|cstr: SmallCString| cstr); | +++++++++++++++++ diff --git a/tests/ui/iterators/into-iter-on-arrays-lint.fixed b/tests/ui/iterators/into-iter-on-arrays-lint.fixed index 6e02a7024..5b91aaf9e 100644 --- a/tests/ui/iterators/into-iter-on-arrays-lint.fixed +++ b/tests/ui/iterators/into-iter-on-arrays-lint.fixed @@ -2,7 +2,7 @@ // run-rustfix // rustfix-only-machine-applicable -#[allow(unused_must_use)] +#[allow(unused_must_use, unused_allocation)] fn main() { let small = [1, 2]; let big = [0u8; 33]; diff --git a/tests/ui/iterators/into-iter-on-arrays-lint.rs b/tests/ui/iterators/into-iter-on-arrays-lint.rs index 582d5cadd..25b0cef73 100644 --- a/tests/ui/iterators/into-iter-on-arrays-lint.rs +++ b/tests/ui/iterators/into-iter-on-arrays-lint.rs @@ -2,7 +2,7 @@ // run-rustfix // rustfix-only-machine-applicable -#[allow(unused_must_use)] +#[allow(unused_must_use, unused_allocation)] fn main() { let small = [1, 2]; let big = [0u8; 33]; diff --git a/tests/ui/kindck/kindck-impl-type-params.stderr b/tests/ui/kindck/kindck-impl-type-params.stderr index 6fd1fc3f7..efb25bf83 100644 --- a/tests/ui/kindck/kindck-impl-type-params.stderr +++ b/tests/ui/kindck/kindck-impl-type-params.stderr @@ -107,7 +107,8 @@ LL | impl Gettable for S {} = note: required for the cast from `S` to the object type `dyn Gettable` help: consider annotating `Foo` with `#[derive(Copy)]` | -LL | #[derive(Copy)] +LL + #[derive(Copy)] +LL | struct Foo; // does not impl Copy | error: aborting due to 6 previous errors diff --git a/tests/ui/lang-items/no_owned_box_lang_item.rs b/tests/ui/lang-items/no_owned_box_lang_item.rs deleted file mode 100644 index c22b44ffc..000000000 --- a/tests/ui/lang-items/no_owned_box_lang_item.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Test that we don't ICE when we are missing the owned_box lang item. - -// error-pattern: requires `owned_box` lang_item - -#![feature(lang_items, box_syntax)] -#![no_std] - -use core::panic::PanicInfo; - -fn main() { - let x = box 1i32; -} - -#[lang = "eh_personality"] extern "C" fn eh_personality() {} -#[lang = "eh_catch_typeinfo"] static EH_CATCH_TYPEINFO: u8 = 0; -#[lang = "panic_impl"] fn panic_impl(panic: &PanicInfo) -> ! { loop {} } diff --git a/tests/ui/lang-items/no_owned_box_lang_item.stderr b/tests/ui/lang-items/no_owned_box_lang_item.stderr deleted file mode 100644 index c55c246b5..000000000 --- a/tests/ui/lang-items/no_owned_box_lang_item.stderr +++ /dev/null @@ -1,4 +0,0 @@ -error: requires `owned_box` lang_item - -error: aborting due to previous error - diff --git a/tests/ui/late-bound-lifetimes/issue-80618.rs b/tests/ui/late-bound-lifetimes/issue-80618.rs new file mode 100644 index 000000000..6aa8ff461 --- /dev/null +++ b/tests/ui/late-bound-lifetimes/issue-80618.rs @@ -0,0 +1,8 @@ +fn foo<'a>(x: &'a str) -> &'a str { + x +} + +fn main() { + let _ = foo::<'static>; +//~^ ERROR cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794] +} diff --git a/tests/ui/late-bound-lifetimes/issue-80618.stderr b/tests/ui/late-bound-lifetimes/issue-80618.stderr new file mode 100644 index 000000000..cf7423fc1 --- /dev/null +++ b/tests/ui/late-bound-lifetimes/issue-80618.stderr @@ -0,0 +1,15 @@ +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present + --> $DIR/issue-80618.rs:6:19 + | +LL | let _ = foo::<'static>; + | ^^^^^^^ + | +note: the late bound lifetime parameter is introduced here + --> $DIR/issue-80618.rs:1:8 + | +LL | fn foo<'a>(x: &'a str) -> &'a str { + | ^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0794`. diff --git a/tests/ui/layout/issue-84108.stderr b/tests/ui/layout/issue-84108.stderr index 36be64241..5ad450bed 100644 --- a/tests/ui/layout/issue-84108.stderr +++ b/tests/ui/layout/issue-84108.stderr @@ -6,7 +6,7 @@ LL | static FOO: (dyn AsRef, u8) = ("hello", 42); | help: consider importing this struct | -LL | use std::ffi::OsStr; +LL + use std::ffi::OsStr; | error[E0412]: cannot find type `Path` in this scope @@ -17,7 +17,7 @@ LL | const BAR: (&Path, [u8], usize) = ("hello", [], 42); | help: consider importing this struct | -LL | use std::path::Path; +LL + use std::path::Path; | error[E0277]: the size for values of type `[u8]` cannot be known at compilation time diff --git a/tests/ui/layout/transmute-to-tail-with-err.rs b/tests/ui/layout/transmute-to-tail-with-err.rs new file mode 100644 index 000000000..6753ce15e --- /dev/null +++ b/tests/ui/layout/transmute-to-tail-with-err.rs @@ -0,0 +1,8 @@ +trait Trait {} + +struct Bar(Box>); +//~^ ERROR cannot find type `T` in this scope + +fn main() { + let x: Bar = unsafe { std::mem::transmute(()) }; +} diff --git a/tests/ui/layout/transmute-to-tail-with-err.stderr b/tests/ui/layout/transmute-to-tail-with-err.stderr new file mode 100644 index 000000000..97ab59c39 --- /dev/null +++ b/tests/ui/layout/transmute-to-tail-with-err.stderr @@ -0,0 +1,14 @@ +error[E0412]: cannot find type `T` in this scope + --> $DIR/transmute-to-tail-with-err.rs:3:26 + | +LL | struct Bar(Box>); + | ^ not found in this scope + | +help: you might be missing a type parameter + | +LL | struct Bar(Box>); + | +++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/lexer/lexer-crlf-line-endings-string-literal-doc-comment.rs b/tests/ui/lexer/lexer-crlf-line-endings-string-literal-doc-comment.rs index 802be7f5a..9ba01540a 100644 --- a/tests/ui/lexer/lexer-crlf-line-endings-string-literal-doc-comment.rs +++ b/tests/ui/lexer/lexer-crlf-line-endings-string-literal-doc-comment.rs @@ -6,7 +6,6 @@ // N.B., this file needs CRLF line endings. The .gitattributes file in // this directory should enforce it. -// ignore-pretty issue #37195 /// Doc comment that ends in CRLF pub fn foo() {} diff --git a/tests/ui/lexer/unterminated-comment.rs b/tests/ui/lexer/unterminated-comment.rs new file mode 100644 index 000000000..1cfdfb1fb --- /dev/null +++ b/tests/ui/lexer/unterminated-comment.rs @@ -0,0 +1 @@ +/* //~ ERROR E0758 diff --git a/tests/ui/lexer/unterminated-comment.stderr b/tests/ui/lexer/unterminated-comment.stderr new file mode 100644 index 000000000..c513fafee --- /dev/null +++ b/tests/ui/lexer/unterminated-comment.stderr @@ -0,0 +1,9 @@ +error[E0758]: unterminated block comment + --> $DIR/unterminated-comment.rs:1:1 + | +LL | /* + | ^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0758`. diff --git a/tests/ui/lexer/unterminated-nested-comment.rs b/tests/ui/lexer/unterminated-nested-comment.rs new file mode 100644 index 000000000..db5f2f3ba --- /dev/null +++ b/tests/ui/lexer/unterminated-nested-comment.rs @@ -0,0 +1,4 @@ +/* //~ ERROR E0758 +/* */ +/* +*/ diff --git a/tests/ui/lexer/unterminated-nested-comment.stderr b/tests/ui/lexer/unterminated-nested-comment.stderr new file mode 100644 index 000000000..3653e76c9 --- /dev/null +++ b/tests/ui/lexer/unterminated-nested-comment.stderr @@ -0,0 +1,21 @@ +error[E0758]: unterminated block comment + --> $DIR/unterminated-nested-comment.rs:1:1 + | +LL | /* + | ^- + | | + | _unterminated block comment + | | +LL | | /* */ +LL | | /* + | | -- + | | | + | | ...as last nested comment starts here, maybe you want to close this instead? +LL | | */ + | |_--^ + | | + | ...and last nested comment terminates here. + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0758`. diff --git a/tests/ui/lifetimes/issue-93911.rs b/tests/ui/lifetimes/issue-93911.rs new file mode 100644 index 000000000..b7ccac1ee --- /dev/null +++ b/tests/ui/lifetimes/issue-93911.rs @@ -0,0 +1,18 @@ +// check-pass +// edition:2021 + +#![allow(dead_code)] + +struct Foo<'a>(&'a u32); + +impl<'a> Foo<'a> { + async fn foo() { + struct Bar<'b>(&'b u32); + + impl<'b> Bar<'b> { + async fn bar() {} + } + } +} + +fn main() {} diff --git a/tests/ui/lifetimes/issue-95023.stderr b/tests/ui/lifetimes/issue-95023.stderr index 35c3797c7..5b93eff86 100644 --- a/tests/ui/lifetimes/issue-95023.stderr +++ b/tests/ui/lifetimes/issue-95023.stderr @@ -25,6 +25,12 @@ error[E0229]: associated type bindings are not allowed here | LL | impl Fn(&isize) for Error { | ^^^^^^^^^^ associated type not allowed here + | +help: parenthesized trait syntax expands to `Fn<(&isize,), Output=()>` + --> $DIR/issue-95023.rs:3:6 + | +LL | impl Fn(&isize) for Error { + | ^^^^^^^^^^ error[E0220]: associated type `B` not found for `Self` --> $DIR/issue-95023.rs:6:44 diff --git a/tests/ui/lifetimes/unusual-rib-combinations.rs b/tests/ui/lifetimes/unusual-rib-combinations.rs index 1c122f42e..0ae68ad04 100644 --- a/tests/ui/lifetimes/unusual-rib-combinations.rs +++ b/tests/ui/lifetimes/unusual-rib-combinations.rs @@ -25,4 +25,9 @@ fn d() {} //~^ ERROR missing lifetime specifier //~| ERROR `S<'_>` is forbidden as the type of a const generic parameter +trait Foo<'a> {} +struct Bar Foo<'a>)>; +//~^ ERROR use of non-static lifetime `'a` in const generic +//~| ERROR `&dyn for<'a> Foo<'a>` is forbidden as the type of a const generic parameter + fn main() {} diff --git a/tests/ui/lifetimes/unusual-rib-combinations.stderr b/tests/ui/lifetimes/unusual-rib-combinations.stderr index 68f4fce01..20163d289 100644 --- a/tests/ui/lifetimes/unusual-rib-combinations.stderr +++ b/tests/ui/lifetimes/unusual-rib-combinations.stderr @@ -9,6 +9,14 @@ help: consider introducing a named lifetime parameter LL | fn d<'a, const C: S<'a>>() {} | +++ ++++ +error[E0771]: use of non-static lifetime `'a` in const generic + --> $DIR/unusual-rib-combinations.rs:29:22 + | +LL | struct Bar Foo<'a>)>; + | ^^ + | + = note: for more information, see issue #74052 + error[E0214]: parenthesized type parameters may only be used with a `Fn` trait --> $DIR/unusual-rib-combinations.rs:7:16 | @@ -55,7 +63,16 @@ LL | fn d() {} = note: the only supported types are integers, `bool` and `char` = help: more complex types are supported with `#![feature(adt_const_params)]` -error: aborting due to 7 previous errors +error: `&dyn for<'a> Foo<'a>` is forbidden as the type of a const generic parameter + --> $DIR/unusual-rib-combinations.rs:29:21 + | +LL | struct Bar Foo<'a>)>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + = help: more complex types are supported with `#![feature(adt_const_params)]` + +error: aborting due to 9 previous errors -Some errors have detailed explanations: E0106, E0214, E0308. +Some errors have detailed explanations: E0106, E0214, E0308, E0771. For more information about an error, try `rustc --explain E0106`. diff --git a/tests/ui/limits/issue-55878.stderr b/tests/ui/limits/issue-55878.stderr index 99f1fdf75..510b36edd 100644 --- a/tests/ui/limits/issue-55878.stderr +++ b/tests/ui/limits/issue-55878.stderr @@ -25,14 +25,6 @@ LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); | = note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) -note: erroneous constant used - --> $DIR/issue-55878.rs:7:26 - | -LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) - error: aborting due to previous error For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/linkage-attr/issue-109144.rs b/tests/ui/linkage-attr/issue-109144.rs new file mode 100644 index 000000000..2f740e553 --- /dev/null +++ b/tests/ui/linkage-attr/issue-109144.rs @@ -0,0 +1,4 @@ +#![crate_type = "lib"] +#[link(kind = "static", modifiers = "+whole-archive,+bundle")] +//~^ ERROR `#[link]` attribute requires a `name = "string"` argument +extern {} diff --git a/tests/ui/linkage-attr/issue-109144.stderr b/tests/ui/linkage-attr/issue-109144.stderr new file mode 100644 index 000000000..33187cfdb --- /dev/null +++ b/tests/ui/linkage-attr/issue-109144.stderr @@ -0,0 +1,9 @@ +error[E0459]: `#[link]` attribute requires a `name = "string"` argument + --> $DIR/issue-109144.rs:2:1 + | +LL | #[link(kind = "static", modifiers = "+whole-archive,+bundle")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `name` argument + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0459`. diff --git a/tests/ui/lint/anonymous-reexport.rs b/tests/ui/lint/anonymous-reexport.rs new file mode 100644 index 000000000..11ac5d071 --- /dev/null +++ b/tests/ui/lint/anonymous-reexport.rs @@ -0,0 +1,19 @@ +#![deny(unused_imports)] +#![crate_type = "rlib"] + +mod my_mod { + pub trait Foo {} + pub type TyFoo = dyn Foo; + pub struct Bar; + pub type TyBar = Bar; +} + +pub use self::my_mod::Foo as _; +pub use self::my_mod::TyFoo as _; //~ ERROR unused import +pub use self::my_mod::Bar as _; //~ ERROR unused import +pub use self::my_mod::TyBar as _; //~ ERROR unused import +pub use self::my_mod::{Bar as _}; //~ ERROR unused import +pub use self::my_mod::{Bar as _, Foo as _}; //~ ERROR unused import +pub use self::my_mod::{Bar as _, TyBar as _}; //~ ERROR unused imports +#[allow(unused_imports)] +use self::my_mod::TyBar as _; diff --git a/tests/ui/lint/anonymous-reexport.stderr b/tests/ui/lint/anonymous-reexport.stderr new file mode 100644 index 000000000..e3854a545 --- /dev/null +++ b/tests/ui/lint/anonymous-reexport.stderr @@ -0,0 +1,44 @@ +error: unused import: `self::my_mod::TyFoo as _` + --> $DIR/anonymous-reexport.rs:12:9 + | +LL | pub use self::my_mod::TyFoo as _; + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/anonymous-reexport.rs:1:9 + | +LL | #![deny(unused_imports)] + | ^^^^^^^^^^^^^^ + +error: unused import: `self::my_mod::Bar as _` + --> $DIR/anonymous-reexport.rs:13:9 + | +LL | pub use self::my_mod::Bar as _; + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: unused import: `self::my_mod::TyBar as _` + --> $DIR/anonymous-reexport.rs:14:9 + | +LL | pub use self::my_mod::TyBar as _; + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: unused import: `Bar as _` + --> $DIR/anonymous-reexport.rs:15:24 + | +LL | pub use self::my_mod::{Bar as _}; + | ^^^^^^^^ + +error: unused import: `Bar as _` + --> $DIR/anonymous-reexport.rs:16:24 + | +LL | pub use self::my_mod::{Bar as _, Foo as _}; + | ^^^^^^^^ + +error: unused imports: `Bar as _`, `TyBar as _` + --> $DIR/anonymous-reexport.rs:17:24 + | +LL | pub use self::my_mod::{Bar as _, TyBar as _}; + | ^^^^^^^^ ^^^^^^^^^^ + +error: aborting due to 6 previous errors + diff --git a/tests/ui/lint/clashing-extern-fn.rs b/tests/ui/lint/clashing-extern-fn.rs index 809e06026..09fda33db 100644 --- a/tests/ui/lint/clashing-extern-fn.rs +++ b/tests/ui/lint/clashing-extern-fn.rs @@ -122,8 +122,8 @@ mod banana { weight: u32, length: u16, } // note: distinct type - // This should not trigger the lint because two::Banana is structurally equivalent to - // one::Banana. + // This should not trigger the lint because two::Banana is structurally equivalent to + // one::Banana. extern "C" { fn weigh_banana(count: *const Banana) -> u64; } @@ -223,6 +223,27 @@ mod transparent { } } +#[allow(improper_ctypes)] +mod zst { + mod transparent { + #[repr(transparent)] + struct TransparentZst(()); + extern "C" { + fn zst() -> (); + fn transparent_zst() -> TransparentZst; + } + } + + mod not_transparent { + struct NotTransparentZst(()); + extern "C" { + // These shouldn't warn since all return types are zero sized + fn zst() -> NotTransparentZst; + fn transparent_zst() -> NotTransparentZst; + } + } +} + mod missing_return_type { mod a { extern "C" { @@ -397,10 +418,14 @@ mod hidden_niche { use std::num::NonZeroUsize; #[repr(transparent)] - struct Transparent { x: NonZeroUsize } + struct Transparent { + x: NonZeroUsize, + } #[repr(transparent)] - struct TransparentNoNiche { y: UnsafeCell } + struct TransparentNoNiche { + y: UnsafeCell, + } extern "C" { fn hidden_niche_transparent() -> Option; diff --git a/tests/ui/lint/clashing-extern-fn.stderr b/tests/ui/lint/clashing-extern-fn.stderr index 217eed6c9..5d457ba0e 100644 --- a/tests/ui/lint/clashing-extern-fn.stderr +++ b/tests/ui/lint/clashing-extern-fn.stderr @@ -130,7 +130,7 @@ LL | fn transparent_incorrect() -> isize; found `unsafe extern "C" fn() -> isize` warning: `missing_return_type` redeclared with a different signature - --> $DIR/clashing-extern-fn.rs:238:13 + --> $DIR/clashing-extern-fn.rs:259:13 | LL | fn missing_return_type() -> usize; | ---------------------------------- `missing_return_type` previously declared here @@ -142,7 +142,7 @@ LL | fn missing_return_type(); found `unsafe extern "C" fn()` warning: `non_zero_usize` redeclared with a different signature - --> $DIR/clashing-extern-fn.rs:256:13 + --> $DIR/clashing-extern-fn.rs:277:13 | LL | fn non_zero_usize() -> core::num::NonZeroUsize; | ----------------------------------------------- `non_zero_usize` previously declared here @@ -154,7 +154,7 @@ LL | fn non_zero_usize() -> usize; found `unsafe extern "C" fn() -> usize` warning: `non_null_ptr` redeclared with a different signature - --> $DIR/clashing-extern-fn.rs:258:13 + --> $DIR/clashing-extern-fn.rs:279:13 | LL | fn non_null_ptr() -> core::ptr::NonNull; | ----------------------------------------------- `non_null_ptr` previously declared here @@ -166,7 +166,7 @@ LL | fn non_null_ptr() -> *const usize; found `unsafe extern "C" fn() -> *const usize` warning: `option_non_zero_usize_incorrect` redeclared with a different signature - --> $DIR/clashing-extern-fn.rs:356:13 + --> $DIR/clashing-extern-fn.rs:377:13 | LL | fn option_non_zero_usize_incorrect() -> usize; | ---------------------------------------------- `option_non_zero_usize_incorrect` previously declared here @@ -178,7 +178,7 @@ LL | fn option_non_zero_usize_incorrect() -> isize; found `unsafe extern "C" fn() -> isize` warning: `option_non_null_ptr_incorrect` redeclared with a different signature - --> $DIR/clashing-extern-fn.rs:358:13 + --> $DIR/clashing-extern-fn.rs:379:13 | LL | fn option_non_null_ptr_incorrect() -> *const usize; | --------------------------------------------------- `option_non_null_ptr_incorrect` previously declared here @@ -190,7 +190,7 @@ LL | fn option_non_null_ptr_incorrect() -> *const isize; found `unsafe extern "C" fn() -> *const isize` warning: `hidden_niche_transparent_no_niche` redeclared with a different signature - --> $DIR/clashing-extern-fn.rs:408:13 + --> $DIR/clashing-extern-fn.rs:433:13 | LL | fn hidden_niche_transparent_no_niche() -> usize; | ------------------------------------------------ `hidden_niche_transparent_no_niche` previously declared here @@ -202,7 +202,7 @@ LL | fn hidden_niche_transparent_no_niche() -> Option Option` warning: `hidden_niche_unsafe_cell` redeclared with a different signature - --> $DIR/clashing-extern-fn.rs:412:13 + --> $DIR/clashing-extern-fn.rs:437:13 | LL | fn hidden_niche_unsafe_cell() -> usize; | --------------------------------------- `hidden_niche_unsafe_cell` previously declared here @@ -214,7 +214,7 @@ LL | fn hidden_niche_unsafe_cell() -> Option Option>` warning: `extern` block uses type `Option`, which is not FFI-safe - --> $DIR/clashing-extern-fn.rs:408:55 + --> $DIR/clashing-extern-fn.rs:433:55 | LL | fn hidden_niche_transparent_no_niche() -> Option; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -224,7 +224,7 @@ LL | fn hidden_niche_transparent_no_niche() -> Option>`, which is not FFI-safe - --> $DIR/clashing-extern-fn.rs:412:46 + --> $DIR/clashing-extern-fn.rs:437:46 | LL | fn hidden_niche_unsafe_cell() -> Option>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe diff --git a/tests/ui/lint/dead-code/issue-59003.rs b/tests/ui/lint/dead-code/issue-59003.rs new file mode 100644 index 000000000..966d64128 --- /dev/null +++ b/tests/ui/lint/dead-code/issue-59003.rs @@ -0,0 +1,18 @@ +// check-pass + +// Make sure we don't have any false positives about the "struct is never constructed" lint. + +#![deny(dead_code)] + +struct Foo { + #[allow(dead_code)] + inner: u32, +} + +impl From for Foo { + fn from(inner: u32) -> Self { + Self { inner } + } +} + +fn main() {} diff --git a/tests/ui/lint/dead-code/issue-85255.rs b/tests/ui/lint/dead-code/issue-85255.rs index 1978bd4e8..d75a8e2dd 100644 --- a/tests/ui/lint/dead-code/issue-85255.rs +++ b/tests/ui/lint/dead-code/issue-85255.rs @@ -11,8 +11,8 @@ struct Foo { struct Bar; impl Bar { - fn a(&self) -> i32 { 5 } //~ WARNING: method `a` is never used - pub fn b(&self) -> i32 { 6 } //~ WARNING: method `b` is never used + fn a(&self) -> i32 { 5 } //~ WARNING: methods `a` and `b` are never used [dead_code] + pub fn b(&self) -> i32 { 6 } } pub(crate) struct Foo1 { @@ -23,8 +23,8 @@ pub(crate) struct Foo1 { pub(crate) struct Bar1; impl Bar1 { - fn a(&self) -> i32 { 5 } //~ WARNING: method `a` is never used - pub fn b(&self) -> i32 { 6 } //~ WARNING: method `b` is never used + fn a(&self) -> i32 { 5 } //~ WARNING: methods `a` and `b` are never used [dead_code] + pub fn b(&self) -> i32 { 6 } } pub(crate) struct Foo2 { @@ -35,8 +35,8 @@ pub(crate) struct Foo2 { pub(crate) struct Bar2; impl Bar2 { - fn a(&self) -> i32 { 5 } //~ WARNING: method `a` is never used - pub fn b(&self) -> i32 { 6 } //~ WARNING: method `b` is never used + fn a(&self) -> i32 { 5 } //~ WARNING: methods `a` and `b` are never used [dead_code] + pub fn b(&self) -> i32 { 6 } } diff --git a/tests/ui/lint/dead-code/issue-85255.stderr b/tests/ui/lint/dead-code/issue-85255.stderr index 58a19cf3c..d981085a4 100644 --- a/tests/ui/lint/dead-code/issue-85255.stderr +++ b/tests/ui/lint/dead-code/issue-85255.stderr @@ -14,6 +14,16 @@ note: the lint level is defined here LL | #![warn(dead_code)] | ^^^^^^^^^ +warning: methods `a` and `b` are never used + --> $DIR/issue-85255.rs:14:8 + | +LL | impl Bar { + | -------- methods in this implementation +LL | fn a(&self) -> i32 { 5 } + | ^ +LL | pub fn b(&self) -> i32 { 6 } + | ^ + warning: fields `a` and `b` are never read --> $DIR/issue-85255.rs:19:5 | @@ -24,6 +34,16 @@ LL | a: i32, LL | pub b: i32, | ^ +warning: methods `a` and `b` are never used + --> $DIR/issue-85255.rs:26:8 + | +LL | impl Bar1 { + | --------- methods in this implementation +LL | fn a(&self) -> i32 { 5 } + | ^ +LL | pub fn b(&self) -> i32 { 6 } + | ^ + warning: fields `a` and `b` are never read --> $DIR/issue-85255.rs:31:5 | @@ -34,41 +54,15 @@ LL | a: i32, LL | pub b: i32, | ^ -warning: method `a` is never used - --> $DIR/issue-85255.rs:14:8 - | -LL | fn a(&self) -> i32 { 5 } - | ^ - -warning: method `b` is never used - --> $DIR/issue-85255.rs:15:12 - | -LL | pub fn b(&self) -> i32 { 6 } - | ^ - -warning: method `a` is never used - --> $DIR/issue-85255.rs:26:8 - | -LL | fn a(&self) -> i32 { 5 } - | ^ - -warning: method `b` is never used - --> $DIR/issue-85255.rs:27:12 - | -LL | pub fn b(&self) -> i32 { 6 } - | ^ - -warning: method `a` is never used +warning: methods `a` and `b` are never used --> $DIR/issue-85255.rs:38:8 | +LL | impl Bar2 { + | --------- methods in this implementation LL | fn a(&self) -> i32 { 5 } | ^ - -warning: method `b` is never used - --> $DIR/issue-85255.rs:39:12 - | LL | pub fn b(&self) -> i32 { 6 } | ^ -warning: 9 warnings emitted +warning: 6 warnings emitted diff --git a/tests/ui/lint/dead-code/lint-dead-code-3.stderr b/tests/ui/lint/dead-code/lint-dead-code-3.stderr index 797b7559c..5c68cf0e1 100644 --- a/tests/ui/lint/dead-code/lint-dead-code-3.stderr +++ b/tests/ui/lint/dead-code/lint-dead-code-3.stderr @@ -10,6 +10,14 @@ note: the lint level is defined here LL | #![deny(dead_code)] | ^^^^^^^^^ +error: method `foo` is never used + --> $DIR/lint-dead-code-3.rs:16:8 + | +LL | impl Foo { + | -------- method in this implementation +LL | fn foo(&self) { + | ^^^ + error: function `bar` is never used --> $DIR/lint-dead-code-3.rs:21:4 | @@ -34,12 +42,6 @@ error: function `blah` is never used LL | fn blah() {} | ^^^^ -error: method `foo` is never used - --> $DIR/lint-dead-code-3.rs:16:8 - | -LL | fn foo(&self) { - | ^^^ - error: function `free` is never used --> $DIR/lint-dead-code-3.rs:62:8 | diff --git a/tests/ui/lint/dead-code/lint-dead-code-6.rs b/tests/ui/lint/dead-code/lint-dead-code-6.rs index e3074acf1..5b2b76b76 100644 --- a/tests/ui/lint/dead-code/lint-dead-code-6.rs +++ b/tests/ui/lint/dead-code/lint-dead-code-6.rs @@ -2,17 +2,16 @@ struct UnusedStruct; //~ ERROR struct `UnusedStruct` is never constructed impl UnusedStruct { - fn unused_impl_fn_1() { //~ ERROR associated function `unused_impl_fn_1` is never used + fn unused_impl_fn_1() { + //~^ ERROR associated functions `unused_impl_fn_1`, `unused_impl_fn_2`, and `unused_impl_fn_3` are never used [dead_code] println!("blah"); } - fn unused_impl_fn_2(var: i32) { //~ ERROR associated function `unused_impl_fn_2` is never used + fn unused_impl_fn_2(var: i32) { println!("foo {}", var); } - fn unused_impl_fn_3( //~ ERROR associated function `unused_impl_fn_3` is never used - var: i32, - ) { + fn unused_impl_fn_3(var: i32) { println!("bar {}", var); } } diff --git a/tests/ui/lint/dead-code/lint-dead-code-6.stderr b/tests/ui/lint/dead-code/lint-dead-code-6.stderr index f9d83308a..ce4110086 100644 --- a/tests/ui/lint/dead-code/lint-dead-code-6.stderr +++ b/tests/ui/lint/dead-code/lint-dead-code-6.stderr @@ -10,23 +10,19 @@ note: the lint level is defined here LL | #![deny(dead_code)] | ^^^^^^^^^ -error: associated function `unused_impl_fn_1` is never used +error: associated functions `unused_impl_fn_1`, `unused_impl_fn_2`, and `unused_impl_fn_3` are never used --> $DIR/lint-dead-code-6.rs:5:8 | +LL | impl UnusedStruct { + | ----------------- associated functions in this implementation LL | fn unused_impl_fn_1() { | ^^^^^^^^^^^^^^^^ - -error: associated function `unused_impl_fn_2` is never used - --> $DIR/lint-dead-code-6.rs:9:8 - | +... LL | fn unused_impl_fn_2(var: i32) { | ^^^^^^^^^^^^^^^^ - -error: associated function `unused_impl_fn_3` is never used - --> $DIR/lint-dead-code-6.rs:13:8 - | -LL | fn unused_impl_fn_3( +... +LL | fn unused_impl_fn_3(var: i32) { | ^^^^^^^^^^^^^^^^ -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors diff --git a/tests/ui/lint/dead-code/unused-assoc-fns.rs b/tests/ui/lint/dead-code/unused-assoc-fns.rs new file mode 100644 index 000000000..b111f4b94 --- /dev/null +++ b/tests/ui/lint/dead-code/unused-assoc-fns.rs @@ -0,0 +1,35 @@ +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] +#![deny(unused)] + +struct Foo; + +impl Foo { + fn one() {} + //~^ ERROR associated items `one`, `two`, `CONSTANT`, `Type`, and `three` are never used [dead_code] + + fn two(&self) {} + + // seperation between items + // ... + // ... + + fn used() {} + + const CONSTANT: usize = 5; + + // more seperation + // ... + // ... + + type Type = usize; + + fn three(&self) { + Foo::one(); + // ... + } +} + +fn main() { + Foo::used(); +} diff --git a/tests/ui/lint/dead-code/unused-assoc-fns.stderr b/tests/ui/lint/dead-code/unused-assoc-fns.stderr new file mode 100644 index 000000000..6344a70ea --- /dev/null +++ b/tests/ui/lint/dead-code/unused-assoc-fns.stderr @@ -0,0 +1,29 @@ +error: associated items `one`, `two`, `CONSTANT`, `Type`, and `three` are never used + --> $DIR/unused-assoc-fns.rs:8:8 + | +LL | impl Foo { + | -------- associated items in this implementation +LL | fn one() {} + | ^^^ +... +LL | fn two(&self) {} + | ^^^ +... +LL | const CONSTANT: usize = 5; + | ^^^^^^^^ +... +LL | type Type = usize; + | ^^^^ +LL | +LL | fn three(&self) { + | ^^^^^ + | +note: the lint level is defined here + --> $DIR/unused-assoc-fns.rs:3:9 + | +LL | #![deny(unused)] + | ^^^^^^ + = note: `#[deny(dead_code)]` implied by `#[deny(unused)]` + +error: aborting due to previous error + diff --git a/tests/ui/lint/fn_must_use.stderr b/tests/ui/lint/fn_must_use.stderr index 657f23c60..e88c1a9b8 100644 --- a/tests/ui/lint/fn_must_use.stderr +++ b/tests/ui/lint/fn_must_use.stderr @@ -10,12 +10,21 @@ note: the lint level is defined here | LL | #![warn(unused_must_use)] | ^^^^^^^^^^^^^^^ +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = need_to_use_this_value(); + | +++++++ warning: unused return value of `MyStruct::need_to_use_this_method_value` that must be used --> $DIR/fn_must_use.rs:60:5 | LL | m.need_to_use_this_method_value(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = m.need_to_use_this_method_value(); + | +++++++ warning: unused return value of `EvenNature::is_even` that must be used --> $DIR/fn_must_use.rs:61:5 @@ -24,24 +33,43 @@ LL | m.is_even(); // trait method! | ^^^^^^^^^^^ | = note: no side effects +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = m.is_even(); // trait method! + | +++++++ warning: unused return value of `MyStruct::need_to_use_this_associated_function_value` that must be used --> $DIR/fn_must_use.rs:64:5 | LL | MyStruct::need_to_use_this_associated_function_value(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = MyStruct::need_to_use_this_associated_function_value(); + | +++++++ warning: unused return value of `std::cmp::PartialEq::eq` that must be used --> $DIR/fn_must_use.rs:70:5 | LL | 2.eq(&3); | ^^^^^^^^ + | +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = 2.eq(&3); + | +++++++ warning: unused return value of `std::cmp::PartialEq::eq` that must be used --> $DIR/fn_must_use.rs:71:5 | LL | m.eq(&n); | ^^^^^^^^ + | +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = m.eq(&n); + | +++++++ warning: unused comparison that must be used --> $DIR/fn_must_use.rs:74:5 diff --git a/tests/ui/lint/inline-trait-and-foreign-items.rs b/tests/ui/lint/inline-trait-and-foreign-items.rs index 13dab7ed9..39bc01f71 100644 --- a/tests/ui/lint/inline-trait-and-foreign-items.rs +++ b/tests/ui/lint/inline-trait-and-foreign-items.rs @@ -1,5 +1,5 @@ #![feature(extern_types)] -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] #![warn(unused_attributes)] diff --git a/tests/ui/lint/issue-109152.rs b/tests/ui/lint/issue-109152.rs new file mode 100644 index 000000000..daf530e6d --- /dev/null +++ b/tests/ui/lint/issue-109152.rs @@ -0,0 +1,7 @@ +#![deny(map_unit_fn)] + +#![crate_type = "lib"] +fn _y() { + vec![42].iter().map(drop); + //~^ ERROR `Iterator::map` call that discard the iterator's values +} diff --git a/tests/ui/lint/issue-109152.stderr b/tests/ui/lint/issue-109152.stderr new file mode 100644 index 000000000..7db9e71a5 --- /dev/null +++ b/tests/ui/lint/issue-109152.stderr @@ -0,0 +1,23 @@ +error: `Iterator::map` call that discard the iterator's values + --> $DIR/issue-109152.rs:5:21 + | +LL | vec![42].iter().map(drop); + | ^^^^----^ + | | | + | | this function returns `()`, which is likely not what you wanted + | | called `Iterator::map` with callable that returns `()` + | after this call to map, the resulting iterator is `impl Iterator`, which means the only information carried by the iterator is the number of items + | + = note: `Iterator::map`, like many of the methods on `Iterator`, gets executed lazily, meaning that its effects won't be visible until it is iterated +note: the lint level is defined here + --> $DIR/issue-109152.rs:1:9 + | +LL | #![deny(map_unit_fn)] + | ^^^^^^^^^^^ +help: you might have meant to use `Iterator::for_each` + | +LL | vec![42].iter().for_each(drop); + | ~~~~~~~~ + +error: aborting due to previous error + diff --git a/tests/ui/lint/issue-109529.fixed b/tests/ui/lint/issue-109529.fixed new file mode 100644 index 000000000..5ad489073 --- /dev/null +++ b/tests/ui/lint/issue-109529.fixed @@ -0,0 +1,6 @@ +// run-rustfix + +fn main() { + for _ in 0..=255 as u8 {} //~ ERROR range endpoint is out of range + for _ in 0..=(255 as u8) {} //~ ERROR range endpoint is out of range +} diff --git a/tests/ui/lint/issue-109529.rs b/tests/ui/lint/issue-109529.rs new file mode 100644 index 000000000..383d7bc4c --- /dev/null +++ b/tests/ui/lint/issue-109529.rs @@ -0,0 +1,6 @@ +// run-rustfix + +fn main() { + for _ in 0..256 as u8 {} //~ ERROR range endpoint is out of range + for _ in 0..(256 as u8) {} //~ ERROR range endpoint is out of range +} diff --git a/tests/ui/lint/issue-109529.stderr b/tests/ui/lint/issue-109529.stderr new file mode 100644 index 000000000..9e857d1b0 --- /dev/null +++ b/tests/ui/lint/issue-109529.stderr @@ -0,0 +1,23 @@ +error: range endpoint is out of range for `u8` + --> $DIR/issue-109529.rs:4:14 + | +LL | for _ in 0..256 as u8 {} + | ------^^^^^^ + | | + | help: use an inclusive range instead: `0..=255` + | + = note: `#[deny(overflowing_literals)]` on by default + +error: range endpoint is out of range for `u8` + --> $DIR/issue-109529.rs:5:14 + | +LL | for _ in 0..(256 as u8) {} + | ^^^^^^^^^^^^^^ + | +help: use an inclusive range instead + | +LL | for _ in 0..=(255 as u8) {} + | + ~~~ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lint/lint-temporary-cstring-as-ptr.rs b/tests/ui/lint/lint-temporary-cstring-as-ptr.rs index 7aa4f2e1e..fab792f12 100644 --- a/tests/ui/lint/lint-temporary-cstring-as-ptr.rs +++ b/tests/ui/lint/lint-temporary-cstring-as-ptr.rs @@ -3,7 +3,15 @@ use std::ffi::CString; +macro_rules! mymacro { + () => { + let s = CString::new("some text").unwrap().as_ptr(); + //~^ ERROR getting the inner pointer of a temporary `CString` + } +} + fn main() { let s = CString::new("some text").unwrap().as_ptr(); //~^ ERROR getting the inner pointer of a temporary `CString` + mymacro!(); } diff --git a/tests/ui/lint/lint-temporary-cstring-as-ptr.stderr b/tests/ui/lint/lint-temporary-cstring-as-ptr.stderr index 79ef57dd1..4e5c8aa06 100644 --- a/tests/ui/lint/lint-temporary-cstring-as-ptr.stderr +++ b/tests/ui/lint/lint-temporary-cstring-as-ptr.stderr @@ -1,5 +1,5 @@ error: getting the inner pointer of a temporary `CString` - --> $DIR/lint-temporary-cstring-as-ptr.rs:7:48 + --> $DIR/lint-temporary-cstring-as-ptr.rs:14:48 | LL | let s = CString::new("some text").unwrap().as_ptr(); | ---------------------------------- ^^^^^^ this pointer will be invalid @@ -14,5 +14,20 @@ note: the lint level is defined here LL | #![deny(temporary_cstring_as_ptr)] | ^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to previous error +error: getting the inner pointer of a temporary `CString` + --> $DIR/lint-temporary-cstring-as-ptr.rs:8:52 + | +LL | let s = CString::new("some text").unwrap().as_ptr(); + | ---------------------------------- ^^^^^^ this pointer will be invalid + | | + | this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime +... +LL | mymacro!(); + | ---------- in this macro invocation + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see https://doc.rust-lang.org/reference/destructors.html + = note: this error originates in the macro `mymacro` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 2 previous errors diff --git a/tests/ui/lint/no-coverage.rs b/tests/ui/lint/no-coverage.rs index ff24c12b2..07906a434 100644 --- a/tests/ui/lint/no-coverage.rs +++ b/tests/ui/lint/no-coverage.rs @@ -1,6 +1,6 @@ #![feature(extern_types)] #![feature(no_coverage)] -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] #![warn(unused_attributes)] #![no_coverage] //~^ WARN: `#[no_coverage]` does not propagate into items and must be applied to the contained functions directly diff --git a/tests/ui/lint/unconditional_panic_98444.rs b/tests/ui/lint/unconditional_panic_98444.rs new file mode 100644 index 000000000..011fabfbb --- /dev/null +++ b/tests/ui/lint/unconditional_panic_98444.rs @@ -0,0 +1,7 @@ +// build-fail + +fn main() { + let xs: [i32; 5] = [1, 2, 3, 4, 5]; + let _ = &xs; + let _ = xs[7]; //~ ERROR: this operation will panic at runtime [unconditional_panic] +} diff --git a/tests/ui/lint/unconditional_panic_98444.stderr b/tests/ui/lint/unconditional_panic_98444.stderr new file mode 100644 index 000000000..a34745809 --- /dev/null +++ b/tests/ui/lint/unconditional_panic_98444.stderr @@ -0,0 +1,10 @@ +error: this operation will panic at runtime + --> $DIR/unconditional_panic_98444.rs:6:13 + | +LL | let _ = xs[7]; + | ^^^^^ index out of bounds: the length is 5 but the index is 7 + | + = note: `#[deny(unconditional_panic)]` on by default + +error: aborting due to previous error + diff --git a/tests/ui/lint/unused/auxiliary/must-use-foreign.rs b/tests/ui/lint/unused/auxiliary/must-use-foreign.rs new file mode 100644 index 000000000..f773f09c3 --- /dev/null +++ b/tests/ui/lint/unused/auxiliary/must-use-foreign.rs @@ -0,0 +1,12 @@ +// edition:2021 + +use std::future::Future; + +pub struct Manager; + +impl Manager { + #[must_use] + pub async fn new() -> (Self, impl Future) { + (Manager, async {}) + } +} diff --git a/tests/ui/lint/unused/must-use-box-from-raw.stderr b/tests/ui/lint/unused/must-use-box-from-raw.stderr index 47ab613be..4898db7fe 100644 --- a/tests/ui/lint/unused/must-use-box-from-raw.stderr +++ b/tests/ui/lint/unused/must-use-box-from-raw.stderr @@ -10,6 +10,10 @@ note: the lint level is defined here | LL | #![warn(unused_must_use)] | ^^^^^^^^^^^^^^^ +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = Box::from_raw(ptr); + | +++++++ warning: 1 warning emitted diff --git a/tests/ui/lint/unused/must-use-foreign.rs b/tests/ui/lint/unused/must-use-foreign.rs new file mode 100644 index 000000000..21a110585 --- /dev/null +++ b/tests/ui/lint/unused/must-use-foreign.rs @@ -0,0 +1,15 @@ +// edition:2021 +// aux-build:must-use-foreign.rs +// check-pass + +extern crate must_use_foreign; + +use must_use_foreign::Manager; + +async fn async_main() { + Manager::new().await.1.await; +} + +fn main() { + let _ = async_main(); +} diff --git a/tests/ui/lint/unused/must_use-unit.stderr b/tests/ui/lint/unused/must_use-unit.stderr index 9fcbc5074..993a19e5f 100644 --- a/tests/ui/lint/unused/must_use-unit.stderr +++ b/tests/ui/lint/unused/must_use-unit.stderr @@ -9,12 +9,21 @@ note: the lint level is defined here | LL | #![deny(unused_must_use)] | ^^^^^^^^^^^^^^^ +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = foo(); + | +++++++ error: unused return value of `bar` that must be used --> $DIR/must_use-unit.rs:15:5 | LL | bar(); | ^^^^^ + | +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = bar(); + | +++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/lint/unused/trait-alias-supertrait.rs b/tests/ui/lint/unused/trait-alias-supertrait.rs new file mode 100644 index 000000000..46f00c06b --- /dev/null +++ b/tests/ui/lint/unused/trait-alias-supertrait.rs @@ -0,0 +1,15 @@ +// check-pass + +// Make sure that we only consider *Self* supertrait predicates +// in the `unused_must_use` lint. + +#![feature(trait_alias)] +#![deny(unused_must_use)] + +trait Foo = Sized where T: Iterator; + +fn test() -> impl Foo {} + +fn main() { + test::>(); +} diff --git a/tests/ui/lint/unused/unused-allocation.rs b/tests/ui/lint/unused/unused-allocation.rs new file mode 100644 index 000000000..c1a6f5cea --- /dev/null +++ b/tests/ui/lint/unused/unused-allocation.rs @@ -0,0 +1,7 @@ +#![feature(rustc_attrs, stmt_expr_attributes)] +#![deny(unused_allocation)] + +fn main() { + _ = (#[rustc_box] Box::new([1])).len(); //~ error: unnecessary allocation, use `&` instead + _ = Box::new([1]).len(); //~ error: unnecessary allocation, use `&` instead +} diff --git a/tests/ui/lint/unused/unused-allocation.stderr b/tests/ui/lint/unused/unused-allocation.stderr new file mode 100644 index 000000000..c9ccfbd30 --- /dev/null +++ b/tests/ui/lint/unused/unused-allocation.stderr @@ -0,0 +1,20 @@ +error: unnecessary allocation, use `&` instead + --> $DIR/unused-allocation.rs:5:9 + | +LL | _ = (#[rustc_box] Box::new([1])).len(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/unused-allocation.rs:2:9 + | +LL | #![deny(unused_allocation)] + | ^^^^^^^^^^^^^^^^^ + +error: unnecessary allocation, use `&` instead + --> $DIR/unused-allocation.rs:6:9 + | +LL | _ = Box::new([1]).len(); + | ^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lint/unused/unused-async.rs b/tests/ui/lint/unused/unused-async.rs index 4be93aa15..6355f47f0 100644 --- a/tests/ui/lint/unused/unused-async.rs +++ b/tests/ui/lint/unused/unused-async.rs @@ -33,7 +33,7 @@ async fn test() { foo().await; //~ ERROR unused output of future returned by `foo` that must be used bar(); //~ ERROR unused return value of `bar` that must be used //~^ ERROR unused implementer of `Future` that must be used - bar().await; //~ ERROR unused output of future returned by `bar` that must be used + bar().await; // ok, it's not an async fn baz(); //~ ERROR unused implementer of `Future` that must be used baz().await; // ok } diff --git a/tests/ui/lint/unused/unused-async.stderr b/tests/ui/lint/unused/unused-async.stderr index 4bcb26dc1..e93a40658 100644 --- a/tests/ui/lint/unused/unused-async.stderr +++ b/tests/ui/lint/unused/unused-async.stderr @@ -16,12 +16,22 @@ error: unused return value of `foo` that must be used | LL | foo(); | ^^^^^ + | +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = foo(); + | +++++++ error: unused output of future returned by `foo` that must be used --> $DIR/unused-async.rs:33:5 | LL | foo().await; | ^^^^^^^^^^^ + | +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = foo().await; + | +++++++ error: unused implementer of `Future` that must be used --> $DIR/unused-async.rs:34:5 @@ -36,12 +46,11 @@ error: unused return value of `bar` that must be used | LL | bar(); | ^^^^^ - -error: unused output of future returned by `bar` that must be used - --> $DIR/unused-async.rs:36:5 | -LL | bar().await; - | ^^^^^^^^^^^ +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = bar(); + | +++++++ error: unused implementer of `Future` that must be used --> $DIR/unused-async.rs:37:5 @@ -51,5 +60,5 @@ LL | baz(); | = note: futures do nothing unless you `.await` or poll them -error: aborting due to 7 previous errors +error: aborting due to 6 previous errors diff --git a/tests/ui/lint/unused/unused-result.stderr b/tests/ui/lint/unused/unused-result.stderr index 4e1ba1fd9..f42995a65 100644 --- a/tests/ui/lint/unused/unused-result.stderr +++ b/tests/ui/lint/unused/unused-result.stderr @@ -9,6 +9,10 @@ note: the lint level is defined here | LL | #![deny(unused_results, unused_must_use)] | ^^^^^^^^^^^^^^^ +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = foo::(); + | +++++++ error: unused `MustUseMsg` that must be used --> $DIR/unused-result.rs:22:5 @@ -17,6 +21,10 @@ LL | foo::(); | ^^^^^^^^^^^^^^^^^^^ | = note: some message +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = foo::(); + | +++++++ error: unused result of type `isize` --> $DIR/unused-result.rs:34:5 @@ -35,6 +43,11 @@ error: unused `MustUse` that must be used | LL | foo::(); | ^^^^^^^^^^^^^^^^ + | +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = foo::(); + | +++++++ error: unused `MustUseMsg` that must be used --> $DIR/unused-result.rs:36:5 @@ -43,6 +56,10 @@ LL | foo::(); | ^^^^^^^^^^^^^^^^^^^ | = note: some message +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = foo::(); + | +++++++ error: aborting due to 5 previous errors diff --git a/tests/ui/lint/unused/unused_attributes-must_use.stderr b/tests/ui/lint/unused/unused_attributes-must_use.stderr index 0f699429e..9633767c4 100644 --- a/tests/ui/lint/unused/unused_attributes-must_use.stderr +++ b/tests/ui/lint/unused/unused_attributes-must_use.stderr @@ -146,42 +146,76 @@ note: the lint level is defined here | LL | #![deny(unused_attributes, unused_must_use)] | ^^^^^^^^^^^^^^^ +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = X; + | +++++++ error: unused `Y` that must be used --> $DIR/unused_attributes-must_use.rs:104:5 | LL | Y::Z; | ^^^^ + | +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = Y::Z; + | +++++++ error: unused `U` that must be used --> $DIR/unused_attributes-must_use.rs:105:5 | LL | U { unit: () }; | ^^^^^^^^^^^^^^ + | +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = U { unit: () }; + | +++++++ error: unused return value of `U::method` that must be used --> $DIR/unused_attributes-must_use.rs:106:5 | LL | U::method(); | ^^^^^^^^^^^ + | +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = U::method(); + | +++++++ error: unused return value of `foo` that must be used --> $DIR/unused_attributes-must_use.rs:107:5 | LL | foo(); | ^^^^^ + | +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = foo(); + | +++++++ error: unused return value of `foreign_foo` that must be used --> $DIR/unused_attributes-must_use.rs:110:9 | LL | foreign_foo(); | ^^^^^^^^^^^^^ + | +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = foreign_foo(); + | +++++++ error: unused return value of `Use::get_four` that must be used --> $DIR/unused_attributes-must_use.rs:118:5 | LL | ().get_four(); | ^^^^^^^^^^^^^ + | +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = ().get_four(); + | +++++++ error: aborting due to 28 previous errors diff --git a/tests/ui/lint/use-redundant.rs b/tests/ui/lint/use-redundant.rs deleted file mode 100644 index 53315dcf6..000000000 --- a/tests/ui/lint/use-redundant.rs +++ /dev/null @@ -1,27 +0,0 @@ -// check-pass -#![warn(unused_imports)] - -use crate::foo::Bar; - -mod foo { - pub type Bar = i32; -} - -fn baz() -> Bar { - 3 -} - -mod m1 { pub struct S {} } -mod m2 { pub struct S {} } - -use m1::*; //~ WARNING unused import -use m2::*; //~ WARNING unused import - -fn main() { - use crate::foo::Bar; //~ WARNING imported redundantly - let _a: Bar = 3; - baz(); - - use m1::S; - let _s = S {}; -} diff --git a/tests/ui/lint/use-redundant.stderr b/tests/ui/lint/use-redundant.stderr deleted file mode 100644 index c861a1956..000000000 --- a/tests/ui/lint/use-redundant.stderr +++ /dev/null @@ -1,29 +0,0 @@ -warning: unused import: `m1::*` - --> $DIR/use-redundant.rs:17:5 - | -LL | use m1::*; - | ^^^^^ - | -note: the lint level is defined here - --> $DIR/use-redundant.rs:2:9 - | -LL | #![warn(unused_imports)] - | ^^^^^^^^^^^^^^ - -warning: unused import: `m2::*` - --> $DIR/use-redundant.rs:18:5 - | -LL | use m2::*; - | ^^^^^ - -warning: the item `Bar` is imported redundantly - --> $DIR/use-redundant.rs:21:9 - | -LL | use crate::foo::Bar; - | --------------- the item `Bar` is already imported here -... -LL | use crate::foo::Bar; - | ^^^^^^^^^^^^^^^ - -warning: 3 warnings emitted - diff --git a/tests/ui/lint/use-redundant/issue-92904.rs b/tests/ui/lint/use-redundant/issue-92904.rs new file mode 100644 index 000000000..511d9d263 --- /dev/null +++ b/tests/ui/lint/use-redundant/issue-92904.rs @@ -0,0 +1,17 @@ +// check-pass + +pub struct Foo(bar::Bar); + +pub mod bar { + pub struct Foo(pub Bar); + pub struct Bar(pub char); +} + +pub fn warning() -> Foo { + use bar::*; + #[deny(unused_imports)] + use self::Foo; // no error + Foo(Bar('a')) +} + +fn main() {} diff --git a/tests/ui/lint/use-redundant/use-redundant-glob-parent.rs b/tests/ui/lint/use-redundant/use-redundant-glob-parent.rs new file mode 100644 index 000000000..6b1e018d2 --- /dev/null +++ b/tests/ui/lint/use-redundant/use-redundant-glob-parent.rs @@ -0,0 +1,16 @@ +// check-pass +#![warn(unused_imports)] + +pub mod bar { + pub struct Foo(pub Bar); + pub struct Bar(pub char); +} + +use bar::*; + +pub fn warning() -> Foo { + use bar::Foo; //~ WARNING imported redundantly + Foo(Bar('a')) +} + +fn main() {} diff --git a/tests/ui/lint/use-redundant/use-redundant-glob-parent.stderr b/tests/ui/lint/use-redundant/use-redundant-glob-parent.stderr new file mode 100644 index 000000000..2c3b33452 --- /dev/null +++ b/tests/ui/lint/use-redundant/use-redundant-glob-parent.stderr @@ -0,0 +1,17 @@ +warning: the item `Foo` is imported redundantly + --> $DIR/use-redundant-glob-parent.rs:12:9 + | +LL | use bar::*; + | ------ the item `Foo` is already imported here +... +LL | use bar::Foo; + | ^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/use-redundant-glob-parent.rs:2:9 + | +LL | #![warn(unused_imports)] + | ^^^^^^^^^^^^^^ + +warning: 1 warning emitted + diff --git a/tests/ui/lint/use-redundant/use-redundant-glob.rs b/tests/ui/lint/use-redundant/use-redundant-glob.rs new file mode 100644 index 000000000..bd9e51b6f --- /dev/null +++ b/tests/ui/lint/use-redundant/use-redundant-glob.rs @@ -0,0 +1,15 @@ +// check-pass +#![warn(unused_imports)] + +pub mod bar { + pub struct Foo(pub Bar); + pub struct Bar(pub char); +} + +pub fn warning() -> bar::Foo { + use bar::*; + use bar::Foo; //~ WARNING imported redundantly + Foo(Bar('a')) +} + +fn main() {} diff --git a/tests/ui/lint/use-redundant/use-redundant-glob.stderr b/tests/ui/lint/use-redundant/use-redundant-glob.stderr new file mode 100644 index 000000000..d3b406d82 --- /dev/null +++ b/tests/ui/lint/use-redundant/use-redundant-glob.stderr @@ -0,0 +1,16 @@ +warning: the item `Foo` is imported redundantly + --> $DIR/use-redundant-glob.rs:11:9 + | +LL | use bar::*; + | ------ the item `Foo` is already imported here +LL | use bar::Foo; + | ^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/use-redundant-glob.rs:2:9 + | +LL | #![warn(unused_imports)] + | ^^^^^^^^^^^^^^ + +warning: 1 warning emitted + diff --git a/tests/ui/lint/use-redundant/use-redundant-multiple-namespaces.rs b/tests/ui/lint/use-redundant/use-redundant-multiple-namespaces.rs new file mode 100644 index 000000000..0fb60840f --- /dev/null +++ b/tests/ui/lint/use-redundant/use-redundant-multiple-namespaces.rs @@ -0,0 +1,21 @@ +// check-pass +#![allow(nonstandard_style)] + +pub mod bar { + pub struct Foo { pub bar: Bar } + pub struct Bar(pub char); +} + +pub mod x { + use crate::bar; + pub const Foo: bar::Bar = bar::Bar('a'); +} + +pub fn warning() -> bar::Foo { + #![deny(unused_imports)] // no error + use bar::*; + use x::Foo; + Foo { bar: Foo } +} + +fn main() {} diff --git a/tests/ui/lint/use-redundant/use-redundant-not-parent.rs b/tests/ui/lint/use-redundant/use-redundant-not-parent.rs new file mode 100644 index 000000000..c97a3d341 --- /dev/null +++ b/tests/ui/lint/use-redundant/use-redundant-not-parent.rs @@ -0,0 +1,19 @@ +// check-pass + +pub mod bar { + pub struct Foo(pub Bar); + pub struct Bar(pub char); +} + +pub mod x { + pub struct Foo(pub crate::bar::Bar); +} + +pub fn warning() -> x::Foo { + use bar::*; + #[deny(unused_imports)] + use x::Foo; // no error + Foo(Bar('a')) +} + +fn main() {} diff --git a/tests/ui/lint/use-redundant/use-redundant.rs b/tests/ui/lint/use-redundant/use-redundant.rs new file mode 100644 index 000000000..53315dcf6 --- /dev/null +++ b/tests/ui/lint/use-redundant/use-redundant.rs @@ -0,0 +1,27 @@ +// check-pass +#![warn(unused_imports)] + +use crate::foo::Bar; + +mod foo { + pub type Bar = i32; +} + +fn baz() -> Bar { + 3 +} + +mod m1 { pub struct S {} } +mod m2 { pub struct S {} } + +use m1::*; //~ WARNING unused import +use m2::*; //~ WARNING unused import + +fn main() { + use crate::foo::Bar; //~ WARNING imported redundantly + let _a: Bar = 3; + baz(); + + use m1::S; + let _s = S {}; +} diff --git a/tests/ui/lint/use-redundant/use-redundant.stderr b/tests/ui/lint/use-redundant/use-redundant.stderr new file mode 100644 index 000000000..c861a1956 --- /dev/null +++ b/tests/ui/lint/use-redundant/use-redundant.stderr @@ -0,0 +1,29 @@ +warning: unused import: `m1::*` + --> $DIR/use-redundant.rs:17:5 + | +LL | use m1::*; + | ^^^^^ + | +note: the lint level is defined here + --> $DIR/use-redundant.rs:2:9 + | +LL | #![warn(unused_imports)] + | ^^^^^^^^^^^^^^ + +warning: unused import: `m2::*` + --> $DIR/use-redundant.rs:18:5 + | +LL | use m2::*; + | ^^^^^ + +warning: the item `Bar` is imported redundantly + --> $DIR/use-redundant.rs:21:9 + | +LL | use crate::foo::Bar; + | --------------- the item `Bar` is already imported here +... +LL | use crate::foo::Bar; + | ^^^^^^^^^^^^^^^ + +warning: 3 warnings emitted + diff --git a/tests/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs b/tests/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs index c9b16e439..293fdca1c 100644 --- a/tests/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs +++ b/tests/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs @@ -5,6 +5,7 @@ fn test() { drop(b); b = Box::new(2); //~ ERROR cannot assign twice to immutable variable `b` //~| NOTE cannot assign twice to immutable + //~| NOTE in this expansion of desugaring of drop and replace drop(b); } diff --git a/tests/ui/macros/bad-concat.stderr b/tests/ui/macros/bad-concat.stderr index 4316fd312..d67f3c33d 100644 --- a/tests/ui/macros/bad-concat.stderr +++ b/tests/ui/macros/bad-concat.stderr @@ -4,7 +4,7 @@ error: expected a literal LL | let _ = concat!(x, y, z, "bar"); | ^ ^ ^ | - = note: only literals (like `"foo"`, `42` and `3.14`) can be passed to `concat!()` + = note: only literals (like `"foo"`, `-42` and `3.14`) can be passed to `concat!()` error: aborting due to previous error diff --git a/tests/ui/macros/concat-bytes-error.stderr b/tests/ui/macros/concat-bytes-error.stderr index d6cd1a3d1..3f2c64922 100644 --- a/tests/ui/macros/concat-bytes-error.stderr +++ b/tests/ui/macros/concat-bytes-error.stderr @@ -4,7 +4,7 @@ error: expected a byte literal LL | concat_bytes!(pie); | ^^^ | - = note: only byte literals (like `b"foo"`, `b's'`, and `[3, 4, 5]`) can be passed to `concat_bytes!()` + = note: only byte literals (like `b"foo"`, `b's'` and `[3, 4, 5]`) can be passed to `concat_bytes!()` error: expected a byte literal --> $DIR/concat-bytes-error.rs:5:19 @@ -12,7 +12,7 @@ error: expected a byte literal LL | concat_bytes!(pie, pie); | ^^^ ^^^ | - = note: only byte literals (like `b"foo"`, `b's'`, and `[3, 4, 5]`) can be passed to `concat_bytes!()` + = note: only byte literals (like `b"foo"`, `b's'` and `[3, 4, 5]`) can be passed to `concat_bytes!()` error: cannot concatenate string literals --> $DIR/concat-bytes-error.rs:6:19 @@ -98,7 +98,7 @@ error: expected a byte literal LL | -33, | ^^^ | - = note: only byte literals (like `b"foo"`, `b's'`, and `[3, 4, 5]`) can be passed to `concat_bytes!()` + = note: only byte literals (like `b"foo"`, `b's'` and `[3, 4, 5]`) can be passed to `concat_bytes!()` error: cannot concatenate doubly nested array --> $DIR/concat-bytes-error.rs:35:9 @@ -151,7 +151,7 @@ error: expected a byte literal LL | concat_bytes!([pie; 2]); | ^^^ | - = note: only byte literals (like `b"foo"`, `b's'`, and `[3, 4, 5]`) can be passed to `concat_bytes!()` + = note: only byte literals (like `b"foo"`, `b's'` and `[3, 4, 5]`) can be passed to `concat_bytes!()` error: cannot concatenate float literals --> $DIR/concat-bytes-error.rs:46:20 diff --git a/tests/ui/macros/concat.stderr b/tests/ui/macros/concat.stderr index 61fb9de1e..d65d93544 100644 --- a/tests/ui/macros/concat.stderr +++ b/tests/ui/macros/concat.stderr @@ -16,7 +16,7 @@ error: expected a literal LL | concat!(foo); | ^^^ | - = note: only literals (like `"foo"`, `42` and `3.14`) can be passed to `concat!()` + = note: only literals (like `"foo"`, `-42` and `3.14`) can be passed to `concat!()` error: expected a literal --> $DIR/concat.rs:5:13 @@ -24,7 +24,7 @@ error: expected a literal LL | concat!(foo()); | ^^^^^ | - = note: only literals (like `"foo"`, `42` and `3.14`) can be passed to `concat!()` + = note: only literals (like `"foo"`, `-42` and `3.14`) can be passed to `concat!()` error: aborting due to 4 previous errors diff --git a/tests/ui/macros/issue-100199.stderr b/tests/ui/macros/issue-100199.stderr index 2cb45dc12..89a6f585c 100644 --- a/tests/ui/macros/issue-100199.stderr +++ b/tests/ui/macros/issue-100199.stderr @@ -7,7 +7,7 @@ LL | #[issue_100199::struct_with_bound] = note: this error originates in the attribute macro `issue_100199::struct_with_bound` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider importing this trait | -LL | use traits::MyTrait; +LL + use traits::MyTrait; | error: aborting due to previous error diff --git a/tests/ui/macros/issue-106837.rs b/tests/ui/macros/issue-106837.rs new file mode 100644 index 000000000..7bbd3d68a --- /dev/null +++ b/tests/ui/macros/issue-106837.rs @@ -0,0 +1,10 @@ +fn main() { + concat!(-42); + concat!(-3.14); + + concat!(-"hello"); + //~^ ERROR expected a literal + + concat!(--1); + //~^ ERROR expected a literal +} diff --git a/tests/ui/macros/issue-106837.stderr b/tests/ui/macros/issue-106837.stderr new file mode 100644 index 000000000..998d6c5eb --- /dev/null +++ b/tests/ui/macros/issue-106837.stderr @@ -0,0 +1,18 @@ +error: expected a literal + --> $DIR/issue-106837.rs:5:13 + | +LL | concat!(-"hello"); + | ^^^^^^^^ + | + = note: only literals (like `"foo"`, `-42` and `3.14`) can be passed to `concat!()` + +error: expected a literal + --> $DIR/issue-106837.rs:8:13 + | +LL | concat!(--1); + | ^^^ + | + = note: only literals (like `"foo"`, `-42` and `3.14`) can be passed to `concat!()` + +error: aborting due to 2 previous errors + diff --git a/tests/ui/macros/issue-109237.rs b/tests/ui/macros/issue-109237.rs new file mode 100644 index 000000000..86a193c9e --- /dev/null +++ b/tests/ui/macros/issue-109237.rs @@ -0,0 +1,7 @@ +macro_rules! statement { + () => {;}; //~ ERROR expected expression +} + +fn main() { + let _ = statement!(); +} diff --git a/tests/ui/macros/issue-109237.stderr b/tests/ui/macros/issue-109237.stderr new file mode 100644 index 000000000..d125cff63 --- /dev/null +++ b/tests/ui/macros/issue-109237.stderr @@ -0,0 +1,18 @@ +error: expected expression, found `;` + --> $DIR/issue-109237.rs:2:12 + | +LL | () => {;}; + | ^ expected expression +... +LL | let _ = statement!(); + | ------------ in this macro invocation + | + = note: the macro call doesn't expand to an expression, but it can expand to a statement + = note: this error originates in the macro `statement` (in Nightly builds, run with -Z macro-backtrace for more info) +help: surround the macro invocation with `{}` to interpret the expansion as a statement + | +LL | let _ = { statement!(); }; + | ~~~~~~~~~~~~~~~~~ + +error: aborting due to previous error + diff --git a/tests/ui/macros/issue-40469.rs b/tests/ui/macros/issue-40469.rs index 25e08ef85..9b22aaef2 100644 --- a/tests/ui/macros/issue-40469.rs +++ b/tests/ui/macros/issue-40469.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty issue #37195 #![allow(dead_code)] diff --git a/tests/ui/macros/issue-98790.rs b/tests/ui/macros/issue-98790.rs new file mode 100644 index 000000000..8fe6fc41d --- /dev/null +++ b/tests/ui/macros/issue-98790.rs @@ -0,0 +1,24 @@ +// run-pass + +macro_rules! stringify_item { + ($item:item) => { + stringify!($item) + }; +} + +macro_rules! repro { + ($expr:expr) => { + stringify_item! { + pub fn repro() -> bool { + $expr + } + } + }; +} + +fn main() { + assert_eq!( + repro!(match () { () => true } | true), + "pub fn repro() -> bool { (match () { () => true, }) | true }" + ); +} diff --git a/tests/ui/macros/macro-comma-support-rpass.rs b/tests/ui/macros/macro-comma-support-rpass.rs index 25b8c3cc6..cb019792e 100644 --- a/tests/ui/macros/macro-comma-support-rpass.rs +++ b/tests/ui/macros/macro-comma-support-rpass.rs @@ -8,7 +8,6 @@ // implementations for some macro_rules! macros as an implementation // detail. -// ignore-pretty issue #37195 // compile-flags: --test -C debug_assertions=yes // revisions: std core diff --git a/tests/ui/macros/macro-include-items.rs b/tests/ui/macros/macro-include-items.rs index 332bf59c9..ad6f04009 100644 --- a/tests/ui/macros/macro-include-items.rs +++ b/tests/ui/macros/macro-include-items.rs @@ -1,7 +1,6 @@ // run-pass #![allow(non_camel_case_types)] -// ignore-pretty issue #37195 fn bar() {} diff --git a/tests/ui/macros/macro-outer-attributes.stderr b/tests/ui/macros/macro-outer-attributes.stderr index 4ea760ab8..0bdc3416f 100644 --- a/tests/ui/macros/macro-outer-attributes.stderr +++ b/tests/ui/macros/macro-outer-attributes.stderr @@ -6,7 +6,7 @@ LL | a::bar(); | help: consider importing this function | -LL | use b::bar; +LL + use b::bar; | help: if you import `bar`, refer to it directly | diff --git a/tests/ui/macros/macro-path-prelude-fail-4.stderr b/tests/ui/macros/macro-path-prelude-fail-4.stderr index dfd6818b6..81c6722b5 100644 --- a/tests/ui/macros/macro-path-prelude-fail-4.stderr +++ b/tests/ui/macros/macro-path-prelude-fail-4.stderr @@ -3,6 +3,14 @@ error: expected derive macro, found built-in attribute `inline` | LL | #[derive(inline)] | ^^^^^^ not a derive macro + | +help: remove from the surrounding `derive()` + --> $DIR/macro-path-prelude-fail-4.rs:1:10 + | +LL | #[derive(inline)] + | ^^^^^^ + = help: add as non-Derive macro + `#[inline]` error: aborting due to previous error diff --git a/tests/ui/macros/macro-path-prelude-fail-5.rs b/tests/ui/macros/macro-path-prelude-fail-5.rs new file mode 100644 index 000000000..b82b6bc78 --- /dev/null +++ b/tests/ui/macros/macro-path-prelude-fail-5.rs @@ -0,0 +1,10 @@ +#[derive(Clone, Debug)] // OK +struct S; + +#[derive(Debug, inline)] //~ ERROR expected derive macro, found built-in attribute `inline` +struct T; + +#[derive(inline, Debug)] //~ ERROR expected derive macro, found built-in attribute `inline` +struct U; + +fn main() {} diff --git a/tests/ui/macros/macro-path-prelude-fail-5.stderr b/tests/ui/macros/macro-path-prelude-fail-5.stderr new file mode 100644 index 000000000..105c59db6 --- /dev/null +++ b/tests/ui/macros/macro-path-prelude-fail-5.stderr @@ -0,0 +1,30 @@ +error: expected derive macro, found built-in attribute `inline` + --> $DIR/macro-path-prelude-fail-5.rs:4:17 + | +LL | #[derive(Debug, inline)] + | ^^^^^^ not a derive macro + | +help: remove from the surrounding `derive()` + --> $DIR/macro-path-prelude-fail-5.rs:4:17 + | +LL | #[derive(Debug, inline)] + | ^^^^^^ + = help: add as non-Derive macro + `#[inline]` + +error: expected derive macro, found built-in attribute `inline` + --> $DIR/macro-path-prelude-fail-5.rs:7:10 + | +LL | #[derive(inline, Debug)] + | ^^^^^^ not a derive macro + | +help: remove from the surrounding `derive()` + --> $DIR/macro-path-prelude-fail-5.rs:7:10 + | +LL | #[derive(inline, Debug)] + | ^^^^^^ + = help: add as non-Derive macro + `#[inline]` + +error: aborting due to 2 previous errors + diff --git a/tests/ui/macros/macros-nonfatal-errors.stderr b/tests/ui/macros/macros-nonfatal-errors.stderr index 93fbc9c8a..ca373ea6c 100644 --- a/tests/ui/macros/macros-nonfatal-errors.stderr +++ b/tests/ui/macros/macros-nonfatal-errors.stderr @@ -3,36 +3,48 @@ error: the `#[default]` attribute may only be used on unit enum variants | LL | #[default] | ^^^^^^^^^^ + | + = help: consider a manual implementation of `Default` error: the `#[default]` attribute may only be used on unit enum variants --> $DIR/macros-nonfatal-errors.rs:18:36 | LL | struct DefaultInnerAttrTupleStruct(#[default] ()); | ^^^^^^^^^^ + | + = help: consider a manual implementation of `Default` error: the `#[default]` attribute may only be used on unit enum variants --> $DIR/macros-nonfatal-errors.rs:22:1 | LL | #[default] | ^^^^^^^^^^ + | + = help: consider a manual implementation of `Default` error: the `#[default]` attribute may only be used on unit enum variants --> $DIR/macros-nonfatal-errors.rs:26:1 | LL | #[default] | ^^^^^^^^^^ + | + = help: consider a manual implementation of `Default` error: the `#[default]` attribute may only be used on unit enum variants --> $DIR/macros-nonfatal-errors.rs:36:11 | LL | Foo = #[default] 0, | ^^^^^^^^^^ + | + = help: consider a manual implementation of `Default` error: the `#[default]` attribute may only be used on unit enum variants --> $DIR/macros-nonfatal-errors.rs:37:14 | LL | Bar([u8; #[default] 1]), | ^^^^^^^^^^ + | + = help: consider a manual implementation of `Default` error: no default declared --> $DIR/macros-nonfatal-errors.rs:42:10 @@ -132,7 +144,7 @@ error: asm template must be a string literal LL | asm!(invalid); | ^^^^^^^ -error: concat_idents! requires ident args +error: `concat_idents!()` requires ident args --> $DIR/macros-nonfatal-errors.rs:101:5 | LL | concat_idents!("not", "idents"); @@ -150,7 +162,7 @@ error: expected string literal LL | env!(invalid); | ^^^^^^^ -error: env! takes 1 or 2 arguments +error: `env!()` takes 1 or 2 arguments --> $DIR/macros-nonfatal-errors.rs:105:5 | LL | env!(foo, abr, baz); @@ -162,7 +174,7 @@ error: environment variable `RUST_HOPEFULLY_THIS_DOESNT_EXIST` not defined at co LL | env!("RUST_HOPEFULLY_THIS_DOESNT_EXIST"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: Use `std::env::var("RUST_HOPEFULLY_THIS_DOESNT_EXIST")` to read the variable at run time + = help: use `std::env::var("RUST_HOPEFULLY_THIS_DOESNT_EXIST")` to read the variable at run time = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info) error: format argument must be a string literal diff --git a/tests/ui/macros/missing-writer.rs b/tests/ui/macros/missing-writer.rs new file mode 100644 index 000000000..7df965c36 --- /dev/null +++ b/tests/ui/macros/missing-writer.rs @@ -0,0 +1,17 @@ +// Check error for missing writer in writeln! and write! macro +fn main() { + let x = 1; + let y = 2; + write!("{}_{}", x, y); + //~^ ERROR format argument must be a string literal + //~| HELP you might be missing a string literal to format with + //~| ERROR cannot write into `&'static str` + //~| NOTE must implement `io::Write`, `fmt::Write`, or have a `write_fmt` method + //~| HELP a writer is needed before this format string + writeln!("{}_{}", x, y); + //~^ ERROR format argument must be a string literal + //~| HELP you might be missing a string literal to format with + //~| ERROR cannot write into `&'static str` + //~| NOTE must implement `io::Write`, `fmt::Write`, or have a `write_fmt` method + //~| HELP a writer is needed before this format string +} diff --git a/tests/ui/macros/missing-writer.stderr b/tests/ui/macros/missing-writer.stderr new file mode 100644 index 000000000..86dfe7d65 --- /dev/null +++ b/tests/ui/macros/missing-writer.stderr @@ -0,0 +1,59 @@ +error: format argument must be a string literal + --> $DIR/missing-writer.rs:5:21 + | +LL | write!("{}_{}", x, y); + | ^ + | +help: you might be missing a string literal to format with + | +LL | write!("{}_{}", "{} {}", x, y); + | ++++++++ + +error: format argument must be a string literal + --> $DIR/missing-writer.rs:11:23 + | +LL | writeln!("{}_{}", x, y); + | ^ + | +help: you might be missing a string literal to format with + | +LL | writeln!("{}_{}", "{} {}", x, y); + | ++++++++ + +error[E0599]: cannot write into `&'static str` + --> $DIR/missing-writer.rs:5:12 + | +LL | write!("{}_{}", x, y); + | -------^^^^^^^------- method not found in `&str` + | +note: must implement `io::Write`, `fmt::Write`, or have a `write_fmt` method + --> $DIR/missing-writer.rs:5:12 + | +LL | write!("{}_{}", x, y); + | ^^^^^^^ +help: a writer is needed before this format string + --> $DIR/missing-writer.rs:5:12 + | +LL | write!("{}_{}", x, y); + | ^ + +error[E0599]: cannot write into `&'static str` + --> $DIR/missing-writer.rs:11:14 + | +LL | writeln!("{}_{}", x, y); + | ---------^^^^^^^------- method not found in `&str` + | +note: must implement `io::Write`, `fmt::Write`, or have a `write_fmt` method + --> $DIR/missing-writer.rs:11:14 + | +LL | writeln!("{}_{}", x, y); + | ^^^^^^^ +help: a writer is needed before this format string + --> $DIR/missing-writer.rs:11:14 + | +LL | writeln!("{}_{}", x, y); + | ^ + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/macros/nested-use-as.rs b/tests/ui/macros/nested-use-as.rs new file mode 100644 index 000000000..21aa81e80 --- /dev/null +++ b/tests/ui/macros/nested-use-as.rs @@ -0,0 +1,83 @@ +// check-pass +// edition:2018 +// issue: https://github.com/rust-lang/rust/issues/97534 + +macro_rules! m { + () => { + macro_rules! foo { + () => {} + } + use foo as bar; + } +} + +m!{} + +use bar as baz; + +baz!{} + +macro_rules! foo2 { + () => {}; +} + +macro_rules! m2 { + () => { + use foo2 as bar2; + }; +} + +m2! {} + +use bar2 as baz2; + +baz2! {} + +macro_rules! n1 { + () => { + macro_rules! n2 { + () => { + macro_rules! n3 { + () => { + macro_rules! n4 { + () => {} + } + use n4 as c4; + } + } + use n3 as c3; + } + } + use n2 as c2; + } +} + +use n1 as c1; +c1!{} +use c2 as a2; +a2!{} +use c3 as a3; +a3!{} +use c4 as a4; +a4!{} + +// https://github.com/rust-lang/rust/pull/108729#issuecomment-1474750675 +// reversed +use d5 as d6; +use d4 as d5; +use d3 as d4; +use d2 as d3; +use d1 as d2; +use foo2 as d1; +d6! {} + +// mess +use f3 as f4; +f5! {} +use f1 as f2; +use f4 as f5; +use f2 as f3; +use foo2 as f1; + +fn main() { +} diff --git a/tests/ui/macros/nonterminal-matching.stderr b/tests/ui/macros/nonterminal-matching.stderr index 5bbd54390..c2b047022 100644 --- a/tests/ui/macros/nonterminal-matching.stderr +++ b/tests/ui/macros/nonterminal-matching.stderr @@ -18,6 +18,9 @@ LL | macro n(a $nt_item b) { ... LL | complex_nonterminal!(enum E {}); | ------------------------------- in this macro invocation + = note: captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens + = note: see for more information + = help: try using `:tt` instead in the macro definition = note: this error originates in the macro `complex_nonterminal` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs b/tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs index b8b6f0846..e88e24482 100644 --- a/tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs +++ b/tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs @@ -5,7 +5,7 @@ // needs-unwind Asserting on contents of error message #![allow(path_statements, unused_allocation)] -#![feature(box_syntax, core_intrinsics, generic_assert, generic_assert_internals)] +#![feature(core_intrinsics, generic_assert, generic_assert_internals)] macro_rules! test { ( @@ -127,9 +127,6 @@ fn main() { // block [ { elem } == 3 ] => "Assertion failed: { elem } == 3" - // box - [ box elem == box 3 ] => "Assertion failed: box elem == box 3" - // break [ loop { break elem; } == 3 ] => "Assertion failed: loop { break elem; } == 3" @@ -164,7 +161,7 @@ fn main() { // mac call // match - [ match elem { _ => elem } == 3 ] => "Assertion failed: match elem { _ => elem, } == 3" + [ match elem { _ => elem } == 3 ] => "Assertion failed: (match elem { _ => elem, }) == 3" // ret [ (|| { return elem; })() == 3 ] => "Assertion failed: (|| { return elem; })() == 3" diff --git a/tests/ui/macros/stringify.rs b/tests/ui/macros/stringify.rs index fdc2a7666..79d8cd757 100644 --- a/tests/ui/macros/stringify.rs +++ b/tests/ui/macros/stringify.rs @@ -4,7 +4,6 @@ #![feature(async_closure)] #![feature(box_patterns)] -#![feature(box_syntax)] #![feature(const_trait_impl)] #![feature(decl_macro)] #![feature(generators)] @@ -91,9 +90,6 @@ fn test_block() { #[test] fn test_expr() { - // ExprKind::Box - assert_eq!(stringify_expr!(box expr), "box expr"); - // ExprKind::Array assert_eq!(stringify_expr!([]), "[]"); assert_eq!(stringify_expr!([true]), "[true]"); diff --git a/tests/ui/macros/syntax-extension-source-utils.rs b/tests/ui/macros/syntax-extension-source-utils.rs index 7e46260d5..f41fadddd 100644 --- a/tests/ui/macros/syntax-extension-source-utils.rs +++ b/tests/ui/macros/syntax-extension-source-utils.rs @@ -1,7 +1,6 @@ // run-pass #![allow(stable_features)] -// ignore-pretty issue #37195 pub mod m1 { pub mod m2 { @@ -14,9 +13,9 @@ pub mod m1 { macro_rules! indirect_line { () => ( line!() ) } pub fn main() { - assert_eq!(line!(), 17); + assert_eq!(line!(), 16); assert_eq!(column!(), 16); - assert_eq!(indirect_line!(), 19); + assert_eq!(indirect_line!(), 18); assert!((file!().ends_with("syntax-extension-source-utils.rs"))); assert_eq!(stringify!((2*3) + 5).to_string(), "(2 * 3) + 5".to_string()); assert!(include!("syntax-extension-source-utils-files/includeme.\ @@ -33,5 +32,5 @@ pub fn main() { // The Windows tests are wrapped in an extra module for some reason assert!((m1::m2::where_am_i().ends_with("m1::m2"))); - assert_eq!((36, "(2 * 3) + 5"), (line!(), stringify!((2*3) + 5))); + assert_eq!((35, "(2 * 3) + 5"), (line!(), stringify!((2*3) + 5))); } diff --git a/tests/ui/malformed/malformed-derive-entry.stderr b/tests/ui/malformed/malformed-derive-entry.stderr index 6ff6fbabb..3059d75d7 100644 --- a/tests/ui/malformed/malformed-derive-entry.stderr +++ b/tests/ui/malformed/malformed-derive-entry.stderr @@ -27,7 +27,8 @@ note: required by a bound in `Copy` = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Test1` with `#[derive(Clone)]` | -LL | #[derive(Clone)] +LL + #[derive(Clone)] +LL | struct Test1; | error[E0277]: the trait bound `Test2: Clone` is not satisfied @@ -41,7 +42,8 @@ note: required by a bound in `Copy` = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Test2` with `#[derive(Clone)]` | -LL | #[derive(Clone)] +LL + #[derive(Clone)] +LL | struct Test2; | error: aborting due to 5 previous errors diff --git a/tests/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.rs b/tests/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.rs index 62aa22d41..b9f1de7ec 100644 --- a/tests/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.rs +++ b/tests/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.rs @@ -1,4 +1,8 @@ -// check-pass +// known-bug: #89515 +// +// The trait solver cannot deal with ambiguous marker trait impls +// if there are lifetimes involved. As we must not special-case any +// regions this does not work, even with 'static #![feature(marker_trait_attr)] #[marker] diff --git a/tests/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.stderr b/tests/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.stderr new file mode 100644 index 000000000..fe4de540b --- /dev/null +++ b/tests/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.stderr @@ -0,0 +1,31 @@ +error[E0283]: type annotations needed: cannot satisfy `&'static (): Marker` + --> $DIR/overlap-marker-trait-with-static-lifetime.rs:11:17 + | +LL | impl Marker for &'static () {} + | ^^^^^^^^^^^ + | +note: multiple `impl`s satisfying `&'static (): Marker` found + --> $DIR/overlap-marker-trait-with-static-lifetime.rs:11:1 + | +LL | impl Marker for &'static () {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl Marker for &'static () {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0283]: type annotations needed: cannot satisfy `&'static (): Marker` + --> $DIR/overlap-marker-trait-with-static-lifetime.rs:12:17 + | +LL | impl Marker for &'static () {} + | ^^^^^^^^^^^ + | +note: multiple `impl`s satisfying `&'static (): Marker` found + --> $DIR/overlap-marker-trait-with-static-lifetime.rs:11:1 + | +LL | impl Marker for &'static () {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl Marker for &'static () {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0283`. diff --git a/tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.rs b/tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.rs index a8f3db5f5..97a814f51 100644 --- a/tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.rs +++ b/tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.rs @@ -1,9 +1,17 @@ -// check-pass +// known-bug: #109481 +// +// While the `T: Copy` is always applicable when checking +// that the impl `impl F for T {}` is well formed, +// the old trait solver can only approximate this by checking +// that there are no inference variables in the obligation and +// no region constraints in the evaluation result. +// +// Because of this we end up with ambiguity here. #![feature(marker_trait_attr)] #[marker] pub trait F {} -impl F for T where T: Copy {} -impl F for T where T: 'static {} +impl F for T {} +impl F for T {} fn main() {} diff --git a/tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.stderr b/tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.stderr new file mode 100644 index 000000000..e713d1451 --- /dev/null +++ b/tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.stderr @@ -0,0 +1,14 @@ +error[E0310]: the parameter type `T` may not live long enough + --> $DIR/overlapping-impl-1-modulo-regions.rs:14:21 + | +LL | impl F for T {} + | ^ ...so that the type `T` will meet its required lifetime bounds + | +help: consider adding an explicit lifetime bound... + | +LL | impl F for T {} + | +++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0310`. diff --git a/tests/ui/match/guards-parenthesized-and.rs b/tests/ui/match/guards-parenthesized-and.rs new file mode 100644 index 000000000..3a1c341f3 --- /dev/null +++ b/tests/ui/match/guards-parenthesized-and.rs @@ -0,0 +1,10 @@ +// check-pass + +fn main() { + let c = 1; + let w = "T"; + match Some(5) { + None if c == 1 && (w != "Y" && w != "E") => {} + _ => panic!(), + } +} diff --git a/tests/ui/match/match-range-fail-2.rs b/tests/ui/match/match-range-fail-2.rs index 792664e1d..4489cf1ab 100644 --- a/tests/ui/match/match-range-fail-2.rs +++ b/tests/ui/match/match-range-fail-2.rs @@ -3,22 +3,19 @@ fn main() { match 5 { 6 ..= 1 => { } + //~^ ERROR lower range bound must be less than or equal to upper _ => { } }; - //~^^^ ERROR lower range bound must be less than or equal to upper - //~| ERROR lower range bound must be less than or equal to upper match 5 { 0 .. 0 => { } + //~^ ERROR lower range bound must be less than upper _ => { } }; - //~^^^ ERROR lower range bound must be less than upper - //~| ERROR lower range bound must be less than upper match 5u64 { 0xFFFF_FFFF_FFFF_FFFF ..= 1 => { } + //~^ ERROR lower range bound must be less than or equal to upper _ => { } }; - //~^^^ ERROR lower range bound must be less than or equal to upper - //~| ERROR lower range bound must be less than or equal to upper } diff --git a/tests/ui/match/match-range-fail-2.stderr b/tests/ui/match/match-range-fail-2.stderr index 7a0852d7e..52a2bf2b3 100644 --- a/tests/ui/match/match-range-fail-2.stderr +++ b/tests/ui/match/match-range-fail-2.stderr @@ -5,36 +5,18 @@ LL | 6 ..= 1 => { } | ^ lower bound larger than upper bound error[E0579]: lower range bound must be less than upper - --> $DIR/match-range-fail-2.rs:12:9 + --> $DIR/match-range-fail-2.rs:11:9 | LL | 0 .. 0 => { } | ^ error[E0030]: lower range bound must be less than or equal to upper - --> $DIR/match-range-fail-2.rs:19:9 + --> $DIR/match-range-fail-2.rs:17:9 | LL | 0xFFFF_FFFF_FFFF_FFFF ..= 1 => { } | ^^^^^^^^^^^^^^^^^^^^^ lower bound larger than upper bound -error[E0030]: lower range bound must be less than or equal to upper - --> $DIR/match-range-fail-2.rs:5:9 - | -LL | 6 ..= 1 => { } - | ^ lower bound larger than upper bound - -error[E0579]: lower range bound must be less than upper - --> $DIR/match-range-fail-2.rs:12:9 - | -LL | 0 .. 0 => { } - | ^ - -error[E0030]: lower range bound must be less than or equal to upper - --> $DIR/match-range-fail-2.rs:19:9 - | -LL | 0xFFFF_FFFF_FFFF_FFFF ..= 1 => { } - | ^^^^^^^^^^^^^^^^^^^^^ lower bound larger than upper bound - -error: aborting due to 6 previous errors +error: aborting due to 3 previous errors Some errors have detailed explanations: E0030, E0579. For more information about an error, try `rustc --explain E0030`. diff --git a/tests/ui/methods/inherent-bound-in-probe.rs b/tests/ui/methods/inherent-bound-in-probe.rs new file mode 100644 index 000000000..81a99ca01 --- /dev/null +++ b/tests/ui/methods/inherent-bound-in-probe.rs @@ -0,0 +1,49 @@ +// normalize-stderr-test: "long-type-\d+" -> "long-type-hash" + +// Fixes #110131 +// +// The issue is that we were constructing an `ImplDerived` cause code for the +// `&'a T: IntoIterator` obligation for `Helper::new`, which is +// incorrect because derived obligations are only expected to come from *traits*. + +struct SeqBuffer<'a, T> +where + &'a T: IntoIterator, +{ + iter: <&'a T as IntoIterator>::IntoIter, +} + +struct Helper<'a, T> +where + &'a T: IntoIterator, +{ + buf: SeqBuffer<'a, T>, +} + +impl<'a, T> Helper<'a, T> +where + &'a T: IntoIterator, +{ + fn new(sq: &'a T) -> Self { + loop {} + } +} + +struct BitReaderWrapper(T); + +impl<'a, T> IntoIterator for &'a BitReaderWrapper +where + &'a T: IntoIterator, +{ + type Item = u32; + + type IntoIter = Helper<'a, T>; + //~^ ERROR `Helper<'a, T>` is not an iterator + + fn into_iter(self) -> Self::IntoIter { + Helper::new(&self.0) + //~^ ERROR overflow evaluating the requirement `&_: IntoIterator` + } +} + +fn main() {} diff --git a/tests/ui/methods/inherent-bound-in-probe.stderr b/tests/ui/methods/inherent-bound-in-probe.stderr new file mode 100644 index 000000000..ff03a7edb --- /dev/null +++ b/tests/ui/methods/inherent-bound-in-probe.stderr @@ -0,0 +1,38 @@ +error[E0277]: `Helper<'a, T>` is not an iterator + --> $DIR/inherent-bound-in-probe.rs:40:21 + | +LL | type IntoIter = Helper<'a, T>; + | ^^^^^^^^^^^^^ `Helper<'a, T>` is not an iterator + | + = help: the trait `Iterator` is not implemented for `Helper<'a, T>` +note: required by a bound in `std::iter::IntoIterator::IntoIter` + --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + +error[E0275]: overflow evaluating the requirement `&_: IntoIterator` + --> $DIR/inherent-bound-in-probe.rs:44:17 + | +LL | Helper::new(&self.0) + | ^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inherent_bound_in_probe`) +note: required for `&BitReaderWrapper<_>` to implement `IntoIterator` + --> $DIR/inherent-bound-in-probe.rs:34:13 + | +LL | impl<'a, T> IntoIterator for &'a BitReaderWrapper + | ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^ +LL | where +LL | &'a T: IntoIterator, + | ------------- unsatisfied trait bound introduced here + = note: 126 redundant requirements hidden + = note: required for `&BitReaderWrapper>>>>` to implement `IntoIterator` + = note: the full type name has been written to '$TEST_BUILD_DIR/methods/inherent-bound-in-probe/inherent-bound-in-probe.long-type-hash.txt' +note: required by a bound in `Helper<'a, T>` + --> $DIR/inherent-bound-in-probe.rs:25:25 + | +LL | &'a T: IntoIterator, + | ^^^^^^^^^^^^^ required by this bound in `Helper<'a, T>` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0275, E0277. +For more information about an error, try `rustc --explain E0275`. diff --git a/tests/ui/methods/method-call-lifetime-args-fail.stderr b/tests/ui/methods/method-call-lifetime-args-fail.stderr index 34526256f..645d8b8d1 100644 --- a/tests/ui/methods/method-call-lifetime-args-fail.stderr +++ b/tests/ui/methods/method-call-lifetime-args-fail.stderr @@ -30,7 +30,7 @@ note: method defined here, with 2 lifetime parameters: `'a`, `'b` LL | fn early<'a, 'b>(self) -> (&'a u8, &'b u8) { loop {} } | ^^^^^ -- -- -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:27:15 | LL | S::late::<'static>(S, &0, &0); @@ -42,7 +42,7 @@ note: the late bound lifetime parameter is introduced here LL | fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {} | ^^ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:29:15 | LL | S::late::<'static, 'static>(S, &0, &0); @@ -54,7 +54,7 @@ note: the late bound lifetime parameter is introduced here LL | fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {} | ^^ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:31:15 | LL | S::late::<'static, 'static, 'static>(S, &0, &0); @@ -66,7 +66,7 @@ note: the late bound lifetime parameter is introduced here LL | fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {} | ^^ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:34:21 | LL | S::late_early::<'static, 'static>(S, &0); @@ -78,7 +78,7 @@ note: the late bound lifetime parameter is introduced here LL | fn late_early<'a, 'b>(self, _: &'a u8) -> &'b u8 { loop {} } | ^^ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:36:21 | LL | S::late_early::<'static, 'static, 'static>(S, &0); @@ -90,7 +90,7 @@ note: the late bound lifetime parameter is introduced here LL | fn late_early<'a, 'b>(self, _: &'a u8) -> &'b u8 { loop {} } | ^^ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:40:24 | LL | S::late_implicit::<'static>(S, &0, &0); @@ -102,7 +102,7 @@ note: the late bound lifetime parameter is introduced here LL | fn late_implicit(self, _: &u8, _: &u8) {} | ^ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:42:24 | LL | S::late_implicit::<'static, 'static>(S, &0, &0); @@ -114,7 +114,7 @@ note: the late bound lifetime parameter is introduced here LL | fn late_implicit(self, _: &u8, _: &u8) {} | ^ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:44:24 | LL | S::late_implicit::<'static, 'static, 'static>(S, &0, &0); @@ -126,7 +126,7 @@ note: the late bound lifetime parameter is introduced here LL | fn late_implicit(self, _: &u8, _: &u8) {} | ^ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:47:30 | LL | S::late_implicit_early::<'static, 'static>(S, &0); @@ -138,7 +138,7 @@ note: the late bound lifetime parameter is introduced here LL | fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} } | ^ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:49:30 | LL | S::late_implicit_early::<'static, 'static, 'static>(S, &0); @@ -150,7 +150,7 @@ note: the late bound lifetime parameter is introduced here LL | fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} } | ^ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:52:35 | LL | S::late_implicit_self_early::<'static, 'static>(&S); @@ -162,7 +162,7 @@ note: the late bound lifetime parameter is introduced here LL | fn late_implicit_self_early<'b>(&self) -> &'b u8 { loop {} } | ^ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:54:35 | LL | S::late_implicit_self_early::<'static, 'static, 'static>(&S); @@ -174,7 +174,7 @@ note: the late bound lifetime parameter is introduced here LL | fn late_implicit_self_early<'b>(&self) -> &'b u8 { loop {} } | ^ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:57:28 | LL | S::late_unused_early::<'static, 'static>(S); @@ -186,7 +186,7 @@ note: the late bound lifetime parameter is introduced here LL | fn late_unused_early<'a, 'b>(self) -> &'b u8 { loop {} } | ^^ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:59:28 | LL | S::late_unused_early::<'static, 'static, 'static>(S); @@ -232,4 +232,5 @@ LL | fn early<'a, 'b>(self) -> (&'a u8, &'b u8) { loop {} } error: aborting due to 18 previous errors -For more information about this error, try `rustc --explain E0107`. +Some errors have detailed explanations: E0107, E0794. +For more information about an error, try `rustc --explain E0107`. diff --git a/tests/ui/methods/method-call-lifetime-args.stderr b/tests/ui/methods/method-call-lifetime-args.stderr index 64ae79e9b..b215d5832 100644 --- a/tests/ui/methods/method-call-lifetime-args.stderr +++ b/tests/ui/methods/method-call-lifetime-args.stderr @@ -1,4 +1,4 @@ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args.rs:9:15 | LL | S::late::<'static>(S, &0, &0); @@ -10,7 +10,7 @@ note: the late bound lifetime parameter is introduced here LL | fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {} | ^^ -error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args.rs:11:24 | LL | S::late_implicit::<'static>(S, &0, &0); @@ -24,3 +24,4 @@ LL | fn late_implicit(self, _: &u8, _: &u8) {} error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0794`. diff --git a/tests/ui/mir-unpretty.rs b/tests/ui/mir-unpretty.rs deleted file mode 100644 index 30620c69f..000000000 --- a/tests/ui/mir-unpretty.rs +++ /dev/null @@ -1,5 +0,0 @@ -// compile-flags: -Z unpretty=mir - -fn main() { - let x: () = 0; //~ ERROR: mismatched types -} diff --git a/tests/ui/mir-unpretty.stderr b/tests/ui/mir-unpretty.stderr deleted file mode 100644 index 3808f8583..000000000 --- a/tests/ui/mir-unpretty.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/mir-unpretty.rs:4:17 - | -LL | let x: () = 0; - | -- ^ expected `()`, found integer - | | - | expected due to this - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/mir/addrof_alignment.rs b/tests/ui/mir/addrof_alignment.rs new file mode 100644 index 000000000..892638bfb --- /dev/null +++ b/tests/ui/mir/addrof_alignment.rs @@ -0,0 +1,15 @@ +// run-pass +// ignore-wasm32-bare: No panic messages +// compile-flags: -C debug-assertions + +struct Misalignment { + a: u32, +} + +fn main() { + let items: [Misalignment; 2] = [Misalignment { a: 0 }, Misalignment { a: 1 }]; + unsafe { + let ptr: *const Misalignment = items.as_ptr().cast::().add(1).cast::(); + let _ptr = core::ptr::addr_of!((*ptr).a); + } +} diff --git a/tests/ui/mir/checks_without_panic_impl.rs b/tests/ui/mir/checks_without_panic_impl.rs new file mode 100644 index 000000000..04f410b77 --- /dev/null +++ b/tests/ui/mir/checks_without_panic_impl.rs @@ -0,0 +1,17 @@ +// Ensures that the alignment check we insert for raw pointer dereferences +// does not prevent crates without a panic_impl from compiling. +// See rust-lang/rust#109996 + +// build-pass +// compile-flags: -Cdebug-assertions=yes + +#![crate_type = "lib"] + +#![feature(lang_items)] +#![feature(no_core)] +#![no_core] + +#[lang = "sized"] +trait Foo {} + +pub unsafe fn foo(x: *const i32) -> &'static i32 { unsafe { &*x } } diff --git a/tests/ui/mir/issue-109004-drop-large-array.rs b/tests/ui/mir/issue-109004-drop-large-array.rs new file mode 100644 index 000000000..5e3361cef --- /dev/null +++ b/tests/ui/mir/issue-109004-drop-large-array.rs @@ -0,0 +1,16 @@ +// check-pass + +const SZ: usize = 64_000_000; +type BigDrop = [String; SZ]; + +fn f(_dropme: BigDrop) {} + +fn f2(_moveme: BigDrop) -> String { + let [a, ..] = _moveme; + a +} + +fn main() { + f(std::array::from_fn(|_| String::new())); + f2(std::array::from_fn(|_| String::new())); +} diff --git a/tests/ui/mir/mir_alignment_check.rs b/tests/ui/mir/mir_alignment_check.rs new file mode 100644 index 000000000..68a5384b3 --- /dev/null +++ b/tests/ui/mir/mir_alignment_check.rs @@ -0,0 +1,12 @@ +// run-fail +// ignore-wasm32-bare: No panic messages +// compile-flags: -C debug-assertions +// error-pattern: misaligned pointer dereference: address must be a multiple of 0x4 but is + +fn main() { + let mut x = [0u32; 2]; + let ptr: *mut u8 = x.as_mut_ptr().cast::(); + unsafe { + *(ptr.add(1).cast::()) = 42; + } +} diff --git a/tests/ui/mir/mir_boxing.rs b/tests/ui/mir/mir_boxing.rs deleted file mode 100644 index 83e1cfb64..000000000 --- a/tests/ui/mir/mir_boxing.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass -#![feature(box_syntax)] - -fn test() -> Box { - box 42 -} - -fn main() { - assert_eq!(*test(), 42); -} diff --git a/tests/ui/mir/unsize-trait.rs b/tests/ui/mir/unsize-trait.rs new file mode 100644 index 000000000..45b5308c0 --- /dev/null +++ b/tests/ui/mir/unsize-trait.rs @@ -0,0 +1,15 @@ +// Check that the interpreter does not ICE when trying to unsize `B` to `[u8]`. +// This is a `build` test to ensure that const-prop-lint runs. +// build-pass + +#![feature(unsize)] + +fn foo(buffer: &mut [B; 2]) + where B: std::marker::Unsize<[u8]>, +{ + let buffer: &[u8] = &buffer[0]; +} + +fn main() { + foo(&mut [[0], [5]]); +} diff --git a/tests/ui/mir/validate/transmute_cast_sized.rs b/tests/ui/mir/validate/transmute_cast_sized.rs new file mode 100644 index 000000000..eaaf7eb3e --- /dev/null +++ b/tests/ui/mir/validate/transmute_cast_sized.rs @@ -0,0 +1,17 @@ +// build-pass +// compile-flags: -Zvalidate-mir +// edition: 2021 + +#![crate_type = "lib"] + +// Use `PhantomData` to get target-independent size +async fn get(_r: std::marker::PhantomData<&i32>) { + loop {} +} + +pub fn check() { + let mut v = get(loop {}); + let _ = || unsafe { + v = std::mem::transmute([0_u8; 1]); + }; +} diff --git a/tests/ui/mismatched_types/method-help-unsatisfied-bound.stderr b/tests/ui/mismatched_types/method-help-unsatisfied-bound.stderr index d3b752507..9dab3e522 100644 --- a/tests/ui/mismatched_types/method-help-unsatisfied-bound.stderr +++ b/tests/ui/mismatched_types/method-help-unsatisfied-bound.stderr @@ -10,7 +10,8 @@ note: required by a bound in `Result::::unwrap` --> $SRC_DIR/core/src/result.rs:LL:COL help: consider annotating `Foo` with `#[derive(Debug)]` | -LL | #[derive(Debug)] +LL + #[derive(Debug)] +LL | struct Foo; | error: aborting due to previous error diff --git a/tests/ui/missing/missing-items/missing-const-parameter.rs b/tests/ui/missing/missing-items/missing-const-parameter.rs new file mode 100644 index 000000000..a3af88f26 --- /dev/null +++ b/tests/ui/missing/missing-items/missing-const-parameter.rs @@ -0,0 +1,24 @@ +struct Struct; + +impl Struct<{ N }> {} +//~^ ERROR cannot find value `N` in this scope +//~| HELP you might be missing a const parameter + +fn func0(_: Struct<{ N }>) {} +//~^ ERROR cannot find value `N` in this scope +//~| HELP you might be missing a const parameter + +fn func1(_: [u8; N]) {} +//~^ ERROR cannot find value `N` in this scope +//~| HELP you might be missing a const parameter + +fn func2(_: [T; N]) {} +//~^ ERROR cannot find value `N` in this scope +//~| HELP you might be missing a const parameter + +struct Image([[u32; C]; R]); +//~^ ERROR cannot find value `C` in this scope +//~| HELP a const parameter with a similar name exists +//~| HELP you might be missing a const parameter + +fn main() {} diff --git a/tests/ui/missing/missing-items/missing-const-parameter.stderr b/tests/ui/missing/missing-items/missing-const-parameter.stderr new file mode 100644 index 000000000..d9fea1306 --- /dev/null +++ b/tests/ui/missing/missing-items/missing-const-parameter.stderr @@ -0,0 +1,64 @@ +error[E0425]: cannot find value `N` in this scope + --> $DIR/missing-const-parameter.rs:3:15 + | +LL | impl Struct<{ N }> {} + | ^ not found in this scope + | +help: you might be missing a const parameter + | +LL | impl Struct<{ N }> {} + | +++++++++++++++++++++ + +error[E0425]: cannot find value `N` in this scope + --> $DIR/missing-const-parameter.rs:7:22 + | +LL | fn func0(_: Struct<{ N }>) {} + | ^ not found in this scope + | +help: you might be missing a const parameter + | +LL | fn func0(_: Struct<{ N }>) {} + | +++++++++++++++++++++ + +error[E0425]: cannot find value `N` in this scope + --> $DIR/missing-const-parameter.rs:11:18 + | +LL | fn func1(_: [u8; N]) {} + | ^ not found in this scope + | +help: you might be missing a const parameter + | +LL | fn func1(_: [u8; N]) {} + | +++++++++++++++++++++ + +error[E0425]: cannot find value `N` in this scope + --> $DIR/missing-const-parameter.rs:15:20 + | +LL | fn func2(_: [T; N]) {} + | ^ not found in this scope + | +help: you might be missing a const parameter + | +LL | fn func2(_: [T; N]) {} + | +++++++++++++++++++++ + +error[E0425]: cannot find value `C` in this scope + --> $DIR/missing-const-parameter.rs:19:37 + | +LL | struct Image([[u32; C]; R]); + | - ^ + | | + | similarly named const parameter `R` defined here + | +help: a const parameter with a similar name exists + | +LL | struct Image([[u32; R]; R]); + | ~ +help: you might be missing a const parameter + | +LL | struct Image([[u32; C]; R]); + | +++++++++++++++++++++ + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/modules/issue-107649.stderr b/tests/ui/modules/issue-107649.stderr index 1cea71f28..38a910b57 100644 --- a/tests/ui/modules/issue-107649.stderr +++ b/tests/ui/modules/issue-107649.stderr @@ -10,7 +10,8 @@ error[E0277]: `Dummy` doesn't implement `Debug` help: consider annotating `Dummy` with `#[derive(Debug)]` --> $DIR/auxiliary/dummy_lib.rs:2:1 | -2 | #[derive(Debug)] +2 + #[derive(Debug)] +3 | #[path = "auxiliary/dummy_lib.rs"] | error: aborting due to previous error diff --git a/tests/ui/modules/mod_dir_implicit.rs b/tests/ui/modules/mod_dir_implicit.rs index d6ea6a98b..7eac90f4d 100644 --- a/tests/ui/modules/mod_dir_implicit.rs +++ b/tests/ui/modules/mod_dir_implicit.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty issue #37195 mod mod_dir_implicit_aux; diff --git a/tests/ui/modules/mod_dir_path.rs b/tests/ui/modules/mod_dir_path.rs index 70f592d0c..72db8e44b 100644 --- a/tests/ui/modules/mod_dir_path.rs +++ b/tests/ui/modules/mod_dir_path.rs @@ -1,6 +1,5 @@ // run-pass #![allow(unused_macros)] -// ignore-pretty issue #37195 mod mod_dir_simple { #[path = "test.rs"] diff --git a/tests/ui/modules/mod_dir_path2.rs b/tests/ui/modules/mod_dir_path2.rs index c3e3e1d63..b4f8f1c84 100644 --- a/tests/ui/modules/mod_dir_path2.rs +++ b/tests/ui/modules/mod_dir_path2.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty issue #37195 #[path = "mod_dir_simple"] mod pancakes { diff --git a/tests/ui/modules/mod_dir_path3.rs b/tests/ui/modules/mod_dir_path3.rs index fed70c1bc..56980c010 100644 --- a/tests/ui/modules/mod_dir_path3.rs +++ b/tests/ui/modules/mod_dir_path3.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty issue #37195 #[path = "mod_dir_simple"] mod pancakes { diff --git a/tests/ui/modules/mod_dir_path_multi.rs b/tests/ui/modules/mod_dir_path_multi.rs index 2b805141a..1c111294a 100644 --- a/tests/ui/modules/mod_dir_path_multi.rs +++ b/tests/ui/modules/mod_dir_path_multi.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty issue #37195 #[path = "mod_dir_simple"] mod biscuits { diff --git a/tests/ui/modules/mod_dir_recursive.rs b/tests/ui/modules/mod_dir_recursive.rs index b109d13d1..56f261398 100644 --- a/tests/ui/modules/mod_dir_recursive.rs +++ b/tests/ui/modules/mod_dir_recursive.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty issue #37195 // Testing that the parser for each file tracks its modules // and paths independently. The load_another_mod module should diff --git a/tests/ui/modules/mod_dir_simple.rs b/tests/ui/modules/mod_dir_simple.rs index 1d92c968a..56f15b1d6 100644 --- a/tests/ui/modules/mod_dir_simple.rs +++ b/tests/ui/modules/mod_dir_simple.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty issue #37195 mod mod_dir_simple { pub mod test; diff --git a/tests/ui/modules/mod_file.rs b/tests/ui/modules/mod_file.rs index 0ca52889e..7b56b99eb 100644 --- a/tests/ui/modules/mod_file.rs +++ b/tests/ui/modules/mod_file.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty issue #37195 // Testing that a plain .rs file can load modules from other source files diff --git a/tests/ui/modules/mod_file_with_path_attr.rs b/tests/ui/modules/mod_file_with_path_attr.rs index 48e253ead..e73936695 100644 --- a/tests/ui/modules/mod_file_with_path_attr.rs +++ b/tests/ui/modules/mod_file_with_path_attr.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty issue #37195 // Testing that a plain .rs file can load modules from other source files diff --git a/tests/ui/modules_and_files_visibility/mod_file_disambig_aux/compiletest-ignore-dir b/tests/ui/modules_and_files_visibility/mod_file_disambig_aux/compiletest-ignore-dir new file mode 100644 index 000000000..e69de29bb diff --git a/tests/ui/myriad-closures.rs b/tests/ui/myriad-closures.rs new file mode 100644 index 000000000..310351f50 --- /dev/null +++ b/tests/ui/myriad-closures.rs @@ -0,0 +1,39 @@ +// run-pass +// This test case tests whether we can handle code bases that contain a high +// number of closures, something that needs special handling in the MingGW +// toolchain. +// See https://github.com/rust-lang/rust/issues/34793 for more information. + +// Make sure we don't optimize anything away: +// compile-flags: -C no-prepopulate-passes -Cpasses=name-anon-globals + +// Expand something exponentially +macro_rules! go_bacterial { + ($mac:ident) => ($mac!()); + ($mac:ident 1 $($t:tt)*) => ( + go_bacterial!($mac $($t)*); + go_bacterial!($mac $($t)*); + ) +} + +macro_rules! mk_closure { + () => ((move || {})()) +} + +macro_rules! mk_fn { + () => { + { + fn function() { + // Make 16 closures + go_bacterial!(mk_closure 1 1 1 1); + } + let _ = function(); + } + } +} + +fn main() { + // Make 2^8 functions, each containing 16 closures, + // resulting in 2^12 closures overall. + go_bacterial!(mk_fn 1 1 1 1 1 1 1 1); +} diff --git a/tests/ui/namespace/namespace-mix.stderr b/tests/ui/namespace/namespace-mix.stderr index cb72d4a1c..3ac5e96c5 100644 --- a/tests/ui/namespace/namespace-mix.stderr +++ b/tests/ui/namespace/namespace-mix.stderr @@ -14,9 +14,9 @@ LL | check(m1::TS); | ~~ help: consider importing one of these items instead | -LL | use m2::S; +LL + use m2::S; | -LL | use xm2::S; +LL + use xm2::S; | help: if you import `S`, refer to it directly | @@ -42,9 +42,9 @@ LL | check(xm1::TS); | ~~ help: consider importing one of these items instead | -LL | use m2::S; +LL + use m2::S; | -LL | use xm2::S; +LL + use xm2::S; | help: if you import `S`, refer to it directly | @@ -68,9 +68,9 @@ LL | check(m7::TV); | ~~ help: consider importing one of these items instead | -LL | use m8::V; +LL + use m8::V; | -LL | use xm8::V; +LL + use xm8::V; | help: if you import `V`, refer to it directly | @@ -96,9 +96,9 @@ LL | check(xm7::TV); | ~~ help: consider importing one of these items instead | -LL | use m8::V; +LL + use m8::V; | -LL | use xm8::V; +LL + use xm8::V; | help: if you import `V`, refer to it directly | diff --git a/tests/ui/never_type/exhaustive_patterns.stderr b/tests/ui/never_type/exhaustive_patterns.stderr index 40c7c1d10..5fed903eb 100644 --- a/tests/ui/never_type/exhaustive_patterns.stderr +++ b/tests/ui/never_type/exhaustive_patterns.stderr @@ -17,8 +17,8 @@ LL | B(inner::Wrapper), = note: the matched value is of type `Either<(), !>` help: you might want to use `if let` to ignore the variant that isn't matched | -LL | if let Either::A(()) = foo() { todo!() } - | ++ ~~~~~~~~~~~ +LL | if let Either::A(()) = foo() { todo!() }; + | ++ +++++++++++ error: aborting due to previous error diff --git a/tests/ui/never_type/issue-52443.rs b/tests/ui/never_type/issue-52443.rs index 0498a8a16..4669d7c1a 100644 --- a/tests/ui/never_type/issue-52443.rs +++ b/tests/ui/never_type/issue-52443.rs @@ -11,4 +11,5 @@ fn main() { //~| ERROR cannot convert //~| ERROR mutable references //~| ERROR cannot call + //~| ERROR the trait bound } diff --git a/tests/ui/never_type/issue-52443.stderr b/tests/ui/never_type/issue-52443.stderr index 99dfce869..1233bdc5d 100644 --- a/tests/ui/never_type/issue-52443.stderr +++ b/tests/ui/never_type/issue-52443.stderr @@ -58,6 +58,19 @@ LL | [(); { for _ in 0usize.. {}; 0}]; = note: see issue #57349 for more information = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable +error[E0277]: the trait bound `RangeFrom: Iterator` is not satisfied + --> $DIR/issue-52443.rs:9:21 + | +LL | [(); { for _ in 0usize.. {}; 0}]; + | ^^^^^^^^ `RangeFrom` is not an iterator + | + = help: the trait `~const Iterator` is not implemented for `RangeFrom` +note: the trait `Iterator` is implemented for `RangeFrom`, but that implementation is not `const` + --> $DIR/issue-52443.rs:9:21 + | +LL | [(); { for _ in 0usize.. {}; 0}]; + | ^^^^^^^^ + error[E0015]: cannot call non-const fn ` as Iterator>::next` in constants --> $DIR/issue-52443.rs:9:21 | @@ -67,7 +80,7 @@ LL | [(); { for _ in 0usize.. {}; 0}]; = note: calls in constants are limited to constant functions, tuple structs and tuple variants = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable -error: aborting due to 6 previous errors; 1 warning emitted +error: aborting due to 7 previous errors; 1 warning emitted -Some errors have detailed explanations: E0015, E0308, E0658. +Some errors have detailed explanations: E0015, E0277, E0308, E0658. For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/new-unsafe-pointers.rs b/tests/ui/new-unsafe-pointers.rs deleted file mode 100644 index d99eb4cbd..000000000 --- a/tests/ui/new-unsafe-pointers.rs +++ /dev/null @@ -1,7 +0,0 @@ -// run-pass -// pretty-expanded FIXME #23616 - -fn main() { - let _a: *const isize = 3 as *const isize; - let _a: *mut isize = 3 as *mut isize; -} diff --git a/tests/ui/nll/closure-requirements/escape-argument-callee.stderr b/tests/ui/nll/closure-requirements/escape-argument-callee.stderr index 363ddfaff..c0d95ddaa 100644 --- a/tests/ui/nll/closure-requirements/escape-argument-callee.stderr +++ b/tests/ui/nll/closure-requirements/escape-argument-callee.stderr @@ -6,7 +6,7 @@ LL | let mut closure = expect_sig(|p, y| *p = y); | = note: defining type: test::{closure#0} with closure substs [ i16, - for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) mut &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }) i32)), + for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) mut &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) i32)), (), ] diff --git a/tests/ui/nll/closure-requirements/escape-argument.stderr b/tests/ui/nll/closure-requirements/escape-argument.stderr index 5a8462d4d..61e2a1ea6 100644 --- a/tests/ui/nll/closure-requirements/escape-argument.stderr +++ b/tests/ui/nll/closure-requirements/escape-argument.stderr @@ -6,7 +6,7 @@ LL | let mut closure = expect_sig(|p, y| *p = y); | = note: defining type: test::{closure#0} with closure substs [ i16, - for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) mut &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) i32)), + for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) mut &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) i32)), (), ] diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr index 7da6ce58b..5a7b12732 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr +++ b/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr @@ -6,7 +6,7 @@ LL | |_outlives1, _outlives2, _outlives3, x, y| { | = note: defining type: supply::{closure#0} with closure substs [ i16, - for extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>, std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) &'_#3r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>)), + for extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'_#3r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>)), (), ] = note: late-bound region is '_#4r diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr index 993687605..db2ecc779 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr +++ b/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr @@ -6,7 +6,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y | = note: defining type: supply::{closure#0} with closure substs [ i16, - for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(4, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(5, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) u32>)), + for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>)), (), ] = note: late-bound region is '_#3r diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr index 721cd45de..1d9dafbe5 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr +++ b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr @@ -6,7 +6,7 @@ LL | foo(cell, |cell_a, cell_x| { | = note: defining type: case1::{closure#0} with closure substs [ i32, - for extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>)), + for extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>)), (), ] @@ -36,7 +36,7 @@ LL | foo(cell, |cell_a, cell_x| { | = note: defining type: case2::{closure#0} with closure substs [ i32, - for extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>)), + for extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>)), (), ] = note: number of external vids: 2 diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr index 43dfc3bb9..85f7fe35c 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr +++ b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr @@ -6,7 +6,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { | = note: defining type: supply::{closure#0} with closure substs [ i16, - for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(4, None) }) u32>)), + for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) u32>)), (), ] = note: late-bound region is '_#2r diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr index 96c734226..7194843e2 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr +++ b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr @@ -6,7 +6,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y | = note: defining type: supply::{closure#0} with closure substs [ i16, - for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }) std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(4, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(5, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) u32>)), + for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>)), (), ] = note: late-bound region is '_#3r diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr index 03dbd686e..71f8a1c67 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr +++ b/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr @@ -6,7 +6,7 @@ LL | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { | = note: defining type: test::{closure#0} with closure substs [ i16, - for extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>)), + for extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>)), (), ] = note: late-bound region is '_#3r diff --git a/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr b/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr index d716d3de2..e1cb97b1c 100644 --- a/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr +++ b/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr @@ -6,7 +6,7 @@ LL | |_outlives1, _outlives2, x, y| { | = note: defining type: supply::{closure#0} with closure substs [ i16, - for extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>)), + for extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>)), (), ] = note: late-bound region is '_#3r diff --git a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr index b924873fc..b66e8391c 100644 --- a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr +++ b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr @@ -6,7 +6,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { | = note: defining type: supply::{closure#0} with closure substs [ i16, - for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(4, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>)), + for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>)), (), ] = note: late-bound region is '_#2r diff --git a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr index 9b25efd0b..49641fd06 100644 --- a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr +++ b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr @@ -6,7 +6,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y | = note: defining type: supply::{closure#0} with closure substs [ i16, - for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(4, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(5, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) u32>)), + for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>)), (), ] = note: late-bound region is '_#3r diff --git a/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr b/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr index 6db72b886..4e34ba516 100644 --- a/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr +++ b/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr @@ -6,7 +6,7 @@ LL | expect_sig(|a, b| b); // ought to return `a` | = note: defining type: test::{closure#0} with closure substs [ i16, - for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) i32)) -> &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) i32, + for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) i32)) -> &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) i32, (), ] diff --git a/tests/ui/nll/issue-78561.rs b/tests/ui/nll/issue-78561.rs index 55147fcd1..1a2a3ca56 100644 --- a/tests/ui/nll/issue-78561.rs +++ b/tests/ui/nll/issue-78561.rs @@ -1,5 +1,5 @@ // check-pass -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] pub trait Trait { type A; diff --git a/tests/ui/nll/ty-outlives/impl-trait-captures.stderr b/tests/ui/nll/ty-outlives/impl-trait-captures.stderr index 7fcb68252..da4b9595c 100644 --- a/tests/ui/nll/ty-outlives/impl-trait-captures.stderr +++ b/tests/ui/nll/ty-outlives/impl-trait-captures.stderr @@ -1,16 +1,16 @@ -error[E0700]: hidden type for `Opaque(DefId(0:13 ~ impl_trait_captures[1afc]::foo::{opaque#0}), [ReEarlyBound(0, 'a), T, ReEarlyBound(0, 'a)])` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `Opaque(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::{opaque#0}), [ReEarlyBound(0, 'a), T, ReEarlyBound(0, 'a)])` captures lifetime that does not appear in bounds --> $DIR/impl-trait-captures.rs:11:5 | LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> { | -- ------------ opaque type defined here | | - | hidden type `&ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[1afc]::foo::'_), '_)) T` captures the anonymous lifetime defined here + | hidden type `&ReFree(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[aeb9]::foo::'_), '_)) T` captures the anonymous lifetime defined here LL | x | ^ | -help: to declare that `Opaque(DefId(0:13 ~ impl_trait_captures[1afc]::foo::{opaque#0}), [ReEarlyBound(0, 'a), T, ReEarlyBound(2, 'a)])` captures `ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[1afc]::foo::'_), '_))`, you can add an explicit `ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[1afc]::foo::'_), '_))` lifetime bound +help: to declare that `Opaque(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::{opaque#0}), [ReEarlyBound(0, 'a), T, ReEarlyBound(2, 'a)])` captures `ReFree(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[aeb9]::foo::'_), '_))`, you can add an explicit `ReFree(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[aeb9]::foo::'_), '_))` lifetime bound | -LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> + ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[1afc]::foo::'_), '_)) { +LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> + ReFree(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[aeb9]::foo::'_), '_)) { | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ error: aborting due to previous error diff --git a/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr b/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr index a442cf12d..2c4a05975 100644 --- a/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr +++ b/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr @@ -6,7 +6,7 @@ LL | twice(cell, value, |a, b| invoke(a, b)); | = note: defining type: generic::::{closure#0} with closure substs [ i16, - for extern "rust-call" fn((std::option::Option>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) T)), + for extern "rust-call" fn((std::option::Option>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) T)), (), ] = note: number of external vids: 2 @@ -28,7 +28,7 @@ LL | twice(cell, value, |a, b| invoke(a, b)); | = note: defining type: generic_fail::::{closure#0} with closure substs [ i16, - for extern "rust-call" fn((std::option::Option>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) T)), + for extern "rust-call" fn((std::option::Option>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) T)), (), ] = note: late-bound region is '_#2r diff --git a/tests/ui/nll/user-annotations/region-error-ice-109072.rs b/tests/ui/nll/user-annotations/region-error-ice-109072.rs new file mode 100644 index 000000000..3f2ad3ccb --- /dev/null +++ b/tests/ui/nll/user-annotations/region-error-ice-109072.rs @@ -0,0 +1,14 @@ +// Regression test for #109072. +// Check that we don't ICE when canonicalizing user annotation. + +trait Lt<'a> { + type T; +} + +impl Lt<'missing> for () { //~ ERROR undeclared lifetime + type T = &'missing (); //~ ERROR undeclared lifetime +} + +fn main() { + let _: <() as Lt<'_>>::T = &(); +} diff --git a/tests/ui/nll/user-annotations/region-error-ice-109072.stderr b/tests/ui/nll/user-annotations/region-error-ice-109072.stderr new file mode 100644 index 000000000..d90971bed --- /dev/null +++ b/tests/ui/nll/user-annotations/region-error-ice-109072.stderr @@ -0,0 +1,26 @@ +error[E0261]: use of undeclared lifetime name `'missing` + --> $DIR/region-error-ice-109072.rs:8:9 + | +LL | impl Lt<'missing> for () { + | - ^^^^^^^^ undeclared lifetime + | | + | help: consider introducing lifetime `'missing` here: `<'missing>` + +error[E0261]: use of undeclared lifetime name `'missing` + --> $DIR/region-error-ice-109072.rs:9:15 + | +LL | type T = &'missing (); + | ^^^^^^^^ undeclared lifetime + | +help: consider introducing lifetime `'missing` here + | +LL | type T<'missing> = &'missing (); + | ++++++++++ +help: consider introducing lifetime `'missing` here + | +LL | impl<'missing> Lt<'missing> for () { + | ++++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0261`. diff --git a/tests/ui/non_modrs_mods/non_modrs_mods.rs b/tests/ui/non_modrs_mods/non_modrs_mods.rs index f664b0166..b3fa39008 100644 --- a/tests/ui/non_modrs_mods/non_modrs_mods.rs +++ b/tests/ui/non_modrs_mods/non_modrs_mods.rs @@ -1,6 +1,5 @@ // run-pass // -// ignore-pretty issue #37195 pub mod modrs_mod; pub mod foors_mod; #[path = "some_crazy_attr_mod_dir/arbitrary_name.rs"] diff --git a/tests/ui/non_modrs_mods_and_inline_mods/x/y/z/compiletest-ignore-dir b/tests/ui/non_modrs_mods_and_inline_mods/x/y/z/compiletest-ignore-dir new file mode 100644 index 000000000..e69de29bb diff --git a/tests/ui/not-clone-closure.stderr b/tests/ui/not-clone-closure.stderr index 37d94cf0e..db9307c61 100644 --- a/tests/ui/not-clone-closure.stderr +++ b/tests/ui/not-clone-closure.stderr @@ -14,7 +14,8 @@ LL | let hello = move || { | ^^^^^^^ help: consider annotating `S` with `#[derive(Clone)]` | -LL | #[derive(Clone)] +LL + #[derive(Clone)] +LL | struct S(i32); | error: aborting due to previous error diff --git a/tests/ui/on-unimplemented/no-debug.stderr b/tests/ui/on-unimplemented/no-debug.stderr index 1035da54d..97d67dbd8 100644 --- a/tests/ui/on-unimplemented/no-debug.stderr +++ b/tests/ui/on-unimplemented/no-debug.stderr @@ -9,7 +9,8 @@ LL | println!("{:?} {:?}", Foo, Bar); = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Foo` with `#[derive(Debug)]` | -LL | #[derive(Debug)] +LL + #[derive(Debug)] +LL | struct Foo; | error[E0277]: `Bar` doesn't implement `Debug` diff --git a/tests/ui/opt-in-copy.rs b/tests/ui/opt-in-copy.rs index 0b48418e4..d0257b574 100644 --- a/tests/ui/opt-in-copy.rs +++ b/tests/ui/opt-in-copy.rs @@ -5,7 +5,7 @@ struct IWantToCopyThis { } impl Copy for IWantToCopyThis {} -//~^ ERROR the trait `Copy` may not be implemented for this type +//~^ ERROR the trait `Copy` cannot be implemented for this type enum CantCopyThisEither { A, @@ -17,6 +17,6 @@ enum IWantToCopyThisToo { } impl Copy for IWantToCopyThisToo {} -//~^ ERROR the trait `Copy` may not be implemented for this type +//~^ ERROR the trait `Copy` cannot be implemented for this type fn main() {} diff --git a/tests/ui/opt-in-copy.stderr b/tests/ui/opt-in-copy.stderr index 4461567df..258ff16e6 100644 --- a/tests/ui/opt-in-copy.stderr +++ b/tests/ui/opt-in-copy.stderr @@ -1,4 +1,4 @@ -error[E0204]: the trait `Copy` may not be implemented for this type +error[E0204]: the trait `Copy` cannot be implemented for this type --> $DIR/opt-in-copy.rs:7:15 | LL | but_i_cant: CantCopyThis, @@ -7,7 +7,7 @@ LL | but_i_cant: CantCopyThis, LL | impl Copy for IWantToCopyThis {} | ^^^^^^^^^^^^^^^ -error[E0204]: the trait `Copy` may not be implemented for this type +error[E0204]: the trait `Copy` cannot be implemented for this type --> $DIR/opt-in-copy.rs:19:15 | LL | ButICant(CantCopyThisEither), diff --git a/tests/ui/or-patterns/exhaustiveness-non-exhaustive.stderr b/tests/ui/or-patterns/exhaustiveness-non-exhaustive.stderr index 9aa808e6b..9f691aea8 100644 --- a/tests/ui/or-patterns/exhaustiveness-non-exhaustive.stderr +++ b/tests/ui/or-patterns/exhaustiveness-non-exhaustive.stderr @@ -7,7 +7,7 @@ LL | match (0u8, 0u8) { = note: the matched value is of type `(u8, u8)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ (0 | 1, 2 | 3) => {} +LL ~ (0 | 1, 2 | 3) => {}, LL + (2_u8..=u8::MAX, _) => todo!() | @@ -20,7 +20,7 @@ LL | match ((0u8,),) { = note: the matched value is of type `((u8,),)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ ((0 | 1,) | (2 | 3,),) => {} +LL ~ ((0 | 1,) | (2 | 3,),) => {}, LL + ((4_u8..=u8::MAX)) => todo!() | @@ -33,7 +33,7 @@ LL | match (Some(0u8),) { = note: the matched value is of type `(Option,)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ (None | Some(0 | 1),) => {} +LL ~ (None | Some(0 | 1),) => {}, LL + (Some(2_u8..=u8::MAX)) => todo!() | diff --git a/tests/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr b/tests/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr index 4adcf4fee..fdb1a9bb4 100644 --- a/tests/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr +++ b/tests/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr @@ -9,8 +9,8 @@ LL | let (0 | (1 | 2)) = 0; = note: the matched value is of type `i32` help: you might want to use `if let` to ignore the variants that aren't matched | -LL | if let (0 | (1 | 2)) = 0 { todo!() } - | ++ ~~~~~~~~~~~ +LL | if let (0 | (1 | 2)) = 0 { todo!() }; + | ++ +++++++++++ error[E0004]: non-exhaustive patterns: `i32::MIN..=-1_i32` and `3_i32..=i32::MAX` not covered --> $DIR/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs:3:11 @@ -21,7 +21,7 @@ LL | match 0 { = note: the matched value is of type `i32` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ 0 | (1 | 2) => {} +LL ~ 0 | (1 | 2) => {}, LL + i32::MIN..=-1_i32 | 3_i32..=i32::MAX => todo!() | diff --git a/tests/ui/output-type-mismatch.rs b/tests/ui/output-type-mismatch.rs deleted file mode 100644 index 35097aa9e..000000000 --- a/tests/ui/output-type-mismatch.rs +++ /dev/null @@ -1,5 +0,0 @@ -// error-pattern: mismatched types - -fn f() { } - -fn main() { let i: isize; i = f(); } diff --git a/tests/ui/output-type-mismatch.stderr b/tests/ui/output-type-mismatch.stderr deleted file mode 100644 index 4507a4df6..000000000 --- a/tests/ui/output-type-mismatch.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/output-type-mismatch.rs:5:31 - | -LL | fn main() { let i: isize; i = f(); } - | ----- ^^^ expected `isize`, found `()` - | | - | expected due to this type - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/panic-runtime/unwind-tables-target-required.rs b/tests/ui/panic-runtime/unwind-tables-target-required.rs index 3abb52b67..5a90b314a 100644 --- a/tests/ui/panic-runtime/unwind-tables-target-required.rs +++ b/tests/ui/panic-runtime/unwind-tables-target-required.rs @@ -1,10 +1,11 @@ // Tests that the compiler errors if the user tries to turn off unwind tables // when they are required. // -// only-x86_64-windows-msvc +// only-x86_64-pc-windows-msvc // compile-flags: -C force-unwind-tables=no // -// error-pattern: target requires unwind tables, they cannot be disabled with `-C force-unwind-tables=no`. +// dont-check-compiler-stderr +// error-pattern: target requires unwind tables, they cannot be disabled with `-C force-unwind-tables=no` pub fn main() { } diff --git a/tests/ui/parser/assoc-static-semantic-fail.rs b/tests/ui/parser/assoc-static-semantic-fail.rs index a8759d209..403160f12 100644 --- a/tests/ui/parser/assoc-static-semantic-fail.rs +++ b/tests/ui/parser/assoc-static-semantic-fail.rs @@ -31,7 +31,7 @@ trait T { //~| ERROR a static item cannot be `default` pub(crate) default static TD: u8; //~^ ERROR associated `static` items are not allowed - //~| ERROR unnecessary visibility qualifier + //~| ERROR visibility qualifiers are not permitted here //~| ERROR a static item cannot be `default` } @@ -47,6 +47,6 @@ impl T for S { pub default static TD: u8; //~^ ERROR associated `static` items are not allowed //~| ERROR associated constant in `impl` without body - //~| ERROR unnecessary visibility qualifier + //~| ERROR visibility qualifiers are not permitted here //~| ERROR a static item cannot be `default` } diff --git a/tests/ui/parser/assoc-static-semantic-fail.stderr b/tests/ui/parser/assoc-static-semantic-fail.stderr index 8a74f49b9..8178bd223 100644 --- a/tests/ui/parser/assoc-static-semantic-fail.stderr +++ b/tests/ui/parser/assoc-static-semantic-fail.stderr @@ -134,11 +134,13 @@ LL | pub(crate) default static ID: u8; | | | help: provide a definition for the constant: `= ;` -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/assoc-static-semantic-fail.rs:32:5 | LL | pub(crate) default static TD: u8; | ^^^^^^^^^^ + | + = note: trait items always share the visibility of their trait error: associated constant in `impl` without body --> $DIR/assoc-static-semantic-fail.rs:41:5 @@ -156,11 +158,13 @@ LL | pub default static TD: u8; | | | help: provide a definition for the constant: `= ;` -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/assoc-static-semantic-fail.rs:47:5 | LL | pub default static TD: u8; - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/assoc-static-semantic-fail.rs:3:12 diff --git a/tests/ui/parser/attr-stmt-expr-attr-bad.rs b/tests/ui/parser/attr-stmt-expr-attr-bad.rs index 469c3855c..c94a32146 100644 --- a/tests/ui/parser/attr-stmt-expr-attr-bad.rs +++ b/tests/ui/parser/attr-stmt-expr-attr-bad.rs @@ -1,7 +1,5 @@ fn main() {} -#[cfg(FALSE)] fn e() { let _ = box #![attr] 0; } -//~^ ERROR an inner attribute is not permitted in this context #[cfg(FALSE)] fn e() { let _ = [#[attr]]; } //~^ ERROR expected expression, found `]` #[cfg(FALSE)] fn e() { let _ = foo#[attr](); } diff --git a/tests/ui/parser/attr-stmt-expr-attr-bad.stderr b/tests/ui/parser/attr-stmt-expr-attr-bad.stderr index 872c560cb..a857f11fd 100644 --- a/tests/ui/parser/attr-stmt-expr-attr-bad.stderr +++ b/tests/ui/parser/attr-stmt-expr-attr-bad.stderr @@ -1,26 +1,17 @@ -error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:3:36 - | -LL | #[cfg(FALSE)] fn e() { let _ = box #![attr] 0; } - | ^^^^^^^^ - | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files - = note: outer attributes, like `#[test]`, annotate the item following them - error: expected expression, found `]` - --> $DIR/attr-stmt-expr-attr-bad.rs:5:40 + --> $DIR/attr-stmt-expr-attr-bad.rs:3:40 | LL | #[cfg(FALSE)] fn e() { let _ = [#[attr]]; } | ^ expected expression error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:7:35 + --> $DIR/attr-stmt-expr-attr-bad.rs:5:35 | LL | #[cfg(FALSE)] fn e() { let _ = foo#[attr](); } | ^ expected one of 8 possible tokens error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:9:36 + --> $DIR/attr-stmt-expr-attr-bad.rs:7:36 | LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); } | ^^^^^^^^ @@ -29,13 +20,13 @@ LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); } = note: outer attributes, like `#[test]`, annotate the item following them error: expected expression, found `)` - --> $DIR/attr-stmt-expr-attr-bad.rs:9:44 + --> $DIR/attr-stmt-expr-attr-bad.rs:7:44 | LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); } | ^ expected expression error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:12:38 + --> $DIR/attr-stmt-expr-attr-bad.rs:10:38 | LL | #[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); } | ^^^^^^^^ @@ -44,13 +35,13 @@ LL | #[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); } = note: outer attributes, like `#[test]`, annotate the item following them error: expected expression, found `)` - --> $DIR/attr-stmt-expr-attr-bad.rs:12:46 + --> $DIR/attr-stmt-expr-attr-bad.rs:10:46 | LL | #[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); } | ^ expected expression error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:15:36 + --> $DIR/attr-stmt-expr-attr-bad.rs:13:36 | LL | #[cfg(FALSE)] fn e() { let _ = 0 + #![attr] 0; } | ^^^^^^^^ @@ -59,7 +50,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = 0 + #![attr] 0; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:17:33 + --> $DIR/attr-stmt-expr-attr-bad.rs:15:33 | LL | #[cfg(FALSE)] fn e() { let _ = !#![attr] 0; } | ^^^^^^^^ @@ -68,7 +59,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = !#![attr] 0; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:19:33 + --> $DIR/attr-stmt-expr-attr-bad.rs:17:33 | LL | #[cfg(FALSE)] fn e() { let _ = -#![attr] 0; } | ^^^^^^^^ @@ -77,13 +68,13 @@ LL | #[cfg(FALSE)] fn e() { let _ = -#![attr] 0; } = note: outer attributes, like `#[test]`, annotate the item following them error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:21:34 + --> $DIR/attr-stmt-expr-attr-bad.rs:19:34 | LL | #[cfg(FALSE)] fn e() { let _ = x #![attr] as Y; } | ^ expected one of 8 possible tokens error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:23:35 + --> $DIR/attr-stmt-expr-attr-bad.rs:21:35 | LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] foo; } | ^^^^^^^^ @@ -92,7 +83,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] foo; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:25:40 + --> $DIR/attr-stmt-expr-attr-bad.rs:23:40 | LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] foo; } | ^^^^^^^^ @@ -101,7 +92,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] foo; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:27:35 + --> $DIR/attr-stmt-expr-attr-bad.rs:25:35 | LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] {foo}; } | ^^^^^^^^ @@ -110,7 +101,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] {foo}; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:29:40 + --> $DIR/attr-stmt-expr-attr-bad.rs:27:40 | LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] {foo}; } | ^^^^^^^^ @@ -119,19 +110,19 @@ LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] {foo}; } = note: outer attributes, like `#[test]`, annotate the item following them error: expected expression, found `..` - --> $DIR/attr-stmt-expr-attr-bad.rs:31:40 + --> $DIR/attr-stmt-expr-attr-bad.rs:29:40 | LL | #[cfg(FALSE)] fn e() { let _ = #[attr] ..#[attr] 0; } | ^^ expected expression error: expected expression, found `..` - --> $DIR/attr-stmt-expr-attr-bad.rs:33:40 + --> $DIR/attr-stmt-expr-attr-bad.rs:31:40 | LL | #[cfg(FALSE)] fn e() { let _ = #[attr] ..; } | ^^ expected expression error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:35:41 + --> $DIR/attr-stmt-expr-attr-bad.rs:33:41 | LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &#![attr] 0; } | ^^^^^^^^ @@ -140,7 +131,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &#![attr] 0; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:37:45 + --> $DIR/attr-stmt-expr-attr-bad.rs:35:45 | LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &mut #![attr] 0; } | ^^^^^^^^ @@ -149,7 +140,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &mut #![attr] 0; } = note: outer attributes, like `#[test]`, annotate the item following them error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:39:37 + --> $DIR/attr-stmt-expr-attr-bad.rs:37:37 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 #[attr] {}; } | -- ^^^^^^^ -- the attributes are attached to this branch @@ -158,7 +149,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 #[attr] {}; } | the branch belongs to this `if` error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:41:38 + --> $DIR/attr-stmt-expr-attr-bad.rs:39:38 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {#![attr]}; } | ^^^^^^^^ @@ -167,13 +158,13 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {#![attr]}; } = note: outer attributes, like `#[test]`, annotate the item following them error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:43:40 + --> $DIR/attr-stmt-expr-attr-bad.rs:41:40 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} #[attr] else {}; } | ^ expected one of `.`, `;`, `?`, `else`, or an operator error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:45:45 + --> $DIR/attr-stmt-expr-attr-bad.rs:43:45 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] {}; } | ---- ^^^^^^^ -- the attributes are attached to this branch @@ -182,7 +173,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] {}; } | the branch belongs to this `else` error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:47:46 + --> $DIR/attr-stmt-expr-attr-bad.rs:45:46 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else {#![attr]}; } | ^^^^^^^^ @@ -191,7 +182,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else {#![attr]}; } = note: outer attributes, like `#[test]`, annotate the item following them error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:49:45 + --> $DIR/attr-stmt-expr-attr-bad.rs:47:45 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; } | ---- ^^^^^^^ ------- the attributes are attached to this branch @@ -200,7 +191,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; } | the branch belongs to this `else` error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:51:50 + --> $DIR/attr-stmt-expr-attr-bad.rs:49:50 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; } | -- ^^^^^^^ -- the attributes are attached to this branch @@ -209,7 +200,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; } | the branch belongs to this `if` error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:53:51 + --> $DIR/attr-stmt-expr-attr-bad.rs:51:51 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {#![attr]}; } | ^^^^^^^^ @@ -218,7 +209,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {#![attr]}; } = note: outer attributes, like `#[test]`, annotate the item following them error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:55:45 + --> $DIR/attr-stmt-expr-attr-bad.rs:53:45 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 #[attr] {}; } | -- ^^^^^^^ -- the attributes are attached to this branch @@ -227,7 +218,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 #[attr] {}; } | the branch belongs to this `if` error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:57:46 + --> $DIR/attr-stmt-expr-attr-bad.rs:55:46 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {#![attr]}; } | ^^^^^^^^ @@ -236,13 +227,13 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {#![attr]}; } = note: outer attributes, like `#[test]`, annotate the item following them error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:59:48 + --> $DIR/attr-stmt-expr-attr-bad.rs:57:48 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} #[attr] else {}; } | ^ expected one of `.`, `;`, `?`, `else`, or an operator error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:61:53 + --> $DIR/attr-stmt-expr-attr-bad.rs:59:53 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; } | ---- ^^^^^^^ -- the attributes are attached to this branch @@ -251,7 +242,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; } | the branch belongs to this `else` error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:63:54 + --> $DIR/attr-stmt-expr-attr-bad.rs:61:54 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else {#![attr]}; } | ^^^^^^^^ @@ -260,7 +251,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else {#![attr]}; } = note: outer attributes, like `#[test]`, annotate the item following them error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:65:53 + --> $DIR/attr-stmt-expr-attr-bad.rs:63:53 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {}; } | ---- ^^^^^^^ --------------- the attributes are attached to this branch @@ -269,7 +260,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {} | the branch belongs to this `else` error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:67:66 + --> $DIR/attr-stmt-expr-attr-bad.rs:65:66 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {}; } | -- ^^^^^^^ -- the attributes are attached to this branch @@ -278,7 +269,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {} | the branch belongs to this `if` error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:69:67 + --> $DIR/attr-stmt-expr-attr-bad.rs:67:67 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {#![attr]}; } | ^^^^^^^^ @@ -287,7 +278,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {#![attr]} = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted following an outer attribute - --> $DIR/attr-stmt-expr-attr-bad.rs:72:32 + --> $DIR/attr-stmt-expr-attr-bad.rs:70:32 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] let _ = 0; } | ------- ^^^^^^^^ not permitted following an outer attribute @@ -298,7 +289,7 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] let _ = 0; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted following an outer attribute - --> $DIR/attr-stmt-expr-attr-bad.rs:74:32 + --> $DIR/attr-stmt-expr-attr-bad.rs:72:32 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] 0; } | ------- ^^^^^^^^ not permitted following an outer attribute @@ -309,7 +300,7 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] 0; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted following an outer attribute - --> $DIR/attr-stmt-expr-attr-bad.rs:76:32 + --> $DIR/attr-stmt-expr-attr-bad.rs:74:32 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!(); } | ------- ^^^^^^^^ ------- the inner attribute doesn't annotate this item macro invocation @@ -325,7 +316,7 @@ LL + #[cfg(FALSE)] fn s() { #[attr] #[attr] foo!(); } | error: an inner attribute is not permitted following an outer attribute - --> $DIR/attr-stmt-expr-attr-bad.rs:78:32 + --> $DIR/attr-stmt-expr-attr-bad.rs:76:32 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo![]; } | ------- ^^^^^^^^ ------- the inner attribute doesn't annotate this item macro invocation @@ -341,7 +332,7 @@ LL + #[cfg(FALSE)] fn s() { #[attr] #[attr] foo![]; } | error: an inner attribute is not permitted following an outer attribute - --> $DIR/attr-stmt-expr-attr-bad.rs:80:32 + --> $DIR/attr-stmt-expr-attr-bad.rs:78:32 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!{}; } | ------- ^^^^^^^^ ------ the inner attribute doesn't annotate this item macro invocation @@ -357,7 +348,7 @@ LL + #[cfg(FALSE)] fn s() { #[attr] #[attr] foo!{}; } | error[E0586]: inclusive range with no end - --> $DIR/attr-stmt-expr-attr-bad.rs:86:35 + --> $DIR/attr-stmt-expr-attr-bad.rs:84:35 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } } | ^^^ help: use `..` instead @@ -365,13 +356,13 @@ LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } } = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error: expected one of `=>`, `if`, or `|`, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:86:38 + --> $DIR/attr-stmt-expr-attr-bad.rs:84:38 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } } | ^ expected one of `=>`, `if`, or `|` error[E0586]: inclusive range with no end - --> $DIR/attr-stmt-expr-attr-bad.rs:89:35 + --> $DIR/attr-stmt-expr-attr-bad.rs:87:35 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } } | ^^^ help: use `..` instead @@ -379,19 +370,19 @@ LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } } = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error: expected one of `=>`, `if`, or `|`, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:89:38 + --> $DIR/attr-stmt-expr-attr-bad.rs:87:38 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } } | ^ expected one of `=>`, `if`, or `|` error: unexpected token: `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:92:39 + --> $DIR/attr-stmt-expr-attr-bad.rs:90:39 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=-#[attr] 10 => () } } | ^ error[E0586]: inclusive range with no end - --> $DIR/attr-stmt-expr-attr-bad.rs:94:35 + --> $DIR/attr-stmt-expr-attr-bad.rs:92:35 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } } | ^^^ help: use `..` instead @@ -399,47 +390,47 @@ LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } } = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error: expected one of `=>`, `if`, or `|`, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:94:38 + --> $DIR/attr-stmt-expr-attr-bad.rs:92:38 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } } | ^ expected one of `=>`, `if`, or `|` error: unexpected token: `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:98:34 + --> $DIR/attr-stmt-expr-attr-bad.rs:96:34 | LL | #[cfg(FALSE)] fn e() { let _ = x.#![attr]foo(); } | ^ error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:98:34 + --> $DIR/attr-stmt-expr-attr-bad.rs:96:34 | LL | #[cfg(FALSE)] fn e() { let _ = x.#![attr]foo(); } | ^ expected one of `.`, `;`, `?`, `else`, or an operator error: unexpected token: `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:101:34 + --> $DIR/attr-stmt-expr-attr-bad.rs:99:34 | LL | #[cfg(FALSE)] fn e() { let _ = x.#[attr]foo(); } | ^ error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:101:34 + --> $DIR/attr-stmt-expr-attr-bad.rs:99:34 | LL | #[cfg(FALSE)] fn e() { let _ = x.#[attr]foo(); } | ^ expected one of `.`, `;`, `?`, `else`, or an operator error: expected statement after outer attribute - --> $DIR/attr-stmt-expr-attr-bad.rs:106:37 + --> $DIR/attr-stmt-expr-attr-bad.rs:104:37 | LL | #[cfg(FALSE)] fn e() { { fn foo() { #[attr]; } } } | ^^^^^^^ error: expected statement after outer attribute - --> $DIR/attr-stmt-expr-attr-bad.rs:108:37 + --> $DIR/attr-stmt-expr-attr-bad.rs:106:37 | LL | #[cfg(FALSE)] fn e() { { fn foo() { #[attr] } } } | ^^^^^^^ -error: aborting due to 53 previous errors +error: aborting due to 52 previous errors For more information about this error, try `rustc --explain E0586`. diff --git a/tests/ui/parser/circular_modules_main.stderr b/tests/ui/parser/circular_modules_main.stderr index 1094def60..2de707893 100644 --- a/tests/ui/parser/circular_modules_main.stderr +++ b/tests/ui/parser/circular_modules_main.stderr @@ -12,7 +12,7 @@ LL | println!("{}", circular_modules_main::hi_str()); | help: consider importing this function | -LL | use hi_str; +LL + use hi_str; | help: if you import `hi_str`, refer to it directly | diff --git a/tests/ui/parser/default.rs b/tests/ui/parser/default.rs index 52338c1f1..d1058ceb2 100644 --- a/tests/ui/parser/default.rs +++ b/tests/ui/parser/default.rs @@ -14,7 +14,7 @@ impl Foo for u8 { } impl Foo for u16 { - pub default fn foo() -> T { //~ ERROR unnecessary visibility qualifier + pub default fn foo() -> T { //~ ERROR visibility qualifiers are not permitted here T::default() } } diff --git a/tests/ui/parser/default.stderr b/tests/ui/parser/default.stderr index 37aa48ccf..e6330f368 100644 --- a/tests/ui/parser/default.stderr +++ b/tests/ui/parser/default.stderr @@ -17,11 +17,13 @@ LL | default pub fn foo() -> T { T::default() } LL | } | - item list ends here -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/default.rs:17:5 | LL | pub default fn foo() -> T { - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/default.rs:3:12 diff --git a/tests/ui/parser/dyn-trait-compatibility.rs b/tests/ui/parser/dyn-trait-compatibility.rs index d2b02cc2a..6341e0532 100644 --- a/tests/ui/parser/dyn-trait-compatibility.rs +++ b/tests/ui/parser/dyn-trait-compatibility.rs @@ -9,6 +9,6 @@ type A2 = dyn; type A3 = dyn<::dyn>; //~^ ERROR cannot find type `dyn` in this scope //~| ERROR cannot find type `dyn` in this scope -//~| ERROR use of undeclared crate or module `dyn` +//~| ERROR cannot find trait `dyn` in this scope fn main() {} diff --git a/tests/ui/parser/dyn-trait-compatibility.stderr b/tests/ui/parser/dyn-trait-compatibility.stderr index 0cae01bd1..653be5b3b 100644 --- a/tests/ui/parser/dyn-trait-compatibility.stderr +++ b/tests/ui/parser/dyn-trait-compatibility.stderr @@ -4,12 +4,6 @@ error[E0433]: failed to resolve: use of undeclared crate or module `dyn` LL | type A1 = dyn::dyn; | ^^^ use of undeclared crate or module `dyn` -error[E0433]: failed to resolve: use of undeclared crate or module `dyn` - --> $DIR/dyn-trait-compatibility.rs:9:23 - | -LL | type A3 = dyn<::dyn>; - | ^^^ use of undeclared crate or module `dyn` - error[E0412]: cannot find type `dyn` in this scope --> $DIR/dyn-trait-compatibility.rs:1:11 | @@ -40,6 +34,12 @@ error[E0412]: cannot find type `dyn` in this scope LL | type A3 = dyn<::dyn>; | ^^^ not found in this scope +error[E0405]: cannot find trait `dyn` in this scope + --> $DIR/dyn-trait-compatibility.rs:9:23 + | +LL | type A3 = dyn<::dyn>; + | ^^^ not found in this scope + error[E0412]: cannot find type `dyn` in this scope --> $DIR/dyn-trait-compatibility.rs:9:16 | @@ -48,5 +48,5 @@ LL | type A3 = dyn<::dyn>; error: aborting due to 8 previous errors -Some errors have detailed explanations: E0412, E0433. -For more information about an error, try `rustc --explain E0412`. +Some errors have detailed explanations: E0405, E0412, E0433. +For more information about an error, try `rustc --explain E0405`. diff --git a/tests/ui/parser/fn-header-semantic-fail.rs b/tests/ui/parser/fn-header-semantic-fail.rs index cf5d3dab4..71f18a27e 100644 --- a/tests/ui/parser/fn-header-semantic-fail.rs +++ b/tests/ui/parser/fn-header-semantic-fail.rs @@ -11,7 +11,6 @@ fn main() { extern "C" fn ff4() {} // OK. const async unsafe extern "C" fn ff5() {} //~^ ERROR functions cannot be both `const` and `async` - //~| ERROR cycle detected trait X { async fn ft1(); //~ ERROR functions in traits cannot be declared `async` @@ -34,7 +33,6 @@ fn main() { //~^ ERROR functions in traits cannot be declared `async` //~| ERROR functions in traits cannot be declared const //~| ERROR functions cannot be both `const` and `async` - //~| ERROR cycle detected } impl Y { @@ -44,7 +42,6 @@ fn main() { extern "C" fn fi4() {} // OK. const async unsafe extern "C" fn fi5() {} //~^ ERROR functions cannot be both `const` and `async` - //~| ERROR cycle detected } extern "C" { diff --git a/tests/ui/parser/fn-header-semantic-fail.stderr b/tests/ui/parser/fn-header-semantic-fail.stderr index 2d8bd19a7..7f7b7e835 100644 --- a/tests/ui/parser/fn-header-semantic-fail.stderr +++ b/tests/ui/parser/fn-header-semantic-fail.stderr @@ -8,19 +8,19 @@ LL | const async unsafe extern "C" fn ff5() {} | `const` because of this error[E0379]: functions in traits cannot be declared const - --> $DIR/fn-header-semantic-fail.rs:19:9 + --> $DIR/fn-header-semantic-fail.rs:18:9 | LL | const fn ft3(); | ^^^^^ functions in traits cannot be const error[E0379]: functions in traits cannot be declared const - --> $DIR/fn-header-semantic-fail.rs:21:9 + --> $DIR/fn-header-semantic-fail.rs:20:9 | LL | const async unsafe extern "C" fn ft5(); | ^^^^^ functions in traits cannot be const error: functions cannot be both `const` and `async` - --> $DIR/fn-header-semantic-fail.rs:21:9 + --> $DIR/fn-header-semantic-fail.rs:20:9 | LL | const async unsafe extern "C" fn ft5(); | ^^^^^-^^^^^---------------------------- @@ -29,19 +29,19 @@ LL | const async unsafe extern "C" fn ft5(); | `const` because of this error[E0379]: functions in traits cannot be declared const - --> $DIR/fn-header-semantic-fail.rs:31:9 + --> $DIR/fn-header-semantic-fail.rs:30:9 | LL | const fn ft3() {} | ^^^^^ functions in traits cannot be const error[E0379]: functions in traits cannot be declared const - --> $DIR/fn-header-semantic-fail.rs:33:9 + --> $DIR/fn-header-semantic-fail.rs:32:9 | LL | const async unsafe extern "C" fn ft5() {} | ^^^^^ functions in traits cannot be const error: functions cannot be both `const` and `async` - --> $DIR/fn-header-semantic-fail.rs:33:9 + --> $DIR/fn-header-semantic-fail.rs:32:9 | LL | const async unsafe extern "C" fn ft5() {} | ^^^^^-^^^^^------------------------------ @@ -50,7 +50,7 @@ LL | const async unsafe extern "C" fn ft5() {} | `const` because of this error: functions cannot be both `const` and `async` - --> $DIR/fn-header-semantic-fail.rs:45:9 + --> $DIR/fn-header-semantic-fail.rs:43:9 | LL | const async unsafe extern "C" fn fi5() {} | ^^^^^-^^^^^------------------------------ @@ -59,7 +59,7 @@ LL | const async unsafe extern "C" fn fi5() {} | `const` because of this error: functions in `extern` blocks cannot have qualifiers - --> $DIR/fn-header-semantic-fail.rs:51:18 + --> $DIR/fn-header-semantic-fail.rs:48:18 | LL | extern "C" { | ---------- in this `extern` block @@ -72,7 +72,7 @@ LL | fn fe1(); | ~~ error: functions in `extern` blocks cannot have qualifiers - --> $DIR/fn-header-semantic-fail.rs:52:19 + --> $DIR/fn-header-semantic-fail.rs:49:19 | LL | extern "C" { | ---------- in this `extern` block @@ -86,7 +86,7 @@ LL | fn fe2(); | ~~ error: functions in `extern` blocks cannot have qualifiers - --> $DIR/fn-header-semantic-fail.rs:53:18 + --> $DIR/fn-header-semantic-fail.rs:50:18 | LL | extern "C" { | ---------- in this `extern` block @@ -100,7 +100,7 @@ LL | fn fe3(); | ~~ error: functions in `extern` blocks cannot have qualifiers - --> $DIR/fn-header-semantic-fail.rs:54:23 + --> $DIR/fn-header-semantic-fail.rs:51:23 | LL | extern "C" { | ---------- in this `extern` block @@ -114,7 +114,7 @@ LL | fn fe4(); | ~~ error: functions in `extern` blocks cannot have qualifiers - --> $DIR/fn-header-semantic-fail.rs:55:42 + --> $DIR/fn-header-semantic-fail.rs:52:42 | LL | extern "C" { | ---------- in this `extern` block @@ -128,7 +128,7 @@ LL | fn fe5(); | ~~ error: functions cannot be both `const` and `async` - --> $DIR/fn-header-semantic-fail.rs:55:9 + --> $DIR/fn-header-semantic-fail.rs:52:9 | LL | const async unsafe extern "C" fn fe5(); | ^^^^^-^^^^^---------------------------- @@ -137,7 +137,7 @@ LL | const async unsafe extern "C" fn fe5(); | `const` because of this error[E0706]: functions in traits cannot be declared `async` - --> $DIR/fn-header-semantic-fail.rs:17:9 + --> $DIR/fn-header-semantic-fail.rs:16:9 | LL | async fn ft1(); | -----^^^^^^^^^^ @@ -150,7 +150,7 @@ LL | async fn ft1(); = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable error[E0706]: functions in traits cannot be declared `async` - --> $DIR/fn-header-semantic-fail.rs:21:9 + --> $DIR/fn-header-semantic-fail.rs:20:9 | LL | const async unsafe extern "C" fn ft5(); | ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -163,7 +163,7 @@ LL | const async unsafe extern "C" fn ft5(); = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable error[E0706]: functions in traits cannot be declared `async` - --> $DIR/fn-header-semantic-fail.rs:29:9 + --> $DIR/fn-header-semantic-fail.rs:28:9 | LL | async fn ft1() {} | -----^^^^^^^^^ @@ -176,7 +176,7 @@ LL | async fn ft1() {} = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable error[E0706]: functions in traits cannot be declared `async` - --> $DIR/fn-header-semantic-fail.rs:33:9 + --> $DIR/fn-header-semantic-fail.rs:32:9 | LL | const async unsafe extern "C" fn ft5() {} | ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -188,115 +188,7 @@ LL | const async unsafe extern "C" fn ft5() {} = note: see issue #91611 for more information = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable -error[E0391]: cycle detected when computing type of `main::ff5::{opaque#0}` - --> $DIR/fn-header-semantic-fail.rs:12:44 - | -LL | const async unsafe extern "C" fn ff5() {} - | ^ - | -note: ...which requires borrow-checking `main::ff5`... - --> $DIR/fn-header-semantic-fail.rs:12:5 - | -LL | const async unsafe extern "C" fn ff5() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires processing MIR for `main::ff5`... - --> $DIR/fn-header-semantic-fail.rs:12:5 - | -LL | const async unsafe extern "C" fn ff5() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires const checking `main::ff5`... - --> $DIR/fn-header-semantic-fail.rs:12:5 - | -LL | const async unsafe extern "C" fn ff5() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which requires computing whether `main::ff5::{opaque#0}` is freeze... - = note: ...which requires evaluating trait selection obligation `main::ff5::{opaque#0}: core::marker::Freeze`... - = note: ...which again requires computing type of `main::ff5::{opaque#0}`, completing the cycle -note: cycle used when checking item types in top-level module - --> $DIR/fn-header-semantic-fail.rs:5:1 - | -LL | / #![feature(const_extern_fn)] -LL | | -LL | | fn main() { -LL | | async fn ff1() {} // OK. -... | -LL | | } -LL | | } - | |_^ - -error[E0391]: cycle detected when computing type of `main::::ft5::{opaque#0}` - --> $DIR/fn-header-semantic-fail.rs:33:48 - | -LL | const async unsafe extern "C" fn ft5() {} - | ^ - | -note: ...which requires borrow-checking `main::::ft5`... - --> $DIR/fn-header-semantic-fail.rs:33:9 - | -LL | const async unsafe extern "C" fn ft5() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires processing MIR for `main::::ft5`... - --> $DIR/fn-header-semantic-fail.rs:33:9 - | -LL | const async unsafe extern "C" fn ft5() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires const checking `main::::ft5`... - --> $DIR/fn-header-semantic-fail.rs:33:9 - | -LL | const async unsafe extern "C" fn ft5() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which requires computing whether `main::::ft5::{opaque#0}` is freeze... - = note: ...which requires evaluating trait selection obligation `main::::ft5::{opaque#0}: core::marker::Freeze`... - = note: ...which again requires computing type of `main::::ft5::{opaque#0}`, completing the cycle -note: cycle used when checking item types in top-level module - --> $DIR/fn-header-semantic-fail.rs:5:1 - | -LL | / #![feature(const_extern_fn)] -LL | | -LL | | fn main() { -LL | | async fn ff1() {} // OK. -... | -LL | | } -LL | | } - | |_^ - -error[E0391]: cycle detected when computing type of `main::::fi5::{opaque#0}` - --> $DIR/fn-header-semantic-fail.rs:45:48 - | -LL | const async unsafe extern "C" fn fi5() {} - | ^ - | -note: ...which requires borrow-checking `main::::fi5`... - --> $DIR/fn-header-semantic-fail.rs:45:9 - | -LL | const async unsafe extern "C" fn fi5() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires processing MIR for `main::::fi5`... - --> $DIR/fn-header-semantic-fail.rs:45:9 - | -LL | const async unsafe extern "C" fn fi5() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires const checking `main::::fi5`... - --> $DIR/fn-header-semantic-fail.rs:45:9 - | -LL | const async unsafe extern "C" fn fi5() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which requires computing whether `main::::fi5::{opaque#0}` is freeze... - = note: ...which requires evaluating trait selection obligation `main::::fi5::{opaque#0}: core::marker::Freeze`... - = note: ...which again requires computing type of `main::::fi5::{opaque#0}`, completing the cycle -note: cycle used when checking item types in top-level module - --> $DIR/fn-header-semantic-fail.rs:5:1 - | -LL | / #![feature(const_extern_fn)] -LL | | -LL | | fn main() { -LL | | async fn ff1() {} // OK. -... | -LL | | } -LL | | } - | |_^ - -error: aborting due to 21 previous errors +error: aborting due to 18 previous errors -Some errors have detailed explanations: E0379, E0391, E0706. +Some errors have detailed explanations: E0379, E0706. For more information about an error, try `rustc --explain E0379`. diff --git a/tests/ui/parser/ident-recovery.rs b/tests/ui/parser/ident-recovery.rs new file mode 100644 index 000000000..7575372b9 --- /dev/null +++ b/tests/ui/parser/ident-recovery.rs @@ -0,0 +1,16 @@ +fn ,comma() { + //~^ ERROR expected identifier, found `,` + struct Foo { + x: i32,, + //~^ ERROR expected identifier, found `,` + y: u32, + } +} + +fn break() { +//~^ ERROR expected identifier, found keyword `break` + let continue = 5; + //~^ ERROR expected identifier, found keyword `continue` +} + +fn main() {} diff --git a/tests/ui/parser/ident-recovery.stderr b/tests/ui/parser/ident-recovery.stderr new file mode 100644 index 000000000..e9a55026d --- /dev/null +++ b/tests/ui/parser/ident-recovery.stderr @@ -0,0 +1,42 @@ +error: expected identifier, found `,` + --> $DIR/ident-recovery.rs:1:4 + | +LL | fn ,comma() { + | ^ + | | + | expected identifier + | help: remove this comma + +error: expected identifier, found `,` + --> $DIR/ident-recovery.rs:4:16 + | +LL | x: i32,, + | ^ + | | + | expected identifier + | help: remove this comma + +error: expected identifier, found keyword `break` + --> $DIR/ident-recovery.rs:10:4 + | +LL | fn break() { + | ^^^^^ expected identifier, found keyword + | +help: escape `break` to use it as an identifier + | +LL | fn r#break() { + | ++ + +error: expected identifier, found keyword `continue` + --> $DIR/ident-recovery.rs:12:9 + | +LL | let continue = 5; + | ^^^^^^^^ expected identifier, found keyword + | +help: escape `continue` to use it as an identifier + | +LL | let r#continue = 5; + | ++ + +error: aborting due to 4 previous errors + diff --git a/tests/ui/parser/integer-literal-start-ident.rs b/tests/ui/parser/integer-literal-start-ident.rs new file mode 100644 index 000000000..12537482e --- /dev/null +++ b/tests/ui/parser/integer-literal-start-ident.rs @@ -0,0 +1,2 @@ +fn 1main() {} +//~^ ERROR expected identifier, found `1main` diff --git a/tests/ui/parser/integer-literal-start-ident.stderr b/tests/ui/parser/integer-literal-start-ident.stderr new file mode 100644 index 000000000..b2c661296 --- /dev/null +++ b/tests/ui/parser/integer-literal-start-ident.stderr @@ -0,0 +1,14 @@ +error: expected identifier, found `1main` + --> $DIR/integer-literal-start-ident.rs:1:4 + | +LL | fn 1main() {} + | ^^^^^ expected identifier + | +help: identifiers cannot start with a number + --> $DIR/integer-literal-start-ident.rs:1:4 + | +LL | fn 1main() {} + | ^ + +error: aborting due to previous error + diff --git a/tests/ui/parser/issues/issue-104088.rs b/tests/ui/parser/issues/issue-104088.rs index 5f794fe2d..3dc636b6a 100644 --- a/tests/ui/parser/issues/issue-104088.rs +++ b/tests/ui/parser/issues/issue-104088.rs @@ -1,26 +1,19 @@ -fn test() { +fn 1234test() { +//~^ ERROR expected identifier, found `1234test` if let 123 = 123 { println!("yes"); } -} - -fn test_2() { - let 1x = 123; - //~^ ERROR expected identifier, found number literal -} - -fn test_3() { - let 2x: i32 = 123; - //~^ ERROR expected identifier, found number literal -} -fn test_4() { if let 2e1 = 123 { //~^ ERROR mismatched types } -} -fn test_5() { let 23name = 123; - //~^ ERROR expected identifier, found number literal + //~^ ERROR expected identifier, found `23name` + + let 2x: i32 = 123; + //~^ ERROR expected identifier, found `2x` + + let 1x = 123; + //~^ ERROR expected identifier, found `1x` } fn main() {} diff --git a/tests/ui/parser/issues/issue-104088.stderr b/tests/ui/parser/issues/issue-104088.stderr index ff4b4bdb6..8b751759d 100644 --- a/tests/ui/parser/issues/issue-104088.stderr +++ b/tests/ui/parser/issues/issue-104088.stderr @@ -1,29 +1,59 @@ -error: expected identifier, found number literal - --> $DIR/issue-104088.rs:6:9 +error: expected identifier, found `1234test` + --> $DIR/issue-104088.rs:1:4 | -LL | let 1x = 123; - | ^^ identifiers cannot start with a number +LL | fn 1234test() { + | ^^^^^^^^ expected identifier + | +help: identifiers cannot start with a number + --> $DIR/issue-104088.rs:1:4 + | +LL | fn 1234test() { + | ^^^^ + +error: expected identifier, found `23name` + --> $DIR/issue-104088.rs:9:9 + | +LL | let 23name = 123; + | ^^^^^^ expected identifier + | +help: identifiers cannot start with a number + --> $DIR/issue-104088.rs:9:9 + | +LL | let 23name = 123; + | ^^ -error: expected identifier, found number literal - --> $DIR/issue-104088.rs:11:9 +error: expected identifier, found `2x` + --> $DIR/issue-104088.rs:12:9 | LL | let 2x: i32 = 123; - | ^^ identifiers cannot start with a number + | ^^ expected identifier + | +help: identifiers cannot start with a number + --> $DIR/issue-104088.rs:12:9 + | +LL | let 2x: i32 = 123; + | ^ -error: expected identifier, found number literal - --> $DIR/issue-104088.rs:22:9 +error: expected identifier, found `1x` + --> $DIR/issue-104088.rs:15:9 | -LL | let 23name = 123; - | ^^^^^^ identifiers cannot start with a number +LL | let 1x = 123; + | ^^ expected identifier + | +help: identifiers cannot start with a number + --> $DIR/issue-104088.rs:15:9 + | +LL | let 1x = 123; + | ^ error[E0308]: mismatched types - --> $DIR/issue-104088.rs:16:12 + --> $DIR/issue-104088.rs:5:12 | LL | if let 2e1 = 123 { | ^^^ --- this expression has type `{integer}` | | | expected integer, found floating-point number -error: aborting due to 4 previous errors +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/parser/issues/issue-108242-semicolon-recovery.rs b/tests/ui/parser/issues/issue-108242-semicolon-recovery.rs new file mode 100644 index 000000000..2fc0b2947 --- /dev/null +++ b/tests/ui/parser/issues/issue-108242-semicolon-recovery.rs @@ -0,0 +1,5 @@ +fn foo() {} +fn main() { + foo(; + foo(; +} //~ ERROR mismatched closing delimiter diff --git a/tests/ui/parser/issues/issue-108242-semicolon-recovery.stderr b/tests/ui/parser/issues/issue-108242-semicolon-recovery.stderr new file mode 100644 index 000000000..f68d6d501 --- /dev/null +++ b/tests/ui/parser/issues/issue-108242-semicolon-recovery.stderr @@ -0,0 +1,13 @@ +error: mismatched closing delimiter: `}` + --> $DIR/issue-108242-semicolon-recovery.rs:4:8 + | +LL | fn main() { + | - closing delimiter possibly meant for this +LL | foo(; +LL | foo(; + | ^ unclosed delimiter +LL | } + | ^ mismatched closing delimiter + +error: aborting due to previous error + diff --git a/tests/ui/parser/issues/issue-110014.rs b/tests/ui/parser/issues/issue-110014.rs new file mode 100644 index 000000000..69d8f402b --- /dev/null +++ b/tests/ui/parser/issues/issue-110014.rs @@ -0,0 +1,3 @@ +fn`2222222222222222222222222222222222222222() {} +//~^ ERROR unknown start of token: ` +//~^^ ERROR expected identifier, found `2222222222222222222222222222222222222222` diff --git a/tests/ui/parser/issues/issue-110014.stderr b/tests/ui/parser/issues/issue-110014.stderr new file mode 100644 index 000000000..7f1dd592e --- /dev/null +++ b/tests/ui/parser/issues/issue-110014.stderr @@ -0,0 +1,19 @@ +error: unknown start of token: ` + --> $DIR/issue-110014.rs:1:3 + | +LL | fn`2222222222222222222222222222222222222222() {} + | ^ + | +help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not + | +LL | fn'2222222222222222222222222222222222222222() {} + | ~ + +error: expected identifier, found `2222222222222222222222222222222222222222` + --> $DIR/issue-110014.rs:1:4 + | +LL | fn`2222222222222222222222222222222222222222() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected identifier + +error: aborting due to 2 previous errors + diff --git a/tests/ui/parser/issues/issue-48508.rs b/tests/ui/parser/issues/issue-48508.rs index 37d04c5d6..1e7db9df8 100644 --- a/tests/ui/parser/issues/issue-48508.rs +++ b/tests/ui/parser/issues/issue-48508.rs @@ -7,7 +7,6 @@ // issue-48508-aux.rs // compile-flags:-g -// ignore-pretty issue #37195 // ignore-asmjs wasm2js does not support source maps yet #![allow(uncommon_codepoints)] diff --git a/tests/ui/parser/issues/issue-65846-rollback-gating-failing-matcher.rs b/tests/ui/parser/issues/issue-65846-rollback-gating-failing-matcher.rs index 76c07bbfd..b0e8f4d99 100644 --- a/tests/ui/parser/issues/issue-65846-rollback-gating-failing-matcher.rs +++ b/tests/ui/parser/issues/issue-65846-rollback-gating-failing-matcher.rs @@ -5,11 +5,17 @@ #[allow(unused_macro_rules)] macro_rules! m { - ($e:expr) => { 0 }; // This fails on the input below due to `, foo`. - ($e:expr,) => { 1 }; // This also fails to match due to `foo`. - (box $e:expr, foo) => { 2 }; // Successful matcher, we should get `2`. + ($e:expr) => { + 0 + }; // This fails on the input below due to `, foo`. + ($e:expr,) => { + 1 + }; // This also fails to match due to `foo`. + (do yeet $e:expr, foo) => { + 2 + }; // Successful matcher, we should get `2`. } fn main() { - assert_eq!(2, m!(box 42, foo)); + assert_eq!(2, m!(do yeet 42, foo)); } diff --git a/tests/ui/parser/removed-syntax-box.fixed b/tests/ui/parser/removed-syntax-box.fixed new file mode 100644 index 000000000..09d1304b7 --- /dev/null +++ b/tests/ui/parser/removed-syntax-box.fixed @@ -0,0 +1,14 @@ +// run-rustfix + +fn main() { + #[allow(dead_code)] + struct T { + a: u8, + b: u8, + } + let _ = Box::new(()); //~ ERROR `box_syntax` has been removed + let _ = Box::new(1); //~ ERROR `box_syntax` has been removed + let _ = Box::new(T { a: 12, b: 18 }); //~ ERROR `box_syntax` has been removed + let _ = Box::new([5; 30]); //~ ERROR `box_syntax` has been removed + let _: Box<()> = Box::new(()); //~ ERROR `box_syntax` has been removed +} diff --git a/tests/ui/parser/removed-syntax-box.rs b/tests/ui/parser/removed-syntax-box.rs new file mode 100644 index 000000000..1f5061b02 --- /dev/null +++ b/tests/ui/parser/removed-syntax-box.rs @@ -0,0 +1,14 @@ +// run-rustfix + +fn main() { + #[allow(dead_code)] + struct T { + a: u8, + b: u8, + } + let _ = box (); //~ ERROR `box_syntax` has been removed + let _ = box 1; //~ ERROR `box_syntax` has been removed + let _ = box T { a: 12, b: 18 }; //~ ERROR `box_syntax` has been removed + let _ = box [5; 30]; //~ ERROR `box_syntax` has been removed + let _: Box<()> = box (); //~ ERROR `box_syntax` has been removed +} diff --git a/tests/ui/parser/removed-syntax-box.stderr b/tests/ui/parser/removed-syntax-box.stderr new file mode 100644 index 000000000..46b891587 --- /dev/null +++ b/tests/ui/parser/removed-syntax-box.stderr @@ -0,0 +1,57 @@ +error: `box_syntax` has been removed + --> $DIR/removed-syntax-box.rs:9:13 + | +LL | let _ = box (); + | ^^^^^^ + | +help: use `Box::new()` instead + | +LL | let _ = Box::new(()); + | ~~~~~~~~~~~~ + +error: `box_syntax` has been removed + --> $DIR/removed-syntax-box.rs:10:13 + | +LL | let _ = box 1; + | ^^^^^ + | +help: use `Box::new()` instead + | +LL | let _ = Box::new(1); + | ~~~~~~~~~~~ + +error: `box_syntax` has been removed + --> $DIR/removed-syntax-box.rs:11:13 + | +LL | let _ = box T { a: 12, b: 18 }; + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `Box::new()` instead + | +LL | let _ = Box::new(T { a: 12, b: 18 }); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +error: `box_syntax` has been removed + --> $DIR/removed-syntax-box.rs:12:13 + | +LL | let _ = box [5; 30]; + | ^^^^^^^^^^^ + | +help: use `Box::new()` instead + | +LL | let _ = Box::new([5; 30]); + | ~~~~~~~~~~~~~~~~~ + +error: `box_syntax` has been removed + --> $DIR/removed-syntax-box.rs:13:22 + | +LL | let _: Box<()> = box (); + | ^^^^^^ + | +help: use `Box::new()` instead + | +LL | let _: Box<()> = Box::new(()); + | ~~~~~~~~~~~~ + +error: aborting due to 5 previous errors + diff --git a/tests/ui/parser/trait-pub-assoc-const.rs b/tests/ui/parser/trait-pub-assoc-const.rs index 219ffa309..7953e12ec 100644 --- a/tests/ui/parser/trait-pub-assoc-const.rs +++ b/tests/ui/parser/trait-pub-assoc-const.rs @@ -1,6 +1,6 @@ trait Foo { pub const Foo: u32; - //~^ ERROR unnecessary visibility qualifier + //~^ ERROR visibility qualifiers are not permitted here } fn main() {} diff --git a/tests/ui/parser/trait-pub-assoc-const.stderr b/tests/ui/parser/trait-pub-assoc-const.stderr index efd09a036..c14a2f2ee 100644 --- a/tests/ui/parser/trait-pub-assoc-const.stderr +++ b/tests/ui/parser/trait-pub-assoc-const.stderr @@ -1,8 +1,10 @@ -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/trait-pub-assoc-const.rs:2:5 | LL | pub const Foo: u32; - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait error: aborting due to previous error diff --git a/tests/ui/parser/trait-pub-assoc-ty.rs b/tests/ui/parser/trait-pub-assoc-ty.rs index a78dfbdcd..5d9434edc 100644 --- a/tests/ui/parser/trait-pub-assoc-ty.rs +++ b/tests/ui/parser/trait-pub-assoc-ty.rs @@ -1,6 +1,6 @@ trait Foo { pub type Foo; - //~^ ERROR unnecessary visibility qualifier + //~^ ERROR visibility qualifiers are not permitted here } fn main() {} diff --git a/tests/ui/parser/trait-pub-assoc-ty.stderr b/tests/ui/parser/trait-pub-assoc-ty.stderr index e76373f5c..7f6e7350c 100644 --- a/tests/ui/parser/trait-pub-assoc-ty.stderr +++ b/tests/ui/parser/trait-pub-assoc-ty.stderr @@ -1,8 +1,10 @@ -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/trait-pub-assoc-ty.rs:2:5 | LL | pub type Foo; - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait error: aborting due to previous error diff --git a/tests/ui/parser/trait-pub-method.rs b/tests/ui/parser/trait-pub-method.rs index 1f6ee028a..c8f33e782 100644 --- a/tests/ui/parser/trait-pub-method.rs +++ b/tests/ui/parser/trait-pub-method.rs @@ -1,6 +1,6 @@ trait Foo { pub fn foo(); - //~^ ERROR unnecessary visibility qualifier + //~^ ERROR visibility qualifiers are not permitted here } fn main() {} diff --git a/tests/ui/parser/trait-pub-method.stderr b/tests/ui/parser/trait-pub-method.stderr index 0e3fe027c..2bf1d468a 100644 --- a/tests/ui/parser/trait-pub-method.stderr +++ b/tests/ui/parser/trait-pub-method.stderr @@ -1,8 +1,10 @@ -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/trait-pub-method.rs:2:5 | LL | pub fn foo(); - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait error: aborting due to previous error diff --git a/tests/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr b/tests/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr index 29cd6c45c..25838fbf0 100644 --- a/tests/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr +++ b/tests/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr @@ -2,18 +2,16 @@ error: cannot move out of value because it is borrowed --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:12:14 | LL | Some(ref _y @ _z) => {} - | ------^^^-- - | | | - | | value is moved into `_z` here + | ^^^^^^ -- value is moved into `_z` here + | | | value is borrowed by `_y` here error: borrow of moved value --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:19:14 | LL | Some(_z @ ref _y) => {} - | --^^^------ - | | | - | | value borrowed here after move + | ^^ ------ value borrowed here after move + | | | value moved into `_z` here | move occurs because `_z` has type `X` which does not implement the `Copy` trait | @@ -26,18 +24,16 @@ error: cannot move out of value because it is borrowed --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:26:14 | LL | Some(ref mut _y @ _z) => {} - | ----------^^^-- - | | | - | | value is moved into `_z` here + | ^^^^^^^^^^ -- value is moved into `_z` here + | | | value is mutably borrowed by `_y` here error: borrow of moved value --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:33:14 | LL | Some(_z @ ref mut _y) => {} - | --^^^---------- - | | | - | | value borrowed here after move + | ^^ ---------- value borrowed here after move + | | | value moved into `_z` here | move occurs because `_z` has type `X` which does not implement the `Copy` trait | diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr b/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr index 2c123b01e..9305facc4 100644 --- a/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr +++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr @@ -2,72 +2,64 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-at-and-box.rs:31:9 | LL | let ref a @ box b = Box::new(NC); - | -----^^^^^^^- - | | | - | | value is moved into `b` here + | ^^^^^ - value is moved into `b` here + | | | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-at-and-box.rs:34:9 | LL | let ref a @ box ref mut b = Box::new(nc()); - | -----^^^^^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-at-and-box.rs:36:9 | LL | let ref a @ box ref mut b = Box::new(NC); - | -----^^^^^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-at-and-box.rs:38:9 | LL | let ref a @ box ref mut b = Box::new(NC); - | -----^^^^^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-at-and-box.rs:42:9 | LL | let ref a @ box ref mut b = Box::new(NC); - | -----^^^^^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-at-and-box.rs:48:9 | LL | let ref mut a @ box ref b = Box::new(NC); - | ---------^^^^^^^----- - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-at-and-box.rs:62:9 | LL | ref mut a @ box ref b => { - | ---------^^^^^^^----- - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-at-and-box.rs:54:11 | LL | fn f5(ref mut a @ box ref b: Box) { - | ---------^^^^^^^----- - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error[E0382]: borrow of moved value diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse-promotion.stderr b/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse-promotion.stderr index d6474f1b4..c440f4619 100644 --- a/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse-promotion.stderr +++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse-promotion.stderr @@ -2,9 +2,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse-promotion.rs:6:9 | LL | let a @ ref b = U; - | -^^^----- - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `a` here | move occurs because `a` has type `U` which does not implement the `Copy` trait | diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr b/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr index 389e86e64..13989ebad 100644 --- a/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr +++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr @@ -2,9 +2,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:22:9 | LL | let a @ ref b = U; - | -^^^----- - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `a` here | move occurs because `a` has type `U` which does not implement the `Copy` trait | @@ -17,9 +16,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:24:9 | LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U); - | -^^^^^^^^^^^^---------^^^^^^-----^ - | | | | - | | | value borrowed here after move + | ^ --------- ----- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait @@ -33,9 +31,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:24:14 | LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U); - | -----^^^--------- - | | | - | | value borrowed here after move + | ^^^^^ --------- value borrowed here after move + | | | value moved into `b` here | move occurs because `b` has type `U` which does not implement the `Copy` trait | @@ -48,9 +45,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:24:33 | LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U); - | -^^^----- - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `d` here | move occurs because `d` has type `U` which does not implement the `Copy` trait | @@ -63,9 +59,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:29:9 | LL | let a @ [ref mut b, ref c] = [U, U]; - | -^^^^---------^^-----^ - | | | | - | | | value borrowed here after move + | ^ --------- ----- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `[U; 2]` which does not implement the `Copy` trait @@ -79,9 +74,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:31:9 | LL | let a @ ref b = u(); - | -^^^----- - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `a` here | move occurs because `a` has type `U` which does not implement the `Copy` trait | @@ -94,9 +88,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:33:9 | LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u()); - | -^^^^^^^^^^^^---------^^^^^^-----^ - | | | | - | | | value borrowed here after move + | ^ --------- ----- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait @@ -110,9 +103,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:33:14 | LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u()); - | -----^^^--------- - | | | - | | value borrowed here after move + | ^^^^^ --------- value borrowed here after move + | | | value moved into `b` here | move occurs because `b` has type `U` which does not implement the `Copy` trait | @@ -125,9 +117,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:33:33 | LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u()); - | -^^^----- - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `d` here | move occurs because `d` has type `U` which does not implement the `Copy` trait | @@ -140,9 +131,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:38:9 | LL | let a @ [ref mut b, ref c] = [u(), u()]; - | -^^^^---------^^-----^ - | | | | - | | | value borrowed here after move + | ^ --------- ----- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `[U; 2]` which does not implement the `Copy` trait @@ -156,9 +146,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:42:9 | LL | a @ Some(ref b) => {} - | -^^^^^^^^-----^ - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `a` here | move occurs because `a` has type `Option` which does not implement the `Copy` trait | @@ -171,9 +160,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:47:9 | LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} - | -^^^^^^^^^^^^^^^^^---------^^^^^^-----^^ - | | | | - | | | value borrowed here after move + | ^ --------- ----- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `Option<(U, U)>` which does not implement the `Copy` trait @@ -187,9 +175,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:47:19 | LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} - | -----^^^--------- - | | | - | | value borrowed here after move + | ^^^^^ --------- value borrowed here after move + | | | value moved into `b` here | move occurs because `b` has type `U` which does not implement the `Copy` trait | @@ -202,9 +189,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:47:38 | LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} - | -^^^----- - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `d` here | move occurs because `d` has type `U` which does not implement the `Copy` trait | @@ -217,9 +203,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:55:9 | LL | mut a @ Some([ref b, ref mut c]) => {} - | -----^^^^^^^^^-----^^---------^^ - | | | | - | | | value borrowed here after move + | ^^^^^ ----- --------- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `Option<[U; 2]>` which does not implement the `Copy` trait @@ -233,9 +218,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:61:9 | LL | a @ Some(ref b) => {} - | -^^^^^^^^-----^ - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `a` here | move occurs because `a` has type `Option` which does not implement the `Copy` trait | @@ -248,9 +232,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:67:9 | LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} - | -^^^^^^^^^^^^^^^^^---------^^^^^^-----^^ - | | | | - | | | value borrowed here after move + | ^ --------- ----- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `Option<(U, U)>` which does not implement the `Copy` trait @@ -264,9 +247,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:67:19 | LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} - | -----^^^--------- - | | | - | | value borrowed here after move + | ^^^^^ --------- value borrowed here after move + | | | value moved into `b` here | move occurs because `b` has type `U` which does not implement the `Copy` trait | @@ -279,9 +261,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:67:38 | LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} - | -^^^----- - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `d` here | move occurs because `d` has type `U` which does not implement the `Copy` trait | @@ -294,9 +275,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:75:9 | LL | mut a @ Some([ref b, ref mut c]) => {} - | -----^^^^^^^^^-----^^---------^^ - | | | | - | | | value borrowed here after move + | ^^^^^ ----- --------- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `Option<[U; 2]>` which does not implement the `Copy` trait @@ -310,9 +290,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:11:11 | LL | fn f1(a @ ref b: U) {} - | -^^^----- - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `a` here | move occurs because `a` has type `U` which does not implement the `Copy` trait | @@ -325,9 +304,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:14:11 | LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {} - | -----^^^^^^^^-----^^^^^^^^^^-----^ - | | | | - | | | value borrowed here after move + | ^^^^^ ----- ----- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait @@ -341,9 +319,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:14:20 | LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {} - | -^^^----- - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `b` here | move occurs because `b` has type `U` which does not implement the `Copy` trait | @@ -356,9 +333,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:14:31 | LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {} - | -----^^^----- - | | | - | | value borrowed here after move + | ^^^^^ ----- value borrowed here after move + | | | value moved into `d` here | move occurs because `d` has type `U` which does not implement the `Copy` trait | @@ -371,9 +347,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:19:11 | LL | fn f3(a @ [ref mut b, ref c]: [U; 2]) {} - | -^^^^---------^^-----^ - | | | | - | | | value borrowed here after move + | ^ --------- ----- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `[U; 2]` which does not implement the `Copy` trait diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr b/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr index 4f7fbc9e0..00593b2a9 100644 --- a/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr +++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr @@ -2,18 +2,16 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:24:9 | LL | let ref a @ b = U; - | -----^^^- - | | | - | | value is moved into `b` here + | ^^^^^ - value is moved into `b` here + | | | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:26:9 | LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U); - | -----^^^^^^^^^^^^-----^^^^^^^^^^-^ - | | | | - | | | value is moved into `e` here + | ^^^^^ ----- - value is moved into `e` here + | | | | | value is moved into `c` here | value is borrowed by `a` here @@ -21,27 +19,24 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:26:18 | LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U); - | -----^^^----- - | | | - | | value is moved into `c` here + | ^^^^^ ----- value is moved into `c` here + | | | value is borrowed by `b` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:26:33 | LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U); - | -----^^^- - | | | - | | value is moved into `e` here + | ^^^^^ - value is moved into `e` here + | | | value is borrowed by `d` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:30:9 | LL | let ref mut a @ [b, mut c] = [U, U]; - | ---------^^^^-^^-----^ - | | | | - | | | value is moved into `c` here + | ^^^^^^^^^ - ----- value is moved into `c` here + | | | | | value is moved into `b` here | value is mutably borrowed by `a` here @@ -49,18 +44,16 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:33:9 | LL | let ref a @ b = u(); - | -----^^^- - | | | - | | value is moved into `b` here + | ^^^^^ - value is moved into `b` here + | | | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:36:9 | LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u()); - | -----^^^^^^^^^^^^-----^^^^^^^^^^-^ - | | | | - | | | value is moved into `e` here + | ^^^^^ ----- - value is moved into `e` here + | | | | | value is moved into `c` here | value is borrowed by `a` here @@ -68,27 +61,24 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:36:18 | LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u()); - | -----^^^----- - | | | - | | value is moved into `c` here + | ^^^^^ ----- value is moved into `c` here + | | | value is borrowed by `b` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:36:33 | LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u()); - | -----^^^- - | | | - | | value is moved into `e` here + | ^^^^^ - value is moved into `e` here + | | | value is borrowed by `d` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:42:9 | LL | let ref mut a @ [b, mut c] = [u(), u()]; - | ---------^^^^-^^-----^ - | | | | - | | | value is moved into `c` here + | ^^^^^^^^^ - ----- value is moved into `c` here + | | | | | value is moved into `b` here | value is mutably borrowed by `a` here @@ -96,18 +86,16 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:47:9 | LL | ref a @ Some(b) => {} - | -----^^^^^^^^-^ - | | | - | | value is moved into `b` here + | ^^^^^ - value is moved into `b` here + | | | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:52:9 | LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} - | -----^^^^^^^^^^^^^^^^^-----^^^^^^^^^^-^^ - | | | | - | | | value is moved into `e` here + | ^^^^^ ----- - value is moved into `e` here + | | | | | value is moved into `c` here | value is borrowed by `a` here @@ -115,27 +103,24 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:52:23 | LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} - | -----^^^----- - | | | - | | value is moved into `c` here + | ^^^^^ ----- value is moved into `c` here + | | | value is borrowed by `b` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:52:38 | LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} - | -----^^^- - | | | - | | value is moved into `e` here + | ^^^^^ - value is moved into `e` here + | | | value is borrowed by `d` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:59:9 | LL | ref mut a @ Some([b, mut c]) => {} - | ---------^^^^^^^^^-^^-----^^ - | | | | - | | | value is moved into `c` here + | ^^^^^^^^^ - ----- value is moved into `c` here + | | | | | value is moved into `b` here | value is mutably borrowed by `a` here @@ -143,18 +128,16 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:64:9 | LL | ref a @ Some(b) => {} - | -----^^^^^^^^-^ - | | | - | | value is moved into `b` here + | ^^^^^ - value is moved into `b` here + | | | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:69:9 | LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} - | -----^^^^^^^^^^^^^^^^^-----^^^^^^^^^^-^^ - | | | | - | | | value is moved into `e` here + | ^^^^^ ----- - value is moved into `e` here + | | | | | value is moved into `c` here | value is borrowed by `a` here @@ -162,27 +145,24 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:69:23 | LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} - | -----^^^----- - | | | - | | value is moved into `c` here + | ^^^^^ ----- value is moved into `c` here + | | | value is borrowed by `b` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:69:38 | LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} - | -----^^^- - | | | - | | value is moved into `e` here + | ^^^^^ - value is moved into `e` here + | | | value is borrowed by `d` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:78:9 | LL | ref mut a @ Some([b, mut c]) => {} - | ---------^^^^^^^^^-^^-----^^ - | | | | - | | | value is moved into `c` here + | ^^^^^^^^^ - ----- value is moved into `c` here + | | | | | value is moved into `b` here | value is mutably borrowed by `a` here @@ -190,18 +170,16 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:11:11 | LL | fn f1(ref a @ b: U) {} - | -----^^^- - | | | - | | value is moved into `b` here + | ^^^^^ - value is moved into `b` here + | | | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:14:11 | LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {} - | -----^^^^^^^^^^^^-----^^^^^^^^^^-^ - | | | | - | | | value is moved into `e` here + | ^^^^^ ----- - value is moved into `e` here + | | | | | value is moved into `c` here | value is borrowed by `a` here @@ -209,27 +187,24 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:14:20 | LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {} - | -----^^^----- - | | | - | | value is moved into `c` here + | ^^^^^ ----- value is moved into `c` here + | | | value is borrowed by `b` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:14:35 | LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {} - | -----^^^- - | | | - | | value is moved into `e` here + | ^^^^^ - value is moved into `e` here + | | | value is borrowed by `d` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:20:11 | LL | fn f3(ref mut a @ [b, mut c]: [U; 2]) {} - | ---------^^^^-^^-----^ - | | | | - | | | value is moved into `c` here + | ^^^^^^^^^ - ----- value is moved into `c` here + | | | | | value is moved into `b` here | value is mutably borrowed by `a` here diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr b/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr index f51b50418..d6409d1b6 100644 --- a/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr +++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr @@ -2,18 +2,16 @@ error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:8:9 | LL | ref mut z @ &mut Some(ref a) => { - | ---------^^^^^^^^^^^^^-----^ - | | | - | | value is borrowed by `a` here + | ^^^^^^^^^ ----- value is borrowed by `a` here + | | | value is mutably borrowed by `z` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-and-ref.rs:33:9 | LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub - | ---------^^^^-----------------^ - | | | | - | | | value is mutably borrowed by `c` here + | ^^^^^^^^^ ----- --------- value is mutably borrowed by `c` here + | | | | | value is borrowed by `b` here | value is mutably borrowed by `a` here @@ -21,36 +19,32 @@ error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:33:22 | LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub - | -----^^^--------- - | | | - | | value is mutably borrowed by `c` here + | ^^^^^ --------- value is mutably borrowed by `c` here + | | | value is borrowed by `b` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:37:9 | LL | let ref a @ ref mut b = U; - | -----^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:39:9 | LL | let ref mut a @ ref b = U; - | ---------^^^----- - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:41:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); - | -----^^^^---------^^---------^ - | | | | - | | | value is mutably borrowed by `c` here + | ^^^^^ --------- --------- value is mutably borrowed by `c` here + | | | | | value is mutably borrowed by `b` here | value is borrowed by `a` here @@ -58,9 +52,8 @@ error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:43:9 | LL | let ref mut a @ (ref b, ref c) = (U, U); - | ---------^^^^-----^^-----^ - | | | | - | | | value is borrowed by `c` here + | ^^^^^^^^^ ----- ----- value is borrowed by `c` here + | | | | | value is borrowed by `b` here | value is mutably borrowed by `a` here @@ -68,153 +61,136 @@ error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:46:9 | LL | let ref mut a @ ref b = u(); - | ---------^^^----- - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:51:9 | LL | let ref a @ ref mut b = u(); - | -----^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:57:9 | LL | let ref mut a @ ref b = U; - | ---------^^^----- - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:61:9 | LL | let ref a @ ref mut b = U; - | -----^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:67:9 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => { - | ---------^^^^^^-----^ - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:67:33 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => { - | ---------^^^^^^^-----^ - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:76:9 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { - | -----^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:76:33 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { - | -----^^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:87:9 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {} - | -----^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:87:33 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {} - | -----^^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:94:9 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {} - | ---------^^^^^^-----^ - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:94:33 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {} - | ---------^^^^^^^-----^ - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:101:9 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {} - | -----^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:101:33 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {} - | -----^^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:109:9 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {} - | ---------^^^^^^-----^ - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:109:33 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {} - | ---------^^^^^^^-----^ - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:117:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); - | -----^^^^---------^^---------^ - | | | | - | | | value is mutably borrowed by `c` here + | ^^^^^ --------- --------- value is mutably borrowed by `c` here + | | | | | value is mutably borrowed by `b` here | value is borrowed by `a` here @@ -222,9 +198,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:123:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); - | -----^^^^---------^^---------^ - | | | | - | | | value is mutably borrowed by `c` here + | ^^^^^ --------- --------- value is mutably borrowed by `c` here + | | | | | value is mutably borrowed by `b` here | value is borrowed by `a` here @@ -232,9 +207,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:129:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); - | -----^^^^---------^^---------^ - | | | | - | | | value is mutably borrowed by `c` here + | ^^^^^ --------- --------- value is mutably borrowed by `c` here + | | | | | value is mutably borrowed by `b` here | value is borrowed by `a` here @@ -242,9 +216,8 @@ error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:134:9 | LL | let ref mut a @ (ref b, ref c) = (U, U); - | ---------^^^^-----^^-----^ - | | | | - | | | value is borrowed by `c` here + | ^^^^^^^^^ ----- ----- value is borrowed by `c` here + | | | | | value is borrowed by `b` here | value is mutably borrowed by `a` here @@ -252,36 +225,32 @@ error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:22:11 | LL | fn f1(ref a @ ref mut b: U) {} - | -----^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:24:11 | LL | fn f2(ref mut a @ ref b: U) {} - | ---------^^^----- - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:26:11 | LL | fn f3(ref a @ [ref b, ref mut mid @ .., ref c]: [U; 4]) {} - | -----^^^^^^^^^^^----------------^^^^^^^^ - | | | - | | value is mutably borrowed by `mid` here + | ^^^^^ ----------- value is mutably borrowed by `mid` here + | | | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:22 | LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {} - | -----^^^------------- - | | | | - | | | value is moved into `c` here + | ^^^^^ --------- - value is moved into `c` here + | | | | | value is mutably borrowed by `b` here | value is borrowed by `a` here @@ -289,9 +258,8 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:30 | LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {} - | ---------^^^- - | | | - | | value is moved into `c` here + | ^^^^^^^^^ - value is moved into `c` here + | | | value is mutably borrowed by `b` here error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr b/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr index a0cb04a06..24189d061 100644 --- a/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr +++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr @@ -2,98 +2,80 @@ error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:26:9 | LL | let ref mut a @ ref mut b = U; - | ---------^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:29:9 | LL | let ref mut a @ ref mut b = U; - | ---------^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:33:9 | LL | let ref mut a @ ref mut b = U; - | ---------^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:36:9 | LL | let ref mut a @ ref mut b = U; - | ---------^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:39:9 | LL | let ref mut a @ ref mut b = U; - | ---------^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:44:9 | -LL | let ref mut a @ ( - | ^-------- - | | - | _________value is mutably borrowed by `a` here - | | -LL | | -LL | | ref mut b, - | | --------- value is mutably borrowed by `b` here -LL | | [ -LL | | ref mut c, - | | --------- value is mutably borrowed by `c` here -LL | | ref mut d, - | | --------- value is mutably borrowed by `d` here -LL | | ref e, - | | ----- value is borrowed by `e` here -LL | | ] -LL | | ) = (U, [U, U, U]); - | |_____^ +LL | let ref mut a @ ( + | ^^^^^^^^^ value is mutably borrowed by `a` here +LL | +LL | ref mut b, + | --------- value is mutably borrowed by `b` here +LL | [ +LL | ref mut c, + | --------- value is mutably borrowed by `c` here +LL | ref mut d, + | --------- value is mutably borrowed by `d` here +LL | ref e, + | ----- value is borrowed by `e` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:54:9 | -LL | let ref mut a @ ( - | ^-------- - | | - | _________value is mutably borrowed by `a` here - | | -LL | | -LL | | ref mut b, - | | --------- value is mutably borrowed by `b` here -LL | | [ -LL | | ref mut c, - | | --------- value is mutably borrowed by `c` here -LL | | ref mut d, - | | --------- value is mutably borrowed by `d` here -LL | | ref e, - | | ----- value is borrowed by `e` here -LL | | ] -LL | | ) = (u(), [u(), u(), u()]); - | |_________^ +LL | let ref mut a @ ( + | ^^^^^^^^^ value is mutably borrowed by `a` here +LL | +LL | ref mut b, + | --------- value is mutably borrowed by `b` here +LL | [ +LL | ref mut c, + | --------- value is mutably borrowed by `c` here +LL | ref mut d, + | --------- value is mutably borrowed by `d` here +LL | ref e, + | ----- value is borrowed by `e` here error: borrow of moved value --> $DIR/borrowck-pat-ref-mut-twice.rs:64:9 | LL | let a @ (ref mut b, ref mut c) = (U, U); - | -^^^^---------^^---------^ - | | | | - | | | value borrowed here after move + | ^ --------- --------- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait @@ -107,9 +89,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-ref-mut-twice.rs:67:9 | LL | let a @ (b, [c, d]) = &mut val; // Same as ^-- - | -^^^^-^^^-^^-^^ - | | | | | - | | | | value borrowed here after move + | ^ - - - value borrowed here after move + | | | | | | | value borrowed here after move | | value borrowed here after move | value moved into `a` here @@ -124,9 +105,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-ref-mut-twice.rs:70:9 | LL | let a @ &mut ref mut b = &mut U; - | -^^^^^^^^--------- - | | | - | | value borrowed here after move + | ^ --------- value borrowed here after move + | | | value moved into `a` here | move occurs because `a` has type `&mut U` which does not implement the `Copy` trait | @@ -139,9 +119,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-ref-mut-twice.rs:72:9 | LL | let a @ &mut (ref mut b, ref mut c) = &mut (U, U); - | -^^^^^^^^^---------^^---------^ - | | | | - | | | value borrowed here after move + | ^ --------- --------- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `&mut (U, U)` which does not implement the `Copy` trait @@ -155,117 +134,99 @@ error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:76:9 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ---------^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:76:37 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ---------^^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:82:9 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ---------^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:82:37 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ---------^^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:89:9 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ---------^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:89:37 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ---------^^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:101:9 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ---------^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:101:37 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ---------^^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:8:11 | LL | fn f1(ref mut a @ ref mut b: U) {} - | ---------^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:10:11 | LL | fn f2(ref mut a @ ref mut b: U) {} - | ---------^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:13:9 | -LL | ref mut a @ [ - | ^-------- - | | - | _________value is mutably borrowed by `a` here - | | -LL | | -LL | | [ref b @ .., _], - | | ---------- value is borrowed by `b` here -LL | | [_, ref mut mid @ ..], - | | ---------------- value is mutably borrowed by `mid` here -LL | | .., -LL | | [..], -LL | | ] : [[U; 4]; 5] - | |_________^ +LL | ref mut a @ [ + | ^^^^^^^^^ value is mutably borrowed by `a` here +LL | +LL | [ref b @ .., _], + | ----- value is borrowed by `b` here +LL | [_, ref mut mid @ ..], + | ----------- value is mutably borrowed by `mid` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:21:22 | LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {} - | ---------^^^------------- - | | | | - | | | value is moved into `c` here + | ^^^^^^^^^ --------- - value is moved into `c` here + | | | | | value is mutably borrowed by `b` here | value is mutably borrowed by `a` here @@ -273,9 +234,8 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-ref-mut-twice.rs:21:34 | LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {} - | ---------^^^- - | | | - | | value is moved into `c` here + | ^^^^^^^^^ - value is moved into `c` here + | | | value is mutably borrowed by `b` here error[E0499]: cannot borrow value as mutable more than once at a time diff --git a/tests/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr b/tests/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr index 73ebbf481..36515c1a2 100644 --- a/tests/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr +++ b/tests/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr @@ -2,36 +2,32 @@ error: cannot move out of value because it is borrowed --> $DIR/default-binding-modes-both-sides-independent.rs:26:9 | LL | let ref a @ b = NotCopy; - | -----^^^- - | | | - | | value is moved into `b` here + | ^^^^^ - value is moved into `b` here + | | | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/default-binding-modes-both-sides-independent.rs:29:9 | LL | let ref mut a @ b = NotCopy; - | ---------^^^- - | | | - | | value is moved into `b` here + | ^^^^^^^^^ - value is moved into `b` here + | | | value is mutably borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/default-binding-modes-both-sides-independent.rs:34:12 | LL | Ok(ref a @ b) | Err(b @ ref a) => { - | -----^^^- - | | | - | | value is moved into `b` here + | ^^^^^ - value is moved into `b` here + | | | value is borrowed by `a` here error: borrow of moved value --> $DIR/default-binding-modes-both-sides-independent.rs:34:29 | LL | Ok(ref a @ b) | Err(b @ ref a) => { - | -^^^----- - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `b` here | move occurs because `b` has type `NotCopy` which does not implement the `Copy` trait | @@ -44,9 +40,8 @@ error: cannot move out of value because it is borrowed --> $DIR/default-binding-modes-both-sides-independent.rs:42:9 | LL | ref a @ b => { - | -----^^^- - | | | - | | value is moved into `b` here + | ^^^^^ - value is moved into `b` here + | | | value is borrowed by `a` here error[E0382]: borrow of moved value diff --git a/tests/ui/pattern/issue-106552.stderr b/tests/ui/pattern/issue-106552.stderr index ed5d40c09..96f3d6845 100644 --- a/tests/ui/pattern/issue-106552.stderr +++ b/tests/ui/pattern/issue-106552.stderr @@ -9,8 +9,8 @@ LL | let 5 = 6; = note: the matched value is of type `i32` help: you might want to use `if let` to ignore the variants that aren't matched | -LL | if let 5 = 6 { todo!() } - | ++ ~~~~~~~~~~~ +LL | if let 5 = 6 { todo!() }; + | ++ +++++++++++ help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits | LL | let _5 = 6; @@ -20,7 +20,7 @@ error[E0005]: refutable pattern in local binding --> $DIR/issue-106552.rs:5:9 | LL | let x @ 5 = 6; - | ^^^^^ patterns `i32::MIN..=4_i32` and `6_i32..=i32::MAX` not covered + | ^ patterns `i32::MIN..=4_i32` and `6_i32..=i32::MAX` not covered | = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html diff --git a/tests/ui/pattern/issue-106862.fixed b/tests/ui/pattern/issue-106862.fixed new file mode 100644 index 000000000..9b27a61ff --- /dev/null +++ b/tests/ui/pattern/issue-106862.fixed @@ -0,0 +1,44 @@ +// run-rustfix + +#![allow(unused)] + +use Foo::{FooB, FooA}; + +enum Foo { + FooA { opt_x: Option, y: i32 }, + FooB { x: i32, y: i32 } +} + +fn main() { + let f = FooB { x: 3, y: 4 }; + + match f { + FooB { x: a, y: b } => println!("{} {}", a, b), + //~^ ERROR expected tuple struct or tuple variant, found variant `FooB` + _ => (), + } + + match f { + FooB { x, y } => println!("{} {}", x, y), + //~^ ERROR expected tuple struct or tuple variant, found variant `FooB` + _ => (), + } + + match f { + FooA { opt_x: Some(x), y } => println!("{} {}", x, y), + //~^ ERROR expected tuple struct or tuple variant, found variant `FooA` + _ => (), + } + + match f { + FooB { x: a, y: _ } => println!("{}", a), + //~^ ERROR expected tuple struct or tuple variant, found variant `FooB` + _ => (), + } + + match f { + FooB { x, y } => (), + //~^ ERROR expected tuple struct or tuple variant, found variant `FooB` + _ => (), + } +} diff --git a/tests/ui/pattern/issue-106862.rs b/tests/ui/pattern/issue-106862.rs new file mode 100644 index 000000000..590430a78 --- /dev/null +++ b/tests/ui/pattern/issue-106862.rs @@ -0,0 +1,44 @@ +// run-rustfix + +#![allow(unused)] + +use Foo::{FooB, FooA}; + +enum Foo { + FooA { opt_x: Option, y: i32 }, + FooB { x: i32, y: i32 } +} + +fn main() { + let f = FooB { x: 3, y: 4 }; + + match f { + FooB(a, b) => println!("{} {}", a, b), + //~^ ERROR expected tuple struct or tuple variant, found variant `FooB` + _ => (), + } + + match f { + FooB(x, y) => println!("{} {}", x, y), + //~^ ERROR expected tuple struct or tuple variant, found variant `FooB` + _ => (), + } + + match f { + FooA(Some(x), y) => println!("{} {}", x, y), + //~^ ERROR expected tuple struct or tuple variant, found variant `FooA` + _ => (), + } + + match f { + FooB(a, _, _) => println!("{}", a), + //~^ ERROR expected tuple struct or tuple variant, found variant `FooB` + _ => (), + } + + match f { + FooB() => (), + //~^ ERROR expected tuple struct or tuple variant, found variant `FooB` + _ => (), + } +} diff --git a/tests/ui/pattern/issue-106862.stderr b/tests/ui/pattern/issue-106862.stderr new file mode 100644 index 000000000..27f8ac972 --- /dev/null +++ b/tests/ui/pattern/issue-106862.stderr @@ -0,0 +1,48 @@ +error[E0532]: expected tuple struct or tuple variant, found variant `FooB` + --> $DIR/issue-106862.rs:16:9 + | +LL | FooB { x: i32, y: i32 } + | ----------------------- `FooB` defined here +... +LL | FooB(a, b) => println!("{} {}", a, b), + | ^^^^^^^^^^ help: use struct pattern syntax instead: `FooB { x: a, y: b }` + +error[E0532]: expected tuple struct or tuple variant, found variant `FooB` + --> $DIR/issue-106862.rs:22:9 + | +LL | FooB { x: i32, y: i32 } + | ----------------------- `FooB` defined here +... +LL | FooB(x, y) => println!("{} {}", x, y), + | ^^^^^^^^^^ help: use struct pattern syntax instead: `FooB { x, y }` + +error[E0532]: expected tuple struct or tuple variant, found variant `FooA` + --> $DIR/issue-106862.rs:28:9 + | +LL | FooA { opt_x: Option, y: i32 }, + | ----------------------------------- `FooA` defined here +... +LL | FooA(Some(x), y) => println!("{} {}", x, y), + | ^^^^^^^^^^^^^^^^ help: use struct pattern syntax instead: `FooA { opt_x: Some(x), y }` + +error[E0532]: expected tuple struct or tuple variant, found variant `FooB` + --> $DIR/issue-106862.rs:34:9 + | +LL | FooB { x: i32, y: i32 } + | ----------------------- `FooB` defined here +... +LL | FooB(a, _, _) => println!("{}", a), + | ^^^^^^^^^^^^^ help: use struct pattern syntax instead: `FooB { x: a, y: _ }` + +error[E0532]: expected tuple struct or tuple variant, found variant `FooB` + --> $DIR/issue-106862.rs:40:9 + | +LL | FooB { x: i32, y: i32 } + | ----------------------- `FooB` defined here +... +LL | FooB() => (), + | ^^^^^^ help: use struct pattern syntax instead: `FooB { x, y }` + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0532`. diff --git a/tests/ui/pattern/issue-68393-let-pat-assoc-constant.stderr b/tests/ui/pattern/issue-68393-let-pat-assoc-constant.stderr index 54ecc2498..62c90b638 100644 --- a/tests/ui/pattern/issue-68393-let-pat-assoc-constant.stderr +++ b/tests/ui/pattern/issue-68393-let-pat-assoc-constant.stderr @@ -1,15 +1,15 @@ -error[E0158]: associated consts cannot be referenced in patterns - --> $DIR/issue-68393-let-pat-assoc-constant.rs:20:40 - | -LL | pub fn test(arg: EFoo, A::X: EFoo) { - | ^^^^ - error[E0158]: associated consts cannot be referenced in patterns --> $DIR/issue-68393-let-pat-assoc-constant.rs:22:9 | LL | let A::X = arg; | ^^^^ +error[E0158]: associated consts cannot be referenced in patterns + --> $DIR/issue-68393-let-pat-assoc-constant.rs:20:40 + | +LL | pub fn test(arg: EFoo, A::X: EFoo) { + | ^^^^ + error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0158`. diff --git a/tests/ui/pattern/pat-tuple-field-count-cross.stderr b/tests/ui/pattern/pat-tuple-field-count-cross.stderr index d92957461..0d7f2e4af 100644 --- a/tests/ui/pattern/pat-tuple-field-count-cross.stderr +++ b/tests/ui/pattern/pat-tuple-field-count-cross.stderr @@ -113,8 +113,8 @@ LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) } | help: use the tuple variant pattern syntax instead | -LL | E1::Z1(/* fields */) => {} - | ~~~~~~~~~~~~~~~~~~~~ +LL | E1::Z1() => {} + | ~~~~~~~~ help: a unit variant with a similar name exists | LL | E1::Z0 => {} diff --git a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed index b28dce881..b469fade3 100644 --- a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed +++ b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed @@ -4,7 +4,7 @@ fn main() { match Some(1) { //~ ERROR non-exhaustive patterns: `None` not covered Some(1) => {} // hello - Some(_) => {} + Some(_) => {}, None => todo!() } } diff --git a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr index 2a016048f..5f2c89246 100644 --- a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr +++ b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr @@ -12,7 +12,7 @@ note: `Option` defined here = note: the matched value is of type `Option` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ Some(_) => {} +LL ~ Some(_) => {}, LL + None => todo!() | diff --git a/tests/ui/pattern/usefulness/const-partial_eq-fallback-ice.stderr b/tests/ui/pattern/usefulness/const-partial_eq-fallback-ice.stderr index 358421cd6..dbd46da44 100644 --- a/tests/ui/pattern/usefulness/const-partial_eq-fallback-ice.stderr +++ b/tests/ui/pattern/usefulness/const-partial_eq-fallback-ice.stderr @@ -3,6 +3,9 @@ error: to use a constant of type `MyType` in a pattern, `MyType` must be annotat | LL | if let CONSTANT = &&MyType { | ^^^^^^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/consts-opaque.stderr b/tests/ui/pattern/usefulness/consts-opaque.stderr index 35396751a..3f0b4a9f2 100644 --- a/tests/ui/pattern/usefulness/consts-opaque.stderr +++ b/tests/ui/pattern/usefulness/consts-opaque.stderr @@ -3,36 +3,18 @@ error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated wit | LL | FOO => {} | ^^^ - -error: unreachable pattern - --> $DIR/consts-opaque.rs:32:9 - | -LL | FOO => {} - | --- matches any value -LL | -LL | _ => {} // should not be emitting unreachable warning - | ^ unreachable pattern - | -note: the lint level is defined here - --> $DIR/consts-opaque.rs:6:9 | -LL | #![deny(unreachable_patterns)] - | ^^^^^^^^^^^^^^^^^^^^ + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]` --> $DIR/consts-opaque.rs:37:9 | LL | FOO_REF => {} | ^^^^^^^ - -error: unreachable pattern - --> $DIR/consts-opaque.rs:39:9 | -LL | FOO_REF => {} - | ------- matches any value -LL | -LL | Foo(_) => {} // should not be emitting unreachable warning - | ^^^^^^ unreachable pattern + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details warning: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]` --> $DIR/consts-opaque.rs:45:9 @@ -42,6 +24,8 @@ LL | FOO_REF_REF => {} | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #62411 + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details = note: `#[warn(indirect_structural_match)]` on by default error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]` @@ -49,6 +33,87 @@ error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated wit | LL | BAR => {} // should not be emitting unreachable warning | ^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details + +error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]` + --> $DIR/consts-opaque.rs:61:9 + | +LL | BAR => {} + | ^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details + +error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]` + --> $DIR/consts-opaque.rs:70:9 + | +LL | BAR => {} + | ^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details + +error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]` + --> $DIR/consts-opaque.rs:72:9 + | +LL | BAR => {} // should not be emitting unreachable warning + | ^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details + +error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]` + --> $DIR/consts-opaque.rs:80:9 + | +LL | BAZ => {} + | ^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details + +error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]` + --> $DIR/consts-opaque.rs:90:9 + | +LL | BAZ => {} + | ^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details + +error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]` + --> $DIR/consts-opaque.rs:97:9 + | +LL | BAZ => {} + | ^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details + +error: unreachable pattern + --> $DIR/consts-opaque.rs:32:9 + | +LL | FOO => {} + | --- matches any value +LL | +LL | _ => {} // should not be emitting unreachable warning + | ^ unreachable pattern + | +note: the lint level is defined here + --> $DIR/consts-opaque.rs:6:9 + | +LL | #![deny(unreachable_patterns)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: unreachable pattern + --> $DIR/consts-opaque.rs:39:9 + | +LL | FOO_REF => {} + | ------- matches any value +LL | +LL | Foo(_) => {} // should not be emitting unreachable warning + | ^^^^^^ unreachable pattern error: unreachable pattern --> $DIR/consts-opaque.rs:53:9 @@ -67,12 +132,6 @@ LL | Bar => {} LL | _ => {} | ^ unreachable pattern -error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/consts-opaque.rs:61:9 - | -LL | BAR => {} - | ^^^ - error: unreachable pattern --> $DIR/consts-opaque.rs:63:9 | @@ -91,18 +150,6 @@ LL | BAR => {} LL | _ => {} | ^ unreachable pattern -error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/consts-opaque.rs:70:9 - | -LL | BAR => {} - | ^^^ - -error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/consts-opaque.rs:72:9 - | -LL | BAR => {} // should not be emitting unreachable warning - | ^^^ - error: unreachable pattern --> $DIR/consts-opaque.rs:72:9 | @@ -121,12 +168,6 @@ LL | BAR => {} LL | _ => {} // should not be emitting unreachable warning | ^ unreachable pattern -error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/consts-opaque.rs:80:9 - | -LL | BAZ => {} - | ^^^ - error: unreachable pattern --> $DIR/consts-opaque.rs:82:9 | @@ -145,12 +186,6 @@ LL | BAZ => {} LL | _ => {} | ^ unreachable pattern -error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/consts-opaque.rs:90:9 - | -LL | BAZ => {} - | ^^^ - error: unreachable pattern --> $DIR/consts-opaque.rs:92:9 | @@ -160,12 +195,6 @@ LL | LL | _ => {} | ^ unreachable pattern -error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/consts-opaque.rs:97:9 - | -LL | BAZ => {} - | ^^^ - error: unreachable pattern --> $DIR/consts-opaque.rs:99:9 | diff --git a/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr b/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr index 17e1a2304..ff29de03d 100644 --- a/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr +++ b/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr @@ -12,7 +12,7 @@ LL | pub enum HiddenEnum { = note: the matched value is of type `HiddenEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ HiddenEnum::B => {} +LL ~ HiddenEnum::B => {}, LL + _ => todo!() | @@ -33,7 +33,7 @@ LL | B, = note: the matched value is of type `HiddenEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ HiddenEnum::C => {} +LL ~ HiddenEnum::C => {}, LL + HiddenEnum::B => todo!() | @@ -54,7 +54,7 @@ LL | B, = note: the matched value is of type `HiddenEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ HiddenEnum::A => {} +LL ~ HiddenEnum::A => {}, LL + HiddenEnum::B | _ => todo!() | @@ -72,7 +72,7 @@ note: `Option` defined here = note: the matched value is of type `Option` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ Some(HiddenEnum::A) => {} +LL ~ Some(HiddenEnum::A) => {}, LL + Some(HiddenEnum::B) | Some(_) => todo!() | @@ -93,7 +93,7 @@ LL | C, = note: the matched value is of type `InCrate` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ InCrate::B => {} +LL ~ InCrate::B => {}, LL + InCrate::C => todo!() | diff --git a/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr index 5e12bc1d2..5a145efce 100644 --- a/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr @@ -162,7 +162,7 @@ LL | match_guarded_arm!(0u8); = note: the matched value is of type `u8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + _ => todo!() | @@ -180,7 +180,7 @@ LL | struct NonEmptyStruct1; = note: the matched value is of type `NonEmptyStruct1` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyStruct1 => todo!() | @@ -198,7 +198,7 @@ LL | struct NonEmptyStruct2(bool); = note: the matched value is of type `NonEmptyStruct2` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyStruct2(_) => todo!() | @@ -216,7 +216,7 @@ LL | union NonEmptyUnion1 { = note: the matched value is of type `NonEmptyUnion1` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyUnion1 { .. } => todo!() | @@ -234,7 +234,7 @@ LL | union NonEmptyUnion2 { = note: the matched value is of type `NonEmptyUnion2` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyUnion2 { .. } => todo!() | @@ -254,7 +254,7 @@ LL | Foo(bool), = note: the matched value is of type `NonEmptyEnum1` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyEnum1::Foo(_) => todo!() | @@ -276,7 +276,7 @@ LL | Bar, = note: the matched value is of type `NonEmptyEnum2` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!() | @@ -294,7 +294,7 @@ LL | enum NonEmptyEnum5 { = note: the matched value is of type `NonEmptyEnum5` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + _ => todo!() | diff --git a/tests/ui/pattern/usefulness/empty-match.normal.stderr b/tests/ui/pattern/usefulness/empty-match.normal.stderr index 5e12bc1d2..5a145efce 100644 --- a/tests/ui/pattern/usefulness/empty-match.normal.stderr +++ b/tests/ui/pattern/usefulness/empty-match.normal.stderr @@ -162,7 +162,7 @@ LL | match_guarded_arm!(0u8); = note: the matched value is of type `u8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + _ => todo!() | @@ -180,7 +180,7 @@ LL | struct NonEmptyStruct1; = note: the matched value is of type `NonEmptyStruct1` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyStruct1 => todo!() | @@ -198,7 +198,7 @@ LL | struct NonEmptyStruct2(bool); = note: the matched value is of type `NonEmptyStruct2` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyStruct2(_) => todo!() | @@ -216,7 +216,7 @@ LL | union NonEmptyUnion1 { = note: the matched value is of type `NonEmptyUnion1` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyUnion1 { .. } => todo!() | @@ -234,7 +234,7 @@ LL | union NonEmptyUnion2 { = note: the matched value is of type `NonEmptyUnion2` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyUnion2 { .. } => todo!() | @@ -254,7 +254,7 @@ LL | Foo(bool), = note: the matched value is of type `NonEmptyEnum1` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyEnum1::Foo(_) => todo!() | @@ -276,7 +276,7 @@ LL | Bar, = note: the matched value is of type `NonEmptyEnum2` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!() | @@ -294,7 +294,7 @@ LL | enum NonEmptyEnum5 { = note: the matched value is of type `NonEmptyEnum5` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + _ => todo!() | diff --git a/tests/ui/pattern/usefulness/floats.stderr b/tests/ui/pattern/usefulness/floats.stderr index c926e50b3..d66d4ba29 100644 --- a/tests/ui/pattern/usefulness/floats.stderr +++ b/tests/ui/pattern/usefulness/floats.stderr @@ -7,7 +7,7 @@ LL | match 0.0 { = note: the matched value is of type `f64` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ 0.0..=1.0 => {} +LL ~ 0.0..=1.0 => {}, LL + _ => todo!() | diff --git a/tests/ui/pattern/usefulness/guards.stderr b/tests/ui/pattern/usefulness/guards.stderr index 0c1563c16..fc6748958 100644 --- a/tests/ui/pattern/usefulness/guards.stderr +++ b/tests/ui/pattern/usefulness/guards.stderr @@ -7,7 +7,7 @@ LL | match 0u8 { = note: the matched value is of type `u8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ 128 ..= 255 if true => {} +LL ~ 128 ..= 255 if true => {}, LL + 128_u8..=u8::MAX => todo!() | diff --git a/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr b/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr index f30ba05df..b585de206 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr @@ -91,7 +91,7 @@ LL | match 0i8 { = note: the matched value is of type `i8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ 1 ..= i8::MAX => {} +LL ~ 1 ..= i8::MAX => {}, LL + 0_i8 => todo!() | @@ -140,7 +140,7 @@ LL | match (0u8, true) { = note: the matched value is of type `(u8, bool)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ (0 ..= 255, true) => {} +LL ~ (0 ..= 255, true) => {}, LL + (126_u8..=127_u8, false) => todo!() | diff --git a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr index e3eb98ccd..0e0f0c3e1 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr @@ -9,7 +9,7 @@ LL | match 0usize { = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ 0 ..= usize::MAX => {} +LL ~ 0 ..= usize::MAX => {}, LL + _ => todo!() | @@ -24,7 +24,7 @@ LL | match 0isize { = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ isize::MIN ..= isize::MAX => {} +LL ~ isize::MIN ..= isize::MAX => {}, LL + _ => todo!() | @@ -147,7 +147,7 @@ LL | match 0isize { = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ 1 ..= isize::MAX => {} +LL ~ 1 ..= isize::MAX => {}, LL + _ => todo!() | diff --git a/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr b/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr index 30492c982..b80411b26 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr @@ -9,7 +9,7 @@ LL | match 0usize { = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ 0..=usize::MAX => {} +LL ~ 0..=usize::MAX => {}, LL + _ => todo!() | @@ -24,7 +24,7 @@ LL | match 0isize { = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ isize::MIN..=isize::MAX => {} +LL ~ isize::MIN..=isize::MAX => {}, LL + _ => todo!() | diff --git a/tests/ui/pattern/usefulness/issue-2111.stderr b/tests/ui/pattern/usefulness/issue-2111.stderr index 01890b73c..7f7c5a0f1 100644 --- a/tests/ui/pattern/usefulness/issue-2111.stderr +++ b/tests/ui/pattern/usefulness/issue-2111.stderr @@ -7,7 +7,7 @@ LL | match (a, b) { = note: the matched value is of type `(Option, Option)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ (Some(_), None) | (None, Some(_)) => {} +LL ~ (Some(_), None) | (None, Some(_)) => {}, LL + (None, None) | (Some(_), Some(_)) => todo!() | diff --git a/tests/ui/pattern/usefulness/issue-30240.stderr b/tests/ui/pattern/usefulness/issue-30240.stderr index 759fdeafe..ff755d681 100644 --- a/tests/ui/pattern/usefulness/issue-30240.stderr +++ b/tests/ui/pattern/usefulness/issue-30240.stderr @@ -7,7 +7,7 @@ LL | match "world" { = note: the matched value is of type `&str` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ "hello" => {} +LL ~ "hello" => {}, LL + &_ => todo!() | @@ -20,7 +20,7 @@ LL | match "world" { = note: the matched value is of type `&str` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ "hello" => {} +LL ~ "hello" => {}, LL + &_ => todo!() | diff --git a/tests/ui/pattern/usefulness/issue-35609.stderr b/tests/ui/pattern/usefulness/issue-35609.stderr index 12113957d..6d5e2f410 100644 --- a/tests/ui/pattern/usefulness/issue-35609.stderr +++ b/tests/ui/pattern/usefulness/issue-35609.stderr @@ -7,7 +7,7 @@ LL | match (A, ()) { = note: the matched value is of type `(Enum, ())` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | -LL ~ (A, _) => {} +LL ~ (A, _) => {}, LL + _ => todo!() | @@ -20,7 +20,7 @@ LL | match (A, A) { = note: the matched value is of type `(Enum, Enum)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | -LL ~ (_, A) => {} +LL ~ (_, A) => {}, LL + _ => todo!() | @@ -33,7 +33,7 @@ LL | match ((A, ()), ()) { = note: the matched value is of type `((Enum, ()), ())` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | -LL ~ ((A, ()), _) => {} +LL ~ ((A, ()), _) => {}, LL + _ => todo!() | @@ -46,7 +46,7 @@ LL | match ((A, ()), A) { = note: the matched value is of type `((Enum, ()), Enum)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | -LL ~ ((A, ()), _) => {} +LL ~ ((A, ()), _) => {}, LL + _ => todo!() | @@ -59,7 +59,7 @@ LL | match ((A, ()), ()) { = note: the matched value is of type `((Enum, ()), ())` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | -LL ~ ((A, _), _) => {} +LL ~ ((A, _), _) => {}, LL + _ => todo!() | @@ -77,7 +77,7 @@ LL | struct S(Enum, ()); = note: the matched value is of type `S` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | -LL ~ S(A, _) => {} +LL ~ S(A, _) => {}, LL + _ => todo!() | @@ -95,7 +95,7 @@ LL | struct Sd { x: Enum, y: () } = note: the matched value is of type `Sd` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | -LL ~ Sd { x: A, y: _ } => {} +LL ~ Sd { x: A, y: _ } => {}, LL + _ => todo!() | diff --git a/tests/ui/pattern/usefulness/issue-3601.stderr b/tests/ui/pattern/usefulness/issue-3601.stderr index 59d7bcd4b..2f6b167d4 100644 --- a/tests/ui/pattern/usefulness/issue-3601.stderr +++ b/tests/ui/pattern/usefulness/issue-3601.stderr @@ -9,7 +9,7 @@ note: `Box` defined here = note: the matched value is of type `Box` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ box ElementKind::HTMLImageElement(ref d) if d.image.is_some() => { true } +LL ~ box ElementKind::HTMLImageElement(ref d) if d.image.is_some() => { true }, LL + box _ => todo!() | diff --git a/tests/ui/pattern/usefulness/issue-50900.stderr b/tests/ui/pattern/usefulness/issue-50900.stderr index 348246d28..7880c8925 100644 --- a/tests/ui/pattern/usefulness/issue-50900.stderr +++ b/tests/ui/pattern/usefulness/issue-50900.stderr @@ -12,7 +12,7 @@ LL | pub struct Tag(pub Context, pub u16); = note: the matched value is of type `Tag` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ Tag::ExifIFDPointer => {} +LL ~ Tag::ExifIFDPointer => {}, LL + Tag(Context::Exif, _) => todo!() | diff --git a/tests/ui/pattern/usefulness/issue-56379.stderr b/tests/ui/pattern/usefulness/issue-56379.stderr index 6eed6bfae..b3e40b992 100644 --- a/tests/ui/pattern/usefulness/issue-56379.stderr +++ b/tests/ui/pattern/usefulness/issue-56379.stderr @@ -18,7 +18,7 @@ LL | C(bool), = note: the matched value is of type `Foo` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ Foo::C(true) => {} +LL ~ Foo::C(true) => {}, LL + Foo::A(false) | Foo::B(false) | Foo::C(false) => todo!() | diff --git a/tests/ui/pattern/usefulness/match-byte-array-patterns-2.stderr b/tests/ui/pattern/usefulness/match-byte-array-patterns-2.stderr index a90f32f7a..3c482eef2 100644 --- a/tests/ui/pattern/usefulness/match-byte-array-patterns-2.stderr +++ b/tests/ui/pattern/usefulness/match-byte-array-patterns-2.stderr @@ -7,7 +7,7 @@ LL | match buf { = note: the matched value is of type `&[u8; 4]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ b"AAAA" => {} +LL ~ b"AAAA" => {}, LL + &[0_u8..=64_u8, _, _, _] | &[66_u8..=u8::MAX, _, _, _] => todo!() | @@ -20,7 +20,7 @@ LL | match buf { = note: the matched value is of type `&[u8]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | -LL ~ b"AAAA" => {} +LL ~ b"AAAA" => {}, LL + _ => todo!() | diff --git a/tests/ui/pattern/usefulness/match-privately-empty.stderr b/tests/ui/pattern/usefulness/match-privately-empty.stderr index 86f75d15c..45352f094 100644 --- a/tests/ui/pattern/usefulness/match-privately-empty.stderr +++ b/tests/ui/pattern/usefulness/match-privately-empty.stderr @@ -12,7 +12,7 @@ note: `Option` defined here = note: the matched value is of type `Option` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ }) => {} +LL ~ }) => {}, LL + Some(Private { misc: true, .. }) => todo!() | diff --git a/tests/ui/pattern/usefulness/match-slice-patterns.stderr b/tests/ui/pattern/usefulness/match-slice-patterns.stderr index 961dd5901..63d1f38e9 100644 --- a/tests/ui/pattern/usefulness/match-slice-patterns.stderr +++ b/tests/ui/pattern/usefulness/match-slice-patterns.stderr @@ -7,7 +7,7 @@ LL | match list { = note: the matched value is of type `&[Option<()>]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ &[.., Some(_), _] => {} +LL ~ &[.., Some(_), _] => {}, LL ~ &[_, Some(_), .., None, _] => todo!(), | diff --git a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr index 769d4070f..8489e2f14 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr @@ -18,7 +18,7 @@ LL | C = note: the matched value is of type `E` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ E::A => {} +LL ~ E::A => {}, LL + E::B | E::C => todo!() | @@ -44,8 +44,8 @@ LL | C = note: the matched value is of type `E` help: you might want to use `if let` to ignore the variants that aren't matched | -LL | if let E::A = e { todo!() } - | ++ ~~~~~~~~~~~ +LL | if let E::A = e { todo!() }; + | ++ +++++++++++ error[E0004]: non-exhaustive patterns: `&E::B` and `&E::C` not covered --> $DIR/non-exhaustive-defined-here.rs:50:11 @@ -67,7 +67,7 @@ LL | C = note: the matched value is of type `&E` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ E::A => {} +LL ~ E::A => {}, LL + &E::B | &E::C => todo!() | @@ -93,8 +93,8 @@ LL | C = note: the matched value is of type `&E` help: you might want to use `if let` to ignore the variants that aren't matched | -LL | if let E::A = e { todo!() } - | ++ ~~~~~~~~~~~ +LL | if let E::A = e { todo!() }; + | ++ +++++++++++ error[E0004]: non-exhaustive patterns: `&&mut &E::B` and `&&mut &E::C` not covered --> $DIR/non-exhaustive-defined-here.rs:66:11 @@ -116,7 +116,7 @@ LL | C = note: the matched value is of type `&&mut &E` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ E::A => {} +LL ~ E::A => {}, LL + &&mut &E::B | &&mut &E::C => todo!() | @@ -142,8 +142,8 @@ LL | C = note: the matched value is of type `&&mut &E` help: you might want to use `if let` to ignore the variants that aren't matched | -LL | if let E::A = e { todo!() } - | ++ ~~~~~~~~~~~ +LL | if let E::A = e { todo!() }; + | ++ +++++++++++ error[E0004]: non-exhaustive patterns: `Opt::None` not covered --> $DIR/non-exhaustive-defined-here.rs:92:11 @@ -162,7 +162,7 @@ LL | None, = note: the matched value is of type `Opt` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ Opt::Some(ref _x) => {} +LL ~ Opt::Some(ref _x) => {}, LL + Opt::None => todo!() | diff --git a/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr b/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr index 44f327421..98e417a17 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr @@ -25,7 +25,7 @@ LL | enum T { A(U), B } = note: the matched value is of type `T` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ T::B => { panic!("goodbye"); } +LL ~ T::B => { panic!("goodbye"); }, LL + T::A(U::C) => todo!() | diff --git a/tests/ui/pattern/usefulness/non-exhaustive-match.stderr b/tests/ui/pattern/usefulness/non-exhaustive-match.stderr index e2260f50b..e59e8885e 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-match.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-match.stderr @@ -24,7 +24,7 @@ LL | match true { = note: the matched value is of type `bool` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ true => {} +LL ~ true => {}, LL + false => todo!() | @@ -42,7 +42,7 @@ note: `Option` defined here = note: the matched value is of type `Option` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ None => {} +LL ~ None => {}, LL + Some(_) => todo!() | @@ -55,7 +55,7 @@ LL | match (2, 3, 4) { = note: the matched value is of type `(i32, i32, i32)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ (_, _, 4) => {} +LL ~ (_, _, 4) => {}, LL + (_, _, i32::MIN..=3_i32) | (_, _, 5_i32..=i32::MAX) => todo!() | @@ -68,7 +68,7 @@ LL | match (T::A, T::A) { = note: the matched value is of type `(T, T)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ (T::B, T::A) => {} +LL ~ (T::B, T::A) => {}, LL + (T::A, T::A) | (T::B, T::B) => todo!() | @@ -86,7 +86,7 @@ LL | enum T { A, B } = note: the matched value is of type `T` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ T::A => {} +LL ~ T::A => {}, LL + T::B => todo!() | @@ -99,7 +99,7 @@ LL | match *vec { = note: the matched value is of type `[Option]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [None] => {} +LL ~ [None] => {}, LL + [] => todo!() | diff --git a/tests/ui/pattern/usefulness/refutable-pattern-errors.stderr b/tests/ui/pattern/usefulness/refutable-pattern-errors.stderr index c518de477..beb51a4d4 100644 --- a/tests/ui/pattern/usefulness/refutable-pattern-errors.stderr +++ b/tests/ui/pattern/usefulness/refutable-pattern-errors.stderr @@ -17,8 +17,8 @@ LL | let (1, (Some(1), 2..=3)) = (1, (None, 2)); = note: the matched value is of type `(i32, (Option, i32))` help: you might want to use `if let` to ignore the variants that aren't matched | -LL | if let (1, (Some(1), 2..=3)) = (1, (None, 2)) { todo!() } - | ++ ~~~~~~~~~~~ +LL | if let (1, (Some(1), 2..=3)) = (1, (None, 2)) { todo!() }; + | ++ +++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr b/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr index 55f0b2319..ab3f6f69f 100644 --- a/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr +++ b/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr @@ -5,6 +5,10 @@ LL | let f = |3: isize| println!("hello"); | ^ pattern `_` not covered | = note: the matched value is of type `isize` +help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits + | +LL | let f = |_3: isize| println!("hello"); + | + error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr b/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr index 5d1e170ae..fb6ecda3c 100644 --- a/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr +++ b/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr @@ -7,7 +7,7 @@ LL | match s2 { = note: the matched value is of type `&[bool; 2]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [true, .., true] => {} +LL ~ [true, .., true] => {}, LL + &[false, _] => todo!() | @@ -20,7 +20,7 @@ LL | match s3 { = note: the matched value is of type `&[bool; 3]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [true, .., true] => {} +LL ~ [true, .., true] => {}, LL + &[false, ..] => todo!() | @@ -33,7 +33,7 @@ LL | match s10 { = note: the matched value is of type `&[bool; 10]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [true, .., true] => {} +LL ~ [true, .., true] => {}, LL + &[false, ..] => todo!() | @@ -46,7 +46,7 @@ LL | match s2 { = note: the matched value is of type `&[bool; 2]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [.., false] => {} +LL ~ [.., false] => {}, LL + &[false, true] => todo!() | @@ -59,7 +59,7 @@ LL | match s3 { = note: the matched value is of type `&[bool; 3]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [.., false] => {} +LL ~ [.., false] => {}, LL + &[false, .., true] => todo!() | @@ -72,7 +72,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [.., false] => {} +LL ~ [.., false] => {}, LL + &[false, .., true] => todo!() | @@ -85,7 +85,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [] => {} +LL ~ [] => {}, LL + &[_, ..] => todo!() | @@ -98,7 +98,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [_] => {} +LL ~ [_] => {}, LL + &[_, _, ..] => todo!() | @@ -111,7 +111,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [true, ..] => {} +LL ~ [true, ..] => {}, LL + &[false, ..] => todo!() | @@ -124,7 +124,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [true, ..] => {} +LL ~ [true, ..] => {}, LL + &[false, _, ..] => todo!() | @@ -137,7 +137,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [.., true] => {} +LL ~ [.., true] => {}, LL + &[_, .., false] => todo!() | @@ -150,7 +150,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [.., false] => {} +LL ~ [.., false] => {}, LL + &[_, _, .., true] => todo!() | @@ -163,7 +163,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [false, .., false] => {} +LL ~ [false, .., false] => {}, LL + &[true, _, .., _] => todo!() | @@ -176,7 +176,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ &[true] => {} +LL ~ &[true] => {}, LL + &[] | &[_, _, ..] => todo!() | @@ -189,7 +189,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ CONST => {} +LL ~ CONST => {}, LL + &[] | &[_, _, ..] => todo!() | @@ -202,7 +202,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ &[false] => {} +LL ~ &[false] => {}, LL + &[] | &[_, _, ..] => todo!() | @@ -215,7 +215,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ CONST => {} +LL ~ CONST => {}, LL + &[] | &[_, _, ..] => todo!() | @@ -228,7 +228,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ CONST => {} +LL ~ CONST => {}, LL + &[_, _, ..] => todo!() | @@ -241,7 +241,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ &[_, _, ..] => {} +LL ~ &[_, _, ..] => {}, LL + &[false] => todo!() | @@ -254,7 +254,7 @@ LL | match s1 { = note: the matched value is of type `&[bool; 1]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ CONST1 => {} +LL ~ CONST1 => {}, LL + &[false] => todo!() | diff --git a/tests/ui/pattern/usefulness/stable-gated-patterns.stderr b/tests/ui/pattern/usefulness/stable-gated-patterns.stderr index 7b8588a3c..f944c25a9 100644 --- a/tests/ui/pattern/usefulness/stable-gated-patterns.stderr +++ b/tests/ui/pattern/usefulness/stable-gated-patterns.stderr @@ -15,7 +15,7 @@ LL | Stable2, = note: the matched value is of type `UnstableEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ UnstableEnum::Stable => {} +LL ~ UnstableEnum::Stable => {}, LL + UnstableEnum::Stable2 | _ => todo!() | @@ -33,7 +33,7 @@ LL | pub enum UnstableEnum { = note: the matched value is of type `UnstableEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ UnstableEnum::Stable2 => {} +LL ~ UnstableEnum::Stable2 => {}, LL + _ => todo!() | diff --git a/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr b/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr index 85c97be29..22425aa0d 100644 --- a/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr +++ b/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr @@ -14,7 +14,7 @@ LL | B { x: Option }, = note: the matched value is of type `A` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ A::B { x: None } => {} +LL ~ A::B { x: None } => {}, LL + A::B { x: Some(_) } => todo!() | diff --git a/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr b/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr index 6dc9a4058..d776249b2 100644 --- a/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr +++ b/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr @@ -15,7 +15,7 @@ LL | Unstable, = note: the matched value is of type `UnstableEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ UnstableEnum::Stable2 => {} +LL ~ UnstableEnum::Stable2 => {}, LL + UnstableEnum::Unstable => todo!() | diff --git a/tests/ui/privacy/auxiliary/xc-private-method-lib.rs b/tests/ui/privacy/auxiliary/xc-private-method-lib.rs new file mode 100644 index 000000000..4d5ec6de3 --- /dev/null +++ b/tests/ui/privacy/auxiliary/xc-private-method-lib.rs @@ -0,0 +1,33 @@ +#![crate_type="lib"] + +pub struct Struct { + pub x: isize +} + +impl Struct { + fn static_meth_struct() -> Struct { + Struct { x: 1 } + } + + fn meth_struct(&self) -> isize { + self.x + } +} + +pub enum Enum { + Variant1(isize), + Variant2(isize) +} + +impl Enum { + fn static_meth_enum() -> Enum { + Enum::Variant2(10) + } + + fn meth_enum(&self) -> isize { + match *self { + Enum::Variant1(x) | + Enum::Variant2(x) => x + } + } +} diff --git a/tests/ui/privacy/effective_visibilities.rs b/tests/ui/privacy/effective_visibilities.rs index ff20e20d3..e9ac93160 100644 --- a/tests/ui/privacy/effective_visibilities.rs +++ b/tests/ui/privacy/effective_visibilities.rs @@ -1,3 +1,4 @@ +#![rustc_effective_visibility] //~ ERROR Direct: pub, Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub #![feature(rustc_attrs)] #[rustc_effective_visibility] @@ -17,13 +18,13 @@ mod outer { //~ ERROR Direct: pub(crate), Reexported: pub(crate), Reachable: pub } #[rustc_effective_visibility] - struct PrivStruct; //~ ERROR Direct: pub(self), Reexported: pub(self), Reachable: pub(self), ReachableThroughImplTrait: pub(self) - //~| ERROR Direct: pub(self), Reexported: pub(self), Reachable: pub(self), ReachableThroughImplTrait: pub(self) + struct PrivStruct; //~ ERROR not in the table + //~| ERROR not in the table #[rustc_effective_visibility] pub union PubUnion { //~ ERROR Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub #[rustc_effective_visibility] - a: u8, //~ ERROR Direct: pub(self), Reexported: pub(self), Reachable: pub(self), ReachableThroughImplTrait: pub(self) + a: u8, //~ ERROR not in the table #[rustc_effective_visibility] pub b: u8, //~ ERROR Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub } diff --git a/tests/ui/privacy/effective_visibilities.stderr b/tests/ui/privacy/effective_visibilities.stderr index 046b6095f..f74f812e1 100644 --- a/tests/ui/privacy/effective_visibilities.stderr +++ b/tests/ui/privacy/effective_visibilities.stderr @@ -1,140 +1,152 @@ +error: Direct: pub, Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub + --> $DIR/effective_visibilities.rs:1:1 + | +LL | / #![rustc_effective_visibility] +LL | | #![feature(rustc_attrs)] +LL | | +LL | | #[rustc_effective_visibility] +... | +LL | | +LL | | fn main() {} + | |____________^ + error: Direct: pub(crate), Reexported: pub(crate), Reachable: pub(crate), ReachableThroughImplTrait: pub(crate) - --> $DIR/effective_visibilities.rs:4:1 + --> $DIR/effective_visibilities.rs:5:1 | LL | mod outer { | ^^^^^^^^^ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:6:5 + --> $DIR/effective_visibilities.rs:7:5 | LL | pub mod inner1 { | ^^^^^^^^^^^^^^ error: not in the table - --> $DIR/effective_visibilities.rs:9:9 + --> $DIR/effective_visibilities.rs:10:9 | LL | extern "C" {} | ^^^^^^^^^^^^^ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:12:9 + --> $DIR/effective_visibilities.rs:13:9 | LL | pub trait PubTrait { | ^^^^^^^^^^^^^^^^^^ -error: Direct: pub(self), Reexported: pub(self), Reachable: pub(self), ReachableThroughImplTrait: pub(self) - --> $DIR/effective_visibilities.rs:20:9 +error: not in the table + --> $DIR/effective_visibilities.rs:21:9 | LL | struct PrivStruct; | ^^^^^^^^^^^^^^^^^ -error: Direct: pub(self), Reexported: pub(self), Reachable: pub(self), ReachableThroughImplTrait: pub(self) - --> $DIR/effective_visibilities.rs:20:9 +error: not in the table + --> $DIR/effective_visibilities.rs:21:9 | LL | struct PrivStruct; | ^^^^^^^^^^^^^^^^^ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:24:9 + --> $DIR/effective_visibilities.rs:25:9 | LL | pub union PubUnion { | ^^^^^^^^^^^^^^^^^^ -error: Direct: pub(self), Reexported: pub(self), Reachable: pub(self), ReachableThroughImplTrait: pub(self) - --> $DIR/effective_visibilities.rs:26:13 +error: not in the table + --> $DIR/effective_visibilities.rs:27:13 | LL | a: u8, | ^^^^^ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:28:13 + --> $DIR/effective_visibilities.rs:29:13 | LL | pub b: u8, | ^^^^^^^^^ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:32:9 + --> $DIR/effective_visibilities.rs:33:9 | LL | pub enum Enum { | ^^^^^^^^^^^^^ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:34:13 + --> $DIR/effective_visibilities.rs:35:13 | LL | A( | ^ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:34:13 + --> $DIR/effective_visibilities.rs:35:13 | LL | A( | ^ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:37:17 + --> $DIR/effective_visibilities.rs:38:17 | LL | PubUnion, | ^^^^^^^^ error: not in the table - --> $DIR/effective_visibilities.rs:43:5 + --> $DIR/effective_visibilities.rs:44:5 | LL | macro_rules! none_macro { | ^^^^^^^^^^^^^^^^^^^^^^^ error: Direct: pub(self), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:49:5 + --> $DIR/effective_visibilities.rs:50:5 | LL | macro_rules! public_macro { | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: Direct: pub(crate), Reexported: pub(crate), Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:54:5 + --> $DIR/effective_visibilities.rs:55:5 | LL | pub struct ReachableStruct { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: Direct: pub(crate), Reexported: pub(crate), Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:56:9 + --> $DIR/effective_visibilities.rs:57:9 | LL | pub a: u8, | ^^^^^^^^^ error: Direct: pub, Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:61:9 + --> $DIR/effective_visibilities.rs:62:9 | LL | pub use outer::inner1; | ^^^^^^^^^^^^^ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:67:5 + --> $DIR/effective_visibilities.rs:68:5 | LL | pub type HalfPublicImport = u8; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: Direct: pub(crate), Reexported: pub(crate), Reachable: pub(crate), ReachableThroughImplTrait: pub(crate) - --> $DIR/effective_visibilities.rs:70:5 + --> $DIR/effective_visibilities.rs:71:5 | LL | pub(crate) const HalfPublicImport: u8 = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: Direct: pub, Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:74:9 + --> $DIR/effective_visibilities.rs:75:9 | LL | pub use half_public_import::HalfPublicImport; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:14:13 + --> $DIR/effective_visibilities.rs:15:13 | LL | const A: i32; | ^^^^^^^^^^^^ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:16:13 + --> $DIR/effective_visibilities.rs:17:13 | LL | type B; | ^^^^^^ -error: aborting due to 23 previous errors +error: aborting due to 24 previous errors diff --git a/tests/ui/privacy/issue-29161.rs b/tests/ui/privacy/issue-29161.rs index d80405aa8..5c926dee0 100644 --- a/tests/ui/privacy/issue-29161.rs +++ b/tests/ui/privacy/issue-29161.rs @@ -2,7 +2,7 @@ mod a { struct A; impl Default for A { - pub fn default() -> A { //~ ERROR unnecessary visibility qualifier + pub fn default() -> A { //~ ERROR visibility qualifiers are not permitted here A } } diff --git a/tests/ui/privacy/issue-29161.stderr b/tests/ui/privacy/issue-29161.stderr index 7ce95e4b0..1a6c80499 100644 --- a/tests/ui/privacy/issue-29161.stderr +++ b/tests/ui/privacy/issue-29161.stderr @@ -1,8 +1,10 @@ -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/issue-29161.rs:5:9 | LL | pub fn default() -> A { - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait error[E0603]: struct `A` is private --> $DIR/issue-29161.rs:13:8 diff --git a/tests/ui/privacy/priv-in-bad-locations.rs b/tests/ui/privacy/priv-in-bad-locations.rs index 76af8c6cd..32c5b801f 100644 --- a/tests/ui/privacy/priv-in-bad-locations.rs +++ b/tests/ui/privacy/priv-in-bad-locations.rs @@ -1,4 +1,4 @@ -pub extern "C" { //~ ERROR unnecessary visibility qualifier +pub extern "C" { //~ ERROR visibility qualifiers are not permitted here pub fn bar(); } @@ -8,10 +8,10 @@ trait A { struct B; -pub impl B {} //~ ERROR unnecessary visibility qualifier +pub impl B {} //~ ERROR visibility qualifiers are not permitted here -pub impl A for B { //~ ERROR unnecessary visibility qualifier - pub fn foo(&self) {} //~ ERROR unnecessary visibility qualifier +pub impl A for B { //~ ERROR visibility qualifiers are not permitted here + pub fn foo(&self) {} //~ ERROR visibility qualifiers are not permitted here } pub fn main() {} diff --git a/tests/ui/privacy/priv-in-bad-locations.stderr b/tests/ui/privacy/priv-in-bad-locations.stderr index 75bd2fe47..70dab5bfe 100644 --- a/tests/ui/privacy/priv-in-bad-locations.stderr +++ b/tests/ui/privacy/priv-in-bad-locations.stderr @@ -1,30 +1,34 @@ -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/priv-in-bad-locations.rs:1:1 | LL | pub extern "C" { - | ^^^ `pub` not permitted here because it's implied + | ^^^ | = note: place qualifiers on individual foreign items instead -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/priv-in-bad-locations.rs:11:1 | LL | pub impl B {} - | ^^^ `pub` not permitted here because it's implied + | ^^^ | = note: place qualifiers on individual impl items instead -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/priv-in-bad-locations.rs:13:1 | LL | pub impl A for B { - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/priv-in-bad-locations.rs:14:5 | LL | pub fn foo(&self) {} - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait error: aborting due to 4 previous errors diff --git a/tests/ui/privacy/privacy-ns1.stderr b/tests/ui/privacy/privacy-ns1.stderr index 91bc84e70..9710cc486 100644 --- a/tests/ui/privacy/privacy-ns1.stderr +++ b/tests/ui/privacy/privacy-ns1.stderr @@ -13,7 +13,7 @@ LL | Baz(); | ~~~ help: consider importing this function instead | -LL | use foo2::Bar; +LL + use foo2::Bar; | error[E0425]: cannot find function, tuple struct or tuple variant `Bar` in this scope @@ -31,7 +31,7 @@ LL | Baz(); | ~~~ help: consider importing this function | -LL | use foo2::Bar; +LL + use foo2::Bar; | error[E0412]: cannot find type `Bar` in this scope @@ -49,7 +49,7 @@ LL | let _x: Box; | ~~~ help: consider importing this trait | -LL | use foo1::Bar; +LL + use foo1::Bar; | error[E0747]: constant provided when a type was expected diff --git a/tests/ui/privacy/privacy-ns2.stderr b/tests/ui/privacy/privacy-ns2.stderr index 904e9013f..75e735e1e 100644 --- a/tests/ui/privacy/privacy-ns2.stderr +++ b/tests/ui/privacy/privacy-ns2.stderr @@ -6,7 +6,7 @@ LL | Bar(); | help: consider importing this function instead | -LL | use foo2::Bar; +LL + use foo2::Bar; | error[E0423]: expected function, tuple struct or tuple variant, found trait `Bar` @@ -24,7 +24,7 @@ LL | Baz(); | ~~~ help: consider importing this function instead | -LL | use foo2::Bar; +LL + use foo2::Bar; | error[E0573]: expected type, found function `Bar` @@ -39,7 +39,7 @@ LL | let _x = Bar(); | ~ help: consider importing this trait instead | -LL | use foo1::Bar; +LL + use foo1::Bar; | error[E0603]: trait `Bar` is private diff --git a/tests/ui/privacy/privacy-sanity.rs b/tests/ui/privacy/privacy-sanity.rs index 8bbf1ab5d..6622089dd 100644 --- a/tests/ui/privacy/privacy-sanity.rs +++ b/tests/ui/privacy/privacy-sanity.rs @@ -10,17 +10,17 @@ pub struct S { } struct Ts(pub u8); -pub impl Tr for S { //~ ERROR unnecessary visibility qualifier - pub fn f() {} //~ ERROR unnecessary visibility qualifier - pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier - pub type T = u8; //~ ERROR unnecessary visibility qualifier +pub impl Tr for S { //~ ERROR visibility qualifiers are not permitted here + pub fn f() {} //~ ERROR visibility qualifiers are not permitted here + pub const C: u8 = 0; //~ ERROR visibility qualifiers are not permitted here + pub type T = u8; //~ ERROR visibility qualifiers are not permitted here } -pub impl S { //~ ERROR unnecessary visibility qualifier +pub impl S { //~ ERROR visibility qualifiers are not permitted here pub fn f() {} pub const C: u8 = 0; // pub type T = u8; } -pub extern "C" { //~ ERROR unnecessary visibility qualifier +pub extern "C" { //~ ERROR visibility qualifiers are not permitted here pub fn f(); pub static St: u8; } @@ -36,17 +36,17 @@ const MAIN: u8 = { } struct Ts(pub u8); - pub impl Tr for S { //~ ERROR unnecessary visibility qualifier - pub fn f() {} //~ ERROR unnecessary visibility qualifier - pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier - pub type T = u8; //~ ERROR unnecessary visibility qualifier + pub impl Tr for S { //~ ERROR visibility qualifiers are not permitted here + pub fn f() {} //~ ERROR visibility qualifiers are not permitted here + pub const C: u8 = 0; //~ ERROR visibility qualifiers are not permitted here + pub type T = u8; //~ ERROR visibility qualifiers are not permitted here } - pub impl S { //~ ERROR unnecessary visibility qualifier + pub impl S { //~ ERROR visibility qualifiers are not permitted here pub fn f() {} pub const C: u8 = 0; // pub type T = u8; } - pub extern "C" { //~ ERROR unnecessary visibility qualifier + pub extern "C" { //~ ERROR visibility qualifiers are not permitted here pub fn f(); pub static St: u8; } @@ -65,17 +65,17 @@ fn main() { } struct Ts(pub u8); - pub impl Tr for S { //~ ERROR unnecessary visibility qualifier - pub fn f() {} //~ ERROR unnecessary visibility qualifier - pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier - pub type T = u8; //~ ERROR unnecessary visibility qualifier + pub impl Tr for S { //~ ERROR visibility qualifiers are not permitted here + pub fn f() {} //~ ERROR visibility qualifiers are not permitted here + pub const C: u8 = 0; //~ ERROR visibility qualifiers are not permitted here + pub type T = u8; //~ ERROR visibility qualifiers are not permitted here } - pub impl S { //~ ERROR unnecessary visibility qualifier + pub impl S { //~ ERROR visibility qualifiers are not permitted here pub fn f() {} pub const C: u8 = 0; // pub type T = u8; } - pub extern "C" { //~ ERROR unnecessary visibility qualifier + pub extern "C" { //~ ERROR visibility qualifiers are not permitted here pub fn f(); pub static St: u8; } diff --git a/tests/ui/privacy/privacy-sanity.stderr b/tests/ui/privacy/privacy-sanity.stderr index c92553fd1..a537f8c19 100644 --- a/tests/ui/privacy/privacy-sanity.stderr +++ b/tests/ui/privacy/privacy-sanity.stderr @@ -1,120 +1,144 @@ -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:13:1 | LL | pub impl Tr for S { - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:14:5 | LL | pub fn f() {} - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:15:5 | LL | pub const C: u8 = 0; - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:16:5 | LL | pub type T = u8; - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:18:1 | LL | pub impl S { - | ^^^ `pub` not permitted here because it's implied + | ^^^ | = note: place qualifiers on individual impl items instead -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:23:1 | LL | pub extern "C" { - | ^^^ `pub` not permitted here because it's implied + | ^^^ | = note: place qualifiers on individual foreign items instead -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:39:5 | LL | pub impl Tr for S { - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:40:9 | LL | pub fn f() {} - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:41:9 | LL | pub const C: u8 = 0; - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:42:9 | LL | pub type T = u8; - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:44:5 | LL | pub impl S { - | ^^^ `pub` not permitted here because it's implied + | ^^^ | = note: place qualifiers on individual impl items instead -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:49:5 | LL | pub extern "C" { - | ^^^ `pub` not permitted here because it's implied + | ^^^ | = note: place qualifiers on individual foreign items instead -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:68:5 | LL | pub impl Tr for S { - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:69:9 | LL | pub fn f() {} - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:70:9 | LL | pub const C: u8 = 0; - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:71:9 | LL | pub type T = u8; - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:73:5 | LL | pub impl S { - | ^^^ `pub` not permitted here because it's implied + | ^^^ | = note: place qualifiers on individual impl items instead -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:78:5 | LL | pub extern "C" { - | ^^^ `pub` not permitted here because it's implied + | ^^^ | = note: place qualifiers on individual foreign items instead diff --git a/tests/ui/privacy/private-in-public-assoc-ty.rs b/tests/ui/privacy/private-in-public-assoc-ty.rs index fba72c131..d4d379bdb 100644 --- a/tests/ui/privacy/private-in-public-assoc-ty.rs +++ b/tests/ui/privacy/private-in-public-assoc-ty.rs @@ -2,7 +2,7 @@ // This test also ensures that the checks are performed even inside private modules. #![feature(associated_type_defaults)] -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] mod m { struct Priv; diff --git a/tests/ui/privacy/private-in-public-type-alias-impl-trait.rs b/tests/ui/privacy/private-in-public-type-alias-impl-trait.rs index c7df31529..fe6ed4673 100644 --- a/tests/ui/privacy/private-in-public-type-alias-impl-trait.rs +++ b/tests/ui/privacy/private-in-public-type-alias-impl-trait.rs @@ -1,5 +1,5 @@ // build-pass (FIXME(62277): could be check-pass?) - +#![feature(impl_trait_in_assoc_type)] #![feature(type_alias_impl_trait)] #![deny(private_in_public)] diff --git a/tests/ui/privacy/useless-pub.rs b/tests/ui/privacy/useless-pub.rs index fde7cd5d8..e4b671142 100644 --- a/tests/ui/privacy/useless-pub.rs +++ b/tests/ui/privacy/useless-pub.rs @@ -5,12 +5,12 @@ pub trait E { } impl E for A { - pub fn foo(&self) {} //~ ERROR: unnecessary visibility qualifier + pub fn foo(&self) {} //~ ERROR: visibility qualifiers are not permitted here } enum Foo { - V1 { pub f: i32 }, //~ ERROR unnecessary visibility qualifier - V2(pub i32), //~ ERROR unnecessary visibility qualifier + V1 { pub f: i32 }, //~ ERROR visibility qualifiers are not permitted here + V2(pub i32), //~ ERROR visibility qualifiers are not permitted here } fn main() {} diff --git a/tests/ui/privacy/useless-pub.stderr b/tests/ui/privacy/useless-pub.stderr index 14c4983ae..73497e3fe 100644 --- a/tests/ui/privacy/useless-pub.stderr +++ b/tests/ui/privacy/useless-pub.stderr @@ -1,20 +1,26 @@ -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/useless-pub.rs:8:5 | LL | pub fn foo(&self) {} - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/useless-pub.rs:12:10 | LL | V1 { pub f: i32 }, - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: enum variants and their fields always share the visibility of the enum they are in -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/useless-pub.rs:13:8 | LL | V2(pub i32), - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: enum variants and their fields always share the visibility of the enum they are in error: aborting due to 3 previous errors diff --git a/tests/ui/privacy/xc-private-method.rs b/tests/ui/privacy/xc-private-method.rs new file mode 100644 index 000000000..f05994646 --- /dev/null +++ b/tests/ui/privacy/xc-private-method.rs @@ -0,0 +1,11 @@ +// aux-build:xc-private-method-lib.rs + +extern crate xc_private_method_lib; + +fn main() { + let _ = xc_private_method_lib::Struct::static_meth_struct(); + //~^ ERROR: associated function `static_meth_struct` is private + + let _ = xc_private_method_lib::Enum::static_meth_enum(); + //~^ ERROR: associated function `static_meth_enum` is private +} diff --git a/tests/ui/privacy/xc-private-method.stderr b/tests/ui/privacy/xc-private-method.stderr new file mode 100644 index 000000000..0eabc592a --- /dev/null +++ b/tests/ui/privacy/xc-private-method.stderr @@ -0,0 +1,25 @@ +error[E0624]: associated function `static_meth_struct` is private + --> $DIR/xc-private-method.rs:6:44 + | +LL | let _ = xc_private_method_lib::Struct::static_meth_struct(); + | ^^^^^^^^^^^^^^^^^^ private associated function + | + ::: $DIR/auxiliary/xc-private-method-lib.rs:8:5 + | +LL | fn static_meth_struct() -> Struct { + | --------------------------------- private associated function defined here + +error[E0624]: associated function `static_meth_enum` is private + --> $DIR/xc-private-method.rs:9:42 + | +LL | let _ = xc_private_method_lib::Enum::static_meth_enum(); + | ^^^^^^^^^^^^^^^^ private associated function + | + ::: $DIR/auxiliary/xc-private-method-lib.rs:23:5 + | +LL | fn static_meth_enum() -> Enum { + | ----------------------------- private associated function defined here + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0624`. diff --git a/tests/ui/privacy/xc-private-method2.rs b/tests/ui/privacy/xc-private-method2.rs new file mode 100644 index 000000000..f11b25108 --- /dev/null +++ b/tests/ui/privacy/xc-private-method2.rs @@ -0,0 +1,11 @@ +// aux-build:xc-private-method-lib.rs + +extern crate xc_private_method_lib; + +fn main() { + let _ = xc_private_method_lib::Struct{ x: 10 }.meth_struct(); + //~^ ERROR method `meth_struct` is private + + let _ = xc_private_method_lib::Enum::Variant1(20).meth_enum(); + //~^ ERROR method `meth_enum` is private +} diff --git a/tests/ui/privacy/xc-private-method2.stderr b/tests/ui/privacy/xc-private-method2.stderr new file mode 100644 index 000000000..af0c3cfcb --- /dev/null +++ b/tests/ui/privacy/xc-private-method2.stderr @@ -0,0 +1,25 @@ +error[E0624]: method `meth_struct` is private + --> $DIR/xc-private-method2.rs:6:52 + | +LL | let _ = xc_private_method_lib::Struct{ x: 10 }.meth_struct(); + | ^^^^^^^^^^^ private method + | + ::: $DIR/auxiliary/xc-private-method-lib.rs:12:5 + | +LL | fn meth_struct(&self) -> isize { + | ------------------------------ private method defined here + +error[E0624]: method `meth_enum` is private + --> $DIR/xc-private-method2.rs:9:55 + | +LL | let _ = xc_private_method_lib::Enum::Variant1(20).meth_enum(); + | ^^^^^^^^^ private method + | + ::: $DIR/auxiliary/xc-private-method-lib.rs:27:5 + | +LL | fn meth_enum(&self) -> isize { + | ---------------------------- private method defined here + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0624`. diff --git a/tests/ui/proc-macro/amputate-span.stderr b/tests/ui/proc-macro/amputate-span.stderr index ab4670411..aa797339b 100644 --- a/tests/ui/proc-macro/amputate-span.stderr +++ b/tests/ui/proc-macro/amputate-span.stderr @@ -6,7 +6,7 @@ LL | Command::new("git"); | help: consider importing this struct | -LL | use std::process::Command; +LL + use std::process::Command; | error[E0433]: failed to resolve: use of undeclared type `Command` @@ -17,7 +17,7 @@ LL | Command::new("git"); | help: consider importing this struct | -LL | use std::process::Command; +LL + use std::process::Command; | error: aborting due to 2 previous errors diff --git a/tests/ui/proc-macro/attributes-on-modules-fail.stderr b/tests/ui/proc-macro/attributes-on-modules-fail.stderr index bb6cbb698..97521f23a 100644 --- a/tests/ui/proc-macro/attributes-on-modules-fail.stderr +++ b/tests/ui/proc-macro/attributes-on-modules-fail.stderr @@ -50,7 +50,7 @@ LL | type A = Y; | help: consider importing this struct | -LL | use Y; +LL + use Y; | error[E0412]: cannot find type `X` in this scope @@ -61,7 +61,7 @@ LL | type A = X; | help: consider importing this struct | -LL | use m::X; +LL + use m::X; | error: aborting due to 7 previous errors diff --git a/tests/ui/proc-macro/bad-projection.rs b/tests/ui/proc-macro/bad-projection.rs new file mode 100644 index 000000000..d214c7ac8 --- /dev/null +++ b/tests/ui/proc-macro/bad-projection.rs @@ -0,0 +1,15 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![allow(warnings)] + +extern crate proc_macro; + +trait Project { + type Assoc; +} + +#[proc_macro] +pub fn uwu() -> <() as Project>::Assoc {} +//~^ ERROR the trait bound `(): Project` is not satisfied diff --git a/tests/ui/proc-macro/bad-projection.stderr b/tests/ui/proc-macro/bad-projection.stderr new file mode 100644 index 000000000..8a8246376 --- /dev/null +++ b/tests/ui/proc-macro/bad-projection.stderr @@ -0,0 +1,9 @@ +error[E0277]: the trait bound `(): Project` is not satisfied + --> $DIR/bad-projection.rs:14:17 + | +LL | pub fn uwu() -> <() as Project>::Assoc {} + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Project` is not implemented for `()` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/proc-macro/derive-bad.rs b/tests/ui/proc-macro/derive-bad.rs index cb5188b5f..92d35f537 100644 --- a/tests/ui/proc-macro/derive-bad.rs +++ b/tests/ui/proc-macro/derive-bad.rs @@ -4,7 +4,7 @@ extern crate derive_bad; #[derive(A)] -//~^ ERROR proc-macro derive produced unparseable tokens +//~^ ERROR proc-macro derive produced unparsable tokens //~| ERROR expected `:`, found `}` struct A; //~ ERROR the name `A` is defined multiple times diff --git a/tests/ui/proc-macro/derive-bad.stderr b/tests/ui/proc-macro/derive-bad.stderr index 241f99b28..43e97f40b 100644 --- a/tests/ui/proc-macro/derive-bad.stderr +++ b/tests/ui/proc-macro/derive-bad.stderr @@ -9,7 +9,7 @@ LL | #[derive(A)] | = note: this error originates in the derive macro `A` (in Nightly builds, run with -Z macro-backtrace for more info) -error: proc-macro derive produced unparseable tokens +error: proc-macro derive produced unparsable tokens --> $DIR/derive-bad.rs:6:10 | LL | #[derive(A)] diff --git a/tests/ui/proc-macro/issue-91800.rs b/tests/ui/proc-macro/issue-91800.rs index 0c1281de4..f48c8bf72 100644 --- a/tests/ui/proc-macro/issue-91800.rs +++ b/tests/ui/proc-macro/issue-91800.rs @@ -5,7 +5,7 @@ extern crate issue_91800_macro; #[derive(MyTrait)] //~^ ERROR macros that expand to items must be delimited with braces or followed by a semicolon -//~| ERROR proc-macro derive produced unparseable tokens +//~| ERROR proc-macro derive produced unparsable tokens #[attribute_macro] //~^ ERROR macros that expand to items must be delimited with braces or followed by a semicolon struct MyStruct; diff --git a/tests/ui/proc-macro/issue-91800.stderr b/tests/ui/proc-macro/issue-91800.stderr index 9c356263a..d831d62e9 100644 --- a/tests/ui/proc-macro/issue-91800.stderr +++ b/tests/ui/proc-macro/issue-91800.stderr @@ -6,7 +6,7 @@ LL | #[derive(MyTrait)] | = note: this error originates in the derive macro `MyTrait` (in Nightly builds, run with -Z macro-backtrace for more info) -error: proc-macro derive produced unparseable tokens +error: proc-macro derive produced unparsable tokens --> $DIR/issue-91800.rs:6:10 | LL | #[derive(MyTrait)] diff --git a/tests/ui/proc-macro/macro-namespace-reserved-2.stderr b/tests/ui/proc-macro/macro-namespace-reserved-2.stderr index 633a6c6a0..b9effe7cf 100644 --- a/tests/ui/proc-macro/macro-namespace-reserved-2.stderr +++ b/tests/ui/proc-macro/macro-namespace-reserved-2.stderr @@ -57,6 +57,14 @@ error: expected derive macro, found attribute macro `my_macro_attr` | LL | #[derive(my_macro_attr)] | ^^^^^^^^^^^^^ not a derive macro + | +help: remove from the surrounding `derive()` + --> $DIR/macro-namespace-reserved-2.rs:53:10 + | +LL | #[derive(my_macro_attr)] + | ^^^^^^^^^^^^^ + = help: add as non-Derive macro + `#[my_macro_attr]` error: can't use a procedural macro from the same crate that defines it --> $DIR/macro-namespace-reserved-2.rs:56:10 @@ -87,6 +95,14 @@ error: expected derive macro, found macro `crate::my_macro` | LL | #[derive(crate::my_macro)] | ^^^^^^^^^^^^^^^ not a derive macro + | +help: remove from the surrounding `derive()` + --> $DIR/macro-namespace-reserved-2.rs:50:10 + | +LL | #[derive(crate::my_macro)] + | ^^^^^^^^^^^^^^^ + = help: add as non-Derive macro + `#[crate::my_macro]` error: cannot find macro `my_macro_attr` in this scope --> $DIR/macro-namespace-reserved-2.rs:28:5 diff --git a/tests/ui/proc-macro/proc-macro-abi.rs b/tests/ui/proc-macro/proc-macro-abi.rs index 873660a5b..93a613e8b 100644 --- a/tests/ui/proc-macro/proc-macro-abi.rs +++ b/tests/ui/proc-macro/proc-macro-abi.rs @@ -9,19 +9,19 @@ use proc_macro::TokenStream; #[proc_macro] pub extern "C" fn abi(a: TokenStream) -> TokenStream { - //~^ ERROR proc macro functions may not be `extern "C"` + //~^ ERROR function-like proc macro has incorrect signature a } #[proc_macro] pub extern "system" fn abi2(a: TokenStream) -> TokenStream { - //~^ ERROR proc macro functions may not be `extern "system"` + //~^ ERROR function-like proc macro has incorrect signature a } #[proc_macro] pub extern fn abi3(a: TokenStream) -> TokenStream { - //~^ ERROR proc macro functions may not be `extern "C"` + //~^ ERROR function-like proc macro has incorrect signature a } diff --git a/tests/ui/proc-macro/proc-macro-abi.stderr b/tests/ui/proc-macro/proc-macro-abi.stderr index 9a781be09..ccc72e518 100644 --- a/tests/ui/proc-macro/proc-macro-abi.stderr +++ b/tests/ui/proc-macro/proc-macro-abi.stderr @@ -1,20 +1,29 @@ -error: proc macro functions may not be `extern "C"` +error: function-like proc macro has incorrect signature --> $DIR/proc-macro-abi.rs:11:1 | LL | pub extern "C" fn abi(a: TokenStream) -> TokenStream { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected "Rust" fn, found "C" fn + | + = note: expected signature `fn(proc_macro::TokenStream) -> proc_macro::TokenStream` + found signature `extern "C" fn(proc_macro::TokenStream) -> proc_macro::TokenStream` -error: proc macro functions may not be `extern "system"` +error: function-like proc macro has incorrect signature --> $DIR/proc-macro-abi.rs:17:1 | LL | pub extern "system" fn abi2(a: TokenStream) -> TokenStream { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected "Rust" fn, found "system" fn + | + = note: expected signature `fn(proc_macro::TokenStream) -> proc_macro::TokenStream` + found signature `extern "system" fn(proc_macro::TokenStream) -> proc_macro::TokenStream` -error: proc macro functions may not be `extern "C"` +error: function-like proc macro has incorrect signature --> $DIR/proc-macro-abi.rs:23:1 | LL | pub extern fn abi3(a: TokenStream) -> TokenStream { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected "Rust" fn, found "C" fn + | + = note: expected signature `fn(proc_macro::TokenStream) -> proc_macro::TokenStream` + found signature `extern "C" fn(proc_macro::TokenStream) -> proc_macro::TokenStream` error: aborting due to 3 previous errors diff --git a/tests/ui/proc-macro/signature-proc-macro-attribute.rs b/tests/ui/proc-macro/signature-proc-macro-attribute.rs index 51abc8e7d..fb48f748c 100644 --- a/tests/ui/proc-macro/signature-proc-macro-attribute.rs +++ b/tests/ui/proc-macro/signature-proc-macro-attribute.rs @@ -8,25 +8,23 @@ use proc_macro::TokenStream; #[proc_macro_attribute] pub fn bad_input(input: String) -> TokenStream { - //~^ ERROR mismatched attribute proc macro signature + //~^ ERROR attribute proc macro has incorrect signature ::proc_macro::TokenStream::new() } #[proc_macro_attribute] pub fn bad_output(input: TokenStream) -> String { - //~^ ERROR mismatched attribute proc macro signature - //~| ERROR mismatched attribute proc macro signature + //~^ ERROR attribute proc macro has incorrect signature String::from("blah") } #[proc_macro_attribute] pub fn bad_everything(input: String) -> String { - //~^ ERROR mismatched attribute proc macro signature - //~| ERROR mismatched attribute proc macro signature + //~^ ERROR attribute proc macro has incorrect signature input } #[proc_macro_attribute] pub fn too_many(a: TokenStream, b: TokenStream, c: String) -> TokenStream { - //~^ ERROR mismatched attribute proc macro signature + //~^ ERROR attribute proc macro has incorrect signature } diff --git a/tests/ui/proc-macro/signature-proc-macro-attribute.stderr b/tests/ui/proc-macro/signature-proc-macro-attribute.stderr index abf7a6f3c..ce832eaa5 100644 --- a/tests/ui/proc-macro/signature-proc-macro-attribute.stderr +++ b/tests/ui/proc-macro/signature-proc-macro-attribute.stderr @@ -1,42 +1,38 @@ -error: mismatched attribute proc macro signature +error: attribute proc macro has incorrect signature --> $DIR/signature-proc-macro-attribute.rs:10:1 | LL | pub fn bad_input(input: String) -> TokenStream { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attribute proc macro must have two arguments of type `proc_macro::TokenStream` - -error: mismatched attribute proc macro signature - --> $DIR/signature-proc-macro-attribute.rs:16:42 - | -LL | pub fn bad_output(input: TokenStream) -> String { - | ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters | - = note: attribute proc macros must have a signature of `fn(TokenStream, TokenStream) -> TokenStream` + = note: expected signature `fn(proc_macro::TokenStream, proc_macro::TokenStream) -> proc_macro::TokenStream` + found signature `fn(std::string::String) -> proc_macro::TokenStream` -error: mismatched attribute proc macro signature +error: attribute proc macro has incorrect signature --> $DIR/signature-proc-macro-attribute.rs:16:1 | LL | pub fn bad_output(input: TokenStream) -> String { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attribute proc macro must have two arguments of type `proc_macro::TokenStream` - -error: mismatched attribute proc macro signature - --> $DIR/signature-proc-macro-attribute.rs:23:41 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters | -LL | pub fn bad_everything(input: String) -> String { - | ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream` - | - = note: attribute proc macros must have a signature of `fn(TokenStream, TokenStream) -> TokenStream` + = note: expected signature `fn(proc_macro::TokenStream, proc_macro::TokenStream) -> proc_macro::TokenStream` + found signature `fn(proc_macro::TokenStream) -> std::string::String` -error: mismatched attribute proc macro signature - --> $DIR/signature-proc-macro-attribute.rs:23:1 +error: attribute proc macro has incorrect signature + --> $DIR/signature-proc-macro-attribute.rs:22:1 | LL | pub fn bad_everything(input: String) -> String { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attribute proc macro must have two arguments of type `proc_macro::TokenStream` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters + | + = note: expected signature `fn(proc_macro::TokenStream, proc_macro::TokenStream) -> proc_macro::TokenStream` + found signature `fn(std::string::String) -> std::string::String` -error: mismatched attribute proc macro signature - --> $DIR/signature-proc-macro-attribute.rs:30:49 +error: attribute proc macro has incorrect signature + --> $DIR/signature-proc-macro-attribute.rs:28:52 | LL | pub fn too_many(a: TokenStream, b: TokenStream, c: String) -> TokenStream { - | ^^^^^^^^^ found unexpected argument + | ^^^^^^ incorrect number of function parameters + | + = note: expected signature `fn(proc_macro::TokenStream, proc_macro::TokenStream) -> proc_macro::TokenStream` + found signature `fn(proc_macro::TokenStream, proc_macro::TokenStream, std::string::String) -> proc_macro::TokenStream` -error: aborting due to 6 previous errors +error: aborting due to 4 previous errors diff --git a/tests/ui/proc-macro/signature-proc-macro-derive.rs b/tests/ui/proc-macro/signature-proc-macro-derive.rs index f2fd824b6..d294b1591 100644 --- a/tests/ui/proc-macro/signature-proc-macro-derive.rs +++ b/tests/ui/proc-macro/signature-proc-macro-derive.rs @@ -8,24 +8,23 @@ use proc_macro::TokenStream; #[proc_macro_derive(Blah)] pub fn bad_input(input: String) -> TokenStream { - //~^ ERROR mismatched derive proc macro signature + //~^ ERROR derive proc macro has incorrect signature TokenStream::new() } #[proc_macro_derive(Bleh)] pub fn bad_output(input: TokenStream) -> String { - //~^ ERROR mismatched derive proc macro signature + //~^ ERROR derive proc macro has incorrect signature String::from("blah") } #[proc_macro_derive(Bluh)] pub fn bad_everything(input: String) -> String { - //~^ ERROR mismatched derive proc macro signature - //~| ERROR mismatched derive proc macro signature + //~^ ERROR derive proc macro has incorrect signature input } #[proc_macro_derive(Blih)] pub fn too_many(a: TokenStream, b: TokenStream, c: String) -> TokenStream { - //~^ ERROR mismatched derive proc macro signature + //~^ ERROR derive proc macro has incorrect signature } diff --git a/tests/ui/proc-macro/signature-proc-macro-derive.stderr b/tests/ui/proc-macro/signature-proc-macro-derive.stderr index a358ae277..03c6abad1 100644 --- a/tests/ui/proc-macro/signature-proc-macro-derive.stderr +++ b/tests/ui/proc-macro/signature-proc-macro-derive.stderr @@ -1,40 +1,38 @@ -error: mismatched derive proc macro signature +error: derive proc macro has incorrect signature --> $DIR/signature-proc-macro-derive.rs:10:25 | LL | pub fn bad_input(input: String) -> TokenStream { - | ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream` + | ^^^^^^ expected `proc_macro::TokenStream`, found `std::string::String` | - = note: derive proc macros must have a signature of `fn(TokenStream) -> TokenStream` + = note: expected signature `fn(proc_macro::TokenStream) -> proc_macro::TokenStream` + found signature `fn(std::string::String) -> proc_macro::TokenStream` -error: mismatched derive proc macro signature +error: derive proc macro has incorrect signature --> $DIR/signature-proc-macro-derive.rs:16:42 | LL | pub fn bad_output(input: TokenStream) -> String { - | ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream` + | ^^^^^^ expected `proc_macro::TokenStream`, found `std::string::String` | - = note: derive proc macros must have a signature of `fn(TokenStream) -> TokenStream` + = note: expected signature `fn(proc_macro::TokenStream) -> proc_macro::TokenStream` + found signature `fn(proc_macro::TokenStream) -> std::string::String` -error: mismatched derive proc macro signature - --> $DIR/signature-proc-macro-derive.rs:22:41 - | -LL | pub fn bad_everything(input: String) -> String { - | ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream` - | - = note: derive proc macros must have a signature of `fn(TokenStream) -> TokenStream` - -error: mismatched derive proc macro signature +error: derive proc macro has incorrect signature --> $DIR/signature-proc-macro-derive.rs:22:30 | LL | pub fn bad_everything(input: String) -> String { - | ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream` + | ^^^^^^ expected `proc_macro::TokenStream`, found `std::string::String` | - = note: derive proc macros must have a signature of `fn(TokenStream) -> TokenStream` + = note: expected signature `fn(proc_macro::TokenStream) -> proc_macro::TokenStream` + found signature `fn(std::string::String) -> std::string::String` -error: mismatched derive proc macro signature - --> $DIR/signature-proc-macro-derive.rs:29:33 +error: derive proc macro has incorrect signature + --> $DIR/signature-proc-macro-derive.rs:28:36 | LL | pub fn too_many(a: TokenStream, b: TokenStream, c: String) -> TokenStream { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ found unexpected arguments + | ^^^^^^^^^^^ incorrect number of function parameters + | + = note: expected signature `fn(proc_macro::TokenStream) -> proc_macro::TokenStream` + found signature `fn(proc_macro::TokenStream, proc_macro::TokenStream, std::string::String) -> proc_macro::TokenStream` -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors diff --git a/tests/ui/proc-macro/signature-proc-macro.rs b/tests/ui/proc-macro/signature-proc-macro.rs index 54770aacd..ca2509ed8 100644 --- a/tests/ui/proc-macro/signature-proc-macro.rs +++ b/tests/ui/proc-macro/signature-proc-macro.rs @@ -8,24 +8,23 @@ use proc_macro::TokenStream; #[proc_macro] pub fn bad_input(input: String) -> TokenStream { - //~^ ERROR mismatched function-like proc macro signature + //~^ ERROR function-like proc macro has incorrect signature ::proc_macro::TokenStream::new() } #[proc_macro] pub fn bad_output(input: TokenStream) -> String { - //~^ ERROR mismatched function-like proc macro signature + //~^ ERROR function-like proc macro has incorrect signature String::from("blah") } #[proc_macro] pub fn bad_everything(input: String) -> String { - //~^ ERROR mismatched function-like proc macro signature - //~| ERROR mismatched function-like proc macro signature + //~^ ERROR function-like proc macro has incorrect signature input } #[proc_macro] pub fn too_many(a: TokenStream, b: TokenStream, c: String) -> TokenStream { - //~^ ERROR mismatched function-like proc macro signature + //~^ ERROR function-like proc macro has incorrect signature } diff --git a/tests/ui/proc-macro/signature-proc-macro.stderr b/tests/ui/proc-macro/signature-proc-macro.stderr index 4b14a54e6..dd2cb0570 100644 --- a/tests/ui/proc-macro/signature-proc-macro.stderr +++ b/tests/ui/proc-macro/signature-proc-macro.stderr @@ -1,40 +1,38 @@ -error: mismatched function-like proc macro signature +error: function-like proc macro has incorrect signature --> $DIR/signature-proc-macro.rs:10:25 | LL | pub fn bad_input(input: String) -> TokenStream { - | ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream` + | ^^^^^^ expected `proc_macro::TokenStream`, found `std::string::String` | - = note: function-like proc macros must have a signature of `fn(TokenStream) -> TokenStream` + = note: expected signature `fn(proc_macro::TokenStream) -> proc_macro::TokenStream` + found signature `fn(std::string::String) -> proc_macro::TokenStream` -error: mismatched function-like proc macro signature +error: function-like proc macro has incorrect signature --> $DIR/signature-proc-macro.rs:16:42 | LL | pub fn bad_output(input: TokenStream) -> String { - | ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream` + | ^^^^^^ expected `proc_macro::TokenStream`, found `std::string::String` | - = note: function-like proc macros must have a signature of `fn(TokenStream) -> TokenStream` + = note: expected signature `fn(proc_macro::TokenStream) -> proc_macro::TokenStream` + found signature `fn(proc_macro::TokenStream) -> std::string::String` -error: mismatched function-like proc macro signature - --> $DIR/signature-proc-macro.rs:22:41 - | -LL | pub fn bad_everything(input: String) -> String { - | ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream` - | - = note: function-like proc macros must have a signature of `fn(TokenStream) -> TokenStream` - -error: mismatched function-like proc macro signature +error: function-like proc macro has incorrect signature --> $DIR/signature-proc-macro.rs:22:30 | LL | pub fn bad_everything(input: String) -> String { - | ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream` + | ^^^^^^ expected `proc_macro::TokenStream`, found `std::string::String` | - = note: function-like proc macros must have a signature of `fn(TokenStream) -> TokenStream` + = note: expected signature `fn(proc_macro::TokenStream) -> proc_macro::TokenStream` + found signature `fn(std::string::String) -> std::string::String` -error: mismatched function-like proc macro signature - --> $DIR/signature-proc-macro.rs:29:33 +error: function-like proc macro has incorrect signature + --> $DIR/signature-proc-macro.rs:28:36 | LL | pub fn too_many(a: TokenStream, b: TokenStream, c: String) -> TokenStream { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ found unexpected arguments + | ^^^^^^^^^^^ incorrect number of function parameters + | + = note: expected signature `fn(proc_macro::TokenStream) -> proc_macro::TokenStream` + found signature `fn(proc_macro::TokenStream, proc_macro::TokenStream, std::string::String) -> proc_macro::TokenStream` -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors diff --git a/tests/ui/proc-macro/signature.rs b/tests/ui/proc-macro/signature.rs index 11187aa31..7b4982a61 100644 --- a/tests/ui/proc-macro/signature.rs +++ b/tests/ui/proc-macro/signature.rs @@ -8,10 +8,6 @@ extern crate proc_macro; #[proc_macro_derive(A)] pub unsafe extern "C" fn foo(a: i32, b: u32) -> u32 { - //~^ ERROR: mismatched derive proc macro signature - //~| mismatched derive proc macro signature - //~| mismatched derive proc macro signature - //~| proc macro functions may not be `extern - //~| proc macro functions may not be `unsafe + //~^ ERROR: derive proc macro has incorrect signature loop {} } diff --git a/tests/ui/proc-macro/signature.stderr b/tests/ui/proc-macro/signature.stderr index 3dbe3f22a..ba5c8c157 100644 --- a/tests/ui/proc-macro/signature.stderr +++ b/tests/ui/proc-macro/signature.stderr @@ -1,36 +1,11 @@ -error: proc macro functions may not be `extern "C"` +error: derive proc macro has incorrect signature --> $DIR/signature.rs:10:1 | LL | pub unsafe extern "C" fn foo(a: i32, b: u32) -> u32 { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: proc macro functions may not be `unsafe` - --> $DIR/signature.rs:10:1 - | -LL | pub unsafe extern "C" fn foo(a: i32, b: u32) -> u32 { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: mismatched derive proc macro signature - --> $DIR/signature.rs:10:49 - | -LL | pub unsafe extern "C" fn foo(a: i32, b: u32) -> u32 { - | ^^^ found u32, expected type `proc_macro::TokenStream` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected normal fn, found unsafe fn | - = note: derive proc macros must have a signature of `fn(TokenStream) -> TokenStream` - -error: mismatched derive proc macro signature - --> $DIR/signature.rs:10:33 - | -LL | pub unsafe extern "C" fn foo(a: i32, b: u32) -> u32 { - | ^^^ found i32, expected type `proc_macro::TokenStream` - | - = note: derive proc macros must have a signature of `fn(TokenStream) -> TokenStream` - -error: mismatched derive proc macro signature - --> $DIR/signature.rs:10:38 - | -LL | pub unsafe extern "C" fn foo(a: i32, b: u32) -> u32 { - | ^^^^^^ found unexpected argument + = note: expected signature `fn(proc_macro::TokenStream) -> proc_macro::TokenStream` + found signature `unsafe extern "C" fn(i32, u32) -> u32` -error: aborting due to 5 previous errors +error: aborting due to previous error diff --git a/tests/ui/proc-macro/span-api-tests.rs b/tests/ui/proc-macro/span-api-tests.rs index 3f04ba866..7493f9cdb 100644 --- a/tests/ui/proc-macro/span-api-tests.rs +++ b/tests/ui/proc-macro/span-api-tests.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty // aux-build:span-api-tests.rs // aux-build:span-test-macros.rs // compile-flags: -Ztranslate-remapped-path-to-local-path=yes diff --git a/tests/ui/process/signal-exit-status.rs b/tests/ui/process/signal-exit-status.rs index 9519ed7b4..0f05f916c 100644 --- a/tests/ui/process/signal-exit-status.rs +++ b/tests/ui/process/signal-exit-status.rs @@ -4,14 +4,16 @@ // ignore-windows // ignore-fuchsia code returned as ZX_TASK_RETCODE_EXCEPTION_KILL, FIXME (#58590) +#![feature(core_intrinsics)] + use std::env; use std::process::Command; pub fn main() { let args: Vec = env::args().collect(); if args.len() >= 2 && args[1] == "signal" { - // Raise a segfault. - unsafe { *(1 as *mut isize) = 0; } + // Raise an aborting signal without UB + core::intrinsics::abort(); } else { let status = Command::new(&args[0]).arg("signal").status().unwrap(); assert!(status.code().is_none()); diff --git a/tests/ui/range/range-pattern-out-of-bounds-issue-68972.rs b/tests/ui/range/range-pattern-out-of-bounds-issue-68972.rs index d02caff1f..206f05d0d 100644 --- a/tests/ui/range/range-pattern-out-of-bounds-issue-68972.rs +++ b/tests/ui/range/range-pattern-out-of-bounds-issue-68972.rs @@ -4,10 +4,8 @@ fn main() { match 0u8 { 251..257 => {} //~^ ERROR literal out of range - //~| ERROR literal out of range 251..=256 => {} //~^ ERROR literal out of range - //~| ERROR literal out of range _ => {} } } diff --git a/tests/ui/range/range-pattern-out-of-bounds-issue-68972.stderr b/tests/ui/range/range-pattern-out-of-bounds-issue-68972.stderr index 7b8309b9b..4f3f9d1eb 100644 --- a/tests/ui/range/range-pattern-out-of-bounds-issue-68972.stderr +++ b/tests/ui/range/range-pattern-out-of-bounds-issue-68972.stderr @@ -5,22 +5,10 @@ LL | 251..257 => {} | ^^^ this value doesn't fit in `u8` whose maximum value is `255` error: literal out of range for `u8` - --> $DIR/range-pattern-out-of-bounds-issue-68972.rs:8:15 + --> $DIR/range-pattern-out-of-bounds-issue-68972.rs:7:15 | LL | 251..=256 => {} | ^^^ this value doesn't fit in `u8` whose maximum value is `255` -error: literal out of range for `u8` - --> $DIR/range-pattern-out-of-bounds-issue-68972.rs:5:14 - | -LL | 251..257 => {} - | ^^^ this value doesn't fit in `u8` whose maximum value is `255` - -error: literal out of range for `u8` - --> $DIR/range-pattern-out-of-bounds-issue-68972.rs:8:15 - | -LL | 251..=256 => {} - | ^^^ this value doesn't fit in `u8` whose maximum value is `255` - -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors diff --git a/tests/ui/range/range_traits-2.stderr b/tests/ui/range/range_traits-2.stderr index 61facba53..0829fc2ce 100644 --- a/tests/ui/range/range_traits-2.stderr +++ b/tests/ui/range/range_traits-2.stderr @@ -1,4 +1,4 @@ -error[E0204]: the trait `Copy` may not be implemented for this type +error[E0204]: the trait `Copy` cannot be implemented for this type --> $DIR/range_traits-2.rs:3:10 | LL | #[derive(Copy, Clone)] diff --git a/tests/ui/range/range_traits-3.stderr b/tests/ui/range/range_traits-3.stderr index e54d17b32..db19d1bae 100644 --- a/tests/ui/range/range_traits-3.stderr +++ b/tests/ui/range/range_traits-3.stderr @@ -1,4 +1,4 @@ -error[E0204]: the trait `Copy` may not be implemented for this type +error[E0204]: the trait `Copy` cannot be implemented for this type --> $DIR/range_traits-3.rs:3:10 | LL | #[derive(Copy, Clone)] diff --git a/tests/ui/range/range_traits-6.stderr b/tests/ui/range/range_traits-6.stderr index addc525f1..dfc74f87c 100644 --- a/tests/ui/range/range_traits-6.stderr +++ b/tests/ui/range/range_traits-6.stderr @@ -1,4 +1,4 @@ -error[E0204]: the trait `Copy` may not be implemented for this type +error[E0204]: the trait `Copy` cannot be implemented for this type --> $DIR/range_traits-6.rs:3:10 | LL | #[derive(Copy, Clone)] diff --git a/tests/ui/reachable-unnameable-type-alias.rs b/tests/ui/reachable-unnameable-type-alias.rs deleted file mode 100644 index 461355f87..000000000 --- a/tests/ui/reachable-unnameable-type-alias.rs +++ /dev/null @@ -1,16 +0,0 @@ -// run-pass - -#![feature(staged_api)] -#![stable(feature = "a", since = "b")] - -mod inner_private_module { - // UnnameableTypeAlias isn't marked as reachable, so no stability annotation is required here - pub type UnnameableTypeAlias = u8; -} - -#[stable(feature = "a", since = "b")] -pub fn f() -> inner_private_module::UnnameableTypeAlias { - 0 -} - -fn main() {} diff --git a/tests/ui/reachable/expr_box.rs b/tests/ui/reachable/expr_box.rs deleted file mode 100644 index 00328ea01..000000000 --- a/tests/ui/reachable/expr_box.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![feature(box_syntax)] -#![allow(unused_variables)] -#![deny(unreachable_code)] - -fn main() { - let x = box return; //~ ERROR unreachable - println!("hi"); -} diff --git a/tests/ui/reachable/expr_box.stderr b/tests/ui/reachable/expr_box.stderr deleted file mode 100644 index ea6472cbe..000000000 --- a/tests/ui/reachable/expr_box.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error: unreachable expression - --> $DIR/expr_box.rs:6:13 - | -LL | let x = box return; - | ^^^^------ - | | | - | | any code following this expression is unreachable - | unreachable expression - | -note: the lint level is defined here - --> $DIR/expr_box.rs:3:9 - | -LL | #![deny(unreachable_code)] - | ^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/tests/ui/reachable/reachable-unnameable-type-alias.rs b/tests/ui/reachable/reachable-unnameable-type-alias.rs new file mode 100644 index 000000000..461355f87 --- /dev/null +++ b/tests/ui/reachable/reachable-unnameable-type-alias.rs @@ -0,0 +1,16 @@ +// run-pass + +#![feature(staged_api)] +#![stable(feature = "a", since = "b")] + +mod inner_private_module { + // UnnameableTypeAlias isn't marked as reachable, so no stability annotation is required here + pub type UnnameableTypeAlias = u8; +} + +#[stable(feature = "a", since = "b")] +pub fn f() -> inner_private_module::UnnameableTypeAlias { + 0 +} + +fn main() {} diff --git a/tests/ui/recursion/issue-95134.rs b/tests/ui/recursion/issue-95134.rs index fdc4d5369..2f1cffa2f 100644 --- a/tests/ui/recursion/issue-95134.rs +++ b/tests/ui/recursion/issue-95134.rs @@ -1,7 +1,7 @@ // build-fail // known-bug: #95134 // compile-flags: -Copt-level=0 -// failure-status: 101 +// dont-check-failure-status // dont-check-compiler-stderr pub fn encode_num(n: u32, mut writer: Writer) -> Result<(), Writer::Error> { diff --git a/tests/ui/regions/issue-2718.rs b/tests/ui/regions/issue-2718.rs deleted file mode 100644 index 6449337ee..000000000 --- a/tests/ui/regions/issue-2718.rs +++ /dev/null @@ -1,327 +0,0 @@ -// run-pass -#![allow(dead_code)] -#![allow(unused_unsafe)] -#![allow(unused_imports)] -#![allow(non_camel_case_types)] - -pub type Task = isize; - -// tjc: I don't know why -pub mod pipes { - use self::state::{empty, full, blocked, terminated}; - use super::Task; - use std::mem::{forget, transmute}; - use std::mem::{replace, swap}; - use std::mem; - use std::thread; - use std::marker::Send; - - pub struct Stuff { - state: state, - blocked_task: Option, - payload: Option - } - - #[derive(PartialEq, Debug)] - #[repr(isize)] - pub enum state { - empty, - full, - blocked, - terminated - } - - pub struct packet { - state: state, - blocked_task: Option, - payload: Option - } - - unsafe impl Send for packet {} - - pub fn packet() -> *const packet { - unsafe { - let p: *const packet = mem::transmute(Box::new(Stuff{ - state: empty, - blocked_task: None::, - payload: None:: - })); - p - } - } - - mod rusti { - pub fn atomic_xchg(_dst: &mut isize, _src: isize) -> isize { panic!(); } - pub fn atomic_xchg_acq(_dst: &mut isize, _src: isize) -> isize { panic!(); } - pub fn atomic_xchg_rel(_dst: &mut isize, _src: isize) -> isize { panic!(); } - } - - // We should consider moving this to ::std::unsafe, although I - // suspect graydon would want us to use void pointers instead. - pub unsafe fn uniquify(x: *const T) -> Box { - mem::transmute(x) - } - - pub fn swap_state_acq(dst: &mut state, src: state) -> state { - unsafe { - transmute(rusti::atomic_xchg_acq(transmute(dst), src as isize)) - } - } - - pub fn swap_state_rel(dst: &mut state, src: state) -> state { - unsafe { - transmute(rusti::atomic_xchg_rel(transmute(dst), src as isize)) - } - } - - pub fn send(mut p: send_packet, payload: T) { - let p = p.unwrap(); - let mut p = unsafe { uniquify(p) }; - assert!((*p).payload.is_none()); - (*p).payload = Some(payload); - let old_state = swap_state_rel(&mut (*p).state, full); - match old_state { - empty => { - // Yay, fastpath. - - // The receiver will eventually clean this up. - unsafe { forget(p); } - } - full => { panic!("duplicate send") } - blocked => { - - // The receiver will eventually clean this up. - unsafe { forget(p); } - } - terminated => { - // The receiver will never receive this. Rely on drop_glue - // to clean everything up. - } - } - } - - pub fn recv(mut p: recv_packet) -> Option { - let p = p.unwrap(); - let mut p = unsafe { uniquify(p) }; - loop { - let old_state = swap_state_acq(&mut (*p).state, - blocked); - match old_state { - empty | blocked => { thread::yield_now(); } - full => { - let payload = replace(&mut p.payload, None); - return Some(payload.unwrap()) - } - terminated => { - assert_eq!(old_state, terminated); - return None; - } - } - } - } - - pub fn sender_terminate(p: *const packet) { - let mut p = unsafe { uniquify(p) }; - match swap_state_rel(&mut (*p).state, terminated) { - empty | blocked => { - // The receiver will eventually clean up. - unsafe { forget(p) } - } - full => { - // This is impossible - panic!("you dun goofed") - } - terminated => { - // I have to clean up, use drop_glue - } - } - } - - pub fn receiver_terminate(p: *const packet) { - let mut p = unsafe { uniquify(p) }; - match swap_state_rel(&mut (*p).state, terminated) { - empty => { - // the sender will clean up - unsafe { forget(p) } - } - blocked => { - // this shouldn't happen. - panic!("terminating a blocked packet") - } - terminated | full => { - // I have to clean up, use drop_glue - } - } - } - - pub struct send_packet { - p: Option<*const packet>, - } - - impl Drop for send_packet { - fn drop(&mut self) { - unsafe { - if self.p != None { - let self_p: &mut Option<*const packet> = - mem::transmute(&mut self.p); - let p = replace(self_p, None); - sender_terminate(p.unwrap()) - } - } - } - } - - impl send_packet { - pub fn unwrap(&mut self) -> *const packet { - replace(&mut self.p, None).unwrap() - } - } - - pub fn send_packet(p: *const packet) -> send_packet { - send_packet { - p: Some(p) - } - } - - pub struct recv_packet { - p: Option<*const packet>, - } - - impl Drop for recv_packet { - fn drop(&mut self) { - unsafe { - if self.p != None { - let self_p: &mut Option<*const packet> = - mem::transmute(&mut self.p); - let p = replace(self_p, None); - receiver_terminate(p.unwrap()) - } - } - } - } - - impl recv_packet { - pub fn unwrap(&mut self) -> *const packet { - replace(&mut self.p, None).unwrap() - } - } - - pub fn recv_packet(p: *const packet) -> recv_packet { - recv_packet { - p: Some(p) - } - } - - pub fn entangle() -> (send_packet, recv_packet) { - let p = packet(); - (send_packet(p), recv_packet(p)) - } -} - -pub mod pingpong { - use std::mem; - - pub struct ping(::pipes::send_packet); - - unsafe impl Send for ping {} - - pub struct pong(::pipes::send_packet); - - unsafe impl Send for pong {} - - pub fn liberate_ping(p: ping) -> ::pipes::send_packet { - unsafe { - let _addr : *const ::pipes::send_packet = match &p { - &ping(ref x) => { mem::transmute(x) } - }; - panic!() - } - } - - pub fn liberate_pong(p: pong) -> ::pipes::send_packet { - unsafe { - let _addr : *const ::pipes::send_packet = match &p { - &pong(ref x) => { mem::transmute(x) } - }; - panic!() - } - } - - pub fn init() -> (client::ping, server::ping) { - ::pipes::entangle() - } - - pub mod client { - use pingpong; - - pub type ping = ::pipes::send_packet; - pub type pong = ::pipes::recv_packet; - - pub fn do_ping(c: ping) -> pong { - let (sp, rp) = ::pipes::entangle(); - - ::pipes::send(c, pingpong::ping(sp)); - rp - } - - pub fn do_pong(c: pong) -> (ping, ()) { - let packet = ::pipes::recv(c); - if packet.is_none() { - panic!("sender closed the connection") - } - (pingpong::liberate_pong(packet.unwrap()), ()) - } - } - - pub mod server { - use pingpong; - - pub type ping = ::pipes::recv_packet; - pub type pong = ::pipes::send_packet; - - pub fn do_ping(c: ping) -> (pong, ()) { - let packet = ::pipes::recv(c); - if packet.is_none() { - panic!("sender closed the connection") - } - (pingpong::liberate_ping(packet.unwrap()), ()) - } - - pub fn do_pong(c: pong) -> ping { - let (sp, rp) = ::pipes::entangle(); - ::pipes::send(c, pingpong::pong(sp)); - rp - } - } -} - -fn client(chan: pingpong::client::ping) { - let chan = pingpong::client::do_ping(chan); - println!("Sent ping"); - let (_chan, _data) = pingpong::client::do_pong(chan); - println!("Received pong"); -} - -fn server(chan: pingpong::server::ping) { - let (chan, _data) = pingpong::server::do_ping(chan); - println!("Received ping"); - let _chan = pingpong::server::do_pong(chan); - println!("Sent pong"); -} - -pub fn main() { - /* -// Commented out because of option::get error - - let (client_, server_) = pingpong::init(); - - task::spawn {|client_| - let client__ = client_.take(); - client(client__); - }; - task::spawn {|server_| - let server__ = server_.take(); - server(server_ˊ); - }; - */ -} diff --git a/tests/ui/repeat-expr/repeat-to-run-dtor-twice.stderr b/tests/ui/repeat-expr/repeat-to-run-dtor-twice.stderr index 36b936163..1bf8e6e06 100644 --- a/tests/ui/repeat-expr/repeat-to-run-dtor-twice.stderr +++ b/tests/ui/repeat-expr/repeat-to-run-dtor-twice.stderr @@ -7,7 +7,8 @@ LL | let _ = [ a; 5 ]; = note: the `Copy` trait is required because this value will be copied for each element of the array help: consider annotating `Foo` with `#[derive(Copy)]` | -LL | #[derive(Copy)] +LL + #[derive(Copy)] +LL | struct Foo { | error: aborting due to previous error diff --git a/tests/ui/resolve/crate-in-paths.stderr b/tests/ui/resolve/crate-in-paths.stderr index b7cf49507..07fb5dcc0 100644 --- a/tests/ui/resolve/crate-in-paths.stderr +++ b/tests/ui/resolve/crate-in-paths.stderr @@ -6,7 +6,7 @@ LL | Foo; | help: consider importing this unit struct | -LL | use crate::bar::Foo; +LL + use crate::bar::Foo; | error: aborting due to previous error diff --git a/tests/ui/resolve/disambiguate-identical-names.rs b/tests/ui/resolve/disambiguate-identical-names.rs new file mode 100644 index 000000000..708d2cd76 --- /dev/null +++ b/tests/ui/resolve/disambiguate-identical-names.rs @@ -0,0 +1,15 @@ +pub mod submod { + // Create ambiguity with the std::vec::Vec item: + pub struct Vec; +} + +fn test(_v: &Vec>) { +} + +fn main() { + let v = std::collections::HashMap::new(); + v.insert(3u8, 1u8); + + test(&v); + //~^ ERROR mismatched types +} diff --git a/tests/ui/resolve/disambiguate-identical-names.stderr b/tests/ui/resolve/disambiguate-identical-names.stderr new file mode 100644 index 000000000..7d8293018 --- /dev/null +++ b/tests/ui/resolve/disambiguate-identical-names.stderr @@ -0,0 +1,19 @@ +error[E0308]: mismatched types + --> $DIR/disambiguate-identical-names.rs:13:10 + | +LL | test(&v); + | ---- ^^ expected `&Vec>`, found `&HashMap` + | | + | arguments to this function are incorrect + | + = note: expected reference `&std::vec::Vec>` + found reference `&HashMap` +note: function defined here + --> $DIR/disambiguate-identical-names.rs:6:4 + | +LL | fn test(_v: &Vec>) { + | ^^^^ ------------------ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/resolve/enums-are-namespaced-xc.stderr b/tests/ui/resolve/enums-are-namespaced-xc.stderr index 6448e596d..5af6cb042 100644 --- a/tests/ui/resolve/enums-are-namespaced-xc.stderr +++ b/tests/ui/resolve/enums-are-namespaced-xc.stderr @@ -6,7 +6,7 @@ LL | let _ = namespaced_enums::A; | help: consider importing this unit variant | -LL | use namespaced_enums::Foo::A; +LL + use namespaced_enums::Foo::A; | help: if you import `A`, refer to it directly | @@ -22,7 +22,7 @@ LL | let _ = namespaced_enums::B(10); | help: consider importing this tuple variant | -LL | use namespaced_enums::Foo::B; +LL + use namespaced_enums::Foo::B; | help: if you import `B`, refer to it directly | @@ -38,7 +38,7 @@ LL | let _ = namespaced_enums::C { a: 10 }; | help: consider importing this variant | -LL | use namespaced_enums::Foo::C; +LL + use namespaced_enums::Foo::C; | help: if you import `C`, refer to it directly | diff --git a/tests/ui/resolve/filter-intrinsics.stderr b/tests/ui/resolve/filter-intrinsics.stderr index 955070891..cc1092dd0 100644 --- a/tests/ui/resolve/filter-intrinsics.stderr +++ b/tests/ui/resolve/filter-intrinsics.stderr @@ -6,7 +6,7 @@ LL | let _ = size_of::(); | help: consider importing this function | -LL | use std::mem::size_of; +LL + use std::mem::size_of; | error[E0425]: cannot find function `fabsf64` in this scope @@ -17,7 +17,7 @@ LL | let _ = fabsf64(1.0); | help: consider importing this function | -LL | use std::intrinsics::fabsf64; +LL + use std::intrinsics::fabsf64; | error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/issue-102946.stderr b/tests/ui/resolve/issue-102946.stderr index 65be0258e..b2cdcb25c 100644 --- a/tests/ui/resolve/issue-102946.stderr +++ b/tests/ui/resolve/issue-102946.stderr @@ -6,7 +6,7 @@ LL | impl Error for str::Utf8Error { | help: consider importing this trait | -LL | use std::error::Error; +LL + use std::error::Error; | error[E0223]: ambiguous associated type diff --git a/tests/ui/resolve/issue-107563-ambiguous-glob-reexports.rs b/tests/ui/resolve/issue-107563-ambiguous-glob-reexports.rs new file mode 100644 index 000000000..431213e25 --- /dev/null +++ b/tests/ui/resolve/issue-107563-ambiguous-glob-reexports.rs @@ -0,0 +1,33 @@ +#![deny(ambiguous_glob_reexports)] + +pub mod foo { + pub type X = u8; +} + +pub mod bar { + pub type X = u8; + pub type Y = u8; +} + +pub use foo::*; +//~^ ERROR ambiguous glob re-exports +pub use bar::*; + +mod ambiguous { + mod m1 { pub type A = u8; } + mod m2 { pub type A = u8; } + pub use self::m1::*; + //~^ ERROR ambiguous glob re-exports + pub use self::m2::*; +} + +pub mod single { + pub use ambiguous::A; + //~^ ERROR `A` is ambiguous +} + +pub mod glob { + pub use ambiguous::*; +} + +pub fn main() {} diff --git a/tests/ui/resolve/issue-107563-ambiguous-glob-reexports.stderr b/tests/ui/resolve/issue-107563-ambiguous-glob-reexports.stderr new file mode 100644 index 000000000..07e61dd86 --- /dev/null +++ b/tests/ui/resolve/issue-107563-ambiguous-glob-reexports.stderr @@ -0,0 +1,47 @@ +error[E0659]: `A` is ambiguous + --> $DIR/issue-107563-ambiguous-glob-reexports.rs:25:24 + | +LL | pub use ambiguous::A; + | ^ ambiguous name + | + = note: ambiguous because of multiple glob imports of a name in the same module +note: `A` could refer to the type alias imported here + --> $DIR/issue-107563-ambiguous-glob-reexports.rs:19:13 + | +LL | pub use self::m1::*; + | ^^^^^^^^^^^ + = help: consider adding an explicit import of `A` to disambiguate +note: `A` could also refer to the type alias imported here + --> $DIR/issue-107563-ambiguous-glob-reexports.rs:21:13 + | +LL | pub use self::m2::*; + | ^^^^^^^^^^^ + = help: consider adding an explicit import of `A` to disambiguate + +error: ambiguous glob re-exports + --> $DIR/issue-107563-ambiguous-glob-reexports.rs:12:9 + | +LL | pub use foo::*; + | ^^^^^^ the name `X` in the type namespace is first re-exported here +LL | +LL | pub use bar::*; + | ------ but the name `X` in the type namespace is also re-exported here + | +note: the lint level is defined here + --> $DIR/issue-107563-ambiguous-glob-reexports.rs:1:9 + | +LL | #![deny(ambiguous_glob_reexports)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: ambiguous glob re-exports + --> $DIR/issue-107563-ambiguous-glob-reexports.rs:19:13 + | +LL | pub use self::m1::*; + | ^^^^^^^^^^^ the name `A` in the type namespace is first re-exported here +LL | +LL | pub use self::m2::*; + | ----------- but the name `A` in the type namespace is also re-exported here + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/resolve/issue-16058.stderr b/tests/ui/resolve/issue-16058.stderr index c47d22cef..710002a15 100644 --- a/tests/ui/resolve/issue-16058.stderr +++ b/tests/ui/resolve/issue-16058.stderr @@ -6,11 +6,11 @@ LL | Result { | help: consider importing one of these items instead | -LL | use std::fmt::Result; +LL + use std::fmt::Result; | -LL | use std::io::Result; +LL + use std::io::Result; | -LL | use std::thread::Result; +LL + use std::thread::Result; | error: aborting due to previous error diff --git a/tests/ui/resolve/issue-17518.stderr b/tests/ui/resolve/issue-17518.stderr index 034d0d01b..492e3b34a 100644 --- a/tests/ui/resolve/issue-17518.stderr +++ b/tests/ui/resolve/issue-17518.stderr @@ -6,7 +6,7 @@ LL | E { name: "foobar" }; | help: consider importing this variant | -LL | use SomeEnum::E; +LL + use SomeEnum::E; | error: aborting due to previous error diff --git a/tests/ui/resolve/issue-21221-1.stderr b/tests/ui/resolve/issue-21221-1.stderr index 538eeead9..a38116cd7 100644 --- a/tests/ui/resolve/issue-21221-1.stderr +++ b/tests/ui/resolve/issue-21221-1.stderr @@ -6,11 +6,11 @@ LL | impl Mul for Foo { | help: consider importing one of these items | -LL | use mul1::Mul; +LL + use mul1::Mul; | -LL | use mul2::Mul; +LL + use mul2::Mul; | -LL | use std::ops::Mul; +LL + use std::ops::Mul; | error[E0412]: cannot find type `Mul` in this scope @@ -21,11 +21,11 @@ LL | fn getMul() -> Mul { | help: consider importing one of these items | -LL | use mul1::Mul; +LL + use mul1::Mul; | -LL | use mul2::Mul; +LL + use mul2::Mul; | -LL | use std::ops::Mul; +LL + use std::ops::Mul; | error[E0405]: cannot find trait `ThisTraitReallyDoesntExistInAnyModuleReally` in this scope @@ -42,7 +42,7 @@ LL | impl Div for Foo { | help: consider importing this trait | -LL | use std::ops::Div; +LL + use std::ops::Div; | error: aborting due to 4 previous errors diff --git a/tests/ui/resolve/issue-21221-2.stderr b/tests/ui/resolve/issue-21221-2.stderr index d4fd7cb12..9beb62662 100644 --- a/tests/ui/resolve/issue-21221-2.stderr +++ b/tests/ui/resolve/issue-21221-2.stderr @@ -6,9 +6,9 @@ LL | impl T for Foo { } | help: consider importing one of these items | -LL | use baz::T; +LL + use baz::T; | -LL | use foo::bar::T; +LL + use foo::bar::T; | error: aborting due to previous error diff --git a/tests/ui/resolve/issue-21221-3.stderr b/tests/ui/resolve/issue-21221-3.stderr index f12e5b09b..0dabdfd9b 100644 --- a/tests/ui/resolve/issue-21221-3.stderr +++ b/tests/ui/resolve/issue-21221-3.stderr @@ -6,7 +6,7 @@ LL | impl OuterTrait for Foo {} | help: consider importing this trait | -LL | use issue_21221_3::outer::OuterTrait; +LL + use issue_21221_3::outer::OuterTrait; | error: aborting due to previous error diff --git a/tests/ui/resolve/issue-21221-4.stderr b/tests/ui/resolve/issue-21221-4.stderr index fc15444d0..5af14b1b6 100644 --- a/tests/ui/resolve/issue-21221-4.stderr +++ b/tests/ui/resolve/issue-21221-4.stderr @@ -6,7 +6,7 @@ LL | impl T for Foo {} | help: consider importing this trait | -LL | use issue_21221_4::T; +LL + use issue_21221_4::T; | error: aborting due to previous error diff --git a/tests/ui/resolve/issue-2356.stderr b/tests/ui/resolve/issue-2356.stderr index 36f3da7c9..313b3e30d 100644 --- a/tests/ui/resolve/issue-2356.stderr +++ b/tests/ui/resolve/issue-2356.stderr @@ -10,7 +10,7 @@ LL | Self::default(); | ~~~~~~~~~~~~~ help: consider importing this function | -LL | use std::default::default; +LL + use std::default::default; | error[E0425]: cannot find value `whiskers` in this scope diff --git a/tests/ui/resolve/issue-26545.stderr b/tests/ui/resolve/issue-26545.stderr index d3c866925..42a7531c5 100644 --- a/tests/ui/resolve/issue-26545.stderr +++ b/tests/ui/resolve/issue-26545.stderr @@ -6,7 +6,7 @@ LL | B(()); | help: consider importing this tuple struct | -LL | use foo::B; +LL + use foo::B; | error: aborting due to previous error diff --git a/tests/ui/resolve/issue-35675.stderr b/tests/ui/resolve/issue-35675.stderr index 4a06196d5..44af65b07 100644 --- a/tests/ui/resolve/issue-35675.stderr +++ b/tests/ui/resolve/issue-35675.stderr @@ -17,7 +17,7 @@ LL | Apple(5) | help: consider importing this tuple variant | -LL | use Fruit::Apple; +LL + use Fruit::Apple; | error[E0573]: expected type, found variant `Fruit::Apple` @@ -37,7 +37,7 @@ LL | Apple(5) | help: consider importing this tuple variant | -LL | use Fruit::Apple; +LL + use Fruit::Apple; | error[E0573]: expected type, found variant `Ok` diff --git a/tests/ui/resolve/issue-3907.stderr b/tests/ui/resolve/issue-3907.stderr index 6fc61cae8..70631a13c 100644 --- a/tests/ui/resolve/issue-3907.stderr +++ b/tests/ui/resolve/issue-3907.stderr @@ -10,7 +10,7 @@ LL | trait Foo = dyn issue_3907::Foo; | help: consider importing this trait instead | -LL | use issue_3907::Foo; +LL + use issue_3907::Foo; | error: aborting due to previous error diff --git a/tests/ui/resolve/issue-50599.stderr b/tests/ui/resolve/issue-50599.stderr index b07482c83..d7419b64f 100644 --- a/tests/ui/resolve/issue-50599.stderr +++ b/tests/ui/resolve/issue-50599.stderr @@ -6,9 +6,9 @@ LL | const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize; | help: consider importing one of these items | -LL | use std::f32::consts::LOG10_2; +LL + use std::f32::consts::LOG10_2; | -LL | use std::f64::consts::LOG10_2; +LL + use std::f64::consts::LOG10_2; | help: if you import `LOG10_2`, refer to it directly | diff --git a/tests/ui/resolve/issue-73427.stderr b/tests/ui/resolve/issue-73427.stderr index 4af5f29d8..622de9b39 100644 --- a/tests/ui/resolve/issue-73427.stderr +++ b/tests/ui/resolve/issue-73427.stderr @@ -107,9 +107,9 @@ LL | (E::TupleWithFields(/* fields */)).foo(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ help: consider importing one of these items instead | -LL | use std::f32::consts::E; +LL + use std::f32::consts::E; | -LL | use std::f64::consts::E; +LL + use std::f64::consts::E; | error[E0532]: expected tuple struct or tuple variant, found enum `A` diff --git a/tests/ui/resolve/issue-90113.stderr b/tests/ui/resolve/issue-90113.stderr index 1b7872057..5f55d9c24 100644 --- a/tests/ui/resolve/issue-90113.stderr +++ b/tests/ui/resolve/issue-90113.stderr @@ -6,7 +6,7 @@ LL | Cons(..) => {} | help: consider importing this tuple variant | -LL | use list::List::Cons; +LL + use list::List::Cons; | error: aborting due to previous error diff --git a/tests/ui/resolve/missing-in-namespace.stderr b/tests/ui/resolve/missing-in-namespace.stderr index fc925ba3b..7a7b749ae 100644 --- a/tests/ui/resolve/missing-in-namespace.stderr +++ b/tests/ui/resolve/missing-in-namespace.stderr @@ -6,7 +6,7 @@ LL | let _map = std::hahmap::HashMap::new(); | help: consider importing this struct | -LL | use std::collections::HashMap; +LL + use std::collections::HashMap; | help: if you import `HashMap`, refer to it directly | diff --git a/tests/ui/resolve/no-implicit-prelude-nested.stderr b/tests/ui/resolve/no-implicit-prelude-nested.stderr index 198b630c5..49cf72bfe 100644 --- a/tests/ui/resolve/no-implicit-prelude-nested.stderr +++ b/tests/ui/resolve/no-implicit-prelude-nested.stderr @@ -6,7 +6,7 @@ LL | impl Add for Test {} | help: consider importing this trait | -LL | use std::ops::Add; +LL + use std::ops::Add; | error[E0404]: expected trait, found derive macro `Clone` @@ -17,7 +17,7 @@ LL | impl Clone for Test {} | help: consider importing this trait instead | -LL | use std::clone::Clone; +LL + use std::clone::Clone; | error[E0405]: cannot find trait `Iterator` in this scope @@ -28,7 +28,7 @@ LL | impl Iterator for Test {} | help: consider importing this trait | -LL | use std::iter::Iterator; +LL + use std::iter::Iterator; | error[E0405]: cannot find trait `ToString` in this scope @@ -39,7 +39,7 @@ LL | impl ToString for Test {} | help: consider importing this trait | -LL | use std::string::ToString; +LL + use std::string::ToString; | error[E0405]: cannot find trait `Writer` in this scope @@ -56,7 +56,7 @@ LL | drop(2) | help: consider importing this function | -LL | use std::mem::drop; +LL + use std::mem::drop; | error[E0405]: cannot find trait `Add` in this scope @@ -67,7 +67,7 @@ LL | impl Add for Test {} | help: consider importing this trait | -LL | use std::ops::Add; +LL + use std::ops::Add; | error[E0404]: expected trait, found derive macro `Clone` @@ -78,7 +78,7 @@ LL | impl Clone for Test {} | help: consider importing this trait instead | -LL | use std::clone::Clone; +LL + use std::clone::Clone; | error[E0405]: cannot find trait `Iterator` in this scope @@ -89,7 +89,7 @@ LL | impl Iterator for Test {} | help: consider importing this trait | -LL | use std::iter::Iterator; +LL + use std::iter::Iterator; | error[E0405]: cannot find trait `ToString` in this scope @@ -100,7 +100,7 @@ LL | impl ToString for Test {} | help: consider importing this trait | -LL | use std::string::ToString; +LL + use std::string::ToString; | error[E0405]: cannot find trait `Writer` in this scope @@ -117,7 +117,7 @@ LL | drop(2) | help: consider importing this function | -LL | use std::mem::drop; +LL + use std::mem::drop; | error[E0405]: cannot find trait `Add` in this scope @@ -128,7 +128,7 @@ LL | impl Add for Test {} | help: consider importing this trait | -LL | use std::ops::Add; +LL + use std::ops::Add; | error[E0404]: expected trait, found derive macro `Clone` @@ -139,7 +139,7 @@ LL | impl Clone for Test {} | help: consider importing this trait instead | -LL | use std::clone::Clone; +LL + use std::clone::Clone; | error[E0405]: cannot find trait `Iterator` in this scope @@ -150,7 +150,7 @@ LL | impl Iterator for Test {} | help: consider importing this trait | -LL | use std::iter::Iterator; +LL + use std::iter::Iterator; | error[E0405]: cannot find trait `ToString` in this scope @@ -161,7 +161,7 @@ LL | impl ToString for Test {} | help: consider importing this trait | -LL | use std::string::ToString; +LL + use std::string::ToString; | error[E0405]: cannot find trait `Writer` in this scope @@ -178,7 +178,7 @@ LL | drop(2) | help: consider importing this function | -LL | use std::mem::drop; +LL + use std::mem::drop; | error: aborting due to 18 previous errors diff --git a/tests/ui/resolve/no-implicit-prelude.stderr b/tests/ui/resolve/no-implicit-prelude.stderr index 36a9b65b7..5a759743f 100644 --- a/tests/ui/resolve/no-implicit-prelude.stderr +++ b/tests/ui/resolve/no-implicit-prelude.stderr @@ -6,7 +6,7 @@ LL | impl Add for Test {} | help: consider importing this trait | -LL | use std::ops::Add; +LL + use std::ops::Add; | error[E0404]: expected trait, found derive macro `Clone` @@ -17,7 +17,7 @@ LL | impl Clone for Test {} | help: consider importing this trait instead | -LL | use std::clone::Clone; +LL + use std::clone::Clone; | error[E0405]: cannot find trait `Iterator` in this scope @@ -28,7 +28,7 @@ LL | impl Iterator for Test {} | help: consider importing this trait | -LL | use std::iter::Iterator; +LL + use std::iter::Iterator; | error[E0405]: cannot find trait `ToString` in this scope @@ -39,7 +39,7 @@ LL | impl ToString for Test {} | help: consider importing this trait | -LL | use std::string::ToString; +LL + use std::string::ToString; | error[E0405]: cannot find trait `Writer` in this scope @@ -56,7 +56,7 @@ LL | drop(2) | help: consider importing this function | -LL | use std::mem::drop; +LL + use std::mem::drop; | error: aborting due to 6 previous errors diff --git a/tests/ui/resolve/privacy-enum-ctor.stderr b/tests/ui/resolve/privacy-enum-ctor.stderr index 3c051429f..0bb090905 100644 --- a/tests/ui/resolve/privacy-enum-ctor.stderr +++ b/tests/ui/resolve/privacy-enum-ctor.stderr @@ -84,9 +84,9 @@ LL | let _: E = m::f; | ~ help: consider importing one of these items instead | -LL | use std::f32::consts::E; +LL + use std::f32::consts::E; | -LL | use std::f64::consts::E; +LL + use std::f64::consts::E; | help: if you import `E`, refer to it directly | @@ -121,9 +121,9 @@ LL | let _: E = (E::Fn(/* fields */)); | ~~~~~~~~~~~~~~~~~~~~~ help: consider importing one of these items instead | -LL | use std::f32::consts::E; +LL + use std::f32::consts::E; | -LL | use std::f64::consts::E; +LL + use std::f64::consts::E; | error[E0412]: cannot find type `Z` in this scope diff --git a/tests/ui/resolve/resolve-primitive-fallback.stderr b/tests/ui/resolve/resolve-primitive-fallback.stderr index f803f9da2..e3a5d4edc 100644 --- a/tests/ui/resolve/resolve-primitive-fallback.stderr +++ b/tests/ui/resolve/resolve-primitive-fallback.stderr @@ -12,7 +12,7 @@ LL | let _: ::u8; | help: consider importing this builtin type | -LL | use std::primitive::u8; +LL + use std::primitive::u8; | help: if you import `u8`, refer to it directly | diff --git a/tests/ui/resolve/tool-import.rs b/tests/ui/resolve/tool-import.rs new file mode 100644 index 000000000..971993332 --- /dev/null +++ b/tests/ui/resolve/tool-import.rs @@ -0,0 +1,8 @@ +// edition: 2018 + +use clippy::time::Instant; +//~^ `clippy` is a tool module + +fn main() { + Instant::now(); +} diff --git a/tests/ui/resolve/tool-import.stderr b/tests/ui/resolve/tool-import.stderr new file mode 100644 index 000000000..d3bdfc93d --- /dev/null +++ b/tests/ui/resolve/tool-import.stderr @@ -0,0 +1,9 @@ +error[E0433]: failed to resolve: `clippy` is a tool module, not a module + --> $DIR/tool-import.rs:3:5 + | +LL | use clippy::time::Instant; + | ^^^^^^ `clippy` is a tool module, not a module + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0433`. diff --git a/tests/ui/resolve/use_suggestion.stderr b/tests/ui/resolve/use_suggestion.stderr index 54ad85383..1155f5caa 100644 --- a/tests/ui/resolve/use_suggestion.stderr +++ b/tests/ui/resolve/use_suggestion.stderr @@ -6,7 +6,7 @@ LL | let x1 = HashMap::new(); | help: consider importing this struct | -LL | use std::collections::HashMap; +LL + use std::collections::HashMap; | error[E0412]: cannot find type `HashMap` in this scope @@ -17,7 +17,7 @@ LL | let y1: HashMap; | help: consider importing this struct | -LL | use std::collections::HashMap; +LL + use std::collections::HashMap; | error[E0412]: cannot find type `GooMap` in this scope diff --git a/tests/ui/resolve/use_suggestion_placement.stderr b/tests/ui/resolve/use_suggestion_placement.stderr index 0aadd82f6..3611f9ae6 100644 --- a/tests/ui/resolve/use_suggestion_placement.stderr +++ b/tests/ui/resolve/use_suggestion_placement.stderr @@ -6,7 +6,7 @@ LL | type Bar = Path; | help: consider importing this struct | -LL | use std::path::Path; +LL + use std::path::Path; | error[E0425]: cannot find value `A` in this scope @@ -17,7 +17,7 @@ LL | let _ = A; | help: consider importing this constant | -LL | use m::A; +LL + use m::A; | error[E0412]: cannot find type `HashMap` in this scope @@ -28,7 +28,7 @@ LL | type Dict = HashMap; | help: consider importing this struct | -LL | use std::collections::HashMap; +LL + use std::collections::HashMap; | error: aborting due to 3 previous errors diff --git a/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-direct-struct-embedded.stderr b/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-direct-struct-embedded.stderr index c73a6cf13..f08ba522a 100644 --- a/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-direct-struct-embedded.stderr +++ b/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-direct-struct-embedded.stderr @@ -3,6 +3,9 @@ error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be ann | LL | WRAP_DIRECT_INLINE => { panic!("WRAP_DIRECT_INLINE matched itself"); } | ^^^^^^^^^^^^^^^^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: aborting due to previous error diff --git a/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-direct-struct-param.stderr b/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-direct-struct-param.stderr index 6fdf9db89..012ccab17 100644 --- a/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-direct-struct-param.stderr +++ b/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-direct-struct-param.stderr @@ -3,6 +3,9 @@ error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be ann | LL | WRAP_DIRECT_PARAM => { panic!("WRAP_DIRECT_PARAM matched itself"); } | ^^^^^^^^^^^^^^^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: aborting due to previous error diff --git a/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-doubly-indirect-embedded.stderr b/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-doubly-indirect-embedded.stderr index 10dd635ff..94ee2216e 100644 --- a/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-doubly-indirect-embedded.stderr +++ b/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-doubly-indirect-embedded.stderr @@ -6,6 +6,8 @@ LL | WRAP_DOUBLY_INDIRECT_INLINE => { panic!("WRAP_DOUBLY_INDIRECT_INLIN | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #62411 + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details note: the lint level is defined here --> $DIR/cant-hide-behind-doubly-indirect-embedded.rs:7:9 | diff --git a/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-doubly-indirect-param.stderr b/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-doubly-indirect-param.stderr index 66aecbc4f..666b7b95e 100644 --- a/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-doubly-indirect-param.stderr +++ b/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-doubly-indirect-param.stderr @@ -6,6 +6,8 @@ LL | WRAP_DOUBLY_INDIRECT_PARAM => { panic!("WRAP_DOUBLY_INDIRECT_PARAM | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #62411 + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details note: the lint level is defined here --> $DIR/cant-hide-behind-doubly-indirect-param.rs:7:9 | diff --git a/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-indirect-struct-embedded.stderr b/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-indirect-struct-embedded.stderr index ee92954a6..ecbe83f3d 100644 --- a/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-indirect-struct-embedded.stderr +++ b/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-indirect-struct-embedded.stderr @@ -6,6 +6,8 @@ LL | WRAP_INDIRECT_INLINE => { panic!("WRAP_INDIRECT_INLINE matched itse | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #62411 + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details note: the lint level is defined here --> $DIR/cant-hide-behind-indirect-struct-embedded.rs:7:9 | diff --git a/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-indirect-struct-param.stderr b/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-indirect-struct-param.stderr index f0c492d6a..211990801 100644 --- a/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-indirect-struct-param.stderr +++ b/tests/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-indirect-struct-param.stderr @@ -6,6 +6,8 @@ LL | WRAP_INDIRECT_PARAM => { panic!("WRAP_INDIRECT_PARAM matched itself | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #62411 + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details note: the lint level is defined here --> $DIR/cant-hide-behind-indirect-struct-param.rs:7:9 | diff --git a/tests/ui/rfc-1445-restrict-constants-in-patterns/issue-61188-match-slice-forbidden-without-eq.stderr b/tests/ui/rfc-1445-restrict-constants-in-patterns/issue-61188-match-slice-forbidden-without-eq.stderr index 0bf369fa8..46600e7b2 100644 --- a/tests/ui/rfc-1445-restrict-constants-in-patterns/issue-61188-match-slice-forbidden-without-eq.stderr +++ b/tests/ui/rfc-1445-restrict-constants-in-patterns/issue-61188-match-slice-forbidden-without-eq.stderr @@ -3,6 +3,9 @@ error: to use a constant of type `B` in a pattern, `B` must be annotated with `# | LL | A => (), | ^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: aborting due to previous error diff --git a/tests/ui/rfc-1445-restrict-constants-in-patterns/issue-62307-match-ref-ref-forbidden-without-eq.stderr b/tests/ui/rfc-1445-restrict-constants-in-patterns/issue-62307-match-ref-ref-forbidden-without-eq.stderr index 955ab4b54..435812306 100644 --- a/tests/ui/rfc-1445-restrict-constants-in-patterns/issue-62307-match-ref-ref-forbidden-without-eq.stderr +++ b/tests/ui/rfc-1445-restrict-constants-in-patterns/issue-62307-match-ref-ref-forbidden-without-eq.stderr @@ -6,6 +6,8 @@ LL | RR_B1 => { println!("CLAIM RR0: {:?} matches {:?}", RR_B1, RR_B0); | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #62411 + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details note: the lint level is defined here --> $DIR/issue-62307-match-ref-ref-forbidden-without-eq.rs:13:9 | @@ -20,6 +22,8 @@ LL | RR_B1 => { println!("CLAIM RR1: {:?} matches {:?}", RR_B1, RR_B1); | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #62411 + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details warning: 2 warnings emitted diff --git a/tests/ui/rfc-1445-restrict-constants-in-patterns/match-forbidden-without-eq.stderr b/tests/ui/rfc-1445-restrict-constants-in-patterns/match-forbidden-without-eq.stderr index 616ed9e48..1c4fb9146 100644 --- a/tests/ui/rfc-1445-restrict-constants-in-patterns/match-forbidden-without-eq.stderr +++ b/tests/ui/rfc-1445-restrict-constants-in-patterns/match-forbidden-without-eq.stderr @@ -3,6 +3,9 @@ error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated wit | LL | FOO => { } | ^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details warning: floating-point types cannot be used in patterns --> $DIR/match-forbidden-without-eq.rs:18:9 diff --git a/tests/ui/rfc-1445-restrict-constants-in-patterns/match-nonempty-array-forbidden-without-eq.stderr b/tests/ui/rfc-1445-restrict-constants-in-patterns/match-nonempty-array-forbidden-without-eq.stderr index 371f8a0aa..6adebada0 100644 --- a/tests/ui/rfc-1445-restrict-constants-in-patterns/match-nonempty-array-forbidden-without-eq.stderr +++ b/tests/ui/rfc-1445-restrict-constants-in-patterns/match-nonempty-array-forbidden-without-eq.stderr @@ -3,6 +3,9 @@ error: to use a constant of type `B` in a pattern, `B` must be annotated with `# | LL | FOO => { } | ^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: aborting due to previous error diff --git a/tests/ui/rfc-1445-restrict-constants-in-patterns/match-requires-both-partialeq-and-eq.stderr b/tests/ui/rfc-1445-restrict-constants-in-patterns/match-requires-both-partialeq-and-eq.stderr index 4157cf652..f5b10f062 100644 --- a/tests/ui/rfc-1445-restrict-constants-in-patterns/match-requires-both-partialeq-and-eq.stderr +++ b/tests/ui/rfc-1445-restrict-constants-in-patterns/match-requires-both-partialeq-and-eq.stderr @@ -3,6 +3,9 @@ error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated wit | LL | FOO => { } | ^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: aborting due to previous error diff --git a/tests/ui/rfc-1937-termination-trait/issue-103052-2.current.stderr b/tests/ui/rfc-1937-termination-trait/issue-103052-2.current.stderr new file mode 100644 index 000000000..f72b3ab02 --- /dev/null +++ b/tests/ui/rfc-1937-termination-trait/issue-103052-2.current.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `Something: Termination` is not satisfied + --> $DIR/issue-103052-2.rs:15:22 + | +LL | fn main() -> Something { + | ^^^^^^^^^ the trait `Termination` is not implemented for `Something` + | +note: required by a bound in `Main::main::{opaque#0}` + --> $DIR/issue-103052-2.rs:9:27 + | +LL | fn main() -> impl std::process::Termination; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Main::main::{opaque#0}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/rfc-1937-termination-trait/issue-103052-2.next.stderr b/tests/ui/rfc-1937-termination-trait/issue-103052-2.next.stderr new file mode 100644 index 000000000..8b01941b4 --- /dev/null +++ b/tests/ui/rfc-1937-termination-trait/issue-103052-2.next.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `Something: Termination` is not satisfied + --> $DIR/issue-103052-2.rs:15:22 + | +LL | fn main() -> Something { + | ^^^^^^^^^ the trait `Termination` is not implemented for `Something` + | +note: required by a bound in `Main::{opaque#0}` + --> $DIR/issue-103052-2.rs:9:27 + | +LL | fn main() -> impl std::process::Termination; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Main::{opaque#0}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/rfc-1937-termination-trait/issue-103052-2.rs b/tests/ui/rfc-1937-termination-trait/issue-103052-2.rs index fa9182b6d..ca5fa6df2 100644 --- a/tests/ui/rfc-1937-termination-trait/issue-103052-2.rs +++ b/tests/ui/rfc-1937-termination-trait/issue-103052-2.rs @@ -1,3 +1,6 @@ +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next + #![feature(return_position_impl_trait_in_trait)] #![allow(incomplete_features)] @@ -9,7 +12,8 @@ mod child { struct Something; impl Main for () { - fn main() -> Something { //~ ERROR the trait bound `Something: Termination` is not satisfied + fn main() -> Something { + //~^ ERROR the trait bound `Something: Termination` is not satisfied Something } } diff --git a/tests/ui/rfc-1937-termination-trait/issue-103052-2.stderr b/tests/ui/rfc-1937-termination-trait/issue-103052-2.stderr deleted file mode 100644 index a700c72ea..000000000 --- a/tests/ui/rfc-1937-termination-trait/issue-103052-2.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0277]: the trait bound `Something: Termination` is not satisfied - --> $DIR/issue-103052-2.rs:12:22 - | -LL | fn main() -> Something { - | ^^^^^^^^^ the trait `Termination` is not implemented for `Something` - | -note: required by a bound in `Main::main::{opaque#0}` - --> $DIR/issue-103052-2.rs:6:27 - | -LL | fn main() -> impl std::process::Termination; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Main::main::{opaque#0}` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/rfc-2005-default-binding-mode/slice.stderr b/tests/ui/rfc-2005-default-binding-mode/slice.stderr index 60c1f5420..5b51dc5ac 100644 --- a/tests/ui/rfc-2005-default-binding-mode/slice.stderr +++ b/tests/ui/rfc-2005-default-binding-mode/slice.stderr @@ -7,7 +7,7 @@ LL | match sl { = note: the matched value is of type `&[u8]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [first, remainder @ ..] => {} +LL ~ [first, remainder @ ..] => {}, LL ~ &[] => todo!(), | diff --git a/tests/ui/rfc-2008-non-exhaustive/omitted-patterns.rs b/tests/ui/rfc-2008-non-exhaustive/omitted-patterns.rs index d8f07bb8f..3482af747 100644 --- a/tests/ui/rfc-2008-non-exhaustive/omitted-patterns.rs +++ b/tests/ui/rfc-2008-non-exhaustive/omitted-patterns.rs @@ -184,4 +184,28 @@ fn main() { // OK: both unstable and stable fields are matched with feature on #[warn(non_exhaustive_omitted_patterns)] let UnstableStruct { stable, stable2, unstable, .. } = UnstableStruct::default(); + + // Ok: local bindings are allowed + #[deny(non_exhaustive_omitted_patterns)] + let local = NonExhaustiveEnum::Unit; + + // Ok: missing patterns will be blocked by the pattern being refutable + #[deny(non_exhaustive_omitted_patterns)] + let local_refutable @ NonExhaustiveEnum::Unit = NonExhaustiveEnum::Unit; + //~^ refutable pattern in local binding + + // Check that matching on a reference results in a correctly spanned diagnostic + #[deny(non_exhaustive_omitted_patterns)] + match &non_enum { + NonExhaustiveEnum::Unit => {} + NonExhaustiveEnum::Tuple(_) => {} + _ => {} + } + //~^^ some variants are not matched explicitly +} + +#[deny(non_exhaustive_omitted_patterns)] +// Ok: Pattern in a param is always wildcard +pub fn takes_non_exhaustive(_: NonExhaustiveEnum) { + let _closure = |_: NonExhaustiveEnum| {}; } diff --git a/tests/ui/rfc-2008-non-exhaustive/omitted-patterns.stderr b/tests/ui/rfc-2008-non-exhaustive/omitted-patterns.stderr index 996bd4a12..923394474 100644 --- a/tests/ui/rfc-2008-non-exhaustive/omitted-patterns.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/omitted-patterns.stderr @@ -184,5 +184,34 @@ note: the lint level is defined here LL | #[deny(non_exhaustive_omitted_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 8 previous errors; 6 warnings emitted +error[E0005]: refutable pattern in local binding + --> $DIR/omitted-patterns.rs:194:9 + | +LL | let local_refutable @ NonExhaustiveEnum::Unit = NonExhaustiveEnum::Unit; + | ^^^^^^^^^^^^^^^ pattern `_` not covered + | + = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant + = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html + = note: the matched value is of type `NonExhaustiveEnum` +help: you might want to use `let else` to handle the variant that isn't matched + | +LL | let local_refutable @ NonExhaustiveEnum::Unit = NonExhaustiveEnum::Unit else { todo!() }; + | ++++++++++++++++ + +error: some variants are not matched explicitly + --> $DIR/omitted-patterns.rs:202:9 + | +LL | _ => {} + | ^ pattern `NonExhaustiveEnum::Struct { .. }` not covered + | + = help: ensure that all variants are matched explicitly by adding the suggested match arms + = note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found +note: the lint level is defined here + --> $DIR/omitted-patterns.rs:198:12 + | +LL | #[deny(non_exhaustive_omitted_patterns)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 10 previous errors; 6 warnings emitted +For more information about this error, try `rustc --explain E0005`. diff --git a/tests/ui/rfc-2008-non-exhaustive/struct.stderr b/tests/ui/rfc-2008-non-exhaustive/struct.stderr index 2cb9ba0d1..39b1ef1e0 100644 --- a/tests/ui/rfc-2008-non-exhaustive/struct.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/struct.stderr @@ -10,14 +10,11 @@ error[E0603]: tuple struct constructor `TupleStruct` is private LL | let ts_explicit = structs::TupleStruct(640, 480); | ^^^^^^^^^^^ private tuple struct constructor | - ::: $DIR/auxiliary/structs.rs:12:24 - | -LL | pub struct TupleStruct(pub u16, pub u16); - | ---------------- a constructor is private if any of the fields is private - | note: the tuple struct constructor `TupleStruct` is defined here --> $DIR/auxiliary/structs.rs:12:1 | +LL | #[non_exhaustive] + | ----------------- cannot be constructed because it is `#[non_exhaustive]` LL | pub struct TupleStruct(pub u16, pub u16); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -30,6 +27,8 @@ LL | let us_explicit = structs::UnitStruct; note: the unit struct `UnitStruct` is defined here --> $DIR/auxiliary/structs.rs:9:1 | +LL | #[non_exhaustive] + | ----------------- cannot be constructed because it is `#[non_exhaustive]` LL | pub struct UnitStruct; | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/rfc-2008-non-exhaustive/variant.stderr b/tests/ui/rfc-2008-non-exhaustive/variant.stderr index 720b7b119..4083f57a9 100644 --- a/tests/ui/rfc-2008-non-exhaustive/variant.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/variant.stderr @@ -8,7 +8,9 @@ note: the tuple variant `Tuple` is defined here --> $DIR/auxiliary/variants.rs:5:23 | LL | #[non_exhaustive] Tuple(u32), - | ^^^^^ + | ----------------- ^^^^^ + | | + | cannot be constructed because it is `#[non_exhaustive]` error[E0603]: unit variant `Unit` is private --> $DIR/variant.rs:14:47 @@ -20,7 +22,9 @@ note: the unit variant `Unit` is defined here --> $DIR/auxiliary/variants.rs:4:23 | LL | #[non_exhaustive] Unit, - | ^^^^ + | ----------------- ^^^^ + | | + | cannot be constructed because it is `#[non_exhaustive]` error[E0603]: unit variant `Unit` is private --> $DIR/variant.rs:18:32 @@ -32,7 +36,9 @@ note: the unit variant `Unit` is defined here --> $DIR/auxiliary/variants.rs:4:23 | LL | #[non_exhaustive] Unit, - | ^^^^ + | ----------------- ^^^^ + | | + | cannot be constructed because it is `#[non_exhaustive]` error[E0603]: tuple variant `Tuple` is private --> $DIR/variant.rs:20:32 @@ -44,7 +50,9 @@ note: the tuple variant `Tuple` is defined here --> $DIR/auxiliary/variants.rs:5:23 | LL | #[non_exhaustive] Tuple(u32), - | ^^^^^ + | ----------------- ^^^^^ + | | + | cannot be constructed because it is `#[non_exhaustive]` error[E0603]: tuple variant `Tuple` is private --> $DIR/variant.rs:26:35 @@ -56,7 +64,9 @@ note: the tuple variant `Tuple` is defined here --> $DIR/auxiliary/variants.rs:5:23 | LL | #[non_exhaustive] Tuple(u32), - | ^^^^^ + | ----------------- ^^^^^ + | | + | cannot be constructed because it is `#[non_exhaustive]` error[E0639]: cannot create non-exhaustive variant using struct expression --> $DIR/variant.rs:8:26 diff --git a/tests/ui/rfc-2091-track-caller/intrinsic-wrapper.rs b/tests/ui/rfc-2091-track-caller/intrinsic-wrapper.rs index 87e52881c..23d2a4b0a 100644 --- a/tests/ui/rfc-2091-track-caller/intrinsic-wrapper.rs +++ b/tests/ui/rfc-2091-track-caller/intrinsic-wrapper.rs @@ -1,5 +1,6 @@ // run-pass // revisions: default mir-opt +//[default] compile-flags: -Zinline-mir=no //[mir-opt] compile-flags: -Zmir-opt-level=4 macro_rules! caller_location_from_macro { @@ -9,13 +10,13 @@ macro_rules! caller_location_from_macro { fn main() { let loc = core::panic::Location::caller(); assert_eq!(loc.file(), file!()); - assert_eq!(loc.line(), 10); + assert_eq!(loc.line(), 11); assert_eq!(loc.column(), 15); // `Location::caller()` in a macro should behave similarly to `file!` and `line!`, // i.e. point to where the macro was invoked, instead of the macro itself. let loc2 = caller_location_from_macro!(); assert_eq!(loc2.file(), file!()); - assert_eq!(loc2.line(), 17); + assert_eq!(loc2.line(), 18); assert_eq!(loc2.column(), 16); } diff --git a/tests/ui/rfc-2091-track-caller/mir-inlined-macro.rs b/tests/ui/rfc-2091-track-caller/mir-inlined-macro.rs new file mode 100644 index 000000000..a2e8eb27e --- /dev/null +++ b/tests/ui/rfc-2091-track-caller/mir-inlined-macro.rs @@ -0,0 +1,23 @@ +// run-pass +// revisions: default mir-opt +//[default] compile-flags: -Zinline-mir=no +//[mir-opt] compile-flags: -Zmir-opt-level=4 + +use std::panic::Location; + +macro_rules! f { + () => { + Location::caller() + }; +} + +#[inline(always)] +fn g() -> &'static Location<'static> { + f!() +} + +fn main() { + let loc = g(); + assert_eq!(loc.line(), 16); + assert_eq!(loc.column(), 5); +} diff --git a/tests/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr b/tests/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr index d8b5a9e63..ce165e646 100644 --- a/tests/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr +++ b/tests/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr @@ -9,7 +9,8 @@ LL | let _: NotDebug = dbg!(NotDebug); = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `NotDebug` with `#[derive(Debug)]` | -LL | #[derive(Debug)] +LL + #[derive(Debug)] +LL | struct NotDebug; | error: aborting due to previous error diff --git a/tests/ui/rfc-2632-const-trait-impl/call-generic-method-nonconst.stderr b/tests/ui/rfc-2632-const-trait-impl/call-generic-method-nonconst.stderr index 706f52343..a28d6ce05 100644 --- a/tests/ui/rfc-2632-const-trait-impl/call-generic-method-nonconst.stderr +++ b/tests/ui/rfc-2632-const-trait-impl/call-generic-method-nonconst.stderr @@ -1,21 +1,14 @@ error[E0277]: the trait bound `S: ~const Foo` is not satisfied - --> $DIR/call-generic-method-nonconst.rs:23:34 + --> $DIR/call-generic-method-nonconst.rs:23:22 | LL | pub const EQ: bool = equals_self(&S); - | ----------- ^^ the trait `~const Foo` is not implemented for `S` - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^ the trait `~const Foo` is not implemented for `S` | note: the trait `Foo` is implemented for `S`, but that implementation is not `const` - --> $DIR/call-generic-method-nonconst.rs:23:34 + --> $DIR/call-generic-method-nonconst.rs:23:22 | LL | pub const EQ: bool = equals_self(&S); - | ^^ -note: required by a bound in `equals_self` - --> $DIR/call-generic-method-nonconst.rs:16:25 - | -LL | const fn equals_self(t: &T) -> bool { - | ^^^^^^^^^^ required by this bound in `equals_self` + | ^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/tests/ui/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr b/tests/ui/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr index 4470e287c..ffc24ec6e 100644 --- a/tests/ui/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr +++ b/tests/ui/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr @@ -1,22 +1,15 @@ error[E0277]: the trait bound `(): ~const Tr` is not satisfied in `fn(()) -> i32 {<() as Tr>::a}` - --> $DIR/const-closure-trait-method-fail.rs:16:42 + --> $DIR/const-closure-trait-method-fail.rs:16:23 | LL | const _: () = assert!(need_const_closure(Tr::a) == 42); - | ------------------ ^^^^^ within `fn(()) -> i32 {<() as Tr>::a}`, the trait `~const Tr` is not implemented for `()` - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^^ within `fn(()) -> i32 {<() as Tr>::a}`, the trait `~const Tr` is not implemented for `()` | note: the trait `Tr` is implemented for `()`, but that implementation is not `const` - --> $DIR/const-closure-trait-method-fail.rs:16:42 + --> $DIR/const-closure-trait-method-fail.rs:16:23 | LL | const _: () = assert!(need_const_closure(Tr::a) == 42); - | ^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ = note: required because it appears within the type `fn(()) -> i32 {<() as Tr>::a}` -note: required by a bound in `need_const_closure` - --> $DIR/const-closure-trait-method-fail.rs:12:32 - | -LL | const fn need_const_closure i32>(x: T) -> i32 { - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `need_const_closure` error: aborting due to previous error diff --git a/tests/ui/rfc-2632-const-trait-impl/const-drop-fail-2.precise.stderr b/tests/ui/rfc-2632-const-trait-impl/const-drop-fail-2.precise.stderr new file mode 100644 index 000000000..bcdc80f82 --- /dev/null +++ b/tests/ui/rfc-2632-const-trait-impl/const-drop-fail-2.precise.stderr @@ -0,0 +1,50 @@ +error[E0277]: the trait bound `NonTrivialDrop: ~const A` is not satisfied + --> $DIR/const-drop-fail-2.rs:31:23 + | +LL | const _: () = check::>( + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `~const A` is not implemented for `NonTrivialDrop` + | +note: the trait `A` is implemented for `NonTrivialDrop`, but that implementation is not `const` + --> $DIR/const-drop-fail-2.rs:31:23 + | +LL | const _: () = check::>( + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `ConstDropImplWithBounds` + --> $DIR/const-drop-fail-2.rs:21:35 + | +LL | struct ConstDropImplWithBounds(PhantomData); + | ^^^^^^^^ required by this bound in `ConstDropImplWithBounds` + +error[E0277]: the trait bound `NonTrivialDrop: ~const A` is not satisfied + --> $DIR/const-drop-fail-2.rs:33:5 + | +LL | ConstDropImplWithBounds(PhantomData) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `~const A` is not implemented for `NonTrivialDrop` + | +note: the trait `A` is implemented for `NonTrivialDrop`, but that implementation is not `const` + --> $DIR/const-drop-fail-2.rs:33:5 + | +LL | ConstDropImplWithBounds(PhantomData) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `ConstDropImplWithBounds` + --> $DIR/const-drop-fail-2.rs:21:35 + | +LL | struct ConstDropImplWithBounds(PhantomData); + | ^^^^^^^^ required by this bound in `ConstDropImplWithBounds` + +error[E0367]: `Drop` impl requires `T: ~const A` but the struct it is implemented for does not + --> $DIR/const-drop-fail-2.rs:39:9 + | +LL | impl const Drop for ConstDropImplWithNonConstBounds { + | ^^^^^^^^ + | +note: the implementor must specify the same requirement + --> $DIR/const-drop-fail-2.rs:37:1 + | +LL | struct ConstDropImplWithNonConstBounds(PhantomData); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0277, E0367. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/rfc-2632-const-trait-impl/const-drop-fail-2.rs b/tests/ui/rfc-2632-const-trait-impl/const-drop-fail-2.rs new file mode 100644 index 000000000..6a252c5d3 --- /dev/null +++ b/tests/ui/rfc-2632-const-trait-impl/const-drop-fail-2.rs @@ -0,0 +1,46 @@ +// revisions: stock precise +#![feature(const_trait_impl)] +#![feature(const_mut_refs)] +#![cfg_attr(precise, feature(const_precise_live_drops))] + +use std::marker::{Destruct, PhantomData}; + +struct NonTrivialDrop; + +impl Drop for NonTrivialDrop { + fn drop(&mut self) { + println!("Non trivial drop"); + } +} + +#[const_trait] +trait A { fn a() { } } + +impl A for NonTrivialDrop {} + +struct ConstDropImplWithBounds(PhantomData); + +impl const Drop for ConstDropImplWithBounds { + fn drop(&mut self) { + T::a(); + } +} + +const fn check(_: T) {} + +const _: () = check::>( + //~^ ERROR the trait bound + ConstDropImplWithBounds(PhantomData) + //~^ ERROR the trait bound +); + +struct ConstDropImplWithNonConstBounds(PhantomData); + +impl const Drop for ConstDropImplWithNonConstBounds { +//~^ ERROR `Drop` impl requires `T: ~const A` but the struct it is implemented for does not + fn drop(&mut self) { + T::a(); + } +} + +fn main() {} diff --git a/tests/ui/rfc-2632-const-trait-impl/const-drop-fail-2.stock.stderr b/tests/ui/rfc-2632-const-trait-impl/const-drop-fail-2.stock.stderr new file mode 100644 index 000000000..bcdc80f82 --- /dev/null +++ b/tests/ui/rfc-2632-const-trait-impl/const-drop-fail-2.stock.stderr @@ -0,0 +1,50 @@ +error[E0277]: the trait bound `NonTrivialDrop: ~const A` is not satisfied + --> $DIR/const-drop-fail-2.rs:31:23 + | +LL | const _: () = check::>( + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `~const A` is not implemented for `NonTrivialDrop` + | +note: the trait `A` is implemented for `NonTrivialDrop`, but that implementation is not `const` + --> $DIR/const-drop-fail-2.rs:31:23 + | +LL | const _: () = check::>( + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `ConstDropImplWithBounds` + --> $DIR/const-drop-fail-2.rs:21:35 + | +LL | struct ConstDropImplWithBounds(PhantomData); + | ^^^^^^^^ required by this bound in `ConstDropImplWithBounds` + +error[E0277]: the trait bound `NonTrivialDrop: ~const A` is not satisfied + --> $DIR/const-drop-fail-2.rs:33:5 + | +LL | ConstDropImplWithBounds(PhantomData) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `~const A` is not implemented for `NonTrivialDrop` + | +note: the trait `A` is implemented for `NonTrivialDrop`, but that implementation is not `const` + --> $DIR/const-drop-fail-2.rs:33:5 + | +LL | ConstDropImplWithBounds(PhantomData) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `ConstDropImplWithBounds` + --> $DIR/const-drop-fail-2.rs:21:35 + | +LL | struct ConstDropImplWithBounds(PhantomData); + | ^^^^^^^^ required by this bound in `ConstDropImplWithBounds` + +error[E0367]: `Drop` impl requires `T: ~const A` but the struct it is implemented for does not + --> $DIR/const-drop-fail-2.rs:39:9 + | +LL | impl const Drop for ConstDropImplWithNonConstBounds { + | ^^^^^^^^ + | +note: the implementor must specify the same requirement + --> $DIR/const-drop-fail-2.rs:37:1 + | +LL | struct ConstDropImplWithNonConstBounds(PhantomData); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0277, E0367. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr b/tests/ui/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr index 796c0d388..40caada51 100644 --- a/tests/ui/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr +++ b/tests/ui/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr @@ -1,99 +1,58 @@ error[E0277]: can't drop `NonTrivialDrop` in const contexts - --> $DIR/const-drop-fail.rs:44:5 + --> $DIR/const-drop-fail.rs:26:23 | -LL | const _: () = check($exp); - | ----- required by a bound introduced by this call +LL | const _: () = check($exp); + | ^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `NonTrivialDrop` ... -LL | NonTrivialDrop, - | ^^^^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `NonTrivialDrop` +LL | / check_all! { +LL | | NonTrivialDrop, +LL | | ConstImplWithDropGlue(NonTrivialDrop), +LL | | } + | |_- in this macro invocation | - = note: the trait bound `NonTrivialDrop: ~const Destruct` is not satisfied -note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:35:19 - | -LL | const fn check(_: T) {} - | ^^^^^^^^^^^^^^^ required by this bound in `check` -help: consider borrowing here +note: the trait `Destruct` is implemented for `NonTrivialDrop`, but that implementation is not `const` + --> $DIR/const-drop-fail.rs:26:23 | -LL | &NonTrivialDrop, - | + -LL | &mut NonTrivialDrop, - | ++++ +LL | const _: () = check($exp); + | ^^^^^^^^^^^ +... +LL | / check_all! { +LL | | NonTrivialDrop, +LL | | ConstImplWithDropGlue(NonTrivialDrop), +LL | | } + | |_- in this macro invocation + = note: this error originates in the macro `check_all` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: can't drop `NonTrivialDrop` in const contexts - --> $DIR/const-drop-fail.rs:46:5 + --> $DIR/const-drop-fail.rs:26:23 | -LL | const _: () = check($exp); - | ----- required by a bound introduced by this call +LL | const _: () = check($exp); + | ^^^^^^^^^^^ within `ConstImplWithDropGlue`, the trait `~const Destruct` is not implemented for `NonTrivialDrop` ... -LL | ConstImplWithDropGlue(NonTrivialDrop), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `ConstImplWithDropGlue`, the trait `~const Destruct` is not implemented for `NonTrivialDrop` +LL | / check_all! { +LL | | NonTrivialDrop, +LL | | ConstImplWithDropGlue(NonTrivialDrop), +LL | | } + | |_- in this macro invocation | note: the trait `Destruct` is implemented for `NonTrivialDrop`, but that implementation is not `const` - --> $DIR/const-drop-fail.rs:46:5 + --> $DIR/const-drop-fail.rs:26:23 | -LL | ConstImplWithDropGlue(NonTrivialDrop), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | const _: () = check($exp); + | ^^^^^^^^^^^ +... +LL | / check_all! { +LL | | NonTrivialDrop, +LL | | ConstImplWithDropGlue(NonTrivialDrop), +LL | | } + | |_- in this macro invocation note: required because it appears within the type `ConstImplWithDropGlue` --> $DIR/const-drop-fail.rs:16:8 | LL | struct ConstImplWithDropGlue(NonTrivialDrop); | ^^^^^^^^^^^^^^^^^^^^^ -note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:35:19 - | -LL | const fn check(_: T) {} - | ^^^^^^^^^^^^^^^ required by this bound in `check` - -error[E0277]: the trait bound `NonTrivialDrop: ~const A` is not satisfied - --> $DIR/const-drop-fail.rs:48:47 - | -LL | ConstDropImplWithBounds::(PhantomData), - | ----------------------------------------- ^^^^^^^^^^^ the trait `~const A` is not implemented for `NonTrivialDrop` - | | - | required by a bound introduced by this call - | -note: the trait `A` is implemented for `NonTrivialDrop`, but that implementation is not `const` - --> $DIR/const-drop-fail.rs:48:47 - | -LL | ConstDropImplWithBounds::(PhantomData), - | ^^^^^^^^^^^ -note: required by a bound in `ConstDropImplWithBounds` - --> $DIR/const-drop-fail.rs:27:35 - | -LL | struct ConstDropImplWithBounds(PhantomData); - | ^^^^^^^^ required by this bound in `ConstDropImplWithBounds` - -error[E0277]: the trait bound `NonTrivialDrop: ~const A` is not satisfied - --> $DIR/const-drop-fail.rs:48:5 - | -LL | ConstDropImplWithBounds::(PhantomData), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `~const A` is not implemented for `NonTrivialDrop` - | -note: the trait `A` is implemented for `NonTrivialDrop`, but that implementation is not `const` - --> $DIR/const-drop-fail.rs:48:5 - | -LL | ConstDropImplWithBounds::(PhantomData), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required by a bound in `ConstDropImplWithBounds` - --> $DIR/const-drop-fail.rs:27:35 - | -LL | struct ConstDropImplWithBounds(PhantomData); - | ^^^^^^^^ required by this bound in `ConstDropImplWithBounds` - -error[E0367]: `Drop` impl requires `T: ~const A` but the struct it is implemented for does not - --> $DIR/const-drop-fail.rs:55:9 - | -LL | impl const Drop for ConstDropImplWithNonConstBounds { - | ^^^^^^^^ - | -note: the implementor must specify the same requirement - --> $DIR/const-drop-fail.rs:53:1 - | -LL | struct ConstDropImplWithNonConstBounds(PhantomData); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the macro `check_all` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 5 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0277, E0367. -For more information about an error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/rfc-2632-const-trait-impl/const-drop-fail.rs b/tests/ui/rfc-2632-const-trait-impl/const-drop-fail.rs index d36c7f81c..c4bdb9ef5 100644 --- a/tests/ui/rfc-2632-const-trait-impl/const-drop-fail.rs +++ b/tests/ui/rfc-2632-const-trait-impl/const-drop-fail.rs @@ -19,44 +19,19 @@ impl const Drop for ConstImplWithDropGlue { fn drop(&mut self) {} } -#[const_trait] -trait A { fn a() { } } - -impl A for NonTrivialDrop {} - -struct ConstDropImplWithBounds(PhantomData); - -impl const Drop for ConstDropImplWithBounds { - fn drop(&mut self) { - T::a(); - } -} - const fn check(_: T) {} macro_rules! check_all { ($($exp:expr),*$(,)?) => {$( const _: () = check($exp); + //~^ ERROR can't drop + //~| ERROR can't drop )*}; } check_all! { NonTrivialDrop, - //~^ ERROR can't drop ConstImplWithDropGlue(NonTrivialDrop), - //~^ ERROR can't drop - ConstDropImplWithBounds::(PhantomData), - //~^ ERROR the trait bound - //~| ERROR the trait bound -} - -struct ConstDropImplWithNonConstBounds(PhantomData); - -impl const Drop for ConstDropImplWithNonConstBounds { -//~^ ERROR `Drop` impl requires `T: ~const A` but the struct it is implemented for does not - fn drop(&mut self) { - T::a(); - } } fn main() {} diff --git a/tests/ui/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr b/tests/ui/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr index 796c0d388..40caada51 100644 --- a/tests/ui/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr +++ b/tests/ui/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr @@ -1,99 +1,58 @@ error[E0277]: can't drop `NonTrivialDrop` in const contexts - --> $DIR/const-drop-fail.rs:44:5 + --> $DIR/const-drop-fail.rs:26:23 | -LL | const _: () = check($exp); - | ----- required by a bound introduced by this call +LL | const _: () = check($exp); + | ^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `NonTrivialDrop` ... -LL | NonTrivialDrop, - | ^^^^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `NonTrivialDrop` +LL | / check_all! { +LL | | NonTrivialDrop, +LL | | ConstImplWithDropGlue(NonTrivialDrop), +LL | | } + | |_- in this macro invocation | - = note: the trait bound `NonTrivialDrop: ~const Destruct` is not satisfied -note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:35:19 - | -LL | const fn check(_: T) {} - | ^^^^^^^^^^^^^^^ required by this bound in `check` -help: consider borrowing here +note: the trait `Destruct` is implemented for `NonTrivialDrop`, but that implementation is not `const` + --> $DIR/const-drop-fail.rs:26:23 | -LL | &NonTrivialDrop, - | + -LL | &mut NonTrivialDrop, - | ++++ +LL | const _: () = check($exp); + | ^^^^^^^^^^^ +... +LL | / check_all! { +LL | | NonTrivialDrop, +LL | | ConstImplWithDropGlue(NonTrivialDrop), +LL | | } + | |_- in this macro invocation + = note: this error originates in the macro `check_all` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: can't drop `NonTrivialDrop` in const contexts - --> $DIR/const-drop-fail.rs:46:5 + --> $DIR/const-drop-fail.rs:26:23 | -LL | const _: () = check($exp); - | ----- required by a bound introduced by this call +LL | const _: () = check($exp); + | ^^^^^^^^^^^ within `ConstImplWithDropGlue`, the trait `~const Destruct` is not implemented for `NonTrivialDrop` ... -LL | ConstImplWithDropGlue(NonTrivialDrop), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `ConstImplWithDropGlue`, the trait `~const Destruct` is not implemented for `NonTrivialDrop` +LL | / check_all! { +LL | | NonTrivialDrop, +LL | | ConstImplWithDropGlue(NonTrivialDrop), +LL | | } + | |_- in this macro invocation | note: the trait `Destruct` is implemented for `NonTrivialDrop`, but that implementation is not `const` - --> $DIR/const-drop-fail.rs:46:5 + --> $DIR/const-drop-fail.rs:26:23 | -LL | ConstImplWithDropGlue(NonTrivialDrop), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | const _: () = check($exp); + | ^^^^^^^^^^^ +... +LL | / check_all! { +LL | | NonTrivialDrop, +LL | | ConstImplWithDropGlue(NonTrivialDrop), +LL | | } + | |_- in this macro invocation note: required because it appears within the type `ConstImplWithDropGlue` --> $DIR/const-drop-fail.rs:16:8 | LL | struct ConstImplWithDropGlue(NonTrivialDrop); | ^^^^^^^^^^^^^^^^^^^^^ -note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:35:19 - | -LL | const fn check(_: T) {} - | ^^^^^^^^^^^^^^^ required by this bound in `check` - -error[E0277]: the trait bound `NonTrivialDrop: ~const A` is not satisfied - --> $DIR/const-drop-fail.rs:48:47 - | -LL | ConstDropImplWithBounds::(PhantomData), - | ----------------------------------------- ^^^^^^^^^^^ the trait `~const A` is not implemented for `NonTrivialDrop` - | | - | required by a bound introduced by this call - | -note: the trait `A` is implemented for `NonTrivialDrop`, but that implementation is not `const` - --> $DIR/const-drop-fail.rs:48:47 - | -LL | ConstDropImplWithBounds::(PhantomData), - | ^^^^^^^^^^^ -note: required by a bound in `ConstDropImplWithBounds` - --> $DIR/const-drop-fail.rs:27:35 - | -LL | struct ConstDropImplWithBounds(PhantomData); - | ^^^^^^^^ required by this bound in `ConstDropImplWithBounds` - -error[E0277]: the trait bound `NonTrivialDrop: ~const A` is not satisfied - --> $DIR/const-drop-fail.rs:48:5 - | -LL | ConstDropImplWithBounds::(PhantomData), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `~const A` is not implemented for `NonTrivialDrop` - | -note: the trait `A` is implemented for `NonTrivialDrop`, but that implementation is not `const` - --> $DIR/const-drop-fail.rs:48:5 - | -LL | ConstDropImplWithBounds::(PhantomData), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required by a bound in `ConstDropImplWithBounds` - --> $DIR/const-drop-fail.rs:27:35 - | -LL | struct ConstDropImplWithBounds(PhantomData); - | ^^^^^^^^ required by this bound in `ConstDropImplWithBounds` - -error[E0367]: `Drop` impl requires `T: ~const A` but the struct it is implemented for does not - --> $DIR/const-drop-fail.rs:55:9 - | -LL | impl const Drop for ConstDropImplWithNonConstBounds { - | ^^^^^^^^ - | -note: the implementor must specify the same requirement - --> $DIR/const-drop-fail.rs:53:1 - | -LL | struct ConstDropImplWithNonConstBounds(PhantomData); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the macro `check_all` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 5 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0277, E0367. -For more information about an error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/rfc-2632-const-trait-impl/const_derives/derive-const-non-const-type.rs b/tests/ui/rfc-2632-const-trait-impl/const_derives/derive-const-non-const-type.rs index 92843a8a2..ed6699f37 100644 --- a/tests/ui/rfc-2632-const-trait-impl/const_derives/derive-const-non-const-type.rs +++ b/tests/ui/rfc-2632-const-trait-impl/const_derives/derive-const-non-const-type.rs @@ -9,5 +9,6 @@ impl Default for A { #[derive_const(Default)] pub struct S(A); //~^ cannot call non-const fn +//~| the trait bound fn main() {} diff --git a/tests/ui/rfc-2632-const-trait-impl/const_derives/derive-const-non-const-type.stderr b/tests/ui/rfc-2632-const-trait-impl/const_derives/derive-const-non-const-type.stderr index 96e0c78b9..653037ef3 100644 --- a/tests/ui/rfc-2632-const-trait-impl/const_derives/derive-const-non-const-type.stderr +++ b/tests/ui/rfc-2632-const-trait-impl/const_derives/derive-const-non-const-type.stderr @@ -1,3 +1,25 @@ +error[E0277]: the trait bound `A: Default` is not satisfied + --> $DIR/derive-const-non-const-type.rs:10:14 + | +LL | #[derive_const(Default)] + | ------- in this derive macro expansion +LL | pub struct S(A); + | ^ the trait `~const Default` is not implemented for `A` + | +note: the trait `Default` is implemented for `A`, but that implementation is not `const` + --> $DIR/derive-const-non-const-type.rs:10:14 + | +LL | #[derive_const(Default)] + | ------- in this derive macro expansion +LL | pub struct S(A); + | ^ + = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider annotating `A` with `#[derive(Default)]` + | +LL + #[derive(Default)] +LL | pub struct A; + | + error[E0015]: cannot call non-const fn `::default` in constant functions --> $DIR/derive-const-non-const-type.rs:10:14 | @@ -10,6 +32,7 @@ LL | pub struct S(A); = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0015`. +Some errors have detailed explanations: E0015, E0277. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.stderr b/tests/ui/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.stderr index a244ab10c..26644f72c 100644 --- a/tests/ui/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.stderr +++ b/tests/ui/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.stderr @@ -1,19 +1,14 @@ error[E0277]: the trait bound `(): ~const Tr` is not satisfied - --> $DIR/default-method-body-is-const-body-checking.rs:12:15 + --> $DIR/default-method-body-is-const-body-checking.rs:12:9 | LL | foo::<()>(); - | ^^ the trait `~const Tr` is not implemented for `()` + | ^^^^^^^^^^^ the trait `~const Tr` is not implemented for `()` | note: the trait `Tr` is implemented for `()`, but that implementation is not `const` - --> $DIR/default-method-body-is-const-body-checking.rs:12:15 + --> $DIR/default-method-body-is-const-body-checking.rs:12:9 | LL | foo::<()>(); - | ^^ -note: required by a bound in `foo` - --> $DIR/default-method-body-is-const-body-checking.rs:7:28 - | -LL | const fn foo() where T: ~const Tr {} - | ^^^^^^^^^ required by this bound in `foo` + | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/tests/ui/rfc-2632-const-trait-impl/function-pointer-does-not-require-const.rs b/tests/ui/rfc-2632-const-trait-impl/function-pointer-does-not-require-const.rs index 1726cf82e..60790e297 100644 --- a/tests/ui/rfc-2632-const-trait-impl/function-pointer-does-not-require-const.rs +++ b/tests/ui/rfc-2632-const-trait-impl/function-pointer-does-not-require-const.rs @@ -1,8 +1,15 @@ // check-pass +#![feature(const_trait_impl)] -type I32Cmp = fn(&i32, &i32) -> core::cmp::Ordering; -pub const fn min_by_i32() -> fn(i32, i32, I32Cmp) -> i32 { - core::cmp::min_by +#[const_trait] +pub trait Test {} + +impl Test for () {} + +pub const fn test() {} + +pub const fn min_by_i32() -> fn() { + test::<()> } fn main() {} diff --git a/tests/ui/rfc-2632-const-trait-impl/gate.rs b/tests/ui/rfc-2632-const-trait-impl/gate.rs index f2cd26c91..d1c93ab9f 100644 --- a/tests/ui/rfc-2632-const-trait-impl/gate.rs +++ b/tests/ui/rfc-2632-const-trait-impl/gate.rs @@ -1,5 +1,13 @@ // gate-test-const_closures + fn main() { (const || {})(); //~^ ERROR: const closures are experimental } + +macro_rules! e { + ($e:expr) => {} +} + +e!((const || {})); +//~^ ERROR const closures are experimental diff --git a/tests/ui/rfc-2632-const-trait-impl/gate.stderr b/tests/ui/rfc-2632-const-trait-impl/gate.stderr index 30edc4127..11cc2cd56 100644 --- a/tests/ui/rfc-2632-const-trait-impl/gate.stderr +++ b/tests/ui/rfc-2632-const-trait-impl/gate.stderr @@ -1,12 +1,21 @@ error[E0658]: const closures are experimental - --> $DIR/gate.rs:3:6 + --> $DIR/gate.rs:4:6 | LL | (const || {})(); - | ^^^^^^^^^^^ + | ^^^^^ | = note: see issue #106003 for more information = help: add `#![feature(const_closures)]` to the crate attributes to enable -error: aborting due to previous error +error[E0658]: const closures are experimental + --> $DIR/gate.rs:12:5 + | +LL | e!((const || {})); + | ^^^^^ + | + = note: see issue #106003 for more information + = help: add `#![feature(const_closures)]` to the crate attributes to enable + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/rfc-2632-const-trait-impl/nested-closure.rs b/tests/ui/rfc-2632-const-trait-impl/nested-closure.rs index a85113600..0b423b340 100644 --- a/tests/ui/rfc-2632-const-trait-impl/nested-closure.rs +++ b/tests/ui/rfc-2632-const-trait-impl/nested-closure.rs @@ -1,6 +1,6 @@ // check-pass -#![feature(const_trait_impl, once_cell)] +#![feature(const_trait_impl, lazy_cell)] use std::sync::LazyLock; diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.rs new file mode 100644 index 000000000..0d59e5026 --- /dev/null +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.rs @@ -0,0 +1,7 @@ +// only-x86_64 + +#![feature(target_feature_11)] + +#[target_feature(enable = "avx2")] +fn main() {} +//~^ ERROR `main` function is not allowed to have `#[target_feature]` diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.stderr new file mode 100644 index 000000000..cfafbd522 --- /dev/null +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.stderr @@ -0,0 +1,8 @@ +error: `main` function is not allowed to have `#[target_feature]` + --> $DIR/issue-108645-target-feature-on-main.rs:6:1 + | +LL | fn main() {} + | ^^^^^^^^^ `main` function is not allowed to have `#[target_feature]` + +error: aborting due to previous error + diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.rs new file mode 100644 index 000000000..50e8ce2fd --- /dev/null +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.rs @@ -0,0 +1,9 @@ +// only-x86_64 + +#![feature(start)] +#![feature(target_feature_11)] + +#[start] +#[target_feature(enable = "avx2")] +//~^ ERROR `start` is not allowed to have `#[target_feature]` +fn start(_argc: isize, _argv: *const *const u8) -> isize { 0 } diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr new file mode 100644 index 000000000..07687f3c7 --- /dev/null +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr @@ -0,0 +1,11 @@ +error: `start` is not allowed to have `#[target_feature]` + --> $DIR/issue-108645-target-feature-on-start.rs:7:1 + | +LL | #[target_feature(enable = "avx2")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | fn start(_argc: isize, _argv: *const *const u8) -> isize { 0 } + | -------------------------------------------------------- `start` is not allowed to have `#[target_feature]` + +error: aborting due to previous error + diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.rs index 7314fa8cc..9108f27b5 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.rs +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.rs @@ -18,4 +18,10 @@ impl Foo for Bar { unsafe fn unsf_foo(&self) {} } +trait Qux { + #[target_feature(enable = "sse2")] + //~^ ERROR cannot be applied to safe trait method + fn foo(&self) {} +} + fn main() {} diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.stderr index 07d6e0900..eb0f18edd 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.stderr +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.stderr @@ -1,3 +1,12 @@ +error: `#[target_feature(..)]` cannot be applied to safe trait method + --> $DIR/trait-impl.rs:22:5 + | +LL | #[target_feature(enable = "sse2")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method +LL | +LL | fn foo(&self) {} + | ------------- not an `unsafe` function + error: `#[target_feature(..)]` cannot be applied to safe trait method --> $DIR/trait-impl.rs:13:5 | @@ -7,5 +16,5 @@ LL | LL | fn foo(&self) {} | ------------- not an `unsafe` function -error: aborting due to previous error +error: aborting due to 2 previous errors diff --git a/tests/ui/runtime/backtrace-debuginfo.rs b/tests/ui/runtime/backtrace-debuginfo.rs index 8b5466b6c..5d233b38d 100644 --- a/tests/ui/runtime/backtrace-debuginfo.rs +++ b/tests/ui/runtime/backtrace-debuginfo.rs @@ -9,7 +9,6 @@ // compile-flags:-g -Copt-level=0 -Cllvm-args=-enable-tail-merge=0 // compile-flags:-Cforce-frame-pointers=yes // compile-flags:-Cstrip=none -// ignore-pretty issue #37195 // ignore-emscripten spawning processes is not supported // ignore-sgx no processes // ignore-fuchsia Backtrace not symbolized, trace different line alignment diff --git a/tests/ui/rust-2018/edition-lint-fully-qualified-paths.fixed b/tests/ui/rust-2018/edition-lint-fully-qualified-paths.fixed index 85d106bc1..ede0c2e8e 100644 --- a/tests/ui/rust-2018/edition-lint-fully-qualified-paths.fixed +++ b/tests/ui/rust-2018/edition-lint-fully-qualified-paths.fixed @@ -18,9 +18,11 @@ mod foo { fn main() { let _: ::Bar = (); //~^ ERROR absolute paths must start with - //~| this is accepted in the current edition + //~| WARN this is accepted in the current edition + //~| ERROR absolute paths must start with + //~| WARN this is accepted in the current edition let _: ::Bar = (); //~^ ERROR absolute paths must start with - //~| this is accepted in the current edition + //~| WARN this is accepted in the current edition } diff --git a/tests/ui/rust-2018/edition-lint-fully-qualified-paths.rs b/tests/ui/rust-2018/edition-lint-fully-qualified-paths.rs index 9ff3c2e5f..48b091ddb 100644 --- a/tests/ui/rust-2018/edition-lint-fully-qualified-paths.rs +++ b/tests/ui/rust-2018/edition-lint-fully-qualified-paths.rs @@ -18,9 +18,11 @@ mod foo { fn main() { let _: ::Bar = (); //~^ ERROR absolute paths must start with - //~| this is accepted in the current edition + //~| WARN this is accepted in the current edition + //~| ERROR absolute paths must start with + //~| WARN this is accepted in the current edition let _: <::foo::Baz as foo::Foo>::Bar = (); //~^ ERROR absolute paths must start with - //~| this is accepted in the current edition + //~| WARN this is accepted in the current edition } diff --git a/tests/ui/rust-2018/edition-lint-fully-qualified-paths.stderr b/tests/ui/rust-2018/edition-lint-fully-qualified-paths.stderr index e1709db09..497ee440d 100644 --- a/tests/ui/rust-2018/edition-lint-fully-qualified-paths.stderr +++ b/tests/ui/rust-2018/edition-lint-fully-qualified-paths.stderr @@ -13,7 +13,16 @@ LL | #![deny(absolute_paths_not_starting_with_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/edition-lint-fully-qualified-paths.rs:23:13 + --> $DIR/edition-lint-fully-qualified-paths.rs:19:25 + | +LL | let _: ::Bar = (); + | ^^^^^^^^^^ help: use `crate`: `crate::foo::Foo` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #53130 + +error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition + --> $DIR/edition-lint-fully-qualified-paths.rs:25:13 | LL | let _: <::foo::Baz as foo::Foo>::Bar = (); | ^^^^^^^^^^ help: use `crate`: `crate::foo::Baz` @@ -21,5 +30,5 @@ LL | let _: <::foo::Baz as foo::Foo>::Bar = (); = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors diff --git a/tests/ui/rust-2018/issue-52202-use-suggestions.stderr b/tests/ui/rust-2018/issue-52202-use-suggestions.stderr index 38cd9713d..9933b9243 100644 --- a/tests/ui/rust-2018/issue-52202-use-suggestions.stderr +++ b/tests/ui/rust-2018/issue-52202-use-suggestions.stderr @@ -6,13 +6,13 @@ LL | let _d = Drain {}; | help: consider importing one of these items | -LL | use crate::plumbing::Drain; +LL + use crate::plumbing::Drain; | -LL | use std::collections::binary_heap::Drain; +LL + use std::collections::binary_heap::Drain; | -LL | use std::collections::hash_map::Drain; +LL + use std::collections::hash_map::Drain; | -LL | use std::collections::hash_set::Drain; +LL + use std::collections::hash_set::Drain; | and 3 other candidates diff --git a/tests/ui/rust-2018/trait-import-suggestions.stderr b/tests/ui/rust-2018/trait-import-suggestions.stderr index 6454b6045..325c5976e 100644 --- a/tests/ui/rust-2018/trait-import-suggestions.stderr +++ b/tests/ui/rust-2018/trait-import-suggestions.stderr @@ -10,7 +10,7 @@ LL | x.foobar(); = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use crate::foo::foobar::Foobar; +LL + use crate::foo::foobar::Foobar; | error[E0599]: no method named `bar` found for type `u32` in the current scope @@ -25,7 +25,7 @@ LL | x.bar(); = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use crate::foo::Bar; +LL + use crate::foo::Bar; | error[E0599]: no method named `baz` found for type `u32` in the current scope @@ -43,7 +43,7 @@ LL | let y = u32::from_str("33"); = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use std::str::FromStr; +LL + use std::str::FromStr; | help: there is an associated function with a similar name | diff --git a/tests/ui/rust-2018/uniform-paths/issue-87932.stderr b/tests/ui/rust-2018/uniform-paths/issue-87932.stderr index b52720ae3..ac2baa359 100644 --- a/tests/ui/rust-2018/uniform-paths/issue-87932.stderr +++ b/tests/ui/rust-2018/uniform-paths/issue-87932.stderr @@ -10,7 +10,7 @@ LL | A::deserialize(); = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use ::deserialize::_a::Deserialize; +LL + use ::deserialize::_a::Deserialize; | error: aborting due to previous error diff --git a/tests/ui/rust-2021/future-prelude-collision-shadow.stderr b/tests/ui/rust-2021/future-prelude-collision-shadow.stderr index 3d21b735a..9dfaf13e2 100644 --- a/tests/ui/rust-2021/future-prelude-collision-shadow.stderr +++ b/tests/ui/rust-2021/future-prelude-collision-shadow.stderr @@ -8,9 +8,9 @@ LL | let _: u32 = 3u8.try_into().unwrap(); = note: 'std::convert::TryInto' is included in the prelude starting in Edition 2021 help: the following traits are implemented but not in scope; perhaps add a `use` for one of them: | -LL | use crate::m::TryIntoU32; +LL + use crate::m::TryIntoU32; | -LL | use std::convert::TryInto; +LL + use std::convert::TryInto; | error: aborting due to previous error diff --git a/tests/ui/rustdoc/doc-primitive.rs b/tests/ui/rustdoc/doc-primitive.rs new file mode 100644 index 000000000..4336961e3 --- /dev/null +++ b/tests/ui/rustdoc/doc-primitive.rs @@ -0,0 +1,8 @@ +#![deny(invalid_doc_attributes)] + +#[doc(primitive = "foo")] +//~^ ERROR unknown `doc` attribute `primitive` +//~| WARN +mod bar {} + +fn main() {} diff --git a/tests/ui/rustdoc/doc-primitive.stderr b/tests/ui/rustdoc/doc-primitive.stderr new file mode 100644 index 000000000..d61eb3816 --- /dev/null +++ b/tests/ui/rustdoc/doc-primitive.stderr @@ -0,0 +1,16 @@ +error: unknown `doc` attribute `primitive` + --> $DIR/doc-primitive.rs:3:7 + | +LL | #[doc(primitive = "foo")] + | ^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #82730 +note: the lint level is defined here + --> $DIR/doc-primitive.rs:1:9 + | +LL | #![deny(invalid_doc_attributes)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/rustdoc/feature-gate-doc_primitive.rs b/tests/ui/rustdoc/feature-gate-doc_primitive.rs index 18e99e72f..78fcd9075 100644 --- a/tests/ui/rustdoc/feature-gate-doc_primitive.rs +++ b/tests/ui/rustdoc/feature-gate-doc_primitive.rs @@ -1,7 +1,5 @@ -// check-pass -#[doc(primitive = "usize")] -//~^ WARNING `doc(primitive)` should never have been stable -//~| WARNING hard error in a future release +#[rustc_doc_primitive = "usize"] +//~^ ERROR `rustc_doc_primitive` is a rustc internal attribute /// Some docs mod usize {} diff --git a/tests/ui/rustdoc/feature-gate-doc_primitive.stderr b/tests/ui/rustdoc/feature-gate-doc_primitive.stderr index 194b2d87d..592088067 100644 --- a/tests/ui/rustdoc/feature-gate-doc_primitive.stderr +++ b/tests/ui/rustdoc/feature-gate-doc_primitive.stderr @@ -1,12 +1,11 @@ -warning: `doc(primitive)` should never have been stable - --> $DIR/feature-gate-doc_primitive.rs:2:7 +error[E0658]: `rustc_doc_primitive` is a rustc internal attribute + --> $DIR/feature-gate-doc_primitive.rs:1:1 | -LL | #[doc(primitive = "usize")] - | ^^^^^^^^^^^^^^^^^^^ +LL | #[rustc_doc_primitive = "usize"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 - = note: `#[warn(invalid_doc_attributes)]` on by default + = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable -warning: 1 warning emitted +error: aborting due to previous error +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/self/arbitrary_self_types_trait.rs b/tests/ui/self/arbitrary_self_types_trait.rs index 973c7cae8..c4651ec71 100644 --- a/tests/ui/self/arbitrary_self_types_trait.rs +++ b/tests/ui/self/arbitrary_self_types_trait.rs @@ -1,4 +1,5 @@ // run-pass +#![allow(unused_allocation)] use std::rc::Rc; @@ -13,7 +14,7 @@ impl Trait for Vec { } fn main() { - let v = vec![1,2,3]; + let v = vec![1, 2, 3]; - assert_eq!(&[1,2,3], Box::new(Rc::new(v)).trait_method()); + assert_eq!(&[1, 2, 3], Box::new(Rc::new(v)).trait_method()); } diff --git a/tests/ui/self/class-missing-self.stderr b/tests/ui/self/class-missing-self.stderr index 063c3f013..3c37d8197 100644 --- a/tests/ui/self/class-missing-self.stderr +++ b/tests/ui/self/class-missing-self.stderr @@ -16,7 +16,7 @@ LL | self.sleep(); | +++++ help: consider importing this function | -LL | use std::thread::sleep; +LL + use std::thread::sleep; | error: aborting due to 2 previous errors diff --git a/tests/ui/shadowed/shadowed-trait-methods.stderr b/tests/ui/shadowed/shadowed-trait-methods.stderr index c3b9084af..1af0400c8 100644 --- a/tests/ui/shadowed/shadowed-trait-methods.stderr +++ b/tests/ui/shadowed/shadowed-trait-methods.stderr @@ -10,7 +10,7 @@ LL | ().f() = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use foo::T; +LL + use foo::T; | error: aborting due to previous error diff --git a/tests/ui/simd/monomorphize-heterogeneous.rs b/tests/ui/simd/monomorphize-heterogeneous.rs new file mode 100644 index 000000000..42e380dbb --- /dev/null +++ b/tests/ui/simd/monomorphize-heterogeneous.rs @@ -0,0 +1,9 @@ +#![feature(repr_simd)] + +#[repr(simd)] +struct I64F64(i64, f64); +//~^ ERROR SIMD vector should be homogeneous + +static X: I64F64 = I64F64(1, 2.0); + +fn main() {} diff --git a/tests/ui/simd/monomorphize-heterogeneous.stderr b/tests/ui/simd/monomorphize-heterogeneous.stderr new file mode 100644 index 000000000..e7b41cd78 --- /dev/null +++ b/tests/ui/simd/monomorphize-heterogeneous.stderr @@ -0,0 +1,9 @@ +error[E0076]: SIMD vector should be homogeneous + --> $DIR/monomorphize-heterogeneous.rs:4:1 + | +LL | struct I64F64(i64, f64); + | ^^^^^^^^^^^^^ SIMD elements must have the same type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0076`. diff --git a/tests/ui/simple_global_asm.rs b/tests/ui/simple_global_asm.rs index 3c69379ff..c3b2f2e0b 100644 --- a/tests/ui/simple_global_asm.rs +++ b/tests/ui/simple_global_asm.rs @@ -1,4 +1,5 @@ // run-pass +// needs-asm-support #![feature(naked_functions)] #![allow(dead_code)] diff --git a/tests/ui/slightly-nice-generic-literal-messages.rs b/tests/ui/slightly-nice-generic-literal-messages.rs deleted file mode 100644 index 268009f65..000000000 --- a/tests/ui/slightly-nice-generic-literal-messages.rs +++ /dev/null @@ -1,14 +0,0 @@ -use std::marker; - -struct Foo(T, marker::PhantomData); - -fn main() { - match Foo(1.1, marker::PhantomData) { - 1 => {} - //~^ ERROR mismatched types - //~| expected struct `Foo<{float}, _>` - //~| found type `{integer}` - //~| expected `Foo<{float}, _>`, found integer - } - -} diff --git a/tests/ui/slightly-nice-generic-literal-messages.stderr b/tests/ui/slightly-nice-generic-literal-messages.stderr deleted file mode 100644 index 83ef522ab..000000000 --- a/tests/ui/slightly-nice-generic-literal-messages.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/slightly-nice-generic-literal-messages.rs:7:9 - | -LL | match Foo(1.1, marker::PhantomData) { - | ----------------------------- this expression has type `Foo<{float}, _>` -LL | 1 => {} - | ^ expected `Foo<{float}, _>`, found integer - | - = note: expected struct `Foo<{float}, _>` - found type `{integer}` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/span/E0204.rs b/tests/ui/span/E0204.rs index 174de8cdd..8793a05c8 100644 --- a/tests/ui/span/E0204.rs +++ b/tests/ui/span/E0204.rs @@ -2,9 +2,9 @@ struct Foo { foo: Vec, } -impl Copy for Foo { } //~ ERROR may not be implemented for this type +impl Copy for Foo { } //~ ERROR cannot be implemented for this type -#[derive(Copy)] //~ ERROR may not be implemented for this type +#[derive(Copy)] //~ ERROR cannot be implemented for this type struct Foo2<'a> { ty: &'a mut bool, } @@ -14,9 +14,9 @@ enum EFoo { Baz, } -impl Copy for EFoo { } //~ ERROR may not be implemented for this type +impl Copy for EFoo { } //~ ERROR cannot be implemented for this type -#[derive(Copy)] //~ ERROR may not be implemented for this type +#[derive(Copy)] //~ ERROR cannot be implemented for this type enum EFoo2<'a> { Bar(&'a mut bool), Baz, diff --git a/tests/ui/span/E0204.stderr b/tests/ui/span/E0204.stderr index 0b2166eed..3a0afb541 100644 --- a/tests/ui/span/E0204.stderr +++ b/tests/ui/span/E0204.stderr @@ -1,4 +1,4 @@ -error[E0204]: the trait `Copy` may not be implemented for this type +error[E0204]: the trait `Copy` cannot be implemented for this type --> $DIR/E0204.rs:5:15 | LL | foo: Vec, @@ -7,7 +7,7 @@ LL | foo: Vec, LL | impl Copy for Foo { } | ^^^ -error[E0204]: the trait `Copy` may not be implemented for this type +error[E0204]: the trait `Copy` cannot be implemented for this type --> $DIR/E0204.rs:7:10 | LL | #[derive(Copy)] @@ -18,7 +18,7 @@ LL | ty: &'a mut bool, | = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0204]: the trait `Copy` may not be implemented for this type +error[E0204]: the trait `Copy` cannot be implemented for this type --> $DIR/E0204.rs:17:15 | LL | Bar { x: Vec }, @@ -27,7 +27,7 @@ LL | Bar { x: Vec }, LL | impl Copy for EFoo { } | ^^^^ -error[E0204]: the trait `Copy` may not be implemented for this type +error[E0204]: the trait `Copy` cannot be implemented for this type --> $DIR/E0204.rs:19:10 | LL | #[derive(Copy)] diff --git a/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.stderr b/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.stderr index 37b2f4138..60433e1c2 100644 --- a/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.stderr +++ b/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.stderr @@ -15,7 +15,7 @@ LL | interval: Duration, | help: consider importing this struct | -LL | use std::time::Duration; +LL + use std::time::Duration; | error: aborting due to 2 previous errors diff --git a/tests/ui/span/issue-35987.stderr b/tests/ui/span/issue-35987.stderr index 057d40ac0..88c86d2a9 100644 --- a/tests/ui/span/issue-35987.stderr +++ b/tests/ui/span/issue-35987.stderr @@ -11,7 +11,7 @@ LL | impl Add for Foo { | help: consider importing this trait instead | -LL | use std::ops::Add; +LL + use std::ops::Add; | error: aborting due to previous error diff --git a/tests/ui/span/issue-71363.stderr b/tests/ui/span/issue-71363.stderr index cb5cc3202..90b623e89 100644 --- a/tests/ui/span/issue-71363.stderr +++ b/tests/ui/span/issue-71363.stderr @@ -21,7 +21,8 @@ note: required by a bound in `std::error::Error` --> $SRC_DIR/core/src/error.rs:LL:COL help: consider annotating `MyError` with `#[derive(Debug)]` | -3 | #[derive(Debug)] +3 + #[derive(Debug)] +4 | struct MyError; | error: aborting due to 2 previous errors diff --git a/tests/ui/specialization/issue-59435.stderr b/tests/ui/specialization/issue-59435.stderr index 211459406..e8a12e4d9 100644 --- a/tests/ui/specialization/issue-59435.stderr +++ b/tests/ui/specialization/issue-59435.stderr @@ -11,7 +11,8 @@ LL | type MyType: Default; | ^^^^^^^ required by this bound in `MyTrait::MyType` help: consider annotating `MyStruct` with `#[derive(Default)]` | -LL | #[derive(Default)] +LL + #[derive(Default)] +LL | struct MyStruct {} | error: aborting due to previous error diff --git a/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.rs b/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.rs new file mode 100644 index 000000000..5fd7c647c --- /dev/null +++ b/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.rs @@ -0,0 +1,12 @@ +#![feature(min_specialization)] + +// An impl that has an erroneous const substitution should not specialize one +// that is well-formed. +#[derive(Clone)] +struct S; + +impl Copy for S {} +//~^ ERROR the constant `N` is not of type `usize` +impl Copy for S {} + +fn main() {} diff --git a/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.stderr b/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.stderr new file mode 100644 index 000000000..83f311efd --- /dev/null +++ b/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.stderr @@ -0,0 +1,14 @@ +error: the constant `N` is not of type `usize` + --> $DIR/bad-const-wf-doesnt-specialize.rs:8:29 + | +LL | impl Copy for S {} + | ^^^^ expected `usize`, found `i32` + | +note: required by a bound in `S` + --> $DIR/bad-const-wf-doesnt-specialize.rs:6:10 + | +LL | struct S; + | ^^^^^^^^^^^^^^ required by this bound in `S` + +error: aborting due to previous error + diff --git a/tests/ui/stability-attribute/auxiliary/const-stability-attribute-implies.rs b/tests/ui/stability-attribute/auxiliary/const-stability-attribute-implies.rs new file mode 100644 index 000000000..f78871b5a --- /dev/null +++ b/tests/ui/stability-attribute/auxiliary/const-stability-attribute-implies.rs @@ -0,0 +1,12 @@ +#![crate_type = "lib"] +#![feature(staged_api)] +#![stable(feature = "stability_attribute_implies", since = "1.0.0")] +#![rustc_const_stable(feature = "stability_attribute_implies", since = "1.0.0")] + +#[stable(feature = "stability_attribute_implies", since = "1.0.0")] +#[rustc_const_stable(feature = "const_foo", since = "1.62.0")] +pub const fn foo() {} + +#[stable(feature = "stability_attribute_implies", since = "1.0.0")] +#[rustc_const_unstable(feature = "const_foobar", issue = "1", implied_by = "const_foo")] +pub const fn foobar() {} diff --git a/tests/ui/stability-attribute/auxiliary/similar-unstable-method.rs b/tests/ui/stability-attribute/auxiliary/similar-unstable-method.rs new file mode 100644 index 000000000..8804186ee --- /dev/null +++ b/tests/ui/stability-attribute/auxiliary/similar-unstable-method.rs @@ -0,0 +1,13 @@ +#![feature(staged_api)] +#![stable(feature = "libfoo", since = "1.0.0")] + +#[unstable(feature = "foo", reason = "...", issue = "none")] +pub fn foo() {} + +#[stable(feature = "libfoo", since = "1.0.0")] +pub struct Foo; + +impl Foo { + #[unstable(feature = "foo", reason = "...", issue = "none")] + pub fn foo(&self) {} +} diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-missing.rs b/tests/ui/stability-attribute/const-stability-attribute-implies-missing.rs new file mode 100644 index 000000000..6d6d793c6 --- /dev/null +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-missing.rs @@ -0,0 +1,16 @@ +#![crate_type = "lib"] +#![feature(staged_api)] +#![stable(feature = "stability_attribute_implies", since = "1.0.0")] +#![rustc_const_stable(feature = "stability_attribute_implies", since = "1.0.0")] + +// Tests that `implied_by = "const_bar"` results in an error being emitted if `const_bar` does not +// exist. + +#[stable(feature = "stability_attribute_implies", since = "1.0.0")] +#[rustc_const_unstable(feature = "const_foobar", issue = "1", implied_by = "const_bar")] +//~^ ERROR feature `const_bar` implying `const_foobar` does not exist +pub const fn foobar() -> u32 { + 0 +} + +const VAR: u32 = foobar(); diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-missing.stderr b/tests/ui/stability-attribute/const-stability-attribute-implies-missing.stderr new file mode 100644 index 000000000..6d8b01a54 --- /dev/null +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-missing.stderr @@ -0,0 +1,8 @@ +error: feature `const_bar` implying `const_foobar` does not exist + --> $DIR/const-stability-attribute-implies-missing.rs:10:1 + | +LL | #[rustc_const_unstable(feature = "const_foobar", issue = "1", implied_by = "const_bar")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-no-feature.rs b/tests/ui/stability-attribute/const-stability-attribute-implies-no-feature.rs new file mode 100644 index 000000000..47e8d2b36 --- /dev/null +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-no-feature.rs @@ -0,0 +1,16 @@ +// aux-build:const-stability-attribute-implies.rs +#![crate_type = "lib"] + +// Tests that despite the `const_foobar` feature being implied by now-stable feature `const_foo`, +// if `const_foobar` isn't allowed in this crate then an error will be emitted. + +extern crate const_stability_attribute_implies; +use const_stability_attribute_implies::{foo, foobar}; + +pub const fn bar() -> u32 { + foo(); // no error - stable + foobar(); //~ ERROR `foobar` is not yet stable as a const fn + 0 +} + +pub const VAR: u32 = bar(); diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-no-feature.stderr b/tests/ui/stability-attribute/const-stability-attribute-implies-no-feature.stderr new file mode 100644 index 000000000..8ef5a364e --- /dev/null +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-no-feature.stderr @@ -0,0 +1,10 @@ +error: `foobar` is not yet stable as a const fn + --> $DIR/const-stability-attribute-implies-no-feature.rs:12:5 + | +LL | foobar(); + | ^^^^^^^^ + | + = help: add `#![feature(const_foobar)]` to the crate attributes to enable + +error: aborting due to previous error + diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.rs b/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.rs new file mode 100644 index 000000000..ffaa171d8 --- /dev/null +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.rs @@ -0,0 +1,19 @@ +// aux-build:const-stability-attribute-implies.rs +#![crate_type = "lib"] +#![deny(stable_features)] +#![feature(const_foo)] +//~^ ERROR the feature `const_foo` has been partially stabilized since 1.62.0 and is succeeded by the feature `const_foobar` + +// Tests that the use of `implied_by` in the `#[rustc_const_unstable]` attribute results in a +// diagnostic mentioning partial stabilization, and that given the implied unstable feature is +// unused (there is no `foobar` call), that the compiler suggests removing the flag. + +extern crate const_stability_attribute_implies; +use const_stability_attribute_implies::foo; + +pub const fn bar() -> u32 { + foo(); + 0 +} + +pub const VAR: u32 = bar(); diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr b/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr new file mode 100644 index 000000000..f6a099cd2 --- /dev/null +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr @@ -0,0 +1,22 @@ +error: the feature `const_foo` has been partially stabilized since 1.62.0 and is succeeded by the feature `const_foobar` + --> $DIR/const-stability-attribute-implies-using-stable.rs:4:12 + | +LL | #![feature(const_foo)] + | ^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/const-stability-attribute-implies-using-stable.rs:3:9 + | +LL | #![deny(stable_features)] + | ^^^^^^^^^^^^^^^ +help: if you are using features which are still unstable, change to using `const_foobar` + | +LL | #![feature(const_foobar)] + | ~~~~~~~~~~~~ +help: if you are using features which are now stable, remove this line + | +LL - #![feature(const_foo)] + | + +error: aborting due to previous error + diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.rs b/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.rs new file mode 100644 index 000000000..2061c5c75 --- /dev/null +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.rs @@ -0,0 +1,21 @@ +// aux-build:const-stability-attribute-implies.rs +#![crate_type = "lib"] +#![deny(stable_features)] +#![feature(const_foo)] +//~^ ERROR the feature `const_foo` has been partially stabilized since 1.62.0 and is succeeded by the feature `const_foobar` + +// Tests that the use of `implied_by` in the `#[rustc_const_unstable]` attribute results in a +// diagnostic mentioning partial stabilization and that given the implied unstable feature is +// used (there is a `const_foobar` call), that the compiler suggests changing to that feature and +// doesn't error about its use. + +extern crate const_stability_attribute_implies; +use const_stability_attribute_implies::{foo, foobar}; + +pub const fn bar() -> u32 { + foo(); + foobar(); // no error! + 0 +} + +pub const VAR: u32 = bar(); diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr b/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr new file mode 100644 index 000000000..063856676 --- /dev/null +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr @@ -0,0 +1,22 @@ +error: the feature `const_foo` has been partially stabilized since 1.62.0 and is succeeded by the feature `const_foobar` + --> $DIR/const-stability-attribute-implies-using-unstable.rs:4:12 + | +LL | #![feature(const_foo)] + | ^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/const-stability-attribute-implies-using-unstable.rs:3:9 + | +LL | #![deny(stable_features)] + | ^^^^^^^^^^^^^^^ +help: if you are using features which are still unstable, change to using `const_foobar` + | +LL | #![feature(const_foobar)] + | ~~~~~~~~~~~~ +help: if you are using features which are now stable, remove this line + | +LL - #![feature(const_foo)] + | + +error: aborting due to previous error + diff --git a/tests/ui/stability-attribute/issue-109177.rs b/tests/ui/stability-attribute/issue-109177.rs new file mode 100644 index 000000000..6d052779c --- /dev/null +++ b/tests/ui/stability-attribute/issue-109177.rs @@ -0,0 +1,13 @@ +// aux-build: similar-unstable-method.rs + +extern crate similar_unstable_method; + +fn main() { + // FIXME: this function should not suggest the `foo` function. + similar_unstable_method::foo1(); + //~^ ERROR cannot find function `foo1` in crate `similar_unstable_method` [E0425] + + let foo = similar_unstable_method::Foo; + foo.foo1(); + //~^ ERROR no method named `foo1` found for struct `Foo` in the current scope [E0599] +} diff --git a/tests/ui/stability-attribute/issue-109177.stderr b/tests/ui/stability-attribute/issue-109177.stderr new file mode 100644 index 000000000..9c2ac591a --- /dev/null +++ b/tests/ui/stability-attribute/issue-109177.stderr @@ -0,0 +1,21 @@ +error[E0425]: cannot find function `foo1` in crate `similar_unstable_method` + --> $DIR/issue-109177.rs:7:30 + | +LL | similar_unstable_method::foo1(); + | ^^^^ help: a function with a similar name exists: `foo` + | + ::: $DIR/auxiliary/similar-unstable-method.rs:5:1 + | +LL | pub fn foo() {} + | ------------ similarly named function `foo` defined here + +error[E0599]: no method named `foo1` found for struct `Foo` in the current scope + --> $DIR/issue-109177.rs:11:9 + | +LL | foo.foo1(); + | ^^^^ method not found in `Foo` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0425, E0599. +For more information about an error, try `rustc --explain E0425`. diff --git a/tests/ui/static/static-mut-not-constant.rs b/tests/ui/static/static-mut-not-constant.rs index 2091fffd4..d501e5c29 100644 --- a/tests/ui/static/static-mut-not-constant.rs +++ b/tests/ui/static/static-mut-not-constant.rs @@ -1,6 +1,4 @@ -#![feature(box_syntax)] - -static mut a: Box = box 3; -//~^ ERROR allocations are not allowed in statics +static mut a: Box = Box::new(3); +//~^ ERROR cannot call non-const fn fn main() {} diff --git a/tests/ui/static/static-mut-not-constant.stderr b/tests/ui/static/static-mut-not-constant.stderr index a0fa24515..8411a1557 100644 --- a/tests/ui/static/static-mut-not-constant.stderr +++ b/tests/ui/static/static-mut-not-constant.stderr @@ -1,9 +1,12 @@ -error[E0010]: allocations are not allowed in statics - --> $DIR/static-mut-not-constant.rs:3:28 +error[E0015]: cannot call non-const fn `Box::::new` in statics + --> $DIR/static-mut-not-constant.rs:1:28 | -LL | static mut a: Box = box 3; - | ^^^^^ allocation not allowed in statics +LL | static mut a: Box = Box::new(3); + | ^^^^^^^^^^^ + | + = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell error: aborting due to previous error -For more information about this error, try `rustc --explain E0010`. +For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/statics/uninhabited-static.stderr b/tests/ui/statics/uninhabited-static.stderr index 437053a44..35fdcae6a 100644 --- a/tests/ui/statics/uninhabited-static.stderr +++ b/tests/ui/statics/uninhabited-static.stderr @@ -47,7 +47,7 @@ error[E0080]: could not evaluate static initializer --> $DIR/uninhabited-static.rs:12:31 | LL | static VOID2: Void = unsafe { std::mem::transmute(()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type + | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of uninhabited type Void warning: the type `Void` does not permit zero-initialization --> $DIR/uninhabited-static.rs:12:31 @@ -66,7 +66,7 @@ error[E0080]: could not evaluate static initializer --> $DIR/uninhabited-static.rs:16:32 | LL | static NEVER2: Void = unsafe { std::mem::transmute(()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type + | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of uninhabited type Void warning: the type `Void` does not permit zero-initialization --> $DIR/uninhabited-static.rs:16:32 diff --git a/tests/ui/stats/hir-stats.stderr b/tests/ui/stats/hir-stats.stderr index ee62d8f2d..d723ff538 100644 --- a/tests/ui/stats/hir-stats.stderr +++ b/tests/ui/stats/hir-stats.stderr @@ -15,45 +15,45 @@ ast-stats-1 Arm 96 ( 1.5%) 2 48 ast-stats-1 ForeignItem 96 ( 1.5%) 1 96 ast-stats-1 - Fn 96 ( 1.5%) 1 ast-stats-1 FnDecl 120 ( 1.8%) 5 24 -ast-stats-1 FieldDef 160 ( 2.4%) 2 80 -ast-stats-1 Stmt 160 ( 2.4%) 5 32 +ast-stats-1 FieldDef 160 ( 2.5%) 2 80 +ast-stats-1 Stmt 160 ( 2.5%) 5 32 ast-stats-1 - Local 32 ( 0.5%) 1 ast-stats-1 - MacCall 32 ( 0.5%) 1 ast-stats-1 - Expr 96 ( 1.5%) 3 -ast-stats-1 Param 160 ( 2.4%) 4 40 -ast-stats-1 Block 192 ( 2.9%) 6 32 +ast-stats-1 Param 160 ( 2.5%) 4 40 +ast-stats-1 Block 192 ( 3.0%) 6 32 ast-stats-1 Variant 208 ( 3.2%) 2 104 -ast-stats-1 GenericBound 224 ( 3.4%) 4 56 -ast-stats-1 - Trait 224 ( 3.4%) 4 -ast-stats-1 AssocItem 416 ( 6.3%) 4 104 -ast-stats-1 - Type 208 ( 3.2%) 2 -ast-stats-1 - Fn 208 ( 3.2%) 2 -ast-stats-1 GenericParam 480 ( 7.3%) 5 96 -ast-stats-1 Pat 504 ( 7.7%) 7 72 +ast-stats-1 GenericBound 224 ( 3.5%) 4 56 +ast-stats-1 - Trait 224 ( 3.5%) 4 +ast-stats-1 AssocItem 352 ( 5.4%) 4 88 +ast-stats-1 - Type 176 ( 2.7%) 2 +ast-stats-1 - Fn 176 ( 2.7%) 2 +ast-stats-1 GenericParam 480 ( 7.4%) 5 96 +ast-stats-1 Pat 504 ( 7.8%) 7 72 ast-stats-1 - Struct 72 ( 1.1%) 1 ast-stats-1 - Wild 72 ( 1.1%) 1 ast-stats-1 - Ident 360 ( 5.5%) 5 -ast-stats-1 Expr 576 ( 8.8%) 8 72 +ast-stats-1 Expr 576 ( 8.9%) 8 72 ast-stats-1 - Path 72 ( 1.1%) 1 ast-stats-1 - Match 72 ( 1.1%) 1 ast-stats-1 - Struct 72 ( 1.1%) 1 ast-stats-1 - Lit 144 ( 2.2%) 2 ast-stats-1 - Block 216 ( 3.3%) 3 -ast-stats-1 PathSegment 720 (11.0%) 30 24 -ast-stats-1 Ty 896 (13.7%) 14 64 +ast-stats-1 PathSegment 720 (11.1%) 30 24 +ast-stats-1 Ty 896 (13.8%) 14 64 ast-stats-1 - Ptr 64 ( 1.0%) 1 ast-stats-1 - Ref 64 ( 1.0%) 1 ast-stats-1 - ImplicitSelf 128 ( 2.0%) 2 -ast-stats-1 - Path 640 ( 9.8%) 10 -ast-stats-1 Item 1_224 (18.7%) 9 136 +ast-stats-1 - Path 640 ( 9.9%) 10 +ast-stats-1 Item 1_224 (18.9%) 9 136 ast-stats-1 - Trait 136 ( 2.1%) 1 ast-stats-1 - Enum 136 ( 2.1%) 1 ast-stats-1 - ForeignMod 136 ( 2.1%) 1 ast-stats-1 - Impl 136 ( 2.1%) 1 ast-stats-1 - Fn 272 ( 4.2%) 2 -ast-stats-1 - Use 408 ( 6.2%) 3 +ast-stats-1 - Use 408 ( 6.3%) 3 ast-stats-1 ---------------------------------------------------------------- -ast-stats-1 Total 6_552 +ast-stats-1 Total 6_488 ast-stats-1 ast-stats-2 POST EXPANSION AST STATS ast-stats-2 Name Accumulated Size Count Item Size @@ -65,32 +65,32 @@ ast-stats-2 ExprField 48 ( 0.7%) 1 48 ast-stats-2 WherePredicate 56 ( 0.8%) 1 56 ast-stats-2 - BoundPredicate 56 ( 0.8%) 1 ast-stats-2 Local 72 ( 1.0%) 1 72 -ast-stats-2 Arm 96 ( 1.3%) 2 48 -ast-stats-2 ForeignItem 96 ( 1.3%) 1 96 -ast-stats-2 - Fn 96 ( 1.3%) 1 +ast-stats-2 Arm 96 ( 1.4%) 2 48 +ast-stats-2 ForeignItem 96 ( 1.4%) 1 96 +ast-stats-2 - Fn 96 ( 1.4%) 1 ast-stats-2 InlineAsm 120 ( 1.7%) 1 120 ast-stats-2 FnDecl 120 ( 1.7%) 5 24 ast-stats-2 Attribute 128 ( 1.8%) 4 32 -ast-stats-2 - DocComment 32 ( 0.4%) 1 -ast-stats-2 - Normal 96 ( 1.3%) 3 -ast-stats-2 FieldDef 160 ( 2.2%) 2 80 -ast-stats-2 Stmt 160 ( 2.2%) 5 32 -ast-stats-2 - Local 32 ( 0.4%) 1 -ast-stats-2 - Semi 32 ( 0.4%) 1 -ast-stats-2 - Expr 96 ( 1.3%) 3 -ast-stats-2 Param 160 ( 2.2%) 4 40 +ast-stats-2 - DocComment 32 ( 0.5%) 1 +ast-stats-2 - Normal 96 ( 1.4%) 3 +ast-stats-2 FieldDef 160 ( 2.3%) 2 80 +ast-stats-2 Stmt 160 ( 2.3%) 5 32 +ast-stats-2 - Local 32 ( 0.5%) 1 +ast-stats-2 - Semi 32 ( 0.5%) 1 +ast-stats-2 - Expr 96 ( 1.4%) 3 +ast-stats-2 Param 160 ( 2.3%) 4 40 ast-stats-2 Block 192 ( 2.7%) 6 32 ast-stats-2 Variant 208 ( 2.9%) 2 104 -ast-stats-2 GenericBound 224 ( 3.1%) 4 56 -ast-stats-2 - Trait 224 ( 3.1%) 4 -ast-stats-2 AssocItem 416 ( 5.8%) 4 104 -ast-stats-2 - Type 208 ( 2.9%) 2 -ast-stats-2 - Fn 208 ( 2.9%) 2 -ast-stats-2 GenericParam 480 ( 6.7%) 5 96 -ast-stats-2 Pat 504 ( 7.0%) 7 72 +ast-stats-2 GenericBound 224 ( 3.2%) 4 56 +ast-stats-2 - Trait 224 ( 3.2%) 4 +ast-stats-2 AssocItem 352 ( 5.0%) 4 88 +ast-stats-2 - Type 176 ( 2.5%) 2 +ast-stats-2 - Fn 176 ( 2.5%) 2 +ast-stats-2 GenericParam 480 ( 6.8%) 5 96 +ast-stats-2 Pat 504 ( 7.1%) 7 72 ast-stats-2 - Struct 72 ( 1.0%) 1 ast-stats-2 - Wild 72 ( 1.0%) 1 -ast-stats-2 - Ident 360 ( 5.0%) 5 +ast-stats-2 - Ident 360 ( 5.1%) 5 ast-stats-2 Expr 648 ( 9.1%) 9 72 ast-stats-2 - Path 72 ( 1.0%) 1 ast-stats-2 - Match 72 ( 1.0%) 1 @@ -98,22 +98,22 @@ ast-stats-2 - Struct 72 ( 1.0%) 1 ast-stats-2 - InlineAsm 72 ( 1.0%) 1 ast-stats-2 - Lit 144 ( 2.0%) 2 ast-stats-2 - Block 216 ( 3.0%) 3 -ast-stats-2 PathSegment 792 (11.1%) 33 24 -ast-stats-2 Ty 896 (12.5%) 14 64 +ast-stats-2 PathSegment 792 (11.2%) 33 24 +ast-stats-2 Ty 896 (12.6%) 14 64 ast-stats-2 - Ptr 64 ( 0.9%) 1 ast-stats-2 - Ref 64 ( 0.9%) 1 ast-stats-2 - ImplicitSelf 128 ( 1.8%) 2 -ast-stats-2 - Path 640 ( 8.9%) 10 -ast-stats-2 Item 1_496 (20.9%) 11 136 +ast-stats-2 - Path 640 ( 9.0%) 10 +ast-stats-2 Item 1_496 (21.1%) 11 136 ast-stats-2 - Trait 136 ( 1.9%) 1 ast-stats-2 - Enum 136 ( 1.9%) 1 ast-stats-2 - ExternCrate 136 ( 1.9%) 1 ast-stats-2 - ForeignMod 136 ( 1.9%) 1 ast-stats-2 - Impl 136 ( 1.9%) 1 ast-stats-2 - Fn 272 ( 3.8%) 2 -ast-stats-2 - Use 544 ( 7.6%) 4 +ast-stats-2 - Use 544 ( 7.7%) 4 ast-stats-2 ---------------------------------------------------------------- -ast-stats-2 Total 7_152 +ast-stats-2 Total 7_088 ast-stats-2 hir-stats HIR STATS hir-stats Name Accumulated Size Count Item Size diff --git a/tests/ui/std/issue-15149.rs b/tests/ui/std/issue-15149.rs new file mode 100644 index 000000000..064472f57 --- /dev/null +++ b/tests/ui/std/issue-15149.rs @@ -0,0 +1,57 @@ +// run-pass + +#![allow(unused_variables)] +// no-prefer-dynamic +// ignore-cross-compile + +use std::env; +use std::ffi::OsStr; +use std::fs; +use std::path::PathBuf; +use std::process; +use std::str; + +fn main() { + // If we're the child, make sure we were invoked correctly + let args: Vec = env::args().collect(); + if args.len() > 1 && args[1] == "child" { + // FIXME: This should check the whole `args[0]` instead of just + // checking that it ends_with the executable name. This + // is needed because of Windows, which has a different behavior. + // See #15149 for more info. + let my_path = env::current_exe().unwrap(); + return assert_eq!(my_path.file_stem(), Some(OsStr::new("mytest"))); + } + + test(); +} + +fn test() { + // If we're the parent, copy our own binary to a new directory. + let my_path = env::current_exe().unwrap(); + let my_dir = my_path.parent().unwrap(); + + let child_dir = PathBuf::from(env::var_os("RUST_TEST_TMPDIR").unwrap()); + let child_dir = child_dir.join("issue-15140-child"); + fs::create_dir_all(&child_dir).unwrap(); + + let child_path = child_dir.join(&format!("mytest{}", env::consts::EXE_SUFFIX)); + fs::copy(&my_path, &child_path).unwrap(); + + // Append the new directory to our own PATH. + let path = { + let mut paths: Vec<_> = env::split_paths(&env::var_os("PATH").unwrap()).collect(); + paths.push(child_dir.to_path_buf()); + env::join_paths(paths).unwrap() + }; + + let child_output = + process::Command::new("mytest").env("PATH", &path).arg("child").output().unwrap(); + + assert!( + child_output.status.success(), + "child assertion failed\n child stdout:\n {}\n child stderr:\n {}", + str::from_utf8(&child_output.stdout).unwrap(), + str::from_utf8(&child_output.stderr).unwrap() + ); +} diff --git a/tests/ui/std/issue-81357-unsound-file-methods.rs b/tests/ui/std/issue-81357-unsound-file-methods.rs new file mode 100644 index 000000000..fdf1150f8 --- /dev/null +++ b/tests/ui/std/issue-81357-unsound-file-methods.rs @@ -0,0 +1,81 @@ +// run-fail +// only-windows + +fn main() { + use std::fs; + use std::io::prelude::*; + use std::os::windows::prelude::*; + use std::ptr; + use std::sync::Arc; + use std::thread; + use std::time::Duration; + + const FILE_FLAG_OVERLAPPED: u32 = 0x40000000; + + fn create_pipe_server(path: &str) -> fs::File { + let mut path0 = path.as_bytes().to_owned(); + path0.push(0); + extern "system" { + fn CreateNamedPipeA( + lpName: *const u8, + dwOpenMode: u32, + dwPipeMode: u32, + nMaxInstances: u32, + nOutBufferSize: u32, + nInBufferSize: u32, + nDefaultTimeOut: u32, + lpSecurityAttributes: *mut u8, + ) -> RawHandle; + } + + unsafe { + let h = CreateNamedPipeA(path0.as_ptr(), 3, 0, 1, 0, 0, 0, ptr::null_mut()); + assert_ne!(h as isize, -1); + fs::File::from_raw_handle(h) + } + } + + let path = "\\\\.\\pipe\\repro"; + let mut server = create_pipe_server(path); + + let client = Arc::new( + fs::OpenOptions::new().custom_flags(FILE_FLAG_OVERLAPPED).read(true).open(path).unwrap(), + ); + + let spawn_read = |is_first: bool| { + thread::spawn({ + let f = client.clone(); + move || { + let mut buf = [0xcc; 1]; + let mut f = f.as_ref(); + f.read(&mut buf).unwrap(); + if is_first { + assert_ne!(buf[0], 0xcc); + } else { + let b = buf[0]; // capture buf[0] + thread::sleep(Duration::from_millis(200)); + + // Check the buffer hasn't been written to after read. + dbg!(buf[0], b); + assert_eq!(buf[0], b); + } + } + }) + }; + + let t1 = spawn_read(true); + thread::sleep(Duration::from_millis(20)); + let t2 = spawn_read(false); + thread::sleep(Duration::from_millis(100)); + let _ = server.write(b"x"); + thread::sleep(Duration::from_millis(100)); + let _ = server.write(b"y"); + + // This is run fail because we need to test for the `abort`. + // That failing to run is the success case. + if t1.join().is_err() || t2.join().is_err() { + return; + } else { + panic!("success"); + } +} diff --git a/tests/ui/std/stdio-from.rs b/tests/ui/std/stdio-from.rs new file mode 100644 index 000000000..fef9f27fc --- /dev/null +++ b/tests/ui/std/stdio-from.rs @@ -0,0 +1,69 @@ +// run-pass +// ignore-cross-compile + +use std::env; +use std::fs::File; +use std::io; +use std::io::{Read, Write}; +use std::process::{Command, Stdio}; +use std::path::PathBuf; + +fn main() { + if env::args().len() > 1 { + child().unwrap() + } else { + parent().unwrap() + } +} + +fn parent() -> io::Result<()> { + let td = PathBuf::from(env::var_os("RUST_TEST_TMPDIR").unwrap()); + let input = td.join("stdio-from-input"); + let output = td.join("stdio-from-output"); + + File::create(&input)?.write_all(b"foo\n")?; + + // Set up this chain: + // $ me file + // ... to duplicate each line 8 times total. + + let mut child1 = Command::new(env::current_exe()?) + .arg("first") + .stdin(File::open(&input)?) // tests File::into() + .stdout(Stdio::piped()) + .spawn()?; + + let mut child3 = Command::new(env::current_exe()?) + .arg("third") + .stdin(Stdio::piped()) + .stdout(File::create(&output)?) // tests File::into() + .spawn()?; + + // Started out of order so we can test both `ChildStdin` and `ChildStdout`. + let mut child2 = Command::new(env::current_exe()?) + .arg("second") + .stdin(child1.stdout.take().unwrap()) // tests ChildStdout::into() + .stdout(child3.stdin.take().unwrap()) // tests ChildStdin::into() + .spawn()?; + + assert!(child1.wait()?.success()); + assert!(child2.wait()?.success()); + assert!(child3.wait()?.success()); + + let mut data = String::new(); + File::open(&output)?.read_to_string(&mut data)?; + for line in data.lines() { + assert_eq!(line, "foo"); + } + assert_eq!(data.lines().count(), 8); + Ok(()) +} + +fn child() -> io::Result<()> { + // double everything + let mut input = vec![]; + io::stdin().read_to_end(&mut input)?; + io::stdout().write_all(&input)?; + io::stdout().write_all(&input)?; + Ok(()) +} diff --git a/tests/ui/std/switch-stdout.rs b/tests/ui/std/switch-stdout.rs new file mode 100644 index 000000000..2d936d96b --- /dev/null +++ b/tests/ui/std/switch-stdout.rs @@ -0,0 +1,52 @@ +// run-pass +// ignore-wasm (needs file descriptors and env variables) + +use std::env; +use std::fs::File; +use std::io::{Read, Write}; +use std::path::PathBuf; + +#[cfg(unix)] +fn switch_stdout_to(file: File) { + use std::os::unix::prelude::*; + + extern "C" { + fn dup2(old: i32, new: i32) -> i32; + } + + unsafe { + assert_eq!(dup2(file.as_raw_fd(), 1), 1); + } +} + +#[cfg(windows)] +fn switch_stdout_to(file: File) { + use std::os::windows::prelude::*; + + extern "system" { + fn SetStdHandle(nStdHandle: u32, handle: *mut u8) -> i32; + } + + const STD_OUTPUT_HANDLE: u32 = (-11i32) as u32; + + unsafe { + let rc = SetStdHandle(STD_OUTPUT_HANDLE, file.into_raw_handle() as *mut _); + assert!(rc != 0); + } +} + +fn main() { + let path = PathBuf::from(env::var_os("RUST_TEST_TMPDIR").unwrap()); + let path = path.join("switch-stdout-output"); + let f = File::create(&path).unwrap(); + + println!("foo"); + std::io::stdout().flush().unwrap(); + switch_stdout_to(f); + println!("bar"); + std::io::stdout().flush().unwrap(); + + let mut contents = String::new(); + File::open(&path).unwrap().read_to_string(&mut contents).unwrap(); + assert_eq!(contents, "bar\n"); +} diff --git a/tests/ui/str/str-escape.rs b/tests/ui/str/str-escape.rs index 0264632fd..10a72421f 100644 --- a/tests/ui/str/str-escape.rs +++ b/tests/ui/str/str-escape.rs @@ -1,11 +1,31 @@ // check-pass +// ignore-tidy-tab + fn main() { let s = "\ "; //~^^^ WARNING multiple lines skipped by escaped newline + assert_eq!(s, ""); + let s = "foo\   bar "; - //~^^^ WARNING non-ASCII whitespace symbol '\u{a0}' is not skipped + //~^^^ WARNING whitespace symbol '\u{a0}' is not skipped + assert_eq!(s, "foo  bar\n "); + + let s = "a\ + b"; + assert_eq!(s, "ab"); + + let s = "a\ + b"; + assert_eq!(s, "ab"); + + let s = "a\ + b"; + //~^^ WARNING whitespace symbol '\u{c}' is not skipped + // '\x0c' is ASCII whitespace, but it may not need skipped + // discussion: https://github.com/rust-lang/rust/pull/108403 + assert_eq!(s, "a\x0cb"); } diff --git a/tests/ui/str/str-escape.stderr b/tests/ui/str/str-escape.stderr index b2501f1a2..43b4f7e36 100644 --- a/tests/ui/str/str-escape.stderr +++ b/tests/ui/str/str-escape.stderr @@ -1,5 +1,5 @@ warning: multiple lines skipped by escaped newline - --> $DIR/str-escape.rs:3:14 + --> $DIR/str-escape.rs:5:14 | LL | let s = "\ | ______________^ @@ -7,15 +7,25 @@ LL | | LL | | "; | |_____________^ skipping everything up to and including this point -warning: non-ASCII whitespace symbol '\u{a0}' is not skipped - --> $DIR/str-escape.rs:7:17 +warning: whitespace symbol '\u{a0}' is not skipped + --> $DIR/str-escape.rs:11:17 | LL | let s = "foo\ | _________________^ LL | |   bar - | | ^ non-ASCII whitespace symbol '\u{a0}' is not skipped + | | ^ whitespace symbol '\u{a0}' is not skipped | |___| | -warning: 2 warnings emitted +warning: whitespace symbol '\u{c}' is not skipped + --> $DIR/str-escape.rs:25:15 + | +LL | let s = "a\ + | _______________^ +LL | | b"; + | | ^- whitespace symbol '\u{c}' is not skipped + | |____| + | + +warning: 3 warnings emitted diff --git a/tests/ui/structs-enums/align-struct.rs b/tests/ui/structs-enums/align-struct.rs index f5418e754..54092542f 100644 --- a/tests/ui/structs-enums/align-struct.rs +++ b/tests/ui/structs-enums/align-struct.rs @@ -1,5 +1,5 @@ // run-pass -#![allow(dead_code)] +#![allow(dead_code, unused_allocation)] use std::mem; @@ -20,7 +20,6 @@ struct AlignMany(i32); // Raising alignment may not alter size. #[repr(align(8))] -#[allow(dead_code)] struct Align8Many { a: i32, b: i32, @@ -29,9 +28,8 @@ struct Align8Many { } enum Enum { - #[allow(dead_code)] A(i32), - B(Align16) + B(Align16), } // Nested alignment - use `#[repr(C)]` to suppress field reordering for sizeof test @@ -73,7 +71,7 @@ struct AlignLarge { union UnionContainsAlign { a: Align16, - b: f32 + b: f32, } impl Align16 { @@ -158,7 +156,7 @@ pub fn main() { // Note that the size of Nested may change if struct field re-ordering is enabled assert_eq!(mem::align_of::(), 16); assert_eq!(mem::size_of::(), 48); - let a = Nested{ a: 1, b: 2, c: Align16(3), d: 4}; + let a = Nested { a: 1, b: 2, c: Align16(3), d: 4 }; assert_eq!(mem::align_of_val(&a), 16); assert_eq!(mem::align_of_val(&a.b), 4); assert_eq!(mem::align_of_val(&a.c), 16); @@ -179,8 +177,8 @@ pub fn main() { assert_eq!(a.0, 15); assert_eq!(mem::align_of_val(a), 16); assert_eq!(mem::size_of_val(a), 16); - }, - _ => () + } + _ => (), } assert!(is_aligned_to(&e, 16)); @@ -197,8 +195,8 @@ pub fn main() { } // arrays of aligned elements should also be aligned - assert_eq!(mem::align_of::<[Align16;2]>(), 16); - assert_eq!(mem::size_of::<[Align16;2]>(), 32); + assert_eq!(mem::align_of::<[Align16; 2]>(), 16); + assert_eq!(mem::size_of::<[Align16; 2]>(), 32); let a = [Align16(0), Align16(1)]; assert_eq!(mem::align_of_val(&a[0]), 16); @@ -209,7 +207,7 @@ pub fn main() { assert_eq!(mem::align_of_val(Box::new(Align16(0)).as_ref()), 16); // check heap array is aligned - let a = vec!(Align16(0), Align16(1)); + let a = vec![Align16(0), Align16(1)]; assert_eq!(mem::align_of_val(&a[0]), 16); assert_eq!(mem::align_of_val(&a[1]), 16); @@ -224,16 +222,14 @@ pub fn main() { assert_eq!(mem::align_of::(), 16); assert_eq!(mem::size_of::(), 32); - let a = AlignContainsPacked4C { a: Packed4C{ a: 1, b: 2 }, b: 3 }; + let a = AlignContainsPacked4C { a: Packed4C { a: 1, b: 2 }, b: 3 }; assert_eq!(mem::align_of_val(&a), 16); assert_eq!(mem::align_of_val(&a.a), 4); assert_eq!(mem::align_of_val(&a.b), mem::align_of::()); assert_eq!(mem::size_of_val(&a), 32); assert!(is_aligned_to(&a, 16)); - let mut large = Box::new(AlignLarge { - stuff: [0; 0x10000], - }); + let mut large = Box::new(AlignLarge { stuff: [0; 0x10000] }); large.stuff[0] = 132; *large.stuff.last_mut().unwrap() = 102; assert_eq!(large.stuff[0], 132); diff --git a/tests/ui/structs/struct-path-alias-bounds.stderr b/tests/ui/structs/struct-path-alias-bounds.stderr index 266291f62..5b01208c5 100644 --- a/tests/ui/structs/struct-path-alias-bounds.stderr +++ b/tests/ui/structs/struct-path-alias-bounds.stderr @@ -11,7 +11,8 @@ LL | struct S { a: T } | ^^^^^ required by this bound in `S` help: consider annotating `NoClone` with `#[derive(Clone)]` | -LL | #[derive(Clone)] +LL + #[derive(Clone)] +LL | struct NoClone; | error: aborting due to previous error diff --git a/tests/ui/structs/struct-tuple-field-names.rs b/tests/ui/structs/struct-tuple-field-names.rs index 7bd54af1d..33f264aa2 100644 --- a/tests/ui/structs/struct-tuple-field-names.rs +++ b/tests/ui/structs/struct-tuple-field-names.rs @@ -12,4 +12,7 @@ fn main() { match y { S { } => {} //~ ERROR: tuple variant `S` written as struct variant [E0769] } + + if let E::S { 0: a } = x { //~ ERROR: pattern does not mention field `1` + } } diff --git a/tests/ui/structs/struct-tuple-field-names.stderr b/tests/ui/structs/struct-tuple-field-names.stderr index 5494c29a6..0b837a47a 100644 --- a/tests/ui/structs/struct-tuple-field-names.stderr +++ b/tests/ui/structs/struct-tuple-field-names.stderr @@ -20,6 +20,22 @@ help: use the tuple variant pattern syntax instead LL | S(_, _) => {} | ~~~~~~ -error: aborting due to 2 previous errors +error[E0027]: pattern does not mention field `1` + --> $DIR/struct-tuple-field-names.rs:16:12 + | +LL | if let E::S { 0: a } = x { + | ^^^^^^^^^^^^^ missing field `1` + | +help: include the missing field in the pattern + | +LL | if let E::S { 0: a, 1: _ } = x { + | ~~~~~~~~ +help: if you don't care about this missing field, you can explicitly ignore it + | +LL | if let E::S { 0: a, .. } = x { + | ~~~~~~ + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0769`. +Some errors have detailed explanations: E0027, E0769. +For more information about an error, try `rustc --explain E0027`. diff --git a/tests/ui/suggestions/bad-infer-in-trait-impl.rs b/tests/ui/suggestions/bad-infer-in-trait-impl.rs new file mode 100644 index 000000000..87db2636f --- /dev/null +++ b/tests/ui/suggestions/bad-infer-in-trait-impl.rs @@ -0,0 +1,10 @@ +trait Foo { + fn bar(); +} + +impl Foo for () { + fn bar(s: _) {} + //~^ ERROR the placeholder `_` is not allowed within types on item signatures for functions +} + +fn main() {} diff --git a/tests/ui/suggestions/bad-infer-in-trait-impl.stderr b/tests/ui/suggestions/bad-infer-in-trait-impl.stderr new file mode 100644 index 000000000..418690ff8 --- /dev/null +++ b/tests/ui/suggestions/bad-infer-in-trait-impl.stderr @@ -0,0 +1,14 @@ +error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/bad-infer-in-trait-impl.rs:6:15 + | +LL | fn bar(s: _) {} + | ^ not allowed in type signatures + | +help: use type parameters instead + | +LL | fn bar(s: T) {} + | +++ ~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0121`. diff --git a/tests/ui/suggestions/chain-method-call-mutation-in-place.rs b/tests/ui/suggestions/chain-method-call-mutation-in-place.rs index cb92ab87a..7a4c74796 100644 --- a/tests/ui/suggestions/chain-method-call-mutation-in-place.rs +++ b/tests/ui/suggestions/chain-method-call-mutation-in-place.rs @@ -1,4 +1,8 @@ -fn main() {} +fn main() { + let x: Vec = vec![1, 2, 3].into_iter().collect::>().sort_by_key(|i| i); //~ ERROR mismatched types + vec![1, 2, 3].into_iter().collect::>().sort_by_key(|i| i).sort(); //~ ERROR no method named `sort` found for unit type `()` in the current scope +} + fn foo(mut s: String) -> String { s.push_str("asdf") //~ ERROR mismatched types } diff --git a/tests/ui/suggestions/chain-method-call-mutation-in-place.stderr b/tests/ui/suggestions/chain-method-call-mutation-in-place.stderr index 11d9b8391..128160f10 100644 --- a/tests/ui/suggestions/chain-method-call-mutation-in-place.stderr +++ b/tests/ui/suggestions/chain-method-call-mutation-in-place.stderr @@ -1,5 +1,33 @@ error[E0308]: mismatched types - --> $DIR/chain-method-call-mutation-in-place.rs:3:5 + --> $DIR/chain-method-call-mutation-in-place.rs:2:23 + | +LL | let x: Vec = vec![1, 2, 3].into_iter().collect::>().sort_by_key(|i| i); + | -------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Vec`, found `()` + | | + | expected due to this + | + = note: expected struct `Vec` + found unit type `()` +note: method `sort_by_key` modifies its receiver in-place, it is not meant to be used in method chains. + --> $DIR/chain-method-call-mutation-in-place.rs:2:71 + | +LL | let x: Vec = vec![1, 2, 3].into_iter().collect::>().sort_by_key(|i| i); + | ^^^^^^^^^^^ this call modifies its receiver in-place + +error[E0599]: no method named `sort` found for unit type `()` in the current scope + --> $DIR/chain-method-call-mutation-in-place.rs:3:72 + | +LL | vec![1, 2, 3].into_iter().collect::>().sort_by_key(|i| i).sort(); + | ^^^^ method not found in `()` + | +note: method `sort_by_key` modifies its receiver in-place, it is not meant to be used in method chains. + --> $DIR/chain-method-call-mutation-in-place.rs:3:53 + | +LL | vec![1, 2, 3].into_iter().collect::>().sort_by_key(|i| i).sort(); + | ^^^^^^^^^^^ this call modifies its receiver in-place + +error[E0308]: mismatched types + --> $DIR/chain-method-call-mutation-in-place.rs:7:5 | LL | fn foo(mut s: String) -> String { | ------ expected `String` because of return type @@ -7,7 +35,7 @@ LL | s.push_str("asdf") | ^^^^^^^^^^^^^^^^^^ expected `String`, found `()` | note: method `push_str` modifies its receiver in-place - --> $DIR/chain-method-call-mutation-in-place.rs:3:7 + --> $DIR/chain-method-call-mutation-in-place.rs:7:7 | LL | s.push_str("asdf") | - ^^^^^^^^ this call modifies `s` in-place @@ -15,6 +43,7 @@ LL | s.push_str("asdf") | you probably want to use this value after calling the method... = note: ...instead of the `()` output of method `push_str` -error: aborting due to previous error +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0308`. +Some errors have detailed explanations: E0308, E0599. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr b/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr index 45593035b..0716005c6 100644 --- a/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr +++ b/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr @@ -35,7 +35,8 @@ LL | t.clone() | ^ help: consider annotating `Foo` with `#[derive(Clone)]` | -LL | #[derive(Clone)] +LL + #[derive(Clone)] +LL | struct Foo; | error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.rs b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.rs index 15f08486f..af47ba8ba 100644 --- a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.rs +++ b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.rs @@ -2,10 +2,9 @@ fn main() { let A = 3; //~^ ERROR refutable pattern in local binding //~| patterns `i32::MIN..=1_i32` and `3_i32..=i32::MAX` not covered - //~| missing patterns are not covered because `a` is interpreted as a constant pattern, not a new variable + //~| missing patterns are not covered because `A` is interpreted as a constant pattern, not a new variable //~| HELP introduce a variable instead - //~| SUGGESTION a_var + //~| SUGGESTION A_var const A: i32 = 2; - //~^ constant defined here } diff --git a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr index 1c1cab25f..9ee3e6eb2 100644 --- a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr +++ b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr @@ -5,12 +5,11 @@ LL | let A = 3; | ^ | | | patterns `i32::MIN..=1_i32` and `3_i32..=i32::MAX` not covered - | missing patterns are not covered because `a` is interpreted as a constant pattern, not a new variable - | help: introduce a variable instead: `a_var` -... -LL | const A: i32 = 2; - | ------------ constant defined here + | missing patterns are not covered because `A` is interpreted as a constant pattern, not a new variable + | help: introduce a variable instead: `A_var` | + = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant + = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: the matched value is of type `i32` error: aborting due to previous error diff --git a/tests/ui/suggestions/core-std-import-order-issue-83564.stderr b/tests/ui/suggestions/core-std-import-order-issue-83564.stderr index e4e1fc591..48ee44a74 100644 --- a/tests/ui/suggestions/core-std-import-order-issue-83564.stderr +++ b/tests/ui/suggestions/core-std-import-order-issue-83564.stderr @@ -6,9 +6,9 @@ LL | let _x = NonZeroU32::new(5).unwrap(); | help: consider importing one of these items | -LL | use core::num::NonZeroU32; +LL + use core::num::NonZeroU32; | -LL | use std::num::NonZeroU32; +LL + use std::num::NonZeroU32; | error: aborting due to previous error diff --git a/tests/ui/suggestions/correct-binder-for-arbitrary-bound-sugg.rs b/tests/ui/suggestions/correct-binder-for-arbitrary-bound-sugg.rs new file mode 100644 index 000000000..e56c8622e --- /dev/null +++ b/tests/ui/suggestions/correct-binder-for-arbitrary-bound-sugg.rs @@ -0,0 +1,16 @@ +trait Foo +where + for<'a> &'a Self: Bar, +{ +} + +impl Foo for () {} + +trait Bar {} + +impl Bar for &() {} + +fn foo() {} +//~^ ERROR the trait bound `for<'a> &'a T: Bar` is not satisfied + +fn main() {} diff --git a/tests/ui/suggestions/correct-binder-for-arbitrary-bound-sugg.stderr b/tests/ui/suggestions/correct-binder-for-arbitrary-bound-sugg.stderr new file mode 100644 index 000000000..2298e7f4e --- /dev/null +++ b/tests/ui/suggestions/correct-binder-for-arbitrary-bound-sugg.stderr @@ -0,0 +1,22 @@ +error[E0277]: the trait bound `for<'a> &'a T: Bar` is not satisfied + --> $DIR/correct-binder-for-arbitrary-bound-sugg.rs:13:11 + | +LL | fn foo() {} + | ^^^ the trait `for<'a> Bar` is not implemented for `&'a T` + | +note: required by a bound in `Foo` + --> $DIR/correct-binder-for-arbitrary-bound-sugg.rs:3:23 + | +LL | trait Foo + | --- required by a bound in this trait +LL | where +LL | for<'a> &'a Self: Bar, + | ^^^ required by this bound in `Foo` +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + | +LL | fn foo() where for<'a> &'a T: Bar {} + | ++++++++++++++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/suggestions/derive-macro-missing-bounds.stderr b/tests/ui/suggestions/derive-macro-missing-bounds.stderr index 79036279d..c3f305c17 100644 --- a/tests/ui/suggestions/derive-macro-missing-bounds.stderr +++ b/tests/ui/suggestions/derive-macro-missing-bounds.stderr @@ -11,7 +11,8 @@ LL | struct Outer(Inner); = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `a::Inner` with `#[derive(Debug)]` | -LL | #[derive(Debug)] +LL + #[derive(Debug)] +LL | struct Inner(T); | help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | diff --git a/tests/ui/suggestions/derive-trait-for-method-call.stderr b/tests/ui/suggestions/derive-trait-for-method-call.stderr index 924b26a8c..e2db0da74 100644 --- a/tests/ui/suggestions/derive-trait-for-method-call.stderr +++ b/tests/ui/suggestions/derive-trait-for-method-call.stderr @@ -32,7 +32,8 @@ note: the trait `Default` must be implemented --> $SRC_DIR/core/src/default.rs:LL:COL help: consider annotating `Enum` with `#[derive(Clone)]` | -LL | #[derive(Clone)] +LL + #[derive(Clone)] +LL | enum Enum { | error[E0599]: the method `test` exists for struct `Foo`, but its trait bounds were not satisfied @@ -67,11 +68,13 @@ LL | impl Foo { | unsatisfied trait bound introduced here help: consider annotating `CloneStruct` with `#[derive(Default)]` | -LL | #[derive(Default)] +LL + #[derive(Default)] +LL | struct CloneStruct { | help: consider annotating `Struct` with `#[derive(Clone, Default)]` | -LL | #[derive(Clone, Default)] +LL + #[derive(Clone, Default)] +LL | struct Struct { | error[E0599]: the method `test` exists for struct `Foo, Instant>`, but its trait bounds were not satisfied diff --git a/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr b/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr index 4658ecb3a..85fbb8b88 100644 --- a/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr +++ b/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr @@ -10,9 +10,9 @@ LL | banana::Chaenomeles.pick() = help: items from traits can only be used if the trait is in scope help: the following traits are implemented but not in scope; perhaps add a `use` for one of them: | -LL | use banana::Apple; +LL + use banana::Apple; | -LL | use banana::Peach; +LL + use banana::Peach; | error: aborting due to previous error diff --git a/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr b/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr index 90ea06239..0232d4c8d 100644 --- a/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr +++ b/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr @@ -50,7 +50,8 @@ LL | Pin::new(x) | | | required by a bound introduced by this call | - = note: consider using `Box::pin` + = note: consider using the `pin!` macro + consider using `Box::pin` if you need to access the pinned value outside of the current scope note: required by a bound in `Pin::

::new` --> $SRC_DIR/core/src/pin.rs:LL:COL @@ -62,25 +63,23 @@ LL | Pin::new(Box::new(x)) | | | required by a bound introduced by this call | - = note: consider using `Box::pin` + = note: consider using the `pin!` macro + consider using `Box::pin` if you need to access the pinned value outside of the current scope note: required by a bound in `Pin::

::new` --> $SRC_DIR/core/src/pin.rs:LL:COL error[E0308]: mismatched types --> $DIR/expected-boxed-future-isnt-pinned.rs:28:5 | +LL | fn zap() -> BoxFuture<'static, i32> { + | ----------------------- expected `Pin + Send + 'static)>>` because of return type LL | / async { LL | | 42 LL | | } - | | ^ - | | | - | |_____expected `Pin>`, found `async` block - | arguments to this function are incorrect + | |_____^ expected `Pin>`, found `async` block | - = note: expected struct `Pin + Send>>` + = note: expected struct `Pin + Send + 'static)>>` found `async` block `[async block@$DIR/expected-boxed-future-isnt-pinned.rs:28:5: 30:6]` -note: function defined here - --> $SRC_DIR/core/src/future/mod.rs:LL:COL help: you need to pin and box this expression | LL ~ Box::pin(async { diff --git a/tests/ui/suggestions/import-trait-for-method-call.stderr b/tests/ui/suggestions/import-trait-for-method-call.stderr index f159b51a2..3f54daf13 100644 --- a/tests/ui/suggestions/import-trait-for-method-call.stderr +++ b/tests/ui/suggestions/import-trait-for-method-call.stderr @@ -10,7 +10,7 @@ LL | h.finish() = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use std::hash::Hasher; +LL + use std::hash::Hasher; | error[E0599]: the method `as_ref` exists for reference `&dyn Bar`, but its trait bounds were not satisfied diff --git a/tests/ui/suggestions/invalid-bin-op.stderr b/tests/ui/suggestions/invalid-bin-op.stderr index 08502dfeb..e291cedb8 100644 --- a/tests/ui/suggestions/invalid-bin-op.stderr +++ b/tests/ui/suggestions/invalid-bin-op.stderr @@ -13,7 +13,8 @@ LL | struct S(T); | ^^^^^^^^^^^ must implement `PartialEq<_>` help: consider annotating `S` with `#[derive(PartialEq)]` | -LL | #[derive(PartialEq)] +LL + #[derive(PartialEq)] +LL | struct S(T); | help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | diff --git a/tests/ui/suggestions/issue-107860.rs b/tests/ui/suggestions/issue-107860.rs new file mode 100644 index 000000000..a6449cd44 --- /dev/null +++ b/tests/ui/suggestions/issue-107860.rs @@ -0,0 +1,6 @@ +// edition: 2021 + +async fn str(T: &str) -> &str { &str } +//~^ ERROR mismatched types + +fn main() {} diff --git a/tests/ui/suggestions/issue-107860.stderr b/tests/ui/suggestions/issue-107860.stderr new file mode 100644 index 000000000..92e3cf8c4 --- /dev/null +++ b/tests/ui/suggestions/issue-107860.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/issue-107860.rs:3:36 + | +LL | async fn str(T: &str) -> &str { &str } + | ^^^^ expected `&str`, found `&fn(&str) -> ... {str::<...>}` + | + = note: expected reference `&str` + found reference `&for<'a> fn(&'a str) -> impl Future {str::<_>}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/suggestions/issue-108470.fixed b/tests/ui/suggestions/issue-108470.fixed new file mode 100644 index 000000000..9d15c4a8f --- /dev/null +++ b/tests/ui/suggestions/issue-108470.fixed @@ -0,0 +1,29 @@ +// run-rustfix +#![allow(dead_code)] + +struct Foo { + t: Thing +} + +#[derive(Clone)] +struct Thing; + +fn test_clone() { + let t = &Thing; + let _f = Foo { + t: t.clone() //~ ERROR mismatched types + }; +} + +struct Bar { + t: bool +} + +fn test_is_some() { + let t = Option::::Some(1); + let _f = Bar { + t: t.is_some() //~ ERROR mismatched types + }; +} + +fn main() {} diff --git a/tests/ui/suggestions/issue-108470.rs b/tests/ui/suggestions/issue-108470.rs new file mode 100644 index 000000000..bda39085d --- /dev/null +++ b/tests/ui/suggestions/issue-108470.rs @@ -0,0 +1,29 @@ +// run-rustfix +#![allow(dead_code)] + +struct Foo { + t: Thing +} + +#[derive(Clone)] +struct Thing; + +fn test_clone() { + let t = &Thing; + let _f = Foo { + t //~ ERROR mismatched types + }; +} + +struct Bar { + t: bool +} + +fn test_is_some() { + let t = Option::::Some(1); + let _f = Bar { + t //~ ERROR mismatched types + }; +} + +fn main() {} diff --git a/tests/ui/suggestions/issue-108470.stderr b/tests/ui/suggestions/issue-108470.stderr new file mode 100644 index 000000000..4e561eca7 --- /dev/null +++ b/tests/ui/suggestions/issue-108470.stderr @@ -0,0 +1,27 @@ +error[E0308]: mismatched types + --> $DIR/issue-108470.rs:14:9 + | +LL | t + | ^ expected `Thing`, found `&Thing` + | +help: consider using clone here + | +LL | t: t.clone() + | +++++++++++ + +error[E0308]: mismatched types + --> $DIR/issue-108470.rs:25:9 + | +LL | t + | ^ expected `bool`, found `Option` + | + = note: expected type `bool` + found enum `Option` +help: use `Option::is_some` to test if the `Option` has a value + | +LL | t: t.is_some() + | +++++++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/suggestions/issue-109291.rs b/tests/ui/suggestions/issue-109291.rs new file mode 100644 index 000000000..1947b16a3 --- /dev/null +++ b/tests/ui/suggestions/issue-109291.rs @@ -0,0 +1,4 @@ +fn main() { + println!("Custom backtrace: {}", std::backtrace::Backtrace::forced_capture()); + //~^ ERROR no function or associated item name +} diff --git a/tests/ui/suggestions/issue-109291.stderr b/tests/ui/suggestions/issue-109291.stderr new file mode 100644 index 000000000..4ef5948d9 --- /dev/null +++ b/tests/ui/suggestions/issue-109291.stderr @@ -0,0 +1,12 @@ +error[E0599]: no function or associated item named `forced_capture` found for struct `Backtrace` in the current scope + --> $DIR/issue-109291.rs:2:65 + | +LL | println!("Custom backtrace: {}", std::backtrace::Backtrace::forced_capture()); + | ^^^^^^^^^^^^^^ + | | + | function or associated item not found in `Backtrace` + | help: there is an associated function with a similar name: `force_capture` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/suggestions/issue-109396.rs b/tests/ui/suggestions/issue-109396.rs new file mode 100644 index 000000000..b6c464d45 --- /dev/null +++ b/tests/ui/suggestions/issue-109396.rs @@ -0,0 +1,12 @@ +fn main() { + { + let mut mutex = std::mem::zeroed( + //~^ ERROR this function takes 0 arguments but 4 arguments were supplied + file.as_raw_fd(), + //~^ ERROR expected value, found macro `file` + 0, + 0, + 0, + ); + } +} diff --git a/tests/ui/suggestions/issue-109396.stderr b/tests/ui/suggestions/issue-109396.stderr new file mode 100644 index 000000000..d4956872a --- /dev/null +++ b/tests/ui/suggestions/issue-109396.stderr @@ -0,0 +1,34 @@ +error[E0423]: expected value, found macro `file` + --> $DIR/issue-109396.rs:5:13 + | +LL | file.as_raw_fd(), + | ^^^^ not a value + +error[E0061]: this function takes 0 arguments but 4 arguments were supplied + --> $DIR/issue-109396.rs:3:25 + | +LL | let mut mutex = std::mem::zeroed( + | ^^^^^^^^^^^^^^^^ +LL | +LL | file.as_raw_fd(), + | ---------------- unexpected argument +LL | +LL | 0, + | - unexpected argument of type `{integer}` +LL | 0, + | - unexpected argument of type `{integer}` +LL | 0, + | - unexpected argument of type `{integer}` + | +note: function defined here + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL +help: remove the extra arguments + | +LL - file.as_raw_fd(), +LL + ); + | + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0061, E0423. +For more information about an error, try `rustc --explain E0061`. diff --git a/tests/ui/suggestions/issue-109436.rs b/tests/ui/suggestions/issue-109436.rs new file mode 100644 index 000000000..e45ee5991 --- /dev/null +++ b/tests/ui/suggestions/issue-109436.rs @@ -0,0 +1,13 @@ +struct Foo; +struct Bar; + +impl From<&Foo> for Bar { + fn from(foo: &Foo) -> Bar { + Bar + } +} + +fn main() { + let foo = Foo; + let b: Bar = foo.into(); //~ ERROR E0277 +} diff --git a/tests/ui/suggestions/issue-109436.stderr b/tests/ui/suggestions/issue-109436.stderr new file mode 100644 index 000000000..48518b33d --- /dev/null +++ b/tests/ui/suggestions/issue-109436.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `Foo: Into<_>` is not satisfied + --> $DIR/issue-109436.rs:12:22 + | +LL | let b: Bar = foo.into(); + | ^^^^ the trait `~const Into<_>` is not implemented for `Foo` + | + = note: required for `Foo` to implement `Into` +help: consider borrowing here + | +LL | let b: Bar = (&foo).into(); + | ++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/suggestions/issue-84973-blacklist.stderr b/tests/ui/suggestions/issue-84973-blacklist.stderr index c20cc8164..4de9da89c 100644 --- a/tests/ui/suggestions/issue-84973-blacklist.stderr +++ b/tests/ui/suggestions/issue-84973-blacklist.stderr @@ -27,7 +27,8 @@ LL | fn f_clone(t: T) {} | ^^^^^ required by this bound in `f_clone` help: consider annotating `S` with `#[derive(Clone)]` | -LL | #[derive(Clone)] +LL + #[derive(Clone)] +LL | struct S; | error[E0277]: `[static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:22]` cannot be unpinned @@ -38,7 +39,8 @@ LL | f_unpin(static || { yield; }); | | | required by a bound introduced by this call | - = note: consider using `Box::pin` + = note: consider using the `pin!` macro + consider using `Box::pin` if you need to access the pinned value outside of the current scope note: required by a bound in `f_unpin` --> $DIR/issue-84973-blacklist.rs:8:15 | diff --git a/tests/ui/suggestions/issue-97760.stderr b/tests/ui/suggestions/issue-97760.stderr index bbcc3693f..5415c247c 100644 --- a/tests/ui/suggestions/issue-97760.stderr +++ b/tests/ui/suggestions/issue-97760.stderr @@ -1,8 +1,8 @@ error[E0277]: `::Item` doesn't implement `std::fmt::Display` - --> $DIR/issue-97760.rs:4:20 + --> $DIR/issue-97760.rs:4:19 | LL | println!("{x}"); - | ^ `::Item` cannot be formatted with the default formatter + | ^^^ `::Item` cannot be formatted with the default formatter | = help: the trait `std::fmt::Display` is not implemented for `::Item` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.fixed b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.fixed index 304360d48..47b35b412 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.fixed +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.fixed @@ -7,7 +7,7 @@ pub struct Vector2{ pub y: T } -#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented for this type +#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented for this type pub struct AABB{ pub loc: Vector2, pub size: Vector2 diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.rs b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.rs index 14e1fbb33..771e9105c 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.rs +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.rs @@ -7,7 +7,7 @@ pub struct Vector2{ pub y: T } -#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented for this type +#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented for this type pub struct AABB{ pub loc: Vector2, pub size: Vector2 diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr index faf730a5c..09696e061 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr @@ -1,4 +1,4 @@ -error[E0204]: the trait `Copy` may not be implemented for this type +error[E0204]: the trait `Copy` cannot be implemented for this type --> $DIR/missing-bound-in-derive-copy-impl-3.rs:10:17 | LL | #[derive(Debug, Copy, Clone)] @@ -6,16 +6,12 @@ LL | #[derive(Debug, Copy, Clone)] LL | pub struct AABB{ LL | pub loc: Vector2, | ------------------- this field does not implement `Copy` -LL | pub size: Vector2 - | -------------------- this field does not implement `Copy` | note: the `Copy` impl for `Vector2` requires that `K: Debug` --> $DIR/missing-bound-in-derive-copy-impl-3.rs:12:14 | LL | pub loc: Vector2, | ^^^^^^^^^^ -LL | pub size: Vector2 - | ^^^^^^^^^^ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting this bound | diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl.rs b/tests/ui/suggestions/missing-bound-in-derive-copy-impl.rs index 52163bddd..9c7b7ba09 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl.rs +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl.rs @@ -6,7 +6,7 @@ pub struct Vector2{ pub y: T } -#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented for this type +#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented for this type pub struct AABB{ pub loc: Vector2, pub size: Vector2 diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr b/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr index 11bc54099..8585fe47b 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr @@ -1,4 +1,4 @@ -error[E0204]: the trait `Copy` may not be implemented for this type +error[E0204]: the trait `Copy` cannot be implemented for this type --> $DIR/missing-bound-in-derive-copy-impl.rs:9:17 | LL | #[derive(Debug, Copy, Clone)] @@ -6,16 +6,12 @@ LL | #[derive(Debug, Copy, Clone)] LL | pub struct AABB{ LL | pub loc: Vector2, | ------------------- this field does not implement `Copy` -LL | pub size: Vector2 - | -------------------- this field does not implement `Copy` | note: the `Copy` impl for `Vector2` requires that `K: Debug` --> $DIR/missing-bound-in-derive-copy-impl.rs:11:14 | LL | pub loc: Vector2, | ^^^^^^^^^^ -LL | pub size: Vector2 - | ^^^^^^^^^^ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `K` | diff --git a/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.fixed b/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.fixed index 691e7553a..f32c61a99 100644 --- a/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.fixed +++ b/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.fixed @@ -14,6 +14,6 @@ impl Clone for OnlyCopyIfDisplay { impl Copy for OnlyCopyIfDisplay {} impl Copy for Wrapper> {} -//~^ ERROR the trait `Copy` may not be implemented for this type +//~^ ERROR the trait `Copy` cannot be implemented for this type fn main() {} diff --git a/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.rs b/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.rs index e3185e7ef..d7725f4a3 100644 --- a/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.rs +++ b/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.rs @@ -14,6 +14,6 @@ impl Clone for OnlyCopyIfDisplay { impl Copy for OnlyCopyIfDisplay {} impl Copy for Wrapper> {} -//~^ ERROR the trait `Copy` may not be implemented for this type +//~^ ERROR the trait `Copy` cannot be implemented for this type fn main() {} diff --git a/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.stderr b/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.stderr index 9e6f0d9eb..856d8db38 100644 --- a/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.stderr +++ b/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.stderr @@ -1,4 +1,4 @@ -error[E0204]: the trait `Copy` may not be implemented for this type +error[E0204]: the trait `Copy` cannot be implemented for this type --> $DIR/missing-bound-in-manual-copy-impl-2.rs:16:18 | LL | struct Wrapper(T); diff --git a/tests/ui/suggestions/missing-bound-in-manual-copy-impl.fixed b/tests/ui/suggestions/missing-bound-in-manual-copy-impl.fixed index 32a7215c5..1139b3153 100644 --- a/tests/ui/suggestions/missing-bound-in-manual-copy-impl.fixed +++ b/tests/ui/suggestions/missing-bound-in-manual-copy-impl.fixed @@ -4,6 +4,6 @@ struct Wrapper(T); impl Copy for Wrapper {} -//~^ ERROR the trait `Copy` may not be implemented for this type +//~^ ERROR the trait `Copy` cannot be implemented for this type fn main() {} diff --git a/tests/ui/suggestions/missing-bound-in-manual-copy-impl.rs b/tests/ui/suggestions/missing-bound-in-manual-copy-impl.rs index c688f4d41..19549248e 100644 --- a/tests/ui/suggestions/missing-bound-in-manual-copy-impl.rs +++ b/tests/ui/suggestions/missing-bound-in-manual-copy-impl.rs @@ -4,6 +4,6 @@ struct Wrapper(T); impl Copy for Wrapper {} -//~^ ERROR the trait `Copy` may not be implemented for this type +//~^ ERROR the trait `Copy` cannot be implemented for this type fn main() {} diff --git a/tests/ui/suggestions/missing-bound-in-manual-copy-impl.stderr b/tests/ui/suggestions/missing-bound-in-manual-copy-impl.stderr index fe2d133c8..ec3e4f23a 100644 --- a/tests/ui/suggestions/missing-bound-in-manual-copy-impl.stderr +++ b/tests/ui/suggestions/missing-bound-in-manual-copy-impl.stderr @@ -1,4 +1,4 @@ -error[E0204]: the trait `Copy` may not be implemented for this type +error[E0204]: the trait `Copy` cannot be implemented for this type --> $DIR/missing-bound-in-manual-copy-impl.rs:6:18 | LL | struct Wrapper(T); diff --git a/tests/ui/suggestions/multiline-multipart-suggestion.rs b/tests/ui/suggestions/multiline-multipart-suggestion.rs new file mode 100644 index 000000000..77d0322d0 --- /dev/null +++ b/tests/ui/suggestions/multiline-multipart-suggestion.rs @@ -0,0 +1,19 @@ +// compile-flags: --error-format=human --color=always +// ignore-windows + +fn short(foo_bar: &Vec<&i32>) -> &i32 { //~ ERROR missing lifetime specifier + &12 +} + +fn long( //~ ERROR missing lifetime specifier + foo_bar: &Vec<&i32>, + something_very_long_so_that_the_line_will_wrap_around__________: i32, +) -> &i32 { + &12 +} + +fn long2( //~ ERROR missing lifetime specifier + foo_bar: &Vec<&i32>) -> &i32 { + &12 +} +fn main() {} diff --git a/tests/ui/suggestions/multiline-multipart-suggestion.stderr b/tests/ui/suggestions/multiline-multipart-suggestion.stderr new file mode 100644 index 000000000..045a86b4f --- /dev/null +++ b/tests/ui/suggestions/multiline-multipart-suggestion.stderr @@ -0,0 +1,46 @@ +error[E0106]: missing lifetime specifier + --> $DIR/multiline-multipart-suggestion.rs:4:34 + | +LL | fn short(foo_bar: &Vec<&i32>) -> &i32 { + |  ---------- ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say which one of `foo_bar`'s 2 lifetimes it is borrowed from +help: consider introducing a named lifetime parameter + | +LL | fn short<'a>(foo_bar: &'a Vec<&'a i32>) -> &'a i32 { + | ++++ ++ ++ ++ + +error[E0106]: missing lifetime specifier + --> $DIR/multiline-multipart-suggestion.rs:11:6 + | +LL |  foo_bar: &Vec<&i32>, + |  ---------- +LL |  something_very_long_so_that_the_line_will_wrap_around__________: i32, +LL | ) -> &i32 { + |  ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say which one of `foo_bar`'s 2 lifetimes it is borrowed from +help: consider introducing a named lifetime parameter + | +LL ~ fn long<'a>( +LL ~  foo_bar: &'a Vec<&'a i32>, +LL |  something_very_long_so_that_the_line_will_wrap_around__________: i32, +LL ~ ) -> &'a i32 { + | + +error[E0106]: missing lifetime specifier + --> $DIR/multiline-multipart-suggestion.rs:16:29 + | +LL |  foo_bar: &Vec<&i32>) -> &i32 { + |  ---------- ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say which one of `foo_bar`'s 2 lifetimes it is borrowed from +help: consider introducing a named lifetime parameter + | +LL ~ fn long2<'a>( +LL ~  foo_bar: &'a Vec<&'a i32>) -> &'a i32 { + | + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0106`. diff --git a/tests/ui/suggestions/mut-borrow-needed-by-trait.stderr b/tests/ui/suggestions/mut-borrow-needed-by-trait.stderr index 6910b77d9..94710f450 100644 --- a/tests/ui/suggestions/mut-borrow-needed-by-trait.stderr +++ b/tests/ui/suggestions/mut-borrow-needed-by-trait.stderr @@ -21,18 +21,22 @@ note: required by a bound in `BufWriter` --> $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL error[E0599]: the method `write_fmt` exists for struct `BufWriter<&dyn Write>`, but its trait bounds were not satisfied - --> $DIR/mut-borrow-needed-by-trait.rs:21:5 + --> $DIR/mut-borrow-needed-by-trait.rs:21:14 | LL | writeln!(fp, "hello world").unwrap(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ method cannot be called on `BufWriter<&dyn Write>` due to unsatisfied trait bounds + | ---------^^---------------- method cannot be called on `BufWriter<&dyn Write>` due to unsatisfied trait bounds --> $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL | = note: doesn't satisfy `BufWriter<&dyn std::io::Write>: std::io::Write` | +note: must implement `io::Write`, `fmt::Write`, or have a `write_fmt` method + --> $DIR/mut-borrow-needed-by-trait.rs:21:14 + | +LL | writeln!(fp, "hello world").unwrap(); + | ^^ = note: the following trait bounds were not satisfied: `&dyn std::io::Write: std::io::Write` which is required by `BufWriter<&dyn std::io::Write>: std::io::Write` - = note: this error originates in the macro `writeln` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/tests/ui/suggestions/no-extern-crate-in-type.stderr b/tests/ui/suggestions/no-extern-crate-in-type.stderr index 876eef2b6..68100e56c 100644 --- a/tests/ui/suggestions/no-extern-crate-in-type.stderr +++ b/tests/ui/suggestions/no-extern-crate-in-type.stderr @@ -6,7 +6,7 @@ LL | type Output = Option; | help: consider importing this struct | -LL | use foo::Foo; +LL + use foo::Foo; | error: aborting due to previous error diff --git a/tests/ui/suggestions/raw-name-use-suggestion.stderr b/tests/ui/suggestions/raw-name-use-suggestion.stderr index 95c26b9ad..fb070ffc3 100644 --- a/tests/ui/suggestions/raw-name-use-suggestion.stderr +++ b/tests/ui/suggestions/raw-name-use-suggestion.stderr @@ -28,7 +28,7 @@ LL | r#break(); | help: consider importing this function | -LL | use foo::r#break; +LL + use foo::r#break; | error: aborting due to 3 previous errors diff --git a/tests/ui/suggestions/ref-pattern-binding.stderr b/tests/ui/suggestions/ref-pattern-binding.stderr index 7b1942593..69ce5d440 100644 --- a/tests/ui/suggestions/ref-pattern-binding.stderr +++ b/tests/ui/suggestions/ref-pattern-binding.stderr @@ -2,9 +2,8 @@ error: borrow of moved value --> $DIR/ref-pattern-binding.rs:10:9 | LL | let _moved @ ref _from = String::from("foo"); - | ------^^^--------- - | | | - | | value borrowed here after move + | ^^^^^^ --------- value borrowed here after move + | | | value moved into `_moved` here | move occurs because `_moved` has type `String` which does not implement the `Copy` trait | @@ -17,27 +16,24 @@ error: cannot move out of value because it is borrowed --> $DIR/ref-pattern-binding.rs:11:9 | LL | let ref _moved @ _from = String::from("foo"); - | ----------^^^----- - | | | - | | value is moved into `_from` here + | ^^^^^^^^^^ ----- value is moved into `_from` here + | | | value is borrowed by `_moved` here error: cannot move out of value because it is borrowed --> $DIR/ref-pattern-binding.rs:15:9 | LL | let ref _moved @ S { f } = S { f: String::from("foo") }; - | ----------^^^^^^^-^^ - | | | - | | value is moved into `f` here + | ^^^^^^^^^^ - value is moved into `f` here + | | | value is borrowed by `_moved` here error: borrow of moved value --> $DIR/ref-pattern-binding.rs:18:9 | LL | let _moved @ S { ref f } = S { f: String::from("foo") }; - | ------^^^^^^^-----^^ - | | | - | | value borrowed here after move + | ^^^^^^ ----- value borrowed here after move + | | | value moved into `_moved` here | move occurs because `_moved` has type `S` which does not implement the `Copy` trait | diff --git a/tests/ui/suggestions/suggest-pin-macro.rs b/tests/ui/suggestions/suggest-pin-macro.rs new file mode 100644 index 000000000..f5b962159 --- /dev/null +++ b/tests/ui/suggestions/suggest-pin-macro.rs @@ -0,0 +1,23 @@ +use std::pin::Pin; +use std::marker::PhantomPinned; + +#[derive(Debug)] +struct Test { + _marker: PhantomPinned, +} +impl Test { + fn new() -> Self { + Test { + _marker: PhantomPinned, // This makes our type `!Unpin` + } + } +} + +fn dummy(_: &mut Test) {} + +pub fn main() { + let mut test1 = Test::new(); + let mut test1 = unsafe { Pin::new_unchecked(&mut test1) }; + + dummy(test1.get_mut()); //~ ERROR E0277 +} diff --git a/tests/ui/suggestions/suggest-pin-macro.stderr b/tests/ui/suggestions/suggest-pin-macro.stderr new file mode 100644 index 000000000..1220cf650 --- /dev/null +++ b/tests/ui/suggestions/suggest-pin-macro.stderr @@ -0,0 +1,19 @@ +error[E0277]: `PhantomPinned` cannot be unpinned + --> $DIR/suggest-pin-macro.rs:22:17 + | +LL | dummy(test1.get_mut()); + | ^^^^^^^ within `Test`, the trait `Unpin` is not implemented for `PhantomPinned` + | + = note: consider using the `pin!` macro + consider using `Box::pin` if you need to access the pinned value outside of the current scope +note: required because it appears within the type `Test` + --> $DIR/suggest-pin-macro.rs:5:8 + | +LL | struct Test { + | ^^^^ +note: required by a bound in `Pin::<&'a mut T>::get_mut` + --> $SRC_DIR/core/src/pin.rs:LL:COL + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/suggestions/suggest-ret-on-async-w-late.rs b/tests/ui/suggestions/suggest-ret-on-async-w-late.rs new file mode 100644 index 000000000..459b94f94 --- /dev/null +++ b/tests/ui/suggestions/suggest-ret-on-async-w-late.rs @@ -0,0 +1,11 @@ +// edition: 2021 + +// Make sure we don't ICE when suggesting a return type +// for an async fn that has late-bound vars... + +async fn ice(_: &i32) { + true + //~^ ERROR mismatched types +} + +fn main() {} diff --git a/tests/ui/suggestions/suggest-ret-on-async-w-late.stderr b/tests/ui/suggestions/suggest-ret-on-async-w-late.stderr new file mode 100644 index 000000000..bff864b22 --- /dev/null +++ b/tests/ui/suggestions/suggest-ret-on-async-w-late.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/suggest-ret-on-async-w-late.rs:7:5 + | +LL | async fn ice(_: &i32) { + | - help: try adding a return type: `-> bool` +LL | true + | ^^^^ expected `()`, found `bool` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/suggestions/suggest-tryinto-edition-change.stderr b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr index 018083f9e..671f5efdd 100644 --- a/tests/ui/suggestions/suggest-tryinto-edition-change.stderr +++ b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr @@ -8,9 +8,9 @@ LL | let _i: i16 = TryFrom::try_from(0_i32).unwrap(); = note: 'core::convert::TryFrom' is included in the prelude starting in Edition 2021 help: consider importing one of these items | -LL | use core::convert::TryFrom; +LL + use core::convert::TryFrom; | -LL | use std::convert::TryFrom; +LL + use std::convert::TryFrom; | error[E0433]: failed to resolve: use of undeclared type `TryInto` @@ -23,9 +23,9 @@ LL | let _i: i16 = TryInto::try_into(0_i32).unwrap(); = note: 'core::convert::TryInto' is included in the prelude starting in Edition 2021 help: consider importing one of these items | -LL | use core::convert::TryInto; +LL + use core::convert::TryInto; | -LL | use std::convert::TryInto; +LL + use std::convert::TryInto; | error[E0433]: failed to resolve: use of undeclared type `FromIterator` @@ -42,9 +42,9 @@ LL | let _v: Vec<_> = IntoIterator::from_iter(&[1]); | ~~~~~~~~~~~~ help: consider importing one of these items | -LL | use core::iter::FromIterator; +LL + use core::iter::FromIterator; | -LL | use std::iter::FromIterator; +LL + use std::iter::FromIterator; | error[E0599]: no method named `try_into` found for type `i32` in the current scope @@ -60,7 +60,7 @@ LL | let _i: i16 = 0_i32.try_into().unwrap(); = note: 'std::convert::TryInto' is included in the prelude starting in Edition 2021 help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use std::convert::TryInto; +LL + use std::convert::TryInto; | error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/use-placement-resolve.stderr b/tests/ui/suggestions/use-placement-resolve.stderr index 9da9e8e27..77724e7e2 100644 --- a/tests/ui/suggestions/use-placement-resolve.stderr +++ b/tests/ui/suggestions/use-placement-resolve.stderr @@ -6,7 +6,7 @@ LL | fn foobar(x: T) {} | help: consider importing this trait instead | -LL | use std::fmt::Debug; +LL + use std::fmt::Debug; | error: aborting due to previous error diff --git a/tests/ui/suggestions/use-placement-typeck.stderr b/tests/ui/suggestions/use-placement-typeck.stderr index 3b2749773..e900e12b7 100644 --- a/tests/ui/suggestions/use-placement-typeck.stderr +++ b/tests/ui/suggestions/use-placement-typeck.stderr @@ -13,7 +13,7 @@ LL | pub struct S; = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use m::Foo; +LL + use m::Foo; | error: aborting due to previous error diff --git a/tests/ui/suppressed-error.rs b/tests/ui/suppressed-error.rs deleted file mode 100644 index 1e39be460..000000000 --- a/tests/ui/suppressed-error.rs +++ /dev/null @@ -1,8 +0,0 @@ -fn main() { - let (x, y) = (); -//~^ ERROR mismatched types -//~| expected unit type `()` -//~| found tuple `(_, _)` -//~| expected `()`, found - return x; -} diff --git a/tests/ui/suppressed-error.stderr b/tests/ui/suppressed-error.stderr deleted file mode 100644 index 11d70f8a4..000000000 --- a/tests/ui/suppressed-error.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/suppressed-error.rs:2:9 - | -LL | let (x, y) = (); - | ^^^^^^ -- this expression has type `()` - | | - | expected `()`, found `(_, _)` - | - = note: expected unit type `()` - found tuple `(_, _)` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/symbol-names/basic.legacy.stderr b/tests/ui/symbol-names/basic.legacy.stderr index fe490a600..c1cbefac8 100644 --- a/tests/ui/symbol-names/basic.legacy.stderr +++ b/tests/ui/symbol-names/basic.legacy.stderr @@ -1,10 +1,10 @@ -error: symbol-name(_ZN5basic4main17he9f658e438f1cac0E) +error: symbol-name(_ZN5basic4main17h6fc0c8d27b1a289fE) --> $DIR/basic.rs:8:1 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(basic::main::he9f658e438f1cac0) +error: demangling(basic::main::h6fc0c8d27b1a289f) --> $DIR/basic.rs:8:1 | LL | #[rustc_symbol_name] diff --git a/tests/ui/symbol-names/basic.v0.stderr b/tests/ui/symbol-names/basic.v0.stderr index 1f0278136..17c6d0ce7 100644 --- a/tests/ui/symbol-names/basic.v0.stderr +++ b/tests/ui/symbol-names/basic.v0.stderr @@ -4,7 +4,7 @@ error: symbol-name(_RNvCsCRATE_HASH_5basic4main) LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(basic[b751b4a00e2291d9]::main) +error: demangling(basic[a90d658f4748b9d1]::main) --> $DIR/basic.rs:8:1 | LL | #[rustc_symbol_name] diff --git a/tests/ui/symbol-names/foreign-types.stderr b/tests/ui/symbol-names/foreign-types.stderr index d6ee388dd..9c8633742 100644 --- a/tests/ui/symbol-names/foreign-types.stderr +++ b/tests/ui/symbol-names/foreign-types.stderr @@ -4,7 +4,7 @@ error: symbol-name(_RMCsCRATE_HASH_13foreign_typesINtB_5CheckNvB_11For LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(>) +error: demangling(>) --> $DIR/foreign-types.rs:13:1 | LL | #[rustc_symbol_name] diff --git a/tests/ui/symbol-names/impl1.v0.stderr b/tests/ui/symbol-names/impl1.v0.stderr index 33caad71f..a7cc5fc8e 100644 --- a/tests/ui/symbol-names/impl1.v0.stderr +++ b/tests/ui/symbol-names/impl1.v0.stderr @@ -4,7 +4,7 @@ error: symbol-name(_RNvMNtCsCRATE_HASH_5impl13fooNtB_3Foo3bar) LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(::bar) +error: demangling(::bar) --> $DIR/impl1.rs:14:9 | LL | #[rustc_symbol_name] @@ -28,7 +28,7 @@ error: symbol-name(_RNvMNtCsCRATE_HASH_5impl13barNtNtB_3foo3Foo3baz) LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(::baz) +error: demangling(::baz) --> $DIR/impl1.rs:32:9 | LL | #[rustc_symbol_name] @@ -52,7 +52,7 @@ error: symbol-name(_RNvXNCNvCsCRATE_HASH_5impl14mains_0ARDNtB_3Foop5AssocFG LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(<[&dyn impl1[2c09c4f1c7c8e90c]::Foo extern "C" fn(&'a u8, ...)> + impl1[2c09c4f1c7c8e90c]::AutoTrait; 3usize] as impl1[2c09c4f1c7c8e90c]::main::{closure#1}::Bar>::method) +error: demangling(<[&dyn impl1[d5591eb39db23cbb]::Foo extern "C" fn(&'a u8, ...)> + impl1[d5591eb39db23cbb]::AutoTrait; 3usize] as impl1[d5591eb39db23cbb]::main::{closure#1}::Bar>::method) --> $DIR/impl1.rs:62:13 | LL | #[rustc_symbol_name] diff --git a/tests/ui/symbol-names/issue-60925.legacy.stderr b/tests/ui/symbol-names/issue-60925.legacy.stderr index 29b42f48d..7dd68e6e3 100644 --- a/tests/ui/symbol-names/issue-60925.legacy.stderr +++ b/tests/ui/symbol-names/issue-60925.legacy.stderr @@ -1,10 +1,10 @@ -error: symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17h13209029be24b923E) +error: symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17hab58a402db4ebf3aE) --> $DIR/issue-60925.rs:21:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(issue_60925::foo::Foo::foo::h13209029be24b923) +error: demangling(issue_60925::foo::Foo::foo::hab58a402db4ebf3a) --> $DIR/issue-60925.rs:21:9 | LL | #[rustc_symbol_name] diff --git a/tests/ui/symbol-names/issue-60925.v0.stderr b/tests/ui/symbol-names/issue-60925.v0.stderr index 408c957c6..77449becc 100644 --- a/tests/ui/symbol-names/issue-60925.v0.stderr +++ b/tests/ui/symbol-names/issue-60925.v0.stderr @@ -4,7 +4,7 @@ error: symbol-name(_RNvMNtCsCRATE_HASH_11issue_609253fooINtB_3FooNtNtB LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(>::foo) +error: demangling(>::foo) --> $DIR/issue-60925.rs:21:9 | LL | #[rustc_symbol_name] diff --git a/tests/ui/symbol-names/issue-75326.v0.stderr b/tests/ui/symbol-names/issue-75326.v0.stderr index 3d7803a0c..fb742f5e4 100644 --- a/tests/ui/symbol-names/issue-75326.v0.stderr +++ b/tests/ui/symbol-names/issue-75326.v0.stderr @@ -4,7 +4,7 @@ error: symbol-name(_RNvXINICsCRATE_HASH_11issue_75326s_0pppEINtB_3FooppENtB LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling( as issue_75326[e8e253d78520f2a2]::Iterator2>::next) +error: demangling( as issue_75326[189ebc60e18860d7]::Iterator2>::next) --> $DIR/issue-75326.rs:41:5 | LL | #[rustc_symbol_name] diff --git a/tests/ui/symbol-names/trait-objects.v0.stderr b/tests/ui/symbol-names/trait-objects.v0.stderr index 47192ce5b..84f2bce66 100644 --- a/tests/ui/symbol-names/trait-objects.v0.stderr +++ b/tests/ui/symbol-names/trait-objects.v0.stderr @@ -4,7 +4,7 @@ error: symbol-name(_RNvXCsCRATE_HASH_13trait_objectsRDG_INtNtNtCsCRATE_HASH_4cor LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(<&dyn for<'a> core[HASH]::ops::function::FnMut<(&'a u8,), Output = ()> as trait_objects[7260a56bea9f357b]::Bar>::method) +error: demangling(<&dyn for<'a> core[HASH]::ops::function::FnMut<(&'a u8,), Output = ()> as trait_objects[3c073c57f94bedc2]::Bar>::method) --> $DIR/trait-objects.rs:15:5 | LL | #[rustc_symbol_name] @@ -22,7 +22,7 @@ error: symbol-name(_RNvXs_CsCRATE_HASH_13trait_objectsRDG_INtNtNtCsCRATE_HASH_4c LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(<&dyn for<'a> core[HASH]::ops::function::FnMut<(&'a u8,), Output = ()> + core[HASH]::marker::Send as trait_objects[7260a56bea9f357b]::Foo>::method) +error: demangling(<&dyn for<'a> core[HASH]::ops::function::FnMut<(&'a u8,), Output = ()> + core[HASH]::marker::Send as trait_objects[3c073c57f94bedc2]::Foo>::method) --> $DIR/trait-objects.rs:27:5 | LL | #[rustc_symbol_name] @@ -40,7 +40,7 @@ error: symbol-name(_RNvXs0_CsCRATE_HASH_13trait_objectsRDG_INtNtNtCsCRATE_HASH_4 LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(<&dyn for<'a> core[HASH]::ops::function::FnMut<(&'a u8,), Output = ()> + core[HASH]::marker::Send as trait_objects[7260a56bea9f357b]::Baz>::method) +error: demangling(<&dyn for<'a> core[HASH]::ops::function::FnMut<(&'a u8,), Output = ()> + core[HASH]::marker::Send as trait_objects[3c073c57f94bedc2]::Baz>::method) --> $DIR/trait-objects.rs:39:5 | LL | #[rustc_symbol_name] diff --git a/tests/ui/symbol-names/x86-stdcall.rs b/tests/ui/symbol-names/x86-stdcall.rs index 9948488c0..43c086dc6 100644 --- a/tests/ui/symbol-names/x86-stdcall.rs +++ b/tests/ui/symbol-names/x86-stdcall.rs @@ -1,5 +1,7 @@ // build-pass -// only-x86-windows +// only-x86 +// only-windows +// ignore-gnu - vectorcall is not supported by GCC: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89485 #![crate_type = "cdylib"] #![feature(abi_vectorcall)] diff --git a/tests/ui/sync/suggest-once-cell.rs b/tests/ui/sync/suggest-once-cell.rs index 82fca45b1..14f40ad87 100644 --- a/tests/ui/sync/suggest-once-cell.rs +++ b/tests/ui/sync/suggest-once-cell.rs @@ -1,5 +1,3 @@ -#![feature(once_cell)] - fn require_sync() {} //~^ NOTE required by this bound in `require_sync` //~| NOTE required by a bound in `require_sync` diff --git a/tests/ui/sync/suggest-once-cell.stderr b/tests/ui/sync/suggest-once-cell.stderr index fadf05374..20242f4b6 100644 --- a/tests/ui/sync/suggest-once-cell.stderr +++ b/tests/ui/sync/suggest-once-cell.stderr @@ -1,5 +1,5 @@ error[E0277]: `OnceCell<()>` cannot be shared between threads safely - --> $DIR/suggest-once-cell.rs:8:20 + --> $DIR/suggest-once-cell.rs:6:20 | LL | require_sync::>(); | ^^^^^^^^^^^^^^^^^^^^^^^ `OnceCell<()>` cannot be shared between threads safely @@ -7,7 +7,7 @@ LL | require_sync::>(); = help: the trait `Sync` is not implemented for `OnceCell<()>` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::OnceLock` instead note: required by a bound in `require_sync` - --> $DIR/suggest-once-cell.rs:3:20 + --> $DIR/suggest-once-cell.rs:1:20 | LL | fn require_sync() {} | ^^^^ required by this bound in `require_sync` diff --git a/tests/ui/sync/suggest-ref-cell.rs b/tests/ui/sync/suggest-ref-cell.rs index 6b972ae09..093a4999c 100644 --- a/tests/ui/sync/suggest-ref-cell.rs +++ b/tests/ui/sync/suggest-ref-cell.rs @@ -1,5 +1,3 @@ -#![feature(once_cell)] - fn require_sync() {} //~^ NOTE required by this bound in `require_sync` //~| NOTE required by a bound in `require_sync` diff --git a/tests/ui/sync/suggest-ref-cell.stderr b/tests/ui/sync/suggest-ref-cell.stderr index 9e8b8fcb4..ca3ae77b1 100644 --- a/tests/ui/sync/suggest-ref-cell.stderr +++ b/tests/ui/sync/suggest-ref-cell.stderr @@ -1,5 +1,5 @@ error[E0277]: `RefCell<()>` cannot be shared between threads safely - --> $DIR/suggest-ref-cell.rs:8:20 + --> $DIR/suggest-ref-cell.rs:6:20 | LL | require_sync::>(); | ^^^^^^^^^^^^^^^^^^^^^^ `RefCell<()>` cannot be shared between threads safely @@ -7,7 +7,7 @@ LL | require_sync::>(); = help: the trait `Sync` is not implemented for `RefCell<()>` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead note: required by a bound in `require_sync` - --> $DIR/suggest-ref-cell.rs:3:20 + --> $DIR/suggest-ref-cell.rs:1:20 | LL | fn require_sync() {} | ^^^^ required by this bound in `require_sync` diff --git a/tests/ui/tag-that-dare-not-speak-its-name.rs b/tests/ui/tag-that-dare-not-speak-its-name.rs deleted file mode 100644 index 0e76ec246..000000000 --- a/tests/ui/tag-that-dare-not-speak-its-name.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Issue #876 - -use std::vec::Vec; - -fn last(v: Vec<&T> ) -> std::option::Option { - ::std::panic!(); -} - -fn main() { - let y; - let x : char = last(y); - //~^ ERROR mismatched types - //~| expected type `char` - //~| found enum `Option<_>` - //~| expected `char`, found `Option<_>` -} diff --git a/tests/ui/tag-that-dare-not-speak-its-name.stderr b/tests/ui/tag-that-dare-not-speak-its-name.stderr deleted file mode 100644 index f53abe53b..000000000 --- a/tests/ui/tag-that-dare-not-speak-its-name.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/tag-that-dare-not-speak-its-name.rs:11:20 - | -LL | let x : char = last(y); - | ---- ^^^^^^^ expected `char`, found `Option<_>` - | | - | expected due to this - | - = note: expected type `char` - found enum `Option<_>` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/target-feature/gate.rs b/tests/ui/target-feature/gate.rs index 2382c98f8..2eea087c7 100644 --- a/tests/ui/target-feature/gate.rs +++ b/tests/ui/target-feature/gate.rs @@ -6,7 +6,6 @@ // ignore-mips64 // ignore-powerpc // ignore-powerpc64 -// ignore-powerpc64le // ignore-riscv64 // ignore-sparc // ignore-sparc64 diff --git a/tests/ui/target-feature/gate.stderr b/tests/ui/target-feature/gate.stderr index ee542b60a..2d6abcc0a 100644 --- a/tests/ui/target-feature/gate.stderr +++ b/tests/ui/target-feature/gate.stderr @@ -1,5 +1,5 @@ error[E0658]: the target feature `avx512bw` is currently unstable - --> $DIR/gate.rs:32:18 + --> $DIR/gate.rs:31:18 | LL | #[target_feature(enable = "avx512bw")] | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/target-feature/invalid-attribute.rs b/tests/ui/target-feature/invalid-attribute.rs index ad1b6e96b..b59ed076f 100644 --- a/tests/ui/target-feature/invalid-attribute.rs +++ b/tests/ui/target-feature/invalid-attribute.rs @@ -6,7 +6,6 @@ // ignore-mips64 // ignore-powerpc // ignore-powerpc64 -// ignore-powerpc64le // ignore-riscv64 // ignore-s390x // ignore-sparc @@ -14,6 +13,21 @@ #![warn(unused_attributes)] +#[target_feature(enable = "sse2")] +//~^ ERROR attribute should be applied to a function +extern crate alloc; +//~^ NOTE not a function + +#[target_feature(enable = "sse2")] +//~^ ERROR attribute should be applied to a function +use alloc::alloc::alloc; +//~^ NOTE not a function + +#[target_feature(enable = "sse2")] +//~^ ERROR attribute should be applied to a function +extern "Rust" {} +//~^ NOTE not a function + #[target_feature = "+sse2"] //~^ ERROR malformed `target_feature` attribute #[target_feature(enable = "foo")] @@ -59,6 +73,11 @@ union Qux { f2: u16, } +#[target_feature(enable = "sse2")] +//~^ ERROR attribute should be applied to a function +type Uwu = (); +//~^ NOTE not a function + #[target_feature(enable = "sse2")] //~^ ERROR attribute should be applied to a function trait Baz {} @@ -69,6 +88,21 @@ trait Baz {} #[target_feature(enable = "sse2")] unsafe fn test() {} +#[target_feature(enable = "sse2")] +//~^ ERROR attribute should be applied to a function +static A: () = (); +//~^ NOTE not a function + +#[target_feature(enable = "sse2")] +//~^ ERROR attribute should be applied to a function +impl Quux for u8 {} +//~^ NOTE not a function + +#[target_feature(enable = "sse2")] +//~^ ERROR attribute should be applied to a function +impl Foo {} +//~^ NOTE not a function + trait Quux { fn foo(); } diff --git a/tests/ui/target-feature/invalid-attribute.stderr b/tests/ui/target-feature/invalid-attribute.stderr index a2adfc67f..c36392d43 100644 --- a/tests/ui/target-feature/invalid-attribute.stderr +++ b/tests/ui/target-feature/invalid-attribute.stderr @@ -1,11 +1,38 @@ error: malformed `target_feature` attribute input - --> $DIR/invalid-attribute.rs:17:1 + --> $DIR/invalid-attribute.rs:31:1 | LL | #[target_feature = "+sse2"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[target_feature(enable = "name")]` error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:34:1 + --> $DIR/invalid-attribute.rs:16:1 + | +LL | #[target_feature(enable = "sse2")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | extern crate alloc; + | ------------------- not a function definition + +error: attribute should be applied to a function definition + --> $DIR/invalid-attribute.rs:21:1 + | +LL | #[target_feature(enable = "sse2")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | use alloc::alloc::alloc; + | ------------------------ not a function definition + +error: attribute should be applied to a function definition + --> $DIR/invalid-attribute.rs:26:1 + | +LL | #[target_feature(enable = "sse2")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | extern "Rust" {} + | ---------------- not a function definition + +error: attribute should be applied to a function definition + --> $DIR/invalid-attribute.rs:48:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -14,7 +41,7 @@ LL | mod another {} | -------------- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:39:1 + --> $DIR/invalid-attribute.rs:53:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +50,7 @@ LL | const FOO: usize = 7; | --------------------- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:44:1 + --> $DIR/invalid-attribute.rs:58:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -32,7 +59,7 @@ LL | struct Foo; | ----------- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:49:1 + --> $DIR/invalid-attribute.rs:63:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -41,7 +68,7 @@ LL | enum Bar {} | ----------- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:54:1 + --> $DIR/invalid-attribute.rs:68:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -54,7 +81,16 @@ LL | | } | |_- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:62:1 + --> $DIR/invalid-attribute.rs:76:1 + | +LL | #[target_feature(enable = "sse2")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | type Uwu = (); + | -------------- not a function definition + +error: attribute should be applied to a function definition + --> $DIR/invalid-attribute.rs:81:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -63,7 +99,34 @@ LL | trait Baz {} | ------------ not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:85:5 + --> $DIR/invalid-attribute.rs:91:1 + | +LL | #[target_feature(enable = "sse2")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | static A: () = (); + | ------------------ not a function definition + +error: attribute should be applied to a function definition + --> $DIR/invalid-attribute.rs:96:1 + | +LL | #[target_feature(enable = "sse2")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | impl Quux for u8 {} + | ------------------- not a function definition + +error: attribute should be applied to a function definition + --> $DIR/invalid-attribute.rs:101:1 + | +LL | #[target_feature(enable = "sse2")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | impl Foo {} + | ----------- not a function definition + +error: attribute should be applied to a function definition + --> $DIR/invalid-attribute.rs:119:5 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -75,7 +138,7 @@ LL | | } | |_____- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:93:5 + --> $DIR/invalid-attribute.rs:127:5 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -84,25 +147,25 @@ LL | || {}; | ----- not a function definition error: the feature named `foo` is not valid for this target - --> $DIR/invalid-attribute.rs:19:18 + --> $DIR/invalid-attribute.rs:33:18 | LL | #[target_feature(enable = "foo")] | ^^^^^^^^^^^^^^ `foo` is not valid for this target error: malformed `target_feature` attribute input - --> $DIR/invalid-attribute.rs:22:18 + --> $DIR/invalid-attribute.rs:36:18 | LL | #[target_feature(bar)] | ^^^ help: must be of the form: `enable = ".."` error: malformed `target_feature` attribute input - --> $DIR/invalid-attribute.rs:24:18 + --> $DIR/invalid-attribute.rs:38:18 | LL | #[target_feature(disable = "baz")] | ^^^^^^^^^^^^^^^ help: must be of the form: `enable = ".."` error[E0658]: `#[target_feature(..)]` can only be applied to `unsafe` functions - --> $DIR/invalid-attribute.rs:28:1 + --> $DIR/invalid-attribute.rs:42:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -114,13 +177,13 @@ LL | fn bar() {} = help: add `#![feature(target_feature_11)]` to the crate attributes to enable error: cannot use `#[inline(always)]` with `#[target_feature]` - --> $DIR/invalid-attribute.rs:67:1 + --> $DIR/invalid-attribute.rs:86:1 | LL | #[inline(always)] | ^^^^^^^^^^^^^^^^^ error[E0658]: `#[target_feature(..)]` can only be applied to `unsafe` functions - --> $DIR/invalid-attribute.rs:77:5 + --> $DIR/invalid-attribute.rs:111:5 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -131,6 +194,6 @@ LL | fn foo() {} = note: see issue #69098 for more information = help: add `#![feature(target_feature_11)]` to the crate attributes to enable -error: aborting due to 15 previous errors +error: aborting due to 22 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/terr-in-field.rs b/tests/ui/terr-in-field.rs deleted file mode 100644 index cfe350ef8..000000000 --- a/tests/ui/terr-in-field.rs +++ /dev/null @@ -1,17 +0,0 @@ -struct Foo { - a: isize, - b: isize, -} - -struct Bar { - a: isize, - b: usize, -} - -fn want_foo(f: Foo) {} -fn have_bar(b: Bar) { - want_foo(b); //~ ERROR mismatched types - //~| expected `Foo`, found `Bar` -} - -fn main() {} diff --git a/tests/ui/terr-in-field.stderr b/tests/ui/terr-in-field.stderr deleted file mode 100644 index 09df4b34b..000000000 --- a/tests/ui/terr-in-field.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/terr-in-field.rs:13:14 - | -LL | want_foo(b); - | -------- ^ expected `Foo`, found `Bar` - | | - | arguments to this function are incorrect - | -note: function defined here - --> $DIR/terr-in-field.rs:11:4 - | -LL | fn want_foo(f: Foo) {} - | ^^^^^^^^ ------ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/terr-sorts.rs b/tests/ui/terr-sorts.rs deleted file mode 100644 index c1e2f7dae..000000000 --- a/tests/ui/terr-sorts.rs +++ /dev/null @@ -1,15 +0,0 @@ -struct Foo { - a: isize, - b: isize, -} - -type Bar = Box; - -fn want_foo(f: Foo) {} -fn have_bar(b: Bar) { - want_foo(b); //~ ERROR mismatched types - //~| expected struct `Foo` - //~| found struct `Box` -} - -fn main() {} diff --git a/tests/ui/terr-sorts.stderr b/tests/ui/terr-sorts.stderr deleted file mode 100644 index 8f1975374..000000000 --- a/tests/ui/terr-sorts.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/terr-sorts.rs:10:14 - | -LL | want_foo(b); - | -------- ^ expected `Foo`, found `Box` - | | - | arguments to this function are incorrect - | - = note: expected struct `Foo` - found struct `Box` -note: function defined here - --> $DIR/terr-sorts.rs:8:4 - | -LL | fn want_foo(f: Foo) {} - | ^^^^^^^^ ------ -help: consider unboxing the value - | -LL | want_foo(*b); - | + - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/test-attrs/custom-test-frameworks/issue-107454.rs b/tests/ui/test-attrs/custom-test-frameworks/issue-107454.rs new file mode 100644 index 000000000..2bb133e8b --- /dev/null +++ b/tests/ui/test-attrs/custom-test-frameworks/issue-107454.rs @@ -0,0 +1,10 @@ +// compile-flags: --test + +#![feature(custom_test_frameworks)] +#![deny(unnameable_test_items)] + +fn foo() { + #[test_case] + //~^ ERROR cannot test inner items [unnameable_test_items] + fn test2() {} +} diff --git a/tests/ui/test-attrs/custom-test-frameworks/issue-107454.stderr b/tests/ui/test-attrs/custom-test-frameworks/issue-107454.stderr new file mode 100644 index 000000000..bd604afb7 --- /dev/null +++ b/tests/ui/test-attrs/custom-test-frameworks/issue-107454.stderr @@ -0,0 +1,15 @@ +error: cannot test inner items + --> $DIR/issue-107454.rs:7:5 + | +LL | #[test_case] + | ^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/issue-107454.rs:4:9 + | +LL | #![deny(unnameable_test_items)] + | ^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the attribute macro `test_case` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + diff --git a/tests/ui/test-attrs/issue-109816.rs b/tests/ui/test-attrs/issue-109816.rs new file mode 100644 index 000000000..21fe5bc53 --- /dev/null +++ b/tests/ui/test-attrs/issue-109816.rs @@ -0,0 +1,7 @@ +// compile-flags: --test + +fn align_offset_weird_strides() { + #[test] + //~^ ERROR the `#[test]` attribute may only be used on a non-associated function + struct A5(u32, u8); +} diff --git a/tests/ui/test-attrs/issue-109816.stderr b/tests/ui/test-attrs/issue-109816.stderr new file mode 100644 index 000000000..e69932875 --- /dev/null +++ b/tests/ui/test-attrs/issue-109816.stderr @@ -0,0 +1,16 @@ +error: the `#[test]` attribute may only be used on a non-associated function + --> $DIR/issue-109816.rs:4:5 + | +LL | #[test] + | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions +LL | +LL | struct A5(u32, u8); + | ------------------- expected a non-associated function, found a struct + | +help: replace with conditional compilation to make the item only exist when tests are being run + | +LL | #[cfg(test)] + | + +error: aborting due to previous error + diff --git a/tests/ui/test-attrs/test-attr-non-associated-functions.rs b/tests/ui/test-attrs/test-attr-non-associated-functions.rs index 31e567c39..2481919b6 100644 --- a/tests/ui/test-attrs/test-attr-non-associated-functions.rs +++ b/tests/ui/test-attrs/test-attr-non-associated-functions.rs @@ -1,18 +1,16 @@ -// #[test] attribute is not allowed on associated functions or methods -// reworded error message // compile-flags:--test struct A {} impl A { #[test] + //~^ ERROR the `#[test]` attribute may only be used on a non-associated function fn new() -> A { - //~^ ERROR `#[test]` attribute is only allowed on non associated functions A {} } #[test] + //~^ ERROR the `#[test]` attribute may only be used on a non-associated function fn recovery_witness() -> A { - //~^ ERROR `#[test]` attribute is only allowed on non associated functions A {} } } diff --git a/tests/ui/test-attrs/test-attr-non-associated-functions.stderr b/tests/ui/test-attrs/test-attr-non-associated-functions.stderr index a81b8f398..3e3a951af 100644 --- a/tests/ui/test-attrs/test-attr-non-associated-functions.stderr +++ b/tests/ui/test-attrs/test-attr-non-associated-functions.stderr @@ -1,20 +1,24 @@ -error: `#[test]` attribute is only allowed on non associated functions - --> $DIR/test-attr-non-associated-functions.rs:9:5 - | -LL | / fn new() -> A { -LL | | -LL | | A {} -LL | | } - | |_____^ +error: the `#[test]` attribute may only be used on a non-associated function + --> $DIR/test-attr-non-associated-functions.rs:6:5 + | +LL | #[test] + | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions + | +help: replace with conditional compilation to make the item only exist when tests are being run + | +LL | #[cfg(test)] + | -error: `#[test]` attribute is only allowed on non associated functions - --> $DIR/test-attr-non-associated-functions.rs:14:5 - | -LL | / fn recovery_witness() -> A { -LL | | -LL | | A {} -LL | | } - | |_____^ +error: the `#[test]` attribute may only be used on a non-associated function + --> $DIR/test-attr-non-associated-functions.rs:11:5 + | +LL | #[test] + | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions + | +help: replace with conditional compilation to make the item only exist when tests are being run + | +LL | #[cfg(test)] + | error: aborting due to 2 previous errors diff --git a/tests/ui/test-attrs/test-on-not-fn.stderr b/tests/ui/test-attrs/test-on-not-fn.stderr index fc2c5f62b..7a9913fbc 100644 --- a/tests/ui/test-attrs/test-on-not-fn.stderr +++ b/tests/ui/test-attrs/test-on-not-fn.stderr @@ -2,7 +2,7 @@ error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:3:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions LL | mod test {} | ----------- expected a non-associated function, found a module | @@ -15,7 +15,7 @@ error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:6:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions LL | / mod loooooooooooooong_teeeeeeeeeest { LL | | /* LL | | this is a comment @@ -34,7 +34,7 @@ error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:20:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions LL | extern "C" {} | ------------- expected a non-associated function, found an extern block | @@ -47,7 +47,7 @@ error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:23:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions LL | trait Foo {} | ------------ expected a non-associated function, found a trait | @@ -60,7 +60,7 @@ error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:26:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions LL | impl Foo for i32 {} | ------------------- expected a non-associated function, found an implementation | @@ -73,7 +73,7 @@ error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:29:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions LL | const FOO: i32 = -1_i32; | ------------------------ expected a non-associated function, found a constant item | @@ -86,7 +86,7 @@ error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:32:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions LL | static BAR: u64 = 10_000_u64; | ----------------------------- expected a non-associated function, found a static item | @@ -99,7 +99,7 @@ error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:35:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions LL | / enum MyUnit { LL | | Unit, LL | | } @@ -114,7 +114,7 @@ error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:40:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions LL | struct NewI32(i32); | ------------------- expected a non-associated function, found a struct | @@ -127,7 +127,7 @@ error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:43:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions LL | / union Spooky { LL | | x: i32, LL | | y: u32, @@ -143,7 +143,7 @@ error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:50:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions LL | #[derive(Copy, Clone, Debug)] LL | / struct MoreAttrs { LL | | a: i32, @@ -160,7 +160,7 @@ warning: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:61:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions LL | foo!(); | ------- expected a non-associated function, found an item macro invocation | diff --git a/tests/ui/test-attrs/tests-listing-format-default.rs b/tests/ui/test-attrs/tests-listing-format-default.rs new file mode 100644 index 000000000..d5df4b57b --- /dev/null +++ b/tests/ui/test-attrs/tests-listing-format-default.rs @@ -0,0 +1,18 @@ +// no-prefer-dynamic +// compile-flags: --test +// run-flags: --list +// run-pass +// check-run-results + +// Checks the listing of tests with no --format arguments. + +#![cfg(test)] +#[test] +fn m_test() {} + +#[test] +#[ignore = "not yet implemented"] +fn z_test() {} + +#[test] +fn a_test() {} diff --git a/tests/ui/test-attrs/tests-listing-format-default.run.stdout b/tests/ui/test-attrs/tests-listing-format-default.run.stdout new file mode 100644 index 000000000..72337daf0 --- /dev/null +++ b/tests/ui/test-attrs/tests-listing-format-default.run.stdout @@ -0,0 +1,5 @@ +a_test: test +m_test: test +z_test: test + +3 tests, 0 benchmarks diff --git a/tests/ui/test-attrs/tests-listing-format-json-without-unstableopts.rs b/tests/ui/test-attrs/tests-listing-format-json-without-unstableopts.rs new file mode 100644 index 000000000..5247f1f8f --- /dev/null +++ b/tests/ui/test-attrs/tests-listing-format-json-without-unstableopts.rs @@ -0,0 +1,18 @@ +// no-prefer-dynamic +// compile-flags: --test +// run-flags: --list --format json +// run-fail +// check-run-results + +// Checks that --format json does not work without -Zunstable-options. + +#![cfg(test)] +#[test] +fn m_test() {} + +#[test] +#[ignore = "not yet implemented"] +fn z_test() {} + +#[test] +fn a_test() {} diff --git a/tests/ui/test-attrs/tests-listing-format-json-without-unstableopts.run.stderr b/tests/ui/test-attrs/tests-listing-format-json-without-unstableopts.run.stderr new file mode 100644 index 000000000..9f6276300 --- /dev/null +++ b/tests/ui/test-attrs/tests-listing-format-json-without-unstableopts.run.stderr @@ -0,0 +1 @@ +error: The "json" format is only accepted on the nightly compiler diff --git a/tests/ui/test-attrs/tests-listing-format-json.rs b/tests/ui/test-attrs/tests-listing-format-json.rs new file mode 100644 index 000000000..5afc2746f --- /dev/null +++ b/tests/ui/test-attrs/tests-listing-format-json.rs @@ -0,0 +1,21 @@ +// no-prefer-dynamic +// compile-flags: --test +// run-flags: --list --format json -Zunstable-options +// run-pass +// check-run-results +// only-nightly +// normalize-stdout-test: "fake-test-src-base/test-attrs/" -> "$$DIR/" +// normalize-stdout-test: "fake-test-src-base\\test-attrs\\" -> "$$DIR/" + +// Checks the listing of tests with --format json. + +#![cfg(test)] +#[test] +fn m_test() {} + +#[test] +#[ignore = "not yet implemented"] +fn z_test() {} + +#[test] +fn a_test() {} diff --git a/tests/ui/test-attrs/tests-listing-format-json.run.stdout b/tests/ui/test-attrs/tests-listing-format-json.run.stdout new file mode 100644 index 000000000..b4131e97c --- /dev/null +++ b/tests/ui/test-attrs/tests-listing-format-json.run.stdout @@ -0,0 +1,5 @@ +{ "type": "suite", "event": "discovery" } +{ "type": "test", "event": "discovered", "name": "a_test", "ignore": false, "ignore_message": "", "source_path": "$DIR/tests-listing-format-json.rs", "start_line": 20, "start_col": 4, "end_line": 20, "end_col": 10 } +{ "type": "test", "event": "discovered", "name": "m_test", "ignore": false, "ignore_message": "", "source_path": "$DIR/tests-listing-format-json.rs", "start_line": 13, "start_col": 4, "end_line": 13, "end_col": 10 } +{ "type": "test", "event": "discovered", "name": "z_test", "ignore": true, "ignore_message": "not yet implemented", "source_path": "$DIR/tests-listing-format-json.rs", "start_line": 17, "start_col": 4, "end_line": 17, "end_col": 10 } +{ "type": "suite", "event": "completed", "tests": 3, "benchmarks": 0, "total": 3, "ignored": 1 } diff --git a/tests/ui/test-attrs/tests-listing-format-terse.rs b/tests/ui/test-attrs/tests-listing-format-terse.rs new file mode 100644 index 000000000..7835f7175 --- /dev/null +++ b/tests/ui/test-attrs/tests-listing-format-terse.rs @@ -0,0 +1,18 @@ +// no-prefer-dynamic +// compile-flags: --test +// run-flags: --list --format terse +// run-pass +// check-run-results + +// Checks the listing of tests with --format terse. + +#![cfg(test)] +#[test] +fn m_test() {} + +#[test] +#[ignore = "not yet implemented"] +fn z_test() {} + +#[test] +fn a_test() {} diff --git a/tests/ui/test-attrs/tests-listing-format-terse.run.stdout b/tests/ui/test-attrs/tests-listing-format-terse.run.stdout new file mode 100644 index 000000000..22afe104b --- /dev/null +++ b/tests/ui/test-attrs/tests-listing-format-terse.run.stdout @@ -0,0 +1,3 @@ +a_test: test +m_test: test +z_test: test diff --git a/tests/ui/thir-print/thir-flat.stdout b/tests/ui/thir-print/thir-flat.stdout index 910c0da27..9d467f73d 100644 --- a/tests/ui/thir-print/thir-flat.stdout +++ b/tests/ui/thir-print/thir-flat.stdout @@ -1,4 +1,4 @@ -DefId(0:3 ~ thir_flat[45a6]::main): +DefId(0:3 ~ thir_flat[7b97]::main): Thir { body_type: Fn( ([]; c_variadic: false)->(), @@ -30,7 +30,7 @@ Thir { kind: Scope { region_scope: Node(2), lint_level: Explicit( - HirId(DefId(0:3 ~ thir_flat[45a6]::main).2), + HirId(DefId(0:3 ~ thir_flat[7b97]::main).2), ), value: e0, }, diff --git a/tests/ui/thir-print/thir-tree-match.stdout b/tests/ui/thir-print/thir-tree-match.stdout index d6174ec26..eea04c095 100644 --- a/tests/ui/thir-print/thir-tree-match.stdout +++ b/tests/ui/thir-print/thir-tree-match.stdout @@ -1,10 +1,10 @@ -DefId(0:16 ~ thir_tree_match[3c9a]::has_match): +DefId(0:16 ~ thir_tree_match[fcf8]::has_match): params: [ Param { ty: Foo ty_span: Some($DIR/thir-tree-match.rs:15:19: 15:22 (#0)) self_kind: None - hir_id: Some(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).1)) + hir_id: Some(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).1)) param: Some( Pat: { ty: Foo @@ -14,7 +14,7 @@ params: [ mutability: Not name: "foo" mode: ByValue - var: LocalVarId(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).2)) + var: LocalVarId(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).2)) ty: Foo is_primary: true subpattern: None @@ -41,7 +41,7 @@ body: kind: Scope { region_scope: Node(26) - lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).26)) + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).26)) value: Expr { ty: bool @@ -63,7 +63,7 @@ body: kind: Scope { region_scope: Node(3) - lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).3)) + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).3)) value: Expr { ty: bool @@ -79,7 +79,7 @@ body: kind: Scope { region_scope: Node(4) - lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).4)) + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).4)) value: Expr { ty: Foo @@ -87,7 +87,7 @@ body: span: $DIR/thir-tree-match.rs:16:11: 16:14 (#0) kind: VarRef { - id: LocalVarId(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).2)) + id: LocalVarId(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).2)) } } } @@ -102,10 +102,10 @@ body: Variant { adt_def: AdtDef { - did: DefId(0:10 ~ thir_tree_match[3c9a]::Foo) - variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[3c9a]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[3c9a]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[3c9a]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[3c9a])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[3c9a]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[3c9a]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }] + did: DefId(0:10 ~ thir_tree_match[fcf8]::Foo) + variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }] flags: IS_ENUM - repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 11573694388057581 } + repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 3477539199540094892 } substs: [] variant_index: 0 subpatterns: [ @@ -116,10 +116,10 @@ body: Variant { adt_def: AdtDef { - did: DefId(0:3 ~ thir_tree_match[3c9a]::Bar) - variants: [VariantDef { def_id: DefId(0:4 ~ thir_tree_match[3c9a]::Bar::First), ctor: Some((Const, DefId(0:5 ~ thir_tree_match[3c9a]::Bar::First::{constructor#0}))), name: "First", discr: Relative(0), fields: [], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:6 ~ thir_tree_match[3c9a]::Bar::Second), ctor: Some((Const, DefId(0:7 ~ thir_tree_match[3c9a]::Bar::Second::{constructor#0}))), name: "Second", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:8 ~ thir_tree_match[3c9a]::Bar::Third), ctor: Some((Const, DefId(0:9 ~ thir_tree_match[3c9a]::Bar::Third::{constructor#0}))), name: "Third", discr: Relative(2), fields: [], flags: NO_VARIANT_FLAGS }] + did: DefId(0:3 ~ thir_tree_match[fcf8]::Bar) + variants: [VariantDef { def_id: DefId(0:4 ~ thir_tree_match[fcf8]::Bar::First), ctor: Some((Const, DefId(0:5 ~ thir_tree_match[fcf8]::Bar::First::{constructor#0}))), name: "First", discr: Relative(0), fields: [], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:6 ~ thir_tree_match[fcf8]::Bar::Second), ctor: Some((Const, DefId(0:7 ~ thir_tree_match[fcf8]::Bar::Second::{constructor#0}))), name: "Second", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:8 ~ thir_tree_match[fcf8]::Bar::Third), ctor: Some((Const, DefId(0:9 ~ thir_tree_match[fcf8]::Bar::Third::{constructor#0}))), name: "Third", discr: Relative(2), fields: [], flags: NO_VARIANT_FLAGS }] flags: IS_ENUM - repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 3125160937860410723 } + repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 10333377570083945360 } substs: [] variant_index: 0 subpatterns: [] @@ -148,7 +148,7 @@ body: kind: Scope { region_scope: Node(13) - lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).13)) + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).13)) value: Expr { ty: bool @@ -162,7 +162,7 @@ body: } } } - lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).12)) + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).12)) scope: Node(12) span: $DIR/thir-tree-match.rs:17:9: 17:40 (#0) } @@ -175,10 +175,10 @@ body: Variant { adt_def: AdtDef { - did: DefId(0:10 ~ thir_tree_match[3c9a]::Foo) - variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[3c9a]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[3c9a]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[3c9a]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[3c9a])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[3c9a]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[3c9a]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }] + did: DefId(0:10 ~ thir_tree_match[fcf8]::Foo) + variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }] flags: IS_ENUM - repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 11573694388057581 } + repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 3477539199540094892 } substs: [] variant_index: 0 subpatterns: [ @@ -211,7 +211,7 @@ body: kind: Scope { region_scope: Node(19) - lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).19)) + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).19)) value: Expr { ty: bool @@ -225,7 +225,7 @@ body: } } } - lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).18)) + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).18)) scope: Node(18) span: $DIR/thir-tree-match.rs:18:9: 18:32 (#0) } @@ -238,10 +238,10 @@ body: Variant { adt_def: AdtDef { - did: DefId(0:10 ~ thir_tree_match[3c9a]::Foo) - variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[3c9a]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[3c9a]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[3c9a]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[3c9a])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[3c9a]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[3c9a]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }] + did: DefId(0:10 ~ thir_tree_match[fcf8]::Foo) + variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }] flags: IS_ENUM - repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 11573694388057581 } + repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 3477539199540094892 } substs: [] variant_index: 1 subpatterns: [] @@ -266,7 +266,7 @@ body: kind: Scope { region_scope: Node(24) - lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).24)) + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).24)) value: Expr { ty: bool @@ -280,7 +280,7 @@ body: } } } - lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).23)) + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).23)) scope: Node(23) span: $DIR/thir-tree-match.rs:19:9: 19:28 (#0) } @@ -297,7 +297,7 @@ body: } -DefId(0:17 ~ thir_tree_match[3c9a]::main): +DefId(0:17 ~ thir_tree_match[fcf8]::main): params: [ ] body: @@ -317,7 +317,7 @@ body: kind: Scope { region_scope: Node(2) - lint_level: Explicit(HirId(DefId(0:17 ~ thir_tree_match[3c9a]::main).2)) + lint_level: Explicit(HirId(DefId(0:17 ~ thir_tree_match[fcf8]::main).2)) value: Expr { ty: () diff --git a/tests/ui/thir-print/thir-tree.stdout b/tests/ui/thir-print/thir-tree.stdout index 0a35d9fb7..1b478dbef 100644 --- a/tests/ui/thir-print/thir-tree.stdout +++ b/tests/ui/thir-print/thir-tree.stdout @@ -1,4 +1,4 @@ -DefId(0:3 ~ thir_tree[8f1d]::main): +DefId(0:3 ~ thir_tree[7aaa]::main): params: [ ] body: @@ -18,7 +18,7 @@ body: kind: Scope { region_scope: Node(2) - lint_level: Explicit(HirId(DefId(0:3 ~ thir_tree[8f1d]::main).2)) + lint_level: Explicit(HirId(DefId(0:3 ~ thir_tree[7aaa]::main).2)) value: Expr { ty: () diff --git a/tests/ui/thread-local-mutation.rs b/tests/ui/thread-local-mutation.rs deleted file mode 100644 index e738225ce..000000000 --- a/tests/ui/thread-local-mutation.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Regression test for #54901: immutable thread locals could be mutated. See: -// https://github.com/rust-lang/rust/issues/29594#issuecomment-328177697 -// https://github.com/rust-lang/rust/issues/54901 - -#![feature(thread_local)] - -#[thread_local] -static S: &str = "before"; - -fn set_s() { - S = "after"; //~ ERROR cannot assign to immutable -} - -fn main() { - println!("{}", S); - set_s(); - println!("{}", S); -} diff --git a/tests/ui/thread-local-mutation.stderr b/tests/ui/thread-local-mutation.stderr deleted file mode 100644 index e5dc0e72e..000000000 --- a/tests/ui/thread-local-mutation.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0594]: cannot assign to immutable static item `S` - --> $DIR/thread-local-mutation.rs:11:5 - | -LL | S = "after"; - | ^^^^^^^^^^^ cannot assign - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0594`. diff --git a/tests/ui/thread-local-static.rs b/tests/ui/thread-local-static.rs deleted file mode 100644 index c7fee9e6b..000000000 --- a/tests/ui/thread-local-static.rs +++ /dev/null @@ -1,16 +0,0 @@ -// edition:2018 - -#![feature(thread_local)] -#![feature(const_swap)] -#[thread_local] -static mut STATIC_VAR_2: [u32; 8] = [4; 8]; -const fn g(x: &mut [u32; 8]) { - //~^ ERROR mutable references are not allowed - std::mem::swap(x, &mut STATIC_VAR_2) - //~^ ERROR thread-local statics cannot be accessed - //~| ERROR mutable references are not allowed - //~| ERROR use of mutable static is unsafe - //~| constant functions cannot refer to statics -} - -fn main() {} diff --git a/tests/ui/thread-local-static.stderr b/tests/ui/thread-local-static.stderr deleted file mode 100644 index 712050a25..000000000 --- a/tests/ui/thread-local-static.stderr +++ /dev/null @@ -1,44 +0,0 @@ -error[E0658]: mutable references are not allowed in constant functions - --> $DIR/thread-local-static.rs:7:12 - | -LL | const fn g(x: &mut [u32; 8]) { - | ^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - -error[E0625]: thread-local statics cannot be accessed at compile-time - --> $DIR/thread-local-static.rs:9:28 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^ - -error[E0013]: constant functions cannot refer to statics - --> $DIR/thread-local-static.rs:9:28 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^ - | - = help: consider extracting the value of the `static` to a `const`, and referring to that - -error[E0658]: mutable references are not allowed in constant functions - --> $DIR/thread-local-static.rs:9:23 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/thread-local-static.rs:9:23 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^^^^^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error: aborting due to 5 previous errors - -Some errors have detailed explanations: E0013, E0133, E0625, E0658. -For more information about an error, try `rustc --explain E0013`. diff --git a/tests/ui/thread-local/auxiliary/tls-export.rs b/tests/ui/thread-local/auxiliary/tls-export.rs new file mode 100644 index 000000000..027213bc0 --- /dev/null +++ b/tests/ui/thread-local/auxiliary/tls-export.rs @@ -0,0 +1,17 @@ +#![crate_type = "dylib"] +#![feature(thread_local)] +#![feature(cfg_target_thread_local)] + +extern crate tls_rlib; + +pub use tls_rlib::*; + +#[cfg(target_thread_local)] +#[thread_local] +pub static FOO: bool = true; + +#[cfg(target_thread_local)] +#[inline(never)] +pub fn foo_addr() -> usize { + &FOO as *const bool as usize +} diff --git a/tests/ui/thread-local/auxiliary/tls-rlib.rs b/tests/ui/thread-local/auxiliary/tls-rlib.rs new file mode 100644 index 000000000..20bc998ec --- /dev/null +++ b/tests/ui/thread-local/auxiliary/tls-rlib.rs @@ -0,0 +1,15 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] +#![feature(thread_local)] +#![feature(cfg_target_thread_local)] + +#[cfg(target_thread_local)] +#[thread_local] +pub static BAR: bool = true; + +#[cfg(target_thread_local)] +#[inline(never)] +pub fn bar_addr() -> usize { + &BAR as *const bool as usize +} diff --git a/tests/ui/thread-local/thread-local-mutation.rs b/tests/ui/thread-local/thread-local-mutation.rs new file mode 100644 index 000000000..e738225ce --- /dev/null +++ b/tests/ui/thread-local/thread-local-mutation.rs @@ -0,0 +1,18 @@ +// Regression test for #54901: immutable thread locals could be mutated. See: +// https://github.com/rust-lang/rust/issues/29594#issuecomment-328177697 +// https://github.com/rust-lang/rust/issues/54901 + +#![feature(thread_local)] + +#[thread_local] +static S: &str = "before"; + +fn set_s() { + S = "after"; //~ ERROR cannot assign to immutable +} + +fn main() { + println!("{}", S); + set_s(); + println!("{}", S); +} diff --git a/tests/ui/thread-local/thread-local-mutation.stderr b/tests/ui/thread-local/thread-local-mutation.stderr new file mode 100644 index 000000000..e5dc0e72e --- /dev/null +++ b/tests/ui/thread-local/thread-local-mutation.stderr @@ -0,0 +1,9 @@ +error[E0594]: cannot assign to immutable static item `S` + --> $DIR/thread-local-mutation.rs:11:5 + | +LL | S = "after"; + | ^^^^^^^^^^^ cannot assign + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0594`. diff --git a/tests/ui/thread-local/thread-local-static.rs b/tests/ui/thread-local/thread-local-static.rs new file mode 100644 index 000000000..c7fee9e6b --- /dev/null +++ b/tests/ui/thread-local/thread-local-static.rs @@ -0,0 +1,16 @@ +// edition:2018 + +#![feature(thread_local)] +#![feature(const_swap)] +#[thread_local] +static mut STATIC_VAR_2: [u32; 8] = [4; 8]; +const fn g(x: &mut [u32; 8]) { + //~^ ERROR mutable references are not allowed + std::mem::swap(x, &mut STATIC_VAR_2) + //~^ ERROR thread-local statics cannot be accessed + //~| ERROR mutable references are not allowed + //~| ERROR use of mutable static is unsafe + //~| constant functions cannot refer to statics +} + +fn main() {} diff --git a/tests/ui/thread-local/thread-local-static.stderr b/tests/ui/thread-local/thread-local-static.stderr new file mode 100644 index 000000000..712050a25 --- /dev/null +++ b/tests/ui/thread-local/thread-local-static.stderr @@ -0,0 +1,44 @@ +error[E0658]: mutable references are not allowed in constant functions + --> $DIR/thread-local-static.rs:7:12 + | +LL | const fn g(x: &mut [u32; 8]) { + | ^ + | + = note: see issue #57349 for more information + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + +error[E0625]: thread-local statics cannot be accessed at compile-time + --> $DIR/thread-local-static.rs:9:28 + | +LL | std::mem::swap(x, &mut STATIC_VAR_2) + | ^^^^^^^^^^^^ + +error[E0013]: constant functions cannot refer to statics + --> $DIR/thread-local-static.rs:9:28 + | +LL | std::mem::swap(x, &mut STATIC_VAR_2) + | ^^^^^^^^^^^^ + | + = help: consider extracting the value of the `static` to a `const`, and referring to that + +error[E0658]: mutable references are not allowed in constant functions + --> $DIR/thread-local-static.rs:9:23 + | +LL | std::mem::swap(x, &mut STATIC_VAR_2) + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #57349 for more information + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + +error[E0133]: use of mutable static is unsafe and requires unsafe function or block + --> $DIR/thread-local-static.rs:9:23 + | +LL | std::mem::swap(x, &mut STATIC_VAR_2) + | ^^^^^^^^^^^^^^^^^ use of mutable static + | + = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior + +error: aborting due to 5 previous errors + +Some errors have detailed explanations: E0013, E0133, E0625, E0658. +For more information about an error, try `rustc --explain E0013`. diff --git a/tests/ui/thread-local/tls-dylib-access.rs b/tests/ui/thread-local/tls-dylib-access.rs new file mode 100644 index 000000000..12c46113c --- /dev/null +++ b/tests/ui/thread-local/tls-dylib-access.rs @@ -0,0 +1,19 @@ +// aux-build: tls-rlib.rs +// aux-build: tls-export.rs +// run-pass + +#![feature(cfg_target_thread_local)] + +#[cfg(target_thread_local)] +extern crate tls_export; + +fn main() { + #[cfg(target_thread_local)] + { + // Check that we get the real address of the `FOO` TLS in the dylib + assert_eq!(&tls_export::FOO as *const bool as usize, tls_export::foo_addr()); + + // Check that we get the real address of the `BAR` TLS in the rlib linked into the dylib + assert_eq!(&tls_export::BAR as *const bool as usize, tls_export::bar_addr()); + } +} diff --git a/tests/ui/threads-sendsync/issue-43733-2.rs b/tests/ui/threads-sendsync/issue-43733-2.rs index 32baeec43..8f7a9c083 100644 --- a/tests/ui/threads-sendsync/issue-43733-2.rs +++ b/tests/ui/threads-sendsync/issue-43733-2.rs @@ -21,7 +21,7 @@ impl Key { } #[cfg(target_thread_local)] -use std::thread::__FastLocalKeyInner as Key; +use std::thread::__LocalKeyInner as Key; static __KEY: Key<()> = Key::new(); //~^ ERROR `UnsafeCell>` cannot be shared between threads diff --git a/tests/ui/threads-sendsync/issue-43733.rs b/tests/ui/threads-sendsync/issue-43733.rs index 935e02944..0eadef3e3 100644 --- a/tests/ui/threads-sendsync/issue-43733.rs +++ b/tests/ui/threads-sendsync/issue-43733.rs @@ -1,8 +1,8 @@ // ignore-wasm32 // revisions: mir thir // [thir]compile-flags: -Z thir-unsafeck -// normalize-stderr-test: "__FastLocalKeyInner::::get" -> "$$LOCALKEYINNER::::get" -// normalize-stderr-test: "__OsLocalKeyInner::::get" -> "$$LOCALKEYINNER::::get" +// normalize-stderr-test: "__LocalKeyInner::::get" -> "$$LOCALKEYINNER::::get" +// normalize-stderr-test: "__LocalKeyInner::::get" -> "$$LOCALKEYINNER::::get" #![feature(thread_local)] #![feature(cfg_target_thread_local, thread_local_internals)] @@ -12,10 +12,10 @@ type Foo = std::cell::RefCell; #[cfg(target_thread_local)] #[thread_local] -static __KEY: std::thread::__FastLocalKeyInner = std::thread::__FastLocalKeyInner::new(); +static __KEY: std::thread::__LocalKeyInner = std::thread::__LocalKeyInner::new(); #[cfg(not(target_thread_local))] -static __KEY: std::thread::__OsLocalKeyInner = std::thread::__OsLocalKeyInner::new(); +static __KEY: std::thread::__LocalKeyInner = std::thread::__LocalKeyInner::new(); fn __getit(_: Option<&mut Option>>) -> std::option::Option<&'static Foo> { __KEY.get(Default::default) diff --git a/tests/ui/tool-attributes/tool-attributes-misplaced-2.stderr b/tests/ui/tool-attributes/tool-attributes-misplaced-2.stderr index 6d0f826e6..06696b548 100644 --- a/tests/ui/tool-attributes/tool-attributes-misplaced-2.stderr +++ b/tests/ui/tool-attributes/tool-attributes-misplaced-2.stderr @@ -3,6 +3,14 @@ error: expected derive macro, found tool attribute `rustfmt::skip` | LL | #[derive(rustfmt::skip)] | ^^^^^^^^^^^^^ not a derive macro + | +help: remove from the surrounding `derive()` + --> $DIR/tool-attributes-misplaced-2.rs:1:10 + | +LL | #[derive(rustfmt::skip)] + | ^^^^^^^^^^^^^ + = help: add as non-Derive macro + `#[rustfmt::skip]` error: expected macro, found tool attribute `rustfmt::skip` --> $DIR/tool-attributes-misplaced-2.rs:5:5 diff --git a/tests/ui/trait-bounds/impl-bound-with-references-error.stderr b/tests/ui/trait-bounds/impl-bound-with-references-error.stderr index 95fd6bd50..b114d295d 100644 --- a/tests/ui/trait-bounds/impl-bound-with-references-error.stderr +++ b/tests/ui/trait-bounds/impl-bound-with-references-error.stderr @@ -6,7 +6,7 @@ LL | T: Into>, | help: consider importing this enum | -LL | use std::borrow::Cow; +LL + use std::borrow::Cow; | error[E0119]: conflicting implementations of trait `From` for type `LabelText` diff --git a/tests/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr b/tests/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr index b29766295..4547e1c98 100644 --- a/tests/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr +++ b/tests/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr @@ -6,7 +6,7 @@ LL | pub struct A(pub H); | help: consider importing this trait | -LL | use A::Trait; +LL + use A::Trait; | help: if you import `Trait`, refer to it directly | diff --git a/tests/ui/traits/alias/dont-elaborate-non-self.rs b/tests/ui/traits/alias/dont-elaborate-non-self.rs new file mode 100644 index 000000000..4f9eaacb8 --- /dev/null +++ b/tests/ui/traits/alias/dont-elaborate-non-self.rs @@ -0,0 +1,10 @@ +#![feature(trait_alias)] + +use std::future::Future; + +trait F> = Fn() -> Fut; + +fn f(a: dyn F) {} +//~^ ERROR the size for values of type `(dyn Fn() -> Fut + 'static)` cannot be known at compilation time + +fn main() {} diff --git a/tests/ui/traits/alias/dont-elaborate-non-self.stderr b/tests/ui/traits/alias/dont-elaborate-non-self.stderr new file mode 100644 index 000000000..247a4f812 --- /dev/null +++ b/tests/ui/traits/alias/dont-elaborate-non-self.stderr @@ -0,0 +1,20 @@ +error[E0277]: the size for values of type `(dyn Fn() -> Fut + 'static)` cannot be known at compilation time + --> $DIR/dont-elaborate-non-self.rs:7:11 + | +LL | fn f(a: dyn F) {} + | ^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `(dyn Fn() -> Fut + 'static)` + = help: unsized fn params are gated as an unstable feature +help: you can use `impl Trait` as the argument type + | +LL | fn f(a: impl F) {} + | ~~~~ +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn f(a: &dyn F) {} + | + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.rs b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.rs index 471a6b836..8e43b7249 100644 --- a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.rs +++ b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.rs @@ -18,6 +18,6 @@ fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: String { //~ ERROR expec fn issue_95327() where ::Assoc: String {} //~^ ERROR expected trait, found struct -//~| ERROR use of undeclared type `Unresolved` +//~| ERROR cannot find trait `Unresolved` in this scope fn main() {} diff --git a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr index 5be334986..0020f9e41 100644 --- a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr +++ b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr @@ -1,9 +1,3 @@ -error[E0433]: failed to resolve: use of undeclared type `Unresolved` - --> $DIR/assoc_type_bound_with_struct.rs:19:31 - | -LL | fn issue_95327() where ::Assoc: String {} - | ^^^^^^^^^^ use of undeclared type `Unresolved` - error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:5:46 | @@ -76,6 +70,12 @@ help: a trait with a similar name exists LL | fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: ToString { | ~~~~~~~~ +error[E0405]: cannot find trait `Unresolved` in this scope + --> $DIR/assoc_type_bound_with_struct.rs:19:31 + | +LL | fn issue_95327() where ::Assoc: String {} + | ^^^^^^^^^^ not found in this scope + error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:19:51 | @@ -87,5 +87,5 @@ LL | fn issue_95327() where ::Assoc: String {} error: aborting due to 6 previous errors -Some errors have detailed explanations: E0404, E0433. +Some errors have detailed explanations: E0404, E0405. For more information about an error, try `rustc --explain E0404`. diff --git a/tests/ui/traits/copy-is-not-modulo-regions.not_static.stderr b/tests/ui/traits/copy-is-not-modulo-regions.not_static.stderr index edd94d201..130425211 100644 --- a/tests/ui/traits/copy-is-not-modulo-regions.not_static.stderr +++ b/tests/ui/traits/copy-is-not-modulo-regions.not_static.stderr @@ -1,4 +1,4 @@ -error[E0204]: the trait `Copy` may not be implemented for this type +error[E0204]: the trait `Copy` cannot be implemented for this type --> $DIR/copy-is-not-modulo-regions.rs:13:21 | LL | struct Bar<'lt>(Foo<'lt>); diff --git a/tests/ui/traits/copy-is-not-modulo-regions.rs b/tests/ui/traits/copy-is-not-modulo-regions.rs index adb870237..b89908374 100644 --- a/tests/ui/traits/copy-is-not-modulo-regions.rs +++ b/tests/ui/traits/copy-is-not-modulo-regions.rs @@ -11,7 +11,7 @@ struct Bar<'lt>(Foo<'lt>); #[cfg(not_static)] impl<'any> Copy for Bar<'any> {} -//[not_static]~^ the trait `Copy` may not be implemented for this type +//[not_static]~^ the trait `Copy` cannot be implemented for this type #[cfg(yes_static)] impl<'any> Copy for Bar<'static> {} diff --git a/tests/ui/traits/dyn-trait.rs b/tests/ui/traits/dyn-trait.rs index e1c1a8de5..10e69105c 100644 --- a/tests/ui/traits/dyn-trait.rs +++ b/tests/ui/traits/dyn-trait.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty `dyn ::foo` parses differently in the current edition use std::fmt::Display; diff --git a/tests/ui/traits/inductive-overflow/lifetime.rs b/tests/ui/traits/inductive-overflow/lifetime.rs index bf536d21c..2f3c90dce 100644 --- a/tests/ui/traits/inductive-overflow/lifetime.rs +++ b/tests/ui/traits/inductive-overflow/lifetime.rs @@ -15,9 +15,9 @@ impl<'a> Y for C<'a> { struct C<'a>(&'a ()); struct X(T::P); -impl NotAuto for Box {} //~ NOTE: required +impl NotAuto for Box {} +impl NotAuto for X where T::P: NotAuto {} //~ NOTE: required //~^ NOTE unsatisfied trait bound introduced here -impl NotAuto for X where T::P: NotAuto {} impl<'a> NotAuto for C<'a> {} fn is_send() {} @@ -28,6 +28,4 @@ fn main() { // Should only be a few notes. is_send::>>(); //~^ ERROR overflow evaluating - //~| 3 redundant requirements hidden - //~| required for } diff --git a/tests/ui/traits/inductive-overflow/lifetime.stderr b/tests/ui/traits/inductive-overflow/lifetime.stderr index 357e59991..7ab2864a8 100644 --- a/tests/ui/traits/inductive-overflow/lifetime.stderr +++ b/tests/ui/traits/inductive-overflow/lifetime.stderr @@ -1,18 +1,14 @@ -error[E0275]: overflow evaluating the requirement `X>: NotAuto` +error[E0275]: overflow evaluating the requirement `Box>>: NotAuto` --> $DIR/lifetime.rs:29:5 | LL | is_send::>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^ | -note: required for `Box>>` to implement `NotAuto` - --> $DIR/lifetime.rs:18:18 +note: required for `X>` to implement `NotAuto` + --> $DIR/lifetime.rs:19:12 | -LL | impl NotAuto for Box {} - | ------- ^^^^^^^ ^^^^^^ - | | - | unsatisfied trait bound introduced here - = note: 3 redundant requirements hidden - = note: required for `X>` to implement `NotAuto` +LL | impl NotAuto for X where T::P: NotAuto {} + | ^^^^^^^ ^^^^ ------- unsatisfied trait bound introduced here note: required by a bound in `is_send` --> $DIR/lifetime.rs:23:15 | diff --git a/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr b/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr index dc967d512..e723c7c51 100644 --- a/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr +++ b/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr @@ -26,7 +26,8 @@ LL | fn copy(x: T) -> (T, T) { (x, x) } | ^^^^^ required by this bound in `copy` help: consider annotating `NoClone` with `#[derive(Copy)]` | -LL | #[derive(Copy)] +LL + #[derive(Copy)] +LL | struct NoClone; | error: aborting due to 2 previous errors diff --git a/tests/ui/traits/issue-50480.rs b/tests/ui/traits/issue-50480.rs index 005939e0c..683a85a32 100644 --- a/tests/ui/traits/issue-50480.rs +++ b/tests/ui/traits/issue-50480.rs @@ -1,5 +1,5 @@ #[derive(Clone, Copy)] -//~^ ERROR the trait `Copy` may not be implemented for this type +//~^ ERROR the trait `Copy` cannot be implemented for this type struct Foo(N, NotDefined, ::Item, Vec, String); //~^ ERROR cannot find type `NotDefined` in this scope //~| ERROR cannot find type `NotDefined` in this scope @@ -7,7 +7,7 @@ struct Foo(N, NotDefined, ::Item, Vec, String); //~| ERROR cannot find type `N` in this scope #[derive(Clone, Copy)] -//~^ ERROR the trait `Copy` may not be implemented for this type +//~^ ERROR the trait `Copy` cannot be implemented for this type struct Bar(T, N, NotDefined, ::Item, Vec, String); //~^ ERROR cannot find type `NotDefined` in this scope //~| ERROR cannot find type `N` in this scope diff --git a/tests/ui/traits/issue-50480.stderr b/tests/ui/traits/issue-50480.stderr index 5063fdca0..4f72db60a 100644 --- a/tests/ui/traits/issue-50480.stderr +++ b/tests/ui/traits/issue-50480.stderr @@ -60,7 +60,7 @@ error[E0412]: cannot find type `NotDefined` in this scope LL | struct Bar(T, N, NotDefined, ::Item, Vec, String); | ^^^^^^^^^^ not found in this scope -error[E0204]: the trait `Copy` may not be implemented for this type +error[E0204]: the trait `Copy` cannot be implemented for this type --> $DIR/issue-50480.rs:1:17 | LL | #[derive(Clone, Copy)] @@ -73,7 +73,7 @@ LL | struct Foo(N, NotDefined, ::Item, Vec, String); | = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0204]: the trait `Copy` may not be implemented for this type +error[E0204]: the trait `Copy` cannot be implemented for this type --> $DIR/issue-50480.rs:9:17 | LL | #[derive(Clone, Copy)] diff --git a/tests/ui/traits/issue-71136.stderr b/tests/ui/traits/issue-71136.stderr index f54173392..ef5579618 100644 --- a/tests/ui/traits/issue-71136.stderr +++ b/tests/ui/traits/issue-71136.stderr @@ -11,7 +11,8 @@ LL | the_foos: Vec, = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Foo` with `#[derive(Clone)]` | -LL | #[derive(Clone)] +LL + #[derive(Clone)] +LL | struct Foo(u8); | error: aborting due to previous error diff --git a/tests/ui/traits/issue-78372.stderr b/tests/ui/traits/issue-78372.stderr index 8e7fd5f25..ec692ff91 100644 --- a/tests/ui/traits/issue-78372.stderr +++ b/tests/ui/traits/issue-78372.stderr @@ -6,7 +6,7 @@ LL | struct Smaht(PhantomData); | help: consider importing this struct | -LL | use std::marker::PhantomData; +LL + use std::marker::PhantomData; | error[E0412]: cannot find type `U` in this scope diff --git a/tests/ui/traits/issue-87558.stderr b/tests/ui/traits/issue-87558.stderr index 494274d8c..b647f9794 100644 --- a/tests/ui/traits/issue-87558.stderr +++ b/tests/ui/traits/issue-87558.stderr @@ -17,6 +17,12 @@ error[E0229]: associated type bindings are not allowed here | LL | impl Fn(&isize) for Error { | ^^^^^^^^^^ associated type not allowed here + | +help: parenthesized trait syntax expands to `Fn<(&isize,), Output=()>` + --> $DIR/issue-87558.rs:3:6 + | +LL | impl Fn(&isize) for Error { + | ^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/tests/ui/traits/issue-91949-hangs-on-recursion.rs b/tests/ui/traits/issue-91949-hangs-on-recursion.rs index 6474b2b38..4eca643a9 100644 --- a/tests/ui/traits/issue-91949-hangs-on-recursion.rs +++ b/tests/ui/traits/issue-91949-hangs-on-recursion.rs @@ -1,6 +1,6 @@ // build-fail // compile-flags: -Zinline-mir=no -// error-pattern: overflow evaluating the requirement `(): Sized` +// error-pattern: overflow evaluating the requirement ` as Iterator>::Item == ()` // error-pattern: function cannot return without recursing // normalize-stderr-test: "long-type-\d+" -> "long-type-hash" diff --git a/tests/ui/traits/issue-91949-hangs-on-recursion.stderr b/tests/ui/traits/issue-91949-hangs-on-recursion.stderr index 1f18c5daf..144990d50 100644 --- a/tests/ui/traits/issue-91949-hangs-on-recursion.stderr +++ b/tests/ui/traits/issue-91949-hangs-on-recursion.stderr @@ -12,11 +12,17 @@ LL | recurse(IteratorOfWrapped(elements).map(|t| t.0)) = help: a `loop` may express intention better if this is on purpose = note: `#[warn(unconditional_recursion)]` on by default -error[E0275]: overflow evaluating the requirement `(): Sized` +error[E0275]: overflow evaluating the requirement ` as Iterator>::Item == ()` | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "512"]` attribute to your crate (`issue_91949_hangs_on_recursion`) - = note: required for `std::iter::Empty<()>` to implement `Iterator` - = note: 171 redundant requirements hidden +note: required for `IteratorOfWrapped<(), std::iter::Empty<()>>` to implement `Iterator` + --> $DIR/issue-91949-hangs-on-recursion.rs:16:32 + | +LL | impl> Iterator for IteratorOfWrapped { + | -------- ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here + = note: 256 redundant requirements hidden = note: required for `IteratorOfWrapped<(), Map>, ...>>, ...>>` to implement `Iterator` = note: the full type name has been written to '$TEST_BUILD_DIR/traits/issue-91949-hangs-on-recursion/issue-91949-hangs-on-recursion.long-type-hash.txt' diff --git a/tests/ui/traits/item-privacy.stderr b/tests/ui/traits/item-privacy.stderr index 04995b3a1..f53813189 100644 --- a/tests/ui/traits/item-privacy.stderr +++ b/tests/ui/traits/item-privacy.stderr @@ -29,7 +29,7 @@ LL | S.b(); = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use method::B; +LL + use method::B; | error[E0624]: method `a` is private @@ -69,7 +69,7 @@ LL | S::b(&S); = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use method::B; +LL + use method::B; | error[E0624]: method `a` is private @@ -109,7 +109,7 @@ LL | S::B; = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use assoc_const::B; +LL + use assoc_const::B; | error[E0624]: associated constant `A` is private diff --git a/tests/ui/traits/method-private.stderr b/tests/ui/traits/method-private.stderr index 55656f21e..e11799308 100644 --- a/tests/ui/traits/method-private.stderr +++ b/tests/ui/traits/method-private.stderr @@ -10,7 +10,7 @@ LL | foo.method(); = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use inner::Bar; +LL + use inner::Bar; | error: aborting due to previous error diff --git a/tests/ui/traits/new-solver/alias-eq-in-canonical-response.rs b/tests/ui/traits/new-solver/alias-eq-in-canonical-response.rs new file mode 100644 index 000000000..4bfb6323a --- /dev/null +++ b/tests/ui/traits/new-solver/alias-eq-in-canonical-response.rs @@ -0,0 +1,40 @@ +// check-pass +// compile-flags: -Ztrait-solver=next + +trait Foo { + type Gat<'a> + where + Self: 'a; + fn bar(&self) -> Self::Gat<'_>; +} + +enum Option { + Some(T), + None, +} + +impl Option { + fn as_ref(&self) -> Option<&T> { + match self { + Option::Some(t) => Option::Some(t), + Option::None => Option::None, + } + } + + fn map(self, f: impl FnOnce(T) -> U) -> Option { + match self { + Option::Some(t) => Option::Some(f(t)), + Option::None => Option::None, + } + } +} + +impl Foo for Option { + type Gat<'a> = Option<::Gat<'a>> where Self: 'a; + + fn bar(&self) -> Self::Gat<'_> { + self.as_ref().map(Foo::bar) + } +} + +fn main() {} diff --git a/tests/ui/traits/new-solver/alias-sub.rs b/tests/ui/traits/new-solver/alias-sub.rs new file mode 100644 index 000000000..30c1981a9 --- /dev/null +++ b/tests/ui/traits/new-solver/alias-sub.rs @@ -0,0 +1,34 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +trait Trait { + type Assoc: Sized; +} + +impl Trait for &'static str { + type Assoc = &'static str; +} + +// Wrapper is just here to get around stupid `Sized` obligations in mir typeck +struct Wrapper(std::marker::PhantomData); +fn mk(x: T) -> Wrapper<::Assoc> { todo!() } + + +trait IsStaticStr {} +impl IsStaticStr for (&'static str,) {} +fn define(_: T) {} + +fn foo<'a, T: Trait>() { + let y = Default::default(); + + // `::Assoc <: &'a str` + // In the old solver, this would *equate* the LHS and RHS. + let _: Wrapper<&'a str> = mk(y); + + // ... then later on, we constrain `?0 = &'static str` + // but that should not mean that `'a = 'static`, because + // we should use *sub* above. + define((y,)); +} + +fn main() {} diff --git a/tests/ui/traits/new-solver/alias_eq_dont_use_normalizes_to_if_substs_eq.rs b/tests/ui/traits/new-solver/alias_eq_dont_use_normalizes_to_if_substs_eq.rs index fd5d0e3b1..531203d9c 100644 --- a/tests/ui/traits/new-solver/alias_eq_dont_use_normalizes_to_if_substs_eq.rs +++ b/tests/ui/traits/new-solver/alias_eq_dont_use_normalizes_to_if_substs_eq.rs @@ -1,7 +1,7 @@ // compile-flags: -Ztrait-solver=next // check that when computing `alias-eq(<() as Foo>::Assoc, <() as Foo>::Assoc)` -// we do not infer `?0 = u8` via the `for (): Foo` impl or `?0 = u16` by +// we do not infer `?0 = u8` via the `for (): Foo` impl or `?0 = u16` by // relating substs as either could be a valid solution. trait Foo { diff --git a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.fail.stderr b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.fail.stderr new file mode 100644 index 000000000..6a926534e --- /dev/null +++ b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.fail.stderr @@ -0,0 +1,18 @@ +error[E0277]: `impl Future` cannot be sent between threads safely + --> $DIR/auto-with-drop_tracking_mir.rs:24:13 + | +LL | is_send(foo()); + | ------- ^^^^^ `impl Future` cannot be sent between threads safely + | | + | required by a bound introduced by this call + | + = help: the trait `Send` is not implemented for `impl Future` +note: required by a bound in `is_send` + --> $DIR/auto-with-drop_tracking_mir.rs:23:24 + | +LL | fn is_send(_: impl Send) {} + | ^^^^ required by this bound in `is_send` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs new file mode 100644 index 000000000..a5db7c463 --- /dev/null +++ b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs @@ -0,0 +1,26 @@ +// compile-flags: -Ztrait-solver=next -Zdrop-tracking-mir +// edition: 2021 +// revisions: pass fail +//[pass] check-pass + +#![feature(negative_impls)] + +struct NotSync; +impl !Sync for NotSync {} + +async fn foo() { + #[cfg(pass)] + let x = &(); + #[cfg(fail)] + let x = &NotSync; + bar().await; + drop(x); +} + +async fn bar() {} + +fn main() { + fn is_send(_: impl Send) {} + is_send(foo()); + //[fail]~^ ERROR `impl Future` cannot be sent between threads safely +} diff --git a/tests/ui/traits/new-solver/canonical-int-var-eq-in-response.rs b/tests/ui/traits/new-solver/canonical-int-var-eq-in-response.rs new file mode 100644 index 000000000..4b013983a --- /dev/null +++ b/tests/ui/traits/new-solver/canonical-int-var-eq-in-response.rs @@ -0,0 +1,22 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +trait Mirror { + type Assoc; +} + +impl Mirror for T { + type Assoc = T; +} + +trait Test {} +impl Test for i64 {} +impl Test for u64 {} + +fn mirror_me(t: T, s: ::Assoc) where ::Assoc: Test {} + +fn main() { + let mut x = 0; + mirror_me(x, 1); + x = 1i64; +} diff --git a/tests/ui/traits/new-solver/canonical-ty-var-eq-in-response.rs b/tests/ui/traits/new-solver/canonical-ty-var-eq-in-response.rs new file mode 100644 index 000000000..d1c6b1077 --- /dev/null +++ b/tests/ui/traits/new-solver/canonical-ty-var-eq-in-response.rs @@ -0,0 +1,39 @@ +// check-pass +// compile-flags: -Ztrait-solver=next + +trait Mirror { + type Item; +} + +struct Wrapper(T); +impl Mirror for Wrapper { + type Item = T; +} + +fn mirror() +where + Wrapper: Mirror, +{ +} + +fn main() { + mirror::<_ /* ?0 */>(); + + // Solving ` as Mirror>::Item = i32` + + // First, we replace the term with a fresh infer var: + // ` as Mirror>::Item = ?1` + + // We select the impl candidate on line #6, which leads us to learn that + // `?0 == ?1`. + + // That should be reflected in our canonical response, which should have + // `^0 = ^0, ^1 = ^0` + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // !! We used to return a totally unconstrained response here :< !! + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + // Then, during the "equate term" part of the projection solving, we + // instantiate the response from the unconstrained projection predicate, + // and equate `?0 == i32`. +} diff --git a/tests/ui/traits/new-solver/cast-checks-handling-projections.rs b/tests/ui/traits/new-solver/cast-checks-handling-projections.rs new file mode 100644 index 000000000..3b261062f --- /dev/null +++ b/tests/ui/traits/new-solver/cast-checks-handling-projections.rs @@ -0,0 +1,6 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +fn main() { + (0u8 + 0u8) as char; +} diff --git a/tests/ui/traits/new-solver/closure-inference-guidance.rs b/tests/ui/traits/new-solver/closure-inference-guidance.rs new file mode 100644 index 000000000..d2ad0cc03 --- /dev/null +++ b/tests/ui/traits/new-solver/closure-inference-guidance.rs @@ -0,0 +1,11 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +fn foo(i: isize) -> isize { i + 1 } + +fn apply(f: F, v: A) -> A where F: FnOnce(A) -> A { f(v) } + +pub fn main() { + let f = |i| foo(i); + assert_eq!(apply(f, 2), 3); +} diff --git a/tests/ui/traits/new-solver/coherence/issue-102048.rs b/tests/ui/traits/new-solver/coherence/issue-102048.rs new file mode 100644 index 000000000..11636bfeb --- /dev/null +++ b/tests/ui/traits/new-solver/coherence/issue-102048.rs @@ -0,0 +1,44 @@ +// This must fail coherence. +// +// Getting this to pass was fairly difficult, so here's an explanation +// of what's happening: +// +// Normalizing projections currently tries to replace them with inference variables +// while emitting a nested `Projection` obligation. This cannot be done if the projection +// has bound variables which is the case here. +// +// So the projections stay until after normalization. When unifying two projections we +// currently treat them as if they are injective, so we **incorrectly** unify their +// substs. This means that coherence for the two impls ends up unifying `?T` and `?U` +// as it tries to unify `>::Assoc` with `>::Assoc`. +// +// `impl1` therefore has the projection `>::Assoc` and we have the +// assumption `?T: for<'a> WithAssoc2<'a, Assoc = i32>` in the `param_env`, so we normalize +// that to `i32`. We then try to unify `i32` from `impl1` with `u32` from `impl2` which fails, +// causing coherence to consider these two impls distinct. + +// compile-flags: -Ztrait-solver=next +pub trait Trait {} + +pub trait WithAssoc1<'a> { + type Assoc; +} +pub trait WithAssoc2<'a> { + type Assoc; +} + +// impl 1 +impl Trait fn(>::Assoc, >::Assoc)> for (T, U) +where + T: for<'a> WithAssoc1<'a> + for<'a> WithAssoc2<'a, Assoc = i32>, + U: for<'a> WithAssoc2<'a>, +{ +} + +// impl 2 +impl Trait fn(>::Assoc, u32)> for (T, U) where + U: for<'a> WithAssoc1<'a> //~^ ERROR conflicting implementations of trait +{ +} + +fn main() {} diff --git a/tests/ui/traits/new-solver/coherence/issue-102048.stderr b/tests/ui/traits/new-solver/coherence/issue-102048.stderr new file mode 100644 index 000000000..17a43838f --- /dev/null +++ b/tests/ui/traits/new-solver/coherence/issue-102048.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `Trait fn(<_ as WithAssoc1<'a>>::Assoc, <_ as WithAssoc2<'a>>::Assoc)>` for type `(_, _)` + --> $DIR/issue-102048.rs:39:1 + | +LL | impl Trait fn(>::Assoc, >::Assoc)> for (T, U) + | --------------------------------------------------------------------------------------------------- first implementation here +... +LL | impl Trait fn(>::Assoc, u32)> for (T, U) where + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_, _)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/traits/new-solver/const-param-placeholder.fail.stderr b/tests/ui/traits/new-solver/const-param-placeholder.fail.stderr new file mode 100644 index 000000000..4db6e22e5 --- /dev/null +++ b/tests/ui/traits/new-solver/const-param-placeholder.fail.stderr @@ -0,0 +1,16 @@ +error[E0277]: the trait bound `[T; N]: Foo` is not satisfied + --> $DIR/const-param-placeholder.rs:17:17 + | +LL | needs_foo::<[T; N]>(); + | ^^^^^^ the trait `Foo` is not implemented for `[T; N]` + | + = help: the trait `Foo` is implemented for `[T; 1]` +note: required by a bound in `needs_foo` + --> $DIR/const-param-placeholder.rs:8:17 + | +LL | fn needs_foo() {} + | ^^^ required by this bound in `needs_foo` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/new-solver/const-param-placeholder.rs b/tests/ui/traits/new-solver/const-param-placeholder.rs new file mode 100644 index 000000000..a83102a4c --- /dev/null +++ b/tests/ui/traits/new-solver/const-param-placeholder.rs @@ -0,0 +1,21 @@ +// compile-flags: -Ztrait-solver=next +// revisions: pass fail +//[pass] check-pass + +struct Wrapper([T; N]); + +trait Foo {} +fn needs_foo() {} + +#[cfg(fail)] +impl Foo for [T; 1] {} + +#[cfg(pass)] +impl Foo for [T; N] {} + +fn test() { + needs_foo::<[T; N]>(); + //[fail]~^ ERROR the trait bound `[T; N]: Foo` is not satisfied +} + +fn main() {} diff --git a/tests/ui/traits/new-solver/deduce-ty-from-object.rs b/tests/ui/traits/new-solver/deduce-ty-from-object.rs new file mode 100644 index 000000000..7398bce7b --- /dev/null +++ b/tests/ui/traits/new-solver/deduce-ty-from-object.rs @@ -0,0 +1,6 @@ +// check-pass +// compile-flags: -Ztrait-solver=next + +fn main() { + let x: Box> = Box::new(std::iter::empty()); +} diff --git a/tests/ui/traits/new-solver/destruct.rs b/tests/ui/traits/new-solver/destruct.rs new file mode 100644 index 000000000..30d7777b7 --- /dev/null +++ b/tests/ui/traits/new-solver/destruct.rs @@ -0,0 +1,13 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +#![feature(const_trait_impl)] + +fn foo(_: impl std::marker::Destruct) {} + +struct MyAdt; + +fn main() { + foo(1); + foo(MyAdt); +} diff --git a/tests/ui/traits/new-solver/dont-elaborate-for-projections.rs b/tests/ui/traits/new-solver/dont-elaborate-for-projections.rs new file mode 100644 index 000000000..e60825006 --- /dev/null +++ b/tests/ui/traits/new-solver/dont-elaborate-for-projections.rs @@ -0,0 +1,12 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +trait Iter<'a, I: 'a>: Iterator {} + +fn needs_iter<'a, T: Iter<'a, I> + ?Sized, I: 'a>(_: &T) {} + +fn test(x: &dyn Iter<'_, ()>) { + needs_iter(x); +} + +fn main() {} diff --git a/tests/ui/traits/new-solver/equating-projection-cyclically.rs b/tests/ui/traits/new-solver/equating-projection-cyclically.rs new file mode 100644 index 000000000..019c6e81c --- /dev/null +++ b/tests/ui/traits/new-solver/equating-projection-cyclically.rs @@ -0,0 +1,24 @@ +// compile-flags: -Ztrait-solver=next +// known-bug: unknown + +trait Test { + type Assoc; +} + +fn transform(x: T) -> T::Assoc { + todo!() +} + +impl Test for i32 { + type Assoc = i32; +} + +impl Test for String { + type Assoc = String; +} + +fn main() { + let mut x = Default::default(); + x = transform(x); + x = 1i32; +} diff --git a/tests/ui/traits/new-solver/equating-projection-cyclically.stderr b/tests/ui/traits/new-solver/equating-projection-cyclically.stderr new file mode 100644 index 000000000..57cbc65a1 --- /dev/null +++ b/tests/ui/traits/new-solver/equating-projection-cyclically.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/equating-projection-cyclically.rs:22:19 + | +LL | x = transform(x); + | ^ expected inferred type, found associated type + | + = note: expected type `_` + found associated type `<_ as Test>::Assoc` + = help: consider constraining the associated type `<_ as Test>::Assoc` to `_` + = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/traits/new-solver/float-canonical.rs b/tests/ui/traits/new-solver/float-canonical.rs new file mode 100644 index 000000000..b8748cd43 --- /dev/null +++ b/tests/ui/traits/new-solver/float-canonical.rs @@ -0,0 +1,8 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +fn foo(x: f64) { + let y = x + 1.0; +} + +fn main() {} diff --git a/tests/ui/traits/new-solver/fn-trait.rs b/tests/ui/traits/new-solver/fn-trait.rs index d566ead10..0599e51d7 100644 --- a/tests/ui/traits/new-solver/fn-trait.rs +++ b/tests/ui/traits/new-solver/fn-trait.rs @@ -1,5 +1,4 @@ // compile-flags: -Ztrait-solver=next -// check-pass fn require_fn(_: impl Fn() -> i32) {} @@ -7,7 +6,27 @@ fn f() -> i32 { 1i32 } +extern "C" fn g() -> i32 { + 2i32 +} + +unsafe fn h() -> i32 { + 2i32 +} + fn main() { require_fn(f); require_fn(f as fn() -> i32); + require_fn(f as unsafe fn() -> i32); + //~^ ERROR: expected a `Fn<()>` closure, found `unsafe fn() -> i32` + //~| ERROR: type mismatch resolving ` i32 as FnOnce<()>>::Output == i32` + require_fn(g); + //~^ ERROR: expected a `Fn<()>` closure, found `extern "C" fn() -> i32 {g}` + //~| ERROR: type mismatch resolving ` i32 {g} as FnOnce<()>>::Output == i32` + require_fn(g as extern "C" fn() -> i32); + //~^ ERROR: expected a `Fn<()>` closure, found `extern "C" fn() -> i32` + //~| ERROR: type mismatch resolving ` i32 as FnOnce<()>>::Output == i32` + require_fn(h); + //~^ ERROR: expected a `Fn<()>` closure, found `unsafe fn() -> i32 {h}` + //~| ERROR: type mismatch resolving ` i32 {h} as FnOnce<()>>::Output == i32` } diff --git a/tests/ui/traits/new-solver/fn-trait.stderr b/tests/ui/traits/new-solver/fn-trait.stderr new file mode 100644 index 000000000..d52bcaf25 --- /dev/null +++ b/tests/ui/traits/new-solver/fn-trait.stderr @@ -0,0 +1,124 @@ +error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() -> i32` + --> $DIR/fn-trait.rs:20:16 + | +LL | require_fn(f as unsafe fn() -> i32); + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }` + | | + | required by a bound introduced by this call + | + = help: the trait `Fn<()>` is not implemented for `unsafe fn() -> i32` + = note: wrap the `unsafe fn() -> i32` in a closure with no arguments: `|| { /* code */ }` +note: required by a bound in `require_fn` + --> $DIR/fn-trait.rs:3:23 + | +LL | fn require_fn(_: impl Fn() -> i32) {} + | ^^^^^^^^^^^ required by this bound in `require_fn` + +error[E0271]: type mismatch resolving ` i32 as FnOnce<()>>::Output == i32` + --> $DIR/fn-trait.rs:20:16 + | +LL | require_fn(f as unsafe fn() -> i32); + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^ types differ + | | + | required by a bound introduced by this call + | +note: required by a bound in `require_fn` + --> $DIR/fn-trait.rs:3:31 + | +LL | fn require_fn(_: impl Fn() -> i32) {} + | ^^^ required by this bound in `require_fn` + +error[E0277]: expected a `Fn<()>` closure, found `extern "C" fn() -> i32 {g}` + --> $DIR/fn-trait.rs:23:16 + | +LL | require_fn(g); + | ---------- ^ expected an `Fn<()>` closure, found `extern "C" fn() -> i32 {g}` + | | + | required by a bound introduced by this call + | + = help: the trait `Fn<()>` is not implemented for fn item `extern "C" fn() -> i32 {g}` + = note: wrap the `extern "C" fn() -> i32 {g}` in a closure with no arguments: `|| { /* code */ }` +note: required by a bound in `require_fn` + --> $DIR/fn-trait.rs:3:23 + | +LL | fn require_fn(_: impl Fn() -> i32) {} + | ^^^^^^^^^^^ required by this bound in `require_fn` + +error[E0271]: type mismatch resolving ` i32 {g} as FnOnce<()>>::Output == i32` + --> $DIR/fn-trait.rs:23:16 + | +LL | require_fn(g); + | ---------- ^ types differ + | | + | required by a bound introduced by this call + | +note: required by a bound in `require_fn` + --> $DIR/fn-trait.rs:3:31 + | +LL | fn require_fn(_: impl Fn() -> i32) {} + | ^^^ required by this bound in `require_fn` + +error[E0277]: expected a `Fn<()>` closure, found `extern "C" fn() -> i32` + --> $DIR/fn-trait.rs:26:16 + | +LL | require_fn(g as extern "C" fn() -> i32); + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `extern "C" fn() -> i32` + | | + | required by a bound introduced by this call + | + = help: the trait `Fn<()>` is not implemented for `extern "C" fn() -> i32` + = note: wrap the `extern "C" fn() -> i32` in a closure with no arguments: `|| { /* code */ }` +note: required by a bound in `require_fn` + --> $DIR/fn-trait.rs:3:23 + | +LL | fn require_fn(_: impl Fn() -> i32) {} + | ^^^^^^^^^^^ required by this bound in `require_fn` + +error[E0271]: type mismatch resolving ` i32 as FnOnce<()>>::Output == i32` + --> $DIR/fn-trait.rs:26:16 + | +LL | require_fn(g as extern "C" fn() -> i32); + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ + | | + | required by a bound introduced by this call + | +note: required by a bound in `require_fn` + --> $DIR/fn-trait.rs:3:31 + | +LL | fn require_fn(_: impl Fn() -> i32) {} + | ^^^ required by this bound in `require_fn` + +error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() -> i32 {h}` + --> $DIR/fn-trait.rs:29:16 + | +LL | require_fn(h); + | ---------- ^ call the function in a closure: `|| unsafe { /* code */ }` + | | + | required by a bound introduced by this call + | + = help: the trait `Fn<()>` is not implemented for fn item `unsafe fn() -> i32 {h}` + = note: wrap the `unsafe fn() -> i32 {h}` in a closure with no arguments: `|| { /* code */ }` +note: required by a bound in `require_fn` + --> $DIR/fn-trait.rs:3:23 + | +LL | fn require_fn(_: impl Fn() -> i32) {} + | ^^^^^^^^^^^ required by this bound in `require_fn` + +error[E0271]: type mismatch resolving ` i32 {h} as FnOnce<()>>::Output == i32` + --> $DIR/fn-trait.rs:29:16 + | +LL | require_fn(h); + | ---------- ^ types differ + | | + | required by a bound introduced by this call + | +note: required by a bound in `require_fn` + --> $DIR/fn-trait.rs:3:31 + | +LL | fn require_fn(_: impl Fn() -> i32) {} + | ^^^ required by this bound in `require_fn` + +error: aborting due to 8 previous errors + +Some errors have detailed explanations: E0271, E0277. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/traits/new-solver/int-var-alias-eq.rs b/tests/ui/traits/new-solver/int-var-alias-eq.rs new file mode 100644 index 000000000..2da387db4 --- /dev/null +++ b/tests/ui/traits/new-solver/int-var-alias-eq.rs @@ -0,0 +1,18 @@ +// check-pass +// compile-flags: -Ztrait-solver=next + +// HIR typeck ends up equating `<_#0i as Add>::Output == _#0i`. +// Want to make sure that we emit an alias-eq goal for this, +// instead of treating it as a type error and bailing. + +fn test() { + // fallback + let x = 1 + 2; +} + +fn test2() -> u32 { + // expectation from return ty + 1 + 2 +} + +fn main() {} diff --git a/tests/ui/traits/new-solver/int-var-is-send.rs b/tests/ui/traits/new-solver/int-var-is-send.rs new file mode 100644 index 000000000..083aa90e1 --- /dev/null +++ b/tests/ui/traits/new-solver/int-var-is-send.rs @@ -0,0 +1,8 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +fn needs_send(_: impl Send) {} + +fn main() { + needs_send(1); +} diff --git a/tests/ui/traits/new-solver/iter-filter-projection.rs b/tests/ui/traits/new-solver/iter-filter-projection.rs new file mode 100644 index 000000000..8fb62323a --- /dev/null +++ b/tests/ui/traits/new-solver/iter-filter-projection.rs @@ -0,0 +1,12 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +use std::{iter, slice}; + +struct Attr; + +fn test<'a, T: Iterator>() {} + +fn main() { + test::, fn(&&Attr) -> bool>>(); +} diff --git a/tests/ui/traits/new-solver/lazy-nested-obligations-1.rs b/tests/ui/traits/new-solver/lazy-nested-obligations-1.rs new file mode 100644 index 000000000..af00cbb3b --- /dev/null +++ b/tests/ui/traits/new-solver/lazy-nested-obligations-1.rs @@ -0,0 +1,13 @@ +// check-pass +// compile-flags: -Ztrait-solver=next +// Issue 94358 + +fn foo(_: C) +where + for <'a> &'a C: IntoIterator, + for <'a> <&'a C as IntoIterator>::IntoIter: ExactSizeIterator, +{} + +fn main() { + foo::<_>(vec![true, false]); +} diff --git a/tests/ui/traits/new-solver/lazy-nested-obligations-2.rs b/tests/ui/traits/new-solver/lazy-nested-obligations-2.rs new file mode 100644 index 000000000..32addd829 --- /dev/null +++ b/tests/ui/traits/new-solver/lazy-nested-obligations-2.rs @@ -0,0 +1,23 @@ +// check-pass +// compile-flags: -Ztrait-solver=next +// Issue 95863 + +pub trait With { + type F; +} + +impl With for i32 { + type F = fn(&str); +} + +fn f(_: &str) {} + +fn main() { + let _: V = V(f); + pub struct V(::F); + + pub enum E3 { + Var(::F), + } + let _: E3 = E3::Var(f); +} diff --git a/tests/ui/traits/new-solver/lazy-nested-obligations-3.rs b/tests/ui/traits/new-solver/lazy-nested-obligations-3.rs new file mode 100644 index 000000000..baf399572 --- /dev/null +++ b/tests/ui/traits/new-solver/lazy-nested-obligations-3.rs @@ -0,0 +1,38 @@ +// check-pass +// compile-flags: -Ztrait-solver=next +// Issue 96750 + +use std::marker::PhantomData; + +trait AsyncFn { + type Output; +} +trait RequestFamily { + type Type<'a>; +} +trait Service {} + +struct MyFn; +impl AsyncFn for MyFn { + type Output = (); +} + +impl RequestFamily for String { + type Type<'a> = String; +} + +struct ServiceFromAsyncFn(F, PhantomData); + +impl Service for ServiceFromAsyncFn +where + Req: RequestFamily, + F: AsyncFn, + F: for<'a> AsyncFn, Output = O>, +{ +} + +fn assert_service() -> impl Service { + ServiceFromAsyncFn(MyFn, PhantomData) +} + +fn main() {} diff --git a/tests/ui/traits/new-solver/more-object-bound.rs b/tests/ui/traits/new-solver/more-object-bound.rs index 712759ef0..bb730b18e 100644 --- a/tests/ui/traits/new-solver/more-object-bound.rs +++ b/tests/ui/traits/new-solver/more-object-bound.rs @@ -10,7 +10,7 @@ trait Trait: SuperTrait::B> {} fn transmute(x: A) -> B { foo::>(x) - //~^ ERROR type annotations needed: cannot satisfy `dyn Trait: Trait` + //~^ ERROR the trait bound `dyn Trait: Trait` is not satisfied } fn foo(x: T::A) -> B diff --git a/tests/ui/traits/new-solver/more-object-bound.stderr b/tests/ui/traits/new-solver/more-object-bound.stderr index 208fdecb0..4554b8c74 100644 --- a/tests/ui/traits/new-solver/more-object-bound.stderr +++ b/tests/ui/traits/new-solver/more-object-bound.stderr @@ -1,10 +1,9 @@ -error[E0283]: type annotations needed: cannot satisfy `dyn Trait: Trait` - --> $DIR/more-object-bound.rs:12:5 +error[E0277]: the trait bound `dyn Trait: Trait` is not satisfied + --> $DIR/more-object-bound.rs:12:17 | LL | foo::>(x) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `dyn Trait` | - = note: cannot satisfy `dyn Trait: Trait` note: required by a bound in `foo` --> $DIR/more-object-bound.rs:18:8 | @@ -13,7 +12,11 @@ LL | fn foo(x: T::A) -> B LL | where LL | T: Trait, | ^^^^^^^^^^^^ required by this bound in `foo` +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + | +LL | fn transmute(x: A) -> B where dyn Trait: Trait { + | ++++++++++++++++++++++++++++++++++++ error: aborting due to previous error -For more information about this error, try `rustc --explain E0283`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/new-solver/nested-obligations-with-bound-vars-gat.rs b/tests/ui/traits/new-solver/nested-obligations-with-bound-vars-gat.rs new file mode 100644 index 000000000..92bad9590 --- /dev/null +++ b/tests/ui/traits/new-solver/nested-obligations-with-bound-vars-gat.rs @@ -0,0 +1,43 @@ +// check-pass +// compile-flags: -Ztrait-solver=next +// Issue 96230 + +use std::fmt::Debug; + +trait Classic { + type Assoc; +} + +trait Gat { + type Assoc<'a>; +} + +struct Foo; + +impl Classic for Foo { + type Assoc = (); +} + +impl Gat for Foo { + type Assoc<'i> = (); +} + +fn classic_debug(_: T) +where + T::Assoc: Debug, +{ +} + +fn gat_debug(_: T) +where + for<'a> T::Assoc<'a>: Debug, +{ +} + +fn main() { + classic_debug::(Foo); // fine + classic_debug(Foo); // fine + + gat_debug::(Foo); // fine + gat_debug(Foo); // boom +} diff --git a/tests/ui/traits/new-solver/normalize-param-env-1.rs b/tests/ui/traits/new-solver/normalize-param-env-1.rs new file mode 100644 index 000000000..b02a5d623 --- /dev/null +++ b/tests/ui/traits/new-solver/normalize-param-env-1.rs @@ -0,0 +1,40 @@ +// check-pass +// compile-flags: -Ztrait-solver=next +// Issue 108933 + +trait Add { + type Sum; +} + +impl Add<()> for () { + type Sum = (); +} + +type Unit = <() as Add<()>>::Sum; + +trait Trait { + type Output; +} + +fn f() +where + T: Trait<()>, + >::Output: Sized, +{ +} + +fn g() +where + T: Trait, + >::Output: Sized, +{ +} + +fn h() +where + T: Trait<()>, + >::Output: Sized, +{ +} + +fn main() {} diff --git a/tests/ui/traits/new-solver/normalize-param-env-2.rs b/tests/ui/traits/new-solver/normalize-param-env-2.rs new file mode 100644 index 000000000..7c2cebdd2 --- /dev/null +++ b/tests/ui/traits/new-solver/normalize-param-env-2.rs @@ -0,0 +1,26 @@ +// check-pass +// compile-flags: -Ztrait-solver=next +// Issue 92505 + +trait A { + type I; + + fn f() + where + Self::I: A, + { + } +} + +impl A for () { + type I = (); + + fn f() + where + Self::I: A, + { + <() as A>::f(); + } +} + +fn main() {} diff --git a/tests/ui/traits/new-solver/normalize-param-env-3.rs b/tests/ui/traits/new-solver/normalize-param-env-3.rs new file mode 100644 index 000000000..ce2974b2a --- /dev/null +++ b/tests/ui/traits/new-solver/normalize-param-env-3.rs @@ -0,0 +1,32 @@ +// check-pass +// compile-flags: -Ztrait-solver=next +// Issue 100177 + +trait GenericTrait {} + +trait Channel: GenericTrait { + type T; +} + +trait Sender { + type Msg; + + fn send() + where + C: Channel; +} + +impl Sender for T { + type Msg = (); + + fn send() + where + C: Channel, + { + } +} + +// This works +fn foo(ch: C) where C: Channel {} + +fn main() {} diff --git a/tests/ui/traits/new-solver/param-discr-kind.rs b/tests/ui/traits/new-solver/param-discr-kind.rs new file mode 100644 index 000000000..e319ddea1 --- /dev/null +++ b/tests/ui/traits/new-solver/param-discr-kind.rs @@ -0,0 +1,8 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +fn foo(x: T) { + std::mem::discriminant(&x); +} + +fn main() {} diff --git a/tests/ui/traits/new-solver/pointee.rs b/tests/ui/traits/new-solver/pointee.rs index fa6ee2e2d..93c0542ac 100644 --- a/tests/ui/traits/new-solver/pointee.rs +++ b/tests/ui/traits/new-solver/pointee.rs @@ -7,17 +7,15 @@ use std::ptr::{DynMetadata, Pointee}; trait Trait {} struct MyDst(T); -fn works() { - let _: ::Metadata = (); - let _: <[T] as Pointee>::Metadata = 1_usize; - let _: ::Metadata = 1_usize; - let _: as Pointee>::Metadata = give::>>(); - let _: as Pointee>::Metadata = (); - let _: <((((([u8],),),),),) as Pointee>::Metadata = 1_usize; -} +fn meta_is + ?Sized, U>() {} -fn give() -> U { - loop {} +fn works() { + meta_is::(); + meta_is::<[T], usize>(); + meta_is::(); + meta_is::, DynMetadata>>(); + meta_is::, ()>(); + meta_is::<((((([u8],),),),),), usize>(); } fn main() {} diff --git a/tests/ui/traits/new-solver/pointer-like.rs b/tests/ui/traits/new-solver/pointer-like.rs index 3745a075e..986301769 100644 --- a/tests/ui/traits/new-solver/pointer-like.rs +++ b/tests/ui/traits/new-solver/pointer-like.rs @@ -9,6 +9,6 @@ fn require_(_: impl PointerLike) {} fn main() { require_(1usize); require_(1u16); - //~^ ERROR `u16` needs to have the same alignment and size as a pointer + //~^ ERROR `u16` needs to have the same ABI as a pointer require_(&1i16); } diff --git a/tests/ui/traits/new-solver/pointer-like.stderr b/tests/ui/traits/new-solver/pointer-like.stderr index f695e6418..215a81cc2 100644 --- a/tests/ui/traits/new-solver/pointer-like.stderr +++ b/tests/ui/traits/new-solver/pointer-like.stderr @@ -1,4 +1,4 @@ -error[E0277]: `u16` needs to have the same alignment and size as a pointer +error[E0277]: `u16` needs to have the same ABI as a pointer --> $DIR/pointer-like.rs:11:14 | LL | require_(1u16); diff --git a/tests/ui/traits/new-solver/prefer-candidate-no-constraints.rs b/tests/ui/traits/new-solver/prefer-candidate-no-constraints.rs new file mode 100644 index 000000000..6f8164f3a --- /dev/null +++ b/tests/ui/traits/new-solver/prefer-candidate-no-constraints.rs @@ -0,0 +1,22 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +trait Foo {} + +impl Foo for T {} + +trait Bar {} + +struct Wrapper<'a, T>(&'a T); + +impl<'a, T> Bar for Wrapper<'a, T> where &'a T: Foo {} +// We need to satisfy `&'a T: Foo` when checking that this impl is WF +// that can either be satisfied via the param-env, or via an impl. +// +// When satisfied via the param-env, since each lifetime is canonicalized +// separately, we end up getting extra region constraints. +// +// However, when satisfied via the impl, there are no region constraints, +// and we can short-circuit a response with no external constraints. + +fn main() {} diff --git a/tests/ui/traits/new-solver/prefer-param-env-on-ambiguity.rs b/tests/ui/traits/new-solver/prefer-param-env-on-ambiguity.rs new file mode 100644 index 000000000..909b33ec3 --- /dev/null +++ b/tests/ui/traits/new-solver/prefer-param-env-on-ambiguity.rs @@ -0,0 +1,10 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +trait Foo<'a> {} +trait Bar<'a> {} + +impl<'a, T: Bar<'a>> Foo<'a> for T {} +impl Bar<'static> for T {} + +fn main() {} diff --git a/tests/ui/traits/new-solver/projection-discr-kind.rs b/tests/ui/traits/new-solver/projection-discr-kind.rs new file mode 100644 index 000000000..20296b287 --- /dev/null +++ b/tests/ui/traits/new-solver/projection-discr-kind.rs @@ -0,0 +1,18 @@ +// compile-flags: -Ztrait-solver=next + +// Check that `::Discriminant` doesn't normalize +// to itself and cause overflow/ambiguity. + +trait Foo { + type Assoc; +} + +trait Bar {} +fn needs_bar(_: impl Bar) {} + +fn foo(x: T::Assoc) { + needs_bar(std::mem::discriminant(&x)); + //~^ ERROR the trait bound `Discriminant<::Assoc>: Bar` is not satisfied +} + +fn main() {} diff --git a/tests/ui/traits/new-solver/projection-discr-kind.stderr b/tests/ui/traits/new-solver/projection-discr-kind.stderr new file mode 100644 index 000000000..03e28f993 --- /dev/null +++ b/tests/ui/traits/new-solver/projection-discr-kind.stderr @@ -0,0 +1,17 @@ +error[E0277]: the trait bound `Discriminant<::Assoc>: Bar` is not satisfied + --> $DIR/projection-discr-kind.rs:14:15 + | +LL | needs_bar(std::mem::discriminant(&x)); + | --------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `Discriminant<::Assoc>` + | | + | required by a bound introduced by this call + | +note: required by a bound in `needs_bar` + --> $DIR/projection-discr-kind.rs:11:22 + | +LL | fn needs_bar(_: impl Bar) {} + | ^^^ required by this bound in `needs_bar` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/new-solver/recursive-self-normalization-2.rs b/tests/ui/traits/new-solver/recursive-self-normalization-2.rs new file mode 100644 index 000000000..8c029f517 --- /dev/null +++ b/tests/ui/traits/new-solver/recursive-self-normalization-2.rs @@ -0,0 +1,19 @@ +// compile-flags: -Ztrait-solver=next + +trait Foo1 { + type Assoc1; +} + +trait Foo2 { + type Assoc2; +} + +trait Bar {} +fn needs_bar() {} + +fn test::Assoc2> + Foo2::Assoc1>>() { + needs_bar::(); + //~^ ERROR overflow evaluating the requirement `::Assoc1: Bar` +} + +fn main() {} diff --git a/tests/ui/traits/new-solver/recursive-self-normalization-2.stderr b/tests/ui/traits/new-solver/recursive-self-normalization-2.stderr new file mode 100644 index 000000000..139b0a456 --- /dev/null +++ b/tests/ui/traits/new-solver/recursive-self-normalization-2.stderr @@ -0,0 +1,16 @@ +error[E0275]: overflow evaluating the requirement `::Assoc1: Bar` + --> $DIR/recursive-self-normalization-2.rs:15:5 + | +LL | needs_bar::(); + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursive_self_normalization_2`) +note: required by a bound in `needs_bar` + --> $DIR/recursive-self-normalization-2.rs:12:17 + | +LL | fn needs_bar() {} + | ^^^ required by this bound in `needs_bar` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/traits/new-solver/recursive-self-normalization.rs b/tests/ui/traits/new-solver/recursive-self-normalization.rs new file mode 100644 index 000000000..06d187b5f --- /dev/null +++ b/tests/ui/traits/new-solver/recursive-self-normalization.rs @@ -0,0 +1,15 @@ +// compile-flags: -Ztrait-solver=next + +trait Foo { + type Assoc; +} + +trait Bar {} +fn needs_bar() {} + +fn test::Assoc>>() { + needs_bar::(); + //~^ ERROR overflow evaluating the requirement `::Assoc: Bar` +} + +fn main() {} diff --git a/tests/ui/traits/new-solver/recursive-self-normalization.stderr b/tests/ui/traits/new-solver/recursive-self-normalization.stderr new file mode 100644 index 000000000..8e9b9b4b4 --- /dev/null +++ b/tests/ui/traits/new-solver/recursive-self-normalization.stderr @@ -0,0 +1,16 @@ +error[E0275]: overflow evaluating the requirement `::Assoc: Bar` + --> $DIR/recursive-self-normalization.rs:11:5 + | +LL | needs_bar::(); + | ^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursive_self_normalization`) +note: required by a bound in `needs_bar` + --> $DIR/recursive-self-normalization.rs:8:17 + | +LL | fn needs_bar() {} + | ^^^ required by this bound in `needs_bar` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/traits/new-solver/runaway-impl-candidate-selection.rs b/tests/ui/traits/new-solver/runaway-impl-candidate-selection.rs new file mode 100644 index 000000000..1dca86d36 --- /dev/null +++ b/tests/ui/traits/new-solver/runaway-impl-candidate-selection.rs @@ -0,0 +1,15 @@ +// compile-flags: -Ztrait-solver=next + +// In the new solver, we are trying to select `::Item: Debug`, +// which, naively can be unified with every impl of `Debug` if we're not careful. +// This test makes sure that we treat projections with inference var substs as +// placeholders during fast reject. + +fn iter() -> ::Item { + todo!() +} + +fn main() { + println!("{:?}", iter::<_>()); + //~^ ERROR type annotations needed +} diff --git a/tests/ui/traits/new-solver/runaway-impl-candidate-selection.stderr b/tests/ui/traits/new-solver/runaway-impl-candidate-selection.stderr new file mode 100644 index 000000000..47004821a --- /dev/null +++ b/tests/ui/traits/new-solver/runaway-impl-candidate-selection.stderr @@ -0,0 +1,9 @@ +error[E0282]: type annotations needed + --> $DIR/runaway-impl-candidate-selection.rs:13:22 + | +LL | println!("{:?}", iter::<_>()); + | ^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `iter` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/traits/new-solver/specialization-transmute.rs b/tests/ui/traits/new-solver/specialization-transmute.rs new file mode 100644 index 000000000..a54701df4 --- /dev/null +++ b/tests/ui/traits/new-solver/specialization-transmute.rs @@ -0,0 +1,30 @@ +// compile-flags: -Ztrait-solver=next + +#![feature(specialization)] +//~^ WARN the feature `specialization` is incomplete + +trait Default { + type Id; + + fn intu(&self) -> &Self::Id; +} + +impl Default for T { + default type Id = T; + + fn intu(&self) -> &Self::Id { + self + //~^ ERROR cannot satisfy `T <: ::Id` + } +} + +fn transmute, U: Copy>(t: T) -> U { + *t.intu() +} + +use std::num::NonZeroU8; +fn main() { + let s = transmute::>(0); + //~^ ERROR cannot satisfy `::Id == Option + assert_eq!(s, None); +} diff --git a/tests/ui/traits/new-solver/specialization-transmute.stderr b/tests/ui/traits/new-solver/specialization-transmute.stderr new file mode 100644 index 000000000..e67c56afc --- /dev/null +++ b/tests/ui/traits/new-solver/specialization-transmute.stderr @@ -0,0 +1,31 @@ +warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/specialization-transmute.rs:3:12 + | +LL | #![feature(specialization)] + | ^^^^^^^^^^^^^^ + | + = note: see issue #31844 for more information + = help: consider using `min_specialization` instead, which is more stable and complete + = note: `#[warn(incomplete_features)]` on by default + +error[E0284]: type annotations needed: cannot satisfy `T <: ::Id` + --> $DIR/specialization-transmute.rs:16:9 + | +LL | self + | ^^^^ cannot satisfy `T <: ::Id` + +error[E0284]: type annotations needed: cannot satisfy `::Id == Option` + --> $DIR/specialization-transmute.rs:27:13 + | +LL | let s = transmute::>(0); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `::Id == Option` + | +note: required by a bound in `transmute` + --> $DIR/specialization-transmute.rs:21:25 + | +LL | fn transmute, U: Copy>(t: T) -> U { + | ^^^^^^ required by this bound in `transmute` + +error: aborting due to 2 previous errors; 1 warning emitted + +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/traits/new-solver/specialization-unconstrained.rs b/tests/ui/traits/new-solver/specialization-unconstrained.rs new file mode 100644 index 000000000..02150689e --- /dev/null +++ b/tests/ui/traits/new-solver/specialization-unconstrained.rs @@ -0,0 +1,22 @@ +// compile-flags: -Ztrait-solver=next + +#![feature(specialization)] +//~^ WARN the feature `specialization` is incomplete + +// Do not treat the RHS of a projection-goal as an unconstrained `Certainty::Yes` response +// if the impl is still further specializable. + +trait Default { + type Id; +} + +impl Default for T { + default type Id = T; +} + +fn test, U>() {} + +fn main() { + test::(); + //~^ ERROR cannot satisfy `::Id == ()` +} diff --git a/tests/ui/traits/new-solver/specialization-unconstrained.stderr b/tests/ui/traits/new-solver/specialization-unconstrained.stderr new file mode 100644 index 000000000..910925cba --- /dev/null +++ b/tests/ui/traits/new-solver/specialization-unconstrained.stderr @@ -0,0 +1,25 @@ +warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/specialization-unconstrained.rs:3:12 + | +LL | #![feature(specialization)] + | ^^^^^^^^^^^^^^ + | + = note: see issue #31844 for more information + = help: consider using `min_specialization` instead, which is more stable and complete + = note: `#[warn(incomplete_features)]` on by default + +error[E0284]: type annotations needed: cannot satisfy `::Id == ()` + --> $DIR/specialization-unconstrained.rs:20:5 + | +LL | test::(); + | ^^^^^^^^^^^^^^^ cannot satisfy `::Id == ()` + | +note: required by a bound in `test` + --> $DIR/specialization-unconstrained.rs:17:20 + | +LL | fn test, U>() {} + | ^^^^^^ required by this bound in `test` + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/traits/new-solver/stall-num-var-auto-trait.fallback.stderr b/tests/ui/traits/new-solver/stall-num-var-auto-trait.fallback.stderr new file mode 100644 index 000000000..a3ab7836c --- /dev/null +++ b/tests/ui/traits/new-solver/stall-num-var-auto-trait.fallback.stderr @@ -0,0 +1,17 @@ +error[E0277]: the trait bound `i32: Foo` is not satisfied + --> $DIR/stall-num-var-auto-trait.rs:18:15 + | +LL | needs_foo(x); + | --------- ^ the trait `Foo` is not implemented for `i32` + | | + | required by a bound introduced by this call + | +note: required by a bound in `needs_foo` + --> $DIR/stall-num-var-auto-trait.rs:14:22 + | +LL | fn needs_foo(x: impl Foo) {} + | ^^^ required by this bound in `needs_foo` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/new-solver/stall-num-var-auto-trait.rs b/tests/ui/traits/new-solver/stall-num-var-auto-trait.rs new file mode 100644 index 000000000..0539c3a42 --- /dev/null +++ b/tests/ui/traits/new-solver/stall-num-var-auto-trait.rs @@ -0,0 +1,25 @@ +// compile-flags: -Ztrait-solver=next +// revisions: fallback constrain +//[constrain] check-pass + +// Tests that we stall the `{integer}: Foo` obligation until after we +// constrain the int type (or fallback occurs). + +#![feature(negative_impls, auto_traits)] + +auto trait Foo {} + +impl !Foo for i32 {} + +fn needs_foo(x: impl Foo) {} + +fn main() { + let mut x = 0; + needs_foo(x); + //[fallback]~^ ERROR the trait bound `i32: Foo` is not satisfied + + #[cfg(constrain)] + { + x = 1u64; + } +} diff --git a/tests/ui/traits/non_lifetime_binders/bad-copy-cond.rs b/tests/ui/traits/non_lifetime_binders/bad-copy-cond.rs new file mode 100644 index 000000000..506cad25f --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/bad-copy-cond.rs @@ -0,0 +1,9 @@ +#![feature(non_lifetime_binders)] +//~^ WARN the feature `non_lifetime_binders` is incomplete + +fn foo() where for T: Copy {} + +fn main() { + foo(); + //~^ ERROR the trait bound `T: Copy` is not satisfied +} diff --git a/tests/ui/traits/non_lifetime_binders/bad-copy-cond.stderr b/tests/ui/traits/non_lifetime_binders/bad-copy-cond.stderr new file mode 100644 index 000000000..07e02d47f --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/bad-copy-cond.stderr @@ -0,0 +1,24 @@ +warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/bad-copy-cond.rs:1:12 + | +LL | #![feature(non_lifetime_binders)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #108185 for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0277]: the trait bound `T: Copy` is not satisfied + --> $DIR/bad-copy-cond.rs:7:5 + | +LL | foo(); + | ^^^ the trait `Copy` is not implemented for `T` + | +note: required by a bound in `foo` + --> $DIR/bad-copy-cond.rs:4:26 + | +LL | fn foo() where for T: Copy {} + | ^^^^ required by this bound in `foo` + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.rs b/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.rs new file mode 100644 index 000000000..91c6dfb8e --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.rs @@ -0,0 +1,11 @@ +#![feature(non_lifetime_binders)] +//~^ WARN the feature `non_lifetime_binders` is incomplete + +fn b() +where + for [(); C]: Copy, + //~^ ERROR cannot capture late-bound const parameter in a constant +{ +} + +fn main() {} diff --git a/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.stderr b/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.stderr new file mode 100644 index 000000000..69bb605bf --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.stderr @@ -0,0 +1,19 @@ +warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/capture-late-ct-in-anon.rs:1:12 + | +LL | #![feature(non_lifetime_binders)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #108185 for more information + = note: `#[warn(incomplete_features)]` on by default + +error: cannot capture late-bound const parameter in a constant + --> $DIR/capture-late-ct-in-anon.rs:6:30 + | +LL | for [(); C]: Copy, + | -------------- ^ + | | + | parameter defined here + +error: aborting due to previous error; 1 warning emitted + diff --git a/tests/ui/traits/non_lifetime_binders/method-probe.rs b/tests/ui/traits/non_lifetime_binders/method-probe.rs new file mode 100644 index 000000000..8df240c20 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/method-probe.rs @@ -0,0 +1,16 @@ +// check-pass + +#![feature(non_lifetime_binders)] +//~^ WARN the feature `non_lifetime_binders` is incomplete + +trait Foo: for Bar {} + +trait Bar { + fn method() -> T; +} + +fn x() { + let _: i32 = T::method(); +} + +fn main() {} diff --git a/tests/ui/traits/non_lifetime_binders/method-probe.stderr b/tests/ui/traits/non_lifetime_binders/method-probe.stderr new file mode 100644 index 000000000..8f61792e6 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/method-probe.stderr @@ -0,0 +1,11 @@ +warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/method-probe.rs:3:12 + | +LL | #![feature(non_lifetime_binders)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #108185 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/traits/non_lifetime_binders/missing-assoc-item.rs b/tests/ui/traits/non_lifetime_binders/missing-assoc-item.rs new file mode 100644 index 000000000..50f0152e9 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/missing-assoc-item.rs @@ -0,0 +1,11 @@ +#![feature(non_lifetime_binders)] +//~^ WARN the feature `non_lifetime_binders` is incomplete + +fn f() +where + for B::Item: Send, + //~^ ERROR ambiguous associated type +{ +} + +fn main() {} diff --git a/tests/ui/traits/non_lifetime_binders/missing-assoc-item.stderr b/tests/ui/traits/non_lifetime_binders/missing-assoc-item.stderr new file mode 100644 index 000000000..d98538642 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/missing-assoc-item.stderr @@ -0,0 +1,23 @@ +warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/missing-assoc-item.rs:1:12 + | +LL | #![feature(non_lifetime_binders)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #108185 for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0223]: ambiguous associated type + --> $DIR/missing-assoc-item.rs:6:12 + | +LL | for B::Item: Send, + | ^^^^^^^ + | +help: if there were a trait named `Example` with associated type `Item` implemented for `B`, you could use the fully-qualified path + | +LL | for ::Item: Send, + | ~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0223`. diff --git a/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.rs b/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.rs new file mode 100644 index 000000000..a635edb44 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.rs @@ -0,0 +1,24 @@ +#![feature(non_lifetime_binders)] +//~^ WARN the feature `non_lifetime_binders` is incomplete + +trait Foo: for Bar {} + +trait Bar { + fn method(&self) {} +} + +fn needs_bar(x: &(impl Bar + ?Sized)) { + x.method(); +} + +impl Foo for () {} + +impl Bar for () {} + +fn main() { + let x: &dyn Foo = &(); + //~^ ERROR the trait `Foo` cannot be made into an object + //~| ERROR the trait `Foo` cannot be made into an object + needs_bar(x); + //~^ ERROR the trait `Foo` cannot be made into an object +} diff --git a/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr b/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr new file mode 100644 index 000000000..47fa29b66 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr @@ -0,0 +1,56 @@ +warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/supertrait-object-safety.rs:1:12 + | +LL | #![feature(non_lifetime_binders)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #108185 for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/supertrait-object-safety.rs:19:23 + | +LL | let x: &dyn Foo = &(); + | ^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/supertrait-object-safety.rs:4:12 + | +LL | trait Foo: for Bar {} + | --- ^^^^^^^^^^^^^ ...because where clause cannot reference non-lifetime `for<...>` variables + | | + | this trait cannot be made into an object... + = note: required for `&()` to implement `CoerceUnsized<&dyn Foo>` + = note: required by cast to type `&dyn Foo` + +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/supertrait-object-safety.rs:19:12 + | +LL | let x: &dyn Foo = &(); + | ^^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/supertrait-object-safety.rs:4:12 + | +LL | trait Foo: for Bar {} + | --- ^^^^^^^^^^^^^ ...because where clause cannot reference non-lifetime `for<...>` variables + | | + | this trait cannot be made into an object... + +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/supertrait-object-safety.rs:22:5 + | +LL | needs_bar(x); + | ^^^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/supertrait-object-safety.rs:4:12 + | +LL | trait Foo: for Bar {} + | --- ^^^^^^^^^^^^^ ...because where clause cannot reference non-lifetime `for<...>` variables + | | + | this trait cannot be made into an object... + +error: aborting due to 3 previous errors; 1 warning emitted + +For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/traits/reservation-impl/coherence-conflict.next.stderr b/tests/ui/traits/reservation-impl/coherence-conflict.next.stderr new file mode 100644 index 000000000..e5a3c3f5c --- /dev/null +++ b/tests/ui/traits/reservation-impl/coherence-conflict.next.stderr @@ -0,0 +1,11 @@ +error[E0119]: conflicting implementations of trait `OtherTrait` for type `()` + --> $DIR/coherence-conflict.rs:12:1 + | +LL | impl OtherTrait for () {} + | ---------------------- first implementation here +LL | impl OtherTrait for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/traits/reservation-impl/coherence-conflict.old.stderr b/tests/ui/traits/reservation-impl/coherence-conflict.old.stderr new file mode 100644 index 000000000..393350ea3 --- /dev/null +++ b/tests/ui/traits/reservation-impl/coherence-conflict.old.stderr @@ -0,0 +1,13 @@ +error[E0119]: conflicting implementations of trait `OtherTrait` for type `()` + --> $DIR/coherence-conflict.rs:12:1 + | +LL | impl OtherTrait for () {} + | ---------------------- first implementation here +LL | impl OtherTrait for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()` + | + = note: this impl is reserved + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/traits/reservation-impl/coherence-conflict.rs b/tests/ui/traits/reservation-impl/coherence-conflict.rs index fa4a30931..6bbd90f94 100644 --- a/tests/ui/traits/reservation-impl/coherence-conflict.rs +++ b/tests/ui/traits/reservation-impl/coherence-conflict.rs @@ -1,5 +1,6 @@ // check that reservation impls are accounted for in negative reasoning. - +// revisions: old next +//[next] compile-flags: -Ztrait-solver=next #![feature(rustc_attrs)] trait MyTrait {} diff --git a/tests/ui/traits/reservation-impl/coherence-conflict.stderr b/tests/ui/traits/reservation-impl/coherence-conflict.stderr deleted file mode 100644 index a811d7e32..000000000 --- a/tests/ui/traits/reservation-impl/coherence-conflict.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0119]: conflicting implementations of trait `OtherTrait` for type `()` - --> $DIR/coherence-conflict.rs:11:1 - | -LL | impl OtherTrait for () {} - | ---------------------- first implementation here -LL | impl OtherTrait for T {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()` - | - = note: this impl is reserved - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/traits/reservation-impl/no-use.next.stderr b/tests/ui/traits/reservation-impl/no-use.next.stderr new file mode 100644 index 000000000..542e3a28a --- /dev/null +++ b/tests/ui/traits/reservation-impl/no-use.next.stderr @@ -0,0 +1,13 @@ +error[E0277]: the trait bound `(): MyTrait` is not satisfied + --> $DIR/no-use.rs:11:26 + | +LL | <() as MyTrait>::foo(&()); + | -------------------- ^^^ the trait `MyTrait` is not implemented for `()` + | | + | required by a bound introduced by this call + | + = help: the trait `MyTrait` is implemented for `()` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/reservation-impl/no-use.old.stderr b/tests/ui/traits/reservation-impl/no-use.old.stderr new file mode 100644 index 000000000..542e3a28a --- /dev/null +++ b/tests/ui/traits/reservation-impl/no-use.old.stderr @@ -0,0 +1,13 @@ +error[E0277]: the trait bound `(): MyTrait` is not satisfied + --> $DIR/no-use.rs:11:26 + | +LL | <() as MyTrait>::foo(&()); + | -------------------- ^^^ the trait `MyTrait` is not implemented for `()` + | | + | required by a bound introduced by this call + | + = help: the trait `MyTrait` is implemented for `()` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/reservation-impl/no-use.rs b/tests/ui/traits/reservation-impl/no-use.rs index 65a55d9e2..864f1791f 100644 --- a/tests/ui/traits/reservation-impl/no-use.rs +++ b/tests/ui/traits/reservation-impl/no-use.rs @@ -1,5 +1,6 @@ // check that reservation impls can't be used as normal impls in positive reasoning. - +// revisions: old next +//[next] compile-flags: -Ztrait-solver=next #![feature(rustc_attrs)] trait MyTrait { fn foo(&self); } diff --git a/tests/ui/traits/reservation-impl/no-use.stderr b/tests/ui/traits/reservation-impl/no-use.stderr deleted file mode 100644 index cefb2a879..000000000 --- a/tests/ui/traits/reservation-impl/no-use.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0277]: the trait bound `(): MyTrait` is not satisfied - --> $DIR/no-use.rs:10:26 - | -LL | <() as MyTrait>::foo(&()); - | -------------------- ^^^ the trait `MyTrait` is not implemented for `()` - | | - | required by a bound introduced by this call - | - = help: the trait `MyTrait` is implemented for `()` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/reservation-impl/non-lattice-ok.rs b/tests/ui/traits/reservation-impl/non-lattice-ok.rs index a71051243..7787904d9 100644 --- a/tests/ui/traits/reservation-impl/non-lattice-ok.rs +++ b/tests/ui/traits/reservation-impl/non-lattice-ok.rs @@ -30,6 +30,12 @@ // // [ii]: https://smallcultfollowing.com/babysteps/blog/2016/09/24/intersection-impls/ + +// check that reservation impls can't be used as normal impls in positive reasoning. + +// revisions: old next +//[next] compile-flags: -Ztrait-solver=next + #![feature(rustc_attrs, never_type)] trait MyTrait {} diff --git a/tests/ui/traits/reservation-impl/ok.rs b/tests/ui/traits/reservation-impl/ok.rs index 611c8d884..8ff6645a2 100644 --- a/tests/ui/traits/reservation-impl/ok.rs +++ b/tests/ui/traits/reservation-impl/ok.rs @@ -3,6 +3,9 @@ // rpass test for reservation impls. Not 100% required because `From` uses them, // but still. +// revisions: old next +//[next] compile-flags: -Ztrait-solver=next + #![feature(rustc_attrs)] use std::mem; diff --git a/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs b/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs new file mode 100644 index 000000000..d37943b92 --- /dev/null +++ b/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs @@ -0,0 +1,34 @@ +//~ ERROR overflow +// A regression test for #111729 checking that we correctly +// track recursion depth for obligations returned by confirmation. +use std::panic::RefUnwindSafe; + +trait Database { + type Storage; +} +trait Query { + type Data; +} +struct ParseQuery; +struct RootDatabase { + _runtime: Runtime, +} + +impl Database for T { + type Storage = SalsaStorage; +} +impl Database for RootDatabase { + type Storage = SalsaStorage; +} + +struct Runtime { + _storage: Box, +} +struct SalsaStorage { + _parse: >::Data, +} + +impl Query for ParseQuery { + type Data = RootDatabase; +} +fn main() {} diff --git a/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr b/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr new file mode 100644 index 000000000..8f9ce3ef1 --- /dev/null +++ b/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr @@ -0,0 +1,24 @@ +error[E0275]: overflow evaluating the requirement `Runtime: RefUnwindSafe` + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`cycle_via_builtin_auto_trait_impl`) +note: required because it appears within the type `RootDatabase` + --> $DIR/cycle-via-builtin-auto-trait-impl.rs:13:8 + | +LL | struct RootDatabase { + | ^^^^^^^^^^^^ +note: required for `RootDatabase` to implement `Database` + --> $DIR/cycle-via-builtin-auto-trait-impl.rs:17:24 + | +LL | impl Database for T { + | ------------- ^^^^^^^^ ^ + | | + | unsatisfied trait bound introduced here +note: required because it appears within the type `Runtime` + --> $DIR/cycle-via-builtin-auto-trait-impl.rs:24:8 + | +LL | struct Runtime { + | ^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/traits/trait-upcasting/alias-where-clause-isnt-supertrait.rs b/tests/ui/traits/trait-upcasting/alias-where-clause-isnt-supertrait.rs new file mode 100644 index 000000000..4a5e445d1 --- /dev/null +++ b/tests/ui/traits/trait-upcasting/alias-where-clause-isnt-supertrait.rs @@ -0,0 +1,33 @@ +#![feature(trait_upcasting)] +#![feature(trait_alias)] + +// Although we *elaborate* `T: Alias` to `i32: B`, we should +// not consider `B` to be a supertrait of the type. +trait Alias = A where i32: B; + +trait A {} + +trait B { + fn test(&self); +} + +trait C: Alias {} + +impl A for () {} + +impl C for () {} + +impl B for i32 { + fn test(&self) { + println!("hi {self}"); + } +} + +fn test(x: &dyn C) -> &dyn B { + x + //~^ ERROR mismatched types +} + +fn main() { + let x: &dyn C = &(); +} diff --git a/tests/ui/traits/trait-upcasting/alias-where-clause-isnt-supertrait.stderr b/tests/ui/traits/trait-upcasting/alias-where-clause-isnt-supertrait.stderr new file mode 100644 index 000000000..5574a0320 --- /dev/null +++ b/tests/ui/traits/trait-upcasting/alias-where-clause-isnt-supertrait.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/alias-where-clause-isnt-supertrait.rs:27:5 + | +LL | fn test(x: &dyn C) -> &dyn B { + | ------ expected `&dyn B` because of return type +LL | x + | ^ expected trait `B`, found trait `C` + | + = note: expected reference `&dyn B` + found reference `&dyn C` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/traits/trait-upcasting/cyclic-trait-resolution.stderr b/tests/ui/traits/trait-upcasting/cyclic-trait-resolution.stderr index 15faab16a..ca98e1831 100644 --- a/tests/ui/traits/trait-upcasting/cyclic-trait-resolution.stderr +++ b/tests/ui/traits/trait-upcasting/cyclic-trait-resolution.stderr @@ -1,15 +1,10 @@ error[E0391]: cycle detected when computing the super predicates of `A` - --> $DIR/cyclic-trait-resolution.rs:1:1 - | -LL | trait A: B + A {} - | ^^^^^^^^^^^^^^ - | -note: ...which requires computing the super traits of `A`... --> $DIR/cyclic-trait-resolution.rs:1:14 | LL | trait A: B + A {} | ^ - = note: ...which again requires computing the super predicates of `A`, completing the cycle + | + = note: ...which immediately requires computing the super predicates of `A` again note: cycle used when collecting item types in top-level module --> $DIR/cyclic-trait-resolution.rs:1:1 | diff --git a/tests/ui/traits/wrong-mul-method-signature.rs b/tests/ui/traits/wrong-mul-method-signature.rs new file mode 100644 index 000000000..1c2f86559 --- /dev/null +++ b/tests/ui/traits/wrong-mul-method-signature.rs @@ -0,0 +1,68 @@ +// This test is to make sure we don't just ICE if the trait +// method for an operator is not implemented properly. +// (In this case the mul method should take &f64 and not f64) +// See: #11450 + +use std::ops::Mul; + +struct Vec1 { + x: f64 +} + +// Expecting value in input signature +impl Mul for Vec1 { + type Output = Vec1; + + fn mul(self, s: &f64) -> Vec1 { + //~^ ERROR method `mul` has an incompatible type for trait + Vec1 { + x: self.x * *s + } + } +} + +struct Vec2 { + x: f64, + y: f64 +} + +// Wrong type parameter ordering +impl Mul for Vec2 { + type Output = f64; + + fn mul(self, s: f64) -> Vec2 { + //~^ ERROR method `mul` has an incompatible type for trait + Vec2 { + x: self.x * s, + y: self.y * s + } + } +} + +struct Vec3 { + x: f64, + y: f64, + z: f64 +} + +// Unexpected return type +impl Mul for Vec3 { + type Output = i32; + + fn mul(self, s: f64) -> f64 { + //~^ ERROR method `mul` has an incompatible type for trait + s + } +} + +pub fn main() { + // Check that the usage goes from the trait declaration: + + let x: Vec1 = Vec1 { x: 1.0 } * 2.0; // this is OK + + let x: Vec2 = Vec2 { x: 1.0, y: 2.0 } * 2.0; // trait had reversed order + //~^ ERROR mismatched types + //~| ERROR mismatched types + + let x: i32 = Vec3 { x: 1.0, y: 2.0, z: 3.0 } * 2.0; +} diff --git a/tests/ui/traits/wrong-mul-method-signature.stderr b/tests/ui/traits/wrong-mul-method-signature.stderr new file mode 100644 index 000000000..25a92f5ec --- /dev/null +++ b/tests/ui/traits/wrong-mul-method-signature.stderr @@ -0,0 +1,56 @@ +error[E0053]: method `mul` has an incompatible type for trait + --> $DIR/wrong-mul-method-signature.rs:16:21 + | +LL | fn mul(self, s: &f64) -> Vec1 { + | ^^^^ + | | + | expected `f64`, found `&f64` + | help: change the parameter type to match the trait: `f64` + | + = note: expected signature `fn(Vec1, f64) -> Vec1` + found signature `fn(Vec1, &f64) -> Vec1` + +error[E0053]: method `mul` has an incompatible type for trait + --> $DIR/wrong-mul-method-signature.rs:33:21 + | +LL | fn mul(self, s: f64) -> Vec2 { + | ^^^ + | | + | expected `Vec2`, found `f64` + | help: change the parameter type to match the trait: `Vec2` + | + = note: expected signature `fn(Vec2, Vec2) -> f64` + found signature `fn(Vec2, f64) -> Vec2` + +error[E0053]: method `mul` has an incompatible type for trait + --> $DIR/wrong-mul-method-signature.rs:52:29 + | +LL | fn mul(self, s: f64) -> f64 { + | ^^^ + | | + | expected `i32`, found `f64` + | help: change the output type to match the trait: `i32` + | + = note: expected signature `fn(Vec3, _) -> i32` + found signature `fn(Vec3, _) -> f64` + +error[E0308]: mismatched types + --> $DIR/wrong-mul-method-signature.rs:63:45 + | +LL | let x: Vec2 = Vec2 { x: 1.0, y: 2.0 } * 2.0; // trait had reversed order + | ----------------------- ^^^ expected `Vec2`, found floating-point number + | | + | expected because this is `Vec2` + +error[E0308]: mismatched types + --> $DIR/wrong-mul-method-signature.rs:63:19 + | +LL | let x: Vec2 = Vec2 { x: 1.0, y: 2.0 } * 2.0; // trait had reversed order + | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Vec2`, found `f64` + | | + | expected due to this + +error: aborting due to 5 previous errors + +Some errors have detailed explanations: E0053, E0308. +For more information about an error, try `rustc --explain E0053`. diff --git a/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr b/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr index 164e88ede..1a0a5d3ae 100644 --- a/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr +++ b/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr @@ -1,10 +1,9 @@ -error[E0277]: `[String; 0]` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. +error[E0277]: `[String; 0]` cannot be safely transmuted into `()` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:26:52 | LL | assert::is_maybe_transmutable::(); - | ^^ `[String; 0]` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. + | ^^ `[String; 0]` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom<[String; 0], assert::Context, Assume { alignment: true, lifetimes: true, safety: true, validity: true }>` is not implemented for `()` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 | @@ -20,13 +19,12 @@ LL | | .and(Assume::VALIDITY) LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `[String; 0]` in the defining scope of `assert::Context`. +error[E0277]: `u128` cannot be safely transmuted into `[String; 0]` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:27:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `u128` cannot be safely transmuted into `[String; 0]` in the defining scope of `assert::Context`. + | ^^^^^^^^^ `[String; 0]` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `[String; 0]` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 | @@ -42,13 +40,12 @@ LL | | .and(Assume::VALIDITY) LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `[String; 1]` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. +error[E0277]: `[String; 1]` cannot be safely transmuted into `()` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:32:52 | LL | assert::is_maybe_transmutable::(); - | ^^ `[String; 1]` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. + | ^^ `[String; 1]` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom<[String; 1], assert::Context, Assume { alignment: true, lifetimes: true, safety: true, validity: true }>` is not implemented for `()` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 | @@ -64,13 +61,12 @@ LL | | .and(Assume::VALIDITY) LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `[String; 1]` in the defining scope of `assert::Context`. +error[E0277]: `u128` cannot be safely transmuted into `[String; 1]` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:33:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `u128` cannot be safely transmuted into `[String; 1]` in the defining scope of `assert::Context`. + | ^^^^^^^^^ `[String; 1]` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `[String; 1]` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 | @@ -86,13 +82,12 @@ LL | | .and(Assume::VALIDITY) LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `[String; 2]` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. +error[E0277]: `[String; 2]` cannot be safely transmuted into `()` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:38:52 | LL | assert::is_maybe_transmutable::(); - | ^^ `[String; 2]` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. + | ^^ `[String; 2]` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom<[String; 2], assert::Context, Assume { alignment: true, lifetimes: true, safety: true, validity: true }>` is not implemented for `()` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 | @@ -108,13 +103,12 @@ LL | | .and(Assume::VALIDITY) LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `[String; 2]` in the defining scope of `assert::Context`. +error[E0277]: `u128` cannot be safely transmuted into `[String; 2]` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:39:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `u128` cannot be safely transmuted into `[String; 2]` in the defining scope of `assert::Context`. + | ^^^^^^^^^ `[String; 2]` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `[String; 2]` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 | diff --git a/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr b/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr index 0f0f77f16..9877a6606 100644 --- a/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr +++ b/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr @@ -1,10 +1,9 @@ -error[E0277]: `Zst` cannot be safely transmuted into `V0i8` in the defining scope of `n8::Context`. +error[E0277]: `Zst` cannot be safely transmuted into `V0i8` in the defining scope of `n8::Context` --> $DIR/primitive_reprs_should_have_correct_length.rs:48:44 | LL | assert::is_transmutable::(); - | ^^^^^^^ `Zst` cannot be safely transmuted into `V0i8` in the defining scope of `n8::Context`. + | ^^^^^^^ The size of `Zst` is smaller than the size of `V0i8` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0i8` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | @@ -21,13 +20,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `V0i8` cannot be safely transmuted into `u16` in the defining scope of `n8::Context`. +error[E0277]: `V0i8` cannot be safely transmuted into `u16` in the defining scope of `n8::Context` --> $DIR/primitive_reprs_should_have_correct_length.rs:50:44 | LL | assert::is_transmutable::(); - | ^^^^^^ `V0i8` cannot be safely transmuted into `u16` in the defining scope of `n8::Context`. + | ^^^^^^ The size of `V0i8` is smaller than the size of `u16` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u16` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | @@ -44,13 +42,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `Zst` cannot be safely transmuted into `V0u8` in the defining scope of `n8::Context`. +error[E0277]: `Zst` cannot be safely transmuted into `V0u8` in the defining scope of `n8::Context` --> $DIR/primitive_reprs_should_have_correct_length.rs:56:44 | LL | assert::is_transmutable::(); - | ^^^^^^^ `Zst` cannot be safely transmuted into `V0u8` in the defining scope of `n8::Context`. + | ^^^^^^^ The size of `Zst` is smaller than the size of `V0u8` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0u8` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | @@ -67,13 +64,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `V0u8` cannot be safely transmuted into `u16` in the defining scope of `n8::Context`. +error[E0277]: `V0u8` cannot be safely transmuted into `u16` in the defining scope of `n8::Context` --> $DIR/primitive_reprs_should_have_correct_length.rs:58:44 | LL | assert::is_transmutable::(); - | ^^^^^^ `V0u8` cannot be safely transmuted into `u16` in the defining scope of `n8::Context`. + | ^^^^^^ The size of `V0u8` is smaller than the size of `u16` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u16` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | @@ -90,13 +86,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `V0i16` in the defining scope of `n16::Context`. +error[E0277]: `u8` cannot be safely transmuted into `V0i16` in the defining scope of `n16::Context` --> $DIR/primitive_reprs_should_have_correct_length.rs:72:44 | LL | assert::is_transmutable::(); - | ^^^^^^^ `u8` cannot be safely transmuted into `V0i16` in the defining scope of `n16::Context`. + | ^^^^^^^ At least one value of `u8` isn't a bit-valid value of `V0i16` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0i16` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | @@ -113,13 +108,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `V0i16` cannot be safely transmuted into `u32` in the defining scope of `n16::Context`. +error[E0277]: `V0i16` cannot be safely transmuted into `u32` in the defining scope of `n16::Context` --> $DIR/primitive_reprs_should_have_correct_length.rs:74:44 | LL | assert::is_transmutable::(); - | ^^^^^^ `V0i16` cannot be safely transmuted into `u32` in the defining scope of `n16::Context`. + | ^^^^^^ The size of `V0i16` is smaller than the size of `u32` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u32` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | @@ -136,13 +130,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `V0u16` in the defining scope of `n16::Context`. +error[E0277]: `u8` cannot be safely transmuted into `V0u16` in the defining scope of `n16::Context` --> $DIR/primitive_reprs_should_have_correct_length.rs:80:44 | LL | assert::is_transmutable::(); - | ^^^^^^^ `u8` cannot be safely transmuted into `V0u16` in the defining scope of `n16::Context`. + | ^^^^^^^ At least one value of `u8` isn't a bit-valid value of `V0u16` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0u16` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | @@ -159,13 +152,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `V0u16` cannot be safely transmuted into `u32` in the defining scope of `n16::Context`. +error[E0277]: `V0u16` cannot be safely transmuted into `u32` in the defining scope of `n16::Context` --> $DIR/primitive_reprs_should_have_correct_length.rs:82:44 | LL | assert::is_transmutable::(); - | ^^^^^^ `V0u16` cannot be safely transmuted into `u32` in the defining scope of `n16::Context`. + | ^^^^^^ The size of `V0u16` is smaller than the size of `u32` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u32` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | @@ -182,13 +174,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `u16` cannot be safely transmuted into `V0i32` in the defining scope of `n32::Context`. +error[E0277]: `u16` cannot be safely transmuted into `V0i32` in the defining scope of `n32::Context` --> $DIR/primitive_reprs_should_have_correct_length.rs:96:44 | LL | assert::is_transmutable::(); - | ^^^^^^^ `u16` cannot be safely transmuted into `V0i32` in the defining scope of `n32::Context`. + | ^^^^^^^ At least one value of `u16` isn't a bit-valid value of `V0i32` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0i32` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | @@ -205,13 +196,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `V0i32` cannot be safely transmuted into `u64` in the defining scope of `n32::Context`. +error[E0277]: `V0i32` cannot be safely transmuted into `u64` in the defining scope of `n32::Context` --> $DIR/primitive_reprs_should_have_correct_length.rs:98:44 | LL | assert::is_transmutable::(); - | ^^^^^^ `V0i32` cannot be safely transmuted into `u64` in the defining scope of `n32::Context`. + | ^^^^^^ The size of `V0i32` is smaller than the size of `u64` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | @@ -228,13 +218,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `u16` cannot be safely transmuted into `V0u32` in the defining scope of `n32::Context`. +error[E0277]: `u16` cannot be safely transmuted into `V0u32` in the defining scope of `n32::Context` --> $DIR/primitive_reprs_should_have_correct_length.rs:104:44 | LL | assert::is_transmutable::(); - | ^^^^^^^ `u16` cannot be safely transmuted into `V0u32` in the defining scope of `n32::Context`. + | ^^^^^^^ At least one value of `u16` isn't a bit-valid value of `V0u32` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0u32` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | @@ -251,13 +240,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `V0u32` cannot be safely transmuted into `u64` in the defining scope of `n32::Context`. +error[E0277]: `V0u32` cannot be safely transmuted into `u64` in the defining scope of `n32::Context` --> $DIR/primitive_reprs_should_have_correct_length.rs:106:44 | LL | assert::is_transmutable::(); - | ^^^^^^ `V0u32` cannot be safely transmuted into `u64` in the defining scope of `n32::Context`. + | ^^^^^^ The size of `V0u32` is smaller than the size of `u64` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | @@ -274,13 +262,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `u32` cannot be safely transmuted into `V0i64` in the defining scope of `n64::Context`. +error[E0277]: `u32` cannot be safely transmuted into `V0i64` in the defining scope of `n64::Context` --> $DIR/primitive_reprs_should_have_correct_length.rs:120:44 | LL | assert::is_transmutable::(); - | ^^^^^^^ `u32` cannot be safely transmuted into `V0i64` in the defining scope of `n64::Context`. + | ^^^^^^^ At least one value of `u32` isn't a bit-valid value of `V0i64` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0i64` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | @@ -297,13 +284,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `V0i64` cannot be safely transmuted into `u128` in the defining scope of `n64::Context`. +error[E0277]: `V0i64` cannot be safely transmuted into `u128` in the defining scope of `n64::Context` --> $DIR/primitive_reprs_should_have_correct_length.rs:122:44 | LL | assert::is_transmutable::(); - | ^^^^^^ `V0i64` cannot be safely transmuted into `u128` in the defining scope of `n64::Context`. + | ^^^^^^ The size of `V0i64` is smaller than the size of `u128` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | @@ -320,13 +306,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `u32` cannot be safely transmuted into `V0u64` in the defining scope of `n64::Context`. +error[E0277]: `u32` cannot be safely transmuted into `V0u64` in the defining scope of `n64::Context` --> $DIR/primitive_reprs_should_have_correct_length.rs:128:44 | LL | assert::is_transmutable::(); - | ^^^^^^^ `u32` cannot be safely transmuted into `V0u64` in the defining scope of `n64::Context`. + | ^^^^^^^ At least one value of `u32` isn't a bit-valid value of `V0u64` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0u64` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | @@ -343,13 +328,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `V0u64` cannot be safely transmuted into `u128` in the defining scope of `n64::Context`. +error[E0277]: `V0u64` cannot be safely transmuted into `u128` in the defining scope of `n64::Context` --> $DIR/primitive_reprs_should_have_correct_length.rs:130:44 | LL | assert::is_transmutable::(); - | ^^^^^^ `V0u64` cannot be safely transmuted into `u128` in the defining scope of `n64::Context`. + | ^^^^^^ The size of `V0u64` is smaller than the size of `u128` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | @@ -366,13 +350,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `V0isize` in the defining scope of `nsize::Context`. +error[E0277]: `u8` cannot be safely transmuted into `V0isize` in the defining scope of `nsize::Context` --> $DIR/primitive_reprs_should_have_correct_length.rs:144:44 | LL | assert::is_transmutable::(); - | ^^^^^^^ `u8` cannot be safely transmuted into `V0isize` in the defining scope of `nsize::Context`. + | ^^^^^^^ At least one value of `u8` isn't a bit-valid value of `V0isize` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0isize` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | @@ -389,13 +372,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `V0isize` cannot be safely transmuted into `[usize; 2]` in the defining scope of `nsize::Context`. +error[E0277]: `V0isize` cannot be safely transmuted into `[usize; 2]` in the defining scope of `nsize::Context` --> $DIR/primitive_reprs_should_have_correct_length.rs:146:44 | LL | assert::is_transmutable::(); - | ^^^^^^ `V0isize` cannot be safely transmuted into `[usize; 2]` in the defining scope of `nsize::Context`. + | ^^^^^^ The size of `V0isize` is smaller than the size of `[usize; 2]` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `[usize; 2]` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | @@ -412,13 +394,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `V0usize` in the defining scope of `nsize::Context`. +error[E0277]: `u8` cannot be safely transmuted into `V0usize` in the defining scope of `nsize::Context` --> $DIR/primitive_reprs_should_have_correct_length.rs:152:44 | LL | assert::is_transmutable::(); - | ^^^^^^^ `u8` cannot be safely transmuted into `V0usize` in the defining scope of `nsize::Context`. + | ^^^^^^^ At least one value of `u8` isn't a bit-valid value of `V0usize` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0usize` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | @@ -435,13 +416,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `V0usize` cannot be safely transmuted into `[usize; 2]` in the defining scope of `nsize::Context`. +error[E0277]: `V0usize` cannot be safely transmuted into `[usize; 2]` in the defining scope of `nsize::Context` --> $DIR/primitive_reprs_should_have_correct_length.rs:154:44 | LL | assert::is_transmutable::(); - | ^^^^^^ `V0usize` cannot be safely transmuted into `[usize; 2]` in the defining scope of `nsize::Context`. + | ^^^^^^ The size of `V0usize` is smaller than the size of `[usize; 2]` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `[usize; 2]` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | diff --git a/tests/ui/transmutability/enums/repr/should_require_well_defined_layout.stderr b/tests/ui/transmutability/enums/repr/should_require_well_defined_layout.stderr index d456a746f..1612b6b36 100644 --- a/tests/ui/transmutability/enums/repr/should_require_well_defined_layout.stderr +++ b/tests/ui/transmutability/enums/repr/should_require_well_defined_layout.stderr @@ -1,10 +1,9 @@ -error[E0277]: `void::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. +error[E0277]: `void::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:28:52 | LL | assert::is_maybe_transmutable::(); - | ^^ `void::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. + | ^^ `void::repr_rust` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:14:14 | @@ -21,13 +20,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `void::repr_rust` in the defining scope of `assert::Context`. +error[E0277]: `u128` cannot be safely transmuted into `void::repr_rust` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:29:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `u128` cannot be safely transmuted into `void::repr_rust` in the defining scope of `assert::Context`. + | ^^^^^^^^^ `void::repr_rust` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `void::repr_rust` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:14:14 | @@ -44,13 +42,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `singleton::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. +error[E0277]: `singleton::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:34:52 | LL | assert::is_maybe_transmutable::(); - | ^^ `singleton::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. + | ^^ `singleton::repr_rust` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:14:14 | @@ -67,13 +64,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `singleton::repr_rust` in the defining scope of `assert::Context`. +error[E0277]: `u128` cannot be safely transmuted into `singleton::repr_rust` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:35:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `u128` cannot be safely transmuted into `singleton::repr_rust` in the defining scope of `assert::Context`. + | ^^^^^^^^^ `singleton::repr_rust` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `singleton::repr_rust` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:14:14 | @@ -90,13 +86,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `duplex::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. +error[E0277]: `duplex::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:40:52 | LL | assert::is_maybe_transmutable::(); - | ^^ `duplex::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. + | ^^ `duplex::repr_rust` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:14:14 | @@ -113,13 +108,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `duplex::repr_rust` in the defining scope of `assert::Context`. +error[E0277]: `u128` cannot be safely transmuted into `duplex::repr_rust` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:41:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `u128` cannot be safely transmuted into `duplex::repr_rust` in the defining scope of `assert::Context`. + | ^^^^^^^^^ `duplex::repr_rust` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `duplex::repr_rust` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:14:14 | diff --git a/tests/ui/transmutability/enums/should_pad_variants.stderr b/tests/ui/transmutability/enums/should_pad_variants.stderr index f4988239d..bfbef8b25 100644 --- a/tests/ui/transmutability/enums/should_pad_variants.stderr +++ b/tests/ui/transmutability/enums/should_pad_variants.stderr @@ -1,10 +1,9 @@ -error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `should_pad_variants::Context`. +error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `should_pad_variants::Context` --> $DIR/should_pad_variants.rs:44:36 | LL | assert::is_transmutable::(); - | ^^^ `Src` cannot be safely transmuted into `Dst` in the defining scope of `should_pad_variants::Context`. + | ^^^ The size of `Src` is smaller than the size of `Dst` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Dst` note: required by a bound in `is_transmutable` --> $DIR/should_pad_variants.rs:13:14 | diff --git a/tests/ui/transmutability/enums/should_respect_endianness.stderr b/tests/ui/transmutability/enums/should_respect_endianness.stderr index 350583b0b..e59301a8c 100644 --- a/tests/ui/transmutability/enums/should_respect_endianness.stderr +++ b/tests/ui/transmutability/enums/should_respect_endianness.stderr @@ -1,10 +1,9 @@ -error[E0277]: `Src` cannot be safely transmuted into `Unexpected` in the defining scope of `assert::Context`. +error[E0277]: `Src` cannot be safely transmuted into `Unexpected` in the defining scope of `assert::Context` --> $DIR/should_respect_endianness.rs:36:36 | LL | assert::is_transmutable::(); - | ^^^^^^^^^^ `Src` cannot be safely transmuted into `Unexpected` in the defining scope of `assert::Context`. + | ^^^^^^^^^^ At least one value of `Src` isn't a bit-valid value of `Unexpected` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Unexpected` note: required by a bound in `is_transmutable` --> $DIR/should_respect_endianness.rs:14:14 | diff --git a/tests/ui/transmutability/issue-101739-1.rs b/tests/ui/transmutability/issue-101739-1.rs index bcb8b158e..2b9666091 100644 --- a/tests/ui/transmutability/issue-101739-1.rs +++ b/tests/ui/transmutability/issue-101739-1.rs @@ -6,7 +6,7 @@ mod assert { pub fn is_transmutable() where Dst: BikeshedIntrinsicFrom, //~ ERROR cannot find type `Dst` in this scope - //~^ ERROR mismatched types + //~^ the constant `ASSUME_ALIGNMENT` is not of type `Assume` { } } diff --git a/tests/ui/transmutability/issue-101739-1.stderr b/tests/ui/transmutability/issue-101739-1.stderr index 7c6b533ef..bf947d0ea 100644 --- a/tests/ui/transmutability/issue-101739-1.stderr +++ b/tests/ui/transmutability/issue-101739-1.stderr @@ -4,13 +4,15 @@ error[E0412]: cannot find type `Dst` in this scope LL | Dst: BikeshedIntrinsicFrom, | ^^^ not found in this scope -error[E0308]: mismatched types - --> $DIR/issue-101739-1.rs:8:50 +error: the constant `ASSUME_ALIGNMENT` is not of type `Assume` + --> $DIR/issue-101739-1.rs:8:14 | LL | Dst: BikeshedIntrinsicFrom, - | ^^^^^^^^^^^^^^^^ expected `Assume`, found `bool` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Assume`, found `bool` + | +note: required by a bound in `BikeshedIntrinsicFrom` + --> $SRC_DIR/core/src/mem/transmutability.rs:LL:COL error: aborting due to 2 previous errors -Some errors have detailed explanations: E0308, E0412. -For more information about an error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/transmutability/primitives/bool.current.stderr b/tests/ui/transmutability/primitives/bool.current.stderr new file mode 100644 index 000000000..47c8438a2 --- /dev/null +++ b/tests/ui/transmutability/primitives/bool.current.stderr @@ -0,0 +1,18 @@ +error[E0277]: `u8` cannot be safely transmuted into `bool` in the defining scope of `assert::Context` + --> $DIR/bool.rs:24:35 + | +LL | assert::is_transmutable::(); + | ^^^^ At least one value of `u8` isn't a bit-valid value of `bool` + | +note: required by a bound in `is_transmutable` + --> $DIR/bool.rs:14:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/primitives/bool.next.stderr b/tests/ui/transmutability/primitives/bool.next.stderr new file mode 100644 index 000000000..47c8438a2 --- /dev/null +++ b/tests/ui/transmutability/primitives/bool.next.stderr @@ -0,0 +1,18 @@ +error[E0277]: `u8` cannot be safely transmuted into `bool` in the defining scope of `assert::Context` + --> $DIR/bool.rs:24:35 + | +LL | assert::is_transmutable::(); + | ^^^^ At least one value of `u8` isn't a bit-valid value of `bool` + | +note: required by a bound in `is_transmutable` + --> $DIR/bool.rs:14:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/primitives/bool.rs b/tests/ui/transmutability/primitives/bool.rs index eebb74fff..de77cfc78 100644 --- a/tests/ui/transmutability/primitives/bool.rs +++ b/tests/ui/transmutability/primitives/bool.rs @@ -1,8 +1,10 @@ +// revisions: current next +//[next] compile-flags: -Ztrait-solver=next + #![crate_type = "lib"] #![feature(transmutability)] #![allow(dead_code)] #![allow(incomplete_features)] - mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; pub struct Context; diff --git a/tests/ui/transmutability/primitives/bool.stderr b/tests/ui/transmutability/primitives/bool.stderr deleted file mode 100644 index 22decf15e..000000000 --- a/tests/ui/transmutability/primitives/bool.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0277]: `u8` cannot be safely transmuted into `bool` in the defining scope of `assert::Context`. - --> $DIR/bool.rs:22:35 - | -LL | assert::is_transmutable::(); - | ^^^^ `u8` cannot be safely transmuted into `bool` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `bool` -note: required by a bound in `is_transmutable` - --> $DIR/bool.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/primitives/numbers.current.stderr b/tests/ui/transmutability/primitives/numbers.current.stderr new file mode 100644 index 000000000..d12e17297 --- /dev/null +++ b/tests/ui/transmutability/primitives/numbers.current.stderr @@ -0,0 +1,858 @@ +error[E0277]: `i8` cannot be safely transmuted into `i16` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:65:40 + | +LL | assert::is_transmutable::< i8, i16>(); + | ^^^ The size of `i8` is smaller than the size of `i16` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i8` cannot be safely transmuted into `u16` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:66:40 + | +LL | assert::is_transmutable::< i8, u16>(); + | ^^^ The size of `i8` is smaller than the size of `u16` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i8` cannot be safely transmuted into `i32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:67:40 + | +LL | assert::is_transmutable::< i8, i32>(); + | ^^^ The size of `i8` is smaller than the size of `i32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i8` cannot be safely transmuted into `f32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:68:40 + | +LL | assert::is_transmutable::< i8, f32>(); + | ^^^ The size of `i8` is smaller than the size of `f32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i8` cannot be safely transmuted into `u32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:69:40 + | +LL | assert::is_transmutable::< i8, u32>(); + | ^^^ The size of `i8` is smaller than the size of `u32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i8` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:70:40 + | +LL | assert::is_transmutable::< i8, u64>(); + | ^^^ The size of `i8` is smaller than the size of `u64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i8` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:71:40 + | +LL | assert::is_transmutable::< i8, i64>(); + | ^^^ The size of `i8` is smaller than the size of `i64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i8` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:72:40 + | +LL | assert::is_transmutable::< i8, f64>(); + | ^^^ The size of `i8` is smaller than the size of `f64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i8` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:73:39 + | +LL | assert::is_transmutable::< i8, u128>(); + | ^^^^ The size of `i8` is smaller than the size of `u128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i8` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:74:39 + | +LL | assert::is_transmutable::< i8, i128>(); + | ^^^^ The size of `i8` is smaller than the size of `i128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `i16` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:76:40 + | +LL | assert::is_transmutable::< u8, i16>(); + | ^^^ The size of `u8` is smaller than the size of `i16` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `u16` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:77:40 + | +LL | assert::is_transmutable::< u8, u16>(); + | ^^^ The size of `u8` is smaller than the size of `u16` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `i32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:78:40 + | +LL | assert::is_transmutable::< u8, i32>(); + | ^^^ The size of `u8` is smaller than the size of `i32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `f32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:79:40 + | +LL | assert::is_transmutable::< u8, f32>(); + | ^^^ The size of `u8` is smaller than the size of `f32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `u32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:80:40 + | +LL | assert::is_transmutable::< u8, u32>(); + | ^^^ The size of `u8` is smaller than the size of `u32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:81:40 + | +LL | assert::is_transmutable::< u8, u64>(); + | ^^^ The size of `u8` is smaller than the size of `u64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:82:40 + | +LL | assert::is_transmutable::< u8, i64>(); + | ^^^ The size of `u8` is smaller than the size of `i64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:83:40 + | +LL | assert::is_transmutable::< u8, f64>(); + | ^^^ The size of `u8` is smaller than the size of `f64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:84:39 + | +LL | assert::is_transmutable::< u8, u128>(); + | ^^^^ The size of `u8` is smaller than the size of `u128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:85:39 + | +LL | assert::is_transmutable::< u8, i128>(); + | ^^^^ The size of `u8` is smaller than the size of `i128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i16` cannot be safely transmuted into `i32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:87:40 + | +LL | assert::is_transmutable::< i16, i32>(); + | ^^^ The size of `i16` is smaller than the size of `i32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i16` cannot be safely transmuted into `f32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:88:40 + | +LL | assert::is_transmutable::< i16, f32>(); + | ^^^ The size of `i16` is smaller than the size of `f32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i16` cannot be safely transmuted into `u32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:89:40 + | +LL | assert::is_transmutable::< i16, u32>(); + | ^^^ The size of `i16` is smaller than the size of `u32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i16` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:90:40 + | +LL | assert::is_transmutable::< i16, u64>(); + | ^^^ The size of `i16` is smaller than the size of `u64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i16` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:91:40 + | +LL | assert::is_transmutable::< i16, i64>(); + | ^^^ The size of `i16` is smaller than the size of `i64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i16` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:92:40 + | +LL | assert::is_transmutable::< i16, f64>(); + | ^^^ The size of `i16` is smaller than the size of `f64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i16` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:93:39 + | +LL | assert::is_transmutable::< i16, u128>(); + | ^^^^ The size of `i16` is smaller than the size of `u128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i16` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:94:39 + | +LL | assert::is_transmutable::< i16, i128>(); + | ^^^^ The size of `i16` is smaller than the size of `i128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u16` cannot be safely transmuted into `i32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:96:40 + | +LL | assert::is_transmutable::< u16, i32>(); + | ^^^ The size of `u16` is smaller than the size of `i32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u16` cannot be safely transmuted into `f32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:97:40 + | +LL | assert::is_transmutable::< u16, f32>(); + | ^^^ The size of `u16` is smaller than the size of `f32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u16` cannot be safely transmuted into `u32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:98:40 + | +LL | assert::is_transmutable::< u16, u32>(); + | ^^^ The size of `u16` is smaller than the size of `u32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u16` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:99:40 + | +LL | assert::is_transmutable::< u16, u64>(); + | ^^^ The size of `u16` is smaller than the size of `u64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u16` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:100:40 + | +LL | assert::is_transmutable::< u16, i64>(); + | ^^^ The size of `u16` is smaller than the size of `i64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u16` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:101:40 + | +LL | assert::is_transmutable::< u16, f64>(); + | ^^^ The size of `u16` is smaller than the size of `f64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u16` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:102:39 + | +LL | assert::is_transmutable::< u16, u128>(); + | ^^^^ The size of `u16` is smaller than the size of `u128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u16` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:103:39 + | +LL | assert::is_transmutable::< u16, i128>(); + | ^^^^ The size of `u16` is smaller than the size of `i128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:105:40 + | +LL | assert::is_transmutable::< i32, u64>(); + | ^^^ The size of `i32` is smaller than the size of `u64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:106:40 + | +LL | assert::is_transmutable::< i32, i64>(); + | ^^^ The size of `i32` is smaller than the size of `i64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:107:40 + | +LL | assert::is_transmutable::< i32, f64>(); + | ^^^ The size of `i32` is smaller than the size of `f64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:108:39 + | +LL | assert::is_transmutable::< i32, u128>(); + | ^^^^ The size of `i32` is smaller than the size of `u128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:109:39 + | +LL | assert::is_transmutable::< i32, i128>(); + | ^^^^ The size of `i32` is smaller than the size of `i128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `f32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:111:40 + | +LL | assert::is_transmutable::< f32, u64>(); + | ^^^ The size of `f32` is smaller than the size of `u64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `f32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:112:40 + | +LL | assert::is_transmutable::< f32, i64>(); + | ^^^ The size of `f32` is smaller than the size of `i64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `f32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:113:40 + | +LL | assert::is_transmutable::< f32, f64>(); + | ^^^ The size of `f32` is smaller than the size of `f64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `f32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:114:39 + | +LL | assert::is_transmutable::< f32, u128>(); + | ^^^^ The size of `f32` is smaller than the size of `u128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `f32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:115:39 + | +LL | assert::is_transmutable::< f32, i128>(); + | ^^^^ The size of `f32` is smaller than the size of `i128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:117:40 + | +LL | assert::is_transmutable::< u32, u64>(); + | ^^^ The size of `u32` is smaller than the size of `u64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:118:40 + | +LL | assert::is_transmutable::< u32, i64>(); + | ^^^ The size of `u32` is smaller than the size of `i64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:119:40 + | +LL | assert::is_transmutable::< u32, f64>(); + | ^^^ The size of `u32` is smaller than the size of `f64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:120:39 + | +LL | assert::is_transmutable::< u32, u128>(); + | ^^^^ The size of `u32` is smaller than the size of `u128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:121:39 + | +LL | assert::is_transmutable::< u32, i128>(); + | ^^^^ The size of `u32` is smaller than the size of `i128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:123:39 + | +LL | assert::is_transmutable::< u64, u128>(); + | ^^^^ The size of `u64` is smaller than the size of `u128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:124:39 + | +LL | assert::is_transmutable::< u64, i128>(); + | ^^^^ The size of `u64` is smaller than the size of `i128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:126:39 + | +LL | assert::is_transmutable::< i64, u128>(); + | ^^^^ The size of `i64` is smaller than the size of `u128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:127:39 + | +LL | assert::is_transmutable::< i64, i128>(); + | ^^^^ The size of `i64` is smaller than the size of `i128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `f64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:129:39 + | +LL | assert::is_transmutable::< f64, u128>(); + | ^^^^ The size of `f64` is smaller than the size of `u128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `f64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:130:39 + | +LL | assert::is_transmutable::< f64, i128>(); + | ^^^^ The size of `f64` is smaller than the size of `i128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error: aborting due to 57 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/primitives/numbers.next.stderr b/tests/ui/transmutability/primitives/numbers.next.stderr new file mode 100644 index 000000000..d12e17297 --- /dev/null +++ b/tests/ui/transmutability/primitives/numbers.next.stderr @@ -0,0 +1,858 @@ +error[E0277]: `i8` cannot be safely transmuted into `i16` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:65:40 + | +LL | assert::is_transmutable::< i8, i16>(); + | ^^^ The size of `i8` is smaller than the size of `i16` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i8` cannot be safely transmuted into `u16` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:66:40 + | +LL | assert::is_transmutable::< i8, u16>(); + | ^^^ The size of `i8` is smaller than the size of `u16` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i8` cannot be safely transmuted into `i32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:67:40 + | +LL | assert::is_transmutable::< i8, i32>(); + | ^^^ The size of `i8` is smaller than the size of `i32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i8` cannot be safely transmuted into `f32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:68:40 + | +LL | assert::is_transmutable::< i8, f32>(); + | ^^^ The size of `i8` is smaller than the size of `f32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i8` cannot be safely transmuted into `u32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:69:40 + | +LL | assert::is_transmutable::< i8, u32>(); + | ^^^ The size of `i8` is smaller than the size of `u32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i8` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:70:40 + | +LL | assert::is_transmutable::< i8, u64>(); + | ^^^ The size of `i8` is smaller than the size of `u64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i8` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:71:40 + | +LL | assert::is_transmutable::< i8, i64>(); + | ^^^ The size of `i8` is smaller than the size of `i64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i8` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:72:40 + | +LL | assert::is_transmutable::< i8, f64>(); + | ^^^ The size of `i8` is smaller than the size of `f64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i8` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:73:39 + | +LL | assert::is_transmutable::< i8, u128>(); + | ^^^^ The size of `i8` is smaller than the size of `u128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i8` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:74:39 + | +LL | assert::is_transmutable::< i8, i128>(); + | ^^^^ The size of `i8` is smaller than the size of `i128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `i16` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:76:40 + | +LL | assert::is_transmutable::< u8, i16>(); + | ^^^ The size of `u8` is smaller than the size of `i16` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `u16` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:77:40 + | +LL | assert::is_transmutable::< u8, u16>(); + | ^^^ The size of `u8` is smaller than the size of `u16` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `i32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:78:40 + | +LL | assert::is_transmutable::< u8, i32>(); + | ^^^ The size of `u8` is smaller than the size of `i32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `f32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:79:40 + | +LL | assert::is_transmutable::< u8, f32>(); + | ^^^ The size of `u8` is smaller than the size of `f32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `u32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:80:40 + | +LL | assert::is_transmutable::< u8, u32>(); + | ^^^ The size of `u8` is smaller than the size of `u32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:81:40 + | +LL | assert::is_transmutable::< u8, u64>(); + | ^^^ The size of `u8` is smaller than the size of `u64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:82:40 + | +LL | assert::is_transmutable::< u8, i64>(); + | ^^^ The size of `u8` is smaller than the size of `i64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:83:40 + | +LL | assert::is_transmutable::< u8, f64>(); + | ^^^ The size of `u8` is smaller than the size of `f64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:84:39 + | +LL | assert::is_transmutable::< u8, u128>(); + | ^^^^ The size of `u8` is smaller than the size of `u128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:85:39 + | +LL | assert::is_transmutable::< u8, i128>(); + | ^^^^ The size of `u8` is smaller than the size of `i128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i16` cannot be safely transmuted into `i32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:87:40 + | +LL | assert::is_transmutable::< i16, i32>(); + | ^^^ The size of `i16` is smaller than the size of `i32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i16` cannot be safely transmuted into `f32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:88:40 + | +LL | assert::is_transmutable::< i16, f32>(); + | ^^^ The size of `i16` is smaller than the size of `f32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i16` cannot be safely transmuted into `u32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:89:40 + | +LL | assert::is_transmutable::< i16, u32>(); + | ^^^ The size of `i16` is smaller than the size of `u32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i16` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:90:40 + | +LL | assert::is_transmutable::< i16, u64>(); + | ^^^ The size of `i16` is smaller than the size of `u64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i16` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:91:40 + | +LL | assert::is_transmutable::< i16, i64>(); + | ^^^ The size of `i16` is smaller than the size of `i64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i16` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:92:40 + | +LL | assert::is_transmutable::< i16, f64>(); + | ^^^ The size of `i16` is smaller than the size of `f64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i16` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:93:39 + | +LL | assert::is_transmutable::< i16, u128>(); + | ^^^^ The size of `i16` is smaller than the size of `u128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i16` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:94:39 + | +LL | assert::is_transmutable::< i16, i128>(); + | ^^^^ The size of `i16` is smaller than the size of `i128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u16` cannot be safely transmuted into `i32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:96:40 + | +LL | assert::is_transmutable::< u16, i32>(); + | ^^^ The size of `u16` is smaller than the size of `i32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u16` cannot be safely transmuted into `f32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:97:40 + | +LL | assert::is_transmutable::< u16, f32>(); + | ^^^ The size of `u16` is smaller than the size of `f32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u16` cannot be safely transmuted into `u32` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:98:40 + | +LL | assert::is_transmutable::< u16, u32>(); + | ^^^ The size of `u16` is smaller than the size of `u32` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u16` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:99:40 + | +LL | assert::is_transmutable::< u16, u64>(); + | ^^^ The size of `u16` is smaller than the size of `u64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u16` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:100:40 + | +LL | assert::is_transmutable::< u16, i64>(); + | ^^^ The size of `u16` is smaller than the size of `i64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u16` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:101:40 + | +LL | assert::is_transmutable::< u16, f64>(); + | ^^^ The size of `u16` is smaller than the size of `f64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u16` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:102:39 + | +LL | assert::is_transmutable::< u16, u128>(); + | ^^^^ The size of `u16` is smaller than the size of `u128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u16` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:103:39 + | +LL | assert::is_transmutable::< u16, i128>(); + | ^^^^ The size of `u16` is smaller than the size of `i128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:105:40 + | +LL | assert::is_transmutable::< i32, u64>(); + | ^^^ The size of `i32` is smaller than the size of `u64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:106:40 + | +LL | assert::is_transmutable::< i32, i64>(); + | ^^^ The size of `i32` is smaller than the size of `i64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:107:40 + | +LL | assert::is_transmutable::< i32, f64>(); + | ^^^ The size of `i32` is smaller than the size of `f64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:108:39 + | +LL | assert::is_transmutable::< i32, u128>(); + | ^^^^ The size of `i32` is smaller than the size of `u128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:109:39 + | +LL | assert::is_transmutable::< i32, i128>(); + | ^^^^ The size of `i32` is smaller than the size of `i128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `f32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:111:40 + | +LL | assert::is_transmutable::< f32, u64>(); + | ^^^ The size of `f32` is smaller than the size of `u64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `f32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:112:40 + | +LL | assert::is_transmutable::< f32, i64>(); + | ^^^ The size of `f32` is smaller than the size of `i64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `f32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:113:40 + | +LL | assert::is_transmutable::< f32, f64>(); + | ^^^ The size of `f32` is smaller than the size of `f64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `f32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:114:39 + | +LL | assert::is_transmutable::< f32, u128>(); + | ^^^^ The size of `f32` is smaller than the size of `u128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `f32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:115:39 + | +LL | assert::is_transmutable::< f32, i128>(); + | ^^^^ The size of `f32` is smaller than the size of `i128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:117:40 + | +LL | assert::is_transmutable::< u32, u64>(); + | ^^^ The size of `u32` is smaller than the size of `u64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:118:40 + | +LL | assert::is_transmutable::< u32, i64>(); + | ^^^ The size of `u32` is smaller than the size of `i64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:119:40 + | +LL | assert::is_transmutable::< u32, f64>(); + | ^^^ The size of `u32` is smaller than the size of `f64` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:120:39 + | +LL | assert::is_transmutable::< u32, u128>(); + | ^^^^ The size of `u32` is smaller than the size of `u128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:121:39 + | +LL | assert::is_transmutable::< u32, i128>(); + | ^^^^ The size of `u32` is smaller than the size of `i128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:123:39 + | +LL | assert::is_transmutable::< u64, u128>(); + | ^^^^ The size of `u64` is smaller than the size of `u128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `u64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:124:39 + | +LL | assert::is_transmutable::< u64, i128>(); + | ^^^^ The size of `u64` is smaller than the size of `i128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:126:39 + | +LL | assert::is_transmutable::< i64, u128>(); + | ^^^^ The size of `i64` is smaller than the size of `u128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `i64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:127:39 + | +LL | assert::is_transmutable::< i64, i128>(); + | ^^^^ The size of `i64` is smaller than the size of `i128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `f64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:129:39 + | +LL | assert::is_transmutable::< f64, u128>(); + | ^^^^ The size of `f64` is smaller than the size of `u128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `f64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` + --> $DIR/numbers.rs:130:39 + | +LL | assert::is_transmutable::< f64, i128>(); + | ^^^^ The size of `f64` is smaller than the size of `i128` + | +note: required by a bound in `is_transmutable` + --> $DIR/numbers.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error: aborting due to 57 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/primitives/numbers.rs b/tests/ui/transmutability/primitives/numbers.rs index 0df43d204..e980e91ed 100644 --- a/tests/ui/transmutability/primitives/numbers.rs +++ b/tests/ui/transmutability/primitives/numbers.rs @@ -1,3 +1,6 @@ +// revisions: current next +//[next] compile-flags: -Ztrait-solver=next + #![crate_type = "lib"] #![feature(transmutability)] #![allow(dead_code)] diff --git a/tests/ui/transmutability/primitives/numbers.stderr b/tests/ui/transmutability/primitives/numbers.stderr deleted file mode 100644 index c04a0e82a..000000000 --- a/tests/ui/transmutability/primitives/numbers.stderr +++ /dev/null @@ -1,915 +0,0 @@ -error[E0277]: `i8` cannot be safely transmuted into `i16` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:62:40 - | -LL | assert::is_transmutable::< i8, i16>(); - | ^^^ `i8` cannot be safely transmuted into `i16` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i16` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i8` cannot be safely transmuted into `u16` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:63:40 - | -LL | assert::is_transmutable::< i8, u16>(); - | ^^^ `i8` cannot be safely transmuted into `u16` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u16` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i8` cannot be safely transmuted into `i32` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:64:40 - | -LL | assert::is_transmutable::< i8, i32>(); - | ^^^ `i8` cannot be safely transmuted into `i32` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i32` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i8` cannot be safely transmuted into `f32` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:65:40 - | -LL | assert::is_transmutable::< i8, f32>(); - | ^^^ `i8` cannot be safely transmuted into `f32` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f32` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i8` cannot be safely transmuted into `u32` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:66:40 - | -LL | assert::is_transmutable::< i8, u32>(); - | ^^^ `i8` cannot be safely transmuted into `u32` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u32` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i8` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:67:40 - | -LL | assert::is_transmutable::< i8, u64>(); - | ^^^ `i8` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i8` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:68:40 - | -LL | assert::is_transmutable::< i8, i64>(); - | ^^^ `i8` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i64` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i8` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:69:40 - | -LL | assert::is_transmutable::< i8, f64>(); - | ^^^ `i8` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f64` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i8` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:70:39 - | -LL | assert::is_transmutable::< i8, u128>(); - | ^^^^ `i8` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i8` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:71:39 - | -LL | assert::is_transmutable::< i8, i128>(); - | ^^^^ `i8` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u8` cannot be safely transmuted into `i16` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:73:40 - | -LL | assert::is_transmutable::< u8, i16>(); - | ^^^ `u8` cannot be safely transmuted into `i16` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i16` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u8` cannot be safely transmuted into `u16` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:74:40 - | -LL | assert::is_transmutable::< u8, u16>(); - | ^^^ `u8` cannot be safely transmuted into `u16` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u16` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u8` cannot be safely transmuted into `i32` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:75:40 - | -LL | assert::is_transmutable::< u8, i32>(); - | ^^^ `u8` cannot be safely transmuted into `i32` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i32` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u8` cannot be safely transmuted into `f32` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:76:40 - | -LL | assert::is_transmutable::< u8, f32>(); - | ^^^ `u8` cannot be safely transmuted into `f32` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f32` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u8` cannot be safely transmuted into `u32` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:77:40 - | -LL | assert::is_transmutable::< u8, u32>(); - | ^^^ `u8` cannot be safely transmuted into `u32` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u32` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u8` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:78:40 - | -LL | assert::is_transmutable::< u8, u64>(); - | ^^^ `u8` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u8` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:79:40 - | -LL | assert::is_transmutable::< u8, i64>(); - | ^^^ `u8` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i64` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u8` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:80:40 - | -LL | assert::is_transmutable::< u8, f64>(); - | ^^^ `u8` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f64` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u8` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:81:39 - | -LL | assert::is_transmutable::< u8, u128>(); - | ^^^^ `u8` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u8` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:82:39 - | -LL | assert::is_transmutable::< u8, i128>(); - | ^^^^ `u8` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i16` cannot be safely transmuted into `i32` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:84:40 - | -LL | assert::is_transmutable::< i16, i32>(); - | ^^^ `i16` cannot be safely transmuted into `i32` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i32` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i16` cannot be safely transmuted into `f32` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:85:40 - | -LL | assert::is_transmutable::< i16, f32>(); - | ^^^ `i16` cannot be safely transmuted into `f32` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f32` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i16` cannot be safely transmuted into `u32` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:86:40 - | -LL | assert::is_transmutable::< i16, u32>(); - | ^^^ `i16` cannot be safely transmuted into `u32` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u32` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i16` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:87:40 - | -LL | assert::is_transmutable::< i16, u64>(); - | ^^^ `i16` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i16` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:88:40 - | -LL | assert::is_transmutable::< i16, i64>(); - | ^^^ `i16` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i64` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i16` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:89:40 - | -LL | assert::is_transmutable::< i16, f64>(); - | ^^^ `i16` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f64` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i16` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:90:39 - | -LL | assert::is_transmutable::< i16, u128>(); - | ^^^^ `i16` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i16` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:91:39 - | -LL | assert::is_transmutable::< i16, i128>(); - | ^^^^ `i16` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u16` cannot be safely transmuted into `i32` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:93:40 - | -LL | assert::is_transmutable::< u16, i32>(); - | ^^^ `u16` cannot be safely transmuted into `i32` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i32` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u16` cannot be safely transmuted into `f32` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:94:40 - | -LL | assert::is_transmutable::< u16, f32>(); - | ^^^ `u16` cannot be safely transmuted into `f32` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f32` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u16` cannot be safely transmuted into `u32` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:95:40 - | -LL | assert::is_transmutable::< u16, u32>(); - | ^^^ `u16` cannot be safely transmuted into `u32` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u32` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u16` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:96:40 - | -LL | assert::is_transmutable::< u16, u64>(); - | ^^^ `u16` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u16` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:97:40 - | -LL | assert::is_transmutable::< u16, i64>(); - | ^^^ `u16` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i64` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u16` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:98:40 - | -LL | assert::is_transmutable::< u16, f64>(); - | ^^^ `u16` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f64` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u16` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:99:39 - | -LL | assert::is_transmutable::< u16, u128>(); - | ^^^^ `u16` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u16` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:100:39 - | -LL | assert::is_transmutable::< u16, i128>(); - | ^^^^ `u16` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:102:40 - | -LL | assert::is_transmutable::< i32, u64>(); - | ^^^ `i32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:103:40 - | -LL | assert::is_transmutable::< i32, i64>(); - | ^^^ `i32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i64` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:104:40 - | -LL | assert::is_transmutable::< i32, f64>(); - | ^^^ `i32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f64` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:105:39 - | -LL | assert::is_transmutable::< i32, u128>(); - | ^^^^ `i32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:106:39 - | -LL | assert::is_transmutable::< i32, i128>(); - | ^^^^ `i32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `f32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:108:40 - | -LL | assert::is_transmutable::< f32, u64>(); - | ^^^ `f32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `f32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:109:40 - | -LL | assert::is_transmutable::< f32, i64>(); - | ^^^ `f32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i64` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `f32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:110:40 - | -LL | assert::is_transmutable::< f32, f64>(); - | ^^^ `f32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f64` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `f32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:111:39 - | -LL | assert::is_transmutable::< f32, u128>(); - | ^^^^ `f32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `f32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:112:39 - | -LL | assert::is_transmutable::< f32, i128>(); - | ^^^^ `f32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:114:40 - | -LL | assert::is_transmutable::< u32, u64>(); - | ^^^ `u32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:115:40 - | -LL | assert::is_transmutable::< u32, i64>(); - | ^^^ `u32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i64` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:116:40 - | -LL | assert::is_transmutable::< u32, f64>(); - | ^^^ `u32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f64` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:117:39 - | -LL | assert::is_transmutable::< u32, u128>(); - | ^^^^ `u32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:118:39 - | -LL | assert::is_transmutable::< u32, i128>(); - | ^^^^ `u32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:120:39 - | -LL | assert::is_transmutable::< u64, u128>(); - | ^^^^ `u64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `u64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:121:39 - | -LL | assert::is_transmutable::< u64, i128>(); - | ^^^^ `u64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:123:39 - | -LL | assert::is_transmutable::< i64, u128>(); - | ^^^^ `i64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `i64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:124:39 - | -LL | assert::is_transmutable::< i64, i128>(); - | ^^^^ `i64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `f64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:126:39 - | -LL | assert::is_transmutable::< f64, u128>(); - | ^^^^ `f64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error[E0277]: `f64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. - --> $DIR/numbers.rs:127:39 - | -LL | assert::is_transmutable::< f64, i128>(); - | ^^^^ `f64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` -note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error: aborting due to 57 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/primitives/unit.current.stderr b/tests/ui/transmutability/primitives/unit.current.stderr new file mode 100644 index 000000000..c49eb6097 --- /dev/null +++ b/tests/ui/transmutability/primitives/unit.current.stderr @@ -0,0 +1,24 @@ +error[E0277]: `()` cannot be safely transmuted into `u8` in the defining scope of `should_have_correct_size::Context` + --> $DIR/unit.rs:31:35 + | +LL | assert::is_transmutable::<(), u8, Context>(); + | ^^ The size of `()` is smaller than the size of `u8` + | +note: required by a bound in `is_transmutable` + --> $DIR/unit.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/primitives/unit.next.stderr b/tests/ui/transmutability/primitives/unit.next.stderr new file mode 100644 index 000000000..c49eb6097 --- /dev/null +++ b/tests/ui/transmutability/primitives/unit.next.stderr @@ -0,0 +1,24 @@ +error[E0277]: `()` cannot be safely transmuted into `u8` in the defining scope of `should_have_correct_size::Context` + --> $DIR/unit.rs:31:35 + | +LL | assert::is_transmutable::<(), u8, Context>(); + | ^^ The size of `()` is smaller than the size of `u8` + | +note: required by a bound in `is_transmutable` + --> $DIR/unit.rs:15:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/primitives/unit.rs b/tests/ui/transmutability/primitives/unit.rs index 1975a61de..12eac1751 100644 --- a/tests/ui/transmutability/primitives/unit.rs +++ b/tests/ui/transmutability/primitives/unit.rs @@ -1,3 +1,6 @@ +// revisions: current next +//[next] compile-flags: -Ztrait-solver=next + //! The unit type, `()`, should be one byte. #![crate_type = "lib"] diff --git a/tests/ui/transmutability/primitives/unit.stderr b/tests/ui/transmutability/primitives/unit.stderr deleted file mode 100644 index 988cd33b3..000000000 --- a/tests/ui/transmutability/primitives/unit.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0277]: `()` cannot be safely transmuted into `u8` in the defining scope of `should_have_correct_size::Context`. - --> $DIR/unit.rs:28:35 - | -LL | assert::is_transmutable::<(), u8, Context>(); - | ^^ `()` cannot be safely transmuted into `u8` in the defining scope of `should_have_correct_size::Context`. - | - = help: the trait `BikeshedIntrinsicFrom<(), should_have_correct_size::Context, Assume { alignment: true, lifetimes: true, safety: true, validity: true }>` is not implemented for `u8` -note: required by a bound in `is_transmutable` - --> $DIR/unit.rs:12:14 - | -LL | pub fn is_transmutable() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | |__________^ required by this bound in `is_transmutable` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/references.current.stderr b/tests/ui/transmutability/references.current.stderr new file mode 100644 index 000000000..ecb095354 --- /dev/null +++ b/tests/ui/transmutability/references.current.stderr @@ -0,0 +1,25 @@ +error[E0277]: `&'static Unit` cannot be safely transmuted into `&'static Unit` in the defining scope of `assert::Context` + --> $DIR/references.rs:29:52 + | +LL | assert::is_maybe_transmutable::<&'static Unit, &'static Unit>(); + | ^^^^^^^^^^^^^ `&'static Unit` does not have a well-specified layout + | +note: required by a bound in `is_maybe_transmutable` + --> $DIR/references.rs:16:14 + | +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/references.next.stderr b/tests/ui/transmutability/references.next.stderr new file mode 100644 index 000000000..ecb095354 --- /dev/null +++ b/tests/ui/transmutability/references.next.stderr @@ -0,0 +1,25 @@ +error[E0277]: `&'static Unit` cannot be safely transmuted into `&'static Unit` in the defining scope of `assert::Context` + --> $DIR/references.rs:29:52 + | +LL | assert::is_maybe_transmutable::<&'static Unit, &'static Unit>(); + | ^^^^^^^^^^^^^ `&'static Unit` does not have a well-specified layout + | +note: required by a bound in `is_maybe_transmutable` + --> $DIR/references.rs:16:14 + | +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/references.rs b/tests/ui/transmutability/references.rs index af3ff0ec1..8c2b25ebb 100644 --- a/tests/ui/transmutability/references.rs +++ b/tests/ui/transmutability/references.rs @@ -1,3 +1,6 @@ +// revisions: current next +//[next] compile-flags: -Ztrait-solver=next + //! Transmutations involving references are not yet supported. #![crate_type = "lib"] diff --git a/tests/ui/transmutability/references.stderr b/tests/ui/transmutability/references.stderr deleted file mode 100644 index eb3bd03fd..000000000 --- a/tests/ui/transmutability/references.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error[E0277]: `&'static Unit` cannot be safely transmuted into `&'static Unit` in the defining scope of `assert::Context`. - --> $DIR/references.rs:26:52 - | -LL | assert::is_maybe_transmutable::<&'static Unit, &'static Unit>(); - | ^^^^^^^^^^^^^ `&'static Unit` cannot be safely transmuted into `&'static Unit` in the defining scope of `assert::Context`. - | - = help: the trait `BikeshedIntrinsicFrom<&'static Unit, assert::Context, Assume { alignment: true, lifetimes: true, safety: true, validity: true }>` is not implemented for `&'static Unit` -note: required by a bound in `is_maybe_transmutable` - --> $DIR/references.rs:13:14 - | -LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom - | |__________^ required by this bound in `is_maybe_transmutable` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/structs/repr/should_require_well_defined_layout.stderr b/tests/ui/transmutability/structs/repr/should_require_well_defined_layout.stderr index d9aebac64..4c5062cd3 100644 --- a/tests/ui/transmutability/structs/repr/should_require_well_defined_layout.stderr +++ b/tests/ui/transmutability/structs/repr/should_require_well_defined_layout.stderr @@ -1,10 +1,9 @@ -error[E0277]: `should_reject_repr_rust::unit::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. +error[E0277]: `should_reject_repr_rust::unit::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:28:52 | LL | assert::is_maybe_transmutable::(); - | ^^ `should_reject_repr_rust::unit::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. + | ^^ `should_reject_repr_rust::unit::repr_rust` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 | @@ -21,13 +20,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust::unit::repr_rust` in the defining scope of `assert::Context`. +error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust::unit::repr_rust` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:29:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `u128` cannot be safely transmuted into `should_reject_repr_rust::unit::repr_rust` in the defining scope of `assert::Context`. + | ^^^^^^^^^ `should_reject_repr_rust::unit::repr_rust` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `should_reject_repr_rust::unit::repr_rust` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 | @@ -44,13 +42,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `should_reject_repr_rust::tuple::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. +error[E0277]: `should_reject_repr_rust::tuple::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:34:52 | LL | assert::is_maybe_transmutable::(); - | ^^ `should_reject_repr_rust::tuple::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. + | ^^ `should_reject_repr_rust::tuple::repr_rust` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 | @@ -67,13 +64,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust::tuple::repr_rust` in the defining scope of `assert::Context`. +error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust::tuple::repr_rust` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:35:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `u128` cannot be safely transmuted into `should_reject_repr_rust::tuple::repr_rust` in the defining scope of `assert::Context`. + | ^^^^^^^^^ `should_reject_repr_rust::tuple::repr_rust` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `should_reject_repr_rust::tuple::repr_rust` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 | @@ -90,13 +86,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `should_reject_repr_rust::braces::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. +error[E0277]: `should_reject_repr_rust::braces::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:40:52 | LL | assert::is_maybe_transmutable::(); - | ^^ `should_reject_repr_rust::braces::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. + | ^^ `should_reject_repr_rust::braces::repr_rust` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 | @@ -113,13 +108,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust::braces::repr_rust` in the defining scope of `assert::Context`. +error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust::braces::repr_rust` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:41:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `u128` cannot be safely transmuted into `should_reject_repr_rust::braces::repr_rust` in the defining scope of `assert::Context`. + | ^^^^^^^^^ `should_reject_repr_rust::braces::repr_rust` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `should_reject_repr_rust::braces::repr_rust` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 | @@ -136,13 +130,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `aligned::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. +error[E0277]: `aligned::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:46:52 | LL | assert::is_maybe_transmutable::(); - | ^^ `aligned::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. + | ^^ `aligned::repr_rust` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 | @@ -159,13 +152,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `aligned::repr_rust` in the defining scope of `assert::Context`. +error[E0277]: `u128` cannot be safely transmuted into `aligned::repr_rust` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:47:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `u128` cannot be safely transmuted into `aligned::repr_rust` in the defining scope of `assert::Context`. + | ^^^^^^^^^ `aligned::repr_rust` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `aligned::repr_rust` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 | @@ -182,13 +174,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `packed::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. +error[E0277]: `packed::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:52:52 | LL | assert::is_maybe_transmutable::(); - | ^^ `packed::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. + | ^^ `packed::repr_rust` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 | @@ -205,13 +196,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `packed::repr_rust` in the defining scope of `assert::Context`. +error[E0277]: `u128` cannot be safely transmuted into `packed::repr_rust` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:53:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `u128` cannot be safely transmuted into `packed::repr_rust` in the defining scope of `assert::Context`. + | ^^^^^^^^^ `packed::repr_rust` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `packed::repr_rust` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 | @@ -228,13 +218,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `nested::repr_c` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. +error[E0277]: `nested::repr_c` cannot be safely transmuted into `()` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:59:49 | LL | assert::is_maybe_transmutable::(); - | ^^ `nested::repr_c` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. + | ^^ `nested::repr_c` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 | @@ -251,13 +240,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `nested::repr_c` in the defining scope of `assert::Context`. +error[E0277]: `u128` cannot be safely transmuted into `nested::repr_c` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:60:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^ `u128` cannot be safely transmuted into `nested::repr_c` in the defining scope of `assert::Context`. + | ^^^^^^ `nested::repr_c` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `nested::repr_c` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 | diff --git a/tests/ui/transmutability/unions/repr/should_require_well_defined_layout.stderr b/tests/ui/transmutability/unions/repr/should_require_well_defined_layout.stderr index aa0cbc51b..4293d34f4 100644 --- a/tests/ui/transmutability/unions/repr/should_require_well_defined_layout.stderr +++ b/tests/ui/transmutability/unions/repr/should_require_well_defined_layout.stderr @@ -1,10 +1,9 @@ -error[E0277]: `should_reject_repr_rust::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. +error[E0277]: `should_reject_repr_rust::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:30:48 | LL | assert::is_maybe_transmutable::(); - | ^^ `should_reject_repr_rust::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. + | ^^ `should_reject_repr_rust::repr_rust` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 | @@ -21,13 +20,12 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust::repr_rust` in the defining scope of `assert::Context`. +error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust::repr_rust` in the defining scope of `assert::Context` --> $DIR/should_require_well_defined_layout.rs:31:43 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `u128` cannot be safely transmuted into `should_reject_repr_rust::repr_rust` in the defining scope of `assert::Context`. + | ^^^^^^^^^ `should_reject_repr_rust::repr_rust` does not have a well-specified layout | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `should_reject_repr_rust::repr_rust` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 | diff --git a/tests/ui/transmutability/unions/should_pad_variants.stderr b/tests/ui/transmutability/unions/should_pad_variants.stderr index f4988239d..bfbef8b25 100644 --- a/tests/ui/transmutability/unions/should_pad_variants.stderr +++ b/tests/ui/transmutability/unions/should_pad_variants.stderr @@ -1,10 +1,9 @@ -error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `should_pad_variants::Context`. +error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `should_pad_variants::Context` --> $DIR/should_pad_variants.rs:44:36 | LL | assert::is_transmutable::(); - | ^^^ `Src` cannot be safely transmuted into `Dst` in the defining scope of `should_pad_variants::Context`. + | ^^^ The size of `Src` is smaller than the size of `Dst` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Dst` note: required by a bound in `is_transmutable` --> $DIR/should_pad_variants.rs:13:14 | diff --git a/tests/ui/transmutability/unions/should_reject_contraction.stderr b/tests/ui/transmutability/unions/should_reject_contraction.stderr index fa7dcc3d2..553f655a1 100644 --- a/tests/ui/transmutability/unions/should_reject_contraction.stderr +++ b/tests/ui/transmutability/unions/should_reject_contraction.stderr @@ -1,10 +1,9 @@ -error[E0277]: `Superset` cannot be safely transmuted into `Subset` in the defining scope of `assert::Context`. +error[E0277]: `Superset` cannot be safely transmuted into `Subset` in the defining scope of `assert::Context` --> $DIR/should_reject_contraction.rs:35:41 | LL | assert::is_transmutable::(); - | ^^^^^^ `Superset` cannot be safely transmuted into `Subset` in the defining scope of `assert::Context`. + | ^^^^^^ At least one value of `Superset` isn't a bit-valid value of `Subset` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Subset` note: required by a bound in `is_transmutable` --> $DIR/should_reject_contraction.rs:13:14 | diff --git a/tests/ui/transmutability/unions/should_reject_disjoint.stderr b/tests/ui/transmutability/unions/should_reject_disjoint.stderr index 880e4cd89..178ae6f08 100644 --- a/tests/ui/transmutability/unions/should_reject_disjoint.stderr +++ b/tests/ui/transmutability/unions/should_reject_disjoint.stderr @@ -1,10 +1,9 @@ -error[E0277]: `A` cannot be safely transmuted into `B` in the defining scope of `assert::Context`. +error[E0277]: `A` cannot be safely transmuted into `B` in the defining scope of `assert::Context` --> $DIR/should_reject_disjoint.rs:33:40 | LL | assert::is_maybe_transmutable::(); - | ^ `A` cannot be safely transmuted into `B` in the defining scope of `assert::Context`. + | ^ At least one value of `A` isn't a bit-valid value of `B` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `B` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_reject_disjoint.rs:13:14 | @@ -14,13 +13,12 @@ LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` -error[E0277]: `B` cannot be safely transmuted into `A` in the defining scope of `assert::Context`. +error[E0277]: `B` cannot be safely transmuted into `A` in the defining scope of `assert::Context` --> $DIR/should_reject_disjoint.rs:34:40 | LL | assert::is_maybe_transmutable::(); - | ^ `B` cannot be safely transmuted into `A` in the defining scope of `assert::Context`. + | ^ At least one value of `B` isn't a bit-valid value of `A` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `A` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_reject_disjoint.rs:13:14 | diff --git a/tests/ui/transmutability/unions/should_reject_intersecting.stderr b/tests/ui/transmutability/unions/should_reject_intersecting.stderr index 501760b08..73c29ab1c 100644 --- a/tests/ui/transmutability/unions/should_reject_intersecting.stderr +++ b/tests/ui/transmutability/unions/should_reject_intersecting.stderr @@ -1,10 +1,9 @@ -error[E0277]: `A` cannot be safely transmuted into `B` in the defining scope of `assert::Context`. +error[E0277]: `A` cannot be safely transmuted into `B` in the defining scope of `assert::Context` --> $DIR/should_reject_intersecting.rs:36:34 | LL | assert::is_transmutable::(); - | ^ `A` cannot be safely transmuted into `B` in the defining scope of `assert::Context`. + | ^ At least one value of `A` isn't a bit-valid value of `B` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `B` note: required by a bound in `is_transmutable` --> $DIR/should_reject_intersecting.rs:14:14 | @@ -14,13 +13,12 @@ LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `B` cannot be safely transmuted into `A` in the defining scope of `assert::Context`. +error[E0277]: `B` cannot be safely transmuted into `A` in the defining scope of `assert::Context` --> $DIR/should_reject_intersecting.rs:37:34 | LL | assert::is_transmutable::(); - | ^ `B` cannot be safely transmuted into `A` in the defining scope of `assert::Context`. + | ^ At least one value of `B` isn't a bit-valid value of `A` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `A` note: required by a bound in `is_transmutable` --> $DIR/should_reject_intersecting.rs:14:14 | diff --git a/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_field.stderr b/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_field.stderr index afbba653b..863ada3c2 100644 --- a/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_field.stderr +++ b/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_field.stderr @@ -1,10 +1,9 @@ -error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context`. +error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context` --> $DIR/should_reject_if_dst_has_private_field.rs:35:41 | LL | assert::is_transmutable::(); - | ^^^^^^^^ `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context`. + | ^^^^^^^^ `Dst` is or contains a type or field that is not visible in that scope | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Dst` note: required by a bound in `is_transmutable` --> $DIR/should_reject_if_dst_has_private_field.rs:13:14 | diff --git a/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.stderr b/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.stderr index f14b5d8b2..7b0f1b4d5 100644 --- a/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.stderr +++ b/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.stderr @@ -1,10 +1,9 @@ -error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context`. +error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context` --> $DIR/should_reject_if_dst_has_private_variant.rs:36:41 | LL | assert::is_transmutable::(); - | ^^^^^^^^ `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context`. + | ^^^^^^^^ `Dst` is or contains a type or field that is not visible in that scope | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Dst` note: required by a bound in `is_transmutable` --> $DIR/should_reject_if_dst_has_private_variant.rs:13:14 | diff --git a/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.stderr b/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.stderr index 01ae8bea2..df19477ef 100644 --- a/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.stderr +++ b/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.stderr @@ -1,10 +1,9 @@ -error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context`. +error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context` --> $DIR/should_reject_if_dst_has_unreachable_field.rs:37:41 | LL | assert::is_transmutable::(); - | ^^^^^^^^ `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context`. + | ^^^^^^^^ `Dst` is or contains a type or field that is not visible in that scope | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Dst` note: required by a bound in `is_transmutable` --> $DIR/should_reject_if_dst_has_unreachable_field.rs:15:14 | diff --git a/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.stderr b/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.stderr index 20a680a74..ea488980c 100644 --- a/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.stderr +++ b/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.stderr @@ -10,13 +10,12 @@ note: the struct `Dst` is defined here LL | #[repr(C)] pub(self) struct Dst { | ^^^^^^^^^^^^^^^^^^^^ -error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context`. +error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context` --> $DIR/should_reject_if_dst_has_unreachable_ty.rs:38:41 | LL | assert::is_transmutable::(); - | ^^^^^^^^ `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context`. + | ^^^^^^^^ `Dst` is or contains a type or field that is not visible in that scope | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Dst` note: required by a bound in `is_transmutable` --> $DIR/should_reject_if_dst_has_unreachable_ty.rs:15:14 | diff --git a/tests/ui/transmute/transmute-padding-ice.stderr b/tests/ui/transmute/transmute-padding-ice.stderr index 87fd4fb66..f5480e0b9 100644 --- a/tests/ui/transmute/transmute-padding-ice.stderr +++ b/tests/ui/transmute/transmute-padding-ice.stderr @@ -1,10 +1,9 @@ -error[E0277]: `B` cannot be safely transmuted into `A` in the defining scope of `assert::Context`. +error[E0277]: `B` cannot be safely transmuted into `A` in the defining scope of `assert::Context` --> $DIR/transmute-padding-ice.rs:27:40 | LL | assert::is_maybe_transmutable::(); - | ^ `B` cannot be safely transmuted into `A` in the defining scope of `assert::Context`. + | ^ The size of `B` is smaller than the size of `A` | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `A` note: required by a bound in `is_maybe_transmutable` --> $DIR/transmute-padding-ice.rs:11:14 | diff --git a/tests/ui/tuple-index.rs b/tests/ui/tuple-index.rs deleted file mode 100644 index 3e1d92b42..000000000 --- a/tests/ui/tuple-index.rs +++ /dev/null @@ -1,32 +0,0 @@ -// run-pass - -struct Point(isize, isize); - -fn main() { - let mut x = Point(3, 2); - assert_eq!(x.0, 3); - assert_eq!(x.1, 2); - x.0 += 5; - assert_eq!(x.0, 8); - { - let ry = &mut x.1; - *ry -= 2; - x.0 += 3; - assert_eq!(x.0, 11); - } - assert_eq!(x.1, 0); - - let mut x = (3, 2); - assert_eq!(x.0, 3); - assert_eq!(x.1, 2); - x.0 += 5; - assert_eq!(x.0, 8); - { - let ry = &mut x.1; - *ry -= 2; - x.0 += 3; - assert_eq!(x.0, 11); - } - assert_eq!(x.1, 0); - -} diff --git a/tests/ui/tuple/tuple-index.rs b/tests/ui/tuple/tuple-index.rs new file mode 100644 index 000000000..3e1d92b42 --- /dev/null +++ b/tests/ui/tuple/tuple-index.rs @@ -0,0 +1,32 @@ +// run-pass + +struct Point(isize, isize); + +fn main() { + let mut x = Point(3, 2); + assert_eq!(x.0, 3); + assert_eq!(x.1, 2); + x.0 += 5; + assert_eq!(x.0, 8); + { + let ry = &mut x.1; + *ry -= 2; + x.0 += 3; + assert_eq!(x.0, 11); + } + assert_eq!(x.1, 0); + + let mut x = (3, 2); + assert_eq!(x.0, 3); + assert_eq!(x.1, 2); + x.0 += 5; + assert_eq!(x.0, 8); + { + let ry = &mut x.1; + *ry -= 2; + x.0 += 3; + assert_eq!(x.0, 11); + } + assert_eq!(x.1, 0); + +} diff --git a/tests/ui/type-alias-impl-trait/assoc-type-const.rs b/tests/ui/type-alias-impl-trait/assoc-type-const.rs index 0ade36daf..62f66914e 100644 --- a/tests/ui/type-alias-impl-trait/assoc-type-const.rs +++ b/tests/ui/type-alias-impl-trait/assoc-type-const.rs @@ -2,7 +2,7 @@ // const generics in an associated opaque type // check-pass -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] trait UnwrapItemsExt<'a, const C: usize> { type Iter; diff --git a/tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.rs b/tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.rs index 3f34b00ec..7c7c68ad6 100644 --- a/tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.rs +++ b/tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.rs @@ -1,7 +1,7 @@ // Tests that we don't allow unconstrained lifetime parameters in impls when // the lifetime is used in an associated opaque type. -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] trait UnwrapItemsExt { type Iter; diff --git a/tests/ui/type-alias-impl-trait/assoc-type-lifetime.rs b/tests/ui/type-alias-impl-trait/assoc-type-lifetime.rs index 39f785d8c..81dacbcfb 100644 --- a/tests/ui/type-alias-impl-trait/assoc-type-lifetime.rs +++ b/tests/ui/type-alias-impl-trait/assoc-type-lifetime.rs @@ -2,7 +2,7 @@ // lifetimes are used in an associated opaque type // check-pass -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] trait UnwrapItemsExt<'a> { type Iter; diff --git a/tests/ui/type-alias-impl-trait/associated-type-impl-trait-lifetime.rs b/tests/ui/type-alias-impl-trait/associated-type-impl-trait-lifetime.rs index 962606508..551815d02 100644 --- a/tests/ui/type-alias-impl-trait/associated-type-impl-trait-lifetime.rs +++ b/tests/ui/type-alias-impl-trait/associated-type-impl-trait-lifetime.rs @@ -1,6 +1,6 @@ //check-pass -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] trait Trait { type Opaque1; diff --git a/tests/ui/type-alias-impl-trait/auxiliary/collect_hidden_types.rs b/tests/ui/type-alias-impl-trait/auxiliary/collect_hidden_types.rs index 75d20a6fe..444a4e695 100644 --- a/tests/ui/type-alias-impl-trait/auxiliary/collect_hidden_types.rs +++ b/tests/ui/type-alias-impl-trait/auxiliary/collect_hidden_types.rs @@ -1,4 +1,4 @@ -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] // edition:2018 diff --git a/tests/ui/type-alias-impl-trait/auxiliary/cross_crate_ice2.rs b/tests/ui/type-alias-impl-trait/auxiliary/cross_crate_ice2.rs index 119f7df1f..98c961503 100644 --- a/tests/ui/type-alias-impl-trait/auxiliary/cross_crate_ice2.rs +++ b/tests/ui/type-alias-impl-trait/auxiliary/cross_crate_ice2.rs @@ -1,7 +1,7 @@ // Crate that exports an opaque `impl Trait` type. Used for testing cross-crate. #![crate_type = "rlib"] -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] pub trait View { type Tmp: Iterator; diff --git a/tests/ui/type-alias-impl-trait/impl-with-unconstrained-param.rs b/tests/ui/type-alias-impl-trait/impl-with-unconstrained-param.rs index 851c2f66c..1824ff5e2 100644 --- a/tests/ui/type-alias-impl-trait/impl-with-unconstrained-param.rs +++ b/tests/ui/type-alias-impl-trait/impl-with-unconstrained-param.rs @@ -1,7 +1,7 @@ // Ensure that we don't ICE if associated type impl trait is used in an impl // with an unconstrained type parameter. -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] trait X { type I; diff --git a/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds.rs b/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds.rs index ee9bce15d..4f99236f4 100644 --- a/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds.rs +++ b/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds.rs @@ -1,6 +1,6 @@ // check-pass -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] trait Callable { type Output; diff --git a/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.rs b/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.rs index ae21a9134..5d5645077 100644 --- a/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.rs +++ b/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.rs @@ -1,4 +1,4 @@ -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] trait Callable { type Output; @@ -17,7 +17,9 @@ impl<'a> PlusOne for &'a mut i32 { impl Callable for T { type Output = impl PlusOne; - fn call(t: T) -> Self::Output { t } + fn call(t: T) -> Self::Output { + t + } } fn test<'a>(y: &'a mut i32) -> impl PlusOne { diff --git a/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.stderr b/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.stderr index e52d5f9de..66e478315 100644 --- a/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.stderr +++ b/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.stderr @@ -1,5 +1,5 @@ error[E0700]: hidden type for `impl PlusOne` captures lifetime that does not appear in bounds - --> $DIR/imply_bounds_from_bounds_param.rs:24:5 + --> $DIR/imply_bounds_from_bounds_param.rs:26:5 | LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne { | -- ------------ opaque type defined here diff --git a/tests/ui/type-alias-impl-trait/incoherent-assoc-imp-trait.rs b/tests/ui/type-alias-impl-trait/incoherent-assoc-imp-trait.rs index 685d76ee3..8df59c68f 100644 --- a/tests/ui/type-alias-impl-trait/incoherent-assoc-imp-trait.rs +++ b/tests/ui/type-alias-impl-trait/incoherent-assoc-imp-trait.rs @@ -1,7 +1,7 @@ // Regression test for issue 67856 #![feature(unboxed_closures)] -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] #![feature(fn_traits)] trait MyTrait {} diff --git a/tests/ui/type-alias-impl-trait/issue-53598.rs b/tests/ui/type-alias-impl-trait/issue-53598.rs index 9c1cbf926..e3e2787b6 100644 --- a/tests/ui/type-alias-impl-trait/issue-53598.rs +++ b/tests/ui/type-alias-impl-trait/issue-53598.rs @@ -1,4 +1,4 @@ -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] use std::fmt::Debug; diff --git a/tests/ui/type-alias-impl-trait/issue-57188-associate-impl-capture.rs b/tests/ui/type-alias-impl-trait/issue-57188-associate-impl-capture.rs index 3a7a5da07..3bdb3bf1d 100644 --- a/tests/ui/type-alias-impl-trait/issue-57188-associate-impl-capture.rs +++ b/tests/ui/type-alias-impl-trait/issue-57188-associate-impl-capture.rs @@ -2,7 +2,7 @@ // check-pass -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] struct Baz<'a> { source: &'a str, diff --git a/tests/ui/type-alias-impl-trait/issue-57611-trait-alias.rs b/tests/ui/type-alias-impl-trait/issue-57611-trait-alias.rs index cad3e0f66..3917bb3b6 100644 --- a/tests/ui/type-alias-impl-trait/issue-57611-trait-alias.rs +++ b/tests/ui/type-alias-impl-trait/issue-57611-trait-alias.rs @@ -3,7 +3,7 @@ // Ensures that we don't ICE #![feature(trait_alias)] -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] trait Foo { type Bar: Baz; diff --git a/tests/ui/type-alias-impl-trait/issue-57700.rs b/tests/ui/type-alias-impl-trait/issue-57700.rs index 484589387..8746545ec 100644 --- a/tests/ui/type-alias-impl-trait/issue-57700.rs +++ b/tests/ui/type-alias-impl-trait/issue-57700.rs @@ -1,5 +1,5 @@ #![feature(arbitrary_self_types)] -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] use std::ops::Deref; diff --git a/tests/ui/type-alias-impl-trait/issue-57807-associated-type.rs b/tests/ui/type-alias-impl-trait/issue-57807-associated-type.rs index fcab2c7db..841bac5f6 100644 --- a/tests/ui/type-alias-impl-trait/issue-57807-associated-type.rs +++ b/tests/ui/type-alias-impl-trait/issue-57807-associated-type.rs @@ -2,7 +2,7 @@ // that we properly unify associated types within // a type alias impl trait // check-pass -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] trait Bar { type A; diff --git a/tests/ui/type-alias-impl-trait/issue-58887.rs b/tests/ui/type-alias-impl-trait/issue-58887.rs index 96ac78602..967586765 100644 --- a/tests/ui/type-alias-impl-trait/issue-58887.rs +++ b/tests/ui/type-alias-impl-trait/issue-58887.rs @@ -1,6 +1,6 @@ // run-pass -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] trait UnwrapItemsExt { type Iter; diff --git a/tests/ui/type-alias-impl-trait/issue-60371.rs b/tests/ui/type-alias-impl-trait/issue-60371.rs index 9a40f3d9b..a61739673 100644 --- a/tests/ui/type-alias-impl-trait/issue-60371.rs +++ b/tests/ui/type-alias-impl-trait/issue-60371.rs @@ -5,7 +5,7 @@ trait Bug { } impl Bug for &() { - type Item = impl Bug; //~ ERROR `impl Trait` in type aliases is unstable + type Item = impl Bug; //~ ERROR `impl Trait` in associated types is unstable const FUN: fn() -> Self::Item = || (); //~^ ERROR the trait bound `(): Bug` is not satisfied diff --git a/tests/ui/type-alias-impl-trait/issue-60371.stderr b/tests/ui/type-alias-impl-trait/issue-60371.stderr index d0c04371b..ffc664736 100644 --- a/tests/ui/type-alias-impl-trait/issue-60371.stderr +++ b/tests/ui/type-alias-impl-trait/issue-60371.stderr @@ -1,11 +1,11 @@ -error[E0658]: `impl Trait` in type aliases is unstable +error[E0658]: `impl Trait` in associated types is unstable --> $DIR/issue-60371.rs:8:17 | LL | type Item = impl Bug; | ^^^^^^^^ | = note: see issue #63063 for more information - = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable + = help: add `#![feature(impl_trait_in_assoc_type)]` to the crate attributes to enable error[E0277]: the trait bound `(): Bug` is not satisfied --> $DIR/issue-60371.rs:10:40 diff --git a/tests/ui/type-alias-impl-trait/issue-60564-working.rs b/tests/ui/type-alias-impl-trait/issue-60564-working.rs index 38accc824..c4687c29d 100644 --- a/tests/ui/type-alias-impl-trait/issue-60564-working.rs +++ b/tests/ui/type-alias-impl-trait/issue-60564-working.rs @@ -1,4 +1,4 @@ -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] // check-pass diff --git a/tests/ui/type-alias-impl-trait/issue-62000-associate-impl-trait-lifetimes.rs b/tests/ui/type-alias-impl-trait/issue-62000-associate-impl-trait-lifetimes.rs index 36779a0ce..0245eab79 100644 --- a/tests/ui/type-alias-impl-trait/issue-62000-associate-impl-trait-lifetimes.rs +++ b/tests/ui/type-alias-impl-trait/issue-62000-associate-impl-trait-lifetimes.rs @@ -2,7 +2,7 @@ // check-pass -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] trait MyTrait { type AssocType: Send; diff --git a/tests/ui/type-alias-impl-trait/issue-74761-2.rs b/tests/ui/type-alias-impl-trait/issue-74761-2.rs index d26ca5c3e..f582592e9 100644 --- a/tests/ui/type-alias-impl-trait/issue-74761-2.rs +++ b/tests/ui/type-alias-impl-trait/issue-74761-2.rs @@ -1,4 +1,4 @@ -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] pub trait A { type B; diff --git a/tests/ui/type-alias-impl-trait/issue-74761.rs b/tests/ui/type-alias-impl-trait/issue-74761.rs index d26ca5c3e..f582592e9 100644 --- a/tests/ui/type-alias-impl-trait/issue-74761.rs +++ b/tests/ui/type-alias-impl-trait/issue-74761.rs @@ -1,4 +1,4 @@ -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] pub trait A { type B; diff --git a/tests/ui/type-alias-impl-trait/issue-78450.rs b/tests/ui/type-alias-impl-trait/issue-78450.rs index fccbfb74f..2a984c1ed 100644 --- a/tests/ui/type-alias-impl-trait/issue-78450.rs +++ b/tests/ui/type-alias-impl-trait/issue-78450.rs @@ -1,6 +1,6 @@ // check-pass -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] pub trait AssociatedImpl { type ImplTrait; diff --git a/tests/ui/type-alias-impl-trait/issue-89952.rs b/tests/ui/type-alias-impl-trait/issue-89952.rs index dc0f19c04..f0ba9fa7c 100644 --- a/tests/ui/type-alias-impl-trait/issue-89952.rs +++ b/tests/ui/type-alias-impl-trait/issue-89952.rs @@ -1,6 +1,6 @@ // check-pass -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] trait SomeTrait {} impl SomeTrait for () {} diff --git a/tests/ui/type-alias-impl-trait/issue-90400-1.rs b/tests/ui/type-alias-impl-trait/issue-90400-1.rs index 15aead2f6..502076057 100644 --- a/tests/ui/type-alias-impl-trait/issue-90400-1.rs +++ b/tests/ui/type-alias-impl-trait/issue-90400-1.rs @@ -1,7 +1,7 @@ // Regression test for #90400, // taken from https://github.com/rust-lang/rust/issues/90400#issuecomment-954927836 -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] trait Bar { fn bar(&self); diff --git a/tests/ui/type-alias-impl-trait/issue-90400-2.rs b/tests/ui/type-alias-impl-trait/issue-90400-2.rs index 4c6e893c1..60ff962ea 100644 --- a/tests/ui/type-alias-impl-trait/issue-90400-2.rs +++ b/tests/ui/type-alias-impl-trait/issue-90400-2.rs @@ -1,7 +1,7 @@ // Regression test for #90400, // taken from https://github.com/rust-lang/rust/issues/90400#issuecomment-954927836 -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] trait Bar { fn bar(&self); diff --git a/tests/ui/type-alias-impl-trait/issue-94429.rs b/tests/ui/type-alias-impl-trait/issue-94429.rs index 2c965b875..d764545f9 100644 --- a/tests/ui/type-alias-impl-trait/issue-94429.rs +++ b/tests/ui/type-alias-impl-trait/issue-94429.rs @@ -1,4 +1,4 @@ -#![feature(type_alias_impl_trait, generator_trait, generators)] +#![feature(impl_trait_in_assoc_type, generator_trait, generators)] use std::ops::Generator; trait Runnable { @@ -13,7 +13,7 @@ impl Runnable for Implementor { type Gen = impl Generator; fn run(&mut self) -> Self::Gen { - //~^ ERROR: type mismatch resolving + //~^ ERROR: type mismatch resolving move || { yield 1; } diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.rs b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.rs index efbf4f1e3..296a3f3e3 100644 --- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.rs +++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.rs @@ -1,6 +1,6 @@ // regression test for #74018 -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] trait Trait { type Associated; diff --git a/tests/ui/type/type-check/assignment-in-if.stderr b/tests/ui/type/type-check/assignment-in-if.stderr index de133e559..9f4558ada 100644 --- a/tests/ui/type/type-check/assignment-in-if.stderr +++ b/tests/ui/type/type-check/assignment-in-if.stderr @@ -67,9 +67,6 @@ LL | x == 5 error[E0308]: mismatched types --> $DIR/assignment-in-if.rs:44:18 | -LL | if y = (Foo { foo: x }) { - | - here the type of `x` is inferred to be `usize` -... LL | if x == x && x = x && x == x { | ------ ^ expected `bool`, found `usize` | | @@ -78,9 +75,6 @@ LL | if x == x && x = x && x == x { error[E0308]: mismatched types --> $DIR/assignment-in-if.rs:44:22 | -LL | if y = (Foo { foo: x }) { - | - here the type of `x` is inferred to be `usize` -... LL | if x == x && x = x && x == x { | ^ expected `bool`, found `usize` @@ -98,9 +92,6 @@ LL | if x == x && x == x && x == x { error[E0308]: mismatched types --> $DIR/assignment-in-if.rs:51:28 | -LL | if y = (Foo { foo: x }) { - | - here the type of `x` is inferred to be `usize` -... LL | if x == x && x == x && x = x { | ---------------- ^ expected `bool`, found `usize` | | diff --git a/tests/ui/type/type-check/point-at-inference-3.fixed b/tests/ui/type/type-check/point-at-inference-3.fixed index edd4adf8b..15a3b5805 100644 --- a/tests/ui/type/type-check/point-at-inference-3.fixed +++ b/tests/ui/type/type-check/point-at-inference-3.fixed @@ -2,7 +2,8 @@ fn main() { let mut v = Vec::new(); v.push(0i32); - //~^ NOTE this is of type `i32`, which causes `v` to be inferred as `Vec` + //~^ NOTE this argument has type `i32`... + //~| NOTE ... which causes `v` to have type `Vec` v.push(0); v.push(1i32); //~ ERROR mismatched types //~^ NOTE expected `i32`, found `u32` diff --git a/tests/ui/type/type-check/point-at-inference-3.rs b/tests/ui/type/type-check/point-at-inference-3.rs index 49d7b5007..a48c4f986 100644 --- a/tests/ui/type/type-check/point-at-inference-3.rs +++ b/tests/ui/type/type-check/point-at-inference-3.rs @@ -2,7 +2,8 @@ fn main() { let mut v = Vec::new(); v.push(0i32); - //~^ NOTE this is of type `i32`, which causes `v` to be inferred as `Vec` + //~^ NOTE this argument has type `i32`... + //~| NOTE ... which causes `v` to have type `Vec` v.push(0); v.push(1u32); //~ ERROR mismatched types //~^ NOTE expected `i32`, found `u32` diff --git a/tests/ui/type/type-check/point-at-inference-3.stderr b/tests/ui/type/type-check/point-at-inference-3.stderr index 2c4907ed2..238764812 100644 --- a/tests/ui/type/type-check/point-at-inference-3.stderr +++ b/tests/ui/type/type-check/point-at-inference-3.stderr @@ -1,8 +1,10 @@ error[E0308]: mismatched types - --> $DIR/point-at-inference-3.rs:7:12 + --> $DIR/point-at-inference-3.rs:8:12 | LL | v.push(0i32); - | ---- this is of type `i32`, which causes `v` to be inferred as `Vec` + | - ---- this argument has type `i32`... + | | + | ... which causes `v` to have type `Vec` ... LL | v.push(1u32); | ---- ^^^^ expected `i32`, found `u32` diff --git a/tests/ui/type/type-check/point-at-inference-4.rs b/tests/ui/type/type-check/point-at-inference-4.rs index aea9b2c6c..3deb234c2 100644 --- a/tests/ui/type/type-check/point-at-inference-4.rs +++ b/tests/ui/type/type-check/point-at-inference-4.rs @@ -11,8 +11,11 @@ fn main() { let s = S(None); s.infer(0i32); //~^ ERROR this method takes 2 arguments but 1 argument was supplied + //~| NOTE this argument has type `i32`... + //~| NOTE ... which causes `s` to have type `S` //~| NOTE an argument is missing //~| HELP provide the argument + //~| HELP change the type of the numeric literal from `i32` to `u32` let t: S = s; //~^ ERROR mismatched types //~| NOTE expected `S`, found `S` diff --git a/tests/ui/type/type-check/point-at-inference-4.stderr b/tests/ui/type/type-check/point-at-inference-4.stderr index 28833d2ed..5f7bb8b93 100644 --- a/tests/ui/type/type-check/point-at-inference-4.stderr +++ b/tests/ui/type/type-check/point-at-inference-4.stderr @@ -15,8 +15,13 @@ LL | s.infer(0i32, /* b */); | ~~~~~~~~~~~~~~~ error[E0308]: mismatched types - --> $DIR/point-at-inference-4.rs:16:24 + --> $DIR/point-at-inference-4.rs:19:24 | +LL | s.infer(0i32); + | - ---- this argument has type `i32`... + | | + | ... which causes `s` to have type `S` +... LL | let t: S = s; | --------- ^ expected `S`, found `S` | | @@ -24,6 +29,10 @@ LL | let t: S = s; | = note: expected struct `S` found struct `S` +help: change the type of the numeric literal from `i32` to `u32` + | +LL | s.infer(0u32); + | ~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/type/type-check/point-at-inference.stderr b/tests/ui/type/type-check/point-at-inference.stderr index a76b4f90c..5fc94d4d1 100644 --- a/tests/ui/type/type-check/point-at-inference.stderr +++ b/tests/ui/type/type-check/point-at-inference.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/point-at-inference.rs:12:9 | LL | foo.push(i); - | - this is of type `&{integer}`, which causes `foo` to be inferred as `Vec<&{integer}>` + | --- - this argument has type `&{integer}`... + | | + | ... which causes `foo` to have type `Vec<&{integer}>` ... LL | bar(foo); | --- ^^^ expected `Vec`, found `Vec<&{integer}>` diff --git a/tests/ui/typeck/bad-type-in-vec-contains.stderr b/tests/ui/typeck/bad-type-in-vec-contains.stderr index 0e03388d2..72533ab1f 100644 --- a/tests/ui/typeck/bad-type-in-vec-contains.stderr +++ b/tests/ui/typeck/bad-type-in-vec-contains.stderr @@ -7,7 +7,6 @@ LL | primes.contains(3); | | expected `&_`, found integer | | help: consider borrowing here: `&3` | arguments to this method are incorrect - | here the type of `primes` is inferred to be `[_]` | = note: expected reference `&_` found type `{integer}` diff --git a/tests/ui/typeck/bad-type-in-vec-push.stderr b/tests/ui/typeck/bad-type-in-vec-push.stderr index ae46050c9..1d5337260 100644 --- a/tests/ui/typeck/bad-type-in-vec-push.stderr +++ b/tests/ui/typeck/bad-type-in-vec-push.stderr @@ -1,8 +1,6 @@ error[E0308]: mismatched types --> $DIR/bad-type-in-vec-push.rs:11:17 | -LL | vector.sort(); - | ------ here the type of `vector` is inferred to be `Vec<_>` LL | result.push(vector); | ---- ^^^^^^ expected integer, found `Vec<_>` | | diff --git a/tests/ui/typeck/explain_clone_autoref.stderr b/tests/ui/typeck/explain_clone_autoref.stderr index 4539da438..38cb7fe55 100644 --- a/tests/ui/typeck/explain_clone_autoref.stderr +++ b/tests/ui/typeck/explain_clone_autoref.stderr @@ -14,7 +14,8 @@ LL | nc.clone() | ^^ help: consider annotating `NotClone` with `#[derive(Clone)]` | -LL | #[derive(Clone)] +LL + #[derive(Clone)] +LL | struct NotClone; | error: aborting due to previous error diff --git a/tests/ui/typeck/issue-105946.rs b/tests/ui/typeck/issue-105946.rs index bf01751d5..f53f31138 100644 --- a/tests/ui/typeck/issue-105946.rs +++ b/tests/ui/typeck/issue-105946.rs @@ -1,12 +1,10 @@ fn digit() -> str { - return {}; - //~^ ERROR: mismatched types [E0308] + return {}; + //~^ ERROR: mismatched types [E0308] } fn main() { - let [_y..] = [box 1, box 2]; + let [_y..] = [Box::new(1), Box::new(2)]; //~^ ERROR: cannot find value `_y` in this scope [E0425] //~| ERROR: `X..` patterns in slices are experimental [E0658] - //~| ERROR: box expression syntax is experimental; you can call `Box::new` instead [E0658] - //~| ERROR: box expression syntax is experimental; you can call `Box::new` instead [E0658] //~| ERROR: pattern requires 1 element but array has 2 [E0527] } diff --git a/tests/ui/typeck/issue-105946.stderr b/tests/ui/typeck/issue-105946.stderr index d803de4df..26c3b7fbc 100644 --- a/tests/ui/typeck/issue-105946.stderr +++ b/tests/ui/typeck/issue-105946.stderr @@ -1,49 +1,31 @@ error[E0425]: cannot find value `_y` in this scope --> $DIR/issue-105946.rs:6:10 | -LL | let [_y..] = [box 1, box 2]; +LL | let [_y..] = [Box::new(1), Box::new(2)]; | ^^ not found in this scope error[E0658]: `X..` patterns in slices are experimental --> $DIR/issue-105946.rs:6:10 | -LL | let [_y..] = [box 1, box 2]; +LL | let [_y..] = [Box::new(1), Box::new(2)]; | ^^^^ | = note: see issue #67264 for more information = help: add `#![feature(half_open_range_patterns_in_slices)]` to the crate attributes to enable -error[E0658]: box expression syntax is experimental; you can call `Box::new` instead - --> $DIR/issue-105946.rs:6:19 - | -LL | let [_y..] = [box 1, box 2]; - | ^^^^^ - | - = note: see issue #49733 for more information - = help: add `#![feature(box_syntax)]` to the crate attributes to enable - -error[E0658]: box expression syntax is experimental; you can call `Box::new` instead - --> $DIR/issue-105946.rs:6:26 - | -LL | let [_y..] = [box 1, box 2]; - | ^^^^^ - | - = note: see issue #49733 for more information - = help: add `#![feature(box_syntax)]` to the crate attributes to enable - error[E0308]: mismatched types - --> $DIR/issue-105946.rs:2:10 + --> $DIR/issue-105946.rs:2:12 | -LL | return {}; - | ^^ expected `str`, found `()` +LL | return {}; + | ^^ expected `str`, found `()` error[E0527]: pattern requires 1 element but array has 2 --> $DIR/issue-105946.rs:6:9 | -LL | let [_y..] = [box 1, box 2]; +LL | let [_y..] = [Box::new(1), Box::new(2)]; | ^^^^^^ expected 2 elements -error: aborting due to 6 previous errors +error: aborting due to 4 previous errors Some errors have detailed explanations: E0308, E0425, E0527, E0658. For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/issue-107775.stderr b/tests/ui/typeck/issue-107775.stderr index 9ee9c022c..b97e74b7e 100644 --- a/tests/ui/typeck/issue-107775.stderr +++ b/tests/ui/typeck/issue-107775.stderr @@ -2,9 +2,9 @@ error[E0308]: mismatched types --> $DIR/issue-107775.rs:35:16 | LL | map.insert(1, Struct::do_something); - | - -------------------- this is of type `fn(u8) -> Pin + Send>> {::do_something::<'_>}`, which causes `map` to be inferred as `HashMap<{integer}, fn(u8) -> Pin + Send>> {::do_something::<'_>}>` - | | - | this is of type `{integer}`, which causes `map` to be inferred as `HashMap<{integer}, fn(u8) -> Pin + Send>> {::do_something::<'_>}>` + | --- -------------------- this argument has type `fn(u8) -> Pin + Send>> {::do_something::<'_>}`... + | | + | ... which causes `map` to have type `HashMap<{integer}, fn(u8) -> Pin + Send>> {::do_something::<'_>}>` LL | Self { map } | ^^^ expected `HashMap Pin<...>>`, found `HashMap<{integer}, ...>` | diff --git a/tests/ui/typeck/issue-110052.rs b/tests/ui/typeck/issue-110052.rs new file mode 100644 index 000000000..f124b58b5 --- /dev/null +++ b/tests/ui/typeck/issue-110052.rs @@ -0,0 +1,12 @@ +// Makes sure we deal with escaping lifetimes *above* INNERMOST when +// suggesting trait for ambiguous associated type. + +impl Validator for () +where + for<'iter> dyn Validator<<&'iter I>::Item>:, + //~^ ERROR ambiguous associated type +{} + +pub trait Validator {} + +fn main() {} diff --git a/tests/ui/typeck/issue-110052.stderr b/tests/ui/typeck/issue-110052.stderr new file mode 100644 index 000000000..0c15c03a7 --- /dev/null +++ b/tests/ui/typeck/issue-110052.stderr @@ -0,0 +1,9 @@ +error[E0223]: ambiguous associated type + --> $DIR/issue-110052.rs:6:30 + | +LL | for<'iter> dyn Validator<<&'iter I>::Item>:, + | ^^^^^^^^^^^^^^^^ help: use the fully-qualified path: `<&'iter I as IntoIterator>::Item` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0223`. diff --git a/tests/ui/typeck/issue-43189.stderr b/tests/ui/typeck/issue-43189.stderr index caf7530b8..c072e6a08 100644 --- a/tests/ui/typeck/issue-43189.stderr +++ b/tests/ui/typeck/issue-43189.stderr @@ -12,7 +12,7 @@ LL | fn a(&self) {} = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use xcrate_issue_43189_b::xcrate_issue_43189_a::A; +LL + use xcrate_issue_43189_b::xcrate_issue_43189_a::A; | error: aborting due to previous error diff --git a/tests/ui/typeck/issue-87935-unsized-box-expr.rs b/tests/ui/typeck/issue-87935-unsized-box-expr.rs deleted file mode 100644 index cd2a82074..000000000 --- a/tests/ui/typeck/issue-87935-unsized-box-expr.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![feature(box_syntax)] -// Box expression needs to be movable, and hence has to be of a Sized type. -fn main() { - let _x: Box<[u32]> = box { loop {} }; - //~^ ERROR: the size for values of type `[u32]` cannot be known at compilation time - - // Check that a deduced size does not cause issues. - let _y: Box<[u32]> = box []; - let _z: Box<[u32; 0]> = box { loop {} }; -} diff --git a/tests/ui/typeck/issue-87935-unsized-box-expr.stderr b/tests/ui/typeck/issue-87935-unsized-box-expr.stderr deleted file mode 100644 index 9ff822352..000000000 --- a/tests/ui/typeck/issue-87935-unsized-box-expr.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0277]: the size for values of type `[u32]` cannot be known at compilation time - --> $DIR/issue-87935-unsized-box-expr.rs:4:30 - | -LL | let _x: Box<[u32]> = box { loop {} }; - | ^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `[u32]` - = note: the type of a box expression must have a statically known size - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/typeck/issue-90164.stderr b/tests/ui/typeck/issue-90164.stderr index 1e2f1bae3..8586f5222 100644 --- a/tests/ui/typeck/issue-90164.stderr +++ b/tests/ui/typeck/issue-90164.stderr @@ -6,7 +6,8 @@ LL | copy(r, w); | | | required by a bound introduced by this call | - = note: consider using `Box::pin` + = note: consider using the `pin!` macro + consider using `Box::pin` if you need to access the pinned value outside of the current scope note: required by a bound in `copy` --> $DIR/issue-90164.rs:1:12 | diff --git a/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.rs b/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.rs deleted file mode 100644 index 5ff567cd0..000000000 --- a/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.rs +++ /dev/null @@ -1,6 +0,0 @@ -// compile-flags: -Ztrait-solver=next -// known-bug: unknown - -fn main() { - (0u8 + 0u8) as char; -} diff --git a/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.stderr b/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.stderr deleted file mode 100644 index 6b09ccd52..000000000 --- a/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0271]: type mismatch resolving `char == ::Output` - --> $DIR/cast-checks-handling-projections.rs:5:5 - | -LL | (0u8 + 0u8) as char; - | ^^^^^^^^^^^ types differ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/typeck/lazy-norm/equating-projection-cyclically.rs b/tests/ui/typeck/lazy-norm/equating-projection-cyclically.rs deleted file mode 100644 index 019c6e81c..000000000 --- a/tests/ui/typeck/lazy-norm/equating-projection-cyclically.rs +++ /dev/null @@ -1,24 +0,0 @@ -// compile-flags: -Ztrait-solver=next -// known-bug: unknown - -trait Test { - type Assoc; -} - -fn transform(x: T) -> T::Assoc { - todo!() -} - -impl Test for i32 { - type Assoc = i32; -} - -impl Test for String { - type Assoc = String; -} - -fn main() { - let mut x = Default::default(); - x = transform(x); - x = 1i32; -} diff --git a/tests/ui/typeck/lazy-norm/equating-projection-cyclically.stderr b/tests/ui/typeck/lazy-norm/equating-projection-cyclically.stderr deleted file mode 100644 index 57cbc65a1..000000000 --- a/tests/ui/typeck/lazy-norm/equating-projection-cyclically.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/equating-projection-cyclically.rs:22:19 - | -LL | x = transform(x); - | ^ expected inferred type, found associated type - | - = note: expected type `_` - found associated type `<_ as Test>::Assoc` - = help: consider constraining the associated type `<_ as Test>::Assoc` to `_` - = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/output-type-mismatch.rs b/tests/ui/typeck/output-type-mismatch.rs new file mode 100644 index 000000000..35097aa9e --- /dev/null +++ b/tests/ui/typeck/output-type-mismatch.rs @@ -0,0 +1,5 @@ +// error-pattern: mismatched types + +fn f() { } + +fn main() { let i: isize; i = f(); } diff --git a/tests/ui/typeck/output-type-mismatch.stderr b/tests/ui/typeck/output-type-mismatch.stderr new file mode 100644 index 000000000..4507a4df6 --- /dev/null +++ b/tests/ui/typeck/output-type-mismatch.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/output-type-mismatch.rs:5:31 + | +LL | fn main() { let i: isize; i = f(); } + | ----- ^^^ expected `isize`, found `()` + | | + | expected due to this type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/suppressed-error.rs b/tests/ui/typeck/suppressed-error.rs new file mode 100644 index 000000000..1e39be460 --- /dev/null +++ b/tests/ui/typeck/suppressed-error.rs @@ -0,0 +1,8 @@ +fn main() { + let (x, y) = (); +//~^ ERROR mismatched types +//~| expected unit type `()` +//~| found tuple `(_, _)` +//~| expected `()`, found + return x; +} diff --git a/tests/ui/typeck/suppressed-error.stderr b/tests/ui/typeck/suppressed-error.stderr new file mode 100644 index 000000000..11d70f8a4 --- /dev/null +++ b/tests/ui/typeck/suppressed-error.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/suppressed-error.rs:2:9 + | +LL | let (x, y) = (); + | ^^^^^^ -- this expression has type `()` + | | + | expected `()`, found `(_, _)` + | + = note: expected unit type `()` + found tuple `(_, _)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/tag-that-dare-not-speak-its-name.rs b/tests/ui/typeck/tag-that-dare-not-speak-its-name.rs new file mode 100644 index 000000000..0e76ec246 --- /dev/null +++ b/tests/ui/typeck/tag-that-dare-not-speak-its-name.rs @@ -0,0 +1,16 @@ +// Issue #876 + +use std::vec::Vec; + +fn last(v: Vec<&T> ) -> std::option::Option { + ::std::panic!(); +} + +fn main() { + let y; + let x : char = last(y); + //~^ ERROR mismatched types + //~| expected type `char` + //~| found enum `Option<_>` + //~| expected `char`, found `Option<_>` +} diff --git a/tests/ui/typeck/tag-that-dare-not-speak-its-name.stderr b/tests/ui/typeck/tag-that-dare-not-speak-its-name.stderr new file mode 100644 index 000000000..f53abe53b --- /dev/null +++ b/tests/ui/typeck/tag-that-dare-not-speak-its-name.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/tag-that-dare-not-speak-its-name.rs:11:20 + | +LL | let x : char = last(y); + | ---- ^^^^^^^ expected `char`, found `Option<_>` + | | + | expected due to this + | + = note: expected type `char` + found enum `Option<_>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/terr-in-field.rs b/tests/ui/typeck/terr-in-field.rs new file mode 100644 index 000000000..cfe350ef8 --- /dev/null +++ b/tests/ui/typeck/terr-in-field.rs @@ -0,0 +1,17 @@ +struct Foo { + a: isize, + b: isize, +} + +struct Bar { + a: isize, + b: usize, +} + +fn want_foo(f: Foo) {} +fn have_bar(b: Bar) { + want_foo(b); //~ ERROR mismatched types + //~| expected `Foo`, found `Bar` +} + +fn main() {} diff --git a/tests/ui/typeck/terr-in-field.stderr b/tests/ui/typeck/terr-in-field.stderr new file mode 100644 index 000000000..09df4b34b --- /dev/null +++ b/tests/ui/typeck/terr-in-field.stderr @@ -0,0 +1,17 @@ +error[E0308]: mismatched types + --> $DIR/terr-in-field.rs:13:14 + | +LL | want_foo(b); + | -------- ^ expected `Foo`, found `Bar` + | | + | arguments to this function are incorrect + | +note: function defined here + --> $DIR/terr-in-field.rs:11:4 + | +LL | fn want_foo(f: Foo) {} + | ^^^^^^^^ ------ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/terr-sorts.rs b/tests/ui/typeck/terr-sorts.rs new file mode 100644 index 000000000..c1e2f7dae --- /dev/null +++ b/tests/ui/typeck/terr-sorts.rs @@ -0,0 +1,15 @@ +struct Foo { + a: isize, + b: isize, +} + +type Bar = Box; + +fn want_foo(f: Foo) {} +fn have_bar(b: Bar) { + want_foo(b); //~ ERROR mismatched types + //~| expected struct `Foo` + //~| found struct `Box` +} + +fn main() {} diff --git a/tests/ui/typeck/terr-sorts.stderr b/tests/ui/typeck/terr-sorts.stderr new file mode 100644 index 000000000..8f1975374 --- /dev/null +++ b/tests/ui/typeck/terr-sorts.stderr @@ -0,0 +1,23 @@ +error[E0308]: mismatched types + --> $DIR/terr-sorts.rs:10:14 + | +LL | want_foo(b); + | -------- ^ expected `Foo`, found `Box` + | | + | arguments to this function are incorrect + | + = note: expected struct `Foo` + found struct `Box` +note: function defined here + --> $DIR/terr-sorts.rs:8:4 + | +LL | fn want_foo(f: Foo) {} + | ^^^^^^^^ ------ +help: consider unboxing the value + | +LL | want_foo(*b); + | + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/while-type-error.rs b/tests/ui/typeck/while-type-error.rs new file mode 100644 index 000000000..8098bfcd8 --- /dev/null +++ b/tests/ui/typeck/while-type-error.rs @@ -0,0 +1,3 @@ +// error-pattern: mismatched types + +fn main() { while main { } } diff --git a/tests/ui/typeck/while-type-error.stderr b/tests/ui/typeck/while-type-error.stderr new file mode 100644 index 000000000..529cbff05 --- /dev/null +++ b/tests/ui/typeck/while-type-error.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/while-type-error.rs:3:19 + | +LL | fn main() { while main { } } + | ^^^^ expected `bool`, found fn item + | + = note: expected type `bool` + found fn item `fn() {main}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/wrong-ret-type.rs b/tests/ui/typeck/wrong-ret-type.rs new file mode 100644 index 000000000..cbff8dbae --- /dev/null +++ b/tests/ui/typeck/wrong-ret-type.rs @@ -0,0 +1,3 @@ +// error-pattern: mismatched types +fn mk_int() -> usize { let i: isize = 3; return i; } +fn main() { } diff --git a/tests/ui/typeck/wrong-ret-type.stderr b/tests/ui/typeck/wrong-ret-type.stderr new file mode 100644 index 000000000..c686a0b2f --- /dev/null +++ b/tests/ui/typeck/wrong-ret-type.stderr @@ -0,0 +1,16 @@ +error[E0308]: mismatched types + --> $DIR/wrong-ret-type.rs:2:49 + | +LL | fn mk_int() -> usize { let i: isize = 3; return i; } + | ----- ^ expected `usize`, found `isize` + | | + | expected `usize` because of return type + | +help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit + | +LL | fn mk_int() -> usize { let i: isize = 3; return i.try_into().unwrap(); } + | ++++++++++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/ufcs-polymorphic-paths.rs b/tests/ui/ufcs-polymorphic-paths.rs deleted file mode 100644 index a14ebd6a4..000000000 --- a/tests/ui/ufcs-polymorphic-paths.rs +++ /dev/null @@ -1,154 +0,0 @@ -// run-pass - -use std::borrow::{Cow, ToOwned}; -use std::default::Default; -use std::iter::FromIterator; -use std::ops::Add; -use std::option::IntoIter as OptionIter; - -pub struct XorShiftRng; -use XorShiftRng as DummyRng; -impl Rng for XorShiftRng {} -pub trait Rng {} -pub trait Rand: Default + Sized { - fn rand(_rng: &mut R) -> Self { Default::default() } -} -impl Rand for i32 { } - -pub trait IntoCow<'a, B: ?Sized> where B: ToOwned { - fn into_cow(self) -> Cow<'a, B>; -} - -impl<'a> IntoCow<'a, str> for String { - fn into_cow(self) -> Cow<'a, str> { - Cow::Owned(self) - } -} - -#[derive(PartialEq, Eq)] -struct Newt(T); - -fn id(x: T) -> T { x } -fn eq(a: T, b: T) -> bool { a == b } -fn u8_as_i8(x: u8) -> i8 { x as i8 } -fn odd(x: usize) -> bool { x % 2 == 1 } -fn dummy_rng() -> DummyRng { XorShiftRng } - -trait Size: Sized { - fn size() -> usize { std::mem::size_of::() } -} -impl Size for T {} - -#[derive(PartialEq, Eq)] -struct BitVec; - -impl BitVec { - fn from_fn(_: usize, _: F) -> BitVec where F: FnMut(usize) -> bool { - BitVec - } -} - -#[derive(PartialEq, Eq)] -struct Foo(T); - -impl Foo { - fn map_in_place(self, mut f: F) -> Foo where F: FnMut(T) -> U { - Foo(f(self.0)) - } - -} - -macro_rules! tests { - ($($expr:expr, $ty:ty, ($($test:expr),*);)+) => (pub fn main() {$({ - const C: $ty = $expr; - static S: $ty = $expr; - assert!(eq(C($($test),*), $expr($($test),*))); - assert!(eq(S($($test),*), $expr($($test),*))); - assert!(eq(C($($test),*), S($($test),*))); - })+}) -} - -tests! { - // Free function. - id, fn(i32) -> i32, (5); - id::, fn(i32) -> i32, (5); - - // Enum variant constructor. - Some, fn(i32) -> Option, (5); - Some::, fn(i32) -> Option, (5); - - // Tuple struct constructor. - Newt, fn(i32) -> Newt, (5); - Newt::, fn(i32) -> Newt, (5); - - // Inherent static methods. - Vec::new, fn() -> Vec<()>, (); - Vec::<()>::new, fn() -> Vec<()>, (); - >::new, fn() -> Vec<()>, (); - Vec::with_capacity, fn(usize) -> Vec<()>, (5); - Vec::<()>::with_capacity, fn(usize) -> Vec<()>, (5); - >::with_capacity, fn(usize) -> Vec<()>, (5); - BitVec::from_fn, fn(usize, fn(usize) -> bool) -> BitVec, (5, odd); - BitVec::from_fn:: bool>, fn(usize, fn(usize) -> bool) -> BitVec, (5, odd); - - // Inherent non-static method. - Foo::map_in_place, fn(Foo, fn(u8) -> i8) -> Foo, (Foo(b'f'), u8_as_i8); - Foo::map_in_place:: i8>, fn(Foo, fn(u8) -> i8) -> Foo, - (Foo(b'f'), u8_as_i8); - Foo::::map_in_place, fn(Foo, fn(u8) -> i8) -> Foo - , (Foo(b'f'), u8_as_i8); - Foo::::map_in_place:: i8>, fn(Foo, fn(u8) -> i8) -> Foo - , (Foo(b'f'), u8_as_i8); - - // Trait static methods. - bool::size, fn() -> usize, (); - ::size, fn() -> usize, (); - ::size, fn() -> usize, (); - - Default::default, fn() -> i32, (); - i32::default, fn() -> i32, (); - ::default, fn() -> i32, (); - ::default, fn() -> i32, (); - - Rand::rand, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); - i32::rand, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); - ::rand, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); - ::rand, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); - Rand::rand::, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); - i32::rand::, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); - ::rand::, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); - ::rand::, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); - - // Trait non-static methods. - Clone::clone, fn(&i32) -> i32, (&5); - i32::clone, fn(&i32) -> i32, (&5); - ::clone, fn(&i32) -> i32, (&5); - ::clone, fn(&i32) -> i32, (&5); - - FromIterator::from_iter, fn(OptionIter) -> Vec, (Some(5).into_iter()); - Vec::from_iter, fn(OptionIter) -> Vec, (Some(5).into_iter()); - >::from_iter, fn(OptionIter) -> Vec, (Some(5).into_iter()); - as FromIterator<_>>::from_iter, fn(OptionIter) -> Vec, - (Some(5).into_iter()); - as FromIterator<_>>::from_iter, fn(OptionIter) -> Vec, - (Some(5).into_iter()); - FromIterator::from_iter::>, fn(OptionIter) -> Vec, - (Some(5).into_iter()); - as FromIterator<_>>::from_iter::>, fn(OptionIter) -> Vec, - (Some(5).into_iter()); - - Add::add, fn(i32, i32) -> i32, (5, 6); - i32::add, fn(i32, i32) -> i32, (5, 6); - ::add, fn(i32, i32) -> i32, (5, 6); - >::add, fn(i32, i32) -> i32, (5, 6); - >::add, fn(i32, i32) -> i32, (5, 6); - - String::into_cow, fn(String) -> Cow<'static, str>, - ("foo".to_string()); - ::into_cow, fn(String) -> Cow<'static, str>, - ("foo".to_string()); - >::into_cow, fn(String) -> Cow<'static, str>, - ("foo".to_string()); - >::into_cow, fn(String) -> Cow<'static, str>, - ("foo".to_string()); -} diff --git a/tests/ui/ufcs/ufcs-partially-resolved.rs b/tests/ui/ufcs/ufcs-partially-resolved.rs index e6470aa6d..712668728 100644 --- a/tests/ui/ufcs/ufcs-partially-resolved.rs +++ b/tests/ui/ufcs/ufcs-partially-resolved.rs @@ -17,37 +17,37 @@ type A = u32; fn main() { let _: ::N; //~ ERROR cannot find associated type `N` in trait `Tr` - let _: ::N; //~ ERROR cannot find associated type `N` in enum `E` - let _: ::N; //~ ERROR cannot find associated type `N` in `A` + let _: ::N; //~ ERROR expected trait, found enum `E` + let _: ::N; //~ ERROR expected trait, found type alias `A` ::N; //~ ERROR cannot find method or associated constant `N` in trait `Tr` - ::N; //~ ERROR cannot find method or associated constant `N` in enum `E` - ::N; //~ ERROR cannot find method or associated constant `N` in `A` + ::N; //~ ERROR expected trait, found enum `E` + ::N; //~ ERROR expected trait, found type alias `A` let _: ::Y; // OK - let _: ::Y; //~ ERROR expected associated type, found variant `E::Y` + let _: ::Y; //~ ERROR expected trait, found enum `E` ::Y; // OK - ::Y; //~ ERROR expected method or associated constant, found unit variant `E::Y` + ::Y; //~ ERROR expected trait, found enum `E` let _: ::N::NN; //~ ERROR cannot find associated type `N` in trait `Tr` - let _: ::N::NN; //~ ERROR cannot find associated type `N` in enum `E` - let _: ::N::NN; //~ ERROR cannot find associated type `N` in `A` + let _: ::N::NN; //~ ERROR expected trait, found enum `E` + let _: ::N::NN; //~ ERROR expected trait, found type alias `A` ::N::NN; //~ ERROR cannot find associated type `N` in trait `Tr` - ::N::NN; //~ ERROR cannot find associated type `N` in enum `E` - ::N::NN; //~ ERROR cannot find associated type `N` in `A` + ::N::NN; //~ ERROR expected trait, found enum `E` + ::N::NN; //~ ERROR expected trait, found type alias `A` let _: ::Y::NN; //~ ERROR ambiguous associated type - let _: ::Y::NN; //~ ERROR expected associated type, found variant `E::Y` + let _: ::Y::NN; //~ ERROR expected trait, found enum `E` ::Y::NN; //~ ERROR no associated item named `NN` found for type `u16` - ::Y::NN; //~ ERROR expected associated type, found variant `E::Y` + ::Y::NN; //~ ERROR expected trait, found enum `E` - let _: ::NN; //~ ERROR cannot find associated type `NN` in `Tr::N` - let _: ::NN; //~ ERROR cannot find associated type `NN` in `E::N` - let _: ::NN; //~ ERROR cannot find associated type `NN` in `A::N` - ::NN; //~ ERROR cannot find method or associated constant `NN` in `Tr::N` - ::NN; //~ ERROR cannot find method or associated constant `NN` in `E::N` - ::NN; //~ ERROR cannot find method or associated constant `NN` in `A::N` - let _: ::NN; //~ ERROR cannot find associated type `NN` in `Tr::Y` - let _: ::NN; //~ ERROR failed to resolve: `Y` is a variant, not a module - ::NN; //~ ERROR cannot find method or associated constant `NN` in `Tr::Y` - ::NN; //~ ERROR failed to resolve: `Y` is a variant, not a module + let _: ::NN; //~ ERROR cannot find trait `N` in trait `Tr` + let _: ::NN; //~ ERROR cannot find trait `N` in enum `E` + let _: ::NN; //~ ERROR cannot find trait `N` in `A` + ::NN; //~ ERROR cannot find trait `N` in trait `Tr` + ::NN; //~ ERROR cannot find trait `N` in enum `E` + ::NN; //~ ERROR cannot find trait `N` in `A` + let _: ::NN; //~ ERROR expected trait, found associated type `Tr::Y + let _: ::NN; //~ ERROR expected trait, found variant `E::Y` + ::NN; //~ ERROR expected trait, found associated type `Tr::Y` + ::NN; //~ ERROR expected trait, found variant `E::Y` let _: ::Z; //~ ERROR expected associated type, found associated function `Dr::Z` ::X; //~ ERROR expected method or associated constant, found associated type `Dr::X` diff --git a/tests/ui/ufcs/ufcs-partially-resolved.stderr b/tests/ui/ufcs/ufcs-partially-resolved.stderr index 72fccea8a..eef55c8dc 100644 --- a/tests/ui/ufcs/ufcs-partially-resolved.stderr +++ b/tests/ui/ufcs/ufcs-partially-resolved.stderr @@ -1,15 +1,3 @@ -error[E0433]: failed to resolve: `Y` is a variant, not a module - --> $DIR/ufcs-partially-resolved.rs:48:22 - | -LL | let _: ::NN; - | ^ `Y` is a variant, not a module - -error[E0433]: failed to resolve: `Y` is a variant, not a module - --> $DIR/ufcs-partially-resolved.rs:50:15 - | -LL | ::NN; - | ^ `Y` is a variant, not a module - error[E0576]: cannot find associated type `N` in trait `Tr` --> $DIR/ufcs-partially-resolved.rs:19:24 | @@ -19,17 +7,25 @@ LL | type Y = u16; LL | let _: ::N; | ^ help: an associated type with a similar name exists: `Y` -error[E0576]: cannot find associated type `N` in enum `E` - --> $DIR/ufcs-partially-resolved.rs:20:23 +error[E0404]: expected trait, found enum `E` + --> $DIR/ufcs-partially-resolved.rs:20:19 | LL | let _: ::N; - | ^ not found in `E` + | ^ help: a trait with a similar name exists: `Eq` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + | + = note: similarly named trait `Eq` defined here -error[E0576]: cannot find associated type `N` in `A` - --> $DIR/ufcs-partially-resolved.rs:21:23 +error[E0404]: expected trait, found type alias `A` + --> $DIR/ufcs-partially-resolved.rs:21:19 | LL | let _: ::N; - | ^ not found in `A` + | ^ type aliases cannot be used as traits + | +help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias + | +LL | trait A = u32; + | error[E0576]: cannot find method or associated constant `N` in trait `Tr` --> $DIR/ufcs-partially-resolved.rs:22:17 @@ -40,29 +36,43 @@ LL | fn Y() {} LL | ::N; | ^ help: an associated function with a similar name exists: `Y` -error[E0576]: cannot find method or associated constant `N` in enum `E` - --> $DIR/ufcs-partially-resolved.rs:23:16 +error[E0404]: expected trait, found enum `E` + --> $DIR/ufcs-partially-resolved.rs:23:12 | LL | ::N; - | ^ not found in `E` + | ^ help: a trait with a similar name exists: `Eq` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + | + = note: similarly named trait `Eq` defined here -error[E0576]: cannot find method or associated constant `N` in `A` - --> $DIR/ufcs-partially-resolved.rs:24:16 +error[E0404]: expected trait, found type alias `A` + --> $DIR/ufcs-partially-resolved.rs:24:12 | LL | ::N; - | ^ not found in `A` + | ^ type aliases cannot be used as traits + | +help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias + | +LL | trait A = u32; + | -error[E0575]: expected associated type, found variant `E::Y` - --> $DIR/ufcs-partially-resolved.rs:26:12 +error[E0404]: expected trait, found enum `E` + --> $DIR/ufcs-partially-resolved.rs:26:19 | LL | let _: ::Y; - | ^^^^^^^^^^^^ not a associated type + | ^ help: a trait with a similar name exists: `Eq` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + | + = note: similarly named trait `Eq` defined here -error[E0575]: expected method or associated constant, found unit variant `E::Y` - --> $DIR/ufcs-partially-resolved.rs:28:5 +error[E0404]: expected trait, found enum `E` + --> $DIR/ufcs-partially-resolved.rs:28:12 | LL | ::Y; - | ^^^^^^^^^^^^ not a method or associated constant + | ^ help: a trait with a similar name exists: `Eq` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + | + = note: similarly named trait `Eq` defined here error[E0576]: cannot find associated type `N` in trait `Tr` --> $DIR/ufcs-partially-resolved.rs:30:24 @@ -73,17 +83,25 @@ LL | type Y = u16; LL | let _: ::N::NN; | ^ help: an associated type with a similar name exists: `Y` -error[E0576]: cannot find associated type `N` in enum `E` - --> $DIR/ufcs-partially-resolved.rs:31:23 +error[E0404]: expected trait, found enum `E` + --> $DIR/ufcs-partially-resolved.rs:31:19 | LL | let _: ::N::NN; - | ^ not found in `E` + | ^ help: a trait with a similar name exists: `Eq` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + | + = note: similarly named trait `Eq` defined here -error[E0576]: cannot find associated type `N` in `A` - --> $DIR/ufcs-partially-resolved.rs:32:23 +error[E0404]: expected trait, found type alias `A` + --> $DIR/ufcs-partially-resolved.rs:32:19 | LL | let _: ::N::NN; - | ^ not found in `A` + | ^ type aliases cannot be used as traits + | +help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias + | +LL | trait A = u32; + | error[E0576]: cannot find associated type `N` in trait `Tr` --> $DIR/ufcs-partially-resolved.rs:33:17 @@ -94,77 +112,103 @@ LL | type Y = u16; LL | ::N::NN; | ^ help: an associated type with a similar name exists: `Y` -error[E0576]: cannot find associated type `N` in enum `E` - --> $DIR/ufcs-partially-resolved.rs:34:16 +error[E0404]: expected trait, found enum `E` + --> $DIR/ufcs-partially-resolved.rs:34:12 | LL | ::N::NN; - | ^ not found in `E` + | ^ help: a trait with a similar name exists: `Eq` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + | + = note: similarly named trait `Eq` defined here -error[E0576]: cannot find associated type `N` in `A` - --> $DIR/ufcs-partially-resolved.rs:35:16 +error[E0404]: expected trait, found type alias `A` + --> $DIR/ufcs-partially-resolved.rs:35:12 | LL | ::N::NN; - | ^ not found in `A` + | ^ type aliases cannot be used as traits + | +help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias + | +LL | trait A = u32; + | -error[E0575]: expected associated type, found variant `E::Y` - --> $DIR/ufcs-partially-resolved.rs:37:12 +error[E0404]: expected trait, found enum `E` + --> $DIR/ufcs-partially-resolved.rs:37:19 | LL | let _: ::Y::NN; - | ^^^^^^^^^^^^^^^^ not a associated type + | ^ help: a trait with a similar name exists: `Eq` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + | + = note: similarly named trait `Eq` defined here -error[E0575]: expected associated type, found variant `E::Y` - --> $DIR/ufcs-partially-resolved.rs:39:5 +error[E0404]: expected trait, found enum `E` + --> $DIR/ufcs-partially-resolved.rs:39:12 | LL | ::Y::NN; - | ^^^^^^^^^^^^^^^^ not a associated type + | ^ help: a trait with a similar name exists: `Eq` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + | + = note: similarly named trait `Eq` defined here -error[E0576]: cannot find associated type `NN` in `Tr::N` - --> $DIR/ufcs-partially-resolved.rs:41:27 +error[E0405]: cannot find trait `N` in trait `Tr` + --> $DIR/ufcs-partially-resolved.rs:41:23 | LL | let _: ::NN; - | ^^ not found in `Tr::N` + | ^ not found in `Tr` -error[E0576]: cannot find associated type `NN` in `E::N` - --> $DIR/ufcs-partially-resolved.rs:42:26 +error[E0405]: cannot find trait `N` in enum `E` + --> $DIR/ufcs-partially-resolved.rs:42:22 | LL | let _: ::NN; - | ^^ not found in `E::N` + | ^ not found in `E` -error[E0576]: cannot find associated type `NN` in `A::N` - --> $DIR/ufcs-partially-resolved.rs:43:26 +error[E0405]: cannot find trait `N` in `A` + --> $DIR/ufcs-partially-resolved.rs:43:22 | LL | let _: ::NN; - | ^^ not found in `A::N` + | ^ not found in `A` -error[E0576]: cannot find method or associated constant `NN` in `Tr::N` - --> $DIR/ufcs-partially-resolved.rs:44:20 +error[E0405]: cannot find trait `N` in trait `Tr` + --> $DIR/ufcs-partially-resolved.rs:44:16 | LL | ::NN; - | ^^ not found in `Tr::N` + | ^ not found in `Tr` -error[E0576]: cannot find method or associated constant `NN` in `E::N` - --> $DIR/ufcs-partially-resolved.rs:45:19 +error[E0405]: cannot find trait `N` in enum `E` + --> $DIR/ufcs-partially-resolved.rs:45:15 | LL | ::NN; - | ^^ not found in `E::N` + | ^ not found in `E` -error[E0576]: cannot find method or associated constant `NN` in `A::N` - --> $DIR/ufcs-partially-resolved.rs:46:19 +error[E0405]: cannot find trait `N` in `A` + --> $DIR/ufcs-partially-resolved.rs:46:15 | LL | ::NN; - | ^^ not found in `A::N` + | ^ not found in `A` -error[E0576]: cannot find associated type `NN` in `Tr::Y` - --> $DIR/ufcs-partially-resolved.rs:47:27 +error[E0404]: expected trait, found associated type `Tr::Y` + --> $DIR/ufcs-partially-resolved.rs:47:19 | LL | let _: ::NN; - | ^^ not found in `Tr::Y` + | ^^^^^ not a trait + +error[E0404]: expected trait, found variant `E::Y` + --> $DIR/ufcs-partially-resolved.rs:48:19 + | +LL | let _: ::NN; + | ^^^^ not a trait -error[E0576]: cannot find method or associated constant `NN` in `Tr::Y` - --> $DIR/ufcs-partially-resolved.rs:49:20 +error[E0404]: expected trait, found associated type `Tr::Y` + --> $DIR/ufcs-partially-resolved.rs:49:12 | LL | ::NN; - | ^^ not found in `Tr::Y` + | ^^^^^ not a trait + +error[E0404]: expected trait, found variant `E::Y` + --> $DIR/ufcs-partially-resolved.rs:50:12 + | +LL | ::NN; + | ^^^^ not a trait error[E0575]: expected associated type, found associated function `Dr::Z` --> $DIR/ufcs-partially-resolved.rs:52:12 @@ -226,5 +270,5 @@ LL | ::X::N; error: aborting due to 32 previous errors -Some errors have detailed explanations: E0223, E0433, E0575, E0576, E0599. +Some errors have detailed explanations: E0223, E0404, E0405, E0575, E0576, E0599. For more information about an error, try `rustc --explain E0223`. diff --git a/tests/ui/ufcs/ufcs-polymorphic-paths.rs b/tests/ui/ufcs/ufcs-polymorphic-paths.rs new file mode 100644 index 000000000..a14ebd6a4 --- /dev/null +++ b/tests/ui/ufcs/ufcs-polymorphic-paths.rs @@ -0,0 +1,154 @@ +// run-pass + +use std::borrow::{Cow, ToOwned}; +use std::default::Default; +use std::iter::FromIterator; +use std::ops::Add; +use std::option::IntoIter as OptionIter; + +pub struct XorShiftRng; +use XorShiftRng as DummyRng; +impl Rng for XorShiftRng {} +pub trait Rng {} +pub trait Rand: Default + Sized { + fn rand(_rng: &mut R) -> Self { Default::default() } +} +impl Rand for i32 { } + +pub trait IntoCow<'a, B: ?Sized> where B: ToOwned { + fn into_cow(self) -> Cow<'a, B>; +} + +impl<'a> IntoCow<'a, str> for String { + fn into_cow(self) -> Cow<'a, str> { + Cow::Owned(self) + } +} + +#[derive(PartialEq, Eq)] +struct Newt(T); + +fn id(x: T) -> T { x } +fn eq(a: T, b: T) -> bool { a == b } +fn u8_as_i8(x: u8) -> i8 { x as i8 } +fn odd(x: usize) -> bool { x % 2 == 1 } +fn dummy_rng() -> DummyRng { XorShiftRng } + +trait Size: Sized { + fn size() -> usize { std::mem::size_of::() } +} +impl Size for T {} + +#[derive(PartialEq, Eq)] +struct BitVec; + +impl BitVec { + fn from_fn(_: usize, _: F) -> BitVec where F: FnMut(usize) -> bool { + BitVec + } +} + +#[derive(PartialEq, Eq)] +struct Foo(T); + +impl Foo { + fn map_in_place(self, mut f: F) -> Foo where F: FnMut(T) -> U { + Foo(f(self.0)) + } + +} + +macro_rules! tests { + ($($expr:expr, $ty:ty, ($($test:expr),*);)+) => (pub fn main() {$({ + const C: $ty = $expr; + static S: $ty = $expr; + assert!(eq(C($($test),*), $expr($($test),*))); + assert!(eq(S($($test),*), $expr($($test),*))); + assert!(eq(C($($test),*), S($($test),*))); + })+}) +} + +tests! { + // Free function. + id, fn(i32) -> i32, (5); + id::, fn(i32) -> i32, (5); + + // Enum variant constructor. + Some, fn(i32) -> Option, (5); + Some::, fn(i32) -> Option, (5); + + // Tuple struct constructor. + Newt, fn(i32) -> Newt, (5); + Newt::, fn(i32) -> Newt, (5); + + // Inherent static methods. + Vec::new, fn() -> Vec<()>, (); + Vec::<()>::new, fn() -> Vec<()>, (); + >::new, fn() -> Vec<()>, (); + Vec::with_capacity, fn(usize) -> Vec<()>, (5); + Vec::<()>::with_capacity, fn(usize) -> Vec<()>, (5); + >::with_capacity, fn(usize) -> Vec<()>, (5); + BitVec::from_fn, fn(usize, fn(usize) -> bool) -> BitVec, (5, odd); + BitVec::from_fn:: bool>, fn(usize, fn(usize) -> bool) -> BitVec, (5, odd); + + // Inherent non-static method. + Foo::map_in_place, fn(Foo, fn(u8) -> i8) -> Foo, (Foo(b'f'), u8_as_i8); + Foo::map_in_place:: i8>, fn(Foo, fn(u8) -> i8) -> Foo, + (Foo(b'f'), u8_as_i8); + Foo::::map_in_place, fn(Foo, fn(u8) -> i8) -> Foo + , (Foo(b'f'), u8_as_i8); + Foo::::map_in_place:: i8>, fn(Foo, fn(u8) -> i8) -> Foo + , (Foo(b'f'), u8_as_i8); + + // Trait static methods. + bool::size, fn() -> usize, (); + ::size, fn() -> usize, (); + ::size, fn() -> usize, (); + + Default::default, fn() -> i32, (); + i32::default, fn() -> i32, (); + ::default, fn() -> i32, (); + ::default, fn() -> i32, (); + + Rand::rand, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); + i32::rand, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); + ::rand, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); + ::rand, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); + Rand::rand::, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); + i32::rand::, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); + ::rand::, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); + ::rand::, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); + + // Trait non-static methods. + Clone::clone, fn(&i32) -> i32, (&5); + i32::clone, fn(&i32) -> i32, (&5); + ::clone, fn(&i32) -> i32, (&5); + ::clone, fn(&i32) -> i32, (&5); + + FromIterator::from_iter, fn(OptionIter) -> Vec, (Some(5).into_iter()); + Vec::from_iter, fn(OptionIter) -> Vec, (Some(5).into_iter()); + >::from_iter, fn(OptionIter) -> Vec, (Some(5).into_iter()); + as FromIterator<_>>::from_iter, fn(OptionIter) -> Vec, + (Some(5).into_iter()); + as FromIterator<_>>::from_iter, fn(OptionIter) -> Vec, + (Some(5).into_iter()); + FromIterator::from_iter::>, fn(OptionIter) -> Vec, + (Some(5).into_iter()); + as FromIterator<_>>::from_iter::>, fn(OptionIter) -> Vec, + (Some(5).into_iter()); + + Add::add, fn(i32, i32) -> i32, (5, 6); + i32::add, fn(i32, i32) -> i32, (5, 6); + ::add, fn(i32, i32) -> i32, (5, 6); + >::add, fn(i32, i32) -> i32, (5, 6); + >::add, fn(i32, i32) -> i32, (5, 6); + + String::into_cow, fn(String) -> Cow<'static, str>, + ("foo".to_string()); + ::into_cow, fn(String) -> Cow<'static, str>, + ("foo".to_string()); + >::into_cow, fn(String) -> Cow<'static, str>, + ("foo".to_string()); + >::into_cow, fn(String) -> Cow<'static, str>, + ("foo".to_string()); +} diff --git a/tests/ui/underscore-imports/shadow.stderr b/tests/ui/underscore-imports/shadow.stderr index 7faede4e6..f2c19405b 100644 --- a/tests/ui/underscore-imports/shadow.stderr +++ b/tests/ui/underscore-imports/shadow.stderr @@ -7,7 +7,7 @@ LL | x.deref(); = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | -LL | use std::ops::Deref; +LL + use std::ops::Deref; | error: aborting due to previous error diff --git a/tests/ui/union/field_checks.rs b/tests/ui/union/field_checks.rs index d5d1e44ac..bb4eccb4c 100644 --- a/tests/ui/union/field_checks.rs +++ b/tests/ui/union/field_checks.rs @@ -21,15 +21,15 @@ union U24 { // OK } union U3 { - a: String, //~ ERROR unions cannot contain fields that may need dropping + a: String, //~ ERROR field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union } union U32 { // field that does not drop but is not `Copy`, either - a: std::cell::RefCell, //~ ERROR unions cannot contain fields that may need dropping + a: std::cell::RefCell, //~ ERROR field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union } union U4 { - a: T, //~ ERROR unions cannot contain fields that may need dropping + a: T, //~ ERROR field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union } union U5 { // Having a drop impl is OK @@ -41,11 +41,11 @@ impl Drop for U5 { } union U5Nested { // a nested union that drops is NOT OK - nest: U5, //~ ERROR unions cannot contain fields that may need dropping + nest: U5, //~ ERROR field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union } union U5Nested2 { // for now we don't special-case empty arrays - nest: [U5; 0], //~ ERROR unions cannot contain fields that may need dropping + nest: [U5; 0], //~ ERROR field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union } union U6 { // OK diff --git a/tests/ui/union/field_checks.stderr b/tests/ui/union/field_checks.stderr index 1f97e97ac..32407a749 100644 --- a/tests/ui/union/field_checks.stderr +++ b/tests/ui/union/field_checks.stderr @@ -1,59 +1,59 @@ -error[E0740]: unions cannot contain fields that may need dropping +error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union --> $DIR/field_checks.rs:24:5 | LL | a: String, | ^^^^^^^^^ | - = note: a type is guaranteed not to need dropping when it implements `Copy`, or when it is the special `ManuallyDrop<_>` type -help: when the type does not implement `Copy`, wrap it inside a `ManuallyDrop<_>` and ensure it is manually dropped + = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` +help: wrap the field type in `ManuallyDrop<...>` | LL | a: std::mem::ManuallyDrop, | +++++++++++++++++++++++ + -error[E0740]: unions cannot contain fields that may need dropping +error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union --> $DIR/field_checks.rs:28:5 | LL | a: std::cell::RefCell, | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: a type is guaranteed not to need dropping when it implements `Copy`, or when it is the special `ManuallyDrop<_>` type -help: when the type does not implement `Copy`, wrap it inside a `ManuallyDrop<_>` and ensure it is manually dropped + = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` +help: wrap the field type in `ManuallyDrop<...>` | LL | a: std::mem::ManuallyDrop>, | +++++++++++++++++++++++ + -error[E0740]: unions cannot contain fields that may need dropping +error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union --> $DIR/field_checks.rs:32:5 | LL | a: T, | ^^^^ | - = note: a type is guaranteed not to need dropping when it implements `Copy`, or when it is the special `ManuallyDrop<_>` type -help: when the type does not implement `Copy`, wrap it inside a `ManuallyDrop<_>` and ensure it is manually dropped + = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` +help: wrap the field type in `ManuallyDrop<...>` | LL | a: std::mem::ManuallyDrop, | +++++++++++++++++++++++ + -error[E0740]: unions cannot contain fields that may need dropping +error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union --> $DIR/field_checks.rs:44:5 | LL | nest: U5, | ^^^^^^^^ | - = note: a type is guaranteed not to need dropping when it implements `Copy`, or when it is the special `ManuallyDrop<_>` type -help: when the type does not implement `Copy`, wrap it inside a `ManuallyDrop<_>` and ensure it is manually dropped + = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` +help: wrap the field type in `ManuallyDrop<...>` | LL | nest: std::mem::ManuallyDrop, | +++++++++++++++++++++++ + -error[E0740]: unions cannot contain fields that may need dropping +error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union --> $DIR/field_checks.rs:48:5 | LL | nest: [U5; 0], | ^^^^^^^^^^^^^ | - = note: a type is guaranteed not to need dropping when it implements `Copy`, or when it is the special `ManuallyDrop<_>` type -help: when the type does not implement `Copy`, wrap it inside a `ManuallyDrop<_>` and ensure it is manually dropped + = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` +help: wrap the field type in `ManuallyDrop<...>` | LL | nest: std::mem::ManuallyDrop<[U5; 0]>, | +++++++++++++++++++++++ + diff --git a/tests/ui/union/issue-41073.rs b/tests/ui/union/issue-41073.rs index 4dfdc606b..f7a82b4e7 100644 --- a/tests/ui/union/issue-41073.rs +++ b/tests/ui/union/issue-41073.rs @@ -1,5 +1,5 @@ union Test { - a: A, //~ ERROR unions cannot contain fields that may need dropping + a: A, //~ ERROR field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union b: B } diff --git a/tests/ui/union/issue-41073.stderr b/tests/ui/union/issue-41073.stderr index b3887fa0f..ae1c4dfed 100644 --- a/tests/ui/union/issue-41073.stderr +++ b/tests/ui/union/issue-41073.stderr @@ -1,11 +1,11 @@ -error[E0740]: unions cannot contain fields that may need dropping +error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union --> $DIR/issue-41073.rs:2:5 | LL | a: A, | ^^^^ | - = note: a type is guaranteed not to need dropping when it implements `Copy`, or when it is the special `ManuallyDrop<_>` type -help: when the type does not implement `Copy`, wrap it inside a `ManuallyDrop<_>` and ensure it is manually dropped + = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` +help: wrap the field type in `ManuallyDrop<...>` | LL | a: std::mem::ManuallyDrop, | +++++++++++++++++++++++ + diff --git a/tests/ui/union/union-copy.rs b/tests/ui/union/union-copy.rs index 5c3f8d908..7ad0a11c6 100644 --- a/tests/ui/union/union-copy.rs +++ b/tests/ui/union/union-copy.rs @@ -9,6 +9,6 @@ union W { } impl Copy for U {} // OK -impl Copy for W {} //~ ERROR the trait `Copy` may not be implemented for this type +impl Copy for W {} //~ ERROR the trait `Copy` cannot be implemented for this type fn main() {} diff --git a/tests/ui/union/union-copy.stderr b/tests/ui/union/union-copy.stderr index 53ee4dd2e..ff6fa48db 100644 --- a/tests/ui/union/union-copy.stderr +++ b/tests/ui/union/union-copy.stderr @@ -1,4 +1,4 @@ -error[E0204]: the trait `Copy` may not be implemented for this type +error[E0204]: the trait `Copy` cannot be implemented for this type --> $DIR/union-copy.rs:12:15 | LL | a: std::mem::ManuallyDrop diff --git a/tests/ui/union/union-derive-clone.mirunsafeck.stderr b/tests/ui/union/union-derive-clone.mirunsafeck.stderr index b80e8b988..4d23d230f 100644 --- a/tests/ui/union/union-derive-clone.mirunsafeck.stderr +++ b/tests/ui/union/union-derive-clone.mirunsafeck.stderr @@ -9,7 +9,8 @@ note: required by a bound in `AssertParamIsCopy` = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `U1` with `#[derive(Copy)]` | -LL | #[derive(Copy)] +LL + #[derive(Copy)] +LL | union U1 { | error[E0599]: the method `clone` exists for union `U5`, but its trait bounds were not satisfied @@ -34,7 +35,8 @@ LL | #[derive(Clone, Copy)] | ^^^^^ unsatisfied trait bound introduced in this `derive` macro help: consider annotating `CloneNoCopy` with `#[derive(Clone, Copy)]` | -LL | #[derive(Clone, Copy)] +LL + #[derive(Clone, Copy)] +LL | struct CloneNoCopy; | error: aborting due to 2 previous errors diff --git a/tests/ui/union/union-derive-clone.thirunsafeck.stderr b/tests/ui/union/union-derive-clone.thirunsafeck.stderr index b80e8b988..4d23d230f 100644 --- a/tests/ui/union/union-derive-clone.thirunsafeck.stderr +++ b/tests/ui/union/union-derive-clone.thirunsafeck.stderr @@ -9,7 +9,8 @@ note: required by a bound in `AssertParamIsCopy` = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `U1` with `#[derive(Copy)]` | -LL | #[derive(Copy)] +LL + #[derive(Copy)] +LL | union U1 { | error[E0599]: the method `clone` exists for union `U5`, but its trait bounds were not satisfied @@ -34,7 +35,8 @@ LL | #[derive(Clone, Copy)] | ^^^^^ unsatisfied trait bound introduced in this `derive` macro help: consider annotating `CloneNoCopy` with `#[derive(Clone, Copy)]` | -LL | #[derive(Clone, Copy)] +LL + #[derive(Clone, Copy)] +LL | struct CloneNoCopy; | error: aborting due to 2 previous errors diff --git a/tests/ui/union/union-derive-eq.mirunsafeck.stderr b/tests/ui/union/union-derive-eq.mirunsafeck.stderr index 9e55390b5..136cd883e 100644 --- a/tests/ui/union/union-derive-eq.mirunsafeck.stderr +++ b/tests/ui/union/union-derive-eq.mirunsafeck.stderr @@ -12,7 +12,8 @@ note: required by a bound in `AssertParamIsEq` = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `PartialEqNotEq` with `#[derive(Eq)]` | -LL | #[derive(Eq)] +LL + #[derive(Eq)] +LL | struct PartialEqNotEq; | error: aborting due to previous error diff --git a/tests/ui/union/union-derive-eq.thirunsafeck.stderr b/tests/ui/union/union-derive-eq.thirunsafeck.stderr index 9e55390b5..136cd883e 100644 --- a/tests/ui/union/union-derive-eq.thirunsafeck.stderr +++ b/tests/ui/union/union-derive-eq.thirunsafeck.stderr @@ -12,7 +12,8 @@ note: required by a bound in `AssertParamIsEq` = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `PartialEqNotEq` with `#[derive(Eq)]` | -LL | #[derive(Eq)] +LL + #[derive(Eq)] +LL | struct PartialEqNotEq; | error: aborting due to previous error diff --git a/tests/ui/union/union-with-drop-fields.mirunsafeck.stderr b/tests/ui/union/union-with-drop-fields.mirunsafeck.stderr index 93fe996d2..9861a21cb 100644 --- a/tests/ui/union/union-with-drop-fields.mirunsafeck.stderr +++ b/tests/ui/union/union-with-drop-fields.mirunsafeck.stderr @@ -1,35 +1,35 @@ -error[E0740]: unions cannot contain fields that may need dropping +error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union --> $DIR/union-with-drop-fields.rs:11:5 | LL | a: String, | ^^^^^^^^^ | - = note: a type is guaranteed not to need dropping when it implements `Copy`, or when it is the special `ManuallyDrop<_>` type -help: when the type does not implement `Copy`, wrap it inside a `ManuallyDrop<_>` and ensure it is manually dropped + = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` +help: wrap the field type in `ManuallyDrop<...>` | LL | a: std::mem::ManuallyDrop, | +++++++++++++++++++++++ + -error[E0740]: unions cannot contain fields that may need dropping +error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union --> $DIR/union-with-drop-fields.rs:19:5 | LL | a: S, | ^^^^ | - = note: a type is guaranteed not to need dropping when it implements `Copy`, or when it is the special `ManuallyDrop<_>` type -help: when the type does not implement `Copy`, wrap it inside a `ManuallyDrop<_>` and ensure it is manually dropped + = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` +help: wrap the field type in `ManuallyDrop<...>` | LL | a: std::mem::ManuallyDrop, | +++++++++++++++++++++++ + -error[E0740]: unions cannot contain fields that may need dropping +error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union --> $DIR/union-with-drop-fields.rs:24:5 | LL | a: T, | ^^^^ | - = note: a type is guaranteed not to need dropping when it implements `Copy`, or when it is the special `ManuallyDrop<_>` type -help: when the type does not implement `Copy`, wrap it inside a `ManuallyDrop<_>` and ensure it is manually dropped + = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` +help: wrap the field type in `ManuallyDrop<...>` | LL | a: std::mem::ManuallyDrop, | +++++++++++++++++++++++ + diff --git a/tests/ui/union/union-with-drop-fields.rs b/tests/ui/union/union-with-drop-fields.rs index a7a8b69e7..9720830fb 100644 --- a/tests/ui/union/union-with-drop-fields.rs +++ b/tests/ui/union/union-with-drop-fields.rs @@ -8,7 +8,7 @@ union U { } union W { - a: String, //~ ERROR unions cannot contain fields that may need dropping + a: String, //~ ERROR field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union b: String, // OK, only one field is reported } @@ -16,12 +16,12 @@ struct S(String); // `S` doesn't implement `Drop` trait, but still has non-trivial destructor union Y { - a: S, //~ ERROR unions cannot contain fields that may need dropping + a: S, //~ ERROR field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union } // We don't know if `T` is trivially-destructable or not until trans union J { - a: T, //~ ERROR unions cannot contain fields that may need dropping + a: T, //~ ERROR field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union } union H { diff --git a/tests/ui/union/union-with-drop-fields.thirunsafeck.stderr b/tests/ui/union/union-with-drop-fields.thirunsafeck.stderr index 93fe996d2..9861a21cb 100644 --- a/tests/ui/union/union-with-drop-fields.thirunsafeck.stderr +++ b/tests/ui/union/union-with-drop-fields.thirunsafeck.stderr @@ -1,35 +1,35 @@ -error[E0740]: unions cannot contain fields that may need dropping +error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union --> $DIR/union-with-drop-fields.rs:11:5 | LL | a: String, | ^^^^^^^^^ | - = note: a type is guaranteed not to need dropping when it implements `Copy`, or when it is the special `ManuallyDrop<_>` type -help: when the type does not implement `Copy`, wrap it inside a `ManuallyDrop<_>` and ensure it is manually dropped + = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` +help: wrap the field type in `ManuallyDrop<...>` | LL | a: std::mem::ManuallyDrop, | +++++++++++++++++++++++ + -error[E0740]: unions cannot contain fields that may need dropping +error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union --> $DIR/union-with-drop-fields.rs:19:5 | LL | a: S, | ^^^^ | - = note: a type is guaranteed not to need dropping when it implements `Copy`, or when it is the special `ManuallyDrop<_>` type -help: when the type does not implement `Copy`, wrap it inside a `ManuallyDrop<_>` and ensure it is manually dropped + = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` +help: wrap the field type in `ManuallyDrop<...>` | LL | a: std::mem::ManuallyDrop, | +++++++++++++++++++++++ + -error[E0740]: unions cannot contain fields that may need dropping +error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union --> $DIR/union-with-drop-fields.rs:24:5 | LL | a: T, | ^^^^ | - = note: a type is guaranteed not to need dropping when it implements `Copy`, or when it is the special `ManuallyDrop<_>` type -help: when the type does not implement `Copy`, wrap it inside a `ManuallyDrop<_>` and ensure it is manually dropped + = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` +help: wrap the field type in `ManuallyDrop<...>` | LL | a: std::mem::ManuallyDrop, | +++++++++++++++++++++++ + diff --git a/tests/ui/union/unresolved-field-isnt-copy.rs b/tests/ui/union/unresolved-field-isnt-copy.rs new file mode 100644 index 000000000..7a6d79b2f --- /dev/null +++ b/tests/ui/union/unresolved-field-isnt-copy.rs @@ -0,0 +1,8 @@ +// Unresolved fields are not copy, but also shouldn't report an extra E0740. + +pub union Foo { + x: *const Missing, + //~^ ERROR cannot find type `Missing` in this scope +} + +fn main() {} diff --git a/tests/ui/union/unresolved-field-isnt-copy.stderr b/tests/ui/union/unresolved-field-isnt-copy.stderr new file mode 100644 index 000000000..22301582e --- /dev/null +++ b/tests/ui/union/unresolved-field-isnt-copy.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `Missing` in this scope + --> $DIR/unresolved-field-isnt-copy.rs:4:15 + | +LL | x: *const Missing, + | ^^^^^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/unique-object-noncopyable.rs b/tests/ui/unique-object-noncopyable.rs deleted file mode 100644 index 2c40dfc7a..000000000 --- a/tests/ui/unique-object-noncopyable.rs +++ /dev/null @@ -1,25 +0,0 @@ -trait Foo { - fn f(&self); -} - -struct Bar { - x: isize, -} - -impl Drop for Bar { - fn drop(&mut self) {} -} - -impl Foo for Bar { - fn f(&self) { - println!("hi"); - } -} - - - -fn main() { - let x = Box::new(Bar { x: 10 }); - let y: Box = x as Box; - let _z = y.clone(); //~ ERROR the method -} diff --git a/tests/ui/unique-object-noncopyable.stderr b/tests/ui/unique-object-noncopyable.stderr deleted file mode 100644 index db42ed9ba..000000000 --- a/tests/ui/unique-object-noncopyable.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0599]: the method `clone` exists for struct `Box`, but its trait bounds were not satisfied - --> $DIR/unique-object-noncopyable.rs:24:16 - | -LL | trait Foo { - | --------- - | | - | doesn't satisfy `dyn Foo: Clone` - | doesn't satisfy `dyn Foo: Sized` -... -LL | let _z = y.clone(); - | ^^^^^ method cannot be called on `Box` due to unsatisfied trait bounds - --> $SRC_DIR/alloc/src/boxed.rs:LL:COL - ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL - | - = note: doesn't satisfy `Box: Clone` - | - = note: the following trait bounds were not satisfied: - `dyn Foo: Sized` - which is required by `Box: Clone` - `dyn Foo: Clone` - which is required by `Box: Clone` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/unique-pinned-nocopy.rs b/tests/ui/unique-pinned-nocopy.rs deleted file mode 100644 index 8edaeef51..000000000 --- a/tests/ui/unique-pinned-nocopy.rs +++ /dev/null @@ -1,14 +0,0 @@ -#[derive(Debug)] -struct R { - b: bool, -} - -impl Drop for R { - fn drop(&mut self) {} -} - -fn main() { - let i = Box::new(R { b: true }); - let _j = i.clone(); //~ ERROR the method - println!("{:?}", i); -} diff --git a/tests/ui/unique-pinned-nocopy.stderr b/tests/ui/unique-pinned-nocopy.stderr deleted file mode 100644 index de6611324..000000000 --- a/tests/ui/unique-pinned-nocopy.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0599]: the method `clone` exists for struct `Box`, but its trait bounds were not satisfied - --> $DIR/unique-pinned-nocopy.rs:12:16 - | -LL | struct R { - | -------- doesn't satisfy `R: Clone` -... -LL | let _j = i.clone(); - | ^^^^^ method cannot be called on `Box` due to unsatisfied trait bounds - --> $SRC_DIR/alloc/src/boxed.rs:LL:COL - ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL - | - = note: doesn't satisfy `Box: Clone` - | - = note: the following trait bounds were not satisfied: - `R: Clone` - which is required by `Box: Clone` - = help: items from traits can only be used if the trait is implemented and in scope - = note: the following trait defines an item `clone`, perhaps you need to implement it: - candidate #1: `Clone` -help: consider annotating `R` with `#[derive(Clone)]` - | -LL | #[derive(Clone)] - | - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/unique/unique-assign-copy.rs b/tests/ui/unique/unique-assign-copy.rs deleted file mode 100644 index b742973ce..000000000 --- a/tests/ui/unique/unique-assign-copy.rs +++ /dev/null @@ -1,12 +0,0 @@ -// run-pass - -pub fn main() { - let mut i: Box<_> = Box::new(1); - // Should be a copy - let mut j; - j = i.clone(); - *i = 2; - *j = 3; - assert_eq!(*i, 2); - assert_eq!(*j, 3); -} diff --git a/tests/ui/unique/unique-assign-drop.rs b/tests/ui/unique/unique-assign-drop.rs deleted file mode 100644 index e7685b589..000000000 --- a/tests/ui/unique/unique-assign-drop.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass -#![allow(unused_assignments)] - -pub fn main() { - let i: Box<_> = Box::new(1); - let mut j: Box<_> = Box::new(2); - // Should drop the previous value of j - j = i; - assert_eq!(*j, 1); -} diff --git a/tests/ui/unique/unique-assign-generic.rs b/tests/ui/unique/unique-assign-generic.rs deleted file mode 100644 index d4932d833..000000000 --- a/tests/ui/unique/unique-assign-generic.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass - -fn f(t: T) -> T { - let t1 = t; - t1 -} - -pub fn main() { - let t = f::>(Box::new(100)); - assert_eq!(t, Box::new(100)); -} diff --git a/tests/ui/unique/unique-assign.rs b/tests/ui/unique/unique-assign.rs deleted file mode 100644 index d598744f1..000000000 --- a/tests/ui/unique/unique-assign.rs +++ /dev/null @@ -1,8 +0,0 @@ -// run-pass -#![allow(unused_mut)] - -pub fn main() { - let mut i: Box<_>; - i = Box::new(1); - assert_eq!(*i, 1); -} diff --git a/tests/ui/unique/unique-autoderef-field.rs b/tests/ui/unique/unique-autoderef-field.rs deleted file mode 100644 index 64147e11f..000000000 --- a/tests/ui/unique/unique-autoderef-field.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass - -struct J { j: isize } - -pub fn main() { - let i: Box<_> = Box::new(J { - j: 100 - }); - assert_eq!(i.j, 100); -} diff --git a/tests/ui/unique/unique-autoderef-index.rs b/tests/ui/unique/unique-autoderef-index.rs deleted file mode 100644 index ea6598a7f..000000000 --- a/tests/ui/unique/unique-autoderef-index.rs +++ /dev/null @@ -1,6 +0,0 @@ -// run-pass - -pub fn main() { - let i: Box<_> = Box::new(vec![100]); - assert_eq!((*i)[0], 100); -} diff --git a/tests/ui/unique/unique-cmp.rs b/tests/ui/unique/unique-cmp.rs deleted file mode 100644 index ee05dd5a3..000000000 --- a/tests/ui/unique/unique-cmp.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass -#![allow(unused_allocation)] - -pub fn main() { - let i: Box<_> = Box::new(100); - assert_eq!(i, Box::new(100)); - assert!(i < Box::new(101)); - assert!(i <= Box::new(100)); - assert!(i > Box::new(99)); - assert!(i >= Box::new(99)); -} diff --git a/tests/ui/unique/unique-containing-tag.rs b/tests/ui/unique/unique-containing-tag.rs deleted file mode 100644 index 6c31ae99b..000000000 --- a/tests/ui/unique/unique-containing-tag.rs +++ /dev/null @@ -1,25 +0,0 @@ -// run-pass -#![allow(dead_code)] -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -pub fn main() { - enum t { t1(isize), t2(isize), } - - let _x: Box<_> = Box::new(t::t1(10)); - - /*alt *x { - t1(a) { - assert_eq!(a, 10); - } - _ { panic!(); } - }*/ - - /*alt x { - Box::new(t1(a) { - assert_eq!(a, 10); - }) - _ { panic!(); } - }*/ -} diff --git a/tests/ui/unique/unique-create.rs b/tests/ui/unique/unique-create.rs deleted file mode 100644 index c566e7962..000000000 --- a/tests/ui/unique/unique-create.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass -#![allow(dead_code)] -// pretty-expanded FIXME #23616 - -pub fn main() { - let _: Box<_> = Box::new(100); -} - -fn vec() { - vec![0]; -} diff --git a/tests/ui/unique/unique-decl-init-copy.rs b/tests/ui/unique/unique-decl-init-copy.rs deleted file mode 100644 index 5b9576fcc..000000000 --- a/tests/ui/unique/unique-decl-init-copy.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass - -pub fn main() { - let mut i: Box<_> = Box::new(1); - // Should be a copy - let mut j = i.clone(); - *i = 2; - *j = 3; - assert_eq!(*i, 2); - assert_eq!(*j, 3); -} diff --git a/tests/ui/unique/unique-decl-init.rs b/tests/ui/unique/unique-decl-init.rs deleted file mode 100644 index 1d70860c7..000000000 --- a/tests/ui/unique/unique-decl-init.rs +++ /dev/null @@ -1,7 +0,0 @@ -// run-pass - -pub fn main() { - let i: Box<_> = Box::new(1); - let j = i; - assert_eq!(*j, 1); -} diff --git a/tests/ui/unique/unique-decl-move.rs b/tests/ui/unique/unique-decl-move.rs deleted file mode 100644 index 21187510f..000000000 --- a/tests/ui/unique/unique-decl-move.rs +++ /dev/null @@ -1,7 +0,0 @@ -// run-pass - -pub fn main() { - let i: Box<_> = Box::new(100); - let j = i; - assert_eq!(*j, 100); -} diff --git a/tests/ui/unique/unique-decl.rs b/tests/ui/unique/unique-decl.rs deleted file mode 100644 index 84a1b2a5b..000000000 --- a/tests/ui/unique/unique-decl.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass -#![allow(dead_code)] - - -pub fn main() { - let _: Box; -} - -fn f(_i: Box) -> Box { - panic!(); -} diff --git a/tests/ui/unique/unique-deref.rs b/tests/ui/unique/unique-deref.rs deleted file mode 100644 index 33a1e9932..000000000 --- a/tests/ui/unique/unique-deref.rs +++ /dev/null @@ -1,6 +0,0 @@ -// run-pass - -pub fn main() { - let i: Box<_> = Box::new(100); - assert_eq!(*i, 100); -} diff --git a/tests/ui/unique/unique-destructure.rs b/tests/ui/unique/unique-destructure.rs deleted file mode 100644 index 7207ac962..000000000 --- a/tests/ui/unique/unique-destructure.rs +++ /dev/null @@ -1,9 +0,0 @@ -// run-pass -#![feature(box_patterns)] - -struct Foo { a: isize, b: isize } - -pub fn main() { - let box Foo{ a, b } = Box::new(Foo { a: 100, b: 200 }); - assert_eq!(a + b, 300); -} diff --git a/tests/ui/unique/unique-drop-complex.rs b/tests/ui/unique/unique-drop-complex.rs deleted file mode 100644 index 2324f1e1a..000000000 --- a/tests/ui/unique/unique-drop-complex.rs +++ /dev/null @@ -1,6 +0,0 @@ -// run-pass -// pretty-expanded FIXME #23616 - -pub fn main() { - let _x: Box<_> = Box::new(vec![0,0,0,0,0]); -} diff --git a/tests/ui/unique/unique-ffi-symbols.rs b/tests/ui/unique/unique-ffi-symbols.rs deleted file mode 100644 index 77b5ead26..000000000 --- a/tests/ui/unique/unique-ffi-symbols.rs +++ /dev/null @@ -1,16 +0,0 @@ -// run-pass -// We used to have a __rust_abi shim that resulted in duplicated symbols -// whenever the item path wasn't enough to disambiguate between them. -fn main() { - let a = { - extern "C" fn good() -> i32 { return 0; } - good as extern "C" fn() -> i32 - }; - let b = { - extern "C" fn good() -> i32 { return 5; } - good as extern "C" fn() -> i32 - }; - - assert!(a != b); - assert_eq!((a(), b()), (0, 5)); -} diff --git a/tests/ui/unique/unique-fn-arg-move.rs b/tests/ui/unique/unique-fn-arg-move.rs deleted file mode 100644 index 6d42df218..000000000 --- a/tests/ui/unique/unique-fn-arg-move.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass - -fn f(i: Box) { - assert_eq!(*i, 100); -} - -pub fn main() { - let i = Box::new(100); - f(i); -} diff --git a/tests/ui/unique/unique-fn-arg-mut.rs b/tests/ui/unique/unique-fn-arg-mut.rs deleted file mode 100644 index 01510200b..000000000 --- a/tests/ui/unique/unique-fn-arg-mut.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass - -fn f(i: &mut Box) { - *i = Box::new(200); -} - -pub fn main() { - let mut i = Box::new(100); - f(&mut i); - assert_eq!(*i, 200); -} diff --git a/tests/ui/unique/unique-fn-arg.rs b/tests/ui/unique/unique-fn-arg.rs deleted file mode 100644 index b4f3bc4b2..000000000 --- a/tests/ui/unique/unique-fn-arg.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass - -fn f(i: Box) { - assert_eq!(*i, 100); -} - -pub fn main() { - f(Box::new(100)); - let i = Box::new(100); - f(i); -} diff --git a/tests/ui/unique/unique-fn-ret.rs b/tests/ui/unique/unique-fn-ret.rs deleted file mode 100644 index 773a9bce1..000000000 --- a/tests/ui/unique/unique-fn-ret.rs +++ /dev/null @@ -1,9 +0,0 @@ -// run-pass - -fn f() -> Box { - Box::new(100) -} - -pub fn main() { - assert_eq!(f(), Box::new(100)); -} diff --git a/tests/ui/unique/unique-generic-assign.rs b/tests/ui/unique/unique-generic-assign.rs deleted file mode 100644 index 9c4405aa8..000000000 --- a/tests/ui/unique/unique-generic-assign.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass -#![allow(dead_code)] -// Issue #976 - - -// pretty-expanded FIXME #23616 - -fn f(x: Box) { - let _x2 = x; -} -pub fn main() { } diff --git a/tests/ui/unique/unique-in-tag.rs b/tests/ui/unique/unique-in-tag.rs deleted file mode 100644 index 6daa06fb1..000000000 --- a/tests/ui/unique/unique-in-tag.rs +++ /dev/null @@ -1,20 +0,0 @@ -// run-pass -#![allow(dead_code)] -#![allow(non_camel_case_types)] - -fn test1() { - enum bar { u(Box), w(isize), } - - let x = bar::u(Box::new(10)); - assert!(match x { - bar::u(a) => { - println!("{}", a); - *a - } - _ => { 66 } - } == 10); -} - -pub fn main() { - test1(); -} diff --git a/tests/ui/unique/unique-in-vec-copy.rs b/tests/ui/unique/unique-in-vec-copy.rs deleted file mode 100644 index ce52d15ef..000000000 --- a/tests/ui/unique/unique-in-vec-copy.rs +++ /dev/null @@ -1,15 +0,0 @@ -// run-pass - -pub fn main() { - let mut a: Vec> = vec![Box::new(10)]; - let b = a.clone(); - - assert_eq!(*a[0], 10); - assert_eq!(*b[0], 10); - - // This should only modify the value in a, not b - *a[0] = 20; - - assert_eq!(*a[0], 20); - assert_eq!(*b[0], 10); -} diff --git a/tests/ui/unique/unique-in-vec.rs b/tests/ui/unique/unique-in-vec.rs deleted file mode 100644 index 1e8d05e3d..000000000 --- a/tests/ui/unique/unique-in-vec.rs +++ /dev/null @@ -1,6 +0,0 @@ -// run-pass - -pub fn main() { - let vect : Vec> = vec![Box::new(100)]; - assert_eq!(vect[0], Box::new(100)); -} diff --git a/tests/ui/unique/unique-init.rs b/tests/ui/unique/unique-init.rs deleted file mode 100644 index d19605046..000000000 --- a/tests/ui/unique/unique-init.rs +++ /dev/null @@ -1,6 +0,0 @@ -// run-pass -// pretty-expanded FIXME #23616 - -pub fn main() { - let _i: Box<_> = Box::new(100); -} diff --git a/tests/ui/unique/unique-kinds.rs b/tests/ui/unique/unique-kinds.rs deleted file mode 100644 index f02d0b507..000000000 --- a/tests/ui/unique/unique-kinds.rs +++ /dev/null @@ -1,64 +0,0 @@ -// run-pass - -use std::cmp::PartialEq; -use std::fmt::Debug; - -fn sendable() { - - fn f(i: T, j: T) { - assert_eq!(i, j); - } - - fn g(i: T, j: T) { - assert!(i != j); - } - - let i: Box<_> = Box::new(100); - let j: Box<_> = Box::new(100); - f(i, j); - let i: Box<_> = Box::new(100); - let j: Box<_> = Box::new(101); - g(i, j); -} - -fn copyable() { - - fn f(i: T, j: T) { - assert_eq!(i, j); - } - - fn g(i: T, j: T) { - assert!(i != j); - } - - let i: Box<_> = Box::new(100); - let j: Box<_> = Box::new(100); - f(i, j); - let i: Box<_> = Box::new(100); - let j: Box<_> = Box::new(101); - g(i, j); -} - -fn noncopyable() { - - fn f(i: T, j: T) { - assert_eq!(i, j); - } - - fn g(i: T, j: T) { - assert!(i != j); - } - - let i: Box<_> = Box::new(100); - let j: Box<_> = Box::new(100); - f(i, j); - let i: Box<_> = Box::new(100); - let j: Box<_> = Box::new(101); - g(i, j); -} - -pub fn main() { - sendable(); - copyable(); - noncopyable(); -} diff --git a/tests/ui/unique/unique-log.rs b/tests/ui/unique/unique-log.rs deleted file mode 100644 index 0715d1662..000000000 --- a/tests/ui/unique/unique-log.rs +++ /dev/null @@ -1,6 +0,0 @@ -// run-pass - -pub fn main() { - let i: Box<_> = Box::new(100); - println!("{}", i); -} diff --git a/tests/ui/unique/unique-match-discrim.rs b/tests/ui/unique/unique-match-discrim.rs deleted file mode 100644 index 6e6d74322..000000000 --- a/tests/ui/unique/unique-match-discrim.rs +++ /dev/null @@ -1,12 +0,0 @@ -// run-pass -#![allow(dead_code)] -// Issue #961 - -// pretty-expanded FIXME #23616 - -fn altsimple() { - match Box::new(true) { - _ => { } - } -} -pub fn main() { } diff --git a/tests/ui/unique/unique-move-drop.rs b/tests/ui/unique/unique-move-drop.rs deleted file mode 100644 index c0f5d8f90..000000000 --- a/tests/ui/unique/unique-move-drop.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass - -#![allow(unused_variables)] - -pub fn main() { - let i: Box<_> = Box::new(100); - let j: Box<_> = Box::new(200); - let j = i; - assert_eq!(*j, 100); -} diff --git a/tests/ui/unique/unique-move-temp.rs b/tests/ui/unique/unique-move-temp.rs deleted file mode 100644 index 103af8e1f..000000000 --- a/tests/ui/unique/unique-move-temp.rs +++ /dev/null @@ -1,8 +0,0 @@ -// run-pass -#![allow(unused_mut)] - -pub fn main() { - let mut i: Box<_>; - i = Box::new(100); - assert_eq!(*i, 100); -} diff --git a/tests/ui/unique/unique-move.rs b/tests/ui/unique/unique-move.rs deleted file mode 100644 index 40a2718e4..000000000 --- a/tests/ui/unique/unique-move.rs +++ /dev/null @@ -1,9 +0,0 @@ -// run-pass -#![allow(unused_mut)] - -pub fn main() { - let i: Box<_> = Box::new(100); - let mut j; - j = i; - assert_eq!(*j, 100); -} diff --git a/tests/ui/unique/unique-mutable.rs b/tests/ui/unique/unique-mutable.rs deleted file mode 100644 index 0367c0809..000000000 --- a/tests/ui/unique/unique-mutable.rs +++ /dev/null @@ -1,7 +0,0 @@ -// run-pass - -pub fn main() { - let mut i: Box<_> = Box::new(0); - *i = 1; - assert_eq!(*i, 1); -} diff --git a/tests/ui/unique/unique-object-move.rs b/tests/ui/unique/unique-object-move.rs deleted file mode 100644 index bb35a9b2d..000000000 --- a/tests/ui/unique/unique-object-move.rs +++ /dev/null @@ -1,18 +0,0 @@ -// run-pass -#![allow(dead_code)] -// Issue #5192 - -// pretty-expanded FIXME #23616 - -pub trait EventLoop { fn foo(&self) {} } - -pub struct UvEventLoop { - uvio: isize -} - -impl EventLoop for UvEventLoop { } - -pub fn main() { - let loop_: Box = Box::new(UvEventLoop { uvio: 0 }) as Box; - let _loop2_ = loop_; -} diff --git a/tests/ui/unique/unique-pat-2.rs b/tests/ui/unique/unique-pat-2.rs deleted file mode 100644 index 9c73fd220..000000000 --- a/tests/ui/unique/unique-pat-2.rs +++ /dev/null @@ -1,18 +0,0 @@ -// run-pass -#![allow(dead_code)] -#![allow(non_camel_case_types)] -#![allow(non_shorthand_field_patterns)] - -#![feature(box_patterns)] - -struct Foo {a: isize, b: usize} - -enum bar { u(Box), w(isize), } - -pub fn main() { - let v = match bar::u(Box::new(Foo{ a: 10, b: 40 })) { - bar::u(box Foo{ a: a, b: b }) => { a + (b as isize) } - _ => { 66 } - }; - assert_eq!(v, 50); -} diff --git a/tests/ui/unique/unique-pat-3.rs b/tests/ui/unique/unique-pat-3.rs deleted file mode 100644 index 2e81f898d..000000000 --- a/tests/ui/unique/unique-pat-3.rs +++ /dev/null @@ -1,16 +0,0 @@ -// run-pass -#![allow(dead_code)] -#![allow(non_camel_case_types)] - -enum bar { u(Box), w(isize), } - -pub fn main() { - let v = match bar::u(10.into()) { - bar::u(a) => { - println!("{}", a); - *a - } - _ => { 66 } - }; - assert_eq!(v, 10); -} diff --git a/tests/ui/unique/unique-pat.rs b/tests/ui/unique/unique-pat.rs deleted file mode 100644 index c2474d0e7..000000000 --- a/tests/ui/unique/unique-pat.rs +++ /dev/null @@ -1,14 +0,0 @@ -// run-pass - -#![feature(box_patterns)] - -fn simple() { - match Box::new(true) { - box true => { } - _ => { panic!(); } - } -} - -pub fn main() { - simple(); -} diff --git a/tests/ui/unique/unique-rec.rs b/tests/ui/unique/unique-rec.rs deleted file mode 100644 index 9f8ad9bb0..000000000 --- a/tests/ui/unique/unique-rec.rs +++ /dev/null @@ -1,9 +0,0 @@ -// run-pass - -struct X { x: isize } - -pub fn main() { - let x: Box<_> = Box::new(X {x: 1}); - let bar = x; - assert_eq!(bar.x, 1); -} diff --git a/tests/ui/unique/unique-send-2.rs b/tests/ui/unique/unique-send-2.rs deleted file mode 100644 index 23ddd2cdc..000000000 --- a/tests/ui/unique/unique-send-2.rs +++ /dev/null @@ -1,33 +0,0 @@ -// run-pass -#![allow(unused_must_use)] -// ignore-emscripten no threads support - -use std::sync::mpsc::{channel, Sender}; -use std::thread; - -fn child(tx: &Sender>, i: usize) { - tx.send(Box::new(i)).unwrap(); -} - -pub fn main() { - let (tx, rx) = channel(); - let n = 100; - let mut expected = 0; - let ts = (0..n).map(|i| { - expected += i; - let tx = tx.clone(); - thread::spawn(move|| { - child(&tx, i) - }) - }).collect::>(); - - let mut actual = 0; - for _ in 0..n { - let j = rx.recv().unwrap(); - actual += *j; - } - - assert_eq!(expected, actual); - - for t in ts { t.join(); } -} diff --git a/tests/ui/unique/unique-send.rs b/tests/ui/unique/unique-send.rs deleted file mode 100644 index 431cc2be5..000000000 --- a/tests/ui/unique/unique-send.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass - -use std::sync::mpsc::channel; - -pub fn main() { - let (tx, rx) = channel::>(); - tx.send(Box::new(100)).unwrap(); - let v = rx.recv().unwrap(); - assert_eq!(v, Box::new(100)); -} diff --git a/tests/ui/unique/unique-swap.rs b/tests/ui/unique/unique-swap.rs deleted file mode 100644 index 4f33ff9a8..000000000 --- a/tests/ui/unique/unique-swap.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass - -use std::mem::swap; - -pub fn main() { - let mut i: Box<_> = Box::new(100); - let mut j: Box<_> = Box::new(200); - swap(&mut i, &mut j); - assert_eq!(i, Box::new(200)); - assert_eq!(j, Box::new(100)); -} diff --git a/tests/ui/unpretty-expr-fn-arg.rs b/tests/ui/unpretty-expr-fn-arg.rs deleted file mode 100644 index 6e1132a33..000000000 --- a/tests/ui/unpretty-expr-fn-arg.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Regression test for the ICE described in #82328. The pretty-printer for -// `-Zunpretty=hir,typed` would previously retrieve type-checking results -// when entering a body, which means that type information was not available -// for expressions occurring in function signatures, as in the `foo` example -// below, leading to an ICE. - -// check-pass -// compile-flags: -Zunpretty=hir,typed -#![allow(dead_code)] - -fn main() {} - -fn foo(-128..=127: i8) {} diff --git a/tests/ui/unpretty-expr-fn-arg.stdout b/tests/ui/unpretty-expr-fn-arg.stdout deleted file mode 100644 index b745b9886..000000000 --- a/tests/ui/unpretty-expr-fn-arg.stdout +++ /dev/null @@ -1,17 +0,0 @@ -// Regression test for the ICE described in #82328. The pretty-printer for -// `-Zunpretty=hir,typed` would previously retrieve type-checking results -// when entering a body, which means that type information was not available -// for expressions occurring in function signatures, as in the `foo` example -// below, leading to an ICE. - -// check-pass -// compile-flags: -Zunpretty=hir,typed -#![allow(dead_code)] -#[prelude_import] -use ::std::prelude::rust_2015::*; -#[macro_use] -extern crate std; - -fn main() ({ } as ()) - -fn foo((-(128 as i8) as i8)...(127 as i8): i8) ({ } as ()) diff --git a/tests/ui/unpretty/box.rs b/tests/ui/unpretty/box.rs new file mode 100644 index 000000000..81f5c88d7 --- /dev/null +++ b/tests/ui/unpretty/box.rs @@ -0,0 +1,9 @@ +// compile-flags: -Zunpretty=hir +// check-pass + +#![feature(stmt_expr_attributes, rustc_attrs)] + +fn main() { + let _ = #[rustc_box] + Box::new(1); +} diff --git a/tests/ui/unpretty/box.stdout b/tests/ui/unpretty/box.stdout new file mode 100644 index 000000000..0c6e012e6 --- /dev/null +++ b/tests/ui/unpretty/box.stdout @@ -0,0 +1,14 @@ +// compile-flags: -Zunpretty=hir +// check-pass + +#![feature(stmt_expr_attributes, rustc_attrs)] +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; + +fn main() { + let _ = + #[rustc_box] + Box::new(1); + } diff --git a/tests/ui/unpretty/flattened-format-args.rs b/tests/ui/unpretty/flattened-format-args.rs new file mode 100644 index 000000000..705dded16 --- /dev/null +++ b/tests/ui/unpretty/flattened-format-args.rs @@ -0,0 +1,8 @@ +// compile-flags: -Zunpretty=hir -Zflatten-format-args=yes +// check-pass + +fn main() { + let x = 1; + // Should flatten to println!("a 123 b {x} xyz\n"): + println!("a {} {}", format_args!("{} b {x}", 123), "xyz"); +} diff --git a/tests/ui/unpretty/flattened-format-args.stdout b/tests/ui/unpretty/flattened-format-args.stdout new file mode 100644 index 000000000..a8fe8da00 --- /dev/null +++ b/tests/ui/unpretty/flattened-format-args.stdout @@ -0,0 +1,16 @@ +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; +// compile-flags: -Zunpretty=hir -Zflatten-format-args=yes +// check-pass + +fn main() { + let x = 1; + // Should flatten to println!("a 123 b {x} xyz\n"): + { + ::std::io::_print(<#[lang = "format_arguments"]>::new_v1(&["a 123 b ", + " xyz\n"], + &[<#[lang = "format_argument"]>::new_display(&x)])); + }; + } diff --git a/tests/ui/unpretty/mir-unpretty.rs b/tests/ui/unpretty/mir-unpretty.rs new file mode 100644 index 000000000..30620c69f --- /dev/null +++ b/tests/ui/unpretty/mir-unpretty.rs @@ -0,0 +1,5 @@ +// compile-flags: -Z unpretty=mir + +fn main() { + let x: () = 0; //~ ERROR: mismatched types +} diff --git a/tests/ui/unpretty/mir-unpretty.stderr b/tests/ui/unpretty/mir-unpretty.stderr new file mode 100644 index 000000000..3808f8583 --- /dev/null +++ b/tests/ui/unpretty/mir-unpretty.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/mir-unpretty.rs:4:17 + | +LL | let x: () = 0; + | -- ^ expected `()`, found integer + | | + | expected due to this + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/unpretty/unpretty-expr-fn-arg.rs b/tests/ui/unpretty/unpretty-expr-fn-arg.rs new file mode 100644 index 000000000..6e1132a33 --- /dev/null +++ b/tests/ui/unpretty/unpretty-expr-fn-arg.rs @@ -0,0 +1,13 @@ +// Regression test for the ICE described in #82328. The pretty-printer for +// `-Zunpretty=hir,typed` would previously retrieve type-checking results +// when entering a body, which means that type information was not available +// for expressions occurring in function signatures, as in the `foo` example +// below, leading to an ICE. + +// check-pass +// compile-flags: -Zunpretty=hir,typed +#![allow(dead_code)] + +fn main() {} + +fn foo(-128..=127: i8) {} diff --git a/tests/ui/unpretty/unpretty-expr-fn-arg.stdout b/tests/ui/unpretty/unpretty-expr-fn-arg.stdout new file mode 100644 index 000000000..b745b9886 --- /dev/null +++ b/tests/ui/unpretty/unpretty-expr-fn-arg.stdout @@ -0,0 +1,17 @@ +// Regression test for the ICE described in #82328. The pretty-printer for +// `-Zunpretty=hir,typed` would previously retrieve type-checking results +// when entering a body, which means that type information was not available +// for expressions occurring in function signatures, as in the `foo` example +// below, leading to an ICE. + +// check-pass +// compile-flags: -Zunpretty=hir,typed +#![allow(dead_code)] +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; + +fn main() ({ } as ()) + +fn foo((-(128 as i8) as i8)...(127 as i8): i8) ({ } as ()) diff --git a/tests/ui/unresolved/unresolved-candidates.stderr b/tests/ui/unresolved/unresolved-candidates.stderr index ea737c567..7ef2f6b1a 100644 --- a/tests/ui/unresolved/unresolved-candidates.stderr +++ b/tests/ui/unresolved/unresolved-candidates.stderr @@ -17,7 +17,7 @@ LL | impl Trait for () {} | help: consider importing this trait | -LL | use a::Trait; +LL + use a::Trait; | error: aborting due to 2 previous errors diff --git a/tests/ui/unsafe-fn-called-from-unsafe-blk.rs b/tests/ui/unsafe-fn-called-from-unsafe-blk.rs deleted file mode 100644 index 3713a7065..000000000 --- a/tests/ui/unsafe-fn-called-from-unsafe-blk.rs +++ /dev/null @@ -1,18 +0,0 @@ -// run-pass - -#![allow(dead_code)] -// -// See also: ui/unsafe/unsafe-fn-called-from-safe.rs - -// pretty-expanded FIXME #23616 - -unsafe fn f() { return; } - -fn g() { - unsafe { - f(); - } -} - -pub fn main() { -} diff --git a/tests/ui/unsafe-fn-called-from-unsafe-fn.rs b/tests/ui/unsafe-fn-called-from-unsafe-fn.rs deleted file mode 100644 index 5e9531076..000000000 --- a/tests/ui/unsafe-fn-called-from-unsafe-fn.rs +++ /dev/null @@ -1,17 +0,0 @@ -// run-pass - -#![allow(dead_code)] -// -// See also: ui/unsafe/unsafe-fn-called-from-safe.rs - -// pretty-expanded FIXME #23616 - -unsafe fn f() { return; } - -unsafe fn g() { - f(); -} - -pub fn main() { - return; -} diff --git a/tests/ui/unsafe-pointer-assignability.rs b/tests/ui/unsafe-pointer-assignability.rs deleted file mode 100644 index db822bb6a..000000000 --- a/tests/ui/unsafe-pointer-assignability.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass - -fn f(x: *const isize) { - unsafe { - assert_eq!(*x, 3); - } -} - -pub fn main() { - f(&3); -} diff --git a/tests/ui/unsafe/foreign-unsafe-fn-called.mir.stderr b/tests/ui/unsafe/foreign-unsafe-fn-called.mir.stderr new file mode 100644 index 000000000..d3cf5d84f --- /dev/null +++ b/tests/ui/unsafe/foreign-unsafe-fn-called.mir.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/foreign-unsafe-fn-called.rs:11:5 + | +LL | test::free(); + | ^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/foreign-unsafe-fn-called.rs b/tests/ui/unsafe/foreign-unsafe-fn-called.rs new file mode 100644 index 000000000..67302ea1b --- /dev/null +++ b/tests/ui/unsafe/foreign-unsafe-fn-called.rs @@ -0,0 +1,14 @@ +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + +mod test { + extern "C" { + pub fn free(); + } +} + +fn main() { + test::free(); + //[mir]~^ ERROR call to unsafe function is unsafe + //[thir]~^^ ERROR call to unsafe function `test::free` is unsafe +} diff --git a/tests/ui/unsafe/foreign-unsafe-fn-called.thir.stderr b/tests/ui/unsafe/foreign-unsafe-fn-called.thir.stderr new file mode 100644 index 000000000..00ba0f7a6 --- /dev/null +++ b/tests/ui/unsafe/foreign-unsafe-fn-called.thir.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function `test::free` is unsafe and requires unsafe function or block + --> $DIR/foreign-unsafe-fn-called.rs:11:5 + | +LL | test::free(); + | ^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/new-unsafe-pointers.rs b/tests/ui/unsafe/new-unsafe-pointers.rs new file mode 100644 index 000000000..d99eb4cbd --- /dev/null +++ b/tests/ui/unsafe/new-unsafe-pointers.rs @@ -0,0 +1,7 @@ +// run-pass +// pretty-expanded FIXME #23616 + +fn main() { + let _a: *const isize = 3 as *const isize; + let _a: *mut isize = 3 as *mut isize; +} diff --git a/tests/ui/unsafe/unsafe-fn-called-from-unsafe-blk.rs b/tests/ui/unsafe/unsafe-fn-called-from-unsafe-blk.rs new file mode 100644 index 000000000..3713a7065 --- /dev/null +++ b/tests/ui/unsafe/unsafe-fn-called-from-unsafe-blk.rs @@ -0,0 +1,18 @@ +// run-pass + +#![allow(dead_code)] +// +// See also: ui/unsafe/unsafe-fn-called-from-safe.rs + +// pretty-expanded FIXME #23616 + +unsafe fn f() { return; } + +fn g() { + unsafe { + f(); + } +} + +pub fn main() { +} diff --git a/tests/ui/unsafe/unsafe-fn-called-from-unsafe-fn.rs b/tests/ui/unsafe/unsafe-fn-called-from-unsafe-fn.rs new file mode 100644 index 000000000..5e9531076 --- /dev/null +++ b/tests/ui/unsafe/unsafe-fn-called-from-unsafe-fn.rs @@ -0,0 +1,17 @@ +// run-pass + +#![allow(dead_code)] +// +// See also: ui/unsafe/unsafe-fn-called-from-safe.rs + +// pretty-expanded FIXME #23616 + +unsafe fn f() { return; } + +unsafe fn g() { + f(); +} + +pub fn main() { + return; +} diff --git a/tests/ui/unsafe/unsafe-fn-deref-ptr.mir.stderr b/tests/ui/unsafe/unsafe-fn-deref-ptr.mir.stderr index a26149924..7f1e7c890 100644 --- a/tests/ui/unsafe/unsafe-fn-deref-ptr.mir.stderr +++ b/tests/ui/unsafe/unsafe-fn-deref-ptr.mir.stderr @@ -1,11 +1,35 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-deref-ptr.rs:5:12 + --> $DIR/unsafe-fn-deref-ptr.rs:5:13 + | +LL | let _ = *p; + | ^^ dereference of raw pointer + | + = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior + +error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block + --> $DIR/unsafe-fn-deref-ptr.rs:6:17 + | +LL | let _: u8 = *p; + | ^^ dereference of raw pointer + | + = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior + +error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block + --> $DIR/unsafe-fn-deref-ptr.rs:7:9 + | +LL | _ = *p; + | ^^ dereference of raw pointer + | + = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior + +error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block + --> $DIR/unsafe-fn-deref-ptr.rs:8:12 | LL | return *p; | ^^ dereference of raw pointer | = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior -error: aborting due to previous error +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/unsafe-fn-deref-ptr.rs b/tests/ui/unsafe/unsafe-fn-deref-ptr.rs index dc989535b..4b7c6bf69 100644 --- a/tests/ui/unsafe/unsafe-fn-deref-ptr.rs +++ b/tests/ui/unsafe/unsafe-fn-deref-ptr.rs @@ -2,6 +2,9 @@ // [thir]compile-flags: -Z thir-unsafeck fn f(p: *const u8) -> u8 { + let _ = *p; //~ ERROR dereference of raw pointer is unsafe + let _: u8 = *p; //~ ERROR dereference of raw pointer is unsafe + _ = *p; //~ ERROR dereference of raw pointer is unsafe return *p; //~ ERROR dereference of raw pointer is unsafe } diff --git a/tests/ui/unsafe/unsafe-fn-deref-ptr.thir.stderr b/tests/ui/unsafe/unsafe-fn-deref-ptr.thir.stderr index a26149924..7f1e7c890 100644 --- a/tests/ui/unsafe/unsafe-fn-deref-ptr.thir.stderr +++ b/tests/ui/unsafe/unsafe-fn-deref-ptr.thir.stderr @@ -1,11 +1,35 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-deref-ptr.rs:5:12 + --> $DIR/unsafe-fn-deref-ptr.rs:5:13 + | +LL | let _ = *p; + | ^^ dereference of raw pointer + | + = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior + +error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block + --> $DIR/unsafe-fn-deref-ptr.rs:6:17 + | +LL | let _: u8 = *p; + | ^^ dereference of raw pointer + | + = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior + +error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block + --> $DIR/unsafe-fn-deref-ptr.rs:7:9 + | +LL | _ = *p; + | ^^ dereference of raw pointer + | + = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior + +error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block + --> $DIR/unsafe-fn-deref-ptr.rs:8:12 | LL | return *p; | ^^ dereference of raw pointer | = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior -error: aborting due to previous error +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/unsafe-pointer-assignability.rs b/tests/ui/unsafe/unsafe-pointer-assignability.rs new file mode 100644 index 000000000..db822bb6a --- /dev/null +++ b/tests/ui/unsafe/unsafe-pointer-assignability.rs @@ -0,0 +1,11 @@ +// run-pass + +fn f(x: *const isize) { + unsafe { + assert_eq!(*x, 3); + } +} + +pub fn main() { + f(&3); +} diff --git a/tests/ui/unterminated-comment.rs b/tests/ui/unterminated-comment.rs deleted file mode 100644 index 1cfdfb1fb..000000000 --- a/tests/ui/unterminated-comment.rs +++ /dev/null @@ -1 +0,0 @@ -/* //~ ERROR E0758 diff --git a/tests/ui/unterminated-comment.stderr b/tests/ui/unterminated-comment.stderr deleted file mode 100644 index c513fafee..000000000 --- a/tests/ui/unterminated-comment.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0758]: unterminated block comment - --> $DIR/unterminated-comment.rs:1:1 - | -LL | /* - | ^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0758`. diff --git a/tests/ui/unterminated-nested-comment.rs b/tests/ui/unterminated-nested-comment.rs deleted file mode 100644 index db5f2f3ba..000000000 --- a/tests/ui/unterminated-nested-comment.rs +++ /dev/null @@ -1,4 +0,0 @@ -/* //~ ERROR E0758 -/* */ -/* -*/ diff --git a/tests/ui/unterminated-nested-comment.stderr b/tests/ui/unterminated-nested-comment.stderr deleted file mode 100644 index 3653e76c9..000000000 --- a/tests/ui/unterminated-nested-comment.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0758]: unterminated block comment - --> $DIR/unterminated-nested-comment.rs:1:1 - | -LL | /* - | ^- - | | - | _unterminated block comment - | | -LL | | /* */ -LL | | /* - | | -- - | | | - | | ...as last nested comment starts here, maybe you want to close this instead? -LL | | */ - | |_--^ - | | - | ...and last nested comment terminates here. - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0758`. diff --git a/tests/ui/unwind-unique.rs b/tests/ui/unwind-unique.rs deleted file mode 100644 index 50ecf751a..000000000 --- a/tests/ui/unwind-unique.rs +++ /dev/null @@ -1,15 +0,0 @@ -// run-pass -// needs-unwind -// ignore-emscripten no threads support - -use std::thread; - -fn f() { - let _a: Box<_> = Box::new(0); - panic!(); -} - -pub fn main() { - let t = thread::spawn(f); - drop(t.join()); -} diff --git a/tests/ui/use.rs b/tests/ui/use.rs deleted file mode 100644 index 1beee4a51..000000000 --- a/tests/ui/use.rs +++ /dev/null @@ -1,23 +0,0 @@ -// run-pass - -#![allow(stable_features)] -// pretty-expanded FIXME #23616 - -#![allow(unused_imports)] -#![feature(start, no_core, core)] -#![no_core] - -extern crate std; -extern crate std as zed; - -use std::str; -use zed::str as x; - -use std::io::{self, Error as IoError, Result as IoResult}; -use std::error::{self as foo}; -mod baz { - pub use std::str as x; -} - -#[start] -pub fn start(_: isize, _: *const *const u8) -> isize { 0 } diff --git a/tests/ui/use/use-mod.rs b/tests/ui/use/use-mod.rs deleted file mode 100644 index 87064c6a4..000000000 --- a/tests/ui/use/use-mod.rs +++ /dev/null @@ -1,19 +0,0 @@ -use foo::bar::{ - self, -//~^ ERROR `self` import can only appear once in an import list - Bar, - self -//~^ ERROR the name `bar` is defined multiple times -}; - -use {self}; -//~^ ERROR `self` import can only appear in an import list with a non-empty prefix - -mod foo { - pub mod bar { - pub struct Bar; - pub struct Baz; - } -} - -fn main() {} diff --git a/tests/ui/use/use-mod.stderr b/tests/ui/use/use-mod.stderr deleted file mode 100644 index 0cae5eb14..000000000 --- a/tests/ui/use/use-mod.stderr +++ /dev/null @@ -1,33 +0,0 @@ -error[E0430]: `self` import can only appear once in an import list - --> $DIR/use-mod.rs:2:5 - | -LL | self, - | ^^^^ can only appear once in an import list -... -LL | self - | ---- another `self` import appears here - -error[E0431]: `self` import can only appear in an import list with a non-empty prefix - --> $DIR/use-mod.rs:9:6 - | -LL | use {self}; - | ^^^^ can only appear in an import list with a non-empty prefix - -error[E0252]: the name `bar` is defined multiple times - --> $DIR/use-mod.rs:5:5 - | -LL | self, - | ---- previous import of the module `bar` here -... -LL | self - | ^^^^ - | | - | `bar` reimported here - | help: remove unnecessary import - | - = note: `bar` must be defined only once in the type namespace of this module - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0252, E0430, E0431. -For more information about an error, try `rustc --explain E0252`. diff --git a/tests/ui/use/use-mod/use-mod.rs b/tests/ui/use/use-mod/use-mod.rs new file mode 100644 index 000000000..87064c6a4 --- /dev/null +++ b/tests/ui/use/use-mod/use-mod.rs @@ -0,0 +1,19 @@ +use foo::bar::{ + self, +//~^ ERROR `self` import can only appear once in an import list + Bar, + self +//~^ ERROR the name `bar` is defined multiple times +}; + +use {self}; +//~^ ERROR `self` import can only appear in an import list with a non-empty prefix + +mod foo { + pub mod bar { + pub struct Bar; + pub struct Baz; + } +} + +fn main() {} diff --git a/tests/ui/use/use-mod/use-mod.stderr b/tests/ui/use/use-mod/use-mod.stderr new file mode 100644 index 000000000..0cae5eb14 --- /dev/null +++ b/tests/ui/use/use-mod/use-mod.stderr @@ -0,0 +1,33 @@ +error[E0430]: `self` import can only appear once in an import list + --> $DIR/use-mod.rs:2:5 + | +LL | self, + | ^^^^ can only appear once in an import list +... +LL | self + | ---- another `self` import appears here + +error[E0431]: `self` import can only appear in an import list with a non-empty prefix + --> $DIR/use-mod.rs:9:6 + | +LL | use {self}; + | ^^^^ can only appear in an import list with a non-empty prefix + +error[E0252]: the name `bar` is defined multiple times + --> $DIR/use-mod.rs:5:5 + | +LL | self, + | ---- previous import of the module `bar` here +... +LL | self + | ^^^^ + | | + | `bar` reimported here + | help: remove unnecessary import + | + = note: `bar` must be defined only once in the type namespace of this module + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0252, E0430, E0431. +For more information about an error, try `rustc --explain E0252`. diff --git a/tests/ui/use/use.rs b/tests/ui/use/use.rs new file mode 100644 index 000000000..1beee4a51 --- /dev/null +++ b/tests/ui/use/use.rs @@ -0,0 +1,23 @@ +// run-pass + +#![allow(stable_features)] +// pretty-expanded FIXME #23616 + +#![allow(unused_imports)] +#![feature(start, no_core, core)] +#![no_core] + +extern crate std; +extern crate std as zed; + +use std::str; +use zed::str as x; + +use std::io::{self, Error as IoError, Result as IoResult}; +use std::error::{self as foo}; +mod baz { + pub use std::str as x; +} + +#[start] +pub fn start(_: isize, _: *const *const u8) -> isize { 0 } diff --git a/tests/ui/variance-intersection-of-ref-and-opt-ref.rs b/tests/ui/variance-intersection-of-ref-and-opt-ref.rs deleted file mode 100644 index 74707a98d..000000000 --- a/tests/ui/variance-intersection-of-ref-and-opt-ref.rs +++ /dev/null @@ -1,25 +0,0 @@ -// run-pass -// Elaborated version of the opening example from RFC 738. This failed -// to compile before variance because invariance of `Option` prevented -// us from approximating the lifetimes of `field1` and `field2` to a -// common intersection. - -#![allow(dead_code)] - -struct List<'l> { - field1: &'l i32, - field2: Option<&'l i32>, -} - -fn foo(field1: &i32, field2: Option<&i32>) -> i32 { - let list = List { field1: field1, field2: field2 }; - *list.field1 + list.field2.cloned().unwrap_or(0) -} - -fn main() { - let x = 22; - let y = Some(3); - let z = None; - assert_eq!(foo(&x, y.as_ref()), 25); - assert_eq!(foo(&x, z.as_ref()), 22); -} diff --git a/tests/ui/variance-iterators-in-libcore.rs b/tests/ui/variance-iterators-in-libcore.rs deleted file mode 100644 index a542e44d5..000000000 --- a/tests/ui/variance-iterators-in-libcore.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass - -#![allow(dead_code)] - -use std::iter::{Fuse, Zip}; - -fn fuse_covariant<'a, I>(iter: Fuse<&'static I>) -> Fuse<&'a I> { iter } -fn zip_covariant<'a, A, B>(iter: Zip<&'static A, &'static B>) -> Zip<&'a A, &'a B> { iter } - -fn main() { } diff --git a/tests/ui/variance/variance-intersection-of-ref-and-opt-ref.rs b/tests/ui/variance/variance-intersection-of-ref-and-opt-ref.rs new file mode 100644 index 000000000..74707a98d --- /dev/null +++ b/tests/ui/variance/variance-intersection-of-ref-and-opt-ref.rs @@ -0,0 +1,25 @@ +// run-pass +// Elaborated version of the opening example from RFC 738. This failed +// to compile before variance because invariance of `Option` prevented +// us from approximating the lifetimes of `field1` and `field2` to a +// common intersection. + +#![allow(dead_code)] + +struct List<'l> { + field1: &'l i32, + field2: Option<&'l i32>, +} + +fn foo(field1: &i32, field2: Option<&i32>) -> i32 { + let list = List { field1: field1, field2: field2 }; + *list.field1 + list.field2.cloned().unwrap_or(0) +} + +fn main() { + let x = 22; + let y = Some(3); + let z = None; + assert_eq!(foo(&x, y.as_ref()), 25); + assert_eq!(foo(&x, z.as_ref()), 22); +} diff --git a/tests/ui/variance/variance-iterators-in-libcore.rs b/tests/ui/variance/variance-iterators-in-libcore.rs new file mode 100644 index 000000000..a542e44d5 --- /dev/null +++ b/tests/ui/variance/variance-iterators-in-libcore.rs @@ -0,0 +1,10 @@ +// run-pass + +#![allow(dead_code)] + +use std::iter::{Fuse, Zip}; + +fn fuse_covariant<'a, I>(iter: Fuse<&'static I>) -> Fuse<&'a I> { iter } +fn zip_covariant<'a, A, B>(iter: Zip<&'static A, &'static B>) -> Zip<&'a A, &'a B> { iter } + +fn main() { } diff --git a/tests/ui/wasm-custom-section-relocations.rs b/tests/ui/wasm-custom-section-relocations.rs deleted file mode 100644 index c3cca3a35..000000000 --- a/tests/ui/wasm-custom-section-relocations.rs +++ /dev/null @@ -1,15 +0,0 @@ -// only-wasm32 - -#[link_section = "test"] -pub static A: &[u8] = &[1]; //~ ERROR: no extra levels of indirection - -#[link_section = "test"] -pub static B: [u8; 3] = [1, 2, 3]; - -#[link_section = "test"] -pub static C: usize = 3; - -#[link_section = "test"] -pub static D: &usize = &C; //~ ERROR: no extra levels of indirection - -fn main() {} diff --git a/tests/ui/wasm-custom-section-relocations.stderr b/tests/ui/wasm-custom-section-relocations.stderr deleted file mode 100644 index a37edc51d..000000000 --- a/tests/ui/wasm-custom-section-relocations.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: statics with a custom `#[link_section]` must be a simple list of bytes on the wasm target with no extra levels of indirection such as references - --> $DIR/wasm-custom-section-relocations.rs:4:1 - | -LL | pub static A: &[u8] = &[1]; - | ^^^^^^^^^^^^^^^^^^^ - -error: statics with a custom `#[link_section]` must be a simple list of bytes on the wasm target with no extra levels of indirection such as references - --> $DIR/wasm-custom-section-relocations.rs:13:1 - | -LL | pub static D: &usize = &C; - | ^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - diff --git a/tests/ui/wasm/wasm-custom-section-relocations.rs b/tests/ui/wasm/wasm-custom-section-relocations.rs new file mode 100644 index 000000000..c3cca3a35 --- /dev/null +++ b/tests/ui/wasm/wasm-custom-section-relocations.rs @@ -0,0 +1,15 @@ +// only-wasm32 + +#[link_section = "test"] +pub static A: &[u8] = &[1]; //~ ERROR: no extra levels of indirection + +#[link_section = "test"] +pub static B: [u8; 3] = [1, 2, 3]; + +#[link_section = "test"] +pub static C: usize = 3; + +#[link_section = "test"] +pub static D: &usize = &C; //~ ERROR: no extra levels of indirection + +fn main() {} diff --git a/tests/ui/wasm/wasm-custom-section-relocations.stderr b/tests/ui/wasm/wasm-custom-section-relocations.stderr new file mode 100644 index 000000000..a37edc51d --- /dev/null +++ b/tests/ui/wasm/wasm-custom-section-relocations.stderr @@ -0,0 +1,14 @@ +error: statics with a custom `#[link_section]` must be a simple list of bytes on the wasm target with no extra levels of indirection such as references + --> $DIR/wasm-custom-section-relocations.rs:4:1 + | +LL | pub static A: &[u8] = &[1]; + | ^^^^^^^^^^^^^^^^^^^ + +error: statics with a custom `#[link_section]` must be a simple list of bytes on the wasm target with no extra levels of indirection such as references + --> $DIR/wasm-custom-section-relocations.rs:13:1 + | +LL | pub static D: &usize = &C; + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/wf/hir-wf-check-erase-regions.rs b/tests/ui/wf/hir-wf-check-erase-regions.rs index 2b4b480df..3855f2c35 100644 --- a/tests/ui/wf/hir-wf-check-erase-regions.rs +++ b/tests/ui/wf/hir-wf-check-erase-regions.rs @@ -4,10 +4,10 @@ pub struct Table([Option; N]); impl<'a, T, const N: usize> IntoIterator for &'a Table { - type IntoIter = std::iter::Flatten>; //~ ERROR `&T` is not an iterator + type IntoIter = std::iter::Flatten>; //~ ERROR `&'a T` is not an iterator type Item = &'a T; - fn into_iter(self) -> Self::IntoIter { //~ ERROR `&T` is not an iterator + fn into_iter(self) -> Self::IntoIter { //~ ERROR `&'a T` is not an iterator unimplemented!() } } diff --git a/tests/ui/wf/hir-wf-check-erase-regions.stderr b/tests/ui/wf/hir-wf-check-erase-regions.stderr index 7bc19dd2e..2843983c7 100644 --- a/tests/ui/wf/hir-wf-check-erase-regions.stderr +++ b/tests/ui/wf/hir-wf-check-erase-regions.stderr @@ -1,24 +1,24 @@ -error[E0277]: `&T` is not an iterator +error[E0277]: `&'a T` is not an iterator --> $DIR/hir-wf-check-erase-regions.rs:7:21 | LL | type IntoIter = std::iter::Flatten>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&T` is not an iterator + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'a T` is not an iterator | - = help: the trait `Iterator` is not implemented for `&T` + = help: the trait `Iterator` is not implemented for `&'a T` = help: the trait `Iterator` is implemented for `&mut I` - = note: required for `&T` to implement `IntoIterator` + = note: required for `&'a T` to implement `IntoIterator` note: required by a bound in `Flatten` --> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL -error[E0277]: `&T` is not an iterator +error[E0277]: `&'a T` is not an iterator --> $DIR/hir-wf-check-erase-regions.rs:10:27 | LL | fn into_iter(self) -> Self::IntoIter { - | ^^^^^^^^^^^^^^ `&T` is not an iterator + | ^^^^^^^^^^^^^^ `&'a T` is not an iterator | - = help: the trait `Iterator` is not implemented for `&T` + = help: the trait `Iterator` is not implemented for `&'a T` = help: the trait `Iterator` is implemented for `&mut I` - = note: required for `&T` to implement `IntoIterator` + = note: required for `&'a T` to implement `IntoIterator` note: required by a bound in `Flatten` --> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL diff --git a/tests/ui/wf/issue-110157.rs b/tests/ui/wf/issue-110157.rs new file mode 100644 index 000000000..43a8ce72f --- /dev/null +++ b/tests/ui/wf/issue-110157.rs @@ -0,0 +1,12 @@ +struct NeedsDropTypes<'tcx, F>(std::marker::PhantomData<&'tcx F>); + +impl<'tcx, F, I> Iterator for NeedsDropTypes<'tcx, F> +//~^ ERROR type annotations needed +where + F: Fn(&Missing) -> Result, + //~^ ERROR cannot find type `Missing` in this scope + I: Iterator, + //~^ ERROR cannot find type `Missing` in this scope +{} + +fn main() {} diff --git a/tests/ui/wf/issue-110157.stderr b/tests/ui/wf/issue-110157.stderr new file mode 100644 index 000000000..91d801e94 --- /dev/null +++ b/tests/ui/wf/issue-110157.stderr @@ -0,0 +1,32 @@ +error[E0412]: cannot find type `Missing` in this scope + --> $DIR/issue-110157.rs:6:12 + | +LL | F: Fn(&Missing) -> Result, + | ^^^^^^^ not found in this scope + +error[E0412]: cannot find type `Missing` in this scope + --> $DIR/issue-110157.rs:8:24 + | +LL | I: Iterator, + | ^^^^^^^ not found in this scope + +error[E0283]: type annotations needed + --> $DIR/issue-110157.rs:3:31 + | +LL | impl<'tcx, F, I> Iterator for NeedsDropTypes<'tcx, F> + | ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `I` + | + = note: cannot satisfy `_: Iterator` +note: required for `NeedsDropTypes<'tcx, F>` to implement `Iterator` + --> $DIR/issue-110157.rs:3:18 + | +LL | impl<'tcx, F, I> Iterator for NeedsDropTypes<'tcx, F> + | ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^ +... +LL | I: Iterator, + | ------------------------ unsatisfied trait bound introduced here + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0283, E0412. +For more information about an error, try `rustc --explain E0283`. diff --git a/tests/ui/wf/wf-const-type.stderr b/tests/ui/wf/wf-const-type.stderr index 85938364e..617969720 100644 --- a/tests/ui/wf/wf-const-type.stderr +++ b/tests/ui/wf/wf-const-type.stderr @@ -12,7 +12,8 @@ LL | struct IsCopy { t: T } | ^^^^ required by this bound in `IsCopy` help: consider annotating `NotCopy` with `#[derive(Copy)]` | -LL | #[derive(Copy)] +LL + #[derive(Copy)] +LL | struct NotCopy; | error: aborting due to previous error diff --git a/tests/ui/wf/wf-static-type.stderr b/tests/ui/wf/wf-static-type.stderr index 16c6124b6..bb5a57834 100644 --- a/tests/ui/wf/wf-static-type.stderr +++ b/tests/ui/wf/wf-static-type.stderr @@ -12,7 +12,8 @@ LL | struct IsCopy { t: T } | ^^^^ required by this bound in `IsCopy` help: consider annotating `NotCopy` with `#[derive(Copy)]` | -LL | #[derive(Copy)] +LL + #[derive(Copy)] +LL | struct NotCopy; | error: aborting due to previous error diff --git a/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr b/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr index f4c7acd5c..ce409f627 100644 --- a/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr +++ b/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr @@ -1,8 +1,8 @@ -error[E0277]: the trait bound `for fn(&ReLateBound(DebruijnIndex(1), BoundRegion { var: 0, kind: BrNamed(DefId(0:6 ~ higher_ranked_fn_type[1209]::called::'b), 'b) }) ()): Foo` is not satisfied +error[E0277]: the trait bound `for fn(&ReLateBound(DebruijnIndex(1), BoundRegion { var: 0, kind: BrNamed(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b), 'b) }) ()): Foo` is not satisfied --> $DIR/higher-ranked-fn-type.rs:20:5 | LL | called() - | ^^^^^^ the trait `for Foo` is not implemented for `fn(&ReLateBound(DebruijnIndex(1), BoundRegion { var: 0, kind: BrNamed(DefId(0:6 ~ higher_ranked_fn_type[1209]::called::'b), 'b) }) ())` + | ^^^^^^ the trait `for Foo` is not implemented for `fn(&ReLateBound(DebruijnIndex(1), BoundRegion { var: 0, kind: BrNamed(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b), 'b) }) ())` | note: required by a bound in `called` --> $DIR/higher-ranked-fn-type.rs:12:25 diff --git a/tests/ui/where-clauses/where-clauses-method-unsatisfied.stderr b/tests/ui/where-clauses/where-clauses-method-unsatisfied.stderr index e90502977..6cf717295 100644 --- a/tests/ui/where-clauses/where-clauses-method-unsatisfied.stderr +++ b/tests/ui/where-clauses/where-clauses-method-unsatisfied.stderr @@ -11,7 +11,8 @@ LL | fn equals(&self, u: &Foo) -> bool where T : Eq { | ^^ required by this bound in `Foo::::equals` help: consider annotating `Bar` with `#[derive(Eq)]` | -LL | #[derive(Eq)] +LL + #[derive(Eq)] +LL | struct Bar; // does not implement Eq | error: aborting due to previous error diff --git a/tests/ui/where-clauses/where-clauses-unsatisfied.stderr b/tests/ui/where-clauses/where-clauses-unsatisfied.stderr index b1805a452..4d239bf43 100644 --- a/tests/ui/where-clauses/where-clauses-unsatisfied.stderr +++ b/tests/ui/where-clauses/where-clauses-unsatisfied.stderr @@ -11,7 +11,8 @@ LL | fn equal(a: &T, b: &T) -> bool where T : Eq { a == b } | ^^ required by this bound in `equal` help: consider annotating `Struct` with `#[derive(Eq)]` | -LL | #[derive(Eq)] +LL + #[derive(Eq)] +LL | struct Struct; | error: aborting due to previous error diff --git a/tests/ui/while-type-error.rs b/tests/ui/while-type-error.rs deleted file mode 100644 index 8098bfcd8..000000000 --- a/tests/ui/while-type-error.rs +++ /dev/null @@ -1,3 +0,0 @@ -// error-pattern: mismatched types - -fn main() { while main { } } diff --git a/tests/ui/while-type-error.stderr b/tests/ui/while-type-error.stderr deleted file mode 100644 index 529cbff05..000000000 --- a/tests/ui/while-type-error.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/while-type-error.rs:3:19 - | -LL | fn main() { while main { } } - | ^^^^ expected `bool`, found fn item - | - = note: expected type `bool` - found fn item `fn() {main}` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/wrong-mul-method-signature.rs b/tests/ui/wrong-mul-method-signature.rs deleted file mode 100644 index 1c2f86559..000000000 --- a/tests/ui/wrong-mul-method-signature.rs +++ /dev/null @@ -1,68 +0,0 @@ -// This test is to make sure we don't just ICE if the trait -// method for an operator is not implemented properly. -// (In this case the mul method should take &f64 and not f64) -// See: #11450 - -use std::ops::Mul; - -struct Vec1 { - x: f64 -} - -// Expecting value in input signature -impl Mul for Vec1 { - type Output = Vec1; - - fn mul(self, s: &f64) -> Vec1 { - //~^ ERROR method `mul` has an incompatible type for trait - Vec1 { - x: self.x * *s - } - } -} - -struct Vec2 { - x: f64, - y: f64 -} - -// Wrong type parameter ordering -impl Mul for Vec2 { - type Output = f64; - - fn mul(self, s: f64) -> Vec2 { - //~^ ERROR method `mul` has an incompatible type for trait - Vec2 { - x: self.x * s, - y: self.y * s - } - } -} - -struct Vec3 { - x: f64, - y: f64, - z: f64 -} - -// Unexpected return type -impl Mul for Vec3 { - type Output = i32; - - fn mul(self, s: f64) -> f64 { - //~^ ERROR method `mul` has an incompatible type for trait - s - } -} - -pub fn main() { - // Check that the usage goes from the trait declaration: - - let x: Vec1 = Vec1 { x: 1.0 } * 2.0; // this is OK - - let x: Vec2 = Vec2 { x: 1.0, y: 2.0 } * 2.0; // trait had reversed order - //~^ ERROR mismatched types - //~| ERROR mismatched types - - let x: i32 = Vec3 { x: 1.0, y: 2.0, z: 3.0 } * 2.0; -} diff --git a/tests/ui/wrong-mul-method-signature.stderr b/tests/ui/wrong-mul-method-signature.stderr deleted file mode 100644 index 25a92f5ec..000000000 --- a/tests/ui/wrong-mul-method-signature.stderr +++ /dev/null @@ -1,56 +0,0 @@ -error[E0053]: method `mul` has an incompatible type for trait - --> $DIR/wrong-mul-method-signature.rs:16:21 - | -LL | fn mul(self, s: &f64) -> Vec1 { - | ^^^^ - | | - | expected `f64`, found `&f64` - | help: change the parameter type to match the trait: `f64` - | - = note: expected signature `fn(Vec1, f64) -> Vec1` - found signature `fn(Vec1, &f64) -> Vec1` - -error[E0053]: method `mul` has an incompatible type for trait - --> $DIR/wrong-mul-method-signature.rs:33:21 - | -LL | fn mul(self, s: f64) -> Vec2 { - | ^^^ - | | - | expected `Vec2`, found `f64` - | help: change the parameter type to match the trait: `Vec2` - | - = note: expected signature `fn(Vec2, Vec2) -> f64` - found signature `fn(Vec2, f64) -> Vec2` - -error[E0053]: method `mul` has an incompatible type for trait - --> $DIR/wrong-mul-method-signature.rs:52:29 - | -LL | fn mul(self, s: f64) -> f64 { - | ^^^ - | | - | expected `i32`, found `f64` - | help: change the output type to match the trait: `i32` - | - = note: expected signature `fn(Vec3, _) -> i32` - found signature `fn(Vec3, _) -> f64` - -error[E0308]: mismatched types - --> $DIR/wrong-mul-method-signature.rs:63:45 - | -LL | let x: Vec2 = Vec2 { x: 1.0, y: 2.0 } * 2.0; // trait had reversed order - | ----------------------- ^^^ expected `Vec2`, found floating-point number - | | - | expected because this is `Vec2` - -error[E0308]: mismatched types - --> $DIR/wrong-mul-method-signature.rs:63:19 - | -LL | let x: Vec2 = Vec2 { x: 1.0, y: 2.0 } * 2.0; // trait had reversed order - | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Vec2`, found `f64` - | | - | expected due to this - -error: aborting due to 5 previous errors - -Some errors have detailed explanations: E0053, E0308. -For more information about an error, try `rustc --explain E0053`. diff --git a/tests/ui/wrong-ret-type.rs b/tests/ui/wrong-ret-type.rs deleted file mode 100644 index cbff8dbae..000000000 --- a/tests/ui/wrong-ret-type.rs +++ /dev/null @@ -1,3 +0,0 @@ -// error-pattern: mismatched types -fn mk_int() -> usize { let i: isize = 3; return i; } -fn main() { } diff --git a/tests/ui/wrong-ret-type.stderr b/tests/ui/wrong-ret-type.stderr deleted file mode 100644 index c686a0b2f..000000000 --- a/tests/ui/wrong-ret-type.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/wrong-ret-type.rs:2:49 - | -LL | fn mk_int() -> usize { let i: isize = 3; return i; } - | ----- ^ expected `usize`, found `isize` - | | - | expected `usize` because of return type - | -help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit - | -LL | fn mk_int() -> usize { let i: isize = 3; return i.try_into().unwrap(); } - | ++++++++++++++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/xc-private-method.rs b/tests/ui/xc-private-method.rs deleted file mode 100644 index f05994646..000000000 --- a/tests/ui/xc-private-method.rs +++ /dev/null @@ -1,11 +0,0 @@ -// aux-build:xc-private-method-lib.rs - -extern crate xc_private_method_lib; - -fn main() { - let _ = xc_private_method_lib::Struct::static_meth_struct(); - //~^ ERROR: associated function `static_meth_struct` is private - - let _ = xc_private_method_lib::Enum::static_meth_enum(); - //~^ ERROR: associated function `static_meth_enum` is private -} diff --git a/tests/ui/xc-private-method.stderr b/tests/ui/xc-private-method.stderr deleted file mode 100644 index 0eabc592a..000000000 --- a/tests/ui/xc-private-method.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0624]: associated function `static_meth_struct` is private - --> $DIR/xc-private-method.rs:6:44 - | -LL | let _ = xc_private_method_lib::Struct::static_meth_struct(); - | ^^^^^^^^^^^^^^^^^^ private associated function - | - ::: $DIR/auxiliary/xc-private-method-lib.rs:8:5 - | -LL | fn static_meth_struct() -> Struct { - | --------------------------------- private associated function defined here - -error[E0624]: associated function `static_meth_enum` is private - --> $DIR/xc-private-method.rs:9:42 - | -LL | let _ = xc_private_method_lib::Enum::static_meth_enum(); - | ^^^^^^^^^^^^^^^^ private associated function - | - ::: $DIR/auxiliary/xc-private-method-lib.rs:23:5 - | -LL | fn static_meth_enum() -> Enum { - | ----------------------------- private associated function defined here - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0624`. diff --git a/tests/ui/xc-private-method2.rs b/tests/ui/xc-private-method2.rs deleted file mode 100644 index f11b25108..000000000 --- a/tests/ui/xc-private-method2.rs +++ /dev/null @@ -1,11 +0,0 @@ -// aux-build:xc-private-method-lib.rs - -extern crate xc_private_method_lib; - -fn main() { - let _ = xc_private_method_lib::Struct{ x: 10 }.meth_struct(); - //~^ ERROR method `meth_struct` is private - - let _ = xc_private_method_lib::Enum::Variant1(20).meth_enum(); - //~^ ERROR method `meth_enum` is private -} diff --git a/tests/ui/xc-private-method2.stderr b/tests/ui/xc-private-method2.stderr deleted file mode 100644 index af0c3cfcb..000000000 --- a/tests/ui/xc-private-method2.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0624]: method `meth_struct` is private - --> $DIR/xc-private-method2.rs:6:52 - | -LL | let _ = xc_private_method_lib::Struct{ x: 10 }.meth_struct(); - | ^^^^^^^^^^^ private method - | - ::: $DIR/auxiliary/xc-private-method-lib.rs:12:5 - | -LL | fn meth_struct(&self) -> isize { - | ------------------------------ private method defined here - -error[E0624]: method `meth_enum` is private - --> $DIR/xc-private-method2.rs:9:55 - | -LL | let _ = xc_private_method_lib::Enum::Variant1(20).meth_enum(); - | ^^^^^^^^^ private method - | - ::: $DIR/auxiliary/xc-private-method-lib.rs:27:5 - | -LL | fn meth_enum(&self) -> isize { - | ---------------------------- private method defined here - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0624`. -- cgit v1.2.3