summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/assembly/closure-inherit-target-feature.rs58
-rw-r--r--tests/codegen/asm-maybe-uninit.rs27
-rw-r--r--tests/codegen/async-fn-debug-awaitee-field.rs10
-rw-r--r--tests/codegen/box-uninit-bytes.rs (renamed from tests/codegen/box-maybe-uninit.rs)14
-rw-r--r--tests/codegen/cold-call-declare-and-call.rs13
-rw-r--r--tests/codegen/debuginfo-inline-callsite-location.rs28
-rw-r--r--tests/codegen/issues/issue-105386-ub-in-debuginfo.rs4
-rw-r--r--tests/codegen/issues/issue-115385-llvm-jump-threading.rs46
-rw-r--r--tests/codegen/lib-optimizations/iter-sum.rs15
-rw-r--r--tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs4
-rw-r--r--tests/codegen/macos/i686-macosx-deployment-target.rs4
-rw-r--r--tests/codegen/macos/i686-no-macosx-deployment-target.rs2
-rw-r--r--tests/codegen/macos/x86_64-macosx-deployment-target.rs4
-rw-r--r--tests/codegen/macos/x86_64-no-macosx-deployment-target.rs2
-rw-r--r--tests/codegen/move-before-nocapture-ref-arg.rs22
-rw-r--r--tests/codegen/repr/transparent.rs1
-rw-r--r--tests/codegen/sanitizer/address-sanitizer-globals-tracking.rs44
-rw-r--r--tests/codegen/sanitizer/cfi-emit-type-metadata-id-itanium-cxx-abi.rs12
-rw-r--r--tests/codegen/sanitizer/kcfi-add-kcfi-flag.rs13
-rw-r--r--tests/codegen/sanitizer/memory-track-origins.rs11
-rw-r--r--tests/codegen/sanitizer/no-sanitize-inlining.rs5
-rw-r--r--tests/codegen/sanitizer/no-sanitize.rs2
-rw-r--r--tests/codegen/sanitizer/sanitizer-recover.rs1
-rw-r--r--tests/codegen/slice-as_chunks.rs6
-rw-r--r--tests/codegen/slice-iter-nonnull.rs6
-rw-r--r--tests/codegen/tuple-layout-opt.rs1
-rw-r--r--tests/codegen/vecdeque-nonempty-get-no-panic.rs17
-rw-r--r--tests/coverage-map/README.md13
-rw-r--r--tests/coverage-map/if.cov-map15
-rw-r--r--tests/coverage-map/if.rs9
-rw-r--r--tests/coverage-map/long_and_wide.cov-map32
-rw-r--r--tests/coverage-map/long_and_wide.rs150
-rw-r--r--tests/coverage-map/status-quo/abort.cov-map57
-rw-r--r--tests/coverage-map/status-quo/abort.rs66
-rw-r--r--tests/coverage-map/status-quo/assert.cov-map40
-rw-r--r--tests/coverage-map/status-quo/assert.rs32
-rw-r--r--tests/coverage-map/status-quo/async.cov-map340
-rw-r--r--tests/coverage-map/status-quo/async.rs128
-rw-r--r--tests/coverage-map/status-quo/async2.cov-map136
-rw-r--r--tests/coverage-map/status-quo/async2.rs57
-rw-r--r--tests/coverage-map/status-quo/closure.cov-map324
-rw-r--r--tests/coverage-map/status-quo/closure.rs220
-rw-r--r--tests/coverage-map/status-quo/closure_bug.cov-map148
-rw-r--r--tests/coverage-map/status-quo/closure_bug.rs44
-rw-r--r--tests/coverage-map/status-quo/closure_macro.cov-map40
-rw-r--r--tests/coverage-map/status-quo/closure_macro.rs40
-rw-r--r--tests/coverage-map/status-quo/closure_macro_async.cov-map48
-rw-r--r--tests/coverage-map/status-quo/closure_macro_async.rs77
-rw-r--r--tests/coverage-map/status-quo/conditions.cov-map261
-rw-r--r--tests/coverage-map/status-quo/conditions.rs86
-rw-r--r--tests/coverage-map/status-quo/continue.cov-map85
-rw-r--r--tests/coverage-map/status-quo/continue.rs69
-rw-r--r--tests/coverage-map/status-quo/dead_code.cov-map37
-rw-r--r--tests/coverage-map/status-quo/dead_code.rs37
-rw-r--r--tests/coverage-map/status-quo/drop_trait.cov-map21
-rw-r--r--tests/coverage-map/status-quo/drop_trait.rs33
-rw-r--r--tests/coverage-map/status-quo/generator.cov-map58
-rw-r--r--tests/coverage-map/status-quo/generator.rs30
-rw-r--r--tests/coverage-map/status-quo/generics.cov-map45
-rw-r--r--tests/coverage-map/status-quo/generics.rs44
-rw-r--r--tests/coverage-map/status-quo/if.cov-map15
-rw-r--r--tests/coverage-map/status-quo/if.rs28
-rw-r--r--tests/coverage-map/status-quo/if_else.cov-map25
-rw-r--r--tests/coverage-map/status-quo/if_else.rs40
-rw-r--r--tests/coverage-map/status-quo/inline-dead.cov-map45
-rw-r--r--tests/coverage-map/status-quo/inline-dead.rs27
-rw-r--r--tests/coverage-map/status-quo/inline.cov-map82
-rw-r--r--tests/coverage-map/status-quo/inline.rs51
-rw-r--r--tests/coverage-map/status-quo/inner_items.cov-map49
-rw-r--r--tests/coverage-map/status-quo/inner_items.rs57
-rw-r--r--tests/coverage-map/status-quo/issue-83601.cov-map28
-rw-r--r--tests/coverage-map/status-quo/issue-83601.rs14
-rw-r--r--tests/coverage-map/status-quo/issue-84561.cov-map233
-rw-r--r--tests/coverage-map/status-quo/issue-84561.rs182
-rw-r--r--tests/coverage-map/status-quo/issue-93054.cov-map24
-rw-r--r--tests/coverage-map/status-quo/issue-93054.rs30
-rw-r--r--tests/coverage-map/status-quo/lazy_boolean.cov-map223
-rw-r--r--tests/coverage-map/status-quo/lazy_boolean.rs61
-rw-r--r--tests/coverage-map/status-quo/loop_break_value.cov-map8
-rw-r--r--tests/coverage-map/status-quo/loop_break_value.rs13
-rw-r--r--tests/coverage-map/status-quo/loops_branches.cov-map185
-rw-r--r--tests/coverage-map/status-quo/loops_branches.rs60
-rw-r--r--tests/coverage-map/status-quo/match_or_pattern.cov-map83
-rw-r--r--tests/coverage-map/status-quo/match_or_pattern.rs43
-rw-r--r--tests/coverage-map/status-quo/nested_loops.cov-map51
-rw-r--r--tests/coverage-map/status-quo/nested_loops.rs25
-rw-r--r--tests/coverage-map/status-quo/no_cov_crate.cov-map78
-rw-r--r--tests/coverage-map/status-quo/no_cov_crate.rs88
-rw-r--r--tests/coverage-map/status-quo/overflow.cov-map43
-rw-r--r--tests/coverage-map/status-quo/overflow.rs63
-rw-r--r--tests/coverage-map/status-quo/panic_unwind.cov-map40
-rw-r--r--tests/coverage-map/status-quo/panic_unwind.rs31
-rw-r--r--tests/coverage-map/status-quo/partial_eq.cov-map64
-rw-r--r--tests/coverage-map/status-quo/partial_eq.rs46
-rw-r--r--tests/coverage-map/status-quo/simple_loop.cov-map28
-rw-r--r--tests/coverage-map/status-quo/simple_loop.rs35
-rw-r--r--tests/coverage-map/status-quo/simple_match.cov-map36
-rw-r--r--tests/coverage-map/status-quo/simple_match.rs43
-rw-r--r--tests/coverage-map/status-quo/sort_groups.cov-map68
-rw-r--r--tests/coverage-map/status-quo/sort_groups.rs23
-rw-r--r--tests/coverage-map/status-quo/test_harness.cov-map24
-rw-r--r--tests/coverage-map/status-quo/test_harness.rs10
-rw-r--r--tests/coverage-map/status-quo/tight_inf_loop.cov-map12
-rw-r--r--tests/coverage-map/status-quo/tight_inf_loop.rs5
-rw-r--r--tests/coverage-map/status-quo/try_error_result.cov-map226
-rw-r--r--tests/coverage-map/status-quo/try_error_result.rs118
-rw-r--r--tests/coverage-map/status-quo/unused.cov-map94
-rw-r--r--tests/coverage-map/status-quo/unused.rs41
-rw-r--r--tests/coverage-map/status-quo/while.cov-map15
-rw-r--r--tests/coverage-map/status-quo/while.rs5
-rw-r--r--tests/coverage-map/status-quo/while_early_ret.cov-map26
-rw-r--r--tests/coverage-map/status-quo/while_early_ret.rs42
-rw-r--r--tests/coverage-map/status-quo/yield.cov-map72
-rw-r--r--tests/coverage-map/status-quo/yield.rs37
-rw-r--r--tests/coverage-map/trivial.cov-map8
-rw-r--r--tests/coverage-map/trivial.rs3
-rw-r--r--tests/debuginfo/pretty-std-collections.rs1
-rw-r--r--tests/debuginfo/regression-bad-location-list-67992.rs31
-rw-r--r--tests/incremental/change_crate_dep_kind.rs1
-rw-r--r--tests/incremental/hashes/function_interfaces.rs2
-rw-r--r--tests/mir-opt/asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir2
-rw-r--r--tests/mir-opt/basic_assignment.main.ElaborateDrops.diff6
-rw-r--r--tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir6
-rw-r--r--tests/mir-opt/bool_compare.opt1.InstSimplify.diff3
-rw-r--r--tests/mir-opt/bool_compare.opt2.InstSimplify.diff3
-rw-r--r--tests/mir-opt/bool_compare.opt3.InstSimplify.diff3
-rw-r--r--tests/mir-opt/bool_compare.opt4.InstSimplify.diff3
-rw-r--r--tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir6
-rw-r--r--tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir6
-rw-r--r--tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir22
-rw-r--r--tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir102
-rw-r--r--tests/mir-opt/building/custom/debuginfo.numbered.built.after.mir11
-rw-r--r--tests/mir-opt/building/custom/debuginfo.pointee.built.after.mir10
-rw-r--r--tests/mir-opt/building/custom/debuginfo.rs71
-rw-r--r--tests/mir-opt/building/custom/debuginfo.structured.built.after.mir10
-rw-r--r--tests/mir-opt/building/custom/debuginfo.variant.built.after.mir10
-rw-r--r--tests/mir-opt/building/custom/debuginfo.variant_deref.built.after.mir11
-rw-r--r--tests/mir-opt/building/enum_cast.droppy.built.after.mir2
-rw-r--r--tests/mir-opt/building/logical_or_in_conditional.rs39
-rw-r--r--tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir186
-rw-r--r--tests/mir-opt/building/logical_or_in_conditional.test_or.built.after.mir87
-rw-r--r--tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir2
-rw-r--r--tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir2
-rw-r--r--tests/mir-opt/building/match_false_edges.main.built.after.mir4
-rw-r--r--tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir6
-rw-r--r--tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir6
-rw-r--r--tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff2
-rw-r--r--tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff12
-rw-r--r--tests/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff6
-rw-r--r--tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff6
-rw-r--r--tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff6
-rw-r--r--tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff6
-rw-r--r--tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff6
-rw-r--r--tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs3
-rw-r--r--tests/mir-opt/const_prop/boxes.rs2
-rw-r--r--tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff4
-rw-r--r--tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff4
-rw-r--r--tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff4
-rw-r--r--tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff4
-rw-r--r--tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff4
-rw-r--r--tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff4
-rw-r--r--tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff8
-rw-r--r--tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff8
-rw-r--r--tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff12
-rw-r--r--tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff12
-rw-r--r--tests/mir-opt/const_prop/large_array_index.rs1
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff8
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff4
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff4
-rw-r--r--tests/mir-opt/const_prop/repeat.rs1
-rw-r--r--tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff4
-rw-r--r--tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff4
-rw-r--r--tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir4
-rw-r--r--tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir4
-rw-r--r--tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff12
-rw-r--r--tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff12
-rw-r--r--tests/mir-opt/coverage_graphviz.bar.InstrumentCoverage.0.dot6
-rw-r--r--tests/mir-opt/coverage_graphviz.main.InstrumentCoverage.0.dot13
-rw-r--r--tests/mir-opt/coverage_graphviz.rs20
-rw-r--r--tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-abort.diff39
-rw-r--r--tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-unwind.diff39
-rw-r--r--tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-abort.diff39
-rw-r--r--tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-unwind.diff39
-rw-r--r--tests/mir-opt/dataflow-const-prop/array_index.rs8
-rw-r--r--tests/mir-opt/dataflow-const-prop/boolean_identities.rs10
-rw-r--r--tests/mir-opt/dataflow-const-prop/boolean_identities.test.DataflowConstProp.diff33
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-abort.diff119
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-unwind.diff123
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-abort.diff119
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-unwind.diff123
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff111
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff115
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff111
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff115
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs17
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.32bit.diff63
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.64bit.diff63
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.32bit.diff (renamed from tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.diff)0
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.64bit.diff82
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.32bit.diff (renamed from tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.diff)0
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.64bit.diff26
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.rs22
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff (renamed from tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.diff)0
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff63
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff126
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff126
-rw-r--r--tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff10
-rw-r--r--tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-abort.diff39
-rw-r--r--tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-unwind.diff39
-rw-r--r--tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-abort.diff39
-rw-r--r--tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-unwind.diff39
-rw-r--r--tests/mir-opt/dataflow-const-prop/large_array_index.rs9
-rw-r--r--tests/mir-opt/dataflow-const-prop/mult_by_zero.rs10
-rw-r--r--tests/mir-opt/dataflow-const-prop/mult_by_zero.test.DataflowConstProp.diff18
-rw-r--r--tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-abort.diff76
-rw-r--r--tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-unwind.diff76
-rw-r--r--tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-abort.diff72
-rw-r--r--tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-unwind.diff72
-rw-r--r--tests/mir-opt/dataflow-const-prop/offset_of.rs49
-rw-r--r--tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-abort.diff43
-rw-r--r--tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-unwind.diff43
-rw-r--r--tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-abort.diff43
-rw-r--r--tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-unwind.diff43
-rw-r--r--tests/mir-opt/dataflow-const-prop/repeat.rs8
-rw-r--r--tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-abort.diff77
-rw-r--r--tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-unwind.diff77
-rw-r--r--tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-abort.diff77
-rw-r--r--tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-unwind.diff77
-rw-r--r--tests/mir-opt/dataflow-const-prop/slice_len.rs12
-rw-r--r--tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff129
-rw-r--r--tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff129
-rw-r--r--tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.diff51
-rw-r--r--tests/mir-opt/dataflow-const-prop/struct.rs11
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.32bit.diff15
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.64bit.diff15
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.32bit.diff15
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.64bit.diff15
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.32bit.diff15
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.64bit.diff15
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.32bit.diff18
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.64bit.diff18
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.rs63
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.32bit.diff22
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.64bit.diff22
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff20
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff20
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.32bit.diff22
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.64bit.diff22
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.32bit.diff24
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.64bit.diff24
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.32bit.diff20
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.64bit.diff20
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.32bit.diff15
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.64bit.diff15
-rw-r--r--tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination.panic-abort.diff15
-rw-r--r--tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination.panic-unwind.diff15
-rw-r--r--tests/mir-opt/dead-store-elimination/call_arg_copy.rs26
-rw-r--r--tests/mir-opt/derefer_inline_test.main.Derefer.panic-abort.diff2
-rw-r--r--tests/mir-opt/derefer_inline_test.main.Derefer.panic-unwind.diff2
-rw-r--r--tests/mir-opt/dont_inline_type_id.call.Inline.diff20
-rw-r--r--tests/mir-opt/dont_inline_type_id.rs15
-rw-r--r--tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff4
-rw-r--r--tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff4
-rw-r--r--tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff4
-rw-r--r--tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff4
-rw-r--r--tests/mir-opt/equal_true.opt.InstSimplify.diff3
-rw-r--r--tests/mir-opt/funky_arms.rs2
-rw-r--r--tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-abort.mir2
-rw-r--r--tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.mir2
-rw-r--r--tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir2
-rw-r--r--tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir6
-rw-r--r--tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir10
-rw-r--r--tests/mir-opt/gvn.arithmetic.GVN.panic-abort.diff342
-rw-r--r--tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff342
-rw-r--r--tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff389
-rw-r--r--tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff389
-rw-r--r--tests/mir-opt/gvn.arithmetic_float.GVN.panic-abort.diff165
-rw-r--r--tests/mir-opt/gvn.arithmetic_float.GVN.panic-unwind.diff165
-rw-r--r--tests/mir-opt/gvn.cast.GVN.panic-abort.diff501
-rw-r--r--tests/mir-opt/gvn.cast.GVN.panic-unwind.diff501
-rw-r--r--tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff191
-rw-r--r--tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff191
-rw-r--r--tests/mir-opt/gvn.multiple_branches.GVN.panic-abort.diff198
-rw-r--r--tests/mir-opt/gvn.multiple_branches.GVN.panic-unwind.diff198
-rw-r--r--tests/mir-opt/gvn.references.GVN.panic-abort.diff105
-rw-r--r--tests/mir-opt/gvn.references.GVN.panic-unwind.diff113
-rw-r--r--tests/mir-opt/gvn.repeated_index.GVN.panic-abort.diff76
-rw-r--r--tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff76
-rw-r--r--tests/mir-opt/gvn.rs253
-rw-r--r--tests/mir-opt/gvn.slices.GVN.panic-abort.diff275
-rw-r--r--tests/mir-opt/gvn.slices.GVN.panic-unwind.diff275
-rw-r--r--tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff883
-rw-r--r--tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff883
-rw-r--r--tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff45
-rw-r--r--tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff45
-rw-r--r--tests/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff3
-rw-r--r--tests/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff6
-rw-r--r--tests/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff6
-rw-r--r--tests/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff12
-rw-r--r--tests/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff6
-rw-r--r--tests/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff6
-rw-r--r--tests/mir-opt/inline/asm_unwind.main.Inline.panic-abort.diff2
-rw-r--r--tests/mir-opt/inline/asm_unwind.main.Inline.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline/cycle.f.Inline.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline/cycle.main.Inline.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline/inline_box_fn.call.Inline.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline/inline_closure.foo.Inline.after.mir6
-rw-r--r--tests/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir6
-rw-r--r--tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir10
-rw-r--r--tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff3
-rw-r--r--tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff3
-rw-r--r--tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff4
-rw-r--r--tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff97
-rw-r--r--tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff70
-rw-r--r--tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir6
-rw-r--r--tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-abort.diff26
-rw-r--r--tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-unwind.diff24
-rw-r--r--tests/mir-opt/inline/unsized_argument.caller.Inline.diff2
-rw-r--r--tests/mir-opt/inline_generically_if_sized.call.Inline.diff24
-rw-r--r--tests/mir-opt/inline_generically_if_sized.rs17
-rw-r--r--tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff8
-rw-r--r--tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff8
-rw-r--r--tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff10
-rw-r--r--tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff10
-rw-r--r--tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff6
-rw-r--r--tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff6
-rw-r--r--tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir4
-rw-r--r--tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir4
-rw-r--r--tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff8
-rw-r--r--tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff8
-rw-r--r--tests/mir-opt/issue_91633.bar.built.after.mir2
-rw-r--r--tests/mir-opt/issue_91633.foo.built.after.mir2
-rw-r--r--tests/mir-opt/issue_99325.main.built.after.32bit.mir (renamed from tests/mir-opt/issue_99325.main.built.after.mir)260
-rw-r--r--tests/mir-opt/issue_99325.main.built.after.64bit.mir276
-rw-r--r--tests/mir-opt/issue_99325.rs2
-rw-r--r--tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff6
-rw-r--r--tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-unwind.diff6
-rw-r--r--tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-abort.diff6
-rw-r--r--tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff6
-rw-r--r--tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-abort.diff1
-rw-r--r--tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-unwind.diff1
-rw-r--r--tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff6
-rw-r--r--tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff6
-rw-r--r--tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff10
-rw-r--r--tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff10
-rw-r--r--tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir2
-rw-r--r--tests/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff24
-rw-r--r--tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir2
-rw-r--r--tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir2
-rw-r--r--tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir2
-rw-r--r--tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir2
-rw-r--r--tests/mir-opt/not_equal_false.opt.InstSimplify.diff3
-rw-r--r--tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir2
-rw-r--r--tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir135
-rw-r--r--tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir30
-rw-r--r--tests/mir-opt/pre-codegen/chained_comparison.rs1
-rw-r--r--tests/mir-opt/pre-codegen/checked_ops.rs1
-rw-r--r--tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir14
-rw-r--r--tests/mir-opt/pre-codegen/intrinsics.rs1
-rw-r--r--tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir2
-rw-r--r--tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir6
-rw-r--r--tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir2
-rw-r--r--tests/mir-opt/pre-codegen/loops.rs1
-rw-r--r--tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir2
-rw-r--r--tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir34
-rw-r--r--tests/mir-opt/pre-codegen/mem_replace.rs2
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff4
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff4
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff4
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff4
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir6
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir8
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir2
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir6
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir6
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.rs1
-rw-r--r--tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir4
-rw-r--r--tests/mir-opt/pre-codegen/simple_option_map.rs1
-rw-r--r--tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir206
-rw-r--r--tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir49
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.rs2
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir3
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir3
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir47
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir47
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir2
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir2
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir6
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir8
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir2
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.rs2
-rw-r--r--tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir22
-rw-r--r--tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir22
-rw-r--r--tests/mir-opt/pre-codegen/spans.rs1
-rw-r--r--tests/mir-opt/pre-codegen/try_identity.rs1
-rw-r--r--tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff8
-rw-r--r--tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff8
-rw-r--r--tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-abort.mir86
-rw-r--r--tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-unwind.mir86
-rw-r--r--tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-abort.mir2
-rw-r--r--tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-unwind.mir2
-rw-r--r--tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir4
-rw-r--r--tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir8
-rw-r--r--tests/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir2
-rw-r--r--tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff3
-rw-r--r--tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff3
-rw-r--r--tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff10
-rw-r--r--tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff5
-rw-r--r--tests/mir-opt/ssa_unreachable_116212.rs14
-rw-r--r--tests/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.mir2
-rw-r--r--tests/pretty/tests-are-sorted.pp2
-rw-r--r--tests/run-coverage-rustdoc/doctest.coverage4
-rw-r--r--tests/run-coverage-rustdoc/doctest.rs4
-rw-r--r--tests/run-coverage/assert.coverage2
-rw-r--r--tests/run-coverage/assert.rs2
-rw-r--r--tests/run-coverage/async2.coverage12
-rw-r--r--tests/run-coverage/async2.rs12
-rw-r--r--tests/run-coverage/auxiliary/inline_always_with_dead_code.rs4
-rw-r--r--tests/run-coverage/auxiliary/macro_name_span_helper.rs10
-rw-r--r--tests/run-coverage/auxiliary/unused_mod_helper.rs1
-rw-r--r--tests/run-coverage/auxiliary/used_crate.rs5
-rw-r--r--tests/run-coverage/auxiliary/used_inline_crate.rs11
-rw-r--r--tests/run-coverage/closure.coverage23
-rw-r--r--tests/run-coverage/closure.rs9
-rw-r--r--tests/run-coverage/closure_bug.coverage53
-rw-r--r--tests/run-coverage/closure_bug.rs44
-rw-r--r--tests/run-coverage/closure_macro.coverage2
-rw-r--r--tests/run-coverage/closure_macro.rs2
-rw-r--r--tests/run-coverage/closure_macro_async.coverage20
-rw-r--r--tests/run-coverage/closure_macro_async.rs20
-rw-r--r--tests/run-coverage/conditions.coverage1
-rw-r--r--tests/run-coverage/conditions.rs1
-rw-r--r--tests/run-coverage/dead_code.coverage2
-rw-r--r--tests/run-coverage/dead_code.rs2
-rw-r--r--tests/run-coverage/drop_trait.coverage2
-rw-r--r--tests/run-coverage/drop_trait.rs2
-rw-r--r--tests/run-coverage/generics.coverage6
-rw-r--r--tests/run-coverage/generics.rs6
-rw-r--r--tests/run-coverage/issue-85461.coverage5
-rw-r--r--tests/run-coverage/issue-85461.rs1
-rw-r--r--tests/run-coverage/issue-93054.coverage14
-rw-r--r--tests/run-coverage/issue-93054.rs14
-rw-r--r--tests/run-coverage/lazy_boolean.coverage2
-rw-r--r--tests/run-coverage/loops_branches.coverage3
-rw-r--r--tests/run-coverage/loops_branches.rs3
-rw-r--r--tests/run-coverage/macro_name_span.coverage39
-rw-r--r--tests/run-coverage/macro_name_span.rs25
-rw-r--r--tests/run-coverage/match_or_pattern.coverage2
-rw-r--r--tests/run-coverage/match_or_pattern.rs2
-rw-r--r--tests/run-coverage/no_cov_crate.coverage16
-rw-r--r--tests/run-coverage/no_cov_crate.rs16
-rw-r--r--tests/run-coverage/overflow.coverage2
-rw-r--r--tests/run-coverage/overflow.rs2
-rw-r--r--tests/run-coverage/try_error_result.coverage14
-rw-r--r--tests/run-coverage/try_error_result.rs14
-rw-r--r--tests/run-coverage/unused.coverage2
-rw-r--r--tests/run-coverage/unused.rs2
-rw-r--r--tests/run-coverage/unused_mod.coverage1
-rw-r--r--tests/run-coverage/uses_crate.coverage5
-rw-r--r--tests/run-coverage/uses_inline_crate.coverage11
-rw-r--r--tests/run-coverage/while_early_ret.coverage2
-rw-r--r--tests/run-coverage/while_early_ret.rs2
-rw-r--r--tests/run-coverage/yield.coverage4
-rw-r--r--tests/run-coverage/yield.rs4
-rw-r--r--tests/run-make-fulldeps/issue-19371/foo.rs1
-rw-r--r--tests/run-make-fulldeps/obtain-borrowck/driver.rs7
-rw-r--r--tests/run-make/compressed-debuginfo/Makefile15
-rw-r--r--tests/run-make/compressed-debuginfo/foo.rs3
-rw-r--r--tests/run-make/emit-path-unhashed/Makefile8
-rw-r--r--tests/run-make/incr-foreign-head-span/Makefile2
-rw-r--r--tests/run-make/issue-88756-default-output/output-default.stdout7
-rw-r--r--tests/run-make/ls-metadata/Makefile4
-rw-r--r--tests/run-make/lto-linkage-used-attr/Makefile9
-rw-r--r--tests/run-make/lto-linkage-used-attr/lib.rs50
-rw-r--r--tests/run-make/lto-linkage-used-attr/main.rs10
-rw-r--r--tests/run-make/macos-deployment-target/Makefile4
-rw-r--r--tests/run-make/metadata-dep-info/Makefile13
-rw-r--r--tests/run-make/metadata-dep-info/dash-separated.rs4
-rw-r--r--tests/run-make/metadata-dep-info/dash-separated_something-extra.normalized.d5
-rw-r--r--tests/run-make/output-filename-overwrites-input/Makefile2
-rw-r--r--tests/run-make/pdb-buildinfo-cl-cmd/Makefile16
-rw-r--r--tests/run-make/pdb-buildinfo-cl-cmd/main.rs2
-rw-r--r--tests/run-make/pdb-buildinfo-cl-cmd/stringlist.txt1
-rw-r--r--tests/run-make/pgo-branch-weights/Makefile1
-rw-r--r--tests/run-make/pgo-gen-lto/Makefile1
-rw-r--r--tests/run-make/pgo-gen/Makefile1
-rw-r--r--tests/run-make/pgo-indirect-call-promotion/Makefile1
-rw-r--r--tests/run-make/pgo-use/Makefile1
-rw-r--r--tests/run-make/pointer-auth-link-with-c/Makefile1
-rw-r--r--tests/run-make/print-cfg/Makefile8
-rw-r--r--tests/run-make/profile/Makefile1
-rw-r--r--tests/run-make/rlib-format-packed-bundled-libs-3/Makefile4
-rw-r--r--tests/run-make/rlib-format-packed-bundled-libs-3/rust_dep.rs2
-rw-r--r--tests/run-make/rustdoc-themes/Makefile3
-rw-r--r--tests/rustdoc-gui/code-color.goml18
-rw-r--r--tests/rustdoc-gui/default-settings.goml2
-rw-r--r--tests/rustdoc-gui/docblock-table.goml16
-rw-r--r--tests/rustdoc-gui/help-page.goml18
-rw-r--r--tests/rustdoc-gui/search-corrections.goml50
-rw-r--r--tests/rustdoc-gui/search-no-result.goml12
-rw-r--r--tests/rustdoc-gui/search-result-color.goml2
-rw-r--r--tests/rustdoc-gui/search-tab.goml86
-rw-r--r--tests/rustdoc-gui/sidebar-source-code.goml2
-rw-r--r--tests/rustdoc-gui/sidebar.goml22
-rw-r--r--tests/rustdoc-gui/src/test_docs/lib.rs12
-rw-r--r--tests/rustdoc-gui/src/theme_css/Cargo.lock7
-rw-r--r--tests/rustdoc-gui/src/theme_css/Cargo.toml7
-rw-r--r--tests/rustdoc-gui/src/theme_css/custom-theme.css99
-rw-r--r--tests/rustdoc-gui/src/theme_css/lib.rs2
-rw-r--r--tests/rustdoc-gui/theme-change.goml33
-rw-r--r--tests/rustdoc-gui/warning-block.goml42
-rw-r--r--tests/rustdoc-js-std/full-path-function.js7
-rw-r--r--tests/rustdoc-js-std/option-type-signatures.js62
-rw-r--r--tests/rustdoc-js-std/vec-type-signatures.js22
-rw-r--r--tests/rustdoc-js/full-path-function.js43
-rw-r--r--tests/rustdoc-js/full-path-function.rs17
-rw-r--r--tests/rustdoc-js/generics-match-ambiguity.js1
-rw-r--r--tests/rustdoc-js/generics-trait.js8
-rw-r--r--tests/rustdoc-js/generics-unbox.js38
-rw-r--r--tests/rustdoc-js/generics-unbox.rs36
-rw-r--r--tests/rustdoc-js/type-parameters.js87
-rw-r--r--tests/rustdoc-js/type-parameters.rs15
-rw-r--r--tests/rustdoc-json/fn_pointer/abi.rs14
-rw-r--r--tests/rustdoc-json/fn_pointer/generics.rs14
-rw-r--r--tests/rustdoc-json/fn_pointer/qualifiers.rs12
-rw-r--r--tests/rustdoc-json/primitives/primitive_type.rs10
-rw-r--r--tests/rustdoc-json/type/dyn.rs64
-rw-r--r--tests/rustdoc-json/type/fn_lifetime.rs38
-rw-r--r--tests/rustdoc-json/type/generic_default.rs42
-rw-r--r--tests/rustdoc-ui/custom_code_classes_in_docs-warning.rs83
-rw-r--r--tests/rustdoc-ui/custom_code_classes_in_docs-warning.stderr97
-rw-r--r--tests/rustdoc-ui/custom_code_classes_in_docs-warning3.rs17
-rw-r--r--tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr33
-rw-r--r--tests/rustdoc-ui/feature-gate-custom_code_classes_in_docs.rs15
-rw-r--r--tests/rustdoc-ui/feature-gate-custom_code_classes_in_docs.stderr14
-rw-r--r--tests/rustdoc-ui/issue-102467.rs15
-rw-r--r--tests/rustdoc-ui/issue-102467.stderr9
-rw-r--r--tests/rustdoc-ui/issues/issue-91713.stdout2
-rw-r--r--tests/rustdoc/anchor-id-trait-method-15169.rs (renamed from tests/rustdoc/issue-15169.rs)4
-rw-r--r--tests/rustdoc/assoc-type-bindings-20646.rs (renamed from tests/rustdoc/issue-20646.rs)2
-rw-r--r--tests/rustdoc/auxiliary/cross_crate_generic_typedef.rs5
-rw-r--r--tests/rustdoc/const-effect-param.rs12
-rw-r--r--tests/rustdoc/const-fn-effects.rs19
-rw-r--r--tests/rustdoc/const-generics/const-generic-defaults.rs2
-rw-r--r--tests/rustdoc/const-generics/const-generics-docs.rs4
-rw-r--r--tests/rustdoc/custom_code_classes.rs28
-rw-r--r--tests/rustdoc/deref-methods-19190-foreign-type.rs (renamed from tests/rustdoc/issue-19190-2.rs)4
-rw-r--r--tests/rustdoc/deref-methods-19190-inline.rs (renamed from tests/rustdoc/issue-19190-3.rs)3
-rw-r--r--tests/rustdoc/deref-methods-19190.rs (renamed from tests/rustdoc/issue-19190.rs)3
-rw-r--r--tests/rustdoc/doc-hidden-method-13698.rs (renamed from tests/rustdoc/issue-13698.rs)3
-rw-r--r--tests/rustdoc/doc-test-attr-18199.rs (renamed from tests/rustdoc/issue-18199.rs)1
-rw-r--r--tests/rustdoc/document-hidden-items-15347.rs (renamed from tests/rustdoc/issue-15347.rs)3
-rw-r--r--tests/rustdoc/highlight-invalid-rust-12834.rs (renamed from tests/rustdoc/issue-12834.rs)2
-rw-r--r--tests/rustdoc/html-no-source.rs30
-rw-r--r--tests/rustdoc/ice-type-error-19181.rs (renamed from tests/rustdoc/issue-19181.rs)1
-rw-r--r--tests/rustdoc/impl-ref-20175.rs (renamed from tests/rustdoc/issue-20175.rs)4
-rw-r--r--tests/rustdoc/infinite-redirection-16265-1.rs (renamed from tests/rustdoc/issue-16265-1.rs)3
-rw-r--r--tests/rustdoc/infinite-redirection-16265-2.rs (renamed from tests/rustdoc/issue-16265-2.rs)3
-rw-r--r--tests/rustdoc/inline-assoc-type-20727-bindings.rs (renamed from tests/rustdoc/issue-20727-2.rs)3
-rw-r--r--tests/rustdoc/inline-assoc-type-20727-bounds-deref.rs (renamed from tests/rustdoc/issue-20727-3.rs)3
-rw-r--r--tests/rustdoc/inline-assoc-type-20727-bounds-index.rs (renamed from tests/rustdoc/issue-20727-4.rs)3
-rw-r--r--tests/rustdoc/inline-assoc-type-20727-bounds.rs (renamed from tests/rustdoc/issue-20727.rs)3
-rw-r--r--tests/rustdoc/inline_cross/async-fn.rs19
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/async-fn.rs18
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/const-fn.rs5
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs6
-rw-r--r--tests/rustdoc/inline_cross/const-fn.rs10
-rw-r--r--tests/rustdoc/inline_cross/impl_trait.rs8
-rw-r--r--tests/rustdoc/issue-105735-overlapping-reexport-2.rs2
-rw-r--r--tests/rustdoc/issue-109449-doc-hidden-reexports.rs6
-rw-r--r--tests/rustdoc/issue-32077-type-alias-impls.rs66
-rw-r--r--tests/rustdoc/issue-88600.rs4
-rw-r--r--tests/rustdoc/macro-ice-16019.rs (renamed from tests/rustdoc/issue-16019.rs)2
-rw-r--r--tests/rustdoc/method-link-foreign-trait-impl-17476.rs (renamed from tests/rustdoc/issue-17476.rs)3
-rw-r--r--tests/rustdoc/no-crate-filter.rs6
-rw-r--r--tests/rustdoc/primitive-raw-pointer-dox-15318-3.rs (renamed from tests/rustdoc/issue-15318-3.rs)2
-rw-r--r--tests/rustdoc/primitive-raw-pointer-link-15318.rs (renamed from tests/rustdoc/issue-15318.rs)2
-rw-r--r--tests/rustdoc/primitive-raw-pointer-link-no-inlined-15318-2.rs (renamed from tests/rustdoc/issue-15318-2.rs)3
-rw-r--r--tests/rustdoc/private-fields-tuple-struct.rs15
-rw-r--r--tests/rustdoc/rfc-2632-const-trait-impl.rs22
-rw-r--r--tests/rustdoc/show-const-contents.rs2
-rw-r--r--tests/rustdoc/sidebar-all-page.rs5
-rw-r--r--tests/rustdoc/titles.rs2
-rw-r--r--tests/rustdoc/typedef-inner-variants-lazy_type_alias.rs34
-rw-r--r--tests/rustdoc/typedef-inner-variants.rs119
-rw-r--r--tests/rustdoc/where.SWhere_Simd_item-decl.html2
-rw-r--r--tests/rustdoc/where.alpha_trait_decl.html2
-rw-r--r--tests/rustdoc/where.rs2
-rw-r--r--tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs2
-rw-r--r--tests/ui-fulldeps/internal-lints/ty_tykind_usage.rs1
-rw-r--r--tests/ui-fulldeps/internal-lints/ty_tykind_usage.stderr32
-rw-r--r--tests/ui-fulldeps/lint-pass-macros.rs2
-rw-r--r--tests/ui-fulldeps/plugin/auxiliary/lint-group-plugin-test.rs3
-rw-r--r--tests/ui-fulldeps/plugin/auxiliary/lint-plugin-test.rs6
-rw-r--r--tests/ui-fulldeps/plugin/auxiliary/lint-tool-test.rs6
-rw-r--r--tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.stderr2
-rw-r--r--tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.stderr10
-rw-r--r--tests/ui-fulldeps/pprust-expr-roundtrip.rs20
-rw-r--r--tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs2
-rw-r--r--tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr2
-rw-r--r--tests/ui-fulldeps/stable-mir/compilation-result.rs78
-rw-r--r--tests/ui-fulldeps/stable-mir/crate-info.rs117
-rw-r--r--tests/ui/abi/compatibility.rs354
-rw-r--r--tests/ui/abi/debug.rs53
-rw-r--r--tests/ui/abi/debug.stderr959
-rw-r--r--tests/ui/abi/explicit_repr_rust.rs12
-rw-r--r--tests/ui/abi/relocation_model_pic.rs3
-rw-r--r--tests/ui/argument-suggestions/issue-100154.stderr6
-rw-r--r--tests/ui/argument-suggestions/two-mismatch-notes.stderr1
-rw-r--r--tests/ui/asm/aarch64/type-check-2.stderr2
-rw-r--r--tests/ui/asm/x86_64/type-check-2.stderr2
-rw-r--r--tests/ui/associated-consts/associated-const-array-len.stderr10
-rw-r--r--tests/ui/associated-consts/defaults-cyclic-fail.rs2
-rw-r--r--tests/ui/associated-consts/defaults-cyclic-fail.stderr14
-rw-r--r--tests/ui/associated-consts/defaults-not-assumed-fail.stderr6
-rw-r--r--tests/ui/associated-consts/double-elided.rs12
-rw-r--r--tests/ui/associated-consts/double-elided.stderr47
-rw-r--r--tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.rs2
-rw-r--r--tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.stderr16
-rw-r--r--tests/ui/associated-consts/issue-105330.stderr10
-rw-r--r--tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr12
-rw-r--r--tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr12
-rw-r--r--tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr12
-rw-r--r--tests/ui/associated-inherent-types/issue-111879-1.stderr4
-rw-r--r--tests/ui/associated-inherent-types/private-in-public.rs21
-rw-r--r--tests/ui/associated-inherent-types/private-in-public.stderr52
-rw-r--r--tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.rs8
-rw-r--r--tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.stderr55
-rw-r--r--tests/ui/associated-type-bounds/overlaping-bound-suggestion.rs12
-rw-r--r--tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr24
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr4
-rw-r--r--tests/ui/associated-type-bounds/suggest-removing-impl.rs14
-rw-r--r--tests/ui/associated-type-bounds/suggest-removing-impl.stderr26
-rw-r--r--tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr6
-rw-r--r--tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr4
-rw-r--r--tests/ui/associated-types/associated-types-no-suitable-supertrait.stderr6
-rw-r--r--tests/ui/associated-types/defaults-specialization.stderr4
-rw-r--r--tests/ui/associated-types/defaults-suitability.stderr5
-rw-r--r--tests/ui/associated-types/issue-23595-2.stderr2
-rw-r--r--tests/ui/associated-types/issue-32323.rs (renamed from tests/ui/issues/issue-32323.rs)0
-rw-r--r--tests/ui/associated-types/issue-32323.stderr (renamed from tests/ui/issues/issue-32323.stderr)0
-rw-r--r--tests/ui/associated-types/issue-44153.stderr4
-rw-r--r--tests/ui/associated-types/issue-59324.stderr6
-rw-r--r--tests/ui/associated-types/issue-64855.stderr6
-rw-r--r--tests/ui/associated-types/issue-85103-layout-debug.rs9
-rw-r--r--tests/ui/associated-types/issue-85103-layout-debug.stderr16
-rw-r--r--tests/ui/associated-types/issue-85103.rs9
-rw-r--r--tests/ui/associated-types/issue-85103.stderr8
-rw-r--r--tests/ui/associated-types/point-at-type-on-obligation-failure-2.stderr15
-rw-r--r--tests/ui/associated-types/substs-ppaux.normal.stderr4
-rw-r--r--tests/ui/associated-types/substs-ppaux.verbose.stderr4
-rw-r--r--tests/ui/async-await/async-await-let-else.drop-tracking.stderr106
-rw-r--r--tests/ui/async-await/async-await-let-else.drop_tracking.stderr106
-rw-r--r--tests/ui/async-await/async-await-let-else.no-drop-tracking.stderr90
-rw-r--r--tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr90
-rw-r--r--tests/ui/async-await/async-await-let-else.rs3
-rw-r--r--tests/ui/async-await/async-await-let-else.stderr (renamed from tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr)26
-rw-r--r--tests/ui/async-await/async-block-control-flow-static-semantics.stderr8
-rw-r--r--tests/ui/async-await/async-error-span.drop_tracking.stderr25
-rw-r--r--tests/ui/async-await/async-error-span.no_drop_tracking.stderr25
-rw-r--r--tests/ui/async-await/async-error-span.rs7
-rw-r--r--tests/ui/async-await/async-error-span.stderr (renamed from tests/ui/async-await/async-error-span.drop_tracking_mir.stderr)4
-rw-r--r--tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr49
-rw-r--r--tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr120
-rw-r--r--tests/ui/async-await/async-fn-nonsend.rs6
-rw-r--r--tests/ui/async-await/async-fn-nonsend.stderr (renamed from tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr)12
-rw-r--r--tests/ui/async-await/async-is-unwindsafe.stderr18
-rw-r--r--tests/ui/async-await/await-sequence.rs1
-rw-r--r--tests/ui/async-await/awaiting-unsized-param.rs13
-rw-r--r--tests/ui/async-await/awaiting-unsized-param.stderr21
-rw-r--r--tests/ui/async-await/const-async-fn-in-main.rs7
-rw-r--r--tests/ui/async-await/const-async-fn-in-main.stderr11
-rw-r--r--tests/ui/async-await/default-struct-update.rs3
-rw-r--r--tests/ui/async-await/drop-and-assign.rs3
-rw-r--r--tests/ui/async-await/drop-track-bad-field-in-fru.rs1
-rw-r--r--tests/ui/async-await/drop-track-bad-field-in-fru.stderr4
-rw-r--r--tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr25
-rw-r--r--tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr25
-rw-r--r--tests/ui/async-await/drop-track-field-assign-nonsend.rs3
-rw-r--r--tests/ui/async-await/drop-track-field-assign-nonsend.stderr (renamed from tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr)6
-rw-r--r--tests/ui/async-await/drop-track-field-assign.rs3
-rw-r--r--tests/ui/async-await/drop-tracking-unresolved-typeck-results.rs3
-rw-r--r--tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr40
-rw-r--r--tests/ui/async-await/feature-self-return-type.rs1
-rw-r--r--tests/ui/async-await/feature-self-return-type.stderr2
-rw-r--r--tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr25
-rw-r--r--tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr25
-rw-r--r--tests/ui/async-await/field-assign-nonsend.rs3
-rw-r--r--tests/ui/async-await/field-assign-nonsend.stderr (renamed from tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr)6
-rw-r--r--tests/ui/async-await/field-assign.rs3
-rw-r--r--tests/ui/async-await/future-contains-err-issue-115188.rs17
-rw-r--r--tests/ui/async-await/future-contains-err-issue-115188.stderr9
-rw-r--r--tests/ui/async-await/future-sizes/async-awaiting-fut.stdout38
-rw-r--r--tests/ui/async-await/future-sizes/large-arg.stdout44
-rw-r--r--tests/ui/async-await/generator-desc.stderr8
-rw-r--r--tests/ui/async-await/generator-not-future.stderr12
-rw-r--r--tests/ui/async-await/in-trait/async-associated-types.rs1
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-extra.rs7
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared.rs2
-rw-r--r--tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs7
-rw-r--r--tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs38
-rw-r--r--tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr10
-rw-r--r--tests/ui/async-await/in-trait/missing-send-bound.stderr5
-rw-r--r--tests/ui/async-await/in-trait/send-on-async-fn-in-trait.fixed20
-rw-r--r--tests/ui/async-await/in-trait/send-on-async-fn-in-trait.rs20
-rw-r--r--tests/ui/async-await/in-trait/send-on-async-fn-in-trait.stderr43
-rw-r--r--tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.rs15
-rw-r--r--tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.stderr23
-rw-r--r--tests/ui/async-await/issue-61949-self-return-type.rs28
-rw-r--r--tests/ui/async-await/issue-61949-self-return-type.stderr26
-rw-r--r--tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr25
-rw-r--r--tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr25
-rw-r--r--tests/ui/async-await/issue-64130-1-sync.rs3
-rw-r--r--tests/ui/async-await/issue-64130-1-sync.stderr (renamed from tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr)6
-rw-r--r--tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr28
-rw-r--r--tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr28
-rw-r--r--tests/ui/async-await/issue-64130-2-send.rs6
-rw-r--r--tests/ui/async-await/issue-64130-2-send.stderr (renamed from tests/ui/async-await/issue-64130-2-send.drop_tracking_mir.stderr)16
-rw-r--r--tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr27
-rw-r--r--tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr27
-rw-r--r--tests/ui/async-await/issue-64130-3-other.rs6
-rw-r--r--tests/ui/async-await/issue-64130-3-other.stderr (renamed from tests/ui/async-await/issue-64130-3-other.drop_tracking_mir.stderr)10
-rw-r--r--tests/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr26
-rw-r--r--tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr26
-rw-r--r--tests/ui/async-await/issue-64130-4-async-move.rs7
-rw-r--r--tests/ui/async-await/issue-64130-non-send-future-diags.stderr2
-rw-r--r--tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr30
-rw-r--r--tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr30
-rw-r--r--tests/ui/async-await/issue-67252-unnamed-future.rs5
-rw-r--r--tests/ui/async-await/issue-67252-unnamed-future.stderr (renamed from tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr)8
-rw-r--r--tests/ui/async-await/issue-68112.drop_tracking.stderr82
-rw-r--r--tests/ui/async-await/issue-68112.no_drop_tracking.stderr82
-rw-r--r--tests/ui/async-await/issue-68112.rs3
-rw-r--r--tests/ui/async-await/issue-68112.stderr (renamed from tests/ui/async-await/issue-68112.drop_tracking_mir.stderr)22
-rw-r--r--tests/ui/async-await/issue-68523-start.rs2
-rw-r--r--tests/ui/async-await/issue-68523-start.stderr4
-rw-r--r--tests/ui/async-await/issue-70818.drop_tracking.stderr18
-rw-r--r--tests/ui/async-await/issue-70818.no_drop_tracking.stderr18
-rw-r--r--tests/ui/async-await/issue-70818.rs3
-rw-r--r--tests/ui/async-await/issue-70818.stderr (renamed from tests/ui/async-await/issue-70818.drop_tracking_mir.stderr)4
-rw-r--r--tests/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr41
-rw-r--r--tests/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr21
-rw-r--r--tests/ui/async-await/issue-70935-complex-spans.rs6
-rw-r--r--tests/ui/async-await/issue-70935-complex-spans.stderr (renamed from tests/ui/async-await/issue-70935-complex-spans.drop_tracking_mir.stderr)10
-rw-r--r--tests/ui/async-await/issue-71137.stderr3
-rw-r--r--tests/ui/async-await/issue-73137.rs3
-rw-r--r--tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking.stderr11
-rw-r--r--tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking_mir.stderr11
-rw-r--r--tests/ui/async-await/issue-73741-type-err-drop-tracking.no_drop_tracking.stderr11
-rw-r--r--tests/ui/async-await/issue-73741-type-err-drop-tracking.rs17
-rw-r--r--tests/ui/async-await/issue-86507.drop_tracking_mir.stderr23
-rw-r--r--tests/ui/async-await/issue-86507.no_drop_tracking.stderr23
-rw-r--r--tests/ui/async-await/issue-86507.rs3
-rw-r--r--tests/ui/async-await/issue-86507.stderr (renamed from tests/ui/async-await/issue-86507.drop_tracking.stderr)6
-rw-r--r--tests/ui/async-await/issue-93197.rs1
-rw-r--r--tests/ui/async-await/issue-93648.rs3
-rw-r--r--tests/ui/async-await/issues/auxiliary/issue_67893.rs7
-rw-r--r--tests/ui/async-await/issues/issue-107280.rs5
-rw-r--r--tests/ui/async-await/issues/issue-107280.stderr67
-rw-r--r--tests/ui/async-await/issues/issue-62009-1.stderr10
-rw-r--r--tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr32
-rw-r--r--tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs7
-rw-r--r--tests/ui/async-await/issues/issue-66695-static-refs.rs4
-rw-r--r--tests/ui/async-await/issues/issue-67611-static-mut-refs.rs6
-rw-r--r--tests/ui/async-await/issues/issue-67893.rs2
-rw-r--r--tests/ui/async-await/issues/issue-67893.stderr28
-rw-r--r--tests/ui/async-await/issues/issue-78600.rs2
-rw-r--r--tests/ui/async-await/issues/issue-78600.stderr14
-rw-r--r--tests/ui/async-await/missed-capture-issue-107414.rs9
-rw-r--r--tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking.stderr21
-rw-r--r--tests/ui/async-await/mutually-recursive-async-impl-trait-type.no_drop_tracking.stderr21
-rw-r--r--tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs4
-rw-r--r--tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr (renamed from tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking_mir.stderr)4
-rw-r--r--tests/ui/async-await/non-trivial-drop.rs3
-rw-r--r--tests/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr35
-rw-r--r--tests/ui/async-await/partial-drop-partial-reinit.rs3
-rw-r--r--tests/ui/async-await/partial-drop-partial-reinit.stderr (renamed from tests/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr)8
-rw-r--r--tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking.stderr12
-rw-r--r--tests/ui/async-await/recursive-async-impl-trait-type.no_drop_tracking.stderr12
-rw-r--r--tests/ui/async-await/recursive-async-impl-trait-type.rs3
-rw-r--r--tests/ui/async-await/recursive-async-impl-trait-type.stderr (renamed from tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking_mir.stderr)2
-rw-r--r--tests/ui/async-await/return-type-notation/issue-110963-early.current.stderr25
-rw-r--r--tests/ui/async-await/return-type-notation/issue-110963-early.next.stderr25
-rw-r--r--tests/ui/async-await/return-type-notation/issue-110963-early.stderr25
-rw-r--r--tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr35
-rw-r--r--tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr11
-rw-r--r--tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs24
-rw-r--r--tests/ui/async-await/unresolved_type_param.drop_tracking.stderr39
-rw-r--r--tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr63
-rw-r--r--tests/ui/async-await/unresolved_type_param.rs26
-rw-r--r--tests/ui/async-await/unresolved_type_param.stderr (renamed from tests/ui/async-await/unresolved_type_param.drop_tracking_mir.stderr)2
-rw-r--r--tests/ui/async-await/unsized-across-await.rs16
-rw-r--r--tests/ui/async-await/unsized-across-await.stderr21
-rw-r--r--tests/ui/attributes/issue-115264-expr-field.rs17
-rw-r--r--tests/ui/attributes/issue-115264-pat-field.rs19
-rw-r--r--tests/ui/backtrace.rs19
-rw-r--r--tests/ui/binding/match-beginning-vert.rs4
-rw-r--r--tests/ui/block-result/issue-20862.stderr2
-rw-r--r--tests/ui/borrowck/async-reference-generality.rs3
-rw-r--r--tests/ui/borrowck/async-reference-generality.stderr27
-rw-r--r--tests/ui/borrowck/erase-error-in-mir-drop-tracking.rs23
-rw-r--r--tests/ui/borrowck/erase-error-in-mir-drop-tracking.stderr24
-rw-r--r--tests/ui/borrowck/issue-114374-invalid-help-fmt-args.rs16
-rw-r--r--tests/ui/borrowck/issue-114374-invalid-help-fmt-args.stderr33
-rw-r--r--tests/ui/borrowck/issue-115259-suggest-iter-mut.fixed20
-rw-r--r--tests/ui/borrowck/issue-115259-suggest-iter-mut.rs20
-rw-r--r--tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr16
-rw-r--r--tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr2
-rw-r--r--tests/ui/borrowck/issue-62387-suggest-iter-mut-2.fixed36
-rw-r--r--tests/ui/borrowck/issue-62387-suggest-iter-mut-2.rs36
-rw-r--r--tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr16
-rw-r--r--tests/ui/borrowck/issue-62387-suggest-iter-mut.fixed30
-rw-r--r--tests/ui/borrowck/issue-62387-suggest-iter-mut.rs30
-rw-r--r--tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr29
-rw-r--r--tests/ui/borrowck/issue-81899.stderr4
-rw-r--r--tests/ui/borrowck/issue-88434-minimal-example.stderr4
-rw-r--r--tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr4
-rw-r--r--tests/ui/borrowck/issue-92157.rs2
-rw-r--r--tests/ui/borrowck/issue-92157.stderr9
-rw-r--r--tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr2
-rw-r--r--tests/ui/borrowck/suggest-mut-iterator.fixed30
-rw-r--r--tests/ui/borrowck/suggest-mut-iterator.rs30
-rw-r--r--tests/ui/borrowck/suggest-mut-iterator.stderr16
-rw-r--r--tests/ui/c-variadic/variadic-ffi-1.stderr2
-rw-r--r--tests/ui/c-variadic/variadic-ffi-2.rs5
-rw-r--r--tests/ui/c-variadic/variadic-ffi-2.stderr2
-rw-r--r--tests/ui/cast/cast-as-bool.rs44
-rw-r--r--tests/ui/cast/cast-as-bool.stderr80
-rw-r--r--tests/ui/cast/cast-rfc0401-2.rs2
-rw-r--r--tests/ui/cast/cast-rfc0401-2.stderr9
-rw-r--r--tests/ui/cast/unsized-struct-cast.rs6
-rw-r--r--tests/ui/cast/unsized-struct-cast.stderr9
-rw-r--r--tests/ui/check-cfg/values-target-json.stderr2
-rw-r--r--tests/ui/check-cfg/well-known-values.stderr2
-rw-r--r--tests/ui/closure_context/issue-26046-fn-mut.stderr2
-rw-r--r--tests/ui/closure_context/issue-26046-fn-once.stderr2
-rw-r--r--tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2018.stderr33
-rw-r--r--tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2021.stderr33
-rw-r--r--tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.rs37
-rw-r--r--tests/ui/closures/2229_closure_analysis/match/if-let-guards.rs55
-rw-r--r--tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr3
-rw-r--r--tests/ui/closures/2229_closure_analysis/repr_packed.rs10
-rw-r--r--tests/ui/closures/2229_closure_analysis/repr_packed.stderr19
-rw-r--r--tests/ui/closures/capture-unsized-by-move.rs10
-rw-r--r--tests/ui/closures/capture-unsized-by-move.stderr14
-rw-r--r--tests/ui/closures/capture-unsized-by-ref.rs10
-rw-r--r--tests/ui/closures/closure-no-fn-1.stderr2
-rw-r--r--tests/ui/closures/closure-no-fn-2.stderr2
-rw-r--r--tests/ui/closures/closure-no-fn-3.stderr2
-rw-r--r--tests/ui/closures/closure-no-fn-4.stderr2
-rw-r--r--tests/ui/closures/closure-no-fn-5.stderr2
-rw-r--r--tests/ui/closures/closure-reform-bad.stderr2
-rw-r--r--tests/ui/closures/closure_cap_coerce_many_fail.stderr20
-rw-r--r--tests/ui/closures/issue-112547.rs15
-rw-r--r--tests/ui/closures/issue-112547.stderr23
-rw-r--r--tests/ui/closures/issue-11873.rs (renamed from tests/ui/issues/issue-11873.rs)0
-rw-r--r--tests/ui/closures/issue-11873.stderr (renamed from tests/ui/issues/issue-11873.stderr)0
-rw-r--r--tests/ui/closures/issue-25439.rs (renamed from tests/ui/issues/issue-25439.rs)0
-rw-r--r--tests/ui/closures/issue-25439.stderr (renamed from tests/ui/issues/issue-25439.stderr)0
-rw-r--r--tests/ui/closures/issue-90871.stderr2
-rw-r--r--tests/ui/closures/print/closure-print-generic-1.stderr2
-rw-r--r--tests/ui/closures/print/closure-print-generic-2.stderr2
-rw-r--r--tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr2
-rw-r--r--tests/ui/closures/print/closure-print-generic-verbose-1.stderr2
-rw-r--r--tests/ui/closures/print/closure-print-generic-verbose-2.stderr2
-rw-r--r--tests/ui/closures/print/closure-print-verbose.stderr2
-rw-r--r--tests/ui/codegen/issue-79865-llvm-miscompile.rs38
-rw-r--r--tests/ui/codegen/subtyping-enforces-type-equality.stderr1
-rw-r--r--tests/ui/coercion/coerce-expect-unsized-ascribed.stderr12
-rw-r--r--tests/ui/coherence/coherence-overlap-downstream-inherent.next.stderr (renamed from tests/ui/coherence/coherence-overlap-downstream-inherent.stderr)4
-rw-r--r--tests/ui/coherence/coherence-overlap-downstream-inherent.old.stderr23
-rw-r--r--tests/ui/coherence/coherence-overlap-downstream-inherent.rs3
-rw-r--r--tests/ui/coherence/coherence-overlap-downstream.next.stderr (renamed from tests/ui/coherence/coherence-overlap-downstream.stderr)4
-rw-r--r--tests/ui/coherence/coherence-overlap-downstream.old.stderr21
-rw-r--r--tests/ui/coherence/coherence-overlap-downstream.rs3
-rw-r--r--tests/ui/coherence/coherence-overlap-issue-23516-inherent.next.stderr (renamed from tests/ui/coherence/coherence-overlap-issue-23516-inherent.stderr)2
-rw-r--r--tests/ui/coherence/coherence-overlap-issue-23516-inherent.old.stderr14
-rw-r--r--tests/ui/coherence/coherence-overlap-issue-23516-inherent.rs3
-rw-r--r--tests/ui/coherence/coherence-overlap-issue-23516.next.stderr (renamed from tests/ui/coherence/coherence-overlap-issue-23516.stderr)2
-rw-r--r--tests/ui/coherence/coherence-overlap-issue-23516.old.stderr13
-rw-r--r--tests/ui/coherence/coherence-overlap-issue-23516.rs3
-rw-r--r--tests/ui/coherence/coherence-unsafe-trait-object-impl.stderr5
-rw-r--r--tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr (renamed from tests/ui/coherence/inter-crate-ambiguity-causes-notes.stderr)2
-rw-r--r--tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr14
-rw-r--r--tests/ui/coherence/inter-crate-ambiguity-causes-notes.rs3
-rw-r--r--tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr4
-rw-r--r--tests/ui/confuse-field-and-method/issue-33784.stderr4
-rw-r--r--tests/ui/const-generics/adt_const_params/const_param_ty_bad.rs2
-rw-r--r--tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr4
-rw-r--r--tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs2
-rw-r--r--tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr35
-rw-r--r--tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.rs44
-rw-r--r--tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.stderr80
-rw-r--r--tests/ui/const-generics/const-param-elided-lifetime.min.stderr10
-rw-r--r--tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr4
-rw-r--r--tests/ui/const-generics/dont-evaluate-array-len-on-err-1.stderr10
-rw-r--r--tests/ui/const-generics/early/const-param-from-outer-fn.rs2
-rw-r--r--tests/ui/const-generics/early/const-param-from-outer-fn.stderr8
-rw-r--r--tests/ui/const-generics/exhaustive-value.stderr4
-rw-r--r--tests/ui/const-generics/float-generic.simple.stderr1
-rw-r--r--tests/ui/const-generics/fn-const-param-call.min.stderr4
-rw-r--r--tests/ui/const-generics/fn-const-param-infer.min.stderr2
-rw-r--r--tests/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.min.stderr2
-rw-r--r--tests/ui/const-generics/generic_const_exprs/eval-privacy.rs7
-rw-r--r--tests/ui/const-generics/generic_const_exprs/eval-privacy.stderr21
-rw-r--r--tests/ui/const-generics/generic_const_exprs/issue-85848.stderr6
-rw-r--r--tests/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-100313.stderr1
-rw-r--r--tests/ui/const-generics/issues/issue-56445-1.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-62878.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-63322-forbid-dyn.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-68615-adt.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-68615-array.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-71169.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-71381.min.stderr4
-rw-r--r--tests/ui/const-generics/issues/issue-71382.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-71611.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-72352.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-73491.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-73727-static-reference-array-const-param.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-74101.min.stderr4
-rw-r--r--tests/ui/const-generics/issues/issue-74255.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-74950.min.stderr10
-rw-r--r--tests/ui/const-generics/issues/issue-75047.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-86530.stderr5
-rw-r--r--tests/ui/const-generics/late-bound-vars/in_closure.rs25
-rw-r--r--tests/ui/const-generics/late-bound-vars/in_closure.stderr30
-rw-r--r--tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.rs13
-rw-r--r--tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.stderr8
-rw-r--r--tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.rs15
-rw-r--r--tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.stderr10
-rw-r--r--tests/ui/const-generics/late-bound-vars/simple.rs27
-rw-r--r--tests/ui/const-generics/late-bound-vars/simple.stderr29
-rw-r--r--tests/ui/const-generics/lifetime-in-const-param.stderr2
-rw-r--r--tests/ui/const-generics/min_const_generics/complex-types.stderr13
-rw-r--r--tests/ui/const-generics/nested-type.min.stderr2
-rw-r--r--tests/ui/const-generics/projection-as-arg-const.stderr1
-rw-r--r--tests/ui/const-generics/raw-ptr-const-param-deref.min.stderr4
-rw-r--r--tests/ui/const-generics/raw-ptr-const-param.min.stderr2
-rw-r--r--tests/ui/const-generics/slice-const-param-mismatch.min.stderr4
-rw-r--r--tests/ui/const-generics/std/const-generics-range.min.stderr12
-rw-r--r--tests/ui/const-generics/transmute-const-param-static-reference.min.stderr2
-rw-r--r--tests/ui/const-generics/type-dependent/issue-71348.min.stderr4
-rw-r--r--tests/ui/const-generics/type-dependent/issue-71382.stderr2
-rw-r--r--tests/ui/const_prop/dont-propagate-generic-instance-2.rs26
-rw-r--r--tests/ui/const_prop/dont-propagate-generic-instance.rs24
-rw-r--r--tests/ui/consts/assert-type-intrinsics.stderr6
-rw-r--r--tests/ui/consts/assoc-const-elided-lifetime.rs19
-rw-r--r--tests/ui/consts/assoc-const-elided-lifetime.stderr33
-rw-r--r--tests/ui/consts/const-err-late.stderr6
-rw-r--r--tests/ui/consts/const-err-multi.stderr6
-rw-r--r--tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.rs5
-rw-r--r--tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.stderr11
-rw-r--r--tests/ui/consts/const-eval/erroneous-const.stderr2
-rw-r--r--tests/ui/consts/const-eval/erroneous-const2.stderr2
-rw-r--r--tests/ui/consts/const-eval/issue-44578.stderr6
-rw-r--r--tests/ui/consts/const-eval/issue-50814-2.stderr2
-rw-r--r--tests/ui/consts/const-eval/issue-50814.stderr2
-rw-r--r--tests/ui/consts/const-eval/panic-assoc-never-type.rs2
-rw-r--r--tests/ui/consts/const-eval/panic-assoc-never-type.stderr4
-rw-r--r--tests/ui/consts/const-eval/raw-bytes.32bit.stderr6
-rw-r--r--tests/ui/consts/const-eval/raw-bytes.64bit.stderr6
-rw-r--r--tests/ui/consts/const-eval/ub-int-array.64bit.stderr36
-rw-r--r--tests/ui/consts/const-eval/ub-int-array.rs8
-rw-r--r--tests/ui/consts/const-eval/ub-int-array.stderr (renamed from tests/ui/consts/const-eval/ub-int-array.32bit.stderr)8
-rw-r--r--tests/ui/consts/const-eval/ub-ref-ptr.stderr4
-rw-r--r--tests/ui/consts/const-eval/ub-uninhabit.rs16
-rw-r--r--tests/ui/consts/const-eval/ub-uninhabit.stderr14
-rw-r--r--tests/ui/consts/const-eval/ub-wide-ptr.stderr6
-rw-r--r--tests/ui/consts/const-eval/union-const-eval-field.stderr4
-rw-r--r--tests/ui/consts/const-float-bits-reject-conv.stderr16
-rw-r--r--tests/ui/consts/const-len-underflow-separate-spans.next.stderr2
-rw-r--r--tests/ui/consts/const-len-underflow-separate-spans.old.stderr2
-rw-r--r--tests/ui/consts/const_in_pattern/issue-65466.rs3
-rw-r--r--tests/ui/consts/const_in_pattern/issue-65466.stderr23
-rw-r--r--tests/ui/consts/effect_param.rs11
-rw-r--r--tests/ui/consts/effect_param.stderr19
-rw-r--r--tests/ui/consts/escaping-bound-var.rs13
-rw-r--r--tests/ui/consts/escaping-bound-var.stderr20
-rw-r--r--tests/ui/consts/fn_trait_refs.stderr62
-rw-r--r--tests/ui/consts/invalid-union.32bit.stderr4
-rw-r--r--tests/ui/consts/invalid-union.64bit.stderr4
-rw-r--r--tests/ui/consts/issue-105536-const-val-roundtrip-ptr-eq.rs31
-rw-r--r--tests/ui/consts/issue-36163.stderr14
-rw-r--r--tests/ui/consts/miri_unleashed/assoc_const.stderr4
-rw-r--r--tests/ui/consts/miri_unleashed/assoc_const_2.stderr4
-rw-r--r--tests/ui/consts/missing-larger-array-impl.stderr4
-rw-r--r--tests/ui/consts/std/alloc.32bit.stderr4
-rw-r--r--tests/ui/consts/std/alloc.64bit.stderr4
-rw-r--r--tests/ui/consts/std/alloc.rs1
-rw-r--r--tests/ui/consts/uninhabited-const-issue-61744.stderr4
-rw-r--r--tests/ui/consts/unstable-const-fn-in-libcore.rs8
-rw-r--r--tests/ui/consts/unstable-const-fn-in-libcore.stderr34
-rw-r--r--tests/ui/cross/cross-fn-cache-hole.stderr5
-rw-r--r--tests/ui/deprecation/issue-84637-deprecated-associated-function.fixed2
-rw-r--r--tests/ui/deprecation/issue-84637-deprecated-associated-function.rs2
-rw-r--r--tests/ui/deprecation/issue-84637-deprecated-associated-function.stderr13
-rw-r--r--tests/ui/derive-uninhabited-enum-38885.stderr1
-rw-r--r--tests/ui/deriving/deriving-all-codegen.stdout28
-rw-r--r--tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs4
-rw-r--r--tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr6
-rw-r--r--tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr2
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs37
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr110
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.rs7
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.stderr12
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.rs11
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.stderr24
-rw-r--r--tests/ui/did_you_mean/bad-assoc-expr.stderr62
-rw-r--r--tests/ui/did_you_mean/bad-assoc-pat.stderr41
-rw-r--r--tests/ui/did_you_mean/bad-assoc-ty.stderr62
-rw-r--r--tests/ui/drop-bounds/drop-bounds-impl-drop.rs10
-rw-r--r--tests/ui/drop/dynamic-drop.rs18
-rw-r--r--tests/ui/dropck/coroutine-liveness-1.rs18
-rw-r--r--tests/ui/dropck/coroutine-liveness-2.rs23
-rw-r--r--tests/ui/dst/dst-bad-coerce1.stderr10
-rw-r--r--tests/ui/dyn-star/error.stderr6
-rw-r--r--tests/ui/entry-point/auxiliary/bad_main_functions.rs2
-rw-r--r--tests/ui/entry-point/imported_main_from_extern_crate_wrong_type.rs6
-rw-r--r--tests/ui/entry-point/imported_main_from_extern_crate_wrong_type.stderr12
-rw-r--r--tests/ui/error-codes/E0040.stderr10
-rw-r--r--tests/ui/error-codes/E0054.stderr9
-rw-r--r--tests/ui/error-codes/E0094.rs2
-rw-r--r--tests/ui/error-codes/E0132.stderr4
-rw-r--r--tests/ui/error-codes/E0220.stderr2
-rw-r--r--tests/ui/error-codes/E0277.stderr5
-rw-r--r--tests/ui/error-codes/E0308.stderr8
-rw-r--r--tests/ui/error-codes/E0374.stderr4
-rw-r--r--tests/ui/error-codes/E0377.stderr4
-rw-r--r--tests/ui/error-codes/E0401.stderr22
-rw-r--r--tests/ui/error-codes/E0445.rs23
-rw-r--r--tests/ui/error-codes/E0445.stderr71
-rw-r--r--tests/ui/error-codes/E0446.rs15
-rw-r--r--tests/ui/error-codes/E0446.stderr23
-rw-r--r--tests/ui/error-codes/E0602.rs2
-rw-r--r--tests/ui/error-codes/E0602.stderr11
-rw-r--r--tests/ui/error-codes/E0609-private-method.rs16
-rw-r--r--tests/ui/error-codes/E0609-private-method.stderr9
-rw-r--r--tests/ui/error-codes/E0647.stderr4
-rw-r--r--tests/ui/error-codes/E0767.stderr2
-rw-r--r--tests/ui/error-festival.stderr9
-rw-r--r--tests/ui/explicit/explicit-call-to-dtor.stderr10
-rw-r--r--tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr10
-rw-r--r--tests/ui/expr/if/bad-if-let-suggestion.rs3
-rw-r--r--tests/ui/expr/if/bad-if-let-suggestion.stderr23
-rw-r--r--tests/ui/extern-flag/invalid-crate-name-dashed.rs10
-rw-r--r--tests/ui/extern-flag/invalid-crate-name-dashed.stderr4
-rw-r--r--tests/ui/extern-flag/invalid-crate-name-non-ascii.rs4
-rw-r--r--tests/ui/extern-flag/invalid-crate-name-non-ascii.stderr2
-rw-r--r--tests/ui/extern-flag/invalid-crate-name.rs4
-rw-r--r--tests/ui/extern-flag/invalid-crate-name.stderr2
-rw-r--r--tests/ui/extern/extern-main-fn.stderr4
-rw-r--r--tests/ui/extern/extern-with-type-bounds.rs2
-rw-r--r--tests/ui/feature-gates/feature-gate-adt_const_params.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-coverage-attribute.rs14
-rw-r--r--tests/ui/feature-gates/feature-gate-coverage-attribute.stderr21
-rw-r--r--tests/ui/feature-gates/feature-gate-no_coverage.rs13
-rw-r--r--tests/ui/feature-gates/feature-gate-no_coverage.stderr12
-rw-r--r--tests/ui/feature-gates/feature-gate-proc_macro_byte_character.rs10
-rw-r--r--tests/ui/feature-gates/feature-gate-proc_macro_byte_character.stderr12
-rw-r--r--tests/ui/feature-gates/feature-gate-type_privacy_lints.rs6
-rw-r--r--tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr70
-rw-r--r--tests/ui/feature-gates/feature-gate-unnamed_fields.rs26
-rw-r--r--tests/ui/feature-gates/feature-gate-unnamed_fields.stderr84
-rw-r--r--tests/ui/feature-gates/print-with-path.cfg.stderr2
-rw-r--r--tests/ui/feature-gates/print-with-path.rs7
-rw-r--r--tests/ui/feature-gates/print-with-path.target-cpus.stderr2
-rw-r--r--tests/ui/feature-gates/print-with-path.target-features.stderr2
-rw-r--r--tests/ui/fmt/raw-idents.rs17
-rw-r--r--tests/ui/fmt/raw-idents.stderr44
-rw-r--r--tests/ui/fn/bad-main.stderr4
-rw-r--r--tests/ui/fn/fn-pointer-mismatch.stderr1
-rw-r--r--tests/ui/fn/keyword-order.stderr2
-rw-r--r--tests/ui/fn/signature-error-reporting-under-verbose.rs1
-rw-r--r--tests/ui/fn/signature-error-reporting-under-verbose.stderr1
-rw-r--r--tests/ui/foreign/foreign-fn-linkname.rs3
-rw-r--r--tests/ui/function-pointer/unsized-ret.stderr12
-rw-r--r--tests/ui/functions-closures/fn-help-with-err.stderr4
-rw-r--r--tests/ui/generator/addassign-yield.rs3
-rw-r--r--tests/ui/generator/auto-trait-regions.drop_tracking.stderr55
-rw-r--r--tests/ui/generator/auto-trait-regions.no_drop_tracking.stderr55
-rw-r--r--tests/ui/generator/auto-trait-regions.rs3
-rw-r--r--tests/ui/generator/auto-trait-regions.stderr (renamed from tests/ui/generator/auto-trait-regions.drop_tracking_mir.stderr)8
-rw-r--r--tests/ui/generator/borrowing.drop_tracking.stderr31
-rw-r--r--tests/ui/generator/borrowing.drop_tracking_mir.stderr39
-rw-r--r--tests/ui/generator/borrowing.rs4
-rw-r--r--tests/ui/generator/borrowing.stderr (renamed from tests/ui/generator/borrowing.no_drop_tracking.stderr)4
-rw-r--r--tests/ui/generator/clone-impl-async.stderr24
-rw-r--r--tests/ui/generator/clone-impl-static.stderr8
-rw-r--r--tests/ui/generator/clone-impl.stderr54
-rw-r--r--tests/ui/generator/derived-drop-parent-expr.rs1
-rw-r--r--tests/ui/generator/drop-control-flow.rs1
-rw-r--r--tests/ui/generator/drop-track-addassign-yield.rs1
-rw-r--r--tests/ui/generator/drop-tracking-error-body.rs18
-rw-r--r--tests/ui/generator/drop-tracking-error-body.stderr17
-rw-r--r--tests/ui/generator/drop-tracking-parent-expression.drop_tracking.stderr128
-rw-r--r--tests/ui/generator/drop-tracking-parent-expression.no_drop_tracking.stderr334
-rw-r--r--tests/ui/generator/drop-tracking-parent-expression.rs11
-rw-r--r--tests/ui/generator/drop-tracking-parent-expression.stderr (renamed from tests/ui/generator/drop-tracking-parent-expression.drop_tracking_mir.stderr)24
-rw-r--r--tests/ui/generator/drop-tracking-yielding-in-match-guards.rs3
-rw-r--r--tests/ui/generator/drop-yield-twice.stderr17
-rw-r--r--tests/ui/generator/generator-yielding-or-returning-itself.stderr4
-rw-r--r--tests/ui/generator/issue-102645.rs2
-rw-r--r--tests/ui/generator/issue-102645.stderr2
-rw-r--r--tests/ui/generator/issue-105084.rs12
-rw-r--r--tests/ui/generator/issue-105084.stderr (renamed from tests/ui/generator/issue-105084.drop_tracking_mir.stderr)18
-rw-r--r--tests/ui/generator/issue-110929-generator-conflict-error-ice.rs3
-rw-r--r--tests/ui/generator/issue-110929-generator-conflict-error-ice.stderr18
-rw-r--r--tests/ui/generator/issue-57017.no_drop_tracking.stderr248
-rw-r--r--tests/ui/generator/issue-57017.rs13
-rw-r--r--tests/ui/generator/issue-57478.no_drop_tracking.stderr31
-rw-r--r--tests/ui/generator/issue-57478.rs7
-rw-r--r--tests/ui/generator/issue-68112.drop_tracking.stderr66
-rw-r--r--tests/ui/generator/issue-68112.no_drop_tracking.stderr66
-rw-r--r--tests/ui/generator/issue-68112.rs6
-rw-r--r--tests/ui/generator/issue-68112.stderr (renamed from tests/ui/generator/issue-68112.drop_tracking_mir.stderr)18
-rw-r--r--tests/ui/generator/issue-93161.rs3
-rw-r--r--tests/ui/generator/layout-error.rs1
-rw-r--r--tests/ui/generator/layout-error.stderr20
-rw-r--r--tests/ui/generator/not-send-sync.drop_tracking.stderr60
-rw-r--r--tests/ui/generator/not-send-sync.no_drop_tracking.stderr60
-rw-r--r--tests/ui/generator/not-send-sync.rs3
-rw-r--r--tests/ui/generator/not-send-sync.stderr (renamed from tests/ui/generator/not-send-sync.drop_tracking_mir.stderr)16
-rw-r--r--tests/ui/generator/parent-expression.drop_tracking.stderr128
-rw-r--r--tests/ui/generator/parent-expression.no_drop_tracking.stderr334
-rw-r--r--tests/ui/generator/parent-expression.rs9
-rw-r--r--tests/ui/generator/parent-expression.stderr (renamed from tests/ui/generator/parent-expression.drop_tracking_mir.stderr)24
-rw-r--r--tests/ui/generator/partial-drop.drop_tracking.stderr61
-rw-r--r--tests/ui/generator/partial-drop.no_drop_tracking.stderr61
-rw-r--r--tests/ui/generator/partial-drop.rs15
-rw-r--r--tests/ui/generator/print/generator-print-verbose-1.drop_tracking.stderr64
-rw-r--r--tests/ui/generator/print/generator-print-verbose-1.no_drop_tracking.stderr64
-rw-r--r--tests/ui/generator/print/generator-print-verbose-1.rs3
-rw-r--r--tests/ui/generator/print/generator-print-verbose-1.stderr (renamed from tests/ui/generator/print/generator-print-verbose-1.drop_tracking_mir.stderr)18
-rw-r--r--tests/ui/generator/print/generator-print-verbose-2.drop_tracking.stderr60
-rw-r--r--tests/ui/generator/print/generator-print-verbose-2.no_drop_tracking.stderr60
-rw-r--r--tests/ui/generator/print/generator-print-verbose-2.rs3
-rw-r--r--tests/ui/generator/print/generator-print-verbose-2.stderr (renamed from tests/ui/generator/print/generator-print-verbose-2.drop_tracking_mir.stderr)16
-rw-r--r--tests/ui/generator/print/generator-print-verbose-3.stderr2
-rw-r--r--tests/ui/generator/ref-upvar-not-send.stderr2
-rw-r--r--tests/ui/generator/retain-resume-ref.drop_tracking.stderr13
-rw-r--r--tests/ui/generator/retain-resume-ref.drop_tracking_mir.stderr14
-rw-r--r--tests/ui/generator/retain-resume-ref.rs4
-rw-r--r--tests/ui/generator/retain-resume-ref.stderr (renamed from tests/ui/generator/retain-resume-ref.no_drop_tracking.stderr)2
-rw-r--r--tests/ui/generator/static-mut-reference-across-yield.rs4
-rw-r--r--tests/ui/generator/static-not-unpin.current.stderr4
-rw-r--r--tests/ui/generator/static-not-unpin.next.stderr4
-rw-r--r--tests/ui/generator/type-mismatch-signature-deduction.stderr2
-rw-r--r--tests/ui/generator/unresolved-ct-var-drop-tracking.rs15
-rw-r--r--tests/ui/generator/unresolved-ct-var-drop-tracking.stderr78
-rw-r--r--tests/ui/generator/unresolved-ct-var.rs5
-rw-r--r--tests/ui/generator/unresolved-ct-var.stderr65
-rw-r--r--tests/ui/generator/unsized-capture-across-yield.rs22
-rw-r--r--tests/ui/generator/unsized-capture-across-yield.stderr23
-rw-r--r--tests/ui/generator/unsized-local-across-yield.rs21
-rw-r--r--tests/ui/generator/unsized-local-across-yield.stderr21
-rw-r--r--tests/ui/generator/witness-ignore-fake-reads.rs34
-rw-r--r--tests/ui/generic-associated-types/bugs/issue-100013.stderr30
-rw-r--r--tests/ui/generic-associated-types/bugs/issue-88460.stderr8
-rw-r--r--tests/ui/generic-associated-types/issue-101020.stderr5
-rw-r--r--tests/ui/generic-associated-types/issue-90014-tait.stderr2
-rw-r--r--tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.rs10
-rw-r--r--tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.stderr15
-rw-r--r--tests/ui/generic-associated-types/own-bound-span.stderr4
-rw-r--r--tests/ui/generic-const-items/elided-lifetimes.stderr2
-rw-r--r--tests/ui/generic-const-items/unsatisfied-bounds.stderr4
-rw-r--r--tests/ui/generics/issue-83556.rs4
-rw-r--r--tests/ui/generics/issue-83556.stderr8
-rw-r--r--tests/ui/generics/issue-94432-garbage-ice.rs2
-rw-r--r--tests/ui/generics/issue-98432.rs2
-rw-r--r--tests/ui/generics/issue-98432.stderr8
-rw-r--r--tests/ui/higher-ranked/trait-bounds/future.classic.stderr2
-rw-r--r--tests/ui/higher-ranked/trait-bounds/issue-30786.stderr18
-rw-r--r--tests/ui/higher-ranked/trait-bounds/issue-59311.stderr2
-rw-r--r--tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.stderr8
-rw-r--r--tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr8
-rw-r--r--tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr15
-rw-r--r--tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-90950.stderr8
-rw-r--r--tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr5
-rw-r--r--tests/ui/impl-trait/auto-trait-leak.rs1
-rw-r--r--tests/ui/impl-trait/auto-trait-leak.stderr82
-rw-r--r--tests/ui/impl-trait/bound-normalization-fail.rs3
-rw-r--r--tests/ui/impl-trait/bound-normalization-fail.stderr16
-rw-r--r--tests/ui/impl-trait/capture-lifetime-not-in-hir.rs21
-rw-r--r--tests/ui/impl-trait/capture-lifetime-not-in-hir.stderr14
-rw-r--r--tests/ui/impl-trait/coherence-treats-tait-ambig.rs3
-rw-r--r--tests/ui/impl-trait/coherence-treats-tait-ambig.stderr (renamed from tests/ui/impl-trait/coherence-treats-tait-ambig.next.stderr)2
-rw-r--r--tests/ui/impl-trait/equality-in-canonical-query.clone.stderr29
-rw-r--r--tests/ui/impl-trait/equality-in-canonical-query.rs23
-rw-r--r--tests/ui/impl-trait/feature-self-return-type.rs1
-rw-r--r--tests/ui/impl-trait/feature-self-return-type.stderr6
-rw-r--r--tests/ui/impl-trait/impl-subtyper.rs18
-rw-r--r--tests/ui/impl-trait/impl-subtyper2.rs7
-rw-r--r--tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs13
-rw-r--r--tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr18
-rw-r--r--tests/ui/impl-trait/in-trait/deep-match-works.rs7
-rw-r--r--tests/ui/impl-trait/in-trait/foreign.rs14
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102140.stderr6
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102571.rs8
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102571.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/lifetime-in-associated-trait-bound.rs19
-rw-r--r--tests/ui/impl-trait/in-trait/nested-rpitit.rs10
-rw-r--r--tests/ui/impl-trait/in-trait/object-safety-sized.rs23
-rw-r--r--tests/ui/impl-trait/in-trait/object-safety.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/object-safety.stderr17
-rw-r--r--tests/ui/impl-trait/in-trait/refine.rs48
-rw-r--r--tests/ui/impl-trait/in-trait/refine.stderr67
-rw-r--r--tests/ui/impl-trait/in-trait/reveal.rs5
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs26
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr16
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.rs23
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr16
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/signature-mismatch.failure.stderr14
-rw-r--r--tests/ui/impl-trait/in-trait/signature-mismatch.rs46
-rw-r--r--tests/ui/impl-trait/in-trait/signature-mismatch.stderr61
-rw-r--r--tests/ui/impl-trait/in-trait/specialization-substs-remap.rs5
-rw-r--r--tests/ui/impl-trait/in-trait/success.rs9
-rw-r--r--tests/ui/impl-trait/in-trait/variance.rs20
-rw-r--r--tests/ui/impl-trait/in-trait/variance.stderr26
-rw-r--r--tests/ui/impl-trait/issue-103181-2.rs2
-rw-r--r--tests/ui/impl-trait/issue-103181-2.stderr57
-rw-r--r--tests/ui/impl-trait/issue-108591.rs3
-rw-r--r--tests/ui/impl-trait/issue-108592.rs3
-rw-r--r--tests/ui/impl-trait/issue-55872-2.drop_tracking.stderr8
-rw-r--r--tests/ui/impl-trait/issue-55872-2.no_drop_tracking.stderr8
-rw-r--r--tests/ui/impl-trait/issue-55872-2.rs5
-rw-r--r--tests/ui/impl-trait/issue-55872-2.stderr (renamed from tests/ui/impl-trait/issue-55872-2.drop_tracking_mir.stderr)4
-rw-r--r--tests/ui/impl-trait/issue-55872-3.stderr4
-rw-r--r--tests/ui/impl-trait/issue-86465.rs6
-rw-r--r--tests/ui/impl-trait/issue-86465.stderr2
-rw-r--r--tests/ui/impl-trait/issue-99073.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-74282.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-78722-2.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-78722.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-86800.stderr4
-rw-r--r--tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr2
-rw-r--r--tests/ui/impl-trait/nested-return-type2-tait2.stderr2
-rw-r--r--tests/ui/impl-trait/nested-return-type2-tait3.stderr2
-rw-r--r--tests/ui/impl-trait/nested-return-type4.stderr2
-rw-r--r--tests/ui/impl-trait/normalize-tait-in-const.stderr25
-rw-r--r--tests/ui/impl-trait/recursive-generator.rs1
-rw-r--r--tests/ui/impl-trait/recursive-generator.stderr15
-rw-r--r--tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking.stderr152
-rw-r--r--tests/ui/impl-trait/recursive-impl-trait-type-indirect.no_drop_tracking.stderr152
-rw-r--r--tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs4
-rw-r--r--tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr (renamed from tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking_mir.stderr)38
-rw-r--r--tests/ui/impl-trait/static-return-lifetime-infered.stderr4
-rw-r--r--tests/ui/impl-trait/variance.rs16
-rw-r--r--tests/ui/impl-trait/variance.stderr26
-rw-r--r--tests/ui/imports/import-after-macro-expand-10.rs17
-rw-r--r--tests/ui/imports/import-after-macro-expand-11.rs21
-rw-r--r--tests/ui/imports/import-after-macro-expand-12.rs34
-rw-r--r--tests/ui/imports/import-after-macro-expand-13.rs22
-rw-r--r--tests/ui/imports/import-after-macro-expand-14.rs22
-rw-r--r--tests/ui/imports/import-after-macro-expand-2.rs4
-rw-r--r--tests/ui/imports/import-after-macro-expand-4.rs11
-rw-r--r--tests/ui/imports/import-after-macro-expand-4.stderr53
-rw-r--r--tests/ui/imports/import-after-macro-expand-6.rs4
-rw-r--r--tests/ui/imports/import-after-macro-expand-9.rs17
-rw-r--r--tests/ui/inference/issue-72616.stderr2
-rw-r--r--tests/ui/inference/issue-72690.stderr42
-rw-r--r--tests/ui/infinite/infinite-type-alias-mutual-recursion.feature.stderr27
-rw-r--r--tests/ui/infinite/infinite-type-alias-mutual-recursion.gated.stderr (renamed from tests/ui/infinite/infinite-type-alias-mutual-recursion.stderr)15
-rw-r--r--tests/ui/infinite/infinite-type-alias-mutual-recursion.rs10
-rw-r--r--tests/ui/infinite/infinite-vec-type-recursion.feature.stderr11
-rw-r--r--tests/ui/infinite/infinite-vec-type-recursion.gated.stderr (renamed from tests/ui/infinite/infinite-vec-type-recursion.stderr)11
-rw-r--r--tests/ui/infinite/infinite-vec-type-recursion.rs9
-rw-r--r--tests/ui/inline-const/promotion.rs22
-rw-r--r--tests/ui/inline-const/promotion.stderr14
-rw-r--r--tests/ui/inner-static-type-parameter.rs2
-rw-r--r--tests/ui/inner-static-type-parameter.stderr6
-rw-r--r--tests/ui/intrinsics/const-eval-select-bad.stderr4
-rw-r--r--tests/ui/intrinsics/feature-gate-safe-intrinsic.rs6
-rw-r--r--tests/ui/intrinsics/feature-gate-safe-intrinsic.stderr20
-rw-r--r--tests/ui/intrinsics/intrinsic-alignment.rs3
-rw-r--r--tests/ui/invalid_dispatch_from_dyn_impls.stderr4
-rw-r--r--tests/ui/issues/auxiliary/issue-111011.stderr2
-rw-r--r--tests/ui/issues/issue-10764.stderr1
-rw-r--r--tests/ui/issues/issue-12127.stderr2
-rw-r--r--tests/ui/issues/issue-17252.stderr11
-rw-r--r--tests/ui/issues/issue-18389.rs10
-rw-r--r--tests/ui/issues/issue-18389.stderr28
-rw-r--r--tests/ui/issues/issue-18611.stderr6
-rw-r--r--tests/ui/issues/issue-21763.stderr3
-rw-r--r--tests/ui/issues/issue-22638.rs4
-rw-r--r--tests/ui/issues/issue-23302-1.stderr9
-rw-r--r--tests/ui/issues/issue-23302-2.stderr9
-rw-r--r--tests/ui/issues/issue-23302-3.stderr14
-rw-r--r--tests/ui/issues/issue-24036.stderr4
-rw-r--r--tests/ui/issues/issue-25076.stderr5
-rw-r--r--tests/ui/issues/issue-27042.stderr15
-rw-r--r--tests/ui/issues/issue-29147.stderr4
-rw-r--r--tests/ui/issues/issue-3214.rs2
-rw-r--r--tests/ui/issues/issue-3214.stderr8
-rw-r--r--tests/ui/issues/issue-35570.stderr6
-rw-r--r--tests/ui/issues/issue-39970.stderr4
-rw-r--r--tests/ui/issues/issue-41880.stderr2
-rw-r--r--tests/ui/issues/issue-43988.stderr4
-rw-r--r--tests/ui/issues/issue-48838.stderr2
-rw-r--r--tests/ui/issues/issue-50600.stderr2
-rw-r--r--tests/ui/issues/issue-50688.stderr2
-rw-r--r--tests/ui/issues/issue-50714-1.stderr4
-rw-r--r--tests/ui/issues/issue-51154.stderr2
-rw-r--r--tests/ui/issues/issue-5997-enum.rs2
-rw-r--r--tests/ui/issues/issue-5997-enum.stderr8
-rw-r--r--tests/ui/issues/issue-5997-struct.rs2
-rw-r--r--tests/ui/issues/issue-5997-struct.stderr8
-rw-r--r--tests/ui/issues/issue-60218.stderr5
-rw-r--r--tests/ui/issues/issue-66353.stderr16
-rw-r--r--tests/ui/issues/issue-66923-show-error-for-correct-call.stderr6
-rw-r--r--tests/ui/issues/issue-69602-type-err-during-codegen-ice.stderr2
-rw-r--r--tests/ui/issues/issue-87199.stderr6
-rw-r--r--tests/ui/issues/issue-9575.stderr4
-rw-r--r--tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr6
-rw-r--r--tests/ui/iterators/invalid-iterator-chain.stderr30
-rw-r--r--tests/ui/kindck/kindck-nonsendable-1.stderr4
-rw-r--r--tests/ui/lang-items/start_lang_item_args.argc.stderr8
-rw-r--r--tests/ui/lang-items/start_lang_item_args.argv.stderr8
-rw-r--r--tests/ui/lang-items/start_lang_item_args.argv_inner_ptr.stderr11
-rw-r--r--tests/ui/lang-items/start_lang_item_args.main_args.stderr13
-rw-r--r--tests/ui/lang-items/start_lang_item_args.main_ret.stderr13
-rw-r--r--tests/ui/lang-items/start_lang_item_args.main_ty.stderr8
-rw-r--r--tests/ui/lang-items/start_lang_item_args.missing_all_args.stderr9
-rw-r--r--tests/ui/lang-items/start_lang_item_args.missing_ret.stderr8
-rw-r--r--tests/ui/lang-items/start_lang_item_args.missing_sigpipe_arg.stderr9
-rw-r--r--tests/ui/lang-items/start_lang_item_args.rs24
-rw-r--r--tests/ui/lang-items/start_lang_item_args.sigpipe.stderr8
-rw-r--r--tests/ui/lang-items/start_lang_item_args.start_ret.stderr8
-rw-r--r--tests/ui/lang-items/start_lang_item_args.too_many_args.stderr9
-rw-r--r--tests/ui/lang-items/start_lang_item_with_target_feature.rs19
-rw-r--r--tests/ui/lang-items/start_lang_item_with_target_feature.stderr11
-rw-r--r--tests/ui/late-bound-lifetimes/predicate-is-global.rs40
-rw-r--r--tests/ui/layout/debug.rs16
-rw-r--r--tests/ui/layout/debug.stderr86
-rw-r--r--tests/ui/layout/enum.rs18
-rw-r--r--tests/ui/layout/enum.stderr14
-rw-r--r--tests/ui/layout/homogeneous-aggr-transparent.rs44
-rw-r--r--tests/ui/layout/homogeneous-aggr-transparent.stderr32
-rw-r--r--tests/ui/layout/layout-cycle.rs31
-rw-r--r--tests/ui/layout/layout-cycle.stderr11
-rw-r--r--tests/ui/layout/struct.rs12
-rw-r--r--tests/ui/layout/struct.stderr14
-rw-r--r--tests/ui/layout/zero-sized-array-enum-niche.stderr6
-rw-r--r--tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr8
-rw-r--r--tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr8
-rw-r--r--tests/ui/lazy-type-alias/trailing-where-clause.stderr11
-rw-r--r--tests/ui/lifetimes/anonymize-unnamed-bound-vars-in-binders.rs27
-rw-r--r--tests/ui/lifetimes/issue-95023.stderr2
-rw-r--r--tests/ui/lifetimes/lifetime-elision-return-type-trait.stderr6
-rw-r--r--tests/ui/lifetimes/unusual-rib-combinations.stderr4
-rw-r--r--tests/ui/limits/issue-55878.stderr8
-rw-r--r--tests/ui/limits/issue-56762.rs6
-rw-r--r--tests/ui/limits/issue-56762.stderr10
-rw-r--r--tests/ui/linkage-attr/common-linkage-non-zero-init.rs14
-rw-r--r--tests/ui/linkage-attr/common-linkage-non-zero-init.stderr3
-rw-r--r--tests/ui/lint-group-forbid-always-trumps-cli.stderr1
-rw-r--r--tests/ui/lint/cli-unknown-force-warn.rs6
-rw-r--r--tests/ui/lint/cli-unknown-force-warn.stderr11
-rw-r--r--tests/ui/lint/command-line-lint-group-deny.stderr1
-rw-r--r--tests/ui/lint/command-line-lint-group-forbid.stderr1
-rw-r--r--tests/ui/lint/command-line-lint-group-warn.stderr1
-rw-r--r--tests/ui/lint/expr-field.rs15
-rw-r--r--tests/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr1
-rw-r--r--tests/ui/lint/force-warn/lint-group-allow-warnings.stderr1
-rw-r--r--tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr1
-rw-r--r--tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr1
-rw-r--r--tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr1
-rw-r--r--tests/ui/lint/future-incompat-test.stderr1
-rw-r--r--tests/ui/lint/invalid_from_utf8.rs27
-rw-r--r--tests/ui/lint/invalid_from_utf8.stderr135
-rw-r--r--tests/ui/lint/issue-99387.rs2
-rw-r--r--tests/ui/lint/large_assignments/box_rc_arc_allowed.rs29
-rw-r--r--tests/ui/lint/large_assignments/box_rc_arc_allowed.stderr23
-rw-r--r--tests/ui/lint/large_assignments/large_future.attribute.stderr (renamed from tests/ui/async-await/large_moves.option.stderr)16
-rw-r--r--tests/ui/lint/large_assignments/large_future.option.stderr (renamed from tests/ui/async-await/large_moves.attribute.stderr)16
-rw-r--r--tests/ui/lint/large_assignments/large_future.rs (renamed from tests/ui/async-await/large_moves.rs)3
-rw-r--r--tests/ui/lint/lint-ctypes-94223.rs7
-rw-r--r--tests/ui/lint/lint-ctypes-94223.stderr27
-rw-r--r--tests/ui/lint/lint-ctypes-fn.rs2
-rw-r--r--tests/ui/lint/lint-ctypes-option-nonnull-unsized.rs8
-rw-r--r--tests/ui/lint/lint-ctypes-option-nonnull-unsized.stderr16
-rw-r--r--tests/ui/lint/lint-ctypes.rs2
-rw-r--r--tests/ui/lint/lint-pre-expansion-extern-module.stderr1
-rw-r--r--tests/ui/lint/lint-removed-cmdline-deny.rs13
-rw-r--r--tests/ui/lint/lint-removed-cmdline-deny.stderr28
-rw-r--r--tests/ui/lint/lint-removed-cmdline.rs1
-rw-r--r--tests/ui/lint/lint-removed-cmdline.stderr5
-rw-r--r--tests/ui/lint/lint-renamed-cmdline-deny.rs10
-rw-r--r--tests/ui/lint/lint-renamed-cmdline-deny.stderr31
-rw-r--r--tests/ui/lint/lint-renamed-cmdline.rs1
-rw-r--r--tests/ui/lint/lint-renamed-cmdline.stderr8
-rw-r--r--tests/ui/lint/lint-unexported-no-mangle.stderr1
-rw-r--r--tests/ui/lint/lint-unknown-lint-cmdline-allow.rs4
-rw-r--r--tests/ui/lint/lint-unknown-lint-cmdline-deny.rs9
-rw-r--r--tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr31
-rw-r--r--tests/ui/lint/lint-unknown-lint-cmdline.rs2
-rw-r--r--tests/ui/lint/lint-unknown-lint-cmdline.stderr20
-rw-r--r--tests/ui/lint/must_not_suspend/dedup.drop_tracking.stderr21
-rw-r--r--tests/ui/lint/must_not_suspend/dedup.no_drop_tracking.stderr33
-rw-r--r--tests/ui/lint/must_not_suspend/dedup.rs8
-rw-r--r--tests/ui/lint/must_not_suspend/dedup.stderr (renamed from tests/ui/lint/must_not_suspend/dedup.drop_tracking_mir.stderr)7
-rw-r--r--tests/ui/lint/must_not_suspend/ref-drop-tracking.rs30
-rw-r--r--tests/ui/lint/must_not_suspend/ref-drop-tracking.stderr27
-rw-r--r--tests/ui/lint/must_not_suspend/ref.drop_tracking.stderr27
-rw-r--r--tests/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr27
-rw-r--r--tests/ui/lint/must_not_suspend/ref.rs5
-rw-r--r--tests/ui/lint/must_not_suspend/ref.stderr (renamed from tests/ui/lint/must_not_suspend/ref.drop_tracking_mir.stderr)8
-rw-r--r--tests/ui/lint/must_not_suspend/trait.drop_tracking_mir.stderr37
-rw-r--r--tests/ui/lint/must_not_suspend/trait.no_drop_tracking.stderr37
-rw-r--r--tests/ui/lint/must_not_suspend/trait.rs6
-rw-r--r--tests/ui/lint/must_not_suspend/trait.stderr (renamed from tests/ui/lint/must_not_suspend/trait.drop_tracking.stderr)10
-rw-r--r--tests/ui/lint/must_not_suspend/unit.drop_tracking_mir.stderr26
-rw-r--r--tests/ui/lint/must_not_suspend/unit.no_drop_tracking.stderr26
-rw-r--r--tests/ui/lint/must_not_suspend/unit.rs4
-rw-r--r--tests/ui/lint/must_not_suspend/unit.stderr (renamed from tests/ui/lint/must_not_suspend/unit.drop_tracking.stderr)8
-rw-r--r--tests/ui/lint/must_not_suspend/warn.drop_tracking.stderr26
-rw-r--r--tests/ui/lint/must_not_suspend/warn.no_drop_tracking.stderr26
-rw-r--r--tests/ui/lint/must_not_suspend/warn.rs7
-rw-r--r--tests/ui/lint/must_not_suspend/warn.stderr (renamed from tests/ui/lint/must_not_suspend/warn.drop_tracking_mir.stderr)20
-rw-r--r--tests/ui/lint/no-coverage.rs40
-rw-r--r--tests/ui/lint/no-coverage.stderr72
-rw-r--r--tests/ui/lint/noop-method-call.fixed13
-rw-r--r--tests/ui/lint/noop-method-call.rs13
-rw-r--r--tests/ui/lint/noop-method-call.stderr14
-rw-r--r--tests/ui/lint/ptr_null_checks.rs14
-rw-r--r--tests/ui/lint/ptr_null_checks.stderr38
-rw-r--r--tests/ui/lint/reference_casting.rs62
-rw-r--r--tests/ui/lint/reference_casting.stderr209
-rw-r--r--tests/ui/lint/trivial_casts.stderr2
-rw-r--r--tests/ui/lint/unused/unused-doc-comments-edge-cases.rs26
-rw-r--r--tests/ui/lint/unused/unused-doc-comments-edge-cases.stderr30
-rw-r--r--tests/ui/lint/unused/unused-parens-issue-106413.rs32
-rw-r--r--tests/ui/lint/unused/unused-parens-issue-106413.stderr127
-rw-r--r--tests/ui/loops/issue-69225-SCEVAddExpr-wrap-flag.rs (renamed from tests/ui/issues/issue-69225-SCEVAddExpr-wrap-flag.rs)0
-rw-r--r--tests/ui/loops/issue-69225-layout-repeated-checked-add.rs (renamed from tests/ui/issues/issue-69225-layout-repeated-checked-add.rs)0
-rw-r--r--tests/ui/loops/loop-break-value.rs63
-rw-r--r--tests/ui/loops/loop-break-value.stderr153
-rw-r--r--tests/ui/loops/loop-labeled-break-value.stderr39
-rw-r--r--tests/ui/loops/loop-properly-diverging-2.stderr13
-rw-r--r--tests/ui/macros/issue-2804.rs (renamed from tests/ui/issue-2804.rs)0
-rw-r--r--tests/ui/macros/issue-39467.rs (renamed from tests/ui/issues/issue-39467.rs)0
-rw-r--r--tests/ui/macros/must-use-in-macro-55516.stderr1
-rw-r--r--tests/ui/main-wrong-type.stderr4
-rw-r--r--tests/ui/match/issue-72896-non-partial-eq-const.rs (renamed from tests/ui/match/issue-72896.rs)3
-rw-r--r--tests/ui/match/issue-72896-non-partial-eq-const.stderr23
-rw-r--r--tests/ui/match/match_non_exhaustive.stderr3
-rw-r--r--tests/ui/methods/issue-3707.rs (renamed from tests/ui/issues/issue-3707.rs)0
-rw-r--r--tests/ui/methods/issue-3707.stderr (renamed from tests/ui/issues/issue-3707.stderr)0
-rw-r--r--tests/ui/methods/issues/issue-61525.stderr4
-rw-r--r--tests/ui/methods/method-missing-call.stderr2
-rw-r--r--tests/ui/mir/issue-92893.rs4
-rw-r--r--tests/ui/mir/issue-92893.stderr18
-rw-r--r--tests/ui/mir/mir-inlining/always-encode-mirs.rs12
-rw-r--r--tests/ui/mir/mir-inlining/auxiliary/internal.rs7
-rw-r--r--tests/ui/mismatched_types/cast-rfc0401.stderr11
-rw-r--r--tests/ui/mismatched_types/issue-13033.rs (renamed from tests/ui/issues/issue-13033.rs)0
-rw-r--r--tests/ui/mismatched_types/issue-13033.stderr (renamed from tests/ui/issues/issue-13033.stderr)0
-rw-r--r--tests/ui/mismatched_types/issue-36053-2.stderr14
-rw-r--r--tests/ui/mismatched_types/normalize-fn-sig.stderr1
-rw-r--r--tests/ui/moves/issue-34721.fixed (renamed from tests/ui/issues/issue-34721.fixed)0
-rw-r--r--tests/ui/moves/issue-34721.rs (renamed from tests/ui/issues/issue-34721.rs)0
-rw-r--r--tests/ui/moves/issue-34721.stderr (renamed from tests/ui/issues/issue-34721.stderr)0
-rw-r--r--tests/ui/namespace/namespace-mix.stderr220
-rw-r--r--tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs11
-rw-r--r--tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.stderr4
-rw-r--r--tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.rs8
-rw-r--r--tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.stderr4
-rw-r--r--tests/ui/nested-ty-params.rs2
-rw-r--r--tests/ui/nested-ty-params.stderr16
-rw-r--r--tests/ui/never_type/fallback-closure-wrap.fallback.stderr4
-rw-r--r--tests/ui/never_type/feature-gate-never_type_fallback.stderr5
-rw-r--r--tests/ui/never_type/impl_trait_fallback3.stderr6
-rw-r--r--tests/ui/never_type/impl_trait_fallback4.stderr6
-rw-r--r--tests/ui/never_type/issue-52443.stderr10
-rw-r--r--tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr6
-rw-r--r--tests/ui/nll/closure-requirements/escape-argument-callee.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/escape-argument.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr4
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-val.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr2
-rw-r--r--tests/ui/nll/issue-54556-stephaneyfx.stderr2
-rw-r--r--tests/ui/nll/missing-universe-cause-issue-114907.rs40
-rw-r--r--tests/ui/nll/missing-universe-cause-issue-114907.stderr79
-rw-r--r--tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr4
-rw-r--r--tests/ui/no-send-res-ports.stderr4
-rw-r--r--tests/ui/not-clone-closure.stderr6
-rw-r--r--tests/ui/object-safety/assoc_type_bounds_sized_used.rs6
-rw-r--r--tests/ui/object-safety/assoc_type_bounds_sized_used.stderr23
-rw-r--r--tests/ui/object-safety/call-when-assoc-ty-is-sized.rs25
-rw-r--r--tests/ui/on-unimplemented/on-trait.stderr10
-rw-r--r--tests/ui/on-unimplemented/parent-label.stderr20
-rw-r--r--tests/ui/on-unimplemented/sum.stderr12
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-1.rs7
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-1.stderr18
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-2.rs5
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-2.stderr12
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-3.rs2
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-3.stderr8
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-5.rs13
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-5.stderr12
-rw-r--r--tests/ui/panic-handler/panic-handler-with-target-feature.rs15
-rw-r--r--tests/ui/panic-handler/panic-handler-with-target-feature.stderr11
-rw-r--r--tests/ui/panics/panic-in-cleanup.rs23
-rw-r--r--tests/ui/panics/panic-in-cleanup.run.stderr9
-rw-r--r--tests/ui/panics/panic-in-ffi.rs18
-rw-r--r--tests/ui/panics/panic-in-ffi.run.stderr7
-rw-r--r--tests/ui/panics/short-ice-remove-middle-frames-2.rs1
-rw-r--r--tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr2
-rw-r--r--tests/ui/panics/short-ice-remove-middle-frames.rs1
-rw-r--r--tests/ui/panics/short-ice-remove-middle-frames.run.stderr2
-rw-r--r--tests/ui/parser/default-unmatched.stderr2
-rw-r--r--tests/ui/parser/expr-as-stmt.stderr2
-rw-r--r--tests/ui/parser/impl-parsing.stderr2
-rw-r--r--tests/ui/parser/issue-101477-enum.stderr2
-rw-r--r--tests/ui/parser/issues/issue-113110-non-item-at-module-root.rs1
-rw-r--r--tests/ui/parser/issues/issue-113110-non-item-at-module-root.stderr10
-rw-r--r--tests/ui/parser/issues/issue-17904-2.stderr2
-rw-r--r--tests/ui/parser/issues/issue-43196.stderr2
-rw-r--r--tests/ui/parser/issues/issue-62913.stderr2
-rw-r--r--tests/ui/parser/issues/issue-68890.stderr2
-rw-r--r--tests/ui/parser/issues/issue-89388.stderr7
-rw-r--r--tests/ui/parser/issues/issue-98601-delimiter-error-1.rs9
-rw-r--r--tests/ui/parser/issues/issue-98601-delimiter-error-1.stderr16
-rw-r--r--tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.rs5
-rw-r--r--tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.stderr14
-rw-r--r--tests/ui/parser/keyword-union-as-identifier.rs72
-rw-r--r--tests/ui/parser/macro/macro-expand-to-field.rs31
-rw-r--r--tests/ui/parser/macro/macro-expand-to-field.stderr51
-rw-r--r--tests/ui/parser/shebang/shebang-doc-comment.stderr2
-rw-r--r--tests/ui/parser/struct-literal-in-if.rs5
-rw-r--r--tests/ui/parser/struct-literal-in-if.stderr18
-rw-r--r--tests/ui/parser/struct-literal-in-match-guard.rs3
-rw-r--r--tests/ui/parser/struct-literal-in-while.rs5
-rw-r--r--tests/ui/parser/struct-literal-in-while.stderr18
-rw-r--r--tests/ui/parser/struct-literal-restrictions-in-lamda.stderr2
-rw-r--r--tests/ui/parser/virtual-structs.stderr2
-rw-r--r--tests/ui/pattern/issue-114896.rs7
-rw-r--r--tests/ui/pattern/issue-114896.stderr11
-rw-r--r--tests/ui/pattern/non-structural-match-types.stderr4
-rw-r--r--tests/ui/pattern/usefulness/auxiliary/non-exhaustive.rs2
-rw-r--r--tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr4
-rw-r--r--tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.rs12
-rw-r--r--tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.stderr17
-rw-r--r--tests/ui/pattern/usefulness/issue-30240.stderr2
-rw-r--r--tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.rs67
-rw-r--r--tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.stderr170
-rw-r--r--tests/ui/pattern/usefulness/nested-non-exhaustive-enums.rs18
-rw-r--r--tests/ui/pattern/usefulness/nested-non-exhaustive-enums.stderr22
-rw-r--r--tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr2
-rw-r--r--tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr2
-rw-r--r--tests/ui/print_type_sizes/async.stdout16
-rw-r--r--tests/ui/print_type_sizes/generator.stdout2
-rw-r--r--tests/ui/print_type_sizes/generator_discr_placement.stdout2
-rw-r--r--tests/ui/print_type_sizes/zero-sized-fields.stdout10
-rw-r--r--tests/ui/privacy/associated-item-privacy-inherent.rs2
-rw-r--r--tests/ui/privacy/associated-item-privacy-trait.rs2
-rw-r--r--tests/ui/privacy/associated-item-privacy-type-binding.rs2
-rw-r--r--tests/ui/privacy/effective_visibilities_full_priv.rs2
-rw-r--r--tests/ui/privacy/issue-30079.rs3
-rw-r--r--tests/ui/privacy/issue-30079.stderr17
-rw-r--r--tests/ui/privacy/private-bounds-locally-allowed.rs7
-rw-r--r--tests/ui/privacy/private-in-public-assoc-ty.rs9
-rw-r--r--tests/ui/privacy/private-in-public-assoc-ty.stderr50
-rw-r--r--tests/ui/privacy/private-in-public-lint.rs19
-rw-r--r--tests/ui/privacy/private-in-public-lint.stderr21
-rw-r--r--tests/ui/privacy/private-in-public-non-principal-2.rs2
-rw-r--r--tests/ui/privacy/private-in-public-non-principal.rs10
-rw-r--r--tests/ui/privacy/private-in-public-non-principal.stderr28
-rw-r--r--tests/ui/privacy/private-in-public-type-alias-impl-trait.rs2
-rw-r--r--tests/ui/privacy/private-in-public-warn.rs85
-rw-r--r--tests/ui/privacy/private-in-public-warn.stderr376
-rw-r--r--tests/ui/privacy/private-in-public.rs66
-rw-r--r--tests/ui/privacy/private-in-public.stderr468
-rw-r--r--tests/ui/privacy/private-inferred-type-2.rs1
-rw-r--r--tests/ui/privacy/private-inferred-type-2.stderr6
-rw-r--r--tests/ui/privacy/private-inferred-type.rs2
-rw-r--r--tests/ui/privacy/private-type-in-interface.rs1
-rw-r--r--tests/ui/privacy/private-type-in-interface.stderr18
-rw-r--r--tests/ui/privacy/restricted/private-in-public.rs5
-rw-r--r--tests/ui/privacy/restricted/private-in-public.stderr21
-rw-r--r--tests/ui/privacy/unnameable_types.rs9
-rw-r--r--tests/ui/privacy/unnameable_types.stderr8
-rw-r--r--tests/ui/privacy/where-priv-type.rs27
-rw-r--r--tests/ui/privacy/where-priv-type.stderr107
-rw-r--r--tests/ui/privacy/where-pub-type-impls-priv-trait.rs23
-rw-r--r--tests/ui/privacy/where-pub-type-impls-priv-trait.stderr84
-rw-r--r--tests/ui/proc-macro/allowed-signatures.rs2
-rw-r--r--tests/ui/proc-macro/auxiliary/api/mod.rs1
-rw-r--r--tests/ui/proc-macro/auxiliary/api/parse.rs4
-rw-r--r--tests/ui/proc-macro/auxiliary/print-tokens.rs16
-rw-r--r--tests/ui/proc-macro/bad-projection.stderr6
-rw-r--r--tests/ui/proc-macro/literal-to-string.rs26
-rw-r--r--tests/ui/proc-macro/literal-to-string.stdout107
-rw-r--r--tests/ui/pub/issue-33174-restricted-type-in-public-interface.rs30
-rw-r--r--tests/ui/pub/issue-33174-restricted-type-in-public-interface.stderr48
-rw-r--r--tests/ui/pub/pub-restricted-error-fn.stderr2
-rw-r--r--tests/ui/range/issue-54505-no-std.rs6
-rw-r--r--tests/ui/range/issue-54505-no-std.stderr14
-rw-r--r--tests/ui/range/range-1.stderr2
-rw-r--r--tests/ui/recursion/issue-83150.stderr6
-rw-r--r--tests/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr1
-rw-r--r--tests/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr1
-rw-r--r--tests/ui/regions/regions-fn-subtyping-return-static-fail.stderr1
-rw-r--r--tests/ui/regions/regions-lifetime-bounds-on-fns.stderr1
-rw-r--r--tests/ui/reify-intrinsic.stderr1
-rw-r--r--tests/ui/repr/16-bit-repr-c-enum.rs2
-rw-r--r--tests/ui/repr/explicit-rust-repr-conflicts.rs23
-rw-r--r--tests/ui/repr/explicit-rust-repr-conflicts.stderr39
-rw-r--r--tests/ui/repr/invalid_repr_list_help.stderr10
-rw-r--r--tests/ui/repr/repr-transparent-non-exhaustive.rs40
-rw-r--r--tests/ui/repr/repr-transparent-non-exhaustive.stderr42
-rw-r--r--tests/ui/repr/repr-transparent.rs23
-rw-r--r--tests/ui/repr/repr-transparent.stderr82
-rw-r--r--tests/ui/resolve/associated-fn-called-as-fn.stderr14
-rw-r--r--tests/ui/resolve/bad-expr-path.stderr4
-rw-r--r--tests/ui/resolve/bad-expr-path2.stderr4
-rw-r--r--tests/ui/resolve/bad-type-env-capture.stderr8
-rw-r--r--tests/ui/resolve/field-and-method-in-self-not-available-in-assoc-fn.rs18
-rw-r--r--tests/ui/resolve/field-and-method-in-self-not-available-in-assoc-fn.stderr41
-rw-r--r--tests/ui/resolve/generic-params-from-outer-item-in-const-item.default.stderr28
-rw-r--r--tests/ui/resolve/generic-params-from-outer-item-in-const-item.generic_const_items.stderr34
-rw-r--r--tests/ui/resolve/generic-params-from-outer-item-in-const-item.rs39
-rw-r--r--tests/ui/resolve/issue-103474.stderr2
-rw-r--r--tests/ui/resolve/issue-12796.rs2
-rw-r--r--tests/ui/resolve/issue-12796.stderr4
-rw-r--r--tests/ui/resolve/issue-14254.stderr98
-rw-r--r--tests/ui/resolve/issue-2356.stderr42
-rw-r--r--tests/ui/resolve/issue-3021-c.rs4
-rw-r--r--tests/ui/resolve/issue-3021-c.stderr16
-rw-r--r--tests/ui/resolve/issue-60057.stderr12
-rw-r--r--tests/ui/resolve/issue-65025-extern-static-parent-generics.rs2
-rw-r--r--tests/ui/resolve/issue-65025-extern-static-parent-generics.stderr6
-rw-r--r--tests/ui/resolve/issue-65035-static-with-parent-generics.rs10
-rw-r--r--tests/ui/resolve/issue-65035-static-with-parent-generics.stderr30
-rw-r--r--tests/ui/resolve/issue-6642.rs (renamed from tests/ui/issues/issue-6642.rs)0
-rw-r--r--tests/ui/resolve/issue-6642.stderr (renamed from tests/ui/issues/issue-6642.stderr)0
-rw-r--r--tests/ui/resolve/resolve-assoc-suggestions.stderr21
-rw-r--r--tests/ui/resolve/resolve-speculative-adjustment.stderr14
-rw-r--r--tests/ui/resolve/resolve-type-param-in-item-in-trait.rs8
-rw-r--r--tests/ui/resolve/resolve-type-param-in-item-in-trait.stderr32
-rw-r--r--tests/ui/resolve/suggest-import-without-clobbering-attrs.fixed16
-rw-r--r--tests/ui/resolve/suggest-import-without-clobbering-attrs.rs15
-rw-r--r--tests/ui/resolve/suggest-import-without-clobbering-attrs.stderr14
-rw-r--r--tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr26
-rw-r--r--tests/ui/resolve/unresolved_static_type_field.stderr5
-rw-r--r--tests/ui/resolve/use-self-in-inner-fn.rs6
-rw-r--r--tests/ui/resolve/use-self-in-inner-fn.stderr6
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/enum.stderr5
-rw-r--r--tests/ui/rfcs/rfc-2091-track-caller/error-with-start.rs2
-rw-r--r--tests/ui/rfcs/rfc-2091-track-caller/error-with-start.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/const-expr.rs26
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.rs18
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.stderr35
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs36
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.stderr285
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.rs15
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.stderr15
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-2.rs16
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.rs14
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.stderr11
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.rs14
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.stderr11
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.rs16
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.stderr14
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.rs97
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr67
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let.rs41
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/parens.rs25
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/parens.stderr54
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/partially-macro-expanded.rs18
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/shadowing.rs23
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/type-inference.rs16
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr1
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr1
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.rs2
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.rs6
-rw-r--r--tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden.rs (renamed from tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-1.rs)0
-rw-r--r--tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden.stderr (renamed from tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-1.stderr)2
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.rs2
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.rs14
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.stderr10
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.rs5
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.stderr33
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.rs340
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.stderr1021
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs261
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.stderr1462
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.rs1
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.stderr30
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs6
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr30
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.rs2
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.stderr36
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs3
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr15
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr15
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr49
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/fallback.rs16
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/infer-fallback.rs11
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr2
-rw-r--r--tests/ui/rmeta/auxiliary/rmeta-meta.rs4
-rw-r--r--tests/ui/rmeta/no_optitimized_mir.rs11
-rw-r--r--tests/ui/rmeta/no_optitimized_mir.stderr10
-rw-r--r--tests/ui/rust-2018/trait-import-suggestions.rs2
-rw-r--r--tests/ui/sanitize/cfg.rs32
-rw-r--r--tests/ui/self/class-missing-self.stderr9
-rw-r--r--tests/ui/simd/intrinsic/generic-elements.rs28
-rw-r--r--tests/ui/simd/intrinsic/generic-elements.stderr80
-rw-r--r--tests/ui/simd/monomorphize-shuffle-index.generic.stderr12
-rw-r--r--tests/ui/simd/monomorphize-shuffle-index.rs28
-rw-r--r--tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr2
-rw-r--r--tests/ui/span/issue-29595.stderr6
-rw-r--r--tests/ui/span/move-closure.stderr2
-rw-r--r--tests/ui/span/send-is-not-static-std-sync.rs2
-rw-r--r--tests/ui/span/send-is-not-static-std-sync.stderr8
-rw-r--r--tests/ui/specialization/issue-38091.stderr5
-rw-r--r--tests/ui/specialization/specialization-default-types.stderr2
-rw-r--r--tests/ui/static/static-reference-to-fn-1.stderr1
-rw-r--r--tests/ui/stats/hir-stats.stderr32
-rw-r--r--tests/ui/stats/meta-stats.rs7
-rw-r--r--tests/ui/structs-enums/enum-rec/issue-17431-6.rs (renamed from tests/ui/issues/issue-17431-6.rs)0
-rw-r--r--tests/ui/structs-enums/enum-rec/issue-17431-6.stderr (renamed from tests/ui/issues/issue-17431-6.stderr)0
-rw-r--r--tests/ui/structs-enums/enum-rec/issue-17431-7.rs (renamed from tests/ui/issues/issue-17431-7.rs)0
-rw-r--r--tests/ui/structs-enums/enum-rec/issue-17431-7.stderr (renamed from tests/ui/issues/issue-17431-7.stderr)0
-rw-r--r--tests/ui/structs-enums/rec-align-u32.rs2
-rw-r--r--tests/ui/structs-enums/rec-align-u64.rs3
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-1.rs (renamed from tests/ui/issues/issue-17431-1.rs)0
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-1.stderr (renamed from tests/ui/issues/issue-17431-1.stderr)0
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-2.rs (renamed from tests/ui/issues/issue-17431-2.rs)0
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-2.stderr (renamed from tests/ui/issues/issue-17431-2.stderr)0
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-3.rs (renamed from tests/ui/issues/issue-17431-3.rs)0
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-3.stderr (renamed from tests/ui/issues/issue-17431-3.stderr)0
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-4.rs (renamed from tests/ui/issues/issue-17431-4.rs)0
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-4.stderr (renamed from tests/ui/issues/issue-17431-4.stderr)0
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-5.rs (renamed from tests/ui/issues/issue-17431-5.rs)0
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-5.stderr (renamed from tests/ui/issues/issue-17431-5.stderr)0
-rw-r--r--tests/ui/suggestions/assoc-const-as-fn.stderr6
-rw-r--r--tests/ui/suggestions/assoc-const-without-self.stderr2
-rw-r--r--tests/ui/suggestions/assoc-type-in-method-return.stderr7
-rw-r--r--tests/ui/suggestions/assoc_fn_without_self.rs8
-rw-r--r--tests/ui/suggestions/assoc_fn_without_self.stderr49
-rw-r--r--tests/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr8
-rw-r--r--tests/ui/suggestions/auxiliary/extern-issue-98562.rs26
-rw-r--r--tests/ui/suggestions/call-boxed.stderr4
-rw-r--r--tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr2
-rw-r--r--tests/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr4
-rw-r--r--tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr2
-rw-r--r--tests/ui/suggestions/issue-84973-blacklist.stderr4
-rw-r--r--tests/ui/suggestions/issue-89333.stderr5
-rw-r--r--tests/ui/suggestions/issue-98562.rs12
-rw-r--r--tests/ui/suggestions/issue-98562.stderr11
-rw-r--r--tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr2
-rw-r--r--tests/ui/suggestions/missing-assoc-fn.stderr2
-rw-r--r--tests/ui/suggestions/return-closures.stderr4
-rw-r--r--tests/ui/suggestions/sugg-else-for-closure.stderr4
-rw-r--r--tests/ui/suggestions/suggest-box.stderr2
-rw-r--r--tests/ui/suggestions/unnamable-types.stderr6
-rw-r--r--tests/ui/symbol-names/basic.legacy.stderr4
-rw-r--r--tests/ui/symbol-names/issue-60925.legacy.stderr4
-rw-r--r--tests/ui/test-attrs/issue-36768.rs2
-rw-r--r--tests/ui/track-diagnostics/track.rs5
-rw-r--r--tests/ui/track-diagnostics/track.stderr2
-rw-r--r--tests/ui/trait-bounds/enum-unit-variant-trait-bound.rs6
-rw-r--r--tests/ui/trait-bounds/enum-unit-variant-trait-bound.stderr13
-rw-r--r--tests/ui/trait-bounds/issue-82038.rs9
-rw-r--r--tests/ui/trait-bounds/issue-82038.stderr15
-rw-r--r--tests/ui/traits/bad-method-typaram-kind.stderr4
-rw-r--r--tests/ui/traits/bound/on-structs-and-enums-in-fns.stderr10
-rw-r--r--tests/ui/traits/bound/on-structs-and-enums-in-impls.stderr5
-rw-r--r--tests/ui/traits/bound/on-structs-and-enums-locals.stderr10
-rw-r--r--tests/ui/traits/bound/on-structs-and-enums-static.stderr5
-rw-r--r--tests/ui/traits/bound/on-structs-and-enums.stderr20
-rw-r--r--tests/ui/traits/deny-builtin-object-impl.current.stderr5
-rw-r--r--tests/ui/traits/deny-builtin-object-impl.next.stderr5
-rw-r--r--tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr11
-rw-r--r--tests/ui/traits/impl-bounds-checking.stderr5
-rw-r--r--tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr6
-rw-r--r--tests/ui/traits/issue-105231.rs2
-rw-r--r--tests/ui/traits/issue-105231.stderr8
-rw-r--r--tests/ui/traits/issue-66768.rs (renamed from tests/ui/issues/issue-66768.rs)0
-rw-r--r--tests/ui/traits/issue-77982.stderr20
-rw-r--r--tests/ui/traits/issue-91949-hangs-on-recursion.stderr2
-rw-r--r--tests/ui/traits/issue-99875.stderr4
-rw-r--r--tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr2
-rw-r--r--tests/ui/traits/new-solver/async.fail.stderr2
-rw-r--r--tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs2
-rw-r--r--tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr6
-rw-r--r--tests/ui/traits/new-solver/canonicalize-effect-var.rs22
-rw-r--r--tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr6
-rw-r--r--tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr4
-rw-r--r--tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr8
-rw-r--r--tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.rs53
-rw-r--r--tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.stderr10
-rw-r--r--tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs2
-rw-r--r--tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr19
-rw-r--r--tests/ui/traits/new-solver/dont-ice-on-assoc-projection.rs19
-rw-r--r--tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr21
-rw-r--r--tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr4
-rw-r--r--tests/ui/traits/new-solver/generator.fail.stderr8
-rw-r--r--tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr4
-rw-r--r--tests/ui/traits/new-solver/overflow/global-cache.stderr4
-rw-r--r--tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.rs12
-rw-r--r--tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.stderr27
-rw-r--r--tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.stderr4
-rw-r--r--tests/ui/traits/new-solver/overflow/recursive-self-normalization.stderr4
-rw-r--r--tests/ui/traits/new-solver/projection-discr-kind.stderr5
-rw-r--r--tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr4
-rw-r--r--tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.rs2
-rw-r--r--tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.stderr2
-rw-r--r--tests/ui/traits/non_lifetime_binders/fail.stderr5
-rw-r--r--tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.rs2
-rw-r--r--tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr2
-rw-r--r--tests/ui/traits/object-does-not-impl-trait.stderr5
-rw-r--r--tests/ui/traits/object/enforce-supertrait-projection.rs2
-rw-r--r--tests/ui/traits/object/enforce-supertrait-projection.stderr2
-rw-r--r--tests/ui/traits/reservation-impl/no-use.next.stderr6
-rw-r--r--tests/ui/traits/reservation-impl/no-use.old.stderr6
-rw-r--r--tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs2
-rw-r--r--tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr8
-rw-r--r--tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.rs15
-rw-r--r--tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.stderr22
-rw-r--r--tests/ui/traits/suggest-dereferences/issue-39029.fixed (renamed from tests/ui/traits/suggest-deferences/issue-39029.fixed)0
-rw-r--r--tests/ui/traits/suggest-dereferences/issue-39029.rs (renamed from tests/ui/traits/suggest-deferences/issue-39029.rs)0
-rw-r--r--tests/ui/traits/suggest-dereferences/issue-39029.stderr (renamed from tests/ui/traits/suggest-deferences/issue-39029.stderr)0
-rw-r--r--tests/ui/traits/suggest-dereferences/issue-62530.fixed (renamed from tests/ui/traits/suggest-deferences/issue-62530.fixed)0
-rw-r--r--tests/ui/traits/suggest-dereferences/issue-62530.rs (renamed from tests/ui/traits/suggest-deferences/issue-62530.rs)0
-rw-r--r--tests/ui/traits/suggest-dereferences/issue-62530.stderr (renamed from tests/ui/traits/suggest-deferences/issue-62530.stderr)0
-rw-r--r--tests/ui/traits/suggest-dereferences/multiple-0.fixed (renamed from tests/ui/traits/suggest-deferences/multiple-0.fixed)0
-rw-r--r--tests/ui/traits/suggest-dereferences/multiple-0.rs (renamed from tests/ui/traits/suggest-deferences/multiple-0.rs)0
-rw-r--r--tests/ui/traits/suggest-dereferences/multiple-0.stderr (renamed from tests/ui/traits/suggest-deferences/multiple-0.stderr)0
-rw-r--r--tests/ui/traits/suggest-dereferences/multiple-1.rs (renamed from tests/ui/traits/suggest-deferences/multiple-1.rs)0
-rw-r--r--tests/ui/traits/suggest-dereferences/multiple-1.stderr (renamed from tests/ui/traits/suggest-deferences/multiple-1.stderr)0
-rw-r--r--tests/ui/traits/suggest-dereferences/root-obligation.fixed (renamed from tests/ui/traits/suggest-deferences/root-obligation.fixed)0
-rw-r--r--tests/ui/traits/suggest-dereferences/root-obligation.rs (renamed from tests/ui/traits/suggest-deferences/root-obligation.rs)0
-rw-r--r--tests/ui/traits/suggest-dereferences/root-obligation.stderr (renamed from tests/ui/traits/suggest-deferences/root-obligation.stderr)0
-rw-r--r--tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.fixed (renamed from tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.fixed)0
-rw-r--r--tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.rs (renamed from tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.rs)0
-rw-r--r--tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.stderr (renamed from tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.stderr)0
-rw-r--r--tests/ui/traits/suggest-fully-qualified-closure.rs2
-rw-r--r--tests/ui/traits/suggest-fully-qualified-closure.stderr4
-rw-r--r--tests/ui/traits/suggest-where-clause.stderr12
-rw-r--r--tests/ui/traits/unsend-future.rs1
-rw-r--r--tests/ui/traits/unsend-future.stderr4
-rw-r--r--tests/ui/traits/vtable-res-trait-param.stderr5
-rw-r--r--tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.rs4
-rw-r--r--tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.stderr19
-rw-r--r--tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.rs4
-rw-r--r--tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.stderr19
-rw-r--r--tests/ui/transmute/issue-115402-overflow-size.rs27
-rw-r--r--tests/ui/transmute/issue-115402-overflow-size.stderr33
-rw-r--r--tests/ui/trivial-bounds/trivial-bounds-leak.stderr11
-rw-r--r--tests/ui/try-trait/issue-32709.rs (renamed from tests/ui/issues/issue-32709.rs)0
-rw-r--r--tests/ui/try-trait/issue-32709.stderr (renamed from tests/ui/issues/issue-32709.stderr)0
-rw-r--r--tests/ui/tuple/wrong_argument_ice-4.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs4
-rw-r--r--tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr24
-rw-r--r--tests/ui/type-alias-impl-trait/auxiliary/drop-shim-relates-opaque-aux.rs21
-rw-r--r--tests/ui/type-alias-impl-trait/cross_inference_pattern_bug.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/destructure_tait-ice-113594.rs19
-rw-r--r--tests/ui/type-alias-impl-trait/destructure_tait-layout_of-ice-113594.rs23
-rw-r--r--tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.rs6
-rw-r--r--tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/drop-shim-relates-opaque-issue-114375.rs10
-rw-r--r--tests/ui/type-alias-impl-trait/escaping-bound-var.rs22
-rw-r--r--tests/ui/type-alias-impl-trait/escaping-bound-var.stderr8
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.rs6
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr14
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_param_use.rs6
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_param_use.stderr26
-rw-r--r--tests/ui/type-alias-impl-trait/generic_lifetime_param.rs5
-rw-r--r--tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs4
-rw-r--r--tests/ui/type-alias-impl-trait/imply_bounds_from_bounds.rs20
-rw-r--r--tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.rs29
-rw-r--r--tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.stderr19
-rw-r--r--tests/ui/type-alias-impl-trait/inference-cycle.stderr24
-rw-r--r--tests/ui/type-alias-impl-trait/issue-53092-2.stderr5
-rw-r--r--tests/ui/type-alias-impl-trait/issue-63279.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/issue-89686.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/issue-89686.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/issue-94429.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/missing_lifetime_bound.rs5
-rw-r--r--tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr9
-rw-r--r--tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.rs6
-rw-r--r--tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-pass.rs6
-rw-r--r--tests/ui/type-alias-impl-trait/mututally-recursive-overflow.rs40
-rw-r--r--tests/ui/type-alias-impl-trait/mututally-recursive-overflow.stderr5
-rw-r--r--tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.rs9
-rw-r--r--tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.stderr47
-rw-r--r--tests/ui/type-alias-impl-trait/normalize-alias-type.rs32
-rw-r--r--tests/ui/type-alias-impl-trait/privacy.rs4
-rw-r--r--tests/ui/type-alias-impl-trait/privacy.stderr18
-rw-r--r--tests/ui/type-alias-impl-trait/reveal_local.stderr60
-rw-r--r--tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.current.stderr29
-rw-r--r--tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.rs32
-rw-r--r--tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query_2.rs18
-rw-r--r--tests/ui/type-alias-impl-trait/self_implication.rs4
-rw-r--r--tests/ui/type-alias-impl-trait/tait-normalize.rs14
-rw-r--r--tests/ui/type-alias-impl-trait/variance.rs44
-rw-r--r--tests/ui/type-alias-impl-trait/variance.stderr68
-rw-r--r--tests/ui/type/subtyping-opaque-type.rs19
-rw-r--r--tests/ui/type/type-arg-out-of-scope.rs2
-rw-r--r--tests/ui/type/type-arg-out-of-scope.stderr16
-rw-r--r--tests/ui/type/type-error-break-tail.stderr13
-rw-r--r--tests/ui/typeck/auxiliary/issue-29181.rs (renamed from tests/ui/issues/auxiliary/issue-29181.rs)0
-rw-r--r--tests/ui/typeck/issue-114918/const-in-fn-return-type.rs10
-rw-r--r--tests/ui/typeck/issue-114918/const-in-fn-return-type.stderr9
-rw-r--r--tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs20
-rw-r--r--tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.stderr9
-rw-r--r--tests/ui/typeck/issue-114918/const-in-struct-type-arg.rs12
-rw-r--r--tests/ui/typeck/issue-114918/const-in-struct-type-arg.stderr9
-rw-r--r--tests/ui/typeck/issue-114918/const-in-trait-fn-return-type.rs13
-rw-r--r--tests/ui/typeck/issue-114918/const-in-trait-fn-return-type.stderr9
-rw-r--r--tests/ui/typeck/issue-29181.rs (renamed from tests/ui/issues/issue-29181.rs)0
-rw-r--r--tests/ui/typeck/issue-29181.stderr (renamed from tests/ui/issues/issue-29181.stderr)0
-rw-r--r--tests/ui/typeck/issue-31173.stderr12
-rw-r--r--tests/ui/typeck/issue-90804-incorrect-reference-suggestion.stderr6
-rw-r--r--tests/ui/typeck/return_type_containing_closure.stderr2
-rw-r--r--tests/ui/typeck/typeck_type_placeholder_item.stderr2
-rw-r--r--tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr6
-rw-r--r--tests/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr4
-rw-r--r--tests/ui/unevaluated_fixed_size_array_len.stderr4
-rw-r--r--tests/ui/union/projection-as-union-type-error-2.stderr5
-rw-r--r--tests/ui/union/projection-as-union-type-error.stderr6
-rw-r--r--tests/ui/union/unnamed-fields/restrict_anonymous_structs.rs37
-rw-r--r--tests/ui/union/unnamed-fields/restrict_anonymous_structs.stderr78
-rw-r--r--tests/ui/union/unnamed-fields/restrict_anonymous_unions.rs37
-rw-r--r--tests/ui/union/unnamed-fields/restrict_anonymous_unions.stderr78
-rw-r--r--tests/ui/unknown-unstable-lints/deny-unstable-lint-command-line.stderr6
-rw-r--r--tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-command-line.stderr6
-rw-r--r--tests/ui/unreachable-code.rs15
-rw-r--r--tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs17
-rw-r--r--tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr16
-rw-r--r--tests/ui/unsafe/initializing-ranged-via-ctor.rs11
-rw-r--r--tests/ui/unsafe/initializing-ranged-via-ctor.stderr16
-rw-r--r--tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.rs16
-rw-r--r--tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.stderr21
-rw-r--r--tests/ui/unsafe/ranged-ctor-as-fn-ptr.rs10
-rw-r--r--tests/ui/unsafe/ranged-ctor-as-fn-ptr.stderr15
-rw-r--r--tests/ui/unsized/issue-115203.rs11
-rw-r--r--tests/ui/unsized/issue-115203.stderr19
-rw-r--r--tests/ui/unsized/issue-115809.rs13
-rw-r--r--tests/ui/unsized/issue-115809.stderr19
-rw-r--r--tests/ui/unsized/issue-75707.stderr5
-rw-r--r--tests/ui/unsized/unsized3.stderr12
-rw-r--r--tests/ui/wf/hir-wf-canonicalized.stderr12
-rw-r--r--tests/ui/wf/issue-95665.stderr5
-rw-r--r--tests/ui/wf/wf-complex-assoc-type.stderr5
-rw-r--r--tests/ui/wf/wf-foreign-fn-decl-ret.stderr11
-rw-r--r--tests/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr6
-rw-r--r--tests/ui/where-clauses/higher-ranked-fn-type.quiet.stderr5
-rw-r--r--tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr5
-rw-r--r--tests/ui/where-clauses/where-clause-method-substituion.stderr5
1974 files changed, 36403 insertions, 12202 deletions
diff --git a/tests/assembly/closure-inherit-target-feature.rs b/tests/assembly/closure-inherit-target-feature.rs
new file mode 100644
index 000000000..65728a155
--- /dev/null
+++ b/tests/assembly/closure-inherit-target-feature.rs
@@ -0,0 +1,58 @@
+// only-x86_64
+// assembly-output: emit-asm
+// make sure the feature is not enabled at compile-time
+// compile-flags: -C opt-level=3 -C target-feature=-sse4.1 -C llvm-args=-x86-asm-syntax=intel
+
+#![feature(target_feature_11)]
+#![crate_type = "rlib"]
+
+use std::arch::x86_64::{__m128, _mm_blend_ps};
+
+#[no_mangle]
+pub unsafe fn sse41_blend_nofeature(x: __m128, y: __m128) -> __m128 {
+ let f = {
+ // check that _mm_blend_ps is not being inlined into the closure
+ // CHECK-LABEL: {{sse41_blend_nofeature.*closure.*:}}
+ // CHECK-NOT: blendps
+ // CHECK: {{call .*_mm_blend_ps.*}}
+ // CHECK-NOT: blendps
+ // CHECK: ret
+ #[inline(never)] |x, y| _mm_blend_ps(x, y, 0b0101)
+ };
+ f(x, y)
+}
+
+#[target_feature(enable = "sse4.1")]
+pub fn sse41_blend_noinline(x: __m128, y: __m128) -> __m128 {
+ let f = {
+ // check that _mm_blend_ps is being inlined into the closure
+ // CHECK-LABEL: {{sse41_blend_noinline.*closure.*:}}
+ // CHECK-NOT: _mm_blend_ps
+ // CHECK: blendps
+ // CHECK-NOT: _mm_blend_ps
+ // CHECK: ret
+ #[inline(never)] |x, y| unsafe {
+ _mm_blend_ps(x, y, 0b0101)
+ }
+ };
+ f(x, y)
+}
+
+#[no_mangle]
+#[target_feature(enable = "sse4.1")]
+pub fn sse41_blend_doinline(x: __m128, y: __m128) -> __m128 {
+ // check that the closure and _mm_blend_ps are being inlined into the function
+ // CHECK-LABEL: sse41_blend_doinline:
+ // CHECK-NOT: {{sse41_blend_doinline.*closure.*}}
+ // CHECK-NOT: _mm_blend_ps
+ // CHECK: blendps
+ // CHECK-NOT: {{sse41_blend_doinline.*closure.*}}
+ // CHECK-NOT: _mm_blend_ps
+ // CHECK: ret
+ let f = {
+ #[inline] |x, y| unsafe {
+ _mm_blend_ps(x, y, 0b0101)
+ }
+ };
+ f(x, y)
+}
diff --git a/tests/codegen/asm-maybe-uninit.rs b/tests/codegen/asm-maybe-uninit.rs
new file mode 100644
index 000000000..d7e4a9489
--- /dev/null
+++ b/tests/codegen/asm-maybe-uninit.rs
@@ -0,0 +1,27 @@
+// compile-flags: -O
+// only-x86_64
+
+#![crate_type = "rlib"]
+#![allow(asm_sub_register)]
+
+use std::mem::MaybeUninit;
+use std::arch::asm;
+
+// CHECK-LABEL: @int
+#[no_mangle]
+pub unsafe fn int(x: MaybeUninit<i32>) -> MaybeUninit<i32> {
+ let y: MaybeUninit<i32>;
+ asm!("/*{}{}*/", in(reg) x, out(reg) y);
+ y
+}
+
+// CHECK-LABEL: @inout
+#[no_mangle]
+pub unsafe fn inout(mut x: i32) -> MaybeUninit<u32> {
+ let mut y: MaybeUninit<u32>;
+ asm!("/*{}*/", inout(reg) x => y);
+ asm!("/*{}*/", inout(reg) y => x);
+ asm!("/*{}*/", inlateout(reg) x => y);
+ asm!("/*{}*/", inlateout(reg) y => x);
+ y
+}
diff --git a/tests/codegen/async-fn-debug-awaitee-field.rs b/tests/codegen/async-fn-debug-awaitee-field.rs
index bc2686158..690505fd7 100644
--- a/tests/codegen/async-fn-debug-awaitee-field.rs
+++ b/tests/codegen/async-fn-debug-awaitee-field.rs
@@ -5,12 +5,14 @@
// ignore-tidy-linelength
// compile-flags: -C debuginfo=2 --edition=2018
-async fn foo() {}
+#![crate_type = "lib"]
-async fn async_fn_test() {
+pub async fn async_fn_test() {
foo().await;
}
+pub async fn foo() {}
+
// NONMSVC: [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "{async_fn_env#0}", scope: [[GEN_SCOPE:![0-9]*]],
// MSVC: [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_union_type, name: "enum2$<async_fn_debug_awaitee_field::async_fn_test::async_fn_env$0>",
// NONMSVC: [[GEN_SCOPE:!.*]] = !DINamespace(name: "async_fn_test",
@@ -19,7 +21,3 @@ async fn async_fn_test() {
// NONMSVC: [[AWAITEE_TYPE]] = !DICompositeType(tag: DW_TAG_structure_type, name: "{async_fn_env#0}", scope: [[AWAITEE_SCOPE:![0-9]*]],
// MSVC: [[AWAITEE_TYPE]] = !DICompositeType(tag: DW_TAG_union_type, name: "enum2$<async_fn_debug_awaitee_field::foo::async_fn_env$0>",
// NONMSVC: [[AWAITEE_SCOPE]] = !DINamespace(name: "foo",
-
-fn main() {
- let _fn = async_fn_test();
-}
diff --git a/tests/codegen/box-maybe-uninit.rs b/tests/codegen/box-uninit-bytes.rs
index 282af99b0..732da0a17 100644
--- a/tests/codegen/box-maybe-uninit.rs
+++ b/tests/codegen/box-uninit-bytes.rs
@@ -25,6 +25,20 @@ pub fn box_uninitialized2() -> Box<MaybeUninit<[usize; 1024 * 1024]>> {
Box::new(MaybeUninit::uninit())
}
+#[repr(align(1024))]
+pub struct LotsaPadding(usize);
+
+// Boxing a value with padding should not copy junk from the stack
+#[no_mangle]
+pub fn box_lotsa_padding() -> Box<LotsaPadding> {
+ // CHECK-LABEL: @box_lotsa_padding
+ // CHECK-NOT: alloca
+ // CHECK-NOT: getelementptr
+ // CHECK-NOT: memcpy
+ // CHECK-NOT: memset
+ Box::new(LotsaPadding(42))
+}
+
// Hide the `allocalign` attribute in the declaration of __rust_alloc
// from the CHECK-NOT above, and also verify the attributes got set reasonably.
// CHECK: declare {{(dso_local )?}}noalias noundef ptr @__rust_alloc(i{{[0-9]+}} noundef, i{{[0-9]+}} allocalign noundef) unnamed_addr [[RUST_ALLOC_ATTRS:#[0-9]+]]
diff --git a/tests/codegen/cold-call-declare-and-call.rs b/tests/codegen/cold-call-declare-and-call.rs
index 71d49478b..572dc407f 100644
--- a/tests/codegen/cold-call-declare-and-call.rs
+++ b/tests/codegen/cold-call-declare-and-call.rs
@@ -1,12 +1,21 @@
+// revisions: NORMAL WINDOWS
// compile-flags: -C no-prepopulate-passes
+//[NORMAL] ignore-windows
+//[WINDOWS] only-windows
+//[WINDOWS] only-x86_64
#![crate_type = "lib"]
#![feature(rust_cold_cc)]
// wasm marks the definition as `dso_local`, so allow that as optional.
-// CHECK: define{{( dso_local)?}} coldcc void @this_should_never_happen(i16
-// CHECK: call coldcc void @this_should_never_happen(i16
+// NORMAL: define{{( dso_local)?}} preserve_mostcc void @this_should_never_happen(i16
+// NORMAL: call preserve_mostcc void @this_should_never_happen(i16
+
+// See the comment in `Target::adjust_abi` for why this differs
+
+// WINDOWS: define void @this_should_never_happen(i16
+// WINDOWS: call void @this_should_never_happen(i16
#[no_mangle]
pub extern "rust-cold" fn this_should_never_happen(x: u16) {}
diff --git a/tests/codegen/debuginfo-inline-callsite-location.rs b/tests/codegen/debuginfo-inline-callsite-location.rs
new file mode 100644
index 000000000..b1475ee79
--- /dev/null
+++ b/tests/codegen/debuginfo-inline-callsite-location.rs
@@ -0,0 +1,28 @@
+// compile-flags: -g -O
+
+// Check that each inline call site for the same function uses the same "sub-program" so that LLVM
+// can correctly merge the debug info if it merges the inlined code (e.g., for merging of tail
+// calls to panic.
+
+// CHECK: tail call void @_ZN4core9panicking5panic17h{{([0-9a-z]{16})}}E
+// CHECK-SAME: !dbg ![[#first_dbg:]]
+// CHECK: tail call void @_ZN4core9panicking5panic17h{{([0-9a-z]{16})}}E
+// CHECK-SAME: !dbg ![[#second_dbg:]]
+
+// CHECK-DAG: ![[#func_dbg:]] = distinct !DISubprogram(name: "unwrap<i32>"
+// CHECK-DAG: ![[#first_scope:]] = distinct !DILexicalBlock(scope: ![[#func_dbg]],
+// CHECK: ![[#second_scope:]] = distinct !DILexicalBlock(scope: ![[#func_dbg]],
+// CHECK: ![[#first_dbg]] = !DILocation(line: [[#]]
+// CHECK-SAME: scope: ![[#first_scope]], inlinedAt: ![[#]])
+// CHECK: ![[#second_dbg]] = !DILocation(line: [[#]]
+// CHECK-SAME: scope: ![[#second_scope]], inlinedAt: ![[#]])
+
+#![crate_type = "lib"]
+
+#[no_mangle]
+extern "C" fn add_numbers(x: &Option<i32>, y: &Option<i32>) -> i32 {
+ let x1 = x.unwrap();
+ let y1 = y.unwrap();
+
+ x1 + y1
+}
diff --git a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs
index f345c96e6..54c50f840 100644
--- a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs
+++ b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs
@@ -15,8 +15,8 @@ pub fn outer_function(x: S, y: S) -> usize {
// 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: [[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: [[inner:%.*]] = getelementptr inbounds %"{{.*}}", ptr [[spill]]
diff --git a/tests/codegen/issues/issue-115385-llvm-jump-threading.rs b/tests/codegen/issues/issue-115385-llvm-jump-threading.rs
new file mode 100644
index 000000000..142e3596d
--- /dev/null
+++ b/tests/codegen/issues/issue-115385-llvm-jump-threading.rs
@@ -0,0 +1,46 @@
+// compile-flags: -O -Ccodegen-units=1
+
+#![crate_type = "lib"]
+
+#[repr(i64)]
+pub enum Boolean {
+ False = 0,
+ True = 1,
+}
+
+impl Clone for Boolean {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+
+impl Copy for Boolean {}
+
+extern "C" {
+ fn set_value(foo: *mut i64);
+ fn bar();
+}
+
+pub fn foo(x: bool) {
+ let mut foo = core::mem::MaybeUninit::<i64>::uninit();
+ unsafe {
+ set_value(foo.as_mut_ptr());
+ }
+
+ if x {
+ let l1 = unsafe { *foo.as_mut_ptr().cast::<Boolean>() };
+ if matches!(l1, Boolean::False) {
+ unsafe {
+ *foo.as_mut_ptr() = 0;
+ }
+ }
+ }
+
+ let l2 = unsafe { *foo.as_mut_ptr() };
+ if l2 == 2 {
+ // CHECK: call void @bar
+ unsafe {
+ bar();
+ }
+ }
+}
diff --git a/tests/codegen/lib-optimizations/iter-sum.rs b/tests/codegen/lib-optimizations/iter-sum.rs
new file mode 100644
index 000000000..ff7ca6ef6
--- /dev/null
+++ b/tests/codegen/lib-optimizations/iter-sum.rs
@@ -0,0 +1,15 @@
+// ignore-debug: the debug assertions get in the way
+// compile-flags: -O
+// only-x86_64 (vectorization varies between architectures)
+#![crate_type = "lib"]
+
+
+// Ensure that slice + take + sum gets vectorized.
+// Currently this relies on the slice::Iter::try_fold implementation
+// CHECK-LABEL: @slice_take_sum
+#[no_mangle]
+pub fn slice_take_sum(s: &[u64], l: usize) -> u64 {
+ // CHECK: vector.body:
+ // CHECK: ret
+ s.iter().take(l).sum()
+}
diff --git a/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs b/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs
index 7555553c2..591ccd45a 100644
--- a/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs
+++ b/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs
@@ -250,11 +250,11 @@ pub struct IntDoubleInt {
c: i32,
}
-// CHECK: define void @f_int_double_int_s_arg(ptr noalias nocapture noundef dereferenceable(24) %a)
+// CHECK: define void @f_int_double_int_s_arg(ptr noalias nocapture noundef align 8 dereferenceable(24) %a)
#[no_mangle]
pub extern "C" fn f_int_double_int_s_arg(a: IntDoubleInt) {}
-// CHECK: define void @f_ret_int_double_int_s(ptr noalias nocapture noundef sret(%IntDoubleInt) dereferenceable(24) %0)
+// CHECK: define void @f_ret_int_double_int_s(ptr noalias nocapture noundef sret(%IntDoubleInt) align 8 dereferenceable(24) %_0)
#[no_mangle]
pub extern "C" fn f_ret_int_double_int_s() -> IntDoubleInt {
IntDoubleInt { a: 1, b: 2., c: 3 }
diff --git a/tests/codegen/macos/i686-macosx-deployment-target.rs b/tests/codegen/macos/i686-macosx-deployment-target.rs
index 17258a264..ba49178dc 100644
--- a/tests/codegen/macos/i686-macosx-deployment-target.rs
+++ b/tests/codegen/macos/i686-macosx-deployment-target.rs
@@ -4,7 +4,7 @@
// compile-flags: -O --target=i686-apple-darwin --crate-type=rlib
// needs-llvm-components: x86
-// rustc-env:MACOSX_DEPLOYMENT_TARGET=10.9
+// rustc-env:MACOSX_DEPLOYMENT_TARGET=10.14
#![feature(no_core, lang_items)]
#![no_core]
@@ -20,7 +20,7 @@ pub struct Bool {
b: bool,
}
-// CHECK: target triple = "i686-apple-macosx10.9.0"
+// CHECK: target triple = "i686-apple-macosx10.14.0"
#[no_mangle]
pub extern "C" fn structbool() -> Bool {
Bool { b: true }
diff --git a/tests/codegen/macos/i686-no-macosx-deployment-target.rs b/tests/codegen/macos/i686-no-macosx-deployment-target.rs
index 043040a95..479fe7968 100644
--- a/tests/codegen/macos/i686-no-macosx-deployment-target.rs
+++ b/tests/codegen/macos/i686-no-macosx-deployment-target.rs
@@ -20,7 +20,7 @@ pub struct Bool {
b: bool,
}
-// CHECK: target triple = "i686-apple-macosx10.7.0"
+// CHECK: target triple = "i686-apple-macosx10.12.0"
#[no_mangle]
pub extern "C" fn structbool() -> Bool {
Bool { b: true }
diff --git a/tests/codegen/macos/x86_64-macosx-deployment-target.rs b/tests/codegen/macos/x86_64-macosx-deployment-target.rs
index 8e673d11d..957c727bb 100644
--- a/tests/codegen/macos/x86_64-macosx-deployment-target.rs
+++ b/tests/codegen/macos/x86_64-macosx-deployment-target.rs
@@ -4,7 +4,7 @@
// compile-flags: -O --target=x86_64-apple-darwin --crate-type=rlib
// needs-llvm-components: x86
-// rustc-env:MACOSX_DEPLOYMENT_TARGET=10.9
+// rustc-env:MACOSX_DEPLOYMENT_TARGET=10.14
#![feature(no_core, lang_items)]
#![no_core]
@@ -20,7 +20,7 @@ pub struct Bool {
b: bool,
}
-// CHECK: target triple = "x86_64-apple-macosx10.9.0"
+// CHECK: target triple = "x86_64-apple-macosx10.14.0"
#[no_mangle]
pub extern "C" fn structbool() -> Bool {
Bool { b: true }
diff --git a/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs b/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs
index 25ae6924d..edbc1b66c 100644
--- a/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs
+++ b/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs
@@ -20,7 +20,7 @@ pub struct Bool {
b: bool,
}
-// CHECK: target triple = "x86_64-apple-macosx10.7.0"
+// CHECK: target triple = "x86_64-apple-macosx10.12.0"
#[no_mangle]
pub extern "C" fn structbool() -> Bool {
Bool { b: true }
diff --git a/tests/codegen/move-before-nocapture-ref-arg.rs b/tests/codegen/move-before-nocapture-ref-arg.rs
new file mode 100644
index 000000000..c7b400c8f
--- /dev/null
+++ b/tests/codegen/move-before-nocapture-ref-arg.rs
@@ -0,0 +1,22 @@
+// Verify that move before the call of the function with noalias, nocapture, readonly.
+// #107436
+// compile-flags: -O
+// min-llvm-version: 17
+
+#![crate_type = "lib"]
+
+#[repr(C)]
+pub struct ThreeSlices<'a>(&'a [u32], &'a [u32], &'a [u32]);
+
+#[no_mangle]
+pub fn sum_slices(val: ThreeSlices) -> u32 {
+ // CHECK-NOT: memcpy
+ let val = val;
+ sum(&val)
+}
+
+#[no_mangle]
+#[inline(never)]
+pub fn sum(val: &ThreeSlices) -> u32 {
+ val.0.iter().sum::<u32>() + val.1.iter().sum::<u32>() + val.2.iter().sum::<u32>()
+}
diff --git a/tests/codegen/repr/transparent.rs b/tests/codegen/repr/transparent.rs
index b140fc719..c5974248b 100644
--- a/tests/codegen/repr/transparent.rs
+++ b/tests/codegen/repr/transparent.rs
@@ -43,7 +43,6 @@ pub extern "C" fn test_WithZst(_: WithZst) -> WithZst { loop {} }
#[repr(transparent)]
pub struct WithZeroSizedArray(*const f32, [i8; 0]);
-// Apparently we use i32* when newtype-unwrapping f32 pointers. Whatever.
// CHECK: define{{.*}}ptr @test_WithZeroSizedArray(ptr noundef %_1)
#[no_mangle]
pub extern "C" fn test_WithZeroSizedArray(_: WithZeroSizedArray) -> WithZeroSizedArray { loop {} }
diff --git a/tests/codegen/sanitizer/address-sanitizer-globals-tracking.rs b/tests/codegen/sanitizer/address-sanitizer-globals-tracking.rs
new file mode 100644
index 000000000..e9dd04e19
--- /dev/null
+++ b/tests/codegen/sanitizer/address-sanitizer-globals-tracking.rs
@@ -0,0 +1,44 @@
+// Verifies that AddressSanitizer symbols show up as expected in LLVM IR with `-Zsanitizer`.
+// This is a regression test for https://github.com/rust-lang/rust/issues/113404
+//
+// Notes about the `compile-flags` below:
+//
+// * The original issue only reproed with LTO - this is why this angle has
+// extra test coverage via different `revisions`
+// * To observe the failure/repro at LLVM-IR level we need to use `staticlib`
+// which necessitates `-C prefer-dynamic=false` - without the latter flag,
+// we would have run into "cannot prefer dynamic linking when performing LTO".
+//
+// The test is restricted to `only-linux`, because the sanitizer-related instrumentation is target
+// specific. In particular, `___asan_globals_registered` is only used in the
+// `InstrumentGlobalsELF` and `InstrumentGlobalsMachO` code paths. The `only-linux` filter is
+// narrower than really needed (i.e. narrower than ELF-or-MachO), but this seems ok - having a
+// linux-only regression test should be sufficient here.
+//
+// needs-sanitizer-address
+// only-linux
+//
+// revisions:ASAN ASAN-FAT-LTO
+// compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static
+//[ASAN] compile-flags:
+//[ASAN-FAT-LTO] compile-flags: -Cprefer-dynamic=false -Clto=fat
+
+#![crate_type="staticlib"]
+
+// The test below mimics `CACHED_POW10` from `library/core/src/num/flt2dec/strategy/grisu.rs` which
+// (because of incorrect handling of `___asan_globals_registered` during LTO) was incorrectly
+// reported as an ODR violation in https://crbug.com/1459233#c1. Before this bug was fixed,
+// `___asan_globals_registered` would show up as `internal global i64` rather than `common hidden
+// global i64`. (The test expectations ignore the exact type because on `arm-android` the type
+// is `i32` rather than `i64`.)
+//
+// CHECK: @___asan_globals_registered = common hidden global
+// CHECK: @__start_asan_globals = extern_weak hidden global
+// CHECK: @__stop_asan_globals = extern_weak hidden global
+#[no_mangle]
+pub static CACHED_POW10: [(u64, i16, i16); 4] = [
+ (0xe61acf033d1a45df, -1087, -308),
+ (0xab70fe17c79ac6ca, -1060, -300),
+ (0xff77b1fcbebcdc4f, -1034, -292),
+ (0xbe5691ef416bd60c, -1007, -284),
+];
diff --git a/tests/codegen/sanitizer/cfi-emit-type-metadata-id-itanium-cxx-abi.rs b/tests/codegen/sanitizer/cfi-emit-type-metadata-id-itanium-cxx-abi.rs
index da608e180..2d8b13e20 100644
--- a/tests/codegen/sanitizer/cfi-emit-type-metadata-id-itanium-cxx-abi.rs
+++ b/tests/codegen/sanitizer/cfi-emit-type-metadata-id-itanium-cxx-abi.rs
@@ -500,12 +500,12 @@ pub fn foo149(_: Type14<Bar>, _: Type14<Bar>, _: Type14<Bar>) { }
// CHECK: ![[TYPE45]] = !{i64 0, !"_ZTSFvu5usizeE"}
// CHECK: ![[TYPE46]] = !{i64 0, !"_ZTSFvu5usizeS_E"}
// CHECK: ![[TYPE47]] = !{i64 0, !"_ZTSFvu5usizeS_S_E"}
-// CHECK: ![[TYPE48]] = !{i64 0, !"_ZTSFvu3f32E"}
-// CHECK: ![[TYPE49]] = !{i64 0, !"_ZTSFvu3f32S_E"}
-// CHECK: ![[TYPE50]] = !{i64 0, !"_ZTSFvu3f32S_S_E"}
-// CHECK: ![[TYPE51]] = !{i64 0, !"_ZTSFvu3f64E"}
-// CHECK: ![[TYPE52]] = !{i64 0, !"_ZTSFvu3f64S_E"}
-// CHECK: ![[TYPE53]] = !{i64 0, !"_ZTSFvu3f64S_S_E"}
+// CHECK: ![[TYPE48]] = !{i64 0, !"_ZTSFvfE"}
+// CHECK: ![[TYPE49]] = !{i64 0, !"_ZTSFvffE"}
+// CHECK: ![[TYPE50]] = !{i64 0, !"_ZTSFvfffE"}
+// CHECK: ![[TYPE51]] = !{i64 0, !"_ZTSFvdE"}
+// CHECK: ![[TYPE52]] = !{i64 0, !"_ZTSFvddE"}
+// CHECK: ![[TYPE53]] = !{i64 0, !"_ZTSFvdddE"}
// CHECK: ![[TYPE54]] = !{i64 0, !"_ZTSFvu4charE"}
// CHECK: ![[TYPE55]] = !{i64 0, !"_ZTSFvu4charS_E"}
// CHECK: ![[TYPE56]] = !{i64 0, !"_ZTSFvu4charS_S_E"}
diff --git a/tests/codegen/sanitizer/kcfi-add-kcfi-flag.rs b/tests/codegen/sanitizer/kcfi-add-kcfi-flag.rs
index c2eb852ae..6d466b93c 100644
--- a/tests/codegen/sanitizer/kcfi-add-kcfi-flag.rs
+++ b/tests/codegen/sanitizer/kcfi-add-kcfi-flag.rs
@@ -1,9 +1,20 @@
// Verifies that "kcfi" module flag is added.
//
-// needs-sanitizer-kcfi
+// revisions: aarch64 x86_64
+// [aarch64] compile-flags: --target aarch64-unknown-none
+// [aarch64] needs-llvm-components: aarch64
+// [x86_64] compile-flags: --target x86_64-unknown-none
+// [x86_64] needs-llvm-components: x86
// compile-flags: -Ctarget-feature=-crt-static -Zsanitizer=kcfi
+#![feature(no_core, lang_items)]
#![crate_type="lib"]
+#![no_core]
+
+#[lang="sized"]
+trait Sized { }
+#[lang="copy"]
+trait Copy { }
pub fn foo() {
}
diff --git a/tests/codegen/sanitizer/memory-track-origins.rs b/tests/codegen/sanitizer/memory-track-origins.rs
index 4bd50508d..e15a3b227 100644
--- a/tests/codegen/sanitizer/memory-track-origins.rs
+++ b/tests/codegen/sanitizer/memory-track-origins.rs
@@ -4,11 +4,12 @@
// needs-sanitizer-memory
// revisions:MSAN-0 MSAN-1 MSAN-2 MSAN-1-LTO MSAN-2-LTO
//
-//[MSAN-0] compile-flags: -Zsanitizer=memory
-//[MSAN-1] compile-flags: -Zsanitizer=memory -Zsanitizer-memory-track-origins=1
-//[MSAN-2] compile-flags: -Zsanitizer=memory -Zsanitizer-memory-track-origins
-//[MSAN-1-LTO] compile-flags: -Zsanitizer=memory -Zsanitizer-memory-track-origins=1 -C lto=fat
-//[MSAN-2-LTO] compile-flags: -Zsanitizer=memory -Zsanitizer-memory-track-origins -C lto=fat
+// compile-flags: -Zsanitizer=memory -Ctarget-feature=-crt-static
+//[MSAN-0] compile-flags:
+//[MSAN-1] compile-flags: -Zsanitizer-memory-track-origins=1
+//[MSAN-2] compile-flags: -Zsanitizer-memory-track-origins
+//[MSAN-1-LTO] compile-flags: -Zsanitizer-memory-track-origins=1 -C lto=fat
+//[MSAN-2-LTO] compile-flags: -Zsanitizer-memory-track-origins -C lto=fat
#![crate_type="lib"]
diff --git a/tests/codegen/sanitizer/no-sanitize-inlining.rs b/tests/codegen/sanitizer/no-sanitize-inlining.rs
index f4af60bae..e371b19eb 100644
--- a/tests/codegen/sanitizer/no-sanitize-inlining.rs
+++ b/tests/codegen/sanitizer/no-sanitize-inlining.rs
@@ -4,8 +4,9 @@
// needs-sanitizer-address
// needs-sanitizer-leak
// revisions: ASAN LSAN
-//[ASAN] compile-flags: -Zsanitizer=address -C opt-level=3 -Z mir-opt-level=4
-//[LSAN] compile-flags: -Zsanitizer=leak -C opt-level=3 -Z mir-opt-level=4
+// compile-flags: -Copt-level=3 -Zmir-opt-level=4 -Ctarget-feature=-crt-static
+//[ASAN] compile-flags: -Zsanitizer=address
+//[LSAN] compile-flags: -Zsanitizer=leak
#![crate_type="lib"]
#![feature(no_sanitize)]
diff --git a/tests/codegen/sanitizer/no-sanitize.rs b/tests/codegen/sanitizer/no-sanitize.rs
index 783b568e2..d0b692434 100644
--- a/tests/codegen/sanitizer/no-sanitize.rs
+++ b/tests/codegen/sanitizer/no-sanitize.rs
@@ -2,7 +2,7 @@
// selectively disable sanitizer instrumentation.
//
// needs-sanitizer-address
-// compile-flags: -Zsanitizer=address
+// compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static
#![crate_type="lib"]
#![feature(no_sanitize)]
diff --git a/tests/codegen/sanitizer/sanitizer-recover.rs b/tests/codegen/sanitizer/sanitizer-recover.rs
index 7b00fcf8e..59b1fdd64 100644
--- a/tests/codegen/sanitizer/sanitizer-recover.rs
+++ b/tests/codegen/sanitizer/sanitizer-recover.rs
@@ -6,6 +6,7 @@
// revisions:ASAN ASAN-RECOVER MSAN MSAN-RECOVER MSAN-RECOVER-LTO
// no-prefer-dynamic
//
+// compile-flags: -Ctarget-feature=-crt-static
//[ASAN] compile-flags: -Zsanitizer=address -Copt-level=0
//[ASAN-RECOVER] compile-flags: -Zsanitizer=address -Zsanitizer-recover=address -Copt-level=0
//[MSAN] compile-flags: -Zsanitizer=memory
diff --git a/tests/codegen/slice-as_chunks.rs b/tests/codegen/slice-as_chunks.rs
index 48e3f73fc..efac9f3d6 100644
--- a/tests/codegen/slice-as_chunks.rs
+++ b/tests/codegen/slice-as_chunks.rs
@@ -22,9 +22,9 @@ pub fn chunks4(x: &[u8]) -> &[[u8; 4]] {
// CHECK-LABEL: @chunks4_with_remainder
#[no_mangle]
pub fn chunks4_with_remainder(x: &[u8]) -> (&[[u8; 4]], &[u8]) {
- // CHECK: and i64 %x.1, -4
- // CHECK: and i64 %x.1, 3
- // CHECK: lshr exact
+ // CHECK-DAG: and i64 %x.1, -4
+ // CHECK-DAG: and i64 %x.1, 3
+ // CHECK-DAG: lshr
// CHECK-NOT: mul
// CHECK-NOT: udiv
// CHECK-NOT: urem
diff --git a/tests/codegen/slice-iter-nonnull.rs b/tests/codegen/slice-iter-nonnull.rs
index f7d164bc8..8749226d4 100644
--- a/tests/codegen/slice-iter-nonnull.rs
+++ b/tests/codegen/slice-iter-nonnull.rs
@@ -100,13 +100,13 @@ pub fn slice_iter_is_empty(it: &std::slice::Iter<'_, u32>) -> bool {
// CHECK-LABEL: @slice_iter_len
#[no_mangle]
pub fn slice_iter_len(it: &std::slice::Iter<'_, u32>) -> usize {
- // CHECK: %[[START:.+]] = load ptr, ptr %it,
- // CHECK-SAME: !nonnull
- // CHECK-SAME: !noundef
// CHECK: %[[ENDP:.+]] = getelementptr{{.+}}ptr %it,{{.+}} 1
// CHECK: %[[END:.+]] = load ptr, ptr %[[ENDP]]
// CHECK-SAME: !nonnull
// CHECK-SAME: !noundef
+ // CHECK: %[[START:.+]] = load ptr, ptr %it,
+ // CHECK-SAME: !nonnull
+ // CHECK-SAME: !noundef
// CHECK: ptrtoint
// CHECK: ptrtoint
diff --git a/tests/codegen/tuple-layout-opt.rs b/tests/codegen/tuple-layout-opt.rs
index 309fe1d5e..7cc67a9b5 100644
--- a/tests/codegen/tuple-layout-opt.rs
+++ b/tests/codegen/tuple-layout-opt.rs
@@ -1,4 +1,3 @@
-// ignore-emscripten
// compile-flags: -C no-prepopulate-passes -Copt-level=0
// Test that tuples get optimized layout, in particular with a ZST in the last field (#63244)
diff --git a/tests/codegen/vecdeque-nonempty-get-no-panic.rs b/tests/codegen/vecdeque-nonempty-get-no-panic.rs
new file mode 100644
index 000000000..c2877d2d0
--- /dev/null
+++ b/tests/codegen/vecdeque-nonempty-get-no-panic.rs
@@ -0,0 +1,17 @@
+// Guards against regression for optimization discussed in issue #80836
+
+// compile-flags: -O
+// ignore-debug: the debug assertions get in the way
+
+#![crate_type = "lib"]
+
+use std::collections::VecDeque;
+
+// CHECK-LABEL: @front
+// CHECK: ret void
+#[no_mangle]
+pub fn front(v: VecDeque<usize>) {
+ if !v.is_empty() {
+ v.get(0).unwrap();
+ }
+}
diff --git a/tests/coverage-map/README.md b/tests/coverage-map/README.md
new file mode 100644
index 000000000..60d1352cd
--- /dev/null
+++ b/tests/coverage-map/README.md
@@ -0,0 +1,13 @@
+The tests in `./status-quo` were copied from `tests/run-coverage` in order to
+capture the current behavior of the instrumentor on non-trivial programs.
+The actual mappings have not been closely inspected.
+
+## Maintenance note
+
+These tests can be sensitive to small changes in MIR spans or MIR control flow,
+especially in HIR-to-MIR lowering or MIR optimizations.
+
+If you haven't touched the coverage code directly, and the `run-coverage` test
+suite still works, then it should usually be OK to just `--bless` these
+coverage mapping tests as necessary, without worrying too much about the exact
+changes.
diff --git a/tests/coverage-map/if.cov-map b/tests/coverage-map/if.cov-map
new file mode 100644
index 000000000..3cedb5ffb
--- /dev/null
+++ b/tests/coverage-map/if.cov-map
@@ -0,0 +1,15 @@
+Function name: if::main
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 03, 01, 02, 0c, 05, 02, 0d, 02, 06, 02, 02, 06, 00, 07, 07, 01, 05, 01, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 3, 1) to (start + 2, 12)
+- Code(Counter(1)) at (prev + 2, 13) to (start + 2, 6)
+- Code(Expression(0, Sub)) at (prev + 2, 6) to (start + 0, 7)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 1, 5) to (start + 1, 2)
+ = (c1 + (c0 - c1))
+
diff --git a/tests/coverage-map/if.rs b/tests/coverage-map/if.rs
new file mode 100644
index 000000000..ed3f69bdc
--- /dev/null
+++ b/tests/coverage-map/if.rs
@@ -0,0 +1,9 @@
+// compile-flags: --edition=2021
+
+fn main() {
+ let cond = std::env::args().len() == 1;
+ if cond {
+ println!("true");
+ }
+ println!("done");
+}
diff --git a/tests/coverage-map/long_and_wide.cov-map b/tests/coverage-map/long_and_wide.cov-map
new file mode 100644
index 000000000..97aebf9b1
--- /dev/null
+++ b/tests/coverage-map/long_and_wide.cov-map
@@ -0,0 +1,32 @@
+Function name: long_and_wide::far_function
+Raw bytes (10): 0x[01, 01, 00, 01, 01, 96, 01, 01, 00, 15]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 150, 1) to (start + 0, 21)
+
+Function name: long_and_wide::long_function
+Raw bytes (10): 0x[01, 01, 00, 01, 01, 10, 01, 84, 01, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 16, 1) to (start + 132, 2)
+
+Function name: long_and_wide::main
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 07, 01, 04, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 7, 1) to (start + 4, 2)
+
+Function name: long_and_wide::wide_function
+Raw bytes (10): 0x[01, 01, 00, 01, 01, 0e, 01, 00, 8b, 01]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 14, 1) to (start + 0, 139)
+
diff --git a/tests/coverage-map/long_and_wide.rs b/tests/coverage-map/long_and_wide.rs
new file mode 100644
index 000000000..a7cbcd480
--- /dev/null
+++ b/tests/coverage-map/long_and_wide.rs
@@ -0,0 +1,150 @@
+// compile-flags: --edition=2021
+// ignore-tidy-linelength
+
+// This file deliberately contains line and column numbers larger than 127,
+// to verify that `coverage-dump`'s ULEB128 parser can handle them.
+
+fn main() {
+ wide_function();
+ long_function();
+ far_function();
+}
+
+#[rustfmt::skip]
+fn wide_function() { /* */ (); }
+
+fn long_function() {
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+}
+
+fn far_function() {}
diff --git a/tests/coverage-map/status-quo/abort.cov-map b/tests/coverage-map/status-quo/abort.cov-map
new file mode 100644
index 000000000..45d3795ef
--- /dev/null
+++ b/tests/coverage-map/status-quo/abort.cov-map
@@ -0,0 +1,57 @@
+Function name: abort::main
+Raw bytes (105): 0x[01, 01, 12, 01, 47, 05, 09, 03, 0d, 42, 11, 03, 0d, 11, 3e, 42, 11, 03, 0d, 3b, 15, 11, 3e, 42, 11, 03, 0d, 15, 36, 3b, 15, 11, 3e, 42, 11, 03, 0d, 05, 09, 0d, 01, 0d, 01, 01, 1b, 03, 02, 0b, 00, 18, 42, 01, 0c, 00, 19, 11, 00, 1a, 02, 0a, 3e, 02, 0a, 00, 0b, 3b, 02, 0c, 00, 19, 15, 00, 1a, 00, 31, 36, 00, 31, 00, 32, 33, 04, 0c, 00, 19, 05, 00, 1a, 00, 31, 09, 00, 31, 00, 32, 47, 01, 09, 00, 17, 0d, 02, 05, 01, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 18
+- expression 0 operands: lhs = Counter(0), rhs = Expression(17, Add)
+- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 3 operands: lhs = Expression(16, Sub), rhs = Counter(4)
+- expression 4 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 5 operands: lhs = Counter(4), rhs = Expression(15, Sub)
+- expression 6 operands: lhs = Expression(16, Sub), rhs = Counter(4)
+- expression 7 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 8 operands: lhs = Expression(14, Add), rhs = Counter(5)
+- expression 9 operands: lhs = Counter(4), rhs = Expression(15, Sub)
+- expression 10 operands: lhs = Expression(16, Sub), rhs = Counter(4)
+- expression 11 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 12 operands: lhs = Counter(5), rhs = Expression(13, Sub)
+- expression 13 operands: lhs = Expression(14, Add), rhs = Counter(5)
+- expression 14 operands: lhs = Counter(4), rhs = Expression(15, Sub)
+- expression 15 operands: lhs = Expression(16, Sub), rhs = Counter(4)
+- expression 16 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 17 operands: lhs = Counter(1), rhs = Counter(2)
+Number of file 0 mappings: 13
+- Code(Counter(0)) at (prev + 13, 1) to (start + 1, 27)
+- Code(Expression(0, Add)) at (prev + 2, 11) to (start + 0, 24)
+ = (c0 + (c1 + c2))
+- Code(Expression(16, Sub)) at (prev + 1, 12) to (start + 0, 25)
+ = ((c0 + (c1 + c2)) - c3)
+- Code(Counter(4)) at (prev + 0, 26) to (start + 2, 10)
+- Code(Expression(15, Sub)) at (prev + 2, 10) to (start + 0, 11)
+ = (((c0 + (c1 + c2)) - c3) - c4)
+- Code(Expression(14, Add)) at (prev + 2, 12) to (start + 0, 25)
+ = (c4 + (((c0 + (c1 + c2)) - c3) - c4))
+- Code(Counter(5)) at (prev + 0, 26) to (start + 0, 49)
+- Code(Expression(13, Sub)) at (prev + 0, 49) to (start + 0, 50)
+ = ((c4 + (((c0 + (c1 + c2)) - c3) - c4)) - c5)
+- Code(Expression(12, Add)) at (prev + 4, 12) to (start + 0, 25)
+ = (c5 + ((c4 + (((c0 + (c1 + c2)) - c3) - c4)) - c5))
+- Code(Counter(1)) at (prev + 0, 26) to (start + 0, 49)
+- Code(Counter(2)) at (prev + 0, 49) to (start + 0, 50)
+- Code(Expression(17, Add)) at (prev + 1, 9) to (start + 0, 23)
+ = (c1 + c2)
+- Code(Counter(3)) at (prev + 2, 5) to (start + 1, 2)
+
+Function name: abort::might_abort
+Raw bytes (21): 0x[01, 01, 01, 01, 05, 03, 01, 04, 01, 01, 14, 05, 02, 09, 01, 24, 02, 02, 0c, 03, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 1
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+Number of file 0 mappings: 3
+- Code(Counter(0)) at (prev + 4, 1) to (start + 1, 20)
+- Code(Counter(1)) at (prev + 2, 9) to (start + 1, 36)
+- Code(Expression(0, Sub)) at (prev + 2, 12) to (start + 3, 2)
+ = (c0 - c1)
+
diff --git a/tests/coverage-map/status-quo/abort.rs b/tests/coverage-map/status-quo/abort.rs
new file mode 100644
index 000000000..98264bdc1
--- /dev/null
+++ b/tests/coverage-map/status-quo/abort.rs
@@ -0,0 +1,66 @@
+#![feature(c_unwind)]
+#![allow(unused_assignments)]
+
+extern "C" fn might_abort(should_abort: bool) {
+ if should_abort {
+ println!("aborting...");
+ panic!("panics and aborts");
+ } else {
+ println!("Don't Panic");
+ }
+}
+
+fn main() -> Result<(), u8> {
+ let mut countdown = 10;
+ while countdown > 0 {
+ if countdown < 5 {
+ might_abort(false);
+ }
+ // See discussion (below the `Notes` section) on coverage results for the closing brace.
+ if countdown < 5 { might_abort(false); } // Counts for different regions on one line.
+ // For the following example, the closing brace is the last character on the line.
+ // This shows the character after the closing brace is highlighted, even if that next
+ // character is a newline.
+ if countdown < 5 { might_abort(false); }
+ countdown -= 1;
+ }
+ Ok(())
+}
+
+// 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 `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
+// intended"). Coverage results would show no executed coverage regions.
+// 6. If `should_abort` is `true` and the program aborts, the program exits with a `132` status
+// (on Linux at least).
+
+/*
+
+Expect the following coverage results:
+
+```text
+ 16| 11| while countdown > 0 {
+ 17| 10| if countdown < 5 {
+ 18| 4| might_abort(false);
+ 19| 6| }
+```
+
+This is actually correct.
+
+The condition `countdown < 5` executed 10 times (10 loop iterations).
+
+It evaluated to `true` 4 times, and executed the `might_abort()` call.
+
+It skipped the body of the `might_abort()` call 6 times. If an `if` does not include an explicit
+`else`, the coverage implementation injects a counter, at the character immediately after the `if`s
+closing brace, to count the "implicit" `else`. This is the only way to capture the coverage of the
+non-true condition.
+
+As another example of why this is important, say the condition was `countdown < 50`, which is always
+`true`. In that case, we wouldn't have a test for what happens if `might_abort()` is not called.
+The closing brace would have a count of `0`, highlighting the missed coverage.
+*/
diff --git a/tests/coverage-map/status-quo/assert.cov-map b/tests/coverage-map/status-quo/assert.cov-map
new file mode 100644
index 000000000..dd413123d
--- /dev/null
+++ b/tests/coverage-map/status-quo/assert.cov-map
@@ -0,0 +1,40 @@
+Function name: assert::main
+Raw bytes (65): 0x[01, 01, 08, 01, 1b, 05, 1f, 09, 0d, 03, 11, 16, 05, 03, 11, 05, 1f, 09, 0d, 09, 01, 09, 01, 01, 1b, 03, 02, 0b, 00, 18, 16, 01, 0c, 00, 1a, 05, 00, 1b, 02, 0a, 12, 02, 13, 00, 20, 09, 00, 21, 02, 0a, 0d, 02, 0a, 00, 0b, 1b, 01, 09, 00, 17, 11, 02, 05, 01, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 8
+- expression 0 operands: lhs = Counter(0), rhs = Expression(6, Add)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(7, Add)
+- expression 2 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 3 operands: lhs = Expression(0, Add), rhs = Counter(4)
+- expression 4 operands: lhs = Expression(5, Sub), rhs = Counter(1)
+- expression 5 operands: lhs = Expression(0, Add), rhs = Counter(4)
+- expression 6 operands: lhs = Counter(1), rhs = Expression(7, Add)
+- expression 7 operands: lhs = Counter(2), rhs = Counter(3)
+Number of file 0 mappings: 9
+- Code(Counter(0)) at (prev + 9, 1) to (start + 1, 27)
+- Code(Expression(0, Add)) at (prev + 2, 11) to (start + 0, 24)
+ = (c0 + (c1 + (c2 + c3)))
+- Code(Expression(5, Sub)) at (prev + 1, 12) to (start + 0, 26)
+ = ((c0 + (c1 + (c2 + c3))) - c4)
+- Code(Counter(1)) at (prev + 0, 27) to (start + 2, 10)
+- Code(Expression(4, Sub)) at (prev + 2, 19) to (start + 0, 32)
+ = (((c0 + (c1 + (c2 + c3))) - c4) - c1)
+- Code(Counter(2)) at (prev + 0, 33) to (start + 2, 10)
+- Code(Counter(3)) at (prev + 2, 10) to (start + 0, 11)
+- Code(Expression(6, Add)) at (prev + 1, 9) to (start + 0, 23)
+ = (c1 + (c2 + c3))
+- Code(Counter(4)) at (prev + 2, 5) to (start + 1, 2)
+
+Function name: assert::might_fail_assert
+Raw bytes (21): 0x[01, 01, 01, 01, 05, 03, 01, 04, 01, 02, 0f, 02, 02, 25, 00, 3d, 05, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 1
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+Number of file 0 mappings: 3
+- Code(Counter(0)) at (prev + 4, 1) to (start + 2, 15)
+- Code(Expression(0, Sub)) at (prev + 2, 37) to (start + 0, 61)
+ = (c0 - c1)
+- Code(Counter(1)) at (prev + 1, 1) to (start + 0, 2)
+
diff --git a/tests/coverage-map/status-quo/assert.rs b/tests/coverage-map/status-quo/assert.rs
new file mode 100644
index 000000000..85e6662a6
--- /dev/null
+++ b/tests/coverage-map/status-quo/assert.rs
@@ -0,0 +1,32 @@
+#![allow(unused_assignments)]
+// failure-status: 101
+
+fn might_fail_assert(one_plus_one: u32) {
+ println!("does 1 + 1 = {}?", one_plus_one);
+ assert_eq!(1 + 1, one_plus_one, "the argument was wrong");
+}
+
+fn main() -> Result<(), u8> {
+ let mut countdown = 10;
+ while countdown > 0 {
+ if countdown == 1 {
+ might_fail_assert(3);
+ } else if countdown < 5 {
+ might_fail_assert(2);
+ }
+ countdown -= 1;
+ }
+ Ok(())
+}
+
+// Notes:
+// 1. Compare this program and its coverage results to those of the very similar test
+// `panic_unwind.rs`, and similar tests `abort.rs` and `try_error_result.rs`.
+// 2. This test confirms the coverage generated when a program passes or fails an `assert!()` or
+// related `assert_*!()` macro.
+// 3. Notably, the `assert` macros *do not* generate `TerminatorKind::Assert`. The macros produce
+// conditional expressions, `TerminatorKind::SwitchInt` branches, and a possible call to
+// `begin_panic_fmt()` (that begins a panic unwind, if the assertion test fails).
+// 4. `TerminatoKind::Assert` is, however, also present in the MIR generated for this test
+// (and in many other coverage tests). The `Assert` terminator is typically generated by the
+// Rust compiler to check for runtime failures, such as numeric overflows.
diff --git a/tests/coverage-map/status-quo/async.cov-map b/tests/coverage-map/status-quo/async.cov-map
new file mode 100644
index 000000000..5f28252ef
--- /dev/null
+++ b/tests/coverage-map/status-quo/async.cov-map
@@ -0,0 +1,340 @@
+Function name: async::c
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 05, 01, 00, 19]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 5, 1) to (start + 0, 25)
+
+Function name: async::c::{closure#0}
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 05, 19, 01, 0e, 05, 02, 09, 00, 0a, 02, 02, 09, 00, 0a, 07, 02, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 5, 25) to (start + 1, 14)
+- Code(Counter(1)) at (prev + 2, 9) to (start + 0, 10)
+- Code(Expression(0, Sub)) at (prev + 2, 9) to (start + 0, 10)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 2, 1) to (start + 0, 2)
+ = (c1 + (c0 - c1))
+
+Function name: async::d
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 0d, 01, 00, 14]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 13, 1) to (start + 0, 20)
+
+Function name: async::d::{closure#0}
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 0d, 14, 00, 19]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 13, 20) to (start + 0, 25)
+
+Function name: async::e (unused)
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 0f, 01, 00, 14]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 15, 1) to (start + 0, 20)
+
+Function name: async::e::{closure#0} (unused)
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 0f, 14, 00, 19]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 15, 20) to (start + 0, 25)
+
+Function name: async::executor::block_on::<core::pin::Pin<&mut async::i::{closure#0}>>
+Raw bytes (44): 0x[01, 01, 05, 0b, 05, 01, 05, 01, 05, 02, 00, 02, 00, 06, 01, 6e, 05, 0a, 36, 02, 0d, 20, 00, 23, 0b, 00, 27, 00, 49, 0f, 01, 17, 00, 1a, 05, 01, 0e, 00, 0f, 13, 02, 05, 00, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 5
+- expression 0 operands: lhs = Expression(2, Add), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 2 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 3 operands: lhs = Expression(0, Sub), rhs = Zero
+- expression 4 operands: lhs = Expression(0, Sub), rhs = Zero
+Number of file 0 mappings: 6
+- Code(Counter(0)) at (prev + 110, 5) to (start + 10, 54)
+- Code(Expression(0, Sub)) at (prev + 13, 32) to (start + 0, 35)
+ = ((c0 + c1) - c1)
+- Code(Expression(2, Add)) at (prev + 0, 39) to (start + 0, 73)
+ = (c0 + c1)
+- Code(Expression(3, Add)) at (prev + 1, 23) to (start + 0, 26)
+ = (((c0 + c1) - c1) + Zero)
+- Code(Counter(1)) at (prev + 1, 14) to (start + 0, 15)
+- Code(Expression(4, Add)) at (prev + 2, 5) to (start + 0, 6)
+ = (((c0 + c1) - c1) + Zero)
+
+Function name: async::executor::block_on::VTABLE::{closure#0}
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 72, 11, 00, 33]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 114, 17) to (start + 0, 51)
+
+Function name: async::executor::block_on::VTABLE::{closure#1}
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 73, 11, 00, 33]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 115, 17) to (start + 0, 51)
+
+Function name: async::executor::block_on::VTABLE::{closure#2}
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 74, 11, 00, 33]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 116, 17) to (start + 0, 51)
+
+Function name: async::executor::block_on::VTABLE::{closure#3}
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 75, 11, 00, 13]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 117, 17) to (start + 0, 19)
+
+Function name: async::f
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 11, 01, 00, 14]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 17, 1) to (start + 0, 20)
+
+Function name: async::f::{closure#0}
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 11, 14, 00, 19]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 17, 20) to (start + 0, 25)
+
+Function name: async::foo (unused)
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 13, 01, 00, 1e]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 19, 1) to (start + 0, 30)
+
+Function name: async::foo::{closure#0} (unused)
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 13, 1e, 00, 2d]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 19, 30) to (start + 0, 45)
+
+Function name: async::g
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 15, 01, 00, 17]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 21, 1) to (start + 0, 23)
+
+Function name: async::g::{closure#0} (unused)
+Raw bytes (69): 0x[01, 01, 00, 0d, 00, 15, 17, 01, 0c, 00, 02, 09, 00, 0a, 01, 00, 0e, 00, 11, 00, 00, 12, 00, 17, 00, 00, 1b, 00, 1c, 00, 00, 20, 00, 22, 00, 01, 09, 00, 0a, 00, 00, 0e, 00, 11, 00, 00, 12, 00, 17, 00, 00, 1b, 00, 1c, 00, 00, 20, 00, 22, 00, 01, 0e, 00, 10, 00, 02, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 13
+- Code(Zero) at (prev + 21, 23) to (start + 1, 12)
+- Code(Zero) at (prev + 2, 9) to (start + 0, 10)
+- Code(Counter(0)) at (prev + 0, 14) to (start + 0, 17)
+- Code(Zero) at (prev + 0, 18) to (start + 0, 23)
+- Code(Zero) at (prev + 0, 27) to (start + 0, 28)
+- Code(Zero) at (prev + 0, 32) to (start + 0, 34)
+- Code(Zero) at (prev + 1, 9) to (start + 0, 10)
+- Code(Zero) at (prev + 0, 14) to (start + 0, 17)
+- Code(Zero) at (prev + 0, 18) to (start + 0, 23)
+- Code(Zero) at (prev + 0, 27) to (start + 0, 28)
+- Code(Zero) at (prev + 0, 32) to (start + 0, 34)
+- Code(Zero) at (prev + 1, 14) to (start + 0, 16)
+- Code(Zero) at (prev + 2, 1) to (start + 0, 2)
+
+Function name: async::h
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 1d, 01, 00, 16]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 29, 1) to (start + 0, 22)
+
+Function name: async::h::{closure#0} (unused)
+Raw bytes (44): 0x[01, 01, 00, 08, 00, 1d, 16, 03, 0c, 00, 04, 09, 00, 0a, 01, 00, 0e, 00, 13, 00, 00, 14, 00, 19, 00, 00, 1a, 00, 1b, 00, 00, 20, 00, 22, 00, 01, 0e, 00, 10, 00, 02, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 8
+- Code(Zero) at (prev + 29, 22) to (start + 3, 12)
+- Code(Zero) at (prev + 4, 9) to (start + 0, 10)
+- Code(Counter(0)) at (prev + 0, 14) to (start + 0, 19)
+- Code(Zero) at (prev + 0, 20) to (start + 0, 25)
+- Code(Zero) at (prev + 0, 26) to (start + 0, 27)
+- Code(Zero) at (prev + 0, 32) to (start + 0, 34)
+- Code(Zero) at (prev + 1, 14) to (start + 0, 16)
+- Code(Zero) at (prev + 2, 1) to (start + 0, 2)
+
+Function name: async::i
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 26, 01, 00, 13]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 38, 1) to (start + 0, 19)
+
+Function name: async::i::{closure#0}
+Raw bytes (84): 0x[01, 01, 05, 01, 00, 0d, 00, 1d, 00, 19, 13, 1d, 21, 0e, 01, 26, 13, 04, 0c, 0d, 05, 09, 00, 0a, 03, 00, 0e, 00, 12, 05, 00, 13, 00, 18, 09, 00, 1c, 00, 21, 07, 00, 27, 00, 2a, 15, 00, 2b, 00, 30, 1d, 01, 09, 00, 0a, 11, 00, 0e, 00, 11, 25, 00, 12, 00, 17, 29, 00, 1b, 00, 20, 0b, 00, 24, 00, 26, 21, 01, 0e, 00, 10, 0f, 02, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 5
+- expression 0 operands: lhs = Counter(0), rhs = Zero
+- expression 1 operands: lhs = Counter(3), rhs = Zero
+- expression 2 operands: lhs = Counter(7), rhs = Zero
+- expression 3 operands: lhs = Counter(6), rhs = Expression(4, Add)
+- expression 4 operands: lhs = Counter(7), rhs = Counter(8)
+Number of file 0 mappings: 14
+- Code(Counter(0)) at (prev + 38, 19) to (start + 4, 12)
+- Code(Counter(3)) at (prev + 5, 9) to (start + 0, 10)
+- Code(Expression(0, Add)) at (prev + 0, 14) to (start + 0, 18)
+ = (c0 + Zero)
+- Code(Counter(1)) at (prev + 0, 19) to (start + 0, 24)
+- Code(Counter(2)) at (prev + 0, 28) to (start + 0, 33)
+- Code(Expression(1, Add)) at (prev + 0, 39) to (start + 0, 42)
+ = (c3 + Zero)
+- Code(Counter(5)) at (prev + 0, 43) to (start + 0, 48)
+- Code(Counter(7)) at (prev + 1, 9) to (start + 0, 10)
+- Code(Counter(4)) at (prev + 0, 14) to (start + 0, 17)
+- Code(Counter(9)) at (prev + 0, 18) to (start + 0, 23)
+- Code(Counter(10)) at (prev + 0, 27) to (start + 0, 32)
+- Code(Expression(2, Add)) at (prev + 0, 36) to (start + 0, 38)
+ = (c7 + Zero)
+- Code(Counter(8)) at (prev + 1, 14) to (start + 0, 16)
+- Code(Expression(3, Add)) at (prev + 2, 1) to (start + 0, 2)
+ = (c6 + (c7 + c8))
+
+Function name: async::j
+Raw bytes (59): 0x[01, 01, 05, 01, 00, 05, 00, 09, 00, 05, 13, 09, 0d, 09, 01, 31, 01, 13, 0c, 05, 14, 09, 00, 0a, 03, 00, 0e, 00, 1b, 07, 00, 1f, 00, 27, 09, 01, 09, 00, 0a, 11, 00, 0e, 00, 1a, 0b, 00, 1e, 00, 20, 0d, 01, 0e, 00, 10, 0f, 02, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 5
+- expression 0 operands: lhs = Counter(0), rhs = Zero
+- expression 1 operands: lhs = Counter(1), rhs = Zero
+- expression 2 operands: lhs = Counter(2), rhs = Zero
+- expression 3 operands: lhs = Counter(1), rhs = Expression(4, Add)
+- expression 4 operands: lhs = Counter(2), rhs = Counter(3)
+Number of file 0 mappings: 9
+- Code(Counter(0)) at (prev + 49, 1) to (start + 19, 12)
+- Code(Counter(1)) at (prev + 20, 9) to (start + 0, 10)
+- Code(Expression(0, Add)) at (prev + 0, 14) to (start + 0, 27)
+ = (c0 + Zero)
+- Code(Expression(1, Add)) at (prev + 0, 31) to (start + 0, 39)
+ = (c1 + Zero)
+- Code(Counter(2)) at (prev + 1, 9) to (start + 0, 10)
+- Code(Counter(4)) at (prev + 0, 14) to (start + 0, 26)
+- Code(Expression(2, Add)) at (prev + 0, 30) to (start + 0, 32)
+ = (c2 + Zero)
+- Code(Counter(3)) at (prev + 1, 14) to (start + 0, 16)
+- Code(Expression(3, Add)) at (prev + 2, 1) to (start + 0, 2)
+ = (c1 + (c2 + c3))
+
+Function name: async::j::c
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 33, 05, 01, 12, 05, 02, 0d, 00, 0e, 02, 0a, 0d, 00, 0e, 07, 02, 05, 00, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 51, 5) to (start + 1, 18)
+- Code(Counter(1)) at (prev + 2, 13) to (start + 0, 14)
+- Code(Expression(0, Sub)) at (prev + 10, 13) to (start + 0, 14)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 2, 5) to (start + 0, 6)
+ = (c1 + (c0 - c1))
+
+Function name: async::j::d
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 42, 05, 00, 17]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 66, 5) to (start + 0, 23)
+
+Function name: async::j::f
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 43, 05, 00, 17]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 67, 5) to (start + 0, 23)
+
+Function name: async::k (unused)
+Raw bytes (29): 0x[01, 01, 00, 05, 01, 4b, 01, 01, 0c, 00, 02, 0e, 00, 10, 00, 01, 0e, 00, 10, 00, 01, 0e, 00, 10, 00, 02, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 5
+- Code(Counter(0)) at (prev + 75, 1) to (start + 1, 12)
+- Code(Zero) at (prev + 2, 14) to (start + 0, 16)
+- Code(Zero) at (prev + 1, 14) to (start + 0, 16)
+- Code(Zero) at (prev + 1, 14) to (start + 0, 16)
+- Code(Zero) at (prev + 2, 1) to (start + 0, 2)
+
+Function name: async::l
+Raw bytes (37): 0x[01, 01, 04, 01, 07, 09, 05, 09, 0f, 05, 02, 05, 01, 53, 01, 01, 0c, 02, 02, 0e, 00, 10, 05, 01, 0e, 00, 10, 09, 01, 0e, 00, 10, 0b, 02, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 4
+- expression 0 operands: lhs = Counter(0), rhs = Expression(1, Add)
+- expression 1 operands: lhs = Counter(2), rhs = Counter(1)
+- expression 2 operands: lhs = Counter(2), rhs = Expression(3, Add)
+- expression 3 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 5
+- Code(Counter(0)) at (prev + 83, 1) to (start + 1, 12)
+- Code(Expression(0, Sub)) at (prev + 2, 14) to (start + 0, 16)
+ = (c0 - (c2 + c1))
+- Code(Counter(1)) at (prev + 1, 14) to (start + 0, 16)
+- Code(Counter(2)) at (prev + 1, 14) to (start + 0, 16)
+- Code(Expression(2, Add)) at (prev + 2, 1) to (start + 0, 2)
+ = (c2 + (c1 + (c0 - (c2 + c1))))
+
+Function name: async::m
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 5b, 01, 00, 19]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 91, 1) to (start + 0, 25)
+
+Function name: async::m::{closure#0} (unused)
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 5b, 19, 00, 22]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 91, 25) to (start + 0, 34)
+
+Function name: async::main
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 5d, 01, 08, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 93, 1) to (start + 8, 2)
+
diff --git a/tests/coverage-map/status-quo/async.rs b/tests/coverage-map/status-quo/async.rs
new file mode 100644
index 000000000..efd9e62d6
--- /dev/null
+++ b/tests/coverage-map/status-quo/async.rs
@@ -0,0 +1,128 @@
+#![allow(unused_assignments, dead_code)]
+
+// compile-flags: --edition=2018 -C opt-level=1
+
+async fn c(x: u8) -> u8 {
+ if x == 8 {
+ 1
+ } else {
+ 0
+ }
+}
+
+async fn d() -> u8 { 1 }
+
+async fn e() -> u8 { 1 } // unused function; executor does not block on `g()`
+
+async fn f() -> u8 { 1 }
+
+async fn foo() -> [bool; 10] { [false; 10] } // unused function; executor does not block on `h()`
+
+pub async fn g(x: u8) {
+ match x {
+ y if e().await == y => (),
+ y if f().await == y => (),
+ _ => (),
+ }
+}
+
+async fn h(x: usize) { // The function signature is counted when called, but the body is not
+ // executed (not awaited) so the open brace has a `0` count (at least when
+ // displayed with `llvm-cov show` in color-mode).
+ match x {
+ y if foo().await[y] => (),
+ _ => (),
+ }
+}
+
+async fn i(x: u8) { // line coverage is 1, but there are 2 regions:
+ // (a) the function signature, counted when the function is called; and
+ // (b) the open brace for the function body, counted once when the body is
+ // executed asynchronously.
+ match x {
+ y if c(x).await == y + 1 => { d().await; }
+ y if f().await == y + 1 => (),
+ _ => (),
+ }
+}
+
+fn j(x: u8) {
+ // non-async versions of `c()`, `d()`, and `f()` to make it similar to async `i()`.
+ fn c(x: u8) -> u8 {
+ if x == 8 {
+ 1 // This line appears covered, but the 1-character expression span covering the `1`
+ // is not executed. (`llvm-cov show` displays a `^0` below the `1` ). This is because
+ // `fn j()` executes the open brace for the function body, followed by the function's
+ // first executable statement, `match x`. Inner function declarations are not
+ // "visible" to the MIR for `j()`, so the code region counts all lines between the
+ // open brace and the first statement as executed, which is, in a sense, true.
+ // `llvm-cov show` overcomes this kind of situation by showing the actual counts
+ // of the enclosed coverages, (that is, the `1` expression was not executed, and
+ // accurately displays a `0`).
+ } else {
+ 0
+ }
+ }
+ fn d() -> u8 { 1 } // inner function is defined in-line, but the function is not executed
+ fn f() -> u8 { 1 }
+ match x {
+ y if c(x) == y + 1 => { d(); }
+ y if f() == y + 1 => (),
+ _ => (),
+ }
+}
+
+fn k(x: u8) { // unused function
+ match x {
+ 1 => (),
+ 2 => (),
+ _ => (),
+ }
+}
+
+fn l(x: u8) {
+ match x {
+ 1 => (),
+ 2 => (),
+ _ => (),
+ }
+}
+
+async fn m(x: u8) -> u8 { x - 1 }
+
+fn main() {
+ let _ = g(10);
+ let _ = h(9);
+ let mut future = Box::pin(i(8));
+ j(7);
+ l(6);
+ let _ = m(5);
+ executor::block_on(future.as_mut());
+}
+
+mod executor {
+ use core::{
+ future::Future,
+ pin::Pin,
+ task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
+ };
+
+ pub fn block_on<F: Future>(mut future: F) -> F::Output {
+ let mut future = unsafe { Pin::new_unchecked(&mut future) };
+ use std::hint::unreachable_unchecked;
+ static VTABLE: RawWakerVTable = RawWakerVTable::new(
+ |_| unsafe { unreachable_unchecked() }, // clone
+ |_| unsafe { unreachable_unchecked() }, // wake
+ |_| unsafe { unreachable_unchecked() }, // wake_by_ref
+ |_| (),
+ );
+ let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
+ let mut context = Context::from_waker(&waker);
+
+ loop {
+ if let Poll::Ready(val) = future.as_mut().poll(&mut context) {
+ break val;
+ }
+ }
+ }
+}
diff --git a/tests/coverage-map/status-quo/async2.cov-map b/tests/coverage-map/status-quo/async2.cov-map
new file mode 100644
index 000000000..fe74dcd88
--- /dev/null
+++ b/tests/coverage-map/status-quo/async2.cov-map
@@ -0,0 +1,136 @@
+Function name: async2::async_func
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 0b, 01, 00, 17]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 11, 1) to (start + 0, 23)
+
+Function name: async2::async_func::{closure#0}
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 0b, 17, 03, 09, 05, 03, 0a, 02, 06, 02, 02, 06, 00, 07, 07, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 11, 23) to (start + 3, 9)
+- Code(Counter(1)) at (prev + 3, 10) to (start + 2, 6)
+- Code(Expression(0, Sub)) at (prev + 2, 6) to (start + 0, 7)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2)
+ = (c1 + (c0 - c1))
+
+Function name: async2::async_func_just_println
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 13, 01, 00, 24]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 19, 1) to (start + 0, 36)
+
+Function name: async2::async_func_just_println::{closure#0}
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 13, 24, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 19, 36) to (start + 2, 2)
+
+Function name: async2::executor::block_on::<async2::async_func::{closure#0}>
+Raw bytes (44): 0x[01, 01, 05, 0b, 05, 01, 05, 01, 05, 02, 00, 02, 00, 06, 01, 27, 05, 0a, 36, 02, 0d, 20, 00, 23, 0b, 00, 27, 00, 49, 0f, 01, 17, 00, 1a, 05, 01, 0e, 00, 0f, 13, 02, 05, 00, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 5
+- expression 0 operands: lhs = Expression(2, Add), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 2 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 3 operands: lhs = Expression(0, Sub), rhs = Zero
+- expression 4 operands: lhs = Expression(0, Sub), rhs = Zero
+Number of file 0 mappings: 6
+- Code(Counter(0)) at (prev + 39, 5) to (start + 10, 54)
+- Code(Expression(0, Sub)) at (prev + 13, 32) to (start + 0, 35)
+ = ((c0 + c1) - c1)
+- Code(Expression(2, Add)) at (prev + 0, 39) to (start + 0, 73)
+ = (c0 + c1)
+- Code(Expression(3, Add)) at (prev + 1, 23) to (start + 0, 26)
+ = (((c0 + c1) - c1) + Zero)
+- Code(Counter(1)) at (prev + 1, 14) to (start + 0, 15)
+- Code(Expression(4, Add)) at (prev + 2, 5) to (start + 0, 6)
+ = (((c0 + c1) - c1) + Zero)
+
+Function name: async2::executor::block_on::<async2::async_func_just_println::{closure#0}>
+Raw bytes (44): 0x[01, 01, 05, 0b, 05, 01, 05, 01, 05, 02, 00, 02, 00, 06, 01, 27, 05, 0a, 36, 02, 0d, 20, 00, 23, 0b, 00, 27, 00, 49, 0f, 01, 17, 00, 1a, 05, 01, 0e, 00, 0f, 13, 02, 05, 00, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 5
+- expression 0 operands: lhs = Expression(2, Add), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 2 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 3 operands: lhs = Expression(0, Sub), rhs = Zero
+- expression 4 operands: lhs = Expression(0, Sub), rhs = Zero
+Number of file 0 mappings: 6
+- Code(Counter(0)) at (prev + 39, 5) to (start + 10, 54)
+- Code(Expression(0, Sub)) at (prev + 13, 32) to (start + 0, 35)
+ = ((c0 + c1) - c1)
+- Code(Expression(2, Add)) at (prev + 0, 39) to (start + 0, 73)
+ = (c0 + c1)
+- Code(Expression(3, Add)) at (prev + 1, 23) to (start + 0, 26)
+ = (((c0 + c1) - c1) + Zero)
+- Code(Counter(1)) at (prev + 1, 14) to (start + 0, 15)
+- Code(Expression(4, Add)) at (prev + 2, 5) to (start + 0, 6)
+ = (((c0 + c1) - c1) + Zero)
+
+Function name: async2::executor::block_on::VTABLE::{closure#0}
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 2b, 11, 00, 33]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 43, 17) to (start + 0, 51)
+
+Function name: async2::executor::block_on::VTABLE::{closure#1}
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 2c, 11, 00, 33]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 44, 17) to (start + 0, 51)
+
+Function name: async2::executor::block_on::VTABLE::{closure#2}
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 2d, 11, 00, 33]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 45, 17) to (start + 0, 51)
+
+Function name: async2::executor::block_on::VTABLE::{closure#3}
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 2e, 11, 00, 13]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 46, 17) to (start + 0, 19)
+
+Function name: async2::main
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 17, 01, 07, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 23, 1) to (start + 7, 2)
+
+Function name: async2::non_async_func
+Raw bytes (26): 0x[01, 01, 01, 05, 00, 04, 01, 03, 01, 03, 09, 05, 03, 0a, 02, 06, 00, 02, 06, 00, 07, 03, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 1
+- expression 0 operands: lhs = Counter(1), rhs = Zero
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 3, 1) to (start + 3, 9)
+- Code(Counter(1)) at (prev + 3, 10) to (start + 2, 6)
+- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
+- Code(Expression(0, Add)) at (prev + 1, 1) to (start + 0, 2)
+ = (c1 + Zero)
+
diff --git a/tests/coverage-map/status-quo/async2.rs b/tests/coverage-map/status-quo/async2.rs
new file mode 100644
index 000000000..2884ff297
--- /dev/null
+++ b/tests/coverage-map/status-quo/async2.rs
@@ -0,0 +1,57 @@
+// compile-flags: --edition=2018
+
+fn non_async_func() {
+ println!("non_async_func was covered");
+ let b = true;
+ if b {
+ println!("non_async_func println in block");
+ }
+}
+
+async fn async_func() {
+ println!("async_func was covered");
+ let b = true;
+ if b {
+ println!("async_func println in block");
+ }
+}
+
+async fn async_func_just_println() {
+ println!("async_func_just_println was covered");
+}
+
+fn main() {
+ println!("codecovsample::main");
+
+ non_async_func();
+
+ executor::block_on(async_func());
+ executor::block_on(async_func_just_println());
+}
+
+mod executor {
+ use core::{
+ future::Future,
+ pin::Pin,
+ task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
+ };
+
+ pub fn block_on<F: Future>(mut future: F) -> F::Output {
+ let mut future = unsafe { Pin::new_unchecked(&mut future) };
+ use std::hint::unreachable_unchecked;
+ static VTABLE: RawWakerVTable = RawWakerVTable::new(
+ |_| unsafe { unreachable_unchecked() }, // clone
+ |_| unsafe { unreachable_unchecked() }, // wake
+ |_| unsafe { unreachable_unchecked() }, // wake_by_ref
+ |_| (),
+ );
+ let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
+ let mut context = Context::from_waker(&waker);
+
+ loop {
+ if let Poll::Ready(val) = future.as_mut().poll(&mut context) {
+ break val;
+ }
+ }
+ }
+}
diff --git a/tests/coverage-map/status-quo/closure.cov-map b/tests/coverage-map/status-quo/closure.cov-map
new file mode 100644
index 000000000..7dbf6ec83
--- /dev/null
+++ b/tests/coverage-map/status-quo/closure.cov-map
@@ -0,0 +1,324 @@
+Function name: closure::main
+Raw bytes (170): 0x[01, 01, 17, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 05, 05, 5a, 01, 05, 18, 01, 08, 01, 0f, 0d, 03, 16, 0e, 06, 0a, 07, 10, 05, 13, 0d, 0b, 1a, 0e, 06, 0a, 0f, 10, 05, 0c, 16, 13, 16, 05, 0d, 18, 17, 19, 09, 01, 1e, 1b, 04, 09, 00, 29, 1f, 01, 09, 00, 2d, 23, 01, 09, 00, 24, 27, 05, 09, 00, 24, 2b, 02, 09, 00, 21, 2f, 04, 09, 00, 21, 33, 04, 09, 00, 28, 37, 09, 09, 00, 32, 3b, 04, 09, 00, 33, 3f, 07, 09, 00, 4b, 43, 08, 09, 00, 48, 47, 0a, 09, 00, 47, 4b, 08, 09, 00, 44, 4f, 0a, 08, 00, 10, 05, 00, 11, 04, 06, 5a, 04, 06, 00, 07, 57, 01, 05, 03, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 23
+- expression 0 operands: lhs = Counter(0), rhs = Zero
+- expression 1 operands: lhs = Counter(0), rhs = Zero
+- expression 2 operands: lhs = Counter(0), rhs = Zero
+- expression 3 operands: lhs = Counter(0), rhs = Zero
+- expression 4 operands: lhs = Counter(0), rhs = Zero
+- expression 5 operands: lhs = Counter(0), rhs = Zero
+- expression 6 operands: lhs = Counter(0), rhs = Zero
+- expression 7 operands: lhs = Counter(0), rhs = Zero
+- expression 8 operands: lhs = Counter(0), rhs = Zero
+- expression 9 operands: lhs = Counter(0), rhs = Zero
+- expression 10 operands: lhs = Counter(0), rhs = Zero
+- expression 11 operands: lhs = Counter(0), rhs = Zero
+- expression 12 operands: lhs = Counter(0), rhs = Zero
+- expression 13 operands: lhs = Counter(0), rhs = Zero
+- expression 14 operands: lhs = Counter(0), rhs = Zero
+- expression 15 operands: lhs = Counter(0), rhs = Zero
+- expression 16 operands: lhs = Counter(0), rhs = Zero
+- expression 17 operands: lhs = Counter(0), rhs = Zero
+- expression 18 operands: lhs = Counter(0), rhs = Zero
+- expression 19 operands: lhs = Counter(0), rhs = Zero
+- expression 20 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 21 operands: lhs = Counter(1), rhs = Expression(22, Sub)
+- expression 22 operands: lhs = Counter(0), rhs = Counter(1)
+Number of file 0 mappings: 24
+- Code(Counter(0)) at (prev + 8, 1) to (start + 15, 13)
+- Code(Expression(0, Add)) at (prev + 22, 14) to (start + 6, 10)
+ = (c0 + Zero)
+- Code(Expression(1, Add)) at (prev + 16, 5) to (start + 19, 13)
+ = (c0 + Zero)
+- Code(Expression(2, Add)) at (prev + 26, 14) to (start + 6, 10)
+ = (c0 + Zero)
+- Code(Expression(3, Add)) at (prev + 16, 5) to (start + 12, 22)
+ = (c0 + Zero)
+- Code(Expression(4, Add)) at (prev + 22, 5) to (start + 13, 24)
+ = (c0 + Zero)
+- Code(Expression(5, Add)) at (prev + 25, 9) to (start + 1, 30)
+ = (c0 + Zero)
+- Code(Expression(6, Add)) at (prev + 4, 9) to (start + 0, 41)
+ = (c0 + Zero)
+- Code(Expression(7, Add)) at (prev + 1, 9) to (start + 0, 45)
+ = (c0 + Zero)
+- Code(Expression(8, Add)) at (prev + 1, 9) to (start + 0, 36)
+ = (c0 + Zero)
+- Code(Expression(9, Add)) at (prev + 5, 9) to (start + 0, 36)
+ = (c0 + Zero)
+- Code(Expression(10, Add)) at (prev + 2, 9) to (start + 0, 33)
+ = (c0 + Zero)
+- Code(Expression(11, Add)) at (prev + 4, 9) to (start + 0, 33)
+ = (c0 + Zero)
+- Code(Expression(12, Add)) at (prev + 4, 9) to (start + 0, 40)
+ = (c0 + Zero)
+- Code(Expression(13, Add)) at (prev + 9, 9) to (start + 0, 50)
+ = (c0 + Zero)
+- Code(Expression(14, Add)) at (prev + 4, 9) to (start + 0, 51)
+ = (c0 + Zero)
+- Code(Expression(15, Add)) at (prev + 7, 9) to (start + 0, 75)
+ = (c0 + Zero)
+- Code(Expression(16, Add)) at (prev + 8, 9) to (start + 0, 72)
+ = (c0 + Zero)
+- Code(Expression(17, Add)) at (prev + 10, 9) to (start + 0, 71)
+ = (c0 + Zero)
+- Code(Expression(18, Add)) at (prev + 8, 9) to (start + 0, 68)
+ = (c0 + Zero)
+- Code(Expression(19, Add)) at (prev + 10, 8) to (start + 0, 16)
+ = (c0 + Zero)
+- Code(Counter(1)) at (prev + 0, 17) to (start + 4, 6)
+- Code(Expression(22, Sub)) at (prev + 4, 6) to (start + 0, 7)
+ = (c0 - c1)
+- Code(Expression(21, Add)) at (prev + 1, 5) to (start + 3, 2)
+ = (c1 + (c0 - c1))
+
+Function name: closure::main::{closure#0}
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 27, 05, 02, 14, 05, 02, 15, 02, 0a, 02, 02, 0a, 00, 0b, 07, 01, 09, 01, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 39, 5) to (start + 2, 20)
+- Code(Counter(1)) at (prev + 2, 21) to (start + 2, 10)
+- Code(Expression(0, Sub)) at (prev + 2, 10) to (start + 0, 11)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 1, 9) to (start + 1, 6)
+ = (c1 + (c0 - c1))
+
+Function name: closure::main::{closure#10} (unused)
+Raw bytes (10): 0x[01, 01, 00, 01, 01, 9a, 01, 07, 00, 21]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 154, 7) to (start + 0, 33)
+
+Function name: closure::main::{closure#11} (unused)
+Raw bytes (10): 0x[01, 01, 00, 01, 01, 9e, 01, 07, 00, 21]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 158, 7) to (start + 0, 33)
+
+Function name: closure::main::{closure#12} (unused)
+Raw bytes (10): 0x[01, 01, 00, 01, 01, a6, 01, 01, 00, 17]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 166, 1) to (start + 0, 23)
+
+Function name: closure::main::{closure#13} (unused)
+Raw bytes (10): 0x[01, 01, 00, 01, 01, ab, 01, 0d, 02, 0e]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 171, 13) to (start + 2, 14)
+
+Function name: closure::main::{closure#14}
+Raw bytes (38): 0x[01, 01, 04, 05, 0a, 01, 05, 01, 05, 03, 00, 05, 03, b2, 01, 0d, 00, 15, 01, 01, 11, 01, 1b, 05, 01, 1e, 00, 25, 0a, 00, 2f, 00, 33, 0f, 01, 0d, 00, 0e]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 4
+- expression 0 operands: lhs = Counter(1), rhs = Expression(2, Sub)
+- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 2 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 3 operands: lhs = Expression(0, Add), rhs = Zero
+Number of file 0 mappings: 5
+- Code(Expression(0, Add)) at (prev + 178, 13) to (start + 0, 21)
+ = (c1 + (c0 - c1))
+- Code(Counter(0)) at (prev + 1, 17) to (start + 1, 27)
+- Code(Counter(1)) at (prev + 1, 30) to (start + 0, 37)
+- Code(Expression(2, Sub)) at (prev + 0, 47) to (start + 0, 51)
+ = (c0 - c1)
+- Code(Expression(3, Add)) at (prev + 1, 13) to (start + 0, 14)
+ = ((c1 + (c0 - c1)) + Zero)
+
+Function name: closure::main::{closure#15}
+Raw bytes (45): 0x[01, 01, 05, 05, 0e, 01, 05, 01, 00, 01, 05, 03, 00, 06, 01, ba, 01, 09, 00, 0a, 03, 01, 0d, 00, 15, 0b, 01, 11, 01, 1b, 05, 01, 1e, 00, 25, 0e, 00, 2f, 00, 33, 13, 02, 09, 00, 0a]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 5
+- expression 0 operands: lhs = Counter(1), rhs = Expression(3, Sub)
+- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 2 operands: lhs = Counter(0), rhs = Zero
+- expression 3 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 4 operands: lhs = Expression(0, Add), rhs = Zero
+Number of file 0 mappings: 6
+- Code(Counter(0)) at (prev + 186, 9) to (start + 0, 10)
+- Code(Expression(0, Add)) at (prev + 1, 13) to (start + 0, 21)
+ = (c1 + (c0 - c1))
+- Code(Expression(2, Add)) at (prev + 1, 17) to (start + 1, 27)
+ = (c0 + Zero)
+- Code(Counter(1)) at (prev + 1, 30) to (start + 0, 37)
+- Code(Expression(3, Sub)) at (prev + 0, 47) to (start + 0, 51)
+ = (c0 - c1)
+- Code(Expression(4, Add)) at (prev + 2, 9) to (start + 0, 10)
+ = ((c1 + (c0 - c1)) + Zero)
+
+Function name: closure::main::{closure#16}
+Raw bytes (38): 0x[01, 01, 04, 05, 0a, 01, 05, 01, 05, 03, 00, 05, 03, c4, 01, 0d, 00, 15, 01, 01, 11, 01, 1b, 05, 01, 1e, 00, 25, 0a, 00, 2f, 00, 33, 0f, 01, 0d, 00, 0e]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 4
+- expression 0 operands: lhs = Counter(1), rhs = Expression(2, Sub)
+- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 2 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 3 operands: lhs = Expression(0, Add), rhs = Zero
+Number of file 0 mappings: 5
+- Code(Expression(0, Add)) at (prev + 196, 13) to (start + 0, 21)
+ = (c1 + (c0 - c1))
+- Code(Counter(0)) at (prev + 1, 17) to (start + 1, 27)
+- Code(Counter(1)) at (prev + 1, 30) to (start + 0, 37)
+- Code(Expression(2, Sub)) at (prev + 0, 47) to (start + 0, 51)
+ = (c0 - c1)
+- Code(Expression(3, Add)) at (prev + 1, 13) to (start + 0, 14)
+ = ((c1 + (c0 - c1)) + Zero)
+
+Function name: closure::main::{closure#17}
+Raw bytes (45): 0x[01, 01, 05, 05, 0e, 01, 05, 01, 00, 01, 05, 03, 00, 06, 01, cc, 01, 09, 00, 0a, 03, 01, 0d, 00, 15, 0b, 01, 11, 01, 1b, 05, 01, 1e, 00, 25, 0e, 00, 2f, 00, 33, 13, 02, 09, 00, 0a]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 5
+- expression 0 operands: lhs = Counter(1), rhs = Expression(3, Sub)
+- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 2 operands: lhs = Counter(0), rhs = Zero
+- expression 3 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 4 operands: lhs = Expression(0, Add), rhs = Zero
+Number of file 0 mappings: 6
+- Code(Counter(0)) at (prev + 204, 9) to (start + 0, 10)
+- Code(Expression(0, Add)) at (prev + 1, 13) to (start + 0, 21)
+ = (c1 + (c0 - c1))
+- Code(Expression(2, Add)) at (prev + 1, 17) to (start + 1, 27)
+ = (c0 + Zero)
+- Code(Counter(1)) at (prev + 1, 30) to (start + 0, 37)
+- Code(Expression(3, Sub)) at (prev + 0, 47) to (start + 0, 51)
+ = (c0 - c1)
+- Code(Expression(4, Add)) at (prev + 2, 9) to (start + 0, 10)
+ = ((c1 + (c0 - c1)) + Zero)
+
+Function name: closure::main::{closure#18}
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 18, 0d, 02, 1c, 05, 02, 1d, 02, 12, 02, 02, 12, 00, 13, 07, 01, 11, 01, 0e]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 24, 13) to (start + 2, 28)
+- Code(Counter(1)) at (prev + 2, 29) to (start + 2, 18)
+- Code(Expression(0, Sub)) at (prev + 2, 18) to (start + 0, 19)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 1, 17) to (start + 1, 14)
+ = (c1 + (c0 - c1))
+
+Function name: closure::main::{closure#19}
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 42, 0d, 02, 1c, 05, 02, 1d, 02, 12, 02, 02, 12, 00, 13, 07, 01, 11, 01, 0e]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 66, 13) to (start + 2, 28)
+- Code(Counter(1)) at (prev + 2, 29) to (start + 2, 18)
+- Code(Expression(0, Sub)) at (prev + 2, 18) to (start + 0, 19)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 1, 17) to (start + 1, 14)
+ = (c1 + (c0 - c1))
+
+Function name: closure::main::{closure#1}
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 51, 05, 02, 14, 05, 02, 15, 02, 0a, 02, 02, 0a, 00, 0b, 07, 01, 09, 01, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 81, 5) to (start + 2, 20)
+- Code(Counter(1)) at (prev + 2, 21) to (start + 2, 10)
+- Code(Expression(0, Sub)) at (prev + 2, 10) to (start + 0, 11)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 1, 9) to (start + 1, 6)
+ = (c1 + (c0 - c1))
+
+Function name: closure::main::{closure#2}
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 67, 05, 02, 14, 05, 02, 15, 02, 0a, 02, 02, 0a, 00, 0b, 07, 01, 09, 01, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 103, 5) to (start + 2, 20)
+- Code(Counter(1)) at (prev + 2, 21) to (start + 2, 10)
+- Code(Expression(0, Sub)) at (prev + 2, 10) to (start + 0, 11)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 1, 9) to (start + 1, 6)
+ = (c1 + (c0 - c1))
+
+Function name: closure::main::{closure#3} (unused)
+Raw bytes (25): 0x[01, 01, 00, 04, 01, 80, 01, 05, 01, 14, 00, 01, 15, 02, 0a, 00, 02, 0a, 00, 0b, 00, 01, 09, 01, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 128, 5) to (start + 1, 20)
+- Code(Zero) at (prev + 1, 21) to (start + 2, 10)
+- Code(Zero) at (prev + 2, 10) to (start + 0, 11)
+- Code(Zero) at (prev + 1, 9) to (start + 1, 6)
+
+Function name: closure::main::{closure#4} (unused)
+Raw bytes (10): 0x[01, 01, 00, 01, 01, 88, 01, 35, 00, 43]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 136, 53) to (start + 0, 67)
+
+Function name: closure::main::{closure#5}
+Raw bytes (10): 0x[01, 01, 00, 01, 01, 8b, 01, 3d, 00, 4f]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 139, 61) to (start + 0, 79)
+
+Function name: closure::main::{closure#6}
+Raw bytes (10): 0x[01, 01, 00, 01, 01, 8c, 01, 41, 00, 57]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 140, 65) to (start + 0, 87)
+
+Function name: closure::main::{closure#7} (unused)
+Raw bytes (10): 0x[01, 01, 00, 01, 01, 8d, 01, 3b, 00, 51]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 141, 59) to (start + 0, 81)
+
+Function name: closure::main::{closure#8} (unused)
+Raw bytes (10): 0x[01, 01, 00, 01, 01, 92, 01, 3b, 00, 55]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 146, 59) to (start + 0, 85)
+
+Function name: closure::main::{closure#9} (unused)
+Raw bytes (10): 0x[01, 01, 00, 01, 01, 94, 01, 38, 02, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 148, 56) to (start + 2, 6)
+
diff --git a/tests/coverage-map/status-quo/closure.rs b/tests/coverage-map/status-quo/closure.rs
new file mode 100644
index 000000000..16a2c4e33
--- /dev/null
+++ b/tests/coverage-map/status-quo/closure.rs
@@ -0,0 +1,220 @@
+#![allow(unused_assignments, unused_variables)]
+// compile-flags: -C opt-level=2
+
+// This test used to be sensitive to certain coverage-specific hacks in
+// `rustc_middle/mir/mono.rs`, but those hacks were later cleaned up by
+// <https://github.com/rust-lang/rust/pull/83666>.
+
+fn main() {
+ // Initialize test constants in a way that cannot be determined at compile time, to ensure
+ // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
+ // dependent conditions.
+ let is_true = std::env::args().len() == 1;
+ let is_false = !is_true;
+
+ let mut some_string = Some(String::from("the string content"));
+ println!(
+ "The string or alt: {}"
+ ,
+ some_string
+ .
+ unwrap_or_else
+ (
+ ||
+ {
+ let mut countdown = 0;
+ if is_false {
+ countdown = 10;
+ }
+ "alt string 1".to_owned()
+ }
+ )
+ );
+
+ some_string = Some(String::from("the string content"));
+ let
+ a
+ =
+ ||
+ {
+ let mut countdown = 0;
+ if is_false {
+ countdown = 10;
+ }
+ "alt string 2".to_owned()
+ };
+ println!(
+ "The string or alt: {}"
+ ,
+ some_string
+ .
+ unwrap_or_else
+ (
+ a
+ )
+ );
+
+ some_string = None;
+ println!(
+ "The string or alt: {}"
+ ,
+ some_string
+ .
+ unwrap_or_else
+ (
+ ||
+ {
+ let mut countdown = 0;
+ if is_false {
+ countdown = 10;
+ }
+ "alt string 3".to_owned()
+ }
+ )
+ );
+
+ some_string = None;
+ let
+ a
+ =
+ ||
+ {
+ let mut countdown = 0;
+ if is_false {
+ countdown = 10;
+ }
+ "alt string 4".to_owned()
+ };
+ println!(
+ "The string or alt: {}"
+ ,
+ some_string
+ .
+ unwrap_or_else
+ (
+ a
+ )
+ );
+
+ let
+ quote_closure
+ =
+ |val|
+ {
+ let mut countdown = 0;
+ if is_false {
+ countdown = 10;
+ }
+ format!("'{}'", val)
+ };
+ println!(
+ "Repeated, quoted string: {:?}"
+ ,
+ std::iter::repeat("repeat me")
+ .take(5)
+ .map
+ (
+ quote_closure
+ )
+ .collect::<Vec<_>>()
+ );
+
+ let
+ _unused_closure
+ =
+ |
+ mut countdown
+ |
+ {
+ if is_false {
+ countdown = 10;
+ }
+ "closure should be unused".to_owned()
+ };
+
+ let mut countdown = 10;
+ let _short_unused_closure = | _unused_arg: u8 | countdown += 1;
+
+
+ let short_used_covered_closure_macro = | used_arg: u8 | println!("called");
+ let short_used_not_covered_closure_macro = | used_arg: u8 | println!("not called");
+ let _short_unused_closure_macro = | _unused_arg: u8 | println!("not called");
+
+
+
+
+ let _short_unused_closure_block = | _unused_arg: u8 | { println!("not called") };
+
+ let _shortish_unused_closure = | _unused_arg: u8 | {
+ println!("not called")
+ };
+
+ let _as_short_unused_closure = |
+ _unused_arg: u8
+ | { println!("not called") };
+
+ let _almost_as_short_unused_closure = |
+ _unused_arg: u8
+ | { println!("not called") }
+ ;
+
+
+
+
+
+ let _short_unused_closure_line_break_no_block = | _unused_arg: u8 |
+println!("not called")
+ ;
+
+ let _short_unused_closure_line_break_no_block2 =
+ | _unused_arg: u8 |
+ println!(
+ "not called"
+ )
+ ;
+
+ let short_used_not_covered_closure_line_break_no_block_embedded_branch =
+ | _unused_arg: u8 |
+ println!(
+ "not called: {}",
+ if is_true { "check" } else { "me" }
+ )
+ ;
+
+ let short_used_not_covered_closure_line_break_block_embedded_branch =
+ | _unused_arg: u8 |
+ {
+ println!(
+ "not called: {}",
+ if is_true { "check" } else { "me" }
+ )
+ }
+ ;
+
+ let short_used_covered_closure_line_break_no_block_embedded_branch =
+ | _unused_arg: u8 |
+ println!(
+ "not called: {}",
+ if is_true { "check" } else { "me" }
+ )
+ ;
+
+ let short_used_covered_closure_line_break_block_embedded_branch =
+ | _unused_arg: u8 |
+ {
+ println!(
+ "not called: {}",
+ if is_true { "check" } else { "me" }
+ )
+ }
+ ;
+
+ if is_false {
+ short_used_not_covered_closure_macro(0);
+ short_used_not_covered_closure_line_break_no_block_embedded_branch(0);
+ short_used_not_covered_closure_line_break_block_embedded_branch(0);
+ }
+ short_used_covered_closure_macro(0);
+ short_used_covered_closure_line_break_no_block_embedded_branch(0);
+ short_used_covered_closure_line_break_block_embedded_branch(0);
+}
diff --git a/tests/coverage-map/status-quo/closure_bug.cov-map b/tests/coverage-map/status-quo/closure_bug.cov-map
new file mode 100644
index 000000000..4fe2e5ad2
--- /dev/null
+++ b/tests/coverage-map/status-quo/closure_bug.cov-map
@@ -0,0 +1,148 @@
+Function name: closure_bug::main
+Raw bytes (241): 0x[01, 01, 34, 01, 00, 01, 05, 05, ce, 01, 01, 05, cb, 01, 00, 05, ce, 01, 01, 05, cb, 01, 09, 05, ce, 01, 01, 05, 09, c6, 01, cb, 01, 09, 05, ce, 01, 01, 05, c3, 01, 00, 09, c6, 01, cb, 01, 09, 05, ce, 01, 01, 05, c3, 01, 0d, 09, c6, 01, cb, 01, 09, 05, ce, 01, 01, 05, 0d, be, 01, c3, 01, 0d, 09, c6, 01, cb, 01, 09, 05, ce, 01, 01, 05, bb, 01, 00, 0d, be, 01, c3, 01, 0d, 09, c6, 01, cb, 01, 09, 05, ce, 01, 01, 05, bb, 01, 11, 0d, be, 01, c3, 01, 0d, 09, c6, 01, cb, 01, 09, 05, ce, 01, 01, 05, 11, b6, 01, bb, 01, 11, 0d, be, 01, c3, 01, 0d, 09, c6, 01, cb, 01, 09, 05, ce, 01, 01, 05, 11, 01, 06, 01, 03, 0a, 03, 09, 05, 01, 0e, 05, 01, 0f, 00, 17, ce, 01, 00, 17, 00, 18, cb, 01, 02, 09, 00, 0a, 13, 06, 05, 01, 0e, 09, 01, 0f, 00, 17, c6, 01, 00, 17, 00, 18, c3, 01, 02, 09, 00, 0a, 3b, 06, 05, 01, 0e, 0d, 01, 0f, 00, 17, be, 01, 00, 17, 00, 18, bb, 01, 02, 09, 00, 0a, 7b, 06, 05, 01, 0e, 11, 01, 0f, 00, 17, b6, 01, 00, 17, 00, 18, b3, 01, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 52
+- expression 0 operands: lhs = Counter(0), rhs = Zero
+- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 2 operands: lhs = Counter(1), rhs = Expression(51, Sub)
+- expression 3 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 4 operands: lhs = Expression(50, Add), rhs = Zero
+- expression 5 operands: lhs = Counter(1), rhs = Expression(51, Sub)
+- expression 6 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 7 operands: lhs = Expression(50, Add), rhs = Counter(2)
+- expression 8 operands: lhs = Counter(1), rhs = Expression(51, Sub)
+- expression 9 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 10 operands: lhs = Counter(2), rhs = Expression(49, Sub)
+- expression 11 operands: lhs = Expression(50, Add), rhs = Counter(2)
+- expression 12 operands: lhs = Counter(1), rhs = Expression(51, Sub)
+- expression 13 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 14 operands: lhs = Expression(48, Add), rhs = Zero
+- expression 15 operands: lhs = Counter(2), rhs = Expression(49, Sub)
+- expression 16 operands: lhs = Expression(50, Add), rhs = Counter(2)
+- expression 17 operands: lhs = Counter(1), rhs = Expression(51, Sub)
+- expression 18 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 19 operands: lhs = Expression(48, Add), rhs = Counter(3)
+- expression 20 operands: lhs = Counter(2), rhs = Expression(49, Sub)
+- expression 21 operands: lhs = Expression(50, Add), rhs = Counter(2)
+- expression 22 operands: lhs = Counter(1), rhs = Expression(51, Sub)
+- expression 23 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 24 operands: lhs = Counter(3), rhs = Expression(47, Sub)
+- expression 25 operands: lhs = Expression(48, Add), rhs = Counter(3)
+- expression 26 operands: lhs = Counter(2), rhs = Expression(49, Sub)
+- expression 27 operands: lhs = Expression(50, Add), rhs = Counter(2)
+- expression 28 operands: lhs = Counter(1), rhs = Expression(51, Sub)
+- expression 29 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 30 operands: lhs = Expression(46, Add), rhs = Zero
+- expression 31 operands: lhs = Counter(3), rhs = Expression(47, Sub)
+- expression 32 operands: lhs = Expression(48, Add), rhs = Counter(3)
+- expression 33 operands: lhs = Counter(2), rhs = Expression(49, Sub)
+- expression 34 operands: lhs = Expression(50, Add), rhs = Counter(2)
+- expression 35 operands: lhs = Counter(1), rhs = Expression(51, Sub)
+- expression 36 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 37 operands: lhs = Expression(46, Add), rhs = Counter(4)
+- expression 38 operands: lhs = Counter(3), rhs = Expression(47, Sub)
+- expression 39 operands: lhs = Expression(48, Add), rhs = Counter(3)
+- expression 40 operands: lhs = Counter(2), rhs = Expression(49, Sub)
+- expression 41 operands: lhs = Expression(50, Add), rhs = Counter(2)
+- expression 42 operands: lhs = Counter(1), rhs = Expression(51, Sub)
+- expression 43 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 44 operands: lhs = Counter(4), rhs = Expression(45, Sub)
+- expression 45 operands: lhs = Expression(46, Add), rhs = Counter(4)
+- expression 46 operands: lhs = Counter(3), rhs = Expression(47, Sub)
+- expression 47 operands: lhs = Expression(48, Add), rhs = Counter(3)
+- expression 48 operands: lhs = Counter(2), rhs = Expression(49, Sub)
+- expression 49 operands: lhs = Expression(50, Add), rhs = Counter(2)
+- expression 50 operands: lhs = Counter(1), rhs = Expression(51, Sub)
+- expression 51 operands: lhs = Counter(0), rhs = Counter(1)
+Number of file 0 mappings: 17
+- Code(Counter(0)) at (prev + 6, 1) to (start + 3, 10)
+- Code(Expression(0, Add)) at (prev + 9, 5) to (start + 1, 14)
+ = (c0 + Zero)
+- Code(Counter(1)) at (prev + 1, 15) to (start + 0, 23)
+- Code(Expression(51, Sub)) at (prev + 0, 23) to (start + 0, 24)
+ = (c0 - c1)
+- Code(Expression(50, Add)) at (prev + 2, 9) to (start + 0, 10)
+ = (c1 + (c0 - c1))
+- Code(Expression(4, Add)) at (prev + 6, 5) to (start + 1, 14)
+ = ((c1 + (c0 - c1)) + Zero)
+- Code(Counter(2)) at (prev + 1, 15) to (start + 0, 23)
+- Code(Expression(49, Sub)) at (prev + 0, 23) to (start + 0, 24)
+ = ((c1 + (c0 - c1)) - c2)
+- Code(Expression(48, Add)) at (prev + 2, 9) to (start + 0, 10)
+ = (c2 + ((c1 + (c0 - c1)) - c2))
+- Code(Expression(14, Add)) at (prev + 6, 5) to (start + 1, 14)
+ = ((c2 + ((c1 + (c0 - c1)) - c2)) + Zero)
+- Code(Counter(3)) at (prev + 1, 15) to (start + 0, 23)
+- Code(Expression(47, Sub)) at (prev + 0, 23) to (start + 0, 24)
+ = ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)
+- Code(Expression(46, Add)) at (prev + 2, 9) to (start + 0, 10)
+ = (c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3))
+- Code(Expression(30, Add)) at (prev + 6, 5) to (start + 1, 14)
+ = ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) + Zero)
+- Code(Counter(4)) at (prev + 1, 15) to (start + 0, 23)
+- Code(Expression(45, Sub)) at (prev + 0, 23) to (start + 0, 24)
+ = ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)
+- Code(Expression(44, Add)) at (prev + 1, 1) to (start + 0, 2)
+ = (c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4))
+
+Function name: closure_bug::main::{closure#0}
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 0d, 09, 00, 12, 05, 00, 15, 00, 19, 02, 00, 23, 00, 28, 07, 00, 29, 00, 2a]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 13, 9) to (start + 0, 18)
+- Code(Counter(1)) at (prev + 0, 21) to (start + 0, 25)
+- Code(Expression(0, Sub)) at (prev + 0, 35) to (start + 0, 40)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 0, 41) to (start + 0, 42)
+ = (c1 + (c0 - c1))
+
+Function name: closure_bug::main::{closure#1}
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 16, 09, 00, 12, 05, 00, 15, 00, 19, 02, 00, 23, 00, 28, 07, 00, 29, 00, 2a]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 22, 9) to (start + 0, 18)
+- Code(Counter(1)) at (prev + 0, 21) to (start + 0, 25)
+- Code(Expression(0, Sub)) at (prev + 0, 35) to (start + 0, 40)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 0, 41) to (start + 0, 42)
+ = (c1 + (c0 - c1))
+
+Function name: closure_bug::main::{closure#2}
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 1f, 09, 00, 12, 05, 00, 15, 00, 19, 02, 00, 23, 00, 28, 07, 00, 29, 00, 2a]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 31, 9) to (start + 0, 18)
+- Code(Counter(1)) at (prev + 0, 21) to (start + 0, 25)
+- Code(Expression(0, Sub)) at (prev + 0, 35) to (start + 0, 40)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 0, 41) to (start + 0, 42)
+ = (c1 + (c0 - c1))
+
+Function name: closure_bug::main::{closure#3}
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 28, 09, 00, 12, 05, 00, 15, 00, 19, 02, 00, 23, 00, 28, 07, 00, 29, 00, 2a]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 40, 9) to (start + 0, 18)
+- Code(Counter(1)) at (prev + 0, 21) to (start + 0, 25)
+- Code(Expression(0, Sub)) at (prev + 0, 35) to (start + 0, 40)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 0, 41) to (start + 0, 42)
+ = (c1 + (c0 - c1))
+
diff --git a/tests/coverage-map/status-quo/closure_bug.rs b/tests/coverage-map/status-quo/closure_bug.rs
new file mode 100644
index 000000000..739bc5f0b
--- /dev/null
+++ b/tests/coverage-map/status-quo/closure_bug.rs
@@ -0,0 +1,44 @@
+// Regression test for #115930.
+// All of these closures are identical, and should produce identical output in
+// the coverage report. However, an unstable sort was causing them to be treated
+// inconsistently when preparing coverage spans.
+
+fn main() {
+ let truthy = std::env::args().len() == 1;
+
+ let a
+ =
+ |
+ |
+ if truthy { true } else { false };
+
+ a();
+ if truthy { a(); }
+
+ let b
+ =
+ |
+ |
+ if truthy { true } else { false };
+
+ b();
+ if truthy { b(); }
+
+ let c
+ =
+ |
+ |
+ if truthy { true } else { false };
+
+ c();
+ if truthy { c(); }
+
+ let d
+ =
+ |
+ |
+ if truthy { true } else { false };
+
+ d();
+ if truthy { d(); }
+}
diff --git a/tests/coverage-map/status-quo/closure_macro.cov-map b/tests/coverage-map/status-quo/closure_macro.cov-map
new file mode 100644
index 000000000..ac017eb44
--- /dev/null
+++ b/tests/coverage-map/status-quo/closure_macro.cov-map
@@ -0,0 +1,40 @@
+Function name: closure_macro::load_configuration_files
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 1d, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 29, 1) to (start + 2, 2)
+
+Function name: closure_macro::main
+Raw bytes (49): 0x[01, 01, 05, 01, 05, 02, 00, 05, 00, 02, 00, 05, 02, 07, 01, 21, 01, 01, 21, 02, 02, 09, 00, 0f, 05, 00, 12, 00, 13, 07, 00, 12, 00, 13, 0b, 00, 54, 00, 55, 0f, 02, 09, 02, 0b, 13, 03, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 5
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Expression(0, Sub), rhs = Zero
+- expression 2 operands: lhs = Counter(1), rhs = Zero
+- expression 3 operands: lhs = Expression(0, Sub), rhs = Zero
+- expression 4 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 7
+- Code(Counter(0)) at (prev + 33, 1) to (start + 1, 33)
+- Code(Expression(0, Sub)) at (prev + 2, 9) to (start + 0, 15)
+ = (c0 - c1)
+- Code(Counter(1)) at (prev + 0, 18) to (start + 0, 19)
+- Code(Expression(1, Add)) at (prev + 0, 18) to (start + 0, 19)
+ = ((c0 - c1) + Zero)
+- Code(Expression(2, Add)) at (prev + 0, 84) to (start + 0, 85)
+ = (c1 + Zero)
+- Code(Expression(3, Add)) at (prev + 2, 9) to (start + 2, 11)
+ = ((c0 - c1) + Zero)
+- Code(Expression(4, Add)) at (prev + 3, 1) to (start + 0, 2)
+ = (c1 + (c0 - c1))
+
+Function name: closure_macro::main::{closure#0}
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 23, 12, 00, 54]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 35, 18) to (start + 0, 84)
+
diff --git a/tests/coverage-map/status-quo/closure_macro.rs b/tests/coverage-map/status-quo/closure_macro.rs
new file mode 100644
index 000000000..9b289141c
--- /dev/null
+++ b/tests/coverage-map/status-quo/closure_macro.rs
@@ -0,0 +1,40 @@
+// compile-flags: --edition=2018
+#![feature(coverage_attribute)]
+
+macro_rules! bail {
+ ($msg:literal $(,)?) => {
+ if $msg.len() > 0 {
+ println!("no msg");
+ } else {
+ println!($msg);
+ }
+ return Err(String::from($msg));
+ };
+}
+
+macro_rules! on_error {
+ ($value:expr, $error_message:expr) => {
+ $value.or_else(|e| { // FIXME(85000): no coverage in closure macros
+ let message = format!($error_message, e);
+ if message.len() > 0 {
+ println!("{}", message);
+ Ok(String::from("ok"))
+ } else {
+ bail!("error");
+ }
+ })
+ };
+}
+
+fn load_configuration_files() -> Result<String, String> {
+ Ok(String::from("config"))
+}
+
+pub fn main() -> Result<(), String> {
+ println!("Starting service");
+ let config = on_error!(load_configuration_files(), "Error loading configs: {}")?;
+
+ let startup_delay_duration = String::from("arg");
+ let _ = (config, startup_delay_duration);
+ Ok(())
+}
diff --git a/tests/coverage-map/status-quo/closure_macro_async.cov-map b/tests/coverage-map/status-quo/closure_macro_async.cov-map
new file mode 100644
index 000000000..c9a142e5a
--- /dev/null
+++ b/tests/coverage-map/status-quo/closure_macro_async.cov-map
@@ -0,0 +1,48 @@
+Function name: closure_macro_async::load_configuration_files
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 1d, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 29, 1) to (start + 2, 2)
+
+Function name: closure_macro_async::test
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 21, 01, 00, 2b]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 33, 1) to (start + 0, 43)
+
+Function name: closure_macro_async::test::{closure#0}
+Raw bytes (49): 0x[01, 01, 05, 01, 05, 02, 00, 05, 00, 02, 00, 05, 02, 07, 01, 21, 2b, 01, 21, 02, 02, 09, 00, 0f, 05, 00, 12, 00, 13, 07, 00, 12, 00, 13, 0b, 00, 54, 00, 55, 0f, 02, 09, 02, 0b, 13, 03, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 5
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Expression(0, Sub), rhs = Zero
+- expression 2 operands: lhs = Counter(1), rhs = Zero
+- expression 3 operands: lhs = Expression(0, Sub), rhs = Zero
+- expression 4 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 7
+- Code(Counter(0)) at (prev + 33, 43) to (start + 1, 33)
+- Code(Expression(0, Sub)) at (prev + 2, 9) to (start + 0, 15)
+ = (c0 - c1)
+- Code(Counter(1)) at (prev + 0, 18) to (start + 0, 19)
+- Code(Expression(1, Add)) at (prev + 0, 18) to (start + 0, 19)
+ = ((c0 - c1) + Zero)
+- Code(Expression(2, Add)) at (prev + 0, 84) to (start + 0, 85)
+ = (c1 + Zero)
+- Code(Expression(3, Add)) at (prev + 2, 9) to (start + 2, 11)
+ = ((c0 - c1) + Zero)
+- Code(Expression(4, Add)) at (prev + 3, 1) to (start + 0, 2)
+ = (c1 + (c0 - c1))
+
+Function name: closure_macro_async::test::{closure#0}::{closure#0}
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 23, 12, 00, 54]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 35, 18) to (start + 0, 84)
+
diff --git a/tests/coverage-map/status-quo/closure_macro_async.rs b/tests/coverage-map/status-quo/closure_macro_async.rs
new file mode 100644
index 000000000..b4275599e
--- /dev/null
+++ b/tests/coverage-map/status-quo/closure_macro_async.rs
@@ -0,0 +1,77 @@
+// compile-flags: --edition=2018
+#![feature(coverage_attribute)]
+
+macro_rules! bail {
+ ($msg:literal $(,)?) => {
+ if $msg.len() > 0 {
+ println!("no msg");
+ } else {
+ println!($msg);
+ }
+ return Err(String::from($msg));
+ };
+}
+
+macro_rules! on_error {
+ ($value:expr, $error_message:expr) => {
+ $value.or_else(|e| { // FIXME(85000): no coverage in closure macros
+ let message = format!($error_message, e);
+ if message.len() > 0 {
+ println!("{}", message);
+ Ok(String::from("ok"))
+ } else {
+ bail!("error");
+ }
+ })
+ };
+}
+
+fn load_configuration_files() -> Result<String, String> {
+ Ok(String::from("config"))
+}
+
+pub async fn test() -> Result<(), String> {
+ println!("Starting service");
+ let config = on_error!(load_configuration_files(), "Error loading configs: {}")?;
+
+ let startup_delay_duration = String::from("arg");
+ let _ = (config, startup_delay_duration);
+ Ok(())
+}
+
+#[coverage(off)]
+fn main() {
+ executor::block_on(test()).unwrap();
+}
+
+mod executor {
+ use core::{
+ future::Future,
+ pin::Pin,
+ task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
+ };
+
+ #[coverage(off)]
+ pub fn block_on<F: Future>(mut future: F) -> F::Output {
+ let mut future = unsafe { Pin::new_unchecked(&mut future) };
+ use std::hint::unreachable_unchecked;
+ static VTABLE: RawWakerVTable = RawWakerVTable::new(
+ #[coverage(off)]
+ |_| unsafe { unreachable_unchecked() }, // clone
+ #[coverage(off)]
+ |_| unsafe { unreachable_unchecked() }, // wake
+ #[coverage(off)]
+ |_| unsafe { unreachable_unchecked() }, // wake_by_ref
+ #[coverage(off)]
+ |_| (),
+ );
+ let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
+ let mut context = Context::from_waker(&waker);
+
+ loop {
+ if let Poll::Ready(val) = future.as_mut().poll(&mut context) {
+ break val;
+ }
+ }
+ }
+}
diff --git a/tests/coverage-map/status-quo/conditions.cov-map b/tests/coverage-map/status-quo/conditions.cov-map
new file mode 100644
index 000000000..d82b8389b
--- /dev/null
+++ b/tests/coverage-map/status-quo/conditions.cov-map
@@ -0,0 +1,261 @@
+Function name: conditions::main
+Raw bytes (793): 0x[01, 01, 90, 01, 09, 33, 37, 41, 3b, 3d, 35, 39, 05, 00, bf, 04, 09, 05, 00, 0d, 35, 26, 39, 0d, 35, 3b, 3d, 35, 39, 37, 41, 3b, 3d, 35, 39, ba, 04, 0d, bf, 04, 09, 05, 00, 03, 00, 45, 00, 87, 01, 49, 45, 00, 82, 01, 31, 87, 01, 49, 45, 00, 7e, 4d, 82, 01, 31, 87, 01, 49, 45, 00, 7a, 51, 7e, 4d, 82, 01, 31, 87, 01, 49, 45, 00, ab, 01, 55, 4d, 51, a7, 01, 59, ab, 01, 55, 4d, 51, 49, a3, 01, a7, 01, 59, ab, 01, 55, 4d, 51, 61, 00, e7, 01, 65, 61, 00, e2, 01, 2d, e7, 01, 65, 61, 00, de, 01, 69, e2, 01, 2d, e7, 01, 65, 61, 00, da, 01, 6d, de, 01, 69, e2, 01, 2d, e7, 01, 65, 61, 00, 8f, 02, 71, 69, 6d, 8b, 02, 75, 8f, 02, 71, 69, 6d, 83, 02, 00, 65, 87, 02, 8b, 02, 75, 8f, 02, 71, 69, 6d, 7d, f3, 03, f7, 03, 8d, 01, fb, 03, 89, 01, 81, 01, 85, 01, 79, 00, db, 02, 7d, 79, 00, d6, 02, 29, db, 02, 7d, 79, 00, d2, 02, 81, 01, d6, 02, 29, db, 02, 7d, 79, 00, ce, 02, 85, 01, d2, 02, 81, 01, d6, 02, 29, db, 02, 7d, 79, 00, fb, 03, 89, 01, 81, 01, 85, 01, f7, 03, 8d, 01, fb, 03, 89, 01, 81, 01, 85, 01, 11, 9b, 04, 9f, 04, 21, a3, 04, 1d, 15, 19, ef, 03, 00, 7d, f3, 03, f7, 03, 8d, 01, fb, 03, 89, 01, 81, 01, 85, 01, ef, 03, 11, 7d, f3, 03, f7, 03, 8d, 01, fb, 03, 89, 01, 81, 01, 85, 01, ea, 03, 25, ef, 03, 11, 7d, f3, 03, f7, 03, 8d, 01, fb, 03, 89, 01, 81, 01, 85, 01, e6, 03, 15, ea, 03, 25, ef, 03, 11, 7d, f3, 03, f7, 03, 8d, 01, fb, 03, 89, 01, 81, 01, 85, 01, e2, 03, 19, e6, 03, 15, ea, 03, 25, ef, 03, 11, 7d, f3, 03, f7, 03, 8d, 01, fb, 03, 89, 01, 81, 01, 85, 01, a3, 04, 1d, 15, 19, 9f, 04, 21, a3, 04, 1d, 15, 19, 97, 04, a7, 04, 11, 9b, 04, 9f, 04, 21, a3, 04, 1d, 15, 19, ab, 04, b6, 04, af, 04, b3, 04, 25, 29, 2d, 31, ba, 04, 0d, bf, 04, 09, 05, 00, 44, 01, 03, 01, 02, 0c, 05, 02, 0d, 02, 06, 00, 02, 06, 00, 07, 03, 03, 09, 00, 0a, bf, 04, 00, 10, 00, 1d, 09, 01, 09, 01, 0a, ba, 04, 02, 0f, 00, 1c, 0d, 01, 0c, 00, 19, 26, 00, 1d, 00, 2a, 22, 00, 2e, 00, 3c, 37, 00, 3d, 02, 0a, 41, 02, 0a, 00, 0b, 33, 01, 09, 01, 12, b6, 04, 03, 09, 00, 0f, 4b, 03, 09, 01, 0c, 45, 01, 0d, 02, 06, 00, 02, 06, 00, 07, 87, 01, 02, 08, 00, 15, 49, 00, 16, 02, 06, 82, 01, 02, 0f, 00, 1c, 7e, 01, 0c, 00, 19, 7a, 00, 1d, 00, 2a, 76, 00, 2e, 00, 3c, a7, 01, 00, 3d, 02, 0a, 59, 02, 0a, 00, 0b, a3, 01, 01, 09, 00, 17, 31, 02, 09, 00, 0f, 9f, 01, 03, 08, 00, 0c, 5d, 01, 0d, 01, 10, 61, 01, 11, 02, 0a, 00, 02, 0a, 00, 0b, e7, 01, 02, 0c, 00, 19, 65, 00, 1a, 02, 0a, e2, 01, 03, 11, 00, 1e, de, 01, 01, 10, 00, 1d, da, 01, 00, 21, 00, 2e, d6, 01, 00, 32, 00, 40, 8b, 02, 00, 41, 02, 0e, 75, 02, 0e, 00, 0f, 87, 02, 01, 0d, 00, 1b, 2d, 02, 0d, 00, 13, 00, 02, 06, 00, 07, ff, 01, 02, 09, 01, 0c, 79, 01, 0d, 02, 06, 00, 02, 06, 00, 07, ef, 03, 02, 09, 00, 0a, db, 02, 00, 10, 00, 1d, 7d, 00, 1e, 02, 06, d6, 02, 02, 0f, 00, 1c, d2, 02, 01, 0c, 00, 19, ce, 02, 00, 1d, 00, 2a, ca, 02, 00, 2e, 00, 3c, f7, 03, 00, 3d, 02, 0a, 8d, 01, 02, 0a, 00, 0b, f3, 03, 01, 09, 00, 17, 29, 02, 0d, 02, 0f, 97, 04, 05, 09, 00, 0a, 83, 03, 00, 10, 00, 1d, 11, 00, 1e, 02, 06, ea, 03, 02, 0f, 00, 1c, e6, 03, 01, 0c, 00, 19, e2, 03, 00, 1d, 00, 2a, de, 03, 00, 2e, 00, 3c, 9f, 04, 00, 3d, 02, 0a, 21, 02, 0a, 00, 0b, 9b, 04, 01, 09, 00, 17, 25, 02, 09, 00, 0f, 93, 04, 02, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 144
+- expression 0 operands: lhs = Counter(2), rhs = Expression(12, Add)
+- expression 1 operands: lhs = Expression(13, Add), rhs = Counter(16)
+- expression 2 operands: lhs = Expression(14, Add), rhs = Counter(15)
+- expression 3 operands: lhs = Counter(13), rhs = Counter(14)
+- expression 4 operands: lhs = Counter(1), rhs = Zero
+- expression 5 operands: lhs = Expression(143, Add), rhs = Counter(2)
+- expression 6 operands: lhs = Counter(1), rhs = Zero
+- expression 7 operands: lhs = Counter(3), rhs = Counter(13)
+- expression 8 operands: lhs = Expression(9, Sub), rhs = Counter(14)
+- expression 9 operands: lhs = Counter(3), rhs = Counter(13)
+- expression 10 operands: lhs = Expression(14, Add), rhs = Counter(15)
+- expression 11 operands: lhs = Counter(13), rhs = Counter(14)
+- expression 12 operands: lhs = Expression(13, Add), rhs = Counter(16)
+- expression 13 operands: lhs = Expression(14, Add), rhs = Counter(15)
+- expression 14 operands: lhs = Counter(13), rhs = Counter(14)
+- expression 15 operands: lhs = Expression(142, Sub), rhs = Counter(3)
+- expression 16 operands: lhs = Expression(143, Add), rhs = Counter(2)
+- expression 17 operands: lhs = Counter(1), rhs = Zero
+- expression 18 operands: lhs = Expression(0, Add), rhs = Zero
+- expression 19 operands: lhs = Counter(17), rhs = Zero
+- expression 20 operands: lhs = Expression(33, Add), rhs = Counter(18)
+- expression 21 operands: lhs = Counter(17), rhs = Zero
+- expression 22 operands: lhs = Expression(32, Sub), rhs = Counter(12)
+- expression 23 operands: lhs = Expression(33, Add), rhs = Counter(18)
+- expression 24 operands: lhs = Counter(17), rhs = Zero
+- expression 25 operands: lhs = Expression(31, Sub), rhs = Counter(19)
+- expression 26 operands: lhs = Expression(32, Sub), rhs = Counter(12)
+- expression 27 operands: lhs = Expression(33, Add), rhs = Counter(18)
+- expression 28 operands: lhs = Counter(17), rhs = Zero
+- expression 29 operands: lhs = Expression(30, Sub), rhs = Counter(20)
+- expression 30 operands: lhs = Expression(31, Sub), rhs = Counter(19)
+- expression 31 operands: lhs = Expression(32, Sub), rhs = Counter(12)
+- expression 32 operands: lhs = Expression(33, Add), rhs = Counter(18)
+- expression 33 operands: lhs = Counter(17), rhs = Zero
+- expression 34 operands: lhs = Expression(42, Add), rhs = Counter(21)
+- expression 35 operands: lhs = Counter(19), rhs = Counter(20)
+- expression 36 operands: lhs = Expression(41, Add), rhs = Counter(22)
+- expression 37 operands: lhs = Expression(42, Add), rhs = Counter(21)
+- expression 38 operands: lhs = Counter(19), rhs = Counter(20)
+- expression 39 operands: lhs = Counter(18), rhs = Expression(40, Add)
+- expression 40 operands: lhs = Expression(41, Add), rhs = Counter(22)
+- expression 41 operands: lhs = Expression(42, Add), rhs = Counter(21)
+- expression 42 operands: lhs = Counter(19), rhs = Counter(20)
+- expression 43 operands: lhs = Counter(24), rhs = Zero
+- expression 44 operands: lhs = Expression(57, Add), rhs = Counter(25)
+- expression 45 operands: lhs = Counter(24), rhs = Zero
+- expression 46 operands: lhs = Expression(56, Sub), rhs = Counter(11)
+- expression 47 operands: lhs = Expression(57, Add), rhs = Counter(25)
+- expression 48 operands: lhs = Counter(24), rhs = Zero
+- expression 49 operands: lhs = Expression(55, Sub), rhs = Counter(26)
+- expression 50 operands: lhs = Expression(56, Sub), rhs = Counter(11)
+- expression 51 operands: lhs = Expression(57, Add), rhs = Counter(25)
+- expression 52 operands: lhs = Counter(24), rhs = Zero
+- expression 53 operands: lhs = Expression(54, Sub), rhs = Counter(27)
+- expression 54 operands: lhs = Expression(55, Sub), rhs = Counter(26)
+- expression 55 operands: lhs = Expression(56, Sub), rhs = Counter(11)
+- expression 56 operands: lhs = Expression(57, Add), rhs = Counter(25)
+- expression 57 operands: lhs = Counter(24), rhs = Zero
+- expression 58 operands: lhs = Expression(67, Add), rhs = Counter(28)
+- expression 59 operands: lhs = Counter(26), rhs = Counter(27)
+- expression 60 operands: lhs = Expression(66, Add), rhs = Counter(29)
+- expression 61 operands: lhs = Expression(67, Add), rhs = Counter(28)
+- expression 62 operands: lhs = Counter(26), rhs = Counter(27)
+- expression 63 operands: lhs = Expression(64, Add), rhs = Zero
+- expression 64 operands: lhs = Counter(25), rhs = Expression(65, Add)
+- expression 65 operands: lhs = Expression(66, Add), rhs = Counter(29)
+- expression 66 operands: lhs = Expression(67, Add), rhs = Counter(28)
+- expression 67 operands: lhs = Counter(26), rhs = Counter(27)
+- expression 68 operands: lhs = Counter(31), rhs = Expression(124, Add)
+- expression 69 operands: lhs = Expression(125, Add), rhs = Counter(35)
+- expression 70 operands: lhs = Expression(126, Add), rhs = Counter(34)
+- expression 71 operands: lhs = Counter(32), rhs = Counter(33)
+- expression 72 operands: lhs = Counter(30), rhs = Zero
+- expression 73 operands: lhs = Expression(86, Add), rhs = Counter(31)
+- expression 74 operands: lhs = Counter(30), rhs = Zero
+- expression 75 operands: lhs = Expression(85, Sub), rhs = Counter(10)
+- expression 76 operands: lhs = Expression(86, Add), rhs = Counter(31)
+- expression 77 operands: lhs = Counter(30), rhs = Zero
+- expression 78 operands: lhs = Expression(84, Sub), rhs = Counter(32)
+- expression 79 operands: lhs = Expression(85, Sub), rhs = Counter(10)
+- expression 80 operands: lhs = Expression(86, Add), rhs = Counter(31)
+- expression 81 operands: lhs = Counter(30), rhs = Zero
+- expression 82 operands: lhs = Expression(83, Sub), rhs = Counter(33)
+- expression 83 operands: lhs = Expression(84, Sub), rhs = Counter(32)
+- expression 84 operands: lhs = Expression(85, Sub), rhs = Counter(10)
+- expression 85 operands: lhs = Expression(86, Add), rhs = Counter(31)
+- expression 86 operands: lhs = Counter(30), rhs = Zero
+- expression 87 operands: lhs = Expression(126, Add), rhs = Counter(34)
+- expression 88 operands: lhs = Counter(32), rhs = Counter(33)
+- expression 89 operands: lhs = Expression(125, Add), rhs = Counter(35)
+- expression 90 operands: lhs = Expression(126, Add), rhs = Counter(34)
+- expression 91 operands: lhs = Counter(32), rhs = Counter(33)
+- expression 92 operands: lhs = Counter(4), rhs = Expression(134, Add)
+- expression 93 operands: lhs = Expression(135, Add), rhs = Counter(8)
+- expression 94 operands: lhs = Expression(136, Add), rhs = Counter(7)
+- expression 95 operands: lhs = Counter(5), rhs = Counter(6)
+- expression 96 operands: lhs = Expression(123, Add), rhs = Zero
+- expression 97 operands: lhs = Counter(31), rhs = Expression(124, Add)
+- expression 98 operands: lhs = Expression(125, Add), rhs = Counter(35)
+- expression 99 operands: lhs = Expression(126, Add), rhs = Counter(34)
+- expression 100 operands: lhs = Counter(32), rhs = Counter(33)
+- expression 101 operands: lhs = Expression(123, Add), rhs = Counter(4)
+- expression 102 operands: lhs = Counter(31), rhs = Expression(124, Add)
+- expression 103 operands: lhs = Expression(125, Add), rhs = Counter(35)
+- expression 104 operands: lhs = Expression(126, Add), rhs = Counter(34)
+- expression 105 operands: lhs = Counter(32), rhs = Counter(33)
+- expression 106 operands: lhs = Expression(122, Sub), rhs = Counter(9)
+- expression 107 operands: lhs = Expression(123, Add), rhs = Counter(4)
+- expression 108 operands: lhs = Counter(31), rhs = Expression(124, Add)
+- expression 109 operands: lhs = Expression(125, Add), rhs = Counter(35)
+- expression 110 operands: lhs = Expression(126, Add), rhs = Counter(34)
+- expression 111 operands: lhs = Counter(32), rhs = Counter(33)
+- expression 112 operands: lhs = Expression(121, Sub), rhs = Counter(5)
+- expression 113 operands: lhs = Expression(122, Sub), rhs = Counter(9)
+- expression 114 operands: lhs = Expression(123, Add), rhs = Counter(4)
+- expression 115 operands: lhs = Counter(31), rhs = Expression(124, Add)
+- expression 116 operands: lhs = Expression(125, Add), rhs = Counter(35)
+- expression 117 operands: lhs = Expression(126, Add), rhs = Counter(34)
+- expression 118 operands: lhs = Counter(32), rhs = Counter(33)
+- expression 119 operands: lhs = Expression(120, Sub), rhs = Counter(6)
+- expression 120 operands: lhs = Expression(121, Sub), rhs = Counter(5)
+- expression 121 operands: lhs = Expression(122, Sub), rhs = Counter(9)
+- expression 122 operands: lhs = Expression(123, Add), rhs = Counter(4)
+- expression 123 operands: lhs = Counter(31), rhs = Expression(124, Add)
+- expression 124 operands: lhs = Expression(125, Add), rhs = Counter(35)
+- expression 125 operands: lhs = Expression(126, Add), rhs = Counter(34)
+- expression 126 operands: lhs = Counter(32), rhs = Counter(33)
+- expression 127 operands: lhs = Expression(136, Add), rhs = Counter(7)
+- expression 128 operands: lhs = Counter(5), rhs = Counter(6)
+- expression 129 operands: lhs = Expression(135, Add), rhs = Counter(8)
+- expression 130 operands: lhs = Expression(136, Add), rhs = Counter(7)
+- expression 131 operands: lhs = Counter(5), rhs = Counter(6)
+- expression 132 operands: lhs = Expression(133, Add), rhs = Expression(137, Add)
+- expression 133 operands: lhs = Counter(4), rhs = Expression(134, Add)
+- expression 134 operands: lhs = Expression(135, Add), rhs = Counter(8)
+- expression 135 operands: lhs = Expression(136, Add), rhs = Counter(7)
+- expression 136 operands: lhs = Counter(5), rhs = Counter(6)
+- expression 137 operands: lhs = Expression(138, Add), rhs = Expression(141, Sub)
+- expression 138 operands: lhs = Expression(139, Add), rhs = Expression(140, Add)
+- expression 139 operands: lhs = Counter(9), rhs = Counter(10)
+- expression 140 operands: lhs = Counter(11), rhs = Counter(12)
+- expression 141 operands: lhs = Expression(142, Sub), rhs = Counter(3)
+- expression 142 operands: lhs = Expression(143, Add), rhs = Counter(2)
+- expression 143 operands: lhs = Counter(1), rhs = Zero
+Number of file 0 mappings: 68
+- Code(Counter(0)) at (prev + 3, 1) to (start + 2, 12)
+- Code(Counter(1)) at (prev + 2, 13) to (start + 2, 6)
+- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
+- Code(Expression(0, Add)) at (prev + 3, 9) to (start + 0, 10)
+ = (c2 + (((c13 + c14) + c15) + c16))
+- Code(Expression(143, Add)) at (prev + 0, 16) to (start + 0, 29)
+ = (c1 + Zero)
+- Code(Counter(2)) at (prev + 1, 9) to (start + 1, 10)
+- Code(Expression(142, Sub)) at (prev + 2, 15) to (start + 0, 28)
+ = ((c1 + Zero) - c2)
+- Code(Counter(3)) at (prev + 1, 12) to (start + 0, 25)
+- Code(Expression(9, Sub)) at (prev + 0, 29) to (start + 0, 42)
+ = (c3 - c13)
+- Code(Expression(8, Sub)) at (prev + 0, 46) to (start + 0, 60)
+ = ((c3 - c13) - c14)
+- Code(Expression(13, Add)) at (prev + 0, 61) to (start + 2, 10)
+ = ((c13 + c14) + c15)
+- Code(Counter(16)) at (prev + 2, 10) to (start + 0, 11)
+- Code(Expression(12, Add)) at (prev + 1, 9) to (start + 1, 18)
+ = (((c13 + c14) + c15) + c16)
+- Code(Expression(141, Sub)) at (prev + 3, 9) to (start + 0, 15)
+ = (((c1 + Zero) - c2) - c3)
+- Code(Expression(18, Add)) at (prev + 3, 9) to (start + 1, 12)
+ = ((c2 + (((c13 + c14) + c15) + c16)) + Zero)
+- Code(Counter(17)) at (prev + 1, 13) to (start + 2, 6)
+- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
+- Code(Expression(33, Add)) at (prev + 2, 8) to (start + 0, 21)
+ = (c17 + Zero)
+- Code(Counter(18)) at (prev + 0, 22) to (start + 2, 6)
+- Code(Expression(32, Sub)) at (prev + 2, 15) to (start + 0, 28)
+ = ((c17 + Zero) - c18)
+- Code(Expression(31, Sub)) at (prev + 1, 12) to (start + 0, 25)
+ = (((c17 + Zero) - c18) - c12)
+- Code(Expression(30, Sub)) at (prev + 0, 29) to (start + 0, 42)
+ = ((((c17 + Zero) - c18) - c12) - c19)
+- Code(Expression(29, Sub)) at (prev + 0, 46) to (start + 0, 60)
+ = (((((c17 + Zero) - c18) - c12) - c19) - c20)
+- Code(Expression(41, Add)) at (prev + 0, 61) to (start + 2, 10)
+ = ((c19 + c20) + c21)
+- Code(Counter(22)) at (prev + 2, 10) to (start + 0, 11)
+- Code(Expression(40, Add)) at (prev + 1, 9) to (start + 0, 23)
+ = (((c19 + c20) + c21) + c22)
+- Code(Counter(12)) at (prev + 2, 9) to (start + 0, 15)
+- Code(Expression(39, Add)) at (prev + 3, 8) to (start + 0, 12)
+ = (c18 + (((c19 + c20) + c21) + c22))
+- Code(Counter(23)) at (prev + 1, 13) to (start + 1, 16)
+- Code(Counter(24)) at (prev + 1, 17) to (start + 2, 10)
+- Code(Zero) at (prev + 2, 10) to (start + 0, 11)
+- Code(Expression(57, Add)) at (prev + 2, 12) to (start + 0, 25)
+ = (c24 + Zero)
+- Code(Counter(25)) at (prev + 0, 26) to (start + 2, 10)
+- Code(Expression(56, Sub)) at (prev + 3, 17) to (start + 0, 30)
+ = ((c24 + Zero) - c25)
+- Code(Expression(55, Sub)) at (prev + 1, 16) to (start + 0, 29)
+ = (((c24 + Zero) - c25) - c11)
+- Code(Expression(54, Sub)) at (prev + 0, 33) to (start + 0, 46)
+ = ((((c24 + Zero) - c25) - c11) - c26)
+- Code(Expression(53, Sub)) at (prev + 0, 50) to (start + 0, 64)
+ = (((((c24 + Zero) - c25) - c11) - c26) - c27)
+- Code(Expression(66, Add)) at (prev + 0, 65) to (start + 2, 14)
+ = ((c26 + c27) + c28)
+- Code(Counter(29)) at (prev + 2, 14) to (start + 0, 15)
+- Code(Expression(65, Add)) at (prev + 1, 13) to (start + 0, 27)
+ = (((c26 + c27) + c28) + c29)
+- Code(Counter(11)) at (prev + 2, 13) to (start + 0, 19)
+- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
+- Code(Expression(63, Add)) at (prev + 2, 9) to (start + 1, 12)
+ = ((c25 + (((c26 + c27) + c28) + c29)) + Zero)
+- Code(Counter(30)) at (prev + 1, 13) to (start + 2, 6)
+- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
+- Code(Expression(123, Add)) at (prev + 2, 9) to (start + 0, 10)
+ = (c31 + (((c32 + c33) + c34) + c35))
+- Code(Expression(86, Add)) at (prev + 0, 16) to (start + 0, 29)
+ = (c30 + Zero)
+- Code(Counter(31)) at (prev + 0, 30) to (start + 2, 6)
+- Code(Expression(85, Sub)) at (prev + 2, 15) to (start + 0, 28)
+ = ((c30 + Zero) - c31)
+- Code(Expression(84, Sub)) at (prev + 1, 12) to (start + 0, 25)
+ = (((c30 + Zero) - c31) - c10)
+- Code(Expression(83, Sub)) at (prev + 0, 29) to (start + 0, 42)
+ = ((((c30 + Zero) - c31) - c10) - c32)
+- Code(Expression(82, Sub)) at (prev + 0, 46) to (start + 0, 60)
+ = (((((c30 + Zero) - c31) - c10) - c32) - c33)
+- Code(Expression(125, Add)) at (prev + 0, 61) to (start + 2, 10)
+ = ((c32 + c33) + c34)
+- Code(Counter(35)) at (prev + 2, 10) to (start + 0, 11)
+- Code(Expression(124, Add)) at (prev + 1, 9) to (start + 0, 23)
+ = (((c32 + c33) + c34) + c35)
+- Code(Counter(10)) at (prev + 2, 13) to (start + 2, 15)
+- Code(Expression(133, Add)) at (prev + 5, 9) to (start + 0, 10)
+ = (c4 + (((c5 + c6) + c7) + c8))
+- Code(Expression(96, Add)) at (prev + 0, 16) to (start + 0, 29)
+ = ((c31 + (((c32 + c33) + c34) + c35)) + Zero)
+- Code(Counter(4)) at (prev + 0, 30) to (start + 2, 6)
+- Code(Expression(122, Sub)) at (prev + 2, 15) to (start + 0, 28)
+ = ((c31 + (((c32 + c33) + c34) + c35)) - c4)
+- Code(Expression(121, Sub)) at (prev + 1, 12) to (start + 0, 25)
+ = (((c31 + (((c32 + c33) + c34) + c35)) - c4) - c9)
+- Code(Expression(120, Sub)) at (prev + 0, 29) to (start + 0, 42)
+ = ((((c31 + (((c32 + c33) + c34) + c35)) - c4) - c9) - c5)
+- Code(Expression(119, Sub)) at (prev + 0, 46) to (start + 0, 60)
+ = (((((c31 + (((c32 + c33) + c34) + c35)) - c4) - c9) - c5) - c6)
+- Code(Expression(135, Add)) at (prev + 0, 61) to (start + 2, 10)
+ = ((c5 + c6) + c7)
+- Code(Counter(8)) at (prev + 2, 10) to (start + 0, 11)
+- Code(Expression(134, Add)) at (prev + 1, 9) to (start + 0, 23)
+ = (((c5 + c6) + c7) + c8)
+- Code(Counter(9)) at (prev + 2, 9) to (start + 0, 15)
+- Code(Expression(132, Add)) at (prev + 2, 1) to (start + 0, 2)
+ = ((c4 + (((c5 + c6) + c7) + c8)) + (((c9 + c10) + (c11 + c12)) + (((c1 + Zero) - c2) - c3)))
+
diff --git a/tests/coverage-map/status-quo/conditions.rs b/tests/coverage-map/status-quo/conditions.rs
new file mode 100644
index 000000000..fa7f2a116
--- /dev/null
+++ b/tests/coverage-map/status-quo/conditions.rs
@@ -0,0 +1,86 @@
+#![allow(unused_assignments, unused_variables)]
+
+fn main() {
+ let mut countdown = 0;
+ if true {
+ countdown = 10;
+ }
+
+ const B: u32 = 100;
+ let x = if countdown > 7 {
+ countdown -= 4;
+ B
+ } else if countdown > 2 {
+ if countdown < 1 || countdown > 5 || countdown != 9 {
+ countdown = 0;
+ }
+ countdown -= 5;
+ countdown
+ } else {
+ return;
+ };
+
+ let mut countdown = 0;
+ if true {
+ countdown = 10;
+ }
+
+ if countdown > 7 {
+ countdown -= 4;
+ } else if countdown > 2 {
+ if countdown < 1 || countdown > 5 || countdown != 9 {
+ countdown = 0;
+ }
+ countdown -= 5;
+ } else {
+ return;
+ }
+
+ if true {
+ let mut countdown = 0;
+ if true {
+ countdown = 10;
+ }
+
+ if countdown > 7 {
+ countdown -= 4;
+ }
+ else if countdown > 2 {
+ if countdown < 1 || countdown > 5 || countdown != 9 {
+ countdown = 0;
+ }
+ countdown -= 5;
+ } else {
+ return;
+ }
+ }
+
+ let mut countdown = 0;
+ if true {
+ countdown = 1;
+ }
+
+ let z = if countdown > 7 {
+ countdown -= 4;
+ } else if countdown > 2 {
+ if countdown < 1 || countdown > 5 || countdown != 9 {
+ countdown = 0;
+ }
+ countdown -= 5;
+ } else {
+ let should_be_reachable = countdown;
+ println!("reached");
+ return;
+ };
+
+ let w = if countdown > 7 {
+ countdown -= 4;
+ } else if countdown > 2 {
+ if countdown < 1 || countdown > 5 || countdown != 9 {
+ countdown = 0;
+ }
+ countdown -= 5;
+ } else {
+ return;
+ };
+}
diff --git a/tests/coverage-map/status-quo/continue.cov-map b/tests/coverage-map/status-quo/continue.cov-map
new file mode 100644
index 000000000..c78cf2930
--- /dev/null
+++ b/tests/coverage-map/status-quo/continue.cov-map
@@ -0,0 +1,85 @@
+Function name: continue::main
+Raw bytes (216): 0x[01, 01, 1f, 01, 07, 05, 09, 03, 0d, 0d, 1f, 11, 15, 1b, 19, 0d, 1f, 11, 15, 15, 00, 19, 37, 1d, 21, 33, 25, 19, 37, 1d, 21, 1d, 00, 25, 4f, 29, 2d, 4b, 31, 25, 4f, 29, 2d, 31, 67, 35, 39, 5f, 3d, 31, 67, 35, 39, 35, 39, 3d, 41, 73, 45, 3d, 41, 41, 00, 49, 45, 1e, 01, 03, 01, 03, 12, 03, 04, 0e, 00, 13, 0a, 01, 0f, 00, 16, 05, 02, 11, 00, 19, 09, 02, 12, 04, 0e, 1b, 06, 0e, 00, 13, 16, 01, 0f, 00, 16, 15, 01, 16, 02, 0e, 11, 04, 11, 00, 19, 23, 03, 09, 00, 0e, 33, 02, 0e, 00, 13, 2e, 01, 0f, 00, 16, 1d, 01, 15, 02, 0e, 21, 04, 11, 00, 19, 3b, 03, 09, 00, 0e, 4b, 02, 0e, 00, 13, 46, 01, 0c, 00, 13, 29, 01, 0d, 00, 15, 2d, 01, 0a, 01, 0e, 5f, 03, 0e, 00, 13, 5a, 01, 0f, 00, 16, 39, 01, 16, 02, 0e, 35, 03, 12, 02, 0e, 67, 04, 09, 00, 0e, 73, 02, 0e, 00, 13, 6e, 01, 0f, 00, 16, 41, 01, 16, 02, 0e, 49, 04, 11, 00, 16, 77, 03, 09, 00, 0e, 7b, 02, 0d, 01, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 31
+- expression 0 operands: lhs = Counter(0), rhs = Expression(1, Add)
+- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 3 operands: lhs = Counter(3), rhs = Expression(7, Add)
+- expression 4 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 5 operands: lhs = Expression(6, Add), rhs = Counter(6)
+- expression 6 operands: lhs = Counter(3), rhs = Expression(7, Add)
+- expression 7 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 8 operands: lhs = Counter(5), rhs = Zero
+- expression 9 operands: lhs = Counter(6), rhs = Expression(13, Add)
+- expression 10 operands: lhs = Counter(7), rhs = Counter(8)
+- expression 11 operands: lhs = Expression(12, Add), rhs = Counter(9)
+- expression 12 operands: lhs = Counter(6), rhs = Expression(13, Add)
+- expression 13 operands: lhs = Counter(7), rhs = Counter(8)
+- expression 14 operands: lhs = Counter(7), rhs = Zero
+- expression 15 operands: lhs = Counter(9), rhs = Expression(19, Add)
+- expression 16 operands: lhs = Counter(10), rhs = Counter(11)
+- expression 17 operands: lhs = Expression(18, Add), rhs = Counter(12)
+- expression 18 operands: lhs = Counter(9), rhs = Expression(19, Add)
+- expression 19 operands: lhs = Counter(10), rhs = Counter(11)
+- expression 20 operands: lhs = Counter(12), rhs = Expression(25, Add)
+- expression 21 operands: lhs = Counter(13), rhs = Counter(14)
+- expression 22 operands: lhs = Expression(23, Add), rhs = Counter(15)
+- expression 23 operands: lhs = Counter(12), rhs = Expression(25, Add)
+- expression 24 operands: lhs = Counter(13), rhs = Counter(14)
+- expression 25 operands: lhs = Counter(13), rhs = Counter(14)
+- expression 26 operands: lhs = Counter(15), rhs = Counter(16)
+- expression 27 operands: lhs = Expression(28, Add), rhs = Counter(17)
+- expression 28 operands: lhs = Counter(15), rhs = Counter(16)
+- expression 29 operands: lhs = Counter(16), rhs = Zero
+- expression 30 operands: lhs = Counter(18), rhs = Counter(17)
+Number of file 0 mappings: 30
+- Code(Counter(0)) at (prev + 3, 1) to (start + 3, 18)
+- Code(Expression(0, Add)) at (prev + 4, 14) to (start + 0, 19)
+ = (c0 + (c1 + c2))
+- Code(Expression(2, Sub)) at (prev + 1, 15) to (start + 0, 22)
+ = ((c0 + (c1 + c2)) - c3)
+- Code(Counter(1)) at (prev + 2, 17) to (start + 0, 25)
+- Code(Counter(2)) at (prev + 2, 18) to (start + 4, 14)
+- Code(Expression(6, Add)) at (prev + 6, 14) to (start + 0, 19)
+ = (c3 + (c4 + c5))
+- Code(Expression(5, Sub)) at (prev + 1, 15) to (start + 0, 22)
+ = ((c3 + (c4 + c5)) - c6)
+- Code(Counter(5)) at (prev + 1, 22) to (start + 2, 14)
+- Code(Counter(4)) at (prev + 4, 17) to (start + 0, 25)
+- Code(Expression(8, Add)) at (prev + 3, 9) to (start + 0, 14)
+ = (c5 + Zero)
+- Code(Expression(12, Add)) at (prev + 2, 14) to (start + 0, 19)
+ = (c6 + (c7 + c8))
+- Code(Expression(11, Sub)) at (prev + 1, 15) to (start + 0, 22)
+ = ((c6 + (c7 + c8)) - c9)
+- Code(Counter(7)) at (prev + 1, 21) to (start + 2, 14)
+- Code(Counter(8)) at (prev + 4, 17) to (start + 0, 25)
+- Code(Expression(14, Add)) at (prev + 3, 9) to (start + 0, 14)
+ = (c7 + Zero)
+- Code(Expression(18, Add)) at (prev + 2, 14) to (start + 0, 19)
+ = (c9 + (c10 + c11))
+- Code(Expression(17, Sub)) at (prev + 1, 12) to (start + 0, 19)
+ = ((c9 + (c10 + c11)) - c12)
+- Code(Counter(10)) at (prev + 1, 13) to (start + 0, 21)
+- Code(Counter(11)) at (prev + 1, 10) to (start + 1, 14)
+- Code(Expression(23, Add)) at (prev + 3, 14) to (start + 0, 19)
+ = (c12 + (c13 + c14))
+- Code(Expression(22, Sub)) at (prev + 1, 15) to (start + 0, 22)
+ = ((c12 + (c13 + c14)) - c15)
+- Code(Counter(14)) at (prev + 1, 22) to (start + 2, 14)
+- Code(Counter(13)) at (prev + 3, 18) to (start + 2, 14)
+- Code(Expression(25, Add)) at (prev + 4, 9) to (start + 0, 14)
+ = (c13 + c14)
+- Code(Expression(28, Add)) at (prev + 2, 14) to (start + 0, 19)
+ = (c15 + c16)
+- Code(Expression(27, Sub)) at (prev + 1, 15) to (start + 0, 22)
+ = ((c15 + c16) - c17)
+- Code(Counter(16)) at (prev + 1, 22) to (start + 2, 14)
+- Code(Counter(18)) at (prev + 4, 17) to (start + 0, 22)
+- Code(Expression(29, Add)) at (prev + 3, 9) to (start + 0, 14)
+ = (c16 + Zero)
+- Code(Expression(30, Add)) at (prev + 2, 13) to (start + 1, 2)
+ = (c18 + c17)
+
diff --git a/tests/coverage-map/status-quo/continue.rs b/tests/coverage-map/status-quo/continue.rs
new file mode 100644
index 000000000..624aa9834
--- /dev/null
+++ b/tests/coverage-map/status-quo/continue.rs
@@ -0,0 +1,69 @@
+#![allow(unused_assignments, unused_variables)]
+
+fn main() {
+ let is_true = std::env::args().len() == 1;
+
+ let mut x = 0;
+ for _ in 0..10 {
+ match is_true {
+ true => {
+ continue;
+ }
+ _ => {
+ x = 1;
+ }
+ }
+ x = 3;
+ }
+ for _ in 0..10 {
+ match is_true {
+ false => {
+ x = 1;
+ }
+ _ => {
+ continue;
+ }
+ }
+ x = 3;
+ }
+ for _ in 0..10 {
+ match is_true {
+ true => {
+ x = 1;
+ }
+ _ => {
+ continue;
+ }
+ }
+ x = 3;
+ }
+ for _ in 0..10 {
+ if is_true {
+ continue;
+ }
+ x = 3;
+ }
+ for _ in 0..10 {
+ match is_true {
+ false => {
+ x = 1;
+ }
+ _ => {
+ let _ = x;
+ }
+ }
+ x = 3;
+ }
+ for _ in 0..10 {
+ match is_true {
+ false => {
+ x = 1;
+ }
+ _ => {
+ break;
+ }
+ }
+ x = 3;
+ }
+ let _ = x;
+}
diff --git a/tests/coverage-map/status-quo/dead_code.cov-map b/tests/coverage-map/status-quo/dead_code.cov-map
new file mode 100644
index 000000000..8d5f88e63
--- /dev/null
+++ b/tests/coverage-map/status-quo/dead_code.cov-map
@@ -0,0 +1,37 @@
+Function name: dead_code::main
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 1b, 01, 07, 0f, 05, 07, 10, 02, 06, 02, 02, 06, 00, 07, 07, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 27, 1) to (start + 7, 15)
+- Code(Counter(1)) at (prev + 7, 16) to (start + 2, 6)
+- Code(Expression(0, Sub)) at (prev + 2, 6) to (start + 0, 7)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2)
+ = (c1 + (c0 - c1))
+
+Function name: dead_code::unused_fn (unused)
+Raw bytes (24): 0x[01, 01, 00, 04, 01, 0f, 01, 07, 0f, 00, 07, 10, 02, 06, 00, 02, 06, 00, 07, 00, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 15, 1) to (start + 7, 15)
+- Code(Zero) at (prev + 7, 16) to (start + 2, 6)
+- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
+- Code(Zero) at (prev + 1, 1) to (start + 0, 2)
+
+Function name: dead_code::unused_pub_fn_not_in_library (unused)
+Raw bytes (24): 0x[01, 01, 00, 04, 01, 03, 01, 07, 0f, 00, 07, 10, 02, 06, 00, 02, 06, 00, 07, 00, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 3, 1) to (start + 7, 15)
+- Code(Zero) at (prev + 7, 16) to (start + 2, 6)
+- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
+- Code(Zero) at (prev + 1, 1) to (start + 0, 2)
+
diff --git a/tests/coverage-map/status-quo/dead_code.rs b/tests/coverage-map/status-quo/dead_code.rs
new file mode 100644
index 000000000..3492712a6
--- /dev/null
+++ b/tests/coverage-map/status-quo/dead_code.rs
@@ -0,0 +1,37 @@
+#![allow(dead_code, unused_assignments, unused_variables)]
+
+pub fn unused_pub_fn_not_in_library() {
+ // Initialize test constants in a way that cannot be determined at compile time, to ensure
+ // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
+ // dependent conditions.
+ let is_true = std::env::args().len() == 1;
+
+ let mut countdown = 0;
+ if is_true {
+ countdown = 10;
+ }
+}
+
+fn unused_fn() {
+ // Initialize test constants in a way that cannot be determined at compile time, to ensure
+ // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
+ // dependent conditions.
+ let is_true = std::env::args().len() == 1;
+
+ let mut countdown = 0;
+ if is_true {
+ countdown = 10;
+ }
+}
+
+fn main() {
+ // Initialize test constants in a way that cannot be determined at compile time, to ensure
+ // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
+ // dependent conditions.
+ let is_true = std::env::args().len() == 1;
+
+ let mut countdown = 0;
+ if is_true {
+ countdown = 10;
+ }
+}
diff --git a/tests/coverage-map/status-quo/drop_trait.cov-map b/tests/coverage-map/status-quo/drop_trait.cov-map
new file mode 100644
index 000000000..203d1048b
--- /dev/null
+++ b/tests/coverage-map/status-quo/drop_trait.cov-map
@@ -0,0 +1,21 @@
+Function name: <drop_trait::Firework as core::ops::drop::Drop>::drop
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 09, 05, 02, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 9, 5) to (start + 2, 6)
+
+Function name: drop_trait::main
+Raw bytes (26): 0x[01, 01, 01, 05, 00, 04, 01, 0e, 01, 05, 0c, 05, 06, 09, 01, 16, 00, 02, 06, 04, 0b, 03, 05, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 1
+- expression 0 operands: lhs = Counter(1), rhs = Zero
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 14, 1) to (start + 5, 12)
+- Code(Counter(1)) at (prev + 6, 9) to (start + 1, 22)
+- Code(Zero) at (prev + 2, 6) to (start + 4, 11)
+- Code(Expression(0, Add)) at (prev + 5, 1) to (start + 0, 2)
+ = (c1 + Zero)
+
diff --git a/tests/coverage-map/status-quo/drop_trait.rs b/tests/coverage-map/status-quo/drop_trait.rs
new file mode 100644
index 000000000..7b062719c
--- /dev/null
+++ b/tests/coverage-map/status-quo/drop_trait.rs
@@ -0,0 +1,33 @@
+#![allow(unused_assignments)]
+// failure-status: 1
+
+struct Firework {
+ strength: i32,
+}
+
+impl Drop for Firework {
+ fn drop(&mut self) {
+ println!("BOOM times {}!!!", self.strength);
+ }
+}
+
+fn main() -> Result<(), u8> {
+ let _firecracker = Firework { strength: 1 };
+
+ let _tnt = Firework { strength: 100 };
+
+ if true {
+ println!("Exiting with error...");
+ return Err(1);
+ }
+
+ let _ = Firework { strength: 1000 };
+
+ Ok(())
+}
+
+// Expected program output:
+// Exiting with error...
+// BOOM times 100!!!
+// BOOM times 1!!!
+// Error: 1
diff --git a/tests/coverage-map/status-quo/generator.cov-map b/tests/coverage-map/status-quo/generator.cov-map
new file mode 100644
index 000000000..a66c1af30
--- /dev/null
+++ b/tests/coverage-map/status-quo/generator.cov-map
@@ -0,0 +1,58 @@
+Function name: generator::get_u32
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 0b, 01, 01, 0b, 05, 01, 0e, 00, 13, 02, 00, 1d, 00, 3c, 07, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 11, 1) to (start + 1, 11)
+- Code(Counter(1)) at (prev + 1, 14) to (start + 0, 19)
+- Code(Expression(0, Sub)) at (prev + 0, 29) to (start + 0, 60)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2)
+ = (c1 + (c0 - c1))
+
+Function name: generator::main
+Raw bytes (71): 0x[01, 01, 0b, 01, 00, 05, 0b, 09, 0d, 11, 00, 11, 15, 2a, 19, 11, 15, 15, 19, 26, 00, 2a, 19, 11, 15, 09, 01, 0f, 01, 02, 16, 03, 07, 0b, 00, 2e, 11, 01, 2b, 00, 2d, 07, 01, 0e, 00, 35, 0f, 02, 0b, 00, 2e, 2a, 01, 22, 00, 27, 26, 00, 2c, 00, 2e, 1f, 01, 0e, 00, 35, 23, 02, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 11
+- expression 0 operands: lhs = Counter(0), rhs = Zero
+- expression 1 operands: lhs = Counter(1), rhs = Expression(2, Add)
+- expression 2 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 3 operands: lhs = Counter(4), rhs = Zero
+- expression 4 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 5 operands: lhs = Expression(10, Sub), rhs = Counter(6)
+- expression 6 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 7 operands: lhs = Counter(5), rhs = Counter(6)
+- expression 8 operands: lhs = Expression(9, Sub), rhs = Zero
+- expression 9 operands: lhs = Expression(10, Sub), rhs = Counter(6)
+- expression 10 operands: lhs = Counter(4), rhs = Counter(5)
+Number of file 0 mappings: 9
+- Code(Counter(0)) at (prev + 15, 1) to (start + 2, 22)
+- Code(Expression(0, Add)) at (prev + 7, 11) to (start + 0, 46)
+ = (c0 + Zero)
+- Code(Counter(4)) at (prev + 1, 43) to (start + 0, 45)
+- Code(Expression(1, Add)) at (prev + 1, 14) to (start + 0, 53)
+ = (c1 + (c2 + c3))
+- Code(Expression(3, Add)) at (prev + 2, 11) to (start + 0, 46)
+ = (c4 + Zero)
+- Code(Expression(10, Sub)) at (prev + 1, 34) to (start + 0, 39)
+ = (c4 - c5)
+- Code(Expression(9, Sub)) at (prev + 0, 44) to (start + 0, 46)
+ = ((c4 - c5) - c6)
+- Code(Expression(7, Add)) at (prev + 1, 14) to (start + 0, 53)
+ = (c5 + c6)
+- Code(Expression(8, Add)) at (prev + 2, 1) to (start + 0, 2)
+ = (((c4 - c5) - c6) + Zero)
+
+Function name: generator::main::{closure#0}
+Raw bytes (14): 0x[01, 01, 00, 02, 01, 11, 1c, 01, 1f, 05, 02, 10, 01, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 2
+- Code(Counter(0)) at (prev + 17, 28) to (start + 1, 31)
+- Code(Counter(1)) at (prev + 2, 16) to (start + 1, 6)
+
diff --git a/tests/coverage-map/status-quo/generator.rs b/tests/coverage-map/status-quo/generator.rs
new file mode 100644
index 000000000..431999102
--- /dev/null
+++ b/tests/coverage-map/status-quo/generator.rs
@@ -0,0 +1,30 @@
+#![feature(generators, generator_trait)]
+
+use std::ops::{Generator, GeneratorState};
+use std::pin::Pin;
+
+// The following implementation of a function called from a `yield` statement
+// (apparently requiring the Result and the `String` type or constructor)
+// creates conditions where the `generator::StateTransform` MIR transform will
+// drop all `Counter` `Coverage` statements from a MIR. `simplify.rs` has logic
+// to handle this condition, and still report dead block coverage.
+fn get_u32(val: bool) -> Result<u32, String> {
+ if val { Ok(1) } else { Err(String::from("some error")) }
+}
+
+fn main() {
+ let is_true = std::env::args().len() == 1;
+ let mut generator = || {
+ yield get_u32(is_true);
+ return "foo";
+ };
+
+ match Pin::new(&mut generator).resume(()) {
+ GeneratorState::Yielded(Ok(1)) => {}
+ _ => panic!("unexpected return from resume"),
+ }
+ match Pin::new(&mut generator).resume(()) {
+ GeneratorState::Complete("foo") => {}
+ _ => panic!("unexpected return from resume"),
+ }
+}
diff --git a/tests/coverage-map/status-quo/generics.cov-map b/tests/coverage-map/status-quo/generics.cov-map
new file mode 100644
index 000000000..6079a433c
--- /dev/null
+++ b/tests/coverage-map/status-quo/generics.cov-map
@@ -0,0 +1,45 @@
+Function name: <generics::Firework<f64> as core::ops::drop::Drop>::drop
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 11, 05, 02, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 17, 5) to (start + 2, 6)
+
+Function name: <generics::Firework<f64>>::set_strength
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 0a, 05, 02, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 10, 5) to (start + 2, 6)
+
+Function name: <generics::Firework<i32> as core::ops::drop::Drop>::drop
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 11, 05, 02, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 17, 5) to (start + 2, 6)
+
+Function name: <generics::Firework<i32>>::set_strength
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 0a, 05, 02, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 10, 5) to (start + 2, 6)
+
+Function name: generics::main
+Raw bytes (26): 0x[01, 01, 01, 05, 00, 04, 01, 16, 01, 08, 0c, 05, 09, 09, 01, 16, 00, 02, 06, 04, 0b, 03, 05, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 1
+- expression 0 operands: lhs = Counter(1), rhs = Zero
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 22, 1) to (start + 8, 12)
+- Code(Counter(1)) at (prev + 9, 9) to (start + 1, 22)
+- Code(Zero) at (prev + 2, 6) to (start + 4, 11)
+- Code(Expression(0, Add)) at (prev + 5, 1) to (start + 0, 2)
+ = (c1 + Zero)
+
diff --git a/tests/coverage-map/status-quo/generics.rs b/tests/coverage-map/status-quo/generics.rs
new file mode 100644
index 000000000..bf4c2d8d6
--- /dev/null
+++ b/tests/coverage-map/status-quo/generics.rs
@@ -0,0 +1,44 @@
+#![allow(unused_assignments)]
+// failure-status: 1
+
+struct Firework<T> where T: Copy + std::fmt::Display {
+ strength: T,
+}
+
+impl<T> Firework<T> where T: Copy + std::fmt::Display {
+ #[inline(always)]
+ fn set_strength(&mut self, new_strength: T) {
+ self.strength = new_strength;
+ }
+}
+
+impl<T> Drop for Firework<T> where T: Copy + std::fmt::Display {
+ #[inline(always)]
+ fn drop(&mut self) {
+ println!("BOOM times {}!!!", self.strength);
+ }
+}
+
+fn main() -> Result<(), u8> {
+ let mut firecracker = Firework { strength: 1 };
+ firecracker.set_strength(2);
+
+ let mut tnt = Firework { strength: 100.1 };
+ tnt.set_strength(200.1);
+ tnt.set_strength(300.3);
+
+ if true {
+ println!("Exiting with error...");
+ return Err(1);
+ }
+
+ let _ = Firework { strength: 1000 };
+
+ Ok(())
+}
+
+// Expected program output:
+// Exiting with error...
+// BOOM times 100!!!
+// BOOM times 1!!!
+// Error: 1
diff --git a/tests/coverage-map/status-quo/if.cov-map b/tests/coverage-map/status-quo/if.cov-map
new file mode 100644
index 000000000..391a69e0e
--- /dev/null
+++ b/tests/coverage-map/status-quo/if.cov-map
@@ -0,0 +1,15 @@
+Function name: if::main
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 03, 01, 12, 10, 05, 13, 05, 05, 06, 02, 05, 06, 00, 07, 07, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 3, 1) to (start + 18, 16)
+- Code(Counter(1)) at (prev + 19, 5) to (start + 5, 6)
+- Code(Expression(0, Sub)) at (prev + 5, 6) to (start + 0, 7)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2)
+ = (c1 + (c0 - c1))
+
diff --git a/tests/coverage-map/status-quo/if.rs b/tests/coverage-map/status-quo/if.rs
new file mode 100644
index 000000000..8ad5042ff
--- /dev/null
+++ b/tests/coverage-map/status-quo/if.rs
@@ -0,0 +1,28 @@
+#![allow(unused_assignments, unused_variables)]
+
+fn main() {
+ // Initialize test constants in a way that cannot be determined at compile time, to ensure
+ // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
+ // dependent conditions.
+ let
+ is_true
+ =
+ std::env::args().len()
+ ==
+ 1
+ ;
+ let
+ mut
+ countdown
+ =
+ 0
+ ;
+ if
+ is_true
+ {
+ countdown
+ =
+ 10
+ ;
+ }
+}
diff --git a/tests/coverage-map/status-quo/if_else.cov-map b/tests/coverage-map/status-quo/if_else.cov-map
new file mode 100644
index 000000000..da692ca3a
--- /dev/null
+++ b/tests/coverage-map/status-quo/if_else.cov-map
@@ -0,0 +1,25 @@
+Function name: if_else::main
+Raw bytes (53): 0x[01, 01, 07, 01, 05, 05, 02, 1b, 09, 05, 02, 09, 16, 1b, 09, 05, 02, 07, 01, 03, 01, 08, 10, 05, 09, 05, 05, 06, 02, 08, 09, 02, 10, 1b, 06, 09, 00, 10, 09, 01, 05, 05, 06, 16, 07, 05, 05, 06, 13, 06, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 7
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 2 operands: lhs = Expression(6, Add), rhs = Counter(2)
+- expression 3 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 4 operands: lhs = Counter(2), rhs = Expression(5, Sub)
+- expression 5 operands: lhs = Expression(6, Add), rhs = Counter(2)
+- expression 6 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 7
+- Code(Counter(0)) at (prev + 3, 1) to (start + 8, 16)
+- Code(Counter(1)) at (prev + 9, 5) to (start + 5, 6)
+- Code(Expression(0, Sub)) at (prev + 8, 9) to (start + 2, 16)
+ = (c0 - c1)
+- Code(Expression(6, Add)) at (prev + 6, 9) to (start + 0, 16)
+ = (c1 + (c0 - c1))
+- Code(Counter(2)) at (prev + 1, 5) to (start + 5, 6)
+- Code(Expression(5, Sub)) at (prev + 7, 5) to (start + 5, 6)
+ = ((c1 + (c0 - c1)) - c2)
+- Code(Expression(4, Add)) at (prev + 6, 1) to (start + 0, 2)
+ = (c2 + ((c1 + (c0 - c1)) - c2))
+
diff --git a/tests/coverage-map/status-quo/if_else.rs b/tests/coverage-map/status-quo/if_else.rs
new file mode 100644
index 000000000..3244e1e3a
--- /dev/null
+++ b/tests/coverage-map/status-quo/if_else.rs
@@ -0,0 +1,40 @@
+#![allow(unused_assignments, unused_variables)]
+
+fn main() {
+ // Initialize test constants in a way that cannot be determined at compile time, to ensure
+ // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
+ // dependent conditions.
+ let is_true = std::env::args().len() == 1;
+
+ let mut countdown = 0;
+ if
+ is_true
+ {
+ countdown
+ =
+ 10
+ ;
+ }
+ else // Note coverage region difference without semicolon
+ {
+ countdown
+ =
+ 100
+ }
+
+ if
+ is_true
+ {
+ countdown
+ =
+ 10
+ ;
+ }
+ else
+ {
+ countdown
+ =
+ 100
+ ;
+ }
+}
diff --git a/tests/coverage-map/status-quo/inline-dead.cov-map b/tests/coverage-map/status-quo/inline-dead.cov-map
new file mode 100644
index 000000000..dec43d3e8
--- /dev/null
+++ b/tests/coverage-map/status-quo/inline-dead.cov-map
@@ -0,0 +1,45 @@
+Function name: inline_dead::dead (unused)
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 19, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 25, 1) to (start + 2, 2)
+
+Function name: inline_dead::live::<false>
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 10, 01, 01, 09, 00, 02, 09, 00, 0f, 02, 02, 09, 00, 0a, 07, 02, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 16, 1) to (start + 1, 9)
+- Code(Zero) at (prev + 2, 9) to (start + 0, 15)
+- Code(Expression(0, Sub)) at (prev + 2, 9) to (start + 0, 10)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 2, 1) to (start + 0, 2)
+ = (c1 + (c0 - c1))
+
+Function name: inline_dead::main
+Raw bytes (16): 0x[01, 01, 01, 01, 00, 02, 01, 04, 01, 03, 0d, 03, 07, 06, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 1
+- expression 0 operands: lhs = Counter(0), rhs = Zero
+Number of file 0 mappings: 2
+- Code(Counter(0)) at (prev + 4, 1) to (start + 3, 13)
+- Code(Expression(0, Add)) at (prev + 7, 6) to (start + 2, 2)
+ = (c0 + Zero)
+
+Function name: inline_dead::main::{closure#0}
+Raw bytes (16): 0x[01, 01, 01, 01, 05, 02, 00, 09, 0d, 00, 0e, 03, 02, 05, 00, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 1
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+Number of file 0 mappings: 2
+- Code(Zero) at (prev + 9, 13) to (start + 0, 14)
+- Code(Expression(0, Add)) at (prev + 2, 5) to (start + 0, 6)
+ = (c0 + c1)
+
diff --git a/tests/coverage-map/status-quo/inline-dead.rs b/tests/coverage-map/status-quo/inline-dead.rs
new file mode 100644
index 000000000..854fa0629
--- /dev/null
+++ b/tests/coverage-map/status-quo/inline-dead.rs
@@ -0,0 +1,27 @@
+// Regression test for issue #98833.
+// compile-flags: -Zinline-mir -Cdebug-assertions=off
+
+fn main() {
+ println!("{}", live::<false>());
+
+ let f = |x: bool| {
+ debug_assert!(
+ x
+ );
+ };
+ f(false);
+}
+
+#[inline]
+fn live<const B: bool>() -> u32 {
+ if B {
+ dead()
+ } else {
+ 0
+ }
+}
+
+#[inline]
+fn dead() -> u32 {
+ 42
+}
diff --git a/tests/coverage-map/status-quo/inline.cov-map b/tests/coverage-map/status-quo/inline.cov-map
new file mode 100644
index 000000000..57ae85623
--- /dev/null
+++ b/tests/coverage-map/status-quo/inline.cov-map
@@ -0,0 +1,82 @@
+Function name: inline::display::<char>
+Raw bytes (35): 0x[01, 01, 03, 01, 05, 05, 00, 03, 05, 05, 01, 29, 01, 00, 22, 05, 01, 09, 00, 0a, 03, 00, 0e, 00, 10, 07, 00, 11, 02, 06, 0a, 03, 05, 01, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 3
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Zero
+- expression 2 operands: lhs = Expression(0, Add), rhs = Counter(1)
+Number of file 0 mappings: 5
+- Code(Counter(0)) at (prev + 41, 1) to (start + 0, 34)
+- Code(Counter(1)) at (prev + 1, 9) to (start + 0, 10)
+- Code(Expression(0, Add)) at (prev + 0, 14) to (start + 0, 16)
+ = (c0 + c1)
+- Code(Expression(1, Add)) at (prev + 0, 17) to (start + 2, 6)
+ = (c1 + Zero)
+- Code(Expression(2, Sub)) at (prev + 3, 5) to (start + 1, 2)
+ = ((c0 + c1) - c1)
+
+Function name: inline::error
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 31, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 49, 1) to (start + 2, 2)
+
+Function name: inline::length::<char>
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 1e, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 30, 1) to (start + 2, 2)
+
+Function name: inline::main
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 05, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 5, 1) to (start + 2, 2)
+
+Function name: inline::permutate::<char>
+Raw bytes (54): 0x[01, 01, 05, 01, 05, 02, 0d, 11, 00, 05, 13, 09, 0d, 08, 01, 0f, 01, 02, 0e, 05, 02, 0f, 02, 06, 02, 02, 0f, 00, 14, 11, 01, 0d, 00, 0e, 06, 00, 12, 00, 16, 0b, 00, 17, 04, 0a, 0d, 05, 0c, 02, 06, 0f, 03, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 5
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Expression(0, Sub), rhs = Counter(3)
+- expression 2 operands: lhs = Counter(4), rhs = Zero
+- expression 3 operands: lhs = Counter(1), rhs = Expression(4, Add)
+- expression 4 operands: lhs = Counter(2), rhs = Counter(3)
+Number of file 0 mappings: 8
+- Code(Counter(0)) at (prev + 15, 1) to (start + 2, 14)
+- Code(Counter(1)) at (prev + 2, 15) to (start + 2, 6)
+- Code(Expression(0, Sub)) at (prev + 2, 15) to (start + 0, 20)
+ = (c0 - c1)
+- Code(Counter(4)) at (prev + 1, 13) to (start + 0, 14)
+- Code(Expression(1, Sub)) at (prev + 0, 18) to (start + 0, 22)
+ = ((c0 - c1) - c3)
+- Code(Expression(2, Add)) at (prev + 0, 23) to (start + 4, 10)
+ = (c4 + Zero)
+- Code(Counter(3)) at (prev + 5, 12) to (start + 2, 6)
+- Code(Expression(3, Add)) at (prev + 3, 1) to (start + 0, 2)
+ = (c1 + (c2 + c3))
+
+Function name: inline::permutations::<char>
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 0a, 01, 03, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 10, 1) to (start + 3, 2)
+
+Function name: inline::swap::<char>
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 23, 01, 04, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 35, 1) to (start + 4, 2)
+
diff --git a/tests/coverage-map/status-quo/inline.rs b/tests/coverage-map/status-quo/inline.rs
new file mode 100644
index 000000000..9cfab9ddb
--- /dev/null
+++ b/tests/coverage-map/status-quo/inline.rs
@@ -0,0 +1,51 @@
+// compile-flags: -Zinline-mir
+
+use std::fmt::Display;
+
+fn main() {
+ permutations(&['a', 'b', 'c']);
+}
+
+#[inline(always)]
+fn permutations<T: Copy + Display>(xs: &[T]) {
+ let mut ys = xs.to_owned();
+ permutate(&mut ys, 0);
+}
+
+fn permutate<T: Copy + Display>(xs: &mut [T], k: usize) {
+ let n = length(xs);
+ if k == n {
+ display(xs);
+ } else if k < n {
+ for i in k..n {
+ swap(xs, i, k);
+ permutate(xs, k + 1);
+ swap(xs, i, k);
+ }
+ } else {
+ error();
+ }
+}
+
+fn length<T>(xs: &[T]) -> usize {
+ xs.len()
+}
+
+#[inline]
+fn swap<T: Copy>(xs: &mut [T], i: usize, j: usize) {
+ let t = xs[i];
+ xs[i] = xs[j];
+ xs[j] = t;
+}
+
+fn display<T: Display>(xs: &[T]) {
+ for x in xs {
+ print!("{}", x);
+ }
+ println!();
+}
+
+#[inline(always)]
+fn error() {
+ panic!("error");
+}
diff --git a/tests/coverage-map/status-quo/inner_items.cov-map b/tests/coverage-map/status-quo/inner_items.cov-map
new file mode 100644
index 000000000..3f39d74ef
--- /dev/null
+++ b/tests/coverage-map/status-quo/inner_items.cov-map
@@ -0,0 +1,49 @@
+Function name: <inner_items::main::InStruct as inner_items::main::InTrait>::default_trait_func
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 21, 09, 03, 0a]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 33, 9) to (start + 3, 10)
+
+Function name: <inner_items::main::InStruct as inner_items::main::InTrait>::trait_func
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 28, 09, 03, 0a]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 40, 9) to (start + 3, 10)
+
+Function name: inner_items::main
+Raw bytes (53): 0x[01, 01, 07, 01, 05, 05, 02, 1b, 09, 05, 02, 09, 16, 1b, 09, 05, 02, 07, 01, 03, 01, 07, 0f, 05, 07, 10, 02, 06, 02, 02, 06, 00, 07, 1b, 24, 08, 00, 0f, 09, 00, 10, 02, 06, 16, 02, 06, 00, 07, 13, 02, 09, 05, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 7
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 2 operands: lhs = Expression(6, Add), rhs = Counter(2)
+- expression 3 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 4 operands: lhs = Counter(2), rhs = Expression(5, Sub)
+- expression 5 operands: lhs = Expression(6, Add), rhs = Counter(2)
+- expression 6 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 7
+- Code(Counter(0)) at (prev + 3, 1) to (start + 7, 15)
+- Code(Counter(1)) at (prev + 7, 16) to (start + 2, 6)
+- Code(Expression(0, Sub)) at (prev + 2, 6) to (start + 0, 7)
+ = (c0 - c1)
+- Code(Expression(6, Add)) at (prev + 36, 8) to (start + 0, 15)
+ = (c1 + (c0 - c1))
+- Code(Counter(2)) at (prev + 0, 16) to (start + 2, 6)
+- Code(Expression(5, Sub)) at (prev + 2, 6) to (start + 0, 7)
+ = ((c1 + (c0 - c1)) - c2)
+- Code(Expression(4, Add)) at (prev + 2, 9) to (start + 5, 2)
+ = (c2 + ((c1 + (c0 - c1)) - c2))
+
+Function name: inner_items::main::in_func
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 12, 05, 04, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 18, 5) to (start + 4, 6)
+
diff --git a/tests/coverage-map/status-quo/inner_items.rs b/tests/coverage-map/status-quo/inner_items.rs
new file mode 100644
index 000000000..bcb62b303
--- /dev/null
+++ b/tests/coverage-map/status-quo/inner_items.rs
@@ -0,0 +1,57 @@
+#![allow(unused_assignments, unused_variables, dead_code)]
+
+fn main() {
+ // Initialize test constants in a way that cannot be determined at compile time, to ensure
+ // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
+ // dependent conditions.
+ let is_true = std::env::args().len() == 1;
+
+ let mut countdown = 0;
+ if is_true {
+ countdown = 10;
+ }
+
+ mod in_mod {
+ const IN_MOD_CONST: u32 = 1000;
+ }
+
+ fn in_func(a: u32) {
+ let b = 1;
+ let c = a + b;
+ println!("c = {}", c)
+ }
+
+ struct InStruct {
+ in_struct_field: u32,
+ }
+
+ const IN_CONST: u32 = 1234;
+
+ trait InTrait {
+ fn trait_func(&mut self, incr: u32);
+
+ fn default_trait_func(&mut self) {
+ in_func(IN_CONST);
+ self.trait_func(IN_CONST);
+ }
+ }
+
+ impl InTrait for InStruct {
+ fn trait_func(&mut self, incr: u32) {
+ self.in_struct_field += incr;
+ in_func(self.in_struct_field);
+ }
+ }
+
+ type InType = String;
+
+ if is_true {
+ in_func(countdown);
+ }
+
+ let mut val = InStruct {
+ in_struct_field: 101,
+ };
+
+ val.default_trait_func();
+}
diff --git a/tests/coverage-map/status-quo/issue-83601.cov-map b/tests/coverage-map/status-quo/issue-83601.cov-map
new file mode 100644
index 000000000..f5db3a897
--- /dev/null
+++ b/tests/coverage-map/status-quo/issue-83601.cov-map
@@ -0,0 +1,28 @@
+Function name: <issue_83601::Foo as core::cmp::PartialEq>::eq
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 03, 11, 00, 1a]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 3, 17) to (start + 0, 26)
+
+Function name: <issue_83601::Foo as core::fmt::Debug>::fmt
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 03, 0a, 00, 0f]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 3, 10) to (start + 0, 15)
+
+Function name: issue_83601::main
+Raw bytes (21): 0x[01, 01, 01, 05, 09, 03, 01, 06, 01, 02, 1c, 05, 03, 09, 01, 1c, 02, 02, 05, 03, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 1
+- expression 0 operands: lhs = Counter(1), rhs = Counter(2)
+Number of file 0 mappings: 3
+- Code(Counter(0)) at (prev + 6, 1) to (start + 2, 28)
+- Code(Counter(1)) at (prev + 3, 9) to (start + 1, 28)
+- Code(Expression(0, Sub)) at (prev + 2, 5) to (start + 3, 2)
+ = (c1 - c2)
+
diff --git a/tests/coverage-map/status-quo/issue-83601.rs b/tests/coverage-map/status-quo/issue-83601.rs
new file mode 100644
index 000000000..0b72a8194
--- /dev/null
+++ b/tests/coverage-map/status-quo/issue-83601.rs
@@ -0,0 +1,14 @@
+// Shows that rust-lang/rust/83601 is resolved
+
+#[derive(Debug, PartialEq, Eq)]
+struct Foo(u32);
+
+fn main() {
+ let bar = Foo(1);
+ assert_eq!(bar, Foo(1));
+ let baz = Foo(0);
+ assert_ne!(baz, Foo(1));
+ println!("{:?}", Foo(1));
+ println!("{:?}", bar);
+ println!("{:?}", baz);
+}
diff --git a/tests/coverage-map/status-quo/issue-84561.cov-map b/tests/coverage-map/status-quo/issue-84561.cov-map
new file mode 100644
index 000000000..fe098fd39
--- /dev/null
+++ b/tests/coverage-map/status-quo/issue-84561.cov-map
@@ -0,0 +1,233 @@
+Function name: <issue_84561::Foo as core::cmp::PartialEq>::eq
+Raw bytes (14): 0x[01, 01, 00, 02, 01, 04, 0a, 00, 13, 00, 00, 0a, 00, 13]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 2
+- Code(Counter(0)) at (prev + 4, 10) to (start + 0, 19)
+- Code(Zero) at (prev + 0, 10) to (start + 0, 19)
+
+Function name: <issue_84561::Foo as core::fmt::Debug>::fmt
+Raw bytes (29): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 89, 01, 09, 00, 25, 05, 00, 25, 00, 26, 02, 01, 09, 00, 0f, 07, 01, 05, 00, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 137, 9) to (start + 0, 37)
+- Code(Counter(1)) at (prev + 0, 37) to (start + 0, 38)
+- Code(Expression(0, Sub)) at (prev + 1, 9) to (start + 0, 15)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 1, 5) to (start + 0, 6)
+ = (c1 + (c0 - c1))
+
+Function name: issue_84561::main
+Raw bytes (10): 0x[01, 01, 00, 01, 01, b2, 01, 01, 04, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 178, 1) to (start + 4, 2)
+
+Function name: issue_84561::test1
+Raw bytes (78): 0x[01, 01, 0e, 05, 06, 01, 05, 09, 36, 03, 09, 0d, 2e, 33, 0d, 09, 36, 03, 09, 11, 26, 2b, 11, 0d, 2e, 33, 0d, 09, 36, 03, 09, 09, 01, 98, 01, 01, 01, 0b, 05, 01, 0c, 00, 1e, 03, 01, 05, 00, 0b, 09, 00, 0c, 00, 1e, 33, 01, 0d, 01, 0b, 0d, 01, 0c, 00, 1e, 2b, 01, 05, 03, 0b, 11, 03, 0c, 00, 1e, 23, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 14
+- expression 0 operands: lhs = Counter(1), rhs = Expression(1, Sub)
+- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 2 operands: lhs = Counter(2), rhs = Expression(13, Sub)
+- expression 3 operands: lhs = Expression(0, Add), rhs = Counter(2)
+- expression 4 operands: lhs = Counter(3), rhs = Expression(11, Sub)
+- expression 5 operands: lhs = Expression(12, Add), rhs = Counter(3)
+- expression 6 operands: lhs = Counter(2), rhs = Expression(13, Sub)
+- expression 7 operands: lhs = Expression(0, Add), rhs = Counter(2)
+- expression 8 operands: lhs = Counter(4), rhs = Expression(9, Sub)
+- expression 9 operands: lhs = Expression(10, Add), rhs = Counter(4)
+- expression 10 operands: lhs = Counter(3), rhs = Expression(11, Sub)
+- expression 11 operands: lhs = Expression(12, Add), rhs = Counter(3)
+- expression 12 operands: lhs = Counter(2), rhs = Expression(13, Sub)
+- expression 13 operands: lhs = Expression(0, Add), rhs = Counter(2)
+Number of file 0 mappings: 9
+- Code(Counter(0)) at (prev + 152, 1) to (start + 1, 11)
+- Code(Counter(1)) at (prev + 1, 12) to (start + 0, 30)
+- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 0, 11)
+ = (c1 + (c0 - c1))
+- Code(Counter(2)) at (prev + 0, 12) to (start + 0, 30)
+- Code(Expression(12, Add)) at (prev + 1, 13) to (start + 1, 11)
+ = (c2 + ((c1 + (c0 - c1)) - c2))
+- Code(Counter(3)) at (prev + 1, 12) to (start + 0, 30)
+- Code(Expression(10, Add)) at (prev + 1, 5) to (start + 3, 11)
+ = (c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3))
+- Code(Counter(4)) at (prev + 3, 12) to (start + 0, 30)
+- Code(Expression(8, Add)) at (prev + 1, 1) to (start + 0, 2)
+ = (c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4))
+
+Function name: issue_84561::test2
+Raw bytes (24): 0x[01, 01, 02, 05, 06, 01, 05, 03, 01, ae, 01, 01, 01, 10, 05, 01, 11, 00, 23, 03, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(1), rhs = Expression(1, Sub)
+- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
+Number of file 0 mappings: 3
+- Code(Counter(0)) at (prev + 174, 1) to (start + 1, 16)
+- Code(Counter(1)) at (prev + 1, 17) to (start + 0, 35)
+- Code(Expression(0, Add)) at (prev + 1, 1) to (start + 0, 2)
+ = (c1 + (c0 - c1))
+
+Function name: issue_84561::test2::call_print
+Raw bytes (10): 0x[01, 01, 00, 01, 01, a5, 01, 09, 02, 0a]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 165, 9) to (start + 2, 10)
+
+Function name: issue_84561::test3
+Raw bytes (437): 0x[01, 01, 41, 05, 09, 0d, 11, 15, 19, 12, 1d, 15, 19, 21, 25, 1e, 29, 21, 25, 31, 39, 3d, 41, 2e, 45, 3d, 41, 42, 49, 45, 4d, 3f, 51, 42, 49, 45, 4d, 5d, 8a, 01, 8f, 01, 5d, 92, 01, 55, 51, 59, 92, 01, 55, 51, 59, 8f, 01, 5d, 92, 01, 55, 51, 59, 87, 01, 61, 5d, 8a, 01, 8f, 01, 5d, 92, 01, 55, 51, 59, 82, 01, 65, 87, 01, 61, 5d, 8a, 01, 8f, 01, 5d, 92, 01, 55, 51, 59, 75, f6, 01, fb, 01, 79, 71, fe, 01, 82, 02, 71, 69, 6d, 71, fe, 01, 82, 02, 71, 69, 6d, 69, 6d, 82, 02, 71, 69, 6d, fb, 01, 79, 71, fe, 01, 82, 02, 71, 69, 6d, f3, 01, 7d, 75, f6, 01, fb, 01, 79, 71, fe, 01, 82, 02, 71, 69, 6d, ee, 01, 81, 01, f3, 01, 7d, 75, f6, 01, fb, 01, 79, 71, fe, 01, 82, 02, 71, 69, 6d, 33, 01, 06, 01, 03, 1c, 05, 04, 09, 01, 1c, 02, 02, 05, 04, 1f, 0d, 05, 05, 00, 1f, 06, 01, 05, 00, 1f, 15, 01, 09, 01, 1c, 12, 02, 05, 00, 1f, 0e, 01, 05, 00, 0f, 00, 00, 20, 00, 30, 21, 01, 05, 03, 0f, 00, 03, 20, 00, 30, 00, 00, 33, 00, 41, 00, 00, 4b, 00, 5a, 1e, 01, 05, 00, 0f, 00, 05, 09, 03, 10, 00, 05, 0d, 00, 1b, 00, 02, 0d, 00, 1c, 1a, 04, 09, 05, 06, 31, 06, 05, 03, 06, 22, 04, 05, 03, 06, 3d, 04, 09, 04, 06, 2e, 05, 08, 00, 0f, 45, 01, 09, 03, 0a, 2a, 05, 09, 03, 0a, 3f, 05, 08, 00, 0f, 51, 01, 09, 00, 13, 00, 03, 0d, 00, 1d, 3a, 03, 09, 00, 13, 00, 03, 0d, 00, 1d, 87, 01, 03, 05, 00, 0f, 8f, 01, 01, 0c, 00, 13, 5d, 01, 0d, 00, 13, 8a, 01, 02, 0d, 00, 13, 82, 01, 04, 05, 02, 13, 65, 03, 0d, 00, 13, 7e, 02, 0d, 00, 13, f3, 01, 03, 05, 00, 0f, 69, 01, 0c, 00, 13, 6d, 01, 0d, 03, 0e, 75, 04, 0d, 00, 13, fb, 01, 02, 0d, 00, 17, 82, 02, 01, 14, 00, 1b, 71, 01, 15, 00, 1b, fe, 01, 02, 15, 00, 1b, f6, 01, 04, 0d, 00, 13, 7d, 03, 09, 00, 19, ee, 01, 02, 05, 00, 0f, ea, 01, 03, 09, 00, 22, 00, 02, 05, 00, 0f, 00, 03, 09, 00, 2c, 00, 02, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 65
+- expression 0 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 1 operands: lhs = Counter(3), rhs = Counter(4)
+- expression 2 operands: lhs = Counter(5), rhs = Counter(6)
+- expression 3 operands: lhs = Expression(4, Sub), rhs = Counter(7)
+- expression 4 operands: lhs = Counter(5), rhs = Counter(6)
+- expression 5 operands: lhs = Counter(8), rhs = Counter(9)
+- expression 6 operands: lhs = Expression(7, Sub), rhs = Counter(10)
+- expression 7 operands: lhs = Counter(8), rhs = Counter(9)
+- expression 8 operands: lhs = Counter(12), rhs = Counter(14)
+- expression 9 operands: lhs = Counter(15), rhs = Counter(16)
+- expression 10 operands: lhs = Expression(11, Sub), rhs = Counter(17)
+- expression 11 operands: lhs = Counter(15), rhs = Counter(16)
+- expression 12 operands: lhs = Expression(16, Sub), rhs = Counter(18)
+- expression 13 operands: lhs = Counter(17), rhs = Counter(19)
+- expression 14 operands: lhs = Expression(15, Add), rhs = Counter(20)
+- expression 15 operands: lhs = Expression(16, Sub), rhs = Counter(18)
+- expression 16 operands: lhs = Counter(17), rhs = Counter(19)
+- expression 17 operands: lhs = Counter(23), rhs = Expression(34, Sub)
+- expression 18 operands: lhs = Expression(35, Add), rhs = Counter(23)
+- expression 19 operands: lhs = Expression(36, Sub), rhs = Counter(21)
+- expression 20 operands: lhs = Counter(20), rhs = Counter(22)
+- expression 21 operands: lhs = Expression(36, Sub), rhs = Counter(21)
+- expression 22 operands: lhs = Counter(20), rhs = Counter(22)
+- expression 23 operands: lhs = Expression(35, Add), rhs = Counter(23)
+- expression 24 operands: lhs = Expression(36, Sub), rhs = Counter(21)
+- expression 25 operands: lhs = Counter(20), rhs = Counter(22)
+- expression 26 operands: lhs = Expression(33, Add), rhs = Counter(24)
+- expression 27 operands: lhs = Counter(23), rhs = Expression(34, Sub)
+- expression 28 operands: lhs = Expression(35, Add), rhs = Counter(23)
+- expression 29 operands: lhs = Expression(36, Sub), rhs = Counter(21)
+- expression 30 operands: lhs = Counter(20), rhs = Counter(22)
+- expression 31 operands: lhs = Expression(32, Sub), rhs = Counter(25)
+- expression 32 operands: lhs = Expression(33, Add), rhs = Counter(24)
+- expression 33 operands: lhs = Counter(23), rhs = Expression(34, Sub)
+- expression 34 operands: lhs = Expression(35, Add), rhs = Counter(23)
+- expression 35 operands: lhs = Expression(36, Sub), rhs = Counter(21)
+- expression 36 operands: lhs = Counter(20), rhs = Counter(22)
+- expression 37 operands: lhs = Counter(29), rhs = Expression(61, Sub)
+- expression 38 operands: lhs = Expression(62, Add), rhs = Counter(30)
+- expression 39 operands: lhs = Counter(28), rhs = Expression(63, Sub)
+- expression 40 operands: lhs = Expression(64, Sub), rhs = Counter(28)
+- expression 41 operands: lhs = Counter(26), rhs = Counter(27)
+- expression 42 operands: lhs = Counter(28), rhs = Expression(63, Sub)
+- expression 43 operands: lhs = Expression(64, Sub), rhs = Counter(28)
+- expression 44 operands: lhs = Counter(26), rhs = Counter(27)
+- expression 45 operands: lhs = Counter(26), rhs = Counter(27)
+- expression 46 operands: lhs = Expression(64, Sub), rhs = Counter(28)
+- expression 47 operands: lhs = Counter(26), rhs = Counter(27)
+- expression 48 operands: lhs = Expression(62, Add), rhs = Counter(30)
+- expression 49 operands: lhs = Counter(28), rhs = Expression(63, Sub)
+- expression 50 operands: lhs = Expression(64, Sub), rhs = Counter(28)
+- expression 51 operands: lhs = Counter(26), rhs = Counter(27)
+- expression 52 operands: lhs = Expression(60, Add), rhs = Counter(31)
+- expression 53 operands: lhs = Counter(29), rhs = Expression(61, Sub)
+- expression 54 operands: lhs = Expression(62, Add), rhs = Counter(30)
+- expression 55 operands: lhs = Counter(28), rhs = Expression(63, Sub)
+- expression 56 operands: lhs = Expression(64, Sub), rhs = Counter(28)
+- expression 57 operands: lhs = Counter(26), rhs = Counter(27)
+- expression 58 operands: lhs = Expression(59, Sub), rhs = Counter(32)
+- expression 59 operands: lhs = Expression(60, Add), rhs = Counter(31)
+- expression 60 operands: lhs = Counter(29), rhs = Expression(61, Sub)
+- expression 61 operands: lhs = Expression(62, Add), rhs = Counter(30)
+- expression 62 operands: lhs = Counter(28), rhs = Expression(63, Sub)
+- expression 63 operands: lhs = Expression(64, Sub), rhs = Counter(28)
+- expression 64 operands: lhs = Counter(26), rhs = Counter(27)
+Number of file 0 mappings: 51
+- Code(Counter(0)) at (prev + 6, 1) to (start + 3, 28)
+- Code(Counter(1)) at (prev + 4, 9) to (start + 1, 28)
+- Code(Expression(0, Sub)) at (prev + 2, 5) to (start + 4, 31)
+ = (c1 - c2)
+- Code(Counter(3)) at (prev + 5, 5) to (start + 0, 31)
+- Code(Expression(1, Sub)) at (prev + 1, 5) to (start + 0, 31)
+ = (c3 - c4)
+- Code(Counter(5)) at (prev + 1, 9) to (start + 1, 28)
+- Code(Expression(4, Sub)) at (prev + 2, 5) to (start + 0, 31)
+ = (c5 - c6)
+- Code(Expression(3, Sub)) at (prev + 1, 5) to (start + 0, 15)
+ = ((c5 - c6) - c7)
+- Code(Zero) at (prev + 0, 32) to (start + 0, 48)
+- Code(Counter(8)) at (prev + 1, 5) to (start + 3, 15)
+- Code(Zero) at (prev + 3, 32) to (start + 0, 48)
+- Code(Zero) at (prev + 0, 51) to (start + 0, 65)
+- Code(Zero) at (prev + 0, 75) to (start + 0, 90)
+- Code(Expression(7, Sub)) at (prev + 1, 5) to (start + 0, 15)
+ = (c8 - c9)
+- Code(Zero) at (prev + 5, 9) to (start + 3, 16)
+- Code(Zero) at (prev + 5, 13) to (start + 0, 27)
+- Code(Zero) at (prev + 2, 13) to (start + 0, 28)
+- Code(Expression(6, Sub)) at (prev + 4, 9) to (start + 5, 6)
+ = ((c8 - c9) - c10)
+- Code(Counter(12)) at (prev + 6, 5) to (start + 3, 6)
+- Code(Expression(8, Sub)) at (prev + 4, 5) to (start + 3, 6)
+ = (c12 - c14)
+- Code(Counter(15)) at (prev + 4, 9) to (start + 4, 6)
+- Code(Expression(11, Sub)) at (prev + 5, 8) to (start + 0, 15)
+ = (c15 - c16)
+- Code(Counter(17)) at (prev + 1, 9) to (start + 3, 10)
+- Code(Expression(10, Sub)) at (prev + 5, 9) to (start + 3, 10)
+ = ((c15 - c16) - c17)
+- Code(Expression(15, Add)) at (prev + 5, 8) to (start + 0, 15)
+ = ((c17 - c19) + c18)
+- Code(Counter(20)) at (prev + 1, 9) to (start + 0, 19)
+- Code(Zero) at (prev + 3, 13) to (start + 0, 29)
+- Code(Expression(14, Sub)) at (prev + 3, 9) to (start + 0, 19)
+ = (((c17 - c19) + c18) - c20)
+- Code(Zero) at (prev + 3, 13) to (start + 0, 29)
+- Code(Expression(33, Add)) at (prev + 3, 5) to (start + 0, 15)
+ = (c23 + (((c20 - c22) + c21) - c23))
+- Code(Expression(35, Add)) at (prev + 1, 12) to (start + 0, 19)
+ = ((c20 - c22) + c21)
+- Code(Counter(23)) at (prev + 1, 13) to (start + 0, 19)
+- Code(Expression(34, Sub)) at (prev + 2, 13) to (start + 0, 19)
+ = (((c20 - c22) + c21) - c23)
+- Code(Expression(32, Sub)) at (prev + 4, 5) to (start + 2, 19)
+ = ((c23 + (((c20 - c22) + c21) - c23)) - c24)
+- Code(Counter(25)) at (prev + 3, 13) to (start + 0, 19)
+- Code(Expression(31, Sub)) at (prev + 2, 13) to (start + 0, 19)
+ = (((c23 + (((c20 - c22) + c21) - c23)) - c24) - c25)
+- Code(Expression(60, Add)) at (prev + 3, 5) to (start + 0, 15)
+ = (c29 + ((c28 + ((c26 - c27) - c28)) - c30))
+- Code(Counter(26)) at (prev + 1, 12) to (start + 0, 19)
+- Code(Counter(27)) at (prev + 1, 13) to (start + 3, 14)
+- Code(Counter(29)) at (prev + 4, 13) to (start + 0, 19)
+- Code(Expression(62, Add)) at (prev + 2, 13) to (start + 0, 23)
+ = (c28 + ((c26 - c27) - c28))
+- Code(Expression(64, Sub)) at (prev + 1, 20) to (start + 0, 27)
+ = (c26 - c27)
+- Code(Counter(28)) at (prev + 1, 21) to (start + 0, 27)
+- Code(Expression(63, Sub)) at (prev + 2, 21) to (start + 0, 27)
+ = ((c26 - c27) - c28)
+- Code(Expression(61, Sub)) at (prev + 4, 13) to (start + 0, 19)
+ = ((c28 + ((c26 - c27) - c28)) - c30)
+- Code(Counter(31)) at (prev + 3, 9) to (start + 0, 25)
+- Code(Expression(59, Sub)) at (prev + 2, 5) to (start + 0, 15)
+ = ((c29 + ((c28 + ((c26 - c27) - c28)) - c30)) - c31)
+- Code(Expression(58, Sub)) at (prev + 3, 9) to (start + 0, 34)
+ = (((c29 + ((c28 + ((c26 - c27) - c28)) - c30)) - c31) - c32)
+- Code(Zero) at (prev + 2, 5) to (start + 0, 15)
+- Code(Zero) at (prev + 3, 9) to (start + 0, 44)
+- Code(Zero) at (prev + 2, 1) to (start + 0, 2)
+
diff --git a/tests/coverage-map/status-quo/issue-84561.rs b/tests/coverage-map/status-quo/issue-84561.rs
new file mode 100644
index 000000000..facf5b5b4
--- /dev/null
+++ b/tests/coverage-map/status-quo/issue-84561.rs
@@ -0,0 +1,182 @@
+// This demonstrated Issue #84561: function-like macros produce unintuitive coverage results.
+
+// failure-status: 101
+#[derive(PartialEq, Eq)]
+struct Foo(u32);
+fn test3() {
+ let is_true = std::env::args().len() == 1;
+ let bar = Foo(1);
+ assert_eq!(bar, Foo(1));
+ let baz = Foo(0);
+ assert_ne!(baz, Foo(1));
+ println!("{:?}", Foo(1));
+ println!("{:?}", bar);
+ println!("{:?}", baz);
+
+ assert_eq!(Foo(1), Foo(1));
+ assert_ne!(Foo(0), Foo(1));
+ assert_eq!(Foo(2), Foo(2));
+ let bar = Foo(0);
+ assert_ne!(bar, Foo(3));
+ assert_ne!(Foo(0), Foo(4));
+ assert_eq!(Foo(3), Foo(3), "with a message");
+ println!("{:?}", bar);
+ println!("{:?}", Foo(1));
+
+ assert_ne!(Foo(0), Foo(5), "{}", if is_true { "true message" } else { "false message" });
+ assert_ne!(
+ Foo(0)
+ ,
+ Foo(5)
+ ,
+ "{}"
+ ,
+ if
+ is_true
+ {
+ "true message"
+ } else {
+ "false message"
+ }
+ );
+
+ let is_true = std::env::args().len() == 1;
+
+ assert_eq!(
+ Foo(1),
+ Foo(1)
+ );
+ assert_ne!(
+ Foo(0),
+ Foo(1)
+ );
+ assert_eq!(
+ Foo(2),
+ Foo(2)
+ );
+ let bar = Foo(1);
+ assert_ne!(
+ bar,
+ Foo(3)
+ );
+ if is_true {
+ assert_ne!(
+ Foo(0),
+ Foo(4)
+ );
+ } else {
+ assert_eq!(
+ Foo(3),
+ Foo(3)
+ );
+ }
+ if is_true {
+ assert_ne!(
+ Foo(0),
+ Foo(4),
+ "with a message"
+ );
+ } else {
+ assert_eq!(
+ Foo(3),
+ Foo(3),
+ "with a message"
+ );
+ }
+ assert_ne!(
+ if is_true {
+ Foo(0)
+ } else {
+ Foo(1)
+ },
+ Foo(5)
+ );
+ assert_ne!(
+ Foo(5),
+ if is_true {
+ Foo(0)
+ } else {
+ Foo(1)
+ }
+ );
+ assert_ne!(
+ if is_true {
+ assert_eq!(
+ Foo(3),
+ Foo(3)
+ );
+ Foo(0)
+ } else {
+ assert_ne!(
+ if is_true {
+ Foo(0)
+ } else {
+ Foo(1)
+ },
+ Foo(5)
+ );
+ Foo(1)
+ },
+ Foo(5),
+ "with a message"
+ );
+ assert_eq!(
+ Foo(1),
+ Foo(3),
+ "this assert should fail"
+ );
+ assert_eq!(
+ Foo(3),
+ Foo(3),
+ "this assert should not be reached"
+ );
+}
+
+impl std::fmt::Debug for Foo {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+ write!(f, "try and succeed")?;
+ Ok(())
+ }
+}
+
+static mut DEBUG_LEVEL_ENABLED: bool = false;
+
+macro_rules! debug {
+ ($($arg:tt)+) => (
+ if unsafe { DEBUG_LEVEL_ENABLED } {
+ println!($($arg)+);
+ }
+ );
+}
+
+fn test1() {
+ debug!("debug is enabled");
+ debug!("debug is enabled");
+ let _ = 0;
+ debug!("debug is enabled");
+ unsafe {
+ DEBUG_LEVEL_ENABLED = true;
+ }
+ debug!("debug is enabled");
+}
+
+macro_rules! call_debug {
+ ($($arg:tt)+) => (
+ fn call_print(s: &str) {
+ print!("{}", s);
+ }
+
+ call_print("called from call_debug: ");
+ debug!($($arg)+);
+ );
+}
+
+fn test2() {
+ call_debug!("debug is enabled");
+}
+
+fn main() {
+ test1();
+ test2();
+ test3();
+}
diff --git a/tests/coverage-map/status-quo/issue-93054.cov-map b/tests/coverage-map/status-quo/issue-93054.cov-map
new file mode 100644
index 000000000..52fe7f58d
--- /dev/null
+++ b/tests/coverage-map/status-quo/issue-93054.cov-map
@@ -0,0 +1,24 @@
+Function name: issue_93054::foo2 (unused)
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 16, 01, 00, 1d]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 22, 1) to (start + 0, 29)
+
+Function name: issue_93054::main
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 1e, 01, 00, 0d]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 30, 1) to (start + 0, 13)
+
+Function name: issue_93054::make (unused)
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 1a, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 26, 1) to (start + 2, 2)
+
diff --git a/tests/coverage-map/status-quo/issue-93054.rs b/tests/coverage-map/status-quo/issue-93054.rs
new file mode 100644
index 000000000..da546cfee
--- /dev/null
+++ b/tests/coverage-map/status-quo/issue-93054.rs
@@ -0,0 +1,30 @@
+#![allow(dead_code, unreachable_code)]
+
+// Regression test for #93054: Functions using uninhabited types often only have a single,
+// unreachable basic block which doesn't get instrumented. This should not cause llvm-cov to fail.
+// Since these kinds functions can't be invoked anyway, it's ok to not have coverage data for them.
+
+// compile-flags: --edition=2021
+
+enum Never {}
+
+impl Never {
+ fn foo(self) {
+ match self {}
+ make().map(|never| match never {});
+ }
+
+ fn bar(&self) {
+ match *self {}
+ }
+}
+
+async fn foo2(never: Never) {
+ match never {}
+}
+
+fn make() -> Option<Never> {
+ None
+}
+
+fn main() {}
diff --git a/tests/coverage-map/status-quo/lazy_boolean.cov-map b/tests/coverage-map/status-quo/lazy_boolean.cov-map
new file mode 100644
index 000000000..b18a96404
--- /dev/null
+++ b/tests/coverage-map/status-quo/lazy_boolean.cov-map
@@ -0,0 +1,223 @@
+Function name: lazy_boolean::main
+Raw bytes (646): 0x[01, 01, a8, 01, 01, 05, 09, 9a, 05, 9f, 05, 09, 05, 02, 05, 02, 9f, 05, 09, 05, 02, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, 97, 05, 00, 09, 9a, 05, 9f, 05, 09, 05, 02, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, 8f, 05, 00, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, 15, 82, 05, 87, 05, 15, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, 87, 05, 00, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, ff, 04, 00, 15, 82, 05, 87, 05, 15, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, ff, 04, 19, 15, 82, 05, 87, 05, 15, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, 19, fa, 04, ff, 04, 19, 15, 82, 05, 87, 05, 15, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, f7, 04, 1d, 19, fa, 04, ff, 04, 19, 15, 82, 05, 87, 05, 15, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, 1d, f2, 04, f7, 04, 1d, 19, fa, 04, ff, 04, 19, 15, 82, 05, 87, 05, 15, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, ef, 04, 21, 1d, f2, 04, f7, 04, 1d, 19, fa, 04, ff, 04, 19, 15, 82, 05, 87, 05, 15, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, 21, ea, 04, ef, 04, 21, 1d, f2, 04, f7, 04, 1d, 19, fa, 04, ff, 04, 19, 15, 82, 05, 87, 05, 15, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, e7, 04, 25, 21, ea, 04, ef, 04, 21, 1d, f2, 04, f7, 04, 1d, 19, fa, 04, ff, 04, 19, 15, 82, 05, 87, 05, 15, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, 25, e2, 04, e7, 04, 25, 21, ea, 04, ef, 04, 21, 1d, f2, 04, f7, 04, 1d, 19, fa, 04, ff, 04, 19, 15, 82, 05, 87, 05, 15, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, 1c, 01, 03, 01, 07, 0f, 05, 07, 10, 04, 06, 02, 04, 06, 00, 07, 97, 05, 02, 09, 00, 11, 9f, 05, 02, 0d, 00, 12, 9a, 05, 02, 0d, 00, 12, 8f, 05, 03, 09, 00, 11, 33, 02, 0d, 00, 12, 92, 05, 02, 0d, 00, 12, 87, 05, 02, 09, 00, 11, 6f, 00, 14, 00, 19, 11, 00, 1d, 00, 22, ff, 04, 01, 09, 00, 11, ab, 01, 00, 14, 00, 19, 15, 00, 1d, 00, 22, cb, 01, 04, 09, 00, 10, fa, 04, 01, 05, 03, 06, 19, 03, 06, 00, 07, f7, 04, 03, 09, 00, 10, 1d, 01, 05, 03, 06, f2, 04, 05, 05, 03, 06, ef, 04, 05, 09, 00, 10, ea, 04, 00, 11, 02, 06, 21, 02, 06, 00, 07, e7, 04, 02, 08, 00, 0f, 25, 00, 10, 02, 06, e2, 04, 02, 0c, 02, 06, df, 04, 03, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 168
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(2), rhs = Expression(166, Sub)
+- expression 2 operands: lhs = Expression(167, Add), rhs = Counter(2)
+- expression 3 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 4 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 5 operands: lhs = Expression(167, Add), rhs = Counter(2)
+- expression 6 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 7 operands: lhs = Counter(3), rhs = Expression(164, Sub)
+- expression 8 operands: lhs = Expression(165, Add), rhs = Counter(3)
+- expression 9 operands: lhs = Counter(2), rhs = Expression(166, Sub)
+- expression 10 operands: lhs = Expression(167, Add), rhs = Counter(2)
+- expression 11 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 12 operands: lhs = Expression(165, Add), rhs = Zero
+- expression 13 operands: lhs = Counter(2), rhs = Expression(166, Sub)
+- expression 14 operands: lhs = Expression(167, Add), rhs = Counter(2)
+- expression 15 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 16 operands: lhs = Expression(165, Add), rhs = Counter(3)
+- expression 17 operands: lhs = Counter(2), rhs = Expression(166, Sub)
+- expression 18 operands: lhs = Expression(167, Add), rhs = Counter(2)
+- expression 19 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 20 operands: lhs = Counter(4), rhs = Expression(162, Sub)
+- expression 21 operands: lhs = Expression(163, Add), rhs = Counter(4)
+- expression 22 operands: lhs = Counter(3), rhs = Expression(164, Sub)
+- expression 23 operands: lhs = Expression(165, Add), rhs = Counter(3)
+- expression 24 operands: lhs = Counter(2), rhs = Expression(166, Sub)
+- expression 25 operands: lhs = Expression(167, Add), rhs = Counter(2)
+- expression 26 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 27 operands: lhs = Expression(163, Add), rhs = Zero
+- expression 28 operands: lhs = Counter(3), rhs = Expression(164, Sub)
+- expression 29 operands: lhs = Expression(165, Add), rhs = Counter(3)
+- expression 30 operands: lhs = Counter(2), rhs = Expression(166, Sub)
+- expression 31 operands: lhs = Expression(167, Add), rhs = Counter(2)
+- expression 32 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 33 operands: lhs = Counter(5), rhs = Expression(160, Sub)
+- expression 34 operands: lhs = Expression(161, Add), rhs = Counter(5)
+- expression 35 operands: lhs = Counter(4), rhs = Expression(162, Sub)
+- expression 36 operands: lhs = Expression(163, Add), rhs = Counter(4)
+- expression 37 operands: lhs = Counter(3), rhs = Expression(164, Sub)
+- expression 38 operands: lhs = Expression(165, Add), rhs = Counter(3)
+- expression 39 operands: lhs = Counter(2), rhs = Expression(166, Sub)
+- expression 40 operands: lhs = Expression(167, Add), rhs = Counter(2)
+- expression 41 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 42 operands: lhs = Expression(161, Add), rhs = Zero
+- expression 43 operands: lhs = Counter(4), rhs = Expression(162, Sub)
+- expression 44 operands: lhs = Expression(163, Add), rhs = Counter(4)
+- expression 45 operands: lhs = Counter(3), rhs = Expression(164, Sub)
+- expression 46 operands: lhs = Expression(165, Add), rhs = Counter(3)
+- expression 47 operands: lhs = Counter(2), rhs = Expression(166, Sub)
+- expression 48 operands: lhs = Expression(167, Add), rhs = Counter(2)
+- expression 49 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 50 operands: lhs = Expression(159, Add), rhs = Zero
+- expression 51 operands: lhs = Counter(5), rhs = Expression(160, Sub)
+- expression 52 operands: lhs = Expression(161, Add), rhs = Counter(5)
+- expression 53 operands: lhs = Counter(4), rhs = Expression(162, Sub)
+- expression 54 operands: lhs = Expression(163, Add), rhs = Counter(4)
+- expression 55 operands: lhs = Counter(3), rhs = Expression(164, Sub)
+- expression 56 operands: lhs = Expression(165, Add), rhs = Counter(3)
+- expression 57 operands: lhs = Counter(2), rhs = Expression(166, Sub)
+- expression 58 operands: lhs = Expression(167, Add), rhs = Counter(2)
+- expression 59 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 60 operands: lhs = Expression(159, Add), rhs = Counter(6)
+- expression 61 operands: lhs = Counter(5), rhs = Expression(160, Sub)
+- expression 62 operands: lhs = Expression(161, Add), rhs = Counter(5)
+- expression 63 operands: lhs = Counter(4), rhs = Expression(162, Sub)
+- expression 64 operands: lhs = Expression(163, Add), rhs = Counter(4)
+- expression 65 operands: lhs = Counter(3), rhs = Expression(164, Sub)
+- expression 66 operands: lhs = Expression(165, Add), rhs = Counter(3)
+- expression 67 operands: lhs = Counter(2), rhs = Expression(166, Sub)
+- expression 68 operands: lhs = Expression(167, Add), rhs = Counter(2)
+- expression 69 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 70 operands: lhs = Counter(6), rhs = Expression(158, Sub)
+- expression 71 operands: lhs = Expression(159, Add), rhs = Counter(6)
+- expression 72 operands: lhs = Counter(5), rhs = Expression(160, Sub)
+- expression 73 operands: lhs = Expression(161, Add), rhs = Counter(5)
+- expression 74 operands: lhs = Counter(4), rhs = Expression(162, Sub)
+- expression 75 operands: lhs = Expression(163, Add), rhs = Counter(4)
+- expression 76 operands: lhs = Counter(3), rhs = Expression(164, Sub)
+- expression 77 operands: lhs = Expression(165, Add), rhs = Counter(3)
+- expression 78 operands: lhs = Counter(2), rhs = Expression(166, Sub)
+- expression 79 operands: lhs = Expression(167, Add), rhs = Counter(2)
+- expression 80 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 81 operands: lhs = Expression(157, Add), rhs = Counter(7)
+- expression 82 operands: lhs = Counter(6), rhs = Expression(158, Sub)
+- expression 83 operands: lhs = Expression(159, Add), rhs = Counter(6)
+- expression 84 operands: lhs = Counter(5), rhs = Expression(160, Sub)
+- expression 85 operands: lhs = Expression(161, Add), rhs = Counter(5)
+- expression 86 operands: lhs = Counter(4), rhs = Expression(162, Sub)
+- expression 87 operands: lhs = Expression(163, Add), rhs = Counter(4)
+- expression 88 operands: lhs = Counter(3), rhs = Expression(164, Sub)
+- expression 89 operands: lhs = Expression(165, Add), rhs = Counter(3)
+- expression 90 operands: lhs = Counter(2), rhs = Expression(166, Sub)
+- expression 91 operands: lhs = Expression(167, Add), rhs = Counter(2)
+- expression 92 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 93 operands: lhs = Counter(7), rhs = Expression(156, Sub)
+- expression 94 operands: lhs = Expression(157, Add), rhs = Counter(7)
+- expression 95 operands: lhs = Counter(6), rhs = Expression(158, Sub)
+- expression 96 operands: lhs = Expression(159, Add), rhs = Counter(6)
+- expression 97 operands: lhs = Counter(5), rhs = Expression(160, Sub)
+- expression 98 operands: lhs = Expression(161, Add), rhs = Counter(5)
+- expression 99 operands: lhs = Counter(4), rhs = Expression(162, Sub)
+- expression 100 operands: lhs = Expression(163, Add), rhs = Counter(4)
+- expression 101 operands: lhs = Counter(3), rhs = Expression(164, Sub)
+- expression 102 operands: lhs = Expression(165, Add), rhs = Counter(3)
+- expression 103 operands: lhs = Counter(2), rhs = Expression(166, Sub)
+- expression 104 operands: lhs = Expression(167, Add), rhs = Counter(2)
+- expression 105 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 106 operands: lhs = Expression(155, Add), rhs = Counter(8)
+- expression 107 operands: lhs = Counter(7), rhs = Expression(156, Sub)
+- expression 108 operands: lhs = Expression(157, Add), rhs = Counter(7)
+- expression 109 operands: lhs = Counter(6), rhs = Expression(158, Sub)
+- expression 110 operands: lhs = Expression(159, Add), rhs = Counter(6)
+- expression 111 operands: lhs = Counter(5), rhs = Expression(160, Sub)
+- expression 112 operands: lhs = Expression(161, Add), rhs = Counter(5)
+- expression 113 operands: lhs = Counter(4), rhs = Expression(162, Sub)
+- expression 114 operands: lhs = Expression(163, Add), rhs = Counter(4)
+- expression 115 operands: lhs = Counter(3), rhs = Expression(164, Sub)
+- expression 116 operands: lhs = Expression(165, Add), rhs = Counter(3)
+- expression 117 operands: lhs = Counter(2), rhs = Expression(166, Sub)
+- expression 118 operands: lhs = Expression(167, Add), rhs = Counter(2)
+- expression 119 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 120 operands: lhs = Counter(8), rhs = Expression(154, Sub)
+- expression 121 operands: lhs = Expression(155, Add), rhs = Counter(8)
+- expression 122 operands: lhs = Counter(7), rhs = Expression(156, Sub)
+- expression 123 operands: lhs = Expression(157, Add), rhs = Counter(7)
+- expression 124 operands: lhs = Counter(6), rhs = Expression(158, Sub)
+- expression 125 operands: lhs = Expression(159, Add), rhs = Counter(6)
+- expression 126 operands: lhs = Counter(5), rhs = Expression(160, Sub)
+- expression 127 operands: lhs = Expression(161, Add), rhs = Counter(5)
+- expression 128 operands: lhs = Counter(4), rhs = Expression(162, Sub)
+- expression 129 operands: lhs = Expression(163, Add), rhs = Counter(4)
+- expression 130 operands: lhs = Counter(3), rhs = Expression(164, Sub)
+- expression 131 operands: lhs = Expression(165, Add), rhs = Counter(3)
+- expression 132 operands: lhs = Counter(2), rhs = Expression(166, Sub)
+- expression 133 operands: lhs = Expression(167, Add), rhs = Counter(2)
+- expression 134 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 135 operands: lhs = Expression(153, Add), rhs = Counter(9)
+- expression 136 operands: lhs = Counter(8), rhs = Expression(154, Sub)
+- expression 137 operands: lhs = Expression(155, Add), rhs = Counter(8)
+- expression 138 operands: lhs = Counter(7), rhs = Expression(156, Sub)
+- expression 139 operands: lhs = Expression(157, Add), rhs = Counter(7)
+- expression 140 operands: lhs = Counter(6), rhs = Expression(158, Sub)
+- expression 141 operands: lhs = Expression(159, Add), rhs = Counter(6)
+- expression 142 operands: lhs = Counter(5), rhs = Expression(160, Sub)
+- expression 143 operands: lhs = Expression(161, Add), rhs = Counter(5)
+- expression 144 operands: lhs = Counter(4), rhs = Expression(162, Sub)
+- expression 145 operands: lhs = Expression(163, Add), rhs = Counter(4)
+- expression 146 operands: lhs = Counter(3), rhs = Expression(164, Sub)
+- expression 147 operands: lhs = Expression(165, Add), rhs = Counter(3)
+- expression 148 operands: lhs = Counter(2), rhs = Expression(166, Sub)
+- expression 149 operands: lhs = Expression(167, Add), rhs = Counter(2)
+- expression 150 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 151 operands: lhs = Counter(9), rhs = Expression(152, Sub)
+- expression 152 operands: lhs = Expression(153, Add), rhs = Counter(9)
+- expression 153 operands: lhs = Counter(8), rhs = Expression(154, Sub)
+- expression 154 operands: lhs = Expression(155, Add), rhs = Counter(8)
+- expression 155 operands: lhs = Counter(7), rhs = Expression(156, Sub)
+- expression 156 operands: lhs = Expression(157, Add), rhs = Counter(7)
+- expression 157 operands: lhs = Counter(6), rhs = Expression(158, Sub)
+- expression 158 operands: lhs = Expression(159, Add), rhs = Counter(6)
+- expression 159 operands: lhs = Counter(5), rhs = Expression(160, Sub)
+- expression 160 operands: lhs = Expression(161, Add), rhs = Counter(5)
+- expression 161 operands: lhs = Counter(4), rhs = Expression(162, Sub)
+- expression 162 operands: lhs = Expression(163, Add), rhs = Counter(4)
+- expression 163 operands: lhs = Counter(3), rhs = Expression(164, Sub)
+- expression 164 operands: lhs = Expression(165, Add), rhs = Counter(3)
+- expression 165 operands: lhs = Counter(2), rhs = Expression(166, Sub)
+- expression 166 operands: lhs = Expression(167, Add), rhs = Counter(2)
+- expression 167 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 28
+- Code(Counter(0)) at (prev + 3, 1) to (start + 7, 15)
+- Code(Counter(1)) at (prev + 7, 16) to (start + 4, 6)
+- Code(Expression(0, Sub)) at (prev + 4, 6) to (start + 0, 7)
+ = (c0 - c1)
+- Code(Expression(165, Add)) at (prev + 2, 9) to (start + 0, 17)
+ = (c2 + ((c1 + (c0 - c1)) - c2))
+- Code(Expression(167, Add)) at (prev + 2, 13) to (start + 0, 18)
+ = (c1 + (c0 - c1))
+- Code(Expression(166, Sub)) at (prev + 2, 13) to (start + 0, 18)
+ = ((c1 + (c0 - c1)) - c2)
+- Code(Expression(163, Add)) at (prev + 3, 9) to (start + 0, 17)
+ = (c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3))
+- Code(Expression(12, Add)) at (prev + 2, 13) to (start + 0, 18)
+ = ((c2 + ((c1 + (c0 - c1)) - c2)) + Zero)
+- Code(Expression(164, Sub)) at (prev + 2, 13) to (start + 0, 18)
+ = ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)
+- Code(Expression(161, Add)) at (prev + 2, 9) to (start + 0, 17)
+ = (c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4))
+- Code(Expression(27, Add)) at (prev + 0, 20) to (start + 0, 25)
+ = ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) + Zero)
+- Code(Counter(4)) at (prev + 0, 29) to (start + 0, 34)
+- Code(Expression(159, Add)) at (prev + 1, 9) to (start + 0, 17)
+ = (c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5))
+- Code(Expression(42, Add)) at (prev + 0, 20) to (start + 0, 25)
+ = ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) + Zero)
+- Code(Counter(5)) at (prev + 0, 29) to (start + 0, 34)
+- Code(Expression(50, Add)) at (prev + 4, 9) to (start + 0, 16)
+ = ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) + Zero)
+- Code(Expression(158, Sub)) at (prev + 1, 5) to (start + 3, 6)
+ = ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)
+- Code(Counter(6)) at (prev + 3, 6) to (start + 0, 7)
+- Code(Expression(157, Add)) at (prev + 3, 9) to (start + 0, 16)
+ = (c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6))
+- Code(Counter(7)) at (prev + 1, 5) to (start + 3, 6)
+- Code(Expression(156, Sub)) at (prev + 5, 5) to (start + 3, 6)
+ = ((c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)) - c7)
+- Code(Expression(155, Add)) at (prev + 5, 9) to (start + 0, 16)
+ = (c7 + ((c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)) - c7))
+- Code(Expression(154, Sub)) at (prev + 0, 17) to (start + 2, 6)
+ = ((c7 + ((c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)) - c7)) - c8)
+- Code(Counter(8)) at (prev + 2, 6) to (start + 0, 7)
+- Code(Expression(153, Add)) at (prev + 2, 8) to (start + 0, 15)
+ = (c8 + ((c7 + ((c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)) - c7)) - c8))
+- Code(Counter(9)) at (prev + 0, 16) to (start + 2, 6)
+- Code(Expression(152, Sub)) at (prev + 2, 12) to (start + 2, 6)
+ = ((c8 + ((c7 + ((c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)) - c7)) - c8)) - c9)
+- Code(Expression(151, Add)) at (prev + 3, 1) to (start + 0, 2)
+ = (c9 + ((c8 + ((c7 + ((c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)) - c7)) - c8)) - c9))
+
diff --git a/tests/coverage-map/status-quo/lazy_boolean.rs b/tests/coverage-map/status-quo/lazy_boolean.rs
new file mode 100644
index 000000000..bb6219e85
--- /dev/null
+++ b/tests/coverage-map/status-quo/lazy_boolean.rs
@@ -0,0 +1,61 @@
+#![allow(unused_assignments, unused_variables)]
+
+fn main() {
+ // Initialize test constants in a way that cannot be determined at compile time, to ensure
+ // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
+ // dependent conditions.
+ let is_true = std::env::args().len() == 1;
+
+ let (mut a, mut b, mut c) = (0, 0, 0);
+ if is_true {
+ a = 1;
+ b = 10;
+ c = 100;
+ }
+ let
+ somebool
+ =
+ a < b
+ ||
+ b < c
+ ;
+ let
+ somebool
+ =
+ b < a
+ ||
+ b < c
+ ;
+ let somebool = a < b && b < c;
+ let somebool = b < a && b < c;
+
+ if
+ !
+ is_true
+ {
+ a = 2
+ ;
+ }
+
+ if
+ is_true
+ {
+ b = 30
+ ;
+ }
+ else
+ {
+ c = 400
+ ;
+ }
+
+ if !is_true {
+ a = 2;
+ }
+
+ if is_true {
+ b = 30;
+ } else {
+ c = 400;
+ }
+}
diff --git a/tests/coverage-map/status-quo/loop_break_value.cov-map b/tests/coverage-map/status-quo/loop_break_value.cov-map
new file mode 100644
index 000000000..75018442d
--- /dev/null
+++ b/tests/coverage-map/status-quo/loop_break_value.cov-map
@@ -0,0 +1,8 @@
+Function name: loop_break_value::main
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 03, 01, 0a, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 3, 1) to (start + 10, 2)
+
diff --git a/tests/coverage-map/status-quo/loop_break_value.rs b/tests/coverage-map/status-quo/loop_break_value.rs
new file mode 100644
index 000000000..dbc4fad7a
--- /dev/null
+++ b/tests/coverage-map/status-quo/loop_break_value.rs
@@ -0,0 +1,13 @@
+#![allow(unused_assignments, unused_variables)]
+
+fn main() {
+ let result
+ =
+ loop
+ {
+ break
+ 10
+ ;
+ }
+ ;
+}
diff --git a/tests/coverage-map/status-quo/loops_branches.cov-map b/tests/coverage-map/status-quo/loops_branches.cov-map
new file mode 100644
index 000000000..480bbfd97
--- /dev/null
+++ b/tests/coverage-map/status-quo/loops_branches.cov-map
@@ -0,0 +1,185 @@
+Function name: <loops_branches::DebugTest as core::fmt::Debug>::fmt
+Raw bytes (251): 0x[01, 01, 32, 05, 09, 00, 02, bf, 01, 19, c3, 01, c7, 01, 0d, 00, 11, 15, c3, 01, c7, 01, 0d, 00, 11, 15, ba, 01, 00, bf, 01, 19, c3, 01, c7, 01, 0d, 00, 11, 15, ba, 01, 15, bf, 01, 19, c3, 01, c7, 01, 0d, 00, 11, 15, b6, 01, 1d, ba, 01, 15, bf, 01, 19, c3, 01, c7, 01, 0d, 00, 11, 15, 00, b2, 01, b6, 01, 1d, ba, 01, 15, bf, 01, 19, c3, 01, c7, 01, 0d, 00, 11, 15, af, 01, 11, 00, b2, 01, b6, 01, 1d, ba, 01, 15, bf, 01, 19, c3, 01, c7, 01, 0d, 00, 11, 15, 25, a7, 01, aa, 01, 19, af, 01, 11, 00, b2, 01, b6, 01, 1d, ba, 01, 15, bf, 01, 19, c3, 01, c7, 01, 0d, 00, 11, 15, 14, 01, 09, 05, 01, 10, 05, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 02, 01, 0e, 00, 0f, 07, 01, 0d, 00, 1e, 25, 00, 1e, 00, 1f, 00, 01, 10, 01, 0a, ba, 01, 03, 0d, 00, 0e, bf, 01, 00, 12, 00, 17, 27, 01, 10, 00, 14, b6, 01, 01, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, b2, 01, 01, 12, 00, 13, af, 01, 01, 11, 00, 22, aa, 01, 00, 22, 00, 23, 00, 01, 14, 01, 0e, 19, 03, 09, 00, 0f, a3, 01, 01, 05, 00, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 50
+- expression 0 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 1 operands: lhs = Zero, rhs = Expression(0, Sub)
+- expression 2 operands: lhs = Expression(47, Add), rhs = Counter(6)
+- expression 3 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
+- expression 4 operands: lhs = Counter(3), rhs = Zero
+- expression 5 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 6 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
+- expression 7 operands: lhs = Counter(3), rhs = Zero
+- expression 8 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 9 operands: lhs = Expression(46, Sub), rhs = Zero
+- expression 10 operands: lhs = Expression(47, Add), rhs = Counter(6)
+- expression 11 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
+- expression 12 operands: lhs = Counter(3), rhs = Zero
+- expression 13 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 14 operands: lhs = Expression(46, Sub), rhs = Counter(5)
+- expression 15 operands: lhs = Expression(47, Add), rhs = Counter(6)
+- expression 16 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
+- expression 17 operands: lhs = Counter(3), rhs = Zero
+- expression 18 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 19 operands: lhs = Expression(45, Sub), rhs = Counter(7)
+- expression 20 operands: lhs = Expression(46, Sub), rhs = Counter(5)
+- expression 21 operands: lhs = Expression(47, Add), rhs = Counter(6)
+- expression 22 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
+- expression 23 operands: lhs = Counter(3), rhs = Zero
+- expression 24 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 25 operands: lhs = Zero, rhs = Expression(44, Sub)
+- expression 26 operands: lhs = Expression(45, Sub), rhs = Counter(7)
+- expression 27 operands: lhs = Expression(46, Sub), rhs = Counter(5)
+- expression 28 operands: lhs = Expression(47, Add), rhs = Counter(6)
+- expression 29 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
+- expression 30 operands: lhs = Counter(3), rhs = Zero
+- expression 31 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 32 operands: lhs = Expression(43, Add), rhs = Counter(4)
+- expression 33 operands: lhs = Zero, rhs = Expression(44, Sub)
+- expression 34 operands: lhs = Expression(45, Sub), rhs = Counter(7)
+- expression 35 operands: lhs = Expression(46, Sub), rhs = Counter(5)
+- expression 36 operands: lhs = Expression(47, Add), rhs = Counter(6)
+- expression 37 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
+- expression 38 operands: lhs = Counter(3), rhs = Zero
+- expression 39 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 40 operands: lhs = Counter(9), rhs = Expression(41, Add)
+- expression 41 operands: lhs = Expression(42, Sub), rhs = Counter(6)
+- expression 42 operands: lhs = Expression(43, Add), rhs = Counter(4)
+- expression 43 operands: lhs = Zero, rhs = Expression(44, Sub)
+- expression 44 operands: lhs = Expression(45, Sub), rhs = Counter(7)
+- expression 45 operands: lhs = Expression(46, Sub), rhs = Counter(5)
+- expression 46 operands: lhs = Expression(47, Add), rhs = Counter(6)
+- expression 47 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
+- expression 48 operands: lhs = Counter(3), rhs = Zero
+- expression 49 operands: lhs = Counter(4), rhs = Counter(5)
+Number of file 0 mappings: 20
+- Code(Counter(0)) at (prev + 9, 5) to (start + 1, 16)
+- Code(Counter(1)) at (prev + 2, 16) to (start + 0, 21)
+- Code(Zero) at (prev + 1, 23) to (start + 0, 27)
+- Code(Zero) at (prev + 0, 28) to (start + 0, 30)
+- Code(Expression(0, Sub)) at (prev + 1, 14) to (start + 0, 15)
+ = (c1 - c2)
+- Code(Expression(1, Add)) at (prev + 1, 13) to (start + 0, 30)
+ = (Zero + (c1 - c2))
+- Code(Counter(9)) at (prev + 0, 30) to (start + 0, 31)
+- Code(Zero) at (prev + 1, 16) to (start + 1, 10)
+- Code(Expression(46, Sub)) at (prev + 3, 13) to (start + 0, 14)
+ = (((c3 + Zero) + (c4 + c5)) - c6)
+- Code(Expression(47, Add)) at (prev + 0, 18) to (start + 0, 23)
+ = ((c3 + Zero) + (c4 + c5))
+- Code(Expression(9, Add)) at (prev + 1, 16) to (start + 0, 20)
+ = ((((c3 + Zero) + (c4 + c5)) - c6) + Zero)
+- Code(Expression(45, Sub)) at (prev + 1, 20) to (start + 0, 25)
+ = ((((c3 + Zero) + (c4 + c5)) - c6) - c5)
+- Code(Zero) at (prev + 1, 27) to (start + 0, 31)
+- Code(Zero) at (prev + 0, 32) to (start + 0, 34)
+- Code(Expression(44, Sub)) at (prev + 1, 18) to (start + 0, 19)
+ = (((((c3 + Zero) + (c4 + c5)) - c6) - c5) - c7)
+- Code(Expression(43, Add)) at (prev + 1, 17) to (start + 0, 34)
+ = (Zero + (((((c3 + Zero) + (c4 + c5)) - c6) - c5) - c7))
+- Code(Expression(42, Sub)) at (prev + 0, 34) to (start + 0, 35)
+ = ((Zero + (((((c3 + Zero) + (c4 + c5)) - c6) - c5) - c7)) - c4)
+- Code(Zero) at (prev + 1, 20) to (start + 1, 14)
+- Code(Counter(6)) at (prev + 3, 9) to (start + 0, 15)
+- Code(Expression(40, Add)) at (prev + 1, 5) to (start + 0, 6)
+ = (c9 + (((Zero + (((((c3 + Zero) + (c4 + c5)) - c6) - c5) - c7)) - c4) + c6))
+
+Function name: <loops_branches::DisplayTest as core::fmt::Display>::fmt
+Raw bytes (255): 0x[01, 01, 34, 01, 05, 02, 09, 00, 0e, 02, 09, c3, 01, 19, c7, 01, cb, 01, 05, 0d, 11, 15, c7, 01, cb, 01, 05, 0d, 11, 15, be, 01, 00, c3, 01, 19, c7, 01, cb, 01, 05, 0d, 11, 15, be, 01, 11, c3, 01, 19, c7, 01, cb, 01, 05, 0d, 11, 15, ba, 01, 1d, be, 01, 11, c3, 01, 19, c7, 01, cb, 01, 05, 0d, 11, 15, 00, b6, 01, ba, 01, 1d, be, 01, 11, c3, 01, 19, c7, 01, cb, 01, 05, 0d, 11, 15, b3, 01, 15, 00, b6, 01, ba, 01, 1d, be, 01, 11, c3, 01, 19, c7, 01, cb, 01, 05, 0d, 11, 15, ae, 01, cf, 01, b3, 01, 15, 00, b6, 01, ba, 01, 1d, be, 01, 11, c3, 01, 19, c7, 01, cb, 01, 05, 0d, 11, 15, 19, 25, 14, 01, 22, 05, 01, 11, 00, 01, 12, 01, 0a, 02, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 0e, 01, 0e, 00, 0f, 0b, 01, 0d, 00, 1e, 25, 00, 1e, 00, 1f, be, 01, 02, 0d, 00, 0e, c3, 01, 00, 12, 00, 17, 2f, 01, 10, 00, 15, 00, 00, 16, 01, 0e, ba, 01, 02, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, b6, 01, 01, 12, 00, 13, b3, 01, 01, 11, 00, 22, ae, 01, 00, 22, 00, 23, 19, 03, 09, 00, 0f, ab, 01, 01, 05, 00, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 52
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Expression(0, Sub), rhs = Counter(2)
+- expression 2 operands: lhs = Zero, rhs = Expression(3, Sub)
+- expression 3 operands: lhs = Expression(0, Sub), rhs = Counter(2)
+- expression 4 operands: lhs = Expression(48, Add), rhs = Counter(6)
+- expression 5 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
+- expression 6 operands: lhs = Counter(1), rhs = Counter(3)
+- expression 7 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 8 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
+- expression 9 operands: lhs = Counter(1), rhs = Counter(3)
+- expression 10 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 11 operands: lhs = Expression(47, Sub), rhs = Zero
+- expression 12 operands: lhs = Expression(48, Add), rhs = Counter(6)
+- expression 13 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
+- expression 14 operands: lhs = Counter(1), rhs = Counter(3)
+- expression 15 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 16 operands: lhs = Expression(47, Sub), rhs = Counter(4)
+- expression 17 operands: lhs = Expression(48, Add), rhs = Counter(6)
+- expression 18 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
+- expression 19 operands: lhs = Counter(1), rhs = Counter(3)
+- expression 20 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 21 operands: lhs = Expression(46, Sub), rhs = Counter(7)
+- expression 22 operands: lhs = Expression(47, Sub), rhs = Counter(4)
+- expression 23 operands: lhs = Expression(48, Add), rhs = Counter(6)
+- expression 24 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
+- expression 25 operands: lhs = Counter(1), rhs = Counter(3)
+- expression 26 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 27 operands: lhs = Zero, rhs = Expression(45, Sub)
+- expression 28 operands: lhs = Expression(46, Sub), rhs = Counter(7)
+- expression 29 operands: lhs = Expression(47, Sub), rhs = Counter(4)
+- expression 30 operands: lhs = Expression(48, Add), rhs = Counter(6)
+- expression 31 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
+- expression 32 operands: lhs = Counter(1), rhs = Counter(3)
+- expression 33 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 34 operands: lhs = Expression(44, Add), rhs = Counter(5)
+- expression 35 operands: lhs = Zero, rhs = Expression(45, Sub)
+- expression 36 operands: lhs = Expression(46, Sub), rhs = Counter(7)
+- expression 37 operands: lhs = Expression(47, Sub), rhs = Counter(4)
+- expression 38 operands: lhs = Expression(48, Add), rhs = Counter(6)
+- expression 39 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
+- expression 40 operands: lhs = Counter(1), rhs = Counter(3)
+- expression 41 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 42 operands: lhs = Expression(43, Sub), rhs = Expression(51, Add)
+- expression 43 operands: lhs = Expression(44, Add), rhs = Counter(5)
+- expression 44 operands: lhs = Zero, rhs = Expression(45, Sub)
+- expression 45 operands: lhs = Expression(46, Sub), rhs = Counter(7)
+- expression 46 operands: lhs = Expression(47, Sub), rhs = Counter(4)
+- expression 47 operands: lhs = Expression(48, Add), rhs = Counter(6)
+- expression 48 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
+- expression 49 operands: lhs = Counter(1), rhs = Counter(3)
+- expression 50 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 51 operands: lhs = Counter(6), rhs = Counter(9)
+Number of file 0 mappings: 20
+- Code(Counter(0)) at (prev + 34, 5) to (start + 1, 17)
+- Code(Zero) at (prev + 1, 18) to (start + 1, 10)
+- Code(Expression(0, Sub)) at (prev + 2, 16) to (start + 0, 21)
+ = (c0 - c1)
+- Code(Zero) at (prev + 1, 23) to (start + 0, 27)
+- Code(Zero) at (prev + 0, 28) to (start + 0, 30)
+- Code(Expression(3, Sub)) at (prev + 1, 14) to (start + 0, 15)
+ = ((c0 - c1) - c2)
+- Code(Expression(2, Add)) at (prev + 1, 13) to (start + 0, 30)
+ = (Zero + ((c0 - c1) - c2))
+- Code(Counter(9)) at (prev + 0, 30) to (start + 0, 31)
+- Code(Expression(47, Sub)) at (prev + 2, 13) to (start + 0, 14)
+ = (((c1 + c3) + (c4 + c5)) - c6)
+- Code(Expression(48, Add)) at (prev + 0, 18) to (start + 0, 23)
+ = ((c1 + c3) + (c4 + c5))
+- Code(Expression(11, Add)) at (prev + 1, 16) to (start + 0, 21)
+ = ((((c1 + c3) + (c4 + c5)) - c6) + Zero)
+- Code(Zero) at (prev + 0, 22) to (start + 1, 14)
+- Code(Expression(46, Sub)) at (prev + 2, 20) to (start + 0, 25)
+ = ((((c1 + c3) + (c4 + c5)) - c6) - c4)
+- Code(Zero) at (prev + 1, 27) to (start + 0, 31)
+- Code(Zero) at (prev + 0, 32) to (start + 0, 34)
+- Code(Expression(45, Sub)) at (prev + 1, 18) to (start + 0, 19)
+ = (((((c1 + c3) + (c4 + c5)) - c6) - c4) - c7)
+- Code(Expression(44, Add)) at (prev + 1, 17) to (start + 0, 34)
+ = (Zero + (((((c1 + c3) + (c4 + c5)) - c6) - c4) - c7))
+- Code(Expression(43, Sub)) at (prev + 0, 34) to (start + 0, 35)
+ = ((Zero + (((((c1 + c3) + (c4 + c5)) - c6) - c4) - c7)) - c5)
+- Code(Counter(6)) at (prev + 3, 9) to (start + 0, 15)
+- Code(Expression(42, Add)) at (prev + 1, 5) to (start + 0, 6)
+ = (((Zero + (((((c1 + c3) + (c4 + c5)) - c6) - c4) - c7)) - c5) + (c6 + c9))
+
+Function name: loops_branches::main
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 37, 01, 05, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 55, 1) to (start + 5, 2)
+
diff --git a/tests/coverage-map/status-quo/loops_branches.rs b/tests/coverage-map/status-quo/loops_branches.rs
new file mode 100644
index 000000000..f3a343bcc
--- /dev/null
+++ b/tests/coverage-map/status-quo/loops_branches.rs
@@ -0,0 +1,60 @@
+#![allow(unused_assignments, unused_variables, while_true)]
+
+// This test confirms that (1) unexecuted infinite loops are handled correctly by the
+// InstrumentCoverage MIR pass; and (2) Counter Expressions that subtract from zero can be dropped.
+
+struct DebugTest;
+
+impl std::fmt::Debug for DebugTest {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+ if true {
+ if false {
+ while true {}
+ }
+ write!(f, "cool")?;
+ } else {
+ }
+
+ for i in 0..10 {
+ if true {
+ if false {
+ while true {}
+ }
+ write!(f, "cool")?;
+ } else {
+ }
+ }
+ Ok(())
+ }
+}
+
+struct DisplayTest;
+
+impl std::fmt::Display for DisplayTest {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+ if false {
+ } else {
+ if false {
+ while true {}
+ }
+ write!(f, "cool")?;
+ }
+ for i in 0..10 {
+ if false {
+ } else {
+ if false {
+ while true {}
+ }
+ write!(f, "cool")?;
+ }
+ }
+ Ok(())
+ }
+}
+
+fn main() {
+ let debug_test = DebugTest;
+ println!("{:?}", debug_test);
+ let display_test = DisplayTest;
+ println!("{}", display_test);
+}
diff --git a/tests/coverage-map/status-quo/match_or_pattern.cov-map b/tests/coverage-map/status-quo/match_or_pattern.cov-map
new file mode 100644
index 000000000..d63407a99
--- /dev/null
+++ b/tests/coverage-map/status-quo/match_or_pattern.cov-map
@@ -0,0 +1,83 @@
+Function name: match_or_pattern::main
+Raw bytes (202): 0x[01, 01, 23, 01, 05, 05, 02, 09, 0d, 2f, 11, 09, 0d, 2b, 15, 2f, 11, 09, 0d, 15, 26, 2b, 15, 2f, 11, 09, 0d, 19, 1d, 57, 21, 19, 1d, 53, 25, 57, 21, 19, 1d, 25, 4e, 53, 25, 57, 21, 19, 1d, 29, 2d, 7f, 31, 29, 2d, 7b, 35, 7f, 31, 29, 2d, 35, 76, 7b, 35, 7f, 31, 29, 2d, 39, 3d, 8b, 01, 41, 39, 3d, 19, 01, 01, 01, 08, 0f, 05, 08, 10, 03, 06, 02, 03, 06, 00, 07, 07, 01, 0b, 00, 11, 11, 03, 1b, 00, 1d, 2f, 01, 0e, 00, 10, 2b, 02, 08, 00, 0f, 15, 00, 10, 03, 06, 26, 03, 06, 00, 07, 23, 01, 0b, 00, 11, 21, 01, 1b, 00, 1d, 57, 01, 0e, 00, 10, 53, 02, 08, 00, 0f, 25, 00, 10, 03, 06, 4e, 03, 06, 00, 07, 4b, 01, 0b, 00, 11, 31, 01, 1b, 00, 1d, 7f, 01, 0e, 00, 10, 7b, 02, 08, 00, 0f, 35, 00, 10, 03, 06, 76, 03, 06, 00, 07, 73, 01, 0b, 00, 11, 41, 01, 1b, 00, 1d, 8b, 01, 01, 0e, 00, 10, 87, 01, 02, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 35
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 2 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 3 operands: lhs = Expression(11, Add), rhs = Counter(4)
+- expression 4 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 5 operands: lhs = Expression(10, Add), rhs = Counter(5)
+- expression 6 operands: lhs = Expression(11, Add), rhs = Counter(4)
+- expression 7 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 8 operands: lhs = Counter(5), rhs = Expression(9, Sub)
+- expression 9 operands: lhs = Expression(10, Add), rhs = Counter(5)
+- expression 10 operands: lhs = Expression(11, Add), rhs = Counter(4)
+- expression 11 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 12 operands: lhs = Counter(6), rhs = Counter(7)
+- expression 13 operands: lhs = Expression(21, Add), rhs = Counter(8)
+- expression 14 operands: lhs = Counter(6), rhs = Counter(7)
+- expression 15 operands: lhs = Expression(20, Add), rhs = Counter(9)
+- expression 16 operands: lhs = Expression(21, Add), rhs = Counter(8)
+- expression 17 operands: lhs = Counter(6), rhs = Counter(7)
+- expression 18 operands: lhs = Counter(9), rhs = Expression(19, Sub)
+- expression 19 operands: lhs = Expression(20, Add), rhs = Counter(9)
+- expression 20 operands: lhs = Expression(21, Add), rhs = Counter(8)
+- expression 21 operands: lhs = Counter(6), rhs = Counter(7)
+- expression 22 operands: lhs = Counter(10), rhs = Counter(11)
+- expression 23 operands: lhs = Expression(31, Add), rhs = Counter(12)
+- expression 24 operands: lhs = Counter(10), rhs = Counter(11)
+- expression 25 operands: lhs = Expression(30, Add), rhs = Counter(13)
+- expression 26 operands: lhs = Expression(31, Add), rhs = Counter(12)
+- expression 27 operands: lhs = Counter(10), rhs = Counter(11)
+- expression 28 operands: lhs = Counter(13), rhs = Expression(29, Sub)
+- expression 29 operands: lhs = Expression(30, Add), rhs = Counter(13)
+- expression 30 operands: lhs = Expression(31, Add), rhs = Counter(12)
+- expression 31 operands: lhs = Counter(10), rhs = Counter(11)
+- expression 32 operands: lhs = Counter(14), rhs = Counter(15)
+- expression 33 operands: lhs = Expression(34, Add), rhs = Counter(16)
+- expression 34 operands: lhs = Counter(14), rhs = Counter(15)
+Number of file 0 mappings: 25
+- Code(Counter(0)) at (prev + 1, 1) to (start + 8, 15)
+- Code(Counter(1)) at (prev + 8, 16) to (start + 3, 6)
+- Code(Expression(0, Sub)) at (prev + 3, 6) to (start + 0, 7)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 1, 11) to (start + 0, 17)
+ = (c1 + (c0 - c1))
+- Code(Counter(4)) at (prev + 3, 27) to (start + 0, 29)
+- Code(Expression(11, Add)) at (prev + 1, 14) to (start + 0, 16)
+ = (c2 + c3)
+- Code(Expression(10, Add)) at (prev + 2, 8) to (start + 0, 15)
+ = ((c2 + c3) + c4)
+- Code(Counter(5)) at (prev + 0, 16) to (start + 3, 6)
+- Code(Expression(9, Sub)) at (prev + 3, 6) to (start + 0, 7)
+ = (((c2 + c3) + c4) - c5)
+- Code(Expression(8, Add)) at (prev + 1, 11) to (start + 0, 17)
+ = (c5 + (((c2 + c3) + c4) - c5))
+- Code(Counter(8)) at (prev + 1, 27) to (start + 0, 29)
+- Code(Expression(21, Add)) at (prev + 1, 14) to (start + 0, 16)
+ = (c6 + c7)
+- Code(Expression(20, Add)) at (prev + 2, 8) to (start + 0, 15)
+ = ((c6 + c7) + c8)
+- Code(Counter(9)) at (prev + 0, 16) to (start + 3, 6)
+- Code(Expression(19, Sub)) at (prev + 3, 6) to (start + 0, 7)
+ = (((c6 + c7) + c8) - c9)
+- Code(Expression(18, Add)) at (prev + 1, 11) to (start + 0, 17)
+ = (c9 + (((c6 + c7) + c8) - c9))
+- Code(Counter(12)) at (prev + 1, 27) to (start + 0, 29)
+- Code(Expression(31, Add)) at (prev + 1, 14) to (start + 0, 16)
+ = (c10 + c11)
+- Code(Expression(30, Add)) at (prev + 2, 8) to (start + 0, 15)
+ = ((c10 + c11) + c12)
+- Code(Counter(13)) at (prev + 0, 16) to (start + 3, 6)
+- Code(Expression(29, Sub)) at (prev + 3, 6) to (start + 0, 7)
+ = (((c10 + c11) + c12) - c13)
+- Code(Expression(28, Add)) at (prev + 1, 11) to (start + 0, 17)
+ = (c13 + (((c10 + c11) + c12) - c13))
+- Code(Counter(16)) at (prev + 1, 27) to (start + 0, 29)
+- Code(Expression(34, Add)) at (prev + 1, 14) to (start + 0, 16)
+ = (c14 + c15)
+- Code(Expression(33, Add)) at (prev + 2, 1) to (start + 0, 2)
+ = ((c14 + c15) + c16)
+
diff --git a/tests/coverage-map/status-quo/match_or_pattern.rs b/tests/coverage-map/status-quo/match_or_pattern.rs
new file mode 100644
index 000000000..ab7aee51d
--- /dev/null
+++ b/tests/coverage-map/status-quo/match_or_pattern.rs
@@ -0,0 +1,43 @@
+fn main() {
+ // Initialize test constants in a way that cannot be determined at compile time, to ensure
+ // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
+ // dependent conditions.
+ let is_true = std::env::args().len() == 1;
+
+ let mut a: u8 = 0;
+ let mut b: u8 = 0;
+ if is_true {
+ a = 2;
+ b = 0;
+ }
+ match (a, b) {
+ // Or patterns generate MIR `SwitchInt` with multiple targets to the same `BasicBlock`.
+ // This test confirms a fix for Issue #79569.
+ (0 | 1, 2 | 3) => {}
+ _ => {}
+ }
+ if is_true {
+ a = 0;
+ b = 0;
+ }
+ match (a, b) {
+ (0 | 1, 2 | 3) => {}
+ _ => {}
+ }
+ if is_true {
+ a = 2;
+ b = 2;
+ }
+ match (a, b) {
+ (0 | 1, 2 | 3) => {}
+ _ => {}
+ }
+ if is_true {
+ a = 0;
+ b = 2;
+ }
+ match (a, b) {
+ (0 | 1, 2 | 3) => {}
+ _ => {}
+ }
+}
diff --git a/tests/coverage-map/status-quo/nested_loops.cov-map b/tests/coverage-map/status-quo/nested_loops.cov-map
new file mode 100644
index 000000000..35d92594e
--- /dev/null
+++ b/tests/coverage-map/status-quo/nested_loops.cov-map
@@ -0,0 +1,51 @@
+Function name: nested_loops::main
+Raw bytes (115): 0x[01, 01, 17, 01, 57, 05, 09, 03, 0d, 4e, 53, 03, 0d, 15, 19, 4b, 09, 4e, 53, 03, 0d, 15, 19, 46, 05, 4b, 09, 4e, 53, 03, 0d, 15, 19, 42, 19, 46, 05, 4b, 09, 4e, 53, 03, 0d, 15, 19, 05, 09, 11, 0d, 0d, 01, 01, 01, 02, 1b, 03, 04, 13, 00, 20, 4e, 01, 0d, 01, 18, 4b, 02, 12, 00, 17, 46, 01, 10, 00, 16, 05, 01, 11, 00, 16, 42, 01, 0e, 03, 16, 3e, 04, 11, 01, 1b, 11, 02, 15, 00, 21, 15, 01, 18, 02, 12, 19, 03, 0e, 00, 0f, 57, 02, 09, 00, 17, 5b, 02, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 23
+- expression 0 operands: lhs = Counter(0), rhs = Expression(21, Add)
+- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 3 operands: lhs = Expression(19, Sub), rhs = Expression(20, Add)
+- expression 4 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 5 operands: lhs = Counter(5), rhs = Counter(6)
+- expression 6 operands: lhs = Expression(18, Add), rhs = Counter(2)
+- expression 7 operands: lhs = Expression(19, Sub), rhs = Expression(20, Add)
+- expression 8 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 9 operands: lhs = Counter(5), rhs = Counter(6)
+- expression 10 operands: lhs = Expression(17, Sub), rhs = Counter(1)
+- expression 11 operands: lhs = Expression(18, Add), rhs = Counter(2)
+- expression 12 operands: lhs = Expression(19, Sub), rhs = Expression(20, Add)
+- expression 13 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 14 operands: lhs = Counter(5), rhs = Counter(6)
+- expression 15 operands: lhs = Expression(16, Sub), rhs = Counter(6)
+- expression 16 operands: lhs = Expression(17, Sub), rhs = Counter(1)
+- expression 17 operands: lhs = Expression(18, Add), rhs = Counter(2)
+- expression 18 operands: lhs = Expression(19, Sub), rhs = Expression(20, Add)
+- expression 19 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 20 operands: lhs = Counter(5), rhs = Counter(6)
+- expression 21 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 22 operands: lhs = Counter(4), rhs = Counter(3)
+Number of file 0 mappings: 13
+- Code(Counter(0)) at (prev + 1, 1) to (start + 2, 27)
+- Code(Expression(0, Add)) at (prev + 4, 19) to (start + 0, 32)
+ = (c0 + (c1 + c2))
+- Code(Expression(19, Sub)) at (prev + 1, 13) to (start + 1, 24)
+ = ((c0 + (c1 + c2)) - c3)
+- Code(Expression(18, Add)) at (prev + 2, 18) to (start + 0, 23)
+ = (((c0 + (c1 + c2)) - c3) + (c5 + c6))
+- Code(Expression(17, Sub)) at (prev + 1, 16) to (start + 0, 22)
+ = ((((c0 + (c1 + c2)) - c3) + (c5 + c6)) - c2)
+- Code(Counter(1)) at (prev + 1, 17) to (start + 0, 22)
+- Code(Expression(16, Sub)) at (prev + 1, 14) to (start + 3, 22)
+ = (((((c0 + (c1 + c2)) - c3) + (c5 + c6)) - c2) - c1)
+- Code(Expression(15, Sub)) at (prev + 4, 17) to (start + 1, 27)
+ = ((((((c0 + (c1 + c2)) - c3) + (c5 + c6)) - c2) - c1) - c6)
+- Code(Counter(4)) at (prev + 2, 21) to (start + 0, 33)
+- Code(Counter(5)) at (prev + 1, 24) to (start + 2, 18)
+- Code(Counter(6)) at (prev + 3, 14) to (start + 0, 15)
+- Code(Expression(21, Add)) at (prev + 2, 9) to (start + 0, 23)
+ = (c1 + c2)
+- Code(Expression(22, Add)) at (prev + 2, 1) to (start + 0, 2)
+ = (c4 + c3)
+
diff --git a/tests/coverage-map/status-quo/nested_loops.rs b/tests/coverage-map/status-quo/nested_loops.rs
new file mode 100644
index 000000000..4c7c78427
--- /dev/null
+++ b/tests/coverage-map/status-quo/nested_loops.rs
@@ -0,0 +1,25 @@
+fn main() {
+ let is_true = std::env::args().len() == 1;
+ let mut countdown = 10;
+
+ 'outer: while countdown > 0 {
+ let mut a = 100;
+ let mut b = 100;
+ for _ in 0..50 {
+ if a < 30 {
+ break;
+ }
+ a -= 5;
+ b -= 5;
+ if b < 90 {
+ a -= 10;
+ if is_true {
+ break 'outer;
+ } else {
+ a -= 2;
+ }
+ }
+ }
+ countdown -= 1;
+ }
+}
diff --git a/tests/coverage-map/status-quo/no_cov_crate.cov-map b/tests/coverage-map/status-quo/no_cov_crate.cov-map
new file mode 100644
index 000000000..7ab5995dc
--- /dev/null
+++ b/tests/coverage-map/status-quo/no_cov_crate.cov-map
@@ -0,0 +1,78 @@
+Function name: no_cov_crate::add_coverage_1
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 14, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 20, 1) to (start + 2, 2)
+
+Function name: no_cov_crate::add_coverage_2
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 18, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 24, 1) to (start + 2, 2)
+
+Function name: no_cov_crate::add_coverage_not_called (unused)
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 1d, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 29, 1) to (start + 2, 2)
+
+Function name: no_cov_crate::main
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 4d, 01, 0b, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 77, 1) to (start + 11, 2)
+
+Function name: no_cov_crate::nested_fns::outer
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 31, 05, 0c, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 49, 5) to (start + 12, 6)
+
+Function name: no_cov_crate::nested_fns::outer_both_covered
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 3f, 05, 0b, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 63, 5) to (start + 11, 6)
+
+Function name: no_cov_crate::nested_fns::outer_both_covered::inner
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 43, 09, 01, 17, 05, 01, 18, 02, 0e, 02, 02, 14, 02, 0e, 07, 03, 09, 00, 0a]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 67, 9) to (start + 1, 23)
+- Code(Counter(1)) at (prev + 1, 24) to (start + 2, 14)
+- Code(Expression(0, Sub)) at (prev + 2, 20) to (start + 2, 14)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 3, 9) to (start + 0, 10)
+ = (c1 + (c0 - c1))
+
+Function name: no_cov_crate::nested_fns::outer_not_covered::inner
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 26, 09, 01, 17, 05, 01, 18, 02, 0e, 02, 02, 14, 02, 0e, 07, 03, 09, 00, 0a]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 38, 9) to (start + 1, 23)
+- Code(Counter(1)) at (prev + 1, 24) to (start + 2, 14)
+- Code(Expression(0, Sub)) at (prev + 2, 20) to (start + 2, 14)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 3, 9) to (start + 0, 10)
+ = (c1 + (c0 - c1))
+
diff --git a/tests/coverage-map/status-quo/no_cov_crate.rs b/tests/coverage-map/status-quo/no_cov_crate.rs
new file mode 100644
index 000000000..e12e4bc55
--- /dev/null
+++ b/tests/coverage-map/status-quo/no_cov_crate.rs
@@ -0,0 +1,88 @@
+// Enables `coverage(off)` on the entire crate
+#![feature(coverage_attribute)]
+
+#[coverage(off)]
+fn do_not_add_coverage_1() {
+ println!("called but not covered");
+}
+
+fn do_not_add_coverage_2() {
+ #![coverage(off)]
+ println!("called but not covered");
+}
+
+#[coverage(off)]
+#[allow(dead_code)]
+fn do_not_add_coverage_not_called() {
+ println!("not called and not covered");
+}
+
+fn add_coverage_1() {
+ println!("called and covered");
+}
+
+fn add_coverage_2() {
+ println!("called and covered");
+}
+
+#[allow(dead_code)]
+fn add_coverage_not_called() {
+ println!("not called but covered");
+}
+
+// FIXME: These test-cases illustrate confusing results of nested functions.
+// See https://github.com/rust-lang/rust/issues/93319
+mod nested_fns {
+ #[coverage(off)]
+ pub fn outer_not_covered(is_true: bool) {
+ fn inner(is_true: bool) {
+ if is_true {
+ println!("called and covered");
+ } else {
+ println!("absolutely not covered");
+ }
+ }
+ println!("called but not covered");
+ inner(is_true);
+ }
+
+ pub fn outer(is_true: bool) {
+ println!("called and covered");
+ inner_not_covered(is_true);
+
+ #[coverage(off)]
+ fn inner_not_covered(is_true: bool) {
+ if is_true {
+ println!("called but not covered");
+ } else {
+ println!("absolutely not covered");
+ }
+ }
+ }
+
+ pub fn outer_both_covered(is_true: bool) {
+ println!("called and covered");
+ inner(is_true);
+
+ fn inner(is_true: bool) {
+ if is_true {
+ println!("called and covered");
+ } else {
+ println!("absolutely not covered");
+ }
+ }
+ }
+}
+
+fn main() {
+ let is_true = std::env::args().len() == 1;
+
+ do_not_add_coverage_1();
+ do_not_add_coverage_2();
+ add_coverage_1();
+ add_coverage_2();
+
+ nested_fns::outer_not_covered(is_true);
+ nested_fns::outer(is_true);
+ nested_fns::outer_both_covered(is_true);
+}
diff --git a/tests/coverage-map/status-quo/overflow.cov-map b/tests/coverage-map/status-quo/overflow.cov-map
new file mode 100644
index 000000000..bfffd9b2a
--- /dev/null
+++ b/tests/coverage-map/status-quo/overflow.cov-map
@@ -0,0 +1,43 @@
+Function name: overflow::main
+Raw bytes (65): 0x[01, 01, 08, 01, 1b, 05, 1f, 09, 0d, 03, 11, 16, 05, 03, 11, 05, 1f, 09, 0d, 09, 01, 0f, 01, 01, 1b, 03, 02, 0b, 00, 18, 16, 01, 0c, 00, 1a, 05, 00, 1b, 03, 0a, 12, 03, 13, 00, 20, 09, 00, 21, 03, 0a, 0d, 03, 0a, 00, 0b, 1b, 01, 09, 00, 17, 11, 02, 05, 01, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 8
+- expression 0 operands: lhs = Counter(0), rhs = Expression(6, Add)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(7, Add)
+- expression 2 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 3 operands: lhs = Expression(0, Add), rhs = Counter(4)
+- expression 4 operands: lhs = Expression(5, Sub), rhs = Counter(1)
+- expression 5 operands: lhs = Expression(0, Add), rhs = Counter(4)
+- expression 6 operands: lhs = Counter(1), rhs = Expression(7, Add)
+- expression 7 operands: lhs = Counter(2), rhs = Counter(3)
+Number of file 0 mappings: 9
+- Code(Counter(0)) at (prev + 15, 1) to (start + 1, 27)
+- Code(Expression(0, Add)) at (prev + 2, 11) to (start + 0, 24)
+ = (c0 + (c1 + (c2 + c3)))
+- Code(Expression(5, Sub)) at (prev + 1, 12) to (start + 0, 26)
+ = ((c0 + (c1 + (c2 + c3))) - c4)
+- Code(Counter(1)) at (prev + 0, 27) to (start + 3, 10)
+- Code(Expression(4, Sub)) at (prev + 3, 19) to (start + 0, 32)
+ = (((c0 + (c1 + (c2 + c3))) - c4) - c1)
+- Code(Counter(2)) at (prev + 0, 33) to (start + 3, 10)
+- Code(Counter(3)) at (prev + 3, 10) to (start + 0, 11)
+- Code(Expression(6, Add)) at (prev + 1, 9) to (start + 0, 23)
+ = (c1 + (c2 + c3))
+- Code(Counter(4)) at (prev + 2, 5) to (start + 1, 2)
+
+Function name: overflow::might_overflow
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 04, 01, 01, 12, 05, 01, 13, 02, 06, 02, 02, 06, 00, 07, 07, 01, 09, 05, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 4, 1) to (start + 1, 18)
+- Code(Counter(1)) at (prev + 1, 19) to (start + 2, 6)
+- Code(Expression(0, Sub)) at (prev + 2, 6) to (start + 0, 7)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 1, 9) to (start + 5, 2)
+ = (c1 + (c0 - c1))
+
diff --git a/tests/coverage-map/status-quo/overflow.rs b/tests/coverage-map/status-quo/overflow.rs
new file mode 100644
index 000000000..bbb65c1b3
--- /dev/null
+++ b/tests/coverage-map/status-quo/overflow.rs
@@ -0,0 +1,63 @@
+#![allow(unused_assignments)]
+// failure-status: 101
+
+fn might_overflow(to_add: u32) -> u32 {
+ if to_add > 5 {
+ println!("this will probably overflow");
+ }
+ let add_to = u32::MAX - 5;
+ println!("does {} + {} overflow?", add_to, to_add);
+ let result = to_add + add_to;
+ println!("continuing after overflow check");
+ result
+}
+
+fn main() -> Result<(), u8> {
+ let mut countdown = 10;
+ while countdown > 0 {
+ if countdown == 1 {
+ let result = might_overflow(10);
+ println!("Result: {}", result);
+ } else if countdown < 5 {
+ let result = might_overflow(1);
+ println!("Result: {}", result);
+ }
+ countdown -= 1;
+ }
+ Ok(())
+}
+
+// Notes:
+// 1. Compare this program and its coverage results to those of the very similar test `assert.rs`,
+// and similar tests `panic_unwind.rs`, abort.rs` and `try_error_result.rs`.
+// 2. This test confirms the coverage generated when a program passes or fails a
+// compiler-generated `TerminatorKind::Assert` (based on an overflow check, in this case).
+// 3. Similar to how the coverage instrumentation handles `TerminatorKind::Call`,
+// compiler-generated assertion failures are assumed to be a symptom of a program bug, not
+// expected behavior. To simplify the coverage graphs and keep instrumented programs as
+// small and fast as possible, `Assert` terminators are assumed to always succeed, and
+// therefore are considered "non-branching" terminators. So, an `Assert` terminator does not
+// get its own coverage counter.
+// 4. After an unhandled panic or failed Assert, coverage results may not always be intuitive.
+// In this test, the final count for the statements after the `if` block in `might_overflow()`
+// is 4, even though the lines after `to_add + add_to` were executed only 3 times. Depending
+// on the MIR graph and the structure of the code, this count could have been 3 (which might
+// have been valid for the overflowed add `+`, but should have been 4 for the lines before
+// the overflow. The reason for this potential uncertainty is, a `CounterKind` is incremented
+// via StatementKind::Counter at the end of the block, but (as in the case in this test),
+// a CounterKind::Expression is always evaluated. In this case, the expression was based on
+// a `Counter` incremented as part of the evaluation of the `if` expression, which was
+// executed, and counted, 4 times, before reaching the overflow add.
+
+// If the program did not overflow, the coverage for `might_overflow()` would look like this:
+//
+// 4| |fn might_overflow(to_add: u32) -> u32 {
+// 5| 4| if to_add > 5 {
+// 6| 0| println!("this will probably overflow");
+// 7| 4| }
+// 8| 4| let add_to = u32::MAX - 5;
+// 9| 4| println!("does {} + {} overflow?", add_to, to_add);
+// 10| 4| let result = to_add + add_to;
+// 11| 4| println!("continuing after overflow check");
+// 12| 4| result
+// 13| 4|}
diff --git a/tests/coverage-map/status-quo/panic_unwind.cov-map b/tests/coverage-map/status-quo/panic_unwind.cov-map
new file mode 100644
index 000000000..f6089ce55
--- /dev/null
+++ b/tests/coverage-map/status-quo/panic_unwind.cov-map
@@ -0,0 +1,40 @@
+Function name: panic_unwind::main
+Raw bytes (65): 0x[01, 01, 08, 01, 1b, 05, 1f, 09, 0d, 03, 11, 16, 05, 03, 11, 05, 1f, 09, 0d, 09, 01, 0d, 01, 01, 1b, 03, 02, 0b, 00, 18, 16, 01, 0c, 00, 1a, 05, 00, 1b, 02, 0a, 12, 02, 13, 00, 20, 09, 00, 21, 02, 0a, 0d, 02, 0a, 00, 0b, 1b, 01, 09, 00, 17, 11, 02, 05, 01, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 8
+- expression 0 operands: lhs = Counter(0), rhs = Expression(6, Add)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(7, Add)
+- expression 2 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 3 operands: lhs = Expression(0, Add), rhs = Counter(4)
+- expression 4 operands: lhs = Expression(5, Sub), rhs = Counter(1)
+- expression 5 operands: lhs = Expression(0, Add), rhs = Counter(4)
+- expression 6 operands: lhs = Counter(1), rhs = Expression(7, Add)
+- expression 7 operands: lhs = Counter(2), rhs = Counter(3)
+Number of file 0 mappings: 9
+- Code(Counter(0)) at (prev + 13, 1) to (start + 1, 27)
+- Code(Expression(0, Add)) at (prev + 2, 11) to (start + 0, 24)
+ = (c0 + (c1 + (c2 + c3)))
+- Code(Expression(5, Sub)) at (prev + 1, 12) to (start + 0, 26)
+ = ((c0 + (c1 + (c2 + c3))) - c4)
+- Code(Counter(1)) at (prev + 0, 27) to (start + 2, 10)
+- Code(Expression(4, Sub)) at (prev + 2, 19) to (start + 0, 32)
+ = (((c0 + (c1 + (c2 + c3))) - c4) - c1)
+- Code(Counter(2)) at (prev + 0, 33) to (start + 2, 10)
+- Code(Counter(3)) at (prev + 2, 10) to (start + 0, 11)
+- Code(Expression(6, Add)) at (prev + 1, 9) to (start + 0, 23)
+ = (c1 + (c2 + c3))
+- Code(Counter(4)) at (prev + 2, 5) to (start + 1, 2)
+
+Function name: panic_unwind::might_panic
+Raw bytes (21): 0x[01, 01, 01, 01, 05, 03, 01, 04, 01, 01, 14, 05, 02, 09, 01, 19, 02, 02, 0c, 03, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 1
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+Number of file 0 mappings: 3
+- Code(Counter(0)) at (prev + 4, 1) to (start + 1, 20)
+- Code(Counter(1)) at (prev + 2, 9) to (start + 1, 25)
+- Code(Expression(0, Sub)) at (prev + 2, 12) to (start + 3, 2)
+ = (c0 - c1)
+
diff --git a/tests/coverage-map/status-quo/panic_unwind.rs b/tests/coverage-map/status-quo/panic_unwind.rs
new file mode 100644
index 000000000..638d2eb6a
--- /dev/null
+++ b/tests/coverage-map/status-quo/panic_unwind.rs
@@ -0,0 +1,31 @@
+#![allow(unused_assignments)]
+// failure-status: 101
+
+fn might_panic(should_panic: bool) {
+ if should_panic {
+ println!("panicking...");
+ panic!("panics");
+ } else {
+ println!("Don't Panic");
+ }
+}
+
+fn main() -> Result<(), u8> {
+ let mut countdown = 10;
+ while countdown > 0 {
+ if countdown == 1 {
+ might_panic(true);
+ } else if countdown < 5 {
+ might_panic(false);
+ }
+ countdown -= 1;
+ }
+ Ok(())
+}
+
+// Notes:
+// 1. Compare this program and its coverage results to those of the similar tests `abort.rs` and
+// `try_error_result.rs`.
+// 2. Since the `panic_unwind.rs` test is allowed to unwind, it is also allowed to execute the
+// normal program exit cleanup, including writing out the current values of the coverage
+// counters.
diff --git a/tests/coverage-map/status-quo/partial_eq.cov-map b/tests/coverage-map/status-quo/partial_eq.cov-map
new file mode 100644
index 000000000..dd61cd77a
--- /dev/null
+++ b/tests/coverage-map/status-quo/partial_eq.cov-map
@@ -0,0 +1,64 @@
+Function name: <partial_eq::Version as core::clone::Clone>::clone (unused)
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 04, 0a, 00, 0f]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 4, 10) to (start + 0, 15)
+
+Function name: <partial_eq::Version as core::cmp::Ord>::cmp (unused)
+Raw bytes (14): 0x[01, 01, 00, 02, 01, 04, 33, 00, 34, 00, 00, 35, 00, 36]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 2
+- Code(Counter(0)) at (prev + 4, 51) to (start + 0, 52)
+- Code(Zero) at (prev + 0, 53) to (start + 0, 54)
+
+Function name: <partial_eq::Version as core::cmp::PartialEq>::eq (unused)
+Raw bytes (14): 0x[01, 01, 00, 02, 01, 04, 18, 00, 19, 00, 00, 20, 00, 21]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 2
+- Code(Counter(0)) at (prev + 4, 24) to (start + 0, 25)
+- Code(Zero) at (prev + 0, 32) to (start + 0, 33)
+
+Function name: <partial_eq::Version as core::cmp::PartialOrd>::partial_cmp
+Raw bytes (22): 0x[01, 01, 04, 07, 0b, 05, 09, 0f, 15, 0d, 11, 02, 01, 04, 27, 00, 28, 03, 00, 30, 00, 31]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 4
+- expression 0 operands: lhs = Expression(1, Add), rhs = Expression(2, Add)
+- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(5)
+- expression 3 operands: lhs = Counter(3), rhs = Counter(4)
+Number of file 0 mappings: 2
+- Code(Counter(0)) at (prev + 4, 39) to (start + 0, 40)
+- Code(Expression(0, Add)) at (prev + 0, 48) to (start + 0, 49)
+ = ((c1 + c2) + ((c3 + c4) + c5))
+
+Function name: <partial_eq::Version as core::fmt::Debug>::fmt
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 04, 11, 00, 16]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 4, 17) to (start + 0, 22)
+
+Function name: <partial_eq::Version>::new
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 0c, 05, 06, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 12, 5) to (start + 6, 6)
+
+Function name: partial_eq::main
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 15, 01, 05, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 21, 1) to (start + 5, 2)
+
diff --git a/tests/coverage-map/status-quo/partial_eq.rs b/tests/coverage-map/status-quo/partial_eq.rs
new file mode 100644
index 000000000..dd8b42c18
--- /dev/null
+++ b/tests/coverage-map/status-quo/partial_eq.rs
@@ -0,0 +1,46 @@
+// This test confirms an earlier problem was resolved, supporting the MIR graph generated by the
+// structure of this test.
+
+#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
+pub struct Version {
+ major: usize,
+ minor: usize,
+ patch: usize,
+}
+
+impl Version {
+ pub fn new(major: usize, minor: usize, patch: usize) -> Self {
+ Self {
+ major,
+ minor,
+ patch,
+ }
+ }
+}
+
+fn main() {
+ let version_3_2_1 = Version::new(3, 2, 1);
+ let version_3_3_0 = Version::new(3, 3, 0);
+
+ println!("{:?} < {:?} = {}", version_3_2_1, version_3_3_0, version_3_2_1 < version_3_3_0);
+}
+
+/*
+
+This test verifies a bug was fixed that otherwise generated this error:
+
+thread 'rustc' panicked at 'No counters provided the source_hash for function:
+ Instance {
+ def: Item(WithOptConstParam {
+ did: DefId(0:101 ~ autocfg[c44a]::version::{impl#2}::partial_cmp),
+ const_param_did: None
+ }),
+ args: []
+ }'
+The `PartialOrd` derived by `Version` happened to generate a MIR that generated coverage
+without a code region associated with any `Counter`. Code regions were associated with at least
+one expression, which is allowed, but the `function_source_hash` was only passed to the codegen
+(coverage mapgen) phase from a `Counter`s code region. A new method was added to pass the
+`function_source_hash` without a code region, if necessary.
+
+*/
diff --git a/tests/coverage-map/status-quo/simple_loop.cov-map b/tests/coverage-map/status-quo/simple_loop.cov-map
new file mode 100644
index 000000000..eb49c2324
--- /dev/null
+++ b/tests/coverage-map/status-quo/simple_loop.cov-map
@@ -0,0 +1,28 @@
+Function name: simple_loop::main
+Raw bytes (59): 0x[01, 01, 0a, 01, 05, 27, 09, 05, 02, 23, 09, 27, 09, 05, 02, 1e, 00, 23, 09, 27, 09, 05, 02, 07, 01, 03, 01, 09, 10, 05, 0a, 05, 05, 06, 02, 05, 06, 00, 07, 23, 05, 0d, 02, 0e, 1e, 04, 0d, 00, 12, 09, 02, 0a, 03, 0a, 1b, 06, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 10
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Expression(9, Add), rhs = Counter(2)
+- expression 2 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 3 operands: lhs = Expression(8, Add), rhs = Counter(2)
+- expression 4 operands: lhs = Expression(9, Add), rhs = Counter(2)
+- expression 5 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 6 operands: lhs = Expression(7, Sub), rhs = Zero
+- expression 7 operands: lhs = Expression(8, Add), rhs = Counter(2)
+- expression 8 operands: lhs = Expression(9, Add), rhs = Counter(2)
+- expression 9 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 7
+- Code(Counter(0)) at (prev + 3, 1) to (start + 9, 16)
+- Code(Counter(1)) at (prev + 10, 5) to (start + 5, 6)
+- Code(Expression(0, Sub)) at (prev + 5, 6) to (start + 0, 7)
+ = (c0 - c1)
+- Code(Expression(8, Add)) at (prev + 5, 13) to (start + 2, 14)
+ = ((c1 + (c0 - c1)) + c2)
+- Code(Expression(7, Sub)) at (prev + 4, 13) to (start + 0, 18)
+ = (((c1 + (c0 - c1)) + c2) - c2)
+- Code(Counter(2)) at (prev + 2, 10) to (start + 3, 10)
+- Code(Expression(6, Add)) at (prev + 6, 1) to (start + 0, 2)
+ = ((((c1 + (c0 - c1)) + c2) - c2) + Zero)
+
diff --git a/tests/coverage-map/status-quo/simple_loop.rs b/tests/coverage-map/status-quo/simple_loop.rs
new file mode 100644
index 000000000..6f7f23475
--- /dev/null
+++ b/tests/coverage-map/status-quo/simple_loop.rs
@@ -0,0 +1,35 @@
+#![allow(unused_assignments)]
+
+fn main() {
+ // Initialize test constants in a way that cannot be determined at compile time, to ensure
+ // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
+ // dependent conditions.
+ let is_true = std::env::args().len() == 1;
+
+ let mut countdown = 0;
+
+ if
+ is_true
+ {
+ countdown
+ =
+ 10
+ ;
+ }
+
+ loop
+ {
+ if
+ countdown
+ ==
+ 0
+ {
+ break
+ ;
+ }
+ countdown
+ -=
+ 1
+ ;
+ }
+}
diff --git a/tests/coverage-map/status-quo/simple_match.cov-map b/tests/coverage-map/status-quo/simple_match.cov-map
new file mode 100644
index 000000000..d5389f04b
--- /dev/null
+++ b/tests/coverage-map/status-quo/simple_match.cov-map
@@ -0,0 +1,36 @@
+Function name: simple_match::main
+Raw bytes (82): 0x[01, 01, 0e, 01, 05, 2f, 33, 05, 02, 09, 0d, 2b, 11, 2f, 33, 05, 02, 09, 0d, 26, 00, 2b, 11, 2f, 33, 05, 02, 09, 0d, 09, 00, 0a, 01, 03, 01, 07, 0f, 05, 07, 10, 02, 06, 02, 02, 06, 00, 07, 2b, 05, 09, 00, 0d, 26, 05, 0d, 00, 16, 09, 02, 0d, 00, 0e, 23, 02, 11, 02, 12, 37, 04, 0d, 07, 0e, 0d, 0a, 0d, 00, 0f, 11, 03, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 14
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Expression(11, Add), rhs = Expression(12, Add)
+- expression 2 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 3 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 4 operands: lhs = Expression(10, Add), rhs = Counter(4)
+- expression 5 operands: lhs = Expression(11, Add), rhs = Expression(12, Add)
+- expression 6 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 7 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 8 operands: lhs = Expression(9, Sub), rhs = Zero
+- expression 9 operands: lhs = Expression(10, Add), rhs = Counter(4)
+- expression 10 operands: lhs = Expression(11, Add), rhs = Expression(12, Add)
+- expression 11 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 12 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 13 operands: lhs = Counter(2), rhs = Zero
+Number of file 0 mappings: 10
+- Code(Counter(0)) at (prev + 3, 1) to (start + 7, 15)
+- Code(Counter(1)) at (prev + 7, 16) to (start + 2, 6)
+- Code(Expression(0, Sub)) at (prev + 2, 6) to (start + 0, 7)
+ = (c0 - c1)
+- Code(Expression(10, Add)) at (prev + 5, 9) to (start + 0, 13)
+ = ((c1 + (c0 - c1)) + (c2 + c3))
+- Code(Expression(9, Sub)) at (prev + 5, 13) to (start + 0, 22)
+ = (((c1 + (c0 - c1)) + (c2 + c3)) - c4)
+- Code(Counter(2)) at (prev + 2, 13) to (start + 0, 14)
+- Code(Expression(8, Add)) at (prev + 2, 17) to (start + 2, 18)
+ = ((((c1 + (c0 - c1)) + (c2 + c3)) - c4) + Zero)
+- Code(Expression(13, Add)) at (prev + 4, 13) to (start + 7, 14)
+ = (c2 + Zero)
+- Code(Counter(3)) at (prev + 10, 13) to (start + 0, 15)
+- Code(Counter(4)) at (prev + 3, 1) to (start + 0, 2)
+
diff --git a/tests/coverage-map/status-quo/simple_match.rs b/tests/coverage-map/status-quo/simple_match.rs
new file mode 100644
index 000000000..be99e59a8
--- /dev/null
+++ b/tests/coverage-map/status-quo/simple_match.rs
@@ -0,0 +1,43 @@
+#![allow(unused_assignments, unused_variables)]
+
+fn main() {
+ // Initialize test constants in a way that cannot be determined at compile time, to ensure
+ // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
+ // dependent conditions.
+ let is_true = std::env::args().len() == 1;
+
+ let mut countdown = 1;
+ if is_true {
+ countdown = 0;
+ }
+
+ for
+ _
+ in
+ 0..2
+ {
+ let z
+ ;
+ match
+ countdown
+ {
+ x
+ if
+ x
+ <
+ 1
+ =>
+ {
+ z = countdown
+ ;
+ let y = countdown
+ ;
+ countdown = 10
+ ;
+ }
+ _
+ =>
+ {}
+ }
+ }
+}
diff --git a/tests/coverage-map/status-quo/sort_groups.cov-map b/tests/coverage-map/status-quo/sort_groups.cov-map
new file mode 100644
index 000000000..7156a66cf
--- /dev/null
+++ b/tests/coverage-map/status-quo/sort_groups.cov-map
@@ -0,0 +1,68 @@
+Function name: sort_groups::generic_fn::<&str>
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 11, 01, 01, 0c, 05, 01, 0d, 02, 06, 02, 02, 06, 00, 07, 07, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 17, 1) to (start + 1, 12)
+- Code(Counter(1)) at (prev + 1, 13) to (start + 2, 6)
+- Code(Expression(0, Sub)) at (prev + 2, 6) to (start + 0, 7)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2)
+ = (c1 + (c0 - c1))
+
+Function name: sort_groups::generic_fn::<()>
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 11, 01, 01, 0c, 05, 01, 0d, 02, 06, 02, 02, 06, 00, 07, 07, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 17, 1) to (start + 1, 12)
+- Code(Counter(1)) at (prev + 1, 13) to (start + 2, 6)
+- Code(Expression(0, Sub)) at (prev + 2, 6) to (start + 0, 7)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2)
+ = (c1 + (c0 - c1))
+
+Function name: sort_groups::generic_fn::<i32>
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 11, 01, 01, 0c, 05, 01, 0d, 02, 06, 02, 02, 06, 00, 07, 07, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 17, 1) to (start + 1, 12)
+- Code(Counter(1)) at (prev + 1, 13) to (start + 2, 6)
+- Code(Expression(0, Sub)) at (prev + 2, 6) to (start + 0, 7)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2)
+ = (c1 + (c0 - c1))
+
+Function name: sort_groups::main
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 06, 01, 04, 0d, 00, 04, 0e, 02, 06, 02, 02, 06, 00, 07, 07, 01, 05, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 6, 1) to (start + 4, 13)
+- Code(Zero) at (prev + 4, 14) to (start + 2, 6)
+- Code(Expression(0, Sub)) at (prev + 2, 6) to (start + 0, 7)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 1, 5) to (start + 2, 2)
+ = (c1 + (c0 - c1))
+
+Function name: sort_groups::other_fn
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 17, 01, 00, 11]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 23, 1) to (start + 0, 17)
+
diff --git a/tests/coverage-map/status-quo/sort_groups.rs b/tests/coverage-map/status-quo/sort_groups.rs
new file mode 100644
index 000000000..f89f9f3ec
--- /dev/null
+++ b/tests/coverage-map/status-quo/sort_groups.rs
@@ -0,0 +1,23 @@
+// compile-flags: --edition=2021
+
+// Demonstrate that `sort_subviews.py` can sort instantiation groups into a
+// predictable order, while preserving their heterogeneous contents.
+
+fn main() {
+ let cond = std::env::args().len() > 1;
+ generic_fn::<()>(cond);
+ generic_fn::<&'static str>(!cond);
+ if false {
+ generic_fn::<char>(cond);
+ }
+ generic_fn::<i32>(cond);
+ other_fn();
+}
+
+fn generic_fn<T>(cond: bool) {
+ if cond {
+ println!("{}", std::any::type_name::<T>());
+ }
+}
+
+fn other_fn() {}
diff --git a/tests/coverage-map/status-quo/test_harness.cov-map b/tests/coverage-map/status-quo/test_harness.cov-map
new file mode 100644
index 000000000..b0e955dd1
--- /dev/null
+++ b/tests/coverage-map/status-quo/test_harness.cov-map
@@ -0,0 +1,24 @@
+Function name: test_harness::my_test
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 0a, 01, 00, 10]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 10, 1) to (start + 0, 16)
+
+Function name: test_harness::my_test::{closure#0}
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 09, 01, 00, 08]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 9, 1) to (start + 0, 8)
+
+Function name: test_harness::unused (unused)
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 07, 01, 00, 0f]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 7, 1) to (start + 0, 15)
+
diff --git a/tests/coverage-map/status-quo/test_harness.rs b/tests/coverage-map/status-quo/test_harness.rs
new file mode 100644
index 000000000..12a755734
--- /dev/null
+++ b/tests/coverage-map/status-quo/test_harness.rs
@@ -0,0 +1,10 @@
+// Verify that the entry point injected by the test harness doesn't cause
+// weird artifacts in the coverage report (e.g. issue #10749).
+
+// compile-flags: --test
+
+#[allow(dead_code)]
+fn unused() {}
+
+#[test]
+fn my_test() {}
diff --git a/tests/coverage-map/status-quo/tight_inf_loop.cov-map b/tests/coverage-map/status-quo/tight_inf_loop.cov-map
new file mode 100644
index 000000000..76884212c
--- /dev/null
+++ b/tests/coverage-map/status-quo/tight_inf_loop.cov-map
@@ -0,0 +1,12 @@
+Function name: tight_inf_loop::main
+Raw bytes (21): 0x[01, 01, 01, 01, 05, 03, 01, 01, 01, 01, 0d, 00, 02, 09, 00, 10, 02, 01, 06, 01, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 1
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+Number of file 0 mappings: 3
+- Code(Counter(0)) at (prev + 1, 1) to (start + 1, 13)
+- Code(Zero) at (prev + 2, 9) to (start + 0, 16)
+- Code(Expression(0, Sub)) at (prev + 1, 6) to (start + 1, 2)
+ = (c0 - c1)
+
diff --git a/tests/coverage-map/status-quo/tight_inf_loop.rs b/tests/coverage-map/status-quo/tight_inf_loop.rs
new file mode 100644
index 000000000..cef99027a
--- /dev/null
+++ b/tests/coverage-map/status-quo/tight_inf_loop.rs
@@ -0,0 +1,5 @@
+fn main() {
+ if false {
+ loop {}
+ }
+}
diff --git a/tests/coverage-map/status-quo/try_error_result.cov-map b/tests/coverage-map/status-quo/try_error_result.cov-map
new file mode 100644
index 000000000..b52e78d11
--- /dev/null
+++ b/tests/coverage-map/status-quo/try_error_result.cov-map
@@ -0,0 +1,226 @@
+Function name: <try_error_result::Thing1>::get_thing_2
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 28, 05, 01, 18, 05, 02, 0d, 00, 14, 02, 02, 0d, 00, 1a, 07, 02, 05, 00, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 40, 5) to (start + 1, 24)
+- Code(Counter(1)) at (prev + 2, 13) to (start + 0, 20)
+- Code(Expression(0, Sub)) at (prev + 2, 13) to (start + 0, 26)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 2, 5) to (start + 0, 6)
+ = (c1 + (c0 - c1))
+
+Function name: <try_error_result::Thing2>::call
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 33, 05, 01, 18, 05, 02, 0d, 00, 14, 02, 02, 0d, 00, 13, 07, 02, 05, 00, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 51, 5) to (start + 1, 24)
+- Code(Counter(1)) at (prev + 2, 13) to (start + 0, 20)
+- Code(Expression(0, Sub)) at (prev + 2, 13) to (start + 0, 19)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 2, 5) to (start + 0, 6)
+ = (c1 + (c0 - c1))
+
+Function name: try_error_result::call
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 04, 01, 01, 14, 05, 02, 09, 00, 10, 02, 02, 09, 00, 0f, 07, 02, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 4, 1) to (start + 1, 20)
+- Code(Counter(1)) at (prev + 2, 9) to (start + 0, 16)
+- Code(Expression(0, Sub)) at (prev + 2, 9) to (start + 0, 15)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 2, 1) to (start + 0, 2)
+ = (c1 + (c0 - c1))
+
+Function name: try_error_result::main
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 70, 01, 02, 0c, 05, 03, 05, 00, 06, 02, 02, 05, 00, 0b, 07, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 112, 1) to (start + 2, 12)
+- Code(Counter(1)) at (prev + 3, 5) to (start + 0, 6)
+- Code(Expression(0, Sub)) at (prev + 2, 5) to (start + 0, 11)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2)
+ = (c1 + (c0 - c1))
+
+Function name: try_error_result::test1
+Raw bytes (77): 0x[01, 01, 09, 01, 07, 05, 09, 03, 0d, 1d, 11, 16, 1d, 03, 0d, 1f, 0d, 11, 23, 15, 19, 0b, 01, 0c, 01, 02, 17, 03, 07, 09, 00, 0e, 16, 02, 09, 04, 1a, 1d, 06, 0d, 00, 29, 11, 00, 29, 00, 2a, 0e, 01, 0d, 00, 2a, 15, 00, 2a, 00, 2b, 12, 04, 0d, 00, 2a, 19, 00, 2a, 00, 2b, 0d, 03, 05, 00, 0b, 1b, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 9
+- expression 0 operands: lhs = Counter(0), rhs = Expression(1, Add)
+- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 3 operands: lhs = Counter(7), rhs = Counter(4)
+- expression 4 operands: lhs = Expression(5, Sub), rhs = Counter(7)
+- expression 5 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 6 operands: lhs = Expression(7, Add), rhs = Counter(3)
+- expression 7 operands: lhs = Counter(4), rhs = Expression(8, Add)
+- expression 8 operands: lhs = Counter(5), rhs = Counter(6)
+Number of file 0 mappings: 11
+- Code(Counter(0)) at (prev + 12, 1) to (start + 2, 23)
+- Code(Expression(0, Add)) at (prev + 7, 9) to (start + 0, 14)
+ = (c0 + (c1 + c2))
+- Code(Expression(5, Sub)) at (prev + 2, 9) to (start + 4, 26)
+ = ((c0 + (c1 + c2)) - c3)
+- Code(Counter(7)) at (prev + 6, 13) to (start + 0, 41)
+- Code(Counter(4)) at (prev + 0, 41) to (start + 0, 42)
+- Code(Expression(3, Sub)) at (prev + 1, 13) to (start + 0, 42)
+ = (c7 - c4)
+- Code(Counter(5)) at (prev + 0, 42) to (start + 0, 43)
+- Code(Expression(4, Sub)) at (prev + 4, 13) to (start + 0, 42)
+ = (((c0 + (c1 + c2)) - c3) - c7)
+- Code(Counter(6)) at (prev + 0, 42) to (start + 0, 43)
+- Code(Counter(3)) at (prev + 3, 5) to (start + 0, 11)
+- Code(Expression(6, Add)) at (prev + 1, 1) to (start + 0, 2)
+ = ((c4 + (c5 + c6)) + c3)
+
+Function name: try_error_result::test2
+Raw bytes (373): 0x[01, 01, 41, 01, 07, 05, 09, 03, 0d, 41, 11, 52, 15, 41, 11, 4a, 1d, 4e, 19, 52, 15, 41, 11, 4e, 00, 52, 15, 41, 11, 4e, 19, 52, 15, 41, 11, 46, 00, 4a, 1d, 4e, 19, 52, 15, 41, 11, 6a, 25, 49, 21, 49, 21, 66, 00, 6a, 25, 49, 21, 9a, 01, 2d, 9e, 01, 29, a2, 01, 41, 03, 0d, a2, 01, 41, 03, 0d, 9e, 01, 29, a2, 01, 41, 03, 0d, 96, 01, 00, 9a, 01, 2d, 9e, 01, 29, a2, 01, 41, 03, 0d, ba, 01, 35, 45, 31, 45, 31, b6, 01, 00, ba, 01, 35, 45, 31, d2, 01, 3d, 4d, 39, 4d, 39, ce, 01, 00, d2, 01, 3d, 4d, 39, db, 01, 0d, 11, df, 01, e3, 01, f3, 01, 15, e7, 01, eb, 01, ef, 01, 19, 1d, 21, 25, f7, 01, fb, 01, 29, 2d, ff, 01, 83, 02, 31, 35, 39, 3d, 28, 01, 3c, 01, 03, 17, 03, 08, 09, 00, 0e, a2, 01, 02, 09, 04, 1a, 41, 06, 0d, 00, 2f, 11, 00, 2f, 00, 30, 52, 00, 31, 03, 35, 15, 04, 11, 00, 12, 4e, 02, 11, 04, 12, 46, 05, 11, 00, 14, 2b, 00, 17, 00, 41, 19, 00, 41, 00, 42, 4a, 00, 43, 00, 5f, 1d, 00, 5f, 00, 60, 43, 01, 0d, 00, 20, 66, 01, 11, 00, 14, 49, 00, 17, 00, 41, 21, 00, 41, 00, 42, 6a, 00, 43, 00, 60, 25, 00, 60, 00, 61, 63, 01, 0d, 00, 20, 96, 01, 04, 11, 00, 14, 9e, 01, 00, 17, 00, 42, 29, 00, 42, 00, 43, 9a, 01, 00, 44, 00, 61, 2d, 00, 61, 00, 62, 93, 01, 01, 0d, 00, 20, b6, 01, 01, 11, 00, 14, 45, 00, 17, 01, 36, 31, 01, 36, 00, 37, ba, 01, 01, 12, 00, 2f, 35, 00, 2f, 00, 30, b3, 01, 01, 0d, 00, 20, ce, 01, 01, 11, 00, 14, 4d, 00, 17, 01, 36, 39, 02, 11, 00, 12, d2, 01, 01, 12, 00, 2f, 3d, 01, 11, 00, 12, cb, 01, 02, 0d, 00, 20, 0d, 03, 05, 00, 0b, d7, 01, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 65
+- expression 0 operands: lhs = Counter(0), rhs = Expression(1, Add)
+- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 3 operands: lhs = Counter(16), rhs = Counter(4)
+- expression 4 operands: lhs = Expression(20, Sub), rhs = Counter(5)
+- expression 5 operands: lhs = Counter(16), rhs = Counter(4)
+- expression 6 operands: lhs = Expression(18, Sub), rhs = Counter(7)
+- expression 7 operands: lhs = Expression(19, Sub), rhs = Counter(6)
+- expression 8 operands: lhs = Expression(20, Sub), rhs = Counter(5)
+- expression 9 operands: lhs = Counter(16), rhs = Counter(4)
+- expression 10 operands: lhs = Expression(19, Sub), rhs = Zero
+- expression 11 operands: lhs = Expression(20, Sub), rhs = Counter(5)
+- expression 12 operands: lhs = Counter(16), rhs = Counter(4)
+- expression 13 operands: lhs = Expression(19, Sub), rhs = Counter(6)
+- expression 14 operands: lhs = Expression(20, Sub), rhs = Counter(5)
+- expression 15 operands: lhs = Counter(16), rhs = Counter(4)
+- expression 16 operands: lhs = Expression(17, Sub), rhs = Zero
+- expression 17 operands: lhs = Expression(18, Sub), rhs = Counter(7)
+- expression 18 operands: lhs = Expression(19, Sub), rhs = Counter(6)
+- expression 19 operands: lhs = Expression(20, Sub), rhs = Counter(5)
+- expression 20 operands: lhs = Counter(16), rhs = Counter(4)
+- expression 21 operands: lhs = Expression(26, Sub), rhs = Counter(9)
+- expression 22 operands: lhs = Counter(18), rhs = Counter(8)
+- expression 23 operands: lhs = Counter(18), rhs = Counter(8)
+- expression 24 operands: lhs = Expression(25, Sub), rhs = Zero
+- expression 25 operands: lhs = Expression(26, Sub), rhs = Counter(9)
+- expression 26 operands: lhs = Counter(18), rhs = Counter(8)
+- expression 27 operands: lhs = Expression(38, Sub), rhs = Counter(11)
+- expression 28 operands: lhs = Expression(39, Sub), rhs = Counter(10)
+- expression 29 operands: lhs = Expression(40, Sub), rhs = Counter(16)
+- expression 30 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 31 operands: lhs = Expression(40, Sub), rhs = Counter(16)
+- expression 32 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 33 operands: lhs = Expression(39, Sub), rhs = Counter(10)
+- expression 34 operands: lhs = Expression(40, Sub), rhs = Counter(16)
+- expression 35 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 36 operands: lhs = Expression(37, Sub), rhs = Zero
+- expression 37 operands: lhs = Expression(38, Sub), rhs = Counter(11)
+- expression 38 operands: lhs = Expression(39, Sub), rhs = Counter(10)
+- expression 39 operands: lhs = Expression(40, Sub), rhs = Counter(16)
+- expression 40 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 41 operands: lhs = Expression(46, Sub), rhs = Counter(13)
+- expression 42 operands: lhs = Counter(17), rhs = Counter(12)
+- expression 43 operands: lhs = Counter(17), rhs = Counter(12)
+- expression 44 operands: lhs = Expression(45, Sub), rhs = Zero
+- expression 45 operands: lhs = Expression(46, Sub), rhs = Counter(13)
+- expression 46 operands: lhs = Counter(17), rhs = Counter(12)
+- expression 47 operands: lhs = Expression(52, Sub), rhs = Counter(15)
+- expression 48 operands: lhs = Counter(19), rhs = Counter(14)
+- expression 49 operands: lhs = Counter(19), rhs = Counter(14)
+- expression 50 operands: lhs = Expression(51, Sub), rhs = Zero
+- expression 51 operands: lhs = Expression(52, Sub), rhs = Counter(15)
+- expression 52 operands: lhs = Counter(19), rhs = Counter(14)
+- expression 53 operands: lhs = Expression(54, Add), rhs = Counter(3)
+- expression 54 operands: lhs = Counter(4), rhs = Expression(55, Add)
+- expression 55 operands: lhs = Expression(56, Add), rhs = Expression(60, Add)
+- expression 56 operands: lhs = Counter(5), rhs = Expression(57, Add)
+- expression 57 operands: lhs = Expression(58, Add), rhs = Expression(59, Add)
+- expression 58 operands: lhs = Counter(6), rhs = Counter(7)
+- expression 59 operands: lhs = Counter(8), rhs = Counter(9)
+- expression 60 operands: lhs = Expression(61, Add), rhs = Expression(62, Add)
+- expression 61 operands: lhs = Counter(10), rhs = Counter(11)
+- expression 62 operands: lhs = Expression(63, Add), rhs = Expression(64, Add)
+- expression 63 operands: lhs = Counter(12), rhs = Counter(13)
+- expression 64 operands: lhs = Counter(14), rhs = Counter(15)
+Number of file 0 mappings: 40
+- Code(Counter(0)) at (prev + 60, 1) to (start + 3, 23)
+- Code(Expression(0, Add)) at (prev + 8, 9) to (start + 0, 14)
+ = (c0 + (c1 + c2))
+- Code(Expression(40, Sub)) at (prev + 2, 9) to (start + 4, 26)
+ = ((c0 + (c1 + c2)) - c3)
+- Code(Counter(16)) at (prev + 6, 13) to (start + 0, 47)
+- Code(Counter(4)) at (prev + 0, 47) to (start + 0, 48)
+- Code(Expression(20, Sub)) at (prev + 0, 49) to (start + 3, 53)
+ = (c16 - c4)
+- Code(Counter(5)) at (prev + 4, 17) to (start + 0, 18)
+- Code(Expression(19, Sub)) at (prev + 2, 17) to (start + 4, 18)
+ = ((c16 - c4) - c5)
+- Code(Expression(17, Sub)) at (prev + 5, 17) to (start + 0, 20)
+ = ((((c16 - c4) - c5) - c6) - c7)
+- Code(Expression(10, Add)) at (prev + 0, 23) to (start + 0, 65)
+ = (((c16 - c4) - c5) + Zero)
+- Code(Counter(6)) at (prev + 0, 65) to (start + 0, 66)
+- Code(Expression(18, Sub)) at (prev + 0, 67) to (start + 0, 95)
+ = (((c16 - c4) - c5) - c6)
+- Code(Counter(7)) at (prev + 0, 95) to (start + 0, 96)
+- Code(Expression(16, Add)) at (prev + 1, 13) to (start + 0, 32)
+ = (((((c16 - c4) - c5) - c6) - c7) + Zero)
+- Code(Expression(25, Sub)) at (prev + 1, 17) to (start + 0, 20)
+ = ((c18 - c8) - c9)
+- Code(Counter(18)) at (prev + 0, 23) to (start + 0, 65)
+- Code(Counter(8)) at (prev + 0, 65) to (start + 0, 66)
+- Code(Expression(26, Sub)) at (prev + 0, 67) to (start + 0, 96)
+ = (c18 - c8)
+- Code(Counter(9)) at (prev + 0, 96) to (start + 0, 97)
+- Code(Expression(24, Add)) at (prev + 1, 13) to (start + 0, 32)
+ = (((c18 - c8) - c9) + Zero)
+- Code(Expression(37, Sub)) at (prev + 4, 17) to (start + 0, 20)
+ = (((((c0 + (c1 + c2)) - c3) - c16) - c10) - c11)
+- Code(Expression(39, Sub)) at (prev + 0, 23) to (start + 0, 66)
+ = (((c0 + (c1 + c2)) - c3) - c16)
+- Code(Counter(10)) at (prev + 0, 66) to (start + 0, 67)
+- Code(Expression(38, Sub)) at (prev + 0, 68) to (start + 0, 97)
+ = ((((c0 + (c1 + c2)) - c3) - c16) - c10)
+- Code(Counter(11)) at (prev + 0, 97) to (start + 0, 98)
+- Code(Expression(36, Add)) at (prev + 1, 13) to (start + 0, 32)
+ = ((((((c0 + (c1 + c2)) - c3) - c16) - c10) - c11) + Zero)
+- Code(Expression(45, Sub)) at (prev + 1, 17) to (start + 0, 20)
+ = ((c17 - c12) - c13)
+- Code(Counter(17)) at (prev + 0, 23) to (start + 1, 54)
+- Code(Counter(12)) at (prev + 1, 54) to (start + 0, 55)
+- Code(Expression(46, Sub)) at (prev + 1, 18) to (start + 0, 47)
+ = (c17 - c12)
+- Code(Counter(13)) at (prev + 0, 47) to (start + 0, 48)
+- Code(Expression(44, Add)) at (prev + 1, 13) to (start + 0, 32)
+ = (((c17 - c12) - c13) + Zero)
+- Code(Expression(51, Sub)) at (prev + 1, 17) to (start + 0, 20)
+ = ((c19 - c14) - c15)
+- Code(Counter(19)) at (prev + 0, 23) to (start + 1, 54)
+- Code(Counter(14)) at (prev + 2, 17) to (start + 0, 18)
+- Code(Expression(52, Sub)) at (prev + 1, 18) to (start + 0, 47)
+ = (c19 - c14)
+- Code(Counter(15)) at (prev + 1, 17) to (start + 0, 18)
+- Code(Expression(50, Add)) at (prev + 2, 13) to (start + 0, 32)
+ = (((c19 - c14) - c15) + Zero)
+- Code(Counter(3)) at (prev + 3, 5) to (start + 0, 11)
+- Code(Expression(53, Add)) at (prev + 1, 1) to (start + 0, 2)
+ = ((c4 + ((c5 + ((c6 + c7) + (c8 + c9))) + ((c10 + c11) + ((c12 + c13) + (c14 + c15))))) + c3)
+
diff --git a/tests/coverage-map/status-quo/try_error_result.rs b/tests/coverage-map/status-quo/try_error_result.rs
new file mode 100644
index 000000000..557cbf22b
--- /dev/null
+++ b/tests/coverage-map/status-quo/try_error_result.rs
@@ -0,0 +1,118 @@
+#![allow(unused_assignments)]
+// failure-status: 1
+
+fn call(return_error: bool) -> Result<(), ()> {
+ if return_error {
+ Err(())
+ } else {
+ Ok(())
+ }
+}
+
+fn test1() -> Result<(), ()> {
+ let mut
+ countdown = 10
+ ;
+ for
+ _
+ in
+ 0..10
+ {
+ countdown
+ -= 1
+ ;
+ if
+ countdown < 5
+ {
+ call(/*return_error=*/ true)?;
+ call(/*return_error=*/ false)?;
+ }
+ else
+ {
+ call(/*return_error=*/ false)?;
+ }
+ }
+ Ok(())
+}
+
+struct Thing1;
+impl Thing1 {
+ fn get_thing_2(&self, return_error: bool) -> Result<Thing2, ()> {
+ if return_error {
+ Err(())
+ } else {
+ Ok(Thing2 {})
+ }
+ }
+}
+
+struct Thing2;
+impl Thing2 {
+ fn call(&self, return_error: bool) -> Result<u32, ()> {
+ if return_error {
+ Err(())
+ } else {
+ Ok(57)
+ }
+ }
+}
+
+fn test2() -> Result<(), ()> {
+ let thing1 = Thing1{};
+ let mut
+ countdown = 10
+ ;
+ for
+ _
+ in
+ 0..10
+ {
+ countdown
+ -= 1
+ ;
+ if
+ countdown < 5
+ {
+ thing1.get_thing_2(/*err=*/ false)?.call(/*err=*/ true).expect_err("call should fail");
+ thing1
+ .
+ get_thing_2(/*return_error=*/ false)
+ ?
+ .
+ call(/*return_error=*/ true)
+ .
+ expect_err(
+ "call should fail"
+ );
+ let val = thing1.get_thing_2(/*return_error=*/ true)?.call(/*return_error=*/ true)?;
+ assert_eq!(val, 57);
+ let val = thing1.get_thing_2(/*return_error=*/ true)?.call(/*return_error=*/ false)?;
+ assert_eq!(val, 57);
+ }
+ else
+ {
+ let val = thing1.get_thing_2(/*return_error=*/ false)?.call(/*return_error=*/ false)?;
+ assert_eq!(val, 57);
+ let val = thing1
+ .get_thing_2(/*return_error=*/ false)?
+ .call(/*return_error=*/ false)?;
+ assert_eq!(val, 57);
+ let val = thing1
+ .get_thing_2(/*return_error=*/ false)
+ ?
+ .call(/*return_error=*/ false)
+ ?
+ ;
+ assert_eq!(val, 57);
+ }
+ }
+ Ok(())
+}
+
+fn main() -> Result<(), ()> {
+ test1().expect_err("test1 should fail");
+ test2()
+ ?
+ ;
+ Ok(())
+}
diff --git a/tests/coverage-map/status-quo/unused.cov-map b/tests/coverage-map/status-quo/unused.cov-map
new file mode 100644
index 000000000..c8b8f195f
--- /dev/null
+++ b/tests/coverage-map/status-quo/unused.cov-map
@@ -0,0 +1,94 @@
+Function name: unused::foo::<f32>
+Raw bytes (42): 0x[01, 01, 04, 01, 0f, 05, 09, 03, 0d, 05, 09, 06, 01, 03, 01, 01, 12, 03, 02, 0b, 00, 11, 0a, 01, 09, 00, 0f, 09, 00, 13, 00, 19, 0f, 01, 09, 00, 0f, 0d, 02, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 4
+- expression 0 operands: lhs = Counter(0), rhs = Expression(3, Add)
+- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 3 operands: lhs = Counter(1), rhs = Counter(2)
+Number of file 0 mappings: 6
+- Code(Counter(0)) at (prev + 3, 1) to (start + 1, 18)
+- Code(Expression(0, Add)) at (prev + 2, 11) to (start + 0, 17)
+ = (c0 + (c1 + c2))
+- Code(Expression(2, Sub)) at (prev + 1, 9) to (start + 0, 15)
+ = ((c0 + (c1 + c2)) - c3)
+- Code(Counter(2)) at (prev + 0, 19) to (start + 0, 25)
+- Code(Expression(3, Add)) at (prev + 1, 9) to (start + 0, 15)
+ = (c1 + c2)
+- Code(Counter(3)) at (prev + 2, 1) to (start + 0, 2)
+
+Function name: unused::foo::<u32>
+Raw bytes (42): 0x[01, 01, 04, 01, 0f, 05, 09, 03, 0d, 05, 09, 06, 01, 03, 01, 01, 12, 03, 02, 0b, 00, 11, 0a, 01, 09, 00, 0f, 09, 00, 13, 00, 19, 0f, 01, 09, 00, 0f, 0d, 02, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 4
+- expression 0 operands: lhs = Counter(0), rhs = Expression(3, Add)
+- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 3 operands: lhs = Counter(1), rhs = Counter(2)
+Number of file 0 mappings: 6
+- Code(Counter(0)) at (prev + 3, 1) to (start + 1, 18)
+- Code(Expression(0, Add)) at (prev + 2, 11) to (start + 0, 17)
+ = (c0 + (c1 + c2))
+- Code(Expression(2, Sub)) at (prev + 1, 9) to (start + 0, 15)
+ = ((c0 + (c1 + c2)) - c3)
+- Code(Counter(2)) at (prev + 0, 19) to (start + 0, 25)
+- Code(Expression(3, Add)) at (prev + 1, 9) to (start + 0, 15)
+ = (c1 + c2)
+- Code(Counter(3)) at (prev + 2, 1) to (start + 0, 2)
+
+Function name: unused::main
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 25, 01, 04, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 37, 1) to (start + 4, 2)
+
+Function name: unused::unused_func (unused)
+Raw bytes (24): 0x[01, 01, 00, 04, 01, 13, 01, 01, 0e, 00, 01, 0f, 02, 06, 00, 02, 06, 00, 07, 00, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 19, 1) to (start + 1, 14)
+- Code(Zero) at (prev + 1, 15) to (start + 2, 6)
+- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
+- Code(Zero) at (prev + 1, 1) to (start + 0, 2)
+
+Function name: unused::unused_func2 (unused)
+Raw bytes (24): 0x[01, 01, 00, 04, 01, 19, 01, 01, 0e, 00, 01, 0f, 02, 06, 00, 02, 06, 00, 07, 00, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 25, 1) to (start + 1, 14)
+- Code(Zero) at (prev + 1, 15) to (start + 2, 6)
+- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
+- Code(Zero) at (prev + 1, 1) to (start + 0, 2)
+
+Function name: unused::unused_func3 (unused)
+Raw bytes (24): 0x[01, 01, 00, 04, 01, 1f, 01, 01, 0e, 00, 01, 0f, 02, 06, 00, 02, 06, 00, 07, 00, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 31, 1) to (start + 1, 14)
+- Code(Zero) at (prev + 1, 15) to (start + 2, 6)
+- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
+- Code(Zero) at (prev + 1, 1) to (start + 0, 2)
+
+Function name: unused::unused_template_func::<_> (unused)
+Raw bytes (34): 0x[01, 01, 00, 06, 01, 0b, 01, 01, 12, 00, 02, 0b, 00, 11, 00, 01, 09, 00, 0f, 00, 00, 13, 00, 19, 00, 01, 09, 00, 0f, 00, 02, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 6
+- Code(Counter(0)) at (prev + 11, 1) to (start + 1, 18)
+- Code(Zero) at (prev + 2, 11) to (start + 0, 17)
+- Code(Zero) at (prev + 1, 9) to (start + 0, 15)
+- Code(Zero) at (prev + 0, 19) to (start + 0, 25)
+- Code(Zero) at (prev + 1, 9) to (start + 0, 15)
+- Code(Zero) at (prev + 2, 1) to (start + 0, 2)
+
diff --git a/tests/coverage-map/status-quo/unused.rs b/tests/coverage-map/status-quo/unused.rs
new file mode 100644
index 000000000..d985af135
--- /dev/null
+++ b/tests/coverage-map/status-quo/unused.rs
@@ -0,0 +1,41 @@
+#![allow(dead_code, unused_assignments, unused_must_use, unused_variables)]
+
+fn foo<T>(x: T) {
+ let mut i = 0;
+ while i < 10 {
+ i != 0 || i != 0;
+ i += 1;
+ }
+}
+
+fn unused_template_func<T>(x: T) {
+ let mut i = 0;
+ while i < 10 {
+ i != 0 || i != 0;
+ i += 1;
+ }
+}
+
+fn unused_func(mut a: u32) {
+ if a != 0 {
+ a += 1;
+ }
+}
+
+fn unused_func2(mut a: u32) {
+ if a != 0 {
+ a += 1;
+ }
+}
+
+fn unused_func3(mut a: u32) {
+ if a != 0 {
+ a += 1;
+ }
+}
+
+fn main() -> Result<(), u8> {
+ foo::<u32>(0);
+ foo::<f32>(0.0);
+ Ok(())
+}
diff --git a/tests/coverage-map/status-quo/while.cov-map b/tests/coverage-map/status-quo/while.cov-map
new file mode 100644
index 000000000..cfd2be96a
--- /dev/null
+++ b/tests/coverage-map/status-quo/while.cov-map
@@ -0,0 +1,15 @@
+Function name: while::main
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 03, 05, 04, 01, 01, 01, 01, 10, 03, 02, 0b, 00, 14, 00, 00, 15, 01, 06, 06, 02, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Expression(0, Add), rhs = Counter(1)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 1, 1) to (start + 1, 16)
+- Code(Expression(0, Add)) at (prev + 2, 11) to (start + 0, 20)
+ = (c0 + c1)
+- Code(Zero) at (prev + 0, 21) to (start + 1, 6)
+- Code(Expression(1, Sub)) at (prev + 2, 1) to (start + 0, 2)
+ = ((c0 + c1) - c1)
+
diff --git a/tests/coverage-map/status-quo/while.rs b/tests/coverage-map/status-quo/while.rs
new file mode 100644
index 000000000..781b90b35
--- /dev/null
+++ b/tests/coverage-map/status-quo/while.rs
@@ -0,0 +1,5 @@
+fn main() {
+ let num = 9;
+ while num >= 10 {
+ }
+}
diff --git a/tests/coverage-map/status-quo/while_early_ret.cov-map b/tests/coverage-map/status-quo/while_early_ret.cov-map
new file mode 100644
index 000000000..369ebe891
--- /dev/null
+++ b/tests/coverage-map/status-quo/while_early_ret.cov-map
@@ -0,0 +1,26 @@
+Function name: while_early_ret::main
+Raw bytes (61): 0x[01, 01, 06, 01, 05, 03, 09, 0e, 05, 03, 09, 17, 09, 0d, 11, 09, 01, 04, 01, 01, 1b, 03, 03, 09, 02, 0a, 0e, 05, 0d, 02, 0e, 0a, 06, 15, 02, 16, 0d, 04, 15, 00, 1b, 11, 04, 15, 00, 1b, 05, 03, 0a, 03, 0a, 09, 06, 05, 00, 0b, 13, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 6
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Expression(0, Add), rhs = Counter(2)
+- expression 2 operands: lhs = Expression(3, Sub), rhs = Counter(1)
+- expression 3 operands: lhs = Expression(0, Add), rhs = Counter(2)
+- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(2)
+- expression 5 operands: lhs = Counter(3), rhs = Counter(4)
+Number of file 0 mappings: 9
+- Code(Counter(0)) at (prev + 4, 1) to (start + 1, 27)
+- Code(Expression(0, Add)) at (prev + 3, 9) to (start + 2, 10)
+ = (c0 + c1)
+- Code(Expression(3, Sub)) at (prev + 5, 13) to (start + 2, 14)
+ = ((c0 + c1) - c2)
+- Code(Expression(2, Sub)) at (prev + 6, 21) to (start + 2, 22)
+ = (((c0 + c1) - c2) - c1)
+- Code(Counter(3)) at (prev + 4, 21) to (start + 0, 27)
+- Code(Counter(4)) at (prev + 4, 21) to (start + 0, 27)
+- Code(Counter(1)) at (prev + 3, 10) to (start + 3, 10)
+- Code(Counter(2)) at (prev + 6, 5) to (start + 0, 11)
+- Code(Expression(4, Add)) at (prev + 1, 1) to (start + 0, 2)
+ = ((c3 + c4) + c2)
+
diff --git a/tests/coverage-map/status-quo/while_early_ret.rs b/tests/coverage-map/status-quo/while_early_ret.rs
new file mode 100644
index 000000000..b2f0eee2c
--- /dev/null
+++ b/tests/coverage-map/status-quo/while_early_ret.rs
@@ -0,0 +1,42 @@
+#![allow(unused_assignments)]
+// failure-status: 1
+
+fn main() -> Result<(), u8> {
+ let mut countdown = 10;
+ while
+ countdown
+ >
+ 0
+ {
+ if
+ countdown
+ <
+ 5
+ {
+ return
+ if
+ countdown
+ >
+ 8
+ {
+ Ok(())
+ }
+ else
+ {
+ Err(1)
+ }
+ ;
+ }
+ countdown
+ -=
+ 1
+ ;
+ }
+ Ok(())
+}
+
+// ISSUE(77553): Originally, this test had `Err(1)` on line 22 (instead of `Ok(())`) and
+// `std::process::exit(2)` on line 26 (instead of `Err(1)`); and this worked as expected on Linux
+// and MacOS. But on Windows (MSVC, at least), the call to `std::process::exit()` exits the program
+// without saving the InstrProf coverage counters. The use of `std::process:exit()` is not critical
+// to the coverage test for early returns, but this is a limitation that should be fixed.
diff --git a/tests/coverage-map/status-quo/yield.cov-map b/tests/coverage-map/status-quo/yield.cov-map
new file mode 100644
index 000000000..16caa2db3
--- /dev/null
+++ b/tests/coverage-map/status-quo/yield.cov-map
@@ -0,0 +1,72 @@
+Function name: yield::main
+Raw bytes (118): 0x[01, 01, 11, 01, 00, 05, 09, 0d, 00, 0d, 11, 32, 15, 0d, 11, 11, 15, 2e, 00, 32, 15, 0d, 11, 2e, 00, 32, 15, 0d, 11, 19, 1d, 21, 00, 25, 29, 2d, 00, 10, 01, 07, 01, 01, 16, 03, 06, 0b, 00, 2e, 0d, 01, 27, 00, 29, 07, 01, 0e, 00, 34, 0b, 02, 0b, 00, 2e, 32, 01, 22, 00, 27, 2e, 00, 2c, 00, 2e, 1b, 01, 0e, 00, 34, 1f, 03, 09, 00, 16, 2b, 07, 0b, 00, 2e, 21, 01, 27, 00, 29, 37, 01, 0e, 00, 34, 3b, 02, 0b, 00, 2e, 2d, 01, 27, 00, 29, 3f, 01, 0e, 00, 34, 43, 02, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 17
+- expression 0 operands: lhs = Counter(0), rhs = Zero
+- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 2 operands: lhs = Counter(3), rhs = Zero
+- expression 3 operands: lhs = Counter(3), rhs = Counter(4)
+- expression 4 operands: lhs = Expression(12, Sub), rhs = Counter(5)
+- expression 5 operands: lhs = Counter(3), rhs = Counter(4)
+- expression 6 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 7 operands: lhs = Expression(11, Sub), rhs = Zero
+- expression 8 operands: lhs = Expression(12, Sub), rhs = Counter(5)
+- expression 9 operands: lhs = Counter(3), rhs = Counter(4)
+- expression 10 operands: lhs = Expression(11, Sub), rhs = Zero
+- expression 11 operands: lhs = Expression(12, Sub), rhs = Counter(5)
+- expression 12 operands: lhs = Counter(3), rhs = Counter(4)
+- expression 13 operands: lhs = Counter(6), rhs = Counter(7)
+- expression 14 operands: lhs = Counter(8), rhs = Zero
+- expression 15 operands: lhs = Counter(9), rhs = Counter(10)
+- expression 16 operands: lhs = Counter(11), rhs = Zero
+Number of file 0 mappings: 16
+- Code(Counter(0)) at (prev + 7, 1) to (start + 1, 22)
+- Code(Expression(0, Add)) at (prev + 6, 11) to (start + 0, 46)
+ = (c0 + Zero)
+- Code(Counter(3)) at (prev + 1, 39) to (start + 0, 41)
+- Code(Expression(1, Add)) at (prev + 1, 14) to (start + 0, 52)
+ = (c1 + c2)
+- Code(Expression(2, Add)) at (prev + 2, 11) to (start + 0, 46)
+ = (c3 + Zero)
+- Code(Expression(12, Sub)) at (prev + 1, 34) to (start + 0, 39)
+ = (c3 - c4)
+- Code(Expression(11, Sub)) at (prev + 0, 44) to (start + 0, 46)
+ = ((c3 - c4) - c5)
+- Code(Expression(6, Add)) at (prev + 1, 14) to (start + 0, 52)
+ = (c4 + c5)
+- Code(Expression(7, Add)) at (prev + 3, 9) to (start + 0, 22)
+ = (((c3 - c4) - c5) + Zero)
+- Code(Expression(10, Add)) at (prev + 7, 11) to (start + 0, 46)
+ = (((c3 - c4) - c5) + Zero)
+- Code(Counter(8)) at (prev + 1, 39) to (start + 0, 41)
+- Code(Expression(13, Add)) at (prev + 1, 14) to (start + 0, 52)
+ = (c6 + c7)
+- Code(Expression(14, Add)) at (prev + 2, 11) to (start + 0, 46)
+ = (c8 + Zero)
+- Code(Counter(11)) at (prev + 1, 39) to (start + 0, 41)
+- Code(Expression(15, Add)) at (prev + 1, 14) to (start + 0, 52)
+ = (c9 + c10)
+- Code(Expression(16, Add)) at (prev + 2, 1) to (start + 0, 2)
+ = (c11 + Zero)
+
+Function name: yield::main::{closure#0}
+Raw bytes (14): 0x[01, 01, 00, 02, 01, 08, 1c, 01, 10, 05, 02, 10, 01, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 2
+- Code(Counter(0)) at (prev + 8, 28) to (start + 1, 16)
+- Code(Counter(1)) at (prev + 2, 16) to (start + 1, 6)
+
+Function name: yield::main::{closure#1}
+Raw bytes (24): 0x[01, 01, 00, 04, 01, 16, 1c, 01, 10, 05, 02, 09, 00, 10, 09, 01, 09, 00, 10, 0d, 01, 10, 01, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 22, 28) to (start + 1, 16)
+- Code(Counter(1)) at (prev + 2, 9) to (start + 0, 16)
+- Code(Counter(2)) at (prev + 1, 9) to (start + 0, 16)
+- Code(Counter(3)) at (prev + 1, 16) to (start + 1, 6)
+
diff --git a/tests/coverage-map/status-quo/yield.rs b/tests/coverage-map/status-quo/yield.rs
new file mode 100644
index 000000000..361275c92
--- /dev/null
+++ b/tests/coverage-map/status-quo/yield.rs
@@ -0,0 +1,37 @@
+#![feature(generators, generator_trait)]
+#![allow(unused_assignments)]
+
+use std::ops::{Generator, GeneratorState};
+use std::pin::Pin;
+
+fn main() {
+ let mut generator = || {
+ yield 1;
+ return "foo";
+ };
+
+ match Pin::new(&mut generator).resume(()) {
+ GeneratorState::Yielded(1) => {}
+ _ => panic!("unexpected value from resume"),
+ }
+ match Pin::new(&mut generator).resume(()) {
+ GeneratorState::Complete("foo") => {}
+ _ => panic!("unexpected value from resume"),
+ }
+
+ let mut generator = || {
+ yield 1;
+ yield 2;
+ yield 3;
+ return "foo";
+ };
+
+ match Pin::new(&mut generator).resume(()) {
+ GeneratorState::Yielded(1) => {}
+ _ => panic!("unexpected value from resume"),
+ }
+ match Pin::new(&mut generator).resume(()) {
+ GeneratorState::Yielded(2) => {}
+ _ => panic!("unexpected value from resume"),
+ }
+}
diff --git a/tests/coverage-map/trivial.cov-map b/tests/coverage-map/trivial.cov-map
new file mode 100644
index 000000000..874e294a1
--- /dev/null
+++ b/tests/coverage-map/trivial.cov-map
@@ -0,0 +1,8 @@
+Function name: trivial::main
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 03, 01, 00, 0d]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 13)
+
diff --git a/tests/coverage-map/trivial.rs b/tests/coverage-map/trivial.rs
new file mode 100644
index 000000000..d0a9b44fb
--- /dev/null
+++ b/tests/coverage-map/trivial.rs
@@ -0,0 +1,3 @@
+// compile-flags: --edition=2021
+
+fn main() {}
diff --git a/tests/debuginfo/pretty-std-collections.rs b/tests/debuginfo/pretty-std-collections.rs
index 93597aa7e..93a0dff68 100644
--- a/tests/debuginfo/pretty-std-collections.rs
+++ b/tests/debuginfo/pretty-std-collections.rs
@@ -1,7 +1,6 @@
// ignore-windows failing on win32 bot
// ignore-freebsd: gdb package too new
// ignore-android: FIXME(#10381)
-// ignore-macos: FIXME(#78665)
// compile-flags:-g
// The pretty printers being tested here require the patch from
diff --git a/tests/debuginfo/regression-bad-location-list-67992.rs b/tests/debuginfo/regression-bad-location-list-67992.rs
new file mode 100644
index 000000000..cc7c4a0d7
--- /dev/null
+++ b/tests/debuginfo/regression-bad-location-list-67992.rs
@@ -0,0 +1,31 @@
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print a
+// gdb-check:$1 = regression_bad_location_list_67992::Foo {x: [0 <repeats 1024 times>]}
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+// lldb-command:print a
+// lldbg-check:(regression_bad_location_list_67992::Foo) $0 = [...]
+// lldbr-check:(regression_bad_location_list_67992::Foo) a = [...]
+
+const ARRAY_SIZE: usize = 1024;
+
+struct Foo {
+ x: [u64; ARRAY_SIZE],
+}
+
+fn foo(a: Foo, i: usize) -> u64 {
+ a.x[i] // #break
+}
+
+fn main() {
+ println!("Hello, world!");
+
+ println!("{}", foo(Foo { x: [0; ARRAY_SIZE] }, 42));
+}
diff --git a/tests/incremental/change_crate_dep_kind.rs b/tests/incremental/change_crate_dep_kind.rs
index f51826601..b9f743404 100644
--- a/tests/incremental/change_crate_dep_kind.rs
+++ b/tests/incremental/change_crate_dep_kind.rs
@@ -5,6 +5,7 @@
// needs-unwind
// revisions:cfail1 cfail2
// compile-flags: -Z query-dep-graph -Cpanic=unwind
+// needs-unwind
// build-pass (FIXME(62277): could be check-pass?)
#![feature(panic_unwind)]
diff --git a/tests/incremental/hashes/function_interfaces.rs b/tests/incremental/hashes/function_interfaces.rs
index 182ca7d92..23b81705f 100644
--- a/tests/incremental/hashes/function_interfaces.rs
+++ b/tests/incremental/hashes/function_interfaces.rs
@@ -302,7 +302,7 @@ pub fn return_impl_trait() -> i32 {
}
#[cfg(not(any(cfail1,cfail4)))]
-#[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, typeck, fn_sig, optimized_mir")]
+#[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, typeck, fn_sig")]
#[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5", except = "hir_owner, hir_owner_nodes, typeck, fn_sig, optimized_mir")]
#[rustc_clean(cfg = "cfail6")]
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 a59ffe97b..6c3128f8c 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);
_1 = const ();
- asm!("", options(MAY_UNWIND)) -> [return: bb1, unwind terminate];
+ asm!("", options(MAY_UNWIND)) -> [return: bb1, unwind terminate(abi)];
}
bb1: {
diff --git a/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff b/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff
index 15269fb8f..f187f9597 100644
--- a/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff
+++ b/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff
@@ -47,7 +47,7 @@
bb2 (cleanup): {
_5 = move _6;
-- drop(_6) -> [return: bb6, unwind terminate];
+- drop(_6) -> [return: bb6, unwind terminate(cleanup)];
+ goto -> bb6;
}
@@ -71,12 +71,12 @@
}
bb6 (cleanup): {
-- drop(_5) -> [return: bb7, unwind terminate];
+- drop(_5) -> [return: bb7, unwind terminate(cleanup)];
+ goto -> bb7;
}
bb7 (cleanup): {
-- drop(_4) -> [return: bb8, unwind terminate];
+- drop(_4) -> [return: bb8, unwind terminate(cleanup)];
+ goto -> bb8;
}
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 a9bc2e890..75070ffda 100644
--- a/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir
+++ b/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir
@@ -51,7 +51,7 @@ fn main() -> () {
bb2 (cleanup): {
_5 = move _6;
- drop(_6) -> [return: bb6, unwind terminate];
+ drop(_6) -> [return: bb6, unwind terminate(cleanup)];
}
bb3: {
@@ -73,11 +73,11 @@ fn main() -> () {
}
bb6 (cleanup): {
- drop(_5) -> [return: bb7, unwind terminate];
+ drop(_5) -> [return: bb7, unwind terminate(cleanup)];
}
bb7 (cleanup): {
- drop(_4) -> [return: bb8, unwind terminate];
+ drop(_4) -> [return: bb8, unwind terminate(cleanup)];
}
bb8 (cleanup): {
diff --git a/tests/mir-opt/bool_compare.opt1.InstSimplify.diff b/tests/mir-opt/bool_compare.opt1.InstSimplify.diff
index 8d0011d50..657c11516 100644
--- a/tests/mir-opt/bool_compare.opt1.InstSimplify.diff
+++ b/tests/mir-opt/bool_compare.opt1.InstSimplify.diff
@@ -13,16 +13,17 @@
_3 = _1;
- _2 = Ne(move _3, const true);
+ _2 = Not(move _3);
- StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
+ StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
+ StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}
diff --git a/tests/mir-opt/bool_compare.opt2.InstSimplify.diff b/tests/mir-opt/bool_compare.opt2.InstSimplify.diff
index 35f106870..bc8be62bd 100644
--- a/tests/mir-opt/bool_compare.opt2.InstSimplify.diff
+++ b/tests/mir-opt/bool_compare.opt2.InstSimplify.diff
@@ -13,16 +13,17 @@
_3 = _1;
- _2 = Ne(const true, move _3);
+ _2 = Not(move _3);
- StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
+ StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
+ StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}
diff --git a/tests/mir-opt/bool_compare.opt3.InstSimplify.diff b/tests/mir-opt/bool_compare.opt3.InstSimplify.diff
index ab15c30ca..034d5e440 100644
--- a/tests/mir-opt/bool_compare.opt3.InstSimplify.diff
+++ b/tests/mir-opt/bool_compare.opt3.InstSimplify.diff
@@ -13,16 +13,17 @@
_3 = _1;
- _2 = Eq(move _3, const false);
+ _2 = Not(move _3);
- StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
+ StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
+ StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}
diff --git a/tests/mir-opt/bool_compare.opt4.InstSimplify.diff b/tests/mir-opt/bool_compare.opt4.InstSimplify.diff
index 40fd1cfe1..d3096da6c 100644
--- a/tests/mir-opt/bool_compare.opt4.InstSimplify.diff
+++ b/tests/mir-opt/bool_compare.opt4.InstSimplify.diff
@@ -13,16 +13,17 @@
_3 = _1;
- _2 = Eq(const false, move _3);
+ _2 = Not(move _3);
- StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
+ StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
+ StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}
diff --git a/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir b/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir
index d196b045a..1c7ef7f83 100644
--- a/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir
+++ b/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir
@@ -54,15 +54,15 @@ fn main() -> () {
}
bb6 (cleanup): {
- drop(_7) -> [return: bb7, unwind terminate];
+ drop(_7) -> [return: bb7, unwind terminate(cleanup)];
}
bb7 (cleanup): {
- drop(_1) -> [return: bb9, unwind terminate];
+ drop(_1) -> [return: bb9, unwind terminate(cleanup)];
}
bb8 (cleanup): {
- drop(_5) -> [return: bb9, unwind terminate];
+ drop(_5) -> [return: bb9, unwind terminate(cleanup)];
}
bb9 (cleanup): {
diff --git a/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir b/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir
index a72d22a9c..4ad1c2de1 100644
--- a/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir
+++ b/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir
@@ -54,15 +54,15 @@ fn main() -> () {
}
bb6 (cleanup): {
- drop(_7) -> [return: bb7, unwind terminate];
+ drop(_7) -> [return: bb7, unwind terminate(cleanup)];
}
bb7 (cleanup): {
- drop(_1) -> [return: bb9, unwind terminate];
+ drop(_1) -> [return: bb9, unwind terminate(cleanup)];
}
bb8 (cleanup): {
- drop(_5) -> [return: bb9, unwind terminate];
+ drop(_5) -> [return: bb9, unwind terminate(cleanup)];
}
bb9 (cleanup): {
diff --git a/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir b/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir
index 9be5b8509..98b1befc3 100644
--- a/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir
+++ b/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir
@@ -9,7 +9,7 @@
storage_conflicts: BitMatrix(0x0) {},
} */
-fn a::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:11:14: 11:16]>, _2: &mut Context<'_>) -> Poll<()> {
+fn a::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>, _2: &mut Context<'_>) -> Poll<()> {
debug _task_context => _4;
let mut _0: std::task::Poll<()>;
let mut _3: ();
@@ -17,23 +17,31 @@ fn a::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:11:14: 11:16]>
let mut _5: u32;
bb0: {
- _5 = discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:11:14: 11:16])));
- switchInt(move _5) -> [0: bb1, 1: bb2, otherwise: bb3];
+ _5 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16})));
+ switchInt(move _5) -> [0: bb1, 1: bb4, otherwise: bb5];
}
bb1: {
_4 = move _2;
_3 = const ();
- _0 = Poll::<()>::Ready(move _3);
- discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:11:14: 11:16]))) = 1;
- return;
+ goto -> bb3;
}
bb2: {
- assert(const false, "`async fn` resumed after completion") -> [success: bb2, unwind unreachable];
+ _0 = Poll::<()>::Ready(move _3);
+ discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16}))) = 1;
+ return;
}
bb3: {
+ goto -> bb2;
+ }
+
+ bb4: {
+ assert(const false, "`async fn` resumed after completion") -> [success: bb4, unwind unreachable];
+ }
+
+ bb5: {
unreachable;
}
}
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 80ac92d59..15330b13c 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
@@ -2,7 +2,17 @@
/* generator_layout = GeneratorLayout {
field_tys: {
_0: GeneratorSavedTy {
- ty: impl std::future::Future<Output = ()>,
+ ty: Generator(
+ DefId(0:4 ~ async_await[ccf8]::a::{closure#0}),
+ [
+ std::future::ResumeTy,
+ (),
+ (),
+ GeneratorWitness(DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), []),
+ (),
+ ],
+ Static,
+ ),
source_info: SourceInfo {
span: $DIR/async_await.rs:15:9: 15:14 (#8),
scope: scope[0],
@@ -10,7 +20,17 @@
ignore_for_traits: false,
},
_1: GeneratorSavedTy {
- ty: impl std::future::Future<Output = ()>,
+ ty: Generator(
+ DefId(0:4 ~ async_await[ccf8]::a::{closure#0}),
+ [
+ std::future::ResumeTy,
+ (),
+ (),
+ GeneratorWitness(DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), []),
+ (),
+ ],
+ Static,
+ ),
source_info: SourceInfo {
span: $DIR/async_await.rs:16:9: 16:14 (#10),
scope: scope[0],
@@ -31,19 +51,19 @@
},
} */
-fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, _2: &mut Context<'_>) -> Poll<()> {
+fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, _2: &mut Context<'_>) -> Poll<()> {
debug _task_context => _38;
let mut _0: std::task::Poll<()>;
let _3: ();
- let mut _4: impl std::future::Future<Output = ()>;
- let mut _5: impl std::future::Future<Output = ()>;
- let mut _6: impl std::future::Future<Output = ()>;
+ let mut _4: {async fn body@$DIR/async_await.rs:11:14: 11:16};
+ let mut _5: {async fn body@$DIR/async_await.rs:11:14: 11:16};
+ let mut _6: {async fn body@$DIR/async_await.rs:11:14: 11:16};
let mut _7: ();
let _8: ();
let mut _9: std::task::Poll<()>;
- let mut _10: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
- let mut _11: &mut impl std::future::Future<Output = ()>;
- let mut _12: &mut impl std::future::Future<Output = ()>;
+ let mut _10: std::pin::Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>;
+ let mut _11: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16};
+ let mut _12: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16};
let mut _13: &mut std::task::Context<'_>;
let mut _14: &mut std::task::Context<'_>;
let mut _15: &mut std::task::Context<'_>;
@@ -51,14 +71,14 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
let mut _18: !;
let mut _19: &mut std::task::Context<'_>;
let mut _20: ();
- let mut _21: impl std::future::Future<Output = ()>;
- let mut _22: impl std::future::Future<Output = ()>;
- let mut _23: impl std::future::Future<Output = ()>;
+ let mut _21: {async fn body@$DIR/async_await.rs:11:14: 11:16};
+ let mut _22: {async fn body@$DIR/async_await.rs:11:14: 11:16};
+ let mut _23: {async fn body@$DIR/async_await.rs:11:14: 11:16};
let _24: ();
let mut _25: std::task::Poll<()>;
- let mut _26: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
- let mut _27: &mut impl std::future::Future<Output = ()>;
- let mut _28: &mut impl std::future::Future<Output = ()>;
+ let mut _26: std::pin::Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>;
+ let mut _27: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16};
+ let mut _28: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16};
let mut _29: &mut std::task::Context<'_>;
let mut _30: &mut std::task::Context<'_>;
let mut _31: &mut std::task::Context<'_>;
@@ -70,7 +90,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
let mut _38: &mut std::task::Context<'_>;
let mut _39: u32;
scope 1 {
- debug __awaitee => (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future<Output = ()>);
+ debug __awaitee => (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16});
let _17: ();
scope 2 {
}
@@ -79,7 +99,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
}
}
scope 4 {
- debug __awaitee => (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future<Output = ()>);
+ debug __awaitee => (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16});
let _33: ();
scope 5 {
}
@@ -89,8 +109,8 @@ 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])));
- switchInt(move _39) -> [0: bb1, 1: bb28, 3: bb26, 4: bb27, otherwise: bb29];
+ _39 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})));
+ switchInt(move _39) -> [0: bb1, 1: bb29, 3: bb27, 4: bb28, otherwise: bb30];
}
bb1: {
@@ -102,13 +122,13 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
}
bb2: {
- _4 = <impl Future<Output = ()> as IntoFuture>::into_future(move _5) -> [return: bb3, unwind unreachable];
+ _4 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as IntoFuture>::into_future(move _5) -> [return: bb3, unwind unreachable];
}
bb3: {
StorageDead(_5);
nop;
- (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future<Output = ()>) = move _4;
+ (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16}) = move _4;
goto -> bb4;
}
@@ -118,9 +138,9 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
StorageLive(_10);
StorageLive(_11);
StorageLive(_12);
- _12 = &mut (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future<Output = ()>);
+ _12 = &mut (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16});
_11 = &mut (*_12);
- _10 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _11) -> [return: bb5, unwind unreachable];
+ _10 = Pin::<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>::new_unchecked(move _11) -> [return: bb5, unwind unreachable];
}
bb5: {
@@ -136,7 +156,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb6: {
_13 = &mut (*_14);
StorageDead(_15);
- _9 = <impl Future<Output = ()> as Future>::poll(move _10, move _13) -> [return: bb7, unwind unreachable];
+ _9 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as Future>::poll(move _10, move _13) -> [return: bb7, unwind unreachable];
}
bb7: {
@@ -156,7 +176,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
StorageLive(_20);
_20 = ();
_0 = Poll::<()>::Pending;
- discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 3;
+ discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2}))) = 3;
return;
}
@@ -173,7 +193,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
StorageDead(_12);
StorageDead(_9);
StorageDead(_8);
- goto -> bb12;
+ drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16})) -> [return: bb12, unwind unreachable];
}
bb11: {
@@ -198,13 +218,13 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
}
bb14: {
- _21 = <impl Future<Output = ()> as IntoFuture>::into_future(move _22) -> [return: bb15, unwind unreachable];
+ _21 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as IntoFuture>::into_future(move _22) -> [return: bb15, unwind unreachable];
}
bb15: {
StorageDead(_22);
nop;
- (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future<Output = ()>) = move _21;
+ (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16}) = move _21;
goto -> bb16;
}
@@ -214,9 +234,9 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
StorageLive(_26);
StorageLive(_27);
StorageLive(_28);
- _28 = &mut (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future<Output = ()>);
+ _28 = &mut (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16});
_27 = &mut (*_28);
- _26 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _27) -> [return: bb17, unwind unreachable];
+ _26 = Pin::<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>::new_unchecked(move _27) -> [return: bb17, unwind unreachable];
}
bb17: {
@@ -232,7 +252,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb18: {
_29 = &mut (*_30);
StorageDead(_31);
- _25 = <impl Future<Output = ()> as Future>::poll(move _26, move _29) -> [return: bb19, unwind unreachable];
+ _25 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as Future>::poll(move _26, move _29) -> [return: bb19, unwind unreachable];
}
bb19: {
@@ -252,7 +272,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
StorageLive(_36);
_36 = ();
_0 = Poll::<()>::Pending;
- discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 4;
+ discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2}))) = 4;
return;
}
@@ -265,7 +285,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
StorageDead(_28);
StorageDead(_25);
StorageDead(_24);
- goto -> bb23;
+ drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16})) -> [return: bb23, unwind unreachable];
}
bb22: {
@@ -283,16 +303,20 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb24: {
StorageDead(_21);
- goto -> bb25;
+ goto -> bb26;
}
bb25: {
_0 = Poll::<()>::Ready(move _37);
- discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 1;
+ discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2}))) = 1;
return;
}
bb26: {
+ goto -> bb25;
+ }
+
+ bb27: {
StorageLive(_3);
StorageLive(_4);
StorageLive(_19);
@@ -301,7 +325,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
goto -> bb11;
}
- bb27: {
+ bb28: {
StorageLive(_21);
StorageLive(_35);
StorageLive(_36);
@@ -309,11 +333,11 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
goto -> bb22;
}
- bb28: {
- assert(const false, "`async fn` resumed after completion") -> [success: bb28, unwind unreachable];
+ bb29: {
+ assert(const false, "`async fn` resumed after completion") -> [success: bb29, unwind unreachable];
}
- bb29: {
+ bb30: {
unreachable;
}
}
diff --git a/tests/mir-opt/building/custom/debuginfo.numbered.built.after.mir b/tests/mir-opt/building/custom/debuginfo.numbered.built.after.mir
new file mode 100644
index 000000000..d86392537
--- /dev/null
+++ b/tests/mir-opt/building/custom/debuginfo.numbered.built.after.mir
@@ -0,0 +1,11 @@
+// MIR for `numbered` after built
+
+fn numbered(_1: (u32, i32)) -> () {
+ debug first => (_1.0: u32);
+ debug second => (_1.0: u32);
+ let mut _0: ();
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/building/custom/debuginfo.pointee.built.after.mir b/tests/mir-opt/building/custom/debuginfo.pointee.built.after.mir
new file mode 100644
index 000000000..86cced6f8
--- /dev/null
+++ b/tests/mir-opt/building/custom/debuginfo.pointee.built.after.mir
@@ -0,0 +1,10 @@
+// MIR for `pointee` after built
+
+fn pointee(_1: &mut Option<i32>) -> () {
+ debug foo => (((*_1) as variant#1).0: i32);
+ let mut _0: ();
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/building/custom/debuginfo.rs b/tests/mir-opt/building/custom/debuginfo.rs
new file mode 100644
index 000000000..bfdc3d3ea
--- /dev/null
+++ b/tests/mir-opt/building/custom/debuginfo.rs
@@ -0,0 +1,71 @@
+#![feature(custom_mir, core_intrinsics)]
+
+extern crate core;
+use core::intrinsics::mir::*;
+
+// EMIT_MIR debuginfo.pointee.built.after.mir
+#[custom_mir(dialect = "built")]
+fn pointee(opt: &mut Option<i32>) {
+ mir!(
+ debug foo => Field::<i32>(Variant(*opt, 1), 0);
+ {
+ Return()
+ }
+ )
+}
+
+// EMIT_MIR debuginfo.numbered.built.after.mir
+#[custom_mir(dialect = "analysis", phase = "post-cleanup")]
+fn numbered(i: (u32, i32)) {
+ mir!(
+ debug first => i.0;
+ debug second => i.0;
+ {
+ Return()
+ }
+ )
+}
+
+struct S { x: f32 }
+
+// EMIT_MIR debuginfo.structured.built.after.mir
+#[custom_mir(dialect = "analysis", phase = "post-cleanup")]
+fn structured(i: S) {
+ mir!(
+ debug x => i.x;
+ {
+ Return()
+ }
+ )
+}
+
+// EMIT_MIR debuginfo.variant.built.after.mir
+#[custom_mir(dialect = "built")]
+fn variant(opt: Option<i32>) {
+ mir!(
+ debug inner => Field::<i32>(Variant(opt, 1), 0);
+ {
+ Return()
+ }
+ )
+}
+
+// EMIT_MIR debuginfo.variant_deref.built.after.mir
+#[custom_mir(dialect = "built")]
+fn variant_deref(opt: Option<&i32>) {
+ mir!(
+ debug pointer => Field::<&i32>(Variant(opt, 1), 0);
+ debug deref => *Field::<&i32>(Variant(opt, 1), 0);
+ {
+ Return()
+ }
+ )
+}
+
+fn main() {
+ numbered((5, 6));
+ structured(S { x: 5. });
+ variant(Some(5));
+ variant_deref(Some(&5));
+ pointee(&mut Some(5));
+}
diff --git a/tests/mir-opt/building/custom/debuginfo.structured.built.after.mir b/tests/mir-opt/building/custom/debuginfo.structured.built.after.mir
new file mode 100644
index 000000000..d122b6bfe
--- /dev/null
+++ b/tests/mir-opt/building/custom/debuginfo.structured.built.after.mir
@@ -0,0 +1,10 @@
+// MIR for `structured` after built
+
+fn structured(_1: S) -> () {
+ debug x => (_1.0: f32);
+ let mut _0: ();
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/building/custom/debuginfo.variant.built.after.mir b/tests/mir-opt/building/custom/debuginfo.variant.built.after.mir
new file mode 100644
index 000000000..d173723fd
--- /dev/null
+++ b/tests/mir-opt/building/custom/debuginfo.variant.built.after.mir
@@ -0,0 +1,10 @@
+// MIR for `variant` after built
+
+fn variant(_1: Option<i32>) -> () {
+ debug inner => ((_1 as variant#1).0: i32);
+ let mut _0: ();
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/building/custom/debuginfo.variant_deref.built.after.mir b/tests/mir-opt/building/custom/debuginfo.variant_deref.built.after.mir
new file mode 100644
index 000000000..37d5d1b2d
--- /dev/null
+++ b/tests/mir-opt/building/custom/debuginfo.variant_deref.built.after.mir
@@ -0,0 +1,11 @@
+// MIR for `variant_deref` after built
+
+fn variant_deref(_1: Option<&i32>) -> () {
+ debug pointer => ((_1 as variant#1).0: &i32);
+ debug deref => (*((_1 as variant#1).0: &i32));
+ let mut _0: ();
+
+ bb0: {
+ 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 1caf9e4a5..ea0edb610 100644
--- a/tests/mir-opt/building/enum_cast.droppy.built.after.mir
+++ b/tests/mir-opt/building/enum_cast.droppy.built.after.mir
@@ -62,7 +62,7 @@ fn droppy() -> () {
}
bb4 (cleanup): {
- drop(_2) -> [return: bb5, unwind terminate];
+ drop(_2) -> [return: bb5, unwind terminate(cleanup)];
}
bb5 (cleanup): {
diff --git a/tests/mir-opt/building/logical_or_in_conditional.rs b/tests/mir-opt/building/logical_or_in_conditional.rs
new file mode 100644
index 000000000..ae159f7e1
--- /dev/null
+++ b/tests/mir-opt/building/logical_or_in_conditional.rs
@@ -0,0 +1,39 @@
+// compile-flags: -Z validate-mir
+#![feature(let_chains)]
+struct Droppy(u8);
+impl Drop for Droppy {
+ fn drop(&mut self) {
+ println!("drop {}", self.0);
+ }
+}
+
+enum E {
+ A(u8),
+ B,
+}
+
+impl E {
+ fn f() -> Self {
+ Self::A(1)
+ }
+}
+
+fn always_true() -> bool {
+ true
+}
+
+// EMIT_MIR logical_or_in_conditional.test_or.built.after.mir
+fn test_or() {
+ if Droppy(0).0 > 0 || Droppy(1).0 > 1 {}
+}
+
+// EMIT_MIR logical_or_in_conditional.test_complex.built.after.mir
+fn test_complex() {
+ if let E::A(_) = E::f() && ((always_true() && Droppy(0).0 > 0) || Droppy(1).0 > 1) {}
+
+ if !always_true() && let E::B = E::f() {}
+}
+
+fn main() {
+ test_or();
+}
diff --git a/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir b/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir
new file mode 100644
index 000000000..096aaec4a
--- /dev/null
+++ b/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir
@@ -0,0 +1,186 @@
+// MIR for `test_complex` after built
+
+fn test_complex() -> () {
+ let mut _0: ();
+ let _1: ();
+ let mut _2: E;
+ let mut _3: isize;
+ let mut _4: bool;
+ let mut _5: bool;
+ let mut _6: u8;
+ let mut _7: Droppy;
+ let mut _8: bool;
+ let mut _9: u8;
+ let mut _10: Droppy;
+ let mut _11: bool;
+ let mut _12: E;
+ let mut _13: isize;
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = E::f() -> [return: bb1, unwind: bb31];
+ }
+
+ bb1: {
+ FakeRead(ForMatchedPlace(None), _2);
+ _3 = discriminant(_2);
+ switchInt(move _3) -> [0: bb2, otherwise: bb3];
+ }
+
+ bb2: {
+ falseEdge -> [real: bb4, imaginary: bb3];
+ }
+
+ bb3: {
+ goto -> bb19;
+ }
+
+ bb4: {
+ StorageLive(_4);
+ _4 = always_true() -> [return: bb5, unwind: bb31];
+ }
+
+ bb5: {
+ switchInt(move _4) -> [0: bb7, otherwise: bb6];
+ }
+
+ bb6: {
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = Droppy(const 0_u8);
+ _6 = (_7.0: u8);
+ _5 = Gt(move _6, const 0_u8);
+ switchInt(move _5) -> [0: bb9, otherwise: bb8];
+ }
+
+ bb7: {
+ goto -> bb13;
+ }
+
+ bb8: {
+ drop(_7) -> [return: bb10, unwind: bb31];
+ }
+
+ bb9: {
+ goto -> bb11;
+ }
+
+ bb10: {
+ StorageDead(_7);
+ StorageDead(_6);
+ goto -> bb16;
+ }
+
+ bb11: {
+ drop(_7) -> [return: bb12, unwind: bb31];
+ }
+
+ bb12: {
+ StorageDead(_7);
+ StorageDead(_6);
+ goto -> bb13;
+ }
+
+ bb13: {
+ StorageLive(_8);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = Droppy(const 1_u8);
+ _9 = (_10.0: u8);
+ _8 = Gt(move _9, const 1_u8);
+ switchInt(move _8) -> [0: bb15, otherwise: bb14];
+ }
+
+ bb14: {
+ drop(_10) -> [return: bb16, unwind: bb31];
+ }
+
+ bb15: {
+ goto -> bb17;
+ }
+
+ bb16: {
+ StorageDead(_10);
+ StorageDead(_9);
+ _1 = const ();
+ goto -> bb20;
+ }
+
+ bb17: {
+ drop(_10) -> [return: bb18, unwind: bb31];
+ }
+
+ bb18: {
+ StorageDead(_10);
+ StorageDead(_9);
+ goto -> bb19;
+ }
+
+ bb19: {
+ _1 = const ();
+ goto -> bb20;
+ }
+
+ bb20: {
+ StorageDead(_8);
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageDead(_1);
+ StorageLive(_11);
+ _11 = always_true() -> [return: bb21, unwind: bb31];
+ }
+
+ bb21: {
+ switchInt(move _11) -> [0: bb23, otherwise: bb22];
+ }
+
+ bb22: {
+ goto -> bb29;
+ }
+
+ bb23: {
+ goto -> bb24;
+ }
+
+ bb24: {
+ StorageLive(_12);
+ _12 = E::f() -> [return: bb25, unwind: bb31];
+ }
+
+ bb25: {
+ FakeRead(ForMatchedPlace(None), _12);
+ _13 = discriminant(_12);
+ switchInt(move _13) -> [1: bb27, otherwise: bb26];
+ }
+
+ bb26: {
+ goto -> bb29;
+ }
+
+ bb27: {
+ falseEdge -> [real: bb28, imaginary: bb26];
+ }
+
+ bb28: {
+ _0 = const ();
+ goto -> bb30;
+ }
+
+ bb29: {
+ _0 = const ();
+ goto -> bb30;
+ }
+
+ bb30: {
+ StorageDead(_11);
+ StorageDead(_12);
+ return;
+ }
+
+ bb31 (cleanup): {
+ resume;
+ }
+}
diff --git a/tests/mir-opt/building/logical_or_in_conditional.test_or.built.after.mir b/tests/mir-opt/building/logical_or_in_conditional.test_or.built.after.mir
new file mode 100644
index 000000000..b84c17c21
--- /dev/null
+++ b/tests/mir-opt/building/logical_or_in_conditional.test_or.built.after.mir
@@ -0,0 +1,87 @@
+// MIR for `test_or` after built
+
+fn test_or() -> () {
+ let mut _0: ();
+ let mut _1: bool;
+ let mut _2: u8;
+ let mut _3: Droppy;
+ let mut _4: bool;
+ let mut _5: u8;
+ let mut _6: Droppy;
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = Droppy(const 0_u8);
+ _2 = (_3.0: u8);
+ _1 = Gt(move _2, const 0_u8);
+ switchInt(move _1) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ drop(_3) -> [return: bb3, unwind: bb12];
+ }
+
+ bb2: {
+ goto -> bb4;
+ }
+
+ bb3: {
+ StorageDead(_3);
+ StorageDead(_2);
+ goto -> bb8;
+ }
+
+ bb4: {
+ drop(_3) -> [return: bb5, unwind: bb12];
+ }
+
+ bb5: {
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = Droppy(const 1_u8);
+ _5 = (_6.0: u8);
+ _4 = Gt(move _5, const 1_u8);
+ switchInt(move _4) -> [0: bb7, otherwise: bb6];
+ }
+
+ bb6: {
+ drop(_6) -> [return: bb8, unwind: bb12];
+ }
+
+ bb7: {
+ goto -> bb9;
+ }
+
+ bb8: {
+ StorageDead(_6);
+ StorageDead(_5);
+ _0 = const ();
+ goto -> bb11;
+ }
+
+ bb9: {
+ drop(_6) -> [return: bb10, unwind: bb12];
+ }
+
+ bb10: {
+ StorageDead(_6);
+ StorageDead(_5);
+ _0 = const ();
+ goto -> bb11;
+ }
+
+ bb11: {
+ StorageDead(_4);
+ StorageDead(_1);
+ return;
+ }
+
+ bb12 (cleanup): {
+ resume;
+ }
+}
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 bd4cd4eb6..9f64a23f3 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
@@ -51,7 +51,7 @@ fn full_tested_match() -> () {
bb5: {
StorageLive(_6);
_6 = &((_2 as Some).0: i32);
- _4 = &shallow _2;
+ _4 = &fake _2;
StorageLive(_7);
_7 = guard() -> [return: bb6, unwind: bb12];
}
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 595e3ab92..89f9bafb6 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
@@ -57,7 +57,7 @@ fn full_tested_match2() -> () {
bb5: {
StorageLive(_6);
_6 = &((_2 as Some).0: i32);
- _4 = &shallow _2;
+ _4 = &fake _2;
StorageLive(_7);
_7 = guard() -> [return: bb6, unwind: bb12];
}
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 91fe2f90e..9a2d89c48 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
@@ -78,7 +78,7 @@ fn main() -> () {
bb8: {
StorageLive(_7);
_7 = &((_2 as Some).0: i32);
- _5 = &shallow _2;
+ _5 = &fake _2;
StorageLive(_8);
_8 = guard() -> [return: bb9, unwind: bb20];
}
@@ -120,7 +120,7 @@ fn main() -> () {
bb14: {
StorageLive(_11);
_11 = &((_2 as Some).0: i32);
- _5 = &shallow _2;
+ _5 = &fake _2;
StorageLive(_12);
StorageLive(_13);
_13 = (*_11);
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 fea1138ba..82424de03 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
@@ -89,15 +89,15 @@ fn move_out_by_subslice() -> () {
}
bb9 (cleanup): {
- drop(_1) -> [return: bb12, unwind terminate];
+ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
}
bb10 (cleanup): {
- drop(_7) -> [return: bb11, unwind terminate];
+ drop(_7) -> [return: bb11, unwind terminate(cleanup)];
}
bb11 (cleanup): {
- drop(_2) -> [return: bb12, unwind terminate];
+ drop(_2) -> [return: bb12, unwind terminate(cleanup)];
}
bb12 (cleanup): {
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 3def40a85..0872d1b6a 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
@@ -89,15 +89,15 @@ fn move_out_from_end() -> () {
}
bb9 (cleanup): {
- drop(_1) -> [return: bb12, unwind terminate];
+ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
}
bb10 (cleanup): {
- drop(_7) -> [return: bb11, unwind terminate];
+ drop(_7) -> [return: bb11, unwind terminate(cleanup)];
}
bb11 (cleanup): {
- drop(_2) -> [return: bb12, unwind terminate];
+ drop(_2) -> [return: bb12, unwind terminate(cleanup)];
}
bb12 (cleanup): {
diff --git a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff b/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff
index 1a4372afe..f2b87221f 100644
--- a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff
+++ b/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff
@@ -63,7 +63,7 @@
}
bb4 (cleanup): {
- drop(_2) -> [return: bb5, unwind terminate];
+ drop(_2) -> [return: bb5, unwind terminate(cleanup)];
}
bb5 (cleanup): {
diff --git a/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff b/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff
index 255ec9481..ed47baa67 100644
--- a/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff
+++ b/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff
@@ -33,14 +33,22 @@
let _15: bool;
let _16: u32;
scope 6 {
- debug f => (bool, bool, u32){ .0 => _14, .1 => _15, .2 => _16, };
+- debug ((f: (bool, bool, u32)).0: bool) => _14;
+- debug ((f: (bool, bool, u32)).1: bool) => _15;
+- debug ((f: (bool, bool, u32)).2: u32) => _16;
++ debug ((f: (bool, bool, u32)).0: bool) => const true;
++ debug ((f: (bool, bool, u32)).1: bool) => const false;
++ debug ((f: (bool, bool, u32)).2: u32) => const 123_u32;
let _10: std::option::Option<u16>;
scope 7 {
debug o => _10;
let _17: u32;
let _18: u32;
scope 8 {
- debug p => Point{ .0 => _17, .1 => _18, };
+- debug ((p: Point).0: u32) => _17;
+- debug ((p: Point).1: u32) => _18;
++ debug ((p: Point).0: u32) => const 32_u32;
++ debug ((p: Point).1: u32) => const 32_u32;
let _11: u32;
scope 9 {
- debug a => _11;
diff --git a/tests/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff b/tests/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff
index d1dbc7089..1768298d5 100644
--- a/tests/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff
+++ b/tests/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff
@@ -43,31 +43,33 @@
}
bb3: {
-- StorageDead(_6);
- switchInt(move _5) -> [0: bb5, otherwise: bb4];
- }
-
- bb4: {
+- StorageDead(_6);
- _4 = const true;
- goto -> bb6;
- }
-
- bb5: {
+- StorageDead(_6);
- _4 = const false;
- goto -> bb6;
- }
-
- bb6: {
-- StorageDead(_5);
- switchInt(move _4) -> [0: bb8, otherwise: bb7];
- }
-
- bb7: {
+- StorageDead(_5);
- _3 = const true;
- goto -> bb9;
- }
-
- bb8: {
+- StorageDead(_5);
- _3 = const false;
- goto -> bb9;
- }
diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff
index 55c774d55..e443c8991 100644
--- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff
+++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff
@@ -34,11 +34,11 @@
StorageLive(_5);
StorageLive(_6);
_6 = const 3_usize;
- _7 = const 3_usize;
+ _7 = Len((*_1));
- _8 = Lt(_6, _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable];
-+ _8 = const false;
-+ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> [success: bb1, unwind unreachable];
++ _8 = Lt(const 3_usize, _7);
++ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> [success: bb1, unwind unreachable];
}
bb1: {
diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff
index dcab570ea..592f43f47 100644
--- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff
@@ -34,11 +34,11 @@
StorageLive(_5);
StorageLive(_6);
_6 = const 3_usize;
- _7 = const 3_usize;
+ _7 = Len((*_1));
- _8 = Lt(_6, _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue];
-+ _8 = const false;
-+ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> [success: bb1, unwind continue];
++ _8 = Lt(const 3_usize, _7);
++ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> [success: bb1, unwind continue];
}
bb1: {
diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff
index 55c774d55..e443c8991 100644
--- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff
+++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff
@@ -34,11 +34,11 @@
StorageLive(_5);
StorageLive(_6);
_6 = const 3_usize;
- _7 = const 3_usize;
+ _7 = Len((*_1));
- _8 = Lt(_6, _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable];
-+ _8 = const false;
-+ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> [success: bb1, unwind unreachable];
++ _8 = Lt(const 3_usize, _7);
++ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> [success: bb1, unwind unreachable];
}
bb1: {
diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff
index dcab570ea..592f43f47 100644
--- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff
@@ -34,11 +34,11 @@
StorageLive(_5);
StorageLive(_6);
_6 = const 3_usize;
- _7 = const 3_usize;
+ _7 = Len((*_1));
- _8 = Lt(_6, _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue];
-+ _8 = const false;
-+ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> [success: bb1, unwind continue];
++ _8 = Lt(const 3_usize, _7);
++ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> [success: bb1, unwind continue];
}
bb1: {
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 7931c4f02..d6b1a93f3 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,8 +1,7 @@
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// compile-flags: -Zmir-enable-passes=+NormalizeArrayLen
-
// EMIT_MIR_FOR_EACH_BIT_WIDTH
+
// EMIT_MIR bad_op_unsafe_oob_for_slices.main.ConstProp.diff
#[allow(unconditional_panic)]
fn main() {
diff --git a/tests/mir-opt/const_prop/boxes.rs b/tests/mir-opt/const_prop/boxes.rs
index 9407759cb..78599174b 100644
--- a/tests/mir-opt/const_prop/boxes.rs
+++ b/tests/mir-opt/const_prop/boxes.rs
@@ -1,8 +1,6 @@
// unit-test: ConstProp
// compile-flags: -O
-// ignore-emscripten compiled with panic=abort by default
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// ignore-wasm64
#![feature(rustc_attrs, stmt_expr_attributes)]
diff --git a/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff
index 6daef87dd..c2fd7f65f 100644
--- a/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff
@@ -24,5 +24,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc3 (size: 8, align: 4) {
++ 02 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff
index 125407bf2..21a31f9ab 100644
--- a/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff
@@ -24,5 +24,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc3 (size: 8, align: 4) {
++ 02 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff
index ca0ce2888..c0efc8730 100644
--- a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff
@@ -29,5 +29,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc3 (size: 2, align: 1) {
++ 03 00 │ ..
}
diff --git a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff
index d63fb9255..2aee6f164 100644
--- a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff
@@ -29,5 +29,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc3 (size: 2, align: 1) {
++ 03 00 │ ..
}
diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff
index 51e17cf69..7ba51ccdb 100644
--- a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff
@@ -35,5 +35,9 @@
_0 = const ();
return;
}
++ }
++
++ alloc3 (size: 2, align: 1) {
++ 00 01 │ ..
}
diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff
index 5ef201497..545b7f22f 100644
--- a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff
@@ -35,5 +35,9 @@
_0 = const ();
return;
}
++ }
++
++ alloc3 (size: 2, align: 1) {
++ 00 01 │ ..
}
diff --git a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff
index 170c01978..18341ba7d 100644
--- a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff
@@ -18,5 +18,13 @@
StorageDead(_2);
return;
}
++ }
++
++ alloc8 (size: 2, align: 1) {
++ 00 00 │ ..
++ }
++
++ alloc7 (size: 2, align: 1) {
++ 00 00 │ ..
}
diff --git a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff
index 64227dfd7..50763c10f 100644
--- a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff
@@ -18,5 +18,13 @@
StorageDead(_2);
return;
}
++ }
++
++ alloc8 (size: 2, align: 1) {
++ 00 00 │ ..
++ }
++
++ alloc7 (size: 2, align: 1) {
++ 00 00 │ ..
}
diff --git a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff
index e1f3f37b3..015180db8 100644
--- a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff
@@ -23,5 +23,17 @@
StorageDead(_2);
return;
}
++ }
++
++ alloc12 (size: 2, align: 1) {
++ 01 02 │ ..
++ }
++
++ alloc11 (size: 2, align: 1) {
++ 01 02 │ ..
++ }
++
++ alloc8 (size: 2, align: 1) {
++ 01 02 │ ..
}
diff --git a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff
index aaa376a95..8e41705c1 100644
--- a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff
@@ -23,5 +23,17 @@
StorageDead(_2);
return;
}
++ }
++
++ alloc12 (size: 2, align: 1) {
++ 01 02 │ ..
++ }
++
++ alloc11 (size: 2, align: 1) {
++ 01 02 │ ..
++ }
++
++ alloc8 (size: 2, align: 1) {
++ 01 02 │ ..
}
diff --git a/tests/mir-opt/const_prop/large_array_index.rs b/tests/mir-opt/const_prop/large_array_index.rs
index 6c03fe9d9..d226bd546 100644
--- a/tests/mir-opt/const_prop/large_array_index.rs
+++ b/tests/mir-opt/const_prop/large_array_index.rs
@@ -1,6 +1,5 @@
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// compile-flags: -Zmir-enable-passes=+NormalizeArrayLen
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR large_array_index.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff
index 0f118c7f5..56a127ae3 100644
--- a/tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff
@@ -25,5 +25,13 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc7 (size: 8, align: 4) {
++ 2a 00 00 00 63 00 00 00 │ *...c...
++ }
++
++ alloc5 (size: 8, align: 4) {
++ 2a 00 00 00 2b 00 00 00 │ *...+...
}
diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff
index a85dcf9c7..a1b433716 100644
--- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff
@@ -46,5 +46,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc7 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
}
diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff
index 15ef0fa4d..2dc514194 100644
--- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff
@@ -46,5 +46,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc7 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
}
diff --git a/tests/mir-opt/const_prop/repeat.rs b/tests/mir-opt/const_prop/repeat.rs
index 21dba84af..fb8b825ee 100644
--- a/tests/mir-opt/const_prop/repeat.rs
+++ b/tests/mir-opt/const_prop/repeat.rs
@@ -1,6 +1,5 @@
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// compile-flags: -Zmir-enable-passes=+NormalizeArrayLen
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR repeat.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff
index f3b30e0dc..6c9de4764 100644
--- a/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff
@@ -17,5 +17,9 @@
+ _0 = const 4_u32;
return;
}
++ }
++
++ alloc5 (size: 8, align: 4) {
++ 04 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff
index 79f85fcef..0f079278c 100644
--- a/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff
@@ -17,5 +17,9 @@
+ _0 = const 4_u32;
return;
}
++ }
++
++ alloc5 (size: 8, align: 4) {
++ 04 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir
index c8f3f641a..c2488f394 100644
--- a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir
+++ b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir
@@ -14,3 +14,7 @@ fn add() -> u32 {
return;
}
}
+
+alloc5 (size: 8, align: 4) {
+ 04 00 00 00 00 __ __ __ │ .....░░░
+}
diff --git a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir
index 9a0646974..fa0b9c77e 100644
--- a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir
+++ b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir
@@ -14,3 +14,7 @@ fn add() -> u32 {
return;
}
}
+
+alloc5 (size: 8, align: 4) {
+ 04 00 00 00 00 __ __ __ │ .....░░░
+}
diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff
index 9e705695a..988ef7dd2 100644
--- a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff
@@ -29,5 +29,17 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc9 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
++ }
++
++ alloc8 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
++ }
++
++ alloc6 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
}
diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff
index 882dd97cc..298446197 100644
--- a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff
@@ -29,5 +29,17 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc9 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
++ }
++
++ alloc8 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
++ }
++
++ alloc6 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
}
diff --git a/tests/mir-opt/coverage_graphviz.bar.InstrumentCoverage.0.dot b/tests/mir-opt/coverage_graphviz.bar.InstrumentCoverage.0.dot
deleted file mode 100644
index 3b90aaeae..000000000
--- a/tests/mir-opt/coverage_graphviz.bar.InstrumentCoverage.0.dot
+++ /dev/null
@@ -1,6 +0,0 @@
-digraph Cov_0_4 {
- graph [fontname="Courier, monospace"];
- node [fontname="Courier, monospace"];
- edge [fontname="Courier, monospace"];
- bcb0__Cov_0_4 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb0</td></tr><tr><td align="left" balign="left"></td></tr><tr><td align="left" balign="left">Counter(bcb0) at 18:1-20:2<br align="left"/> 19:5-19:9: @0[0]: Coverage::Counter(0) for $DIR/coverage_graphviz.rs:18:1 - 20:2<br align="left"/> 20:2-20:2: @0.Return: return</td></tr><tr><td align="left" balign="left">bb0: Return</td></tr></table>>];
-}
diff --git a/tests/mir-opt/coverage_graphviz.main.InstrumentCoverage.0.dot b/tests/mir-opt/coverage_graphviz.main.InstrumentCoverage.0.dot
deleted file mode 100644
index 19c220e2e..000000000
--- a/tests/mir-opt/coverage_graphviz.main.InstrumentCoverage.0.dot
+++ /dev/null
@@ -1,13 +0,0 @@
-digraph Cov_0_3 {
- graph [fontname="Courier, monospace"];
- node [fontname="Courier, monospace"];
- edge [fontname="Courier, monospace"];
- bcb3__Cov_0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb3</td></tr><tr><td align="left" balign="left">Counter(bcb3) at 13:10-13:10<br align="left"/> 13:10-13:10: @5[0]: Coverage::Counter(1) for $DIR/coverage_graphviz.rs:13:10 - 13:11</td></tr><tr><td align="left" balign="left">bb5: Goto</td></tr></table>>];
- bcb2__Cov_0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb2</td></tr><tr><td align="left" balign="left">Expression(bcb1:(bcb0 + bcb3) - bcb3) at 12:13-12:18<br align="left"/> 12:13-12:18: @4[0]: Coverage::Expression(2) = Expression(1) + Zero for $DIR/coverage_graphviz.rs:15:1 - 15:2<br align="left"/>Expression(bcb2:(bcb1:(bcb0 + bcb3) - bcb3) + 0) at 15:2-15:2<br align="left"/> 15:2-15:2: @4.Return: return</td></tr><tr><td align="left" balign="left">bb4: Return</td></tr></table>>];
- bcb1__Cov_0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb1</td></tr><tr><td align="left" balign="left">Expression(bcb0 + bcb3) at 10:5-11:17<br align="left"/> 11:12-11:17: @2.Call: _2 = bar() -&gt; [return: bb3, unwind: bb6]</td></tr><tr><td align="left" balign="left">bb1: FalseUnwind<br align="left"/>bb2: Call</td></tr><tr><td align="left" balign="left">bb3: SwitchInt</td></tr></table>>];
- bcb0__Cov_0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb0</td></tr><tr><td align="left" balign="left"></td></tr><tr><td align="left" balign="left">Counter(bcb0) at 9:1-9:11<br align="left"/> </td></tr><tr><td align="left" balign="left">bb0: Goto</td></tr></table>>];
- bcb3__Cov_0_3 -> bcb1__Cov_0_3 [label=<>];
- bcb1__Cov_0_3 -> bcb3__Cov_0_3 [label=<0>];
- bcb1__Cov_0_3 -> bcb2__Cov_0_3 [label=<otherwise>];
- bcb0__Cov_0_3 -> bcb1__Cov_0_3 [label=<>];
-}
diff --git a/tests/mir-opt/coverage_graphviz.rs b/tests/mir-opt/coverage_graphviz.rs
deleted file mode 100644
index 09403bb3a..000000000
--- a/tests/mir-opt/coverage_graphviz.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Test that `-C instrument-coverage` with `-Z dump-mir-graphviz` generates a graphviz (.dot file)
-// rendering of the `BasicCoverageBlock` coverage control flow graph, with counters and
-// expressions.
-
-// needs-profiler-support
-// compile-flags: -C instrument-coverage -Z dump-mir-graphviz
-// EMIT_MIR coverage_graphviz.main.InstrumentCoverage.0.dot
-// EMIT_MIR coverage_graphviz.bar.InstrumentCoverage.0.dot
-fn main() {
- loop {
- if bar() {
- break;
- }
- }
-}
-
-#[inline(never)]
-fn bar() -> bool {
- true
-}
diff --git a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-abort.diff
new file mode 100644
index 000000000..212ddc5b1
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-abort.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: [u32; 4];
+ let _3: usize;
+ let mut _4: usize;
+ let mut _5: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32];
+ StorageLive(_3);
+ _3 = const 2_usize;
+- _4 = Len(_2);
+- _5 = Lt(_3, _4);
+- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable];
++ _4 = const 4_usize;
++ _5 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _1 = _2[_3];
++ _1 = _2[2 of 3];
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-unwind.diff
new file mode 100644
index 000000000..5c53d4f44
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-unwind.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: [u32; 4];
+ let _3: usize;
+ let mut _4: usize;
+ let mut _5: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32];
+ StorageLive(_3);
+ _3 = const 2_usize;
+- _4 = Len(_2);
+- _5 = Lt(_3, _4);
+- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue];
++ _4 = const 4_usize;
++ _5 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _1 = _2[_3];
++ _1 = _2[2 of 3];
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-abort.diff
new file mode 100644
index 000000000..212ddc5b1
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-abort.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: [u32; 4];
+ let _3: usize;
+ let mut _4: usize;
+ let mut _5: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32];
+ StorageLive(_3);
+ _3 = const 2_usize;
+- _4 = Len(_2);
+- _5 = Lt(_3, _4);
+- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable];
++ _4 = const 4_usize;
++ _5 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _1 = _2[_3];
++ _1 = _2[2 of 3];
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-unwind.diff
new file mode 100644
index 000000000..5c53d4f44
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-unwind.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: [u32; 4];
+ let _3: usize;
+ let mut _4: usize;
+ let mut _5: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32];
+ StorageLive(_3);
+ _3 = const 2_usize;
+- _4 = Len(_2);
+- _5 = Lt(_3, _4);
+- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue];
++ _4 = const 4_usize;
++ _5 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _1 = _2[_3];
++ _1 = _2[2 of 3];
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/array_index.rs b/tests/mir-opt/dataflow-const-prop/array_index.rs
new file mode 100644
index 000000000..ddb3646ca
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/array_index.rs
@@ -0,0 +1,8 @@
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// unit-test: DataflowConstProp
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+
+// EMIT_MIR array_index.main.DataflowConstProp.diff
+fn main() {
+ let x: u32 = [0, 1, 2, 3][2];
+}
diff --git a/tests/mir-opt/dataflow-const-prop/boolean_identities.rs b/tests/mir-opt/dataflow-const-prop/boolean_identities.rs
new file mode 100644
index 000000000..9e911e85b
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/boolean_identities.rs
@@ -0,0 +1,10 @@
+// unit-test: DataflowConstProp
+
+// EMIT_MIR boolean_identities.test.DataflowConstProp.diff
+pub fn test(x: bool, y: bool) -> bool {
+ (y | true) & (x & false)
+}
+
+fn main() {
+ test(true, false);
+}
diff --git a/tests/mir-opt/dataflow-const-prop/boolean_identities.test.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/boolean_identities.test.DataflowConstProp.diff
new file mode 100644
index 000000000..5440c38ce
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/boolean_identities.test.DataflowConstProp.diff
@@ -0,0 +1,33 @@
+- // MIR for `test` before DataflowConstProp
++ // MIR for `test` after DataflowConstProp
+
+ fn test(_1: bool, _2: bool) -> bool {
+ debug x => _1;
+ debug y => _2;
+ let mut _0: bool;
+ let mut _3: bool;
+ let mut _4: bool;
+ let mut _5: bool;
+ let mut _6: bool;
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _2;
+- _3 = BitOr(move _4, const true);
++ _3 = const true;
+ StorageDead(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = _1;
+- _5 = BitAnd(move _6, const false);
++ _5 = const false;
+ StorageDead(_6);
+- _0 = BitAnd(move _3, move _5);
++ _0 = const false;
+ StorageDead(_5);
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-abort.diff
new file mode 100644
index 000000000..b9b46f16a
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-abort.diff
@@ -0,0 +1,119 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: A;
+ let mut _2: std::boxed::Box<[bool]>;
+ scope 1 {
+ debug a => _1;
+ }
+ scope 2 (inlined <Box<[bool]> as Default>::default) {
+ let _3: std::ptr::Unique<[bool]>;
+ let mut _4: std::ptr::Unique<[bool; 0]>;
+ scope 3 {
+ debug ptr => _3;
+ }
+ scope 4 (inlined Unique::<[bool; 0]>::dangling) {
+ let mut _5: std::ptr::NonNull<[bool; 0]>;
+ scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
+ let mut _7: usize;
+ scope 6 {
+ let _6: *mut [bool; 0];
+ scope 7 {
+ debug ptr => _6;
+ scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) {
+ debug ptr => _6;
+ let mut _8: *const [bool; 0];
+ scope 12 {
+ scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
+ debug ptr => _6;
+ scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
+ debug self => _9;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 8 (inlined align_of::<[bool; 0]>) {
+ }
+ scope 9 (inlined invalid_mut::<[bool; 0]>) {
+ debug addr => _7;
+ scope 10 {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+- _7 = AlignOf([bool; 0]);
+- _6 = _7 as *mut [bool; 0] (Transmute);
++ _7 = const 1_usize;
++ _6 = const {0x1 as *mut [bool; 0]};
+ StorageDead(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+- _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer));
+- _5 = NonNull::<[bool; 0]> { pointer: _8 };
++ _8 = const {0x1 as *const [bool; 0]};
++ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_6);
+- _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
++ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
+ StorageDead(_5);
+- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
++ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+- _2 = Box::<[bool]>(_3, const std::alloc::Global);
++ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+- _1 = A { foo: move _2 };
++ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ alloc11 (size: 8, align: 4) {
++ 01 00 00 00 00 00 00 00 │ ........
++ }
++
++ alloc10 (size: 8, align: 4) {
++ 01 00 00 00 00 00 00 00 │ ........
++ }
++
++ alloc7 (size: 8, align: 4) {
++ 01 00 00 00 00 00 00 00 │ ........
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-unwind.diff
new file mode 100644
index 000000000..93b18f23e
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-unwind.diff
@@ -0,0 +1,123 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: A;
+ let mut _2: std::boxed::Box<[bool]>;
+ scope 1 {
+ debug a => _1;
+ }
+ scope 2 (inlined <Box<[bool]> as Default>::default) {
+ let _3: std::ptr::Unique<[bool]>;
+ let mut _4: std::ptr::Unique<[bool; 0]>;
+ scope 3 {
+ debug ptr => _3;
+ }
+ scope 4 (inlined Unique::<[bool; 0]>::dangling) {
+ let mut _5: std::ptr::NonNull<[bool; 0]>;
+ scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
+ let mut _7: usize;
+ scope 6 {
+ let _6: *mut [bool; 0];
+ scope 7 {
+ debug ptr => _6;
+ scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) {
+ debug ptr => _6;
+ let mut _8: *const [bool; 0];
+ scope 12 {
+ scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
+ debug ptr => _6;
+ scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
+ debug self => _9;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 8 (inlined align_of::<[bool; 0]>) {
+ }
+ scope 9 (inlined invalid_mut::<[bool; 0]>) {
+ debug addr => _7;
+ scope 10 {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+- _7 = AlignOf([bool; 0]);
+- _6 = _7 as *mut [bool; 0] (Transmute);
++ _7 = const 1_usize;
++ _6 = const {0x1 as *mut [bool; 0]};
+ StorageDead(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+- _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer));
+- _5 = NonNull::<[bool; 0]> { pointer: _8 };
++ _8 = const {0x1 as *const [bool; 0]};
++ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_6);
+- _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
++ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
+ StorageDead(_5);
+- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
++ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+- _2 = Box::<[bool]>(_3, const std::alloc::Global);
++ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+- _1 = A { foo: move _2 };
++ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind: bb2];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
+
+ bb2 (cleanup): {
+ resume;
+ }
++ }
++
++ alloc11 (size: 8, align: 4) {
++ 01 00 00 00 00 00 00 00 │ ........
++ }
++
++ alloc10 (size: 8, align: 4) {
++ 01 00 00 00 00 00 00 00 │ ........
++ }
++
++ alloc7 (size: 8, align: 4) {
++ 01 00 00 00 00 00 00 00 │ ........
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-abort.diff
new file mode 100644
index 000000000..3d3af6285
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-abort.diff
@@ -0,0 +1,119 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: A;
+ let mut _2: std::boxed::Box<[bool]>;
+ scope 1 {
+ debug a => _1;
+ }
+ scope 2 (inlined <Box<[bool]> as Default>::default) {
+ let _3: std::ptr::Unique<[bool]>;
+ let mut _4: std::ptr::Unique<[bool; 0]>;
+ scope 3 {
+ debug ptr => _3;
+ }
+ scope 4 (inlined Unique::<[bool; 0]>::dangling) {
+ let mut _5: std::ptr::NonNull<[bool; 0]>;
+ scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
+ let mut _7: usize;
+ scope 6 {
+ let _6: *mut [bool; 0];
+ scope 7 {
+ debug ptr => _6;
+ scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) {
+ debug ptr => _6;
+ let mut _8: *const [bool; 0];
+ scope 12 {
+ scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
+ debug ptr => _6;
+ scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
+ debug self => _9;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 8 (inlined align_of::<[bool; 0]>) {
+ }
+ scope 9 (inlined invalid_mut::<[bool; 0]>) {
+ debug addr => _7;
+ scope 10 {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+- _7 = AlignOf([bool; 0]);
+- _6 = _7 as *mut [bool; 0] (Transmute);
++ _7 = const 1_usize;
++ _6 = const {0x1 as *mut [bool; 0]};
+ StorageDead(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+- _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer));
+- _5 = NonNull::<[bool; 0]> { pointer: _8 };
++ _8 = const {0x1 as *const [bool; 0]};
++ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_6);
+- _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
++ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
+ StorageDead(_5);
+- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
++ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+- _2 = Box::<[bool]>(_3, const std::alloc::Global);
++ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+- _1 = A { foo: move _2 };
++ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ alloc11 (size: 16, align: 8) {
++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
++ }
++
++ alloc10 (size: 16, align: 8) {
++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
++ }
++
++ alloc7 (size: 16, align: 8) {
++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-unwind.diff
new file mode 100644
index 000000000..1933f9baf
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-unwind.diff
@@ -0,0 +1,123 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: A;
+ let mut _2: std::boxed::Box<[bool]>;
+ scope 1 {
+ debug a => _1;
+ }
+ scope 2 (inlined <Box<[bool]> as Default>::default) {
+ let _3: std::ptr::Unique<[bool]>;
+ let mut _4: std::ptr::Unique<[bool; 0]>;
+ scope 3 {
+ debug ptr => _3;
+ }
+ scope 4 (inlined Unique::<[bool; 0]>::dangling) {
+ let mut _5: std::ptr::NonNull<[bool; 0]>;
+ scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
+ let mut _7: usize;
+ scope 6 {
+ let _6: *mut [bool; 0];
+ scope 7 {
+ debug ptr => _6;
+ scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) {
+ debug ptr => _6;
+ let mut _8: *const [bool; 0];
+ scope 12 {
+ scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
+ debug ptr => _6;
+ scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
+ debug self => _9;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 8 (inlined align_of::<[bool; 0]>) {
+ }
+ scope 9 (inlined invalid_mut::<[bool; 0]>) {
+ debug addr => _7;
+ scope 10 {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+- _7 = AlignOf([bool; 0]);
+- _6 = _7 as *mut [bool; 0] (Transmute);
++ _7 = const 1_usize;
++ _6 = const {0x1 as *mut [bool; 0]};
+ StorageDead(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+- _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer));
+- _5 = NonNull::<[bool; 0]> { pointer: _8 };
++ _8 = const {0x1 as *const [bool; 0]};
++ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_6);
+- _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
++ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
+ StorageDead(_5);
+- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
++ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+- _2 = Box::<[bool]>(_3, const std::alloc::Global);
++ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+- _1 = A { foo: move _2 };
++ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind: bb2];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
+
+ bb2 (cleanup): {
+ resume;
+ }
++ }
++
++ alloc11 (size: 16, align: 8) {
++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
++ }
++
++ alloc10 (size: 16, align: 8) {
++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
++ }
++
++ alloc7 (size: 16, align: 8) {
++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff
new file mode 100644
index 000000000..7862c23da
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff
@@ -0,0 +1,111 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: A;
+ let mut _2: std::boxed::Box<[bool]>;
+ scope 1 {
+ debug a => _1;
+ }
+ scope 2 (inlined <Box<[bool]> as Default>::default) {
+ let _3: std::ptr::Unique<[bool]>;
+ let mut _4: std::ptr::Unique<[bool; 0]>;
+ scope 3 {
+ debug ptr => _3;
+ }
+ scope 4 (inlined Unique::<[bool; 0]>::dangling) {
+ let mut _5: std::ptr::NonNull<[bool; 0]>;
+ scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
+ let mut _7: usize;
+ scope 6 {
+ let _6: *mut [bool; 0];
+ scope 7 {
+ debug ptr => _6;
+ scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) {
+ debug ptr => _6;
+ let mut _8: *const [bool; 0];
+ scope 12 {
+ scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
+ debug ptr => _6;
+ scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
+ debug self => _9;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 8 (inlined align_of::<[bool; 0]>) {
+ }
+ scope 9 (inlined invalid_mut::<[bool; 0]>) {
+ debug addr => _7;
+ scope 10 {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = const 1_usize;
+ _6 = const {0x1 as *mut [bool; 0]};
+ StorageDead(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+ _8 = const {0x1 as *const [bool; 0]};
+ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_6);
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
+ StorageDead(_5);
+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
+ }
+
+ alloc11 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
+ alloc10 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
+ alloc7 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff
new file mode 100644
index 000000000..bd4150ebb
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff
@@ -0,0 +1,115 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: A;
+ let mut _2: std::boxed::Box<[bool]>;
+ scope 1 {
+ debug a => _1;
+ }
+ scope 2 (inlined <Box<[bool]> as Default>::default) {
+ let _3: std::ptr::Unique<[bool]>;
+ let mut _4: std::ptr::Unique<[bool; 0]>;
+ scope 3 {
+ debug ptr => _3;
+ }
+ scope 4 (inlined Unique::<[bool; 0]>::dangling) {
+ let mut _5: std::ptr::NonNull<[bool; 0]>;
+ scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
+ let mut _7: usize;
+ scope 6 {
+ let _6: *mut [bool; 0];
+ scope 7 {
+ debug ptr => _6;
+ scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) {
+ debug ptr => _6;
+ let mut _8: *const [bool; 0];
+ scope 12 {
+ scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
+ debug ptr => _6;
+ scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
+ debug self => _9;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 8 (inlined align_of::<[bool; 0]>) {
+ }
+ scope 9 (inlined invalid_mut::<[bool; 0]>) {
+ debug addr => _7;
+ scope 10 {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = const 1_usize;
+ _6 = const {0x1 as *mut [bool; 0]};
+ StorageDead(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+ _8 = const {0x1 as *const [bool; 0]};
+ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_6);
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
+ StorageDead(_5);
+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind: bb2];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
+
+ bb2 (cleanup): {
+ resume;
+ }
+ }
+
+ alloc11 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
+ alloc10 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
+ alloc7 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff
new file mode 100644
index 000000000..312fc7b7a
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff
@@ -0,0 +1,111 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: A;
+ let mut _2: std::boxed::Box<[bool]>;
+ scope 1 {
+ debug a => _1;
+ }
+ scope 2 (inlined <Box<[bool]> as Default>::default) {
+ let _3: std::ptr::Unique<[bool]>;
+ let mut _4: std::ptr::Unique<[bool; 0]>;
+ scope 3 {
+ debug ptr => _3;
+ }
+ scope 4 (inlined Unique::<[bool; 0]>::dangling) {
+ let mut _5: std::ptr::NonNull<[bool; 0]>;
+ scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
+ let mut _7: usize;
+ scope 6 {
+ let _6: *mut [bool; 0];
+ scope 7 {
+ debug ptr => _6;
+ scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) {
+ debug ptr => _6;
+ let mut _8: *const [bool; 0];
+ scope 12 {
+ scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
+ debug ptr => _6;
+ scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
+ debug self => _9;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 8 (inlined align_of::<[bool; 0]>) {
+ }
+ scope 9 (inlined invalid_mut::<[bool; 0]>) {
+ debug addr => _7;
+ scope 10 {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = const 1_usize;
+ _6 = const {0x1 as *mut [bool; 0]};
+ StorageDead(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+ _8 = const {0x1 as *const [bool; 0]};
+ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_6);
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
+ StorageDead(_5);
+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
+ }
+
+ alloc11 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
+ alloc10 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
+ alloc7 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff
new file mode 100644
index 000000000..3227d8b84
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff
@@ -0,0 +1,115 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: A;
+ let mut _2: std::boxed::Box<[bool]>;
+ scope 1 {
+ debug a => _1;
+ }
+ scope 2 (inlined <Box<[bool]> as Default>::default) {
+ let _3: std::ptr::Unique<[bool]>;
+ let mut _4: std::ptr::Unique<[bool; 0]>;
+ scope 3 {
+ debug ptr => _3;
+ }
+ scope 4 (inlined Unique::<[bool; 0]>::dangling) {
+ let mut _5: std::ptr::NonNull<[bool; 0]>;
+ scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
+ let mut _7: usize;
+ scope 6 {
+ let _6: *mut [bool; 0];
+ scope 7 {
+ debug ptr => _6;
+ scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) {
+ debug ptr => _6;
+ let mut _8: *const [bool; 0];
+ scope 12 {
+ scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
+ debug ptr => _6;
+ scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
+ debug self => _9;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 8 (inlined align_of::<[bool; 0]>) {
+ }
+ scope 9 (inlined invalid_mut::<[bool; 0]>) {
+ debug addr => _7;
+ scope 10 {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = const 1_usize;
+ _6 = const {0x1 as *mut [bool; 0]};
+ StorageDead(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+ _8 = const {0x1 as *const [bool; 0]};
+ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_6);
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
+ StorageDead(_5);
+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind: bb2];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
+
+ bb2 (cleanup): {
+ resume;
+ }
+ }
+
+ alloc11 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
+ alloc10 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
+ alloc7 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs
new file mode 100644
index 000000000..dfeccd3eb
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs
@@ -0,0 +1,17 @@
+// unit-test: DataflowConstProp
+// compile-flags: -Zmir-enable-passes=+ConstProp,+Inline
+// ignore-debug assertions change the output MIR
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
+struct A {
+ foo: Box<[bool]>,
+}
+
+// EMIT_MIR default_boxed_slice.main.ConstProp.diff
+// EMIT_MIR default_boxed_slice.main.DataflowConstProp.diff
+fn main() {
+ // ConstProp will create a constant of type `Box<[bool]>`.
+ // Verify that `DataflowConstProp` does not ICE trying to dereference it directly.
+ let a: A = A { foo: Box::default() };
+}
diff --git a/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..07ac5b72e
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.32bit.diff
@@ -0,0 +1,63 @@
+- // MIR for `constant` before DataflowConstProp
++ // MIR for `constant` after DataflowConstProp
+
+ fn constant() -> () {
+ let mut _0: ();
+ let _1: E;
+ let mut _3: isize;
+ scope 1 {
+ debug e => _1;
+ let _2: i32;
+ let _4: i32;
+ let _5: i32;
+ scope 2 {
+ debug x => _2;
+ }
+ scope 3 {
+ debug x => _4;
+ }
+ scope 4 {
+ debug x => _5;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const _;
+ StorageLive(_2);
+- _3 = discriminant(_1);
+- switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2];
++ _3 = const 0_isize;
++ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_5);
+ _5 = ((_1 as V2).0: i32);
+ _2 = _5;
+ StorageDead(_5);
+ goto -> bb4;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ StorageLive(_4);
+- _4 = ((_1 as V1).0: i32);
+- _2 = _4;
++ _4 = const 0_i32;
++ _2 = const 0_i32;
+ StorageDead(_4);
+ goto -> bb4;
+ }
+
+ bb4: {
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..07ac5b72e
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.64bit.diff
@@ -0,0 +1,63 @@
+- // MIR for `constant` before DataflowConstProp
++ // MIR for `constant` after DataflowConstProp
+
+ fn constant() -> () {
+ let mut _0: ();
+ let _1: E;
+ let mut _3: isize;
+ scope 1 {
+ debug e => _1;
+ let _2: i32;
+ let _4: i32;
+ let _5: i32;
+ scope 2 {
+ debug x => _2;
+ }
+ scope 3 {
+ debug x => _4;
+ }
+ scope 4 {
+ debug x => _5;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const _;
+ StorageLive(_2);
+- _3 = discriminant(_1);
+- switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2];
++ _3 = const 0_isize;
++ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_5);
+ _5 = ((_1 as V2).0: i32);
+ _2 = _5;
+ StorageDead(_5);
+ goto -> bb4;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ StorageLive(_4);
+- _4 = ((_1 as V1).0: i32);
+- _2 = _4;
++ _4 = const 0_i32;
++ _2 = const 0_i32;
+ StorageDead(_4);
+ goto -> bb4;
+ }
+
+ bb4: {
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.32bit.diff
index 775325c4d..775325c4d 100644
--- a/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.diff
+++ b/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.32bit.diff
diff --git a/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..775325c4d
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.64bit.diff
@@ -0,0 +1,82 @@
+- // MIR for `multiple` before DataflowConstProp
++ // MIR for `multiple` after DataflowConstProp
+
+ fn multiple(_1: bool, _2: u8) -> () {
+ debug x => _1;
+ debug i => _2;
+ let mut _0: ();
+ let _3: std::option::Option<u8>;
+ let mut _4: bool;
+ let mut _5: u8;
+ let mut _7: isize;
+ scope 1 {
+ debug e => _3;
+ let _6: u8;
+ let _8: u8;
+ scope 2 {
+ debug x => _6;
+ let _9: u8;
+ scope 4 {
+ debug y => _9;
+ }
+ }
+ scope 3 {
+ debug i => _8;
+ }
+ }
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ switchInt(move _4) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ StorageLive(_5);
+ _5 = _2;
+ _3 = Option::<u8>::Some(move _5);
+ StorageDead(_5);
+ goto -> bb3;
+ }
+
+ bb2: {
+ _3 = Option::<u8>::None;
+ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_4);
+ StorageLive(_6);
+ _7 = discriminant(_3);
+ switchInt(move _7) -> [0: bb4, 1: bb6, otherwise: bb5];
+ }
+
+ bb4: {
+ _6 = const 0_u8;
+ goto -> bb7;
+ }
+
+ bb5: {
+ unreachable;
+ }
+
+ bb6: {
+ StorageLive(_8);
+ _8 = ((_3 as Some).0: u8);
+ _6 = _8;
+ StorageDead(_8);
+ goto -> bb7;
+ }
+
+ bb7: {
+ StorageLive(_9);
+ _9 = _6;
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_6);
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.32bit.diff
index 960e69ee9..960e69ee9 100644
--- a/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.diff
+++ b/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.32bit.diff
diff --git a/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..960e69ee9
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.64bit.diff
@@ -0,0 +1,26 @@
+- // MIR for `mutate_discriminant` before DataflowConstProp
++ // MIR for `mutate_discriminant` after DataflowConstProp
+
+ fn mutate_discriminant() -> u8 {
+ let mut _0: u8;
+ let mut _1: std::option::Option<NonZeroUsize>;
+ let mut _2: isize;
+
+ bb0: {
+ discriminant(_1) = 1;
+ (((_1 as variant#1).0: NonZeroUsize).0: usize) = const 0_usize;
+ _2 = discriminant(_1);
+ switchInt(_2) -> [0: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ _0 = const 1_u8;
+ return;
+ }
+
+ bb2: {
+ _0 = const 2_u8;
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/enum.rs b/tests/mir-opt/dataflow-const-prop/enum.rs
index 79a20d7ef..5a10e9e88 100644
--- a/tests/mir-opt/dataflow-const-prop/enum.rs
+++ b/tests/mir-opt/dataflow-const-prop/enum.rs
@@ -1,9 +1,11 @@
// unit-test: DataflowConstProp
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
#![feature(custom_mir, core_intrinsics, rustc_attrs)]
use std::intrinsics::mir::*;
+#[derive(Copy, Clone)]
enum E {
V1(i32),
V2(i32)
@@ -15,6 +17,24 @@ fn simple() {
let x = match e { E::V1(x) => x, E::V2(x) => x };
}
+// EMIT_MIR enum.constant.DataflowConstProp.diff
+fn constant() {
+ const C: E = E::V1(0);
+ let e = C;
+ let x = match e { E::V1(x) => x, E::V2(x) => x };
+}
+
+// EMIT_MIR enum.statics.DataflowConstProp.diff
+fn statics() {
+ static C: E = E::V1(0);
+ let e = C;
+ let x = match e { E::V1(x) => x, E::V2(x) => x };
+
+ static RC: &E = &E::V2(4);
+ let e = RC;
+ let x = match e { E::V1(x) => x, E::V2(x) => x };
+}
+
#[rustc_layout_scalar_valid_range_start(1)]
#[rustc_nonnull_optimization_guaranteed]
struct NonZeroUsize(usize);
@@ -63,6 +83,8 @@ fn multiple(x: bool, i: u8) {
fn main() {
simple();
+ constant();
+ statics();
mutate_discriminant();
multiple(false, 5);
}
diff --git a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff
index 3946e7c7d..3946e7c7d 100644
--- a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.diff
+++ b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff
diff --git a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..3946e7c7d
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff
@@ -0,0 +1,63 @@
+- // MIR for `simple` before DataflowConstProp
++ // MIR for `simple` after DataflowConstProp
+
+ fn simple() -> () {
+ let mut _0: ();
+ let _1: E;
+ let mut _3: isize;
+ scope 1 {
+ debug e => _1;
+ let _2: i32;
+ let _4: i32;
+ let _5: i32;
+ scope 2 {
+ debug x => _2;
+ }
+ scope 3 {
+ debug x => _4;
+ }
+ scope 4 {
+ debug x => _5;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = E::V1(const 0_i32);
+ StorageLive(_2);
+- _3 = discriminant(_1);
+- switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2];
++ _3 = const 0_isize;
++ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_5);
+ _5 = ((_1 as V2).0: i32);
+ _2 = _5;
+ StorageDead(_5);
+ goto -> bb4;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ StorageLive(_4);
+- _4 = ((_1 as V1).0: i32);
+- _2 = _4;
++ _4 = const 0_i32;
++ _2 = const 0_i32;
+ StorageDead(_4);
+ goto -> bb4;
+ }
+
+ bb4: {
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..ae8b44c95
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff
@@ -0,0 +1,126 @@
+- // MIR for `statics` before DataflowConstProp
++ // MIR for `statics` after DataflowConstProp
+
+ fn statics() -> () {
+ let mut _0: ();
+ let _1: E;
+ let mut _2: &E;
+ let mut _4: isize;
+ let mut _8: &&E;
+ let mut _10: isize;
+ scope 1 {
+ debug e => _1;
+ let _3: i32;
+ let _5: i32;
+ let _6: i32;
+ scope 2 {
+ debug x => _3;
+ let _7: &E;
+ scope 5 {
+ debug e => _7;
+ let _9: &i32;
+ let _11: &i32;
+ let _12: &i32;
+ scope 6 {
+ debug x => _9;
+ }
+ scope 7 {
+ debug x => _11;
+ }
+ scope 8 {
+ debug x => _12;
+ }
+ }
+ }
+ scope 3 {
+ debug x => _5;
+ }
+ scope 4 {
+ debug x => _6;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = const {alloc1: &E};
+ _1 = (*_2);
+ StorageDead(_2);
+ StorageLive(_3);
+- _4 = discriminant(_1);
+- switchInt(move _4) -> [0: bb3, 1: bb1, otherwise: bb2];
++ _4 = const 0_isize;
++ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_6);
+ _6 = ((_1 as V2).0: i32);
+ _3 = _6;
+ StorageDead(_6);
+ goto -> bb4;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ StorageLive(_5);
+- _5 = ((_1 as V1).0: i32);
+- _3 = _5;
++ _5 = const 0_i32;
++ _3 = const 0_i32;
+ StorageDead(_5);
+ goto -> bb4;
+ }
+
+ bb4: {
+ StorageLive(_7);
+ StorageLive(_8);
+ _8 = const {alloc2: &&E};
+ _7 = (*_8);
+ StorageDead(_8);
+ StorageLive(_9);
+ _10 = discriminant((*_7));
+ switchInt(move _10) -> [0: bb6, 1: bb5, otherwise: bb2];
+ }
+
+ bb5: {
+ StorageLive(_12);
+ _12 = &(((*_7) as V2).0: i32);
+ _9 = &(*_12);
+ StorageDead(_12);
+ goto -> bb7;
+ }
+
+ bb6: {
+ StorageLive(_11);
+ _11 = &(((*_7) as V1).0: i32);
+ _9 = _11;
+ StorageDead(_11);
+ goto -> bb7;
+ }
+
+ bb7: {
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_7);
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
+ }
+
+ alloc2 (static: RC, size: 4, align: 4) {
+ ╾─alloc14─╼ │ ╾──╼
+ }
+
+ alloc14 (size: 8, align: 4) {
+ 01 00 00 00 04 00 00 00 │ ........
+ }
+
+ alloc1 (static: statics::C, size: 8, align: 4) {
+ 00 00 00 00 00 00 00 00 │ ........
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..63799b3ba
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff
@@ -0,0 +1,126 @@
+- // MIR for `statics` before DataflowConstProp
++ // MIR for `statics` after DataflowConstProp
+
+ fn statics() -> () {
+ let mut _0: ();
+ let _1: E;
+ let mut _2: &E;
+ let mut _4: isize;
+ let mut _8: &&E;
+ let mut _10: isize;
+ scope 1 {
+ debug e => _1;
+ let _3: i32;
+ let _5: i32;
+ let _6: i32;
+ scope 2 {
+ debug x => _3;
+ let _7: &E;
+ scope 5 {
+ debug e => _7;
+ let _9: &i32;
+ let _11: &i32;
+ let _12: &i32;
+ scope 6 {
+ debug x => _9;
+ }
+ scope 7 {
+ debug x => _11;
+ }
+ scope 8 {
+ debug x => _12;
+ }
+ }
+ }
+ scope 3 {
+ debug x => _5;
+ }
+ scope 4 {
+ debug x => _6;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = const {alloc1: &E};
+ _1 = (*_2);
+ StorageDead(_2);
+ StorageLive(_3);
+- _4 = discriminant(_1);
+- switchInt(move _4) -> [0: bb3, 1: bb1, otherwise: bb2];
++ _4 = const 0_isize;
++ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_6);
+ _6 = ((_1 as V2).0: i32);
+ _3 = _6;
+ StorageDead(_6);
+ goto -> bb4;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ StorageLive(_5);
+- _5 = ((_1 as V1).0: i32);
+- _3 = _5;
++ _5 = const 0_i32;
++ _3 = const 0_i32;
+ StorageDead(_5);
+ goto -> bb4;
+ }
+
+ bb4: {
+ StorageLive(_7);
+ StorageLive(_8);
+ _8 = const {alloc2: &&E};
+ _7 = (*_8);
+ StorageDead(_8);
+ StorageLive(_9);
+ _10 = discriminant((*_7));
+ switchInt(move _10) -> [0: bb6, 1: bb5, otherwise: bb2];
+ }
+
+ bb5: {
+ StorageLive(_12);
+ _12 = &(((*_7) as V2).0: i32);
+ _9 = &(*_12);
+ StorageDead(_12);
+ goto -> bb7;
+ }
+
+ bb6: {
+ StorageLive(_11);
+ _11 = &(((*_7) as V1).0: i32);
+ _9 = _11;
+ StorageDead(_11);
+ goto -> bb7;
+ }
+
+ bb7: {
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_7);
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
+ }
+
+ alloc2 (static: RC, size: 8, align: 8) {
+ ╾───────alloc14───────╼ │ ╾──────╼
+ }
+
+ alloc14 (size: 8, align: 4) {
+ 01 00 00 00 04 00 00 00 │ ........
+ }
+
+ alloc1 (static: statics::C, size: 8, align: 4) {
+ 00 00 00 00 00 00 00 00 │ ........
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff
index 08b599f9f..355f28b03 100644
--- a/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff
+++ b/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff
@@ -39,19 +39,20 @@
StorageLive(_4);
- _4 = _1;
- _3 = Eq(move _4, const 1_i32);
+- switchInt(move _3) -> [0: bb2, otherwise: bb1];
+ _4 = const 1_i32;
+ _3 = const true;
- StorageDead(_4);
-- switchInt(move _3) -> [0: bb2, otherwise: bb1];
+ switchInt(const true) -> [0: bb2, otherwise: bb1];
}
bb1: {
+ StorageDead(_4);
_2 = const 2_i32;
goto -> bb3;
}
bb2: {
+ StorageDead(_4);
_2 = const 3_i32;
goto -> bb3;
}
@@ -70,20 +71,21 @@
StorageLive(_9);
- _9 = _1;
- _8 = Eq(move _9, const 1_i32);
+- switchInt(move _8) -> [0: bb5, otherwise: bb4];
+ _9 = const 1_i32;
+ _8 = const true;
- StorageDead(_9);
-- switchInt(move _8) -> [0: bb5, otherwise: bb4];
+ switchInt(const true) -> [0: bb5, otherwise: bb4];
}
bb4: {
+ StorageDead(_9);
- _7 = _1;
+ _7 = const 1_i32;
goto -> bb6;
}
bb5: {
+ StorageDead(_9);
StorageLive(_10);
_10 = _1;
_7 = Add(move _10, const 1_i32);
diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-abort.diff
new file mode 100644
index 000000000..6c612d467
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-abort.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u8;
+ let mut _2: [u8; 5000];
+ let _3: usize;
+ let mut _4: usize;
+ let mut _5: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = [const 0_u8; 5000];
+ StorageLive(_3);
+ _3 = const 2_usize;
+- _4 = Len(_2);
+- _5 = Lt(_3, _4);
+- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable];
++ _4 = const 5000_usize;
++ _5 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _1 = _2[_3];
++ _1 = _2[2 of 3];
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-unwind.diff
new file mode 100644
index 000000000..87024da26
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-unwind.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u8;
+ let mut _2: [u8; 5000];
+ let _3: usize;
+ let mut _4: usize;
+ let mut _5: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = [const 0_u8; 5000];
+ StorageLive(_3);
+ _3 = const 2_usize;
+- _4 = Len(_2);
+- _5 = Lt(_3, _4);
+- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue];
++ _4 = const 5000_usize;
++ _5 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _1 = _2[_3];
++ _1 = _2[2 of 3];
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-abort.diff
new file mode 100644
index 000000000..6c612d467
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-abort.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u8;
+ let mut _2: [u8; 5000];
+ let _3: usize;
+ let mut _4: usize;
+ let mut _5: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = [const 0_u8; 5000];
+ StorageLive(_3);
+ _3 = const 2_usize;
+- _4 = Len(_2);
+- _5 = Lt(_3, _4);
+- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable];
++ _4 = const 5000_usize;
++ _5 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _1 = _2[_3];
++ _1 = _2[2 of 3];
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-unwind.diff
new file mode 100644
index 000000000..87024da26
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-unwind.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u8;
+ let mut _2: [u8; 5000];
+ let _3: usize;
+ let mut _4: usize;
+ let mut _5: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = [const 0_u8; 5000];
+ StorageLive(_3);
+ _3 = const 2_usize;
+- _4 = Len(_2);
+- _5 = Lt(_3, _4);
+- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue];
++ _4 = const 5000_usize;
++ _5 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _1 = _2[_3];
++ _1 = _2[2 of 3];
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.rs b/tests/mir-opt/dataflow-const-prop/large_array_index.rs
new file mode 100644
index 000000000..af13c7d10
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/large_array_index.rs
@@ -0,0 +1,9 @@
+// unit-test: DataflowConstProp
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+
+// EMIT_MIR large_array_index.main.DataflowConstProp.diff
+fn main() {
+ // check that we don't propagate this, because it's too large
+ let x: u8 = [0_u8; 5000][2];
+}
diff --git a/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs b/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs
new file mode 100644
index 000000000..dbea14804
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs
@@ -0,0 +1,10 @@
+// unit-test: DataflowConstProp
+
+// EMIT_MIR mult_by_zero.test.DataflowConstProp.diff
+fn test(x : i32) -> i32 {
+ x * 0
+}
+
+fn main() {
+ test(10);
+}
diff --git a/tests/mir-opt/dataflow-const-prop/mult_by_zero.test.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/mult_by_zero.test.DataflowConstProp.diff
new file mode 100644
index 000000000..91bc10a56
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/mult_by_zero.test.DataflowConstProp.diff
@@ -0,0 +1,18 @@
+- // MIR for `test` before DataflowConstProp
++ // MIR for `test` after DataflowConstProp
+
+ fn test(_1: i32) -> i32 {
+ debug x => _1;
+ let mut _0: i32;
+ let mut _2: i32;
+
+ bb0: {
+ StorageLive(_2);
+ _2 = _1;
+- _0 = Mul(move _2, const 0_i32);
++ _0 = const 0_i32;
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-abort.diff
new file mode 100644
index 000000000..c61414b65
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-abort.diff
@@ -0,0 +1,76 @@
+- // MIR for `concrete` before DataflowConstProp
++ // MIR for `concrete` after DataflowConstProp
+
+ fn concrete() -> () {
+ let mut _0: ();
+ let _1: usize;
+ let mut _2: usize;
+ let mut _4: usize;
+ let mut _6: usize;
+ let mut _8: usize;
+ scope 1 {
+ debug x => _1;
+ let _3: usize;
+ scope 2 {
+ debug y => _3;
+ let _5: usize;
+ scope 3 {
+ debug z0 => _5;
+ let _7: usize;
+ scope 4 {
+ debug z1 => _7;
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+- _2 = OffsetOf(Alpha, [0]);
+- _1 = must_use::<usize>(move _2) -> [return: bb1, unwind unreachable];
++ _2 = const 4_usize;
++ _1 = must_use::<usize>(const 4_usize) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+- _4 = OffsetOf(Alpha, [1]);
+- _3 = must_use::<usize>(move _4) -> [return: bb2, unwind unreachable];
++ _4 = const 0_usize;
++ _3 = must_use::<usize>(const 0_usize) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+- _6 = OffsetOf(Alpha, [2, 0]);
+- _5 = must_use::<usize>(move _6) -> [return: bb3, unwind unreachable];
++ _6 = const 2_usize;
++ _5 = must_use::<usize>(const 2_usize) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+- _8 = OffsetOf(Alpha, [2, 1]);
+- _7 = must_use::<usize>(move _8) -> [return: bb4, unwind unreachable];
++ _8 = const 3_usize;
++ _7 = must_use::<usize>(const 3_usize) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_8);
+ _0 = const ();
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-unwind.diff
new file mode 100644
index 000000000..0c3939a34
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-unwind.diff
@@ -0,0 +1,76 @@
+- // MIR for `concrete` before DataflowConstProp
++ // MIR for `concrete` after DataflowConstProp
+
+ fn concrete() -> () {
+ let mut _0: ();
+ let _1: usize;
+ let mut _2: usize;
+ let mut _4: usize;
+ let mut _6: usize;
+ let mut _8: usize;
+ scope 1 {
+ debug x => _1;
+ let _3: usize;
+ scope 2 {
+ debug y => _3;
+ let _5: usize;
+ scope 3 {
+ debug z0 => _5;
+ let _7: usize;
+ scope 4 {
+ debug z1 => _7;
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+- _2 = OffsetOf(Alpha, [0]);
+- _1 = must_use::<usize>(move _2) -> [return: bb1, unwind continue];
++ _2 = const 4_usize;
++ _1 = must_use::<usize>(const 4_usize) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+- _4 = OffsetOf(Alpha, [1]);
+- _3 = must_use::<usize>(move _4) -> [return: bb2, unwind continue];
++ _4 = const 0_usize;
++ _3 = must_use::<usize>(const 0_usize) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+- _6 = OffsetOf(Alpha, [2, 0]);
+- _5 = must_use::<usize>(move _6) -> [return: bb3, unwind continue];
++ _6 = const 2_usize;
++ _5 = must_use::<usize>(const 2_usize) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+- _8 = OffsetOf(Alpha, [2, 1]);
+- _7 = must_use::<usize>(move _8) -> [return: bb4, unwind continue];
++ _8 = const 3_usize;
++ _7 = must_use::<usize>(const 3_usize) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_8);
+ _0 = const ();
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-abort.diff
new file mode 100644
index 000000000..d54d46870
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-abort.diff
@@ -0,0 +1,72 @@
+- // MIR for `generic` before DataflowConstProp
++ // MIR for `generic` after DataflowConstProp
+
+ fn generic() -> () {
+ let mut _0: ();
+ let _1: usize;
+ let mut _2: usize;
+ let mut _4: usize;
+ let mut _6: usize;
+ let mut _8: usize;
+ scope 1 {
+ debug gx => _1;
+ let _3: usize;
+ scope 2 {
+ debug gy => _3;
+ let _5: usize;
+ scope 3 {
+ debug dx => _5;
+ let _7: usize;
+ scope 4 {
+ debug dy => _7;
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = OffsetOf(Gamma<T>, [0]);
+ _1 = must_use::<usize>(move _2) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = OffsetOf(Gamma<T>, [1]);
+ _3 = must_use::<usize>(move _4) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+- _6 = OffsetOf(Delta<T>, [1]);
+- _5 = must_use::<usize>(move _6) -> [return: bb3, unwind unreachable];
++ _6 = const 0_usize;
++ _5 = must_use::<usize>(const 0_usize) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+- _8 = OffsetOf(Delta<T>, [2]);
+- _7 = must_use::<usize>(move _8) -> [return: bb4, unwind unreachable];
++ _8 = const 2_usize;
++ _7 = must_use::<usize>(const 2_usize) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_8);
+ _0 = const ();
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-unwind.diff
new file mode 100644
index 000000000..6032a2274
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-unwind.diff
@@ -0,0 +1,72 @@
+- // MIR for `generic` before DataflowConstProp
++ // MIR for `generic` after DataflowConstProp
+
+ fn generic() -> () {
+ let mut _0: ();
+ let _1: usize;
+ let mut _2: usize;
+ let mut _4: usize;
+ let mut _6: usize;
+ let mut _8: usize;
+ scope 1 {
+ debug gx => _1;
+ let _3: usize;
+ scope 2 {
+ debug gy => _3;
+ let _5: usize;
+ scope 3 {
+ debug dx => _5;
+ let _7: usize;
+ scope 4 {
+ debug dy => _7;
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = OffsetOf(Gamma<T>, [0]);
+ _1 = must_use::<usize>(move _2) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = OffsetOf(Gamma<T>, [1]);
+ _3 = must_use::<usize>(move _4) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+- _6 = OffsetOf(Delta<T>, [1]);
+- _5 = must_use::<usize>(move _6) -> [return: bb3, unwind continue];
++ _6 = const 0_usize;
++ _5 = must_use::<usize>(const 0_usize) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+- _8 = OffsetOf(Delta<T>, [2]);
+- _7 = must_use::<usize>(move _8) -> [return: bb4, unwind continue];
++ _8 = const 2_usize;
++ _7 = must_use::<usize>(const 2_usize) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_8);
+ _0 = const ();
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.rs b/tests/mir-opt/dataflow-const-prop/offset_of.rs
new file mode 100644
index 000000000..ccc90790e
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/offset_of.rs
@@ -0,0 +1,49 @@
+// unit-test: DataflowConstProp
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
+#![feature(offset_of)]
+
+use std::marker::PhantomData;
+use std::mem::offset_of;
+
+struct Alpha {
+ x: u8,
+ y: u16,
+ z: Beta,
+}
+
+struct Beta(u8, u8);
+
+struct Gamma<T> {
+ x: u8,
+ y: u16,
+ _t: T,
+}
+
+#[repr(C)]
+struct Delta<T> {
+ _phantom: PhantomData<T>,
+ x: u8,
+ y: u16,
+}
+
+// EMIT_MIR offset_of.concrete.DataflowConstProp.diff
+fn concrete() {
+ let x = offset_of!(Alpha, x);
+ let y = offset_of!(Alpha, y);
+ let z0 = offset_of!(Alpha, z.0);
+ let z1 = offset_of!(Alpha, z.1);
+}
+
+// EMIT_MIR offset_of.generic.DataflowConstProp.diff
+fn generic<T>() {
+ let gx = offset_of!(Gamma<T>, x);
+ let gy = offset_of!(Gamma<T>, y);
+ let dx = offset_of!(Delta<T>, x);
+ let dy = offset_of!(Delta<T>, y);
+}
+
+fn main() {
+ concrete();
+ generic::<()>();
+}
diff --git a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-abort.diff
new file mode 100644
index 000000000..a18ef6c9d
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-abort.diff
@@ -0,0 +1,43 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: u32;
+ let mut _3: [u32; 8];
+ let _4: usize;
+ let mut _5: usize;
+ let mut _6: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = [const 42_u32; 8];
+ StorageLive(_4);
+ _4 = const 2_usize;
+- _5 = Len(_3);
+- _6 = Lt(_4, _5);
+- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable];
++ _5 = const 8_usize;
++ _6 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _2 = _3[_4];
++ _2 = _3[2 of 3];
+ _1 = Add(move _2, const 0_u32);
+ StorageDead(_2);
+ StorageDead(_4);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-unwind.diff
new file mode 100644
index 000000000..3356ef98b
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-unwind.diff
@@ -0,0 +1,43 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: u32;
+ let mut _3: [u32; 8];
+ let _4: usize;
+ let mut _5: usize;
+ let mut _6: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = [const 42_u32; 8];
+ StorageLive(_4);
+ _4 = const 2_usize;
+- _5 = Len(_3);
+- _6 = Lt(_4, _5);
+- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind continue];
++ _5 = const 8_usize;
++ _6 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _2 = _3[_4];
++ _2 = _3[2 of 3];
+ _1 = Add(move _2, const 0_u32);
+ StorageDead(_2);
+ StorageDead(_4);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-abort.diff
new file mode 100644
index 000000000..a18ef6c9d
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-abort.diff
@@ -0,0 +1,43 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: u32;
+ let mut _3: [u32; 8];
+ let _4: usize;
+ let mut _5: usize;
+ let mut _6: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = [const 42_u32; 8];
+ StorageLive(_4);
+ _4 = const 2_usize;
+- _5 = Len(_3);
+- _6 = Lt(_4, _5);
+- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable];
++ _5 = const 8_usize;
++ _6 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _2 = _3[_4];
++ _2 = _3[2 of 3];
+ _1 = Add(move _2, const 0_u32);
+ StorageDead(_2);
+ StorageDead(_4);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-unwind.diff
new file mode 100644
index 000000000..3356ef98b
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-unwind.diff
@@ -0,0 +1,43 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: u32;
+ let mut _3: [u32; 8];
+ let _4: usize;
+ let mut _5: usize;
+ let mut _6: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = [const 42_u32; 8];
+ StorageLive(_4);
+ _4 = const 2_usize;
+- _5 = Len(_3);
+- _6 = Lt(_4, _5);
+- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind continue];
++ _5 = const 8_usize;
++ _6 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _2 = _3[_4];
++ _2 = _3[2 of 3];
+ _1 = Add(move _2, const 0_u32);
+ StorageDead(_2);
+ StorageDead(_4);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/repeat.rs b/tests/mir-opt/dataflow-const-prop/repeat.rs
new file mode 100644
index 000000000..9fa353e44
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/repeat.rs
@@ -0,0 +1,8 @@
+// unit-test: DataflowConstProp
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+
+// EMIT_MIR repeat.main.DataflowConstProp.diff
+fn main() {
+ let x: u32 = [42; 8][2] + 0;
+}
diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-abort.diff
new file mode 100644
index 000000000..e99b413f7
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-abort.diff
@@ -0,0 +1,77 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: &[u32];
+ let mut _3: &[u32; 3];
+ let _4: &[u32; 3];
+ let _5: [u32; 3];
+ let _6: usize;
+ let mut _7: usize;
+ let mut _8: bool;
+ let mut _10: &[u32];
+ let _11: usize;
+ let mut _12: usize;
+ let mut _13: bool;
+ let mut _14: &[u32; 3];
+ scope 1 {
+ debug local => _1;
+ let _9: u32;
+ scope 2 {
+ debug constant => _9;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _14 = const _;
+ _4 = _14;
+ _3 = _4;
+ _2 = move _3 as &[u32] (PointerCoercion(Unsize));
+ StorageDead(_3);
+ StorageLive(_6);
+ _6 = const 1_usize;
+- _7 = Len((*_2));
+- _8 = Lt(_6, _7);
+- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable];
++ _7 = const 3_usize;
++ _8 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _1 = (*_2)[_6];
++ _1 = (*_2)[1 of 2];
+ StorageDead(_6);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = const _;
+ StorageLive(_11);
+ _11 = const 1_usize;
+- _12 = Len((*_10));
+- _13 = Lt(_11, _12);
+- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb2, unwind unreachable];
++ _12 = const 3_usize;
++ _13 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb2, unwind unreachable];
+ }
+
+ bb2: {
+- _9 = (*_10)[_11];
++ _9 = (*_10)[1 of 2];
+ StorageDead(_11);
+ StorageDead(_10);
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-unwind.diff
new file mode 100644
index 000000000..759a793fb
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-unwind.diff
@@ -0,0 +1,77 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: &[u32];
+ let mut _3: &[u32; 3];
+ let _4: &[u32; 3];
+ let _5: [u32; 3];
+ let _6: usize;
+ let mut _7: usize;
+ let mut _8: bool;
+ let mut _10: &[u32];
+ let _11: usize;
+ let mut _12: usize;
+ let mut _13: bool;
+ let mut _14: &[u32; 3];
+ scope 1 {
+ debug local => _1;
+ let _9: u32;
+ scope 2 {
+ debug constant => _9;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _14 = const _;
+ _4 = _14;
+ _3 = _4;
+ _2 = move _3 as &[u32] (PointerCoercion(Unsize));
+ StorageDead(_3);
+ StorageLive(_6);
+ _6 = const 1_usize;
+- _7 = Len((*_2));
+- _8 = Lt(_6, _7);
+- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue];
++ _7 = const 3_usize;
++ _8 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _1 = (*_2)[_6];
++ _1 = (*_2)[1 of 2];
+ StorageDead(_6);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = const _;
+ StorageLive(_11);
+ _11 = const 1_usize;
+- _12 = Len((*_10));
+- _13 = Lt(_11, _12);
+- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb2, unwind continue];
++ _12 = const 3_usize;
++ _13 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb2, unwind continue];
+ }
+
+ bb2: {
+- _9 = (*_10)[_11];
++ _9 = (*_10)[1 of 2];
+ StorageDead(_11);
+ StorageDead(_10);
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-abort.diff
new file mode 100644
index 000000000..e99b413f7
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-abort.diff
@@ -0,0 +1,77 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: &[u32];
+ let mut _3: &[u32; 3];
+ let _4: &[u32; 3];
+ let _5: [u32; 3];
+ let _6: usize;
+ let mut _7: usize;
+ let mut _8: bool;
+ let mut _10: &[u32];
+ let _11: usize;
+ let mut _12: usize;
+ let mut _13: bool;
+ let mut _14: &[u32; 3];
+ scope 1 {
+ debug local => _1;
+ let _9: u32;
+ scope 2 {
+ debug constant => _9;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _14 = const _;
+ _4 = _14;
+ _3 = _4;
+ _2 = move _3 as &[u32] (PointerCoercion(Unsize));
+ StorageDead(_3);
+ StorageLive(_6);
+ _6 = const 1_usize;
+- _7 = Len((*_2));
+- _8 = Lt(_6, _7);
+- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable];
++ _7 = const 3_usize;
++ _8 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _1 = (*_2)[_6];
++ _1 = (*_2)[1 of 2];
+ StorageDead(_6);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = const _;
+ StorageLive(_11);
+ _11 = const 1_usize;
+- _12 = Len((*_10));
+- _13 = Lt(_11, _12);
+- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb2, unwind unreachable];
++ _12 = const 3_usize;
++ _13 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb2, unwind unreachable];
+ }
+
+ bb2: {
+- _9 = (*_10)[_11];
++ _9 = (*_10)[1 of 2];
+ StorageDead(_11);
+ StorageDead(_10);
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-unwind.diff
new file mode 100644
index 000000000..759a793fb
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-unwind.diff
@@ -0,0 +1,77 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: &[u32];
+ let mut _3: &[u32; 3];
+ let _4: &[u32; 3];
+ let _5: [u32; 3];
+ let _6: usize;
+ let mut _7: usize;
+ let mut _8: bool;
+ let mut _10: &[u32];
+ let _11: usize;
+ let mut _12: usize;
+ let mut _13: bool;
+ let mut _14: &[u32; 3];
+ scope 1 {
+ debug local => _1;
+ let _9: u32;
+ scope 2 {
+ debug constant => _9;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _14 = const _;
+ _4 = _14;
+ _3 = _4;
+ _2 = move _3 as &[u32] (PointerCoercion(Unsize));
+ StorageDead(_3);
+ StorageLive(_6);
+ _6 = const 1_usize;
+- _7 = Len((*_2));
+- _8 = Lt(_6, _7);
+- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue];
++ _7 = const 3_usize;
++ _8 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _1 = (*_2)[_6];
++ _1 = (*_2)[1 of 2];
+ StorageDead(_6);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = const _;
+ StorageLive(_11);
+ _11 = const 1_usize;
+- _12 = Len((*_10));
+- _13 = Lt(_11, _12);
+- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb2, unwind continue];
++ _12 = const 3_usize;
++ _13 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb2, unwind continue];
+ }
+
+ bb2: {
+- _9 = (*_10)[_11];
++ _9 = (*_10)[1 of 2];
+ StorageDead(_11);
+ StorageDead(_10);
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.rs b/tests/mir-opt/dataflow-const-prop/slice_len.rs
new file mode 100644
index 000000000..41367e484
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/slice_len.rs
@@ -0,0 +1,12 @@
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// unit-test: DataflowConstProp
+// compile-flags: -Zmir-enable-passes=+InstSimplify
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+
+// EMIT_MIR slice_len.main.DataflowConstProp.diff
+fn main() {
+ let local = (&[1u32, 2, 3] as &[u32])[1];
+
+ const SLICE: &[u32] = &[1, 2, 3];
+ let constant = SLICE[1];
+}
diff --git a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..2de6ba307
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff
@@ -0,0 +1,129 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: S;
+ let mut _3: i32;
+ let mut _5: i32;
+ let mut _6: i32;
+ let mut _11: BigStruct;
+ let mut _16: &&BigStruct;
+ let mut _17: &BigStruct;
+ let mut _18: &BigStruct;
+ let mut _19: &BigStruct;
+ let mut _20: &BigStruct;
+ let mut _21: &BigStruct;
+ scope 1 {
+ debug s => _1;
+ let _2: i32;
+ scope 2 {
+ debug a => _2;
+ let _4: i32;
+ scope 3 {
+ debug b => _4;
+ let _7: S;
+ let _8: u8;
+ let _9: f32;
+ let _10: S;
+ scope 4 {
+ debug a => _7;
+ debug b => _8;
+ debug c => _9;
+ debug d => _10;
+ let _12: S;
+ let _13: u8;
+ let _14: f32;
+ let _15: S;
+ scope 5 {
+ debug a => _12;
+ debug b => _13;
+ debug c => _14;
+ debug d => _15;
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = S(const 1_i32);
+ StorageLive(_2);
+ StorageLive(_3);
+- _3 = (_1.0: i32);
+- _2 = Add(move _3, const 2_i32);
++ _3 = const 1_i32;
++ _2 = const 3_i32;
+ StorageDead(_3);
+ (_1.0: i32) = const 3_i32;
+ StorageLive(_4);
+ StorageLive(_5);
+- _5 = _2;
++ _5 = const 3_i32;
+ StorageLive(_6);
+- _6 = (_1.0: i32);
+- _4 = Add(move _5, move _6);
++ _6 = const 3_i32;
++ _4 = const 6_i32;
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageLive(_11);
+ _11 = const _;
+ StorageLive(_7);
+- _7 = (_11.0: S);
++ _7 = const S(1_i32);
+ StorageLive(_8);
+- _8 = (_11.1: u8);
++ _8 = const 5_u8;
+ StorageLive(_9);
+- _9 = (_11.2: f32);
++ _9 = const 7f32;
+ StorageLive(_10);
+- _10 = (_11.3: S);
++ _10 = const S(13_i32);
+ StorageDead(_11);
+ StorageLive(_16);
+ _16 = const {alloc1: &&BigStruct};
+ _17 = deref_copy (*_16);
+ StorageLive(_12);
+ _18 = deref_copy (*_16);
+- _12 = ((*_18).0: S);
++ _12 = const S(1_i32);
+ StorageLive(_13);
+ _19 = deref_copy (*_16);
+- _13 = ((*_19).1: u8);
++ _13 = const 5_u8;
+ StorageLive(_14);
+ _20 = deref_copy (*_16);
+- _14 = ((*_20).2: f32);
++ _14 = const 7f32;
+ StorageLive(_15);
+ _21 = deref_copy (*_16);
+- _15 = ((*_21).3: S);
++ _15 = const S(13_i32);
+ StorageDead(_16);
+ _0 = const ();
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
+ alloc1 (static: STAT, size: 4, align: 4) {
+ ╾─alloc15─╼ │ ╾──╼
+ }
+
+ alloc15 (size: 16, align: 4) {
+ 01 00 00 00 00 00 e0 40 0d 00 00 00 05 __ __ __ │ .......@.....░░░
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..71a28f216
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff
@@ -0,0 +1,129 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: S;
+ let mut _3: i32;
+ let mut _5: i32;
+ let mut _6: i32;
+ let mut _11: BigStruct;
+ let mut _16: &&BigStruct;
+ let mut _17: &BigStruct;
+ let mut _18: &BigStruct;
+ let mut _19: &BigStruct;
+ let mut _20: &BigStruct;
+ let mut _21: &BigStruct;
+ scope 1 {
+ debug s => _1;
+ let _2: i32;
+ scope 2 {
+ debug a => _2;
+ let _4: i32;
+ scope 3 {
+ debug b => _4;
+ let _7: S;
+ let _8: u8;
+ let _9: f32;
+ let _10: S;
+ scope 4 {
+ debug a => _7;
+ debug b => _8;
+ debug c => _9;
+ debug d => _10;
+ let _12: S;
+ let _13: u8;
+ let _14: f32;
+ let _15: S;
+ scope 5 {
+ debug a => _12;
+ debug b => _13;
+ debug c => _14;
+ debug d => _15;
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = S(const 1_i32);
+ StorageLive(_2);
+ StorageLive(_3);
+- _3 = (_1.0: i32);
+- _2 = Add(move _3, const 2_i32);
++ _3 = const 1_i32;
++ _2 = const 3_i32;
+ StorageDead(_3);
+ (_1.0: i32) = const 3_i32;
+ StorageLive(_4);
+ StorageLive(_5);
+- _5 = _2;
++ _5 = const 3_i32;
+ StorageLive(_6);
+- _6 = (_1.0: i32);
+- _4 = Add(move _5, move _6);
++ _6 = const 3_i32;
++ _4 = const 6_i32;
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageLive(_11);
+ _11 = const _;
+ StorageLive(_7);
+- _7 = (_11.0: S);
++ _7 = const S(1_i32);
+ StorageLive(_8);
+- _8 = (_11.1: u8);
++ _8 = const 5_u8;
+ StorageLive(_9);
+- _9 = (_11.2: f32);
++ _9 = const 7f32;
+ StorageLive(_10);
+- _10 = (_11.3: S);
++ _10 = const S(13_i32);
+ StorageDead(_11);
+ StorageLive(_16);
+ _16 = const {alloc1: &&BigStruct};
+ _17 = deref_copy (*_16);
+ StorageLive(_12);
+ _18 = deref_copy (*_16);
+- _12 = ((*_18).0: S);
++ _12 = const S(1_i32);
+ StorageLive(_13);
+ _19 = deref_copy (*_16);
+- _13 = ((*_19).1: u8);
++ _13 = const 5_u8;
+ StorageLive(_14);
+ _20 = deref_copy (*_16);
+- _14 = ((*_20).2: f32);
++ _14 = const 7f32;
+ StorageLive(_15);
+ _21 = deref_copy (*_16);
+- _15 = ((*_21).3: S);
++ _15 = const S(13_i32);
+ StorageDead(_16);
+ _0 = const ();
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
+ alloc1 (static: STAT, size: 8, align: 8) {
+ ╾───────alloc15───────╼ │ ╾──────╼
+ }
+
+ alloc15 (size: 16, align: 4) {
+ 01 00 00 00 00 00 e0 40 0d 00 00 00 05 __ __ __ │ .......@.....░░░
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.diff
deleted file mode 100644
index 914bc8ac4..000000000
--- a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.diff
+++ /dev/null
@@ -1,51 +0,0 @@
-- // MIR for `main` before DataflowConstProp
-+ // MIR for `main` after DataflowConstProp
-
- fn main() -> () {
- let mut _0: ();
- let mut _1: S;
- let mut _3: i32;
- let mut _5: i32;
- let mut _6: i32;
- scope 1 {
- debug s => _1;
- let _2: i32;
- scope 2 {
- debug a => _2;
- let _4: i32;
- scope 3 {
- debug b => _4;
- }
- }
- }
-
- bb0: {
- StorageLive(_1);
- _1 = S(const 1_i32);
- StorageLive(_2);
- StorageLive(_3);
-- _3 = (_1.0: i32);
-- _2 = Add(move _3, const 2_i32);
-+ _3 = const 1_i32;
-+ _2 = const 3_i32;
- StorageDead(_3);
- (_1.0: i32) = const 3_i32;
- StorageLive(_4);
- StorageLive(_5);
-- _5 = _2;
-+ _5 = const 3_i32;
- StorageLive(_6);
-- _6 = (_1.0: i32);
-- _4 = Add(move _5, move _6);
-+ _6 = const 3_i32;
-+ _4 = const 6_i32;
- StorageDead(_6);
- StorageDead(_5);
- _0 = const ();
- StorageDead(_4);
- StorageDead(_2);
- StorageDead(_1);
- return;
- }
- }
-
diff --git a/tests/mir-opt/dataflow-const-prop/struct.rs b/tests/mir-opt/dataflow-const-prop/struct.rs
index 841b279e0..e92a1676d 100644
--- a/tests/mir-opt/dataflow-const-prop/struct.rs
+++ b/tests/mir-opt/dataflow-const-prop/struct.rs
@@ -1,11 +1,22 @@
// unit-test: DataflowConstProp
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+#[derive(Copy, Clone)]
struct S(i32);
+#[derive(Copy, Clone)]
+struct BigStruct(S, u8, f32, S);
+
// EMIT_MIR struct.main.DataflowConstProp.diff
fn main() {
let mut s = S(1);
let a = s.0 + 2;
s.0 = 3;
let b = a + s.0;
+
+ const VAL: BigStruct = BigStruct(S(1), 5, 7., S(13));
+ let BigStruct(a, b, c, d) = VAL;
+
+ static STAT: &BigStruct = &BigStruct(S(1), 5, 7., S(13));
+ let BigStruct(a, b, c, d) = *STAT;
}
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..52f096ac0
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.32bit.diff
@@ -0,0 +1,15 @@
+- // MIR for `from_char` before DataflowConstProp
++ // MIR for `from_char` after DataflowConstProp
+
+ fn from_char() -> i32 {
+ let mut _0: i32;
+ scope 1 {
+ }
+
+ bb0: {
+- _0 = const 'R' as i32 (Transmute);
++ _0 = const 82_i32;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..52f096ac0
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.64bit.diff
@@ -0,0 +1,15 @@
+- // MIR for `from_char` before DataflowConstProp
++ // MIR for `from_char` after DataflowConstProp
+
+ fn from_char() -> i32 {
+ let mut _0: i32;
+ scope 1 {
+ }
+
+ bb0: {
+- _0 = const 'R' as i32 (Transmute);
++ _0 = const 82_i32;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..3972eb209
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.32bit.diff
@@ -0,0 +1,15 @@
+- // MIR for `invalid_bool` before DataflowConstProp
++ // MIR for `invalid_bool` after DataflowConstProp
+
+ fn invalid_bool() -> bool {
+ let mut _0: bool;
+ scope 1 {
+ }
+
+ bb0: {
+- _0 = const -1_i8 as bool (Transmute);
++ _0 = const {transmute(0xff): bool};
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..3972eb209
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.64bit.diff
@@ -0,0 +1,15 @@
+- // MIR for `invalid_bool` before DataflowConstProp
++ // MIR for `invalid_bool` after DataflowConstProp
+
+ fn invalid_bool() -> bool {
+ let mut _0: bool;
+ scope 1 {
+ }
+
+ bb0: {
+- _0 = const -1_i8 as bool (Transmute);
++ _0 = const {transmute(0xff): bool};
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..837dabde4
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.32bit.diff
@@ -0,0 +1,15 @@
+- // MIR for `invalid_char` before DataflowConstProp
++ // MIR for `invalid_char` after DataflowConstProp
+
+ fn invalid_char() -> char {
+ let mut _0: char;
+ scope 1 {
+ }
+
+ bb0: {
+- _0 = const _ as char (Transmute);
++ _0 = const {transmute(0x7fffffff): char};
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..837dabde4
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.64bit.diff
@@ -0,0 +1,15 @@
+- // MIR for `invalid_char` before DataflowConstProp
++ // MIR for `invalid_char` after DataflowConstProp
+
+ fn invalid_char() -> char {
+ let mut _0: char;
+ scope 1 {
+ }
+
+ bb0: {
+- _0 = const _ as char (Transmute);
++ _0 = const {transmute(0x7fffffff): char};
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..6091e169e
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.32bit.diff
@@ -0,0 +1,18 @@
+- // MIR for `less_as_i8` before DataflowConstProp
++ // MIR for `less_as_i8` after DataflowConstProp
+
+ fn less_as_i8() -> i8 {
+ let mut _0: i8;
+ let mut _1: std::cmp::Ordering;
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = Less;
+ _0 = move _1 as i8 (Transmute);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..6091e169e
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.64bit.diff
@@ -0,0 +1,18 @@
+- // MIR for `less_as_i8` before DataflowConstProp
++ // MIR for `less_as_i8` after DataflowConstProp
+
+ fn less_as_i8() -> i8 {
+ let mut _0: i8;
+ let mut _1: std::cmp::Ordering;
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = Less;
+ _0 = move _1 as i8 (Transmute);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.rs b/tests/mir-opt/dataflow-const-prop/transmute.rs
new file mode 100644
index 000000000..c25e33ab0
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.rs
@@ -0,0 +1,63 @@
+// unit-test: DataflowConstProp
+// compile-flags: -O --crate-type=lib
+// ignore-endian-big
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+
+use std::mem::transmute;
+
+// EMIT_MIR transmute.less_as_i8.DataflowConstProp.diff
+pub fn less_as_i8() -> i8 {
+ unsafe { transmute(std::cmp::Ordering::Less) }
+}
+
+// EMIT_MIR transmute.from_char.DataflowConstProp.diff
+pub fn from_char() -> i32 {
+ unsafe { transmute('R') }
+}
+
+// EMIT_MIR transmute.valid_char.DataflowConstProp.diff
+pub fn valid_char() -> char {
+ unsafe { transmute(0x52_u32) }
+}
+
+// EMIT_MIR transmute.invalid_char.DataflowConstProp.diff
+pub unsafe fn invalid_char() -> char {
+ unsafe { transmute(i32::MAX) }
+}
+
+// EMIT_MIR transmute.invalid_bool.DataflowConstProp.diff
+pub unsafe fn invalid_bool() -> bool {
+ unsafe { transmute(-1_i8) }
+}
+
+// EMIT_MIR transmute.undef_union_as_integer.DataflowConstProp.diff
+pub unsafe fn undef_union_as_integer() -> u32 {
+ union Union32 { value: u32, unit: () }
+ unsafe { transmute(Union32 { unit: () }) }
+}
+
+// EMIT_MIR transmute.unreachable_direct.DataflowConstProp.diff
+pub unsafe fn unreachable_direct() -> ! {
+ let x: Never = unsafe { transmute(()) };
+ match x {}
+}
+
+// EMIT_MIR transmute.unreachable_ref.DataflowConstProp.diff
+pub unsafe fn unreachable_ref() -> ! {
+ let x: &Never = unsafe { transmute(1_usize) };
+ match *x {}
+}
+
+// EMIT_MIR transmute.unreachable_mut.DataflowConstProp.diff
+pub unsafe fn unreachable_mut() -> ! {
+ let x: &mut Never = unsafe { transmute(1_usize) };
+ match *x {}
+}
+
+// EMIT_MIR transmute.unreachable_box.DataflowConstProp.diff
+pub unsafe fn unreachable_box() -> ! {
+ let x: Box<Never> = unsafe { transmute(1_usize) };
+ match *x {}
+}
+
+enum Never {}
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..fc0634b1f
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.32bit.diff
@@ -0,0 +1,22 @@
+- // MIR for `undef_union_as_integer` before DataflowConstProp
++ // MIR for `undef_union_as_integer` after DataflowConstProp
+
+ fn undef_union_as_integer() -> u32 {
+ let mut _0: u32;
+ let mut _1: undef_union_as_integer::Union32;
+ let mut _2: ();
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = ();
+ _1 = Union32 { value: move _2 };
+ StorageDead(_2);
+ _0 = move _1 as u32 (Transmute);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..fc0634b1f
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.64bit.diff
@@ -0,0 +1,22 @@
+- // MIR for `undef_union_as_integer` before DataflowConstProp
++ // MIR for `undef_union_as_integer` after DataflowConstProp
+
+ fn undef_union_as_integer() -> u32 {
+ let mut _0: u32;
+ let mut _1: undef_union_as_integer::Union32;
+ let mut _2: ();
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = ();
+ _1 = Union32 { value: move _2 };
+ StorageDead(_2);
+ _0 = move _1 as u32 (Transmute);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..d0c298ba2
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff
@@ -0,0 +1,20 @@
+- // MIR for `unreachable_box` before DataflowConstProp
++ // MIR for `unreachable_box` after DataflowConstProp
+
+ fn unreachable_box() -> ! {
+ let mut _0: !;
+ let _1: std::boxed::Box<Never>;
+ scope 1 {
+ debug x => _1;
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = const 1_usize as std::boxed::Box<Never> (Transmute);
++ _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global);
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..d0c298ba2
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff
@@ -0,0 +1,20 @@
+- // MIR for `unreachable_box` before DataflowConstProp
++ // MIR for `unreachable_box` after DataflowConstProp
+
+ fn unreachable_box() -> ! {
+ let mut _0: !;
+ let _1: std::boxed::Box<Never>;
+ scope 1 {
+ debug x => _1;
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = const 1_usize as std::boxed::Box<Never> (Transmute);
++ _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global);
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..acbb5cd1b
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.32bit.diff
@@ -0,0 +1,22 @@
+- // MIR for `unreachable_direct` before DataflowConstProp
++ // MIR for `unreachable_direct` after DataflowConstProp
+
+ fn unreachable_direct() -> ! {
+ let mut _0: !;
+ let _1: Never;
+ let mut _2: ();
+ scope 1 {
+ debug x => _1;
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = ();
+ _1 = move _2 as Never (Transmute);
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..acbb5cd1b
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.64bit.diff
@@ -0,0 +1,22 @@
+- // MIR for `unreachable_direct` before DataflowConstProp
++ // MIR for `unreachable_direct` after DataflowConstProp
+
+ fn unreachable_direct() -> ! {
+ let mut _0: !;
+ let _1: Never;
+ let mut _2: ();
+ scope 1 {
+ debug x => _1;
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = ();
+ _1 = move _2 as Never (Transmute);
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..2ffaeea72
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.32bit.diff
@@ -0,0 +1,24 @@
+- // MIR for `unreachable_mut` before DataflowConstProp
++ // MIR for `unreachable_mut` after DataflowConstProp
+
+ fn unreachable_mut() -> ! {
+ let mut _0: !;
+ let _1: &mut Never;
+ let mut _2: &mut Never;
+ scope 1 {
+ debug x => _1;
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+- _2 = const 1_usize as &mut Never (Transmute);
++ _2 = const {0x1 as &mut Never};
+ _1 = &mut (*_2);
+ StorageDead(_2);
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..2ffaeea72
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.64bit.diff
@@ -0,0 +1,24 @@
+- // MIR for `unreachable_mut` before DataflowConstProp
++ // MIR for `unreachable_mut` after DataflowConstProp
+
+ fn unreachable_mut() -> ! {
+ let mut _0: !;
+ let _1: &mut Never;
+ let mut _2: &mut Never;
+ scope 1 {
+ debug x => _1;
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+- _2 = const 1_usize as &mut Never (Transmute);
++ _2 = const {0x1 as &mut Never};
+ _1 = &mut (*_2);
+ StorageDead(_2);
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..31fcaafc5
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.32bit.diff
@@ -0,0 +1,20 @@
+- // MIR for `unreachable_ref` before DataflowConstProp
++ // MIR for `unreachable_ref` after DataflowConstProp
+
+ fn unreachable_ref() -> ! {
+ let mut _0: !;
+ let _1: &Never;
+ scope 1 {
+ debug x => _1;
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = const 1_usize as &Never (Transmute);
++ _1 = const {0x1 as &Never};
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..31fcaafc5
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.64bit.diff
@@ -0,0 +1,20 @@
+- // MIR for `unreachable_ref` before DataflowConstProp
++ // MIR for `unreachable_ref` after DataflowConstProp
+
+ fn unreachable_ref() -> ! {
+ let mut _0: !;
+ let _1: &Never;
+ scope 1 {
+ debug x => _1;
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = const 1_usize as &Never (Transmute);
++ _1 = const {0x1 as &Never};
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..402ef754a
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.32bit.diff
@@ -0,0 +1,15 @@
+- // MIR for `valid_char` before DataflowConstProp
++ // MIR for `valid_char` after DataflowConstProp
+
+ fn valid_char() -> char {
+ let mut _0: char;
+ scope 1 {
+ }
+
+ bb0: {
+- _0 = const 82_u32 as char (Transmute);
++ _0 = const 'R';
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..402ef754a
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.64bit.diff
@@ -0,0 +1,15 @@
+- // MIR for `valid_char` before DataflowConstProp
++ // MIR for `valid_char` after DataflowConstProp
+
+ fn valid_char() -> char {
+ let mut _0: char;
+ scope 1 {
+ }
+
+ bb0: {
+- _0 = const 82_u32 as char (Transmute);
++ _0 = const 'R';
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination.panic-abort.diff b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination.panic-abort.diff
new file mode 100644
index 000000000..dc0f90734
--- /dev/null
+++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination.panic-abort.diff
@@ -0,0 +1,15 @@
+- // MIR for `move_packed` before DeadStoreElimination
++ // MIR for `move_packed` after DeadStoreElimination
+
+ fn move_packed(_1: Packed) -> () {
+ let mut _0: ();
+
+ bb0: {
+ _0 = use_both(const 0_i32, (_1.1: i32)) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination.panic-unwind.diff b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination.panic-unwind.diff
new file mode 100644
index 000000000..86ef026ec
--- /dev/null
+++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination.panic-unwind.diff
@@ -0,0 +1,15 @@
+- // MIR for `move_packed` before DeadStoreElimination
++ // MIR for `move_packed` after DeadStoreElimination
+
+ fn move_packed(_1: Packed) -> () {
+ let mut _0: ();
+
+ bb0: {
+ _0 = use_both(const 0_i32, (_1.1: i32)) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dead-store-elimination/call_arg_copy.rs b/tests/mir-opt/dead-store-elimination/call_arg_copy.rs
index 41f91fc13..f09cdee14 100644
--- a/tests/mir-opt/dead-store-elimination/call_arg_copy.rs
+++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.rs
@@ -2,6 +2,12 @@
// unit-test: DeadStoreElimination
// compile-flags: -Zmir-enable-passes=+CopyProp
+#![feature(core_intrinsics)]
+#![feature(custom_mir)]
+#![allow(internal_features)]
+
+use std::intrinsics::mir::*;
+
#[inline(never)]
fn use_both(_: i32, _: i32) {}
@@ -10,6 +16,26 @@ fn move_simple(x: i32) {
use_both(x, x);
}
+#[repr(packed)]
+struct Packed {
+ x: u8,
+ y: i32,
+}
+
+// EMIT_MIR call_arg_copy.move_packed.DeadStoreElimination.diff
+#[custom_mir(dialect = "analysis")]
+fn move_packed(packed: Packed) {
+ mir!(
+ {
+ Call(RET = use_both(0, packed.y), ret)
+ }
+ ret = {
+ Return()
+ }
+ )
+}
+
fn main() {
move_simple(1);
+ move_packed(Packed { x: 0, y: 1 });
}
diff --git a/tests/mir-opt/derefer_inline_test.main.Derefer.panic-abort.diff b/tests/mir-opt/derefer_inline_test.main.Derefer.panic-abort.diff
index 024d9bc7f..8ac6acd0e 100644
--- a/tests/mir-opt/derefer_inline_test.main.Derefer.panic-abort.diff
+++ b/tests/mir-opt/derefer_inline_test.main.Derefer.panic-abort.diff
@@ -28,7 +28,7 @@
}
bb4 (cleanup): {
- drop(_2) -> [return: bb5, unwind terminate];
+ drop(_2) -> [return: bb5, unwind terminate(cleanup)];
}
bb5 (cleanup): {
diff --git a/tests/mir-opt/derefer_inline_test.main.Derefer.panic-unwind.diff b/tests/mir-opt/derefer_inline_test.main.Derefer.panic-unwind.diff
index 2ada087b4..aa9fcb505 100644
--- a/tests/mir-opt/derefer_inline_test.main.Derefer.panic-unwind.diff
+++ b/tests/mir-opt/derefer_inline_test.main.Derefer.panic-unwind.diff
@@ -28,7 +28,7 @@
}
bb4 (cleanup): {
- drop(_2) -> [return: bb5, unwind terminate];
+ drop(_2) -> [return: bb5, unwind terminate(cleanup)];
}
bb5 (cleanup): {
diff --git a/tests/mir-opt/dont_inline_type_id.call.Inline.diff b/tests/mir-opt/dont_inline_type_id.call.Inline.diff
new file mode 100644
index 000000000..80cfe07b0
--- /dev/null
+++ b/tests/mir-opt/dont_inline_type_id.call.Inline.diff
@@ -0,0 +1,20 @@
+- // MIR for `call` before Inline
++ // MIR for `call` after Inline
+
+ fn call(_1: &T) -> TypeId {
+ debug s => _1;
+ let mut _0: std::any::TypeId;
+ let mut _2: &T;
+
+ bb0: {
+ StorageLive(_2);
+ _2 = &(*_1);
+ _0 = <T as Any>::type_id(move _2) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dont_inline_type_id.rs b/tests/mir-opt/dont_inline_type_id.rs
new file mode 100644
index 000000000..d8a566360
--- /dev/null
+++ b/tests/mir-opt/dont_inline_type_id.rs
@@ -0,0 +1,15 @@
+// unit-test: Inline
+// compile-flags: --crate-type=lib -C panic=abort
+
+use std::any::Any;
+use std::any::TypeId;
+
+struct A<T: ?Sized + 'static> {
+ a: i32,
+ b: T,
+}
+
+// EMIT_MIR dont_inline_type_id.call.Inline.diff
+pub fn call<T: ?Sized + 'static>(s: &T) -> TypeId {
+ s.type_id()
+}
diff --git a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff
index 9d9a7a1e4..ec5f5c1f1 100644
--- a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff
+++ b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff
@@ -64,5 +64,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc15 (size: 8, align: 4) {
++ 02 00 00 00 05 20 00 00 │ ..... ..
}
diff --git a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff
index 9d9a7a1e4..9bf8637ec 100644
--- a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff
+++ b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff
@@ -64,5 +64,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc15 (size: 16, align: 8) {
++ 02 00 00 00 00 00 00 00 05 20 00 00 00 00 00 00 │ ......... ......
}
diff --git a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff
index 4306f38b8..7dc6d21a9 100644
--- a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff
+++ b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff
@@ -64,5 +64,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc14 (size: 8, align: 4) {
++ 05 20 00 00 01 00 00 00 │ . ......
}
diff --git a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff
index 4306f38b8..0b000876a 100644
--- a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff
+++ b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff
@@ -64,5 +64,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc14 (size: 16, align: 8) {
++ 05 20 00 00 00 00 00 00 01 00 00 00 00 00 00 00 │ . ..............
}
diff --git a/tests/mir-opt/equal_true.opt.InstSimplify.diff b/tests/mir-opt/equal_true.opt.InstSimplify.diff
index 7b38862e4..88a51000c 100644
--- a/tests/mir-opt/equal_true.opt.InstSimplify.diff
+++ b/tests/mir-opt/equal_true.opt.InstSimplify.diff
@@ -13,16 +13,17 @@
_3 = _1;
- _2 = Eq(move _3, const true);
+ _2 = move _3;
- StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
+ StorageDead(_3);
_0 = const 0_i32;
goto -> bb3;
}
bb2: {
+ StorageDead(_3);
_0 = const 1_i32;
goto -> bb3;
}
diff --git a/tests/mir-opt/funky_arms.rs b/tests/mir-opt/funky_arms.rs
index 6b4f4c805..79fd9457c 100644
--- a/tests/mir-opt/funky_arms.rs
+++ b/tests/mir-opt/funky_arms.rs
@@ -9,7 +9,7 @@ use core::num::flt2dec;
use std::fmt::{Formatter, Result};
// EMIT_MIR funky_arms.float_to_exponential_common.ConstProp.diff
-fn float_to_exponential_common<T>(fmt: &mut Formatter<'_>, num: &T, upper: bool) -> Result
+pub fn float_to_exponential_common<T>(fmt: &mut Formatter<'_>, num: &T, upper: bool) -> Result
where
T: flt2dec::DecodableFloat,
{
diff --git a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-abort.mir b/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-abort.mir
index 958078b97..d8bea1420 100644
--- a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-abort.mir
+++ b/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-abort.mir
@@ -21,7 +21,7 @@
},
} */
-fn main::{closure#0}(_1: *mut [generator@$DIR/generator_drop_cleanup.rs:10:15: 10:17]) -> () {
+fn main::{closure#0}(_1: *mut {generator@$DIR/generator_drop_cleanup.rs:10:15: 10:17}) -> () {
let mut _0: ();
let mut _2: ();
let _3: std::string::String;
diff --git a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.mir b/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.mir
index 7e050e585..d8b27eda8 100644
--- a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.mir
+++ b/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.mir
@@ -21,7 +21,7 @@
},
} */
-fn main::{closure#0}(_1: *mut [generator@$DIR/generator_drop_cleanup.rs:10:15: 10:17]) -> () {
+fn main::{closure#0}(_1: *mut {generator@$DIR/generator_drop_cleanup.rs:10:15: 10:17}) -> () {
let mut _0: ();
let mut _2: ();
let _3: std::string::String;
diff --git a/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir b/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir
index 25c656b3a..4587282de 100644
--- a/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir
+++ b/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir
@@ -1,6 +1,6 @@
// MIR for `main::{closure#0}` before StateTransform
-fn main::{closure#0}(_1: [generator@$DIR/generator_storage_dead_unwind.rs:22:16: 22:18], _2: ()) -> ()
+fn main::{closure#0}(_1: {generator@$DIR/generator_storage_dead_unwind.rs:22:16: 22:18}, _2: ()) -> ()
yields ()
{
let mut _0: ();
diff --git a/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir b/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir
index 6a4c5436f..38026f65b 100644
--- a/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir
+++ b/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir
@@ -1,6 +1,6 @@
// MIR for `main::{closure#0}` before StateTransform
-fn main::{closure#0}(_1: [generator@$DIR/generator_storage_dead_unwind.rs:22:16: 22:18], _2: ()) -> ()
+fn main::{closure#0}(_1: {generator@$DIR/generator_storage_dead_unwind.rs:22:16: 22:18}, _2: ()) -> ()
yields ()
{
let mut _0: ();
@@ -104,7 +104,7 @@ yields ()
bb13 (cleanup): {
StorageDead(_3);
- drop(_1) -> [return: bb14, unwind terminate];
+ drop(_1) -> [return: bb14, unwind terminate(cleanup)];
}
bb14 (cleanup): {
@@ -113,6 +113,6 @@ yields ()
bb15 (cleanup): {
StorageDead(_3);
- drop(_1) -> [return: bb14, unwind terminate];
+ drop(_1) -> [return: bb14, unwind terminate(cleanup)];
}
}
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 13d703b90..ac7549f93 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
@@ -21,7 +21,7 @@
},
} */
-fn main::{closure#0}(_1: Pin<&mut [generator@$DIR/generator_tiny.rs:19:16: 19:24]>, _2: u8) -> GeneratorState<(), ()> {
+fn main::{closure#0}(_1: Pin<&mut {generator@$DIR/generator_tiny.rs:19:16: 19:24}>, _2: u8) -> GeneratorState<(), ()> {
debug _x => _10;
let mut _0: std::ops::GeneratorState<(), ()>;
let _3: HasDrop;
@@ -34,18 +34,18 @@ fn main::{closure#0}(_1: Pin<&mut [generator@$DIR/generator_tiny.rs:19:16: 19:24
let _10: u8;
let mut _11: u32;
scope 1 {
- debug _d => (((*(_1.0: &mut [generator@$DIR/generator_tiny.rs:19:16: 19:24])) as variant#3).0: HasDrop);
+ debug _d => (((*(_1.0: &mut {generator@$DIR/generator_tiny.rs:19:16: 19:24})) as variant#3).0: HasDrop);
}
bb0: {
- _11 = discriminant((*(_1.0: &mut [generator@$DIR/generator_tiny.rs:19:16: 19:24])));
+ _11 = discriminant((*(_1.0: &mut {generator@$DIR/generator_tiny.rs:19:16: 19:24})));
switchInt(move _11) -> [0: bb1, 3: bb5, otherwise: bb6];
}
bb1: {
_10 = move _2;
nop;
- (((*(_1.0: &mut [generator@$DIR/generator_tiny.rs:19:16: 19:24])) as variant#3).0: HasDrop) = HasDrop;
+ (((*(_1.0: &mut {generator@$DIR/generator_tiny.rs:19:16: 19:24})) as variant#3).0: HasDrop) = HasDrop;
StorageLive(_4);
goto -> bb2;
}
@@ -55,7 +55,7 @@ fn main::{closure#0}(_1: Pin<&mut [generator@$DIR/generator_tiny.rs:19:16: 19:24
StorageLive(_7);
_7 = ();
_0 = GeneratorState::<(), ()>::Yielded(move _7);
- discriminant((*(_1.0: &mut [generator@$DIR/generator_tiny.rs:19:16: 19:24]))) = 3;
+ discriminant((*(_1.0: &mut {generator@$DIR/generator_tiny.rs:19:16: 19:24}))) = 3;
return;
}
diff --git a/tests/mir-opt/gvn.arithmetic.GVN.panic-abort.diff b/tests/mir-opt/gvn.arithmetic.GVN.panic-abort.diff
new file mode 100644
index 000000000..3f5173c18
--- /dev/null
+++ b/tests/mir-opt/gvn.arithmetic.GVN.panic-abort.diff
@@ -0,0 +1,342 @@
+- // MIR for `arithmetic` before GVN
++ // MIR for `arithmetic` after GVN
+
+ fn arithmetic(_1: u64) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: u64;
+ let mut _4: u64;
+ let _5: ();
+ let mut _6: u64;
+ let mut _7: u64;
+ let _8: ();
+ let mut _9: u64;
+ let mut _10: u64;
+ let _11: ();
+ let mut _12: u64;
+ let mut _13: u64;
+ let _14: ();
+ let mut _15: u64;
+ let mut _16: u64;
+ let mut _17: bool;
+ let _18: ();
+ let mut _19: u64;
+ let mut _20: u64;
+ let mut _21: bool;
+ let _22: ();
+ let mut _23: u64;
+ let mut _24: u64;
+ let mut _25: bool;
+ let _26: ();
+ let mut _27: u64;
+ let mut _28: u64;
+ let mut _29: bool;
+ let _30: ();
+ let mut _31: u64;
+ let mut _32: u64;
+ let mut _33: bool;
+ let _34: ();
+ let mut _35: u64;
+ let mut _36: u64;
+ let mut _37: bool;
+ let _38: ();
+ let mut _39: u64;
+ let mut _40: u64;
+ let mut _41: bool;
+ let _42: ();
+ let mut _43: u64;
+ let mut _44: u64;
+ let mut _45: bool;
+ let _46: ();
+ let mut _47: u64;
+ let mut _48: u64;
+ let _49: ();
+ let mut _50: u64;
+ let mut _51: u64;
+ let _52: ();
+ let mut _53: u64;
+ let mut _54: u64;
+ let _55: ();
+ let mut _56: u64;
+ let mut _57: u64;
+ let _58: ();
+ let mut _59: u64;
+ let mut _60: u64;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+- StorageLive(_4);
+- _4 = _1;
+- _3 = Add(move _4, const 0_u64);
+- StorageDead(_4);
++ _3 = Add(_1, const 0_u64);
+ _2 = opaque::<u64>(move _3) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_5);
+ StorageLive(_6);
+- StorageLive(_7);
+- _7 = _1;
+- _6 = Sub(move _7, const 0_u64);
+- StorageDead(_7);
++ _6 = Sub(_1, const 0_u64);
+ _5 = opaque::<u64>(move _6) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageLive(_8);
+ StorageLive(_9);
+- StorageLive(_10);
+- _10 = _1;
+- _9 = Mul(move _10, const 0_u64);
+- StorageDead(_10);
++ _9 = Mul(_1, const 0_u64);
+ _8 = opaque::<u64>(move _9) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_11);
+ StorageLive(_12);
+- StorageLive(_13);
+- _13 = _1;
+- _12 = Mul(move _13, const 1_u64);
+- StorageDead(_13);
++ _12 = Mul(_1, const 1_u64);
+ _11 = opaque::<u64>(move _12) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageLive(_14);
+ StorageLive(_15);
+- StorageLive(_16);
+- _16 = _1;
+ _17 = Eq(const 0_u64, const 0_u64);
+- assert(!move _17, "attempt to divide `{}` by zero", _16) -> [success: bb5, unwind unreachable];
++ assert(!_17, "attempt to divide `{}` by zero", _1) -> [success: bb5, unwind unreachable];
+ }
+
+ bb5: {
+- _15 = Div(move _16, const 0_u64);
+- StorageDead(_16);
++ _15 = Div(_1, const 0_u64);
+ _14 = opaque::<u64>(move _15) -> [return: bb6, unwind unreachable];
+ }
+
+ bb6: {
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_18);
+ StorageLive(_19);
+- StorageLive(_20);
+- _20 = _1;
+ _21 = Eq(const 1_u64, const 0_u64);
+- assert(!move _21, "attempt to divide `{}` by zero", _20) -> [success: bb7, unwind unreachable];
++ assert(!_21, "attempt to divide `{}` by zero", _1) -> [success: bb7, unwind unreachable];
+ }
+
+ bb7: {
+- _19 = Div(move _20, const 1_u64);
+- StorageDead(_20);
++ _19 = Div(_1, const 1_u64);
+ _18 = opaque::<u64>(move _19) -> [return: bb8, unwind unreachable];
+ }
+
+ bb8: {
+ StorageDead(_19);
+ StorageDead(_18);
+ StorageLive(_22);
+ StorageLive(_23);
+- StorageLive(_24);
+- _24 = _1;
+- _25 = Eq(_24, const 0_u64);
+- assert(!move _25, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb9, unwind unreachable];
++ _25 = Eq(_1, const 0_u64);
++ assert(!_25, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb9, unwind unreachable];
+ }
+
+ bb9: {
+- _23 = Div(const 0_u64, move _24);
+- StorageDead(_24);
++ _23 = Div(const 0_u64, _1);
+ _22 = opaque::<u64>(move _23) -> [return: bb10, unwind unreachable];
+ }
+
+ bb10: {
+ StorageDead(_23);
+ StorageDead(_22);
+ StorageLive(_26);
+ StorageLive(_27);
+- StorageLive(_28);
+- _28 = _1;
+- _29 = Eq(_28, const 0_u64);
+- assert(!move _29, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb11, unwind unreachable];
++ assert(!_25, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb11, unwind unreachable];
+ }
+
+ bb11: {
+- _27 = Div(const 1_u64, move _28);
+- StorageDead(_28);
++ _27 = Div(const 1_u64, _1);
+ _26 = opaque::<u64>(move _27) -> [return: bb12, unwind unreachable];
+ }
+
+ bb12: {
+ StorageDead(_27);
+ StorageDead(_26);
+ StorageLive(_30);
+ StorageLive(_31);
+- StorageLive(_32);
+- _32 = _1;
+- _33 = Eq(const 0_u64, const 0_u64);
+- assert(!move _33, "attempt to calculate the remainder of `{}` with a divisor of zero", _32) -> [success: bb13, unwind unreachable];
++ assert(!_17, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb13, unwind unreachable];
+ }
+
+ bb13: {
+- _31 = Rem(move _32, const 0_u64);
+- StorageDead(_32);
++ _31 = Rem(_1, const 0_u64);
+ _30 = opaque::<u64>(move _31) -> [return: bb14, unwind unreachable];
+ }
+
+ bb14: {
+ StorageDead(_31);
+ StorageDead(_30);
+ StorageLive(_34);
+ StorageLive(_35);
+- StorageLive(_36);
+- _36 = _1;
+- _37 = Eq(const 1_u64, const 0_u64);
+- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", _36) -> [success: bb15, unwind unreachable];
++ assert(!_21, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb15, unwind unreachable];
+ }
+
+ bb15: {
+- _35 = Rem(move _36, const 1_u64);
+- StorageDead(_36);
++ _35 = Rem(_1, const 1_u64);
+ _34 = opaque::<u64>(move _35) -> [return: bb16, unwind unreachable];
+ }
+
+ bb16: {
+ StorageDead(_35);
+ StorageDead(_34);
+ StorageLive(_38);
+ StorageLive(_39);
+- StorageLive(_40);
+- _40 = _1;
+- _41 = Eq(_40, const 0_u64);
+- assert(!move _41, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb17, unwind unreachable];
++ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb17, unwind unreachable];
+ }
+
+ bb17: {
+- _39 = Rem(const 0_u64, move _40);
+- StorageDead(_40);
++ _39 = Rem(const 0_u64, _1);
+ _38 = opaque::<u64>(move _39) -> [return: bb18, unwind unreachable];
+ }
+
+ bb18: {
+ StorageDead(_39);
+ StorageDead(_38);
+ StorageLive(_42);
+ StorageLive(_43);
+- StorageLive(_44);
+- _44 = _1;
+- _45 = Eq(_44, const 0_u64);
+- assert(!move _45, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb19, unwind unreachable];
++ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb19, unwind unreachable];
+ }
+
+ bb19: {
+- _43 = Rem(const 1_u64, move _44);
+- StorageDead(_44);
++ _43 = Rem(const 1_u64, _1);
+ _42 = opaque::<u64>(move _43) -> [return: bb20, unwind unreachable];
+ }
+
+ bb20: {
+ StorageDead(_43);
+ StorageDead(_42);
+ StorageLive(_46);
+ StorageLive(_47);
+- StorageLive(_48);
+- _48 = _1;
+- _47 = BitAnd(move _48, const 0_u64);
+- StorageDead(_48);
++ _47 = BitAnd(_1, const 0_u64);
+ _46 = opaque::<u64>(move _47) -> [return: bb21, unwind unreachable];
+ }
+
+ bb21: {
+ StorageDead(_47);
+ StorageDead(_46);
+ StorageLive(_49);
+ StorageLive(_50);
+- StorageLive(_51);
+- _51 = _1;
+- _50 = BitOr(move _51, const 0_u64);
+- StorageDead(_51);
++ _50 = BitOr(_1, const 0_u64);
+ _49 = opaque::<u64>(move _50) -> [return: bb22, unwind unreachable];
+ }
+
+ bb22: {
+ StorageDead(_50);
+ StorageDead(_49);
+ StorageLive(_52);
+ StorageLive(_53);
+- StorageLive(_54);
+- _54 = _1;
+- _53 = BitXor(move _54, const 0_u64);
+- StorageDead(_54);
++ _53 = BitXor(_1, const 0_u64);
+ _52 = opaque::<u64>(move _53) -> [return: bb23, unwind unreachable];
+ }
+
+ bb23: {
+ StorageDead(_53);
+ StorageDead(_52);
+ StorageLive(_55);
+ StorageLive(_56);
+- StorageLive(_57);
+- _57 = _1;
+- _56 = Shr(move _57, const 0_i32);
+- StorageDead(_57);
++ _56 = Shr(_1, const 0_i32);
+ _55 = opaque::<u64>(move _56) -> [return: bb24, unwind unreachable];
+ }
+
+ bb24: {
+ StorageDead(_56);
+ StorageDead(_55);
+ StorageLive(_58);
+ StorageLive(_59);
+- StorageLive(_60);
+- _60 = _1;
+- _59 = Shl(move _60, const 0_i32);
+- StorageDead(_60);
++ _59 = Shl(_1, const 0_i32);
+ _58 = opaque::<u64>(move _59) -> [return: bb25, unwind unreachable];
+ }
+
+ bb25: {
+ StorageDead(_59);
+ StorageDead(_58);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff b/tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff
new file mode 100644
index 000000000..38da21d91
--- /dev/null
+++ b/tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff
@@ -0,0 +1,342 @@
+- // MIR for `arithmetic` before GVN
++ // MIR for `arithmetic` after GVN
+
+ fn arithmetic(_1: u64) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: u64;
+ let mut _4: u64;
+ let _5: ();
+ let mut _6: u64;
+ let mut _7: u64;
+ let _8: ();
+ let mut _9: u64;
+ let mut _10: u64;
+ let _11: ();
+ let mut _12: u64;
+ let mut _13: u64;
+ let _14: ();
+ let mut _15: u64;
+ let mut _16: u64;
+ let mut _17: bool;
+ let _18: ();
+ let mut _19: u64;
+ let mut _20: u64;
+ let mut _21: bool;
+ let _22: ();
+ let mut _23: u64;
+ let mut _24: u64;
+ let mut _25: bool;
+ let _26: ();
+ let mut _27: u64;
+ let mut _28: u64;
+ let mut _29: bool;
+ let _30: ();
+ let mut _31: u64;
+ let mut _32: u64;
+ let mut _33: bool;
+ let _34: ();
+ let mut _35: u64;
+ let mut _36: u64;
+ let mut _37: bool;
+ let _38: ();
+ let mut _39: u64;
+ let mut _40: u64;
+ let mut _41: bool;
+ let _42: ();
+ let mut _43: u64;
+ let mut _44: u64;
+ let mut _45: bool;
+ let _46: ();
+ let mut _47: u64;
+ let mut _48: u64;
+ let _49: ();
+ let mut _50: u64;
+ let mut _51: u64;
+ let _52: ();
+ let mut _53: u64;
+ let mut _54: u64;
+ let _55: ();
+ let mut _56: u64;
+ let mut _57: u64;
+ let _58: ();
+ let mut _59: u64;
+ let mut _60: u64;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+- StorageLive(_4);
+- _4 = _1;
+- _3 = Add(move _4, const 0_u64);
+- StorageDead(_4);
++ _3 = Add(_1, const 0_u64);
+ _2 = opaque::<u64>(move _3) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_5);
+ StorageLive(_6);
+- StorageLive(_7);
+- _7 = _1;
+- _6 = Sub(move _7, const 0_u64);
+- StorageDead(_7);
++ _6 = Sub(_1, const 0_u64);
+ _5 = opaque::<u64>(move _6) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageLive(_8);
+ StorageLive(_9);
+- StorageLive(_10);
+- _10 = _1;
+- _9 = Mul(move _10, const 0_u64);
+- StorageDead(_10);
++ _9 = Mul(_1, const 0_u64);
+ _8 = opaque::<u64>(move _9) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_11);
+ StorageLive(_12);
+- StorageLive(_13);
+- _13 = _1;
+- _12 = Mul(move _13, const 1_u64);
+- StorageDead(_13);
++ _12 = Mul(_1, const 1_u64);
+ _11 = opaque::<u64>(move _12) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageLive(_14);
+ StorageLive(_15);
+- StorageLive(_16);
+- _16 = _1;
+ _17 = Eq(const 0_u64, const 0_u64);
+- assert(!move _17, "attempt to divide `{}` by zero", _16) -> [success: bb5, unwind continue];
++ assert(!_17, "attempt to divide `{}` by zero", _1) -> [success: bb5, unwind continue];
+ }
+
+ bb5: {
+- _15 = Div(move _16, const 0_u64);
+- StorageDead(_16);
++ _15 = Div(_1, const 0_u64);
+ _14 = opaque::<u64>(move _15) -> [return: bb6, unwind continue];
+ }
+
+ bb6: {
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_18);
+ StorageLive(_19);
+- StorageLive(_20);
+- _20 = _1;
+ _21 = Eq(const 1_u64, const 0_u64);
+- assert(!move _21, "attempt to divide `{}` by zero", _20) -> [success: bb7, unwind continue];
++ assert(!_21, "attempt to divide `{}` by zero", _1) -> [success: bb7, unwind continue];
+ }
+
+ bb7: {
+- _19 = Div(move _20, const 1_u64);
+- StorageDead(_20);
++ _19 = Div(_1, const 1_u64);
+ _18 = opaque::<u64>(move _19) -> [return: bb8, unwind continue];
+ }
+
+ bb8: {
+ StorageDead(_19);
+ StorageDead(_18);
+ StorageLive(_22);
+ StorageLive(_23);
+- StorageLive(_24);
+- _24 = _1;
+- _25 = Eq(_24, const 0_u64);
+- assert(!move _25, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb9, unwind continue];
++ _25 = Eq(_1, const 0_u64);
++ assert(!_25, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb9, unwind continue];
+ }
+
+ bb9: {
+- _23 = Div(const 0_u64, move _24);
+- StorageDead(_24);
++ _23 = Div(const 0_u64, _1);
+ _22 = opaque::<u64>(move _23) -> [return: bb10, unwind continue];
+ }
+
+ bb10: {
+ StorageDead(_23);
+ StorageDead(_22);
+ StorageLive(_26);
+ StorageLive(_27);
+- StorageLive(_28);
+- _28 = _1;
+- _29 = Eq(_28, const 0_u64);
+- assert(!move _29, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb11, unwind continue];
++ assert(!_25, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb11, unwind continue];
+ }
+
+ bb11: {
+- _27 = Div(const 1_u64, move _28);
+- StorageDead(_28);
++ _27 = Div(const 1_u64, _1);
+ _26 = opaque::<u64>(move _27) -> [return: bb12, unwind continue];
+ }
+
+ bb12: {
+ StorageDead(_27);
+ StorageDead(_26);
+ StorageLive(_30);
+ StorageLive(_31);
+- StorageLive(_32);
+- _32 = _1;
+- _33 = Eq(const 0_u64, const 0_u64);
+- assert(!move _33, "attempt to calculate the remainder of `{}` with a divisor of zero", _32) -> [success: bb13, unwind continue];
++ assert(!_17, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb13, unwind continue];
+ }
+
+ bb13: {
+- _31 = Rem(move _32, const 0_u64);
+- StorageDead(_32);
++ _31 = Rem(_1, const 0_u64);
+ _30 = opaque::<u64>(move _31) -> [return: bb14, unwind continue];
+ }
+
+ bb14: {
+ StorageDead(_31);
+ StorageDead(_30);
+ StorageLive(_34);
+ StorageLive(_35);
+- StorageLive(_36);
+- _36 = _1;
+- _37 = Eq(const 1_u64, const 0_u64);
+- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", _36) -> [success: bb15, unwind continue];
++ assert(!_21, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb15, unwind continue];
+ }
+
+ bb15: {
+- _35 = Rem(move _36, const 1_u64);
+- StorageDead(_36);
++ _35 = Rem(_1, const 1_u64);
+ _34 = opaque::<u64>(move _35) -> [return: bb16, unwind continue];
+ }
+
+ bb16: {
+ StorageDead(_35);
+ StorageDead(_34);
+ StorageLive(_38);
+ StorageLive(_39);
+- StorageLive(_40);
+- _40 = _1;
+- _41 = Eq(_40, const 0_u64);
+- assert(!move _41, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb17, unwind continue];
++ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb17, unwind continue];
+ }
+
+ bb17: {
+- _39 = Rem(const 0_u64, move _40);
+- StorageDead(_40);
++ _39 = Rem(const 0_u64, _1);
+ _38 = opaque::<u64>(move _39) -> [return: bb18, unwind continue];
+ }
+
+ bb18: {
+ StorageDead(_39);
+ StorageDead(_38);
+ StorageLive(_42);
+ StorageLive(_43);
+- StorageLive(_44);
+- _44 = _1;
+- _45 = Eq(_44, const 0_u64);
+- assert(!move _45, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb19, unwind continue];
++ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb19, unwind continue];
+ }
+
+ bb19: {
+- _43 = Rem(const 1_u64, move _44);
+- StorageDead(_44);
++ _43 = Rem(const 1_u64, _1);
+ _42 = opaque::<u64>(move _43) -> [return: bb20, unwind continue];
+ }
+
+ bb20: {
+ StorageDead(_43);
+ StorageDead(_42);
+ StorageLive(_46);
+ StorageLive(_47);
+- StorageLive(_48);
+- _48 = _1;
+- _47 = BitAnd(move _48, const 0_u64);
+- StorageDead(_48);
++ _47 = BitAnd(_1, const 0_u64);
+ _46 = opaque::<u64>(move _47) -> [return: bb21, unwind continue];
+ }
+
+ bb21: {
+ StorageDead(_47);
+ StorageDead(_46);
+ StorageLive(_49);
+ StorageLive(_50);
+- StorageLive(_51);
+- _51 = _1;
+- _50 = BitOr(move _51, const 0_u64);
+- StorageDead(_51);
++ _50 = BitOr(_1, const 0_u64);
+ _49 = opaque::<u64>(move _50) -> [return: bb22, unwind continue];
+ }
+
+ bb22: {
+ StorageDead(_50);
+ StorageDead(_49);
+ StorageLive(_52);
+ StorageLive(_53);
+- StorageLive(_54);
+- _54 = _1;
+- _53 = BitXor(move _54, const 0_u64);
+- StorageDead(_54);
++ _53 = BitXor(_1, const 0_u64);
+ _52 = opaque::<u64>(move _53) -> [return: bb23, unwind continue];
+ }
+
+ bb23: {
+ StorageDead(_53);
+ StorageDead(_52);
+ StorageLive(_55);
+ StorageLive(_56);
+- StorageLive(_57);
+- _57 = _1;
+- _56 = Shr(move _57, const 0_i32);
+- StorageDead(_57);
++ _56 = Shr(_1, const 0_i32);
+ _55 = opaque::<u64>(move _56) -> [return: bb24, unwind continue];
+ }
+
+ bb24: {
+ StorageDead(_56);
+ StorageDead(_55);
+ StorageLive(_58);
+ StorageLive(_59);
+- StorageLive(_60);
+- _60 = _1;
+- _59 = Shl(move _60, const 0_i32);
+- StorageDead(_60);
++ _59 = Shl(_1, const 0_i32);
+ _58 = opaque::<u64>(move _59) -> [return: bb25, unwind continue];
+ }
+
+ bb25: {
+ StorageDead(_59);
+ StorageDead(_58);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff b/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff
new file mode 100644
index 000000000..0c342799e
--- /dev/null
+++ b/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff
@@ -0,0 +1,389 @@
+- // MIR for `arithmetic_checked` before GVN
++ // MIR for `arithmetic_checked` after GVN
+
+ fn arithmetic_checked(_1: u64) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: u64;
+ let mut _4: u64;
+ let mut _5: (u64, bool);
+ let _6: ();
+ let mut _7: u64;
+ let mut _8: u64;
+ let mut _9: (u64, bool);
+ let _10: ();
+ let mut _11: u64;
+ let mut _12: u64;
+ let mut _13: (u64, bool);
+ let _14: ();
+ let mut _15: u64;
+ let mut _16: u64;
+ let mut _17: (u64, bool);
+ let _18: ();
+ let mut _19: u64;
+ let mut _20: u64;
+ let mut _21: bool;
+ let _22: ();
+ let mut _23: u64;
+ let mut _24: u64;
+ let mut _25: bool;
+ let _26: ();
+ let mut _27: u64;
+ let mut _28: u64;
+ let mut _29: bool;
+ let _30: ();
+ let mut _31: u64;
+ let mut _32: u64;
+ let mut _33: bool;
+ let _34: ();
+ let mut _35: u64;
+ let mut _36: u64;
+ let mut _37: bool;
+ let _38: ();
+ let mut _39: u64;
+ let mut _40: u64;
+ let mut _41: bool;
+ let _42: ();
+ let mut _43: u64;
+ let mut _44: u64;
+ let mut _45: bool;
+ let _46: ();
+ let mut _47: u64;
+ let mut _48: u64;
+ let mut _49: bool;
+ let _50: ();
+ let mut _51: u64;
+ let mut _52: u64;
+ let _53: ();
+ let mut _54: u64;
+ let mut _55: u64;
+ let _56: ();
+ let mut _57: u64;
+ let mut _58: u64;
+ let _59: ();
+ let mut _60: u64;
+ let mut _61: u64;
+ let mut _62: u32;
+ let mut _63: bool;
+ let _64: ();
+ let mut _65: u64;
+ let mut _66: u64;
+ let mut _67: u32;
+ let mut _68: bool;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+- StorageLive(_4);
+- _4 = _1;
+- _5 = CheckedAdd(_4, const 0_u64);
+- assert(!move (_5.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, const 0_u64) -> [success: bb1, unwind unreachable];
++ _5 = CheckedAdd(_1, const 0_u64);
++ assert(!move (_5.1: bool), "attempt to compute `{} + {}`, which would overflow", _1, const 0_u64) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ _3 = move (_5.0: u64);
+- StorageDead(_4);
+ _2 = opaque::<u64>(move _3) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_6);
+ StorageLive(_7);
+- StorageLive(_8);
+- _8 = _1;
+- _9 = CheckedSub(_8, const 0_u64);
+- assert(!move (_9.1: bool), "attempt to compute `{} - {}`, which would overflow", move _8, const 0_u64) -> [success: bb3, unwind unreachable];
++ _9 = CheckedSub(_1, const 0_u64);
++ assert(!move (_9.1: bool), "attempt to compute `{} - {}`, which would overflow", _1, const 0_u64) -> [success: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ _7 = move (_9.0: u64);
+- StorageDead(_8);
+ _6 = opaque::<u64>(move _7) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageLive(_10);
+ StorageLive(_11);
+- StorageLive(_12);
+- _12 = _1;
+- _13 = CheckedMul(_12, const 0_u64);
+- assert(!move (_13.1: bool), "attempt to compute `{} * {}`, which would overflow", move _12, const 0_u64) -> [success: bb5, unwind unreachable];
++ _13 = CheckedMul(_1, const 0_u64);
++ assert(!move (_13.1: bool), "attempt to compute `{} * {}`, which would overflow", _1, const 0_u64) -> [success: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ _11 = move (_13.0: u64);
+- StorageDead(_12);
+ _10 = opaque::<u64>(move _11) -> [return: bb6, unwind unreachable];
+ }
+
+ bb6: {
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageLive(_14);
+ StorageLive(_15);
+- StorageLive(_16);
+- _16 = _1;
+- _17 = CheckedMul(_16, const 1_u64);
+- assert(!move (_17.1: bool), "attempt to compute `{} * {}`, which would overflow", move _16, const 1_u64) -> [success: bb7, unwind unreachable];
++ _17 = CheckedMul(_1, const 1_u64);
++ assert(!move (_17.1: bool), "attempt to compute `{} * {}`, which would overflow", _1, const 1_u64) -> [success: bb7, unwind unreachable];
+ }
+
+ bb7: {
+ _15 = move (_17.0: u64);
+- StorageDead(_16);
+ _14 = opaque::<u64>(move _15) -> [return: bb8, unwind unreachable];
+ }
+
+ bb8: {
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_18);
+ StorageLive(_19);
+- StorageLive(_20);
+- _20 = _1;
+ _21 = Eq(const 0_u64, const 0_u64);
+- assert(!move _21, "attempt to divide `{}` by zero", _20) -> [success: bb9, unwind unreachable];
++ assert(!_21, "attempt to divide `{}` by zero", _1) -> [success: bb9, unwind unreachable];
+ }
+
+ bb9: {
+- _19 = Div(move _20, const 0_u64);
+- StorageDead(_20);
++ _19 = Div(_1, const 0_u64);
+ _18 = opaque::<u64>(move _19) -> [return: bb10, unwind unreachable];
+ }
+
+ bb10: {
+ StorageDead(_19);
+ StorageDead(_18);
+ StorageLive(_22);
+ StorageLive(_23);
+- StorageLive(_24);
+- _24 = _1;
+ _25 = Eq(const 1_u64, const 0_u64);
+- assert(!move _25, "attempt to divide `{}` by zero", _24) -> [success: bb11, unwind unreachable];
++ assert(!_25, "attempt to divide `{}` by zero", _1) -> [success: bb11, unwind unreachable];
+ }
+
+ bb11: {
+- _23 = Div(move _24, const 1_u64);
+- StorageDead(_24);
++ _23 = Div(_1, const 1_u64);
+ _22 = opaque::<u64>(move _23) -> [return: bb12, unwind unreachable];
+ }
+
+ bb12: {
+ StorageDead(_23);
+ StorageDead(_22);
+ StorageLive(_26);
+ StorageLive(_27);
+- StorageLive(_28);
+- _28 = _1;
+- _29 = Eq(_28, const 0_u64);
+- assert(!move _29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb13, unwind unreachable];
++ _29 = Eq(_1, const 0_u64);
++ assert(!_29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb13, unwind unreachable];
+ }
+
+ bb13: {
+- _27 = Div(const 0_u64, move _28);
+- StorageDead(_28);
++ _27 = Div(const 0_u64, _1);
+ _26 = opaque::<u64>(move _27) -> [return: bb14, unwind unreachable];
+ }
+
+ bb14: {
+ StorageDead(_27);
+ StorageDead(_26);
+ StorageLive(_30);
+ StorageLive(_31);
+- StorageLive(_32);
+- _32 = _1;
+- _33 = Eq(_32, const 0_u64);
+- assert(!move _33, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb15, unwind unreachable];
++ assert(!_29, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb15, unwind unreachable];
+ }
+
+ bb15: {
+- _31 = Div(const 1_u64, move _32);
+- StorageDead(_32);
++ _31 = Div(const 1_u64, _1);
+ _30 = opaque::<u64>(move _31) -> [return: bb16, unwind unreachable];
+ }
+
+ bb16: {
+ StorageDead(_31);
+ StorageDead(_30);
+ StorageLive(_34);
+ StorageLive(_35);
+- StorageLive(_36);
+- _36 = _1;
+- _37 = Eq(const 0_u64, const 0_u64);
+- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", _36) -> [success: bb17, unwind unreachable];
++ assert(!_21, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb17, unwind unreachable];
+ }
+
+ bb17: {
+- _35 = Rem(move _36, const 0_u64);
+- StorageDead(_36);
++ _35 = Rem(_1, const 0_u64);
+ _34 = opaque::<u64>(move _35) -> [return: bb18, unwind unreachable];
+ }
+
+ bb18: {
+ StorageDead(_35);
+ StorageDead(_34);
+ StorageLive(_38);
+ StorageLive(_39);
+- StorageLive(_40);
+- _40 = _1;
+- _41 = Eq(const 1_u64, const 0_u64);
+- assert(!move _41, "attempt to calculate the remainder of `{}` with a divisor of zero", _40) -> [success: bb19, unwind unreachable];
++ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb19, unwind unreachable];
+ }
+
+ bb19: {
+- _39 = Rem(move _40, const 1_u64);
+- StorageDead(_40);
++ _39 = Rem(_1, const 1_u64);
+ _38 = opaque::<u64>(move _39) -> [return: bb20, unwind unreachable];
+ }
+
+ bb20: {
+ StorageDead(_39);
+ StorageDead(_38);
+ StorageLive(_42);
+ StorageLive(_43);
+- StorageLive(_44);
+- _44 = _1;
+- _45 = Eq(_44, const 0_u64);
+- assert(!move _45, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb21, unwind unreachable];
++ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb21, unwind unreachable];
+ }
+
+ bb21: {
+- _43 = Rem(const 0_u64, move _44);
+- StorageDead(_44);
++ _43 = Rem(const 0_u64, _1);
+ _42 = opaque::<u64>(move _43) -> [return: bb22, unwind unreachable];
+ }
+
+ bb22: {
+ StorageDead(_43);
+ StorageDead(_42);
+ StorageLive(_46);
+ StorageLive(_47);
+- StorageLive(_48);
+- _48 = _1;
+- _49 = Eq(_48, const 0_u64);
+- assert(!move _49, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb23, unwind unreachable];
++ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb23, unwind unreachable];
+ }
+
+ bb23: {
+- _47 = Rem(const 1_u64, move _48);
+- StorageDead(_48);
++ _47 = Rem(const 1_u64, _1);
+ _46 = opaque::<u64>(move _47) -> [return: bb24, unwind unreachable];
+ }
+
+ bb24: {
+ StorageDead(_47);
+ StorageDead(_46);
+ StorageLive(_50);
+ StorageLive(_51);
+- StorageLive(_52);
+- _52 = _1;
+- _51 = BitAnd(move _52, const 0_u64);
+- StorageDead(_52);
++ _51 = BitAnd(_1, const 0_u64);
+ _50 = opaque::<u64>(move _51) -> [return: bb25, unwind unreachable];
+ }
+
+ bb25: {
+ StorageDead(_51);
+ StorageDead(_50);
+ StorageLive(_53);
+ StorageLive(_54);
+- StorageLive(_55);
+- _55 = _1;
+- _54 = BitOr(move _55, const 0_u64);
+- StorageDead(_55);
++ _54 = BitOr(_1, const 0_u64);
+ _53 = opaque::<u64>(move _54) -> [return: bb26, unwind unreachable];
+ }
+
+ bb26: {
+ StorageDead(_54);
+ StorageDead(_53);
+ StorageLive(_56);
+ StorageLive(_57);
+- StorageLive(_58);
+- _58 = _1;
+- _57 = BitXor(move _58, const 0_u64);
+- StorageDead(_58);
++ _57 = BitXor(_1, const 0_u64);
+ _56 = opaque::<u64>(move _57) -> [return: bb27, unwind unreachable];
+ }
+
+ bb27: {
+ StorageDead(_57);
+ StorageDead(_56);
+ StorageLive(_59);
+ StorageLive(_60);
+- StorageLive(_61);
+- _61 = _1;
+ _62 = const 0_i32 as u32 (IntToInt);
+- _63 = Lt(move _62, const 64_u32);
+- assert(move _63, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb28, unwind unreachable];
++ _63 = Lt(_62, const 64_u32);
++ assert(_63, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb28, unwind unreachable];
+ }
+
+ bb28: {
+- _60 = Shr(move _61, const 0_i32);
+- StorageDead(_61);
++ _60 = Shr(_1, const 0_i32);
+ _59 = opaque::<u64>(move _60) -> [return: bb29, unwind unreachable];
+ }
+
+ bb29: {
+ StorageDead(_60);
+ StorageDead(_59);
+ StorageLive(_64);
+ StorageLive(_65);
+- StorageLive(_66);
+- _66 = _1;
+- _67 = const 0_i32 as u32 (IntToInt);
+- _68 = Lt(move _67, const 64_u32);
+- assert(move _68, "attempt to shift left by `{}`, which would overflow", const 0_i32) -> [success: bb30, unwind unreachable];
++ assert(_63, "attempt to shift left by `{}`, which would overflow", const 0_i32) -> [success: bb30, unwind unreachable];
+ }
+
+ bb30: {
+- _65 = Shl(move _66, const 0_i32);
+- StorageDead(_66);
++ _65 = Shl(_1, const 0_i32);
+ _64 = opaque::<u64>(move _65) -> [return: bb31, unwind unreachable];
+ }
+
+ bb31: {
+ StorageDead(_65);
+ StorageDead(_64);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff b/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff
new file mode 100644
index 000000000..7813c29b9
--- /dev/null
+++ b/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff
@@ -0,0 +1,389 @@
+- // MIR for `arithmetic_checked` before GVN
++ // MIR for `arithmetic_checked` after GVN
+
+ fn arithmetic_checked(_1: u64) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: u64;
+ let mut _4: u64;
+ let mut _5: (u64, bool);
+ let _6: ();
+ let mut _7: u64;
+ let mut _8: u64;
+ let mut _9: (u64, bool);
+ let _10: ();
+ let mut _11: u64;
+ let mut _12: u64;
+ let mut _13: (u64, bool);
+ let _14: ();
+ let mut _15: u64;
+ let mut _16: u64;
+ let mut _17: (u64, bool);
+ let _18: ();
+ let mut _19: u64;
+ let mut _20: u64;
+ let mut _21: bool;
+ let _22: ();
+ let mut _23: u64;
+ let mut _24: u64;
+ let mut _25: bool;
+ let _26: ();
+ let mut _27: u64;
+ let mut _28: u64;
+ let mut _29: bool;
+ let _30: ();
+ let mut _31: u64;
+ let mut _32: u64;
+ let mut _33: bool;
+ let _34: ();
+ let mut _35: u64;
+ let mut _36: u64;
+ let mut _37: bool;
+ let _38: ();
+ let mut _39: u64;
+ let mut _40: u64;
+ let mut _41: bool;
+ let _42: ();
+ let mut _43: u64;
+ let mut _44: u64;
+ let mut _45: bool;
+ let _46: ();
+ let mut _47: u64;
+ let mut _48: u64;
+ let mut _49: bool;
+ let _50: ();
+ let mut _51: u64;
+ let mut _52: u64;
+ let _53: ();
+ let mut _54: u64;
+ let mut _55: u64;
+ let _56: ();
+ let mut _57: u64;
+ let mut _58: u64;
+ let _59: ();
+ let mut _60: u64;
+ let mut _61: u64;
+ let mut _62: u32;
+ let mut _63: bool;
+ let _64: ();
+ let mut _65: u64;
+ let mut _66: u64;
+ let mut _67: u32;
+ let mut _68: bool;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+- StorageLive(_4);
+- _4 = _1;
+- _5 = CheckedAdd(_4, const 0_u64);
+- assert(!move (_5.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, const 0_u64) -> [success: bb1, unwind continue];
++ _5 = CheckedAdd(_1, const 0_u64);
++ assert(!move (_5.1: bool), "attempt to compute `{} + {}`, which would overflow", _1, const 0_u64) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+ _3 = move (_5.0: u64);
+- StorageDead(_4);
+ _2 = opaque::<u64>(move _3) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_6);
+ StorageLive(_7);
+- StorageLive(_8);
+- _8 = _1;
+- _9 = CheckedSub(_8, const 0_u64);
+- assert(!move (_9.1: bool), "attempt to compute `{} - {}`, which would overflow", move _8, const 0_u64) -> [success: bb3, unwind continue];
++ _9 = CheckedSub(_1, const 0_u64);
++ assert(!move (_9.1: bool), "attempt to compute `{} - {}`, which would overflow", _1, const 0_u64) -> [success: bb3, unwind continue];
+ }
+
+ bb3: {
+ _7 = move (_9.0: u64);
+- StorageDead(_8);
+ _6 = opaque::<u64>(move _7) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageLive(_10);
+ StorageLive(_11);
+- StorageLive(_12);
+- _12 = _1;
+- _13 = CheckedMul(_12, const 0_u64);
+- assert(!move (_13.1: bool), "attempt to compute `{} * {}`, which would overflow", move _12, const 0_u64) -> [success: bb5, unwind continue];
++ _13 = CheckedMul(_1, const 0_u64);
++ assert(!move (_13.1: bool), "attempt to compute `{} * {}`, which would overflow", _1, const 0_u64) -> [success: bb5, unwind continue];
+ }
+
+ bb5: {
+ _11 = move (_13.0: u64);
+- StorageDead(_12);
+ _10 = opaque::<u64>(move _11) -> [return: bb6, unwind continue];
+ }
+
+ bb6: {
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageLive(_14);
+ StorageLive(_15);
+- StorageLive(_16);
+- _16 = _1;
+- _17 = CheckedMul(_16, const 1_u64);
+- assert(!move (_17.1: bool), "attempt to compute `{} * {}`, which would overflow", move _16, const 1_u64) -> [success: bb7, unwind continue];
++ _17 = CheckedMul(_1, const 1_u64);
++ assert(!move (_17.1: bool), "attempt to compute `{} * {}`, which would overflow", _1, const 1_u64) -> [success: bb7, unwind continue];
+ }
+
+ bb7: {
+ _15 = move (_17.0: u64);
+- StorageDead(_16);
+ _14 = opaque::<u64>(move _15) -> [return: bb8, unwind continue];
+ }
+
+ bb8: {
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_18);
+ StorageLive(_19);
+- StorageLive(_20);
+- _20 = _1;
+ _21 = Eq(const 0_u64, const 0_u64);
+- assert(!move _21, "attempt to divide `{}` by zero", _20) -> [success: bb9, unwind continue];
++ assert(!_21, "attempt to divide `{}` by zero", _1) -> [success: bb9, unwind continue];
+ }
+
+ bb9: {
+- _19 = Div(move _20, const 0_u64);
+- StorageDead(_20);
++ _19 = Div(_1, const 0_u64);
+ _18 = opaque::<u64>(move _19) -> [return: bb10, unwind continue];
+ }
+
+ bb10: {
+ StorageDead(_19);
+ StorageDead(_18);
+ StorageLive(_22);
+ StorageLive(_23);
+- StorageLive(_24);
+- _24 = _1;
+ _25 = Eq(const 1_u64, const 0_u64);
+- assert(!move _25, "attempt to divide `{}` by zero", _24) -> [success: bb11, unwind continue];
++ assert(!_25, "attempt to divide `{}` by zero", _1) -> [success: bb11, unwind continue];
+ }
+
+ bb11: {
+- _23 = Div(move _24, const 1_u64);
+- StorageDead(_24);
++ _23 = Div(_1, const 1_u64);
+ _22 = opaque::<u64>(move _23) -> [return: bb12, unwind continue];
+ }
+
+ bb12: {
+ StorageDead(_23);
+ StorageDead(_22);
+ StorageLive(_26);
+ StorageLive(_27);
+- StorageLive(_28);
+- _28 = _1;
+- _29 = Eq(_28, const 0_u64);
+- assert(!move _29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb13, unwind continue];
++ _29 = Eq(_1, const 0_u64);
++ assert(!_29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb13, unwind continue];
+ }
+
+ bb13: {
+- _27 = Div(const 0_u64, move _28);
+- StorageDead(_28);
++ _27 = Div(const 0_u64, _1);
+ _26 = opaque::<u64>(move _27) -> [return: bb14, unwind continue];
+ }
+
+ bb14: {
+ StorageDead(_27);
+ StorageDead(_26);
+ StorageLive(_30);
+ StorageLive(_31);
+- StorageLive(_32);
+- _32 = _1;
+- _33 = Eq(_32, const 0_u64);
+- assert(!move _33, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb15, unwind continue];
++ assert(!_29, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb15, unwind continue];
+ }
+
+ bb15: {
+- _31 = Div(const 1_u64, move _32);
+- StorageDead(_32);
++ _31 = Div(const 1_u64, _1);
+ _30 = opaque::<u64>(move _31) -> [return: bb16, unwind continue];
+ }
+
+ bb16: {
+ StorageDead(_31);
+ StorageDead(_30);
+ StorageLive(_34);
+ StorageLive(_35);
+- StorageLive(_36);
+- _36 = _1;
+- _37 = Eq(const 0_u64, const 0_u64);
+- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", _36) -> [success: bb17, unwind continue];
++ assert(!_21, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb17, unwind continue];
+ }
+
+ bb17: {
+- _35 = Rem(move _36, const 0_u64);
+- StorageDead(_36);
++ _35 = Rem(_1, const 0_u64);
+ _34 = opaque::<u64>(move _35) -> [return: bb18, unwind continue];
+ }
+
+ bb18: {
+ StorageDead(_35);
+ StorageDead(_34);
+ StorageLive(_38);
+ StorageLive(_39);
+- StorageLive(_40);
+- _40 = _1;
+- _41 = Eq(const 1_u64, const 0_u64);
+- assert(!move _41, "attempt to calculate the remainder of `{}` with a divisor of zero", _40) -> [success: bb19, unwind continue];
++ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb19, unwind continue];
+ }
+
+ bb19: {
+- _39 = Rem(move _40, const 1_u64);
+- StorageDead(_40);
++ _39 = Rem(_1, const 1_u64);
+ _38 = opaque::<u64>(move _39) -> [return: bb20, unwind continue];
+ }
+
+ bb20: {
+ StorageDead(_39);
+ StorageDead(_38);
+ StorageLive(_42);
+ StorageLive(_43);
+- StorageLive(_44);
+- _44 = _1;
+- _45 = Eq(_44, const 0_u64);
+- assert(!move _45, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb21, unwind continue];
++ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb21, unwind continue];
+ }
+
+ bb21: {
+- _43 = Rem(const 0_u64, move _44);
+- StorageDead(_44);
++ _43 = Rem(const 0_u64, _1);
+ _42 = opaque::<u64>(move _43) -> [return: bb22, unwind continue];
+ }
+
+ bb22: {
+ StorageDead(_43);
+ StorageDead(_42);
+ StorageLive(_46);
+ StorageLive(_47);
+- StorageLive(_48);
+- _48 = _1;
+- _49 = Eq(_48, const 0_u64);
+- assert(!move _49, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb23, unwind continue];
++ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb23, unwind continue];
+ }
+
+ bb23: {
+- _47 = Rem(const 1_u64, move _48);
+- StorageDead(_48);
++ _47 = Rem(const 1_u64, _1);
+ _46 = opaque::<u64>(move _47) -> [return: bb24, unwind continue];
+ }
+
+ bb24: {
+ StorageDead(_47);
+ StorageDead(_46);
+ StorageLive(_50);
+ StorageLive(_51);
+- StorageLive(_52);
+- _52 = _1;
+- _51 = BitAnd(move _52, const 0_u64);
+- StorageDead(_52);
++ _51 = BitAnd(_1, const 0_u64);
+ _50 = opaque::<u64>(move _51) -> [return: bb25, unwind continue];
+ }
+
+ bb25: {
+ StorageDead(_51);
+ StorageDead(_50);
+ StorageLive(_53);
+ StorageLive(_54);
+- StorageLive(_55);
+- _55 = _1;
+- _54 = BitOr(move _55, const 0_u64);
+- StorageDead(_55);
++ _54 = BitOr(_1, const 0_u64);
+ _53 = opaque::<u64>(move _54) -> [return: bb26, unwind continue];
+ }
+
+ bb26: {
+ StorageDead(_54);
+ StorageDead(_53);
+ StorageLive(_56);
+ StorageLive(_57);
+- StorageLive(_58);
+- _58 = _1;
+- _57 = BitXor(move _58, const 0_u64);
+- StorageDead(_58);
++ _57 = BitXor(_1, const 0_u64);
+ _56 = opaque::<u64>(move _57) -> [return: bb27, unwind continue];
+ }
+
+ bb27: {
+ StorageDead(_57);
+ StorageDead(_56);
+ StorageLive(_59);
+ StorageLive(_60);
+- StorageLive(_61);
+- _61 = _1;
+ _62 = const 0_i32 as u32 (IntToInt);
+- _63 = Lt(move _62, const 64_u32);
+- assert(move _63, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb28, unwind continue];
++ _63 = Lt(_62, const 64_u32);
++ assert(_63, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb28, unwind continue];
+ }
+
+ bb28: {
+- _60 = Shr(move _61, const 0_i32);
+- StorageDead(_61);
++ _60 = Shr(_1, const 0_i32);
+ _59 = opaque::<u64>(move _60) -> [return: bb29, unwind continue];
+ }
+
+ bb29: {
+ StorageDead(_60);
+ StorageDead(_59);
+ StorageLive(_64);
+ StorageLive(_65);
+- StorageLive(_66);
+- _66 = _1;
+- _67 = const 0_i32 as u32 (IntToInt);
+- _68 = Lt(move _67, const 64_u32);
+- assert(move _68, "attempt to shift left by `{}`, which would overflow", const 0_i32) -> [success: bb30, unwind continue];
++ assert(_63, "attempt to shift left by `{}`, which would overflow", const 0_i32) -> [success: bb30, unwind continue];
+ }
+
+ bb30: {
+- _65 = Shl(move _66, const 0_i32);
+- StorageDead(_66);
++ _65 = Shl(_1, const 0_i32);
+ _64 = opaque::<u64>(move _65) -> [return: bb31, unwind continue];
+ }
+
+ bb31: {
+ StorageDead(_65);
+ StorageDead(_64);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.arithmetic_float.GVN.panic-abort.diff b/tests/mir-opt/gvn.arithmetic_float.GVN.panic-abort.diff
new file mode 100644
index 000000000..7d5ac8353
--- /dev/null
+++ b/tests/mir-opt/gvn.arithmetic_float.GVN.panic-abort.diff
@@ -0,0 +1,165 @@
+- // MIR for `arithmetic_float` before GVN
++ // MIR for `arithmetic_float` after GVN
+
+ fn arithmetic_float(_1: f64) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: f64;
+ let mut _4: f64;
+ let _5: ();
+ let mut _6: f64;
+ let mut _7: f64;
+ let _8: ();
+ let mut _9: f64;
+ let mut _10: f64;
+ let _11: ();
+ let mut _12: f64;
+ let mut _13: f64;
+ let _14: ();
+ let mut _15: f64;
+ let mut _16: f64;
+ let _17: ();
+ let mut _18: f64;
+ let mut _19: f64;
+ let _20: ();
+ let mut _21: f64;
+ let mut _22: f64;
+ let _23: ();
+ let mut _24: bool;
+ let mut _25: f64;
+ let mut _26: f64;
+ let _27: ();
+ let mut _28: bool;
+ let mut _29: f64;
+ let mut _30: f64;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+- StorageLive(_4);
+- _4 = _1;
+- _3 = Add(move _4, const 0f64);
+- StorageDead(_4);
++ _3 = Add(_1, const 0f64);
+ _2 = opaque::<f64>(move _3) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_5);
+ StorageLive(_6);
+- StorageLive(_7);
+- _7 = _1;
+- _6 = Sub(move _7, const 0f64);
+- StorageDead(_7);
++ _6 = Sub(_1, const 0f64);
+ _5 = opaque::<f64>(move _6) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageLive(_8);
+ StorageLive(_9);
+- StorageLive(_10);
+- _10 = _1;
+- _9 = Mul(move _10, const 0f64);
+- StorageDead(_10);
++ _9 = Mul(_1, const 0f64);
+ _8 = opaque::<f64>(move _9) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_11);
+ StorageLive(_12);
+- StorageLive(_13);
+- _13 = _1;
+- _12 = Div(move _13, const 0f64);
+- StorageDead(_13);
++ _12 = Div(_1, const 0f64);
+ _11 = opaque::<f64>(move _12) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageLive(_14);
+ StorageLive(_15);
+- StorageLive(_16);
+- _16 = _1;
+- _15 = Div(const 0f64, move _16);
+- StorageDead(_16);
++ _15 = Div(const 0f64, _1);
+ _14 = opaque::<f64>(move _15) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_17);
+ StorageLive(_18);
+- StorageLive(_19);
+- _19 = _1;
+- _18 = Rem(move _19, const 0f64);
+- StorageDead(_19);
++ _18 = Rem(_1, const 0f64);
+ _17 = opaque::<f64>(move _18) -> [return: bb6, unwind unreachable];
+ }
+
+ bb6: {
+ StorageDead(_18);
+ StorageDead(_17);
+ StorageLive(_20);
+ StorageLive(_21);
+- StorageLive(_22);
+- _22 = _1;
+- _21 = Rem(const 0f64, move _22);
+- StorageDead(_22);
++ _21 = Rem(const 0f64, _1);
+ _20 = opaque::<f64>(move _21) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageLive(_23);
+ StorageLive(_24);
+- StorageLive(_25);
+- _25 = _1;
+- StorageLive(_26);
+- _26 = _1;
+- _24 = Eq(move _25, move _26);
+- StorageDead(_26);
+- StorageDead(_25);
++ _24 = Eq(_1, _1);
+ _23 = opaque::<bool>(move _24) -> [return: bb8, unwind unreachable];
+ }
+
+ bb8: {
+ StorageDead(_24);
+ StorageDead(_23);
+ StorageLive(_27);
+ StorageLive(_28);
+- StorageLive(_29);
+- _29 = _1;
+- StorageLive(_30);
+- _30 = _1;
+- _28 = Ne(move _29, move _30);
+- StorageDead(_30);
+- StorageDead(_29);
++ _28 = Ne(_1, _1);
+ _27 = opaque::<bool>(move _28) -> [return: bb9, unwind unreachable];
+ }
+
+ bb9: {
+ StorageDead(_28);
+ StorageDead(_27);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.arithmetic_float.GVN.panic-unwind.diff b/tests/mir-opt/gvn.arithmetic_float.GVN.panic-unwind.diff
new file mode 100644
index 000000000..36c26dc66
--- /dev/null
+++ b/tests/mir-opt/gvn.arithmetic_float.GVN.panic-unwind.diff
@@ -0,0 +1,165 @@
+- // MIR for `arithmetic_float` before GVN
++ // MIR for `arithmetic_float` after GVN
+
+ fn arithmetic_float(_1: f64) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: f64;
+ let mut _4: f64;
+ let _5: ();
+ let mut _6: f64;
+ let mut _7: f64;
+ let _8: ();
+ let mut _9: f64;
+ let mut _10: f64;
+ let _11: ();
+ let mut _12: f64;
+ let mut _13: f64;
+ let _14: ();
+ let mut _15: f64;
+ let mut _16: f64;
+ let _17: ();
+ let mut _18: f64;
+ let mut _19: f64;
+ let _20: ();
+ let mut _21: f64;
+ let mut _22: f64;
+ let _23: ();
+ let mut _24: bool;
+ let mut _25: f64;
+ let mut _26: f64;
+ let _27: ();
+ let mut _28: bool;
+ let mut _29: f64;
+ let mut _30: f64;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+- StorageLive(_4);
+- _4 = _1;
+- _3 = Add(move _4, const 0f64);
+- StorageDead(_4);
++ _3 = Add(_1, const 0f64);
+ _2 = opaque::<f64>(move _3) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_5);
+ StorageLive(_6);
+- StorageLive(_7);
+- _7 = _1;
+- _6 = Sub(move _7, const 0f64);
+- StorageDead(_7);
++ _6 = Sub(_1, const 0f64);
+ _5 = opaque::<f64>(move _6) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageLive(_8);
+ StorageLive(_9);
+- StorageLive(_10);
+- _10 = _1;
+- _9 = Mul(move _10, const 0f64);
+- StorageDead(_10);
++ _9 = Mul(_1, const 0f64);
+ _8 = opaque::<f64>(move _9) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_11);
+ StorageLive(_12);
+- StorageLive(_13);
+- _13 = _1;
+- _12 = Div(move _13, const 0f64);
+- StorageDead(_13);
++ _12 = Div(_1, const 0f64);
+ _11 = opaque::<f64>(move _12) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageLive(_14);
+ StorageLive(_15);
+- StorageLive(_16);
+- _16 = _1;
+- _15 = Div(const 0f64, move _16);
+- StorageDead(_16);
++ _15 = Div(const 0f64, _1);
+ _14 = opaque::<f64>(move _15) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_17);
+ StorageLive(_18);
+- StorageLive(_19);
+- _19 = _1;
+- _18 = Rem(move _19, const 0f64);
+- StorageDead(_19);
++ _18 = Rem(_1, const 0f64);
+ _17 = opaque::<f64>(move _18) -> [return: bb6, unwind continue];
+ }
+
+ bb6: {
+ StorageDead(_18);
+ StorageDead(_17);
+ StorageLive(_20);
+ StorageLive(_21);
+- StorageLive(_22);
+- _22 = _1;
+- _21 = Rem(const 0f64, move _22);
+- StorageDead(_22);
++ _21 = Rem(const 0f64, _1);
+ _20 = opaque::<f64>(move _21) -> [return: bb7, unwind continue];
+ }
+
+ bb7: {
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageLive(_23);
+ StorageLive(_24);
+- StorageLive(_25);
+- _25 = _1;
+- StorageLive(_26);
+- _26 = _1;
+- _24 = Eq(move _25, move _26);
+- StorageDead(_26);
+- StorageDead(_25);
++ _24 = Eq(_1, _1);
+ _23 = opaque::<bool>(move _24) -> [return: bb8, unwind continue];
+ }
+
+ bb8: {
+ StorageDead(_24);
+ StorageDead(_23);
+ StorageLive(_27);
+ StorageLive(_28);
+- StorageLive(_29);
+- _29 = _1;
+- StorageLive(_30);
+- _30 = _1;
+- _28 = Ne(move _29, move _30);
+- StorageDead(_30);
+- StorageDead(_29);
++ _28 = Ne(_1, _1);
+ _27 = opaque::<bool>(move _28) -> [return: bb9, unwind continue];
+ }
+
+ bb9: {
+ StorageDead(_28);
+ StorageDead(_27);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.cast.GVN.panic-abort.diff b/tests/mir-opt/gvn.cast.GVN.panic-abort.diff
new file mode 100644
index 000000000..513fe60b6
--- /dev/null
+++ b/tests/mir-opt/gvn.cast.GVN.panic-abort.diff
@@ -0,0 +1,501 @@
+- // MIR for `cast` before GVN
++ // MIR for `cast` after GVN
+
+ fn cast() -> () {
+ let mut _0: ();
+ let _1: i64;
+ let _4: ();
+ let mut _5: u8;
+ let mut _6: i64;
+ let _7: ();
+ let mut _8: u16;
+ let mut _9: i64;
+ let _10: ();
+ let mut _11: u32;
+ let mut _12: i64;
+ let _13: ();
+ let mut _14: u64;
+ let mut _15: i64;
+ let _16: ();
+ let mut _17: i8;
+ let mut _18: i64;
+ let _19: ();
+ let mut _20: i16;
+ let mut _21: i64;
+ let _22: ();
+ let mut _23: i32;
+ let mut _24: i64;
+ let _25: ();
+ let mut _26: i64;
+ let _27: ();
+ let mut _28: f32;
+ let mut _29: i64;
+ let _30: ();
+ let mut _31: f64;
+ let mut _32: i64;
+ let _33: ();
+ let mut _34: u8;
+ let mut _35: u64;
+ let _36: ();
+ let mut _37: u16;
+ let mut _38: u64;
+ let _39: ();
+ let mut _40: u32;
+ let mut _41: u64;
+ let _42: ();
+ let mut _43: u64;
+ let _44: ();
+ let mut _45: i8;
+ let mut _46: u64;
+ let _47: ();
+ let mut _48: i16;
+ let mut _49: u64;
+ let _50: ();
+ let mut _51: i32;
+ let mut _52: u64;
+ let _53: ();
+ let mut _54: i64;
+ let mut _55: u64;
+ let _56: ();
+ let mut _57: f32;
+ let mut _58: u64;
+ let _59: ();
+ let mut _60: f64;
+ let mut _61: u64;
+ let _62: ();
+ let mut _63: u8;
+ let mut _64: f64;
+ let _65: ();
+ let mut _66: u16;
+ let mut _67: f64;
+ let _68: ();
+ let mut _69: u32;
+ let mut _70: f64;
+ let _71: ();
+ let mut _72: u64;
+ let mut _73: f64;
+ let _74: ();
+ let mut _75: i8;
+ let mut _76: f64;
+ let _77: ();
+ let mut _78: i16;
+ let mut _79: f64;
+ let _80: ();
+ let mut _81: i32;
+ let mut _82: f64;
+ let _83: ();
+ let mut _84: i64;
+ let mut _85: f64;
+ let _86: ();
+ let mut _87: f32;
+ let mut _88: f64;
+ let _89: ();
+ let mut _90: f64;
+ scope 1 {
+ debug i => _1;
+ let _2: u64;
+ scope 2 {
+ debug u => _2;
+ let _3: f64;
+ scope 3 {
+ debug f => _3;
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_1);
+ _1 = const 1_i64;
+- StorageLive(_2);
+ _2 = const 1_u64;
+- StorageLive(_3);
+ _3 = const 1f64;
+ StorageLive(_4);
+ StorageLive(_5);
+- StorageLive(_6);
+- _6 = _1;
+- _5 = move _6 as u8 (IntToInt);
+- StorageDead(_6);
++ _5 = const 1_i64 as u8 (IntToInt);
+ _4 = opaque::<u8>(move _5) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_7);
+ StorageLive(_8);
+- StorageLive(_9);
+- _9 = _1;
+- _8 = move _9 as u16 (IntToInt);
+- StorageDead(_9);
++ _8 = const 1_i64 as u16 (IntToInt);
+ _7 = opaque::<u16>(move _8) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageLive(_10);
+ StorageLive(_11);
+- StorageLive(_12);
+- _12 = _1;
+- _11 = move _12 as u32 (IntToInt);
+- StorageDead(_12);
++ _11 = const 1_i64 as u32 (IntToInt);
+ _10 = opaque::<u32>(move _11) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageLive(_13);
+ StorageLive(_14);
+- StorageLive(_15);
+- _15 = _1;
+- _14 = move _15 as u64 (IntToInt);
+- StorageDead(_15);
++ _14 = const 1_i64 as u64 (IntToInt);
+ _13 = opaque::<u64>(move _14) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_14);
+ StorageDead(_13);
+ StorageLive(_16);
+ StorageLive(_17);
+- StorageLive(_18);
+- _18 = _1;
+- _17 = move _18 as i8 (IntToInt);
+- StorageDead(_18);
++ _17 = const 1_i64 as i8 (IntToInt);
+ _16 = opaque::<i8>(move _17) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageLive(_19);
+ StorageLive(_20);
+- StorageLive(_21);
+- _21 = _1;
+- _20 = move _21 as i16 (IntToInt);
+- StorageDead(_21);
++ _20 = const 1_i64 as i16 (IntToInt);
+ _19 = opaque::<i16>(move _20) -> [return: bb6, unwind unreachable];
+ }
+
+ bb6: {
+ StorageDead(_20);
+ StorageDead(_19);
+ StorageLive(_22);
+ StorageLive(_23);
+- StorageLive(_24);
+- _24 = _1;
+- _23 = move _24 as i32 (IntToInt);
+- StorageDead(_24);
++ _23 = const 1_i64 as i32 (IntToInt);
+ _22 = opaque::<i32>(move _23) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+ StorageDead(_23);
+ StorageDead(_22);
+ StorageLive(_25);
+- StorageLive(_26);
+- _26 = _1;
+- _25 = opaque::<i64>(move _26) -> [return: bb8, unwind unreachable];
++ _25 = opaque::<i64>(const 1_i64) -> [return: bb8, unwind unreachable];
+ }
+
+ bb8: {
+- StorageDead(_26);
+ StorageDead(_25);
+ StorageLive(_27);
+ StorageLive(_28);
+- StorageLive(_29);
+- _29 = _1;
+- _28 = move _29 as f32 (IntToFloat);
+- StorageDead(_29);
++ _28 = const 1_i64 as f32 (IntToFloat);
+ _27 = opaque::<f32>(move _28) -> [return: bb9, unwind unreachable];
+ }
+
+ bb9: {
+ StorageDead(_28);
+ StorageDead(_27);
+ StorageLive(_30);
+ StorageLive(_31);
+- StorageLive(_32);
+- _32 = _1;
+- _31 = move _32 as f64 (IntToFloat);
+- StorageDead(_32);
++ _31 = const 1_i64 as f64 (IntToFloat);
+ _30 = opaque::<f64>(move _31) -> [return: bb10, unwind unreachable];
+ }
+
+ bb10: {
+ StorageDead(_31);
+ StorageDead(_30);
+ StorageLive(_33);
+ StorageLive(_34);
+- StorageLive(_35);
+- _35 = _2;
+- _34 = move _35 as u8 (IntToInt);
+- StorageDead(_35);
++ _34 = const 1_u64 as u8 (IntToInt);
+ _33 = opaque::<u8>(move _34) -> [return: bb11, unwind unreachable];
+ }
+
+ bb11: {
+ StorageDead(_34);
+ StorageDead(_33);
+ StorageLive(_36);
+ StorageLive(_37);
+- StorageLive(_38);
+- _38 = _2;
+- _37 = move _38 as u16 (IntToInt);
+- StorageDead(_38);
++ _37 = const 1_u64 as u16 (IntToInt);
+ _36 = opaque::<u16>(move _37) -> [return: bb12, unwind unreachable];
+ }
+
+ bb12: {
+ StorageDead(_37);
+ StorageDead(_36);
+ StorageLive(_39);
+ StorageLive(_40);
+- StorageLive(_41);
+- _41 = _2;
+- _40 = move _41 as u32 (IntToInt);
+- StorageDead(_41);
++ _40 = const 1_u64 as u32 (IntToInt);
+ _39 = opaque::<u32>(move _40) -> [return: bb13, unwind unreachable];
+ }
+
+ bb13: {
+ StorageDead(_40);
+ StorageDead(_39);
+ StorageLive(_42);
+- StorageLive(_43);
+- _43 = _2;
+- _42 = opaque::<u64>(move _43) -> [return: bb14, unwind unreachable];
++ _42 = opaque::<u64>(const 1_u64) -> [return: bb14, unwind unreachable];
+ }
+
+ bb14: {
+- StorageDead(_43);
+ StorageDead(_42);
+ StorageLive(_44);
+ StorageLive(_45);
+- StorageLive(_46);
+- _46 = _2;
+- _45 = move _46 as i8 (IntToInt);
+- StorageDead(_46);
++ _45 = const 1_u64 as i8 (IntToInt);
+ _44 = opaque::<i8>(move _45) -> [return: bb15, unwind unreachable];
+ }
+
+ bb15: {
+ StorageDead(_45);
+ StorageDead(_44);
+ StorageLive(_47);
+ StorageLive(_48);
+- StorageLive(_49);
+- _49 = _2;
+- _48 = move _49 as i16 (IntToInt);
+- StorageDead(_49);
++ _48 = const 1_u64 as i16 (IntToInt);
+ _47 = opaque::<i16>(move _48) -> [return: bb16, unwind unreachable];
+ }
+
+ bb16: {
+ StorageDead(_48);
+ StorageDead(_47);
+ StorageLive(_50);
+ StorageLive(_51);
+- StorageLive(_52);
+- _52 = _2;
+- _51 = move _52 as i32 (IntToInt);
+- StorageDead(_52);
++ _51 = const 1_u64 as i32 (IntToInt);
+ _50 = opaque::<i32>(move _51) -> [return: bb17, unwind unreachable];
+ }
+
+ bb17: {
+ StorageDead(_51);
+ StorageDead(_50);
+ StorageLive(_53);
+ StorageLive(_54);
+- StorageLive(_55);
+- _55 = _2;
+- _54 = move _55 as i64 (IntToInt);
+- StorageDead(_55);
++ _54 = const 1_u64 as i64 (IntToInt);
+ _53 = opaque::<i64>(move _54) -> [return: bb18, unwind unreachable];
+ }
+
+ bb18: {
+ StorageDead(_54);
+ StorageDead(_53);
+ StorageLive(_56);
+ StorageLive(_57);
+- StorageLive(_58);
+- _58 = _2;
+- _57 = move _58 as f32 (IntToFloat);
+- StorageDead(_58);
++ _57 = const 1_u64 as f32 (IntToFloat);
+ _56 = opaque::<f32>(move _57) -> [return: bb19, unwind unreachable];
+ }
+
+ bb19: {
+ StorageDead(_57);
+ StorageDead(_56);
+ StorageLive(_59);
+ StorageLive(_60);
+- StorageLive(_61);
+- _61 = _2;
+- _60 = move _61 as f64 (IntToFloat);
+- StorageDead(_61);
++ _60 = const 1_u64 as f64 (IntToFloat);
+ _59 = opaque::<f64>(move _60) -> [return: bb20, unwind unreachable];
+ }
+
+ bb20: {
+ StorageDead(_60);
+ StorageDead(_59);
+ StorageLive(_62);
+ StorageLive(_63);
+- StorageLive(_64);
+- _64 = _3;
+- _63 = move _64 as u8 (FloatToInt);
+- StorageDead(_64);
++ _63 = const 1f64 as u8 (FloatToInt);
+ _62 = opaque::<u8>(move _63) -> [return: bb21, unwind unreachable];
+ }
+
+ bb21: {
+ StorageDead(_63);
+ StorageDead(_62);
+ StorageLive(_65);
+ StorageLive(_66);
+- StorageLive(_67);
+- _67 = _3;
+- _66 = move _67 as u16 (FloatToInt);
+- StorageDead(_67);
++ _66 = const 1f64 as u16 (FloatToInt);
+ _65 = opaque::<u16>(move _66) -> [return: bb22, unwind unreachable];
+ }
+
+ bb22: {
+ StorageDead(_66);
+ StorageDead(_65);
+ StorageLive(_68);
+ StorageLive(_69);
+- StorageLive(_70);
+- _70 = _3;
+- _69 = move _70 as u32 (FloatToInt);
+- StorageDead(_70);
++ _69 = const 1f64 as u32 (FloatToInt);
+ _68 = opaque::<u32>(move _69) -> [return: bb23, unwind unreachable];
+ }
+
+ bb23: {
+ StorageDead(_69);
+ StorageDead(_68);
+ StorageLive(_71);
+ StorageLive(_72);
+- StorageLive(_73);
+- _73 = _3;
+- _72 = move _73 as u64 (FloatToInt);
+- StorageDead(_73);
++ _72 = const 1f64 as u64 (FloatToInt);
+ _71 = opaque::<u64>(move _72) -> [return: bb24, unwind unreachable];
+ }
+
+ bb24: {
+ StorageDead(_72);
+ StorageDead(_71);
+ StorageLive(_74);
+ StorageLive(_75);
+- StorageLive(_76);
+- _76 = _3;
+- _75 = move _76 as i8 (FloatToInt);
+- StorageDead(_76);
++ _75 = const 1f64 as i8 (FloatToInt);
+ _74 = opaque::<i8>(move _75) -> [return: bb25, unwind unreachable];
+ }
+
+ bb25: {
+ StorageDead(_75);
+ StorageDead(_74);
+ StorageLive(_77);
+ StorageLive(_78);
+- StorageLive(_79);
+- _79 = _3;
+- _78 = move _79 as i16 (FloatToInt);
+- StorageDead(_79);
++ _78 = const 1f64 as i16 (FloatToInt);
+ _77 = opaque::<i16>(move _78) -> [return: bb26, unwind unreachable];
+ }
+
+ bb26: {
+ StorageDead(_78);
+ StorageDead(_77);
+ StorageLive(_80);
+ StorageLive(_81);
+- StorageLive(_82);
+- _82 = _3;
+- _81 = move _82 as i32 (FloatToInt);
+- StorageDead(_82);
++ _81 = const 1f64 as i32 (FloatToInt);
+ _80 = opaque::<i32>(move _81) -> [return: bb27, unwind unreachable];
+ }
+
+ bb27: {
+ StorageDead(_81);
+ StorageDead(_80);
+ StorageLive(_83);
+ StorageLive(_84);
+- StorageLive(_85);
+- _85 = _3;
+- _84 = move _85 as i64 (FloatToInt);
+- StorageDead(_85);
++ _84 = const 1f64 as i64 (FloatToInt);
+ _83 = opaque::<i64>(move _84) -> [return: bb28, unwind unreachable];
+ }
+
+ bb28: {
+ StorageDead(_84);
+ StorageDead(_83);
+ StorageLive(_86);
+ StorageLive(_87);
+- StorageLive(_88);
+- _88 = _3;
+- _87 = move _88 as f32 (FloatToFloat);
+- StorageDead(_88);
++ _87 = const 1f64 as f32 (FloatToFloat);
+ _86 = opaque::<f32>(move _87) -> [return: bb29, unwind unreachable];
+ }
+
+ bb29: {
+ StorageDead(_87);
+ StorageDead(_86);
+ StorageLive(_89);
+- StorageLive(_90);
+- _90 = _3;
+- _89 = opaque::<f64>(move _90) -> [return: bb30, unwind unreachable];
++ _89 = opaque::<f64>(const 1f64) -> [return: bb30, unwind unreachable];
+ }
+
+ bb30: {
+- StorageDead(_90);
+ StorageDead(_89);
+ _0 = const ();
+- StorageDead(_3);
+- StorageDead(_2);
+- StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff b/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff
new file mode 100644
index 000000000..33192ed8d
--- /dev/null
+++ b/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff
@@ -0,0 +1,501 @@
+- // MIR for `cast` before GVN
++ // MIR for `cast` after GVN
+
+ fn cast() -> () {
+ let mut _0: ();
+ let _1: i64;
+ let _4: ();
+ let mut _5: u8;
+ let mut _6: i64;
+ let _7: ();
+ let mut _8: u16;
+ let mut _9: i64;
+ let _10: ();
+ let mut _11: u32;
+ let mut _12: i64;
+ let _13: ();
+ let mut _14: u64;
+ let mut _15: i64;
+ let _16: ();
+ let mut _17: i8;
+ let mut _18: i64;
+ let _19: ();
+ let mut _20: i16;
+ let mut _21: i64;
+ let _22: ();
+ let mut _23: i32;
+ let mut _24: i64;
+ let _25: ();
+ let mut _26: i64;
+ let _27: ();
+ let mut _28: f32;
+ let mut _29: i64;
+ let _30: ();
+ let mut _31: f64;
+ let mut _32: i64;
+ let _33: ();
+ let mut _34: u8;
+ let mut _35: u64;
+ let _36: ();
+ let mut _37: u16;
+ let mut _38: u64;
+ let _39: ();
+ let mut _40: u32;
+ let mut _41: u64;
+ let _42: ();
+ let mut _43: u64;
+ let _44: ();
+ let mut _45: i8;
+ let mut _46: u64;
+ let _47: ();
+ let mut _48: i16;
+ let mut _49: u64;
+ let _50: ();
+ let mut _51: i32;
+ let mut _52: u64;
+ let _53: ();
+ let mut _54: i64;
+ let mut _55: u64;
+ let _56: ();
+ let mut _57: f32;
+ let mut _58: u64;
+ let _59: ();
+ let mut _60: f64;
+ let mut _61: u64;
+ let _62: ();
+ let mut _63: u8;
+ let mut _64: f64;
+ let _65: ();
+ let mut _66: u16;
+ let mut _67: f64;
+ let _68: ();
+ let mut _69: u32;
+ let mut _70: f64;
+ let _71: ();
+ let mut _72: u64;
+ let mut _73: f64;
+ let _74: ();
+ let mut _75: i8;
+ let mut _76: f64;
+ let _77: ();
+ let mut _78: i16;
+ let mut _79: f64;
+ let _80: ();
+ let mut _81: i32;
+ let mut _82: f64;
+ let _83: ();
+ let mut _84: i64;
+ let mut _85: f64;
+ let _86: ();
+ let mut _87: f32;
+ let mut _88: f64;
+ let _89: ();
+ let mut _90: f64;
+ scope 1 {
+ debug i => _1;
+ let _2: u64;
+ scope 2 {
+ debug u => _2;
+ let _3: f64;
+ scope 3 {
+ debug f => _3;
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_1);
+ _1 = const 1_i64;
+- StorageLive(_2);
+ _2 = const 1_u64;
+- StorageLive(_3);
+ _3 = const 1f64;
+ StorageLive(_4);
+ StorageLive(_5);
+- StorageLive(_6);
+- _6 = _1;
+- _5 = move _6 as u8 (IntToInt);
+- StorageDead(_6);
++ _5 = const 1_i64 as u8 (IntToInt);
+ _4 = opaque::<u8>(move _5) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_7);
+ StorageLive(_8);
+- StorageLive(_9);
+- _9 = _1;
+- _8 = move _9 as u16 (IntToInt);
+- StorageDead(_9);
++ _8 = const 1_i64 as u16 (IntToInt);
+ _7 = opaque::<u16>(move _8) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageLive(_10);
+ StorageLive(_11);
+- StorageLive(_12);
+- _12 = _1;
+- _11 = move _12 as u32 (IntToInt);
+- StorageDead(_12);
++ _11 = const 1_i64 as u32 (IntToInt);
+ _10 = opaque::<u32>(move _11) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageLive(_13);
+ StorageLive(_14);
+- StorageLive(_15);
+- _15 = _1;
+- _14 = move _15 as u64 (IntToInt);
+- StorageDead(_15);
++ _14 = const 1_i64 as u64 (IntToInt);
+ _13 = opaque::<u64>(move _14) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_14);
+ StorageDead(_13);
+ StorageLive(_16);
+ StorageLive(_17);
+- StorageLive(_18);
+- _18 = _1;
+- _17 = move _18 as i8 (IntToInt);
+- StorageDead(_18);
++ _17 = const 1_i64 as i8 (IntToInt);
+ _16 = opaque::<i8>(move _17) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageLive(_19);
+ StorageLive(_20);
+- StorageLive(_21);
+- _21 = _1;
+- _20 = move _21 as i16 (IntToInt);
+- StorageDead(_21);
++ _20 = const 1_i64 as i16 (IntToInt);
+ _19 = opaque::<i16>(move _20) -> [return: bb6, unwind continue];
+ }
+
+ bb6: {
+ StorageDead(_20);
+ StorageDead(_19);
+ StorageLive(_22);
+ StorageLive(_23);
+- StorageLive(_24);
+- _24 = _1;
+- _23 = move _24 as i32 (IntToInt);
+- StorageDead(_24);
++ _23 = const 1_i64 as i32 (IntToInt);
+ _22 = opaque::<i32>(move _23) -> [return: bb7, unwind continue];
+ }
+
+ bb7: {
+ StorageDead(_23);
+ StorageDead(_22);
+ StorageLive(_25);
+- StorageLive(_26);
+- _26 = _1;
+- _25 = opaque::<i64>(move _26) -> [return: bb8, unwind continue];
++ _25 = opaque::<i64>(const 1_i64) -> [return: bb8, unwind continue];
+ }
+
+ bb8: {
+- StorageDead(_26);
+ StorageDead(_25);
+ StorageLive(_27);
+ StorageLive(_28);
+- StorageLive(_29);
+- _29 = _1;
+- _28 = move _29 as f32 (IntToFloat);
+- StorageDead(_29);
++ _28 = const 1_i64 as f32 (IntToFloat);
+ _27 = opaque::<f32>(move _28) -> [return: bb9, unwind continue];
+ }
+
+ bb9: {
+ StorageDead(_28);
+ StorageDead(_27);
+ StorageLive(_30);
+ StorageLive(_31);
+- StorageLive(_32);
+- _32 = _1;
+- _31 = move _32 as f64 (IntToFloat);
+- StorageDead(_32);
++ _31 = const 1_i64 as f64 (IntToFloat);
+ _30 = opaque::<f64>(move _31) -> [return: bb10, unwind continue];
+ }
+
+ bb10: {
+ StorageDead(_31);
+ StorageDead(_30);
+ StorageLive(_33);
+ StorageLive(_34);
+- StorageLive(_35);
+- _35 = _2;
+- _34 = move _35 as u8 (IntToInt);
+- StorageDead(_35);
++ _34 = const 1_u64 as u8 (IntToInt);
+ _33 = opaque::<u8>(move _34) -> [return: bb11, unwind continue];
+ }
+
+ bb11: {
+ StorageDead(_34);
+ StorageDead(_33);
+ StorageLive(_36);
+ StorageLive(_37);
+- StorageLive(_38);
+- _38 = _2;
+- _37 = move _38 as u16 (IntToInt);
+- StorageDead(_38);
++ _37 = const 1_u64 as u16 (IntToInt);
+ _36 = opaque::<u16>(move _37) -> [return: bb12, unwind continue];
+ }
+
+ bb12: {
+ StorageDead(_37);
+ StorageDead(_36);
+ StorageLive(_39);
+ StorageLive(_40);
+- StorageLive(_41);
+- _41 = _2;
+- _40 = move _41 as u32 (IntToInt);
+- StorageDead(_41);
++ _40 = const 1_u64 as u32 (IntToInt);
+ _39 = opaque::<u32>(move _40) -> [return: bb13, unwind continue];
+ }
+
+ bb13: {
+ StorageDead(_40);
+ StorageDead(_39);
+ StorageLive(_42);
+- StorageLive(_43);
+- _43 = _2;
+- _42 = opaque::<u64>(move _43) -> [return: bb14, unwind continue];
++ _42 = opaque::<u64>(const 1_u64) -> [return: bb14, unwind continue];
+ }
+
+ bb14: {
+- StorageDead(_43);
+ StorageDead(_42);
+ StorageLive(_44);
+ StorageLive(_45);
+- StorageLive(_46);
+- _46 = _2;
+- _45 = move _46 as i8 (IntToInt);
+- StorageDead(_46);
++ _45 = const 1_u64 as i8 (IntToInt);
+ _44 = opaque::<i8>(move _45) -> [return: bb15, unwind continue];
+ }
+
+ bb15: {
+ StorageDead(_45);
+ StorageDead(_44);
+ StorageLive(_47);
+ StorageLive(_48);
+- StorageLive(_49);
+- _49 = _2;
+- _48 = move _49 as i16 (IntToInt);
+- StorageDead(_49);
++ _48 = const 1_u64 as i16 (IntToInt);
+ _47 = opaque::<i16>(move _48) -> [return: bb16, unwind continue];
+ }
+
+ bb16: {
+ StorageDead(_48);
+ StorageDead(_47);
+ StorageLive(_50);
+ StorageLive(_51);
+- StorageLive(_52);
+- _52 = _2;
+- _51 = move _52 as i32 (IntToInt);
+- StorageDead(_52);
++ _51 = const 1_u64 as i32 (IntToInt);
+ _50 = opaque::<i32>(move _51) -> [return: bb17, unwind continue];
+ }
+
+ bb17: {
+ StorageDead(_51);
+ StorageDead(_50);
+ StorageLive(_53);
+ StorageLive(_54);
+- StorageLive(_55);
+- _55 = _2;
+- _54 = move _55 as i64 (IntToInt);
+- StorageDead(_55);
++ _54 = const 1_u64 as i64 (IntToInt);
+ _53 = opaque::<i64>(move _54) -> [return: bb18, unwind continue];
+ }
+
+ bb18: {
+ StorageDead(_54);
+ StorageDead(_53);
+ StorageLive(_56);
+ StorageLive(_57);
+- StorageLive(_58);
+- _58 = _2;
+- _57 = move _58 as f32 (IntToFloat);
+- StorageDead(_58);
++ _57 = const 1_u64 as f32 (IntToFloat);
+ _56 = opaque::<f32>(move _57) -> [return: bb19, unwind continue];
+ }
+
+ bb19: {
+ StorageDead(_57);
+ StorageDead(_56);
+ StorageLive(_59);
+ StorageLive(_60);
+- StorageLive(_61);
+- _61 = _2;
+- _60 = move _61 as f64 (IntToFloat);
+- StorageDead(_61);
++ _60 = const 1_u64 as f64 (IntToFloat);
+ _59 = opaque::<f64>(move _60) -> [return: bb20, unwind continue];
+ }
+
+ bb20: {
+ StorageDead(_60);
+ StorageDead(_59);
+ StorageLive(_62);
+ StorageLive(_63);
+- StorageLive(_64);
+- _64 = _3;
+- _63 = move _64 as u8 (FloatToInt);
+- StorageDead(_64);
++ _63 = const 1f64 as u8 (FloatToInt);
+ _62 = opaque::<u8>(move _63) -> [return: bb21, unwind continue];
+ }
+
+ bb21: {
+ StorageDead(_63);
+ StorageDead(_62);
+ StorageLive(_65);
+ StorageLive(_66);
+- StorageLive(_67);
+- _67 = _3;
+- _66 = move _67 as u16 (FloatToInt);
+- StorageDead(_67);
++ _66 = const 1f64 as u16 (FloatToInt);
+ _65 = opaque::<u16>(move _66) -> [return: bb22, unwind continue];
+ }
+
+ bb22: {
+ StorageDead(_66);
+ StorageDead(_65);
+ StorageLive(_68);
+ StorageLive(_69);
+- StorageLive(_70);
+- _70 = _3;
+- _69 = move _70 as u32 (FloatToInt);
+- StorageDead(_70);
++ _69 = const 1f64 as u32 (FloatToInt);
+ _68 = opaque::<u32>(move _69) -> [return: bb23, unwind continue];
+ }
+
+ bb23: {
+ StorageDead(_69);
+ StorageDead(_68);
+ StorageLive(_71);
+ StorageLive(_72);
+- StorageLive(_73);
+- _73 = _3;
+- _72 = move _73 as u64 (FloatToInt);
+- StorageDead(_73);
++ _72 = const 1f64 as u64 (FloatToInt);
+ _71 = opaque::<u64>(move _72) -> [return: bb24, unwind continue];
+ }
+
+ bb24: {
+ StorageDead(_72);
+ StorageDead(_71);
+ StorageLive(_74);
+ StorageLive(_75);
+- StorageLive(_76);
+- _76 = _3;
+- _75 = move _76 as i8 (FloatToInt);
+- StorageDead(_76);
++ _75 = const 1f64 as i8 (FloatToInt);
+ _74 = opaque::<i8>(move _75) -> [return: bb25, unwind continue];
+ }
+
+ bb25: {
+ StorageDead(_75);
+ StorageDead(_74);
+ StorageLive(_77);
+ StorageLive(_78);
+- StorageLive(_79);
+- _79 = _3;
+- _78 = move _79 as i16 (FloatToInt);
+- StorageDead(_79);
++ _78 = const 1f64 as i16 (FloatToInt);
+ _77 = opaque::<i16>(move _78) -> [return: bb26, unwind continue];
+ }
+
+ bb26: {
+ StorageDead(_78);
+ StorageDead(_77);
+ StorageLive(_80);
+ StorageLive(_81);
+- StorageLive(_82);
+- _82 = _3;
+- _81 = move _82 as i32 (FloatToInt);
+- StorageDead(_82);
++ _81 = const 1f64 as i32 (FloatToInt);
+ _80 = opaque::<i32>(move _81) -> [return: bb27, unwind continue];
+ }
+
+ bb27: {
+ StorageDead(_81);
+ StorageDead(_80);
+ StorageLive(_83);
+ StorageLive(_84);
+- StorageLive(_85);
+- _85 = _3;
+- _84 = move _85 as i64 (FloatToInt);
+- StorageDead(_85);
++ _84 = const 1f64 as i64 (FloatToInt);
+ _83 = opaque::<i64>(move _84) -> [return: bb28, unwind continue];
+ }
+
+ bb28: {
+ StorageDead(_84);
+ StorageDead(_83);
+ StorageLive(_86);
+ StorageLive(_87);
+- StorageLive(_88);
+- _88 = _3;
+- _87 = move _88 as f32 (FloatToFloat);
+- StorageDead(_88);
++ _87 = const 1f64 as f32 (FloatToFloat);
+ _86 = opaque::<f32>(move _87) -> [return: bb29, unwind continue];
+ }
+
+ bb29: {
+ StorageDead(_87);
+ StorageDead(_86);
+ StorageLive(_89);
+- StorageLive(_90);
+- _90 = _3;
+- _89 = opaque::<f64>(move _90) -> [return: bb30, unwind continue];
++ _89 = opaque::<f64>(const 1f64) -> [return: bb30, unwind continue];
+ }
+
+ bb30: {
+- StorageDead(_90);
+ StorageDead(_89);
+ _0 = const ();
+- StorageDead(_3);
+- StorageDead(_2);
+- StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff b/tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff
new file mode 100644
index 000000000..ee320cf67
--- /dev/null
+++ b/tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff
@@ -0,0 +1,191 @@
+- // MIR for `dereferences` before GVN
++ // MIR for `dereferences` after GVN
+
+ fn dereferences(_1: &mut u32, _2: &impl Copy, _3: &S<u32>) -> () {
+ debug t => _1;
+ debug u => _2;
+ debug s => _3;
+ let mut _0: ();
+ let _4: ();
+ let mut _5: u32;
+ let _6: ();
+ let mut _7: u32;
+ let _8: *const u32;
+ let _9: ();
+ let mut _10: u32;
+ let _11: ();
+ let mut _12: u32;
+ let _14: ();
+ let mut _15: u32;
+ let _16: ();
+ let mut _17: u32;
+ let _19: ();
+ let mut _20: u32;
+ let _21: ();
+ let mut _22: u32;
+ let _23: ();
+ let mut _24: &u32;
+ let _25: ();
+ let mut _26: impl Copy;
+ let _27: ();
+ let mut _28: impl Copy;
+ let _29: ();
+ let mut _30: u32;
+ let _31: ();
+ let mut _32: u32;
+ scope 1 {
+ debug z => _8;
+ let _13: *mut u32;
+ scope 2 {
+ }
+ scope 3 {
+ }
+ scope 4 {
+ debug z => _13;
+ let _18: &u32;
+ scope 5 {
+ }
+ scope 6 {
+ }
+ scope 7 {
+ debug z => _18;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = (*_1);
+ _4 = opaque::<u32>(move _5) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = (*_1);
+ _6 = opaque::<u32>(move _7) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageLive(_8);
+ _8 = &raw const (*_1);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = (*_8);
+ _9 = opaque::<u32>(move _10) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = (*_8);
+ _11 = opaque::<u32>(move _12) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageLive(_13);
+ _13 = &raw mut (*_1);
+ StorageLive(_14);
+ StorageLive(_15);
+ _15 = (*_13);
+ _14 = opaque::<u32>(move _15) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_16);
+ StorageLive(_17);
+ _17 = (*_13);
+ _16 = opaque::<u32>(move _17) -> [return: bb6, unwind unreachable];
+ }
+
+ bb6: {
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageLive(_18);
+ _18 = &(*_1);
+ StorageLive(_19);
+- StorageLive(_20);
+ _20 = (*_18);
+- _19 = opaque::<u32>(move _20) -> [return: bb7, unwind unreachable];
++ _19 = opaque::<u32>(_20) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+- StorageDead(_20);
+ StorageDead(_19);
+ StorageLive(_21);
+- StorageLive(_22);
+- _22 = (*_18);
+- _21 = opaque::<u32>(move _22) -> [return: bb8, unwind unreachable];
++ _21 = opaque::<u32>(_20) -> [return: bb8, unwind unreachable];
+ }
+
+ bb8: {
+- StorageDead(_22);
+ StorageDead(_21);
+ StorageLive(_23);
+ StorageLive(_24);
+ _24 = &(*_18);
+ _23 = opaque::<&u32>(move _24) -> [return: bb9, unwind unreachable];
+ }
+
+ bb9: {
+ StorageDead(_24);
+ StorageDead(_23);
+ StorageLive(_25);
+ StorageLive(_26);
+ _26 = (*_2);
+ _25 = opaque::<impl Copy>(move _26) -> [return: bb10, unwind unreachable];
+ }
+
+ bb10: {
+ StorageDead(_26);
+ StorageDead(_25);
+ StorageLive(_27);
+ StorageLive(_28);
+ _28 = (*_2);
+ _27 = opaque::<impl Copy>(move _28) -> [return: bb11, unwind unreachable];
+ }
+
+ bb11: {
+ StorageDead(_28);
+ StorageDead(_27);
+ StorageLive(_29);
+- StorageLive(_30);
+ _30 = ((*_3).0: u32);
+- _29 = opaque::<u32>(move _30) -> [return: bb12, unwind unreachable];
++ _29 = opaque::<u32>(_30) -> [return: bb12, unwind unreachable];
+ }
+
+ bb12: {
+- StorageDead(_30);
+ StorageDead(_29);
+ StorageLive(_31);
+- StorageLive(_32);
+- _32 = ((*_3).0: u32);
+- _31 = opaque::<u32>(move _32) -> [return: bb13, unwind unreachable];
++ _31 = opaque::<u32>(_30) -> [return: bb13, unwind unreachable];
+ }
+
+ bb13: {
+- StorageDead(_32);
+ StorageDead(_31);
+ _0 = const ();
+ StorageDead(_18);
+ StorageDead(_13);
+ StorageDead(_8);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff b/tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff
new file mode 100644
index 000000000..f627b4d59
--- /dev/null
+++ b/tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff
@@ -0,0 +1,191 @@
+- // MIR for `dereferences` before GVN
++ // MIR for `dereferences` after GVN
+
+ fn dereferences(_1: &mut u32, _2: &impl Copy, _3: &S<u32>) -> () {
+ debug t => _1;
+ debug u => _2;
+ debug s => _3;
+ let mut _0: ();
+ let _4: ();
+ let mut _5: u32;
+ let _6: ();
+ let mut _7: u32;
+ let _8: *const u32;
+ let _9: ();
+ let mut _10: u32;
+ let _11: ();
+ let mut _12: u32;
+ let _14: ();
+ let mut _15: u32;
+ let _16: ();
+ let mut _17: u32;
+ let _19: ();
+ let mut _20: u32;
+ let _21: ();
+ let mut _22: u32;
+ let _23: ();
+ let mut _24: &u32;
+ let _25: ();
+ let mut _26: impl Copy;
+ let _27: ();
+ let mut _28: impl Copy;
+ let _29: ();
+ let mut _30: u32;
+ let _31: ();
+ let mut _32: u32;
+ scope 1 {
+ debug z => _8;
+ let _13: *mut u32;
+ scope 2 {
+ }
+ scope 3 {
+ }
+ scope 4 {
+ debug z => _13;
+ let _18: &u32;
+ scope 5 {
+ }
+ scope 6 {
+ }
+ scope 7 {
+ debug z => _18;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = (*_1);
+ _4 = opaque::<u32>(move _5) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = (*_1);
+ _6 = opaque::<u32>(move _7) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageLive(_8);
+ _8 = &raw const (*_1);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = (*_8);
+ _9 = opaque::<u32>(move _10) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = (*_8);
+ _11 = opaque::<u32>(move _12) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageLive(_13);
+ _13 = &raw mut (*_1);
+ StorageLive(_14);
+ StorageLive(_15);
+ _15 = (*_13);
+ _14 = opaque::<u32>(move _15) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_16);
+ StorageLive(_17);
+ _17 = (*_13);
+ _16 = opaque::<u32>(move _17) -> [return: bb6, unwind continue];
+ }
+
+ bb6: {
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageLive(_18);
+ _18 = &(*_1);
+ StorageLive(_19);
+- StorageLive(_20);
+ _20 = (*_18);
+- _19 = opaque::<u32>(move _20) -> [return: bb7, unwind continue];
++ _19 = opaque::<u32>(_20) -> [return: bb7, unwind continue];
+ }
+
+ bb7: {
+- StorageDead(_20);
+ StorageDead(_19);
+ StorageLive(_21);
+- StorageLive(_22);
+- _22 = (*_18);
+- _21 = opaque::<u32>(move _22) -> [return: bb8, unwind continue];
++ _21 = opaque::<u32>(_20) -> [return: bb8, unwind continue];
+ }
+
+ bb8: {
+- StorageDead(_22);
+ StorageDead(_21);
+ StorageLive(_23);
+ StorageLive(_24);
+ _24 = &(*_18);
+ _23 = opaque::<&u32>(move _24) -> [return: bb9, unwind continue];
+ }
+
+ bb9: {
+ StorageDead(_24);
+ StorageDead(_23);
+ StorageLive(_25);
+ StorageLive(_26);
+ _26 = (*_2);
+ _25 = opaque::<impl Copy>(move _26) -> [return: bb10, unwind continue];
+ }
+
+ bb10: {
+ StorageDead(_26);
+ StorageDead(_25);
+ StorageLive(_27);
+ StorageLive(_28);
+ _28 = (*_2);
+ _27 = opaque::<impl Copy>(move _28) -> [return: bb11, unwind continue];
+ }
+
+ bb11: {
+ StorageDead(_28);
+ StorageDead(_27);
+ StorageLive(_29);
+- StorageLive(_30);
+ _30 = ((*_3).0: u32);
+- _29 = opaque::<u32>(move _30) -> [return: bb12, unwind continue];
++ _29 = opaque::<u32>(_30) -> [return: bb12, unwind continue];
+ }
+
+ bb12: {
+- StorageDead(_30);
+ StorageDead(_29);
+ StorageLive(_31);
+- StorageLive(_32);
+- _32 = ((*_3).0: u32);
+- _31 = opaque::<u32>(move _32) -> [return: bb13, unwind continue];
++ _31 = opaque::<u32>(_30) -> [return: bb13, unwind continue];
+ }
+
+ bb13: {
+- StorageDead(_32);
+ StorageDead(_31);
+ _0 = const ();
+ StorageDead(_18);
+ StorageDead(_13);
+ StorageDead(_8);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.multiple_branches.GVN.panic-abort.diff b/tests/mir-opt/gvn.multiple_branches.GVN.panic-abort.diff
new file mode 100644
index 000000000..0a6690028
--- /dev/null
+++ b/tests/mir-opt/gvn.multiple_branches.GVN.panic-abort.diff
@@ -0,0 +1,198 @@
+- // MIR for `multiple_branches` before GVN
++ // MIR for `multiple_branches` after GVN
+
+ fn multiple_branches(_1: bool, _2: u8, _3: u8) -> () {
+ debug t => _1;
+ debug x => _2;
+ debug y => _3;
+ let mut _0: ();
+ let _4: ();
+ let mut _5: bool;
+ let _6: ();
+ let mut _7: u8;
+ let mut _8: u8;
+ let mut _9: u8;
+ let _10: ();
+ let mut _11: u8;
+ let mut _12: u8;
+ let mut _13: u8;
+ let _14: ();
+ let mut _15: u8;
+ let mut _16: u8;
+ let mut _17: u8;
+ let _18: ();
+ let mut _19: u8;
+ let mut _20: u8;
+ let mut _21: u8;
+ let _22: ();
+ let mut _23: u8;
+ let mut _24: u8;
+ let mut _25: u8;
+ let mut _26: bool;
+ let _27: ();
+ let mut _28: u8;
+ let mut _29: u8;
+ let mut _30: u8;
+ let _31: ();
+ let mut _32: u8;
+ let mut _33: u8;
+ let mut _34: u8;
+
+ bb0: {
+- StorageLive(_4);
+- StorageLive(_5);
+- _5 = _1;
+- switchInt(move _5) -> [0: bb4, otherwise: bb1];
++ switchInt(_1) -> [0: bb4, otherwise: bb1];
+ }
+
+ bb1: {
+ StorageLive(_6);
+- StorageLive(_7);
+- StorageLive(_8);
+- _8 = _2;
+- StorageLive(_9);
+- _9 = _3;
+- _7 = Add(move _8, move _9);
+- StorageDead(_9);
+- StorageDead(_8);
+- _6 = opaque::<u8>(move _7) -> [return: bb2, unwind unreachable];
++ _7 = Add(_2, _3);
++ _6 = opaque::<u8>(_7) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+- StorageDead(_7);
+ StorageDead(_6);
+ StorageLive(_10);
+- StorageLive(_11);
+- StorageLive(_12);
+- _12 = _2;
+- StorageLive(_13);
+- _13 = _3;
+- _11 = Add(move _12, move _13);
+- StorageDead(_13);
+- StorageDead(_12);
+- _10 = opaque::<u8>(move _11) -> [return: bb3, unwind unreachable];
++ _10 = opaque::<u8>(_7) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+- StorageDead(_11);
+ StorageDead(_10);
+- _4 = const ();
+ goto -> bb7;
+ }
+
+ bb4: {
+ StorageLive(_14);
+- StorageLive(_15);
+- StorageLive(_16);
+- _16 = _2;
+- StorageLive(_17);
+- _17 = _3;
+- _15 = Add(move _16, move _17);
+- StorageDead(_17);
+- StorageDead(_16);
+- _14 = opaque::<u8>(move _15) -> [return: bb5, unwind unreachable];
++ _15 = Add(_2, _3);
++ _14 = opaque::<u8>(_15) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+- StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_18);
+- StorageLive(_19);
+- StorageLive(_20);
+- _20 = _2;
+- StorageLive(_21);
+- _21 = _3;
+- _19 = Add(move _20, move _21);
+- StorageDead(_21);
+- StorageDead(_20);
+- _18 = opaque::<u8>(move _19) -> [return: bb6, unwind unreachable];
++ _18 = opaque::<u8>(_15) -> [return: bb6, unwind unreachable];
+ }
+
+ bb6: {
+- StorageDead(_19);
+ StorageDead(_18);
+- _4 = const ();
+ goto -> bb7;
+ }
+
+ bb7: {
+- StorageDead(_5);
+- StorageDead(_4);
+ StorageLive(_22);
+- StorageLive(_23);
+- StorageLive(_24);
+- _24 = _2;
+- StorageLive(_25);
+- _25 = _3;
+- _23 = Add(move _24, move _25);
+- StorageDead(_25);
+- StorageDead(_24);
+- _22 = opaque::<u8>(move _23) -> [return: bb8, unwind unreachable];
++ _23 = Add(_2, _3);
++ _22 = opaque::<u8>(_23) -> [return: bb8, unwind unreachable];
+ }
+
+ bb8: {
+- StorageDead(_23);
+ StorageDead(_22);
+- StorageLive(_26);
+- _26 = _1;
+- switchInt(move _26) -> [0: bb11, otherwise: bb9];
++ switchInt(_1) -> [0: bb11, otherwise: bb9];
+ }
+
+ bb9: {
+ StorageLive(_27);
+- StorageLive(_28);
+- StorageLive(_29);
+- _29 = _2;
+- StorageLive(_30);
+- _30 = _3;
+- _28 = Add(move _29, move _30);
+- StorageDead(_30);
+- StorageDead(_29);
+- _27 = opaque::<u8>(move _28) -> [return: bb10, unwind unreachable];
++ _27 = opaque::<u8>(_23) -> [return: bb10, unwind unreachable];
+ }
+
+ bb10: {
+- StorageDead(_28);
+ StorageDead(_27);
+ _0 = const ();
+ goto -> bb13;
+ }
+
+ bb11: {
+ StorageLive(_31);
+- StorageLive(_32);
+- StorageLive(_33);
+- _33 = _2;
+- StorageLive(_34);
+- _34 = _3;
+- _32 = Add(move _33, move _34);
+- StorageDead(_34);
+- StorageDead(_33);
+- _31 = opaque::<u8>(move _32) -> [return: bb12, unwind unreachable];
++ _31 = opaque::<u8>(_23) -> [return: bb12, unwind unreachable];
+ }
+
+ bb12: {
+- StorageDead(_32);
+ StorageDead(_31);
+ _0 = const ();
+ goto -> bb13;
+ }
+
+ bb13: {
+- StorageDead(_26);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.multiple_branches.GVN.panic-unwind.diff b/tests/mir-opt/gvn.multiple_branches.GVN.panic-unwind.diff
new file mode 100644
index 000000000..0199f2720
--- /dev/null
+++ b/tests/mir-opt/gvn.multiple_branches.GVN.panic-unwind.diff
@@ -0,0 +1,198 @@
+- // MIR for `multiple_branches` before GVN
++ // MIR for `multiple_branches` after GVN
+
+ fn multiple_branches(_1: bool, _2: u8, _3: u8) -> () {
+ debug t => _1;
+ debug x => _2;
+ debug y => _3;
+ let mut _0: ();
+ let _4: ();
+ let mut _5: bool;
+ let _6: ();
+ let mut _7: u8;
+ let mut _8: u8;
+ let mut _9: u8;
+ let _10: ();
+ let mut _11: u8;
+ let mut _12: u8;
+ let mut _13: u8;
+ let _14: ();
+ let mut _15: u8;
+ let mut _16: u8;
+ let mut _17: u8;
+ let _18: ();
+ let mut _19: u8;
+ let mut _20: u8;
+ let mut _21: u8;
+ let _22: ();
+ let mut _23: u8;
+ let mut _24: u8;
+ let mut _25: u8;
+ let mut _26: bool;
+ let _27: ();
+ let mut _28: u8;
+ let mut _29: u8;
+ let mut _30: u8;
+ let _31: ();
+ let mut _32: u8;
+ let mut _33: u8;
+ let mut _34: u8;
+
+ bb0: {
+- StorageLive(_4);
+- StorageLive(_5);
+- _5 = _1;
+- switchInt(move _5) -> [0: bb4, otherwise: bb1];
++ switchInt(_1) -> [0: bb4, otherwise: bb1];
+ }
+
+ bb1: {
+ StorageLive(_6);
+- StorageLive(_7);
+- StorageLive(_8);
+- _8 = _2;
+- StorageLive(_9);
+- _9 = _3;
+- _7 = Add(move _8, move _9);
+- StorageDead(_9);
+- StorageDead(_8);
+- _6 = opaque::<u8>(move _7) -> [return: bb2, unwind continue];
++ _7 = Add(_2, _3);
++ _6 = opaque::<u8>(_7) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+- StorageDead(_7);
+ StorageDead(_6);
+ StorageLive(_10);
+- StorageLive(_11);
+- StorageLive(_12);
+- _12 = _2;
+- StorageLive(_13);
+- _13 = _3;
+- _11 = Add(move _12, move _13);
+- StorageDead(_13);
+- StorageDead(_12);
+- _10 = opaque::<u8>(move _11) -> [return: bb3, unwind continue];
++ _10 = opaque::<u8>(_7) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+- StorageDead(_11);
+ StorageDead(_10);
+- _4 = const ();
+ goto -> bb7;
+ }
+
+ bb4: {
+ StorageLive(_14);
+- StorageLive(_15);
+- StorageLive(_16);
+- _16 = _2;
+- StorageLive(_17);
+- _17 = _3;
+- _15 = Add(move _16, move _17);
+- StorageDead(_17);
+- StorageDead(_16);
+- _14 = opaque::<u8>(move _15) -> [return: bb5, unwind continue];
++ _15 = Add(_2, _3);
++ _14 = opaque::<u8>(_15) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+- StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_18);
+- StorageLive(_19);
+- StorageLive(_20);
+- _20 = _2;
+- StorageLive(_21);
+- _21 = _3;
+- _19 = Add(move _20, move _21);
+- StorageDead(_21);
+- StorageDead(_20);
+- _18 = opaque::<u8>(move _19) -> [return: bb6, unwind continue];
++ _18 = opaque::<u8>(_15) -> [return: bb6, unwind continue];
+ }
+
+ bb6: {
+- StorageDead(_19);
+ StorageDead(_18);
+- _4 = const ();
+ goto -> bb7;
+ }
+
+ bb7: {
+- StorageDead(_5);
+- StorageDead(_4);
+ StorageLive(_22);
+- StorageLive(_23);
+- StorageLive(_24);
+- _24 = _2;
+- StorageLive(_25);
+- _25 = _3;
+- _23 = Add(move _24, move _25);
+- StorageDead(_25);
+- StorageDead(_24);
+- _22 = opaque::<u8>(move _23) -> [return: bb8, unwind continue];
++ _23 = Add(_2, _3);
++ _22 = opaque::<u8>(_23) -> [return: bb8, unwind continue];
+ }
+
+ bb8: {
+- StorageDead(_23);
+ StorageDead(_22);
+- StorageLive(_26);
+- _26 = _1;
+- switchInt(move _26) -> [0: bb11, otherwise: bb9];
++ switchInt(_1) -> [0: bb11, otherwise: bb9];
+ }
+
+ bb9: {
+ StorageLive(_27);
+- StorageLive(_28);
+- StorageLive(_29);
+- _29 = _2;
+- StorageLive(_30);
+- _30 = _3;
+- _28 = Add(move _29, move _30);
+- StorageDead(_30);
+- StorageDead(_29);
+- _27 = opaque::<u8>(move _28) -> [return: bb10, unwind continue];
++ _27 = opaque::<u8>(_23) -> [return: bb10, unwind continue];
+ }
+
+ bb10: {
+- StorageDead(_28);
+ StorageDead(_27);
+ _0 = const ();
+ goto -> bb13;
+ }
+
+ bb11: {
+ StorageLive(_31);
+- StorageLive(_32);
+- StorageLive(_33);
+- _33 = _2;
+- StorageLive(_34);
+- _34 = _3;
+- _32 = Add(move _33, move _34);
+- StorageDead(_34);
+- StorageDead(_33);
+- _31 = opaque::<u8>(move _32) -> [return: bb12, unwind continue];
++ _31 = opaque::<u8>(_23) -> [return: bb12, unwind continue];
+ }
+
+ bb12: {
+- StorageDead(_32);
+ StorageDead(_31);
+ _0 = const ();
+ goto -> bb13;
+ }
+
+ bb13: {
+- StorageDead(_26);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.references.GVN.panic-abort.diff b/tests/mir-opt/gvn.references.GVN.panic-abort.diff
new file mode 100644
index 000000000..b7ad4ab1f
--- /dev/null
+++ b/tests/mir-opt/gvn.references.GVN.panic-abort.diff
@@ -0,0 +1,105 @@
+- // MIR for `references` before GVN
++ // MIR for `references` after GVN
+
+ fn references(_1: impl Sized) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: &impl Sized;
+ let _4: ();
+ let mut _5: &impl Sized;
+ let _6: ();
+ let mut _7: &mut impl Sized;
+ let _8: ();
+ let mut _9: &mut impl Sized;
+ let _10: ();
+ let mut _11: *const impl Sized;
+ let _12: ();
+ let mut _13: *const impl Sized;
+ let _14: ();
+ let mut _15: *mut impl Sized;
+ let _16: ();
+ let mut _17: *mut impl Sized;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &_1;
+ _2 = opaque::<&impl Sized>(move _3) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = &_1;
+ _4 = opaque::<&impl Sized>(move _5) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &mut _1;
+ _6 = opaque::<&mut impl Sized>(move _7) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageLive(_8);
+ StorageLive(_9);
+ _9 = &mut _1;
+ _8 = opaque::<&mut impl Sized>(move _9) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_10);
+ StorageLive(_11);
+ _11 = &raw const _1;
+ _10 = opaque::<*const impl Sized>(move _11) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageLive(_12);
+ StorageLive(_13);
+ _13 = &raw const _1;
+ _12 = opaque::<*const impl Sized>(move _13) -> [return: bb6, unwind unreachable];
+ }
+
+ bb6: {
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageLive(_14);
+ StorageLive(_15);
+ _15 = &raw mut _1;
+ _14 = opaque::<*mut impl Sized>(move _15) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_16);
+ StorageLive(_17);
+ _17 = &raw mut _1;
+ _16 = opaque::<*mut impl Sized>(move _17) -> [return: bb8, unwind unreachable];
+ }
+
+ bb8: {
+ StorageDead(_17);
+ StorageDead(_16);
+ _0 = const ();
+ drop(_1) -> [return: bb9, unwind unreachable];
+ }
+
+ bb9: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.references.GVN.panic-unwind.diff b/tests/mir-opt/gvn.references.GVN.panic-unwind.diff
new file mode 100644
index 000000000..08ed4c629
--- /dev/null
+++ b/tests/mir-opt/gvn.references.GVN.panic-unwind.diff
@@ -0,0 +1,113 @@
+- // MIR for `references` before GVN
++ // MIR for `references` after GVN
+
+ fn references(_1: impl Sized) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: &impl Sized;
+ let _4: ();
+ let mut _5: &impl Sized;
+ let _6: ();
+ let mut _7: &mut impl Sized;
+ let _8: ();
+ let mut _9: &mut impl Sized;
+ let _10: ();
+ let mut _11: *const impl Sized;
+ let _12: ();
+ let mut _13: *const impl Sized;
+ let _14: ();
+ let mut _15: *mut impl Sized;
+ let _16: ();
+ let mut _17: *mut impl Sized;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &_1;
+ _2 = opaque::<&impl Sized>(move _3) -> [return: bb1, unwind: bb10];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = &_1;
+ _4 = opaque::<&impl Sized>(move _5) -> [return: bb2, unwind: bb10];
+ }
+
+ bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &mut _1;
+ _6 = opaque::<&mut impl Sized>(move _7) -> [return: bb3, unwind: bb10];
+ }
+
+ bb3: {
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageLive(_8);
+ StorageLive(_9);
+ _9 = &mut _1;
+ _8 = opaque::<&mut impl Sized>(move _9) -> [return: bb4, unwind: bb10];
+ }
+
+ bb4: {
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_10);
+ StorageLive(_11);
+ _11 = &raw const _1;
+ _10 = opaque::<*const impl Sized>(move _11) -> [return: bb5, unwind: bb10];
+ }
+
+ bb5: {
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageLive(_12);
+ StorageLive(_13);
+ _13 = &raw const _1;
+ _12 = opaque::<*const impl Sized>(move _13) -> [return: bb6, unwind: bb10];
+ }
+
+ bb6: {
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageLive(_14);
+ StorageLive(_15);
+ _15 = &raw mut _1;
+ _14 = opaque::<*mut impl Sized>(move _15) -> [return: bb7, unwind: bb10];
+ }
+
+ bb7: {
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_16);
+ StorageLive(_17);
+ _17 = &raw mut _1;
+ _16 = opaque::<*mut impl Sized>(move _17) -> [return: bb8, unwind: bb10];
+ }
+
+ bb8: {
+ StorageDead(_17);
+ StorageDead(_16);
+ _0 = const ();
+ drop(_1) -> [return: bb9, unwind: bb11];
+ }
+
+ bb9: {
+ return;
+ }
+
+ bb10 (cleanup): {
+ drop(_1) -> [return: bb11, unwind terminate(cleanup)];
+ }
+
+ bb11 (cleanup): {
+ resume;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.repeated_index.GVN.panic-abort.diff b/tests/mir-opt/gvn.repeated_index.GVN.panic-abort.diff
new file mode 100644
index 000000000..4c29523d6
--- /dev/null
+++ b/tests/mir-opt/gvn.repeated_index.GVN.panic-abort.diff
@@ -0,0 +1,76 @@
+- // MIR for `repeated_index` before GVN
++ // MIR for `repeated_index` after GVN
+
+ fn repeated_index(_1: T, _2: usize) -> () {
+ debug x => _1;
+ debug idx => _2;
+ let mut _0: ();
+ let _3: [T; N];
+ let mut _4: T;
+ let _5: ();
+ let mut _6: T;
+ let _7: usize;
+ let mut _8: usize;
+ let mut _9: bool;
+ let _10: ();
+ let mut _11: T;
+ let _12: usize;
+ let mut _13: usize;
+ let mut _14: bool;
+ scope 1 {
+ debug a => _3;
+ }
+
+ bb0: {
+ StorageLive(_3);
+- StorageLive(_4);
+- _4 = _1;
+- _3 = [move _4; N];
+- StorageDead(_4);
++ _3 = [_1; N];
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = const 0_usize;
+ _8 = Len(_3);
+- _9 = Lt(_7, _8);
+- assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb1, unwind unreachable];
++ _9 = Lt(const 0_usize, _8);
++ assert(move _9, "index out of bounds: the length is {} but the index is {}", _8, const 0_usize) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ _6 = _3[_7];
+ _5 = opaque::<T>(move _6) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageLive(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = _2;
+- _13 = Len(_3);
+- _14 = Lt(_12, _13);
+- assert(move _14, "index out of bounds: the length is {} but the index is {}", move _13, _12) -> [success: bb3, unwind unreachable];
++ _14 = Lt(_2, _8);
++ assert(move _14, "index out of bounds: the length is {} but the index is {}", _8, _2) -> [success: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ _11 = _3[_12];
+ _10 = opaque::<T>(move _11) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_11);
+ StorageDead(_12);
+ StorageDead(_10);
+ _0 = const ();
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff b/tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff
new file mode 100644
index 000000000..e44f54cf3
--- /dev/null
+++ b/tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff
@@ -0,0 +1,76 @@
+- // MIR for `repeated_index` before GVN
++ // MIR for `repeated_index` after GVN
+
+ fn repeated_index(_1: T, _2: usize) -> () {
+ debug x => _1;
+ debug idx => _2;
+ let mut _0: ();
+ let _3: [T; N];
+ let mut _4: T;
+ let _5: ();
+ let mut _6: T;
+ let _7: usize;
+ let mut _8: usize;
+ let mut _9: bool;
+ let _10: ();
+ let mut _11: T;
+ let _12: usize;
+ let mut _13: usize;
+ let mut _14: bool;
+ scope 1 {
+ debug a => _3;
+ }
+
+ bb0: {
+ StorageLive(_3);
+- StorageLive(_4);
+- _4 = _1;
+- _3 = [move _4; N];
+- StorageDead(_4);
++ _3 = [_1; N];
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = const 0_usize;
+ _8 = Len(_3);
+- _9 = Lt(_7, _8);
+- assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb1, unwind continue];
++ _9 = Lt(const 0_usize, _8);
++ assert(move _9, "index out of bounds: the length is {} but the index is {}", _8, const 0_usize) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+ _6 = _3[_7];
+ _5 = opaque::<T>(move _6) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageLive(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = _2;
+- _13 = Len(_3);
+- _14 = Lt(_12, _13);
+- assert(move _14, "index out of bounds: the length is {} but the index is {}", move _13, _12) -> [success: bb3, unwind continue];
++ _14 = Lt(_2, _8);
++ assert(move _14, "index out of bounds: the length is {} but the index is {}", _8, _2) -> [success: bb3, unwind continue];
+ }
+
+ bb3: {
+ _11 = _3[_12];
+ _10 = opaque::<T>(move _11) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_11);
+ StorageDead(_12);
+ StorageDead(_10);
+ _0 = const ();
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.rs b/tests/mir-opt/gvn.rs
new file mode 100644
index 000000000..a85e2ae36
--- /dev/null
+++ b/tests/mir-opt/gvn.rs
@@ -0,0 +1,253 @@
+// unit-test: GVN
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
+#![feature(raw_ref_op)]
+#![feature(rustc_attrs)]
+#![allow(unconditional_panic)]
+
+struct S<T>(T);
+
+fn subexpression_elimination(x: u64, y: u64, mut z: u64) {
+ opaque(x + y);
+ opaque(x * y);
+ opaque(x - y);
+ opaque(x / y);
+ opaque(x % y);
+ opaque(x & y);
+ opaque(x | y);
+ opaque(x ^ y);
+ opaque(x << y);
+ opaque(x >> y);
+ opaque(x as u32);
+ opaque(x as f32);
+ opaque(S(x));
+ opaque(S(x).0);
+
+ // Those are duplicates to substitute somehow.
+ opaque((x + y) + z);
+ opaque((x * y) + z);
+ opaque((x - y) + z);
+ opaque((x / y) + z);
+ opaque((x % y) + z);
+ opaque((x & y) + z);
+ opaque((x | y) + z);
+ opaque((x ^ y) + z);
+ opaque((x << y) + z);
+ opaque((x >> y) + z);
+ opaque(S(x));
+ opaque(S(x).0);
+
+ // We can substitute through an immutable reference too.
+ let a = &z;
+ opaque(*a + x);
+ opaque(*a + x);
+
+ // But not through a mutable reference or a pointer.
+ let b = &mut z;
+ opaque(*b + x);
+ opaque(*b + x);
+ unsafe {
+ let c = &raw const z;
+ opaque(*c + x);
+ opaque(*c + x);
+ let d = &raw mut z;
+ opaque(*d + x);
+ opaque(*d + x);
+ }
+
+ // We can substitute again, but not with the earlier computations.
+ // Important: `e` is not `a`!
+ let e = &z;
+ opaque(*e + x);
+ opaque(*e + x);
+
+}
+
+fn wrap_unwrap<T: Copy>(x: T) -> T {
+ match Some(x) {
+ Some(y) => y,
+ None => panic!(),
+ }
+}
+
+fn repeated_index<T: Copy, const N: usize>(x: T, idx: usize) {
+ let a = [x; N];
+ opaque(a[0]);
+ opaque(a[idx]);
+}
+
+fn arithmetic(x: u64) {
+ opaque(x + 0);
+ opaque(x - 0);
+ opaque(x * 0);
+ opaque(x * 1);
+ opaque(x / 0);
+ opaque(x / 1);
+ opaque(0 / x);
+ opaque(1 / x);
+ opaque(x % 0);
+ opaque(x % 1);
+ opaque(0 % x);
+ opaque(1 % x);
+ opaque(x & 0);
+ opaque(x | 0);
+ opaque(x ^ 0);
+ opaque(x >> 0);
+ opaque(x << 0);
+}
+
+#[rustc_inherit_overflow_checks]
+fn arithmetic_checked(x: u64) {
+ opaque(x + 0);
+ opaque(x - 0);
+ opaque(x * 0);
+ opaque(x * 1);
+ opaque(x / 0);
+ opaque(x / 1);
+ opaque(0 / x);
+ opaque(1 / x);
+ opaque(x % 0);
+ opaque(x % 1);
+ opaque(0 % x);
+ opaque(1 % x);
+ opaque(x & 0);
+ opaque(x | 0);
+ opaque(x ^ 0);
+ opaque(x >> 0);
+ opaque(x << 0);
+}
+
+fn arithmetic_float(x: f64) {
+ opaque(x + 0.);
+ opaque(x - 0.);
+ opaque(x * 0.);
+ opaque(x / 0.);
+ opaque(0. / x);
+ opaque(x % 0.);
+ opaque(0. % x);
+ // Those are not simplifiable to `true`/`false`, thanks to NaNs.
+ opaque(x == x);
+ opaque(x != x);
+}
+
+fn cast() {
+ let i = 1_i64;
+ let u = 1_u64;
+ let f = 1_f64;
+ opaque(i as u8);
+ opaque(i as u16);
+ opaque(i as u32);
+ opaque(i as u64);
+ opaque(i as i8);
+ opaque(i as i16);
+ opaque(i as i32);
+ opaque(i as i64);
+ opaque(i as f32);
+ opaque(i as f64);
+ opaque(u as u8);
+ opaque(u as u16);
+ opaque(u as u32);
+ opaque(u as u64);
+ opaque(u as i8);
+ opaque(u as i16);
+ opaque(u as i32);
+ opaque(u as i64);
+ opaque(u as f32);
+ opaque(u as f64);
+ opaque(f as u8);
+ opaque(f as u16);
+ opaque(f as u32);
+ opaque(f as u64);
+ opaque(f as i8);
+ opaque(f as i16);
+ opaque(f as i32);
+ opaque(f as i64);
+ opaque(f as f32);
+ opaque(f as f64);
+}
+
+fn multiple_branches(t: bool, x: u8, y: u8) {
+ if t {
+ opaque(x + y); // a
+ opaque(x + y); // should reuse a
+ } else {
+ opaque(x + y); // b
+ opaque(x + y); // shoud reuse b
+ }
+ opaque(x + y); // c
+ if t {
+ opaque(x + y); // should reuse c
+ } else {
+ opaque(x + y); // should reuse c
+ }
+}
+
+fn references(mut x: impl Sized) {
+ opaque(&x);
+ opaque(&x); // should not reuse a
+ opaque(&mut x);
+ opaque(&mut x); // should not reuse a
+ opaque(&raw const x);
+ opaque(&raw const x); // should not reuse a
+ opaque(&raw mut x);
+ opaque(&raw mut x); // should not reuse a
+}
+
+fn dereferences(t: &mut u32, u: &impl Copy, s: &S<u32>) {
+ opaque(*t);
+ opaque(*t); // this cannot reuse a, as x is &mut.
+ let z = &raw const *t;
+ unsafe { opaque(*z) };
+ unsafe { opaque(*z) }; // this cannot reuse a, as x is *const.
+ let z = &raw mut *t;
+ unsafe { opaque(*z) };
+ unsafe { opaque(*z) }; // this cannot reuse a, as x is *mut.
+ let z = &*t;
+ opaque(*z);
+ opaque(*z); // this can reuse, as `z` is immutable ref, Freeze and Copy.
+ opaque(&*z); // but not for a reborrow.
+ opaque(*u);
+ opaque(*u); // this cannot reuse, as `z` is not Freeze.
+ opaque(s.0);
+ opaque(s.0); // *s is not Copy, by (*s).0 is, so we can reuse.
+}
+
+fn slices() {
+ let s = "my favourite slice"; // This is a `Const::Slice` in MIR.
+ opaque(s);
+ let t = s; // This should be the same pointer, so cannot be a `Const::Slice`.
+ opaque(t);
+ assert_eq!(s.as_ptr(), t.as_ptr());
+ let u = unsafe { std::mem::transmute::<&str, &[u8]>(s) };
+ opaque(u);
+ assert_eq!(s.as_ptr(), u.as_ptr());
+}
+
+fn main() {
+ subexpression_elimination(2, 4, 5);
+ wrap_unwrap(5);
+ repeated_index::<u32, 7>(5, 3);
+ arithmetic(5);
+ arithmetic_checked(5);
+ arithmetic_float(5.);
+ cast();
+ multiple_branches(true, 5, 9);
+ references(5);
+ dereferences(&mut 5, &6, &S(7));
+ slices();
+}
+
+#[inline(never)]
+fn opaque(_: impl Sized) {}
+
+// EMIT_MIR gvn.subexpression_elimination.GVN.diff
+// EMIT_MIR gvn.wrap_unwrap.GVN.diff
+// EMIT_MIR gvn.repeated_index.GVN.diff
+// EMIT_MIR gvn.arithmetic.GVN.diff
+// EMIT_MIR gvn.arithmetic_checked.GVN.diff
+// EMIT_MIR gvn.arithmetic_float.GVN.diff
+// EMIT_MIR gvn.cast.GVN.diff
+// EMIT_MIR gvn.multiple_branches.GVN.diff
+// EMIT_MIR gvn.references.GVN.diff
+// EMIT_MIR gvn.dereferences.GVN.diff
+// EMIT_MIR gvn.slices.GVN.diff
diff --git a/tests/mir-opt/gvn.slices.GVN.panic-abort.diff b/tests/mir-opt/gvn.slices.GVN.panic-abort.diff
new file mode 100644
index 000000000..de3d28d05
--- /dev/null
+++ b/tests/mir-opt/gvn.slices.GVN.panic-abort.diff
@@ -0,0 +1,275 @@
+- // MIR for `slices` before GVN
++ // MIR for `slices` after GVN
+
+ fn slices() -> () {
+ let mut _0: ();
+ let _1: &str;
+ let _2: ();
+ let mut _3: &str;
+ let _5: ();
+ let mut _6: &str;
+ let _7: ();
+ let mut _8: (&*const u8, &*const u8);
+ let mut _9: &*const u8;
+ let _10: *const u8;
+ let mut _11: &str;
+ let mut _12: &*const u8;
+ let _13: *const u8;
+ let mut _14: &str;
+ let mut _17: bool;
+ let mut _18: *const u8;
+ let mut _19: *const u8;
+ let mut _20: !;
+ let _22: !;
+ let mut _23: core::panicking::AssertKind;
+ let mut _24: &*const u8;
+ let _25: &*const u8;
+ let mut _26: &*const u8;
+ let _27: &*const u8;
+ let mut _28: std::option::Option<std::fmt::Arguments<'_>>;
+ let mut _30: &str;
+ let _31: ();
+ let mut _32: &[u8];
+ let _33: ();
+ let mut _34: (&*const u8, &*const u8);
+ let mut _35: &*const u8;
+ let _36: *const u8;
+ let mut _37: &str;
+ let mut _38: &*const u8;
+ let _39: *const u8;
+ let mut _40: &[u8];
+ let mut _43: bool;
+ let mut _44: *const u8;
+ let mut _45: *const u8;
+ let mut _46: !;
+ let _48: !;
+ let mut _49: core::panicking::AssertKind;
+ let mut _50: &*const u8;
+ let _51: &*const u8;
+ let mut _52: &*const u8;
+ let _53: &*const u8;
+ let mut _54: std::option::Option<std::fmt::Arguments<'_>>;
+ scope 1 {
+ debug s => _1;
+ let _4: &str;
+ scope 2 {
+ debug t => _4;
+ let _15: &*const u8;
+ let _16: &*const u8;
+ let _29: &[u8];
+ scope 3 {
+ debug left_val => _15;
+ debug right_val => _16;
+ let _21: core::panicking::AssertKind;
+ scope 4 {
+ debug kind => _21;
+ }
+ }
+ scope 5 {
+ debug u => _29;
+ let _41: &*const u8;
+ let _42: &*const u8;
+ scope 7 {
+ debug left_val => _41;
+ debug right_val => _42;
+ let _47: core::panicking::AssertKind;
+ scope 8 {
+ debug kind => _47;
+ }
+ }
+ }
+ scope 6 {
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_1);
+ _1 = const "my favourite slice";
+ StorageLive(_2);
+- StorageLive(_3);
+- _3 = _1;
+- _2 = opaque::<&str>(move _3) -> [return: bb1, unwind unreachable];
++ _2 = opaque::<&str>(_1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+- StorageLive(_6);
+- _6 = _4;
+- _5 = opaque::<&str>(move _6) -> [return: bb2, unwind unreachable];
++ _5 = opaque::<&str>(_1) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+- StorageDead(_6);
+ StorageDead(_5);
+- StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+ StorageLive(_10);
+ StorageLive(_11);
+ _11 = &(*_1);
+ _10 = core::str::<impl str>::as_ptr(move _11) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_11);
+ _9 = &_10;
+ StorageLive(_12);
+ StorageLive(_13);
+ StorageLive(_14);
+ _14 = &(*_4);
+ _13 = core::str::<impl str>::as_ptr(move _14) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_14);
+ _12 = &_13;
+ _8 = (move _9, move _12);
+ StorageDead(_12);
+ StorageDead(_9);
+ StorageLive(_15);
+ _15 = (_8.0: &*const u8);
+ StorageLive(_16);
+ _16 = (_8.1: &*const u8);
+ StorageLive(_17);
+ StorageLive(_18);
+ _18 = (*_15);
+ StorageLive(_19);
+ _19 = (*_16);
+ _17 = Eq(move _18, move _19);
+ switchInt(move _17) -> [0: bb6, otherwise: bb5];
+ }
+
+ bb5: {
+ StorageDead(_19);
+ StorageDead(_18);
+- _7 = const ();
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageDead(_15);
+ StorageDead(_13);
+ StorageDead(_10);
+ StorageDead(_8);
+- StorageDead(_7);
+- StorageLive(_29);
+ StorageLive(_30);
+ _30 = &(*_1);
+ _29 = move _30 as &[u8] (Transmute);
+ StorageDead(_30);
+ StorageLive(_31);
+- StorageLive(_32);
+- _32 = _29;
+- _31 = opaque::<&[u8]>(move _32) -> [return: bb7, unwind unreachable];
++ _31 = opaque::<&[u8]>(_29) -> [return: bb7, unwind unreachable];
+ }
+
+ bb6: {
+ StorageDead(_19);
+ StorageDead(_18);
+- StorageLive(_21);
+ _21 = core::panicking::AssertKind::Eq;
+ StorageLive(_22);
+- StorageLive(_23);
+- _23 = move _21;
+ StorageLive(_24);
+ StorageLive(_25);
+ _25 = &(*_15);
+ _24 = &(*_25);
+ StorageLive(_26);
+ StorageLive(_27);
+ _27 = &(*_16);
+ _26 = &(*_27);
+ StorageLive(_28);
+ _28 = Option::<Arguments<'_>>::None;
+- _22 = core::panicking::assert_failed::<*const u8, *const u8>(move _23, move _24, move _26, move _28) -> unwind unreachable;
++ _22 = core::panicking::assert_failed::<*const u8, *const u8>(_21, move _24, move _26, move _28) -> unwind unreachable;
+ }
+
+ bb7: {
+- StorageDead(_32);
+ StorageDead(_31);
+- StorageLive(_33);
+ StorageLive(_34);
+ StorageLive(_35);
+ StorageLive(_36);
+ StorageLive(_37);
+ _37 = &(*_1);
+ _36 = core::str::<impl str>::as_ptr(move _37) -> [return: bb8, unwind unreachable];
+ }
+
+ bb8: {
+ StorageDead(_37);
+ _35 = &_36;
+ StorageLive(_38);
+ StorageLive(_39);
+ StorageLive(_40);
+ _40 = &(*_29);
+ _39 = core::slice::<impl [u8]>::as_ptr(move _40) -> [return: bb9, unwind unreachable];
+ }
+
+ bb9: {
+ StorageDead(_40);
+ _38 = &_39;
+ _34 = (move _35, move _38);
+ StorageDead(_38);
+ StorageDead(_35);
+ StorageLive(_41);
+ _41 = (_34.0: &*const u8);
+ StorageLive(_42);
+ _42 = (_34.1: &*const u8);
+ StorageLive(_43);
+ StorageLive(_44);
+ _44 = (*_41);
+ StorageLive(_45);
+ _45 = (*_42);
+ _43 = Eq(move _44, move _45);
+ switchInt(move _43) -> [0: bb11, otherwise: bb10];
+ }
+
+ bb10: {
+ StorageDead(_45);
+ StorageDead(_44);
+- _33 = const ();
+ StorageDead(_43);
+ StorageDead(_42);
+ StorageDead(_41);
+ StorageDead(_39);
+ StorageDead(_36);
+ StorageDead(_34);
+- StorageDead(_33);
+ _0 = const ();
+- StorageDead(_29);
+ StorageDead(_4);
+- StorageDead(_1);
+ return;
+ }
+
+ bb11: {
+ StorageDead(_45);
+ StorageDead(_44);
+- StorageLive(_47);
+ _47 = core::panicking::AssertKind::Eq;
+ StorageLive(_48);
+- StorageLive(_49);
+- _49 = move _47;
+ StorageLive(_50);
+ StorageLive(_51);
+ _51 = &(*_41);
+ _50 = &(*_51);
+ StorageLive(_52);
+ StorageLive(_53);
+ _53 = &(*_42);
+ _52 = &(*_53);
+ StorageLive(_54);
+ _54 = Option::<Arguments<'_>>::None;
+- _48 = core::panicking::assert_failed::<*const u8, *const u8>(move _49, move _50, move _52, move _54) -> unwind unreachable;
++ _48 = core::panicking::assert_failed::<*const u8, *const u8>(_47, move _50, move _52, move _54) -> unwind unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff b/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff
new file mode 100644
index 000000000..f22bb2543
--- /dev/null
+++ b/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff
@@ -0,0 +1,275 @@
+- // MIR for `slices` before GVN
++ // MIR for `slices` after GVN
+
+ fn slices() -> () {
+ let mut _0: ();
+ let _1: &str;
+ let _2: ();
+ let mut _3: &str;
+ let _5: ();
+ let mut _6: &str;
+ let _7: ();
+ let mut _8: (&*const u8, &*const u8);
+ let mut _9: &*const u8;
+ let _10: *const u8;
+ let mut _11: &str;
+ let mut _12: &*const u8;
+ let _13: *const u8;
+ let mut _14: &str;
+ let mut _17: bool;
+ let mut _18: *const u8;
+ let mut _19: *const u8;
+ let mut _20: !;
+ let _22: !;
+ let mut _23: core::panicking::AssertKind;
+ let mut _24: &*const u8;
+ let _25: &*const u8;
+ let mut _26: &*const u8;
+ let _27: &*const u8;
+ let mut _28: std::option::Option<std::fmt::Arguments<'_>>;
+ let mut _30: &str;
+ let _31: ();
+ let mut _32: &[u8];
+ let _33: ();
+ let mut _34: (&*const u8, &*const u8);
+ let mut _35: &*const u8;
+ let _36: *const u8;
+ let mut _37: &str;
+ let mut _38: &*const u8;
+ let _39: *const u8;
+ let mut _40: &[u8];
+ let mut _43: bool;
+ let mut _44: *const u8;
+ let mut _45: *const u8;
+ let mut _46: !;
+ let _48: !;
+ let mut _49: core::panicking::AssertKind;
+ let mut _50: &*const u8;
+ let _51: &*const u8;
+ let mut _52: &*const u8;
+ let _53: &*const u8;
+ let mut _54: std::option::Option<std::fmt::Arguments<'_>>;
+ scope 1 {
+ debug s => _1;
+ let _4: &str;
+ scope 2 {
+ debug t => _4;
+ let _15: &*const u8;
+ let _16: &*const u8;
+ let _29: &[u8];
+ scope 3 {
+ debug left_val => _15;
+ debug right_val => _16;
+ let _21: core::panicking::AssertKind;
+ scope 4 {
+ debug kind => _21;
+ }
+ }
+ scope 5 {
+ debug u => _29;
+ let _41: &*const u8;
+ let _42: &*const u8;
+ scope 7 {
+ debug left_val => _41;
+ debug right_val => _42;
+ let _47: core::panicking::AssertKind;
+ scope 8 {
+ debug kind => _47;
+ }
+ }
+ }
+ scope 6 {
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_1);
+ _1 = const "my favourite slice";
+ StorageLive(_2);
+- StorageLive(_3);
+- _3 = _1;
+- _2 = opaque::<&str>(move _3) -> [return: bb1, unwind continue];
++ _2 = opaque::<&str>(_1) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+- StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+- StorageLive(_6);
+- _6 = _4;
+- _5 = opaque::<&str>(move _6) -> [return: bb2, unwind continue];
++ _5 = opaque::<&str>(_1) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+- StorageDead(_6);
+ StorageDead(_5);
+- StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+ StorageLive(_10);
+ StorageLive(_11);
+ _11 = &(*_1);
+ _10 = core::str::<impl str>::as_ptr(move _11) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_11);
+ _9 = &_10;
+ StorageLive(_12);
+ StorageLive(_13);
+ StorageLive(_14);
+ _14 = &(*_4);
+ _13 = core::str::<impl str>::as_ptr(move _14) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_14);
+ _12 = &_13;
+ _8 = (move _9, move _12);
+ StorageDead(_12);
+ StorageDead(_9);
+ StorageLive(_15);
+ _15 = (_8.0: &*const u8);
+ StorageLive(_16);
+ _16 = (_8.1: &*const u8);
+ StorageLive(_17);
+ StorageLive(_18);
+ _18 = (*_15);
+ StorageLive(_19);
+ _19 = (*_16);
+ _17 = Eq(move _18, move _19);
+ switchInt(move _17) -> [0: bb6, otherwise: bb5];
+ }
+
+ bb5: {
+ StorageDead(_19);
+ StorageDead(_18);
+- _7 = const ();
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageDead(_15);
+ StorageDead(_13);
+ StorageDead(_10);
+ StorageDead(_8);
+- StorageDead(_7);
+- StorageLive(_29);
+ StorageLive(_30);
+ _30 = &(*_1);
+ _29 = move _30 as &[u8] (Transmute);
+ StorageDead(_30);
+ StorageLive(_31);
+- StorageLive(_32);
+- _32 = _29;
+- _31 = opaque::<&[u8]>(move _32) -> [return: bb7, unwind continue];
++ _31 = opaque::<&[u8]>(_29) -> [return: bb7, unwind continue];
+ }
+
+ bb6: {
+ StorageDead(_19);
+ StorageDead(_18);
+- StorageLive(_21);
+ _21 = core::panicking::AssertKind::Eq;
+ StorageLive(_22);
+- StorageLive(_23);
+- _23 = move _21;
+ StorageLive(_24);
+ StorageLive(_25);
+ _25 = &(*_15);
+ _24 = &(*_25);
+ StorageLive(_26);
+ StorageLive(_27);
+ _27 = &(*_16);
+ _26 = &(*_27);
+ StorageLive(_28);
+ _28 = Option::<Arguments<'_>>::None;
+- _22 = core::panicking::assert_failed::<*const u8, *const u8>(move _23, move _24, move _26, move _28) -> unwind continue;
++ _22 = core::panicking::assert_failed::<*const u8, *const u8>(_21, move _24, move _26, move _28) -> unwind continue;
+ }
+
+ bb7: {
+- StorageDead(_32);
+ StorageDead(_31);
+- StorageLive(_33);
+ StorageLive(_34);
+ StorageLive(_35);
+ StorageLive(_36);
+ StorageLive(_37);
+ _37 = &(*_1);
+ _36 = core::str::<impl str>::as_ptr(move _37) -> [return: bb8, unwind continue];
+ }
+
+ bb8: {
+ StorageDead(_37);
+ _35 = &_36;
+ StorageLive(_38);
+ StorageLive(_39);
+ StorageLive(_40);
+ _40 = &(*_29);
+ _39 = core::slice::<impl [u8]>::as_ptr(move _40) -> [return: bb9, unwind continue];
+ }
+
+ bb9: {
+ StorageDead(_40);
+ _38 = &_39;
+ _34 = (move _35, move _38);
+ StorageDead(_38);
+ StorageDead(_35);
+ StorageLive(_41);
+ _41 = (_34.0: &*const u8);
+ StorageLive(_42);
+ _42 = (_34.1: &*const u8);
+ StorageLive(_43);
+ StorageLive(_44);
+ _44 = (*_41);
+ StorageLive(_45);
+ _45 = (*_42);
+ _43 = Eq(move _44, move _45);
+ switchInt(move _43) -> [0: bb11, otherwise: bb10];
+ }
+
+ bb10: {
+ StorageDead(_45);
+ StorageDead(_44);
+- _33 = const ();
+ StorageDead(_43);
+ StorageDead(_42);
+ StorageDead(_41);
+ StorageDead(_39);
+ StorageDead(_36);
+ StorageDead(_34);
+- StorageDead(_33);
+ _0 = const ();
+- StorageDead(_29);
+ StorageDead(_4);
+- StorageDead(_1);
+ return;
+ }
+
+ bb11: {
+ StorageDead(_45);
+ StorageDead(_44);
+- StorageLive(_47);
+ _47 = core::panicking::AssertKind::Eq;
+ StorageLive(_48);
+- StorageLive(_49);
+- _49 = move _47;
+ StorageLive(_50);
+ StorageLive(_51);
+ _51 = &(*_41);
+ _50 = &(*_51);
+ StorageLive(_52);
+ StorageLive(_53);
+ _53 = &(*_42);
+ _52 = &(*_53);
+ StorageLive(_54);
+ _54 = Option::<Arguments<'_>>::None;
+- _48 = core::panicking::assert_failed::<*const u8, *const u8>(move _49, move _50, move _52, move _54) -> unwind continue;
++ _48 = core::panicking::assert_failed::<*const u8, *const u8>(_47, move _50, move _52, move _54) -> unwind continue;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff
new file mode 100644
index 000000000..bf866e2f4
--- /dev/null
+++ b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff
@@ -0,0 +1,883 @@
+- // MIR for `subexpression_elimination` before GVN
++ // MIR for `subexpression_elimination` after GVN
+
+ fn subexpression_elimination(_1: u64, _2: u64, _3: u64) -> () {
+ debug x => _1;
+ debug y => _2;
+ debug z => _3;
+ let mut _0: ();
+ let _4: ();
+ let mut _5: u64;
+ let mut _6: u64;
+ let mut _7: u64;
+ let _8: ();
+ let mut _9: u64;
+ let mut _10: u64;
+ let mut _11: u64;
+ let _12: ();
+ let mut _13: u64;
+ let mut _14: u64;
+ let mut _15: u64;
+ let _16: ();
+ let mut _17: u64;
+ let mut _18: u64;
+ let mut _19: u64;
+ let mut _20: bool;
+ let _21: ();
+ let mut _22: u64;
+ let mut _23: u64;
+ let mut _24: u64;
+ let mut _25: bool;
+ let _26: ();
+ let mut _27: u64;
+ let mut _28: u64;
+ let mut _29: u64;
+ let _30: ();
+ let mut _31: u64;
+ let mut _32: u64;
+ let mut _33: u64;
+ let _34: ();
+ let mut _35: u64;
+ let mut _36: u64;
+ let mut _37: u64;
+ let _38: ();
+ let mut _39: u64;
+ let mut _40: u64;
+ let mut _41: u64;
+ let _42: ();
+ let mut _43: u64;
+ let mut _44: u64;
+ let mut _45: u64;
+ let _46: ();
+ let mut _47: u32;
+ let mut _48: u64;
+ let _49: ();
+ let mut _50: f32;
+ let mut _51: u64;
+ let _52: ();
+ let mut _53: S<u64>;
+ let mut _54: u64;
+ let _55: ();
+ let mut _56: u64;
+ let mut _57: S<u64>;
+ let mut _58: u64;
+ let _59: ();
+ let mut _60: u64;
+ let mut _61: u64;
+ let mut _62: u64;
+ let mut _63: u64;
+ let mut _64: u64;
+ let _65: ();
+ let mut _66: u64;
+ let mut _67: u64;
+ let mut _68: u64;
+ let mut _69: u64;
+ let mut _70: u64;
+ let _71: ();
+ let mut _72: u64;
+ let mut _73: u64;
+ let mut _74: u64;
+ let mut _75: u64;
+ let mut _76: u64;
+ let _77: ();
+ let mut _78: u64;
+ let mut _79: u64;
+ let mut _80: u64;
+ let mut _81: u64;
+ let mut _82: bool;
+ let mut _83: u64;
+ let _84: ();
+ let mut _85: u64;
+ let mut _86: u64;
+ let mut _87: u64;
+ let mut _88: u64;
+ let mut _89: bool;
+ let mut _90: u64;
+ let _91: ();
+ let mut _92: u64;
+ let mut _93: u64;
+ let mut _94: u64;
+ let mut _95: u64;
+ let mut _96: u64;
+ let _97: ();
+ let mut _98: u64;
+ let mut _99: u64;
+ let mut _100: u64;
+ let mut _101: u64;
+ let mut _102: u64;
+ let _103: ();
+ let mut _104: u64;
+ let mut _105: u64;
+ let mut _106: u64;
+ let mut _107: u64;
+ let mut _108: u64;
+ let _109: ();
+ let mut _110: u64;
+ let mut _111: u64;
+ let mut _112: u64;
+ let mut _113: u64;
+ let mut _114: u64;
+ let _115: ();
+ let mut _116: u64;
+ let mut _117: u64;
+ let mut _118: u64;
+ let mut _119: u64;
+ let mut _120: u64;
+ let _121: ();
+ let mut _122: S<u64>;
+ let mut _123: u64;
+ let _124: ();
+ let mut _125: u64;
+ let mut _126: S<u64>;
+ let mut _127: u64;
+ let _128: &u64;
+ let _129: ();
+ let mut _130: u64;
+ let mut _131: u64;
+ let mut _132: u64;
+ let _133: ();
+ let mut _134: u64;
+ let mut _135: u64;
+ let mut _136: u64;
+ let _138: ();
+ let mut _139: u64;
+ let mut _140: u64;
+ let mut _141: u64;
+ let _142: ();
+ let mut _143: u64;
+ let mut _144: u64;
+ let mut _145: u64;
+ let _146: ();
+ let _148: ();
+ let mut _149: u64;
+ let mut _150: u64;
+ let mut _151: u64;
+ let _152: ();
+ let mut _153: u64;
+ let mut _154: u64;
+ let mut _155: u64;
+ let _157: ();
+ let mut _158: u64;
+ let mut _159: u64;
+ let mut _160: u64;
+ let _161: ();
+ let mut _162: u64;
+ let mut _163: u64;
+ let mut _164: u64;
+ let _166: ();
+ let mut _167: u64;
+ let mut _168: u64;
+ let mut _169: u64;
+ let _170: ();
+ let mut _171: u64;
+ let mut _172: u64;
+ let mut _173: u64;
+ scope 1 {
+ debug a => _128;
+ let _137: &mut u64;
+ scope 2 {
+ debug b => _137;
+ let _165: &u64;
+ scope 3 {
+ let _147: *const u64;
+ scope 4 {
+ debug c => _147;
+ let _156: *mut u64;
+ scope 5 {
+ debug d => _156;
+ }
+ }
+ }
+ scope 6 {
+ debug e => _165;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_4);
+- StorageLive(_5);
+- StorageLive(_6);
+- _6 = _1;
+- StorageLive(_7);
+- _7 = _2;
+- _5 = Add(move _6, move _7);
+- StorageDead(_7);
+- StorageDead(_6);
+- _4 = opaque::<u64>(move _5) -> [return: bb1, unwind unreachable];
++ _5 = Add(_1, _2);
++ _4 = opaque::<u64>(_5) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_8);
+- StorageLive(_9);
+- StorageLive(_10);
+- _10 = _1;
+- StorageLive(_11);
+- _11 = _2;
+- _9 = Mul(move _10, move _11);
+- StorageDead(_11);
+- StorageDead(_10);
+- _8 = opaque::<u64>(move _9) -> [return: bb2, unwind unreachable];
++ _9 = Mul(_1, _2);
++ _8 = opaque::<u64>(_9) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+- StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_12);
+- StorageLive(_13);
+- StorageLive(_14);
+- _14 = _1;
+- StorageLive(_15);
+- _15 = _2;
+- _13 = Sub(move _14, move _15);
+- StorageDead(_15);
+- StorageDead(_14);
+- _12 = opaque::<u64>(move _13) -> [return: bb3, unwind unreachable];
++ _13 = Sub(_1, _2);
++ _12 = opaque::<u64>(_13) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+- StorageDead(_13);
+ StorageDead(_12);
+ StorageLive(_16);
+- StorageLive(_17);
+- StorageLive(_18);
+- _18 = _1;
+- StorageLive(_19);
+- _19 = _2;
+- _20 = Eq(_19, const 0_u64);
+- assert(!move _20, "attempt to divide `{}` by zero", _18) -> [success: bb4, unwind unreachable];
++ _20 = Eq(_2, const 0_u64);
++ assert(!_20, "attempt to divide `{}` by zero", _1) -> [success: bb4, unwind unreachable];
+ }
+
+ bb4: {
+- _17 = Div(move _18, move _19);
+- StorageDead(_19);
+- StorageDead(_18);
+- _16 = opaque::<u64>(move _17) -> [return: bb5, unwind unreachable];
++ _17 = Div(_1, _2);
++ _16 = opaque::<u64>(_17) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+- StorageDead(_17);
+ StorageDead(_16);
+ StorageLive(_21);
+- StorageLive(_22);
+- StorageLive(_23);
+- _23 = _1;
+- StorageLive(_24);
+- _24 = _2;
+- _25 = Eq(_24, const 0_u64);
+- assert(!move _25, "attempt to calculate the remainder of `{}` with a divisor of zero", _23) -> [success: bb6, unwind unreachable];
++ assert(!_20, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb6, unwind unreachable];
+ }
+
+ bb6: {
+- _22 = Rem(move _23, move _24);
+- StorageDead(_24);
+- StorageDead(_23);
+- _21 = opaque::<u64>(move _22) -> [return: bb7, unwind unreachable];
++ _22 = Rem(_1, _2);
++ _21 = opaque::<u64>(_22) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+- StorageDead(_22);
+ StorageDead(_21);
+ StorageLive(_26);
+- StorageLive(_27);
+- StorageLive(_28);
+- _28 = _1;
+- StorageLive(_29);
+- _29 = _2;
+- _27 = BitAnd(move _28, move _29);
+- StorageDead(_29);
+- StorageDead(_28);
+- _26 = opaque::<u64>(move _27) -> [return: bb8, unwind unreachable];
++ _27 = BitAnd(_1, _2);
++ _26 = opaque::<u64>(_27) -> [return: bb8, unwind unreachable];
+ }
+
+ bb8: {
+- StorageDead(_27);
+ StorageDead(_26);
+ StorageLive(_30);
+- StorageLive(_31);
+- StorageLive(_32);
+- _32 = _1;
+- StorageLive(_33);
+- _33 = _2;
+- _31 = BitOr(move _32, move _33);
+- StorageDead(_33);
+- StorageDead(_32);
+- _30 = opaque::<u64>(move _31) -> [return: bb9, unwind unreachable];
++ _31 = BitOr(_1, _2);
++ _30 = opaque::<u64>(_31) -> [return: bb9, unwind unreachable];
+ }
+
+ bb9: {
+- StorageDead(_31);
+ StorageDead(_30);
+ StorageLive(_34);
+- StorageLive(_35);
+- StorageLive(_36);
+- _36 = _1;
+- StorageLive(_37);
+- _37 = _2;
+- _35 = BitXor(move _36, move _37);
+- StorageDead(_37);
+- StorageDead(_36);
+- _34 = opaque::<u64>(move _35) -> [return: bb10, unwind unreachable];
++ _35 = BitXor(_1, _2);
++ _34 = opaque::<u64>(_35) -> [return: bb10, unwind unreachable];
+ }
+
+ bb10: {
+- StorageDead(_35);
+ StorageDead(_34);
+ StorageLive(_38);
+- StorageLive(_39);
+- StorageLive(_40);
+- _40 = _1;
+- StorageLive(_41);
+- _41 = _2;
+- _39 = Shl(move _40, move _41);
+- StorageDead(_41);
+- StorageDead(_40);
+- _38 = opaque::<u64>(move _39) -> [return: bb11, unwind unreachable];
++ _39 = Shl(_1, _2);
++ _38 = opaque::<u64>(_39) -> [return: bb11, unwind unreachable];
+ }
+
+ bb11: {
+- StorageDead(_39);
+ StorageDead(_38);
+ StorageLive(_42);
+- StorageLive(_43);
+- StorageLive(_44);
+- _44 = _1;
+- StorageLive(_45);
+- _45 = _2;
+- _43 = Shr(move _44, move _45);
+- StorageDead(_45);
+- StorageDead(_44);
+- _42 = opaque::<u64>(move _43) -> [return: bb12, unwind unreachable];
++ _43 = Shr(_1, _2);
++ _42 = opaque::<u64>(_43) -> [return: bb12, unwind unreachable];
+ }
+
+ bb12: {
+- StorageDead(_43);
+ StorageDead(_42);
+ StorageLive(_46);
+ StorageLive(_47);
+- StorageLive(_48);
+- _48 = _1;
+- _47 = move _48 as u32 (IntToInt);
+- StorageDead(_48);
++ _47 = _1 as u32 (IntToInt);
+ _46 = opaque::<u32>(move _47) -> [return: bb13, unwind unreachable];
+ }
+
+ bb13: {
+ StorageDead(_47);
+ StorageDead(_46);
+ StorageLive(_49);
+ StorageLive(_50);
+- StorageLive(_51);
+- _51 = _1;
+- _50 = move _51 as f32 (IntToFloat);
+- StorageDead(_51);
++ _50 = _1 as f32 (IntToFloat);
+ _49 = opaque::<f32>(move _50) -> [return: bb14, unwind unreachable];
+ }
+
+ bb14: {
+ StorageDead(_50);
+ StorageDead(_49);
+ StorageLive(_52);
+- StorageLive(_53);
+- StorageLive(_54);
+- _54 = _1;
+- _53 = S::<u64>(move _54);
+- StorageDead(_54);
+- _52 = opaque::<S<u64>>(move _53) -> [return: bb15, unwind unreachable];
++ _53 = S::<u64>(_1);
++ _52 = opaque::<S<u64>>(_53) -> [return: bb15, unwind unreachable];
+ }
+
+ bb15: {
+- StorageDead(_53);
+ StorageDead(_52);
+ StorageLive(_55);
+- StorageLive(_56);
+- StorageLive(_57);
+- StorageLive(_58);
+- _58 = _1;
+- _57 = S::<u64>(move _58);
+- StorageDead(_58);
+- _56 = (_57.0: u64);
+- _55 = opaque::<u64>(move _56) -> [return: bb16, unwind unreachable];
++ _56 = (_53.0: u64);
++ _55 = opaque::<u64>(_56) -> [return: bb16, unwind unreachable];
+ }
+
+ bb16: {
+- StorageDead(_56);
+- StorageDead(_57);
+ StorageDead(_55);
+ StorageLive(_59);
+ StorageLive(_60);
+- StorageLive(_61);
+- StorageLive(_62);
+- _62 = _1;
+- StorageLive(_63);
+- _63 = _2;
+- _61 = Add(move _62, move _63);
+- StorageDead(_63);
+- StorageDead(_62);
+ StorageLive(_64);
+ _64 = _3;
+- _60 = Add(move _61, move _64);
++ _60 = Add(_5, move _64);
+ StorageDead(_64);
+- StorageDead(_61);
+ _59 = opaque::<u64>(move _60) -> [return: bb17, unwind unreachable];
+ }
+
+ bb17: {
+ StorageDead(_60);
+ StorageDead(_59);
+ StorageLive(_65);
+ StorageLive(_66);
+- StorageLive(_67);
+- StorageLive(_68);
+- _68 = _1;
+- StorageLive(_69);
+- _69 = _2;
+- _67 = Mul(move _68, move _69);
+- StorageDead(_69);
+- StorageDead(_68);
+ StorageLive(_70);
+ _70 = _3;
+- _66 = Add(move _67, move _70);
++ _66 = Add(_9, move _70);
+ StorageDead(_70);
+- StorageDead(_67);
+ _65 = opaque::<u64>(move _66) -> [return: bb18, unwind unreachable];
+ }
+
+ bb18: {
+ StorageDead(_66);
+ StorageDead(_65);
+ StorageLive(_71);
+ StorageLive(_72);
+- StorageLive(_73);
+- StorageLive(_74);
+- _74 = _1;
+- StorageLive(_75);
+- _75 = _2;
+- _73 = Sub(move _74, move _75);
+- StorageDead(_75);
+- StorageDead(_74);
+ StorageLive(_76);
+ _76 = _3;
+- _72 = Add(move _73, move _76);
++ _72 = Add(_13, move _76);
+ StorageDead(_76);
+- StorageDead(_73);
+ _71 = opaque::<u64>(move _72) -> [return: bb19, unwind unreachable];
+ }
+
+ bb19: {
+ StorageDead(_72);
+ StorageDead(_71);
+ StorageLive(_77);
+ StorageLive(_78);
+- StorageLive(_79);
+- StorageLive(_80);
+- _80 = _1;
+- StorageLive(_81);
+- _81 = _2;
+- _82 = Eq(_81, const 0_u64);
+- assert(!move _82, "attempt to divide `{}` by zero", _80) -> [success: bb20, unwind unreachable];
++ assert(!_20, "attempt to divide `{}` by zero", _1) -> [success: bb20, unwind unreachable];
+ }
+
+ bb20: {
+- _79 = Div(move _80, move _81);
+- StorageDead(_81);
+- StorageDead(_80);
+ StorageLive(_83);
+ _83 = _3;
+- _78 = Add(move _79, move _83);
++ _78 = Add(_17, move _83);
+ StorageDead(_83);
+- StorageDead(_79);
+ _77 = opaque::<u64>(move _78) -> [return: bb21, unwind unreachable];
+ }
+
+ bb21: {
+ StorageDead(_78);
+ StorageDead(_77);
+ StorageLive(_84);
+ StorageLive(_85);
+- StorageLive(_86);
+- StorageLive(_87);
+- _87 = _1;
+- StorageLive(_88);
+- _88 = _2;
+- _89 = Eq(_88, const 0_u64);
+- assert(!move _89, "attempt to calculate the remainder of `{}` with a divisor of zero", _87) -> [success: bb22, unwind unreachable];
++ assert(!_20, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb22, unwind unreachable];
+ }
+
+ bb22: {
+- _86 = Rem(move _87, move _88);
+- StorageDead(_88);
+- StorageDead(_87);
+ StorageLive(_90);
+ _90 = _3;
+- _85 = Add(move _86, move _90);
++ _85 = Add(_22, move _90);
+ StorageDead(_90);
+- StorageDead(_86);
+ _84 = opaque::<u64>(move _85) -> [return: bb23, unwind unreachable];
+ }
+
+ bb23: {
+ StorageDead(_85);
+ StorageDead(_84);
+ StorageLive(_91);
+ StorageLive(_92);
+- StorageLive(_93);
+- StorageLive(_94);
+- _94 = _1;
+- StorageLive(_95);
+- _95 = _2;
+- _93 = BitAnd(move _94, move _95);
+- StorageDead(_95);
+- StorageDead(_94);
+ StorageLive(_96);
+ _96 = _3;
+- _92 = Add(move _93, move _96);
++ _92 = Add(_27, move _96);
+ StorageDead(_96);
+- StorageDead(_93);
+ _91 = opaque::<u64>(move _92) -> [return: bb24, unwind unreachable];
+ }
+
+ bb24: {
+ StorageDead(_92);
+ StorageDead(_91);
+ StorageLive(_97);
+ StorageLive(_98);
+- StorageLive(_99);
+- StorageLive(_100);
+- _100 = _1;
+- StorageLive(_101);
+- _101 = _2;
+- _99 = BitOr(move _100, move _101);
+- StorageDead(_101);
+- StorageDead(_100);
+ StorageLive(_102);
+ _102 = _3;
+- _98 = Add(move _99, move _102);
++ _98 = Add(_31, move _102);
+ StorageDead(_102);
+- StorageDead(_99);
+ _97 = opaque::<u64>(move _98) -> [return: bb25, unwind unreachable];
+ }
+
+ bb25: {
+ StorageDead(_98);
+ StorageDead(_97);
+ StorageLive(_103);
+ StorageLive(_104);
+- StorageLive(_105);
+- StorageLive(_106);
+- _106 = _1;
+- StorageLive(_107);
+- _107 = _2;
+- _105 = BitXor(move _106, move _107);
+- StorageDead(_107);
+- StorageDead(_106);
+ StorageLive(_108);
+ _108 = _3;
+- _104 = Add(move _105, move _108);
++ _104 = Add(_35, move _108);
+ StorageDead(_108);
+- StorageDead(_105);
+ _103 = opaque::<u64>(move _104) -> [return: bb26, unwind unreachable];
+ }
+
+ bb26: {
+ StorageDead(_104);
+ StorageDead(_103);
+ StorageLive(_109);
+ StorageLive(_110);
+- StorageLive(_111);
+- StorageLive(_112);
+- _112 = _1;
+- StorageLive(_113);
+- _113 = _2;
+- _111 = Shl(move _112, move _113);
+- StorageDead(_113);
+- StorageDead(_112);
+ StorageLive(_114);
+ _114 = _3;
+- _110 = Add(move _111, move _114);
++ _110 = Add(_39, move _114);
+ StorageDead(_114);
+- StorageDead(_111);
+ _109 = opaque::<u64>(move _110) -> [return: bb27, unwind unreachable];
+ }
+
+ bb27: {
+ StorageDead(_110);
+ StorageDead(_109);
+ StorageLive(_115);
+ StorageLive(_116);
+- StorageLive(_117);
+- StorageLive(_118);
+- _118 = _1;
+- StorageLive(_119);
+- _119 = _2;
+- _117 = Shr(move _118, move _119);
+- StorageDead(_119);
+- StorageDead(_118);
+ StorageLive(_120);
+ _120 = _3;
+- _116 = Add(move _117, move _120);
++ _116 = Add(_43, move _120);
+ StorageDead(_120);
+- StorageDead(_117);
+ _115 = opaque::<u64>(move _116) -> [return: bb28, unwind unreachable];
+ }
+
+ bb28: {
+ StorageDead(_116);
+ StorageDead(_115);
+ StorageLive(_121);
+- StorageLive(_122);
+- StorageLive(_123);
+- _123 = _1;
+- _122 = S::<u64>(move _123);
+- StorageDead(_123);
+- _121 = opaque::<S<u64>>(move _122) -> [return: bb29, unwind unreachable];
++ _121 = opaque::<S<u64>>(_53) -> [return: bb29, unwind unreachable];
+ }
+
+ bb29: {
+- StorageDead(_122);
+ StorageDead(_121);
+ StorageLive(_124);
+- StorageLive(_125);
+- StorageLive(_126);
+- StorageLive(_127);
+- _127 = _1;
+- _126 = S::<u64>(move _127);
+- StorageDead(_127);
+- _125 = (_126.0: u64);
+- _124 = opaque::<u64>(move _125) -> [return: bb30, unwind unreachable];
++ _124 = opaque::<u64>(_56) -> [return: bb30, unwind unreachable];
+ }
+
+ bb30: {
+- StorageDead(_125);
+- StorageDead(_126);
+ StorageDead(_124);
+ StorageLive(_128);
+ _128 = &_3;
+ StorageLive(_129);
+- StorageLive(_130);
+- StorageLive(_131);
+ _131 = (*_128);
+- StorageLive(_132);
+- _132 = _1;
+- _130 = Add(move _131, move _132);
+- StorageDead(_132);
+- StorageDead(_131);
+- _129 = opaque::<u64>(move _130) -> [return: bb31, unwind unreachable];
++ _130 = Add(_131, _1);
++ _129 = opaque::<u64>(_130) -> [return: bb31, unwind unreachable];
+ }
+
+ bb31: {
+- StorageDead(_130);
+ StorageDead(_129);
+ StorageLive(_133);
+- StorageLive(_134);
+- StorageLive(_135);
+- _135 = (*_128);
+- StorageLive(_136);
+- _136 = _1;
+- _134 = Add(move _135, move _136);
+- StorageDead(_136);
+- StorageDead(_135);
+- _133 = opaque::<u64>(move _134) -> [return: bb32, unwind unreachable];
++ _133 = opaque::<u64>(_130) -> [return: bb32, unwind unreachable];
+ }
+
+ bb32: {
+- StorageDead(_134);
+ StorageDead(_133);
+ StorageLive(_137);
+ _137 = &mut _3;
+ StorageLive(_138);
+ StorageLive(_139);
+ StorageLive(_140);
+ _140 = (*_137);
+- StorageLive(_141);
+- _141 = _1;
+- _139 = Add(move _140, move _141);
+- StorageDead(_141);
++ _139 = Add(move _140, _1);
+ StorageDead(_140);
+ _138 = opaque::<u64>(move _139) -> [return: bb33, unwind unreachable];
+ }
+
+ bb33: {
+ StorageDead(_139);
+ StorageDead(_138);
+ StorageLive(_142);
+ StorageLive(_143);
+ StorageLive(_144);
+ _144 = (*_137);
+- StorageLive(_145);
+- _145 = _1;
+- _143 = Add(move _144, move _145);
+- StorageDead(_145);
++ _143 = Add(move _144, _1);
+ StorageDead(_144);
+ _142 = opaque::<u64>(move _143) -> [return: bb34, unwind unreachable];
+ }
+
+ bb34: {
+ StorageDead(_143);
+ StorageDead(_142);
+- StorageLive(_146);
+ StorageLive(_147);
+ _147 = &raw const _3;
+ StorageLive(_148);
+ StorageLive(_149);
+ StorageLive(_150);
+ _150 = (*_147);
+- StorageLive(_151);
+- _151 = _1;
+- _149 = Add(move _150, move _151);
+- StorageDead(_151);
++ _149 = Add(move _150, _1);
+ StorageDead(_150);
+ _148 = opaque::<u64>(move _149) -> [return: bb35, unwind unreachable];
+ }
+
+ bb35: {
+ StorageDead(_149);
+ StorageDead(_148);
+ StorageLive(_152);
+ StorageLive(_153);
+ StorageLive(_154);
+ _154 = (*_147);
+- StorageLive(_155);
+- _155 = _1;
+- _153 = Add(move _154, move _155);
+- StorageDead(_155);
++ _153 = Add(move _154, _1);
+ StorageDead(_154);
+ _152 = opaque::<u64>(move _153) -> [return: bb36, unwind unreachable];
+ }
+
+ bb36: {
+ StorageDead(_153);
+ StorageDead(_152);
+ StorageLive(_156);
+ _156 = &raw mut _3;
+ StorageLive(_157);
+ StorageLive(_158);
+ StorageLive(_159);
+ _159 = (*_156);
+- StorageLive(_160);
+- _160 = _1;
+- _158 = Add(move _159, move _160);
+- StorageDead(_160);
++ _158 = Add(move _159, _1);
+ StorageDead(_159);
+ _157 = opaque::<u64>(move _158) -> [return: bb37, unwind unreachable];
+ }
+
+ bb37: {
+ StorageDead(_158);
+ StorageDead(_157);
+ StorageLive(_161);
+ StorageLive(_162);
+ StorageLive(_163);
+ _163 = (*_156);
+- StorageLive(_164);
+- _164 = _1;
+- _162 = Add(move _163, move _164);
+- StorageDead(_164);
++ _162 = Add(move _163, _1);
+ StorageDead(_163);
+ _161 = opaque::<u64>(move _162) -> [return: bb38, unwind unreachable];
+ }
+
+ bb38: {
+ StorageDead(_162);
+ StorageDead(_161);
+- _146 = const ();
+ StorageDead(_156);
+ StorageDead(_147);
+- StorageDead(_146);
+ StorageLive(_165);
+ _165 = &_3;
+ StorageLive(_166);
+- StorageLive(_167);
+- StorageLive(_168);
+ _168 = (*_165);
+- StorageLive(_169);
+- _169 = _1;
+- _167 = Add(move _168, move _169);
+- StorageDead(_169);
+- StorageDead(_168);
+- _166 = opaque::<u64>(move _167) -> [return: bb39, unwind unreachable];
++ _167 = Add(_168, _1);
++ _166 = opaque::<u64>(_167) -> [return: bb39, unwind unreachable];
+ }
+
+ bb39: {
+- StorageDead(_167);
+ StorageDead(_166);
+ StorageLive(_170);
+- StorageLive(_171);
+- StorageLive(_172);
+- _172 = (*_165);
+- StorageLive(_173);
+- _173 = _1;
+- _171 = Add(move _172, move _173);
+- StorageDead(_173);
+- StorageDead(_172);
+- _170 = opaque::<u64>(move _171) -> [return: bb40, unwind unreachable];
++ _170 = opaque::<u64>(_167) -> [return: bb40, unwind unreachable];
+ }
+
+ bb40: {
+- StorageDead(_171);
+ StorageDead(_170);
+ _0 = const ();
+ StorageDead(_165);
+ StorageDead(_137);
+ StorageDead(_128);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff
new file mode 100644
index 000000000..68b052907
--- /dev/null
+++ b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff
@@ -0,0 +1,883 @@
+- // MIR for `subexpression_elimination` before GVN
++ // MIR for `subexpression_elimination` after GVN
+
+ fn subexpression_elimination(_1: u64, _2: u64, _3: u64) -> () {
+ debug x => _1;
+ debug y => _2;
+ debug z => _3;
+ let mut _0: ();
+ let _4: ();
+ let mut _5: u64;
+ let mut _6: u64;
+ let mut _7: u64;
+ let _8: ();
+ let mut _9: u64;
+ let mut _10: u64;
+ let mut _11: u64;
+ let _12: ();
+ let mut _13: u64;
+ let mut _14: u64;
+ let mut _15: u64;
+ let _16: ();
+ let mut _17: u64;
+ let mut _18: u64;
+ let mut _19: u64;
+ let mut _20: bool;
+ let _21: ();
+ let mut _22: u64;
+ let mut _23: u64;
+ let mut _24: u64;
+ let mut _25: bool;
+ let _26: ();
+ let mut _27: u64;
+ let mut _28: u64;
+ let mut _29: u64;
+ let _30: ();
+ let mut _31: u64;
+ let mut _32: u64;
+ let mut _33: u64;
+ let _34: ();
+ let mut _35: u64;
+ let mut _36: u64;
+ let mut _37: u64;
+ let _38: ();
+ let mut _39: u64;
+ let mut _40: u64;
+ let mut _41: u64;
+ let _42: ();
+ let mut _43: u64;
+ let mut _44: u64;
+ let mut _45: u64;
+ let _46: ();
+ let mut _47: u32;
+ let mut _48: u64;
+ let _49: ();
+ let mut _50: f32;
+ let mut _51: u64;
+ let _52: ();
+ let mut _53: S<u64>;
+ let mut _54: u64;
+ let _55: ();
+ let mut _56: u64;
+ let mut _57: S<u64>;
+ let mut _58: u64;
+ let _59: ();
+ let mut _60: u64;
+ let mut _61: u64;
+ let mut _62: u64;
+ let mut _63: u64;
+ let mut _64: u64;
+ let _65: ();
+ let mut _66: u64;
+ let mut _67: u64;
+ let mut _68: u64;
+ let mut _69: u64;
+ let mut _70: u64;
+ let _71: ();
+ let mut _72: u64;
+ let mut _73: u64;
+ let mut _74: u64;
+ let mut _75: u64;
+ let mut _76: u64;
+ let _77: ();
+ let mut _78: u64;
+ let mut _79: u64;
+ let mut _80: u64;
+ let mut _81: u64;
+ let mut _82: bool;
+ let mut _83: u64;
+ let _84: ();
+ let mut _85: u64;
+ let mut _86: u64;
+ let mut _87: u64;
+ let mut _88: u64;
+ let mut _89: bool;
+ let mut _90: u64;
+ let _91: ();
+ let mut _92: u64;
+ let mut _93: u64;
+ let mut _94: u64;
+ let mut _95: u64;
+ let mut _96: u64;
+ let _97: ();
+ let mut _98: u64;
+ let mut _99: u64;
+ let mut _100: u64;
+ let mut _101: u64;
+ let mut _102: u64;
+ let _103: ();
+ let mut _104: u64;
+ let mut _105: u64;
+ let mut _106: u64;
+ let mut _107: u64;
+ let mut _108: u64;
+ let _109: ();
+ let mut _110: u64;
+ let mut _111: u64;
+ let mut _112: u64;
+ let mut _113: u64;
+ let mut _114: u64;
+ let _115: ();
+ let mut _116: u64;
+ let mut _117: u64;
+ let mut _118: u64;
+ let mut _119: u64;
+ let mut _120: u64;
+ let _121: ();
+ let mut _122: S<u64>;
+ let mut _123: u64;
+ let _124: ();
+ let mut _125: u64;
+ let mut _126: S<u64>;
+ let mut _127: u64;
+ let _128: &u64;
+ let _129: ();
+ let mut _130: u64;
+ let mut _131: u64;
+ let mut _132: u64;
+ let _133: ();
+ let mut _134: u64;
+ let mut _135: u64;
+ let mut _136: u64;
+ let _138: ();
+ let mut _139: u64;
+ let mut _140: u64;
+ let mut _141: u64;
+ let _142: ();
+ let mut _143: u64;
+ let mut _144: u64;
+ let mut _145: u64;
+ let _146: ();
+ let _148: ();
+ let mut _149: u64;
+ let mut _150: u64;
+ let mut _151: u64;
+ let _152: ();
+ let mut _153: u64;
+ let mut _154: u64;
+ let mut _155: u64;
+ let _157: ();
+ let mut _158: u64;
+ let mut _159: u64;
+ let mut _160: u64;
+ let _161: ();
+ let mut _162: u64;
+ let mut _163: u64;
+ let mut _164: u64;
+ let _166: ();
+ let mut _167: u64;
+ let mut _168: u64;
+ let mut _169: u64;
+ let _170: ();
+ let mut _171: u64;
+ let mut _172: u64;
+ let mut _173: u64;
+ scope 1 {
+ debug a => _128;
+ let _137: &mut u64;
+ scope 2 {
+ debug b => _137;
+ let _165: &u64;
+ scope 3 {
+ let _147: *const u64;
+ scope 4 {
+ debug c => _147;
+ let _156: *mut u64;
+ scope 5 {
+ debug d => _156;
+ }
+ }
+ }
+ scope 6 {
+ debug e => _165;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_4);
+- StorageLive(_5);
+- StorageLive(_6);
+- _6 = _1;
+- StorageLive(_7);
+- _7 = _2;
+- _5 = Add(move _6, move _7);
+- StorageDead(_7);
+- StorageDead(_6);
+- _4 = opaque::<u64>(move _5) -> [return: bb1, unwind continue];
++ _5 = Add(_1, _2);
++ _4 = opaque::<u64>(_5) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+- StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_8);
+- StorageLive(_9);
+- StorageLive(_10);
+- _10 = _1;
+- StorageLive(_11);
+- _11 = _2;
+- _9 = Mul(move _10, move _11);
+- StorageDead(_11);
+- StorageDead(_10);
+- _8 = opaque::<u64>(move _9) -> [return: bb2, unwind continue];
++ _9 = Mul(_1, _2);
++ _8 = opaque::<u64>(_9) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+- StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_12);
+- StorageLive(_13);
+- StorageLive(_14);
+- _14 = _1;
+- StorageLive(_15);
+- _15 = _2;
+- _13 = Sub(move _14, move _15);
+- StorageDead(_15);
+- StorageDead(_14);
+- _12 = opaque::<u64>(move _13) -> [return: bb3, unwind continue];
++ _13 = Sub(_1, _2);
++ _12 = opaque::<u64>(_13) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+- StorageDead(_13);
+ StorageDead(_12);
+ StorageLive(_16);
+- StorageLive(_17);
+- StorageLive(_18);
+- _18 = _1;
+- StorageLive(_19);
+- _19 = _2;
+- _20 = Eq(_19, const 0_u64);
+- assert(!move _20, "attempt to divide `{}` by zero", _18) -> [success: bb4, unwind continue];
++ _20 = Eq(_2, const 0_u64);
++ assert(!_20, "attempt to divide `{}` by zero", _1) -> [success: bb4, unwind continue];
+ }
+
+ bb4: {
+- _17 = Div(move _18, move _19);
+- StorageDead(_19);
+- StorageDead(_18);
+- _16 = opaque::<u64>(move _17) -> [return: bb5, unwind continue];
++ _17 = Div(_1, _2);
++ _16 = opaque::<u64>(_17) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+- StorageDead(_17);
+ StorageDead(_16);
+ StorageLive(_21);
+- StorageLive(_22);
+- StorageLive(_23);
+- _23 = _1;
+- StorageLive(_24);
+- _24 = _2;
+- _25 = Eq(_24, const 0_u64);
+- assert(!move _25, "attempt to calculate the remainder of `{}` with a divisor of zero", _23) -> [success: bb6, unwind continue];
++ assert(!_20, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb6, unwind continue];
+ }
+
+ bb6: {
+- _22 = Rem(move _23, move _24);
+- StorageDead(_24);
+- StorageDead(_23);
+- _21 = opaque::<u64>(move _22) -> [return: bb7, unwind continue];
++ _22 = Rem(_1, _2);
++ _21 = opaque::<u64>(_22) -> [return: bb7, unwind continue];
+ }
+
+ bb7: {
+- StorageDead(_22);
+ StorageDead(_21);
+ StorageLive(_26);
+- StorageLive(_27);
+- StorageLive(_28);
+- _28 = _1;
+- StorageLive(_29);
+- _29 = _2;
+- _27 = BitAnd(move _28, move _29);
+- StorageDead(_29);
+- StorageDead(_28);
+- _26 = opaque::<u64>(move _27) -> [return: bb8, unwind continue];
++ _27 = BitAnd(_1, _2);
++ _26 = opaque::<u64>(_27) -> [return: bb8, unwind continue];
+ }
+
+ bb8: {
+- StorageDead(_27);
+ StorageDead(_26);
+ StorageLive(_30);
+- StorageLive(_31);
+- StorageLive(_32);
+- _32 = _1;
+- StorageLive(_33);
+- _33 = _2;
+- _31 = BitOr(move _32, move _33);
+- StorageDead(_33);
+- StorageDead(_32);
+- _30 = opaque::<u64>(move _31) -> [return: bb9, unwind continue];
++ _31 = BitOr(_1, _2);
++ _30 = opaque::<u64>(_31) -> [return: bb9, unwind continue];
+ }
+
+ bb9: {
+- StorageDead(_31);
+ StorageDead(_30);
+ StorageLive(_34);
+- StorageLive(_35);
+- StorageLive(_36);
+- _36 = _1;
+- StorageLive(_37);
+- _37 = _2;
+- _35 = BitXor(move _36, move _37);
+- StorageDead(_37);
+- StorageDead(_36);
+- _34 = opaque::<u64>(move _35) -> [return: bb10, unwind continue];
++ _35 = BitXor(_1, _2);
++ _34 = opaque::<u64>(_35) -> [return: bb10, unwind continue];
+ }
+
+ bb10: {
+- StorageDead(_35);
+ StorageDead(_34);
+ StorageLive(_38);
+- StorageLive(_39);
+- StorageLive(_40);
+- _40 = _1;
+- StorageLive(_41);
+- _41 = _2;
+- _39 = Shl(move _40, move _41);
+- StorageDead(_41);
+- StorageDead(_40);
+- _38 = opaque::<u64>(move _39) -> [return: bb11, unwind continue];
++ _39 = Shl(_1, _2);
++ _38 = opaque::<u64>(_39) -> [return: bb11, unwind continue];
+ }
+
+ bb11: {
+- StorageDead(_39);
+ StorageDead(_38);
+ StorageLive(_42);
+- StorageLive(_43);
+- StorageLive(_44);
+- _44 = _1;
+- StorageLive(_45);
+- _45 = _2;
+- _43 = Shr(move _44, move _45);
+- StorageDead(_45);
+- StorageDead(_44);
+- _42 = opaque::<u64>(move _43) -> [return: bb12, unwind continue];
++ _43 = Shr(_1, _2);
++ _42 = opaque::<u64>(_43) -> [return: bb12, unwind continue];
+ }
+
+ bb12: {
+- StorageDead(_43);
+ StorageDead(_42);
+ StorageLive(_46);
+ StorageLive(_47);
+- StorageLive(_48);
+- _48 = _1;
+- _47 = move _48 as u32 (IntToInt);
+- StorageDead(_48);
++ _47 = _1 as u32 (IntToInt);
+ _46 = opaque::<u32>(move _47) -> [return: bb13, unwind continue];
+ }
+
+ bb13: {
+ StorageDead(_47);
+ StorageDead(_46);
+ StorageLive(_49);
+ StorageLive(_50);
+- StorageLive(_51);
+- _51 = _1;
+- _50 = move _51 as f32 (IntToFloat);
+- StorageDead(_51);
++ _50 = _1 as f32 (IntToFloat);
+ _49 = opaque::<f32>(move _50) -> [return: bb14, unwind continue];
+ }
+
+ bb14: {
+ StorageDead(_50);
+ StorageDead(_49);
+ StorageLive(_52);
+- StorageLive(_53);
+- StorageLive(_54);
+- _54 = _1;
+- _53 = S::<u64>(move _54);
+- StorageDead(_54);
+- _52 = opaque::<S<u64>>(move _53) -> [return: bb15, unwind continue];
++ _53 = S::<u64>(_1);
++ _52 = opaque::<S<u64>>(_53) -> [return: bb15, unwind continue];
+ }
+
+ bb15: {
+- StorageDead(_53);
+ StorageDead(_52);
+ StorageLive(_55);
+- StorageLive(_56);
+- StorageLive(_57);
+- StorageLive(_58);
+- _58 = _1;
+- _57 = S::<u64>(move _58);
+- StorageDead(_58);
+- _56 = (_57.0: u64);
+- _55 = opaque::<u64>(move _56) -> [return: bb16, unwind continue];
++ _56 = (_53.0: u64);
++ _55 = opaque::<u64>(_56) -> [return: bb16, unwind continue];
+ }
+
+ bb16: {
+- StorageDead(_56);
+- StorageDead(_57);
+ StorageDead(_55);
+ StorageLive(_59);
+ StorageLive(_60);
+- StorageLive(_61);
+- StorageLive(_62);
+- _62 = _1;
+- StorageLive(_63);
+- _63 = _2;
+- _61 = Add(move _62, move _63);
+- StorageDead(_63);
+- StorageDead(_62);
+ StorageLive(_64);
+ _64 = _3;
+- _60 = Add(move _61, move _64);
++ _60 = Add(_5, move _64);
+ StorageDead(_64);
+- StorageDead(_61);
+ _59 = opaque::<u64>(move _60) -> [return: bb17, unwind continue];
+ }
+
+ bb17: {
+ StorageDead(_60);
+ StorageDead(_59);
+ StorageLive(_65);
+ StorageLive(_66);
+- StorageLive(_67);
+- StorageLive(_68);
+- _68 = _1;
+- StorageLive(_69);
+- _69 = _2;
+- _67 = Mul(move _68, move _69);
+- StorageDead(_69);
+- StorageDead(_68);
+ StorageLive(_70);
+ _70 = _3;
+- _66 = Add(move _67, move _70);
++ _66 = Add(_9, move _70);
+ StorageDead(_70);
+- StorageDead(_67);
+ _65 = opaque::<u64>(move _66) -> [return: bb18, unwind continue];
+ }
+
+ bb18: {
+ StorageDead(_66);
+ StorageDead(_65);
+ StorageLive(_71);
+ StorageLive(_72);
+- StorageLive(_73);
+- StorageLive(_74);
+- _74 = _1;
+- StorageLive(_75);
+- _75 = _2;
+- _73 = Sub(move _74, move _75);
+- StorageDead(_75);
+- StorageDead(_74);
+ StorageLive(_76);
+ _76 = _3;
+- _72 = Add(move _73, move _76);
++ _72 = Add(_13, move _76);
+ StorageDead(_76);
+- StorageDead(_73);
+ _71 = opaque::<u64>(move _72) -> [return: bb19, unwind continue];
+ }
+
+ bb19: {
+ StorageDead(_72);
+ StorageDead(_71);
+ StorageLive(_77);
+ StorageLive(_78);
+- StorageLive(_79);
+- StorageLive(_80);
+- _80 = _1;
+- StorageLive(_81);
+- _81 = _2;
+- _82 = Eq(_81, const 0_u64);
+- assert(!move _82, "attempt to divide `{}` by zero", _80) -> [success: bb20, unwind continue];
++ assert(!_20, "attempt to divide `{}` by zero", _1) -> [success: bb20, unwind continue];
+ }
+
+ bb20: {
+- _79 = Div(move _80, move _81);
+- StorageDead(_81);
+- StorageDead(_80);
+ StorageLive(_83);
+ _83 = _3;
+- _78 = Add(move _79, move _83);
++ _78 = Add(_17, move _83);
+ StorageDead(_83);
+- StorageDead(_79);
+ _77 = opaque::<u64>(move _78) -> [return: bb21, unwind continue];
+ }
+
+ bb21: {
+ StorageDead(_78);
+ StorageDead(_77);
+ StorageLive(_84);
+ StorageLive(_85);
+- StorageLive(_86);
+- StorageLive(_87);
+- _87 = _1;
+- StorageLive(_88);
+- _88 = _2;
+- _89 = Eq(_88, const 0_u64);
+- assert(!move _89, "attempt to calculate the remainder of `{}` with a divisor of zero", _87) -> [success: bb22, unwind continue];
++ assert(!_20, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb22, unwind continue];
+ }
+
+ bb22: {
+- _86 = Rem(move _87, move _88);
+- StorageDead(_88);
+- StorageDead(_87);
+ StorageLive(_90);
+ _90 = _3;
+- _85 = Add(move _86, move _90);
++ _85 = Add(_22, move _90);
+ StorageDead(_90);
+- StorageDead(_86);
+ _84 = opaque::<u64>(move _85) -> [return: bb23, unwind continue];
+ }
+
+ bb23: {
+ StorageDead(_85);
+ StorageDead(_84);
+ StorageLive(_91);
+ StorageLive(_92);
+- StorageLive(_93);
+- StorageLive(_94);
+- _94 = _1;
+- StorageLive(_95);
+- _95 = _2;
+- _93 = BitAnd(move _94, move _95);
+- StorageDead(_95);
+- StorageDead(_94);
+ StorageLive(_96);
+ _96 = _3;
+- _92 = Add(move _93, move _96);
++ _92 = Add(_27, move _96);
+ StorageDead(_96);
+- StorageDead(_93);
+ _91 = opaque::<u64>(move _92) -> [return: bb24, unwind continue];
+ }
+
+ bb24: {
+ StorageDead(_92);
+ StorageDead(_91);
+ StorageLive(_97);
+ StorageLive(_98);
+- StorageLive(_99);
+- StorageLive(_100);
+- _100 = _1;
+- StorageLive(_101);
+- _101 = _2;
+- _99 = BitOr(move _100, move _101);
+- StorageDead(_101);
+- StorageDead(_100);
+ StorageLive(_102);
+ _102 = _3;
+- _98 = Add(move _99, move _102);
++ _98 = Add(_31, move _102);
+ StorageDead(_102);
+- StorageDead(_99);
+ _97 = opaque::<u64>(move _98) -> [return: bb25, unwind continue];
+ }
+
+ bb25: {
+ StorageDead(_98);
+ StorageDead(_97);
+ StorageLive(_103);
+ StorageLive(_104);
+- StorageLive(_105);
+- StorageLive(_106);
+- _106 = _1;
+- StorageLive(_107);
+- _107 = _2;
+- _105 = BitXor(move _106, move _107);
+- StorageDead(_107);
+- StorageDead(_106);
+ StorageLive(_108);
+ _108 = _3;
+- _104 = Add(move _105, move _108);
++ _104 = Add(_35, move _108);
+ StorageDead(_108);
+- StorageDead(_105);
+ _103 = opaque::<u64>(move _104) -> [return: bb26, unwind continue];
+ }
+
+ bb26: {
+ StorageDead(_104);
+ StorageDead(_103);
+ StorageLive(_109);
+ StorageLive(_110);
+- StorageLive(_111);
+- StorageLive(_112);
+- _112 = _1;
+- StorageLive(_113);
+- _113 = _2;
+- _111 = Shl(move _112, move _113);
+- StorageDead(_113);
+- StorageDead(_112);
+ StorageLive(_114);
+ _114 = _3;
+- _110 = Add(move _111, move _114);
++ _110 = Add(_39, move _114);
+ StorageDead(_114);
+- StorageDead(_111);
+ _109 = opaque::<u64>(move _110) -> [return: bb27, unwind continue];
+ }
+
+ bb27: {
+ StorageDead(_110);
+ StorageDead(_109);
+ StorageLive(_115);
+ StorageLive(_116);
+- StorageLive(_117);
+- StorageLive(_118);
+- _118 = _1;
+- StorageLive(_119);
+- _119 = _2;
+- _117 = Shr(move _118, move _119);
+- StorageDead(_119);
+- StorageDead(_118);
+ StorageLive(_120);
+ _120 = _3;
+- _116 = Add(move _117, move _120);
++ _116 = Add(_43, move _120);
+ StorageDead(_120);
+- StorageDead(_117);
+ _115 = opaque::<u64>(move _116) -> [return: bb28, unwind continue];
+ }
+
+ bb28: {
+ StorageDead(_116);
+ StorageDead(_115);
+ StorageLive(_121);
+- StorageLive(_122);
+- StorageLive(_123);
+- _123 = _1;
+- _122 = S::<u64>(move _123);
+- StorageDead(_123);
+- _121 = opaque::<S<u64>>(move _122) -> [return: bb29, unwind continue];
++ _121 = opaque::<S<u64>>(_53) -> [return: bb29, unwind continue];
+ }
+
+ bb29: {
+- StorageDead(_122);
+ StorageDead(_121);
+ StorageLive(_124);
+- StorageLive(_125);
+- StorageLive(_126);
+- StorageLive(_127);
+- _127 = _1;
+- _126 = S::<u64>(move _127);
+- StorageDead(_127);
+- _125 = (_126.0: u64);
+- _124 = opaque::<u64>(move _125) -> [return: bb30, unwind continue];
++ _124 = opaque::<u64>(_56) -> [return: bb30, unwind continue];
+ }
+
+ bb30: {
+- StorageDead(_125);
+- StorageDead(_126);
+ StorageDead(_124);
+ StorageLive(_128);
+ _128 = &_3;
+ StorageLive(_129);
+- StorageLive(_130);
+- StorageLive(_131);
+ _131 = (*_128);
+- StorageLive(_132);
+- _132 = _1;
+- _130 = Add(move _131, move _132);
+- StorageDead(_132);
+- StorageDead(_131);
+- _129 = opaque::<u64>(move _130) -> [return: bb31, unwind continue];
++ _130 = Add(_131, _1);
++ _129 = opaque::<u64>(_130) -> [return: bb31, unwind continue];
+ }
+
+ bb31: {
+- StorageDead(_130);
+ StorageDead(_129);
+ StorageLive(_133);
+- StorageLive(_134);
+- StorageLive(_135);
+- _135 = (*_128);
+- StorageLive(_136);
+- _136 = _1;
+- _134 = Add(move _135, move _136);
+- StorageDead(_136);
+- StorageDead(_135);
+- _133 = opaque::<u64>(move _134) -> [return: bb32, unwind continue];
++ _133 = opaque::<u64>(_130) -> [return: bb32, unwind continue];
+ }
+
+ bb32: {
+- StorageDead(_134);
+ StorageDead(_133);
+ StorageLive(_137);
+ _137 = &mut _3;
+ StorageLive(_138);
+ StorageLive(_139);
+ StorageLive(_140);
+ _140 = (*_137);
+- StorageLive(_141);
+- _141 = _1;
+- _139 = Add(move _140, move _141);
+- StorageDead(_141);
++ _139 = Add(move _140, _1);
+ StorageDead(_140);
+ _138 = opaque::<u64>(move _139) -> [return: bb33, unwind continue];
+ }
+
+ bb33: {
+ StorageDead(_139);
+ StorageDead(_138);
+ StorageLive(_142);
+ StorageLive(_143);
+ StorageLive(_144);
+ _144 = (*_137);
+- StorageLive(_145);
+- _145 = _1;
+- _143 = Add(move _144, move _145);
+- StorageDead(_145);
++ _143 = Add(move _144, _1);
+ StorageDead(_144);
+ _142 = opaque::<u64>(move _143) -> [return: bb34, unwind continue];
+ }
+
+ bb34: {
+ StorageDead(_143);
+ StorageDead(_142);
+- StorageLive(_146);
+ StorageLive(_147);
+ _147 = &raw const _3;
+ StorageLive(_148);
+ StorageLive(_149);
+ StorageLive(_150);
+ _150 = (*_147);
+- StorageLive(_151);
+- _151 = _1;
+- _149 = Add(move _150, move _151);
+- StorageDead(_151);
++ _149 = Add(move _150, _1);
+ StorageDead(_150);
+ _148 = opaque::<u64>(move _149) -> [return: bb35, unwind continue];
+ }
+
+ bb35: {
+ StorageDead(_149);
+ StorageDead(_148);
+ StorageLive(_152);
+ StorageLive(_153);
+ StorageLive(_154);
+ _154 = (*_147);
+- StorageLive(_155);
+- _155 = _1;
+- _153 = Add(move _154, move _155);
+- StorageDead(_155);
++ _153 = Add(move _154, _1);
+ StorageDead(_154);
+ _152 = opaque::<u64>(move _153) -> [return: bb36, unwind continue];
+ }
+
+ bb36: {
+ StorageDead(_153);
+ StorageDead(_152);
+ StorageLive(_156);
+ _156 = &raw mut _3;
+ StorageLive(_157);
+ StorageLive(_158);
+ StorageLive(_159);
+ _159 = (*_156);
+- StorageLive(_160);
+- _160 = _1;
+- _158 = Add(move _159, move _160);
+- StorageDead(_160);
++ _158 = Add(move _159, _1);
+ StorageDead(_159);
+ _157 = opaque::<u64>(move _158) -> [return: bb37, unwind continue];
+ }
+
+ bb37: {
+ StorageDead(_158);
+ StorageDead(_157);
+ StorageLive(_161);
+ StorageLive(_162);
+ StorageLive(_163);
+ _163 = (*_156);
+- StorageLive(_164);
+- _164 = _1;
+- _162 = Add(move _163, move _164);
+- StorageDead(_164);
++ _162 = Add(move _163, _1);
+ StorageDead(_163);
+ _161 = opaque::<u64>(move _162) -> [return: bb38, unwind continue];
+ }
+
+ bb38: {
+ StorageDead(_162);
+ StorageDead(_161);
+- _146 = const ();
+ StorageDead(_156);
+ StorageDead(_147);
+- StorageDead(_146);
+ StorageLive(_165);
+ _165 = &_3;
+ StorageLive(_166);
+- StorageLive(_167);
+- StorageLive(_168);
+ _168 = (*_165);
+- StorageLive(_169);
+- _169 = _1;
+- _167 = Add(move _168, move _169);
+- StorageDead(_169);
+- StorageDead(_168);
+- _166 = opaque::<u64>(move _167) -> [return: bb39, unwind continue];
++ _167 = Add(_168, _1);
++ _166 = opaque::<u64>(_167) -> [return: bb39, unwind continue];
+ }
+
+ bb39: {
+- StorageDead(_167);
+ StorageDead(_166);
+ StorageLive(_170);
+- StorageLive(_171);
+- StorageLive(_172);
+- _172 = (*_165);
+- StorageLive(_173);
+- _173 = _1;
+- _171 = Add(move _172, move _173);
+- StorageDead(_173);
+- StorageDead(_172);
+- _170 = opaque::<u64>(move _171) -> [return: bb40, unwind continue];
++ _170 = opaque::<u64>(_167) -> [return: bb40, unwind continue];
+ }
+
+ bb40: {
+- StorageDead(_171);
+ StorageDead(_170);
+ _0 = const ();
+ StorageDead(_165);
+ StorageDead(_137);
+ StorageDead(_128);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff
new file mode 100644
index 000000000..f33845502
--- /dev/null
+++ b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff
@@ -0,0 +1,45 @@
+- // MIR for `wrap_unwrap` before GVN
++ // MIR for `wrap_unwrap` after GVN
+
+ fn wrap_unwrap(_1: T) -> T {
+ debug x => _1;
+ let mut _0: T;
+ let mut _2: std::option::Option<T>;
+ let mut _3: T;
+ let mut _4: isize;
+ let _5: T;
+ let mut _6: !;
+ scope 1 {
+ debug y => _5;
+ }
+
+ bb0: {
+ StorageLive(_2);
+- StorageLive(_3);
+- _3 = _1;
+- _2 = Option::<T>::Some(move _3);
+- StorageDead(_3);
++ _2 = Option::<T>::Some(_1);
+ _4 = discriminant(_2);
+ switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_6);
+ _6 = begin_panic::<&str>(const "explicit panic") -> unwind unreachable;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+- StorageLive(_5);
+ _5 = ((_2 as Some).0: T);
+ _0 = _5;
+- StorageDead(_5);
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff
new file mode 100644
index 000000000..edc05f99f
--- /dev/null
+++ b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff
@@ -0,0 +1,45 @@
+- // MIR for `wrap_unwrap` before GVN
++ // MIR for `wrap_unwrap` after GVN
+
+ fn wrap_unwrap(_1: T) -> T {
+ debug x => _1;
+ let mut _0: T;
+ let mut _2: std::option::Option<T>;
+ let mut _3: T;
+ let mut _4: isize;
+ let _5: T;
+ let mut _6: !;
+ scope 1 {
+ debug y => _5;
+ }
+
+ bb0: {
+ StorageLive(_2);
+- StorageLive(_3);
+- _3 = _1;
+- _2 = Option::<T>::Some(move _3);
+- StorageDead(_3);
++ _2 = Option::<T>::Some(_1);
+ _4 = discriminant(_2);
+ switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_6);
+ _6 = begin_panic::<&str>(const "explicit panic") -> unwind continue;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+- StorageLive(_5);
+ _5 = ((_2 as Some).0: T);
+ _0 = _5;
+- StorageDead(_5);
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff
index 8483b89f8..153195860 100644
--- a/tests/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff
+++ b/tests/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff
@@ -12,16 +12,17 @@
StorageLive(_3);
_3 = _1;
_2 = Eq(move _3, const -42f32);
- StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
+ StorageDead(_3);
_0 = const 0_i32;
goto -> bb3;
}
bb2: {
+ StorageDead(_3);
_0 = const 1_i32;
goto -> bb3;
}
diff --git a/tests/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff
index 837841b00..fedbd6cdd 100644
--- a/tests/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff
+++ b/tests/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff
@@ -12,21 +12,19 @@
StorageLive(_3);
_3 = _1;
- _2 = Eq(move _3, const 'x');
-- StorageDead(_3);
- switchInt(move _2) -> [0: bb2, otherwise: bb1];
+ nop;
-+ nop;
+ switchInt(move _3) -> [120: bb1, otherwise: bb2];
}
bb1: {
-+ StorageDead(_3);
+ StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
-+ StorageDead(_3);
+ StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}
diff --git a/tests/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff
index 3cbf91299..9c38d8fe0 100644
--- a/tests/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff
+++ b/tests/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff
@@ -12,21 +12,19 @@
StorageLive(_3);
_3 = _1;
- _2 = Eq(move _3, const 42_i8);
-- StorageDead(_3);
- switchInt(move _2) -> [0: bb2, otherwise: bb1];
+ nop;
-+ nop;
+ switchInt(move _3) -> [42: bb1, otherwise: bb2];
}
bb1: {
-+ StorageDead(_3);
+ StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
-+ StorageDead(_3);
+ StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}
diff --git a/tests/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff
index 8d6f3b224..8c85ce785 100644
--- a/tests/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff
+++ b/tests/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff
@@ -14,40 +14,36 @@
StorageLive(_3);
_3 = _1;
- _2 = Eq(move _3, const 42_u32);
-- StorageDead(_3);
- switchInt(move _2) -> [0: bb2, otherwise: bb1];
+ nop;
-+ nop;
+ switchInt(move _3) -> [42: bb1, otherwise: bb2];
}
bb1: {
-+ StorageDead(_3);
+ StorageDead(_3);
_0 = const 0_u32;
goto -> bb6;
}
bb2: {
-+ StorageDead(_3);
+ StorageDead(_3);
StorageLive(_4);
StorageLive(_5);
_5 = _1;
- _4 = Ne(move _5, const 21_u32);
-- StorageDead(_5);
- switchInt(move _4) -> [0: bb4, otherwise: bb3];
+ nop;
-+ nop;
+ switchInt(move _5) -> [21: bb4, otherwise: bb3];
}
bb3: {
-+ StorageDead(_5);
+ StorageDead(_5);
_0 = const 1_u32;
goto -> bb5;
}
bb4: {
-+ StorageDead(_5);
+ StorageDead(_5);
_0 = const 2_u32;
goto -> bb5;
}
diff --git a/tests/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff
index e2566b13c..876ed61e9 100644
--- a/tests/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff
+++ b/tests/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff
@@ -12,21 +12,19 @@
StorageLive(_3);
_3 = _1;
- _2 = Eq(move _3, const -42_i32);
-- StorageDead(_3);
- switchInt(move _2) -> [0: bb2, otherwise: bb1];
+ nop;
-+ nop;
+ switchInt(move _3) -> [4294967254: bb1, otherwise: bb2];
}
bb1: {
-+ StorageDead(_3);
+ StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
-+ StorageDead(_3);
+ StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}
diff --git a/tests/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff
index dc8da5b44..ed3eb47dd 100644
--- a/tests/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff
+++ b/tests/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff
@@ -12,21 +12,19 @@
StorageLive(_3);
_3 = _1;
- _2 = Eq(move _3, const 42_u32);
-- StorageDead(_3);
- switchInt(move _2) -> [0: bb2, otherwise: bb1];
+ nop;
-+ nop;
+ switchInt(move _3) -> [42: bb1, otherwise: bb2];
}
bb1: {
-+ StorageDead(_3);
+ StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
-+ StorageDead(_3);
+ StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}
diff --git a/tests/mir-opt/inline/asm_unwind.main.Inline.panic-abort.diff b/tests/mir-opt/inline/asm_unwind.main.Inline.panic-abort.diff
index 503dc5beb..aa9429c46 100644
--- a/tests/mir-opt/inline/asm_unwind.main.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline/asm_unwind.main.Inline.panic-abort.diff
@@ -17,7 +17,7 @@
StorageLive(_1);
- _1 = foo() -> [return: bb1, unwind unreachable];
+ StorageLive(_2);
-+ asm!("", options(MAY_UNWIND)) -> [return: bb2, unwind terminate];
++ asm!("", options(MAY_UNWIND)) -> [return: bb2, unwind terminate(abi)];
}
bb1: {
diff --git a/tests/mir-opt/inline/asm_unwind.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/asm_unwind.main.Inline.panic-unwind.diff
index 684211b53..ea9c360aa 100644
--- a/tests/mir-opt/inline/asm_unwind.main.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/asm_unwind.main.Inline.panic-unwind.diff
@@ -32,7 +32,7 @@
+ }
+
+ bb3 (cleanup): {
-+ drop(_2) -> [return: bb4, unwind terminate];
++ drop(_2) -> [return: bb4, unwind terminate(cleanup)];
+ }
+
+ bb4 (cleanup): {
diff --git a/tests/mir-opt/inline/cycle.f.Inline.panic-unwind.diff b/tests/mir-opt/inline/cycle.f.Inline.panic-unwind.diff
index f3a6ee22c..b7fea4f2e 100644
--- a/tests/mir-opt/inline/cycle.f.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/cycle.f.Inline.panic-unwind.diff
@@ -30,7 +30,7 @@
}
bb3 (cleanup): {
- drop(_1) -> [return: bb4, unwind terminate];
+ drop(_1) -> [return: bb4, unwind terminate(cleanup)];
}
bb4 (cleanup): {
diff --git a/tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff b/tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff
index ad801fd28..1fd1014ba 100644
--- a/tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff
@@ -36,7 +36,7 @@
+ }
+
+ bb3 (cleanup): {
-+ drop(_2) -> [return: bb4, unwind terminate];
++ drop(_2) -> [return: bb4, unwind terminate(cleanup)];
+ }
+
+ bb4 (cleanup): {
diff --git a/tests/mir-opt/inline/cycle.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/cycle.main.Inline.panic-unwind.diff
index 99dc64115..e8299db47 100644
--- a/tests/mir-opt/inline/cycle.main.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/cycle.main.Inline.panic-unwind.diff
@@ -36,7 +36,7 @@
+ }
+
+ bb3 (cleanup): {
-+ drop(_2) -> [return: bb4, unwind terminate];
++ drop(_2) -> [return: bb4, unwind terminate(cleanup)];
+ }
+
+ bb4 (cleanup): {
diff --git a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-unwind.diff b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-unwind.diff
index ef85e075e..b82961c28 100644
--- a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-unwind.diff
@@ -27,7 +27,7 @@
}
bb3 (cleanup): {
- drop(_1) -> [return: bb4, unwind terminate];
+ drop(_1) -> [return: bb4, unwind terminate(cleanup)];
}
bb4 (cleanup): {
diff --git a/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-unwind.diff
index 5df730a99..47fd0ed07 100644
--- a/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-unwind.diff
@@ -30,7 +30,7 @@
}
bb3 (cleanup): {
- drop(_1) -> [return: bb4, unwind terminate];
+ drop(_1) -> [return: bb4, unwind terminate(cleanup)];
}
bb4 (cleanup): {
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 9384064c5..8a60f4b1b 100644
--- a/tests/mir-opt/inline/inline_closure.foo.Inline.after.mir
+++ b/tests/mir-opt/inline/inline_closure.foo.Inline.after.mir
@@ -4,8 +4,8 @@ fn foo(_1: T, _2: i32) -> i32 {
debug _t => _1;
debug q => _2;
let mut _0: i32;
- let _3: [closure@foo<T>::{closure#0}];
- let mut _4: &[closure@foo<T>::{closure#0}];
+ let _3: {closure@foo<T>::{closure#0}};
+ let mut _4: &{closure@foo<T>::{closure#0}};
let mut _5: (i32, i32);
let mut _6: i32;
let mut _7: i32;
@@ -21,7 +21,7 @@ fn foo(_1: T, _2: i32) -> i32 {
bb0: {
StorageLive(_3);
- _3 = [closure@foo::<T>::{closure#0}];
+ _3 = {closure@foo::<T>::{closure#0}};
StorageLive(_4);
_4 = &_3;
StorageLive(_5);
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 17676638a..6e77a9bc5 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
@@ -4,8 +4,8 @@ fn foo(_1: T, _2: &i32) -> i32 {
debug _t => _1;
debug q => _2;
let mut _0: i32;
- let _3: [closure@foo<T>::{closure#0}];
- let mut _4: &[closure@foo<T>::{closure#0}];
+ let _3: {closure@foo<T>::{closure#0}};
+ let mut _4: &{closure@foo<T>::{closure#0}};
let mut _5: (&i32, &i32);
let mut _6: &i32;
let mut _7: &i32;
@@ -24,7 +24,7 @@ fn foo(_1: T, _2: &i32) -> i32 {
bb0: {
StorageLive(_3);
- _3 = [closure@foo::<T>::{closure#0}];
+ _3 = {closure@foo::<T>::{closure#0}};
StorageLive(_4);
_4 = &_3;
StorageLive(_5);
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 b8178d201..721fac27d 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
@@ -4,10 +4,10 @@ fn foo(_1: T, _2: i32) -> (i32, T) {
debug t => _1;
debug q => _2;
let mut _0: (i32, T);
- let _3: [closure@foo<T>::{closure#0}];
+ let _3: {closure@foo<T>::{closure#0}};
let mut _4: &i32;
let mut _5: &T;
- let mut _6: &[closure@foo<T>::{closure#0}];
+ let mut _6: &{closure@foo<T>::{closure#0}};
let mut _7: (i32,);
let mut _8: i32;
let mut _9: i32;
@@ -30,7 +30,7 @@ fn foo(_1: T, _2: i32) -> (i32, T) {
_4 = &_2;
StorageLive(_5);
_5 = &_1;
- _3 = [closure@foo::<T>::{closure#0}] { q: move _4, t: move _5 };
+ _3 = {closure@foo::<T>::{closure#0}} { q: move _4, t: move _5 };
StorageDead(_5);
StorageDead(_4);
StorageLive(_6);
@@ -42,10 +42,10 @@ fn foo(_1: T, _2: i32) -> (i32, T) {
StorageLive(_9);
_9 = move (_7.0: i32);
StorageLive(_11);
- _10 = deref_copy ((*_6).0: &i32);
+ _10 = ((*_6).0: &i32);
_11 = (*_10);
StorageLive(_13);
- _12 = deref_copy ((*_6).1: &T);
+ _12 = ((*_6).1: &T);
_13 = (*_12);
_0 = (move _11, move _13);
StorageDead(_13);
diff --git a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff
index 9db0d385d..d675695eb 100644
--- a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff
@@ -18,11 +18,11 @@
StorageLive(_3);
_3 = _1;
_2 = Gt(move _3, const 0_i32);
- StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
+ StorageDead(_3);
StorageLive(_4);
_4 = _1;
_0 = move _4 as u32 (IntToInt);
@@ -32,6 +32,7 @@
}
bb2: {
+ StorageDead(_3);
StorageLive(_6);
- _6 = panic() -> unwind unreachable;
+ StorageLive(_7);
diff --git a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff
index 5663b4624..114261611 100644
--- a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff
@@ -18,11 +18,11 @@
StorageLive(_3);
_3 = _1;
_2 = Gt(move _3, const 0_i32);
- StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
+ StorageDead(_3);
StorageLive(_4);
_4 = _1;
_0 = move _4 as u32 (IntToInt);
@@ -32,6 +32,7 @@
}
bb2: {
+ StorageDead(_3);
StorageLive(_6);
- _6 = panic() -> unwind continue;
+ StorageLive(_7);
diff --git a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff
index 073ddeff7..9f8c5806c 100644
--- a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff
@@ -54,11 +54,11 @@
+ }
+
+ bb4 (cleanup): {
-+ drop(_4) -> [return: bb5, unwind terminate];
++ drop(_4) -> [return: bb5, unwind terminate(cleanup)];
+ }
+
+ bb5 (cleanup): {
-+ drop(_2) -> [return: bb6, unwind terminate];
++ drop(_2) -> [return: bb6, unwind terminate(cleanup)];
+ }
+
+ bb6 (cleanup): {
diff --git a/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff
index e05c605a4..6779003b6 100644
--- a/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff
@@ -4,30 +4,28 @@
fn main() -> () {
let mut _0: ();
let _1: std::ops::GeneratorState<i32, bool>;
- let mut _2: std::pin::Pin<&mut [generator@$DIR/inline_generator.rs:16:5: 16:8]>;
- let mut _3: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8];
- let mut _4: [generator@$DIR/inline_generator.rs:16:5: 16:8];
+ let mut _2: std::pin::Pin<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>;
+ let mut _3: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8};
+ let mut _4: {generator@$DIR/inline_generator.rs:16:5: 16:8};
+ let mut _5: bool;
scope 1 {
debug _r => _1;
}
+ scope 2 (inlined g) {
+ }
-+ scope 3 (inlined Pin::<&mut [generator@$DIR/inline_generator.rs:16:5: 16:8]>::new) {
++ scope 3 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new) {
+ debug pointer => _3;
+ scope 4 {
-+ scope 5 (inlined Pin::<&mut [generator@$DIR/inline_generator.rs:16:5: 16:8]>::new_unchecked) {
++ scope 5 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new_unchecked) {
+ debug pointer => _3;
+ }
+ }
+ }
+ scope 6 (inlined g::{closure#0}) {
+ debug a => _5;
-+ let mut _6: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8];
++ let mut _6: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8};
+ let mut _7: u32;
+ let mut _8: i32;
-+ let mut _9: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8];
-+ let mut _10: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8];
+ }
bb0: {
@@ -36,71 +34,74 @@
StorageLive(_3);
StorageLive(_4);
- _4 = g() -> [return: bb1, unwind unreachable];
-- }
--
-- bb1: {
-+ _4 = [generator@$DIR/inline_generator.rs:16:5: 16:8 (#0)];
- _3 = &mut _4;
-- _2 = Pin::<&mut [generator@$DIR/inline_generator.rs:16:5: 16:8]>::new(move _3) -> [return: bb2, unwind unreachable];
-- }
--
-- bb2: {
-+ _2 = Pin::<&mut [generator@$DIR/inline_generator.rs:16:5: 16:8]> { pointer: move _3 };
- StorageDead(_3);
-- _1 = <[generator@$DIR/inline_generator.rs:16:5: 16:8] as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind unreachable];
++ _4 = {generator@$DIR/inline_generator.rs:16:5: 16:8 (#0)};
++ _3 = &mut _4;
++ _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}> { pointer: move _3 };
++ StorageDead(_3);
+ StorageLive(_5);
+ _5 = const false;
-+ _6 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8]);
++ _6 = (_2.0: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8});
+ _7 = discriminant((*_6));
-+ switchInt(move _7) -> [0: bb2, 1: bb6, 3: bb7, otherwise: bb8];
++ switchInt(move _7) -> [0: bb3, 1: bb7, 3: bb8, otherwise: bb9];
}
-- bb3: {
-+ bb1: {
+ bb1: {
+- _3 = &mut _4;
+- _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new(move _3) -> [return: bb2, unwind unreachable];
+ StorageDead(_5);
- StorageDead(_2);
- StorageDead(_4);
- _0 = const ();
- StorageDead(_1);
- return;
-+ }
-+
-+ bb2: {
++ StorageDead(_2);
++ drop(_4) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+- StorageDead(_3);
+- _1 = <{generator@$DIR/inline_generator.rs:16:5: 16:8} as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind unreachable];
++ StorageDead(_4);
++ _0 = const ();
++ StorageDead(_1);
++ return;
+ }
+
+ bb3: {
+- StorageDead(_2);
+- drop(_4) -> [return: bb4, unwind unreachable];
+ StorageLive(_8);
-+ switchInt(_5) -> [0: bb3, otherwise: bb4];
-+ }
-+
-+ bb3: {
++ switchInt(_5) -> [0: bb4, otherwise: bb5];
+ }
+
+ bb4: {
+- StorageDead(_4);
+- _0 = const ();
+- StorageDead(_1);
+- return;
+ _8 = const 13_i32;
-+ goto -> bb5;
++ goto -> bb6;
+ }
+
-+ bb4: {
++ bb5: {
+ _8 = const 7_i32;
-+ goto -> bb5;
++ goto -> bb6;
+ }
+
-+ bb5: {
++ bb6: {
+ _1 = GeneratorState::<i32, bool>::Yielded(move _8);
-+ _9 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8]);
-+ discriminant((*_9)) = 3;
++ discriminant((*_6)) = 3;
+ goto -> bb1;
+ }
+
-+ bb6: {
-+ assert(const false, "generator resumed after completion") -> [success: bb6, unwind unreachable];
++ bb7: {
++ assert(const false, "generator resumed after completion") -> [success: bb7, unwind unreachable];
+ }
+
-+ bb7: {
++ bb8: {
+ StorageLive(_8);
+ StorageDead(_8);
+ _1 = GeneratorState::<i32, bool>::Complete(_5);
-+ _10 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8]);
-+ discriminant((*_10)) = 1;
++ discriminant((*_6)) = 1;
+ goto -> bb1;
+ }
+
-+ bb8: {
++ bb9: {
+ unreachable;
}
}
diff --git a/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff
index fedcf0423..31744be99 100644
--- a/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff
@@ -4,30 +4,28 @@
fn main() -> () {
let mut _0: ();
let _1: std::ops::GeneratorState<i32, bool>;
- let mut _2: std::pin::Pin<&mut [generator@$DIR/inline_generator.rs:16:5: 16:8]>;
- let mut _3: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8];
- let mut _4: [generator@$DIR/inline_generator.rs:16:5: 16:8];
+ let mut _2: std::pin::Pin<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>;
+ let mut _3: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8};
+ let mut _4: {generator@$DIR/inline_generator.rs:16:5: 16:8};
+ let mut _5: bool;
scope 1 {
debug _r => _1;
}
+ scope 2 (inlined g) {
+ }
-+ scope 3 (inlined Pin::<&mut [generator@$DIR/inline_generator.rs:16:5: 16:8]>::new) {
++ scope 3 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new) {
+ debug pointer => _3;
+ scope 4 {
-+ scope 5 (inlined Pin::<&mut [generator@$DIR/inline_generator.rs:16:5: 16:8]>::new_unchecked) {
++ scope 5 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new_unchecked) {
+ debug pointer => _3;
+ }
+ }
+ }
+ scope 6 (inlined g::{closure#0}) {
+ debug a => _5;
-+ let mut _6: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8];
++ let mut _6: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8};
+ let mut _7: u32;
+ let mut _8: i32;
-+ let mut _9: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8];
-+ let mut _10: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8];
+ }
bb0: {
@@ -39,73 +37,83 @@
- }
-
- bb1: {
-+ _4 = [generator@$DIR/inline_generator.rs:16:5: 16:8 (#0)];
++ _4 = {generator@$DIR/inline_generator.rs:16:5: 16:8 (#0)};
_3 = &mut _4;
-- _2 = Pin::<&mut [generator@$DIR/inline_generator.rs:16:5: 16:8]>::new(move _3) -> [return: bb2, unwind: bb4];
+- _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new(move _3) -> [return: bb2, unwind: bb5];
- }
-
- bb2: {
-+ _2 = Pin::<&mut [generator@$DIR/inline_generator.rs:16:5: 16:8]> { pointer: move _3 };
++ _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}> { pointer: move _3 };
StorageDead(_3);
-- _1 = <[generator@$DIR/inline_generator.rs:16:5: 16:8] as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb4];
+- _1 = <{generator@$DIR/inline_generator.rs:16:5: 16:8} as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb5];
+ StorageLive(_5);
+ _5 = const false;
-+ _6 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8]);
++ _6 = (_2.0: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8});
+ _7 = discriminant((*_6));
-+ switchInt(move _7) -> [0: bb3, 1: bb7, 3: bb8, otherwise: bb9];
++ switchInt(move _7) -> [0: bb5, 1: bb9, 3: bb10, otherwise: bb11];
}
- bb3: {
+ bb1: {
+ StorageDead(_5);
StorageDead(_2);
+- drop(_4) -> [return: bb4, unwind: bb6];
++ drop(_4) -> [return: bb2, unwind: bb4];
+ }
+
+- bb4: {
++ bb2: {
StorageDead(_4);
_0 = const ();
StorageDead(_1);
return;
}
-- bb4 (cleanup): {
-+ bb2 (cleanup): {
+- bb5 (cleanup): {
+- drop(_4) -> [return: bb6, unwind terminate(cleanup)];
++ bb3 (cleanup): {
++ drop(_4) -> [return: bb4, unwind terminate(cleanup)];
+ }
+
+- bb6 (cleanup): {
++ bb4 (cleanup): {
resume;
+ }
+
-+ bb3: {
++ bb5: {
+ StorageLive(_8);
-+ switchInt(_5) -> [0: bb4, otherwise: bb5];
++ switchInt(_5) -> [0: bb6, otherwise: bb7];
+ }
+
-+ bb4: {
++ bb6: {
+ _8 = const 13_i32;
-+ goto -> bb6;
++ goto -> bb8;
+ }
+
-+ bb5: {
++ bb7: {
+ _8 = const 7_i32;
-+ goto -> bb6;
++ goto -> bb8;
+ }
+
-+ bb6: {
++ bb8: {
+ _1 = GeneratorState::<i32, bool>::Yielded(move _8);
-+ _9 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8]);
-+ discriminant((*_9)) = 3;
++ discriminant((*_6)) = 3;
+ goto -> bb1;
+ }
+
-+ bb7: {
-+ assert(const false, "generator resumed after completion") -> [success: bb7, unwind: bb2];
++ bb9: {
++ assert(const false, "generator resumed after completion") -> [success: bb9, unwind: bb3];
+ }
+
-+ bb8: {
++ bb10: {
+ StorageLive(_8);
+ StorageDead(_8);
+ _1 = GeneratorState::<i32, bool>::Complete(_5);
-+ _10 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8]);
-+ discriminant((*_10)) = 1;
++ discriminant((*_6)) = 1;
+ goto -> bb1;
+ }
+
-+ bb9: {
++ bb11: {
+ unreachable;
}
}
diff --git a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff
index 54c33aac9..675292f06 100644
--- a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff
@@ -155,7 +155,7 @@
- StorageDead(_1);
- return;
+ bb3 (cleanup): {
-+ drop(_2) -> [return: bb2, unwind terminate];
++ drop(_2) -> [return: bb2, unwind terminate(cleanup)];
}
- bb4 (cleanup): {
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 ef91f5040..4d170c41f 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
@@ -2,8 +2,8 @@
fn main() -> () {
let mut _0: ();
- let _1: [closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16];
- let mut _2: &[closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16];
+ let _1: {closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16};
+ let mut _2: &{closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16};
let mut _3: ((),);
let mut _4: ();
let mut _5: ();
@@ -19,7 +19,7 @@ fn main() -> () {
bb0: {
StorageLive(_1);
- _1 = [closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16];
+ _1 = {closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16};
StorageLive(_2);
_2 = &_1;
StorageLive(_3);
diff --git a/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff
index b750330df..5a946712e 100644
--- a/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff
@@ -37,7 +37,7 @@
}
bb4 (cleanup): {
- drop(_1) -> [return: bb5, unwind terminate];
+ drop(_1) -> [return: bb5, unwind terminate(cleanup)];
}
bb5 (cleanup): {
diff --git a/tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-abort.diff b/tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-abort.diff
index c94dd2556..b532b133a 100644
--- a/tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-abort.diff
+++ b/tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-abort.diff
@@ -15,28 +15,44 @@
StorageLive(_2);
StorageLive(_3);
StorageLive(_4);
- _4 = hide_foo() -> [return: bb1, unwind unreachable];
+ _4 = hide_foo() -> [return: bb1, unwind: bb6];
}
bb1: {
_3 = &_4;
StorageLive(_5);
_5 = ();
-- _2 = <impl Fn() as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind unreachable];
-+ _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind unreachable];
+- _2 = <impl Fn() as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind: bb5];
++ _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind: bb5];
}
bb2: {
StorageDead(_5);
StorageDead(_3);
+ drop(_4) -> [return: bb3, unwind: bb6];
+ }
+
+ bb3: {
StorageDead(_4);
StorageDead(_2);
_0 = const ();
- drop(_1) -> [return: bb3, unwind unreachable];
+ drop(_1) -> [return: bb4, unwind: bb7];
}
- bb3: {
+ bb4: {
return;
}
+
+ bb5 (cleanup): {
+ drop(_4) -> [return: bb6, unwind terminate(cleanup)];
+ }
+
+ bb6 (cleanup): {
+ drop(_1) -> [return: bb7, unwind terminate(cleanup)];
+ }
+
+ bb7 (cleanup): {
+ resume;
+ }
}
diff --git a/tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-unwind.diff b/tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-unwind.diff
index 7765e491d..bcebcf297 100644
--- a/tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-unwind.diff
+++ b/tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-unwind.diff
@@ -15,35 +15,43 @@
StorageLive(_2);
StorageLive(_3);
StorageLive(_4);
- _4 = hide_foo() -> [return: bb1, unwind: bb4];
+ _4 = hide_foo() -> [return: bb1, unwind: bb6];
}
bb1: {
_3 = &_4;
StorageLive(_5);
_5 = ();
-- _2 = <impl Fn() as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind: bb4];
-+ _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind: bb4];
+- _2 = <impl Fn() as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind: bb5];
++ _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind: bb5];
}
bb2: {
StorageDead(_5);
StorageDead(_3);
+ drop(_4) -> [return: bb3, unwind: bb6];
+ }
+
+ bb3: {
StorageDead(_4);
StorageDead(_2);
_0 = const ();
- drop(_1) -> [return: bb3, unwind: bb5];
+ drop(_1) -> [return: bb4, unwind continue];
}
- bb3: {
+ bb4: {
return;
}
- bb4 (cleanup): {
- drop(_1) -> [return: bb5, unwind terminate];
+ bb5 (cleanup): {
+ drop(_4) -> [return: bb6, unwind terminate(cleanup)];
}
- bb5 (cleanup): {
+ bb6 (cleanup): {
+ drop(_1) -> [return: bb7, unwind terminate(cleanup)];
+ }
+
+ bb7 (cleanup): {
resume;
}
}
diff --git a/tests/mir-opt/inline/unsized_argument.caller.Inline.diff b/tests/mir-opt/inline/unsized_argument.caller.Inline.diff
index 6ee6a0ffe..ab81f7071 100644
--- a/tests/mir-opt/inline/unsized_argument.caller.Inline.diff
+++ b/tests/mir-opt/inline/unsized_argument.caller.Inline.diff
@@ -40,7 +40,7 @@
bb4 (cleanup): {
_8 = &mut _3;
- _9 = <Box<[i32]> as Drop>::drop(move _8) -> [return: bb1, unwind terminate];
+ _9 = <Box<[i32]> as Drop>::drop(move _8) -> [return: bb1, unwind terminate(cleanup)];
}
}
diff --git a/tests/mir-opt/inline_generically_if_sized.call.Inline.diff b/tests/mir-opt/inline_generically_if_sized.call.Inline.diff
new file mode 100644
index 000000000..0cf4565dc
--- /dev/null
+++ b/tests/mir-opt/inline_generically_if_sized.call.Inline.diff
@@ -0,0 +1,24 @@
+- // MIR for `call` before Inline
++ // MIR for `call` after Inline
+
+ fn call(_1: &T) -> i32 {
+ debug s => _1;
+ let mut _0: i32;
+ let mut _2: &T;
++ scope 1 (inlined <T as Foo>::bar) {
++ debug self => _2;
++ }
+
+ bb0: {
+ StorageLive(_2);
+ _2 = &(*_1);
+- _0 = <T as Foo>::bar(move _2) -> [return: bb1, unwind unreachable];
+- }
+-
+- bb1: {
++ _0 = const 0_i32;
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline_generically_if_sized.rs b/tests/mir-opt/inline_generically_if_sized.rs
new file mode 100644
index 000000000..1acfff7a5
--- /dev/null
+++ b/tests/mir-opt/inline_generically_if_sized.rs
@@ -0,0 +1,17 @@
+// unit-test: Inline
+// compile-flags: --crate-type=lib -C panic=abort
+
+trait Foo {
+ fn bar(&self) -> i32;
+}
+
+impl<T> Foo for T {
+ fn bar(&self) -> i32 {
+ 0
+ }
+}
+
+// EMIT_MIR inline_generically_if_sized.call.Inline.diff
+pub fn call<T>(s: &T) -> i32 {
+ s.bar()
+}
diff --git a/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff
index 11501907b..4469270a9 100644
--- a/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff
+++ b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff
@@ -40,17 +40,17 @@
}
bb3 (cleanup): {
-- drop(_3) -> [return: bb5, unwind terminate];
+- drop(_3) -> [return: bb5, unwind terminate(cleanup)];
+ goto -> bb5;
}
bb4 (cleanup): {
-- drop(_4) -> [return: bb5, unwind terminate];
+- drop(_4) -> [return: bb5, unwind terminate(cleanup)];
+ goto -> bb5;
}
bb5 (cleanup): {
-- drop(_2) -> [return: bb6, unwind terminate];
+- drop(_2) -> [return: bb6, unwind terminate(cleanup)];
+ goto -> bb8;
}
@@ -59,7 +59,7 @@
+ }
+
+ bb7 (cleanup): {
-+ drop(_2) -> [return: bb6, unwind terminate];
++ drop(_2) -> [return: bb6, unwind terminate(cleanup)];
+ }
+
+ bb8 (cleanup): {
diff --git a/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff
index 11501907b..4469270a9 100644
--- a/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff
+++ b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff
@@ -40,17 +40,17 @@
}
bb3 (cleanup): {
-- drop(_3) -> [return: bb5, unwind terminate];
+- drop(_3) -> [return: bb5, unwind terminate(cleanup)];
+ goto -> bb5;
}
bb4 (cleanup): {
-- drop(_4) -> [return: bb5, unwind terminate];
+- drop(_4) -> [return: bb5, unwind terminate(cleanup)];
+ goto -> bb5;
}
bb5 (cleanup): {
-- drop(_2) -> [return: bb6, unwind terminate];
+- drop(_2) -> [return: bb6, unwind terminate(cleanup)];
+ goto -> bb8;
}
@@ -59,7 +59,7 @@
+ }
+
+ bb7 (cleanup): {
-+ drop(_2) -> [return: bb6, unwind terminate];
++ drop(_2) -> [return: bb6, unwind terminate(cleanup)];
+ }
+
+ bb8 (cleanup): {
diff --git a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff
index 65f4806aa..78184f6ae 100644
--- a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff
+++ b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff
@@ -47,7 +47,7 @@
bb3 (cleanup): {
_2 = move _5;
-- drop(_5) -> [return: bb8, unwind terminate];
+- drop(_5) -> [return: bb8, unwind terminate(cleanup)];
+ goto -> bb8;
}
@@ -70,17 +70,17 @@
}
bb7 (cleanup): {
-- drop(_4) -> [return: bb8, unwind terminate];
+- drop(_4) -> [return: bb8, unwind terminate(cleanup)];
+ goto -> bb8;
}
bb8 (cleanup): {
-- drop(_2) -> [return: bb9, unwind terminate];
+- drop(_2) -> [return: bb9, unwind terminate(cleanup)];
+ goto -> bb9;
}
bb9 (cleanup): {
-- drop(_1) -> [return: bb10, unwind terminate];
+- drop(_1) -> [return: bb10, unwind terminate(cleanup)];
+ goto -> bb12;
}
@@ -89,7 +89,7 @@
+ }
+
+ bb11 (cleanup): {
-+ drop(_1) -> [return: bb10, unwind terminate];
++ drop(_1) -> [return: bb10, unwind terminate(cleanup)];
+ }
+
+ bb12 (cleanup): {
diff --git a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff
index 4845fc732..688887c3c 100644
--- a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff
+++ b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff
@@ -47,7 +47,7 @@
bb3 (cleanup): {
_2 = move _5;
-- drop(_5) -> [return: bb8, unwind terminate];
+- drop(_5) -> [return: bb8, unwind terminate(cleanup)];
+ goto -> bb8;
}
@@ -70,17 +70,17 @@
}
bb7 (cleanup): {
-- drop(_4) -> [return: bb8, unwind terminate];
+- drop(_4) -> [return: bb8, unwind terminate(cleanup)];
+ goto -> bb8;
}
bb8 (cleanup): {
-- drop(_2) -> [return: bb9, unwind terminate];
+- drop(_2) -> [return: bb9, unwind terminate(cleanup)];
+ goto -> bb9;
}
bb9 (cleanup): {
-- drop(_1) -> [return: bb10, unwind terminate];
+- drop(_1) -> [return: bb10, unwind terminate(cleanup)];
+ goto -> bb12;
}
@@ -89,7 +89,7 @@
+ }
+
+ bb11 (cleanup): {
-+ drop(_1) -> [return: bb10, unwind terminate];
++ drop(_1) -> [return: bb10, unwind terminate(cleanup)];
+ }
+
+ bb12 (cleanup): {
diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff
index aca7fe95c..b57fe348c 100644
--- a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff
+++ b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff
@@ -58,7 +58,7 @@
+ _8 = const true;
+ _9 = const true;
_1 = move _3;
-- drop(_3) -> [return: bb11, unwind terminate];
+- drop(_3) -> [return: bb11, unwind terminate(cleanup)];
+ goto -> bb11;
}
@@ -102,7 +102,7 @@
}
bb11 (cleanup): {
-- drop(_1) -> [return: bb12, unwind terminate];
+- drop(_1) -> [return: bb12, unwind terminate(cleanup)];
+ goto -> bb12;
}
@@ -124,7 +124,7 @@
+ }
+
+ bb16 (cleanup): {
-+ drop(_1) -> [return: bb12, unwind terminate];
++ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
+ }
+
+ bb17: {
diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff
index 60ce9cd8a..2156850e3 100644
--- a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff
+++ b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff
@@ -58,7 +58,7 @@
+ _8 = const true;
+ _9 = const true;
_1 = move _3;
-- drop(_3) -> [return: bb11, unwind terminate];
+- drop(_3) -> [return: bb11, unwind terminate(cleanup)];
+ goto -> bb11;
}
@@ -102,7 +102,7 @@
}
bb11 (cleanup): {
-- drop(_1) -> [return: bb12, unwind terminate];
+- drop(_1) -> [return: bb12, unwind terminate(cleanup)];
+ goto -> bb12;
}
@@ -124,7 +124,7 @@
+ }
+
+ bb16 (cleanup): {
-+ drop(_1) -> [return: bb12, unwind terminate];
++ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
+ }
+
+ bb17: {
diff --git a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir
index ae0beffae..734629678 100644
--- a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir
+++ b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir
@@ -100,11 +100,11 @@ fn test() -> Option<Box<u32>> {
}
bb11 (cleanup): {
- drop(_1) -> [return: bb13, unwind terminate];
+ drop(_1) -> [return: bb13, unwind terminate(cleanup)];
}
bb12 (cleanup): {
- drop(_5) -> [return: bb13, unwind terminate];
+ drop(_5) -> [return: bb13, unwind terminate(cleanup)];
}
bb13 (cleanup): {
diff --git a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir
index 7ecdc428e..8264e2cab 100644
--- a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir
+++ b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir
@@ -100,11 +100,11 @@ fn test() -> Option<Box<u32>> {
}
bb11 (cleanup): {
- drop(_1) -> [return: bb13, unwind terminate];
+ drop(_1) -> [return: bb13, unwind terminate(cleanup)];
}
bb12 (cleanup): {
- drop(_5) -> [return: bb13, unwind terminate];
+ drop(_5) -> [return: bb13, unwind terminate(cleanup)];
}
bb13 (cleanup): {
diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff
index f61632728..9d8f272ab 100644
--- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff
+++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff
@@ -33,12 +33,10 @@
_3 = &_4;
_2 = move _3 as &[T] (PointerCoercion(Unsize));
StorageDead(_3);
- _8 = Len((*_2));
+ _8 = const 3_usize;
_9 = const 3_usize;
-- _10 = Eq(move _8, const 3_usize);
-- switchInt(move _10) -> [0: bb1, otherwise: bb2];
-+ nop;
-+ switchInt(move _8) -> [3: bb2, otherwise: bb1];
+ _10 = const true;
+ goto -> bb2;
}
bb1: {
diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff
index f6c337be1..738b0b1b3 100644
--- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff
+++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff
@@ -33,12 +33,10 @@
_3 = &_4;
_2 = move _3 as &[T] (PointerCoercion(Unsize));
StorageDead(_3);
- _8 = Len((*_2));
+ _8 = const 3_usize;
_9 = const 3_usize;
-- _10 = Eq(move _8, const 3_usize);
-- switchInt(move _10) -> [0: bb1, otherwise: bb2];
-+ nop;
-+ switchInt(move _8) -> [3: bb2, otherwise: bb1];
+ _10 = const true;
+ goto -> bb2;
}
bb1: {
diff --git a/tests/mir-opt/issue_91633.bar.built.after.mir b/tests/mir-opt/issue_91633.bar.built.after.mir
index 92f52e138..cce1a1fd2 100644
--- a/tests/mir-opt/issue_91633.bar.built.after.mir
+++ b/tests/mir-opt/issue_91633.bar.built.after.mir
@@ -28,7 +28,7 @@ fn bar(_1: Box<[T]>) -> () {
}
bb3 (cleanup): {
- drop(_1) -> [return: bb4, unwind terminate];
+ drop(_1) -> [return: bb4, unwind terminate(cleanup)];
}
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 4529c58a1..a66769f0d 100644
--- a/tests/mir-opt/issue_91633.foo.built.after.mir
+++ b/tests/mir-opt/issue_91633.foo.built.after.mir
@@ -45,7 +45,7 @@ fn foo(_1: Box<[T]>) -> T {
}
bb5 (cleanup): {
- drop(_1) -> [return: bb6, unwind terminate];
+ drop(_1) -> [return: bb6, unwind terminate(cleanup)];
}
bb6 (cleanup): {
diff --git a/tests/mir-opt/issue_99325.main.built.after.mir b/tests/mir-opt/issue_99325.main.built.after.32bit.mir
index aef89c7f9..132b71335 100644
--- a/tests/mir-opt/issue_99325.main.built.after.mir
+++ b/tests/mir-opt/issue_99325.main.built.after.32bit.mir
@@ -1,8 +1,8 @@
// MIR for `main` after built
| User Type Annotations
-| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [Const { ty: &'static [u8; 4], kind: Branch([Leaf(0x41), Leaf(0x41), Leaf(0x41), Leaf(0x41)]) }], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:10:16: 10:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
-| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [Const { ty: &'static [u8; 4], kind: UnevaluatedConst { def: DefId(0:8 ~ issue_99325[22bb]::main::{constant#1}), args: [] } }], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:11:16: 11:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
+| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [&*b"AAAA"], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:12:16: 12: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), UserArgs { args: [UnevaluatedConst { def: DefId(0:8 ~ issue_99325[22bb]::main::{constant#1}), args: [] }: &ReStatic [u8; 4_usize]], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:13:16: 13:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
|
fn main() -> () {
let mut _0: ();
@@ -16,51 +16,49 @@ fn main() -> () {
let _8: &&[u8];
let _9: &&[u8; 4];
let mut _10: bool;
- let mut _11: bool;
- let mut _12: &&[u8];
- let mut _13: &&[u8; 4];
- let mut _14: !;
- let _16: !;
- let mut _17: core::panicking::AssertKind;
- let mut _18: &&[u8];
- let _19: &&[u8];
- let mut _20: &&[u8; 4];
- let _21: &&[u8; 4];
- let mut _22: std::option::Option<std::fmt::Arguments<'_>>;
- let _23: ();
- let mut _24: (&&[u8], &&[u8; 4]);
- let mut _25: &&[u8];
- let _26: &[u8];
- let mut _27: &&[u8; 4];
- let _28: &[u8; 4];
- let _29: &&[u8];
- let _30: &&[u8; 4];
- let mut _31: bool;
- let mut _32: bool;
- let mut _33: &&[u8];
- let mut _34: &&[u8; 4];
- let mut _35: !;
- let _37: !;
- let mut _38: core::panicking::AssertKind;
- let mut _39: &&[u8];
- let _40: &&[u8];
- let mut _41: &&[u8; 4];
- let _42: &&[u8; 4];
- let mut _43: std::option::Option<std::fmt::Arguments<'_>>;
+ let mut _11: &&[u8];
+ let mut _12: &&[u8; 4];
+ let mut _13: !;
+ let _15: !;
+ let mut _16: core::panicking::AssertKind;
+ let mut _17: &&[u8];
+ let _18: &&[u8];
+ let mut _19: &&[u8; 4];
+ let _20: &&[u8; 4];
+ let mut _21: std::option::Option<std::fmt::Arguments<'_>>;
+ let _22: ();
+ let mut _23: (&&[u8], &&[u8; 4]);
+ let mut _24: &&[u8];
+ let _25: &[u8];
+ let mut _26: &&[u8; 4];
+ let _27: &[u8; 4];
+ let _28: &&[u8];
+ let _29: &&[u8; 4];
+ let mut _30: bool;
+ let mut _31: &&[u8];
+ let mut _32: &&[u8; 4];
+ let mut _33: !;
+ let _35: !;
+ let mut _36: core::panicking::AssertKind;
+ let mut _37: &&[u8];
+ let _38: &&[u8];
+ let mut _39: &&[u8; 4];
+ let _40: &&[u8; 4];
+ let mut _41: std::option::Option<std::fmt::Arguments<'_>>;
scope 1 {
debug left_val => _8;
debug right_val => _9;
- let _15: core::panicking::AssertKind;
+ let _14: core::panicking::AssertKind;
scope 2 {
- debug kind => _15;
+ debug kind => _14;
}
}
scope 3 {
- debug left_val => _29;
- debug right_val => _30;
- let _36: core::panicking::AssertKind;
+ debug left_val => _28;
+ debug right_val => _29;
+ let _34: core::panicking::AssertKind;
scope 4 {
- debug kind => _36;
+ debug kind => _34;
}
}
@@ -69,7 +67,7 @@ fn main() -> () {
StorageLive(_2);
StorageLive(_3);
StorageLive(_4);
- _4 = function_with_bytes::<&*b"AAAA">() -> [return: bb1, unwind: bb19];
+ _4 = function_with_bytes::<&*b"AAAA">() -> [return: bb1, unwind: bb21];
}
bb1: {
@@ -90,179 +88,185 @@ fn main() -> () {
_9 = (_2.1: &&[u8; 4]);
StorageLive(_10);
StorageLive(_11);
+ _11 = &(*_8);
StorageLive(_12);
- _12 = &(*_8);
- StorageLive(_13);
- _13 = &(*_9);
- _11 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _12, move _13) -> [return: bb2, unwind: bb19];
+ _12 = &(*_9);
+ _10 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _11, move _12) -> [return: bb2, unwind: bb21];
}
bb2: {
- StorageDead(_13);
- StorageDead(_12);
- _10 = Not(move _11);
- StorageDead(_11);
switchInt(move _10) -> [0: bb4, otherwise: bb3];
}
bb3: {
+ StorageDead(_12);
+ StorageDead(_11);
+ goto -> bb8;
+ }
+
+ bb4: {
+ goto -> bb5;
+ }
+
+ bb5: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageLive(_14);
+ _14 = core::panicking::AssertKind::Eq;
+ FakeRead(ForLet(None), _14);
StorageLive(_15);
- _15 = core::panicking::AssertKind::Eq;
- FakeRead(ForLet(None), _15);
StorageLive(_16);
+ _16 = move _14;
StorageLive(_17);
- _17 = move _15;
StorageLive(_18);
+ _18 = &(*_8);
+ _17 = &(*_18);
StorageLive(_19);
- _19 = &(*_8);
- _18 = &(*_19);
StorageLive(_20);
+ _20 = &(*_9);
+ _19 = &(*_20);
StorageLive(_21);
- _21 = &(*_9);
- _20 = &(*_21);
- StorageLive(_22);
- _22 = Option::<Arguments<'_>>::None;
- _16 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _17, move _18, move _20, move _22) -> bb19;
- }
-
- bb4: {
- goto -> bb7;
+ _21 = Option::<Arguments<'_>>::None;
+ _15 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _16, move _17, move _19, move _21) -> bb21;
}
- bb5: {
- StorageDead(_22);
- StorageDead(_20);
- StorageDead(_18);
- StorageDead(_17);
+ bb6: {
StorageDead(_21);
StorageDead(_19);
+ StorageDead(_17);
StorageDead(_16);
+ StorageDead(_20);
+ StorageDead(_18);
StorageDead(_15);
+ StorageDead(_14);
unreachable;
}
- bb6: {
- goto -> bb8;
+ bb7: {
+ goto -> bb9;
}
- bb7: {
+ bb8: {
_1 = const ();
- goto -> bb8;
+ goto -> bb9;
}
- bb8: {
+ bb9: {
StorageDead(_10);
StorageDead(_9);
StorageDead(_8);
- goto -> bb9;
+ goto -> bb10;
}
- bb9: {
+ bb10: {
StorageDead(_7);
StorageDead(_6);
StorageDead(_4);
StorageDead(_2);
StorageDead(_1);
+ StorageLive(_22);
StorageLive(_23);
StorageLive(_24);
StorageLive(_25);
- StorageLive(_26);
- _26 = function_with_bytes::<&*b"AAAA">() -> [return: bb10, unwind: bb19];
+ _25 = function_with_bytes::<&*b"AAAA">() -> [return: bb11, unwind: bb21];
}
- bb10: {
- _25 = &_26;
+ bb11: {
+ _24 = &_25;
+ StorageLive(_26);
StorageLive(_27);
+ _27 = const b"AAAA";
+ _26 = &_27;
+ _23 = (move _24, move _26);
+ StorageDead(_26);
+ StorageDead(_24);
+ FakeRead(ForMatchedPlace(None), _23);
StorageLive(_28);
- _28 = const b"AAAA";
- _27 = &_28;
- _24 = (move _25, move _27);
- StorageDead(_27);
- StorageDead(_25);
- FakeRead(ForMatchedPlace(None), _24);
+ _28 = (_23.0: &&[u8]);
StorageLive(_29);
- _29 = (_24.0: &&[u8]);
+ _29 = (_23.1: &&[u8; 4]);
StorageLive(_30);
- _30 = (_24.1: &&[u8; 4]);
StorageLive(_31);
+ _31 = &(*_28);
StorageLive(_32);
- StorageLive(_33);
- _33 = &(*_29);
- StorageLive(_34);
- _34 = &(*_30);
- _32 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _33, move _34) -> [return: bb11, unwind: bb19];
+ _32 = &(*_29);
+ _30 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _31, move _32) -> [return: bb12, unwind: bb21];
}
- bb11: {
- StorageDead(_34);
- StorageDead(_33);
- _31 = Not(move _32);
+ bb12: {
+ switchInt(move _30) -> [0: bb14, otherwise: bb13];
+ }
+
+ bb13: {
StorageDead(_32);
- switchInt(move _31) -> [0: bb13, otherwise: bb12];
+ StorageDead(_31);
+ goto -> bb18;
}
- bb12: {
+ bb14: {
+ goto -> bb15;
+ }
+
+ bb15: {
+ StorageDead(_32);
+ StorageDead(_31);
+ StorageLive(_34);
+ _34 = core::panicking::AssertKind::Eq;
+ FakeRead(ForLet(None), _34);
+ StorageLive(_35);
StorageLive(_36);
- _36 = core::panicking::AssertKind::Eq;
- FakeRead(ForLet(None), _36);
+ _36 = move _34;
StorageLive(_37);
StorageLive(_38);
- _38 = move _36;
+ _38 = &(*_28);
+ _37 = &(*_38);
StorageLive(_39);
StorageLive(_40);
_40 = &(*_29);
_39 = &(*_40);
StorageLive(_41);
- StorageLive(_42);
- _42 = &(*_30);
- _41 = &(*_42);
- StorageLive(_43);
- _43 = Option::<Arguments<'_>>::None;
- _37 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _38, move _39, move _41, move _43) -> bb19;
- }
-
- bb13: {
- goto -> bb16;
+ _41 = Option::<Arguments<'_>>::None;
+ _35 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _36, move _37, move _39, move _41) -> bb21;
}
- bb14: {
- StorageDead(_43);
+ bb16: {
StorageDead(_41);
StorageDead(_39);
- StorageDead(_38);
- StorageDead(_42);
- StorageDead(_40);
StorageDead(_37);
StorageDead(_36);
+ StorageDead(_40);
+ StorageDead(_38);
+ StorageDead(_35);
+ StorageDead(_34);
unreachable;
}
- bb15: {
- goto -> bb17;
+ bb17: {
+ goto -> bb19;
}
- bb16: {
- _23 = const ();
- goto -> bb17;
+ bb18: {
+ _22 = const ();
+ goto -> bb19;
}
- bb17: {
- StorageDead(_31);
+ bb19: {
StorageDead(_30);
StorageDead(_29);
- goto -> bb18;
+ StorageDead(_28);
+ goto -> bb20;
}
- bb18: {
- StorageDead(_28);
- StorageDead(_26);
- StorageDead(_24);
+ bb20: {
+ StorageDead(_27);
+ StorageDead(_25);
StorageDead(_23);
+ StorageDead(_22);
_0 = const ();
return;
}
- bb19 (cleanup): {
+ bb21 (cleanup): {
resume;
}
}
diff --git a/tests/mir-opt/issue_99325.main.built.after.64bit.mir b/tests/mir-opt/issue_99325.main.built.after.64bit.mir
new file mode 100644
index 000000000..132b71335
--- /dev/null
+++ b/tests/mir-opt/issue_99325.main.built.after.64bit.mir
@@ -0,0 +1,276 @@
+// MIR for `main` after built
+
+| User Type Annotations
+| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [&*b"AAAA"], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:12:16: 12: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), UserArgs { args: [UnevaluatedConst { def: DefId(0:8 ~ issue_99325[22bb]::main::{constant#1}), args: [] }: &ReStatic [u8; 4_usize]], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:13:16: 13:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
+|
+fn main() -> () {
+ let mut _0: ();
+ let _1: ();
+ let mut _2: (&&[u8], &&[u8; 4]);
+ let mut _3: &&[u8];
+ let _4: &[u8];
+ let mut _5: &&[u8; 4];
+ let _6: &[u8; 4];
+ let _7: [u8; 4];
+ let _8: &&[u8];
+ let _9: &&[u8; 4];
+ let mut _10: bool;
+ let mut _11: &&[u8];
+ let mut _12: &&[u8; 4];
+ let mut _13: !;
+ let _15: !;
+ let mut _16: core::panicking::AssertKind;
+ let mut _17: &&[u8];
+ let _18: &&[u8];
+ let mut _19: &&[u8; 4];
+ let _20: &&[u8; 4];
+ let mut _21: std::option::Option<std::fmt::Arguments<'_>>;
+ let _22: ();
+ let mut _23: (&&[u8], &&[u8; 4]);
+ let mut _24: &&[u8];
+ let _25: &[u8];
+ let mut _26: &&[u8; 4];
+ let _27: &[u8; 4];
+ let _28: &&[u8];
+ let _29: &&[u8; 4];
+ let mut _30: bool;
+ let mut _31: &&[u8];
+ let mut _32: &&[u8; 4];
+ let mut _33: !;
+ let _35: !;
+ let mut _36: core::panicking::AssertKind;
+ let mut _37: &&[u8];
+ let _38: &&[u8];
+ let mut _39: &&[u8; 4];
+ let _40: &&[u8; 4];
+ let mut _41: std::option::Option<std::fmt::Arguments<'_>>;
+ scope 1 {
+ debug left_val => _8;
+ debug right_val => _9;
+ let _14: core::panicking::AssertKind;
+ scope 2 {
+ debug kind => _14;
+ }
+ }
+ scope 3 {
+ debug left_val => _28;
+ debug right_val => _29;
+ let _34: core::panicking::AssertKind;
+ scope 4 {
+ debug kind => _34;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = function_with_bytes::<&*b"AAAA">() -> [return: bb1, unwind: bb21];
+ }
+
+ bb1: {
+ _3 = &_4;
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = [const 65_u8, const 65_u8, const 65_u8, const 65_u8];
+ _6 = &_7;
+ _5 = &_6;
+ _2 = (move _3, move _5);
+ StorageDead(_5);
+ StorageDead(_3);
+ FakeRead(ForMatchedPlace(None), _2);
+ StorageLive(_8);
+ _8 = (_2.0: &&[u8]);
+ StorageLive(_9);
+ _9 = (_2.1: &&[u8; 4]);
+ StorageLive(_10);
+ StorageLive(_11);
+ _11 = &(*_8);
+ StorageLive(_12);
+ _12 = &(*_9);
+ _10 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _11, move _12) -> [return: bb2, unwind: bb21];
+ }
+
+ bb2: {
+ switchInt(move _10) -> [0: bb4, otherwise: bb3];
+ }
+
+ bb3: {
+ StorageDead(_12);
+ StorageDead(_11);
+ goto -> bb8;
+ }
+
+ bb4: {
+ goto -> bb5;
+ }
+
+ bb5: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageLive(_14);
+ _14 = core::panicking::AssertKind::Eq;
+ FakeRead(ForLet(None), _14);
+ StorageLive(_15);
+ StorageLive(_16);
+ _16 = move _14;
+ StorageLive(_17);
+ StorageLive(_18);
+ _18 = &(*_8);
+ _17 = &(*_18);
+ StorageLive(_19);
+ StorageLive(_20);
+ _20 = &(*_9);
+ _19 = &(*_20);
+ StorageLive(_21);
+ _21 = Option::<Arguments<'_>>::None;
+ _15 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _16, move _17, move _19, move _21) -> bb21;
+ }
+
+ bb6: {
+ StorageDead(_21);
+ StorageDead(_19);
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageDead(_20);
+ StorageDead(_18);
+ StorageDead(_15);
+ StorageDead(_14);
+ unreachable;
+ }
+
+ bb7: {
+ goto -> bb9;
+ }
+
+ bb8: {
+ _1 = const ();
+ goto -> bb9;
+ }
+
+ bb9: {
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageDead(_8);
+ goto -> bb10;
+ }
+
+ bb10: {
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageDead(_1);
+ StorageLive(_22);
+ StorageLive(_23);
+ StorageLive(_24);
+ StorageLive(_25);
+ _25 = function_with_bytes::<&*b"AAAA">() -> [return: bb11, unwind: bb21];
+ }
+
+ bb11: {
+ _24 = &_25;
+ StorageLive(_26);
+ StorageLive(_27);
+ _27 = const b"AAAA";
+ _26 = &_27;
+ _23 = (move _24, move _26);
+ StorageDead(_26);
+ StorageDead(_24);
+ FakeRead(ForMatchedPlace(None), _23);
+ StorageLive(_28);
+ _28 = (_23.0: &&[u8]);
+ StorageLive(_29);
+ _29 = (_23.1: &&[u8; 4]);
+ StorageLive(_30);
+ StorageLive(_31);
+ _31 = &(*_28);
+ StorageLive(_32);
+ _32 = &(*_29);
+ _30 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _31, move _32) -> [return: bb12, unwind: bb21];
+ }
+
+ bb12: {
+ switchInt(move _30) -> [0: bb14, otherwise: bb13];
+ }
+
+ bb13: {
+ StorageDead(_32);
+ StorageDead(_31);
+ goto -> bb18;
+ }
+
+ bb14: {
+ goto -> bb15;
+ }
+
+ bb15: {
+ StorageDead(_32);
+ StorageDead(_31);
+ StorageLive(_34);
+ _34 = core::panicking::AssertKind::Eq;
+ FakeRead(ForLet(None), _34);
+ StorageLive(_35);
+ StorageLive(_36);
+ _36 = move _34;
+ StorageLive(_37);
+ StorageLive(_38);
+ _38 = &(*_28);
+ _37 = &(*_38);
+ StorageLive(_39);
+ StorageLive(_40);
+ _40 = &(*_29);
+ _39 = &(*_40);
+ StorageLive(_41);
+ _41 = Option::<Arguments<'_>>::None;
+ _35 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _36, move _37, move _39, move _41) -> bb21;
+ }
+
+ bb16: {
+ StorageDead(_41);
+ StorageDead(_39);
+ StorageDead(_37);
+ StorageDead(_36);
+ StorageDead(_40);
+ StorageDead(_38);
+ StorageDead(_35);
+ StorageDead(_34);
+ unreachable;
+ }
+
+ bb17: {
+ goto -> bb19;
+ }
+
+ bb18: {
+ _22 = const ();
+ goto -> bb19;
+ }
+
+ bb19: {
+ StorageDead(_30);
+ StorageDead(_29);
+ StorageDead(_28);
+ goto -> bb20;
+ }
+
+ bb20: {
+ StorageDead(_27);
+ StorageDead(_25);
+ StorageDead(_23);
+ StorageDead(_22);
+ _0 = const ();
+ return;
+ }
+
+ bb21 (cleanup): {
+ resume;
+ }
+}
+
+alloc4 (size: 4, align: 1) {
+ 41 41 41 41 │ AAAA
+}
diff --git a/tests/mir-opt/issue_99325.rs b/tests/mir-opt/issue_99325.rs
index fe819cddb..3603228a5 100644
--- a/tests/mir-opt/issue_99325.rs
+++ b/tests/mir-opt/issue_99325.rs
@@ -1,3 +1,5 @@
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+
#![feature(adt_const_params)]
#![allow(incomplete_features)]
diff --git a/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff b/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff
index 6174d5259..5242c5f6a 100644
--- a/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff
+++ b/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff
@@ -32,12 +32,12 @@
bb1: {
StorageDead(_6);
_3 = Lt(move _4, move _5);
- StorageDead(_5);
- StorageDead(_4);
switchInt(move _3) -> [0: bb4, otherwise: bb2];
}
bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
StorageLive(_8);
_8 = _1;
_9 = Len((*_2));
@@ -52,6 +52,8 @@
}
bb4: {
+ StorageDead(_5);
+ StorageDead(_4);
_0 = const 42_u8;
goto -> bb5;
}
diff --git a/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-unwind.diff
index 60c0772d8..a9e99933b 100644
--- a/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-unwind.diff
+++ b/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-unwind.diff
@@ -32,12 +32,12 @@
bb1: {
StorageDead(_6);
_3 = Lt(move _4, move _5);
- StorageDead(_5);
- StorageDead(_4);
switchInt(move _3) -> [0: bb4, otherwise: bb2];
}
bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
StorageLive(_8);
_8 = _1;
_9 = Len((*_2));
@@ -52,6 +52,8 @@
}
bb4: {
+ StorageDead(_5);
+ StorageDead(_4);
_0 = const 42_u8;
goto -> bb5;
}
diff --git a/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-abort.diff b/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-abort.diff
index e2de18452..7749ba6be 100644
--- a/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-abort.diff
+++ b/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-abort.diff
@@ -35,12 +35,12 @@
bb1: {
StorageDead(_6);
_3 = Lt(move _4, move _5);
- StorageDead(_5);
- StorageDead(_4);
switchInt(move _3) -> [0: bb4, otherwise: bb2];
}
bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
StorageLive(_8);
_8 = _1;
_9 = Len((*_2));
@@ -55,6 +55,8 @@
}
bb4: {
+ StorageDead(_5);
+ StorageDead(_4);
StorageLive(_11);
_11 = const 0_usize;
_12 = Len((*_2));
diff --git a/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff
index eb81e0eea..fcc2c1653 100644
--- a/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff
+++ b/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff
@@ -35,12 +35,12 @@
bb1: {
StorageDead(_6);
_3 = Lt(move _4, move _5);
- StorageDead(_5);
- StorageDead(_4);
switchInt(move _3) -> [0: bb4, otherwise: bb2];
}
bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
StorageLive(_8);
_8 = _1;
_9 = Len((*_2));
@@ -55,6 +55,8 @@
}
bb4: {
+ StorageDead(_5);
+ StorageDead(_4);
StorageLive(_11);
_11 = const 0_usize;
_12 = Len((*_2));
diff --git a/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-abort.diff
index 95a4a83d6..b2cf3cc1c 100644
--- a/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-abort.diff
+++ b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-abort.diff
@@ -12,6 +12,7 @@
StorageLive(_2);
_2 = &raw const (*_1);
- _0 = read_via_copy::<Never>(move _2) -> unwind unreachable;
++ _0 = (*_2);
+ unreachable;
}
}
diff --git a/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-unwind.diff
index 95a4a83d6..b2cf3cc1c 100644
--- a/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-unwind.diff
+++ b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-unwind.diff
@@ -12,6 +12,7 @@
StorageLive(_2);
_2 = &raw const (*_1);
- _0 = read_via_copy::<Never>(move _2) -> unwind unreachable;
++ _0 = (*_2);
+ unreachable;
}
}
diff --git a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff
index 70b33fb70..7f752ca0f 100644
--- a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff
+++ b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff
@@ -28,12 +28,12 @@
bb1: {
StorageDead(_6);
_3 = Lt(move _4, move _5);
- StorageDead(_5);
- StorageDead(_4);
switchInt(move _3) -> [0: bb4, otherwise: bb2];
}
bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
StorageLive(_7);
_7 = _1;
_8 = Len((*_2));
@@ -48,6 +48,8 @@
}
bb4: {
+ StorageDead(_5);
+ StorageDead(_4);
_0 = const 42_u8;
goto -> bb5;
}
diff --git a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff
index 310b3b26a..d73b563a0 100644
--- a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff
+++ b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff
@@ -28,12 +28,12 @@
bb1: {
StorageDead(_6);
_3 = Lt(move _4, move _5);
- StorageDead(_5);
- StorageDead(_4);
switchInt(move _3) -> [0: bb4, otherwise: bb2];
}
bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
StorageLive(_7);
_7 = _1;
_8 = Len((*_2));
@@ -48,6 +48,8 @@
}
bb4: {
+ StorageDead(_5);
+ StorageDead(_4);
_0 = const 42_u8;
goto -> bb5;
}
diff --git a/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff
index be09ed641..137688ff6 100644
--- a/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff
+++ b/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff
@@ -80,8 +80,8 @@
_6 = &(_2.1: bool);
StorageLive(_8);
_8 = &(_2.2: std::string::String);
-- _3 = &shallow (_2.0: bool);
-- _4 = &shallow (_2.1: bool);
+- _3 = &fake (_2.0: bool);
+- _4 = &fake (_2.1: bool);
StorageLive(_9);
StorageLive(_10);
_10 = _1;
@@ -137,8 +137,8 @@
_6 = &(_2.0: bool);
StorageLive(_8);
_8 = &(_2.2: std::string::String);
-- _3 = &shallow (_2.0: bool);
-- _4 = &shallow (_2.1: bool);
+- _3 = &fake (_2.0: bool);
+- _4 = &fake (_2.1: bool);
StorageLive(_12);
StorageLive(_13);
_13 = _1;
@@ -243,7 +243,7 @@
}
- bb25 (cleanup): {
-- drop(_2) -> [return: bb26, unwind terminate];
+- drop(_2) -> [return: bb26, unwind terminate(cleanup)];
+ bb22 (cleanup): {
+ goto -> bb27;
}
diff --git a/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff
index be09ed641..137688ff6 100644
--- a/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff
+++ b/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff
@@ -80,8 +80,8 @@
_6 = &(_2.1: bool);
StorageLive(_8);
_8 = &(_2.2: std::string::String);
-- _3 = &shallow (_2.0: bool);
-- _4 = &shallow (_2.1: bool);
+- _3 = &fake (_2.0: bool);
+- _4 = &fake (_2.1: bool);
StorageLive(_9);
StorageLive(_10);
_10 = _1;
@@ -137,8 +137,8 @@
_6 = &(_2.0: bool);
StorageLive(_8);
_8 = &(_2.2: std::string::String);
-- _3 = &shallow (_2.0: bool);
-- _4 = &shallow (_2.1: bool);
+- _3 = &fake (_2.0: bool);
+- _4 = &fake (_2.1: bool);
StorageLive(_12);
StorageLive(_13);
_13 = _1;
@@ -243,7 +243,7 @@
}
- bb25 (cleanup): {
-- drop(_2) -> [return: bb26, unwind terminate];
+- drop(_2) -> [return: bb26, unwind terminate(cleanup)];
+ bb22 (cleanup): {
+ goto -> bb27;
}
diff --git a/tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir b/tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir
index 7f8eb82c7..8764236bf 100644
--- a/tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir
+++ b/tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir
@@ -68,7 +68,7 @@ fn main() -> () {
}
bb9: {
- _8 = &shallow _1;
+ _8 = &fake _1;
StorageLive(_9);
_9 = _2;
switchInt(move _9) -> [0: bb11, otherwise: bb10];
diff --git a/tests/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff b/tests/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff
index b5edbfee0..5a71bef93 100644
--- a/tests/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff
+++ b/tests/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff
@@ -40,39 +40,43 @@
- }
-
- bb3: {
+- switchInt(move _5) -> [0: bb5, otherwise: bb4];
+- }
+-
+- bb4: {
+ StorageLive(_7);
+ _7 = move _6;
+ _5 = Ne(_7, const false);
+ StorageDead(_7);
++ StorageLive(_8);
++ _8 = move _5;
StorageDead(_6);
-- switchInt(move _5) -> [0: bb5, otherwise: bb4];
-- }
--
-- bb4: {
- _4 = const true;
- goto -> bb6;
- }
-
- bb5: {
+- StorageDead(_6);
- _4 = const false;
- goto -> bb6;
- }
-
- bb6: {
-+ StorageLive(_8);
-+ _8 = move _5;
-+ _4 = Ne(_8, const false);
-+ StorageDead(_8);
- StorageDead(_5);
- switchInt(move _4) -> [0: bb8, otherwise: bb7];
- }
-
- bb7: {
++ _4 = Ne(_8, const false);
++ StorageDead(_8);
++ StorageLive(_9);
++ _9 = move _4;
+ StorageDead(_5);
- _3 = const true;
- goto -> bb9;
- }
-
- bb8: {
+- StorageDead(_5);
- _3 = const false;
- goto -> bb9;
- }
@@ -82,8 +86,6 @@
- }
-
- bb10: {
-+ StorageLive(_9);
-+ _9 = move _4;
+ _3 = Ne(_9, const false);
+ StorageDead(_9);
+ StorageLive(_10);
diff --git a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir
index 56b0f8165..c581d0f84 100644
--- a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir
+++ b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir
@@ -22,7 +22,7 @@
|
fn main() -> () {
let mut _0: ();
- let mut _1: [usize; Const { ty: usize, kind: Leaf(0x00000003) }];
+ let mut _1: [usize; ValTree(Leaf(0x00000003): usize)];
let _3: usize;
let mut _4: usize;
let mut _5: bool;
diff --git a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir
index 83b851eed..48243e34d 100644
--- a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir
+++ b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir
@@ -22,7 +22,7 @@
|
fn main() -> () {
let mut _0: ();
- let mut _1: [usize; Const { ty: usize, kind: Leaf(0x0000000000000003) }];
+ let mut _1: [usize; ValTree(Leaf(0x0000000000000003): usize)];
let _3: usize;
let mut _4: usize;
let mut _5: bool;
diff --git a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir
index e22fc7d54..99a7a6b61 100644
--- a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir
+++ b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir
@@ -31,7 +31,7 @@ fn main() -> () {
}
bb3 (cleanup): {
- drop(_2) -> [return: bb4, unwind terminate];
+ drop(_2) -> [return: bb4, unwind terminate(cleanup)];
}
bb4 (cleanup): {
diff --git a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir
index 6fb107929..7364b329e 100644
--- a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir
+++ b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir
@@ -31,7 +31,7 @@ fn main() -> () {
}
bb3 (cleanup): {
- drop(_2) -> [return: bb4, unwind terminate];
+ drop(_2) -> [return: bb4, unwind terminate(cleanup)];
}
bb4 (cleanup): {
diff --git a/tests/mir-opt/not_equal_false.opt.InstSimplify.diff b/tests/mir-opt/not_equal_false.opt.InstSimplify.diff
index 71353be24..1342966aa 100644
--- a/tests/mir-opt/not_equal_false.opt.InstSimplify.diff
+++ b/tests/mir-opt/not_equal_false.opt.InstSimplify.diff
@@ -13,16 +13,17 @@
_3 = _1;
- _2 = Ne(move _3, const false);
+ _2 = move _3;
- StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
+ StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
+ StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}
diff --git a/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
index bc0479002..0ef191804 100644
--- a/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
+++ b/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
@@ -33,7 +33,7 @@ fn main() -> () {
bb1 (cleanup): {
(_1.0: Aligned) = move _4;
- drop(_1) -> [return: bb3, unwind terminate];
+ drop(_1) -> [return: bb3, unwind terminate(cleanup)];
}
bb2: {
diff --git a/tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir
index c7fd397fc..838e30fa3 100644
--- a/tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir
@@ -7,130 +7,111 @@ fn naive(_1: &Blueprint, _2: &Blueprint) -> bool {
let mut _3: u32;
let mut _4: u32;
let mut _5: bool;
- let mut _6: bool;
+ let mut _6: u32;
let mut _7: u32;
- let mut _8: u32;
- let mut _9: bool;
- let mut _10: bool;
- let mut _11: u32;
+ let mut _8: bool;
+ let mut _9: u32;
+ let mut _10: u32;
+ let mut _11: bool;
let mut _12: u32;
- let mut _13: bool;
+ let mut _13: u32;
let mut _14: bool;
let mut _15: u32;
let mut _16: u32;
- let mut _17: bool;
- let mut _18: u32;
- let mut _19: u32;
- let mut _20: bool;
bb0: {
- StorageLive(_14);
- StorageLive(_10);
- StorageLive(_6);
StorageLive(_5);
StorageLive(_3);
_3 = ((*_1).0: u32);
StorageLive(_4);
_4 = ((*_2).0: u32);
_5 = Eq(move _3, move _4);
- StorageDead(_4);
- StorageDead(_3);
switchInt(move _5) -> [0: bb1, otherwise: bb2];
}
bb1: {
- _6 = const false;
- goto -> bb3;
+ StorageDead(_4);
+ StorageDead(_3);
+ goto -> bb8;
}
bb2: {
- StorageLive(_9);
- StorageLive(_7);
- _7 = ((*_1).1: u32);
+ StorageDead(_4);
+ StorageDead(_3);
StorageLive(_8);
- _8 = ((*_2).1: u32);
- _9 = Eq(move _7, move _8);
- StorageDead(_8);
- StorageDead(_7);
- _6 = move _9;
- goto -> bb3;
+ StorageLive(_6);
+ _6 = ((*_1).1: u32);
+ StorageLive(_7);
+ _7 = ((*_2).1: u32);
+ _8 = Eq(move _6, move _7);
+ switchInt(move _8) -> [0: bb3, otherwise: bb4];
}
bb3: {
- StorageDead(_9);
- StorageDead(_5);
- switchInt(move _6) -> [0: bb4, otherwise: bb5];
+ StorageDead(_7);
+ StorageDead(_6);
+ goto -> bb8;
}
bb4: {
- _10 = const false;
- goto -> bb6;
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageLive(_11);
+ StorageLive(_9);
+ _9 = ((*_1).2: u32);
+ StorageLive(_10);
+ _10 = ((*_2).2: u32);
+ _11 = Eq(move _9, move _10);
+ switchInt(move _11) -> [0: bb5, otherwise: bb6];
}
bb5: {
- StorageLive(_13);
- StorageLive(_11);
- _11 = ((*_1).2: u32);
- StorageLive(_12);
- _12 = ((*_2).2: u32);
- _13 = Eq(move _11, move _12);
- StorageDead(_12);
- StorageDead(_11);
- _10 = move _13;
- goto -> bb6;
+ StorageDead(_10);
+ StorageDead(_9);
+ goto -> bb8;
}
bb6: {
- StorageDead(_13);
- StorageDead(_6);
- switchInt(move _10) -> [0: bb7, otherwise: bb8];
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageLive(_14);
+ StorageLive(_12);
+ _12 = ((*_1).3: u32);
+ StorageLive(_13);
+ _13 = ((*_2).3: u32);
+ _14 = Eq(move _12, move _13);
+ switchInt(move _14) -> [0: bb7, otherwise: bb9];
}
bb7: {
- _14 = const false;
- goto -> bb9;
+ StorageDead(_13);
+ StorageDead(_12);
+ goto -> bb8;
}
bb8: {
- StorageLive(_17);
+ _0 = const false;
+ goto -> bb10;
+ }
+
+ bb9: {
+ StorageDead(_13);
+ StorageDead(_12);
StorageLive(_15);
- _15 = ((*_1).3: u32);
+ _15 = ((*_1).4: u32);
StorageLive(_16);
- _16 = ((*_2).3: u32);
- _17 = Eq(move _15, move _16);
+ _16 = ((*_2).4: u32);
+ _0 = Eq(move _15, move _16);
StorageDead(_16);
StorageDead(_15);
- _14 = move _17;
- goto -> bb9;
- }
-
- bb9: {
- StorageDead(_17);
- StorageDead(_10);
- switchInt(move _14) -> [0: bb10, otherwise: bb11];
+ goto -> bb10;
}
bb10: {
- _0 = const false;
- goto -> bb12;
- }
-
- bb11: {
- StorageLive(_20);
- StorageLive(_18);
- _18 = ((*_1).4: u32);
- StorageLive(_19);
- _19 = ((*_2).4: u32);
- _20 = Eq(move _18, move _19);
- StorageDead(_19);
- StorageDead(_18);
- _0 = move _20;
- goto -> bb12;
- }
-
- bb12: {
- StorageDead(_20);
StorageDead(_14);
+ StorageDead(_11);
+ StorageDead(_8);
+ StorageDead(_5);
return;
}
}
diff --git a/tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir
index 1e619bc97..8452fa12f 100644
--- a/tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir
@@ -27,12 +27,12 @@ fn returning(_1: &Blueprint, _2: &Blueprint) -> bool {
StorageLive(_4);
_4 = ((*_2).0: u32);
_5 = Ne(move _3, move _4);
- StorageDead(_4);
- StorageDead(_3);
switchInt(move _5) -> [0: bb1, otherwise: bb10];
}
bb1: {
+ StorageDead(_4);
+ StorageDead(_3);
StorageDead(_5);
StorageLive(_8);
StorageLive(_6);
@@ -40,12 +40,12 @@ fn returning(_1: &Blueprint, _2: &Blueprint) -> bool {
StorageLive(_7);
_7 = ((*_2).1: u32);
_8 = Ne(move _6, move _7);
- StorageDead(_7);
- StorageDead(_6);
switchInt(move _8) -> [0: bb2, otherwise: bb9];
}
bb2: {
+ StorageDead(_7);
+ StorageDead(_6);
StorageDead(_8);
StorageLive(_11);
StorageLive(_9);
@@ -53,12 +53,12 @@ fn returning(_1: &Blueprint, _2: &Blueprint) -> bool {
StorageLive(_10);
_10 = ((*_2).2: u32);
_11 = Ne(move _9, move _10);
- StorageDead(_10);
- StorageDead(_9);
switchInt(move _11) -> [0: bb3, otherwise: bb8];
}
bb3: {
+ StorageDead(_10);
+ StorageDead(_9);
StorageDead(_11);
StorageLive(_14);
StorageLive(_12);
@@ -66,12 +66,12 @@ fn returning(_1: &Blueprint, _2: &Blueprint) -> bool {
StorageLive(_13);
_13 = ((*_2).3: u32);
_14 = Ne(move _12, move _13);
- StorageDead(_13);
- StorageDead(_12);
switchInt(move _14) -> [0: bb4, otherwise: bb7];
}
bb4: {
+ StorageDead(_13);
+ StorageDead(_12);
StorageDead(_14);
StorageLive(_17);
StorageLive(_15);
@@ -79,42 +79,52 @@ fn returning(_1: &Blueprint, _2: &Blueprint) -> bool {
StorageLive(_16);
_16 = ((*_2).4: u32);
_17 = Ne(move _15, move _16);
- StorageDead(_16);
- StorageDead(_15);
switchInt(move _17) -> [0: bb5, otherwise: bb6];
}
bb5: {
+ StorageDead(_16);
+ StorageDead(_15);
StorageDead(_17);
_0 = const true;
goto -> bb11;
}
bb6: {
+ StorageDead(_16);
+ StorageDead(_15);
_0 = const false;
StorageDead(_17);
goto -> bb11;
}
bb7: {
+ StorageDead(_13);
+ StorageDead(_12);
_0 = const false;
StorageDead(_14);
goto -> bb11;
}
bb8: {
+ StorageDead(_10);
+ StorageDead(_9);
_0 = const false;
StorageDead(_11);
goto -> bb11;
}
bb9: {
+ StorageDead(_7);
+ StorageDead(_6);
_0 = const false;
StorageDead(_8);
goto -> bb11;
}
bb10: {
+ StorageDead(_4);
+ StorageDead(_3);
_0 = const false;
StorageDead(_5);
goto -> bb11;
diff --git a/tests/mir-opt/pre-codegen/chained_comparison.rs b/tests/mir-opt/pre-codegen/chained_comparison.rs
index f7879140f..430300419 100644
--- a/tests/mir-opt/pre-codegen/chained_comparison.rs
+++ b/tests/mir-opt/pre-codegen/chained_comparison.rs
@@ -1,5 +1,4 @@
// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
-// ignore-debug
#![crate_type = "lib"]
diff --git a/tests/mir-opt/pre-codegen/checked_ops.rs b/tests/mir-opt/pre-codegen/checked_ops.rs
index dee43b0c6..23d78e987 100644
--- a/tests/mir-opt/pre-codegen/checked_ops.rs
+++ b/tests/mir-opt/pre-codegen/checked_ops.rs
@@ -1,6 +1,5 @@
// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
// needs-unwind
-// ignore-debug
// only-x86_64
#![crate_type = "lib"]
diff --git a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir
index b2ea96f03..75f81c5aa 100644
--- a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir
@@ -40,16 +40,22 @@ fn step_forward(_1: u32, _2: usize) -> u32 {
_5 = Eq(_4, const 1_isize);
_6 = Not(move _5);
StorageDead(_5);
- StorageDead(_3);
- StorageDead(_8);
- switchInt(move _6) -> [0: bb3, otherwise: bb2];
+ switchInt(move _6) -> [0: bb2, otherwise: bb3];
}
bb2: {
- assert(!const true, "attempt to compute `{} + {}`, which would overflow", const _, const 1_u32) -> [success: bb3, unwind continue];
+ StorageDead(_3);
+ StorageDead(_8);
+ goto -> bb4;
}
bb3: {
+ StorageDead(_3);
+ StorageDead(_8);
+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const _, const 1_u32) -> [success: bb4, unwind continue];
+ }
+
+ bb4: {
StorageDead(_6);
StorageLive(_7);
_7 = _2 as u32 (IntToInt);
diff --git a/tests/mir-opt/pre-codegen/intrinsics.rs b/tests/mir-opt/pre-codegen/intrinsics.rs
index ecdb656cb..e32e04384 100644
--- a/tests/mir-opt/pre-codegen/intrinsics.rs
+++ b/tests/mir-opt/pre-codegen/intrinsics.rs
@@ -1,6 +1,5 @@
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
-// ignore-debug
// Checks that we do not have any branches in the MIR for the two tested functions.
diff --git a/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir
index 940b9ae11..4db829a5e 100644
--- a/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir
@@ -83,7 +83,7 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> ()
}
bb9 (cleanup): {
- drop(_5) -> [return: bb10, unwind terminate];
+ drop(_5) -> [return: bb10, unwind terminate(cleanup)];
}
bb10 (cleanup): {
diff --git a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir
index 2e51faeba..0d79f2de1 100644
--- a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir
@@ -63,17 +63,19 @@ fn int_range(_1: usize, _2: usize) -> () {
_7 = Lt(move _5, move _6);
StorageDead(_6);
StorageDead(_5);
- StorageDead(_16);
- StorageDead(_15);
switchInt(move _7) -> [0: bb2, otherwise: bb3];
}
bb2: {
+ StorageDead(_16);
+ StorageDead(_15);
_8 = Option::<usize>::None;
goto -> bb5;
}
bb3: {
+ StorageDead(_16);
+ StorageDead(_15);
_9 = (_4.0: usize);
StorageLive(_10);
_10 = <usize as Step>::forward_unchecked(_9, const 1_usize) -> [return: bb4, unwind continue];
diff --git a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir
index 261416036..c30df7425 100644
--- a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir
@@ -75,7 +75,7 @@ fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () {
}
bb9 (cleanup): {
- drop(_5) -> [return: bb10, unwind terminate];
+ drop(_5) -> [return: bb10, unwind terminate(cleanup)];
}
bb10 (cleanup): {
diff --git a/tests/mir-opt/pre-codegen/loops.rs b/tests/mir-opt/pre-codegen/loops.rs
index 67f549a51..f3ba40922 100644
--- a/tests/mir-opt/pre-codegen/loops.rs
+++ b/tests/mir-opt/pre-codegen/loops.rs
@@ -1,6 +1,5 @@
// compile-flags: -O -Zmir-opt-level=2 -g
// needs-unwind
-// ignore-debug
#![crate_type = "lib"]
diff --git a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir
index 8eff46fb9..cb29473d7 100644
--- a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir
@@ -67,7 +67,7 @@ fn vec_move(_1: Vec<impl Sized>) -> () {
}
bb9 (cleanup): {
- drop(_3) -> [return: bb10, unwind terminate];
+ drop(_3) -> [return: bb10, unwind terminate(cleanup)];
}
bb10 (cleanup): {
diff --git a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir
index 26919dd98..630babaa8 100644
--- a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir
@@ -10,23 +10,53 @@ fn mem_replace(_1: &mut u32, _2: u32) -> u32 {
scope 2 {
scope 3 {
debug result => _0;
- scope 6 (inlined std::ptr::write::<u32>) {
+ scope 16 (inlined std::ptr::write::<u32>) {
debug dst => _1;
debug src => _2;
- scope 7 {
+ scope 17 {
}
}
}
scope 4 (inlined std::ptr::read::<u32>) {
debug src => _1;
scope 5 {
+ scope 6 (inlined std::ptr::read::runtime::<u32>) {
+ debug src => _1;
+ scope 7 (inlined intrinsics::is_aligned_and_not_null::<u32>) {
+ debug ptr => _1;
+ scope 8 (inlined ptr::const_ptr::<impl *const u32>::is_null) {
+ debug self => _1;
+ let mut _3: *const u8;
+ scope 9 {
+ scope 10 (inlined ptr::const_ptr::<impl *const T>::is_null::runtime_impl) {
+ debug ptr => _3;
+ scope 11 (inlined ptr::const_ptr::<impl *const u8>::addr) {
+ debug self => _3;
+ scope 12 {
+ scope 13 (inlined ptr::const_ptr::<impl *const u8>::cast::<()>) {
+ debug self => _3;
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 14 (inlined ptr::const_ptr::<impl *const u32>::is_aligned) {
+ debug self => _1;
+ scope 15 (inlined align_of::<u32>) {
+ }
+ }
+ }
+ }
}
}
}
}
bb0: {
+ StorageLive(_3);
_0 = (*_1);
+ StorageDead(_3);
(*_1) = _2;
return;
}
diff --git a/tests/mir-opt/pre-codegen/mem_replace.rs b/tests/mir-opt/pre-codegen/mem_replace.rs
index e5066c38b..a139848ba 100644
--- a/tests/mir-opt/pre-codegen/mem_replace.rs
+++ b/tests/mir-opt/pre-codegen/mem_replace.rs
@@ -1,6 +1,6 @@
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
-// ignore-debug
+// ignore-debug the standard library debug assertions leak into this test
#![crate_type = "lib"]
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff
index 2c607b4c0..681e9666e 100644
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff
@@ -55,5 +55,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc5 (size: 8, align: 4) {
++ 04 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff
index b6929f3f9..db16b8d82 100644
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff
@@ -55,5 +55,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc5 (size: 8, align: 4) {
++ 04 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff
index 2c607b4c0..681e9666e 100644
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff
@@ -55,5 +55,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc5 (size: 8, align: 4) {
++ 04 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff
index b6929f3f9..db16b8d82 100644
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff
@@ -55,5 +55,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc5 (size: 8, align: 4) {
++ 04 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir
index d76b46bdd..9664ccfb0 100644
--- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir
@@ -66,17 +66,19 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
_8 = Lt(move _6, move _7);
StorageDead(_7);
StorageDead(_6);
- StorageDead(_19);
- StorageDead(_18);
switchInt(move _8) -> [0: bb2, otherwise: bb3];
}
bb2: {
+ StorageDead(_19);
+ StorageDead(_18);
_9 = Option::<u32>::None;
goto -> bb5;
}
bb3: {
+ StorageDead(_19);
+ StorageDead(_18);
_10 = (_5.0: u32);
StorageLive(_11);
_11 = <u32 as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind unreachable];
diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir
index 4d7c017da..dc8b46b6c 100644
--- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir
@@ -66,17 +66,19 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
_8 = Lt(move _6, move _7);
StorageDead(_7);
StorageDead(_6);
- StorageDead(_19);
- StorageDead(_18);
switchInt(move _8) -> [0: bb2, otherwise: bb3];
}
bb2: {
+ StorageDead(_19);
+ StorageDead(_18);
_9 = Option::<u32>::None;
goto -> bb5;
}
bb3: {
+ StorageDead(_19);
+ StorageDead(_18);
_10 = (_5.0: u32);
StorageLive(_11);
_11 = <u32 as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind: bb11];
@@ -127,7 +129,7 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
}
bb11 (cleanup): {
- drop(_3) -> [return: bb12, unwind terminate];
+ drop(_3) -> [return: bb12, unwind terminate(cleanup)];
}
bb12 (cleanup): {
diff --git a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir
index bbab4e47a..a677e8b43 100644
--- a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir
@@ -82,7 +82,7 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
}
bb8 (cleanup): {
- drop(_3) -> [return: bb9, unwind terminate];
+ drop(_3) -> [return: bb9, unwind terminate(cleanup)];
}
bb9 (cleanup): {
diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir
index 7360aa3e6..fff713b5a 100644
--- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir
@@ -38,17 +38,19 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> {
_4 = Lt(move _2, move _3);
StorageDead(_3);
StorageDead(_2);
- StorageDead(_8);
- StorageDead(_7);
switchInt(move _4) -> [0: bb1, otherwise: bb2];
}
bb1: {
+ StorageDead(_8);
+ StorageDead(_7);
_0 = Option::<u32>::None;
goto -> bb4;
}
bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
_5 = ((*_1).0: u32);
StorageLive(_6);
_6 = <u32 as Step>::forward_unchecked(_5, const 1_usize) -> [return: bb3, unwind unreachable];
diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir
index 61957082d..cc12c0122 100644
--- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir
@@ -38,17 +38,19 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> {
_4 = Lt(move _2, move _3);
StorageDead(_3);
StorageDead(_2);
- StorageDead(_8);
- StorageDead(_7);
switchInt(move _4) -> [0: bb1, otherwise: bb2];
}
bb1: {
+ StorageDead(_8);
+ StorageDead(_7);
_0 = Option::<u32>::None;
goto -> bb4;
}
bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
_5 = ((*_1).0: u32);
StorageLive(_6);
_6 = <u32 as Step>::forward_unchecked(_5, const 1_usize) -> [return: bb3, unwind continue];
diff --git a/tests/mir-opt/pre-codegen/range_iter.rs b/tests/mir-opt/pre-codegen/range_iter.rs
index cabd9419e..955214478 100644
--- a/tests/mir-opt/pre-codegen/range_iter.rs
+++ b/tests/mir-opt/pre-codegen/range_iter.rs
@@ -1,6 +1,5 @@
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
-// ignore-debug
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![crate_type = "lib"]
diff --git a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir
index 68d78f743..48b780aea 100644
--- a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir
@@ -3,9 +3,9 @@
fn ezmap(_1: Option<i32>) -> Option<i32> {
debug x => _1;
let mut _0: std::option::Option<i32>;
- scope 1 (inlined map::<i32, i32, [closure@$DIR/simple_option_map.rs:18:12: 18:15]>) {
+ scope 1 (inlined map::<i32, i32, {closure@$DIR/simple_option_map.rs:17:12: 17:15}>) {
debug slf => _1;
- debug f => const ZeroSized: [closure@$DIR/simple_option_map.rs:18:12: 18:15];
+ debug f => const ZeroSized: {closure@$DIR/simple_option_map.rs:17:12: 17:15};
let mut _2: isize;
let _3: i32;
let mut _4: i32;
diff --git a/tests/mir-opt/pre-codegen/simple_option_map.rs b/tests/mir-opt/pre-codegen/simple_option_map.rs
index fb3da68e4..d4f28dda6 100644
--- a/tests/mir-opt/pre-codegen/simple_option_map.rs
+++ b/tests/mir-opt/pre-codegen/simple_option_map.rs
@@ -1,6 +1,5 @@
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
-// ignore-debug
#[inline(always)]
fn map<T, U, F>(slf: Option<T>, f: F) -> Option<U>
diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
index 1488779f9..ed286beb4 100644
--- a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
@@ -1,6 +1,6 @@
// MIR for `variant_a::{closure#0}` after PreCodegen
-fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2: &&(usize, usize, usize, usize)) -> bool {
+fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2: &&(usize, usize, usize, usize)) -> bool {
let mut _0: bool;
let mut _3: &(usize, usize, usize, usize);
let _4: &usize;
@@ -12,30 +12,27 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2
let _10: &usize;
let _11: &usize;
let mut _16: bool;
- let mut _17: bool;
- let _18: &usize;
- let mut _23: bool;
- let _24: &usize;
- let mut _29: bool;
- let mut _30: bool;
- let _31: &usize;
- let mut _36: bool;
+ let _17: &usize;
+ let mut _22: bool;
+ let _23: &usize;
+ let mut _28: bool;
+ let _29: &usize;
+ let mut _34: &&usize;
+ let mut _35: &&usize;
+ let mut _36: &&usize;
let mut _37: &&usize;
let mut _38: &&usize;
let mut _39: &&usize;
let mut _40: &&usize;
let mut _41: &&usize;
- let mut _42: &&usize;
- let mut _43: &&usize;
- let mut _44: &&usize;
scope 1 {
debug a => _4;
debug b => _6;
debug c => _8;
debug d => _10;
scope 2 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
- debug self => _37;
- debug other => _38;
+ debug self => _34;
+ debug other => _35;
let mut _12: &usize;
let mut _13: &usize;
scope 3 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
@@ -46,39 +43,39 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2
}
}
scope 4 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
- debug self => _41;
- debug other => _42;
- let mut _25: &usize;
- let mut _26: &usize;
+ debug self => _36;
+ debug other => _37;
+ let mut _18: &usize;
+ let mut _19: &usize;
scope 5 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
- debug self => _25;
- debug other => _26;
- let mut _27: usize;
- let mut _28: usize;
+ debug self => _18;
+ debug other => _19;
+ let mut _20: usize;
+ let mut _21: usize;
}
}
scope 6 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
- debug self => _39;
- debug other => _40;
- let mut _19: &usize;
- let mut _20: &usize;
+ debug self => _38;
+ debug other => _39;
+ let mut _24: &usize;
+ let mut _25: &usize;
scope 7 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
- debug self => _19;
- debug other => _20;
- let mut _21: usize;
- let mut _22: usize;
+ debug self => _24;
+ debug other => _25;
+ let mut _26: usize;
+ let mut _27: usize;
}
}
scope 8 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
- debug self => _43;
- debug other => _44;
- let mut _32: &usize;
- let mut _33: &usize;
+ debug self => _40;
+ debug other => _41;
+ let mut _30: &usize;
+ let mut _31: &usize;
scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
- debug self => _32;
- debug other => _33;
- let mut _34: usize;
- let mut _35: usize;
+ debug self => _30;
+ debug other => _31;
+ let mut _32: usize;
+ let mut _33: usize;
}
}
}
@@ -96,10 +93,9 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2
StorageLive(_10);
_9 = deref_copy (*_2);
_10 = &((*_9).3: usize);
- StorageLive(_17);
StorageLive(_16);
- StorageLive(_37);
- StorageLive(_38);
+ StorageLive(_34);
+ StorageLive(_35);
StorageLive(_11);
_11 = _8;
_12 = deref_copy _4;
@@ -111,109 +107,109 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2
_16 = Le(move _14, move _15);
StorageDead(_15);
StorageDead(_14);
- StorageDead(_11);
- StorageDead(_38);
- StorageDead(_37);
switchInt(move _16) -> [0: bb1, otherwise: bb2];
}
bb1: {
- _17 = const false;
- goto -> bb3;
+ StorageDead(_11);
+ StorageDead(_35);
+ StorageDead(_34);
+ goto -> bb4;
}
bb2: {
- StorageLive(_23);
- StorageLive(_39);
- StorageLive(_40);
- StorageLive(_18);
- _18 = _6;
- _19 = deref_copy _10;
- _20 = deref_copy _18;
+ StorageDead(_11);
+ StorageDead(_35);
+ StorageDead(_34);
+ StorageLive(_22);
+ StorageLive(_36);
+ StorageLive(_37);
+ StorageLive(_17);
+ _17 = _6;
+ _18 = deref_copy _10;
+ _19 = deref_copy _17;
+ StorageLive(_20);
+ _20 = (*_18);
StorageLive(_21);
_21 = (*_19);
- StorageLive(_22);
- _22 = (*_20);
- _23 = Le(move _21, move _22);
- StorageDead(_22);
+ _22 = Le(move _20, move _21);
StorageDead(_21);
- StorageDead(_18);
- StorageDead(_40);
- StorageDead(_39);
- _17 = move _23;
- goto -> bb3;
+ StorageDead(_20);
+ switchInt(move _22) -> [0: bb3, otherwise: bb8];
}
bb3: {
- StorageDead(_23);
- StorageDead(_16);
- switchInt(move _17) -> [0: bb4, otherwise: bb8];
+ StorageDead(_17);
+ StorageDead(_37);
+ StorageDead(_36);
+ goto -> bb4;
}
bb4: {
- StorageLive(_30);
- StorageLive(_29);
- StorageLive(_41);
- StorageLive(_42);
- StorageLive(_24);
- _24 = _4;
- _25 = deref_copy _8;
- _26 = deref_copy _24;
+ StorageLive(_28);
+ StorageLive(_38);
+ StorageLive(_39);
+ StorageLive(_23);
+ _23 = _4;
+ _24 = deref_copy _8;
+ _25 = deref_copy _23;
+ StorageLive(_26);
+ _26 = (*_24);
StorageLive(_27);
_27 = (*_25);
- StorageLive(_28);
- _28 = (*_26);
- _29 = Le(move _27, move _28);
- StorageDead(_28);
+ _28 = Le(move _26, move _27);
StorageDead(_27);
- StorageDead(_24);
- StorageDead(_42);
- StorageDead(_41);
- switchInt(move _29) -> [0: bb5, otherwise: bb6];
+ StorageDead(_26);
+ switchInt(move _28) -> [0: bb5, otherwise: bb6];
}
bb5: {
- _30 = const false;
+ StorageDead(_23);
+ StorageDead(_39);
+ StorageDead(_38);
+ _0 = const false;
goto -> bb7;
}
bb6: {
- StorageLive(_36);
- StorageLive(_43);
- StorageLive(_44);
- StorageLive(_31);
- _31 = _10;
- _32 = deref_copy _6;
- _33 = deref_copy _31;
- StorageLive(_34);
- _34 = (*_32);
- StorageLive(_35);
- _35 = (*_33);
- _36 = Le(move _34, move _35);
- StorageDead(_35);
- StorageDead(_34);
- StorageDead(_31);
- StorageDead(_44);
- StorageDead(_43);
- _30 = move _36;
+ StorageDead(_23);
+ StorageDead(_39);
+ StorageDead(_38);
+ StorageLive(_40);
+ StorageLive(_41);
+ StorageLive(_29);
+ _29 = _10;
+ _30 = deref_copy _6;
+ _31 = deref_copy _29;
+ StorageLive(_32);
+ _32 = (*_30);
+ StorageLive(_33);
+ _33 = (*_31);
+ _0 = Le(move _32, move _33);
+ StorageDead(_33);
+ StorageDead(_32);
+ StorageDead(_29);
+ StorageDead(_41);
+ StorageDead(_40);
goto -> bb7;
}
bb7: {
- StorageDead(_36);
- StorageDead(_29);
- _0 = move _30;
+ StorageDead(_28);
goto -> bb9;
}
bb8: {
+ StorageDead(_17);
+ StorageDead(_37);
+ StorageDead(_36);
_0 = const true;
goto -> bb9;
}
bb9: {
- StorageDead(_30);
- StorageDead(_17);
+ StorageDead(_22);
+ StorageDead(_16);
StorageDead(_10);
StorageDead(_8);
StorageDead(_6);
diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir
index bab9f0b58..80c8cebff 100644
--- a/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir
@@ -1,6 +1,6 @@
// MIR for `variant_b::{closure#0}` after PreCodegen
-fn variant_b::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:11:25: 11:41], _2: &&(usize, usize, usize, usize)) -> bool {
+fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:11:25: 11:41}, _2: &&(usize, usize, usize, usize)) -> bool {
let mut _0: bool;
let mut _3: &(usize, usize, usize, usize);
let _4: usize;
@@ -13,9 +13,6 @@ fn variant_b::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:11:25: 11:41],
let mut _11: bool;
let mut _12: bool;
let mut _13: bool;
- let mut _14: bool;
- let mut _15: bool;
- let mut _16: bool;
scope 1 {
debug a => _4;
debug b => _6;
@@ -32,64 +29,46 @@ fn variant_b::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:11:25: 11:41],
_8 = ((*_7).2: usize);
_9 = deref_copy (*_2);
_10 = ((*_9).3: usize);
- StorageLive(_12);
StorageLive(_11);
_11 = Le(_4, _8);
- switchInt(move _11) -> [0: bb1, otherwise: bb2];
+ switchInt(move _11) -> [0: bb2, otherwise: bb1];
}
bb1: {
- _12 = const false;
- goto -> bb3;
+ StorageLive(_12);
+ _12 = Le(_10, _6);
+ switchInt(move _12) -> [0: bb2, otherwise: bb6];
}
bb2: {
StorageLive(_13);
- _13 = Le(_10, _6);
- _12 = move _13;
- goto -> bb3;
+ _13 = Le(_8, _4);
+ switchInt(move _13) -> [0: bb3, otherwise: bb4];
}
bb3: {
- StorageDead(_13);
- StorageDead(_11);
- switchInt(move _12) -> [0: bb4, otherwise: bb8];
+ _0 = const false;
+ goto -> bb5;
}
bb4: {
- StorageLive(_15);
- StorageLive(_14);
- _14 = Le(_8, _4);
- switchInt(move _14) -> [0: bb5, otherwise: bb6];
+ _0 = Le(_6, _10);
+ goto -> bb5;
}
bb5: {
- _15 = const false;
+ StorageDead(_13);
goto -> bb7;
}
bb6: {
- StorageLive(_16);
- _16 = Le(_6, _10);
- _15 = move _16;
+ _0 = const true;
goto -> bb7;
}
bb7: {
- StorageDead(_16);
- StorageDead(_14);
- _0 = move _15;
- goto -> bb9;
- }
-
- bb8: {
- _0 = const true;
- goto -> bb9;
- }
-
- bb9: {
- StorageDead(_15);
StorageDead(_12);
+ StorageDead(_11);
return;
}
}
diff --git a/tests/mir-opt/pre-codegen/slice_index.rs b/tests/mir-opt/pre-codegen/slice_index.rs
index d80bff50c..57ffb07e2 100644
--- a/tests/mir-opt/pre-codegen/slice_index.rs
+++ b/tests/mir-opt/pre-codegen/slice_index.rs
@@ -1,6 +1,6 @@
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
-// ignore-debug
+// ignore-debug the standard library debug assertions leak into this test
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![crate_type = "lib"]
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir
index 07a58309e..8590c9d3b 100644
--- a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir
@@ -58,16 +58,17 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> {
StorageLive(_3);
_3 = Len((*_1));
_4 = Lt(_2, move _3);
- StorageDead(_3);
switchInt(move _4) -> [0: bb1, otherwise: bb2];
}
bb1: {
+ StorageDead(_3);
_0 = const Option::<&mut u32>::None;
goto -> bb3;
}
bb2: {
+ StorageDead(_3);
StorageLive(_8);
StorageLive(_5);
_5 = &raw mut (*_1);
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir
index 07a58309e..8590c9d3b 100644
--- a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir
@@ -58,16 +58,17 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> {
StorageLive(_3);
_3 = Len((*_1));
_4 = Lt(_2, move _3);
- StorageDead(_3);
switchInt(move _4) -> [0: bb1, otherwise: bb2];
}
bb1: {
+ StorageDead(_3);
_0 = const Option::<&mut u32>::None;
goto -> bb3;
}
bb2: {
+ StorageDead(_3);
StorageLive(_8);
StorageLive(_5);
_5 = &raw mut (*_1);
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir
index 2f5d356a2..2fd669aee 100644
--- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir
@@ -8,46 +8,63 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
let mut _4: usize;
scope 1 (inlined core::slice::<impl [u32]>::get_unchecked_mut::<std::ops::Range<usize>>) {
debug self => _1;
- debug index => std::ops::Range<usize>{ .0 => _3, .1 => _4, };
+ debug ((index: std::ops::Range<usize>).0: usize) => _3;
+ debug ((index: std::ops::Range<usize>).1: usize) => _4;
let mut _5: *mut [u32];
let mut _13: *mut [u32];
scope 2 {
scope 3 (inlined <std::ops::Range<usize> as SliceIndex<[u32]>>::get_unchecked_mut) {
- debug self => std::ops::Range<usize>{ .0 => _3, .1 => _4, };
+ debug ((self: std::ops::Range<usize>).0: usize) => _3;
+ debug ((self: std::ops::Range<usize>).1: usize) => _4;
debug slice => _5;
let mut _7: *mut u32;
let mut _8: *mut u32;
- let _14: usize;
let _15: usize;
+ let _16: usize;
scope 4 {
- debug this => std::ops::Range<usize>{ .0 => _14, .1 => _15, };
+ debug ((this: std::ops::Range<usize>).0: usize) => _15;
+ debug ((this: std::ops::Range<usize>).1: usize) => _16;
scope 5 {
let _6: usize;
scope 6 {
debug new_len => _6;
- scope 7 (inlined ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) {
+ scope 11 (inlined ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) {
debug self => _5;
}
- scope 8 (inlined ptr::mut_ptr::<impl *mut u32>::add) {
+ scope 12 (inlined ptr::mut_ptr::<impl *mut u32>::add) {
debug self => _7;
debug count => _3;
- scope 9 {
+ scope 13 {
}
}
- scope 10 (inlined slice_from_raw_parts_mut::<u32>) {
+ scope 14 (inlined slice_from_raw_parts_mut::<u32>) {
debug data => _8;
debug len => _6;
let mut _9: *mut ();
- scope 11 (inlined ptr::mut_ptr::<impl *mut u32>::cast::<()>) {
+ scope 15 (inlined ptr::mut_ptr::<impl *mut u32>::cast::<()>) {
debug self => _8;
}
- scope 12 (inlined std::ptr::from_raw_parts_mut::<[u32]>) {
+ scope 16 (inlined std::ptr::from_raw_parts_mut::<[u32]>) {
debug data_address => _9;
debug metadata => _6;
let mut _10: *const ();
let mut _11: std::ptr::metadata::PtrComponents<[u32]>;
let mut _12: std::ptr::metadata::PtrRepr<[u32]>;
- scope 13 {
+ scope 17 {
+ }
+ }
+ }
+ }
+ scope 7 (inlined <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked_mut::runtime::<u32>) {
+ debug ((this: std::ops::Range<usize>).0: usize) => _15;
+ debug ((this: std::ops::Range<usize>).1: usize) => _16;
+ debug slice => _5;
+ scope 8 (inlined ptr::mut_ptr::<impl *mut [u32]>::len) {
+ debug self => _5;
+ let mut _14: *const [u32];
+ scope 9 (inlined std::ptr::metadata::<[u32]>) {
+ debug ptr => _14;
+ scope 10 {
}
}
}
@@ -63,9 +80,10 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
_4 = move (_2.1: usize);
StorageLive(_5);
_5 = &raw mut (*_1);
+ StorageLive(_6);
StorageLive(_14);
StorageLive(_15);
- StorageLive(_6);
+ StorageLive(_16);
_6 = SubUnchecked(_4, _3);
StorageLive(_8);
StorageLive(_7);
@@ -86,9 +104,10 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
StorageDead(_12);
StorageDead(_9);
StorageDead(_8);
- StorageDead(_6);
- StorageDead(_14);
+ StorageDead(_16);
StorageDead(_15);
+ StorageDead(_14);
+ StorageDead(_6);
StorageDead(_5);
_0 = &mut (*_13);
return;
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir
index 2f5d356a2..2fd669aee 100644
--- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir
@@ -8,46 +8,63 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
let mut _4: usize;
scope 1 (inlined core::slice::<impl [u32]>::get_unchecked_mut::<std::ops::Range<usize>>) {
debug self => _1;
- debug index => std::ops::Range<usize>{ .0 => _3, .1 => _4, };
+ debug ((index: std::ops::Range<usize>).0: usize) => _3;
+ debug ((index: std::ops::Range<usize>).1: usize) => _4;
let mut _5: *mut [u32];
let mut _13: *mut [u32];
scope 2 {
scope 3 (inlined <std::ops::Range<usize> as SliceIndex<[u32]>>::get_unchecked_mut) {
- debug self => std::ops::Range<usize>{ .0 => _3, .1 => _4, };
+ debug ((self: std::ops::Range<usize>).0: usize) => _3;
+ debug ((self: std::ops::Range<usize>).1: usize) => _4;
debug slice => _5;
let mut _7: *mut u32;
let mut _8: *mut u32;
- let _14: usize;
let _15: usize;
+ let _16: usize;
scope 4 {
- debug this => std::ops::Range<usize>{ .0 => _14, .1 => _15, };
+ debug ((this: std::ops::Range<usize>).0: usize) => _15;
+ debug ((this: std::ops::Range<usize>).1: usize) => _16;
scope 5 {
let _6: usize;
scope 6 {
debug new_len => _6;
- scope 7 (inlined ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) {
+ scope 11 (inlined ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) {
debug self => _5;
}
- scope 8 (inlined ptr::mut_ptr::<impl *mut u32>::add) {
+ scope 12 (inlined ptr::mut_ptr::<impl *mut u32>::add) {
debug self => _7;
debug count => _3;
- scope 9 {
+ scope 13 {
}
}
- scope 10 (inlined slice_from_raw_parts_mut::<u32>) {
+ scope 14 (inlined slice_from_raw_parts_mut::<u32>) {
debug data => _8;
debug len => _6;
let mut _9: *mut ();
- scope 11 (inlined ptr::mut_ptr::<impl *mut u32>::cast::<()>) {
+ scope 15 (inlined ptr::mut_ptr::<impl *mut u32>::cast::<()>) {
debug self => _8;
}
- scope 12 (inlined std::ptr::from_raw_parts_mut::<[u32]>) {
+ scope 16 (inlined std::ptr::from_raw_parts_mut::<[u32]>) {
debug data_address => _9;
debug metadata => _6;
let mut _10: *const ();
let mut _11: std::ptr::metadata::PtrComponents<[u32]>;
let mut _12: std::ptr::metadata::PtrRepr<[u32]>;
- scope 13 {
+ scope 17 {
+ }
+ }
+ }
+ }
+ scope 7 (inlined <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked_mut::runtime::<u32>) {
+ debug ((this: std::ops::Range<usize>).0: usize) => _15;
+ debug ((this: std::ops::Range<usize>).1: usize) => _16;
+ debug slice => _5;
+ scope 8 (inlined ptr::mut_ptr::<impl *mut [u32]>::len) {
+ debug self => _5;
+ let mut _14: *const [u32];
+ scope 9 (inlined std::ptr::metadata::<[u32]>) {
+ debug ptr => _14;
+ scope 10 {
}
}
}
@@ -63,9 +80,10 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
_4 = move (_2.1: usize);
StorageLive(_5);
_5 = &raw mut (*_1);
+ StorageLive(_6);
StorageLive(_14);
StorageLive(_15);
- StorageLive(_6);
+ StorageLive(_16);
_6 = SubUnchecked(_4, _3);
StorageLive(_8);
StorageLive(_7);
@@ -86,9 +104,10 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
StorageDead(_12);
StorageDead(_9);
StorageDead(_8);
- StorageDead(_6);
- StorageDead(_14);
+ StorageDead(_16);
StorageDead(_15);
+ StorageDead(_14);
+ StorageDead(_6);
StorageDead(_5);
_0 = &mut (*_13);
return;
diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir
index 836fa2677..3d76bab7c 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir
@@ -195,7 +195,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
bb11 (cleanup): {
- drop(_2) -> [return: bb12, unwind terminate];
+ drop(_2) -> [return: bb12, unwind terminate(cleanup)];
}
bb12 (cleanup): {
diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir
index 65baaf64a..e8586cec9 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir
@@ -182,7 +182,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
bb11 (cleanup): {
- drop(_2) -> [return: bb12, unwind terminate];
+ drop(_2) -> [return: bb12, unwind terminate(cleanup)];
}
bb12 (cleanup): {
diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir
index 4edf4b4fb..4afe2eda1 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir
@@ -75,17 +75,19 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
_8 = Lt(move _6, move _7);
StorageDead(_7);
StorageDead(_6);
- StorageDead(_22);
- StorageDead(_21);
switchInt(move _8) -> [0: bb2, otherwise: bb3];
}
bb2: {
+ StorageDead(_22);
+ StorageDead(_21);
_9 = Option::<usize>::None;
goto -> bb5;
}
bb3: {
+ StorageDead(_22);
+ StorageDead(_21);
_10 = (_5.0: usize);
StorageLive(_11);
_11 = <usize as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind unreachable];
diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir
index f7b19e80e..48092608d 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir
@@ -75,17 +75,19 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
_8 = Lt(move _6, move _7);
StorageDead(_7);
StorageDead(_6);
- StorageDead(_22);
- StorageDead(_21);
switchInt(move _8) -> [0: bb2, otherwise: bb3];
}
bb2: {
+ StorageDead(_22);
+ StorageDead(_21);
_9 = Option::<usize>::None;
goto -> bb5;
}
bb3: {
+ StorageDead(_22);
+ StorageDead(_21);
_10 = (_5.0: usize);
StorageLive(_11);
_11 = <usize as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind: bb12];
@@ -143,7 +145,7 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
bb12 (cleanup): {
- drop(_2) -> [return: bb13, unwind terminate];
+ drop(_2) -> [return: bb13, unwind terminate(cleanup)];
}
bb13 (cleanup): {
diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir
index 43f8806e1..3cdc49f60 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir
@@ -196,7 +196,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
bb11 (cleanup): {
- drop(_2) -> [return: bb12, unwind terminate];
+ drop(_2) -> [return: bb12, unwind terminate(cleanup)];
}
bb12 (cleanup): {
diff --git a/tests/mir-opt/pre-codegen/slice_iter.rs b/tests/mir-opt/pre-codegen/slice_iter.rs
index 4e954aa34..179005636 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.rs
+++ b/tests/mir-opt/pre-codegen/slice_iter.rs
@@ -1,6 +1,6 @@
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
-// ignore-debug
+// ignore-debug the standard library debug assertions leak into this test
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![crate_type = "lib"]
diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir
index ed7107e53..1d3317efd 100644
--- a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir
@@ -1,21 +1,21 @@
// MIR for `outer` after PreCodegen
fn outer(_1: u8) -> u8 {
- debug v => _1; // in scope 0 at $DIR/spans.rs:10:14: 10:15
- let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:10:24: 10:26
- let mut _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13
+ debug v => _1; // in scope 0 at $DIR/spans.rs:9:14: 9:15
+ let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:9:24: 9:26
+ let mut _2: &u8; // in scope 0 at $DIR/spans.rs:10:11: 10:13
bb0: {
- StorageLive(_2); // scope 0 at $DIR/spans.rs:11:11: 11:13
- _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13
- _0 = inner(move _2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/spans.rs:11:5: 11:14
- // mir::Constant
- // + span: $DIR/spans.rs:11:5: 11:10
- // + literal: Const { ty: for<'a> fn(&'a u8) -> u8 {inner}, val: Value(<ZST>) }
+ StorageLive(_2); // scope 0 at $DIR/spans.rs:10:11: 10:13
+ _2 = &_1; // scope 0 at $DIR/spans.rs:10:11: 10:13
+ _0 = inner(move _2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/spans.rs:10:5: 10:14
+ // mir::ConstOperand
+ // + span: $DIR/spans.rs:10:5: 10:10
+ // + const_: Const { ty: for<'a> fn(&'a u8) -> u8 {inner}, val: Value(inner) }
}
bb1: {
- StorageDead(_2); // scope 0 at $DIR/spans.rs:11:13: 11:14
- return; // scope 0 at $DIR/spans.rs:12:2: 12:2
+ StorageDead(_2); // scope 0 at $DIR/spans.rs:10:13: 10:14
+ return; // scope 0 at $DIR/spans.rs:11:2: 11:2
}
}
diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir
index dc436dc26..aba66861f 100644
--- a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir
@@ -1,21 +1,21 @@
// MIR for `outer` after PreCodegen
fn outer(_1: u8) -> u8 {
- debug v => _1; // in scope 0 at $DIR/spans.rs:10:14: 10:15
- let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:10:24: 10:26
- let mut _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13
+ debug v => _1; // in scope 0 at $DIR/spans.rs:9:14: 9:15
+ let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:9:24: 9:26
+ let mut _2: &u8; // in scope 0 at $DIR/spans.rs:10:11: 10:13
bb0: {
- StorageLive(_2); // scope 0 at $DIR/spans.rs:11:11: 11:13
- _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13
- _0 = inner(move _2) -> [return: bb1, unwind continue]; // scope 0 at $DIR/spans.rs:11:5: 11:14
- // mir::Constant
- // + span: $DIR/spans.rs:11:5: 11:10
- // + literal: Const { ty: for<'a> fn(&'a u8) -> u8 {inner}, val: Value(<ZST>) }
+ StorageLive(_2); // scope 0 at $DIR/spans.rs:10:11: 10:13
+ _2 = &_1; // scope 0 at $DIR/spans.rs:10:11: 10:13
+ _0 = inner(move _2) -> [return: bb1, unwind continue]; // scope 0 at $DIR/spans.rs:10:5: 10:14
+ // mir::ConstOperand
+ // + span: $DIR/spans.rs:10:5: 10:10
+ // + const_: Const { ty: for<'a> fn(&'a u8) -> u8 {inner}, val: Value(inner) }
}
bb1: {
- StorageDead(_2); // scope 0 at $DIR/spans.rs:11:13: 11:14
- return; // scope 0 at $DIR/spans.rs:12:2: 12:2
+ StorageDead(_2); // scope 0 at $DIR/spans.rs:10:13: 10:14
+ return; // scope 0 at $DIR/spans.rs:11:2: 11:2
}
}
diff --git a/tests/mir-opt/pre-codegen/spans.rs b/tests/mir-opt/pre-codegen/spans.rs
index 6ae9935ee..295eb0476 100644
--- a/tests/mir-opt/pre-codegen/spans.rs
+++ b/tests/mir-opt/pre-codegen/spans.rs
@@ -2,7 +2,6 @@
//
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: -Zmir-include-spans
-// ignore-wasm32
#![crate_type = "lib"]
diff --git a/tests/mir-opt/pre-codegen/try_identity.rs b/tests/mir-opt/pre-codegen/try_identity.rs
index 079ecccab..a227c82d6 100644
--- a/tests/mir-opt/pre-codegen/try_identity.rs
+++ b/tests/mir-opt/pre-codegen/try_identity.rs
@@ -1,6 +1,5 @@
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
-// ignore-debug
// Track the status of MIR optimizations simplifying `Ok(res?)` for both the old and new desugarings
// of that syntax.
diff --git a/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff
index 33322c41b..6c469d744 100644
--- a/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff
+++ b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff
@@ -34,10 +34,10 @@
}
bb4: {
-- _4 = &shallow _1;
-- _5 = &shallow (*((_1 as Some).0: &&i32));
-- _6 = &shallow ((_1 as Some).0: &&i32);
-- _7 = &shallow (*(*((_1 as Some).0: &&i32)));
+- _4 = &fake _1;
+- _5 = &fake (*((_1 as Some).0: &&i32));
+- _6 = &fake ((_1 as Some).0: &&i32);
+- _7 = &fake (*(*((_1 as Some).0: &&i32)));
+ nop;
+ nop;
+ nop;
diff --git a/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff
index 33322c41b..6c469d744 100644
--- a/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff
+++ b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff
@@ -34,10 +34,10 @@
}
bb4: {
-- _4 = &shallow _1;
-- _5 = &shallow (*((_1 as Some).0: &&i32));
-- _6 = &shallow ((_1 as Some).0: &&i32);
-- _7 = &shallow (*(*((_1 as Some).0: &&i32)));
+- _4 = &fake _1;
+- _5 = &fake (*((_1 as Some).0: &&i32));
+- _6 = &fake ((_1 as Some).0: &&i32);
+- _7 = &fake (*(*((_1 as Some).0: &&i32)));
+ nop;
+ nop;
+ nop;
diff --git a/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-abort.mir b/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-abort.mir
index 70efdbf4b..566b6af95 100644
--- a/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-abort.mir
+++ b/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-abort.mir
@@ -19,17 +19,16 @@ fn array_casts() -> () {
let mut _18: &usize;
let _19: usize;
let mut _22: bool;
- let mut _23: bool;
+ let mut _23: usize;
let mut _24: usize;
- let mut _25: usize;
- let mut _26: !;
- let _28: !;
- let mut _29: core::panicking::AssertKind;
- let mut _30: &usize;
- let _31: &usize;
- let mut _32: &usize;
- let _33: &usize;
- let mut _34: std::option::Option<std::fmt::Arguments<'_>>;
+ let mut _25: !;
+ let _27: !;
+ let mut _28: core::panicking::AssertKind;
+ let mut _29: &usize;
+ let _30: &usize;
+ let mut _31: &usize;
+ let _32: &usize;
+ let mut _33: std::option::Option<std::fmt::Arguments<'_>>;
scope 1 {
debug x => _1;
let _2: *mut usize;
@@ -45,15 +44,15 @@ fn array_casts() -> () {
debug p => _9;
let _20: &usize;
let _21: &usize;
- let mut _35: &usize;
+ let mut _34: &usize;
scope 6 {
}
scope 7 {
debug left_val => _20;
debug right_val => _21;
- let _27: core::panicking::AssertKind;
+ let _26: core::panicking::AssertKind;
scope 8 {
- debug kind => _27;
+ debug kind => _26;
}
}
}
@@ -110,9 +109,9 @@ fn array_casts() -> () {
_15 = (*_16);
_14 = &_15;
StorageLive(_18);
- _35 = const _;
- Retag(_35);
- _18 = &(*_35);
+ _34 = const _;
+ Retag(_34);
+ _18 = &(*_34);
_13 = (move _14, move _18);
Retag(_13);
StorageDead(_18);
@@ -125,39 +124,16 @@ fn array_casts() -> () {
Retag(_21);
StorageLive(_22);
StorageLive(_23);
+ _23 = (*_20);
StorageLive(_24);
- _24 = (*_20);
- StorageLive(_25);
- _25 = (*_21);
- _23 = Eq(move _24, move _25);
- StorageDead(_25);
- StorageDead(_24);
- _22 = Not(move _23);
- StorageDead(_23);
+ _24 = (*_21);
+ _22 = Eq(move _23, move _24);
switchInt(move _22) -> [0: bb4, otherwise: bb3];
}
bb3: {
- StorageLive(_27);
- _27 = core::panicking::AssertKind::Eq;
- StorageLive(_28);
- StorageLive(_29);
- _29 = move _27;
- StorageLive(_30);
- StorageLive(_31);
- _31 = &(*_20);
- _30 = &(*_31);
- StorageLive(_32);
- StorageLive(_33);
- _33 = &(*_21);
- _32 = &(*_33);
- StorageLive(_34);
- _34 = Option::<Arguments<'_>>::None;
- Retag(_34);
- _28 = core::panicking::assert_failed::<usize, usize>(move _29, move _30, move _32, move _34) -> unwind unreachable;
- }
-
- bb4: {
+ StorageDead(_24);
+ StorageDead(_23);
_12 = const ();
StorageDead(_22);
StorageDead(_21);
@@ -173,4 +149,26 @@ fn array_casts() -> () {
StorageDead(_1);
return;
}
+
+ bb4: {
+ StorageDead(_24);
+ StorageDead(_23);
+ StorageLive(_26);
+ _26 = core::panicking::AssertKind::Eq;
+ StorageLive(_27);
+ StorageLive(_28);
+ _28 = move _26;
+ StorageLive(_29);
+ StorageLive(_30);
+ _30 = &(*_20);
+ _29 = &(*_30);
+ StorageLive(_31);
+ StorageLive(_32);
+ _32 = &(*_21);
+ _31 = &(*_32);
+ StorageLive(_33);
+ _33 = Option::<Arguments<'_>>::None;
+ Retag(_33);
+ _27 = core::panicking::assert_failed::<usize, usize>(move _28, move _29, move _31, move _33) -> unwind unreachable;
+ }
}
diff --git a/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
index cfa9628d4..d0d317632 100644
--- a/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
+++ b/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
@@ -19,17 +19,16 @@ fn array_casts() -> () {
let mut _18: &usize;
let _19: usize;
let mut _22: bool;
- let mut _23: bool;
+ let mut _23: usize;
let mut _24: usize;
- let mut _25: usize;
- let mut _26: !;
- let _28: !;
- let mut _29: core::panicking::AssertKind;
- let mut _30: &usize;
- let _31: &usize;
- let mut _32: &usize;
- let _33: &usize;
- let mut _34: std::option::Option<std::fmt::Arguments<'_>>;
+ let mut _25: !;
+ let _27: !;
+ let mut _28: core::panicking::AssertKind;
+ let mut _29: &usize;
+ let _30: &usize;
+ let mut _31: &usize;
+ let _32: &usize;
+ let mut _33: std::option::Option<std::fmt::Arguments<'_>>;
scope 1 {
debug x => _1;
let _2: *mut usize;
@@ -45,15 +44,15 @@ fn array_casts() -> () {
debug p => _9;
let _20: &usize;
let _21: &usize;
- let mut _35: &usize;
+ let mut _34: &usize;
scope 6 {
}
scope 7 {
debug left_val => _20;
debug right_val => _21;
- let _27: core::panicking::AssertKind;
+ let _26: core::panicking::AssertKind;
scope 8 {
- debug kind => _27;
+ debug kind => _26;
}
}
}
@@ -110,9 +109,9 @@ fn array_casts() -> () {
_15 = (*_16);
_14 = &_15;
StorageLive(_18);
- _35 = const _;
- Retag(_35);
- _18 = &(*_35);
+ _34 = const _;
+ Retag(_34);
+ _18 = &(*_34);
_13 = (move _14, move _18);
Retag(_13);
StorageDead(_18);
@@ -125,39 +124,16 @@ fn array_casts() -> () {
Retag(_21);
StorageLive(_22);
StorageLive(_23);
+ _23 = (*_20);
StorageLive(_24);
- _24 = (*_20);
- StorageLive(_25);
- _25 = (*_21);
- _23 = Eq(move _24, move _25);
- StorageDead(_25);
- StorageDead(_24);
- _22 = Not(move _23);
- StorageDead(_23);
+ _24 = (*_21);
+ _22 = Eq(move _23, move _24);
switchInt(move _22) -> [0: bb4, otherwise: bb3];
}
bb3: {
- StorageLive(_27);
- _27 = core::panicking::AssertKind::Eq;
- StorageLive(_28);
- StorageLive(_29);
- _29 = move _27;
- StorageLive(_30);
- StorageLive(_31);
- _31 = &(*_20);
- _30 = &(*_31);
- StorageLive(_32);
- StorageLive(_33);
- _33 = &(*_21);
- _32 = &(*_33);
- StorageLive(_34);
- _34 = Option::<Arguments<'_>>::None;
- Retag(_34);
- _28 = core::panicking::assert_failed::<usize, usize>(move _29, move _30, move _32, move _34) -> unwind continue;
- }
-
- bb4: {
+ StorageDead(_24);
+ StorageDead(_23);
_12 = const ();
StorageDead(_22);
StorageDead(_21);
@@ -173,4 +149,26 @@ fn array_casts() -> () {
StorageDead(_1);
return;
}
+
+ bb4: {
+ StorageDead(_24);
+ StorageDead(_23);
+ StorageLive(_26);
+ _26 = core::panicking::AssertKind::Eq;
+ StorageLive(_27);
+ StorageLive(_28);
+ _28 = move _26;
+ StorageLive(_29);
+ StorageLive(_30);
+ _30 = &(*_20);
+ _29 = &(*_30);
+ StorageLive(_31);
+ StorageLive(_32);
+ _32 = &(*_21);
+ _31 = &(*_32);
+ StorageLive(_33);
+ _33 = Option::<Arguments<'_>>::None;
+ Retag(_33);
+ _27 = core::panicking::assert_failed::<usize, usize>(move _28, move _29, move _31, move _33) -> unwind continue;
+ }
}
diff --git a/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-abort.mir b/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-abort.mir
index 4a3d19784..7f3310919 100644
--- a/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-abort.mir
+++ b/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-abort.mir
@@ -1,6 +1,6 @@
// MIR for `main::{closure#0}` after SimplifyCfg-elaborate-drops
-fn main::{closure#0}(_1: &[closure@main::{closure#0}], _2: &i32) -> &i32 {
+fn main::{closure#0}(_1: &{closure@main::{closure#0}}, _2: &i32) -> &i32 {
debug x => _2;
let mut _0: &i32;
let _3: &i32;
diff --git a/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
index 4a3d19784..7f3310919 100644
--- a/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
+++ b/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
@@ -1,6 +1,6 @@
// MIR for `main::{closure#0}` after SimplifyCfg-elaborate-drops
-fn main::{closure#0}(_1: &[closure@main::{closure#0}], _2: &i32) -> &i32 {
+fn main::{closure#0}(_1: &{closure@main::{closure#0}}, _2: &i32) -> &i32 {
debug x => _2;
let mut _0: &i32;
let _3: &i32;
diff --git a/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir b/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir
index fb37bec10..ec894fa51 100644
--- a/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir
+++ b/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir
@@ -10,7 +10,7 @@ fn main() -> () {
let mut _7: &mut i32;
let mut _9: &mut i32;
let mut _12: *mut i32;
- let mut _14: [closure@main::{closure#0}];
+ let mut _14: {closure@main::{closure#0}};
let mut _16: for<'a> fn(&'a i32) -> &'a i32;
let mut _17: &i32;
let _18: &i32;
@@ -103,7 +103,7 @@ fn main() -> () {
StorageDead(_2);
StorageLive(_13);
StorageLive(_14);
- _14 = [closure@main::{closure#0}];
+ _14 = {closure@main::{closure#0}};
Retag(_14);
_13 = move _14 as for<'a> fn(&'a i32) -> &'a i32 (PointerCoercion(ClosureFnPointer(Normal)));
StorageDead(_14);
diff --git a/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
index 508f96409..d89124f69 100644
--- a/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
+++ b/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
@@ -10,7 +10,7 @@ fn main() -> () {
let mut _7: &mut i32;
let mut _9: &mut i32;
let mut _12: *mut i32;
- let mut _14: [closure@main::{closure#0}];
+ let mut _14: {closure@main::{closure#0}};
let mut _16: for<'a> fn(&'a i32) -> &'a i32;
let mut _17: &i32;
let _18: &i32;
@@ -103,7 +103,7 @@ fn main() -> () {
StorageDead(_2);
StorageLive(_13);
StorageLive(_14);
- _14 = [closure@main::{closure#0}];
+ _14 = {closure@main::{closure#0}};
Retag(_14);
_13 = move _14 as for<'a> fn(&'a i32) -> &'a i32 (PointerCoercion(ClosureFnPointer(Normal)));
StorageDead(_14);
@@ -167,11 +167,11 @@ fn main() -> () {
}
bb7 (cleanup): {
- drop(_21) -> [return: bb9, unwind terminate];
+ drop(_21) -> [return: bb9, unwind terminate(cleanup)];
}
bb8 (cleanup): {
- drop(_5) -> [return: bb9, unwind terminate];
+ drop(_5) -> [return: bb9, unwind terminate(cleanup)];
}
bb9 (cleanup): {
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 9bf69acd3..3a8b457a7 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
@@ -24,7 +24,7 @@ fn std::ptr::drop_in_place(_1: *mut [String]) -> () {
bb3 (cleanup): {
_4 = &raw mut (*_1)[_3];
_3 = Add(move _3, const 1_usize);
- drop((*_4)) -> [return: bb4, unwind terminate];
+ drop((*_4)) -> [return: bb4, unwind terminate(cleanup)];
}
bb4 (cleanup): {
diff --git a/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff
index bb14b909a..b020d1baa 100644
--- a/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff
+++ b/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff
@@ -33,7 +33,8 @@
+ let _32: u32;
scope 1 {
- debug foo => _1;
-+ debug foo => Foo<T>{ .0 => _31, .1 => _32, };
++ debug ((foo: Foo<T>).0: std::result::Result<std::boxed::Box<dyn std::fmt::Display>, <T as Err>::Err>) => _31;
++ debug ((foo: Foo<T>).1: u32) => _32;
let _5: std::result::Result<std::boxed::Box<dyn std::fmt::Display>, <T as Err>::Err>;
scope 2 {
debug x => _5;
diff --git a/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff
index 7ee043169..1330f9b3a 100644
--- a/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff
+++ b/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff
@@ -8,7 +8,8 @@
+ let _5: u8;
scope 1 {
- debug y => _1;
-+ debug y => (usize, u8){ .0 => _4, .1 => _5, };
++ debug ((y: (usize, u8)).0: usize) => _4;
++ debug ((y: (usize, u8)).1: u8) => _5;
let _2: usize;
scope 2 {
debug t => _2;
diff --git a/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff
index 0a1de891a..362133863 100644
--- a/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff
+++ b/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff
@@ -11,7 +11,10 @@
+ let _14: std::option::Option<isize>;
scope 1 {
- debug y => _2;
-+ debug y => Foo{ .0 => _11, .1 => _12, .2 => _13, .3 => _14, };
++ debug ((y: Foo).0: u8) => _11;
++ debug ((y: Foo).1: ()) => _12;
++ debug ((y: Foo).2: &str) => _13;
++ debug ((y: Foo).3: std::option::Option<isize>) => _14;
let _3: u8;
scope 2 {
debug t => _3;
@@ -25,7 +28,10 @@
+ let _10: std::option::Option<isize>;
scope 4 {
- debug z => _5;
-+ debug z => Foo{ .0 => _7, .1 => _8, .2 => _9, .3 => _10, };
++ debug ((z: Foo).0: u8) => _7;
++ debug ((z: Foo).1: ()) => _8;
++ debug ((z: Foo).2: &str) => _9;
++ debug ((z: Foo).3: std::option::Option<isize>) => _10;
let _6: ();
scope 5 {
debug a => _6;
diff --git a/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff
index d7c57c293..304bf2fb1 100644
--- a/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff
+++ b/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff
@@ -11,7 +11,10 @@
+ let _8: std::option::Option<isize>;
scope 1 {
- debug y => _2;
-+ debug y => Foo{ .0 => _5, .1 => _6, .2 => _7, .3 => _8, };
++ debug ((y: Foo).0: u8) => _5;
++ debug ((y: Foo).1: ()) => _6;
++ debug ((y: Foo).2: &str) => _7;
++ debug ((y: Foo).3: std::option::Option<isize>) => _8;
let _3: u8;
scope 2 {
debug t => _3;
diff --git a/tests/mir-opt/ssa_unreachable_116212.rs b/tests/mir-opt/ssa_unreachable_116212.rs
new file mode 100644
index 000000000..f58866587
--- /dev/null
+++ b/tests/mir-opt/ssa_unreachable_116212.rs
@@ -0,0 +1,14 @@
+// Regression test for issue #116212.
+
+#![feature(never_type)]
+
+use std::mem::MaybeUninit;
+
+struct Foo {
+ x: u8,
+ y: !,
+}
+
+fn main() {
+ let foo = unsafe { MaybeUninit::<Foo>::uninit().assume_init() };
+}
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 ee90a5407..b58794183 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<i32>) -> () {
}
bb4 (cleanup): {
- drop(((*_1).0: alloc::raw_vec::RawVec<i32>)) -> [return: bb2, unwind terminate];
+ drop(((*_1).0: alloc::raw_vec::RawVec<i32>)) -> [return: bb2, unwind terminate(cleanup)];
}
bb5: {
diff --git a/tests/pretty/tests-are-sorted.pp b/tests/pretty/tests-are-sorted.pp
index 7d7f68213..fd9386be8 100644
--- a/tests/pretty/tests-are-sorted.pp
+++ b/tests/pretty/tests-are-sorted.pp
@@ -79,7 +79,7 @@ pub const a_test: test::TestDescAndFn =
};
fn a_test() {}
#[rustc_main]
-#[no_coverage]
+#[coverage(off)]
pub fn main() -> () {
extern crate test;
test::test_main_static(&[&a_test, &m_test, &z_test])
diff --git a/tests/run-coverage-rustdoc/doctest.coverage b/tests/run-coverage-rustdoc/doctest.coverage
index 07f1e6b3e..5797784f4 100644
--- a/tests/run-coverage-rustdoc/doctest.coverage
+++ b/tests/run-coverage-rustdoc/doctest.coverage
@@ -10,6 +10,8 @@ $DIR/auxiliary/doctest_crate.rs:
LL| 3|}
$DIR/doctest.rs:
+ LL| |// aux-build:doctest_crate.rs
+ LL| |
LL| |//! This test ensures that code from doctests is properly re-mapped.
LL| |//! See <https://github.com/rust-lang/rust/issues/79417> for more info.
LL| |//!
@@ -78,7 +80,7 @@ $DIR/doctest.rs:
LL| |//! doctest_main()
LL| |//! }
LL| |//! ```
- LL| |// aux-build:doctest_crate.rs
+ LL| |
LL| |/// doctest attached to fn testing external code:
LL| |/// ```
LL| 1|/// extern crate doctest_crate;
diff --git a/tests/run-coverage-rustdoc/doctest.rs b/tests/run-coverage-rustdoc/doctest.rs
index 251b0c291..4006d723c 100644
--- a/tests/run-coverage-rustdoc/doctest.rs
+++ b/tests/run-coverage-rustdoc/doctest.rs
@@ -1,3 +1,5 @@
+// aux-build:doctest_crate.rs
+
//! This test ensures that code from doctests is properly re-mapped.
//! See <https://github.com/rust-lang/rust/issues/79417> for more info.
//!
@@ -63,7 +65,7 @@
//! doctest_main()
//! }
//! ```
-// aux-build:doctest_crate.rs
+
/// doctest attached to fn testing external code:
/// ```
/// extern crate doctest_crate;
diff --git a/tests/run-coverage/assert.coverage b/tests/run-coverage/assert.coverage
index 3c6108e43..8b997724c 100644
--- a/tests/run-coverage/assert.coverage
+++ b/tests/run-coverage/assert.coverage
@@ -7,7 +7,7 @@
^1
LL| 3|}
LL| |
- LL| 1|fn main() -> Result<(),u8> {
+ LL| 1|fn main() -> Result<(), u8> {
LL| 1| let mut countdown = 10;
LL| 11| while countdown > 0 {
LL| 11| if countdown == 1 {
diff --git a/tests/run-coverage/assert.rs b/tests/run-coverage/assert.rs
index d32a37e07..85e6662a6 100644
--- a/tests/run-coverage/assert.rs
+++ b/tests/run-coverage/assert.rs
@@ -6,7 +6,7 @@ fn might_fail_assert(one_plus_one: u32) {
assert_eq!(1 + 1, one_plus_one, "the argument was wrong");
}
-fn main() -> Result<(),u8> {
+fn main() -> Result<(), u8> {
let mut countdown = 10;
while countdown > 0 {
if countdown == 1 {
diff --git a/tests/run-coverage/async2.coverage b/tests/run-coverage/async2.coverage
index 7e0139ae0..fcb0a3aed 100644
--- a/tests/run-coverage/async2.coverage
+++ b/tests/run-coverage/async2.coverage
@@ -1,11 +1,5 @@
LL| |// compile-flags: --edition=2018
LL| |
- LL| |use core::{
- LL| | future::Future,
- LL| | marker::Send,
- LL| | pin::Pin,
- LL| |};
- LL| |
LL| 1|fn non_async_func() {
LL| 1| println!("non_async_func was covered");
LL| 1| let b = true;
@@ -15,9 +9,6 @@
^0
LL| 1|}
LL| |
- LL| |
- LL| |
- LL| |
LL| 1|async fn async_func() {
LL| 1| println!("async_func was covered");
LL| 1| let b = true;
@@ -27,9 +18,6 @@
^0
LL| 1|}
LL| |
- LL| |
- LL| |
- LL| |
LL| 1|async fn async_func_just_println() {
LL| 1| println!("async_func_just_println was covered");
LL| 1|}
diff --git a/tests/run-coverage/async2.rs b/tests/run-coverage/async2.rs
index 959d48ce9..2884ff297 100644
--- a/tests/run-coverage/async2.rs
+++ b/tests/run-coverage/async2.rs
@@ -1,11 +1,5 @@
// compile-flags: --edition=2018
-use core::{
- future::Future,
- marker::Send,
- pin::Pin,
-};
-
fn non_async_func() {
println!("non_async_func was covered");
let b = true;
@@ -14,9 +8,6 @@ fn non_async_func() {
}
}
-
-
-
async fn async_func() {
println!("async_func was covered");
let b = true;
@@ -25,9 +16,6 @@ async fn async_func() {
}
}
-
-
-
async fn async_func_just_println() {
println!("async_func_just_println was covered");
}
diff --git a/tests/run-coverage/auxiliary/inline_always_with_dead_code.rs b/tests/run-coverage/auxiliary/inline_always_with_dead_code.rs
index 2b21dee6c..9dc50dae2 100644
--- a/tests/run-coverage/auxiliary/inline_always_with_dead_code.rs
+++ b/tests/run-coverage/auxiliary/inline_always_with_dead_code.rs
@@ -4,9 +4,9 @@
mod foo {
#[inline(always)]
- pub fn called() { }
+ pub fn called() {}
- fn uncalled() { }
+ fn uncalled() {}
}
pub mod bar {
diff --git a/tests/run-coverage/auxiliary/macro_name_span_helper.rs b/tests/run-coverage/auxiliary/macro_name_span_helper.rs
new file mode 100644
index 000000000..6797c081d
--- /dev/null
+++ b/tests/run-coverage/auxiliary/macro_name_span_helper.rs
@@ -0,0 +1,10 @@
+// edition: 2021
+
+#[macro_export]
+macro_rules! macro_that_defines_a_function {
+ (fn $name:ident () $body:tt) => {
+ fn $name () -> () $body
+ }
+}
+
+// Non-executable comment.
diff --git a/tests/run-coverage/auxiliary/unused_mod_helper.rs b/tests/run-coverage/auxiliary/unused_mod_helper.rs
index ae1cc1531..88c5dac65 100644
--- a/tests/run-coverage/auxiliary/unused_mod_helper.rs
+++ b/tests/run-coverage/auxiliary/unused_mod_helper.rs
@@ -1,3 +1,4 @@
+#[allow(dead_code)]
pub fn never_called_function() {
println!("I am never called");
}
diff --git a/tests/run-coverage/auxiliary/used_crate.rs b/tests/run-coverage/auxiliary/used_crate.rs
index 16592d48d..c086ef21e 100644
--- a/tests/run-coverage/auxiliary/used_crate.rs
+++ b/tests/run-coverage/auxiliary/used_crate.rs
@@ -1,6 +1,8 @@
#![allow(unused_assignments, unused_variables)]
+// Verify that coverage works with optimizations:
// compile-flags: -C opt-level=3
-use std::fmt::Debug; // ^^ validates coverage now works with optimizations
+
+use std::fmt::Debug;
pub fn used_function() {
// Initialize test constants in a way that cannot be determined at compile time, to ensure
@@ -42,6 +44,7 @@ pub fn unused_function() {
}
}
+#[allow(dead_code)]
fn unused_private_function() {
let is_true = std::env::args().len() == 1;
let mut countdown = 2;
diff --git a/tests/run-coverage/auxiliary/used_inline_crate.rs b/tests/run-coverage/auxiliary/used_inline_crate.rs
index 8b8e9d548..e8929de6b 100644
--- a/tests/run-coverage/auxiliary/used_inline_crate.rs
+++ b/tests/run-coverage/auxiliary/used_inline_crate.rs
@@ -1,7 +1,7 @@
#![allow(unused_assignments, unused_variables)]
-
+// Verify that coverage works with optimizations:
// compile-flags: -C opt-level=3
-// ^^ validates coverage now works with optimizations
+
use std::fmt::Debug;
pub fn used_function() {
@@ -29,12 +29,6 @@ pub fn used_inline_function() {
use_this_lib_crate();
}
-
-
-
-
-
-
#[inline(always)]
pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) {
println!("used_only_from_bin_crate_generic_function with {:?}", arg);
@@ -71,6 +65,7 @@ pub fn unused_function() {
}
#[inline(always)]
+#[allow(dead_code)]
fn unused_private_function() {
let is_true = std::env::args().len() == 1;
let mut countdown = 2;
diff --git a/tests/run-coverage/closure.coverage b/tests/run-coverage/closure.coverage
index 809cf1f48..67014f792 100644
--- a/tests/run-coverage/closure.coverage
+++ b/tests/run-coverage/closure.coverage
@@ -1,11 +1,16 @@
LL| |#![allow(unused_assignments, unused_variables)]
LL| |// compile-flags: -C opt-level=2
- LL| 1|fn main() { // ^^ fix described in rustc_middle/mir/mono.rs
+ LL| |
+ LL| |// This test used to be sensitive to certain coverage-specific hacks in
+ LL| |// `rustc_middle/mir/mono.rs`, but those hacks were later cleaned up by
+ LL| |// <https://github.com/rust-lang/rust/pull/83666>.
+ LL| |
+ LL| 1|fn main() {
LL| 1| // Initialize test constants in a way that cannot be determined at compile time, to ensure
LL| 1| // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
LL| 1| // dependent conditions.
LL| 1| let is_true = std::env::args().len() == 1;
- LL| 1| let is_false = ! is_true;
+ LL| 1| let is_false = !is_true;
LL| 1|
LL| 1| let mut some_string = Some(String::from("the string content"));
LL| 1| println!(
@@ -71,8 +76,8 @@
LL| 1| some_string = None;
LL| 1| let
LL| 1| a
- LL| 1| =
- LL| 1| ||
+ LL| | =
+ LL| | ||
LL| 1| {
LL| 1| let mut countdown = 0;
LL| 1| if is_false {
@@ -93,8 +98,8 @@
LL| 1|
LL| 1| let
LL| 1| quote_closure
- LL| 1| =
- LL| 1| |val|
+ LL| | =
+ LL| | |val|
LL| 5| {
LL| 5| let mut countdown = 0;
LL| 5| if is_false {
@@ -181,7 +186,7 @@
LL| | ;
LL| |
LL| 1| let short_used_not_covered_closure_line_break_block_embedded_branch =
- LL| 1| | _unused_arg: u8 |
+ LL| | | _unused_arg: u8 |
LL| 0| {
LL| 0| println!(
LL| 0| "not called: {}",
@@ -191,7 +196,7 @@
LL| | ;
LL| |
LL| 1| let short_used_covered_closure_line_break_no_block_embedded_branch =
- LL| 1| | _unused_arg: u8 |
+ LL| | | _unused_arg: u8 |
LL| 1| println!(
LL| 1| "not called: {}",
LL| 1| if is_true { "check" } else { "me" }
@@ -200,7 +205,7 @@
LL| | ;
LL| |
LL| 1| let short_used_covered_closure_line_break_block_embedded_branch =
- LL| 1| | _unused_arg: u8 |
+ LL| | | _unused_arg: u8 |
LL| 1| {
LL| 1| println!(
LL| 1| "not called: {}",
diff --git a/tests/run-coverage/closure.rs b/tests/run-coverage/closure.rs
index eb3a1ebff..16a2c4e33 100644
--- a/tests/run-coverage/closure.rs
+++ b/tests/run-coverage/closure.rs
@@ -1,11 +1,16 @@
#![allow(unused_assignments, unused_variables)]
// compile-flags: -C opt-level=2
-fn main() { // ^^ fix described in rustc_middle/mir/mono.rs
+
+// This test used to be sensitive to certain coverage-specific hacks in
+// `rustc_middle/mir/mono.rs`, but those hacks were later cleaned up by
+// <https://github.com/rust-lang/rust/pull/83666>.
+
+fn main() {
// Initialize test constants in a way that cannot be determined at compile time, to ensure
// rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
// dependent conditions.
let is_true = std::env::args().len() == 1;
- let is_false = ! is_true;
+ let is_false = !is_true;
let mut some_string = Some(String::from("the string content"));
println!(
diff --git a/tests/run-coverage/closure_bug.coverage b/tests/run-coverage/closure_bug.coverage
new file mode 100644
index 000000000..f3299834b
--- /dev/null
+++ b/tests/run-coverage/closure_bug.coverage
@@ -0,0 +1,53 @@
+ LL| |// Regression test for #115930.
+ LL| |// All of these closures are identical, and should produce identical output in
+ LL| |// the coverage report. However, an unstable sort was causing them to be treated
+ LL| |// inconsistently when preparing coverage spans.
+ LL| |
+ LL| 1|fn main() {
+ LL| 1| let truthy = std::env::args().len() == 1;
+ LL| 1|
+ LL| 1| let a
+ LL| | =
+ LL| | |
+ LL| | |
+ LL| 2| if truthy { true } else { false };
+ ^0
+ LL| |
+ LL| 1| a();
+ LL| 1| if truthy { a(); }
+ ^0
+ LL| |
+ LL| 1| let b
+ LL| | =
+ LL| | |
+ LL| | |
+ LL| 2| if truthy { true } else { false };
+ ^0
+ LL| |
+ LL| 1| b();
+ LL| 1| if truthy { b(); }
+ ^0
+ LL| |
+ LL| 1| let c
+ LL| | =
+ LL| | |
+ LL| | |
+ LL| 2| if truthy { true } else { false };
+ ^0
+ LL| |
+ LL| 1| c();
+ LL| 1| if truthy { c(); }
+ ^0
+ LL| |
+ LL| 1| let d
+ LL| | =
+ LL| | |
+ LL| | |
+ LL| 2| if truthy { true } else { false };
+ ^0
+ LL| |
+ LL| 1| d();
+ LL| 1| if truthy { d(); }
+ ^0
+ LL| 1|}
+
diff --git a/tests/run-coverage/closure_bug.rs b/tests/run-coverage/closure_bug.rs
new file mode 100644
index 000000000..739bc5f0b
--- /dev/null
+++ b/tests/run-coverage/closure_bug.rs
@@ -0,0 +1,44 @@
+// Regression test for #115930.
+// All of these closures are identical, and should produce identical output in
+// the coverage report. However, an unstable sort was causing them to be treated
+// inconsistently when preparing coverage spans.
+
+fn main() {
+ let truthy = std::env::args().len() == 1;
+
+ let a
+ =
+ |
+ |
+ if truthy { true } else { false };
+
+ a();
+ if truthy { a(); }
+
+ let b
+ =
+ |
+ |
+ if truthy { true } else { false };
+
+ b();
+ if truthy { b(); }
+
+ let c
+ =
+ |
+ |
+ if truthy { true } else { false };
+
+ c();
+ if truthy { c(); }
+
+ let d
+ =
+ |
+ |
+ if truthy { true } else { false };
+
+ d();
+ if truthy { d(); }
+}
diff --git a/tests/run-coverage/closure_macro.coverage b/tests/run-coverage/closure_macro.coverage
index 1bfd2013d..0f2c917e0 100644
--- a/tests/run-coverage/closure_macro.coverage
+++ b/tests/run-coverage/closure_macro.coverage
@@ -1,5 +1,5 @@
LL| |// compile-flags: --edition=2018
- LL| |#![feature(no_coverage)]
+ LL| |#![feature(coverage_attribute)]
LL| |
LL| |macro_rules! bail {
LL| | ($msg:literal $(,)?) => {
diff --git a/tests/run-coverage/closure_macro.rs b/tests/run-coverage/closure_macro.rs
index 5e3b00d1e..9b289141c 100644
--- a/tests/run-coverage/closure_macro.rs
+++ b/tests/run-coverage/closure_macro.rs
@@ -1,5 +1,5 @@
// compile-flags: --edition=2018
-#![feature(no_coverage)]
+#![feature(coverage_attribute)]
macro_rules! bail {
($msg:literal $(,)?) => {
diff --git a/tests/run-coverage/closure_macro_async.coverage b/tests/run-coverage/closure_macro_async.coverage
index 0e4365fc7..74247f1bc 100644
--- a/tests/run-coverage/closure_macro_async.coverage
+++ b/tests/run-coverage/closure_macro_async.coverage
@@ -1,5 +1,5 @@
LL| |// compile-flags: --edition=2018
- LL| |#![feature(no_coverage)]
+ LL| |#![feature(coverage_attribute)]
LL| |
LL| |macro_rules! bail {
LL| | ($msg:literal $(,)?) => {
@@ -40,9 +40,9 @@
LL| 1| Ok(())
LL| 1|}
LL| |
- LL| |#[no_coverage]
+ LL| |#[coverage(off)]
LL| |fn main() {
- LL| | executor::block_on(test());
+ LL| | executor::block_on(test()).unwrap();
LL| |}
LL| |
LL| |mod executor {
@@ -52,22 +52,18 @@
LL| | task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
LL| | };
LL| |
- LL| | #[no_coverage]
+ LL| | #[coverage(off)]
LL| | pub fn block_on<F: Future>(mut future: F) -> F::Output {
LL| | let mut future = unsafe { Pin::new_unchecked(&mut future) };
LL| | use std::hint::unreachable_unchecked;
LL| | static VTABLE: RawWakerVTable = RawWakerVTable::new(
- LL| |
- LL| | #[no_coverage]
+ LL| | #[coverage(off)]
LL| | |_| unsafe { unreachable_unchecked() }, // clone
- LL| |
- LL| | #[no_coverage]
+ LL| | #[coverage(off)]
LL| | |_| unsafe { unreachable_unchecked() }, // wake
- LL| |
- LL| | #[no_coverage]
+ LL| | #[coverage(off)]
LL| | |_| unsafe { unreachable_unchecked() }, // wake_by_ref
- LL| |
- LL| | #[no_coverage]
+ LL| | #[coverage(off)]
LL| | |_| (),
LL| | );
LL| | let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
diff --git a/tests/run-coverage/closure_macro_async.rs b/tests/run-coverage/closure_macro_async.rs
index e3e89e9c8..b4275599e 100644
--- a/tests/run-coverage/closure_macro_async.rs
+++ b/tests/run-coverage/closure_macro_async.rs
@@ -1,5 +1,5 @@
// compile-flags: --edition=2018
-#![feature(no_coverage)]
+#![feature(coverage_attribute)]
macro_rules! bail {
($msg:literal $(,)?) => {
@@ -39,9 +39,9 @@ pub async fn test() -> Result<(), String> {
Ok(())
}
-#[no_coverage]
+#[coverage(off)]
fn main() {
- executor::block_on(test());
+ executor::block_on(test()).unwrap();
}
mod executor {
@@ -51,22 +51,18 @@ mod executor {
task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
};
- #[no_coverage]
+ #[coverage(off)]
pub fn block_on<F: Future>(mut future: F) -> F::Output {
let mut future = unsafe { Pin::new_unchecked(&mut future) };
use std::hint::unreachable_unchecked;
static VTABLE: RawWakerVTable = RawWakerVTable::new(
-
- #[no_coverage]
+ #[coverage(off)]
|_| unsafe { unreachable_unchecked() }, // clone
-
- #[no_coverage]
+ #[coverage(off)]
|_| unsafe { unreachable_unchecked() }, // wake
-
- #[no_coverage]
+ #[coverage(off)]
|_| unsafe { unreachable_unchecked() }, // wake_by_ref
-
- #[no_coverage]
+ #[coverage(off)]
|_| (),
);
let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
diff --git a/tests/run-coverage/conditions.coverage b/tests/run-coverage/conditions.coverage
index 4749c353a..473335ff6 100644
--- a/tests/run-coverage/conditions.coverage
+++ b/tests/run-coverage/conditions.coverage
@@ -59,7 +59,6 @@
LL| | }
LL| 0| }
LL| |
- LL| |
LL| 1| let mut countdown = 0;
LL| 1| if true {
LL| 1| countdown = 1;
diff --git a/tests/run-coverage/conditions.rs b/tests/run-coverage/conditions.rs
index 057599d1b..fa7f2a116 100644
--- a/tests/run-coverage/conditions.rs
+++ b/tests/run-coverage/conditions.rs
@@ -55,7 +55,6 @@ fn main() {
}
}
-
let mut countdown = 0;
if true {
countdown = 1;
diff --git a/tests/run-coverage/dead_code.coverage b/tests/run-coverage/dead_code.coverage
index 5074d8b3c..c4ee9f23f 100644
--- a/tests/run-coverage/dead_code.coverage
+++ b/tests/run-coverage/dead_code.coverage
@@ -1,4 +1,4 @@
- LL| |#![allow(unused_assignments, unused_variables)]
+ LL| |#![allow(dead_code, unused_assignments, unused_variables)]
LL| |
LL| 0|pub fn unused_pub_fn_not_in_library() {
LL| 0| // Initialize test constants in a way that cannot be determined at compile time, to ensure
diff --git a/tests/run-coverage/dead_code.rs b/tests/run-coverage/dead_code.rs
index a1285df0e..3492712a6 100644
--- a/tests/run-coverage/dead_code.rs
+++ b/tests/run-coverage/dead_code.rs
@@ -1,4 +1,4 @@
-#![allow(unused_assignments, unused_variables)]
+#![allow(dead_code, unused_assignments, unused_variables)]
pub fn unused_pub_fn_not_in_library() {
// Initialize test constants in a way that cannot be determined at compile time, to ensure
diff --git a/tests/run-coverage/drop_trait.coverage b/tests/run-coverage/drop_trait.coverage
index c99b980a3..2c9439a93 100644
--- a/tests/run-coverage/drop_trait.coverage
+++ b/tests/run-coverage/drop_trait.coverage
@@ -11,7 +11,7 @@
LL| 2| }
LL| |}
LL| |
- LL| 1|fn main() -> Result<(),u8> {
+ LL| 1|fn main() -> Result<(), u8> {
LL| 1| let _firecracker = Firework { strength: 1 };
LL| 1|
LL| 1| let _tnt = Firework { strength: 100 };
diff --git a/tests/run-coverage/drop_trait.rs b/tests/run-coverage/drop_trait.rs
index a9b5d1d1e..7b062719c 100644
--- a/tests/run-coverage/drop_trait.rs
+++ b/tests/run-coverage/drop_trait.rs
@@ -11,7 +11,7 @@ impl Drop for Firework {
}
}
-fn main() -> Result<(),u8> {
+fn main() -> Result<(), u8> {
let _firecracker = Firework { strength: 1 };
let _tnt = Firework { strength: 100 };
diff --git a/tests/run-coverage/generics.coverage b/tests/run-coverage/generics.coverage
index 2ff8f917e..098391835 100644
--- a/tests/run-coverage/generics.coverage
+++ b/tests/run-coverage/generics.coverage
@@ -41,7 +41,7 @@
------------------
LL| |}
LL| |
- LL| 1|fn main() -> Result<(),u8> {
+ LL| 1|fn main() -> Result<(), u8> {
LL| 1| let mut firecracker = Firework { strength: 1 };
LL| 1| firecracker.set_strength(2);
LL| 1|
@@ -54,10 +54,6 @@
LL| 1| return Err(1);
LL| 0| }
LL| 0|
- LL| 0|
- LL| 0|
- LL| 0|
- LL| 0|
LL| 0| let _ = Firework { strength: 1000 };
LL| 0|
LL| 0| Ok(())
diff --git a/tests/run-coverage/generics.rs b/tests/run-coverage/generics.rs
index 150ffb9db..bf4c2d8d6 100644
--- a/tests/run-coverage/generics.rs
+++ b/tests/run-coverage/generics.rs
@@ -19,7 +19,7 @@ impl<T> Drop for Firework<T> where T: Copy + std::fmt::Display {
}
}
-fn main() -> Result<(),u8> {
+fn main() -> Result<(), u8> {
let mut firecracker = Firework { strength: 1 };
firecracker.set_strength(2);
@@ -32,10 +32,6 @@ fn main() -> Result<(),u8> {
return Err(1);
}
-
-
-
-
let _ = Firework { strength: 1000 };
Ok(())
diff --git a/tests/run-coverage/issue-85461.coverage b/tests/run-coverage/issue-85461.coverage
index f97ab2303..cbc910664 100644
--- a/tests/run-coverage/issue-85461.coverage
+++ b/tests/run-coverage/issue-85461.coverage
@@ -5,9 +5,9 @@ $DIR/auxiliary/inline_always_with_dead_code.rs:
LL| |
LL| |mod foo {
LL| | #[inline(always)]
- LL| 2| pub fn called() { }
+ LL| 2| pub fn called() {}
LL| |
- LL| 0| fn uncalled() { }
+ LL| 0| fn uncalled() {}
LL| |}
LL| |
LL| |pub mod bar {
@@ -24,6 +24,7 @@ $DIR/auxiliary/inline_always_with_dead_code.rs:
$DIR/issue-85461.rs:
LL| |// Regression test for #85461: MSVC sometimes fail to link with dead code and #[inline(always)]
+ LL| |
LL| |// aux-build:inline_always_with_dead_code.rs
LL| |extern crate inline_always_with_dead_code;
LL| |
diff --git a/tests/run-coverage/issue-85461.rs b/tests/run-coverage/issue-85461.rs
index 6f626b4a6..9d4c90a82 100644
--- a/tests/run-coverage/issue-85461.rs
+++ b/tests/run-coverage/issue-85461.rs
@@ -1,4 +1,5 @@
// Regression test for #85461: MSVC sometimes fail to link with dead code and #[inline(always)]
+
// aux-build:inline_always_with_dead_code.rs
extern crate inline_always_with_dead_code;
diff --git a/tests/run-coverage/issue-93054.coverage b/tests/run-coverage/issue-93054.coverage
index 074e6b983..15f225326 100644
--- a/tests/run-coverage/issue-93054.coverage
+++ b/tests/run-coverage/issue-93054.coverage
@@ -1,29 +1,31 @@
+ LL| |#![allow(dead_code, unreachable_code)]
+ LL| |
LL| |// Regression test for #93054: Functions using uninhabited types often only have a single,
LL| |// unreachable basic block which doesn't get instrumented. This should not cause llvm-cov to fail.
LL| |// Since these kinds functions can't be invoked anyway, it's ok to not have coverage data for them.
LL| |
LL| |// compile-flags: --edition=2021
LL| |
- LL| |enum Never { }
+ LL| |enum Never {}
LL| |
LL| |impl Never {
LL| | fn foo(self) {
- LL| | match self { }
- LL| | make().map(|never| match never { });
+ LL| | match self {}
+ LL| | make().map(|never| match never {});
LL| | }
LL| |
LL| | fn bar(&self) {
- LL| | match *self { }
+ LL| | match *self {}
LL| | }
LL| |}
LL| |
LL| 0|async fn foo2(never: Never) {
- LL| | match never { }
+ LL| | match never {}
LL| |}
LL| |
LL| 0|fn make() -> Option<Never> {
LL| 0| None
LL| 0|}
LL| |
- LL| 1|fn main() { }
+ LL| 1|fn main() {}
diff --git a/tests/run-coverage/issue-93054.rs b/tests/run-coverage/issue-93054.rs
index c160b3db0..da546cfee 100644
--- a/tests/run-coverage/issue-93054.rs
+++ b/tests/run-coverage/issue-93054.rs
@@ -1,28 +1,30 @@
+#![allow(dead_code, unreachable_code)]
+
// Regression test for #93054: Functions using uninhabited types often only have a single,
// unreachable basic block which doesn't get instrumented. This should not cause llvm-cov to fail.
// Since these kinds functions can't be invoked anyway, it's ok to not have coverage data for them.
// compile-flags: --edition=2021
-enum Never { }
+enum Never {}
impl Never {
fn foo(self) {
- match self { }
- make().map(|never| match never { });
+ match self {}
+ make().map(|never| match never {});
}
fn bar(&self) {
- match *self { }
+ match *self {}
}
}
async fn foo2(never: Never) {
- match never { }
+ match never {}
}
fn make() -> Option<Never> {
None
}
-fn main() { }
+fn main() {}
diff --git a/tests/run-coverage/lazy_boolean.coverage b/tests/run-coverage/lazy_boolean.coverage
index 2d927a083..8f14082ef 100644
--- a/tests/run-coverage/lazy_boolean.coverage
+++ b/tests/run-coverage/lazy_boolean.coverage
@@ -32,7 +32,7 @@
^0
LL| |
LL| | if
- LL| 1| !
+ LL| | !
LL| 1| is_true
LL| 0| {
LL| 0| a = 2
diff --git a/tests/run-coverage/loops_branches.coverage b/tests/run-coverage/loops_branches.coverage
index 148a22377..8cd6f1be3 100644
--- a/tests/run-coverage/loops_branches.coverage
+++ b/tests/run-coverage/loops_branches.coverage
@@ -9,8 +9,7 @@
LL| 1| fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
LL| 1| if true {
LL| 1| if false {
- LL| 0| while true {
- LL| 0| }
+ LL| 0| while true {}
LL| 1| }
LL| 1| write!(f, "cool")?;
^0
diff --git a/tests/run-coverage/loops_branches.rs b/tests/run-coverage/loops_branches.rs
index 7116ce47f..f3a343bcc 100644
--- a/tests/run-coverage/loops_branches.rs
+++ b/tests/run-coverage/loops_branches.rs
@@ -9,8 +9,7 @@ impl std::fmt::Debug for DebugTest {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
if true {
if false {
- while true {
- }
+ while true {}
}
write!(f, "cool")?;
} else {
diff --git a/tests/run-coverage/macro_name_span.coverage b/tests/run-coverage/macro_name_span.coverage
new file mode 100644
index 000000000..cadf70246
--- /dev/null
+++ b/tests/run-coverage/macro_name_span.coverage
@@ -0,0 +1,39 @@
+$DIR/auxiliary/macro_name_span_helper.rs:
+ LL| |// edition: 2021
+ LL| |
+ LL| |#[macro_export]
+ LL| |macro_rules! macro_that_defines_a_function {
+ LL| | (fn $name:ident () $body:tt) => {
+ LL| 1| fn $name () -> () $body
+ LL| | }
+ LL| |}
+ LL| |
+ LL| |// Non-executable comment.
+
+$DIR/macro_name_span.rs:
+ LL| |// edition: 2021
+ LL| |
+ LL| |// Regression test for <https://github.com/rust-lang/rust/issues/117788>.
+ LL| |// Under some circumstances, the heuristics that detect macro name spans can
+ LL| |// get confused and produce incorrect spans beyond the bounds of the span
+ LL| |// being processed.
+ LL| |
+ LL| |// aux-build: macro_name_span_helper.rs
+ LL| |extern crate macro_name_span_helper;
+ LL| |
+ LL| 1|fn main() {
+ LL| 1| affected_function();
+ LL| 1|}
+ LL| |
+ LL| |macro_rules! macro_with_an_unreasonably_and_egregiously_long_name {
+ LL| | () => {
+ LL| | println!("hello");
+ LL| | };
+ LL| |}
+ LL| |
+ LL| |macro_name_span_helper::macro_that_defines_a_function! {
+ LL| | fn affected_function() {
+ LL| | macro_with_an_unreasonably_and_egregiously_long_name!();
+ LL| | }
+ LL| |}
+
diff --git a/tests/run-coverage/macro_name_span.rs b/tests/run-coverage/macro_name_span.rs
new file mode 100644
index 000000000..5d15977c4
--- /dev/null
+++ b/tests/run-coverage/macro_name_span.rs
@@ -0,0 +1,25 @@
+// edition: 2021
+
+// Regression test for <https://github.com/rust-lang/rust/issues/117788>.
+// Under some circumstances, the heuristics that detect macro name spans can
+// get confused and produce incorrect spans beyond the bounds of the span
+// being processed.
+
+// aux-build: macro_name_span_helper.rs
+extern crate macro_name_span_helper;
+
+fn main() {
+ affected_function();
+}
+
+macro_rules! macro_with_an_unreasonably_and_egregiously_long_name {
+ () => {
+ println!("hello");
+ };
+}
+
+macro_name_span_helper::macro_that_defines_a_function! {
+ fn affected_function() {
+ macro_with_an_unreasonably_and_egregiously_long_name!();
+ }
+}
diff --git a/tests/run-coverage/match_or_pattern.coverage b/tests/run-coverage/match_or_pattern.coverage
index 0b5a2c03d..94c796721 100644
--- a/tests/run-coverage/match_or_pattern.coverage
+++ b/tests/run-coverage/match_or_pattern.coverage
@@ -1,5 +1,3 @@
- LL| |#![feature(or_patterns)]
- LL| |
LL| 1|fn main() {
LL| 1| // Initialize test constants in a way that cannot be determined at compile time, to ensure
LL| 1| // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
diff --git a/tests/run-coverage/match_or_pattern.rs b/tests/run-coverage/match_or_pattern.rs
index 4c6a8a9b7..ab7aee51d 100644
--- a/tests/run-coverage/match_or_pattern.rs
+++ b/tests/run-coverage/match_or_pattern.rs
@@ -1,5 +1,3 @@
-#![feature(or_patterns)]
-
fn main() {
// Initialize test constants in a way that cannot be determined at compile time, to ensure
// rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
diff --git a/tests/run-coverage/no_cov_crate.coverage b/tests/run-coverage/no_cov_crate.coverage
index c34dbde88..f5a0322bf 100644
--- a/tests/run-coverage/no_cov_crate.coverage
+++ b/tests/run-coverage/no_cov_crate.coverage
@@ -1,17 +1,18 @@
- LL| |// Enables `no_coverage` on the entire crate
- LL| |#![feature(no_coverage)]
+ LL| |// Enables `coverage(off)` on the entire crate
+ LL| |#![feature(coverage_attribute)]
LL| |
- LL| |#[no_coverage]
+ LL| |#[coverage(off)]
LL| |fn do_not_add_coverage_1() {
LL| | println!("called but not covered");
LL| |}
LL| |
LL| |fn do_not_add_coverage_2() {
- LL| | #![no_coverage]
+ LL| | #![coverage(off)]
LL| | println!("called but not covered");
LL| |}
LL| |
- LL| |#[no_coverage]
+ LL| |#[coverage(off)]
+ LL| |#[allow(dead_code)]
LL| |fn do_not_add_coverage_not_called() {
LL| | println!("not called and not covered");
LL| |}
@@ -24,6 +25,7 @@
LL| 1| println!("called and covered");
LL| 1|}
LL| |
+ LL| |#[allow(dead_code)]
LL| 0|fn add_coverage_not_called() {
LL| 0| println!("not called but covered");
LL| 0|}
@@ -31,7 +33,7 @@
LL| |// FIXME: These test-cases illustrate confusing results of nested functions.
LL| |// See https://github.com/rust-lang/rust/issues/93319
LL| |mod nested_fns {
- LL| | #[no_coverage]
+ LL| | #[coverage(off)]
LL| | pub fn outer_not_covered(is_true: bool) {
LL| 1| fn inner(is_true: bool) {
LL| 1| if is_true {
@@ -48,7 +50,7 @@
LL| 1| println!("called and covered");
LL| 1| inner_not_covered(is_true);
LL| 1|
- LL| 1| #[no_coverage]
+ LL| 1| #[coverage(off)]
LL| 1| fn inner_not_covered(is_true: bool) {
LL| 1| if is_true {
LL| 1| println!("called but not covered");
diff --git a/tests/run-coverage/no_cov_crate.rs b/tests/run-coverage/no_cov_crate.rs
index 0bfbdda2c..e12e4bc55 100644
--- a/tests/run-coverage/no_cov_crate.rs
+++ b/tests/run-coverage/no_cov_crate.rs
@@ -1,17 +1,18 @@
-// Enables `no_coverage` on the entire crate
-#![feature(no_coverage)]
+// Enables `coverage(off)` on the entire crate
+#![feature(coverage_attribute)]
-#[no_coverage]
+#[coverage(off)]
fn do_not_add_coverage_1() {
println!("called but not covered");
}
fn do_not_add_coverage_2() {
- #![no_coverage]
+ #![coverage(off)]
println!("called but not covered");
}
-#[no_coverage]
+#[coverage(off)]
+#[allow(dead_code)]
fn do_not_add_coverage_not_called() {
println!("not called and not covered");
}
@@ -24,6 +25,7 @@ fn add_coverage_2() {
println!("called and covered");
}
+#[allow(dead_code)]
fn add_coverage_not_called() {
println!("not called but covered");
}
@@ -31,7 +33,7 @@ fn add_coverage_not_called() {
// FIXME: These test-cases illustrate confusing results of nested functions.
// See https://github.com/rust-lang/rust/issues/93319
mod nested_fns {
- #[no_coverage]
+ #[coverage(off)]
pub fn outer_not_covered(is_true: bool) {
fn inner(is_true: bool) {
if is_true {
@@ -48,7 +50,7 @@ mod nested_fns {
println!("called and covered");
inner_not_covered(is_true);
- #[no_coverage]
+ #[coverage(off)]
fn inner_not_covered(is_true: bool) {
if is_true {
println!("called but not covered");
diff --git a/tests/run-coverage/overflow.coverage b/tests/run-coverage/overflow.coverage
index 2d60316e2..cee076e88 100644
--- a/tests/run-coverage/overflow.coverage
+++ b/tests/run-coverage/overflow.coverage
@@ -12,7 +12,7 @@
LL| 4| result
LL| 4|}
LL| |
- LL| 1|fn main() -> Result<(),u8> {
+ LL| 1|fn main() -> Result<(), u8> {
LL| 1| let mut countdown = 10;
LL| 11| while countdown > 0 {
LL| 11| if countdown == 1 {
diff --git a/tests/run-coverage/overflow.rs b/tests/run-coverage/overflow.rs
index 7df8de6f3..bbb65c1b3 100644
--- a/tests/run-coverage/overflow.rs
+++ b/tests/run-coverage/overflow.rs
@@ -12,7 +12,7 @@ fn might_overflow(to_add: u32) -> u32 {
result
}
-fn main() -> Result<(),u8> {
+fn main() -> Result<(), u8> {
let mut countdown = 10;
while countdown > 0 {
if countdown == 1 {
diff --git a/tests/run-coverage/try_error_result.coverage b/tests/run-coverage/try_error_result.coverage
index fcdb7437d..5d48cbd62 100644
--- a/tests/run-coverage/try_error_result.coverage
+++ b/tests/run-coverage/try_error_result.coverage
@@ -1,7 +1,7 @@
LL| |#![allow(unused_assignments)]
LL| |// failure-status: 1
LL| |
- LL| 6|fn call(return_error: bool) -> Result<(),()> {
+ LL| 6|fn call(return_error: bool) -> Result<(), ()> {
LL| 6| if return_error {
LL| 1| Err(())
LL| | } else {
@@ -9,7 +9,7 @@
LL| | }
LL| 6|}
LL| |
- LL| 1|fn test1() -> Result<(),()> {
+ LL| 1|fn test1() -> Result<(), ()> {
LL| 1| let mut
LL| 1| countdown = 10
LL| | ;
@@ -38,18 +38,18 @@
LL| |
LL| |struct Thing1;
LL| |impl Thing1 {
- LL| 18| fn get_thing_2(&self, return_error: bool) -> Result<Thing2,()> {
+ LL| 18| fn get_thing_2(&self, return_error: bool) -> Result<Thing2, ()> {
LL| 18| if return_error {
LL| 1| Err(())
LL| | } else {
- LL| 17| Ok(Thing2{})
+ LL| 17| Ok(Thing2 {})
LL| | }
LL| 18| }
LL| |}
LL| |
LL| |struct Thing2;
LL| |impl Thing2 {
- LL| 17| fn call(&self, return_error: bool) -> Result<u32,()> {
+ LL| 17| fn call(&self, return_error: bool) -> Result<u32, ()> {
LL| 17| if return_error {
LL| 2| Err(())
LL| | } else {
@@ -58,7 +58,7 @@
LL| 17| }
LL| |}
LL| |
- LL| 1|fn test2() -> Result<(),()> {
+ LL| 1|fn test2() -> Result<(), ()> {
LL| 1| let thing1 = Thing1{};
LL| 1| let mut
LL| 1| countdown = 10
@@ -115,7 +115,7 @@
LL| 0| Ok(())
LL| 1|}
LL| |
- LL| 1|fn main() -> Result<(),()> {
+ LL| 1|fn main() -> Result<(), ()> {
LL| 1| test1().expect_err("test1 should fail");
LL| 1| test2()
LL| 1| ?
diff --git a/tests/run-coverage/try_error_result.rs b/tests/run-coverage/try_error_result.rs
index 9eb1d2db2..557cbf22b 100644
--- a/tests/run-coverage/try_error_result.rs
+++ b/tests/run-coverage/try_error_result.rs
@@ -1,7 +1,7 @@
#![allow(unused_assignments)]
// failure-status: 1
-fn call(return_error: bool) -> Result<(),()> {
+fn call(return_error: bool) -> Result<(), ()> {
if return_error {
Err(())
} else {
@@ -9,7 +9,7 @@ fn call(return_error: bool) -> Result<(),()> {
}
}
-fn test1() -> Result<(),()> {
+fn test1() -> Result<(), ()> {
let mut
countdown = 10
;
@@ -37,18 +37,18 @@ fn test1() -> Result<(),()> {
struct Thing1;
impl Thing1 {
- fn get_thing_2(&self, return_error: bool) -> Result<Thing2,()> {
+ fn get_thing_2(&self, return_error: bool) -> Result<Thing2, ()> {
if return_error {
Err(())
} else {
- Ok(Thing2{})
+ Ok(Thing2 {})
}
}
}
struct Thing2;
impl Thing2 {
- fn call(&self, return_error: bool) -> Result<u32,()> {
+ fn call(&self, return_error: bool) -> Result<u32, ()> {
if return_error {
Err(())
} else {
@@ -57,7 +57,7 @@ impl Thing2 {
}
}
-fn test2() -> Result<(),()> {
+fn test2() -> Result<(), ()> {
let thing1 = Thing1{};
let mut
countdown = 10
@@ -109,7 +109,7 @@ fn test2() -> Result<(),()> {
Ok(())
}
-fn main() -> Result<(),()> {
+fn main() -> Result<(), ()> {
test1().expect_err("test1 should fail");
test2()
?
diff --git a/tests/run-coverage/unused.coverage b/tests/run-coverage/unused.coverage
index ba25e34bf..056ffeb02 100644
--- a/tests/run-coverage/unused.coverage
+++ b/tests/run-coverage/unused.coverage
@@ -1,3 +1,5 @@
+ LL| |#![allow(dead_code, unused_assignments, unused_must_use, unused_variables)]
+ LL| |
LL| 2|fn foo<T>(x: T) {
LL| 2| let mut i = 0;
LL| 22| while i < 10 {
diff --git a/tests/run-coverage/unused.rs b/tests/run-coverage/unused.rs
index fb6113eb0..d985af135 100644
--- a/tests/run-coverage/unused.rs
+++ b/tests/run-coverage/unused.rs
@@ -1,3 +1,5 @@
+#![allow(dead_code, unused_assignments, unused_must_use, unused_variables)]
+
fn foo<T>(x: T) {
let mut i = 0;
while i < 10 {
diff --git a/tests/run-coverage/unused_mod.coverage b/tests/run-coverage/unused_mod.coverage
index 558dfaa5c..a8fa24ac6 100644
--- a/tests/run-coverage/unused_mod.coverage
+++ b/tests/run-coverage/unused_mod.coverage
@@ -1,4 +1,5 @@
$DIR/auxiliary/unused_mod_helper.rs:
+ LL| |#[allow(dead_code)]
LL| 0|pub fn never_called_function() {
LL| 0| println!("I am never called");
LL| 0|}
diff --git a/tests/run-coverage/uses_crate.coverage b/tests/run-coverage/uses_crate.coverage
index 9da096dbd..50d92102a 100644
--- a/tests/run-coverage/uses_crate.coverage
+++ b/tests/run-coverage/uses_crate.coverage
@@ -1,7 +1,9 @@
$DIR/auxiliary/used_crate.rs:
LL| |#![allow(unused_assignments, unused_variables)]
+ LL| |// Verify that coverage works with optimizations:
LL| |// compile-flags: -C opt-level=3
- LL| |use std::fmt::Debug; // ^^ validates coverage now works with optimizations
+ LL| |
+ LL| |use std::fmt::Debug;
LL| |
LL| 1|pub fn used_function() {
LL| 1| // Initialize test constants in a way that cannot be determined at compile time, to ensure
@@ -90,6 +92,7 @@ $DIR/auxiliary/used_crate.rs:
LL| 0| }
LL| 0|}
LL| |
+ LL| |#[allow(dead_code)]
LL| 0|fn unused_private_function() {
LL| 0| let is_true = std::env::args().len() == 1;
LL| 0| let mut countdown = 2;
diff --git a/tests/run-coverage/uses_inline_crate.coverage b/tests/run-coverage/uses_inline_crate.coverage
index 48493e207..cc0e01ffd 100644
--- a/tests/run-coverage/uses_inline_crate.coverage
+++ b/tests/run-coverage/uses_inline_crate.coverage
@@ -1,8 +1,8 @@
$DIR/auxiliary/used_inline_crate.rs:
LL| |#![allow(unused_assignments, unused_variables)]
- LL| |
+ LL| |// Verify that coverage works with optimizations:
LL| |// compile-flags: -C opt-level=3
- LL| |// ^^ validates coverage now works with optimizations
+ LL| |
LL| |use std::fmt::Debug;
LL| |
LL| 1|pub fn used_function() {
@@ -32,12 +32,6 @@ $DIR/auxiliary/used_inline_crate.rs:
LL| 1| use_this_lib_crate();
LL| 1|}
LL| |
- LL| |
- LL| |
- LL| |
- LL| |
- LL| |
- LL| |
LL| |#[inline(always)]
LL| 2|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) {
LL| 2| println!("used_only_from_bin_crate_generic_function with {:?}", arg);
@@ -120,6 +114,7 @@ $DIR/auxiliary/used_inline_crate.rs:
LL| 0|}
LL| |
LL| |#[inline(always)]
+ LL| |#[allow(dead_code)]
LL| 0|fn unused_private_function() {
LL| 0| let is_true = std::env::args().len() == 1;
LL| 0| let mut countdown = 2;
diff --git a/tests/run-coverage/while_early_ret.coverage b/tests/run-coverage/while_early_ret.coverage
index 97808447a..49d39d366 100644
--- a/tests/run-coverage/while_early_ret.coverage
+++ b/tests/run-coverage/while_early_ret.coverage
@@ -1,7 +1,7 @@
LL| |#![allow(unused_assignments)]
LL| |// failure-status: 1
LL| |
- LL| 1|fn main() -> Result<(),u8> {
+ LL| 1|fn main() -> Result<(), u8> {
LL| 1| let mut countdown = 10;
LL| | while
LL| 7| countdown
diff --git a/tests/run-coverage/while_early_ret.rs b/tests/run-coverage/while_early_ret.rs
index 1c83c8fc7..b2f0eee2c 100644
--- a/tests/run-coverage/while_early_ret.rs
+++ b/tests/run-coverage/while_early_ret.rs
@@ -1,7 +1,7 @@
#![allow(unused_assignments)]
// failure-status: 1
-fn main() -> Result<(),u8> {
+fn main() -> Result<(), u8> {
let mut countdown = 10;
while
countdown
diff --git a/tests/run-coverage/yield.coverage b/tests/run-coverage/yield.coverage
index 383dd9915..90c2641a7 100644
--- a/tests/run-coverage/yield.coverage
+++ b/tests/run-coverage/yield.coverage
@@ -7,7 +7,7 @@
LL| 1|fn main() {
LL| 1| let mut generator = || {
LL| 1| yield 1;
- LL| 1| return "foo"
+ LL| 1| return "foo";
LL| 1| };
LL| |
LL| 1| match Pin::new(&mut generator).resume(()) {
@@ -23,7 +23,7 @@
LL| 1| yield 1;
LL| 1| yield 2;
LL| 0| yield 3;
- LL| 0| return "foo"
+ LL| 0| return "foo";
LL| 0| };
LL| |
LL| 1| match Pin::new(&mut generator).resume(()) {
diff --git a/tests/run-coverage/yield.rs b/tests/run-coverage/yield.rs
index ff7616656..361275c92 100644
--- a/tests/run-coverage/yield.rs
+++ b/tests/run-coverage/yield.rs
@@ -7,7 +7,7 @@ use std::pin::Pin;
fn main() {
let mut generator = || {
yield 1;
- return "foo"
+ return "foo";
};
match Pin::new(&mut generator).resume(()) {
@@ -23,7 +23,7 @@ fn main() {
yield 1;
yield 2;
yield 3;
- return "foo"
+ return "foo";
};
match Pin::new(&mut generator).resume(()) {
diff --git a/tests/run-make-fulldeps/issue-19371/foo.rs b/tests/run-make-fulldeps/issue-19371/foo.rs
index 681326387..1c9d33dcc 100644
--- a/tests/run-make-fulldeps/issue-19371/foo.rs
+++ b/tests/run-make-fulldeps/issue-19371/foo.rs
@@ -61,6 +61,7 @@ fn compile(code: String, output: PathBuf, sysroot: PathBuf) {
override_queries: None,
make_codegen_backend: None,
registry: rustc_driver::diagnostics_registry(),
+ expanded_args: Default::default(),
};
interface::run_compiler(config, |compiler| {
diff --git a/tests/run-make-fulldeps/obtain-borrowck/driver.rs b/tests/run-make-fulldeps/obtain-borrowck/driver.rs
index 04c551cf4..5df4c558e 100644
--- a/tests/run-make-fulldeps/obtain-borrowck/driver.rs
+++ b/tests/run-make-fulldeps/obtain-borrowck/driver.rs
@@ -25,9 +25,9 @@ use rustc_hir::def_id::LocalDefId;
use rustc_interface::interface::Compiler;
use rustc_interface::{Config, Queries};
use rustc_middle::query::queries::mir_borrowck::ProvidedValue;
-use rustc_middle::query::{ExternProviders, Providers};
use rustc_middle::ty::TyCtxt;
-use rustc_session::{Session, EarlyErrorHandler};
+use rustc_middle::util::Providers;
+use rustc_session::Session;
use std::cell::RefCell;
use std::collections::HashMap;
use std::thread_local;
@@ -58,7 +58,6 @@ impl rustc_driver::Callbacks for CompilerCalls {
// the result.
fn after_analysis<'tcx>(
&mut self,
- _handler: &EarlyErrorHandler,
compiler: &Compiler,
queries: &'tcx Queries<'tcx>,
) -> Compilation {
@@ -111,7 +110,7 @@ impl rustc_driver::Callbacks for CompilerCalls {
}
}
-fn override_queries(_session: &Session, local: &mut Providers, _external: &mut ExternProviders) {
+fn override_queries(_session: &Session, local: &mut Providers) {
local.mir_borrowck = mir_borrowck;
}
diff --git a/tests/run-make/compressed-debuginfo/Makefile b/tests/run-make/compressed-debuginfo/Makefile
new file mode 100644
index 000000000..f9e4927d0
--- /dev/null
+++ b/tests/run-make/compressed-debuginfo/Makefile
@@ -0,0 +1,15 @@
+# ignore-cross-compile
+include ../tools.mk
+
+# only-linux
+# min-llvm-version: 16.0
+#
+# This tests debuginfo-compression.
+
+all: zlib zstandard
+
+zlib:
+ test "`$(RUSTC) --crate-name=foo --crate-type=lib --emit=obj -C debuginfo=full -Z debuginfo-compression=zlib foo.rs 2>&1 | sed 's/.*unknown.*zlib.*/missing/' | head -n 1`" = missing || readelf -t $(TMPDIR)/foo.o | grep -q ZLIB
+
+zstandard:
+ test "`$(RUSTC) --crate-name=foo --crate-type=lib --emit=obj -C debuginfo=full -Z debuginfo-compression=zstd foo.rs 2>&1 | sed 's/.*unknown.*zstd.*/missing/' | head -n 1`" = missing || readelf -t $(TMPDIR)/foo.o | grep -q ZST
diff --git a/tests/run-make/compressed-debuginfo/foo.rs b/tests/run-make/compressed-debuginfo/foo.rs
new file mode 100644
index 000000000..185ce2245
--- /dev/null
+++ b/tests/run-make/compressed-debuginfo/foo.rs
@@ -0,0 +1,3 @@
+pub fn foo() -> i32 {
+ 42
+}
diff --git a/tests/run-make/emit-path-unhashed/Makefile b/tests/run-make/emit-path-unhashed/Makefile
index 74047fe5f..611f85781 100644
--- a/tests/run-make/emit-path-unhashed/Makefile
+++ b/tests/run-make/emit-path-unhashed/Makefile
@@ -5,10 +5,10 @@ OUT=$(TMPDIR)/emit
# --emit KIND=PATH should not affect crate hash vs --emit KIND
all: $(OUT)/a/libfoo.rlib $(OUT)/b/libfoo.rlib $(OUT)/c/libfoo.rlib \
$(TMPDIR)/libfoo.rlib
- $(RUSTC) -Zls $(TMPDIR)/libfoo.rlib > $(TMPDIR)/base.txt
- $(RUSTC) -Zls $(OUT)/a/libfoo.rlib > $(TMPDIR)/a.txt
- $(RUSTC) -Zls $(OUT)/b/libfoo.rlib > $(TMPDIR)/b.txt
- $(RUSTC) -Zls $(OUT)/c/libfoo.rlib > $(TMPDIR)/c.txt
+ $(RUSTC) -Zls=root $(TMPDIR)/libfoo.rlib > $(TMPDIR)/base.txt
+ $(RUSTC) -Zls=root $(OUT)/a/libfoo.rlib > $(TMPDIR)/a.txt
+ $(RUSTC) -Zls=root $(OUT)/b/libfoo.rlib > $(TMPDIR)/b.txt
+ $(RUSTC) -Zls=root $(OUT)/c/libfoo.rlib > $(TMPDIR)/c.txt
diff $(TMPDIR)/base.txt $(TMPDIR)/a.txt
diff $(TMPDIR)/base.txt $(TMPDIR)/b.txt
diff --git a/tests/run-make/incr-foreign-head-span/Makefile b/tests/run-make/incr-foreign-head-span/Makefile
index 9d6102cdd..9be4b0f60 100644
--- a/tests/run-make/incr-foreign-head-span/Makefile
+++ b/tests/run-make/incr-foreign-head-span/Makefile
@@ -15,7 +15,7 @@ INCR=$(TMPDIR)/incr
all:
cp first_crate.rs second_crate.rs $(TMPDIR)
$(RUSTC) $(TMPDIR)/first_crate.rs -C incremental=$(INCR) --target $(TARGET) --crate-type lib
- $(RUSTC) $(TMPDIR)/second_crate.rs -C incremental=$(INCR) --target $(TARGET) --extern first-crate=$(TMPDIR) --crate-type lib
+ $(RUSTC) $(TMPDIR)/second_crate.rs -C incremental=$(INCR) --target $(TARGET) --extern first_crate=$(TMPDIR)/libfirst_crate.rlib --crate-type lib
rm $(TMPDIR)/first_crate.rs
$(RUSTC) $(TMPDIR)/second_crate.rs -C incremental=$(INCR) --target $(TARGET) --cfg second_run --crate-type lib
diff --git a/tests/run-make/issue-88756-default-output/output-default.stdout b/tests/run-make/issue-88756-default-output/output-default.stdout
index b28069823..38a3965f0 100644
--- a/tests/run-make/issue-88756-default-output/output-default.stdout
+++ b/tests/run-make/issue-88756-default-output/output-default.stdout
@@ -100,7 +100,7 @@ Options:
check if given theme is valid
--resource-suffix PATH
suffix to add to CSS and JavaScript files, e.g.,
- "light.css" will become "light-suffix.css"
+ "search-index.js" will become "search-index-suffix.js"
--edition EDITION
edition to use when compiling rust code (default:
2015)
@@ -133,9 +133,6 @@ Options:
Path string to force loading static files from in
output pages. If not set, uses combinations of '../'
to reach the documentation root.
- --disable-per-crate-search
- disables generating the crate selector on the search
- box
--persist-doctests PATH
Directory to persist doctest executables into
--show-coverage
@@ -191,6 +188,8 @@ Options:
removed, see issue #44136
<https://github.com/rust-lang/rust/issues/44136> for
more information
+ --html-no-source
+ Disable HTML source code pages generation
@path Read newline separated options from `path`
diff --git a/tests/run-make/ls-metadata/Makefile b/tests/run-make/ls-metadata/Makefile
index 123dd64e1..f03569bae 100644
--- a/tests/run-make/ls-metadata/Makefile
+++ b/tests/run-make/ls-metadata/Makefile
@@ -3,6 +3,6 @@ include ../tools.mk
all:
$(RUSTC) foo.rs
- $(RUSTC) -Z ls $(TMPDIR)/foo
+ $(RUSTC) -Z ls=root $(TMPDIR)/foo
touch $(TMPDIR)/bar
- $(RUSTC) -Z ls $(TMPDIR)/bar
+ $(RUSTC) -Z ls=root $(TMPDIR)/bar
diff --git a/tests/run-make/lto-linkage-used-attr/Makefile b/tests/run-make/lto-linkage-used-attr/Makefile
new file mode 100644
index 000000000..e78b83890
--- /dev/null
+++ b/tests/run-make/lto-linkage-used-attr/Makefile
@@ -0,0 +1,9 @@
+include ../tools.mk
+
+# Verify that the impl_* symbols are preserved. #108030
+# only-x86_64-unknown-linux-gnu
+# min-llvm-version: 17
+
+all:
+ $(RUSTC) -Cdebuginfo=0 -Copt-level=3 lib.rs
+ $(RUSTC) -Clto=fat -Cdebuginfo=0 -Copt-level=3 main.rs
diff --git a/tests/run-make/lto-linkage-used-attr/lib.rs b/tests/run-make/lto-linkage-used-attr/lib.rs
new file mode 100644
index 000000000..0a92ea9cd
--- /dev/null
+++ b/tests/run-make/lto-linkage-used-attr/lib.rs
@@ -0,0 +1,50 @@
+#![crate_type = "rlib"]
+#![crate_type = "cdylib"]
+
+#[macro_export]
+macro_rules! asm_func {
+ ($name:expr, $body:expr $(, $($args:tt)*)?) => {
+ core::arch::global_asm!(
+ concat!(
+ ".p2align 4\n",
+ ".hidden ", $name, "\n",
+ ".global ", $name, "\n",
+ ".type ", $name, ",@function\n",
+ $name, ":\n",
+ $body,
+ ".size ", $name, ",.-", $name,
+ )
+ $(, $($args)*)?
+ );
+ };
+}
+
+macro_rules! libcall_trampoline {
+ ($libcall:ident ; $libcall_impl:ident) => {
+ asm_func!(
+ stringify!($libcall),
+ concat!(
+ "
+ .cfi_startproc simple
+ .cfi_def_cfa_offset 0
+ jmp {}
+ .cfi_endproc
+ ",
+ ),
+ sym $libcall_impl
+ );
+ };
+}
+
+pub mod trampolines {
+ extern "C" {
+ pub fn table_fill_funcref();
+ pub fn table_fill_externref();
+ }
+
+ unsafe extern "C" fn impl_table_fill_funcref() {}
+ unsafe extern "C" fn impl_table_fill_externref() {}
+
+ libcall_trampoline!(table_fill_funcref ; impl_table_fill_funcref);
+ libcall_trampoline!(table_fill_externref ; impl_table_fill_externref);
+}
diff --git a/tests/run-make/lto-linkage-used-attr/main.rs b/tests/run-make/lto-linkage-used-attr/main.rs
new file mode 100644
index 000000000..256b02e5b
--- /dev/null
+++ b/tests/run-make/lto-linkage-used-attr/main.rs
@@ -0,0 +1,10 @@
+extern crate lib;
+
+use lib::trampolines::*;
+
+fn main() {
+ unsafe {
+ table_fill_externref();
+ table_fill_funcref();
+ }
+}
diff --git a/tests/run-make/macos-deployment-target/Makefile b/tests/run-make/macos-deployment-target/Makefile
index d0cf836bc..757ca6995 100644
--- a/tests/run-make/macos-deployment-target/Makefile
+++ b/tests/run-make/macos-deployment-target/Makefile
@@ -9,12 +9,12 @@ include ../tools.mk
ifeq ($(strip $(shell uname -m)),arm64)
GREP_PATTERN = "minos 11.0"
else
- GREP_PATTERN = "version 10.9"
+ GREP_PATTERN = "version 10.13"
endif
OUT_FILE=$(TMPDIR)/with_deployment_target.dylib
all:
- env MACOSX_DEPLOYMENT_TARGET=10.9 $(RUSTC) with_deployment_target.rs -o $(OUT_FILE)
+ env MACOSX_DEPLOYMENT_TARGET=10.13 $(RUSTC) with_deployment_target.rs -o $(OUT_FILE)
# XXX: The check is for either the x86_64 minimum OR the aarch64 minimum (M1 starts at macOS 11).
# They also use different load commands, so we let that change with each too. The aarch64 check
# isn't as robust as the x86 one, but testing both seems unneeded.
diff --git a/tests/run-make/metadata-dep-info/Makefile b/tests/run-make/metadata-dep-info/Makefile
new file mode 100644
index 000000000..f9043f214
--- /dev/null
+++ b/tests/run-make/metadata-dep-info/Makefile
@@ -0,0 +1,13 @@
+include ../tools.mk
+
+ifdef RUSTC_BLESS_TEST
+ RUSTC_TEST_OP = cp
+else
+ RUSTC_TEST_OP = $(DIFF)
+endif
+
+all:
+ $(RUSTC) --emit=metadata,dep-info --crate-type lib dash-separated.rs -C extra-filename=_something-extra
+ # Strip TMPDIR since it is a machine specific absolute path
+ sed "s%.*[/\\]%%" "$(TMPDIR)"/dash-separated_something-extra.d > "$(TMPDIR)"/dash-separated_something-extra.normalized.d
+ $(RUSTC_TEST_OP) "$(TMPDIR)"/dash-separated_something-extra.normalized.d dash-separated_something-extra.normalized.d
diff --git a/tests/run-make/metadata-dep-info/dash-separated.rs b/tests/run-make/metadata-dep-info/dash-separated.rs
new file mode 100644
index 000000000..4202afd3d
--- /dev/null
+++ b/tests/run-make/metadata-dep-info/dash-separated.rs
@@ -0,0 +1,4 @@
+//! It is important that this file has at least one `-` in the file name since
+//! we want to test that it becomes a `_` when appropriate.
+
+pub struct Foo;
diff --git a/tests/run-make/metadata-dep-info/dash-separated_something-extra.normalized.d b/tests/run-make/metadata-dep-info/dash-separated_something-extra.normalized.d
new file mode 100644
index 000000000..497d76b4e
--- /dev/null
+++ b/tests/run-make/metadata-dep-info/dash-separated_something-extra.normalized.d
@@ -0,0 +1,5 @@
+libdash_separated_something-extra.rmeta: dash-separated.rs
+
+dash-separated_something-extra.d: dash-separated.rs
+
+dash-separated.rs:
diff --git a/tests/run-make/output-filename-overwrites-input/Makefile b/tests/run-make/output-filename-overwrites-input/Makefile
index 605b86b25..fe5d23138 100644
--- a/tests/run-make/output-filename-overwrites-input/Makefile
+++ b/tests/run-make/output-filename-overwrites-input/Makefile
@@ -8,7 +8,7 @@ all:
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
+ $(RUSTC) foo.rs 2>&1 && $(RUSTC) -Z ls=root $(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/pdb-buildinfo-cl-cmd/Makefile b/tests/run-make/pdb-buildinfo-cl-cmd/Makefile
new file mode 100644
index 000000000..a7be301a5
--- /dev/null
+++ b/tests/run-make/pdb-buildinfo-cl-cmd/Makefile
@@ -0,0 +1,16 @@
+include ../tools.mk
+
+# only-windows-msvc
+
+# tests if the pdb contains the following information in the LF_BUILDINFO:
+# 1. the commandline args to compile it (cmd)
+# 2. full path to the compiler (cl)
+
+# we just do a stringsearch on the pdb, as these need to show up at least once, as the LF_BUILDINFO is created for each cgu
+# actual parsing would be better, but this is a simple and good enough solution for now
+
+all:
+ $(RUSTC_ORIGINAL) main.rs -g --crate-name my_crate_name --crate-type bin -C metadata=dc9ef878b0a48666 --out-dir $(TMPDIR)
+ cat '$(TMPDIR)/my_crate_name.pdb' | grep -F '$(RUSTC_ORIGINAL)'
+# using a file containing the string so I don't have problems with escaping quotes and spaces
+ cat '$(TMPDIR)/my_crate_name.pdb' | grep -f 'stringlist.txt'
diff --git a/tests/run-make/pdb-buildinfo-cl-cmd/main.rs b/tests/run-make/pdb-buildinfo-cl-cmd/main.rs
new file mode 100644
index 000000000..f79c691f0
--- /dev/null
+++ b/tests/run-make/pdb-buildinfo-cl-cmd/main.rs
@@ -0,0 +1,2 @@
+fn main() {
+}
diff --git a/tests/run-make/pdb-buildinfo-cl-cmd/stringlist.txt b/tests/run-make/pdb-buildinfo-cl-cmd/stringlist.txt
new file mode 100644
index 000000000..634e9f19e
--- /dev/null
+++ b/tests/run-make/pdb-buildinfo-cl-cmd/stringlist.txt
@@ -0,0 +1 @@
+"main.rs" "-g" "--crate-name" "my_crate_name" "--crate-type" "bin" "-C" "metadata=dc9ef878b0a48666" "--out-dir" \ No newline at end of file
diff --git a/tests/run-make/pgo-branch-weights/Makefile b/tests/run-make/pgo-branch-weights/Makefile
index c60206a1f..4c9f8b249 100644
--- a/tests/run-make/pgo-branch-weights/Makefile
+++ b/tests/run-make/pgo-branch-weights/Makefile
@@ -1,5 +1,6 @@
# needs-profiler-support
# ignore-windows-gnu
+# ignore-cross-compile
# 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.
diff --git a/tests/run-make/pgo-gen-lto/Makefile b/tests/run-make/pgo-gen-lto/Makefile
index 3f2f6a838..8b647846a 100644
--- a/tests/run-make/pgo-gen-lto/Makefile
+++ b/tests/run-make/pgo-gen-lto/Makefile
@@ -1,5 +1,6 @@
# needs-profiler-support
# ignore-windows-gnu
+# ignore-cross-compile
# 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.
diff --git a/tests/run-make/pgo-gen/Makefile b/tests/run-make/pgo-gen/Makefile
index 4623a7495..bf32cfdb8 100644
--- a/tests/run-make/pgo-gen/Makefile
+++ b/tests/run-make/pgo-gen/Makefile
@@ -1,5 +1,6 @@
# needs-profiler-support
# ignore-windows-gnu
+# ignore-cross-compile
# 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.
diff --git a/tests/run-make/pgo-indirect-call-promotion/Makefile b/tests/run-make/pgo-indirect-call-promotion/Makefile
index 45302215c..542eb244d 100644
--- a/tests/run-make/pgo-indirect-call-promotion/Makefile
+++ b/tests/run-make/pgo-indirect-call-promotion/Makefile
@@ -1,5 +1,6 @@
# needs-profiler-support
# ignore-windows-gnu
+# ignore-cross-compile
# 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.
diff --git a/tests/run-make/pgo-use/Makefile b/tests/run-make/pgo-use/Makefile
index 3bac9b77a..9f440118d 100644
--- a/tests/run-make/pgo-use/Makefile
+++ b/tests/run-make/pgo-use/Makefile
@@ -1,5 +1,6 @@
# needs-profiler-support
# ignore-windows-gnu
+# ignore-cross-compile
# 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.
diff --git a/tests/run-make/pointer-auth-link-with-c/Makefile b/tests/run-make/pointer-auth-link-with-c/Makefile
index dffbd3035..8fcf10e20 100644
--- a/tests/run-make/pointer-auth-link-with-c/Makefile
+++ b/tests/run-make/pointer-auth-link-with-c/Makefile
@@ -1,6 +1,7 @@
include ../tools.mk
# only-aarch64
+# ignore-cross-compile
all:
$(COMPILE_OBJ) $(TMPDIR)/test.o test.c
diff --git a/tests/run-make/print-cfg/Makefile b/tests/run-make/print-cfg/Makefile
index 654c303b3..6b153e5b5 100644
--- a/tests/run-make/print-cfg/Makefile
+++ b/tests/run-make/print-cfg/Makefile
@@ -13,19 +13,19 @@ all: default output_to_file
output_to_file:
# Backend-independent, printed by rustc_driver_impl/src/lib.rs
- $(RUSTC) --target x86_64-pc-windows-gnu --print cfg=$(TMPDIR)/cfg.txt -Z unstable-options
+ $(RUSTC) --target x86_64-pc-windows-gnu --print cfg=$(TMPDIR)/cfg.txt
$(CGREP) windows < $(TMPDIR)/cfg.txt
# Printed from CodegenBackend trait impl in rustc_codegen_llvm/src/lib.rs
- $(RUSTC) --print relocation-models=$(TMPDIR)/relocation-models.txt -Z unstable-options
+ $(RUSTC) --print relocation-models=$(TMPDIR)/relocation-models.txt
$(CGREP) dynamic-no-pic < $(TMPDIR)/relocation-models.txt
# Printed by compiler/rustc_codegen_llvm/src/llvm_util.rs
- $(RUSTC) --target wasm32-unknown-unknown --print target-features=$(TMPDIR)/target-features.txt -Z unstable-options
+ $(RUSTC) --target wasm32-unknown-unknown --print target-features=$(TMPDIR)/target-features.txt
$(CGREP) reference-types < $(TMPDIR)/target-features.txt
# Printed by C++ code in rustc_llvm/llvm-wrapper/PassWrapper.cpp
- $(RUSTC) --target wasm32-unknown-unknown --print target-cpus=$(TMPDIR)/target-cpus.txt -Z unstable-options
+ $(RUSTC) --target wasm32-unknown-unknown --print target-cpus=$(TMPDIR)/target-cpus.txt
$(CGREP) generic < $(TMPDIR)/target-cpus.txt
ifdef IS_WINDOWS
diff --git a/tests/run-make/profile/Makefile b/tests/run-make/profile/Makefile
index fffc051ad..7919b18ba 100644
--- a/tests/run-make/profile/Makefile
+++ b/tests/run-make/profile/Makefile
@@ -1,4 +1,5 @@
# needs-profiler-support
+# ignore-cross-compile
include ../tools.mk
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 1f2812cb0..9ba077b18 100644
--- a/tests/run-make/rlib-format-packed-bundled-libs-3/Makefile
+++ b/tests/run-make/rlib-format-packed-bundled-libs-3/Makefile
@@ -3,7 +3,7 @@ include ../tools.mk
# ignore-cross-compile
# only-linux
-# Make sure -Zpacked_bundled_libs-like behavior activates with whole-archive.
+# Make sure -Zpacked_bundled_libs-like behavior activates with +bundle,+whole-archive.
# We're using the llvm-nm instead of the system nm to ensure it is compatible
# with the LLVM bitcode generated by rustc.
@@ -11,7 +11,7 @@ NM = "$(LLVM_BIN_DIR)"/llvm-nm
all: $(call NATIVE_STATICLIB,native_dep_1) $(call NATIVE_STATICLIB,native_dep_2) $(call NATIVE_STATICLIB,native_dep_3) $(call NATIVE_STATICLIB,native_dep_4)
# test cfg with packed bundle
- $(RUSTC) rust_dep_cfg.rs --crate-type=rlib -Zpacked_bundled_libs
+ $(RUSTC) rust_dep_cfg.rs --crate-type=rlib
$(RUSTC) main.rs --extern rust_dep=$(TMPDIR)/librust_dep_cfg.rlib --crate-type=staticlib --cfg should_add
$(AR) t $(TMPDIR)/librust_dep_cfg.rlib | $(CGREP) -e "libnative_dep_1.a"
$(AR) t $(TMPDIR)/librust_dep_cfg.rlib | $(CGREP) -e "libnative_dep_2.a"
diff --git a/tests/run-make/rlib-format-packed-bundled-libs-3/rust_dep.rs b/tests/run-make/rlib-format-packed-bundled-libs-3/rust_dep.rs
index abd846b68..bde9b739d 100644
--- a/tests/run-make/rlib-format-packed-bundled-libs-3/rust_dep.rs
+++ b/tests/run-make/rlib-format-packed-bundled-libs-3/rust_dep.rs
@@ -1,5 +1,3 @@
-#![feature(packed_bundled_libs)]
-
#[link(name = "native_dep_1", kind = "static", modifiers = "+whole-archive,+bundle")]
extern "C" {}
diff --git a/tests/run-make/rustdoc-themes/Makefile b/tests/run-make/rustdoc-themes/Makefile
index a6d9a43ad..a4980eb0b 100644
--- a/tests/run-make/rustdoc-themes/Makefile
+++ b/tests/run-make/rustdoc-themes/Makefile
@@ -5,6 +5,7 @@ include ../tools.mk
OUTPUT_DIR := "$(TMPDIR)/rustdoc-themes"
all:
- cp $(S)/src/librustdoc/html/static/css/themes/light.css $(TMPDIR)/test.css
+ awk '/Begin theme: light/ {in_theme=1;next} /End theme:/ {in_theme=0} { if (in_theme) print }' \
+ < '$(S)/src/librustdoc/html/static/css/noscript.css' > '$(TMPDIR)/test.css'
$(RUSTDOC) -o $(OUTPUT_DIR) foo.rs --theme $(TMPDIR)/test.css
$(HTMLDOCCK) $(OUTPUT_DIR) foo.rs
diff --git a/tests/rustdoc-gui/code-color.goml b/tests/rustdoc-gui/code-color.goml
index 833fa05db..92bdfb25b 100644
--- a/tests/rustdoc-gui/code-color.goml
+++ b/tests/rustdoc-gui/code-color.goml
@@ -19,6 +19,18 @@ define-function: (
},
)
-call-function: ("check-colors", ("ayu", "rgb(230, 225, 207)", "rgb(255, 180, 84)"))
-call-function: ("check-colors", ("dark", "rgb(221, 221, 221)", "rgb(221, 221, 221)"))
-call-function: ("check-colors", ("light", "rgb(0, 0, 0)", "rgb(0, 0, 0)"))
+call-function: ("check-colors", {
+ "theme": "ayu",
+ "doc_code_color": "#e6e1cf",
+ "doc_inline_code_color": "#ffb454",
+})
+call-function: ("check-colors", {
+ "theme": "dark",
+ "doc_code_color": "#ddd",
+ "doc_inline_code_color": "#ddd",
+})
+call-function: ("check-colors", {
+ "theme": "light",
+ "doc_code_color": "black",
+ "doc_inline_code_color": "black",
+})
diff --git a/tests/rustdoc-gui/default-settings.goml b/tests/rustdoc-gui/default-settings.goml
index 3466f3693..ff4abb65c 100644
--- a/tests/rustdoc-gui/default-settings.goml
+++ b/tests/rustdoc-gui/default-settings.goml
@@ -5,4 +5,4 @@
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)"})
+wait-for-css: ("body", {"background-color": "#0f1419"})
diff --git a/tests/rustdoc-gui/docblock-table.goml b/tests/rustdoc-gui/docblock-table.goml
index 011451ef4..678b302f2 100644
--- a/tests/rustdoc-gui/docblock-table.goml
+++ b/tests/rustdoc-gui/docblock-table.goml
@@ -36,17 +36,17 @@ define-function: (
)
call-function: ("check-colors", {
- "theme": "dark",
- "border_color": "rgb(224, 224, 224)",
- "zebra_stripe_color": "rgb(42, 42, 42)",
+ "theme": "ayu",
+ "border_color": "#5c6773",
+ "zebra_stripe_color": "#191f26",
})
call-function: ("check-colors", {
- "theme": "ayu",
- "border_color": "rgb(92, 103, 115)",
- "zebra_stripe_color": "rgb(25, 31, 38)",
+ "theme": "dark",
+ "border_color": "#e0e0e0",
+ "zebra_stripe_color": "#2a2a2a",
})
call-function: ("check-colors", {
"theme": "light",
- "border_color": "rgb(224, 224, 224)",
- "zebra_stripe_color": "rgb(245, 245, 245)",
+ "border_color": "#e0e0e0",
+ "zebra_stripe_color": "#f5f5f5",
})
diff --git a/tests/rustdoc-gui/help-page.goml b/tests/rustdoc-gui/help-page.goml
index 6e880302f..84c203555 100644
--- a/tests/rustdoc-gui/help-page.goml
+++ b/tests/rustdoc-gui/help-page.goml
@@ -33,21 +33,21 @@ define-function: (
call-function: ("check-colors", {
"theme": "ayu",
- "color": "rgb(197, 197, 197)",
- "background": "rgb(49, 69, 89)",
- "box_shadow": "rgb(92, 103, 115)",
+ "color": "#c5c5c5",
+ "background": "#314559",
+ "box_shadow": "#5c6773",
})
call-function: ("check-colors", {
"theme": "dark",
- "color": "rgb(0, 0, 0)",
- "background": "rgb(250, 251, 252)",
- "box_shadow": "rgb(198, 203, 209)",
+ "color": "#000",
+ "background": "#fafbfc",
+ "box_shadow": "#c6cbd1",
})
call-function: ("check-colors", {
"theme": "light",
- "color": "rgb(0, 0, 0)",
- "background": "rgb(250, 251, 252)",
- "box_shadow": "rgb(198, 203, 209)",
+ "color": "#000",
+ "background": "#fafbfc",
+ "box_shadow": "#c6cbd1",
})
// This test ensures that opening the help popover without switching pages works.
diff --git a/tests/rustdoc-gui/search-corrections.goml b/tests/rustdoc-gui/search-corrections.goml
index 5d1b83b35..aeb3c9b31 100644
--- a/tests/rustdoc-gui/search-corrections.goml
+++ b/tests/rustdoc-gui/search-corrections.goml
@@ -54,3 +54,53 @@ assert-text: (
".search-corrections",
"Type \"notablestructwithlongnamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead."
)
+
+// Now, generic correction
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+// Intentionally wrong spelling of "NotableStructWithLongName"
+write: (".search-input", "NotableStructWithLongNamr, NotableStructWithLongNamr")
+// To be SURE that the search will be run.
+press-key: 'Enter'
+// Waiting for the search results to appear...
+wait-for: "#search-tabs"
+
+assert-css: (".search-corrections", {
+ "display": "block"
+})
+assert-text: (
+ ".search-corrections",
+ "Type \"notablestructwithlongnamr\" not found and used as generic parameter. Consider searching for \"notablestructwithlongname\" instead."
+)
+
+// Now, generic correction plus error
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+// Intentionally wrong spelling of "NotableStructWithLongName"
+write: (".search-input", "Foo<NotableStructWithLongNamr>,y")
+// To be SURE that the search will be run.
+press-key: 'Enter'
+// Waiting for the search results to appear...
+wait-for: "#search-tabs"
+
+assert-css: (".search-corrections", {
+ "display": "block"
+})
+assert-text: (
+ ".search-corrections",
+ "Type \"notablestructwithlongnamr\" not found and used as generic parameter. Consider searching for \"notablestructwithlongname\" instead."
+)
+
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+// Intentionally wrong spelling of "NotableStructWithLongName"
+write: (".search-input", "generic:NotableStructWithLongNamr<x>,y")
+// To be SURE that the search will be run.
+press-key: 'Enter'
+// Waiting for the search results to appear...
+wait-for: "#search-tabs"
+
+assert-css: (".error", {
+ "display": "block"
+})
+assert-text: (
+ ".error",
+ "Query parser error: \"Generic type parameter notablestructwithlongnamr does not accept generic parameters\"."
+)
diff --git a/tests/rustdoc-gui/search-no-result.goml b/tests/rustdoc-gui/search-no-result.goml
index 46d1856b4..e7c647912 100644
--- a/tests/rustdoc-gui/search-no-result.goml
+++ b/tests/rustdoc-gui/search-no-result.goml
@@ -21,16 +21,16 @@ define-function: (
call-function: ("check-no-result", {
"theme": "ayu",
- "link": "rgb(57, 175, 215)",
- "link_hover": "rgb(57, 175, 215)",
+ "link": "#39afd7",
+ "link_hover": "#39afd7",
})
call-function: ("check-no-result", {
"theme": "dark",
- "link": "rgb(210, 153, 29)",
- "link_hover": "rgb(210, 153, 29)",
+ "link": "#d2991d",
+ "link_hover": "#d2991d",
})
call-function: ("check-no-result", {
"theme": "light",
- "link": "rgb(56, 115, 173)",
- "link_hover": "rgb(56, 115, 173)",
+ "link": "#3873ad",
+ "link_hover": "#3873ad",
})
diff --git a/tests/rustdoc-gui/search-result-color.goml b/tests/rustdoc-gui/search-result-color.goml
index f9f81c5ba..44677dfbf 100644
--- a/tests/rustdoc-gui/search-result-color.goml
+++ b/tests/rustdoc-gui/search-result-color.goml
@@ -151,7 +151,7 @@ assert-css: (
)
assert-css: (
"//*[@class='result-name']//*[text()='test_docs::']/ancestor::a",
- {"color": "#fff", "background-color": "rgb(60, 60, 60)"},
+ {"color": "#fff", "background-color": "#3c3c3c"},
)
// Dark theme
diff --git a/tests/rustdoc-gui/search-tab.goml b/tests/rustdoc-gui/search-tab.goml
index 7bbde3ec2..427201e1b 100644
--- a/tests/rustdoc-gui/search-tab.goml
+++ b/tests/rustdoc-gui/search-tab.goml
@@ -1,5 +1,5 @@
// Checking the colors of the search tab headers.
-go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html?search=something"
+go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html?search=foo"
show-text: true
define-function: (
@@ -74,3 +74,87 @@ call-function: ("check-colors", {
"border_top_selected": "2px solid #0089ff",
"border_top_hover": "2px solid #0089ff",
})
+
+// set size wide enough that the text is in a single row
+set-window-size: (851, 600)
+
+// Check the size and count in tabs
+assert-text: ("#search-tabs > button:nth-child(1) > .count", " (23) ")
+assert-text: ("#search-tabs > button:nth-child(2) > .count", " (4)  ")
+assert-text: ("#search-tabs > button:nth-child(3) > .count", " (0)  ")
+store-property: ("#search-tabs > button:nth-child(1)", {"offsetWidth": buttonWidth})
+assert-property: ("#search-tabs > button:nth-child(2)", {"offsetWidth": |buttonWidth|})
+assert-property: ("#search-tabs > button:nth-child(3)", {"offsetWidth": |buttonWidth|})
+store-property: ("#search-tabs > button:nth-child(1) > .count", {"offsetWidth": countWidth})
+assert-property: ("#search-tabs > button:nth-child(2) > .count", {"offsetWidth": |countWidth|})
+assert-property: ("#search-tabs > button:nth-child(3) > .count", {"offsetWidth": |countWidth|})
+
+// Check that counts are in a row with each other
+compare-elements-position: (
+ "#search-tabs > button:nth-child(1) > .count",
+ "#search-tabs > button:nth-child(2) > .count",
+ ("y")
+)
+compare-elements-position: (
+ "#search-tabs > button:nth-child(2) > .count",
+ "#search-tabs > button:nth-child(3) > .count",
+ ("y")
+)
+// Check that counts are beside the titles and haven't wrapped
+compare-elements-position-near: (
+ "#search-tabs > button:nth-child(1)",
+ "#search-tabs > button:nth-child(1) > .count",
+ {"y": 8}
+)
+compare-elements-position-near: (
+ "#search-tabs > button:nth-child(2)",
+ "#search-tabs > button:nth-child(2) > .count",
+ {"y": 8}
+)
+compare-elements-position-near: (
+ "#search-tabs > button:nth-child(2)",
+ "#search-tabs > button:nth-child(2) > .count",
+ {"y": 8}
+)
+
+// Set size narrow enough that they wrap.
+// When I tested it, it wrapped at 811px, but I added some fudge factor to ensure it
+// doesn't prematurely wrap with slightly different font kerning or whatever, with a
+// @media query
+set-window-size: (850, 600)
+
+// all counts and buttons still have same size
+store-property: ("#search-tabs > button:nth-child(1)", {"offsetWidth": buttonWidth})
+assert-property: ("#search-tabs > button:nth-child(2)", {"offsetWidth": |buttonWidth|})
+assert-property: ("#search-tabs > button:nth-child(3)", {"offsetWidth": |buttonWidth|})
+store-property: ("#search-tabs > button:nth-child(1) > .count", {"offsetWidth": countWidth})
+assert-property: ("#search-tabs > button:nth-child(2) > .count", {"offsetWidth": |countWidth|})
+assert-property: ("#search-tabs > button:nth-child(3) > .count", {"offsetWidth": |countWidth|})
+
+// Check that counts are still in a row with each other
+compare-elements-position: (
+ "#search-tabs > button:nth-child(1) > .count",
+ "#search-tabs > button:nth-child(2) > .count",
+ ("y")
+)
+compare-elements-position: (
+ "#search-tabs > button:nth-child(2) > .count",
+ "#search-tabs > button:nth-child(3) > .count",
+ ("y")
+)
+// Check that counts are NOT beside the titles; now they have wrapped
+compare-elements-position-near-false: (
+ "#search-tabs > button:nth-child(1)",
+ "#search-tabs > button:nth-child(1) > .count",
+ {"y": 8}
+)
+compare-elements-position-near-false: (
+ "#search-tabs > button:nth-child(2)",
+ "#search-tabs > button:nth-child(2) > .count",
+ {"y": 8}
+)
+compare-elements-position-near-false: (
+ "#search-tabs > button:nth-child(2)",
+ "#search-tabs > button:nth-child(2) > .count",
+ {"y": 8}
+)
diff --git a/tests/rustdoc-gui/sidebar-source-code.goml b/tests/rustdoc-gui/sidebar-source-code.goml
index 69c589741..92b9045b7 100644
--- a/tests/rustdoc-gui/sidebar-source-code.goml
+++ b/tests/rustdoc-gui/sidebar-source-code.goml
@@ -73,7 +73,7 @@ assert: "//*[@class='dir-entry' and @open]/*[text()='sub_mod']"
// Only "another_folder" should be "open" in "lib2".
assert: "//*[@class='dir-entry' and not(@open)]/*[text()='another_mod']"
// All other trees should be collapsed.
-assert-count: ("//*[@id='src-sidebar']/details[not(text()='lib2') and not(@open)]", 9)
+assert-count: ("//*[@id='src-sidebar']/details[not(text()='lib2') and not(@open)]", 10)
// We now switch to mobile mode.
set-window-size: (600, 600)
diff --git a/tests/rustdoc-gui/sidebar.goml b/tests/rustdoc-gui/sidebar.goml
index 574cc629a..520481d3b 100644
--- a/tests/rustdoc-gui/sidebar.goml
+++ b/tests/rustdoc-gui/sidebar.goml
@@ -25,24 +25,24 @@ call-function: (
"check-colors",
{
"theme": "ayu",
- "color": "rgb(197, 197, 197)",
- "background_color": "rgb(20, 25, 31)",
+ "color": "#c5c5c5",
+ "background_color": "#14191f",
}
)
call-function: (
"check-colors",
{
"theme": "dark",
- "color": "rgb(221, 221, 221)",
- "background_color": "rgb(80, 80, 80)",
+ "color": "#ddd",
+ "background_color": "#505050",
}
)
call-function: (
"check-colors",
{
"theme": "light",
- "color": "rgb(0, 0, 0)",
- "background_color": "rgb(245, 245, 245)",
+ "color": "black",
+ "background_color": "#f5f5f5",
}
)
@@ -55,7 +55,7 @@ assert-text: (".sidebar > .location", "Crate test_docs")
assert-count: (".sidebar .location", 1)
assert-count: (".sidebar h2", 1)
assert-text: ("#all-types", "All Items")
-assert-css: ("#all-types", {"color": "rgb(53, 109, 164)"})
+assert-css: ("#all-types", {"color": "#356da4"})
// We check that we have the crates list and that the "current" on is "test_docs".
assert-text: (".sidebar-elems ul.crate > li > a.current", "test_docs")
// And we're also supposed to have the list of items in the current module.
@@ -67,7 +67,7 @@ assert-text: (".sidebar-elems section ul > li:nth-child(5)", "Enums")
assert-text: (".sidebar-elems section ul > li:nth-child(6)", "Constants")
assert-text: (".sidebar-elems section ul > li:nth-child(7)", "Traits")
assert-text: (".sidebar-elems section ul > li:nth-child(8)", "Functions")
-assert-text: (".sidebar-elems section ul > li:nth-child(9)", "Type Definitions")
+assert-text: (".sidebar-elems section ul > li:nth-child(9)", "Type Aliases")
assert-text: (".sidebar-elems section ul > li:nth-child(10)", "Unions")
assert-text: (".sidebar-elems section ul > li:nth-child(11)", "Keywords")
assert-text: ("#structs + .item-table .item-name > a", "Foo")
@@ -88,7 +88,7 @@ assert-property: ("html", {"scrollTop": "0"})
// We now go back to the crate page to click on the "lib2" crate link.
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
assert-property: (".sidebar", {"clientWidth": "200"})
-assert-css: (".sidebar-elems ul.crate > li:first-child > a", {"color": "rgb(53, 109, 164)"})
+assert-css: (".sidebar-elems ul.crate > li:first-child > a", {"color": "#356da4"})
click: ".sidebar-elems ul.crate > li:first-child > a"
// PAGE: lib2/index.html
@@ -102,7 +102,7 @@ assert-text: (".sidebar-elems > section ul.block > li:nth-child(1)", "Modules")
assert-text: (".sidebar-elems > section ul.block > li:nth-child(2)", "Structs")
assert-text: (".sidebar-elems > section ul.block > li:nth-child(3)", "Traits")
assert-text: (".sidebar-elems > section ul.block > li:nth-child(4)", "Functions")
-assert-text: (".sidebar-elems > section ul.block > li:nth-child(5)", "Type Definitions")
+assert-text: (".sidebar-elems > section ul.block > li:nth-child(5)", "Type Aliases")
assert-text: ("#functions + .item-table .item-name > a", "foobar")
click: "#functions + .item-table .item-name > a"
@@ -140,7 +140,7 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
assert-property: (".sidebar", {"clientWidth": "200"})
click: "//ul[@class='block mod']/preceding-sibling::h3/a"
// PAGE: index.html
-assert-css: ("#modules", {"background-color": "rgb(253, 255, 211)"})
+assert-css: ("#modules", {"background-color": "#fdffd3"})
// Finally, assert that the `[+]/[−]` toggle doesn't affect sidebar width.
click: "#toggle-all-docs"
diff --git a/tests/rustdoc-gui/src/test_docs/lib.rs b/tests/rustdoc-gui/src/test_docs/lib.rs
index 49484ee08..38180aef7 100644
--- a/tests/rustdoc-gui/src/test_docs/lib.rs
+++ b/tests/rustdoc-gui/src/test_docs/lib.rs
@@ -65,6 +65,18 @@ impl Foo {
pub fn must_use(&self) -> bool {
true
}
+
+ /// hello
+ ///
+ /// <div id="doc-warning-1" class="warning">this is a warning</div>
+ ///
+ /// done
+ pub fn warning1() {}
+
+ /// Checking there is no bottom margin if "warning" is the last element.
+ ///
+ /// <div id="doc-warning-2" class="warning">this is a warning</div>
+ pub fn warning2() {}
}
impl AsRef<str> for Foo {
diff --git a/tests/rustdoc-gui/src/theme_css/Cargo.lock b/tests/rustdoc-gui/src/theme_css/Cargo.lock
new file mode 100644
index 000000000..7ad6737a4
--- /dev/null
+++ b/tests/rustdoc-gui/src/theme_css/Cargo.lock
@@ -0,0 +1,7 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "theme_css"
+version = "0.1.0"
diff --git a/tests/rustdoc-gui/src/theme_css/Cargo.toml b/tests/rustdoc-gui/src/theme_css/Cargo.toml
new file mode 100644
index 000000000..798e64f93
--- /dev/null
+++ b/tests/rustdoc-gui/src/theme_css/Cargo.toml
@@ -0,0 +1,7 @@
+[package]
+name = "theme_css"
+version = "0.1.0"
+edition = "2018"
+
+[lib]
+path = "lib.rs"
diff --git a/tests/rustdoc-gui/src/theme_css/custom-theme.css b/tests/rustdoc-gui/src/theme_css/custom-theme.css
new file mode 100644
index 000000000..260ef87f6
--- /dev/null
+++ b/tests/rustdoc-gui/src/theme_css/custom-theme.css
@@ -0,0 +1,99 @@
+:root {
+ --main-background-color: red;
+ --main-color: black;
+ --settings-input-color: #2196f3;
+ --settings-input-border-color: #717171;
+ --settings-button-color: #000;
+ --settings-button-border-focus: #717171;
+ --sidebar-background-color: #f5f5f5;
+ --sidebar-background-color-hover: #e0e0e0;
+ --code-block-background-color: #f5f5f5;
+ --scrollbar-track-background-color: #dcdcdc;
+ --scrollbar-thumb-background-color: rgba(36, 37, 39, 0.6);
+ --scrollbar-color: rgba(36, 37, 39, 0.6) #d9d9d9;
+ --headings-border-bottom-color: #ddd;
+ --border-color: #e0e0e0;
+ --button-background-color: #fff;
+ --right-side-color: grey;
+ --code-attribute-color: #999;
+ --toggles-color: #999;
+ --toggle-filter: none;
+ --search-input-focused-border-color: #66afe9;
+ --copy-path-button-color: #999;
+ --copy-path-img-filter: invert(50%);
+ --copy-path-img-hover-filter: invert(35%);
+ --codeblock-error-hover-color: rgb(255, 0, 0);
+ --codeblock-error-color: rgba(255, 0, 0, .5);
+ --codeblock-ignore-hover-color: rgb(255, 142, 0);
+ --codeblock-ignore-color: rgba(255, 142, 0, .6);
+ --warning-border-color: #ff8e00;
+ --type-link-color: #ad378a;
+ --trait-link-color: #6e4fc9;
+ --assoc-item-link-color: #3873ad;
+ --function-link-color: #ad7c37;
+ --macro-link-color: #068000;
+ --keyword-link-color: #3873ad;
+ --mod-link-color: #3873ad;
+ --link-color: #3873ad;
+ --sidebar-link-color: #356da4;
+ --sidebar-current-link-background-color: #fff;
+ --search-result-link-focus-background-color: #ccc;
+ --search-result-border-color: #aaa3;
+ --search-color: #000;
+ --search-error-code-background-color: #d0cccc;
+ --search-results-alias-color: #000;
+ --search-results-grey-color: #999;
+ --search-tab-title-count-color: #888;
+ --search-tab-button-not-selected-border-top-color: #e6e6e6;
+ --search-tab-button-not-selected-background: #e6e6e6;
+ --search-tab-button-selected-border-top-color: #0089ff;
+ --search-tab-button-selected-background: #fff;
+ --stab-background-color: #fff5d6;
+ --stab-code-color: #000;
+ --code-highlight-kw-color: #8959a8;
+ --code-highlight-kw-2-color: #4271ae;
+ --code-highlight-lifetime-color: #b76514;
+ --code-highlight-prelude-color: #4271ae;
+ --code-highlight-prelude-val-color: #c82829;
+ --code-highlight-number-color: #718c00;
+ --code-highlight-string-color: #718c00;
+ --code-highlight-literal-color: #c82829;
+ --code-highlight-attribute-color: #c82829;
+ --code-highlight-self-color: #c82829;
+ --code-highlight-macro-color: #3e999f;
+ --code-highlight-question-mark-color: #ff9011;
+ --code-highlight-comment-color: #8e908c;
+ --code-highlight-doc-comment-color: #4d4d4c;
+ --src-line-numbers-span-color: #c67e2d;
+ --src-line-number-highlighted-background-color: #fdffd3;
+ --test-arrow-color: #f5f5f5;
+ --test-arrow-background-color: rgba(78, 139, 202, 0.2);
+ --test-arrow-hover-color: #f5f5f5;
+ --test-arrow-hover-background-color: rgb(78, 139, 202);
+ --target-background-color: #fdffd3;
+ --target-border-color: #ad7c37;
+ --kbd-color: #000;
+ --kbd-background: #fafbfc;
+ --kbd-box-shadow-color: #c6cbd1;
+ --rust-logo-filter: initial;
+ /* match border-color; uses https://codepen.io/sosuke/pen/Pjoqqp */
+ --crate-search-div-filter: invert(100%) sepia(0%) saturate(4223%) hue-rotate(289deg)
+ brightness(114%) contrast(76%);
+ --crate-search-div-hover-filter: invert(44%) sepia(18%) saturate(23%) hue-rotate(317deg)
+ brightness(96%) contrast(93%);
+ --crate-search-hover-border: #717171;
+ --src-sidebar-background-selected: #fff;
+ --src-sidebar-background-hover: #e0e0e0;
+ --table-alt-row-background-color: #f5f5f5;
+ --codeblock-link-background: #eee;
+ --scrape-example-toggle-line-background: #ccc;
+ --scrape-example-toggle-line-hover-background: #999;
+ --scrape-example-code-line-highlight: #fcffd6;
+ --scrape-example-code-line-highlight-focus: #f6fdb0;
+ --scrape-example-help-border-color: #555;
+ --scrape-example-help-color: #333;
+ --scrape-example-help-hover-border-color: #000;
+ --scrape-example-help-hover-color: #000;
+ --scrape-example-code-wrapper-background-start: rgba(255, 255, 255, 1);
+ --scrape-example-code-wrapper-background-end: rgba(255, 255, 255, 0);
+}
diff --git a/tests/rustdoc-gui/src/theme_css/lib.rs b/tests/rustdoc-gui/src/theme_css/lib.rs
new file mode 100644
index 000000000..e9f3265fa
--- /dev/null
+++ b/tests/rustdoc-gui/src/theme_css/lib.rs
@@ -0,0 +1,2 @@
+// compile-flags: --theme custom-theme.css
+//! <div class="custom-text">custom text</div>
diff --git a/tests/rustdoc-gui/theme-change.goml b/tests/rustdoc-gui/theme-change.goml
index e4b031b73..fdaf9d628 100644
--- a/tests/rustdoc-gui/theme-change.goml
+++ b/tests/rustdoc-gui/theme-change.goml
@@ -65,3 +65,36 @@ assert-local-storage: { "rustdoc-theme": "light" }
reload:
wait-for: "#settings"
assert: "#preferred-light-theme.setting-line.hidden"
+
+// Ensures that the custom theme feature is working as expected.
+go-to: "file://" + |DOC_PATH| + "/theme_css/index.html"
+set-local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "dark"}
+reload:
+
+store-value: (background_light, "white")
+store-value: (background_dark, "#353535")
+store-value: (background_ayu, "#0f1419")
+store-value: (background_custom_theme, "red")
+
+click: "#settings-menu"
+wait-for: "#theme-ayu"
+click: "#theme-ayu"
+// should be the ayu theme so let's check the color.
+wait-for-css: ("body", { "background-color": |background_ayu| })
+assert-local-storage: { "rustdoc-theme": "ayu" }
+assert-text: (".custom-text", "custom text")
+click: "#theme-light"
+// should be the light theme so let's check the color.
+wait-for-css: ("body", { "background-color": |background_light| })
+assert-local-storage: { "rustdoc-theme": "light" }
+assert-text: (".custom-text", "custom text")
+click: "#theme-dark"
+// Should be the dark theme so let's check the color.
+wait-for-css: ("body", { "background-color": |background_dark| })
+assert-local-storage: { "rustdoc-theme": "dark" }
+assert-text: (".custom-text", "custom text")
+click: "#theme-custom-theme"
+// Should be the custom theme so let's check the color.
+wait-for-css: ("body", { "background-color": |background_custom_theme| })
+assert-local-storage: { "rustdoc-theme": "custom-theme" }
+assert-text: (".custom-text", "custom text")
diff --git a/tests/rustdoc-gui/warning-block.goml b/tests/rustdoc-gui/warning-block.goml
new file mode 100644
index 000000000..8832b65c4
--- /dev/null
+++ b/tests/rustdoc-gui/warning-block.goml
@@ -0,0 +1,42 @@
+// Test to check that the "warning blocks" are displayed as expected.
+go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
+show-text: true
+
+define-function: (
+ "check-warning",
+ (theme, color, border_color),
+ block {
+ set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
+ reload:
+
+ // The IDs are added directly into the DOM to make writing this test easier.
+ assert-css: ("#doc-warning-1", {
+ "margin-bottom": "12px",
+ "color": |color|,
+ "border-left": "2px solid " + |border_color|,
+ "background-color": "transparent",
+ })
+ assert-css: ("#doc-warning-2", {
+ "margin-bottom": "0px",
+ "color": |color|,
+ "border-left": "2px solid " + |border_color|,
+ "background-color": "transparent",
+ })
+ },
+)
+
+call-function: ("check-warning", {
+ "theme": "ayu",
+ "color": "#c5c5c5",
+ "border_color": "#ff8e00",
+})
+call-function: ("check-warning", {
+ "theme": "dark",
+ "color": "#ddd",
+ "border_color": "#ff8e00",
+})
+call-function: ("check-warning", {
+ "theme": "light",
+ "color": "black",
+ "border_color": "#ff8e00",
+})
diff --git a/tests/rustdoc-js-std/full-path-function.js b/tests/rustdoc-js-std/full-path-function.js
new file mode 100644
index 000000000..ac157b3aa
--- /dev/null
+++ b/tests/rustdoc-js-std/full-path-function.js
@@ -0,0 +1,7 @@
+const EXPECTED = {
+ 'query': 'vec::vec -> usize',
+ 'others': [
+ { 'path': 'std::vec::Vec', 'name': 'len' },
+ { 'path': 'std::vec::Vec', 'name': 'capacity' },
+ ],
+};
diff --git a/tests/rustdoc-js-std/option-type-signatures.js b/tests/rustdoc-js-std/option-type-signatures.js
index 259978506..e154fa707 100644
--- a/tests/rustdoc-js-std/option-type-signatures.js
+++ b/tests/rustdoc-js-std/option-type-signatures.js
@@ -1,3 +1,7 @@
+// ignore-order
+
+const FILTER_CRATE = "std";
+
const EXPECTED = [
{
'query': 'option, fnonce -> option',
@@ -19,4 +23,62 @@ const EXPECTED = [
{ 'path': 'std::option::Option', 'name': 'as_mut_slice' },
],
},
+ {
+ 'query': 'option<t>, option<t> -> option<t>',
+ 'others': [
+ { 'path': 'std::option::Option', 'name': 'or' },
+ { 'path': 'std::option::Option', 'name': 'xor' },
+ ],
+ },
+ {
+ 'query': 'option<t>, option<u> -> option<u>',
+ 'others': [
+ { 'path': 'std::option::Option', 'name': 'and' },
+ { 'path': 'std::option::Option', 'name': 'zip' },
+ ],
+ },
+ {
+ 'query': 'option<t>, option<u> -> option<t>',
+ 'others': [
+ { 'path': 'std::option::Option', 'name': 'and' },
+ { 'path': 'std::option::Option', 'name': 'zip' },
+ ],
+ },
+ {
+ 'query': 'option<t>, option<u> -> option<t, u>',
+ 'others': [
+ { 'path': 'std::option::Option', 'name': 'zip' },
+ ],
+ },
+ {
+ 'query': 'option<t>, e -> result<t, e>',
+ 'others': [
+ { 'path': 'std::option::Option', 'name': 'ok_or' },
+ { 'path': 'std::result::Result', 'name': 'transpose' },
+ ],
+ },
+ {
+ 'query': 'result<option<t>, e> -> option<result<t, e>>',
+ 'others': [
+ { 'path': 'std::result::Result', 'name': 'transpose' },
+ ],
+ },
+ {
+ 'query': 'option<t>, option<t> -> bool',
+ 'others': [
+ { 'path': 'std::option::Option', 'name': 'eq' },
+ ],
+ },
+ {
+ 'query': 'option<option<t>> -> option<t>',
+ 'others': [
+ { 'path': 'std::option::Option', 'name': 'flatten' },
+ ],
+ },
+ {
+ 'query': 'option<t>',
+ 'returned': [
+ { 'path': 'std::result::Result', 'name': 'ok' },
+ ],
+ },
];
diff --git a/tests/rustdoc-js-std/vec-type-signatures.js b/tests/rustdoc-js-std/vec-type-signatures.js
new file mode 100644
index 000000000..18cf9d6ef
--- /dev/null
+++ b/tests/rustdoc-js-std/vec-type-signatures.js
@@ -0,0 +1,22 @@
+// ignore-order
+
+const FILTER_CRATE = "std";
+
+const EXPECTED = [
+ {
+ 'query': 'vec::intoiter<T> -> [T]',
+ 'others': [
+ { 'path': 'std::vec::IntoIter', 'name': 'as_slice' },
+ { 'path': 'std::vec::IntoIter', 'name': 'as_mut_slice' },
+ { 'path': 'std::vec::IntoIter', 'name': 'next_chunk' },
+ ],
+ },
+ {
+ 'query': 'vec::intoiter<T> -> []',
+ 'others': [
+ { 'path': 'std::vec::IntoIter', 'name': 'as_slice' },
+ { 'path': 'std::vec::IntoIter', 'name': 'as_mut_slice' },
+ { 'path': 'std::vec::IntoIter', 'name': 'next_chunk' },
+ ],
+ },
+];
diff --git a/tests/rustdoc-js/full-path-function.js b/tests/rustdoc-js/full-path-function.js
new file mode 100644
index 000000000..48be51b15
--- /dev/null
+++ b/tests/rustdoc-js/full-path-function.js
@@ -0,0 +1,43 @@
+// exact-check
+
+const EXPECTED = [
+ {
+ 'query': 'sac -> usize',
+ 'others': [
+ { 'path': 'full_path_function::b::Sac', 'name': 'bar' },
+ { 'path': 'full_path_function::b::Sac', 'name': 'len' },
+ { 'path': 'full_path_function::sac::Sac', 'name': 'len' },
+ ],
+ },
+ {
+ 'query': 'b::sac -> usize',
+ 'others': [
+ { 'path': 'full_path_function::b::Sac', 'name': 'bar' },
+ { 'path': 'full_path_function::b::Sac', 'name': 'len' },
+ ],
+ },
+ {
+ 'query': 'b::sac -> u32',
+ 'others': [
+ { 'path': 'full_path_function::b::Sac', 'name': 'bar2' },
+ ],
+ },
+ {
+ 'query': 'string::string -> u32',
+ 'others': [
+ { 'path': 'full_path_function::b::Sac', 'name': 'string' },
+ ],
+ },
+ {
+ 'query': 'alloc::string::string -> u32',
+ 'others': [
+ { 'path': 'full_path_function::b::Sac', 'name': 'string' },
+ ],
+ },
+ {
+ 'query': 'alloc::string -> u32',
+ 'others': [
+ { 'path': 'full_path_function::b::Sac', 'name': 'string' },
+ ],
+ },
+];
diff --git a/tests/rustdoc-js/full-path-function.rs b/tests/rustdoc-js/full-path-function.rs
new file mode 100644
index 000000000..8dcc3f2b6
--- /dev/null
+++ b/tests/rustdoc-js/full-path-function.rs
@@ -0,0 +1,17 @@
+pub mod sac {
+ pub struct Sac;
+
+ impl Sac {
+ pub fn len(&self) -> usize { 0 }
+ }
+}
+
+pub mod b {
+ pub struct Sac;
+ impl Sac {
+ pub fn len(&self) -> usize { 0 }
+ pub fn bar(&self, w: u32) -> usize { 0 }
+ pub fn bar2(&self, w: u32) -> u32 { 0 }
+ pub fn string(w: String) -> u32 { 0 }
+ }
+}
diff --git a/tests/rustdoc-js/generics-match-ambiguity.js b/tests/rustdoc-js/generics-match-ambiguity.js
index a9932a16c..edce4268c 100644
--- a/tests/rustdoc-js/generics-match-ambiguity.js
+++ b/tests/rustdoc-js/generics-match-ambiguity.js
@@ -79,6 +79,7 @@ const EXPECTED = [
{ 'path': 'generics_match_ambiguity', 'name': 'baac' },
{ 'path': 'generics_match_ambiguity', 'name': 'baaf' },
{ 'path': 'generics_match_ambiguity', 'name': 'baag' },
+ { 'path': 'generics_match_ambiguity', 'name': 'baah' },
],
},
{
diff --git a/tests/rustdoc-js/generics-trait.js b/tests/rustdoc-js/generics-trait.js
index 4ccfb8f4e..a71393b5e 100644
--- a/tests/rustdoc-js/generics-trait.js
+++ b/tests/rustdoc-js/generics-trait.js
@@ -12,12 +12,16 @@ const EXPECTED = [
],
},
{
- 'query': 'Result<SomeTraiz>',
- 'correction': null,
+ 'query': 'Resulx<SomeTrait>',
'in_args': [],
'returned': [],
},
{
+ 'query': 'Result<SomeTraiz>',
+ 'proposeCorrectionFrom': 'SomeTraiz',
+ 'proposeCorrectionTo': 'SomeTrait',
+ },
+ {
'query': 'OtherThingxxxxxxxx',
'correction': null,
'in_args': [
diff --git a/tests/rustdoc-js/generics-unbox.js b/tests/rustdoc-js/generics-unbox.js
new file mode 100644
index 000000000..9cdfc7ac8
--- /dev/null
+++ b/tests/rustdoc-js/generics-unbox.js
@@ -0,0 +1,38 @@
+// exact-check
+
+const EXPECTED = [
+ {
+ 'query': 'Inside<T> -> Out1<T>',
+ 'others': [
+ { 'path': 'generics_unbox', 'name': 'alpha' },
+ ],
+ },
+ {
+ 'query': 'Inside<T> -> Out3<T>',
+ 'others': [
+ { 'path': 'generics_unbox', 'name': 'beta' },
+ { 'path': 'generics_unbox', 'name': 'gamma' },
+ ],
+ },
+ {
+ 'query': 'Inside<T> -> Out4<T>',
+ 'others': [
+ { 'path': 'generics_unbox', 'name': 'beta' },
+ { 'path': 'generics_unbox', 'name': 'gamma' },
+ ],
+ },
+ {
+ 'query': 'Inside<T> -> Out3<U, T>',
+ 'others': [
+ { 'path': 'generics_unbox', 'name': 'beta' },
+ { 'path': 'generics_unbox', 'name': 'gamma' },
+ ],
+ },
+ {
+ 'query': 'Inside<T> -> Out4<U, T>',
+ 'others': [
+ { 'path': 'generics_unbox', 'name': 'beta' },
+ { 'path': 'generics_unbox', 'name': 'gamma' },
+ ],
+ },
+];
diff --git a/tests/rustdoc-js/generics-unbox.rs b/tests/rustdoc-js/generics-unbox.rs
new file mode 100644
index 000000000..bef34f891
--- /dev/null
+++ b/tests/rustdoc-js/generics-unbox.rs
@@ -0,0 +1,36 @@
+pub struct Out<A, B = ()> {
+ a: A,
+ b: B,
+}
+
+pub struct Out1<A, const N: usize> {
+ a: [A; N],
+}
+
+pub struct Out2<A, const N: usize> {
+ a: [A; N],
+}
+
+pub struct Out3<A, B> {
+ a: A,
+ b: B,
+}
+
+pub struct Out4<A, B> {
+ a: A,
+ b: B,
+}
+
+pub struct Inside<T>(T);
+
+pub fn alpha<const N: usize, T>(_: Inside<T>) -> Out<Out1<T, N>, Out2<T, N>> {
+ loop {}
+}
+
+pub fn beta<T, U>(_: Inside<T>) -> Out<Out3<T, U>, Out4<U, T>> {
+ loop {}
+}
+
+pub fn gamma<T, U>(_: Inside<T>) -> Out<Out3<U, T>, Out4<T, U>> {
+ loop {}
+}
diff --git a/tests/rustdoc-js/type-parameters.js b/tests/rustdoc-js/type-parameters.js
new file mode 100644
index 000000000..e695f189b
--- /dev/null
+++ b/tests/rustdoc-js/type-parameters.js
@@ -0,0 +1,87 @@
+// exact-check
+// ignore-order
+
+const EXPECTED = [
+ {
+ query: '-> trait:Some',
+ others: [
+ { path: 'foo', name: 'alef' },
+ { path: 'foo', name: 'alpha' },
+ ],
+ },
+ {
+ query: '-> generic:T',
+ others: [
+ { path: 'foo', name: 'bet' },
+ { path: 'foo', name: 'alef' },
+ { path: 'foo', name: 'beta' },
+ ],
+ },
+ {
+ query: 'A -> B',
+ others: [
+ { path: 'foo', name: 'bet' },
+ ],
+ },
+ {
+ query: 'A -> A',
+ others: [
+ { path: 'foo', name: 'beta' },
+ ],
+ },
+ {
+ query: 'A, A',
+ others: [
+ { path: 'foo', name: 'alternate' },
+ ],
+ },
+ {
+ query: 'A, B',
+ others: [
+ { path: 'foo', name: 'other' },
+ ],
+ },
+ {
+ query: 'Other, Other',
+ others: [
+ { path: 'foo', name: 'other' },
+ { path: 'foo', name: 'alternate' },
+ ],
+ },
+ {
+ query: 'generic:T',
+ in_args: [
+ { path: 'foo', name: 'bet' },
+ { path: 'foo', name: 'beta' },
+ { path: 'foo', name: 'other' },
+ { path: 'foo', name: 'alternate' },
+ ],
+ },
+ {
+ query: 'generic:Other',
+ in_args: [
+ { path: 'foo', name: 'bet' },
+ { path: 'foo', name: 'beta' },
+ { path: 'foo', name: 'other' },
+ { path: 'foo', name: 'alternate' },
+ ],
+ },
+ {
+ query: 'trait:Other',
+ in_args: [
+ { path: 'foo', name: 'other' },
+ { path: 'foo', name: 'alternate' },
+ ],
+ },
+ {
+ query: 'Other',
+ in_args: [
+ { path: 'foo', name: 'other' },
+ { path: 'foo', name: 'alternate' },
+ ],
+ },
+ {
+ query: 'trait:T',
+ in_args: [],
+ },
+];
diff --git a/tests/rustdoc-js/type-parameters.rs b/tests/rustdoc-js/type-parameters.rs
new file mode 100644
index 000000000..cda5e2617
--- /dev/null
+++ b/tests/rustdoc-js/type-parameters.rs
@@ -0,0 +1,15 @@
+#![crate_name="foo"]
+
+pub trait Some {}
+impl Some for () {}
+pub trait Other {}
+impl Other for () {}
+
+pub fn alef<T: Some>() -> T { loop {} }
+pub fn alpha() -> impl Some { }
+
+pub fn bet<T, U>(t: T) -> U { loop {} }
+pub fn beta<T>(t: T) -> T {}
+
+pub fn other<T: Other, U: Other>(t: T, u: U) { loop {} }
+pub fn alternate<T: Other>(t: T, u: T) { loop {} }
diff --git a/tests/rustdoc-json/fn_pointer/abi.rs b/tests/rustdoc-json/fn_pointer/abi.rs
index 77c0e8233..dbe316f57 100644
--- a/tests/rustdoc-json/fn_pointer/abi.rs
+++ b/tests/rustdoc-json/fn_pointer/abi.rs
@@ -2,23 +2,23 @@
#![feature(abi_vectorcall)]
-// @is "$.index[*][?(@.name=='AbiRust')].inner.typedef.type.function_pointer.header.abi" \"Rust\"
+// @is "$.index[*][?(@.name=='AbiRust')].inner.type_alias.type.function_pointer.header.abi" \"Rust\"
pub type AbiRust = fn();
-// @is "$.index[*][?(@.name=='AbiC')].inner.typedef.type.function_pointer.header.abi" '{"C": {"unwind": false}}'
+// @is "$.index[*][?(@.name=='AbiC')].inner.type_alias.type.function_pointer.header.abi" '{"C": {"unwind": false}}'
pub type AbiC = extern "C" fn();
-// @is "$.index[*][?(@.name=='AbiSystem')].inner.typedef.type.function_pointer.header.abi" '{"System": {"unwind": false}}'
+// @is "$.index[*][?(@.name=='AbiSystem')].inner.type_alias.type.function_pointer.header.abi" '{"System": {"unwind": false}}'
pub type AbiSystem = extern "system" fn();
-// @is "$.index[*][?(@.name=='AbiCUnwind')].inner.typedef.type.function_pointer.header.abi" '{"C": {"unwind": true}}'
+// @is "$.index[*][?(@.name=='AbiCUnwind')].inner.type_alias.type.function_pointer.header.abi" '{"C": {"unwind": true}}'
pub type AbiCUnwind = extern "C-unwind" fn();
-// @is "$.index[*][?(@.name=='AbiSystemUnwind')].inner.typedef.type.function_pointer.header.abi" '{"System": {"unwind": true}}'
+// @is "$.index[*][?(@.name=='AbiSystemUnwind')].inner.type_alias.type.function_pointer.header.abi" '{"System": {"unwind": true}}'
pub type AbiSystemUnwind = extern "system-unwind" fn();
-// @is "$.index[*][?(@.name=='AbiVecorcall')].inner.typedef.type.function_pointer.header.abi.Other" '"\"vectorcall\""'
+// @is "$.index[*][?(@.name=='AbiVecorcall')].inner.type_alias.type.function_pointer.header.abi.Other" '"\"vectorcall\""'
pub type AbiVecorcall = extern "vectorcall" fn();
-// @is "$.index[*][?(@.name=='AbiVecorcallUnwind')].inner.typedef.type.function_pointer.header.abi.Other" '"\"vectorcall-unwind\""'
+// @is "$.index[*][?(@.name=='AbiVecorcallUnwind')].inner.type_alias.type.function_pointer.header.abi.Other" '"\"vectorcall-unwind\""'
pub type AbiVecorcallUnwind = extern "vectorcall-unwind" fn();
diff --git a/tests/rustdoc-json/fn_pointer/generics.rs b/tests/rustdoc-json/fn_pointer/generics.rs
index 48672f12d..3b82561ec 100644
--- a/tests/rustdoc-json/fn_pointer/generics.rs
+++ b/tests/rustdoc-json/fn_pointer/generics.rs
@@ -3,11 +3,11 @@
#![feature(no_core)]
#![no_core]
-// @count "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.typedef.type.function_pointer.decl.inputs[*]" 1
-// @is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.typedef.type.function_pointer.decl.inputs[0][0]" '"val"'
-// @is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.typedef.type.function_pointer.decl.inputs[0][1].borrowed_ref.lifetime" \"\'c\"
-// @is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.typedef.type.function_pointer.decl.output.primitive" \"i32\"
-// @count "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.typedef.type.function_pointer.generic_params[*]" 1
-// @is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.typedef.type.function_pointer.generic_params[0].name" \"\'c\"
-// @is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.typedef.type.function_pointer.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }'
+// @count "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.decl.inputs[*]" 1
+// @is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.decl.inputs[0][0]" '"val"'
+// @is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.decl.inputs[0][1].borrowed_ref.lifetime" \"\'c\"
+// @is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.decl.output.primitive" \"i32\"
+// @count "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.generic_params[*]" 1
+// @is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.generic_params[0].name" \"\'c\"
+// @is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }'
pub type WithHigherRankTraitBounds = for<'c> fn(val: &'c i32) -> i32;
diff --git a/tests/rustdoc-json/fn_pointer/qualifiers.rs b/tests/rustdoc-json/fn_pointer/qualifiers.rs
index 0ab776c21..1a62eb2ba 100644
--- a/tests/rustdoc-json/fn_pointer/qualifiers.rs
+++ b/tests/rustdoc-json/fn_pointer/qualifiers.rs
@@ -1,11 +1,11 @@
// ignore-tidy-linelength
-// @is "$.index[*][?(@.name=='FnPointer')].inner.typedef.type.function_pointer.header.unsafe" false
-// @is "$.index[*][?(@.name=='FnPointer')].inner.typedef.type.function_pointer.header.const" false
-// @is "$.index[*][?(@.name=='FnPointer')].inner.typedef.type.function_pointer.header.async" false
+// @is "$.index[*][?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.unsafe" false
+// @is "$.index[*][?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.const" false
+// @is "$.index[*][?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.async" false
pub type FnPointer = fn();
-// @is "$.index[*][?(@.name=='UnsafePointer')].inner.typedef.type.function_pointer.header.unsafe" true
-// @is "$.index[*][?(@.name=='UnsafePointer')].inner.typedef.type.function_pointer.header.const" false
-// @is "$.index[*][?(@.name=='UnsafePointer')].inner.typedef.type.function_pointer.header.async" false
+// @is "$.index[*][?(@.name=='UnsafePointer')].inner.type_alias.type.function_pointer.header.unsafe" true
+// @is "$.index[*][?(@.name=='UnsafePointer')].inner.type_alias.type.function_pointer.header.const" false
+// @is "$.index[*][?(@.name=='UnsafePointer')].inner.type_alias.type.function_pointer.header.async" false
pub type UnsafePointer = unsafe fn();
diff --git a/tests/rustdoc-json/primitives/primitive_type.rs b/tests/rustdoc-json/primitives/primitive_type.rs
index 5f251b3b8..89c5d06c0 100644
--- a/tests/rustdoc-json/primitives/primitive_type.rs
+++ b/tests/rustdoc-json/primitives/primitive_type.rs
@@ -1,17 +1,17 @@
#![feature(never_type)]
// @is "$.index[*][?(@.name=='PrimNever')].visibility" \"public\"
-// @is "$.index[*][?(@.name=='PrimNever')].inner.typedef.type.primitive" \"never\"
+// @is "$.index[*][?(@.name=='PrimNever')].inner.type_alias.type.primitive" \"never\"
pub type PrimNever = !;
-// @is "$.index[*][?(@.name=='PrimStr')].inner.typedef.type.primitive" \"str\"
+// @is "$.index[*][?(@.name=='PrimStr')].inner.type_alias.type.primitive" \"str\"
pub type PrimStr = str;
-// @is "$.index[*][?(@.name=='PrimBool')].inner.typedef.type.primitive" \"bool\"
+// @is "$.index[*][?(@.name=='PrimBool')].inner.type_alias.type.primitive" \"bool\"
pub type PrimBool = bool;
-// @is "$.index[*][?(@.name=='PrimChar')].inner.typedef.type.primitive" \"char\"
+// @is "$.index[*][?(@.name=='PrimChar')].inner.type_alias.type.primitive" \"char\"
pub type PrimChar = char;
-// @is "$.index[*][?(@.name=='PrimU8')].inner.typedef.type.primitive" \"u8\"
+// @is "$.index[*][?(@.name=='PrimU8')].inner.type_alias.type.primitive" \"u8\"
pub type PrimU8 = u8;
diff --git a/tests/rustdoc-json/type/dyn.rs b/tests/rustdoc-json/type/dyn.rs
index e5ee60fad..4db65b61d 100644
--- a/tests/rustdoc-json/type/dyn.rs
+++ b/tests/rustdoc-json/type/dyn.rs
@@ -7,40 +7,40 @@ use std::fmt::Debug;
// @set weird_order = "$.index[*][?(@.name=='WeirdOrder')].id"
// @ismany "$.index[*][?(@.name=='dyn')].inner.module.items[*]" $sync_int_gen $ref_fn $weird_order
-// @has "$.index[*][?(@.name=='SyncIntGen')].inner.typedef"
-// @is "$.index[*][?(@.name=='SyncIntGen')].inner.typedef.generics" '{"params": [], "where_predicates": []}'
-// @has "$.index[*][?(@.name=='SyncIntGen')].inner.typedef.type.resolved_path"
-// @is "$.index[*][?(@.name=='SyncIntGen')].inner.typedef.type.resolved_path.name" \"Box\"
-// @is "$.index[*][?(@.name=='SyncIntGen')].inner.typedef.type.resolved_path.args.angle_bracketed.bindings" []
-// @count "$.index[*][?(@.name=='SyncIntGen')].inner.typedef.type.resolved_path.args.angle_bracketed.args" 1
-// @has "$.index[*][?(@.name=='SyncIntGen')].inner.typedef.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait"
-// @is "$.index[*][?(@.name=='SyncIntGen')].inner.typedef.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.lifetime" \"\'static\"
-// @count "$.index[*][?(@.name=='SyncIntGen')].inner.typedef.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[*]" 3
-// @is "$.index[*][?(@.name=='SyncIntGen')].inner.typedef.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].generic_params" []
-// @is "$.index[*][?(@.name=='SyncIntGen')].inner.typedef.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[1].generic_params" []
-// @is "$.index[*][?(@.name=='SyncIntGen')].inner.typedef.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[2].generic_params" []
-// @is "$.index[*][?(@.name=='SyncIntGen')].inner.typedef.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].trait.name" '"Fn"'
-// @is "$.index[*][?(@.name=='SyncIntGen')].inner.typedef.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[1].trait.name" '"Send"'
-// @is "$.index[*][?(@.name=='SyncIntGen')].inner.typedef.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[2].trait.name" '"Sync"'
-// @is "$.index[*][?(@.name=='SyncIntGen')].inner.typedef.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].trait.args" '{"parenthesized": {"inputs": [],"output": {"primitive": "i32"}}}'
+// @has "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias"
+// @is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.generics" '{"params": [], "where_predicates": []}'
+// @has "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path"
+// @is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.name" \"Box\"
+// @is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.bindings" []
+// @count "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args" 1
+// @has "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait"
+// @is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.lifetime" \"\'static\"
+// @count "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[*]" 3
+// @is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].generic_params" []
+// @is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[1].generic_params" []
+// @is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[2].generic_params" []
+// @is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].trait.name" '"Fn"'
+// @is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[1].trait.name" '"Send"'
+// @is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[2].trait.name" '"Sync"'
+// @is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].trait.args" '{"parenthesized": {"inputs": [],"output": {"primitive": "i32"}}}'
pub type SyncIntGen = Box<dyn Fn() -> i32 + Send + Sync + 'static>;
-// @has "$.index[*][?(@.name=='RefFn')].inner.typedef"
-// @is "$.index[*][?(@.name=='RefFn')].inner.typedef.generics" '{"params": [{"kind": {"lifetime": {"outlives": []}},"name": "'\''a"}],"where_predicates": []}'
-// @has "$.index[*][?(@.name=='RefFn')].inner.typedef.type.borrowed_ref"
-// @is "$.index[*][?(@.name=='RefFn')].inner.typedef.type.borrowed_ref.mutable" 'false'
-// @is "$.index[*][?(@.name=='RefFn')].inner.typedef.type.borrowed_ref.lifetime" "\"'a\""
-// @has "$.index[*][?(@.name=='RefFn')].inner.typedef.type.borrowed_ref.type.dyn_trait"
-// @is "$.index[*][?(@.name=='RefFn')].inner.typedef.type.borrowed_ref.type.dyn_trait.lifetime" null
-// @count "$.index[*][?(@.name=='RefFn')].inner.typedef.type.borrowed_ref.type.dyn_trait.traits[*]" 1
-// @is "$.index[*][?(@.name=='RefFn')].inner.typedef.type.borrowed_ref.type.dyn_trait.traits[0].generic_params" '[{"kind": {"lifetime": {"outlives": []}},"name": "'\''b"}]'
-// @is "$.index[*][?(@.name=='RefFn')].inner.typedef.type.borrowed_ref.type.dyn_trait.traits[0].trait.name" '"Fn"'
-// @has "$.index[*][?(@.name=='RefFn')].inner.typedef.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.inputs[0].borrowed_ref"
-// @is "$.index[*][?(@.name=='RefFn')].inner.typedef.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.inputs[0].borrowed_ref.lifetime" "\"'b\""
-// @has "$.index[*][?(@.name=='RefFn')].inner.typedef.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.output.borrowed_ref"
-// @is "$.index[*][?(@.name=='RefFn')].inner.typedef.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.output.borrowed_ref.lifetime" "\"'b\""
+// @has "$.index[*][?(@.name=='RefFn')].inner.type_alias"
+// @is "$.index[*][?(@.name=='RefFn')].inner.type_alias.generics" '{"params": [{"kind": {"lifetime": {"outlives": []}},"name": "'\''a"}],"where_predicates": []}'
+// @has "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref"
+// @is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.mutable" 'false'
+// @is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.lifetime" "\"'a\""
+// @has "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait"
+// @is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.lifetime" null
+// @count "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[*]" 1
+// @is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].generic_params" '[{"kind": {"lifetime": {"outlives": []}},"name": "'\''b"}]'
+// @is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.name" '"Fn"'
+// @has "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.inputs[0].borrowed_ref"
+// @is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.inputs[0].borrowed_ref.lifetime" "\"'b\""
+// @has "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.output.borrowed_ref"
+// @is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.output.borrowed_ref.lifetime" "\"'b\""
pub type RefFn<'a> = &'a dyn for<'b> Fn(&'b i32) -> &'b i32;
-// @is "$.index[*][?(@.name=='WeirdOrder')].inner.typedef.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].trait.name" '"Send"'
-// @is "$.index[*][?(@.name=='WeirdOrder')].inner.typedef.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[1].trait.name" '"Debug"'
+// @is "$.index[*][?(@.name=='WeirdOrder')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].trait.name" '"Send"'
+// @is "$.index[*][?(@.name=='WeirdOrder')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[1].trait.name" '"Debug"'
pub type WeirdOrder = Box<dyn Send + Debug>;
diff --git a/tests/rustdoc-json/type/fn_lifetime.rs b/tests/rustdoc-json/type/fn_lifetime.rs
index 424c5dce2..4aca303e6 100644
--- a/tests/rustdoc-json/type/fn_lifetime.rs
+++ b/tests/rustdoc-json/type/fn_lifetime.rs
@@ -1,26 +1,26 @@
// ignore-tidy-linelength
-// @has "$.index[*][?(@.name=='GenericFn')].inner.typedef"
+// @has "$.index[*][?(@.name=='GenericFn')].inner.type_alias"
-// @ismany "$.index[*][?(@.name=='GenericFn')].inner.typedef.generics.params[*].name" \"\'a\"
-// @has "$.index[*][?(@.name=='GenericFn')].inner.typedef.generics.params[*].kind.lifetime"
-// @count "$.index[*][?(@.name=='GenericFn')].inner.typedef.generics.params[*].kind.lifetime.outlives[*]" 0
-// @count "$.index[*][?(@.name=='GenericFn')].inner.typedef.generics.where_predicates[*]" 0
-// @count "$.index[*][?(@.name=='GenericFn')].inner.typedef.type.function_pointer.generic_params[*]" 0
-// @count "$.index[*][?(@.name=='GenericFn')].inner.typedef.type.function_pointer.decl.inputs[*]" 1
-// @is "$.index[*][?(@.name=='GenericFn')].inner.typedef.type.function_pointer.decl.inputs[*][1].borrowed_ref.lifetime" \"\'a\"
-// @is "$.index[*][?(@.name=='GenericFn')].inner.typedef.type.function_pointer.decl.output.borrowed_ref.lifetime" \"\'a\"
+// @ismany "$.index[*][?(@.name=='GenericFn')].inner.type_alias.generics.params[*].name" \"\'a\"
+// @has "$.index[*][?(@.name=='GenericFn')].inner.type_alias.generics.params[*].kind.lifetime"
+// @count "$.index[*][?(@.name=='GenericFn')].inner.type_alias.generics.params[*].kind.lifetime.outlives[*]" 0
+// @count "$.index[*][?(@.name=='GenericFn')].inner.type_alias.generics.where_predicates[*]" 0
+// @count "$.index[*][?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.generic_params[*]" 0
+// @count "$.index[*][?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.decl.inputs[*]" 1
+// @is "$.index[*][?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.decl.inputs[*][1].borrowed_ref.lifetime" \"\'a\"
+// @is "$.index[*][?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.decl.output.borrowed_ref.lifetime" \"\'a\"
pub type GenericFn<'a> = fn(&'a i32) -> &'a i32;
-// @has "$.index[*][?(@.name=='ForAll')].inner.typedef"
-// @count "$.index[*][?(@.name=='ForAll')].inner.typedef.generics.params[*]" 0
-// @count "$.index[*][?(@.name=='ForAll')].inner.typedef.generics.where_predicates[*]" 0
-// @count "$.index[*][?(@.name=='ForAll')].inner.typedef.type.function_pointer.generic_params[*]" 1
-// @is "$.index[*][?(@.name=='ForAll')].inner.typedef.type.function_pointer.generic_params[*].name" \"\'a\"
-// @has "$.index[*][?(@.name=='ForAll')].inner.typedef.type.function_pointer.generic_params[*].kind.lifetime"
-// @count "$.index[*][?(@.name=='ForAll')].inner.typedef.type.function_pointer.generic_params[*].kind.lifetime.outlives[*]" 0
-// @count "$.index[*][?(@.name=='ForAll')].inner.typedef.type.function_pointer.decl.inputs[*]" 1
-// @is "$.index[*][?(@.name=='ForAll')].inner.typedef.type.function_pointer.decl.inputs[*][1].borrowed_ref.lifetime" \"\'a\"
-// @is "$.index[*][?(@.name=='ForAll')].inner.typedef.type.function_pointer.decl.output.borrowed_ref.lifetime" \"\'a\"
+// @has "$.index[*][?(@.name=='ForAll')].inner.type_alias"
+// @count "$.index[*][?(@.name=='ForAll')].inner.type_alias.generics.params[*]" 0
+// @count "$.index[*][?(@.name=='ForAll')].inner.type_alias.generics.where_predicates[*]" 0
+// @count "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*]" 1
+// @is "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*].name" \"\'a\"
+// @has "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*].kind.lifetime"
+// @count "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*].kind.lifetime.outlives[*]" 0
+// @count "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.decl.inputs[*]" 1
+// @is "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.decl.inputs[*][1].borrowed_ref.lifetime" \"\'a\"
+// @is "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.decl.output.borrowed_ref.lifetime" \"\'a\"
pub type ForAll = for<'a> fn(&'a i32) -> &'a i32;
diff --git a/tests/rustdoc-json/type/generic_default.rs b/tests/rustdoc-json/type/generic_default.rs
index b46428745..30817a42e 100644
--- a/tests/rustdoc-json/type/generic_default.rs
+++ b/tests/rustdoc-json/type/generic_default.rs
@@ -9,25 +9,25 @@ pub enum Result<T, E> {
// @set my_error = "$.index[*][?(@.name=='MyError')].id"
pub struct MyError {}
-// @has "$.index[*][?(@.name=='MyResult')].inner.typedef"
-// @count "$.index[*][?(@.name=='MyResult')].inner.typedef.generics.where_predicates[*]" 0
-// @count "$.index[*][?(@.name=='MyResult')].inner.typedef.generics.params[*]" 2
-// @is "$.index[*][?(@.name=='MyResult')].inner.typedef.generics.params[0].name" \"T\"
-// @is "$.index[*][?(@.name=='MyResult')].inner.typedef.generics.params[1].name" \"E\"
-// @has "$.index[*][?(@.name=='MyResult')].inner.typedef.generics.params[0].kind.type"
-// @has "$.index[*][?(@.name=='MyResult')].inner.typedef.generics.params[1].kind.type"
-// @count "$.index[*][?(@.name=='MyResult')].inner.typedef.generics.params[0].kind.type.bounds[*]" 0
-// @count "$.index[*][?(@.name=='MyResult')].inner.typedef.generics.params[1].kind.type.bounds[*]" 0
-// @is "$.index[*][?(@.name=='MyResult')].inner.typedef.generics.params[0].kind.type.default" null
-// @has "$.index[*][?(@.name=='MyResult')].inner.typedef.generics.params[1].kind.type.default.resolved_path"
-// @is "$.index[*][?(@.name=='MyResult')].inner.typedef.generics.params[1].kind.type.default.resolved_path.id" $my_error
-// @is "$.index[*][?(@.name=='MyResult')].inner.typedef.generics.params[1].kind.type.default.resolved_path.name" \"MyError\"
-// @has "$.index[*][?(@.name=='MyResult')].inner.typedef.type.resolved_path"
-// @is "$.index[*][?(@.name=='MyResult')].inner.typedef.type.resolved_path.id" $result
-// @is "$.index[*][?(@.name=='MyResult')].inner.typedef.type.resolved_path.name" \"Result\"
-// @is "$.index[*][?(@.name=='MyResult')].inner.typedef.type.resolved_path.args.angle_bracketed.bindings" []
-// @has "$.index[*][?(@.name=='MyResult')].inner.typedef.type.resolved_path.args.angle_bracketed.args[0].type.generic"
-// @has "$.index[*][?(@.name=='MyResult')].inner.typedef.type.resolved_path.args.angle_bracketed.args[1].type.generic"
-// @is "$.index[*][?(@.name=='MyResult')].inner.typedef.type.resolved_path.args.angle_bracketed.args[0].type.generic" \"T\"
-// @is "$.index[*][?(@.name=='MyResult')].inner.typedef.type.resolved_path.args.angle_bracketed.args[1].type.generic" \"E\"
+// @has "$.index[*][?(@.name=='MyResult')].inner.type_alias"
+// @count "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.where_predicates[*]" 0
+// @count "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[*]" 2
+// @is "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[0].name" \"T\"
+// @is "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[1].name" \"E\"
+// @has "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[0].kind.type"
+// @has "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type"
+// @count "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[0].kind.type.bounds[*]" 0
+// @count "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.bounds[*]" 0
+// @is "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[0].kind.type.default" null
+// @has "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.default.resolved_path"
+// @is "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.default.resolved_path.id" $my_error
+// @is "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.default.resolved_path.name" \"MyError\"
+// @has "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path"
+// @is "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.id" $result
+// @is "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.name" \"Result\"
+// @is "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.bindings" []
+// @has "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.generic"
+// @has "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[1].type.generic"
+// @is "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.generic" \"T\"
+// @is "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[1].type.generic" \"E\"
pub type MyResult<T, E = MyError> = Result<T, E>;
diff --git a/tests/rustdoc-ui/custom_code_classes_in_docs-warning.rs b/tests/rustdoc-ui/custom_code_classes_in_docs-warning.rs
new file mode 100644
index 000000000..5398d5833
--- /dev/null
+++ b/tests/rustdoc-ui/custom_code_classes_in_docs-warning.rs
@@ -0,0 +1,83 @@
+// This test ensures that warnings are working as expected for "custom_code_classes_in_docs"
+// feature.
+
+#![feature(custom_code_classes_in_docs)]
+#![deny(warnings)]
+#![feature(no_core)]
+#![no_core]
+
+/// ```{. }
+/// main;
+/// ```
+//~^^^ ERROR unexpected ` ` character after `.`
+pub fn foo() {}
+
+/// ```{class= a}
+/// main;
+/// ```
+//~^^^ ERROR unexpected ` ` character after `=`
+pub fn foo2() {}
+
+/// ```{#id}
+/// main;
+/// ```
+//~^^^ ERROR unexpected character `#`
+pub fn foo3() {}
+
+/// ```{{
+/// main;
+/// ```
+//~^^^ ERROR unexpected character `{`
+pub fn foo4() {}
+
+/// ```}
+/// main;
+/// ```
+//~^^^ ERROR unexpected character `}`
+pub fn foo5() {}
+
+/// ```)
+/// main;
+/// ```
+//~^^^ ERROR unexpected character `)`
+pub fn foo6() {}
+
+/// ```{class=}
+/// main;
+/// ```
+//~^^^ ERROR unexpected `}` character after `=`
+pub fn foo7() {}
+
+/// ```(
+/// main;
+/// ```
+//~^^^ ERROR unclosed comment: missing `)` at the end
+pub fn foo8() {}
+
+/// ```{class=one=two}
+/// main;
+/// ```
+//~^^^ ERROR unexpected `=` character
+pub fn foo9() {}
+
+/// ```{.one.two}
+/// main;
+/// ```
+pub fn foo10() {}
+
+/// ```{class=(one}
+/// main;
+/// ```
+//~^^^ ERROR unexpected `(` character after `=`
+pub fn foo11() {}
+
+/// ```{class=one.two}
+/// main;
+/// ```
+pub fn foo12() {}
+
+/// ```{(comment)}
+/// main;
+/// ```
+//~^^^ ERROR unexpected character `(`
+pub fn foo13() {}
diff --git a/tests/rustdoc-ui/custom_code_classes_in_docs-warning.stderr b/tests/rustdoc-ui/custom_code_classes_in_docs-warning.stderr
new file mode 100644
index 000000000..14b4b3bab
--- /dev/null
+++ b/tests/rustdoc-ui/custom_code_classes_in_docs-warning.stderr
@@ -0,0 +1,97 @@
+error: unexpected ` ` character after `.`
+ --> $DIR/custom_code_classes_in_docs-warning.rs:9:1
+ |
+LL | / /// ```{. }
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+ |
+note: the lint level is defined here
+ --> $DIR/custom_code_classes_in_docs-warning.rs:5:9
+ |
+LL | #![deny(warnings)]
+ | ^^^^^^^^
+ = note: `#[deny(rustdoc::invalid_codeblock_attributes)]` implied by `#[deny(warnings)]`
+
+error: unexpected ` ` character after `=`
+ --> $DIR/custom_code_classes_in_docs-warning.rs:15:1
+ |
+LL | / /// ```{class= a}
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+
+error: unexpected character `#`
+ --> $DIR/custom_code_classes_in_docs-warning.rs:21:1
+ |
+LL | / /// ```{#id}
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+
+error: unexpected character `{`
+ --> $DIR/custom_code_classes_in_docs-warning.rs:27:1
+ |
+LL | / /// ```{{
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+
+error: unexpected character `}`
+ --> $DIR/custom_code_classes_in_docs-warning.rs:33:1
+ |
+LL | / /// ```}
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+
+error: unexpected character `)`
+ --> $DIR/custom_code_classes_in_docs-warning.rs:39:1
+ |
+LL | / /// ```)
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+
+error: unexpected `}` character after `=`
+ --> $DIR/custom_code_classes_in_docs-warning.rs:45:1
+ |
+LL | / /// ```{class=}
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+
+error: unclosed comment: missing `)` at the end
+ --> $DIR/custom_code_classes_in_docs-warning.rs:51:1
+ |
+LL | / /// ```(
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+
+error: unexpected `=` character
+ --> $DIR/custom_code_classes_in_docs-warning.rs:57:1
+ |
+LL | / /// ```{class=one=two}
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+
+error: unexpected `(` character after `=`
+ --> $DIR/custom_code_classes_in_docs-warning.rs:68:1
+ |
+LL | / /// ```{class=(one}
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+
+error: unexpected character `(`
+ --> $DIR/custom_code_classes_in_docs-warning.rs:79:1
+ |
+LL | / /// ```{(comment)}
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+
+error: aborting due to 11 previous errors
+
diff --git a/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.rs b/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.rs
new file mode 100644
index 000000000..57d9038cb
--- /dev/null
+++ b/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.rs
@@ -0,0 +1,17 @@
+// This test ensures that warnings are working as expected for "custom_code_classes_in_docs"
+// feature.
+
+#![feature(custom_code_classes_in_docs)]
+#![deny(warnings)]
+#![feature(no_core)]
+#![no_core]
+
+/// ```{class="}
+/// main;
+/// ```
+//~^^^ ERROR unclosed quote string
+//~| ERROR unclosed quote string
+/// ```"
+/// main;
+/// ```
+pub fn foo() {}
diff --git a/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr b/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr
new file mode 100644
index 000000000..4f2ded78c
--- /dev/null
+++ b/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr
@@ -0,0 +1,33 @@
+error: unclosed quote string `"`
+ --> $DIR/custom_code_classes_in_docs-warning3.rs:9:1
+ |
+LL | / /// ```{class="}
+LL | | /// main;
+LL | | /// ```
+LL | |
+... |
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+ |
+note: the lint level is defined here
+ --> $DIR/custom_code_classes_in_docs-warning3.rs:5:9
+ |
+LL | #![deny(warnings)]
+ | ^^^^^^^^
+ = note: `#[deny(rustdoc::invalid_codeblock_attributes)]` implied by `#[deny(warnings)]`
+
+error: unclosed quote string `"`
+ --> $DIR/custom_code_classes_in_docs-warning3.rs:9:1
+ |
+LL | / /// ```{class="}
+LL | | /// main;
+LL | | /// ```
+LL | |
+... |
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/rustdoc-ui/feature-gate-custom_code_classes_in_docs.rs b/tests/rustdoc-ui/feature-gate-custom_code_classes_in_docs.rs
new file mode 100644
index 000000000..99263a944
--- /dev/null
+++ b/tests/rustdoc-ui/feature-gate-custom_code_classes_in_docs.rs
@@ -0,0 +1,15 @@
+// check-pass
+
+/// ```{class=language-c}
+/// int main(void) { return 0; }
+/// ```
+//~^^^ WARNING custom classes in code blocks will change behaviour
+//~| NOTE found these custom classes: class=language-c
+//~| NOTE see issue #79483 <https://github.com/rust-lang/rust/issues/79483>
+//~| HELP add `#![feature(custom_code_classes_in_docs)]` to the crate attributes to enable
+pub struct Bar;
+
+/// ```ASN.1
+/// int main(void) { return 0; }
+/// ```
+pub struct Bar2;
diff --git a/tests/rustdoc-ui/feature-gate-custom_code_classes_in_docs.stderr b/tests/rustdoc-ui/feature-gate-custom_code_classes_in_docs.stderr
new file mode 100644
index 000000000..1a2360d9b
--- /dev/null
+++ b/tests/rustdoc-ui/feature-gate-custom_code_classes_in_docs.stderr
@@ -0,0 +1,14 @@
+warning: custom classes in code blocks will change behaviour
+ --> $DIR/feature-gate-custom_code_classes_in_docs.rs:3:1
+ |
+LL | / /// ```{class=language-c}
+LL | | /// int main(void) { return 0; }
+LL | | /// ```
+ | |_______^
+ |
+ = note: see issue #79483 <https://github.com/rust-lang/rust/issues/79483> for more information
+ = help: add `#![feature(custom_code_classes_in_docs)]` to the crate attributes to enable
+ = note: found these custom classes: class=language-c
+
+warning: 1 warning emitted
+
diff --git a/tests/rustdoc-ui/issue-102467.rs b/tests/rustdoc-ui/issue-102467.rs
new file mode 100644
index 000000000..bff876e41
--- /dev/null
+++ b/tests/rustdoc-ui/issue-102467.rs
@@ -0,0 +1,15 @@
+// Regression test for <https://github.com/rust-lang/rust/issues/102467>.
+// It ensures that the expected error is displayed.
+
+#![feature(associated_const_equality)]
+
+trait T {
+ type A: S<C<X = 0i32> = 34>;
+ //~^ ERROR associated type bindings are not allowed here
+}
+
+trait S {
+ const C: i32;
+}
+
+fn main() {}
diff --git a/tests/rustdoc-ui/issue-102467.stderr b/tests/rustdoc-ui/issue-102467.stderr
new file mode 100644
index 000000000..a337293f7
--- /dev/null
+++ b/tests/rustdoc-ui/issue-102467.stderr
@@ -0,0 +1,9 @@
+error[E0229]: associated type bindings are not allowed here
+ --> $DIR/issue-102467.rs:7:17
+ |
+LL | type A: S<C<X = 0i32> = 34>;
+ | ^^^^^^^^ associated type not allowed here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0229`.
diff --git a/tests/rustdoc-ui/issues/issue-91713.stdout b/tests/rustdoc-ui/issues/issue-91713.stdout
index 167835243..bbea7e5c2 100644
--- a/tests/rustdoc-ui/issues/issue-91713.stdout
+++ b/tests/rustdoc-ui/issues/issue-91713.stdout
@@ -1,4 +1,5 @@
Available passes for running rustdoc:
+check-custom-code-classes - check for custom code classes without the feature-gate enabled
check_doc_test_visibility - run various visibility-related lints on doctests
strip-hidden - strips all `#[doc(hidden)]` items from the output
strip-private - strips all private items from a crate which cannot be seen externally, implies strip-priv-imports
@@ -10,6 +11,7 @@ calculate-doc-coverage - counts the number of items with and without documentati
run-lints - runs some of rustdoc's lints
Default passes for rustdoc:
+check-custom-code-classes
collect-trait-impls
check_doc_test_visibility
strip-hidden (when not --document-hidden-items)
diff --git a/tests/rustdoc/issue-15169.rs b/tests/rustdoc/anchor-id-trait-method-15169.rs
index e525d85e2..26bb59c18 100644
--- a/tests/rustdoc/issue-15169.rs
+++ b/tests/rustdoc/anchor-id-trait-method-15169.rs
@@ -1,3 +1,7 @@
// @has issue_15169/struct.Foo.html '//*[@id="method.eq"]' 'fn eq'
+
+// https://github.com/rust-lang/rust/issues/15169
+#![crate_name="issue_15169"]
+
#[derive(PartialEq)]
pub struct Foo;
diff --git a/tests/rustdoc/issue-20646.rs b/tests/rustdoc/assoc-type-bindings-20646.rs
index b2ee9c260..375b5b5b2 100644
--- a/tests/rustdoc/issue-20646.rs
+++ b/tests/rustdoc/assoc-type-bindings-20646.rs
@@ -1,6 +1,8 @@
// aux-build:issue-20646.rs
// ignore-cross-compile
+// https://github.com/rust-lang/rust/issues/20646
+#![crate_name="issue_20646"]
#![feature(associated_types)]
extern crate issue_20646;
diff --git a/tests/rustdoc/auxiliary/cross_crate_generic_typedef.rs b/tests/rustdoc/auxiliary/cross_crate_generic_typedef.rs
new file mode 100644
index 000000000..f4e020b3b
--- /dev/null
+++ b/tests/rustdoc/auxiliary/cross_crate_generic_typedef.rs
@@ -0,0 +1,5 @@
+pub struct InlineOne<A> {
+ pub inline: A
+}
+
+pub type InlineU64 = InlineOne<u64>;
diff --git a/tests/rustdoc/const-effect-param.rs b/tests/rustdoc/const-effect-param.rs
new file mode 100644
index 000000000..f50a9b96d
--- /dev/null
+++ b/tests/rustdoc/const-effect-param.rs
@@ -0,0 +1,12 @@
+#![crate_name = "foo"]
+#![feature(effects, const_trait_impl)]
+
+#[const_trait]
+pub trait Tr {
+ fn f();
+}
+
+// @has foo/fn.g.html
+// @has - '//pre[@class="rust item-decl"]' 'pub const fn g<T: Tr>()'
+/// foo
+pub const fn g<T: ~const Tr>() {}
diff --git a/tests/rustdoc/const-fn-effects.rs b/tests/rustdoc/const-fn-effects.rs
new file mode 100644
index 000000000..7c19b4b2c
--- /dev/null
+++ b/tests/rustdoc/const-fn-effects.rs
@@ -0,0 +1,19 @@
+#![crate_name = "foo"]
+#![feature(effects)]
+
+// @has foo/fn.bar.html
+// @has - '//pre[@class="rust item-decl"]' 'pub const fn bar() -> '
+/// foo
+pub const fn bar() -> usize {
+ 2
+}
+
+// @has foo/struct.Foo.html
+// @has - '//*[@class="method"]' 'const fn new()'
+pub struct Foo(usize);
+
+impl Foo {
+ pub const fn new() -> Foo {
+ Foo(0)
+ }
+}
diff --git a/tests/rustdoc/const-generics/const-generic-defaults.rs b/tests/rustdoc/const-generics/const-generic-defaults.rs
index f781c6a62..7a0a79411 100644
--- a/tests/rustdoc/const-generics/const-generic-defaults.rs
+++ b/tests/rustdoc/const-generics/const-generic-defaults.rs
@@ -1,5 +1,5 @@
#![crate_name = "foo"]
// @has foo/struct.Foo.html '//pre[@class="rust item-decl"]' \
-// 'pub struct Foo<const M: usize = 10, const N: usize = M, T = i32>(_);'
+// 'pub struct Foo<const M: usize = 10, const N: usize = M, T = i32>('
pub struct Foo<const M: usize = 10, const N: usize = M, T = i32>(T);
diff --git a/tests/rustdoc/const-generics/const-generics-docs.rs b/tests/rustdoc/const-generics/const-generics-docs.rs
index 828486a41..70a9518f0 100644
--- a/tests/rustdoc/const-generics/const-generics-docs.rs
+++ b/tests/rustdoc/const-generics/const-generics-docs.rs
@@ -33,7 +33,7 @@ impl<const N: usize> Trait<N> for [u8; N] {}
// @has foo/struct.Foo.html '//pre[@class="rust item-decl"]' \
// 'pub struct Foo<const N: usize> where u8: Trait<N>'
pub struct Foo<const N: usize> where u8: Trait<N>;
-// @has foo/struct.Bar.html '//pre[@class="rust item-decl"]' 'pub struct Bar<T, const N: usize>(_)'
+// @has foo/struct.Bar.html '//pre[@class="rust item-decl"]' 'pub struct Bar<T, const N: usize>('
pub struct Bar<T, const N: usize>([T; N]);
// @has foo/struct.Foo.html '//*[@id="impl-Foo%3CM%3E"]/h3[@class="code-header"]' 'impl<const M: usize> Foo<M>where u8: Trait<M>'
@@ -92,7 +92,7 @@ macro_rules! define_me {
}
// @has foo/struct.Foz.html '//pre[@class="rust item-decl"]' \
-// 'pub struct Foz<const N: usize>(_);'
+// 'pub struct Foz<const N: usize>(/* private fields */);'
define_me!(Foz<N>);
trait Q {
diff --git a/tests/rustdoc/custom_code_classes.rs b/tests/rustdoc/custom_code_classes.rs
new file mode 100644
index 000000000..cd20d8b7d
--- /dev/null
+++ b/tests/rustdoc/custom_code_classes.rs
@@ -0,0 +1,28 @@
+// Test for `custom_code_classes_in_docs` feature.
+
+#![feature(custom_code_classes_in_docs)]
+#![crate_name = "foo"]
+#![feature(no_core)]
+#![no_core]
+
+// @has 'foo/struct.Bar.html'
+// @has - '//*[@id="main-content"]//pre[@class="language-whatever hoho-c"]' 'main;'
+// @has - '//*[@id="main-content"]//pre[@class="language-whatever2 haha-c"]' 'main;'
+// @has - '//*[@id="main-content"]//pre[@class="language-whatever4 huhu-c"]' 'main;'
+
+/// ```{class=hoho-c},whatever
+/// main;
+/// ```
+///
+/// Testing multiple kinds of orders.
+///
+/// ```whatever2 {class=haha-c}
+/// main;
+/// ```
+///
+/// Testing with multiple "unknown". Only the first should be used.
+///
+/// ```whatever4,{.huhu-c} whatever5
+/// main;
+/// ```
+pub struct Bar;
diff --git a/tests/rustdoc/issue-19190-2.rs b/tests/rustdoc/deref-methods-19190-foreign-type.rs
index b6416e2e5..c83269921 100644
--- a/tests/rustdoc/issue-19190-2.rs
+++ b/tests/rustdoc/deref-methods-19190-foreign-type.rs
@@ -1,3 +1,7 @@
+// https://github.com/rust-lang/rust/issues/19190
+
+#![crate_name="issue_19190_2"]
+
use std::ops::Deref;
pub struct Bar;
diff --git a/tests/rustdoc/issue-19190-3.rs b/tests/rustdoc/deref-methods-19190-inline.rs
index 4d34ce650..619b268d6 100644
--- a/tests/rustdoc/issue-19190-3.rs
+++ b/tests/rustdoc/deref-methods-19190-inline.rs
@@ -1,6 +1,9 @@
// aux-build:issue-19190-3.rs
// ignore-cross-compile
+// https://github.com/rust-lang/rust/issues/19190
+#![crate_name="issue_19190_3"]
+
extern crate issue_19190_3;
use std::ops::Deref;
diff --git a/tests/rustdoc/issue-19190.rs b/tests/rustdoc/deref-methods-19190.rs
index 2046273e2..4c274d82f 100644
--- a/tests/rustdoc/issue-19190.rs
+++ b/tests/rustdoc/deref-methods-19190.rs
@@ -1,3 +1,6 @@
+// https://github.com/rust-lang/rust/issues/19190
+#![crate_name="issue_19190"]
+
use std::ops::Deref;
pub struct Foo;
diff --git a/tests/rustdoc/issue-13698.rs b/tests/rustdoc/doc-hidden-method-13698.rs
index 3046a8a28..f1bd6e73b 100644
--- a/tests/rustdoc/issue-13698.rs
+++ b/tests/rustdoc/doc-hidden-method-13698.rs
@@ -1,6 +1,9 @@
// aux-build:issue-13698.rs
// ignore-cross-compile
+// https://github.com/rust-lang/rust/issues/13698
+#![crate_name="issue_13698"]
+
extern crate issue_13698;
pub struct Foo;
diff --git a/tests/rustdoc/issue-18199.rs b/tests/rustdoc/doc-test-attr-18199.rs
index 9cc58b162..c9d223532 100644
--- a/tests/rustdoc/issue-18199.rs
+++ b/tests/rustdoc/doc-test-attr-18199.rs
@@ -1,4 +1,5 @@
// compile-flags:--test
+// https://github.com/rust-lang/rust/issues/18199
#![doc(test(attr(feature(staged_api))))]
diff --git a/tests/rustdoc/issue-15347.rs b/tests/rustdoc/document-hidden-items-15347.rs
index e93d74011..d8a760e56 100644
--- a/tests/rustdoc/issue-15347.rs
+++ b/tests/rustdoc/document-hidden-items-15347.rs
@@ -1,4 +1,7 @@
// compile-flags: -Z unstable-options --document-hidden-items
+// https://github.com/rust-lang/rust/issues/15347
+
+#![crate_name="issue_15347"]
// @has issue_15347/fn.foo.html
#[doc(hidden)]
diff --git a/tests/rustdoc/issue-12834.rs b/tests/rustdoc/highlight-invalid-rust-12834.rs
index 9605a1e78..f8acc5002 100644
--- a/tests/rustdoc/issue-12834.rs
+++ b/tests/rustdoc/highlight-invalid-rust-12834.rs
@@ -1,6 +1,8 @@
// Tests that failing to syntax highlight a rust code-block doesn't cause
// rustdoc to fail, while still rendering the code-block (without highlighting).
+// https://github.com/rust-lang/rust/issues/12834
+#![crate_name="issue_12834"]
#![allow(rustdoc::invalid_rust_codeblocks)]
// @has issue_12834/fn.foo.html
diff --git a/tests/rustdoc/html-no-source.rs b/tests/rustdoc/html-no-source.rs
new file mode 100644
index 000000000..25615a73c
--- /dev/null
+++ b/tests/rustdoc/html-no-source.rs
@@ -0,0 +1,30 @@
+// compile-flags: -Zunstable-options --html-no-source
+
+// This test ensures that the `--html-no-source` flag disables
+// the creation of the `src` folder.
+
+#![feature(staged_api)]
+#![stable(feature = "bar", since = "1.0")]
+#![crate_name = "foo"]
+
+// Ensures that there is no items in the corresponding "src" folder.
+// @files 'src/foo' '[]'
+
+// @has foo/fn.foo.html
+// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · '
+// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · '
+#[stable(feature = "bar", since = "1.0")]
+pub fn foo() {}
+
+// @has foo/struct.Bar.html
+// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · '
+// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · '
+#[stable(feature = "bar", since = "1.0")]
+pub struct Bar;
+
+impl Bar {
+ // @has - '//*[@id="method.bar"]/*[@class="since rightside"]' '2.0'
+ // @!has - '//*[@id="method.bar"]/*[@class="rightside"]' '2.0 ·'
+ #[stable(feature = "foobar", since = "2.0")]
+ pub fn bar() {}
+}
diff --git a/tests/rustdoc/issue-19181.rs b/tests/rustdoc/ice-type-error-19181.rs
index 3dea152fc..3ced61366 100644
--- a/tests/rustdoc/issue-19181.rs
+++ b/tests/rustdoc/ice-type-error-19181.rs
@@ -1,4 +1,5 @@
// compile-flags:--test
+// https://github.com/rust-lang/rust/issues/19181
// rustdoc should not panic when target crate has compilation errors
diff --git a/tests/rustdoc/issue-20175.rs b/tests/rustdoc/impl-ref-20175.rs
index 6a42e2afb..a92db2d0a 100644
--- a/tests/rustdoc/issue-20175.rs
+++ b/tests/rustdoc/impl-ref-20175.rs
@@ -1,3 +1,7 @@
+// https://github.com/rust-lang/rust/issues/20175
+
+#![crate_name="issue_20175"]
+
pub trait Foo {
fn foo(&self) {}
}
diff --git a/tests/rustdoc/issue-16265-1.rs b/tests/rustdoc/infinite-redirection-16265-1.rs
index 2fda637a6..7d72469bd 100644
--- a/tests/rustdoc/issue-16265-1.rs
+++ b/tests/rustdoc/infinite-redirection-16265-1.rs
@@ -1,3 +1,6 @@
+// https://github.com/rust-lang/rust/issues/16265
+#![crate_name="issue_16265_1"]
+
pub struct Foo;
// @hasraw issue_16265_1/traits/index.html 'source'
diff --git a/tests/rustdoc/issue-16265-2.rs b/tests/rustdoc/infinite-redirection-16265-2.rs
index c3eb35617..7a4791c5f 100644
--- a/tests/rustdoc/issue-16265-2.rs
+++ b/tests/rustdoc/infinite-redirection-16265-2.rs
@@ -1,3 +1,6 @@
+// https://github.com/rust-lang/rust/issues/16265
+#![crate_name="issue_16265_2"]
+
// @hasraw issue_16265_2/index.html 'source'
trait Y {}
diff --git a/tests/rustdoc/issue-20727-2.rs b/tests/rustdoc/inline-assoc-type-20727-bindings.rs
index c1aa9617b..e59dec29d 100644
--- a/tests/rustdoc/issue-20727-2.rs
+++ b/tests/rustdoc/inline-assoc-type-20727-bindings.rs
@@ -1,6 +1,9 @@
// aux-build:issue-20727.rs
// ignore-cross-compile
+// https://github.com/rust-lang/rust/issues/20727
+#![crate_name="issue_20727_2"]
+
extern crate issue_20727;
// @has issue_20727_2/trait.Add.html
diff --git a/tests/rustdoc/issue-20727-3.rs b/tests/rustdoc/inline-assoc-type-20727-bounds-deref.rs
index 2f9d91fc5..005ee3e32 100644
--- a/tests/rustdoc/issue-20727-3.rs
+++ b/tests/rustdoc/inline-assoc-type-20727-bounds-deref.rs
@@ -1,6 +1,9 @@
// aux-build:issue-20727.rs
// ignore-cross-compile
+// https://github.com/rust-lang/rust/issues/20727
+#![crate_name="issue_20727_3"]
+
extern crate issue_20727;
pub trait Bar {}
diff --git a/tests/rustdoc/issue-20727-4.rs b/tests/rustdoc/inline-assoc-type-20727-bounds-index.rs
index ec9f18fc3..1a3f4cd20 100644
--- a/tests/rustdoc/issue-20727-4.rs
+++ b/tests/rustdoc/inline-assoc-type-20727-bounds-index.rs
@@ -1,6 +1,9 @@
// aux-build:issue-20727.rs
// ignore-cross-compile
+// https://github.com/rust-lang/rust/issues/20727
+#![crate_name="issue_20727_4"]
+
extern crate issue_20727;
// @has issue_20727_4/trait.Index.html
diff --git a/tests/rustdoc/issue-20727.rs b/tests/rustdoc/inline-assoc-type-20727-bounds.rs
index 266848bee..7cbc8d381 100644
--- a/tests/rustdoc/issue-20727.rs
+++ b/tests/rustdoc/inline-assoc-type-20727-bounds.rs
@@ -1,6 +1,9 @@
// aux-build:issue-20727.rs
// ignore-cross-compile
+// https://github.com/rust-lang/rust/issues/20727
+#![crate_name="issue_20727"]
+
extern crate issue_20727;
// @has issue_20727/trait.Deref.html
diff --git a/tests/rustdoc/inline_cross/async-fn.rs b/tests/rustdoc/inline_cross/async-fn.rs
new file mode 100644
index 000000000..95e175aab
--- /dev/null
+++ b/tests/rustdoc/inline_cross/async-fn.rs
@@ -0,0 +1,19 @@
+// Regression test for issue #115760.
+// Check that we render the correct return type of free and
+// associated async functions reexported from external crates.
+
+// aux-crate:async_fn=async-fn.rs
+// edition: 2021
+#![crate_name = "user"]
+
+// @has user/fn.load.html
+// @has - '//pre[@class="rust item-decl"]' "pub async fn load() -> i32"
+pub use async_fn::load;
+
+// @has user/trait.Load.html
+// @has - '//*[@id="tymethod.run"]' 'async fn run(&self) -> i32'
+pub use async_fn::Load;
+
+// @has user/struct.Loader.html
+// @has - '//*[@id="method.run"]' 'async fn run(&self) -> i32'
+pub use async_fn::Loader;
diff --git a/tests/rustdoc/inline_cross/auxiliary/async-fn.rs b/tests/rustdoc/inline_cross/auxiliary/async-fn.rs
new file mode 100644
index 000000000..767564ed1
--- /dev/null
+++ b/tests/rustdoc/inline_cross/auxiliary/async-fn.rs
@@ -0,0 +1,18 @@
+#![feature(async_fn_in_trait)]
+// edition: 2021
+
+pub async fn load() -> i32 {
+ 0
+}
+
+pub trait Load {
+ async fn run(&self) -> i32;
+}
+
+pub struct Loader;
+
+impl Load for Loader {
+ async fn run(&self) -> i32 {
+ 1
+ }
+}
diff --git a/tests/rustdoc/inline_cross/auxiliary/const-fn.rs b/tests/rustdoc/inline_cross/auxiliary/const-fn.rs
new file mode 100644
index 000000000..26332b419
--- /dev/null
+++ b/tests/rustdoc/inline_cross/auxiliary/const-fn.rs
@@ -0,0 +1,5 @@
+#![feature(effects)]
+
+pub const fn load() -> i32 {
+ 0
+}
diff --git a/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs b/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs
index 19433c968..42cfc3dc3 100644
--- a/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs
+++ b/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs
@@ -33,9 +33,3 @@ pub struct Foo;
impl Foo {
pub fn method<'a>(_x: impl Clone + Into<Vec<u8>> + 'a) {}
}
-
-pub struct Bar;
-
-impl Bar {
- pub async fn async_foo(&self) {}
-}
diff --git a/tests/rustdoc/inline_cross/const-fn.rs b/tests/rustdoc/inline_cross/const-fn.rs
new file mode 100644
index 000000000..24934b873
--- /dev/null
+++ b/tests/rustdoc/inline_cross/const-fn.rs
@@ -0,0 +1,10 @@
+// Regression test for issue #116629.
+// Check that we render the correct generic params of const fn
+
+// aux-crate:const_fn=const-fn.rs
+// edition: 2021
+#![crate_name = "user"]
+
+// @has user/fn.load.html
+// @has - '//pre[@class="rust item-decl"]' "pub const fn load() -> i32"
+pub use const_fn::load;
diff --git a/tests/rustdoc/inline_cross/impl_trait.rs b/tests/rustdoc/inline_cross/impl_trait.rs
index b6a1552bc..5c802c514 100644
--- a/tests/rustdoc/inline_cross/impl_trait.rs
+++ b/tests/rustdoc/inline_cross/impl_trait.rs
@@ -33,15 +33,7 @@ pub use impl_trait_aux::func4;
// @!has - '//pre[@class="rust item-decl"]' 'where'
pub use impl_trait_aux::func5;
-// @has impl_trait/fn.async_fn.html
-// @has - '//pre[@class="rust item-decl"]' "pub async fn async_fn()"
-pub use impl_trait_aux::async_fn;
-
// @has impl_trait/struct.Foo.html
// @has - '//*[@id="method.method"]//h4[@class="code-header"]' "pub fn method<'a>(_x: impl Clone + Into<Vec<u8, Global>> + 'a)"
// @!has - '//*[@id="method.method"]//h4[@class="code-header"]' 'where'
pub use impl_trait_aux::Foo;
-
-// @has impl_trait/struct.Bar.html
-// @has - '//*[@id="method.async_foo"]' "pub async fn async_foo("
-pub use impl_trait_aux::Bar;
diff --git a/tests/rustdoc/issue-105735-overlapping-reexport-2.rs b/tests/rustdoc/issue-105735-overlapping-reexport-2.rs
index 910824839..5d2c553d8 100644
--- a/tests/rustdoc/issue-105735-overlapping-reexport-2.rs
+++ b/tests/rustdoc/issue-105735-overlapping-reexport-2.rs
@@ -8,7 +8,7 @@
// @has - '//*[@class="item-name"]/a[@class="constant"]' 'AtomicU8'
// We also ensure we don't have another item displayed.
// @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 2
-// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Type Definitions'
+// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Type Aliases'
// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Constants'
mod other {
diff --git a/tests/rustdoc/issue-109449-doc-hidden-reexports.rs b/tests/rustdoc/issue-109449-doc-hidden-reexports.rs
index b0c225401..3b836a219 100644
--- a/tests/rustdoc/issue-109449-doc-hidden-reexports.rs
+++ b/tests/rustdoc/issue-109449-doc-hidden-reexports.rs
@@ -104,7 +104,7 @@ pub mod glob_reexport {
// @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 3
// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Re-exports'
// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Structs'
- // @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Type Definitions'
+ // @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Type Aliases'
// Now we check we have 1 re-export and 2 inlined items.
// If not item from a glob re-export is visible, we don't show the re-export.
@@ -135,9 +135,9 @@ pub mod doc_hidden_reexport {
// @has - '//a[@class="struct"]' 'Reexport'
// Check that the `#[doc(hidden)]` re-export's attributes are not taken into account.
// @has - '//*[@class="desc docblock-short"]' 'Visible. Original.'
+ /// Visible.
+ pub use self::Bar3 as Reexport;
/// Hidden.
#[doc(hidden)]
pub use crate::private::Bar3;
- /// Visible.
- pub use self::Bar3 as Reexport;
}
diff --git a/tests/rustdoc/issue-32077-type-alias-impls.rs b/tests/rustdoc/issue-32077-type-alias-impls.rs
new file mode 100644
index 000000000..ac486c36a
--- /dev/null
+++ b/tests/rustdoc/issue-32077-type-alias-impls.rs
@@ -0,0 +1,66 @@
+// Regression test for <https://github.com/rust-lang/rust/issues/32077>.
+
+#![crate_name = "foo"]
+
+pub struct GenericStruct<T>(T);
+
+impl<T> GenericStruct<T> {
+ pub fn on_gen(arg: T) {}
+}
+
+impl GenericStruct<u32> {
+ pub fn on_u32(arg: u32) {}
+}
+
+pub trait Foo {}
+pub trait Bar {}
+
+impl<T> Foo for GenericStruct<T> {}
+impl Bar for GenericStruct<u32> {}
+
+// @has 'foo/type.TypedefStruct.html'
+// We check that "Aliased type" is also present as a title in the sidebar.
+// @has - '//*[@class="sidebar-elems"]//h3/a[@href="#aliased-type"]' 'Aliased type'
+// We check that we have the implementation of the type alias itself.
+// @has - '//*[@id="impl-TypedefStruct"]/h3' 'impl TypedefStruct'
+// @has - '//*[@id="method.on_alias"]/h4' 'pub fn on_alias()'
+// @has - '//*[@id="impl-GenericStruct%3CT%3E"]/h3' 'impl<T> GenericStruct<T>'
+// @has - '//*[@id="method.on_gen"]/h4' 'pub fn on_gen(arg: T)'
+// @has - '//*[@id="impl-Foo-for-GenericStruct%3CT%3E"]/h3' 'impl<T> Foo for GenericStruct<T>'
+// This trait implementation doesn't match the type alias parameters so shouldn't appear in docs.
+// @!has - '//h3' 'impl Bar for GenericStruct<u32> {}'
+// Same goes for the `Deref` impl.
+// @!has - '//h2' 'Methods from Deref<Target = u32>'
+// @count - '//nav[@class="sidebar"]//a' 'on_alias' 1
+// @count - '//nav[@class="sidebar"]//a' 'on_gen' 1
+// @count - '//nav[@class="sidebar"]//a' 'Foo' 1
+// @!has - '//nav[@class="sidebar"]//a' 'Bar'
+// @!has - '//nav[@class="sidebar"]//a' 'on_u32'
+pub type TypedefStruct = GenericStruct<u8>;
+
+impl TypedefStruct {
+ pub fn on_alias() {}
+}
+
+impl std::ops::Deref for GenericStruct<u32> {
+ type Target = u32;
+
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
+
+pub struct Wrap<T>(GenericStruct<T>);
+
+// @has 'foo/type.Alias.html'
+// @has - '//h2' 'Methods from Deref<Target = u32>'
+// @has - '//*[@id="impl-Deref-for-Wrap%3CT%3E"]/h3' 'impl<T> Deref for Wrap<T>'
+pub type Alias = Wrap<u32>;
+
+impl<T> std::ops::Deref for Wrap<T> {
+ type Target = GenericStruct<T>;
+
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
diff --git a/tests/rustdoc/issue-88600.rs b/tests/rustdoc/issue-88600.rs
index db0d102b7..f89af472f 100644
--- a/tests/rustdoc/issue-88600.rs
+++ b/tests/rustdoc/issue-88600.rs
@@ -8,10 +8,10 @@ pub struct S;
// @has issue_88600/enum.FooEnum.html
pub enum FooEnum {
- // @has - '//*[@id="variant.HiddenTupleItem"]//h3' 'HiddenTupleItem(_)'
+ // @has - '//*[@id="variant.HiddenTupleItem"]//h3' 'HiddenTupleItem(/* private fields */)'
// @count - '//*[@id="variant.HiddenTupleItem.field.0"]' 0
HiddenTupleItem(#[doc(hidden)] H),
- // @has - '//*[@id="variant.MultipleHidden"]//h3' 'MultipleHidden(_, _)'
+ // @has - '//*[@id="variant.MultipleHidden"]//h3' 'MultipleHidden(/* private fields */)'
// @count - '//*[@id="variant.MultipleHidden.field.0"]' 0
// @count - '//*[@id="variant.MultipleHidden.field.1"]' 0
MultipleHidden(#[doc(hidden)] H, #[doc(hidden)] H),
diff --git a/tests/rustdoc/issue-16019.rs b/tests/rustdoc/macro-ice-16019.rs
index 239d92378..d0f82e0a3 100644
--- a/tests/rustdoc/issue-16019.rs
+++ b/tests/rustdoc/macro-ice-16019.rs
@@ -1,3 +1,5 @@
+// https://github.com/rust-lang/rust/issues/16019
+
macro_rules! define_struct {
($rounds:expr) => (
struct Struct {
diff --git a/tests/rustdoc/issue-17476.rs b/tests/rustdoc/method-link-foreign-trait-impl-17476.rs
index a5b484c98..e52ab6f38 100644
--- a/tests/rustdoc/issue-17476.rs
+++ b/tests/rustdoc/method-link-foreign-trait-impl-17476.rs
@@ -1,5 +1,8 @@
// aux-build:issue-17476.rs
// ignore-cross-compile
+// https://github.com/rust-lang/rust/issues/17476
+
+#![crate_name="issue_17476"]
extern crate issue_17476;
diff --git a/tests/rustdoc/no-crate-filter.rs b/tests/rustdoc/no-crate-filter.rs
deleted file mode 100644
index b2f899064..000000000
--- a/tests/rustdoc/no-crate-filter.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-#![crate_name = "foo"]
-
-// compile-flags: -Z unstable-options --disable-per-crate-search
-
-// @!has 'foo/struct.Foo.html' '//*[id="crate-search"]' ''
-pub struct Foo;
diff --git a/tests/rustdoc/issue-15318-3.rs b/tests/rustdoc/primitive-raw-pointer-dox-15318-3.rs
index 2dab8f948..80c559756 100644
--- a/tests/rustdoc/issue-15318-3.rs
+++ b/tests/rustdoc/primitive-raw-pointer-dox-15318-3.rs
@@ -1,3 +1,5 @@
+// https://github.com/rust-lang/rust/issues/15318
+#![crate_name="issue_15318_3"]
#![feature(rustc_attrs)]
// @has issue_15318_3/primitive.pointer.html
diff --git a/tests/rustdoc/issue-15318.rs b/tests/rustdoc/primitive-raw-pointer-link-15318.rs
index 0349fe285..77f25ff4c 100644
--- a/tests/rustdoc/issue-15318.rs
+++ b/tests/rustdoc/primitive-raw-pointer-link-15318.rs
@@ -1,6 +1,8 @@
// aux-build:issue-15318.rs
// ignore-cross-compile
+// https://github.com/rust-lang/rust/issues/15318
+#![crate_name="issue_15318"]
#![no_std]
extern crate issue_15318;
diff --git a/tests/rustdoc/issue-15318-2.rs b/tests/rustdoc/primitive-raw-pointer-link-no-inlined-15318-2.rs
index 614f2c1c0..1b35bb185 100644
--- a/tests/rustdoc/issue-15318-2.rs
+++ b/tests/rustdoc/primitive-raw-pointer-link-no-inlined-15318-2.rs
@@ -1,5 +1,8 @@
// aux-build:issue-15318.rs
// ignore-cross-compile
+// https://github.com/rust-lang/rust/issues/15318
+
+#![crate_name="issue_15318_2"]
#![no_std]
extern crate issue_15318;
diff --git a/tests/rustdoc/private-fields-tuple-struct.rs b/tests/rustdoc/private-fields-tuple-struct.rs
new file mode 100644
index 000000000..c6989dd8c
--- /dev/null
+++ b/tests/rustdoc/private-fields-tuple-struct.rs
@@ -0,0 +1,15 @@
+// This test checks the diplay of "/* private fields */" sentence in tuple structs.
+#![crate_name = "foo"]
+
+// @has 'foo/struct.A.html' '//*[@class="rust item-decl"]/code' 'pub struct A(pub u8, _);'
+pub struct A(pub u8, u8);
+// @has 'foo/struct.B.html' '//*[@class="rust item-decl"]/code' 'pub struct B(_, pub u8);'
+pub struct B(u8, pub u8);
+// @has 'foo/struct.C.html' '//*[@class="rust item-decl"]/code' 'pub struct C(_, pub u8, _);'
+pub struct C(u8, pub u8, u8);
+// @has 'foo/struct.D.html' '//*[@class="rust item-decl"]/code' 'pub struct D(pub u8, _, pub u8);'
+pub struct D(pub u8, u8, pub u8);
+// @has 'foo/struct.E.html' '//*[@class="rust item-decl"]/code' 'pub struct E(/* private fields */);'
+pub struct E(u8);
+// @has 'foo/struct.F.html' '//*[@class="rust item-decl"]/code' 'pub struct F(/* private fields */);'
+pub struct F(u8, u8);
diff --git a/tests/rustdoc/rfc-2632-const-trait-impl.rs b/tests/rustdoc/rfc-2632-const-trait-impl.rs
index 5d742dc39..7f56b2ffe 100644
--- a/tests/rustdoc/rfc-2632-const-trait-impl.rs
+++ b/tests/rustdoc/rfc-2632-const-trait-impl.rs
@@ -5,6 +5,8 @@
// To future blessers: make sure that `const_trait_impl` is
// stabilized when changing `@!has` to `@has`, and please do
// not remove this test.
+//
+// FIXME(effects) add `const_trait` to `Fn` so we use `~const`
#![feature(const_trait_impl)]
#![crate_name = "foo"]
@@ -22,9 +24,9 @@ pub trait Tr<T> {
// @has - '//section[@id="method.a"]/h4[@class="code-header"]/a[@class="trait"]' 'Fn'
// @!has - '//section[@id="method.a"]/h4[@class="code-header"]/span[@class="where"]' '~const'
// @has - '//section[@id="method.a"]/h4[@class="code-header"]/span[@class="where fmt-newline"]' ': Fn'
- fn a<A: ~const Fn() + ~const Destruct>()
+ fn a<A: /* ~const */ Fn() + ~const Destruct>()
where
- Option<A>: ~const Fn() + ~const Destruct,
+ Option<A>: /* ~const */ Fn() + ~const Destruct,
{
}
}
@@ -34,13 +36,13 @@ pub trait Tr<T> {
// @has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/a[@class="trait"]' 'Fn'
// @!has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/span[@class="where"]' '~const'
// @has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/span[@class="where fmt-newline"]' ': Fn'
-impl<T: ~const Fn() + ~const Destruct> const Tr<T> for T
+impl<T: /* ~const */ Fn() + ~const Destruct> const Tr<T> for T
where
- Option<T>: ~const Fn() + ~const Destruct,
+ Option<T>: /* ~const */ Fn() + ~const Destruct,
{
- fn a<A: ~const Fn() + ~const Destruct>()
+ fn a<A: /* ~const */ Fn() + ~const Destruct>()
where
- Option<A>: ~const Fn() + ~const Destruct,
+ Option<A>: /* ~const */ Fn() + ~const Destruct,
{
}
}
@@ -49,9 +51,9 @@ where
// @has - '//pre[@class="rust item-decl"]/code/a[@class="trait"]' 'Fn'
// @!has - '//pre[@class="rust item-decl"]/code/span[@class="where fmt-newline"]' '~const'
// @has - '//pre[@class="rust item-decl"]/code/span[@class="where fmt-newline"]' ': Fn'
-pub const fn foo<F: ~const Fn() + ~const Destruct>()
+pub const fn foo<F: /* ~const */ Fn() + ~const Destruct>()
where
- Option<F>: ~const Fn() + ~const Destruct,
+ Option<F>: /* ~const */ Fn() + ~const Destruct,
{
F::a()
}
@@ -61,9 +63,9 @@ impl<T> S<T> {
// @has - '//section[@id="method.foo"]/h4[@class="code-header"]/a[@class="trait"]' 'Fn'
// @!has - '//section[@id="method.foo"]/h4[@class="code-header"]/span[@class="where"]' '~const'
// @has - '//section[@id="method.foo"]/h4[@class="code-header"]/span[@class="where fmt-newline"]' ': Fn'
- pub const fn foo<B, C: ~const Fn() + ~const Destruct>()
+ pub const fn foo<B, C: /* ~const */ Fn() + ~const Destruct>()
where
- B: ~const Fn() + ~const Destruct,
+ B: /* ~const */ Fn() + ~const Destruct,
{
B::a()
}
diff --git a/tests/rustdoc/show-const-contents.rs b/tests/rustdoc/show-const-contents.rs
index 69e742ee7..91df03adb 100644
--- a/tests/rustdoc/show-const-contents.rs
+++ b/tests/rustdoc/show-const-contents.rs
@@ -47,7 +47,7 @@ pub struct MyTypeWithStr(&'static str);
// @!hasraw show_const_contents/constant.MY_TYPE_WITH_STR.html '; //'
pub const MY_TYPE_WITH_STR: MyTypeWithStr = MyTypeWithStr("show this");
-// @hasraw show_const_contents/constant.PI.html '= 3.14159265358979323846264338327950288f32;'
+// @hasraw show_const_contents/constant.PI.html '= 3.14159265358979323846264338327950288_f32;'
// @hasraw show_const_contents/constant.PI.html '; // 3.14159274f32'
pub use std::f32::consts::PI;
diff --git a/tests/rustdoc/sidebar-all-page.rs b/tests/rustdoc/sidebar-all-page.rs
index 45a6ba8ed..4c8a0f543 100644
--- a/tests/rustdoc/sidebar-all-page.rs
+++ b/tests/rustdoc/sidebar-all-page.rs
@@ -1,5 +1,4 @@
#![crate_name = "foo"]
-
#![feature(rustc_attrs)]
// @has 'foo/all.html'
@@ -9,7 +8,7 @@
// @has - '//*[@class="sidebar-elems"]//li' 'Functions'
// @has - '//*[@class="sidebar-elems"]//li' 'Traits'
// @has - '//*[@class="sidebar-elems"]//li' 'Macros'
-// @has - '//*[@class="sidebar-elems"]//li' 'Type Definitions'
+// @has - '//*[@class="sidebar-elems"]//li' 'Type Aliases'
// @has - '//*[@class="sidebar-elems"]//li' 'Constants'
// @has - '//*[@class="sidebar-elems"]//li' 'Statics'
// @has - '//*[@class="sidebar-elems"]//li' 'Primitive Types'
@@ -26,7 +25,7 @@ pub fn foo() {}
pub trait Trait {}
#[macro_export]
macro_rules! foo {
- () => {}
+ () => {};
}
pub type Type = u8;
pub const FOO: u8 = 0;
diff --git a/tests/rustdoc/titles.rs b/tests/rustdoc/titles.rs
index e1feb1cd6..f6a059de6 100644
--- a/tests/rustdoc/titles.rs
+++ b/tests/rustdoc/titles.rs
@@ -30,7 +30,7 @@ pub struct FooStruct;
// @matches 'foo/enum.FooEnum.html' '//h2[@class="location"]' 'FooEnum'
pub enum FooEnum {}
-// @matches 'foo/type.FooType.html' '//h1' 'Type Definition foo::FooType'
+// @matches 'foo/type.FooType.html' '//h1' 'Type Alias foo::FooType'
// @matches 'foo/type.FooType.html' '//h2[@class="location"]' 'FooType'
pub type FooType = FooStruct;
diff --git a/tests/rustdoc/typedef-inner-variants-lazy_type_alias.rs b/tests/rustdoc/typedef-inner-variants-lazy_type_alias.rs
new file mode 100644
index 000000000..ff84352d7
--- /dev/null
+++ b/tests/rustdoc/typedef-inner-variants-lazy_type_alias.rs
@@ -0,0 +1,34 @@
+#![crate_name = "inner_types_lazy"]
+
+#![feature(lazy_type_alias)]
+#![allow(incomplete_features)]
+
+// @has 'inner_types_lazy/struct.Pair.html'
+pub struct Pair<A, B> {
+ pub first: A,
+ pub second: B,
+}
+
+// @has 'inner_types_lazy/type.ReversedTypesPair.html'
+// @count - '//*[@id="aliased-type"]' 1
+// @count - '//*[@id="variants"]' 0
+// @count - '//*[@id="fields"]' 1
+// @count - '//span[@class="where fmt-newline"]' 0
+pub type ReversedTypesPair<Q, R> = Pair<R, Q>;
+
+// @has 'inner_types_lazy/type.ReadWrite.html'
+// @count - '//*[@id="aliased-type"]' 1
+// @count - '//*[@id="variants"]' 0
+// @count - '//*[@id="fields"]' 1
+// @count - '//span[@class="where fmt-newline"]' 2
+pub type ReadWrite<R, W> = Pair<R, W>
+where
+ R: std::io::Read,
+ W: std::io::Write;
+
+// @has 'inner_types_lazy/type.VecPair.html'
+// @count - '//*[@id="aliased-type"]' 1
+// @count - '//*[@id="variants"]' 0
+// @count - '//*[@id="fields"]' 1
+// @count - '//span[@class="where fmt-newline"]' 0
+pub type VecPair<U, V> = Pair<Vec<U>, Vec<V>>;
diff --git a/tests/rustdoc/typedef-inner-variants.rs b/tests/rustdoc/typedef-inner-variants.rs
new file mode 100644
index 000000000..b734714fd
--- /dev/null
+++ b/tests/rustdoc/typedef-inner-variants.rs
@@ -0,0 +1,119 @@
+// This test checks different combinations of structs, enums, and unions
+// for the "Show Aliased Type" feature on type definition.
+
+#![crate_name = "inner_variants"]
+
+// aux-build:cross_crate_generic_typedef.rs
+extern crate cross_crate_generic_typedef;
+
+pub struct Adt;
+pub struct Ty;
+pub struct TyCtxt;
+
+pub trait Interner {
+ type Adt;
+ type Ty;
+}
+
+impl Interner for TyCtxt {
+ type Adt = Adt;
+ type Ty = Ty;
+}
+
+// @has 'inner_variants/type.AliasTy.html'
+// @count - '//*[@id="variants"]' 0
+// @count - '//*[@id="fields"]' 0
+pub type AliasTy = Ty;
+
+// @has 'inner_variants/enum.IrTyKind.html'
+pub enum IrTyKind<A, I: Interner> {
+ /// Doc comment for AdtKind
+ AdtKind(I::Adt),
+ /// and another one for TyKind
+ TyKind(I::Adt, <I as Interner>::Ty),
+ // no comment
+ StructKind { a: A, },
+ #[doc(hidden)]
+ Unspecified,
+}
+
+// @has 'inner_variants/type.NearlyTyKind.html'
+// @count - '//*[@id="aliased-type"]' 1
+// @count - '//*[@id="variants"]' 1
+// @count - '//*[@id="fields"]' 0
+pub type NearlyTyKind<A> = IrTyKind<A, TyCtxt>;
+
+// @has 'inner_variants/type.TyKind.html'
+// @count - '//*[@id="aliased-type"]' 1
+// @count - '//*[@id="variants"]' 1
+// @count - '//*[@id="fields"]' 0
+// @count - '//*[@class="variant"]' 3
+// @matches - '//pre[@class="rust item-decl"]//code' "enum TyKind"
+// @has - '//pre[@class="rust item-decl"]//code/a[1]' "Adt"
+// @has - '//pre[@class="rust item-decl"]//code/a[2]' "Adt"
+// @has - '//pre[@class="rust item-decl"]//code/a[3]' "Ty"
+// @has - '//pre[@class="rust item-decl"]//code/a[4]' "i64"
+pub type TyKind = IrTyKind<i64, TyCtxt>;
+
+// @has 'inner_variants/union.OneOr.html'
+pub union OneOr<A: Copy> {
+ pub one: i64,
+ pub or: A,
+}
+
+// @has 'inner_variants/type.OneOrF64.html'
+// @count - '//*[@id="aliased-type"]' 1
+// @count - '//*[@id="variants"]' 0
+// @count - '//*[@id="fields"]' 1
+// @count - '//*[@class="structfield small-section-header"]' 2
+// @matches - '//pre[@class="rust item-decl"]//code' "union OneOrF64"
+pub type OneOrF64 = OneOr<f64>;
+
+// @has 'inner_variants/struct.One.html'
+pub struct One<T> {
+ pub val: T,
+ #[doc(hidden)]
+ pub __hidden: T,
+ __private: T,
+}
+
+// @has 'inner_variants/type.OneU64.html'
+// @count - '//*[@id="aliased-type"]' 1
+// @count - '//*[@id="variants"]' 0
+// @count - '//*[@id="fields"]' 1
+// @count - '//*[@class="structfield small-section-header"]' 1
+// @matches - '//pre[@class="rust item-decl"]//code' "struct OneU64"
+// @matches - '//pre[@class="rust item-decl"]//code' "pub val"
+pub type OneU64 = One<u64>;
+
+// @has 'inner_variants/struct.OnceA.html'
+pub struct OnceA<'a, A> {
+ pub a: &'a A,
+}
+
+// @has 'inner_variants/type.Once.html'
+// @count - '//*[@id="aliased-type"]' 1
+// @count - '//*[@id="variants"]' 0
+// @count - '//*[@id="fields"]' 1
+// @matches - '//pre[@class="rust item-decl"]//code' "struct Once<'a>"
+// @matches - '//pre[@class="rust item-decl"]//code' "&'a"
+pub type Once<'a> = OnceA<'a, i64>;
+
+// @has 'inner_variants/struct.HighlyGenericStruct.html'
+pub struct HighlyGenericStruct<A, B, C, D> {
+ pub z: (A, B, C, D)
+}
+
+// @has 'inner_variants/type.HighlyGenericAABB.html'
+// @count - '//*[@id="aliased-type"]' 1
+// @count - '//*[@id="variants"]' 0
+// @count - '//*[@id="fields"]' 1
+// @matches - '//pre[@class="rust item-decl"]//code' "struct HighlyGenericAABB<A, B>"
+// @matches - '//pre[@class="rust item-decl"]//code' "pub z"
+pub type HighlyGenericAABB<A, B> = HighlyGenericStruct<A, A, B, B>;
+
+// @has 'inner_variants/type.InlineU64.html'
+// @count - '//*[@id="aliased-type"]' 1
+// @count - '//*[@id="variants"]' 0
+// @count - '//*[@id="fields"]' 1
+pub use cross_crate_generic_typedef::InlineU64;
diff --git a/tests/rustdoc/where.SWhere_Simd_item-decl.html b/tests/rustdoc/where.SWhere_Simd_item-decl.html
index 3e72ba2b7..46708b9e4 100644
--- a/tests/rustdoc/where.SWhere_Simd_item-decl.html
+++ b/tests/rustdoc/where.SWhere_Simd_item-decl.html
@@ -1,3 +1,3 @@
-<pre class="rust item-decl"><code>pub struct Simd&lt;T&gt;(_)
+<pre class="rust item-decl"><code>pub struct Simd&lt;T&gt;(/* private fields */)
<span class="where">where
T: <a class="trait" href="trait.MyTrait.html" title="trait foo::MyTrait">MyTrait</a></span>;</code></pre>
diff --git a/tests/rustdoc/where.alpha_trait_decl.html b/tests/rustdoc/where.alpha_trait_decl.html
index a7700055c..0c0b2d1ce 100644
--- a/tests/rustdoc/where.alpha_trait_decl.html
+++ b/tests/rustdoc/where.alpha_trait_decl.html
@@ -1,3 +1,3 @@
-<code>pub struct Alpha&lt;A&gt;(_)
+<code>pub struct Alpha&lt;A&gt;(/* private fields */)
<span class="where">where
A: <a class="trait" href="trait.MyTrait.html" title="trait foo::MyTrait">MyTrait</a></span>;</code> \ No newline at end of file
diff --git a/tests/rustdoc/where.rs b/tests/rustdoc/where.rs
index 2aa9c8b54..aea02c140 100644
--- a/tests/rustdoc/where.rs
+++ b/tests/rustdoc/where.rs
@@ -4,7 +4,7 @@ use std::io::Lines;
pub trait MyTrait { fn dummy(&self) { } }
-// @has foo/struct.Alpha.html '//pre' "pub struct Alpha<A>(_) where A: MyTrait"
+// @has foo/struct.Alpha.html '//pre' "pub struct Alpha<A>(/* private fields */) where A: MyTrait"
// @snapshot alpha_trait_decl - '//*[@class="rust item-decl"]/code'
pub struct Alpha<A>(A) where A: MyTrait;
// @has foo/trait.Bravo.html '//pre' "pub trait Bravo<B>where B: MyTrait"
diff --git a/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs b/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs
index f6f0c0385..fa6734b6c 100644
--- a/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs
+++ b/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs
@@ -6,7 +6,7 @@
extern crate rustc_middle;
extern crate rustc_session;
-use rustc_session::lint::{LintArray, LintPass};
+use rustc_session::lint::{LintPass, LintVec};
use rustc_session::{declare_lint, declare_lint_pass, impl_lint_pass};
declare_lint! {
diff --git a/tests/ui-fulldeps/internal-lints/ty_tykind_usage.rs b/tests/ui-fulldeps/internal-lints/ty_tykind_usage.rs
index bf655510a..3f7429a5f 100644
--- a/tests/ui-fulldeps/internal-lints/ty_tykind_usage.rs
+++ b/tests/ui-fulldeps/internal-lints/ty_tykind_usage.rs
@@ -31,7 +31,6 @@ fn main() {
TyKind::Closure(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
TyKind::Generator(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
TyKind::GeneratorWitness(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
- TyKind::GeneratorWitnessMIR(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
TyKind::Never => (), //~ ERROR usage of `ty::TyKind::<kind>`
TyKind::Tuple(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
TyKind::Alias(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
diff --git a/tests/ui-fulldeps/internal-lints/ty_tykind_usage.stderr b/tests/ui-fulldeps/internal-lints/ty_tykind_usage.stderr
index 9f8c0bea0..1f49d6b64 100644
--- a/tests/ui-fulldeps/internal-lints/ty_tykind_usage.stderr
+++ b/tests/ui-fulldeps/internal-lints/ty_tykind_usage.stderr
@@ -121,65 +121,59 @@ LL | TyKind::GeneratorWitness(..) => (),
error: usage of `ty::TyKind::<kind>`
--> $DIR/ty_tykind_usage.rs:34:9
|
-LL | TyKind::GeneratorWitnessMIR(..) => (),
- | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
-
-error: usage of `ty::TyKind::<kind>`
- --> $DIR/ty_tykind_usage.rs:35:9
- |
LL | TyKind::Never => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>`
- --> $DIR/ty_tykind_usage.rs:36:9
+ --> $DIR/ty_tykind_usage.rs:35:9
|
LL | TyKind::Tuple(..) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>`
- --> $DIR/ty_tykind_usage.rs:37:9
+ --> $DIR/ty_tykind_usage.rs:36:9
|
LL | TyKind::Alias(..) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>`
- --> $DIR/ty_tykind_usage.rs:38:9
+ --> $DIR/ty_tykind_usage.rs:37:9
|
LL | TyKind::Param(..) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>`
- --> $DIR/ty_tykind_usage.rs:39:9
+ --> $DIR/ty_tykind_usage.rs:38:9
|
LL | TyKind::Bound(..) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>`
- --> $DIR/ty_tykind_usage.rs:40:9
+ --> $DIR/ty_tykind_usage.rs:39:9
|
LL | TyKind::Placeholder(..) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>`
- --> $DIR/ty_tykind_usage.rs:41:9
+ --> $DIR/ty_tykind_usage.rs:40:9
|
LL | TyKind::Infer(..) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>`
- --> $DIR/ty_tykind_usage.rs:42:9
+ --> $DIR/ty_tykind_usage.rs:41:9
|
LL | TyKind::Error(_) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>`
- --> $DIR/ty_tykind_usage.rs:47:12
+ --> $DIR/ty_tykind_usage.rs:46:12
|
LL | if let TyKind::Int(int_ty) = kind {}
| ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind`
- --> $DIR/ty_tykind_usage.rs:49:24
+ --> $DIR/ty_tykind_usage.rs:48:24
|
LL | fn ty_kind(ty_bad: TyKind<'_>, ty_good: Ty<'_>) {}
| ^^^^^^^^^^
@@ -187,7 +181,7 @@ LL | fn ty_kind(ty_bad: TyKind<'_>, ty_good: Ty<'_>) {}
= help: try using `Ty` instead
error: usage of `ty::TyKind`
- --> $DIR/ty_tykind_usage.rs:51:37
+ --> $DIR/ty_tykind_usage.rs:50:37
|
LL | fn ir_ty_kind<I: Interner>(bad: IrTyKind<I>) -> IrTyKind<I> {
| ^^^^^^^^^^^
@@ -195,7 +189,7 @@ LL | fn ir_ty_kind<I: Interner>(bad: IrTyKind<I>) -> IrTyKind<I> {
= help: try using `Ty` instead
error: usage of `ty::TyKind`
- --> $DIR/ty_tykind_usage.rs:51:53
+ --> $DIR/ty_tykind_usage.rs:50:53
|
LL | fn ir_ty_kind<I: Interner>(bad: IrTyKind<I>) -> IrTyKind<I> {
| ^^^^^^^^^^^
@@ -203,12 +197,12 @@ LL | fn ir_ty_kind<I: Interner>(bad: IrTyKind<I>) -> IrTyKind<I> {
= help: try using `Ty` instead
error: usage of `ty::TyKind::<kind>`
- --> $DIR/ty_tykind_usage.rs:54:9
+ --> $DIR/ty_tykind_usage.rs:53:9
|
LL | IrTyKind::Bool
| --------^^^^^^
| |
| help: try using `ty::<kind>` directly: `ty`
-error: aborting due to 33 previous errors
+error: aborting due to 32 previous errors
diff --git a/tests/ui-fulldeps/lint-pass-macros.rs b/tests/ui-fulldeps/lint-pass-macros.rs
index b3c2a5427..4c6178341 100644
--- a/tests/ui-fulldeps/lint-pass-macros.rs
+++ b/tests/ui-fulldeps/lint-pass-macros.rs
@@ -5,7 +5,7 @@
extern crate rustc_session;
-use rustc_session::lint::{LintArray, LintPass};
+use rustc_session::lint::{LintPass, LintVec};
use rustc_session::{declare_lint, declare_lint_pass, impl_lint_pass};
declare_lint! {
diff --git a/tests/ui-fulldeps/plugin/auxiliary/lint-group-plugin-test.rs b/tests/ui-fulldeps/plugin/auxiliary/lint-group-plugin-test.rs
index 4a41e7fbb..150f0c6b9 100644
--- a/tests/ui-fulldeps/plugin/auxiliary/lint-group-plugin-test.rs
+++ b/tests/ui-fulldeps/plugin/auxiliary/lint-group-plugin-test.rs
@@ -5,13 +5,12 @@
// Load rustc as a plugin to get macros.
extern crate rustc_driver;
extern crate rustc_hir;
-#[macro_use]
extern crate rustc_lint;
#[macro_use]
extern crate rustc_session;
use rustc_driver::plugin::Registry;
-use rustc_lint::{LateContext, LateLintPass, LintArray, LintContext, LintId, LintPass};
+use rustc_lint::{LateContext, LateLintPass, LintContext, LintId};
declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");
diff --git a/tests/ui-fulldeps/plugin/auxiliary/lint-plugin-test.rs b/tests/ui-fulldeps/plugin/auxiliary/lint-plugin-test.rs
index 30956deb7..acc5fe760 100644
--- a/tests/ui-fulldeps/plugin/auxiliary/lint-plugin-test.rs
+++ b/tests/ui-fulldeps/plugin/auxiliary/lint-plugin-test.rs
@@ -6,14 +6,14 @@ extern crate rustc_ast;
// Load rustc as a plugin to get macros
extern crate rustc_driver;
-#[macro_use]
extern crate rustc_lint;
#[macro_use]
extern crate rustc_session;
+use rustc_ast::ast;
use rustc_driver::plugin::Registry;
-use rustc_lint::{EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass};
-use rustc_ast as ast;
+use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
+
declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");
declare_lint_pass!(Pass => [TEST_LINT]);
diff --git a/tests/ui-fulldeps/plugin/auxiliary/lint-tool-test.rs b/tests/ui-fulldeps/plugin/auxiliary/lint-tool-test.rs
index c2c024865..21de4aa70 100644
--- a/tests/ui-fulldeps/plugin/auxiliary/lint-tool-test.rs
+++ b/tests/ui-fulldeps/plugin/auxiliary/lint-tool-test.rs
@@ -4,14 +4,14 @@ extern crate rustc_ast;
// Load rustc as a plugin to get macros
extern crate rustc_driver;
-#[macro_use]
extern crate rustc_lint;
#[macro_use]
extern crate rustc_session;
-use rustc_driver::plugin::Registry;
-use rustc_lint::{EarlyContext, EarlyLintPass, LintArray, LintContext, LintId, LintPass};
use rustc_ast as ast;
+use rustc_driver::plugin::Registry;
+use rustc_lint::{EarlyContext, EarlyLintPass, LintContext, LintId};
+
declare_tool_lint!(pub clippy::TEST_LINT, Warn, "Warn about stuff");
declare_tool_lint!(
/// Some docs
diff --git a/tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.stderr b/tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.stderr
index 20486d596..6e17bbde0 100644
--- a/tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.stderr
+++ b/tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.stderr
@@ -13,6 +13,7 @@ LL | fn lintme() { }
| ^^^^^^^^^^^^^^^
|
= note: `-D test-lint` implied by `-D lint-me`
+ = help: to override `-D lint-me` add `#[allow(test_lint)]`
error: item is named 'pleaselintme'
--> $DIR/lint-group-plugin-deny-cmdline.rs:12:1
@@ -21,6 +22,7 @@ LL | fn pleaselintme() { }
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D please-lint` implied by `-D lint-me`
+ = help: to override `-D lint-me` add `#[allow(please_lint)]`
error: aborting due to 2 previous errors; 1 warning emitted
diff --git a/tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.stderr b/tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.stderr
index b060e3a3e..0e6617959 100644
--- a/tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.stderr
+++ b/tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.stderr
@@ -1,9 +1,12 @@
-warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint
+warning: lint name `test_lint` is deprecated and may not have an effect in the future.
|
+ = help: change it to clippy::test_lint
= note: requested on the command line with `-A test_lint`
+ = note: `#[warn(renamed_and_removed_lints)]` on by default
-warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint
+warning: lint name `test_lint` is deprecated and may not have an effect in the future.
|
+ = help: change it to clippy::test_lint
= note: requested on the command line with `-A test_lint`
warning: item is named 'lintme'
@@ -22,8 +25,9 @@ LL | #![plugin(lint_tool_test)]
|
= note: `#[warn(deprecated)]` on by default
-warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint
+warning: lint name `test_lint` is deprecated and may not have an effect in the future.
|
+ = help: change it to clippy::test_lint
= note: requested on the command line with `-A test_lint`
warning: 5 warnings emitted
diff --git a/tests/ui-fulldeps/pprust-expr-roundtrip.rs b/tests/ui-fulldeps/pprust-expr-roundtrip.rs
index ae375dfab..541be7ebb 100644
--- a/tests/ui-fulldeps/pprust-expr-roundtrip.rs
+++ b/tests/ui-fulldeps/pprust-expr-roundtrip.rs
@@ -80,14 +80,20 @@ fn iter_exprs(depth: usize, f: &mut dyn FnMut(P<Expr>)) {
let seg = PathSegment::from_ident(Ident::from_str("x"));
iter_exprs(depth - 1, &mut |e| {
g(ExprKind::MethodCall(Box::new(MethodCall {
- seg: seg.clone(), receiver: e, args: thin_vec![make_x()], span: DUMMY_SP
- }))
- )});
+ seg: seg.clone(),
+ receiver: e,
+ args: thin_vec![make_x()],
+ span: DUMMY_SP,
+ })))
+ });
iter_exprs(depth - 1, &mut |e| {
g(ExprKind::MethodCall(Box::new(MethodCall {
- seg: seg.clone(), receiver: make_x(), args: thin_vec![e], span: DUMMY_SP
- }))
- )});
+ seg: seg.clone(),
+ receiver: make_x(),
+ args: thin_vec![e],
+ span: DUMMY_SP,
+ })))
+ });
}
2..=7 => {
let op = Spanned {
@@ -174,7 +180,7 @@ fn iter_exprs(depth: usize, f: &mut dyn FnMut(P<Expr>)) {
18 => {
let pat =
P(Pat { id: DUMMY_NODE_ID, kind: PatKind::Wild, span: DUMMY_SP, tokens: None });
- iter_exprs(depth - 1, &mut |e| g(ExprKind::Let(pat.clone(), e, DUMMY_SP)))
+ iter_exprs(depth - 1, &mut |e| g(ExprKind::Let(pat.clone(), e, DUMMY_SP, None)))
}
_ => panic!("bad counter value in iter_exprs"),
}
diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs
index 642b58b07..283d87d3e 100644
--- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs
+++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs
@@ -1,7 +1,7 @@
// check-fail
// Tests that a doc comment will not preclude a field from being considered a diagnostic argument
// normalize-stderr-test "the following other types implement trait `IntoDiagnosticArg`:(?:.*\n){0,9}\s+and \d+ others" -> "normalized in stderr"
-// normalize-stderr-test "diagnostic_builder\.rs:[0-9]+:[0-9]+" -> "diagnostic_builder.rs:LL:CC"
+// normalize-stderr-test "(COMPILER_DIR/.*\.rs):[0-9]+:[0-9]+" -> "$1:LL:CC"
// The proc_macro2 crate handles spans differently when on beta/stable release rather than nightly,
// changing the output of this test. Since Subdiagnostic is strictly internal to the compiler
diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr
index 8c876213a..70d7b3225 100644
--- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr
+++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr
@@ -23,7 +23,7 @@ LL | arg: NotIntoDiagnosticArg,
|
= help: normalized in stderr
note: required by a bound in `Diagnostic::set_arg`
- --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:960:5
+ --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC
error: aborting due to 2 previous errors
diff --git a/tests/ui-fulldeps/stable-mir/compilation-result.rs b/tests/ui-fulldeps/stable-mir/compilation-result.rs
new file mode 100644
index 000000000..3ec1519fb
--- /dev/null
+++ b/tests/ui-fulldeps/stable-mir/compilation-result.rs
@@ -0,0 +1,78 @@
+// run-pass
+// Test StableMIR behavior when different results are given
+
+// ignore-stage1
+// ignore-cross-compile
+// ignore-remote
+// edition: 2021
+
+#![feature(rustc_private)]
+#![feature(assert_matches)]
+
+extern crate rustc_middle;
+extern crate rustc_smir;
+extern crate stable_mir;
+
+use rustc_middle::ty::TyCtxt;
+use rustc_smir::rustc_internal;
+use std::io::Write;
+use std::ops::ControlFlow;
+
+/// This test will generate and analyze a dummy crate using the stable mir.
+/// For that, it will first write the dummy crate into a file.
+/// Then it will create a `StableMir` using custom arguments and then
+/// it will run the compiler.
+fn main() {
+ let path = "input_compilation_result_test.rs";
+ generate_input(&path).unwrap();
+ let args = vec!["rustc".to_string(), path.to_string()];
+ test_continue(args.clone());
+ test_break(args.clone());
+ test_failed(args.clone());
+ test_skipped(args);
+}
+
+fn test_continue(args: Vec<String>) {
+ let continue_fn = |_: TyCtxt| ControlFlow::Continue::<(), bool>(true);
+ let result = rustc_internal::StableMir::new(args, continue_fn).run();
+ assert_eq!(result, Ok(true));
+}
+
+fn test_break(args: Vec<String>) {
+ let continue_fn = |_: TyCtxt| ControlFlow::Break::<bool, i32>(false);
+ let result = rustc_internal::StableMir::new(args, continue_fn).run();
+ assert_eq!(result, Err(stable_mir::CompilerError::Interrupted(false)));
+}
+
+fn test_skipped(mut args: Vec<String>) {
+ args.push("--version".to_string());
+ let unreach_fn = |_: TyCtxt| -> ControlFlow<()> { unreachable!() };
+ let result = rustc_internal::StableMir::new(args, unreach_fn).run();
+ assert_eq!(result, Err(stable_mir::CompilerError::Skipped));
+}
+
+fn test_failed(mut args: Vec<String>) {
+ args.push("--cfg=broken".to_string());
+ let unreach_fn = |_: TyCtxt| -> ControlFlow<()> { unreachable!() };
+ let result = rustc_internal::StableMir::new(args, unreach_fn).run();
+ assert_eq!(result, Err(stable_mir::CompilerError::CompilationFailed));
+}
+
+fn generate_input(path: &str) -> std::io::Result<()> {
+ let mut file = std::fs::File::create(path)?;
+ write!(
+ file,
+ r#"
+ // This should trigger a compilation failure when enabled.
+ #[cfg(broken)]
+ mod broken_mod {{
+ fn call_invalid() {{
+ invalid_fn();
+ }}
+ }}
+
+ fn main() {{}}
+ "#
+ )?;
+ Ok(())
+}
diff --git a/tests/ui-fulldeps/stable-mir/crate-info.rs b/tests/ui-fulldeps/stable-mir/crate-info.rs
index f55d7d599..ce4ee3c24 100644
--- a/tests/ui-fulldeps/stable-mir/crate-info.rs
+++ b/tests/ui-fulldeps/stable-mir/crate-info.rs
@@ -8,27 +8,26 @@
#![feature(rustc_private)]
#![feature(assert_matches)]
+#![feature(control_flow_enum)]
-extern crate rustc_driver;
extern crate rustc_hir;
-extern crate rustc_interface;
extern crate rustc_middle;
-extern crate rustc_session;
extern crate rustc_smir;
+extern crate stable_mir;
-use rustc_driver::{Callbacks, Compilation, RunCompiler};
use rustc_hir::def::DefKind;
-use rustc_interface::{interface, Queries};
use rustc_middle::ty::TyCtxt;
-use rustc_session::EarlyErrorHandler;
-use rustc_smir::{rustc_internal, stable_mir};
+use rustc_smir::rustc_internal;
+
+use stable_mir::fold::Foldable;
use std::assert_matches::assert_matches;
use std::io::Write;
+use std::ops::ControlFlow;
const CRATE_NAME: &str = "input";
/// This function uses the Stable MIR APIs to get information about the test crate.
-fn test_stable_mir(tcx: TyCtxt<'_>) {
+fn test_stable_mir(_tcx: TyCtxt<'_>) -> ControlFlow<()> {
// Get the local crate using stable_mir API.
let local = stable_mir::local_crate();
assert_eq!(&local.name, CRATE_NAME);
@@ -37,12 +36,12 @@ fn test_stable_mir(tcx: TyCtxt<'_>) {
// Find items in the local crate.
let items = stable_mir::all_local_items();
- assert!(get_item(tcx, &items, (DefKind::Fn, "foo::bar")).is_some());
+ assert!(get_item(&items, (DefKind::Fn, "foo::bar")).is_some());
// Find the `std` crate.
assert!(stable_mir::find_crate("std").is_some());
- let bar = get_item(tcx, &items, (DefKind::Fn, "bar")).unwrap();
+ let bar = get_item(&items, (DefKind::Fn, "bar")).unwrap();
let body = bar.body();
assert_eq!(body.locals.len(), 2);
assert_eq!(body.blocks.len(), 1);
@@ -57,7 +56,7 @@ fn test_stable_mir(tcx: TyCtxt<'_>) {
other => panic!("{other:?}"),
}
- let foo_bar = get_item(tcx, &items, (DefKind::Fn, "foo_bar")).unwrap();
+ let foo_bar = get_item(&items, (DefKind::Fn, "foo_bar")).unwrap();
let body = foo_bar.body();
assert_eq!(body.locals.len(), 7);
assert_eq!(body.blocks.len(), 4);
@@ -67,7 +66,7 @@ fn test_stable_mir(tcx: TyCtxt<'_>) {
other => panic!("{other:?}"),
}
- let types = get_item(tcx, &items, (DefKind::Fn, "types")).unwrap();
+ let types = get_item(&items, (DefKind::Fn, "types")).unwrap();
let body = types.body();
assert_eq!(body.locals.len(), 6);
assert_matches!(
@@ -97,7 +96,7 @@ fn test_stable_mir(tcx: TyCtxt<'_>) {
))
);
- let drop = get_item(tcx, &items, (DefKind::Fn, "drop")).unwrap();
+ let drop = get_item(&items, (DefKind::Fn, "drop")).unwrap();
let body = drop.body();
assert_eq!(body.blocks.len(), 2);
let block = &body.blocks[0];
@@ -106,7 +105,7 @@ fn test_stable_mir(tcx: TyCtxt<'_>) {
other => panic!("{other:?}"),
}
- let assert = get_item(tcx, &items, (DefKind::Fn, "assert")).unwrap();
+ let assert = get_item(&items, (DefKind::Fn, "assert")).unwrap();
let body = assert.body();
assert_eq!(body.blocks.len(), 2);
let block = &body.blocks[0];
@@ -114,24 +113,68 @@ fn test_stable_mir(tcx: TyCtxt<'_>) {
stable_mir::mir::Terminator::Assert { .. } => {}
other => panic!("{other:?}"),
}
+
+ let monomorphic = get_item(&items, (DefKind::Fn, "monomorphic")).unwrap();
+ for block in monomorphic.body().blocks {
+ match &block.terminator {
+ stable_mir::mir::Terminator::Call { func, .. } => match func {
+ stable_mir::mir::Operand::Constant(c) => match &c.literal.literal {
+ stable_mir::ty::ConstantKind::Allocated(alloc) => {
+ assert!(alloc.bytes.is_empty());
+ match c.literal.ty.kind() {
+ stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::FnDef(
+ def,
+ mut args,
+ )) => {
+ let func = def.body();
+ match func.locals[1]
+ .fold(&mut args)
+ .continue_value()
+ .unwrap()
+ .kind()
+ {
+ stable_mir::ty::TyKind::RigidTy(
+ stable_mir::ty::RigidTy::Uint(_),
+ ) => {}
+ stable_mir::ty::TyKind::RigidTy(
+ stable_mir::ty::RigidTy::Tuple(_),
+ ) => {}
+ other => panic!("{other:?}"),
+ }
+ }
+ other => panic!("{other:?}"),
+ }
+ }
+ other => panic!("{other:?}"),
+ },
+ other => panic!("{other:?}"),
+ },
+ stable_mir::mir::Terminator::Return => {}
+ other => panic!("{other:?}"),
+ }
+ }
+
+ let foo_const = get_item(&items, (DefKind::Const, "FOO")).unwrap();
+ // Ensure we don't panic trying to get the body of a constant.
+ foo_const.body();
+
+ ControlFlow::Continue(())
}
// Use internal API to find a function in a crate.
fn get_item<'a>(
- tcx: TyCtxt,
items: &'a stable_mir::CrateItems,
item: (DefKind, &str),
) -> Option<&'a stable_mir::CrateItem> {
items.iter().find(|crate_item| {
- let def_id = rustc_internal::item_def_id(crate_item);
- tcx.def_kind(def_id) == item.0 && tcx.def_path_str(def_id) == item.1
+ crate_item.kind().to_string() == format!("{:?}", item.0) && crate_item.name() == item.1
})
}
/// This test will generate and analyze a dummy crate using the stable mir.
/// For that, it will first write the dummy crate into a file.
-/// It will invoke the compiler using a custom Callback implementation, which will
-/// invoke Stable MIR APIs after the compiler has finished its analysis.
+/// Then it will create a `StableMir` using custom arguments and then
+/// it will run the compiler.
fn main() {
let path = "input.rs";
generate_input(&path).unwrap();
@@ -142,29 +185,7 @@ fn main() {
CRATE_NAME.to_string(),
path.to_string(),
];
- rustc_driver::catch_fatal_errors(|| {
- RunCompiler::new(&args, &mut SMirCalls {}).run().unwrap();
- })
- .unwrap();
-}
-
-struct SMirCalls {}
-
-impl Callbacks for SMirCalls {
- /// Called after analysis. Return value instructs the compiler whether to
- /// continue the compilation afterwards (defaults to `Compilation::Continue`)
- fn after_analysis<'tcx>(
- &mut self,
- _handler: &EarlyErrorHandler,
- _compiler: &interface::Compiler,
- queries: &'tcx Queries<'tcx>,
- ) -> Compilation {
- queries.global_ctxt().unwrap().enter(|tcx| {
- rustc_smir::rustc_internal::run(tcx, || test_stable_mir(tcx));
- });
- // No need to keep going.
- Compilation::Stop
- }
+ rustc_internal::StableMir::new(args, test_stable_mir).run().unwrap();
}
fn generate_input(path: &str) -> std::io::Result<()> {
@@ -172,6 +193,18 @@ fn generate_input(path: &str) -> std::io::Result<()> {
write!(
file,
r#"
+ pub const FOO: u32 = 1 + 2;
+
+ fn generic<T, const U: usize>(t: T) -> [(); U] {{
+ _ = t;
+ [(); U]
+ }}
+
+ pub fn monomorphic() {{
+ generic::<(), 5>(());
+ generic::<u32, 0>(45);
+ }}
+
mod foo {{
pub fn bar(i: i32) -> i64 {{
i as i64
diff --git a/tests/ui/abi/compatibility.rs b/tests/ui/abi/compatibility.rs
new file mode 100644
index 000000000..1f049b178
--- /dev/null
+++ b/tests/ui/abi/compatibility.rs
@@ -0,0 +1,354 @@
+// check-pass
+// revisions: host
+// revisions: arm
+//[arm] compile-flags: --target arm-unknown-linux-gnueabi
+//[arm] needs-llvm-components: arm
+// revisions: aarch64
+//[aarch64] compile-flags: --target aarch64-unknown-linux-gnu
+//[aarch64] needs-llvm-components: aarch64
+// revisions: s390x
+//[s390x] compile-flags: --target s390x-unknown-linux-gnu
+//[s390x] needs-llvm-components: systemz
+// revisions: mips
+//[mips] compile-flags: --target mips-unknown-linux-gnu
+//[mips] needs-llvm-components: mips
+// revisions: mips64
+//[mips64] compile-flags: --target mips64-unknown-linux-gnuabi64
+//[mips64] needs-llvm-components: mips
+// revisions: sparc
+//[sparc] compile-flags: --target sparc-unknown-linux-gnu
+//[sparc] needs-llvm-components: sparc
+// revisions: sparc64
+//[sparc64] compile-flags: --target sparc64-unknown-linux-gnu
+//[sparc64] needs-llvm-components: sparc
+// revisions: powerpc64
+//[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu
+//[powerpc64] needs-llvm-components: powerpc
+// revisions: riscv
+//[riscv] compile-flags: --target riscv64gc-unknown-linux-gnu
+//[riscv] needs-llvm-components: riscv
+// revisions: loongarch64
+//[loongarch64] compile-flags: --target loongarch64-unknown-linux-gnu
+//[loongarch64] needs-llvm-components: loongarch
+// revisions: wasm
+//[wasm] compile-flags: --target wasm32-unknown-unknown
+//[wasm] needs-llvm-components: webassembly
+// revisions: wasi
+//[wasi] compile-flags: --target wasm32-wasi
+//[wasi] needs-llvm-components: webassembly
+// revisions: nvptx64
+//[nvptx64] compile-flags: --target nvptx64-nvidia-cuda
+//[nvptx64] needs-llvm-components: nvptx
+#![feature(rustc_attrs, unsized_fn_params, transparent_unions)]
+#![cfg_attr(not(host), feature(no_core, lang_items), no_std, no_core)]
+#![allow(unused, improper_ctypes_definitions, internal_features)]
+
+// FIXME: some targets are broken in various ways.
+// Hence there are `cfg` throughout this test to disable parts of it on those targets.
+// sparc64: https://github.com/rust-lang/rust/issues/115336
+// mips64: https://github.com/rust-lang/rust/issues/115404
+
+#[cfg(host)]
+use std::{
+ any::Any, marker::PhantomData, mem::ManuallyDrop, num::NonZeroI32, ptr::NonNull, rc::Rc,
+ sync::Arc,
+};
+
+/// To work cross-target this test must be no_core.
+/// This little prelude supplies what we need.
+#[cfg(not(host))]
+mod prelude {
+ #[lang = "sized"]
+ pub trait Sized {}
+
+ #[lang = "receiver"]
+ pub trait Receiver {}
+ impl<T: ?Sized> Receiver for &T {}
+ impl<T: ?Sized> Receiver for &mut T {}
+
+ #[lang = "copy"]
+ pub trait Copy: Sized {}
+ impl Copy for i32 {}
+ impl Copy for f32 {}
+ impl<T: ?Sized> Copy for &T {}
+ impl<T: ?Sized> Copy for *const T {}
+ impl<T: ?Sized> Copy for *mut T {}
+
+ #[lang = "clone"]
+ pub trait Clone: Sized {
+ fn clone(&self) -> Self;
+ }
+
+ #[lang = "phantom_data"]
+ pub struct PhantomData<T: ?Sized>;
+ impl<T: ?Sized> Copy for PhantomData<T> {}
+
+ #[lang = "unsafe_cell"]
+ #[repr(transparent)]
+ pub struct UnsafeCell<T: ?Sized> {
+ value: T,
+ }
+
+ pub trait Any: 'static {}
+
+ pub enum Option<T> {
+ None,
+ Some(T),
+ }
+ impl<T: Copy> Copy for Option<T> {}
+
+ pub enum Result<T, E> {
+ Ok(T),
+ Err(E),
+ }
+ impl<T: Copy, E: Copy> Copy for Result<T, E> {}
+
+ #[lang = "manually_drop"]
+ #[repr(transparent)]
+ pub struct ManuallyDrop<T: ?Sized> {
+ value: T,
+ }
+ impl<T: Copy + ?Sized> Copy for ManuallyDrop<T> {}
+
+ #[repr(transparent)]
+ #[rustc_layout_scalar_valid_range_start(1)]
+ #[rustc_nonnull_optimization_guaranteed]
+ pub struct NonNull<T: ?Sized> {
+ pointer: *const T,
+ }
+ impl<T: ?Sized> Copy for NonNull<T> {}
+
+ #[repr(transparent)]
+ #[rustc_layout_scalar_valid_range_start(1)]
+ #[rustc_nonnull_optimization_guaranteed]
+ pub struct NonZeroI32(i32);
+
+ // This just stands in for a non-trivial type.
+ pub struct Vec<T> {
+ ptr: NonNull<T>,
+ cap: usize,
+ len: usize,
+ }
+
+ pub struct Unique<T: ?Sized> {
+ pub pointer: NonNull<T>,
+ pub _marker: PhantomData<T>,
+ }
+
+ pub struct Global;
+
+ #[lang = "owned_box"]
+ pub struct Box<T: ?Sized, A = Global>(Unique<T>, A);
+
+ #[repr(C)]
+ struct RcBox<T: ?Sized> {
+ strong: UnsafeCell<usize>,
+ weak: UnsafeCell<usize>,
+ value: T,
+ }
+ pub struct Rc<T: ?Sized, A = Global> {
+ ptr: NonNull<RcBox<T>>,
+ phantom: PhantomData<RcBox<T>>,
+ alloc: A,
+ }
+
+ #[repr(C, align(8))]
+ struct AtomicUsize(usize);
+ #[repr(C)]
+ struct ArcInner<T: ?Sized> {
+ strong: AtomicUsize,
+ weak: AtomicUsize,
+ data: T,
+ }
+ pub struct Arc<T: ?Sized, A = Global> {
+ ptr: NonNull<ArcInner<T>>,
+ phantom: PhantomData<ArcInner<T>>,
+ alloc: A,
+ }
+}
+#[cfg(not(host))]
+use prelude::*;
+
+macro_rules! assert_abi_compatible {
+ ($name:ident, $t1:ty, $t2:ty) => {
+ mod $name {
+ use super::*;
+ // Declaring a `type` doesn't even check well-formedness, so we also declare a function.
+ fn check_wf(_x: $t1, _y: $t2) {}
+ // Test argument and return value, `Rust` and `C` ABIs.
+ #[rustc_abi(assert_eq)]
+ type TestRust = (fn($t1) -> $t1, fn($t2) -> $t2);
+ #[rustc_abi(assert_eq)]
+ type TestC = (extern "C" fn($t1) -> $t1, extern "C" fn($t2) -> $t2);
+ }
+ };
+}
+
+struct Zst;
+impl Copy for Zst {}
+impl Clone for Zst {
+ fn clone(&self) -> Self {
+ Zst
+ }
+}
+
+#[repr(C)]
+struct ReprC1<T: ?Sized>(T);
+#[repr(C)]
+struct ReprC2Int<T>(i32, T);
+#[repr(C)]
+struct ReprC2Float<T>(f32, T);
+#[repr(C)]
+struct ReprC4<T>(T, Vec<i32>, Zst, T);
+#[repr(C)]
+struct ReprC4Mixed<T>(T, f32, i32, T);
+#[repr(C)]
+enum ReprCEnum<T> {
+ Variant1,
+ Variant2(T),
+}
+#[repr(C)]
+union ReprCUnion<T> {
+ nothing: (),
+ something: ManuallyDrop<T>,
+}
+
+macro_rules! test_abi_compatible {
+ ($name:ident, $t1:ty, $t2:ty) => {
+ mod $name {
+ use super::*;
+ assert_abi_compatible!(plain, $t1, $t2);
+ // We also do some tests with differences in fields of `repr(C)` types.
+ assert_abi_compatible!(repr_c_1, ReprC1<$t1>, ReprC1<$t2>);
+ assert_abi_compatible!(repr_c_2_int, ReprC2Int<$t1>, ReprC2Int<$t2>);
+ assert_abi_compatible!(repr_c_2_float, ReprC2Float<$t1>, ReprC2Float<$t2>);
+ assert_abi_compatible!(repr_c_4, ReprC4<$t1>, ReprC4<$t2>);
+ assert_abi_compatible!(repr_c_4mixed, ReprC4Mixed<$t1>, ReprC4Mixed<$t2>);
+ assert_abi_compatible!(repr_c_enum, ReprCEnum<$t1>, ReprCEnum<$t2>);
+ assert_abi_compatible!(repr_c_union, ReprCUnion<$t1>, ReprCUnion<$t2>);
+ }
+ };
+}
+
+// Compatibility of pointers is probably de-facto guaranteed,
+// but that does not seem to be documented.
+test_abi_compatible!(ptr_mut, *const i32, *mut i32);
+test_abi_compatible!(ptr_pointee, *const i32, *const Vec<i32>);
+test_abi_compatible!(ref_mut, &i32, &mut i32);
+test_abi_compatible!(ref_ptr, &i32, *const i32);
+test_abi_compatible!(box_ptr, Box<i32>, *const i32);
+test_abi_compatible!(nonnull_ptr, NonNull<i32>, *const i32);
+test_abi_compatible!(fn_fn, fn(), fn(i32) -> i32);
+
+// Some further guarantees we will likely (have to) make.
+test_abi_compatible!(zst_unit, Zst, ());
+#[cfg(not(any(target_arch = "sparc64")))]
+test_abi_compatible!(zst_array, Zst, [u8; 0]);
+test_abi_compatible!(nonzero_int, NonZeroI32, i32);
+
+// `DispatchFromDyn` relies on ABI compatibility.
+// This is interesting since these types are not `repr(transparent)`.
+test_abi_compatible!(rc, Rc<i32>, *mut i32);
+test_abi_compatible!(arc, Arc<i32>, *mut i32);
+
+// `repr(transparent)` compatibility.
+#[repr(transparent)]
+struct Wrapper1<T: ?Sized>(T);
+#[repr(transparent)]
+struct Wrapper2<T: ?Sized>((), Zst, T);
+#[repr(transparent)]
+struct Wrapper3<T>(T, [u8; 0], PhantomData<u64>);
+#[repr(transparent)]
+union WrapperUnion<T> {
+ nothing: (),
+ something: ManuallyDrop<T>,
+}
+
+macro_rules! test_transparent {
+ ($name:ident, $t:ty) => {
+ mod $name {
+ use super::*;
+ test_abi_compatible!(wrap1, $t, Wrapper1<$t>);
+ test_abi_compatible!(wrap2, $t, Wrapper2<$t>);
+ test_abi_compatible!(wrap3, $t, Wrapper3<$t>);
+ test_abi_compatible!(wrap4, $t, WrapperUnion<$t>);
+ }
+ };
+}
+
+test_transparent!(simple, i32);
+test_transparent!(reference, &'static i32);
+test_transparent!(zst, Zst);
+test_transparent!(unit, ());
+test_transparent!(enum_, Option<i32>);
+test_transparent!(enum_niched, Option<&'static i32>);
+#[cfg(not(any(target_arch = "mips64", target_arch = "sparc64")))]
+mod tuples {
+ use super::*;
+ // mixing in some floats since they often get special treatment
+ test_transparent!(pair, (i32, f32));
+ // chosen to fit into 64bit
+ test_transparent!(triple, (i8, i16, f32));
+ // Pure-float types that are not ScalarPair seem to be tricky.
+ test_transparent!(triple_f32, (f32, f32, f32));
+ test_transparent!(triple_f64, (f64, f64, f64));
+ // and also something that's larger than 2 pointers
+ test_transparent!(tuple, (i32, f32, i64, f64));
+}
+// Some targets have special rules for arrays.
+#[cfg(not(any(target_arch = "mips64", target_arch = "sparc64")))]
+mod arrays {
+ use super::*;
+ test_transparent!(empty_array, [u32; 0]);
+ test_transparent!(empty_1zst_array, [u8; 0]);
+ test_transparent!(small_array, [i32; 2]); // chosen to fit into 64bit
+ test_transparent!(large_array, [i32; 16]);
+}
+
+// Some tests with unsized types (not all wrappers are compatible with that).
+macro_rules! test_transparent_unsized {
+ ($name:ident, $t:ty) => {
+ mod $name {
+ use super::*;
+ assert_abi_compatible!(wrap1, $t, Wrapper1<$t>);
+ assert_abi_compatible!(wrap1_reprc, ReprC1<$t>, ReprC1<Wrapper1<$t>>);
+ assert_abi_compatible!(wrap2, $t, Wrapper2<$t>);
+ assert_abi_compatible!(wrap2_reprc, ReprC1<$t>, ReprC1<Wrapper2<$t>>);
+ }
+ };
+}
+
+#[cfg(not(any(target_arch = "mips64", target_arch = "sparc64")))]
+mod unsized_ {
+ use super::*;
+ test_transparent_unsized!(str_, str);
+ test_transparent_unsized!(slice, [u8]);
+ test_transparent_unsized!(dyn_trait, dyn Any);
+}
+
+// RFC 3391 <https://rust-lang.github.io/rfcs/3391-result_ffi_guarantees.html>.
+macro_rules! test_nonnull {
+ ($name:ident, $t:ty) => {
+ mod $name {
+ use super::*;
+ test_abi_compatible!(option, Option<$t>, $t);
+ test_abi_compatible!(result_err_unit, Result<$t, ()>, $t);
+ test_abi_compatible!(result_ok_unit, Result<(), $t>, $t);
+ test_abi_compatible!(result_err_zst, Result<$t, Zst>, $t);
+ test_abi_compatible!(result_ok_zst, Result<Zst, $t>, $t);
+ test_abi_compatible!(result_err_arr, Result<$t, [i8; 0]>, $t);
+ test_abi_compatible!(result_ok_arr, Result<[i8; 0], $t>, $t);
+ }
+ }
+}
+
+test_nonnull!(ref_, &i32);
+test_nonnull!(mut_, &mut i32);
+test_nonnull!(ref_unsized, &[i32]);
+test_nonnull!(mut_unsized, &mut [i32]);
+test_nonnull!(fn_, fn());
+test_nonnull!(nonnull, NonNull<i32>);
+test_nonnull!(nonnull_unsized, NonNull<dyn Any>);
+test_nonnull!(non_zero, NonZeroI32);
+
+fn main() {}
diff --git a/tests/ui/abi/debug.rs b/tests/ui/abi/debug.rs
new file mode 100644
index 000000000..77715ee40
--- /dev/null
+++ b/tests/ui/abi/debug.rs
@@ -0,0 +1,53 @@
+// normalize-stderr-test "(abi|pref|unadjusted_abi_align): Align\([1-8] bytes\)" -> "$1: $$SOME_ALIGN"
+// normalize-stderr-test "(size): Size\([48] bytes\)" -> "$1: $$SOME_SIZE"
+// normalize-stderr-test "(can_unwind): (true|false)" -> "$1: $$SOME_BOOL"
+// normalize-stderr-test "(valid_range): 0\.\.=(4294967295|18446744073709551615)" -> "$1: $$FULL"
+// This pattern is prepared for when we account for alignment in the niche.
+// normalize-stderr-test "(valid_range): [1-9]\.\.=(429496729[0-9]|1844674407370955161[0-9])" -> "$1: $$NON_NULL"
+// Some attributes are only computed for release builds:
+// compile-flags: -O
+#![feature(rustc_attrs)]
+#![crate_type = "lib"]
+
+struct S(u16);
+
+#[rustc_abi(debug)]
+fn test(_x: u8) -> bool { true } //~ ERROR: fn_abi
+
+#[rustc_abi(debug)]
+type TestFnPtr = fn(bool) -> u8; //~ ERROR: fn_abi
+
+#[rustc_abi(debug)]
+fn test_generic<T>(_x: *const T) { } //~ ERROR: fn_abi
+
+#[rustc_abi(debug)]
+const C: () = (); //~ ERROR: can only be applied to
+
+impl S {
+ #[rustc_abi(debug)]
+ const C: () = (); //~ ERROR: can only be applied to
+}
+
+impl S {
+ #[rustc_abi(debug)]
+ fn assoc_test(&self) { } //~ ERROR: fn_abi
+}
+
+#[rustc_abi(assert_eq)]
+type TestAbiEq = (fn(bool), fn(bool));
+
+#[rustc_abi(assert_eq)]
+type TestAbiNe = (fn(u8), fn(u32)); //~ ERROR: ABIs are not compatible
+
+#[rustc_abi(assert_eq)]
+type TestAbiNeLarger = (fn([u8; 32]), fn([u32; 32])); //~ ERROR: ABIs are not compatible
+
+#[rustc_abi(assert_eq)]
+type TestAbiNeFloat = (fn(f32), fn(u32)); //~ ERROR: ABIs are not compatible
+
+// Sign matters on some targets (such as s390x), so let's make sure we never accept this.
+#[rustc_abi(assert_eq)]
+type TestAbiNeSign = (fn(i32), fn(u32)); //~ ERROR: ABIs are not compatible
+
+#[rustc_abi(assert_eq)]
+type TestAbiEqNonsense = (fn((str, str)), fn((str, str))); //~ ERROR: cannot be known at compilation time
diff --git a/tests/ui/abi/debug.stderr b/tests/ui/abi/debug.stderr
new file mode 100644
index 000000000..00fc7d1ec
--- /dev/null
+++ b/tests/ui/abi/debug.stderr
@@ -0,0 +1,959 @@
+error: fn_abi_of(test) = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: u8,
+ layout: Layout {
+ size: Size(1 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: Int(
+ I8,
+ false,
+ ),
+ valid_range: 0..=255,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoUndef,
+ arg_ext: None,
+ pointee_size: Size(0 bytes),
+ pointee_align: None,
+ },
+ ),
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: bool,
+ layout: Layout {
+ size: Size(1 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: Int(
+ I8,
+ false,
+ ),
+ valid_range: 0..=1,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: Some(
+ Niche {
+ offset: Size(0 bytes),
+ value: Int(
+ I8,
+ false,
+ ),
+ valid_range: 0..=1,
+ },
+ ),
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoUndef,
+ arg_ext: Zext,
+ pointee_size: Size(0 bytes),
+ pointee_align: None,
+ },
+ ),
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ --> $DIR/debug.rs:15:1
+ |
+LL | fn test(_x: u8) -> bool { true }
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: fn_abi_of(TestFnPtr) = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: bool,
+ layout: Layout {
+ size: Size(1 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: Int(
+ I8,
+ false,
+ ),
+ valid_range: 0..=1,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: Some(
+ Niche {
+ offset: Size(0 bytes),
+ value: Int(
+ I8,
+ false,
+ ),
+ valid_range: 0..=1,
+ },
+ ),
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoUndef,
+ arg_ext: Zext,
+ pointee_size: Size(0 bytes),
+ pointee_align: None,
+ },
+ ),
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: u8,
+ layout: Layout {
+ size: Size(1 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: Int(
+ I8,
+ false,
+ ),
+ valid_range: 0..=255,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoUndef,
+ arg_ext: None,
+ pointee_size: Size(0 bytes),
+ pointee_align: None,
+ },
+ ),
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ --> $DIR/debug.rs:18:1
+ |
+LL | type TestFnPtr = fn(bool) -> u8;
+ | ^^^^^^^^^^^^^^
+
+error: fn_abi_of(test_generic) = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: *const T,
+ layout: Layout {
+ size: $SOME_SIZE,
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: Pointer(
+ AddressSpace(
+ 0,
+ ),
+ ),
+ valid_range: $FULL,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoUndef,
+ arg_ext: None,
+ pointee_size: Size(0 bytes),
+ pointee_align: None,
+ },
+ ),
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: (),
+ layout: Layout {
+ size: Size(0 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Arbitrary {
+ offsets: [],
+ memory_index: [],
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Ignore,
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ --> $DIR/debug.rs:21:1
+ |
+LL | fn test_generic<T>(_x: *const T) { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: `#[rustc_abi]` can only be applied to function items, type aliases, and associated functions
+ --> $DIR/debug.rs:24:1
+ |
+LL | const C: () = ();
+ | ^^^^^^^^^^^
+
+error: ABIs are not compatible
+ left ABI = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: u8,
+ layout: Layout {
+ size: Size(1 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: Int(
+ I8,
+ false,
+ ),
+ valid_range: 0..=255,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoUndef,
+ arg_ext: None,
+ pointee_size: Size(0 bytes),
+ pointee_align: None,
+ },
+ ),
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: (),
+ layout: Layout {
+ size: Size(0 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Arbitrary {
+ offsets: [],
+ memory_index: [],
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Ignore,
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ right ABI = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: u32,
+ layout: Layout {
+ size: $SOME_SIZE,
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: Int(
+ I32,
+ false,
+ ),
+ valid_range: $FULL,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoUndef,
+ arg_ext: None,
+ pointee_size: Size(0 bytes),
+ pointee_align: None,
+ },
+ ),
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: (),
+ layout: Layout {
+ size: Size(0 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Arbitrary {
+ offsets: [],
+ memory_index: [],
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Ignore,
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ --> $DIR/debug.rs:40:1
+ |
+LL | type TestAbiNe = (fn(u8), fn(u32));
+ | ^^^^^^^^^^^^^^
+
+error: ABIs are not compatible
+ left ABI = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: [u8; 32],
+ layout: Layout {
+ size: Size(32 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Array {
+ stride: Size(1 bytes),
+ count: 32,
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Indirect {
+ attrs: ArgAttributes {
+ regular: NoAlias | NoCapture | NonNull | NoUndef,
+ arg_ext: None,
+ pointee_size: Size(32 bytes),
+ pointee_align: Some(
+ Align(1 bytes),
+ ),
+ },
+ meta_attrs: None,
+ on_stack: false,
+ },
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: (),
+ layout: Layout {
+ size: Size(0 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Arbitrary {
+ offsets: [],
+ memory_index: [],
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Ignore,
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ right ABI = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: [u32; 32],
+ layout: Layout {
+ size: Size(128 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Array {
+ stride: Size(4 bytes),
+ count: 32,
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Indirect {
+ attrs: ArgAttributes {
+ regular: NoAlias | NoCapture | NonNull | NoUndef,
+ arg_ext: None,
+ pointee_size: Size(128 bytes),
+ pointee_align: Some(
+ Align(4 bytes),
+ ),
+ },
+ meta_attrs: None,
+ on_stack: false,
+ },
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: (),
+ layout: Layout {
+ size: Size(0 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Arbitrary {
+ offsets: [],
+ memory_index: [],
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Ignore,
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ --> $DIR/debug.rs:43:1
+ |
+LL | type TestAbiNeLarger = (fn([u8; 32]), fn([u32; 32]));
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: ABIs are not compatible
+ left ABI = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: f32,
+ layout: Layout {
+ size: $SOME_SIZE,
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: F32,
+ valid_range: $FULL,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoUndef,
+ arg_ext: None,
+ pointee_size: Size(0 bytes),
+ pointee_align: None,
+ },
+ ),
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: (),
+ layout: Layout {
+ size: Size(0 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Arbitrary {
+ offsets: [],
+ memory_index: [],
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Ignore,
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ right ABI = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: u32,
+ layout: Layout {
+ size: $SOME_SIZE,
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: Int(
+ I32,
+ false,
+ ),
+ valid_range: $FULL,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoUndef,
+ arg_ext: None,
+ pointee_size: Size(0 bytes),
+ pointee_align: None,
+ },
+ ),
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: (),
+ layout: Layout {
+ size: Size(0 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Arbitrary {
+ offsets: [],
+ memory_index: [],
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Ignore,
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ --> $DIR/debug.rs:46:1
+ |
+LL | type TestAbiNeFloat = (fn(f32), fn(u32));
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: ABIs are not compatible
+ left ABI = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: i32,
+ layout: Layout {
+ size: $SOME_SIZE,
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: Int(
+ I32,
+ true,
+ ),
+ valid_range: $FULL,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoUndef,
+ arg_ext: None,
+ pointee_size: Size(0 bytes),
+ pointee_align: None,
+ },
+ ),
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: (),
+ layout: Layout {
+ size: Size(0 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Arbitrary {
+ offsets: [],
+ memory_index: [],
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Ignore,
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ right ABI = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: u32,
+ layout: Layout {
+ size: $SOME_SIZE,
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: Int(
+ I32,
+ false,
+ ),
+ valid_range: $FULL,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoUndef,
+ arg_ext: None,
+ pointee_size: Size(0 bytes),
+ pointee_align: None,
+ },
+ ),
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: (),
+ layout: Layout {
+ size: Size(0 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Arbitrary {
+ offsets: [],
+ memory_index: [],
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Ignore,
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ --> $DIR/debug.rs:50:1
+ |
+LL | type TestAbiNeSign = (fn(i32), fn(u32));
+ | ^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/debug.rs:53:46
+ |
+LL | type TestAbiEqNonsense = (fn((str, str)), fn((str, str)));
+ | ^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `str`
+ = note: only the last element of a tuple may have a dynamically sized type
+
+error: `#[rustc_abi]` can only be applied to function items, type aliases, and associated functions
+ --> $DIR/debug.rs:28:5
+ |
+LL | const C: () = ();
+ | ^^^^^^^^^^^
+
+error: fn_abi_of(assoc_test) = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: &S,
+ layout: Layout {
+ size: $SOME_SIZE,
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: Pointer(
+ AddressSpace(
+ 0,
+ ),
+ ),
+ valid_range: $NON_NULL,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: Some(
+ Niche {
+ offset: Size(0 bytes),
+ value: Pointer(
+ AddressSpace(
+ 0,
+ ),
+ ),
+ valid_range: $NON_NULL,
+ },
+ ),
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoAlias | NonNull | ReadOnly | NoUndef,
+ arg_ext: None,
+ pointee_size: Size(2 bytes),
+ pointee_align: Some(
+ Align(2 bytes),
+ ),
+ },
+ ),
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: (),
+ layout: Layout {
+ size: Size(0 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Arbitrary {
+ offsets: [],
+ memory_index: [],
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Ignore,
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ --> $DIR/debug.rs:33:5
+ |
+LL | fn assoc_test(&self) { }
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 11 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/abi/explicit_repr_rust.rs b/tests/ui/abi/explicit_repr_rust.rs
new file mode 100644
index 000000000..4f8cab3bf
--- /dev/null
+++ b/tests/ui/abi/explicit_repr_rust.rs
@@ -0,0 +1,12 @@
+// check-pass
+
+#[repr(Rust)]
+struct A;
+
+#[repr(Rust, align(16))]
+struct B;
+
+#[repr(Rust, packed)]
+struct C;
+
+fn main() {}
diff --git a/tests/ui/abi/relocation_model_pic.rs b/tests/ui/abi/relocation_model_pic.rs
index 0cfc44cd0..cca2e8db7 100644
--- a/tests/ui/abi/relocation_model_pic.rs
+++ b/tests/ui/abi/relocation_model_pic.rs
@@ -1,7 +1,6 @@
// run-pass
// compile-flags: -C relocation-model=pic
-// ignore-emscripten no pic
-// ignore-wasm
+// needs-relocation-model-pic
#![feature(cfg_relocation_model)]
diff --git a/tests/ui/argument-suggestions/issue-100154.stderr b/tests/ui/argument-suggestions/issue-100154.stderr
index 2504f616f..966f56e2a 100644
--- a/tests/ui/argument-suggestions/issue-100154.stderr
+++ b/tests/ui/argument-suggestions/issue-100154.stderr
@@ -14,12 +14,10 @@ LL | fn foo(i: impl std::fmt::Display) {}
= note: `impl Trait` cannot be explicitly specified as a generic argument
error[E0277]: `()` doesn't implement `std::fmt::Display`
- --> $DIR/issue-100154.rs:4:15
+ --> $DIR/issue-100154.rs:4:11
|
LL | foo::<()>(());
- | --------- ^^ `()` cannot be formatted with the default formatter
- | |
- | required by a bound introduced by this call
+ | ^^ `()` 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
diff --git a/tests/ui/argument-suggestions/two-mismatch-notes.stderr b/tests/ui/argument-suggestions/two-mismatch-notes.stderr
index 38cf23ddc..70cc60255 100644
--- a/tests/ui/argument-suggestions/two-mismatch-notes.stderr
+++ b/tests/ui/argument-suggestions/two-mismatch-notes.stderr
@@ -11,7 +11,6 @@ LL | foo(f, w);
| ^
= note: expected fn pointer `fn(i32)`
found fn item `fn(u32) {f}`
- = note: when the arguments and return types match, functions can be coerced to function pointers
note: expected `Wrapper<i32>`, found `Wrapper<isize>`
--> $DIR/two-mismatch-notes.rs:10:12
|
diff --git a/tests/ui/asm/aarch64/type-check-2.stderr b/tests/ui/asm/aarch64/type-check-2.stderr
index 875df44ff..d647f6a9f 100644
--- a/tests/ui/asm/aarch64/type-check-2.stderr
+++ b/tests/ui/asm/aarch64/type-check-2.stderr
@@ -22,7 +22,7 @@ LL | asm!("{:v}", in(vreg) SimdNonCopy(0.0, 0.0, 0.0, 0.0));
|
= note: `SimdNonCopy` does not implement the Copy trait
-error: cannot use value of type `[closure@$DIR/type-check-2.rs:41:28: 41:36]` for inline assembly
+error: cannot use value of type `{closure@$DIR/type-check-2.rs:41:28: 41:36}` for inline assembly
--> $DIR/type-check-2.rs:41:28
|
LL | asm!("{}", in(reg) |x: i32| x);
diff --git a/tests/ui/asm/x86_64/type-check-2.stderr b/tests/ui/asm/x86_64/type-check-2.stderr
index d9ca25519..4f3d5100a 100644
--- a/tests/ui/asm/x86_64/type-check-2.stderr
+++ b/tests/ui/asm/x86_64/type-check-2.stderr
@@ -30,7 +30,7 @@ LL | asm!("{}", in(xmm_reg) SimdNonCopy(0.0, 0.0, 0.0, 0.0));
|
= note: `SimdNonCopy` does not implement the Copy trait
-error: cannot use value of type `[closure@$DIR/type-check-2.rs:52:28: 52:36]` for inline assembly
+error: cannot use value of type `{closure@$DIR/type-check-2.rs:52:28: 52:36}` for inline assembly
--> $DIR/type-check-2.rs:52:28
|
LL | asm!("{}", in(reg) |x: i32| x);
diff --git a/tests/ui/associated-consts/associated-const-array-len.stderr b/tests/ui/associated-consts/associated-const-array-len.stderr
index 86c62e7b7..e3db45810 100644
--- a/tests/ui/associated-consts/associated-const-array-len.stderr
+++ b/tests/ui/associated-consts/associated-const-array-len.stderr
@@ -1,8 +1,14 @@
error[E0277]: the trait bound `i32: Foo` is not satisfied
- --> $DIR/associated-const-array-len.rs:5:16
+ --> $DIR/associated-const-array-len.rs:5:17
|
LL | const X: [i32; <i32 as Foo>::ID] = [0, 1, 2];
- | ^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32`
+ | ^^^ the trait `Foo` is not implemented for `i32`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/associated-const-array-len.rs:1:1
+ |
+LL | trait Foo {
+ | ^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/associated-consts/defaults-cyclic-fail.rs b/tests/ui/associated-consts/defaults-cyclic-fail.rs
index a1c6840a0..9ef0003da 100644
--- a/tests/ui/associated-consts/defaults-cyclic-fail.rs
+++ b/tests/ui/associated-consts/defaults-cyclic-fail.rs
@@ -3,7 +3,7 @@
// Cyclic assoc. const defaults don't error unless *used*
trait Tr {
const A: u8 = Self::B;
- //~^ cycle detected when const-evaluating + checking `Tr::A`
+ //~^ cycle detected
const B: u8 = Self::A;
}
diff --git a/tests/ui/associated-consts/defaults-cyclic-fail.stderr b/tests/ui/associated-consts/defaults-cyclic-fail.stderr
index ebdb76e42..e29c32f5d 100644
--- a/tests/ui/associated-consts/defaults-cyclic-fail.stderr
+++ b/tests/ui/associated-consts/defaults-cyclic-fail.stderr
@@ -1,15 +1,25 @@
-error[E0391]: cycle detected when const-evaluating + checking `Tr::A`
+error[E0391]: cycle detected when simplifying constant for the type system `Tr::A`
+ --> $DIR/defaults-cyclic-fail.rs:5:5
+ |
+LL | const A: u8 = Self::B;
+ | ^^^^^^^^^^^
+ |
+note: ...which requires const-evaluating + checking `Tr::A`...
--> $DIR/defaults-cyclic-fail.rs:5:19
|
LL | const A: u8 = Self::B;
| ^^^^^^^
+note: ...which requires simplifying constant for the type system `Tr::B`...
+ --> $DIR/defaults-cyclic-fail.rs:8:5
|
+LL | const B: u8 = Self::A;
+ | ^^^^^^^^^^^
note: ...which requires const-evaluating + checking `Tr::B`...
--> $DIR/defaults-cyclic-fail.rs:8:19
|
LL | const B: u8 = Self::A;
| ^^^^^^^
- = note: ...which again requires const-evaluating + checking `Tr::A`, completing the cycle
+ = note: ...which again requires simplifying constant for the type system `Tr::A`, completing the cycle
note: cycle used when const-evaluating + checking `main::promoted[1]`
--> $DIR/defaults-cyclic-fail.rs:16:16
|
diff --git a/tests/ui/associated-consts/defaults-not-assumed-fail.stderr b/tests/ui/associated-consts/defaults-not-assumed-fail.stderr
index 9b761b006..d65991234 100644
--- a/tests/ui/associated-consts/defaults-not-assumed-fail.stderr
+++ b/tests/ui/associated-consts/defaults-not-assumed-fail.stderr
@@ -4,13 +4,13 @@ error[E0080]: evaluation of `<() as Tr>::B` failed
LL | const B: u8 = Self::A + 1;
| ^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/defaults-not-assumed-fail.rs:33:16
|
LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
| ^^^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/defaults-not-assumed-fail.rs:33:5
|
LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
@@ -18,7 +18,7 @@ LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
|
= note: this note originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/defaults-not-assumed-fail.rs:33:5
|
LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
diff --git a/tests/ui/associated-consts/double-elided.rs b/tests/ui/associated-consts/double-elided.rs
new file mode 100644
index 000000000..fd0317781
--- /dev/null
+++ b/tests/ui/associated-consts/double-elided.rs
@@ -0,0 +1,12 @@
+struct S;
+
+impl S {
+ const C: &&str = &"";
+ //~^ WARN `&` without an explicit lifetime name cannot be used here
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ //~| WARN `&` without an explicit lifetime name cannot be used here
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ //~| ERROR in type `&&str`, reference has a longer lifetime than the data it references
+}
+
+fn main() {}
diff --git a/tests/ui/associated-consts/double-elided.stderr b/tests/ui/associated-consts/double-elided.stderr
new file mode 100644
index 000000000..ba4e6a23e
--- /dev/null
+++ b/tests/ui/associated-consts/double-elided.stderr
@@ -0,0 +1,47 @@
+warning: `&` without an explicit lifetime name cannot be used here
+ --> $DIR/double-elided.rs:4:14
+ |
+LL | const C: &&str = &"";
+ | ^
+ |
+ = 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 #115010 <https://github.com/rust-lang/rust/issues/115010>
+ = note: `#[warn(elided_lifetimes_in_associated_constant)]` on by default
+help: use the `'static` lifetime
+ |
+LL | const C: &'static &str = &"";
+ | +++++++
+
+warning: `&` without an explicit lifetime name cannot be used here
+ --> $DIR/double-elided.rs:4:15
+ |
+LL | const C: &&str = &"";
+ | ^
+ |
+ = 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 #115010 <https://github.com/rust-lang/rust/issues/115010>
+help: use the `'static` lifetime
+ |
+LL | const C: &&'static str = &"";
+ | +++++++
+
+error[E0491]: in type `&&str`, reference has a longer lifetime than the data it references
+ --> $DIR/double-elided.rs:4:5
+ |
+LL | const C: &&str = &"";
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+note: the pointer is valid for the anonymous lifetime as defined here
+ --> $DIR/double-elided.rs:4:14
+ |
+LL | const C: &&str = &"";
+ | ^
+note: but the referenced data is only valid for the anonymous lifetime as defined here
+ --> $DIR/double-elided.rs:4:14
+ |
+LL | const C: &&str = &"";
+ | ^
+
+error: aborting due to previous error; 2 warnings emitted
+
+For more information about this error, try `rustc --explain E0491`.
diff --git a/tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.rs b/tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.rs
index 40896c32e..1e0b77b0d 100644
--- a/tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.rs
+++ b/tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.rs
@@ -5,6 +5,8 @@ trait Trait {
impl Trait for () {
const ASSOC: &dyn Fn(_) = 1i32;
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for associated constants
+ //~| WARN `&` without an explicit lifetime name cannot be used here
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
}
fn main() {}
diff --git a/tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.stderr b/tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.stderr
index 993a08fab..f8c02420f 100644
--- a/tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.stderr
+++ b/tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.stderr
@@ -1,9 +1,23 @@
+warning: `&` without an explicit lifetime name cannot be used here
+ --> $DIR/infer-placeholder-in-non-suggestable-pos.rs:6:18
+ |
+LL | const ASSOC: &dyn Fn(_) = 1i32;
+ | ^
+ |
+ = 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 #115010 <https://github.com/rust-lang/rust/issues/115010>
+ = note: `#[warn(elided_lifetimes_in_associated_constant)]` on by default
+help: use the `'static` lifetime
+ |
+LL | const ASSOC: &'static dyn Fn(_) = 1i32;
+ | +++++++
+
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
--> $DIR/infer-placeholder-in-non-suggestable-pos.rs:6:26
|
LL | const ASSOC: &dyn Fn(_) = 1i32;
| ^ not allowed in type signatures
-error: aborting due to previous error
+error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0121`.
diff --git a/tests/ui/associated-consts/issue-105330.stderr b/tests/ui/associated-consts/issue-105330.stderr
index e9fe3a5e5..927422fa8 100644
--- a/tests/ui/associated-consts/issue-105330.stderr
+++ b/tests/ui/associated-consts/issue-105330.stderr
@@ -51,6 +51,11 @@ error[E0277]: the trait bound `Demo: TraitWAssocConst` is not satisfied
LL | foo::<Demo>()();
| ^^^^ the trait `TraitWAssocConst` is not implemented for `Demo`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-105330.rs:1:1
+ |
+LL | pub trait TraitWAssocConst {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `foo`
--> $DIR/issue-105330.rs:11:11
|
@@ -87,6 +92,11 @@ error[E0277]: the trait bound `Demo: TraitWAssocConst` is not satisfied
LL | foo::<Demo>();
| ^^^^ the trait `TraitWAssocConst` is not implemented for `Demo`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-105330.rs:1:1
+ |
+LL | pub trait TraitWAssocConst {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `foo`
--> $DIR/issue-105330.rs:11:11
|
diff --git a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr
index 51bf0cb5e..4418fb755 100644
--- a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr
+++ b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr
@@ -4,7 +4,12 @@ error[E0391]: cycle detected when elaborating drops for `<impl at $DIR/issue-249
LL | const BAR: u32 = IMPL_REF_BAR;
| ^^^^^^^^^^^^
|
-note: ...which requires const-evaluating + checking `IMPL_REF_BAR`...
+note: ...which requires simplifying constant for the type system `IMPL_REF_BAR`...
+ --> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:7:1
+ |
+LL | const IMPL_REF_BAR: u32 = GlobalImplRef::BAR;
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+note: ...which requires simplifying constant for the type system `IMPL_REF_BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:7:1
|
LL | const IMPL_REF_BAR: u32 = GlobalImplRef::BAR;
@@ -14,6 +19,11 @@ note: ...which requires const-evaluating + checking `IMPL_REF_BAR`...
|
LL | const IMPL_REF_BAR: u32 = GlobalImplRef::BAR;
| ^^^^^^^^^^^^^^^^^^
+note: ...which requires simplifying constant for the type system `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 11:19>::BAR`...
+ --> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:12:5
+ |
+LL | const BAR: u32 = IMPL_REF_BAR;
+ | ^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 11:19>::BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:12:5
|
diff --git a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr
index 8277d41a1..392cd5e34 100644
--- a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr
+++ b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr
@@ -4,7 +4,12 @@ error[E0391]: cycle detected when elaborating drops for `FooDefault::BAR`
LL | const BAR: u32 = DEFAULT_REF_BAR;
| ^^^^^^^^^^^^^^^
|
-note: ...which requires const-evaluating + checking `DEFAULT_REF_BAR`...
+note: ...which requires simplifying constant for the type system `DEFAULT_REF_BAR`...
+ --> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:11:1
+ |
+LL | const DEFAULT_REF_BAR: u32 = <GlobalDefaultRef>::BAR;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: ...which requires simplifying constant for the type system `DEFAULT_REF_BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:11:1
|
LL | const DEFAULT_REF_BAR: u32 = <GlobalDefaultRef>::BAR;
@@ -14,6 +19,11 @@ note: ...which requires const-evaluating + checking `DEFAULT_REF_BAR`...
|
LL | const DEFAULT_REF_BAR: u32 = <GlobalDefaultRef>::BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^
+note: ...which requires simplifying constant for the type system `FooDefault::BAR`...
+ --> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:8:5
+ |
+LL | const BAR: u32 = DEFAULT_REF_BAR;
+ | ^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `FooDefault::BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:8:5
|
diff --git a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr
index 9983ba794..6cbddca9c 100644
--- a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr
+++ b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr
@@ -4,7 +4,12 @@ error[E0391]: cycle detected when elaborating drops for `<impl at $DIR/issue-249
LL | const BAR: u32 = TRAIT_REF_BAR;
| ^^^^^^^^^^^^^
|
-note: ...which requires const-evaluating + checking `TRAIT_REF_BAR`...
+note: ...which requires simplifying constant for the type system `TRAIT_REF_BAR`...
+ --> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1
+ |
+LL | const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+note: ...which requires simplifying constant for the type system `TRAIT_REF_BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1
|
LL | const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR;
@@ -14,6 +19,11 @@ note: ...which requires const-evaluating + checking `TRAIT_REF_BAR`...
|
LL | const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR;
| ^^^^^^^^^^^^^^^^^^^^^
+note: ...which requires simplifying constant for the type system `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 11:28>::BAR`...
+ --> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:12:5
+ |
+LL | const BAR: u32 = TRAIT_REF_BAR;
+ | ^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 11:28>::BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:12:5
|
diff --git a/tests/ui/associated-inherent-types/issue-111879-1.stderr b/tests/ui/associated-inherent-types/issue-111879-1.stderr
index 689b45e09..bf35f2bb5 100644
--- a/tests/ui/associated-inherent-types/issue-111879-1.stderr
+++ b/tests/ui/associated-inherent-types/issue-111879-1.stderr
@@ -4,8 +4,8 @@ error[E0580]: `main` function has wrong type
LL | fn main(_: for<'a> fn(Foo<fn(&'a ())>::Assoc)) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
- = note: expected fn pointer `fn()`
- found fn pointer `fn(for<'a> fn(Foo<fn(&'a ())>::Assoc))`
+ = note: expected signature `fn()`
+ found signature `fn(for<'a> fn(&'a ()))`
error: aborting due to previous error
diff --git a/tests/ui/associated-inherent-types/private-in-public.rs b/tests/ui/associated-inherent-types/private-in-public.rs
index e9e189f95..7797a2a16 100644
--- a/tests/ui/associated-inherent-types/private-in-public.rs
+++ b/tests/ui/associated-inherent-types/private-in-public.rs
@@ -1,26 +1,15 @@
+// check-pass
+
#![feature(inherent_associated_types)]
-#![feature(type_privacy_lints)]
#![allow(incomplete_features)]
#![crate_type = "lib"]
-#![deny(private_in_public)]
-#![warn(private_interfaces)]
-
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
pub type PubAlias0 = PubTy::PrivAssocTy;
-//~^ ERROR private associated type `PubTy::PrivAssocTy` in public interface (error E0446)
-//~| WARNING this was previously accepted
-//~| WARNING associated type `PubTy::PrivAssocTy` is more private than the item `PubAlias0`
+//~^ WARNING associated type `PubTy::PrivAssocTy` is more private than the item `PubAlias0`
pub type PubAlias1 = PrivTy::PubAssocTy;
-//~^ ERROR private type `PrivTy` in public interface (error E0446)
-//~| WARNING this was previously accepted
-//~| WARNING type `PrivTy` is more private than the item `PubAlias1`
+//~^ WARNING type `PrivTy` is more private than the item `PubAlias1`
pub type PubAlias2 = PubTy::PubAssocTy<PrivTy>;
-//~^ ERROR private type `PrivTy` in public interface (error E0446)
-//~| WARNING this was previously accepted
-//~| WARNING type `PrivTy` is more private than the item `PubAlias2`
+//~^ WARNING type `PrivTy` is more private than the item `PubAlias2`
pub struct PubTy;
impl PubTy {
diff --git a/tests/ui/associated-inherent-types/private-in-public.stderr b/tests/ui/associated-inherent-types/private-in-public.stderr
index 65d187c1b..076bbd78a 100644
--- a/tests/ui/associated-inherent-types/private-in-public.stderr
+++ b/tests/ui/associated-inherent-types/private-in-public.stderr
@@ -1,75 +1,39 @@
-error: private associated type `PubTy::PrivAssocTy` in public interface (error E0446)
- --> $DIR/private-in-public.rs:12:1
- |
-LL | pub type PubAlias0 = PubTy::PrivAssocTy;
- | ^^^^^^^^^^^^^^^^^^
- |
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
-note: the lint level is defined here
- --> $DIR/private-in-public.rs:5:9
- |
-LL | #![deny(private_in_public)]
- | ^^^^^^^^^^^^^^^^^
-
warning: associated type `PubTy::PrivAssocTy` is more private than the item `PubAlias0`
- --> $DIR/private-in-public.rs:12:1
+ --> $DIR/private-in-public.rs:7:1
|
LL | pub type PubAlias0 = PubTy::PrivAssocTy;
| ^^^^^^^^^^^^^^^^^^ type alias `PubAlias0` is reachable at visibility `pub`
|
note: but associated type `PubTy::PrivAssocTy` is only usable at visibility `pub(crate)`
- --> $DIR/private-in-public.rs:27:5
+ --> $DIR/private-in-public.rs:16:5
|
LL | type PrivAssocTy = ();
| ^^^^^^^^^^^^^^^^
-note: the lint level is defined here
- --> $DIR/private-in-public.rs:6:9
- |
-LL | #![warn(private_interfaces)]
- | ^^^^^^^^^^^^^^^^^^
-
-error: private type `PrivTy` in public interface (error E0446)
- --> $DIR/private-in-public.rs:16:1
- |
-LL | pub type PubAlias1 = PrivTy::PubAssocTy;
- | ^^^^^^^^^^^^^^^^^^
- |
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+ = note: `#[warn(private_interfaces)]` on by default
warning: type `PrivTy` is more private than the item `PubAlias1`
- --> $DIR/private-in-public.rs:16:1
+ --> $DIR/private-in-public.rs:9:1
|
LL | pub type PubAlias1 = PrivTy::PubAssocTy;
| ^^^^^^^^^^^^^^^^^^ type alias `PubAlias1` is reachable at visibility `pub`
|
note: but type `PrivTy` is only usable at visibility `pub(crate)`
- --> $DIR/private-in-public.rs:31:1
+ --> $DIR/private-in-public.rs:20:1
|
LL | struct PrivTy;
| ^^^^^^^^^^^^^
-error: private type `PrivTy` in public interface (error E0446)
- --> $DIR/private-in-public.rs:20:1
- |
-LL | pub type PubAlias2 = PubTy::PubAssocTy<PrivTy>;
- | ^^^^^^^^^^^^^^^^^^
- |
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
-
warning: type `PrivTy` is more private than the item `PubAlias2`
- --> $DIR/private-in-public.rs:20:1
+ --> $DIR/private-in-public.rs:11:1
|
LL | pub type PubAlias2 = PubTy::PubAssocTy<PrivTy>;
| ^^^^^^^^^^^^^^^^^^ type alias `PubAlias2` is reachable at visibility `pub`
|
note: but type `PrivTy` is only usable at visibility `pub(crate)`
- --> $DIR/private-in-public.rs:31:1
+ --> $DIR/private-in-public.rs:20:1
|
LL | struct PrivTy;
| ^^^^^^^^^^^^^
-error: aborting due to 3 previous errors; 3 warnings emitted
+warning: 3 warnings emitted
diff --git a/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.rs b/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.rs
index 5c59f217b..997696923 100644
--- a/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.rs
+++ b/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.rs
@@ -1,6 +1,5 @@
-// FIXME(inherent_associated_types): This should be `check-pass`
-// known-bug: #108491
// compile-flags: --crate-type=lib
+// check-pass
#![feature(inherent_associated_types)]
#![allow(incomplete_features)]
@@ -8,11 +7,6 @@
// Bounds on the self type play a major role in the resolution of inherent associated types (*).
// As a result of that, if a type alias contains any then its bounds have to be respected and the
// lint `type_alias_bounds` should not fire.
-//
-// FIXME(inherent_associated_types): In the current implementation that is. We might move the
-// selection phase of IATs from hir_typeck to trait_selection resulting in us not requiring the
-// ParamEnv that early allowing us to ignore bounds on type aliases again.
-// Triage this before stabilization.
#![deny(type_alias_bounds)]
diff --git a/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.stderr b/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.stderr
deleted file mode 100644
index 5e18543fc..000000000
--- a/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.stderr
+++ /dev/null
@@ -1,55 +0,0 @@
-error[E0391]: cycle detected when expanding type alias `Alias`
- --> $DIR/type-alias-bounds-are-enforced.rs:19:1
- |
-LL | pub type Alias<T: Bound> = (Source<T>::Assoc,);
- | ^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: ...which requires computing the variances of `Source`...
- --> $DIR/type-alias-bounds-are-enforced.rs:21:1
- |
-LL | pub struct Source<T>(T);
- | ^^^^^^^^^^^^^^^^^^^^
- = note: ...which requires computing the variances for items in this crate...
- = note: ...which again requires expanding type alias `Alias`, completing the cycle
-note: cycle used when collecting item types in top-level module
- --> $DIR/type-alias-bounds-are-enforced.rs:5:1
- |
-LL | / #![feature(inherent_associated_types)]
-LL | | #![allow(incomplete_features)]
-LL | |
-LL | | // Bounds on the self type play a major role in the resolution of inherent associated types (*).
-... |
-LL | | pub type Assoc = ();
-LL | | }
- | |_^
- = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-
-error[E0391]: cycle detected when expanding type alias `Alias`
- --> $DIR/type-alias-bounds-are-enforced.rs:19:1
- |
-LL | pub type Alias<T: Bound> = (Source<T>::Assoc,);
- | ^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: ...which requires computing the variances of `Source`...
- --> $DIR/type-alias-bounds-are-enforced.rs:21:1
- |
-LL | pub struct Source<T>(T);
- | ^^^^^^^^^^^^^^^^^^^^
- = note: ...which requires computing the variances for items in this crate...
- = note: ...which again requires expanding type alias `Alias`, completing the cycle
-note: cycle used when collecting item types in top-level module
- --> $DIR/type-alias-bounds-are-enforced.rs:5:1
- |
-LL | / #![feature(inherent_associated_types)]
-LL | | #![allow(incomplete_features)]
-LL | |
-LL | | // Bounds on the self type play a major role in the resolution of inherent associated types (*).
-... |
-LL | | pub type Assoc = ();
-LL | | }
- | |_^
- = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/associated-type-bounds/overlaping-bound-suggestion.rs b/tests/ui/associated-type-bounds/overlaping-bound-suggestion.rs
new file mode 100644
index 000000000..3853bc859
--- /dev/null
+++ b/tests/ui/associated-type-bounds/overlaping-bound-suggestion.rs
@@ -0,0 +1,12 @@
+#![allow(bare_trait_objects)]
+#![feature(associated_type_bounds)]
+trait Item {
+ type Core;
+}
+pub struct Flatten<I> {
+ inner: <IntoIterator<Item: IntoIterator<Item: >>::IntoIterator as Item>::Core,
+ //~^ ERROR E0191
+ //~| ERROR E0223
+}
+
+fn main() {}
diff --git a/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr b/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr
new file mode 100644
index 000000000..61299550e
--- /dev/null
+++ b/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr
@@ -0,0 +1,24 @@
+error[E0191]: the value of the associated types `IntoIter` (from trait `IntoIterator`), `IntoIter` (from trait `IntoIterator`), `Item` (from trait `IntoIterator`), `Item` (from trait `IntoIterator`) must be specified
+ --> $DIR/overlaping-bound-suggestion.rs:7:13
+ |
+LL | inner: <IntoIterator<Item: IntoIterator<Item: >>::IntoIterator as Item>::Core,
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | | |
+ | | associated types `Item`, `IntoIter` must be specified
+ | associated types `Item`, `IntoIter` must be specified
+
+error[E0223]: ambiguous associated type
+ --> $DIR/overlaping-bound-suggestion.rs:7:13
+ |
+LL | inner: <IntoIterator<Item: IntoIterator<Item: >>::IntoIterator as Item>::Core,
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+help: if there were a trait named `Example` with associated type `IntoIterator` implemented for `(dyn IntoIterator + 'static)`, you could use the fully-qualified path
+ |
+LL | inner: <<(dyn IntoIterator + 'static) as Example>::IntoIterator as Item>::Core,
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0191, E0223.
+For more information about an error, try `rustc --explain E0191`.
diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr
index c2da4f576..edce1045e 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr
@@ -13,12 +13,12 @@ error: future cannot be sent between threads safely
LL | is_send(foo::<T>());
| ^^^^^^^^^^ future returned by `foo` is not `Send`
|
- = help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>>`
+ = help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>> { <T as Foo>::method() }`
note: future is not `Send` as it awaits another future which is not `Send`
--> $DIR/basic.rs:13:5
|
LL | T::method().await?;
- | ^^^^^^^^^^^ await occurs here on type `impl Future<Output = Result<(), ()>>`, which is not `Send`
+ | ^^^^^^^^^^^ await occurs here on type `impl Future<Output = Result<(), ()>> { <T as Foo>::method() }`, which is not `Send`
note: required by a bound in `is_send`
--> $DIR/basic.rs:17:20
|
diff --git a/tests/ui/associated-type-bounds/suggest-removing-impl.rs b/tests/ui/associated-type-bounds/suggest-removing-impl.rs
new file mode 100644
index 000000000..242cd8572
--- /dev/null
+++ b/tests/ui/associated-type-bounds/suggest-removing-impl.rs
@@ -0,0 +1,14 @@
+trait Tr {
+ type Assoc: impl Sized;
+ //~^ ERROR expected a trait, found type
+ //~| HELP use the trait bounds directly
+
+ fn fn_with_generics<T>()
+ where
+ T: impl Sized
+ //~^ ERROR expected a trait, found type
+ //~| HELP use the trait bounds directly
+ {}
+}
+
+fn main() {}
diff --git a/tests/ui/associated-type-bounds/suggest-removing-impl.stderr b/tests/ui/associated-type-bounds/suggest-removing-impl.stderr
new file mode 100644
index 000000000..875b2db6d
--- /dev/null
+++ b/tests/ui/associated-type-bounds/suggest-removing-impl.stderr
@@ -0,0 +1,26 @@
+error: expected a trait, found type
+ --> $DIR/suggest-removing-impl.rs:2:17
+ |
+LL | type Assoc: impl Sized;
+ | ^^^^^^^^^^
+ |
+help: use the trait bounds directly
+ |
+LL - type Assoc: impl Sized;
+LL + type Assoc: Sized;
+ |
+
+error: expected a trait, found type
+ --> $DIR/suggest-removing-impl.rs:8:12
+ |
+LL | T: impl Sized
+ | ^^^^^^^^^^
+ |
+help: use the trait bounds directly
+ |
+LL - T: impl Sized
+LL + T: Sized
+ |
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr b/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr
index 8c3463a28..fbc4ccd4c 100644
--- a/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr
+++ b/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `(): Add<A>` is not satisfied
|
LL | r = r + a;
| ^ the trait `Add<A>` is not implemented for `()`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/associated-types-ICE-when-projecting-out-of-err.rs:15:1
+ |
+LL | trait Add<RHS=Self> {
+ | ^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr b/tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr
index 8fecfdf7b..676d6353d 100644
--- a/tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr
+++ b/tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `T: Foo<usize>` is not satisfied
- --> $DIR/associated-types-invalid-trait-ref-issue-18865.rs:10:12
+ --> $DIR/associated-types-invalid-trait-ref-issue-18865.rs:10:13
|
LL | let u: <T as Foo<usize>>::Bar = t.get_bar();
- | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo<usize>` is not implemented for `T`
+ | ^ the trait `Foo<usize>` is not implemented for `T`
|
help: consider further restricting this bound
|
diff --git a/tests/ui/associated-types/associated-types-no-suitable-supertrait.stderr b/tests/ui/associated-types/associated-types-no-suitable-supertrait.stderr
index bd3ee2abd..b3f2e16ba 100644
--- a/tests/ui/associated-types/associated-types-no-suitable-supertrait.stderr
+++ b/tests/ui/associated-types/associated-types-no-suitable-supertrait.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `(T, U): Get` is not satisfied
|
LL | fn uhoh<U:Get>(&self, foo: U, bar: <(T, U) as Get>::Value) {}
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `(T, U)`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/associated-types-no-suitable-supertrait.rs:12:1
+ |
+LL | trait Get {
+ | ^^^^^^^^^
error[E0277]: the trait bound `Self: Get` is not satisfied
--> $DIR/associated-types-no-suitable-supertrait.rs:17:40
diff --git a/tests/ui/associated-types/defaults-specialization.stderr b/tests/ui/associated-types/defaults-specialization.stderr
index 7e21f7fc3..7ef433d85 100644
--- a/tests/ui/associated-types/defaults-specialization.stderr
+++ b/tests/ui/associated-types/defaults-specialization.stderr
@@ -29,7 +29,7 @@ error[E0053]: method `make` has an incompatible type for trait
--> $DIR/defaults-specialization.rs:35:18
|
LL | default type Ty = bool;
- | ----------------------- expected this associated type
+ | ----------------------- associated type is `default` and may be overridden
LL |
LL | fn make() -> bool { true }
| ^^^^
@@ -76,7 +76,7 @@ error[E0308]: mismatched types
--> $DIR/defaults-specialization.rs:44:29
|
LL | default type Ty = bool;
- | ----------------------- expected this associated type
+ | ----------------------- associated type is `default` and may be overridden
LL |
LL | fn make() -> Self::Ty { true }
| -------- ^^^^ expected associated type, found `bool`
diff --git a/tests/ui/associated-types/defaults-suitability.stderr b/tests/ui/associated-types/defaults-suitability.stderr
index 4b2094691..0a8ad0f89 100644
--- a/tests/ui/associated-types/defaults-suitability.stderr
+++ b/tests/ui/associated-types/defaults-suitability.stderr
@@ -58,6 +58,11 @@ error[E0277]: the trait bound `(): Foo<Self>` is not satisfied
LL | type Assoc: Foo<Self> = ();
| ^^ the trait `Foo<Self>` is not implemented for `()`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/defaults-suitability.rs:27:1
+ |
+LL | trait Foo<T> {
+ | ^^^^^^^^^^^^
note: required by a bound in `Bar::Assoc`
--> $DIR/defaults-suitability.rs:34:17
|
diff --git a/tests/ui/associated-types/issue-23595-2.stderr b/tests/ui/associated-types/issue-23595-2.stderr
index dded673f6..73effa9f9 100644
--- a/tests/ui/associated-types/issue-23595-2.stderr
+++ b/tests/ui/associated-types/issue-23595-2.stderr
@@ -2,7 +2,7 @@ error[E0220]: associated type `anything_here_kills_it` not found for `Self`
--> $DIR/issue-23595-2.rs:6:22
|
LL | type B = C<Self::anything_here_kills_it>;
- | ^^^^^^^^^^^^^^^^^^^^^^ associated type `anything_here_kills_it` not found
+ | ^^^^^^^^^^^^^^^^^^^^^^ help: `Self` has the following associated type: `B`
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-32323.rs b/tests/ui/associated-types/issue-32323.rs
index 5078f5523..5078f5523 100644
--- a/tests/ui/issues/issue-32323.rs
+++ b/tests/ui/associated-types/issue-32323.rs
diff --git a/tests/ui/issues/issue-32323.stderr b/tests/ui/associated-types/issue-32323.stderr
index 8212c607e..8212c607e 100644
--- a/tests/ui/issues/issue-32323.stderr
+++ b/tests/ui/associated-types/issue-32323.stderr
diff --git a/tests/ui/associated-types/issue-44153.stderr b/tests/ui/associated-types/issue-44153.stderr
index 8bddcd955..73365d64d 100644
--- a/tests/ui/associated-types/issue-44153.stderr
+++ b/tests/ui/associated-types/issue-44153.stderr
@@ -1,8 +1,8 @@
error[E0271]: type mismatch resolving `<() as Array>::Element == &()`
- --> $DIR/issue-44153.rs:18:5
+ --> $DIR/issue-44153.rs:18:6
|
LL | <() as Visit>::visit();
- | ^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<() as Array>::Element == &()`
+ | ^^ type mismatch resolving `<() as Array>::Element == &()`
|
note: expected this to be `&()`
--> $DIR/issue-44153.rs:10:20
diff --git a/tests/ui/associated-types/issue-59324.stderr b/tests/ui/associated-types/issue-59324.stderr
index a84b599b5..266e22d47 100644
--- a/tests/ui/associated-types/issue-59324.stderr
+++ b/tests/ui/associated-types/issue-59324.stderr
@@ -48,6 +48,12 @@ error[E0277]: the trait bound `(): Foo` is not satisfied
|
LL | fn with_factory<H>(factory: dyn ThriftService<()>) {}
| ^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `()`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-59324.rs:3:1
+ |
+LL | pub trait Foo: NotFoo {
+ | ^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Bug: Foo` is not satisfied
--> $DIR/issue-59324.rs:19:10
diff --git a/tests/ui/associated-types/issue-64855.stderr b/tests/ui/associated-types/issue-64855.stderr
index 6ad795c11..f1016f0e3 100644
--- a/tests/ui/associated-types/issue-64855.stderr
+++ b/tests/ui/associated-types/issue-64855.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `Bar<T>: Foo` is not satisfied
|
LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
| ^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `Bar<T>`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-64855.rs:1:1
+ |
+LL | pub trait Foo {
+ | ^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/associated-types/issue-85103-layout-debug.rs b/tests/ui/associated-types/issue-85103-layout-debug.rs
new file mode 100644
index 000000000..77c9876ff
--- /dev/null
+++ b/tests/ui/associated-types/issue-85103-layout-debug.rs
@@ -0,0 +1,9 @@
+#![feature(rustc_attrs)]
+
+use std::borrow::Cow;
+
+#[rustc_layout(debug)]
+type Edges<'a, E> = Cow<'a, [E]>;
+//~^ the trait bound `[E]: ToOwned` is not satisfied
+
+fn main() {}
diff --git a/tests/ui/associated-types/issue-85103-layout-debug.stderr b/tests/ui/associated-types/issue-85103-layout-debug.stderr
new file mode 100644
index 000000000..0bdea10ba
--- /dev/null
+++ b/tests/ui/associated-types/issue-85103-layout-debug.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `[E]: ToOwned` is not satisfied
+ --> $DIR/issue-85103-layout-debug.rs:6:21
+ |
+LL | type Edges<'a, E> = Cow<'a, [E]>;
+ | ^^^^^^^^^^^^ the trait `ToOwned` is not implemented for `[E]`
+ |
+note: required by a bound in `Cow`
+ --> $SRC_DIR/alloc/src/borrow.rs:LL:COL
+help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
+ |
+LL | type Edges<'a, E> where [E]: ToOwned = Cow<'a, [E]>;
+ | ++++++++++++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/associated-types/issue-85103.rs b/tests/ui/associated-types/issue-85103.rs
deleted file mode 100644
index 9c6a419e9..000000000
--- a/tests/ui/associated-types/issue-85103.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-#![feature(rustc_attrs)]
-
-use std::borrow::Cow;
-
-#[rustc_layout(debug)]
-type Edges<'a, E> = Cow<'a, [E]>;
-//~^ 6:1: 6:18: unable to determine layout for `<[E] as ToOwned>::Owned` because `<[E] as ToOwned>::Owned` cannot be normalized
-
-fn main() {}
diff --git a/tests/ui/associated-types/issue-85103.stderr b/tests/ui/associated-types/issue-85103.stderr
deleted file mode 100644
index 17f714807..000000000
--- a/tests/ui/associated-types/issue-85103.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: unable to determine layout for `<[E] as ToOwned>::Owned` because `<[E] as ToOwned>::Owned` cannot be normalized
- --> $DIR/issue-85103.rs:6:1
- |
-LL | type Edges<'a, E> = Cow<'a, [E]>;
- | ^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/associated-types/point-at-type-on-obligation-failure-2.stderr b/tests/ui/associated-types/point-at-type-on-obligation-failure-2.stderr
index 3b4689e08..056d9201b 100644
--- a/tests/ui/associated-types/point-at-type-on-obligation-failure-2.stderr
+++ b/tests/ui/associated-types/point-at-type-on-obligation-failure-2.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `bool: Bar` is not satisfied
LL | type Assoc = bool;
| ^^^^ the trait `Bar` is not implemented for `bool`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/point-at-type-on-obligation-failure-2.rs:1:1
+ |
+LL | trait Bar {}
+ | ^^^^^^^^^
note: required by a bound in `Foo::Assoc`
--> $DIR/point-at-type-on-obligation-failure-2.rs:4:17
|
@@ -16,6 +21,11 @@ error[E0277]: the trait bound `bool: Bar` is not satisfied
LL | type Assoc = bool;
| ^^^^ the trait `Bar` is not implemented for `bool`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/point-at-type-on-obligation-failure-2.rs:1:1
+ |
+LL | trait Bar {}
+ | ^^^^^^^^^
note: required by a bound in `Baz::Assoc`
--> $DIR/point-at-type-on-obligation-failure-2.rs:13:18
|
@@ -31,6 +41,11 @@ error[E0277]: the trait bound `bool: Bar` is not satisfied
LL | type Assoc = bool;
| ^^^^ the trait `Bar` is not implemented for `bool`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/point-at-type-on-obligation-failure-2.rs:1:1
+ |
+LL | trait Bar {}
+ | ^^^^^^^^^
note: required by a bound in `Bat::Assoc`
--> $DIR/point-at-type-on-obligation-failure-2.rs:24:27
|
diff --git a/tests/ui/associated-types/substs-ppaux.normal.stderr b/tests/ui/associated-types/substs-ppaux.normal.stderr
index acdc3be8c..015b22f79 100644
--- a/tests/ui/associated-types/substs-ppaux.normal.stderr
+++ b/tests/ui/associated-types/substs-ppaux.normal.stderr
@@ -71,10 +71,10 @@ LL | let x: () = foo::<'static>();
| ++
error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/substs-ppaux.rs:49:5
+ --> $DIR/substs-ppaux.rs:49:6
|
LL | <str as Foo<u8>>::bar;
- | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ | ^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `str`
note: required for `str` to implement `Foo<'_, '_, u8>`
diff --git a/tests/ui/associated-types/substs-ppaux.verbose.stderr b/tests/ui/associated-types/substs-ppaux.verbose.stderr
index ad67899e6..484581b10 100644
--- a/tests/ui/associated-types/substs-ppaux.verbose.stderr
+++ b/tests/ui/associated-types/substs-ppaux.verbose.stderr
@@ -71,10 +71,10 @@ LL | let x: () = foo::<'static>();
| ++
error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/substs-ppaux.rs:49:5
+ --> $DIR/substs-ppaux.rs:49:6
|
LL | <str as Foo<u8>>::bar;
- | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ | ^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `str`
note: required for `str` to implement `Foo<'?0, '?1, u8>`
diff --git a/tests/ui/async-await/async-await-let-else.drop-tracking.stderr b/tests/ui/async-await/async-await-let-else.drop-tracking.stderr
deleted file mode 100644
index fb83ca90a..000000000
--- a/tests/ui/async-await/async-await-let-else.drop-tracking.stderr
+++ /dev/null
@@ -1,106 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/async-await-let-else.rs:48:13
- |
-LL | is_send(foo(Some(true)));
- | ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:11:14
- |
-LL | let r = Rc::new(());
- | - has type `Rc<()>` which is not `Send`
-LL | bar().await
- | ^^^^^^ await occurs here, with `r` maybe used later
-LL | };
- | - `r` is later dropped here
-note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
- |
-LL | fn is_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `is_send`
-
-error[E0277]: `Rc<()>` cannot be sent between threads safely
- --> $DIR/async-await-let-else.rs:50:13
- |
-LL | async fn foo2(x: Option<bool>) {
- | - within this `impl Future<Output = ()>`
-...
-LL | is_send(foo2(Some(true)));
- | ------- ^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely
- | |
- | required by a bound introduced by this call
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
-note: required because it's used within this `async fn` body
- --> $DIR/async-await-let-else.rs:27:29
- |
-LL | async fn bar2<T>(_: T) -> ! {
- | _____________________________^
-LL | | panic!()
-LL | | }
- | |_^
- = note: required because it captures the following types: `ResumeTy`, `Option<bool>`, `impl Future<Output = !>`, `()`
-note: required because it's used within this `async fn` body
- --> $DIR/async-await-let-else.rs:21:32
- |
-LL | async fn foo2(x: Option<bool>) {
- | ________________________________^
-LL | | let Some(_) = x else {
-LL | | bar2(Rc::new(())).await
-LL | | };
-LL | | }
- | |_^
-note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
- |
-LL | fn is_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `is_send`
-
-error: future cannot be sent between threads safely
- --> $DIR/async-await-let-else.rs:52:13
- |
-LL | is_send(foo3(Some(true)));
- | ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:33:28
- |
-LL | (Rc::new(()), bar().await);
- | ----------- ^^^^^^ - `Rc::new(())` is later dropped here
- | | |
- | | await occurs here, with `Rc::new(())` maybe used later
- | has type `Rc<()>` which is not `Send`
-note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
- |
-LL | fn is_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `is_send`
-
-error: future cannot be sent between threads safely
- --> $DIR/async-await-let-else.rs:54:13
- |
-LL | is_send(foo4(Some(true)));
- | ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:41:14
- |
-LL | let r = Rc::new(());
- | - has type `Rc<()>` which is not `Send`
-LL | bar().await;
- | ^^^^^^ await occurs here, with `r` maybe used later
-...
-LL | };
- | - `r` is later dropped here
-note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
- |
-LL | fn is_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `is_send`
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/async-await-let-else.drop_tracking.stderr b/tests/ui/async-await/async-await-let-else.drop_tracking.stderr
deleted file mode 100644
index dee90262f..000000000
--- a/tests/ui/async-await/async-await-let-else.drop_tracking.stderr
+++ /dev/null
@@ -1,106 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/async-await-let-else.rs:48:13
- |
-LL | is_send(foo(Some(true)));
- | ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:11:15
- |
-LL | let r = Rc::new(());
- | - has type `Rc<()>` which is not `Send`
-LL | bar().await
- | ^^^^^ await occurs here, with `r` maybe used later
-LL | };
- | - `r` is later dropped here
-note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
- |
-LL | fn is_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `is_send`
-
-error[E0277]: `Rc<()>` cannot be sent between threads safely
- --> $DIR/async-await-let-else.rs:50:13
- |
-LL | async fn foo2(x: Option<bool>) {
- | - within this `impl Future<Output = ()>`
-...
-LL | is_send(foo2(Some(true)));
- | ------- ^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely
- | |
- | required by a bound introduced by this call
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
-note: required because it's used within this `async fn` body
- --> $DIR/async-await-let-else.rs:27:29
- |
-LL | async fn bar2<T>(_: T) -> ! {
- | _____________________________^
-LL | | panic!()
-LL | | }
- | |_^
- = note: required because it captures the following types: `ResumeTy`, `Option<bool>`, `impl Future<Output = !>`, `()`
-note: required because it's used within this `async fn` body
- --> $DIR/async-await-let-else.rs:21:32
- |
-LL | async fn foo2(x: Option<bool>) {
- | ________________________________^
-LL | | let Some(_) = x else {
-LL | | bar2(Rc::new(())).await
-LL | | };
-LL | | }
- | |_^
-note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
- |
-LL | fn is_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `is_send`
-
-error: future cannot be sent between threads safely
- --> $DIR/async-await-let-else.rs:52:13
- |
-LL | is_send(foo3(Some(true)));
- | ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:33:29
- |
-LL | (Rc::new(()), bar().await);
- | ----------- ^^^^^ - `Rc::new(())` is later dropped here
- | | |
- | | await occurs here, with `Rc::new(())` maybe used later
- | has type `Rc<()>` which is not `Send`
-note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
- |
-LL | fn is_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `is_send`
-
-error: future cannot be sent between threads safely
- --> $DIR/async-await-let-else.rs:54:13
- |
-LL | is_send(foo4(Some(true)));
- | ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:41:15
- |
-LL | let r = Rc::new(());
- | - has type `Rc<()>` which is not `Send`
-LL | bar().await;
- | ^^^^^ await occurs here, with `r` maybe used later
-...
-LL | };
- | - `r` is later dropped here
-note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
- |
-LL | fn is_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `is_send`
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/async-await-let-else.no-drop-tracking.stderr b/tests/ui/async-await/async-await-let-else.no-drop-tracking.stderr
deleted file mode 100644
index d3c5e80a3..000000000
--- a/tests/ui/async-await/async-await-let-else.no-drop-tracking.stderr
+++ /dev/null
@@ -1,90 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/async-await-let-else.rs:48:13
- |
-LL | is_send(foo(Some(true)));
- | ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:11:14
- |
-LL | let r = Rc::new(());
- | - has type `Rc<()>` which is not `Send`
-LL | bar().await
- | ^^^^^^ await occurs here, with `r` maybe used later
-LL | };
- | - `r` is later dropped here
-note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
- |
-LL | fn is_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `is_send`
-
-error: future cannot be sent between threads safely
- --> $DIR/async-await-let-else.rs:50:13
- |
-LL | is_send(foo2(Some(true)));
- | ^^^^^^^^^^^^^^^^ future returned by `foo2` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:23:26
- |
-LL | bar2(Rc::new(())).await
- | ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later
- | |
- | has type `Rc<()>` which is not `Send`
-LL | };
- | - `Rc::new(())` is later dropped here
-note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
- |
-LL | fn is_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `is_send`
-
-error: future cannot be sent between threads safely
- --> $DIR/async-await-let-else.rs:52:13
- |
-LL | is_send(foo3(Some(true)));
- | ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:33:28
- |
-LL | (Rc::new(()), bar().await);
- | ----------- ^^^^^^ - `Rc::new(())` is later dropped here
- | | |
- | | await occurs here, with `Rc::new(())` maybe used later
- | has type `Rc<()>` which is not `Send`
-note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
- |
-LL | fn is_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `is_send`
-
-error: future cannot be sent between threads safely
- --> $DIR/async-await-let-else.rs:54:13
- |
-LL | is_send(foo4(Some(true)));
- | ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:41:14
- |
-LL | let r = Rc::new(());
- | - has type `Rc<()>` which is not `Send`
-LL | bar().await;
- | ^^^^^^ await occurs here, with `r` maybe used later
-...
-LL | };
- | - `r` is later dropped here
-note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
- |
-LL | fn is_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `is_send`
-
-error: aborting due to 4 previous errors
-
diff --git a/tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr b/tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr
deleted file mode 100644
index ece4e51ec..000000000
--- a/tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr
+++ /dev/null
@@ -1,90 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/async-await-let-else.rs:48:13
- |
-LL | is_send(foo(Some(true)));
- | ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:11:15
- |
-LL | let r = Rc::new(());
- | - has type `Rc<()>` which is not `Send`
-LL | bar().await
- | ^^^^^ await occurs here, with `r` maybe used later
-LL | };
- | - `r` is later dropped here
-note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
- |
-LL | fn is_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `is_send`
-
-error: future cannot be sent between threads safely
- --> $DIR/async-await-let-else.rs:50:13
- |
-LL | is_send(foo2(Some(true)));
- | ^^^^^^^^^^^^^^^^ future returned by `foo2` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:23:27
- |
-LL | bar2(Rc::new(())).await
- | ----------- ^^^^^ await occurs here, with `Rc::new(())` maybe used later
- | |
- | has type `Rc<()>` which is not `Send`
-LL | };
- | - `Rc::new(())` is later dropped here
-note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
- |
-LL | fn is_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `is_send`
-
-error: future cannot be sent between threads safely
- --> $DIR/async-await-let-else.rs:52:13
- |
-LL | is_send(foo3(Some(true)));
- | ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:33:29
- |
-LL | (Rc::new(()), bar().await);
- | ----------- ^^^^^ - `Rc::new(())` is later dropped here
- | | |
- | | await occurs here, with `Rc::new(())` maybe used later
- | has type `Rc<()>` which is not `Send`
-note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
- |
-LL | fn is_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `is_send`
-
-error: future cannot be sent between threads safely
- --> $DIR/async-await-let-else.rs:54:13
- |
-LL | is_send(foo4(Some(true)));
- | ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:41:15
- |
-LL | let r = Rc::new(());
- | - has type `Rc<()>` which is not `Send`
-LL | bar().await;
- | ^^^^^ await occurs here, with `r` maybe used later
-...
-LL | };
- | - `r` is later dropped here
-note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
- |
-LL | fn is_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `is_send`
-
-error: aborting due to 4 previous errors
-
diff --git a/tests/ui/async-await/async-await-let-else.rs b/tests/ui/async-await/async-await-let-else.rs
index 113d576b5..a3c722605 100644
--- a/tests/ui/async-await/async-await-let-else.rs
+++ b/tests/ui/async-await/async-await-let-else.rs
@@ -1,7 +1,4 @@
// edition:2021
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
use std::rc::Rc;
diff --git a/tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr b/tests/ui/async-await/async-await-let-else.stderr
index e3fcceaa3..9a1c17822 100644
--- a/tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/async-await-let-else.stderr
@@ -1,25 +1,25 @@
error: future cannot be sent between threads safely
- --> $DIR/async-await-let-else.rs:48:13
+ --> $DIR/async-await-let-else.rs:45:13
|
LL | is_send(foo(Some(true)));
| ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:11:15
+ --> $DIR/async-await-let-else.rs:8:15
|
LL | let r = Rc::new(());
| - has type `Rc<()>` which is not `Send`
LL | bar().await
| ^^^^^ await occurs here, with `r` maybe used later
note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
+ --> $DIR/async-await-let-else.rs:16:15
|
LL | fn is_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `is_send`
error[E0277]: `Rc<()>` cannot be sent between threads safely
- --> $DIR/async-await-let-else.rs:50:13
+ --> $DIR/async-await-let-else.rs:47:13
|
LL | async fn foo2(x: Option<bool>) {
| - within this `impl Future<Output = ()>`
@@ -31,7 +31,7 @@ LL | is_send(foo2(Some(true)));
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: required because it's used within this `async fn` body
- --> $DIR/async-await-let-else.rs:27:29
+ --> $DIR/async-await-let-else.rs:24:29
|
LL | async fn bar2<T>(_: T) -> ! {
| _____________________________^
@@ -40,7 +40,7 @@ LL | | }
| |_^
= note: required because it captures the following types: `impl Future<Output = !>`
note: required because it's used within this `async fn` body
- --> $DIR/async-await-let-else.rs:21:32
+ --> $DIR/async-await-let-else.rs:18:32
|
LL | async fn foo2(x: Option<bool>) {
| ________________________________^
@@ -50,47 +50,47 @@ LL | | };
LL | | }
| |_^
note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
+ --> $DIR/async-await-let-else.rs:16:15
|
LL | fn is_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `is_send`
error: future cannot be sent between threads safely
- --> $DIR/async-await-let-else.rs:52:13
+ --> $DIR/async-await-let-else.rs:49:13
|
LL | is_send(foo3(Some(true)));
| ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:33:29
+ --> $DIR/async-await-let-else.rs:30:29
|
LL | (Rc::new(()), bar().await);
| ----------- ^^^^^ await occurs here, with `Rc::new(())` maybe used later
| |
| has type `Rc<()>` which is not `Send`
note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
+ --> $DIR/async-await-let-else.rs:16:15
|
LL | fn is_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `is_send`
error: future cannot be sent between threads safely
- --> $DIR/async-await-let-else.rs:54:13
+ --> $DIR/async-await-let-else.rs:51:13
|
LL | is_send(foo4(Some(true)));
| ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:41:15
+ --> $DIR/async-await-let-else.rs:38:15
|
LL | let r = Rc::new(());
| - has type `Rc<()>` which is not `Send`
LL | bar().await;
| ^^^^^ await occurs here, with `r` maybe used later
note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
+ --> $DIR/async-await-let-else.rs:16:15
|
LL | fn is_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `is_send`
diff --git a/tests/ui/async-await/async-block-control-flow-static-semantics.stderr b/tests/ui/async-await/async-block-control-flow-static-semantics.stderr
index bbd5a822d..c89671cc4 100644
--- a/tests/ui/async-await/async-block-control-flow-static-semantics.stderr
+++ b/tests/ui/async-await/async-block-control-flow-static-semantics.stderr
@@ -29,13 +29,13 @@ LL | |
LL | | }
| |_^ expected `u8`, found `()`
-error[E0271]: expected `[async block@$DIR/async-block-control-flow-static-semantics.rs:23:17: 25:6]` to be a future that resolves to `()`, but it resolves to `u8`
+error[E0271]: expected `{async block@$DIR/async-block-control-flow-static-semantics.rs:23:17: 25:6}` to be a future that resolves to `()`, but it resolves to `u8`
--> $DIR/async-block-control-flow-static-semantics.rs:26:39
|
LL | let _: &dyn Future<Output = ()> = &block;
| ^^^^^^ expected `()`, found `u8`
|
- = note: required for the cast from `&[async block@$DIR/async-block-control-flow-static-semantics.rs:23:17: 25:6]` to `&dyn Future<Output = ()>`
+ = note: required for the cast from `&{async block@$DIR/async-block-control-flow-static-semantics.rs:23:17: 25:6}` to `&dyn Future<Output = ()>`
error[E0308]: mismatched types
--> $DIR/async-block-control-flow-static-semantics.rs:12:43
@@ -45,13 +45,13 @@ LL | fn return_targets_async_block_not_fn() -> u8 {
| |
| implicitly returns `()` as its body has no tail or `return` expression
-error[E0271]: expected `[async block@$DIR/async-block-control-flow-static-semantics.rs:14:17: 16:6]` to be a future that resolves to `()`, but it resolves to `u8`
+error[E0271]: expected `{async block@$DIR/async-block-control-flow-static-semantics.rs:14:17: 16:6}` to be a future that resolves to `()`, but it resolves to `u8`
--> $DIR/async-block-control-flow-static-semantics.rs:17:39
|
LL | let _: &dyn Future<Output = ()> = &block;
| ^^^^^^ expected `()`, found `u8`
|
- = note: required for the cast from `&[async block@$DIR/async-block-control-flow-static-semantics.rs:14:17: 16:6]` to `&dyn Future<Output = ()>`
+ = note: required for the cast from `&{async block@$DIR/async-block-control-flow-static-semantics.rs:14:17: 16:6}` to `&dyn Future<Output = ()>`
error[E0308]: mismatched types
--> $DIR/async-block-control-flow-static-semantics.rs:49:44
diff --git a/tests/ui/async-await/async-error-span.drop_tracking.stderr b/tests/ui/async-await/async-error-span.drop_tracking.stderr
deleted file mode 100644
index 99a674a26..000000000
--- a/tests/ui/async-await/async-error-span.drop_tracking.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error[E0277]: `()` is not a future
- --> $DIR/async-error-span.rs:10:20
- |
-LL | fn get_future() -> impl Future<Output = ()> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future
- |
- = help: the trait `Future` is not implemented for `()`
- = note: () must be a future or must implement `IntoFuture` to be awaited
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/async-error-span.rs:16:9
- |
-LL | let a;
- | ^ cannot infer type
- |
-note: the type is part of the `async fn` body because of this `await`
- --> $DIR/async-error-span.rs:19:18
- |
-LL | get_future().await;
- | ^^^^^
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0277, E0698.
-For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/async-error-span.no_drop_tracking.stderr b/tests/ui/async-await/async-error-span.no_drop_tracking.stderr
deleted file mode 100644
index 99a674a26..000000000
--- a/tests/ui/async-await/async-error-span.no_drop_tracking.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error[E0277]: `()` is not a future
- --> $DIR/async-error-span.rs:10:20
- |
-LL | fn get_future() -> impl Future<Output = ()> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future
- |
- = help: the trait `Future` is not implemented for `()`
- = note: () must be a future or must implement `IntoFuture` to be awaited
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/async-error-span.rs:16:9
- |
-LL | let a;
- | ^ cannot infer type
- |
-note: the type is part of the `async fn` body because of this `await`
- --> $DIR/async-error-span.rs:19:18
- |
-LL | get_future().await;
- | ^^^^^
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0277, E0698.
-For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/async-error-span.rs b/tests/ui/async-await/async-error-span.rs
index c9ecf359e..c8127df62 100644
--- a/tests/ui/async-await/async-error-span.rs
+++ b/tests/ui/async-await/async-error-span.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
// Regression test for issue #62382.
@@ -13,9 +10,7 @@ fn get_future() -> impl Future<Output = ()> {
}
async fn foo() {
- let a;
- //[no_drop_tracking,drop_tracking]~^ ERROR type inside `async fn` body must be known in this context
- //[drop_tracking_mir]~^^ ERROR type annotations needed
+ let a; //~ ERROR type annotations needed
get_future().await;
}
diff --git a/tests/ui/async-await/async-error-span.drop_tracking_mir.stderr b/tests/ui/async-await/async-error-span.stderr
index 2f29ee6cd..2ec968ffc 100644
--- a/tests/ui/async-await/async-error-span.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/async-error-span.stderr
@@ -1,5 +1,5 @@
error[E0277]: `()` is not a future
- --> $DIR/async-error-span.rs:10:20
+ --> $DIR/async-error-span.rs:7:20
|
LL | fn get_future() -> impl Future<Output = ()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future
@@ -8,7 +8,7 @@ LL | fn get_future() -> impl Future<Output = ()> {
= note: () must be a future or must implement `IntoFuture` to be awaited
error[E0282]: type annotations needed
- --> $DIR/async-error-span.rs:16:9
+ --> $DIR/async-error-span.rs:13:9
|
LL | let a;
| ^
diff --git a/tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr b/tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr
deleted file mode 100644
index 0515edaed..000000000
--- a/tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr
+++ /dev/null
@@ -1,49 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/async-fn-nonsend.rs:72:17
- |
-LL | assert_send(non_send_temporary_in_match());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/async-fn-nonsend.rs:36:26
- |
-LL | match Some(non_send()) {
- | ---------------- has type `Option<impl Debug>` which is not `Send`
-LL | Some(_) => fut().await,
- | ^^^^^ await occurs here, with `Some(non_send())` maybe used later
-...
-LL | }
- | - `Some(non_send())` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/async-fn-nonsend.rs:67:24
- |
-LL | fn assert_send(_: impl Send) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: future cannot be sent between threads safely
- --> $DIR/async-fn-nonsend.rs:74:17
- |
-LL | assert_send(non_sync_with_method_call());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
-note: future is not `Send` as this value is used across an await
- --> $DIR/async-fn-nonsend.rs:49:15
- |
-LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
- | --------------- has type `Formatter<'_>` which is not `Send`
-...
-LL | fut().await;
- | ^^^^^ await occurs here, with `get_formatter()` maybe used later
-LL | }
-LL | }
- | - `get_formatter()` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/async-fn-nonsend.rs:67:24
- |
-LL | fn assert_send(_: impl Send) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr b/tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr
deleted file mode 100644
index b29d2e192..000000000
--- a/tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr
+++ /dev/null
@@ -1,120 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/async-fn-nonsend.rs:70:17
- |
-LL | assert_send(local_dropped_before_await());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `local_dropped_before_await` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/async-fn-nonsend.rs:27:11
- |
-LL | let x = non_send();
- | - has type `impl Debug` which is not `Send`
-LL | drop(x);
-LL | fut().await;
- | ^^^^^ await occurs here, with `x` maybe used later
-LL | }
- | - `x` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/async-fn-nonsend.rs:67:24
- |
-LL | fn assert_send(_: impl Send) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: future cannot be sent between threads safely
- --> $DIR/async-fn-nonsend.rs:72:17
- |
-LL | assert_send(non_send_temporary_in_match());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/async-fn-nonsend.rs:36:26
- |
-LL | match Some(non_send()) {
- | ---------- has type `impl Debug` which is not `Send`
-LL | Some(_) => fut().await,
- | ^^^^^ await occurs here, with `non_send()` maybe used later
-...
-LL | }
- | - `non_send()` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/async-fn-nonsend.rs:67:24
- |
-LL | fn assert_send(_: impl Send) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: future cannot be sent between threads safely
- --> $DIR/async-fn-nonsend.rs:74:17
- |
-LL | assert_send(non_sync_with_method_call());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
-note: future is not `Send` as this value is used across an await
- --> $DIR/async-fn-nonsend.rs:49:15
- |
-LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
- | --------------- has type `Formatter<'_>` which is not `Send`
-...
-LL | fut().await;
- | ^^^^^ await occurs here, with `get_formatter()` maybe used later
-LL | }
-LL | }
- | - `get_formatter()` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/async-fn-nonsend.rs:67:24
- |
-LL | fn assert_send(_: impl Send) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: future cannot be sent between threads safely
- --> $DIR/async-fn-nonsend.rs:76:17
- |
-LL | assert_send(non_sync_with_method_call_panic());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call_panic` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
-note: future is not `Send` as this value is used across an await
- --> $DIR/async-fn-nonsend.rs:56:15
- |
-LL | let f: &mut std::fmt::Formatter = panic!();
- | - has type `&mut Formatter<'_>` which is not `Send`
-LL | if non_sync().fmt(f).unwrap() == () {
-LL | fut().await;
- | ^^^^^ await occurs here, with `f` maybe used later
-LL | }
-LL | }
- | - `f` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/async-fn-nonsend.rs:67:24
- |
-LL | fn assert_send(_: impl Send) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: future cannot be sent between threads safely
- --> $DIR/async-fn-nonsend.rs:78:17
- |
-LL | assert_send(non_sync_with_method_call_infinite_loop());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call_infinite_loop` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
-note: future is not `Send` as this value is used across an await
- --> $DIR/async-fn-nonsend.rs:63:15
- |
-LL | let f: &mut std::fmt::Formatter = loop {};
- | - has type `&mut Formatter<'_>` which is not `Send`
-LL | if non_sync().fmt(f).unwrap() == () {
-LL | fut().await;
- | ^^^^^ await occurs here, with `f` maybe used later
-LL | }
-LL | }
- | - `f` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/async-fn-nonsend.rs:67:24
- |
-LL | fn assert_send(_: impl Send) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to 5 previous errors
-
diff --git a/tests/ui/async-await/async-fn-nonsend.rs b/tests/ui/async-await/async-fn-nonsend.rs
index ed440bd01..c5453b67e 100644
--- a/tests/ui/async-await/async-fn-nonsend.rs
+++ b/tests/ui/async-await/async-fn-nonsend.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
// compile-flags: --crate-type lib
@@ -68,13 +65,10 @@ fn assert_send(_: impl Send) {}
pub fn pass_assert() {
assert_send(local_dropped_before_await());
- //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
assert_send(non_send_temporary_in_match());
//~^ ERROR future cannot be sent between threads safely
assert_send(non_sync_with_method_call());
//~^ ERROR future cannot be sent between threads safely
assert_send(non_sync_with_method_call_panic());
- //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
assert_send(non_sync_with_method_call_infinite_loop());
- //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
}
diff --git a/tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr b/tests/ui/async-await/async-fn-nonsend.stderr
index 219945e09..0ced6c36f 100644
--- a/tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/async-fn-nonsend.stderr
@@ -1,32 +1,32 @@
error: future cannot be sent between threads safely
- --> $DIR/async-fn-nonsend.rs:72:17
+ --> $DIR/async-fn-nonsend.rs:68:17
|
LL | assert_send(non_send_temporary_in_match());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-fn-nonsend.rs:36:26
+ --> $DIR/async-fn-nonsend.rs:33:26
|
LL | match Some(non_send()) {
| ---------------- has type `Option<impl Debug>` which is not `Send`
LL | Some(_) => fut().await,
| ^^^^^ await occurs here, with `Some(non_send())` maybe used later
note: required by a bound in `assert_send`
- --> $DIR/async-fn-nonsend.rs:67:24
+ --> $DIR/async-fn-nonsend.rs:64:24
|
LL | fn assert_send(_: impl Send) {}
| ^^^^ required by this bound in `assert_send`
error: future cannot be sent between threads safely
- --> $DIR/async-fn-nonsend.rs:74:17
+ --> $DIR/async-fn-nonsend.rs:70:17
|
LL | assert_send(non_sync_with_method_call());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-fn-nonsend.rs:49:15
+ --> $DIR/async-fn-nonsend.rs:46:15
|
LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
| --------------- has type `Formatter<'_>` which is not `Send`
@@ -34,7 +34,7 @@ LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
LL | fut().await;
| ^^^^^ await occurs here, with `get_formatter()` maybe used later
note: required by a bound in `assert_send`
- --> $DIR/async-fn-nonsend.rs:67:24
+ --> $DIR/async-fn-nonsend.rs:64:24
|
LL | fn assert_send(_: impl Send) {}
| ^^^^ required by this bound in `assert_send`
diff --git a/tests/ui/async-await/async-is-unwindsafe.stderr b/tests/ui/async-await/async-is-unwindsafe.stderr
index 5d29325c8..eaa455380 100644
--- a/tests/ui/async-await/async-is-unwindsafe.stderr
+++ b/tests/ui/async-await/async-is-unwindsafe.stderr
@@ -1,21 +1,20 @@
error[E0277]: the type `&mut Context<'_>` may not be safely transferred across an unwind boundary
- --> $DIR/async-is-unwindsafe.rs:12:19
+ --> $DIR/async-is-unwindsafe.rs:12:5
|
LL | is_unwindsafe(async {
- | ___________________^
+ | _____^^^^^^^^^^^^^_-
+ | | |
+ | | `&mut Context<'_>` may not be safely transferred across an unwind boundary
LL | |
LL | | use std::ptr::null;
LL | | use std::task::{Context, RawWaker, RawWakerVTable, Waker};
... |
LL | | drop(cx_ref);
LL | | });
- | | ^
- | | |
- | |_____`&mut Context<'_>` may not be safely transferred across an unwind boundary
- | within this `[async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6]`
+ | |_____- within this `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}`
|
- = help: within `[async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6]`, the trait `UnwindSafe` is not implemented for `&mut Context<'_>`
- = note: `UnwindSafe` is implemented for `&std::task::Context<'_>`, but not for `&mut std::task::Context<'_>`
+ = help: within `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}`, the trait `UnwindSafe` is not implemented for `&mut Context<'_>`
+ = note: `UnwindSafe` is implemented for `&Context<'_>`, but not for `&mut Context<'_>`
note: future does not implement `UnwindSafe` as this value is used across an await
--> $DIR/async-is-unwindsafe.rs:25:18
|
@@ -24,9 +23,6 @@ LL | let cx_ref = &mut cx;
LL |
LL | async {}.await; // this needs an inner await point
| ^^^^^ await occurs here, with `cx_ref` maybe used later
-...
-LL | });
- | - `cx_ref` is later dropped here
note: required by a bound in `is_unwindsafe`
--> $DIR/async-is-unwindsafe.rs:3:26
|
diff --git a/tests/ui/async-await/await-sequence.rs b/tests/ui/async-await/await-sequence.rs
index 726c4284e..79f68dd60 100644
--- a/tests/ui/async-await/await-sequence.rs
+++ b/tests/ui/async-await/await-sequence.rs
@@ -1,5 +1,4 @@
// edition:2021
-// compile-flags: -Z drop-tracking
// build-pass
use std::collections::HashMap;
diff --git a/tests/ui/async-await/awaiting-unsized-param.rs b/tests/ui/async-await/awaiting-unsized-param.rs
new file mode 100644
index 000000000..e8b18bf37
--- /dev/null
+++ b/tests/ui/async-await/awaiting-unsized-param.rs
@@ -0,0 +1,13 @@
+// edition: 2021
+
+#![feature(unsized_fn_params, unsized_locals)]
+//~^ WARN the feature `unsized_locals` is incomplete
+
+use std::future::Future;
+
+async fn bug<T>(mut f: dyn Future<Output = T> + Unpin) -> T {
+ //~^ ERROR the size for values of type `(dyn Future<Output = T> + Unpin + 'static)` cannot be known at compilation time
+ (&mut f).await
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/awaiting-unsized-param.stderr b/tests/ui/async-await/awaiting-unsized-param.stderr
new file mode 100644
index 000000000..47a5dcebf
--- /dev/null
+++ b/tests/ui/async-await/awaiting-unsized-param.stderr
@@ -0,0 +1,21 @@
+warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/awaiting-unsized-param.rs:3:31
+ |
+LL | #![feature(unsized_fn_params, unsized_locals)]
+ | ^^^^^^^^^^^^^^
+ |
+ = note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error[E0277]: the size for values of type `(dyn Future<Output = T> + Unpin + 'static)` cannot be known at compilation time
+ --> $DIR/awaiting-unsized-param.rs:8:17
+ |
+LL | async fn bug<T>(mut f: dyn Future<Output = T> + Unpin) -> T {
+ | ^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `(dyn Future<Output = T> + Unpin + 'static)`
+ = note: all values captured by value by a closure must have a statically known size
+
+error: aborting due to previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/const-async-fn-in-main.rs b/tests/ui/async-await/const-async-fn-in-main.rs
new file mode 100644
index 000000000..5d1aa4d83
--- /dev/null
+++ b/tests/ui/async-await/const-async-fn-in-main.rs
@@ -0,0 +1,7 @@
+// edition:2021
+// Check what happens when a const async fn is in the main function (#102796)
+
+fn main() {
+ const async fn a() {}
+//~^ ERROR functions cannot be both `const` and `async`
+}
diff --git a/tests/ui/async-await/const-async-fn-in-main.stderr b/tests/ui/async-await/const-async-fn-in-main.stderr
new file mode 100644
index 000000000..10b151709
--- /dev/null
+++ b/tests/ui/async-await/const-async-fn-in-main.stderr
@@ -0,0 +1,11 @@
+error: functions cannot be both `const` and `async`
+ --> $DIR/const-async-fn-in-main.rs:5:5
+ |
+LL | const async fn a() {}
+ | ^^^^^-^^^^^----------
+ | | |
+ | | `async` because of this
+ | `const` because of this
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/default-struct-update.rs b/tests/ui/async-await/default-struct-update.rs
index daee8469a..f4757e7cb 100644
--- a/tests/ui/async-await/default-struct-update.rs
+++ b/tests/ui/async-await/default-struct-update.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// build-pass
// edition:2018
diff --git a/tests/ui/async-await/drop-and-assign.rs b/tests/ui/async-await/drop-and-assign.rs
index e520dfbdc..ef39033a9 100644
--- a/tests/ui/async-await/drop-and-assign.rs
+++ b/tests/ui/async-await/drop-and-assign.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2021
// build-pass
diff --git a/tests/ui/async-await/drop-track-bad-field-in-fru.rs b/tests/ui/async-await/drop-track-bad-field-in-fru.rs
index 28ad77675..667b288e6 100644
--- a/tests/ui/async-await/drop-track-bad-field-in-fru.rs
+++ b/tests/ui/async-await/drop-track-bad-field-in-fru.rs
@@ -1,4 +1,3 @@
-// compile-flags: -Zdrop-tracking
// edition: 2021
fn main() {}
diff --git a/tests/ui/async-await/drop-track-bad-field-in-fru.stderr b/tests/ui/async-await/drop-track-bad-field-in-fru.stderr
index b49b15db6..721e01062 100644
--- a/tests/ui/async-await/drop-track-bad-field-in-fru.stderr
+++ b/tests/ui/async-await/drop-track-bad-field-in-fru.stderr
@@ -1,5 +1,5 @@
error[E0559]: variant `Option<_>::None` has no field named `value`
- --> $DIR/drop-track-bad-field-in-fru.rs:7:12
+ --> $DIR/drop-track-bad-field-in-fru.rs:6:12
|
LL | None { value: (), ..Default::default() }.await;
| ^^^^^ `Option<_>::None` does not have this field
@@ -7,7 +7,7 @@ LL | None { value: (), ..Default::default() }.await;
= note: all struct fields are already assigned
error[E0277]: `Option<_>` is not a future
- --> $DIR/drop-track-bad-field-in-fru.rs:7:46
+ --> $DIR/drop-track-bad-field-in-fru.rs:6:46
|
LL | None { value: (), ..Default::default() }.await;
| -^^^^^
diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr
deleted file mode 100644
index 80402d842..000000000
--- a/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/drop-track-field-assign-nonsend.rs:45:17
- |
-LL | assert_send(agent.handle());
- | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/drop-track-field-assign-nonsend.rs:23:39
- |
-LL | let mut info = self.info_result.clone();
- | -------- has type `InfoResult` which is not `Send`
-...
-LL | let _ = send_element(element).await;
- | ^^^^^ await occurs here, with `mut info` maybe used later
-LL | }
- | - `mut info` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/drop-track-field-assign-nonsend.rs:40:19
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr
deleted file mode 100644
index 80402d842..000000000
--- a/tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/drop-track-field-assign-nonsend.rs:45:17
- |
-LL | assert_send(agent.handle());
- | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/drop-track-field-assign-nonsend.rs:23:39
- |
-LL | let mut info = self.info_result.clone();
- | -------- has type `InfoResult` which is not `Send`
-...
-LL | let _ = send_element(element).await;
- | ^^^^^ await occurs here, with `mut info` maybe used later
-LL | }
- | - `mut info` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/drop-track-field-assign-nonsend.rs:40:19
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.rs b/tests/ui/async-await/drop-track-field-assign-nonsend.rs
index 3e2228000..19315ef19 100644
--- a/tests/ui/async-await/drop-track-field-assign-nonsend.rs
+++ b/tests/ui/async-await/drop-track-field-assign-nonsend.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// Derived from an ICE found in tokio-xmpp during a crater run.
// edition:2021
diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.stderr
index d9141cf4e..6c235916d 100644
--- a/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/drop-track-field-assign-nonsend.stderr
@@ -1,12 +1,12 @@
error: future cannot be sent between threads safely
- --> $DIR/drop-track-field-assign-nonsend.rs:45:17
+ --> $DIR/drop-track-field-assign-nonsend.rs:42:17
|
LL | assert_send(agent.handle());
| ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
note: future is not `Send` as this value is used across an await
- --> $DIR/drop-track-field-assign-nonsend.rs:23:39
+ --> $DIR/drop-track-field-assign-nonsend.rs:20:39
|
LL | let mut info = self.info_result.clone();
| -------- has type `InfoResult` which is not `Send`
@@ -14,7 +14,7 @@ LL | let mut info = self.info_result.clone();
LL | let _ = send_element(element).await;
| ^^^^^ await occurs here, with `mut info` maybe used later
note: required by a bound in `assert_send`
- --> $DIR/drop-track-field-assign-nonsend.rs:40:19
+ --> $DIR/drop-track-field-assign-nonsend.rs:37:19
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
diff --git a/tests/ui/async-await/drop-track-field-assign.rs b/tests/ui/async-await/drop-track-field-assign.rs
index b79d2af06..4887eff7e 100644
--- a/tests/ui/async-await/drop-track-field-assign.rs
+++ b/tests/ui/async-await/drop-track-field-assign.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// Derived from an ICE found in tokio-xmpp during a crater run.
// edition:2021
// build-pass
diff --git a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.rs b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.rs
index 7f7294295..9f80b9c6e 100644
--- a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.rs
+++ b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.rs
@@ -1,4 +1,3 @@
-// compile-flags: -Zdrop-tracking
// incremental
// edition: 2021
@@ -99,8 +98,6 @@ fn main() {
send(async {
//~^ ERROR implementation of `FnOnce` is not general enough
//~| ERROR implementation of `FnOnce` is not general enough
- //~| ERROR implementation of `FnOnce` is not general enough
- //~| ERROR implementation of `FnOnce` is not general enough
Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await
});
}
diff --git a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr
index aa9a22e9e..cfb0ebe38 100644
--- a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr
+++ b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr
@@ -1,26 +1,9 @@
error: implementation of `FnOnce` is not general enough
- --> $DIR/drop-tracking-unresolved-typeck-results.rs:99:5
+ --> $DIR/drop-tracking-unresolved-typeck-results.rs:98:5
|
LL | / send(async {
LL | |
LL | |
-LL | |
-LL | |
-LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await
-LL | | });
- | |______^ implementation of `FnOnce` is not general enough
- |
- = note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`...
- = note: ...but it actually implements `FnOnce<(&(),)>`
-
-error: implementation of `FnOnce` is not general enough
- --> $DIR/drop-tracking-unresolved-typeck-results.rs:99:5
- |
-LL | / send(async {
-LL | |
-LL | |
-LL | |
-LL | |
LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await
LL | | });
| |______^ implementation of `FnOnce` is not general enough
@@ -29,28 +12,11 @@ LL | | });
= note: ...but it actually implements `FnOnce<(&(),)>`
error: implementation of `FnOnce` is not general enough
- --> $DIR/drop-tracking-unresolved-typeck-results.rs:99:5
+ --> $DIR/drop-tracking-unresolved-typeck-results.rs:98:5
|
LL | / send(async {
LL | |
LL | |
-LL | |
-LL | |
-LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await
-LL | | });
- | |______^ implementation of `FnOnce` is not general enough
- |
- = note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`...
- = note: ...but it actually implements `FnOnce<(&(),)>`
-
-error: implementation of `FnOnce` is not general enough
- --> $DIR/drop-tracking-unresolved-typeck-results.rs:99:5
- |
-LL | / send(async {
-LL | |
-LL | |
-LL | |
-LL | |
LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await
LL | | });
| |______^ implementation of `FnOnce` is not general enough
@@ -58,5 +24,5 @@ LL | | });
= note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`...
= note: ...but it actually implements `FnOnce<(&(),)>`
-error: aborting due to 4 previous errors
+error: aborting due to 2 previous errors
diff --git a/tests/ui/async-await/feature-self-return-type.rs b/tests/ui/async-await/feature-self-return-type.rs
index 41f887430..ae6f766d2 100644
--- a/tests/ui/async-await/feature-self-return-type.rs
+++ b/tests/ui/async-await/feature-self-return-type.rs
@@ -1,5 +1,4 @@
// edition:2018
-#![feature(impl_trait_projections)]
// This test checks that we emit the correct borrowck error when `Self` is used as a return type.
// See #61949 for context.
diff --git a/tests/ui/async-await/feature-self-return-type.stderr b/tests/ui/async-await/feature-self-return-type.stderr
index 747c54b66..dc160bfbf 100644
--- a/tests/ui/async-await/feature-self-return-type.stderr
+++ b/tests/ui/async-await/feature-self-return-type.stderr
@@ -1,5 +1,5 @@
error[E0597]: `bar` does not live long enough
- --> $DIR/feature-self-return-type.rs:22:18
+ --> $DIR/feature-self-return-type.rs:21:18
|
LL | let x = {
| - borrow later stored here
diff --git a/tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr b/tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr
deleted file mode 100644
index e2e64c9ae..000000000
--- a/tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/field-assign-nonsend.rs:45:17
- |
-LL | assert_send(agent.handle());
- | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/field-assign-nonsend.rs:23:39
- |
-LL | let mut info = self.info_result.clone();
- | -------- has type `InfoResult` which is not `Send`
-...
-LL | let _ = send_element(element).await;
- | ^^^^^ await occurs here, with `mut info` maybe used later
-LL | }
- | - `mut info` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/field-assign-nonsend.rs:40:19
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr b/tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr
deleted file mode 100644
index e2e64c9ae..000000000
--- a/tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/field-assign-nonsend.rs:45:17
- |
-LL | assert_send(agent.handle());
- | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/field-assign-nonsend.rs:23:39
- |
-LL | let mut info = self.info_result.clone();
- | -------- has type `InfoResult` which is not `Send`
-...
-LL | let _ = send_element(element).await;
- | ^^^^^ await occurs here, with `mut info` maybe used later
-LL | }
- | - `mut info` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/field-assign-nonsend.rs:40:19
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/field-assign-nonsend.rs b/tests/ui/async-await/field-assign-nonsend.rs
index 3e2228000..19315ef19 100644
--- a/tests/ui/async-await/field-assign-nonsend.rs
+++ b/tests/ui/async-await/field-assign-nonsend.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// Derived from an ICE found in tokio-xmpp during a crater run.
// edition:2021
diff --git a/tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr b/tests/ui/async-await/field-assign-nonsend.stderr
index d1df8e91a..3037d7024 100644
--- a/tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/field-assign-nonsend.stderr
@@ -1,12 +1,12 @@
error: future cannot be sent between threads safely
- --> $DIR/field-assign-nonsend.rs:45:17
+ --> $DIR/field-assign-nonsend.rs:42:17
|
LL | assert_send(agent.handle());
| ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
note: future is not `Send` as this value is used across an await
- --> $DIR/field-assign-nonsend.rs:23:39
+ --> $DIR/field-assign-nonsend.rs:20:39
|
LL | let mut info = self.info_result.clone();
| -------- has type `InfoResult` which is not `Send`
@@ -14,7 +14,7 @@ LL | let mut info = self.info_result.clone();
LL | let _ = send_element(element).await;
| ^^^^^ await occurs here, with `mut info` maybe used later
note: required by a bound in `assert_send`
- --> $DIR/field-assign-nonsend.rs:40:19
+ --> $DIR/field-assign-nonsend.rs:37:19
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
diff --git a/tests/ui/async-await/field-assign.rs b/tests/ui/async-await/field-assign.rs
index b79d2af06..4887eff7e 100644
--- a/tests/ui/async-await/field-assign.rs
+++ b/tests/ui/async-await/field-assign.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// Derived from an ICE found in tokio-xmpp during a crater run.
// edition:2021
// build-pass
diff --git a/tests/ui/async-await/future-contains-err-issue-115188.rs b/tests/ui/async-await/future-contains-err-issue-115188.rs
new file mode 100644
index 000000000..bf643c926
--- /dev/null
+++ b/tests/ui/async-await/future-contains-err-issue-115188.rs
@@ -0,0 +1,17 @@
+// edition: 2021
+
+// Makes sure we don't spew a bunch of unrelated opaque errors when the reason
+// for this error is just a missing struct field in `foo`.
+
+async fn foo() {
+ let y = Wrapper { };
+ //~^ ERROR missing field `t` in initializer of `Wrapper<_>`
+}
+
+struct Wrapper<T> { t: T }
+
+fn is_send<T: Send>(_: T) {}
+
+fn main() {
+ is_send(foo());
+}
diff --git a/tests/ui/async-await/future-contains-err-issue-115188.stderr b/tests/ui/async-await/future-contains-err-issue-115188.stderr
new file mode 100644
index 000000000..8fd2550c1
--- /dev/null
+++ b/tests/ui/async-await/future-contains-err-issue-115188.stderr
@@ -0,0 +1,9 @@
+error[E0063]: missing field `t` in initializer of `Wrapper<_>`
+ --> $DIR/future-contains-err-issue-115188.rs:7:13
+ |
+LL | let y = Wrapper { };
+ | ^^^^^^^ missing `t`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0063`.
diff --git a/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout b/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout
index c0fbb0204..d63911b0d 100644
--- a/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout
+++ b/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout
@@ -1,11 +1,17 @@
-print-type-size type: `[async fn body@$DIR/async-awaiting-fut.rs:21:21: 24:2]`: 3078 bytes, alignment: 1 bytes
+print-type-size type: `{async fn body@$DIR/async-awaiting-fut.rs:21:21: 24:2}`: 3078 bytes, alignment: 1 bytes
print-type-size discriminant: 1 bytes
print-type-size variant `Unresumed`: 0 bytes
print-type-size variant `Suspend0`: 3077 bytes
print-type-size local `.__awaitee`: 3077 bytes
print-type-size variant `Returned`: 0 bytes
print-type-size variant `Panicked`: 0 bytes
-print-type-size type: `[async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2]`: 3077 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::ManuallyDrop<{async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2}>`: 3077 bytes, alignment: 1 bytes
+print-type-size field `.value`: 3077 bytes
+print-type-size type: `std::mem::MaybeUninit<{async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2}>`: 3077 bytes, alignment: 1 bytes
+print-type-size variant `MaybeUninit`: 3077 bytes
+print-type-size field `.uninit`: 0 bytes
+print-type-size field `.value`: 3077 bytes
+print-type-size type: `{async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2}`: 3077 bytes, alignment: 1 bytes
print-type-size discriminant: 1 bytes
print-type-size variant `Unresumed`: 1025 bytes
print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes
@@ -30,13 +36,13 @@ print-type-size variant `Returned`: 1025 bytes
print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes
print-type-size variant `Panicked`: 1025 bytes
print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes
-print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2]>`: 3077 bytes, alignment: 1 bytes
-print-type-size field `.value`: 3077 bytes
-print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2]>`: 3077 bytes, alignment: 1 bytes
-print-type-size variant `MaybeUninit`: 3077 bytes
+print-type-size type: `std::mem::ManuallyDrop<{async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37}>`: 1025 bytes, alignment: 1 bytes
+print-type-size field `.value`: 1025 bytes
+print-type-size type: `std::mem::MaybeUninit<{async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37}>`: 1025 bytes, alignment: 1 bytes
+print-type-size variant `MaybeUninit`: 1025 bytes
print-type-size field `.uninit`: 0 bytes
-print-type-size field `.value`: 3077 bytes
-print-type-size type: `[async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37]`: 1025 bytes, alignment: 1 bytes
+print-type-size field `.value`: 1025 bytes
+print-type-size type: `{async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37}`: 1025 bytes, alignment: 1 bytes
print-type-size discriminant: 1 bytes
print-type-size variant `Unresumed`: 1024 bytes
print-type-size upvar `.arg`: 1024 bytes
@@ -44,17 +50,6 @@ print-type-size variant `Returned`: 1024 bytes
print-type-size upvar `.arg`: 1024 bytes
print-type-size variant `Panicked`: 1024 bytes
print-type-size upvar `.arg`: 1024 bytes
-print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37]>`: 1025 bytes, alignment: 1 bytes
-print-type-size field `.value`: 1025 bytes
-print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37]>`: 1025 bytes, alignment: 1 bytes
-print-type-size variant `MaybeUninit`: 1025 bytes
-print-type-size field `.uninit`: 0 bytes
-print-type-size field `.value`: 1025 bytes
-print-type-size type: `[async fn body@$DIR/async-awaiting-fut.rs:6:17: 6:19]`: 1 bytes, alignment: 1 bytes
-print-type-size discriminant: 1 bytes
-print-type-size variant `Unresumed`: 0 bytes
-print-type-size variant `Returned`: 0 bytes
-print-type-size variant `Panicked`: 0 bytes
print-type-size type: `std::mem::ManuallyDrop<bool>`: 1 bytes, alignment: 1 bytes
print-type-size field `.value`: 1 bytes
print-type-size type: `std::mem::MaybeUninit<bool>`: 1 bytes, alignment: 1 bytes
@@ -66,3 +61,8 @@ print-type-size discriminant: 1 bytes
print-type-size variant `Ready`: 0 bytes
print-type-size field `.0`: 0 bytes
print-type-size variant `Pending`: 0 bytes
+print-type-size type: `{async fn body@$DIR/async-awaiting-fut.rs:6:17: 6:19}`: 1 bytes, alignment: 1 bytes
+print-type-size discriminant: 1 bytes
+print-type-size variant `Unresumed`: 0 bytes
+print-type-size variant `Returned`: 0 bytes
+print-type-size variant `Panicked`: 0 bytes
diff --git a/tests/ui/async-await/future-sizes/large-arg.stdout b/tests/ui/async-await/future-sizes/large-arg.stdout
index b5e95ddd7..005460df6 100644
--- a/tests/ui/async-await/future-sizes/large-arg.stdout
+++ b/tests/ui/async-await/future-sizes/large-arg.stdout
@@ -1,55 +1,47 @@
-print-type-size type: `[async fn body@$DIR/large-arg.rs:6:21: 8:2]`: 3076 bytes, alignment: 1 bytes
+print-type-size type: `{async fn body@$DIR/large-arg.rs:6:21: 8:2}`: 3076 bytes, alignment: 1 bytes
print-type-size discriminant: 1 bytes
print-type-size variant `Unresumed`: 0 bytes
print-type-size variant `Suspend0`: 3075 bytes
print-type-size local `.__awaitee`: 3075 bytes
print-type-size variant `Returned`: 0 bytes
print-type-size variant `Panicked`: 0 bytes
-print-type-size type: `[async fn body@$DIR/large-arg.rs:10:30: 12:2]`: 3075 bytes, alignment: 1 bytes
-print-type-size discriminant: 1 bytes
-print-type-size variant `Unresumed`: 1024 bytes
-print-type-size upvar `.t`: 1024 bytes
-print-type-size variant `Suspend0`: 3074 bytes
-print-type-size upvar `.t`: 1024 bytes
-print-type-size local `.__awaitee`: 2050 bytes
-print-type-size variant `Returned`: 1024 bytes
-print-type-size upvar `.t`: 1024 bytes
-print-type-size variant `Panicked`: 1024 bytes
-print-type-size upvar `.t`: 1024 bytes
-print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/large-arg.rs:10:30: 12:2]>`: 3075 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::ManuallyDrop<{async fn body@$DIR/large-arg.rs:10:30: 12:2}>`: 3075 bytes, alignment: 1 bytes
print-type-size field `.value`: 3075 bytes
-print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/large-arg.rs:10:30: 12:2]>`: 3075 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::MaybeUninit<{async fn body@$DIR/large-arg.rs:10:30: 12:2}>`: 3075 bytes, alignment: 1 bytes
print-type-size variant `MaybeUninit`: 3075 bytes
print-type-size field `.uninit`: 0 bytes
print-type-size field `.value`: 3075 bytes
-print-type-size type: `[async fn body@$DIR/large-arg.rs:13:26: 15:2]`: 2050 bytes, alignment: 1 bytes
+print-type-size type: `{async fn body@$DIR/large-arg.rs:10:30: 12:2}`: 3075 bytes, alignment: 1 bytes
print-type-size discriminant: 1 bytes
print-type-size variant `Unresumed`: 1024 bytes
print-type-size upvar `.t`: 1024 bytes
-print-type-size variant `Suspend0`: 2049 bytes
+print-type-size variant `Suspend0`: 3074 bytes
print-type-size upvar `.t`: 1024 bytes
-print-type-size local `.__awaitee`: 1025 bytes
+print-type-size local `.__awaitee`: 2050 bytes
print-type-size variant `Returned`: 1024 bytes
print-type-size upvar `.t`: 1024 bytes
print-type-size variant `Panicked`: 1024 bytes
print-type-size upvar `.t`: 1024 bytes
-print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/large-arg.rs:13:26: 15:2]>`: 2050 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::ManuallyDrop<{async fn body@$DIR/large-arg.rs:13:26: 15:2}>`: 2050 bytes, alignment: 1 bytes
print-type-size field `.value`: 2050 bytes
-print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/large-arg.rs:13:26: 15:2]>`: 2050 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::MaybeUninit<{async fn body@$DIR/large-arg.rs:13:26: 15:2}>`: 2050 bytes, alignment: 1 bytes
print-type-size variant `MaybeUninit`: 2050 bytes
print-type-size field `.uninit`: 0 bytes
print-type-size field `.value`: 2050 bytes
-print-type-size type: `[async fn body@$DIR/large-arg.rs:16:26: 18:2]`: 1025 bytes, alignment: 1 bytes
+print-type-size type: `{async fn body@$DIR/large-arg.rs:13:26: 15:2}`: 2050 bytes, alignment: 1 bytes
print-type-size discriminant: 1 bytes
print-type-size variant `Unresumed`: 1024 bytes
print-type-size upvar `.t`: 1024 bytes
+print-type-size variant `Suspend0`: 2049 bytes
+print-type-size upvar `.t`: 1024 bytes
+print-type-size local `.__awaitee`: 1025 bytes
print-type-size variant `Returned`: 1024 bytes
print-type-size upvar `.t`: 1024 bytes
print-type-size variant `Panicked`: 1024 bytes
print-type-size upvar `.t`: 1024 bytes
-print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/large-arg.rs:16:26: 18:2]>`: 1025 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::ManuallyDrop<{async fn body@$DIR/large-arg.rs:16:26: 18:2}>`: 1025 bytes, alignment: 1 bytes
print-type-size field `.value`: 1025 bytes
-print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/large-arg.rs:16:26: 18:2]>`: 1025 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::MaybeUninit<{async fn body@$DIR/large-arg.rs:16:26: 18:2}>`: 1025 bytes, alignment: 1 bytes
print-type-size variant `MaybeUninit`: 1025 bytes
print-type-size field `.uninit`: 0 bytes
print-type-size field `.value`: 1025 bytes
@@ -58,3 +50,11 @@ print-type-size discriminant: 1 bytes
print-type-size variant `Ready`: 1024 bytes
print-type-size field `.0`: 1024 bytes
print-type-size variant `Pending`: 0 bytes
+print-type-size type: `{async fn body@$DIR/large-arg.rs:16:26: 18:2}`: 1025 bytes, alignment: 1 bytes
+print-type-size discriminant: 1 bytes
+print-type-size variant `Unresumed`: 1024 bytes
+print-type-size upvar `.t`: 1024 bytes
+print-type-size variant `Returned`: 1024 bytes
+print-type-size upvar `.t`: 1024 bytes
+print-type-size variant `Panicked`: 1024 bytes
+print-type-size upvar `.t`: 1024 bytes
diff --git a/tests/ui/async-await/generator-desc.stderr b/tests/ui/async-await/generator-desc.stderr
index 042766f19..d3e951cfe 100644
--- a/tests/ui/async-await/generator-desc.stderr
+++ b/tests/ui/async-await/generator-desc.stderr
@@ -7,8 +7,8 @@ LL | fun(async {}, async {});
| | 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: 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
--> $DIR/generator-desc.rs:8:4
|
@@ -40,8 +40,8 @@ LL | fun((async || {})(), (async || {})());
| | the expected `async` closure body
| arguments to this function are incorrect
|
- = note: expected `async` closure body `[async closure body@$DIR/generator-desc.rs:14:19: 14:21]`
- found `async` closure body `[async closure body@$DIR/generator-desc.rs:14:36: 14:38]`
+ = note: expected `async` closure body `{async closure body@$DIR/generator-desc.rs:14:19: 14:21}`
+ found `async` closure body `{async closure body@$DIR/generator-desc.rs:14:36: 14:38}`
note: function defined here
--> $DIR/generator-desc.rs:8:4
|
diff --git a/tests/ui/async-await/generator-not-future.stderr b/tests/ui/async-await/generator-not-future.stderr
index 1b81b461f..540501b98 100644
--- a/tests/ui/async-await/generator-not-future.stderr
+++ b/tests/ui/async-await/generator-not-future.stderr
@@ -26,11 +26,11 @@ note: required by a bound in `takes_generator`
LL | fn takes_generator<ResumeTy>(_g: impl Generator<ResumeTy, Yield = (), Return = ()>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_generator`
-error[E0277]: the trait bound `[async block@$DIR/generator-not-future.rs:35:21: 35:29]: Generator<_>` is not satisfied
+error[E0277]: the trait bound `{async block@$DIR/generator-not-future.rs:35:21: 35:29}: Generator<_>` is not satisfied
--> $DIR/generator-not-future.rs:35:21
|
LL | takes_generator(async {});
- | --------------- ^^^^^^^^ the trait `Generator<_>` is not implemented for `[async block@$DIR/generator-not-future.rs:35:21: 35:29]`
+ | --------------- ^^^^^^^^ the trait `Generator<_>` is not implemented for `{async block@$DIR/generator-not-future.rs:35:21: 35:29}`
| |
| required by a bound introduced by this call
|
@@ -56,7 +56,7 @@ note: required by a bound in `takes_future`
LL | fn takes_future(_f: impl Future<Output = ()>) {}
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future`
-error[E0277]: `[generator@$DIR/generator-not-future.rs:41:18: 41:23]` is not a future
+error[E0277]: `{generator@$DIR/generator-not-future.rs:41:18: 41:23}` is not a future
--> $DIR/generator-not-future.rs:41:18
|
LL | takes_future(|ctx| {
@@ -66,10 +66,10 @@ LL | takes_future(|ctx| {
LL | |
LL | | ctx = yield ();
LL | | });
- | |_____^ `[generator@$DIR/generator-not-future.rs:41:18: 41:23]` is not a future
+ | |_____^ `{generator@$DIR/generator-not-future.rs:41:18: 41:23}` is not a future
|
- = help: the trait `Future` is not implemented for `[generator@$DIR/generator-not-future.rs:41:18: 41:23]`
- = note: [generator@$DIR/generator-not-future.rs:41:18: 41:23] must be a future or must implement `IntoFuture` to be awaited
+ = help: the trait `Future` is not implemented for `{generator@$DIR/generator-not-future.rs:41:18: 41:23}`
+ = note: {generator@$DIR/generator-not-future.rs:41:18: 41:23} must be a future or must implement `IntoFuture` to be awaited
note: required by a bound in `takes_future`
--> $DIR/generator-not-future.rs:17:26
|
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..3e2739a16 100644
--- a/tests/ui/async-await/in-trait/async-associated-types.rs
+++ b/tests/ui/async-await/in-trait/async-associated-types.rs
@@ -2,7 +2,6 @@
// edition: 2021
#![feature(async_fn_in_trait)]
-#![feature(impl_trait_projections)]
#![allow(incomplete_features)]
use std::fmt::Debug;
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..3505690f1 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
@@ -2,14 +2,14 @@
// edition: 2021
#![feature(async_fn_in_trait)]
-#![feature(return_position_impl_trait_in_trait)]
+#![feature(return_position_impl_trait_in_trait, lint_reasons)]
#![allow(incomplete_features)]
use std::future::Future;
use std::pin::Pin;
use std::task::Poll;
-trait MyTrait {
+pub trait MyTrait {
async fn foo(&self) -> i32;
}
@@ -27,8 +27,7 @@ impl Future for MyFuture {
}
impl MyTrait for i32 {
- // FIXME: this should eventually require `#[refine]` to compile, because it also provides
- // `Clone`.
+ #[expect(refining_impl_trait)]
fn foo(&self) -> impl Future<Output = i32> + Clone {
MyFuture(*self)
}
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..0a5023176 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared.rs
@@ -12,7 +12,7 @@ trait MyTrait {
}
impl MyTrait for i32 {
- fn foo(&self) -> impl Future<Output = i32> + '_ {
+ fn foo(&self) -> impl Future<Output = i32> {
async { *self }
}
}
diff --git a/tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs b/tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs
new file mode 100644
index 000000000..bba886f17
--- /dev/null
+++ b/tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs
@@ -0,0 +1,7 @@
+// edition:2021
+
+#![feature(async_fn_in_trait)]
+
+pub trait Foo {
+ async fn test();
+}
diff --git a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs
new file mode 100644
index 000000000..2fe6b473d
--- /dev/null
+++ b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs
@@ -0,0 +1,38 @@
+// edition: 2021
+// build-fail
+//~^^ ERROR cycle detected when computing layout of
+
+#![feature(async_fn_in_trait)]
+
+fn main() {
+ let _ = async {
+ A.first().await.second().await;
+ };
+}
+
+pub trait First {
+ type Second: Second;
+ async fn first(self) -> Self::Second;
+}
+
+struct A;
+
+impl First for A {
+ type Second = A;
+ async fn first(self) -> Self::Second {
+ A
+ }
+}
+
+pub trait Second {
+ async fn second(self);
+}
+
+impl<C> Second for C
+where
+ C: First,
+{
+ async fn second(self) {
+ self.first().await.second().await;
+ }
+}
diff --git a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr
new file mode 100644
index 000000000..41e84466a
--- /dev/null
+++ b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr
@@ -0,0 +1,10 @@
+error[E0391]: cycle detected when computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:35:27: 37:6}`
+ |
+ = note: ...which requires computing layout of `<<A as First>::Second as Second>::{opaque#0}`...
+ = note: ...which again requires computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:35:27: 37:6}`, completing the cycle
+ = note: cycle used when computing layout of `{async block@$DIR/indirect-recursion-issue-112047.rs:8:13: 10:6}`
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/async-await/in-trait/missing-send-bound.stderr b/tests/ui/async-await/in-trait/missing-send-bound.stderr
index 18185b755..7e59d94d4 100644
--- a/tests/ui/async-await/in-trait/missing-send-bound.stderr
+++ b/tests/ui/async-await/in-trait/missing-send-bound.stderr
@@ -15,6 +15,11 @@ note: required by a bound in `assert_is_send`
|
LL | fn assert_is_send(_: impl Send) {}
| ^^^^ required by this bound in `assert_is_send`
+help: `Send` can be made part of the associated future's guarantees for all implementations of `Foo::bar`
+ |
+LL - async fn bar();
+LL + fn bar() -> impl std::future::Future<Output = ()> + Send;
+ |
error: aborting due to previous error
diff --git a/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.fixed b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.fixed
new file mode 100644
index 000000000..33c005874
--- /dev/null
+++ b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.fixed
@@ -0,0 +1,20 @@
+// run-rustfix
+// edition: 2021
+
+#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
+#![allow(unused)]
+
+trait Foo {
+ fn test() -> impl std::future::Future<Output = ()> + Send { async {} }
+ fn test2() -> impl std::future::Future<Output = i32> + Send {async { 1 + 2 } }
+}
+
+fn bar<T: Foo>() {
+ fn needs_send(_: impl Send) {}
+ needs_send(T::test());
+ //~^ ERROR `impl Future<Output = ()>` cannot be sent between threads safely
+ needs_send(T::test2());
+ //~^ ERROR `impl Future<Output = i32>` cannot be sent between threads safely
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.rs b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.rs
new file mode 100644
index 000000000..96b623d69
--- /dev/null
+++ b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.rs
@@ -0,0 +1,20 @@
+// run-rustfix
+// edition: 2021
+
+#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
+#![allow(unused)]
+
+trait Foo {
+ async fn test() -> () {}
+ async fn test2() -> i32 { 1 + 2 }
+}
+
+fn bar<T: Foo>() {
+ fn needs_send(_: impl Send) {}
+ needs_send(T::test());
+ //~^ ERROR `impl Future<Output = ()>` cannot be sent between threads safely
+ needs_send(T::test2());
+ //~^ ERROR `impl Future<Output = i32>` cannot be sent between threads safely
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.stderr b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.stderr
new file mode 100644
index 000000000..4319a1411
--- /dev/null
+++ b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.stderr
@@ -0,0 +1,43 @@
+error[E0277]: `impl Future<Output = ()>` cannot be sent between threads safely
+ --> $DIR/send-on-async-fn-in-trait.rs:14:16
+ |
+LL | needs_send(T::test());
+ | ---------- ^^^^^^^^^ `impl Future<Output = ()>` cannot be sent between threads safely
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Send` is not implemented for `impl Future<Output = ()>`
+note: required by a bound in `needs_send`
+ --> $DIR/send-on-async-fn-in-trait.rs:13:27
+ |
+LL | fn needs_send(_: impl Send) {}
+ | ^^^^ required by this bound in `needs_send`
+help: `Send` can be made part of the associated future's guarantees for all implementations of `Foo::test`
+ |
+LL - async fn test() -> () {}
+LL + fn test() -> impl std::future::Future<Output = ()> + Send { async {} }
+ |
+
+error[E0277]: `impl Future<Output = i32>` cannot be sent between threads safely
+ --> $DIR/send-on-async-fn-in-trait.rs:16:16
+ |
+LL | needs_send(T::test2());
+ | ---------- ^^^^^^^^^^ `impl Future<Output = i32>` cannot be sent between threads safely
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Send` is not implemented for `impl Future<Output = i32>`
+note: required by a bound in `needs_send`
+ --> $DIR/send-on-async-fn-in-trait.rs:13:27
+ |
+LL | fn needs_send(_: impl Send) {}
+ | ^^^^ required by this bound in `needs_send`
+help: `Send` can be made part of the associated future's guarantees for all implementations of `Foo::test2`
+ |
+LL - async fn test2() -> i32 { 1 + 2 }
+LL + fn test2() -> impl std::future::Future<Output = i32> + Send {async { 1 + 2 } }
+ |
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.rs b/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.rs
new file mode 100644
index 000000000..83b69d72a
--- /dev/null
+++ b/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.rs
@@ -0,0 +1,15 @@
+// aux-build:foreign-async-fn.rs
+// edition:2021
+
+#![feature(async_fn_in_trait)]
+
+extern crate foreign_async_fn;
+use foreign_async_fn::Foo;
+
+fn bar<T: Foo>() {
+ fn needs_send(_: impl Send) {}
+ needs_send(T::test());
+ //~^ ERROR `impl Future<Output = ()>` cannot be sent between threads safely
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.stderr b/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.stderr
new file mode 100644
index 000000000..f337a04ba
--- /dev/null
+++ b/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.stderr
@@ -0,0 +1,23 @@
+error[E0277]: `impl Future<Output = ()>` cannot be sent between threads safely
+ --> $DIR/send-on-foreign-async-fn-in-trait.rs:11:16
+ |
+LL | needs_send(T::test());
+ | ---------- ^^^^^^^^^ `impl Future<Output = ()>` cannot be sent between threads safely
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Send` is not implemented for `impl Future<Output = ()>`
+note: `<T as Foo>::test` is an `async fn` in trait, which does not automatically imply that its future is `Send`
+ --> $DIR/auxiliary/foreign-async-fn.rs:6:5
+ |
+LL | async fn test();
+ | ^^^^^^^^^^^^^^^^
+note: required by a bound in `needs_send`
+ --> $DIR/send-on-foreign-async-fn-in-trait.rs:10:27
+ |
+LL | fn needs_send(_: impl Send) {}
+ | ^^^^ required by this bound in `needs_send`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/issue-61949-self-return-type.rs b/tests/ui/async-await/issue-61949-self-return-type.rs
deleted file mode 100644
index d73dbc6e8..000000000
--- a/tests/ui/async-await/issue-61949-self-return-type.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-// edition:2018
-// gate-test-impl_trait_projections
-
-// This test checks that `Self` is prohibited as a return type. See #61949 for context.
-
-pub struct Foo<'a> {
- pub bar: &'a i32,
-}
-
-impl<'a> Foo<'a> {
- pub async fn new(_bar: &'a i32) -> Self {
- //~^ ERROR `async fn` return type cannot contain a projection or `Self` that references lifetimes from a parent scope
- Foo {
- bar: &22
- }
- }
-}
-
-async fn foo() {
- let x = {
- let bar = 22;
- Foo::new(&bar).await
- //~^ ERROR `bar` does not live long enough
- };
- drop(x);
-}
-
-fn main() { }
diff --git a/tests/ui/async-await/issue-61949-self-return-type.stderr b/tests/ui/async-await/issue-61949-self-return-type.stderr
deleted file mode 100644
index ac85ed288..000000000
--- a/tests/ui/async-await/issue-61949-self-return-type.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error[E0658]: `async fn` return type cannot contain a projection or `Self` that references lifetimes from a parent scope
- --> $DIR/issue-61949-self-return-type.rs:11:40
- |
-LL | pub async fn new(_bar: &'a i32) -> Self {
- | ^^^^ help: consider spelling out the type instead: `Foo<'a>`
- |
- = note: see issue #103532 <https://github.com/rust-lang/rust/issues/103532> for more information
- = help: add `#![feature(impl_trait_projections)]` to the crate attributes to enable
-
-error[E0597]: `bar` does not live long enough
- --> $DIR/issue-61949-self-return-type.rs:22:18
- |
-LL | let x = {
- | - borrow later stored here
-LL | let bar = 22;
- | --- binding `bar` declared here
-LL | Foo::new(&bar).await
- | ^^^^ borrowed value does not live long enough
-LL |
-LL | };
- | - `bar` dropped here while still borrowed
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0597, E0658.
-For more information about an error, try `rustc --explain E0597`.
diff --git a/tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr b/tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr
deleted file mode 100644
index 56aa035f4..000000000
--- a/tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error: future cannot be shared between threads safely
- --> $DIR/issue-64130-1-sync.rs:25:13
- |
-LL | is_sync(bar());
- | ^^^^^ future returned by `bar` is not `Sync`
- |
- = help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
-note: future is not `Sync` as this value is used across an await
- --> $DIR/issue-64130-1-sync.rs:18:11
- |
-LL | let x = Foo;
- | - has type `Foo` which is not `Sync`
-LL | baz().await;
- | ^^^^^ await occurs here, with `x` maybe used later
-LL | drop(x);
-LL | }
- | - `x` is later dropped here
-note: required by a bound in `is_sync`
- --> $DIR/issue-64130-1-sync.rs:14:15
- |
-LL | fn is_sync<T: Sync>(t: T) { }
- | ^^^^ required by this bound in `is_sync`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr
deleted file mode 100644
index 56aa035f4..000000000
--- a/tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error: future cannot be shared between threads safely
- --> $DIR/issue-64130-1-sync.rs:25:13
- |
-LL | is_sync(bar());
- | ^^^^^ future returned by `bar` is not `Sync`
- |
- = help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
-note: future is not `Sync` as this value is used across an await
- --> $DIR/issue-64130-1-sync.rs:18:11
- |
-LL | let x = Foo;
- | - has type `Foo` which is not `Sync`
-LL | baz().await;
- | ^^^^^ await occurs here, with `x` maybe used later
-LL | drop(x);
-LL | }
- | - `x` is later dropped here
-note: required by a bound in `is_sync`
- --> $DIR/issue-64130-1-sync.rs:14:15
- |
-LL | fn is_sync<T: Sync>(t: T) { }
- | ^^^^ required by this bound in `is_sync`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-64130-1-sync.rs b/tests/ui/async-await/issue-64130-1-sync.rs
index 44646e0e5..7769085a0 100644
--- a/tests/ui/async-await/issue-64130-1-sync.rs
+++ b/tests/ui/async-await/issue-64130-1-sync.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
#![feature(negative_impls)]
// edition:2018
diff --git a/tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr b/tests/ui/async-await/issue-64130-1-sync.stderr
index ea1bfb9f9..207e085d2 100644
--- a/tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/issue-64130-1-sync.stderr
@@ -1,19 +1,19 @@
error: future cannot be shared between threads safely
- --> $DIR/issue-64130-1-sync.rs:25:13
+ --> $DIR/issue-64130-1-sync.rs:22:13
|
LL | is_sync(bar());
| ^^^^^ future returned by `bar` is not `Sync`
|
= help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
note: future is not `Sync` as this value is used across an await
- --> $DIR/issue-64130-1-sync.rs:18:11
+ --> $DIR/issue-64130-1-sync.rs:15:11
|
LL | let x = Foo;
| - has type `Foo` which is not `Sync`
LL | baz().await;
| ^^^^^ await occurs here, with `x` maybe used later
note: required by a bound in `is_sync`
- --> $DIR/issue-64130-1-sync.rs:14:15
+ --> $DIR/issue-64130-1-sync.rs:11:15
|
LL | fn is_sync<T: Sync>(t: T) { }
| ^^^^ required by this bound in `is_sync`
diff --git a/tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr b/tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr
deleted file mode 100644
index d1717ad33..000000000
--- a/tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr
+++ /dev/null
@@ -1,28 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-64130-2-send.rs:24:13
- |
-LL | is_send(bar());
- | ^^^^^ future returned by `bar` is not `Send`
- |
- = note: the trait bound `Unique<Foo>: Send` is not satisfied
-note: future is not `Send` as this value is used across an await
- --> $DIR/issue-64130-2-send.rs:18:11
- |
-LL | let x = Box::new(Foo);
- | - has type `Box<Foo>` which is not `Send`
-LL | baz().await;
- | ^^^^^ await occurs here, with `x` maybe used later
-LL | }
- | - `x` is later dropped here
-note: required by a bound in `is_send`
- --> $DIR/issue-64130-2-send.rs:14:15
- |
-LL | fn is_send<T: Send>(t: T) { }
- | ^^^^ required by this bound in `is_send`
-help: consider borrowing here
- |
-LL | is_send(&bar());
- | +
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr
deleted file mode 100644
index d1717ad33..000000000
--- a/tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr
+++ /dev/null
@@ -1,28 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-64130-2-send.rs:24:13
- |
-LL | is_send(bar());
- | ^^^^^ future returned by `bar` is not `Send`
- |
- = note: the trait bound `Unique<Foo>: Send` is not satisfied
-note: future is not `Send` as this value is used across an await
- --> $DIR/issue-64130-2-send.rs:18:11
- |
-LL | let x = Box::new(Foo);
- | - has type `Box<Foo>` which is not `Send`
-LL | baz().await;
- | ^^^^^ await occurs here, with `x` maybe used later
-LL | }
- | - `x` is later dropped here
-note: required by a bound in `is_send`
- --> $DIR/issue-64130-2-send.rs:14:15
- |
-LL | fn is_send<T: Send>(t: T) { }
- | ^^^^ required by this bound in `is_send`
-help: consider borrowing here
- |
-LL | is_send(&bar());
- | +
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-64130-2-send.rs b/tests/ui/async-await/issue-64130-2-send.rs
index d6d855bac..0195afe6b 100644
--- a/tests/ui/async-await/issue-64130-2-send.rs
+++ b/tests/ui/async-await/issue-64130-2-send.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
#![feature(negative_impls)]
// edition:2018
@@ -14,8 +11,9 @@ impl !Send for Foo {}
fn is_send<T: Send>(t: T) { }
async fn bar() {
- let x = Box::new(Foo);
+ let x = Foo;
baz().await;
+ drop(x);
}
async fn baz() { }
diff --git a/tests/ui/async-await/issue-64130-2-send.drop_tracking_mir.stderr b/tests/ui/async-await/issue-64130-2-send.stderr
index 45e43525a..a433c76ae 100644
--- a/tests/ui/async-await/issue-64130-2-send.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/issue-64130-2-send.stderr
@@ -1,26 +1,22 @@
error: future cannot be sent between threads safely
- --> $DIR/issue-64130-2-send.rs:24:13
+ --> $DIR/issue-64130-2-send.rs:22:13
|
LL | is_send(bar());
| ^^^^^ future returned by `bar` is not `Send`
|
- = note: the trait bound `Unique<Foo>: Send` is not satisfied
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Foo`
note: future is not `Send` as this value is used across an await
- --> $DIR/issue-64130-2-send.rs:18:11
+ --> $DIR/issue-64130-2-send.rs:15:11
|
-LL | let x = Box::new(Foo);
- | - has type `Box<Foo>` which is not `Send`
+LL | let x = Foo;
+ | - has type `Foo` which is not `Send`
LL | baz().await;
| ^^^^^ await occurs here, with `x` maybe used later
note: required by a bound in `is_send`
- --> $DIR/issue-64130-2-send.rs:14:15
+ --> $DIR/issue-64130-2-send.rs:11:15
|
LL | fn is_send<T: Send>(t: T) { }
| ^^^^ required by this bound in `is_send`
-help: consider borrowing here
- |
-LL | is_send(&bar());
- | +
error: aborting due to previous error
diff --git a/tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr b/tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr
deleted file mode 100644
index b69f06da1..000000000
--- a/tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr
+++ /dev/null
@@ -1,27 +0,0 @@
-error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future<Output = ()>`
- --> $DIR/issue-64130-3-other.rs:27:12
- |
-LL | async fn bar() {
- | - within this `impl Future<Output = ()>`
-...
-LL | is_qux(bar());
- | ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo`
- |
-note: future does not implement `Qux` as this value is used across an await
- --> $DIR/issue-64130-3-other.rs:21:11
- |
-LL | let x = Box::new(Foo);
- | - has type `Box<Foo>` which does not implement `Qux`
-LL | baz().await;
- | ^^^^^ await occurs here, with `x` maybe used later
-LL | }
- | - `x` is later dropped here
-note: required by a bound in `is_qux`
- --> $DIR/issue-64130-3-other.rs:17:14
- |
-LL | fn is_qux<T: Qux>(t: T) {}
- | ^^^ required by this bound in `is_qux`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr
deleted file mode 100644
index b69f06da1..000000000
--- a/tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr
+++ /dev/null
@@ -1,27 +0,0 @@
-error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future<Output = ()>`
- --> $DIR/issue-64130-3-other.rs:27:12
- |
-LL | async fn bar() {
- | - within this `impl Future<Output = ()>`
-...
-LL | is_qux(bar());
- | ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo`
- |
-note: future does not implement `Qux` as this value is used across an await
- --> $DIR/issue-64130-3-other.rs:21:11
- |
-LL | let x = Box::new(Foo);
- | - has type `Box<Foo>` which does not implement `Qux`
-LL | baz().await;
- | ^^^^^ await occurs here, with `x` maybe used later
-LL | }
- | - `x` is later dropped here
-note: required by a bound in `is_qux`
- --> $DIR/issue-64130-3-other.rs:17:14
- |
-LL | fn is_qux<T: Qux>(t: T) {}
- | ^^^ required by this bound in `is_qux`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/issue-64130-3-other.rs b/tests/ui/async-await/issue-64130-3-other.rs
index 92d3b7c81..074d67aa3 100644
--- a/tests/ui/async-await/issue-64130-3-other.rs
+++ b/tests/ui/async-await/issue-64130-3-other.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
#![feature(auto_traits)]
#![feature(negative_impls)]
// edition:2018
@@ -17,8 +14,9 @@ impl !Qux for Foo {}
fn is_qux<T: Qux>(t: T) {}
async fn bar() {
- let x = Box::new(Foo);
+ let x = Foo;
baz().await;
+ drop(x);
}
async fn baz() {}
diff --git a/tests/ui/async-await/issue-64130-3-other.drop_tracking_mir.stderr b/tests/ui/async-await/issue-64130-3-other.stderr
index 129837124..573da1034 100644
--- a/tests/ui/async-await/issue-64130-3-other.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/issue-64130-3-other.stderr
@@ -1,5 +1,5 @@
error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future<Output = ()>`
- --> $DIR/issue-64130-3-other.rs:27:12
+ --> $DIR/issue-64130-3-other.rs:25:12
|
LL | async fn bar() {
| - within this `impl Future<Output = ()>`
@@ -8,14 +8,14 @@ LL | is_qux(bar());
| ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo`
|
note: future does not implement `Qux` as this value is used across an await
- --> $DIR/issue-64130-3-other.rs:21:11
+ --> $DIR/issue-64130-3-other.rs:18:11
|
-LL | let x = Box::new(Foo);
- | - has type `Box<Foo>` which does not implement `Qux`
+LL | let x = Foo;
+ | - has type `Foo` which does not implement `Qux`
LL | baz().await;
| ^^^^^ await occurs here, with `x` maybe used later
note: required by a bound in `is_qux`
- --> $DIR/issue-64130-3-other.rs:17:14
+ --> $DIR/issue-64130-3-other.rs:14:14
|
LL | fn is_qux<T: Qux>(t: T) {}
| ^^^ required by this bound in `is_qux`
diff --git a/tests/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr b/tests/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr
deleted file mode 100644
index 884619f4d..000000000
--- a/tests/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-64130-4-async-move.rs:20:17
- |
-LL | pub fn foo() -> impl Future + Send {
- | ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
- |
- = help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)`
-note: future is not `Send` as this value is used across an await
- --> $DIR/issue-64130-4-async-move.rs:27:31
- |
-LL | match client.status() {
- | ------ has type `&Client` which is not `Send`
-LL | 200 => {
-LL | let _x = get().await;
- | ^^^^^^ await occurs here, with `client` maybe used later
-...
-LL | }
- | - `client` is later dropped here
-help: consider moving this into a `let` binding to create a shorter lived borrow
- --> $DIR/issue-64130-4-async-move.rs:25:15
- |
-LL | match client.status() {
- | ^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr
deleted file mode 100644
index 60b7551ff..000000000
--- a/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-64130-4-async-move.rs:21:17
- |
-LL | pub fn foo() -> impl Future + Send {
- | ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
- |
- = help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)`
-note: future is not `Send` as this value is used across an await
- --> $DIR/issue-64130-4-async-move.rs:27:23
- |
-LL | match client.status() {
- | ------ has type `&Client` which is not `Send`
-LL | 200 => {
-LL | get().await;
- | ^^^^^ await occurs here, with `client` maybe used later
-...
-LL | }
- | - `client` is later dropped here
-help: consider moving this into a `let` binding to create a shorter lived borrow
- --> $DIR/issue-64130-4-async-move.rs:25:15
- |
-LL | match client.status() {
- | ^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-64130-4-async-move.rs b/tests/ui/async-await/issue-64130-4-async-move.rs
index 5d68a808b..359813f63 100644
--- a/tests/ui/async-await/issue-64130-4-async-move.rs
+++ b/tests/ui/async-await/issue-64130-4-async-move.rs
@@ -1,9 +1,5 @@
// edition:2018
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-// [drop_tracking_mir] check-pass
-// [drop_tracking] check-pass
+// check-pass
use std::any::Any;
use std::future::Future;
@@ -19,7 +15,6 @@ impl Client {
async fn get() {}
pub fn foo() -> impl Future + Send {
- //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
let client = Client(Box::new(true));
async move {
match client.status() {
diff --git a/tests/ui/async-await/issue-64130-non-send-future-diags.stderr b/tests/ui/async-await/issue-64130-non-send-future-diags.stderr
index e044e2ca0..cb02fcf5c 100644
--- a/tests/ui/async-await/issue-64130-non-send-future-diags.stderr
+++ b/tests/ui/async-await/issue-64130-non-send-future-diags.stderr
@@ -12,8 +12,6 @@ LL | let g = x.lock().unwrap();
| - has type `MutexGuard<'_, u32>` which is not `Send`
LL | baz().await;
| ^^^^^ await occurs here, with `g` maybe used later
-LL | }
- | - `g` is later dropped here
note: required by a bound in `is_send`
--> $DIR/issue-64130-non-send-future-diags.rs:9:15
|
diff --git a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr b/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr
deleted file mode 100644
index fa2229865..000000000
--- a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-67252-unnamed-future.rs:21:11
- |
-LL | spawn(async {
- | ___________^
-LL | | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
-LL | | AFuture.await;
-LL | | drop(a);
-LL | | });
- | |_____^ future created by async block is not `Send`
- |
- = help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()`
-note: future is not `Send` as this value is used across an await
- --> $DIR/issue-67252-unnamed-future.rs:23:17
- |
-LL | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
- | - has type `*mut ()` which is not `Send`
-LL | AFuture.await;
- | ^^^^^ await occurs here, with `a` maybe used later
-LL | drop(a);
-LL | });
- | - `a` is later dropped here
-note: required by a bound in `spawn`
- --> $DIR/issue-67252-unnamed-future.rs:9:13
- |
-LL | fn spawn<T: Send>(_: T) {}
- | ^^^^ required by this bound in `spawn`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr b/tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr
deleted file mode 100644
index fa2229865..000000000
--- a/tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-67252-unnamed-future.rs:21:11
- |
-LL | spawn(async {
- | ___________^
-LL | | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
-LL | | AFuture.await;
-LL | | drop(a);
-LL | | });
- | |_____^ future created by async block is not `Send`
- |
- = help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()`
-note: future is not `Send` as this value is used across an await
- --> $DIR/issue-67252-unnamed-future.rs:23:17
- |
-LL | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
- | - has type `*mut ()` which is not `Send`
-LL | AFuture.await;
- | ^^^^^ await occurs here, with `a` maybe used later
-LL | drop(a);
-LL | });
- | - `a` is later dropped here
-note: required by a bound in `spawn`
- --> $DIR/issue-67252-unnamed-future.rs:9:13
- |
-LL | fn spawn<T: Send>(_: T) {}
- | ^^^^ required by this bound in `spawn`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-67252-unnamed-future.rs b/tests/ui/async-await/issue-67252-unnamed-future.rs
index bb9ad77ce..60717d993 100644
--- a/tests/ui/async-await/issue-67252-unnamed-future.rs
+++ b/tests/ui/async-await/issue-67252-unnamed-future.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
use std::future::Future;
use std::pin::Pin;
@@ -21,7 +18,7 @@ async fn foo() {
spawn(async { //~ ERROR future cannot be sent between threads safely
let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
AFuture.await;
- drop(a);
+ let _a = a;
});
}
diff --git a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr b/tests/ui/async-await/issue-67252-unnamed-future.stderr
index 8cf7bb8d9..069befa91 100644
--- a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/issue-67252-unnamed-future.stderr
@@ -1,19 +1,19 @@
error: future cannot be sent between threads safely
- --> $DIR/issue-67252-unnamed-future.rs:21:5
+ --> $DIR/issue-67252-unnamed-future.rs:18:5
|
LL | spawn(async {
| ^^^^^ future created by async block is not `Send`
|
- = help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()`
+ = help: within `{async block@$DIR/issue-67252-unnamed-future.rs:18:11: 22:6}`, the trait `Send` is not implemented for `*mut ()`
note: future is not `Send` as this value is used across an await
- --> $DIR/issue-67252-unnamed-future.rs:23:17
+ --> $DIR/issue-67252-unnamed-future.rs:20:17
|
LL | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
| - has type `*mut ()` which is not `Send`
LL | AFuture.await;
| ^^^^^ await occurs here, with `a` maybe used later
note: required by a bound in `spawn`
- --> $DIR/issue-67252-unnamed-future.rs:9:13
+ --> $DIR/issue-67252-unnamed-future.rs:6:13
|
LL | fn spawn<T: Send>(_: T) {}
| ^^^^ required by this bound in `spawn`
diff --git a/tests/ui/async-await/issue-68112.drop_tracking.stderr b/tests/ui/async-await/issue-68112.drop_tracking.stderr
deleted file mode 100644
index bd648de30..000000000
--- a/tests/ui/async-await/issue-68112.drop_tracking.stderr
+++ /dev/null
@@ -1,82 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-68112.rs:37:18
- |
-LL | require_send(send_fut);
- | ^^^^^^^^ future created by async block is not `Send`
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
-note: future is not `Send` as it awaits another future which is not `Send`
- --> $DIR/issue-68112.rs:34:17
- |
-LL | let _ = non_send_fut.await;
- | ^^^^^^^^^^^^ await occurs here on type `impl Future<Output = Arc<RefCell<i32>>>`, which is not `Send`
-note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:14:25
- |
-LL | fn require_send(_: impl Send) {}
- | ^^^^ required by this bound in `require_send`
-
-error: future cannot be sent between threads safely
- --> $DIR/issue-68112.rs:46:18
- |
-LL | require_send(send_fut);
- | ^^^^^^^^ future created by async block is not `Send`
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
-note: future is not `Send` as it awaits another future which is not `Send`
- --> $DIR/issue-68112.rs:43:17
- |
-LL | let _ = make_non_send_future1().await;
- | ^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `impl Future<Output = Arc<RefCell<i32>>>`, which is not `Send`
-note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:14:25
- |
-LL | fn require_send(_: impl Send) {}
- | ^^^^ required by this bound in `require_send`
-
-error[E0277]: `RefCell<i32>` cannot be shared between threads safely
- --> $DIR/issue-68112.rs:65:18
- |
-LL | require_send(send_fut);
- | ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
- | |
- | required by a bound introduced by this call
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
- = note: required for `Arc<RefCell<i32>>` to implement `Send`
-note: required because it's used within this `async fn` body
- --> $DIR/issue-68112.rs:50:31
- |
-LL | async fn ready2<T>(t: T) -> T {
- | _______________________________^
-LL | | t
-LL | | }
- | |_^
-note: required because it appears within the type `impl Future<Output = Arc<RefCell<i32>>>`
- --> $DIR/issue-68112.rs:53:31
- |
-LL | fn make_non_send_future2() -> impl Future<Output = Arc<RefCell<i32>>> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: required because it captures the following types: `ResumeTy`, `impl Future<Output = Arc<RefCell<i32>>>`, `()`, `Ready<i32>`
-note: required because it's used within this `async` block
- --> $DIR/issue-68112.rs:60:20
- |
-LL | let send_fut = async {
- | ____________________^
-LL | | let non_send_fut = make_non_send_future2();
-LL | | let _ = non_send_fut.await;
-LL | | ready(0).await;
-LL | | };
- | |_____^
-note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:14:25
- |
-LL | fn require_send(_: impl Send) {}
- | ^^^^ required by this bound in `require_send`
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/issue-68112.no_drop_tracking.stderr b/tests/ui/async-await/issue-68112.no_drop_tracking.stderr
deleted file mode 100644
index 35b7341f6..000000000
--- a/tests/ui/async-await/issue-68112.no_drop_tracking.stderr
+++ /dev/null
@@ -1,82 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-68112.rs:37:18
- |
-LL | require_send(send_fut);
- | ^^^^^^^^ future created by async block is not `Send`
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
-note: future is not `Send` as it awaits another future which is not `Send`
- --> $DIR/issue-68112.rs:34:17
- |
-LL | let _ = non_send_fut.await;
- | ^^^^^^^^^^^^ await occurs here on type `impl Future<Output = Arc<RefCell<i32>>>`, which is not `Send`
-note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:14:25
- |
-LL | fn require_send(_: impl Send) {}
- | ^^^^ required by this bound in `require_send`
-
-error: future cannot be sent between threads safely
- --> $DIR/issue-68112.rs:46:18
- |
-LL | require_send(send_fut);
- | ^^^^^^^^ future created by async block is not `Send`
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
-note: future is not `Send` as it awaits another future which is not `Send`
- --> $DIR/issue-68112.rs:43:17
- |
-LL | let _ = make_non_send_future1().await;
- | ^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `impl Future<Output = Arc<RefCell<i32>>>`, which is not `Send`
-note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:14:25
- |
-LL | fn require_send(_: impl Send) {}
- | ^^^^ required by this bound in `require_send`
-
-error[E0277]: `RefCell<i32>` cannot be shared between threads safely
- --> $DIR/issue-68112.rs:65:18
- |
-LL | require_send(send_fut);
- | ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
- | |
- | required by a bound introduced by this call
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
- = note: required for `Arc<RefCell<i32>>` to implement `Send`
-note: required because it's used within this `async fn` body
- --> $DIR/issue-68112.rs:50:31
- |
-LL | async fn ready2<T>(t: T) -> T {
- | _______________________________^
-LL | | t
-LL | | }
- | |_^
-note: required because it appears within the type `impl Future<Output = Arc<RefCell<i32>>>`
- --> $DIR/issue-68112.rs:53:31
- |
-LL | fn make_non_send_future2() -> impl Future<Output = Arc<RefCell<i32>>> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: required because it captures the following types: `ResumeTy`, `impl Future<Output = Arc<RefCell<i32>>>`, `()`, `i32`, `Ready<i32>`
-note: required because it's used within this `async` block
- --> $DIR/issue-68112.rs:60:20
- |
-LL | let send_fut = async {
- | ____________________^
-LL | | let non_send_fut = make_non_send_future2();
-LL | | let _ = non_send_fut.await;
-LL | | ready(0).await;
-LL | | };
- | |_____^
-note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:14:25
- |
-LL | fn require_send(_: impl Send) {}
- | ^^^^ required by this bound in `require_send`
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/issue-68112.rs b/tests/ui/async-await/issue-68112.rs
index 19119ae0f..fd6089e0c 100644
--- a/tests/ui/async-await/issue-68112.rs
+++ b/tests/ui/async-await/issue-68112.rs
@@ -1,7 +1,4 @@
// edition:2018
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
use std::{
cell::RefCell,
diff --git a/tests/ui/async-await/issue-68112.drop_tracking_mir.stderr b/tests/ui/async-await/issue-68112.stderr
index 7a9242cba..17b619ebe 100644
--- a/tests/ui/async-await/issue-68112.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/issue-68112.stderr
@@ -1,5 +1,5 @@
error: future cannot be sent between threads safely
- --> $DIR/issue-68112.rs:37:5
+ --> $DIR/issue-68112.rs:34:5
|
LL | require_send(send_fut);
| ^^^^^^^^^^^^ future created by async block is not `Send`
@@ -7,18 +7,18 @@ LL | require_send(send_fut);
= help: the trait `Sync` is not implemented for `RefCell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
note: future is not `Send` as it awaits another future which is not `Send`
- --> $DIR/issue-68112.rs:34:17
+ --> $DIR/issue-68112.rs:31:17
|
LL | let _ = non_send_fut.await;
| ^^^^^^^^^^^^ await occurs here on type `impl Future<Output = Arc<RefCell<i32>>>`, which is not `Send`
note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:14:25
+ --> $DIR/issue-68112.rs:11:25
|
LL | fn require_send(_: impl Send) {}
| ^^^^ required by this bound in `require_send`
error: future cannot be sent between threads safely
- --> $DIR/issue-68112.rs:46:5
+ --> $DIR/issue-68112.rs:43:5
|
LL | require_send(send_fut);
| ^^^^^^^^^^^^ future created by async block is not `Send`
@@ -26,18 +26,18 @@ LL | require_send(send_fut);
= help: the trait `Sync` is not implemented for `RefCell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
note: future is not `Send` as it awaits another future which is not `Send`
- --> $DIR/issue-68112.rs:43:17
+ --> $DIR/issue-68112.rs:40:17
|
LL | let _ = make_non_send_future1().await;
| ^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `impl Future<Output = Arc<RefCell<i32>>>`, which is not `Send`
note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:14:25
+ --> $DIR/issue-68112.rs:11:25
|
LL | fn require_send(_: impl Send) {}
| ^^^^ required by this bound in `require_send`
error[E0277]: `RefCell<i32>` cannot be shared between threads safely
- --> $DIR/issue-68112.rs:65:5
+ --> $DIR/issue-68112.rs:62:5
|
LL | require_send(send_fut);
| ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
@@ -46,7 +46,7 @@ LL | require_send(send_fut);
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
= note: required for `Arc<RefCell<i32>>` to implement `Send`
note: required because it's used within this `async fn` body
- --> $DIR/issue-68112.rs:50:31
+ --> $DIR/issue-68112.rs:47:31
|
LL | async fn ready2<T>(t: T) -> T {
| _______________________________^
@@ -54,13 +54,13 @@ LL | | t
LL | | }
| |_^
note: required because it appears within the type `impl Future<Output = Arc<RefCell<i32>>>`
- --> $DIR/issue-68112.rs:53:31
+ --> $DIR/issue-68112.rs:50:31
|
LL | fn make_non_send_future2() -> impl Future<Output = Arc<RefCell<i32>>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: required because it captures the following types: `impl Future<Output = Arc<RefCell<i32>>>`, `Ready<i32>`
note: required because it's used within this `async` block
- --> $DIR/issue-68112.rs:60:20
+ --> $DIR/issue-68112.rs:57:20
|
LL | let send_fut = async {
| ____________________^
@@ -70,7 +70,7 @@ LL | | ready(0).await;
LL | | };
| |_____^
note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:14:25
+ --> $DIR/issue-68112.rs:11:25
|
LL | fn require_send(_: impl Send) {}
| ^^^^ required by this bound in `require_send`
diff --git a/tests/ui/async-await/issue-68523-start.rs b/tests/ui/async-await/issue-68523-start.rs
index 2ced88a16..5adc28b20 100644
--- a/tests/ui/async-await/issue-68523-start.rs
+++ b/tests/ui/async-await/issue-68523-start.rs
@@ -4,6 +4,6 @@
#[start]
pub async fn start(_: isize, _: *const *const u8) -> isize {
-//~^ ERROR `start` is not allowed to be `async`
+//~^ ERROR `#[start]` function is not allowed to be `async`
0
}
diff --git a/tests/ui/async-await/issue-68523-start.stderr b/tests/ui/async-await/issue-68523-start.stderr
index 3a0a3b5de..7c06fe340 100644
--- a/tests/ui/async-await/issue-68523-start.stderr
+++ b/tests/ui/async-await/issue-68523-start.stderr
@@ -1,8 +1,8 @@
-error[E0752]: `start` is not allowed to be `async`
+error[E0752]: `#[start]` function is not allowed to be `async`
--> $DIR/issue-68523-start.rs:6:1
|
LL | pub async fn start(_: isize, _: *const *const u8) -> isize {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `start` is not allowed to be `async`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `#[start]` is not allowed to be `async`
error: aborting due to previous error
diff --git a/tests/ui/async-await/issue-70818.drop_tracking.stderr b/tests/ui/async-await/issue-70818.drop_tracking.stderr
deleted file mode 100644
index ab0698c3e..000000000
--- a/tests/ui/async-await/issue-70818.drop_tracking.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-70818.rs:7:38
- |
-LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
- |
-note: captured value is not `Send`
- --> $DIR/issue-70818.rs:9:18
- |
-LL | async { (ty, ty1) }
- | ^^^ has type `U` which is not `Send`
-help: consider restricting type parameter `U`
- |
-LL | fn foo<T: Send, U: std::marker::Send>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
- | +++++++++++++++++++
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-70818.no_drop_tracking.stderr b/tests/ui/async-await/issue-70818.no_drop_tracking.stderr
deleted file mode 100644
index ab0698c3e..000000000
--- a/tests/ui/async-await/issue-70818.no_drop_tracking.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-70818.rs:7:38
- |
-LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
- |
-note: captured value is not `Send`
- --> $DIR/issue-70818.rs:9:18
- |
-LL | async { (ty, ty1) }
- | ^^^ has type `U` which is not `Send`
-help: consider restricting type parameter `U`
- |
-LL | fn foo<T: Send, U: std::marker::Send>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
- | +++++++++++++++++++
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-70818.rs b/tests/ui/async-await/issue-70818.rs
index 2941de0f5..019c56eb2 100644
--- a/tests/ui/async-await/issue-70818.rs
+++ b/tests/ui/async-await/issue-70818.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
use std::future::Future;
diff --git a/tests/ui/async-await/issue-70818.drop_tracking_mir.stderr b/tests/ui/async-await/issue-70818.stderr
index ab0698c3e..20109d4d1 100644
--- a/tests/ui/async-await/issue-70818.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/issue-70818.stderr
@@ -1,11 +1,11 @@
error: future cannot be sent between threads safely
- --> $DIR/issue-70818.rs:7:38
+ --> $DIR/issue-70818.rs:4:38
|
LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
|
note: captured value is not `Send`
- --> $DIR/issue-70818.rs:9:18
+ --> $DIR/issue-70818.rs:6:18
|
LL | async { (ty, ty1) }
| ^^^ has type `U` which is not `Send`
diff --git a/tests/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr b/tests/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr
deleted file mode 100644
index f80bb4242..000000000
--- a/tests/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr
+++ /dev/null
@@ -1,41 +0,0 @@
-error[E0277]: `*mut ()` cannot be shared between threads safely
- --> $DIR/issue-70935-complex-spans.rs:18:23
- |
-LL | fn foo(x: NotSync) -> impl Future + Send {
- | ^^^^^^^^^^^^^^^^^^ `*mut ()` cannot be shared between threads safely
- |
- = help: within `NotSync`, the trait `Sync` is not implemented for `*mut ()`
-note: required because it appears within the type `PhantomData<*mut ()>`
- --> $SRC_DIR/core/src/marker.rs:LL:COL
-note: required because it appears within the type `NotSync`
- --> $DIR/issue-70935-complex-spans.rs:12:8
- |
-LL | struct NotSync(PhantomData<*mut ()>);
- | ^^^^^^^
- = note: required for `&NotSync` to implement `Send`
-note: required because it's used within this closure
- --> $DIR/issue-70935-complex-spans.rs:22:13
- |
-LL | baz(|| async {
- | ^^
-note: required because it's used within this `async fn` body
- --> $DIR/issue-70935-complex-spans.rs:15:67
- |
-LL | async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> {
- | ___________________________________________________________________^
-LL | | }
- | |_^
- = note: required because it captures the following types: `ResumeTy`, `impl Future<Output = ()>`, `()`
-note: required because it's used within this `async` block
- --> $DIR/issue-70935-complex-spans.rs:21:5
- |
-LL | / async move {
-LL | | baz(|| async {
-LL | | foo(x.clone());
-LL | | }).await;
-LL | | }
- | |_____^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr b/tests/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr
deleted file mode 100644
index d8ef6a5ee..000000000
--- a/tests/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-70935-complex-spans.rs:18:23
- |
-LL | fn foo(x: NotSync) -> impl Future + Send {
- | ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
- |
- = help: within `NotSync`, the trait `Sync` is not implemented for `*mut ()`
-note: future is not `Send` as this value is used across an await
- --> $DIR/issue-70935-complex-spans.rs:24:12
- |
-LL | baz(|| async {
- | _____________-
-LL | | foo(x.clone());
-LL | | }).await;
- | | - ^^^^^- the value is later dropped here
- | | | |
- | |_________| await occurs here, with the value maybe used later
- | has type `[closure@$DIR/issue-70935-complex-spans.rs:22:13: 22:15]` which is not `Send`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-70935-complex-spans.rs b/tests/ui/async-await/issue-70935-complex-spans.rs
index 9ebde1d39..4af737395 100644
--- a/tests/ui/async-await/issue-70935-complex-spans.rs
+++ b/tests/ui/async-await/issue-70935-complex-spans.rs
@@ -1,7 +1,4 @@
// edition:2018
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// #70935: Check if we do not emit snippet
// with newlines which lead complex diagnostics.
@@ -16,8 +13,7 @@ async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> {
}
fn foo(x: NotSync) -> impl Future + Send {
- //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
- //[drop_tracking,drop_tracking_mir]~^^ ERROR `*mut ()` cannot be shared between threads
+ //~^ ERROR `*mut ()` cannot be shared between threads safely
async move {
baz(|| async {
foo(x.clone());
diff --git a/tests/ui/async-await/issue-70935-complex-spans.drop_tracking_mir.stderr b/tests/ui/async-await/issue-70935-complex-spans.stderr
index eb9d93e22..ab834daa8 100644
--- a/tests/ui/async-await/issue-70935-complex-spans.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/issue-70935-complex-spans.stderr
@@ -1,5 +1,5 @@
error[E0277]: `*mut ()` cannot be shared between threads safely
- --> $DIR/issue-70935-complex-spans.rs:18:23
+ --> $DIR/issue-70935-complex-spans.rs:15:23
|
LL | fn foo(x: NotSync) -> impl Future + Send {
| ^^^^^^^^^^^^^^^^^^ `*mut ()` cannot be shared between threads safely
@@ -8,18 +8,18 @@ LL | fn foo(x: NotSync) -> impl Future + Send {
note: required because it appears within the type `PhantomData<*mut ()>`
--> $SRC_DIR/core/src/marker.rs:LL:COL
note: required because it appears within the type `NotSync`
- --> $DIR/issue-70935-complex-spans.rs:12:8
+ --> $DIR/issue-70935-complex-spans.rs:9:8
|
LL | struct NotSync(PhantomData<*mut ()>);
| ^^^^^^^
= note: required for `&NotSync` to implement `Send`
note: required because it's used within this closure
- --> $DIR/issue-70935-complex-spans.rs:22:13
+ --> $DIR/issue-70935-complex-spans.rs:18:13
|
LL | baz(|| async {
| ^^
note: required because it's used within this `async fn` body
- --> $DIR/issue-70935-complex-spans.rs:15:67
+ --> $DIR/issue-70935-complex-spans.rs:12:67
|
LL | async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> {
| ___________________________________________________________________^
@@ -27,7 +27,7 @@ LL | | }
| |_^
= note: required because it captures the following types: `impl Future<Output = ()>`
note: required because it's used within this `async` block
- --> $DIR/issue-70935-complex-spans.rs:21:5
+ --> $DIR/issue-70935-complex-spans.rs:17:5
|
LL | / async move {
LL | | baz(|| async {
diff --git a/tests/ui/async-await/issue-71137.stderr b/tests/ui/async-await/issue-71137.stderr
index a344246d6..443af010c 100644
--- a/tests/ui/async-await/issue-71137.stderr
+++ b/tests/ui/async-await/issue-71137.stderr
@@ -12,9 +12,6 @@ LL | let mut guard = m.lock().unwrap();
| --------- has type `MutexGuard<'_, i32>` which is not `Send`
LL | (async { "right"; }).await;
| ^^^^^ await occurs here, with `mut guard` maybe used later
-LL | *guard += 1;
-LL | }
- | - `mut guard` is later dropped here
note: required by a bound in `fake_spawn`
--> $DIR/issue-71137.rs:8:27
|
diff --git a/tests/ui/async-await/issue-73137.rs b/tests/ui/async-await/issue-73137.rs
index dcbe7765a..c43ce2cad 100644
--- a/tests/ui/async-await/issue-73137.rs
+++ b/tests/ui/async-await/issue-73137.rs
@@ -2,9 +2,6 @@
// run-pass
// edition:2018
-// revisions: normal drop-tracking
-// [normal]compile-flags: -Zdrop-tracking=no
-// [drop-tracking]compile-flags: -Zdrop-tracking
#![allow(dead_code)]
use std::future::Future;
diff --git a/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking.stderr b/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking.stderr
deleted file mode 100644
index 6d19c3beb..000000000
--- a/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0070]: invalid left-hand side of assignment
- --> $DIR/issue-73741-type-err-drop-tracking.rs:11:7
- |
-LL | 1 = 2;
- | - ^
- | |
- | cannot assign to this expression
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0070`.
diff --git a/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking_mir.stderr b/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking_mir.stderr
deleted file mode 100644
index 6d19c3beb..000000000
--- a/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking_mir.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0070]: invalid left-hand side of assignment
- --> $DIR/issue-73741-type-err-drop-tracking.rs:11:7
- |
-LL | 1 = 2;
- | - ^
- | |
- | cannot assign to this expression
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0070`.
diff --git a/tests/ui/async-await/issue-73741-type-err-drop-tracking.no_drop_tracking.stderr b/tests/ui/async-await/issue-73741-type-err-drop-tracking.no_drop_tracking.stderr
deleted file mode 100644
index 6d19c3beb..000000000
--- a/tests/ui/async-await/issue-73741-type-err-drop-tracking.no_drop_tracking.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0070]: invalid left-hand side of assignment
- --> $DIR/issue-73741-type-err-drop-tracking.rs:11:7
- |
-LL | 1 = 2;
- | - ^
- | |
- | cannot assign to this expression
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0070`.
diff --git a/tests/ui/async-await/issue-73741-type-err-drop-tracking.rs b/tests/ui/async-await/issue-73741-type-err-drop-tracking.rs
deleted file mode 100644
index 1fa8d6914..000000000
--- a/tests/ui/async-await/issue-73741-type-err-drop-tracking.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-// edition:2018
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-//
-// Regression test for issue #73741
-// Ensures that we don't emit spurious errors when
-// a type error ocurrs in an `async fn`
-
-async fn weird() {
- 1 = 2; //~ ERROR invalid left-hand side
-
- let mut loop_count = 0;
- async {}.await
-}
-
-fn main() {}
diff --git a/tests/ui/async-await/issue-86507.drop_tracking_mir.stderr b/tests/ui/async-await/issue-86507.drop_tracking_mir.stderr
deleted file mode 100644
index adb7b9bf4..000000000
--- a/tests/ui/async-await/issue-86507.drop_tracking_mir.stderr
+++ /dev/null
@@ -1,23 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-86507.rs:20:13
- |
-LL | / Box::pin(
-LL | | async move {
-LL | | let x = x;
-LL | | }
-LL | | )
- | |_____________^ future created by async block is not `Send`
- |
-note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
- --> $DIR/issue-86507.rs:22:29
- |
-LL | let x = x;
- | ^ has type `&T` which is not `Send`, because `T` is not `Sync`
- = note: required for the cast from `Pin<Box<[async block@$DIR/issue-86507.rs:21:17: 23:18]>>` to `Pin<Box<(dyn Future<Output = ()> + Send + 'async_trait)>>`
-help: consider further restricting this bound
- |
-LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T)
- | +++++++++++++++++++
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-86507.no_drop_tracking.stderr b/tests/ui/async-await/issue-86507.no_drop_tracking.stderr
deleted file mode 100644
index adb7b9bf4..000000000
--- a/tests/ui/async-await/issue-86507.no_drop_tracking.stderr
+++ /dev/null
@@ -1,23 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-86507.rs:20:13
- |
-LL | / Box::pin(
-LL | | async move {
-LL | | let x = x;
-LL | | }
-LL | | )
- | |_____________^ future created by async block is not `Send`
- |
-note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
- --> $DIR/issue-86507.rs:22:29
- |
-LL | let x = x;
- | ^ has type `&T` which is not `Send`, because `T` is not `Sync`
- = note: required for the cast from `Pin<Box<[async block@$DIR/issue-86507.rs:21:17: 23:18]>>` to `Pin<Box<(dyn Future<Output = ()> + Send + 'async_trait)>>`
-help: consider further restricting this bound
- |
-LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T)
- | +++++++++++++++++++
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-86507.rs b/tests/ui/async-await/issue-86507.rs
index 63c298dbe..317f03176 100644
--- a/tests/ui/async-await/issue-86507.rs
+++ b/tests/ui/async-await/issue-86507.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
use ::core::pin::Pin;
diff --git a/tests/ui/async-await/issue-86507.drop_tracking.stderr b/tests/ui/async-await/issue-86507.stderr
index adb7b9bf4..d5a3f72cf 100644
--- a/tests/ui/async-await/issue-86507.drop_tracking.stderr
+++ b/tests/ui/async-await/issue-86507.stderr
@@ -1,5 +1,5 @@
error: future cannot be sent between threads safely
- --> $DIR/issue-86507.rs:20:13
+ --> $DIR/issue-86507.rs:17:13
|
LL | / Box::pin(
LL | | async move {
@@ -9,11 +9,11 @@ LL | | )
| |_____________^ future created by async block is not `Send`
|
note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
- --> $DIR/issue-86507.rs:22:29
+ --> $DIR/issue-86507.rs:19:29
|
LL | let x = x;
| ^ has type `&T` which is not `Send`, because `T` is not `Sync`
- = note: required for the cast from `Pin<Box<[async block@$DIR/issue-86507.rs:21:17: 23:18]>>` to `Pin<Box<(dyn Future<Output = ()> + Send + 'async_trait)>>`
+ = note: required for the cast from `Pin<Box<{async block@$DIR/issue-86507.rs:18:17: 20:18}>>` to `Pin<Box<(dyn Future<Output = ()> + Send + 'async_trait)>>`
help: consider further restricting this bound
|
LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T)
diff --git a/tests/ui/async-await/issue-93197.rs b/tests/ui/async-await/issue-93197.rs
index c627fe17a..05ec013d0 100644
--- a/tests/ui/async-await/issue-93197.rs
+++ b/tests/ui/async-await/issue-93197.rs
@@ -1,7 +1,6 @@
// Regression test for #93197
// check-pass
// edition:2021
-// compile-flags: -Zdrop-tracking
#![feature(try_blocks)]
diff --git a/tests/ui/async-await/issue-93648.rs b/tests/ui/async-await/issue-93648.rs
index ec2249ca5..b27a79a42 100644
--- a/tests/ui/async-await/issue-93648.rs
+++ b/tests/ui/async-await/issue-93648.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2021
// build-pass
diff --git a/tests/ui/async-await/issues/auxiliary/issue_67893.rs b/tests/ui/async-await/issues/auxiliary/issue_67893.rs
index d53944698..efde4d286 100644
--- a/tests/ui/async-await/issues/auxiliary/issue_67893.rs
+++ b/tests/ui/async-await/issues/auxiliary/issue_67893.rs
@@ -1,13 +1,12 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
use std::sync::{Arc, Mutex};
+fn make_arc() -> Arc<Mutex<()>> { unimplemented!() }
+
pub async fn f(_: ()) {}
pub async fn run() {
- let x: Arc<Mutex<()>> = unimplemented!();
+ let x: Arc<Mutex<()>> = make_arc();
f(*x.lock().unwrap()).await;
}
diff --git a/tests/ui/async-await/issues/issue-107280.rs b/tests/ui/async-await/issues/issue-107280.rs
index 85fce8740..81ae9553c 100644
--- a/tests/ui/async-await/issues/issue-107280.rs
+++ b/tests/ui/async-await/issues/issue-107280.rs
@@ -3,11 +3,6 @@
async fn foo() {
inner::<false>().await
//~^ ERROR: function takes 2 generic arguments but 1 generic argument was supplied
- //~| ERROR: type inside `async fn` body must be known in this context
- //~| ERROR: type inside `async fn` body must be known in this context
- //~| ERROR: type inside `async fn` body must be known in this context
- //~| ERROR: type inside `async fn` body must be known in this context
- //~| ERROR: type inside `async fn` body must be known in this context
}
async fn inner<T, const PING: bool>() {}
diff --git a/tests/ui/async-await/issues/issue-107280.stderr b/tests/ui/async-await/issues/issue-107280.stderr
index 2e69862a0..c5fd5c5bf 100644
--- a/tests/ui/async-await/issues/issue-107280.stderr
+++ b/tests/ui/async-await/issues/issue-107280.stderr
@@ -7,7 +7,7 @@ LL | inner::<false>().await
| expected 2 generic arguments
|
note: function defined here, with 2 generic parameters: `T`, `PING`
- --> $DIR/issue-107280.rs:13:10
+ --> $DIR/issue-107280.rs:8:10
|
LL | async fn inner<T, const PING: bool>() {}
| ^^^^^ - ----------------
@@ -16,67 +16,6 @@ help: add missing generic argument
LL | inner::<false, PING>().await
| ++++++
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/issue-107280.rs:4:5
- |
-LL | inner::<false>().await
- | ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
- |
-note: the type is part of the `async fn` body because of this `await`
- --> $DIR/issue-107280.rs:4:22
- |
-LL | inner::<false>().await
- | ^^^^^
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/issue-107280.rs:4:5
- |
-LL | inner::<false>().await
- | ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
- |
-note: the type is part of the `async fn` body because of this `await`
- --> $DIR/issue-107280.rs:4:22
- |
-LL | inner::<false>().await
- | ^^^^^
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/issue-107280.rs:4:5
- |
-LL | inner::<false>().await
- | ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
- |
-note: the type is part of the `async fn` body because of this `await`
- --> $DIR/issue-107280.rs:4:22
- |
-LL | inner::<false>().await
- | ^^^^^
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/issue-107280.rs:4:5
- |
-LL | inner::<false>().await
- | ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
- |
-note: the type is part of the `async fn` body because of this `await`
- --> $DIR/issue-107280.rs:4:22
- |
-LL | inner::<false>().await
- | ^^^^^
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/issue-107280.rs:4:5
- |
-LL | inner::<false>().await
- | ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
- |
-note: the type is part of the `async fn` body because of this `await`
- --> $DIR/issue-107280.rs:4:22
- |
-LL | inner::<false>().await
- | ^^^^^
-
-error: aborting due to 6 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0107, E0698.
-For more information about an error, try `rustc --explain E0107`.
+For more information about this error, try `rustc --explain E0107`.
diff --git a/tests/ui/async-await/issues/issue-62009-1.stderr b/tests/ui/async-await/issues/issue-62009-1.stderr
index 53d0577a1..bb617d090 100644
--- a/tests/ui/async-await/issues/issue-62009-1.stderr
+++ b/tests/ui/async-await/issues/issue-62009-1.stderr
@@ -24,18 +24,18 @@ LL | fn main() {
LL | (|_| 2333).await;
| ^^^^^ only allowed inside `async` functions and blocks
-error[E0277]: `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` is not a future
+error[E0277]: `{closure@$DIR/issue-62009-1.rs:12:6: 12:9}` is not a future
--> $DIR/issue-62009-1.rs:12:16
|
LL | (|_| 2333).await;
| -^^^^^
| ||
- | |`[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` is not a future
+ | |`{closure@$DIR/issue-62009-1.rs:12:6: 12:9}` is not a future
| help: remove the `.await`
|
- = help: the trait `Future` is not implemented for closure `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]`
- = note: [closure@$DIR/issue-62009-1.rs:12:6: 12:9] must be a future or must implement `IntoFuture` to be awaited
- = note: required for `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` to implement `IntoFuture`
+ = help: the trait `Future` is not implemented for closure `{closure@$DIR/issue-62009-1.rs:12:6: 12:9}`
+ = note: {closure@$DIR/issue-62009-1.rs:12:6: 12:9} must be a future or must implement `IntoFuture` to be awaited
+ = note: required for `{closure@$DIR/issue-62009-1.rs:12:6: 12:9}` to implement `IntoFuture`
error: aborting due to 4 previous errors
diff --git a/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr b/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr
deleted file mode 100644
index 53d326202..000000000
--- a/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr
+++ /dev/null
@@ -1,32 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-65436-raw-ptr-not-send.rs:17:17
- |
-LL | assert_send(async {
- | _________________^
-LL | |
-LL | | bar(Foo(std::ptr::null())).await;
-LL | | })
- | |_____^ future created by async block is not `Send`
- |
- = help: within `[async block@$DIR/issue-65436-raw-ptr-not-send.rs:17:17: 20:6]`, the trait `Send` is not implemented for `*const u8`
-note: future is not `Send` as this value is used across an await
- --> $DIR/issue-65436-raw-ptr-not-send.rs:19:36
- |
-LL | bar(Foo(std::ptr::null())).await;
- | ---------------- ^^^^^- `std::ptr::null()` is later dropped here
- | | |
- | | await occurs here, with `std::ptr::null()` maybe used later
- | has type `*const u8` which is not `Send`
-help: consider moving this into a `let` binding to create a shorter lived borrow
- --> $DIR/issue-65436-raw-ptr-not-send.rs:19:13
- |
-LL | bar(Foo(std::ptr::null())).await;
- | ^^^^^^^^^^^^^^^^^^^^^
-note: required by a bound in `assert_send`
- --> $DIR/issue-65436-raw-ptr-not-send.rs:14:19
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs b/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs
index d7ef92951..ef6f105f3 100644
--- a/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs
+++ b/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs
@@ -1,9 +1,5 @@
// edition:2018
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-// [drop_tracking] check-pass
-// [drop_tracking_mir] check-pass
+// check-pass
struct Foo(*const u8);
@@ -15,7 +11,6 @@ fn assert_send<T: Send>(_: T) {}
fn main() {
assert_send(async {
- //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
bar(Foo(std::ptr::null())).await;
})
}
diff --git a/tests/ui/async-await/issues/issue-66695-static-refs.rs b/tests/ui/async-await/issues/issue-66695-static-refs.rs
index f0609713b..1b0e1c6c9 100644
--- a/tests/ui/async-await/issues/issue-66695-static-refs.rs
+++ b/tests/ui/async-await/issues/issue-66695-static-refs.rs
@@ -1,12 +1,15 @@
// build-pass
// edition:2018
+#![feature(if_let_guard)]
+
static A: [i32; 5] = [1, 2, 3, 4, 5];
async fn fun() {
let u = A[async { 1 }.await];
match A {
i if async { true }.await => (),
+ i if let Some(1) = async { Some(1) }.await => (),
_ => (),
}
}
@@ -18,6 +21,7 @@ fn main() {
async {
match A {
i if async { true }.await => (),
+ i if let Some(2) = async { Some(2) }.await => (),
_ => (),
}
};
diff --git a/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs b/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs
index c4f8f607d..caed76269 100644
--- a/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs
+++ b/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs
@@ -1,9 +1,7 @@
// build-pass
// edition:2018
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
+#![feature(if_let_guard)]
static mut A: [i32; 5] = [1, 2, 3, 4, 5];
@@ -14,6 +12,7 @@ async fn fun() {
unsafe {
match A {
i if async { true }.await => (),
+ i if let Some(1) = async { Some(1) }.await => (),
_ => (),
}
}
@@ -27,6 +26,7 @@ fn main() {
unsafe {
match A {
i if async { true }.await => (),
+ i if let Some(2) = async { Some(2) }.await => (),
_ => (),
}
}
diff --git a/tests/ui/async-await/issues/issue-67893.rs b/tests/ui/async-await/issues/issue-67893.rs
index d73772e5f..359c75f17 100644
--- a/tests/ui/async-await/issues/issue-67893.rs
+++ b/tests/ui/async-await/issues/issue-67893.rs
@@ -7,5 +7,5 @@ fn g(_: impl Send) {}
fn main() {
g(issue_67893::run())
- //~^ ERROR future cannot be sent between threads safely
+ //~^ ERROR `MutexGuard<'_, ()>` cannot be sent between threads safely
}
diff --git a/tests/ui/async-await/issues/issue-67893.stderr b/tests/ui/async-await/issues/issue-67893.stderr
index c941b9eeb..f36269e8f 100644
--- a/tests/ui/async-await/issues/issue-67893.stderr
+++ b/tests/ui/async-await/issues/issue-67893.stderr
@@ -1,18 +1,27 @@
-error: future cannot be sent between threads safely
+error[E0277]: `MutexGuard<'_, ()>` cannot be sent between threads safely
--> $DIR/issue-67893.rs:9:7
|
LL | g(issue_67893::run())
- | ^^^^^^^^^^^^^^^^^^ future is not `Send`
+ | - ^^^^^^^^^^^^^^^^^^ `MutexGuard<'_, ()>` cannot be sent between threads safely
+ | |
+ | required by a bound introduced by this call
+ |
+ ::: $DIR/auxiliary/issue_67893.rs:9:20
+ |
+LL | pub async fn run() {
+ | - within this `impl Future<Output = ()>`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, ()>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/auxiliary/issue_67893.rs:12:27
+ = note: required because it captures the following types: `Arc<Mutex<()>>`, `MutexGuard<'_, ()>`, `impl Future<Output = ()>`
+note: required because it's used within this `async fn` body
+ --> $DIR/auxiliary/issue_67893.rs:9:20
|
-LL | f(*x.lock().unwrap()).await;
- | ----------------- ^^^^^- `x.lock().unwrap()` is later dropped here
- | | |
- | | await occurs here, with `x.lock().unwrap()` maybe used later
- | has type `MutexGuard<'_, ()>` which is not `Send`
+LL | pub async fn run() {
+ | ____________________^
+LL | | let x: Arc<Mutex<()>> = make_arc();
+LL | | f(*x.lock().unwrap()).await;
+LL | | }
+ | |_^
note: required by a bound in `g`
--> $DIR/issue-67893.rs:6:14
|
@@ -21,3 +30,4 @@ LL | fn g(_: impl Send) {}
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/issues/issue-78600.rs b/tests/ui/async-await/issues/issue-78600.rs
index 8aaeaecf3..4303fc795 100644
--- a/tests/ui/async-await/issues/issue-78600.rs
+++ b/tests/ui/async-await/issues/issue-78600.rs
@@ -1,10 +1,10 @@
+// check-pass
// edition:2018
struct S<'a>(&'a i32);
impl<'a> S<'a> {
async fn new(i: &'a i32) -> Result<Self, ()> {
- //~^ ERROR: `async fn`
Ok(S(&22))
}
}
diff --git a/tests/ui/async-await/issues/issue-78600.stderr b/tests/ui/async-await/issues/issue-78600.stderr
deleted file mode 100644
index 37eafa996..000000000
--- a/tests/ui/async-await/issues/issue-78600.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0658]: `async fn` return type cannot contain a projection or `Self` that references lifetimes from a parent scope
- --> $DIR/issue-78600.rs:6:33
- |
-LL | async fn new(i: &'a i32) -> Result<Self, ()> {
- | ^^^^^^^----^^^^^
- | |
- | help: consider spelling out the type instead: `S<'a>`
- |
- = note: see issue #103532 <https://github.com/rust-lang/rust/issues/103532> for more information
- = help: add `#![feature(impl_trait_projections)]` 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/async-await/missed-capture-issue-107414.rs b/tests/ui/async-await/missed-capture-issue-107414.rs
index 0ab4f5ade..bb14eb74b 100644
--- a/tests/ui/async-await/missed-capture-issue-107414.rs
+++ b/tests/ui/async-await/missed-capture-issue-107414.rs
@@ -1,6 +1,8 @@
// check-pass
// edition:2018
+#![feature(if_let_guard)]
+
fn main() {}
struct StructA {}
@@ -22,3 +24,10 @@ async fn ice() {
_ => {}
}
}
+
+async fn if_let() {
+ match Some(StructB {}) {
+ Some(struct_b) if let true = get_struct_a_async().await.fn_taking_struct_b(&struct_b) => {}
+ _ => {}
+ }
+}
diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking.stderr b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking.stderr
deleted file mode 100644
index 8a7317bb9..000000000
--- a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18
- |
-LL | async fn rec_1() {
- | ^ 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[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/mutually-recursive-async-impl-trait-type.rs:13:18
- |
-LL | async fn rec_2() {
- | ^ 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 2 previous errors
-
-For more information about this error, try `rustc --explain E0733`.
diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.no_drop_tracking.stderr b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.no_drop_tracking.stderr
deleted file mode 100644
index 8a7317bb9..000000000
--- a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.no_drop_tracking.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18
- |
-LL | async fn rec_1() {
- | ^ 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[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/mutually-recursive-async-impl-trait-type.rs:13:18
- |
-LL | async fn rec_2() {
- | ^ 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 2 previous errors
-
-For more information about this error, try `rustc --explain E0733`.
diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs
index a241f30e7..bb2a61f03 100644
--- a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs
+++ b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs
@@ -1,7 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-
// edition:2018
// Test that impl trait does not allow creating recursive types that are
// otherwise forbidden when using `async` and `await`.
diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking_mir.stderr b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr
index 8a7317bb9..f789ad2a0 100644
--- a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr
@@ -1,5 +1,5 @@
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18
+ --> $DIR/mutually-recursive-async-impl-trait-type.rs:5:18
|
LL | async fn rec_1() {
| ^ recursive `async fn`
@@ -8,7 +8,7 @@ LL | async fn rec_1() {
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/mutually-recursive-async-impl-trait-type.rs:13:18
+ --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18
|
LL | async fn rec_2() {
| ^ recursive `async fn`
diff --git a/tests/ui/async-await/non-trivial-drop.rs b/tests/ui/async-await/non-trivial-drop.rs
index 258da0756..3fed7c972 100644
--- a/tests/ui/async-await/non-trivial-drop.rs
+++ b/tests/ui/async-await/non-trivial-drop.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// build-pass
// edition:2018
diff --git a/tests/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr b/tests/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr
deleted file mode 100644
index 17b4ef7bd..000000000
--- a/tests/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr
+++ /dev/null
@@ -1,35 +0,0 @@
-error[E0277]: `NotSend` cannot be sent between threads safely
- --> $DIR/partial-drop-partial-reinit.rs:9:16
- |
-LL | gimme_send(foo());
- | ---------- ^^^^^ `NotSend` cannot be sent between threads safely
- | |
- | required by a bound introduced by this call
-...
-LL | async fn foo() {
- | - within this `impl Future<Output = ()>`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `NotSend`
- = note: required because it appears within the type `(NotSend,)`
- = note: required because it captures the following types: `ResumeTy`, `(NotSend,)`, `()`, `impl Future<Output = ()>`
-note: required because it's used within this `async fn` body
- --> $DIR/partial-drop-partial-reinit.rs:31:16
- |
-LL | async fn foo() {
- | ________________^
-LL | |
-LL | |
-LL | | let mut x = (NotSend {},);
-... |
-LL | | bar().await;
-LL | | }
- | |_^
-note: required by a bound in `gimme_send`
- --> $DIR/partial-drop-partial-reinit.rs:17:18
- |
-LL | fn gimme_send<T: Send>(t: T) {
- | ^^^^ required by this bound in `gimme_send`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/partial-drop-partial-reinit.rs b/tests/ui/async-await/partial-drop-partial-reinit.rs
index 7d097e72f..75acb442e 100644
--- a/tests/ui/async-await/partial-drop-partial-reinit.rs
+++ b/tests/ui/async-await/partial-drop-partial-reinit.rs
@@ -1,7 +1,4 @@
// edition:2021
-// revisions: no_drop_tracking drop_tracking
-// [drop_tracking] compile-flags: -Zdrop-tracking=yes
-// [no_drop_tracking] compile-flags: -Zdrop-tracking=no
#![feature(negative_impls)]
#![allow(unused)]
diff --git a/tests/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr b/tests/ui/async-await/partial-drop-partial-reinit.stderr
index 34d8a159f..85e1830c7 100644
--- a/tests/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr
+++ b/tests/ui/async-await/partial-drop-partial-reinit.stderr
@@ -1,5 +1,5 @@
error[E0277]: `NotSend` cannot be sent between threads safely
- --> $DIR/partial-drop-partial-reinit.rs:9:16
+ --> $DIR/partial-drop-partial-reinit.rs:6:16
|
LL | gimme_send(foo());
| ---------- ^^^^^ `NotSend` cannot be sent between threads safely
@@ -11,9 +11,9 @@ LL | async fn foo() {
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `NotSend`
= note: required because it appears within the type `(NotSend,)`
- = note: required because it captures the following types: `ResumeTy`, `(NotSend,)`, `impl Future<Output = ()>`, `()`
+ = note: required because it captures the following types: `(NotSend,)`, `impl Future<Output = ()>`
note: required because it's used within this `async fn` body
- --> $DIR/partial-drop-partial-reinit.rs:31:16
+ --> $DIR/partial-drop-partial-reinit.rs:28:16
|
LL | async fn foo() {
| ________________^
@@ -25,7 +25,7 @@ LL | | bar().await;
LL | | }
| |_^
note: required by a bound in `gimme_send`
- --> $DIR/partial-drop-partial-reinit.rs:17:18
+ --> $DIR/partial-drop-partial-reinit.rs:14:18
|
LL | fn gimme_send<T: Send>(t: T) {
| ^^^^ required by this bound in `gimme_send`
diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking.stderr b/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking.stderr
deleted file mode 100644
index 7e63a8da5..000000000
--- a/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/recursive-async-impl-trait-type.rs:8:40
- |
-LL | async fn recursive_async_function() -> () {
- | ^^ 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/recursive-async-impl-trait-type.no_drop_tracking.stderr b/tests/ui/async-await/recursive-async-impl-trait-type.no_drop_tracking.stderr
deleted file mode 100644
index 7e63a8da5..000000000
--- a/tests/ui/async-await/recursive-async-impl-trait-type.no_drop_tracking.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/recursive-async-impl-trait-type.rs:8:40
- |
-LL | async fn recursive_async_function() -> () {
- | ^^ 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/recursive-async-impl-trait-type.rs b/tests/ui/async-await/recursive-async-impl-trait-type.rs
index 60b34d3a1..edc4cb8ac 100644
--- a/tests/ui/async-await/recursive-async-impl-trait-type.rs
+++ b/tests/ui/async-await/recursive-async-impl-trait-type.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
// Test that impl trait does not allow creating recursive types that are
// otherwise forbidden when using `async` and `await`.
diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking_mir.stderr b/tests/ui/async-await/recursive-async-impl-trait-type.stderr
index 7e63a8da5..63f64f445 100644
--- a/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/recursive-async-impl-trait-type.stderr
@@ -1,5 +1,5 @@
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/recursive-async-impl-trait-type.rs:8:40
+ --> $DIR/recursive-async-impl-trait-type.rs:5:40
|
LL | async fn recursive_async_function() -> () {
| ^^ recursive `async fn`
diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.current.stderr b/tests/ui/async-await/return-type-notation/issue-110963-early.current.stderr
index 1b847b59e..77385e966 100644
--- a/tests/ui/async-await/return-type-notation/issue-110963-early.current.stderr
+++ b/tests/ui/async-await/return-type-notation/issue-110963-early.current.stderr
@@ -7,7 +7,7 @@ LL | #![feature(return_type_notation)]
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
-error: higher-ranked lifetime error
+error[E0308]: mismatched types
--> $DIR/issue-110963-early.rs:17:5
|
LL | / spawn(async move {
@@ -16,11 +16,17 @@ LL | | if !hc.check().await {
LL | | log_health_check_failure().await;
LL | | }
LL | | });
- | |______^
+ | |______^ one type is more general than the other
|
- = note: could not prove `[async block@$DIR/issue-110963-early.rs:17:11: 22:6]: Send`
+ = note: expected trait `Send`
+ found trait `for<'a> Send`
+note: the lifetime requirement is introduced here
+ --> $DIR/issue-110963-early.rs:37:17
+ |
+LL | F: Future + Send + 'static,
+ | ^^^^
-error: higher-ranked lifetime error
+error[E0308]: mismatched types
--> $DIR/issue-110963-early.rs:17:5
|
LL | / spawn(async move {
@@ -29,9 +35,16 @@ LL | | if !hc.check().await {
LL | | log_health_check_failure().await;
LL | | }
LL | | });
- | |______^
+ | |______^ one type is more general than the other
+ |
+ = note: expected trait `Send`
+ found trait `for<'a> Send`
+note: the lifetime requirement is introduced here
+ --> $DIR/issue-110963-early.rs:37:17
|
- = note: could not prove `[async block@$DIR/issue-110963-early.rs:17:11: 22:6]: Send`
+LL | F: Future + Send + 'static,
+ | ^^^^
error: aborting due to 2 previous errors; 1 warning emitted
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.next.stderr b/tests/ui/async-await/return-type-notation/issue-110963-early.next.stderr
index 1b847b59e..77385e966 100644
--- a/tests/ui/async-await/return-type-notation/issue-110963-early.next.stderr
+++ b/tests/ui/async-await/return-type-notation/issue-110963-early.next.stderr
@@ -7,7 +7,7 @@ LL | #![feature(return_type_notation)]
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
-error: higher-ranked lifetime error
+error[E0308]: mismatched types
--> $DIR/issue-110963-early.rs:17:5
|
LL | / spawn(async move {
@@ -16,11 +16,17 @@ LL | | if !hc.check().await {
LL | | log_health_check_failure().await;
LL | | }
LL | | });
- | |______^
+ | |______^ one type is more general than the other
|
- = note: could not prove `[async block@$DIR/issue-110963-early.rs:17:11: 22:6]: Send`
+ = note: expected trait `Send`
+ found trait `for<'a> Send`
+note: the lifetime requirement is introduced here
+ --> $DIR/issue-110963-early.rs:37:17
+ |
+LL | F: Future + Send + 'static,
+ | ^^^^
-error: higher-ranked lifetime error
+error[E0308]: mismatched types
--> $DIR/issue-110963-early.rs:17:5
|
LL | / spawn(async move {
@@ -29,9 +35,16 @@ LL | | if !hc.check().await {
LL | | log_health_check_failure().await;
LL | | }
LL | | });
- | |______^
+ | |______^ one type is more general than the other
+ |
+ = note: expected trait `Send`
+ found trait `for<'a> Send`
+note: the lifetime requirement is introduced here
+ --> $DIR/issue-110963-early.rs:37:17
|
- = note: could not prove `[async block@$DIR/issue-110963-early.rs:17:11: 22:6]: Send`
+LL | F: Future + Send + 'static,
+ | ^^^^
error: aborting due to 2 previous errors; 1 warning emitted
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.stderr b/tests/ui/async-await/return-type-notation/issue-110963-early.stderr
index 33e22dec3..969094a2c 100644
--- a/tests/ui/async-await/return-type-notation/issue-110963-early.stderr
+++ b/tests/ui/async-await/return-type-notation/issue-110963-early.stderr
@@ -7,7 +7,7 @@ LL | #![feature(return_type_notation)]
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
-error: higher-ranked lifetime error
+error[E0308]: mismatched types
--> $DIR/issue-110963-early.rs:15:5
|
LL | / spawn(async move {
@@ -16,11 +16,17 @@ LL | | if !hc.check().await {
LL | | log_health_check_failure().await;
LL | | }
LL | | });
- | |______^
+ | |______^ one type is more general than the other
|
- = note: could not prove `[async block@$DIR/issue-110963-early.rs:15:11: 20:6]: Send`
+ = note: expected trait `Send`
+ found trait `for<'a> Send`
+note: the lifetime requirement is introduced here
+ --> $DIR/issue-110963-early.rs:35:17
+ |
+LL | F: Future + Send + 'static,
+ | ^^^^
-error: higher-ranked lifetime error
+error[E0308]: mismatched types
--> $DIR/issue-110963-early.rs:15:5
|
LL | / spawn(async move {
@@ -29,9 +35,16 @@ LL | | if !hc.check().await {
LL | | log_health_check_failure().await;
LL | | }
LL | | });
- | |______^
+ | |______^ one type is more general than the other
+ |
+ = note: expected trait `Send`
+ found trait `for<'a> Send`
+note: the lifetime requirement is introduced here
+ --> $DIR/issue-110963-early.rs:35:17
|
- = note: could not prove `[async block@$DIR/issue-110963-early.rs:15:11: 20:6]: Send`
+LL | F: Future + Send + 'static,
+ | ^^^^
error: aborting due to 2 previous errors; 1 warning emitted
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr
new file mode 100644
index 000000000..8f4590203
--- /dev/null
+++ b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr
@@ -0,0 +1,35 @@
+warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:8:12
+ |
+LL | #![feature(return_type_notation)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error[E0277]: `impl Future<Output = ()> { <_ as Foo>::bar() }` cannot be sent between threads safely
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:23:11
+ |
+LL | build(Bar);
+ | ----- ^^^ `impl Future<Output = ()> { <_ as Foo>::bar() }` cannot be sent between threads safely
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `for<'a> Send` is not implemented for `impl Future<Output = ()> { <_ as Foo>::bar() }`
+note: this is a known limitation of the trait solver that will be lifted in the future
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:23:11
+ |
+LL | build(Bar);
+ | ------^^^-
+ | | |
+ | | the trait solver is unable to infer the generic types that should be inferred from this argument
+ | add turbofish arguments to this call to specify the types manually, even if it's redundant
+note: required by a bound in `build`
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:20:39
+ |
+LL | fn build<T>(_: T) where T: Foo<bar(): Send> {}
+ | ^^^^ required by this bound in `build`
+
+error: aborting due to previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr
new file mode 100644
index 000000000..6fab71787
--- /dev/null
+++ b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr
@@ -0,0 +1,11 @@
+warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:8:12
+ |
+LL | #![feature(return_type_notation)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs
new file mode 100644
index 000000000..b2cd9707d
--- /dev/null
+++ b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs
@@ -0,0 +1,24 @@
+// revisions: current next
+//[current] known-bug: #109924
+//[next] check-pass
+//[next] compile-flags: -Ztrait-solver=next
+// edition:2021
+
+#![feature(async_fn_in_trait)]
+#![feature(return_type_notation)]
+//[next]~^ WARN the feature `return_type_notation` is incomplete
+
+trait Foo {
+ async fn bar(&self);
+}
+
+struct Bar;
+impl Foo for Bar {
+ async fn bar(&self) {}
+}
+
+fn build<T>(_: T) where T: Foo<bar(): Send> {}
+
+fn main() {
+ build(Bar);
+}
diff --git a/tests/ui/async-await/unresolved_type_param.drop_tracking.stderr b/tests/ui/async-await/unresolved_type_param.drop_tracking.stderr
deleted file mode 100644
index 6b4a3a363..000000000
--- a/tests/ui/async-await/unresolved_type_param.drop_tracking.stderr
+++ /dev/null
@@ -1,39 +0,0 @@
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/unresolved_type_param.rs:12:5
- |
-LL | bar().await;
- | ^^^ cannot infer type for type parameter `T` declared on the function `bar`
- |
-note: the type is part of the `async fn` body because of this `await`
- --> $DIR/unresolved_type_param.rs:12:11
- |
-LL | bar().await;
- | ^^^^^
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/unresolved_type_param.rs:12:5
- |
-LL | bar().await;
- | ^^^ cannot infer type for type parameter `T` declared on the function `bar`
- |
-note: the type is part of the `async fn` body because of this `await`
- --> $DIR/unresolved_type_param.rs:12:11
- |
-LL | bar().await;
- | ^^^^^
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/unresolved_type_param.rs:12:5
- |
-LL | bar().await;
- | ^^^ cannot infer type for type parameter `T` declared on the function `bar`
- |
-note: the type is part of the `async fn` body because of this `await`
- --> $DIR/unresolved_type_param.rs:12:11
- |
-LL | bar().await;
- | ^^^^^
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0698`.
diff --git a/tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr b/tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr
deleted file mode 100644
index 6642e90ac..000000000
--- a/tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr
+++ /dev/null
@@ -1,63 +0,0 @@
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/unresolved_type_param.rs:12:5
- |
-LL | bar().await;
- | ^^^ cannot infer type for type parameter `T` declared on the function `bar`
- |
-note: the type is part of the `async fn` body because of this `await`
- --> $DIR/unresolved_type_param.rs:12:11
- |
-LL | bar().await;
- | ^^^^^
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/unresolved_type_param.rs:12:5
- |
-LL | bar().await;
- | ^^^ cannot infer type for type parameter `T` declared on the function `bar`
- |
-note: the type is part of the `async fn` body because of this `await`
- --> $DIR/unresolved_type_param.rs:12:11
- |
-LL | bar().await;
- | ^^^^^
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/unresolved_type_param.rs:12:5
- |
-LL | bar().await;
- | ^^^ cannot infer type for type parameter `T` declared on the function `bar`
- |
-note: the type is part of the `async fn` body because of this `await`
- --> $DIR/unresolved_type_param.rs:12:11
- |
-LL | bar().await;
- | ^^^^^
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/unresolved_type_param.rs:12:5
- |
-LL | bar().await;
- | ^^^ cannot infer type for type parameter `T` declared on the function `bar`
- |
-note: the type is part of the `async fn` body because of this `await`
- --> $DIR/unresolved_type_param.rs:12:11
- |
-LL | bar().await;
- | ^^^^^
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/unresolved_type_param.rs:12:5
- |
-LL | bar().await;
- | ^^^ cannot infer type for type parameter `T` declared on the function `bar`
- |
-note: the type is part of the `async fn` body because of this `await`
- --> $DIR/unresolved_type_param.rs:12:11
- |
-LL | bar().await;
- | ^^^^^
-
-error: aborting due to 5 previous errors
-
-For more information about this error, try `rustc --explain E0698`.
diff --git a/tests/ui/async-await/unresolved_type_param.rs b/tests/ui/async-await/unresolved_type_param.rs
index ca0a92b94..dd5aa0dd0 100644
--- a/tests/ui/async-await/unresolved_type_param.rs
+++ b/tests/ui/async-await/unresolved_type_param.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// Provoke an unresolved type error (T).
// Error message should pinpoint the type parameter T as needing to be bound
// (rather than give a general error message)
@@ -10,27 +7,6 @@ async fn bar<T>() -> () {}
async fn foo() {
bar().await;
- //[drop_tracking_mir]~^ ERROR type annotations needed
- //[drop_tracking_mir]~| NOTE cannot infer type of the type parameter `T`
- //[no_drop_tracking,drop_tracking]~^^^ ERROR type inside `async fn` body must be known in this context
- //[no_drop_tracking,drop_tracking]~| ERROR type inside `async fn` body must be known in this context
- //[no_drop_tracking,drop_tracking]~| ERROR type inside `async fn` body must be known in this context
- //[no_drop_tracking,drop_tracking]~| NOTE cannot infer type for type parameter `T`
- //[no_drop_tracking,drop_tracking]~| NOTE cannot infer type for type parameter `T`
- //[no_drop_tracking,drop_tracking]~| NOTE cannot infer type for type parameter `T`
- //[no_drop_tracking,drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
- //[no_drop_tracking,drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
- //[no_drop_tracking,drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
- //[no_drop_tracking,drop_tracking]~| NOTE in this expansion of desugaring of `await`
- //[no_drop_tracking,drop_tracking]~| NOTE in this expansion of desugaring of `await`
- //[no_drop_tracking,drop_tracking]~| NOTE in this expansion of desugaring of `await`
- //[no_drop_tracking]~^^^^^^^^^^^^^^^ ERROR type inside `async fn` body must be known in this context
- //[no_drop_tracking]~| ERROR type inside `async fn` body must be known in this context
- //[no_drop_tracking]~| NOTE cannot infer type for type parameter `T`
- //[no_drop_tracking]~| NOTE cannot infer type for type parameter `T`
- //[no_drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
- //[no_drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
- //[no_drop_tracking]~| NOTE in this expansion of desugaring of `await`
- //[no_drop_tracking]~| NOTE in this expansion of desugaring of `await`
+ //~^ ERROR type annotations needed
}
fn main() {}
diff --git a/tests/ui/async-await/unresolved_type_param.drop_tracking_mir.stderr b/tests/ui/async-await/unresolved_type_param.stderr
index 95c799468..45aa76606 100644
--- a/tests/ui/async-await/unresolved_type_param.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/unresolved_type_param.stderr
@@ -1,5 +1,5 @@
error[E0282]: type annotations needed
- --> $DIR/unresolved_type_param.rs:12:5
+ --> $DIR/unresolved_type_param.rs:9:5
|
LL | bar().await;
| ^^^ cannot infer type of the type parameter `T` declared on the function `bar`
diff --git a/tests/ui/async-await/unsized-across-await.rs b/tests/ui/async-await/unsized-across-await.rs
new file mode 100644
index 000000000..32cb4f88e
--- /dev/null
+++ b/tests/ui/async-await/unsized-across-await.rs
@@ -0,0 +1,16 @@
+// edition: 2021
+
+#![feature(unsized_locals)]
+//~^ WARN the feature `unsized_locals` is incomplete
+
+async fn f() {}
+
+async fn g(x: Box<dyn std::fmt::Display>) {
+ let _x = *x;
+ //~^ ERROR the size for values of type `dyn std::fmt::Display` cannot be known at compilation time
+ f().await;
+}
+
+fn main() {
+ let _a = g(Box::new(5));
+}
diff --git a/tests/ui/async-await/unsized-across-await.stderr b/tests/ui/async-await/unsized-across-await.stderr
new file mode 100644
index 000000000..649b12ce5
--- /dev/null
+++ b/tests/ui/async-await/unsized-across-await.stderr
@@ -0,0 +1,21 @@
+warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/unsized-across-await.rs:3:12
+ |
+LL | #![feature(unsized_locals)]
+ | ^^^^^^^^^^^^^^
+ |
+ = note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error[E0277]: the size for values of type `dyn std::fmt::Display` cannot be known at compilation time
+ --> $DIR/unsized-across-await.rs:9:9
+ |
+LL | let _x = *x;
+ | ^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `dyn std::fmt::Display`
+ = note: all values live across `await` must have a statically known size
+
+error: aborting due to previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/attributes/issue-115264-expr-field.rs b/tests/ui/attributes/issue-115264-expr-field.rs
new file mode 100644
index 000000000..f53ac4aee
--- /dev/null
+++ b/tests/ui/attributes/issue-115264-expr-field.rs
@@ -0,0 +1,17 @@
+// Regression test for issue 115264
+// Tests that retrieving the ident of the X::foo field
+// in main() does not cause an ICE
+
+// check-pass
+
+#[allow(dead_code)]
+struct X {
+ foo: i32,
+}
+
+fn main() {
+ let _ = X {
+ #[doc(alias = "StructItem")]
+ foo: 123,
+ };
+}
diff --git a/tests/ui/attributes/issue-115264-pat-field.rs b/tests/ui/attributes/issue-115264-pat-field.rs
new file mode 100644
index 000000000..8c6bbe167
--- /dev/null
+++ b/tests/ui/attributes/issue-115264-pat-field.rs
@@ -0,0 +1,19 @@
+// Regression test for issue 115264
+// Tests that retrieving the ident of 'foo' variable in
+// the pattern inside main() does not cause an ICE
+
+// check-pass
+
+struct X {
+ foo: i32,
+}
+
+#[allow(unused_variables)]
+fn main() {
+ let X {
+ #[doc(alias = "StructItem")]
+ foo
+ } = X {
+ foo: 123
+ };
+}
diff --git a/tests/ui/backtrace.rs b/tests/ui/backtrace.rs
index 66b378f62..84be333be 100644
--- a/tests/ui/backtrace.rs
+++ b/tests/ui/backtrace.rs
@@ -94,27 +94,30 @@ fn runtest(me: &str) {
#[cfg(not(panic = "abort"))]
{
// Make sure a stack trace is printed
- let p = template(me).arg("double-fail").spawn().unwrap();
+ let p = template(me).arg("double-fail").env("RUST_BACKTRACE","0").spawn().unwrap();
let out = p.wait_with_output().unwrap();
assert!(!out.status.success());
let s = str::from_utf8(&out.stderr).unwrap();
// loosened the following from double::h to double:: due to
// spurious failures on mac, 32bit, optimized
- assert!(s.contains("stack backtrace") && contains_verbose_expected(s, "double"),
- "bad output3: {}", s);
+ assert!(
+ s.contains("stack backtrace") &&
+ s.contains("panic in a destructor during cleanup") &&
+ contains_verbose_expected(s, "double"),
+ "bad output3: {}", s
+ );
+ // Make sure it's only one stack trace.
+ assert_eq!(s.split("stack backtrace").count(), 2);
// Make sure a stack trace isn't printed too many times
- //
- // Currently it is printed 3 times ("once", "twice" and "panic in a
- // function that cannot unwind") but in the future the last one may be
- // removed.
+ // even with RUST_BACKTRACE=1. It should be printed twice.
let p = template(me).arg("double-fail")
.env("RUST_BACKTRACE", "1").spawn().unwrap();
let out = p.wait_with_output().unwrap();
assert!(!out.status.success());
let s = str::from_utf8(&out.stderr).unwrap();
let mut i = 0;
- for _ in 0..3 {
+ for _ in 0..2 {
i += s[i + 10..].find("stack backtrace").unwrap() + 10;
}
assert!(s[i + 10..].find("stack backtrace").is_none(),
diff --git a/tests/ui/binding/match-beginning-vert.rs b/tests/ui/binding/match-beginning-vert.rs
index 79267400b..93c08f0b7 100644
--- a/tests/ui/binding/match-beginning-vert.rs
+++ b/tests/ui/binding/match-beginning-vert.rs
@@ -1,4 +1,7 @@
// run-pass
+
+#![feature(if_let_guard)]
+
enum Foo {
A,
B,
@@ -13,6 +16,7 @@ fn main() {
match *foo {
| A => println!("A"),
| B | C if 1 < 2 => println!("BC!"),
+ | D if let 1 = 1 => println!("D!"),
| _ => {},
}
}
diff --git a/tests/ui/block-result/issue-20862.stderr b/tests/ui/block-result/issue-20862.stderr
index 37bad64c5..17b524fe3 100644
--- a/tests/ui/block-result/issue-20862.stderr
+++ b/tests/ui/block-result/issue-20862.stderr
@@ -7,7 +7,7 @@ LL | |y| x + y
| ^^^^^^^^^ expected `()`, found closure
|
= note: expected unit type `()`
- found closure `[closure@$DIR/issue-20862.rs:2:5: 2:8]`
+ found closure `{closure@$DIR/issue-20862.rs:2:5: 2:8}`
error[E0618]: expected function, found `()`
--> $DIR/issue-20862.rs:7:13
diff --git a/tests/ui/borrowck/async-reference-generality.rs b/tests/ui/borrowck/async-reference-generality.rs
index 487d1ac81..668df9ea7 100644
--- a/tests/ui/borrowck/async-reference-generality.rs
+++ b/tests/ui/borrowck/async-reference-generality.rs
@@ -1,5 +1,4 @@
-// check-fail
-// known-bug: #99492
+// check-pass
// edition: 2021
use std::marker::PhantomData;
diff --git a/tests/ui/borrowck/async-reference-generality.stderr b/tests/ui/borrowck/async-reference-generality.stderr
deleted file mode 100644
index af720ad29..000000000
--- a/tests/ui/borrowck/async-reference-generality.stderr
+++ /dev/null
@@ -1,27 +0,0 @@
-error[E0308]: mismatched types
- --> $DIR/async-reference-generality.rs:23:5
- |
-LL | / async {
-LL | | let _x = Struct::<Empty<&'static ()>, _>(PhantomData);
-LL | | async {}.await;
-LL | | }
- | |_____^ one type is more general than the other
- |
- = note: expected reference `&()`
- found reference `&()`
-
-error[E0308]: mismatched types
- --> $DIR/async-reference-generality.rs:23:5
- |
-LL | / async {
-LL | | let _x = Struct::<Empty<&'static ()>, _>(PhantomData);
-LL | | async {}.await;
-LL | | }
- | |_____^ one type is more general than the other
- |
- = note: expected reference `&()`
- found reference `&()`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/borrowck/erase-error-in-mir-drop-tracking.rs b/tests/ui/borrowck/erase-error-in-mir-drop-tracking.rs
deleted file mode 100644
index addbe5d65..000000000
--- a/tests/ui/borrowck/erase-error-in-mir-drop-tracking.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// compile-flags: -Zdrop-tracking-mir
-// edition:2021
-
-use std::future::Future;
-
-trait Client {
- type Connecting<'a>: Future + Send
- where
- Self: 'a;
-
- fn connect(&'_ self) -> Self::Connecting<'a>;
- //~^ ERROR use of undeclared lifetime name `'a`
-}
-
-fn call_connect<C>(c: &'_ C) -> impl '_ + Future + Send
-where
- C: Client + Send + Sync,
-{
- async move { c.connect().await }
- //~^ ERROR `C` does not live long enough
-}
-
-fn main() {}
diff --git a/tests/ui/borrowck/erase-error-in-mir-drop-tracking.stderr b/tests/ui/borrowck/erase-error-in-mir-drop-tracking.stderr
deleted file mode 100644
index 53abe3dc9..000000000
--- a/tests/ui/borrowck/erase-error-in-mir-drop-tracking.stderr
+++ /dev/null
@@ -1,24 +0,0 @@
-error[E0261]: use of undeclared lifetime name `'a`
- --> $DIR/erase-error-in-mir-drop-tracking.rs:11:46
- |
-LL | fn connect(&'_ self) -> Self::Connecting<'a>;
- | ^^ undeclared lifetime
- |
-help: consider introducing lifetime `'a` here
- |
-LL | fn connect<'a>(&'_ self) -> Self::Connecting<'a>;
- | ++++
-help: consider introducing lifetime `'a` here
- |
-LL | trait Client<'a> {
- | ++++
-
-error: `C` does not live long enough
- --> $DIR/erase-error-in-mir-drop-tracking.rs:19:5
- |
-LL | async move { c.connect().await }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0261`.
diff --git a/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.rs b/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.rs
new file mode 100644
index 000000000..4a6c2f9ed
--- /dev/null
+++ b/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.rs
@@ -0,0 +1,16 @@
+#![allow(dead_code)]
+
+fn bar<'a>(_: std::fmt::Arguments<'a>) {}
+fn main() {
+ let x = format_args!("a {} {} {}.", 1, format_args!("b{}!", 2), 3);
+ //~^ ERROR temporary value dropped while borrowed
+
+ bar(x);
+
+ let foo = format_args!("{}", "hi");
+ //~^ ERROR temporary value dropped while borrowed
+ bar(foo);
+
+ let foo = format_args!("hi"); // no placeholder in arguments, so no error
+ bar(foo);
+}
diff --git a/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.stderr b/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.stderr
new file mode 100644
index 000000000..8221505b1
--- /dev/null
+++ b/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.stderr
@@ -0,0 +1,33 @@
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/issue-114374-invalid-help-fmt-args.rs:5:13
+ |
+LL | let x = format_args!("a {} {} {}.", 1, format_args!("b{}!", 2), 3);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
+ | |
+ | creates a temporary value which is freed while still in use
+...
+LL | bar(x);
+ | - borrow later used here
+ |
+ = note: the result of `format_args!` can only be assigned directly if no placeholders in it's arguments are used
+ = note: to learn more, visit <https://doc.rust-lang.org/std/macro.format_args.html>
+ = note: this error originates in the macro `format_args` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/issue-114374-invalid-help-fmt-args.rs:10:15
+ |
+LL | let foo = format_args!("{}", "hi");
+ | ^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
+ | |
+ | creates a temporary value which is freed while still in use
+LL |
+LL | bar(foo);
+ | --- borrow later used here
+ |
+ = note: the result of `format_args!` can only be assigned directly if no placeholders in it's arguments are used
+ = note: to learn more, visit <https://doc.rust-lang.org/std/macro.format_args.html>
+ = note: this error originates in the macro `format_args` (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 E0716`.
diff --git a/tests/ui/borrowck/issue-115259-suggest-iter-mut.fixed b/tests/ui/borrowck/issue-115259-suggest-iter-mut.fixed
new file mode 100644
index 000000000..4653fe737
--- /dev/null
+++ b/tests/ui/borrowck/issue-115259-suggest-iter-mut.fixed
@@ -0,0 +1,20 @@
+// run-rustfix
+#![allow(unused_mut)]
+#![allow(dead_code)]
+
+pub trait Layer {
+ fn process(&mut self) -> u32;
+}
+
+pub struct State {
+ layers: Vec<Box<dyn Layer>>,
+}
+
+impl State {
+ pub fn process(&mut self) -> u32 {
+ self.layers.iter_mut().fold(0, |result, mut layer| result + layer.process())
+ //~^ ERROR cannot borrow `**layer` as mutable, as it is behind a `&` reference
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/issue-115259-suggest-iter-mut.rs b/tests/ui/borrowck/issue-115259-suggest-iter-mut.rs
new file mode 100644
index 000000000..e0f6ab132
--- /dev/null
+++ b/tests/ui/borrowck/issue-115259-suggest-iter-mut.rs
@@ -0,0 +1,20 @@
+// run-rustfix
+#![allow(unused_mut)]
+#![allow(dead_code)]
+
+pub trait Layer {
+ fn process(&mut self) -> u32;
+}
+
+pub struct State {
+ layers: Vec<Box<dyn Layer>>,
+}
+
+impl State {
+ pub fn process(&mut self) -> u32 {
+ self.layers.iter().fold(0, |result, mut layer| result + layer.process())
+ //~^ ERROR cannot borrow `**layer` as mutable, as it is behind a `&` reference
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr b/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr
new file mode 100644
index 000000000..7e0fc2cf2
--- /dev/null
+++ b/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr
@@ -0,0 +1,16 @@
+error[E0596]: cannot borrow `**layer` as mutable, as it is behind a `&` reference
+ --> $DIR/issue-115259-suggest-iter-mut.rs:15:65
+ |
+LL | self.layers.iter().fold(0, |result, mut layer| result + layer.process())
+ | --------- ^^^^^ `layer` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | |
+ | consider changing this binding's type to be: `&mut Box<dyn Layer>`
+ |
+help: you may want to use `iter_mut` here
+ |
+LL | self.layers.iter_mut().fold(0, |result, mut layer| result + layer.process())
+ | ~~~~~~~~
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr b/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr
index f0b574846..3debfb62c 100644
--- a/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr
+++ b/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr
@@ -4,7 +4,7 @@ error: lifetime may not live long enough
LL | let _action = move || {
| -------
| | |
- | | return type of closure `[closure@$DIR/issue-53432-nested-closure-outlives-borrowed-value.rs:4:9: 4:11]` contains a lifetime `'2`
+ | | return type of closure `{closure@$DIR/issue-53432-nested-closure-outlives-borrowed-value.rs:4:9: 4:11}` contains a lifetime `'2`
| lifetime `'1` represents this closure's body
LL | || f() // The `nested` closure
| ^^^^^^ returning this value requires that `'1` must outlive `'2`
diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.fixed b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.fixed
new file mode 100644
index 000000000..f02374d8e
--- /dev/null
+++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.fixed
@@ -0,0 +1,36 @@
+// run-rustfix
+#![allow(unused_mut)]
+#![allow(dead_code)]
+use std::path::PathBuf;
+
+#[derive(Clone)]
+struct Container {
+ things: Vec<PathBuf>,
+}
+
+impl Container {
+ fn things(&mut self) -> &[PathBuf] {
+ &self.things
+ }
+}
+
+// contains containers
+struct ContainerContainer {
+ contained: Vec<Container>,
+}
+
+impl ContainerContainer {
+ fn contained(&self) -> &[Container] {
+ &self.contained
+ }
+
+ fn all_the_things(&mut self) -> &[PathBuf] {
+ let mut vec = self.contained.clone();
+ let _a =
+ vec.iter_mut().flat_map(|container| container.things()).cloned().collect::<Vec<PathBuf>>();
+ //~^ ERROR cannot borrow `*container` as mutable, as it is behind a `&` reference
+ unimplemented!();
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.rs b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.rs
new file mode 100644
index 000000000..2d0b837a9
--- /dev/null
+++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.rs
@@ -0,0 +1,36 @@
+// run-rustfix
+#![allow(unused_mut)]
+#![allow(dead_code)]
+use std::path::PathBuf;
+
+#[derive(Clone)]
+struct Container {
+ things: Vec<PathBuf>,
+}
+
+impl Container {
+ fn things(&mut self) -> &[PathBuf] {
+ &self.things
+ }
+}
+
+// contains containers
+struct ContainerContainer {
+ contained: Vec<Container>,
+}
+
+impl ContainerContainer {
+ fn contained(&self) -> &[Container] {
+ &self.contained
+ }
+
+ fn all_the_things(&mut self) -> &[PathBuf] {
+ let mut vec = self.contained.clone();
+ let _a =
+ vec.iter().flat_map(|container| container.things()).cloned().collect::<Vec<PathBuf>>();
+ //~^ ERROR cannot borrow `*container` as mutable, as it is behind a `&` reference
+ unimplemented!();
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr
new file mode 100644
index 000000000..19f194100
--- /dev/null
+++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr
@@ -0,0 +1,16 @@
+error[E0596]: cannot borrow `*container` as mutable, as it is behind a `&` reference
+ --> $DIR/issue-62387-suggest-iter-mut-2.rs:30:45
+ |
+LL | vec.iter().flat_map(|container| container.things()).cloned().collect::<Vec<PathBuf>>();
+ | --------- ^^^^^^^^^ `container` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | |
+ | consider changing this binding's type to be: `&mut Container`
+ |
+help: you may want to use `iter_mut` here
+ |
+LL | vec.iter_mut().flat_map(|container| container.things()).cloned().collect::<Vec<PathBuf>>();
+ | ~~~~~~~~
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut.fixed b/tests/ui/borrowck/issue-62387-suggest-iter-mut.fixed
new file mode 100644
index 000000000..8bf2625de
--- /dev/null
+++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut.fixed
@@ -0,0 +1,30 @@
+// run-rustfix
+#![allow(unused_mut)]
+#![allow(dead_code)]
+
+#[derive(Debug)]
+struct A {
+ a: i32,
+}
+
+impl A {
+ fn double(&mut self) {
+ self.a += self.a
+ }
+}
+
+fn baz() {
+ let mut v = [A { a: 4 }];
+ v.iter_mut().for_each(|a| a.double());
+ //~^ ERROR cannot borrow `*a` as mutable, as it is behind a `&` reference
+ println!("{:?}", v);
+}
+
+fn bar() {
+ let mut v = [A { a: 4 }];
+ v.iter_mut().rev().rev().for_each(|a| a.double());
+ //~^ ERROR cannot borrow `*a` as mutable, as it is behind a `&` reference
+ println!("{:?}", v);
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut.rs b/tests/ui/borrowck/issue-62387-suggest-iter-mut.rs
new file mode 100644
index 000000000..39bc30bf2
--- /dev/null
+++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut.rs
@@ -0,0 +1,30 @@
+// run-rustfix
+#![allow(unused_mut)]
+#![allow(dead_code)]
+
+#[derive(Debug)]
+struct A {
+ a: i32,
+}
+
+impl A {
+ fn double(&mut self) {
+ self.a += self.a
+ }
+}
+
+fn baz() {
+ let mut v = [A { a: 4 }];
+ v.iter().for_each(|a| a.double());
+ //~^ ERROR cannot borrow `*a` as mutable, as it is behind a `&` reference
+ println!("{:?}", v);
+}
+
+fn bar() {
+ let mut v = [A { a: 4 }];
+ v.iter().rev().rev().for_each(|a| a.double());
+ //~^ ERROR cannot borrow `*a` as mutable, as it is behind a `&` reference
+ println!("{:?}", v);
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr b/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr
new file mode 100644
index 000000000..fd58e4330
--- /dev/null
+++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr
@@ -0,0 +1,29 @@
+error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference
+ --> $DIR/issue-62387-suggest-iter-mut.rs:18:27
+ |
+LL | v.iter().for_each(|a| a.double());
+ | - ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | |
+ | consider changing this binding's type to be: `&mut A`
+ |
+help: you may want to use `iter_mut` here
+ |
+LL | v.iter_mut().for_each(|a| a.double());
+ | ~~~~~~~~
+
+error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference
+ --> $DIR/issue-62387-suggest-iter-mut.rs:25:39
+ |
+LL | v.iter().rev().rev().for_each(|a| a.double());
+ | - ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | |
+ | consider changing this binding's type to be: `&mut A`
+ |
+help: you may want to use `iter_mut` here
+ |
+LL | v.iter_mut().rev().rev().for_each(|a| a.double());
+ | ~~~~~~~~
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/tests/ui/borrowck/issue-81899.stderr b/tests/ui/borrowck/issue-81899.stderr
index 1b03bc3af..5ff33933c 100644
--- a/tests/ui/borrowck/issue-81899.stderr
+++ b/tests/ui/borrowck/issue-81899.stderr
@@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed
LL | panic!()
| ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/issue-81899.rs:11:5
|
-note: inside `f::<[closure@$DIR/issue-81899.rs:4:31: 4:34]>`
+note: inside `f::<{closure@$DIR/issue-81899.rs:4:31: 4:34}>`
--> $DIR/issue-81899.rs:11:5
|
LL | panic!()
@@ -16,7 +16,7 @@ LL | const _CONST: &[u8] = &f(&[], |_| {});
| ^^^^^^^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/issue-81899.rs:4:23
|
LL | const _CONST: &[u8] = &f(&[], |_| {});
diff --git a/tests/ui/borrowck/issue-88434-minimal-example.stderr b/tests/ui/borrowck/issue-88434-minimal-example.stderr
index a5a571c6d..7b785b25b 100644
--- a/tests/ui/borrowck/issue-88434-minimal-example.stderr
+++ b/tests/ui/borrowck/issue-88434-minimal-example.stderr
@@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed
LL | panic!()
| ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:10:5
|
-note: inside `f::<[closure@$DIR/issue-88434-minimal-example.rs:3:25: 3:28]>`
+note: inside `f::<{closure@$DIR/issue-88434-minimal-example.rs:3:25: 3:28}>`
--> $DIR/issue-88434-minimal-example.rs:10:5
|
LL | panic!()
@@ -16,7 +16,7 @@ LL | const _CONST: &() = &f(&|_| {});
| ^^^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/issue-88434-minimal-example.rs:3:21
|
LL | const _CONST: &() = &f(&|_| {});
diff --git a/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr b/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr
index 00023c459..9732b8cfa 100644
--- a/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr
+++ b/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr
@@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed
LL | panic!()
| ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/issue-88434-removal-index-should-be-less.rs:10:5
|
-note: inside `f::<[closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34]>`
+note: inside `f::<{closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34}>`
--> $DIR/issue-88434-removal-index-should-be-less.rs:10:5
|
LL | panic!()
@@ -16,7 +16,7 @@ LL | const _CONST: &[u8] = &f(&[], |_| {});
| ^^^^^^^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/issue-88434-removal-index-should-be-less.rs:3:23
|
LL | const _CONST: &[u8] = &f(&[], |_| {});
diff --git a/tests/ui/borrowck/issue-92157.rs b/tests/ui/borrowck/issue-92157.rs
index 6ee2320a6..3a6f8908b 100644
--- a/tests/ui/borrowck/issue-92157.rs
+++ b/tests/ui/borrowck/issue-92157.rs
@@ -9,7 +9,7 @@ extern {}
#[lang = "start"]
fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize {
- //~^ ERROR: incorrect number of parameters for the `start` lang item
+ //~^ ERROR lang item `start` function has wrong type [E0308]
40+2
}
diff --git a/tests/ui/borrowck/issue-92157.stderr b/tests/ui/borrowck/issue-92157.stderr
index a4010d73d..a46b12889 100644
--- a/tests/ui/borrowck/issue-92157.stderr
+++ b/tests/ui/borrowck/issue-92157.stderr
@@ -1,11 +1,12 @@
-error: incorrect number of parameters for the `start` lang item
+error[E0308]: lang item `start` function has wrong type
--> $DIR/issue-92157.rs:11:1
|
LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
- = note: the `start` lang item should have four parameters, but found 3
- = note: the `start` lang item should have the signature `fn(fn() -> T, isize, *const *const u8, u8) -> isize`
+ = note: expected signature `fn(fn() -> T, isize, *const *const u8, u8) -> _`
+ found signature `fn(fn() -> T, isize, *const *const u8) -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr b/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr
index 776c338de..d7762621c 100644
--- a/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr
+++ b/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr
@@ -24,7 +24,7 @@ error: lifetime may not live long enough
LL | move |()| s.chars().map(|c| format!("{}{}", c, s))
| --------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2`
| | |
- | | return type of closure `Map<Chars<'_>, [closure@$DIR/issue-95079-missing-move-in-nested-closure.rs:11:29: 11:32]>` contains a lifetime `'2`
+ | | return type of closure `Map<Chars<'_>, {closure@$DIR/issue-95079-missing-move-in-nested-closure.rs:11:29: 11:32}>` contains a lifetime `'2`
| lifetime `'1` represents this closure's body
|
= note: closure implements `Fn`, so references to captured variables can't escape the closure
diff --git a/tests/ui/borrowck/suggest-mut-iterator.fixed b/tests/ui/borrowck/suggest-mut-iterator.fixed
new file mode 100644
index 000000000..16512b8a3
--- /dev/null
+++ b/tests/ui/borrowck/suggest-mut-iterator.fixed
@@ -0,0 +1,30 @@
+// run-rustfix
+struct Test {
+ a: u32
+}
+
+impl Test {
+ pub fn add(&mut self, value: u32) {
+ self.a += value;
+ }
+
+ pub fn print_value(&self) {
+ println!("Value of a is: {}", self.a);
+ }
+}
+
+fn main() {
+ let mut tests = Vec::new();
+ for i in 0..=10 {
+ tests.push(Test {a: i});
+ }
+ for test in &mut tests {
+ test.add(2); //~ ERROR cannot borrow `*test` as mutable, as it is behind a `&` reference
+ }
+ for test in &mut tests {
+ test.add(2);
+ }
+ for test in &tests {
+ test.print_value();
+ }
+}
diff --git a/tests/ui/borrowck/suggest-mut-iterator.rs b/tests/ui/borrowck/suggest-mut-iterator.rs
new file mode 100644
index 000000000..276edeccb
--- /dev/null
+++ b/tests/ui/borrowck/suggest-mut-iterator.rs
@@ -0,0 +1,30 @@
+// run-rustfix
+struct Test {
+ a: u32
+}
+
+impl Test {
+ pub fn add(&mut self, value: u32) {
+ self.a += value;
+ }
+
+ pub fn print_value(&self) {
+ println!("Value of a is: {}", self.a);
+ }
+}
+
+fn main() {
+ let mut tests = Vec::new();
+ for i in 0..=10 {
+ tests.push(Test {a: i});
+ }
+ for test in &tests {
+ test.add(2); //~ ERROR cannot borrow `*test` as mutable, as it is behind a `&` reference
+ }
+ for test in &mut tests {
+ test.add(2);
+ }
+ for test in &tests {
+ test.print_value();
+ }
+}
diff --git a/tests/ui/borrowck/suggest-mut-iterator.stderr b/tests/ui/borrowck/suggest-mut-iterator.stderr
new file mode 100644
index 000000000..77f991a9a
--- /dev/null
+++ b/tests/ui/borrowck/suggest-mut-iterator.stderr
@@ -0,0 +1,16 @@
+error[E0596]: cannot borrow `*test` as mutable, as it is behind a `&` reference
+ --> $DIR/suggest-mut-iterator.rs:22:9
+ |
+LL | for test in &tests {
+ | ------ this iterator yields `&` references
+LL | test.add(2);
+ | ^^^^ `test` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ |
+help: use a mutable iterator instead
+ |
+LL | for test in &mut tests {
+ | +++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/tests/ui/c-variadic/variadic-ffi-1.stderr b/tests/ui/c-variadic/variadic-ffi-1.stderr
index c78993381..4beea83d8 100644
--- a/tests/ui/c-variadic/variadic-ffi-1.stderr
+++ b/tests/ui/c-variadic/variadic-ffi-1.stderr
@@ -46,7 +46,6 @@ LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo;
|
= note: expected fn pointer `unsafe extern "C" fn(_, _)`
found fn item `unsafe extern "C" fn(_, _, ...) {foo}`
- = note: when the arguments and return types match, functions can be coerced to function pointers
error[E0308]: mismatched types
--> $DIR/variadic-ffi-1.rs:26:54
@@ -58,7 +57,6 @@ LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar;
|
= note: expected fn pointer `extern "C" fn(_, _, ...)`
found fn item `extern "C" fn(_, _) {bar}`
- = note: when the arguments and return types match, functions can be coerced to function pointers
error[E0617]: can't pass `f32` to variadic function
--> $DIR/variadic-ffi-1.rs:28:19
diff --git a/tests/ui/c-variadic/variadic-ffi-2.rs b/tests/ui/c-variadic/variadic-ffi-2.rs
index c34b7e55f..67a0a9a1d 100644
--- a/tests/ui/c-variadic/variadic-ffi-2.rs
+++ b/tests/ui/c-variadic/variadic-ffi-2.rs
@@ -3,10 +3,13 @@
fn baz(f: extern "stdcall" fn(usize, ...)) {
//~^ ERROR: C-variadic function must have a compatible calling convention,
- // like C, cdecl, win64, sysv64 or efiapi
+ // like C, cdecl, aapcs, win64, sysv64 or efiapi
f(22, 44);
}
+fn aapcs(f: extern "aapcs" fn(usize, ...)) {
+ f(22, 44);
+}
fn sysv(f: extern "sysv64" fn(usize, ...)) {
f(22, 44);
}
diff --git a/tests/ui/c-variadic/variadic-ffi-2.stderr b/tests/ui/c-variadic/variadic-ffi-2.stderr
index e21001eca..8884fc6fb 100644
--- a/tests/ui/c-variadic/variadic-ffi-2.stderr
+++ b/tests/ui/c-variadic/variadic-ffi-2.stderr
@@ -1,4 +1,4 @@
-error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `win64`, `sysv64` or `efiapi`
+error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `aapcs`, `win64`, `sysv64` or `efiapi`
--> $DIR/variadic-ffi-2.rs:4:11
|
LL | fn baz(f: extern "stdcall" fn(usize, ...)) {
diff --git a/tests/ui/cast/cast-as-bool.rs b/tests/ui/cast/cast-as-bool.rs
index fbebc80d9..511a02718 100644
--- a/tests/ui/cast/cast-as-bool.rs
+++ b/tests/ui/cast/cast-as-bool.rs
@@ -1,11 +1,47 @@
fn main() {
- let u = 5 as bool; //~ ERROR cannot cast as `bool`
+ let u = 5 as bool; //~ ERROR cannot cast `i32` as `bool`
//~| HELP compare with zero instead
- //~| SUGGESTION 5 != 0
+ //~| SUGGESTION != 0
- let t = (1 + 2) as bool; //~ ERROR cannot cast as `bool`
+ let t = (1 + 2) as bool; //~ ERROR cannot cast `i32` as `bool`
//~| HELP compare with zero instead
- //~| SUGGESTION (1 + 2) != 0
+ //~| SUGGESTION != 0
+
+ let _ = 5_u32 as bool; //~ ERROR cannot cast `u32` as `bool`
+ //~| HELP compare with zero instead
+
+ let _ = 64.0_f64 as bool; //~ ERROR cannot cast `f64` as `bool`
+ //~| HELP compare with zero instead
+
+ // Enums that can normally be cast to integers can't be cast to `bool`, just like integers.
+ // Note that enums that cannot be cast to integers can't be cast to anything at *all*
+ // so that's not tested here.
+ enum IntEnum {
+ Zero,
+ One,
+ Two
+ }
+ let _ = IntEnum::One as bool; //~ ERROR cannot cast `IntEnum` as `bool`
+
+ fn uwu(_: u8) -> String {
+ todo!()
+ }
+
+ unsafe fn owo() {}
+
+ // fn item to bool
+ let _ = uwu as bool; //~ ERROR cannot cast `fn(u8) -> String {uwu}` as `bool`
+ // unsafe fn item
+ let _ = owo as bool; //~ ERROR cannot cast `unsafe fn() {owo}` as `bool`
+
+ // fn ptr to bool
+ let _ = uwu as fn(u8) -> String as bool; //~ ERROR cannot cast `fn(u8) -> String` as `bool`
+
+ let _ = 'x' as bool; //~ ERROR cannot cast `char` as `bool`
+
+ let ptr = 1 as *const ();
+
+ let _ = ptr as bool; //~ ERROR cannot cast `*const ()` as `bool`
let v = "hello" as bool;
//~^ ERROR casting `&'static str` as `bool` is invalid
diff --git a/tests/ui/cast/cast-as-bool.stderr b/tests/ui/cast/cast-as-bool.stderr
index 19ac8f10f..4ff56a95e 100644
--- a/tests/ui/cast/cast-as-bool.stderr
+++ b/tests/ui/cast/cast-as-bool.stderr
@@ -1,18 +1,86 @@
-error[E0054]: cannot cast as `bool`
+error[E0054]: cannot cast `i32` as `bool`
--> $DIR/cast-as-bool.rs:2:13
|
LL | let u = 5 as bool;
- | ^^^^^^^^^ help: compare with zero instead: `5 != 0`
+ | ^^^^^^^^^
+ |
+help: compare with zero instead
+ |
+LL | let u = 5 != 0;
+ | ~~~~
-error[E0054]: cannot cast as `bool`
+error[E0054]: cannot cast `i32` as `bool`
--> $DIR/cast-as-bool.rs:6:13
|
LL | let t = (1 + 2) as bool;
- | ^^^^^^^^^^^^^^^ help: compare with zero instead: `(1 + 2) != 0`
+ | ^^^^^^^^^^^^^^^
+ |
+help: compare with zero instead
+ |
+LL | let t = (1 + 2) != 0;
+ | ~~~~
-error[E0606]: casting `&'static str` as `bool` is invalid
+error[E0054]: cannot cast `u32` as `bool`
--> $DIR/cast-as-bool.rs:10:13
|
+LL | let _ = 5_u32 as bool;
+ | ^^^^^^^^^^^^^
+ |
+help: compare with zero instead
+ |
+LL | let _ = 5_u32 != 0;
+ | ~~~~
+
+error[E0054]: cannot cast `f64` as `bool`
+ --> $DIR/cast-as-bool.rs:13:13
+ |
+LL | let _ = 64.0_f64 as bool;
+ | ^^^^^^^^^^^^^^^^
+ |
+help: compare with zero instead
+ |
+LL | let _ = 64.0_f64 != 0;
+ | ~~~~
+
+error[E0054]: cannot cast `IntEnum` as `bool`
+ --> $DIR/cast-as-bool.rs:24:13
+ |
+LL | let _ = IntEnum::One as bool;
+ | ^^^^^^^^^^^^^^^^^^^^ unsupported cast
+
+error[E0054]: cannot cast `fn(u8) -> String {uwu}` as `bool`
+ --> $DIR/cast-as-bool.rs:33:13
+ |
+LL | let _ = uwu as bool;
+ | ^^^^^^^^^^^ unsupported cast
+
+error[E0054]: cannot cast `unsafe fn() {owo}` as `bool`
+ --> $DIR/cast-as-bool.rs:35:13
+ |
+LL | let _ = owo as bool;
+ | ^^^^^^^^^^^ unsupported cast
+
+error[E0054]: cannot cast `fn(u8) -> String` as `bool`
+ --> $DIR/cast-as-bool.rs:38:13
+ |
+LL | let _ = uwu as fn(u8) -> String as bool;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsupported cast
+
+error[E0054]: cannot cast `char` as `bool`
+ --> $DIR/cast-as-bool.rs:40:13
+ |
+LL | let _ = 'x' as bool;
+ | ^^^^^^^^^^^ unsupported cast
+
+error[E0054]: cannot cast `*const ()` as `bool`
+ --> $DIR/cast-as-bool.rs:44:13
+ |
+LL | let _ = ptr as bool;
+ | ^^^^^^^^^^^ unsupported cast
+
+error[E0606]: casting `&'static str` as `bool` is invalid
+ --> $DIR/cast-as-bool.rs:46:13
+ |
LL | let v = "hello" as bool;
| ^^^^^^^^^^^^^^^
|
@@ -21,7 +89,7 @@ help: consider using the `is_empty` method on `&'static str` to determine if it
LL | let v = !"hello".is_empty();
| + ~~~~~~~~~~~
-error: aborting due to 3 previous errors
+error: aborting due to 11 previous errors
Some errors have detailed explanations: E0054, E0606.
For more information about an error, try `rustc --explain E0054`.
diff --git a/tests/ui/cast/cast-rfc0401-2.rs b/tests/ui/cast/cast-rfc0401-2.rs
index 7709aa341..70604a587 100644
--- a/tests/ui/cast/cast-rfc0401-2.rs
+++ b/tests/ui/cast/cast-rfc0401-2.rs
@@ -4,5 +4,5 @@
fn main() {
let _ = 3 as bool;
- //~^ ERROR cannot cast as `bool`
+ //~^ ERROR cannot cast `i32` as `bool`
}
diff --git a/tests/ui/cast/cast-rfc0401-2.stderr b/tests/ui/cast/cast-rfc0401-2.stderr
index 52f6af78a..dd90c3a97 100644
--- a/tests/ui/cast/cast-rfc0401-2.stderr
+++ b/tests/ui/cast/cast-rfc0401-2.stderr
@@ -1,8 +1,13 @@
-error[E0054]: cannot cast as `bool`
+error[E0054]: cannot cast `i32` as `bool`
--> $DIR/cast-rfc0401-2.rs:6:13
|
LL | let _ = 3 as bool;
- | ^^^^^^^^^ help: compare with zero instead: `3 != 0`
+ | ^^^^^^^^^
+ |
+help: compare with zero instead
+ |
+LL | let _ = 3 != 0;
+ | ~~~~
error: aborting due to previous error
diff --git a/tests/ui/cast/unsized-struct-cast.rs b/tests/ui/cast/unsized-struct-cast.rs
new file mode 100644
index 000000000..52bb6cedc
--- /dev/null
+++ b/tests/ui/cast/unsized-struct-cast.rs
@@ -0,0 +1,6 @@
+pub struct Data([u8]);
+
+fn main(){
+ const _: *const Data = &[] as *const Data;
+ //~^ ERROR: casting `&[_; 0]` as `*const Data` is invalid
+}
diff --git a/tests/ui/cast/unsized-struct-cast.stderr b/tests/ui/cast/unsized-struct-cast.stderr
new file mode 100644
index 000000000..79b3d973c
--- /dev/null
+++ b/tests/ui/cast/unsized-struct-cast.stderr
@@ -0,0 +1,9 @@
+error[E0606]: casting `&[_; 0]` as `*const Data` is invalid
+ --> $DIR/unsized-struct-cast.rs:4:28
+ |
+LL | const _: *const Data = &[] as *const Data;
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0606`.
diff --git a/tests/ui/check-cfg/values-target-json.stderr b/tests/ui/check-cfg/values-target-json.stderr
index e773d5d83..c705152d9 100644
--- a/tests/ui/check-cfg/values-target-json.stderr
+++ b/tests/ui/check-cfg/values-target-json.stderr
@@ -6,7 +6,7 @@ LL | #[cfg(target_os = "linuz")]
| |
| help: there is a expected value with a similar name: `"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`, `teeos`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`
+ = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `ericos`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `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-cfg/well-known-values.stderr b/tests/ui/check-cfg/well-known-values.stderr
index 1f7758146..b381f5a4a 100644
--- a/tests/ui/check-cfg/well-known-values.stderr
+++ b/tests/ui/check-cfg/well-known-values.stderr
@@ -6,7 +6,7 @@ LL | #[cfg(target_os = "linuz")]
| |
| help: there is a expected value with a similar name: `"linux"`
|
- = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`
+ = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value
diff --git a/tests/ui/closure_context/issue-26046-fn-mut.stderr b/tests/ui/closure_context/issue-26046-fn-mut.stderr
index e468f6be7..eeb409452 100644
--- a/tests/ui/closure_context/issue-26046-fn-mut.stderr
+++ b/tests/ui/closure_context/issue-26046-fn-mut.stderr
@@ -9,7 +9,7 @@ LL | num += 1;
LL | Box::new(closure)
| ----------------- the requirement to implement `Fn` derives from here
|
- = note: required for the cast from `Box<[closure@$DIR/issue-26046-fn-mut.rs:4:19: 4:21]>` to `Box<(dyn Fn() + 'static)>`
+ = note: required for the cast from `Box<{closure@$DIR/issue-26046-fn-mut.rs:4:19: 4:21}>` to `Box<(dyn Fn() + 'static)>`
error: aborting due to previous error
diff --git a/tests/ui/closure_context/issue-26046-fn-once.stderr b/tests/ui/closure_context/issue-26046-fn-once.stderr
index 41f60327c..24773a1d7 100644
--- a/tests/ui/closure_context/issue-26046-fn-once.stderr
+++ b/tests/ui/closure_context/issue-26046-fn-once.stderr
@@ -9,7 +9,7 @@ LL | vec
LL | Box::new(closure)
| ----------------- the requirement to implement `Fn` derives from here
|
- = note: required for the cast from `Box<[closure@$DIR/issue-26046-fn-once.rs:4:19: 4:26]>` to `Box<(dyn Fn() -> Vec<u8> + 'static)>`
+ = note: required for the cast from `Box<{closure@$DIR/issue-26046-fn-once.rs:4:19: 4:26}>` to `Box<(dyn Fn() -> Vec<u8> + 'static)>`
error: aborting due to previous error
diff --git a/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2018.stderr b/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2018.stderr
new file mode 100644
index 000000000..394629c00
--- /dev/null
+++ b/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2018.stderr
@@ -0,0 +1,33 @@
+error[E0505]: cannot move out of `value` because it is borrowed
+ --> $DIR/if-let-guards-errors.rs:16:13
+ |
+LL | let f = |x: &E| {
+ | ------- borrow of `value` occurs here
+LL | match &x {
+LL | E::Number(_) if let E::Number(ref mut n) = *value => { }
+ | ------ borrow occurs due to use in closure
+...
+LL | let x = value;
+ | ^^^^^ move out of `value` occurs here
+LL |
+LL | drop(f);
+ | - borrow later used here
+
+error[E0382]: use of moved value: `value`
+ --> $DIR/if-let-guards-errors.rs:28:13
+ |
+LL | fn if_let_move(value: Box<E>) {
+ | ----- move occurs because `value` has type `Box<E>`, which does not implement the `Copy` trait
+LL | let f = |x: &E| {
+ | ------- value moved into closure here
+LL | match &x {
+LL | E::Number(_) if let E::String(s) = *value => { }
+ | ------ variable moved due to use in closure
+...
+LL | let x = value;
+ | ^^^^^ value used here after move
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0382, E0505.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2021.stderr b/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2021.stderr
new file mode 100644
index 000000000..567284501
--- /dev/null
+++ b/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2021.stderr
@@ -0,0 +1,33 @@
+error[E0505]: cannot move out of `value` because it is borrowed
+ --> $DIR/if-let-guards-errors.rs:16:13
+ |
+LL | let f = |x: &E| {
+ | ------- borrow of `*value` occurs here
+LL | match &x {
+LL | E::Number(_) if let E::Number(ref mut n) = *value => { }
+ | ------ borrow occurs due to use in closure
+...
+LL | let x = value;
+ | ^^^^^ move out of `value` occurs here
+LL |
+LL | drop(f);
+ | - borrow later used here
+
+error[E0382]: use of moved value: `value`
+ --> $DIR/if-let-guards-errors.rs:28:13
+ |
+LL | fn if_let_move(value: Box<E>) {
+ | ----- move occurs because `value` has type `Box<E>`, which does not implement the `Copy` trait
+LL | let f = |x: &E| {
+ | ------- value moved into closure here
+LL | match &x {
+LL | E::Number(_) if let E::String(s) = *value => { }
+ | ------ variable moved due to use in closure
+...
+LL | let x = value;
+ | ^^^^^ value used here after move
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0382, E0505.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.rs b/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.rs
new file mode 100644
index 000000000..17e38c033
--- /dev/null
+++ b/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.rs
@@ -0,0 +1,37 @@
+// Check the if let guards don't force capture by value
+// revisions: e2018 e2021
+//[e2018] edition:2018
+//[e2021] edition:2021
+
+#![feature(if_let_guard)]
+#![allow(irrefutable_let_patterns)]
+
+fn if_let_ref_mut(mut value: Box<E>) {
+ let f = |x: &E| {
+ match &x {
+ E::Number(_) if let E::Number(ref mut n) = *value => { }
+ _ => {}
+ }
+ };
+ let x = value;
+ //~^ ERROR cannot move out of `value` because it is borrowed
+ drop(f);
+}
+
+fn if_let_move(value: Box<E>) {
+ let f = |x: &E| {
+ match &x {
+ E::Number(_) if let E::String(s) = *value => { }
+ _ => {}
+ }
+ };
+ let x = value;
+ //~^ ERROR use of moved value: `value`
+}
+
+enum E {
+ String(String),
+ Number(i32),
+}
+
+fn main() {}
diff --git a/tests/ui/closures/2229_closure_analysis/match/if-let-guards.rs b/tests/ui/closures/2229_closure_analysis/match/if-let-guards.rs
new file mode 100644
index 000000000..fa331707b
--- /dev/null
+++ b/tests/ui/closures/2229_closure_analysis/match/if-let-guards.rs
@@ -0,0 +1,55 @@
+// Check the if let guards don't force capture by value
+// revisions: e2018 e2021
+// check-pass
+//[e2018] edition:2018
+//[e2021] edition:2021
+
+#![feature(if_let_guard)]
+#![allow(irrefutable_let_patterns)]
+
+fn if_let_underscore(value: Box<E>) {
+ |x: &E| {
+ match &x {
+ E::Number(_) if let _ = *value => { }
+ _ => {}
+ }
+ };
+ let x = value;
+}
+
+fn if_let_copy(value: Box<E>) {
+ |x: &E| {
+ match &x {
+ E::Number(_) if let E::Number(n) = *value => { }
+ _ => {}
+ }
+ };
+ let x = value;
+}
+
+fn if_let_ref(value: Box<E>) {
+ |x: &E| {
+ match &x {
+ E::Number(_) if let E::Number(ref n) = *value => { }
+ _ => {}
+ }
+ };
+ let x = value;
+}
+
+fn if_let_ref_mut(mut value: Box<E>) {
+ |x: &E| {
+ match &x {
+ E::Number(_) if let E::Number(ref mut n) = *value => { }
+ _ => {}
+ }
+ };
+ let x = value;
+}
+
+enum E {
+ String(String),
+ Number(i32),
+}
+
+fn main() {}
diff --git a/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr b/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr
index 3a5fad154..0807f4590 100644
--- a/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr
+++ b/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr
@@ -45,7 +45,8 @@ note: `E2` defined here
|
LL | pub enum E2 { A, B }
| ^^^^^^^^^^^
- = note: the matched value is of type `E2`, which is marked as non-exhaustive
+ = note: the matched value is of type `E2`
+ = note: `E2` is marked as non-exhaustive, so a wildcard `_` is necessary to match exhaustively
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 | let _e = || { match e2 { E2::A => (), E2::B => (), _ => todo!() } };
diff --git a/tests/ui/closures/2229_closure_analysis/repr_packed.rs b/tests/ui/closures/2229_closure_analysis/repr_packed.rs
index f23670f63..8c23454fa 100644
--- a/tests/ui/closures/2229_closure_analysis/repr_packed.rs
+++ b/tests/ui/closures/2229_closure_analysis/repr_packed.rs
@@ -3,7 +3,8 @@
#![feature(rustc_attrs)]
// `u8` aligned at a byte and are unaffected by repr(packed).
-// Therefore we can precisely (and safely) capture references to both the fields.
+// Therefore we *could* precisely (and safely) capture references to both the fields,
+// but we don't, since we don't want capturing to change when field types change alignment.
fn test_alignment_not_affected() {
#[repr(packed)]
struct Foo { x: u8, y: u8 }
@@ -17,11 +18,10 @@ fn test_alignment_not_affected() {
//~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes:
let z1: &u8 = &foo.x;
- //~^ NOTE: Capturing foo[(0, 0)] -> ImmBorrow
- //~| NOTE: Min Capture foo[(0, 0)] -> ImmBorrow
+ //~^ NOTE: Capturing foo[] -> ImmBorrow
let z2: &mut u8 = &mut foo.y;
- //~^ NOTE: Capturing foo[(1, 0)] -> MutBorrow
- //~| NOTE: Min Capture foo[(1, 0)] -> MutBorrow
+ //~^ NOTE: Capturing foo[] -> MutBorrow
+ //~| NOTE: Min Capture foo[] -> MutBorrow
*z2 = 42;
diff --git a/tests/ui/closures/2229_closure_analysis/repr_packed.stderr b/tests/ui/closures/2229_closure_analysis/repr_packed.stderr
index 580061ebc..32b3d844c 100644
--- a/tests/ui/closures/2229_closure_analysis/repr_packed.stderr
+++ b/tests/ui/closures/2229_closure_analysis/repr_packed.stderr
@@ -1,5 +1,5 @@
error[E0658]: attributes on expressions are experimental
- --> $DIR/repr_packed.rs:13:17
+ --> $DIR/repr_packed.rs:14:17
|
LL | let mut c = #[rustc_capture_analysis]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -26,7 +26,7 @@ LL | let c = #[rustc_capture_analysis]
= help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable
error: First Pass analysis includes:
- --> $DIR/repr_packed.rs:16:5
+ --> $DIR/repr_packed.rs:17:5
|
LL | / || {
LL | |
@@ -37,19 +37,19 @@ LL | | println!("({}, {})", z1, z2);
LL | | };
| |_____^
|
-note: Capturing foo[(0, 0)] -> ImmBorrow
- --> $DIR/repr_packed.rs:19:24
+note: Capturing foo[] -> ImmBorrow
+ --> $DIR/repr_packed.rs:20:24
|
LL | let z1: &u8 = &foo.x;
| ^^^^^
-note: Capturing foo[(1, 0)] -> MutBorrow
+note: Capturing foo[] -> MutBorrow
--> $DIR/repr_packed.rs:22:32
|
LL | let z2: &mut u8 = &mut foo.y;
| ^^^^^
error: Min Capture analysis includes:
- --> $DIR/repr_packed.rs:16:5
+ --> $DIR/repr_packed.rs:17:5
|
LL | / || {
LL | |
@@ -60,12 +60,7 @@ LL | | println!("({}, {})", z1, z2);
LL | | };
| |_____^
|
-note: Min Capture foo[(0, 0)] -> ImmBorrow
- --> $DIR/repr_packed.rs:19:24
- |
-LL | let z1: &u8 = &foo.x;
- | ^^^^^
-note: Min Capture foo[(1, 0)] -> MutBorrow
+note: Min Capture foo[] -> MutBorrow
--> $DIR/repr_packed.rs:22:32
|
LL | let z2: &mut u8 = &mut foo.y;
diff --git a/tests/ui/closures/capture-unsized-by-move.rs b/tests/ui/closures/capture-unsized-by-move.rs
new file mode 100644
index 000000000..1148e34ac
--- /dev/null
+++ b/tests/ui/closures/capture-unsized-by-move.rs
@@ -0,0 +1,10 @@
+// compile-flags: --crate-type=lib
+
+#![feature(unsized_fn_params)]
+
+pub fn f(k: dyn std::fmt::Display) {
+ let k2 = move || {
+ k.to_string();
+ //~^ ERROR the size for values of type `(dyn std::fmt::Display + 'static)` cannot be known at compilation time
+ };
+}
diff --git a/tests/ui/closures/capture-unsized-by-move.stderr b/tests/ui/closures/capture-unsized-by-move.stderr
new file mode 100644
index 000000000..d7fafc8ca
--- /dev/null
+++ b/tests/ui/closures/capture-unsized-by-move.stderr
@@ -0,0 +1,14 @@
+error[E0277]: the size for values of type `(dyn std::fmt::Display + 'static)` cannot be known at compilation time
+ --> $DIR/capture-unsized-by-move.rs:7:9
+ |
+LL | let k2 = move || {
+ | -- this closure captures all values by move
+LL | k.to_string();
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `(dyn std::fmt::Display + 'static)`
+ = note: all values captured by value by a closure 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/closures/capture-unsized-by-ref.rs b/tests/ui/closures/capture-unsized-by-ref.rs
new file mode 100644
index 000000000..c9e4a5903
--- /dev/null
+++ b/tests/ui/closures/capture-unsized-by-ref.rs
@@ -0,0 +1,10 @@
+// build-pass
+// compile-flags: --crate-type=lib
+
+#![feature(unsized_fn_params)]
+
+pub fn f(k: dyn std::fmt::Display) {
+ let k2 = || {
+ k.to_string();
+ };
+}
diff --git a/tests/ui/closures/closure-no-fn-1.stderr b/tests/ui/closures/closure-no-fn-1.stderr
index eab7482e6..87e670bb0 100644
--- a/tests/ui/closures/closure-no-fn-1.stderr
+++ b/tests/ui/closures/closure-no-fn-1.stderr
@@ -7,7 +7,7 @@ LL | let foo: fn(u8) -> u8 = |v: u8| { a += v; a };
| expected due to this
|
= note: expected fn pointer `fn(u8) -> u8`
- found closure `[closure@$DIR/closure-no-fn-1.rs:6:29: 6:36]`
+ found closure `{closure@$DIR/closure-no-fn-1.rs:6:29: 6:36}`
note: closures can only be coerced to `fn` types if they do not capture any variables
--> $DIR/closure-no-fn-1.rs:6:39
|
diff --git a/tests/ui/closures/closure-no-fn-2.stderr b/tests/ui/closures/closure-no-fn-2.stderr
index e1f0143ab..7c7e9d0ce 100644
--- a/tests/ui/closures/closure-no-fn-2.stderr
+++ b/tests/ui/closures/closure-no-fn-2.stderr
@@ -7,7 +7,7 @@ LL | let bar: fn() -> u8 = || { b };
| expected due to this
|
= note: expected fn pointer `fn() -> u8`
- found closure `[closure@$DIR/closure-no-fn-2.rs:6:27: 6:29]`
+ found closure `{closure@$DIR/closure-no-fn-2.rs:6:27: 6:29}`
note: closures can only be coerced to `fn` types if they do not capture any variables
--> $DIR/closure-no-fn-2.rs:6:32
|
diff --git a/tests/ui/closures/closure-no-fn-3.stderr b/tests/ui/closures/closure-no-fn-3.stderr
index 6009389b1..276e766e8 100644
--- a/tests/ui/closures/closure-no-fn-3.stderr
+++ b/tests/ui/closures/closure-no-fn-3.stderr
@@ -1,4 +1,4 @@
-error[E0605]: non-primitive cast: `[closure@$DIR/closure-no-fn-3.rs:6:28: 6:30]` as `fn() -> u8`
+error[E0605]: non-primitive cast: `{closure@$DIR/closure-no-fn-3.rs:6:28: 6:30}` as `fn() -> u8`
--> $DIR/closure-no-fn-3.rs:6:27
|
LL | let baz: fn() -> u8 = (|| { b }) as fn() -> u8;
diff --git a/tests/ui/closures/closure-no-fn-4.stderr b/tests/ui/closures/closure-no-fn-4.stderr
index d1b704884..0bec11ab6 100644
--- a/tests/ui/closures/closure-no-fn-4.stderr
+++ b/tests/ui/closures/closure-no-fn-4.stderr
@@ -12,7 +12,7 @@ LL | | };
| |_____- `match` arms have incompatible types
|
= note: expected fn pointer `fn(usize) -> usize`
- found closure `[closure@$DIR/closure-no-fn-4.rs:5:18: 5:21]`
+ found closure `{closure@$DIR/closure-no-fn-4.rs:5:18: 5:21}`
note: closures can only be coerced to `fn` types if they do not capture any variables
--> $DIR/closure-no-fn-4.rs:5:26
|
diff --git a/tests/ui/closures/closure-no-fn-5.stderr b/tests/ui/closures/closure-no-fn-5.stderr
index a33b847ea..13d19495d 100644
--- a/tests/ui/closures/closure-no-fn-5.stderr
+++ b/tests/ui/closures/closure-no-fn-5.stderr
@@ -7,7 +7,7 @@ LL | let bar: fn() -> u8 = || { a; b; c; d; e };
| expected due to this
|
= note: expected fn pointer `fn() -> u8`
- found closure `[closure@$DIR/closure-no-fn-5.rs:10:27: 10:29]`
+ found closure `{closure@$DIR/closure-no-fn-5.rs:10:27: 10:29}`
note: closures can only be coerced to `fn` types if they do not capture any variables
--> $DIR/closure-no-fn-5.rs:10:32
|
diff --git a/tests/ui/closures/closure-reform-bad.stderr b/tests/ui/closures/closure-reform-bad.stderr
index 4c40f70b9..6bb598131 100644
--- a/tests/ui/closures/closure-reform-bad.stderr
+++ b/tests/ui/closures/closure-reform-bad.stderr
@@ -9,7 +9,7 @@ LL | call_bare(f)
| arguments to this function are incorrect
|
= note: expected fn pointer `for<'a> fn(&'a str)`
- found closure `[closure@$DIR/closure-reform-bad.rs:10:13: 10:22]`
+ found closure `{closure@$DIR/closure-reform-bad.rs:10:13: 10:22}`
note: closures can only be coerced to `fn` types if they do not capture any variables
--> $DIR/closure-reform-bad.rs:10:43
|
diff --git a/tests/ui/closures/closure_cap_coerce_many_fail.stderr b/tests/ui/closures/closure_cap_coerce_many_fail.stderr
index ca8a43328..958439e7d 100644
--- a/tests/ui/closures/closure_cap_coerce_many_fail.stderr
+++ b/tests/ui/closures/closure_cap_coerce_many_fail.stderr
@@ -12,7 +12,7 @@ LL | | };
| |_____- `match` arms have incompatible types
|
= note: expected fn item `fn(i32, i32) -> i32 {add}`
- found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:9:16: 9:22]`
+ found closure `{closure@$DIR/closure_cap_coerce_many_fail.rs:9:16: 9:22}`
error[E0308]: `match` arms have incompatible types
--> $DIR/closure_cap_coerce_many_fail.rs:18:16
@@ -23,15 +23,15 @@ LL | | "+" => |a, b| (a + b) as i32,
| | ---------------------
| | |
| | the expected closure
- | | this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:17:16: 17:22]`
+ | | this is found to be of type `{closure@$DIR/closure_cap_coerce_many_fail.rs:17:16: 17:22}`
LL | | "-" => |a, b| (a - b + cap) as i32,
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
LL | | _ => unimplemented!(),
LL | | };
| |_____- `match` arms have incompatible types
|
- = note: expected closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:17:16: 17:22]`
- found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:18:16: 18:22]`
+ = note: expected closure `{closure@$DIR/closure_cap_coerce_many_fail.rs:17:16: 17:22}`
+ found closure `{closure@$DIR/closure_cap_coerce_many_fail.rs:18:16: 18:22}`
= note: no two closures, even if identical, have the same type
= help: consider boxing your closure and/or using it as a trait object
@@ -44,15 +44,15 @@ LL | | "+" => |a, b| (a + b + cap) as i32,
| | ---------------------------
| | |
| | the expected closure
- | | this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:22]`
+ | | this is found to be of type `{closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:22}`
LL | | "-" => |a, b| (a - b) as i32,
| | ^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
LL | | _ => unimplemented!(),
LL | | };
| |_____- `match` arms have incompatible types
|
- = note: expected closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:22]`
- found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:27:16: 27:22]`
+ = note: expected closure `{closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:22}`
+ found closure `{closure@$DIR/closure_cap_coerce_many_fail.rs:27:16: 27:22}`
= note: no two closures, even if identical, have the same type
= help: consider boxing your closure and/or using it as a trait object
@@ -65,15 +65,15 @@ LL | | "+" => |a, b| (a + b + cap) as i32,
| | ---------------------------
| | |
| | the expected closure
- | | this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:22]`
+ | | this is found to be of type `{closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:22}`
LL | | "-" => |a, b| (a - b + cap) as i32,
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
LL | | _ => unimplemented!(),
LL | | };
| |_____- `match` arms have incompatible types
|
- = note: expected closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:22]`
- found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:35:16: 35:22]`
+ = note: expected closure `{closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:22}`
+ found closure `{closure@$DIR/closure_cap_coerce_many_fail.rs:35:16: 35:22}`
= note: no two closures, even if identical, have the same type
= help: consider boxing your closure and/or using it as a trait object
diff --git a/tests/ui/closures/issue-112547.rs b/tests/ui/closures/issue-112547.rs
new file mode 100644
index 000000000..8ecb2abcc
--- /dev/null
+++ b/tests/ui/closures/issue-112547.rs
@@ -0,0 +1,15 @@
+#![feature(non_lifetime_binders)]
+ //~^ WARNING the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
+
+pub fn bar()
+where
+ for<const N: usize = {
+ (||1usize)()
+}> V: IntoIterator
+//~^ ERROR cannot find type `V` in this scope [E0412]
+{
+}
+
+fn main() {
+ bar();
+}
diff --git a/tests/ui/closures/issue-112547.stderr b/tests/ui/closures/issue-112547.stderr
new file mode 100644
index 000000000..d86b05dc6
--- /dev/null
+++ b/tests/ui/closures/issue-112547.stderr
@@ -0,0 +1,23 @@
+error[E0412]: cannot find type `V` in this scope
+ --> $DIR/issue-112547.rs:8:4
+ |
+LL | }> V: IntoIterator
+ | ^ not found in this scope
+ |
+help: you might be missing a type parameter
+ |
+LL | pub fn bar<V>()
+ | +++
+
+warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/issue-112547.rs:1:12
+ |
+LL | #![feature(non_lifetime_binders)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error: aborting due to previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0412`.
diff --git a/tests/ui/issues/issue-11873.rs b/tests/ui/closures/issue-11873.rs
index d3bd05caf..d3bd05caf 100644
--- a/tests/ui/issues/issue-11873.rs
+++ b/tests/ui/closures/issue-11873.rs
diff --git a/tests/ui/issues/issue-11873.stderr b/tests/ui/closures/issue-11873.stderr
index c814eedd2..c814eedd2 100644
--- a/tests/ui/issues/issue-11873.stderr
+++ b/tests/ui/closures/issue-11873.stderr
diff --git a/tests/ui/issues/issue-25439.rs b/tests/ui/closures/issue-25439.rs
index 4f73ff3e3..4f73ff3e3 100644
--- a/tests/ui/issues/issue-25439.rs
+++ b/tests/ui/closures/issue-25439.rs
diff --git a/tests/ui/issues/issue-25439.stderr b/tests/ui/closures/issue-25439.stderr
index dadae23fd..dadae23fd 100644
--- a/tests/ui/issues/issue-25439.stderr
+++ b/tests/ui/closures/issue-25439.stderr
diff --git a/tests/ui/closures/issue-90871.stderr b/tests/ui/closures/issue-90871.stderr
index 4a578b4d7..ef1cb213f 100644
--- a/tests/ui/closures/issue-90871.stderr
+++ b/tests/ui/closures/issue-90871.stderr
@@ -14,7 +14,7 @@ LL | type_ascribe!(2, n([u8; || 1]))
| ^^^^ expected `usize`, found closure
|
= note: expected type `usize`
- found closure `[closure@$DIR/issue-90871.rs:4:29: 4:31]`
+ found closure `{closure@$DIR/issue-90871.rs:4:29: 4:31}`
help: use parentheses to call this closure
|
LL | type_ascribe!(2, n([u8; (|| 1)()]))
diff --git a/tests/ui/closures/print/closure-print-generic-1.stderr b/tests/ui/closures/print/closure-print-generic-1.stderr
index b21734f02..2697f93b1 100644
--- a/tests/ui/closures/print/closure-print-generic-1.stderr
+++ b/tests/ui/closures/print/closure-print-generic-1.stderr
@@ -2,7 +2,7 @@ error[E0382]: use of moved value: `c`
--> $DIR/closure-print-generic-1.rs:17:5
|
LL | let c = to_fn_once(move || {
- | - move occurs because `c` has type `[closure@$DIR/closure-print-generic-1.rs:12:24: 12:31]`, which does not implement the `Copy` trait
+ | - move occurs because `c` has type `{closure@$DIR/closure-print-generic-1.rs:12:24: 12:31}`, which does not implement the `Copy` trait
...
LL | c();
| --- `c` moved due to this call
diff --git a/tests/ui/closures/print/closure-print-generic-2.stderr b/tests/ui/closures/print/closure-print-generic-2.stderr
index e53277a93..ced0be945 100644
--- a/tests/ui/closures/print/closure-print-generic-2.stderr
+++ b/tests/ui/closures/print/closure-print-generic-2.stderr
@@ -9,7 +9,7 @@ LL | let c1: () = c;
| expected due to this
|
= note: expected unit type `()`
- found closure `[closure@$DIR/closure-print-generic-2.rs:5:17: 5:19]`
+ found closure `{closure@$DIR/closure-print-generic-2.rs:5:17: 5:19}`
help: use parentheses to call this closure
|
LL | let c1: () = c();
diff --git a/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr b/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr
index 49453b053..6e3659b95 100644
--- a/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr
+++ b/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr
@@ -9,7 +9,7 @@ LL | let c1 : () = c;
| expected due to this
|
= note: expected unit type `()`
- found closure `[mod1::f<T>::{closure#0} closure_args=(unavailable) args=[T, ?16t, extern "rust-call" fn(()), ?15t]]`
+ found closure `{mod1::f<T>::{closure#0} closure_args=(unavailable) args=[T, ?16t, extern "rust-call" fn(()), ?15t]}`
help: use parentheses to call this closure
|
LL | let c1 : () = c();
diff --git a/tests/ui/closures/print/closure-print-generic-verbose-1.stderr b/tests/ui/closures/print/closure-print-generic-verbose-1.stderr
index 9a1f18fa8..5e8a6b1a7 100644
--- a/tests/ui/closures/print/closure-print-generic-verbose-1.stderr
+++ b/tests/ui/closures/print/closure-print-generic-verbose-1.stderr
@@ -2,7 +2,7 @@ error[E0382]: use of moved value: `c`
--> $DIR/closure-print-generic-verbose-1.rs:17:5
|
LL | let c = to_fn_once(move|| {
- | - move occurs because `c` has type `[f<T>::{closure#0} closure_kind_ty=i32 closure_sig_as_fn_ptr_ty=extern "rust-call" fn(()) upvar_tys=(Foo<&'?9 str>, T)]`, which does not implement the `Copy` trait
+ | - move occurs because `c` has type `{f<T>::{closure#0} closure_kind_ty=i32 closure_sig_as_fn_ptr_ty=extern "rust-call" fn(()) upvar_tys=(Foo<&'?9 str>, T)}`, which does not implement the `Copy` trait
...
LL | c();
| --- `c` moved due to this call
diff --git a/tests/ui/closures/print/closure-print-generic-verbose-2.stderr b/tests/ui/closures/print/closure-print-generic-verbose-2.stderr
index d2deba3dd..f1fc35e75 100644
--- a/tests/ui/closures/print/closure-print-generic-verbose-2.stderr
+++ b/tests/ui/closures/print/closure-print-generic-verbose-2.stderr
@@ -9,7 +9,7 @@ LL | let c1 : () = c;
| expected due to this
|
= note: expected unit type `()`
- found closure `[f<T>::{closure#0} closure_args=(unavailable) args=[T, ?16t, extern "rust-call" fn(()), ?15t]]`
+ found closure `{f<T>::{closure#0} closure_args=(unavailable) args=[T, ?16t, extern "rust-call" fn(()), ?15t]}`
help: use parentheses to call this closure
|
LL | let c1 : () = c();
diff --git a/tests/ui/closures/print/closure-print-verbose.stderr b/tests/ui/closures/print/closure-print-verbose.stderr
index acc81f5e4..3f9160fe5 100644
--- a/tests/ui/closures/print/closure-print-verbose.stderr
+++ b/tests/ui/closures/print/closure-print-verbose.stderr
@@ -7,7 +7,7 @@ LL | let foo: fn(u8) -> u8 = |v: u8| { a += v; a };
| expected due to this
|
= note: expected fn pointer `fn(u8) -> u8`
- found closure `[main::{closure#0} closure_args=(unavailable) args=[i8, extern "rust-call" fn((u8,)) -> u8, ?6t]]`
+ found closure `{main::{closure#0} closure_args=(unavailable) args=[i8, extern "rust-call" fn((u8,)) -> u8, ?6t]}`
note: closures can only be coerced to `fn` types if they do not capture any variables
--> $DIR/closure-print-verbose.rs:10:39
|
diff --git a/tests/ui/codegen/issue-79865-llvm-miscompile.rs b/tests/ui/codegen/issue-79865-llvm-miscompile.rs
new file mode 100644
index 000000000..b77f09f8e
--- /dev/null
+++ b/tests/ui/codegen/issue-79865-llvm-miscompile.rs
@@ -0,0 +1,38 @@
+// run-pass
+// only-x86_64
+// compile-flags: -C opt-level=3
+
+// Regression test for issue #79865.
+// The assertion will fail when compiled with Rust 1.56..=1.59
+// due to a LLVM miscompilation.
+
+use std::arch::x86_64::*;
+
+fn main() {
+ if is_x86_feature_detected!("avx") {
+ let res: [f64; 4] = unsafe { std::mem::transmute::<_, _>(first()) };
+ assert_eq!(res, [22.0, 44.0, 66.0, 88.0]);
+ }
+}
+
+#[target_feature(enable = "avx")]
+unsafe fn first() -> __m256d {
+ second()
+}
+
+unsafe fn second() -> __m256d {
+ let v0 = _mm256_setr_pd(1.0, 2.0, 3.0, 4.0);
+ let v1 = _mm256_setr_pd(10.0, 20.0, 30.0, 40.0);
+
+ // needs to be called twice to hit the miscompilation
+ let (add, _) = add_sub(v0, v1);
+ let (add, _) = add_sub(add, add);
+ add
+}
+
+#[inline(never)] // needed to hit the miscompilation
+unsafe fn add_sub(v1: __m256d, v0: __m256d) -> (__m256d, __m256d) {
+ let add = _mm256_add_pd(v0, v1);
+ let sub = _mm256_sub_pd(v0, v1);
+ (add, sub)
+}
diff --git a/tests/ui/codegen/subtyping-enforces-type-equality.stderr b/tests/ui/codegen/subtyping-enforces-type-equality.stderr
deleted file mode 100644
index 870ca0f83..000000000
--- a/tests/ui/codegen/subtyping-enforces-type-equality.stderr
+++ /dev/null
@@ -1 +0,0 @@
-WARN rustc_codegen_ssa::mir::locals Unexpected initial operand type. See the issues/114858
diff --git a/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr b/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr
index aa5ec6b5a..646044ae4 100644
--- a/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr
+++ b/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr
@@ -29,10 +29,10 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:14:27
|
LL | let _ = type_ascribe!(Box::new( { |x| (x as u8) }), Box<dyn Fn(i32) -> _>);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Fn(i32) -> u8>`, found `Box<[closure@coerce-expect-unsized-ascribed.rs:14:39]>`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Fn(i32) -> u8>`, found `Box<{closure@coerce-expect-unsized-ascribed.rs:14:39}>`
|
= note: expected struct `Box<dyn Fn(i32) -> u8>`
- found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:14:39: 14:42]>`
+ found struct `Box<{closure@$DIR/coerce-expect-unsized-ascribed.rs:14:39: 14:42}>`
error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:15:27
@@ -83,10 +83,10 @@ error[E0308]: mismatched types
--> $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:22: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:22:30: 22:33]`
+ found reference `&{closure@$DIR/coerce-expect-unsized-ascribed.rs:22:30: 22:33}`
error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:23:27
@@ -119,10 +119,10 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:27:27
|
LL | let _ = type_ascribe!(Box::new(|x| (x as u8)), Box<dyn Fn(i32) -> _>);
- | ^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Fn(i32) -> u8>`, found `Box<[closure@coerce-expect-unsized-ascribed.rs:27:36]>`
+ | ^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Fn(i32) -> u8>`, found `Box<{closure@coerce-expect-unsized-ascribed.rs:27:36}>`
|
= note: expected struct `Box<dyn Fn(i32) -> u8>`
- found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:27:36: 27: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-overlap-downstream-inherent.stderr b/tests/ui/coherence/coherence-overlap-downstream-inherent.next.stderr
index bbce4b530..2938bc629 100644
--- a/tests/ui/coherence/coherence-overlap-downstream-inherent.stderr
+++ b/tests/ui/coherence/coherence-overlap-downstream-inherent.next.stderr
@@ -1,5 +1,5 @@
error[E0592]: duplicate definitions with name `dummy`
- --> $DIR/coherence-overlap-downstream-inherent.rs:7:26
+ --> $DIR/coherence-overlap-downstream-inherent.rs:10:26
|
LL | impl<T:Sugar> Sweet<T> { fn dummy(&self) { } }
| ^^^^^^^^^^^^^^^ duplicate definitions for `dummy`
@@ -8,7 +8,7 @@ LL | impl<T:Fruit> Sweet<T> { fn dummy(&self) { } }
| --------------- other definition for `dummy`
error[E0592]: duplicate definitions with name `f`
- --> $DIR/coherence-overlap-downstream-inherent.rs:13:38
+ --> $DIR/coherence-overlap-downstream-inherent.rs:16:38
|
LL | impl<X, T> A<T, X> where T: Bar<X> { fn f(&self) {} }
| ^^^^^^^^^^^ duplicate definitions for `f`
diff --git a/tests/ui/coherence/coherence-overlap-downstream-inherent.old.stderr b/tests/ui/coherence/coherence-overlap-downstream-inherent.old.stderr
new file mode 100644
index 000000000..2938bc629
--- /dev/null
+++ b/tests/ui/coherence/coherence-overlap-downstream-inherent.old.stderr
@@ -0,0 +1,23 @@
+error[E0592]: duplicate definitions with name `dummy`
+ --> $DIR/coherence-overlap-downstream-inherent.rs:10:26
+ |
+LL | impl<T:Sugar> Sweet<T> { fn dummy(&self) { } }
+ | ^^^^^^^^^^^^^^^ duplicate definitions for `dummy`
+LL |
+LL | impl<T:Fruit> Sweet<T> { fn dummy(&self) { } }
+ | --------------- other definition for `dummy`
+
+error[E0592]: duplicate definitions with name `f`
+ --> $DIR/coherence-overlap-downstream-inherent.rs:16:38
+ |
+LL | impl<X, T> A<T, X> where T: Bar<X> { fn f(&self) {} }
+ | ^^^^^^^^^^^ duplicate definitions for `f`
+LL |
+LL | impl<X> A<i32, X> { fn f(&self) {} }
+ | ----------- other definition for `f`
+ |
+ = note: downstream crates may implement trait `Bar<_>` for type `i32`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0592`.
diff --git a/tests/ui/coherence/coherence-overlap-downstream-inherent.rs b/tests/ui/coherence/coherence-overlap-downstream-inherent.rs
index 5dea33e33..2c3ef4fd3 100644
--- a/tests/ui/coherence/coherence-overlap-downstream-inherent.rs
+++ b/tests/ui/coherence/coherence-overlap-downstream-inherent.rs
@@ -1,3 +1,6 @@
+// revisions: old next
+//[next] compile-flags: -Ztrait-solver=next
+
// Tests that we consider `T: Sugar + Fruit` to be ambiguous, even
// though no impls are found.
diff --git a/tests/ui/coherence/coherence-overlap-downstream.stderr b/tests/ui/coherence/coherence-overlap-downstream.next.stderr
index 7f373e595..9d62efbc3 100644
--- a/tests/ui/coherence/coherence-overlap-downstream.stderr
+++ b/tests/ui/coherence/coherence-overlap-downstream.next.stderr
@@ -1,5 +1,5 @@
error[E0119]: conflicting implementations of trait `Sweet`
- --> $DIR/coherence-overlap-downstream.rs:8:1
+ --> $DIR/coherence-overlap-downstream.rs:11:1
|
LL | impl<T:Sugar> Sweet for T { }
| ------------------------- first implementation here
@@ -7,7 +7,7 @@ LL | impl<T:Fruit> Sweet for T { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`
- --> $DIR/coherence-overlap-downstream.rs:14:1
+ --> $DIR/coherence-overlap-downstream.rs:17:1
|
LL | impl<X, T> Foo<X> for T where T: Bar<X> {}
| ----------------------- first implementation here
diff --git a/tests/ui/coherence/coherence-overlap-downstream.old.stderr b/tests/ui/coherence/coherence-overlap-downstream.old.stderr
new file mode 100644
index 000000000..9d62efbc3
--- /dev/null
+++ b/tests/ui/coherence/coherence-overlap-downstream.old.stderr
@@ -0,0 +1,21 @@
+error[E0119]: conflicting implementations of trait `Sweet`
+ --> $DIR/coherence-overlap-downstream.rs:11:1
+ |
+LL | impl<T:Sugar> Sweet for T { }
+ | ------------------------- first implementation here
+LL | impl<T:Fruit> Sweet for T { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
+
+error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`
+ --> $DIR/coherence-overlap-downstream.rs:17:1
+ |
+LL | impl<X, T> Foo<X> for T where T: Bar<X> {}
+ | ----------------------- first implementation here
+LL | impl<X> Foo<X> for i32 {}
+ | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32`
+ |
+ = note: downstream crates may implement trait `Bar<_>` for type `i32`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/coherence/coherence-overlap-downstream.rs b/tests/ui/coherence/coherence-overlap-downstream.rs
index 738ec0e3d..a4e559604 100644
--- a/tests/ui/coherence/coherence-overlap-downstream.rs
+++ b/tests/ui/coherence/coherence-overlap-downstream.rs
@@ -1,3 +1,6 @@
+// revisions: old next
+//[next] compile-flags: -Ztrait-solver=next
+
// Tests that we consider `T: Sugar + Fruit` to be ambiguous, even
// though no impls are found.
diff --git a/tests/ui/coherence/coherence-overlap-issue-23516-inherent.stderr b/tests/ui/coherence/coherence-overlap-issue-23516-inherent.next.stderr
index 3ad818cbc..c02a679c1 100644
--- a/tests/ui/coherence/coherence-overlap-issue-23516-inherent.stderr
+++ b/tests/ui/coherence/coherence-overlap-issue-23516-inherent.next.stderr
@@ -1,5 +1,5 @@
error[E0592]: duplicate definitions with name `dummy`
- --> $DIR/coherence-overlap-issue-23516-inherent.rs:9:25
+ --> $DIR/coherence-overlap-issue-23516-inherent.rs:12:25
|
LL | impl<T:Sugar> Cake<T> { fn dummy(&self) { } }
| ^^^^^^^^^^^^^^^ duplicate definitions for `dummy`
diff --git a/tests/ui/coherence/coherence-overlap-issue-23516-inherent.old.stderr b/tests/ui/coherence/coherence-overlap-issue-23516-inherent.old.stderr
new file mode 100644
index 000000000..c02a679c1
--- /dev/null
+++ b/tests/ui/coherence/coherence-overlap-issue-23516-inherent.old.stderr
@@ -0,0 +1,14 @@
+error[E0592]: duplicate definitions with name `dummy`
+ --> $DIR/coherence-overlap-issue-23516-inherent.rs:12:25
+ |
+LL | impl<T:Sugar> Cake<T> { fn dummy(&self) { } }
+ | ^^^^^^^^^^^^^^^ duplicate definitions for `dummy`
+LL |
+LL | impl<U:Sugar> Cake<Box<U>> { fn dummy(&self) { } }
+ | --------------- other definition for `dummy`
+ |
+ = note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0592`.
diff --git a/tests/ui/coherence/coherence-overlap-issue-23516-inherent.rs b/tests/ui/coherence/coherence-overlap-issue-23516-inherent.rs
index a272e620f..a7c90a6b8 100644
--- a/tests/ui/coherence/coherence-overlap-issue-23516-inherent.rs
+++ b/tests/ui/coherence/coherence-overlap-issue-23516-inherent.rs
@@ -1,3 +1,6 @@
+// revisions: old next
+//[next] compile-flags: -Ztrait-solver=next
+
// Tests that we consider `Box<U>: !Sugar` to be ambiguous, even
// though we see no impl of `Sugar` for `Box`. Therefore, an overlap
// error is reported for the following pair of impls (#23516).
diff --git a/tests/ui/coherence/coherence-overlap-issue-23516.stderr b/tests/ui/coherence/coherence-overlap-issue-23516.next.stderr
index cd3984267..a4e87af8a 100644
--- a/tests/ui/coherence/coherence-overlap-issue-23516.stderr
+++ b/tests/ui/coherence/coherence-overlap-issue-23516.next.stderr
@@ -1,5 +1,5 @@
error[E0119]: conflicting implementations of trait `Sweet` for type `Box<_>`
- --> $DIR/coherence-overlap-issue-23516.rs:8:1
+ --> $DIR/coherence-overlap-issue-23516.rs:11:1
|
LL | impl<T:Sugar> Sweet for T { }
| ------------------------- first implementation here
diff --git a/tests/ui/coherence/coherence-overlap-issue-23516.old.stderr b/tests/ui/coherence/coherence-overlap-issue-23516.old.stderr
new file mode 100644
index 000000000..a4e87af8a
--- /dev/null
+++ b/tests/ui/coherence/coherence-overlap-issue-23516.old.stderr
@@ -0,0 +1,13 @@
+error[E0119]: conflicting implementations of trait `Sweet` for type `Box<_>`
+ --> $DIR/coherence-overlap-issue-23516.rs:11:1
+ |
+LL | impl<T:Sugar> Sweet for T { }
+ | ------------------------- first implementation here
+LL | impl<U:Sugar> Sweet for Box<U> { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Box<_>`
+ |
+ = note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/coherence/coherence-overlap-issue-23516.rs b/tests/ui/coherence/coherence-overlap-issue-23516.rs
index 63e42e8f4..c846d3971 100644
--- a/tests/ui/coherence/coherence-overlap-issue-23516.rs
+++ b/tests/ui/coherence/coherence-overlap-issue-23516.rs
@@ -1,3 +1,6 @@
+// revisions: old next
+//[next] compile-flags: -Ztrait-solver=next
+
// Tests that we consider `Box<U>: !Sugar` to be ambiguous, even
// though we see no impl of `Sugar` for `Box`. Therefore, an overlap
// error is reported for the following pair of impls (#23516).
diff --git a/tests/ui/coherence/coherence-unsafe-trait-object-impl.stderr b/tests/ui/coherence/coherence-unsafe-trait-object-impl.stderr
index 2e2dac288..a3a37fd27 100644
--- a/tests/ui/coherence/coherence-unsafe-trait-object-impl.stderr
+++ b/tests/ui/coherence/coherence-unsafe-trait-object-impl.stderr
@@ -6,6 +6,11 @@ LL | takes_t(t);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/coherence-unsafe-trait-object-impl.rs:6:1
+ |
+LL | trait Trait: Sized {
+ | ^^^^^^^^^^^^^^^^^^
note: required by a bound in `takes_t`
--> $DIR/coherence-unsafe-trait-object-impl.rs:10:15
|
diff --git a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.stderr b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr
index 4ddd712b2..0dd28706e 100644
--- a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.stderr
+++ b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr
@@ -1,5 +1,5 @@
error[E0119]: conflicting implementations of trait `From<()>` for type `S`
- --> $DIR/inter-crate-ambiguity-causes-notes.rs:9:1
+ --> $DIR/inter-crate-ambiguity-causes-notes.rs:12:1
|
LL | impl From<()> for S {
| ------------------- first implementation here
diff --git a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr
new file mode 100644
index 000000000..0dd28706e
--- /dev/null
+++ b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr
@@ -0,0 +1,14 @@
+error[E0119]: conflicting implementations of trait `From<()>` for type `S`
+ --> $DIR/inter-crate-ambiguity-causes-notes.rs:12:1
+ |
+LL | impl From<()> for S {
+ | ------------------- first implementation here
+...
+LL | impl<I> From<I> for S
+ | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S`
+ |
+ = note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.rs b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.rs
index 5b11c78ab..743e80d3f 100644
--- a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.rs
+++ b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.rs
@@ -1,3 +1,6 @@
+// revisions: old next
+//[next] compile-flags: -Ztrait-solver=next
+
struct S;
impl From<()> for S {
diff --git a/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr b/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr
index f315ba821..89289767b 100644
--- a/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr
+++ b/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr
@@ -6,13 +6,11 @@ LL | #[derive(PartialEq, Default)]
...
LL | impl<T, Q> PartialEq<Q> for Interval<T>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the first impl is here
-...
-LL | Q: ?Sized + PartialOrd,
- | ---------- `Interval<_>: PartialOrd` may be considered to hold in future releases, causing the impls to overlap
|
= 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 #114040 <https://github.com/rust-lang/rust/issues/114040>
= note: impls that are not considered to overlap may be considered to overlap in the future
+ = note: `Interval<_>: PartialOrd` may be considered to hold in future releases, causing the impls to overlap
note: the lint level is defined here
--> $DIR/warn-when-cycle-is-error-in-coherence.rs:1:9
|
diff --git a/tests/ui/confuse-field-and-method/issue-33784.stderr b/tests/ui/confuse-field-and-method/issue-33784.stderr
index 34debb683..aaf953a66 100644
--- a/tests/ui/confuse-field-and-method/issue-33784.stderr
+++ b/tests/ui/confuse-field-and-method/issue-33784.stderr
@@ -1,4 +1,4 @@
-error[E0599]: no method named `closure` found for reference `&Obj<[closure@$DIR/issue-33784.rs:25:43: 25:45]>` in the current scope
+error[E0599]: no method named `closure` found for reference `&Obj<{closure@$DIR/issue-33784.rs:25:43: 25:45}>` in the current scope
--> $DIR/issue-33784.rs:27:7
|
LL | p.closure();
@@ -9,7 +9,7 @@ help: to call the function stored in `closure`, surround the field access with p
LL | (p.closure)();
| + +
-error[E0599]: no method named `fn_ptr` found for reference `&&Obj<[closure@$DIR/issue-33784.rs:25:43: 25:45]>` in the current scope
+error[E0599]: no method named `fn_ptr` found for reference `&&Obj<{closure@$DIR/issue-33784.rs:25:43: 25:45}>` in the current scope
--> $DIR/issue-33784.rs:29:7
|
LL | q.fn_ptr();
diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_bad.rs b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.rs
index 0da68ae75..c4d2d02ba 100644
--- a/tests/ui/const-generics/adt_const_params/const_param_ty_bad.rs
+++ b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.rs
@@ -5,7 +5,7 @@ fn check(_: impl std::marker::ConstParamTy) {}
fn main() {
check(main); //~ error: `fn() {main}` can't be used as a const parameter type
- check(|| {}); //~ error: `[closure@$DIR/const_param_ty_bad.rs:8:11: 8:13]` can't be used as a const parameter type
+ check(|| {}); //~ error: `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}` can't be used as a const parameter type
check(main as fn()); //~ error: `fn()` can't be used as a const parameter type
check(&mut ()); //~ error: `&mut ()` can't be used as a const parameter type
check(&mut () as *mut ()); //~ error: `*mut ()` can't be used as a const parameter type
diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr
index 48910b82a..d96491f4f 100644
--- a/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr
+++ b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr
@@ -16,11 +16,11 @@ help: use parentheses to call this function
LL | check(main());
| ++
-error[E0277]: `[closure@$DIR/const_param_ty_bad.rs:8:11: 8:13]` can't be used as a const parameter type
+error[E0277]: `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}` can't be used as a const parameter type
--> $DIR/const_param_ty_bad.rs:8:11
|
LL | check(|| {});
- | ----- ^^^^^ the trait `ConstParamTy` is not implemented for closure `[closure@$DIR/const_param_ty_bad.rs:8:11: 8:13]`
+ | ----- ^^^^^ the trait `ConstParamTy` is not implemented for closure `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs
index 08f7c5cb5..7174d1ec4 100644
--- a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs
+++ b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs
@@ -10,10 +10,12 @@ struct CantParam(ImplementsConstParamTy);
impl std::marker::ConstParamTy for CantParam {}
//~^ error: the type `CantParam` does not `#[derive(Eq)]`
//~| error: the type `CantParam` does not `#[derive(PartialEq)]`
+//~| the trait bound `CantParam: Eq` is not satisfied
#[derive(std::marker::ConstParamTy)]
//~^ error: the type `CantParamDerive` does not `#[derive(Eq)]`
//~| error: the type `CantParamDerive` does not `#[derive(PartialEq)]`
+//~| the trait bound `CantParamDerive: Eq` is not satisfied
struct CantParamDerive(ImplementsConstParamTy);
fn check<T: std::marker::ConstParamTy>() {}
diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr
index 43c5b96dc..2cf7cc07d 100644
--- a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr
+++ b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr
@@ -1,3 +1,17 @@
+error[E0277]: the trait bound `CantParam: Eq` is not satisfied
+ --> $DIR/const_param_ty_impl_no_structural_eq.rs:10:36
+ |
+LL | impl std::marker::ConstParamTy for CantParam {}
+ | ^^^^^^^^^ the trait `Eq` is not implemented for `CantParam`
+ |
+note: required by a bound in `ConstParamTy`
+ --> $SRC_DIR/core/src/marker.rs:LL:COL
+help: consider annotating `CantParam` with `#[derive(Eq)]`
+ |
+LL + #[derive(Eq)]
+LL | struct CantParam(ImplementsConstParamTy);
+ |
+
error[E0277]: the type `CantParam` does not `#[derive(PartialEq)]`
--> $DIR/const_param_ty_impl_no_structural_eq.rs:10:36
|
@@ -16,8 +30,23 @@ LL | impl std::marker::ConstParamTy for CantParam {}
note: required by a bound in `ConstParamTy`
--> $SRC_DIR/core/src/marker.rs:LL:COL
+error[E0277]: the trait bound `CantParamDerive: Eq` is not satisfied
+ --> $DIR/const_param_ty_impl_no_structural_eq.rs:15:10
+ |
+LL | #[derive(std::marker::ConstParamTy)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Eq` is not implemented for `CantParamDerive`
+ |
+note: required by a bound in `ConstParamTy`
+ --> $SRC_DIR/core/src/marker.rs:LL:COL
+ = note: this error originates in the derive macro `std::marker::ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider annotating `CantParamDerive` with `#[derive(Eq)]`
+ |
+LL + #[derive(Eq)]
+LL | struct CantParamDerive(ImplementsConstParamTy);
+ |
+
error[E0277]: the type `CantParamDerive` does not `#[derive(PartialEq)]`
- --> $DIR/const_param_ty_impl_no_structural_eq.rs:14:10
+ --> $DIR/const_param_ty_impl_no_structural_eq.rs:15:10
|
LL | #[derive(std::marker::ConstParamTy)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `StructuralPartialEq` is not implemented for `CantParamDerive`
@@ -27,7 +56,7 @@ note: required by a bound in `ConstParamTy`
= note: this error originates in the derive macro `std::marker::ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the type `CantParamDerive` does not `#[derive(Eq)]`
- --> $DIR/const_param_ty_impl_no_structural_eq.rs:14:10
+ --> $DIR/const_param_ty_impl_no_structural_eq.rs:15:10
|
LL | #[derive(std::marker::ConstParamTy)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `StructuralEq` is not implemented for `CantParamDerive`
@@ -36,6 +65,6 @@ note: required by a bound in `ConstParamTy`
--> $SRC_DIR/core/src/marker.rs:LL:COL
= note: this error originates in the derive macro `std::marker::ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: aborting due to 4 previous errors
+error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.rs b/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.rs
new file mode 100644
index 000000000..a83830178
--- /dev/null
+++ b/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.rs
@@ -0,0 +1,44 @@
+// Test that when adt_const_params is not enabled, we suggest adding the feature only when
+// it would be possible for the type to be used as a const generic or when it's likely
+// possible for the user to fix their type to be used.
+
+// Can never be used as const generics.
+fn uwu_0<const N: &'static mut ()>() {}
+//~^ ERROR: forbidden as the type of a const generic
+
+// Needs the feature but can be used, so suggest adding the feature.
+fn owo_0<const N: &'static u32>() {}
+//~^ ERROR: forbidden as the type of a const generic
+//~^^ HELP: add `#![feature(adt_const_params)]`
+
+// Can only be used in const generics with changes.
+struct Meow {
+ meow: u8,
+}
+
+fn meow_0<const N: Meow>() {}
+//~^ ERROR: forbidden as the type of a const generic
+//~^^ HELP: add `#![feature(adt_const_params)]`
+fn meow_1<const N: &'static Meow>() {}
+//~^ ERROR: forbidden as the type of a const generic
+//~^^ HELP: add `#![feature(adt_const_params)]`
+fn meow_2<const N: [Meow; 100]>() {}
+//~^ ERROR: forbidden as the type of a const generic
+//~^^ HELP: add `#![feature(adt_const_params)]`
+fn meow_3<const N: (Meow, u8)>() {}
+//~^ ERROR: forbidden as the type of a const generic
+//~^^ HELP: add `#![feature(adt_const_params)]`
+
+// This is suboptimal that it thinks it can be used
+// but better to suggest the feature to the user.
+fn meow_4<const N: (Meow, String)>() {}
+//~^ ERROR: forbidden as the type of a const generic
+//~^^ HELP: add `#![feature(adt_const_params)]`
+
+// Non-local ADT that does not impl `ConstParamTy`
+fn nya_0<const N: String>() {}
+//~^ ERROR: forbidden as the type of a const generic
+fn nya_1<const N: Vec<u32>>() {}
+//~^ ERROR: forbidden as the type of a const generic
+
+fn main() {}
diff --git a/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.stderr b/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.stderr
new file mode 100644
index 000000000..04527e315
--- /dev/null
+++ b/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.stderr
@@ -0,0 +1,80 @@
+error: `&'static mut ()` is forbidden as the type of a const generic parameter
+ --> $DIR/suggest_feature_only_when_possible.rs:6:19
+ |
+LL | fn uwu_0<const N: &'static mut ()>() {}
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
+
+error: `&'static u32` is forbidden as the type of a const generic parameter
+ --> $DIR/suggest_feature_only_when_possible.rs:10:19
+ |
+LL | fn owo_0<const N: &'static u32>() {}
+ | ^^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
+
+error: `Meow` is forbidden as the type of a const generic parameter
+ --> $DIR/suggest_feature_only_when_possible.rs:19:20
+ |
+LL | fn meow_0<const N: Meow>() {}
+ | ^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
+
+error: `&'static Meow` is forbidden as the type of a const generic parameter
+ --> $DIR/suggest_feature_only_when_possible.rs:22:20
+ |
+LL | fn meow_1<const N: &'static Meow>() {}
+ | ^^^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
+
+error: `[Meow; 100]` is forbidden as the type of a const generic parameter
+ --> $DIR/suggest_feature_only_when_possible.rs:25:20
+ |
+LL | fn meow_2<const N: [Meow; 100]>() {}
+ | ^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
+
+error: `(Meow, u8)` is forbidden as the type of a const generic parameter
+ --> $DIR/suggest_feature_only_when_possible.rs:28:20
+ |
+LL | fn meow_3<const N: (Meow, u8)>() {}
+ | ^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
+
+error: `(Meow, String)` is forbidden as the type of a const generic parameter
+ --> $DIR/suggest_feature_only_when_possible.rs:34:20
+ |
+LL | fn meow_4<const N: (Meow, String)>() {}
+ | ^^^^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
+
+error: `String` is forbidden as the type of a const generic parameter
+ --> $DIR/suggest_feature_only_when_possible.rs:39:19
+ |
+LL | fn nya_0<const N: String>() {}
+ | ^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
+
+error: `Vec<u32>` is forbidden as the type of a const generic parameter
+ --> $DIR/suggest_feature_only_when_possible.rs:41:19
+ |
+LL | fn nya_1<const N: Vec<u32>>() {}
+ | ^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
+
+error: aborting due to 9 previous errors
+
diff --git a/tests/ui/const-generics/const-param-elided-lifetime.min.stderr b/tests/ui/const-generics/const-param-elided-lifetime.min.stderr
index 656bc2946..ffe452859 100644
--- a/tests/ui/const-generics/const-param-elided-lifetime.min.stderr
+++ b/tests/ui/const-generics/const-param-elided-lifetime.min.stderr
@@ -35,7 +35,7 @@ LL | struct A<const N: &u8>;
| ^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `&u8` is forbidden as the type of a const generic parameter
--> $DIR/const-param-elided-lifetime.rs:14:15
@@ -44,7 +44,7 @@ LL | impl<const N: &u8> A<N> {
| ^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `&u8` is forbidden as the type of a const generic parameter
--> $DIR/const-param-elided-lifetime.rs:22:15
@@ -53,7 +53,7 @@ LL | impl<const N: &u8> B for A<N> {}
| ^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `&u8` is forbidden as the type of a const generic parameter
--> $DIR/const-param-elided-lifetime.rs:26:17
@@ -62,7 +62,7 @@ LL | fn bar<const N: &u8>() {}
| ^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `&u8` is forbidden as the type of a const generic parameter
--> $DIR/const-param-elided-lifetime.rs:17:21
@@ -71,7 +71,7 @@ LL | fn foo<const M: &u8>(&self) {}
| ^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 10 previous errors
diff --git a/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr b/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr
index f829526ca..daeeadeed 100644
--- a/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr
+++ b/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr
@@ -21,7 +21,7 @@ LL | pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]);
| ^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `[u8; N]` is forbidden as the type of a const generic parameter
--> $DIR/const-param-type-depends-on-const-param.rs:15:35
@@ -30,7 +30,7 @@ LL | pub struct SelfDependent<const N: [u8; N]>;
| ^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 4 previous errors
diff --git a/tests/ui/const-generics/dont-evaluate-array-len-on-err-1.stderr b/tests/ui/const-generics/dont-evaluate-array-len-on-err-1.stderr
index d8eebeb0d..b3a275660 100644
--- a/tests/ui/const-generics/dont-evaluate-array-len-on-err-1.stderr
+++ b/tests/ui/const-generics/dont-evaluate-array-len-on-err-1.stderr
@@ -1,8 +1,14 @@
error[E0277]: the trait bound `[Adt; std::mem::size_of::<Self::Assoc>()]: Foo` is not satisfied
- --> $DIR/dont-evaluate-array-len-on-err-1.rs:15:9
+ --> $DIR/dont-evaluate-array-len-on-err-1.rs:15:10
|
LL | <[Adt; std::mem::size_of::<Self::Assoc>()] as Foo>::bar()
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `[Adt; std::mem::size_of::<Self::Assoc>()]`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `[Adt; std::mem::size_of::<Self::Assoc>()]`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/dont-evaluate-array-len-on-err-1.rs:9:1
+ |
+LL | trait Foo {
+ | ^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/const-generics/early/const-param-from-outer-fn.rs b/tests/ui/const-generics/early/const-param-from-outer-fn.rs
index c3b418ee3..ee57f3c4f 100644
--- a/tests/ui/const-generics/early/const-param-from-outer-fn.rs
+++ b/tests/ui/const-generics/early/const-param-from-outer-fn.rs
@@ -1,6 +1,6 @@
fn foo<const X: u32>() {
fn bar() -> u32 {
- X //~ ERROR can't use generic parameters from outer function
+ X //~ ERROR can't use generic parameters from outer item
}
}
diff --git a/tests/ui/const-generics/early/const-param-from-outer-fn.stderr b/tests/ui/const-generics/early/const-param-from-outer-fn.stderr
index e3bf38b70..826f26579 100644
--- a/tests/ui/const-generics/early/const-param-from-outer-fn.stderr
+++ b/tests/ui/const-generics/early/const-param-from-outer-fn.stderr
@@ -1,12 +1,12 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/const-param-from-outer-fn.rs:3:9
|
LL | fn foo<const X: u32>() {
- | - const parameter from outer function
+ | - const parameter from outer item
LL | fn bar() -> u32 {
- | - help: try using a local generic parameter instead: `<X>`
+ | - help: try introducing a local generic parameter here: `<X>`
LL | X
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
error: aborting due to previous error
diff --git a/tests/ui/const-generics/exhaustive-value.stderr b/tests/ui/const-generics/exhaustive-value.stderr
index 4a26e0977..deb65ddba 100644
--- a/tests/ui/const-generics/exhaustive-value.stderr
+++ b/tests/ui/const-generics/exhaustive-value.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `(): Foo<N>` is not satisfied
- --> $DIR/exhaustive-value.rs:262:5
+ --> $DIR/exhaustive-value.rs:262:6
|
LL | <() as Foo<N>>::test()
- | ^^^^^^^^^^^^^^^^^^^^ the trait `Foo<N>` is not implemented for `()`
+ | ^^ the trait `Foo<N>` is not implemented for `()`
|
= help: the following other types implement trait `Foo<N>`:
<() as Foo<0>>
diff --git a/tests/ui/const-generics/float-generic.simple.stderr b/tests/ui/const-generics/float-generic.simple.stderr
index 89ca36b0f..aeb19dc75 100644
--- a/tests/ui/const-generics/float-generic.simple.stderr
+++ b/tests/ui/const-generics/float-generic.simple.stderr
@@ -5,7 +5,6 @@ LL | fn foo<const F: f32>() {}
| ^^^
|
= 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 previous error
diff --git a/tests/ui/const-generics/fn-const-param-call.min.stderr b/tests/ui/const-generics/fn-const-param-call.min.stderr
index d984449e6..2d316fba1 100644
--- a/tests/ui/const-generics/fn-const-param-call.min.stderr
+++ b/tests/ui/const-generics/fn-const-param-call.min.stderr
@@ -3,12 +3,16 @@ error: using function pointers as const generic parameters is forbidden
|
LL | struct Wrapper<const F: fn() -> u32>;
| ^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: using function pointers as const generic parameters is forbidden
--> $DIR/fn-const-param-call.rs:13:15
|
LL | impl<const F: fn() -> u32> Wrapper<F> {
| ^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/fn-const-param-infer.min.stderr b/tests/ui/const-generics/fn-const-param-infer.min.stderr
index f0767a109..a7afa4842 100644
--- a/tests/ui/const-generics/fn-const-param-infer.min.stderr
+++ b/tests/ui/const-generics/fn-const-param-infer.min.stderr
@@ -3,6 +3,8 @@ error: using function pointers as const generic parameters is forbidden
|
LL | struct Checked<const F: fn(usize) -> bool>;
| ^^^^^^^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: aborting due to previous error
diff --git a/tests/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.min.stderr b/tests/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.min.stderr
index 956e9c9c9..64d1e0bcf 100644
--- a/tests/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.min.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.min.stderr
@@ -23,7 +23,7 @@ LL | struct B<const CFG: Config> {
| ^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 3 previous errors
diff --git a/tests/ui/const-generics/generic_const_exprs/eval-privacy.rs b/tests/ui/const-generics/generic_const_exprs/eval-privacy.rs
index e5464a425..8023b998a 100644
--- a/tests/ui/const-generics/generic_const_exprs/eval-privacy.rs
+++ b/tests/ui/const-generics/generic_const_exprs/eval-privacy.rs
@@ -1,12 +1,6 @@
#![crate_type = "lib"]
#![feature(generic_const_exprs)]
-#![feature(type_privacy_lints)]
#![allow(incomplete_features)]
-#![warn(private_interfaces)]
-
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
pub struct Const<const U: u8>;
@@ -21,7 +15,6 @@ where
{
type AssocTy = Const<{ my_const_fn(U) }>;
//~^ ERROR private type
- //~| WARNING type `fn(u8) -> u8 {my_const_fn}` is more private than the item `<Const<U> as Trait>::AssocTy`
fn assoc_fn() -> Self::AssocTy {
Const
}
diff --git a/tests/ui/const-generics/generic_const_exprs/eval-privacy.stderr b/tests/ui/const-generics/generic_const_exprs/eval-privacy.stderr
index 16fae6b5c..2d9de8805 100644
--- a/tests/ui/const-generics/generic_const_exprs/eval-privacy.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/eval-privacy.stderr
@@ -1,5 +1,5 @@
error[E0446]: private type `fn(u8) -> u8 {my_const_fn}` in public interface
- --> $DIR/eval-privacy.rs:22:5
+ --> $DIR/eval-privacy.rs:16:5
|
LL | type AssocTy = Const<{ my_const_fn(U) }>;
| ^^^^^^^^^^^^ can't leak private type
@@ -7,23 +7,6 @@ LL | type AssocTy = Const<{ my_const_fn(U) }>;
LL | const fn my_const_fn(val: u8) -> u8 {
| ----------------------------------- `fn(u8) -> u8 {my_const_fn}` declared as private
-warning: type `fn(u8) -> u8 {my_const_fn}` is more private than the item `<Const<U> as Trait>::AssocTy`
- --> $DIR/eval-privacy.rs:22:5
- |
-LL | type AssocTy = Const<{ my_const_fn(U) }>;
- | ^^^^^^^^^^^^ associated type `<Const<U> as Trait>::AssocTy` is reachable at visibility `pub`
- |
-note: but type `fn(u8) -> u8 {my_const_fn}` is only usable at visibility `pub(crate)`
- --> $DIR/eval-privacy.rs:30:1
- |
-LL | const fn my_const_fn(val: u8) -> u8 {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: the lint level is defined here
- --> $DIR/eval-privacy.rs:5:9
- |
-LL | #![warn(private_interfaces)]
- | ^^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error; 1 warning emitted
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/const-generics/generic_const_exprs/issue-85848.stderr b/tests/ui/const-generics/generic_const_exprs/issue-85848.stderr
index e50ac671e..9391b1c1a 100644
--- a/tests/ui/const-generics/generic_const_exprs/issue-85848.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/issue-85848.stderr
@@ -6,7 +6,11 @@ LL | writes_to_specific_path(&cap);
| |
| required by a bound introduced by this call
|
- = help: the trait `Delegates<U>` is implemented for `T`
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-85848.rs:4:1
+ |
+LL | trait _Contains<T> {
+ | ^^^^^^^^^^^^^^^^^^
note: required for `&C` to implement `Contains<(), true>`
--> $DIR/issue-85848.rs:21:12
|
diff --git a/tests/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr b/tests/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr
index b8a1027c9..4c45339b9 100644
--- a/tests/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr
+++ b/tests/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr
@@ -14,7 +14,7 @@ LL | trait Trait<const S: &'static str> {}
| ^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/issues/issue-100313.stderr b/tests/ui/const-generics/issues/issue-100313.stderr
index 42ad4d61c..796966b22 100644
--- a/tests/ui/const-generics/issues/issue-100313.stderr
+++ b/tests/ui/const-generics/issues/issue-100313.stderr
@@ -4,6 +4,7 @@ error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
LL | *(B as *const bool as *mut bool) = false;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
= note: `#[deny(invalid_reference_casting)]` on by default
error[E0080]: evaluation of constant value failed
diff --git a/tests/ui/const-generics/issues/issue-56445-1.min.stderr b/tests/ui/const-generics/issues/issue-56445-1.min.stderr
index 71a7051f2..fc10aba0f 100644
--- a/tests/ui/const-generics/issues/issue-56445-1.min.stderr
+++ b/tests/ui/const-generics/issues/issue-56445-1.min.stderr
@@ -13,7 +13,7 @@ LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
| ^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/issues/issue-62878.min.stderr b/tests/ui/const-generics/issues/issue-62878.min.stderr
index 9c0e5179c..eb8b9732f 100644
--- a/tests/ui/const-generics/issues/issue-62878.min.stderr
+++ b/tests/ui/const-generics/issues/issue-62878.min.stderr
@@ -13,7 +13,7 @@ LL | fn foo<const N: usize, const A: [u8; N]>() {}
| ^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/issues/issue-63322-forbid-dyn.min.stderr b/tests/ui/const-generics/issues/issue-63322-forbid-dyn.min.stderr
index 9f6c7ccf3..9d80f1cd0 100644
--- a/tests/ui/const-generics/issues/issue-63322-forbid-dyn.min.stderr
+++ b/tests/ui/const-generics/issues/issue-63322-forbid-dyn.min.stderr
@@ -5,7 +5,7 @@ LL | fn test<const T: &'static dyn A>() {
| ^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to previous error
diff --git a/tests/ui/const-generics/issues/issue-68615-adt.min.stderr b/tests/ui/const-generics/issues/issue-68615-adt.min.stderr
index df04c4896..c8b9f1719 100644
--- a/tests/ui/const-generics/issues/issue-68615-adt.min.stderr
+++ b/tests/ui/const-generics/issues/issue-68615-adt.min.stderr
@@ -5,7 +5,7 @@ LL | struct Const<const V: [usize; 0]> {}
| ^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to previous error
diff --git a/tests/ui/const-generics/issues/issue-68615-array.min.stderr b/tests/ui/const-generics/issues/issue-68615-array.min.stderr
index 1b4517087..fc6cef9d4 100644
--- a/tests/ui/const-generics/issues/issue-68615-array.min.stderr
+++ b/tests/ui/const-generics/issues/issue-68615-array.min.stderr
@@ -5,7 +5,7 @@ LL | struct Foo<const V: [usize; 0] > {}
| ^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to previous error
diff --git a/tests/ui/const-generics/issues/issue-71169.min.stderr b/tests/ui/const-generics/issues/issue-71169.min.stderr
index ebfb24bec..bba92f32a 100644
--- a/tests/ui/const-generics/issues/issue-71169.min.stderr
+++ b/tests/ui/const-generics/issues/issue-71169.min.stderr
@@ -13,7 +13,7 @@ LL | fn foo<const LEN: usize, const DATA: [u8; LEN]>() {}
| ^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/issues/issue-71381.min.stderr b/tests/ui/const-generics/issues/issue-71381.min.stderr
index e1e140071..e16d3b7a8 100644
--- a/tests/ui/const-generics/issues/issue-71381.min.stderr
+++ b/tests/ui/const-generics/issues/issue-71381.min.stderr
@@ -19,12 +19,16 @@ error: using function pointers as const generic parameters is forbidden
|
LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&self) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: using function pointers as const generic parameters is forbidden
--> $DIR/issue-71381.rs:23:19
|
LL | const FN: unsafe extern "C" fn(Args),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: aborting due to 4 previous errors
diff --git a/tests/ui/const-generics/issues/issue-71382.min.stderr b/tests/ui/const-generics/issues/issue-71382.min.stderr
index 715037bd5..217166d84 100644
--- a/tests/ui/const-generics/issues/issue-71382.min.stderr
+++ b/tests/ui/const-generics/issues/issue-71382.min.stderr
@@ -3,6 +3,8 @@ error: using function pointers as const generic parameters is forbidden
|
LL | fn test<const FN: fn()>(&self) {
| ^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: aborting due to previous error
diff --git a/tests/ui/const-generics/issues/issue-71611.min.stderr b/tests/ui/const-generics/issues/issue-71611.min.stderr
index b33d7cf98..b01936f4d 100644
--- a/tests/ui/const-generics/issues/issue-71611.min.stderr
+++ b/tests/ui/const-generics/issues/issue-71611.min.stderr
@@ -11,6 +11,8 @@ error: using function pointers as const generic parameters is forbidden
|
LL | fn func<A, const F: fn(inner: A)>(outer: A) {
| ^^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/issues/issue-72352.min.stderr b/tests/ui/const-generics/issues/issue-72352.min.stderr
index eedd73c4d..b010996b8 100644
--- a/tests/ui/const-generics/issues/issue-72352.min.stderr
+++ b/tests/ui/const-generics/issues/issue-72352.min.stderr
@@ -3,6 +3,8 @@ error: using function pointers as const generic parameters is forbidden
|
LL | unsafe fn unsafely_do_the_thing<const F: fn(&CStr) -> usize>(ptr: *const i8) -> usize {
| ^^^^^^^^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: aborting due to previous error
diff --git a/tests/ui/const-generics/issues/issue-73491.min.stderr b/tests/ui/const-generics/issues/issue-73491.min.stderr
index f03354fc4..fdf057bdb 100644
--- a/tests/ui/const-generics/issues/issue-73491.min.stderr
+++ b/tests/ui/const-generics/issues/issue-73491.min.stderr
@@ -5,7 +5,7 @@ LL | fn hoge<const IN: [u32; LEN]>() {}
| ^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to previous error
diff --git a/tests/ui/const-generics/issues/issue-73727-static-reference-array-const-param.min.stderr b/tests/ui/const-generics/issues/issue-73727-static-reference-array-const-param.min.stderr
index 0a7db6247..bed0a02a7 100644
--- a/tests/ui/const-generics/issues/issue-73727-static-reference-array-const-param.min.stderr
+++ b/tests/ui/const-generics/issues/issue-73727-static-reference-array-const-param.min.stderr
@@ -5,7 +5,7 @@ LL | fn a<const X: &'static [u32]>() {}
| ^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to previous error
diff --git a/tests/ui/const-generics/issues/issue-74101.min.stderr b/tests/ui/const-generics/issues/issue-74101.min.stderr
index 134c24834..7852ce5bc 100644
--- a/tests/ui/const-generics/issues/issue-74101.min.stderr
+++ b/tests/ui/const-generics/issues/issue-74101.min.stderr
@@ -5,7 +5,7 @@ LL | fn test<const N: [u8; 1 + 2]>() {}
| ^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `[u8; 1 + 2]` is forbidden as the type of a const generic parameter
--> $DIR/issue-74101.rs:9:21
@@ -14,7 +14,7 @@ LL | struct Foo<const N: [u8; 1 + 2]>;
| ^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/issues/issue-74255.min.stderr b/tests/ui/const-generics/issues/issue-74255.min.stderr
index bbcf8682b..affeca167 100644
--- a/tests/ui/const-generics/issues/issue-74255.min.stderr
+++ b/tests/ui/const-generics/issues/issue-74255.min.stderr
@@ -5,7 +5,7 @@ LL | fn ice_struct_fn<const I: IceEnum>() {}
| ^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to previous error
diff --git a/tests/ui/const-generics/issues/issue-74950.min.stderr b/tests/ui/const-generics/issues/issue-74950.min.stderr
index c37ee93d4..a5dbe10b7 100644
--- a/tests/ui/const-generics/issues/issue-74950.min.stderr
+++ b/tests/ui/const-generics/issues/issue-74950.min.stderr
@@ -5,7 +5,7 @@ LL | struct Outer<const I: Inner>;
| ^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `Inner` is forbidden as the type of a const generic parameter
--> $DIR/issue-74950.rs:20:23
@@ -14,7 +14,7 @@ LL | struct Outer<const I: Inner>;
| ^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `Inner` is forbidden as the type of a const generic parameter
--> $DIR/issue-74950.rs:20:23
@@ -23,7 +23,7 @@ LL | struct Outer<const I: Inner>;
| ^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `Inner` is forbidden as the type of a const generic parameter
--> $DIR/issue-74950.rs:20:23
@@ -32,7 +32,7 @@ LL | struct Outer<const I: Inner>;
| ^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `Inner` is forbidden as the type of a const generic parameter
--> $DIR/issue-74950.rs:20:23
@@ -41,7 +41,7 @@ LL | struct Outer<const I: Inner>;
| ^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 5 previous errors
diff --git a/tests/ui/const-generics/issues/issue-75047.min.stderr b/tests/ui/const-generics/issues/issue-75047.min.stderr
index 46af19ef3..e316b4624 100644
--- a/tests/ui/const-generics/issues/issue-75047.min.stderr
+++ b/tests/ui/const-generics/issues/issue-75047.min.stderr
@@ -5,7 +5,7 @@ LL | struct Foo<const N: [u8; Bar::<u32>::value()]>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to previous error
diff --git a/tests/ui/const-generics/issues/issue-86530.stderr b/tests/ui/const-generics/issues/issue-86530.stderr
index 620ed4f0f..d02808f7c 100644
--- a/tests/ui/const-generics/issues/issue-86530.stderr
+++ b/tests/ui/const-generics/issues/issue-86530.stderr
@@ -6,6 +6,11 @@ LL | z(" ");
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-86530.rs:4:1
+ |
+LL | pub trait X {
+ | ^^^^^^^^^^^
note: required by a bound in `z`
--> $DIR/issue-86530.rs:10:8
|
diff --git a/tests/ui/const-generics/late-bound-vars/in_closure.rs b/tests/ui/const-generics/late-bound-vars/in_closure.rs
index 4fdf603b0..443c755c6 100644
--- a/tests/ui/const-generics/late-bound-vars/in_closure.rs
+++ b/tests/ui/const-generics/late-bound-vars/in_closure.rs
@@ -1,28 +1,13 @@
-// failure-status: 101
// known-bug: unknown
-// error-pattern:internal compiler error
-// normalize-stderr-test "internal compiler error.*" -> ""
-// 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" -> ""
-// normalize-stderr-test "note: compiler flags.*\n\n" -> ""
-// normalize-stderr-test "note: rustc.*running on.*\n\n" -> ""
-// normalize-stderr-test "thread.*panicked.*:\n.*\n" -> ""
-// normalize-stderr-test "stack backtrace:\n" -> ""
-// normalize-stderr-test "\s\d{1,}: .*\n" -> ""
-// normalize-stderr-test "\s at .*\n" -> ""
-// normalize-stderr-test ".*note: Some details.*\n" -> ""
-// normalize-stderr-test "\n[ ]*\n" -> ""
-// normalize-stderr-test "compiler/.*: projection" -> "projection"
-// normalize-stderr-test ".*omitted \d{1,} frame.*\n" -> ""
-// normalize-stderr-test "error: [\s\n]*query stack during panic:\n" -> ""
-// this should run-pass
+// see comment on `tests/ui/const-generics/late-bound-vars/simple.rs`
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
-const fn inner<'a>() -> usize where &'a (): Sized {
+const fn inner<'a>() -> usize
+where
+ &'a (): Sized,
+{
3
}
diff --git a/tests/ui/const-generics/late-bound-vars/in_closure.stderr b/tests/ui/const-generics/late-bound-vars/in_closure.stderr
index ac406bf2b..e15496454 100644
--- a/tests/ui/const-generics/late-bound-vars/in_closure.stderr
+++ b/tests/ui/const-generics/late-bound-vars/in_closure.stderr
@@ -1,10 +1,20 @@
-#0 [mir_borrowck] borrow-checking `test::{closure#0}::{constant#1}`
-#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `test::{closure#0}::{constant#1}`
-#2 [mir_for_ctfe] caching mir of `test::{closure#0}::{constant#1}` for CTFE
-#3 [eval_to_allocation_raw] const-evaluating + checking `test::{closure#0}::{constant#1}`
-#4 [eval_to_allocation_raw] const-evaluating + checking `test::{closure#0}::{constant#1}`
-#5 [eval_to_valtree] evaluating type-level constant
-#6 [typeck] type-checking `test`
-#7 [analysis] running analysis passes on this crate
-end of query stack
-error: aborting due to previous error \ No newline at end of file
+error: cannot capture late-bound lifetime in constant
+ --> $DIR/in_closure.rs:16:29
+ |
+LL | fn test<'a>() {
+ | -- lifetime defined here
+LL | let _ = || {
+LL | let _: [u8; inner::<'a>()];
+ | ^^
+
+error: cannot capture late-bound lifetime in constant
+ --> $DIR/in_closure.rs:17:29
+ |
+LL | fn test<'a>() {
+ | -- lifetime defined here
+...
+LL | let _ = [0; inner::<'a>()];
+ | ^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.rs b/tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.rs
new file mode 100644
index 000000000..b81aa50d9
--- /dev/null
+++ b/tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.rs
@@ -0,0 +1,13 @@
+// known-bug: unknown
+// see comment on `tests/ui/const-generics/late-bound-vars/simple.rs`
+
+#![feature(generic_const_exprs)]
+#![allow(incomplete_features)]
+
+trait MyTrait<T> {}
+
+fn bug<'a, T>() -> &'static dyn MyTrait<[(); { |x: &'a u32| { x }; 4 }]> {
+ todo!()
+}
+
+fn main() {}
diff --git a/tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.stderr b/tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.stderr
new file mode 100644
index 000000000..21c8fe686
--- /dev/null
+++ b/tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.stderr
@@ -0,0 +1,8 @@
+error: cannot capture late-bound lifetime in constant
+ --> $DIR/late-bound-in-return-issue-77357.rs:9:53
+ |
+LL | fn bug<'a, T>() -> &'static dyn MyTrait<[(); { |x: &'a u32| { x }; 4 }]> {
+ | -- lifetime defined here ^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.rs b/tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.rs
new file mode 100644
index 000000000..89f01748f
--- /dev/null
+++ b/tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.rs
@@ -0,0 +1,15 @@
+// known-bug: unknown
+// see comment on `tests/ui/const-generics/late-bound-vars/simple.rs`
+
+#![feature(generic_const_exprs)]
+#![allow(incomplete_features)]
+
+fn bug<'a>()
+where
+ for<'b> [(); {
+ let x: &'b ();
+ 0
+ }]:
+{}
+
+fn main() {}
diff --git a/tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.stderr b/tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.stderr
new file mode 100644
index 000000000..a66dc8db9
--- /dev/null
+++ b/tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.stderr
@@ -0,0 +1,10 @@
+error: cannot capture late-bound lifetime in constant
+ --> $DIR/late-bound-in-where-issue-83993.rs:10:17
+ |
+LL | for<'b> [(); {
+ | -- lifetime defined here
+LL | let x: &'b ();
+ | ^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/const-generics/late-bound-vars/simple.rs b/tests/ui/const-generics/late-bound-vars/simple.rs
index 544073b5a..a562bd8cb 100644
--- a/tests/ui/const-generics/late-bound-vars/simple.rs
+++ b/tests/ui/const-generics/late-bound-vars/simple.rs
@@ -1,22 +1,13 @@
-// failure-status: 101
// known-bug: unknown
-// error-pattern:internal compiler error
-// normalize-stderr-test "internal compiler error.*" -> ""
-// 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" -> ""
-// normalize-stderr-test "note: compiler flags.*\n\n" -> ""
-// normalize-stderr-test "note: rustc.*running on.*\n\n" -> ""
-// normalize-stderr-test "thread.*panicked.*:\n.*\n" -> ""
-// normalize-stderr-test "stack backtrace:\n" -> ""
-// normalize-stderr-test "\s\d{1,}: .*\n" -> ""
-// normalize-stderr-test "\s at .*\n" -> ""
-// normalize-stderr-test ".*note: Some details.*\n" -> ""
-// normalize-stderr-test "\n\n[ ]*\n" -> ""
-// normalize-stderr-test "compiler/.*: projection" -> "projection"
-// normalize-stderr-test ".*omitted \d{1,} frame.*\n" -> ""
-// normalize-stderr-test "error: [\s\n]*query stack" -> "error: query stack"
+
+// If we want this to compile, then we'd need to do something like RPITs do,
+// where nested associated constants have early-bound versions of their captured
+// late-bound vars inserted into their generics. This gives us substitutable
+// lifetimes to actually use when borrow-checking the associated const, which is
+// lowered as a totally separate body from its parent. Since this doesn't exist,
+// we should just error rather than resolving this late-bound var with no
+// binder to actually attach it to, or worse, as a free region that can't even be
+// substituted correctly, and ICEing. - @compiler-errors
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
diff --git a/tests/ui/const-generics/late-bound-vars/simple.stderr b/tests/ui/const-generics/late-bound-vars/simple.stderr
index c9f2164b6..e72e37363 100644
--- a/tests/ui/const-generics/late-bound-vars/simple.stderr
+++ b/tests/ui/const-generics/late-bound-vars/simple.stderr
@@ -1,12 +1,19 @@
-error: query stack during panic:
-#0 [mir_borrowck] borrow-checking `test::{constant#1}`
-#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `test::{constant#1}`
-#2 [mir_for_ctfe] caching mir of `test::{constant#1}` for CTFE
-#3 [eval_to_allocation_raw] const-evaluating + checking `test::{constant#1}`
-#4 [eval_to_allocation_raw] const-evaluating + checking `test::{constant#1}`
-#5 [eval_to_valtree] evaluating type-level constant
-#6 [typeck] type-checking `test`
-#7 [analysis] running analysis passes on this crate
-end of query stack
-error: aborting due to previous error
+error: cannot capture late-bound lifetime in constant
+ --> $DIR/simple.rs:20:25
+ |
+LL | fn test<'a>() {
+ | -- lifetime defined here
+LL | let _: [u8; inner::<'a>()];
+ | ^^
+
+error: cannot capture late-bound lifetime in constant
+ --> $DIR/simple.rs:21:25
+ |
+LL | fn test<'a>() {
+ | -- lifetime defined here
+LL | let _: [u8; inner::<'a>()];
+LL | let _ = [0; inner::<'a>()];
+ | ^^
+
+error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/lifetime-in-const-param.stderr b/tests/ui/const-generics/lifetime-in-const-param.stderr
index 8fd9068e8..c2fcdcf1a 100644
--- a/tests/ui/const-generics/lifetime-in-const-param.stderr
+++ b/tests/ui/const-generics/lifetime-in-const-param.stderr
@@ -11,7 +11,7 @@ LL | struct S<'a, const N: S2>(&'a ());
| ^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/min_const_generics/complex-types.stderr b/tests/ui/const-generics/min_const_generics/complex-types.stderr
index 4ddbadb54..8cc75dbaf 100644
--- a/tests/ui/const-generics/min_const_generics/complex-types.stderr
+++ b/tests/ui/const-generics/min_const_generics/complex-types.stderr
@@ -5,7 +5,7 @@ LL | struct Foo<const N: [u8; 0]>;
| ^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `()` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:6:21
@@ -14,7 +14,7 @@ LL | struct Bar<const N: ()>;
| ^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `No` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:11:21
@@ -23,7 +23,7 @@ LL | struct Fez<const N: No>;
| ^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `&'static u8` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:14:21
@@ -32,7 +32,7 @@ LL | struct Faz<const N: &'static u8>;
| ^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `!` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:17:21
@@ -41,7 +41,6 @@ LL | struct Fiz<const N: !>;
| ^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
error: `()` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:20:19
@@ -50,7 +49,7 @@ LL | enum Goo<const N: ()> { A, B }
| ^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `()` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:23:20
@@ -59,7 +58,7 @@ LL | union Boo<const N: ()> { a: () }
| ^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 7 previous errors
diff --git a/tests/ui/const-generics/nested-type.min.stderr b/tests/ui/const-generics/nested-type.min.stderr
index 257a9e31e..ca5af5f96 100644
--- a/tests/ui/const-generics/nested-type.min.stderr
+++ b/tests/ui/const-generics/nested-type.min.stderr
@@ -30,7 +30,7 @@ LL | | }]>;
| |__^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/projection-as-arg-const.stderr b/tests/ui/const-generics/projection-as-arg-const.stderr
index 803ed9c95..9f727231e 100644
--- a/tests/ui/const-generics/projection-as-arg-const.stderr
+++ b/tests/ui/const-generics/projection-as-arg-const.stderr
@@ -5,7 +5,6 @@ LL | pub fn foo<const X: <i32 as Identity>::Identity>() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= 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 previous error
diff --git a/tests/ui/const-generics/raw-ptr-const-param-deref.min.stderr b/tests/ui/const-generics/raw-ptr-const-param-deref.min.stderr
index 04bc46cb4..1eb238255 100644
--- a/tests/ui/const-generics/raw-ptr-const-param-deref.min.stderr
+++ b/tests/ui/const-generics/raw-ptr-const-param-deref.min.stderr
@@ -3,12 +3,16 @@ error: using raw pointers as const generic parameters is forbidden
|
LL | struct Const<const P: *const u32>;
| ^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: using raw pointers as const generic parameters is forbidden
--> $DIR/raw-ptr-const-param-deref.rs:11:15
|
LL | impl<const P: *const u32> Const<P> {
| ^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/raw-ptr-const-param.min.stderr b/tests/ui/const-generics/raw-ptr-const-param.min.stderr
index 310422aaf..13fbc34e5 100644
--- a/tests/ui/const-generics/raw-ptr-const-param.min.stderr
+++ b/tests/ui/const-generics/raw-ptr-const-param.min.stderr
@@ -3,6 +3,8 @@ error: using raw pointers as const generic parameters is forbidden
|
LL | struct Const<const P: *const u32>;
| ^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: aborting due to previous error
diff --git a/tests/ui/const-generics/slice-const-param-mismatch.min.stderr b/tests/ui/const-generics/slice-const-param-mismatch.min.stderr
index fed802f6a..3c086f59b 100644
--- a/tests/ui/const-generics/slice-const-param-mismatch.min.stderr
+++ b/tests/ui/const-generics/slice-const-param-mismatch.min.stderr
@@ -5,7 +5,7 @@ LL | struct ConstString<const T: &'static str>;
| ^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `&'static [u8]` is forbidden as the type of a const generic parameter
--> $DIR/slice-const-param-mismatch.rs:9:28
@@ -14,7 +14,7 @@ LL | struct ConstBytes<const T: &'static [u8]>;
| ^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/std/const-generics-range.min.stderr b/tests/ui/const-generics/std/const-generics-range.min.stderr
index 53fca6e88..d45f74924 100644
--- a/tests/ui/const-generics/std/const-generics-range.min.stderr
+++ b/tests/ui/const-generics/std/const-generics-range.min.stderr
@@ -5,7 +5,7 @@ LL | struct _Range<const R: std::ops::Range<usize>>;
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `RangeFrom<usize>` is forbidden as the type of a const generic parameter
--> $DIR/const-generics-range.rs:13:28
@@ -14,7 +14,7 @@ LL | struct _RangeFrom<const R: std::ops::RangeFrom<usize>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `RangeFull` is forbidden as the type of a const generic parameter
--> $DIR/const-generics-range.rs:18:28
@@ -23,7 +23,7 @@ LL | struct _RangeFull<const R: std::ops::RangeFull>;
| ^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `RangeInclusive<usize>` is forbidden as the type of a const generic parameter
--> $DIR/const-generics-range.rs:24:33
@@ -32,7 +32,7 @@ LL | struct _RangeInclusive<const R: std::ops::RangeInclusive<usize>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `RangeTo<usize>` is forbidden as the type of a const generic parameter
--> $DIR/const-generics-range.rs:29:26
@@ -41,7 +41,7 @@ LL | struct _RangeTo<const R: std::ops::RangeTo<usize>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `RangeToInclusive<usize>` is forbidden as the type of a const generic parameter
--> $DIR/const-generics-range.rs:34:35
@@ -50,7 +50,7 @@ LL | struct _RangeToInclusive<const R: std::ops::RangeToInclusive<usize>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 6 previous errors
diff --git a/tests/ui/const-generics/transmute-const-param-static-reference.min.stderr b/tests/ui/const-generics/transmute-const-param-static-reference.min.stderr
index 039c4276c..f18e14946 100644
--- a/tests/ui/const-generics/transmute-const-param-static-reference.min.stderr
+++ b/tests/ui/const-generics/transmute-const-param-static-reference.min.stderr
@@ -5,7 +5,7 @@ LL | struct Const<const P: &'static ()>;
| ^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to previous error
diff --git a/tests/ui/const-generics/type-dependent/issue-71348.min.stderr b/tests/ui/const-generics/type-dependent/issue-71348.min.stderr
index b8fbb3979..6490592c1 100644
--- a/tests/ui/const-generics/type-dependent/issue-71348.min.stderr
+++ b/tests/ui/const-generics/type-dependent/issue-71348.min.stderr
@@ -5,7 +5,7 @@ LL | trait Get<'a, const N: &'static str> {
| ^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `&'static str` is forbidden as the type of a const generic parameter
--> $DIR/issue-71348.rs:18:25
@@ -14,7 +14,7 @@ LL | fn ask<'a, const N: &'static str>(&'a self) -> &'a <Self as Get<N>>::Ta
| ^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/type-dependent/issue-71382.stderr b/tests/ui/const-generics/type-dependent/issue-71382.stderr
index ad522aead..3f42feea5 100644
--- a/tests/ui/const-generics/type-dependent/issue-71382.stderr
+++ b/tests/ui/const-generics/type-dependent/issue-71382.stderr
@@ -3,6 +3,8 @@ error: using function pointers as const generic parameters is forbidden
|
LL | fn test<const FN: fn() -> u8>(&self) -> u8 {
| ^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: aborting due to previous error
diff --git a/tests/ui/const_prop/dont-propagate-generic-instance-2.rs b/tests/ui/const_prop/dont-propagate-generic-instance-2.rs
new file mode 100644
index 000000000..e5525af23
--- /dev/null
+++ b/tests/ui/const_prop/dont-propagate-generic-instance-2.rs
@@ -0,0 +1,26 @@
+// run-pass
+
+#![feature(inline_const)]
+
+// Makes sure we don't propagate generic instances of `Self: ?Sized` blanket impls.
+// This is relevant when we have an overlapping impl and builtin dyn instance.
+// See <https://github.com/rust-lang/rust/pull/114941> for more context.
+
+trait Trait {
+ fn foo(&self) -> &'static str;
+}
+
+impl<T: ?Sized> Trait for T {
+ fn foo(&self) -> &'static str {
+ std::any::type_name::<T>()
+ }
+}
+
+fn bar<T: ?Sized>() -> fn(&T) -> &'static str {
+ const { Trait::foo as fn(&T) -> &'static str }
+ // If const prop were to propagate the instance
+}
+
+fn main() {
+ assert_eq!("i32", bar::<dyn Trait>()(&1i32));
+}
diff --git a/tests/ui/const_prop/dont-propagate-generic-instance.rs b/tests/ui/const_prop/dont-propagate-generic-instance.rs
new file mode 100644
index 000000000..5994961b8
--- /dev/null
+++ b/tests/ui/const_prop/dont-propagate-generic-instance.rs
@@ -0,0 +1,24 @@
+// run-pass
+
+// Makes sure we don't propagate generic instances of `Self: ?Sized` blanket impls.
+// This is relevant when we have an overlapping impl and builtin dyn instance.
+// See <https://github.com/rust-lang/rust/pull/114941> for more context.
+
+trait Trait {
+ fn foo(&self) -> &'static str;
+}
+
+impl<T: ?Sized> Trait for T {
+ fn foo(&self) -> &'static str {
+ std::any::type_name::<T>()
+ }
+}
+
+const fn bar<T: ?Sized>() -> fn(&T) -> &'static str {
+ Trait::foo
+ // If const prop were to propagate the instance
+}
+
+fn main() {
+ assert_eq!("i32", bar::<dyn Trait>()(&1i32));
+}
diff --git a/tests/ui/consts/assert-type-intrinsics.stderr b/tests/ui/consts/assert-type-intrinsics.stderr
index 70aec91e2..3c03b03de 100644
--- a/tests/ui/consts/assert-type-intrinsics.stderr
+++ b/tests/ui/consts/assert-type-intrinsics.stderr
@@ -2,19 +2,19 @@ error[E0080]: evaluation of constant value failed
--> $DIR/assert-type-intrinsics.rs:12:9
|
LL | MaybeUninit::<!>::uninit().assume_init();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to instantiate uninhabited type `!`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'aborted execution: attempted to instantiate uninhabited type `!`', $DIR/assert-type-intrinsics.rs:12:36
error[E0080]: evaluation of constant value failed
--> $DIR/assert-type-intrinsics.rs:16:9
|
LL | intrinsics::assert_mem_uninitialized_valid::<&'static i32>();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to leave type `&i32` uninitialized, which is invalid
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'aborted execution: attempted to leave type `&i32` uninitialized, which is invalid', $DIR/assert-type-intrinsics.rs:16:9
error[E0080]: evaluation of constant value failed
--> $DIR/assert-type-intrinsics.rs:20:9
|
LL | intrinsics::assert_zero_valid::<&'static i32>();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to zero-initialize type `&i32`, which is invalid
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'aborted execution: attempted to zero-initialize type `&i32`, which is invalid', $DIR/assert-type-intrinsics.rs:20:9
error: aborting due to 3 previous errors
diff --git a/tests/ui/consts/assoc-const-elided-lifetime.rs b/tests/ui/consts/assoc-const-elided-lifetime.rs
new file mode 100644
index 000000000..10cd33a8f
--- /dev/null
+++ b/tests/ui/consts/assoc-const-elided-lifetime.rs
@@ -0,0 +1,19 @@
+#![deny(elided_lifetimes_in_associated_constant)]
+
+use std::marker::PhantomData;
+
+struct Foo<'a> {
+ x: PhantomData<&'a ()>,
+}
+
+impl<'a> Foo<'a> {
+ const FOO: Foo<'_> = Foo { x: PhantomData::<&()> };
+ //~^ ERROR `'_` cannot be used here
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+
+ const BAR: &() = &();
+ //~^ ERROR `&` without an explicit lifetime name cannot be used here
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+}
+
+fn main() {}
diff --git a/tests/ui/consts/assoc-const-elided-lifetime.stderr b/tests/ui/consts/assoc-const-elided-lifetime.stderr
new file mode 100644
index 000000000..a1eeaff4b
--- /dev/null
+++ b/tests/ui/consts/assoc-const-elided-lifetime.stderr
@@ -0,0 +1,33 @@
+error: `'_` cannot be used here
+ --> $DIR/assoc-const-elided-lifetime.rs:10:20
+ |
+LL | const FOO: Foo<'_> = Foo { x: PhantomData::<&()> };
+ | ^^
+ |
+ = 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 #115010 <https://github.com/rust-lang/rust/issues/115010>
+note: the lint level is defined here
+ --> $DIR/assoc-const-elided-lifetime.rs:1:9
+ |
+LL | #![deny(elided_lifetimes_in_associated_constant)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: use the `'static` lifetime
+ |
+LL | const FOO: Foo<'static> = Foo { x: PhantomData::<&()> };
+ | ~~~~~~~
+
+error: `&` without an explicit lifetime name cannot be used here
+ --> $DIR/assoc-const-elided-lifetime.rs:14:16
+ |
+LL | const BAR: &() = &();
+ | ^
+ |
+ = 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 #115010 <https://github.com/rust-lang/rust/issues/115010>
+help: use the `'static` lifetime
+ |
+LL | const BAR: &'static () = &();
+ | +++++++
+
+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 149d3b523..85bc56bae 100644
--- a/tests/ui/consts/const-err-late.stderr
+++ b/tests/ui/consts/const-err-late.stderr
@@ -4,7 +4,7 @@ error[E0080]: evaluation of `S::<i32>::FOO` failed
LL | const FOO: u8 = [5u8][1];
| ^^^^^^^^ index out of bounds: the length is 1 but the index is 1
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-err-late.rs:19:16
|
LL | black_box((S::<i32>::FOO, S::<u32>::FOO));
@@ -16,13 +16,13 @@ error[E0080]: evaluation of `S::<u32>::FOO` failed
LL | const FOO: u8 = [5u8][1];
| ^^^^^^^^ index out of bounds: the length is 1 but the index is 1
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-err-late.rs:19:31
|
LL | black_box((S::<i32>::FOO, S::<u32>::FOO));
| ^^^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-err-late.rs:19:16
|
LL | black_box((S::<i32>::FOO, S::<u32>::FOO));
diff --git a/tests/ui/consts/const-err-multi.stderr b/tests/ui/consts/const-err-multi.stderr
index 28af8e5eb..1ad504b3a 100644
--- a/tests/ui/consts/const-err-multi.stderr
+++ b/tests/ui/consts/const-err-multi.stderr
@@ -4,19 +4,19 @@ error[E0080]: evaluation of constant value failed
LL | pub const A: i8 = -i8::MIN;
| ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-err-multi.rs:3:19
|
LL | pub const B: i8 = A;
| ^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-err-multi.rs:5:19
|
LL | pub const C: u8 = A as u8;
| ^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-err-multi.rs:7:24
|
LL | pub const D: i8 = 50 - A;
diff --git a/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.rs b/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.rs
new file mode 100644
index 000000000..0bf2f0e66
--- /dev/null
+++ b/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.rs
@@ -0,0 +1,5 @@
+#![crate_type = "lib"]
+
+struct Bug([u8; panic!{"\t"}]);
+//~^ ERROR evaluation of constant value failed
+//~| NOTE: in this expansion of panic!
diff --git a/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.stderr b/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.stderr
new file mode 100644
index 000000000..82c63dd17
--- /dev/null
+++ b/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.stderr
@@ -0,0 +1,11 @@
+error[E0080]: evaluation of constant value failed
+ --> $DIR/const_panic-normalize-tabs-115498.rs:3:17
+ |
+LL | struct Bug([u8; panic!{"\t"}]);
+ | ^^^^^^^^^^^^ the evaluated program panicked at ' ', $DIR/const_panic-normalize-tabs-115498.rs:3:17
+ |
+ = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (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/erroneous-const.stderr b/tests/ui/consts/const-eval/erroneous-const.stderr
index 770f95062..0e31520fd 100644
--- a/tests/ui/consts/const-eval/erroneous-const.stderr
+++ b/tests/ui/consts/const-eval/erroneous-const.stderr
@@ -4,7 +4,7 @@ error[E0080]: evaluation of `PrintName::<i32>::VOID` failed
LL | const VOID: () = [()][2];
| ^^^^^^^ index out of bounds: the length is 1 but the index is 2
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/erroneous-const.rs:13:13
|
LL | PrintName::<T>::VOID;
diff --git a/tests/ui/consts/const-eval/erroneous-const2.stderr b/tests/ui/consts/const-eval/erroneous-const2.stderr
index 082c28765..4ca44694c 100644
--- a/tests/ui/consts/const-eval/erroneous-const2.stderr
+++ b/tests/ui/consts/const-eval/erroneous-const2.stderr
@@ -4,7 +4,7 @@ error[E0080]: evaluation of `PrintName::<i32>::VOID` failed
LL | const VOID: () = [()][2];
| ^^^^^^^ index out of bounds: the length is 1 but the index is 2
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/erroneous-const2.rs:13:9
|
LL | PrintName::<i32>::VOID;
diff --git a/tests/ui/consts/const-eval/issue-44578.stderr b/tests/ui/consts/const-eval/issue-44578.stderr
index f3952809e..c7aaee942 100644
--- a/tests/ui/consts/const-eval/issue-44578.stderr
+++ b/tests/ui/consts/const-eval/issue-44578.stderr
@@ -4,13 +4,13 @@ error[E0080]: evaluation of `<Bar<u16, u8> as Foo>::AMT` failed
LL | const AMT: usize = [A::AMT][(A::AMT > B::AMT) as usize];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 1
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/issue-44578.rs:25:20
|
LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/issue-44578.rs:25:20
|
LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
@@ -18,7 +18,7 @@ LL | println!("{}", <Bar<u16, u8> 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
+note: erroneous constant encountered
--> $DIR/issue-44578.rs:25:20
|
LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
diff --git a/tests/ui/consts/const-eval/issue-50814-2.stderr b/tests/ui/consts/const-eval/issue-50814-2.stderr
index 956f7aec9..450fb0023 100644
--- a/tests/ui/consts/const-eval/issue-50814-2.stderr
+++ b/tests/ui/consts/const-eval/issue-50814-2.stderr
@@ -4,7 +4,7 @@ error[E0080]: evaluation of `<A<()> as Foo<()>>::BAR` failed
LL | const BAR: usize = [5, 6, 7][T::BOO];
| ^^^^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 42
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/issue-50814-2.rs:18:6
|
LL | &<A<T> as Foo<T>>::BAR
diff --git a/tests/ui/consts/const-eval/issue-50814.stderr b/tests/ui/consts/const-eval/issue-50814.stderr
index 05b6271f4..48a20d0bb 100644
--- a/tests/ui/consts/const-eval/issue-50814.stderr
+++ b/tests/ui/consts/const-eval/issue-50814.stderr
@@ -4,7 +4,7 @@ error[E0080]: evaluation of `<Sum<U8, U8> as Unsigned>::MAX` failed
LL | const MAX: u8 = A::MAX + B::MAX;
| ^^^^^^^^^^^^^^^ attempt to compute `u8::MAX + u8::MAX`, which would overflow
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/issue-50814.rs:20:6
|
LL | &Sum::<U8, U8>::MAX
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 1abe708d1..88ce5b0d8 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; //~ erroneous constant used
+ let _ = PrintName::VOID; //~ erroneous constant encountered
}
diff --git a/tests/ui/consts/const-eval/panic-assoc-never-type.stderr b/tests/ui/consts/const-eval/panic-assoc-never-type.stderr
index 7c36a3a42..4706497db 100644
--- a/tests/ui/consts/const-eval/panic-assoc-never-type.stderr
+++ b/tests/ui/consts/const-eval/panic-assoc-never-type.stderr
@@ -6,13 +6,13 @@ LL | const VOID: ! = panic!();
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/panic-assoc-never-type.rs:14:13
|
LL | let _ = PrintName::VOID;
| ^^^^^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/panic-assoc-never-type.rs:14:13
|
LL | let _ = PrintName::VOID;
diff --git a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr
index e087a0ebe..042e7eeb3 100644
--- a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr
+++ b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr
@@ -341,7 +341,7 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
╾ALLOC_ID╼ │ ╾──╼
}
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/raw-bytes.rs:160:40
|
LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
@@ -358,7 +358,7 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3
╾ALLOC_ID╼ │ ╾──╼
}
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/raw-bytes.rs:166:42
|
LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]);
@@ -375,7 +375,7 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran
╾ALLOC_ID╼ │ ╾──╼
}
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/raw-bytes.rs:170:42
|
LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]);
diff --git a/tests/ui/consts/const-eval/raw-bytes.64bit.stderr b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr
index 4c655161f..8426a9505 100644
--- a/tests/ui/consts/const-eval/raw-bytes.64bit.stderr
+++ b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr
@@ -341,7 +341,7 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
╾ALLOC_ID╼ │ ╾──────╼
}
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/raw-bytes.rs:160:40
|
LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
@@ -358,7 +358,7 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3
╾ALLOC_ID╼ │ ╾──────╼
}
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/raw-bytes.rs:166:42
|
LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]);
@@ -375,7 +375,7 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran
╾ALLOC_ID╼ │ ╾──────╼
}
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/raw-bytes.rs:170:42
|
LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]);
diff --git a/tests/ui/consts/const-eval/ub-int-array.64bit.stderr b/tests/ui/consts/const-eval/ub-int-array.64bit.stderr
deleted file mode 100644
index b3df41304..000000000
--- a/tests/ui/consts/const-eval/ub-int-array.64bit.stderr
+++ /dev/null
@@ -1,36 +0,0 @@
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-int-array.rs:19:1
- |
-LL | const UNINIT_INT_0: [u32; 3] = unsafe {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered uninitialized memory, but expected an integer
- |
- = 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: 12, align: 4) {
- __ __ __ __ 01 00 00 00 02 00 00 00 │ ░░░░........
- }
-
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-int-array.rs:24:1
- |
-LL | const UNINIT_INT_1: [u32; 3] = unsafe {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [1]: encountered uninitialized memory, but expected an integer
- |
- = 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: 12, align: 4) {
- 00 00 00 00 01 __ 01 01 02 02 __ 02 │ .....░....░.
- }
-
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-int-array.rs:42:1
- |
-LL | const UNINIT_INT_2: [u32; 3] = unsafe {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [2]: encountered uninitialized memory, but expected an integer
- |
- = 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: 12, align: 4) {
- 00 00 00 00 01 01 01 01 02 02 02 __ │ ...........░
- }
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/ub-int-array.rs b/tests/ui/consts/const-eval/ub-int-array.rs
index adcf376b9..cde0749dc 100644
--- a/tests/ui/consts/const-eval/ub-int-array.rs
+++ b/tests/ui/consts/const-eval/ub-int-array.rs
@@ -1,4 +1,3 @@
-// stderr-per-bitwidth
//! Test the "array of int" fast path in validity checking, and in particular whether it
//! points at the right array element.
@@ -19,7 +18,12 @@ impl<T: Copy> MaybeUninit<T> {
const UNINIT_INT_0: [u32; 3] = unsafe {
//~^ ERROR it is undefined behavior to use this value
//~| invalid value at [0]
- mem::transmute([MaybeUninit { uninit: () }, MaybeUninit::new(1), MaybeUninit::new(2)])
+ mem::transmute([
+ MaybeUninit { uninit: () },
+ // Constants chosen to achieve endianness-independent hex dump.
+ MaybeUninit::new(0x11111111),
+ MaybeUninit::new(0x22222222),
+ ])
};
const UNINIT_INT_1: [u32; 3] = unsafe {
//~^ ERROR it is undefined behavior to use this value
diff --git a/tests/ui/consts/const-eval/ub-int-array.32bit.stderr b/tests/ui/consts/const-eval/ub-int-array.stderr
index b3df41304..c8efd7e1b 100644
--- a/tests/ui/consts/const-eval/ub-int-array.32bit.stderr
+++ b/tests/ui/consts/const-eval/ub-int-array.stderr
@@ -1,16 +1,16 @@
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-int-array.rs:19:1
+ --> $DIR/ub-int-array.rs:18:1
|
LL | const UNINIT_INT_0: [u32; 3] = unsafe {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered uninitialized memory, but expected an integer
|
= 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: 12, align: 4) {
- __ __ __ __ 01 00 00 00 02 00 00 00 │ ░░░░........
+ __ __ __ __ 11 11 11 11 22 22 22 22 │ ░░░░....""""
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-int-array.rs:24:1
+ --> $DIR/ub-int-array.rs:28:1
|
LL | const UNINIT_INT_1: [u32; 3] = unsafe {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [1]: encountered uninitialized memory, but expected an integer
@@ -21,7 +21,7 @@ LL | const UNINIT_INT_1: [u32; 3] = unsafe {
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-int-array.rs:42:1
+ --> $DIR/ub-int-array.rs:46:1
|
LL | const UNINIT_INT_2: [u32; 3] = unsafe {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [2]: encountered uninitialized memory, but expected an integer
diff --git a/tests/ui/consts/const-eval/ub-ref-ptr.stderr b/tests/ui/consts/const-eval/ub-ref-ptr.stderr
index 0ee1e6087..6d5c36cea 100644
--- a/tests/ui/consts/const-eval/ub-ref-ptr.stderr
+++ b/tests/ui/consts/const-eval/ub-ref-ptr.stderr
@@ -60,7 +60,7 @@ LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
= 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
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/ub-ref-ptr.rs:36:38
|
LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
@@ -75,7 +75,7 @@ LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[us
= 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
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/ub-ref-ptr.rs:39:85
|
LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
diff --git a/tests/ui/consts/const-eval/ub-uninhabit.rs b/tests/ui/consts/const-eval/ub-uninhabit.rs
index 10edae437..01600f545 100644
--- a/tests/ui/consts/const-eval/ub-uninhabit.rs
+++ b/tests/ui/consts/const-eval/ub-uninhabit.rs
@@ -1,7 +1,10 @@
// Strip out raw byte dumps to make comparison platform-independent:
// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
+#![feature(core_intrinsics)]
+#![feature(never_type)]
+use std::intrinsics;
use std::mem;
#[derive(Copy, Clone)]
@@ -15,11 +18,24 @@ union MaybeUninit<T: Copy> {
const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init };
//~^ ERROR evaluation of constant value failed
+//~| constructing invalid value
const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
//~^ ERROR it is undefined behavior to use this value
+//~| constructing invalid value
const BAD_BAD_ARRAY: [Bar; 1] = unsafe { MaybeUninit { uninit: () }.init };
//~^ ERROR evaluation of constant value failed
+//~| constructing invalid value
+
+
+const READ_NEVER: () = unsafe {
+ let mem = [0u32; 8];
+ let ptr = mem.as_ptr().cast::<!>();
+ let _val = intrinsics::read_via_copy(ptr);
+ //~^ ERROR evaluation of constant value failed
+ //~| constructing invalid value
+};
+
fn main() {}
diff --git a/tests/ui/consts/const-eval/ub-uninhabit.stderr b/tests/ui/consts/const-eval/ub-uninhabit.stderr
index f1ad0f04d..d26f4e036 100644
--- a/tests/ui/consts/const-eval/ub-uninhabit.stderr
+++ b/tests/ui/consts/const-eval/ub-uninhabit.stderr
@@ -1,11 +1,11 @@
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-uninhabit.rs:16:35
+ --> $DIR/ub-uninhabit.rs:19:35
|
LL | const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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
+ --> $DIR/ub-uninhabit.rs:23:1
|
LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type Bar
@@ -16,11 +16,17 @@ LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
}
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-uninhabit.rs:22:42
+ --> $DIR/ub-uninhabit.rs:27:42
|
LL | const BAD_BAD_ARRAY: [Bar; 1] = unsafe { MaybeUninit { uninit: () }.init };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered a value of uninhabited type `Bar`
-error: aborting due to 3 previous errors
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ub-uninhabit.rs:35:16
+ |
+LL | let _val = intrinsics::read_via_copy(ptr);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of the never type `!`
+
+error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/ub-wide-ptr.stderr b/tests/ui/consts/const-eval/ub-wide-ptr.stderr
index 02bbbf504..d8add67fa 100644
--- a/tests/ui/consts/const-eval/ub-wide-ptr.stderr
+++ b/tests/ui/consts/const-eval/ub-wide-ptr.stderr
@@ -139,7 +139,7 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
HEX_DUMP
}
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/ub-wide-ptr.rs:85:40
|
LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
@@ -156,7 +156,7 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3
HEX_DUMP
}
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/ub-wide-ptr.rs:92:42
|
LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]);
@@ -173,7 +173,7 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran
HEX_DUMP
}
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/ub-wide-ptr.rs:96:42
|
LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]);
diff --git a/tests/ui/consts/const-eval/union-const-eval-field.stderr b/tests/ui/consts/const-eval/union-const-eval-field.stderr
index 9899c56c0..ce260300f 100644
--- a/tests/ui/consts/const-eval/union-const-eval-field.stderr
+++ b/tests/ui/consts/const-eval/union-const-eval-field.stderr
@@ -4,13 +4,13 @@ error[E0080]: evaluation of constant value failed
LL | const FIELD3: Field3 = unsafe { UNION.field3 };
| ^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/union-const-eval-field.rs:31:5
|
LL | FIELD3
| ^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/union-const-eval-field.rs:31:5
|
LL | FIELD3
diff --git a/tests/ui/consts/const-float-bits-reject-conv.stderr b/tests/ui/consts/const-float-bits-reject-conv.stderr
index 7ad022520..1511dab12 100644
--- a/tests/ui/consts/const-float-bits-reject-conv.stderr
+++ b/tests/ui/consts/const-float-bits-reject-conv.stderr
@@ -30,25 +30,25 @@ LL | const MASKED_NAN2: u32 = f32::NAN.to_bits() ^ 0x0055_5555;
| ^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-float-bits-reject-conv.rs:35:34
|
LL | const_assert!(f32::from_bits(MASKED_NAN1).is_nan());
| ^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-float-bits-reject-conv.rs:36:34
|
LL | const_assert!(f32::from_bits(MASKED_NAN1).is_nan());
| ^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-float-bits-reject-conv.rs:42:34
|
LL | const_assert!(f32::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1);
| ^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-float-bits-reject-conv.rs:43:34
|
LL | const_assert!(f32::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2);
@@ -86,25 +86,25 @@ LL | const MASKED_NAN2: u64 = f64::NAN.to_bits() ^ 0x0005_5555_5555_5555;
| ^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-float-bits-reject-conv.rs:57:34
|
LL | const_assert!(f64::from_bits(MASKED_NAN1).is_nan());
| ^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-float-bits-reject-conv.rs:58:34
|
LL | const_assert!(f64::from_bits(MASKED_NAN1).is_nan());
| ^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-float-bits-reject-conv.rs:61:34
|
LL | const_assert!(f64::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1);
| ^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-float-bits-reject-conv.rs:62:34
|
LL | const_assert!(f64::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2);
diff --git a/tests/ui/consts/const-len-underflow-separate-spans.next.stderr b/tests/ui/consts/const-len-underflow-separate-spans.next.stderr
index d9208d070..b7b5b648c 100644
--- a/tests/ui/consts/const-len-underflow-separate-spans.next.stderr
+++ b/tests/ui/consts/const-len-underflow-separate-spans.next.stderr
@@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed
LL | const LEN: usize = ONE - TWO;
| ^^^^^^^^^ attempt to compute `1_usize - 2_usize`, which would overflow
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-len-underflow-separate-spans.rs:14:17
|
LL | let a: [i8; LEN] = unimplemented!();
diff --git a/tests/ui/consts/const-len-underflow-separate-spans.old.stderr b/tests/ui/consts/const-len-underflow-separate-spans.old.stderr
index d9208d070..b7b5b648c 100644
--- a/tests/ui/consts/const-len-underflow-separate-spans.old.stderr
+++ b/tests/ui/consts/const-len-underflow-separate-spans.old.stderr
@@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed
LL | const LEN: usize = ONE - TWO;
| ^^^^^^^^^ attempt to compute `1_usize - 2_usize`, which would overflow
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-len-underflow-separate-spans.rs:14:17
|
LL | let a: [i8; LEN] = unimplemented!();
diff --git a/tests/ui/consts/const_in_pattern/issue-65466.rs b/tests/ui/consts/const_in_pattern/issue-65466.rs
index 2b421f4c7..d45c32e17 100644
--- a/tests/ui/consts/const_in_pattern/issue-65466.rs
+++ b/tests/ui/consts/const_in_pattern/issue-65466.rs
@@ -15,7 +15,8 @@ const C: &[O<B>] = &[O::None];
fn main() {
let x = O::None;
match &[x][..] {
- C => (),
+ C => (), //~WARN: the type must implement `PartialEq`
+ //~| previously accepted
_ => (),
}
}
diff --git a/tests/ui/consts/const_in_pattern/issue-65466.stderr b/tests/ui/consts/const_in_pattern/issue-65466.stderr
new file mode 100644
index 000000000..9c80cb3a8
--- /dev/null
+++ b/tests/ui/consts/const_in_pattern/issue-65466.stderr
@@ -0,0 +1,23 @@
+warning: to use a constant of type `&[O<B>]` in a pattern, the type must implement `PartialEq`
+ --> $DIR/issue-65466.rs:18:9
+ |
+LL | C => (),
+ | ^
+ |
+ = 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 #116122 <https://github.com/rust-lang/rust/issues/116122>
+ = note: `#[warn(const_patterns_without_partial_eq)]` on by default
+
+warning: 1 warning emitted
+
+Future incompatibility report: Future breakage diagnostic:
+warning: to use a constant of type `&[O<B>]` in a pattern, the type must implement `PartialEq`
+ --> $DIR/issue-65466.rs:18:9
+ |
+LL | C => (),
+ | ^
+ |
+ = 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 #116122 <https://github.com/rust-lang/rust/issues/116122>
+ = note: `#[warn(const_patterns_without_partial_eq)]` on by default
+
diff --git a/tests/ui/consts/effect_param.rs b/tests/ui/consts/effect_param.rs
new file mode 100644
index 000000000..f11ec739f
--- /dev/null
+++ b/tests/ui/consts/effect_param.rs
@@ -0,0 +1,11 @@
+//! Ensure we don't allow accessing const effect parameters from stable Rust.
+
+fn main() {
+ i8::checked_sub::<true>(42, 43);
+ //~^ ERROR: method takes 0 generic arguments but 1 generic argument was supplied
+}
+
+const FOO: () = {
+ i8::checked_sub::<false>(42, 43);
+ //~^ ERROR: method takes 0 generic arguments but 1 generic argument was supplied
+};
diff --git a/tests/ui/consts/effect_param.stderr b/tests/ui/consts/effect_param.stderr
new file mode 100644
index 000000000..f8c4bfc02
--- /dev/null
+++ b/tests/ui/consts/effect_param.stderr
@@ -0,0 +1,19 @@
+error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/effect_param.rs:9:9
+ |
+LL | i8::checked_sub::<false>(42, 43);
+ | ^^^^^^^^^^^--------- help: remove these generics
+ | |
+ | expected 0 generic arguments
+
+error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/effect_param.rs:4:9
+ |
+LL | i8::checked_sub::<true>(42, 43);
+ | ^^^^^^^^^^^-------- help: remove these generics
+ | |
+ | expected 0 generic arguments
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0107`.
diff --git a/tests/ui/consts/escaping-bound-var.rs b/tests/ui/consts/escaping-bound-var.rs
new file mode 100644
index 000000000..7c1fbd24f
--- /dev/null
+++ b/tests/ui/consts/escaping-bound-var.rs
@@ -0,0 +1,13 @@
+#![feature(generic_const_exprs)]
+//~^ WARN the feature `generic_const_exprs` is incomplete
+
+fn test<'a>(
+ _: &'a (),
+) -> [(); {
+ let x: &'a ();
+ //~^ ERROR cannot capture late-bound lifetime in constant
+ 1
+}] {
+}
+
+fn main() {}
diff --git a/tests/ui/consts/escaping-bound-var.stderr b/tests/ui/consts/escaping-bound-var.stderr
new file mode 100644
index 000000000..d26ae2cee
--- /dev/null
+++ b/tests/ui/consts/escaping-bound-var.stderr
@@ -0,0 +1,20 @@
+warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/escaping-bound-var.rs:1:12
+ |
+LL | #![feature(generic_const_exprs)]
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error: cannot capture late-bound lifetime in constant
+ --> $DIR/escaping-bound-var.rs:7:13
+ |
+LL | fn test<'a>(
+ | -- lifetime defined here
+...
+LL | let x: &'a ();
+ | ^^
+
+error: aborting due to previous error; 1 warning emitted
+
diff --git a/tests/ui/consts/fn_trait_refs.stderr b/tests/ui/consts/fn_trait_refs.stderr
index bfebf6670..658a0b7b2 100644
--- a/tests/ui/consts/fn_trait_refs.stderr
+++ b/tests/ui/consts/fn_trait_refs.stderr
@@ -10,6 +10,66 @@ error[E0635]: unknown feature `const_cmp`
LL | #![feature(const_cmp)]
| ^^^^^^^^^
-error: aborting due to 2 previous errors
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/fn_trait_refs.rs:15:15
+ |
+LL | T: ~const Fn<()> + ~const Destruct,
+ | ^^^^^^
+
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/fn_trait_refs.rs:15:15
+ |
+LL | T: ~const Fn<()> + ~const Destruct,
+ | ^^^^^^
+
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/fn_trait_refs.rs:22:15
+ |
+LL | T: ~const FnMut<()> + ~const Destruct,
+ | ^^^^^^^^^
+
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/fn_trait_refs.rs:22:15
+ |
+LL | T: ~const FnMut<()> + ~const Destruct,
+ | ^^^^^^^^^
+
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/fn_trait_refs.rs:29:15
+ |
+LL | T: ~const FnOnce<()>,
+ | ^^^^^^^^^^
+
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/fn_trait_refs.rs:29:15
+ |
+LL | T: ~const FnOnce<()>,
+ | ^^^^^^^^^^
+
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/fn_trait_refs.rs:36:15
+ |
+LL | T: ~const Fn<()> + ~const Destruct,
+ | ^^^^^^
+
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/fn_trait_refs.rs:36:15
+ |
+LL | T: ~const Fn<()> + ~const Destruct,
+ | ^^^^^^
+
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/fn_trait_refs.rs:50:15
+ |
+LL | T: ~const FnMut<()> + ~const Destruct,
+ | ^^^^^^^^^
+
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/fn_trait_refs.rs:50:15
+ |
+LL | T: ~const FnMut<()> + ~const Destruct,
+ | ^^^^^^^^^
+
+error: aborting due to 12 previous errors
For more information about this error, try `rustc --explain E0635`.
diff --git a/tests/ui/consts/invalid-union.32bit.stderr b/tests/ui/consts/invalid-union.32bit.stderr
index 0dd18a557..b6cf060e5 100644
--- a/tests/ui/consts/invalid-union.32bit.stderr
+++ b/tests/ui/consts/invalid-union.32bit.stderr
@@ -9,13 +9,13 @@ LL | fn main() {
╾─alloc7──╼ │ ╾──╼
}
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/invalid-union.rs:43:25
|
LL | let _: &'static _ = &C;
| ^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/invalid-union.rs:43:25
|
LL | let _: &'static _ = &C;
diff --git a/tests/ui/consts/invalid-union.64bit.stderr b/tests/ui/consts/invalid-union.64bit.stderr
index 07f36ee28..e3a3ef62c 100644
--- a/tests/ui/consts/invalid-union.64bit.stderr
+++ b/tests/ui/consts/invalid-union.64bit.stderr
@@ -9,13 +9,13 @@ LL | fn main() {
╾───────alloc7────────╼ │ ╾──────╼
}
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/invalid-union.rs:43:25
|
LL | let _: &'static _ = &C;
| ^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/invalid-union.rs:43:25
|
LL | let _: &'static _ = &C;
diff --git a/tests/ui/consts/issue-105536-const-val-roundtrip-ptr-eq.rs b/tests/ui/consts/issue-105536-const-val-roundtrip-ptr-eq.rs
new file mode 100644
index 000000000..1615399be
--- /dev/null
+++ b/tests/ui/consts/issue-105536-const-val-roundtrip-ptr-eq.rs
@@ -0,0 +1,31 @@
+// run-pass
+
+// This does not reflect a stable guarantee (we guarantee very little for equality of pointers
+// around `const`), but it would be good to understand what is happening if these assertions ever
+// fail.
+use std::ptr::NonNull;
+use std::slice::from_raw_parts;
+
+const PTR_U8: *const u8 = NonNull::dangling().as_ptr();
+const CONST_U8_REF: &[u8] = unsafe { from_raw_parts(PTR_U8, 0) };
+const CONST_U8_PTR: *const u8 = unsafe { from_raw_parts(PTR_U8, 0).as_ptr() };
+static STATIC_U8_REF: &[u8] = unsafe { from_raw_parts(PTR_U8, 0) };
+
+const PTR_U16: *const u16 = NonNull::dangling().as_ptr();
+const CONST_U16_REF: &[u16] = unsafe { from_raw_parts(PTR_U16, 0) };
+
+const fn const_u8_fn() -> &'static [u8] {
+ unsafe { from_raw_parts(PTR_U8, 0) }
+}
+
+fn main() {
+ let ptr_u8 = unsafe { from_raw_parts(PTR_U8, 0) }.as_ptr();
+ let ptr_u16 = unsafe { from_raw_parts(PTR_U16, 0) }.as_ptr();
+
+ assert_eq!(ptr_u8, PTR_U8);
+ assert_eq!(ptr_u8, CONST_U8_PTR);
+ assert_eq!(ptr_u8, const_u8_fn().as_ptr());
+ assert_eq!(ptr_u8, STATIC_U8_REF.as_ptr());
+ assert_eq!(ptr_u16, CONST_U16_REF.as_ptr());
+ assert_eq!(ptr_u8, CONST_U8_REF.as_ptr());
+}
diff --git a/tests/ui/consts/issue-36163.stderr b/tests/ui/consts/issue-36163.stderr
index 190b41062..6fcfe3ed2 100644
--- a/tests/ui/consts/issue-36163.stderr
+++ b/tests/ui/consts/issue-36163.stderr
@@ -1,15 +1,25 @@
-error[E0391]: cycle detected when const-evaluating + checking `Foo::B::{constant#0}`
+error[E0391]: cycle detected when simplifying constant for the type system `Foo::B::{constant#0}`
--> $DIR/issue-36163.rs:4:9
|
LL | B = A,
| ^
|
+note: ...which requires const-evaluating + checking `Foo::B::{constant#0}`...
+ --> $DIR/issue-36163.rs:4:9
+ |
+LL | B = A,
+ | ^
+note: ...which requires simplifying constant for the type system `A`...
+ --> $DIR/issue-36163.rs:1:1
+ |
+LL | const A: isize = Foo::B as isize;
+ | ^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `A`...
--> $DIR/issue-36163.rs:1:18
|
LL | const A: isize = Foo::B as isize;
| ^^^^^^^^^^^^^^^
- = note: ...which again requires const-evaluating + checking `Foo::B::{constant#0}`, completing the cycle
+ = note: ...which again requires simplifying constant for the type system `Foo::B::{constant#0}`, completing the cycle
note: cycle used when simplifying constant for the type system `Foo::B::{constant#0}`
--> $DIR/issue-36163.rs:4:9
|
diff --git a/tests/ui/consts/miri_unleashed/assoc_const.stderr b/tests/ui/consts/miri_unleashed/assoc_const.stderr
index d97097d35..274b1de7e 100644
--- a/tests/ui/consts/miri_unleashed/assoc_const.stderr
+++ b/tests/ui/consts/miri_unleashed/assoc_const.stderr
@@ -13,13 +13,13 @@ note: inside `<String as Bar<Vec<u32>, String>>::F`
LL | const F: u32 = (U::X, 42).1;
| ^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/assoc_const.rs:29:13
|
LL | let y = <String as Bar<Vec<u32>, String>>::F;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/assoc_const.rs:29:13
|
LL | let y = <String as Bar<Vec<u32>, String>>::F;
diff --git a/tests/ui/consts/miri_unleashed/assoc_const_2.stderr b/tests/ui/consts/miri_unleashed/assoc_const_2.stderr
index ae7b03fc9..c8e4cab4e 100644
--- a/tests/ui/consts/miri_unleashed/assoc_const_2.stderr
+++ b/tests/ui/consts/miri_unleashed/assoc_const_2.stderr
@@ -4,13 +4,13 @@ error[E0080]: evaluation of `<std::string::String as Bar<std::string::String>>::
LL | const F: u32 = 100 / U::X;
| ^^^^^^^^^^ attempt to divide `100_u32` by zero
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/assoc_const_2.rs:27:13
|
LL | let y = <String as Bar<String>>::F;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/assoc_const_2.rs:27:13
|
LL | let y = <String as Bar<String>>::F;
diff --git a/tests/ui/consts/missing-larger-array-impl.stderr b/tests/ui/consts/missing-larger-array-impl.stderr
index b8f6cb5ef..fe9d0f6e6 100644
--- a/tests/ui/consts/missing-larger-array-impl.stderr
+++ b/tests/ui/consts/missing-larger-array-impl.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `[X; 35]: Default` is not satisfied
- --> $DIR/missing-larger-array-impl.rs:7:5
+ --> $DIR/missing-larger-array-impl.rs:7:6
|
LL | <[X; 35] as Default>::default();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `[X; 35]`
+ | ^^^^^^^ the trait `Default` is not implemented for `[X; 35]`
|
= help: the following other types implement trait `Default`:
[T; 0]
diff --git a/tests/ui/consts/std/alloc.32bit.stderr b/tests/ui/consts/std/alloc.32bit.stderr
index 8c83df53d..da805de45 100644
--- a/tests/ui/consts/std/alloc.32bit.stderr
+++ b/tests/ui/consts/std/alloc.32bit.stderr
@@ -1,5 +1,5 @@
error[E0080]: it is undefined behavior to use this value
- --> $DIR/alloc.rs:12:1
+ --> $DIR/alloc.rs:11:1
|
LL | const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x00000000, but expected a valid enum tag
@@ -10,7 +10,7 @@ LL | const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchec
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/alloc.rs:16:1
+ --> $DIR/alloc.rs:15:1
|
LL | const LAYOUT_INVALID_THREE: Layout = unsafe { Layout::from_size_align_unchecked(9, 3) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x00000003, but expected a valid enum tag
diff --git a/tests/ui/consts/std/alloc.64bit.stderr b/tests/ui/consts/std/alloc.64bit.stderr
index addedad17..094503e10 100644
--- a/tests/ui/consts/std/alloc.64bit.stderr
+++ b/tests/ui/consts/std/alloc.64bit.stderr
@@ -1,5 +1,5 @@
error[E0080]: it is undefined behavior to use this value
- --> $DIR/alloc.rs:12:1
+ --> $DIR/alloc.rs:11:1
|
LL | const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x0000000000000000, but expected a valid enum tag
@@ -10,7 +10,7 @@ LL | const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchec
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/alloc.rs:16:1
+ --> $DIR/alloc.rs:15:1
|
LL | const LAYOUT_INVALID_THREE: Layout = unsafe { Layout::from_size_align_unchecked(9, 3) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x0000000000000003, but expected a valid enum tag
diff --git a/tests/ui/consts/std/alloc.rs b/tests/ui/consts/std/alloc.rs
index 9abf35d63..0a2c2f4de 100644
--- a/tests/ui/consts/std/alloc.rs
+++ b/tests/ui/consts/std/alloc.rs
@@ -1,5 +1,4 @@
// stderr-per-bitwidth
-// ignore-debug (the debug assertions change the error)
// Strip out raw byte dumps to make comparison platform-independent:
// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
diff --git a/tests/ui/consts/uninhabited-const-issue-61744.stderr b/tests/ui/consts/uninhabited-const-issue-61744.stderr
index adefbf336..f48e6c4ce 100644
--- a/tests/ui/consts/uninhabited-const-issue-61744.stderr
+++ b/tests/ui/consts/uninhabited-const-issue-61744.stderr
@@ -645,13 +645,13 @@ note: inside `<i32 as Const>::CONSTANT`
LL | const CONSTANT: i32 = unsafe { fake_type() };
| ^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/uninhabited-const-issue-61744.rs:18:10
|
LL | dbg!(i32::CONSTANT);
| ^^^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/uninhabited-const-issue-61744.rs:18:10
|
LL | dbg!(i32::CONSTANT);
diff --git a/tests/ui/consts/unstable-const-fn-in-libcore.rs b/tests/ui/consts/unstable-const-fn-in-libcore.rs
index 61e28117e..b62a74039 100644
--- a/tests/ui/consts/unstable-const-fn-in-libcore.rs
+++ b/tests/ui/consts/unstable-const-fn-in-libcore.rs
@@ -1,3 +1,5 @@
+// known-bug: #110395
+// FIXME check-pass
// This is a non-regression test for const-qualification of unstable items in libcore
// as explained in issue #67053.
// const-qualification could miss some `const fn`s if they were unstable and the feature
@@ -15,12 +17,12 @@ impl<T> Opt<T> {
#[rustc_const_unstable(feature = "foo", issue = "none")]
#[stable(feature = "rust1", since = "1.0.0")]
const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T {
- //~^ ERROR destructor of
- //~| ERROR destructor of
+ //FIXME ~^ ERROR destructor of
+ //FIXME ~| ERROR destructor of
match self {
Opt::Some(t) => t,
Opt::None => f(),
- //~^ ERROR cannot call
+ //FIXME ~^ ERROR cannot call
}
}
}
diff --git a/tests/ui/consts/unstable-const-fn-in-libcore.stderr b/tests/ui/consts/unstable-const-fn-in-libcore.stderr
index 95d7b7e85..b75f99a72 100644
--- a/tests/ui/consts/unstable-const-fn-in-libcore.stderr
+++ b/tests/ui/consts/unstable-const-fn-in-libcore.stderr
@@ -1,34 +1,8 @@
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/unstable-const-fn-in-libcore.rs:22:26
- |
-LL | Opt::None => f(),
- | ^^^
- |
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
- |
-LL | const fn unwrap_or_else<F: ~const FnOnce() -> T + ~const std::ops::FnOnce<()>>(self, f: F) -> T {
- | +++++++++++++++++++++++++++++
-
-error[E0493]: destructor of `F` cannot be evaluated at compile-time
- --> $DIR/unstable-const-fn-in-libcore.rs:17:60
- |
-LL | const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T {
- | ^ the destructor for this type cannot be evaluated in constant functions
-...
-LL | }
- | - value is dropped here
-
-error[E0493]: destructor of `Opt<T>` cannot be evaluated at compile-time
- --> $DIR/unstable-const-fn-in-libcore.rs:17:54
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/unstable-const-fn-in-libcore.rs:19:39
|
LL | const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T {
- | ^^^^ the destructor for this type cannot be evaluated in constant functions
-...
-LL | }
- | - value is dropped here
+ | ^^^^^^^^^^^^^
-error: aborting due to 3 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0015, E0493.
-For more information about an error, try `rustc --explain E0015`.
diff --git a/tests/ui/cross/cross-fn-cache-hole.stderr b/tests/ui/cross/cross-fn-cache-hole.stderr
index 7e15562b0..79d171393 100644
--- a/tests/ui/cross/cross-fn-cache-hole.stderr
+++ b/tests/ui/cross/cross-fn-cache-hole.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `i32: Bar<u32>` is not satisfied
LL | where i32: Foo<u32, A>
| ^^^^^^^^^^^^^^^^ the trait `Bar<u32>` is not implemented for `i32`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/cross-fn-cache-hole.rs:11:1
+ |
+LL | trait Bar<X> { }
+ | ^^^^^^^^^^^^
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
diff --git a/tests/ui/deprecation/issue-84637-deprecated-associated-function.fixed b/tests/ui/deprecation/issue-84637-deprecated-associated-function.fixed
index 85e882870..659b54655 100644
--- a/tests/ui/deprecation/issue-84637-deprecated-associated-function.fixed
+++ b/tests/ui/deprecation/issue-84637-deprecated-associated-function.fixed
@@ -6,4 +6,6 @@ fn main() {
let _foo = str::trim_start(" aoeu"); //~ ERROR use of deprecated method `core::str::<impl str>::trim_left`: superseded by `trim_start` [deprecated]
let _bar = " aoeu".trim_start(); //~ ERROR use of deprecated method `core::str::<impl str>::trim_left`: superseded by `trim_start` [deprecated]
+
+ let _baz = ["a", "b"].join(" "); //~ ERROR use of deprecated method `std::slice::<impl [T]>::connect`: renamed to join [deprecated]
}
diff --git a/tests/ui/deprecation/issue-84637-deprecated-associated-function.rs b/tests/ui/deprecation/issue-84637-deprecated-associated-function.rs
index 246de2f5e..cfc6c4450 100644
--- a/tests/ui/deprecation/issue-84637-deprecated-associated-function.rs
+++ b/tests/ui/deprecation/issue-84637-deprecated-associated-function.rs
@@ -6,4 +6,6 @@ fn main() {
let _foo = str::trim_left(" aoeu"); //~ ERROR use of deprecated method `core::str::<impl str>::trim_left`: superseded by `trim_start` [deprecated]
let _bar = " aoeu".trim_left(); //~ ERROR use of deprecated method `core::str::<impl str>::trim_left`: superseded by `trim_start` [deprecated]
+
+ let _baz = ["a", "b"].connect(" "); //~ ERROR use of deprecated method `std::slice::<impl [T]>::connect`: renamed to join [deprecated]
}
diff --git a/tests/ui/deprecation/issue-84637-deprecated-associated-function.stderr b/tests/ui/deprecation/issue-84637-deprecated-associated-function.stderr
index 3b518d180..d1f5ea360 100644
--- a/tests/ui/deprecation/issue-84637-deprecated-associated-function.stderr
+++ b/tests/ui/deprecation/issue-84637-deprecated-associated-function.stderr
@@ -25,5 +25,16 @@ help: replace the use of the deprecated method
LL | let _bar = " aoeu".trim_start();
| ~~~~~~~~~~
-error: aborting due to 2 previous errors
+error: use of deprecated method `std::slice::<impl [T]>::connect`: renamed to join
+ --> $DIR/issue-84637-deprecated-associated-function.rs:10:27
+ |
+LL | let _baz = ["a", "b"].connect(" ");
+ | ^^^^^^^
+ |
+help: replace the use of the deprecated method
+ |
+LL | let _baz = ["a", "b"].join(" ");
+ | ~~~~
+
+error: aborting due to 3 previous errors
diff --git a/tests/ui/derive-uninhabited-enum-38885.stderr b/tests/ui/derive-uninhabited-enum-38885.stderr
index dcdf8f843..3fabf446d 100644
--- a/tests/ui/derive-uninhabited-enum-38885.stderr
+++ b/tests/ui/derive-uninhabited-enum-38885.stderr
@@ -9,6 +9,7 @@ LL | Void(Void),
|
= note: `Foo` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
= note: `-W dead-code` implied by `-W unused`
+ = help: to override `-W unused` add `#[allow(dead_code)]`
warning: 1 warning emitted
diff --git a/tests/ui/deriving/deriving-all-codegen.stdout b/tests/ui/deriving/deriving-all-codegen.stdout
index 6bfc859bf..3d9f8129d 100644
--- a/tests/ui/deriving/deriving-all-codegen.stdout
+++ b/tests/ui/deriving/deriving-all-codegen.stdout
@@ -60,7 +60,7 @@ impl ::core::marker::StructuralEq for Empty { }
impl ::core::cmp::Eq for Empty {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}
#[automatically_derived]
@@ -135,7 +135,7 @@ impl ::core::marker::StructuralEq for Point { }
impl ::core::cmp::Eq for Point {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<u32>;
}
@@ -221,7 +221,7 @@ impl ::core::marker::StructuralEq for PackedPoint { }
impl ::core::cmp::Eq for PackedPoint {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<u32>;
}
@@ -334,7 +334,7 @@ impl ::core::marker::StructuralEq for Big { }
impl ::core::cmp::Eq for Big {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<u32>;
}
@@ -500,7 +500,7 @@ impl ::core::marker::StructuralEq for Unsized { }
impl ::core::cmp::Eq for Unsized {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<[u32]>;
}
@@ -615,7 +615,7 @@ impl<T: ::core::cmp::Eq + Trait, U: ::core::cmp::Eq> ::core::cmp::Eq for
Generic<T, U> where T::A: ::core::cmp::Eq {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<T>;
let _: ::core::cmp::AssertParamIsEq<T::A>;
@@ -738,7 +738,7 @@ impl<T: ::core::cmp::Eq + ::core::marker::Copy + Trait, U: ::core::cmp::Eq +
T::A: ::core::cmp::Eq + ::core::marker::Copy {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<T>;
let _: ::core::cmp::AssertParamIsEq<T::A>;
@@ -821,7 +821,7 @@ impl ::core::marker::StructuralEq for Enum0 { }
impl ::core::cmp::Eq for Enum0 {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}
#[automatically_derived]
@@ -892,7 +892,7 @@ impl ::core::marker::StructuralEq for Enum1 { }
impl ::core::cmp::Eq for Enum1 {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<u32>;
}
@@ -959,7 +959,7 @@ impl ::core::marker::StructuralEq for Fieldless1 { }
impl ::core::cmp::Eq for Fieldless1 {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}
#[automatically_derived]
@@ -1034,7 +1034,7 @@ impl ::core::marker::StructuralEq for Fieldless { }
impl ::core::cmp::Eq for Fieldless {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}
#[automatically_derived]
@@ -1142,7 +1142,7 @@ impl ::core::marker::StructuralEq for Mixed { }
impl ::core::cmp::Eq for Mixed {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<u32>;
let _: ::core::cmp::AssertParamIsEq<Option<u32>>;
@@ -1270,7 +1270,7 @@ impl ::core::marker::StructuralEq for Fielded { }
impl ::core::cmp::Eq for Fielded {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<u32>;
let _: ::core::cmp::AssertParamIsEq<bool>;
@@ -1393,7 +1393,7 @@ impl<T: ::core::cmp::Eq, U: ::core::cmp::Eq> ::core::cmp::Eq for
EnumGeneric<T, U> {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<T>;
let _: ::core::cmp::AssertParamIsEq<U>;
diff --git a/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs b/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs
index a686ed9c8..b08e29162 100644
--- a/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs
+++ b/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs
@@ -1,12 +1,12 @@
#[diagnostic::non_existing_attribute]
//~^ERROR `#[diagnostic]` attribute name space is experimental [E0658]
-//~|WARNING unknown diagnostic attribute [unknown_diagnostic_attributes]
+//~|WARNING unknown diagnostic attribute [unknown_or_malformed_diagnostic_attributes]
pub trait Bar {
}
#[diagnostic::non_existing_attribute(with_option = "foo")]
//~^ERROR `#[diagnostic]` attribute name space is experimental [E0658]
-//~|WARNING unknown diagnostic attribute [unknown_diagnostic_attributes]
+//~|WARNING unknown diagnostic attribute [unknown_or_malformed_diagnostic_attributes]
struct Foo;
fn main() {
diff --git a/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr b/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr
index 45c95cbb3..017d00e2c 100644
--- a/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr
+++ b/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr
@@ -4,7 +4,7 @@ error[E0658]: `#[diagnostic]` attribute name space is experimental
LL | #[diagnostic::non_existing_attribute]
| ^^^^^^^^^^
|
- = note: see issue #94785 <https://github.com/rust-lang/rust/issues/94785> for more information
+ = note: see issue #111996 <https://github.com/rust-lang/rust/issues/111996> for more information
= help: add `#![feature(diagnostic_namespace)]` to the crate attributes to enable
error[E0658]: `#[diagnostic]` attribute name space is experimental
@@ -13,7 +13,7 @@ error[E0658]: `#[diagnostic]` attribute name space is experimental
LL | #[diagnostic::non_existing_attribute(with_option = "foo")]
| ^^^^^^^^^^
|
- = note: see issue #94785 <https://github.com/rust-lang/rust/issues/94785> for more information
+ = note: see issue #111996 <https://github.com/rust-lang/rust/issues/111996> for more information
= help: add `#![feature(diagnostic_namespace)]` to the crate attributes to enable
warning: unknown diagnostic attribute
@@ -22,7 +22,7 @@ warning: unknown diagnostic attribute
LL | #[diagnostic::non_existing_attribute]
| ^^^^^^^^^^^^^^^^^^^^^^
|
- = note: `#[warn(unknown_diagnostic_attributes)]` on by default
+ = note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
warning: unknown diagnostic attribute
--> $DIR/feature-gate-diagnostic_namespace.rs:7:15
diff --git a/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr b/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr
index 4f9b7ba2b..753077b36 100644
--- a/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr
+++ b/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr
@@ -4,7 +4,7 @@ warning: unknown diagnostic attribute
LL | #[diagnostic::non_existing_attribute]
| ^^^^^^^^^^^^^^^^^^^^^^
|
- = note: `#[warn(unknown_diagnostic_attributes)]` on by default
+ = note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
warning: unknown diagnostic attribute
--> $DIR/non_existing_attributes_accepted.rs:8:15
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs
new file mode 100644
index 000000000..00fb59d14
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs
@@ -0,0 +1,37 @@
+#![feature(diagnostic_namespace)]
+
+#[diagnostic::on_unimplemented(unsupported = "foo")]
+//~^WARN malformed `on_unimplemented` attribute
+//~|WARN malformed `on_unimplemented` attribute
+trait Foo {}
+
+#[diagnostic::on_unimplemented(message = "Baz")]
+//~^WARN `#[diagnostic::on_unimplemented]` can only be applied to trait definitions
+struct Bar {}
+
+#[diagnostic::on_unimplemented(message = "Boom", unsupported = "Bar")]
+//~^WARN malformed `on_unimplemented` attribute
+//~|WARN malformed `on_unimplemented` attribute
+trait Baz {}
+
+#[diagnostic::on_unimplemented(message = "Boom", on(_Self = "i32", message = "whatever"))]
+//~^WARN malformed `on_unimplemented` attribute
+//~|WARN malformed `on_unimplemented` attribute
+trait Boom {}
+
+#[diagnostic::on_unimplemented = "boom"]
+//~^WARN malformed `on_unimplemented` attribute
+trait Doom {}
+
+fn take_foo(_: impl Foo) {}
+fn take_baz(_: impl Baz) {}
+fn take_boom(_: impl Boom) {}
+
+fn main() {
+ take_foo(1_i32);
+ //~^ERROR the trait bound `i32: Foo` is not satisfied
+ take_baz(1_i32);
+ //~^ERROR Boom
+ take_boom(1_i32);
+ //~^ERROR Boom
+}
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr
new file mode 100644
index 000000000..bb1b29ef2
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr
@@ -0,0 +1,110 @@
+warning: `#[diagnostic::on_unimplemented]` can only be applied to trait definitions
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:8:1
+ |
+LL | #[diagnostic::on_unimplemented(message = "Baz")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:3:32
+ |
+LL | #[diagnostic::on_unimplemented(unsupported = "foo")]
+ | ^^^^^^^^^^^^^^^^^^^
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:12:50
+ |
+LL | #[diagnostic::on_unimplemented(message = "Boom", unsupported = "Bar")]
+ | ^^^^^^^^^^^^^^^^^^^
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:17:50
+ |
+LL | #[diagnostic::on_unimplemented(message = "Boom", on(_Self = "i32", message = "whatever"))]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:22:1
+ |
+LL | #[diagnostic::on_unimplemented = "boom"]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:3:32
+ |
+LL | #[diagnostic::on_unimplemented(unsupported = "foo")]
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `i32: Foo` is not satisfied
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:31:14
+ |
+LL | take_foo(1_i32);
+ | -------- ^^^^^ the trait `Foo` is not implemented for `i32`
+ | |
+ | required by a bound introduced by this call
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:6:1
+ |
+LL | trait Foo {}
+ | ^^^^^^^^^
+note: required by a bound in `take_foo`
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:26:21
+ |
+LL | fn take_foo(_: impl Foo) {}
+ | ^^^ required by this bound in `take_foo`
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:12:50
+ |
+LL | #[diagnostic::on_unimplemented(message = "Boom", unsupported = "Bar")]
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: Boom
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:33:14
+ |
+LL | take_baz(1_i32);
+ | -------- ^^^^^ the trait `Baz` is not implemented for `i32`
+ | |
+ | required by a bound introduced by this call
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:15:1
+ |
+LL | trait Baz {}
+ | ^^^^^^^^^
+note: required by a bound in `take_baz`
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:27:21
+ |
+LL | fn take_baz(_: impl Baz) {}
+ | ^^^ required by this bound in `take_baz`
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:17:50
+ |
+LL | #[diagnostic::on_unimplemented(message = "Boom", on(_Self = "i32", message = "whatever"))]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: Boom
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:35:15
+ |
+LL | take_boom(1_i32);
+ | --------- ^^^^^ the trait `Boom` is not implemented for `i32`
+ | |
+ | required by a bound introduced by this call
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:20:1
+ |
+LL | trait Boom {}
+ | ^^^^^^^^^^
+note: required by a bound in `take_boom`
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:28:22
+ |
+LL | fn take_boom(_: impl Boom) {}
+ | ^^^^ required by this bound in `take_boom`
+
+error: aborting due to 3 previous errors; 8 warnings emitted
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.rs b/tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.rs
new file mode 100644
index 000000000..609a840c1
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.rs
@@ -0,0 +1,7 @@
+#[diagnostic::on_unimplemented(message = "Foo")]
+//~^ERROR `#[diagnostic]` attribute name space is experimental [E0658]
+pub trait Bar {
+}
+
+fn main() {
+}
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.stderr
new file mode 100644
index 000000000..21f02e3a7
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.stderr
@@ -0,0 +1,12 @@
+error[E0658]: `#[diagnostic]` attribute name space is experimental
+ --> $DIR/feature-gate-diagnostic_on_unimplemented.rs:1:3
+ |
+LL | #[diagnostic::on_unimplemented(message = "Foo")]
+ | ^^^^^^^^^^
+ |
+ = note: see issue #111996 <https://github.com/rust-lang/rust/issues/111996> for more information
+ = help: add `#![feature(diagnostic_namespace)]` 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/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.rs b/tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.rs
new file mode 100644
index 000000000..797edbc9e
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.rs
@@ -0,0 +1,11 @@
+#![feature(diagnostic_namespace)]
+
+#[diagnostic::on_unimplemented(message = "Foo", label = "Bar", note = "Baz")]
+trait Foo {}
+
+fn takes_foo(_: impl Foo) {}
+
+fn main() {
+ takes_foo(());
+ //~^ERROR Foo
+}
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.stderr
new file mode 100644
index 000000000..549c7caa7
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.stderr
@@ -0,0 +1,24 @@
+error[E0277]: Foo
+ --> $DIR/on_unimplemented_simple.rs:9:15
+ |
+LL | takes_foo(());
+ | --------- ^^ Bar
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Foo` is not implemented for `()`
+ = note: Baz
+help: this trait has no implementations, consider adding one
+ --> $DIR/on_unimplemented_simple.rs:4:1
+ |
+LL | trait Foo {}
+ | ^^^^^^^^^
+note: required by a bound in `takes_foo`
+ --> $DIR/on_unimplemented_simple.rs:6:22
+ |
+LL | fn takes_foo(_: impl Foo) {}
+ | ^^^ required by this bound in `takes_foo`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/did_you_mean/bad-assoc-expr.stderr b/tests/ui/did_you_mean/bad-assoc-expr.stderr
index c295cac9a..b83078e21 100644
--- a/tests/ui/did_you_mean/bad-assoc-expr.stderr
+++ b/tests/ui/did_you_mean/bad-assoc-expr.stderr
@@ -2,60 +2,104 @@ error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:3:5
|
LL | [i32; 4]::clone(&a);
- | ^^^^^^^^^^^^^^^ help: try: `<[i32; 4]>::clone`
+ | ^^^^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | <[i32; 4]>::clone(&a);
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:6:5
|
LL | [i32]::as_ref(&a);
- | ^^^^^^^^^^^^^ help: try: `<[i32]>::as_ref`
+ | ^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | <[i32]>::as_ref(&a);
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:9:5
|
LL | (u8)::clone(&0);
- | ^^^^^^^^^^^ help: try: `<(u8)>::clone`
+ | ^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | <(u8)>::clone(&0);
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:12:5
|
LL | (u8, u8)::clone(&(0, 0));
- | ^^^^^^^^^^^^^^^ help: try: `<(u8, u8)>::clone`
+ | ^^^^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | <(u8, u8)>::clone(&(0, 0));
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:15:6
|
LL | &(u8)::clone(&0);
- | ^^^^^^^^^^^ help: try: `<(u8)>::clone`
+ | ^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | &<(u8)>::clone(&0);
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:18:10
|
LL | 10 + (u8)::clone(&0);
- | ^^^^^^^^^^^ help: try: `<(u8)>::clone`
+ | ^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | 10 + <(u8)>::clone(&0);
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:32:13
|
LL | let _ = ty!()::clone(&0);
- | ^^^^^^^^^^^^ help: try: `<ty!()>::clone`
+ | ^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | let _ = <ty!()>::clone(&0);
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:34:5
|
LL | ty!()::clone(&0);
- | ^^^^^^^^^^^^ help: try: `<ty!()>::clone`
+ | ^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | <ty!()>::clone(&0);
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:23:19
|
LL | ($ty: ty) => ($ty::clone(&0))
- | ^^^^^^^^^^ help: try: `<$ty>::clone`
+ | ^^^
...
LL | expr!(u8);
| --------- in this macro invocation
|
= note: this error originates in the macro `expr` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | ($ty: ty) => (<$ty>::clone(&0))
+ | + +
error: aborting due to 9 previous errors
diff --git a/tests/ui/did_you_mean/bad-assoc-pat.stderr b/tests/ui/did_you_mean/bad-assoc-pat.stderr
index 19d173f1b..8bdeb8ffd 100644
--- a/tests/ui/did_you_mean/bad-assoc-pat.stderr
+++ b/tests/ui/did_you_mean/bad-assoc-pat.stderr
@@ -2,42 +2,71 @@ error: missing angle brackets in associated item path
--> $DIR/bad-assoc-pat.rs:3:9
|
LL | [u8]::AssocItem => {}
- | ^^^^^^^^^^^^^^^ help: try: `<[u8]>::AssocItem`
+ | ^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | <[u8]>::AssocItem => {}
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-pat.rs:6:9
|
LL | (u8, u8)::AssocItem => {}
- | ^^^^^^^^^^^^^^^^^^^ help: try: `<(u8, u8)>::AssocItem`
+ | ^^^^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | <(u8, u8)>::AssocItem => {}
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-pat.rs:9:9
|
LL | _::AssocItem => {}
- | ^^^^^^^^^^^^ help: try: `<_>::AssocItem`
+ | ^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | <_>::AssocItem => {}
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-pat.rs:14:10
|
LL | &(u8,)::AssocItem => {}
- | ^^^^^^^^^^^^^^^^ help: try: `<(u8,)>::AssocItem`
+ | ^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | &<(u8,)>::AssocItem => {}
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-pat.rs:32:9
|
LL | ty!()::AssocItem => {}
- | ^^^^^^^^^^^^^^^^ help: try: `<ty!()>::AssocItem`
+ | ^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | <ty!()>::AssocItem => {}
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-pat.rs:21:19
|
LL | ($ty: ty) => ($ty::AssocItem)
- | ^^^^^^^^^^^^^^ help: try: `<$ty>::AssocItem`
+ | ^^^
...
LL | pat!(u8) => {}
| -------- in this macro invocation
|
= note: this error originates in the macro `pat` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | ($ty: ty) => (<$ty>::AssocItem)
+ | + +
error[E0599]: no associated item named `AssocItem` found for slice `[u8]` in the current scope
--> $DIR/bad-assoc-pat.rs:3:15
diff --git a/tests/ui/did_you_mean/bad-assoc-ty.stderr b/tests/ui/did_you_mean/bad-assoc-ty.stderr
index 55096e95d..efa6bb668 100644
--- a/tests/ui/did_you_mean/bad-assoc-ty.stderr
+++ b/tests/ui/did_you_mean/bad-assoc-ty.stderr
@@ -2,60 +2,104 @@ error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:1:10
|
LL | type A = [u8; 4]::AssocTy;
- | ^^^^^^^^^^^^^^^^ help: try: `<[u8; 4]>::AssocTy`
+ | ^^^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | type A = <[u8; 4]>::AssocTy;
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:5:10
|
LL | type B = [u8]::AssocTy;
- | ^^^^^^^^^^^^^ help: try: `<[u8]>::AssocTy`
+ | ^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | type B = <[u8]>::AssocTy;
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:9:10
|
LL | type C = (u8)::AssocTy;
- | ^^^^^^^^^^^^^ help: try: `<(u8)>::AssocTy`
+ | ^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | type C = <(u8)>::AssocTy;
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:13:10
|
LL | type D = (u8, u8)::AssocTy;
- | ^^^^^^^^^^^^^^^^^ help: try: `<(u8, u8)>::AssocTy`
+ | ^^^^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | type D = <(u8, u8)>::AssocTy;
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:17:10
|
LL | type E = _::AssocTy;
- | ^^^^^^^^^^ help: try: `<_>::AssocTy`
+ | ^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | type E = <_>::AssocTy;
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:21:19
|
LL | type F = &'static (u8)::AssocTy;
- | ^^^^^^^^^^^^^ help: try: `<(u8)>::AssocTy`
+ | ^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | type F = &'static <(u8)>::AssocTy;
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:27:10
|
LL | type G = dyn 'static + (Send)::AssocTy;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `<dyn 'static + (Send)>::AssocTy`
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | type G = <dyn 'static + (Send)>::AssocTy;
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:46:10
|
LL | type I = ty!()::AssocTy;
- | ^^^^^^^^^^^^^^ help: try: `<ty!()>::AssocTy`
+ | ^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | type I = <ty!()>::AssocTy;
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:39:19
|
LL | ($ty: ty) => ($ty::AssocTy);
- | ^^^^^^^^^^^^ help: try: `<$ty>::AssocTy`
+ | ^^^
...
LL | type J = ty!(u8);
| ------- in this macro invocation
|
= note: this error originates in the macro `ty` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | ($ty: ty) => (<$ty>::AssocTy);
+ | + +
error[E0223]: ambiguous associated type
--> $DIR/bad-assoc-ty.rs:1:10
diff --git a/tests/ui/drop-bounds/drop-bounds-impl-drop.rs b/tests/ui/drop-bounds/drop-bounds-impl-drop.rs
index 063efc7b3..15aebdf1b 100644
--- a/tests/ui/drop-bounds/drop-bounds-impl-drop.rs
+++ b/tests/ui/drop-bounds/drop-bounds-impl-drop.rs
@@ -2,13 +2,13 @@
#![deny(drop_bounds)]
// As a special exemption, `impl Drop` in the return position raises no error.
// This allows a convenient way to return an unnamed drop guard.
-fn voldemort_type() -> impl Drop {
- struct Voldemort;
- impl Drop for Voldemort {
+fn unnameable_type() -> impl Drop {
+ struct Unnameable;
+ impl Drop for Unnameable {
fn drop(&mut self) {}
}
- Voldemort
+ Unnameable
}
fn main() {
- let _ = voldemort_type();
+ let _ = unnameable_type();
}
diff --git a/tests/ui/drop/dynamic-drop.rs b/tests/ui/drop/dynamic-drop.rs
index 9e51d3ada..caef6358e 100644
--- a/tests/ui/drop/dynamic-drop.rs
+++ b/tests/ui/drop/dynamic-drop.rs
@@ -2,6 +2,7 @@
// needs-unwind
#![feature(generators, generator_trait)]
+#![feature(if_let_guard)]
#![allow(unused_assignments)]
#![allow(unused_variables)]
@@ -332,6 +333,16 @@ fn move_ref_pattern(a: &Allocator) {
let (ref _a, ref mut _b, _c, mut _d) = tup;
}
+fn if_let_guard(a: &Allocator, c: bool, d: i32) {
+ let foo = if c { Some(a.alloc()) } else { None };
+
+ match d == 0 {
+ false if let Some(a) = foo => { let b = a; }
+ true if let true = { drop(foo.unwrap_or_else(|| a.alloc())); d == 1 } => {}
+ _ => {}
+ }
+}
+
fn panic_after_return(a: &Allocator) -> Ptr<'_> {
// Panic in the drop of `p` or `q` can leak
let exceptions = vec![8, 9];
@@ -497,6 +508,13 @@ fn main() {
run_test(|a| move_ref_pattern(a));
+ run_test(|a| if_let_guard(a, true, 0));
+ run_test(|a| if_let_guard(a, true, 1));
+ run_test(|a| if_let_guard(a, true, 2));
+ run_test(|a| if_let_guard(a, false, 0));
+ run_test(|a| if_let_guard(a, false, 1));
+ run_test(|a| if_let_guard(a, false, 2));
+
run_test(|a| {
panic_after_return(a);
});
diff --git a/tests/ui/dropck/coroutine-liveness-1.rs b/tests/ui/dropck/coroutine-liveness-1.rs
new file mode 100644
index 000000000..aea4d15ad
--- /dev/null
+++ b/tests/ui/dropck/coroutine-liveness-1.rs
@@ -0,0 +1,18 @@
+// check-pass
+// edition: 2021
+
+// regression test for #116242.
+use std::future;
+
+fn main() {
+ let mut recv = future::ready(());
+ let _combined_fut = async {
+ let _ = || read(&mut recv);
+ };
+
+ drop(recv);
+}
+
+fn read<F: future::Future>(_: &mut F) -> F::Output {
+ todo!()
+}
diff --git a/tests/ui/dropck/coroutine-liveness-2.rs b/tests/ui/dropck/coroutine-liveness-2.rs
new file mode 100644
index 000000000..416a073c6
--- /dev/null
+++ b/tests/ui/dropck/coroutine-liveness-2.rs
@@ -0,0 +1,23 @@
+// check-pass
+// edition: 2021
+
+// regression test found while working on #117134.
+use std::future;
+
+fn main() {
+ let mut recv = future::ready(());
+ let _combined_fut = async {
+ let _ = || read(&mut recv);
+ };
+
+ let _uwu = (String::new(), _combined_fut);
+ // Dropping a coroutine as part of a more complex
+ // types should not add unnecessary liveness
+ // constraints.
+
+ drop(recv);
+}
+
+fn read<F: future::Future>(_: &mut F) -> F::Output {
+ todo!()
+}
diff --git a/tests/ui/dst/dst-bad-coerce1.stderr b/tests/ui/dst/dst-bad-coerce1.stderr
index 2c75518c2..455d15e93 100644
--- a/tests/ui/dst/dst-bad-coerce1.stderr
+++ b/tests/ui/dst/dst-bad-coerce1.stderr
@@ -15,6 +15,11 @@ error[E0277]: the trait bound `Foo: Bar` is not satisfied
LL | let f3: &Fat<dyn Bar> = f2;
| ^^ the trait `Bar` is not implemented for `Foo`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/dst-bad-coerce1.rs:10:1
+ |
+LL | trait Bar { fn bar(&self) {} }
+ | ^^^^^^^^^
= note: required for the cast from `&Fat<Foo>` to `&Fat<dyn Bar>`
error[E0308]: mismatched types
@@ -34,6 +39,11 @@ error[E0277]: the trait bound `Foo: Bar` is not satisfied
LL | let f3: &(dyn Bar,) = f2;
| ^^ the trait `Bar` is not implemented for `Foo`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/dst-bad-coerce1.rs:10:1
+ |
+LL | trait Bar { fn bar(&self) {} }
+ | ^^^^^^^^^
= note: required for the cast from `&(Foo,)` to `&(dyn Bar,)`
error: aborting due to 4 previous errors
diff --git a/tests/ui/dyn-star/error.stderr b/tests/ui/dyn-star/error.stderr
index ae54b9ca7..e039bb6f1 100644
--- a/tests/ui/dyn-star/error.stderr
+++ b/tests/ui/dyn-star/error.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `{integer}: Foo` is not satisfied
|
LL | let dyn_i: dyn* Foo = i;
| ^ the trait `Foo` is not implemented for `{integer}`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/error.rs:6:1
+ |
+LL | trait Foo {}
+ | ^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/entry-point/auxiliary/bad_main_functions.rs b/tests/ui/entry-point/auxiliary/bad_main_functions.rs
new file mode 100644
index 000000000..4649be99e
--- /dev/null
+++ b/tests/ui/entry-point/auxiliary/bad_main_functions.rs
@@ -0,0 +1,2 @@
+pub fn boilerplate(x: u8) {}
+//~^ ERROR: `main` function has wrong type [E0580]
diff --git a/tests/ui/entry-point/imported_main_from_extern_crate_wrong_type.rs b/tests/ui/entry-point/imported_main_from_extern_crate_wrong_type.rs
new file mode 100644
index 000000000..0a115dd3b
--- /dev/null
+++ b/tests/ui/entry-point/imported_main_from_extern_crate_wrong_type.rs
@@ -0,0 +1,6 @@
+// aux-build:bad_main_functions.rs
+
+#![feature(imported_main)]
+
+extern crate bad_main_functions;
+pub use bad_main_functions::boilerplate as main;
diff --git a/tests/ui/entry-point/imported_main_from_extern_crate_wrong_type.stderr b/tests/ui/entry-point/imported_main_from_extern_crate_wrong_type.stderr
new file mode 100644
index 000000000..3c6893310
--- /dev/null
+++ b/tests/ui/entry-point/imported_main_from_extern_crate_wrong_type.stderr
@@ -0,0 +1,12 @@
+error[E0580]: `main` function has wrong type
+ --> $DIR/auxiliary/bad_main_functions.rs:1:1
+ |
+LL | pub fn boilerplate(x: u8) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
+ |
+ = note: expected signature `fn()`
+ found signature `fn(u8)`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0580`.
diff --git a/tests/ui/error-codes/E0040.stderr b/tests/ui/error-codes/E0040.stderr
index 9fcda1a93..839be79d2 100644
--- a/tests/ui/error-codes/E0040.stderr
+++ b/tests/ui/error-codes/E0040.stderr
@@ -2,10 +2,12 @@ error[E0040]: explicit use of destructor method
--> $DIR/E0040.rs:16:7
|
LL | x.drop();
- | --^^^^--
- | | |
- | | explicit destructor calls not allowed
- | help: consider using `drop` function: `drop(x)`
+ | ^^^^ explicit destructor calls not allowed
+ |
+help: consider using `drop` function
+ |
+LL | drop(x);
+ | +++++ ~
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0054.stderr b/tests/ui/error-codes/E0054.stderr
index 6b1092760..0a4adabba 100644
--- a/tests/ui/error-codes/E0054.stderr
+++ b/tests/ui/error-codes/E0054.stderr
@@ -1,8 +1,13 @@
-error[E0054]: cannot cast as `bool`
+error[E0054]: cannot cast `i32` as `bool`
--> $DIR/E0054.rs:3:24
|
LL | let x_is_nonzero = x as bool;
- | ^^^^^^^^^ help: compare with zero instead: `x != 0`
+ | ^^^^^^^^^
+ |
+help: compare with zero instead
+ |
+LL | let x_is_nonzero = x != 0;
+ | ~~~~
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0094.rs b/tests/ui/error-codes/E0094.rs
index a2ec932c1..97ebcff99 100644
--- a/tests/ui/error-codes/E0094.rs
+++ b/tests/ui/error-codes/E0094.rs
@@ -1,4 +1,4 @@
-#![feature(intrinsics)]
+#![feature(intrinsics, rustc_attrs)]
extern "rust-intrinsic" {
#[rustc_safe_intrinsic]
diff --git a/tests/ui/error-codes/E0132.stderr b/tests/ui/error-codes/E0132.stderr
index c21363756..d4ddc07b5 100644
--- a/tests/ui/error-codes/E0132.stderr
+++ b/tests/ui/error-codes/E0132.stderr
@@ -1,8 +1,8 @@
-error[E0132]: start function is not allowed to have type parameters
+error[E0132]: `#[start]` function is not allowed to have type parameters
--> $DIR/E0132.rs:4:5
|
LL | fn f< T >() {}
- | ^^^^^ start function cannot have type parameters
+ | ^^^^^ `#[start]` function cannot have type parameters
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0220.stderr b/tests/ui/error-codes/E0220.stderr
index 11763ce78..e03eadaca 100644
--- a/tests/ui/error-codes/E0220.stderr
+++ b/tests/ui/error-codes/E0220.stderr
@@ -2,7 +2,7 @@ error[E0220]: associated type `F` not found for `Trait`
--> $DIR/E0220.rs:5:22
|
LL | type Foo = dyn Trait<F=i32>;
- | ^ associated type `F` not found
+ | ^ help: `Trait` has the following associated type: `Bar`
error[E0191]: the value of the associated type `Bar` (from trait `Trait`) must be specified
--> $DIR/E0220.rs:5:16
diff --git a/tests/ui/error-codes/E0277.stderr b/tests/ui/error-codes/E0277.stderr
index 440e43dff..0b0d2b097 100644
--- a/tests/ui/error-codes/E0277.stderr
+++ b/tests/ui/error-codes/E0277.stderr
@@ -21,6 +21,11 @@ LL | some_func(5i32);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/E0277.rs:3:1
+ |
+LL | trait Foo {
+ | ^^^^^^^^^
note: required by a bound in `some_func`
--> $DIR/E0277.rs:7:17
|
diff --git a/tests/ui/error-codes/E0308.stderr b/tests/ui/error-codes/E0308.stderr
index 187b775f9..141abed60 100644
--- a/tests/ui/error-codes/E0308.stderr
+++ b/tests/ui/error-codes/E0308.stderr
@@ -1,11 +1,11 @@
error[E0308]: intrinsic has wrong type
- --> $DIR/E0308.rs:6:5
+ --> $DIR/E0308.rs:6:20
|
LL | fn size_of<T>();
- | ^^^^^^^^^^^^^^^^ expected `()`, found `usize`
+ | ^ expected `usize`, found `()`
|
- = note: expected fn pointer `extern "rust-intrinsic" fn()`
- found fn pointer `extern "rust-intrinsic" fn() -> usize`
+ = note: expected signature `extern "rust-intrinsic" fn() -> usize`
+ found signature `extern "rust-intrinsic" fn()`
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0374.stderr b/tests/ui/error-codes/E0374.stderr
index 68e15e6f8..a77920430 100644
--- a/tests/ui/error-codes/E0374.stderr
+++ b/tests/ui/error-codes/E0374.stderr
@@ -1,8 +1,10 @@
-error[E0374]: the trait `CoerceUnsized` may only be implemented for a coercion between structures with one field being coerced, none found
+error[E0374]: the trait `CoerceUnsized` may only be implemented for a coercion between structures
--> $DIR/E0374.rs:8:1
|
LL | impl<T, U> CoerceUnsized<Foo<U>> for Foo<T>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: expected a single field to be coerced, none found
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0377.stderr b/tests/ui/error-codes/E0377.stderr
index bf7d8c8d3..664e499ec 100644
--- a/tests/ui/error-codes/E0377.stderr
+++ b/tests/ui/error-codes/E0377.stderr
@@ -1,8 +1,10 @@
-error[E0377]: the trait `CoerceUnsized` may only be implemented for a coercion between structures with the same definition; expected `Foo`, found `Bar`
+error[E0377]: the trait `CoerceUnsized` may only be implemented for a coercion between structures
--> $DIR/E0377.rs:12:1
|
LL | impl<T, U> CoerceUnsized<Bar<U>> for Foo<T> where T: CoerceUnsized<U> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: expected coercion between the same definition; expected `Foo`, found `Bar`
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0401.stderr b/tests/ui/error-codes/E0401.stderr
index fa4b91cac..928c8d11d 100644
--- a/tests/ui/error-codes/E0401.stderr
+++ b/tests/ui/error-codes/E0401.stderr
@@ -1,26 +1,26 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/E0401.rs:4:39
|
LL | fn foo<T>(x: T) {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | fn bfnr<U, V: Baz<U>, W: Fn()>(y: T) {
- | - ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `T,`
+ | help: try introducing a local generic parameter here: `T,`
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/E0401.rs:9:16
|
LL | fn foo<T>(x: T) {
- | - type parameter from outer function
+ | - type parameter from outer item
...
LL | fn baz<U,
- | - help: try using a local generic parameter instead: `T,`
+ | - help: try introducing a local generic parameter here: `T,`
...
LL | (y: T) {
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/E0401.rs:24:25
|
LL | impl<T> Iterator for A<T> {
@@ -29,8 +29,8 @@ LL | impl<T> Iterator for A<T> {
LL | fn helper(sel: &Self) -> u8 {
| ^^^^
| |
- | use of generic parameter from outer function
- | use a type here instead
+ | use of generic parameter from outer item
+ | refer to the type directly here instead
error[E0282]: type annotations needed
--> $DIR/E0401.rs:11:5
diff --git a/tests/ui/error-codes/E0445.rs b/tests/ui/error-codes/E0445.rs
deleted file mode 100644
index 9f29c8167..000000000
--- a/tests/ui/error-codes/E0445.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-#![feature(type_privacy_lints)]
-#[warn(private_bounds)]
-#[warn(private_interfaces)]
-
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
-
-trait Foo {
- fn dummy(&self) { }
-}
-
-pub trait Bar : Foo {}
-//~^ ERROR private trait `Foo` in public interface [E0445]
-//~| WARNING trait `Foo` is more private than the item `Bar`
-pub struct Bar2<T: Foo>(pub T);
-//~^ ERROR private trait `Foo` in public interface [E0445]
-//~| WARNING trait `Foo` is more private than the item `Bar2`
-pub fn foo<T: Foo> (t: T) {}
-//~^ ERROR private trait `Foo` in public interface [E0445]
-//~| WARNING trait `Foo` is more private than the item `foo`
-
-fn main() {}
diff --git a/tests/ui/error-codes/E0445.stderr b/tests/ui/error-codes/E0445.stderr
deleted file mode 100644
index 4f940868f..000000000
--- a/tests/ui/error-codes/E0445.stderr
+++ /dev/null
@@ -1,71 +0,0 @@
-error[E0445]: private trait `Foo` in public interface
- --> $DIR/E0445.rs:13:1
- |
-LL | trait Foo {
- | --------- `Foo` declared as private
-...
-LL | pub trait Bar : Foo {}
- | ^^^^^^^^^^^^^^^^^^^ can't leak private trait
-
-warning: trait `Foo` is more private than the item `Bar`
- --> $DIR/E0445.rs:13:1
- |
-LL | pub trait Bar : Foo {}
- | ^^^^^^^^^^^^^^^^^^^ trait `Bar` is reachable at visibility `pub`
- |
-note: but trait `Foo` is only usable at visibility `pub(crate)`
- --> $DIR/E0445.rs:9:1
- |
-LL | trait Foo {
- | ^^^^^^^^^
-note: the lint level is defined here
- --> $DIR/E0445.rs:2:8
- |
-LL | #[warn(private_bounds)]
- | ^^^^^^^^^^^^^^
-
-error[E0445]: private trait `Foo` in public interface
- --> $DIR/E0445.rs:16:1
- |
-LL | trait Foo {
- | --------- `Foo` declared as private
-...
-LL | pub struct Bar2<T: Foo>(pub T);
- | ^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
-
-warning: trait `Foo` is more private than the item `Bar2`
- --> $DIR/E0445.rs:16:1
- |
-LL | pub struct Bar2<T: Foo>(pub T);
- | ^^^^^^^^^^^^^^^^^^^^^^^ struct `Bar2` is reachable at visibility `pub`
- |
-note: but trait `Foo` is only usable at visibility `pub(crate)`
- --> $DIR/E0445.rs:9:1
- |
-LL | trait Foo {
- | ^^^^^^^^^
-
-error[E0445]: private trait `Foo` in public interface
- --> $DIR/E0445.rs:19:1
- |
-LL | trait Foo {
- | --------- `Foo` declared as private
-...
-LL | pub fn foo<T: Foo> (t: T) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
-
-warning: trait `Foo` is more private than the item `foo`
- --> $DIR/E0445.rs:19:1
- |
-LL | pub fn foo<T: Foo> (t: T) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ function `foo` is reachable at visibility `pub`
- |
-note: but trait `Foo` is only usable at visibility `pub(crate)`
- --> $DIR/E0445.rs:9:1
- |
-LL | trait Foo {
- | ^^^^^^^^^
-
-error: aborting due to 3 previous errors; 3 warnings emitted
-
-For more information about this error, try `rustc --explain E0445`.
diff --git a/tests/ui/error-codes/E0446.rs b/tests/ui/error-codes/E0446.rs
index f61c7e546..6d6c4f97c 100644
--- a/tests/ui/error-codes/E0446.rs
+++ b/tests/ui/error-codes/E0446.rs
@@ -1,9 +1,14 @@
-mod foo {
- struct Bar(u32);
+struct Bar;
+trait PrivTr {}
- pub fn bar() -> Bar { //~ ERROR E0446
- Bar(0)
- }
+pub trait PubTr {
+ type Alias1;
+ type Alias2;
+}
+
+impl PubTr for u8 {
+ type Alias1 = Bar; //~ ERROR E0446
+ type Alias2 = Box<dyn PrivTr>; //~ ERROR E0446
}
fn main() {}
diff --git a/tests/ui/error-codes/E0446.stderr b/tests/ui/error-codes/E0446.stderr
index b6a195c40..2951e69d1 100644
--- a/tests/ui/error-codes/E0446.stderr
+++ b/tests/ui/error-codes/E0446.stderr
@@ -1,12 +1,21 @@
error[E0446]: private type `Bar` in public interface
- --> $DIR/E0446.rs:4:5
+ --> $DIR/E0446.rs:10:5
|
-LL | struct Bar(u32);
- | ---------- `Bar` declared as private
-LL |
-LL | pub fn bar() -> Bar {
- | ^^^^^^^^^^^^^^^^^^^ can't leak private type
+LL | struct Bar;
+ | ---------- `Bar` declared as private
+...
+LL | type Alias1 = Bar;
+ | ^^^^^^^^^^^ can't leak private type
-error: aborting due to previous error
+error[E0446]: private trait `PrivTr` in public interface
+ --> $DIR/E0446.rs:11:5
+ |
+LL | trait PrivTr {}
+ | ------------ `PrivTr` declared as private
+...
+LL | type Alias2 = Box<dyn PrivTr>;
+ | ^^^^^^^^^^^ can't leak private trait
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/error-codes/E0602.rs b/tests/ui/error-codes/E0602.rs
index 8fadce526..77d28838a 100644
--- a/tests/ui/error-codes/E0602.rs
+++ b/tests/ui/error-codes/E0602.rs
@@ -1,6 +1,8 @@
// compile-flags:-D bogus
+// check-pass
// error-pattern:E0602
// error-pattern:requested on the command line with `-D bogus`
+// error-pattern:`#[warn(unknown_lints)]` on by default
fn main() {}
diff --git a/tests/ui/error-codes/E0602.stderr b/tests/ui/error-codes/E0602.stderr
index 2b3722633..60ecec7cd 100644
--- a/tests/ui/error-codes/E0602.stderr
+++ b/tests/ui/error-codes/E0602.stderr
@@ -1,11 +1,16 @@
-error[E0602]: unknown lint: `bogus`
+warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
+ = note: `#[warn(unknown_lints)]` on by default
-error[E0602]: unknown lint: `bogus`
+warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
-error: aborting due to 2 previous errors
+warning[E0602]: unknown lint: `bogus`
+ |
+ = note: requested on the command line with `-D bogus`
+
+warning: 3 warnings emitted
For more information about this error, try `rustc --explain E0602`.
diff --git a/tests/ui/error-codes/E0609-private-method.rs b/tests/ui/error-codes/E0609-private-method.rs
new file mode 100644
index 000000000..dfa97ad9a
--- /dev/null
+++ b/tests/ui/error-codes/E0609-private-method.rs
@@ -0,0 +1,16 @@
+// This error is an E0609 and *not* an E0615 because the fact that the method exists is not
+// relevant.
+mod foo {
+ pub struct Foo {
+ x: u32,
+ }
+
+ impl Foo {
+ fn method(&self) {}
+ }
+}
+
+fn main() {
+ let f = foo::Foo { x: 0 };
+ f.method; //~ ERROR E0609
+}
diff --git a/tests/ui/error-codes/E0609-private-method.stderr b/tests/ui/error-codes/E0609-private-method.stderr
new file mode 100644
index 000000000..d2a11e906
--- /dev/null
+++ b/tests/ui/error-codes/E0609-private-method.stderr
@@ -0,0 +1,9 @@
+error[E0609]: no field `method` on type `Foo`
+ --> $DIR/E0609-private-method.rs:15:7
+ |
+LL | f.method;
+ | ^^^^^^ unknown field
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0609`.
diff --git a/tests/ui/error-codes/E0647.stderr b/tests/ui/error-codes/E0647.stderr
index 08cedfaef..9d1ab9671 100644
--- a/tests/ui/error-codes/E0647.stderr
+++ b/tests/ui/error-codes/E0647.stderr
@@ -1,8 +1,8 @@
-error[E0647]: start function is not allowed to have a `where` clause
+error[E0647]: `#[start]` function is not allowed to have a `where` clause
--> $DIR/E0647.rs:7:50
|
LL | fn start(_: isize, _: *const *const u8) -> isize where (): Copy {
- | ^^^^^^^^^^^^^^ start function cannot have a `where` clause
+ | ^^^^^^^^^^^^^^ `#[start]` function cannot have a `where` clause
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0767.stderr b/tests/ui/error-codes/E0767.stderr
index ee8524730..4b09008f9 100644
--- a/tests/ui/error-codes/E0767.stderr
+++ b/tests/ui/error-codes/E0767.stderr
@@ -19,7 +19,7 @@ LL | | }
| |_________^ expected `()`, found closure
|
= note: expected unit type `()`
- found closure `[closure@$DIR/E0767.rs:3:9: 3:11]`
+ found closure `{closure@$DIR/E0767.rs:3:9: 3:11}`
error: aborting due to 2 previous errors
diff --git a/tests/ui/error-festival.stderr b/tests/ui/error-festival.stderr
index e8ee1d969..9d75671c4 100644
--- a/tests/ui/error-festival.stderr
+++ b/tests/ui/error-festival.stderr
@@ -59,11 +59,16 @@ error[E0605]: non-primitive cast: `u8` as `Vec<u8>`
LL | x as Vec<u8>;
| ^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
-error[E0054]: cannot cast as `bool`
+error[E0054]: cannot cast `{integer}` as `bool`
--> $DIR/error-festival.rs:33:24
|
LL | let x_is_nonzero = x as bool;
- | ^^^^^^^^^ help: compare with zero instead: `x != 0`
+ | ^^^^^^^^^
+ |
+help: compare with zero instead
+ |
+LL | let x_is_nonzero = x != 0;
+ | ~~~~
error[E0606]: casting `&u8` as `u32` is invalid
--> $DIR/error-festival.rs:37:18
diff --git a/tests/ui/explicit/explicit-call-to-dtor.stderr b/tests/ui/explicit/explicit-call-to-dtor.stderr
index f3c9bf6cc..f2e0b73b6 100644
--- a/tests/ui/explicit/explicit-call-to-dtor.stderr
+++ b/tests/ui/explicit/explicit-call-to-dtor.stderr
@@ -2,10 +2,12 @@ error[E0040]: explicit use of destructor method
--> $DIR/explicit-call-to-dtor.rs:15:7
|
LL | x.drop();
- | --^^^^--
- | | |
- | | explicit destructor calls not allowed
- | help: consider using `drop` function: `drop(x)`
+ | ^^^^ explicit destructor calls not allowed
+ |
+help: consider using `drop` function
+ |
+LL | drop(x);
+ | +++++ ~
error: aborting due to previous error
diff --git a/tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr b/tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr
index c70671173..5fa42fcf1 100644
--- a/tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr
+++ b/tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr
@@ -2,10 +2,12 @@ error[E0040]: explicit use of destructor method
--> $DIR/explicit-call-to-supertrait-dtor.rs:22:14
|
LL | self.drop();
- | -----^^^^--
- | | |
- | | explicit destructor calls not allowed
- | help: consider using `drop` function: `drop(self)`
+ | ^^^^ explicit destructor calls not allowed
+ |
+help: consider using `drop` function
+ |
+LL | drop(self);
+ | +++++ ~
error: aborting due to previous error
diff --git a/tests/ui/expr/if/bad-if-let-suggestion.rs b/tests/ui/expr/if/bad-if-let-suggestion.rs
index a8b2a2830..99d584ac7 100644
--- a/tests/ui/expr/if/bad-if-let-suggestion.rs
+++ b/tests/ui/expr/if/bad-if-let-suggestion.rs
@@ -4,9 +4,8 @@
fn a() {
if let x = 1 && i = 2 {}
//~^ ERROR cannot find value `i` in this scope
- //~| ERROR `let` expressions in this position are unstable
//~| ERROR mismatched types
- //~| ERROR `let` expressions are not supported here
+ //~| ERROR expected expression, found `let` statement
}
fn b() {
diff --git a/tests/ui/expr/if/bad-if-let-suggestion.stderr b/tests/ui/expr/if/bad-if-let-suggestion.stderr
index 3a53a20b4..20ac9ca76 100644
--- a/tests/ui/expr/if/bad-if-let-suggestion.stderr
+++ b/tests/ui/expr/if/bad-if-let-suggestion.stderr
@@ -1,4 +1,4 @@
-error: `let` expressions are not supported here
+error: expected expression, found `let` statement
--> $DIR/bad-if-let-suggestion.rs:5:8
|
LL | if let x = 1 && i = 2 {}
@@ -13,7 +13,7 @@ LL | if let x = 1 && i = 2 {}
| ^ not found in this scope
error[E0425]: cannot find value `i` in this scope
- --> $DIR/bad-if-let-suggestion.rs:13:9
+ --> $DIR/bad-if-let-suggestion.rs:12:9
|
LL | fn a() {
| ------ similarly named function `a` defined here
@@ -22,7 +22,7 @@ LL | if (i + j) = i {}
| ^ help: a function with a similar name exists: `a`
error[E0425]: cannot find value `j` in this scope
- --> $DIR/bad-if-let-suggestion.rs:13:13
+ --> $DIR/bad-if-let-suggestion.rs:12:13
|
LL | fn a() {
| ------ similarly named function `a` defined here
@@ -31,7 +31,7 @@ LL | if (i + j) = i {}
| ^ help: a function with a similar name exists: `a`
error[E0425]: cannot find value `i` in this scope
- --> $DIR/bad-if-let-suggestion.rs:13:18
+ --> $DIR/bad-if-let-suggestion.rs:12:18
|
LL | fn a() {
| ------ similarly named function `a` defined here
@@ -40,7 +40,7 @@ LL | if (i + j) = i {}
| ^ help: a function with a similar name exists: `a`
error[E0425]: cannot find value `x` in this scope
- --> $DIR/bad-if-let-suggestion.rs:20:8
+ --> $DIR/bad-if-let-suggestion.rs:19:8
|
LL | fn a() {
| ------ similarly named function `a` defined here
@@ -48,15 +48,6 @@ LL | fn a() {
LL | if x[0] = 1 {}
| ^ help: a function with a similar name exists: `a`
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/bad-if-let-suggestion.rs:5:8
- |
-LL | if let x = 1 && i = 2 {}
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
error[E0308]: mismatched types
--> $DIR/bad-if-let-suggestion.rs:5:8
|
@@ -68,7 +59,7 @@ help: you might have meant to compare for equality
LL | if let x = 1 && i == 2 {}
| +
-error: aborting due to 8 previous errors
+error: aborting due to 7 previous errors
-Some errors have detailed explanations: E0308, E0425, E0658.
+Some errors have detailed explanations: E0308, E0425.
For more information about an error, try `rustc --explain E0308`.
diff --git a/tests/ui/extern-flag/invalid-crate-name-dashed.rs b/tests/ui/extern-flag/invalid-crate-name-dashed.rs
new file mode 100644
index 000000000..7f351e48b
--- /dev/null
+++ b/tests/ui/extern-flag/invalid-crate-name-dashed.rs
@@ -0,0 +1,10 @@
+// compile-flags: --extern=my-awesome-library=libawesome.rlib
+// error-pattern: crate name `my-awesome-library` passed to `--extern` is not a valid ASCII identifier
+// error-pattern: consider replacing the dashes with underscores: `my_awesome_library`
+
+// In a sense, this is a regression test for issue #113035. We no longer suggest
+// `pub use my-awesome-library::*;` (sic!) as we outright ban this crate name.
+
+pub use my_awesome_library::*;
+
+fn main() {}
diff --git a/tests/ui/extern-flag/invalid-crate-name-dashed.stderr b/tests/ui/extern-flag/invalid-crate-name-dashed.stderr
new file mode 100644
index 000000000..5da1c4bb2
--- /dev/null
+++ b/tests/ui/extern-flag/invalid-crate-name-dashed.stderr
@@ -0,0 +1,4 @@
+error: crate name `my-awesome-library` passed to `--extern` is not a valid ASCII identifier
+ |
+ = help: consider replacing the dashes with underscores: `my_awesome_library`
+
diff --git a/tests/ui/extern-flag/invalid-crate-name-non-ascii.rs b/tests/ui/extern-flag/invalid-crate-name-non-ascii.rs
new file mode 100644
index 000000000..ec4a85820
--- /dev/null
+++ b/tests/ui/extern-flag/invalid-crate-name-non-ascii.rs
@@ -0,0 +1,4 @@
+// compile-flags: --extern čɍαţē=libnon_ascii.rlib
+// error-pattern: crate name `čɍαţē` passed to `--extern` is not a valid ASCII identifier
+
+fn main() {}
diff --git a/tests/ui/extern-flag/invalid-crate-name-non-ascii.stderr b/tests/ui/extern-flag/invalid-crate-name-non-ascii.stderr
new file mode 100644
index 000000000..6b38dcd01
--- /dev/null
+++ b/tests/ui/extern-flag/invalid-crate-name-non-ascii.stderr
@@ -0,0 +1,2 @@
+error: crate name `čɍαţē` passed to `--extern` is not a valid ASCII identifier
+
diff --git a/tests/ui/extern-flag/invalid-crate-name.rs b/tests/ui/extern-flag/invalid-crate-name.rs
new file mode 100644
index 000000000..a26b5dd46
--- /dev/null
+++ b/tests/ui/extern-flag/invalid-crate-name.rs
@@ -0,0 +1,4 @@
+// compile-flags: --extern=?#1%$
+// error-pattern: crate name `?#1%$` passed to `--extern` is not a valid ASCII identifier
+
+fn main() {}
diff --git a/tests/ui/extern-flag/invalid-crate-name.stderr b/tests/ui/extern-flag/invalid-crate-name.stderr
new file mode 100644
index 000000000..e2f83160d
--- /dev/null
+++ b/tests/ui/extern-flag/invalid-crate-name.stderr
@@ -0,0 +1,2 @@
+error: crate name `?#1%$` passed to `--extern` is not a valid ASCII identifier
+
diff --git a/tests/ui/extern/extern-main-fn.stderr b/tests/ui/extern/extern-main-fn.stderr
index 136c95753..846102670 100644
--- a/tests/ui/extern/extern-main-fn.stderr
+++ b/tests/ui/extern/extern-main-fn.stderr
@@ -4,8 +4,8 @@ error[E0580]: `main` function has wrong type
LL | extern "C" fn main() {}
| ^^^^^^^^^^^^^^^^^^^^ expected "Rust" fn, found "C" fn
|
- = note: expected fn pointer `fn()`
- found fn pointer `extern "C" fn()`
+ = note: expected signature `fn()`
+ found signature `extern "C" fn()`
error: aborting due to previous error
diff --git a/tests/ui/extern/extern-with-type-bounds.rs b/tests/ui/extern/extern-with-type-bounds.rs
index a72aa4171..99e9801fd 100644
--- a/tests/ui/extern/extern-with-type-bounds.rs
+++ b/tests/ui/extern/extern-with-type-bounds.rs
@@ -1,4 +1,4 @@
-#![feature(intrinsics)]
+#![feature(intrinsics, rustc_attrs)]
extern "rust-intrinsic" {
// Real example from libcore
diff --git a/tests/ui/feature-gates/feature-gate-adt_const_params.stderr b/tests/ui/feature-gates/feature-gate-adt_const_params.stderr
index d8f089a28..13b9b84f0 100644
--- a/tests/ui/feature-gates/feature-gate-adt_const_params.stderr
+++ b/tests/ui/feature-gates/feature-gate-adt_const_params.stderr
@@ -5,7 +5,7 @@ LL | struct Foo<const NAME: &'static str>;
| ^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to previous error
diff --git a/tests/ui/feature-gates/feature-gate-coverage-attribute.rs b/tests/ui/feature-gates/feature-gate-coverage-attribute.rs
new file mode 100644
index 000000000..0a463755f
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-coverage-attribute.rs
@@ -0,0 +1,14 @@
+#![crate_type = "lib"]
+#![feature(no_coverage)] //~ ERROR feature has been removed [E0557]
+
+#[derive(PartialEq, Eq)] // ensure deriving `Eq` does not enable `feature(coverage)`
+struct Foo {
+ a: u8,
+ b: u32,
+}
+
+#[coverage(off)] //~ ERROR the `#[coverage]` attribute is an experimental feature
+fn requires_feature_coverage() -> bool {
+ let bar = Foo { a: 0, b: 0 };
+ bar == Foo { a: 0, b: 0 }
+}
diff --git a/tests/ui/feature-gates/feature-gate-coverage-attribute.stderr b/tests/ui/feature-gates/feature-gate-coverage-attribute.stderr
new file mode 100644
index 000000000..0131a19a3
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-coverage-attribute.stderr
@@ -0,0 +1,21 @@
+error[E0557]: feature has been removed
+ --> $DIR/feature-gate-coverage-attribute.rs:2:12
+ |
+LL | #![feature(no_coverage)]
+ | ^^^^^^^^^^^ feature has been removed
+ |
+ = note: renamed to `coverage_attribute`
+
+error[E0658]: the `#[coverage]` attribute is an experimental feature
+ --> $DIR/feature-gate-coverage-attribute.rs:10:1
+ |
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #84605 <https://github.com/rust-lang/rust/issues/84605> for more information
+ = help: add `#![feature(coverage_attribute)]` to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0557, E0658.
+For more information about an error, try `rustc --explain E0557`.
diff --git a/tests/ui/feature-gates/feature-gate-no_coverage.rs b/tests/ui/feature-gates/feature-gate-no_coverage.rs
deleted file mode 100644
index fd4c6f760..000000000
--- a/tests/ui/feature-gates/feature-gate-no_coverage.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-#![crate_type = "lib"]
-
-#[derive(PartialEq, Eq)] // ensure deriving `Eq` does not enable `feature(no_coverage)`
-struct Foo {
- a: u8,
- b: u32,
-}
-
-#[no_coverage] //~ ERROR the `#[no_coverage]` attribute is an experimental feature
-fn requires_feature_no_coverage() -> bool {
- let bar = Foo { a: 0, b: 0 };
- bar == Foo { a: 0, b: 0 }
-}
diff --git a/tests/ui/feature-gates/feature-gate-no_coverage.stderr b/tests/ui/feature-gates/feature-gate-no_coverage.stderr
deleted file mode 100644
index f7167e0b7..000000000
--- a/tests/ui/feature-gates/feature-gate-no_coverage.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0658]: the `#[no_coverage]` attribute is an experimental feature
- --> $DIR/feature-gate-no_coverage.rs:9:1
- |
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
- |
- = note: see issue #84605 <https://github.com/rust-lang/rust/issues/84605> for more information
- = help: add `#![feature(no_coverage)]` 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-proc_macro_byte_character.rs b/tests/ui/feature-gates/feature-gate-proc_macro_byte_character.rs
new file mode 100644
index 000000000..0648ce0ee
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-proc_macro_byte_character.rs
@@ -0,0 +1,10 @@
+// force-host
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::Literal;
+
+fn test() {
+ Literal::byte_character(b'a'); //~ ERROR use of unstable library feature 'proc_macro_byte_character'
+}
diff --git a/tests/ui/feature-gates/feature-gate-proc_macro_byte_character.stderr b/tests/ui/feature-gates/feature-gate-proc_macro_byte_character.stderr
new file mode 100644
index 000000000..006915389
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-proc_macro_byte_character.stderr
@@ -0,0 +1,12 @@
+error[E0658]: use of unstable library feature 'proc_macro_byte_character'
+ --> $DIR/feature-gate-proc_macro_byte_character.rs:9:5
+ |
+LL | Literal::byte_character(b'a');
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #115268 <https://github.com/rust-lang/rust/issues/115268> for more information
+ = help: add `#![feature(proc_macro_byte_character)]` 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-type_privacy_lints.rs b/tests/ui/feature-gates/feature-gate-type_privacy_lints.rs
index aad64c9d0..8bb9736f1 100644
--- a/tests/ui/feature-gates/feature-gate-type_privacy_lints.rs
+++ b/tests/ui/feature-gates/feature-gate-type_privacy_lints.rs
@@ -1,11 +1,5 @@
// check-pass
-#![warn(private_interfaces)] //~ WARN unknown lint
- //~| WARN unknown lint
- //~| WARN unknown lint
-#![warn(private_bounds)] //~ WARN unknown lint
- //~| WARN unknown lint
- //~| WARN unknown lint
#![warn(unnameable_types)] //~ WARN unknown lint
//~| WARN unknown lint
//~| WARN unknown lint
diff --git a/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr b/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr
index 79cc974cc..4349fea6f 100644
--- a/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr
+++ b/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr
@@ -1,26 +1,5 @@
-warning: unknown lint: `private_interfaces`
- --> $DIR/feature-gate-type_privacy_lints.rs:3:1
- |
-LL | #![warn(private_interfaces)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: the `private_interfaces` lint is unstable
- = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
- = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
- = note: `#[warn(unknown_lints)]` on by default
-
-warning: unknown lint: `private_bounds`
- --> $DIR/feature-gate-type_privacy_lints.rs:6:1
- |
-LL | #![warn(private_bounds)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: the `private_bounds` lint is unstable
- = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
- = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
-
warning: unknown lint: `unnameable_types`
- --> $DIR/feature-gate-type_privacy_lints.rs:9:1
+ --> $DIR/feature-gate-type_privacy_lints.rs:3:1
|
LL | #![warn(unnameable_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -28,29 +7,10 @@ LL | #![warn(unnameable_types)]
= note: the `unnameable_types` lint is unstable
= note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
= help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
-
-warning: unknown lint: `private_interfaces`
- --> $DIR/feature-gate-type_privacy_lints.rs:3:1
- |
-LL | #![warn(private_interfaces)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: the `private_interfaces` lint is unstable
- = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
- = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
-
-warning: unknown lint: `private_bounds`
- --> $DIR/feature-gate-type_privacy_lints.rs:6:1
- |
-LL | #![warn(private_bounds)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: the `private_bounds` lint is unstable
- = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
- = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
+ = note: `#[warn(unknown_lints)]` on by default
warning: unknown lint: `unnameable_types`
- --> $DIR/feature-gate-type_privacy_lints.rs:9:1
+ --> $DIR/feature-gate-type_privacy_lints.rs:3:1
|
LL | #![warn(unnameable_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -59,28 +19,8 @@ LL | #![warn(unnameable_types)]
= note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
= help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
-warning: unknown lint: `private_interfaces`
- --> $DIR/feature-gate-type_privacy_lints.rs:3:1
- |
-LL | #![warn(private_interfaces)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: the `private_interfaces` lint is unstable
- = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
- = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
-
-warning: unknown lint: `private_bounds`
- --> $DIR/feature-gate-type_privacy_lints.rs:6:1
- |
-LL | #![warn(private_bounds)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: the `private_bounds` lint is unstable
- = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
- = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
-
warning: unknown lint: `unnameable_types`
- --> $DIR/feature-gate-type_privacy_lints.rs:9:1
+ --> $DIR/feature-gate-type_privacy_lints.rs:3:1
|
LL | #![warn(unnameable_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -89,5 +29,5 @@ LL | #![warn(unnameable_types)]
= note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
= help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
-warning: 9 warnings emitted
+warning: 3 warnings emitted
diff --git a/tests/ui/feature-gates/feature-gate-unnamed_fields.rs b/tests/ui/feature-gates/feature-gate-unnamed_fields.rs
new file mode 100644
index 000000000..4bbd0c83b
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-unnamed_fields.rs
@@ -0,0 +1,26 @@
+struct Foo {
+ foo: u8,
+ _: union { //~ ERROR unnamed fields are not yet fully implemented [E0658]
+ //~^ ERROR unnamed fields are not yet fully implemented [E0658]
+ //~| ERROR anonymous unions are unimplemented
+ bar: u8,
+ baz: u16
+ }
+}
+
+union Bar {
+ foobar: u8,
+ _: struct { //~ ERROR unnamed fields are not yet fully implemented [E0658]
+ //~^ ERROR unnamed fields are not yet fully implemented [E0658]
+ //~| ERROR anonymous structs are unimplemented
+ foobaz: u8,
+ barbaz: u16
+ }
+}
+
+struct S;
+struct Baz {
+ _: S //~ ERROR unnamed fields are not yet fully implemented [E0658]
+}
+
+fn main(){}
diff --git a/tests/ui/feature-gates/feature-gate-unnamed_fields.stderr b/tests/ui/feature-gates/feature-gate-unnamed_fields.stderr
new file mode 100644
index 000000000..f026f2c36
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-unnamed_fields.stderr
@@ -0,0 +1,84 @@
+error[E0658]: unnamed fields are not yet fully implemented
+ --> $DIR/feature-gate-unnamed_fields.rs:3:5
+ |
+LL | _: union {
+ | ^
+ |
+ = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
+ = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
+
+error[E0658]: unnamed fields are not yet fully implemented
+ --> $DIR/feature-gate-unnamed_fields.rs:3:8
+ |
+LL | _: union {
+ | ________^
+LL | |
+LL | |
+LL | | bar: u8,
+LL | | baz: u16
+LL | | }
+ | |_____^
+ |
+ = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
+ = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
+
+error[E0658]: unnamed fields are not yet fully implemented
+ --> $DIR/feature-gate-unnamed_fields.rs:13:5
+ |
+LL | _: struct {
+ | ^
+ |
+ = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
+ = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
+
+error[E0658]: unnamed fields are not yet fully implemented
+ --> $DIR/feature-gate-unnamed_fields.rs:13:8
+ |
+LL | _: struct {
+ | ________^
+LL | |
+LL | |
+LL | | foobaz: u8,
+LL | | barbaz: u16
+LL | | }
+ | |_____^
+ |
+ = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
+ = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
+
+error[E0658]: unnamed fields are not yet fully implemented
+ --> $DIR/feature-gate-unnamed_fields.rs:23:5
+ |
+LL | _: S
+ | ^
+ |
+ = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
+ = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
+
+error: anonymous unions are unimplemented
+ --> $DIR/feature-gate-unnamed_fields.rs:3:8
+ |
+LL | _: union {
+ | ________^
+LL | |
+LL | |
+LL | | bar: u8,
+LL | | baz: u16
+LL | | }
+ | |_____^
+
+error: anonymous structs are unimplemented
+ --> $DIR/feature-gate-unnamed_fields.rs:13:8
+ |
+LL | _: struct {
+ | ________^
+LL | |
+LL | |
+LL | | foobaz: u8,
+LL | | barbaz: u16
+LL | | }
+ | |_____^
+
+error: aborting due to 7 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/feature-gates/print-with-path.cfg.stderr b/tests/ui/feature-gates/print-with-path.cfg.stderr
deleted file mode 100644
index a6c51baa3..000000000
--- a/tests/ui/feature-gates/print-with-path.cfg.stderr
+++ /dev/null
@@ -1,2 +0,0 @@
-error: the `-Z unstable-options` flag must also be passed to enable the path print option
-
diff --git a/tests/ui/feature-gates/print-with-path.rs b/tests/ui/feature-gates/print-with-path.rs
deleted file mode 100644
index f929c14c2..000000000
--- a/tests/ui/feature-gates/print-with-path.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-// check-fail
-// revisions: cfg target-features target-cpus
-// [cfg]compile-flags: --print cfg=cfg.txt
-// [target-cpus]compile-flags: --print target-cpu=target_cpu.txt
-// [target-features]compile-flags: --print target-features=target_features.txt
-
-fn main() {}
diff --git a/tests/ui/feature-gates/print-with-path.target-cpus.stderr b/tests/ui/feature-gates/print-with-path.target-cpus.stderr
deleted file mode 100644
index a6c51baa3..000000000
--- a/tests/ui/feature-gates/print-with-path.target-cpus.stderr
+++ /dev/null
@@ -1,2 +0,0 @@
-error: the `-Z unstable-options` flag must also be passed to enable the path print option
-
diff --git a/tests/ui/feature-gates/print-with-path.target-features.stderr b/tests/ui/feature-gates/print-with-path.target-features.stderr
deleted file mode 100644
index a6c51baa3..000000000
--- a/tests/ui/feature-gates/print-with-path.target-features.stderr
+++ /dev/null
@@ -1,2 +0,0 @@
-error: the `-Z unstable-options` flag must also be passed to enable the path print option
-
diff --git a/tests/ui/fmt/raw-idents.rs b/tests/ui/fmt/raw-idents.rs
new file mode 100644
index 000000000..29a74c55a
--- /dev/null
+++ b/tests/ui/fmt/raw-idents.rs
@@ -0,0 +1,17 @@
+// Regression test for https://github.com/rust-lang/rust/issues/115466
+
+// The "identifier" in format strings is parsed as an IDENTIFIER_OR_KEYWORD, not an IDENTIFIER.
+// Test that there is an actionable diagnostic if a RAW_IDENTIFIER is used instead.
+
+fn main() {
+ let r#type = "foobar";
+ println!("It is {r#type}"); //~ ERROR: invalid format string: raw identifiers are not supported
+ println!(r##"It still is {r#type}"##); //~ ERROR: invalid format string: raw identifiers are not supported
+ println!(concat!("{r#", "type}")); //~ ERROR: invalid format string: raw identifiers are not supported
+ println!("{\x72\x23type:?}"); //~ ERROR: invalid format string: raw identifiers are not supported
+
+ // OK
+ println!("{type}");
+ println!("{let}", let = r#type);
+ println!("{let}", r#let = r#type);
+}
diff --git a/tests/ui/fmt/raw-idents.stderr b/tests/ui/fmt/raw-idents.stderr
new file mode 100644
index 000000000..2ddc114d2
--- /dev/null
+++ b/tests/ui/fmt/raw-idents.stderr
@@ -0,0 +1,44 @@
+error: invalid format string: raw identifiers are not supported
+ --> $DIR/raw-idents.rs:8:22
+ |
+LL | println!("It is {r#type}");
+ | --^^^^
+ | |
+ | raw identifier used here in format string
+ | help: remove the `r#`
+ |
+ = note: identifiers in format strings can be keywords and don't need to be prefixed with `r#`
+
+error: invalid format string: raw identifiers are not supported
+ --> $DIR/raw-idents.rs:9:31
+ |
+LL | println!(r##"It still is {r#type}"##);
+ | --^^^^
+ | |
+ | raw identifier used here in format string
+ | help: remove the `r#`
+ |
+ = note: identifiers in format strings can be keywords and don't need to be prefixed with `r#`
+
+error: invalid format string: raw identifiers are not supported
+ --> $DIR/raw-idents.rs:10:14
+ |
+LL | println!(concat!("{r#", "type}"));
+ | ^^^^^^^^^^^^^^^^^^^^^^^ raw identifier used here in format string
+ |
+ = note: identifiers in format strings can be keywords and don't need to be prefixed with `r#`
+ = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: invalid format string: raw identifiers are not supported
+ --> $DIR/raw-idents.rs:11:16
+ |
+LL | println!("{\x72\x23type:?}");
+ | --------^^^^
+ | |
+ | raw identifier used here in format string
+ | help: remove the `r#`
+ |
+ = note: identifiers in format strings can be keywords and don't need to be prefixed with `r#`
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/fn/bad-main.stderr b/tests/ui/fn/bad-main.stderr
index 675b66d05..65140a079 100644
--- a/tests/ui/fn/bad-main.stderr
+++ b/tests/ui/fn/bad-main.stderr
@@ -4,8 +4,8 @@ error[E0580]: `main` function has wrong type
LL | fn main(x: isize) { }
| ^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
- = note: expected fn pointer `fn()`
- found fn pointer `fn(isize)`
+ = note: expected signature `fn()`
+ found signature `fn(isize)`
error: aborting due to previous error
diff --git a/tests/ui/fn/fn-pointer-mismatch.stderr b/tests/ui/fn/fn-pointer-mismatch.stderr
index a674babcb..87ece845b 100644
--- a/tests/ui/fn/fn-pointer-mismatch.stderr
+++ b/tests/ui/fn/fn-pointer-mismatch.stderr
@@ -80,7 +80,6 @@ LL | let e: &fn(u32) -> u32 = &foo;
= note: expected reference `&fn(u32) -> u32`
found reference `&fn(u32) -> u32 {foo}`
= note: fn items are distinct from fn pointers
- = note: when the arguments and return types match, functions can be coerced to function pointers
help: consider casting to a fn pointer
|
LL | let e: &fn(u32) -> u32 = &(foo as fn(u32) -> u32);
diff --git a/tests/ui/fn/keyword-order.stderr b/tests/ui/fn/keyword-order.stderr
index d3b140c85..97d8f91b1 100644
--- a/tests/ui/fn/keyword-order.stderr
+++ b/tests/ui/fn/keyword-order.stderr
@@ -11,6 +11,8 @@ error: expected item, found keyword `pub`
|
LL | default pub const async unsafe extern fn err() {}
| ^^^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
error: aborting due to 2 previous errors
diff --git a/tests/ui/fn/signature-error-reporting-under-verbose.rs b/tests/ui/fn/signature-error-reporting-under-verbose.rs
index 12ff113c9..d00cbd8a0 100644
--- a/tests/ui/fn/signature-error-reporting-under-verbose.rs
+++ b/tests/ui/fn/signature-error-reporting-under-verbose.rs
@@ -12,5 +12,4 @@ fn main() {
//~| NOTE expected fn pointer, found fn item
//~| NOTE expected fn pointer `fn(i32, u32)`
//~| NOTE arguments to this function are incorrect
- //~| NOTE when the arguments and return types match, functions can be coerced to function pointers
}
diff --git a/tests/ui/fn/signature-error-reporting-under-verbose.stderr b/tests/ui/fn/signature-error-reporting-under-verbose.stderr
index f4498db72..067ee824d 100644
--- a/tests/ui/fn/signature-error-reporting-under-verbose.stderr
+++ b/tests/ui/fn/signature-error-reporting-under-verbose.stderr
@@ -8,7 +8,6 @@ LL | needs_ptr(foo);
|
= note: expected fn pointer `fn(i32, u32)`
found fn item `fn(i32, i32) {foo}`
- = note: when the arguments and return types match, functions can be coerced to function pointers
note: function defined here
--> $DIR/signature-error-reporting-under-verbose.rs:5:4
|
diff --git a/tests/ui/foreign/foreign-fn-linkname.rs b/tests/ui/foreign/foreign-fn-linkname.rs
index f6d820594..d1d6e703e 100644
--- a/tests/ui/foreign/foreign-fn-linkname.rs
+++ b/tests/ui/foreign/foreign-fn-linkname.rs
@@ -2,6 +2,9 @@
// ignore-wasm32-bare no libc to test ffi with
// ignore-sgx no libc
+// Ensure no false positive on "unused extern crate" lint
+#![deny(unused_extern_crates)]
+
#![feature(rustc_private)]
extern crate libc;
diff --git a/tests/ui/function-pointer/unsized-ret.stderr b/tests/ui/function-pointer/unsized-ret.stderr
index 870f1805b..dcfec53ee 100644
--- a/tests/ui/function-pointer/unsized-ret.stderr
+++ b/tests/ui/function-pointer/unsized-ret.stderr
@@ -1,10 +1,8 @@
error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/unsized-ret.rs:10:27
+ --> $DIR/unsized-ret.rs:10:11
|
LL | foo::<fn() -> str, _>(None, ());
- | --------------------- ^^^^ doesn't have a size known at compile-time
- | |
- | required by a bound introduced by this call
+ | ^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: within `fn() -> str`, the trait `Sized` is not implemented for `str`
= note: required because it appears within the type `fn() -> str`
@@ -15,12 +13,10 @@ LL | fn foo<F: Fn<T>, T:std::marker::Tuple>(f: Option<F>, t: T) {
| ^^^^^ required by this bound in `foo`
error[E0277]: the size for values of type `(dyn std::fmt::Display + 'a)` cannot be known at compilation time
- --> $DIR/unsized-ret.rs:13:66
+ --> $DIR/unsized-ret.rs:13:11
|
LL | foo::<for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a), _>(None, (&(),));
- | ------------------------------------------------------------ ^^^^ doesn't have a size known at compile-time
- | |
- | required by a bound introduced by this call
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: within `for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a)`, the trait `for<'a> Sized` is not implemented for `(dyn std::fmt::Display + 'a)`
= note: required because it appears within the type `fn(&()) -> dyn Display`
diff --git a/tests/ui/functions-closures/fn-help-with-err.stderr b/tests/ui/functions-closures/fn-help-with-err.stderr
index da081eb43..e5fe46114 100644
--- a/tests/ui/functions-closures/fn-help-with-err.stderr
+++ b/tests/ui/functions-closures/fn-help-with-err.stderr
@@ -4,11 +4,11 @@ error[E0425]: cannot find value `oops` in this scope
LL | let arc = std::sync::Arc::new(oops);
| ^^^^ not found in this scope
-error[E0599]: no method named `bar` found for struct `Arc<[closure@$DIR/fn-help-with-err.rs:18:36: 18:38]>` in the current scope
+error[E0599]: no method named `bar` found for struct `Arc<{closure@$DIR/fn-help-with-err.rs:18:36: 18:38}>` in the current scope
--> $DIR/fn-help-with-err.rs:19:10
|
LL | arc2.bar();
- | ^^^ method not found in `Arc<[closure@fn-help-with-err.rs:18:36]>`
+ | ^^^ method not found in `Arc<{closure@fn-help-with-err.rs:18:36}>`
|
= help: items from traits can only be used if the trait is implemented and in scope
note: `Bar` defines an item `bar`, perhaps you need to implement it
diff --git a/tests/ui/generator/addassign-yield.rs b/tests/ui/generator/addassign-yield.rs
index 7211367af..66f22bf31 100644
--- a/tests/ui/generator/addassign-yield.rs
+++ b/tests/ui/generator/addassign-yield.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// run-pass
// Regression test for broken MIR error (#61442)
// Due to the two possible evaluation orders for
diff --git a/tests/ui/generator/auto-trait-regions.drop_tracking.stderr b/tests/ui/generator/auto-trait-regions.drop_tracking.stderr
deleted file mode 100644
index b2a5b92ed..000000000
--- a/tests/ui/generator/auto-trait-regions.drop_tracking.stderr
+++ /dev/null
@@ -1,55 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/auto-trait-regions.rs:48:24
- |
-LL | let a = A(&mut true, &mut true, No);
- | ^^^^ - temporary value is freed at the end of this statement
- | |
- | creates a temporary value which is freed while still in use
-...
-LL | assert_foo(a);
- | - borrow later used here
- |
-help: consider using a `let` binding to create a longer lived value
- |
-LL ~ let binding = true;
-LL ~ let a = A(&mut binding, &mut true, No);
- |
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/auto-trait-regions.rs:48:35
- |
-LL | let a = A(&mut true, &mut true, No);
- | ^^^^ - temporary value is freed at the end of this statement
- | |
- | creates a temporary value which is freed while still in use
-...
-LL | assert_foo(a);
- | - borrow later used here
- |
-help: consider using a `let` binding to create a longer lived value
- |
-LL ~ let binding = true;
-LL ~ let a = A(&mut true, &mut binding, No);
- |
-
-error: implementation of `Foo` is not general enough
- --> $DIR/auto-trait-regions.rs:34:5
- |
-LL | assert_foo(gen);
- | ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
- |
- = note: `&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`...
- = note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef`
-
-error: implementation of `Foo` is not general enough
- --> $DIR/auto-trait-regions.rs:54:5
- |
-LL | assert_foo(gen);
- | ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
- |
- = note: `Foo` would have to be implemented for the type `A<'0, '1>`, for any two lifetimes `'0` and `'1`...
- = note: ...but `Foo` is actually implemented for the type `A<'_, '2>`, for some specific lifetime `'2`
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/tests/ui/generator/auto-trait-regions.no_drop_tracking.stderr b/tests/ui/generator/auto-trait-regions.no_drop_tracking.stderr
deleted file mode 100644
index b2a5b92ed..000000000
--- a/tests/ui/generator/auto-trait-regions.no_drop_tracking.stderr
+++ /dev/null
@@ -1,55 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/auto-trait-regions.rs:48:24
- |
-LL | let a = A(&mut true, &mut true, No);
- | ^^^^ - temporary value is freed at the end of this statement
- | |
- | creates a temporary value which is freed while still in use
-...
-LL | assert_foo(a);
- | - borrow later used here
- |
-help: consider using a `let` binding to create a longer lived value
- |
-LL ~ let binding = true;
-LL ~ let a = A(&mut binding, &mut true, No);
- |
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/auto-trait-regions.rs:48:35
- |
-LL | let a = A(&mut true, &mut true, No);
- | ^^^^ - temporary value is freed at the end of this statement
- | |
- | creates a temporary value which is freed while still in use
-...
-LL | assert_foo(a);
- | - borrow later used here
- |
-help: consider using a `let` binding to create a longer lived value
- |
-LL ~ let binding = true;
-LL ~ let a = A(&mut true, &mut binding, No);
- |
-
-error: implementation of `Foo` is not general enough
- --> $DIR/auto-trait-regions.rs:34:5
- |
-LL | assert_foo(gen);
- | ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
- |
- = note: `&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`...
- = note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef`
-
-error: implementation of `Foo` is not general enough
- --> $DIR/auto-trait-regions.rs:54:5
- |
-LL | assert_foo(gen);
- | ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
- |
- = note: `Foo` would have to be implemented for the type `A<'0, '1>`, for any two lifetimes `'0` and `'1`...
- = note: ...but `Foo` is actually implemented for the type `A<'_, '2>`, for some specific lifetime `'2`
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/tests/ui/generator/auto-trait-regions.rs b/tests/ui/generator/auto-trait-regions.rs
index 350f3cc34..aa4218e13 100644
--- a/tests/ui/generator/auto-trait-regions.rs
+++ b/tests/ui/generator/auto-trait-regions.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
#![feature(generators)]
#![feature(auto_traits)]
#![feature(negative_impls)]
diff --git a/tests/ui/generator/auto-trait-regions.drop_tracking_mir.stderr b/tests/ui/generator/auto-trait-regions.stderr
index b2a5b92ed..a9a0bde2b 100644
--- a/tests/ui/generator/auto-trait-regions.drop_tracking_mir.stderr
+++ b/tests/ui/generator/auto-trait-regions.stderr
@@ -1,5 +1,5 @@
error[E0716]: temporary value dropped while borrowed
- --> $DIR/auto-trait-regions.rs:48:24
+ --> $DIR/auto-trait-regions.rs:45:24
|
LL | let a = A(&mut true, &mut true, No);
| ^^^^ - temporary value is freed at the end of this statement
@@ -16,7 +16,7 @@ LL ~ let a = A(&mut binding, &mut true, No);
|
error[E0716]: temporary value dropped while borrowed
- --> $DIR/auto-trait-regions.rs:48:35
+ --> $DIR/auto-trait-regions.rs:45:35
|
LL | let a = A(&mut true, &mut true, No);
| ^^^^ - temporary value is freed at the end of this statement
@@ -33,7 +33,7 @@ LL ~ let a = A(&mut true, &mut binding, No);
|
error: implementation of `Foo` is not general enough
- --> $DIR/auto-trait-regions.rs:34:5
+ --> $DIR/auto-trait-regions.rs:31:5
|
LL | assert_foo(gen);
| ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
@@ -42,7 +42,7 @@ LL | assert_foo(gen);
= note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef`
error: implementation of `Foo` is not general enough
- --> $DIR/auto-trait-regions.rs:54:5
+ --> $DIR/auto-trait-regions.rs:51:5
|
LL | assert_foo(gen);
| ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
diff --git a/tests/ui/generator/borrowing.drop_tracking.stderr b/tests/ui/generator/borrowing.drop_tracking.stderr
deleted file mode 100644
index 96e3c327f..000000000
--- a/tests/ui/generator/borrowing.drop_tracking.stderr
+++ /dev/null
@@ -1,31 +0,0 @@
-error[E0597]: `a` does not live long enough
- --> $DIR/borrowing.rs:13:33
- |
-LL | let _b = {
- | -- borrow later stored here
-LL | let a = 3;
-LL | Pin::new(&mut || yield &a).resume(())
- | -- ^ borrowed value does not live long enough
- | |
- | value captured here by generator
-LL |
-LL | };
- | - `a` dropped here while still borrowed
-
-error[E0597]: `a` does not live long enough
- --> $DIR/borrowing.rs:20:20
- |
-LL | let _b = {
- | -- borrow later stored here
-LL | let a = 3;
-LL | || {
- | -- value captured here by generator
-LL | yield &a
- | ^ borrowed value does not live long enough
-...
-LL | };
- | - `a` dropped here while still borrowed
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/tests/ui/generator/borrowing.drop_tracking_mir.stderr b/tests/ui/generator/borrowing.drop_tracking_mir.stderr
deleted file mode 100644
index 8fbad276d..000000000
--- a/tests/ui/generator/borrowing.drop_tracking_mir.stderr
+++ /dev/null
@@ -1,39 +0,0 @@
-error[E0597]: `a` does not live long enough
- --> $DIR/borrowing.rs:13:33
- |
-LL | Pin::new(&mut || yield &a).resume(())
- | ----------^
- | | |
- | | borrowed value does not live long enough
- | value captured here by generator
- | a temporary with access to the borrow is created here ...
-LL |
-LL | };
- | -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for generator
- | |
- | `a` dropped here while still borrowed
- |
- = note: the temporary is part of an expression at the end of a block;
- consider forcing this temporary to be dropped sooner, before the block's local variables are dropped
-help: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block
- |
-LL | let x = Pin::new(&mut || yield &a).resume(()); x
- | +++++++ +++
-
-error[E0597]: `a` does not live long enough
- --> $DIR/borrowing.rs:20:20
- |
-LL | let _b = {
- | -- borrow later stored here
-LL | let a = 3;
-LL | || {
- | -- value captured here by generator
-LL | yield &a
- | ^ borrowed value does not live long enough
-...
-LL | };
- | - `a` dropped here while still borrowed
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/tests/ui/generator/borrowing.rs b/tests/ui/generator/borrowing.rs
index 29f39437f..d36592583 100644
--- a/tests/ui/generator/borrowing.rs
+++ b/tests/ui/generator/borrowing.rs
@@ -1,7 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-
#![feature(generators, generator_trait)]
use std::ops::Generator;
diff --git a/tests/ui/generator/borrowing.no_drop_tracking.stderr b/tests/ui/generator/borrowing.stderr
index 96e3c327f..38e1ace8c 100644
--- a/tests/ui/generator/borrowing.no_drop_tracking.stderr
+++ b/tests/ui/generator/borrowing.stderr
@@ -1,5 +1,5 @@
error[E0597]: `a` does not live long enough
- --> $DIR/borrowing.rs:13:33
+ --> $DIR/borrowing.rs:9:33
|
LL | let _b = {
| -- borrow later stored here
@@ -13,7 +13,7 @@ LL | };
| - `a` dropped here while still borrowed
error[E0597]: `a` does not live long enough
- --> $DIR/borrowing.rs:20:20
+ --> $DIR/borrowing.rs:16:20
|
LL | let _b = {
| -- borrow later stored here
diff --git a/tests/ui/generator/clone-impl-async.stderr b/tests/ui/generator/clone-impl-async.stderr
index 985472887..d172dff3a 100644
--- a/tests/ui/generator/clone-impl-async.stderr
+++ b/tests/ui/generator/clone-impl-async.stderr
@@ -1,8 +1,8 @@
-error[E0277]: the trait bound `[async block@$DIR/clone-impl-async.rs:12:27: 16:6]: Copy` is not satisfied
+error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:12:27: 16:6}: Copy` is not satisfied
--> $DIR/clone-impl-async.rs:17:16
|
LL | check_copy(&inner_non_clone);
- | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `[async block@$DIR/clone-impl-async.rs:12:27: 16:6]`
+ | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:12:27: 16:6}`
| |
| required by a bound introduced by this call
|
@@ -12,11 +12,11 @@ note: required by a bound in `check_copy`
LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy`
-error[E0277]: the trait bound `[async block@$DIR/clone-impl-async.rs:12:27: 16:6]: Clone` is not satisfied
+error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:12:27: 16:6}: Clone` is not satisfied
--> $DIR/clone-impl-async.rs:19:17
|
LL | check_clone(&inner_non_clone);
- | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `[async block@$DIR/clone-impl-async.rs:12:27: 16:6]`
+ | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:12:27: 16:6}`
| |
| required by a bound introduced by this call
|
@@ -26,11 +26,11 @@ note: required by a bound in `check_clone`
LL | fn check_clone<T: Clone>(_x: &T) {}
| ^^^^^ required by this bound in `check_clone`
-error[E0277]: the trait bound `[async block@$DIR/clone-impl-async.rs:23:27: 25:6]: Copy` is not satisfied
+error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:23:27: 25:6}: Copy` is not satisfied
--> $DIR/clone-impl-async.rs:26:16
|
LL | check_copy(&outer_non_clone);
- | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `[async block@$DIR/clone-impl-async.rs:23:27: 25:6]`
+ | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:23:27: 25:6}`
| |
| required by a bound introduced by this call
|
@@ -40,11 +40,11 @@ note: required by a bound in `check_copy`
LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy`
-error[E0277]: the trait bound `[async block@$DIR/clone-impl-async.rs:23:27: 25:6]: Clone` is not satisfied
+error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:23:27: 25:6}: Clone` is not satisfied
--> $DIR/clone-impl-async.rs:28:17
|
LL | check_clone(&outer_non_clone);
- | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `[async block@$DIR/clone-impl-async.rs:23:27: 25:6]`
+ | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:23:27: 25:6}`
| |
| required by a bound introduced by this call
|
@@ -54,11 +54,11 @@ note: required by a bound in `check_clone`
LL | fn check_clone<T: Clone>(_x: &T) {}
| ^^^^^ required by this bound in `check_clone`
-error[E0277]: the trait bound `[async block@$DIR/clone-impl-async.rs:31:28: 31:41]: Copy` is not satisfied
+error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:31:28: 31:41}: Copy` is not satisfied
--> $DIR/clone-impl-async.rs:32:16
|
LL | check_copy(&maybe_copy_clone);
- | ---------- ^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `[async block@$DIR/clone-impl-async.rs:31:28: 31:41]`
+ | ---------- ^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:31:28: 31:41}`
| |
| required by a bound introduced by this call
|
@@ -68,11 +68,11 @@ note: required by a bound in `check_copy`
LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy`
-error[E0277]: the trait bound `[async block@$DIR/clone-impl-async.rs:31:28: 31:41]: Clone` is not satisfied
+error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:31:28: 31:41}: Clone` is not satisfied
--> $DIR/clone-impl-async.rs:34:17
|
LL | check_clone(&maybe_copy_clone);
- | ----------- ^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `[async block@$DIR/clone-impl-async.rs:31:28: 31:41]`
+ | ----------- ^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:31:28: 31:41}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/generator/clone-impl-static.stderr b/tests/ui/generator/clone-impl-static.stderr
index cbadf6f15..8b51824c7 100644
--- a/tests/ui/generator/clone-impl-static.stderr
+++ b/tests/ui/generator/clone-impl-static.stderr
@@ -1,8 +1,8 @@
-error[E0277]: the trait bound `[static generator@$DIR/clone-impl-static.rs:7:15: 7:29]: Copy` is not satisfied
+error[E0277]: the trait bound `{static generator@$DIR/clone-impl-static.rs:7:15: 7:29}: Copy` is not satisfied
--> $DIR/clone-impl-static.rs:10:16
|
LL | check_copy(&gen);
- | ---------- ^^^^ the trait `Copy` is not implemented for `[static generator@$DIR/clone-impl-static.rs:7:15: 7:29]`
+ | ---------- ^^^^ the trait `Copy` is not implemented for `{static generator@$DIR/clone-impl-static.rs:7:15: 7:29}`
| |
| required by a bound introduced by this call
|
@@ -12,11 +12,11 @@ note: required by a bound in `check_copy`
LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy`
-error[E0277]: the trait bound `[static generator@$DIR/clone-impl-static.rs:7:15: 7:29]: Clone` is not satisfied
+error[E0277]: the trait bound `{static generator@$DIR/clone-impl-static.rs:7:15: 7:29}: Clone` is not satisfied
--> $DIR/clone-impl-static.rs:12:17
|
LL | check_clone(&gen);
- | ----------- ^^^^ the trait `Clone` is not implemented for `[static generator@$DIR/clone-impl-static.rs:7:15: 7:29]`
+ | ----------- ^^^^ the trait `Clone` is not implemented for `{static generator@$DIR/clone-impl-static.rs:7:15: 7:29}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/generator/clone-impl.stderr b/tests/ui/generator/clone-impl.stderr
index 64eb47c1a..870216398 100644
--- a/tests/ui/generator/clone-impl.stderr
+++ b/tests/ui/generator/clone-impl.stderr
@@ -1,11 +1,11 @@
-error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `[generator@$DIR/clone-impl.rs:36:23: 36:30]`
- --> $DIR/clone-impl.rs:42:16
+error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:36:23: 36:30}`
+ --> $DIR/clone-impl.rs:42:5
|
LL | let gen_clone_0 = move || {
- | ------- within this `[generator@$DIR/clone-impl.rs:36:23: 36:30]`
+ | ------- within this `{generator@$DIR/clone-impl.rs:36:23: 36:30}`
...
LL | check_copy(&gen_clone_0);
- | ^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:36:23: 36:30]`, the trait `Copy` is not implemented for `Vec<u32>`
+ | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec<u32>`
|
note: captured value does not implement `Copy`
--> $DIR/clone-impl.rs:40:14
@@ -18,14 +18,14 @@ note: required by a bound in `check_copy`
LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy`
-error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `[generator@$DIR/clone-impl.rs:36:23: 36:30]`
- --> $DIR/clone-impl.rs:42:16
+error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:36:23: 36:30}`
+ --> $DIR/clone-impl.rs:42:5
|
LL | let gen_clone_0 = move || {
- | ------- within this `[generator@$DIR/clone-impl.rs:36:23: 36:30]`
+ | ------- within this `{generator@$DIR/clone-impl.rs:36:23: 36:30}`
...
LL | check_copy(&gen_clone_0);
- | ^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:36:23: 36:30]`, the trait `Copy` is not implemented for `Vec<char>`
+ | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec<char>`
|
note: generator does not implement `Copy` as this value is used across a yield
--> $DIR/clone-impl.rs:38:9
@@ -34,23 +34,20 @@ LL | let v = vec!['a'];
| - has type `Vec<char>` which does not implement `Copy`
LL | yield;
| ^^^^^ yield occurs here, with `v` maybe used later
-...
-LL | };
- | - `v` is later dropped here
note: required by a bound in `check_copy`
--> $DIR/clone-impl.rs:72:18
|
LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy`
-error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `[generator@$DIR/clone-impl.rs:46:23: 46:30]`
- --> $DIR/clone-impl.rs:58:16
+error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:46:23: 46:30}`
+ --> $DIR/clone-impl.rs:58:5
|
LL | let gen_clone_1 = move || {
- | ------- within this `[generator@$DIR/clone-impl.rs:46:23: 46:30]`
+ | ------- within this `{generator@$DIR/clone-impl.rs:46:23: 46:30}`
...
LL | check_copy(&gen_clone_1);
- | ^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:46:23: 46:30]`, the trait `Copy` is not implemented for `Vec<u32>`
+ | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec<u32>`
|
note: captured value does not implement `Copy`
--> $DIR/clone-impl.rs:56:14
@@ -63,14 +60,14 @@ note: required by a bound in `check_copy`
LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy`
-error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `[generator@$DIR/clone-impl.rs:46:23: 46:30]`
- --> $DIR/clone-impl.rs:58:16
+error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:46:23: 46:30}`
+ --> $DIR/clone-impl.rs:58:5
|
LL | let gen_clone_1 = move || {
- | ------- within this `[generator@$DIR/clone-impl.rs:46:23: 46:30]`
+ | ------- within this `{generator@$DIR/clone-impl.rs:46:23: 46:30}`
...
LL | check_copy(&gen_clone_1);
- | ^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:46:23: 46:30]`, the trait `Copy` is not implemented for `Vec<char>`
+ | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec<char>`
|
note: generator does not implement `Copy` as this value is used across a yield
--> $DIR/clone-impl.rs:52:9
@@ -80,23 +77,20 @@ LL | let v = vec!['a'];
...
LL | yield;
| ^^^^^ yield occurs here, with `v` maybe used later
-...
-LL | };
- | - `v` is later dropped here
note: required by a bound in `check_copy`
--> $DIR/clone-impl.rs:72:18
|
LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy`
-error[E0277]: the trait bound `NonClone: Copy` is not satisfied in `[generator@$DIR/clone-impl.rs:62:25: 62:32]`
- --> $DIR/clone-impl.rs:66:16
+error[E0277]: the trait bound `NonClone: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:62:25: 62:32}`
+ --> $DIR/clone-impl.rs:66:5
|
LL | let gen_non_clone = move || {
- | ------- within this `[generator@$DIR/clone-impl.rs:62:25: 62:32]`
+ | ------- within this `{generator@$DIR/clone-impl.rs:62:25: 62:32}`
...
LL | check_copy(&gen_non_clone);
- | ^^^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:62:25: 62:32]`, the trait `Copy` is not implemented for `NonClone`
+ | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Copy` is not implemented for `NonClone`
|
note: captured value does not implement `Copy`
--> $DIR/clone-impl.rs:64:14
@@ -114,14 +108,14 @@ 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]`
- --> $DIR/clone-impl.rs:68:17
+error[E0277]: the trait bound `NonClone: Clone` is not satisfied in `{generator@$DIR/clone-impl.rs:62:25: 62:32}`
+ --> $DIR/clone-impl.rs:68:5
|
LL | let gen_non_clone = move || {
- | ------- within this `[generator@$DIR/clone-impl.rs:62:25: 62:32]`
+ | ------- within this `{generator@$DIR/clone-impl.rs:62:25: 62:32}`
...
LL | check_clone(&gen_non_clone);
- | ^^^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:62:25: 62:32]`, the trait `Clone` is not implemented for `NonClone`
+ | ^^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Clone` is not implemented for `NonClone`
|
note: captured value does not implement `Clone`
--> $DIR/clone-impl.rs:64:14
diff --git a/tests/ui/generator/derived-drop-parent-expr.rs b/tests/ui/generator/derived-drop-parent-expr.rs
index 4bd34346a..e38192451 100644
--- a/tests/ui/generator/derived-drop-parent-expr.rs
+++ b/tests/ui/generator/derived-drop-parent-expr.rs
@@ -1,5 +1,4 @@
// build-pass
-// compile-flags:-Zdrop-tracking
//! Like drop-tracking-parent-expression, but also tests that this doesn't ICE when building MIR
#![feature(generators)]
diff --git a/tests/ui/generator/drop-control-flow.rs b/tests/ui/generator/drop-control-flow.rs
index c6efda954..1c25c06ba 100644
--- a/tests/ui/generator/drop-control-flow.rs
+++ b/tests/ui/generator/drop-control-flow.rs
@@ -1,5 +1,4 @@
// build-pass
-// compile-flags: -Zdrop-tracking
// A test to ensure generators capture values that were conditionally dropped,
// and also that values that are dropped along all paths to a yield do not get
diff --git a/tests/ui/generator/drop-track-addassign-yield.rs b/tests/ui/generator/drop-track-addassign-yield.rs
index 71cfb170b..1e64f1d2e 100644
--- a/tests/ui/generator/drop-track-addassign-yield.rs
+++ b/tests/ui/generator/drop-track-addassign-yield.rs
@@ -1,5 +1,4 @@
// run-pass
-// compile-flags: -Zdrop-tracking
// Based on addassign-yield.rs, but with drop tracking enabled. Originally we did not implement
// the fake_read callback on ExprUseVisitor which caused this case to break.
diff --git a/tests/ui/generator/drop-tracking-error-body.rs b/tests/ui/generator/drop-tracking-error-body.rs
deleted file mode 100644
index f99d9ab6b..000000000
--- a/tests/ui/generator/drop-tracking-error-body.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// compile-flags: -Zdrop-tracking-mir --edition=2021
-
-#![feature(generators)]
-
-pub async fn async_bad_body() {
- match true {} //~ ERROR non-exhaustive patterns: type `bool` is non-empty
-}
-
-pub fn generator_bad_body() {
- || {
- // 'non-exhaustive pattern' only seems to be reported once, so this annotation doesn't work
- // keep the function around so we can make sure it doesn't ICE
- match true {}; // ERROR non-exhaustive patterns: type `bool` is non-empty
- yield ();
- };
-}
-
-fn main() {}
diff --git a/tests/ui/generator/drop-tracking-error-body.stderr b/tests/ui/generator/drop-tracking-error-body.stderr
deleted file mode 100644
index 28a689233..000000000
--- a/tests/ui/generator/drop-tracking-error-body.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0004]: non-exhaustive patterns: type `bool` is non-empty
- --> $DIR/drop-tracking-error-body.rs:6:11
- |
-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 as shown
- |
-LL ~ match true {
-LL + _ => todo!(),
-LL ~ }
- |
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/generator/drop-tracking-parent-expression.drop_tracking.stderr b/tests/ui/generator/drop-tracking-parent-expression.drop_tracking.stderr
deleted file mode 100644
index c07906ec3..000000000
--- a/tests/ui/generator/drop-tracking-parent-expression.drop_tracking.stderr
+++ /dev/null
@@ -1,128 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `derived_drop::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `significant_drop::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `insignificant_dtor::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: aborting due to 3 previous errors
-
diff --git a/tests/ui/generator/drop-tracking-parent-expression.no_drop_tracking.stderr b/tests/ui/generator/drop-tracking-parent-expression.no_drop_tracking.stderr
deleted file mode 100644
index 1a05bfe4f..000000000
--- a/tests/ui/generator/drop-tracking-parent-expression.no_drop_tracking.stderr
+++ /dev/null
@@ -1,334 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `copy::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `copy::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:40:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `copy::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:38:22
- |
-LL | let g = move || match drop($name::Client::default()) {
- | ------------------------ has type `copy::Client` which is not `Send`
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `derived_drop::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:40:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `derived_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:38:22
- |
-LL | let g = move || match drop($name::Client::default()) {
- | ------------------------ has type `derived_drop::Client` which is not `Send`
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `significant_drop::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:40:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `significant_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:38:22
- |
-LL | let g = move || match drop($name::Client::default()) {
- | ------------------------ has type `significant_drop::Client` which is not `Send`
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `insignificant_dtor::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:40:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:38:22
- |
-LL | let g = move || match drop($name::Client::default()) {
- | ------------------------ has type `insignificant_dtor::Client` which is not `Send`
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: aborting due to 8 previous errors
-
diff --git a/tests/ui/generator/drop-tracking-parent-expression.rs b/tests/ui/generator/drop-tracking-parent-expression.rs
index ed9ac6d11..198b14528 100644
--- a/tests/ui/generator/drop-tracking-parent-expression.rs
+++ b/tests/ui/generator/drop-tracking-parent-expression.rs
@@ -1,7 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-
#![feature(generators, negative_impls, rustc_attrs)]
macro_rules! type_combinations {
@@ -21,14 +17,13 @@ macro_rules! type_combinations {
let g = move || match drop($name::Client { ..$name::Client::default() }) {
//~^ `significant_drop::Client` which is not `Send`
//~| `insignificant_dtor::Client` which is not `Send`
- //[no_drop_tracking,drop_tracking]~| `derived_drop::Client` which is not `Send`
+ //~| `derived_drop::Client` which is not `Send`
_ => yield,
};
assert_send(g);
//~^ ERROR cannot be sent between threads
//~| ERROR cannot be sent between threads
//~| ERROR cannot be sent between threads
- //[no_drop_tracking]~| ERROR cannot be sent between threads
}
// Simple owned value. This works because the Client is considered moved into `drop`,
@@ -38,10 +33,6 @@ macro_rules! type_combinations {
_ => yield,
};
assert_send(g);
- //[no_drop_tracking]~^ ERROR cannot be sent between threads
- //[no_drop_tracking]~| ERROR cannot be sent between threads
- //[no_drop_tracking]~| ERROR cannot be sent between threads
- //[no_drop_tracking]~| ERROR cannot be sent between threads
}
)* }
}
diff --git a/tests/ui/generator/drop-tracking-parent-expression.drop_tracking_mir.stderr b/tests/ui/generator/drop-tracking-parent-expression.stderr
index 35698a98d..e85bb1347 100644
--- a/tests/ui/generator/drop-tracking-parent-expression.drop_tracking_mir.stderr
+++ b/tests/ui/generator/drop-tracking-parent-expression.stderr
@@ -1,5 +1,5 @@
error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:27:13
+ --> $DIR/drop-tracking-parent-expression.rs:23:13
|
LL | assert_send(g);
| ^^^^^^^^^^^ generator is not `Send`
@@ -13,9 +13,9 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client`
+ = help: within `{generator@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `derived_drop::Client`
note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:25:22
+ --> $DIR/drop-tracking-parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
| ------------------------ has type `derived_drop::Client` which is not `Send`
@@ -32,14 +32,14 @@ LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
+ --> $DIR/drop-tracking-parent-expression.rs:40:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:27:13
+ --> $DIR/drop-tracking-parent-expression.rs:23:13
|
LL | assert_send(g);
| ^^^^^^^^^^^ generator is not `Send`
@@ -53,9 +53,9 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client`
+ = help: within `{generator@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `significant_drop::Client`
note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:25:22
+ --> $DIR/drop-tracking-parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
| ------------------------ has type `significant_drop::Client` which is not `Send`
@@ -72,14 +72,14 @@ LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
+ --> $DIR/drop-tracking-parent-expression.rs:40:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:27:13
+ --> $DIR/drop-tracking-parent-expression.rs:23:13
|
LL | assert_send(g);
| ^^^^^^^^^^^ generator is not `Send`
@@ -93,9 +93,9 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client`
+ = help: within `{generator@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `insignificant_dtor::Client`
note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:25:22
+ --> $DIR/drop-tracking-parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
| ------------------------ has type `insignificant_dtor::Client` which is not `Send`
@@ -112,7 +112,7 @@ LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
+ --> $DIR/drop-tracking-parent-expression.rs:40:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
diff --git a/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs b/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs
index cbc291701..92e0136d5 100644
--- a/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs
+++ b/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs
@@ -1,8 +1,5 @@
// build-pass
// edition:2018
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
#![feature(generators)]
diff --git a/tests/ui/generator/drop-yield-twice.stderr b/tests/ui/generator/drop-yield-twice.stderr
index 0808a2c85..39a906f0b 100644
--- a/tests/ui/generator/drop-yield-twice.stderr
+++ b/tests/ui/generator/drop-yield-twice.stderr
@@ -1,16 +1,10 @@
error: generator cannot be sent between threads safely
- --> $DIR/drop-yield-twice.rs:7:17
+ --> $DIR/drop-yield-twice.rs:7:5
|
-LL | assert_send(|| {
- | _________________^
-LL | | let guard = Foo(42);
-LL | | yield;
-LL | | drop(guard);
-LL | | yield;
-LL | | })
- | |_____^ generator is not `Send`
+LL | assert_send(|| {
+ | ^^^^^^^^^^^ generator is not `Send`
|
- = help: within `[generator@$DIR/drop-yield-twice.rs:7:17: 7:19]`, the trait `Send` is not implemented for `Foo`
+ = help: within `{generator@$DIR/drop-yield-twice.rs:7:17: 7:19}`, the trait `Send` is not implemented for `Foo`
note: generator is not `Send` as this value is used across a yield
--> $DIR/drop-yield-twice.rs:9:9
|
@@ -18,9 +12,6 @@ LL | let guard = Foo(42);
| ----- has type `Foo` which is not `Send`
LL | yield;
| ^^^^^ yield occurs here, with `guard` maybe used later
-...
-LL | })
- | - `guard` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/drop-yield-twice.rs:15:19
|
diff --git a/tests/ui/generator/generator-yielding-or-returning-itself.stderr b/tests/ui/generator/generator-yielding-or-returning-itself.stderr
index a26dbf3f2..7841a0854 100644
--- a/tests/ui/generator/generator-yielding-or-returning-itself.stderr
+++ b/tests/ui/generator/generator-yielding-or-returning-itself.stderr
@@ -1,4 +1,4 @@
-error[E0271]: type mismatch resolving `<[generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 15:36] as Generator>::Return == [generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 15:36]`
+error[E0271]: type mismatch resolving `<{generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 15:36} as Generator>::Return == {generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 15:36}`
--> $DIR/generator-yielding-or-returning-itself.rs:15:34
|
LL | want_cyclic_generator_return(|| {
@@ -23,7 +23,7 @@ LL | pub fn want_cyclic_generator_return<T>(_: T)
LL | where T: Generator<Yield = (), Return = T>
| ^^^^^^^^^^ required by this bound in `want_cyclic_generator_return`
-error[E0271]: type mismatch resolving `<[generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 28:35] as Generator>::Yield == [generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 28:35]`
+error[E0271]: type mismatch resolving `<{generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 28:35} as Generator>::Yield == {generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 28:35}`
--> $DIR/generator-yielding-or-returning-itself.rs:28:33
|
LL | want_cyclic_generator_yield(|| {
diff --git a/tests/ui/generator/issue-102645.rs b/tests/ui/generator/issue-102645.rs
index 35acd5cd7..677cc69d3 100644
--- a/tests/ui/generator/issue-102645.rs
+++ b/tests/ui/generator/issue-102645.rs
@@ -1,5 +1,3 @@
-// compile-flags: -Zdrop-tracking
-
#![feature(generators, generator_trait)]
use std::ops::Generator;
diff --git a/tests/ui/generator/issue-102645.stderr b/tests/ui/generator/issue-102645.stderr
index 3f9a4c2f3..5d28dfc45 100644
--- a/tests/ui/generator/issue-102645.stderr
+++ b/tests/ui/generator/issue-102645.stderr
@@ -1,5 +1,5 @@
error[E0061]: this method takes 1 argument but 0 arguments were supplied
- --> $DIR/issue-102645.rs:16:22
+ --> $DIR/issue-102645.rs:14:22
|
LL | Pin::new(&mut b).resume();
| ^^^^^^-- an argument of type `()` is missing
diff --git a/tests/ui/generator/issue-105084.rs b/tests/ui/generator/issue-105084.rs
index ff9357b76..50b5da6e6 100644
--- a/tests/ui/generator/issue-105084.rs
+++ b/tests/ui/generator/issue-105084.rs
@@ -1,11 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-// [no_drop_tracking] known-bug: #105084
-// [no_drop_tracking] check-pass
-// [drop_tracking] known-bug: #105084
-// [drop_tracking] check-pass
-
#![feature(generators)]
#![feature(generator_clone)]
#![feature(generator_trait)]
@@ -37,13 +29,13 @@ fn main() {
// As it is not taken into account for trait computation,
// the generator is `Copy`.
let mut h = copy(g);
- //[drop_tracking_mir]~^ ERROR the trait bound `Box<(i32, ())>: Copy` is not satisfied in
+ //~^ ERROR the trait bound `Box<(i32, ())>: Copy` is not satisfied in
// We now have 2 boxes with the same backing allocation:
// one inside `g` and one inside `h`.
// Proceed and drop `t` in `g`.
Pin::new(&mut g).resume(());
- //[drop_tracking_mir]~^ ERROR borrow of moved value: `g`
+ //~^ ERROR borrow of moved value: `g`
// Proceed and drop `t` in `h` -> double free!
Pin::new(&mut h).resume(());
diff --git a/tests/ui/generator/issue-105084.drop_tracking_mir.stderr b/tests/ui/generator/issue-105084.stderr
index 1cd4c4e4d..573c31f11 100644
--- a/tests/ui/generator/issue-105084.drop_tracking_mir.stderr
+++ b/tests/ui/generator/issue-105084.stderr
@@ -1,8 +1,8 @@
error[E0382]: borrow of moved value: `g`
- --> $DIR/issue-105084.rs:45:14
+ --> $DIR/issue-105084.rs:37: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
+ | ----- move occurs because `g` has type `{generator@$DIR/issue-105084.rs:14:17: 14:19}`, which does not implement the `Copy` trait
...
LL | let mut h = copy(g);
| - value moved here
@@ -11,7 +11,7 @@ LL | Pin::new(&mut g).resume(());
| ^^^^^^ value borrowed here after move
|
note: consider changing this parameter type in function `copy` to borrow instead if owning the value isn't necessary
- --> $DIR/issue-105084.rs:17:21
+ --> $DIR/issue-105084.rs:9:21
|
LL | fn copy<T: Copy>(x: T) -> T {
| ---- ^ this parameter takes ownership of the value
@@ -22,17 +22,17 @@ help: consider cloning the value if the performance cost is acceptable
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:39:17
+error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `{generator@$DIR/issue-105084.rs:14:17: 14:19}`
+ --> $DIR/issue-105084.rs:31:17
|
LL | let mut g = || {
- | -- within this `[generator@$DIR/issue-105084.rs:22:17: 22:19]`
+ | -- within this `{generator@$DIR/issue-105084.rs:14:17: 14:19}`
...
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, ())>`
+ | ^^^^ within `{generator@$DIR/issue-105084.rs:14:17: 14: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:29:22
+ --> $DIR/issue-105084.rs:21:22
|
LL | Box::new((5, yield));
| -------------^^^^^--
@@ -40,7 +40,7 @@ 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
+ --> $DIR/issue-105084.rs:9:12
|
LL | fn copy<T: Copy>(x: T) -> T {
| ^^^^ required by this bound in `copy`
diff --git a/tests/ui/generator/issue-110929-generator-conflict-error-ice.rs b/tests/ui/generator/issue-110929-generator-conflict-error-ice.rs
index 9408acc15..845102464 100644
--- a/tests/ui/generator/issue-110929-generator-conflict-error-ice.rs
+++ b/tests/ui/generator/issue-110929-generator-conflict-error-ice.rs
@@ -1,5 +1,5 @@
// edition:2021
-// compile-flags: -Zdrop-tracking-mir=yes
+// check-pass
#![feature(generators)]
fn main() {
@@ -7,6 +7,5 @@ fn main() {
|| {
let _c = || yield *&mut *x;
|| _ = &mut *x;
- //~^ cannot borrow `*x` as mutable more than once at a time
};
}
diff --git a/tests/ui/generator/issue-110929-generator-conflict-error-ice.stderr b/tests/ui/generator/issue-110929-generator-conflict-error-ice.stderr
deleted file mode 100644
index 4d72ebe79..000000000
--- a/tests/ui/generator/issue-110929-generator-conflict-error-ice.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0499]: cannot borrow `*x` as mutable more than once at a time
- --> $DIR/issue-110929-generator-conflict-error-ice.rs:9:9
- |
-LL | let _c = || yield *&mut *x;
- | -- -- first borrow occurs due to use of `*x` in generator
- | |
- | first mutable borrow occurs here
-LL | || _ = &mut *x;
- | ^^ -- second borrow occurs due to use of `*x` in closure
- | |
- | second mutable borrow occurs here
-LL |
-LL | };
- | - first borrow might be used here, when `_c` is dropped and runs the destructor for generator
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/tests/ui/generator/issue-57017.no_drop_tracking.stderr b/tests/ui/generator/issue-57017.no_drop_tracking.stderr
deleted file mode 100644
index f7b8e198c..000000000
--- a/tests/ui/generator/issue-57017.no_drop_tracking.stderr
+++ /dev/null
@@ -1,248 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/issue-57017.rs:32:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
- |
- = help: the trait `Sync` is not implemented for `copy::unsync::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/issue-57017.rs:30:28
- |
-LL | let g = move || match drop(&$name::unsync::Client::default()) {
- | --------------------------------- has type `&copy::unsync::Client` which is not `Send`
-LL | _status => yield,
- | ^^^^^ yield occurs here, with `&$name::unsync::Client::default()` maybe used later
-LL | };
- | - `&$name::unsync::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/issue-57017.rs:52:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/issue-57017.rs:44:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/issue-57017.rs:41:21: 41:28]`, the trait `Send` is not implemented for `copy::unsend::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/issue-57017.rs:42:28
- |
-LL | let g = move || match drop($name::unsend::Client::default()) {
- | -------------------------------- has type `copy::unsend::Client` which is not `Send`
-LL | _status => yield,
- | ^^^^^ yield occurs here, with `$name::unsend::Client::default()` maybe used later
-LL | };
- | - `$name::unsend::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/issue-57017.rs:52:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/issue-57017.rs:32:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
- |
- = help: the trait `Sync` is not implemented for `derived_drop::unsync::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/issue-57017.rs:30:28
- |
-LL | let g = move || match drop(&$name::unsync::Client::default()) {
- | --------------------------------- has type `&derived_drop::unsync::Client` which is not `Send`
-LL | _status => yield,
- | ^^^^^ yield occurs here, with `&$name::unsync::Client::default()` maybe used later
-LL | };
- | - `&$name::unsync::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/issue-57017.rs:52:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/issue-57017.rs:44:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/issue-57017.rs:41:21: 41:28]`, the trait `Send` is not implemented for `derived_drop::unsend::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/issue-57017.rs:42:28
- |
-LL | let g = move || match drop($name::unsend::Client::default()) {
- | -------------------------------- has type `derived_drop::unsend::Client` which is not `Send`
-LL | _status => yield,
- | ^^^^^ yield occurs here, with `$name::unsend::Client::default()` maybe used later
-LL | };
- | - `$name::unsend::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/issue-57017.rs:52:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/issue-57017.rs:32:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
- |
- = help: the trait `Sync` is not implemented for `significant_drop::unsync::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/issue-57017.rs:30:28
- |
-LL | let g = move || match drop(&$name::unsync::Client::default()) {
- | --------------------------------- has type `&significant_drop::unsync::Client` which is not `Send`
-LL | _status => yield,
- | ^^^^^ yield occurs here, with `&$name::unsync::Client::default()` maybe used later
-LL | };
- | - `&$name::unsync::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/issue-57017.rs:52:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/issue-57017.rs:44:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/issue-57017.rs:41:21: 41:28]`, the trait `Send` is not implemented for `significant_drop::unsend::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/issue-57017.rs:42:28
- |
-LL | let g = move || match drop($name::unsend::Client::default()) {
- | -------------------------------- has type `significant_drop::unsend::Client` which is not `Send`
-LL | _status => yield,
- | ^^^^^ yield occurs here, with `$name::unsend::Client::default()` maybe used later
-LL | };
- | - `$name::unsend::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/issue-57017.rs:52:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: aborting due to 6 previous errors
-
diff --git a/tests/ui/generator/issue-57017.rs b/tests/ui/generator/issue-57017.rs
index 381897c77..bb2d6679b 100644
--- a/tests/ui/generator/issue-57017.rs
+++ b/tests/ui/generator/issue-57017.rs
@@ -1,9 +1,4 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-// [drop_tracking] build-pass
-// [drop_tracking_mir] build-pass
-
+// build-pass
#![feature(generators, negative_impls)]
#![allow(dropping_references, dropping_copy_types)]
@@ -30,9 +25,6 @@ macro_rules! type_combinations {
_status => yield,
};
assert_send(g);
- //[no_drop_tracking]~^ ERROR generator cannot be sent between threads safely
- //[no_drop_tracking]~| ERROR generator cannot be sent between threads safely
- //[no_drop_tracking]~| ERROR generator cannot be sent between threads safely
}
// This tests that `Client` is properly considered to be dropped after moving it into the
@@ -42,9 +34,6 @@ macro_rules! type_combinations {
_status => yield,
};
assert_send(g);
- //[no_drop_tracking]~^ ERROR generator cannot be sent between threads safely
- //[no_drop_tracking]~| ERROR generator cannot be sent between threads safely
- //[no_drop_tracking]~| ERROR generator cannot be sent between threads safely
}
)* }
}
diff --git a/tests/ui/generator/issue-57478.no_drop_tracking.stderr b/tests/ui/generator/issue-57478.no_drop_tracking.stderr
deleted file mode 100644
index 612dd9c37..000000000
--- a/tests/ui/generator/issue-57478.no_drop_tracking.stderr
+++ /dev/null
@@ -1,31 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/issue-57478.rs:13:17
- |
-LL | assert_send(|| {
- | _________________^
-LL | |
-LL | | let guard = Foo;
-LL | | drop(guard);
-LL | | yield;
-LL | | })
- | |_____^ generator is not `Send`
- |
- = help: within `[generator@$DIR/issue-57478.rs:13:17: 13:19]`, the trait `Send` is not implemented for `Foo`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/issue-57478.rs:17:9
- |
-LL | let guard = Foo;
- | ----- has type `Foo` which is not `Send`
-LL | drop(guard);
-LL | yield;
- | ^^^^^ yield occurs here, with `guard` maybe used later
-LL | })
- | - `guard` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/issue-57478.rs:21:19
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/generator/issue-57478.rs b/tests/ui/generator/issue-57478.rs
index 3c23b5992..39710febd 100644
--- a/tests/ui/generator/issue-57478.rs
+++ b/tests/ui/generator/issue-57478.rs
@@ -1,8 +1,4 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-// [drop_tracking] check-pass
-// [drop_tracking_mir] check-pass
+// check-pass
#![feature(negative_impls, generators)]
@@ -11,7 +7,6 @@ impl !Send for Foo {}
fn main() {
assert_send(|| {
- //[no_drop_tracking]~^ ERROR generator cannot be sent between threads safely
let guard = Foo;
drop(guard);
yield;
diff --git a/tests/ui/generator/issue-68112.drop_tracking.stderr b/tests/ui/generator/issue-68112.drop_tracking.stderr
deleted file mode 100644
index 282eac1b6..000000000
--- a/tests/ui/generator/issue-68112.drop_tracking.stderr
+++ /dev/null
@@ -1,66 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/issue-68112.rs:43:18
- |
-LL | require_send(send_gen);
- | ^^^^^^^^ generator is not `Send`
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/issue-68112.rs:39:9
- |
-LL | let _non_send_gen = make_non_send_generator();
- | ------------- has type `impl Generator<Return = Arc<RefCell<i32>>>` which is not `Send`
-LL |
-LL | yield;
- | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
-...
-LL | };
- | - `_non_send_gen` is later dropped here
-note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:25:25
- |
-LL | fn require_send(_: impl Send) {}
- | ^^^^ required by this bound in `require_send`
-
-error[E0277]: `RefCell<i32>` cannot be shared between threads safely
- --> $DIR/issue-68112.rs:67:18
- |
-LL | require_send(send_gen);
- | ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
- | |
- | required by a bound introduced by this call
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
- = note: required for `Arc<RefCell<i32>>` to implement `Send`
-note: required because it's used within this generator
- --> $DIR/issue-68112.rs:52:5
- |
-LL | || {
- | ^^
-note: required because it appears within the type `impl Generator<Return = Arc<RefCell<i32>>>`
- --> $DIR/issue-68112.rs:49:30
- |
-LL | pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: required because it appears within the type `impl Generator<Return = Arc<RefCell<i32>>>`
- --> $DIR/issue-68112.rs:57:34
- |
-LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: required because it captures the following types: `impl Generator<Return = Arc<RefCell<i32>>>`, `()`
-note: required because it's used within this generator
- --> $DIR/issue-68112.rs:63:20
- |
-LL | let send_gen = || {
- | ^^
-note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:25:25
- |
-LL | fn require_send(_: impl Send) {}
- | ^^^^ required by this bound in `require_send`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generator/issue-68112.no_drop_tracking.stderr b/tests/ui/generator/issue-68112.no_drop_tracking.stderr
deleted file mode 100644
index 282eac1b6..000000000
--- a/tests/ui/generator/issue-68112.no_drop_tracking.stderr
+++ /dev/null
@@ -1,66 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/issue-68112.rs:43:18
- |
-LL | require_send(send_gen);
- | ^^^^^^^^ generator is not `Send`
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/issue-68112.rs:39:9
- |
-LL | let _non_send_gen = make_non_send_generator();
- | ------------- has type `impl Generator<Return = Arc<RefCell<i32>>>` which is not `Send`
-LL |
-LL | yield;
- | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
-...
-LL | };
- | - `_non_send_gen` is later dropped here
-note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:25:25
- |
-LL | fn require_send(_: impl Send) {}
- | ^^^^ required by this bound in `require_send`
-
-error[E0277]: `RefCell<i32>` cannot be shared between threads safely
- --> $DIR/issue-68112.rs:67:18
- |
-LL | require_send(send_gen);
- | ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
- | |
- | required by a bound introduced by this call
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
- = note: required for `Arc<RefCell<i32>>` to implement `Send`
-note: required because it's used within this generator
- --> $DIR/issue-68112.rs:52:5
- |
-LL | || {
- | ^^
-note: required because it appears within the type `impl Generator<Return = Arc<RefCell<i32>>>`
- --> $DIR/issue-68112.rs:49:30
- |
-LL | pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: required because it appears within the type `impl Generator<Return = Arc<RefCell<i32>>>`
- --> $DIR/issue-68112.rs:57:34
- |
-LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: required because it captures the following types: `impl Generator<Return = Arc<RefCell<i32>>>`, `()`
-note: required because it's used within this generator
- --> $DIR/issue-68112.rs:63:20
- |
-LL | let send_gen = || {
- | ^^
-note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:25:25
- |
-LL | fn require_send(_: impl Send) {}
- | ^^^^ required by this bound in `require_send`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generator/issue-68112.rs b/tests/ui/generator/issue-68112.rs
index 48b53b769..9dd68726f 100644
--- a/tests/ui/generator/issue-68112.rs
+++ b/tests/ui/generator/issue-68112.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
#![feature(generators, generator_trait)]
use std::{
@@ -39,7 +36,7 @@ fn test1() {
yield;
//~^ NOTE yield occurs here
//~| NOTE value is used across a yield
- }; //[no_drop_tracking,drop_tracking]~ NOTE later dropped here
+ };
require_send(send_gen);
//~^ ERROR generator cannot be sent between threads
//~| NOTE not `Send`
@@ -68,7 +65,6 @@ fn test2() {
//~^ ERROR `RefCell<i32>` cannot be shared between threads safely
//~| NOTE `RefCell<i32>` cannot be shared between threads safely
//~| NOTE required for
- //[no_drop_tracking,drop_tracking]~| NOTE required by a bound introduced by this call
//~| NOTE captures the following types
//~| NOTE use `std::sync::RwLock` instead
}
diff --git a/tests/ui/generator/issue-68112.drop_tracking_mir.stderr b/tests/ui/generator/issue-68112.stderr
index a83522b71..808004822 100644
--- a/tests/ui/generator/issue-68112.drop_tracking_mir.stderr
+++ b/tests/ui/generator/issue-68112.stderr
@@ -1,5 +1,5 @@
error: generator cannot be sent between threads safely
- --> $DIR/issue-68112.rs:43:5
+ --> $DIR/issue-68112.rs:40:5
|
LL | require_send(send_gen);
| ^^^^^^^^^^^^ generator is not `Send`
@@ -7,7 +7,7 @@ LL | require_send(send_gen);
= help: the trait `Sync` is not implemented for `RefCell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
note: generator is not `Send` as this value is used across a yield
- --> $DIR/issue-68112.rs:39:9
+ --> $DIR/issue-68112.rs:36:9
|
LL | let _non_send_gen = make_non_send_generator();
| ------------- has type `impl Generator<Return = Arc<RefCell<i32>>>` which is not `Send`
@@ -15,13 +15,13 @@ LL |
LL | yield;
| ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:25:25
+ --> $DIR/issue-68112.rs:22:25
|
LL | fn require_send(_: impl Send) {}
| ^^^^ required by this bound in `require_send`
error[E0277]: `RefCell<i32>` cannot be shared between threads safely
- --> $DIR/issue-68112.rs:67:5
+ --> $DIR/issue-68112.rs:64:5
|
LL | require_send(send_gen);
| ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
@@ -30,28 +30,28 @@ LL | require_send(send_gen);
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
= note: required for `Arc<RefCell<i32>>` to implement `Send`
note: required because it's used within this generator
- --> $DIR/issue-68112.rs:52:5
+ --> $DIR/issue-68112.rs:49:5
|
LL | || {
| ^^
note: required because it appears within the type `impl Generator<Return = Arc<RefCell<i32>>>`
- --> $DIR/issue-68112.rs:49:30
+ --> $DIR/issue-68112.rs:46:30
|
LL | pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
note: required because it appears within the type `impl Generator<Return = Arc<RefCell<i32>>>`
- --> $DIR/issue-68112.rs:57:34
+ --> $DIR/issue-68112.rs:54:34
|
LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: required because it captures the following types: `impl Generator<Return = Arc<RefCell<i32>>>`
note: required because it's used within this generator
- --> $DIR/issue-68112.rs:63:20
+ --> $DIR/issue-68112.rs:60:20
|
LL | let send_gen = || {
| ^^
note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:25:25
+ --> $DIR/issue-68112.rs:22:25
|
LL | fn require_send(_: impl Send) {}
| ^^^^ required by this bound in `require_send`
diff --git a/tests/ui/generator/issue-93161.rs b/tests/ui/generator/issue-93161.rs
index 8d3f7c62f..ae8603b7c 100644
--- a/tests/ui/generator/issue-93161.rs
+++ b/tests/ui/generator/issue-93161.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2021
// run-pass
diff --git a/tests/ui/generator/layout-error.rs b/tests/ui/generator/layout-error.rs
index 44cfc1d70..7c3d18740 100644
--- a/tests/ui/generator/layout-error.rs
+++ b/tests/ui/generator/layout-error.rs
@@ -24,6 +24,5 @@ fn main() {
type F = impl Future;
// Check that statics are inhabited computes they layout.
static POOL: Task<F> = Task::new();
- //~^ ERROR: cannot check whether the hidden type of `layout_error[b009]::main::F::{opaque#0}` satisfies auto traits
Task::spawn(&POOL, || cb());
}
diff --git a/tests/ui/generator/layout-error.stderr b/tests/ui/generator/layout-error.stderr
index ea3b25551..b1a258f4f 100644
--- a/tests/ui/generator/layout-error.stderr
+++ b/tests/ui/generator/layout-error.stderr
@@ -4,24 +4,6 @@ error[E0425]: cannot find value `Foo` in this scope
LL | let a = Foo;
| ^^^ not found in this scope
-error: cannot check whether the hidden type of `layout_error[b009]::main::F::{opaque#0}` satisfies auto traits
- --> $DIR/layout-error.rs:26:18
- |
-LL | static POOL: Task<F> = Task::new();
- | ^^^^^^^
- |
-note: opaque type is declared here
- --> $DIR/layout-error.rs:24:14
- |
-LL | type F = impl Future;
- | ^^^^^^^^^^^
-note: required because it appears within the type `Task<F>`
- --> $DIR/layout-error.rs:9:12
- |
-LL | pub struct Task<F: Future>(F);
- | ^^^^
- = note: shared static variables must have a type that implements `Sync`
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/generator/not-send-sync.drop_tracking.stderr b/tests/ui/generator/not-send-sync.drop_tracking.stderr
deleted file mode 100644
index 718fd4224..000000000
--- a/tests/ui/generator/not-send-sync.drop_tracking.stderr
+++ /dev/null
@@ -1,60 +0,0 @@
-error: generator cannot be shared between threads safely
- --> $DIR/not-send-sync.rs:17:17
- |
-LL | assert_sync(|| {
- | _________________^
-LL | |
-LL | | let a = NotSync;
-LL | | yield;
-LL | | drop(a);
-LL | | });
- | |_____^ generator is not `Sync`
- |
- = help: within `[generator@$DIR/not-send-sync.rs:17:17: 17:19]`, the trait `Sync` is not implemented for `NotSync`
-note: generator is not `Sync` as this value is used across a yield
- --> $DIR/not-send-sync.rs:20:9
- |
-LL | let a = NotSync;
- | - has type `NotSync` which is not `Sync`
-LL | yield;
- | ^^^^^ yield occurs here, with `a` maybe used later
-LL | drop(a);
-LL | });
- | - `a` is later dropped here
-note: required by a bound in `assert_sync`
- --> $DIR/not-send-sync.rs:14:23
- |
-LL | fn assert_sync<T: Sync>(_: T) {}
- | ^^^^ required by this bound in `assert_sync`
-
-error: generator cannot be sent between threads safely
- --> $DIR/not-send-sync.rs:24:17
- |
-LL | assert_send(|| {
- | _________________^
-LL | |
-LL | | let a = NotSend;
-LL | | yield;
-LL | | drop(a);
-LL | | });
- | |_____^ generator is not `Send`
- |
- = help: within `[generator@$DIR/not-send-sync.rs:24:17: 24:19]`, the trait `Send` is not implemented for `NotSend`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/not-send-sync.rs:27:9
- |
-LL | let a = NotSend;
- | - has type `NotSend` which is not `Send`
-LL | yield;
- | ^^^^^ yield occurs here, with `a` maybe used later
-LL | drop(a);
-LL | });
- | - `a` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/not-send-sync.rs:15:23
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/generator/not-send-sync.no_drop_tracking.stderr b/tests/ui/generator/not-send-sync.no_drop_tracking.stderr
deleted file mode 100644
index 718fd4224..000000000
--- a/tests/ui/generator/not-send-sync.no_drop_tracking.stderr
+++ /dev/null
@@ -1,60 +0,0 @@
-error: generator cannot be shared between threads safely
- --> $DIR/not-send-sync.rs:17:17
- |
-LL | assert_sync(|| {
- | _________________^
-LL | |
-LL | | let a = NotSync;
-LL | | yield;
-LL | | drop(a);
-LL | | });
- | |_____^ generator is not `Sync`
- |
- = help: within `[generator@$DIR/not-send-sync.rs:17:17: 17:19]`, the trait `Sync` is not implemented for `NotSync`
-note: generator is not `Sync` as this value is used across a yield
- --> $DIR/not-send-sync.rs:20:9
- |
-LL | let a = NotSync;
- | - has type `NotSync` which is not `Sync`
-LL | yield;
- | ^^^^^ yield occurs here, with `a` maybe used later
-LL | drop(a);
-LL | });
- | - `a` is later dropped here
-note: required by a bound in `assert_sync`
- --> $DIR/not-send-sync.rs:14:23
- |
-LL | fn assert_sync<T: Sync>(_: T) {}
- | ^^^^ required by this bound in `assert_sync`
-
-error: generator cannot be sent between threads safely
- --> $DIR/not-send-sync.rs:24:17
- |
-LL | assert_send(|| {
- | _________________^
-LL | |
-LL | | let a = NotSend;
-LL | | yield;
-LL | | drop(a);
-LL | | });
- | |_____^ generator is not `Send`
- |
- = help: within `[generator@$DIR/not-send-sync.rs:24:17: 24:19]`, the trait `Send` is not implemented for `NotSend`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/not-send-sync.rs:27:9
- |
-LL | let a = NotSend;
- | - has type `NotSend` which is not `Send`
-LL | yield;
- | ^^^^^ yield occurs here, with `a` maybe used later
-LL | drop(a);
-LL | });
- | - `a` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/not-send-sync.rs:15:23
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/generator/not-send-sync.rs b/tests/ui/generator/not-send-sync.rs
index 8794db452..16c8cd476 100644
--- a/tests/ui/generator/not-send-sync.rs
+++ b/tests/ui/generator/not-send-sync.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
#![feature(generators)]
#![feature(negative_impls)]
diff --git a/tests/ui/generator/not-send-sync.drop_tracking_mir.stderr b/tests/ui/generator/not-send-sync.stderr
index 66f01ae37..13ce687e0 100644
--- a/tests/ui/generator/not-send-sync.drop_tracking_mir.stderr
+++ b/tests/ui/generator/not-send-sync.stderr
@@ -1,39 +1,39 @@
error: generator cannot be shared between threads safely
- --> $DIR/not-send-sync.rs:17:5
+ --> $DIR/not-send-sync.rs:14:5
|
LL | assert_sync(|| {
| ^^^^^^^^^^^ generator is not `Sync`
|
- = help: within `[generator@$DIR/not-send-sync.rs:17:17: 17:19]`, the trait `Sync` is not implemented for `NotSync`
+ = help: within `{generator@$DIR/not-send-sync.rs:14:17: 14:19}`, the trait `Sync` is not implemented for `NotSync`
note: generator is not `Sync` as this value is used across a yield
- --> $DIR/not-send-sync.rs:20:9
+ --> $DIR/not-send-sync.rs:17:9
|
LL | let a = NotSync;
| - has type `NotSync` which is not `Sync`
LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later
note: required by a bound in `assert_sync`
- --> $DIR/not-send-sync.rs:14:23
+ --> $DIR/not-send-sync.rs:11:23
|
LL | fn assert_sync<T: Sync>(_: T) {}
| ^^^^ required by this bound in `assert_sync`
error: generator cannot be sent between threads safely
- --> $DIR/not-send-sync.rs:24:5
+ --> $DIR/not-send-sync.rs:21:5
|
LL | assert_send(|| {
| ^^^^^^^^^^^ generator is not `Send`
|
- = help: within `[generator@$DIR/not-send-sync.rs:24:17: 24:19]`, the trait `Send` is not implemented for `NotSend`
+ = help: within `{generator@$DIR/not-send-sync.rs:21:17: 21:19}`, the trait `Send` is not implemented for `NotSend`
note: generator is not `Send` as this value is used across a yield
- --> $DIR/not-send-sync.rs:27:9
+ --> $DIR/not-send-sync.rs:24:9
|
LL | let a = NotSend;
| - has type `NotSend` which is not `Send`
LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later
note: required by a bound in `assert_send`
- --> $DIR/not-send-sync.rs:15:23
+ --> $DIR/not-send-sync.rs:12:23
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
diff --git a/tests/ui/generator/parent-expression.drop_tracking.stderr b/tests/ui/generator/parent-expression.drop_tracking.stderr
deleted file mode 100644
index ef489088b..000000000
--- a/tests/ui/generator/parent-expression.drop_tracking.stderr
+++ /dev/null
@@ -1,128 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `derived_drop::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `significant_drop::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `insignificant_dtor::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: aborting due to 3 previous errors
-
diff --git a/tests/ui/generator/parent-expression.no_drop_tracking.stderr b/tests/ui/generator/parent-expression.no_drop_tracking.stderr
deleted file mode 100644
index 2e1313a80..000000000
--- a/tests/ui/generator/parent-expression.no_drop_tracking.stderr
+++ /dev/null
@@ -1,334 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `copy::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `copy::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:40:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `copy::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:38:22
- |
-LL | let g = move || match drop($name::Client::default()) {
- | ------------------------ has type `copy::Client` which is not `Send`
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `derived_drop::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:40:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `derived_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:38:22
- |
-LL | let g = move || match drop($name::Client::default()) {
- | ------------------------ has type `derived_drop::Client` which is not `Send`
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `significant_drop::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:40:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `significant_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:38:22
- |
-LL | let g = move || match drop($name::Client::default()) {
- | ------------------------ has type `significant_drop::Client` which is not `Send`
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `insignificant_dtor::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:40:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:38:22
- |
-LL | let g = move || match drop($name::Client::default()) {
- | ------------------------ has type `insignificant_dtor::Client` which is not `Send`
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: aborting due to 8 previous errors
-
diff --git a/tests/ui/generator/parent-expression.rs b/tests/ui/generator/parent-expression.rs
index 239034e3d..198b14528 100644
--- a/tests/ui/generator/parent-expression.rs
+++ b/tests/ui/generator/parent-expression.rs
@@ -1,7 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-
#![feature(generators, negative_impls, rustc_attrs)]
macro_rules! type_combinations {
@@ -28,7 +24,6 @@ macro_rules! type_combinations {
//~^ ERROR cannot be sent between threads
//~| ERROR cannot be sent between threads
//~| ERROR cannot be sent between threads
- //[no_drop_tracking]~^^^^ ERROR cannot be sent between threads
}
// Simple owned value. This works because the Client is considered moved into `drop`,
@@ -38,10 +33,6 @@ macro_rules! type_combinations {
_ => yield,
};
assert_send(g);
- //[no_drop_tracking]~^ ERROR cannot be sent between threads
- //[no_drop_tracking]~| ERROR cannot be sent between threads
- //[no_drop_tracking]~| ERROR cannot be sent between threads
- //[no_drop_tracking]~| ERROR cannot be sent between threads
}
)* }
}
diff --git a/tests/ui/generator/parent-expression.drop_tracking_mir.stderr b/tests/ui/generator/parent-expression.stderr
index bf8144564..25a3b051b 100644
--- a/tests/ui/generator/parent-expression.drop_tracking_mir.stderr
+++ b/tests/ui/generator/parent-expression.stderr
@@ -1,5 +1,5 @@
error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:27:13
+ --> $DIR/parent-expression.rs:23:13
|
LL | assert_send(g);
| ^^^^^^^^^^^ generator is not `Send`
@@ -13,9 +13,9 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client`
+ = help: within `{generator@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `derived_drop::Client`
note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:25:22
+ --> $DIR/parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
| ------------------------ has type `derived_drop::Client` which is not `Send`
@@ -32,14 +32,14 @@ LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
+ --> $DIR/parent-expression.rs:40:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:27:13
+ --> $DIR/parent-expression.rs:23:13
|
LL | assert_send(g);
| ^^^^^^^^^^^ generator is not `Send`
@@ -53,9 +53,9 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client`
+ = help: within `{generator@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `significant_drop::Client`
note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:25:22
+ --> $DIR/parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
| ------------------------ has type `significant_drop::Client` which is not `Send`
@@ -72,14 +72,14 @@ LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
+ --> $DIR/parent-expression.rs:40:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:27:13
+ --> $DIR/parent-expression.rs:23:13
|
LL | assert_send(g);
| ^^^^^^^^^^^ generator is not `Send`
@@ -93,9 +93,9 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client`
+ = help: within `{generator@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `insignificant_dtor::Client`
note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:25:22
+ --> $DIR/parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
| ------------------------ has type `insignificant_dtor::Client` which is not `Send`
@@ -112,7 +112,7 @@ LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
+ --> $DIR/parent-expression.rs:40:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
diff --git a/tests/ui/generator/partial-drop.drop_tracking.stderr b/tests/ui/generator/partial-drop.drop_tracking.stderr
deleted file mode 100644
index f1b25cb8c..000000000
--- a/tests/ui/generator/partial-drop.drop_tracking.stderr
+++ /dev/null
@@ -1,61 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/partial-drop.rs:17:17
- |
-LL | assert_send(|| {
- | _________________^
-LL | |
-LL | | let guard = Bar { foo: Foo, x: 42 };
-LL | | drop(guard.foo);
-LL | | yield;
-LL | | });
- | |_____^ generator is not `Send`
- |
- = help: within `[generator@$DIR/partial-drop.rs:17:17: 17:19]`, the trait `Send` is not implemented for `Foo`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/partial-drop.rs:21:9
- |
-LL | let guard = Bar { foo: Foo, x: 42 };
- | ----- has type `Bar` which is not `Send`
-LL | drop(guard.foo);
-LL | yield;
- | ^^^^^ yield occurs here, with `guard` maybe used later
-LL | });
- | - `guard` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/partial-drop.rs:33:19
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: generator cannot be sent between threads safely
- --> $DIR/partial-drop.rs:24:17
- |
-LL | assert_send(|| {
- | _________________^
-LL | |
-LL | | let guard = Bar { foo: Foo, x: 42 };
-LL | | let Bar { foo, x } = guard;
-LL | | drop(foo);
-LL | | yield;
-LL | | });
- | |_____^ generator is not `Send`
- |
- = help: within `[generator@$DIR/partial-drop.rs:24:17: 24:19]`, the trait `Send` is not implemented for `Foo`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/partial-drop.rs:29:9
- |
-LL | let guard = Bar { foo: Foo, x: 42 };
- | ----- has type `Bar` which is not `Send`
-...
-LL | yield;
- | ^^^^^ yield occurs here, with `guard` maybe used later
-LL | });
- | - `guard` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/partial-drop.rs:33:19
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/generator/partial-drop.no_drop_tracking.stderr b/tests/ui/generator/partial-drop.no_drop_tracking.stderr
deleted file mode 100644
index 91152b5ea..000000000
--- a/tests/ui/generator/partial-drop.no_drop_tracking.stderr
+++ /dev/null
@@ -1,61 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/partial-drop.rs:17:17
- |
-LL | assert_send(|| {
- | _________________^
-LL | |
-LL | | let guard = Bar { foo: Foo, x: 42 };
-LL | | drop(guard.foo);
-LL | | yield;
-LL | | });
- | |_____^ generator is not `Send`
- |
- = help: within `[generator@$DIR/partial-drop.rs:17:17: 17:19]`, the trait `Send` is not implemented for `Foo`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/partial-drop.rs:21:9
- |
-LL | let guard = Bar { foo: Foo, x: 42 };
- | ----- has type `Bar` which is not `Send`
-LL | drop(guard.foo);
-LL | yield;
- | ^^^^^ yield occurs here, with `guard` maybe used later
-LL | });
- | - `guard` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/partial-drop.rs:33:19
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: generator cannot be sent between threads safely
- --> $DIR/partial-drop.rs:24:17
- |
-LL | assert_send(|| {
- | _________________^
-LL | |
-LL | | let guard = Bar { foo: Foo, x: 42 };
-LL | | let Bar { foo, x } = guard;
-LL | | drop(foo);
-LL | | yield;
-LL | | });
- | |_____^ generator is not `Send`
- |
- = help: within `[generator@$DIR/partial-drop.rs:24:17: 24:19]`, the trait `Send` is not implemented for `Foo`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/partial-drop.rs:29:9
- |
-LL | let Bar { foo, x } = guard;
- | --- has type `Foo` which is not `Send`
-LL | drop(foo);
-LL | yield;
- | ^^^^^ yield occurs here, with `foo` maybe used later
-LL | });
- | - `foo` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/partial-drop.rs:33:19
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/generator/partial-drop.rs b/tests/ui/generator/partial-drop.rs
index 1d3ae075d..868f36adc 100644
--- a/tests/ui/generator/partial-drop.rs
+++ b/tests/ui/generator/partial-drop.rs
@@ -1,8 +1,4 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-// [drop_tracking_mir] check-pass
-
+// check-pass
#![feature(negative_impls, generators)]
struct Foo;
@@ -15,14 +11,19 @@ struct Bar {
fn main() {
assert_send(|| {
- //[no_drop_tracking,drop_tracking]~^ ERROR generator cannot be sent between threads safely
let guard = Bar { foo: Foo, x: 42 };
drop(guard.foo);
yield;
});
assert_send(|| {
- //[no_drop_tracking,drop_tracking]~^ ERROR generator cannot be sent between threads safely
+ let mut guard = Bar { foo: Foo, x: 42 };
+ drop(guard);
+ guard = Bar { foo: Foo, x: 23 };
+ yield;
+ });
+
+ assert_send(|| {
let guard = Bar { foo: Foo, x: 42 };
let Bar { foo, x } = guard;
drop(foo);
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
deleted file mode 100644
index 429b202f6..000000000
--- a/tests/ui/generator/print/generator-print-verbose-1.drop_tracking.stderr
+++ /dev/null
@@ -1,64 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/generator-print-verbose-1.rs:40:18
- |
-LL | require_send(send_gen);
- | ^^^^^^^^ generator is not `Send`
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
-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[7d1d]::make_non_send_generator::{opaque#0}), [])` which is not `Send`
-LL | yield;
- | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
-LL | };
- | - `_non_send_gen` is later dropped here
-note: required by a bound in `require_send`
- --> $DIR/generator-print-verbose-1.rs:29:25
- |
-LL | fn require_send(_: impl Send) {}
- | ^^^^ required by this bound in `require_send`
-
-error[E0277]: `RefCell<i32>` cannot be shared between threads safely
- --> $DIR/generator-print-verbose-1.rs:59:18
- |
-LL | require_send(send_gen);
- | ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
- | |
- | required by a bound introduced by this call
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
- = note: required for `Arc<RefCell<i32>>` to implement `Send`
-note: required because it's used within this generator
- --> $DIR/generator-print-verbose-1.rs:45:5
- |
-LL | || {
- | ^^
-note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[7d1d]::make_gen2::{opaque#0}), [Arc<RefCell<i32>>])`
- --> $DIR/generator-print-verbose-1.rs:44:30
- |
-LL | pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-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<Return = Arc<RefCell<i32>>> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = 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
- |
-LL | let send_gen = || {
- | ^^
-note: required by a bound in `require_send`
- --> $DIR/generator-print-verbose-1.rs:29:25
- |
-LL | fn require_send(_: impl Send) {}
- | ^^^^ required by this bound in `require_send`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
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
deleted file mode 100644
index 429b202f6..000000000
--- a/tests/ui/generator/print/generator-print-verbose-1.no_drop_tracking.stderr
+++ /dev/null
@@ -1,64 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/generator-print-verbose-1.rs:40:18
- |
-LL | require_send(send_gen);
- | ^^^^^^^^ generator is not `Send`
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
-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[7d1d]::make_non_send_generator::{opaque#0}), [])` which is not `Send`
-LL | yield;
- | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
-LL | };
- | - `_non_send_gen` is later dropped here
-note: required by a bound in `require_send`
- --> $DIR/generator-print-verbose-1.rs:29:25
- |
-LL | fn require_send(_: impl Send) {}
- | ^^^^ required by this bound in `require_send`
-
-error[E0277]: `RefCell<i32>` cannot be shared between threads safely
- --> $DIR/generator-print-verbose-1.rs:59:18
- |
-LL | require_send(send_gen);
- | ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
- | |
- | required by a bound introduced by this call
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
- = note: required for `Arc<RefCell<i32>>` to implement `Send`
-note: required because it's used within this generator
- --> $DIR/generator-print-verbose-1.rs:45:5
- |
-LL | || {
- | ^^
-note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[7d1d]::make_gen2::{opaque#0}), [Arc<RefCell<i32>>])`
- --> $DIR/generator-print-verbose-1.rs:44:30
- |
-LL | pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-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<Return = Arc<RefCell<i32>>> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = 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
- |
-LL | let send_gen = || {
- | ^^
-note: required by a bound in `require_send`
- --> $DIR/generator-print-verbose-1.rs:29:25
- |
-LL | fn require_send(_: impl Send) {}
- | ^^^^ required by this bound in `require_send`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generator/print/generator-print-verbose-1.rs b/tests/ui/generator/print/generator-print-verbose-1.rs
index c7052c7d1..e52234c08 100644
--- a/tests/ui/generator/print/generator-print-verbose-1.rs
+++ b/tests/ui/generator/print/generator-print-verbose-1.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// compile-flags: -Zverbose
// Same as: tests/ui/generator/issue-68112.stderr
diff --git a/tests/ui/generator/print/generator-print-verbose-1.drop_tracking_mir.stderr b/tests/ui/generator/print/generator-print-verbose-1.stderr
index 01a30fd2f..d949543de 100644
--- a/tests/ui/generator/print/generator-print-verbose-1.drop_tracking_mir.stderr
+++ b/tests/ui/generator/print/generator-print-verbose-1.stderr
@@ -1,5 +1,5 @@
error: generator cannot be sent between threads safely
- --> $DIR/generator-print-verbose-1.rs:40:5
+ --> $DIR/generator-print-verbose-1.rs:37:5
|
LL | require_send(send_gen);
| ^^^^^^^^^^^^ generator is not `Send`
@@ -7,20 +7,20 @@ LL | require_send(send_gen);
= help: the trait `Sync` is not implemented for `RefCell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
note: generator is not `Send` as this value is used across a yield
- --> $DIR/generator-print-verbose-1.rs:38:9
+ --> $DIR/generator-print-verbose-1.rs:35:9
|
LL | let _non_send_gen = make_non_send_generator();
| ------------- 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`
- --> $DIR/generator-print-verbose-1.rs:29:25
+ --> $DIR/generator-print-verbose-1.rs:26:25
|
LL | fn require_send(_: impl Send) {}
| ^^^^ required by this bound in `require_send`
error[E0277]: `RefCell<i32>` cannot be shared between threads safely
- --> $DIR/generator-print-verbose-1.rs:59:5
+ --> $DIR/generator-print-verbose-1.rs:56:5
|
LL | require_send(send_gen);
| ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
@@ -29,28 +29,28 @@ LL | require_send(send_gen);
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
= note: required for `Arc<RefCell<i32>>` to implement `Send`
note: required because it's used within this generator
- --> $DIR/generator-print-verbose-1.rs:45:5
+ --> $DIR/generator-print-verbose-1.rs:42:5
|
LL | || {
| ^^
note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[7d1d]::make_gen2::{opaque#0}), [Arc<RefCell<i32>>])`
- --> $DIR/generator-print-verbose-1.rs:44:30
+ --> $DIR/generator-print-verbose-1.rs:41:30
|
LL | pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
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
+ --> $DIR/generator-print-verbose-1.rs:47:34
|
LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= 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
+ --> $DIR/generator-print-verbose-1.rs:52:20
|
LL | let send_gen = || {
| ^^
note: required by a bound in `require_send`
- --> $DIR/generator-print-verbose-1.rs:29:25
+ --> $DIR/generator-print-verbose-1.rs:26:25
|
LL | fn require_send(_: impl Send) {}
| ^^^^ required by this bound in `require_send`
diff --git a/tests/ui/generator/print/generator-print-verbose-2.drop_tracking.stderr b/tests/ui/generator/print/generator-print-verbose-2.drop_tracking.stderr
deleted file mode 100644
index 1f2e530f6..000000000
--- a/tests/ui/generator/print/generator-print-verbose-2.drop_tracking.stderr
+++ /dev/null
@@ -1,60 +0,0 @@
-error: generator cannot be shared between threads safely
- --> $DIR/generator-print-verbose-2.rs:20:17
- |
-LL | assert_sync(|| {
- | _________________^
-LL | |
-LL | | let a = NotSync;
-LL | | yield;
-LL | | drop(a);
-LL | | });
- | |_____^ generator is not `Sync`
- |
- = help: within `[main::{closure#0} upvar_tys=() {NotSync, ()}]`, the trait `Sync` is not implemented for `NotSync`
-note: generator is not `Sync` as this value is used across a yield
- --> $DIR/generator-print-verbose-2.rs:23:9
- |
-LL | let a = NotSync;
- | - has type `NotSync` which is not `Sync`
-LL | yield;
- | ^^^^^ yield occurs here, with `a` maybe used later
-LL | drop(a);
-LL | });
- | - `a` is later dropped here
-note: required by a bound in `assert_sync`
- --> $DIR/generator-print-verbose-2.rs:17:23
- |
-LL | fn assert_sync<T: Sync>(_: T) {}
- | ^^^^ required by this bound in `assert_sync`
-
-error: generator cannot be sent between threads safely
- --> $DIR/generator-print-verbose-2.rs:27:17
- |
-LL | assert_send(|| {
- | _________________^
-LL | |
-LL | | let a = NotSend;
-LL | | yield;
-LL | | drop(a);
-LL | | });
- | |_____^ generator is not `Send`
- |
- = help: within `[main::{closure#1} upvar_tys=() {NotSend, ()}]`, the trait `Send` is not implemented for `NotSend`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/generator-print-verbose-2.rs:30:9
- |
-LL | let a = NotSend;
- | - has type `NotSend` which is not `Send`
-LL | yield;
- | ^^^^^ yield occurs here, with `a` maybe used later
-LL | drop(a);
-LL | });
- | - `a` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/generator-print-verbose-2.rs:18:23
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/generator/print/generator-print-verbose-2.no_drop_tracking.stderr b/tests/ui/generator/print/generator-print-verbose-2.no_drop_tracking.stderr
deleted file mode 100644
index 1f2e530f6..000000000
--- a/tests/ui/generator/print/generator-print-verbose-2.no_drop_tracking.stderr
+++ /dev/null
@@ -1,60 +0,0 @@
-error: generator cannot be shared between threads safely
- --> $DIR/generator-print-verbose-2.rs:20:17
- |
-LL | assert_sync(|| {
- | _________________^
-LL | |
-LL | | let a = NotSync;
-LL | | yield;
-LL | | drop(a);
-LL | | });
- | |_____^ generator is not `Sync`
- |
- = help: within `[main::{closure#0} upvar_tys=() {NotSync, ()}]`, the trait `Sync` is not implemented for `NotSync`
-note: generator is not `Sync` as this value is used across a yield
- --> $DIR/generator-print-verbose-2.rs:23:9
- |
-LL | let a = NotSync;
- | - has type `NotSync` which is not `Sync`
-LL | yield;
- | ^^^^^ yield occurs here, with `a` maybe used later
-LL | drop(a);
-LL | });
- | - `a` is later dropped here
-note: required by a bound in `assert_sync`
- --> $DIR/generator-print-verbose-2.rs:17:23
- |
-LL | fn assert_sync<T: Sync>(_: T) {}
- | ^^^^ required by this bound in `assert_sync`
-
-error: generator cannot be sent between threads safely
- --> $DIR/generator-print-verbose-2.rs:27:17
- |
-LL | assert_send(|| {
- | _________________^
-LL | |
-LL | | let a = NotSend;
-LL | | yield;
-LL | | drop(a);
-LL | | });
- | |_____^ generator is not `Send`
- |
- = help: within `[main::{closure#1} upvar_tys=() {NotSend, ()}]`, the trait `Send` is not implemented for `NotSend`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/generator-print-verbose-2.rs:30:9
- |
-LL | let a = NotSend;
- | - has type `NotSend` which is not `Send`
-LL | yield;
- | ^^^^^ yield occurs here, with `a` maybe used later
-LL | drop(a);
-LL | });
- | - `a` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/generator-print-verbose-2.rs:18:23
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/generator/print/generator-print-verbose-2.rs b/tests/ui/generator/print/generator-print-verbose-2.rs
index ab29db6e0..e53a7ef8c 100644
--- a/tests/ui/generator/print/generator-print-verbose-2.rs
+++ b/tests/ui/generator/print/generator-print-verbose-2.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// compile-flags: -Zverbose
// Same as test/ui/generator/not-send-sync.rs
diff --git a/tests/ui/generator/print/generator-print-verbose-2.drop_tracking_mir.stderr b/tests/ui/generator/print/generator-print-verbose-2.stderr
index 354369f19..8ff755761 100644
--- a/tests/ui/generator/print/generator-print-verbose-2.drop_tracking_mir.stderr
+++ b/tests/ui/generator/print/generator-print-verbose-2.stderr
@@ -1,39 +1,39 @@
error: generator cannot be shared between threads safely
- --> $DIR/generator-print-verbose-2.rs:20:5
+ --> $DIR/generator-print-verbose-2.rs:17:5
|
LL | assert_sync(|| {
| ^^^^^^^^^^^ generator is not `Sync`
|
- = help: within `[main::{closure#0} upvar_tys=() [main::{closure#0}]]`, the trait `Sync` is not implemented for `NotSync`
+ = help: within `{main::{closure#0} upvar_tys=() {main::{closure#0}}}`, the trait `Sync` is not implemented for `NotSync`
note: generator is not `Sync` as this value is used across a yield
- --> $DIR/generator-print-verbose-2.rs:23:9
+ --> $DIR/generator-print-verbose-2.rs:20:9
|
LL | let a = NotSync;
| - has type `NotSync` which is not `Sync`
LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later
note: required by a bound in `assert_sync`
- --> $DIR/generator-print-verbose-2.rs:17:23
+ --> $DIR/generator-print-verbose-2.rs:14:23
|
LL | fn assert_sync<T: Sync>(_: T) {}
| ^^^^ required by this bound in `assert_sync`
error: generator cannot be sent between threads safely
- --> $DIR/generator-print-verbose-2.rs:27:5
+ --> $DIR/generator-print-verbose-2.rs:24:5
|
LL | assert_send(|| {
| ^^^^^^^^^^^ generator is not `Send`
|
- = help: within `[main::{closure#1} upvar_tys=() [main::{closure#1}]]`, the trait `Send` is not implemented for `NotSend`
+ = help: within `{main::{closure#1} upvar_tys=() {main::{closure#1}}}`, the trait `Send` is not implemented for `NotSend`
note: generator is not `Send` as this value is used across a yield
- --> $DIR/generator-print-verbose-2.rs:30:9
+ --> $DIR/generator-print-verbose-2.rs:27:9
|
LL | let a = NotSend;
| - has type `NotSend` which is not `Send`
LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later
note: required by a bound in `assert_send`
- --> $DIR/generator-print-verbose-2.rs:18:23
+ --> $DIR/generator-print-verbose-2.rs:15:23
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
diff --git a/tests/ui/generator/print/generator-print-verbose-3.stderr b/tests/ui/generator/print/generator-print-verbose-3.stderr
index d15646259..69358ed0a 100644
--- a/tests/ui/generator/print/generator-print-verbose-3.stderr
+++ b/tests/ui/generator/print/generator-print-verbose-3.stderr
@@ -12,7 +12,7 @@ LL | | };
| |_____^ expected `()`, found generator
|
= note: expected unit type `()`
- found generator `[main::{closure#0} upvar_tys=(unavailable)]`
+ found generator `{main::{closure#0} upvar_tys=(unavailable)}`
error: aborting due to previous error
diff --git a/tests/ui/generator/ref-upvar-not-send.stderr b/tests/ui/generator/ref-upvar-not-send.stderr
index 689ace67e..d6a2be977 100644
--- a/tests/ui/generator/ref-upvar-not-send.stderr
+++ b/tests/ui/generator/ref-upvar-not-send.stderr
@@ -34,7 +34,7 @@ LL | | let _y = y;
LL | | });
| |_____^ generator is not `Send`
|
- = help: within `[generator@$DIR/ref-upvar-not-send.rs:23:17: 23:24]`, the trait `Send` is not implemented for `*mut ()`
+ = help: within `{generator@$DIR/ref-upvar-not-send.rs:23:17: 23:24}`, the trait `Send` is not implemented for `*mut ()`
note: captured value is not `Send` because `&mut` references cannot be sent unless their referent is `Send`
--> $DIR/ref-upvar-not-send.rs:27:18
|
diff --git a/tests/ui/generator/retain-resume-ref.drop_tracking.stderr b/tests/ui/generator/retain-resume-ref.drop_tracking.stderr
deleted file mode 100644
index 7122a951e..000000000
--- a/tests/ui/generator/retain-resume-ref.drop_tracking.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0499]: cannot borrow `thing` as mutable more than once at a time
- --> $DIR/retain-resume-ref.rs:27:25
- |
-LL | gen.as_mut().resume(&mut thing);
- | ---------- first mutable borrow occurs here
-LL | gen.as_mut().resume(&mut thing);
- | ------ ^^^^^^^^^^ second mutable borrow occurs here
- | |
- | first borrow later used by call
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/tests/ui/generator/retain-resume-ref.drop_tracking_mir.stderr b/tests/ui/generator/retain-resume-ref.drop_tracking_mir.stderr
deleted file mode 100644
index 736ed1fb6..000000000
--- a/tests/ui/generator/retain-resume-ref.drop_tracking_mir.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0499]: cannot borrow `thing` as mutable more than once at a time
- --> $DIR/retain-resume-ref.rs:27:25
- |
-LL | gen.as_mut().resume(&mut thing);
- | ---------- first mutable borrow occurs here
-LL | gen.as_mut().resume(&mut thing);
- | ^^^^^^^^^^ second mutable borrow occurs here
-LL |
-LL | }
- | - first borrow might be used here, when `gen` is dropped and runs the destructor for generator
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/tests/ui/generator/retain-resume-ref.rs b/tests/ui/generator/retain-resume-ref.rs
index 0050d98d0..0606ea71c 100644
--- a/tests/ui/generator/retain-resume-ref.rs
+++ b/tests/ui/generator/retain-resume-ref.rs
@@ -1,7 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-
//! This test ensures that a mutable reference cannot be passed as a resume argument twice.
#![feature(generators, generator_trait)]
diff --git a/tests/ui/generator/retain-resume-ref.no_drop_tracking.stderr b/tests/ui/generator/retain-resume-ref.stderr
index 7122a951e..e33310d12 100644
--- a/tests/ui/generator/retain-resume-ref.no_drop_tracking.stderr
+++ b/tests/ui/generator/retain-resume-ref.stderr
@@ -1,5 +1,5 @@
error[E0499]: cannot borrow `thing` as mutable more than once at a time
- --> $DIR/retain-resume-ref.rs:27:25
+ --> $DIR/retain-resume-ref.rs:23:25
|
LL | gen.as_mut().resume(&mut thing);
| ---------- first mutable borrow occurs here
diff --git a/tests/ui/generator/static-mut-reference-across-yield.rs b/tests/ui/generator/static-mut-reference-across-yield.rs
index 4784ff49b..0fa6d9cdc 100644
--- a/tests/ui/generator/static-mut-reference-across-yield.rs
+++ b/tests/ui/generator/static-mut-reference-across-yield.rs
@@ -1,8 +1,6 @@
// build-pass
-// revisions: mir thir drop_tracking drop_tracking_mir
+// revisions: mir thir
// [thir]compile-flags: -Zthir-unsafeck
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
#![feature(generators)]
diff --git a/tests/ui/generator/static-not-unpin.current.stderr b/tests/ui/generator/static-not-unpin.current.stderr
index ecd8ca60c..242489841 100644
--- a/tests/ui/generator/static-not-unpin.current.stderr
+++ b/tests/ui/generator/static-not-unpin.current.stderr
@@ -1,8 +1,8 @@
-error[E0277]: `[static generator@$DIR/static-not-unpin.rs:14:25: 14:34]` cannot be unpinned
+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]`
+ | ------------ ^^^^^^^^^ 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
|
diff --git a/tests/ui/generator/static-not-unpin.next.stderr b/tests/ui/generator/static-not-unpin.next.stderr
index ecd8ca60c..242489841 100644
--- a/tests/ui/generator/static-not-unpin.next.stderr
+++ b/tests/ui/generator/static-not-unpin.next.stderr
@@ -1,8 +1,8 @@
-error[E0277]: `[static generator@$DIR/static-not-unpin.rs:14:25: 14:34]` cannot be unpinned
+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]`
+ | ------------ ^^^^^^^^^ 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
|
diff --git a/tests/ui/generator/type-mismatch-signature-deduction.stderr b/tests/ui/generator/type-mismatch-signature-deduction.stderr
index ef6d896f8..fe1bade55 100644
--- a/tests/ui/generator/type-mismatch-signature-deduction.stderr
+++ b/tests/ui/generator/type-mismatch-signature-deduction.stderr
@@ -18,7 +18,7 @@ LL | Ok(5)
LL | Err(5)
| ++++ +
-error[E0271]: type mismatch resolving `<[generator@$DIR/type-mismatch-signature-deduction.rs:7:5: 7:7] as Generator>::Return == i32`
+error[E0271]: type mismatch resolving `<{generator@$DIR/type-mismatch-signature-deduction.rs:7:5: 7:7} as Generator>::Return == i32`
--> $DIR/type-mismatch-signature-deduction.rs:5:13
|
LL | fn foo() -> impl Generator<Return = i32> {
diff --git a/tests/ui/generator/unresolved-ct-var-drop-tracking.rs b/tests/ui/generator/unresolved-ct-var-drop-tracking.rs
deleted file mode 100644
index a6589348d..000000000
--- a/tests/ui/generator/unresolved-ct-var-drop-tracking.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// incremental
-// edition:2021
-// compile-flags: -Zdrop-tracking
-
-fn main() {
- let _ = async {
- let s = std::array::from_fn(|_| ()).await;
- //~^ ERROR `[(); _]` is not a future
- //~| ERROR type inside `async` block must be known in this context
- //~| ERROR type inside `async` block must be known in this context
- //~| ERROR type inside `async` block must be known in this context
- //~| ERROR type inside `async` block must be known in this context
- //~| ERROR type inside `async` block must be known in this context
- };
-}
diff --git a/tests/ui/generator/unresolved-ct-var-drop-tracking.stderr b/tests/ui/generator/unresolved-ct-var-drop-tracking.stderr
deleted file mode 100644
index dec0141ab..000000000
--- a/tests/ui/generator/unresolved-ct-var-drop-tracking.stderr
+++ /dev/null
@@ -1,78 +0,0 @@
-error[E0277]: `[(); _]` is not a future
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:45
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ----------------------------^^^^^
- | | ||
- | | |`[(); _]` is not a future
- | | help: remove the `.await`
- | this call returns `[(); _]`
- |
- = help: the trait `Future` is not implemented for `[(); _]`
- = note: [(); _] must be a future or must implement `IntoFuture` to be awaited
- = note: required for `[(); _]` to implement `IntoFuture`
-
-error[E0698]: type inside `async` block must be known in this context
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:17
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
- |
-note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:45
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^
-
-error[E0698]: type inside `async` block must be known in this context
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:17
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
- |
-note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:45
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^
-
-error[E0698]: type inside `async` block must be known in this context
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:17
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
- |
-note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:45
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^
-
-error[E0698]: type inside `async` block must be known in this context
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:17
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
- |
-note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:45
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^
-
-error[E0698]: type inside `async` block must be known in this context
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:17
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
- |
-note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:45
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^
-
-error: aborting due to 6 previous errors
-
-Some errors have detailed explanations: E0277, E0698.
-For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/generator/unresolved-ct-var.rs b/tests/ui/generator/unresolved-ct-var.rs
index 0a1570fc2..0316385fb 100644
--- a/tests/ui/generator/unresolved-ct-var.rs
+++ b/tests/ui/generator/unresolved-ct-var.rs
@@ -5,10 +5,5 @@ fn main() {
let _ = async {
let s = std::array::from_fn(|_| ()).await;
//~^ ERROR `[(); _]` is not a future
- //~| ERROR type inside `async` block must be known in this context
- //~| ERROR type inside `async` block must be known in this context
- //~| ERROR type inside `async` block must be known in this context
- //~| ERROR type inside `async` block must be known in this context
- //~| ERROR type inside `async` block must be known in this context
};
}
diff --git a/tests/ui/generator/unresolved-ct-var.stderr b/tests/ui/generator/unresolved-ct-var.stderr
index ace254178..9badc1dc2 100644
--- a/tests/ui/generator/unresolved-ct-var.stderr
+++ b/tests/ui/generator/unresolved-ct-var.stderr
@@ -12,67 +12,6 @@ LL | let s = std::array::from_fn(|_| ()).await;
= note: [(); _] must be a future or must implement `IntoFuture` to be awaited
= note: required for `[(); _]` to implement `IntoFuture`
-error[E0698]: type inside `async` block must be known in this context
- --> $DIR/unresolved-ct-var.rs:6:17
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
- |
-note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var.rs:6:45
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^
-
-error[E0698]: type inside `async` block must be known in this context
- --> $DIR/unresolved-ct-var.rs:6:17
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
- |
-note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var.rs:6:45
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^
-
-error[E0698]: type inside `async` block must be known in this context
- --> $DIR/unresolved-ct-var.rs:6:17
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
- |
-note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var.rs:6:45
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^
-
-error[E0698]: type inside `async` block must be known in this context
- --> $DIR/unresolved-ct-var.rs:6:17
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
- |
-note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var.rs:6:45
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^
-
-error[E0698]: type inside `async` block must be known in this context
- --> $DIR/unresolved-ct-var.rs:6:17
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
- |
-note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var.rs:6:45
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^
-
-error: aborting due to 6 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0277, E0698.
-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/generator/unsized-capture-across-yield.rs b/tests/ui/generator/unsized-capture-across-yield.rs
new file mode 100644
index 000000000..7bcb0800c
--- /dev/null
+++ b/tests/ui/generator/unsized-capture-across-yield.rs
@@ -0,0 +1,22 @@
+#![feature(generator_trait)]
+#![feature(generators)]
+#![feature(unsized_locals)]
+//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
+
+use std::ops::Generator;
+
+fn capture() -> impl Generator {
+ let b: [u8] = *(Box::new([]) as Box<[u8]>);
+ move || {
+ println!("{:?}", &b);
+ //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time
+
+ yield;
+
+ for elem in b.iter() {}
+ }
+}
+
+fn main() {
+ capture();
+}
diff --git a/tests/ui/generator/unsized-capture-across-yield.stderr b/tests/ui/generator/unsized-capture-across-yield.stderr
new file mode 100644
index 000000000..8a5b968a5
--- /dev/null
+++ b/tests/ui/generator/unsized-capture-across-yield.stderr
@@ -0,0 +1,23 @@
+warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/unsized-capture-across-yield.rs:3:12
+ |
+LL | #![feature(unsized_locals)]
+ | ^^^^^^^^^^^^^^
+ |
+ = note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
+ --> $DIR/unsized-capture-across-yield.rs:11:27
+ |
+LL | move || {
+ | -- this closure captures all values by move
+LL | println!("{:?}", &b);
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `[u8]`
+ = note: all values captured by value by a closure must have a statically known size
+
+error: aborting due to previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generator/unsized-local-across-yield.rs b/tests/ui/generator/unsized-local-across-yield.rs
new file mode 100644
index 000000000..f761f45c2
--- /dev/null
+++ b/tests/ui/generator/unsized-local-across-yield.rs
@@ -0,0 +1,21 @@
+#![feature(generator_trait)]
+#![feature(generators)]
+#![feature(unsized_locals)]
+//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
+
+use std::ops::Generator;
+
+fn across() -> impl Generator {
+ move || {
+ let b: [u8] = *(Box::new([]) as Box<[u8]>);
+ //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time
+
+ yield;
+
+ for elem in b.iter() {}
+ }
+}
+
+fn main() {
+ across();
+}
diff --git a/tests/ui/generator/unsized-local-across-yield.stderr b/tests/ui/generator/unsized-local-across-yield.stderr
new file mode 100644
index 000000000..1942f266e
--- /dev/null
+++ b/tests/ui/generator/unsized-local-across-yield.stderr
@@ -0,0 +1,21 @@
+warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/unsized-local-across-yield.rs:3:12
+ |
+LL | #![feature(unsized_locals)]
+ | ^^^^^^^^^^^^^^
+ |
+ = note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
+ --> $DIR/unsized-local-across-yield.rs:10:13
+ |
+LL | let b: [u8] = *(Box::new([]) as Box<[u8]>);
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `[u8]`
+ = note: all values live across `yield` must have a statically known size
+
+error: aborting due to previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generator/witness-ignore-fake-reads.rs b/tests/ui/generator/witness-ignore-fake-reads.rs
new file mode 100644
index 000000000..ccf9ce8b4
--- /dev/null
+++ b/tests/ui/generator/witness-ignore-fake-reads.rs
@@ -0,0 +1,34 @@
+// check-pass
+// edition: 2021
+
+// regression test for #117059
+struct SendNotSync(*const ());
+unsafe impl Send for SendNotSync {}
+// impl !Sync for SendNotSync {} // automatically disabled
+
+struct Inner {
+ stream: SendNotSync,
+ state: bool,
+}
+
+struct SendSync;
+impl std::ops::Deref for SendSync {
+ type Target = Inner;
+ fn deref(&self) -> &Self::Target {
+ todo!();
+ }
+}
+
+async fn next() {
+ let inner = SendSync;
+ match inner.state {
+ true if false => {}
+ false => async {}.await,
+ _ => {}
+ }
+}
+
+fn is_send<T: Send>(_: T) {}
+fn main() {
+ is_send(next())
+}
diff --git a/tests/ui/generic-associated-types/bugs/issue-100013.stderr b/tests/ui/generic-associated-types/bugs/issue-100013.stderr
index 86dbad84d..93c69422f 100644
--- a/tests/ui/generic-associated-types/bugs/issue-100013.stderr
+++ b/tests/ui/generic-associated-types/bugs/issue-100013.stderr
@@ -7,16 +7,6 @@ LL | | async {}.await; // a yield point
LL | | }
| |_____^
|
-note: the lifetime defined here...
- --> $DIR/issue-100013.rs:16:38
- |
-LL | let x = None::<I::Future<'_, '_>>; // a type referencing GAT
- | ^^
-note: ...must outlive the lifetime defined here
- --> $DIR/issue-100013.rs:16:34
- |
-LL | let x = None::<I::Future<'_, '_>>; // a type referencing GAT
- | ^^
= note: this is a known limitation that will be removed in the future (see issue #100013 <https://github.com/rust-lang/rust/issues/100013> for more information)
error: lifetime bound not satisfied
@@ -28,16 +18,6 @@ LL | | async {}.await; // a yield point
LL | | }
| |_____^
|
-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 `'a` defined here
- --> $DIR/issue-100013.rs:21:10
- |
-LL | fn call2<'a, 'b, I: FutureIterator>() -> impl Send {
- | ^^
= note: this is a known limitation that will be removed in the future (see issue #100013 <https://github.com/rust-lang/rust/issues/100013> for more information)
error: lifetime may not live long enough
@@ -62,16 +42,6 @@ LL | | async {}.await; // a yield point
LL | | }
| |_____^
|
-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 `'a` defined here
- --> $DIR/issue-100013.rs:28:10
- |
-LL | fn call3<'a: 'b, 'b, I: FutureIterator>() -> impl Send {
- | ^^
= note: this is a known limitation that will be removed in the future (see issue #100013 <https://github.com/rust-lang/rust/issues/100013> for more information)
error: aborting due to 4 previous errors
diff --git a/tests/ui/generic-associated-types/bugs/issue-88460.stderr b/tests/ui/generic-associated-types/bugs/issue-88460.stderr
index a2047f103..b9e2c4186 100644
--- a/tests/ui/generic-associated-types/bugs/issue-88460.stderr
+++ b/tests/ui/generic-associated-types/bugs/issue-88460.stderr
@@ -7,6 +7,14 @@ LL | test(Foo);
| required by a bound introduced by this call
|
= help: the trait `Marker` is implemented for `()`
+note: this is a known limitation of the trait solver that will be lifted in the future
+ --> $DIR/issue-88460.rs:28:10
+ |
+LL | test(Foo);
+ | -----^^^-
+ | | |
+ | | the trait solver is unable to infer the generic types that should be inferred from this argument
+ | add turbofish arguments to this call to specify the types manually, even if it's redundant
note: required by a bound in `test`
--> $DIR/issue-88460.rs:15:27
|
diff --git a/tests/ui/generic-associated-types/issue-101020.stderr b/tests/ui/generic-associated-types/issue-101020.stderr
index 5c8db617c..91967fb85 100644
--- a/tests/ui/generic-associated-types/issue-101020.stderr
+++ b/tests/ui/generic-associated-types/issue-101020.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `for<'a> &'a mut (): Foo<&'a mut ()>` is not satis
LL | (&mut EmptyIter).consume(());
| ^^^^^^^ the trait `for<'a> Foo<&'a mut ()>` is not implemented for `&'a mut ()`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-101020.rs:28:1
+ |
+LL | trait Foo<T> {}
+ | ^^^^^^^^^^^^
note: required for `&'a mut ()` to implement `for<'a> FuncInput<'a, &'a mut ()>`
--> $DIR/issue-101020.rs:27:20
|
diff --git a/tests/ui/generic-associated-types/issue-90014-tait.stderr b/tests/ui/generic-associated-types/issue-90014-tait.stderr
index 1dec7edce..b86e2a204 100644
--- a/tests/ui/generic-associated-types/issue-90014-tait.stderr
+++ b/tests/ui/generic-associated-types/issue-90014-tait.stderr
@@ -10,7 +10,7 @@ LL | async { () }
| ^^^^^^^^^^^^ expected future, found `async` block
|
= note: expected opaque type `Foo<'_>::Fut<'a>`
- found `async` block `[async block@$DIR/issue-90014-tait.rs:18:9: 18:21]`
+ found `async` block `{async block@$DIR/issue-90014-tait.rs:18:9: 18:21}`
note: this item must have the opaque type in its signature in order to be able to register hidden types
--> $DIR/issue-90014-tait.rs:17:8
|
diff --git a/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.rs b/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.rs
new file mode 100644
index 000000000..b127b3f6e
--- /dev/null
+++ b/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.rs
@@ -0,0 +1,10 @@
+trait Trait {
+ type P<T: Copy, U: Copy>;
+}
+impl Trait for () {
+ type P<T: Copy, U: Copy> = ();
+}
+fn main() {
+ let _: <() as Trait>::P<String, String>;
+ //~^ ERROR the trait bound `String: Copy` is not satisfied
+}
diff --git a/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.stderr b/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.stderr
new file mode 100644
index 000000000..72a987b4a
--- /dev/null
+++ b/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `String: Copy` is not satisfied
+ --> $DIR/multiple-type-params-with-unmet-bounds.rs:8:29
+ |
+LL | let _: <() as Trait>::P<String, String>;
+ | ^^^^^^ the trait `Copy` is not implemented for `String`
+ |
+note: required by a bound in `Trait::P`
+ --> $DIR/multiple-type-params-with-unmet-bounds.rs:2:15
+ |
+LL | type P<T: Copy, U: Copy>;
+ | ^^^^ required by this bound in `Trait::P`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generic-associated-types/own-bound-span.stderr b/tests/ui/generic-associated-types/own-bound-span.stderr
index 8ab8ea623..4a0566ca7 100644
--- a/tests/ui/generic-associated-types/own-bound-span.stderr
+++ b/tests/ui/generic-associated-types/own-bound-span.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `String: Copy` is not satisfied
- --> $DIR/own-bound-span.rs:14:12
+ --> $DIR/own-bound-span.rs:14:24
|
LL | let _: <S as D>::P<String>;
- | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
+ | ^^^^^^ the trait `Copy` is not implemented for `String`
|
note: required by a bound in `D::P`
--> $DIR/own-bound-span.rs:4:15
diff --git a/tests/ui/generic-const-items/elided-lifetimes.stderr b/tests/ui/generic-const-items/elided-lifetimes.stderr
index 8cd3f9ee7..e7df8ca5c 100644
--- a/tests/ui/generic-const-items/elided-lifetimes.stderr
+++ b/tests/ui/generic-const-items/elided-lifetimes.stderr
@@ -28,7 +28,7 @@ LL | const I<const S: &str>: &str = "";
| ^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 4 previous errors
diff --git a/tests/ui/generic-const-items/unsatisfied-bounds.stderr b/tests/ui/generic-const-items/unsatisfied-bounds.stderr
index 1fda46037..2cee53431 100644
--- a/tests/ui/generic-const-items/unsatisfied-bounds.stderr
+++ b/tests/ui/generic-const-items/unsatisfied-bounds.stderr
@@ -27,10 +27,10 @@ LL | Infallible: From<T>;
| ^^^^^^^ required by this bound in `K`
error[E0277]: the trait bound `Vec<u8>: Copy` is not satisfied
- --> $DIR/unsatisfied-bounds.rs:32:13
+ --> $DIR/unsatisfied-bounds.rs:32:26
|
LL | let _ = <() as Trait<Vec<u8>>>::A;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Vec<u8>`
+ | ^^^^^^^ the trait `Copy` is not implemented for `Vec<u8>`
|
note: required by a bound in `Trait::A`
--> $DIR/unsatisfied-bounds.rs:17:12
diff --git a/tests/ui/generics/issue-83556.rs b/tests/ui/generics/issue-83556.rs
new file mode 100644
index 000000000..7cea1c863
--- /dev/null
+++ b/tests/ui/generics/issue-83556.rs
@@ -0,0 +1,4 @@
+struct Foo<T, 'a>(&'a ());
+//~^ ERROR lifetime parameters must be declared prior to
+
+fn main() {}
diff --git a/tests/ui/generics/issue-83556.stderr b/tests/ui/generics/issue-83556.stderr
new file mode 100644
index 000000000..93affaffe
--- /dev/null
+++ b/tests/ui/generics/issue-83556.stderr
@@ -0,0 +1,8 @@
+error: lifetime parameters must be declared prior to type and const parameters
+ --> $DIR/issue-83556.rs:1:15
+ |
+LL | struct Foo<T, 'a>(&'a ());
+ | ----^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, T>`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/generics/issue-94432-garbage-ice.rs b/tests/ui/generics/issue-94432-garbage-ice.rs
index d0709e2d2..4ddb3a7e9 100644
--- a/tests/ui/generics/issue-94432-garbage-ice.rs
+++ b/tests/ui/generics/issue-94432-garbage-ice.rs
@@ -4,7 +4,7 @@
fn�a<e>(){fn�p(){e}} //~ ERROR unknown start of token: \u{fffd}
//~^ ERROR unknown start of token: \u{fffd}
-//~^^ ERROR can't use generic parameters from outer function [E0401]
+//~^^ ERROR can't use generic parameters from outer item [E0401]
//~^^^ WARN type parameter `e` should have an upper camel case name
fn main(){}
diff --git a/tests/ui/generics/issue-98432.rs b/tests/ui/generics/issue-98432.rs
index 780c50d6f..c31dea76c 100644
--- a/tests/ui/generics/issue-98432.rs
+++ b/tests/ui/generics/issue-98432.rs
@@ -2,7 +2,7 @@ struct Struct<T>(T);
impl<T> Struct<T> {
const CONST: fn() = || {
- struct _Obligation where T:; //~ ERROR can't use generic parameters from outer function
+ struct _Obligation where T:; //~ ERROR can't use generic parameters from outer item
};
}
diff --git a/tests/ui/generics/issue-98432.stderr b/tests/ui/generics/issue-98432.stderr
index c7b5c3361..0736d9410 100644
--- a/tests/ui/generics/issue-98432.stderr
+++ b/tests/ui/generics/issue-98432.stderr
@@ -1,13 +1,13 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-98432.rs:5:34
|
LL | impl<T> Struct<T> {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | const CONST: fn() = || {
LL | struct _Obligation where T:;
- | - ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `<T>`
+ | help: try introducing a local generic parameter here: `<T>`
error: aborting due to previous error
diff --git a/tests/ui/higher-ranked/trait-bounds/future.classic.stderr b/tests/ui/higher-ranked/trait-bounds/future.classic.stderr
index 33c0f7173..ef31b7266 100644
--- a/tests/ui/higher-ranked/trait-bounds/future.classic.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/future.classic.stderr
@@ -1,6 +1,6 @@
error: the compiler unexpectedly panicked. this is a bug.
query stack during panic:
-#0 [evaluate_obligation] evaluating trait selection obligation `for<'a> [async fn body@$DIR/future.rs:32:35: 34:2]: core::future::future::Future`
+#0 [evaluate_obligation] evaluating trait selection obligation `for<'a> {async fn body@$DIR/future.rs:32:35: 34:2}: core::future::future::Future`
#1 [codegen_select_candidate] computing candidate for `<strlen as Trait>`
end of query stack
diff --git a/tests/ui/higher-ranked/trait-bounds/issue-30786.stderr b/tests/ui/higher-ranked/trait-bounds/issue-30786.stderr
index 957082b60..4f9ceb577 100644
--- a/tests/ui/higher-ranked/trait-bounds/issue-30786.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/issue-30786.stderr
@@ -1,4 +1,4 @@
-error[E0599]: the method `filterx` exists for struct `Map<Repeat, [closure@issue-30786.rs:119:27]>`, but its trait bounds were not satisfied
+error[E0599]: the method `filterx` exists for struct `Map<Repeat, {closure@issue-30786.rs:119:27}>`, but its trait bounds were not satisfied
--> $DIR/issue-30786.rs:120:22
|
LL | pub struct Map<S, F> {
@@ -8,18 +8,18 @@ LL | pub struct Map<S, F> {
| doesn't satisfy `_: StreamExt`
...
LL | let filter = map.filterx(|x: &_| true);
- | ^^^^^^^ method cannot be called on `Map<Repeat, [closure@issue-30786.rs:119:27]>` due to unsatisfied trait bounds
+ | ^^^^^^^ method cannot be called on `Map<Repeat, {closure@issue-30786.rs:119:27}>` due to unsatisfied trait bounds
|
note: the following trait bounds were not satisfied:
- `&'a mut &Map<Repeat, [closure@$DIR/issue-30786.rs:119:27: 119:34]>: Stream`
- `&'a mut &mut Map<Repeat, [closure@$DIR/issue-30786.rs:119:27: 119:34]>: Stream`
- `&'a mut Map<Repeat, [closure@$DIR/issue-30786.rs:119:27: 119:34]>: Stream`
+ `&'a mut &Map<Repeat, {closure@$DIR/issue-30786.rs:119:27: 119:34}>: Stream`
+ `&'a mut &mut Map<Repeat, {closure@$DIR/issue-30786.rs:119:27: 119:34}>: Stream`
+ `&'a mut Map<Repeat, {closure@$DIR/issue-30786.rs:119:27: 119:34}>: Stream`
--> $DIR/issue-30786.rs:98:50
|
LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {}
| --------- - ^^^^^^ unsatisfied trait bound introduced here
-error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, fn(&u64) -> &u64 {identity::<u64>}>, [closure@issue-30786.rs:131:30]>`, but its trait bounds were not satisfied
+error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, fn(&u64) -> &u64 {identity::<u64>}>, {closure@issue-30786.rs:131:30}>`, but its trait bounds were not satisfied
--> $DIR/issue-30786.rs:132:24
|
LL | pub struct Filter<S, F> {
@@ -32,9 +32,9 @@ LL | let count = filter.countx();
| ^^^^^^ method cannot be called due to unsatisfied trait bounds
|
note: the following trait bounds were not satisfied:
- `&'a mut &Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:131:30: 131:37]>: Stream`
- `&'a mut &mut Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:131:30: 131:37]>: Stream`
- `&'a mut Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:131:30: 131:37]>: Stream`
+ `&'a mut &Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, {closure@$DIR/issue-30786.rs:131:30: 131:37}>: Stream`
+ `&'a mut &mut Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, {closure@$DIR/issue-30786.rs:131:30: 131:37}>: Stream`
+ `&'a mut Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, {closure@$DIR/issue-30786.rs:131:30: 131:37}>: Stream`
--> $DIR/issue-30786.rs:98:50
|
LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {}
diff --git a/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr b/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr
index c01ab8e34..28c259be3 100644
--- a/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr
@@ -4,7 +4,7 @@ error: higher-ranked lifetime error
LL | v.t(|| {});
| ^^^^^^^^^^
|
- = note: could not prove `[closure@$DIR/issue-59311.rs:17:9: 17:11] well-formed`
+ = note: could not prove `{closure@$DIR/issue-59311.rs:17:9: 17:11} well-formed`
error: higher-ranked lifetime error
--> $DIR/issue-59311.rs:17:9
diff --git a/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.stderr b/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.stderr
index 4d470ae70..74610b55d 100644
--- a/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.stderr
@@ -1,4 +1,4 @@
-error[E0271]: type mismatch resolving `<L<[closure@issue-62203-hrtb-ice.rs:42:16]> as T0<'r, (&u8,)>>::O == <_ as Ty<'r>>::V`
+error[E0271]: type mismatch resolving `<L<{closure@issue-62203-hrtb-ice.rs:42:16}> as T0<'r, (&u8,)>>::O == <_ as Ty<'r>>::V`
--> $DIR/issue-62203-hrtb-ice.rs:39:9
|
LL | let v = Unit2.m(
@@ -10,7 +10,7 @@ LL | | f: |x| {
... |
LL | | },
LL | | },
- | |_________^ type mismatch resolving `<L<[closure@issue-62203-hrtb-ice.rs:42:16]> as T0<'r, (&u8,)>>::O == <_ as Ty<'r>>::V`
+ | |_________^ type mismatch resolving `<L<{closure@issue-62203-hrtb-ice.rs:42:16}> as T0<'r, (&u8,)>>::O == <_ as Ty<'r>>::V`
|
note: expected this to be `<_ as Ty<'_>>::V`
--> $DIR/issue-62203-hrtb-ice.rs:21:14
@@ -30,7 +30,7 @@ LL | where
LL | F: for<'r> T0<'r, (<Self as Ty<'r>>::V,), O = <B as Ty<'r>>::V>,
| ^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m`
-error[E0271]: expected `[closure@issue-62203-hrtb-ice.rs:42:16]` to be a closure that returns `Unit3`, but it returns `Unit4`
+error[E0271]: expected `{closure@issue-62203-hrtb-ice.rs:42:16}` to be a closure that returns `Unit3`, but it returns `Unit4`
--> $DIR/issue-62203-hrtb-ice.rs:39:9
|
LL | let v = Unit2.m(
@@ -44,7 +44,7 @@ LL | | },
LL | | },
| |_________^ expected `Unit3`, found `Unit4`
|
-note: required for `L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:16: 42:19]>` to implement `for<'r> T0<'r, (&'r u8,)>`
+note: required for `L<{closure@$DIR/issue-62203-hrtb-ice.rs:42:16: 42:19}>` to implement `for<'r> T0<'r, (&'r u8,)>`
--> $DIR/issue-62203-hrtb-ice.rs:17:16
|
LL | impl<'a, A, T> T0<'a, A> for L<T>
diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr
index b30dd36d2..2cc2bb2bb 100644
--- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr
@@ -8,6 +8,14 @@ LL | call(f, ());
|
= note: expected a closure with arguments `((),)`
found a closure with arguments `(<_ as ATC<'a>>::Type,)`
+note: this is a known limitation of the trait solver that will be lifted in the future
+ --> $DIR/issue-62529-3.rs:25:14
+ |
+LL | call(f, ());
+ | -----^-----
+ | | |
+ | | the trait solver is unable to infer the generic types that should be inferred from this argument
+ | add turbofish arguments to this call to specify the types manually, even if it's redundant
note: required by a bound in `call`
--> $DIR/issue-62529-3.rs:9:36
|
diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr
index edef6ccd3..7fe803550 100644
--- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied
LL | C: StackContext,
| ^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-89118.rs:1:1
+ |
+LL | trait BufferMut {}
+ | ^^^^^^^^^^^^^^^
note: required for `Ctx<()>` to implement `for<'a> BufferUdpStateContext<&'a ()>`
--> $DIR/issue-89118.rs:5:23
|
@@ -26,6 +31,11 @@ error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied
LL | impl<C> EthernetWorker<C> {}
| ^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-89118.rs:1:1
+ |
+LL | trait BufferMut {}
+ | ^^^^^^^^^^^^^^^
note: required for `Ctx<()>` to implement `for<'a> BufferUdpStateContext<&'a ()>`
--> $DIR/issue-89118.rs:5:23
|
@@ -48,6 +58,11 @@ error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied
LL | type Handler = Ctx<C::Dispatcher>;
| ^^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-89118.rs:1:1
+ |
+LL | trait BufferMut {}
+ | ^^^^^^^^^^^^^^^
note: required for `Ctx<()>` to implement `for<'a> BufferUdpStateContext<&'a ()>`
--> $DIR/issue-89118.rs:5:23
|
diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-90950.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-90950.stderr
index 5be33bccd..55eaef786 100644
--- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-90950.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-90950.stderr
@@ -7,6 +7,14 @@ LL | upcast(y)
| required by a bound introduced by this call
|
= help: the trait `IsCovariant<'a>` is implemented for `std::borrow::Cow<'a, T>`
+note: this is a known limitation of the trait solver that will be lifted in the future
+ --> $DIR/issue-90950.rs:50:12
+ |
+LL | upcast(y)
+ | -------^-
+ | | |
+ | | the trait solver is unable to infer the generic types that should be inferred from this argument
+ | add turbofish arguments to this call to specify the types manually, even if it's redundant
note: required by a bound in `upcast`
--> $DIR/issue-90950.rs:27:42
|
diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr
index 73388a725..081dbb67d 100644
--- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `for<'a> <_ as Trait<'a>>::Out: Copy` is not satis
LL | let _: () = weird_bound();
| ^^^^^^^^^^^ the trait `for<'a> Copy` is not implemented for `<_ as Trait<'a>>::Out`
|
+note: this is a known limitation of the trait solver that will be lifted in the future
+ --> $DIR/norm-before-method-resolution.rs:22:17
+ |
+LL | let _: () = weird_bound();
+ | ^^^^^^^^^^^ try adding turbofish arguments to this expression to specify the types manually, even if it's redundant
note: required by a bound in `weird_bound`
--> $DIR/norm-before-method-resolution.rs:18:40
|
diff --git a/tests/ui/impl-trait/auto-trait-leak.rs b/tests/ui/impl-trait/auto-trait-leak.rs
index d71c09879..1f90292f4 100644
--- a/tests/ui/impl-trait/auto-trait-leak.rs
+++ b/tests/ui/impl-trait/auto-trait-leak.rs
@@ -12,7 +12,6 @@ fn cycle1() -> impl Clone {
//~^ ERROR cycle detected
//~| ERROR cycle detected
send(cycle2().clone());
- //~^ ERROR: cannot check whether the hidden type of opaque type satisfies auto traits
Rc::new(Cell::new(5))
}
diff --git a/tests/ui/impl-trait/auto-trait-leak.stderr b/tests/ui/impl-trait/auto-trait-leak.stderr
index a024cff0b..62341f6de 100644
--- a/tests/ui/impl-trait/auto-trait-leak.stderr
+++ b/tests/ui/impl-trait/auto-trait-leak.stderr
@@ -1,4 +1,4 @@
-error[E0391]: cycle detected when computing type of `cycle1::{opaque#0}`
+error[E0391]: cycle detected when computing type of opaque `cycle1::{opaque#0}`
--> $DIR/auto-trait-leak.rs:11:16
|
LL | fn cycle1() -> impl Clone {
@@ -10,32 +10,26 @@ note: ...which requires type-checking `cycle1`...
LL | send(cycle2().clone());
| ^^^^
= note: ...which requires evaluating trait selection obligation `cycle2::{opaque#0}: core::marker::Send`...
-note: ...which requires computing type of `cycle2::{opaque#0}`...
- --> $DIR/auto-trait-leak.rs:20:16
+note: ...which requires computing type of opaque `cycle2::{opaque#0}`...
+ --> $DIR/auto-trait-leak.rs:19:16
|
LL | fn cycle2() -> impl Clone {
| ^^^^^^^^^^
note: ...which requires type-checking `cycle2`...
- --> $DIR/auto-trait-leak.rs:21:5
+ --> $DIR/auto-trait-leak.rs:20:5
|
LL | send(cycle1().clone());
| ^^^^
= note: ...which requires evaluating trait selection obligation `cycle1::{opaque#0}: core::marker::Send`...
- = note: ...which again requires computing type of `cycle1::{opaque#0}`, completing the cycle
-note: cycle used when checking item types in top-level module
- --> $DIR/auto-trait-leak.rs:1:1
- |
-LL | / use std::cell::Cell;
-LL | | use std::rc::Rc;
-LL | |
-LL | | fn send<T: Send>(_: T) {}
-... |
-LL | | Rc::new(String::from("foo"))
-LL | | }
- | |_^
+ = note: ...which again requires computing type of opaque `cycle1::{opaque#0}`, completing the cycle
+note: cycle used when computing type of `cycle1::{opaque#0}`
+ --> $DIR/auto-trait-leak.rs:11:16
+ |
+LL | fn cycle1() -> impl Clone {
+ | ^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-error[E0391]: cycle detected when computing type of `cycle1::{opaque#0}`
+error[E0391]: cycle detected when computing type of opaque `cycle1::{opaque#0}`
--> $DIR/auto-trait-leak.rs:11:16
|
LL | fn cycle1() -> impl Clone {
@@ -47,32 +41,26 @@ note: ...which requires type-checking `cycle1`...
LL | send(cycle2().clone());
| ^^^^
= note: ...which requires evaluating trait selection obligation `cycle2::{opaque#0}: core::marker::Send`...
-note: ...which requires computing type of `cycle2::{opaque#0}`...
- --> $DIR/auto-trait-leak.rs:20:16
+note: ...which requires computing type of opaque `cycle2::{opaque#0}`...
+ --> $DIR/auto-trait-leak.rs:19:16
|
LL | fn cycle2() -> impl Clone {
| ^^^^^^^^^^
note: ...which requires type-checking `cycle2`...
- --> $DIR/auto-trait-leak.rs:20:1
+ --> $DIR/auto-trait-leak.rs:19:1
|
LL | fn cycle2() -> impl Clone {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: ...which again requires computing type of `cycle1::{opaque#0}`, completing the cycle
-note: cycle used when checking item types in top-level module
- --> $DIR/auto-trait-leak.rs:1:1
- |
-LL | / use std::cell::Cell;
-LL | | use std::rc::Rc;
-LL | |
-LL | | fn send<T: Send>(_: T) {}
-... |
-LL | | Rc::new(String::from("foo"))
-LL | | }
- | |_^
+ = note: ...which again requires computing type of opaque `cycle1::{opaque#0}`, completing the cycle
+note: cycle used when computing type of `cycle1::{opaque#0}`
+ --> $DIR/auto-trait-leak.rs:11:16
+ |
+LL | fn cycle1() -> impl Clone {
+ | ^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: cannot check whether the hidden type of opaque type satisfies auto traits
- --> $DIR/auto-trait-leak.rs:21:10
+ --> $DIR/auto-trait-leak.rs:20:10
|
LL | send(cycle1().clone());
| ---- ^^^^^^^^^^^^^^^^
@@ -85,7 +73,7 @@ note: opaque type is declared here
LL | fn cycle1() -> impl Clone {
| ^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
- --> $DIR/auto-trait-leak.rs:20:4
+ --> $DIR/auto-trait-leak.rs:19:4
|
LL | fn cycle2() -> impl Clone {
| ^^^^^^
@@ -95,30 +83,6 @@ note: required by a bound in `send`
LL | fn send<T: Send>(_: T) {}
| ^^^^ required by this bound in `send`
-error: cannot check whether the hidden type of opaque type satisfies auto traits
- --> $DIR/auto-trait-leak.rs:14:10
- |
-LL | send(cycle2().clone());
- | ---- ^^^^^^^^^^^^^^^^
- | |
- | required by a bound introduced by this call
- |
-note: opaque type is declared here
- --> $DIR/auto-trait-leak.rs:20:16
- |
-LL | fn cycle2() -> impl Clone {
- | ^^^^^^^^^^
-note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
- --> $DIR/auto-trait-leak.rs:11:4
- |
-LL | fn cycle1() -> impl Clone {
- | ^^^^^^
-note: required by a bound in `send`
- --> $DIR/auto-trait-leak.rs:4:12
- |
-LL | fn send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `send`
-
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/impl-trait/bound-normalization-fail.rs b/tests/ui/impl-trait/bound-normalization-fail.rs
index 332959247..566a4a7ad 100644
--- a/tests/ui/impl-trait/bound-normalization-fail.rs
+++ b/tests/ui/impl-trait/bound-normalization-fail.rs
@@ -39,8 +39,7 @@ mod lifetimes {
/// Missing bound constraining `Assoc`, `T::Assoc` can't be normalized further.
fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike<Output = T::Assoc> {
- //~^ ERROR `impl Trait` return type cannot contain a projection or `Self` that references lifetimes from a parent scope
- //~| ERROR: type mismatch
+ //~^ ERROR: type mismatch
Foo(())
}
}
diff --git a/tests/ui/impl-trait/bound-normalization-fail.stderr b/tests/ui/impl-trait/bound-normalization-fail.stderr
index f04a753a0..fcac9ac34 100644
--- a/tests/ui/impl-trait/bound-normalization-fail.stderr
+++ b/tests/ui/impl-trait/bound-normalization-fail.stderr
@@ -19,21 +19,12 @@ help: consider constraining the associated type `<T as impl_trait::Trait>::Assoc
LL | fn foo_fail<T: Trait<Assoc = ()>>() -> impl FooLike<Output = T::Assoc> {
| ++++++++++++
-error[E0658]: `impl Trait` return type cannot contain a projection or `Self` that references lifetimes from a parent scope
- --> $DIR/bound-normalization-fail.rs:41:41
- |
-LL | fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike<Output = T::Assoc> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: see issue #103532 <https://github.com/rust-lang/rust/issues/103532> for more information
- = help: add `#![feature(impl_trait_projections)]` to the crate attributes to enable
-
error[E0271]: type mismatch resolving `<Foo<()> as FooLike>::Output == <T as Trait<'a>>::Assoc`
--> $DIR/bound-normalization-fail.rs:41:41
|
LL | fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike<Output = T::Assoc> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<Foo<()> as FooLike>::Output == <T as Trait<'a>>::Assoc`
-...
+LL |
LL | Foo(())
| ------- return type was inferred to be `Foo<()>` here
|
@@ -49,7 +40,6 @@ help: consider constraining the associated type `<T as lifetimes::Trait<'a>>::As
LL | fn foo2_fail<'a, T: Trait<'a, Assoc = ()>>() -> impl FooLike<Output = T::Assoc> {
| ++++++++++++
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
-Some errors have detailed explanations: E0271, E0658.
-For more information about an error, try `rustc --explain E0271`.
+For more information about this error, try `rustc --explain E0271`.
diff --git a/tests/ui/impl-trait/capture-lifetime-not-in-hir.rs b/tests/ui/impl-trait/capture-lifetime-not-in-hir.rs
new file mode 100644
index 000000000..9c067cb69
--- /dev/null
+++ b/tests/ui/impl-trait/capture-lifetime-not-in-hir.rs
@@ -0,0 +1,21 @@
+#![feature(rustc_attrs)]
+#![rustc_variance_of_opaques]
+
+trait Bar<'a> {
+ type Assoc: From<()>;
+}
+
+fn foo<'a, T: Bar<'a>>() -> impl Into<T::Assoc> {
+ //~^ ERROR [o, o]
+ // captures both T and 'a invariantly
+ ()
+}
+
+fn foo2<'a, T: Bar<'a>>() -> impl Into<T::Assoc> + 'a {
+ //~^ ERROR [o, o, o]
+ // captures both T and 'a invariantly, and also duplicates `'a`
+ // i.e. the opaque looks like `impl Into<<T as Bar<'a>>::Assoc> + 'a_duplicated`
+ ()
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/capture-lifetime-not-in-hir.stderr b/tests/ui/impl-trait/capture-lifetime-not-in-hir.stderr
new file mode 100644
index 000000000..9d52001b0
--- /dev/null
+++ b/tests/ui/impl-trait/capture-lifetime-not-in-hir.stderr
@@ -0,0 +1,14 @@
+error: [o, o]
+ --> $DIR/capture-lifetime-not-in-hir.rs:8:29
+ |
+LL | fn foo<'a, T: Bar<'a>>() -> impl Into<T::Assoc> {
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: [o, o, o]
+ --> $DIR/capture-lifetime-not-in-hir.rs:14:30
+ |
+LL | fn foo2<'a, T: Bar<'a>>() -> impl Into<T::Assoc> + 'a {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/impl-trait/coherence-treats-tait-ambig.rs b/tests/ui/impl-trait/coherence-treats-tait-ambig.rs
index 156a7eb0e..df47208bf 100644
--- a/tests/ui/impl-trait/coherence-treats-tait-ambig.rs
+++ b/tests/ui/impl-trait/coherence-treats-tait-ambig.rs
@@ -1,6 +1,3 @@
-// revisions: current next
-//[next] compile-flags: -Ztrait-solver=next
-
#![feature(type_alias_impl_trait)]
type T = impl Sized;
diff --git a/tests/ui/impl-trait/coherence-treats-tait-ambig.next.stderr b/tests/ui/impl-trait/coherence-treats-tait-ambig.stderr
index 61fed1629..7c69c4bfe 100644
--- a/tests/ui/impl-trait/coherence-treats-tait-ambig.next.stderr
+++ b/tests/ui/impl-trait/coherence-treats-tait-ambig.stderr
@@ -1,5 +1,5 @@
error[E0119]: conflicting implementations of trait `Into<T>` for type `Foo`
- --> $DIR/coherence-treats-tait-ambig.rs:10:1
+ --> $DIR/coherence-treats-tait-ambig.rs:7:1
|
LL | impl Into<T> for Foo {
| ^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/impl-trait/equality-in-canonical-query.clone.stderr b/tests/ui/impl-trait/equality-in-canonical-query.clone.stderr
new file mode 100644
index 000000000..83791f0d3
--- /dev/null
+++ b/tests/ui/impl-trait/equality-in-canonical-query.clone.stderr
@@ -0,0 +1,29 @@
+error: internal compiler error: no errors encountered even though `delay_span_bug` issued
+
+error: internal compiler error: {OpaqueTypeKey { def_id: DefId(rpit::{opaque#0}), args: [] }: OpaqueTypeDecl { hidden_type: OpaqueHiddenType { span: no-location (#0), ty: Alias(Opaque, AliasTy { args: [], def_id: DefId(foo::{opaque#0}) }) } }}
+ |
+ =
+
+
+error: internal compiler error: error performing ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing }, value: ProvePredicate { predicate: Binder { value: ProjectionPredicate(AliasTy { args: [FnDef(DefId(rpit), []), ()], def_id: DefId(ops::function::FnOnce::Output) }, Term::Ty(Alias(Opaque, AliasTy { args: [], def_id: DefId(foo::{opaque#0}) }))), bound_vars: [] } } }
+ --> $DIR/equality-in-canonical-query.rs:19:5
+ |
+LL | same_output(foo, rpit);
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+
+ --> $DIR/equality-in-canonical-query.rs:19:5
+ |
+LL | same_output(foo, rpit);
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+
+
+
+
+
+
+query stack during panic:
+end of query stack
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/impl-trait/equality-in-canonical-query.rs b/tests/ui/impl-trait/equality-in-canonical-query.rs
new file mode 100644
index 000000000..672b1eeea
--- /dev/null
+++ b/tests/ui/impl-trait/equality-in-canonical-query.rs
@@ -0,0 +1,23 @@
+// issue: #116877
+// revisions: sized clone
+//[sized] check-pass
+
+//[clone] known-bug: #108498
+//[clone] failure-status: 101
+//[clone] normalize-stderr-test: "DefId\(.*?\]::" -> "DefId("
+//[clone] normalize-stderr-test: "(?m)note: .*$" -> ""
+//[clone] normalize-stderr-test: "(?m)^ *\d+: .*\n" -> ""
+//[clone] normalize-stderr-test: "(?m)^ *at .*\n" -> ""
+
+#[cfg(sized)] fn rpit() -> impl Sized {}
+#[cfg(clone)] fn rpit() -> impl Clone {}
+
+fn same_output<Out>(_: impl Fn() -> Out, _: impl Fn() -> Out) {}
+
+pub fn foo() -> impl Sized {
+ same_output(rpit, foo);
+ same_output(foo, rpit);
+ rpit()
+}
+
+fn main () {}
diff --git a/tests/ui/impl-trait/feature-self-return-type.rs b/tests/ui/impl-trait/feature-self-return-type.rs
index 51877e9cc..7555df1b2 100644
--- a/tests/ui/impl-trait/feature-self-return-type.rs
+++ b/tests/ui/impl-trait/feature-self-return-type.rs
@@ -1,5 +1,4 @@
// edition:2018
-#![feature(impl_trait_projections)]
// This test checks that we emit the correct borrowck error when `Self` or a projection is used as
// a return type. See #61949 for context.
diff --git a/tests/ui/impl-trait/feature-self-return-type.stderr b/tests/ui/impl-trait/feature-self-return-type.stderr
index b9b8d00ce..e7113a9df 100644
--- a/tests/ui/impl-trait/feature-self-return-type.stderr
+++ b/tests/ui/impl-trait/feature-self-return-type.stderr
@@ -1,5 +1,5 @@
error[E0597]: `bar` does not live long enough
- --> $DIR/feature-self-return-type.rs:23:22
+ --> $DIR/feature-self-return-type.rs:22:22
|
LL | let x = {
| - borrow later stored here
@@ -12,7 +12,7 @@ LL | };
| - `bar` dropped here while still borrowed
error[E0597]: `y` does not live long enough
- --> $DIR/feature-self-return-type.rs:63:17
+ --> $DIR/feature-self-return-type.rs:62:17
|
LL | let x = {
| - borrow later stored here
@@ -25,7 +25,7 @@ LL | };
| - `y` dropped here while still borrowed
error[E0597]: `y` does not live long enough
- --> $DIR/feature-self-return-type.rs:95:17
+ --> $DIR/feature-self-return-type.rs:94:17
|
LL | let x = {
| - borrow later stored here
diff --git a/tests/ui/impl-trait/impl-subtyper.rs b/tests/ui/impl-trait/impl-subtyper.rs
new file mode 100644
index 000000000..2d99cdd4f
--- /dev/null
+++ b/tests/ui/impl-trait/impl-subtyper.rs
@@ -0,0 +1,18 @@
+// check-pass
+
+#![crate_type = "lib"]
+fn checkpoints() -> impl Iterator {
+ Some(()).iter().flat_map(|_| std::iter::once(()))
+}
+
+fn block_checkpoints() -> impl Iterator {
+ checkpoints()
+}
+
+fn iter_raw() -> impl Iterator {
+ let mut iter = block_checkpoints();
+
+ (0..9).map(move |_| {
+ iter.next();
+ })
+}
diff --git a/tests/ui/impl-trait/impl-subtyper2.rs b/tests/ui/impl-trait/impl-subtyper2.rs
new file mode 100644
index 000000000..2e0acbae6
--- /dev/null
+++ b/tests/ui/impl-trait/impl-subtyper2.rs
@@ -0,0 +1,7 @@
+// check-pass
+
+fn ages() -> Option<impl Iterator> {
+ None::<std::slice::Iter<()>>
+}
+
+fn main(){}
diff --git a/tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs b/tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs
new file mode 100644
index 000000000..e62662f2f
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs
@@ -0,0 +1,13 @@
+// compile-flags: --crate-type=lib
+// check-pass
+
+#![feature(return_position_impl_trait_in_trait)]
+#![deny(refining_impl_trait)]
+
+pub trait Tr<T> {
+ fn foo() -> impl for<'a> Tr<&'a Self>;
+}
+
+impl<T> Tr<T> for () {
+ fn foo() -> impl for<'a> Tr<&'a Self> {}
+}
diff --git a/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs b/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs
index cfc2193f6..6e9940211 100644
--- a/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs
+++ b/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs
@@ -1,4 +1,4 @@
-#![feature(return_position_impl_trait_in_trait)]
+#![feature(return_position_impl_trait_in_trait, lint_reasons)]
use std::ops::Deref;
@@ -8,6 +8,7 @@ pub trait Foo {
pub struct Foreign;
impl Foo for Foreign {
+ #[expect(refining_impl_trait)]
fn bar(self) -> &'static () {
&()
}
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs
index ff7ad4bf3..fbbbb8585 100644
--- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs
+++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs
@@ -2,7 +2,7 @@
#![feature(return_position_impl_trait_in_trait)]
-trait Iterable {
+pub trait Iterable {
type Item<'a>
where
Self: 'a;
@@ -17,6 +17,7 @@ impl<'a, I: 'a + Iterable> Iterable for &'a I {
//~^ ERROR impl has stricter requirements than trait
fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> {
+ //~^ WARN impl trait in impl method signature does not match trait method signature
(*self).iter()
}
}
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr
index 106b8a7c8..a5fb338ea 100644
--- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr
+++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr
@@ -12,6 +12,22 @@ help: copy the `where` clause predicates from the trait
LL | where Self: 'b;
| ~~~~~~~~~~~~~~
-error: aborting due to previous error
+warning: impl trait in impl method signature does not match trait method signature
+ --> $DIR/bad-item-bound-within-rpitit.rs:19:28
+ |
+LL | fn iter(&self) -> impl '_ + Iterator<Item = Self::Item<'_>>;
+ | ----------------------------------------- return type from trait method defined here
+...
+LL | fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> {
+ | ^^ this bound is stronger than that defined on the trait
+ |
+ = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
+ = note: `#[warn(refining_impl_trait)]` on by default
+help: replace the return type so that it matches the trait
+ |
+LL | fn iter(&self) -> impl Iterator<Item = <Self as Iterable>::Item<'_>> + '_ {
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0276`.
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 78cff97c6..fc290f11f 100644
--- a/tests/ui/impl-trait/in-trait/deep-match-works.rs
+++ b/tests/ui/impl-trait/in-trait/deep-match-works.rs
@@ -1,15 +1,16 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
+#![feature(return_position_impl_trait_in_trait, lint_reasons)]
#![allow(incomplete_features)]
-struct Wrapper<T>(T);
+pub struct Wrapper<T>(T);
-trait Foo {
+pub trait Foo {
fn bar() -> Wrapper<impl Sized>;
}
impl Foo for () {
+ #[expect(refining_impl_trait)]
fn bar() -> Wrapper<i32> {
Wrapper(0)
}
diff --git a/tests/ui/impl-trait/in-trait/foreign.rs b/tests/ui/impl-trait/in-trait/foreign.rs
index b0c93a029..6285d7786 100644
--- a/tests/ui/impl-trait/in-trait/foreign.rs
+++ b/tests/ui/impl-trait/in-trait/foreign.rs
@@ -1,14 +1,25 @@
// check-pass
// aux-build: rpitit.rs
+#![feature(lint_reasons)]
+
extern crate rpitit;
use rpitit::{Foo, Foreign};
use std::sync::Arc;
// Implement an RPITIT from another crate.
-struct Local;
+pub struct Local;
impl Foo for Local {
+ #[expect(refining_impl_trait)]
+ fn bar(self) -> Arc<String> {
+ Arc::new(String::new())
+ }
+}
+
+struct LocalIgnoreRefining;
+impl Foo for LocalIgnoreRefining {
+ #[deny(refining_impl_trait)]
fn bar(self) -> Arc<String> {
Arc::new(String::new())
}
@@ -23,4 +34,5 @@ fn main() {
let &() = Foreign.bar();
let x: Arc<String> = Local.bar();
+ let x: Arc<String> = LocalIgnoreRefining.bar();
}
diff --git a/tests/ui/impl-trait/in-trait/issue-102140.stderr b/tests/ui/impl-trait/in-trait/issue-102140.stderr
index 5d55b9fa4..18bb63745 100644
--- a/tests/ui/impl-trait/in-trait/issue-102140.stderr
+++ b/tests/ui/impl-trait/in-trait/issue-102140.stderr
@@ -6,7 +6,11 @@ LL | MyTrait::foo(&self)
| |
| required by a bound introduced by this call
|
- = help: the trait `MyTrait` is implemented for `Outer`
+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
diff --git a/tests/ui/impl-trait/in-trait/issue-102571.rs b/tests/ui/impl-trait/in-trait/issue-102571.rs
index 61c91e644..ccb53031c 100644
--- a/tests/ui/impl-trait/in-trait/issue-102571.rs
+++ b/tests/ui/impl-trait/in-trait/issue-102571.rs
@@ -8,14 +8,6 @@ trait Foo {
fn bar(self) -> impl Deref<Target = impl Display + ?Sized>;
}
-struct A;
-
-impl Foo for A {
- fn bar(self) -> &'static str {
- "Hello, world"
- }
-}
-
fn foo<T: Foo>(t: T) {
let () = t.bar();
//~^ ERROR mismatched types
diff --git a/tests/ui/impl-trait/in-trait/issue-102571.stderr b/tests/ui/impl-trait/in-trait/issue-102571.stderr
index 87219941d..594b9ae9c 100644
--- a/tests/ui/impl-trait/in-trait/issue-102571.stderr
+++ b/tests/ui/impl-trait/in-trait/issue-102571.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/issue-102571.rs:20:9
+ --> $DIR/issue-102571.rs:12:9
|
LL | let () = t.bar();
| ^^ ------- this expression has type `impl Deref<Target = impl std::fmt::Display + ?Sized>`
diff --git a/tests/ui/impl-trait/in-trait/lifetime-in-associated-trait-bound.rs b/tests/ui/impl-trait/in-trait/lifetime-in-associated-trait-bound.rs
new file mode 100644
index 000000000..49d36d6c9
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/lifetime-in-associated-trait-bound.rs
@@ -0,0 +1,19 @@
+// check-pass
+
+#![feature(associated_type_bounds, return_position_impl_trait_in_trait)]
+
+trait Trait {
+ type Type;
+
+ fn method(&self) -> impl Trait<Type: '_>;
+}
+
+impl Trait for () {
+ type Type = ();
+
+ fn method(&self) -> impl Trait<Type: '_> {
+ ()
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/nested-rpitit.rs b/tests/ui/impl-trait/in-trait/nested-rpitit.rs
index 65285e3a3..58ba1acaf 100644
--- a/tests/ui/impl-trait/in-trait/nested-rpitit.rs
+++ b/tests/ui/impl-trait/in-trait/nested-rpitit.rs
@@ -1,26 +1,28 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
+#![feature(return_position_impl_trait_in_trait, lint_reasons)]
#![allow(incomplete_features)]
use std::fmt::Display;
use std::ops::Deref;
-trait Foo {
+pub trait Foo {
fn bar(self) -> impl Deref<Target = impl Display + ?Sized>;
}
-struct A;
+pub struct A;
impl Foo for A {
+ #[expect(refining_impl_trait)]
fn bar(self) -> &'static str {
"Hello, world"
}
}
-struct B;
+pub struct B;
impl Foo for B {
+ #[expect(refining_impl_trait)]
fn bar(self) -> Box<i32> {
Box::new(42)
}
diff --git a/tests/ui/impl-trait/in-trait/object-safety-sized.rs b/tests/ui/impl-trait/in-trait/object-safety-sized.rs
new file mode 100644
index 000000000..f221cfbb1
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/object-safety-sized.rs
@@ -0,0 +1,23 @@
+// check-pass
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
+
+#![feature(return_position_impl_trait_in_trait)]
+
+fn main() {
+ let vec: Vec<Box<dyn Trait>> = Vec::new();
+
+ for i in vec {
+ i.fn_2();
+ }
+}
+
+trait OtherTrait {}
+
+trait Trait {
+ fn fn_1(&self) -> impl OtherTrait
+ where
+ Self: Sized;
+
+ fn fn_2(&self) -> bool;
+}
diff --git a/tests/ui/impl-trait/in-trait/object-safety.rs b/tests/ui/impl-trait/in-trait/object-safety.rs
index dd35b9a2d..d1c9fba4e 100644
--- a/tests/ui/impl-trait/in-trait/object-safety.rs
+++ b/tests/ui/impl-trait/in-trait/object-safety.rs
@@ -8,7 +8,7 @@ trait Foo {
}
impl Foo for u32 {
- fn baz(&self) -> u32 {
+ fn baz(&self) -> impl Debug {
32
}
}
@@ -19,4 +19,5 @@ fn main() {
//~| ERROR the trait `Foo` cannot be made into an object
let s = i.baz();
//~^ ERROR the trait `Foo` cannot be made into an object
+ //~| ERROR the trait `Foo` cannot be made into an object
}
diff --git a/tests/ui/impl-trait/in-trait/object-safety.stderr b/tests/ui/impl-trait/in-trait/object-safety.stderr
index 4a3b3b114..0170dc5d0 100644
--- a/tests/ui/impl-trait/in-trait/object-safety.stderr
+++ b/tests/ui/impl-trait/in-trait/object-safety.stderr
@@ -14,6 +14,21 @@ LL | fn baz(&self) -> impl Debug;
= help: consider moving `baz` to another trait
error[E0038]: the trait `Foo` cannot be made into an object
+ --> $DIR/object-safety.rs:20:15
+ |
+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 <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
+ --> $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();
@@ -44,6 +59,6 @@ LL | fn baz(&self) -> impl Debug;
= help: consider moving `baz` to another trait
= note: required for the cast from `Box<u32>` to `Box<dyn Foo>`
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0038`.
diff --git a/tests/ui/impl-trait/in-trait/refine.rs b/tests/ui/impl-trait/in-trait/refine.rs
new file mode 100644
index 000000000..a91f9b3e7
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/refine.rs
@@ -0,0 +1,48 @@
+#![feature(return_position_impl_trait_in_trait, async_fn_in_trait)]
+#![deny(refining_impl_trait)]
+
+pub trait Foo {
+ fn bar() -> impl Sized;
+}
+
+pub struct A;
+impl Foo for A {
+ fn bar() -> impl Copy {}
+ //~^ ERROR impl method signature does not match trait method signature
+}
+
+pub struct B;
+impl Foo for B {
+ fn bar() {}
+ //~^ ERROR impl method signature does not match trait method signature
+}
+
+pub struct C;
+impl Foo for C {
+ fn bar() -> () {}
+ //~^ ERROR impl method signature does not match trait method signature
+}
+
+struct Private;
+impl Foo for Private {
+ fn bar() -> () {}
+}
+
+pub trait Arg<A> {
+ fn bar() -> impl Sized;
+}
+impl Arg<Private> for A {
+ fn bar() -> () {}
+}
+
+pub trait Late {
+ fn bar<'a>(&'a self) -> impl Sized + 'a;
+}
+
+pub struct D;
+impl Late for D {
+ fn bar(&self) -> impl Copy + '_ {}
+ //~^ ERROR impl method signature does not match trait method signature
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/refine.stderr b/tests/ui/impl-trait/in-trait/refine.stderr
new file mode 100644
index 000000000..29aa08e25
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/refine.stderr
@@ -0,0 +1,67 @@
+error: impl trait in impl method signature does not match trait method signature
+ --> $DIR/refine.rs:10:22
+ |
+LL | fn bar() -> impl Sized;
+ | ---------- return type from trait method defined here
+...
+LL | fn bar() -> impl Copy {}
+ | ^^^^ this bound is stronger than that defined on the trait
+ |
+ = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
+note: the lint level is defined here
+ --> $DIR/refine.rs:2:9
+ |
+LL | #![deny(refining_impl_trait)]
+ | ^^^^^^^^^^^^^^^^^^^
+help: replace the return type so that it matches the trait
+ |
+LL | fn bar() -> impl Sized {}
+ | ~~~~~~~~~~
+
+error: impl trait in impl method signature does not match trait method signature
+ --> $DIR/refine.rs:16:5
+ |
+LL | fn bar() -> impl Sized;
+ | ---------- return type from trait method defined here
+...
+LL | fn bar() {}
+ | ^^^^^^^^
+ |
+ = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
+help: replace the return type so that it matches the trait
+ |
+LL | fn bar() -> impl Sized {}
+ | +++++++++++++
+
+error: impl trait in impl method signature does not match trait method signature
+ --> $DIR/refine.rs:22:17
+ |
+LL | fn bar() -> impl Sized;
+ | ---------- return type from trait method defined here
+...
+LL | fn bar() -> () {}
+ | ^^
+ |
+ = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
+help: replace the return type so that it matches the trait
+ |
+LL | fn bar() -> impl Sized {}
+ | ~~~~~~~~~~
+
+error: impl trait in impl method signature does not match trait method signature
+ --> $DIR/refine.rs:44:27
+ |
+LL | fn bar<'a>(&'a self) -> impl Sized + 'a;
+ | --------------- return type from trait method defined here
+...
+LL | fn bar(&self) -> impl Copy + '_ {}
+ | ^^^^ this bound is stronger than that defined on the trait
+ |
+ = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
+help: replace the return type so that it matches the trait
+ |
+LL | fn bar(&self) -> impl Sized + '_ {}
+ | ~~~~~~~~~~~~~~~
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/impl-trait/in-trait/reveal.rs b/tests/ui/impl-trait/in-trait/reveal.rs
index d6ede1cc4..b1b46d75b 100644
--- a/tests/ui/impl-trait/in-trait/reveal.rs
+++ b/tests/ui/impl-trait/in-trait/reveal.rs
@@ -1,13 +1,14 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
+#![feature(return_position_impl_trait_in_trait, lint_reasons)]
#![allow(incomplete_features)]
-trait Foo {
+pub trait Foo {
fn f() -> Box<impl Sized>;
}
impl Foo for () {
+ #[expect(refining_impl_trait)]
fn f() -> Box<String> {
Box::new(String::new())
}
diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs
new file mode 100644
index 000000000..5e14a7f8e
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs
@@ -0,0 +1,26 @@
+#![feature(return_position_impl_trait_in_trait)]
+
+trait Extend {
+ fn extend<'a: 'a>(_: &'a str) -> (impl Sized + 'a, &'static str);
+}
+
+impl Extend for () {
+ fn extend<'a: 'a>(s: &'a str) -> (Option<&'static &'a ()>, &'static str)
+ //~^ ERROR in type `&'static &'a ()`, reference has a longer lifetime than the data it references
+ where
+ 'a: 'static,
+ {
+ (None, s)
+ }
+}
+
+// This indirection is not necessary for reproduction,
+// but it makes this test future-proof against #114936.
+fn extend<T: Extend>(s: &str) -> &'static str {
+ <T as Extend>::extend(s).1
+}
+
+fn main() {
+ let use_after_free = extend::<()>(&String::from("temporary"));
+ println!("{}", use_after_free);
+}
diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr
new file mode 100644
index 000000000..1d947310e
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr
@@ -0,0 +1,16 @@
+error[E0491]: in type `&'static &'a ()`, reference has a longer lifetime than the data it references
+ --> $DIR/rpitit-hidden-types-self-implied-wf-via-param.rs:8:38
+ |
+LL | fn extend<'a: 'a>(s: &'a str) -> (Option<&'static &'a ()>, &'static str)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the pointer is valid for the static lifetime
+note: but the referenced data is only valid for the lifetime `'a` as defined here
+ --> $DIR/rpitit-hidden-types-self-implied-wf-via-param.rs:8:15
+ |
+LL | fn extend<'a: 'a>(s: &'a str) -> (Option<&'static &'a ()>, &'static str)
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0491`.
diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.rs b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.rs
new file mode 100644
index 000000000..c1885af4e
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.rs
@@ -0,0 +1,23 @@
+#![feature(return_position_impl_trait_in_trait)]
+
+trait Extend {
+ fn extend(_: &str) -> (impl Sized + '_, &'static str);
+}
+
+impl Extend for () {
+ fn extend(s: &str) -> (Option<&'static &'_ ()>, &'static str) {
+ //~^ ERROR in type `&'static &()`, reference has a longer lifetime than the data it references
+ (None, s)
+ }
+}
+
+// This indirection is not necessary for reproduction,
+// but it makes this test future-proof against #114936.
+fn extend<T: Extend>(s: &str) -> &'static str {
+ <T as Extend>::extend(s).1
+}
+
+fn main() {
+ let use_after_free = extend::<()>(&String::from("temporary"));
+ println!("{}", use_after_free);
+}
diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr
new file mode 100644
index 000000000..7b63e72ac
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr
@@ -0,0 +1,16 @@
+error[E0491]: in type `&'static &()`, reference has a longer lifetime than the data it references
+ --> $DIR/rpitit-hidden-types-self-implied-wf.rs:8:27
+ |
+LL | fn extend(s: &str) -> (Option<&'static &'_ ()>, &'static str) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the pointer is valid for the static lifetime
+note: but the referenced data is only valid for the anonymous lifetime defined here
+ --> $DIR/rpitit-hidden-types-self-implied-wf.rs:8:18
+ |
+LL | fn extend(s: &str) -> (Option<&'static &'_ ()>, &'static str) {
+ | ^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0491`.
diff --git a/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs b/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs
index 7682884f8..44a2b4303 100644
--- a/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs
+++ b/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs
@@ -1,6 +1,6 @@
// issue: 113903
-#![feature(return_position_impl_trait_in_trait)]
+#![feature(return_position_impl_trait_in_trait, lint_reasons)]
use std::ops::Deref;
@@ -10,6 +10,7 @@ pub trait Tr {
}
impl Tr for () {
+ #[expect(refining_impl_trait)]
fn w() -> &'static () {
&()
}
diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.failure.stderr b/tests/ui/impl-trait/in-trait/signature-mismatch.failure.stderr
new file mode 100644
index 000000000..468cf12f1
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/signature-mismatch.failure.stderr
@@ -0,0 +1,14 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/signature-mismatch.rs:79:10
+ |
+LL | &'a self,
+ | -------- this parameter and the return type are declared with different lifetimes...
+...
+LL | ) -> impl Future<Output = Vec<u8>> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | ...but data from `buff` is returned here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0623`.
diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.rs b/tests/ui/impl-trait/in-trait/signature-mismatch.rs
index 1d63a6f3c..685c0f06e 100644
--- a/tests/ui/impl-trait/in-trait/signature-mismatch.rs
+++ b/tests/ui/impl-trait/in-trait/signature-mismatch.rs
@@ -1,26 +1,36 @@
// edition:2021
+// revisions: success failure
+//[success] check-pass
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
+#![feature(return_position_impl_trait_in_trait, lint_reasons)]
use std::future::Future;
-trait Captures<'a> {}
+pub trait Captures<'a> {}
impl<T> Captures<'_> for T {}
-trait Captures2<'a, 'b> {}
+pub trait Captures2<'a, 'b> {}
impl<T> Captures2<'_, '_> for T {}
pub trait AsyncTrait {
+ #[cfg(success)]
fn async_fn(&self, buff: &[u8]) -> impl Future<Output = Vec<u8>>;
+
+ #[cfg(success)]
fn async_fn_early<'a: 'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>>;
+
+ #[cfg(success)]
fn async_fn_multiple<'a>(&'a self, buff: &[u8])
- -> impl Future<Output = Vec<u8>> + Captures<'a>;
+ -> impl Future<Output = Vec<u8>> + Captures<'a>;
+
+ #[cfg(failure)]
fn async_fn_reduce_outlive<'a, T>(
&'a self,
buff: &[u8],
t: T,
) -> impl Future<Output = Vec<u8>> + 'a;
+
+ #[cfg(success)]
fn async_fn_reduce<'a, T>(
&'a self,
buff: &[u8],
@@ -31,38 +41,52 @@ pub trait AsyncTrait {
pub struct Struct;
impl AsyncTrait for Struct {
+ // Does not capture more lifetimes that trait def'n, since trait def'n
+ // implicitly captures all in-scope lifetimes.
+ #[cfg(success)]
+ #[expect(refining_impl_trait)]
fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a {
- //~^ ERROR return type captures more lifetimes than trait definition
async move { buff.to_vec() }
}
+ // Does not capture more lifetimes that trait def'n, since trait def'n
+ // implicitly captures all in-scope lifetimes.
+ #[cfg(success)]
+ #[expect(refining_impl_trait)]
fn async_fn_early<'a: 'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a {
- //~^ ERROR return type captures more lifetimes than trait definition
async move { buff.to_vec() }
}
+ // Does not capture more lifetimes that trait def'n, since trait def'n
+ // implicitly captures all in-scope lifetimes.
+ #[cfg(success)]
+ #[expect(refining_impl_trait)]
fn async_fn_multiple<'a, 'b>(
&'a self,
buff: &'b [u8],
) -> impl Future<Output = Vec<u8>> + Captures2<'a, 'b> {
- //~^ ERROR return type captures more lifetimes than trait definition
async move { buff.to_vec() }
}
+ // This error message is awkward, but `impl Future<Output = Vec<u8>>`
+ // cannot outlive `'a` (from the trait signature) because it captures
+ // both `T` and `'b`.
+ #[cfg(failure)]
fn async_fn_reduce_outlive<'a, 'b, T>(
&'a self,
buff: &'b [u8],
t: T,
) -> impl Future<Output = Vec<u8>> {
- //~^ ERROR the parameter type `T` may not live long enough
+ //[failure]~^ ERROR lifetime mismatch
async move {
let _t = t;
vec![]
}
}
- // OK: We remove the `Captures<'a>`, providing a guarantee that we don't capture `'a`,
- // but we still fulfill the `Captures<'a>` trait bound.
+ // Does not capture fewer lifetimes that trait def'n (not that it matters),
+ // since impl also captures all in-scope lifetimes.
+ #[cfg(success)]
fn async_fn_reduce<'a, 'b, T>(&'a self, buff: &'b [u8], t: T) -> impl Future<Output = Vec<u8>> {
async move {
let _t = t;
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 616f1ac35..000000000
--- a/tests/ui/impl-trait/in-trait/signature-mismatch.stderr
+++ /dev/null
@@ -1,61 +0,0 @@
-error: return type captures more lifetimes than trait definition
- --> $DIR/signature-mismatch.rs:34:47
- |
-LL | fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a {
- | -- this lifetime was captured ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: hidden type must only reference lifetimes captured by this impl trait
- --> $DIR/signature-mismatch.rs:15:40
- |
-LL | fn async_fn(&self, buff: &[u8]) -> impl Future<Output = Vec<u8>>;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: hidden type inferred to be `impl Future<Output = Vec<u8>> + 'a`
-
-error: return type captures more lifetimes than trait definition
- --> $DIR/signature-mismatch.rs:39:57
- |
-LL | fn async_fn_early<'a: 'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a {
- | -- this lifetime was captured ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: hidden type must only reference lifetimes captured by this impl trait
- --> $DIR/signature-mismatch.rs:16:57
- |
-LL | fn async_fn_early<'a: 'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>>;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: hidden type inferred to be `impl Future<Output = Vec<u8>> + 'a`
-
-error: return type captures more lifetimes than trait definition
- --> $DIR/signature-mismatch.rs:47:10
- |
-LL | fn async_fn_multiple<'a, 'b>(
- | -- this lifetime was captured
-...
-LL | ) -> impl Future<Output = Vec<u8>> + Captures2<'a, 'b> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: hidden type must only reference lifetimes captured by this impl trait
- --> $DIR/signature-mismatch.rs:18:12
- |
-LL | -> impl Future<Output = Vec<u8>> + Captures<'a>;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: hidden type inferred to be `impl Future<Output = Vec<u8>> + Captures2<'a, 'b>`
-
-error[E0309]: the parameter type `T` may not live long enough
- --> $DIR/signature-mismatch.rs:56:10
- |
-LL | ) -> impl Future<Output = Vec<u8>> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `impl Future<Output = Vec<u8>>` will meet its required lifetime bounds...
- |
-note: ...that is required by this bound
- --> $DIR/signature-mismatch.rs:23:42
- |
-LL | ) -> impl Future<Output = Vec<u8>> + 'a;
- | ^^
-help: consider adding an explicit lifetime bound...
- |
-LL | fn async_fn_reduce_outlive<'a, 'b, T: 'a>(
- | ++++
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0309`.
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..41fc28588 100644
--- a/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs
+++ b/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs
@@ -1,10 +1,10 @@
// check-pass
#![feature(specialization)]
-#![feature(return_position_impl_trait_in_trait)]
+#![feature(return_position_impl_trait_in_trait, lint_reasons)]
#![allow(incomplete_features)]
-trait Foo {
+pub trait Foo {
fn bar(&self) -> impl Sized;
}
@@ -12,6 +12,7 @@ impl<U> Foo for U
where
U: Copy,
{
+ #[expect(refining_impl_trait)]
fn bar(&self) -> U {
*self
}
diff --git a/tests/ui/impl-trait/in-trait/success.rs b/tests/ui/impl-trait/in-trait/success.rs
index 4cbe682b4..7d415ea17 100644
--- a/tests/ui/impl-trait/in-trait/success.rs
+++ b/tests/ui/impl-trait/in-trait/success.rs
@@ -1,29 +1,32 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
+#![feature(return_position_impl_trait_in_trait, lint_reasons)]
#![allow(incomplete_features)]
use std::fmt::Display;
-trait Foo {
+pub trait Foo {
fn bar(&self) -> impl Display;
}
impl Foo for i32 {
+ #[expect(refining_impl_trait)]
fn bar(&self) -> i32 {
*self
}
}
impl Foo for &'static str {
+ #[expect(refining_impl_trait)]
fn bar(&self) -> &'static str {
*self
}
}
-struct Yay;
+pub struct Yay;
impl Foo for Yay {
+ #[expect(refining_impl_trait)]
fn bar(&self) -> String {
String::from(":^)")
}
diff --git a/tests/ui/impl-trait/in-trait/variance.rs b/tests/ui/impl-trait/in-trait/variance.rs
new file mode 100644
index 000000000..f8e4ab88c
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/variance.rs
@@ -0,0 +1,20 @@
+#![feature(rustc_attrs, return_position_impl_trait_in_trait)]
+#![allow(internal_features)]
+#![rustc_variance_of_opaques]
+
+trait Captures<'a> {}
+impl<T> Captures<'_> for T {}
+
+trait Foo<'i> {
+ fn implicit_capture_early<'a: 'a>() -> impl Sized {}
+ //~^ [o, *, *, o, o]
+ // Self, 'i, 'a, 'i_duplicated, 'a_duplicated
+
+ fn explicit_capture_early<'a: 'a>() -> impl Sized + Captures<'a> {} //~ [o, *, *, o, o]
+
+ fn implicit_capture_late<'a>(_: &'a ()) -> impl Sized {} //~ [o, *, o, o]
+
+ fn explicit_capture_late<'a>(_: &'a ()) -> impl Sized + Captures<'a> {} //~ [o, *, o, o]
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/variance.stderr b/tests/ui/impl-trait/in-trait/variance.stderr
new file mode 100644
index 000000000..8cae5a92f
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/variance.stderr
@@ -0,0 +1,26 @@
+error: [o, *, *, o, o]
+ --> $DIR/variance.rs:9:44
+ |
+LL | fn implicit_capture_early<'a: 'a>() -> impl Sized {}
+ | ^^^^^^^^^^
+
+error: [o, *, *, o, o]
+ --> $DIR/variance.rs:13:44
+ |
+LL | fn explicit_capture_early<'a: 'a>() -> impl Sized + Captures<'a> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: [o, *, o, o]
+ --> $DIR/variance.rs:15:48
+ |
+LL | fn implicit_capture_late<'a>(_: &'a ()) -> impl Sized {}
+ | ^^^^^^^^^^
+
+error: [o, *, o, o]
+ --> $DIR/variance.rs:17:48
+ |
+LL | fn explicit_capture_late<'a>(_: &'a ()) -> impl Sized + Captures<'a> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/impl-trait/issue-103181-2.rs b/tests/ui/impl-trait/issue-103181-2.rs
index 34deb98be..b43ac4507 100644
--- a/tests/ui/impl-trait/issue-103181-2.rs
+++ b/tests/ui/impl-trait/issue-103181-2.rs
@@ -24,8 +24,6 @@ where
B: Send, // <- a second bound
{
normalize(broken_fut(), ());
- //~^ ERROR: cannot check whether the hidden type of opaque type satisfies auto traits
- //~| ERROR: cannot check whether the hidden type of opaque type satisfies auto traits
}
fn main() {}
diff --git a/tests/ui/impl-trait/issue-103181-2.stderr b/tests/ui/impl-trait/issue-103181-2.stderr
index cb5253ea6..5eb2dd918 100644
--- a/tests/ui/impl-trait/issue-103181-2.stderr
+++ b/tests/ui/impl-trait/issue-103181-2.stderr
@@ -4,61 +4,6 @@ error[E0425]: cannot find value `ident_error` in this scope
LL | ident_error;
| ^^^^^^^^^^^ not found in this scope
-error: cannot check whether the hidden type of opaque type satisfies auto traits
- --> $DIR/issue-103181-2.rs:26:15
- |
-LL | normalize(broken_fut(), ());
- | --------- ^^^^^^^^^^^^
- | |
- | required by a bound introduced by this call
- |
-note: opaque type is declared here
- --> $DIR/issue-103181-2.rs:11:23
- |
-LL | async fn broken_fut() {
- | ^
-note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
- --> $DIR/issue-103181-2.rs:20:10
- |
-LL | async fn iceice<A, B>()
- | ^^^^^^
-note: required for `impl Future<Output = ()>` to implement `SendFuture`
- --> $DIR/issue-103181-2.rs:7:17
- |
-LL | impl<Fut: Send> SendFuture for Fut {
- | ---- ^^^^^^^^^^ ^^^
- | |
- | unsatisfied trait bound introduced here
-note: required by a bound in `normalize`
- --> $DIR/issue-103181-2.rs:18:19
- |
-LL | fn normalize<Fut: SendFuture>(_: Fut, _: Fut::Output) {}
- | ^^^^^^^^^^ required by this bound in `normalize`
-
-error: cannot check whether the hidden type of opaque type satisfies auto traits
- --> $DIR/issue-103181-2.rs:26:5
- |
-LL | normalize(broken_fut(), ());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: opaque type is declared here
- --> $DIR/issue-103181-2.rs:11:23
- |
-LL | async fn broken_fut() {
- | ^
-note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
- --> $DIR/issue-103181-2.rs:20:10
- |
-LL | async fn iceice<A, B>()
- | ^^^^^^
-note: required for `impl Future<Output = ()>` to implement `SendFuture`
- --> $DIR/issue-103181-2.rs:7:17
- |
-LL | impl<Fut: Send> SendFuture for Fut {
- | ---- ^^^^^^^^^^ ^^^
- | |
- | unsatisfied trait bound introduced here
-
-error: aborting due to 3 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/impl-trait/issue-108591.rs b/tests/ui/impl-trait/issue-108591.rs
index 6b9d14941..91ea2e9fb 100644
--- a/tests/ui/impl-trait/issue-108591.rs
+++ b/tests/ui/impl-trait/issue-108591.rs
@@ -13,7 +13,8 @@ impl MyTy<'_> {
}
}
-type Opaque<'a> = impl Sized;
+type Opaque2 = impl Sized;
+type Opaque<'a> = Opaque2;
fn define<'a>() -> Opaque<'a> {}
fn test<'a>() {
diff --git a/tests/ui/impl-trait/issue-108592.rs b/tests/ui/impl-trait/issue-108592.rs
index 58a0ed9bf..953fffc48 100644
--- a/tests/ui/impl-trait/issue-108592.rs
+++ b/tests/ui/impl-trait/issue-108592.rs
@@ -11,7 +11,8 @@ fn test_closure() {
closure(&opaque());
}
-type Opaque<'a> = impl Sized;
+type Opaque2 = impl Sized;
+type Opaque<'a> = Opaque2;
fn define<'a>() -> Opaque<'a> {}
fn test_tait(_: &Opaque<'_>) {
diff --git a/tests/ui/impl-trait/issue-55872-2.drop_tracking.stderr b/tests/ui/impl-trait/issue-55872-2.drop_tracking.stderr
deleted file mode 100644
index 477c964bd..000000000
--- a/tests/ui/impl-trait/issue-55872-2.drop_tracking.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-2.no_drop_tracking.stderr b/tests/ui/impl-trait/issue-55872-2.no_drop_tracking.stderr
deleted file mode 100644
index 477c964bd..000000000
--- a/tests/ui/impl-trait/issue-55872-2.no_drop_tracking.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-2.rs b/tests/ui/impl-trait/issue-55872-2.rs
index 7a5cb3b3d..8a96fdc5c 100644
--- a/tests/ui/impl-trait/issue-55872-2.rs
+++ b/tests/ui/impl-trait/issue-55872-2.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
#![feature(impl_trait_in_assoc_type)]
@@ -16,7 +13,7 @@ impl<S> Bar for S {
fn foo<T>() -> Self::E {
async {}
//~^ ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
- //[drop_tracking_mir]~^^ ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
+ //~| ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
}
}
diff --git a/tests/ui/impl-trait/issue-55872-2.drop_tracking_mir.stderr b/tests/ui/impl-trait/issue-55872-2.stderr
index c14bb5cc9..3e70f1cf8 100644
--- a/tests/ui/impl-trait/issue-55872-2.drop_tracking_mir.stderr
+++ b/tests/ui/impl-trait/issue-55872-2.stderr
@@ -1,11 +1,11 @@
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
+ --> $DIR/issue-55872-2.rs:14:9
|
LL | async {}
| ^^^^^^^^
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
+ --> $DIR/issue-55872-2.rs:14:9
|
LL | async {}
| ^^^^^^^^
diff --git a/tests/ui/impl-trait/issue-55872-3.stderr b/tests/ui/impl-trait/issue-55872-3.stderr
index 827988974..b542b6141 100644
--- a/tests/ui/impl-trait/issue-55872-3.stderr
+++ b/tests/ui/impl-trait/issue-55872-3.stderr
@@ -1,8 +1,8 @@
-error[E0277]: the trait bound `[async block@$DIR/issue-55872-3.rs:15:9: 15:17]: Copy` is not satisfied
+error[E0277]: the trait bound `{async block@$DIR/issue-55872-3.rs:15:9: 15:17}: Copy` is not satisfied
--> $DIR/issue-55872-3.rs:13:20
|
LL | fn foo<T>() -> Self::E {
- | ^^^^^^^ the trait `Copy` is not implemented for `[async block@$DIR/issue-55872-3.rs:15:9: 15:17]`
+ | ^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/issue-55872-3.rs:15:9: 15:17}`
error: aborting due to previous error
diff --git a/tests/ui/impl-trait/issue-86465.rs b/tests/ui/impl-trait/issue-86465.rs
index 8c7b41d73..a79bb6474 100644
--- a/tests/ui/impl-trait/issue-86465.rs
+++ b/tests/ui/impl-trait/issue-86465.rs
@@ -1,10 +1,6 @@
#![feature(type_alias_impl_trait)]
-pub trait Captures<'a> {}
-
-impl<'a, T: ?Sized> Captures<'a> for T {}
-
-type X<'a, 'b> = impl std::fmt::Debug + Captures<'a> + Captures<'b>;
+type X<'a, 'b> = impl std::fmt::Debug;
fn f<'t, 'u>(a: &'t u32, b: &'u u32) -> (X<'t, 'u>, X<'u, 't>) {
(a, a)
diff --git a/tests/ui/impl-trait/issue-86465.stderr b/tests/ui/impl-trait/issue-86465.stderr
index b949b2b42..90d6904ed 100644
--- a/tests/ui/impl-trait/issue-86465.stderr
+++ b/tests/ui/impl-trait/issue-86465.stderr
@@ -1,5 +1,5 @@
error: concrete type differs from previous defining opaque type use
- --> $DIR/issue-86465.rs:10:5
+ --> $DIR/issue-86465.rs:6:5
|
LL | (a, a)
| ^^^^^^
diff --git a/tests/ui/impl-trait/issue-99073.stderr b/tests/ui/impl-trait/issue-99073.stderr
index a8400080e..3c32f1794 100644
--- a/tests/ui/impl-trait/issue-99073.stderr
+++ b/tests/ui/impl-trait/issue-99073.stderr
@@ -10,7 +10,7 @@ error: concrete type differs from previous defining opaque type use
--> $DIR/issue-99073.rs:6:13
|
LL | move || f(fix(&f))
- | ^^^^^^^ expected `[closure@$DIR/issue-99073.rs:6:3: 6:10]`, got `G`
+ | ^^^^^^^ expected `{closure@$DIR/issue-99073.rs:6:3: 6:10}`, got `G`
|
note: previous use here
--> $DIR/issue-99073.rs:5:36
diff --git a/tests/ui/impl-trait/issues/issue-74282.stderr b/tests/ui/impl-trait/issues/issue-74282.stderr
index d43e9fee0..f8e85f7ae 100644
--- a/tests/ui/impl-trait/issues/issue-74282.stderr
+++ b/tests/ui/impl-trait/issues/issue-74282.stderr
@@ -14,7 +14,7 @@ LL | | })
| |_____^ expected opaque type, found closure
|
= note: expected opaque type `Closure`
- found closure `[closure@$DIR/issue-74282.rs:8:15: 8:17]`
+ found closure `{closure@$DIR/issue-74282.rs:8:15: 8:17}`
= note: no two closures, even if identical, have the same type
= help: consider boxing your closure and/or using it as a trait object
note: tuple struct defined here
diff --git a/tests/ui/impl-trait/issues/issue-78722-2.stderr b/tests/ui/impl-trait/issues/issue-78722-2.stderr
index 6db603e77..8817eb7d2 100644
--- a/tests/ui/impl-trait/issues/issue-78722-2.stderr
+++ b/tests/ui/impl-trait/issues/issue-78722-2.stderr
@@ -7,7 +7,7 @@ LL | let f: F = async { 1 };
= note: see issue #85368 <https://github.com/rust-lang/rust/issues/85368> for more information
= help: add `#![feature(const_async_blocks)]` to the crate attributes to enable
-error[E0271]: expected `[async block@$DIR/issue-78722-2.rs:13:13: 13:21]` to be a future that resolves to `u8`, but it resolves to `()`
+error[E0271]: expected `{async block@$DIR/issue-78722-2.rs:13:13: 13:21}` to be a future that resolves to `u8`, but it resolves to `()`
--> $DIR/issue-78722-2.rs:11:30
|
LL | fn concrete_use() -> F {
diff --git a/tests/ui/impl-trait/issues/issue-78722.stderr b/tests/ui/impl-trait/issues/issue-78722.stderr
index 36340a0ba..5ad659697 100644
--- a/tests/ui/impl-trait/issues/issue-78722.stderr
+++ b/tests/ui/impl-trait/issues/issue-78722.stderr
@@ -7,7 +7,7 @@ LL | let f: F = async { 1 };
= note: see issue #85368 <https://github.com/rust-lang/rust/issues/85368> for more information
= help: add `#![feature(const_async_blocks)]` to the crate attributes to enable
-error[E0271]: expected `[async block@$DIR/issue-78722.rs:10:13: 10:21]` to be a future that resolves to `u8`, but it resolves to `()`
+error[E0271]: expected `{async block@$DIR/issue-78722.rs:10:13: 10:21}` to be a future that resolves to `u8`, but it resolves to `()`
--> $DIR/issue-78722.rs:8:30
|
LL | fn concrete_use() -> F {
diff --git a/tests/ui/impl-trait/issues/issue-86800.stderr b/tests/ui/impl-trait/issues/issue-86800.stderr
index facab390d..8228f8ace 100644
--- a/tests/ui/impl-trait/issues/issue-86800.stderr
+++ b/tests/ui/impl-trait/issues/issue-86800.stderr
@@ -7,6 +7,6 @@ LL | type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResu
error: the compiler unexpectedly panicked. this is a bug.
query stack during panic:
-#0 [type_of] computing type of `TransactionFuture::{opaque#0}`
-#1 [check_mod_item_types] checking item types in top-level module
+#0 [type_of_opaque] computing type of opaque `TransactionFuture::{opaque#0}`
+#1 [type_of] computing type of `TransactionFuture::{opaque#0}`
end of query stack
diff --git a/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr b/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr
index 55e3cd950..33b48b1e9 100644
--- a/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr
+++ b/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr
@@ -104,7 +104,7 @@ error[E0700]: hidden type for `impl Fn(&'a u32)` captures lifetime that does not
LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) {
| -- ---------------- opaque type defined here
| |
- | hidden type `[closure@$DIR/must_outlive_least_region_or_bound.rs:38:5: 38:13]` captures the lifetime `'b` as defined here
+ | hidden type `{closure@$DIR/must_outlive_least_region_or_bound.rs:38:5: 38:13}` captures the lifetime `'b` as defined here
LL | move |_| println!("{}", y)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
diff --git a/tests/ui/impl-trait/nested-return-type2-tait2.stderr b/tests/ui/impl-trait/nested-return-type2-tait2.stderr
index b85bb5efd..125262b96 100644
--- a/tests/ui/impl-trait/nested-return-type2-tait2.stderr
+++ b/tests/ui/impl-trait/nested-return-type2-tait2.stderr
@@ -5,7 +5,7 @@ LL | || 42
| ^^^^^ the trait `Duh` is not implemented for `Sendable`
|
= help: the trait `Duh` is implemented for `i32`
-note: required for `[closure@$DIR/nested-return-type2-tait2.rs:27:5: 27:7]` to implement `Trait`
+note: required for `{closure@$DIR/nested-return-type2-tait2.rs:27:5: 27:7}` to implement `Trait`
--> $DIR/nested-return-type2-tait2.rs:14:31
|
LL | impl<R: Duh, F: FnMut() -> R> Trait for F {
diff --git a/tests/ui/impl-trait/nested-return-type2-tait3.stderr b/tests/ui/impl-trait/nested-return-type2-tait3.stderr
index 19fd3c134..c2332b6e4 100644
--- a/tests/ui/impl-trait/nested-return-type2-tait3.stderr
+++ b/tests/ui/impl-trait/nested-return-type2-tait3.stderr
@@ -5,7 +5,7 @@ LL | || 42
| ^^^^^ the trait `Duh` is not implemented for `impl Send`
|
= help: the trait `Duh` is implemented for `i32`
-note: required for `[closure@$DIR/nested-return-type2-tait3.rs:26:5: 26:7]` to implement `Trait`
+note: required for `{closure@$DIR/nested-return-type2-tait3.rs:26:5: 26:7}` to implement `Trait`
--> $DIR/nested-return-type2-tait3.rs:14:31
|
LL | impl<R: Duh, F: FnMut() -> R> Trait for F {
diff --git a/tests/ui/impl-trait/nested-return-type4.stderr b/tests/ui/impl-trait/nested-return-type4.stderr
index 907822ebb..a1e2d227f 100644
--- a/tests/ui/impl-trait/nested-return-type4.stderr
+++ b/tests/ui/impl-trait/nested-return-type4.stderr
@@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Future<Output = impl Sized>` captures lifeti
LL | fn test<'s: 's>(s: &'s str) -> impl std::future::Future<Output = impl Sized> {
| -- --------------------------------------------- opaque type defined here
| |
- | hidden type `[async block@$DIR/nested-return-type4.rs:4:5: 4:31]` captures the lifetime `'s` as defined here
+ | hidden type `{async block@$DIR/nested-return-type4.rs:4:5: 4:31}` captures the lifetime `'s` as defined here
LL | async move { let _s = s; }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
diff --git a/tests/ui/impl-trait/normalize-tait-in-const.stderr b/tests/ui/impl-trait/normalize-tait-in-const.stderr
index 5fbba9a85..ada8fd7fa 100644
--- a/tests/ui/impl-trait/normalize-tait-in-const.stderr
+++ b/tests/ui/impl-trait/normalize-tait-in-const.stderr
@@ -1,25 +1,8 @@
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/normalize-tait-in-const.rs:26:5
- |
-LL | fun(filter_positive());
- | ^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
- |
-LL | const fn with_positive<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct + ~const std::ops::Fn<(&Alias<'_>,)>>(fun: F) {
- | ++++++++++++++++++++++++++++++++++++
-
-error[E0493]: destructor of `F` cannot be evaluated at compile-time
- --> $DIR/normalize-tait-in-const.rs:25:79
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/normalize-tait-in-const.rs:25:42
|
LL | const fn with_positive<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
- | ^^^ the destructor for this type cannot be evaluated in constant functions
-LL | fun(filter_positive());
-LL | }
- | - value is dropped here
+ | ^^^^^^^^^^^^^^^^^
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0015, E0493.
-For more information about an error, try `rustc --explain E0015`.
diff --git a/tests/ui/impl-trait/recursive-generator.rs b/tests/ui/impl-trait/recursive-generator.rs
index e876f0fb4..000af70c4 100644
--- a/tests/ui/impl-trait/recursive-generator.rs
+++ b/tests/ui/impl-trait/recursive-generator.rs
@@ -7,7 +7,6 @@ fn foo() -> impl Generator<Yield = (), Return = ()> {
//~| NOTE recursive opaque type
//~| NOTE in this expansion of desugaring of
|| {
- //~^ NOTE returning here
let mut gen = Box::pin(foo());
//~^ NOTE generator captures itself here
let mut r = gen.as_mut().resume(());
diff --git a/tests/ui/impl-trait/recursive-generator.stderr b/tests/ui/impl-trait/recursive-generator.stderr
index e23fd4b4a..86e193d95 100644
--- a/tests/ui/impl-trait/recursive-generator.stderr
+++ b/tests/ui/impl-trait/recursive-generator.stderr
@@ -1,18 +1,11 @@
error[E0720]: cannot resolve opaque type
--> $DIR/recursive-generator.rs:5:13
|
-LL | fn foo() -> impl Generator<Yield = (), Return = ()> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive opaque type
+LL | fn foo() -> impl Generator<Yield = (), Return = ()> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive opaque type
...
-LL | / || {
-LL | |
-LL | | let mut gen = Box::pin(foo());
- | | ------- generator captures itself here
-LL | |
-... |
-LL | | }
-LL | | }
- | |_____- returning here with type `[generator@$DIR/recursive-generator.rs:9:5: 9:7]`
+LL | let mut gen = Box::pin(foo());
+ | ------- generator captures itself here
error: aborting due to previous error
diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking.stderr b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking.stderr
deleted file mode 100644
index 43118ae38..000000000
--- a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking.stderr
+++ /dev/null
@@ -1,152 +0,0 @@
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:11:22
- |
-LL | fn option(i: i32) -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | if i < 0 { None } else { Some((option(i - 1), i)) }
- | ---- ------------------------ returning here with type `Option<(impl Sized, i32)>`
- | |
- | returning here with type `Option<(impl Sized, i32)>`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:16:15
- |
-LL | fn tuple() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | (tuple(),)
- | ---------- returning here with type `(impl Sized,)`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:21:15
- |
-LL | fn array() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | [array()]
- | --------- returning here with type `[impl Sized; 1]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:26:13
- |
-LL | fn ptr() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | &ptr() as *const _
- | ------------------ returning here with type `*const impl Sized`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:31:16
- |
-LL | fn fn_ptr() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | fn_ptr as fn() -> _
- | ------------------- returning here with type `fn() -> impl Sized`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:36:25
- |
-LL | fn closure_capture() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-...
-LL | / move || {
-LL | | x;
- | | - closure captures itself here
-LL | | }
- | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:39:5: 39:12]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:44:29
- |
-LL | fn closure_ref_capture() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-...
-LL | / move || {
-LL | | &x;
- | | - closure captures itself here
-LL | | }
- | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:47:5: 47:12]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:52:21
- |
-LL | fn closure_sig() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | || closure_sig()
- | ---------------- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:54:5: 54:7]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:57:23
- |
-LL | fn generator_sig() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | || generator_sig()
- | ------------------ returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:59:5: 59:7]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:62:27
- |
-LL | fn generator_capture() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-...
-LL | / move || {
-LL | | yield;
-LL | | x;
- | | - generator captures itself here
-LL | | }
- | |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:65:5: 65:12]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:71:35
- |
-LL | fn substs_change<T: 'static>() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | (substs_change::<&T>(),)
- | ------------------------ returning here with type `(impl Sized,)`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:76:24
- |
-LL | fn generator_hold() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | / move || {
-LL | | let x = generator_hold();
- | | - generator captures itself here
-LL | | yield;
-LL | | x;
-LL | | }
- | |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:78:5: 78:12]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:90:26
- |
-LL | fn mutual_recursion() -> impl Sync {
- | ^^^^^^^^^ recursive opaque type
-LL |
-LL | mutual_recursion_b()
- | -------------------- returning here with type `impl Sized`
-...
-LL | fn mutual_recursion_b() -> impl Sized {
- | ---------- returning this opaque type `impl Sized`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:95:28
- |
-LL | fn mutual_recursion() -> impl Sync {
- | --------- returning this opaque type `impl Sync`
-...
-LL | fn mutual_recursion_b() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | mutual_recursion()
- | ------------------ returning here with type `impl Sync`
-
-error: aborting due to 14 previous errors
-
-For more information about this error, try `rustc --explain E0720`.
diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.no_drop_tracking.stderr b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.no_drop_tracking.stderr
deleted file mode 100644
index 43118ae38..000000000
--- a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.no_drop_tracking.stderr
+++ /dev/null
@@ -1,152 +0,0 @@
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:11:22
- |
-LL | fn option(i: i32) -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | if i < 0 { None } else { Some((option(i - 1), i)) }
- | ---- ------------------------ returning here with type `Option<(impl Sized, i32)>`
- | |
- | returning here with type `Option<(impl Sized, i32)>`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:16:15
- |
-LL | fn tuple() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | (tuple(),)
- | ---------- returning here with type `(impl Sized,)`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:21:15
- |
-LL | fn array() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | [array()]
- | --------- returning here with type `[impl Sized; 1]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:26:13
- |
-LL | fn ptr() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | &ptr() as *const _
- | ------------------ returning here with type `*const impl Sized`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:31:16
- |
-LL | fn fn_ptr() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | fn_ptr as fn() -> _
- | ------------------- returning here with type `fn() -> impl Sized`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:36:25
- |
-LL | fn closure_capture() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-...
-LL | / move || {
-LL | | x;
- | | - closure captures itself here
-LL | | }
- | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:39:5: 39:12]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:44:29
- |
-LL | fn closure_ref_capture() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-...
-LL | / move || {
-LL | | &x;
- | | - closure captures itself here
-LL | | }
- | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:47:5: 47:12]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:52:21
- |
-LL | fn closure_sig() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | || closure_sig()
- | ---------------- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:54:5: 54:7]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:57:23
- |
-LL | fn generator_sig() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | || generator_sig()
- | ------------------ returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:59:5: 59:7]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:62:27
- |
-LL | fn generator_capture() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-...
-LL | / move || {
-LL | | yield;
-LL | | x;
- | | - generator captures itself here
-LL | | }
- | |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:65:5: 65:12]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:71:35
- |
-LL | fn substs_change<T: 'static>() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | (substs_change::<&T>(),)
- | ------------------------ returning here with type `(impl Sized,)`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:76:24
- |
-LL | fn generator_hold() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | / move || {
-LL | | let x = generator_hold();
- | | - generator captures itself here
-LL | | yield;
-LL | | x;
-LL | | }
- | |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:78:5: 78:12]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:90:26
- |
-LL | fn mutual_recursion() -> impl Sync {
- | ^^^^^^^^^ recursive opaque type
-LL |
-LL | mutual_recursion_b()
- | -------------------- returning here with type `impl Sized`
-...
-LL | fn mutual_recursion_b() -> impl Sized {
- | ---------- returning this opaque type `impl Sized`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:95:28
- |
-LL | fn mutual_recursion() -> impl Sync {
- | --------- returning this opaque type `impl Sync`
-...
-LL | fn mutual_recursion_b() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | mutual_recursion()
- | ------------------ returning here with type `impl Sync`
-
-error: aborting due to 14 previous errors
-
-For more information about this error, try `rustc --explain E0720`.
diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs
index 630372e13..ffc0cd9d1 100644
--- a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs
+++ b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs
@@ -1,7 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-
// Test that impl trait does not allow creating recursive types that are
// otherwise forbidden.
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.stderr
index 9c67f17e9..1d919fb52 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.stderr
@@ -1,5 +1,5 @@
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:11:22
+ --> $DIR/recursive-impl-trait-type-indirect.rs:7:22
|
LL | fn option(i: i32) -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
@@ -10,7 +10,7 @@ LL | if i < 0 { None } else { Some((option(i - 1), i)) }
| returning here with type `Option<(impl Sized, i32)>`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:16:15
+ --> $DIR/recursive-impl-trait-type-indirect.rs:12:15
|
LL | fn tuple() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
@@ -19,7 +19,7 @@ LL | (tuple(),)
| ---------- returning here with type `(impl Sized,)`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:21:15
+ --> $DIR/recursive-impl-trait-type-indirect.rs:17:15
|
LL | fn array() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
@@ -28,7 +28,7 @@ LL | [array()]
| --------- returning here with type `[impl Sized; 1]`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:26:13
+ --> $DIR/recursive-impl-trait-type-indirect.rs:22:13
|
LL | fn ptr() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
@@ -37,7 +37,7 @@ LL | &ptr() as *const _
| ------------------ returning here with type `*const impl Sized`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:31:16
+ --> $DIR/recursive-impl-trait-type-indirect.rs:27:16
|
LL | fn fn_ptr() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
@@ -46,7 +46,7 @@ LL | fn_ptr as fn() -> _
| ------------------- returning here with type `fn() -> impl Sized`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:36:25
+ --> $DIR/recursive-impl-trait-type-indirect.rs:32:25
|
LL | fn closure_capture() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
@@ -55,10 +55,10 @@ LL | / move || {
LL | | x;
| | - closure captures itself here
LL | | }
- | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:39:5: 39:12]`
+ | |_____- returning here with type `{closure@$DIR/recursive-impl-trait-type-indirect.rs:35:5: 35:12}`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:44:29
+ --> $DIR/recursive-impl-trait-type-indirect.rs:40:29
|
LL | fn closure_ref_capture() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
@@ -67,28 +67,28 @@ LL | / move || {
LL | | &x;
| | - closure captures itself here
LL | | }
- | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:47:5: 47:12]`
+ | |_____- returning here with type `{closure@$DIR/recursive-impl-trait-type-indirect.rs:43:5: 43:12}`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:52:21
+ --> $DIR/recursive-impl-trait-type-indirect.rs:48:21
|
LL | fn closure_sig() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
LL |
LL | || closure_sig()
- | ---------------- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:54:5: 54:7]`
+ | ---------------- returning here with type `{closure@$DIR/recursive-impl-trait-type-indirect.rs:50:5: 50:7}`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:57:23
+ --> $DIR/recursive-impl-trait-type-indirect.rs:53:23
|
LL | fn generator_sig() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
LL |
LL | || generator_sig()
- | ------------------ returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:59:5: 59:7]`
+ | ------------------ returning here with type `{closure@$DIR/recursive-impl-trait-type-indirect.rs:55:5: 55:7}`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:62:27
+ --> $DIR/recursive-impl-trait-type-indirect.rs:58:27
|
LL | fn generator_capture() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
@@ -98,10 +98,10 @@ LL | | yield;
LL | | x;
| | - generator captures itself here
LL | | }
- | |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:65:5: 65:12]`
+ | |_____- returning here with type `{generator@$DIR/recursive-impl-trait-type-indirect.rs:61:5: 61:12}`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:71:35
+ --> $DIR/recursive-impl-trait-type-indirect.rs:67:35
|
LL | fn substs_change<T: 'static>() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
@@ -110,7 +110,7 @@ LL | (substs_change::<&T>(),)
| ------------------------ returning here with type `(impl Sized,)`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:76:24
+ --> $DIR/recursive-impl-trait-type-indirect.rs:72:24
|
LL | fn generator_hold() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
@@ -119,7 +119,7 @@ LL | let x = generator_hold();
| - generator captures itself here
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:90:26
+ --> $DIR/recursive-impl-trait-type-indirect.rs:86:26
|
LL | fn mutual_recursion() -> impl Sync {
| ^^^^^^^^^ recursive opaque type
@@ -131,7 +131,7 @@ LL | fn mutual_recursion_b() -> impl Sized {
| ---------- returning this opaque type `impl Sized`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:95:28
+ --> $DIR/recursive-impl-trait-type-indirect.rs:91:28
|
LL | fn mutual_recursion() -> impl Sync {
| --------- returning this opaque type `impl Sync`
diff --git a/tests/ui/impl-trait/static-return-lifetime-infered.stderr b/tests/ui/impl-trait/static-return-lifetime-infered.stderr
index 488cb821c..4be244068 100644
--- a/tests/ui/impl-trait/static-return-lifetime-infered.stderr
+++ b/tests/ui/impl-trait/static-return-lifetime-infered.stderr
@@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Iterator<Item = u32>` captures lifetime that
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
| ----- ----------------------- opaque type defined here
| |
- | hidden type `Map<std::slice::Iter<'_, (u32, u32)>, [closure@$DIR/static-return-lifetime-infered.rs:7:27: 7:30]>` captures the anonymous lifetime defined here
+ | hidden type `Map<std::slice::Iter<'_, (u32, u32)>, {closure@$DIR/static-return-lifetime-infered.rs:7:27: 7:30}>` captures the anonymous lifetime defined here
LL | self.x.iter().map(|a| a.0)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
@@ -19,7 +19,7 @@ error[E0700]: hidden type for `impl Iterator<Item = u32>` captures lifetime that
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
| -- ----------------------- opaque type defined here
| |
- | hidden type `Map<std::slice::Iter<'a, (u32, u32)>, [closure@$DIR/static-return-lifetime-infered.rs:11:27: 11:30]>` captures the lifetime `'a` as defined here
+ | hidden type `Map<std::slice::Iter<'a, (u32, u32)>, {closure@$DIR/static-return-lifetime-infered.rs:11:27: 11:30}>` captures the lifetime `'a` as defined here
LL | self.x.iter().map(|a| a.0)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
diff --git a/tests/ui/impl-trait/variance.rs b/tests/ui/impl-trait/variance.rs
new file mode 100644
index 000000000..d6212f8f3
--- /dev/null
+++ b/tests/ui/impl-trait/variance.rs
@@ -0,0 +1,16 @@
+#![feature(rustc_attrs)]
+#![allow(internal_features)]
+#![rustc_variance_of_opaques]
+
+trait Captures<'a> {}
+impl<T> Captures<'_> for T {}
+
+fn not_captured_early<'a: 'a>() -> impl Sized {} //~ [*]
+
+fn captured_early<'a: 'a>() -> impl Sized + Captures<'a> {} //~ [*, o]
+
+fn not_captured_late<'a>(_: &'a ()) -> impl Sized {} //~ []
+
+fn captured_late<'a>(_: &'a ()) -> impl Sized + Captures<'a> {} //~ [o]
+
+fn main() {}
diff --git a/tests/ui/impl-trait/variance.stderr b/tests/ui/impl-trait/variance.stderr
new file mode 100644
index 000000000..644736754
--- /dev/null
+++ b/tests/ui/impl-trait/variance.stderr
@@ -0,0 +1,26 @@
+error: [*]
+ --> $DIR/variance.rs:8:36
+ |
+LL | fn not_captured_early<'a: 'a>() -> impl Sized {}
+ | ^^^^^^^^^^
+
+error: [*, o]
+ --> $DIR/variance.rs:10:32
+ |
+LL | fn captured_early<'a: 'a>() -> impl Sized + Captures<'a> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: []
+ --> $DIR/variance.rs:12:40
+ |
+LL | fn not_captured_late<'a>(_: &'a ()) -> impl Sized {}
+ | ^^^^^^^^^^
+
+error: [o]
+ --> $DIR/variance.rs:14:36
+ |
+LL | fn captured_late<'a>(_: &'a ()) -> impl Sized + Captures<'a> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/imports/import-after-macro-expand-10.rs b/tests/ui/imports/import-after-macro-expand-10.rs
new file mode 100644
index 000000000..b3520c42d
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-10.rs
@@ -0,0 +1,17 @@
+// check-pass
+
+mod b {
+ pub mod http {
+ pub struct HeaderMap;
+ }
+
+ pub use self::http::*;
+ #[derive(Debug)]
+ pub struct HeaderMap;
+}
+
+use crate::b::*;
+
+fn main() {
+ let h: crate::b::HeaderMap = HeaderMap;
+}
diff --git a/tests/ui/imports/import-after-macro-expand-11.rs b/tests/ui/imports/import-after-macro-expand-11.rs
new file mode 100644
index 000000000..2b81dfc23
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-11.rs
@@ -0,0 +1,21 @@
+// check-pass
+
+#[derive(Debug)]
+struct H;
+
+mod p {
+ use super::*;
+
+ #[derive(Clone)]
+ struct H;
+
+ mod t {
+ use super::*;
+
+ fn f() {
+ let h: crate::p::H = H;
+ }
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/imports/import-after-macro-expand-12.rs b/tests/ui/imports/import-after-macro-expand-12.rs
new file mode 100644
index 000000000..f92e8c12f
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-12.rs
@@ -0,0 +1,34 @@
+// check-pass
+// https://github.com/rust-lang/rust/issues/115377
+
+use module::*;
+
+mod module {
+ pub enum B {}
+ impl B {
+ pub const ASSOC: u8 = 0;
+ }
+}
+
+#[derive()]
+pub enum B {}
+impl B {
+ pub const ASSOC: u16 = 0;
+}
+
+macro_rules! m {
+ ($right:expr) => {
+ $right
+ };
+}
+
+fn main() {
+ let a: u16 = {
+ use self::*;
+ B::ASSOC
+ };
+ let b: u16 = m!({
+ use self::*;
+ B::ASSOC
+ });
+}
diff --git a/tests/ui/imports/import-after-macro-expand-13.rs b/tests/ui/imports/import-after-macro-expand-13.rs
new file mode 100644
index 000000000..fd640002c
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-13.rs
@@ -0,0 +1,22 @@
+// check-pass
+// similar as `import-after-macro-expand-6.rs`
+
+use crate::a::HeaderMap;
+
+mod b {
+ pub mod http {
+ pub struct HeaderMap;
+ }
+
+ pub use self::http::*;
+ #[derive(Debug)]
+ pub struct HeaderMap;
+}
+
+mod a {
+ pub use crate::b::*;
+}
+
+fn main() {
+ let h: crate::b::HeaderMap = HeaderMap;
+}
diff --git a/tests/ui/imports/import-after-macro-expand-14.rs b/tests/ui/imports/import-after-macro-expand-14.rs
new file mode 100644
index 000000000..4d461a0e2
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-14.rs
@@ -0,0 +1,22 @@
+// check-pass
+
+use crate::a::HeaderMap;
+
+mod b {
+ pub mod http {
+ #[derive(Clone)]
+ pub struct HeaderMap;
+ }
+
+ pub use self::http::*;
+ #[derive(Debug)]
+ pub struct HeaderMap;
+}
+
+mod a {
+ pub use crate::b::*;
+}
+
+fn main() {
+ let h: crate::b::HeaderMap = HeaderMap;
+}
diff --git a/tests/ui/imports/import-after-macro-expand-2.rs b/tests/ui/imports/import-after-macro-expand-2.rs
index b3996d488..ff773fc82 100644
--- a/tests/ui/imports/import-after-macro-expand-2.rs
+++ b/tests/ui/imports/import-after-macro-expand-2.rs
@@ -12,9 +12,7 @@ mod tests {
use super::*;
fn test_thing() {
- let thing: crate::thing::Thing = Thing::Bar;
- // FIXME: `thing` should refer to `crate::Thing`,
- // FIXME: but doesn't currently refer to it due to backward compatibility
+ let thing: crate::Thing = Thing::Foo;
}
}
diff --git a/tests/ui/imports/import-after-macro-expand-4.rs b/tests/ui/imports/import-after-macro-expand-4.rs
index 02cc3f01a..fc0a232a9 100644
--- a/tests/ui/imports/import-after-macro-expand-4.rs
+++ b/tests/ui/imports/import-after-macro-expand-4.rs
@@ -1,3 +1,4 @@
+// check-pass
// https://github.com/rust-lang/rust/pull/113242#issuecomment-1616034904
// similar with `import-after-macro-expand-2.rs`
@@ -10,16 +11,6 @@ pub use a::*;
mod c {
use crate::*;
pub struct S(Vec<P>);
- //~^ ERROR the size for values of type
- //~| WARNING trait objects without an explicit
- //~| WARNING this is accepted in the current edition
- //~| WARNING trait objects without an explicit
- //~| WARNING this is accepted in the current edition
- //~| WARNING trait objects without an explicit
- //~| WARNING this is accepted in the current edition
-
- // FIXME: should works, but doesn't currently refer
- // to it due to backward compatibility
}
#[derive(Clone)]
diff --git a/tests/ui/imports/import-after-macro-expand-4.stderr b/tests/ui/imports/import-after-macro-expand-4.stderr
deleted file mode 100644
index 01f70cfc5..000000000
--- a/tests/ui/imports/import-after-macro-expand-4.stderr
+++ /dev/null
@@ -1,53 +0,0 @@
-warning: trait objects without an explicit `dyn` are deprecated
- --> $DIR/import-after-macro-expand-4.rs:12:22
- |
-LL | pub struct S(Vec<P>);
- | ^
- |
- = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
- = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
- = note: `#[warn(bare_trait_objects)]` on by default
-help: use `dyn`
- |
-LL | pub struct S(Vec<dyn P>);
- | +++
-
-warning: trait objects without an explicit `dyn` are deprecated
- --> $DIR/import-after-macro-expand-4.rs:12:22
- |
-LL | pub struct S(Vec<P>);
- | ^
- |
- = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
- = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
-help: use `dyn`
- |
-LL | pub struct S(Vec<dyn P>);
- | +++
-
-warning: trait objects without an explicit `dyn` are deprecated
- --> $DIR/import-after-macro-expand-4.rs:12:22
- |
-LL | pub struct S(Vec<P>);
- | ^
- |
- = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
- = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
-help: use `dyn`
- |
-LL | pub struct S(Vec<dyn P>);
- | +++
-
-error[E0277]: the size for values of type `(dyn a::P + 'static)` cannot be known at compilation time
- --> $DIR/import-after-macro-expand-4.rs:12:18
- |
-LL | pub struct S(Vec<P>);
- | ^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `Sized` is not implemented for `(dyn a::P + 'static)`
-note: required by a bound in `Vec`
- --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
-
-error: aborting due to previous error; 3 warnings emitted
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/imports/import-after-macro-expand-6.rs b/tests/ui/imports/import-after-macro-expand-6.rs
index ab5bb37a1..bff8efebc 100644
--- a/tests/ui/imports/import-after-macro-expand-6.rs
+++ b/tests/ui/imports/import-after-macro-expand-6.rs
@@ -18,7 +18,5 @@ mod b {
use crate::a::HeaderMap;
fn main() {
- let h: crate::b::http::HeaderMap = HeaderMap;
- // FIXME: should refer to `crate::b::HeaderMap`,
- // FIXME: but doesn't currently refer to it due to backward compatibility
+ let h: crate::b::HeaderMap = HeaderMap;
}
diff --git a/tests/ui/imports/import-after-macro-expand-9.rs b/tests/ui/imports/import-after-macro-expand-9.rs
new file mode 100644
index 000000000..deee42c3b
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-9.rs
@@ -0,0 +1,17 @@
+// check-pass
+
+use crate::b::*;
+
+mod b {
+ pub mod http {
+ pub struct HeaderMap;
+ }
+
+ pub use self::http::*;
+ #[derive(Debug)]
+ pub struct HeaderMap;
+}
+
+fn main() {
+ let h: crate::b::HeaderMap = HeaderMap;
+}
diff --git a/tests/ui/inference/issue-72616.stderr b/tests/ui/inference/issue-72616.stderr
index 6ee0626ca..02c92c1c1 100644
--- a/tests/ui/inference/issue-72616.stderr
+++ b/tests/ui/inference/issue-72616.stderr
@@ -23,7 +23,7 @@ LL | if String::from("a") == "a".try_into().unwrap() {}
| ^^^^^^^^
|
= note: multiple `impl`s satisfying `_: TryFrom<&str>` found in the following crates: `core`, `std`:
- - impl<> TryFrom<&str> for std::sys_common::net::LookupHost;
+ - impl TryFrom<&str> for std::sys_common::net::LookupHost;
- impl<T, U> TryFrom<U> for T
where U: Into<T>;
= note: required for `&str` to implement `TryInto<_>`
diff --git a/tests/ui/inference/issue-72690.stderr b/tests/ui/inference/issue-72690.stderr
index 8eda71ec0..225558805 100644
--- a/tests/ui/inference/issue-72690.stderr
+++ b/tests/ui/inference/issue-72690.stderr
@@ -2,11 +2,11 @@ error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:7:5
|
LL | String::from("x".as_ref());
- | ^^^^^^^^^^^^ cannot infer type for reference `&_`
+ | ^^^^^^ cannot infer type for reference `&_`
|
= note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
- - impl<> From<&String> for String;
- - impl<> From<&str> for String;
+ - impl From<&String> for String;
+ - impl From<&str> for String;
error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:7:22
@@ -71,11 +71,11 @@ error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:21:5
|
LL | String::from("x".as_ref());
- | ^^^^^^^^^^^^ cannot infer type for reference `&_`
+ | ^^^^^^ cannot infer type for reference `&_`
|
= note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
- - impl<> From<&String> for String;
- - impl<> From<&str> for String;
+ - impl From<&String> for String;
+ - impl From<&str> for String;
error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:21:22
@@ -97,11 +97,11 @@ error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:28:5
|
LL | String::from("x".as_ref());
- | ^^^^^^^^^^^^ cannot infer type for reference `&_`
+ | ^^^^^^ cannot infer type for reference `&_`
|
= note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
- - impl<> From<&String> for String;
- - impl<> From<&str> for String;
+ - impl From<&String> for String;
+ - impl From<&str> for String;
error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:28:22
@@ -123,11 +123,11 @@ error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:37:5
|
LL | String::from("x".as_ref());
- | ^^^^^^^^^^^^ cannot infer type for reference `&_`
+ | ^^^^^^ cannot infer type for reference `&_`
|
= note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
- - impl<> From<&String> for String;
- - impl<> From<&str> for String;
+ - impl From<&String> for String;
+ - impl From<&str> for String;
error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:37:22
@@ -149,11 +149,11 @@ error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:46:5
|
LL | String::from("x".as_ref());
- | ^^^^^^^^^^^^ cannot infer type for reference `&_`
+ | ^^^^^^ cannot infer type for reference `&_`
|
= note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
- - impl<> From<&String> for String;
- - impl<> From<&str> for String;
+ - impl From<&String> for String;
+ - impl From<&str> for String;
error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:46:22
@@ -175,11 +175,11 @@ error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:53:5
|
LL | String::from("x".as_ref());
- | ^^^^^^^^^^^^ cannot infer type for reference `&_`
+ | ^^^^^^ cannot infer type for reference `&_`
|
= note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
- - impl<> From<&String> for String;
- - impl<> From<&str> for String;
+ - impl From<&String> for String;
+ - impl From<&str> for String;
error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:53:22
@@ -201,11 +201,11 @@ error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:62:5
|
LL | String::from("x".as_ref());
- | ^^^^^^^^^^^^ cannot infer type for reference `&_`
+ | ^^^^^^ cannot infer type for reference `&_`
|
= note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
- - impl<> From<&String> for String;
- - impl<> From<&str> for String;
+ - impl From<&String> for String;
+ - impl From<&str> for String;
error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:62:22
diff --git a/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature.stderr b/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature.stderr
new file mode 100644
index 000000000..8b8fc46df
--- /dev/null
+++ b/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature.stderr
@@ -0,0 +1,27 @@
+error[E0275]: overflow evaluating the requirement `X2`
+ --> $DIR/infinite-type-alias-mutual-recursion.rs:6:11
+ |
+LL | type X1 = X2;
+ | ^^
+ |
+ = note: in case this is a recursive type alias, consider using a struct, enum, or union instead
+
+error[E0275]: overflow evaluating the requirement `X3`
+ --> $DIR/infinite-type-alias-mutual-recursion.rs:9:11
+ |
+LL | type X2 = X3;
+ | ^^
+ |
+ = note: in case this is a recursive type alias, consider using a struct, enum, or union instead
+
+error[E0275]: overflow evaluating the requirement `X1`
+ --> $DIR/infinite-type-alias-mutual-recursion.rs:11:11
+ |
+LL | type X3 = X1;
+ | ^^
+ |
+ = note: in case this is a recursive type alias, consider using a struct, enum, or union instead
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/infinite/infinite-type-alias-mutual-recursion.stderr b/tests/ui/infinite/infinite-type-alias-mutual-recursion.gated.stderr
index bbdb1f70b..ec63688fa 100644
--- a/tests/ui/infinite/infinite-type-alias-mutual-recursion.stderr
+++ b/tests/ui/infinite/infinite-type-alias-mutual-recursion.gated.stderr
@@ -1,16 +1,16 @@
error[E0391]: cycle detected when expanding type alias `X1`
- --> $DIR/infinite-type-alias-mutual-recursion.rs:1:11
+ --> $DIR/infinite-type-alias-mutual-recursion.rs:6:11
|
LL | type X1 = X2;
| ^^
|
note: ...which requires expanding type alias `X2`...
- --> $DIR/infinite-type-alias-mutual-recursion.rs:3:11
+ --> $DIR/infinite-type-alias-mutual-recursion.rs:9:11
|
LL | type X2 = X3;
| ^^
note: ...which requires expanding type alias `X3`...
- --> $DIR/infinite-type-alias-mutual-recursion.rs:4:11
+ --> $DIR/infinite-type-alias-mutual-recursion.rs:11:11
|
LL | type X3 = X1;
| ^^
@@ -19,12 +19,13 @@ LL | type X3 = X1;
= help: consider using a struct, enum, or union instead to break the cycle
= help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information
note: cycle used when collecting item types in top-level module
- --> $DIR/infinite-type-alias-mutual-recursion.rs:1:1
+ --> $DIR/infinite-type-alias-mutual-recursion.rs:3:1
|
-LL | / type X1 = X2;
+LL | / #![cfg_attr(feature, feature(lazy_type_alias))]
+LL | | #![allow(incomplete_features)]
LL | |
-LL | | type X2 = X3;
-LL | | type X3 = X1;
+LL | | type X1 = X2;
+... |
LL | |
LL | | fn main() {}
| |____________^
diff --git a/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs b/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs
index 5381eedcf..90c941c63 100644
--- a/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs
+++ b/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs
@@ -1,6 +1,14 @@
+// revisions: feature gated
+
+#![cfg_attr(feature, feature(lazy_type_alias))]
+#![allow(incomplete_features)]
+
type X1 = X2;
-//~^ ERROR cycle detected when expanding type alias `X1`
+//[gated]~^ ERROR cycle detected when expanding type alias `X1`
+//[feature]~^^ ERROR: overflow evaluating the requirement `X2`
type X2 = X3;
+//[feature]~^ ERROR: overflow evaluating the requirement `X3`
type X3 = X1;
+//[feature]~^ ERROR: overflow evaluating the requirement `X1`
fn main() {}
diff --git a/tests/ui/infinite/infinite-vec-type-recursion.feature.stderr b/tests/ui/infinite/infinite-vec-type-recursion.feature.stderr
new file mode 100644
index 000000000..3a1462159
--- /dev/null
+++ b/tests/ui/infinite/infinite-vec-type-recursion.feature.stderr
@@ -0,0 +1,11 @@
+error[E0275]: overflow evaluating the requirement `X`
+ --> $DIR/infinite-vec-type-recursion.rs:6:10
+ |
+LL | type X = Vec<X>;
+ | ^^^^^^
+ |
+ = note: in case this is a recursive type alias, consider using a struct, enum, or union instead
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/infinite/infinite-vec-type-recursion.stderr b/tests/ui/infinite/infinite-vec-type-recursion.gated.stderr
index a21b033a9..e47d9b652 100644
--- a/tests/ui/infinite/infinite-vec-type-recursion.stderr
+++ b/tests/ui/infinite/infinite-vec-type-recursion.gated.stderr
@@ -1,5 +1,5 @@
error[E0391]: cycle detected when expanding type alias `X`
- --> $DIR/infinite-vec-type-recursion.rs:1:14
+ --> $DIR/infinite-vec-type-recursion.rs:6:14
|
LL | type X = Vec<X>;
| ^
@@ -9,11 +9,14 @@ LL | type X = Vec<X>;
= help: consider using a struct, enum, or union instead to break the cycle
= help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information
note: cycle used when collecting item types in top-level module
- --> $DIR/infinite-vec-type-recursion.rs:1:1
+ --> $DIR/infinite-vec-type-recursion.rs:3:1
|
-LL | / type X = Vec<X>;
-LL | |
+LL | / #![cfg_attr(feature, feature(lazy_type_alias))]
+LL | | #![allow(incomplete_features)]
LL | |
+LL | | type X = Vec<X>;
+... |
+LL | | #[rustfmt::skip]
LL | | fn main() { let b: X = Vec::new(); }
| |____________________________________^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
diff --git a/tests/ui/infinite/infinite-vec-type-recursion.rs b/tests/ui/infinite/infinite-vec-type-recursion.rs
index 356818225..71ab4a330 100644
--- a/tests/ui/infinite/infinite-vec-type-recursion.rs
+++ b/tests/ui/infinite/infinite-vec-type-recursion.rs
@@ -1,4 +1,11 @@
+// revisions: feature gated
+
+#![cfg_attr(feature, feature(lazy_type_alias))]
+#![allow(incomplete_features)]
+
type X = Vec<X>;
-//~^ ERROR cycle detected
+//[gated]~^ ERROR cycle detected
+//[feature]~^^ ERROR: overflow evaluating the requirement `X`
+#[rustfmt::skip]
fn main() { let b: X = Vec::new(); }
diff --git a/tests/ui/inline-const/promotion.rs b/tests/ui/inline-const/promotion.rs
new file mode 100644
index 000000000..242959c6b
--- /dev/null
+++ b/tests/ui/inline-const/promotion.rs
@@ -0,0 +1,22 @@
+#![feature(inline_const)]
+#![allow(arithmetic_overflow, unconditional_panic)]
+
+// The only way to have promoteds that fail is in `const fn` called from `const`/`static`.
+// Make sure that in a `const` block, we do not promote such calls.
+const fn div_by_zero() -> i32 {
+ 1 / 0
+}
+
+const fn mk_false() -> bool {
+ false
+}
+
+fn main() {
+ let v = const {
+ if mk_false() {
+ let _x: &'static i32 = &div_by_zero();
+ //~^ ERROR: temporary value dropped while borrowed
+ }
+ 42
+ };
+}
diff --git a/tests/ui/inline-const/promotion.stderr b/tests/ui/inline-const/promotion.stderr
new file mode 100644
index 000000000..795fc8f59
--- /dev/null
+++ b/tests/ui/inline-const/promotion.stderr
@@ -0,0 +1,14 @@
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/promotion.rs:17:37
+ |
+LL | let _x: &'static i32 = &div_by_zero();
+ | ------------ ^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
+LL |
+LL | }
+ | - temporary value is freed at the end of this statement
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0716`.
diff --git a/tests/ui/inner-static-type-parameter.rs b/tests/ui/inner-static-type-parameter.rs
index c08ccd29d..a1994e752 100644
--- a/tests/ui/inner-static-type-parameter.rs
+++ b/tests/ui/inner-static-type-parameter.rs
@@ -4,7 +4,7 @@ enum Bar<T> { What } //~ ERROR parameter `T` is never used
fn foo<T>() {
static a: Bar<T> = Bar::What;
-//~^ ERROR can't use generic parameters from outer function
+//~^ ERROR can't use generic parameters from outer item
}
fn main() {
diff --git a/tests/ui/inner-static-type-parameter.stderr b/tests/ui/inner-static-type-parameter.stderr
index e4e449e41..ff6558e49 100644
--- a/tests/ui/inner-static-type-parameter.stderr
+++ b/tests/ui/inner-static-type-parameter.stderr
@@ -1,10 +1,10 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/inner-static-type-parameter.rs:6:19
|
LL | fn foo<T>() {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | static a: Bar<T> = Bar::What;
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
error[E0392]: parameter `T` is never used
--> $DIR/inner-static-type-parameter.rs:3:10
diff --git a/tests/ui/intrinsics/const-eval-select-bad.stderr b/tests/ui/intrinsics/const-eval-select-bad.stderr
index d4507a27a..ecd08e3cd 100644
--- a/tests/ui/intrinsics/const-eval-select-bad.stderr
+++ b/tests/ui/intrinsics/const-eval-select-bad.stderr
@@ -4,7 +4,7 @@ error: this argument must be a function item
LL | const_eval_select((), || {}, || {});
| ^^^^^
|
- = note: expected a function item, found [closure@$DIR/const-eval-select-bad.rs:7:27: 7:29]
+ = note: expected a function item, found {closure@$DIR/const-eval-select-bad.rs:7:27: 7:29}
= help: consult the documentation on `const_eval_select` for more information
error: this argument must be a function item
@@ -13,7 +13,7 @@ error: this argument must be a function item
LL | const_eval_select((), || {}, || {});
| ^^^^^
|
- = note: expected a function item, found [closure@$DIR/const-eval-select-bad.rs:7:34: 7:36]
+ = note: expected a function item, found {closure@$DIR/const-eval-select-bad.rs:7:34: 7:36}
= help: consult the documentation on `const_eval_select` for more information
error: this argument must be a function item
diff --git a/tests/ui/intrinsics/feature-gate-safe-intrinsic.rs b/tests/ui/intrinsics/feature-gate-safe-intrinsic.rs
new file mode 100644
index 000000000..ffaa4d771
--- /dev/null
+++ b/tests/ui/intrinsics/feature-gate-safe-intrinsic.rs
@@ -0,0 +1,6 @@
+#[rustc_safe_intrinsic]
+//~^ ERROR the `#[rustc_safe_intrinsic]` attribute is used internally to mark intrinsics as safe
+//~| ERROR attribute should be applied to intrinsic functions
+fn safe() {}
+
+fn main() {}
diff --git a/tests/ui/intrinsics/feature-gate-safe-intrinsic.stderr b/tests/ui/intrinsics/feature-gate-safe-intrinsic.stderr
new file mode 100644
index 000000000..8aeb56598
--- /dev/null
+++ b/tests/ui/intrinsics/feature-gate-safe-intrinsic.stderr
@@ -0,0 +1,20 @@
+error[E0658]: the `#[rustc_safe_intrinsic]` attribute is used internally to mark intrinsics as safe
+ --> $DIR/feature-gate-safe-intrinsic.rs:1:1
+ |
+LL | #[rustc_safe_intrinsic]
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable
+
+error: attribute should be applied to intrinsic functions
+ --> $DIR/feature-gate-safe-intrinsic.rs:1:1
+ |
+LL | #[rustc_safe_intrinsic]
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | fn safe() {}
+ | ------------ not an intrinsic function
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/intrinsics/intrinsic-alignment.rs b/tests/ui/intrinsics/intrinsic-alignment.rs
index b99bb39d0..6f9df6441 100644
--- a/tests/ui/intrinsics/intrinsic-alignment.rs
+++ b/tests/ui/intrinsics/intrinsic-alignment.rs
@@ -1,7 +1,7 @@
// run-pass
// ignore-wasm32-bare seems not important to test here
-#![feature(intrinsics)]
+#![feature(intrinsics, rustc_attrs)]
mod rusti {
extern "rust-intrinsic" {
@@ -16,6 +16,7 @@ mod rusti {
target_os = "emscripten",
target_os = "freebsd",
target_os = "fuchsia",
+ target_os = "hurd",
target_os = "illumos",
target_os = "linux",
target_os = "macos",
diff --git a/tests/ui/invalid_dispatch_from_dyn_impls.stderr b/tests/ui/invalid_dispatch_from_dyn_impls.stderr
index b5b32d2f0..172ee7ade 100644
--- a/tests/ui/invalid_dispatch_from_dyn_impls.stderr
+++ b/tests/ui/invalid_dispatch_from_dyn_impls.stderr
@@ -15,11 +15,13 @@ LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<MultiplePointers<U>> for Multipl
= note: the trait `DispatchFromDyn` may only be implemented for a coercion between structures with a single field being coerced
= note: currently, 2 fields need coercions: `ptr1` (`*const T` to `*const U`), `ptr2` (`*const T` to `*const U`)
-error[E0378]: the trait `DispatchFromDyn` may only be implemented for a coercion between structures with a single field being coerced, none found
+error[E0378]: the trait `DispatchFromDyn` may only be implemented for a coercion between structures
--> $DIR/invalid_dispatch_from_dyn_impls.rs:31:1
|
LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<NothingToCoerce<T>> for NothingToCoerce<U> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: expected a single field to be coerced, none found
error[E0378]: structs implementing `DispatchFromDyn` may not have `#[repr(packed)]` or `#[repr(C)]`
--> $DIR/invalid_dispatch_from_dyn_impls.rs:37:1
diff --git a/tests/ui/issues/auxiliary/issue-111011.stderr b/tests/ui/issues/auxiliary/issue-111011.stderr
index 082f0f035..c0b48c584 100644
--- a/tests/ui/issues/auxiliary/issue-111011.stderr
+++ b/tests/ui/issues/auxiliary/issue-111011.stderr
@@ -17,7 +17,7 @@ LL | bar(async move || {});
| arguments to this function are incorrect
|
= note: expected struct `Box<(dyn FnOnce() -> _ + 'static)>`
- found closure `[closure@$DIR/issue-111011.rs:11:9: 11:22]`
+ found closure `{closure@$DIR/issue-111011.rs:11:9: 11:22}`
= note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html
note: function defined here
--> $DIR/issue-111011.rs:7:4
diff --git a/tests/ui/issues/issue-10764.stderr b/tests/ui/issues/issue-10764.stderr
index fcb45affe..4d8a85a13 100644
--- a/tests/ui/issues/issue-10764.stderr
+++ b/tests/ui/issues/issue-10764.stderr
@@ -8,7 +8,6 @@ LL | fn main() { f(bar) }
|
= note: expected fn pointer `fn()`
found fn item `extern "C" fn() {bar}`
- = note: when the arguments and return types match, functions can be coerced to function pointers
note: function defined here
--> $DIR/issue-10764.rs:1:4
|
diff --git a/tests/ui/issues/issue-12127.stderr b/tests/ui/issues/issue-12127.stderr
index 2c451b07f..2e5858679 100644
--- a/tests/ui/issues/issue-12127.stderr
+++ b/tests/ui/issues/issue-12127.stderr
@@ -11,7 +11,7 @@ note: this value implements `FnOnce`, which causes it to be moved when called
|
LL | f();
| ^
- = note: move occurs because `f` has type `[closure@$DIR/issue-12127.rs:8:24: 8:30]`, which does not implement the `Copy` trait
+ = note: move occurs because `f` has type `{closure@$DIR/issue-12127.rs:8:24: 8:30}`, which does not implement the `Copy` trait
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-17252.stderr b/tests/ui/issues/issue-17252.stderr
index daaf82e80..32e20d774 100644
--- a/tests/ui/issues/issue-17252.stderr
+++ b/tests/ui/issues/issue-17252.stderr
@@ -1,10 +1,15 @@
-error[E0391]: cycle detected when const-evaluating + checking `FOO`
+error[E0391]: cycle detected when simplifying constant for the type system `FOO`
+ --> $DIR/issue-17252.rs:1:1
+ |
+LL | const FOO: usize = FOO;
+ | ^^^^^^^^^^^^^^^^
+ |
+note: ...which requires const-evaluating + checking `FOO`...
--> $DIR/issue-17252.rs:1:20
|
LL | const FOO: usize = FOO;
| ^^^
- |
- = note: ...which immediately requires const-evaluating + checking `FOO` again
+ = note: ...which again requires simplifying constant for the type system `FOO`, completing the cycle
note: cycle used when const-evaluating + checking `main::{constant#0}`
--> $DIR/issue-17252.rs:4:18
|
diff --git a/tests/ui/issues/issue-18389.rs b/tests/ui/issues/issue-18389.rs
index 05a5decf4..26b607f40 100644
--- a/tests/ui/issues/issue-18389.rs
+++ b/tests/ui/issues/issue-18389.rs
@@ -1,9 +1,4 @@
-#![feature(type_privacy_lints)]
-#![warn(private_bounds)]
-
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
+// check-pass
use std::any::Any;
use std::any::TypeId;
@@ -12,8 +7,7 @@ trait Private<P, R> {
fn call(&self, p: P, r: R);
}
pub trait Public: Private<
-//~^ ERROR private trait `Private<<Self as Public>::P, <Self as Public>::R>` in public interface
-//~| WARNING trait `Private<<Self as Public>::P, <Self as Public>::R>` is more private than the item `Public`
+//~^ WARNING trait `Private<<Self as Public>::P, <Self as Public>::R>` is more private than the item `Public`
<Self as Public>::P,
<Self as Public>::R
> {
diff --git a/tests/ui/issues/issue-18389.stderr b/tests/ui/issues/issue-18389.stderr
index 18ffc4177..4706d1ba1 100644
--- a/tests/ui/issues/issue-18389.stderr
+++ b/tests/ui/issues/issue-18389.stderr
@@ -1,39 +1,19 @@
-error[E0445]: private trait `Private<<Self as Public>::P, <Self as Public>::R>` in public interface
- --> $DIR/issue-18389.rs:14:1
- |
-LL | trait Private<P, R> {
- | ------------------- `Private<<Self as Public>::P, <Self as Public>::R>` declared as private
-...
-LL | / pub trait Public: Private<
-LL | |
-LL | |
-LL | | <Self as Public>::P,
-LL | | <Self as Public>::R
-LL | | > {
- | |_^ can't leak private trait
-
warning: trait `Private<<Self as Public>::P, <Self as Public>::R>` is more private than the item `Public`
- --> $DIR/issue-18389.rs:14:1
+ --> $DIR/issue-18389.rs:9:1
|
LL | / pub trait Public: Private<
LL | |
-LL | |
LL | | <Self as Public>::P,
LL | | <Self as Public>::R
LL | | > {
| |_^ trait `Public` is reachable at visibility `pub`
|
note: but trait `Private<<Self as Public>::P, <Self as Public>::R>` is only usable at visibility `pub(crate)`
- --> $DIR/issue-18389.rs:11:1
+ --> $DIR/issue-18389.rs:6:1
|
LL | trait Private<P, R> {
| ^^^^^^^^^^^^^^^^^^^
-note: the lint level is defined here
- --> $DIR/issue-18389.rs:2:9
- |
-LL | #![warn(private_bounds)]
- | ^^^^^^^^^^^^^^
+ = note: `#[warn(private_bounds)]` on by default
-error: aborting due to previous error; 1 warning emitted
+warning: 1 warning emitted
-For more information about this error, try `rustc --explain E0445`.
diff --git a/tests/ui/issues/issue-18611.stderr b/tests/ui/issues/issue-18611.stderr
index bd18d4622..784b9b984 100644
--- a/tests/ui/issues/issue-18611.stderr
+++ b/tests/ui/issues/issue-18611.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `isize: HasState` is not satisfied
|
LL | fn add_state(op: <isize as HasState>::State) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasState` is not implemented for `isize`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-18611.rs:5:1
+ |
+LL | trait HasState {
+ | ^^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-21763.stderr b/tests/ui/issues/issue-21763.stderr
index df50118ac..a887635d3 100644
--- a/tests/ui/issues/issue-21763.stderr
+++ b/tests/ui/issues/issue-21763.stderr
@@ -9,9 +9,6 @@ LL | foo::<HashMap<Rc<()>, Rc<()>>>();
= note: required for `hashbrown::raw::RawTable<(Rc<()>, Rc<()>)>` to implement `Send`
note: required because it appears within the type `HashMap<Rc<()>, Rc<()>, RandomState>`
--> $HASHBROWN_SRC_LOCATION
- |
-LL | pub struct HashMap<K, V, S = DefaultHashBuilder, A: Allocator + Clone = Global> {
- | ^^^^^^^
note: required because it appears within the type `HashMap<Rc<()>, Rc<()>>`
--> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
note: required by a bound in `foo`
diff --git a/tests/ui/issues/issue-22638.rs b/tests/ui/issues/issue-22638.rs
index 198ceccc2..c2407227c 100644
--- a/tests/ui/issues/issue-22638.rs
+++ b/tests/ui/issues/issue-22638.rs
@@ -1,5 +1,5 @@
// build-fail
-// normalize-stderr-test: "<\[closure@.+`" -> "$$CLOSURE`"
+// normalize-stderr-test: "<\{closure@.+`" -> "$$CLOSURE`"
// normalize-stderr-test: ".nll/" -> "/"
#![allow(unused)]
@@ -54,7 +54,7 @@ impl D {
pub fn matches<F: Fn()>(&self, f: &F) {
let &D(ref a) = self;
a.matches(f)
- //~^ ERROR reached the recursion limit while instantiating `A::matches::<[closure
+ //~^ ERROR reached the recursion limit while instantiating `A::matches::<{closure
}
}
diff --git a/tests/ui/issues/issue-23302-1.stderr b/tests/ui/issues/issue-23302-1.stderr
index d807e2440..d753bdeb9 100644
--- a/tests/ui/issues/issue-23302-1.stderr
+++ b/tests/ui/issues/issue-23302-1.stderr
@@ -1,10 +1,15 @@
-error[E0391]: cycle detected when const-evaluating + checking `X::A::{constant#0}`
+error[E0391]: cycle detected when simplifying constant for the type system `X::A::{constant#0}`
--> $DIR/issue-23302-1.rs:4:9
|
LL | A = X::A as isize,
| ^^^^^^^^^^^^^
|
- = note: ...which immediately requires const-evaluating + checking `X::A::{constant#0}` again
+note: ...which requires const-evaluating + checking `X::A::{constant#0}`...
+ --> $DIR/issue-23302-1.rs:4:9
+ |
+LL | A = X::A as isize,
+ | ^^^^^^^^^^^^^
+ = note: ...which again requires simplifying constant for the type system `X::A::{constant#0}`, completing the cycle
note: cycle used when simplifying constant for the type system `X::A::{constant#0}`
--> $DIR/issue-23302-1.rs:4:9
|
diff --git a/tests/ui/issues/issue-23302-2.stderr b/tests/ui/issues/issue-23302-2.stderr
index 91b39dba1..b756ee1d5 100644
--- a/tests/ui/issues/issue-23302-2.stderr
+++ b/tests/ui/issues/issue-23302-2.stderr
@@ -1,10 +1,15 @@
-error[E0391]: cycle detected when const-evaluating + checking `Y::A::{constant#0}`
+error[E0391]: cycle detected when simplifying constant for the type system `Y::A::{constant#0}`
--> $DIR/issue-23302-2.rs:4:9
|
LL | A = Y::B as isize,
| ^^^^^^^^^^^^^
|
- = note: ...which immediately requires const-evaluating + checking `Y::A::{constant#0}` again
+note: ...which requires const-evaluating + checking `Y::A::{constant#0}`...
+ --> $DIR/issue-23302-2.rs:4:9
+ |
+LL | A = Y::B as isize,
+ | ^^^^^^^^^^^^^
+ = note: ...which again requires simplifying constant for the type system `Y::A::{constant#0}`, completing the cycle
note: cycle used when simplifying constant for the type system `Y::A::{constant#0}`
--> $DIR/issue-23302-2.rs:4:9
|
diff --git a/tests/ui/issues/issue-23302-3.stderr b/tests/ui/issues/issue-23302-3.stderr
index 6b708d81f..6cdc94551 100644
--- a/tests/ui/issues/issue-23302-3.stderr
+++ b/tests/ui/issues/issue-23302-3.stderr
@@ -1,15 +1,25 @@
-error[E0391]: cycle detected when const-evaluating + checking `A`
+error[E0391]: cycle detected when simplifying constant for the type system `A`
+ --> $DIR/issue-23302-3.rs:1:1
+ |
+LL | const A: i32 = B;
+ | ^^^^^^^^^^^^
+ |
+note: ...which requires const-evaluating + checking `A`...
--> $DIR/issue-23302-3.rs:1:16
|
LL | const A: i32 = B;
| ^
+note: ...which requires simplifying constant for the type system `B`...
+ --> $DIR/issue-23302-3.rs:3:1
|
+LL | const B: i32 = A;
+ | ^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `B`...
--> $DIR/issue-23302-3.rs:3:16
|
LL | const B: i32 = A;
| ^
- = note: ...which again requires const-evaluating + checking `A`, completing the cycle
+ = note: ...which again requires simplifying constant for the type system `A`, completing the cycle
note: cycle used when simplifying constant for the type system `A`
--> $DIR/issue-23302-3.rs:1:1
|
diff --git a/tests/ui/issues/issue-24036.stderr b/tests/ui/issues/issue-24036.stderr
index 0e73a51fa..a425816cd 100644
--- a/tests/ui/issues/issue-24036.stderr
+++ b/tests/ui/issues/issue-24036.stderr
@@ -6,8 +6,8 @@ LL | let mut x = |c| c + 1;
LL | x = |c| c + 1;
| ^^^^^^^^^ expected closure, found a different closure
|
- = note: expected closure `[closure@$DIR/issue-24036.rs:2:17: 2:20]`
- found closure `[closure@$DIR/issue-24036.rs:3:9: 3:12]`
+ = note: expected closure `{closure@$DIR/issue-24036.rs:2:17: 2:20}`
+ found closure `{closure@$DIR/issue-24036.rs:3:9: 3:12}`
= note: no two closures, even if identical, have the same type
= help: consider boxing your closure and/or using it as a trait object
diff --git a/tests/ui/issues/issue-25076.stderr b/tests/ui/issues/issue-25076.stderr
index 159cc484c..065bf7def 100644
--- a/tests/ui/issues/issue-25076.stderr
+++ b/tests/ui/issues/issue-25076.stderr
@@ -6,6 +6,11 @@ LL | do_fold(bot(), ());
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-25076.rs:3:1
+ |
+LL | trait InOut<T> { type Out; }
+ | ^^^^^^^^^^^^^^
note: required by a bound in `do_fold`
--> $DIR/issue-25076.rs:5:18
|
diff --git a/tests/ui/issues/issue-27042.stderr b/tests/ui/issues/issue-27042.stderr
index 59ef28481..01532de99 100644
--- a/tests/ui/issues/issue-27042.stderr
+++ b/tests/ui/issues/issue-27042.stderr
@@ -11,11 +11,18 @@ LL | | while true { break }; // but here we cite the whole loop
error[E0308]: mismatched types
--> $DIR/issue-27042.rs:6:16
|
+LL | let _: i32 =
+ | - expected because of this assignment
+LL | 'a: // in this case, the citation is just the `break`:
LL | loop { break };
- | ^^^^^
- | |
- | expected `i32`, found `()`
- | help: give it a value of the expected type: `break 42`
+ | ---- ^^^^^ expected `i32`, found `()`
+ | |
+ | this loop is expected to be of type `i32`
+ |
+help: give it a value of the expected type
+ |
+LL | loop { break 42 };
+ | ++
error[E0308]: mismatched types
--> $DIR/issue-27042.rs:8:9
diff --git a/tests/ui/issues/issue-29147.stderr b/tests/ui/issues/issue-29147.stderr
index 138d477dc..d0d948531 100644
--- a/tests/ui/issues/issue-29147.stderr
+++ b/tests/ui/issues/issue-29147.stderr
@@ -1,8 +1,8 @@
error[E0283]: type annotations needed
- --> $DIR/issue-29147.rs:22:13
+ --> $DIR/issue-29147.rs:22:14
|
LL | let _ = <S5<_>>::xxx;
- | ^^^^^^^^^^^^ cannot infer type for struct `S5<_>`
+ | ^^^^^ cannot infer type for struct `S5<_>`
|
note: multiple `impl`s satisfying `S5<_>: Foo` found
--> $DIR/issue-29147.rs:18:1
diff --git a/tests/ui/issues/issue-3214.rs b/tests/ui/issues/issue-3214.rs
index e3c07bb3f..b2c27f5be 100644
--- a/tests/ui/issues/issue-3214.rs
+++ b/tests/ui/issues/issue-3214.rs
@@ -1,6 +1,6 @@
fn foo<T>() {
struct Foo {
- x: T, //~ ERROR can't use generic parameters from outer function
+ x: T, //~ ERROR can't use generic parameters from outer item
}
impl<T> Drop for Foo<T> {
diff --git a/tests/ui/issues/issue-3214.stderr b/tests/ui/issues/issue-3214.stderr
index 7a2d772f0..5b57c1baf 100644
--- a/tests/ui/issues/issue-3214.stderr
+++ b/tests/ui/issues/issue-3214.stderr
@@ -1,12 +1,12 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-3214.rs:3:12
|
LL | fn foo<T>() {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | struct Foo {
- | - help: try using a local generic parameter instead: `<T>`
+ | - help: try introducing a local generic parameter here: `<T>`
LL | x: T,
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/issue-3214.rs:6:22
diff --git a/tests/ui/issues/issue-35570.stderr b/tests/ui/issues/issue-35570.stderr
index 2697d46bd..197e80ac0 100644
--- a/tests/ui/issues/issue-35570.stderr
+++ b/tests/ui/issues/issue-35570.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `for<'a> (): Trait2<'a>` is not satisfied
|
LL | fn _ice(param: Box<dyn for <'a> Trait1<<() as Trait2<'a>>::Ty>>) {
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Trait2<'a>` is not implemented for `()`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-35570.rs:4:1
+ |
+LL | trait Trait2<'a> {
+ | ^^^^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-39970.stderr b/tests/ui/issues/issue-39970.stderr
index 8344b88c3..713bc404f 100644
--- a/tests/ui/issues/issue-39970.stderr
+++ b/tests/ui/issues/issue-39970.stderr
@@ -1,8 +1,8 @@
error[E0271]: type mismatch resolving `<() as Array<'a>>::Element == ()`
- --> $DIR/issue-39970.rs:19:5
+ --> $DIR/issue-39970.rs:19:6
|
LL | <() as Visit>::visit();
- | ^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<() as Array<'a>>::Element == ()`
+ | ^^ type mismatch resolving `<() as Array<'a>>::Element == ()`
|
note: expected this to be `()`
--> $DIR/issue-39970.rs:10:20
diff --git a/tests/ui/issues/issue-41880.stderr b/tests/ui/issues/issue-41880.stderr
index 00c375f8d..6414e2692 100644
--- a/tests/ui/issues/issue-41880.stderr
+++ b/tests/ui/issues/issue-41880.stderr
@@ -5,7 +5,7 @@ LL | pub struct Iterate<T, F> {
| ------------------------ method `iter` not found for this struct
...
LL | println!("{:?}", a.iter().take(10).collect::<Vec<usize>>());
- | ^^^^ method not found in `Iterate<{integer}, [closure@issue-41880.rs:26:24]>`
+ | ^^^^ method not found in `Iterate<{integer}, {closure@issue-41880.rs:26:24}>`
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-43988.stderr b/tests/ui/issues/issue-43988.stderr
index 02c5dd5bf..7bbb8ed2c 100644
--- a/tests/ui/issues/issue-43988.stderr
+++ b/tests/ui/issues/issue-43988.stderr
@@ -32,7 +32,7 @@ error[E0552]: unrecognized representation hint
LL | #[repr(nothing)]
| ^^^^^^^
|
- = help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
+ = help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
error[E0552]: unrecognized representation hint
--> $DIR/issue-43988.rs:18:12
@@ -40,7 +40,7 @@ error[E0552]: unrecognized representation hint
LL | #[repr(something_not_real)]
| ^^^^^^^^^^^^^^^^^^
|
- = help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
+ = help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
error[E0518]: attribute should be applied to function or closure
--> $DIR/issue-43988.rs:30:5
diff --git a/tests/ui/issues/issue-48838.stderr b/tests/ui/issues/issue-48838.stderr
index 3502af702..159199a7f 100644
--- a/tests/ui/issues/issue-48838.stderr
+++ b/tests/ui/issues/issue-48838.stderr
@@ -5,7 +5,7 @@ LL | Square = |x| x,
| ^^^^^ expected `isize`, found closure
|
= note: expected type `isize`
- found closure `[closure@$DIR/issue-48838.rs:2:14: 2:17]`
+ found closure `{closure@$DIR/issue-48838.rs:2:14: 2:17}`
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-50600.stderr b/tests/ui/issues/issue-50600.stderr
index 7fea7e5c0..d285c3467 100644
--- a/tests/ui/issues/issue-50600.stderr
+++ b/tests/ui/issues/issue-50600.stderr
@@ -5,7 +5,7 @@ LL | fn([u8; |x: u8| {}]),
| ^^^^^^^^^^ expected `usize`, found closure
|
= note: expected type `usize`
- found closure `[closure@$DIR/issue-50600.rs:2:13: 2:20]`
+ found closure `{closure@$DIR/issue-50600.rs:2:13: 2:20}`
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-50688.stderr b/tests/ui/issues/issue-50688.stderr
index 6973ad271..df7603d79 100644
--- a/tests/ui/issues/issue-50688.stderr
+++ b/tests/ui/issues/issue-50688.stderr
@@ -5,7 +5,7 @@ LL | [1; || {}];
| ^^^^^ expected `usize`, found closure
|
= note: expected type `usize`
- found closure `[closure@$DIR/issue-50688.rs:2:9: 2:11]`
+ found closure `{closure@$DIR/issue-50688.rs:2:9: 2:11}`
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-50714-1.stderr b/tests/ui/issues/issue-50714-1.stderr
index 28469bee0..bacd09b2a 100644
--- a/tests/ui/issues/issue-50714-1.stderr
+++ b/tests/ui/issues/issue-50714-1.stderr
@@ -1,8 +1,8 @@
-error[E0647]: start function is not allowed to have a `where` clause
+error[E0647]: `#[start]` function is not allowed to have a `where` clause
--> $DIR/issue-50714-1.rs:9:50
|
LL | fn start(_: isize, _: *const *const u8) -> isize where fn(&()): Eq {
- | ^^^^^^^^^^^^^^^^^ start function cannot have a `where` clause
+ | ^^^^^^^^^^^^^^^^^ `#[start]` function cannot have a `where` clause
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-51154.stderr b/tests/ui/issues/issue-51154.stderr
index d8a833a86..002d5ccdc 100644
--- a/tests/ui/issues/issue-51154.stderr
+++ b/tests/ui/issues/issue-51154.stderr
@@ -9,7 +9,7 @@ LL | let _: Box<F> = Box::new(|| ());
| arguments to this function are incorrect
|
= note: expected type parameter `F`
- found closure `[closure@$DIR/issue-51154.rs:2:30: 2:32]`
+ found closure `{closure@$DIR/issue-51154.rs:2:30: 2:32}`
= help: every closure has a distinct type and so could not always match the caller-chosen type of parameter `F`
note: associated function defined here
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
diff --git a/tests/ui/issues/issue-5997-enum.rs b/tests/ui/issues/issue-5997-enum.rs
index 3ff4e036c..0b1857ae3 100644
--- a/tests/ui/issues/issue-5997-enum.rs
+++ b/tests/ui/issues/issue-5997-enum.rs
@@ -1,6 +1,6 @@
fn f<Z>() -> bool {
enum E { V(Z) }
- //~^ ERROR can't use generic parameters from outer function
+ //~^ ERROR can't use generic parameters from outer item
true
}
diff --git a/tests/ui/issues/issue-5997-enum.stderr b/tests/ui/issues/issue-5997-enum.stderr
index 3a79215d3..d07258ea7 100644
--- a/tests/ui/issues/issue-5997-enum.stderr
+++ b/tests/ui/issues/issue-5997-enum.stderr
@@ -1,12 +1,12 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-5997-enum.rs:2:16
|
LL | fn f<Z>() -> bool {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | enum E { V(Z) }
- | - ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `<Z>`
+ | help: try introducing a local generic parameter here: `<Z>`
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-5997-struct.rs b/tests/ui/issues/issue-5997-struct.rs
index 6cf510b0a..19d994b0d 100644
--- a/tests/ui/issues/issue-5997-struct.rs
+++ b/tests/ui/issues/issue-5997-struct.rs
@@ -1,5 +1,5 @@
fn f<T>() -> bool {
- struct S(T); //~ ERROR can't use generic parameters from outer function
+ struct S(T); //~ ERROR can't use generic parameters from outer item
true
}
diff --git a/tests/ui/issues/issue-5997-struct.stderr b/tests/ui/issues/issue-5997-struct.stderr
index d2e97f767..83229e02c 100644
--- a/tests/ui/issues/issue-5997-struct.stderr
+++ b/tests/ui/issues/issue-5997-struct.stderr
@@ -1,12 +1,12 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-5997-struct.rs:2:14
|
LL | fn f<T>() -> bool {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | struct S(T);
- | -^ use of generic parameter from outer function
+ | -^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `<T>`
+ | help: try introducing a local generic parameter here: `<T>`
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-60218.stderr b/tests/ui/issues/issue-60218.stderr
index 563690c9a..ae3c4d120 100644
--- a/tests/ui/issues/issue-60218.stderr
+++ b/tests/ui/issues/issue-60218.stderr
@@ -6,6 +6,11 @@ LL | trigger_error(vec![], |x: &u32| x)
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-60218.rs:7:1
+ |
+LL | pub trait Foo {}
+ | ^^^^^^^^^^^^^
note: required by a bound in `trigger_error`
--> $DIR/issue-60218.rs:13:72
|
diff --git a/tests/ui/issues/issue-66353.stderr b/tests/ui/issues/issue-66353.stderr
index 335618097..7ab7547b4 100644
--- a/tests/ui/issues/issue-66353.stderr
+++ b/tests/ui/issues/issue-66353.stderr
@@ -1,8 +1,14 @@
error[E0277]: the trait bound `(): _A` is not satisfied
- --> $DIR/issue-66353.rs:12:14
+ --> $DIR/issue-66353.rs:12:15
|
LL | _Func::< <() as _A>::AssocT >::func(());
- | ^^^^^^^^^^^^^^^^^^ the trait `_A` is not implemented for `()`
+ | ^^ the trait `_A` is not implemented for `()`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-66353.rs:7:1
+ |
+LL | trait _A {
+ | ^^^^^^^^
error[E0277]: the trait bound `(): _Func<_>` is not satisfied
--> $DIR/issue-66353.rs:12:41
@@ -11,6 +17,12 @@ LL | _Func::< <() as _A>::AssocT >::func(());
| ----------------------------------- ^^ the trait `_Func<_>` is not implemented for `()`
| |
| required by a bound introduced by this call
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-66353.rs:3:1
+ |
+LL | trait _Func<T> {
+ | ^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
diff --git a/tests/ui/issues/issue-66923-show-error-for-correct-call.stderr b/tests/ui/issues/issue-66923-show-error-for-correct-call.stderr
index cec482a53..22b1da64c 100644
--- a/tests/ui/issues/issue-66923-show-error-for-correct-call.stderr
+++ b/tests/ui/issues/issue-66923-show-error-for-correct-call.stderr
@@ -17,10 +17,12 @@ note: required by a bound in `collect`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
error[E0277]: a value of type `Vec<f64>` cannot be built from an iterator over elements of type `&f64`
- --> $DIR/issue-66923-show-error-for-correct-call.rs:12:29
+ --> $DIR/issue-66923-show-error-for-correct-call.rs:12:39
|
LL | let x3 = x1.into_iter().collect::<Vec<f64>>();
- | ^^^^^^^ value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>`
+ | ------- ^^^^^^^^ value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>`
+ | |
+ | required by a bound introduced by this call
|
= help: the trait `FromIterator<&f64>` is not implemented for `Vec<f64>`
= help: the trait `FromIterator<T>` is implemented for `Vec<T>`
diff --git a/tests/ui/issues/issue-69602-type-err-during-codegen-ice.stderr b/tests/ui/issues/issue-69602-type-err-during-codegen-ice.stderr
index ba385d887..6f9302bc4 100644
--- a/tests/ui/issues/issue-69602-type-err-during-codegen-ice.stderr
+++ b/tests/ui/issues/issue-69602-type-err-during-codegen-ice.stderr
@@ -13,7 +13,7 @@ LL | type MyA: TraitA;
LL | impl TraitB for B {
| ^^^^^^^^^^^^^^^^^ missing `MyA` in implementation
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/issue-69602-type-err-during-codegen-ice.rs:21:17
|
LL | let _ = [0; B::VALUE];
diff --git a/tests/ui/issues/issue-87199.stderr b/tests/ui/issues/issue-87199.stderr
index 0ec5e73f3..67949b37d 100644
--- a/tests/ui/issues/issue-87199.stderr
+++ b/tests/ui/issues/issue-87199.stderr
@@ -17,12 +17,10 @@ LL | fn ret() -> impl Iterator<Item = ()> + ?Send { std::iter::empty() }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
- --> $DIR/issue-87199.rs:18:22
+ --> $DIR/issue-87199.rs:18:15
|
LL | ref_arg::<[i32]>(&[5]);
- | ---------------- ^^^^ doesn't have a size known at compile-time
- | |
- | required by a bound introduced by this call
+ | ^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[i32]`
note: required by a bound in `ref_arg`
diff --git a/tests/ui/issues/issue-9575.stderr b/tests/ui/issues/issue-9575.stderr
index 5b8ce84a0..e49eac3ba 100644
--- a/tests/ui/issues/issue-9575.stderr
+++ b/tests/ui/issues/issue-9575.stderr
@@ -4,8 +4,8 @@ error[E0308]: `#[start]` function has wrong type
LL | fn start(argc: isize, argv: *const *const u8, crate_map: *const u8) -> isize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
- = note: expected fn pointer `fn(isize, *const *const u8) -> _`
- found fn pointer `fn(isize, *const *const u8, *const u8) -> _`
+ = note: expected signature `fn(isize, *const *const u8) -> _`
+ found signature `fn(isize, *const *const u8, *const u8) -> _`
error: aborting due to previous error
diff --git a/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr b/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr
index 7f1b9c38e..e728fec29 100644
--- a/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr
+++ b/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr
@@ -1,8 +1,10 @@
error[E0277]: a value of type `f32` cannot be made by summing an iterator over elements of type `{integer}`
- --> $DIR/invalid-iterator-chain-with-int-infer.rs:2:41
+ --> $DIR/invalid-iterator-chain-with-int-infer.rs:2:47
|
LL | let x = Some(()).iter().map(|()| 1).sum::<f32>();
- | ^^^ value of type `f32` cannot be made by summing a `std::iter::Iterator<Item={integer}>`
+ | --- ^^^ value of type `f32` cannot be made by summing a `std::iter::Iterator<Item={integer}>`
+ | |
+ | required by a bound introduced by this call
|
= help: the trait `Sum<{integer}>` is not implemented for `f32`
= help: the following other types implement trait `Sum<A>`:
diff --git a/tests/ui/iterators/invalid-iterator-chain.stderr b/tests/ui/iterators/invalid-iterator-chain.stderr
index a2688107d..b355da5cb 100644
--- a/tests/ui/iterators/invalid-iterator-chain.stderr
+++ b/tests/ui/iterators/invalid-iterator-chain.stderr
@@ -17,10 +17,12 @@ note: required by a bound in `collect`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
- --> $DIR/invalid-iterator-chain.rs:15:27
+ --> $DIR/invalid-iterator-chain.rs:15:33
|
LL | println!("{}", scores.sum::<i32>());
- | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
+ | --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
+ | |
+ | required by a bound introduced by this call
|
= help: the trait `Sum<()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
@@ -42,10 +44,12 @@ note: required by a bound in `std::iter::Iterator::sum`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
- --> $DIR/invalid-iterator-chain.rs:26:14
+ --> $DIR/invalid-iterator-chain.rs:26:20
|
LL | .sum::<i32>(),
- | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
+ | --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
+ | |
+ | required by a bound introduced by this call
|
= help: the trait `Sum<()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
@@ -74,10 +78,12 @@ note: required by a bound in `std::iter::Iterator::sum`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `f64`
- --> $DIR/invalid-iterator-chain.rs:36:14
+ --> $DIR/invalid-iterator-chain.rs:36:20
|
LL | .sum::<i32>(),
- | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=f64>`
+ | --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=f64>`
+ | |
+ | required by a bound introduced by this call
|
= help: the trait `Sum<f64>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
@@ -102,10 +108,12 @@ note: required by a bound in `std::iter::Iterator::sum`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
- --> $DIR/invalid-iterator-chain.rs:38:54
+ --> $DIR/invalid-iterator-chain.rs:38:60
|
LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
- | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
+ | --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
+ | |
+ | required by a bound introduced by this call
|
= help: the trait `Sum<()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
@@ -123,10 +131,12 @@ note: required by a bound in `std::iter::Iterator::sum`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `&()`
- --> $DIR/invalid-iterator-chain.rs:39:40
+ --> $DIR/invalid-iterator-chain.rs:39:46
|
LL | println!("{}", vec![(), ()].iter().sum::<i32>());
- | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=&()>`
+ | --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=&()>`
+ | |
+ | required by a bound introduced by this call
|
= help: the trait `Sum<&()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
diff --git a/tests/ui/kindck/kindck-nonsendable-1.stderr b/tests/ui/kindck/kindck-nonsendable-1.stderr
index cc6e1f59c..077004ae7 100644
--- a/tests/ui/kindck/kindck-nonsendable-1.stderr
+++ b/tests/ui/kindck/kindck-nonsendable-1.stderr
@@ -5,10 +5,10 @@ LL | bar(move|| foo(x));
| --- ------^^^^^^^
| | |
| | `Rc<usize>` cannot be sent between threads safely
- | | within this `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:15]`
+ | | within this `{closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:15}`
| required by a bound introduced by this call
|
- = help: within `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:15]`, the trait `Send` is not implemented for `Rc<usize>`
+ = help: within `{closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:15}`, the trait `Send` is not implemented for `Rc<usize>`
note: required because it's used within this closure
--> $DIR/kindck-nonsendable-1.rs:9:9
|
diff --git a/tests/ui/lang-items/start_lang_item_args.argc.stderr b/tests/ui/lang-items/start_lang_item_args.argc.stderr
index 65c99a93c..66d4397a2 100644
--- a/tests/ui/lang-items/start_lang_item_args.argc.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.argc.stderr
@@ -1,8 +1,12 @@
-error: parameter 2 of the `start` lang item is incorrect
+error[E0308]: lang item `start` function has wrong type
--> $DIR/start_lang_item_args.rs:75:38
|
LL | fn start<T>(_main: fn() -> T, _argc: i8, _argv: *const *const u8, _sigpipe: u8) -> isize {
- | ^^ help: change the type from `i8` to `isize`
+ | ^^ expected `isize`, found `i8`
+ |
+ = note: expected signature `fn(fn() -> _, isize, _, _) -> _`
+ found signature `fn(fn() -> _, i8, _, _) -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_args.argv.stderr b/tests/ui/lang-items/start_lang_item_args.argv.stderr
index f0947a9b3..53d776cd8 100644
--- a/tests/ui/lang-items/start_lang_item_args.argv.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.argv.stderr
@@ -1,8 +1,12 @@
-error: parameter 3 of the `start` lang item is incorrect
+error[E0308]: lang item `start` function has wrong type
--> $DIR/start_lang_item_args.rs:89:52
|
LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: u8, _sigpipe: u8) -> isize {
- | ^^ help: change the type from `u8` to `*const *const u8`
+ | ^^ expected `*const *const u8`, found `u8`
+ |
+ = note: expected signature `fn(fn() -> _, _, *const *const u8, _) -> _`
+ found signature `fn(fn() -> _, _, u8, _) -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_args.argv_inner_ptr.stderr b/tests/ui/lang-items/start_lang_item_args.argv_inner_ptr.stderr
index 08efd5088..7d002e090 100644
--- a/tests/ui/lang-items/start_lang_item_args.argv_inner_ptr.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.argv_inner_ptr.stderr
@@ -1,13 +1,12 @@
-error: parameter 3 of the `start` lang item is incorrect
+error[E0308]: lang item `start` function has wrong type
--> $DIR/start_lang_item_args.rs:82:52
|
LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const usize, _sigpipe: u8) -> isize {
- | ^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^ expected `u8`, found `usize`
|
-help: change the type from `*const *const usize` to `*const *const u8`
- |
-LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
- | ~~~~~~~~~~~~~~~~
+ = note: expected signature `fn(fn() -> _, _, *const *const u8, _) -> _`
+ found signature `fn(fn() -> _, _, *const *const usize, _) -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_args.main_args.stderr b/tests/ui/lang-items/start_lang_item_args.main_args.stderr
index c20a74466..91994b9d7 100644
--- a/tests/ui/lang-items/start_lang_item_args.main_args.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.main_args.stderr
@@ -1,13 +1,12 @@
-error: parameter 1 of the `start` lang item is incorrect
- --> $DIR/start_lang_item_args.rs:61:20
+error[E0308]: lang item `start` function has wrong type
+ --> $DIR/start_lang_item_args.rs:61:1
|
LL | fn start<T>(_main: fn(i32) -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
- | ^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
-help: change the type from `fn(i32) -> T` to `fn() -> T`
- |
-LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
- | ~~~~~~~~~
+ = note: expected signature `fn(fn() -> _, _, _, _) -> _`
+ found signature `fn(fn(i32) -> _, _, _, _) -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_args.main_ret.stderr b/tests/ui/lang-items/start_lang_item_args.main_ret.stderr
index 8f967252f..4582b6985 100644
--- a/tests/ui/lang-items/start_lang_item_args.main_ret.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.main_ret.stderr
@@ -1,13 +1,14 @@
-error: parameter 1 of the `start` lang item is incorrect
+error[E0308]: lang item `start` function has wrong type
--> $DIR/start_lang_item_args.rs:68:20
|
LL | fn start<T>(_main: fn() -> u16, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
- | ^^^^^^^^^^^
+ | - ^^^^^^^^^^^ expected type parameter `T`, found `u16`
+ | |
+ | this type parameter
|
-help: change the type from `fn() -> u16` to `fn() -> T`
- |
-LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
- | ~~~~~~~~~
+ = note: expected signature `fn(fn() -> T, _, _, _) -> _`
+ found signature `fn(fn() -> u16, _, _, _) -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_args.main_ty.stderr b/tests/ui/lang-items/start_lang_item_args.main_ty.stderr
index deb37b868..87940d05e 100644
--- a/tests/ui/lang-items/start_lang_item_args.main_ty.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.main_ty.stderr
@@ -1,8 +1,12 @@
-error: parameter 1 of the `start` lang item is incorrect
+error[E0308]: lang item `start` function has wrong type
--> $DIR/start_lang_item_args.rs:54:20
|
LL | fn start<T>(_main: u64, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
- | ^^^ help: change the type from `u64` to `fn() -> T`
+ | ^^^ expected fn pointer, found `u64`
+ |
+ = note: expected signature `fn(fn() -> T, _, _, _) -> _`
+ found signature `fn(u64, _, _, _) -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_args.missing_all_args.stderr b/tests/ui/lang-items/start_lang_item_args.missing_all_args.stderr
index 004c2a67f..5363871e2 100644
--- a/tests/ui/lang-items/start_lang_item_args.missing_all_args.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.missing_all_args.stderr
@@ -1,11 +1,12 @@
-error: incorrect number of parameters for the `start` lang item
+error[E0308]: lang item `start` function has wrong type
--> $DIR/start_lang_item_args.rs:15:1
|
LL | fn start<T>() -> isize {
- | ^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
- = note: the `start` lang item should have four parameters, but found 0
- = note: the `start` lang item should have the signature `fn(fn() -> T, isize, *const *const u8, u8) -> isize`
+ = note: expected signature `fn(fn() -> T, isize, *const *const u8, u8) -> _`
+ found signature `fn() -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_args.missing_ret.stderr b/tests/ui/lang-items/start_lang_item_args.missing_ret.stderr
index 1d8285b59..2bb29f911 100644
--- a/tests/ui/lang-items/start_lang_item_args.missing_ret.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.missing_ret.stderr
@@ -1,8 +1,12 @@
-error: the return type of the `start` lang item is incorrect
+error[E0308]: lang item `start` function has wrong type
--> $DIR/start_lang_item_args.rs:29:84
|
LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) {}
- | ^ help: change the type from `()` to `isize`
+ | ^ expected `isize`, found `()`
+ |
+ = note: expected signature `fn(fn() -> _, _, _, _) -> isize`
+ found signature `fn(fn() -> _, _, _, _)`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_args.missing_sigpipe_arg.stderr b/tests/ui/lang-items/start_lang_item_args.missing_sigpipe_arg.stderr
index e545a750f..f873f7614 100644
--- a/tests/ui/lang-items/start_lang_item_args.missing_sigpipe_arg.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.missing_sigpipe_arg.stderr
@@ -1,11 +1,12 @@
-error: incorrect number of parameters for the `start` lang item
+error[E0308]: lang item `start` function has wrong type
--> $DIR/start_lang_item_args.rs:22:1
|
LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
- = note: the `start` lang item should have four parameters, but found 3
- = note: the `start` lang item should have the signature `fn(fn() -> T, isize, *const *const u8, u8) -> isize`
+ = note: expected signature `fn(fn() -> T, isize, *const *const u8, u8) -> _`
+ found signature `fn(fn() -> T, isize, *const *const u8) -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_args.rs b/tests/ui/lang-items/start_lang_item_args.rs
index 0dbfba39c..4a0302bcb 100644
--- a/tests/ui/lang-items/start_lang_item_args.rs
+++ b/tests/ui/lang-items/start_lang_item_args.rs
@@ -13,33 +13,33 @@ pub trait Sized {}
#[cfg(missing_all_args)]
#[lang = "start"]
fn start<T>() -> isize {
- //[missing_all_args]~^ ERROR incorrect number of parameters
+ //[missing_all_args]~^ ERROR lang item `start` function has wrong type [E0308]
100
}
#[cfg(missing_sigpipe_arg)]
#[lang = "start"]
fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize {
- //[missing_sigpipe_arg]~^ ERROR incorrect number of parameters
+ //[missing_sigpipe_arg]~^ ERROR lang item `start` function has wrong type [E0308]
100
}
#[cfg(missing_ret)]
#[lang = "start"]
fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) {}
-//[missing_ret]~^ ERROR the return type of the `start` lang item is incorrect
+//[missing_ret]~^ ERROR lang item `start` function has wrong type [E0308]
#[cfg(start_ret)]
#[lang = "start"]
fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> u8 {
- //[start_ret]~^ ERROR the return type of the `start` lang item is incorrect
+ //[start_ret]~^ ERROR lang item `start` function has wrong type [E0308]
100
}
#[cfg(too_many_args)]
#[lang = "start"]
fn start<T>(
- //[too_many_args]~^ ERROR incorrect number of parameters
+ //[too_many_args]~^ ERROR lang item `start` function has wrong type [E0308]
_main: fn() -> T,
_argc: isize,
_argv: *const *const u8,
@@ -52,49 +52,49 @@ fn start<T>(
#[cfg(main_ty)]
#[lang = "start"]
fn start<T>(_main: u64, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
- //[main_ty]~^ ERROR parameter 1 of the `start` lang item is incorrect
+ //[main_ty]~^ ERROR lang item `start` function has wrong type [E0308]
100
}
#[cfg(main_args)]
#[lang = "start"]
fn start<T>(_main: fn(i32) -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
- //[main_args]~^ ERROR parameter 1 of the `start` lang item is incorrect
+ //[main_args]~^ ERROR lang item `start` function has wrong type [E0308]
100
}
#[cfg(main_ret)]
#[lang = "start"]
fn start<T>(_main: fn() -> u16, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
- //[main_ret]~^ ERROR parameter 1 of the `start` lang item is incorrect
+ //[main_ret]~^ ERROR lang item `start` function has wrong type [E0308]
100
}
#[cfg(argc)]
#[lang = "start"]
fn start<T>(_main: fn() -> T, _argc: i8, _argv: *const *const u8, _sigpipe: u8) -> isize {
- //[argc]~^ ERROR parameter 2 of the `start` lang item is incorrect
+ //[argc]~^ ERROR lang item `start` function has wrong type [E0308]
100
}
#[cfg(argv_inner_ptr)]
#[lang = "start"]
fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const usize, _sigpipe: u8) -> isize {
- //[argv_inner_ptr]~^ ERROR parameter 3 of the `start` lang item is incorrect
+ //[argv_inner_ptr]~^ ERROR lang item `start` function has wrong type [E0308]
100
}
#[cfg(argv)]
#[lang = "start"]
fn start<T>(_main: fn() -> T, _argc: isize, _argv: u8, _sigpipe: u8) -> isize {
- //[argv]~^ ERROR parameter 3 of the `start` lang item is incorrect
+ //[argv]~^ ERROR lang item `start` function has wrong type [E0308]
100
}
#[cfg(sigpipe)]
#[lang = "start"]
fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: i64) -> isize {
- //[sigpipe]~^ ERROR parameter 4 of the `start` lang item is incorrect
+ //[sigpipe]~^ ERROR lang item `start` function has wrong type [E0308]
100
}
diff --git a/tests/ui/lang-items/start_lang_item_args.sigpipe.stderr b/tests/ui/lang-items/start_lang_item_args.sigpipe.stderr
index b20ae3128..280d423bd 100644
--- a/tests/ui/lang-items/start_lang_item_args.sigpipe.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.sigpipe.stderr
@@ -1,8 +1,12 @@
-error: parameter 4 of the `start` lang item is incorrect
+error[E0308]: lang item `start` function has wrong type
--> $DIR/start_lang_item_args.rs:96:80
|
LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: i64) -> isize {
- | ^^^ help: change the type from `i64` to `u8`
+ | ^^^ expected `u8`, found `i64`
+ |
+ = note: expected signature `fn(fn() -> _, _, _, u8) -> _`
+ found signature `fn(fn() -> _, _, _, i64) -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_args.start_ret.stderr b/tests/ui/lang-items/start_lang_item_args.start_ret.stderr
index 935d5f3c8..4e4f8a5cd 100644
--- a/tests/ui/lang-items/start_lang_item_args.start_ret.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.start_ret.stderr
@@ -1,8 +1,12 @@
-error: the return type of the `start` lang item is incorrect
+error[E0308]: lang item `start` function has wrong type
--> $DIR/start_lang_item_args.rs:34:87
|
LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> u8 {
- | ^^ help: change the type from `u8` to `isize`
+ | ^^ expected `isize`, found `u8`
+ |
+ = note: expected signature `fn(fn() -> _, _, _, _) -> isize`
+ found signature `fn(fn() -> _, _, _, _) -> u8`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_args.too_many_args.stderr b/tests/ui/lang-items/start_lang_item_args.too_many_args.stderr
index 30a7ed18a..085d4b1f2 100644
--- a/tests/ui/lang-items/start_lang_item_args.too_many_args.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.too_many_args.stderr
@@ -1,4 +1,4 @@
-error: incorrect number of parameters for the `start` lang item
+error[E0308]: lang item `start` function has wrong type
--> $DIR/start_lang_item_args.rs:41:1
|
LL | / fn start<T>(
@@ -8,10 +8,11 @@ LL | | _argc: isize,
... |
LL | | _extra_arg: (),
LL | | ) -> isize {
- | |__________^
+ | |__________^ incorrect number of function parameters
|
- = note: the `start` lang item should have four parameters, but found 5
- = note: the `start` lang item should have the signature `fn(fn() -> T, isize, *const *const u8, u8) -> isize`
+ = note: expected signature `fn(fn() -> T, isize, *const *const u8, u8) -> _`
+ found signature `fn(fn() -> T, isize, *const *const u8, u8, ()) -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_with_target_feature.rs b/tests/ui/lang-items/start_lang_item_with_target_feature.rs
new file mode 100644
index 000000000..3052b7bb5
--- /dev/null
+++ b/tests/ui/lang-items/start_lang_item_with_target_feature.rs
@@ -0,0 +1,19 @@
+// only-x86_64
+// check-fail
+
+#![feature(lang_items, no_core, target_feature_11)]
+#![no_core]
+
+#[lang = "copy"]
+pub trait Copy {}
+#[lang = "sized"]
+pub trait Sized {}
+
+#[lang = "start"]
+#[target_feature(enable = "avx2")]
+//~^ ERROR `start` language item function is not allowed to have `#[target_feature]`
+fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
+ 0
+}
+
+fn main() {}
diff --git a/tests/ui/lang-items/start_lang_item_with_target_feature.stderr b/tests/ui/lang-items/start_lang_item_with_target_feature.stderr
new file mode 100644
index 000000000..ff55a1365
--- /dev/null
+++ b/tests/ui/lang-items/start_lang_item_with_target_feature.stderr
@@ -0,0 +1,11 @@
+error: `start` language item function is not allowed to have `#[target_feature]`
+ --> $DIR/start_lang_item_with_target_feature.rs:13:1
+ |
+LL | #[target_feature(enable = "avx2")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
+ | ------------------------------------------------------------------------------------------- `start` language item function is not allowed to have `#[target_feature]`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/late-bound-lifetimes/predicate-is-global.rs b/tests/ui/late-bound-lifetimes/predicate-is-global.rs
new file mode 100644
index 000000000..be017a3f9
--- /dev/null
+++ b/tests/ui/late-bound-lifetimes/predicate-is-global.rs
@@ -0,0 +1,40 @@
+// check-pass
+
+trait Foo {
+ type Assoc;
+
+ fn do_it(_: &Self::Assoc)
+ where
+ for<'a> Self: Baz<'a>;
+}
+
+trait Baz<'a>: Foo {}
+
+impl Foo for () {
+ type Assoc = Inherent;
+
+ // Ensure that the `for<'a> Self: Baz<'a>` predicate, which has
+ // a supertrait `for<'a> Self: Foo`, does not cause us to fail
+ // to normalize `Self::Assoc`.
+ fn do_it(x: &Self::Assoc)
+ where
+ for<'a> Self: Baz<'a>,
+ {
+ x.inherent();
+ }
+}
+
+struct Inherent;
+impl Inherent {
+ fn inherent(&self) {}
+}
+
+// This trivial bound doesn't hold, but the unused lifetime tripped up that check after #117589, and
+// showed up in its crater results (in `soa-derive 0.13.0`).
+fn do_it()
+where
+ for<'a> Inherent: Clone,
+{
+}
+
+fn main() {}
diff --git a/tests/ui/layout/debug.rs b/tests/ui/layout/debug.rs
index 46171880a..65f2f3b89 100644
--- a/tests/ui/layout/debug.rs
+++ b/tests/ui/layout/debug.rs
@@ -1,4 +1,4 @@
-// normalize-stderr-test "pref: Align\([1-8] bytes\)" -> "pref: $$PREF_ALIGN"
+// normalize-stderr-test "pref: Align\([1-8] bytes\)" -> "pref: $$SOME_ALIGN"
#![feature(never_type, rustc_attrs, type_alias_impl_trait, repr_simd)]
#![crate_type = "lib"]
@@ -17,6 +17,9 @@ type Test = Result<i32, i32>; //~ ERROR: layout_of
#[rustc_layout(debug)]
type T = impl std::fmt::Debug; //~ ERROR: layout_of
+fn f() -> T {
+ 0i32
+}
#[rustc_layout(debug)]
pub union V { //~ ERROR: layout_of
@@ -63,6 +66,13 @@ union P5 { zst: [u16; 0], byte: u8 } //~ ERROR: layout_of
#[rustc_layout(debug)]
type X = std::mem::MaybeUninit<u8>; //~ ERROR: layout_of
-fn f() -> T {
- 0i32
+#[rustc_layout(debug)]
+const C: () = (); //~ ERROR: can only be applied to
+
+impl S {
+ #[rustc_layout(debug)]
+ const C: () = (); //~ ERROR: can only be applied to
}
+
+#[rustc_layout(debug)]
+type Impossible = (str, str); //~ ERROR: cannot be known at compilation time
diff --git a/tests/ui/layout/debug.stderr b/tests/ui/layout/debug.stderr
index eeffb3c5f..5162a771b 100644
--- a/tests/ui/layout/debug.stderr
+++ b/tests/ui/layout/debug.stderr
@@ -2,7 +2,7 @@ error: layout_of(E) = Layout {
size: Size(12 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Aggregate {
sized: true,
@@ -40,7 +40,7 @@ error: layout_of(E) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Aggregate {
sized: true,
@@ -60,7 +60,7 @@ error: layout_of(E) = Layout {
size: Size(12 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Uninhabited,
fields: Arbitrary {
@@ -96,7 +96,7 @@ error: layout_of(S) = Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: ScalarPair(
Initialized {
@@ -117,13 +117,13 @@ error: layout_of(S) = Layout {
fields: Arbitrary {
offsets: [
Size(0 bytes),
- Size(0 bytes),
+ Size(8 bytes),
Size(4 bytes),
],
memory_index: [
- 1,
0,
2,
+ 1,
],
},
largest_niche: None,
@@ -142,7 +142,7 @@ error: layout_of(U) = Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Aggregate {
sized: true,
@@ -162,11 +162,11 @@ error: layout_of(U) = Layout {
LL | union U { f1: (i32, i32), f3: i32 }
| ^^^^^^^
-error: layout_of(std::result::Result<i32, i32>) = Layout {
+error: layout_of(Result<i32, i32>) = Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: ScalarPair(
Initialized {
@@ -217,7 +217,7 @@ error: layout_of(std::result::Result<i32, i32>) = Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: ScalarPair(
Initialized {
@@ -254,7 +254,7 @@ error: layout_of(std::result::Result<i32, i32>) = Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: ScalarPair(
Initialized {
@@ -301,7 +301,7 @@ error: layout_of(i32) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Scalar(
Initialized {
@@ -329,7 +329,7 @@ error: layout_of(V) = Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(2 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Aggregate {
sized: true,
@@ -344,7 +344,7 @@ error: layout_of(V) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(2 bytes),
}
- --> $DIR/debug.rs:22:1
+ --> $DIR/debug.rs:25:1
|
LL | pub union V {
| ^^^^^^^^^^^
@@ -353,7 +353,7 @@ error: layout_of(W) = Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(2 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Aggregate {
sized: true,
@@ -368,7 +368,7 @@ error: layout_of(W) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(2 bytes),
}
- --> $DIR/debug.rs:28:1
+ --> $DIR/debug.rs:31:1
|
LL | pub union W {
| ^^^^^^^^^^^
@@ -377,7 +377,7 @@ error: layout_of(Y) = Layout {
size: Size(0 bytes),
align: AbiAndPrefAlign {
abi: Align(2 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Aggregate {
sized: true,
@@ -392,7 +392,7 @@ error: layout_of(Y) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(2 bytes),
}
- --> $DIR/debug.rs:34:1
+ --> $DIR/debug.rs:37:1
|
LL | pub union Y {
| ^^^^^^^^^^^
@@ -401,7 +401,7 @@ error: layout_of(P1) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Aggregate {
sized: true,
@@ -416,7 +416,7 @@ error: layout_of(P1) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(1 bytes),
}
- --> $DIR/debug.rs:41:1
+ --> $DIR/debug.rs:44:1
|
LL | union P1 { x: u32 }
| ^^^^^^^^
@@ -425,7 +425,7 @@ error: layout_of(P2) = Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Aggregate {
sized: true,
@@ -440,7 +440,7 @@ error: layout_of(P2) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(1 bytes),
}
- --> $DIR/debug.rs:45:1
+ --> $DIR/debug.rs:48:1
|
LL | union P2 { x: (u32, u32) }
| ^^^^^^^^
@@ -449,7 +449,7 @@ error: layout_of(P3) = Layout {
size: Size(16 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Aggregate {
sized: true,
@@ -464,7 +464,7 @@ error: layout_of(P3) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(1 bytes),
}
- --> $DIR/debug.rs:53:1
+ --> $DIR/debug.rs:56:1
|
LL | union P3 { x: F32x4 }
| ^^^^^^^^
@@ -473,7 +473,7 @@ error: layout_of(P4) = Layout {
size: Size(12 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Aggregate {
sized: true,
@@ -488,7 +488,7 @@ error: layout_of(P4) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(1 bytes),
}
- --> $DIR/debug.rs:57:1
+ --> $DIR/debug.rs:60:1
|
LL | union P4 { x: E }
| ^^^^^^^^
@@ -497,7 +497,7 @@ error: layout_of(P5) = Layout {
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Scalar(
Union {
@@ -517,16 +517,16 @@ error: layout_of(P5) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(1 bytes),
}
- --> $DIR/debug.rs:61:1
+ --> $DIR/debug.rs:64:1
|
LL | union P5 { zst: [u16; 0], byte: u8 }
| ^^^^^^^^
-error: layout_of(std::mem::MaybeUninit<u8>) = Layout {
+error: layout_of(MaybeUninit<u8>) = Layout {
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Scalar(
Union {
@@ -546,10 +546,32 @@ error: layout_of(std::mem::MaybeUninit<u8>) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(1 bytes),
}
- --> $DIR/debug.rs:64:1
+ --> $DIR/debug.rs:67:1
|
LL | type X = std::mem::MaybeUninit<u8>;
| ^^^^^^
-error: aborting due to 14 previous errors
+error: `#[rustc_layout]` can only be applied to `struct`/`enum`/`union` declarations and type aliases
+ --> $DIR/debug.rs:70:1
+ |
+LL | const C: () = ();
+ | ^^^^^^^^^^^
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/debug.rs:78:19
+ |
+LL | type Impossible = (str, str);
+ | ^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `str`
+ = note: only the last element of a tuple may have a dynamically sized type
+
+error: `#[rustc_layout]` can only be applied to `struct`/`enum`/`union` declarations and type aliases
+ --> $DIR/debug.rs:74:5
+ |
+LL | const C: () = ();
+ | ^^^^^^^^^^^
+
+error: aborting due to 17 previous errors
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/layout/enum.rs b/tests/ui/layout/enum.rs
new file mode 100644
index 000000000..7ac2eaa86
--- /dev/null
+++ b/tests/ui/layout/enum.rs
@@ -0,0 +1,18 @@
+// normalize-stderr-test "pref: Align\([1-8] bytes\)" -> "pref: $$PREF_ALIGN"
+//! Various enum layout tests.
+
+#![feature(rustc_attrs)]
+#![feature(never_type)]
+#![crate_type = "lib"]
+
+#[rustc_layout(align)]
+enum UninhabitedVariantAlign { //~ERROR: abi: Align(2 bytes)
+ A([u8; 32]),
+ B([u16; 0], !), // make sure alignment in uninhabited fields is respected
+}
+
+#[rustc_layout(size)]
+enum UninhabitedVariantSpace { //~ERROR: size: Size(16 bytes)
+ A,
+ B([u8; 15], !), // make sure there is space being reserved for this field.
+}
diff --git a/tests/ui/layout/enum.stderr b/tests/ui/layout/enum.stderr
new file mode 100644
index 000000000..d6bc7780c
--- /dev/null
+++ b/tests/ui/layout/enum.stderr
@@ -0,0 +1,14 @@
+error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIGN }
+ --> $DIR/enum.rs:9:1
+ |
+LL | enum UninhabitedVariantAlign {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: size: Size(16 bytes)
+ --> $DIR/enum.rs:15:1
+ |
+LL | enum UninhabitedVariantSpace {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/layout/homogeneous-aggr-transparent.rs b/tests/ui/layout/homogeneous-aggr-transparent.rs
new file mode 100644
index 000000000..9703d2bf2
--- /dev/null
+++ b/tests/ui/layout/homogeneous-aggr-transparent.rs
@@ -0,0 +1,44 @@
+#![feature(rustc_attrs)]
+#![feature(transparent_unions)]
+use std::marker::PhantomData;
+
+// Regression test for #115664. We want to ensure that `repr(transparent)` wrappers do not affect
+// the result of `homogeneous_aggregate`.
+
+type Tuple = (f32, f32, f32);
+
+struct Zst;
+
+#[repr(transparent)]
+struct Wrapper1<T>(T);
+#[repr(transparent)]
+struct Wrapper2<T>((), Zst, T);
+#[repr(transparent)]
+struct Wrapper3<T>(T, [u8; 0], PhantomData<u64>);
+#[repr(transparent)]
+union WrapperUnion<T: Copy> {
+ nothing: (),
+ something: T,
+}
+
+#[rustc_layout(homogeneous_aggregate)]
+pub type Test0 = Tuple;
+//~^ ERROR homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
+
+#[rustc_layout(homogeneous_aggregate)]
+pub type Test1 = Wrapper1<Tuple>;
+//~^ ERROR homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
+
+#[rustc_layout(homogeneous_aggregate)]
+pub type Test2 = Wrapper2<Tuple>;
+//~^ ERROR homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
+
+#[rustc_layout(homogeneous_aggregate)]
+pub type Test3 = Wrapper3<Tuple>;
+//~^ ERROR homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
+
+#[rustc_layout(homogeneous_aggregate)]
+pub type Test4 = WrapperUnion<Tuple>;
+//~^ ERROR homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
+
+fn main() {}
diff --git a/tests/ui/layout/homogeneous-aggr-transparent.stderr b/tests/ui/layout/homogeneous-aggr-transparent.stderr
new file mode 100644
index 000000000..99eb703ac
--- /dev/null
+++ b/tests/ui/layout/homogeneous-aggr-transparent.stderr
@@ -0,0 +1,32 @@
+error: homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
+ --> $DIR/homogeneous-aggr-transparent.rs:25:1
+ |
+LL | pub type Test0 = Tuple;
+ | ^^^^^^^^^^^^^^
+
+error: homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
+ --> $DIR/homogeneous-aggr-transparent.rs:29:1
+ |
+LL | pub type Test1 = Wrapper1<Tuple>;
+ | ^^^^^^^^^^^^^^
+
+error: homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
+ --> $DIR/homogeneous-aggr-transparent.rs:33:1
+ |
+LL | pub type Test2 = Wrapper2<Tuple>;
+ | ^^^^^^^^^^^^^^
+
+error: homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
+ --> $DIR/homogeneous-aggr-transparent.rs:37:1
+ |
+LL | pub type Test3 = Wrapper3<Tuple>;
+ | ^^^^^^^^^^^^^^
+
+error: homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
+ --> $DIR/homogeneous-aggr-transparent.rs:41:1
+ |
+LL | pub type Test4 = WrapperUnion<Tuple>;
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to 5 previous errors
+
diff --git a/tests/ui/layout/layout-cycle.rs b/tests/ui/layout/layout-cycle.rs
new file mode 100644
index 000000000..85685058e
--- /dev/null
+++ b/tests/ui/layout/layout-cycle.rs
@@ -0,0 +1,31 @@
+// build-fail
+//~^ ERROR: a cycle occurred during layout computation
+//~| ERROR: cycle detected when computing layout of
+
+// Issue #111176 -- ensure that we do not emit ICE on layout cycles
+
+use std::mem;
+
+pub struct S<T: Tr> {
+ pub f: <T as Tr>::I,
+}
+
+pub trait Tr {
+ type I: Tr;
+}
+
+impl<T: Tr> Tr for S<T> {
+ type I = S<S<T>>;
+}
+
+impl Tr for () {
+ type I = ();
+}
+
+fn foo<T: Tr>() -> usize {
+ mem::size_of::<S<T>>()
+}
+
+fn main() {
+ println!("{}", foo::<S<()>>());
+}
diff --git a/tests/ui/layout/layout-cycle.stderr b/tests/ui/layout/layout-cycle.stderr
new file mode 100644
index 000000000..a3cdb7edc
--- /dev/null
+++ b/tests/ui/layout/layout-cycle.stderr
@@ -0,0 +1,11 @@
+error[E0391]: cycle detected when computing layout of `S<S<()>>`
+ |
+ = note: ...which requires computing layout of `<S<()> as Tr>::I`...
+ = note: ...which again requires computing layout of `S<S<()>>`, completing the cycle
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
+
+error: failed to get layout for S<S<()>>: a cycle occurred during layout computation
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/layout/struct.rs b/tests/ui/layout/struct.rs
new file mode 100644
index 000000000..e74cf5a95
--- /dev/null
+++ b/tests/ui/layout/struct.rs
@@ -0,0 +1,12 @@
+// normalize-stderr-test "pref: Align\([1-8] bytes\)" -> "pref: $$PREF_ALIGN"
+//! Various struct layout tests.
+
+#![feature(rustc_attrs)]
+#![feature(never_type)]
+#![crate_type = "lib"]
+
+#[rustc_layout(abi)]
+struct AlignedZstPreventsScalar(i16, [i32; 0]); //~ERROR: abi: Aggregate
+
+#[rustc_layout(abi)]
+struct AlignedZstButStillScalar(i32, [i16; 0]); //~ERROR: abi: Scalar
diff --git a/tests/ui/layout/struct.stderr b/tests/ui/layout/struct.stderr
new file mode 100644
index 000000000..b61c9a99c
--- /dev/null
+++ b/tests/ui/layout/struct.stderr
@@ -0,0 +1,14 @@
+error: abi: Aggregate { sized: true }
+ --> $DIR/struct.rs:9:1
+ |
+LL | struct AlignedZstPreventsScalar(i16, [i32; 0]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: abi: Scalar(Initialized { value: Int(I32, true), valid_range: 0..=4294967295 })
+ --> $DIR/struct.rs:12:1
+ |
+LL | struct AlignedZstButStillScalar(i32, [i16; 0]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/layout/zero-sized-array-enum-niche.stderr b/tests/ui/layout/zero-sized-array-enum-niche.stderr
index df9f1cc8d..8161f97dd 100644
--- a/tests/ui/layout/zero-sized-array-enum-niche.stderr
+++ b/tests/ui/layout/zero-sized-array-enum-niche.stderr
@@ -1,4 +1,4 @@
-error: layout_of(std::result::Result<[u32; 0], bool>) = Layout {
+error: layout_of(Result<[u32; 0], bool>) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
@@ -232,7 +232,7 @@ error: layout_of(MultipleAlignments) = Layout {
LL | enum MultipleAlignments {
| ^^^^^^^^^^^^^^^^^^^^^^^
-error: layout_of(std::result::Result<[u32; 0], Packed<std::num::NonZeroU16>>) = Layout {
+error: layout_of(Result<[u32; 0], Packed<NonZeroU16>>) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
@@ -337,7 +337,7 @@ error: layout_of(std::result::Result<[u32; 0], Packed<std::num::NonZeroU16>>) =
LL | type NicheLosesToTagged = Result<[u32; 0], Packed<std::num::NonZeroU16>>;
| ^^^^^^^^^^^^^^^^^^^^^^^
-error: layout_of(std::result::Result<[u32; 0], Packed<U16IsZero>>) = Layout {
+error: layout_of(Result<[u32; 0], Packed<U16IsZero>>) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
diff --git a/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr
index 9e0e2bfa8..3b216ac15 100644
--- a/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr
+++ b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr
@@ -1,14 +1,14 @@
error[E0277]: the trait bound `String: Copy` is not satisfied
- --> $DIR/extern-crate-has-lazy-type-aliases.rs:15:12
+ --> $DIR/extern-crate-has-lazy-type-aliases.rs:15:24
|
LL | let _: lazy::Alias<String>;
- | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
+ | ^^^^^^ the trait `Copy` is not implemented for `String`
|
-note: required by a bound on the type alias `Alias`
+note: required by a bound in `lazy::Alias`
--> $DIR/auxiliary/lazy.rs:4:19
|
LL | pub type Alias<T: Copy> = Option<T>;
- | ^^^^ required by this bound
+ | ^^^^ required by this bound in `Alias`
error: aborting due to previous error
diff --git a/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr
index 9e0e2bfa8..3b216ac15 100644
--- a/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr
+++ b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr
@@ -1,14 +1,14 @@
error[E0277]: the trait bound `String: Copy` is not satisfied
- --> $DIR/extern-crate-has-lazy-type-aliases.rs:15:12
+ --> $DIR/extern-crate-has-lazy-type-aliases.rs:15:24
|
LL | let _: lazy::Alias<String>;
- | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
+ | ^^^^^^ the trait `Copy` is not implemented for `String`
|
-note: required by a bound on the type alias `Alias`
+note: required by a bound in `lazy::Alias`
--> $DIR/auxiliary/lazy.rs:4:19
|
LL | pub type Alias<T: Copy> = Option<T>;
- | ^^^^ required by this bound
+ | ^^^^ required by this bound in `Alias`
error: aborting due to previous error
diff --git a/tests/ui/lazy-type-alias/trailing-where-clause.stderr b/tests/ui/lazy-type-alias/trailing-where-clause.stderr
index d7606ba6b..193f80b23 100644
--- a/tests/ui/lazy-type-alias/trailing-where-clause.stderr
+++ b/tests/ui/lazy-type-alias/trailing-where-clause.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `String: From<()>` is not satisfied
- --> $DIR/trailing-where-clause.rs:12:12
+ --> $DIR/trailing-where-clause.rs:12:18
|
LL | let _: Alias<()>;
- | ^^^^^^^^^ the trait `From<()>` is not implemented for `String`
+ | ^^ the trait `From<()>` is not implemented for `String`
|
= help: the following other types implement trait `From<T>`:
<String as From<char>>
@@ -11,11 +11,14 @@ LL | let _: Alias<()>;
<String as From<&str>>
<String as From<&mut str>>
<String as From<&String>>
-note: required by a bound on the type alias `Alias`
+note: required by a bound in `Alias`
--> $DIR/trailing-where-clause.rs:8:13
|
+LL | type Alias<T> = T
+ | ----- required by a bound in this type alias
+LL | where
LL | String: From<T>;
- | ^^^^^^^ required by this bound
+ | ^^^^^^^ required by this bound in `Alias`
error: aborting due to previous error
diff --git a/tests/ui/lifetimes/anonymize-unnamed-bound-vars-in-binders.rs b/tests/ui/lifetimes/anonymize-unnamed-bound-vars-in-binders.rs
new file mode 100644
index 000000000..05e3763e9
--- /dev/null
+++ b/tests/ui/lifetimes/anonymize-unnamed-bound-vars-in-binders.rs
@@ -0,0 +1,27 @@
+// build-pass
+// issue: #115807
+
+trait Chip: for<'a> TraitWithLifetime<'a> + SomeMarker {
+ fn compute(&self);
+}
+
+trait SomeMarker {}
+
+trait TraitWithLifetime<'a>: SomeMarker {}
+
+trait Machine {
+ fn run();
+}
+
+struct BasicMachine;
+
+impl Machine for BasicMachine {
+ fn run() {
+ let chips: [&dyn Chip; 0] = [];
+ let _ = chips.map(|chip| chip.compute());
+ }
+}
+
+fn main() {
+ BasicMachine::run();
+}
diff --git a/tests/ui/lifetimes/issue-95023.stderr b/tests/ui/lifetimes/issue-95023.stderr
index 5b93eff86..6361d8ad3 100644
--- a/tests/ui/lifetimes/issue-95023.stderr
+++ b/tests/ui/lifetimes/issue-95023.stderr
@@ -36,7 +36,7 @@ error[E0220]: associated type `B` not found for `Self`
--> $DIR/issue-95023.rs:6:44
|
LL | fn foo<const N: usize>(&self) -> Self::B<{N}>;
- | ^ associated type `B` not found
+ | ^ help: `Self` has the following associated type: `Output`
error: aborting due to 5 previous errors
diff --git a/tests/ui/lifetimes/lifetime-elision-return-type-trait.stderr b/tests/ui/lifetimes/lifetime-elision-return-type-trait.stderr
index ef1127c59..421ab3fcf 100644
--- a/tests/ui/lifetimes/lifetime-elision-return-type-trait.stderr
+++ b/tests/ui/lifetimes/lifetime-elision-return-type-trait.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `Result<(), _>: Future` is not satisfied
|
LL | fn foo() -> impl Future<Item=(), Error=Box<dyn Error>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Future` is not implemented for `Result<(), _>`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/lifetime-elision-return-type-trait.rs:1:1
+ |
+LL | trait Future {
+ | ^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/lifetimes/unusual-rib-combinations.stderr b/tests/ui/lifetimes/unusual-rib-combinations.stderr
index 01ec69a61..92a2ef2f4 100644
--- a/tests/ui/lifetimes/unusual-rib-combinations.stderr
+++ b/tests/ui/lifetimes/unusual-rib-combinations.stderr
@@ -56,7 +56,7 @@ LL | fn d<const C: S>() {}
| ^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `&dyn for<'a> Foo<'a>` is forbidden as the type of a const generic parameter
--> $DIR/unusual-rib-combinations.rs:29:21
@@ -65,7 +65,7 @@ LL | struct Bar<const N: &'a (dyn for<'a> Foo<'a>)>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 9 previous errors
diff --git a/tests/ui/limits/issue-55878.stderr b/tests/ui/limits/issue-55878.stderr
index 510b36edd..93716c0b3 100644
--- a/tests/ui/limits/issue-55878.stderr
+++ b/tests/ui/limits/issue-55878.stderr
@@ -1,6 +1,8 @@
-error[E0080]: values of the type `[u8; usize::MAX]` are too big for the current architecture
+error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
|
+ = note: values of the type `[u8; usize::MAX]` are too big for the current architecture
+ |
note: inside `std::mem::size_of::<[u8; usize::MAX]>`
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
note: inside `main`
@@ -9,7 +11,7 @@ note: inside `main`
LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/issue-55878.rs:7:26
|
LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>());
@@ -17,7 +19,7 @@ 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
+note: erroneous constant encountered
--> $DIR/issue-55878.rs:7:26
|
LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>());
diff --git a/tests/ui/limits/issue-56762.rs b/tests/ui/limits/issue-56762.rs
index ed7ee4da8..1c7facb04 100644
--- a/tests/ui/limits/issue-56762.rs
+++ b/tests/ui/limits/issue-56762.rs
@@ -14,8 +14,10 @@ impl TooBigArray {
}
static MY_TOO_BIG_ARRAY_1: TooBigArray = TooBigArray::new();
-//~^ ERROR values of the type `[u8; 2305843009213693951]` are too big
+//~^ ERROR could not evaluate static initializer
+//~| too big
static MY_TOO_BIG_ARRAY_2: [u8; HUGE_SIZE] = [0x00; HUGE_SIZE];
-//~^ ERROR values of the type `[u8; 2305843009213693951]` are too big
+//~^ ERROR could not evaluate static initializer
+//~| too big
fn main() { }
diff --git a/tests/ui/limits/issue-56762.stderr b/tests/ui/limits/issue-56762.stderr
index 29f2a8859..3a6c3559a 100644
--- a/tests/ui/limits/issue-56762.stderr
+++ b/tests/ui/limits/issue-56762.stderr
@@ -1,14 +1,14 @@
-error[E0080]: values of the type `[u8; 2305843009213693951]` are too big for the current architecture
+error[E0080]: could not evaluate static initializer
--> $DIR/issue-56762.rs:16:1
|
LL | static MY_TOO_BIG_ARRAY_1: TooBigArray = TooBigArray::new();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ values of the type `[u8; 2305843009213693951]` are too big for the current architecture
-error[E0080]: values of the type `[u8; 2305843009213693951]` are too big for the current architecture
- --> $DIR/issue-56762.rs:18:1
+error[E0080]: could not evaluate static initializer
+ --> $DIR/issue-56762.rs:19:1
|
LL | static MY_TOO_BIG_ARRAY_2: [u8; HUGE_SIZE] = [0x00; HUGE_SIZE];
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ values of the type `[u8; 2305843009213693951]` are too big for the current architecture
error: aborting due to 2 previous errors
diff --git a/tests/ui/linkage-attr/common-linkage-non-zero-init.rs b/tests/ui/linkage-attr/common-linkage-non-zero-init.rs
new file mode 100644
index 000000000..ce8d9848e
--- /dev/null
+++ b/tests/ui/linkage-attr/common-linkage-non-zero-init.rs
@@ -0,0 +1,14 @@
+// build-fail
+// failure-status: 101
+// known-bug: #109681
+
+// This test verifies that we continue to hit the LLVM error for common linkage with non-zero
+// initializers, since it generates invalid LLVM IR.
+// Linkages are internal features marked as perma-unstable, so we don't need to fix the issue
+// for now.
+#![crate_type="lib"]
+#![feature(linkage)]
+
+#[linkage = "common"]
+#[no_mangle]
+pub static TEST: bool = true;
diff --git a/tests/ui/linkage-attr/common-linkage-non-zero-init.stderr b/tests/ui/linkage-attr/common-linkage-non-zero-init.stderr
new file mode 100644
index 000000000..667bb3ec1
--- /dev/null
+++ b/tests/ui/linkage-attr/common-linkage-non-zero-init.stderr
@@ -0,0 +1,3 @@
+'common' global must have a zero initializer!
+ptr @TEST
+LLVM ERROR: Broken module found, compilation aborted!
diff --git a/tests/ui/lint-group-forbid-always-trumps-cli.stderr b/tests/ui/lint-group-forbid-always-trumps-cli.stderr
index 8910af87c..cd042179c 100644
--- a/tests/ui/lint-group-forbid-always-trumps-cli.stderr
+++ b/tests/ui/lint-group-forbid-always-trumps-cli.stderr
@@ -5,6 +5,7 @@ LL | let x = 1;
| ^ help: if this is intentional, prefix it with an underscore: `_x`
|
= note: `-F unused-variables` implied by `-F unused`
+ = help: to override `-F unused` add `#[allow(unused_variables)]`
error: aborting due to previous error
diff --git a/tests/ui/lint/cli-unknown-force-warn.rs b/tests/ui/lint/cli-unknown-force-warn.rs
index f3dea87a6..a9e4e4a60 100644
--- a/tests/ui/lint/cli-unknown-force-warn.rs
+++ b/tests/ui/lint/cli-unknown-force-warn.rs
@@ -1,7 +1,11 @@
// Checks that rustc correctly errors when passed an invalid lint with
// `--force-warn`. This is a regression test for issue #86958.
-//
+
+// check-pass
// compile-flags: --force-warn foo-qux
+
// error-pattern: unknown lint: `foo_qux`
+// error-pattern: requested on the command line with `--force-warn foo_qux`
+// error-pattern: `#[warn(unknown_lints)]` on by default
fn main() {}
diff --git a/tests/ui/lint/cli-unknown-force-warn.stderr b/tests/ui/lint/cli-unknown-force-warn.stderr
index 9ce9f405a..2ee718a8c 100644
--- a/tests/ui/lint/cli-unknown-force-warn.stderr
+++ b/tests/ui/lint/cli-unknown-force-warn.stderr
@@ -1,11 +1,16 @@
-error[E0602]: unknown lint: `foo_qux`
+warning[E0602]: unknown lint: `foo_qux`
|
= note: requested on the command line with `--force-warn foo_qux`
+ = note: `#[warn(unknown_lints)]` on by default
-error[E0602]: unknown lint: `foo_qux`
+warning[E0602]: unknown lint: `foo_qux`
|
= note: requested on the command line with `--force-warn foo_qux`
-error: aborting due to 2 previous errors
+warning[E0602]: unknown lint: `foo_qux`
+ |
+ = note: requested on the command line with `--force-warn foo_qux`
+
+warning: 3 warnings emitted
For more information about this error, try `rustc --explain E0602`.
diff --git a/tests/ui/lint/command-line-lint-group-deny.stderr b/tests/ui/lint/command-line-lint-group-deny.stderr
index 04c3f6f26..59d8429ea 100644
--- a/tests/ui/lint/command-line-lint-group-deny.stderr
+++ b/tests/ui/lint/command-line-lint-group-deny.stderr
@@ -5,6 +5,7 @@ LL | let _InappropriateCamelCasing = true;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `_inappropriate_camel_casing`
|
= note: `-D non-snake-case` implied by `-D bad-style`
+ = help: to override `-D bad-style` add `#[allow(non_snake_case)]`
error: aborting due to previous error
diff --git a/tests/ui/lint/command-line-lint-group-forbid.stderr b/tests/ui/lint/command-line-lint-group-forbid.stderr
index 736782140..486d32a9f 100644
--- a/tests/ui/lint/command-line-lint-group-forbid.stderr
+++ b/tests/ui/lint/command-line-lint-group-forbid.stderr
@@ -5,6 +5,7 @@ LL | let _InappropriateCamelCasing = true;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `_inappropriate_camel_casing`
|
= note: `-F non-snake-case` implied by `-F bad-style`
+ = help: to override `-F bad-style` add `#[allow(non_snake_case)]`
error: aborting due to previous error
diff --git a/tests/ui/lint/command-line-lint-group-warn.stderr b/tests/ui/lint/command-line-lint-group-warn.stderr
index e9c80b4ef..cfe346a5b 100644
--- a/tests/ui/lint/command-line-lint-group-warn.stderr
+++ b/tests/ui/lint/command-line-lint-group-warn.stderr
@@ -5,6 +5,7 @@ LL | let _InappropriateCamelCasing = true;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `_inappropriate_camel_casing`
|
= note: `-W non-snake-case` implied by `-W bad-style`
+ = help: to override `-W bad-style` add `#[allow(non_snake_case)]`
warning: 1 warning emitted
diff --git a/tests/ui/lint/expr-field.rs b/tests/ui/lint/expr-field.rs
new file mode 100644
index 000000000..638fbf521
--- /dev/null
+++ b/tests/ui/lint/expr-field.rs
@@ -0,0 +1,15 @@
+// check-pass
+
+pub struct A {
+ pub x: u32,
+}
+
+#[deny(unused_comparisons)]
+pub fn foo(y: u32) -> A {
+ A {
+ #[allow(unused_comparisons)]
+ x: if y < 0 { 1 } else { 2 },
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr b/tests/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr
index d1b764b34..01c2ed84c 100644
--- a/tests/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr
+++ b/tests/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr
@@ -7,6 +7,7 @@ LL | 0...100 => true,
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
= note: `--force-warn ellipsis-inclusive-range-patterns` implied by `--force-warn rust-2021-compatibility`
+ = help: to override `--force-warn rust-2021-compatibility` add `#[allow(ellipsis_inclusive_range_patterns)]`
warning: 1 warning emitted
diff --git a/tests/ui/lint/force-warn/lint-group-allow-warnings.stderr b/tests/ui/lint/force-warn/lint-group-allow-warnings.stderr
index dc7b1b7b9..e925a195f 100644
--- a/tests/ui/lint/force-warn/lint-group-allow-warnings.stderr
+++ b/tests/ui/lint/force-warn/lint-group-allow-warnings.stderr
@@ -5,6 +5,7 @@ LL | pub fn FUNCTION() {}
| ^^^^^^^^ help: convert the identifier to snake case: `function`
|
= note: `--force-warn non-snake-case` implied by `--force-warn nonstandard-style`
+ = help: to override `--force-warn nonstandard-style` add `#[allow(non_snake_case)]`
warning: 1 warning emitted
diff --git a/tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr b/tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr
index e17630fd3..b0cd3ddd2 100644
--- a/tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr
+++ b/tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr
@@ -7,6 +7,7 @@ LL | pub fn function(_x: Box<SomeTrait>) {}
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
= note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms`
+ = help: to override `--force-warn rust-2018-idioms` add `#[allow(bare_trait_objects)]`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
diff --git a/tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr b/tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr
index 72198541a..8c841916c 100644
--- a/tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr
+++ b/tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr
@@ -7,6 +7,7 @@ LL | pub fn function(_x: Box<SomeTrait>) {}
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
= note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms`
+ = help: to override `--force-warn rust-2018-idioms` add `#[allow(bare_trait_objects)]`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
diff --git a/tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr b/tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr
index 52c870ac2..c0144205d 100644
--- a/tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr
+++ b/tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr
@@ -7,6 +7,7 @@ LL | pub fn function(_x: Box<SomeTrait>) {}
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
= note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms`
+ = help: to override `--force-warn rust-2018-idioms` add `#[allow(bare_trait_objects)]`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
diff --git a/tests/ui/lint/future-incompat-test.stderr b/tests/ui/lint/future-incompat-test.stderr
index 52674a843..2951f904f 100644
--- a/tests/ui/lint/future-incompat-test.stderr
+++ b/tests/ui/lint/future-incompat-test.stderr
@@ -6,4 +6,5 @@ LL | let x = 1;
| ^ help: if this is intentional, prefix it with an underscore: `_x`
|
= note: `-A unused-variables` implied by `-A unused`
+ = help: to override `-A unused` add `#[allow(unused_variables)]`
diff --git a/tests/ui/lint/invalid_from_utf8.rs b/tests/ui/lint/invalid_from_utf8.rs
index 9c8c63681..43ceffb71 100644
--- a/tests/ui/lint/invalid_from_utf8.rs
+++ b/tests/ui/lint/invalid_from_utf8.rs
@@ -1,6 +1,8 @@
// check-pass
+#![feature(inline_const)]
#![feature(concat_bytes)]
+
#![warn(invalid_from_utf8_unchecked)]
#![warn(invalid_from_utf8)]
@@ -90,4 +92,29 @@ pub fn from_utf8() {
}
}
+pub fn from_utf8_with_indirections() {
+ let mut a = [99, 108, 130, 105, 112, 112, 121];
+ std::str::from_utf8_mut(&mut a);
+ //~^ WARN calls to `std::str::from_utf8_mut`
+ let mut b = &mut a;
+ let mut c = b;
+ std::str::from_utf8_mut(c);
+ //~^ WARN calls to `std::str::from_utf8_mut`
+ let mut c = &[99, 108, 130, 105, 112, 112, 121];
+ std::str::from_utf8(c);
+ //~^ WARN calls to `std::str::from_utf8`
+ const INVALID_1: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
+ std::str::from_utf8(&INVALID_1);
+ //~^ WARN calls to `std::str::from_utf8`
+ static INVALID_2: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
+ std::str::from_utf8(&INVALID_2);
+ //~^ WARN calls to `std::str::from_utf8`
+ const INVALID_3: &'static [u8; 7] = &[99, 108, 130, 105, 112, 112, 121];
+ std::str::from_utf8(INVALID_3);
+ //~^ WARN calls to `std::str::from_utf8`
+ const INVALID_4: &'static [u8; 7] = { &[99, 108, 130, 105, 112, 112, 121] };
+ std::str::from_utf8(INVALID_4);
+ //~^ WARN calls to `std::str::from_utf8`
+}
+
fn main() {}
diff --git a/tests/ui/lint/invalid_from_utf8.stderr b/tests/ui/lint/invalid_from_utf8.stderr
index 8e00d3bf8..884165d4f 100644
--- a/tests/ui/lint/invalid_from_utf8.stderr
+++ b/tests/ui/lint/invalid_from_utf8.stderr
@@ -1,43 +1,43 @@
warning: calls to `std::str::from_utf8_unchecked_mut` with a invalid literal are undefined behavior
- --> $DIR/invalid_from_utf8.rs:19:9
+ --> $DIR/invalid_from_utf8.rs:21:9
|
LL | std::str::from_utf8_unchecked_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------^
- | |
- | the literal was valid UTF-8 up to the 2 bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
+ | |
+ | the literal was valid UTF-8 up to the 2 bytes
|
note: the lint level is defined here
- --> $DIR/invalid_from_utf8.rs:4:9
+ --> $DIR/invalid_from_utf8.rs:6:9
|
LL | #![warn(invalid_from_utf8_unchecked)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: calls to `std::str::from_utf8_unchecked_mut` with a invalid literal are undefined behavior
- --> $DIR/invalid_from_utf8.rs:21:9
+ --> $DIR/invalid_from_utf8.rs:23:9
|
LL | std::str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------------------------------------------------^
- | |
- | the literal was valid UTF-8 up to the 2 bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
+ | |
+ | the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior
- --> $DIR/invalid_from_utf8.rs:39:9
+ --> $DIR/invalid_from_utf8.rs:41:9
|
LL | std::str::from_utf8_unchecked(&[99, 108, 130, 105, 112, 112, 121]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------------------^
- | |
- | the literal was valid UTF-8 up to the 2 bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
+ | |
+ | the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior
- --> $DIR/invalid_from_utf8.rs:41:9
+ --> $DIR/invalid_from_utf8.rs:43:9
|
LL | std::str::from_utf8_unchecked(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------------------^
- | |
- | the literal was valid UTF-8 up to the 2 bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
+ | |
+ | the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior
- --> $DIR/invalid_from_utf8.rs:43:9
+ --> $DIR/invalid_from_utf8.rs:45:9
|
LL | std::str::from_utf8_unchecked(b"cl\x82ippy");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------^
@@ -45,7 +45,7 @@ LL | std::str::from_utf8_unchecked(b"cl\x82ippy");
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior
- --> $DIR/invalid_from_utf8.rs:45:9
+ --> $DIR/invalid_from_utf8.rs:47:9
|
LL | std::str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------^
@@ -53,45 +53,45 @@ LL | std::str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy"));
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error
- --> $DIR/invalid_from_utf8.rs:62:9
+ --> $DIR/invalid_from_utf8.rs:64:9
|
LL | std::str::from_utf8_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------^
- | |
- | the literal was valid UTF-8 up to the 2 bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
+ | |
+ | the literal was valid UTF-8 up to the 2 bytes
|
note: the lint level is defined here
- --> $DIR/invalid_from_utf8.rs:5:9
+ --> $DIR/invalid_from_utf8.rs:7:9
|
LL | #![warn(invalid_from_utf8)]
| ^^^^^^^^^^^^^^^^^
warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error
- --> $DIR/invalid_from_utf8.rs:64:9
+ --> $DIR/invalid_from_utf8.rs:66:9
|
LL | std::str::from_utf8_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
- | ^^^^^^^^^^^^^^^^^^^^^^^^--------------------------------------------------^
- | |
- | the literal was valid UTF-8 up to the 2 bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
+ | |
+ | the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8` with a invalid literal always return an error
- --> $DIR/invalid_from_utf8.rs:82:9
+ --> $DIR/invalid_from_utf8.rs:84:9
|
LL | std::str::from_utf8(&[99, 108, 130, 105, 112, 112, 121]);
- | ^^^^^^^^^^^^^^^^^^^^-----------------------------------^
- | |
- | the literal was valid UTF-8 up to the 2 bytes
+ | ^^^^^^^^^^^^^^^^^^^^^----------------------------------^
+ | |
+ | the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8` with a invalid literal always return an error
- --> $DIR/invalid_from_utf8.rs:84:9
+ --> $DIR/invalid_from_utf8.rs:86:9
|
LL | std::str::from_utf8(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
- | ^^^^^^^^^^^^^^^^^^^^----------------------------------------------^
- | |
- | the literal was valid UTF-8 up to the 2 bytes
+ | ^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
+ | |
+ | the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8` with a invalid literal always return an error
- --> $DIR/invalid_from_utf8.rs:86:9
+ --> $DIR/invalid_from_utf8.rs:88:9
|
LL | std::str::from_utf8(b"cl\x82ippy");
| ^^^^^^^^^^^^^^^^^^^^-------------^
@@ -99,12 +99,69 @@ LL | std::str::from_utf8(b"cl\x82ippy");
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8` with a invalid literal always return an error
- --> $DIR/invalid_from_utf8.rs:88:9
+ --> $DIR/invalid_from_utf8.rs:90:9
|
LL | std::str::from_utf8(concat_bytes!(b"cl", b"\x82ippy"));
| ^^^^^^^^^^^^^^^^^^^^---------------------------------^
| |
| the literal was valid UTF-8 up to the 2 bytes
-warning: 12 warnings emitted
+warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error
+ --> $DIR/invalid_from_utf8.rs:97:5
+ |
+LL | let mut a = [99, 108, 130, 105, 112, 112, 121];
+ | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
+LL | std::str::from_utf8_mut(&mut a);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error
+ --> $DIR/invalid_from_utf8.rs:101:5
+ |
+LL | let mut a = [99, 108, 130, 105, 112, 112, 121];
+ | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
+...
+LL | std::str::from_utf8_mut(c);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: calls to `std::str::from_utf8` with a invalid literal always return an error
+ --> $DIR/invalid_from_utf8.rs:104:5
+ |
+LL | let mut c = &[99, 108, 130, 105, 112, 112, 121];
+ | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
+LL | std::str::from_utf8(c);
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+warning: calls to `std::str::from_utf8` with a invalid literal always return an error
+ --> $DIR/invalid_from_utf8.rs:107:5
+ |
+LL | const INVALID_1: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
+ | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
+LL | std::str::from_utf8(&INVALID_1);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: calls to `std::str::from_utf8` with a invalid literal always return an error
+ --> $DIR/invalid_from_utf8.rs:110:5
+ |
+LL | static INVALID_2: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
+ | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
+LL | std::str::from_utf8(&INVALID_2);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: calls to `std::str::from_utf8` with a invalid literal always return an error
+ --> $DIR/invalid_from_utf8.rs:113:5
+ |
+LL | const INVALID_3: &'static [u8; 7] = &[99, 108, 130, 105, 112, 112, 121];
+ | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
+LL | std::str::from_utf8(INVALID_3);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: calls to `std::str::from_utf8` with a invalid literal always return an error
+ --> $DIR/invalid_from_utf8.rs:116:5
+ |
+LL | const INVALID_4: &'static [u8; 7] = { &[99, 108, 130, 105, 112, 112, 121] };
+ | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
+LL | std::str::from_utf8(INVALID_4);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: 19 warnings emitted
diff --git a/tests/ui/lint/issue-99387.rs b/tests/ui/lint/issue-99387.rs
index ba5031167..571d4194f 100644
--- a/tests/ui/lint/issue-99387.rs
+++ b/tests/ui/lint/issue-99387.rs
@@ -2,7 +2,7 @@
//! opaque types.
#![feature(type_alias_impl_trait)]
-#![allow(private_in_public)]
+#![allow(private_interfaces)]
pub type Successors<'a> = impl Iterator<Item = &'a ()>;
diff --git a/tests/ui/lint/large_assignments/box_rc_arc_allowed.rs b/tests/ui/lint/large_assignments/box_rc_arc_allowed.rs
new file mode 100644
index 000000000..331136420
--- /dev/null
+++ b/tests/ui/lint/large_assignments/box_rc_arc_allowed.rs
@@ -0,0 +1,29 @@
+#![deny(large_assignments)]
+#![feature(large_assignments)]
+#![move_size_limit = "1000"]
+// build-fail
+// only-x86_64
+
+// edition:2018
+// compile-flags: -Zmir-opt-level=0
+
+use std::{sync::Arc, rc::Rc};
+
+fn main() {
+ let _ = Arc::new([0; 9999]); // OK!
+ let _ = Box::new([0; 9999]); // OK!
+ let _ = Rc::new([0; 9999]); // OK!
+ let _ = NotBox::new([0; 9999]); //~ ERROR large_assignments
+}
+
+struct NotBox {
+ data: [u8; 9999],
+}
+
+impl NotBox {
+ fn new(data: [u8; 9999]) -> Self {
+ Self {
+ data, //~ ERROR large_assignments
+ }
+ }
+}
diff --git a/tests/ui/lint/large_assignments/box_rc_arc_allowed.stderr b/tests/ui/lint/large_assignments/box_rc_arc_allowed.stderr
new file mode 100644
index 000000000..b45cbe5da
--- /dev/null
+++ b/tests/ui/lint/large_assignments/box_rc_arc_allowed.stderr
@@ -0,0 +1,23 @@
+error: moving 9999 bytes
+ --> $DIR/box_rc_arc_allowed.rs:16:13
+ |
+LL | let _ = NotBox::new([0; 9999]);
+ | ^^^^^^^^^^^^^^^^^^^^^^ 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
+ --> $DIR/box_rc_arc_allowed.rs:1:9
+ |
+LL | #![deny(large_assignments)]
+ | ^^^^^^^^^^^^^^^^^
+
+error: moving 9999 bytes
+ --> $DIR/box_rc_arc_allowed.rs:26:13
+ |
+LL | data,
+ | ^^^^ 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: aborting due to 2 previous errors
+
diff --git a/tests/ui/async-await/large_moves.option.stderr b/tests/ui/lint/large_assignments/large_future.attribute.stderr
index 94f61caa2..734b7ff7b 100644
--- a/tests/ui/async-await/large_moves.option.stderr
+++ b/tests/ui/lint/large_assignments/large_future.attribute.stderr
@@ -1,31 +1,23 @@
error: moving 10024 bytes
- --> $DIR/large_moves.rs:19:14
+ --> $DIR/large_future.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 = "..."]`
note: the lint level is defined here
- --> $DIR/large_moves.rs:1:9
+ --> $DIR/large_future.rs:1:9
|
LL | #![deny(large_assignments)]
| ^^^^^^^^^^^^^^^^^
error: moving 10024 bytes
- --> $DIR/large_moves.rs:19:13
- |
-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:21:13
+ --> $DIR/large_future.rs:20:13
|
LL | let a = z.0;
| ^^^ 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: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
diff --git a/tests/ui/async-await/large_moves.attribute.stderr b/tests/ui/lint/large_assignments/large_future.option.stderr
index 94f61caa2..734b7ff7b 100644
--- a/tests/ui/async-await/large_moves.attribute.stderr
+++ b/tests/ui/lint/large_assignments/large_future.option.stderr
@@ -1,31 +1,23 @@
error: moving 10024 bytes
- --> $DIR/large_moves.rs:19:14
+ --> $DIR/large_future.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 = "..."]`
note: the lint level is defined here
- --> $DIR/large_moves.rs:1:9
+ --> $DIR/large_future.rs:1:9
|
LL | #![deny(large_assignments)]
| ^^^^^^^^^^^^^^^^^
error: moving 10024 bytes
- --> $DIR/large_moves.rs:19:13
- |
-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:21:13
+ --> $DIR/large_future.rs:20:13
|
LL | let a = z.0;
| ^^^ 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: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
diff --git a/tests/ui/async-await/large_moves.rs b/tests/ui/lint/large_assignments/large_future.rs
index c8ed6bafe..834746fa9 100644
--- a/tests/ui/async-await/large_moves.rs
+++ b/tests/ui/lint/large_assignments/large_future.rs
@@ -1,5 +1,5 @@
#![deny(large_assignments)]
-#![feature(large_assignments)]
+#![cfg_attr(attribute, feature(large_assignments))]
#![cfg_attr(attribute, move_size_limit = "1000")]
// build-fail
// only-x86_64
@@ -17,7 +17,6 @@ fn main() {
dbg!(y);
};
let z = (x, 42); //~ ERROR large_assignments
- //~^ ERROR large_assignments
let a = z.0; //~ ERROR large_assignments
let b = z.1;
}
diff --git a/tests/ui/lint/lint-ctypes-94223.rs b/tests/ui/lint/lint-ctypes-94223.rs
index 70dd2a71f..ac24f61b0 100644
--- a/tests/ui/lint/lint-ctypes-94223.rs
+++ b/tests/ui/lint/lint-ctypes-94223.rs
@@ -24,6 +24,13 @@ enum BadUnion {
type Foo = extern "C" fn([u8]);
//~^ ERROR `extern` fn uses type `[u8]`, which is not FFI-safe
+pub trait FooTrait {
+ type FooType;
+}
+
+pub type Foo2<T> = extern "C" fn(Option<&<T as FooTrait>::FooType>);
+//~^ ERROR `extern` fn uses type `Option<&<T as FooTrait>::FooType>`, which is not FFI-safe
+
pub struct FfiUnsafe;
#[allow(improper_ctypes_definitions)]
diff --git a/tests/ui/lint/lint-ctypes-94223.stderr b/tests/ui/lint/lint-ctypes-94223.stderr
index 49e64ed51..bd127cf60 100644
--- a/tests/ui/lint/lint-ctypes-94223.stderr
+++ b/tests/ui/lint/lint-ctypes-94223.stderr
@@ -66,8 +66,17 @@ LL | type Foo = extern "C" fn([u8]);
= help: consider using a raw pointer instead
= note: slices have no C equivalent
+error: `extern` fn uses type `Option<&<T as FooTrait>::FooType>`, which is not FFI-safe
+ --> $DIR/lint-ctypes-94223.rs:31:20
+ |
+LL | pub type Foo2<T> = extern "C" fn(Option<&<T as FooTrait>::FooType>);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
+ |
+ = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
+ = note: enum has no representation hint
+
error: `extern` fn uses type `FfiUnsafe`, which is not FFI-safe
- --> $DIR/lint-ctypes-94223.rs:34:17
+ --> $DIR/lint-ctypes-94223.rs:41:17
|
LL | pub static BAD: extern "C" fn(FfiUnsafe) = f;
| ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -75,13 +84,13 @@ LL | pub static BAD: extern "C" fn(FfiUnsafe) = f;
= help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
= note: this struct has unspecified layout
note: the type is defined here
- --> $DIR/lint-ctypes-94223.rs:27:1
+ --> $DIR/lint-ctypes-94223.rs:34:1
|
LL | pub struct FfiUnsafe;
| ^^^^^^^^^^^^^^^^^^^^
error: `extern` fn uses type `FfiUnsafe`, which is not FFI-safe
- --> $DIR/lint-ctypes-94223.rs:37:30
+ --> $DIR/lint-ctypes-94223.rs:44:30
|
LL | pub static BAD_TWICE: Result<extern "C" fn(FfiUnsafe), extern "C" fn(FfiUnsafe)> = Ok(f);
| ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -89,13 +98,13 @@ LL | pub static BAD_TWICE: Result<extern "C" fn(FfiUnsafe), extern "C" fn(FfiUns
= help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
= note: this struct has unspecified layout
note: the type is defined here
- --> $DIR/lint-ctypes-94223.rs:27:1
+ --> $DIR/lint-ctypes-94223.rs:34:1
|
LL | pub struct FfiUnsafe;
| ^^^^^^^^^^^^^^^^^^^^
error: `extern` fn uses type `FfiUnsafe`, which is not FFI-safe
- --> $DIR/lint-ctypes-94223.rs:37:56
+ --> $DIR/lint-ctypes-94223.rs:44:56
|
LL | pub static BAD_TWICE: Result<extern "C" fn(FfiUnsafe), extern "C" fn(FfiUnsafe)> = Ok(f);
| ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -103,13 +112,13 @@ LL | pub static BAD_TWICE: Result<extern "C" fn(FfiUnsafe), extern "C" fn(FfiUns
= help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
= note: this struct has unspecified layout
note: the type is defined here
- --> $DIR/lint-ctypes-94223.rs:27:1
+ --> $DIR/lint-ctypes-94223.rs:34:1
|
LL | pub struct FfiUnsafe;
| ^^^^^^^^^^^^^^^^^^^^
error: `extern` fn uses type `FfiUnsafe`, which is not FFI-safe
- --> $DIR/lint-ctypes-94223.rs:41:22
+ --> $DIR/lint-ctypes-94223.rs:48:22
|
LL | pub const BAD_CONST: extern "C" fn(FfiUnsafe) = f;
| ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -117,10 +126,10 @@ LL | pub const BAD_CONST: extern "C" fn(FfiUnsafe) = f;
= help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
= note: this struct has unspecified layout
note: the type is defined here
- --> $DIR/lint-ctypes-94223.rs:27:1
+ --> $DIR/lint-ctypes-94223.rs:34:1
|
LL | pub struct FfiUnsafe;
| ^^^^^^^^^^^^^^^^^^^^
-error: aborting due to 11 previous errors
+error: aborting due to 12 previous errors
diff --git a/tests/ui/lint/lint-ctypes-fn.rs b/tests/ui/lint/lint-ctypes-fn.rs
index d3b36a9d5..14831e247 100644
--- a/tests/ui/lint/lint-ctypes-fn.rs
+++ b/tests/ui/lint/lint-ctypes-fn.rs
@@ -1,6 +1,6 @@
#![feature(rustc_private)]
-#![allow(private_in_public)]
+#![allow(private_interfaces)]
#![deny(improper_ctypes_definitions)]
extern crate libc;
diff --git a/tests/ui/lint/lint-ctypes-option-nonnull-unsized.rs b/tests/ui/lint/lint-ctypes-option-nonnull-unsized.rs
new file mode 100644
index 000000000..ca08eb23a
--- /dev/null
+++ b/tests/ui/lint/lint-ctypes-option-nonnull-unsized.rs
@@ -0,0 +1,8 @@
+#![deny(improper_ctypes_definitions)]
+
+extern "C" fn foo<T: ?Sized + 'static>() -> Option<&'static T> {
+ //~^ ERROR `extern` fn uses type `Option<&T>`, which is not FFI-safe
+ None
+}
+
+fn main() {}
diff --git a/tests/ui/lint/lint-ctypes-option-nonnull-unsized.stderr b/tests/ui/lint/lint-ctypes-option-nonnull-unsized.stderr
new file mode 100644
index 000000000..f59fb3cc7
--- /dev/null
+++ b/tests/ui/lint/lint-ctypes-option-nonnull-unsized.stderr
@@ -0,0 +1,16 @@
+error: `extern` fn uses type `Option<&T>`, which is not FFI-safe
+ --> $DIR/lint-ctypes-option-nonnull-unsized.rs:3:45
+ |
+LL | extern "C" fn foo<T: ?Sized + 'static>() -> Option<&'static T> {
+ | ^^^^^^^^^^^^^^^^^^ not FFI-safe
+ |
+ = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
+ = note: enum has no representation hint
+note: the lint level is defined here
+ --> $DIR/lint-ctypes-option-nonnull-unsized.rs:1:9
+ |
+LL | #![deny(improper_ctypes_definitions)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/lint/lint-ctypes.rs b/tests/ui/lint/lint-ctypes.rs
index 9165e14b7..3dd731625 100644
--- a/tests/ui/lint/lint-ctypes.rs
+++ b/tests/ui/lint/lint-ctypes.rs
@@ -1,6 +1,6 @@
#![feature(rustc_private)]
-#![allow(private_in_public)]
+#![allow(private_interfaces)]
#![deny(improper_ctypes)]
extern crate libc;
diff --git a/tests/ui/lint/lint-pre-expansion-extern-module.stderr b/tests/ui/lint/lint-pre-expansion-extern-module.stderr
index ce3e8806a..8a6e1531d 100644
--- a/tests/ui/lint/lint-pre-expansion-extern-module.stderr
+++ b/tests/ui/lint/lint-pre-expansion-extern-module.stderr
@@ -7,6 +7,7 @@ LL | pub fn try() {}
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
= note: `-W keyword-idents` implied by `-W rust-2018-compatibility`
+ = help: to override `-W rust-2018-compatibility` add `#[allow(keyword_idents)]`
warning: 1 warning emitted
diff --git a/tests/ui/lint/lint-removed-cmdline-deny.rs b/tests/ui/lint/lint-removed-cmdline-deny.rs
new file mode 100644
index 000000000..8cf91cf60
--- /dev/null
+++ b/tests/ui/lint/lint-removed-cmdline-deny.rs
@@ -0,0 +1,13 @@
+// The raw_pointer_derived lint warns about its removal
+// cc #30346
+
+// compile-flags:-D renamed-and-removed-lints -D raw_pointer_derive
+
+// error-pattern:lint `raw_pointer_derive` has been removed
+// error-pattern:requested on the command line with `-D raw_pointer_derive`
+// error-pattern:requested on the command line with `-D renamed-and-removed-lints`
+
+#![warn(unused)]
+
+#[deny(warnings)]
+fn main() { let unused = (); }
diff --git a/tests/ui/lint/lint-removed-cmdline-deny.stderr b/tests/ui/lint/lint-removed-cmdline-deny.stderr
new file mode 100644
index 000000000..80c85d01e
--- /dev/null
+++ b/tests/ui/lint/lint-removed-cmdline-deny.stderr
@@ -0,0 +1,28 @@
+error: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
+ |
+ = note: requested on the command line with `-D raw_pointer_derive`
+ = note: requested on the command line with `-D renamed-and-removed-lints`
+
+error: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
+ |
+ = note: requested on the command line with `-D raw_pointer_derive`
+
+error: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
+ |
+ = note: requested on the command line with `-D raw_pointer_derive`
+
+error: unused variable: `unused`
+ --> $DIR/lint-removed-cmdline-deny.rs:13:17
+ |
+LL | fn main() { let unused = (); }
+ | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
+ |
+note: the lint level is defined here
+ --> $DIR/lint-removed-cmdline-deny.rs:12:8
+ |
+LL | #[deny(warnings)]
+ | ^^^^^^^^
+ = note: `#[deny(unused_variables)]` implied by `#[deny(warnings)]`
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/lint/lint-removed-cmdline.rs b/tests/ui/lint/lint-removed-cmdline.rs
index 462beabb9..34373df3a 100644
--- a/tests/ui/lint/lint-removed-cmdline.rs
+++ b/tests/ui/lint/lint-removed-cmdline.rs
@@ -4,6 +4,7 @@
// compile-flags:-D raw_pointer_derive
// error-pattern:lint `raw_pointer_derive` has been removed
+// error-pattern:`#[warn(renamed_and_removed_lints)]` on by default
// error-pattern:requested on the command line with `-D raw_pointer_derive`
#![warn(unused)]
diff --git a/tests/ui/lint/lint-removed-cmdline.stderr b/tests/ui/lint/lint-removed-cmdline.stderr
index 9be532ef2..ebfae34ad 100644
--- a/tests/ui/lint/lint-removed-cmdline.stderr
+++ b/tests/ui/lint/lint-removed-cmdline.stderr
@@ -1,6 +1,7 @@
warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
|
= note: requested on the command line with `-D raw_pointer_derive`
+ = note: `#[warn(renamed_and_removed_lints)]` on by default
warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
|
@@ -11,13 +12,13 @@ warning: lint `raw_pointer_derive` has been removed: using derive with raw point
= note: requested on the command line with `-D raw_pointer_derive`
error: unused variable: `unused`
- --> $DIR/lint-removed-cmdline.rs:12:17
+ --> $DIR/lint-removed-cmdline.rs:13:17
|
LL | fn main() { let unused = (); }
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
|
note: the lint level is defined here
- --> $DIR/lint-removed-cmdline.rs:11:8
+ --> $DIR/lint-removed-cmdline.rs:12:8
|
LL | #[deny(warnings)]
| ^^^^^^^^
diff --git a/tests/ui/lint/lint-renamed-cmdline-deny.rs b/tests/ui/lint/lint-renamed-cmdline-deny.rs
new file mode 100644
index 000000000..01629aaca
--- /dev/null
+++ b/tests/ui/lint/lint-renamed-cmdline-deny.rs
@@ -0,0 +1,10 @@
+// compile-flags:-D renamed-and-removed-lints -D bare_trait_object
+
+// error-pattern:lint `bare_trait_object` has been renamed to `bare_trait_objects`
+// error-pattern:use the new name `bare_trait_objects`
+// error-pattern:requested on the command line with `-D bare_trait_object`
+// error-pattern:requested on the command line with `-D renamed-and-removed-lints`
+// error-pattern:unused
+
+#[deny(unused)]
+fn main() { let unused = (); }
diff --git a/tests/ui/lint/lint-renamed-cmdline-deny.stderr b/tests/ui/lint/lint-renamed-cmdline-deny.stderr
new file mode 100644
index 000000000..df22ef60d
--- /dev/null
+++ b/tests/ui/lint/lint-renamed-cmdline-deny.stderr
@@ -0,0 +1,31 @@
+error: lint `bare_trait_object` has been renamed to `bare_trait_objects`
+ |
+ = help: use the new name `bare_trait_objects`
+ = note: requested on the command line with `-D bare_trait_object`
+ = note: requested on the command line with `-D renamed-and-removed-lints`
+
+error: lint `bare_trait_object` has been renamed to `bare_trait_objects`
+ |
+ = help: use the new name `bare_trait_objects`
+ = note: requested on the command line with `-D bare_trait_object`
+
+error: lint `bare_trait_object` has been renamed to `bare_trait_objects`
+ |
+ = help: use the new name `bare_trait_objects`
+ = note: requested on the command line with `-D bare_trait_object`
+
+error: unused variable: `unused`
+ --> $DIR/lint-renamed-cmdline-deny.rs:10:17
+ |
+LL | fn main() { let unused = (); }
+ | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
+ |
+note: the lint level is defined here
+ --> $DIR/lint-renamed-cmdline-deny.rs:9:8
+ |
+LL | #[deny(unused)]
+ | ^^^^^^
+ = note: `#[deny(unused_variables)]` implied by `#[deny(unused)]`
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/lint/lint-renamed-cmdline.rs b/tests/ui/lint/lint-renamed-cmdline.rs
index c873771e3..fba7c3331 100644
--- a/tests/ui/lint/lint-renamed-cmdline.rs
+++ b/tests/ui/lint/lint-renamed-cmdline.rs
@@ -2,6 +2,7 @@
// error-pattern:lint `bare_trait_object` has been renamed to `bare_trait_objects`
// error-pattern:requested on the command line with `-D bare_trait_object`
+// error-pattern:`#[warn(renamed_and_removed_lints)]` on by default
// error-pattern:unused
#[deny(unused)]
diff --git a/tests/ui/lint/lint-renamed-cmdline.stderr b/tests/ui/lint/lint-renamed-cmdline.stderr
index 8dfd61ac9..a41284003 100644
--- a/tests/ui/lint/lint-renamed-cmdline.stderr
+++ b/tests/ui/lint/lint-renamed-cmdline.stderr
@@ -1,23 +1,27 @@
warning: lint `bare_trait_object` has been renamed to `bare_trait_objects`
|
+ = help: use the new name `bare_trait_objects`
= note: requested on the command line with `-D bare_trait_object`
+ = note: `#[warn(renamed_and_removed_lints)]` on by default
warning: lint `bare_trait_object` has been renamed to `bare_trait_objects`
|
+ = help: use the new name `bare_trait_objects`
= note: requested on the command line with `-D bare_trait_object`
warning: lint `bare_trait_object` has been renamed to `bare_trait_objects`
|
+ = help: use the new name `bare_trait_objects`
= note: requested on the command line with `-D bare_trait_object`
error: unused variable: `unused`
- --> $DIR/lint-renamed-cmdline.rs:8:17
+ --> $DIR/lint-renamed-cmdline.rs:9:17
|
LL | fn main() { let unused = (); }
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
|
note: the lint level is defined here
- --> $DIR/lint-renamed-cmdline.rs:7:8
+ --> $DIR/lint-renamed-cmdline.rs:8:8
|
LL | #[deny(unused)]
| ^^^^^^
diff --git a/tests/ui/lint/lint-unexported-no-mangle.stderr b/tests/ui/lint/lint-unexported-no-mangle.stderr
index a11ee769c..858527822 100644
--- a/tests/ui/lint/lint-unexported-no-mangle.stderr
+++ b/tests/ui/lint/lint-unexported-no-mangle.stderr
@@ -1,6 +1,7 @@
warning: lint `private_no_mangle_fns` has been removed: no longer a warning, `#[no_mangle]` functions always exported
|
= note: requested on the command line with `-F private_no_mangle_fns`
+ = note: `#[warn(renamed_and_removed_lints)]` on by default
warning: lint `private_no_mangle_statics` has been removed: no longer a warning, `#[no_mangle]` statics always exported
|
diff --git a/tests/ui/lint/lint-unknown-lint-cmdline-allow.rs b/tests/ui/lint/lint-unknown-lint-cmdline-allow.rs
new file mode 100644
index 000000000..c7f8d434c
--- /dev/null
+++ b/tests/ui/lint/lint-unknown-lint-cmdline-allow.rs
@@ -0,0 +1,4 @@
+// check-pass
+// compile-flags:-A unknown-lints -D bogus -D dead_cod
+
+fn main() { }
diff --git a/tests/ui/lint/lint-unknown-lint-cmdline-deny.rs b/tests/ui/lint/lint-unknown-lint-cmdline-deny.rs
new file mode 100644
index 000000000..31bc20473
--- /dev/null
+++ b/tests/ui/lint/lint-unknown-lint-cmdline-deny.rs
@@ -0,0 +1,9 @@
+// compile-flags:-D unknown-lints -D bogus -D dead_cod
+
+// error-pattern:unknown lint: `bogus`
+// error-pattern:requested on the command line with `-D bogus`
+// error-pattern:requested on the command line with `-D dead_cod`
+// error-pattern:requested on the command line with `-D unknown-lints`
+// error-pattern:did you mean: `dead_code`
+
+fn main() { }
diff --git a/tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr b/tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr
new file mode 100644
index 000000000..677b5edc8
--- /dev/null
+++ b/tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr
@@ -0,0 +1,31 @@
+error[E0602]: unknown lint: `bogus`
+ |
+ = note: requested on the command line with `-D bogus`
+ = note: requested on the command line with `-D unknown-lints`
+
+error[E0602]: unknown lint: `dead_cod`
+ |
+ = help: did you mean: `dead_code`
+ = note: requested on the command line with `-D dead_cod`
+
+error[E0602]: unknown lint: `bogus`
+ |
+ = note: requested on the command line with `-D bogus`
+
+error[E0602]: unknown lint: `dead_cod`
+ |
+ = help: did you mean: `dead_code`
+ = note: requested on the command line with `-D dead_cod`
+
+error[E0602]: unknown lint: `bogus`
+ |
+ = note: requested on the command line with `-D bogus`
+
+error[E0602]: unknown lint: `dead_cod`
+ |
+ = help: did you mean: `dead_code`
+ = note: requested on the command line with `-D dead_cod`
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0602`.
diff --git a/tests/ui/lint/lint-unknown-lint-cmdline.rs b/tests/ui/lint/lint-unknown-lint-cmdline.rs
index 7f3f55fba..81539cb6d 100644
--- a/tests/ui/lint/lint-unknown-lint-cmdline.rs
+++ b/tests/ui/lint/lint-unknown-lint-cmdline.rs
@@ -1,7 +1,9 @@
+// check-pass
// compile-flags:-D bogus -D dead_cod
// error-pattern:unknown lint: `bogus`
// error-pattern:requested on the command line with `-D bogus`
+// error-pattern:`#[warn(unknown_lints)]` on by default
// error-pattern:unknown lint: `dead_cod`
// error-pattern:requested on the command line with `-D dead_cod`
// error-pattern:did you mean: `dead_code`
diff --git a/tests/ui/lint/lint-unknown-lint-cmdline.stderr b/tests/ui/lint/lint-unknown-lint-cmdline.stderr
index 3855d5527..10db76ac4 100644
--- a/tests/ui/lint/lint-unknown-lint-cmdline.stderr
+++ b/tests/ui/lint/lint-unknown-lint-cmdline.stderr
@@ -1,21 +1,31 @@
-error[E0602]: unknown lint: `bogus`
+warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
+ = note: `#[warn(unknown_lints)]` on by default
-error[E0602]: unknown lint: `dead_cod`
+warning[E0602]: unknown lint: `dead_cod`
|
= help: did you mean: `dead_code`
= note: requested on the command line with `-D dead_cod`
-error[E0602]: unknown lint: `bogus`
+warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
-error[E0602]: unknown lint: `dead_cod`
+warning[E0602]: unknown lint: `dead_cod`
|
= help: did you mean: `dead_code`
= note: requested on the command line with `-D dead_cod`
-error: aborting due to 4 previous errors
+warning[E0602]: unknown lint: `bogus`
+ |
+ = note: requested on the command line with `-D bogus`
+
+warning[E0602]: unknown lint: `dead_cod`
+ |
+ = help: did you mean: `dead_code`
+ = note: requested on the command line with `-D dead_cod`
+
+warning: 6 warnings emitted
For more information about this error, try `rustc --explain E0602`.
diff --git a/tests/ui/lint/must_not_suspend/dedup.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/dedup.drop_tracking.stderr
deleted file mode 100644
index cd3baa857..000000000
--- a/tests/ui/lint/must_not_suspend/dedup.drop_tracking.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error: `No` held across a suspend point, but should not be
- --> $DIR/dedup.rs:19:9
- |
-LL | let no = No {};
- | ^^
-LL | wheeee(&no).await;
- | ----- the value is held across this suspend point
- |
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/dedup.rs:19:9
- |
-LL | let no = No {};
- | ^^
-note: the lint level is defined here
- --> $DIR/dedup.rs:6:9
- |
-LL | #![deny(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/lint/must_not_suspend/dedup.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/dedup.no_drop_tracking.stderr
deleted file mode 100644
index aff2f7c32..000000000
--- a/tests/ui/lint/must_not_suspend/dedup.no_drop_tracking.stderr
+++ /dev/null
@@ -1,33 +0,0 @@
-error: `No` held across a suspend point, but should not be
- --> $DIR/dedup.rs:19:9
- |
-LL | let no = No {};
- | ^^
-LL | wheeee(&no).await;
- | ----- the value is held across this suspend point
- |
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/dedup.rs:19:9
- |
-LL | let no = No {};
- | ^^
-note: the lint level is defined here
- --> $DIR/dedup.rs:6:9
- |
-LL | #![deny(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-error: `No` held across a suspend point, but should not be
- --> $DIR/dedup.rs:20:13
- |
-LL | wheeee(&no).await;
- | ^^ ----- the value is held across this suspend point
- |
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/dedup.rs:20:13
- |
-LL | wheeee(&no).await;
- | ^^
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/lint/must_not_suspend/dedup.rs b/tests/ui/lint/must_not_suspend/dedup.rs
index 96bdb7715..867bdf2ec 100644
--- a/tests/ui/lint/must_not_suspend/dedup.rs
+++ b/tests/ui/lint/must_not_suspend/dedup.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
#![feature(must_not_suspend)]
#![deny(must_not_suspend)]
@@ -16,8 +13,9 @@ async fn wheeee<T>(t: T) {
}
async fn yes() {
- let no = No {}; //~ ERROR `No` held across
- wheeee(&no).await; //[no_drop_tracking]~ ERROR `No` held across
+ let no = No {};
+ //~^ ERROR `No` held across
+ wheeee(&no).await;
drop(no);
}
diff --git a/tests/ui/lint/must_not_suspend/dedup.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/dedup.stderr
index cd3baa857..5d5b04a5d 100644
--- a/tests/ui/lint/must_not_suspend/dedup.drop_tracking_mir.stderr
+++ b/tests/ui/lint/must_not_suspend/dedup.stderr
@@ -1,18 +1,19 @@
error: `No` held across a suspend point, but should not be
- --> $DIR/dedup.rs:19:9
+ --> $DIR/dedup.rs:16:9
|
LL | let no = No {};
| ^^
+LL |
LL | wheeee(&no).await;
| ----- the value is held across this suspend point
|
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/dedup.rs:19:9
+ --> $DIR/dedup.rs:16:9
|
LL | let no = No {};
| ^^
note: the lint level is defined here
- --> $DIR/dedup.rs:6:9
+ --> $DIR/dedup.rs:3:9
|
LL | #![deny(must_not_suspend)]
| ^^^^^^^^^^^^^^^^
diff --git a/tests/ui/lint/must_not_suspend/ref-drop-tracking.rs b/tests/ui/lint/must_not_suspend/ref-drop-tracking.rs
deleted file mode 100644
index 1bc4a3812..000000000
--- a/tests/ui/lint/must_not_suspend/ref-drop-tracking.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-// edition:2018
-// compile-flags: -Zdrop-tracking
-#![feature(must_not_suspend)]
-#![deny(must_not_suspend)]
-
-#[must_not_suspend = "You gotta use Umm's, ya know?"]
-struct Umm {
- i: i64
-}
-
-struct Bar {
- u: Umm,
-}
-
-async fn other() {}
-
-impl Bar {
- async fn uhoh(&mut self) {
- let guard = &mut self.u; //~ ERROR `Umm` held across
-
- other().await;
-
- *guard = Umm {
- i: 2
- }
- }
-}
-
-fn main() {
-}
diff --git a/tests/ui/lint/must_not_suspend/ref-drop-tracking.stderr b/tests/ui/lint/must_not_suspend/ref-drop-tracking.stderr
deleted file mode 100644
index 348880b9c..000000000
--- a/tests/ui/lint/must_not_suspend/ref-drop-tracking.stderr
+++ /dev/null
@@ -1,27 +0,0 @@
-error: reference to `Umm` held across a suspend point, but should not be
- --> $DIR/ref-drop-tracking.rs:19:13
- |
-LL | let guard = &mut self.u;
- | ^^^^^
-LL |
-LL | other().await;
- | ----- the value is held across this suspend point
- |
-note: You gotta use Umm's, ya know?
- --> $DIR/ref-drop-tracking.rs:19:13
- |
-LL | let guard = &mut self.u;
- | ^^^^^
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/ref-drop-tracking.rs:19:13
- |
-LL | let guard = &mut self.u;
- | ^^^^^
-note: the lint level is defined here
- --> $DIR/ref-drop-tracking.rs:4:9
- |
-LL | #![deny(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/lint/must_not_suspend/ref.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/ref.drop_tracking.stderr
deleted file mode 100644
index fb18c2be9..000000000
--- a/tests/ui/lint/must_not_suspend/ref.drop_tracking.stderr
+++ /dev/null
@@ -1,27 +0,0 @@
-error: reference to `Umm` held across a suspend point, but should not be
- --> $DIR/ref.rs:22:13
- |
-LL | let guard = &mut self.u;
- | ^^^^^
-LL |
-LL | other().await;
- | ----- the value is held across this suspend point
- |
-note: You gotta use Umm's, ya know?
- --> $DIR/ref.rs:22:13
- |
-LL | let guard = &mut self.u;
- | ^^^^^
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/ref.rs:22:13
- |
-LL | let guard = &mut self.u;
- | ^^^^^
-note: the lint level is defined here
- --> $DIR/ref.rs:7:9
- |
-LL | #![deny(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr
deleted file mode 100644
index 6976dd349..000000000
--- a/tests/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr
+++ /dev/null
@@ -1,27 +0,0 @@
-error: `Umm` held across a suspend point, but should not be
- --> $DIR/ref.rs:22:26
- |
-LL | let guard = &mut self.u;
- | ^^^^^^
-LL |
-LL | other().await;
- | ----- the value is held across this suspend point
- |
-note: You gotta use Umm's, ya know?
- --> $DIR/ref.rs:22:26
- |
-LL | let guard = &mut self.u;
- | ^^^^^^
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/ref.rs:22:26
- |
-LL | let guard = &mut self.u;
- | ^^^^^^
-note: the lint level is defined here
- --> $DIR/ref.rs:7:9
- |
-LL | #![deny(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/lint/must_not_suspend/ref.rs b/tests/ui/lint/must_not_suspend/ref.rs
index d05dcb83a..3b6ef39c9 100644
--- a/tests/ui/lint/must_not_suspend/ref.rs
+++ b/tests/ui/lint/must_not_suspend/ref.rs
@@ -1,8 +1,4 @@
// edition:2018
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-
#![feature(must_not_suspend)]
#![deny(must_not_suspend)]
@@ -23,7 +19,6 @@ impl Bar {
other().await;
- let _g = &*guard;
*guard = Umm { i: 2 }
}
}
diff --git a/tests/ui/lint/must_not_suspend/ref.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/ref.stderr
index fb18c2be9..ed91a4a0b 100644
--- a/tests/ui/lint/must_not_suspend/ref.drop_tracking_mir.stderr
+++ b/tests/ui/lint/must_not_suspend/ref.stderr
@@ -1,5 +1,5 @@
error: reference to `Umm` held across a suspend point, but should not be
- --> $DIR/ref.rs:22:13
+ --> $DIR/ref.rs:18:13
|
LL | let guard = &mut self.u;
| ^^^^^
@@ -8,17 +8,17 @@ LL | other().await;
| ----- the value is held across this suspend point
|
note: You gotta use Umm's, ya know?
- --> $DIR/ref.rs:22:13
+ --> $DIR/ref.rs:18:13
|
LL | let guard = &mut self.u;
| ^^^^^
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/ref.rs:22:13
+ --> $DIR/ref.rs:18:13
|
LL | let guard = &mut self.u;
| ^^^^^
note: the lint level is defined here
- --> $DIR/ref.rs:7:9
+ --> $DIR/ref.rs:3:9
|
LL | #![deny(must_not_suspend)]
| ^^^^^^^^^^^^^^^^
diff --git a/tests/ui/lint/must_not_suspend/trait.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/trait.drop_tracking_mir.stderr
deleted file mode 100644
index 8c8ad1f37..000000000
--- a/tests/ui/lint/must_not_suspend/trait.drop_tracking_mir.stderr
+++ /dev/null
@@ -1,37 +0,0 @@
-error: implementer of `Wow` held across a suspend point, but should not be
- --> $DIR/trait.rs:24:9
- |
-LL | let _guard1 = r#impl();
- | ^^^^^^^
-...
-LL | other().await;
- | ----- the value is held across this suspend point
- |
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/trait.rs:24:9
- |
-LL | let _guard1 = r#impl();
- | ^^^^^^^
-note: the lint level is defined here
- --> $DIR/trait.rs:6:9
- |
-LL | #![deny(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-error: boxed `Wow` trait object held across a suspend point, but should not be
- --> $DIR/trait.rs:25:9
- |
-LL | let _guard2 = r#dyn();
- | ^^^^^^^
-LL |
-LL | other().await;
- | ----- the value is held across this suspend point
- |
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/trait.rs:25:9
- |
-LL | let _guard2 = r#dyn();
- | ^^^^^^^
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/lint/must_not_suspend/trait.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/trait.no_drop_tracking.stderr
deleted file mode 100644
index 8c8ad1f37..000000000
--- a/tests/ui/lint/must_not_suspend/trait.no_drop_tracking.stderr
+++ /dev/null
@@ -1,37 +0,0 @@
-error: implementer of `Wow` held across a suspend point, but should not be
- --> $DIR/trait.rs:24:9
- |
-LL | let _guard1 = r#impl();
- | ^^^^^^^
-...
-LL | other().await;
- | ----- the value is held across this suspend point
- |
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/trait.rs:24:9
- |
-LL | let _guard1 = r#impl();
- | ^^^^^^^
-note: the lint level is defined here
- --> $DIR/trait.rs:6:9
- |
-LL | #![deny(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-error: boxed `Wow` trait object held across a suspend point, but should not be
- --> $DIR/trait.rs:25:9
- |
-LL | let _guard2 = r#dyn();
- | ^^^^^^^
-LL |
-LL | other().await;
- | ----- the value is held across this suspend point
- |
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/trait.rs:25:9
- |
-LL | let _guard2 = r#dyn();
- | ^^^^^^^
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/lint/must_not_suspend/trait.rs b/tests/ui/lint/must_not_suspend/trait.rs
index cc3ae298d..6c911cb4b 100644
--- a/tests/ui/lint/must_not_suspend/trait.rs
+++ b/tests/ui/lint/must_not_suspend/trait.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
#![feature(must_not_suspend)]
#![deny(must_not_suspend)]
@@ -25,9 +22,6 @@ pub async fn uhoh() {
let _guard2 = r#dyn(); //~ ERROR boxed `Wow` trait object held across
other().await;
-
- drop(_guard1);
- drop(_guard2);
}
fn main() {
diff --git a/tests/ui/lint/must_not_suspend/trait.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/trait.stderr
index 8c8ad1f37..2c03f8e82 100644
--- a/tests/ui/lint/must_not_suspend/trait.drop_tracking.stderr
+++ b/tests/ui/lint/must_not_suspend/trait.stderr
@@ -1,5 +1,5 @@
error: implementer of `Wow` held across a suspend point, but should not be
- --> $DIR/trait.rs:24:9
+ --> $DIR/trait.rs:21:9
|
LL | let _guard1 = r#impl();
| ^^^^^^^
@@ -8,18 +8,18 @@ LL | other().await;
| ----- the value is held across this suspend point
|
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/trait.rs:24:9
+ --> $DIR/trait.rs:21:9
|
LL | let _guard1 = r#impl();
| ^^^^^^^
note: the lint level is defined here
- --> $DIR/trait.rs:6:9
+ --> $DIR/trait.rs:3:9
|
LL | #![deny(must_not_suspend)]
| ^^^^^^^^^^^^^^^^
error: boxed `Wow` trait object held across a suspend point, but should not be
- --> $DIR/trait.rs:25:9
+ --> $DIR/trait.rs:22:9
|
LL | let _guard2 = r#dyn();
| ^^^^^^^
@@ -28,7 +28,7 @@ LL | other().await;
| ----- the value is held across this suspend point
|
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/trait.rs:25:9
+ --> $DIR/trait.rs:22:9
|
LL | let _guard2 = r#dyn();
| ^^^^^^^
diff --git a/tests/ui/lint/must_not_suspend/unit.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/unit.drop_tracking_mir.stderr
deleted file mode 100644
index e24cffdd0..000000000
--- a/tests/ui/lint/must_not_suspend/unit.drop_tracking_mir.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error: `Umm` held across a suspend point, but should not be
- --> $DIR/unit.rs:22:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-LL | other().await;
- | ----- the value is held across this suspend point
- |
-note: You gotta use Umm's, ya know?
- --> $DIR/unit.rs:22:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/unit.rs:22:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-note: the lint level is defined here
- --> $DIR/unit.rs:6:9
- |
-LL | #![deny(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/lint/must_not_suspend/unit.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/unit.no_drop_tracking.stderr
deleted file mode 100644
index e24cffdd0..000000000
--- a/tests/ui/lint/must_not_suspend/unit.no_drop_tracking.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error: `Umm` held across a suspend point, but should not be
- --> $DIR/unit.rs:22:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-LL | other().await;
- | ----- the value is held across this suspend point
- |
-note: You gotta use Umm's, ya know?
- --> $DIR/unit.rs:22:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/unit.rs:22:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-note: the lint level is defined here
- --> $DIR/unit.rs:6:9
- |
-LL | #![deny(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/lint/must_not_suspend/unit.rs b/tests/ui/lint/must_not_suspend/unit.rs
index fbc51b366..af4a76caa 100644
--- a/tests/ui/lint/must_not_suspend/unit.rs
+++ b/tests/ui/lint/must_not_suspend/unit.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
#![feature(must_not_suspend)]
#![deny(must_not_suspend)]
@@ -10,6 +7,7 @@ struct Umm {
i: i64
}
+
fn bar() -> Umm {
Umm {
i: 1
diff --git a/tests/ui/lint/must_not_suspend/unit.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/unit.stderr
index e24cffdd0..11c95c146 100644
--- a/tests/ui/lint/must_not_suspend/unit.drop_tracking.stderr
+++ b/tests/ui/lint/must_not_suspend/unit.stderr
@@ -1,5 +1,5 @@
error: `Umm` held across a suspend point, but should not be
- --> $DIR/unit.rs:22:9
+ --> $DIR/unit.rs:20:9
|
LL | let _guard = bar();
| ^^^^^^
@@ -7,17 +7,17 @@ LL | other().await;
| ----- the value is held across this suspend point
|
note: You gotta use Umm's, ya know?
- --> $DIR/unit.rs:22:9
+ --> $DIR/unit.rs:20:9
|
LL | let _guard = bar();
| ^^^^^^
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/unit.rs:22:9
+ --> $DIR/unit.rs:20:9
|
LL | let _guard = bar();
| ^^^^^^
note: the lint level is defined here
- --> $DIR/unit.rs:6:9
+ --> $DIR/unit.rs:3:9
|
LL | #![deny(must_not_suspend)]
| ^^^^^^^^^^^^^^^^
diff --git a/tests/ui/lint/must_not_suspend/warn.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/warn.drop_tracking.stderr
deleted file mode 100644
index 4f7b40a5e..000000000
--- a/tests/ui/lint/must_not_suspend/warn.drop_tracking.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-warning: `Umm` held across a suspend point, but should not be
- --> $DIR/warn.rs:24:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-LL | other().await;
- | ----- the value is held across this suspend point
- |
-note: You gotta use Umm's, ya know?
- --> $DIR/warn.rs:24:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/warn.rs:24:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-note: the lint level is defined here
- --> $DIR/warn.rs:7:9
- |
-LL | #![warn(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-warning: 1 warning emitted
-
diff --git a/tests/ui/lint/must_not_suspend/warn.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/warn.no_drop_tracking.stderr
deleted file mode 100644
index 4f7b40a5e..000000000
--- a/tests/ui/lint/must_not_suspend/warn.no_drop_tracking.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-warning: `Umm` held across a suspend point, but should not be
- --> $DIR/warn.rs:24:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-LL | other().await;
- | ----- the value is held across this suspend point
- |
-note: You gotta use Umm's, ya know?
- --> $DIR/warn.rs:24:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/warn.rs:24:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-note: the lint level is defined here
- --> $DIR/warn.rs:7:9
- |
-LL | #![warn(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-warning: 1 warning emitted
-
diff --git a/tests/ui/lint/must_not_suspend/warn.rs b/tests/ui/lint/must_not_suspend/warn.rs
index 5a4863169..2d5dd01e5 100644
--- a/tests/ui/lint/must_not_suspend/warn.rs
+++ b/tests/ui/lint/must_not_suspend/warn.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
// run-pass
#![feature(must_not_suspend)]
@@ -21,9 +18,9 @@ fn bar() -> Umm {
async fn other() {}
pub async fn uhoh() {
- let _guard = bar(); //~ WARNING `Umm` held across
+ let guard = bar(); //~ WARNING `Umm` held across
other().await;
- drop(_guard);
+ drop(guard);
}
fn main() {
diff --git a/tests/ui/lint/must_not_suspend/warn.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/warn.stderr
index 4f7b40a5e..e59656e50 100644
--- a/tests/ui/lint/must_not_suspend/warn.drop_tracking_mir.stderr
+++ b/tests/ui/lint/must_not_suspend/warn.stderr
@@ -1,23 +1,23 @@
warning: `Umm` held across a suspend point, but should not be
- --> $DIR/warn.rs:24:9
+ --> $DIR/warn.rs:21:9
|
-LL | let _guard = bar();
- | ^^^^^^
+LL | let guard = bar();
+ | ^^^^^
LL | other().await;
| ----- the value is held across this suspend point
|
note: You gotta use Umm's, ya know?
- --> $DIR/warn.rs:24:9
+ --> $DIR/warn.rs:21:9
|
-LL | let _guard = bar();
- | ^^^^^^
+LL | let guard = bar();
+ | ^^^^^
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/warn.rs:24:9
+ --> $DIR/warn.rs:21:9
|
-LL | let _guard = bar();
- | ^^^^^^
+LL | let guard = bar();
+ | ^^^^^
note: the lint level is defined here
- --> $DIR/warn.rs:7:9
+ --> $DIR/warn.rs:4:9
|
LL | #![warn(must_not_suspend)]
| ^^^^^^^^^^^^^^^^
diff --git a/tests/ui/lint/no-coverage.rs b/tests/ui/lint/no-coverage.rs
index 07906a434..907d25d33 100644
--- a/tests/ui/lint/no-coverage.rs
+++ b/tests/ui/lint/no-coverage.rs
@@ -1,55 +1,55 @@
#![feature(extern_types)]
-#![feature(no_coverage)]
+#![feature(coverage_attribute)]
#![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
+#![coverage(off)]
+//~^ WARN: `#[coverage]` does not propagate into items and must be applied to the contained functions directly
-#[no_coverage]
-//~^ WARN: `#[no_coverage]` does not propagate into items and must be applied to the contained functions directly
+#[coverage(off)]
+//~^ WARN: `#[coverage]` does not propagate into items and must be applied to the contained functions directly
trait Trait {
- #[no_coverage] //~ ERROR `#[no_coverage]` must be applied to coverable code
+ #[coverage(off)] //~ ERROR `#[coverage]` must be applied to coverable code
const X: u32;
- #[no_coverage] //~ ERROR `#[no_coverage]` must be applied to coverable code
+ #[coverage(off)] //~ ERROR `#[coverage]` must be applied to coverable code
type T;
type U;
}
-#[no_coverage]
-//~^ WARN: `#[no_coverage]` does not propagate into items and must be applied to the contained functions directly
+#[coverage(off)]
+//~^ WARN: `#[coverage]` does not propagate into items and must be applied to the contained functions directly
impl Trait for () {
const X: u32 = 0;
- #[no_coverage] //~ ERROR `#[no_coverage]` must be applied to coverable code
+ #[coverage(off)] //~ ERROR `#[coverage]` must be applied to coverable code
type T = Self;
- #[no_coverage] //~ ERROR `#[no_coverage]` must be applied to coverable code
+ #[coverage(off)] //~ ERROR `#[coverage]` must be applied to coverable code
type U = impl Trait; //~ ERROR unconstrained opaque type
}
extern "C" {
- #[no_coverage] //~ ERROR `#[no_coverage]` must be applied to coverable code
+ #[coverage(off)] //~ ERROR `#[coverage]` must be applied to coverable code
static X: u32;
- #[no_coverage] //~ ERROR `#[no_coverage]` must be applied to coverable code
+ #[coverage(off)] //~ ERROR `#[coverage]` must be applied to coverable code
type T;
}
-#[no_coverage]
+#[coverage(off)]
fn main() {
- #[no_coverage]
- //~^ WARN `#[no_coverage]` may only be applied to function definitions
+ #[coverage(off)]
+ //~^ WARN `#[coverage]` may only be applied to function definitions
let _ = ();
match () {
- #[no_coverage]
- //~^ WARN `#[no_coverage]` may only be applied to function definitions
+ #[coverage(off)]
+ //~^ WARN `#[coverage]` may only be applied to function definitions
() => (),
}
- #[no_coverage]
- //~^ WARN `#[no_coverage]` may only be applied to function definitions
+ #[coverage(off)]
+ //~^ WARN `#[coverage]` may only be applied to function definitions
return ();
}
diff --git a/tests/ui/lint/no-coverage.stderr b/tests/ui/lint/no-coverage.stderr
index 404efbeac..a87b0fb49 100644
--- a/tests/ui/lint/no-coverage.stderr
+++ b/tests/ui/lint/no-coverage.stderr
@@ -1,8 +1,8 @@
-warning: `#[no_coverage]` does not propagate into items and must be applied to the contained functions directly
+warning: `#[coverage]` does not propagate into items and must be applied to the contained functions directly
--> $DIR/no-coverage.rs:8:1
|
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/no-coverage.rs:4:9
@@ -10,83 +10,83 @@ note: the lint level is defined here
LL | #![warn(unused_attributes)]
| ^^^^^^^^^^^^^^^^^
-warning: `#[no_coverage]` does not propagate into items and must be applied to the contained functions directly
+warning: `#[coverage]` does not propagate into items and must be applied to the contained functions directly
--> $DIR/no-coverage.rs:20:1
|
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
-warning: `#[no_coverage]` may only be applied to function definitions
+warning: `#[coverage]` may only be applied to function definitions
--> $DIR/no-coverage.rs:42:5
|
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
-warning: `#[no_coverage]` may only be applied to function definitions
+warning: `#[coverage]` may only be applied to function definitions
--> $DIR/no-coverage.rs:47:9
|
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
-warning: `#[no_coverage]` may only be applied to function definitions
+warning: `#[coverage]` may only be applied to function definitions
--> $DIR/no-coverage.rs:52:5
|
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
-error[E0788]: `#[no_coverage]` must be applied to coverable code
+error[E0788]: `#[coverage]` must be applied to coverable code
--> $DIR/no-coverage.rs:11:5
|
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
LL | const X: u32;
| ------------- not coverable code
-error[E0788]: `#[no_coverage]` must be applied to coverable code
+error[E0788]: `#[coverage]` must be applied to coverable code
--> $DIR/no-coverage.rs:14:5
|
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
LL | type T;
| ------- not coverable code
-error[E0788]: `#[no_coverage]` must be applied to coverable code
+error[E0788]: `#[coverage]` must be applied to coverable code
--> $DIR/no-coverage.rs:25:5
|
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
LL | type T = Self;
| -------------- not coverable code
-error[E0788]: `#[no_coverage]` must be applied to coverable code
+error[E0788]: `#[coverage]` must be applied to coverable code
--> $DIR/no-coverage.rs:28:5
|
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
LL | type U = impl Trait;
| -------------------- not coverable code
-error[E0788]: `#[no_coverage]` must be applied to coverable code
+error[E0788]: `#[coverage]` must be applied to coverable code
--> $DIR/no-coverage.rs:33:5
|
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
LL | static X: u32;
| -------------- not coverable code
-error[E0788]: `#[no_coverage]` must be applied to coverable code
+error[E0788]: `#[coverage]` must be applied to coverable code
--> $DIR/no-coverage.rs:36:5
|
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
LL | type T;
| ------- not coverable code
-warning: `#[no_coverage]` does not propagate into items and must be applied to the contained functions directly
+warning: `#[coverage]` does not propagate into items and must be applied to the contained functions directly
--> $DIR/no-coverage.rs:5:1
|
-LL | #![no_coverage]
- | ^^^^^^^^^^^^^^^
+LL | #![coverage(off)]
+ | ^^^^^^^^^^^^^^^^^
error: unconstrained opaque type
--> $DIR/no-coverage.rs:29:14
diff --git a/tests/ui/lint/noop-method-call.fixed b/tests/ui/lint/noop-method-call.fixed
index eeb80279f..4d9834f7d 100644
--- a/tests/ui/lint/noop-method-call.fixed
+++ b/tests/ui/lint/noop-method-call.fixed
@@ -1,6 +1,7 @@
// check-pass
// run-rustfix
+#![feature(rustc_attrs)]
#![allow(unused)]
use std::borrow::Borrow;
@@ -49,3 +50,15 @@ fn non_generic(non_clone_type: &PlainType<u32>) {
non_clone_type;
//~^ WARN call to `.clone()` on a reference in this situation does nothing
}
+
+struct DiagnosticClone;
+impl Clone for DiagnosticClone {
+ #[rustc_diagnostic_item = "other_clone"]
+ fn clone(&self) -> Self {
+ DiagnosticClone
+ }
+}
+
+fn with_other_diagnostic_item(x: DiagnosticClone) {
+ x.clone();
+}
diff --git a/tests/ui/lint/noop-method-call.rs b/tests/ui/lint/noop-method-call.rs
index 9569a0dfc..6242a00e0 100644
--- a/tests/ui/lint/noop-method-call.rs
+++ b/tests/ui/lint/noop-method-call.rs
@@ -1,6 +1,7 @@
// check-pass
// run-rustfix
+#![feature(rustc_attrs)]
#![allow(unused)]
use std::borrow::Borrow;
@@ -49,3 +50,15 @@ fn non_generic(non_clone_type: &PlainType<u32>) {
non_clone_type.clone();
//~^ WARN call to `.clone()` on a reference in this situation does nothing
}
+
+struct DiagnosticClone;
+impl Clone for DiagnosticClone {
+ #[rustc_diagnostic_item = "other_clone"]
+ fn clone(&self) -> Self {
+ DiagnosticClone
+ }
+}
+
+fn with_other_diagnostic_item(x: DiagnosticClone) {
+ x.clone();
+}
diff --git a/tests/ui/lint/noop-method-call.stderr b/tests/ui/lint/noop-method-call.stderr
index aefc2706f..d04f44022 100644
--- a/tests/ui/lint/noop-method-call.stderr
+++ b/tests/ui/lint/noop-method-call.stderr
@@ -1,5 +1,5 @@
warning: call to `.clone()` on a reference in this situation does nothing
- --> $DIR/noop-method-call.rs:15:25
+ --> $DIR/noop-method-call.rs:16:25
|
LL | let _ = &mut encoded.clone();
| ^^^^^^^^ help: remove this redundant call
@@ -8,7 +8,7 @@ LL | let _ = &mut encoded.clone();
= note: `#[warn(noop_method_call)]` on by default
warning: call to `.clone()` on a reference in this situation does nothing
- --> $DIR/noop-method-call.rs:17:21
+ --> $DIR/noop-method-call.rs:18:21
|
LL | let _ = &encoded.clone();
| ^^^^^^^^ help: remove this redundant call
@@ -16,7 +16,7 @@ LL | let _ = &encoded.clone();
= note: the type `[u8]` does not implement `Clone`, so calling `clone` on `&[u8]` copies the reference, which does not do anything and can be removed
warning: call to `.clone()` on a reference in this situation does nothing
- --> $DIR/noop-method-call.rs:23:71
+ --> $DIR/noop-method-call.rs:24:71
|
LL | let non_clone_type_ref_clone: &PlainType<u32> = non_clone_type_ref.clone();
| ^^^^^^^^ help: remove this redundant call
@@ -24,7 +24,7 @@ LL | let non_clone_type_ref_clone: &PlainType<u32> = non_clone_type_ref.clon
= note: the type `PlainType<u32>` does not implement `Clone`, so calling `clone` on `&PlainType<u32>` copies the reference, which does not do anything and can be removed
warning: call to `.deref()` on a reference in this situation does nothing
- --> $DIR/noop-method-call.rs:31:63
+ --> $DIR/noop-method-call.rs:32:63
|
LL | let non_deref_type_deref: &PlainType<u32> = non_deref_type.deref();
| ^^^^^^^^ help: remove this redundant call
@@ -32,7 +32,7 @@ LL | let non_deref_type_deref: &PlainType<u32> = non_deref_type.deref();
= note: the type `PlainType<u32>` does not implement `Deref`, so calling `deref` on `&PlainType<u32>` copies the reference, which does not do anything and can be removed
warning: call to `.borrow()` on a reference in this situation does nothing
- --> $DIR/noop-method-call.rs:35:66
+ --> $DIR/noop-method-call.rs:36:66
|
LL | let non_borrow_type_borrow: &PlainType<u32> = non_borrow_type.borrow();
| ^^^^^^^^^ help: remove this redundant call
@@ -40,7 +40,7 @@ LL | let non_borrow_type_borrow: &PlainType<u32> = non_borrow_type.borrow();
= note: the type `PlainType<u32>` does not implement `Borrow`, so calling `borrow` on `&PlainType<u32>` copies the reference, which does not do anything and can be removed
warning: call to `.clone()` on a reference in this situation does nothing
- --> $DIR/noop-method-call.rs:44:19
+ --> $DIR/noop-method-call.rs:45:19
|
LL | non_clone_type.clone();
| ^^^^^^^^ help: remove this redundant call
@@ -48,7 +48,7 @@ LL | non_clone_type.clone();
= note: the type `PlainType<T>` does not implement `Clone`, so calling `clone` on `&PlainType<T>` copies the reference, which does not do anything and can be removed
warning: call to `.clone()` on a reference in this situation does nothing
- --> $DIR/noop-method-call.rs:49:19
+ --> $DIR/noop-method-call.rs:50:19
|
LL | non_clone_type.clone();
| ^^^^^^^^ help: remove this redundant call
diff --git a/tests/ui/lint/ptr_null_checks.rs b/tests/ui/lint/ptr_null_checks.rs
index e677ea309..3028084e9 100644
--- a/tests/ui/lint/ptr_null_checks.rs
+++ b/tests/ui/lint/ptr_null_checks.rs
@@ -38,15 +38,15 @@ fn main() {
if (&mut 8 as *mut i32).is_null() {}
//~^ WARN references are not nullable
if ptr::from_mut(&mut 8).is_null() {}
- //~^ WARN references are not nullable
+ //~^ WARN call is never null
if (&8 as *const i32).is_null() {}
//~^ WARN references are not nullable
if ptr::from_ref(&8).is_null() {}
- //~^ WARN references are not nullable
+ //~^ WARN call is never null
if ptr::from_ref(&8).cast_mut().is_null() {}
- //~^ WARN references are not nullable
+ //~^ WARN call is never null
if (ptr::from_ref(&8).cast_mut() as *mut i32).is_null() {}
- //~^ WARN references are not nullable
+ //~^ WARN call is never null
if (&8 as *const i32) == std::ptr::null() {}
//~^ WARN references are not nullable
let ref_num = &8;
@@ -65,6 +65,12 @@ fn main() {
if (&*{ static_i32() } as *const i32).is_null() {}
//~^ WARN references are not nullable
+ // ---------------- Functions -------------------
+ if ptr::NonNull::new(&mut 8).unwrap().as_ptr().is_null() {}
+ //~^ WARN call is never null
+ if ptr::NonNull::<u8>::dangling().as_ptr().is_null() {}
+ //~^ WARN call is never null
+
// ----------------------------------------------
const ZPTR: *const () = 0 as *const _;
const NOT_ZPTR: *const () = 1 as *const _;
diff --git a/tests/ui/lint/ptr_null_checks.stderr b/tests/ui/lint/ptr_null_checks.stderr
index 3cee1804b..0edc1b865 100644
--- a/tests/ui/lint/ptr_null_checks.stderr
+++ b/tests/ui/lint/ptr_null_checks.stderr
@@ -117,13 +117,11 @@ LL | if (&mut 8 as *mut i32).is_null() {}
| |
| expression has type `&mut i32`
-warning: references are not nullable, so checking them for null will always return false
+warning: returned pointer of `from_mut` call is never null, so checking it for null will always return false
--> $DIR/ptr_null_checks.rs:40:8
|
LL | if ptr::from_mut(&mut 8).is_null() {}
- | ^^^^^^^^^^^^^^------^^^^^^^^^^^
- | |
- | expression has type `&mut i32`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: references are not nullable, so checking them for null will always return false
--> $DIR/ptr_null_checks.rs:42:8
@@ -133,29 +131,23 @@ LL | if (&8 as *const i32).is_null() {}
| |
| expression has type `&i32`
-warning: references are not nullable, so checking them for null will always return false
+warning: returned pointer of `from_ref` call is never null, so checking it for null will always return false
--> $DIR/ptr_null_checks.rs:44:8
|
LL | if ptr::from_ref(&8).is_null() {}
- | ^^^^^^^^^^^^^^--^^^^^^^^^^^
- | |
- | expression has type `&i32`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-warning: references are not nullable, so checking them for null will always return false
+warning: returned pointer of `from_ref` call is never null, so checking it for null will always return false
--> $DIR/ptr_null_checks.rs:46:8
|
LL | if ptr::from_ref(&8).cast_mut().is_null() {}
- | ^^^^^^^^^^^^^^--^^^^^^^^^^^^^^^^^^^^^^
- | |
- | expression has type `&i32`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-warning: references are not nullable, so checking them for null will always return false
+warning: returned pointer of `from_ref` call is never null, so checking it for null will always return false
--> $DIR/ptr_null_checks.rs:48:8
|
LL | if (ptr::from_ref(&8).cast_mut() as *mut i32).is_null() {}
- | ^^^^^^^^^^^^^^^--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | expression has type `&i32`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: references are not nullable, so checking them for null will always return false
--> $DIR/ptr_null_checks.rs:50:8
@@ -221,5 +213,17 @@ LL | if (&*{ static_i32() } as *const i32).is_null() {}
| |
| expression has type `&i32`
-warning: 25 warnings emitted
+warning: returned pointer of `as_ptr` call is never null, so checking it for null will always return false
+ --> $DIR/ptr_null_checks.rs:69:8
+ |
+LL | if ptr::NonNull::new(&mut 8).unwrap().as_ptr().is_null() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: returned pointer of `as_ptr` call is never null, so checking it for null will always return false
+ --> $DIR/ptr_null_checks.rs:71:8
+ |
+LL | if ptr::NonNull::<u8>::dangling().as_ptr().is_null() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: 27 warnings emitted
diff --git a/tests/ui/lint/reference_casting.rs b/tests/ui/lint/reference_casting.rs
index 6c38bca3d..fba8789e9 100644
--- a/tests/ui/lint/reference_casting.rs
+++ b/tests/ui/lint/reference_casting.rs
@@ -36,6 +36,12 @@ unsafe fn ref_to_mut() {
//~^ ERROR casting `&T` to `&mut T` is undefined behavior
let _num = &mut *std::mem::transmute::<_, *mut i32>(num);
//~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ let _num = &mut *(std::mem::transmute::<_, *mut i32>(num) as *mut i32);
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ let _num = &mut *std::cell::UnsafeCell::raw_get(
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ num as *const i32 as *const std::cell::UnsafeCell<i32>
+ );
let deferred = num as *const i32 as *mut i32;
let _num = &mut *deferred;
@@ -43,13 +49,35 @@ unsafe fn ref_to_mut() {
let deferred = (std::ptr::from_ref(num) as *const i32 as *const i32).cast_mut() as *mut i32;
let _num = &mut *deferred;
//~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ let deferred_rebind = deferred;
+ let _num = &mut *deferred_rebind;
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
let _num = &mut *(num as *const _ as usize as *mut i32);
//~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ let _num = &mut *(std::mem::transmute::<_, *mut _>(num as *const i32) as *mut i32);
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+
+ static NUM: &'static i32 = &2;
+ let num = NUM as *const i32 as *mut i32;
+ let num = num;
+ let num = num;
+ let _num = &mut *num;
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
unsafe fn generic_ref_cast_mut<T>(this: &T) -> &mut T {
&mut *((this as *const _) as *mut _)
//~^ ERROR casting `&T` to `&mut T` is undefined behavior
}
+
+ fn as_mut<T>(x: &T) -> &mut T {
+ unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ }
+
+ fn as_mut_i32(x: &i32) -> &mut i32 {
+ unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ }
}
unsafe fn assign_to_ref() {
@@ -71,14 +99,30 @@ unsafe fn assign_to_ref() {
//~^ ERROR assigning to `&T` is undefined behavior
*std::mem::transmute::<_, *mut i32>(num) += 1;
//~^ ERROR assigning to `&T` is undefined behavior
+ *(std::mem::transmute::<_, *mut i32>(num) as *mut i32) += 1;
+ //~^ ERROR assigning to `&T` is undefined behavior
+ std::ptr::write(
+ //~^ ERROR assigning to `&T` is undefined behavior
+ std::mem::transmute::<*const i32, *mut i32>(num),
+ -1i32,
+ );
let value = num as *const i32 as *mut i32;
*value = 1;
//~^ ERROR assigning to `&T` is undefined behavior
+ let value_rebind = value;
+ *value_rebind = 1;
+ //~^ ERROR assigning to `&T` is undefined behavior
*(num as *const i32).cast::<i32>().cast_mut() = 2;
//~^ ERROR assigning to `&T` is undefined behavior
*(num as *const _ as usize as *mut i32) = 2;
//~^ ERROR assigning to `&T` is undefined behavior
+ std::ptr::write(value, 2);
+ //~^ ERROR assigning to `&T` is undefined behavior
+ std::ptr::write_unaligned(value, 2);
+ //~^ ERROR assigning to `&T` is undefined behavior
+ std::ptr::write_volatile(value, 2);
+ //~^ ERROR assigning to `&T` is undefined behavior
unsafe fn generic_assign_to_ref<T>(this: &T, a: T) {
*(this as *const _ as *mut _) = a;
@@ -86,6 +130,7 @@ unsafe fn assign_to_ref() {
}
}
+const RAW_PTR: *mut u8 = 1 as *mut u8;
unsafe fn no_warn() {
let num = &3i32;
let mut_num = &mut 3i32;
@@ -100,6 +145,23 @@ unsafe fn no_warn() {
let mut value = 3;
let value: *const i32 = &mut value;
*(value as *const i16 as *mut i16) = 42;
+ *RAW_PTR = 42; // RAW_PTR is defined outside the function body,
+ // make sure we don't ICE on it when trying to
+ // determine if we should lint on it or not.
+
+ fn safe_as_mut<T>(x: &std::cell::UnsafeCell<T>) -> &mut T {
+ unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
+ }
+
+ fn cell_as_mut(x: &std::cell::Cell<i32>) -> &mut i32 {
+ unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
+ }
+
+ #[repr(transparent)]
+ struct DoesContainUnsafeCell(std::cell::UnsafeCell<i32>);
+ fn safe_as_mut2(x: &DoesContainUnsafeCell) -> &mut DoesContainUnsafeCell {
+ unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
+ }
}
fn main() {}
diff --git a/tests/ui/lint/reference_casting.stderr b/tests/ui/lint/reference_casting.stderr
index 7ff9b76a8..8f89cf980 100644
--- a/tests/ui/lint/reference_casting.stderr
+++ b/tests/ui/lint/reference_casting.stderr
@@ -4,6 +4,7 @@ error: casting `&T` to `&mut T` is undefined behavior, even if the reference is
LL | let _num = &mut *(num as *const i32 as *mut i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
= note: `#[deny(invalid_reference_casting)]` on by default
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
@@ -11,150 +12,328 @@ error: casting `&T` to `&mut T` is undefined behavior, even if the reference is
|
LL | let _num = &mut *(num as *const i32).cast_mut();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
--> $DIR/reference_casting.rs:23:16
|
LL | let _num = &mut *std::ptr::from_ref(num).cast_mut();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
--> $DIR/reference_casting.rs:25:16
|
LL | let _num = &mut *std::ptr::from_ref({ num }).cast_mut();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
--> $DIR/reference_casting.rs:27:16
|
LL | let _num = &mut *{ std::ptr::from_ref(num) }.cast_mut();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
--> $DIR/reference_casting.rs:29:16
|
LL | let _num = &mut *(std::ptr::from_ref({ num }) as *mut i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
--> $DIR/reference_casting.rs:31:16
|
LL | let _num = &mut *(num as *const i32).cast::<i32>().cast_mut();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
--> $DIR/reference_casting.rs:33:16
|
LL | let _num = &mut *(num as *const i32).cast::<i32>().cast_mut().cast_const().cast_mut();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
--> $DIR/reference_casting.rs:35:16
|
LL | let _num = &mut *(std::ptr::from_ref(static_u8()) as *mut i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
--> $DIR/reference_casting.rs:37:16
|
LL | let _num = &mut *std::mem::transmute::<_, *mut i32>(num);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:39:16
+ |
+LL | let _num = &mut *(std::mem::transmute::<_, *mut i32>(num) as *mut i32);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
--> $DIR/reference_casting.rs:41:16
|
+LL | let _num = &mut *std::cell::UnsafeCell::raw_get(
+ | ________________^
+LL | |
+LL | | num as *const i32 as *const std::cell::UnsafeCell<i32>
+LL | | );
+ | |_____^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:47:16
+ |
LL | let deferred = num as *const i32 as *mut i32;
| ----------------------------- casting happend here
LL | let _num = &mut *deferred;
| ^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
- --> $DIR/reference_casting.rs:44:16
+ --> $DIR/reference_casting.rs:50:16
|
LL | let deferred = (std::ptr::from_ref(num) as *const i32 as *const i32).cast_mut() as *mut i32;
| ---------------------------------------------------------------------------- casting happend here
LL | let _num = &mut *deferred;
| ^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
- --> $DIR/reference_casting.rs:46:16
+ --> $DIR/reference_casting.rs:53:16
+ |
+LL | let deferred = (std::ptr::from_ref(num) as *const i32 as *const i32).cast_mut() as *mut i32;
+ | ---------------------------------------------------------------------------- casting happend here
+...
+LL | let _num = &mut *deferred_rebind;
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:55:16
|
LL | let _num = &mut *(num as *const _ as usize as *mut i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
- --> $DIR/reference_casting.rs:50:9
+ --> $DIR/reference_casting.rs:57:16
+ |
+LL | let _num = &mut *(std::mem::transmute::<_, *mut _>(num as *const i32) as *mut i32);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:64:16
+ |
+LL | let num = NUM as *const i32 as *mut i32;
+ | ----------------------------- casting happend here
+...
+LL | let _num = &mut *num;
+ | ^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:68:9
|
LL | &mut *((this as *const _) as *mut _)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:73:18
+ |
+LL | unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:78:18
+ |
+LL | unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:60:5
+ --> $DIR/reference_casting.rs:88:5
|
LL | *(a as *const _ as *mut _) = String::from("Replaced");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:62:5
+ --> $DIR/reference_casting.rs:90:5
|
LL | *(a as *const _ as *mut String) += " world";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:64:5
+ --> $DIR/reference_casting.rs:92:5
|
LL | *std::ptr::from_ref(num).cast_mut() += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:66:5
+ --> $DIR/reference_casting.rs:94:5
|
LL | *std::ptr::from_ref({ num }).cast_mut() += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:68:5
+ --> $DIR/reference_casting.rs:96:5
|
LL | *{ std::ptr::from_ref(num) }.cast_mut() += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:70:5
+ --> $DIR/reference_casting.rs:98:5
|
LL | *(std::ptr::from_ref({ num }) as *mut i32) += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:72:5
+ --> $DIR/reference_casting.rs:100:5
|
LL | *std::mem::transmute::<_, *mut i32>(num) += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:102:5
+ |
+LL | *(std::mem::transmute::<_, *mut i32>(num) as *mut i32) += 1;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:76:5
+ --> $DIR/reference_casting.rs:104:5
+ |
+LL | / std::ptr::write(
+LL | |
+LL | | std::mem::transmute::<*const i32, *mut i32>(num),
+LL | | -1i32,
+LL | | );
+ | |_____^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:111:5
|
LL | let value = num as *const i32 as *mut i32;
| ----------------------------- casting happend here
LL | *value = 1;
| ^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:114:5
+ |
+LL | let value = num as *const i32 as *mut i32;
+ | ----------------------------- casting happend here
+...
+LL | *value_rebind = 1;
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:78:5
+ --> $DIR/reference_casting.rs:116:5
|
LL | *(num as *const i32).cast::<i32>().cast_mut() = 2;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:80:5
+ --> $DIR/reference_casting.rs:118:5
|
LL | *(num as *const _ as usize as *mut i32) = 2;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:84:9
+ --> $DIR/reference_casting.rs:120:5
+ |
+LL | let value = num as *const i32 as *mut i32;
+ | ----------------------------- casting happend here
+...
+LL | std::ptr::write(value, 2);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:122:5
+ |
+LL | let value = num as *const i32 as *mut i32;
+ | ----------------------------- casting happend here
+...
+LL | std::ptr::write_unaligned(value, 2);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:124:5
+ |
+LL | let value = num as *const i32 as *mut i32;
+ | ----------------------------- casting happend here
+...
+LL | std::ptr::write_volatile(value, 2);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:128:9
|
LL | *(this as *const _ as *mut _) = a;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
-error: aborting due to 25 previous errors
+error: aborting due to 38 previous errors
diff --git a/tests/ui/lint/trivial_casts.stderr b/tests/ui/lint/trivial_casts.stderr
index 74f962835..5e2115574 100644
--- a/tests/ui/lint/trivial_casts.stderr
+++ b/tests/ui/lint/trivial_casts.stderr
@@ -128,7 +128,7 @@ LL | let _ = &baz as &dyn Fn(i32);
|
= help: cast can be replaced by coercion; this might require a temporary variable
-error: trivial cast: `&[closure@$DIR/trivial_casts.rs:72:13: 72:22]` as `&dyn Fn(i32)`
+error: trivial cast: `&{closure@$DIR/trivial_casts.rs:72:13: 72:22}` as `&dyn Fn(i32)`
--> $DIR/trivial_casts.rs:73:13
|
LL | let _ = &x as &dyn Fn(i32);
diff --git a/tests/ui/lint/unused/unused-doc-comments-edge-cases.rs b/tests/ui/lint/unused/unused-doc-comments-edge-cases.rs
index 54d86c31f..ba32fb566 100644
--- a/tests/ui/lint/unused/unused-doc-comments-edge-cases.rs
+++ b/tests/ui/lint/unused/unused-doc-comments-edge-cases.rs
@@ -26,6 +26,32 @@ fn doc_comment_on_expr(num: u8) -> bool {
num == 3
}
+fn doc_comment_on_expr_field() -> bool {
+ struct S { foo: i32 }
+
+ let x = S {
+ /// useless doc comment
+ //~^ ERROR: unused doc comment
+ foo: 3
+ };
+
+ true
+}
+
+fn doc_comment_on_pat_field() -> bool {
+ struct S { foo: i32 }
+
+ let S {
+ /// useless doc comment
+ //~^ ERROR: unused doc comment
+ foo
+ } = S {
+ foo: 3
+ };
+
+ true
+}
+
fn doc_comment_on_generic<#[doc = "x"] T>(val: T) {}
//~^ ERROR: unused doc comment
diff --git a/tests/ui/lint/unused/unused-doc-comments-edge-cases.stderr b/tests/ui/lint/unused/unused-doc-comments-edge-cases.stderr
index 078b780d8..b5aa62157 100644
--- a/tests/ui/lint/unused/unused-doc-comments-edge-cases.stderr
+++ b/tests/ui/lint/unused/unused-doc-comments-edge-cases.stderr
@@ -42,7 +42,29 @@ LL | num == 3
= help: use `//` for a plain comment
error: unused doc comment
- --> $DIR/unused-doc-comments-edge-cases.rs:29:27
+ --> $DIR/unused-doc-comments-edge-cases.rs:33:9
+ |
+LL | /// useless doc comment
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | foo: 3
+ | ------ rustdoc does not generate documentation for expression fields
+ |
+ = help: use `//` for a plain comment
+
+error: unused doc comment
+ --> $DIR/unused-doc-comments-edge-cases.rs:45:9
+ |
+LL | /// useless doc comment
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | foo
+ | --- rustdoc does not generate documentation for pattern fields
+ |
+ = help: use `//` for a plain comment
+
+error: unused doc comment
+ --> $DIR/unused-doc-comments-edge-cases.rs:55:27
|
LL | fn doc_comment_on_generic<#[doc = "x"] T>(val: T) {}
| ^^^^^^^^^^^^ - rustdoc does not generate documentation for generic parameters
@@ -50,7 +72,7 @@ LL | fn doc_comment_on_generic<#[doc = "x"] T>(val: T) {}
= help: use `//` for a plain comment
error: unused doc comment
- --> $DIR/unused-doc-comments-edge-cases.rs:33:5
+ --> $DIR/unused-doc-comments-edge-cases.rs:59:5
|
LL | /// unused doc comment
| ^^^^^^^^^^^^^^^^^^^^^^
@@ -63,7 +85,7 @@ LL | | }
= help: use `//` for a plain comment
error: unused doc comment
- --> $DIR/unused-doc-comments-edge-cases.rs:40:1
+ --> $DIR/unused-doc-comments-edge-cases.rs:66:1
|
LL | /// unused doc comment
| ^^^^^^^^^^^^^^^^^^^^^^
@@ -89,7 +111,7 @@ help: you might have meant to return this value
LL | return true;
| ++++++ +
-error: aborting due to 8 previous errors
+error: aborting due to 10 previous errors
Some errors have detailed explanations: E0308, E0658.
For more information about an error, try `rustc --explain E0308`.
diff --git a/tests/ui/lint/unused/unused-parens-issue-106413.rs b/tests/ui/lint/unused/unused-parens-issue-106413.rs
new file mode 100644
index 000000000..7e76ab073
--- /dev/null
+++ b/tests/ui/lint/unused/unused-parens-issue-106413.rs
@@ -0,0 +1,32 @@
+// check-pass
+#![warn(unused_parens)]
+
+fn id<T>(t: T) -> T { t }
+
+fn main() {
+ // This should not warn
+ let _ = 1 as (i32) < 2;
+ let _ = id(1 as (i32) < 2);
+ let _ = id(1 as i32)
+ as (i32) < 2;
+ // These should warn
+ let _ = 1 as ((i32)) < 2; //~WARN unnecessary parentheses
+ let _ = 1 as (i32); //~WARN unnecessary parentheses
+ let _ = 1 as (i32) > 2; //~WARN unnecessary parentheses
+ let _ = id(1 as (i32)) //~WARN unnecessary parentheses
+ as (i32) < 2;
+ let _ = id(1 as (i32)) < 2; //~WARN unnecessary parentheses
+
+ // This should not warn
+ let _ = 1 as (i32) << 2;
+ let _ = id(1 as (i32) << 2);
+ let _ = id(1 as i32)
+ as (i32) << 2;
+ // These should warn
+ let _ = 1 as ((i32)) << 2; //~WARN unnecessary parentheses
+ let _ = 1 as (i32); //~WARN unnecessary parentheses
+ let _ = 1 as (i32) >> 2; //~WARN unnecessary parentheses
+ let _ = id(1 as (i32)) //~WARN unnecessary parentheses
+ as (i32) << 2;
+ let _ = id(1 as (i32)) << 2; //~WARN unnecessary parentheses
+}
diff --git a/tests/ui/lint/unused/unused-parens-issue-106413.stderr b/tests/ui/lint/unused/unused-parens-issue-106413.stderr
new file mode 100644
index 000000000..d2d8f76d9
--- /dev/null
+++ b/tests/ui/lint/unused/unused-parens-issue-106413.stderr
@@ -0,0 +1,127 @@
+warning: unnecessary parentheses around type
+ --> $DIR/unused-parens-issue-106413.rs:13:19
+ |
+LL | let _ = 1 as ((i32)) < 2;
+ | ^ ^
+ |
+note: the lint level is defined here
+ --> $DIR/unused-parens-issue-106413.rs:2:9
+ |
+LL | #![warn(unused_parens)]
+ | ^^^^^^^^^^^^^
+help: remove these parentheses
+ |
+LL - let _ = 1 as ((i32)) < 2;
+LL + let _ = 1 as (i32) < 2;
+ |
+
+warning: unnecessary parentheses around type
+ --> $DIR/unused-parens-issue-106413.rs:14:18
+ |
+LL | let _ = 1 as (i32);
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let _ = 1 as (i32);
+LL + let _ = 1 as i32;
+ |
+
+warning: unnecessary parentheses around type
+ --> $DIR/unused-parens-issue-106413.rs:15:18
+ |
+LL | let _ = 1 as (i32) > 2;
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let _ = 1 as (i32) > 2;
+LL + let _ = 1 as i32 > 2;
+ |
+
+warning: unnecessary parentheses around type
+ --> $DIR/unused-parens-issue-106413.rs:16:21
+ |
+LL | let _ = id(1 as (i32))
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let _ = id(1 as (i32))
+LL + let _ = id(1 as i32)
+ |
+
+warning: unnecessary parentheses around type
+ --> $DIR/unused-parens-issue-106413.rs:18:21
+ |
+LL | let _ = id(1 as (i32)) < 2;
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let _ = id(1 as (i32)) < 2;
+LL + let _ = id(1 as i32) < 2;
+ |
+
+warning: unnecessary parentheses around type
+ --> $DIR/unused-parens-issue-106413.rs:26:19
+ |
+LL | let _ = 1 as ((i32)) << 2;
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let _ = 1 as ((i32)) << 2;
+LL + let _ = 1 as (i32) << 2;
+ |
+
+warning: unnecessary parentheses around type
+ --> $DIR/unused-parens-issue-106413.rs:27:18
+ |
+LL | let _ = 1 as (i32);
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let _ = 1 as (i32);
+LL + let _ = 1 as i32;
+ |
+
+warning: unnecessary parentheses around type
+ --> $DIR/unused-parens-issue-106413.rs:28:18
+ |
+LL | let _ = 1 as (i32) >> 2;
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let _ = 1 as (i32) >> 2;
+LL + let _ = 1 as i32 >> 2;
+ |
+
+warning: unnecessary parentheses around type
+ --> $DIR/unused-parens-issue-106413.rs:29:21
+ |
+LL | let _ = id(1 as (i32))
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let _ = id(1 as (i32))
+LL + let _ = id(1 as i32)
+ |
+
+warning: unnecessary parentheses around type
+ --> $DIR/unused-parens-issue-106413.rs:31:21
+ |
+LL | let _ = id(1 as (i32)) << 2;
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let _ = id(1 as (i32)) << 2;
+LL + let _ = id(1 as i32) << 2;
+ |
+
+warning: 10 warnings emitted
+
diff --git a/tests/ui/issues/issue-69225-SCEVAddExpr-wrap-flag.rs b/tests/ui/loops/issue-69225-SCEVAddExpr-wrap-flag.rs
index 6e030f1cc..6e030f1cc 100644
--- a/tests/ui/issues/issue-69225-SCEVAddExpr-wrap-flag.rs
+++ b/tests/ui/loops/issue-69225-SCEVAddExpr-wrap-flag.rs
diff --git a/tests/ui/issues/issue-69225-layout-repeated-checked-add.rs b/tests/ui/loops/issue-69225-layout-repeated-checked-add.rs
index 7f43e4d1a..7f43e4d1a 100644
--- a/tests/ui/issues/issue-69225-layout-repeated-checked-add.rs
+++ b/tests/ui/loops/issue-69225-layout-repeated-checked-add.rs
diff --git a/tests/ui/loops/loop-break-value.rs b/tests/ui/loops/loop-break-value.rs
index 51c9a36a0..c35200520 100644
--- a/tests/ui/loops/loop-break-value.rs
+++ b/tests/ui/loops/loop-break-value.rs
@@ -95,4 +95,67 @@ fn main() {
break LOOP;
//~^ ERROR cannot find value `LOOP` in this scope
}
+
+ let _ = 'a: loop {
+ loop {
+ break; // This doesn't affect the expected break type of the 'a loop
+ loop {
+ loop {
+ break 'a 1;
+ }
+ }
+ }
+ break; //~ ERROR mismatched types
+ };
+
+ let _ = 'a: loop {
+ loop {
+ break; // This doesn't affect the expected break type of the 'a loop
+ loop {
+ loop {
+ break 'a 1;
+ }
+ }
+ }
+ break 'a; //~ ERROR mismatched types
+ };
+
+ loop {
+ break;
+ let _ = loop {
+ break 2;
+ loop {
+ break;
+ }
+ };
+ break 2; //~ ERROR mismatched types
+ }
+
+ 'a: loop {
+ break;
+ let _ = 'a: loop {
+ //~^ WARNING label name `'a` shadows a label name that is already in scope
+ break 2;
+ loop {
+ break 'a; //~ ERROR mismatched types
+ }
+ };
+ break 2; //~ ERROR mismatched types
+ }
+
+ 'a: loop {
+ break;
+ let _ = 'a: loop {
+ //~^ WARNING label name `'a` shadows a label name that is already in scope
+ break 'a 2;
+ loop {
+ break 'a; //~ ERROR mismatched types
+ }
+ };
+ break 2; //~ ERROR mismatched types
+ };
+
+ loop { // point at the return type
+ break 2; //~ ERROR mismatched types
+ }
}
diff --git a/tests/ui/loops/loop-break-value.stderr b/tests/ui/loops/loop-break-value.stderr
index 5525dbb90..6c83bc757 100644
--- a/tests/ui/loops/loop-break-value.stderr
+++ b/tests/ui/loops/loop-break-value.stderr
@@ -1,3 +1,21 @@
+warning: label name `'a` shadows a label name that is already in scope
+ --> $DIR/loop-break-value.rs:136:17
+ |
+LL | 'a: loop {
+ | -- first declared here
+LL | break;
+LL | let _ = 'a: loop {
+ | ^^ label `'a` already in scope
+
+warning: label name `'a` shadows a label name that is already in scope
+ --> $DIR/loop-break-value.rs:148:17
+ |
+LL | 'a: loop {
+ | -- first declared here
+LL | break;
+LL | let _ = 'a: loop {
+ | ^^ label `'a` already in scope
+
error[E0425]: cannot find value `LOOP` in this scope
--> $DIR/loop-break-value.rs:95:15
|
@@ -134,7 +152,10 @@ error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:4:31
|
LL | let val: ! = loop { break break; };
- | ^^^^^ expected `!`, found `()`
+ | --- ---- ^^^^^ expected `!`, found `()`
+ | | |
+ | | this loop is expected to be of type `!`
+ | expected because of this assignment
|
= note: expected type `!`
found unit type `()`
@@ -142,24 +163,38 @@ LL | let val: ! = loop { break break; };
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:11:19
|
+LL | break "asdf";
+ | ------------ expected because of this `break`
+LL | } else {
LL | break 123;
| ^^^ expected `&str`, found integer
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:16:15
|
+LL | let _: i32 = loop {
+ | - ---- this loop is expected to be of type `i32`
+ | |
+ | expected because of this assignment
LL | break "asdf";
| ^^^^^^ expected `i32`, found `&str`
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:21:31
|
+LL | let _: i32 = 'outer_loop: loop {
+ | - ---- this loop is expected to be of type `i32`
+ | |
+ | expected because of this assignment
+LL | loop {
LL | break 'outer_loop "nope";
| ^^^^^^ expected `i32`, found `&str`
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:73:26
|
+LL | break;
+ | ----- expected because of this `break`
LL | break 'c 123;
| ^^^ expected `()`, found integer
@@ -167,7 +202,11 @@ error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:80:15
|
LL | break (break, break);
- | ^^^^^^^^^^^^^^ expected `()`, found `(!, !)`
+ | ^-----^^-----^
+ | || |
+ | || expected because of this `break`
+ | |expected because of this `break`
+ | expected `()`, found `(!, !)`
|
= note: expected unit type `()`
found tuple `(!, !)`
@@ -175,19 +214,119 @@ LL | break (break, break);
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:85:15
|
+LL | break;
+ | ----- expected because of this `break`
LL | break 2;
| ^ expected `()`, found integer
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:90:9
|
+LL | break 2;
+ | ------- expected because of this `break`
LL | break;
- | ^^^^^
- | |
- | expected integer, found `()`
- | help: give it a value of the expected type: `break value`
+ | ^^^^^ expected integer, found `()`
+ |
+help: give it a value of the expected type
+ |
+LL | break value;
+ | +++++
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:108:9
+ |
+LL | break 'a 1;
+ | ---------- expected because of this `break`
+...
+LL | break;
+ | ^^^^^ expected integer, found `()`
+ |
+help: give it a value of the expected type
+ |
+LL | break value;
+ | +++++
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:120:9
+ |
+LL | break 'a 1;
+ | ---------- expected because of this `break`
+...
+LL | break 'a;
+ | ^^^^^^^^ expected integer, found `()`
+ |
+help: give it a value of the expected type
+ |
+LL | break 'a value;
+ | +++++
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:131:15
+ |
+LL | break;
+ | ----- expected because of this `break`
+...
+LL | break 2;
+ | ^ expected `()`, found integer
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:140:17
+ |
+LL | break 2;
+ | ------- expected because of this `break`
+LL | loop {
+LL | break 'a;
+ | ^^^^^^^^ expected integer, found `()`
+ |
+help: give it a value of the expected type
+ |
+LL | break 'a value;
+ | +++++
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:143:15
+ |
+LL | break;
+ | ----- expected because of this `break`
+...
+LL | break 2;
+ | ^ expected `()`, found integer
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:152:17
+ |
+LL | break 'a 2;
+ | ---------- expected because of this `break`
+LL | loop {
+LL | break 'a;
+ | ^^^^^^^^ expected integer, found `()`
+ |
+help: give it a value of the expected type
+ |
+LL | break 'a value;
+ | +++++
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:155:15
+ |
+LL | break;
+ | ----- expected because of this `break`
+...
+LL | break 2;
+ | ^ expected `()`, found integer
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:159:15
+ |
+LL | fn main() {
+ | - expected `()` because of this return type
+...
+LL | loop { // point at the return type
+ | ---- this loop is expected to be of type `()`
+LL | break 2;
+ | ^ expected `()`, found integer
-error: aborting due to 17 previous errors; 1 warning emitted
+error: aborting due to 25 previous errors; 3 warnings emitted
Some errors have detailed explanations: E0308, E0425, E0571.
For more information about an error, try `rustc --explain E0308`.
diff --git a/tests/ui/loops/loop-labeled-break-value.stderr b/tests/ui/loops/loop-labeled-break-value.stderr
index aa04d330f..694d6c306 100644
--- a/tests/ui/loops/loop-labeled-break-value.stderr
+++ b/tests/ui/loops/loop-labeled-break-value.stderr
@@ -2,28 +2,43 @@ error[E0308]: mismatched types
--> $DIR/loop-labeled-break-value.rs:3:29
|
LL | let _: i32 = loop { break };
- | ^^^^^
- | |
- | expected `i32`, found `()`
- | help: give it a value of the expected type: `break 42`
+ | - ---- ^^^^^ expected `i32`, found `()`
+ | | |
+ | | this loop is expected to be of type `i32`
+ | expected because of this assignment
+ |
+help: give it a value of the expected type
+ |
+LL | let _: i32 = loop { break 42 };
+ | ++
error[E0308]: mismatched types
--> $DIR/loop-labeled-break-value.rs:6:37
|
LL | let _: i32 = 'inner: loop { break 'inner };
- | ^^^^^^^^^^^^
- | |
- | expected `i32`, found `()`
- | help: give it a value of the expected type: `break 'inner 42`
+ | - ---- ^^^^^^^^^^^^ expected `i32`, found `()`
+ | | |
+ | | this loop is expected to be of type `i32`
+ | expected because of this assignment
+ |
+help: give it a value of the expected type
+ |
+LL | let _: i32 = 'inner: loop { break 'inner 42 };
+ | ++
error[E0308]: mismatched types
--> $DIR/loop-labeled-break-value.rs:9:45
|
LL | let _: i32 = 'inner2: loop { loop { break 'inner2 } };
- | ^^^^^^^^^^^^^
- | |
- | expected `i32`, found `()`
- | help: give it a value of the expected type: `break 'inner2 42`
+ | - ---- ^^^^^^^^^^^^^ expected `i32`, found `()`
+ | | |
+ | | this loop is expected to be of type `i32`
+ | expected because of this assignment
+ |
+help: give it a value of the expected type
+ |
+LL | let _: i32 = 'inner2: loop { loop { break 'inner2 42 } };
+ | ++
error: aborting due to 3 previous errors
diff --git a/tests/ui/loops/loop-properly-diverging-2.stderr b/tests/ui/loops/loop-properly-diverging-2.stderr
index 5030a2935..1d1ae60cd 100644
--- a/tests/ui/loops/loop-properly-diverging-2.stderr
+++ b/tests/ui/loops/loop-properly-diverging-2.stderr
@@ -2,10 +2,15 @@ error[E0308]: mismatched types
--> $DIR/loop-properly-diverging-2.rs:2:23
|
LL | let x: i32 = loop { break };
- | ^^^^^
- | |
- | expected `i32`, found `()`
- | help: give it a value of the expected type: `break 42`
+ | - ---- ^^^^^ expected `i32`, found `()`
+ | | |
+ | | this loop is expected to be of type `i32`
+ | expected because of this assignment
+ |
+help: give it a value of the expected type
+ |
+LL | let x: i32 = loop { break 42 };
+ | ++
error: aborting due to previous error
diff --git a/tests/ui/issue-2804.rs b/tests/ui/macros/issue-2804.rs
index 571028c5e..571028c5e 100644
--- a/tests/ui/issue-2804.rs
+++ b/tests/ui/macros/issue-2804.rs
diff --git a/tests/ui/issues/issue-39467.rs b/tests/ui/macros/issue-39467.rs
index 397751e4e..397751e4e 100644
--- a/tests/ui/issues/issue-39467.rs
+++ b/tests/ui/macros/issue-39467.rs
diff --git a/tests/ui/macros/must-use-in-macro-55516.stderr b/tests/ui/macros/must-use-in-macro-55516.stderr
index 8878b0eea..7bf4aaab5 100644
--- a/tests/ui/macros/must-use-in-macro-55516.stderr
+++ b/tests/ui/macros/must-use-in-macro-55516.stderr
@@ -6,6 +6,7 @@ LL | write!(&mut example, "{}", 42);
|
= note: this `Result` may be an `Err` variant, which should be handled
= note: `-W unused-must-use` implied by `-W unused`
+ = help: to override `-W unused` add `#[allow(unused_must_use)]`
= note: this warning originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: 1 warning emitted
diff --git a/tests/ui/main-wrong-type.stderr b/tests/ui/main-wrong-type.stderr
index 43efaf884..1e5f36875 100644
--- a/tests/ui/main-wrong-type.stderr
+++ b/tests/ui/main-wrong-type.stderr
@@ -4,8 +4,8 @@ error[E0580]: `main` function has wrong type
LL | fn main(foo: S) {
| ^^^^^^^^^^^^^^^ incorrect number of function parameters
|
- = note: expected fn pointer `fn()`
- found fn pointer `fn(S)`
+ = note: expected signature `fn()`
+ found signature `fn(S)`
error: aborting due to previous error
diff --git a/tests/ui/match/issue-72896.rs b/tests/ui/match/issue-72896-non-partial-eq-const.rs
index 3a8b82037..a3095f0be 100644
--- a/tests/ui/match/issue-72896.rs
+++ b/tests/ui/match/issue-72896-non-partial-eq-const.rs
@@ -17,7 +17,8 @@ const CONST_SET: EnumSet<Enum8> = EnumSet { __enumset_underlying: 3 };
fn main() {
match CONST_SET {
- CONST_SET => { /* ok */ }
+ CONST_SET => { /* ok */ } //~WARN: must implement `PartialEq`
+ //~| previously accepted
_ => panic!("match fell through?"),
}
}
diff --git a/tests/ui/match/issue-72896-non-partial-eq-const.stderr b/tests/ui/match/issue-72896-non-partial-eq-const.stderr
new file mode 100644
index 000000000..a7fc0cfc0
--- /dev/null
+++ b/tests/ui/match/issue-72896-non-partial-eq-const.stderr
@@ -0,0 +1,23 @@
+warning: to use a constant of type `EnumSet<Enum8>` in a pattern, the type must implement `PartialEq`
+ --> $DIR/issue-72896-non-partial-eq-const.rs:20:9
+ |
+LL | CONST_SET => { /* ok */ }
+ | ^^^^^^^^^
+ |
+ = 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 #116122 <https://github.com/rust-lang/rust/issues/116122>
+ = note: `#[warn(const_patterns_without_partial_eq)]` on by default
+
+warning: 1 warning emitted
+
+Future incompatibility report: Future breakage diagnostic:
+warning: to use a constant of type `EnumSet<Enum8>` in a pattern, the type must implement `PartialEq`
+ --> $DIR/issue-72896-non-partial-eq-const.rs:20:9
+ |
+LL | CONST_SET => { /* ok */ }
+ | ^^^^^^^^^
+ |
+ = 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 #116122 <https://github.com/rust-lang/rust/issues/116122>
+ = note: `#[warn(const_patterns_without_partial_eq)]` on by default
+
diff --git a/tests/ui/match/match_non_exhaustive.stderr b/tests/ui/match/match_non_exhaustive.stderr
index 46ee8d517..7b8bdfe00 100644
--- a/tests/ui/match/match_non_exhaustive.stderr
+++ b/tests/ui/match/match_non_exhaustive.stderr
@@ -45,7 +45,8 @@ note: `E2` defined here
|
LL | pub enum E2 { A, B }
| ^^^^^^^^^^^
- = note: the matched value is of type `E2`, which is marked as non-exhaustive
+ = note: the matched value is of type `E2`
+ = note: `E2` is marked as non-exhaustive, so a wildcard `_` is necessary to match exhaustively
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 | match e2 { E2::A => (), E2::B => (), _ => todo!() };
diff --git a/tests/ui/issues/issue-3707.rs b/tests/ui/methods/issue-3707.rs
index 0817c51ee..0817c51ee 100644
--- a/tests/ui/issues/issue-3707.rs
+++ b/tests/ui/methods/issue-3707.rs
diff --git a/tests/ui/issues/issue-3707.stderr b/tests/ui/methods/issue-3707.stderr
index 07c8101cb..07c8101cb 100644
--- a/tests/ui/issues/issue-3707.stderr
+++ b/tests/ui/methods/issue-3707.stderr
diff --git a/tests/ui/methods/issues/issue-61525.stderr b/tests/ui/methods/issues/issue-61525.stderr
index a8afdeb84..a329b52e3 100644
--- a/tests/ui/methods/issues/issue-61525.stderr
+++ b/tests/ui/methods/issues/issue-61525.stderr
@@ -1,8 +1,8 @@
error[E0277]: the size for values of type `dyn ToString` cannot be known at compilation time
- --> $DIR/issue-61525.rs:14:33
+ --> $DIR/issue-61525.rs:14:19
|
LL | 1.query::<dyn ToString>("")
- | ----- ^^ doesn't have a size known at compile-time
+ | ----- ^^^^^^^^^^^^ doesn't have a size known at compile-time
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/methods/method-missing-call.stderr b/tests/ui/methods/method-missing-call.stderr
index 040a65d16..bc508461b 100644
--- a/tests/ui/methods/method-missing-call.stderr
+++ b/tests/ui/methods/method-missing-call.stderr
@@ -9,7 +9,7 @@ help: use parentheses to call the method
LL | .get_x();
| ++
-error[E0615]: attempted to take value of method `filter_map` on type `Filter<Map<std::slice::Iter<'_, {integer}>, [closure@$DIR/method-missing-call.rs:27:20: 27:23]>, [closure@$DIR/method-missing-call.rs:28:23: 28:28]>`
+error[E0615]: attempted to take value of method `filter_map` on type `Filter<Map<std::slice::Iter<'_, {integer}>, {closure@$DIR/method-missing-call.rs:27:20: 27:23}>, {closure@$DIR/method-missing-call.rs:28:23: 28:28}>`
--> $DIR/method-missing-call.rs:29:16
|
LL | .filter_map;
diff --git a/tests/ui/mir/issue-92893.rs b/tests/ui/mir/issue-92893.rs
index 635050f37..6127d267e 100644
--- a/tests/ui/mir/issue-92893.rs
+++ b/tests/ui/mir/issue-92893.rs
@@ -1,7 +1,5 @@
struct Bug<A = [(); (let a = (), 1).1]> {
- //~^ `let` expressions are not supported here
- //~| `let` expressions in this position are unstable [E0658]
- //~| expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
a: A
}
diff --git a/tests/ui/mir/issue-92893.stderr b/tests/ui/mir/issue-92893.stderr
index 4a0fcce31..6c1a9dc03 100644
--- a/tests/ui/mir/issue-92893.stderr
+++ b/tests/ui/mir/issue-92893.stderr
@@ -3,24 +3,8 @@ error: expected expression, found `let` statement
|
LL | struct Bug<A = [(); (let a = (), 1).1]> {
| ^^^
-
-error: `let` expressions are not supported here
- --> $DIR/issue-92893.rs:1:22
- |
-LL | struct Bug<A = [(); (let a = (), 1).1]> {
- | ^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/issue-92893.rs:1:22
- |
-LL | struct Bug<A = [(); (let a = (), 1).1]> {
- | ^^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error: aborting due to 3 previous errors
+error: aborting due to previous error
-For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/mir/mir-inlining/always-encode-mirs.rs b/tests/ui/mir/mir-inlining/always-encode-mirs.rs
new file mode 100644
index 000000000..f3731996c
--- /dev/null
+++ b/tests/ui/mir/mir-inlining/always-encode-mirs.rs
@@ -0,0 +1,12 @@
+// Regression test for MIR inlining with -Zalways-encode-mir enabled in the auxiliary crate.
+// Previously we inlined function not eligible for inlining which lead to linking error:
+// undefined reference to `internal::S'
+//
+// aux-build:internal.rs
+// build-pass
+// compile-flags: -O
+extern crate internal;
+
+fn main() {
+ println!("{}", internal::f());
+}
diff --git a/tests/ui/mir/mir-inlining/auxiliary/internal.rs b/tests/ui/mir/mir-inlining/auxiliary/internal.rs
new file mode 100644
index 000000000..fa0f9c2da
--- /dev/null
+++ b/tests/ui/mir/mir-inlining/auxiliary/internal.rs
@@ -0,0 +1,7 @@
+// compile-flags: -Zalways-encode-mir
+
+static S: usize = 42;
+
+pub fn f() -> &'static usize {
+ &S
+}
diff --git a/tests/ui/mismatched_types/cast-rfc0401.stderr b/tests/ui/mismatched_types/cast-rfc0401.stderr
index 6b9ac3c58..d63cec489 100644
--- a/tests/ui/mismatched_types/cast-rfc0401.stderr
+++ b/tests/ui/mismatched_types/cast-rfc0401.stderr
@@ -82,13 +82,18 @@ error[E0606]: casting `f32` as `*const u8` is invalid
LL | let _ = f as *const u8;
| ^^^^^^^^^^^^^^
-error[E0054]: cannot cast as `bool`
+error[E0054]: cannot cast `i32` as `bool`
--> $DIR/cast-rfc0401.rs:39:13
|
LL | let _ = 3_i32 as bool;
- | ^^^^^^^^^^^^^ help: compare with zero instead: `3_i32 != 0`
+ | ^^^^^^^^^^^^^
+ |
+help: compare with zero instead
+ |
+LL | let _ = 3_i32 != 0;
+ | ~~~~
-error[E0054]: cannot cast as `bool`
+error[E0054]: cannot cast `E` as `bool`
--> $DIR/cast-rfc0401.rs:40:13
|
LL | let _ = E::A as bool;
diff --git a/tests/ui/issues/issue-13033.rs b/tests/ui/mismatched_types/issue-13033.rs
index fdb356e70..fdb356e70 100644
--- a/tests/ui/issues/issue-13033.rs
+++ b/tests/ui/mismatched_types/issue-13033.rs
diff --git a/tests/ui/issues/issue-13033.stderr b/tests/ui/mismatched_types/issue-13033.stderr
index db2c1189e..db2c1189e 100644
--- a/tests/ui/issues/issue-13033.stderr
+++ b/tests/ui/mismatched_types/issue-13033.stderr
diff --git a/tests/ui/mismatched_types/issue-36053-2.stderr b/tests/ui/mismatched_types/issue-36053-2.stderr
index 4d230ce9a..bac27788a 100644
--- a/tests/ui/mismatched_types/issue-36053-2.stderr
+++ b/tests/ui/mismatched_types/issue-36053-2.stderr
@@ -15,7 +15,7 @@ help: consider adjusting the signature so it borrows its argument
LL | once::<&str>("str").fuse().filter(|a: &&str| true).count();
| +
-error[E0599]: the method `count` exists for struct `Filter<Fuse<Once<&str>>, [closure@issue-36053-2.rs:7:39]>`, but its trait bounds were not satisfied
+error[E0599]: the method `count` exists for struct `Filter<Fuse<Once<&str>>, {closure@issue-36053-2.rs:7:39}>`, but its trait bounds were not satisfied
--> $DIR/issue-36053-2.rs:7:55
|
LL | once::<&str>("str").fuse().filter(|a: &str| true).count();
@@ -28,12 +28,12 @@ LL | once::<&str>("str").fuse().filter(|a: &str| true).count();
= note: doesn't satisfy `_: Iterator`
|
= note: the following trait bounds were not satisfied:
- `<[closure@$DIR/issue-36053-2.rs:7:39: 7:48] as FnOnce<(&&str,)>>::Output = bool`
- which is required by `Filter<Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:48]>: Iterator`
- `[closure@$DIR/issue-36053-2.rs:7:39: 7:48]: FnMut<(&&str,)>`
- which is required by `Filter<Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:48]>: Iterator`
- `Filter<Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:48]>: Iterator`
- which is required by `&mut Filter<Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:48]>: Iterator`
+ `<{closure@$DIR/issue-36053-2.rs:7:39: 7:48} as FnOnce<(&&str,)>>::Output = bool`
+ which is required by `Filter<Fuse<std::iter::Once<&str>>, {closure@$DIR/issue-36053-2.rs:7:39: 7:48}>: Iterator`
+ `{closure@$DIR/issue-36053-2.rs:7:39: 7:48}: FnMut<(&&str,)>`
+ which is required by `Filter<Fuse<std::iter::Once<&str>>, {closure@$DIR/issue-36053-2.rs:7:39: 7:48}>: Iterator`
+ `Filter<Fuse<std::iter::Once<&str>>, {closure@$DIR/issue-36053-2.rs:7:39: 7:48}>: Iterator`
+ which is required by `&mut Filter<Fuse<std::iter::Once<&str>>, {closure@$DIR/issue-36053-2.rs:7:39: 7:48}>: Iterator`
error: aborting due to 2 previous errors
diff --git a/tests/ui/mismatched_types/normalize-fn-sig.stderr b/tests/ui/mismatched_types/normalize-fn-sig.stderr
index e3a064655..252e56387 100644
--- a/tests/ui/mismatched_types/normalize-fn-sig.stderr
+++ b/tests/ui/mismatched_types/normalize-fn-sig.stderr
@@ -8,7 +8,6 @@ LL | needs_i32_ref_fn(foo::<()>);
|
= note: expected fn pointer `fn(&'static i32, i32)`
found fn item `fn(i32, &'static i32) {foo::<()>}`
- = note: when the arguments and return types match, functions can be coerced to function pointers
note: function defined here
--> $DIR/normalize-fn-sig.rs:11:4
|
diff --git a/tests/ui/issues/issue-34721.fixed b/tests/ui/moves/issue-34721.fixed
index f135ad383..f135ad383 100644
--- a/tests/ui/issues/issue-34721.fixed
+++ b/tests/ui/moves/issue-34721.fixed
diff --git a/tests/ui/issues/issue-34721.rs b/tests/ui/moves/issue-34721.rs
index 14dd01766..14dd01766 100644
--- a/tests/ui/issues/issue-34721.rs
+++ b/tests/ui/moves/issue-34721.rs
diff --git a/tests/ui/issues/issue-34721.stderr b/tests/ui/moves/issue-34721.stderr
index f2bf22227..f2bf22227 100644
--- a/tests/ui/issues/issue-34721.stderr
+++ b/tests/ui/moves/issue-34721.stderr
diff --git a/tests/ui/namespace/namespace-mix.stderr b/tests/ui/namespace/namespace-mix.stderr
index 3ac5e96c5..4eff08ead 100644
--- a/tests/ui/namespace/namespace-mix.stderr
+++ b/tests/ui/namespace/namespace-mix.stderr
@@ -114,6 +114,11 @@ LL | check(m1::S{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -128,6 +133,11 @@ LL | check(m2::S{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -142,6 +152,11 @@ LL | check(m2::S);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -156,6 +171,11 @@ LL | check(xm1::S{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -170,6 +190,11 @@ LL | check(xm2::S{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -184,6 +209,11 @@ LL | check(xm2::S);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -198,6 +228,11 @@ LL | check(m3::TS{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -212,6 +247,11 @@ LL | check(m3::TS);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -226,6 +266,11 @@ LL | check(m4::TS{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -240,6 +285,11 @@ LL | check(m4::TS);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -254,6 +304,11 @@ LL | check(xm3::TS{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -268,6 +323,11 @@ LL | check(xm3::TS);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -282,6 +342,11 @@ LL | check(xm4::TS{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -296,6 +361,11 @@ LL | check(xm4::TS);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -310,6 +380,11 @@ LL | check(m5::US{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -324,6 +399,11 @@ LL | check(m5::US);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -338,6 +418,11 @@ LL | check(m6::US{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -352,6 +437,11 @@ LL | check(m6::US);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -366,6 +456,11 @@ LL | check(xm5::US{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -380,6 +475,11 @@ LL | check(xm5::US);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -394,6 +494,11 @@ LL | check(xm6::US{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -408,6 +513,11 @@ LL | check(xm6::US);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -422,6 +532,11 @@ LL | check(m7::V{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -436,6 +551,11 @@ LL | check(m8::V{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -450,6 +570,11 @@ LL | check(m8::V);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -464,6 +589,11 @@ LL | check(xm7::V{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -478,6 +608,11 @@ LL | check(xm8::V{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -492,6 +627,11 @@ LL | check(xm8::V);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -506,6 +646,11 @@ LL | check(m9::TV{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -520,6 +665,11 @@ LL | check(m9::TV);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -534,6 +684,11 @@ LL | check(mA::TV{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -548,6 +703,11 @@ LL | check(mA::TV);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -562,6 +722,11 @@ LL | check(xm9::TV{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -576,6 +741,11 @@ LL | check(xm9::TV);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -590,6 +760,11 @@ LL | check(xmA::TV{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -604,6 +779,11 @@ LL | check(xmA::TV);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -618,6 +798,11 @@ LL | check(mB::UV{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -632,6 +817,11 @@ LL | check(mB::UV);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -646,6 +836,11 @@ LL | check(mC::UV{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -660,6 +855,11 @@ LL | check(mC::UV);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -674,6 +874,11 @@ LL | check(xmB::UV{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -688,6 +893,11 @@ LL | check(xmB::UV);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -702,6 +912,11 @@ LL | check(xmC::UV{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -716,6 +931,11 @@ LL | check(xmC::UV);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
diff --git a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs b/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs
deleted file mode 100644
index 0ccd441cc..000000000
--- a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// gate-test-packed_bundled_libs
-
-// ignore-wasm32-bare
-// compile-flags: --crate-type rlib
-// error-pattern: link modifiers combination `+bundle,+whole-archive` is unstable when generating rlibs
-// build-fail
-
-#[link(name = "rust_test_helpers", kind = "static", modifiers = "+bundle,+whole-archive")]
-extern "C" {}
-
-fn main() {}
diff --git a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.stderr b/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.stderr
deleted file mode 100644
index 8a9fed740..000000000
--- a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.stderr
+++ /dev/null
@@ -1,4 +0,0 @@
-error: link modifiers combination `+bundle,+whole-archive` is unstable when generating rlibs
-
-error: aborting due to previous error
-
diff --git a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.rs b/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.rs
deleted file mode 100644
index 18d4b52a3..000000000
--- a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// gate-test-packed_bundled_libs
-
-// ignore-wasm32-bare
-// compile-flags: -l static:+bundle,+whole-archive=rust_test_helpers --crate-type rlib
-// error-pattern: link modifiers combination `+bundle,+whole-archive` is unstable when generating rlibs
-// build-fail
-
-fn main() {}
diff --git a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.stderr b/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.stderr
deleted file mode 100644
index 8a9fed740..000000000
--- a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.stderr
+++ /dev/null
@@ -1,4 +0,0 @@
-error: link modifiers combination `+bundle,+whole-archive` is unstable when generating rlibs
-
-error: aborting due to previous error
-
diff --git a/tests/ui/nested-ty-params.rs b/tests/ui/nested-ty-params.rs
index 85413acdb..25bac1ba2 100644
--- a/tests/ui/nested-ty-params.rs
+++ b/tests/ui/nested-ty-params.rs
@@ -1,4 +1,4 @@
-// error-pattern:can't use generic parameters from outer function
+// error-pattern:can't use generic parameters from outer item
fn hd<U>(v: Vec<U> ) -> U {
fn hd1(w: [U]) -> U { return w[0]; }
diff --git a/tests/ui/nested-ty-params.stderr b/tests/ui/nested-ty-params.stderr
index 8f4746f5e..a9cdec667 100644
--- a/tests/ui/nested-ty-params.stderr
+++ b/tests/ui/nested-ty-params.stderr
@@ -1,22 +1,22 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/nested-ty-params.rs:3:16
|
LL | fn hd<U>(v: Vec<U> ) -> U {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | fn hd1(w: [U]) -> U { return w[0]; }
- | - ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `<U>`
+ | help: try introducing a local generic parameter here: `<U>`
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/nested-ty-params.rs:3:23
|
LL | fn hd<U>(v: Vec<U> ) -> U {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | fn hd1(w: [U]) -> U { return w[0]; }
- | - ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `<U>`
+ | help: try introducing a local generic parameter here: `<U>`
error: aborting due to 2 previous errors
diff --git a/tests/ui/never_type/fallback-closure-wrap.fallback.stderr b/tests/ui/never_type/fallback-closure-wrap.fallback.stderr
index 5b6f02351..49f55db1e 100644
--- a/tests/ui/never_type/fallback-closure-wrap.fallback.stderr
+++ b/tests/ui/never_type/fallback-closure-wrap.fallback.stderr
@@ -1,4 +1,4 @@
-error[E0271]: expected `[closure@fallback-closure-wrap.rs:18:40]` to be a closure that returns `()`, but it returns `!`
+error[E0271]: expected `{closure@fallback-closure-wrap.rs:18:40}` to be a closure that returns `()`, but it returns `!`
--> $DIR/fallback-closure-wrap.rs:18:31
|
LL | let error = Closure::wrap(Box::new(move || {
@@ -10,7 +10,7 @@ LL | | }) as Box<dyn FnMut()>);
|
= note: expected unit type `()`
found type `!`
- = note: required for the cast from `Box<[closure@$DIR/fallback-closure-wrap.rs:18:40: 18:47]>` to `Box<dyn FnMut()>`
+ = note: required for the cast from `Box<{closure@$DIR/fallback-closure-wrap.rs:18:40: 18:47}>` to `Box<dyn FnMut()>`
error: aborting due to previous error
diff --git a/tests/ui/never_type/feature-gate-never_type_fallback.stderr b/tests/ui/never_type/feature-gate-never_type_fallback.stderr
index 2db1cc4b7..56aafbb4c 100644
--- a/tests/ui/never_type/feature-gate-never_type_fallback.stderr
+++ b/tests/ui/never_type/feature-gate-never_type_fallback.stderr
@@ -8,6 +8,11 @@ LL | foo(panic!())
| | this tail expression is of type `()`
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/feature-gate-never_type_fallback.rs:7:1
+ |
+LL | trait T {}
+ | ^^^^^^^
note: required by a bound in `foo`
--> $DIR/feature-gate-never_type_fallback.rs:13:16
|
diff --git a/tests/ui/never_type/impl_trait_fallback3.stderr b/tests/ui/never_type/impl_trait_fallback3.stderr
index 5d5d216fb..821d14156 100644
--- a/tests/ui/never_type/impl_trait_fallback3.stderr
+++ b/tests/ui/never_type/impl_trait_fallback3.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `(): T` is not satisfied
|
LL | fn a() -> Foo {
| ^^^ the trait `T` is not implemented for `()`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/impl_trait_fallback3.rs:5:1
+ |
+LL | trait T {
+ | ^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/never_type/impl_trait_fallback4.stderr b/tests/ui/never_type/impl_trait_fallback4.stderr
index f2e216e90..67421ba8d 100644
--- a/tests/ui/never_type/impl_trait_fallback4.stderr
+++ b/tests/ui/never_type/impl_trait_fallback4.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `(): T` is not satisfied
|
LL | fn foo() -> impl T {
| ^^^^^^ the trait `T` is not implemented for `()`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/impl_trait_fallback4.rs:3:1
+ |
+LL | trait T {
+ | ^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/never_type/issue-52443.stderr b/tests/ui/never_type/issue-52443.stderr
index 99dfce869..59292ed68 100644
--- a/tests/ui/never_type/issue-52443.stderr
+++ b/tests/ui/never_type/issue-52443.stderr
@@ -33,10 +33,12 @@ error[E0308]: mismatched types
--> $DIR/issue-52443.rs:4:17
|
LL | [(); loop { break }];
- | ^^^^^
- | |
- | expected `usize`, found `()`
- | help: give it a value of the expected type: `break 42`
+ | ^^^^^ expected `usize`, found `()`
+ |
+help: give it a value of the expected type
+ |
+LL | [(); loop { break 42 }];
+ | ++
error[E0015]: cannot convert `RangeFrom<usize>` into an iterator in constants
--> $DIR/issue-52443.rs:9:21
diff --git a/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr b/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr
index 06e902bca..54c16230f 100644
--- a/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr
+++ b/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr
@@ -1,10 +1,8 @@
error[E0277]: the trait bound `E: From<()>` is not satisfied
- --> $DIR/never-value-fallback-issue-66757.rs:28:26
+ --> $DIR/never-value-fallback-issue-66757.rs:28:6
|
LL | <E as From<_>>::from(never);
- | -------------------- ^^^^^ the trait `From<()>` is not implemented for `E`
- | |
- | required by a bound introduced by this call
+ | ^ the trait `From<()>` is not implemented for `E`
|
= help: the trait `From<!>` is implemented for `E`
diff --git a/tests/ui/nll/closure-requirements/escape-argument-callee.stderr b/tests/ui/nll/closure-requirements/escape-argument-callee.stderr
index 1e3a5328d..b3cb7813e 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 args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> 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)),
+ for<Region(BrAnon), Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) mut &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon }) i32)),
(),
]
diff --git a/tests/ui/nll/closure-requirements/escape-argument.stderr b/tests/ui/nll/closure-requirements/escape-argument.stderr
index bc4ba93f8..4f0156728 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 args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None))> 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)),
+ for<Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) mut &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) 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 f8383cc42..ccf56bf6f 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 args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&'?2 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'?3 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>)),
+ for<Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) u32>, std::cell::Cell<&'?2 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) &'?3 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>)),
(),
]
= note: late-bound region is '?4
diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr
index 113173d8f..a16433c9d 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 args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&'?1 &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) }) &'?2 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>)),
+ for<Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon }) &'?2 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon }) u32>)),
(),
]
= note: late-bound region is '?3
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 ba15199ab..9e0f16c0f 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 args [
i32,
- for<Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'?1 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>)),
+ for<Region(BrAnon)> extern "rust-call" fn((std::cell::Cell<&'?1 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) u32>)),
(),
]
@@ -36,7 +36,7 @@ LL | foo(cell, |cell_a, cell_x| {
|
= note: defining type: case2::{closure#0} with closure args [
i32,
- for<Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'?1 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>)),
+ for<Region(BrAnon)> extern "rust-call" fn((std::cell::Cell<&'?1 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) 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 f2bf83c6c..e4989e321 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 args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&'?1 &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>)),
+ for<Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon }) u32>)),
(),
]
= note: late-bound region is '?2
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 2734326ed..be35e62d0 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 args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&'?2 &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>)),
+ for<Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon }) std::cell::Cell<&'?2 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon }) u32>)),
(),
]
= note: late-bound region is '?3
diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr
index 5ab321eb6..8880dd816 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 args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'?2 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>)),
+ for<Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) &'?2 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>)),
(),
]
= note: late-bound region is '?3
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 595fd5ff5..47774b63f 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 args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'?2 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>)),
+ for<Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) &'?2 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>)),
(),
]
= note: late-bound region is '?3
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 62b0e3eed..3404bb128 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 args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> 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) }) &'?1 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>)),
+ for<Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) &'?1 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>)),
(),
]
= note: late-bound region is '?2
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 6f2044d62..e40648912 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 args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> 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) }) &'?1 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) &'?2 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>)),
+ for<Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) &'?1 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon }) &'?2 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon }) u32>)),
(),
]
= note: late-bound region is '?3
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 7635f2ede..18fb7195d 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 args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None))> 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,
+ for<Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) i32)) -> &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) i32,
(),
]
diff --git a/tests/ui/nll/issue-54556-stephaneyfx.stderr b/tests/ui/nll/issue-54556-stephaneyfx.stderr
index f9e82cb00..0dfea0fd7 100644
--- a/tests/ui/nll/issue-54556-stephaneyfx.stderr
+++ b/tests/ui/nll/issue-54556-stephaneyfx.stderr
@@ -12,7 +12,7 @@ LL | }
| -
| |
| `stmt` dropped here while still borrowed
- | ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `Map<Rows<'_>, [closure@$DIR/issue-54556-stephaneyfx.rs:28:14: 28:19]>`
+ | ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `Map<Rows<'_>, {closure@$DIR/issue-54556-stephaneyfx.rs:28:14: 28:19}>`
|
= note: the temporary is part of an expression at the end of a block;
consider forcing this temporary to be dropped sooner, before the block's local variables are dropped
diff --git a/tests/ui/nll/missing-universe-cause-issue-114907.rs b/tests/ui/nll/missing-universe-cause-issue-114907.rs
new file mode 100644
index 000000000..94acdccfc
--- /dev/null
+++ b/tests/ui/nll/missing-universe-cause-issue-114907.rs
@@ -0,0 +1,40 @@
+// This is a non-regression test for issue #114907 where an ICE happened because of missing
+// `UniverseInfo`s accessed during diagnostics.
+//
+// A couple notes:
+// - the `FnOnce` bounds need an arg that is a reference
+// - a custom `Drop` is needed somewhere in the type that `accept` returns, to create universes
+// during liveness and dropck outlives computation
+
+// check-fail
+
+trait Role {
+ type Inner;
+}
+
+struct HandshakeCallback<C>(C);
+impl<C: FnOnce(&())> Role for HandshakeCallback<C> {
+ type Inner = ();
+}
+
+struct Handshake<R: Role> {
+ _inner: Option<R::Inner>,
+}
+impl<R: Role> Drop for Handshake<R> {
+ fn drop(&mut self) {}
+}
+
+fn accept<C: FnOnce(&())>(_: C) -> Handshake<HandshakeCallback<C>> {
+ todo!()
+}
+
+fn main() {
+ let callback = |_| {};
+ accept(callback);
+ //~^ ERROR mismatched types
+ //~| ERROR mismatched types
+ //~| ERROR implementation of `FnOnce` is not general enough
+ //~| ERROR implementation of `FnOnce` is not general enough
+ //~| ERROR higher-ranked subtype error
+ //~| ERROR higher-ranked subtype error
+}
diff --git a/tests/ui/nll/missing-universe-cause-issue-114907.stderr b/tests/ui/nll/missing-universe-cause-issue-114907.stderr
new file mode 100644
index 000000000..c3dd4257a
--- /dev/null
+++ b/tests/ui/nll/missing-universe-cause-issue-114907.stderr
@@ -0,0 +1,79 @@
+error[E0308]: mismatched types
+ --> $DIR/missing-universe-cause-issue-114907.rs:33:5
+ |
+LL | accept(callback);
+ | ^^^^^^^^^^^^^^^^ one type is more general than the other
+ |
+ = note: expected trait `for<'a> FnOnce<(&'a (),)>`
+ found trait `FnOnce<(&(),)>`
+note: this closure does not fulfill the lifetime requirements
+ --> $DIR/missing-universe-cause-issue-114907.rs:32:20
+ |
+LL | let callback = |_| {};
+ | ^^^
+note: the lifetime requirement is introduced here
+ --> $DIR/missing-universe-cause-issue-114907.rs:27:14
+ |
+LL | fn accept<C: FnOnce(&())>(_: C) -> Handshake<HandshakeCallback<C>> {
+ | ^^^^^^^^^^^
+help: consider specifying the type of the closure parameters
+ |
+LL | let callback = |_: &_| {};
+ | ~~~~~~~
+
+error: implementation of `FnOnce` is not general enough
+ --> $DIR/missing-universe-cause-issue-114907.rs:33:5
+ |
+LL | accept(callback);
+ | ^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
+ |
+ = note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`...
+ = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2`
+
+error: implementation of `FnOnce` is not general enough
+ --> $DIR/missing-universe-cause-issue-114907.rs:33:5
+ |
+LL | accept(callback);
+ | ^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
+ |
+ = note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`...
+ = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2`
+
+error[E0308]: mismatched types
+ --> $DIR/missing-universe-cause-issue-114907.rs:33:5
+ |
+LL | accept(callback);
+ | ^^^^^^^^^^^^^^^^ one type is more general than the other
+ |
+ = note: expected trait `for<'a> FnOnce<(&'a (),)>`
+ found trait `FnOnce<(&(),)>`
+note: this closure does not fulfill the lifetime requirements
+ --> $DIR/missing-universe-cause-issue-114907.rs:32:20
+ |
+LL | let callback = |_| {};
+ | ^^^
+note: the lifetime requirement is introduced here
+ --> $DIR/missing-universe-cause-issue-114907.rs:20:21
+ |
+LL | struct Handshake<R: Role> {
+ | ^^^^
+help: consider specifying the type of the closure parameters
+ |
+LL | let callback = |_: &_| {};
+ | ~~~~~~~
+
+error: higher-ranked subtype error
+ --> $DIR/missing-universe-cause-issue-114907.rs:33:21
+ |
+LL | accept(callback);
+ | ^
+
+error: higher-ranked subtype error
+ --> $DIR/missing-universe-cause-issue-114907.rs:33:21
+ |
+LL | accept(callback);
+ | ^
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
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 660211fe2..f58d49d84 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::<T>::{closure#0} with closure args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) T)),
+ for<Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) 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::<T>::{closure#0} with closure args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) T)),
+ for<Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) T)),
(),
]
= note: late-bound region is '?2
diff --git a/tests/ui/no-send-res-ports.stderr b/tests/ui/no-send-res-ports.stderr
index 75561f411..33446e9d1 100644
--- a/tests/ui/no-send-res-ports.stderr
+++ b/tests/ui/no-send-res-ports.stderr
@@ -4,7 +4,7 @@ error[E0277]: `Rc<()>` cannot be sent between threads safely
LL | thread::spawn(move|| {
| ------------- ^-----
| | |
- | _____|_____________within this `[closure@$DIR/no-send-res-ports.rs:25:19: 25:25]`
+ | _____|_____________within this `{closure@$DIR/no-send-res-ports.rs:25:19: 25:25}`
| | |
| | required by a bound introduced by this call
LL | |
@@ -13,7 +13,7 @@ LL | | println!("{:?}", y);
LL | | });
| |_____^ `Rc<()>` cannot be sent between threads safely
|
- = help: within `[closure@$DIR/no-send-res-ports.rs:25:19: 25:25]`, the trait `Send` is not implemented for `Rc<()>`
+ = help: within `{closure@$DIR/no-send-res-ports.rs:25:19: 25:25}`, the trait `Send` is not implemented for `Rc<()>`
note: required because it appears within the type `Port<()>`
--> $DIR/no-send-res-ports.rs:5:8
|
diff --git a/tests/ui/not-clone-closure.stderr b/tests/ui/not-clone-closure.stderr
index db9307c61..17cf938d1 100644
--- a/tests/ui/not-clone-closure.stderr
+++ b/tests/ui/not-clone-closure.stderr
@@ -1,11 +1,11 @@
-error[E0277]: the trait bound `S: Clone` is not satisfied in `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]`
+error[E0277]: the trait bound `S: Clone` is not satisfied in `{closure@$DIR/not-clone-closure.rs:7:17: 7:24}`
--> $DIR/not-clone-closure.rs:11:23
|
LL | let hello = move || {
- | ------- within this `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]`
+ | ------- within this `{closure@$DIR/not-clone-closure.rs:7:17: 7:24}`
...
LL | let hello = hello.clone();
- | ^^^^^ within `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]`, the trait `Clone` is not implemented for `S`
+ | ^^^^^ within `{closure@$DIR/not-clone-closure.rs:7:17: 7:24}`, the trait `Clone` is not implemented for `S`
|
note: required because it's used within this closure
--> $DIR/not-clone-closure.rs:7:17
diff --git a/tests/ui/object-safety/assoc_type_bounds_sized_used.rs b/tests/ui/object-safety/assoc_type_bounds_sized_used.rs
index cf5345b1c..d59fc1712 100644
--- a/tests/ui/object-safety/assoc_type_bounds_sized_used.rs
+++ b/tests/ui/object-safety/assoc_type_bounds_sized_used.rs
@@ -1,6 +1,5 @@
-//! This test checks that even if some associated types have
-//! `where Self: Sized` bounds, those without still need to be
-//! mentioned in trait objects.
+//! This test checks that associated types with `Self: Sized` cannot be projected
+//! from a `dyn Trait`.
trait Bop {
type Bar: Default
@@ -16,5 +15,4 @@ fn bop<T: Bop + ?Sized>() {
fn main() {
bop::<dyn Bop>();
- //~^ ERROR: the size for values of type `dyn Bop` cannot be known at compilation time
}
diff --git a/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr b/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr
index f8488d842..224d33fb2 100644
--- a/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr
+++ b/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr
@@ -1,5 +1,5 @@
error[E0599]: the function or associated item `default` exists for associated type `<T as Bop>::Bar`, but its trait bounds were not satisfied
- --> $DIR/assoc_type_bounds_sized_used.rs:12:30
+ --> $DIR/assoc_type_bounds_sized_used.rs:11:30
|
LL | let _ = <T as Bop>::Bar::default();
| ^^^^^^^ function or associated item cannot be called on `<T as Bop>::Bar` due to unsatisfied trait bounds
@@ -13,15 +13,15 @@ LL | fn bop<T: Bop + ?Sized>() where T: Sized {
| ++++++++++++++
error[E0277]: the size for values of type `T` cannot be known at compilation time
- --> $DIR/assoc_type_bounds_sized_used.rs:12:13
+ --> $DIR/assoc_type_bounds_sized_used.rs:11:14
|
LL | fn bop<T: Bop + ?Sized>() {
| - this type parameter needs to be `Sized`
LL | let _ = <T as Bop>::Bar::default();
- | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ | ^ doesn't have a size known at compile-time
|
note: required by a bound in `Bop::Bar`
- --> $DIR/assoc_type_bounds_sized_used.rs:8:15
+ --> $DIR/assoc_type_bounds_sized_used.rs:7:15
|
LL | type Bar: Default
| --- required by a bound in this associated type
@@ -34,20 +34,7 @@ LL - fn bop<T: Bop + ?Sized>() {
LL + fn bop<T: Bop>() {
|
-error[E0277]: the size for values of type `dyn Bop` cannot be known at compilation time
- --> $DIR/assoc_type_bounds_sized_used.rs:18:11
- |
-LL | bop::<dyn Bop>();
- | ^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `Sized` is not implemented for `dyn Bop`
-note: required by a bound in `bop`
- --> $DIR/assoc_type_bounds_sized_used.rs:11:11
- |
-LL | fn bop<T: Bop + ?Sized>() {
- | ^^^ required by this bound in `bop`
-
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/object-safety/call-when-assoc-ty-is-sized.rs b/tests/ui/object-safety/call-when-assoc-ty-is-sized.rs
new file mode 100644
index 000000000..0b30a88fd
--- /dev/null
+++ b/tests/ui/object-safety/call-when-assoc-ty-is-sized.rs
@@ -0,0 +1,25 @@
+// check-pass
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
+
+trait Foo {
+ type Bar<'a>
+ where
+ Self: Sized;
+
+ fn test(&self);
+}
+
+impl Foo for () {
+ type Bar<'a> = () where Self: Sized;
+
+ fn test(&self) {}
+}
+
+fn test(x: &dyn Foo) {
+ x.test();
+}
+
+fn main() {
+ test(&());
+}
diff --git a/tests/ui/on-unimplemented/on-trait.stderr b/tests/ui/on-unimplemented/on-trait.stderr
index 4b040f1ac..4847a1a5a 100644
--- a/tests/ui/on-unimplemented/on-trait.stderr
+++ b/tests/ui/on-unimplemented/on-trait.stderr
@@ -5,6 +5,11 @@ LL | let y: Option<Vec<u8>> = collect(x.iter()); // this should give approxi
| ^^^^^^^ a collection of type `Option<Vec<u8>>` cannot be built from an iterator over elements of type `&u8`
|
= help: the trait `MyFromIterator<&u8>` is not implemented for `Option<Vec<u8>>`
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-trait.rs:17:1
+ |
+LL | trait MyFromIterator<A> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `collect`
--> $DIR/on-trait.rs:22:39
|
@@ -18,6 +23,11 @@ LL | let x: String = foobar();
| ^^^^^^ test error `String` with `u8` `_` `u32` in `Foo`
|
= help: the trait `Foo<u8, _, u32>` is not implemented for `String`
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-trait.rs:7:3
+ |
+LL | pub trait Foo<Bar, Baz, Quux> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `foobar`
--> $DIR/on-trait.rs:12:24
|
diff --git a/tests/ui/on-unimplemented/parent-label.stderr b/tests/ui/on-unimplemented/parent-label.stderr
index 8cd7412fd..101a41512 100644
--- a/tests/ui/on-unimplemented/parent-label.stderr
+++ b/tests/ui/on-unimplemented/parent-label.stderr
@@ -8,6 +8,11 @@ LL | f(Foo {});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/parent-label.rs:6:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `f`
--> $DIR/parent-label.rs:10:9
|
@@ -24,6 +29,11 @@ LL | f(Foo {});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/parent-label.rs:6:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `f`
--> $DIR/parent-label.rs:10:9
|
@@ -41,6 +51,11 @@ LL | f(Foo {});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/parent-label.rs:6:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `f`
--> $DIR/parent-label.rs:10:9
|
@@ -58,6 +73,11 @@ LL | f(Foo {});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/parent-label.rs:6:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `f`
--> $DIR/parent-label.rs:10:9
|
diff --git a/tests/ui/on-unimplemented/sum.stderr b/tests/ui/on-unimplemented/sum.stderr
index a2357e49b..257dec200 100644
--- a/tests/ui/on-unimplemented/sum.stderr
+++ b/tests/ui/on-unimplemented/sum.stderr
@@ -1,8 +1,10 @@
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `&()`
- --> $DIR/sum.rs:4:25
+ --> $DIR/sum.rs:4:31
|
LL | vec![(), ()].iter().sum::<i32>();
- | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=&()>`
+ | --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=&()>`
+ | |
+ | required by a bound introduced by this call
|
= help: the trait `Sum<&()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
@@ -19,10 +21,12 @@ note: required by a bound in `std::iter::Iterator::sum`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
error[E0277]: a value of type `i32` cannot be made by multiplying all elements of type `&()` from an iterator
- --> $DIR/sum.rs:7:25
+ --> $DIR/sum.rs:7:35
|
LL | vec![(), ()].iter().product::<i32>();
- | ^^^^^^^ value of type `i32` cannot be made by multiplying all elements from a `std::iter::Iterator<Item=&()>`
+ | ------- ^^^ value of type `i32` cannot be made by multiplying all elements from a `std::iter::Iterator<Item=&()>`
+ | |
+ | required by a bound introduced by this call
|
= help: the trait `Product<&()>` is not implemented for `i32`
= help: the following other types implement trait `Product<A>`:
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-1.rs b/tests/ui/panic-handler/panic-handler-bad-signature-1.rs
index 775961d3f..ae27db7a8 100644
--- a/tests/ui/panic-handler/panic-handler-bad-signature-1.rs
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-1.rs
@@ -6,8 +6,5 @@
use core::panic::PanicInfo;
#[panic_handler]
-fn panic(
- info: PanicInfo, //~ ERROR argument should be `&PanicInfo`
-) -> () //~ ERROR return type should be `!`
-{
-}
+fn panic(info: PanicInfo) -> () {}
+//~^ `#[panic_handler]` function has wrong type [E0308]
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-1.stderr b/tests/ui/panic-handler/panic-handler-bad-signature-1.stderr
index 8b044f766..85555c439 100644
--- a/tests/ui/panic-handler/panic-handler-bad-signature-1.stderr
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-1.stderr
@@ -1,14 +1,12 @@
-error: return type should be `!`
- --> $DIR/panic-handler-bad-signature-1.rs:11:6
+error[E0308]: `#[panic_handler]` function has wrong type
+ --> $DIR/panic-handler-bad-signature-1.rs:9:16
|
-LL | ) -> ()
- | ^^
-
-error: argument should be `&PanicInfo`
- --> $DIR/panic-handler-bad-signature-1.rs:10:11
+LL | fn panic(info: PanicInfo) -> () {}
+ | ^^^^^^^^^ expected `&PanicInfo<'_>`, found `PanicInfo<'_>`
|
-LL | info: PanicInfo,
- | ^^^^^^^^^
+ = note: expected signature `for<'a, 'b> fn(&'a PanicInfo<'b>) -> !`
+ found signature `for<'a> fn(PanicInfo<'a>)`
-error: aborting due to 2 previous errors
+error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-2.rs b/tests/ui/panic-handler/panic-handler-bad-signature-2.rs
index 727934000..3c3f1513f 100644
--- a/tests/ui/panic-handler/panic-handler-bad-signature-2.rs
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-2.rs
@@ -6,9 +6,8 @@
use core::panic::PanicInfo;
#[panic_handler]
-fn panic(
- info: &'static PanicInfo, //~ ERROR argument should be `&PanicInfo`
-) -> !
+fn panic(info: &'static PanicInfo) -> !
+//~^ #[panic_handler]` function has wrong type [E0308]
{
loop {}
}
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-2.stderr b/tests/ui/panic-handler/panic-handler-bad-signature-2.stderr
index 5ab693420..84eba2a5a 100644
--- a/tests/ui/panic-handler/panic-handler-bad-signature-2.stderr
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-2.stderr
@@ -1,8 +1,12 @@
-error: argument should be `&PanicInfo`
- --> $DIR/panic-handler-bad-signature-2.rs:10:11
+error[E0308]: `#[panic_handler]` function has wrong type
+ --> $DIR/panic-handler-bad-signature-2.rs:9:1
|
-LL | info: &'static PanicInfo,
- | ^^^^^^^^^^^^^^^^^^
+LL | fn panic(info: &'static PanicInfo) -> !
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
+ |
+ = note: expected signature `for<'a, 'b> fn(&'a PanicInfo<'b>) -> _`
+ found signature `for<'a> fn(&'static PanicInfo<'a>) -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-3.rs b/tests/ui/panic-handler/panic-handler-bad-signature-3.rs
index ab9c9d7f4..9e17e32fb 100644
--- a/tests/ui/panic-handler/panic-handler-bad-signature-3.rs
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-3.rs
@@ -6,6 +6,6 @@
use core::panic::PanicInfo;
#[panic_handler]
-fn panic() -> ! { //~ ERROR function should have one argument
+fn panic() -> ! { //~ #[panic_handler]` function has wrong type [E0308]
loop {}
}
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-3.stderr b/tests/ui/panic-handler/panic-handler-bad-signature-3.stderr
index 0a70181fd..cdf55ab65 100644
--- a/tests/ui/panic-handler/panic-handler-bad-signature-3.stderr
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-3.stderr
@@ -1,8 +1,12 @@
-error: function should have one argument
+error[E0308]: `#[panic_handler]` function has wrong type
--> $DIR/panic-handler-bad-signature-3.rs:9:1
|
LL | fn panic() -> ! {
- | ^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^ incorrect number of function parameters
+ |
+ = note: expected signature `for<'a, 'b> fn(&'a PanicInfo<'b>) -> _`
+ found signature `fn() -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-5.rs b/tests/ui/panic-handler/panic-handler-bad-signature-5.rs
new file mode 100644
index 000000000..97307d1b2
--- /dev/null
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-5.rs
@@ -0,0 +1,13 @@
+// compile-flags:-C panic=abort
+
+#![no_std]
+#![no_main]
+
+use core::panic::PanicInfo;
+
+#[panic_handler]
+fn panic(info: &PanicInfo<'static>) -> !
+//~^ #[panic_handler]` function has wrong type [E0308]
+{
+ loop {}
+}
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-5.stderr b/tests/ui/panic-handler/panic-handler-bad-signature-5.stderr
new file mode 100644
index 000000000..20c175875
--- /dev/null
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-5.stderr
@@ -0,0 +1,12 @@
+error[E0308]: `#[panic_handler]` function has wrong type
+ --> $DIR/panic-handler-bad-signature-5.rs:9:1
+ |
+LL | fn panic(info: &PanicInfo<'static>) -> !
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
+ |
+ = note: expected signature `for<'a, 'b> fn(&'a PanicInfo<'b>) -> _`
+ found signature `for<'a> fn(&'a PanicInfo<'static>) -> _`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/panic-handler/panic-handler-with-target-feature.rs b/tests/ui/panic-handler/panic-handler-with-target-feature.rs
new file mode 100644
index 000000000..8ea0275d7
--- /dev/null
+++ b/tests/ui/panic-handler/panic-handler-with-target-feature.rs
@@ -0,0 +1,15 @@
+// compile-flags:-C panic=abort
+// only-x86_64
+
+#![feature(target_feature_11)]
+#![no_std]
+#![no_main]
+
+use core::panic::PanicInfo;
+
+#[panic_handler]
+#[target_feature(enable = "avx2")]
+//~^ ERROR `panic_impl` language item function is not allowed to have `#[target_feature]`
+fn panic(info: &PanicInfo) -> ! {
+ unimplemented!();
+}
diff --git a/tests/ui/panic-handler/panic-handler-with-target-feature.stderr b/tests/ui/panic-handler/panic-handler-with-target-feature.stderr
new file mode 100644
index 000000000..4210a4200
--- /dev/null
+++ b/tests/ui/panic-handler/panic-handler-with-target-feature.stderr
@@ -0,0 +1,11 @@
+error: `panic_impl` language item function is not allowed to have `#[target_feature]`
+ --> $DIR/panic-handler-with-target-feature.rs:11:1
+ |
+LL | #[target_feature(enable = "avx2")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | fn panic(info: &PanicInfo) -> ! {
+ | ------------------------------- `panic_impl` language item function is not allowed to have `#[target_feature]`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/panics/panic-in-cleanup.rs b/tests/ui/panics/panic-in-cleanup.rs
new file mode 100644
index 000000000..84880f188
--- /dev/null
+++ b/tests/ui/panics/panic-in-cleanup.rs
@@ -0,0 +1,23 @@
+// run-fail
+// exec-env:RUST_BACKTRACE=0
+// check-run-results
+// error-pattern: panic in a destructor during cleanup
+// normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> ""
+// normalize-stderr-test: "\n +at [^\n]+" -> ""
+// normalize-stderr-test: "(core/src/panicking\.rs):[0-9]+:[0-9]+" -> "$1:$$LINE:$$COL"
+// needs-unwind
+// ignore-emscripten "RuntimeError" junk in output
+// ignore-msvc SEH doesn't do panic-during-cleanup the same way as everyone else
+
+struct Bomb;
+
+impl Drop for Bomb {
+ fn drop(&mut self) {
+ panic!("BOOM");
+ }
+}
+
+fn main() {
+ let _b = Bomb;
+ panic!();
+}
diff --git a/tests/ui/panics/panic-in-cleanup.run.stderr b/tests/ui/panics/panic-in-cleanup.run.stderr
new file mode 100644
index 000000000..e7def11b0
--- /dev/null
+++ b/tests/ui/panics/panic-in-cleanup.run.stderr
@@ -0,0 +1,9 @@
+thread 'main' panicked at $DIR/panic-in-cleanup.rs:22:5:
+explicit panic
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
+thread 'main' panicked at $DIR/panic-in-cleanup.rs:16:9:
+BOOM
+stack backtrace:
+thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL:
+panic in a destructor during cleanup
+thread caused non-unwinding panic. aborting.
diff --git a/tests/ui/panics/panic-in-ffi.rs b/tests/ui/panics/panic-in-ffi.rs
new file mode 100644
index 000000000..d9f1fcee8
--- /dev/null
+++ b/tests/ui/panics/panic-in-ffi.rs
@@ -0,0 +1,18 @@
+// run-fail
+// exec-env:RUST_BACKTRACE=0
+// check-run-results
+// error-pattern: panic in a function that cannot unwind
+// normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> ""
+// normalize-stderr-test: "\n +at [^\n]+" -> ""
+// normalize-stderr-test: "(core/src/panicking\.rs):[0-9]+:[0-9]+" -> "$1:$$LINE:$$COL"
+// needs-unwind
+// ignore-emscripten "RuntimeError" junk in output
+#![feature(c_unwind)]
+
+extern "C" fn panic_in_ffi() {
+ panic!("Test");
+}
+
+fn main() {
+ panic_in_ffi();
+}
diff --git a/tests/ui/panics/panic-in-ffi.run.stderr b/tests/ui/panics/panic-in-ffi.run.stderr
new file mode 100644
index 000000000..a92a66c57
--- /dev/null
+++ b/tests/ui/panics/panic-in-ffi.run.stderr
@@ -0,0 +1,7 @@
+thread 'main' panicked at $DIR/panic-in-ffi.rs:13:5:
+Test
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
+thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL:
+panic in a function that cannot unwind
+stack backtrace:
+thread caused non-unwinding panic. aborting.
diff --git a/tests/ui/panics/short-ice-remove-middle-frames-2.rs b/tests/ui/panics/short-ice-remove-middle-frames-2.rs
index 38a80f8b6..751959f55 100644
--- a/tests/ui/panics/short-ice-remove-middle-frames-2.rs
+++ b/tests/ui/panics/short-ice-remove-middle-frames-2.rs
@@ -2,6 +2,7 @@
// run-fail
// check-run-results
// exec-env:RUST_BACKTRACE=1
+// needs-unwind
// ignore-android FIXME #17520
// ignore-wasm no panic support
// ignore-openbsd no support for libbacktrace without filename
diff --git a/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr b/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr
index 2b648a0ca..664ebaa4c 100644
--- a/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr
+++ b/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr
@@ -1,4 +1,4 @@
-thread 'main' panicked at $DIR/short-ice-remove-middle-frames-2.rs:56:5:
+thread 'main' panicked at $DIR/short-ice-remove-middle-frames-2.rs:57:5:
debug!!!
stack backtrace:
0: std::panicking::begin_panic
diff --git a/tests/ui/panics/short-ice-remove-middle-frames.rs b/tests/ui/panics/short-ice-remove-middle-frames.rs
index c872084f0..134e13233 100644
--- a/tests/ui/panics/short-ice-remove-middle-frames.rs
+++ b/tests/ui/panics/short-ice-remove-middle-frames.rs
@@ -2,6 +2,7 @@
// run-fail
// check-run-results
// exec-env:RUST_BACKTRACE=1
+// needs-unwind
// ignore-android FIXME #17520
// ignore-wasm no panic support
// ignore-openbsd no support for libbacktrace without filename
diff --git a/tests/ui/panics/short-ice-remove-middle-frames.run.stderr b/tests/ui/panics/short-ice-remove-middle-frames.run.stderr
index 5b3726840..bc252fde1 100644
--- a/tests/ui/panics/short-ice-remove-middle-frames.run.stderr
+++ b/tests/ui/panics/short-ice-remove-middle-frames.run.stderr
@@ -1,4 +1,4 @@
-thread 'main' panicked at $DIR/short-ice-remove-middle-frames.rs:52:5:
+thread 'main' panicked at $DIR/short-ice-remove-middle-frames.rs:53:5:
debug!!!
stack backtrace:
0: std::panicking::begin_panic
diff --git a/tests/ui/parser/default-unmatched.stderr b/tests/ui/parser/default-unmatched.stderr
index 331e003f6..de142411d 100644
--- a/tests/ui/parser/default-unmatched.stderr
+++ b/tests/ui/parser/default-unmatched.stderr
@@ -11,6 +11,8 @@ error: expected item, found reserved keyword `do`
|
LL | default do
| ^^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
error: aborting due to 2 previous errors
diff --git a/tests/ui/parser/expr-as-stmt.stderr b/tests/ui/parser/expr-as-stmt.stderr
index 18c8b0b7c..76a83aa01 100644
--- a/tests/ui/parser/expr-as-stmt.stderr
+++ b/tests/ui/parser/expr-as-stmt.stderr
@@ -217,7 +217,7 @@ LL | { true } || { true }
| ^^^^^^^^^^^ expected `bool`, found closure
|
= note: expected type `bool`
- found closure `[closure@$DIR/expr-as-stmt.rs:51:14: 51:16]`
+ found closure `{closure@$DIR/expr-as-stmt.rs:51:14: 51:16}`
help: parentheses are required to parse this as an expression
|
LL | ({ true }) || { true }
diff --git a/tests/ui/parser/impl-parsing.stderr b/tests/ui/parser/impl-parsing.stderr
index 755addf14..a57cc075c 100644
--- a/tests/ui/parser/impl-parsing.stderr
+++ b/tests/ui/parser/impl-parsing.stderr
@@ -35,6 +35,8 @@ error: expected item, found keyword `unsafe`
|
LL | default unsafe FAIL
| ^^^^^^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
error: aborting due to 6 previous errors
diff --git a/tests/ui/parser/issue-101477-enum.stderr b/tests/ui/parser/issue-101477-enum.stderr
index 1edca391e..94130671f 100644
--- a/tests/ui/parser/issue-101477-enum.stderr
+++ b/tests/ui/parser/issue-101477-enum.stderr
@@ -11,6 +11,8 @@ error: expected item, found `==`
|
LL | B == 2
| ^^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
error: aborting due to 2 previous errors
diff --git a/tests/ui/parser/issues/issue-113110-non-item-at-module-root.rs b/tests/ui/parser/issues/issue-113110-non-item-at-module-root.rs
new file mode 100644
index 000000000..3b6f43043
--- /dev/null
+++ b/tests/ui/parser/issues/issue-113110-non-item-at-module-root.rs
@@ -0,0 +1 @@
+ 5 //~ ERROR expected item, found `5`
diff --git a/tests/ui/parser/issues/issue-113110-non-item-at-module-root.stderr b/tests/ui/parser/issues/issue-113110-non-item-at-module-root.stderr
new file mode 100644
index 000000000..0789c4548
--- /dev/null
+++ b/tests/ui/parser/issues/issue-113110-non-item-at-module-root.stderr
@@ -0,0 +1,10 @@
+error: expected item, found `5`
+ --> $DIR/issue-113110-non-item-at-module-root.rs:1:2
+ |
+LL | 5
+ | ^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-17904-2.stderr b/tests/ui/parser/issues/issue-17904-2.stderr
index 9c7fdf6cc..7185a5e57 100644
--- a/tests/ui/parser/issues/issue-17904-2.stderr
+++ b/tests/ui/parser/issues/issue-17904-2.stderr
@@ -3,6 +3,8 @@ error: expected item, found keyword `where`
|
LL | struct Bar<T> { x: T } where T: Copy
| ^^^^^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
error: aborting due to previous error
diff --git a/tests/ui/parser/issues/issue-43196.stderr b/tests/ui/parser/issues/issue-43196.stderr
index 4f7ed5cc6..15bbb158c 100644
--- a/tests/ui/parser/issues/issue-43196.stderr
+++ b/tests/ui/parser/issues/issue-43196.stderr
@@ -11,6 +11,8 @@ error: expected item, found `|`
|
LL | |
| ^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
error: aborting due to 2 previous errors
diff --git a/tests/ui/parser/issues/issue-62913.stderr b/tests/ui/parser/issues/issue-62913.stderr
index 6f385e8dc..c33e46837 100644
--- a/tests/ui/parser/issues/issue-62913.stderr
+++ b/tests/ui/parser/issues/issue-62913.stderr
@@ -17,6 +17,8 @@ error: expected item, found `"\u\"`
|
LL | "\u\"
| ^^^^^^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
error: aborting due to 3 previous errors
diff --git a/tests/ui/parser/issues/issue-68890.stderr b/tests/ui/parser/issues/issue-68890.stderr
index 2a3bf6b41..0d7b53a67 100644
--- a/tests/ui/parser/issues/issue-68890.stderr
+++ b/tests/ui/parser/issues/issue-68890.stderr
@@ -15,6 +15,8 @@ error: expected item, found `)`
|
LL | enum e{A((?'a a+?+l))}
| ^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
error: aborting due to 3 previous errors
diff --git a/tests/ui/parser/issues/issue-89388.stderr b/tests/ui/parser/issues/issue-89388.stderr
index cf28bef0f..366d05c2d 100644
--- a/tests/ui/parser/issues/issue-89388.stderr
+++ b/tests/ui/parser/issues/issue-89388.stderr
@@ -2,7 +2,12 @@ error: missing angle brackets in associated item path
--> $DIR/issue-89388.rs:5:24
|
LL | let _ = option.map([_]::to_vec);
- | ^^^^^^^^^^^ help: try: `<[_]>::to_vec`
+ | ^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | let _ = option.map(<[_]>::to_vec);
+ | + +
error: aborting due to previous error
diff --git a/tests/ui/parser/issues/issue-98601-delimiter-error-1.rs b/tests/ui/parser/issues/issue-98601-delimiter-error-1.rs
new file mode 100644
index 000000000..cfbbd014d
--- /dev/null
+++ b/tests/ui/parser/issues/issue-98601-delimiter-error-1.rs
@@ -0,0 +1,9 @@
+fn foo() {
+ match 0 {
+ _ => {}
+ }
+ if foo
+ }
+} //~ ERROR unexpected closing delimiter: `}`
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-98601-delimiter-error-1.stderr b/tests/ui/parser/issues/issue-98601-delimiter-error-1.stderr
new file mode 100644
index 000000000..d568a4c58
--- /dev/null
+++ b/tests/ui/parser/issues/issue-98601-delimiter-error-1.stderr
@@ -0,0 +1,16 @@
+error: unexpected closing delimiter: `}`
+ --> $DIR/issue-98601-delimiter-error-1.rs:7:1
+ |
+LL | fn foo() {
+ | - this delimiter might not be properly closed...
+LL | match 0 {
+LL | _ => {}
+ | -- block is empty, you might have not meant to close it
+...
+LL | }
+ | - ...as it matches this but it has different indentation
+LL | }
+ | ^ unexpected closing delimiter
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.rs b/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.rs
new file mode 100644
index 000000000..254e816cf
--- /dev/null
+++ b/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.rs
@@ -0,0 +1,5 @@
+fn main() {
+ todo!();
+}
+
+fn other(_: i32)) {} //~ ERROR unexpected closing delimiter: `)`
diff --git a/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.stderr b/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.stderr
new file mode 100644
index 000000000..81dd39bb7
--- /dev/null
+++ b/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.stderr
@@ -0,0 +1,14 @@
+error: unexpected closing delimiter: `)`
+ --> $DIR/issue-98601-delimiter-error-unexpected-close.rs:5:17
+ |
+LL | fn main() {
+ | - this opening brace...
+LL | todo!();
+LL | }
+ | - ...matches this closing brace
+LL |
+LL | fn other(_: i32)) {}
+ | ^ unexpected closing delimiter
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/keyword-union-as-identifier.rs b/tests/ui/parser/keyword-union-as-identifier.rs
new file mode 100644
index 000000000..7062557d7
--- /dev/null
+++ b/tests/ui/parser/keyword-union-as-identifier.rs
@@ -0,0 +1,72 @@
+// check-pass
+
+#![allow(non_camel_case_types)]
+#![allow(non_upper_case_globals)]
+
+mod union {
+ type union = i32;
+
+ pub struct Bar {
+ pub union: union,
+ }
+
+ pub fn union() -> Bar {
+ Bar {
+ union: 5
+ }
+ }
+}
+
+mod struct_union {
+ pub struct union {
+ pub union: u32
+ }
+ static union: union = union { union: 0 };
+
+ impl union {
+ pub fn union<'union>() -> &'union union {
+ &union
+ }
+ }
+ impl union {}
+ trait Foo {}
+ impl Foo for union {}
+ trait Bar {
+ fn bar() {}
+ }
+ impl Bar for union {}
+}
+
+mod union_union {
+ pub union union {
+ pub union: u32
+ }
+ const union: union = union { union: 0 };
+ impl union {
+ pub fn union() -> union {
+ union
+ }
+ }
+}
+
+mod trait_union {
+ pub trait union {
+ fn union() {}
+ }
+ impl union for () {}
+}
+
+macro_rules! ty {
+ ($ty:ty { $($field:ident:$field_ty:ty)* }) => {};
+}
+
+fn main() {
+ let union = union::union();
+ let _ = union.union;
+ let _ = struct_union::union::union().union;
+ let union = union_union::union::union();
+ let _ = unsafe { union.union };
+ <() as trait_union::union>::union();
+ ty!(union {});
+ ty!(union { union: union });
+}
diff --git a/tests/ui/parser/macro/macro-expand-to-field.rs b/tests/ui/parser/macro/macro-expand-to-field.rs
index 155872f7a..533511ecf 100644
--- a/tests/ui/parser/macro/macro-expand-to-field.rs
+++ b/tests/ui/parser/macro/macro-expand-to-field.rs
@@ -1,5 +1,7 @@
// compile-flags: --crate-type=lib
+// https://github.com/rust-lang/rust/issues/113766
+
macro_rules! field {
($name:ident:$type:ty) => {
$name:$type
@@ -13,15 +15,14 @@ macro_rules! variant {
}
struct Struct {
+ //~^ NOTE while parsing this struct
field!(bar:u128),
//~^ NOTE macros cannot expand to struct fields
//~| ERROR unexpected token: `!`
//~| NOTE unexpected token after this
a: u32,
b: u32,
- field!(recovers:()), //~ NOTE macros cannot expand to struct fields
- //~^ ERROR unexpected token: `!`
- //~^^ NOTE unexpected token after this
+ field!(recovers:()),
}
enum EnumVariant {
@@ -35,7 +36,7 @@ enum EnumVariant {
//~^ NOTE macros cannot expand to enum variants
//~| ERROR unexpected token: `!`
//~| NOTE unexpected token after this
- Data {
+ Data { //~ NOTE while parsing this struct
field!(x:u32),
//~^ NOTE macros cannot expand to struct fields
//~| ERROR unexpected token: `!`
@@ -44,27 +45,35 @@ enum EnumVariant {
}
enum EnumVariantField {
- Named {
+ Named { //~ NOTE while parsing this struct
field!(oopsies:()),
//~^ NOTE macros cannot expand to struct fields
//~| ERROR unexpected token: `!`
//~| unexpected token after this
field!(oopsies2:()),
- //~^ NOTE macros cannot expand to struct fields
- //~| ERROR unexpected token: `!`
- //~| unexpected token after this
},
}
union Union {
+ //~^ NOTE while parsing this union
A: u32,
field!(oopsies:()),
//~^ NOTE macros cannot expand to union fields
//~| ERROR unexpected token: `!`
- //~| unexpected token after this
+ //~| NOTE unexpected token after this
B: u32,
field!(recovers:()),
- //~^ NOTE macros cannot expand to union fields
+}
+
+// https://github.com/rust-lang/rust/issues/114636
+
+#[derive(Debug)]
+pub struct Lazy {
+ //~^ NOTE while parsing this struct
+ unreachable!()
+ //~^ NOTE macros cannot expand to struct fields
//~| ERROR unexpected token: `!`
- //~| unexpected token after this
+ //~| NOTE unexpected token after this
}
+
+fn main() {}
diff --git a/tests/ui/parser/macro/macro-expand-to-field.stderr b/tests/ui/parser/macro/macro-expand-to-field.stderr
index adcd032f5..0bb718000 100644
--- a/tests/ui/parser/macro/macro-expand-to-field.stderr
+++ b/tests/ui/parser/macro/macro-expand-to-field.stderr
@@ -1,21 +1,16 @@
error: unexpected token: `!`
- --> $DIR/macro-expand-to-field.rs:16:10
+ --> $DIR/macro-expand-to-field.rs:19:10
|
+LL | struct Struct {
+ | ------ while parsing this struct
+LL |
LL | field!(bar:u128),
| ^ unexpected token after this
|
= note: macros cannot expand to struct fields
error: unexpected token: `!`
- --> $DIR/macro-expand-to-field.rs:22:10
- |
-LL | field!(recovers:()),
- | ^ unexpected token after this
- |
- = note: macros cannot expand to struct fields
-
-error: unexpected token: `!`
- --> $DIR/macro-expand-to-field.rs:28:12
+ --> $DIR/macro-expand-to-field.rs:29:12
|
LL | variant!(whoops),
| ^ unexpected token after this
@@ -23,7 +18,7 @@ LL | variant!(whoops),
= note: macros cannot expand to enum variants
error: unexpected token: `!`
- --> $DIR/macro-expand-to-field.rs:34:12
+ --> $DIR/macro-expand-to-field.rs:35:12
|
LL | variant!(recovers),
| ^ unexpected token after this
@@ -31,44 +26,46 @@ LL | variant!(recovers),
= note: macros cannot expand to enum variants
error: unexpected token: `!`
- --> $DIR/macro-expand-to-field.rs:39:14
+ --> $DIR/macro-expand-to-field.rs:40:14
|
+LL | Data {
+ | ---- while parsing this struct
LL | field!(x:u32),
| ^ unexpected token after this
|
= note: macros cannot expand to struct fields
error: unexpected token: `!`
- --> $DIR/macro-expand-to-field.rs:48:14
+ --> $DIR/macro-expand-to-field.rs:49:14
|
+LL | Named {
+ | ----- while parsing this struct
LL | field!(oopsies:()),
| ^ unexpected token after this
|
= note: macros cannot expand to struct fields
error: unexpected token: `!`
- --> $DIR/macro-expand-to-field.rs:52:14
- |
-LL | field!(oopsies2:()),
- | ^ unexpected token after this
- |
- = note: macros cannot expand to struct fields
-
-error: unexpected token: `!`
- --> $DIR/macro-expand-to-field.rs:61:10
+ --> $DIR/macro-expand-to-field.rs:60:10
|
+LL | union Union {
+ | ----- while parsing this union
+...
LL | field!(oopsies:()),
| ^ unexpected token after this
|
= note: macros cannot expand to union fields
error: unexpected token: `!`
- --> $DIR/macro-expand-to-field.rs:66:10
+ --> $DIR/macro-expand-to-field.rs:73:16
|
-LL | field!(recovers:()),
- | ^ unexpected token after this
+LL | pub struct Lazy {
+ | ---- while parsing this struct
+LL |
+LL | unreachable!()
+ | ^ unexpected token after this
|
- = note: macros cannot expand to union fields
+ = note: macros cannot expand to struct fields
-error: aborting due to 9 previous errors
+error: aborting due to 7 previous errors
diff --git a/tests/ui/parser/shebang/shebang-doc-comment.stderr b/tests/ui/parser/shebang/shebang-doc-comment.stderr
index 2227d45ec..a36b2a2f7 100644
--- a/tests/ui/parser/shebang/shebang-doc-comment.stderr
+++ b/tests/ui/parser/shebang/shebang-doc-comment.stderr
@@ -3,6 +3,8 @@ error: expected item, found `[`
|
LL | [allow(unused_variables)]
| ^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
error: aborting due to previous error
diff --git a/tests/ui/parser/struct-literal-in-if.rs b/tests/ui/parser/struct-literal-in-if.rs
index 2ce2c8f18..c4a253c3d 100644
--- a/tests/ui/parser/struct-literal-in-if.rs
+++ b/tests/ui/parser/struct-literal-in-if.rs
@@ -14,4 +14,9 @@ fn main() {
}.hi() {
println!("yo");
}
+ if let true = Foo { //~ ERROR struct literals are not allowed here
+ x: 3
+ }.hi() {
+ println!("yo");
+ }
}
diff --git a/tests/ui/parser/struct-literal-in-if.stderr b/tests/ui/parser/struct-literal-in-if.stderr
index b5a9864bb..8b72469fc 100644
--- a/tests/ui/parser/struct-literal-in-if.stderr
+++ b/tests/ui/parser/struct-literal-in-if.stderr
@@ -14,5 +14,21 @@ LL | x: 3
LL ~ }).hi() {
|
-error: aborting due to previous error
+error: struct literals are not allowed here
+ --> $DIR/struct-literal-in-if.rs:17:19
+ |
+LL | if let true = Foo {
+ | ___________________^
+LL | | x: 3
+LL | | }.hi() {
+ | |_____^
+ |
+help: surround the struct literal with parentheses
+ |
+LL ~ if let true = (Foo {
+LL | x: 3
+LL ~ }).hi() {
+ |
+
+error: aborting due to 2 previous errors
diff --git a/tests/ui/parser/struct-literal-in-match-guard.rs b/tests/ui/parser/struct-literal-in-match-guard.rs
index bf0551b5c..bbee60e28 100644
--- a/tests/ui/parser/struct-literal-in-match-guard.rs
+++ b/tests/ui/parser/struct-literal-in-match-guard.rs
@@ -3,6 +3,8 @@
// Unlike `if` condition, `match` guards accept struct literals.
// This is detected in <https://github.com/rust-lang/rust/pull/74566#issuecomment-663613705>.
+#![feature(if_let_guard)]
+
#[derive(PartialEq)]
struct Foo {
x: isize,
@@ -11,6 +13,7 @@ struct Foo {
fn foo(f: Foo) {
match () {
() if f == Foo { x: 42 } => {}
+ () if let Foo { x: 0.. } = Foo { x: 42 } => {}
_ => {}
}
}
diff --git a/tests/ui/parser/struct-literal-in-while.rs b/tests/ui/parser/struct-literal-in-while.rs
index 5000ce85b..86931f788 100644
--- a/tests/ui/parser/struct-literal-in-while.rs
+++ b/tests/ui/parser/struct-literal-in-while.rs
@@ -14,4 +14,9 @@ fn main() {
}.hi() {
println!("yo");
}
+ while let true = Foo { //~ ERROR struct literals are not allowed here
+ x: 3
+ }.hi() {
+ println!("yo");
+ }
}
diff --git a/tests/ui/parser/struct-literal-in-while.stderr b/tests/ui/parser/struct-literal-in-while.stderr
index 17e9277e0..13d003608 100644
--- a/tests/ui/parser/struct-literal-in-while.stderr
+++ b/tests/ui/parser/struct-literal-in-while.stderr
@@ -14,5 +14,21 @@ LL | x: 3
LL ~ }).hi() {
|
-error: aborting due to previous error
+error: struct literals are not allowed here
+ --> $DIR/struct-literal-in-while.rs:17:22
+ |
+LL | while let true = Foo {
+ | ______________________^
+LL | | x: 3
+LL | | }.hi() {
+ | |_____^
+ |
+help: surround the struct literal with parentheses
+ |
+LL ~ while let true = (Foo {
+LL | x: 3
+LL ~ }).hi() {
+ |
+
+error: aborting due to 2 previous errors
diff --git a/tests/ui/parser/struct-literal-restrictions-in-lamda.stderr b/tests/ui/parser/struct-literal-restrictions-in-lamda.stderr
index 0852c7cb4..c715486e2 100644
--- a/tests/ui/parser/struct-literal-restrictions-in-lamda.stderr
+++ b/tests/ui/parser/struct-literal-restrictions-in-lamda.stderr
@@ -24,7 +24,7 @@ LL | | }.hi() {
| |__________^ expected `bool`, found closure
|
= note: expected type `bool`
- found closure `[closure@$DIR/struct-literal-restrictions-in-lamda.rs:12:11: 12:13]`
+ found closure `{closure@$DIR/struct-literal-restrictions-in-lamda.rs:12:11: 12:13}`
help: use parentheses to call this closure
|
LL ~ while (|| Foo {
diff --git a/tests/ui/parser/virtual-structs.stderr b/tests/ui/parser/virtual-structs.stderr
index a5211d83f..268fc1057 100644
--- a/tests/ui/parser/virtual-structs.stderr
+++ b/tests/ui/parser/virtual-structs.stderr
@@ -3,6 +3,8 @@ error: expected item, found reserved keyword `virtual`
|
LL | virtual struct SuperStruct {
| ^^^^^^^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
error: aborting due to previous error
diff --git a/tests/ui/pattern/issue-114896.rs b/tests/ui/pattern/issue-114896.rs
new file mode 100644
index 000000000..cde37f658
--- /dev/null
+++ b/tests/ui/pattern/issue-114896.rs
@@ -0,0 +1,7 @@
+fn main() {
+ fn x(a: &char) {
+ let &b = a;
+ b.make_ascii_uppercase();
+//~^ cannot borrow `b` as mutable, as it is not declared as mutable
+ }
+}
diff --git a/tests/ui/pattern/issue-114896.stderr b/tests/ui/pattern/issue-114896.stderr
new file mode 100644
index 000000000..ffeb7bc13
--- /dev/null
+++ b/tests/ui/pattern/issue-114896.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow `b` as mutable, as it is not declared as mutable
+ --> $DIR/issue-114896.rs:4:9
+ |
+LL | let &b = a;
+ | -- help: consider changing this to be mutable: `&(mut b)`
+LL | b.make_ascii_uppercase();
+ | ^ cannot borrow as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/tests/ui/pattern/non-structural-match-types.stderr b/tests/ui/pattern/non-structural-match-types.stderr
index dea7c4695..43d92775e 100644
--- a/tests/ui/pattern/non-structural-match-types.stderr
+++ b/tests/ui/pattern/non-structural-match-types.stderr
@@ -1,10 +1,10 @@
-error: `[closure@$DIR/non-structural-match-types.rs:9:17: 9:19]` cannot be used in patterns
+error: `{closure@$DIR/non-structural-match-types.rs:9:17: 9:19}` cannot be used in patterns
--> $DIR/non-structural-match-types.rs:9:9
|
LL | const { || {} } => {},
| ^^^^^^^^^^^^^^^
-error: `[async block@$DIR/non-structural-match-types.rs:12:17: 12:25]` cannot be used in patterns
+error: `{async block@$DIR/non-structural-match-types.rs:12:17: 12:25}` cannot be used in patterns
--> $DIR/non-structural-match-types.rs:12:9
|
LL | const { async {} } => {},
diff --git a/tests/ui/pattern/usefulness/auxiliary/non-exhaustive.rs b/tests/ui/pattern/usefulness/auxiliary/non-exhaustive.rs
new file mode 100644
index 000000000..6f459b826
--- /dev/null
+++ b/tests/ui/pattern/usefulness/auxiliary/non-exhaustive.rs
@@ -0,0 +1,2 @@
+#[non_exhaustive]
+pub enum NonExhaustiveEnum { A, B }
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 0e0f0c3e1..df330c60b 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
@@ -77,6 +77,8 @@ LL | m!((0usize, true), (0..5, true) | (5..=usize::MAX, true) | (0..=usize::
| ^^^^^^^^^^^^^^ pattern `(_, _)` not covered
|
= note: the matched value is of type `(usize, bool)`
+ = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = 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 | match $s { $($t)+ => {}, (_, _) => todo!() }
@@ -131,6 +133,8 @@ LL | m!((0isize, true), (isize::MIN..5, true)
| ^^^^^^^^^^^^^^ pattern `(_, _)` not covered
|
= note: the matched value is of type `(isize, bool)`
+ = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = 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 | match $s { $($t)+ => {}, (_, _) => todo!() }
diff --git a/tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.rs b/tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.rs
new file mode 100644
index 000000000..0ee7856c6
--- /dev/null
+++ b/tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.rs
@@ -0,0 +1,12 @@
+fn main() {
+ let a = "";
+ let b = "";
+ match (a, b) {
+ //~^ ERROR non-exhaustive patterns: `(&_, _)` not covered [E0004]
+ //~| NOTE pattern `(&_, _)` not covered
+ //~| NOTE the matched value is of type `(&str, &str)`
+ //~| NOTE `&str` cannot be matched exhaustively, so a wildcard `_` is necessary
+ ("a", "b") => {}
+ ("c", "d") => {}
+ }
+}
diff --git a/tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.stderr b/tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.stderr
new file mode 100644
index 000000000..771fc320a
--- /dev/null
+++ b/tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.stderr
@@ -0,0 +1,17 @@
+error[E0004]: non-exhaustive patterns: `(&_, _)` not covered
+ --> $DIR/issue-105479-str-non-exhaustiveness.rs:4:11
+ |
+LL | match (a, b) {
+ | ^^^^^^ pattern `(&_, _)` not covered
+ |
+ = note: the matched value is of type `(&str, &str)`
+ = note: `&str` cannot be matched exhaustively, so a wildcard `_` is necessary
+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 ~ ("c", "d") => {},
+LL + (&_, _) => todo!()
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/pattern/usefulness/issue-30240.stderr b/tests/ui/pattern/usefulness/issue-30240.stderr
index ff755d681..da8bbdffb 100644
--- a/tests/ui/pattern/usefulness/issue-30240.stderr
+++ b/tests/ui/pattern/usefulness/issue-30240.stderr
@@ -5,6 +5,7 @@ LL | match "world" {
| ^^^^^^^ pattern `&_` not covered
|
= note: the matched value is of type `&str`
+ = note: `&str` cannot be matched exhaustively, so a wildcard `_` is necessary
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" => {},
@@ -18,6 +19,7 @@ LL | match "world" {
| ^^^^^^^ pattern `&_` not covered
|
= note: the matched value is of type `&str`
+ = note: `&str` cannot be matched exhaustively, so a wildcard `_` is necessary
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" => {},
diff --git a/tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.rs b/tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.rs
new file mode 100644
index 000000000..8f58227ee
--- /dev/null
+++ b/tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.rs
@@ -0,0 +1,67 @@
+struct A<T> {
+ a: T,
+}
+
+struct B<T, U>(T, U);
+
+fn main() {
+ match 0 {
+ //~^ ERROR non-exhaustive patterns: `_` not covered [E0004]
+ 0 => (),
+ 1..=usize::MAX => (),
+ }
+
+ match (0usize, 0usize) {
+ //~^ ERROR non-exhaustive patterns: `(_, _)` not covered [E0004]
+ (0, 0) => (),
+ (1..=usize::MAX, 1..=usize::MAX) => (),
+ }
+
+ match (0isize, 0usize) {
+ //~^ ERROR non-exhaustive patterns: `(_, _)` not covered [E0004]
+ (isize::MIN..=isize::MAX, 0) => (),
+ (isize::MIN..=isize::MAX, 1..=usize::MAX) => (),
+ }
+
+ // Should not report note about usize not having fixed max value
+ match Some(1usize) {
+ //~^ ERROR non-exhaustive patterns: `Some(_)` not covered
+ None => {}
+ }
+
+ match Some(4) {
+ //~^ ERROR non-exhaustive patterns: `Some(_)` not covered
+ Some(0) => (),
+ Some(1..=usize::MAX) => (),
+ None => (),
+ }
+
+ match Some(Some(Some(0))) {
+ //~^ ERROR non-exhaustive patterns: `Some(Some(Some(_)))` not covered
+ Some(Some(Some(0))) => (),
+ Some(Some(Some(1..=usize::MAX))) => (),
+ Some(Some(None)) => (),
+ Some(None) => (),
+ None => (),
+ }
+
+ match (A { a: 0usize }) {
+ //~^ ERROR non-exhaustive patterns: `A { .. }` not covered [E0004]
+ A { a: 0 } => (),
+ A { a: 1..=usize::MAX } => (),
+ }
+
+ match B(0isize, 0usize) {
+ //~^ ERROR non-exhaustive patterns: `B(_, _)` not covered [E0004]
+ B(isize::MIN..=isize::MAX, 0) => (),
+ B(isize::MIN..=isize::MAX, 1..=usize::MAX) => (),
+ }
+
+ // Should report only the note about usize not having fixed max value and not report
+ // report the note about isize
+ match B(0isize, 0usize) {
+ //~^ ERROR non-exhaustive patterns: `B(_, _)` not covered [E0004]
+ B(_, 0) => (),
+ B(_, 1..=usize::MAX) => (),
+ }
+}
diff --git a/tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.stderr b/tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.stderr
new file mode 100644
index 000000000..ea1d99e20
--- /dev/null
+++ b/tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.stderr
@@ -0,0 +1,170 @@
+error[E0004]: non-exhaustive patterns: `_` not covered
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:8:11
+ |
+LL | match 0 {
+ | ^ pattern `_` not covered
+ |
+ = note: the matched value is of type `usize`
+ = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = 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 ~ 1..=usize::MAX => (),
+LL ~ _ => todo!(),
+ |
+
+error[E0004]: non-exhaustive patterns: `(_, _)` not covered
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:14:11
+ |
+LL | match (0usize, 0usize) {
+ | ^^^^^^^^^^^^^^^^ pattern `(_, _)` not covered
+ |
+ = note: the matched value is of type `(usize, usize)`
+ = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = 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 ~ (1..=usize::MAX, 1..=usize::MAX) => (),
+LL ~ (_, _) => todo!(),
+ |
+
+error[E0004]: non-exhaustive patterns: `(_, _)` not covered
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:20:11
+ |
+LL | match (0isize, 0usize) {
+ | ^^^^^^^^^^^^^^^^ pattern `(_, _)` not covered
+ |
+ = note: the matched value is of type `(isize, usize)`
+ = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = 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, 1..=usize::MAX) => (),
+LL ~ (_, _) => todo!(),
+ |
+
+error[E0004]: non-exhaustive patterns: `Some(_)` not covered
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:27:11
+ |
+LL | match Some(1usize) {
+ | ^^^^^^^^^^^^ pattern `Some(_)` not covered
+ |
+note: `Option<usize>` defined here
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+ ::: $SRC_DIR/core/src/option.rs:LL:COL
+ |
+ = note: not covered
+ = note: the matched value is of type `Option<usize>`
+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 + Some(_) => todo!()
+ |
+
+error[E0004]: non-exhaustive patterns: `Some(_)` not covered
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:32:11
+ |
+LL | match Some(4) {
+ | ^^^^^^^ pattern `Some(_)` not covered
+ |
+note: `Option<usize>` defined here
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+ ::: $SRC_DIR/core/src/option.rs:LL:COL
+ |
+ = note: not covered
+ = note: the matched value is of type `Option<usize>`
+ = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = 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 ~ None => (),
+LL ~ Some(_) => todo!(),
+ |
+
+error[E0004]: non-exhaustive patterns: `Some(Some(Some(_)))` not covered
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:39:11
+ |
+LL | match Some(Some(Some(0))) {
+ | ^^^^^^^^^^^^^^^^^^^ pattern `Some(Some(Some(_)))` not covered
+ |
+note: `Option<Option<Option<usize>>>` defined here
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+ ::: $SRC_DIR/core/src/option.rs:LL:COL
+ |
+ = note: not covered
+ |
+ = note: not covered
+ |
+ = note: not covered
+ = note: the matched value is of type `Option<Option<Option<usize>>>`
+ = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = 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 ~ None => (),
+LL ~ Some(Some(Some(_))) => todo!(),
+ |
+
+error[E0004]: non-exhaustive patterns: `A { .. }` not covered
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:48:11
+ |
+LL | match (A { a: 0usize }) {
+ | ^^^^^^^^^^^^^^^^^ pattern `A { .. }` not covered
+ |
+note: `A<usize>` defined here
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:1:8
+ |
+LL | struct A<T> {
+ | ^
+ = note: the matched value is of type `A<usize>`
+ = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = 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 ~ A { a: 1..=usize::MAX } => (),
+LL ~ A { .. } => todo!(),
+ |
+
+error[E0004]: non-exhaustive patterns: `B(_, _)` not covered
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:54:11
+ |
+LL | match B(0isize, 0usize) {
+ | ^^^^^^^^^^^^^^^^^ pattern `B(_, _)` not covered
+ |
+note: `B<isize, usize>` defined here
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:5:8
+ |
+LL | struct B<T, U>(T, U);
+ | ^
+ = note: the matched value is of type `B<isize, usize>`
+ = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = 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 ~ B(isize::MIN..=isize::MAX, 1..=usize::MAX) => (),
+LL ~ B(_, _) => todo!(),
+ |
+
+error[E0004]: non-exhaustive patterns: `B(_, _)` not covered
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:62:11
+ |
+LL | match B(0isize, 0usize) {
+ | ^^^^^^^^^^^^^^^^^ pattern `B(_, _)` not covered
+ |
+note: `B<isize, usize>` defined here
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:5:8
+ |
+LL | struct B<T, U>(T, U);
+ | ^
+ = note: the matched value is of type `B<isize, usize>`
+ = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = 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 ~ B(_, 1..=usize::MAX) => (),
+LL ~ B(_, _) => todo!(),
+ |
+
+error: aborting due to 9 previous errors
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/pattern/usefulness/nested-non-exhaustive-enums.rs b/tests/ui/pattern/usefulness/nested-non-exhaustive-enums.rs
new file mode 100644
index 000000000..3a8a74d1f
--- /dev/null
+++ b/tests/ui/pattern/usefulness/nested-non-exhaustive-enums.rs
@@ -0,0 +1,18 @@
+// aux-build:non-exhaustive.rs
+
+extern crate non_exhaustive;
+
+use non_exhaustive::NonExhaustiveEnum;
+
+fn main() {
+ match Some(NonExhaustiveEnum::A) {
+ //~^ ERROR non-exhaustive patterns: `Some(_)` not covered [E0004]
+ //~| NOTE pattern `Some(_)` not covered
+ //~| NOTE `Option<NonExhaustiveEnum>` defined here
+ //~| NOTE the matched value is of type `Option<NonExhaustiveEnum>`
+ //~| NOTE `NonExhaustiveEnum` is marked as non-exhaustive
+ Some(NonExhaustiveEnum::A) => {}
+ Some(NonExhaustiveEnum::B) => {}
+ None => {}
+ }
+}
diff --git a/tests/ui/pattern/usefulness/nested-non-exhaustive-enums.stderr b/tests/ui/pattern/usefulness/nested-non-exhaustive-enums.stderr
new file mode 100644
index 000000000..9fbd871db
--- /dev/null
+++ b/tests/ui/pattern/usefulness/nested-non-exhaustive-enums.stderr
@@ -0,0 +1,22 @@
+error[E0004]: non-exhaustive patterns: `Some(_)` not covered
+ --> $DIR/nested-non-exhaustive-enums.rs:8:11
+ |
+LL | match Some(NonExhaustiveEnum::A) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Some(_)` not covered
+ |
+note: `Option<NonExhaustiveEnum>` defined here
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+ ::: $SRC_DIR/core/src/option.rs:LL:COL
+ |
+ = note: not covered
+ = note: the matched value is of type `Option<NonExhaustiveEnum>`
+ = note: `NonExhaustiveEnum` is marked as non-exhaustive, so a wildcard `_` is necessary to match exhaustively
+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 + Some(_) => todo!()
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr b/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr
index b8af566de..d798ec722 100644
--- a/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr
+++ b/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr
@@ -10,6 +10,8 @@ note: `Foo` defined here
LL | struct Foo {
| ^^^
= note: the matched value is of type `Foo`
+ = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = 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 ~ Foo { first: false, second: Some([1, 2, 3, 4]) } => (),
diff --git a/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr b/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr
index e2a65ff85..50c7fc889 100644
--- a/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr
+++ b/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr
@@ -10,6 +10,8 @@ note: `Foo` defined here
LL | struct Foo(isize, isize);
| ^^^
= note: the matched value is of type `Foo`
+ = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = 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 ~ Foo(2, b) => println!("{}", b),
diff --git a/tests/ui/print_type_sizes/async.stdout b/tests/ui/print_type_sizes/async.stdout
index 873def903..e1be98f85 100644
--- a/tests/ui/print_type_sizes/async.stdout
+++ b/tests/ui/print_type_sizes/async.stdout
@@ -1,4 +1,4 @@
-print-type-size type: `[async fn body@$DIR/async.rs:10:36: 13:2]`: 16386 bytes, alignment: 1 bytes
+print-type-size type: `{async fn body@$DIR/async.rs:10:36: 13:2}`: 16386 bytes, alignment: 1 bytes
print-type-size discriminant: 1 bytes
print-type-size variant `Unresumed`: 8192 bytes
print-type-size upvar `.arg`: 8192 bytes
@@ -16,14 +16,9 @@ print-type-size type: `std::mem::MaybeUninit<[u8; 8192]>`: 8192 bytes, alignment
print-type-size variant `MaybeUninit`: 8192 bytes
print-type-size field `.uninit`: 0 bytes
print-type-size field `.value`: 8192 bytes
-print-type-size type: `[async fn body@$DIR/async.rs:8:17: 8:19]`: 1 bytes, alignment: 1 bytes
-print-type-size discriminant: 1 bytes
-print-type-size variant `Unresumed`: 0 bytes
-print-type-size variant `Returned`: 0 bytes
-print-type-size variant `Panicked`: 0 bytes
-print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/async.rs:8:17: 8:19]>`: 1 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::ManuallyDrop<{async fn body@$DIR/async.rs:8:17: 8:19}>`: 1 bytes, alignment: 1 bytes
print-type-size field `.value`: 1 bytes
-print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/async.rs:8:17: 8:19]>`: 1 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::MaybeUninit<{async fn body@$DIR/async.rs:8:17: 8:19}>`: 1 bytes, alignment: 1 bytes
print-type-size variant `MaybeUninit`: 1 bytes
print-type-size field `.uninit`: 0 bytes
print-type-size field `.value`: 1 bytes
@@ -32,3 +27,8 @@ print-type-size discriminant: 1 bytes
print-type-size variant `Ready`: 0 bytes
print-type-size field `.0`: 0 bytes
print-type-size variant `Pending`: 0 bytes
+print-type-size type: `{async fn body@$DIR/async.rs:8:17: 8:19}`: 1 bytes, alignment: 1 bytes
+print-type-size discriminant: 1 bytes
+print-type-size variant `Unresumed`: 0 bytes
+print-type-size variant `Returned`: 0 bytes
+print-type-size variant `Panicked`: 0 bytes
diff --git a/tests/ui/print_type_sizes/generator.stdout b/tests/ui/print_type_sizes/generator.stdout
index 2dcadde9e..f8c52a595 100644
--- a/tests/ui/print_type_sizes/generator.stdout
+++ b/tests/ui/print_type_sizes/generator.stdout
@@ -1,4 +1,4 @@
-print-type-size type: `[generator@$DIR/generator.rs:10:5: 10:14]`: 8193 bytes, alignment: 1 bytes
+print-type-size type: `{generator@$DIR/generator.rs:10:5: 10:14}`: 8193 bytes, alignment: 1 bytes
print-type-size discriminant: 1 bytes
print-type-size variant `Unresumed`: 8192 bytes
print-type-size upvar `.array`: 8192 bytes
diff --git a/tests/ui/print_type_sizes/generator_discr_placement.stdout b/tests/ui/print_type_sizes/generator_discr_placement.stdout
index fe0022cf5..f7bdee111 100644
--- a/tests/ui/print_type_sizes/generator_discr_placement.stdout
+++ b/tests/ui/print_type_sizes/generator_discr_placement.stdout
@@ -1,4 +1,4 @@
-print-type-size type: `[generator@$DIR/generator_discr_placement.rs:12:13: 12:15]`: 8 bytes, alignment: 4 bytes
+print-type-size type: `{generator@$DIR/generator_discr_placement.rs:12:13: 12:15}`: 8 bytes, alignment: 4 bytes
print-type-size discriminant: 1 bytes
print-type-size variant `Unresumed`: 0 bytes
print-type-size variant `Suspend0`: 7 bytes
diff --git a/tests/ui/print_type_sizes/zero-sized-fields.stdout b/tests/ui/print_type_sizes/zero-sized-fields.stdout
index 72f59c4bb..e4d44241e 100644
--- a/tests/ui/print_type_sizes/zero-sized-fields.stdout
+++ b/tests/ui/print_type_sizes/zero-sized-fields.stdout
@@ -1,16 +1,16 @@
print-type-size type: `S5<(), Empty>`: 16 bytes, alignment: 4 bytes
+print-type-size field `.w`: 4 bytes
+print-type-size field `.x`: 4 bytes
+print-type-size field `.y`: 4 bytes
+print-type-size field `.z`: 4 bytes
print-type-size field `.tagw`: 0 bytes
print-type-size field `.unit`: 0 bytes
print-type-size field `.void`: 0 bytes
print-type-size field `.empty`: 0 bytes
print-type-size field `.tagz`: 0 bytes
-print-type-size field `.w`: 4 bytes
-print-type-size field `.x`: 4 bytes
-print-type-size field `.y`: 4 bytes
-print-type-size field `.z`: 4 bytes
print-type-size type: `S1`: 8 bytes, alignment: 4 bytes
-print-type-size field `.tag`: 0 bytes
print-type-size field `.x`: 4 bytes
print-type-size field `.y`: 4 bytes
+print-type-size field `.tag`: 0 bytes
print-type-size type: `Empty`: 0 bytes, alignment: 1 bytes
print-type-size type: `Void`: 0 bytes, alignment: 1 bytes
diff --git a/tests/ui/privacy/associated-item-privacy-inherent.rs b/tests/ui/privacy/associated-item-privacy-inherent.rs
index 7b7c734a9..81703ae10 100644
--- a/tests/ui/privacy/associated-item-privacy-inherent.rs
+++ b/tests/ui/privacy/associated-item-privacy-inherent.rs
@@ -1,5 +1,5 @@
#![feature(decl_macro, associated_type_defaults)]
-#![allow(unused, private_in_public)]
+#![allow(private_interfaces)]
mod priv_nominal {
pub struct Pub;
diff --git a/tests/ui/privacy/associated-item-privacy-trait.rs b/tests/ui/privacy/associated-item-privacy-trait.rs
index c686a2177..db77a6a72 100644
--- a/tests/ui/privacy/associated-item-privacy-trait.rs
+++ b/tests/ui/privacy/associated-item-privacy-trait.rs
@@ -1,5 +1,5 @@
#![feature(decl_macro, associated_type_defaults)]
-#![allow(unused, private_in_public)]
+#![allow(private_interfaces, private_bounds)]
mod priv_trait {
trait PrivTr {
diff --git a/tests/ui/privacy/associated-item-privacy-type-binding.rs b/tests/ui/privacy/associated-item-privacy-type-binding.rs
index 9826b83a3..95a4fbf63 100644
--- a/tests/ui/privacy/associated-item-privacy-type-binding.rs
+++ b/tests/ui/privacy/associated-item-privacy-type-binding.rs
@@ -1,5 +1,5 @@
#![feature(decl_macro, associated_type_defaults)]
-#![allow(unused, private_in_public)]
+#![allow(private_interfaces, private_bounds)]
mod priv_trait {
trait PrivTr {
diff --git a/tests/ui/privacy/effective_visibilities_full_priv.rs b/tests/ui/privacy/effective_visibilities_full_priv.rs
index a26ae3bd1..b96eddcab 100644
--- a/tests/ui/privacy/effective_visibilities_full_priv.rs
+++ b/tests/ui/privacy/effective_visibilities_full_priv.rs
@@ -1,5 +1,5 @@
#![feature(rustc_attrs)]
-#![allow(private_in_public)]
+#![allow(private_interfaces)]
struct SemiPriv;
diff --git a/tests/ui/privacy/issue-30079.rs b/tests/ui/privacy/issue-30079.rs
index a02a932d0..ddba629f5 100644
--- a/tests/ui/privacy/issue-30079.rs
+++ b/tests/ui/privacy/issue-30079.rs
@@ -3,8 +3,7 @@ struct SemiPriv;
mod m1 {
struct Priv;
impl ::SemiPriv {
- pub fn f(_: Priv) {} //~ WARN private type `m1::Priv` in public interface
- //~^ WARNING hard error
+ pub fn f(_: Priv) {} //~ WARN type `m1::Priv` is more private than the item `m1::<impl SemiPriv>::f`
}
impl Priv {
diff --git a/tests/ui/privacy/issue-30079.stderr b/tests/ui/privacy/issue-30079.stderr
index 9179ff339..f1facba7c 100644
--- a/tests/ui/privacy/issue-30079.stderr
+++ b/tests/ui/privacy/issue-30079.stderr
@@ -1,15 +1,18 @@
-warning: private type `m1::Priv` in public interface (error E0446)
+warning: type `m1::Priv` is more private than the item `m1::<impl SemiPriv>::f`
--> $DIR/issue-30079.rs:6:9
|
LL | pub fn f(_: Priv) {}
- | ^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^ associated function `m1::<impl SemiPriv>::f` is reachable at visibility `pub(crate)`
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
- = note: `#[warn(private_in_public)]` on by default
+note: but type `m1::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/issue-30079.rs:4:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
+ = note: `#[warn(private_interfaces)]` on by default
error[E0446]: private type `m2::Priv` in public interface
- --> $DIR/issue-30079.rs:18:9
+ --> $DIR/issue-30079.rs:17:9
|
LL | struct Priv;
| ----------- `m2::Priv` declared as private
@@ -18,7 +21,7 @@ LL | type Target = Priv;
| ^^^^^^^^^^^ can't leak private type
error[E0446]: private type `m3::Priv` in public interface
- --> $DIR/issue-30079.rs:35:9
+ --> $DIR/issue-30079.rs:34:9
|
LL | struct Priv;
| ----------- `m3::Priv` declared as private
diff --git a/tests/ui/privacy/private-bounds-locally-allowed.rs b/tests/ui/privacy/private-bounds-locally-allowed.rs
new file mode 100644
index 000000000..96a007a64
--- /dev/null
+++ b/tests/ui/privacy/private-bounds-locally-allowed.rs
@@ -0,0 +1,7 @@
+// check-pass
+// compile-flags: --crate-type=lib
+
+#[allow(private_bounds)]
+pub trait Foo: FooImpl {}
+
+trait FooImpl {}
diff --git a/tests/ui/privacy/private-in-public-assoc-ty.rs b/tests/ui/privacy/private-in-public-assoc-ty.rs
index d4d379bdb..5f7c4bcf2 100644
--- a/tests/ui/privacy/private-in-public-assoc-ty.rs
+++ b/tests/ui/privacy/private-in-public-assoc-ty.rs
@@ -22,14 +22,11 @@ mod m {
// applies only to the aliased types, not bounds.
pub trait PubTr {
type Alias1: PrivTr;
- //~^ WARN private trait `PrivTr` in public interface
- //~| WARN this was previously accepted
+ //~^ WARN trait `PrivTr` is more private than the item `PubTr::Alias1`
type Alias2: PubTrAux1<Priv> = u8;
- //~^ WARN private type `Priv` in public interface
- //~| WARN this was previously accepted
+ //~^ WARN type `Priv` is more private than the item `PubTr::Alias2`
type Alias3: PubTrAux2<A = Priv> = u8;
- //~^ WARN private type `Priv` in public interface
- //~| WARN this was previously accepted
+ //~^ WARN type `Priv` is more private than the item `PubTr::Alias3`
type Alias4 = Priv;
//~^ ERROR private type `Priv` in public interface
diff --git a/tests/ui/privacy/private-in-public-assoc-ty.stderr b/tests/ui/privacy/private-in-public-assoc-ty.stderr
index a59027d81..0931e6d99 100644
--- a/tests/ui/privacy/private-in-public-assoc-ty.stderr
+++ b/tests/ui/privacy/private-in-public-assoc-ty.stderr
@@ -7,36 +7,45 @@ LL | struct Priv;
LL | type A = Priv;
| ^^^^^^ can't leak private type
-warning: private trait `PrivTr` in public interface (error E0445)
+warning: trait `PrivTr` is more private than the item `PubTr::Alias1`
--> $DIR/private-in-public-assoc-ty.rs:24:9
|
LL | type Alias1: PrivTr;
- | ^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^ associated type `PubTr::Alias1` is reachable at visibility `pub(crate)`
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
- = note: `#[warn(private_in_public)]` on by default
+note: but trait `PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-assoc-ty.rs:9:5
+ |
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
+ = note: `#[warn(private_bounds)]` on by default
-warning: private type `Priv` in public interface (error E0446)
- --> $DIR/private-in-public-assoc-ty.rs:27:9
+warning: type `Priv` is more private than the item `PubTr::Alias2`
+ --> $DIR/private-in-public-assoc-ty.rs:26:9
|
LL | type Alias2: PubTrAux1<Priv> = u8;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated type `PubTr::Alias2` is reachable at visibility `pub(crate)`
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-assoc-ty.rs:8:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
-warning: private type `Priv` in public interface (error E0446)
- --> $DIR/private-in-public-assoc-ty.rs:30:9
+warning: type `Priv` is more private than the item `PubTr::Alias3`
+ --> $DIR/private-in-public-assoc-ty.rs:28:9
|
LL | type Alias3: PubTrAux2<A = Priv> = u8;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated type `PubTr::Alias3` is reachable at visibility `pub(crate)`
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-assoc-ty.rs:8:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
error[E0446]: private type `Priv` in public interface
- --> $DIR/private-in-public-assoc-ty.rs:34:9
+ --> $DIR/private-in-public-assoc-ty.rs:31:9
|
LL | struct Priv;
| ----------- `Priv` declared as private
@@ -45,7 +54,7 @@ LL | type Alias4 = Priv;
| ^^^^^^^^^^^ can't leak private type
error[E0446]: private type `Priv` in public interface
- --> $DIR/private-in-public-assoc-ty.rs:41:9
+ --> $DIR/private-in-public-assoc-ty.rs:38:9
|
LL | struct Priv;
| ----------- `Priv` declared as private
@@ -53,8 +62,8 @@ LL | struct Priv;
LL | type Alias1 = Priv;
| ^^^^^^^^^^^ can't leak private type
-error[E0445]: private trait `PrivTr` in public interface
- --> $DIR/private-in-public-assoc-ty.rs:44:9
+error[E0446]: private trait `PrivTr` in public interface
+ --> $DIR/private-in-public-assoc-ty.rs:41:9
|
LL | trait PrivTr {}
| ------------ `PrivTr` declared as private
@@ -64,5 +73,4 @@ LL | type Exist = impl PrivTr;
error: aborting due to 4 previous errors; 3 warnings emitted
-Some errors have detailed explanations: E0445, E0446.
-For more information about an error, try `rustc --explain E0445`.
+For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/privacy/private-in-public-lint.rs b/tests/ui/privacy/private-in-public-lint.rs
deleted file mode 100644
index 8b6e43601..000000000
--- a/tests/ui/privacy/private-in-public-lint.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-mod m1 {
- pub struct Pub;
- struct Priv;
-
- impl Pub {
- pub fn f() -> Priv {Priv} //~ ERROR private type `m1::Priv` in public interface
- }
-}
-
-mod m2 {
- pub struct Pub;
- struct Priv;
-
- impl Pub {
- pub fn f() -> Priv {Priv} //~ ERROR private type `m2::Priv` in public interface
- }
-}
-
-fn main() {}
diff --git a/tests/ui/privacy/private-in-public-lint.stderr b/tests/ui/privacy/private-in-public-lint.stderr
deleted file mode 100644
index 1e98e3bed..000000000
--- a/tests/ui/privacy/private-in-public-lint.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0446]: private type `m1::Priv` in public interface
- --> $DIR/private-in-public-lint.rs:6:9
- |
-LL | struct Priv;
- | ----------- `m1::Priv` declared as private
-...
-LL | pub fn f() -> Priv {Priv}
- | ^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error[E0446]: private type `m2::Priv` in public interface
- --> $DIR/private-in-public-lint.rs:15:9
- |
-LL | struct Priv;
- | ----------- `m2::Priv` declared as private
-...
-LL | pub fn f() -> Priv {Priv}
- | ^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/privacy/private-in-public-non-principal-2.rs b/tests/ui/privacy/private-in-public-non-principal-2.rs
index db451d334..d7223c647 100644
--- a/tests/ui/privacy/private-in-public-non-principal-2.rs
+++ b/tests/ui/privacy/private-in-public-non-principal-2.rs
@@ -1,7 +1,7 @@
#![feature(auto_traits)]
#![feature(negative_impls)]
-#[allow(private_in_public)]
+#[allow(private_interfaces)]
mod m {
pub trait PubPrincipal {}
auto trait PrivNonPrincipal {}
diff --git a/tests/ui/privacy/private-in-public-non-principal.rs b/tests/ui/privacy/private-in-public-non-principal.rs
index a2284c930..e348a1816 100644
--- a/tests/ui/privacy/private-in-public-non-principal.rs
+++ b/tests/ui/privacy/private-in-public-non-principal.rs
@@ -1,19 +1,11 @@
#![feature(auto_traits)]
#![feature(negative_impls)]
-#![feature(type_privacy_lints)]
-#![deny(private_interfaces)]
-
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
pub trait PubPrincipal {}
auto trait PrivNonPrincipal {}
pub fn leak_dyn_nonprincipal() -> Box<dyn PubPrincipal + PrivNonPrincipal> { loop {} }
-//~^ WARN private trait `PrivNonPrincipal` in public interface
-//~| WARN this was previously accepted
-//~| ERROR trait `PrivNonPrincipal` is more private than the item `leak_dyn_nonprincipal`
+//~^ WARN trait `PrivNonPrincipal` is more private than the item `leak_dyn_nonprincipal`
#[deny(missing_docs)]
fn container() {
diff --git a/tests/ui/privacy/private-in-public-non-principal.stderr b/tests/ui/privacy/private-in-public-non-principal.stderr
index 1387f59cb..63512f462 100644
--- a/tests/ui/privacy/private-in-public-non-principal.stderr
+++ b/tests/ui/privacy/private-in-public-non-principal.stderr
@@ -1,41 +1,27 @@
-warning: private trait `PrivNonPrincipal` in public interface (error E0445)
- --> $DIR/private-in-public-non-principal.rs:13:1
- |
-LL | pub fn leak_dyn_nonprincipal() -> Box<dyn PubPrincipal + PrivNonPrincipal> { loop {} }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
- = note: `#[warn(private_in_public)]` on by default
-
-error: trait `PrivNonPrincipal` is more private than the item `leak_dyn_nonprincipal`
- --> $DIR/private-in-public-non-principal.rs:13:1
+warning: trait `PrivNonPrincipal` is more private than the item `leak_dyn_nonprincipal`
+ --> $DIR/private-in-public-non-principal.rs:7:1
|
LL | pub fn leak_dyn_nonprincipal() -> Box<dyn PubPrincipal + PrivNonPrincipal> { loop {} }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `leak_dyn_nonprincipal` is reachable at visibility `pub`
|
note: but trait `PrivNonPrincipal` is only usable at visibility `pub(crate)`
- --> $DIR/private-in-public-non-principal.rs:11:1
+ --> $DIR/private-in-public-non-principal.rs:5:1
|
LL | auto trait PrivNonPrincipal {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: the lint level is defined here
- --> $DIR/private-in-public-non-principal.rs:4:9
- |
-LL | #![deny(private_interfaces)]
- | ^^^^^^^^^^^^^^^^^^
+ = note: `#[warn(private_interfaces)]` on by default
error: missing documentation for an associated function
- --> $DIR/private-in-public-non-principal.rs:21:9
+ --> $DIR/private-in-public-non-principal.rs:13:9
|
LL | pub fn check_doc_lint() {}
| ^^^^^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
- --> $DIR/private-in-public-non-principal.rs:18:8
+ --> $DIR/private-in-public-non-principal.rs:10:8
|
LL | #[deny(missing_docs)]
| ^^^^^^^^^^^^
-error: aborting due to 2 previous errors; 1 warning emitted
+error: aborting due to previous error; 1 warning emitted
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 fe6ed4673..3fb543e96 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,7 +1,7 @@
// build-pass (FIXME(62277): could be check-pass?)
#![feature(impl_trait_in_assoc_type)]
#![feature(type_alias_impl_trait)]
-#![deny(private_in_public)]
+#![deny(private_interfaces, private_bounds)]
pub type Pub = impl Default;
diff --git a/tests/ui/privacy/private-in-public-warn.rs b/tests/ui/privacy/private-in-public-warn.rs
index 0fa1de975..99d318e36 100644
--- a/tests/ui/privacy/private-in-public-warn.rs
+++ b/tests/ui/privacy/private-in-public-warn.rs
@@ -2,7 +2,7 @@
// This test also ensures that the checks are performed even inside private modules.
#![feature(associated_type_defaults)]
-#![deny(private_in_public)]
+#![deny(private_interfaces, private_bounds)]
#![allow(improper_ctypes)]
mod types {
@@ -12,30 +12,21 @@ mod types {
type Alias;
}
- pub type Alias = Priv; //~ ERROR private type `types::Priv` in public interface
- //~^ WARNING hard error
+ pub type Alias = Priv; //~ ERROR type `types::Priv` is more private than the item `types::Alias`
pub enum E {
- V1(Priv), //~ ERROR private type `types::Priv` in public interface
- //~^ WARNING hard error
- V2 { field: Priv }, //~ ERROR private type `types::Priv` in public interface
- //~^ WARNING hard error
+ V1(Priv), //~ ERROR type `types::Priv` is more private than the item `E::V1::0`
+ V2 { field: Priv }, //~ ERROR type `types::Priv` is more private than the item `E::V2::field`
}
pub trait Tr {
- const C: Priv = Priv; //~ ERROR private type `types::Priv` in public interface
- //~^ WARNING hard error
+ const C: Priv = Priv; //~ ERROR type `types::Priv` is more private than the item `Tr::C`
type Alias = Priv; //~ ERROR private type `types::Priv` in public interface
- fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public interface
- //~^ WARNING hard error
- fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` in public interface
- //~^ WARNING hard error
+ fn f1(arg: Priv) {} //~ ERROR type `types::Priv` is more private than the item `Tr::f1`
+ fn f2() -> Priv { panic!() } //~ ERROR type `types::Priv` is more private than the item `Tr::f2`
}
extern "C" {
- pub static ES: Priv; //~ ERROR private type `types::Priv` in public interface
- //~^ WARNING hard error
- pub fn ef1(arg: Priv); //~ ERROR private type `types::Priv` in public interface
- //~^ WARNING hard error
- pub fn ef2() -> Priv; //~ ERROR private type `types::Priv` in public interface
- //~^ WARNING hard error
+ pub static ES: Priv; //~ ERROR type `types::Priv` is more private than the item `types::ES`
+ pub fn ef1(arg: Priv); //~ ERROR type `types::Priv` is more private than the item `types::ef1`
+ pub fn ef2() -> Priv; //~ ERROR type `types::Priv` is more private than the item `types::ef2`
}
impl PubTr for Pub {
type Alias = Priv; //~ ERROR private type `types::Priv` in public interface
@@ -47,22 +38,16 @@ mod traits {
pub struct Pub<T>(T);
pub trait PubTr {}
- pub type Alias<T: PrivTr> = T; //~ ERROR private trait `traits::PrivTr` in public interface
- //~| WARNING hard error
- //~| WARNING bounds on generic parameters are not enforced in type aliases
- pub trait Tr1: PrivTr {} //~ ERROR private trait `traits::PrivTr` in public interface
- //~^ WARNING hard error
- pub trait Tr2<T: PrivTr> {} //~ ERROR private trait `traits::PrivTr` in public interface
- //~^ WARNING hard error
+ pub type Alias<T: PrivTr> = T; //~ ERROR trait `traits::PrivTr` is more private than the item `traits::Alias`
+ //~^ WARNING bounds on generic parameters are not enforced in type aliases
+ pub trait Tr1: PrivTr {} //~ ERROR trait `traits::PrivTr` is more private than the item `traits::Tr1`
+ pub trait Tr2<T: PrivTr> {} //~ ERROR trait `traits::PrivTr` is more private than the item `traits::Tr2`
pub trait Tr3 {
type Alias: PrivTr;
- //~^ ERROR private trait `traits::PrivTr` in public interface
- //~| WARNING hard error
- fn f<T: PrivTr>(arg: T) {} //~ ERROR private trait `traits::PrivTr` in public interface
- //~^ WARNING hard error
+ //~^ ERROR trait `traits::PrivTr` is more private than the item `traits::Tr3::Alias`
+ fn f<T: PrivTr>(arg: T) {} //~ ERROR trait `traits::PrivTr` is more private than the item `traits::Tr3::f`
}
- impl<T: PrivTr> Pub<T> {} //~ ERROR private trait `traits::PrivTr` in public interface
- //~^ WARNING hard error
+ impl<T: PrivTr> Pub<T> {} //~ ERROR trait `traits::PrivTr` is more private than the item `traits::Pub<T>`
impl<T: PrivTr> PubTr for Pub<T> {} // OK, trait impl predicates
}
@@ -72,20 +57,16 @@ mod traits_where {
pub trait PubTr {}
pub type Alias<T> where T: PrivTr = T;
- //~^ ERROR private trait `traits_where::PrivTr` in public interface
- //~| WARNING hard error
+ //~^ ERROR trait `traits_where::PrivTr` is more private than the item `traits_where::Alias`
//~| WARNING where clauses are not enforced in type aliases
pub trait Tr2<T> where T: PrivTr {}
- //~^ ERROR private trait `traits_where::PrivTr` in public interface
- //~| WARNING hard error
+ //~^ ERROR trait `traits_where::PrivTr` is more private than the item `traits_where::Tr2`
pub trait Tr3 {
fn f<T>(arg: T) where T: PrivTr {}
- //~^ ERROR private trait `traits_where::PrivTr` in public interface
- //~| WARNING hard error
+ //~^ ERROR trait `traits_where::PrivTr` is more private than the item `traits_where::Tr3::f`
}
impl<T> Pub<T> where T: PrivTr {}
- //~^ ERROR private trait `traits_where::PrivTr` in public interface
- //~| WARNING hard error
+ //~^ ERROR trait `traits_where::PrivTr` is more private than the item `traits_where::Pub<T>`
impl<T> PubTr for Pub<T> where T: PrivTr {} // OK, trait impl predicates
}
@@ -96,14 +77,10 @@ mod generics {
pub trait PubTr<T> {}
pub trait Tr1: PrivTr<Pub> {}
- //~^ ERROR private trait `generics::PrivTr<generics::Pub>` in public interface
- //~| WARNING hard error
- pub trait Tr2: PubTr<Priv> {} //~ ERROR private type `generics::Priv` in public interface
- //~^ WARNING hard error
- pub trait Tr3: PubTr<[Priv; 1]> {} //~ ERROR private type `generics::Priv` in public interface
- //~^ WARNING hard error
- pub trait Tr4: PubTr<Pub<Priv>> {} //~ ERROR private type `generics::Priv` in public interface
- //~^ WARNING hard error
+ //~^ ERROR trait `generics::PrivTr<generics::Pub>` is more private than the item `generics::Tr1`
+ pub trait Tr2: PubTr<Priv> {} //~ ERROR type `generics::Priv` is more private than the item `generics::Tr2`
+ pub trait Tr3: PubTr<[Priv; 1]> {} //~ ERROR type `generics::Priv` is more private than the item `generics::Tr3`
+ pub trait Tr4: PubTr<Pub<Priv>> {} //~ ERROR type `generics::Priv` is more private than the item `Tr4`
}
mod impls {
@@ -200,8 +177,7 @@ mod aliases_pub {
pub trait Tr2: PrivUseAliasTr<PrivAlias> {} // OK
impl PrivAlias {
- pub fn f(arg: Priv) {} //~ ERROR private type `aliases_pub::Priv` in public interface
- //~^ WARNING hard error
+ pub fn f(arg: Priv) {} //~ ERROR type `aliases_pub::Priv` is more private than the item `aliases_pub::<impl Pub2>::f`
}
impl PrivUseAliasTr for PrivUseAlias {
type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface
@@ -244,13 +220,10 @@ mod aliases_priv {
}
pub trait Tr1: PrivUseAliasTr {}
- //~^ ERROR private trait `PrivTr1` in public interface
- //~| WARNING hard error
+ //~^ ERROR trait `PrivTr1` is more private than the item `aliases_priv::Tr1`
pub trait Tr2: PrivUseAliasTr<PrivAlias> {}
- //~^ ERROR private trait `PrivTr1<Priv2>` in public interface
- //~| WARNING hard error
- //~| ERROR private type `Priv2` in public interface
- //~| WARNING hard error
+ //~^ ERROR trait `PrivTr1<Priv2>` is more private than the item `aliases_priv::Tr2`
+ //~| ERROR type `Priv2` is more private than the item `aliases_priv::Tr2`
impl PrivUseAlias {
pub fn f(arg: Priv) {} // OK
diff --git a/tests/ui/privacy/private-in-public-warn.stderr b/tests/ui/privacy/private-in-public-warn.stderr
index 66f91ce6f..6497b7ff5 100644
--- a/tests/ui/privacy/private-in-public-warn.stderr
+++ b/tests/ui/privacy/private-in-public-warn.stderr
@@ -1,46 +1,58 @@
-error: private type `types::Priv` in public interface (error E0446)
+error: type `types::Priv` is more private than the item `types::Alias`
--> $DIR/private-in-public-warn.rs:15:5
|
LL | pub type Alias = Priv;
- | ^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^ type alias `types::Alias` is reachable at visibility `pub(crate)`
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:9:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
note: the lint level is defined here
--> $DIR/private-in-public-warn.rs:5:9
|
-LL | #![deny(private_in_public)]
- | ^^^^^^^^^^^^^^^^^
+LL | #![deny(private_interfaces, private_bounds)]
+ | ^^^^^^^^^^^^^^^^^^
-error: private type `types::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:18:12
+error: type `types::Priv` is more private than the item `E::V1::0`
+ --> $DIR/private-in-public-warn.rs:17:12
|
LL | V1(Priv),
- | ^^^^
+ | ^^^^ field `E::V1::0` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:9:5
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | struct Priv;
+ | ^^^^^^^^^^^
-error: private type `types::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:20:14
+error: type `types::Priv` is more private than the item `E::V2::field`
+ --> $DIR/private-in-public-warn.rs:18:14
|
LL | V2 { field: Priv },
- | ^^^^^^^^^^^
+ | ^^^^^^^^^^^ field `E::V2::field` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:9:5
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | struct Priv;
+ | ^^^^^^^^^^^
-error: private type `types::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:24:9
+error: type `types::Priv` is more private than the item `Tr::C`
+ --> $DIR/private-in-public-warn.rs:21:9
|
LL | const C: Priv = Priv;
- | ^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^ associated constant `Tr::C` is reachable at visibility `pub(crate)`
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:9:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
error[E0446]: private type `types::Priv` in public interface
- --> $DIR/private-in-public-warn.rs:26:9
+ --> $DIR/private-in-public-warn.rs:22:9
|
LL | struct Priv;
| ----------- `types::Priv` declared as private
@@ -48,53 +60,68 @@ LL | struct Priv;
LL | type Alias = Priv;
| ^^^^^^^^^^ can't leak private type
-error: private type `types::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:27:9
+error: type `types::Priv` is more private than the item `Tr::f1`
+ --> $DIR/private-in-public-warn.rs:23:9
|
LL | fn f1(arg: Priv) {}
- | ^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^ associated function `Tr::f1` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:9:5
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | struct Priv;
+ | ^^^^^^^^^^^
-error: private type `types::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:29:9
+error: type `types::Priv` is more private than the item `Tr::f2`
+ --> $DIR/private-in-public-warn.rs:24:9
|
LL | fn f2() -> Priv { panic!() }
- | ^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^ associated function `Tr::f2` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:9:5
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | struct Priv;
+ | ^^^^^^^^^^^
-error: private type `types::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:33:9
+error: type `types::Priv` is more private than the item `types::ES`
+ --> $DIR/private-in-public-warn.rs:27:9
|
LL | pub static ES: Priv;
- | ^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^ static `types::ES` is reachable at visibility `pub(crate)`
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:9:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
-error: private type `types::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:35:9
+error: type `types::Priv` is more private than the item `types::ef1`
+ --> $DIR/private-in-public-warn.rs:28:9
|
LL | pub fn ef1(arg: Priv);
- | ^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^ function `types::ef1` is reachable at visibility `pub(crate)`
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:9:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
-error: private type `types::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:37:9
+error: type `types::Priv` is more private than the item `types::ef2`
+ --> $DIR/private-in-public-warn.rs:29:9
|
LL | pub fn ef2() -> Priv;
- | ^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^ function `types::ef2` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:9:5
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | struct Priv;
+ | ^^^^^^^^^^^
error[E0446]: private type `types::Priv` in public interface
- --> $DIR/private-in-public-warn.rs:41:9
+ --> $DIR/private-in-public-warn.rs:32:9
|
LL | struct Priv;
| ----------- `types::Priv` declared as private
@@ -102,134 +129,181 @@ LL | struct Priv;
LL | type Alias = Priv;
| ^^^^^^^^^^ can't leak private type
-error: private trait `traits::PrivTr` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:50:5
+error: trait `traits::PrivTr` is more private than the item `traits::Alias`
+ --> $DIR/private-in-public-warn.rs:41:5
|
LL | pub type Alias<T: PrivTr> = T;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ type alias `traits::Alias` is reachable at visibility `pub(crate)`
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:37:5
+ |
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
+note: the lint level is defined here
+ --> $DIR/private-in-public-warn.rs:5:29
+ |
+LL | #![deny(private_interfaces, private_bounds)]
+ | ^^^^^^^^^^^^^^
-error: private trait `traits::PrivTr` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:53:5
+error: trait `traits::PrivTr` is more private than the item `traits::Tr1`
+ --> $DIR/private-in-public-warn.rs:43:5
|
LL | pub trait Tr1: PrivTr {}
- | ^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^ trait `traits::Tr1` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:37:5
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
-error: private trait `traits::PrivTr` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:55:5
+error: trait `traits::PrivTr` is more private than the item `traits::Tr2`
+ --> $DIR/private-in-public-warn.rs:44:5
|
LL | pub trait Tr2<T: PrivTr> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ trait `traits::Tr2` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:37:5
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
-error: private trait `traits::PrivTr` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:58:9
+error: trait `traits::PrivTr` is more private than the item `traits::Tr3::Alias`
+ --> $DIR/private-in-public-warn.rs:46:9
|
LL | type Alias: PrivTr;
- | ^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^ associated type `traits::Tr3::Alias` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:37:5
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
-error: private trait `traits::PrivTr` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:61:9
+error: trait `traits::PrivTr` is more private than the item `traits::Tr3::f`
+ --> $DIR/private-in-public-warn.rs:48:9
|
LL | fn f<T: PrivTr>(arg: T) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^ associated function `traits::Tr3::f` is reachable at visibility `pub(crate)`
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:37:5
+ |
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
-error: private trait `traits::PrivTr` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:64:5
+error: trait `traits::PrivTr` is more private than the item `traits::Pub<T>`
+ --> $DIR/private-in-public-warn.rs:50:5
|
LL | impl<T: PrivTr> Pub<T> {}
- | ^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^ implementation `traits::Pub<T>` is reachable at visibility `pub(crate)`
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:37:5
+ |
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
-error: private trait `traits_where::PrivTr` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:74:5
+error: trait `traits_where::PrivTr` is more private than the item `traits_where::Alias`
+ --> $DIR/private-in-public-warn.rs:59:5
|
LL | pub type Alias<T> where T: PrivTr = T;
- | ^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^ type alias `traits_where::Alias` is reachable at visibility `pub(crate)`
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:55:5
+ |
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
-error: private trait `traits_where::PrivTr` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:78:5
+error: trait `traits_where::PrivTr` is more private than the item `traits_where::Tr2`
+ --> $DIR/private-in-public-warn.rs:62:5
|
LL | pub trait Tr2<T> where T: PrivTr {}
- | ^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^ trait `traits_where::Tr2` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:55:5
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
-error: private trait `traits_where::PrivTr` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:82:9
+error: trait `traits_where::PrivTr` is more private than the item `traits_where::Tr3::f`
+ --> $DIR/private-in-public-warn.rs:65:9
|
LL | fn f<T>(arg: T) where T: PrivTr {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated function `traits_where::Tr3::f` is reachable at visibility `pub(crate)`
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:55:5
+ |
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
-error: private trait `traits_where::PrivTr` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:86:5
+error: trait `traits_where::PrivTr` is more private than the item `traits_where::Pub<T>`
+ --> $DIR/private-in-public-warn.rs:68:5
|
LL | impl<T> Pub<T> where T: PrivTr {}
- | ^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^ implementation `traits_where::Pub<T>` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:55:5
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
-error: private trait `generics::PrivTr<generics::Pub>` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:98:5
+error: trait `generics::PrivTr<generics::Pub>` is more private than the item `generics::Tr1`
+ --> $DIR/private-in-public-warn.rs:79:5
|
LL | pub trait Tr1: PrivTr<Pub> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `generics::Tr1` is reachable at visibility `pub(crate)`
+ |
+note: but trait `generics::PrivTr<generics::Pub>` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:76:5
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | trait PrivTr<T> {}
+ | ^^^^^^^^^^^^^^^
-error: private type `generics::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:101:5
+error: type `generics::Priv` is more private than the item `generics::Tr2`
+ --> $DIR/private-in-public-warn.rs:81:5
|
LL | pub trait Tr2: PubTr<Priv> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `generics::Tr2` is reachable at visibility `pub(crate)`
+ |
+note: but type `generics::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:74:5
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | struct Priv<T = u8>(T);
+ | ^^^^^^^^^^^^^^^^^^^
-error: private type `generics::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:103:5
+error: type `generics::Priv` is more private than the item `generics::Tr3`
+ --> $DIR/private-in-public-warn.rs:82:5
|
LL | pub trait Tr3: PubTr<[Priv; 1]> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `generics::Tr3` is reachable at visibility `pub(crate)`
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `generics::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:74:5
+ |
+LL | struct Priv<T = u8>(T);
+ | ^^^^^^^^^^^^^^^^^^^
-error: private type `generics::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:105:5
+error: type `generics::Priv` is more private than the item `Tr4`
+ --> $DIR/private-in-public-warn.rs:83:5
|
LL | pub trait Tr4: PubTr<Pub<Priv>> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `Tr4` is reachable at visibility `pub(crate)`
+ |
+note: but type `generics::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:74:5
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | struct Priv<T = u8>(T);
+ | ^^^^^^^^^^^^^^^^^^^
error[E0446]: private type `impls::Priv` in public interface
- --> $DIR/private-in-public-warn.rs:132:9
+ --> $DIR/private-in-public-warn.rs:109:9
|
LL | struct Priv;
| ----------- `impls::Priv` declared as private
@@ -237,17 +311,20 @@ LL | struct Priv;
LL | type Alias = Priv;
| ^^^^^^^^^^ can't leak private type
-error: private type `aliases_pub::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:203:9
+error: type `aliases_pub::Priv` is more private than the item `aliases_pub::<impl Pub2>::f`
+ --> $DIR/private-in-public-warn.rs:180:9
|
LL | pub fn f(arg: Priv) {}
- | ^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^ associated function `aliases_pub::<impl Pub2>::f` is reachable at visibility `pub(crate)`
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `aliases_pub::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:153:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
error[E0446]: private type `aliases_pub::Priv` in public interface
- --> $DIR/private-in-public-warn.rs:207:9
+ --> $DIR/private-in-public-warn.rs:183:9
|
LL | struct Priv;
| ----------- `aliases_pub::Priv` declared as private
@@ -256,7 +333,7 @@ LL | type Check = Priv;
| ^^^^^^^^^^ can't leak private type
error[E0446]: private type `aliases_pub::Priv` in public interface
- --> $DIR/private-in-public-warn.rs:210:9
+ --> $DIR/private-in-public-warn.rs:186:9
|
LL | struct Priv;
| ----------- `aliases_pub::Priv` declared as private
@@ -265,7 +342,7 @@ LL | type Check = Priv;
| ^^^^^^^^^^ can't leak private type
error[E0446]: private type `aliases_pub::Priv` in public interface
- --> $DIR/private-in-public-warn.rs:213:9
+ --> $DIR/private-in-public-warn.rs:189:9
|
LL | struct Priv;
| ----------- `aliases_pub::Priv` declared as private
@@ -274,7 +351,7 @@ LL | type Check = Priv;
| ^^^^^^^^^^ can't leak private type
error[E0446]: private type `aliases_pub::Priv` in public interface
- --> $DIR/private-in-public-warn.rs:216:9
+ --> $DIR/private-in-public-warn.rs:192:9
|
LL | struct Priv;
| ----------- `aliases_pub::Priv` declared as private
@@ -282,35 +359,44 @@ LL | struct Priv;
LL | type Check = Priv;
| ^^^^^^^^^^ can't leak private type
-error: private trait `PrivTr1` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:246:5
+error: trait `PrivTr1` is more private than the item `aliases_priv::Tr1`
+ --> $DIR/private-in-public-warn.rs:222:5
|
LL | pub trait Tr1: PrivUseAliasTr {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `aliases_priv::Tr1` is reachable at visibility `pub(crate)`
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but trait `PrivTr1` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:208:5
+ |
+LL | trait PrivTr1<T = u8> {
+ | ^^^^^^^^^^^^^^^^^^^^^
-error: private trait `PrivTr1<Priv2>` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:249:5
+error: trait `PrivTr1<Priv2>` is more private than the item `aliases_priv::Tr2`
+ --> $DIR/private-in-public-warn.rs:224:5
|
LL | pub trait Tr2: PrivUseAliasTr<PrivAlias> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `aliases_priv::Tr2` is reachable at visibility `pub(crate)`
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but trait `PrivTr1<Priv2>` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:208:5
+ |
+LL | trait PrivTr1<T = u8> {
+ | ^^^^^^^^^^^^^^^^^^^^^
-error: private type `Priv2` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:249:5
+error: type `Priv2` is more private than the item `aliases_priv::Tr2`
+ --> $DIR/private-in-public-warn.rs:224:5
|
LL | pub trait Tr2: PrivUseAliasTr<PrivAlias> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `aliases_priv::Tr2` is reachable at visibility `pub(crate)`
+ |
+note: but type `Priv2` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:206:5
|
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | struct Priv2;
+ | ^^^^^^^^^^^^
warning: bounds on generic parameters are not enforced in type aliases
- --> $DIR/private-in-public-warn.rs:50:23
+ --> $DIR/private-in-public-warn.rs:41:23
|
LL | pub type Alias<T: PrivTr> = T;
| ^^^^^^
@@ -323,7 +409,7 @@ LL + pub type Alias<T> = T;
|
warning: where clauses are not enforced in type aliases
- --> $DIR/private-in-public-warn.rs:74:29
+ --> $DIR/private-in-public-warn.rs:59:29
|
LL | pub type Alias<T> where T: PrivTr = T;
| ^^^^^^^^^
diff --git a/tests/ui/privacy/private-in-public.rs b/tests/ui/privacy/private-in-public.rs
index dbd1c483f..f54f9e38f 100644
--- a/tests/ui/privacy/private-in-public.rs
+++ b/tests/ui/privacy/private-in-public.rs
@@ -1,3 +1,5 @@
+// check-pass
+
// Private types and traits are not allowed in public interfaces.
// This test also ensures that the checks are performed even inside private modules.
@@ -10,16 +12,16 @@ mod types {
type Alias;
}
- pub const C: Priv = Priv; //~ ERROR private type `types::Priv` in public interface
- pub static S: Priv = Priv; //~ ERROR private type `types::Priv` in public interface
- pub fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public interface
- pub fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` in public interface
- pub struct S1(pub Priv); //~ ERROR private type `types::Priv` in public interface
- pub struct S2 { pub field: Priv } //~ ERROR private type `types::Priv` in public interface
+ pub const C: Priv = Priv; //~ WARNING type `types::Priv` is more private than the item `C`
+ pub static S: Priv = Priv; //~ WARNING type `types::Priv` is more private than the item `S`
+ pub fn f1(arg: Priv) {} //~ WARNING `types::Priv` is more private than the item `types::f1`
+ pub fn f2() -> Priv { panic!() } //~ WARNING type `types::Priv` is more private than the item `types::f2`
+ pub struct S1(pub Priv); //~ WARNING type `types::Priv` is more private than the item `types::S1::0`
+ pub struct S2 { pub field: Priv } //~ WARNING `types::Priv` is more private than the item `S2::field`
impl Pub {
- pub const C: Priv = Priv; //~ ERROR private type `types::Priv` in public interface
- pub fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public interface
- pub fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` in public interface
+ pub const C: Priv = Priv; //~ WARNING type `types::Priv` is more private than the item `types::Pub::C`
+ pub fn f1(arg: Priv) {} //~ WARNING type `types::Priv` is more private than the item `types::Pub::f1`
+ pub fn f2() -> Priv { panic!() } //~ WARNING type `types::Priv` is more private than the item `types::Pub::f2`
}
}
@@ -28,11 +30,11 @@ mod traits {
pub struct Pub<T>(T);
pub trait PubTr {}
- pub enum E<T: PrivTr> { V(T) } //~ ERROR private trait `traits::PrivTr` in public interface
- pub fn f<T: PrivTr>(arg: T) {} //~ ERROR private trait `traits::PrivTr` in public interface
- pub struct S1<T: PrivTr>(T); //~ ERROR private trait `traits::PrivTr` in public interface
- impl<T: PrivTr> Pub<T> { //~ ERROR private trait `traits::PrivTr` in public interface
- pub fn f<U: PrivTr>(arg: U) {} //~ ERROR private trait `traits::PrivTr` in public interface
+ pub enum E<T: PrivTr> { V(T) } //~ WARNING trait `traits::PrivTr` is more private than the item `traits::E`
+ pub fn f<T: PrivTr>(arg: T) {} //~ WARNING trait `traits::PrivTr` is more private than the item `traits::f`
+ pub struct S1<T: PrivTr>(T); //~ WARNING trait `traits::PrivTr` is more private than the item `traits::S1`
+ impl<T: PrivTr> Pub<T> { //~ WARNING trait `traits::PrivTr` is more private than the item `traits::Pub<T>`
+ pub fn f<U: PrivTr>(arg: U) {} //~ WARNING trait `traits::PrivTr` is more private than the item `traits::Pub::<T>::f`
}
}
@@ -42,15 +44,15 @@ mod traits_where {
pub trait PubTr {}
pub enum E<T> where T: PrivTr { V(T) }
- //~^ ERROR private trait `traits_where::PrivTr` in public interface
+ //~^ WARNING trait `traits_where::PrivTr` is more private than the item `traits_where::E`
pub fn f<T>(arg: T) where T: PrivTr {}
- //~^ ERROR private trait `traits_where::PrivTr` in public interface
+ //~^ WARNING trait `traits_where::PrivTr` is more private than the item `traits_where::f`
pub struct S1<T>(T) where T: PrivTr;
- //~^ ERROR private trait `traits_where::PrivTr` in public interface
+ //~^ WARNING trait `traits_where::PrivTr` is more private than the item `traits_where::S1`
impl<T> Pub<T> where T: PrivTr {
- //~^ ERROR private trait `traits_where::PrivTr` in public interface
+ //~^ WARNING trait `traits_where::PrivTr` is more private than the item `traits_where::Pub<T>`
pub fn f<U>(arg: U) where U: PrivTr {}
- //~^ ERROR private trait `traits_where::PrivTr` in public interface
+ //~^ WARNING trait `traits_where::PrivTr` is more private than the item `traits_where::Pub::<T>::f`
}
}
@@ -60,10 +62,10 @@ mod generics {
trait PrivTr<T> {}
pub trait PubTr<T> {}
- pub fn f1(arg: [Priv; 1]) {} //~ ERROR private type `generics::Priv` in public interface
- pub fn f2(arg: Pub<Priv>) {} //~ ERROR private type `generics::Priv` in public interface
+ pub fn f1(arg: [Priv; 1]) {} //~ WARNING type `generics::Priv` is more private than the item `generics::f1`
+ pub fn f2(arg: Pub<Priv>) {} //~ WARNING type `generics::Priv` is more private than the item `generics::f2`
pub fn f3(arg: Priv<Pub>) {}
- //~^ ERROR private type `generics::Priv<generics::Pub>` in public interface
+ //~^ WARNING type `generics::Priv<generics::Pub>` is more private than the item `generics::f3`
}
mod impls {
@@ -77,7 +79,7 @@ mod impls {
}
impl Pub {
- pub fn f(arg: Priv) {} //~ ERROR private type `impls::Priv` in public interface
+ pub fn f(arg: Priv) {} //~ WARNING type `impls::Priv` is more private than the item `impls::Pub::f`
}
}
@@ -102,11 +104,11 @@ mod aliases_pub {
// This should be OK, but associated type aliases are not substituted yet
pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
- //~^ ERROR private trait `aliases_pub::PrivTr` in public interface
- //~| ERROR private type `aliases_pub::Priv` in public interface
+ //~^ WARNING trait `aliases_pub::PrivTr` is more private than the item `aliases_pub::f3`
+ //~| WARNING type `aliases_pub::Priv` is more private than the item `aliases_pub::f3`
impl PrivUseAlias {
- pub fn f(arg: Priv) {} //~ ERROR private type `aliases_pub::Priv` in public interface
+ pub fn f(arg: Priv) {}
}
}
@@ -128,11 +130,11 @@ mod aliases_priv {
}
impl PrivTr for Priv {}
- pub fn f1(arg: PrivUseAlias) {} //~ ERROR private type `Priv1` in public interface
- pub fn f2(arg: PrivAlias) {} //~ ERROR private type `Priv2` in public interface
+ pub fn f1(arg: PrivUseAlias) {} //~ WARNING type `Priv1` is more private than the item `aliases_priv::f1`
+ pub fn f2(arg: PrivAlias) {} //~ WARNING type `Priv2` is more private than the item `aliases_priv::f2`
pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
- //~^ ERROR private trait `aliases_priv::PrivTr` in public interface
- //~| ERROR private type `aliases_priv::Priv` in public interface
+ //~^ WARNING trait `aliases_priv::PrivTr` is more private than the item `aliases_priv::f3`
+ //~| WARNING type `aliases_priv::Priv` is more private than the item `aliases_priv::f3`
}
mod aliases_params {
@@ -141,8 +143,8 @@ mod aliases_params {
type Result<T> = ::std::result::Result<T, Priv>;
pub fn f2(arg: PrivAliasGeneric) {}
- //~^ ERROR private type `aliases_params::Priv` in public interface
- pub fn f3(arg: Result<u8>) {} //~ ERROR private type `aliases_params::Priv` in public interface
+ //~^ WARNING type `aliases_params::Priv` is more private than the item `aliases_params::f2`
+ pub fn f3(arg: Result<u8>) {} //~ WARNING type `aliases_params::Priv` is more private than the item `aliases_params::f3`
}
fn main() {}
diff --git a/tests/ui/privacy/private-in-public.stderr b/tests/ui/privacy/private-in-public.stderr
index 887eebf53..d8f9fd007 100644
--- a/tests/ui/privacy/private-in-public.stderr
+++ b/tests/ui/privacy/private-in-public.stderr
@@ -1,292 +1,376 @@
-error[E0446]: private type `types::Priv` in public interface
- --> $DIR/private-in-public.rs:13:5
+warning: type `types::Priv` is more private than the item `C`
+ --> $DIR/private-in-public.rs:15:5
|
-LL | struct Priv;
- | ----------- `types::Priv` declared as private
-...
LL | pub const C: Priv = Priv;
- | ^^^^^^^^^^^^^^^^^ can't leak private type
-
-error[E0446]: private type `types::Priv` in public interface
- --> $DIR/private-in-public.rs:14:5
+ | ^^^^^^^^^^^^^^^^^ constant `C` is reachable at visibility `pub(crate)`
|
-LL | struct Priv;
- | ----------- `types::Priv` declared as private
-...
-LL | pub static S: Priv = Priv;
- | ^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error[E0446]: private type `types::Priv` in public interface
- --> $DIR/private-in-public.rs:15:5
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:9:5
|
LL | struct Priv;
- | ----------- `types::Priv` declared as private
-...
-LL | pub fn f1(arg: Priv) {}
- | ^^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^
+ = note: `#[warn(private_interfaces)]` on by default
-error[E0446]: private type `types::Priv` in public interface
+warning: type `types::Priv` is more private than the item `S`
--> $DIR/private-in-public.rs:16:5
|
+LL | pub static S: Priv = Priv;
+ | ^^^^^^^^^^^^^^^^^^ static `S` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:9:5
+ |
LL | struct Priv;
- | ----------- `types::Priv` declared as private
-...
-LL | pub fn f2() -> Priv { panic!() }
- | ^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^
-error[E0446]: private type `types::Priv` in public interface
- --> $DIR/private-in-public.rs:17:19
+warning: type `types::Priv` is more private than the item `types::f1`
+ --> $DIR/private-in-public.rs:17:5
+ |
+LL | pub fn f1(arg: Priv) {}
+ | ^^^^^^^^^^^^^^^^^^^^ function `types::f1` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:9:5
|
LL | struct Priv;
- | ----------- `types::Priv` declared as private
-...
-LL | pub struct S1(pub Priv);
- | ^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^
-error[E0446]: private type `types::Priv` in public interface
- --> $DIR/private-in-public.rs:18:21
+warning: type `types::Priv` is more private than the item `types::f2`
+ --> $DIR/private-in-public.rs:18:5
+ |
+LL | pub fn f2() -> Priv { panic!() }
+ | ^^^^^^^^^^^^^^^^^^^ function `types::f2` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:9:5
|
LL | struct Priv;
- | ----------- `types::Priv` declared as private
-...
-LL | pub struct S2 { pub field: Priv }
- | ^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^
-error[E0446]: private type `types::Priv` in public interface
- --> $DIR/private-in-public.rs:20:9
+warning: type `types::Priv` is more private than the item `types::S1::0`
+ --> $DIR/private-in-public.rs:19:19
+ |
+LL | pub struct S1(pub Priv);
+ | ^^^^^^^^ field `types::S1::0` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:9:5
|
LL | struct Priv;
- | ----------- `types::Priv` declared as private
-...
-LL | pub const C: Priv = Priv;
- | ^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^
-error[E0446]: private type `types::Priv` in public interface
- --> $DIR/private-in-public.rs:21:9
+warning: type `types::Priv` is more private than the item `S2::field`
+ --> $DIR/private-in-public.rs:20:21
+ |
+LL | pub struct S2 { pub field: Priv }
+ | ^^^^^^^^^^^^^^^ field `S2::field` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:9:5
|
LL | struct Priv;
- | ----------- `types::Priv` declared as private
-...
-LL | pub fn f1(arg: Priv) {}
- | ^^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^
-error[E0446]: private type `types::Priv` in public interface
+warning: type `types::Priv` is more private than the item `types::Pub::C`
--> $DIR/private-in-public.rs:22:9
|
+LL | pub const C: Priv = Priv;
+ | ^^^^^^^^^^^^^^^^^ associated constant `types::Pub::C` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:9:5
+ |
LL | struct Priv;
- | ----------- `types::Priv` declared as private
-...
-LL | pub fn f2() -> Priv { panic!() }
- | ^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^
-error[E0445]: private trait `traits::PrivTr` in public interface
- --> $DIR/private-in-public.rs:31:5
+warning: type `types::Priv` is more private than the item `types::Pub::f1`
+ --> $DIR/private-in-public.rs:23:9
|
-LL | trait PrivTr {}
- | ------------ `traits::PrivTr` declared as private
-...
-LL | pub enum E<T: PrivTr> { V(T) }
- | ^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+LL | pub fn f1(arg: Priv) {}
+ | ^^^^^^^^^^^^^^^^^^^^ associated function `types::Pub::f1` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:9:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
-error[E0445]: private trait `traits::PrivTr` in public interface
- --> $DIR/private-in-public.rs:32:5
+warning: type `types::Priv` is more private than the item `types::Pub::f2`
+ --> $DIR/private-in-public.rs:24:9
|
-LL | trait PrivTr {}
- | ------------ `traits::PrivTr` declared as private
-...
-LL | pub fn f<T: PrivTr>(arg: T) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+LL | pub fn f2() -> Priv { panic!() }
+ | ^^^^^^^^^^^^^^^^^^^ associated function `types::Pub::f2` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:9:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
-error[E0445]: private trait `traits::PrivTr` in public interface
+warning: trait `traits::PrivTr` is more private than the item `traits::E`
--> $DIR/private-in-public.rs:33:5
|
+LL | pub enum E<T: PrivTr> { V(T) }
+ | ^^^^^^^^^^^^^^^^^^^^^ enum `traits::E` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:29:5
+ |
LL | trait PrivTr {}
- | ------------ `traits::PrivTr` declared as private
-...
-LL | pub struct S1<T: PrivTr>(T);
- | ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+ | ^^^^^^^^^^^^
+ = note: `#[warn(private_bounds)]` on by default
-error[E0445]: private trait `traits::PrivTr` in public interface
+warning: trait `traits::PrivTr` is more private than the item `traits::f`
--> $DIR/private-in-public.rs:34:5
|
+LL | pub fn f<T: PrivTr>(arg: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `traits::f` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:29:5
+ |
LL | trait PrivTr {}
- | ------------ `traits::PrivTr` declared as private
-...
-LL | impl<T: PrivTr> Pub<T> {
- | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+ | ^^^^^^^^^^^^
-error[E0445]: private trait `traits::PrivTr` in public interface
- --> $DIR/private-in-public.rs:35:9
+warning: trait `traits::PrivTr` is more private than the item `traits::S1`
+ --> $DIR/private-in-public.rs:35:5
+ |
+LL | pub struct S1<T: PrivTr>(T);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ struct `traits::S1` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:29:5
|
LL | trait PrivTr {}
- | ------------ `traits::PrivTr` declared as private
-...
-LL | pub fn f<U: PrivTr>(arg: U) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+ | ^^^^^^^^^^^^
-error[E0445]: private trait `traits_where::PrivTr` in public interface
- --> $DIR/private-in-public.rs:44:5
+warning: trait `traits::PrivTr` is more private than the item `traits::Pub<T>`
+ --> $DIR/private-in-public.rs:36:5
+ |
+LL | impl<T: PrivTr> Pub<T> {
+ | ^^^^^^^^^^^^^^^^^^^^^^ implementation `traits::Pub<T>` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:29:5
|
LL | trait PrivTr {}
- | ------------ `traits_where::PrivTr` declared as private
-...
-LL | pub enum E<T> where T: PrivTr { V(T) }
- | ^^^^^^^^^^^^^ can't leak private trait
+ | ^^^^^^^^^^^^
-error[E0445]: private trait `traits_where::PrivTr` in public interface
+warning: trait `traits::PrivTr` is more private than the item `traits::Pub::<T>::f`
+ --> $DIR/private-in-public.rs:37:9
+ |
+LL | pub fn f<U: PrivTr>(arg: U) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated function `traits::Pub::<T>::f` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:29:5
+ |
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
+
+warning: trait `traits_where::PrivTr` is more private than the item `traits_where::E`
--> $DIR/private-in-public.rs:46:5
|
+LL | pub enum E<T> where T: PrivTr { V(T) }
+ | ^^^^^^^^^^^^^ enum `traits_where::E` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:42:5
+ |
LL | trait PrivTr {}
- | ------------ `traits_where::PrivTr` declared as private
-...
-LL | pub fn f<T>(arg: T) where T: PrivTr {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+ | ^^^^^^^^^^^^
-error[E0445]: private trait `traits_where::PrivTr` in public interface
+warning: trait `traits_where::PrivTr` is more private than the item `traits_where::f`
--> $DIR/private-in-public.rs:48:5
|
+LL | pub fn f<T>(arg: T) where T: PrivTr {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `traits_where::f` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:42:5
+ |
LL | trait PrivTr {}
- | ------------ `traits_where::PrivTr` declared as private
-...
-LL | pub struct S1<T>(T) where T: PrivTr;
- | ^^^^^^^^^^^^^^^^ can't leak private trait
+ | ^^^^^^^^^^^^
-error[E0445]: private trait `traits_where::PrivTr` in public interface
+warning: trait `traits_where::PrivTr` is more private than the item `traits_where::S1`
--> $DIR/private-in-public.rs:50:5
|
+LL | pub struct S1<T>(T) where T: PrivTr;
+ | ^^^^^^^^^^^^^^^^ struct `traits_where::S1` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:42:5
+ |
LL | trait PrivTr {}
- | ------------ `traits_where::PrivTr` declared as private
-...
-LL | impl<T> Pub<T> where T: PrivTr {
- | ^^^^^^^^^^^^^^ can't leak private trait
+ | ^^^^^^^^^^^^
-error[E0445]: private trait `traits_where::PrivTr` in public interface
- --> $DIR/private-in-public.rs:52:9
+warning: trait `traits_where::PrivTr` is more private than the item `traits_where::Pub<T>`
+ --> $DIR/private-in-public.rs:52:5
+ |
+LL | impl<T> Pub<T> where T: PrivTr {
+ | ^^^^^^^^^^^^^^ implementation `traits_where::Pub<T>` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:42:5
|
LL | trait PrivTr {}
- | ------------ `traits_where::PrivTr` declared as private
-...
+ | ^^^^^^^^^^^^
+
+warning: trait `traits_where::PrivTr` is more private than the item `traits_where::Pub::<T>::f`
+ --> $DIR/private-in-public.rs:54:9
+ |
LL | pub fn f<U>(arg: U) where U: PrivTr {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated function `traits_where::Pub::<T>::f` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:42:5
+ |
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
-error[E0446]: private type `generics::Priv` in public interface
- --> $DIR/private-in-public.rs:63:5
+warning: type `generics::Priv` is more private than the item `generics::f1`
+ --> $DIR/private-in-public.rs:65:5
|
-LL | struct Priv<T = u8>(T);
- | ------------------- `generics::Priv` declared as private
-...
LL | pub fn f1(arg: [Priv; 1]) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error[E0446]: private type `generics::Priv` in public interface
- --> $DIR/private-in-public.rs:64:5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ function `generics::f1` is reachable at visibility `pub(crate)`
+ |
+note: but type `generics::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:60:5
|
LL | struct Priv<T = u8>(T);
- | ------------------- `generics::Priv` declared as private
-...
-LL | pub fn f2(arg: Pub<Priv>) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^^^^^^^^^
-error[E0446]: private type `generics::Priv<generics::Pub>` in public interface
- --> $DIR/private-in-public.rs:65:5
+warning: type `generics::Priv` is more private than the item `generics::f2`
+ --> $DIR/private-in-public.rs:66:5
+ |
+LL | pub fn f2(arg: Pub<Priv>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ function `generics::f2` is reachable at visibility `pub(crate)`
+ |
+note: but type `generics::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:60:5
|
LL | struct Priv<T = u8>(T);
- | ------------------- `generics::Priv<generics::Pub>` declared as private
-...
+ | ^^^^^^^^^^^^^^^^^^^
+
+warning: type `generics::Priv<generics::Pub>` is more private than the item `generics::f3`
+ --> $DIR/private-in-public.rs:67:5
+ |
LL | pub fn f3(arg: Priv<Pub>) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ function `generics::f3` is reachable at visibility `pub(crate)`
+ |
+note: but type `generics::Priv<generics::Pub>` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:60:5
+ |
+LL | struct Priv<T = u8>(T);
+ | ^^^^^^^^^^^^^^^^^^^
-error[E0446]: private type `impls::Priv` in public interface
- --> $DIR/private-in-public.rs:80:9
+warning: type `impls::Priv` is more private than the item `impls::Pub::f`
+ --> $DIR/private-in-public.rs:82:9
|
-LL | struct Priv;
- | ----------- `impls::Priv` declared as private
-...
LL | pub fn f(arg: Priv) {}
- | ^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^^^^^^^^^ associated function `impls::Pub::f` is reachable at visibility `pub(crate)`
+ |
+note: but type `impls::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:72:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
-error[E0445]: private trait `aliases_pub::PrivTr` in public interface
- --> $DIR/private-in-public.rs:104:5
+warning: trait `aliases_pub::PrivTr` is more private than the item `aliases_pub::f3`
+ --> $DIR/private-in-public.rs:106:5
|
-LL | trait PrivTr {
- | ------------ `aliases_pub::PrivTr` declared as private
-...
LL | pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_pub::f3` is reachable at visibility `pub(crate)`
+ |
+note: but trait `aliases_pub::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:100:5
+ |
+LL | trait PrivTr {
+ | ^^^^^^^^^^^^
-error[E0446]: private type `aliases_pub::Priv` in public interface
- --> $DIR/private-in-public.rs:104:5
+warning: type `aliases_pub::Priv` is more private than the item `aliases_pub::f3`
+ --> $DIR/private-in-public.rs:106:5
|
-LL | struct Priv;
- | ----------- `aliases_pub::Priv` declared as private
-...
LL | pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error[E0446]: private type `aliases_pub::Priv` in public interface
- --> $DIR/private-in-public.rs:109:9
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_pub::f3` is reachable at visibility `pub(crate)`
+ |
+note: but type `aliases_pub::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:87:5
|
LL | struct Priv;
- | ----------- `aliases_pub::Priv` declared as private
-...
-LL | pub fn f(arg: Priv) {}
- | ^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^
-error[E0446]: private type `Priv1` in public interface
- --> $DIR/private-in-public.rs:131:5
+warning: type `Priv1` is more private than the item `aliases_priv::f1`
+ --> $DIR/private-in-public.rs:133:5
|
-LL | struct Priv1;
- | ------------ `Priv1` declared as private
-...
LL | pub fn f1(arg: PrivUseAlias) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_priv::f1` is reachable at visibility `pub(crate)`
+ |
+note: but type `Priv1` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:118:5
+ |
+LL | struct Priv1;
+ | ^^^^^^^^^^^^
-error[E0446]: private type `Priv2` in public interface
- --> $DIR/private-in-public.rs:132:5
+warning: type `Priv2` is more private than the item `aliases_priv::f2`
+ --> $DIR/private-in-public.rs:134:5
|
-LL | struct Priv2;
- | ------------ `Priv2` declared as private
-...
LL | pub fn f2(arg: PrivAlias) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_priv::f2` is reachable at visibility `pub(crate)`
+ |
+note: but type `Priv2` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:119:5
+ |
+LL | struct Priv2;
+ | ^^^^^^^^^^^^
-error[E0445]: private trait `aliases_priv::PrivTr` in public interface
- --> $DIR/private-in-public.rs:133:5
+warning: trait `aliases_priv::PrivTr` is more private than the item `aliases_priv::f3`
+ --> $DIR/private-in-public.rs:135:5
|
-LL | trait PrivTr {
- | ------------ `aliases_priv::PrivTr` declared as private
-...
LL | pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_priv::f3` is reachable at visibility `pub(crate)`
+ |
+note: but trait `aliases_priv::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:128:5
+ |
+LL | trait PrivTr {
+ | ^^^^^^^^^^^^
-error[E0446]: private type `aliases_priv::Priv` in public interface
- --> $DIR/private-in-public.rs:133:5
+warning: type `aliases_priv::Priv` is more private than the item `aliases_priv::f3`
+ --> $DIR/private-in-public.rs:135:5
|
-LL | struct Priv;
- | ----------- `aliases_priv::Priv` declared as private
-...
LL | pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error[E0446]: private type `aliases_params::Priv` in public interface
- --> $DIR/private-in-public.rs:143:5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_priv::f3` is reachable at visibility `pub(crate)`
+ |
+note: but type `aliases_priv::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:116:5
|
LL | struct Priv;
- | ----------- `aliases_params::Priv` declared as private
-...
-LL | pub fn f2(arg: PrivAliasGeneric) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^
-error[E0446]: private type `aliases_params::Priv` in public interface
+warning: type `aliases_params::Priv` is more private than the item `aliases_params::f2`
--> $DIR/private-in-public.rs:145:5
|
+LL | pub fn f2(arg: PrivAliasGeneric) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_params::f2` is reachable at visibility `pub(crate)`
+ |
+note: but type `aliases_params::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:141:5
+ |
LL | struct Priv;
- | ----------- `aliases_params::Priv` declared as private
-...
+ | ^^^^^^^^^^^
+
+warning: type `aliases_params::Priv` is more private than the item `aliases_params::f3`
+ --> $DIR/private-in-public.rs:147:5
+ |
LL | pub fn f3(arg: Result<u8>) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_params::f3` is reachable at visibility `pub(crate)`
+ |
+note: but type `aliases_params::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:141:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
-error: aborting due to 32 previous errors
+warning: 31 warnings emitted
-Some errors have detailed explanations: E0445, E0446.
-For more information about an error, try `rustc --explain E0445`.
diff --git a/tests/ui/privacy/private-inferred-type-2.rs b/tests/ui/privacy/private-inferred-type-2.rs
index 15b263b38..1c4c52bea 100644
--- a/tests/ui/privacy/private-inferred-type-2.rs
+++ b/tests/ui/privacy/private-inferred-type-2.rs
@@ -1,4 +1,5 @@
// aux-build:private-inferred-type.rs
+#![allow(private_interfaces)]
extern crate private_inferred_type as ext;
diff --git a/tests/ui/privacy/private-inferred-type-2.stderr b/tests/ui/privacy/private-inferred-type-2.stderr
index 3a0fc03b4..8a905f5d8 100644
--- a/tests/ui/privacy/private-inferred-type-2.stderr
+++ b/tests/ui/privacy/private-inferred-type-2.stderr
@@ -1,17 +1,17 @@
error: type `Priv` is private
- --> $DIR/private-inferred-type-2.rs:16:5
+ --> $DIR/private-inferred-type-2.rs:17:5
|
LL | m::Pub::get_priv;
| ^^^^^^^^^^^^^^^^ private type
error: type `Priv` is private
- --> $DIR/private-inferred-type-2.rs:17:5
+ --> $DIR/private-inferred-type-2.rs:18:5
|
LL | m::Pub::static_method;
| ^^^^^^^^^^^^^^^^^^^^^ private type
error: type `ext::Priv` is private
- --> $DIR/private-inferred-type-2.rs:18:5
+ --> $DIR/private-inferred-type-2.rs:19:5
|
LL | ext::Pub::static_method;
| ^^^^^^^^^^^^^^^^^^^^^^^ private type
diff --git a/tests/ui/privacy/private-inferred-type.rs b/tests/ui/privacy/private-inferred-type.rs
index e8743dd96..8c07226fe 100644
--- a/tests/ui/privacy/private-inferred-type.rs
+++ b/tests/ui/privacy/private-inferred-type.rs
@@ -1,5 +1,5 @@
#![feature(decl_macro)]
-#![allow(private_in_public)]
+#![allow(private_interfaces)]
mod m {
fn priv_fn() {}
diff --git a/tests/ui/privacy/private-type-in-interface.rs b/tests/ui/privacy/private-type-in-interface.rs
index 7fbdbaf5f..39e0bf23c 100644
--- a/tests/ui/privacy/private-type-in-interface.rs
+++ b/tests/ui/privacy/private-type-in-interface.rs
@@ -1,6 +1,7 @@
// aux-build:private-inferred-type.rs
#![allow(warnings)]
+#![allow(private_interfaces)]
extern crate private_inferred_type as ext;
diff --git a/tests/ui/privacy/private-type-in-interface.stderr b/tests/ui/privacy/private-type-in-interface.stderr
index 4e87caa34..03225d84f 100644
--- a/tests/ui/privacy/private-type-in-interface.stderr
+++ b/tests/ui/privacy/private-type-in-interface.stderr
@@ -1,53 +1,53 @@
error: type `Priv` is private
- --> $DIR/private-type-in-interface.rs:15:9
+ --> $DIR/private-type-in-interface.rs:16:9
|
LL | fn f(_: m::Alias) {}
| ^^^^^^^^ private type
error: type `Priv` is private
- --> $DIR/private-type-in-interface.rs:15:6
+ --> $DIR/private-type-in-interface.rs:16:6
|
LL | fn f(_: m::Alias) {}
| ^ private type
error: type `ext::Priv` is private
- --> $DIR/private-type-in-interface.rs:17:13
+ --> $DIR/private-type-in-interface.rs:18:13
|
LL | fn f_ext(_: ext::Alias) {}
| ^^^^^^^^^^ private type
error: type `ext::Priv` is private
- --> $DIR/private-type-in-interface.rs:17:10
+ --> $DIR/private-type-in-interface.rs:18:10
|
LL | fn f_ext(_: ext::Alias) {}
| ^ private type
error: type `Priv` is private
- --> $DIR/private-type-in-interface.rs:21:6
+ --> $DIR/private-type-in-interface.rs:22:6
|
LL | impl m::Alias {}
| ^^^^^^^^ private type
error: type `ext::Priv` is private
- --> $DIR/private-type-in-interface.rs:22:14
+ --> $DIR/private-type-in-interface.rs:23:14
|
LL | impl Tr1 for ext::Alias {}
| ^^^^^^^^^^ private type
error: type `Priv` is private
- --> $DIR/private-type-in-interface.rs:23:10
+ --> $DIR/private-type-in-interface.rs:24:10
|
LL | type A = <m::Alias as m::Trait>::X;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ private type
error: type `Priv` is private
- --> $DIR/private-type-in-interface.rs:27:11
+ --> $DIR/private-type-in-interface.rs:28:11
|
LL | fn g() -> impl Tr2<m::Alias> { 0 }
| ^^^^^^^^^^^^^^^^^^ private type
error: type `ext::Priv` is private
- --> $DIR/private-type-in-interface.rs:28:15
+ --> $DIR/private-type-in-interface.rs:29:15
|
LL | fn g_ext() -> impl Tr2<ext::Alias> { 0 }
| ^^^^^^^^^^^^^^^^^^^^ private type
diff --git a/tests/ui/privacy/restricted/private-in-public.rs b/tests/ui/privacy/restricted/private-in-public.rs
index 1e3dbdf73..80a7e6ad0 100644
--- a/tests/ui/privacy/restricted/private-in-public.rs
+++ b/tests/ui/privacy/restricted/private-in-public.rs
@@ -1,10 +1,11 @@
+// check-pass
mod foo {
struct Priv;
mod bar {
use foo::Priv;
pub(super) fn f(_: Priv) {}
- pub(crate) fn g(_: Priv) {} //~ ERROR E0446
- pub(crate) fn h(_: Priv) {} //~ ERROR E0446
+ pub(crate) fn g(_: Priv) {}
+ pub(crate) fn h(_: Priv) {}
}
}
diff --git a/tests/ui/privacy/restricted/private-in-public.stderr b/tests/ui/privacy/restricted/private-in-public.stderr
deleted file mode 100644
index 65d996f0f..000000000
--- a/tests/ui/privacy/restricted/private-in-public.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0446]: private type `Priv` in public interface
- --> $DIR/private-in-public.rs:6:9
- |
-LL | struct Priv;
- | ----------- `Priv` declared as private
-...
-LL | pub(crate) fn g(_: Priv) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error[E0446]: private type `Priv` in public interface
- --> $DIR/private-in-public.rs:7:9
- |
-LL | struct Priv;
- | ----------- `Priv` declared as private
-...
-LL | pub(crate) fn h(_: Priv) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/privacy/unnameable_types.rs b/tests/ui/privacy/unnameable_types.rs
index 46e249152..c6c5561c3 100644
--- a/tests/ui/privacy/unnameable_types.rs
+++ b/tests/ui/privacy/unnameable_types.rs
@@ -1,5 +1,4 @@
#![feature(type_privacy_lints)]
-#![allow(private_in_public)]
#![deny(unnameable_types)]
mod m {
@@ -21,10 +20,10 @@ mod m {
}
}
-pub trait Voldemort<T> {}
+pub trait Unnameable<T> {}
-impl Voldemort<m::PubStruct> for i32 {}
-impl Voldemort<m::PubE> for i32 {}
-impl<T> Voldemort<T> for u32 where T: m::PubTr {}
+impl Unnameable<m::PubStruct> for i32 {}
+impl Unnameable<m::PubE> for i32 {}
+impl<T> Unnameable<T> for u32 where T: m::PubTr {}
fn main() {}
diff --git a/tests/ui/privacy/unnameable_types.stderr b/tests/ui/privacy/unnameable_types.stderr
index 904127525..d68a11c97 100644
--- a/tests/ui/privacy/unnameable_types.stderr
+++ b/tests/ui/privacy/unnameable_types.stderr
@@ -1,23 +1,23 @@
error: struct `PubStruct` is reachable but cannot be named
- --> $DIR/unnameable_types.rs:6:5
+ --> $DIR/unnameable_types.rs:5:5
|
LL | pub struct PubStruct(pub i32);
| ^^^^^^^^^^^^^^^^^^^^ reachable at visibility `pub`, but can only be named at visibility `pub(crate)`
|
note: the lint level is defined here
- --> $DIR/unnameable_types.rs:3:9
+ --> $DIR/unnameable_types.rs:2:9
|
LL | #![deny(unnameable_types)]
| ^^^^^^^^^^^^^^^^
error: enum `PubE` is reachable but cannot be named
- --> $DIR/unnameable_types.rs:8:5
+ --> $DIR/unnameable_types.rs:7:5
|
LL | pub enum PubE {
| ^^^^^^^^^^^^^ reachable at visibility `pub`, but can only be named at visibility `pub(crate)`
error: trait `PubTr` is reachable but cannot be named
- --> $DIR/unnameable_types.rs:12:5
+ --> $DIR/unnameable_types.rs:11:5
|
LL | pub trait PubTr {
| ^^^^^^^^^^^^^^^ reachable at visibility `pub`, but can only be named at visibility `pub(crate)`
diff --git a/tests/ui/privacy/where-priv-type.rs b/tests/ui/privacy/where-priv-type.rs
index 2e0a6b3e7..cd9cce7ec 100644
--- a/tests/ui/privacy/where-priv-type.rs
+++ b/tests/ui/privacy/where-priv-type.rs
@@ -3,14 +3,7 @@
#![crate_type = "lib"]
#![feature(generic_const_exprs)]
-#![feature(type_privacy_lints)]
#![allow(incomplete_features)]
-#![warn(private_bounds)]
-#![warn(private_interfaces)]
-
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
struct PrivTy;
trait PrivTr {}
@@ -23,42 +16,33 @@ impl PubTrWithAssocTy for PrivTy { type AssocTy = PrivTy; }
pub struct S
-//~^ WARNING private type `PrivTy` in public interface
-//~| WARNING hard error
-//~| WARNING type `PrivTy` is more private than the item `S`
+//~^ WARNING type `PrivTy` is more private than the item `S`
where
PrivTy:
{}
pub enum E
-//~^ WARNING private type `PrivTy` in public interface
-//~| WARNING hard error
-//~| WARNING type `PrivTy` is more private than the item `E`
+//~^ WARNING type `PrivTy` is more private than the item `E`
where
PrivTy:
{}
pub fn f()
-//~^ WARNING private type `PrivTy` in public interface
-//~| WARNING hard error
-//~| WARNING type `PrivTy` is more private than the item `f`
+//~^ WARNING type `PrivTy` is more private than the item `f`
where
PrivTy:
{}
impl S
-//~^ ERROR private type `PrivTy` in public interface
-//~| WARNING type `PrivTy` is more private than the item `S`
+//~^ WARNING type `PrivTy` is more private than the item `S`
where
PrivTy:
{
pub fn f()
- //~^ WARNING private type `PrivTy` in public interface
- //~| WARNING hard error
- //~| WARNING type `PrivTy` is more private than the item `S::f`
+ //~^ WARNING type `PrivTy` is more private than the item `S::f`
where
PrivTy:
{}
@@ -90,7 +74,6 @@ where
{
type AssocTy = Const<{ my_const_fn(U) }>;
//~^ ERROR private type
- //~| WARNING type `fn(u8) -> u8 {my_const_fn}` is more private than the item `<Const<U> as Trait>::AssocTy`
fn assoc_fn() -> Self::AssocTy {
Const
}
diff --git a/tests/ui/privacy/where-priv-type.stderr b/tests/ui/privacy/where-priv-type.stderr
index d6baf22b3..dcc249c63 100644
--- a/tests/ui/privacy/where-priv-type.stderr
+++ b/tests/ui/privacy/where-priv-type.stderr
@@ -1,136 +1,72 @@
-warning: private type `PrivTy` in public interface (error E0446)
- --> $DIR/where-priv-type.rs:25:1
- |
-LL | pub struct S
- | ^^^^^^^^^^^^
- |
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
- = note: `#[warn(private_in_public)]` on by default
-
warning: type `PrivTy` is more private than the item `S`
- --> $DIR/where-priv-type.rs:25:1
+ --> $DIR/where-priv-type.rs:18:1
|
LL | pub struct S
| ^^^^^^^^^^^^ struct `S` is reachable at visibility `pub`
|
note: but type `PrivTy` is only usable at visibility `pub(crate)`
- --> $DIR/where-priv-type.rs:15:1
+ --> $DIR/where-priv-type.rs:8:1
|
LL | struct PrivTy;
| ^^^^^^^^^^^^^
-note: the lint level is defined here
- --> $DIR/where-priv-type.rs:8:9
- |
-LL | #![warn(private_bounds)]
- | ^^^^^^^^^^^^^^
-
-warning: private type `PrivTy` in public interface (error E0446)
- --> $DIR/where-priv-type.rs:34:1
- |
-LL | pub enum E
- | ^^^^^^^^^^
- |
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
+ = note: `#[warn(private_bounds)]` on by default
warning: type `PrivTy` is more private than the item `E`
- --> $DIR/where-priv-type.rs:34:1
+ --> $DIR/where-priv-type.rs:25:1
|
LL | pub enum E
| ^^^^^^^^^^ enum `E` is reachable at visibility `pub`
|
note: but type `PrivTy` is only usable at visibility `pub(crate)`
- --> $DIR/where-priv-type.rs:15:1
+ --> $DIR/where-priv-type.rs:8:1
|
LL | struct PrivTy;
| ^^^^^^^^^^^^^
-warning: private type `PrivTy` in public interface (error E0446)
- --> $DIR/where-priv-type.rs:43:1
- |
-LL | / pub fn f()
-LL | |
-LL | |
-LL | |
-LL | | where
-LL | | PrivTy:
- | |___________^
- |
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
-
warning: type `PrivTy` is more private than the item `f`
- --> $DIR/where-priv-type.rs:43:1
+ --> $DIR/where-priv-type.rs:32:1
|
LL | / pub fn f()
LL | |
-LL | |
-LL | |
LL | | where
LL | | PrivTy:
| |___________^ function `f` is reachable at visibility `pub`
|
note: but type `PrivTy` is only usable at visibility `pub(crate)`
- --> $DIR/where-priv-type.rs:15:1
+ --> $DIR/where-priv-type.rs:8:1
|
LL | struct PrivTy;
| ^^^^^^^^^^^^^
-error[E0446]: private type `PrivTy` in public interface
- --> $DIR/where-priv-type.rs:52:1
- |
-LL | struct PrivTy;
- | ------------- `PrivTy` declared as private
-...
-LL | impl S
- | ^^^^^^ can't leak private type
-
warning: type `PrivTy` is more private than the item `S`
- --> $DIR/where-priv-type.rs:52:1
+ --> $DIR/where-priv-type.rs:39:1
|
LL | impl S
| ^^^^^^ implementation `S` is reachable at visibility `pub`
|
note: but type `PrivTy` is only usable at visibility `pub(crate)`
- --> $DIR/where-priv-type.rs:15:1
+ --> $DIR/where-priv-type.rs:8:1
|
LL | struct PrivTy;
| ^^^^^^^^^^^^^
-warning: private type `PrivTy` in public interface (error E0446)
- --> $DIR/where-priv-type.rs:58:5
- |
-LL | / pub fn f()
-LL | |
-LL | |
-LL | |
-LL | | where
-LL | | PrivTy:
- | |_______________^
- |
- = 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 #34537 <https://github.com/rust-lang/rust/issues/34537>
-
warning: type `PrivTy` is more private than the item `S::f`
- --> $DIR/where-priv-type.rs:58:5
+ --> $DIR/where-priv-type.rs:44:5
|
LL | / pub fn f()
LL | |
-LL | |
-LL | |
LL | | where
LL | | PrivTy:
| |_______________^ associated function `S::f` is reachable at visibility `pub`
|
note: but type `PrivTy` is only usable at visibility `pub(crate)`
- --> $DIR/where-priv-type.rs:15:1
+ --> $DIR/where-priv-type.rs:8:1
|
LL | struct PrivTy;
| ^^^^^^^^^^^^^
error[E0446]: private type `fn(u8) -> u8 {my_const_fn}` in public interface
- --> $DIR/where-priv-type.rs:91:5
+ --> $DIR/where-priv-type.rs:75:5
|
LL | type AssocTy = Const<{ my_const_fn(U) }>;
| ^^^^^^^^^^^^ can't leak private type
@@ -138,23 +74,6 @@ LL | type AssocTy = Const<{ my_const_fn(U) }>;
LL | const fn my_const_fn(val: u8) -> u8 {
| ----------------------------------- `fn(u8) -> u8 {my_const_fn}` declared as private
-warning: type `fn(u8) -> u8 {my_const_fn}` is more private than the item `<Const<U> as Trait>::AssocTy`
- --> $DIR/where-priv-type.rs:91:5
- |
-LL | type AssocTy = Const<{ my_const_fn(U) }>;
- | ^^^^^^^^^^^^ associated type `<Const<U> as Trait>::AssocTy` is reachable at visibility `pub`
- |
-note: but type `fn(u8) -> u8 {my_const_fn}` is only usable at visibility `pub(crate)`
- --> $DIR/where-priv-type.rs:99:1
- |
-LL | const fn my_const_fn(val: u8) -> u8 {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: the lint level is defined here
- --> $DIR/where-priv-type.rs:9:9
- |
-LL | #![warn(private_interfaces)]
- | ^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors; 10 warnings emitted
+error: aborting due to previous error; 5 warnings emitted
For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/privacy/where-pub-type-impls-priv-trait.rs b/tests/ui/privacy/where-pub-type-impls-priv-trait.rs
index c59fdb7c7..d5e797b52 100644
--- a/tests/ui/privacy/where-pub-type-impls-priv-trait.rs
+++ b/tests/ui/privacy/where-pub-type-impls-priv-trait.rs
@@ -1,14 +1,10 @@
+// check-pass
+
// priv-in-pub lint tests where the private trait bounds a public type
#![crate_type = "lib"]
#![feature(generic_const_exprs)]
-#![feature(type_privacy_lints)]
#![allow(incomplete_features)]
-#![warn(private_bounds)]
-
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
struct PrivTy;
trait PrivTr {}
@@ -22,38 +18,33 @@ impl PubTrWithAssocTy for PrivTy { type AssocTy = PrivTy; }
pub struct S
-//~^ ERROR private trait `PrivTr` in public interface
-//~| WARNING trait `PrivTr` is more private than the item `S`
+//~^ WARNING trait `PrivTr` is more private than the item `S`
where
PubTy: PrivTr
{}
pub enum E
-//~^ ERROR private trait `PrivTr` in public interface
-//~| WARNING trait `PrivTr` is more private than the item `E`
+//~^ WARNING trait `PrivTr` is more private than the item `E`
where
PubTy: PrivTr
{}
pub fn f()
-//~^ ERROR private trait `PrivTr` in public interface
-//~| WARNING trait `PrivTr` is more private than the item `f`
+//~^ WARNING trait `PrivTr` is more private than the item `f`
where
PubTy: PrivTr
{}
impl S
-//~^ ERROR private trait `PrivTr` in public interface
-//~| WARNING trait `PrivTr` is more private than the item `S`
+//~^ WARNING trait `PrivTr` is more private than the item `S`
where
PubTy: PrivTr
{
pub fn f()
- //~^ ERROR private trait `PrivTr` in public interface
- //~| WARNING trait `PrivTr` is more private than the item `S::f`
+ //~^ WARNING trait `PrivTr` is more private than the item `S::f`
where
PubTy: PrivTr
{}
diff --git a/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr b/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr
index e2d7ce446..c47687433 100644
--- a/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr
+++ b/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr
@@ -1,129 +1,69 @@
-error[E0445]: private trait `PrivTr` in public interface
- --> $DIR/where-pub-type-impls-priv-trait.rs:24:1
- |
-LL | trait PrivTr {}
- | ------------ `PrivTr` declared as private
-...
-LL | pub struct S
- | ^^^^^^^^^^^^ can't leak private trait
-
warning: trait `PrivTr` is more private than the item `S`
- --> $DIR/where-pub-type-impls-priv-trait.rs:24:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:20:1
|
LL | pub struct S
| ^^^^^^^^^^^^ struct `S` is reachable at visibility `pub`
|
note: but trait `PrivTr` is only usable at visibility `pub(crate)`
- --> $DIR/where-pub-type-impls-priv-trait.rs:14:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
|
LL | trait PrivTr {}
| ^^^^^^^^^^^^
-note: the lint level is defined here
- --> $DIR/where-pub-type-impls-priv-trait.rs:7:9
- |
-LL | #![warn(private_bounds)]
- | ^^^^^^^^^^^^^^
-
-error[E0445]: private trait `PrivTr` in public interface
- --> $DIR/where-pub-type-impls-priv-trait.rs:32:1
- |
-LL | trait PrivTr {}
- | ------------ `PrivTr` declared as private
-...
-LL | pub enum E
- | ^^^^^^^^^^ can't leak private trait
+ = note: `#[warn(private_bounds)]` on by default
warning: trait `PrivTr` is more private than the item `E`
- --> $DIR/where-pub-type-impls-priv-trait.rs:32:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:27:1
|
LL | pub enum E
| ^^^^^^^^^^ enum `E` is reachable at visibility `pub`
|
note: but trait `PrivTr` is only usable at visibility `pub(crate)`
- --> $DIR/where-pub-type-impls-priv-trait.rs:14:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
|
LL | trait PrivTr {}
| ^^^^^^^^^^^^
-error[E0445]: private trait `PrivTr` in public interface
- --> $DIR/where-pub-type-impls-priv-trait.rs:40:1
- |
-LL | trait PrivTr {}
- | ------------ `PrivTr` declared as private
-...
-LL | / pub fn f()
-LL | |
-LL | |
-LL | | where
-LL | | PubTy: PrivTr
- | |_________________^ can't leak private trait
-
warning: trait `PrivTr` is more private than the item `f`
- --> $DIR/where-pub-type-impls-priv-trait.rs:40:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:34:1
|
LL | / pub fn f()
LL | |
-LL | |
LL | | where
LL | | PubTy: PrivTr
| |_________________^ function `f` is reachable at visibility `pub`
|
note: but trait `PrivTr` is only usable at visibility `pub(crate)`
- --> $DIR/where-pub-type-impls-priv-trait.rs:14:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
|
LL | trait PrivTr {}
| ^^^^^^^^^^^^
-error[E0445]: private trait `PrivTr` in public interface
- --> $DIR/where-pub-type-impls-priv-trait.rs:48:1
- |
-LL | trait PrivTr {}
- | ------------ `PrivTr` declared as private
-...
-LL | impl S
- | ^^^^^^ can't leak private trait
-
warning: trait `PrivTr` is more private than the item `S`
- --> $DIR/where-pub-type-impls-priv-trait.rs:48:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:41:1
|
LL | impl S
| ^^^^^^ implementation `S` is reachable at visibility `pub`
|
note: but trait `PrivTr` is only usable at visibility `pub(crate)`
- --> $DIR/where-pub-type-impls-priv-trait.rs:14:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
|
LL | trait PrivTr {}
| ^^^^^^^^^^^^
-error[E0445]: private trait `PrivTr` in public interface
- --> $DIR/where-pub-type-impls-priv-trait.rs:54:5
- |
-LL | trait PrivTr {}
- | ------------ `PrivTr` declared as private
-...
-LL | / pub fn f()
-LL | |
-LL | |
-LL | | where
-LL | | PubTy: PrivTr
- | |_____________________^ can't leak private trait
-
warning: trait `PrivTr` is more private than the item `S::f`
- --> $DIR/where-pub-type-impls-priv-trait.rs:54:5
+ --> $DIR/where-pub-type-impls-priv-trait.rs:46:5
|
LL | / pub fn f()
LL | |
-LL | |
LL | | where
LL | | PubTy: PrivTr
| |_____________________^ associated function `S::f` is reachable at visibility `pub`
|
note: but trait `PrivTr` is only usable at visibility `pub(crate)`
- --> $DIR/where-pub-type-impls-priv-trait.rs:14:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
|
LL | trait PrivTr {}
| ^^^^^^^^^^^^
-error: aborting due to 5 previous errors; 5 warnings emitted
+warning: 5 warnings emitted
-For more information about this error, try `rustc --explain E0445`.
diff --git a/tests/ui/proc-macro/allowed-signatures.rs b/tests/ui/proc-macro/allowed-signatures.rs
index 868508761..ce327901b 100644
--- a/tests/ui/proc-macro/allowed-signatures.rs
+++ b/tests/ui/proc-macro/allowed-signatures.rs
@@ -3,7 +3,7 @@
// no-prefer-dynamic
#![crate_type = "proc-macro"]
-#![allow(private_in_public)]
+#![allow(private_interfaces)]
extern crate proc_macro;
use proc_macro::TokenStream;
diff --git a/tests/ui/proc-macro/auxiliary/api/mod.rs b/tests/ui/proc-macro/auxiliary/api/mod.rs
index 739c25132..3bea5d757 100644
--- a/tests/ui/proc-macro/auxiliary/api/mod.rs
+++ b/tests/ui/proc-macro/auxiliary/api/mod.rs
@@ -4,6 +4,7 @@
#![crate_type = "proc-macro"]
#![crate_name = "proc_macro_api_tests"]
#![feature(proc_macro_span)]
+#![feature(proc_macro_byte_character)]
#![deny(dead_code)] // catch if a test function is never called
extern crate proc_macro;
diff --git a/tests/ui/proc-macro/auxiliary/api/parse.rs b/tests/ui/proc-macro/auxiliary/api/parse.rs
index 27391f831..07c9f4649 100644
--- a/tests/ui/proc-macro/auxiliary/api/parse.rs
+++ b/tests/ui/proc-macro/auxiliary/api/parse.rs
@@ -29,12 +29,16 @@ fn test_display_literal() {
assert_eq!(Literal::character('\'').to_string(), "'\\''");
assert_eq!(Literal::character('"').to_string(), "'\"'");
assert_eq!(Literal::character('\u{1}').to_string(), "'\\u{1}'");
+
+ assert_eq!(Literal::byte_character(b'a').to_string(), "b'a'");
+ assert_eq!(Literal::byte_character(0).to_string(), "b'\\x00'");
}
fn test_parse_literal() {
assert_eq!("1".parse::<Literal>().unwrap().to_string(), "1");
assert_eq!("1.0".parse::<Literal>().unwrap().to_string(), "1.0");
assert_eq!("'a'".parse::<Literal>().unwrap().to_string(), "'a'");
+ assert_eq!("b'a'".parse::<Literal>().unwrap().to_string(), "b'a'");
assert_eq!("\"\n\"".parse::<Literal>().unwrap().to_string(), "\"\n\"");
assert_eq!("b\"\"".parse::<Literal>().unwrap().to_string(), "b\"\"");
assert_eq!("r##\"\"##".parse::<Literal>().unwrap().to_string(), "r##\"\"##");
diff --git a/tests/ui/proc-macro/auxiliary/print-tokens.rs b/tests/ui/proc-macro/auxiliary/print-tokens.rs
new file mode 100644
index 000000000..3a5767edb
--- /dev/null
+++ b/tests/ui/proc-macro/auxiliary/print-tokens.rs
@@ -0,0 +1,16 @@
+// force-host
+// no-prefer-dynamic
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::{TokenStream, TokenTree};
+
+#[proc_macro]
+pub fn print_tokens(input: TokenStream) -> TokenStream {
+ println!("{:#?}", input);
+ for token in input {
+ println!("{token}");
+ }
+ TokenStream::new()
+}
diff --git a/tests/ui/proc-macro/bad-projection.stderr b/tests/ui/proc-macro/bad-projection.stderr
index 8a8246376..8716defa1 100644
--- a/tests/ui/proc-macro/bad-projection.stderr
+++ b/tests/ui/proc-macro/bad-projection.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `(): Project` is not satisfied
|
LL | pub fn uwu() -> <() as Project>::Assoc {}
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `Project` is not implemented for `()`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/bad-projection.rs:9:1
+ |
+LL | trait Project {
+ | ^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/proc-macro/literal-to-string.rs b/tests/ui/proc-macro/literal-to-string.rs
new file mode 100644
index 000000000..494d17cbe
--- /dev/null
+++ b/tests/ui/proc-macro/literal-to-string.rs
@@ -0,0 +1,26 @@
+// check-pass
+// edition: 2021
+#![feature(c_str_literals)]
+
+// aux-build: print-tokens.rs
+extern crate print_tokens;
+
+fn main() {
+ print_tokens::print_tokens! {
+ 1
+ 17u8
+ 42.
+ 3.14f32
+ b'a'
+ b'\xFF'
+ 'c'
+ '\x32'
+ "\"str\""
+ r#""raw" str"#
+ r###"very ##"raw"## str"###
+ b"\"byte\" str"
+ br#""raw" "byte" str"#
+ c"\"c\" str"
+ cr#""raw" "c" str"#
+ }
+}
diff --git a/tests/ui/proc-macro/literal-to-string.stdout b/tests/ui/proc-macro/literal-to-string.stdout
new file mode 100644
index 000000000..7b27fcf79
--- /dev/null
+++ b/tests/ui/proc-macro/literal-to-string.stdout
@@ -0,0 +1,107 @@
+TokenStream [
+ Literal {
+ kind: Integer,
+ symbol: "1",
+ suffix: None,
+ span: #0 bytes(172..173),
+ },
+ Literal {
+ kind: Integer,
+ symbol: "17",
+ suffix: Some("u8"),
+ span: #0 bytes(182..186),
+ },
+ Literal {
+ kind: Float,
+ symbol: "42.",
+ suffix: None,
+ span: #0 bytes(195..198),
+ },
+ Literal {
+ kind: Float,
+ symbol: "3.14",
+ suffix: Some("f32"),
+ span: #0 bytes(207..214),
+ },
+ Literal {
+ kind: Byte,
+ symbol: "a",
+ suffix: None,
+ span: #0 bytes(223..227),
+ },
+ Literal {
+ kind: Byte,
+ symbol: "\xFF",
+ suffix: None,
+ span: #0 bytes(236..243),
+ },
+ Literal {
+ kind: Char,
+ symbol: "c",
+ suffix: None,
+ span: #0 bytes(252..255),
+ },
+ Literal {
+ kind: Char,
+ symbol: "\x32",
+ suffix: None,
+ span: #0 bytes(264..270),
+ },
+ Literal {
+ kind: Str,
+ symbol: "\\"str\\"",
+ suffix: None,
+ span: #0 bytes(279..288),
+ },
+ Literal {
+ kind: StrRaw(1),
+ symbol: "\"raw\" str",
+ suffix: None,
+ span: #0 bytes(297..311),
+ },
+ Literal {
+ kind: StrRaw(3),
+ symbol: "very ##\"raw\"## str",
+ suffix: None,
+ span: #0 bytes(320..347),
+ },
+ Literal {
+ kind: ByteStr,
+ symbol: "\\"byte\\" str",
+ suffix: None,
+ span: #0 bytes(356..371),
+ },
+ Literal {
+ kind: ByteStrRaw(1),
+ symbol: "\"raw\" \"byte\" str",
+ suffix: None,
+ span: #0 bytes(380..402),
+ },
+ Literal {
+ kind: CStr,
+ symbol: "\\"c\\" str",
+ suffix: None,
+ span: #0 bytes(411..423),
+ },
+ Literal {
+ kind: CStrRaw(1),
+ symbol: "\"raw\" \"c\" str",
+ suffix: None,
+ span: #0 bytes(432..451),
+ },
+]
+1
+17u8
+42.
+3.14f32
+b'a'
+b'\xFF'
+'c'
+'\x32'
+"\"str\""
+r#""raw" str"#
+r###"very ##"raw"## str"###
+b"\"byte\" str"
+br#""raw" "byte" str"#
+c"\"c\" str"
+cr#""raw" "c" str"#
diff --git a/tests/ui/pub/issue-33174-restricted-type-in-public-interface.rs b/tests/ui/pub/issue-33174-restricted-type-in-public-interface.rs
index cdeea6224..7930964c8 100644
--- a/tests/ui/pub/issue-33174-restricted-type-in-public-interface.rs
+++ b/tests/ui/pub/issue-33174-restricted-type-in-public-interface.rs
@@ -1,44 +1,24 @@
-#![feature(type_privacy_lints)]
-#![allow(non_camel_case_types)] // genus is always capitalized
-#![warn(private_interfaces)]
-//~^ NOTE the lint level is defined here
+// check-pass
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
+#![allow(non_camel_case_types)] // genus is always capitalized
pub(crate) struct Snail;
-//~^ NOTE `Snail` declared as private
-//~| NOTE but type `Snail` is only usable at visibility `pub(crate)`
mod sea {
pub(super) struct Turtle;
- //~^ NOTE `Turtle` declared as crate-private
- //~| NOTE but type `Turtle` is only usable at visibility `pub(crate)`
}
struct Tortoise;
-//~^ NOTE `Tortoise` declared as private
-//~| NOTE but type `Tortoise` is only usable at visibility `pub(crate)`
pub struct Shell<T> {
pub(crate) creature: T,
}
pub type Helix_pomatia = Shell<Snail>;
-//~^ ERROR private type `Snail` in public interface
-//~| WARNING type `Snail` is more private than the item `Helix_pomatia`
-//~| NOTE can't leak private type
-//~| NOTE type alias `Helix_pomatia` is reachable at visibility `pub`
+//~^ WARNING type `Snail` is more private than the item `Helix_pomatia`
pub type Dermochelys_coriacea = Shell<sea::Turtle>;
-//~^ ERROR crate-private type `Turtle` in public interface
-//~| WARNING type `Turtle` is more private than the item `Dermochelys_coriacea`
-//~| NOTE can't leak crate-private type
-//~| NOTE type alias `Dermochelys_coriacea` is reachable at visibility `pub`
+//~^ WARNING type `Turtle` is more private than the item `Dermochelys_coriacea`
pub type Testudo_graeca = Shell<Tortoise>;
-//~^ ERROR private type `Tortoise` in public interface
-//~| WARNING type `Tortoise` is more private than the item `Testudo_graeca`
-//~| NOTE can't leak private type
-//~| NOTE type alias `Testudo_graeca` is reachable at visibility `pub`
+//~^ WARNING type `Tortoise` is more private than the item `Testudo_graeca`
fn main() {}
diff --git a/tests/ui/pub/issue-33174-restricted-type-in-public-interface.stderr b/tests/ui/pub/issue-33174-restricted-type-in-public-interface.stderr
index 20e51e190..26dfa2e7d 100644
--- a/tests/ui/pub/issue-33174-restricted-type-in-public-interface.stderr
+++ b/tests/ui/pub/issue-33174-restricted-type-in-public-interface.stderr
@@ -1,71 +1,39 @@
-error[E0446]: private type `Snail` in public interface
- --> $DIR/issue-33174-restricted-type-in-public-interface.rs:28:1
- |
-LL | pub(crate) struct Snail;
- | ----------------------- `Snail` declared as private
-...
-LL | pub type Helix_pomatia = Shell<Snail>;
- | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
-
warning: type `Snail` is more private than the item `Helix_pomatia`
- --> $DIR/issue-33174-restricted-type-in-public-interface.rs:28:1
+ --> $DIR/issue-33174-restricted-type-in-public-interface.rs:17:1
|
LL | pub type Helix_pomatia = Shell<Snail>;
| ^^^^^^^^^^^^^^^^^^^^^^ type alias `Helix_pomatia` is reachable at visibility `pub`
|
note: but type `Snail` is only usable at visibility `pub(crate)`
- --> $DIR/issue-33174-restricted-type-in-public-interface.rs:10:1
+ --> $DIR/issue-33174-restricted-type-in-public-interface.rs:5:1
|
LL | pub(crate) struct Snail;
| ^^^^^^^^^^^^^^^^^^^^^^^
-note: the lint level is defined here
- --> $DIR/issue-33174-restricted-type-in-public-interface.rs:3:9
- |
-LL | #![warn(private_interfaces)]
- | ^^^^^^^^^^^^^^^^^^
-
-error[E0446]: crate-private type `Turtle` in public interface
- --> $DIR/issue-33174-restricted-type-in-public-interface.rs:33:1
- |
-LL | pub(super) struct Turtle;
- | ------------------------ `Turtle` declared as crate-private
-...
-LL | pub type Dermochelys_coriacea = Shell<sea::Turtle>;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak crate-private type
+ = note: `#[warn(private_interfaces)]` on by default
warning: type `Turtle` is more private than the item `Dermochelys_coriacea`
- --> $DIR/issue-33174-restricted-type-in-public-interface.rs:33:1
+ --> $DIR/issue-33174-restricted-type-in-public-interface.rs:19:1
|
LL | pub type Dermochelys_coriacea = Shell<sea::Turtle>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type alias `Dermochelys_coriacea` is reachable at visibility `pub`
|
note: but type `Turtle` is only usable at visibility `pub(crate)`
- --> $DIR/issue-33174-restricted-type-in-public-interface.rs:15:5
+ --> $DIR/issue-33174-restricted-type-in-public-interface.rs:8:5
|
LL | pub(super) struct Turtle;
| ^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0446]: private type `Tortoise` in public interface
- --> $DIR/issue-33174-restricted-type-in-public-interface.rs:38:1
- |
-LL | struct Tortoise;
- | --------------- `Tortoise` declared as private
-...
-LL | pub type Testudo_graeca = Shell<Tortoise>;
- | ^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
-
warning: type `Tortoise` is more private than the item `Testudo_graeca`
- --> $DIR/issue-33174-restricted-type-in-public-interface.rs:38:1
+ --> $DIR/issue-33174-restricted-type-in-public-interface.rs:21:1
|
LL | pub type Testudo_graeca = Shell<Tortoise>;
| ^^^^^^^^^^^^^^^^^^^^^^^ type alias `Testudo_graeca` is reachable at visibility `pub`
|
note: but type `Tortoise` is only usable at visibility `pub(crate)`
- --> $DIR/issue-33174-restricted-type-in-public-interface.rs:20:1
+ --> $DIR/issue-33174-restricted-type-in-public-interface.rs:11:1
|
LL | struct Tortoise;
| ^^^^^^^^^^^^^^^
-error: aborting due to 3 previous errors; 3 warnings emitted
+warning: 3 warnings emitted
-For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/pub/pub-restricted-error-fn.stderr b/tests/ui/pub/pub-restricted-error-fn.stderr
index 0511a821a..ca5d8e1b5 100644
--- a/tests/ui/pub/pub-restricted-error-fn.stderr
+++ b/tests/ui/pub/pub-restricted-error-fn.stderr
@@ -11,6 +11,8 @@ error: expected item, found `(`
|
LL | pub(crate) () fn foo() {}
| ^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
error: aborting due to 2 previous errors
diff --git a/tests/ui/range/issue-54505-no-std.rs b/tests/ui/range/issue-54505-no-std.rs
index db455fada..a15956853 100644
--- a/tests/ui/range/issue-54505-no-std.rs
+++ b/tests/ui/range/issue-54505-no-std.rs
@@ -17,9 +17,9 @@ extern "C" fn eh_personality() {}
static EH_CATCH_TYPEINFO: u8 = 0;
#[panic_handler]
-fn panic_handler() {}
-//~^ ERROR return type should be `!`
-//~| ERROR function should have one argument
+fn panic_handler(_: &core::panic::PanicInfo) -> ! {
+ unimplemented!();
+}
// take a reference to any built-in range
fn take_range(_r: &impl RangeBounds<i8>) {}
diff --git a/tests/ui/range/issue-54505-no-std.stderr b/tests/ui/range/issue-54505-no-std.stderr
index 13563d194..1694d514f 100644
--- a/tests/ui/range/issue-54505-no-std.stderr
+++ b/tests/ui/range/issue-54505-no-std.stderr
@@ -1,15 +1,3 @@
-error: return type should be `!`
- --> $DIR/issue-54505-no-std.rs:20:20
- |
-LL | fn panic_handler() {}
- | ^
-
-error: function should have one argument
- --> $DIR/issue-54505-no-std.rs:20:1
- |
-LL | fn panic_handler() {}
- | ^^^^^^^^^^^^^^^^^^
-
error[E0308]: mismatched types
--> $DIR/issue-54505-no-std.rs:29:16
|
@@ -130,6 +118,6 @@ help: consider borrowing here
LL | take_range(&(..=42));
| ++ +
-error: aborting due to 8 previous errors
+error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/range/range-1.stderr b/tests/ui/range/range-1.stderr
index 277d9b268..96c1ffb2f 100644
--- a/tests/ui/range/range-1.stderr
+++ b/tests/ui/range/range-1.stderr
@@ -19,7 +19,7 @@ LL | for i in false..true {}
i64
i128
usize
- and 5 others
+ and 8 others
= note: required for `std::ops::Range<bool>` to implement `Iterator`
= note: required for `std::ops::Range<bool>` to implement `IntoIterator`
diff --git a/tests/ui/recursion/issue-83150.stderr b/tests/ui/recursion/issue-83150.stderr
index 543b73084..5df8af484 100644
--- a/tests/ui/recursion/issue-83150.stderr
+++ b/tests/ui/recursion/issue-83150.stderr
@@ -9,12 +9,12 @@ LL | func(&mut iter.map(|x| x + 1))
= 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 `Map<&mut std::ops::Range<u8>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>: Iterator`
+error[E0275]: overflow evaluating the requirement `Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>: Iterator`
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_83150`)
- = note: required for `&mut Map<&mut std::ops::Range<u8>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>` to implement `Iterator`
+ = note: required for `&mut Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>` to implement `Iterator`
= note: 65 redundant requirements hidden
- = note: required for `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut std::ops::Range<u8>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>` to implement `Iterator`
+ = note: required for `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>` to implement `Iterator`
error: aborting due to previous error; 1 warning emitted
diff --git a/tests/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr b/tests/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr
index f2328cf3b..a9a92b7a6 100644
--- a/tests/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr
+++ b/tests/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr
@@ -8,7 +8,6 @@ LL | let _: fn(&mut &isize, &mut &isize) = a;
|
= note: expected fn pointer `for<'a, 'b, 'c, 'd> fn(&'a mut &'b isize, &'c mut &'d isize)`
found fn item `for<'a, 'b> fn(&'a mut &isize, &'b mut &isize) {a::<'_, '_>}`
- = note: when the arguments and return types match, functions can be coerced to function pointers
error: aborting due to previous error
diff --git a/tests/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr b/tests/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr
index 9c5004981..e96559937 100644
--- a/tests/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr
+++ b/tests/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr
@@ -8,7 +8,6 @@ LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
|
= note: expected fn pointer `for<'a, 'b, 'c, 'd, 'e, 'f> fn(&'a mut &'b isize, &'c mut &'d isize, &'e mut &'f isize)`
found fn item `for<'a, 'b, 'c> fn(&'a mut &isize, &'b mut &isize, &'c mut &isize) {a::<'_, '_, '_>}`
- = note: when the arguments and return types match, functions can be coerced to function pointers
error: aborting due to previous error
diff --git a/tests/ui/regions/regions-fn-subtyping-return-static-fail.stderr b/tests/ui/regions/regions-fn-subtyping-return-static-fail.stderr
index 766a3d033..8d82ff958 100644
--- a/tests/ui/regions/regions-fn-subtyping-return-static-fail.stderr
+++ b/tests/ui/regions/regions-fn-subtyping-return-static-fail.stderr
@@ -8,7 +8,6 @@ LL | want_G(baz);
|
= note: expected fn pointer `for<'cx> fn(&'cx S) -> &'static S`
found fn item `for<'a> fn(&'a S) -> &'a S {baz}`
- = note: when the arguments and return types match, functions can be coerced to function pointers
note: function defined here
--> $DIR/regions-fn-subtyping-return-static-fail.rs:20:4
|
diff --git a/tests/ui/regions/regions-lifetime-bounds-on-fns.stderr b/tests/ui/regions/regions-lifetime-bounds-on-fns.stderr
index 2fab29865..53a5612d2 100644
--- a/tests/ui/regions/regions-lifetime-bounds-on-fns.stderr
+++ b/tests/ui/regions/regions-lifetime-bounds-on-fns.stderr
@@ -8,7 +8,6 @@ LL | let _: fn(&mut &isize, &mut &isize) = a;
|
= note: expected fn pointer `for<'a, 'b, 'c, 'd> fn(&'a mut &'b isize, &'c mut &'d isize)`
found fn item `for<'a, 'b> fn(&'a mut &isize, &'b mut &isize) {a::<'_, '_>}`
- = note: when the arguments and return types match, functions can be coerced to function pointers
error: aborting due to previous error
diff --git a/tests/ui/reify-intrinsic.stderr b/tests/ui/reify-intrinsic.stderr
index 9f9034a30..310b6c224 100644
--- a/tests/ui/reify-intrinsic.stderr
+++ b/tests/ui/reify-intrinsic.stderr
@@ -8,7 +8,6 @@ LL | let _: unsafe extern "rust-intrinsic" fn(isize) -> usize = std::mem::tr
|
= note: expected fn pointer `unsafe extern "rust-intrinsic" fn(isize) -> usize`
found fn item `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}`
- = note: when the arguments and return types match, functions can be coerced to function pointers
error[E0606]: casting `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}` as `unsafe extern "rust-intrinsic" fn(isize) -> usize` is invalid
--> $DIR/reify-intrinsic.rs:11:13
diff --git a/tests/ui/repr/16-bit-repr-c-enum.rs b/tests/ui/repr/16-bit-repr-c-enum.rs
index 2acfde4be..d4fea2b19 100644
--- a/tests/ui/repr/16-bit-repr-c-enum.rs
+++ b/tests/ui/repr/16-bit-repr-c-enum.rs
@@ -5,7 +5,7 @@
// [avr] compile-flags: --target=avr-unknown-gnu-atmega328 --crate-type=rlib
// [msp430] needs-llvm-components: msp430
// [msp430] compile-flags: --target=msp430-none-elf --crate-type=rlib
-#![feature(no_core, lang_items, intrinsics, staged_api)]
+#![feature(no_core, lang_items, intrinsics, staged_api, rustc_attrs)]
#![no_core]
#![crate_type = "lib"]
#![stable(feature = "", since = "")]
diff --git a/tests/ui/repr/explicit-rust-repr-conflicts.rs b/tests/ui/repr/explicit-rust-repr-conflicts.rs
new file mode 100644
index 000000000..22dd12d31
--- /dev/null
+++ b/tests/ui/repr/explicit-rust-repr-conflicts.rs
@@ -0,0 +1,23 @@
+#[repr(C, Rust)] //~ ERROR conflicting representation hints
+struct S {
+ a: i32,
+}
+
+
+#[repr(Rust)] //~ ERROR conflicting representation hints
+#[repr(C)]
+struct T {
+ a: i32,
+}
+
+#[repr(Rust, u64)] //~ ERROR conflicting representation hints
+enum U {
+ V,
+}
+
+#[repr(Rust, simd)]
+//~^ ERROR conflicting representation hints
+//~| ERROR SIMD types are experimental and possibly buggy
+struct F32x4(f32, f32, f32, f32);
+
+fn main() {}
diff --git a/tests/ui/repr/explicit-rust-repr-conflicts.stderr b/tests/ui/repr/explicit-rust-repr-conflicts.stderr
new file mode 100644
index 000000000..7126da574
--- /dev/null
+++ b/tests/ui/repr/explicit-rust-repr-conflicts.stderr
@@ -0,0 +1,39 @@
+error[E0658]: SIMD types are experimental and possibly buggy
+ --> $DIR/explicit-rust-repr-conflicts.rs:18:1
+ |
+LL | #[repr(Rust, simd)]
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #27731 <https://github.com/rust-lang/rust/issues/27731> for more information
+ = help: add `#![feature(repr_simd)]` to the crate attributes to enable
+
+error[E0566]: conflicting representation hints
+ --> $DIR/explicit-rust-repr-conflicts.rs:1:8
+ |
+LL | #[repr(C, Rust)]
+ | ^ ^^^^
+
+error[E0566]: conflicting representation hints
+ --> $DIR/explicit-rust-repr-conflicts.rs:7:8
+ |
+LL | #[repr(Rust)]
+ | ^^^^
+LL | #[repr(C)]
+ | ^
+
+error[E0566]: conflicting representation hints
+ --> $DIR/explicit-rust-repr-conflicts.rs:13:8
+ |
+LL | #[repr(Rust, u64)]
+ | ^^^^ ^^^
+
+error[E0566]: conflicting representation hints
+ --> $DIR/explicit-rust-repr-conflicts.rs:18:8
+ |
+LL | #[repr(Rust, simd)]
+ | ^^^^ ^^^^
+
+error: aborting due to 5 previous errors
+
+Some errors have detailed explanations: E0566, E0658.
+For more information about an error, try `rustc --explain E0566`.
diff --git a/tests/ui/repr/invalid_repr_list_help.stderr b/tests/ui/repr/invalid_repr_list_help.stderr
index 48a6af3dd..7ffe1287e 100644
--- a/tests/ui/repr/invalid_repr_list_help.stderr
+++ b/tests/ui/repr/invalid_repr_list_help.stderr
@@ -4,7 +4,7 @@ error[E0552]: unrecognized representation hint
LL | #[repr(uwu)]
| ^^^
|
- = help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
+ = help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
error[E0552]: unrecognized representation hint
--> $DIR/invalid_repr_list_help.rs:6:8
@@ -12,7 +12,7 @@ error[E0552]: unrecognized representation hint
LL | #[repr(uwu = "a")]
| ^^^^^^^^^
|
- = help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
+ = help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
error[E0552]: unrecognized representation hint
--> $DIR/invalid_repr_list_help.rs:9:8
@@ -20,7 +20,7 @@ error[E0552]: unrecognized representation hint
LL | #[repr(uwu(4))]
| ^^^^^^
|
- = help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
+ = help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
error[E0552]: unrecognized representation hint
--> $DIR/invalid_repr_list_help.rs:14:8
@@ -28,7 +28,7 @@ error[E0552]: unrecognized representation hint
LL | #[repr(uwu, u8)]
| ^^^
|
- = help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
+ = help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
warning: unknown `doc` attribute `owo`
--> $DIR/invalid_repr_list_help.rs:20:7
@@ -46,7 +46,7 @@ error[E0552]: unrecognized representation hint
LL | #[repr(uwu)]
| ^^^
|
- = help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
+ = help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
error: aborting due to 5 previous errors; 1 warning emitted
diff --git a/tests/ui/repr/repr-transparent-non-exhaustive.rs b/tests/ui/repr/repr-transparent-non-exhaustive.rs
index 506f1dcf3..84dd3f492 100644
--- a/tests/ui/repr/repr-transparent-non-exhaustive.rs
+++ b/tests/ui/repr/repr-transparent-non-exhaustive.rs
@@ -93,4 +93,44 @@ pub struct T16(Sized, ExternalIndirection<NonExhaustiveVariant>);
//~^ ERROR zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
//~| WARN this was previously accepted by the compiler
+#[repr(transparent)]
+pub struct T17(NonExhaustive, Sized);
+//~^ ERROR zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+//~| WARN this was previously accepted by the compiler
+
+#[repr(transparent)]
+pub struct T18(NonExhaustive, NonExhaustive);
+//~^ ERROR zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+//~| WARN this was previously accepted by the compiler
+
+#[repr(transparent)]
+pub struct T19(NonExhaustive, Private);
+//~^ ERROR zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+//~| WARN this was previously accepted by the compiler
+
+#[repr(transparent)]
+pub struct T19Flipped(Private, NonExhaustive);
+//~^ ERROR zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+//~| WARN this was previously accepted by the compiler
+
+#[repr(transparent)]
+pub struct T20(NonExhaustive);
+// Okay, since it's the only field.
+
+#[repr(transparent)]
+pub struct T21(NonExhaustive, InternalNonExhaustive);
+// Okay, since there's only 1 foreign non-exhaustive type.
+
+#[repr(transparent)]
+pub struct T21Flipped(InternalNonExhaustive, NonExhaustive);
+// Okay, since there's only 1 foreign non-exhaustive type.
+
+#[repr(transparent)]
+pub struct T22(NonExhaustive, InternalPrivate);
+// Okay, since there's only 1 foreign non-exhaustive type.
+
+#[repr(transparent)]
+pub struct T22Flipped(InternalPrivate, NonExhaustive);
+// Okay, since there's only 1 foreign non-exhaustive type.
+
fn main() {}
diff --git a/tests/ui/repr/repr-transparent-non-exhaustive.stderr b/tests/ui/repr/repr-transparent-non-exhaustive.stderr
index 16edf59c7..808b9bc98 100644
--- a/tests/ui/repr/repr-transparent-non-exhaustive.stderr
+++ b/tests/ui/repr/repr-transparent-non-exhaustive.stderr
@@ -123,5 +123,45 @@ LL | pub struct T16(Sized, ExternalIndirection<NonExhaustiveVariant>);
= note: for more information, see issue #78586 <https://github.com/rust-lang/rust/issues/78586>
= note: this enum contains `NonExhaustiveVariant`, which is marked with `#[non_exhaustive]`, and makes it not a breaking change to become non-zero-sized in the future.
-error: aborting due to 12 previous errors
+error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+ --> $DIR/repr-transparent-non-exhaustive.rs:97:16
+ |
+LL | pub struct T17(NonExhaustive, Sized);
+ | ^^^^^^^^^^^^^
+ |
+ = 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 #78586 <https://github.com/rust-lang/rust/issues/78586>
+ = note: this struct contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, and makes it not a breaking change to become non-zero-sized in the future.
+
+error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+ --> $DIR/repr-transparent-non-exhaustive.rs:102:31
+ |
+LL | pub struct T18(NonExhaustive, NonExhaustive);
+ | ^^^^^^^^^^^^^
+ |
+ = 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 #78586 <https://github.com/rust-lang/rust/issues/78586>
+ = note: this struct contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, and makes it not a breaking change to become non-zero-sized in the future.
+
+error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+ --> $DIR/repr-transparent-non-exhaustive.rs:107:31
+ |
+LL | pub struct T19(NonExhaustive, Private);
+ | ^^^^^^^
+ |
+ = 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 #78586 <https://github.com/rust-lang/rust/issues/78586>
+ = note: this struct contains `Private`, which contains private fields, and makes it not a breaking change to become non-zero-sized in the future.
+
+error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+ --> $DIR/repr-transparent-non-exhaustive.rs:112:32
+ |
+LL | pub struct T19Flipped(Private, NonExhaustive);
+ | ^^^^^^^^^^^^^
+ |
+ = 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 #78586 <https://github.com/rust-lang/rust/issues/78586>
+ = note: this struct contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, and makes it not a breaking change to become non-zero-sized in the future.
+
+error: aborting due to 16 previous errors
diff --git a/tests/ui/repr/repr-transparent.rs b/tests/ui/repr/repr-transparent.rs
index 8c9d1639c..87cf59ce9 100644
--- a/tests/ui/repr/repr-transparent.rs
+++ b/tests/ui/repr/repr-transparent.rs
@@ -23,23 +23,26 @@ struct ContainsMultipleZst(PhantomData<*const i32>, NoFields);
struct ContainsZstAndNonZst((), [i32; 2]);
#[repr(transparent)]
-struct MultipleNonZst(u8, u8); //~ ERROR needs at most one non-zero-sized field
+struct MultipleNonZst(u8, u8); //~ ERROR needs at most one field with non-trivial size or alignment
trait Mirror { type It: ?Sized; }
impl<T: ?Sized> Mirror for T { type It = Self; }
#[repr(transparent)]
pub struct StructWithProjection(f32, <f32 as Mirror>::It);
-//~^ ERROR needs at most one non-zero-sized field
+//~^ ERROR needs at most one field with non-trivial size or alignment
#[repr(transparent)]
-struct NontrivialAlignZst(u32, [u16; 0]); //~ ERROR alignment larger than 1
+struct NontrivialAlignZst(u32, [u16; 0]); //~ ERROR needs at most one field with non-trivial size or alignment
#[repr(align(32))]
struct ZstAlign32<T>(PhantomData<T>);
#[repr(transparent)]
-struct GenericAlign<T>(ZstAlign32<T>, u32); //~ ERROR alignment larger than 1
+struct GenericAlign<T>(ZstAlign32<T>, u32); //~ ERROR needs at most one field with non-trivial size or alignment
+
+#[repr(transparent)]
+struct WrapsZstWithAlignment([i32; 0]);
#[repr(transparent)] //~ ERROR unsupported representation for zero-variant enum
enum Void {} //~ ERROR transparent enum needs exactly one variant, but has 0
@@ -58,7 +61,7 @@ enum UnitFieldEnum {
enum TooManyFieldsEnum {
Foo(u32, String),
}
-//~^^^ ERROR transparent enum needs at most one non-zero-sized field, but has 2
+//~^^^ ERROR transparent enum needs at most one field with non-trivial size or alignment, but has 2
#[repr(transparent)]
enum MultipleVariants { //~ ERROR transparent enum needs exactly one variant, but has 2
@@ -67,13 +70,13 @@ enum MultipleVariants { //~ ERROR transparent enum needs exactly one variant, bu
}
#[repr(transparent)]
-enum NontrivialAlignZstEnum {
- Foo(u32, [u16; 0]), //~ ERROR alignment larger than 1
+enum NontrivialAlignZstEnum { //~ ERROR needs at most one field with non-trivial size or alignment
+ Foo(u32, [u16; 0]),
}
#[repr(transparent)]
-enum GenericAlignEnum<T> {
- Foo { bar: ZstAlign32<T>, baz: u32 } //~ ERROR alignment larger than 1
+enum GenericAlignEnum<T> { //~ ERROR needs at most one field with non-trivial size or alignment
+ Foo { bar: ZstAlign32<T>, baz: u32 }
}
#[repr(transparent)]
@@ -82,7 +85,7 @@ union UnitUnion {
}
#[repr(transparent)]
-union TooManyFields { //~ ERROR transparent union needs at most one non-zero-sized field, but has 2
+union TooManyFields { //~ ERROR transparent union needs at most one field with non-trivial size or alignment, but has 2
u: u32,
s: i32
}
diff --git a/tests/ui/repr/repr-transparent.stderr b/tests/ui/repr/repr-transparent.stderr
index 028fc25db..d0c78a841 100644
--- a/tests/ui/repr/repr-transparent.stderr
+++ b/tests/ui/repr/repr-transparent.stderr
@@ -1,35 +1,41 @@
-error[E0690]: transparent struct needs at most one non-zero-sized field, but has 2
+error[E0690]: transparent struct needs at most one field with non-trivial size or alignment, but has 2
--> $DIR/repr-transparent.rs:26:1
|
LL | struct MultipleNonZst(u8, u8);
- | ^^^^^^^^^^^^^^^^^^^^^ -- -- this field is non-zero-sized
+ | ^^^^^^^^^^^^^^^^^^^^^ -- -- this field has non-zero size or requires alignment
| | |
- | | this field is non-zero-sized
- | needs at most one non-zero-sized field, but has 2
+ | | this field has non-zero size or requires alignment
+ | needs at most one field with non-trivial size or alignment, but has 2
-error[E0690]: transparent struct needs at most one non-zero-sized field, but has 2
+error[E0690]: transparent struct needs at most one field with non-trivial size or alignment, but has 2
--> $DIR/repr-transparent.rs:32:1
|
LL | pub struct StructWithProjection(f32, <f32 as Mirror>::It);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --- ------------------- this field is non-zero-sized
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --- ------------------- this field has non-zero size or requires alignment
| | |
- | | this field is non-zero-sized
- | needs at most one non-zero-sized field, but has 2
+ | | this field has non-zero size or requires alignment
+ | needs at most one field with non-trivial size or alignment, but has 2
-error[E0691]: zero-sized field in transparent struct has alignment larger than 1
- --> $DIR/repr-transparent.rs:36:32
+error[E0690]: transparent struct needs at most one field with non-trivial size or alignment, but has 2
+ --> $DIR/repr-transparent.rs:36:1
|
LL | struct NontrivialAlignZst(u32, [u16; 0]);
- | ^^^^^^^^ has alignment of 2, which is larger than 1
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ --- -------- this field has non-zero size or requires alignment
+ | | |
+ | | this field has non-zero size or requires alignment
+ | needs at most one field with non-trivial size or alignment, but has 2
-error[E0691]: zero-sized field in transparent struct has alignment larger than 1
- --> $DIR/repr-transparent.rs:42:24
+error[E0690]: transparent struct needs at most one field with non-trivial size or alignment, but has 2
+ --> $DIR/repr-transparent.rs:42:1
|
LL | struct GenericAlign<T>(ZstAlign32<T>, u32);
- | ^^^^^^^^^^^^^ has alignment of 32, which is larger than 1
+ | ^^^^^^^^^^^^^^^^^^^^^^ ------------- --- this field has non-zero size or requires alignment
+ | | |
+ | | this field has non-zero size or requires alignment
+ | needs at most one field with non-trivial size or alignment, but has 2
error[E0084]: unsupported representation for zero-variant enum
- --> $DIR/repr-transparent.rs:44:1
+ --> $DIR/repr-transparent.rs:47:1
|
LL | #[repr(transparent)]
| ^^^^^^^^^^^^^^^^^^^^
@@ -37,23 +43,23 @@ LL | enum Void {}
| --------- zero-variant enum
error[E0731]: transparent enum needs exactly one variant, but has 0
- --> $DIR/repr-transparent.rs:45:1
+ --> $DIR/repr-transparent.rs:48:1
|
LL | enum Void {}
| ^^^^^^^^^ needs exactly one variant, but has 0
-error[E0690]: the variant of a transparent enum needs at most one non-zero-sized field, but has 2
- --> $DIR/repr-transparent.rs:58:1
+error[E0690]: the variant of a transparent enum needs at most one field with non-trivial size or alignment, but has 2
+ --> $DIR/repr-transparent.rs:61:1
|
LL | enum TooManyFieldsEnum {
- | ^^^^^^^^^^^^^^^^^^^^^^ needs at most one non-zero-sized field, but has 2
+ | ^^^^^^^^^^^^^^^^^^^^^^ needs at most one field with non-trivial size or alignment, but has 2
LL | Foo(u32, String),
- | --- ------ this field is non-zero-sized
+ | --- ------ this field has non-zero size or requires alignment
| |
- | this field is non-zero-sized
+ | this field has non-zero size or requires alignment
error[E0731]: transparent enum needs exactly one variant, but has 2
- --> $DIR/repr-transparent.rs:64:1
+ --> $DIR/repr-transparent.rs:67:1
|
LL | enum MultipleVariants {
| ^^^^^^^^^^^^^^^^^^^^^ needs exactly one variant, but has 2
@@ -62,29 +68,37 @@ LL | Foo(String),
LL | Bar,
| --- too many variants in `MultipleVariants`
-error[E0691]: zero-sized field in transparent enum has alignment larger than 1
- --> $DIR/repr-transparent.rs:71:14
+error[E0690]: the variant of a transparent enum needs at most one field with non-trivial size or alignment, but has 2
+ --> $DIR/repr-transparent.rs:73:1
|
+LL | enum NontrivialAlignZstEnum {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ needs at most one field with non-trivial size or alignment, but has 2
LL | Foo(u32, [u16; 0]),
- | ^^^^^^^^ has alignment of 2, which is larger than 1
+ | --- -------- this field has non-zero size or requires alignment
+ | |
+ | this field has non-zero size or requires alignment
-error[E0691]: zero-sized field in transparent enum has alignment larger than 1
- --> $DIR/repr-transparent.rs:76:11
+error[E0690]: the variant of a transparent enum needs at most one field with non-trivial size or alignment, but has 2
+ --> $DIR/repr-transparent.rs:78:1
|
+LL | enum GenericAlignEnum<T> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ needs at most one field with non-trivial size or alignment, but has 2
LL | Foo { bar: ZstAlign32<T>, baz: u32 }
- | ^^^^^^^^^^^^^^^^^^ has alignment of 32, which is larger than 1
+ | ------------------ -------- this field has non-zero size or requires alignment
+ | |
+ | this field has non-zero size or requires alignment
-error[E0690]: transparent union needs at most one non-zero-sized field, but has 2
- --> $DIR/repr-transparent.rs:85:1
+error[E0690]: transparent union needs at most one field with non-trivial size or alignment, but has 2
+ --> $DIR/repr-transparent.rs:88:1
|
LL | union TooManyFields {
- | ^^^^^^^^^^^^^^^^^^^ needs at most one non-zero-sized field, but has 2
+ | ^^^^^^^^^^^^^^^^^^^ needs at most one field with non-trivial size or alignment, but has 2
LL | u: u32,
- | ------ this field is non-zero-sized
+ | ------ this field has non-zero size or requires alignment
LL | s: i32
- | ------ this field is non-zero-sized
+ | ------ this field has non-zero size or requires alignment
error: aborting due to 11 previous errors
-Some errors have detailed explanations: E0084, E0690, E0691, E0731.
+Some errors have detailed explanations: E0084, E0690, E0731.
For more information about an error, try `rustc --explain E0084`.
diff --git a/tests/ui/resolve/associated-fn-called-as-fn.stderr b/tests/ui/resolve/associated-fn-called-as-fn.stderr
index fbdea30d5..7d28b959a 100644
--- a/tests/ui/resolve/associated-fn-called-as-fn.stderr
+++ b/tests/ui/resolve/associated-fn-called-as-fn.stderr
@@ -2,13 +2,23 @@ error[E0425]: cannot find function `collect_primary` in this scope
--> $DIR/associated-fn-called-as-fn.rs:6:30
|
LL | '0'..='9' => collect_primary(&c),
- | ^^^^^^^^^^^^^^^ help: you might have meant to call the associated function: `Self::collect_primary`
+ | ^^^^^^^^^^^^^^^
+ |
+help: you might have meant to call the associated function
+ |
+LL | '0'..='9' => Self::collect_primary(&c),
+ | ++++++
error[E0425]: cannot find function `collect_primary` in this scope
--> $DIR/associated-fn-called-as-fn.rs:23:30
|
LL | '0'..='9' => collect_primary(&c),
- | ^^^^^^^^^^^^^^^ help: you might have meant to call the associated function: `Self::collect_primary`
+ | ^^^^^^^^^^^^^^^
+ |
+help: you might have meant to call the associated function
+ |
+LL | '0'..='9' => Self::collect_primary(&c),
+ | ++++++
error: aborting due to 2 previous errors
diff --git a/tests/ui/resolve/bad-expr-path.stderr b/tests/ui/resolve/bad-expr-path.stderr
index 411130913..0392c1fa2 100644
--- a/tests/ui/resolve/bad-expr-path.stderr
+++ b/tests/ui/resolve/bad-expr-path.stderr
@@ -16,8 +16,8 @@ error[E0580]: `main` function has wrong type
LL | fn main(arguments: Vec<String>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
- = note: expected fn pointer `fn()`
- found fn pointer `fn(Vec<String>)`
+ = note: expected signature `fn()`
+ found signature `fn(Vec<String>)`
error[E0425]: cannot find function `log` in this scope
--> $DIR/bad-expr-path.rs:4:5
diff --git a/tests/ui/resolve/bad-expr-path2.stderr b/tests/ui/resolve/bad-expr-path2.stderr
index af3ca99c5..9238b1f70 100644
--- a/tests/ui/resolve/bad-expr-path2.stderr
+++ b/tests/ui/resolve/bad-expr-path2.stderr
@@ -16,8 +16,8 @@ error[E0580]: `main` function has wrong type
LL | fn main(arguments: Vec<String>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
- = note: expected fn pointer `fn()`
- found fn pointer `fn(Vec<String>)`
+ = note: expected signature `fn()`
+ found signature `fn(Vec<String>)`
error[E0425]: cannot find function `log` in this scope
--> $DIR/bad-expr-path2.rs:6:5
diff --git a/tests/ui/resolve/bad-type-env-capture.stderr b/tests/ui/resolve/bad-type-env-capture.stderr
index b6282c2d0..941b6b7a6 100644
--- a/tests/ui/resolve/bad-type-env-capture.stderr
+++ b/tests/ui/resolve/bad-type-env-capture.stderr
@@ -1,12 +1,12 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/bad-type-env-capture.rs:2:15
|
LL | fn foo<T>() {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | fn bar(b: T) { }
- | - ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `<T>`
+ | help: try introducing a local generic parameter here: `<T>`
error: aborting due to previous error
diff --git a/tests/ui/resolve/field-and-method-in-self-not-available-in-assoc-fn.rs b/tests/ui/resolve/field-and-method-in-self-not-available-in-assoc-fn.rs
new file mode 100644
index 000000000..b5f139590
--- /dev/null
+++ b/tests/ui/resolve/field-and-method-in-self-not-available-in-assoc-fn.rs
@@ -0,0 +1,18 @@
+struct Foo {
+ field: u32,
+}
+
+impl Foo {
+ fn field(&self) -> u32 {
+ self.field
+ }
+
+ fn new() -> Foo {
+ field; //~ ERROR cannot find value `field` in this scope
+ Foo { field } //~ ERROR cannot find value `field` in this scope
+ }
+ fn clone(&self) -> Foo {
+ Foo { field } //~ ERROR cannot find value `field` in this scope
+ }
+}
+fn main() {}
diff --git a/tests/ui/resolve/field-and-method-in-self-not-available-in-assoc-fn.stderr b/tests/ui/resolve/field-and-method-in-self-not-available-in-assoc-fn.stderr
new file mode 100644
index 000000000..3c44c1c24
--- /dev/null
+++ b/tests/ui/resolve/field-and-method-in-self-not-available-in-assoc-fn.stderr
@@ -0,0 +1,41 @@
+error[E0425]: cannot find value `field` in this scope
+ --> $DIR/field-and-method-in-self-not-available-in-assoc-fn.rs:11:9
+ |
+LL | field: u32,
+ | ---------- a field by that name exists in `Self`
+...
+LL | fn field(&self) -> u32 {
+ | ----- a method by that name is available on `Self` here
+...
+LL | field;
+ | ^^^^^
+
+error[E0425]: cannot find value `field` in this scope
+ --> $DIR/field-and-method-in-self-not-available-in-assoc-fn.rs:12:15
+ |
+LL | field: u32,
+ | ---------- a field by that name exists in `Self`
+...
+LL | fn field(&self) -> u32 {
+ | ----- a method by that name is available on `Self` here
+...
+LL | Foo { field }
+ | ^^^^^
+
+error[E0425]: cannot find value `field` in this scope
+ --> $DIR/field-and-method-in-self-not-available-in-assoc-fn.rs:15:15
+ |
+LL | fn field(&self) -> u32 {
+ | ----- a method by that name is available on `Self` here
+...
+LL | Foo { field }
+ | ^^^^^
+ |
+help: you might have meant to use the available field
+ |
+LL | Foo { field: self.field }
+ | ++++++++++++
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/resolve/generic-params-from-outer-item-in-const-item.default.stderr b/tests/ui/resolve/generic-params-from-outer-item-in-const-item.default.stderr
new file mode 100644
index 000000000..4f8538292
--- /dev/null
+++ b/tests/ui/resolve/generic-params-from-outer-item-in-const-item.default.stderr
@@ -0,0 +1,28 @@
+error[E0401]: can't use generic parameters from outer item
+ --> $DIR/generic-params-from-outer-item-in-const-item.rs:12:20
+ |
+LL | fn outer<T: Tr>() { // outer function
+ | - type parameter from outer item
+LL | const K: u32 = T::C;
+ | ^^^^ use of generic parameter from outer item
+
+error[E0401]: can't use generic parameters from outer item
+ --> $DIR/generic-params-from-outer-item-in-const-item.rs:19:24
+ |
+LL | impl<T> Tr for T { // outer impl block
+ | - type parameter from outer item
+LL | const C: u32 = {
+LL | const I: u32 = T::C;
+ | ^^^^ use of generic parameter from outer item
+
+error[E0401]: can't use generic parameters from outer item
+ --> $DIR/generic-params-from-outer-item-in-const-item.rs:27:20
+ |
+LL | struct S<T: Tr>(U32<{ // outer struct
+ | - type parameter from outer item
+LL | const _: u32 = T::C;
+ | ^^^^ use of generic parameter from outer item
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0401`.
diff --git a/tests/ui/resolve/generic-params-from-outer-item-in-const-item.generic_const_items.stderr b/tests/ui/resolve/generic-params-from-outer-item-in-const-item.generic_const_items.stderr
new file mode 100644
index 000000000..1cb55842b
--- /dev/null
+++ b/tests/ui/resolve/generic-params-from-outer-item-in-const-item.generic_const_items.stderr
@@ -0,0 +1,34 @@
+error[E0401]: can't use generic parameters from outer item
+ --> $DIR/generic-params-from-outer-item-in-const-item.rs:12:20
+ |
+LL | fn outer<T: Tr>() { // outer function
+ | - type parameter from outer item
+LL | const K: u32 = T::C;
+ | - ^^^^ use of generic parameter from outer item
+ | |
+ | help: try introducing a local generic parameter here: `<T>`
+
+error[E0401]: can't use generic parameters from outer item
+ --> $DIR/generic-params-from-outer-item-in-const-item.rs:19:24
+ |
+LL | impl<T> Tr for T { // outer impl block
+ | - type parameter from outer item
+LL | const C: u32 = {
+LL | const I: u32 = T::C;
+ | - ^^^^ use of generic parameter from outer item
+ | |
+ | help: try introducing a local generic parameter here: `<T>`
+
+error[E0401]: can't use generic parameters from outer item
+ --> $DIR/generic-params-from-outer-item-in-const-item.rs:27:20
+ |
+LL | struct S<T: Tr>(U32<{ // outer struct
+ | - type parameter from outer item
+LL | const _: u32 = T::C;
+ | - ^^^^ use of generic parameter from outer item
+ | |
+ | help: try introducing a local generic parameter here: `<T>`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0401`.
diff --git a/tests/ui/resolve/generic-params-from-outer-item-in-const-item.rs b/tests/ui/resolve/generic-params-from-outer-item-in-const-item.rs
new file mode 100644
index 000000000..e5647d72c
--- /dev/null
+++ b/tests/ui/resolve/generic-params-from-outer-item-in-const-item.rs
@@ -0,0 +1,39 @@
+// Regression test for issue #115720.
+// If a const item contains generic params from an outer items, only suggest
+// turning the const item generic if the feature `generic_const_items` is enabled.
+
+// revisions: default generic_const_items
+
+#![cfg_attr(generic_const_items, feature(generic_const_items))]
+#![feature(generic_const_exprs)] // only used for the test case "outer struct"
+#![allow(incomplete_features)]
+
+fn outer<T: Tr>() { // outer function
+ const K: u32 = T::C;
+ //~^ ERROR can't use generic parameters from outer item
+ //[generic_const_items]~| HELP try introducing a local generic parameter here
+}
+
+impl<T> Tr for T { // outer impl block
+ const C: u32 = {
+ const I: u32 = T::C;
+ //~^ ERROR can't use generic parameters from outer item
+ //[generic_const_items]~| HELP try introducing a local generic parameter here
+ I
+ };
+}
+
+struct S<T: Tr>(U32<{ // outer struct
+ const _: u32 = T::C;
+ //~^ ERROR can't use generic parameters from outer item
+ //[generic_const_items]~| HELP try introducing a local generic parameter here
+ 0
+}>);
+
+trait Tr {
+ const C: u32;
+}
+
+struct U32<const N: u32>;
+
+fn main() {}
diff --git a/tests/ui/resolve/issue-103474.stderr b/tests/ui/resolve/issue-103474.stderr
index 415d23155..e48fb31ec 100644
--- a/tests/ui/resolve/issue-103474.stderr
+++ b/tests/ui/resolve/issue-103474.stderr
@@ -19,7 +19,7 @@ error[E0425]: cannot find function `first` in this scope
LL | first()
| ^^^^^ not found in this scope
|
-help: consider using the associated function
+help: consider using the method on `Self`
|
LL | self.first()
| +++++
diff --git a/tests/ui/resolve/issue-12796.rs b/tests/ui/resolve/issue-12796.rs
index 942d6b9a5..de3e73437 100644
--- a/tests/ui/resolve/issue-12796.rs
+++ b/tests/ui/resolve/issue-12796.rs
@@ -1,7 +1,7 @@
trait Trait {
fn outer(&self) {
fn inner(_: &Self) {
- //~^ ERROR can't use generic parameters from outer function
+ //~^ ERROR can't use generic parameters from outer item
}
}
}
diff --git a/tests/ui/resolve/issue-12796.stderr b/tests/ui/resolve/issue-12796.stderr
index a01fd2d65..ef59d0036 100644
--- a/tests/ui/resolve/issue-12796.stderr
+++ b/tests/ui/resolve/issue-12796.stderr
@@ -1,10 +1,10 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-12796.rs:3:22
|
LL | fn inner(_: &Self) {
| ^^^^
| |
- | use of generic parameter from outer function
+ | use of generic parameter from outer item
| can't use `Self` here
error: aborting due to previous error
diff --git a/tests/ui/resolve/issue-14254.stderr b/tests/ui/resolve/issue-14254.stderr
index 690a40f7e..9284b4bab 100644
--- a/tests/ui/resolve/issue-14254.stderr
+++ b/tests/ui/resolve/issue-14254.stderr
@@ -8,13 +8,23 @@ error[E0425]: cannot find value `x` in this scope
--> $DIR/issue-14254.rs:30:9
|
LL | x;
- | ^ help: you might have meant to use the available field: `self.x`
+ | ^
+ |
+help: you might have meant to use the available field
+ |
+LL | self.x;
+ | +++++
error[E0425]: cannot find value `y` in this scope
--> $DIR/issue-14254.rs:32:9
|
LL | y;
- | ^ help: you might have meant to use the available field: `self.y`
+ | ^
+ |
+help: you might have meant to use the available field
+ |
+LL | self.y;
+ | +++++
error[E0425]: cannot find value `a` in this scope
--> $DIR/issue-14254.rs:34:9
@@ -31,7 +41,7 @@ LL | bah;
help: you might have meant to refer to the associated function
|
LL | Self::bah;
- | ~~~~~~~~~
+ | ++++++
error[E0425]: cannot find value `b` in this scope
--> $DIR/issue-14254.rs:38:9
@@ -43,13 +53,23 @@ error[E0425]: cannot find value `x` in this scope
--> $DIR/issue-14254.rs:47:9
|
LL | x;
- | ^ help: you might have meant to use the available field: `self.x`
+ | ^
+ |
+help: you might have meant to use the available field
+ |
+LL | self.x;
+ | +++++
error[E0425]: cannot find value `y` in this scope
--> $DIR/issue-14254.rs:49:9
|
LL | y;
- | ^ help: you might have meant to use the available field: `self.y`
+ | ^
+ |
+help: you might have meant to use the available field
+ |
+LL | self.y;
+ | +++++
error[E0425]: cannot find value `a` in this scope
--> $DIR/issue-14254.rs:51:9
@@ -66,7 +86,7 @@ LL | bah;
help: you might have meant to refer to the associated function
|
LL | Self::bah;
- | ~~~~~~~~~
+ | ++++++
error[E0425]: cannot find value `b` in this scope
--> $DIR/issue-14254.rs:55:9
@@ -83,7 +103,7 @@ LL | bah;
help: you might have meant to refer to the associated function
|
LL | Self::bah;
- | ~~~~~~~~~
+ | ++++++
error[E0425]: cannot find value `bah` in this scope
--> $DIR/issue-14254.rs:73:9
@@ -94,7 +114,7 @@ LL | bah;
help: you might have meant to refer to the associated function
|
LL | Self::bah;
- | ~~~~~~~~~
+ | ++++++
error[E0425]: cannot find value `bah` in this scope
--> $DIR/issue-14254.rs:82:9
@@ -105,7 +125,7 @@ LL | bah;
help: you might have meant to refer to the associated function
|
LL | Self::bah;
- | ~~~~~~~~~
+ | ++++++
error[E0425]: cannot find value `bah` in this scope
--> $DIR/issue-14254.rs:91:9
@@ -116,7 +136,7 @@ LL | bah;
help: you might have meant to refer to the associated function
|
LL | Self::bah;
- | ~~~~~~~~~
+ | ++++++
error[E0425]: cannot find value `bah` in this scope
--> $DIR/issue-14254.rs:100:9
@@ -127,55 +147,95 @@ LL | bah;
help: you might have meant to refer to the associated function
|
LL | Self::bah;
- | ~~~~~~~~~
+ | ++++++
error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:19:9
|
LL | baz();
- | ^^^ help: you might have meant to call the method: `self.baz`
+ | ^^^
+ |
+help: you might have meant to call the method
+ |
+LL | self.baz();
+ | +++++
error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:28:9
|
LL | baz();
- | ^^^ help: you might have meant to call the method: `self.baz`
+ | ^^^
+ |
+help: you might have meant to call the method
+ |
+LL | self.baz();
+ | +++++
error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:45:9
|
LL | baz();
- | ^^^ help: you might have meant to call the method: `self.baz`
+ | ^^^
+ |
+help: you might have meant to call the method
+ |
+LL | self.baz();
+ | +++++
error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:62:9
|
LL | baz();
- | ^^^ help: you might have meant to call the method: `self.baz`
+ | ^^^
+ |
+help: you might have meant to call the method
+ |
+LL | self.baz();
+ | +++++
error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:71:9
|
LL | baz();
- | ^^^ help: you might have meant to call the method: `self.baz`
+ | ^^^
+ |
+help: you might have meant to call the method
+ |
+LL | self.baz();
+ | +++++
error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:80:9
|
LL | baz();
- | ^^^ help: you might have meant to call the method: `self.baz`
+ | ^^^
+ |
+help: you might have meant to call the method
+ |
+LL | self.baz();
+ | +++++
error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:89:9
|
LL | baz();
- | ^^^ help: you might have meant to call the method: `self.baz`
+ | ^^^
+ |
+help: you might have meant to call the method
+ |
+LL | self.baz();
+ | +++++
error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:98:9
|
LL | baz();
- | ^^^ help: you might have meant to call the method: `self.baz`
+ | ^^^
+ |
+help: you might have meant to call the method
+ |
+LL | self.baz();
+ | +++++
error: aborting due to 24 previous errors
diff --git a/tests/ui/resolve/issue-2356.stderr b/tests/ui/resolve/issue-2356.stderr
index 30f5f0595..5f75ae988 100644
--- a/tests/ui/resolve/issue-2356.stderr
+++ b/tests/ui/resolve/issue-2356.stderr
@@ -1,8 +1,11 @@
error[E0425]: cannot find value `whiskers` in this scope
--> $DIR/issue-2356.rs:39:5
|
+LL | whiskers: isize,
+ | --------------- a field by that name exists in `Self`
+...
LL | whiskers -= other;
- | ^^^^^^^^ a field by this name exists in `Self`
+ | ^^^^^^^^
error[E0424]: expected value, found module `self`
--> $DIR/issue-2356.rs:65:8
@@ -21,13 +24,21 @@ error[E0425]: cannot find value `whiskers` in this scope
--> $DIR/issue-2356.rs:79:5
|
LL | whiskers = 0;
- | ^^^^^^^^ help: you might have meant to use the available field: `self.whiskers`
+ | ^^^^^^^^
+ |
+help: you might have meant to use the available field
+ |
+LL | self.whiskers = 0;
+ | +++++
error[E0425]: cannot find value `whiskers` in this scope
--> $DIR/issue-2356.rs:84:5
|
+LL | whiskers: isize,
+ | --------------- a field by that name exists in `Self`
+...
LL | whiskers = 4;
- | ^^^^^^^^ a field by this name exists in `Self`
+ | ^^^^^^^^
error[E0424]: expected value, found module `self`
--> $DIR/issue-2356.rs:92:5
@@ -47,19 +58,34 @@ error[E0425]: cannot find function `clone` in this scope
--> $DIR/issue-2356.rs:24:5
|
LL | clone();
- | ^^^^^ help: you might have meant to call the method: `self.clone`
+ | ^^^^^
+ |
+help: you might have meant to call the method
+ |
+LL | self.clone();
+ | +++++
error[E0425]: cannot find function `default` in this scope
--> $DIR/issue-2356.rs:31:5
|
LL | default();
- | ^^^^^^^ help: you might have meant to call the associated function: `Self::default`
+ | ^^^^^^^
+ |
+help: you might have meant to call the associated function
+ |
+LL | Self::default();
+ | ++++++
error[E0425]: cannot find function `shave` in this scope
--> $DIR/issue-2356.rs:41:5
|
LL | shave(4);
- | ^^^^^ help: you might have meant to call the associated function: `Self::shave`
+ | ^^^^^
+ |
+help: you might have meant to call the associated function
+ |
+LL | Self::shave(4);
+ | ++++++
error[E0425]: cannot find function `purr` in this scope
--> $DIR/issue-2356.rs:43:5
@@ -73,7 +99,7 @@ error[E0425]: cannot find function `static_method` in this scope
LL | static_method();
| ^^^^^^^^^^^^^ not found in this scope
|
-help: consider using the associated function
+help: consider using the associated function on `Self`
|
LL | Self::static_method();
| ++++++
@@ -102,7 +128,7 @@ error[E0425]: cannot find function `grow_older` in this scope
LL | grow_older();
| ^^^^^^^^^^ not found in this scope
|
-help: consider using the associated function
+help: consider using the associated function on `Self`
|
LL | Self::grow_older();
| ++++++
diff --git a/tests/ui/resolve/issue-3021-c.rs b/tests/ui/resolve/issue-3021-c.rs
index 94ed1fdf7..bd21d1244 100644
--- a/tests/ui/resolve/issue-3021-c.rs
+++ b/tests/ui/resolve/issue-3021-c.rs
@@ -1,8 +1,8 @@
fn siphash<T>() {
trait U {
- fn g(&self, x: T) -> T; //~ ERROR can't use generic parameters from outer function
- //~^ ERROR can't use generic parameters from outer function
+ fn g(&self, x: T) -> T; //~ ERROR can't use generic parameters from outer item
+ //~^ ERROR can't use generic parameters from outer item
}
}
diff --git a/tests/ui/resolve/issue-3021-c.stderr b/tests/ui/resolve/issue-3021-c.stderr
index 5176efc3a..537bbaf7b 100644
--- a/tests/ui/resolve/issue-3021-c.stderr
+++ b/tests/ui/resolve/issue-3021-c.stderr
@@ -1,24 +1,24 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-3021-c.rs:4:24
|
LL | fn siphash<T>() {
- | - type parameter from outer function
+ | - type parameter from outer item
LL |
LL | trait U {
- | - help: try using a local generic parameter instead: `<T>`
+ | - help: try introducing a local generic parameter here: `<T>`
LL | fn g(&self, x: T) -> T;
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-3021-c.rs:4:30
|
LL | fn siphash<T>() {
- | - type parameter from outer function
+ | - type parameter from outer item
LL |
LL | trait U {
- | - help: try using a local generic parameter instead: `<T>`
+ | - help: try introducing a local generic parameter here: `<T>`
LL | fn g(&self, x: T) -> T;
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
error: aborting due to 2 previous errors
diff --git a/tests/ui/resolve/issue-60057.stderr b/tests/ui/resolve/issue-60057.stderr
index 4d915fcd9..a2ab86443 100644
--- a/tests/ui/resolve/issue-60057.stderr
+++ b/tests/ui/resolve/issue-60057.stderr
@@ -1,14 +1,22 @@
error[E0425]: cannot find value `banana` in this scope
--> $DIR/issue-60057.rs:8:21
|
+LL | banana: u8,
+ | ---------- a field by that name exists in `Self`
+...
LL | banana: banana
- | ^^^^^^ a field by this name exists in `Self`
+ | ^^^^^^
error[E0425]: cannot find value `banana` in this scope
--> $DIR/issue-60057.rs:14:21
|
LL | banana: banana
- | ^^^^^^ help: you might have meant to use the available field: `self.banana`
+ | ^^^^^^
+ |
+help: you might have meant to use the available field
+ |
+LL | banana: self.banana
+ | +++++
error: aborting due to 2 previous errors
diff --git a/tests/ui/resolve/issue-65025-extern-static-parent-generics.rs b/tests/ui/resolve/issue-65025-extern-static-parent-generics.rs
index ce45f630e..4fa3f12d0 100644
--- a/tests/ui/resolve/issue-65025-extern-static-parent-generics.rs
+++ b/tests/ui/resolve/issue-65025-extern-static-parent-generics.rs
@@ -1,7 +1,7 @@
unsafe fn foo<A>() {
extern "C" {
static baz: *const A;
- //~^ ERROR can't use generic parameters from outer function
+ //~^ ERROR can't use generic parameters from outer item
}
let bar: *const u64 = core::mem::transmute(&baz);
diff --git a/tests/ui/resolve/issue-65025-extern-static-parent-generics.stderr b/tests/ui/resolve/issue-65025-extern-static-parent-generics.stderr
index 6bbf76dd1..3e9c3fd11 100644
--- a/tests/ui/resolve/issue-65025-extern-static-parent-generics.stderr
+++ b/tests/ui/resolve/issue-65025-extern-static-parent-generics.stderr
@@ -1,11 +1,11 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-65025-extern-static-parent-generics.rs:3:28
|
LL | unsafe fn foo<A>() {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | extern "C" {
LL | static baz: *const A;
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
error: aborting due to previous error
diff --git a/tests/ui/resolve/issue-65035-static-with-parent-generics.rs b/tests/ui/resolve/issue-65035-static-with-parent-generics.rs
index f96c04841..bc99584a8 100644
--- a/tests/ui/resolve/issue-65035-static-with-parent-generics.rs
+++ b/tests/ui/resolve/issue-65035-static-with-parent-generics.rs
@@ -1,26 +1,26 @@
fn f<T>() {
extern "C" {
static a: *const T;
- //~^ ERROR can't use generic parameters from outer function
+ //~^ ERROR can't use generic parameters from outer item
}
}
fn g<T: Default>() {
static a: *const T = Default::default();
- //~^ ERROR can't use generic parameters from outer function
+ //~^ ERROR can't use generic parameters from outer item
}
fn h<const N: usize>() {
extern "C" {
static a: [u8; N];
- //~^ ERROR can't use generic parameters from outer function
+ //~^ ERROR can't use generic parameters from outer item
}
}
fn i<const N: usize>() {
static a: [u8; N] = [0; N];
- //~^ ERROR can't use generic parameters from outer function
- //~| ERROR can't use generic parameters from outer function
+ //~^ ERROR can't use generic parameters from outer item
+ //~| ERROR can't use generic parameters from outer item
}
fn main() {}
diff --git a/tests/ui/resolve/issue-65035-static-with-parent-generics.stderr b/tests/ui/resolve/issue-65035-static-with-parent-generics.stderr
index 7ed572f80..f1fe1a600 100644
--- a/tests/ui/resolve/issue-65035-static-with-parent-generics.stderr
+++ b/tests/ui/resolve/issue-65035-static-with-parent-generics.stderr
@@ -1,44 +1,44 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-65035-static-with-parent-generics.rs:3:26
|
LL | fn f<T>() {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | extern "C" {
LL | static a: *const T;
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-65035-static-with-parent-generics.rs:9:22
|
LL | fn g<T: Default>() {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | static a: *const T = Default::default();
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-65035-static-with-parent-generics.rs:15:24
|
LL | fn h<const N: usize>() {
- | - const parameter from outer function
+ | - const parameter from outer item
LL | extern "C" {
LL | static a: [u8; N];
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-65035-static-with-parent-generics.rs:21:20
|
LL | fn i<const N: usize>() {
- | - const parameter from outer function
+ | - const parameter from outer item
LL | static a: [u8; N] = [0; N];
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-65035-static-with-parent-generics.rs:21:29
|
LL | fn i<const N: usize>() {
- | - const parameter from outer function
+ | - const parameter from outer item
LL | static a: [u8; N] = [0; N];
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
error: aborting due to 5 previous errors
diff --git a/tests/ui/issues/issue-6642.rs b/tests/ui/resolve/issue-6642.rs
index f80f6fffe..f80f6fffe 100644
--- a/tests/ui/issues/issue-6642.rs
+++ b/tests/ui/resolve/issue-6642.rs
diff --git a/tests/ui/issues/issue-6642.stderr b/tests/ui/resolve/issue-6642.stderr
index 6668108d0..6668108d0 100644
--- a/tests/ui/issues/issue-6642.stderr
+++ b/tests/ui/resolve/issue-6642.stderr
diff --git a/tests/ui/resolve/resolve-assoc-suggestions.stderr b/tests/ui/resolve/resolve-assoc-suggestions.stderr
index 8def9aa20..3d9d4ffaa 100644
--- a/tests/ui/resolve/resolve-assoc-suggestions.stderr
+++ b/tests/ui/resolve/resolve-assoc-suggestions.stderr
@@ -14,13 +14,23 @@ error[E0425]: cannot find value `field` in this scope
--> $DIR/resolve-assoc-suggestions.rs:20:9
|
LL | field;
- | ^^^^^ help: you might have meant to use the available field: `self.field`
+ | ^^^^^
+ |
+help: you might have meant to use the available field
+ |
+LL | self.field;
+ | +++++
error[E0412]: cannot find type `Type` in this scope
--> $DIR/resolve-assoc-suggestions.rs:23:16
|
LL | let _: Type;
- | ^^^^ help: you might have meant to use the associated type: `Self::Type`
+ | ^^^^
+ |
+help: you might have meant to use the associated type
+ |
+LL | let _: Self::Type;
+ | ++++++
error[E0531]: cannot find tuple struct or tuple variant `Type` in this scope
--> $DIR/resolve-assoc-suggestions.rs:25:13
@@ -50,7 +60,12 @@ error[E0425]: cannot find value `method` in this scope
--> $DIR/resolve-assoc-suggestions.rs:34:9
|
LL | method;
- | ^^^^^^ help: you might have meant to refer to the method: `self.method`
+ | ^^^^^^
+ |
+help: you might have meant to refer to the method
+ |
+LL | self.method;
+ | +++++
error: aborting due to 9 previous errors
diff --git a/tests/ui/resolve/resolve-speculative-adjustment.stderr b/tests/ui/resolve/resolve-speculative-adjustment.stderr
index be11a7ebe..fb15472bd 100644
--- a/tests/ui/resolve/resolve-speculative-adjustment.stderr
+++ b/tests/ui/resolve/resolve-speculative-adjustment.stderr
@@ -8,13 +8,23 @@ error[E0425]: cannot find value `field` in this scope
--> $DIR/resolve-speculative-adjustment.rs:23:9
|
LL | field;
- | ^^^^^ help: you might have meant to use the available field: `self.field`
+ | ^^^^^
+ |
+help: you might have meant to use the available field
+ |
+LL | self.field;
+ | +++++
error[E0425]: cannot find function `method` in this scope
--> $DIR/resolve-speculative-adjustment.rs:25:9
|
LL | method();
- | ^^^^^^ help: you might have meant to call the method: `self.method`
+ | ^^^^^^
+ |
+help: you might have meant to call the method
+ |
+LL | self.method();
+ | +++++
error[E0425]: cannot find function `method` in this scope
--> $DIR/resolve-speculative-adjustment.rs:19:13
diff --git a/tests/ui/resolve/resolve-type-param-in-item-in-trait.rs b/tests/ui/resolve/resolve-type-param-in-item-in-trait.rs
index c77a66524..2d5f34c62 100644
--- a/tests/ui/resolve/resolve-type-param-in-item-in-trait.rs
+++ b/tests/ui/resolve/resolve-type-param-in-item-in-trait.rs
@@ -6,7 +6,7 @@ trait TraitA<A> {
fn outer(&self) {
enum Foo<B> {
Variance(A)
- //~^ ERROR can't use generic parameters from outer function
+ //~^ ERROR can't use generic parameters from outer item
}
}
}
@@ -14,21 +14,21 @@ trait TraitA<A> {
trait TraitB<A> {
fn outer(&self) {
struct Foo<B>(A);
- //~^ ERROR can't use generic parameters from outer function
+ //~^ ERROR can't use generic parameters from outer item
}
}
trait TraitC<A> {
fn outer(&self) {
struct Foo<B> { a: A }
- //~^ ERROR can't use generic parameters from outer function
+ //~^ ERROR can't use generic parameters from outer item
}
}
trait TraitD<A> {
fn outer(&self) {
fn foo<B>(a: A) { }
- //~^ ERROR can't use generic parameters from outer function
+ //~^ ERROR can't use generic parameters from outer item
}
}
diff --git a/tests/ui/resolve/resolve-type-param-in-item-in-trait.stderr b/tests/ui/resolve/resolve-type-param-in-item-in-trait.stderr
index 0a6d1cc3b..1ab56fdc5 100644
--- a/tests/ui/resolve/resolve-type-param-in-item-in-trait.stderr
+++ b/tests/ui/resolve/resolve-type-param-in-item-in-trait.stderr
@@ -1,46 +1,46 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/resolve-type-param-in-item-in-trait.rs:8:22
|
LL | trait TraitA<A> {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | fn outer(&self) {
LL | enum Foo<B> {
- | - help: try using a local generic parameter instead: `A,`
+ | - help: try introducing a local generic parameter here: `A,`
LL | Variance(A)
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/resolve-type-param-in-item-in-trait.rs:16:23
|
LL | trait TraitB<A> {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | fn outer(&self) {
LL | struct Foo<B>(A);
- | - ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `A,`
+ | help: try introducing a local generic parameter here: `A,`
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/resolve-type-param-in-item-in-trait.rs:23:28
|
LL | trait TraitC<A> {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | fn outer(&self) {
LL | struct Foo<B> { a: A }
- | - ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `A,`
+ | help: try introducing a local generic parameter here: `A,`
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/resolve-type-param-in-item-in-trait.rs:30:22
|
LL | trait TraitD<A> {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | fn outer(&self) {
LL | fn foo<B>(a: A) { }
- | - ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `A,`
+ | help: try introducing a local generic parameter here: `A,`
error: aborting due to 4 previous errors
diff --git a/tests/ui/resolve/suggest-import-without-clobbering-attrs.fixed b/tests/ui/resolve/suggest-import-without-clobbering-attrs.fixed
new file mode 100644
index 000000000..fc68884fe
--- /dev/null
+++ b/tests/ui/resolve/suggest-import-without-clobbering-attrs.fixed
@@ -0,0 +1,16 @@
+// run-rustfix
+// compile-flags: --cfg=whatever -Aunused
+
+use y::z;
+#[cfg(whatever)]
+use y::Whatever;
+
+mod y {
+ pub(crate) fn z() {}
+ pub(crate) struct Whatever;
+}
+
+fn main() {
+ z();
+ //~^ ERROR cannot find function `z` in this scope
+}
diff --git a/tests/ui/resolve/suggest-import-without-clobbering-attrs.rs b/tests/ui/resolve/suggest-import-without-clobbering-attrs.rs
new file mode 100644
index 000000000..38a109570
--- /dev/null
+++ b/tests/ui/resolve/suggest-import-without-clobbering-attrs.rs
@@ -0,0 +1,15 @@
+// run-rustfix
+// compile-flags: --cfg=whatever -Aunused
+
+#[cfg(whatever)]
+use y::Whatever;
+
+mod y {
+ pub(crate) fn z() {}
+ pub(crate) struct Whatever;
+}
+
+fn main() {
+ z();
+ //~^ ERROR cannot find function `z` in this scope
+}
diff --git a/tests/ui/resolve/suggest-import-without-clobbering-attrs.stderr b/tests/ui/resolve/suggest-import-without-clobbering-attrs.stderr
new file mode 100644
index 000000000..d3574851d
--- /dev/null
+++ b/tests/ui/resolve/suggest-import-without-clobbering-attrs.stderr
@@ -0,0 +1,14 @@
+error[E0425]: cannot find function `z` in this scope
+ --> $DIR/suggest-import-without-clobbering-attrs.rs:13:5
+ |
+LL | z();
+ | ^ not found in this scope
+ |
+help: consider importing this function
+ |
+LL + use y::z;
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr
index f32e0404e..0306c8af8 100644
--- a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr
+++ b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr
@@ -1,20 +1,20 @@
error[E0425]: cannot find value `config` in this scope
--> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:7:16
|
+LL | config: String,
+ | -------------- a field by that name exists in `Self`
+...
LL | Self { config }
- | ^^^^^^
- | |
- | a field by this name exists in `Self`
- | help: a local variable with a similar name exists: `cofig`
+ | ^^^^^^ help: a local variable with a similar name exists: `cofig`
error[E0425]: cannot find value `config` in this scope
--> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:11:20
|
+LL | config: String,
+ | -------------- a field by that name exists in `Self`
+...
LL | println!("{config}");
- | ^^^^^^
- | |
- | a field by this name exists in `Self`
- | help: a local variable with a similar name exists: `cofig`
+ | ^^^^^^ help: a local variable with a similar name exists: `cofig`
error[E0425]: cannot find value `config` in this scope
--> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:15:20
@@ -25,7 +25,7 @@ LL | println!("{config}");
help: you might have meant to use the available field
|
LL | println!("{self.config}");
- | ~~~~~~~~~~~
+ | +++++
help: a local variable with a similar name exists
|
LL | println!("{cofig}");
@@ -43,7 +43,7 @@ LL | fn ba() {}
help: you might have meant to refer to the associated function
|
LL | Self::bah;
- | ~~~~~~~~~
+ | ++++++
help: a function with a similar name exists
|
LL | ba;
@@ -61,7 +61,7 @@ LL | const BARR: u32 = 3;
help: you might have meant to use the associated `const`
|
LL | Self::BAR;
- | ~~~~~~~~~
+ | ++++++
help: a constant with a similar name exists
|
LL | BARR;
@@ -79,7 +79,7 @@ LL | type Bar = String;
help: you might have meant to use the associated type
|
LL | let foo: Self::Baz = "".to_string();
- | ~~~~~~~~~
+ | ++++++
help: a type alias with a similar name exists
|
LL | let foo: Bar = "".to_string();
@@ -97,7 +97,7 @@ LL | fn ba() {}
help: you might have meant to call the method
|
LL | self.baz();
- | ~~~~~~~~
+ | +++++
help: a function with a similar name exists
|
LL | ba();
diff --git a/tests/ui/resolve/unresolved_static_type_field.stderr b/tests/ui/resolve/unresolved_static_type_field.stderr
index 06926b53d..035dc9b96 100644
--- a/tests/ui/resolve/unresolved_static_type_field.stderr
+++ b/tests/ui/resolve/unresolved_static_type_field.stderr
@@ -1,8 +1,11 @@
error[E0425]: cannot find value `cx` in this scope
--> $DIR/unresolved_static_type_field.rs:9:11
|
+LL | cx: bool,
+ | -------- a field by that name exists in `Self`
+...
LL | f(cx);
- | ^^ a field by this name exists in `Self`
+ | ^^
error: aborting due to previous error
diff --git a/tests/ui/resolve/use-self-in-inner-fn.rs b/tests/ui/resolve/use-self-in-inner-fn.rs
index eccb315fe..f4dfa4c40 100644
--- a/tests/ui/resolve/use-self-in-inner-fn.rs
+++ b/tests/ui/resolve/use-self-in-inner-fn.rs
@@ -4,9 +4,9 @@ impl A {
//~^ NOTE `Self` type implicitly declared here, by this `impl`
fn banana(&mut self) {
fn peach(this: &Self) {
- //~^ ERROR can't use generic parameters from outer function
- //~| NOTE use of generic parameter from outer function
- //~| NOTE use a type here instead
+ //~^ ERROR can't use generic parameters from outer item
+ //~| NOTE use of generic parameter from outer item
+ //~| NOTE refer to the type directly here instead
}
}
}
diff --git a/tests/ui/resolve/use-self-in-inner-fn.stderr b/tests/ui/resolve/use-self-in-inner-fn.stderr
index 966093499..832aaacaf 100644
--- a/tests/ui/resolve/use-self-in-inner-fn.stderr
+++ b/tests/ui/resolve/use-self-in-inner-fn.stderr
@@ -1,4 +1,4 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/use-self-in-inner-fn.rs:6:25
|
LL | impl A {
@@ -7,8 +7,8 @@ LL | impl A {
LL | fn peach(this: &Self) {
| ^^^^
| |
- | use of generic parameter from outer function
- | use a type here instead
+ | use of generic parameter from outer item
+ | refer to the type directly here instead
error: aborting due to previous error
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/enum.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/enum.stderr
index 872cb9b8b..4e7f3098a 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/enum.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/enum.stderr
@@ -28,7 +28,8 @@ note: `NonExhaustiveEnum` defined here
|
LL | pub enum NonExhaustiveEnum {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: the matched value is of type `NonExhaustiveEnum`, which is marked as non-exhaustive
+ = note: the matched value is of type `NonExhaustiveEnum`
+ = note: `NonExhaustiveEnum` is marked as non-exhaustive, so a wildcard `_` is necessary to match exhaustively
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 ~ NonExhaustiveEnum::Struct { .. } => "third",
@@ -46,7 +47,7 @@ note: `NonExhaustiveEnum` defined here
|
LL | pub enum NonExhaustiveEnum {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: the matched value is of type `NonExhaustiveEnum`, which is marked as non-exhaustive
+ = note: the matched value is of type `NonExhaustiveEnum`
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 ~ match enum_unit {
diff --git a/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.rs b/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.rs
index 0cab47170..f0e111b57 100644
--- a/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.rs
+++ b/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.rs
@@ -1,7 +1,7 @@
#![feature(start)]
#[start]
-#[track_caller] //~ ERROR `start` is not allowed to be `#[track_caller]`
+#[track_caller] //~ ERROR `#[start]` function is not allowed to be `#[track_caller]`
fn start(_argc: isize, _argv: *const *const u8) -> isize {
panic!("{}: oh no", std::panic::Location::caller());
}
diff --git a/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.stderr b/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.stderr
index 454c98ff9..b6ef62152 100644
--- a/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.stderr
+++ b/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.stderr
@@ -1,10 +1,10 @@
-error: `start` is not allowed to be `#[track_caller]`
+error: `#[start]` function is not allowed to be `#[track_caller]`
--> $DIR/error-with-start.rs:4:1
|
LL | #[track_caller]
| ^^^^^^^^^^^^^^^
LL | fn start(_argc: isize, _argv: *const *const u8) -> isize {
- | -------------------------------------------------------- `start` is not allowed to be `#[track_caller]`
+ | -------------------------------------------------------- `#[start]` function is not allowed to be `#[track_caller]`
error: aborting due to previous error
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/const-expr.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/const-expr.rs
new file mode 100644
index 000000000..5c42c0d8b
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/const-expr.rs
@@ -0,0 +1,26 @@
+// Ensure if let guards can be used in constant expressions.
+// build-pass
+
+#![feature(if_let_guard)]
+
+const fn match_if_let(x: Option<i32>, y: Option<i32>) -> i32 {
+ match x {
+ None if let Some(a @ 5) = y => a,
+ Some(z) if let (Some(_), 12) = (y, z) => 2,
+ _ => 3,
+ }
+}
+
+const ASSERTS: usize = {
+ assert!(match_if_let(None, Some(5)) == 5);
+ assert!(match_if_let(Some(12), Some(3)) == 2);
+ assert!(match_if_let(None, Some(4)) == 3);
+ assert!(match_if_let(Some(11), Some(3)) == 3);
+ assert!(match_if_let(Some(12), None) == 3);
+ assert!(match_if_let(None, None) == 3);
+ 0
+};
+
+fn main() {
+ let _: [(); ASSERTS];
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.rs
new file mode 100644
index 000000000..b4eb54139
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.rs
@@ -0,0 +1,18 @@
+#![feature(if_let_guard)]
+#![allow(irrefutable_let_patterns)]
+
+fn match_option(x: Option<u32>) {
+ match x {
+ //~^ ERROR non-exhaustive patterns: `None` not covered
+ Some(_) => {}
+ None if let y = x => {}
+ }
+}
+
+fn main() {
+ let x = ();
+ match x {
+ //~^ ERROR non-exhaustive patterns: `()` not covered
+ y if let z = y => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.stderr
new file mode 100644
index 000000000..ddd08854f
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.stderr
@@ -0,0 +1,35 @@
+error[E0004]: non-exhaustive patterns: `None` not covered
+ --> $DIR/exhaustive.rs:5:11
+ |
+LL | match x {
+ | ^ pattern `None` not covered
+ |
+note: `Option<u32>` defined here
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+ ::: $SRC_DIR/core/src/option.rs:LL:COL
+ |
+ = note: not covered
+ = note: the matched value is of type `Option<u32>`
+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 if let y = x => {},
+LL + None => todo!()
+ |
+
+error[E0004]: non-exhaustive patterns: `()` not covered
+ --> $DIR/exhaustive.rs:14:11
+ |
+LL | match x {
+ | ^ pattern `()` not covered
+ |
+ = note: the matched value is of type `()`
+ = note: match arms with guards don't count towards exhaustivity
+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 ~ y if let z = y => {},
+LL + () => todo!()
+ |
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs
index 3beb20f0a..b8c0eb3e6 100644
--- a/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs
@@ -8,14 +8,10 @@ fn _if_let_guard() {
//~^ ERROR `if let` guards are experimental
() if (let 0 = 1) => {}
- //~^ ERROR `let` expressions in this position are unstable
- //~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
() if (((let 0 = 1))) => {}
- //~^ ERROR `let` expressions in this position are unstable
- //~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
() if true && let 0 = 1 => {}
//~^ ERROR `if let` guards are experimental
@@ -26,36 +22,22 @@ fn _if_let_guard() {
//~| ERROR `let` expressions in this position are unstable
() if (let 0 = 1) && true => {}
- //~^ ERROR `let` expressions in this position are unstable
- //~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
() if true && (let 0 = 1) => {}
- //~^ ERROR `let` expressions in this position are unstable
- //~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
() if (let 0 = 1) && (let 0 = 1) => {}
- //~^ ERROR `let` expressions in this position are unstable
- //~| ERROR `let` expressions in this position are unstable
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
- //~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
() if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
//~^ ERROR `if let` guards are experimental
//~| ERROR `let` expressions in this position are unstable
//~| ERROR `let` expressions in this position are unstable
- //~| ERROR `let` expressions in this position are unstable
- //~| ERROR `let` expressions in this position are unstable
- //~| ERROR `let` expressions in this position are unstable
//~| ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
() if let Range { start: _, end: _ } = (true..true) && false => {}
@@ -76,13 +58,9 @@ fn _macros() {
}
}
use_expr!((let 0 = 1 && 0 == 0));
- //~^ ERROR `let` expressions in this position are unstable
- //~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
use_expr!((let 0 = 1));
- //~^ ERROR `let` expressions in this position are unstable
- //~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
match () {
#[cfg(FALSE)]
() if let 0 = 1 => {}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.stderr
index dc182ce46..62534b555 100644
--- a/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.stderr
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.stderr
@@ -2,87 +2,6 @@ error: expected expression, found `let` statement
--> $DIR/feature-gate.rs:10:16
|
LL | () if (let 0 = 1) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:15:18
- |
-LL | () if (((let 0 = 1))) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:28:16
- |
-LL | () if (let 0 = 1) && true => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:33:24
- |
-LL | () if true && (let 0 = 1) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:38:16
- |
-LL | () if (let 0 = 1) && (let 0 = 1) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:38:31
- |
-LL | () if (let 0 = 1) && (let 0 = 1) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:46:42
- |
-LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:46:55
- |
-LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:46:68
- |
-LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:78:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:82:16
- |
-LL | use_expr!((let 0 = 1));
- | ^^^
-
-error: no rules expected the token `let`
- --> $DIR/feature-gate.rs:92:15
- |
-LL | macro_rules! use_expr {
- | --------------------- when calling this macro
-...
-LL | use_expr!(let 0 = 1);
- | ^^^ no rules expected this token in macro call
- |
-note: while trying to match meta-variable `$e:expr`
- --> $DIR/feature-gate.rs:71:10
- |
-LL | ($e:expr) => {
- | ^^^^^^^
-
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:10:16
- |
-LL | () if (let 0 = 1) => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
@@ -92,135 +11,140 @@ note: `let`s wrapped in parentheses are not supported in a context with let chai
LL | () if (let 0 = 1) => {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:15:18
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:13:18
|
LL | () if (((let 0 = 1))) => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/feature-gate.rs:15:18
+ --> $DIR/feature-gate.rs:13:18
|
LL | () if (((let 0 = 1))) => {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:28:16
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:24:16
|
LL | () if (let 0 = 1) && true => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/feature-gate.rs:28:16
+ --> $DIR/feature-gate.rs:24:16
|
LL | () if (let 0 = 1) && true => {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:33:24
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:27:24
|
LL | () if true && (let 0 = 1) => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/feature-gate.rs:33:24
+ --> $DIR/feature-gate.rs:27:24
|
LL | () if true && (let 0 = 1) => {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:38:16
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:30:16
|
LL | () if (let 0 = 1) && (let 0 = 1) => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/feature-gate.rs:38:16
+ --> $DIR/feature-gate.rs:30:16
|
LL | () if (let 0 = 1) && (let 0 = 1) => {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:38:31
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:30:31
|
LL | () if (let 0 = 1) && (let 0 = 1) => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/feature-gate.rs:38:31
+ --> $DIR/feature-gate.rs:30:31
|
LL | () if (let 0 = 1) && (let 0 = 1) => {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:46:42
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:34:42
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/feature-gate.rs:46:42
+ --> $DIR/feature-gate.rs:34:42
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:46:55
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:34:55
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/feature-gate.rs:46:42
+ --> $DIR/feature-gate.rs:34:42
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:46:68
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:34:68
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/feature-gate.rs:46:42
+ --> $DIR/feature-gate.rs:34:42
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:78:16
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:60:16
|
LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/feature-gate.rs:78:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:82:16
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:62:16
|
LL | use_expr!((let 0 = 1));
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/feature-gate.rs:82:16
+
+error: no rules expected the token `let`
+ --> $DIR/feature-gate.rs:70:15
|
-LL | use_expr!((let 0 = 1));
- | ^^^^^^^^^
+LL | macro_rules! use_expr {
+ | --------------------- when calling this macro
+...
+LL | use_expr!(let 0 = 1);
+ | ^^^ no rules expected this token in macro call
+ |
+note: while trying to match meta-variable `$e:expr`
+ --> $DIR/feature-gate.rs:53:10
+ |
+LL | ($e:expr) => {
+ | ^^^^^^^
error[E0658]: `if let` guards are experimental
--> $DIR/feature-gate.rs:7:12
@@ -233,7 +157,7 @@ LL | () if let 0 = 1 => {}
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `if let` guards are experimental
- --> $DIR/feature-gate.rs:20:12
+ --> $DIR/feature-gate.rs:16:12
|
LL | () if true && let 0 = 1 => {}
| ^^^^^^^^^^^^^^^^^^^^
@@ -243,7 +167,7 @@ LL | () if true && let 0 = 1 => {}
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `if let` guards are experimental
- --> $DIR/feature-gate.rs:24:12
+ --> $DIR/feature-gate.rs:20:12
|
LL | () if let 0 = 1 && true => {}
| ^^^^^^^^^^^^^^^^^^^^
@@ -253,7 +177,7 @@ LL | () if let 0 = 1 && true => {}
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `if let` guards are experimental
- --> $DIR/feature-gate.rs:46:12
+ --> $DIR/feature-gate.rs:34:12
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -263,7 +187,7 @@ LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 =
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `if let` guards are experimental
- --> $DIR/feature-gate.rs:61:12
+ --> $DIR/feature-gate.rs:43:12
|
LL | () if let Range { start: _, end: _ } = (true..true) && false => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -273,7 +197,7 @@ LL | () if let Range { start: _, end: _ } = (true..true) && false => {}
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `if let` guards are experimental
- --> $DIR/feature-gate.rs:88:12
+ --> $DIR/feature-gate.rs:66:12
|
LL | () if let 0 = 1 => {}
| ^^^^^^^^^^^^
@@ -283,25 +207,7 @@ LL | () if let 0 = 1 => {}
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:10:16
- |
-LL | () if (let 0 = 1) => {}
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:15:18
- |
-LL | () if (((let 0 = 1))) => {}
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:20:23
+ --> $DIR/feature-gate.rs:16:23
|
LL | () if true && let 0 = 1 => {}
| ^^^^^^^^^
@@ -310,7 +216,7 @@ LL | () if true && let 0 = 1 => {}
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:24:15
+ --> $DIR/feature-gate.rs:20:15
|
LL | () if let 0 = 1 && true => {}
| ^^^^^^^^^
@@ -319,43 +225,7 @@ LL | () if let 0 = 1 && true => {}
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:28:16
- |
-LL | () if (let 0 = 1) && true => {}
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:33:24
- |
-LL | () if true && (let 0 = 1) => {}
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:38:16
- |
-LL | () if (let 0 = 1) && (let 0 = 1) => {}
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:38:31
- |
-LL | () if (let 0 = 1) && (let 0 = 1) => {}
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:46:15
+ --> $DIR/feature-gate.rs:34:15
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^
@@ -364,7 +234,7 @@ LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 =
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:46:28
+ --> $DIR/feature-gate.rs:34:28
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^
@@ -373,34 +243,7 @@ LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 =
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:46:42
- |
-LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:46:55
- |
-LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:46:68
- |
-LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:61:15
+ --> $DIR/feature-gate.rs:43:15
|
LL | () if let Range { start: _, end: _ } = (true..true) && false => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -408,24 +251,6 @@ LL | () if let Range { start: _, end: _ } = (true..true) && false => {}
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:78:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:82:16
- |
-LL | use_expr!((let 0 = 1));
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error: aborting due to 45 previous errors
+error: aborting due to 23 previous errors
For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.rs
new file mode 100644
index 000000000..792225e65
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.rs
@@ -0,0 +1,15 @@
+// References to by-move bindings in an if-let guard *cannot* be used after the guard.
+
+#![feature(if_let_guard)]
+
+fn main() {
+ let x: Option<Option<String>> = Some(Some(String::new()));
+ match x {
+ Some(mut y) if let Some(ref z) = y => {
+ //~^ ERROR: cannot move out of `x.0` because it is borrowed
+ let _z: &String = z;
+ let _y: Option<String> = y;
+ }
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.stderr
new file mode 100644
index 000000000..b8e1bb324
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.stderr
@@ -0,0 +1,15 @@
+error[E0505]: cannot move out of `x.0` because it is borrowed
+ --> $DIR/guard-lifetime-1.rs:8:14
+ |
+LL | Some(mut y) if let Some(ref z) = y => {
+ | ^^^^^
+ | |
+ | move out of `x.0` occurs here
+ | borrow of `x.0` occurs here
+LL |
+LL | let _z: &String = z;
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-2.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-2.rs
new file mode 100644
index 000000000..aa2154e3e
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-2.rs
@@ -0,0 +1,16 @@
+// References to by-mutable-ref bindings in an if-let guard *can* be used after the guard.
+
+// check-pass
+
+#![feature(if_let_guard)]
+
+fn main() {
+ let mut x: Option<Option<String>> = Some(Some(String::new()));
+ match x {
+ Some(ref mut y) if let Some(ref z) = *y => {
+ let _z: &String = z;
+ let _y: &mut Option<String> = y;
+ }
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.rs
new file mode 100644
index 000000000..9353c9d92
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.rs
@@ -0,0 +1,14 @@
+// Check mutable bindings cannot be mutated by an if-let guard.
+
+#![feature(if_let_guard)]
+
+fn main() {
+ let x: Option<Option<i32>> = Some(Some(6));
+ match x {
+ Some(mut y) if let Some(ref mut z) = y => {
+ //~^ ERROR cannot borrow `y.0` as mutable, as it is immutable for the pattern guard
+ let _: &mut i32 = z;
+ }
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.stderr
new file mode 100644
index 000000000..009d15338
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow `y.0` as mutable, as it is immutable for the pattern guard
+ --> $DIR/guard-mutability-1.rs:8:33
+ |
+LL | Some(mut y) if let Some(ref mut z) = y => {
+ | ^^^^^^^^^ cannot borrow as mutable
+ |
+ = note: variables bound in patterns are immutable until the end of the pattern guard
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.rs
new file mode 100644
index 000000000..4efa02f57
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.rs
@@ -0,0 +1,14 @@
+// Check mutable reference bindings cannot be mutated by an if-let guard.
+
+#![feature(if_let_guard)]
+
+fn main() {
+ let mut x: Option<Option<i32>> = Some(Some(6));
+ match x {
+ Some(ref mut y) if let Some(ref mut z) = *y => {
+ //~^ ERROR cannot borrow `y.0` as mutable, as it is immutable for the pattern guard
+ let _: &mut i32 = z;
+ }
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.stderr
new file mode 100644
index 000000000..07e7c6a2c
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow `y.0` as mutable, as it is immutable for the pattern guard
+ --> $DIR/guard-mutability-2.rs:8:37
+ |
+LL | Some(ref mut y) if let Some(ref mut z) = *y => {
+ | ^^^^^^^^^ cannot borrow as mutable
+ |
+ = note: variables bound in patterns are immutable until the end of the pattern guard
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.rs
new file mode 100644
index 000000000..423a2cd53
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.rs
@@ -0,0 +1,16 @@
+// Expression macros can't expand to a let match guard.
+
+#![feature(if_let_guard)]
+#![feature(let_chains)]
+
+macro_rules! m {
+ ($e:expr) => { let Some(x) = $e }
+ //~^ ERROR expected expression, found `let` statement
+}
+
+fn main() {
+ match () {
+ () if m!(Some(5)) => {}
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.stderr
new file mode 100644
index 000000000..00c1c303d
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.stderr
@@ -0,0 +1,14 @@
+error: expected expression, found `let` statement
+ --> $DIR/macro-expanded.rs:7:20
+ |
+LL | ($e:expr) => { let Some(x) = $e }
+ | ^^^
+...
+LL | () if m!(Some(5)) => {}
+ | ----------- in this macro invocation
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to previous error
+
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.rs
new file mode 100644
index 000000000..5c333cd77
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.rs
@@ -0,0 +1,97 @@
+#![feature(if_let_guard)]
+#![feature(let_chains)]
+#![allow(irrefutable_let_patterns)]
+
+fn same_pattern(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, 2) if let y = x && c => (),
+ (1, 2) if let z = x => (), //~ ERROR use of moved value: `x`
+ _ => (),
+ }
+}
+
+fn same_pattern_ok(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, 2) if c && let y = x => (),
+ (1, 2) if let z = x => (),
+ _ => (),
+ }
+}
+
+fn different_patterns(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, _) if let y = x && c => (),
+ (_, 2) if let z = x => (), //~ ERROR use of moved value: `x`
+ _ => (),
+ }
+}
+
+fn different_patterns_ok(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, _) if c && let y = x => (),
+ (_, 2) if let z = x => (),
+ _ => (),
+ }
+}
+
+fn or_pattern(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, _) | (_, 2) if let y = x && c => (), //~ ERROR use of moved value: `x`
+ _ => (),
+ }
+}
+
+fn or_pattern_ok(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, _) | (_, 2) if c && let y = x => (),
+ _ => (),
+ }
+}
+
+fn use_in_arm(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, 2) if let y = x && c => false,
+ _ => { *x == 1 }, //~ ERROR use of moved value: `x`
+ };
+}
+
+fn use_in_arm_ok(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, 2) if c && let y = x => false,
+ _ => { *x == 1 },
+ };
+}
+
+fn main() {}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr
new file mode 100644
index 000000000..d27fde582
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr
@@ -0,0 +1,67 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/move-guard-if-let-chain.rs:12:27
+ |
+LL | let x: Box<_> = Box::new(1);
+ | - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
+...
+LL | (1, 2) if let y = x && c => (),
+ | - value moved here
+LL | (1, 2) if let z = x => (),
+ | ^ value used here after move
+ |
+help: borrow this binding in the pattern to avoid moving the value
+ |
+LL | (1, 2) if let ref y = x && c => (),
+ | +++
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/move-guard-if-let-chain.rs:36:27
+ |
+LL | let x: Box<_> = Box::new(1);
+ | - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
+...
+LL | (1, _) if let y = x && c => (),
+ | - value moved here
+LL | (_, 2) if let z = x => (),
+ | ^ value used here after move
+ |
+help: borrow this binding in the pattern to avoid moving the value
+ |
+LL | (1, _) if let ref y = x && c => (),
+ | +++
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/move-guard-if-let-chain.rs:59:36
+ |
+LL | let x: Box<_> = Box::new(1);
+ | - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
+...
+LL | (1, _) | (_, 2) if let y = x && c => (),
+ | - ^ value used here after move
+ | |
+ | value moved here
+ |
+help: borrow this binding in the pattern to avoid moving the value
+ |
+LL | (1, _) | (_, 2) if let ref y = x && c => (),
+ | +++
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/move-guard-if-let-chain.rs:82:16
+ |
+LL | let x: Box<_> = Box::new(1);
+ | - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
+...
+LL | (1, 2) if let y = x && c => false,
+ | - value moved here
+LL | _ => { *x == 1 },
+ | ^^ value used here after move
+ |
+help: borrow this binding in the pattern to avoid moving the value
+ |
+LL | (1, 2) if let ref y = x && c => false,
+ | +++
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let.rs
new file mode 100644
index 000000000..071b86e2e
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let.rs
@@ -0,0 +1,41 @@
+// Check that borrowck knows that moves in the pattern for if-let guards
+// only happen when the pattern is matched.
+
+// build-pass
+
+#![feature(if_let_guard)]
+#![allow(irrefutable_let_patterns)]
+
+fn same_pattern() {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, 2) if let y = x => (),
+ (1, 2) if let z = x => (),
+ _ => (),
+ }
+}
+
+fn or_pattern() {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, _) | (_, 2) if let y = x => (),
+ _ => (),
+ }
+}
+
+fn main() {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, 2) if let y = x => false,
+ _ => { *x == 1 },
+ };
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/parens.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/parens.rs
new file mode 100644
index 000000000..f12824db9
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/parens.rs
@@ -0,0 +1,25 @@
+// Parenthesised let "expressions" are not allowed in guards
+
+#![feature(if_let_guard)]
+#![feature(let_chains)]
+
+#[cfg(FALSE)]
+fn un_cfged() {
+ match () {
+ () if let 0 = 1 => {}
+ () if (let 0 = 1) => {}
+ //~^ ERROR expected expression, found `let` statement
+ () if (((let 0 = 1))) => {}
+ //~^ ERROR expected expression, found `let` statement
+ }
+}
+
+fn main() {
+ match () {
+ () if let 0 = 1 => {}
+ () if (let 0 = 1) => {}
+ //~^ ERROR expected expression, found `let` statement
+ () if (((let 0 = 1))) => {}
+ //~^ ERROR expected expression, found `let` statement
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/parens.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/parens.stderr
new file mode 100644
index 000000000..0c16d9c54
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/parens.stderr
@@ -0,0 +1,54 @@
+error: expected expression, found `let` statement
+ --> $DIR/parens.rs:10:16
+ |
+LL | () if (let 0 = 1) => {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/parens.rs:10:16
+ |
+LL | () if (let 0 = 1) => {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/parens.rs:12:18
+ |
+LL | () if (((let 0 = 1))) => {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/parens.rs:12:18
+ |
+LL | () if (((let 0 = 1))) => {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/parens.rs:20:16
+ |
+LL | () if (let 0 = 1) => {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/parens.rs:20:16
+ |
+LL | () if (let 0 = 1) => {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/parens.rs:22:18
+ |
+LL | () if (((let 0 = 1))) => {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/parens.rs:22:18
+ |
+LL | () if (((let 0 = 1))) => {}
+ | ^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/partially-macro-expanded.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/partially-macro-expanded.rs
new file mode 100644
index 000000000..d91b3a358
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/partially-macro-expanded.rs
@@ -0,0 +1,18 @@
+// Macros can be used for (parts of) the pattern and expression in an if let guard
+// check-pass
+
+#![feature(if_let_guard)]
+#![feature(let_chains)]
+
+macro_rules! m {
+ (pattern $i:ident) => { Some($i) };
+ (expression $e:expr) => { $e };
+}
+
+fn main() {
+ match () {
+ () if let m!(pattern x) = m!(expression Some(4)) => {}
+ () if let [m!(pattern y)] = [Some(8 + m!(expression 4))] => {}
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/shadowing.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/shadowing.rs
new file mode 100644
index 000000000..dba292ef9
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/shadowing.rs
@@ -0,0 +1,23 @@
+// Check shadowing in if let guards works as expected.
+// check-pass
+
+#![feature(if_let_guard)]
+#![feature(let_chains)]
+
+fn main() {
+ let x: Option<Option<i32>> = Some(Some(6));
+ match x {
+ Some(x) if let Some(x) = x => {
+ let _: i32 = x;
+ }
+ _ => {}
+ }
+
+ let y: Option<Option<Option<i32>>> = Some(Some(Some(-24)));
+ match y {
+ Some(y) if let Some(y) = y && let Some(y) = y => {
+ let _: i32 = y;
+ }
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/type-inference.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/type-inference.rs
new file mode 100644
index 000000000..ef7a772e6
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/type-inference.rs
@@ -0,0 +1,16 @@
+// check-pass
+
+#![feature(if_let_guard)]
+
+struct S;
+
+fn get<T>() -> Option<T> {
+ None
+}
+
+fn main() {
+ match get() {
+ x if let Some(S) = x => {}
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr
index b0ac5dc44..e08ffe42d 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr
@@ -13,7 +13,6 @@ LL | let foo: fn() = foo;
found fn item `fn() {foo}`
= note: fn items are distinct from fn pointers
= note: functions with `#[target_feature]` can only be coerced to `unsafe` function pointers
- = note: when the arguments and return types match, functions can be coerced to function pointers
help: consider casting to a fn pointer
|
LL | let foo: fn() = foo as fn();
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr
index b0ac5dc44..e08ffe42d 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr
@@ -13,7 +13,6 @@ LL | let foo: fn() = foo;
found fn item `fn() {foo}`
= note: fn items are distinct from fn pointers
= note: functions with `#[target_feature]` can only be coerced to `unsafe` function pointers
- = note: when the arguments and return types match, functions can be coerced to function pointers
help: consider casting to a fn pointer
|
LL | let foo: fn() = foo as fn();
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
index 50e8ce2fd..221c0416d 100644
--- 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
@@ -5,5 +5,5 @@
#[start]
#[target_feature(enable = "avx2")]
-//~^ ERROR `start` is not allowed to have `#[target_feature]`
+//~^ ERROR `#[start]` function 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
index 07687f3c7..b49f8afd9 100644
--- 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
@@ -1,11 +1,11 @@
-error: `start` is not allowed to have `#[target_feature]`
+error: `#[start]` function 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]`
+ | -------------------------------------------------------- `#[start]` function is not allowed to have `#[target_feature]`
error: aborting due to previous error
diff --git a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.rs b/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.rs
deleted file mode 100644
index f8e033937..000000000
--- a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-// compile-flags:--extern му_сгате
-// edition:2018
-
-use му_сгате::baz; //~ ERROR cannot load a crate with a non-ascii name `му_сгате`
-
-fn main() {}
diff --git a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.stderr b/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.stderr
deleted file mode 100644
index 05fc4fb22..000000000
--- a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: cannot load a crate with a non-ascii name `му_сгате`
- --> $DIR/crate_name_nonascii_forbidden-2.rs:4:5
- |
-LL | use му_сгате::baz;
- | ^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-1.rs b/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden.rs
index c07ba54af..c07ba54af 100644
--- a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-1.rs
+++ b/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden.rs
diff --git a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-1.stderr b/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden.stderr
index a8f3abe59..5aade17cb 100644
--- a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-1.stderr
+++ b/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden.stderr
@@ -1,5 +1,5 @@
error: cannot load a crate with a non-ascii name `ьаг`
- --> $DIR/crate_name_nonascii_forbidden-1.rs:1:1
+ --> $DIR/crate_name_nonascii_forbidden.rs:1:1
|
LL | extern crate ьаг;
| ^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.rs
index e6dee2a1d..cb3be59be 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.rs
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.rs
@@ -3,7 +3,7 @@
fn let_or_guard(x: Result<Option<i32>, ()>) {
match x {
Ok(opt) if let Some(4) = opt || false => {}
- //~^ ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
_ => {}
}
}
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.stderr
index 26850998c..4b85fdd50 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.stderr
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.stderr
@@ -1,4 +1,4 @@
-error: `let` expressions are not supported here
+error: expected expression, found `let` statement
--> $DIR/ast-validate-guards.rs:5:20
|
LL | Ok(opt) if let Some(4) = opt || false => {}
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.rs
new file mode 100644
index 000000000..530458064
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.rs
@@ -0,0 +1,14 @@
+// Regression test for #104172
+
+const N: usize = {
+ struct U;
+ !let y = 42;
+ //~^ ERROR expected expression, found `let` statement
+ 3
+};
+
+struct S {
+ x: [(); N]
+}
+
+fn main() {}
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.stderr
new file mode 100644
index 000000000..3eaccde3b
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.stderr
@@ -0,0 +1,10 @@
+error: expected expression, found `let` statement
+ --> $DIR/avoid-invalid-mir.rs:5:6
+ |
+LL | !let y = 42;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: aborting due to previous error
+
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.rs
index e0dded152..2c0571a7b 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.rs
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.rs
@@ -1,19 +1,18 @@
+// check-pass
+
fn and_chain() {
let z;
if true && { z = 3; true} && z == 3 {}
- //~^ ERROR E0381
}
fn and_chain_2() {
let z;
true && { z = 3; true} && z == 3;
- //~^ ERROR E0381
}
fn or_chain() {
let z;
if false || { z = 3; false} || z == 3 {}
- //~^ ERROR E0381
}
fn main() {
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.stderr
deleted file mode 100644
index 30d5a6779..000000000
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.stderr
+++ /dev/null
@@ -1,33 +0,0 @@
-error[E0381]: used binding `z` is possibly-uninitialized
- --> $DIR/chains-without-let.rs:3:34
- |
-LL | let z;
- | - binding declared here but left uninitialized
-LL | if true && { z = 3; true} && z == 3 {}
- | ----- ^ `z` used here but it is possibly-uninitialized
- | |
- | binding initialized here in some conditions
-
-error[E0381]: used binding `z` is possibly-uninitialized
- --> $DIR/chains-without-let.rs:9:31
- |
-LL | let z;
- | - binding declared here but left uninitialized
-LL | true && { z = 3; true} && z == 3;
- | ----- ^ `z` used here but it is possibly-uninitialized
- | |
- | binding initialized here in some conditions
-
-error[E0381]: used binding `z` is possibly-uninitialized
- --> $DIR/chains-without-let.rs:15:36
- |
-LL | let z;
- | - binding declared here but left uninitialized
-LL | if false || { z = 3; false} || z == 3 {}
- | ----- ^ `z` used here but it is possibly-uninitialized
- | |
- | binding initialized here in some conditions
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.rs
new file mode 100644
index 000000000..096036bb1
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.rs
@@ -0,0 +1,340 @@
+// Check that we don't suggest enabling a feature for code that's
+// not accepted even with that feature.
+
+#![allow(irrefutable_let_patterns)]
+
+use std::ops::Range;
+
+fn main() {}
+
+fn _if() {
+ if (let 0 = 1) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ if (((let 0 = 1))) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ if (let 0 = 1) && true {}
+ //~^ ERROR expected expression, found `let` statement
+
+ if true && (let 0 = 1) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ if (let 0 = 1) && (let 0 = 1) {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+
+ if (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+}
+
+fn _while() {
+ while (let 0 = 1) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ while (((let 0 = 1))) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ while (let 0 = 1) && true {}
+ //~^ ERROR expected expression, found `let` statement
+
+ while true && (let 0 = 1) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ while (let 0 = 1) && (let 0 = 1) {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+
+ while (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+}
+
+fn _macros() {
+ macro_rules! use_expr {
+ ($e:expr) => {
+ if $e {}
+ while $e {}
+ }
+ }
+ use_expr!((let 0 = 1 && 0 == 0));
+ //~^ ERROR expected expression, found `let` statement
+ use_expr!((let 0 = 1));
+ //~^ ERROR expected expression, found `let` statement
+}
+
+fn nested_within_if_expr() {
+ if &let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+
+ if !let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+ if *let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+ if -let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+
+ fn _check_try_binds_tighter() -> Result<(), ()> {
+ if let 0 = 0? {}
+ //~^ ERROR the `?` operator can only be applied to values that implement `Try`
+ Ok(())
+ }
+ if (let 0 = 0)? {}
+ //~^ ERROR expected expression, found `let` statement
+
+ if true || let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+ if (true || let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ if true && (true || let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ if true || (true && let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ let mut x = true;
+ if x = let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+
+ if true..(let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+ if ..(let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ if (let 0 = 0).. {}
+ //~^ ERROR expected expression, found `let` statement
+
+ // Binds as `(let ... = true)..true &&/|| false`.
+ if let Range { start: _, end: _ } = true..true && false {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+ if let Range { start: _, end: _ } = true..true || false {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+
+ // Binds as `(let Range { start: F, end } = F)..(|| true)`.
+ const F: fn() -> bool = || true;
+ if let Range { start: F, end } = F..|| true {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+
+ // Binds as `(let Range { start: true, end } = t)..(&&false)`.
+ let t = &&true;
+ if let Range { start: true, end } = t..&&false {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+
+ if let true = let true = true {}
+ //~^ ERROR expected expression, found `let` statement
+}
+
+fn nested_within_while_expr() {
+ while &let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+
+ while !let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+ while *let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+ while -let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+
+ fn _check_try_binds_tighter() -> Result<(), ()> {
+ while let 0 = 0? {}
+ //~^ ERROR the `?` operator can only be applied to values that implement `Try`
+ Ok(())
+ }
+ while (let 0 = 0)? {}
+ //~^ ERROR expected expression, found `let` statement
+
+ while true || let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+ while (true || let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ while true && (true || let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ while true || (true && let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ let mut x = true;
+ while x = let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+
+ while true..(let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+ while ..(let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ while (let 0 = 0).. {}
+ //~^ ERROR expected expression, found `let` statement
+
+ // Binds as `(let ... = true)..true &&/|| false`.
+ while let Range { start: _, end: _ } = true..true && false {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+ while let Range { start: _, end: _ } = true..true || false {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+
+ // Binds as `(let Range { start: F, end } = F)..(|| true)`.
+ const F: fn() -> bool = || true;
+ while let Range { start: F, end } = F..|| true {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+
+ // Binds as `(let Range { start: true, end } = t)..(&&false)`.
+ let t = &&true;
+ while let Range { start: true, end } = t..&&false {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+
+ while let true = let true = true {}
+ //~^ ERROR expected expression, found `let` statement
+}
+
+fn not_error_because_clarified_intent() {
+ if let Range { start: _, end: _ } = (true..true || false) { }
+
+ if let Range { start: _, end: _ } = (true..true && false) { }
+
+ while let Range { start: _, end: _ } = (true..true || false) { }
+
+ while let Range { start: _, end: _ } = (true..true && false) { }
+}
+
+fn outside_if_and_while_expr() {
+ &let 0 = 0;
+ //~^ ERROR expected expression, found `let` statement
+
+ !let 0 = 0;
+ //~^ ERROR expected expression, found `let` statement
+ *let 0 = 0;
+ //~^ ERROR expected expression, found `let` statement
+ -let 0 = 0;
+ //~^ ERROR expected expression, found `let` statement
+ let _ = let _ = 3;
+ //~^ ERROR expected expression, found `let` statement
+
+ fn _check_try_binds_tighter() -> Result<(), ()> {
+ let 0 = 0?;
+ //~^ ERROR the `?` operator can only be applied to values that implement `Try`
+ Ok(())
+ }
+ (let 0 = 0)?;
+ //~^ ERROR expected expression, found `let` statement
+
+ true || let 0 = 0;
+ //~^ ERROR expected expression, found `let` statement
+ (true || let 0 = 0);
+ //~^ ERROR expected expression, found `let` statement
+ true && (true || let 0 = 0);
+ //~^ ERROR expected expression, found `let` statement
+
+ let mut x = true;
+ x = let 0 = 0;
+ //~^ ERROR expected expression, found `let` statement
+
+ true..(let 0 = 0);
+ //~^ ERROR expected expression, found `let` statement
+ ..(let 0 = 0);
+ //~^ ERROR expected expression, found `let` statement
+ (let 0 = 0)..;
+ //~^ ERROR expected expression, found `let` statement
+
+ (let Range { start: _, end: _ } = true..true || false);
+ //~^ ERROR mismatched types
+ //~| ERROR expected expression, found `let` statement
+
+ (let true = let true = true);
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+
+ {
+ #[cfg(FALSE)]
+ let x = true && let y = 1;
+ //~^ ERROR expected expression, found `let` statement
+ }
+
+ #[cfg(FALSE)]
+ {
+ [1, 2, 3][let _ = ()]
+ //~^ ERROR expected expression, found `let` statement
+ }
+
+ // Check function tail position.
+ &let 0 = 0
+ //~^ ERROR expected expression, found `let` statement
+}
+
+// Let's make sure that `let` inside const generic arguments are considered.
+fn inside_const_generic_arguments() {
+ struct A<const B: bool>;
+ impl<const B: bool> A<{B}> { const O: u32 = 5; }
+
+ if let A::<{
+ true && let 1 = 1
+ //~^ ERROR expected expression, found `let` statement
+ }>::O = 5 {}
+
+ while let A::<{
+ true && let 1 = 1
+ //~^ ERROR expected expression, found `let` statement
+ }>::O = 5 {}
+
+ if A::<{
+ true && let 1 = 1
+ //~^ ERROR expected expression, found `let` statement
+ }>::O == 5 {}
+
+ // In the cases above we have `ExprKind::Block` to help us out.
+ // Below however, we would not have a block and so an implementation might go
+ // from visiting expressions to types without banning `let` expressions down the tree.
+ // This tests ensures that we are not caught by surprise should the parser
+ // admit non-IDENT expressions in const generic arguments.
+
+ if A::<
+ true && let 1 = 1
+ //~^ ERROR expressions must be enclosed in braces
+ //~| ERROR expected expression, found `let` statement
+ >::O == 5 {}
+}
+
+fn with_parenthesis() {
+ let opt = Some(Some(1i32));
+
+ if (let Some(a) = opt && true) {
+ //~^ ERROR expected expression, found `let` statement
+ }
+
+ if (let Some(a) = opt) && true {
+ //~^ ERROR expected expression, found `let` statement
+ }
+ if (let Some(a) = opt) && (let Some(b) = a) {
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+ }
+
+ if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+ }
+ if (let Some(a) = opt && (let Some(b) = a)) && true {
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+ }
+ if (let Some(a) = opt && (true)) && true {
+ //~^ ERROR expected expression, found `let` statement
+ }
+
+ #[cfg(FALSE)]
+ let x = (true && let y = 1);
+ //~^ ERROR expected expression, found `let` statement
+
+ #[cfg(FALSE)]
+ {
+ ([1, 2, 3][let _ = ()])
+ //~^ ERROR expected expression, found `let` statement
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.stderr
new file mode 100644
index 000000000..31f389512
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.stderr
@@ -0,0 +1,1021 @@
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:11:9
+ |
+LL | if (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:11:9
+ |
+LL | if (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:14:11
+ |
+LL | if (((let 0 = 1))) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:14:11
+ |
+LL | if (((let 0 = 1))) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:17:9
+ |
+LL | if (let 0 = 1) && true {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:17:9
+ |
+LL | if (let 0 = 1) && true {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:20:17
+ |
+LL | if true && (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:20:17
+ |
+LL | if true && (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:23:9
+ |
+LL | if (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:23:9
+ |
+LL | if (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:23:24
+ |
+LL | if (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:23:24
+ |
+LL | if (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:27:9
+ |
+LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:27:9
+ |
+LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:27:22
+ |
+LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:27:9
+ |
+LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:27:35
+ |
+LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:27:9
+ |
+LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:34:12
+ |
+LL | while (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:34:12
+ |
+LL | while (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:37:14
+ |
+LL | while (((let 0 = 1))) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:37:14
+ |
+LL | while (((let 0 = 1))) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:40:12
+ |
+LL | while (let 0 = 1) && true {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:40:12
+ |
+LL | while (let 0 = 1) && true {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:43:20
+ |
+LL | while true && (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:43:20
+ |
+LL | while true && (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:46:12
+ |
+LL | while (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:46:12
+ |
+LL | while (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:46:27
+ |
+LL | while (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:46:27
+ |
+LL | while (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:50:12
+ |
+LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:50:12
+ |
+LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:50:25
+ |
+LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:50:12
+ |
+LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:50:38
+ |
+LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:50:12
+ |
+LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:70:9
+ |
+LL | if &let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:73:9
+ |
+LL | if !let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:75:9
+ |
+LL | if *let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:77:9
+ |
+LL | if -let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:85:9
+ |
+LL | if (let 0 = 0)? {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:88:16
+ |
+LL | if true || let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `||` operators are not supported in let chain expressions
+ --> $DIR/disallowed-positions-without-feature-gate.rs:88:13
+ |
+LL | if true || let 0 = 0 {}
+ | ^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:90:17
+ |
+LL | if (true || let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:92:25
+ |
+LL | if true && (true || let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:94:25
+ |
+LL | if true || (true && let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:98:12
+ |
+LL | if x = let 0 = 0 {}
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:101:15
+ |
+LL | if true..(let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:104:11
+ |
+LL | if ..(let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:106:9
+ |
+LL | if (let 0 = 0).. {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:110:8
+ |
+LL | if let Range { start: _, end: _ } = true..true && false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:113:8
+ |
+LL | if let Range { start: _, end: _ } = true..true || false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:119:8
+ |
+LL | if let Range { start: F, end } = F..|| true {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:125:8
+ |
+LL | if let Range { start: true, end } = t..&&false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:129:19
+ |
+LL | if let true = let true = true {}
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:134:12
+ |
+LL | while &let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:137:12
+ |
+LL | while !let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:139:12
+ |
+LL | while *let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:141:12
+ |
+LL | while -let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:149:12
+ |
+LL | while (let 0 = 0)? {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:152:19
+ |
+LL | while true || let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `||` operators are not supported in let chain expressions
+ --> $DIR/disallowed-positions-without-feature-gate.rs:152:16
+ |
+LL | while true || let 0 = 0 {}
+ | ^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:154:20
+ |
+LL | while (true || let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:156:28
+ |
+LL | while true && (true || let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:158:28
+ |
+LL | while true || (true && let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:162:15
+ |
+LL | while x = let 0 = 0 {}
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:165:18
+ |
+LL | while true..(let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:168:14
+ |
+LL | while ..(let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:170:12
+ |
+LL | while (let 0 = 0).. {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:174:11
+ |
+LL | while let Range { start: _, end: _ } = true..true && false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:177:11
+ |
+LL | while let Range { start: _, end: _ } = true..true || false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:183:11
+ |
+LL | while let Range { start: F, end } = F..|| true {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:189:11
+ |
+LL | while let Range { start: true, end } = t..&&false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:193:22
+ |
+LL | while let true = let true = true {}
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:208:6
+ |
+LL | &let 0 = 0;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:211:6
+ |
+LL | !let 0 = 0;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:213:6
+ |
+LL | *let 0 = 0;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:215:6
+ |
+LL | -let 0 = 0;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:217:13
+ |
+LL | let _ = let _ = 3;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:225:6
+ |
+LL | (let 0 = 0)?;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:228:13
+ |
+LL | true || let 0 = 0;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:230:14
+ |
+LL | (true || let 0 = 0);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:232:22
+ |
+LL | true && (true || let 0 = 0);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:236:9
+ |
+LL | x = let 0 = 0;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:239:12
+ |
+LL | true..(let 0 = 0);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:241:8
+ |
+LL | ..(let 0 = 0);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:243:6
+ |
+LL | (let 0 = 0)..;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:246:6
+ |
+LL | (let Range { start: _, end: _ } = true..true || false);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:250:6
+ |
+LL | (let true = let true = true);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:250:17
+ |
+LL | (let true = let true = true);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:256:25
+ |
+LL | let x = true && let y = 1;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:262:19
+ |
+LL | [1, 2, 3][let _ = ()]
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:267:6
+ |
+LL | &let 0 = 0
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:277:17
+ |
+LL | true && let 1 = 1
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:282:17
+ |
+LL | true && let 1 = 1
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:287:17
+ |
+LL | true && let 1 = 1
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:298:17
+ |
+LL | true && let 1 = 1
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expressions must be enclosed in braces to be used as const generic arguments
+ --> $DIR/disallowed-positions-without-feature-gate.rs:298:9
+ |
+LL | true && let 1 = 1
+ | ^^^^^^^^^^^^^^^^^
+ |
+help: enclose the `const` expression in braces
+ |
+LL | { true && let 1 = 1 }
+ | + +
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:307:9
+ |
+LL | if (let Some(a) = opt && true) {
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:307:9
+ |
+LL | if (let Some(a) = opt && true) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:311:9
+ |
+LL | if (let Some(a) = opt) && true {
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:311:9
+ |
+LL | if (let Some(a) = opt) && true {
+ | ^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:314:9
+ |
+LL | if (let Some(a) = opt) && (let Some(b) = a) {
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:314:9
+ |
+LL | if (let Some(a) = opt) && (let Some(b) = a) {
+ | ^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:314:32
+ |
+LL | if (let Some(a) = opt) && (let Some(b) = a) {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:314:32
+ |
+LL | if (let Some(a) = opt) && (let Some(b) = a) {
+ | ^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:319:9
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:319:9
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:319:31
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:319:31
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
+ | ^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:323:9
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:323:9
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:323:31
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:323:31
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
+ | ^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:327:9
+ |
+LL | if (let Some(a) = opt && (true)) && true {
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:327:9
+ |
+LL | if (let Some(a) = opt && (true)) && true {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:332:22
+ |
+LL | let x = (true && let y = 1);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:337:20
+ |
+LL | ([1, 2, 3][let _ = ()])
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:63:16
+ |
+LL | use_expr!((let 0 = 1 && 0 == 0));
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:65:16
+ |
+LL | use_expr!((let 0 = 1));
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:101:8
+ |
+LL | if true..(let 0 = 0) {}
+ | ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<bool>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:110:12
+ |
+LL | if let Range { start: _, end: _ } = true..true && false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
+ | |
+ | expected `bool`, found `Range<_>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<_>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:113:12
+ |
+LL | if let Range { start: _, end: _ } = true..true || false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
+ | |
+ | expected `bool`, found `Range<_>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<_>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:119:12
+ |
+LL | if let Range { start: F, end } = F..|| true {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool`
+ | |
+ | expected fn pointer, found `Range<_>`
+ |
+ = note: expected fn pointer `fn() -> bool`
+ found struct `std::ops::Range<_>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:125:12
+ |
+LL | if let Range { start: true, end } = t..&&false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool`
+ | |
+ | expected `bool`, found `Range<_>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<_>`
+
+error[E0277]: the `?` operator can only be applied to values that implement `Try`
+ --> $DIR/disallowed-positions-without-feature-gate.rs:81:20
+ |
+LL | if let 0 = 0? {}
+ | ^^ the `?` operator cannot be applied to type `{integer}`
+ |
+ = help: the trait `Try` is not implemented for `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:165:11
+ |
+LL | while true..(let 0 = 0) {}
+ | ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<bool>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:174:15
+ |
+LL | while let Range { start: _, end: _ } = true..true && false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
+ | |
+ | expected `bool`, found `Range<_>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<_>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:177:15
+ |
+LL | while let Range { start: _, end: _ } = true..true || false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
+ | |
+ | expected `bool`, found `Range<_>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<_>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:183:15
+ |
+LL | while let Range { start: F, end } = F..|| true {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool`
+ | |
+ | expected fn pointer, found `Range<_>`
+ |
+ = note: expected fn pointer `fn() -> bool`
+ found struct `std::ops::Range<_>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:189:15
+ |
+LL | while let Range { start: true, end } = t..&&false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool`
+ | |
+ | expected `bool`, found `Range<_>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<_>`
+
+error[E0277]: the `?` operator can only be applied to values that implement `Try`
+ --> $DIR/disallowed-positions-without-feature-gate.rs:145:23
+ |
+LL | while let 0 = 0? {}
+ | ^^ the `?` operator cannot be applied to type `{integer}`
+ |
+ = help: the trait `Try` is not implemented for `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:246:10
+ |
+LL | (let Range { start: _, end: _ } = true..true || false);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
+ | |
+ | expected `bool`, found `Range<_>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<_>`
+
+error[E0277]: the `?` operator can only be applied to values that implement `Try`
+ --> $DIR/disallowed-positions-without-feature-gate.rs:221:17
+ |
+LL | let 0 = 0?;
+ | ^^ the `?` operator cannot be applied to type `{integer}`
+ |
+ = help: the trait `Try` is not implemented for `{integer}`
+
+error: aborting due to 105 previous errors
+
+Some errors have detailed explanations: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs
index 2a9a5472b..4ac3ea53a 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs
@@ -27,64 +27,46 @@ fn main() {}
fn _if() {
if (let 0 = 1) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if (((let 0 = 1))) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if (let 0 = 1) && true {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if true && (let 0 = 1) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if (let 0 = 1) && (let 0 = 1) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
}
fn _while() {
while (let 0 = 1) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while (((let 0 = 1))) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while (let 0 = 1) && true {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while true && (let 0 = 1) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while (let 0 = 1) && (let 0 = 1) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
}
@@ -97,32 +79,21 @@ fn _macros() {
}
}
use_expr!((let 0 = 1 && 0 == 0));
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
use_expr!((let 0 = 1));
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}
fn nested_within_if_expr() {
if &let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if !let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if *let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR type `bool` cannot be dereferenced
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if -let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR cannot apply unary operator `-` to type `bool`
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
fn _check_try_binds_tighter() -> Result<(), ()> {
if let 0 = 0? {}
@@ -130,91 +101,63 @@ fn nested_within_if_expr() {
Ok(())
}
if (let 0 = 0)? {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR the `?` operator can only be applied to values that implement `Try`
- //~| ERROR the `?` operator can only be used in a function that returns `Result`
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if true || let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if (true || let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if true && (true || let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if true || (true && let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
let mut x = true;
if x = let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if true..(let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
if ..(let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if (let 0 = 0).. {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
// Binds as `(let ... = true)..true &&/|| false`.
if let Range { start: _, end: _ } = true..true && false {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
if let Range { start: _, end: _ } = true..true || false {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
// Binds as `(let Range { start: F, end } = F)..(|| true)`.
const F: fn() -> bool = || true;
if let Range { start: F, end } = F..|| true {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
// Binds as `(let Range { start: true, end } = t)..(&&false)`.
let t = &&true;
if let Range { start: true, end } = t..&&false {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
if let true = let true = true {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}
fn nested_within_while_expr() {
while &let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while !let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while *let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR type `bool` cannot be dereferenced
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while -let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR cannot apply unary operator `-` to type `bool`
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
fn _check_try_binds_tighter() -> Result<(), ()> {
while let 0 = 0? {}
@@ -222,72 +165,51 @@ fn nested_within_while_expr() {
Ok(())
}
while (let 0 = 0)? {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR the `?` operator can only be applied to values that implement `Try`
- //~| ERROR the `?` operator can only be used in a function that returns `Result`
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while true || let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while (true || let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while true && (true || let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while true || (true && let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
let mut x = true;
while x = let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while true..(let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
while ..(let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while (let 0 = 0).. {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
// Binds as `(let ... = true)..true &&/|| false`.
while let Range { start: _, end: _ } = true..true && false {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
while let Range { start: _, end: _ } = true..true || false {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
// Binds as `(let Range { start: F, end } = F)..(|| true)`.
const F: fn() -> bool = || true;
while let Range { start: F, end } = F..|| true {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
// Binds as `(let Range { start: true, end } = t)..(&&false)`.
let t = &&true;
while let Range { start: true, end } = t..&&false {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
while let true = let true = true {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}
fn not_error_because_clarified_intent() {
@@ -302,20 +224,14 @@ fn not_error_because_clarified_intent() {
fn outside_if_and_while_expr() {
&let 0 = 0;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
!let 0 = 0;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
*let 0 = 0;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR type `bool` cannot be dereferenced
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
-let 0 = 0;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR cannot apply unary operator `-` to type `bool`
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
fn _check_try_binds_tighter() -> Result<(), ()> {
let 0 = 0?;
@@ -323,44 +239,32 @@ fn outside_if_and_while_expr() {
Ok(())
}
(let 0 = 0)?;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR the `?` operator can only be used in a function that returns `Result`
- //~| ERROR the `?` operator can only be applied to values that implement `Try`
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
true || let 0 = 0;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
(true || let 0 = 0);
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
true && (true || let 0 = 0);
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
let mut x = true;
x = let 0 = 0;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
true..(let 0 = 0);
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
..(let 0 = 0);
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
(let 0 = 0)..;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
(let Range { start: _, end: _ } = true..true || false);
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
+ //~^ ERROR mismatched types
//~| ERROR expected expression, found `let` statement
(let true = let true = true);
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
{
@@ -377,9 +281,7 @@ fn outside_if_and_while_expr() {
// Check function tail position.
&let 0 = 0
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}
// Let's make sure that `let` inside const generic arguments are considered.
@@ -389,20 +291,17 @@ fn inside_const_generic_arguments() {
if let A::<{
true && let 1 = 1
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}>::O = 5 {}
while let A::<{
true && let 1 = 1
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}>::O = 5 {}
if A::<{
true && let 1 = 1
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}>::O == 5 {}
// In the cases above we have `ExprKind::Block` to help us out.
@@ -413,8 +312,7 @@ fn inside_const_generic_arguments() {
if A::<
true && let 1 = 1
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expressions must be enclosed in braces
+ //~^ ERROR expressions must be enclosed in braces
//~| ERROR expected expression, found `let` statement
>::O == 5 {}
}
@@ -423,38 +321,29 @@ fn with_parenthesis() {
let opt = Some(Some(1i32));
if (let Some(a) = opt && true) {
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}
if (let Some(a) = opt) && true {
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}
if (let Some(a) = opt) && (let Some(b) = a) {
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
}
if let Some(a) = opt && (true && true) {
}
if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
}
if (let Some(a) = opt && (let Some(b) = a)) && true {
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
}
if (let Some(a) = opt && (true)) && true {
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}
if (true && (true)) && let Some(a) = opt {
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.stderr
index 81933173c..ab58abf4d 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.stderr
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.stderr
@@ -2,503 +2,6 @@ error: expected expression, found `let` statement
--> $DIR/disallowed-positions.rs:29:9
|
LL | if (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:33:11
- |
-LL | if (((let 0 = 1))) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:37:9
- |
-LL | if (let 0 = 1) && true {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:41:17
- |
-LL | if true && (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:45:9
- |
-LL | if (let 0 = 1) && (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:45:24
- |
-LL | if (let 0 = 1) && (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:51:35
- |
-LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:51:48
- |
-LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:51:61
- |
-LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:61:12
- |
-LL | while (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:65:14
- |
-LL | while (((let 0 = 1))) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:69:12
- |
-LL | while (let 0 = 1) && true {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:73:20
- |
-LL | while true && (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:77:12
- |
-LL | while (let 0 = 1) && (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:77:27
- |
-LL | while (let 0 = 1) && (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:83:38
- |
-LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:83:51
- |
-LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:83:64
- |
-LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:110:9
- |
-LL | if &let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:115:9
- |
-LL | if !let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:118:9
- |
-LL | if *let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:122:9
- |
-LL | if -let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:132:9
- |
-LL | if (let 0 = 0)? {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:138:16
- |
-LL | if true || let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:141:17
- |
-LL | if (true || let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:144:25
- |
-LL | if true && (true || let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:147:25
- |
-LL | if true || (true && let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:152:12
- |
-LL | if x = let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:157:15
- |
-LL | if true..(let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:161:11
- |
-LL | if ..(let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:165:9
- |
-LL | if (let 0 = 0).. {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:196:19
- |
-LL | if let true = let true = true {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:202:12
- |
-LL | while &let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:207:12
- |
-LL | while !let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:210:12
- |
-LL | while *let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:214:12
- |
-LL | while -let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:224:12
- |
-LL | while (let 0 = 0)? {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:230:19
- |
-LL | while true || let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:233:20
- |
-LL | while (true || let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:236:28
- |
-LL | while true && (true || let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:239:28
- |
-LL | while true || (true && let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:244:15
- |
-LL | while x = let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:249:18
- |
-LL | while true..(let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:253:14
- |
-LL | while ..(let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:257:12
- |
-LL | while (let 0 = 0).. {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:288:22
- |
-LL | while let true = let true = true {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:304:6
- |
-LL | &let 0 = 0;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:308:6
- |
-LL | !let 0 = 0;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:311:6
- |
-LL | *let 0 = 0;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:315:6
- |
-LL | -let 0 = 0;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:325:6
- |
-LL | (let 0 = 0)?;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:331:13
- |
-LL | true || let 0 = 0;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:334:14
- |
-LL | (true || let 0 = 0);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:337:22
- |
-LL | true && (true || let 0 = 0);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:342:9
- |
-LL | x = let 0 = 0;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:346:12
- |
-LL | true..(let 0 = 0);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:349:8
- |
-LL | ..(let 0 = 0);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:352:6
- |
-LL | (let 0 = 0)..;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:356:6
- |
-LL | (let Range { start: _, end: _ } = true..true || false);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:361:6
- |
-LL | (let true = let true = true);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:361:17
- |
-LL | (let true = let true = true);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:368:25
- |
-LL | let x = true && let y = 1;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:374:19
- |
-LL | [1, 2, 3][let _ = ()]
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:379:6
- |
-LL | &let 0 = 0
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:391:17
- |
-LL | true && let 1 = 1
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:397:17
- |
-LL | true && let 1 = 1
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:403:17
- |
-LL | true && let 1 = 1
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:415:17
- |
-LL | true && let 1 = 1
- | ^^^
-
-error: expressions must be enclosed in braces to be used as const generic arguments
- --> $DIR/disallowed-positions.rs:415:9
- |
-LL | true && let 1 = 1
- | ^^^^^^^^^^^^^^^^^
- |
-help: enclose the `const` expression in braces
- |
-LL | { true && let 1 = 1 }
- | + +
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:425:9
- |
-LL | if (let Some(a) = opt && true) {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:430:9
- |
-LL | if (let Some(a) = opt) && true {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:434:9
- |
-LL | if (let Some(a) = opt) && (let Some(b) = a) {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:434:32
- |
-LL | if (let Some(a) = opt) && (let Some(b) = a) {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:443:9
- |
-LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:443:31
- |
-LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:449:9
- |
-LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:449:31
- |
-LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:455:9
- |
-LL | if (let Some(a) = opt && (true)) && true {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:472:22
- |
-LL | let x = (true && let y = 1);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:477:20
- |
-LL | ([1, 2, 3][let _ = ()])
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:99:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:103:16
- |
-LL | use_expr!((let 0 = 1));
- | ^^^
-
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:29:9
- |
-LL | if (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
@@ -508,1012 +11,863 @@ note: `let`s wrapped in parentheses are not supported in a context with let chai
LL | if (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:33:11
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:32:11
|
LL | if (((let 0 = 1))) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:33:11
+ --> $DIR/disallowed-positions.rs:32:11
|
LL | if (((let 0 = 1))) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:37:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:35:9
|
LL | if (let 0 = 1) && true {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:37:9
+ --> $DIR/disallowed-positions.rs:35:9
|
LL | if (let 0 = 1) && true {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:41:17
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:38:17
|
LL | if true && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:41:17
+ --> $DIR/disallowed-positions.rs:38:17
|
LL | if true && (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:45:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:41:9
|
LL | if (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:45:9
+ --> $DIR/disallowed-positions.rs:41:9
|
LL | if (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:45:24
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:41:24
|
LL | if (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:45:24
+ --> $DIR/disallowed-positions.rs:41:24
|
LL | if (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:51:35
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:45:35
|
LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:51:35
+ --> $DIR/disallowed-positions.rs:45:35
|
LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:51:48
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:45:48
|
LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:51:35
+ --> $DIR/disallowed-positions.rs:45:35
|
LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:51:61
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:45:61
|
LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:51:35
+ --> $DIR/disallowed-positions.rs:45:35
|
LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:61:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:52:12
|
LL | while (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:61:12
+ --> $DIR/disallowed-positions.rs:52:12
|
LL | while (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:65:14
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:55:14
|
LL | while (((let 0 = 1))) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:65:14
+ --> $DIR/disallowed-positions.rs:55:14
|
LL | while (((let 0 = 1))) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:69:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:58:12
|
LL | while (let 0 = 1) && true {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:69:12
+ --> $DIR/disallowed-positions.rs:58:12
|
LL | while (let 0 = 1) && true {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:73:20
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:61:20
|
LL | while true && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:73:20
+ --> $DIR/disallowed-positions.rs:61:20
|
LL | while true && (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:77:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:64:12
|
LL | while (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:77:12
+ --> $DIR/disallowed-positions.rs:64:12
|
LL | while (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:77:27
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:64:27
|
LL | while (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:77:27
+ --> $DIR/disallowed-positions.rs:64:27
|
LL | while (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:83:38
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:68:38
|
LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:83:38
+ --> $DIR/disallowed-positions.rs:68:38
|
LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:83:51
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:68:51
|
LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:83:38
+ --> $DIR/disallowed-positions.rs:68:38
|
LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:83:64
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:68:64
|
LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:83:38
+ --> $DIR/disallowed-positions.rs:68:38
|
LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:99:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^^^^^^^
- |
- = note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:99:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^^^^^^^^^^^^^^^^^
-
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:99:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^^^^^^^
- |
- = note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:99:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^^^^^^^^^^^^^^^^^
-
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:103:16
- |
-LL | use_expr!((let 0 = 1));
- | ^^^^^^^^^
- |
- = note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:103:16
- |
-LL | use_expr!((let 0 = 1));
- | ^^^^^^^^^
-
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:103:16
- |
-LL | use_expr!((let 0 = 1));
- | ^^^^^^^^^
- |
- = note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:103:16
- |
-LL | use_expr!((let 0 = 1));
- | ^^^^^^^^^
-
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:110:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:88:9
|
LL | if &let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:115:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:91:9
|
LL | if !let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:118:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:93:9
|
LL | if *let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:122:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:95:9
|
LL | if -let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:132:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:103:9
|
LL | if (let 0 = 0)? {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:132:9
- |
-LL | if (let 0 = 0)? {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:138:16
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:106:16
|
LL | if true || let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:138:13
+ --> $DIR/disallowed-positions.rs:106:13
|
LL | if true || let 0 = 0 {}
| ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:141:17
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:108:17
|
LL | if (true || let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:141:14
- |
-LL | if (true || let 0 = 0) {}
- | ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:144:25
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:110:25
|
LL | if true && (true || let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:144:22
- |
-LL | if true && (true || let 0 = 0) {}
- | ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:147:25
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:112:25
|
LL | if true || (true && let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:147:17
- |
-LL | if true || (true && let 0 = 0) {}
- | ^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:152:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:116:12
|
LL | if x = let 0 = 0 {}
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:157:15
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:119:15
|
LL | if true..(let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:157:15
- |
-LL | if true..(let 0 = 0) {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:161:11
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:122:11
|
LL | if ..(let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:161:11
- |
-LL | if ..(let 0 = 0) {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:165:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:124:9
|
LL | if (let 0 = 0).. {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:165:9
- |
-LL | if (let 0 = 0).. {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:171:8
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:128:8
|
LL | if let Range { start: _, end: _ } = true..true && false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:175:8
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:131:8
|
LL | if let Range { start: _, end: _ } = true..true || false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:182:8
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:137:8
|
LL | if let Range { start: F, end } = F..|| true {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:190:8
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:143:8
|
LL | if let Range { start: true, end } = t..&&false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:196:19
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:147:19
|
LL | if let true = let true = true {}
- | ^^^^^^^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:202:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:152:12
|
LL | while &let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:207:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:155:12
|
LL | while !let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:210:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:157:12
|
LL | while *let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:214:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:159:12
|
LL | while -let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:224:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:167:12
|
LL | while (let 0 = 0)? {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:224:12
- |
-LL | while (let 0 = 0)? {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:230:19
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:170:19
|
LL | while true || let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:230:16
+ --> $DIR/disallowed-positions.rs:170:16
|
LL | while true || let 0 = 0 {}
| ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:233:20
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:172:20
|
LL | while (true || let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:233:17
- |
-LL | while (true || let 0 = 0) {}
- | ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:236:28
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:174:28
|
LL | while true && (true || let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:236:25
- |
-LL | while true && (true || let 0 = 0) {}
- | ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:239:28
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:176:28
|
LL | while true || (true && let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:239:20
- |
-LL | while true || (true && let 0 = 0) {}
- | ^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:244:15
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:180:15
|
LL | while x = let 0 = 0 {}
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:249:18
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:183:18
|
LL | while true..(let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:249:18
- |
-LL | while true..(let 0 = 0) {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:253:14
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:186:14
|
LL | while ..(let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:253:14
- |
-LL | while ..(let 0 = 0) {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:257:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:188:12
|
LL | while (let 0 = 0).. {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:257:12
- |
-LL | while (let 0 = 0).. {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:263:11
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:192:11
|
LL | while let Range { start: _, end: _ } = true..true && false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:267:11
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:195:11
|
LL | while let Range { start: _, end: _ } = true..true || false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:274:11
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:201:11
|
LL | while let Range { start: F, end } = F..|| true {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:282:11
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:207:11
|
LL | while let Range { start: true, end } = t..&&false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:288:22
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:211:22
|
LL | while let true = let true = true {}
- | ^^^^^^^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:304:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:226:6
|
LL | &let 0 = 0;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:308:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:229:6
|
LL | !let 0 = 0;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:311:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:231:6
|
LL | *let 0 = 0;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:315:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:233:6
|
LL | -let 0 = 0;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:325:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:241:6
|
LL | (let 0 = 0)?;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:325:6
- |
-LL | (let 0 = 0)?;
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:331:13
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:244:13
|
LL | true || let 0 = 0;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:331:10
- |
-LL | true || let 0 = 0;
- | ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:334:14
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:246:14
|
LL | (true || let 0 = 0);
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:334:11
- |
-LL | (true || let 0 = 0);
- | ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:337:22
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:248:22
|
LL | true && (true || let 0 = 0);
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:337:19
- |
-LL | true && (true || let 0 = 0);
- | ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:342:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:252:9
|
LL | x = let 0 = 0;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:346:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:255:12
|
LL | true..(let 0 = 0);
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:346:12
- |
-LL | true..(let 0 = 0);
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:349:8
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:257:8
|
LL | ..(let 0 = 0);
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:349:8
- |
-LL | ..(let 0 = 0);
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:352:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:259:6
|
LL | (let 0 = 0)..;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:352:6
- |
-LL | (let 0 = 0)..;
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:356:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:262:6
|
LL | (let Range { start: _, end: _ } = true..true || false);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:361:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:266:6
|
LL | (let true = let true = true);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:361:6
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:266:17
|
LL | (let true = let true = true);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:272:25
+ |
+LL | let x = true && let y = 1;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:278:19
+ |
+LL | [1, 2, 3][let _ = ()]
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:379:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:283:6
|
LL | &let 0 = 0
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:391:17
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:293:17
|
LL | true && let 1 = 1
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:397:17
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:298:17
|
LL | true && let 1 = 1
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:403:17
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:303:17
|
LL | true && let 1 = 1
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:415:17
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:314:17
|
LL | true && let 1 = 1
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:425:9
+error: expressions must be enclosed in braces to be used as const generic arguments
+ --> $DIR/disallowed-positions.rs:314:9
+ |
+LL | true && let 1 = 1
+ | ^^^^^^^^^^^^^^^^^
+ |
+help: enclose the `const` expression in braces
+ |
+LL | { true && let 1 = 1 }
+ | + +
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:323:9
|
LL | if (let Some(a) = opt && true) {
| ^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:425:9
+ --> $DIR/disallowed-positions.rs:323:9
|
LL | if (let Some(a) = opt && true) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:430:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:327:9
|
LL | if (let Some(a) = opt) && true {
| ^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:430:9
+ --> $DIR/disallowed-positions.rs:327:9
|
LL | if (let Some(a) = opt) && true {
| ^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:434:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:330:9
|
LL | if (let Some(a) = opt) && (let Some(b) = a) {
| ^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:434:9
+ --> $DIR/disallowed-positions.rs:330:9
|
LL | if (let Some(a) = opt) && (let Some(b) = a) {
| ^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:434:32
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:330:32
|
LL | if (let Some(a) = opt) && (let Some(b) = a) {
| ^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:434:32
+ --> $DIR/disallowed-positions.rs:330:32
|
LL | if (let Some(a) = opt) && (let Some(b) = a) {
| ^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:443:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:337:9
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
| ^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:443:9
+ --> $DIR/disallowed-positions.rs:337:9
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:443:31
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:337:31
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
| ^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:443:31
+ --> $DIR/disallowed-positions.rs:337:31
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
| ^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:449:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:341:9
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
| ^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:449:9
+ --> $DIR/disallowed-positions.rs:341:9
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:449:31
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:341:31
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
| ^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:449:31
+ --> $DIR/disallowed-positions.rs:341:31
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
| ^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:455:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:345:9
|
LL | if (let Some(a) = opt && (true)) && true {
| ^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:455:9
+ --> $DIR/disallowed-positions.rs:345:9
|
LL | if (let Some(a) = opt && (true)) && true {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:110:8
- |
-LL | if &let 0 = 0 {}
- | ^^^^^^^^^^ expected `bool`, found `&bool`
- |
-help: consider removing the borrow
- |
-LL - if &let 0 = 0 {}
-LL + if let 0 = 0 {}
- |
-
-error[E0614]: type `bool` cannot be dereferenced
- --> $DIR/disallowed-positions.rs:118:8
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:361:22
|
-LL | if *let 0 = 0 {}
- | ^^^^^^^^^^
-
-error[E0600]: cannot apply unary operator `-` to type `bool`
- --> $DIR/disallowed-positions.rs:122:8
+LL | let x = (true && let y = 1);
+ | ^^^
|
-LL | if -let 0 = 0 {}
- | ^^^^^^^^^^ cannot apply unary operator `-`
+ = note: only supported directly in conditions of `if` and `while` expressions
-error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/disallowed-positions.rs:132:8
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:366:20
|
-LL | if (let 0 = 0)? {}
- | ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
+LL | ([1, 2, 3][let _ = ()])
+ | ^^^
|
- = help: the trait `Try` is not implemented for `bool`
+ = note: only supported directly in conditions of `if` and `while` expressions
-error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
- --> $DIR/disallowed-positions.rs:132:19
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:81:16
|
-LL | fn nested_within_if_expr() {
- | -------------------------- this function should return `Result` or `Option` to accept `?`
-...
-LL | if (let 0 = 0)? {}
- | ^ cannot use the `?` operator in a function that returns `()`
+LL | use_expr!((let 0 = 1 && 0 == 0));
+ | ^^^
|
- = help: the trait `FromResidual<_>` is not implemented for `()`
+ = note: only supported directly in conditions of `if` and `while` expressions
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:152:8
- |
-LL | if x = let 0 = 0 {}
- | ^^^^^^^^^^^^^ expected `bool`, found `()`
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:83:16
|
-help: you might have meant to compare for equality
+LL | use_expr!((let 0 = 1));
+ | ^^^
|
-LL | if x == let 0 = 0 {}
- | +
+ = note: only supported directly in conditions of `if` and `while` expressions
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:157:8
+ --> $DIR/disallowed-positions.rs:119:8
|
LL | if true..(let 0 = 0) {}
| ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
@@ -1522,25 +876,7 @@ LL | if true..(let 0 = 0) {}
found struct `std::ops::Range<bool>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:161:8
- |
-LL | if ..(let 0 = 0) {}
- | ^^^^^^^^^^^^^ expected `bool`, found `RangeTo<bool>`
- |
- = note: expected type `bool`
- found struct `RangeTo<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:165:8
- |
-LL | if (let 0 = 0).. {}
- | ^^^^^^^^^^^^^ expected `bool`, found `RangeFrom<bool>`
- |
- = note: expected type `bool`
- found struct `RangeFrom<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:171:12
+ --> $DIR/disallowed-positions.rs:128:12
|
LL | if let Range { start: _, end: _ } = true..true && false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
@@ -1551,16 +887,7 @@ LL | if let Range { start: _, end: _ } = true..true && false {}
found struct `std::ops::Range<_>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:171:8
- |
-LL | if let Range { start: _, end: _ } = true..true && false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:175:12
+ --> $DIR/disallowed-positions.rs:131:12
|
LL | if let Range { start: _, end: _ } = true..true || false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
@@ -1571,16 +898,7 @@ LL | if let Range { start: _, end: _ } = true..true || false {}
found struct `std::ops::Range<_>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:175:8
- |
-LL | if let Range { start: _, end: _ } = true..true || false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:182:12
+ --> $DIR/disallowed-positions.rs:137:12
|
LL | if let Range { start: F, end } = F..|| true {}
| ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool`
@@ -1591,29 +909,7 @@ LL | if let Range { start: F, end } = F..|| true {}
found struct `std::ops::Range<_>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:182:41
- |
-LL | if let Range { start: F, end } = F..|| true {}
- | ^^^^^^^ expected `bool`, found closure
- |
- = note: expected type `bool`
- found closure `[closure@$DIR/disallowed-positions.rs:182:41: 182:43]`
-help: use parentheses to call this closure
- |
-LL | if let Range { start: F, end } = F..(|| true)() {}
- | + +++
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:182:8
- |
-LL | if let Range { start: F, end } = F..|| true {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:190:12
+ --> $DIR/disallowed-positions.rs:143:12
|
LL | if let Range { start: true, end } = t..&&false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool`
@@ -1623,29 +919,8 @@ LL | if let Range { start: true, end } = t..&&false {}
= note: expected type `bool`
found struct `std::ops::Range<_>`
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:190:44
- |
-LL | if let Range { start: true, end } = t..&&false {}
- | ^^^^^^^ expected `bool`, found `&&bool`
- |
-help: consider removing the `&&`
- |
-LL - if let Range { start: true, end } = t..&&false {}
-LL + if let Range { start: true, end } = t..false {}
- |
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:190:8
- |
-LL | if let Range { start: true, end } = t..&&false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/disallowed-positions.rs:128:20
+ --> $DIR/disallowed-positions.rs:99:20
|
LL | if let 0 = 0? {}
| ^^ the `?` operator cannot be applied to type `{integer}`
@@ -1653,61 +928,7 @@ LL | if let 0 = 0? {}
= help: the trait `Try` is not implemented for `{integer}`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:202:11
- |
-LL | while &let 0 = 0 {}
- | ^^^^^^^^^^ expected `bool`, found `&bool`
- |
-help: consider removing the borrow
- |
-LL - while &let 0 = 0 {}
-LL + while let 0 = 0 {}
- |
-
-error[E0614]: type `bool` cannot be dereferenced
- --> $DIR/disallowed-positions.rs:210:11
- |
-LL | while *let 0 = 0 {}
- | ^^^^^^^^^^
-
-error[E0600]: cannot apply unary operator `-` to type `bool`
- --> $DIR/disallowed-positions.rs:214:11
- |
-LL | while -let 0 = 0 {}
- | ^^^^^^^^^^ cannot apply unary operator `-`
-
-error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/disallowed-positions.rs:224:11
- |
-LL | while (let 0 = 0)? {}
- | ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
- |
- = help: the trait `Try` is not implemented for `bool`
-
-error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
- --> $DIR/disallowed-positions.rs:224:22
- |
-LL | fn nested_within_while_expr() {
- | ----------------------------- this function should return `Result` or `Option` to accept `?`
-...
-LL | while (let 0 = 0)? {}
- | ^ cannot use the `?` operator in a function that returns `()`
- |
- = help: the trait `FromResidual<_>` is not implemented for `()`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:244:11
- |
-LL | while x = let 0 = 0 {}
- | ^^^^^^^^^^^^^ expected `bool`, found `()`
- |
-help: you might have meant to compare for equality
- |
-LL | while x == let 0 = 0 {}
- | +
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:249:11
+ --> $DIR/disallowed-positions.rs:183:11
|
LL | while true..(let 0 = 0) {}
| ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
@@ -1716,25 +937,7 @@ LL | while true..(let 0 = 0) {}
found struct `std::ops::Range<bool>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:253:11
- |
-LL | while ..(let 0 = 0) {}
- | ^^^^^^^^^^^^^ expected `bool`, found `RangeTo<bool>`
- |
- = note: expected type `bool`
- found struct `RangeTo<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:257:11
- |
-LL | while (let 0 = 0).. {}
- | ^^^^^^^^^^^^^ expected `bool`, found `RangeFrom<bool>`
- |
- = note: expected type `bool`
- found struct `RangeFrom<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:263:15
+ --> $DIR/disallowed-positions.rs:192:15
|
LL | while let Range { start: _, end: _ } = true..true && false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
@@ -1745,16 +948,7 @@ LL | while let Range { start: _, end: _ } = true..true && false {}
found struct `std::ops::Range<_>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:263:11
- |
-LL | while let Range { start: _, end: _ } = true..true && false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:267:15
+ --> $DIR/disallowed-positions.rs:195:15
|
LL | while let Range { start: _, end: _ } = true..true || false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
@@ -1765,16 +959,7 @@ LL | while let Range { start: _, end: _ } = true..true || false {}
found struct `std::ops::Range<_>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:267:11
- |
-LL | while let Range { start: _, end: _ } = true..true || false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:274:15
+ --> $DIR/disallowed-positions.rs:201:15
|
LL | while let Range { start: F, end } = F..|| true {}
| ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool`
@@ -1785,29 +970,7 @@ LL | while let Range { start: F, end } = F..|| true {}
found struct `std::ops::Range<_>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:274:44
- |
-LL | while let Range { start: F, end } = F..|| true {}
- | ^^^^^^^ expected `bool`, found closure
- |
- = note: expected type `bool`
- found closure `[closure@$DIR/disallowed-positions.rs:274:44: 274:46]`
-help: use parentheses to call this closure
- |
-LL | while let Range { start: F, end } = F..(|| true)() {}
- | + +++
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:274:11
- |
-LL | while let Range { start: F, end } = F..|| true {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:282:15
+ --> $DIR/disallowed-positions.rs:207:15
|
LL | while let Range { start: true, end } = t..&&false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool`
@@ -1817,68 +980,16 @@ LL | while let Range { start: true, end } = t..&&false {}
= note: expected type `bool`
found struct `std::ops::Range<_>`
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:282:47
- |
-LL | while let Range { start: true, end } = t..&&false {}
- | ^^^^^^^ expected `bool`, found `&&bool`
- |
-help: consider removing the `&&`
- |
-LL - while let Range { start: true, end } = t..&&false {}
-LL + while let Range { start: true, end } = t..false {}
- |
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:282:11
- |
-LL | while let Range { start: true, end } = t..&&false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/disallowed-positions.rs:220:23
+ --> $DIR/disallowed-positions.rs:163:23
|
LL | while let 0 = 0? {}
| ^^ the `?` operator cannot be applied to type `{integer}`
|
= help: the trait `Try` is not implemented for `{integer}`
-error[E0614]: type `bool` cannot be dereferenced
- --> $DIR/disallowed-positions.rs:311:5
- |
-LL | *let 0 = 0;
- | ^^^^^^^^^^
-
-error[E0600]: cannot apply unary operator `-` to type `bool`
- --> $DIR/disallowed-positions.rs:315:5
- |
-LL | -let 0 = 0;
- | ^^^^^^^^^^ cannot apply unary operator `-`
-
-error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/disallowed-positions.rs:325:5
- |
-LL | (let 0 = 0)?;
- | ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
- |
- = help: the trait `Try` is not implemented for `bool`
-
-error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
- --> $DIR/disallowed-positions.rs:325:16
- |
-LL | fn outside_if_and_while_expr() {
- | ------------------------------ this function should return `Result` or `Option` to accept `?`
-...
-LL | (let 0 = 0)?;
- | ^ cannot use the `?` operator in a function that returns `()`
- |
- = help: the trait `FromResidual<_>` is not implemented for `()`
-
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:356:10
+ --> $DIR/disallowed-positions.rs:262:10
|
LL | (let Range { start: _, end: _ } = true..true || false);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
@@ -1888,24 +999,15 @@ LL | (let Range { start: _, end: _ } = true..true || false);
= note: expected type `bool`
found struct `std::ops::Range<_>`
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:379:5
- |
-LL | fn outside_if_and_while_expr() {
- | - help: try adding a return type: `-> &bool`
-...
-LL | &let 0 = 0
- | ^^^^^^^^^^ expected `()`, found `&bool`
-
error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/disallowed-positions.rs:321:17
+ --> $DIR/disallowed-positions.rs:237:17
|
LL | let 0 = 0?;
| ^^ the `?` operator cannot be applied to type `{integer}`
|
= help: the trait `Try` is not implemented for `{integer}`
-error: aborting due to 215 previous errors
+error: aborting due to 104 previous errors
-Some errors have detailed explanations: E0277, E0308, E0600, E0614.
+Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.rs
index 2a6c14435..3c572054e 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.rs
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.rs
@@ -14,7 +14,6 @@ fn main() {
};
let Some(n) = opt && let another = n else {
//~^ ERROR a `&&` expression cannot be directly assigned in `let...else`
- //~| ERROR `let` expressions are not supported here
//~| ERROR mismatched types
//~| ERROR mismatched types
//~| ERROR expected expression, found `let` statement
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.stderr
index 9bc3e7541..0442f1218 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.stderr
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.stderr
@@ -14,6 +14,8 @@ error: expected expression, found `let` statement
|
LL | let Some(n) = opt && let another = n else {
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: a `&&` expression cannot be directly assigned in `let...else`
--> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:15:19
@@ -27,13 +29,13 @@ LL | let Some(n) = (opt && let another = n) else {
| + +
error: this `if` expression is missing a block after the condition
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:24:5
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:23:5
|
LL | if let Some(n) = opt else {
| ^^
|
help: add a block here
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:24:25
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:23:25
|
LL | if let Some(n) = opt else {
| ^
@@ -44,31 +46,31 @@ LL + let Some(n) = opt else {
|
error: this `if` expression is missing a block after the condition
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:28:5
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:27:5
|
LL | if let Some(n) = opt && n == 1 else {
| ^^
|
help: add a block here
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:28:35
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:27:35
|
LL | if let Some(n) = opt && n == 1 else {
| ^
error: this `if` expression is missing a block after the condition
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:32:5
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:31:5
|
LL | if let Some(n) = opt && let another = n else {
| ^^
|
help: add a block here
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:32:44
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:31:44
|
LL | if let Some(n) = opt && let another = n else {
| ^
error: expected `{`, found keyword `else`
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:38:33
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:37:33
|
LL | while let Some(n) = opt else {
| ----- ----------------- ^^^^ expected `{`
@@ -77,7 +79,7 @@ LL | while let Some(n) = opt else {
| while parsing the body of this `while` expression
error: expected `{`, found keyword `else`
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:44:43
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:43:43
|
LL | while let Some(n) = opt && n == 1 else {
| ----- --------------------------- ^^^^ expected `{`
@@ -86,7 +88,7 @@ LL | while let Some(n) = opt && n == 1 else {
| while parsing the body of this `while` expression
error: expected `{`, found keyword `else`
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:50:52
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:49:52
|
LL | while let Some(n) = opt && let another = n else {
| ----- ------------------------------------ ^^^^ expected `{`
@@ -94,14 +96,6 @@ LL | while let Some(n) = opt && let another = n else {
| | this `while` condition successfully parsed
| while parsing the body of this `while` expression
-error: `let` expressions are not supported here
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:15:26
- |
-LL | let Some(n) = opt && let another = n else {
- | ^^^^^^^^^^^^^^^
- |
- = note: only supported directly in conditions of `if` and `while` expressions
-
error[E0308]: mismatched types
--> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:9:19
|
@@ -142,6 +136,6 @@ LL | let Some(n) = opt && let another = n else {
= note: expected type `bool`
found enum `Option<_>`
-error: aborting due to 14 previous errors
+error: aborting due to 13 previous errors
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs
index 2b407ef51..bca7564ef 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs
@@ -43,8 +43,7 @@ fn _macros() {
macro_rules! noop_expr { ($e:expr) => {}; }
noop_expr!((let 0 = 1));
- //~^ ERROR `let` expressions in this position are unstable [E0658]
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
macro_rules! use_expr {
($e:expr) => {
@@ -53,8 +52,7 @@ fn _macros() {
}
}
#[cfg(FALSE)] (let 0 = 1);
- //~^ ERROR `let` expressions in this position are unstable [E0658]
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
use_expr!(let 0 = 1);
//~^ ERROR no rules expected the token `let`
}
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr
index 7a43b71fc..6f7473675 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr
@@ -1,17 +1,21 @@
error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:55:20
+ --> $DIR/feature-gate.rs:54:20
|
LL | #[cfg(FALSE)] (let 0 = 1);
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: expected expression, found `let` statement
--> $DIR/feature-gate.rs:45:17
|
LL | noop_expr!((let 0 = 1));
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: no rules expected the token `let`
- --> $DIR/feature-gate.rs:58:15
+ --> $DIR/feature-gate.rs:56:15
|
LL | macro_rules! use_expr {
| --------------------- when calling this macro
@@ -20,7 +24,7 @@ LL | use_expr!(let 0 = 1);
| ^^^ no rules expected this token in macro call
|
note: while trying to match meta-variable `$e:expr`
- --> $DIR/feature-gate.rs:50:10
+ --> $DIR/feature-gate.rs:49:10
|
LL | ($e:expr) => {
| ^^^^^^^
@@ -97,24 +101,6 @@ LL | while let Range { start: _, end: _ } = (true..true) && false {}
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:55:20
- |
-LL | #[cfg(FALSE)] (let 0 = 1);
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:45:17
- |
-LL | noop_expr!((let 0 = 1));
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error: aborting due to 13 previous errors
+error: aborting due to 11 previous errors
For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.rs
index a942d1f4c..dce1c19ff 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.rs
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.rs
@@ -13,6 +13,7 @@ fn main() {
if let Some(elem) = _opt && [1, 2, 3][let _ = &&let Some(x) = Some(42)] = 1 {
//~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
true
}
}
@@ -31,6 +32,7 @@ fn main() {
{
if let Some(elem) = _opt && [1, 2, 3][let _ = ()] = 1 {
//~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
true
}
}
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.stderr
index d1ce83c72..247fad2e9 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.stderr
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.stderr
@@ -3,36 +3,64 @@ error: expected expression, found `let` statement
|
LL | let _ = &&let Some(x) = Some(42);
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: expected expression, found `let` statement
--> $DIR/invalid-let-in-a-valid-let-context.rs:13:47
|
LL | if let Some(elem) = _opt && [1, 2, 3][let _ = &&let Some(x) = Some(42)] = 1 {
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: expected expression, found `let` statement
--> $DIR/invalid-let-in-a-valid-let-context.rs:13:57
|
LL | if let Some(elem) = _opt && [1, 2, 3][let _ = &&let Some(x) = Some(42)] = 1 {
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/invalid-let-in-a-valid-let-context.rs:13:12
+ |
+LL | if let Some(elem) = _opt && [1, 2, 3][let _ = &&let Some(x) = Some(42)] = 1 {
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: expected expression, found `let` statement
- --> $DIR/invalid-let-in-a-valid-let-context.rs:23:23
+ --> $DIR/invalid-let-in-a-valid-let-context.rs:24:23
|
LL | [1, 2, 3][let _ = ()];
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: expected expression, found `let` statement
- --> $DIR/invalid-let-in-a-valid-let-context.rs:32:47
+ --> $DIR/invalid-let-in-a-valid-let-context.rs:33:47
|
LL | if let Some(elem) = _opt && [1, 2, 3][let _ = ()] = 1 {
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/invalid-let-in-a-valid-let-context.rs:33:12
+ |
+LL | if let Some(elem) = _opt && [1, 2, 3][let _ = ()] = 1 {
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: expected expression, found `let` statement
- --> $DIR/invalid-let-in-a-valid-let-context.rs:40:21
+ --> $DIR/invalid-let-in-a-valid-let-context.rs:42:21
|
LL | let x = let y = 1;
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
-error: aborting due to 6 previous errors
+error: aborting due to 8 previous errors
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
index 4fcfe9d47..ad11c090f 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `T: Foo` is not satisfied
- --> $DIR/assoc-type-const-bound-usage.rs:12:5
+ --> $DIR/assoc-type-const-bound-usage.rs:12:6
|
LL | <T as Foo>::Assoc::foo();
- | ^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `T`
+ | ^ the trait `Foo` is not implemented for `T`
|
help: consider further restricting this bound
|
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr
index 2d9c49af8..452bf757d 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `u32: ~const Plus` is not satisfied
- --> $DIR/call-const-trait-method-fail.rs:25:7
+ --> $DIR/call-const-trait-method-fail.rs:25:5
|
LL | a.plus(b)
- | ^^^^ the trait `Plus` is not implemented for `u32`
+ | ^ the trait `Plus` is not implemented for `u32`
|
= help: the trait `Plus` is implemented for `u32`
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs
index 2c99d8bf1..15f062edf 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs
@@ -1,4 +1,5 @@
-// check-pass
+// known-bug: #110395
+// FIXME check-pass
#![feature(const_trait_impl, const_closures)]
#![allow(incomplete_features)]
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.stderr
new file mode 100644
index 000000000..f25390a90
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.stderr
@@ -0,0 +1,8 @@
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closure-parse-not-item.rs:7:32
+ |
+LL | const fn test() -> impl ~const Fn() {
+ | ^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr
index 96ffca651..4c45b0e56 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr
@@ -1,15 +1,8 @@
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/const-closure-trait-method-fail.rs:15:5
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closure-trait-method-fail.rs:14:39
|
-LL | x(())
- | ^^^^^
- |
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
- |
-LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32 + ~const std::ops::FnOnce<((),)>>(x: T) -> i32 {
- | ++++++++++++++++++++++++++++++++
+LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
+ | ^^^^^^^^^^^^^^^^^
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr
index fd0c29118..a8ef244ea 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr
@@ -1,15 +1,8 @@
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/const-closure-trait-method.rs:15:5
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closure-trait-method.rs:14:39
|
-LL | x(())
- | ^^^^^
- |
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
- |
-LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32 + ~const std::ops::FnOnce<((),)>>(x: T) -> i32 {
- | ++++++++++++++++++++++++++++++++
+LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
+ | ^^^^^^^^^^^^^^^^^
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr
index abf2a2dc5..6d61b23e4 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr
@@ -1,39 +1,26 @@
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/const-closures.rs:12:5
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closures.rs:8:19
|
-LL | f() * 7
- | ^^^
- |
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
- |
-LL | F: ~const FnOnce() -> u8 + ~const std::ops::Fn<()>,
- | +++++++++++++++++++++++++
+LL | F: ~const FnOnce() -> u8,
+ | ^^^^^^^^^^^^^^
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/const-closures.rs:24:5
- |
-LL | f() + f()
- | ^^^
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closures.rs:9:19
|
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
- |
-LL | const fn answer<F: ~const Fn() -> u8 + ~const std::ops::Fn<()>>(f: &F) -> u8 {
- | +++++++++++++++++++++++++
+LL | F: ~const FnMut() -> u8,
+ | ^^^^^^^^^^^^^
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/const-closures.rs:24:11
- |
-LL | f() + f()
- | ^^^
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closures.rs:10:19
|
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
+LL | F: ~const Fn() -> u8,
+ | ^^^^^^^^^^
+
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closures.rs:23:27
|
-LL | const fn answer<F: ~const Fn() -> u8 + ~const std::ops::Fn<()>>(f: &F) -> u8 {
- | +++++++++++++++++++++++++
+LL | const fn answer<F: ~const Fn() -> u8>(f: &F) -> u8 {
+ | ^^^^^^^^^^
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors
-For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/fallback.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/fallback.rs
new file mode 100644
index 000000000..da2778f61
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/fallback.rs
@@ -0,0 +1,16 @@
+// check-pass
+
+#![feature(effects)]
+
+pub const fn owo() {}
+
+fn main() {
+ // make sure falling back ty/int vars doesn't cause const fallback to be skipped...
+ // See issue: 115791.
+ let _ = 1;
+ if false {
+ let x = panic!();
+ }
+
+ let _ = owo;
+}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/infer-fallback.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/infer-fallback.rs
new file mode 100644
index 000000000..2f474d978
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/infer-fallback.rs
@@ -0,0 +1,11 @@
+// check-pass
+#![feature(const_trait_impl, effects)]
+
+const fn a() {}
+
+fn foo<F: FnOnce()>(a: F) {}
+
+fn main() {
+ let _ = a;
+ foo(a);
+}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr
index e8d0eec02..c94563d35 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: ~const Bar` is not satisfied
--> $DIR/trait-where-clause-const.rs:21:5
|
LL | T::b();
- | ^^^^ the trait `Bar` is not implemented for `T`
+ | ^ the trait `Bar` is not implemented for `T`
|
note: required by a bound in `Foo::b`
--> $DIR/trait-where-clause-const.rs:15:24
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr
index 11f0c4016..255878e17 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: Bar` is not satisfied
--> $DIR/trait-where-clause.rs:14:5
|
LL | T::b();
- | ^^^^ the trait `Bar` is not implemented for `T`
+ | ^ the trait `Bar` is not implemented for `T`
|
note: required by a bound in `Foo::b`
--> $DIR/trait-where-clause.rs:8:24
diff --git a/tests/ui/rmeta/auxiliary/rmeta-meta.rs b/tests/ui/rmeta/auxiliary/rmeta-meta.rs
index 6d8ed95bd..6d4350495 100644
--- a/tests/ui/rmeta/auxiliary/rmeta-meta.rs
+++ b/tests/ui/rmeta/auxiliary/rmeta-meta.rs
@@ -6,3 +6,7 @@
pub struct Foo {
pub field: i32,
}
+
+pub fn missing_optimized_mir() {
+ println!("indeed");
+}
diff --git a/tests/ui/rmeta/no_optitimized_mir.rs b/tests/ui/rmeta/no_optitimized_mir.rs
new file mode 100644
index 000000000..c503005f1
--- /dev/null
+++ b/tests/ui/rmeta/no_optitimized_mir.rs
@@ -0,0 +1,11 @@
+// aux-build:rmeta-meta.rs
+// no-prefer-dynamic
+// build-fail
+
+// Check that we do not ICE when we need optimized MIR but it is missing.
+
+extern crate rmeta_meta;
+
+fn main() {
+ rmeta_meta::missing_optimized_mir();
+}
diff --git a/tests/ui/rmeta/no_optitimized_mir.stderr b/tests/ui/rmeta/no_optitimized_mir.stderr
new file mode 100644
index 000000000..a17024c53
--- /dev/null
+++ b/tests/ui/rmeta/no_optitimized_mir.stderr
@@ -0,0 +1,10 @@
+error: missing optimized MIR for an item in the crate `rmeta_meta`
+ |
+note: missing optimized MIR for this item (was the crate `rmeta_meta` compiled with `--emit=metadata`?)
+ --> $DIR/auxiliary/rmeta-meta.rs:10:1
+ |
+LL | pub fn missing_optimized_mir() {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/rust-2018/trait-import-suggestions.rs b/tests/ui/rust-2018/trait-import-suggestions.rs
index 9c67c3f4b..900b3d093 100644
--- a/tests/ui/rust-2018/trait-import-suggestions.rs
+++ b/tests/ui/rust-2018/trait-import-suggestions.rs
@@ -1,6 +1,6 @@
// edition:2018
// aux-build:trait-import-suggestions.rs
-// compile-flags:--extern trait-import-suggestions
+// compile-flags:--extern trait_import_suggestions
mod foo {
mod foobar {
diff --git a/tests/ui/sanitize/cfg.rs b/tests/ui/sanitize/cfg.rs
index c0f08a6d1..761c646ec 100644
--- a/tests/ui/sanitize/cfg.rs
+++ b/tests/ui/sanitize/cfg.rs
@@ -1,23 +1,31 @@
// Verifies that when compiling with -Zsanitizer=option,
// the `#[cfg(sanitize = "option")]` attribute is configured.
-// needs-sanitizer-support
-// needs-sanitizer-address
-// needs-sanitizer-cfi
-// needs-sanitizer-kcfi
-// needs-sanitizer-leak
-// needs-sanitizer-memory
-// needs-sanitizer-thread
// check-pass
-// revisions: address leak memory thread
+// revisions: address cfi kcfi leak memory thread
+//compile-flags: -Ctarget-feature=-crt-static
+//[address]needs-sanitizer-address
//[address]compile-flags: -Zsanitizer=address --cfg address
+//[cfi]needs-sanitizer-cfi
//[cfi]compile-flags: -Zsanitizer=cfi --cfg cfi
-//[kcfi]compile-flags: -Zsanitizer=kcfi --cfg kcfi
+//[cfi]compile-flags: -Clto -Ccodegen-units=1
+//[kcfi]needs-llvm-components: x86
+//[kcfi]compile-flags: -Zsanitizer=kcfi --cfg kcfi --target x86_64-unknown-none
+//[leak]needs-sanitizer-leak
//[leak]compile-flags: -Zsanitizer=leak --cfg leak
+//[memory]needs-sanitizer-memory
//[memory]compile-flags: -Zsanitizer=memory --cfg memory
+//[thread]needs-sanitizer-thread
//[thread]compile-flags: -Zsanitizer=thread --cfg thread
-#![feature(cfg_sanitize)]
+#![feature(cfg_sanitize, no_core, lang_items)]
+#![crate_type="lib"]
+#![no_core]
+
+#[lang="sized"]
+trait Sized { }
+#[lang="copy"]
+trait Copy { }
#[cfg(all(sanitize = "address", address))]
fn main() {}
@@ -36,3 +44,7 @@ fn main() {}
#[cfg(all(sanitize = "thread", thread))]
fn main() {}
+
+pub fn check() {
+ main();
+}
diff --git a/tests/ui/self/class-missing-self.stderr b/tests/ui/self/class-missing-self.stderr
index 3c37d8197..ca7a89620 100644
--- a/tests/ui/self/class-missing-self.stderr
+++ b/tests/ui/self/class-missing-self.stderr
@@ -2,7 +2,12 @@ error[E0425]: cannot find value `meows` in this scope
--> $DIR/class-missing-self.rs:9:7
|
LL | meows += 1;
- | ^^^^^ help: you might have meant to use the available field: `self.meows`
+ | ^^^^^
+ |
+help: you might have meant to use the available field
+ |
+LL | self.meows += 1;
+ | +++++
error[E0425]: cannot find function `sleep` in this scope
--> $DIR/class-missing-self.rs:10:7
@@ -10,7 +15,7 @@ error[E0425]: cannot find function `sleep` in this scope
LL | sleep();
| ^^^^^ not found in this scope
|
-help: consider using the associated function
+help: consider using the method on `Self`
|
LL | self.sleep();
| +++++
diff --git a/tests/ui/simd/intrinsic/generic-elements.rs b/tests/ui/simd/intrinsic/generic-elements.rs
index 0ff2203ec..6ba93e46f 100644
--- a/tests/ui/simd/intrinsic/generic-elements.rs
+++ b/tests/ui/simd/intrinsic/generic-elements.rs
@@ -1,6 +1,7 @@
// build-fail
-#![feature(repr_simd, platform_intrinsics, rustc_attrs)]
+#![feature(repr_simd, platform_intrinsics, rustc_attrs, adt_const_params)]
+#![allow(incomplete_features)]
#[repr(simd)]
#[derive(Copy, Clone)]
@@ -35,6 +36,7 @@ extern "platform-intrinsic" {
fn simd_extract<T, E>(x: T, idx: u32) -> E;
fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U;
+ fn simd_shuffle_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U;
}
fn main() {
@@ -71,5 +73,29 @@ fn main() {
//~^ ERROR expected return type of length 4, found `i32x8` with length 8
simd_shuffle::<_, _, i32x2>(x, x, IDX8);
//~^ ERROR expected return type of length 8, found `i32x2` with length 2
+
+ const I2: &[u32] = &[0; 2];
+ simd_shuffle_generic::<i32, i32, I2>(0, 0);
+ //~^ ERROR expected SIMD input type, found non-SIMD `i32`
+ const I4: &[u32] = &[0; 4];
+ simd_shuffle_generic::<i32, i32, I4>(0, 0);
+ //~^ ERROR expected SIMD input type, found non-SIMD `i32`
+ const I8: &[u32] = &[0; 8];
+ simd_shuffle_generic::<i32, i32, I8>(0, 0);
+ //~^ ERROR expected SIMD input type, found non-SIMD `i32`
+
+ simd_shuffle_generic::<_, f32x2, I2>(x, x);
+//~^ ERROR element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32`
+ simd_shuffle_generic::<_, f32x4, I4>(x, x);
+//~^ ERROR element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32`
+ simd_shuffle_generic::<_, f32x8, I8>(x, x);
+//~^ ERROR element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32`
+
+ simd_shuffle_generic::<_, i32x8, I2>(x, x);
+ //~^ ERROR expected return type of length 2, found `i32x8` with length 8
+ simd_shuffle_generic::<_, i32x8, I4>(x, x);
+ //~^ ERROR expected return type of length 4, found `i32x8` with length 8
+ simd_shuffle_generic::<_, i32x2, I8>(x, x);
+ //~^ ERROR expected return type of length 8, found `i32x2` with length 2
}
}
diff --git a/tests/ui/simd/intrinsic/generic-elements.stderr b/tests/ui/simd/intrinsic/generic-elements.stderr
index 115d9d4b3..26e013449 100644
--- a/tests/ui/simd/intrinsic/generic-elements.stderr
+++ b/tests/ui/simd/intrinsic/generic-elements.stderr
@@ -1,75 +1,129 @@
error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/generic-elements.rs:44:9
+ --> $DIR/generic-elements.rs:46:9
|
LL | simd_insert(0, 0, 0);
| ^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected inserted type `i32` (element of input `i32x4`), found `f64`
- --> $DIR/generic-elements.rs:46:9
+ --> $DIR/generic-elements.rs:48:9
|
LL | simd_insert(x, 0, 1.0);
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_extract` intrinsic: expected return type `i32` (element of input `i32x4`), found `f32`
- --> $DIR/generic-elements.rs:48:9
+ --> $DIR/generic-elements.rs:50:9
|
LL | simd_extract::<_, f32>(x, 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/generic-elements.rs:52:9
+ --> $DIR/generic-elements.rs:54:9
|
LL | simd_shuffle::<i32, _, i32>(0, 0, IDX2);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/generic-elements.rs:55:9
+ --> $DIR/generic-elements.rs:57:9
|
LL | simd_shuffle::<i32, _, i32>(0, 0, IDX4);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/generic-elements.rs:58:9
+ --> $DIR/generic-elements.rs:60:9
|
LL | simd_shuffle::<i32, _, i32>(0, 0, IDX8);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32`
- --> $DIR/generic-elements.rs:61:9
+ --> $DIR/generic-elements.rs:63:9
|
LL | simd_shuffle::<_, _, f32x2>(x, x, IDX2);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32`
- --> $DIR/generic-elements.rs:63:9
+ --> $DIR/generic-elements.rs:65:9
|
LL | simd_shuffle::<_, _, f32x4>(x, x, IDX4);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32`
- --> $DIR/generic-elements.rs:65:9
+ --> $DIR/generic-elements.rs:67:9
|
LL | simd_shuffle::<_, _, f32x8>(x, x, IDX8);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 2, found `i32x8` with length 8
- --> $DIR/generic-elements.rs:68:9
+ --> $DIR/generic-elements.rs:70:9
|
LL | simd_shuffle::<_, _, i32x8>(x, x, IDX2);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 4, found `i32x8` with length 8
- --> $DIR/generic-elements.rs:70:9
+ --> $DIR/generic-elements.rs:72:9
|
LL | simd_shuffle::<_, _, i32x8>(x, x, IDX4);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 8, found `i32x2` with length 2
- --> $DIR/generic-elements.rs:72:9
+ --> $DIR/generic-elements.rs:74:9
|
LL | simd_shuffle::<_, _, i32x2>(x, x, IDX8);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: aborting due to 12 previous errors
+error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/generic-elements.rs:78:9
+ |
+LL | simd_shuffle_generic::<i32, i32, I2>(0, 0);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/generic-elements.rs:81:9
+ |
+LL | simd_shuffle_generic::<i32, i32, I4>(0, 0);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/generic-elements.rs:84:9
+ |
+LL | simd_shuffle_generic::<i32, i32, I8>(0, 0);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32`
+ --> $DIR/generic-elements.rs:87:9
+ |
+LL | simd_shuffle_generic::<_, f32x2, I2>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32`
+ --> $DIR/generic-elements.rs:89:9
+ |
+LL | simd_shuffle_generic::<_, f32x4, I4>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32`
+ --> $DIR/generic-elements.rs:91:9
+ |
+LL | simd_shuffle_generic::<_, f32x8, I8>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return type of length 2, found `i32x8` with length 8
+ --> $DIR/generic-elements.rs:94:9
+ |
+LL | simd_shuffle_generic::<_, i32x8, I2>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return type of length 4, found `i32x8` with length 8
+ --> $DIR/generic-elements.rs:96:9
+ |
+LL | simd_shuffle_generic::<_, i32x8, I4>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return type of length 8, found `i32x2` with length 2
+ --> $DIR/generic-elements.rs:98:9
+ |
+LL | simd_shuffle_generic::<_, i32x2, I8>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 21 previous errors
For more information about this error, try `rustc --explain E0511`.
diff --git a/tests/ui/simd/monomorphize-shuffle-index.generic.stderr b/tests/ui/simd/monomorphize-shuffle-index.generic.stderr
new file mode 100644
index 000000000..fc66b1956
--- /dev/null
+++ b/tests/ui/simd/monomorphize-shuffle-index.generic.stderr
@@ -0,0 +1,12 @@
+error: overly complex generic constant
+ --> $DIR/monomorphize-shuffle-index.rs:29:45
+ |
+LL | return simd_shuffle_generic::<_, _, { &Self::I }>(a, b);
+ | ^^--------^^
+ | |
+ | pointer casts are not allowed in generic constants
+ |
+ = help: consider moving this anonymous constant into a `const` function
+
+error: aborting due to previous error
+
diff --git a/tests/ui/simd/monomorphize-shuffle-index.rs b/tests/ui/simd/monomorphize-shuffle-index.rs
index 2467baa08..db7953f06 100644
--- a/tests/ui/simd/monomorphize-shuffle-index.rs
+++ b/tests/ui/simd/monomorphize-shuffle-index.rs
@@ -1,8 +1,14 @@
-//run-pass
-#![feature(repr_simd, platform_intrinsics)]
+//[old]run-pass
+//[generic_with_fn]run-pass
+// revisions: old generic generic_with_fn
+#![feature(repr_simd, platform_intrinsics, adt_const_params, generic_const_exprs)]
+#![allow(incomplete_features)]
extern "platform-intrinsic" {
+ #[cfg(old)]
fn simd_shuffle<T, I, U>(a: T, b: T, i: I) -> U;
+ #[cfg(any(generic, generic_with_fn))]
+ fn simd_shuffle_generic<T, U, const I: &'static [u32]>(a: T, b: T) -> U;
}
#[derive(Copy, Clone)]
@@ -11,12 +17,24 @@ struct Simd<T, const N: usize>([T; N]);
trait Shuffle<const N: usize> {
const I: [u32; N];
-
- unsafe fn shuffle<T, const M: usize>(&self, a: Simd<T, M>, b: Simd<T, M>) -> Simd<T, N> {
- simd_shuffle(a, b, Self::I)
+ const J: &'static [u32] = &Self::I;
+
+ unsafe fn shuffle<T, const M: usize>(&self, a: Simd<T, M>, b: Simd<T, M>) -> Simd<T, N>
+ where
+ Thing<{ Self::J }>:,
+ {
+ #[cfg(old)]
+ return simd_shuffle(a, b, Self::I);
+ #[cfg(generic)]
+ return simd_shuffle_generic::<_, _, { &Self::I }>(a, b);
+ //[generic]~^ overly complex generic constant
+ #[cfg(generic_with_fn)]
+ return simd_shuffle_generic::<_, _, { Self::J }>(a, b);
}
}
+struct Thing<const X: &'static [u32]>;
+
fn main() {
struct I1;
impl Shuffle<4> for I1 {
diff --git a/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr b/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr
index ba8da2e75..29a606c4f 100644
--- a/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr
+++ b/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr
@@ -42,7 +42,7 @@ LL | f(Box::new(|a| {
| --- captured by this `FnMut` closure
LL |
LL | foo(f);
- | ^ move occurs because `f` has type `[closure@$DIR/borrowck-call-is-borrow-issue-12224.rs:52:17: 52:58]`, which does not implement the `Copy` trait
+ | ^ move occurs because `f` has type `{closure@$DIR/borrowck-call-is-borrow-issue-12224.rs:52:17: 52:58}`, which does not implement the `Copy` trait
error[E0505]: cannot move out of `f` because it is borrowed
--> $DIR/borrowck-call-is-borrow-issue-12224.rs:55:16
diff --git a/tests/ui/span/issue-29595.stderr b/tests/ui/span/issue-29595.stderr
index 92445e407..7d603cdbf 100644
--- a/tests/ui/span/issue-29595.stderr
+++ b/tests/ui/span/issue-29595.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `u8: Tr` is not satisfied
|
LL | let a: u8 = Tr::C;
| ^^^^^ the trait `Tr` is not implemented for `u8`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-29595.rs:1:1
+ |
+LL | trait Tr {
+ | ^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/span/move-closure.stderr b/tests/ui/span/move-closure.stderr
index dcc607896..2127b8202 100644
--- a/tests/ui/span/move-closure.stderr
+++ b/tests/ui/span/move-closure.stderr
@@ -7,7 +7,7 @@ LL | let x: () = move || ();
| expected due to this
|
= note: expected unit type `()`
- found closure `[closure@$DIR/move-closure.rs:5:17: 5:24]`
+ found closure `{closure@$DIR/move-closure.rs:5:17: 5:24}`
help: use parentheses to call this closure
|
LL | let x: () = (move || ())();
diff --git a/tests/ui/span/send-is-not-static-std-sync.rs b/tests/ui/span/send-is-not-static-std-sync.rs
index f8ab5243c..9c1ee2871 100644
--- a/tests/ui/span/send-is-not-static-std-sync.rs
+++ b/tests/ui/span/send-is-not-static-std-sync.rs
@@ -46,7 +46,7 @@ fn channel() {
tx.send(&z).unwrap();
}
//~^^ ERROR `z` does not live long enough
- // (channels lack #[may_dangle], thus their dtors are implicit uses of `z`)
+ tx.use_ref(); // (channel drop glue does not use `z` => needs explicit use)
}
fn main() {}
diff --git a/tests/ui/span/send-is-not-static-std-sync.stderr b/tests/ui/span/send-is-not-static-std-sync.stderr
index eaba415ad..46534b391 100644
--- a/tests/ui/span/send-is-not-static-std-sync.stderr
+++ b/tests/ui/span/send-is-not-static-std-sync.stderr
@@ -75,11 +75,9 @@ LL | tx.send(&z).unwrap();
| ^^ borrowed value does not live long enough
LL | }
| - `z` dropped here while still borrowed
-...
-LL | }
- | - borrow might be used here, when `tx` is dropped and runs the `Drop` code for type `Sender`
- |
- = note: values in a scope are dropped in the opposite order they are defined
+LL |
+LL | tx.use_ref(); // (channel drop glue does not use `z` => needs explicit use)
+ | -- borrow later used here
error: aborting due to 6 previous errors
diff --git a/tests/ui/specialization/issue-38091.stderr b/tests/ui/specialization/issue-38091.stderr
index f2210a407..4d840482b 100644
--- a/tests/ui/specialization/issue-38091.stderr
+++ b/tests/ui/specialization/issue-38091.stderr
@@ -14,6 +14,11 @@ error[E0277]: the trait bound `(): Valid` is not satisfied
LL | default type Ty = ();
| ^^ the trait `Valid` is not implemented for `()`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-38091.rs:20:1
+ |
+LL | trait Valid {}
+ | ^^^^^^^^^^^
note: required by a bound in `Iterate::Ty`
--> $DIR/issue-38091.rs:5:14
|
diff --git a/tests/ui/specialization/specialization-default-types.stderr b/tests/ui/specialization/specialization-default-types.stderr
index ecccf29a1..774ac9536 100644
--- a/tests/ui/specialization/specialization-default-types.stderr
+++ b/tests/ui/specialization/specialization-default-types.stderr
@@ -12,7 +12,7 @@ error[E0308]: mismatched types
--> $DIR/specialization-default-types.rs:15:9
|
LL | default type Output = Box<T>;
- | ----------------------------- expected this associated type
+ | ----------------------------- associated type is `default` and may be overridden
LL | default fn generate(self) -> Self::Output {
| ------------ expected `<T as Example>::Output` because of return type
LL | Box::new(self)
diff --git a/tests/ui/static/static-reference-to-fn-1.stderr b/tests/ui/static/static-reference-to-fn-1.stderr
index b68352b51..86c4eaa7e 100644
--- a/tests/ui/static/static-reference-to-fn-1.stderr
+++ b/tests/ui/static/static-reference-to-fn-1.stderr
@@ -7,7 +7,6 @@ LL | func: &foo,
= note: expected reference `&fn() -> Option<isize>`
found reference `&fn() -> Option<isize> {foo}`
= note: fn items are distinct from fn pointers
- = note: when the arguments and return types match, functions can be coerced to function pointers
help: consider casting to a fn pointer
|
LL | func: &(foo as fn() -> Option<isize>),
diff --git a/tests/ui/stats/hir-stats.stderr b/tests/ui/stats/hir-stats.stderr
index d723ff538..813e65e45 100644
--- a/tests/ui/stats/hir-stats.stderr
+++ b/tests/ui/stats/hir-stats.stderr
@@ -146,33 +146,33 @@ hir-stats - Trait 192 ( 2.1%) 4
hir-stats WherePredicate 192 ( 2.1%) 3 64
hir-stats - BoundPredicate 192 ( 2.1%) 3
hir-stats Block 288 ( 3.2%) 6 48
-hir-stats Pat 360 ( 4.0%) 5 72
+hir-stats Pat 360 ( 3.9%) 5 72
hir-stats - Wild 72 ( 0.8%) 1
hir-stats - Struct 72 ( 0.8%) 1
hir-stats - Binding 216 ( 2.4%) 3
hir-stats GenericParam 400 ( 4.4%) 5 80
-hir-stats Generics 560 ( 6.2%) 10 56
-hir-stats Ty 720 ( 8.0%) 15 48
+hir-stats Generics 560 ( 6.1%) 10 56
+hir-stats Ty 720 ( 7.9%) 15 48
hir-stats - Ptr 48 ( 0.5%) 1
hir-stats - Ref 48 ( 0.5%) 1
-hir-stats - Path 624 ( 6.9%) 13
-hir-stats Expr 768 ( 8.5%) 12 64
+hir-stats - Path 624 ( 6.8%) 13
+hir-stats Expr 768 ( 8.4%) 12 64
hir-stats - Path 64 ( 0.7%) 1
hir-stats - Struct 64 ( 0.7%) 1
hir-stats - Match 64 ( 0.7%) 1
hir-stats - InlineAsm 64 ( 0.7%) 1
hir-stats - Lit 128 ( 1.4%) 2
hir-stats - Block 384 ( 4.2%) 6
-hir-stats Item 880 ( 9.7%) 11 80
-hir-stats - Trait 80 ( 0.9%) 1
-hir-stats - Enum 80 ( 0.9%) 1
-hir-stats - ExternCrate 80 ( 0.9%) 1
-hir-stats - ForeignMod 80 ( 0.9%) 1
-hir-stats - Impl 80 ( 0.9%) 1
-hir-stats - Fn 160 ( 1.8%) 2
-hir-stats - Use 320 ( 3.5%) 4
-hir-stats Path 1_240 (13.7%) 31 40
-hir-stats PathSegment 1_920 (21.2%) 40 48
+hir-stats Item 968 (10.6%) 11 88
+hir-stats - Trait 88 ( 1.0%) 1
+hir-stats - Enum 88 ( 1.0%) 1
+hir-stats - ExternCrate 88 ( 1.0%) 1
+hir-stats - ForeignMod 88 ( 1.0%) 1
+hir-stats - Impl 88 ( 1.0%) 1
+hir-stats - Fn 176 ( 1.9%) 2
+hir-stats - Use 352 ( 3.9%) 4
+hir-stats Path 1_240 (13.6%) 31 40
+hir-stats PathSegment 1_920 (21.0%) 40 48
hir-stats ----------------------------------------------------------------
-hir-stats Total 9_048
+hir-stats Total 9_136
hir-stats
diff --git a/tests/ui/stats/meta-stats.rs b/tests/ui/stats/meta-stats.rs
new file mode 100644
index 000000000..2d38e0882
--- /dev/null
+++ b/tests/ui/stats/meta-stats.rs
@@ -0,0 +1,7 @@
+// build-pass
+// dont-check-compiler-stderr
+// compile-flags: -Zmeta-stats
+
+#![crate_type = "lib"]
+
+pub fn a() {}
diff --git a/tests/ui/issues/issue-17431-6.rs b/tests/ui/structs-enums/enum-rec/issue-17431-6.rs
index b7e49873d..b7e49873d 100644
--- a/tests/ui/issues/issue-17431-6.rs
+++ b/tests/ui/structs-enums/enum-rec/issue-17431-6.rs
diff --git a/tests/ui/issues/issue-17431-6.stderr b/tests/ui/structs-enums/enum-rec/issue-17431-6.stderr
index e0a822550..e0a822550 100644
--- a/tests/ui/issues/issue-17431-6.stderr
+++ b/tests/ui/structs-enums/enum-rec/issue-17431-6.stderr
diff --git a/tests/ui/issues/issue-17431-7.rs b/tests/ui/structs-enums/enum-rec/issue-17431-7.rs
index 4fd786278..4fd786278 100644
--- a/tests/ui/issues/issue-17431-7.rs
+++ b/tests/ui/structs-enums/enum-rec/issue-17431-7.rs
diff --git a/tests/ui/issues/issue-17431-7.stderr b/tests/ui/structs-enums/enum-rec/issue-17431-7.stderr
index ecf072b8e..ecf072b8e 100644
--- a/tests/ui/issues/issue-17431-7.stderr
+++ b/tests/ui/structs-enums/enum-rec/issue-17431-7.stderr
diff --git a/tests/ui/structs-enums/rec-align-u32.rs b/tests/ui/structs-enums/rec-align-u32.rs
index ee704198d..b3c323d2a 100644
--- a/tests/ui/structs-enums/rec-align-u32.rs
+++ b/tests/ui/structs-enums/rec-align-u32.rs
@@ -3,7 +3,7 @@
#![allow(unused_unsafe)]
// Issue #2303
-#![feature(intrinsics)]
+#![feature(intrinsics, rustc_attrs)]
use std::mem;
diff --git a/tests/ui/structs-enums/rec-align-u64.rs b/tests/ui/structs-enums/rec-align-u64.rs
index f21c9b2c8..de008bcc0 100644
--- a/tests/ui/structs-enums/rec-align-u64.rs
+++ b/tests/ui/structs-enums/rec-align-u64.rs
@@ -5,7 +5,7 @@
// Issue #2303
-#![feature(intrinsics)]
+#![feature(intrinsics, rustc_attrs)]
use std::mem;
@@ -37,6 +37,7 @@ struct Outer {
target_os = "emscripten",
target_os = "freebsd",
target_os = "fuchsia",
+ target_os = "hurd",
target_os = "illumos",
target_os = "linux",
target_os = "macos",
diff --git a/tests/ui/issues/issue-17431-1.rs b/tests/ui/structs-enums/struct-rec/issue-17431-1.rs
index 3b692cc0e..3b692cc0e 100644
--- a/tests/ui/issues/issue-17431-1.rs
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-1.rs
diff --git a/tests/ui/issues/issue-17431-1.stderr b/tests/ui/structs-enums/struct-rec/issue-17431-1.stderr
index e3af8976c..e3af8976c 100644
--- a/tests/ui/issues/issue-17431-1.stderr
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-1.stderr
diff --git a/tests/ui/issues/issue-17431-2.rs b/tests/ui/structs-enums/struct-rec/issue-17431-2.rs
index f7b9c6a55..f7b9c6a55 100644
--- a/tests/ui/issues/issue-17431-2.rs
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-2.rs
diff --git a/tests/ui/issues/issue-17431-2.stderr b/tests/ui/structs-enums/struct-rec/issue-17431-2.stderr
index 39a99ec1e..39a99ec1e 100644
--- a/tests/ui/issues/issue-17431-2.stderr
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-2.stderr
diff --git a/tests/ui/issues/issue-17431-3.rs b/tests/ui/structs-enums/struct-rec/issue-17431-3.rs
index 83a63a88b..83a63a88b 100644
--- a/tests/ui/issues/issue-17431-3.rs
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-3.rs
diff --git a/tests/ui/issues/issue-17431-3.stderr b/tests/ui/structs-enums/struct-rec/issue-17431-3.stderr
index 394134c78..394134c78 100644
--- a/tests/ui/issues/issue-17431-3.stderr
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-3.stderr
diff --git a/tests/ui/issues/issue-17431-4.rs b/tests/ui/structs-enums/struct-rec/issue-17431-4.rs
index 48f0dba2a..48f0dba2a 100644
--- a/tests/ui/issues/issue-17431-4.rs
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-4.rs
diff --git a/tests/ui/issues/issue-17431-4.stderr b/tests/ui/structs-enums/struct-rec/issue-17431-4.stderr
index 3d141e44b..3d141e44b 100644
--- a/tests/ui/issues/issue-17431-4.stderr
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-4.stderr
diff --git a/tests/ui/issues/issue-17431-5.rs b/tests/ui/structs-enums/struct-rec/issue-17431-5.rs
index 0fd6ee611..0fd6ee611 100644
--- a/tests/ui/issues/issue-17431-5.rs
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-5.rs
diff --git a/tests/ui/issues/issue-17431-5.stderr b/tests/ui/structs-enums/struct-rec/issue-17431-5.stderr
index 44a90a6fe..44a90a6fe 100644
--- a/tests/ui/issues/issue-17431-5.stderr
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-5.stderr
diff --git a/tests/ui/suggestions/assoc-const-as-fn.stderr b/tests/ui/suggestions/assoc-const-as-fn.stderr
index 3b6e947c5..d55d968b6 100644
--- a/tests/ui/suggestions/assoc-const-as-fn.stderr
+++ b/tests/ui/suggestions/assoc-const-as-fn.stderr
@@ -1,10 +1,8 @@
error[E0277]: the trait bound `T: GlUniformScalar` is not satisfied
- --> $DIR/assoc-const-as-fn.rs:14:40
+ --> $DIR/assoc-const-as-fn.rs:14:6
|
LL | <T as GlUniformScalar>::FACTORY(1, value);
- | ------------------------------- ^^^^^ the trait `GlUniformScalar` is not implemented for `T`
- | |
- | required by a bound introduced by this call
+ | ^ the trait `GlUniformScalar` is not implemented for `T`
|
help: consider further restricting this bound
|
diff --git a/tests/ui/suggestions/assoc-const-without-self.stderr b/tests/ui/suggestions/assoc-const-without-self.stderr
index 88d72da70..05528d277 100644
--- a/tests/ui/suggestions/assoc-const-without-self.stderr
+++ b/tests/ui/suggestions/assoc-const-without-self.stderr
@@ -4,7 +4,7 @@ error[E0425]: cannot find value `A_CONST` in this scope
LL | A_CONST
| ^^^^^^^ not found in this scope
|
-help: consider using the associated constant
+help: consider using the associated constant on `Self`
|
LL | Self::A_CONST
| ++++++
diff --git a/tests/ui/suggestions/assoc-type-in-method-return.stderr b/tests/ui/suggestions/assoc-type-in-method-return.stderr
index 202e4a16e..df3828ad4 100644
--- a/tests/ui/suggestions/assoc-type-in-method-return.stderr
+++ b/tests/ui/suggestions/assoc-type-in-method-return.stderr
@@ -2,7 +2,12 @@ error[E0412]: cannot find type `Bla` in this scope
--> $DIR/assoc-type-in-method-return.rs:3:25
|
LL | fn to_bla(&self) -> Bla;
- | ^^^ help: you might have meant to use the associated type: `Self::Bla`
+ | ^^^
+ |
+help: you might have meant to use the associated type
+ |
+LL | fn to_bla(&self) -> Self::Bla;
+ | ++++++
error: aborting due to previous error
diff --git a/tests/ui/suggestions/assoc_fn_without_self.rs b/tests/ui/suggestions/assoc_fn_without_self.rs
index 778d98477..35c16ef3e 100644
--- a/tests/ui/suggestions/assoc_fn_without_self.rs
+++ b/tests/ui/suggestions/assoc_fn_without_self.rs
@@ -17,4 +17,12 @@ impl S {
bar(); //~ ERROR cannot find function `bar` in this scope
baz(2, 3); //~ ERROR cannot find function `baz` in this scope
}
+ fn d(&self) {
+ fn c() {
+ foo(); //~ ERROR cannot find function `foo` in this scope
+ }
+ foo(); //~ ERROR cannot find function `foo` in this scope
+ bar(); //~ ERROR cannot find function `bar` in this scope
+ baz(2, 3); //~ ERROR cannot find function `baz` in this scope
+ }
}
diff --git a/tests/ui/suggestions/assoc_fn_without_self.stderr b/tests/ui/suggestions/assoc_fn_without_self.stderr
index febdd6733..9cee7c7ee 100644
--- a/tests/ui/suggestions/assoc_fn_without_self.stderr
+++ b/tests/ui/suggestions/assoc_fn_without_self.stderr
@@ -4,7 +4,7 @@ error[E0425]: cannot find function `foo` in this scope
LL | foo();
| ^^^ not found in this scope
|
-help: consider using the associated function
+help: consider using the associated function on `Self`
|
LL | Self::foo();
| ++++++
@@ -12,31 +12,68 @@ LL | Self::foo();
error[E0425]: cannot find function `bar` in this scope
--> $DIR/assoc_fn_without_self.rs:17:9
|
+LL | fn bar(&self) {}
+ | --- a method by that name is available on `Self` here
+...
+LL | bar();
+ | ^^^ not found in this scope
+
+error[E0425]: cannot find function `baz` in this scope
+ --> $DIR/assoc_fn_without_self.rs:18:9
+ |
+LL | baz(2, 3);
+ | ^^^ not found in this scope
+ |
+help: consider using the associated function on `Self`
+ |
+LL | Self::baz(2, 3);
+ | ++++++
+
+error[E0425]: cannot find function `foo` in this scope
+ --> $DIR/assoc_fn_without_self.rs:14:13
+ |
+LL | foo();
+ | ^^^ not found in this scope
+
+error[E0425]: cannot find function `foo` in this scope
+ --> $DIR/assoc_fn_without_self.rs:24:9
+ |
+LL | foo();
+ | ^^^ not found in this scope
+ |
+help: consider using the associated function on `Self`
+ |
+LL | Self::foo();
+ | ++++++
+
+error[E0425]: cannot find function `bar` in this scope
+ --> $DIR/assoc_fn_without_self.rs:25:9
+ |
LL | bar();
| ^^^ not found in this scope
|
-help: consider using the associated function
+help: consider using the method on `Self`
|
LL | self.bar();
| +++++
error[E0425]: cannot find function `baz` in this scope
- --> $DIR/assoc_fn_without_self.rs:18:9
+ --> $DIR/assoc_fn_without_self.rs:26:9
|
LL | baz(2, 3);
| ^^^ not found in this scope
|
-help: consider using the associated function
+help: consider using the associated function on `Self`
|
LL | Self::baz(2, 3);
| ++++++
error[E0425]: cannot find function `foo` in this scope
- --> $DIR/assoc_fn_without_self.rs:14:13
+ --> $DIR/assoc_fn_without_self.rs:22:13
|
LL | foo();
| ^^^ not found in this scope
-error: aborting due to 4 previous errors
+error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr b/tests/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr
index 8ed62f854..3065f83ea 100644
--- a/tests/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr
+++ b/tests/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr
@@ -18,16 +18,16 @@ help: use parentheses to call this function
LL | bar(foo());
| ++
-error[E0277]: `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33]` is not a future
+error[E0277]: `{closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33}` is not a future
--> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:12:9
|
LL | bar(async_closure);
- | --- ^^^^^^^^^^^^^ `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33]` is not a future
+ | --- ^^^^^^^^^^^^^ `{closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33}` is not a future
| |
| required by a bound introduced by this call
|
- = help: the trait `Future` is not implemented for closure `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33]`
- = note: [closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33] must be a future or must implement `IntoFuture` to be awaited
+ = help: the trait `Future` is not implemented for closure `{closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33}`
+ = note: {closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33} must be a future or must implement `IntoFuture` to be awaited
note: required by a bound in `bar`
--> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:7:16
|
diff --git a/tests/ui/suggestions/auxiliary/extern-issue-98562.rs b/tests/ui/suggestions/auxiliary/extern-issue-98562.rs
new file mode 100644
index 000000000..948e40549
--- /dev/null
+++ b/tests/ui/suggestions/auxiliary/extern-issue-98562.rs
@@ -0,0 +1,26 @@
+pub trait TraitE {
+ type I3;
+}
+
+pub trait TraitD {
+ type I3;
+}
+
+pub trait TraitC {
+ type I1;
+ type I2;
+}
+
+pub trait TraitB {
+ type Item;
+}
+
+pub trait TraitA<G1, G2, G3> {
+ fn baz<
+ U: TraitC<I1 = G1, I2 = G2> + TraitD<I3 = G3> + TraitE,
+ V: TraitD<I3 = G1>
+ >(_: U, _: V) -> Self
+ where
+ U: TraitB,
+ <U as TraitB>::Item: Copy;
+}
diff --git a/tests/ui/suggestions/call-boxed.stderr b/tests/ui/suggestions/call-boxed.stderr
index 9b31ee07c..11823ff09 100644
--- a/tests/ui/suggestions/call-boxed.stderr
+++ b/tests/ui/suggestions/call-boxed.stderr
@@ -6,10 +6,10 @@ LL | let mut x = 1i32;
LL | let y = Box::new(|| 1);
| -- the found closure
LL | x = y;
- | ^ expected `i32`, found `Box<[closure@call-boxed.rs:3:22]>`
+ | ^ expected `i32`, found `Box<{closure@call-boxed.rs:3:22}>`
|
= note: expected type `i32`
- found struct `Box<[closure@$DIR/call-boxed.rs:3:22: 3:24]>`
+ found struct `Box<{closure@$DIR/call-boxed.rs:3:22: 3:24}>`
help: use parentheses to call this closure
|
LL | x = y();
diff --git a/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr b/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr
index 0232d4c8d..5093448d2 100644
--- a/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr
+++ b/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr
@@ -79,7 +79,7 @@ LL | | }
| |_____^ expected `Pin<Box<...>>`, found `async` block
|
= note: expected struct `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>`
- found `async` block `[async block@$DIR/expected-boxed-future-isnt-pinned.rs:28:5: 30:6]`
+ found `async` block `{async block@$DIR/expected-boxed-future-isnt-pinned.rs:28:5: 30:6}`
help: you need to pin and box this expression
|
LL ~ Box::pin(async {
diff --git a/tests/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr b/tests/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr
index 955148315..75a3ae1a8 100644
--- a/tests/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr
+++ b/tests/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr
@@ -16,11 +16,11 @@ help: use parentheses to call this function
LL | bar(foo());
| ++
-error[E0277]: the trait bound `[closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:21]: T` is not satisfied
+error[E0277]: the trait bound `{closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:21}: T` is not satisfied
--> $DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:19:9
|
LL | bar(closure);
- | --- ^^^^^^^ the trait `T` is not implemented for closure `[closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:21]`
+ | --- ^^^^^^^ the trait `T` is not implemented for closure `{closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:21}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr b/tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr
index a137db8cd..40bb87c8a 100644
--- a/tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr
+++ b/tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr
@@ -271,7 +271,7 @@ LL | let _: usize = closure;
| expected due to this
|
= note: expected type `usize`
- found closure `[closure@$DIR/fn-or-tuple-struct-without-args.rs:45:19: 45:21]`
+ found closure `{closure@$DIR/fn-or-tuple-struct-without-args.rs:45:19: 45:21}`
help: use parentheses to call this closure
|
LL | let _: usize = closure();
diff --git a/tests/ui/suggestions/issue-84973-blacklist.stderr b/tests/ui/suggestions/issue-84973-blacklist.stderr
index 4de9da89c..c8ce146ce 100644
--- a/tests/ui/suggestions/issue-84973-blacklist.stderr
+++ b/tests/ui/suggestions/issue-84973-blacklist.stderr
@@ -31,11 +31,11 @@ LL + #[derive(Clone)]
LL | struct S;
|
-error[E0277]: `[static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:22]` cannot be unpinned
+error[E0277]: `{static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:22}` cannot be unpinned
--> $DIR/issue-84973-blacklist.rs:17:13
|
LL | f_unpin(static || { yield; });
- | ------- ^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `[static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:22]`
+ | ------- ^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `{static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:22}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/suggestions/issue-89333.stderr b/tests/ui/suggestions/issue-89333.stderr
index f73f1147d..4739f11dd 100644
--- a/tests/ui/suggestions/issue-89333.stderr
+++ b/tests/ui/suggestions/issue-89333.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `for<'a> &'a _: Trait` is not satisfied
LL | test(&|| 0);
| ^^^^ the trait `for<'a> Trait` is not implemented for `&'a _`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-89333.rs:9:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `test`
--> $DIR/issue-89333.rs:11:55
|
diff --git a/tests/ui/suggestions/issue-98562.rs b/tests/ui/suggestions/issue-98562.rs
new file mode 100644
index 000000000..de04050d5
--- /dev/null
+++ b/tests/ui/suggestions/issue-98562.rs
@@ -0,0 +1,12 @@
+// aux-build:extern-issue-98562.rs
+
+extern crate extern_issue_98562;
+use extern_issue_98562::TraitA;
+
+struct X;
+impl TraitA<u8, u16, u32> for X {
+ //~^ ERROR not all trait items implemented
+}
+//~^ HELP implement the missing item: `fn baz<U: TraitC<I1 = u8, I2 = u16> + TraitD<I3 = u32>, V: TraitD<I3 = u8>>(_: U, _: V) -> Self where U: TraitE, U: TraitB, <U as TraitB>::Item: Copy { todo!() }`
+
+fn main() {}
diff --git a/tests/ui/suggestions/issue-98562.stderr b/tests/ui/suggestions/issue-98562.stderr
new file mode 100644
index 000000000..7897fa441
--- /dev/null
+++ b/tests/ui/suggestions/issue-98562.stderr
@@ -0,0 +1,11 @@
+error[E0046]: not all trait items implemented, missing: `baz`
+ --> $DIR/issue-98562.rs:7:1
+ |
+LL | impl TraitA<u8, u16, u32> for X {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `baz` in implementation
+ |
+ = help: implement the missing item: `fn baz<U: TraitC<I1 = u8, I2 = u16> + TraitD<I3 = u32>, V: TraitD<I3 = u8>>(_: U, _: V) -> Self where U: TraitE, U: TraitB, <U as TraitB>::Item: Copy { todo!() }`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0046`.
diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr
index 93cfa60b5..318ea4083 100644
--- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr
+++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr
@@ -12,7 +12,7 @@ error[E0700]: hidden type for `impl FnOnce()` captures lifetime that does not ap
LL | fn foo<G, T>(g: G, dest: &mut T) -> impl FnOnce()
| ------ ------------- opaque type defined here
| |
- | hidden type `[closure@$DIR/missing-lifetimes-in-signature.rs:19:5: 19:12]` captures the anonymous lifetime defined here
+ | hidden type `{closure@$DIR/missing-lifetimes-in-signature.rs:19:5: 19:12}` captures the anonymous lifetime defined here
...
LL | / move || {
LL | |
diff --git a/tests/ui/suggestions/missing-assoc-fn.stderr b/tests/ui/suggestions/missing-assoc-fn.stderr
index 77fa95628..84cb6e985 100644
--- a/tests/ui/suggestions/missing-assoc-fn.stderr
+++ b/tests/ui/suggestions/missing-assoc-fn.stderr
@@ -28,7 +28,7 @@ error[E0046]: not all trait items implemented, missing: `from_iter`
LL | impl FromIterator<()> for X {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `from_iter` in implementation
|
- = help: implement the missing item: `fn from_iter<T>(_: T) -> Self where T: IntoIterator, std::iter::IntoIterator::Item = () { todo!() }`
+ = help: implement the missing item: `fn from_iter<T: IntoIterator<Item = ()>>(_: T) -> Self { todo!() }`
error: aborting due to 3 previous errors
diff --git a/tests/ui/suggestions/return-closures.stderr b/tests/ui/suggestions/return-closures.stderr
index 8b856d8de..f0810bbb2 100644
--- a/tests/ui/suggestions/return-closures.stderr
+++ b/tests/ui/suggestions/return-closures.stderr
@@ -8,7 +8,7 @@ LL | |x: &i32| 1i32
| ^^^^^^^^^^^^^^ expected `()`, found closure
|
= note: expected unit type `()`
- found closure `[closure@$DIR/return-closures.rs:3:5: 3:14]`
+ found closure `{closure@$DIR/return-closures.rs:3:5: 3:14}`
error[E0308]: mismatched types
--> $DIR/return-closures.rs:9:5
@@ -20,7 +20,7 @@ LL | || i
| ^^^^ expected `()`, found closure
|
= note: expected unit type `()`
- found closure `[closure@$DIR/return-closures.rs:9:5: 9:7]`
+ found closure `{closure@$DIR/return-closures.rs:9:5: 9:7}`
error: aborting due to 2 previous errors
diff --git a/tests/ui/suggestions/sugg-else-for-closure.stderr b/tests/ui/suggestions/sugg-else-for-closure.stderr
index 09553b93c..80ad3f9e4 100644
--- a/tests/ui/suggestions/sugg-else-for-closure.stderr
+++ b/tests/ui/suggestions/sugg-else-for-closure.stderr
@@ -7,8 +7,8 @@ LL | let _s = y.unwrap_or(|| x.split('.').nth(1).unwrap());
| arguments to this method are incorrect
|
= note: expected reference `&str`
- found closure `[closure@$DIR/sugg-else-for-closure.rs:6:26: 6:28]`
-help: the return type of this call is `[closure@$DIR/sugg-else-for-closure.rs:6:26: 6:28]` due to the type of the argument passed
+ found closure `{closure@$DIR/sugg-else-for-closure.rs:6:26: 6:28}`
+help: the return type of this call is `{closure@$DIR/sugg-else-for-closure.rs:6:26: 6:28}` due to the type of the argument passed
--> $DIR/sugg-else-for-closure.rs:6:14
|
LL | let _s = y.unwrap_or(|| x.split('.').nth(1).unwrap());
diff --git a/tests/ui/suggestions/suggest-box.stderr b/tests/ui/suggestions/suggest-box.stderr
index 9a4e9fef4..e5d5ecc0b 100644
--- a/tests/ui/suggestions/suggest-box.stderr
+++ b/tests/ui/suggestions/suggest-box.stderr
@@ -11,7 +11,7 @@ LL | | };
| |_____^ expected `Box<dyn Fn() -> Result<(), ()>>`, found closure
|
= note: expected struct `Box<dyn Fn() -> Result<(), ()>>`
- found closure `[closure@$DIR/suggest-box.rs:4:47: 4:49]`
+ found closure `{closure@$DIR/suggest-box.rs:4:47: 4:49}`
= note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html
help: store this in the heap by calling `Box::new`
|
diff --git a/tests/ui/suggestions/unnamable-types.stderr b/tests/ui/suggestions/unnamable-types.stderr
index 24bedb529..19e9af145 100644
--- a/tests/ui/suggestions/unnamable-types.stderr
+++ b/tests/ui/suggestions/unnamable-types.stderr
@@ -19,7 +19,7 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures
LL | const C: _ = || 42;
| ^ not allowed in type signatures
|
-note: however, the inferred type `[closure@unnamable-types.rs:17:14]` cannot be named
+note: however, the inferred type `{closure@unnamable-types.rs:17:14}` cannot be named
--> $DIR/unnamable-types.rs:17:14
|
LL | const C: _ = || 42;
@@ -31,7 +31,7 @@ error: missing type for `const` item
LL | const D = S { t: { let i = 0; move || -> i32 { i } } };
| ^
|
-note: however, the inferred type `S<[closure@unnamable-types.rs:23:31]>` cannot be named
+note: however, the inferred type `S<{closure@unnamable-types.rs:23:31}>` cannot be named
--> $DIR/unnamable-types.rs:23:11
|
LL | const D = S { t: { let i = 0; move || -> i32 { i } } };
@@ -55,7 +55,7 @@ error: missing type for `const` item
LL | const G = || -> i32 { yield 0; return 1; };
| ^
|
-note: however, the inferred type `[generator@$DIR/unnamable-types.rs:37:11: 37:20]` cannot be named
+note: however, the inferred type `{generator@$DIR/unnamable-types.rs:37:11: 37:20}` cannot be named
--> $DIR/unnamable-types.rs:37:11
|
LL | const G = || -> i32 { yield 0; return 1; };
diff --git a/tests/ui/symbol-names/basic.legacy.stderr b/tests/ui/symbol-names/basic.legacy.stderr
index c1cbefac8..61d27ec69 100644
--- a/tests/ui/symbol-names/basic.legacy.stderr
+++ b/tests/ui/symbol-names/basic.legacy.stderr
@@ -1,10 +1,10 @@
-error: symbol-name(_ZN5basic4main17h6fc0c8d27b1a289fE)
+error: symbol-name(_ZN5basic4main17h9308686d0228fa1dE)
--> $DIR/basic.rs:8:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
-error: demangling(basic::main::h6fc0c8d27b1a289f)
+error: demangling(basic::main::h9308686d0228fa1d)
--> $DIR/basic.rs:8:1
|
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 7dd68e6e3..eb65f3b58 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$3foo17hab58a402db4ebf3aE)
+error: symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17h84ab5dafbd2a1508E)
--> $DIR/issue-60925.rs:21:9
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
-error: demangling(issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo::hab58a402db4ebf3a)
+error: demangling(issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo::h84ab5dafbd2a1508)
--> $DIR/issue-60925.rs:21:9
|
LL | #[rustc_symbol_name]
diff --git a/tests/ui/test-attrs/issue-36768.rs b/tests/ui/test-attrs/issue-36768.rs
index f671cbc82..7531f3621 100644
--- a/tests/ui/test-attrs/issue-36768.rs
+++ b/tests/ui/test-attrs/issue-36768.rs
@@ -1,6 +1,6 @@
// run-pass
// compile-flags:--test
-#![deny(private_in_public)]
+#![deny(private_interfaces)]
#[test] fn foo() {}
mod foo {}
diff --git a/tests/ui/track-diagnostics/track.rs b/tests/ui/track-diagnostics/track.rs
index 61b9137ea..97bd7789a 100644
--- a/tests/ui/track-diagnostics/track.rs
+++ b/tests/ui/track-diagnostics/track.rs
@@ -6,6 +6,11 @@
// normalize-stderr-test ".rs:\d+:\d+" -> ".rs:LL:CC"
// normalize-stderr-test "note: rustc .+ running on .+" -> "note: rustc $$VERSION running on $$TARGET"
+// The test becomes too flaky if we care about exact args. If `-Z ui-testing`
+// from compiletest and `-Z track-diagnostics` from `// compile-flags` at the
+// top of this file are present, then assume all args are present.
+// normalize-stderr-test "note: compiler flags: .*-Z ui-testing.*-Z track-diagnostics" -> "note: compiler flags: ... -Z ui-testing ... -Z track-diagnostics"
+
fn main() {
break rust
}
diff --git a/tests/ui/track-diagnostics/track.stderr b/tests/ui/track-diagnostics/track.stderr
index 8256c1f5f..60254dc47 100644
--- a/tests/ui/track-diagnostics/track.stderr
+++ b/tests/ui/track-diagnostics/track.stderr
@@ -20,6 +20,8 @@ note: we would appreciate a joke overview: https://github.com/rust-lang/rust/iss
note: rustc $VERSION running on $TARGET
+note: compiler flags: ... -Z ui-testing ... -Z track-diagnostics
+
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0268, E0425.
diff --git a/tests/ui/trait-bounds/enum-unit-variant-trait-bound.rs b/tests/ui/trait-bounds/enum-unit-variant-trait-bound.rs
new file mode 100644
index 000000000..91525bc90
--- /dev/null
+++ b/tests/ui/trait-bounds/enum-unit-variant-trait-bound.rs
@@ -0,0 +1,6 @@
+// Regression test for one part of issue #105306.
+
+fn main() {
+ let _ = Option::<[u8]>::None;
+ //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time
+}
diff --git a/tests/ui/trait-bounds/enum-unit-variant-trait-bound.stderr b/tests/ui/trait-bounds/enum-unit-variant-trait-bound.stderr
new file mode 100644
index 000000000..32f6b00b2
--- /dev/null
+++ b/tests/ui/trait-bounds/enum-unit-variant-trait-bound.stderr
@@ -0,0 +1,13 @@
+error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
+ --> $DIR/enum-unit-variant-trait-bound.rs:4:22
+ |
+LL | let _ = Option::<[u8]>::None;
+ | ^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `[u8]`
+note: required by a bound in `None`
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/trait-bounds/issue-82038.rs b/tests/ui/trait-bounds/issue-82038.rs
new file mode 100644
index 000000000..11de714fa
--- /dev/null
+++ b/tests/ui/trait-bounds/issue-82038.rs
@@ -0,0 +1,9 @@
+// Failed bound `bool: Foo` must not point at the `Self: Clone` line
+
+trait Foo {
+ fn my_method() where Self: Clone;
+}
+
+fn main() {
+ <bool as Foo>::my_method(); //~ERROR [E0277]
+}
diff --git a/tests/ui/trait-bounds/issue-82038.stderr b/tests/ui/trait-bounds/issue-82038.stderr
new file mode 100644
index 000000000..30bb4a0a8
--- /dev/null
+++ b/tests/ui/trait-bounds/issue-82038.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `bool: Foo` is not satisfied
+ --> $DIR/issue-82038.rs:8:6
+ |
+LL | <bool as Foo>::my_method();
+ | ^^^^ the trait `Foo` is not implemented for `bool`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-82038.rs:3:1
+ |
+LL | trait Foo {
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/bad-method-typaram-kind.stderr b/tests/ui/traits/bad-method-typaram-kind.stderr
index 56acfbe80..4c2d8e9f0 100644
--- a/tests/ui/traits/bad-method-typaram-kind.stderr
+++ b/tests/ui/traits/bad-method-typaram-kind.stderr
@@ -2,7 +2,9 @@ error[E0277]: `T` cannot be sent between threads safely
--> $DIR/bad-method-typaram-kind.rs:2:13
|
LL | 1.bar::<T>();
- | ^ `T` cannot be sent between threads safely
+ | --- ^ `T` cannot be sent between threads safely
+ | |
+ | required by a bound introduced by this call
|
note: required by a bound in `Bar::bar`
--> $DIR/bad-method-typaram-kind.rs:6:14
diff --git a/tests/ui/traits/bound/on-structs-and-enums-in-fns.stderr b/tests/ui/traits/bound/on-structs-and-enums-in-fns.stderr
index 61237a63e..530264b34 100644
--- a/tests/ui/traits/bound/on-structs-and-enums-in-fns.stderr
+++ b/tests/ui/traits/bound/on-structs-and-enums-in-fns.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `u32: Trait` is not satisfied
LL | fn explode(x: Foo<u32>) {}
| ^^^^^^^^ the trait `Trait` is not implemented for `u32`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-structs-and-enums-in-fns.rs:1:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `Foo`
--> $DIR/on-structs-and-enums-in-fns.rs:3:14
|
@@ -16,6 +21,11 @@ error[E0277]: the trait bound `f32: Trait` is not satisfied
LL | fn kaboom(y: Bar<f32>) {}
| ^^^^^^^^ the trait `Trait` is not implemented for `f32`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-structs-and-enums-in-fns.rs:1:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `Bar`
--> $DIR/on-structs-and-enums-in-fns.rs:7:12
|
diff --git a/tests/ui/traits/bound/on-structs-and-enums-in-impls.stderr b/tests/ui/traits/bound/on-structs-and-enums-in-impls.stderr
index 8a4374226..372bbabbd 100644
--- a/tests/ui/traits/bound/on-structs-and-enums-in-impls.stderr
+++ b/tests/ui/traits/bound/on-structs-and-enums-in-impls.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `u16: Trait` is not satisfied
LL | impl PolyTrait<Foo<u16>> for Struct {
| ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `u16`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-structs-and-enums-in-impls.rs:1:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `Foo`
--> $DIR/on-structs-and-enums-in-impls.rs:3:14
|
diff --git a/tests/ui/traits/bound/on-structs-and-enums-locals.stderr b/tests/ui/traits/bound/on-structs-and-enums-locals.stderr
index 20bbe69c0..01cf76c62 100644
--- a/tests/ui/traits/bound/on-structs-and-enums-locals.stderr
+++ b/tests/ui/traits/bound/on-structs-and-enums-locals.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `usize: Trait` is not satisfied
LL | let baz: Foo<usize> = loop { };
| ^^^^^^^^^^ the trait `Trait` is not implemented for `usize`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-structs-and-enums-locals.rs:1:1
+ |
+LL | trait Trait {
+ | ^^^^^^^^^^^
note: required by a bound in `Foo`
--> $DIR/on-structs-and-enums-locals.rs:5:14
|
@@ -16,6 +21,11 @@ error[E0277]: the trait bound `{integer}: Trait` is not satisfied
LL | x: 3
| ^ the trait `Trait` is not implemented for `{integer}`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-structs-and-enums-locals.rs:1:1
+ |
+LL | trait Trait {
+ | ^^^^^^^^^^^
note: required by a bound in `Foo`
--> $DIR/on-structs-and-enums-locals.rs:5:14
|
diff --git a/tests/ui/traits/bound/on-structs-and-enums-static.stderr b/tests/ui/traits/bound/on-structs-and-enums-static.stderr
index fda734e85..fa14aff68 100644
--- a/tests/ui/traits/bound/on-structs-and-enums-static.stderr
+++ b/tests/ui/traits/bound/on-structs-and-enums-static.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `usize: Trait` is not satisfied
LL | static X: Foo<usize> = Foo {
| ^^^^^^^^^^ the trait `Trait` is not implemented for `usize`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-structs-and-enums-static.rs:1:1
+ |
+LL | trait Trait {
+ | ^^^^^^^^^^^
note: required by a bound in `Foo`
--> $DIR/on-structs-and-enums-static.rs:5:14
|
diff --git a/tests/ui/traits/bound/on-structs-and-enums.stderr b/tests/ui/traits/bound/on-structs-and-enums.stderr
index fe05b8634..606f76485 100644
--- a/tests/ui/traits/bound/on-structs-and-enums.stderr
+++ b/tests/ui/traits/bound/on-structs-and-enums.stderr
@@ -20,6 +20,11 @@ error[E0277]: the trait bound `isize: Trait` is not satisfied
LL | a: Foo<isize>,
| ^^^^^^^^^^ the trait `Trait` is not implemented for `isize`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-structs-and-enums.rs:1:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `Foo`
--> $DIR/on-structs-and-enums.rs:3:14
|
@@ -32,6 +37,11 @@ error[E0277]: the trait bound `usize: Trait` is not satisfied
LL | Quux(Bar<usize>),
| ^^^^^^^^^^ the trait `Trait` is not implemented for `usize`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-structs-and-enums.rs:1:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `Bar`
--> $DIR/on-structs-and-enums.rs:7:12
|
@@ -76,6 +86,11 @@ error[E0277]: the trait bound `i32: Trait` is not satisfied
LL | Foo<i32>,
| ^^^^^^^^ the trait `Trait` is not implemented for `i32`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-structs-and-enums.rs:1:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `Foo`
--> $DIR/on-structs-and-enums.rs:3:14
|
@@ -88,6 +103,11 @@ error[E0277]: the trait bound `u8: Trait` is not satisfied
LL | DictionaryLike { field: Bar<u8> },
| ^^^^^^^ the trait `Trait` is not implemented for `u8`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-structs-and-enums.rs:1:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `Bar`
--> $DIR/on-structs-and-enums.rs:7:12
|
diff --git a/tests/ui/traits/deny-builtin-object-impl.current.stderr b/tests/ui/traits/deny-builtin-object-impl.current.stderr
index 5c1987426..8ca3d3a05 100644
--- a/tests/ui/traits/deny-builtin-object-impl.current.stderr
+++ b/tests/ui/traits/deny-builtin-object-impl.current.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `dyn NotObject: NotObject` is not satisfied
LL | test_not_object::<dyn NotObject>();
| ^^^^^^^^^^^^^ the trait `NotObject` is not implemented for `dyn NotObject`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/deny-builtin-object-impl.rs:10:1
+ |
+LL | trait NotObject {}
+ | ^^^^^^^^^^^^^^^
note: required by a bound in `test_not_object`
--> $DIR/deny-builtin-object-impl.rs:14:23
|
diff --git a/tests/ui/traits/deny-builtin-object-impl.next.stderr b/tests/ui/traits/deny-builtin-object-impl.next.stderr
index 5c1987426..8ca3d3a05 100644
--- a/tests/ui/traits/deny-builtin-object-impl.next.stderr
+++ b/tests/ui/traits/deny-builtin-object-impl.next.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `dyn NotObject: NotObject` is not satisfied
LL | test_not_object::<dyn NotObject>();
| ^^^^^^^^^^^^^ the trait `NotObject` is not implemented for `dyn NotObject`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/deny-builtin-object-impl.rs:10:1
+ |
+LL | trait NotObject {}
+ | ^^^^^^^^^^^^^^^
note: required by a bound in `test_not_object`
--> $DIR/deny-builtin-object-impl.rs:14:23
|
diff --git a/tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr b/tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr
index 934d20b22..a5d0e6ab0 100644
--- a/tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr
+++ b/tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr
@@ -5,13 +5,16 @@ LL | <i32 as RefFoo<i32>>::ref_foo(unknown);
| ^^^^^^^ not found in this scope
error[E0277]: the trait bound `for<'a> &'a mut Vec<&'a u32>: Foo<'static, i32>` is not satisfied
- --> $DIR/dont-autoderef-ty-with-escaping-var.rs:17:35
+ --> $DIR/dont-autoderef-ty-with-escaping-var.rs:17:6
|
LL | <i32 as RefFoo<i32>>::ref_foo(unknown);
- | ----------------------------- ^^^^^^^ the trait `for<'a> Foo<'static, i32>` is not implemented for `&'a mut Vec<&'a u32>`
- | |
- | required by a bound introduced by this call
+ | ^^^ the trait `for<'a> Foo<'static, i32>` is not implemented for `&'a mut Vec<&'a u32>`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/dont-autoderef-ty-with-escaping-var.rs:3:1
|
+LL | trait Foo<'x, T> {}
+ | ^^^^^^^^^^^^^^^^
note: required for `i32` to implement `RefFoo<i32>`
--> $DIR/dont-autoderef-ty-with-escaping-var.rs:9:9
|
diff --git a/tests/ui/traits/impl-bounds-checking.stderr b/tests/ui/traits/impl-bounds-checking.stderr
index 1f969efe1..bfa8213ab 100644
--- a/tests/ui/traits/impl-bounds-checking.stderr
+++ b/tests/ui/traits/impl-bounds-checking.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `isize: Clone2` is not satisfied
LL | impl Getter<isize> for isize {
| ^^^^^ the trait `Clone2` is not implemented for `isize`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/impl-bounds-checking.rs:1:1
+ |
+LL | pub trait Clone2 {
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `Getter`
--> $DIR/impl-bounds-checking.rs:6:17
|
diff --git a/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr b/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr
index 656e0d0bf..7027fa69e 100644
--- a/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr
+++ b/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr
@@ -24,12 +24,10 @@ LL | fn with_trait<C:CompareToInts + CompareTo<i32>>(c: &C) -> bool {
| ++++++++++++++++
error[E0277]: the trait bound `dyn CompareToInts: CompareTo<i32>` is not satisfied
- --> $DIR/repeated-supertrait-ambig.rs:34:37
+ --> $DIR/repeated-supertrait-ambig.rs:34:6
|
LL | <dyn CompareToInts>::same_as(c, 22)
- | ---------------------------- ^^ the trait `CompareTo<i32>` is not implemented for `dyn CompareToInts`
- | |
- | required by a bound introduced by this call
+ | ^^^^^^^^^^^^^^^^^ the trait `CompareTo<i32>` is not implemented for `dyn CompareToInts`
|
= help: the following other types implement trait `CompareTo<T>`:
<i64 as CompareTo<i64>>
diff --git a/tests/ui/traits/issue-105231.rs b/tests/ui/traits/issue-105231.rs
index bb2b13664..74c7afd6b 100644
--- a/tests/ui/traits/issue-105231.rs
+++ b/tests/ui/traits/issue-105231.rs
@@ -1,9 +1,9 @@
+//~ ERROR overflow evaluating the requirement `A<A<A<A<A<A<A<...>>>>>>>: Send`
struct A<T>(B<T>);
//~^ ERROR recursive types `A` and `B` have infinite size
struct B<T>(A<A<T>>);
trait Foo {}
impl<T> Foo for T where T: Send {}
-//~^ ERROR overflow evaluating the requirement `A<A<A<A<A<A<A<...>>>>>>>: Send`
impl Foo for B<u8> {}
fn main() {}
diff --git a/tests/ui/traits/issue-105231.stderr b/tests/ui/traits/issue-105231.stderr
index 76a710673..fe20c47c5 100644
--- a/tests/ui/traits/issue-105231.stderr
+++ b/tests/ui/traits/issue-105231.stderr
@@ -1,5 +1,5 @@
error[E0072]: recursive types `A` and `B` have infinite size
- --> $DIR/issue-105231.rs:1:1
+ --> $DIR/issue-105231.rs:2:1
|
LL | struct A<T>(B<T>);
| ^^^^^^^^^^^ ---- recursive without indirection
@@ -15,14 +15,10 @@ LL ~ struct B<T>(Box<A<A<T>>>);
|
error[E0275]: overflow evaluating the requirement `A<A<A<A<A<A<A<...>>>>>>>: Send`
- --> $DIR/issue-105231.rs:5:28
- |
-LL | impl<T> Foo for T where T: Send {}
- | ^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_105231`)
note: required because it appears within the type `B<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<u8>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
- --> $DIR/issue-105231.rs:3:8
+ --> $DIR/issue-105231.rs:4:8
|
LL | struct B<T>(A<A<T>>);
| ^
diff --git a/tests/ui/issues/issue-66768.rs b/tests/ui/traits/issue-66768.rs
index ce42c8b01..ce42c8b01 100644
--- a/tests/ui/issues/issue-66768.rs
+++ b/tests/ui/traits/issue-66768.rs
diff --git a/tests/ui/traits/issue-77982.stderr b/tests/ui/traits/issue-77982.stderr
index d4fea05fe..33cc186ac 100644
--- a/tests/ui/traits/issue-77982.stderr
+++ b/tests/ui/traits/issue-77982.stderr
@@ -35,23 +35,12 @@ help: consider specifying the generic argument
LL | opts.get::<Q>(opt.as_ref());
| +++++
-error[E0283]: type annotations needed
+error[E0282]: type annotations needed
--> $DIR/issue-77982.rs:13:59
|
LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect();
- | --------- ^^^^
- | |
- | required by a bound introduced by this call
- |
- = note: multiple `impl`s satisfying `u32: From<_>` found in the `core` crate:
- - impl From<Ipv4Addr> for u32;
- - impl From<NonZeroU32> for u32;
- - impl From<bool> for u32;
- - impl From<char> for u32;
- - impl From<u16> for u32;
- - impl From<u8> for u32;
- - impl<T> From<!> for T;
- - impl<T> From<T> for T;
+ | ^^^^
+ |
help: try using a fully qualified path to specify the expected types
|
LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(<u32 as Into<T>>::into(0u32))).collect();
@@ -95,4 +84,5 @@ LL | let _: Box<T> = (&()).bar();
error: aborting due to 5 previous errors
-For more information about this error, try `rustc --explain E0283`.
+Some errors have detailed explanations: E0282, E0283.
+For more information about an error, try `rustc --explain E0282`.
diff --git a/tests/ui/traits/issue-91949-hangs-on-recursion.stderr b/tests/ui/traits/issue-91949-hangs-on-recursion.stderr
index c6fc7bb12..4593fa2c4 100644
--- a/tests/ui/traits/issue-91949-hangs-on-recursion.stderr
+++ b/tests/ui/traits/issue-91949-hangs-on-recursion.stderr
@@ -23,7 +23,7 @@ LL | impl<T, I: Iterator<Item = T>> Iterator for IteratorOfWrapped<T, I> {
| |
| unsatisfied trait bound introduced here
= note: 256 redundant requirements hidden
- = note: required for `IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), std::iter::Empty<()>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>` to implement `Iterator`
+ = note: required for `IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), std::iter::Empty<()>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>` to implement `Iterator`
error: aborting due to previous error; 1 warning emitted
diff --git a/tests/ui/traits/issue-99875.stderr b/tests/ui/traits/issue-99875.stderr
index fb6eebbd2..29e875715 100644
--- a/tests/ui/traits/issue-99875.stderr
+++ b/tests/ui/traits/issue-99875.stderr
@@ -16,11 +16,11 @@ help: the trait `Trait` is implemented for fn pointer `fn(Argument) -> Return`,
LL | takes(function as fn(Argument) -> Return);
| +++++++++++++++++++++++++
-error[E0277]: the trait bound `[closure@$DIR/issue-99875.rs:14:11: 14:34]: Trait` is not satisfied
+error[E0277]: the trait bound `{closure@$DIR/issue-99875.rs:14:11: 14:34}: Trait` is not satisfied
--> $DIR/issue-99875.rs:14:11
|
LL | takes(|_: Argument| -> Return { todo!() });
- | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for closure `[closure@$DIR/issue-99875.rs:14:11: 14:34]`
+ | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for closure `{closure@$DIR/issue-99875.rs:14:11: 14:34}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr b/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr
index 8eda64e44..46677a583 100644
--- a/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr
+++ b/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr
@@ -5,6 +5,8 @@ LL | impl<T: TraitB> Overlaps<Box<T>> for <T as TraitB>::Assoc {}
| --------------------------------------------------------- first implementation here
LL | impl<U: TraitB> Overlaps<U> for <U as TraitB>::Assoc {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `<_ as TraitB>::Assoc`
+ |
+ = note: downstream crates may implement trait `TraitB` for type `std::boxed::Box<_>`
error: aborting due to previous error
diff --git a/tests/ui/traits/new-solver/async.fail.stderr b/tests/ui/traits/new-solver/async.fail.stderr
index 72fa2eb31..44097b556 100644
--- a/tests/ui/traits/new-solver/async.fail.stderr
+++ b/tests/ui/traits/new-solver/async.fail.stderr
@@ -1,4 +1,4 @@
-error[E0271]: type mismatch resolving `<[async block@$DIR/async.rs:12:17: 12:25] as Future>::Output == i32`
+error[E0271]: type mismatch resolving `<{async block@$DIR/async.rs:12:17: 12:25} as Future>::Output == i32`
--> $DIR/async.rs:12:17
|
LL | needs_async(async {});
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
index e311a4af2..6b54718e3 100644
--- a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs
+++ b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs
@@ -1,4 +1,4 @@
-// compile-flags: -Ztrait-solver=next -Zdrop-tracking-mir
+// compile-flags: -Ztrait-solver=next
// edition: 2021
// revisions: pass fail
//[pass] check-pass
diff --git a/tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr b/tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr
index f7551739b..4eaa25961 100644
--- a/tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr
+++ b/tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr
@@ -1,10 +1,8 @@
error[E0277]: expected a `Fn<_>` closure, found `fn() -> str`
- --> $DIR/builtin-fn-must-return-sized.rs:15:27
+ --> $DIR/builtin-fn-must-return-sized.rs:15:11
|
LL | foo::<fn() -> str, _>(None, ());
- | --------------------- ^^^^ expected an `Fn<_>` closure, found `fn() -> str`
- | |
- | required by a bound introduced by this call
+ | ^^^^^^^^^^^ expected an `Fn<_>` closure, found `fn() -> str`
|
= help: the trait `Fn<_>` is not implemented for `fn() -> str`
note: required by a bound in `foo`
diff --git a/tests/ui/traits/new-solver/canonicalize-effect-var.rs b/tests/ui/traits/new-solver/canonicalize-effect-var.rs
new file mode 100644
index 000000000..35b69ed1a
--- /dev/null
+++ b/tests/ui/traits/new-solver/canonicalize-effect-var.rs
@@ -0,0 +1,22 @@
+// compile-flags: -Ztrait-solver=next
+// check-pass
+
+#![feature(effects)]
+#![feature(const_trait_impl)]
+
+#[const_trait]
+trait Foo {
+ fn foo();
+}
+
+trait Bar {}
+
+impl const Foo for i32 {
+ fn foo() {}
+}
+
+impl<T> const Foo for T where T: Bar {
+ fn foo() {}
+}
+
+fn main() {}
diff --git a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr
index 5d5f325e4..73d46c4df 100644
--- a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr
+++ b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr
@@ -1,3 +1,7 @@
+WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <<LocalTy as Overflow>::Assoc as std::marker::Sized>
+WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <<LocalTy as Overflow>::Assoc as std::marker::Sized>
+WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <<LocalTy as Overflow>::Assoc as std::marker::Sized>
+WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <<LocalTy as Overflow>::Assoc as std::marker::Sized>
error[E0119]: conflicting implementations of trait `Trait` for type `<LocalTy as Overflow>::Assoc`
--> $DIR/trait_ref_is_knowable-norm-overflow.rs:17:1
|
@@ -6,6 +10,8 @@ LL | impl<T: Copy> Trait for T {}
LL | struct LocalTy;
LL | impl Trait for <LocalTy as Overflow>::Assoc {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `<LocalTy as Overflow>::Assoc`
+ |
+ = note: upstream crates may add a new impl of trait `std::marker::Copy` for type `<LocalTy as Overflow>::Assoc` in future versions
error: aborting due to previous error
diff --git a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr
index 7d3535e1f..a86115671 100644
--- a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr
+++ b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr
@@ -5,10 +5,10 @@ LL | impls::<W<_>>();
| ^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `impls`
error[E0275]: overflow evaluating the requirement `W<_>: Trait`
- --> $DIR/fixpoint-exponential-growth.rs:29:5
+ --> $DIR/fixpoint-exponential-growth.rs:29:13
|
LL | impls::<W<_>>();
- | ^^^^^^^^^^^^^
+ | ^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`fixpoint_exponential_growth`)
note: required by a bound in `impls`
diff --git a/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr b/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr
index 4b8846da5..a3404da51 100644
--- a/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr
+++ b/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr
@@ -1,8 +1,8 @@
error[E0275]: overflow evaluating the requirement `(): Trait`
- --> $DIR/double-cycle-inductive-coinductive.rs:32:5
+ --> $DIR/double-cycle-inductive-coinductive.rs:32:19
|
LL | impls_trait::<()>();
- | ^^^^^^^^^^^^^^^^^
+ | ^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`double_cycle_inductive_coinductive`)
note: required by a bound in `impls_trait`
@@ -12,10 +12,10 @@ LL | fn impls_trait<T: Trait>() {}
| ^^^^^ required by this bound in `impls_trait`
error[E0275]: overflow evaluating the requirement `(): TraitRev`
- --> $DIR/double-cycle-inductive-coinductive.rs:35:5
+ --> $DIR/double-cycle-inductive-coinductive.rs:35:23
|
LL | impls_trait_rev::<()>();
- | ^^^^^^^^^^^^^^^^^^^^^
+ | ^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`double_cycle_inductive_coinductive`)
note: required by a bound in `impls_trait_rev`
diff --git a/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.rs b/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.rs
new file mode 100644
index 000000000..279063923
--- /dev/null
+++ b/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.rs
@@ -0,0 +1,53 @@
+// compile-flags: -Ztrait-solver=next
+#![feature(rustc_attrs)]
+
+// Check that we correctly rerun the trait solver for heads of cycles,
+// even if they are not the root.
+
+struct A<T: ?Sized>(*const T);
+struct B<T: ?Sized>(*const T);
+struct C<T: ?Sized>(*const T);
+
+#[rustc_coinductive]
+trait Trait<'a, 'b> {}
+trait NotImplemented {}
+
+impl<'a, 'b, T: ?Sized> Trait<'a, 'b> for A<T> where B<T>: Trait<'a, 'b> {}
+
+// With this the root of `B<T>` is `A<T>`, even if the other impl does
+// not have a cycle with `A<T>`. This candidate never applies because of
+// the `A<T>: NotImplemented` bound.
+impl<'a, 'b, T: ?Sized> Trait<'a, 'b> for B<T>
+where
+ A<T>: Trait<'a, 'b>,
+ A<T>: NotImplemented,
+{
+}
+
+// This impl directly requires 'b to be equal to 'static.
+//
+// Because of the coinductive cycle through `C<T>` it also requires
+// 'a to be 'static.
+impl<'a, T: ?Sized> Trait<'a, 'static> for B<T>
+where
+ C<T>: Trait<'a, 'a>,
+{}
+
+// In the first iteration of `B<T>: Trait<'a, 'b>` we don't add any
+// constraints here, only after setting the provisional result to require
+// `'b == 'static` do we also add that constraint for `'a`.
+impl<'a, 'b, T: ?Sized> Trait<'a, 'b> for C<T>
+where
+ B<T>: Trait<'a, 'b>,
+{}
+
+fn impls_trait<'a, 'b, T: Trait<'a, 'b> + ?Sized>() {}
+
+fn check<'a, T: ?Sized>() {
+ impls_trait::<'a, 'static, A<T>>();
+ //~^ ERROR lifetime may not live long enough
+}
+
+fn main() {
+ check::<()>();
+}
diff --git a/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.stderr b/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.stderr
new file mode 100644
index 000000000..4cbd08981
--- /dev/null
+++ b/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.stderr
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+ --> $DIR/fixpoint-rerun-all-cycle-heads.rs:47:5
+ |
+LL | fn check<'a, T: ?Sized>() {
+ | -- lifetime `'a` defined here
+LL | impls_trait::<'a, 'static, A<T>>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs b/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs
index 3cfe7ab87..f06b98a79 100644
--- a/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs
+++ b/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs
@@ -39,7 +39,7 @@ fn impls_ar<T: AR>() {}
fn main() {
impls_a::<()>();
- // FIXME(-Ztrait-solver=next): This is broken and should error.
+ //~^ ERROR overflow evaluating the requirement `(): A`
impls_ar::<()>();
//~^ ERROR overflow evaluating the requirement `(): AR`
diff --git a/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr b/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr
index 0e1c86c1b..859b3f3f1 100644
--- a/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr
+++ b/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr
@@ -1,8 +1,21 @@
+error[E0275]: overflow evaluating the requirement `(): A`
+ --> $DIR/inductive-not-on-stack.rs:41:15
+ |
+LL | impls_a::<()>();
+ | ^^
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inductive_not_on_stack`)
+note: required by a bound in `impls_a`
+ --> $DIR/inductive-not-on-stack.rs:25:15
+ |
+LL | fn impls_a<T: A>() {}
+ | ^ required by this bound in `impls_a`
+
error[E0275]: overflow evaluating the requirement `(): AR`
- --> $DIR/inductive-not-on-stack.rs:44:5
+ --> $DIR/inductive-not-on-stack.rs:44:16
|
LL | impls_ar::<()>();
- | ^^^^^^^^^^^^^^
+ | ^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inductive_not_on_stack`)
note: required by a bound in `impls_ar`
@@ -11,6 +24,6 @@ note: required by a bound in `impls_ar`
LL | fn impls_ar<T: AR>() {}
| ^^ required by this bound in `impls_ar`
-error: aborting due to previous error
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.rs b/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.rs
new file mode 100644
index 000000000..b9798c79d
--- /dev/null
+++ b/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.rs
@@ -0,0 +1,19 @@
+// compile-flags: -Ztrait-solver=next-coherence
+
+// Makes sure we don't ICE on associated const projection when the feature gate
+// is not enabled, since we should avoid encountering ICEs on stable if possible.
+
+trait Bar {
+ const ASSOC: usize;
+}
+impl Bar for () {
+ const ASSOC: usize = 1;
+}
+
+trait Foo {}
+impl Foo for () {}
+impl<T> Foo for T where T: Bar<ASSOC = 0> {}
+//~^ ERROR associated const equality is incomplete
+//~| ERROR conflicting implementations of trait `Foo` for type `()`
+
+fn main() {}
diff --git a/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr b/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr
new file mode 100644
index 000000000..7ad495a35
--- /dev/null
+++ b/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr
@@ -0,0 +1,21 @@
+error[E0658]: associated const equality is incomplete
+ --> $DIR/dont-ice-on-assoc-projection.rs:15:32
+ |
+LL | impl<T> Foo for T where T: Bar<ASSOC = 0> {}
+ | ^^^^^^^^^
+ |
+ = note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
+ = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable
+
+error[E0119]: conflicting implementations of trait `Foo` for type `()`
+ --> $DIR/dont-ice-on-assoc-projection.rs:15:1
+ |
+LL | impl Foo for () {}
+ | --------------- first implementation here
+LL | impl<T> Foo for T where T: Bar<ASSOC = 0> {}
+ | ^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0119, E0658.
+For more information about an error, try `rustc --explain E0119`.
diff --git a/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr b/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr
index ec1c3231a..a31bfd958 100644
--- a/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr
+++ b/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr
@@ -1,8 +1,8 @@
error[E0283]: type annotations needed: cannot satisfy `Foo: Send`
- --> $DIR/dont-type_of-tait-in-defining-scope.rs:16:5
+ --> $DIR/dont-type_of-tait-in-defining-scope.rs:16:18
|
LL | needs_send::<Foo>();
- | ^^^^^^^^^^^^^^^^^
+ | ^^^
|
= note: cannot satisfy `Foo: Send`
note: required by a bound in `needs_send`
diff --git a/tests/ui/traits/new-solver/generator.fail.stderr b/tests/ui/traits/new-solver/generator.fail.stderr
index d94d41e35..e3fe4bf5a 100644
--- a/tests/ui/traits/new-solver/generator.fail.stderr
+++ b/tests/ui/traits/new-solver/generator.fail.stderr
@@ -1,4 +1,4 @@
-error[E0277]: the trait bound `[generator@$DIR/generator.rs:18:21: 18:23]: Generator<A>` is not satisfied
+error[E0277]: the trait bound `{generator@$DIR/generator.rs:18:21: 18:23}: Generator<A>` is not satisfied
--> $DIR/generator.rs:18:21
|
LL | needs_generator(|| {
@@ -10,7 +10,7 @@ LL | |
LL | |
LL | | yield ();
LL | | });
- | |_____^ the trait `Generator<A>` is not implemented for `[generator@$DIR/generator.rs:18:21: 18:23]`
+ | |_____^ the trait `Generator<A>` is not implemented for `{generator@$DIR/generator.rs:18:21: 18:23}`
|
note: required by a bound in `needs_generator`
--> $DIR/generator.rs:14:28
@@ -18,7 +18,7 @@ note: required by a bound in `needs_generator`
LL | fn needs_generator(_: impl Generator<A, Yield = B, Return = C>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `needs_generator`
-error[E0271]: type mismatch resolving `<[generator@$DIR/generator.rs:18:21: 18:23] as Generator<A>>::Yield == B`
+error[E0271]: type mismatch resolving `<{generator@$DIR/generator.rs:18:21: 18:23} as Generator<A>>::Yield == B`
--> $DIR/generator.rs:18:21
|
LL | needs_generator(|| {
@@ -38,7 +38,7 @@ note: required by a bound in `needs_generator`
LL | fn needs_generator(_: impl Generator<A, Yield = B, Return = C>) {}
| ^^^^^^^^^ required by this bound in `needs_generator`
-error[E0271]: type mismatch resolving `<[generator@$DIR/generator.rs:18:21: 18:23] as Generator<A>>::Return == C`
+error[E0271]: type mismatch resolving `<{generator@$DIR/generator.rs:18:21: 18:23} as Generator<A>>::Return == C`
--> $DIR/generator.rs:18:21
|
LL | needs_generator(|| {
diff --git a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr
index 28a99cbbc..beed40f36 100644
--- a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr
+++ b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr
@@ -5,10 +5,10 @@ LL | impls::<W<_>>();
| ^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `impls`
error[E0275]: overflow evaluating the requirement `W<_>: Trait`
- --> $DIR/exponential-trait-goals.rs:17:5
+ --> $DIR/exponential-trait-goals.rs:17:13
|
LL | impls::<W<_>>();
- | ^^^^^^^^^^^^^
+ | ^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`exponential_trait_goals`)
note: required by a bound in `impls`
diff --git a/tests/ui/traits/new-solver/overflow/global-cache.stderr b/tests/ui/traits/new-solver/overflow/global-cache.stderr
index f3b86a083..ebb03d84b 100644
--- a/tests/ui/traits/new-solver/overflow/global-cache.stderr
+++ b/tests/ui/traits/new-solver/overflow/global-cache.stderr
@@ -1,8 +1,8 @@
error[E0275]: overflow evaluating the requirement `Inc<Inc<Inc<Inc<Inc<Inc<Inc<...>>>>>>>: Trait`
- --> $DIR/global-cache.rs:21:5
+ --> $DIR/global-cache.rs:21:19
|
LL | impls_trait::<Four<Four<Four<Four<()>>>>>();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "18"]` attribute to your crate (`global_cache`)
note: required by a bound in `impls_trait`
diff --git a/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.rs b/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.rs
new file mode 100644
index 000000000..539c9614e
--- /dev/null
+++ b/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.rs
@@ -0,0 +1,12 @@
+//~ ERROR overflow evaluating the requirement `Self well-formed`
+//~| ERROR overflow evaluating the requirement `Self: Trait`
+
+// This is a non-regression test for issue #115351, where a recursion limit of 0 caused an ICE.
+// compile-flags: -Ztrait-solver=next --crate-type=lib
+// check-fail
+
+#![recursion_limit = "0"]
+trait Trait {}
+impl Trait for u32 {}
+//~^ ERROR overflow evaluating the requirement `u32: Trait`
+//~| ERROR overflow evaluating the requirement `u32 well-formed`
diff --git a/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.stderr b/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.stderr
new file mode 100644
index 000000000..16b25d90a
--- /dev/null
+++ b/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.stderr
@@ -0,0 +1,27 @@
+error[E0275]: overflow evaluating the requirement `Self: Trait`
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "2"]` attribute to your crate (`recursion_limit_zero_issue_115351`)
+
+error[E0275]: overflow evaluating the requirement `Self well-formed`
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "2"]` attribute to your crate (`recursion_limit_zero_issue_115351`)
+
+error[E0275]: overflow evaluating the requirement `u32: Trait`
+ --> $DIR/recursion-limit-zero-issue-115351.rs:10:16
+ |
+LL | impl Trait for u32 {}
+ | ^^^
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "2"]` attribute to your crate (`recursion_limit_zero_issue_115351`)
+
+error[E0275]: overflow evaluating the requirement `u32 well-formed`
+ --> $DIR/recursion-limit-zero-issue-115351.rs:10:16
+ |
+LL | impl Trait for u32 {}
+ | ^^^
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "2"]` attribute to your crate (`recursion_limit_zero_issue_115351`)
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.stderr b/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.stderr
index eebaf21d7..1dc63fae9 100644
--- a/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.stderr
+++ b/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.stderr
@@ -1,8 +1,8 @@
error[E0275]: overflow evaluating the requirement `<T as Foo1>::Assoc1: Bar`
- --> $DIR/recursive-self-normalization-2.rs:16:5
+ --> $DIR/recursive-self-normalization-2.rs:16:17
|
LL | needs_bar::<T::Assoc1>();
- | ^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^
|
= 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`
diff --git a/tests/ui/traits/new-solver/overflow/recursive-self-normalization.stderr b/tests/ui/traits/new-solver/overflow/recursive-self-normalization.stderr
index 6a87fe2f1..afc5bfa54 100644
--- a/tests/ui/traits/new-solver/overflow/recursive-self-normalization.stderr
+++ b/tests/ui/traits/new-solver/overflow/recursive-self-normalization.stderr
@@ -1,8 +1,8 @@
error[E0275]: overflow evaluating the requirement `<T as Foo>::Assoc: Bar`
- --> $DIR/recursive-self-normalization.rs:12:5
+ --> $DIR/recursive-self-normalization.rs:12:17
|
LL | needs_bar::<T::Assoc>();
- | ^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^
|
= 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`
diff --git a/tests/ui/traits/new-solver/projection-discr-kind.stderr b/tests/ui/traits/new-solver/projection-discr-kind.stderr
index 03e28f993..e14953f19 100644
--- a/tests/ui/traits/new-solver/projection-discr-kind.stderr
+++ b/tests/ui/traits/new-solver/projection-discr-kind.stderr
@@ -6,6 +6,11 @@ LL | needs_bar(std::mem::discriminant(&x));
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/projection-discr-kind.rs:10:1
+ |
+LL | trait Bar {}
+ | ^^^^^^^^^
note: required by a bound in `needs_bar`
--> $DIR/projection-discr-kind.rs:11:22
|
diff --git a/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr b/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr
index 83a0452b0..b311ac6b5 100644
--- a/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr
+++ b/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr
@@ -1,8 +1,8 @@
error[E0283]: type annotations needed: cannot satisfy `T: Bar`
- --> $DIR/two-projection-param-candidates-are-ambiguous.rs:26:5
+ --> $DIR/two-projection-param-candidates-are-ambiguous.rs:26:17
|
LL | needs_bar::<T>();
- | ^^^^^^^^^^^^^^
+ | ^
|
= note: cannot satisfy `T: Bar`
= help: the trait `Bar` is implemented for `T`
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
index 91c6dfb8e..bbae67f0b 100644
--- 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
@@ -4,7 +4,7 @@
fn b()
where
for<const C: usize> [(); C]: Copy,
- //~^ ERROR cannot capture late-bound const parameter in a constant
+ //~^ ERROR cannot capture late-bound const parameter in constant
{
}
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
index 69bb605bf..d65892ec6 100644
--- 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
@@ -7,7 +7,7 @@ LL | #![feature(non_lifetime_binders)]
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
= note: `#[warn(incomplete_features)]` on by default
-error: cannot capture late-bound const parameter in a constant
+error: cannot capture late-bound const parameter in constant
--> $DIR/capture-late-ct-in-anon.rs:6:30
|
LL | for<const C: usize> [(); C]: Copy,
diff --git a/tests/ui/traits/non_lifetime_binders/fail.stderr b/tests/ui/traits/non_lifetime_binders/fail.stderr
index 7bd02550f..240bcef7d 100644
--- a/tests/ui/traits/non_lifetime_binders/fail.stderr
+++ b/tests/ui/traits/non_lifetime_binders/fail.stderr
@@ -13,6 +13,11 @@ error[E0277]: the trait bound `T: Trait` is not satisfied
LL | fail();
| ^^^^ the trait `Trait` is not implemented for `T`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/fail.rs:6:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `fail`
--> $DIR/fail.rs:10:15
|
diff --git a/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.rs b/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.rs
index 3903bfe9b..64f09f823 100644
--- a/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.rs
+++ b/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.rs
@@ -5,7 +5,7 @@
fn foo() -> usize
where
for<T> [i32; { let _: T = todo!(); 0 }]:,
- //~^ ERROR cannot capture late-bound type parameter in a constant
+ //~^ ERROR cannot capture late-bound type parameter in constant
{}
fn main() {}
diff --git a/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr b/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr
index fafff02de..dc54e1acc 100644
--- a/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr
+++ b/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr
@@ -15,7 +15,7 @@ LL | #![feature(non_lifetime_binders, generic_const_exprs)]
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
-error: cannot capture late-bound type parameter in a constant
+error: cannot capture late-bound type parameter in constant
--> $DIR/late-bound-in-anon-ct.rs:7:27
|
LL | for<T> [i32; { let _: T = todo!(); 0 }]:,
diff --git a/tests/ui/traits/object-does-not-impl-trait.stderr b/tests/ui/traits/object-does-not-impl-trait.stderr
index f1dd508a4..81d67255a 100644
--- a/tests/ui/traits/object-does-not-impl-trait.stderr
+++ b/tests/ui/traits/object-does-not-impl-trait.stderr
@@ -6,6 +6,11 @@ LL | fn take_object(f: Box<dyn Foo>) { take_foo(f); }
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/object-does-not-impl-trait.rs:4:1
+ |
+LL | trait Foo {}
+ | ^^^^^^^^^
note: required by a bound in `take_foo`
--> $DIR/object-does-not-impl-trait.rs:5:15
|
diff --git a/tests/ui/traits/object/enforce-supertrait-projection.rs b/tests/ui/traits/object/enforce-supertrait-projection.rs
index 2c9b41eea..0ea944ec2 100644
--- a/tests/ui/traits/object/enforce-supertrait-projection.rs
+++ b/tests/ui/traits/object/enforce-supertrait-projection.rs
@@ -7,7 +7,7 @@ trait Trait: SuperTrait<A = <Self as SuperTrait>::B> {}
fn transmute<A, B>(x: A) -> B {
foo::<A, B, dyn Trait<A = A, B = B>>(x)
- //~^ ERROR type mismatch resolving `<dyn Trait<B = B, A = A> as SuperTrait>::A == B`
+ //~^ ERROR type mismatch resolving `<dyn Trait<A = A, B = B> as SuperTrait>::A == B`
}
fn foo<A, B, T: ?Sized>(x: T::A) -> B
diff --git a/tests/ui/traits/object/enforce-supertrait-projection.stderr b/tests/ui/traits/object/enforce-supertrait-projection.stderr
index 848b4e69a..2fb94d348 100644
--- a/tests/ui/traits/object/enforce-supertrait-projection.stderr
+++ b/tests/ui/traits/object/enforce-supertrait-projection.stderr
@@ -1,4 +1,4 @@
-error[E0271]: type mismatch resolving `<dyn Trait<B = B, A = A> as SuperTrait>::A == B`
+error[E0271]: type mismatch resolving `<dyn Trait<A = A, B = B> as SuperTrait>::A == B`
--> $DIR/enforce-supertrait-projection.rs:9:17
|
LL | fn transmute<A, B>(x: A) -> B {
diff --git a/tests/ui/traits/reservation-impl/no-use.next.stderr b/tests/ui/traits/reservation-impl/no-use.next.stderr
index 542e3a28a..632f0f816 100644
--- a/tests/ui/traits/reservation-impl/no-use.next.stderr
+++ b/tests/ui/traits/reservation-impl/no-use.next.stderr
@@ -1,10 +1,8 @@
error[E0277]: the trait bound `(): MyTrait` is not satisfied
- --> $DIR/no-use.rs:11:26
+ --> $DIR/no-use.rs:11:6
|
LL | <() as MyTrait>::foo(&());
- | -------------------- ^^^ the trait `MyTrait` is not implemented for `()`
- | |
- | required by a bound introduced by this call
+ | ^^ the trait `MyTrait` is not implemented for `()`
|
= help: the trait `MyTrait` is implemented for `()`
diff --git a/tests/ui/traits/reservation-impl/no-use.old.stderr b/tests/ui/traits/reservation-impl/no-use.old.stderr
index 542e3a28a..632f0f816 100644
--- a/tests/ui/traits/reservation-impl/no-use.old.stderr
+++ b/tests/ui/traits/reservation-impl/no-use.old.stderr
@@ -1,10 +1,8 @@
error[E0277]: the trait bound `(): MyTrait` is not satisfied
- --> $DIR/no-use.rs:11:26
+ --> $DIR/no-use.rs:11:6
|
LL | <() as MyTrait>::foo(&());
- | -------------------- ^^^ the trait `MyTrait` is not implemented for `()`
- | |
- | required by a bound introduced by this call
+ | ^^ the trait `MyTrait` is not implemented for `()`
|
= help: the trait `MyTrait` is implemented for `()`
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
index 206ab0789..d37943b92 100644
--- 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
@@ -1,3 +1,4 @@
+//~ ERROR overflow
// A regression test for #111729 checking that we correctly
// track recursion depth for obligations returned by confirmation.
use std::panic::RefUnwindSafe;
@@ -14,7 +15,6 @@ struct RootDatabase {
}
impl<T: RefUnwindSafe> Database for T {
- //~^ ERROR overflow
type Storage = SalsaStorage;
}
impl Database for RootDatabase {
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
index 4123a8199..8f9ce3ef1 100644
--- 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
@@ -1,17 +1,13 @@
error[E0275]: overflow evaluating the requirement `Runtime<RootDatabase>: RefUnwindSafe`
- --> $DIR/cycle-via-builtin-auto-trait-impl.rs:16:9
- |
-LL | impl<T: RefUnwindSafe> Database for T {
- | ^^^^^^^^^^^^^
|
= 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:12:8
+ --> $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:16:24
+ --> $DIR/cycle-via-builtin-auto-trait-impl.rs:17:24
|
LL | impl<T: RefUnwindSafe> Database for T {
| ------------- ^^^^^^^^ ^
diff --git a/tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.rs b/tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.rs
new file mode 100644
index 000000000..c6f9e3456
--- /dev/null
+++ b/tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.rs
@@ -0,0 +1,15 @@
+fn use_iterator<I>(itr: I)
+where
+ I: IntoIterator<Item = i32>,
+{
+}
+
+fn pass_iterator<I>(i: &dyn IntoIterator<Item = i32, IntoIter = I>)
+where
+ I: Iterator<Item = i32>,
+{
+ use_iterator(i);
+ //~^ ERROR `&dyn IntoIterator<IntoIter = I, Item = i32>` is not an iterator
+}
+
+fn main() {}
diff --git a/tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.stderr b/tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.stderr
new file mode 100644
index 000000000..bd0e7ca2c
--- /dev/null
+++ b/tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.stderr
@@ -0,0 +1,22 @@
+error[E0277]: `&dyn IntoIterator<IntoIter = I, Item = i32>` is not an iterator
+ --> $DIR/dont-suggest-unsize-deref.rs:11:18
+ |
+LL | use_iterator(i);
+ | ------------ ^ `&dyn IntoIterator<IntoIter = I, Item = i32>` is not an iterator
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Iterator` is not implemented for `&dyn IntoIterator<IntoIter = I, Item = i32>`
+ = note: required for `&dyn IntoIterator<IntoIter = I, Item = i32>` to implement `IntoIterator`
+note: required by a bound in `use_iterator`
+ --> $DIR/dont-suggest-unsize-deref.rs:3:8
+ |
+LL | fn use_iterator<I>(itr: I)
+ | ------------ required by a bound in this function
+LL | where
+LL | I: IntoIterator<Item = i32>,
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `use_iterator`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/suggest-deferences/issue-39029.fixed b/tests/ui/traits/suggest-dereferences/issue-39029.fixed
index a1abf668b..a1abf668b 100644
--- a/tests/ui/traits/suggest-deferences/issue-39029.fixed
+++ b/tests/ui/traits/suggest-dereferences/issue-39029.fixed
diff --git a/tests/ui/traits/suggest-deferences/issue-39029.rs b/tests/ui/traits/suggest-dereferences/issue-39029.rs
index 90d097105..90d097105 100644
--- a/tests/ui/traits/suggest-deferences/issue-39029.rs
+++ b/tests/ui/traits/suggest-dereferences/issue-39029.rs
diff --git a/tests/ui/traits/suggest-deferences/issue-39029.stderr b/tests/ui/traits/suggest-dereferences/issue-39029.stderr
index 49105de3d..49105de3d 100644
--- a/tests/ui/traits/suggest-deferences/issue-39029.stderr
+++ b/tests/ui/traits/suggest-dereferences/issue-39029.stderr
diff --git a/tests/ui/traits/suggest-deferences/issue-62530.fixed b/tests/ui/traits/suggest-dereferences/issue-62530.fixed
index 406caaa00..406caaa00 100644
--- a/tests/ui/traits/suggest-deferences/issue-62530.fixed
+++ b/tests/ui/traits/suggest-dereferences/issue-62530.fixed
diff --git a/tests/ui/traits/suggest-deferences/issue-62530.rs b/tests/ui/traits/suggest-dereferences/issue-62530.rs
index 53846be73..53846be73 100644
--- a/tests/ui/traits/suggest-deferences/issue-62530.rs
+++ b/tests/ui/traits/suggest-dereferences/issue-62530.rs
diff --git a/tests/ui/traits/suggest-deferences/issue-62530.stderr b/tests/ui/traits/suggest-dereferences/issue-62530.stderr
index e47ae0b65..e47ae0b65 100644
--- a/tests/ui/traits/suggest-deferences/issue-62530.stderr
+++ b/tests/ui/traits/suggest-dereferences/issue-62530.stderr
diff --git a/tests/ui/traits/suggest-deferences/multiple-0.fixed b/tests/ui/traits/suggest-dereferences/multiple-0.fixed
index b7160b75c..b7160b75c 100644
--- a/tests/ui/traits/suggest-deferences/multiple-0.fixed
+++ b/tests/ui/traits/suggest-dereferences/multiple-0.fixed
diff --git a/tests/ui/traits/suggest-deferences/multiple-0.rs b/tests/ui/traits/suggest-dereferences/multiple-0.rs
index 9ac55177f..9ac55177f 100644
--- a/tests/ui/traits/suggest-deferences/multiple-0.rs
+++ b/tests/ui/traits/suggest-dereferences/multiple-0.rs
diff --git a/tests/ui/traits/suggest-deferences/multiple-0.stderr b/tests/ui/traits/suggest-dereferences/multiple-0.stderr
index 6a4d4b8d5..6a4d4b8d5 100644
--- a/tests/ui/traits/suggest-deferences/multiple-0.stderr
+++ b/tests/ui/traits/suggest-dereferences/multiple-0.stderr
diff --git a/tests/ui/traits/suggest-deferences/multiple-1.rs b/tests/ui/traits/suggest-dereferences/multiple-1.rs
index 91c6c7924..91c6c7924 100644
--- a/tests/ui/traits/suggest-deferences/multiple-1.rs
+++ b/tests/ui/traits/suggest-dereferences/multiple-1.rs
diff --git a/tests/ui/traits/suggest-deferences/multiple-1.stderr b/tests/ui/traits/suggest-dereferences/multiple-1.stderr
index 6e12321c2..6e12321c2 100644
--- a/tests/ui/traits/suggest-deferences/multiple-1.stderr
+++ b/tests/ui/traits/suggest-dereferences/multiple-1.stderr
diff --git a/tests/ui/traits/suggest-deferences/root-obligation.fixed b/tests/ui/traits/suggest-dereferences/root-obligation.fixed
index 7a8433f90..7a8433f90 100644
--- a/tests/ui/traits/suggest-deferences/root-obligation.fixed
+++ b/tests/ui/traits/suggest-dereferences/root-obligation.fixed
diff --git a/tests/ui/traits/suggest-deferences/root-obligation.rs b/tests/ui/traits/suggest-dereferences/root-obligation.rs
index 51bac2107..51bac2107 100644
--- a/tests/ui/traits/suggest-deferences/root-obligation.rs
+++ b/tests/ui/traits/suggest-dereferences/root-obligation.rs
diff --git a/tests/ui/traits/suggest-deferences/root-obligation.stderr b/tests/ui/traits/suggest-dereferences/root-obligation.stderr
index 1363fb8c4..1363fb8c4 100644
--- a/tests/ui/traits/suggest-deferences/root-obligation.stderr
+++ b/tests/ui/traits/suggest-dereferences/root-obligation.stderr
diff --git a/tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.fixed b/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.fixed
index ea3d1bf85..ea3d1bf85 100644
--- a/tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.fixed
+++ b/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.fixed
diff --git a/tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.rs b/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.rs
index 9eda68027..9eda68027 100644
--- a/tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.rs
+++ b/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.rs
diff --git a/tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.stderr b/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.stderr
index ede31a2c7..ede31a2c7 100644
--- a/tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.stderr
+++ b/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.stderr
diff --git a/tests/ui/traits/suggest-fully-qualified-closure.rs b/tests/ui/traits/suggest-fully-qualified-closure.rs
index c077921c0..6bbb6a95d 100644
--- a/tests/ui/traits/suggest-fully-qualified-closure.rs
+++ b/tests/ui/traits/suggest-fully-qualified-closure.rs
@@ -1,6 +1,6 @@
// check-fail
// known-bug: #103705
-// normalize-stderr-test "\[closure@.*\]" -> "[closure@]"
+// normalize-stderr-test "\{closure@.*\}" -> "{closure@}"
// normalize-stderr-test "\+* ~" -> "+++ ~"
// The output of this currently suggests writing a closure in the qualified path.
diff --git a/tests/ui/traits/suggest-fully-qualified-closure.stderr b/tests/ui/traits/suggest-fully-qualified-closure.stderr
index 3df623c14..2aea3783f 100644
--- a/tests/ui/traits/suggest-fully-qualified-closure.stderr
+++ b/tests/ui/traits/suggest-fully-qualified-closure.stderr
@@ -6,7 +6,7 @@ LL | q.lol(||());
|
help: try using a fully qualified path to specify the expected types
|
-LL | <Qqq as MyTrait<T>>::lol::<[closure@]>(&q, ||());
+LL | <Qqq as MyTrait<T>>::lol::<{closure@}>(&q, ||());
| +++ ~
error[E0283]: type annotations needed
@@ -25,7 +25,7 @@ LL | impl MyTrait<u64> for Qqq{
| ^^^^^^^^^^^^^^^^^^^^^^^^^
help: try using a fully qualified path to specify the expected types
|
-LL | <Qqq as MyTrait<T>>::lol::<[closure@]>(&q, ||());
+LL | <Qqq as MyTrait<T>>::lol::<{closure@}>(&q, ||());
| +++ ~
error: aborting due to 2 previous errors
diff --git a/tests/ui/traits/suggest-where-clause.stderr b/tests/ui/traits/suggest-where-clause.stderr
index f3a4c6890..e3bbf768c 100644
--- a/tests/ui/traits/suggest-where-clause.stderr
+++ b/tests/ui/traits/suggest-where-clause.stderr
@@ -38,10 +38,10 @@ LL + fn check<T: Iterator, U>() {
|
error[E0277]: the trait bound `u64: From<T>` is not satisfied
- --> $DIR/suggest-where-clause.rs:15:5
+ --> $DIR/suggest-where-clause.rs:15:6
|
LL | <u64 as From<T>>::from;
- | ^^^^^^^^^^^^^^^^^^^^^^ the trait `From<T>` is not implemented for `u64`
+ | ^^^ the trait `From<T>` is not implemented for `u64`
|
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
|
@@ -49,10 +49,10 @@ LL | fn check<T: Iterator, U: ?Sized>() where u64: From<T> {
| ++++++++++++++++++
error[E0277]: the trait bound `u64: From<<T as Iterator>::Item>` is not satisfied
- --> $DIR/suggest-where-clause.rs:18:5
+ --> $DIR/suggest-where-clause.rs:18:6
|
LL | <u64 as From<<T as Iterator>::Item>>::from;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<<T as Iterator>::Item>` is not implemented for `u64`
+ | ^^^ the trait `From<<T as Iterator>::Item>` is not implemented for `u64`
|
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
|
@@ -60,10 +60,10 @@ LL | fn check<T: Iterator, U: ?Sized>() where u64: From<<T as Iterator>::Item> {
| ++++++++++++++++++++++++++++++++++++++
error[E0277]: the trait bound `Misc<_>: From<T>` is not satisfied
- --> $DIR/suggest-where-clause.rs:23:5
+ --> $DIR/suggest-where-clause.rs:23:6
|
LL | <Misc<_> as From<T>>::from;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<T>` is not implemented for `Misc<_>`
+ | ^^^^^^^ the trait `From<T>` is not implemented for `Misc<_>`
error[E0277]: the size for values of type `[T]` cannot be known at compilation time
--> $DIR/suggest-where-clause.rs:28:20
diff --git a/tests/ui/traits/unsend-future.rs b/tests/ui/traits/unsend-future.rs
index fbbc07b11..a8367573f 100644
--- a/tests/ui/traits/unsend-future.rs
+++ b/tests/ui/traits/unsend-future.rs
@@ -13,6 +13,7 @@ fn require_handler<H: Handler>(h: H) {}
async fn handler() {
let a = &1 as *const i32;
async {}.await;
+ let b = a;
}
fn main() {
diff --git a/tests/ui/traits/unsend-future.stderr b/tests/ui/traits/unsend-future.stderr
index 6ce1cf452..01829021b 100644
--- a/tests/ui/traits/unsend-future.stderr
+++ b/tests/ui/traits/unsend-future.stderr
@@ -1,5 +1,5 @@
error: future cannot be sent between threads safely
- --> $DIR/unsend-future.rs:19:21
+ --> $DIR/unsend-future.rs:20:21
|
LL | require_handler(handler)
| ^^^^^^^ future returned by `handler` is not `Send`
@@ -12,8 +12,6 @@ LL | let a = &1 as *const i32;
| - has type `*const i32` which is not `Send`
LL | async {}.await;
| ^^^^^ await occurs here, with `a` maybe used later
-LL | }
- | - `a` is later dropped here
note: required by a bound in `require_handler`
--> $DIR/unsend-future.rs:11:23
|
diff --git a/tests/ui/traits/vtable-res-trait-param.stderr b/tests/ui/traits/vtable-res-trait-param.stderr
index 2b3e3de9b..4cfceefb2 100644
--- a/tests/ui/traits/vtable-res-trait-param.stderr
+++ b/tests/ui/traits/vtable-res-trait-param.stderr
@@ -6,6 +6,11 @@ LL | b.gimme_an_a(y)
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/vtable-res-trait-param.rs:1:1
+ |
+LL | trait TraitA {
+ | ^^^^^^^^^^^^
note: required by a bound in `TraitB::gimme_an_a`
--> $DIR/vtable-res-trait-param.rs:6:21
|
diff --git a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.rs b/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.rs
index 546fcbaa3..b61291633 100644
--- a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.rs
+++ b/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.rs
@@ -1,3 +1,5 @@
+// check-pass
+
//! If visibility is assumed, a transmutation should be accepted even if the
//! destination type contains an unreachable field (e.g., a public field with a
//! private type). (This rule is distinct from type privacy, which still may
@@ -29,7 +31,7 @@ mod dst {
#[repr(C)] pub(self) struct Zst; // <- unreachable type
#[repr(C)] pub(in super) struct Dst {
- pub(in super) field: Zst, //~ ERROR private type
+ pub(in super) field: Zst, //~ WARNING type `dst::Zst` is more private than the item `Dst::field`
}
}
diff --git a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.stderr b/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.stderr
index be83b7ce3..80099388d 100644
--- a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.stderr
+++ b/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.stderr
@@ -1,12 +1,15 @@
-error[E0446]: private type `dst::Zst` in public interface
- --> $DIR/should_accept_if_dst_has_unreachable_field.rs:32:9
+warning: type `dst::Zst` is more private than the item `Dst::field`
+ --> $DIR/should_accept_if_dst_has_unreachable_field.rs:34:9
|
-LL | #[repr(C)] pub(self) struct Zst; // <- unreachable type
- | -------------------- `dst::Zst` declared as private
-...
LL | pub(in super) field: Zst,
- | ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ field `Dst::field` is reachable at visibility `pub(crate)`
+ |
+note: but type `dst::Zst` is only usable at visibility `pub(self)`
+ --> $DIR/should_accept_if_dst_has_unreachable_field.rs:31:16
+ |
+LL | #[repr(C)] pub(self) struct Zst; // <- unreachable type
+ | ^^^^^^^^^^^^^^^^^^^^
+ = note: `#[warn(private_interfaces)]` on by default
-error: aborting due to previous error
+warning: 1 warning emitted
-For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.rs b/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.rs
index 9c8345a8e..e7742058c 100644
--- a/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.rs
+++ b/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.rs
@@ -1,3 +1,5 @@
+// check-pass
+
//! The presence of an unreachable field in the source type (e.g., a public
//! field with a private type does not affect transmutability. (This rule is
//! distinct from type privacy, which still may forbid naming such types.)
@@ -19,7 +21,7 @@ mod src {
#[repr(C)] pub(self) struct Zst; // <- unreachable type
#[repr(C)] pub(in super) struct Src {
- pub(in super) field: Zst, //~ ERROR private type
+ pub(in super) field: Zst, //~ WARNING type `src::Zst` is more private than the item `Src::field`
}
}
diff --git a/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.stderr b/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.stderr
index 39b73302e..55fb33923 100644
--- a/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.stderr
+++ b/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.stderr
@@ -1,12 +1,15 @@
-error[E0446]: private type `src::Zst` in public interface
- --> $DIR/should_accept_if_src_has_unreachable_field.rs:22:9
+warning: type `src::Zst` is more private than the item `Src::field`
+ --> $DIR/should_accept_if_src_has_unreachable_field.rs:24:9
|
-LL | #[repr(C)] pub(self) struct Zst; // <- unreachable type
- | -------------------- `src::Zst` declared as private
-...
LL | pub(in super) field: Zst,
- | ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ field `Src::field` is reachable at visibility `pub(crate)`
+ |
+note: but type `src::Zst` is only usable at visibility `pub(self)`
+ --> $DIR/should_accept_if_src_has_unreachable_field.rs:21:16
+ |
+LL | #[repr(C)] pub(self) struct Zst; // <- unreachable type
+ | ^^^^^^^^^^^^^^^^^^^^
+ = note: `#[warn(private_interfaces)]` on by default
-error: aborting due to previous error
+warning: 1 warning emitted
-For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/transmute/issue-115402-overflow-size.rs b/tests/ui/transmute/issue-115402-overflow-size.rs
new file mode 100644
index 000000000..91168041e
--- /dev/null
+++ b/tests/ui/transmute/issue-115402-overflow-size.rs
@@ -0,0 +1,27 @@
+#![crate_type = "lib"]
+#![feature(transmutability)]
+mod assert {
+ use std::mem::BikeshedIntrinsicFrom;
+ struct Context;
+
+ pub fn is_maybe_transmutable<Src, Dst>()
+ where
+ Dst: BikeshedIntrinsicFrom<Src, Context>,
+ {
+ }
+}
+
+fn main() {
+ pub union Uninit {
+ a: [u8; usize::MAX],
+ }
+
+ #[repr(C)]
+ struct ExplicitlyPadded(Uninit);
+
+ assert::is_maybe_transmutable::<(), ExplicitlyPadded>();
+ //~^ ERROR `()` cannot be safely transmuted into `ExplicitlyPadded`
+
+ assert::is_maybe_transmutable::<ExplicitlyPadded, ()>();
+ //~^ ERROR `ExplicitlyPadded` cannot be safely transmuted into `()`
+}
diff --git a/tests/ui/transmute/issue-115402-overflow-size.stderr b/tests/ui/transmute/issue-115402-overflow-size.stderr
new file mode 100644
index 000000000..08d180f64
--- /dev/null
+++ b/tests/ui/transmute/issue-115402-overflow-size.stderr
@@ -0,0 +1,33 @@
+error[E0277]: `()` cannot be safely transmuted into `ExplicitlyPadded` in the defining scope of `assert::Context`
+ --> $DIR/issue-115402-overflow-size.rs:22:41
+ |
+LL | assert::is_maybe_transmutable::<(), ExplicitlyPadded>();
+ | ^^^^^^^^^^^^^^^^ values of the type `ExplicitlyPadded` are too big for the current architecture
+ |
+note: required by a bound in `is_maybe_transmutable`
+ --> $DIR/issue-115402-overflow-size.rs:9:14
+ |
+LL | pub fn is_maybe_transmutable<Src, Dst>()
+ | --------------------- required by a bound in this function
+LL | where
+LL | Dst: BikeshedIntrinsicFrom<Src, Context>,
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable`
+
+error[E0277]: `ExplicitlyPadded` cannot be safely transmuted into `()` in the defining scope of `assert::Context`
+ --> $DIR/issue-115402-overflow-size.rs:25:55
+ |
+LL | assert::is_maybe_transmutable::<ExplicitlyPadded, ()>();
+ | ^^ values of the type `ExplicitlyPadded` are too big for the current architecture
+ |
+note: required by a bound in `is_maybe_transmutable`
+ --> $DIR/issue-115402-overflow-size.rs:9:14
+ |
+LL | pub fn is_maybe_transmutable<Src, Dst>()
+ | --------------------- required by a bound in this function
+LL | where
+LL | Dst: BikeshedIntrinsicFrom<Src, Context>,
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/trivial-bounds/trivial-bounds-leak.stderr b/tests/ui/trivial-bounds/trivial-bounds-leak.stderr
index 02c5d5d24..be472a507 100644
--- a/tests/ui/trivial-bounds/trivial-bounds-leak.stderr
+++ b/tests/ui/trivial-bounds/trivial-bounds-leak.stderr
@@ -27,6 +27,12 @@ LL | Foo::test(&4i32);
| --------- ^^^^^ the trait `Foo` is not implemented for `i32`
| |
| required by a bound introduced by this call
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/trivial-bounds-leak.rs:4:1
+ |
+LL | pub trait Foo {
+ | ^^^^^^^^^^^^^
error[E0277]: the trait bound `i32: Foo` is not satisfied
--> $DIR/trivial-bounds-leak.rs:26:22
@@ -36,6 +42,11 @@ LL | generic_function(5i32);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/trivial-bounds-leak.rs:4:1
+ |
+LL | pub trait Foo {
+ | ^^^^^^^^^^^^^
note: required by a bound in `generic_function`
--> $DIR/trivial-bounds-leak.rs:29:24
|
diff --git a/tests/ui/issues/issue-32709.rs b/tests/ui/try-trait/issue-32709.rs
index c05bfdc4c..c05bfdc4c 100644
--- a/tests/ui/issues/issue-32709.rs
+++ b/tests/ui/try-trait/issue-32709.rs
diff --git a/tests/ui/issues/issue-32709.stderr b/tests/ui/try-trait/issue-32709.stderr
index 94e8f9295..94e8f9295 100644
--- a/tests/ui/issues/issue-32709.stderr
+++ b/tests/ui/try-trait/issue-32709.stderr
diff --git a/tests/ui/tuple/wrong_argument_ice-4.stderr b/tests/ui/tuple/wrong_argument_ice-4.stderr
index d8569ebf6..1fbf180c6 100644
--- a/tests/ui/tuple/wrong_argument_ice-4.stderr
+++ b/tests/ui/tuple/wrong_argument_ice-4.stderr
@@ -8,7 +8,7 @@ LL | | let b = 1;
LL | | });
| | -
| | |
- | |_____unexpected argument of type `[closure@$DIR/wrong_argument_ice-4.rs:2:13: 2:15]`
+ | |_____unexpected argument of type `{closure@$DIR/wrong_argument_ice-4.rs:2:13: 2:15}`
| help: remove the extra argument
|
note: closure defined here
diff --git a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs b/tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs
index fd3f9c614..660950d59 100644
--- a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs
+++ b/tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs
@@ -5,8 +5,8 @@
mod m {
pub type Foo = impl std::fmt::Debug;
- //~^ ERROR: cycle detected when computing type of `m::Foo::{opaque#0}` [E0391]
- //~| ERROR: cycle detected when computing type of `m::Foo::{opaque#0}` [E0391]
+ //~^ ERROR: cycle detected when computing type of opaque `m::Foo::{opaque#0}` [E0391]
+ //~| ERROR: cycle detected when computing type of opaque `m::Foo::{opaque#0}` [E0391]
pub fn foo() -> Foo {
22_u32
diff --git a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr b/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr
index 5bd0f76c3..d86988266 100644
--- a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr
+++ b/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr
@@ -1,4 +1,4 @@
-error[E0391]: cycle detected when computing type of `m::Foo::{opaque#0}`
+error[E0391]: cycle detected when computing type of opaque `m::Foo::{opaque#0}`
--> $DIR/auto-trait-leakage3.rs:7:20
|
LL | pub type Foo = impl std::fmt::Debug;
@@ -10,15 +10,15 @@ note: ...which requires type-checking `m::bar`...
LL | is_send(foo());
| ^^^^^^^
= note: ...which requires evaluating trait selection obligation `m::Foo: core::marker::Send`...
- = note: ...which again requires computing type of `m::Foo::{opaque#0}`, completing the cycle
-note: cycle used when checking item types in module `m`
- --> $DIR/auto-trait-leakage3.rs:6:1
+ = note: ...which again requires computing type of opaque `m::Foo::{opaque#0}`, completing the cycle
+note: cycle used when computing type of `m::Foo::{opaque#0}`
+ --> $DIR/auto-trait-leakage3.rs:7:20
|
-LL | mod m {
- | ^^^^^
+LL | pub type Foo = impl std::fmt::Debug;
+ | ^^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-error[E0391]: cycle detected when computing type of `m::Foo::{opaque#0}`
+error[E0391]: cycle detected when computing type of opaque `m::Foo::{opaque#0}`
--> $DIR/auto-trait-leakage3.rs:7:20
|
LL | pub type Foo = impl std::fmt::Debug;
@@ -29,12 +29,12 @@ note: ...which requires type-checking `m::bar`...
|
LL | pub fn bar() {
| ^^^^^^^^^^^^
- = note: ...which again requires computing type of `m::Foo::{opaque#0}`, completing the cycle
-note: cycle used when checking item types in module `m`
- --> $DIR/auto-trait-leakage3.rs:6:1
+ = note: ...which again requires computing type of opaque `m::Foo::{opaque#0}`, completing the cycle
+note: cycle used when computing type of `m::Foo::{opaque#0}`
+ --> $DIR/auto-trait-leakage3.rs:7:20
|
-LL | mod m {
- | ^^^^^
+LL | pub type Foo = impl std::fmt::Debug;
+ | ^^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: cannot check whether the hidden type of `auto_trait_leakage3[211d]::m::Foo::{opaque#0}` satisfies auto traits
diff --git a/tests/ui/type-alias-impl-trait/auxiliary/drop-shim-relates-opaque-aux.rs b/tests/ui/type-alias-impl-trait/auxiliary/drop-shim-relates-opaque-aux.rs
new file mode 100644
index 000000000..54a225100
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/auxiliary/drop-shim-relates-opaque-aux.rs
@@ -0,0 +1,21 @@
+// crate foo
+
+#![feature(type_alias_impl_trait)]
+
+type Tait = impl Sized;
+fn _constrain() -> Tait {}
+
+struct WrapperWithDrop<T>(T);
+impl<T> Drop for WrapperWithDrop<T> {
+ fn drop(&mut self) {}
+}
+
+pub struct Foo(WrapperWithDrop<Tait>);
+
+trait Id {
+ type Id: ?Sized;
+}
+impl<T: ?Sized> Id for T {
+ type Id = T;
+}
+pub struct Bar(WrapperWithDrop<<Tait as Id>::Id>);
diff --git a/tests/ui/type-alias-impl-trait/cross_inference_pattern_bug.rs b/tests/ui/type-alias-impl-trait/cross_inference_pattern_bug.rs
index 9a50c0f98..31fea42fa 100644
--- a/tests/ui/type-alias-impl-trait/cross_inference_pattern_bug.rs
+++ b/tests/ui/type-alias-impl-trait/cross_inference_pattern_bug.rs
@@ -1,5 +1,5 @@
// compile-flags: --edition=2021
-// check-pass
+// build-pass
#![feature(type_alias_impl_trait)]
fn main() {
diff --git a/tests/ui/type-alias-impl-trait/destructure_tait-ice-113594.rs b/tests/ui/type-alias-impl-trait/destructure_tait-ice-113594.rs
new file mode 100644
index 000000000..7c2d68cce
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/destructure_tait-ice-113594.rs
@@ -0,0 +1,19 @@
+// build-pass
+// edition: 2021
+
+#![feature(type_alias_impl_trait)]
+
+pub struct Foo {
+ /// This type must have nontrivial drop glue
+ field: String,
+}
+
+pub type Tait = impl Sized;
+
+pub async fn ice_cold(beverage: Tait) {
+ // Must destructure at least one field of `Foo`
+ let Foo { field } = beverage;
+ _ = field;
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/destructure_tait-layout_of-ice-113594.rs b/tests/ui/type-alias-impl-trait/destructure_tait-layout_of-ice-113594.rs
new file mode 100644
index 000000000..8568b26be
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/destructure_tait-layout_of-ice-113594.rs
@@ -0,0 +1,23 @@
+// build-pass
+// edition: 2021
+
+#![feature(type_alias_impl_trait)]
+
+fn foo<T>(x: T) {
+ type Opaque<T> = impl Sized;
+ let foo: Opaque<T> = (x,);
+ let (a,): (T,) = foo;
+}
+
+const fn bar<T: Copy>(x: T) {
+ type Opaque<T: Copy> = impl Copy;
+ let foo: Opaque<T> = (x, 2u32);
+ let (a, b): (T, u32) = foo;
+}
+
+fn main() {
+ foo::<u32>(1);
+ bar::<u32>(1);
+ const CONST: () = bar::<u32>(42u32);
+ CONST
+}
diff --git a/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.rs b/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.rs
index 5f75fdc71..4f424b8c6 100644
--- a/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.rs
+++ b/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.rs
@@ -1,11 +1,7 @@
#![feature(type_alias_impl_trait)]
#![allow(dead_code)]
-pub trait Captures<'a> {}
-
-impl<'a, T: ?Sized> Captures<'a> for T {}
-
-type OneLifetime<'a, 'b> = impl std::fmt::Debug + Captures<'a> + Captures<'b>;
+type OneLifetime<'a, 'b> = impl std::fmt::Debug;
fn foo<'a, 'b>(a: &'a u32, b: &'b u32) -> OneLifetime<'a, 'b> {
a
diff --git a/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.stderr b/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.stderr
index 546598e8a..0c50a84e8 100644
--- a/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.stderr
+++ b/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.stderr
@@ -1,11 +1,11 @@
error: concrete type differs from previous defining opaque type use
- --> $DIR/different_lifetimes_defining_uses.rs:15:5
+ --> $DIR/different_lifetimes_defining_uses.rs:11:5
|
LL | b
| ^ expected `&'a u32`, got `&'b u32`
|
note: previous use here
- --> $DIR/different_lifetimes_defining_uses.rs:11:5
+ --> $DIR/different_lifetimes_defining_uses.rs:7:5
|
LL | a
| ^
diff --git a/tests/ui/type-alias-impl-trait/drop-shim-relates-opaque-issue-114375.rs b/tests/ui/type-alias-impl-trait/drop-shim-relates-opaque-issue-114375.rs
new file mode 100644
index 000000000..51d287049
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/drop-shim-relates-opaque-issue-114375.rs
@@ -0,0 +1,10 @@
+// aux-build:drop-shim-relates-opaque-aux.rs
+// compile-flags: -Zvalidate-mir --crate-type=lib
+// build-pass
+
+extern crate drop_shim_relates_opaque_aux;
+
+pub fn drop_foo(_: drop_shim_relates_opaque_aux::Foo) {}
+pub fn drop_bar(_: drop_shim_relates_opaque_aux::Bar) {}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/escaping-bound-var.rs b/tests/ui/type-alias-impl-trait/escaping-bound-var.rs
new file mode 100644
index 000000000..bf27e76db
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/escaping-bound-var.rs
@@ -0,0 +1,22 @@
+#![feature(type_alias_impl_trait)]
+
+pub trait Trait<'a> {
+ type Assoc;
+}
+
+trait Test<'a> {}
+
+pub type Foo = impl for<'a> Trait<'a, Assoc = impl Test<'a>>;
+//~^ ERROR cannot capture late-bound lifetime in type alias impl trait
+
+impl Trait<'_> for () {
+ type Assoc = ();
+}
+
+impl Test<'_> for () {}
+
+fn constrain() -> Foo {
+ ()
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/escaping-bound-var.stderr b/tests/ui/type-alias-impl-trait/escaping-bound-var.stderr
new file mode 100644
index 000000000..8205a60cc
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/escaping-bound-var.stderr
@@ -0,0 +1,8 @@
+error: cannot capture late-bound lifetime in type alias impl trait
+ --> $DIR/escaping-bound-var.rs:9:57
+ |
+LL | pub type Foo = impl for<'a> Trait<'a, Assoc = impl Test<'a>>;
+ | -- lifetime defined here ^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.rs b/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.rs
index 14ced3418..169d4f8d5 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.rs
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.rs
@@ -2,11 +2,7 @@
fn main() {}
-pub trait Captures<'a> {}
-
-impl<'a, T: ?Sized> Captures<'a> for T {}
-
-type Two<'a, 'b> = impl std::fmt::Debug + Captures<'a> + Captures<'b>;
+type Two<'a, 'b> = impl std::fmt::Debug;
fn one<'a>(t: &'a ()) -> Two<'a, 'a> {
//~^ ERROR non-defining opaque type use
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr
index 4da69a705..b03bf2466 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr
@@ -1,25 +1,25 @@
error: non-defining opaque type use in defining scope
- --> $DIR/generic_duplicate_lifetime_param.rs:11:26
+ --> $DIR/generic_duplicate_lifetime_param.rs:7:26
|
LL | fn one<'a>(t: &'a ()) -> Two<'a, 'a> {
| ^^^^^^^^^^^ generic argument `'a` used twice
|
note: for this opaque type
- --> $DIR/generic_duplicate_lifetime_param.rs:9:20
+ --> $DIR/generic_duplicate_lifetime_param.rs:5:20
|
-LL | type Two<'a, 'b> = impl std::fmt::Debug + Captures<'a> + Captures<'b>;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | type Two<'a, 'b> = impl std::fmt::Debug;
+ | ^^^^^^^^^^^^^^^^^^^^
error: non-defining opaque type use in defining scope
- --> $DIR/generic_duplicate_lifetime_param.rs:13:5
+ --> $DIR/generic_duplicate_lifetime_param.rs:9:5
|
LL | t
| ^
|
note: lifetime used multiple times
- --> $DIR/generic_duplicate_lifetime_param.rs:9:10
+ --> $DIR/generic_duplicate_lifetime_param.rs:5:10
|
-LL | type Two<'a, 'b> = impl std::fmt::Debug + Captures<'a> + Captures<'b>;
+LL | type Two<'a, 'b> = impl std::fmt::Debug;
| ^^ ^^
error: aborting due to 2 previous errors
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.rs b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.rs
index 1e391b55a..e3c6f4d87 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.rs
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.rs
@@ -14,11 +14,7 @@ fn main() {}
// test that unused generic parameters are ok
type TwoTys<T, U> = impl Debug;
-pub trait Captures<'a> {}
-
-impl<'a, T: ?Sized> Captures<'a> for T {}
-
-type TwoLifetimes<'a, 'b> = impl Debug + Captures<'a> + Captures<'b>;
+type TwoLifetimes<'a, 'b> = impl Debug;
type TwoConsts<const X: usize, const Y: usize> = impl Debug;
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.stderr
index d8330771d..495308a6c 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.stderr
@@ -1,5 +1,5 @@
error: non-defining opaque type use in defining scope
- --> $DIR/generic_duplicate_param_use.rs:25:30
+ --> $DIR/generic_duplicate_param_use.rs:21:30
|
LL | fn one_ty<T: Debug>(t: T) -> TwoTys<T, T> {
| ^^^^^^^^^^^^ generic argument `T` used twice
@@ -11,7 +11,7 @@ LL | type TwoTys<T, U> = impl Debug;
| ^^^^^^^^^^
error: non-defining opaque type use in defining scope
- --> $DIR/generic_duplicate_param_use.rs:27:5
+ --> $DIR/generic_duplicate_param_use.rs:23:5
|
LL | t
| ^
@@ -23,49 +23,49 @@ LL | type TwoTys<T, U> = impl Debug;
| ^ ^
error: non-defining opaque type use in defining scope
- --> $DIR/generic_duplicate_param_use.rs:31:36
+ --> $DIR/generic_duplicate_param_use.rs:27:36
|
LL | fn one_lifetime<'a>(t: &'a u32) -> TwoLifetimes<'a, 'a> {
| ^^^^^^^^^^^^^^^^^^^^ generic argument `'a` used twice
|
note: for this opaque type
- --> $DIR/generic_duplicate_param_use.rs:21:29
+ --> $DIR/generic_duplicate_param_use.rs:17:29
|
-LL | type TwoLifetimes<'a, 'b> = impl Debug + Captures<'a> + Captures<'b>;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | type TwoLifetimes<'a, 'b> = impl Debug;
+ | ^^^^^^^^^^
error: non-defining opaque type use in defining scope
- --> $DIR/generic_duplicate_param_use.rs:33:5
+ --> $DIR/generic_duplicate_param_use.rs:29:5
|
LL | t
| ^
|
note: lifetime used multiple times
- --> $DIR/generic_duplicate_param_use.rs:21:19
+ --> $DIR/generic_duplicate_param_use.rs:17:19
|
-LL | type TwoLifetimes<'a, 'b> = impl Debug + Captures<'a> + Captures<'b>;
+LL | type TwoLifetimes<'a, 'b> = impl Debug;
| ^^ ^^
error: non-defining opaque type use in defining scope
- --> $DIR/generic_duplicate_param_use.rs:37:50
+ --> $DIR/generic_duplicate_param_use.rs:33:50
|
LL | fn one_const<const N: usize>(t: *mut [u8; N]) -> TwoConsts<N, N> {
| ^^^^^^^^^^^^^^^ generic argument `N` used twice
|
note: for this opaque type
- --> $DIR/generic_duplicate_param_use.rs:23:50
+ --> $DIR/generic_duplicate_param_use.rs:19:50
|
LL | type TwoConsts<const X: usize, const Y: usize> = impl Debug;
| ^^^^^^^^^^
error: non-defining opaque type use in defining scope
- --> $DIR/generic_duplicate_param_use.rs:39:5
+ --> $DIR/generic_duplicate_param_use.rs:35:5
|
LL | t
| ^
|
note: constant used multiple times
- --> $DIR/generic_duplicate_param_use.rs:23:16
+ --> $DIR/generic_duplicate_param_use.rs:19:16
|
LL | type TwoConsts<const X: usize, const Y: usize> = impl Debug;
| ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/generic_lifetime_param.rs b/tests/ui/type-alias-impl-trait/generic_lifetime_param.rs
index 106efefba..e109c38c9 100644
--- a/tests/ui/type-alias-impl-trait/generic_lifetime_param.rs
+++ b/tests/ui/type-alias-impl-trait/generic_lifetime_param.rs
@@ -1,11 +1,10 @@
-// check-pass
+// build-pass (FIXME(62277): could be check-pass?)
#![feature(type_alias_impl_trait)]
fn main() {}
-type Region<'a> = impl std::fmt::Debug + 'a;
-
+type Region<'a> = impl std::fmt::Debug;
fn region<'b>(a: &'b ()) -> Region<'b> {
a
diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs
index 6f9434255..469a493b0 100644
--- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs
+++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs
@@ -1,7 +1,7 @@
#![feature(type_alias_impl_trait)]
mod test_lifetime_param {
- type Ty<'a> = impl Sized + 'a;
+ type Ty<'a> = impl Sized;
fn defining(a: &str) -> Ty<'_> { a }
fn assert_static<'a: 'static>() {}
fn test<'a>() where Ty<'a>: 'static { assert_static::<'a>() }
@@ -9,7 +9,7 @@ mod test_lifetime_param {
}
mod test_higher_kinded_lifetime_param {
- type Ty<'a> = impl Sized + 'a;
+ type Ty<'a> = impl Sized;
fn defining(a: &str) -> Ty<'_> { a }
fn assert_static<'a: 'static>() {}
fn test<'a>() where for<'b> Ty<'b>: 'a { assert_static::<'a>() }
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 4f99236f4..06c119287 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,16 +1,20 @@
// check-pass
-#![feature(impl_trait_in_assoc_type)]
+#![feature(impl_trait_in_assoc_type, type_alias_impl_trait)]
-trait Callable {
- type Output;
- fn call() -> Self::Output;
-}
+mod foo {
+ pub trait Callable {
+ type Output;
+ fn call() -> Self::Output;
+ }
-impl<'a> Callable for &'a () {
- type Output = impl Sized;
- fn call() -> Self::Output {}
+ pub type OutputHelper = impl Sized;
+ impl<'a> Callable for &'a () {
+ type Output = OutputHelper;
+ fn call() -> Self::Output {}
+ }
}
+use foo::*;
fn test<'a>() -> impl Sized {
<&'a () as Callable>::call()
diff --git a/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.rs b/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.rs
new file mode 100644
index 000000000..f6cbbf04d
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.rs
@@ -0,0 +1,29 @@
+// edition: 2021
+// build-fail
+//~^^ ERROR cycle detected when computing layout of
+
+#![feature(impl_trait_in_assoc_type)]
+
+use core::future::Future;
+
+trait Recur {
+ type Recur: Future<Output = ()>;
+
+ fn recur(self) -> Self::Recur;
+}
+
+async fn recur(t: impl Recur) {
+ t.recur().await;
+}
+
+impl Recur for () {
+ type Recur = impl Future<Output = ()>;
+
+ fn recur(self) -> Self::Recur {
+ async move { recur(self).await; }
+ }
+}
+
+fn main() {
+ recur(());
+}
diff --git a/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.stderr b/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.stderr
new file mode 100644
index 000000000..2063becdb
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.stderr
@@ -0,0 +1,19 @@
+error[E0391]: cycle detected when computing layout of `{async block@$DIR/indirect-recursion-issue-112047.rs:23:9: 23:42}`
+ |
+ = note: ...which requires computing layout of `core::mem::maybe_uninit::MaybeUninit<{async fn body@$DIR/indirect-recursion-issue-112047.rs:15:31: 17:2}>`...
+ = note: ...which requires computing layout of `core::mem::manually_drop::ManuallyDrop<{async fn body@$DIR/indirect-recursion-issue-112047.rs:15:31: 17:2}>`...
+ = note: ...which requires computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:15:31: 17:2}`...
+ = note: ...which requires computing layout of `core::mem::maybe_uninit::MaybeUninit<<() as Recur>::Recur>`...
+ = note: ...which requires computing layout of `core::mem::maybe_uninit::MaybeUninit<{async block@$DIR/indirect-recursion-issue-112047.rs:23:9: 23:42}>`...
+ = note: ...which requires computing layout of `core::mem::manually_drop::ManuallyDrop<{async block@$DIR/indirect-recursion-issue-112047.rs:23:9: 23:42}>`...
+ = note: ...which again requires computing layout of `{async block@$DIR/indirect-recursion-issue-112047.rs:23:9: 23:42}`, completing the cycle
+note: cycle used when elaborating drops for `<impl at $DIR/indirect-recursion-issue-112047.rs:19:1: 19:18>::recur`
+ --> $DIR/indirect-recursion-issue-112047.rs:22:5
+ |
+LL | fn recur(self) -> Self::Recur {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/type-alias-impl-trait/inference-cycle.stderr b/tests/ui/type-alias-impl-trait/inference-cycle.stderr
index 41530dda9..4ab059d05 100644
--- a/tests/ui/type-alias-impl-trait/inference-cycle.stderr
+++ b/tests/ui/type-alias-impl-trait/inference-cycle.stderr
@@ -1,4 +1,4 @@
-error[E0391]: cycle detected when computing type of `m::Foo::{opaque#0}`
+error[E0391]: cycle detected when computing type of opaque `m::Foo::{opaque#0}`
--> $DIR/inference-cycle.rs:5:20
|
LL | pub type Foo = impl std::fmt::Debug;
@@ -10,15 +10,15 @@ note: ...which requires type-checking `m::bar`...
LL | is_send(foo()); // Today: error
| ^^^^^^^
= note: ...which requires evaluating trait selection obligation `m::Foo: core::marker::Send`...
- = note: ...which again requires computing type of `m::Foo::{opaque#0}`, completing the cycle
-note: cycle used when checking item types in module `m`
- --> $DIR/inference-cycle.rs:4:1
+ = note: ...which again requires computing type of opaque `m::Foo::{opaque#0}`, completing the cycle
+note: cycle used when computing type of `m::Foo::{opaque#0}`
+ --> $DIR/inference-cycle.rs:5:20
|
-LL | mod m {
- | ^^^^^
+LL | pub type Foo = impl std::fmt::Debug;
+ | ^^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-error[E0391]: cycle detected when computing type of `m::Foo::{opaque#0}`
+error[E0391]: cycle detected when computing type of opaque `m::Foo::{opaque#0}`
--> $DIR/inference-cycle.rs:5:20
|
LL | pub type Foo = impl std::fmt::Debug;
@@ -29,12 +29,12 @@ note: ...which requires type-checking `m::bar`...
|
LL | pub fn bar() {
| ^^^^^^^^^^^^
- = note: ...which again requires computing type of `m::Foo::{opaque#0}`, completing the cycle
-note: cycle used when checking item types in module `m`
- --> $DIR/inference-cycle.rs:4:1
+ = note: ...which again requires computing type of opaque `m::Foo::{opaque#0}`, completing the cycle
+note: cycle used when computing type of `m::Foo::{opaque#0}`
+ --> $DIR/inference-cycle.rs:5:20
|
-LL | mod m {
- | ^^^^^
+LL | pub type Foo = impl std::fmt::Debug;
+ | ^^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: cannot check whether the hidden type of `inference_cycle[4ecc]::m::Foo::{opaque#0}` satisfies auto traits
diff --git a/tests/ui/type-alias-impl-trait/issue-53092-2.stderr b/tests/ui/type-alias-impl-trait/issue-53092-2.stderr
index 6148131b4..e4054e14a 100644
--- a/tests/ui/type-alias-impl-trait/issue-53092-2.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-53092-2.stderr
@@ -4,6 +4,11 @@ error[E0391]: cycle detected when computing type of `Bug::{opaque#0}`
LL | type Bug<T, U> = impl Fn(T) -> U + Copy;
| ^^^^^^^^^^^^^^^^^^^^^^
|
+note: ...which requires computing type of opaque `Bug::{opaque#0}`...
+ --> $DIR/issue-53092-2.rs:4:18
+ |
+LL | type Bug<T, U> = impl Fn(T) -> U + Copy;
+ | ^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires type-checking `CONST_BUG`...
--> $DIR/issue-53092-2.rs:6:1
|
diff --git a/tests/ui/type-alias-impl-trait/issue-63279.stderr b/tests/ui/type-alias-impl-trait/issue-63279.stderr
index a4f6359b9..a86856247 100644
--- a/tests/ui/type-alias-impl-trait/issue-63279.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-63279.stderr
@@ -23,7 +23,7 @@ LL | || -> Closure { || () }
| ^^^^^ expected `()`, found closure
|
= note: expected unit type `()`
- found closure `[closure@$DIR/issue-63279.rs:7:21: 7:23]`
+ found closure `{closure@$DIR/issue-63279.rs:7:21: 7:23}`
help: use parentheses to call this closure
|
LL | || -> Closure { (|| ())() }
@@ -36,7 +36,7 @@ LL | || -> Closure { || () }
| ^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found closure
|
= note: expected unit type `()`
- found closure `[closure@$DIR/issue-63279.rs:7:5: 7:18]`
+ found closure `{closure@$DIR/issue-63279.rs:7:5: 7:18}`
help: use parentheses to call this closure
|
LL | (|| -> Closure { || () })()
diff --git a/tests/ui/type-alias-impl-trait/issue-89686.rs b/tests/ui/type-alias-impl-trait/issue-89686.rs
index 058417bdb..de070fc9d 100644
--- a/tests/ui/type-alias-impl-trait/issue-89686.rs
+++ b/tests/ui/type-alias-impl-trait/issue-89686.rs
@@ -4,7 +4,7 @@
use std::future::Future;
-type G<'a, T> = impl Future<Output = ()> + 'a;
+type G<'a, T> = impl Future<Output = ()>;
trait Trait {
type F: Future<Output = ()>;
diff --git a/tests/ui/type-alias-impl-trait/issue-89686.stderr b/tests/ui/type-alias-impl-trait/issue-89686.stderr
index 3b95a575a..b636ada8b 100644
--- a/tests/ui/type-alias-impl-trait/issue-89686.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-89686.stderr
@@ -6,7 +6,7 @@ LL | async move { self.f().await }
|
help: consider restricting type parameter `T`
|
-LL | type G<'a, T: Trait> = impl Future<Output = ()> + 'a;
+LL | type G<'a, T: Trait> = impl Future<Output = ()>;
| +++++++
error: aborting due to previous error
diff --git a/tests/ui/type-alias-impl-trait/issue-94429.stderr b/tests/ui/type-alias-impl-trait/issue-94429.stderr
index 8d7f7a07b..26605cdd2 100644
--- a/tests/ui/type-alias-impl-trait/issue-94429.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-94429.stderr
@@ -1,4 +1,4 @@
-error[E0271]: type mismatch resolving `<[generator@$DIR/issue-94429.rs:17:9: 17:16] as Generator>::Yield == ()`
+error[E0271]: type mismatch resolving `<{generator@$DIR/issue-94429.rs:17:9: 17:16} as Generator>::Yield == ()`
--> $DIR/issue-94429.rs:15:26
|
LL | fn run(&mut self) -> Self::Gen {
diff --git a/tests/ui/type-alias-impl-trait/missing_lifetime_bound.rs b/tests/ui/type-alias-impl-trait/missing_lifetime_bound.rs
index 01d1f5db1..c584a58cb 100644
--- a/tests/ui/type-alias-impl-trait/missing_lifetime_bound.rs
+++ b/tests/ui/type-alias-impl-trait/missing_lifetime_bound.rs
@@ -1,7 +1,8 @@
#![feature(type_alias_impl_trait)]
-type Opaque<'a, T> = impl Sized;
+type Opaque2<T> = impl Sized;
+type Opaque<'a, T> = Opaque2<T>;
fn defining<'a, T>(x: &'a i32) -> Opaque<T> { x }
-//~^ ERROR: hidden type for `Opaque<'a, T>` captures lifetime that does not appear in bounds
+//~^ ERROR: hidden type for `Opaque2<T>` captures lifetime that does not appear in bounds
fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr b/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr
index d666e668d..6bcae6e53 100644
--- a/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr
+++ b/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr
@@ -1,8 +1,9 @@
-error[E0700]: hidden type for `Opaque<'a, T>` captures lifetime that does not appear in bounds
- --> $DIR/missing_lifetime_bound.rs:4:47
+error[E0700]: hidden type for `Opaque2<T>` captures lifetime that does not appear in bounds
+ --> $DIR/missing_lifetime_bound.rs:5:47
|
-LL | type Opaque<'a, T> = impl Sized;
- | ---------- opaque type defined here
+LL | type Opaque2<T> = impl Sized;
+ | ---------- opaque type defined here
+LL | type Opaque<'a, T> = Opaque2<T>;
LL | fn defining<'a, T>(x: &'a i32) -> Opaque<T> { x }
| -- ^
| |
diff --git a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.rs b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.rs
index 65eb2952e..3f122f106 100644
--- a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.rs
+++ b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.rs
@@ -1,10 +1,6 @@
#![feature(type_alias_impl_trait)]
-pub trait Captures<'a> {}
-
-impl<'a, T: ?Sized> Captures<'a> for T {}
-
-type Foo<'a, 'b> = impl std::fmt::Debug + Captures<'a> + Captures<'b>;
+type Foo<'a, 'b> = impl std::fmt::Debug;
fn foo<'x, 'y>(i: &'x i32, j: &'y i32) -> (Foo<'x, 'y>, Foo<'y, 'x>) {
(i, i) //~ ERROR concrete type differs from previous
diff --git a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.stderr b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.stderr
index d7676b8e9..81e603e23 100644
--- a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.stderr
+++ b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.stderr
@@ -1,5 +1,5 @@
error: concrete type differs from previous defining opaque type use
- --> $DIR/multiple-def-uses-in-one-fn-lifetimes.rs:10:5
+ --> $DIR/multiple-def-uses-in-one-fn-lifetimes.rs:6:5
|
LL | (i, i)
| ^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-pass.rs b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-pass.rs
index 21fca047a..83fd9a1da 100644
--- a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-pass.rs
+++ b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-pass.rs
@@ -7,11 +7,7 @@ fn f<A: ToString + Clone, B: ToString + Clone>(a: A, b: B) -> (X<A, B>, X<A, B>)
(a.clone(), a)
}
-pub trait Captures<'a> {}
-
-impl<'a, T: ?Sized> Captures<'a> for T {}
-
-type Foo<'a, 'b> = impl std::fmt::Debug + Captures<'a> + Captures<'b>;
+type Foo<'a, 'b> = impl std::fmt::Debug;
fn foo<'x, 'y>(i: &'x i32, j: &'y i32) -> (Foo<'x, 'y>, Foo<'y, 'x>) {
(i, j)
diff --git a/tests/ui/type-alias-impl-trait/mututally-recursive-overflow.rs b/tests/ui/type-alias-impl-trait/mututally-recursive-overflow.rs
new file mode 100644
index 000000000..1ccd1b0cb
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/mututally-recursive-overflow.rs
@@ -0,0 +1,40 @@
+// edition: 2021
+// build-fail
+//~^^ ERROR overflow evaluating the requirement `<() as B>::Assoc == _`
+
+#![feature(rustc_attrs)]
+#![feature(impl_trait_in_assoc_type)]
+
+#[rustc_coinductive]
+trait A {
+ type Assoc;
+
+ fn test() -> Self::Assoc;
+}
+
+#[rustc_coinductive]
+trait B {
+ type Assoc;
+
+ fn test() -> Self::Assoc;
+}
+
+impl<T: A> B for T {
+ type Assoc = impl Sized;
+
+ fn test() -> <Self as B>::Assoc {
+ <T as A>::test()
+ }
+}
+
+fn main() {
+ <() as A>::test();
+}
+
+impl<T: B> A for T {
+ type Assoc = impl Sized;
+
+ fn test() -> <Self as A>::Assoc {
+ <T as B>::test()
+ }
+}
diff --git a/tests/ui/type-alias-impl-trait/mututally-recursive-overflow.stderr b/tests/ui/type-alias-impl-trait/mututally-recursive-overflow.stderr
new file mode 100644
index 000000000..49c59f7eb
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/mututally-recursive-overflow.stderr
@@ -0,0 +1,5 @@
+error[E0275]: overflow evaluating the requirement `<() as B>::Assoc == _`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.rs b/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.rs
new file mode 100644
index 000000000..fec0fdc46
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.rs
@@ -0,0 +1,9 @@
+#![feature(type_alias_impl_trait)]
+
+pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;
+//~^ ERROR use of undeclared lifetime name `'db`
+//~| ERROR cannot find type `Key` in this scope
+//~| ERROR unconstrained opaque type
+//~| ERROR unconstrained opaque type
+
+pub fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.stderr b/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.stderr
new file mode 100644
index 000000000..d4aeace4a
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.stderr
@@ -0,0 +1,47 @@
+error[E0261]: use of undeclared lifetime name `'db`
+ --> $DIR/nested-impl-trait-in-tait.rs:3:40
+ |
+LL | pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;
+ | ^^^ undeclared lifetime
+ |
+ = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
+help: consider making the bound lifetime-generic with a new `'db` lifetime
+ |
+LL | pub type Tait = impl for<'db> Iterator<Item = (&'db Key, impl Iterator)>;
+ | ++++++++
+help: consider introducing lifetime `'db` here
+ |
+LL | pub type Tait<'db> = impl Iterator<Item = (&'db Key, impl Iterator)>;
+ | +++++
+
+error[E0412]: cannot find type `Key` in this scope
+ --> $DIR/nested-impl-trait-in-tait.rs:3:44
+ |
+LL | pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;
+ | ^^^ not found in this scope
+ |
+help: consider importing this struct
+ |
+LL + use std::thread::local_impl::Key;
+ |
+
+error: unconstrained opaque type
+ --> $DIR/nested-impl-trait-in-tait.rs:3:17
+ |
+LL | pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: `Tait` must be used in combination with a concrete type within the same module
+
+error: unconstrained opaque type
+ --> $DIR/nested-impl-trait-in-tait.rs:3:49
+ |
+LL | pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;
+ | ^^^^^^^^^^^^^
+ |
+ = note: `Tait` must be used in combination with a concrete type within the same module
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0261, E0412.
+For more information about an error, try `rustc --explain E0261`.
diff --git a/tests/ui/type-alias-impl-trait/normalize-alias-type.rs b/tests/ui/type-alias-impl-trait/normalize-alias-type.rs
new file mode 100644
index 000000000..7c62002b9
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/normalize-alias-type.rs
@@ -0,0 +1,32 @@
+// check-pass
+// compile-flags: -Z mir-opt-level=3
+#![feature(type_alias_impl_trait)]
+#![crate_type = "lib"]
+pub trait Tr {
+ fn get(&self) -> u32;
+}
+
+impl Tr for (u32,) {
+ #[inline]
+ fn get(&self) -> u32 { self.0 }
+}
+
+pub fn tr1() -> impl Tr {
+ (32,)
+}
+
+pub fn tr2() -> impl Tr {
+ struct Inner {
+ x: X,
+ }
+ type X = impl Tr;
+ impl Tr for Inner {
+ fn get(&self) -> u32 {
+ self.x.get()
+ }
+ }
+
+ Inner {
+ x: tr1(),
+ }
+}
diff --git a/tests/ui/type-alias-impl-trait/privacy.rs b/tests/ui/type-alias-impl-trait/privacy.rs
index aa092f6f8..3efbfaf09 100644
--- a/tests/ui/type-alias-impl-trait/privacy.rs
+++ b/tests/ui/type-alias-impl-trait/privacy.rs
@@ -1,8 +1,10 @@
+// check-pass
+
#![feature(type_alias_impl_trait)]
type Foo = (impl Sized, u8);
pub fn foo() -> Foo {
- //~^ ERROR private type alias `Foo` in public interface
+ //~^ WARNING type alias `Foo` is more private than the item `foo`
(42, 42)
}
fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/privacy.stderr b/tests/ui/type-alias-impl-trait/privacy.stderr
index e8c6039cd..50870905c 100644
--- a/tests/ui/type-alias-impl-trait/privacy.stderr
+++ b/tests/ui/type-alias-impl-trait/privacy.stderr
@@ -1,11 +1,15 @@
-error[E0446]: private type alias `Foo` in public interface
- --> $DIR/privacy.rs:4:1
+warning: type alias `Foo` is more private than the item `foo`
+ --> $DIR/privacy.rs:6:1
|
-LL | type Foo = (impl Sized, u8);
- | -------- `Foo` declared as private
LL | pub fn foo() -> Foo {
- | ^^^^^^^^^^^^^^^^^^^ can't leak private type alias
+ | ^^^^^^^^^^^^^^^^^^^ function `foo` is reachable at visibility `pub`
+ |
+note: but type alias `Foo` is only usable at visibility `pub(crate)`
+ --> $DIR/privacy.rs:5:1
+ |
+LL | type Foo = (impl Sized, u8);
+ | ^^^^^^^^
+ = note: `#[warn(private_interfaces)]` on by default
-error: aborting due to previous error
+warning: 1 warning emitted
-For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/type-alias-impl-trait/reveal_local.stderr b/tests/ui/type-alias-impl-trait/reveal_local.stderr
index 813185c13..c62fd88f4 100644
--- a/tests/ui/type-alias-impl-trait/reveal_local.stderr
+++ b/tests/ui/type-alias-impl-trait/reveal_local.stderr
@@ -1,4 +1,4 @@
-error[E0391]: cycle detected when computing type of `Foo::{opaque#0}`
+error[E0391]: cycle detected when computing type of opaque `Foo::{opaque#0}`
--> $DIR/reveal_local.rs:5:12
|
LL | type Foo = impl Debug;
@@ -10,21 +10,15 @@ note: ...which requires type-checking `not_good`...
LL | is_send::<Foo>();
| ^^^^^^^^^^^^^^
= note: ...which requires evaluating trait selection obligation `Foo: core::marker::Send`...
- = note: ...which again requires computing type of `Foo::{opaque#0}`, completing the cycle
-note: cycle used when checking item types in top-level module
- --> $DIR/reveal_local.rs:1:1
- |
-LL | / #![feature(type_alias_impl_trait)]
-LL | |
-LL | | use std::fmt::Debug;
-LL | |
-... |
-LL | |
-LL | | fn main() {}
- | |____________^
+ = note: ...which again requires computing type of opaque `Foo::{opaque#0}`, completing the cycle
+note: cycle used when computing type of `Foo::{opaque#0}`
+ --> $DIR/reveal_local.rs:5:12
+ |
+LL | type Foo = impl Debug;
+ | ^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-error[E0391]: cycle detected when computing type of `Foo::{opaque#0}`
+error[E0391]: cycle detected when computing type of opaque `Foo::{opaque#0}`
--> $DIR/reveal_local.rs:5:12
|
LL | type Foo = impl Debug;
@@ -35,18 +29,12 @@ note: ...which requires type-checking `not_good`...
|
LL | fn not_good() {
| ^^^^^^^^^^^^^
- = note: ...which again requires computing type of `Foo::{opaque#0}`, completing the cycle
-note: cycle used when checking item types in top-level module
- --> $DIR/reveal_local.rs:1:1
- |
-LL | / #![feature(type_alias_impl_trait)]
-LL | |
-LL | | use std::fmt::Debug;
-LL | |
-... |
-LL | |
-LL | | fn main() {}
- | |____________^
+ = note: ...which again requires computing type of opaque `Foo::{opaque#0}`, completing the cycle
+note: cycle used when computing type of `Foo::{opaque#0}`
+ --> $DIR/reveal_local.rs:5:12
+ |
+LL | type Foo = impl Debug;
+ | ^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: cannot check whether the hidden type of `reveal_local[9507]::Foo::{opaque#0}` satisfies auto traits
@@ -71,7 +59,7 @@ note: required by a bound in `is_send`
LL | fn is_send<T: Send>() {}
| ^^^^ required by this bound in `is_send`
-error[E0391]: cycle detected when computing type of `Foo::{opaque#0}`
+error[E0391]: cycle detected when computing type of opaque `Foo::{opaque#0}`
--> $DIR/reveal_local.rs:5:12
|
LL | type Foo = impl Debug;
@@ -82,18 +70,12 @@ note: ...which requires type-checking `not_gooder`...
|
LL | fn not_gooder() -> Foo {
| ^^^^^^^^^^^^^^^^^^^^^^
- = note: ...which again requires computing type of `Foo::{opaque#0}`, completing the cycle
-note: cycle used when checking item types in top-level module
- --> $DIR/reveal_local.rs:1:1
- |
-LL | / #![feature(type_alias_impl_trait)]
-LL | |
-LL | | use std::fmt::Debug;
-LL | |
-... |
-LL | |
-LL | | fn main() {}
- | |____________^
+ = note: ...which again requires computing type of opaque `Foo::{opaque#0}`, completing the cycle
+note: cycle used when computing type of `Foo::{opaque#0}`
+ --> $DIR/reveal_local.rs:5:12
+ |
+LL | type Foo = impl Debug;
+ | ^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: cannot check whether the hidden type of `reveal_local[9507]::Foo::{opaque#0}` satisfies auto traits
diff --git a/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.current.stderr b/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.current.stderr
new file mode 100644
index 000000000..844103d77
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.current.stderr
@@ -0,0 +1,29 @@
+error: internal compiler error: no errors encountered even though `delay_span_bug` issued
+
+error: internal compiler error: {OpaqueTypeKey { def_id: DefId(get_rpit::{opaque#0}), args: [] }: OpaqueTypeDecl { hidden_type: OpaqueHiddenType { span: no-location (#0), ty: Alias(Opaque, AliasTy { args: [], def_id: DefId(Opaque::{opaque#0}) }) } }}
+ |
+ =
+
+
+error: internal compiler error: error performing ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing }, value: ProvePredicate { predicate: Binder { value: ProjectionPredicate(AliasTy { args: [FnDef(DefId(get_rpit), []), ()], def_id: DefId(ops::function::FnOnce::Output) }, Term::Ty(Alias(Opaque, AliasTy { args: [], def_id: DefId(Opaque::{opaque#0}) }))), bound_vars: [] } } }
+ --> $DIR/rpit_tait_equality_in_canonical_query.rs:28:5
+ |
+LL | query(get_rpit);
+ | ^^^^^^^^^^^^^^^
+ |
+
+ --> $DIR/rpit_tait_equality_in_canonical_query.rs:28:5
+ |
+LL | query(get_rpit);
+ | ^^^^^^^^^^^^^^^
+
+
+
+
+
+
+
+query stack during panic:
+end of query stack
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.rs b/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.rs
new file mode 100644
index 000000000..0f0002f77
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.rs
@@ -0,0 +1,32 @@
+//! This tries to prove the APIT's bounds in a canonical query,
+//! which doesn't know anything about the defining scope of either
+//! opaque type and thus makes a random choice as to which opaque type
+//! becomes the hidden type of the other. When we leave the canonical
+//! query, we attempt to actually check the defining anchor, but now we
+//! have a situation where the RPIT gets constrained outside its anchor.
+
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
+//[next] check-pass
+
+//[current] known-bug: #108498
+//[current] failure-status: 101
+//[current] normalize-stderr-test: "DefId\(.*?\]::" -> "DefId("
+//[current] normalize-stderr-test: "(?m)note: .*$" -> ""
+//[current] normalize-stderr-test: "(?m)^ *\d+: .*\n" -> ""
+//[current] normalize-stderr-test: "(?m)^ *at .*\n" -> ""
+
+#![feature(type_alias_impl_trait)]
+
+type Opaque = impl Sized;
+
+fn get_rpit() -> impl Clone {}
+
+fn query(_: impl FnOnce() -> Opaque) {}
+
+fn test() -> Opaque {
+ query(get_rpit);
+ get_rpit()
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query_2.rs b/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query_2.rs
new file mode 100644
index 000000000..9d7e647dd
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query_2.rs
@@ -0,0 +1,18 @@
+// The canonical query `Projection(<get_rpit as FnOnce>::Output = Opaque)`
+// is the *only* site that defines `Opaque` in MIR typeck.
+//
+// check-pass
+
+#![feature(type_alias_impl_trait)]
+
+type Opaque = impl Sized;
+
+fn get_rpit() -> impl Sized {}
+
+fn query(_: impl FnOnce() -> Opaque) {}
+
+fn test(_: Opaque) {
+ query(get_rpit);
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/self_implication.rs b/tests/ui/type-alias-impl-trait/self_implication.rs
index 4e805ee30..65659a0f3 100644
--- a/tests/ui/type-alias-impl-trait/self_implication.rs
+++ b/tests/ui/type-alias-impl-trait/self_implication.rs
@@ -22,9 +22,9 @@ fn bar() {
}
// desugared
- type FooX<'a> = impl Sized;
+ type FooX = impl Sized;
impl<'a> Foo<'a> {
- fn foo(&self) -> FooX<'a> {}
+ fn foo(&self) -> FooX {}
}
// use site
diff --git a/tests/ui/type-alias-impl-trait/tait-normalize.rs b/tests/ui/type-alias-impl-trait/tait-normalize.rs
new file mode 100644
index 000000000..26d94dbb4
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/tait-normalize.rs
@@ -0,0 +1,14 @@
+// check-pass
+
+#![feature(type_alias_impl_trait)]
+
+fn enum_upvar() {
+ type T = impl Copy;
+ let foo: T = Some((1u32, 2u32));
+ let x = move || match foo {
+ None => (),
+ Some((a, b)) => (),
+ };
+}
+
+fn main(){}
diff --git a/tests/ui/type-alias-impl-trait/variance.rs b/tests/ui/type-alias-impl-trait/variance.rs
new file mode 100644
index 000000000..e92cf2513
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/variance.rs
@@ -0,0 +1,44 @@
+#![feature(rustc_attrs, type_alias_impl_trait, impl_trait_in_assoc_type)]
+#![allow(internal_features)]
+#![rustc_variance_of_opaques]
+
+trait Captures<'a> {}
+impl<T> Captures<'_> for T {}
+
+type NotCapturedEarly<'a> = impl Sized; //~ [o]
+
+type CapturedEarly<'a> = impl Sized + Captures<'a>; //~ [o]
+
+// TAIT does *not* capture `'b`
+type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>; //~ [o]
+
+// TAIT does *not* capture `'b`
+type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>; //~ [o]
+
+type Bar<'a, 'b: 'b, T> = impl Sized; //~ ERROR [o, o, o]
+
+trait Foo<'i> {
+ type ImplicitCapture<'a>;
+
+ type ExplicitCaptureFromHeader<'a>;
+
+ type ExplicitCaptureFromGat<'a>;
+}
+
+impl<'i> Foo<'i> for &'i () {
+ type ImplicitCapture<'a> = impl Sized; //~ [o, o]
+
+ type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; //~ [o, o]
+
+ type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; //~ [o, o]
+}
+
+impl<'i> Foo<'i> for () {
+ type ImplicitCapture<'a> = impl Sized; //~ [o, o]
+
+ type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; //~ [o, o]
+
+ type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; //~ [o, o]
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/variance.stderr b/tests/ui/type-alias-impl-trait/variance.stderr
new file mode 100644
index 000000000..1794447c8
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/variance.stderr
@@ -0,0 +1,68 @@
+error: [o]
+ --> $DIR/variance.rs:8:29
+ |
+LL | type NotCapturedEarly<'a> = impl Sized;
+ | ^^^^^^^^^^
+
+error: [o]
+ --> $DIR/variance.rs:10:26
+ |
+LL | type CapturedEarly<'a> = impl Sized + Captures<'a>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: [o]
+ --> $DIR/variance.rs:13:56
+ |
+LL | type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>;
+ | ^^^^^^^^^^
+
+error: [o]
+ --> $DIR/variance.rs:16:49
+ |
+LL | type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: [o, o, o]
+ --> $DIR/variance.rs:18:27
+ |
+LL | type Bar<'a, 'b: 'b, T> = impl Sized;
+ | ^^^^^^^^^^
+
+error: [o, o]
+ --> $DIR/variance.rs:29:32
+ |
+LL | type ImplicitCapture<'a> = impl Sized;
+ | ^^^^^^^^^^
+
+error: [o, o]
+ --> $DIR/variance.rs:31:42
+ |
+LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: [o, o]
+ --> $DIR/variance.rs:33:39
+ |
+LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: [o, o]
+ --> $DIR/variance.rs:37:32
+ |
+LL | type ImplicitCapture<'a> = impl Sized;
+ | ^^^^^^^^^^
+
+error: [o, o]
+ --> $DIR/variance.rs:39:42
+ |
+LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: [o, o]
+ --> $DIR/variance.rs:41:39
+ |
+LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 11 previous errors
+
diff --git a/tests/ui/type/subtyping-opaque-type.rs b/tests/ui/type/subtyping-opaque-type.rs
new file mode 100644
index 000000000..beda232ea
--- /dev/null
+++ b/tests/ui/type/subtyping-opaque-type.rs
@@ -0,0 +1,19 @@
+// check-pass
+// compile-flags: -Zvalidate-mir
+trait Duh {}
+
+impl Duh for i32 {}
+
+trait Trait {
+ type Assoc: Duh;
+}
+
+impl<R: Duh, F: FnMut() -> R> Trait for F {
+ type Assoc = R;
+}
+
+fn foo() -> impl Trait<Assoc = impl Send> {
+ || 42
+}
+
+fn main() {}
diff --git a/tests/ui/type/type-arg-out-of-scope.rs b/tests/ui/type/type-arg-out-of-scope.rs
index 02aad0077..c36f9904e 100644
--- a/tests/ui/type/type-arg-out-of-scope.rs
+++ b/tests/ui/type/type-arg-out-of-scope.rs
@@ -1,4 +1,4 @@
-// error-pattern:can't use generic parameters from outer function
+// error-pattern:can't use generic parameters from outer item
fn foo<T>(x: T) {
fn bar(f: Box<dyn FnMut(T) -> T>) { }
}
diff --git a/tests/ui/type/type-arg-out-of-scope.stderr b/tests/ui/type/type-arg-out-of-scope.stderr
index 7f18b4510..8665001e2 100644
--- a/tests/ui/type/type-arg-out-of-scope.stderr
+++ b/tests/ui/type/type-arg-out-of-scope.stderr
@@ -1,22 +1,22 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/type-arg-out-of-scope.rs:3:29
|
LL | fn foo<T>(x: T) {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | fn bar(f: Box<dyn FnMut(T) -> T>) { }
- | - ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `<T>`
+ | help: try introducing a local generic parameter here: `<T>`
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/type-arg-out-of-scope.rs:3:35
|
LL | fn foo<T>(x: T) {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | fn bar(f: Box<dyn FnMut(T) -> T>) { }
- | - ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `<T>`
+ | help: try introducing a local generic parameter here: `<T>`
error: aborting due to 2 previous errors
diff --git a/tests/ui/type/type-error-break-tail.stderr b/tests/ui/type/type-error-break-tail.stderr
index 16dc6475c..9a02bc287 100644
--- a/tests/ui/type/type-error-break-tail.stderr
+++ b/tests/ui/type/type-error-break-tail.stderr
@@ -2,13 +2,16 @@ error[E0308]: mismatched types
--> $DIR/type-error-break-tail.rs:3:20
|
LL | fn loop_ending() -> i32 {
- | --- expected `i32` because of return type
+ | --- expected `i32` because of this return type
LL | loop {
+ | ---- this loop is expected to be of type `i32`
LL | if false { break; }
- | ^^^^^
- | |
- | expected `i32`, found `()`
- | help: give it a value of the expected type: `break 42`
+ | ^^^^^ expected `i32`, found `()`
+ |
+help: give it a value of the expected type
+ |
+LL | if false { break 42; }
+ | ++
error: aborting due to previous error
diff --git a/tests/ui/issues/auxiliary/issue-29181.rs b/tests/ui/typeck/auxiliary/issue-29181.rs
index bd1a9be4e..bd1a9be4e 100644
--- a/tests/ui/issues/auxiliary/issue-29181.rs
+++ b/tests/ui/typeck/auxiliary/issue-29181.rs
diff --git a/tests/ui/typeck/issue-114918/const-in-fn-return-type.rs b/tests/ui/typeck/issue-114918/const-in-fn-return-type.rs
new file mode 100644
index 000000000..d93963329
--- /dev/null
+++ b/tests/ui/typeck/issue-114918/const-in-fn-return-type.rs
@@ -0,0 +1,10 @@
+// Regression test for #114918
+// Test that a const generic enclosed in a block within a return type
+// produces a type mismatch error instead of triggering a const eval cycle
+
+#[allow(unused_braces)]
+fn func() -> [u8; { () } ] { //~ ERROR mismatched types
+ loop {}
+}
+
+fn main() {}
diff --git a/tests/ui/typeck/issue-114918/const-in-fn-return-type.stderr b/tests/ui/typeck/issue-114918/const-in-fn-return-type.stderr
new file mode 100644
index 000000000..88ed96e14
--- /dev/null
+++ b/tests/ui/typeck/issue-114918/const-in-fn-return-type.stderr
@@ -0,0 +1,9 @@
+error[E0308]: mismatched types
+ --> $DIR/const-in-fn-return-type.rs:6:21
+ |
+LL | fn func() -> [u8; { () } ] {
+ | ^^ expected `usize`, found `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs
new file mode 100644
index 000000000..a1b9a7eba
--- /dev/null
+++ b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs
@@ -0,0 +1,20 @@
+// Regression test for #114918
+// Test that a const generic enclosed in a block within the return type
+// of an impl fn produces a type mismatch error instead of triggering
+// a const eval cycle
+
+
+trait Trait {
+ fn func<const N: u32>() -> [ (); N ];
+}
+
+struct S {}
+
+#[allow(unused_braces)]
+impl Trait for S {
+ fn func<const N: u32>() -> [ (); { () }] { //~ ERROR mismatched types
+ N
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.stderr b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.stderr
new file mode 100644
index 000000000..9843651b1
--- /dev/null
+++ b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.stderr
@@ -0,0 +1,9 @@
+error[E0308]: mismatched types
+ --> $DIR/const-in-impl-fn-return-type.rs:15:40
+ |
+LL | fn func<const N: u32>() -> [ (); { () }] {
+ | ^^ expected `usize`, found `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/typeck/issue-114918/const-in-struct-type-arg.rs b/tests/ui/typeck/issue-114918/const-in-struct-type-arg.rs
new file mode 100644
index 000000000..9eee4ab3d
--- /dev/null
+++ b/tests/ui/typeck/issue-114918/const-in-struct-type-arg.rs
@@ -0,0 +1,12 @@
+// Regression test for #114918
+// Test that a const generic enclosed in a block in a struct's type arg
+// produces a type mismatch error instead of triggering a const eval cycle
+
+#[allow(unused_braces)]
+struct S<const N: usize> {
+ arr: [u8; N]
+}
+
+fn main() {
+ let s = S::<{ () }> { arr: [5, 6, 7]}; //~ ERROR mismatched types
+}
diff --git a/tests/ui/typeck/issue-114918/const-in-struct-type-arg.stderr b/tests/ui/typeck/issue-114918/const-in-struct-type-arg.stderr
new file mode 100644
index 000000000..3307e76d9
--- /dev/null
+++ b/tests/ui/typeck/issue-114918/const-in-struct-type-arg.stderr
@@ -0,0 +1,9 @@
+error[E0308]: mismatched types
+ --> $DIR/const-in-struct-type-arg.rs:11:19
+ |
+LL | let s = S::<{ () }> { arr: [5, 6, 7]};
+ | ^^ expected `usize`, found `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/typeck/issue-114918/const-in-trait-fn-return-type.rs b/tests/ui/typeck/issue-114918/const-in-trait-fn-return-type.rs
new file mode 100644
index 000000000..8e2eec349
--- /dev/null
+++ b/tests/ui/typeck/issue-114918/const-in-trait-fn-return-type.rs
@@ -0,0 +1,13 @@
+// Regression test for #114918
+// Test that a const generic enclosed in a block within the return type
+// of a trait method produces a type mismatch error instead of triggering
+// a const eval cycle
+
+#[allow(unused_braces)]
+trait Trait {
+ fn func<const N: u32>() -> [ (); { () }] { //~ ERROR mismatched types
+ N
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/typeck/issue-114918/const-in-trait-fn-return-type.stderr b/tests/ui/typeck/issue-114918/const-in-trait-fn-return-type.stderr
new file mode 100644
index 000000000..6bc0de77a
--- /dev/null
+++ b/tests/ui/typeck/issue-114918/const-in-trait-fn-return-type.stderr
@@ -0,0 +1,9 @@
+error[E0308]: mismatched types
+ --> $DIR/const-in-trait-fn-return-type.rs:8:40
+ |
+LL | fn func<const N: u32>() -> [ (); { () }] {
+ | ^^ expected `usize`, found `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/issues/issue-29181.rs b/tests/ui/typeck/issue-29181.rs
index 70e5bc019..70e5bc019 100644
--- a/tests/ui/issues/issue-29181.rs
+++ b/tests/ui/typeck/issue-29181.rs
diff --git a/tests/ui/issues/issue-29181.stderr b/tests/ui/typeck/issue-29181.stderr
index 53addf2fe..53addf2fe 100644
--- a/tests/ui/issues/issue-29181.stderr
+++ b/tests/ui/typeck/issue-29181.stderr
diff --git a/tests/ui/typeck/issue-31173.stderr b/tests/ui/typeck/issue-31173.stderr
index b622122f3..d65c4306a 100644
--- a/tests/ui/typeck/issue-31173.stderr
+++ b/tests/ui/typeck/issue-31173.stderr
@@ -1,4 +1,4 @@
-error[E0271]: expected `TakeWhile<&mut IntoIter<u8>, [closure@issue-31173.rs:7:21]>` to be an iterator that yields `&_`, but it yields `u8`
+error[E0271]: expected `TakeWhile<&mut IntoIter<u8>, {closure@issue-31173.rs:7:21}>` to be an iterator that yields `&_`, but it yields `u8`
--> $DIR/issue-31173.rs:11:10
|
LL | .cloned()
@@ -21,7 +21,7 @@ LL | | })
note: required by a bound in `cloned`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut IntoIter<u8>, [closure@issue-31173.rs:7:21]>>`, but its trait bounds were not satisfied
+error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut IntoIter<u8>, {closure@issue-31173.rs:7:21}>>`, but its trait bounds were not satisfied
--> $DIR/issue-31173.rs:12:10
|
LL | let temp: Vec<u8> = it
@@ -43,10 +43,10 @@ LL | | .collect();
= note: doesn't satisfy `_: Iterator`
|
= note: the following trait bounds were not satisfied:
- `<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]> as Iterator>::Item = &_`
- which is required by `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>: Iterator`
- `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>: Iterator`
- which is required by `&mut Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>: Iterator`
+ `<TakeWhile<&mut std::vec::IntoIter<u8>, {closure@$DIR/issue-31173.rs:7:21: 7:25}> as Iterator>::Item = &_`
+ which is required by `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, {closure@$DIR/issue-31173.rs:7:21: 7:25}>>: Iterator`
+ `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, {closure@$DIR/issue-31173.rs:7:21: 7:25}>>: Iterator`
+ which is required by `&mut Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, {closure@$DIR/issue-31173.rs:7:21: 7:25}>>: Iterator`
error: aborting due to 2 previous errors
diff --git a/tests/ui/typeck/issue-90804-incorrect-reference-suggestion.stderr b/tests/ui/typeck/issue-90804-incorrect-reference-suggestion.stderr
index 08eab0253..a75024aa2 100644
--- a/tests/ui/typeck/issue-90804-incorrect-reference-suggestion.stderr
+++ b/tests/ui/typeck/issue-90804-incorrect-reference-suggestion.stderr
@@ -1,10 +1,8 @@
error[E0277]: the trait bound `(): Marker<u32>` is not satisfied
- --> $DIR/issue-90804-incorrect-reference-suggestion.rs:10:17
+ --> $DIR/issue-90804-incorrect-reference-suggestion.rs:10:13
|
LL | check::<()>(());
- | ----------- ^^ the trait `Marker<u32>` is not implemented for `()`
- | |
- | required by a bound introduced by this call
+ | ^^ the trait `Marker<u32>` is not implemented for `()`
|
note: required by a bound in `check`
--> $DIR/issue-90804-incorrect-reference-suggestion.rs:7:17
diff --git a/tests/ui/typeck/return_type_containing_closure.stderr b/tests/ui/typeck/return_type_containing_closure.stderr
index f9a240963..7be46ac07 100644
--- a/tests/ui/typeck/return_type_containing_closure.stderr
+++ b/tests/ui/typeck/return_type_containing_closure.stderr
@@ -5,7 +5,7 @@ LL | vec!['a'].iter().map(|c| c)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Map<Iter<'_, char>, ...>`
|
= note: expected unit type `()`
- found struct `Map<std::slice::Iter<'_, char>, [closure@$DIR/return_type_containing_closure.rs:3:26: 3:29]>`
+ found struct `Map<std::slice::Iter<'_, char>, {closure@$DIR/return_type_containing_closure.rs:3:26: 3:29}>`
help: consider using a semicolon here
|
LL | vec!['a'].iter().map(|c| c);
diff --git a/tests/ui/typeck/typeck_type_placeholder_item.stderr b/tests/ui/typeck/typeck_type_placeholder_item.stderr
index 0c5e7e3ce..a4325b01f 100644
--- a/tests/ui/typeck/typeck_type_placeholder_item.stderr
+++ b/tests/ui/typeck/typeck_type_placeholder_item.stderr
@@ -443,7 +443,7 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures
LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x);
| ^ not allowed in type signatures
|
-note: however, the inferred type `Map<Filter<Range<i32>, [closure@typeck_type_placeholder_item.rs:229:29]>, [closure@typeck_type_placeholder_item.rs:229:49]>` cannot be named
+note: however, the inferred type `Map<Filter<Range<i32>, {closure@typeck_type_placeholder_item.rs:229:29}>, {closure@typeck_type_placeholder_item.rs:229:49}>` cannot be named
--> $DIR/typeck_type_placeholder_item.rs:229:14
|
LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x);
diff --git a/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr b/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr
index 85adf7751..ae0a06e63 100644
--- a/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr
+++ b/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr
@@ -1,10 +1,8 @@
error[E0277]: cannot add `u32` to `i32`
- --> $DIR/ufcs-qpath-self-mismatch.rs:4:31
+ --> $DIR/ufcs-qpath-self-mismatch.rs:4:6
|
LL | <i32 as Add<u32>>::add(1, 2);
- | ---------------------- ^ no implementation for `i32 + u32`
- | |
- | required by a bound introduced by this call
+ | ^^^ no implementation for `i32 + u32`
|
= help: the trait `Add<u32>` is not implemented for `i32`
= help: the following other types implement trait `Add<Rhs>`:
diff --git a/tests/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr b/tests/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr
index 482fd3cb4..e2d867ff2 100644
--- a/tests/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr
+++ b/tests/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr
@@ -1,8 +1,8 @@
-error[E0599]: no method named `call` found for closure `[closure@$DIR/unboxed-closures-static-call-wrong-trait.rs:6:26: 6:29]` in the current scope
+error[E0599]: no method named `call` found for closure `{closure@$DIR/unboxed-closures-static-call-wrong-trait.rs:6:26: 6:29}` in the current scope
--> $DIR/unboxed-closures-static-call-wrong-trait.rs:7:10
|
LL | mut_.call((0, ));
- | ^^^^ method not found in `[closure@unboxed-closures-static-call-wrong-trait.rs:6:26]`
+ | ^^^^ method not found in `{closure@unboxed-closures-static-call-wrong-trait.rs:6:26}`
error: aborting due to previous error
diff --git a/tests/ui/unevaluated_fixed_size_array_len.stderr b/tests/ui/unevaluated_fixed_size_array_len.stderr
index 5e67b2c44..b04a7b7f2 100644
--- a/tests/ui/unevaluated_fixed_size_array_len.stderr
+++ b/tests/ui/unevaluated_fixed_size_array_len.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `[(); 0]: Foo` is not satisfied
- --> $DIR/unevaluated_fixed_size_array_len.rs:12:5
+ --> $DIR/unevaluated_fixed_size_array_len.rs:12:6
|
LL | <[(); 0] as Foo>::foo()
- | ^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `[(); 0]`
+ | ^^^^^^^ the trait `Foo` is not implemented for `[(); 0]`
|
= help: the trait `Foo` is implemented for `[(); 1]`
diff --git a/tests/ui/union/projection-as-union-type-error-2.stderr b/tests/ui/union/projection-as-union-type-error-2.stderr
index bab226f27..21f4ea103 100644
--- a/tests/ui/union/projection-as-union-type-error-2.stderr
+++ b/tests/ui/union/projection-as-union-type-error-2.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `u8: NotImplemented` is not satisfied
LL | a: <Foo as Identity>::Identity,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotImplemented` is not implemented for `u8`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/projection-as-union-type-error-2.rs:9:1
+ |
+LL | trait NotImplemented {}
+ | ^^^^^^^^^^^^^^^^^^^^
note: required for `u8` to implement `Identity`
--> $DIR/projection-as-union-type-error-2.rs:11:25
|
diff --git a/tests/ui/union/projection-as-union-type-error.stderr b/tests/ui/union/projection-as-union-type-error.stderr
index e4fbe9603..2b0241caf 100644
--- a/tests/ui/union/projection-as-union-type-error.stderr
+++ b/tests/ui/union/projection-as-union-type-error.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `u8: Identity` is not satisfied
|
LL | a: <Foo as Identity>::Identity,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Identity` is not implemented for `u8`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/projection-as-union-type-error.rs:6:1
+ |
+LL | pub trait Identity {
+ | ^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/union/unnamed-fields/restrict_anonymous_structs.rs b/tests/ui/union/unnamed-fields/restrict_anonymous_structs.rs
new file mode 100644
index 000000000..192bbba5a
--- /dev/null
+++ b/tests/ui/union/unnamed-fields/restrict_anonymous_structs.rs
@@ -0,0 +1,37 @@
+#![allow(incomplete_features)]
+#![feature(unnamed_fields)]
+
+struct F {
+ field: struct { field: u8 }, //~ ERROR anonymous structs are not allowed outside of unnamed struct or union fields
+ //~^ ERROR anonymous structs are unimplemented
+ _: struct { field: u8 },
+ //~^ ERROR anonymous structs are unimplemented
+}
+
+struct G {
+ _: (u8, u8), //~ ERROR unnamed fields can only have struct or union types
+}
+
+union H {
+ field: struct { field: u8 }, //~ ERROR anonymous structs are not allowed outside of unnamed struct or union fields
+ //~^ ERROR anonymous structs are unimplemented
+ _: struct { field: u8 },
+ //~^ ERROR anonymous structs are unimplemented
+}
+
+union I {
+ _: (u8, u8), //~ ERROR unnamed fields can only have struct or union types
+}
+
+enum K {
+ M {
+ _ : struct { field: u8 }, //~ ERROR anonymous structs are not allowed outside of unnamed struct or union fields
+ //~^ ERROR unnamed fields are not allowed outside of structs or unions
+ //~| ERROR anonymous structs are unimplemented
+ },
+ N {
+ _ : u8, //~ ERROR unnamed fields are not allowed outside of structs or unions
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/union/unnamed-fields/restrict_anonymous_structs.stderr b/tests/ui/union/unnamed-fields/restrict_anonymous_structs.stderr
new file mode 100644
index 000000000..fd731766c
--- /dev/null
+++ b/tests/ui/union/unnamed-fields/restrict_anonymous_structs.stderr
@@ -0,0 +1,78 @@
+error: anonymous structs are not allowed outside of unnamed struct or union fields
+ --> $DIR/restrict_anonymous_structs.rs:5:12
+ |
+LL | field: struct { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^^ anonymous struct declared here
+
+error: unnamed fields can only have struct or union types
+ --> $DIR/restrict_anonymous_structs.rs:12:5
+ |
+LL | _: (u8, u8),
+ | ^ -------- not a struct or union
+
+error: anonymous structs are not allowed outside of unnamed struct or union fields
+ --> $DIR/restrict_anonymous_structs.rs:16:12
+ |
+LL | field: struct { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^^ anonymous struct declared here
+
+error: unnamed fields can only have struct or union types
+ --> $DIR/restrict_anonymous_structs.rs:23:5
+ |
+LL | _: (u8, u8),
+ | ^ -------- not a struct or union
+
+error: unnamed fields are not allowed outside of structs or unions
+ --> $DIR/restrict_anonymous_structs.rs:28:9
+ |
+LL | _ : struct { field: u8 },
+ | -^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | unnamed field declared here
+
+error: anonymous structs are not allowed outside of unnamed struct or union fields
+ --> $DIR/restrict_anonymous_structs.rs:28:13
+ |
+LL | _ : struct { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^^ anonymous struct declared here
+
+error: unnamed fields are not allowed outside of structs or unions
+ --> $DIR/restrict_anonymous_structs.rs:33:9
+ |
+LL | _ : u8,
+ | -^^^^^
+ | |
+ | unnamed field declared here
+
+error: anonymous structs are unimplemented
+ --> $DIR/restrict_anonymous_structs.rs:5:12
+ |
+LL | field: struct { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: anonymous structs are unimplemented
+ --> $DIR/restrict_anonymous_structs.rs:7:8
+ |
+LL | _: struct { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: anonymous structs are unimplemented
+ --> $DIR/restrict_anonymous_structs.rs:16:12
+ |
+LL | field: struct { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: anonymous structs are unimplemented
+ --> $DIR/restrict_anonymous_structs.rs:18:8
+ |
+LL | _: struct { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: anonymous structs are unimplemented
+ --> $DIR/restrict_anonymous_structs.rs:28:13
+ |
+LL | _ : struct { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 12 previous errors
+
diff --git a/tests/ui/union/unnamed-fields/restrict_anonymous_unions.rs b/tests/ui/union/unnamed-fields/restrict_anonymous_unions.rs
new file mode 100644
index 000000000..c69266089
--- /dev/null
+++ b/tests/ui/union/unnamed-fields/restrict_anonymous_unions.rs
@@ -0,0 +1,37 @@
+#![allow(incomplete_features)]
+#![feature(unnamed_fields)]
+
+struct F {
+ field: union { field: u8 }, //~ ERROR anonymous unions are not allowed outside of unnamed struct or union fields
+ //~^ ERROR anonymous unions are unimplemented
+ _: union { field: u8 },
+ //~^ ERROR anonymous unions are unimplemented
+}
+
+struct G {
+ _: (u8, u8), //~ ERROR unnamed fields can only have struct or union types
+}
+
+union H {
+ field: union { field: u8 }, //~ ERROR anonymous unions are not allowed outside of unnamed struct or union fields
+ //~^ ERROR anonymous unions are unimplemented
+ _: union { field: u8 },
+ //~^ ERROR anonymous unions are unimplemented
+}
+
+union I {
+ _: (u8, u8), //~ ERROR unnamed fields can only have struct or union types
+}
+
+enum K {
+ M {
+ _ : union { field: u8 }, //~ ERROR anonymous unions are not allowed outside of unnamed struct or union fields
+ //~^ ERROR unnamed fields are not allowed outside of structs or unions
+ //~| ERROR anonymous unions are unimplemented
+ },
+ N {
+ _ : u8, //~ ERROR unnamed fields are not allowed outside of structs or unions
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/union/unnamed-fields/restrict_anonymous_unions.stderr b/tests/ui/union/unnamed-fields/restrict_anonymous_unions.stderr
new file mode 100644
index 000000000..c65cad775
--- /dev/null
+++ b/tests/ui/union/unnamed-fields/restrict_anonymous_unions.stderr
@@ -0,0 +1,78 @@
+error: anonymous unions are not allowed outside of unnamed struct or union fields
+ --> $DIR/restrict_anonymous_unions.rs:5:12
+ |
+LL | field: union { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^ anonymous union declared here
+
+error: unnamed fields can only have struct or union types
+ --> $DIR/restrict_anonymous_unions.rs:12:5
+ |
+LL | _: (u8, u8),
+ | ^ -------- not a struct or union
+
+error: anonymous unions are not allowed outside of unnamed struct or union fields
+ --> $DIR/restrict_anonymous_unions.rs:16:12
+ |
+LL | field: union { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^ anonymous union declared here
+
+error: unnamed fields can only have struct or union types
+ --> $DIR/restrict_anonymous_unions.rs:23:5
+ |
+LL | _: (u8, u8),
+ | ^ -------- not a struct or union
+
+error: unnamed fields are not allowed outside of structs or unions
+ --> $DIR/restrict_anonymous_unions.rs:28:9
+ |
+LL | _ : union { field: u8 },
+ | -^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | unnamed field declared here
+
+error: anonymous unions are not allowed outside of unnamed struct or union fields
+ --> $DIR/restrict_anonymous_unions.rs:28:13
+ |
+LL | _ : union { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^ anonymous union declared here
+
+error: unnamed fields are not allowed outside of structs or unions
+ --> $DIR/restrict_anonymous_unions.rs:33:9
+ |
+LL | _ : u8,
+ | -^^^^^
+ | |
+ | unnamed field declared here
+
+error: anonymous unions are unimplemented
+ --> $DIR/restrict_anonymous_unions.rs:5:12
+ |
+LL | field: union { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: anonymous unions are unimplemented
+ --> $DIR/restrict_anonymous_unions.rs:7:8
+ |
+LL | _: union { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: anonymous unions are unimplemented
+ --> $DIR/restrict_anonymous_unions.rs:16:12
+ |
+LL | field: union { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: anonymous unions are unimplemented
+ --> $DIR/restrict_anonymous_unions.rs:18:8
+ |
+LL | _: union { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: anonymous unions are unimplemented
+ --> $DIR/restrict_anonymous_unions.rs:28:13
+ |
+LL | _ : union { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 12 previous errors
+
diff --git a/tests/ui/unknown-unstable-lints/deny-unstable-lint-command-line.stderr b/tests/ui/unknown-unstable-lints/deny-unstable-lint-command-line.stderr
index aa73b824a..32f8d2f45 100644
--- a/tests/ui/unknown-unstable-lints/deny-unstable-lint-command-line.stderr
+++ b/tests/ui/unknown-unstable-lints/deny-unstable-lint-command-line.stderr
@@ -1,18 +1,18 @@
error: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
- = help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = help: add `-Zcrate-attr="feature(test_unstable_lint)"` to the command-line options to enable
= note: requested on the command line with `-D unknown-lints`
error: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
- = help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = help: add `-Zcrate-attr="feature(test_unstable_lint)"` to the command-line options to enable
error: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
- = help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = help: add `-Zcrate-attr="feature(test_unstable_lint)"` to the command-line options to enable
error: aborting due to 3 previous errors
diff --git a/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-command-line.stderr b/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-command-line.stderr
index 82851c800..dd9ecf02f 100644
--- a/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-command-line.stderr
+++ b/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-command-line.stderr
@@ -1,18 +1,18 @@
warning: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
- = help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = help: add `-Zcrate-attr="feature(test_unstable_lint)"` to the command-line options to enable
= note: requested on the command line with `-W unknown-lints`
warning: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
- = help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = help: add `-Zcrate-attr="feature(test_unstable_lint)"` to the command-line options to enable
warning: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
- = help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = help: add `-Zcrate-attr="feature(test_unstable_lint)"` to the command-line options to enable
warning: 3 warnings emitted
diff --git a/tests/ui/unreachable-code.rs b/tests/ui/unreachable-code.rs
index 28b938edc..64174db7a 100644
--- a/tests/ui/unreachable-code.rs
+++ b/tests/ui/unreachable-code.rs
@@ -2,25 +2,32 @@
#![allow(unused_must_use)]
#![allow(dead_code)]
-
#![allow(path_statements)]
#![allow(unreachable_code)]
#![allow(unused_variables)]
+#![feature(if_let_guard)]
-fn id(x: bool) -> bool { x }
+fn id(x: bool) -> bool {
+ x
+}
fn call_id() {
let c = panic!();
id(c);
}
-fn call_id_2() { id(true) && id(return); }
+fn call_id_2() {
+ id(true) && id(return);
+}
-fn call_id_3() { id(return) && id(return); }
+fn call_id_3() {
+ id(return) && id(return);
+}
fn ret_guard() {
match 2 {
x if (return) => { x; }
+ x if let true = return => { x; }
_ => {}
}
}
diff --git a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs
new file mode 100644
index 000000000..a192f3445
--- /dev/null
+++ b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs
@@ -0,0 +1,17 @@
+// edition: 2024
+// compile-flags: -Zunstable-options
+// check-pass
+
+#![crate_type = "lib"]
+
+#![deny(unused_unsafe)]
+
+unsafe fn unsf() {}
+
+unsafe fn foo() {
+ unsf();
+ //~^ WARN call to unsafe function is unsafe and requires unsafe block
+
+ // no unused_unsafe
+ unsafe { unsf(); }
+}
diff --git a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr
new file mode 100644
index 000000000..fbc621f4d
--- /dev/null
+++ b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr
@@ -0,0 +1,16 @@
+warning: call to unsafe function is unsafe and requires unsafe block (error E0133)
+ --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:12:5
+ |
+LL | unsf();
+ | ^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+note: an unsafe function restricts its caller, but its body is safe by default
+ --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:11:1
+ |
+LL | unsafe fn foo() {
+ | ^^^^^^^^^^^^^^^
+ = note: `#[warn(unsafe_op_in_unsafe_fn)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/unsafe/initializing-ranged-via-ctor.rs b/tests/ui/unsafe/initializing-ranged-via-ctor.rs
new file mode 100644
index 000000000..ca44fa7e4
--- /dev/null
+++ b/tests/ui/unsafe/initializing-ranged-via-ctor.rs
@@ -0,0 +1,11 @@
+#![feature(rustc_attrs)]
+#![allow(internal_features)]
+
+#[derive(Debug)]
+#[rustc_layout_scalar_valid_range_start(2)]
+struct NonZeroAndOneU8(u8);
+
+fn main() {
+ println!("{:?}", Some(1).map(NonZeroAndOneU8).unwrap());
+ //~^ ERROR found `unsafe fn(u8) -> NonZeroAndOneU8 {NonZeroAndOneU8}`
+}
diff --git a/tests/ui/unsafe/initializing-ranged-via-ctor.stderr b/tests/ui/unsafe/initializing-ranged-via-ctor.stderr
new file mode 100644
index 000000000..d34554c66
--- /dev/null
+++ b/tests/ui/unsafe/initializing-ranged-via-ctor.stderr
@@ -0,0 +1,16 @@
+error[E0277]: expected a `FnOnce<({integer},)>` closure, found `unsafe fn(u8) -> NonZeroAndOneU8 {NonZeroAndOneU8}`
+ --> $DIR/initializing-ranged-via-ctor.rs:9:34
+ |
+LL | println!("{:?}", Some(1).map(NonZeroAndOneU8).unwrap());
+ | --- ^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `FnOnce<({integer},)>` is not implemented for fn item `unsafe fn(u8) -> NonZeroAndOneU8 {NonZeroAndOneU8}`
+ = note: unsafe function cannot be called generically without an unsafe block
+note: required by a bound in `Option::<T>::map`
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.rs b/tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.rs
new file mode 100644
index 000000000..68559338d
--- /dev/null
+++ b/tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.rs
@@ -0,0 +1,16 @@
+// Regression test for #115348.
+
+unsafe fn uwu() {}
+
+// Tests that the false-positive warning "unnecessary `unsafe` block"
+// should not be reported, when the error "non-exhaustive patterns"
+// appears.
+
+fn foo(x: Option<u32>) {
+ match x {
+ //~^ ERROR non-exhaustive patterns: `None` not covered
+ Some(_) => unsafe { uwu() },
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.stderr b/tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.stderr
new file mode 100644
index 000000000..7384899b9
--- /dev/null
+++ b/tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.stderr
@@ -0,0 +1,21 @@
+error[E0004]: non-exhaustive patterns: `None` not covered
+ --> $DIR/issue-115348-false-positive-warning-of-unnecessary-unsafe.rs:10:11
+ |
+LL | match x {
+ | ^ pattern `None` not covered
+ |
+note: `Option<u32>` defined here
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+ ::: $SRC_DIR/core/src/option.rs:LL:COL
+ |
+ = note: not covered
+ = note: the matched value is of type `Option<u32>`
+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(_) => unsafe { uwu() },
+LL ~ None => todo!(),
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/unsafe/ranged-ctor-as-fn-ptr.rs b/tests/ui/unsafe/ranged-ctor-as-fn-ptr.rs
new file mode 100644
index 000000000..a91e57951
--- /dev/null
+++ b/tests/ui/unsafe/ranged-ctor-as-fn-ptr.rs
@@ -0,0 +1,10 @@
+#![feature(rustc_attrs)]
+
+#[derive(Debug)]
+#[rustc_layout_scalar_valid_range_start(2)]
+struct NonZeroAndOneU8(u8);
+
+fn main() {
+ let x: fn(u8) -> NonZeroAndOneU8 = NonZeroAndOneU8;
+ //~^ ERROR mismatched types
+}
diff --git a/tests/ui/unsafe/ranged-ctor-as-fn-ptr.stderr b/tests/ui/unsafe/ranged-ctor-as-fn-ptr.stderr
new file mode 100644
index 000000000..660c40704
--- /dev/null
+++ b/tests/ui/unsafe/ranged-ctor-as-fn-ptr.stderr
@@ -0,0 +1,15 @@
+error[E0308]: mismatched types
+ --> $DIR/ranged-ctor-as-fn-ptr.rs:8:40
+ |
+LL | let x: fn(u8) -> NonZeroAndOneU8 = NonZeroAndOneU8;
+ | ------------------------- ^^^^^^^^^^^^^^^ expected normal fn, found unsafe fn
+ | |
+ | expected due to this
+ |
+ = note: expected fn pointer `fn(_) -> NonZeroAndOneU8`
+ found struct constructor `unsafe fn(_) -> NonZeroAndOneU8 {NonZeroAndOneU8}`
+ = note: unsafe functions cannot be coerced into safe function pointers
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/unsized/issue-115203.rs b/tests/ui/unsized/issue-115203.rs
new file mode 100644
index 000000000..5fe7bd642
--- /dev/null
+++ b/tests/ui/unsized/issue-115203.rs
@@ -0,0 +1,11 @@
+// compile-flags: --emit link
+
+fn main() {
+ let a: [i32; 0] = [];
+ match [a[..]] {
+ //~^ ERROR cannot move a value of type `[i32]
+ //~| ERROR cannot move out of type `[i32]`, a non-copy slice
+ [[]] => (),
+ _ => (),
+ }
+}
diff --git a/tests/ui/unsized/issue-115203.stderr b/tests/ui/unsized/issue-115203.stderr
new file mode 100644
index 000000000..3ee734988
--- /dev/null
+++ b/tests/ui/unsized/issue-115203.stderr
@@ -0,0 +1,19 @@
+error[E0161]: cannot move a value of type `[i32]`
+ --> $DIR/issue-115203.rs:5:12
+ |
+LL | match [a[..]] {
+ | ^^^^^ the size of `[i32]` cannot be statically determined
+
+error[E0508]: cannot move out of type `[i32]`, a non-copy slice
+ --> $DIR/issue-115203.rs:5:12
+ |
+LL | match [a[..]] {
+ | ^^^^^
+ | |
+ | cannot move out of here
+ | move occurs because value has type `[i32]`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0161, E0508.
+For more information about an error, try `rustc --explain E0161`.
diff --git a/tests/ui/unsized/issue-115809.rs b/tests/ui/unsized/issue-115809.rs
new file mode 100644
index 000000000..ff25365ea
--- /dev/null
+++ b/tests/ui/unsized/issue-115809.rs
@@ -0,0 +1,13 @@
+// compile-flags: --emit=link -Zmir-opt-level=2 -Zpolymorphize=on
+
+fn foo<T>() {
+ let a: [i32; 0] = [];
+ match [a[..]] {
+ //~^ ERROR cannot move a value of type `[i32]
+ //~| ERROR cannot move out of type `[i32]`, a non-copy slice
+ [[x]] => {}
+ _ => (),
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/unsized/issue-115809.stderr b/tests/ui/unsized/issue-115809.stderr
new file mode 100644
index 000000000..a92554b79
--- /dev/null
+++ b/tests/ui/unsized/issue-115809.stderr
@@ -0,0 +1,19 @@
+error[E0161]: cannot move a value of type `[i32]`
+ --> $DIR/issue-115809.rs:5:12
+ |
+LL | match [a[..]] {
+ | ^^^^^ the size of `[i32]` cannot be statically determined
+
+error[E0508]: cannot move out of type `[i32]`, a non-copy slice
+ --> $DIR/issue-115809.rs:5:12
+ |
+LL | match [a[..]] {
+ | ^^^^^
+ | |
+ | cannot move out of here
+ | move occurs because value has type `[i32]`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0161, E0508.
+For more information about an error, try `rustc --explain E0161`.
diff --git a/tests/ui/unsized/issue-75707.stderr b/tests/ui/unsized/issue-75707.stderr
index 97618ed05..aa7f9c78f 100644
--- a/tests/ui/unsized/issue-75707.stderr
+++ b/tests/ui/unsized/issue-75707.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `MyCall: Callback` is not satisfied
LL | f::<dyn Processing<Call = MyCall>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Callback` is not implemented for `MyCall`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-75707.rs:1:1
+ |
+LL | pub trait Callback {
+ | ^^^^^^^^^^^^^^^^^^
note: required by a bound in `f`
--> $DIR/issue-75707.rs:9:9
|
diff --git a/tests/ui/unsized/unsized3.stderr b/tests/ui/unsized/unsized3.stderr
index 3ef9a8753..a11243980 100644
--- a/tests/ui/unsized/unsized3.stderr
+++ b/tests/ui/unsized/unsized3.stderr
@@ -1,12 +1,10 @@
error[E0277]: the size for values of type `X` cannot be known at compilation time
- --> $DIR/unsized3.rs:7:13
+ --> $DIR/unsized3.rs:7:10
|
LL | fn f1<X: ?Sized>(x: &X) {
| - this type parameter needs to be `Sized`
LL | f2::<X>(x);
- | ------- ^ doesn't have a size known at compile-time
- | |
- | required by a bound introduced by this call
+ | ^ doesn't have a size known at compile-time
|
note: required by a bound in `f2`
--> $DIR/unsized3.rs:10:7
@@ -24,14 +22,12 @@ LL | fn f2<X: ?Sized>(x: &X) {
| ++++++++
error[E0277]: the size for values of type `X` cannot be known at compilation time
- --> $DIR/unsized3.rs:18:13
+ --> $DIR/unsized3.rs:18:10
|
LL | fn f3<X: ?Sized + T>(x: &X) {
| - this type parameter needs to be `Sized`
LL | f4::<X>(x);
- | ------- ^ doesn't have a size known at compile-time
- | |
- | required by a bound introduced by this call
+ | ^ doesn't have a size known at compile-time
|
note: required by a bound in `f4`
--> $DIR/unsized3.rs:21:7
diff --git a/tests/ui/wf/hir-wf-canonicalized.stderr b/tests/ui/wf/hir-wf-canonicalized.stderr
index 9fd0f9c81..21122e37d 100644
--- a/tests/ui/wf/hir-wf-canonicalized.stderr
+++ b/tests/ui/wf/hir-wf-canonicalized.stderr
@@ -3,12 +3,24 @@ error[E0277]: the trait bound `Bar<'a, T>: Foo` is not satisfied
|
LL | callback: Box<dyn Callback<dyn Callback<Bar<'a, T>>>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `Bar<'a, T>`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/hir-wf-canonicalized.rs:3:1
+ |
+LL | trait Foo {
+ | ^^^^^^^^^
error[E0277]: the trait bound `(dyn Callback<Bar<'a, T>, for<'b, 'c, 'd> Output = ()> + 'static): Foo` is not satisfied
--> $DIR/hir-wf-canonicalized.rs:10:15
|
LL | callback: Box<dyn Callback<dyn Callback<Bar<'a, T>>>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `(dyn Callback<Bar<'a, T>, for<'b, 'c, 'd> Output = ()> + 'static)`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/hir-wf-canonicalized.rs:3:1
+ |
+LL | trait Foo {
+ | ^^^^^^^^^
error[E0277]: the size for values of type `(dyn Callback<Bar<'a, T>, for<'b, 'c, 'd> Output = ()> + 'static)` cannot be known at compilation time
--> $DIR/hir-wf-canonicalized.rs:10:15
diff --git a/tests/ui/wf/issue-95665.stderr b/tests/ui/wf/issue-95665.stderr
index b1cda59a9..f80cd41a4 100644
--- a/tests/ui/wf/issue-95665.stderr
+++ b/tests/ui/wf/issue-95665.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `u8: Trait` is not satisfied
LL | static VAR: Struct<u8>;
| ^^^^^^^^^^ the trait `Trait` is not implemented for `u8`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-95665.rs:4:1
+ |
+LL | pub trait Trait: {}
+ | ^^^^^^^^^^^^^^^
note: required by a bound in `Struct`
--> $DIR/issue-95665.rs:6:22
|
diff --git a/tests/ui/wf/wf-complex-assoc-type.stderr b/tests/ui/wf/wf-complex-assoc-type.stderr
index ef613e313..6a623bec8 100644
--- a/tests/ui/wf/wf-complex-assoc-type.stderr
+++ b/tests/ui/wf/wf-complex-assoc-type.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `bool: MyTrait` is not satisfied
LL | type MyItem = Option<((AssertMyTrait<bool>, u8))>;
| ^^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `bool`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/wf-complex-assoc-type.rs:1:1
+ |
+LL | trait MyTrait {}
+ | ^^^^^^^^^^^^^
note: required by a bound in `AssertMyTrait`
--> $DIR/wf-complex-assoc-type.rs:2:25
|
diff --git a/tests/ui/wf/wf-foreign-fn-decl-ret.stderr b/tests/ui/wf/wf-foreign-fn-decl-ret.stderr
index b03023b5f..0e9360104 100644
--- a/tests/ui/wf/wf-foreign-fn-decl-ret.stderr
+++ b/tests/ui/wf/wf-foreign-fn-decl-ret.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `(): Foo` is not satisfied
|
LL | pub fn lint_me() -> <() as Foo>::Assoc;
| ^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `()`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/wf-foreign-fn-decl-ret.rs:6:1
+ |
+LL | pub trait Foo {
+ | ^^^^^^^^^^^^^
error[E0277]: the trait bound `u32: Unsatisfied` is not satisfied
--> $DIR/wf-foreign-fn-decl-ret.rs:14:32
@@ -10,6 +16,11 @@ error[E0277]: the trait bound `u32: Unsatisfied` is not satisfied
LL | pub fn lint_me_aswell() -> Bar<u32>;
| ^^^^^^^^ the trait `Unsatisfied` is not implemented for `u32`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/wf-foreign-fn-decl-ret.rs:1:1
+ |
+LL | pub trait Unsatisfied {}
+ | ^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `Bar`
--> $DIR/wf-foreign-fn-decl-ret.rs:4:19
|
diff --git a/tests/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr b/tests/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr
index e460cdcd3..52f46562c 100644
--- a/tests/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr
+++ b/tests/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `DefaultAllocator: Allocator` is not satisfied
|
LL | struct Foo(Matrix<<DefaultAllocator as Allocator>::Buffer>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Allocator` is not implemented for `DefaultAllocator`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/wf-packed-on-proj-of-type-as-unimpl-trait.rs:23:1
+ |
+LL | pub trait Allocator { type Buffer; }
+ | ^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/where-clauses/higher-ranked-fn-type.quiet.stderr b/tests/ui/where-clauses/higher-ranked-fn-type.quiet.stderr
index 191a8ca8e..29b36f44a 100644
--- a/tests/ui/where-clauses/higher-ranked-fn-type.quiet.stderr
+++ b/tests/ui/where-clauses/higher-ranked-fn-type.quiet.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `for<'b> fn(&'b ()): Foo` is not satisfied
LL | called()
| ^^^^^^ the trait `for<'b> Foo` is not implemented for `fn(&'b ())`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/higher-ranked-fn-type.rs:6:1
+ |
+LL | trait Foo {
+ | ^^^^^^^^^
note: required by a bound in `called`
--> $DIR/higher-ranked-fn-type.rs:12:25
|
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 ce409f627..54afeaa7e 100644
--- a/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr
+++ b/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `for<Region(BrNamed(DefId(0:6 ~ higher_ranked_fn_t
LL | called()
| ^^^^^^ the trait `for<Region(BrNamed(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b), 'b))> 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) }) ())`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/higher-ranked-fn-type.rs:6:1
+ |
+LL | trait Foo {
+ | ^^^^^^^^^
note: required by a bound in `called`
--> $DIR/higher-ranked-fn-type.rs:12:25
|
diff --git a/tests/ui/where-clauses/where-clause-method-substituion.stderr b/tests/ui/where-clauses/where-clause-method-substituion.stderr
index 8c47ed6d4..2f3b615a1 100644
--- a/tests/ui/where-clauses/where-clause-method-substituion.stderr
+++ b/tests/ui/where-clauses/where-clause-method-substituion.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `X: Foo<X>` is not satisfied
LL | 1.method::<X>();
| ^ the trait `Foo<X>` is not implemented for `X`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/where-clause-method-substituion.rs:1:1
+ |
+LL | trait Foo<T> {
+ | ^^^^^^^^^^^^
note: required by a bound in `Bar::method`
--> $DIR/where-clause-method-substituion.rs:6:34
|