about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/assembly/targets/targets-pe.rs6
-rw-r--r--tests/codegen-units/item-collection/closures.rs12
-rw-r--r--tests/codegen-units/item-collection/non-generic-closures.rs7
-rw-r--r--tests/codegen/min-function-alignment.rs43
-rw-r--r--tests/codegen/naked-fn/min-function-alignment.rs44
-rw-r--r--tests/codegen/slice-init.rs26
-rw-r--r--tests/codegen/vec-in-place.rs54
-rw-r--r--tests/codegen/vec_pop_push_noop.rs3
-rw-r--r--tests/coverage/generic-unused-impl.cov-map18
-rw-r--r--tests/coverage/generic-unused-impl.coverage18
-rw-r--r--tests/coverage/generic-unused-impl.rs17
-rw-r--r--tests/crashes/114317.rs6
-rw-r--r--tests/crashes/126182.rs10
-rw-r--r--tests/crashes/135122.rs24
-rw-r--r--tests/crashes/135124.rs9
-rw-r--r--tests/crashes/135128.rs10
-rw-r--r--tests/crashes/135210.rs8
-rw-r--r--tests/crashes/135341.rs5
-rw-r--r--tests/debuginfo/strings-and-strs.rs2
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff2
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff2
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff2
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff2
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff6
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff6
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff6
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff6
-rw-r--r--tests/mir-opt/gvn.aggregate_struct_then_transmute.GVN.panic-abort.diff340
-rw-r--r--tests/mir-opt/gvn.aggregate_struct_then_transmute.GVN.panic-unwind.diff340
-rw-r--r--tests/mir-opt/gvn.rs102
-rw-r--r--tests/mir-opt/gvn.transmute_then_cast_pointer.GVN.panic-abort.diff115
-rw-r--r--tests/mir-opt/gvn.transmute_then_cast_pointer.GVN.panic-unwind.diff115
-rw-r--r--tests/mir-opt/gvn.transmute_then_transmute_again.GVN.panic-abort.diff74
-rw-r--r--tests/mir-opt/gvn.transmute_then_transmute_again.GVN.panic-unwind.diff74
-rw-r--r--tests/mir-opt/impossible_predicates.impossible_predicate.ImpossiblePredicates.diff30
-rw-r--r--tests/mir-opt/impossible_predicates.rs10
-rw-r--r--tests/mir-opt/inline/forced.caller.ForceInline.panic-abort.diff21
-rw-r--r--tests/mir-opt/inline/forced.caller.ForceInline.panic-unwind.diff21
-rw-r--r--tests/mir-opt/inline/forced.rs13
-rw-r--r--tests/mir-opt/inline/forced_async.caller.ForceInline.panic-abort.diff12
-rw-r--r--tests/mir-opt/inline/forced_async.caller.ForceInline.panic-unwind.diff12
-rw-r--r--tests/mir-opt/inline/forced_async.rs14
-rw-r--r--tests/mir-opt/inline/forced_closure.caller-{closure#0}.ForceInline.panic-abort.diff21
-rw-r--r--tests/mir-opt/inline/forced_closure.caller-{closure#0}.ForceInline.panic-unwind.diff21
-rw-r--r--tests/mir-opt/inline/forced_closure.rs15
-rw-r--r--tests/mir-opt/inline/forced_dead_code.caller.ForceInline.panic-abort.diff21
-rw-r--r--tests/mir-opt/inline/forced_dead_code.caller.ForceInline.panic-unwind.diff21
-rw-r--r--tests/mir-opt/inline/forced_dead_code.rs17
-rw-r--r--tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff87
-rw-r--r--tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir2
-rw-r--r--tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir2
-rw-r--r--tests/mir-opt/inline/unsized_argument.caller.Inline.diff2
-rw-r--r--tests/mir-opt/instsimplify/aggregate_array.const_items.InstSimplify-after-simplifycfg.diff13
-rw-r--r--tests/mir-opt/instsimplify/aggregate_array.equal_referents.InstSimplify-after-simplifycfg.diff12
-rw-r--r--tests/mir-opt/instsimplify/aggregate_array.literals.InstSimplify-after-simplifycfg.diff13
-rw-r--r--tests/mir-opt/instsimplify/aggregate_array.local.InstSimplify-after-simplifycfg.diff39
-rw-r--r--tests/mir-opt/instsimplify/aggregate_array.rs56
-rw-r--r--tests/mir-opt/instsimplify/aggregate_array.strs.InstSimplify-after-simplifycfg.diff13
-rw-r--r--tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify-after-simplifycfg.diff83
-rw-r--r--tests/mir-opt/instsimplify/combine_transmutes.keep_transparent_transmute.InstSimplify-after-simplifycfg.diff30
-rw-r--r--tests/mir-opt/instsimplify/combine_transmutes.rs25
-rw-r--r--tests/mir-opt/instsimplify/simplify_repeat.repeat_once_to_aggregate.InstSimplify-after-simplifycfg.diff30
-rw-r--r--tests/mir-opt/instsimplify/simplify_repeat.rs20
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir182
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir132
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir116
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir116
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir130
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir130
-rw-r--r--tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir46
-rw-r--r--tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir46
-rw-r--r--tests/mir-opt/remove_zsts.get_union.PreCodegen.after.mir10
-rw-r--r--tests/mir-opt/remove_zsts.remove_generic_array.RemoveZsts.diff44
-rw-r--r--tests/mir-opt/remove_zsts.rs19
-rw-r--r--tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-abort.mir1
-rw-r--r--tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-unwind.mir1
-rw-r--r--tests/rustdoc-json/reexport/simple_private.rs6
-rw-r--r--tests/rustdoc-json/reexport/simple_public.rs5
-rw-r--r--tests/rustdoc-ui/crate-reference-in-block-module.stderr0
-rw-r--r--tests/rustdoc-ui/macro-docs.stdout0
-rw-r--r--tests/rustdoc/inline_local/staged-inline.rs18
-rw-r--r--tests/ui/abi/c-zst.aarch64-darwin.stderr2
-rw-r--r--tests/ui/abi/c-zst.powerpc-linux.stderr2
-rw-r--r--tests/ui/abi/c-zst.s390x-linux.stderr2
-rw-r--r--tests/ui/abi/c-zst.sparc64-linux.stderr2
-rw-r--r--tests/ui/abi/c-zst.x86_64-linux.stderr2
-rw-r--r--tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr2
-rw-r--r--tests/ui/abi/debug.rs1
-rw-r--r--tests/ui/abi/debug.stderr46
-rw-r--r--tests/ui/abi/sysv64-zst.stderr2
-rw-r--r--tests/ui/abi/win64-zst.x86_64-linux.stderr2
-rw-r--r--tests/ui/abi/win64-zst.x86_64-windows-gnu.stderr2
-rw-r--r--tests/ui/abi/win64-zst.x86_64-windows-msvc.stderr2
-rw-r--r--tests/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.stderr8
-rw-r--r--tests/ui/associated-types/cache/project-fn-ret-invariant.oneuse.stderr8
-rw-r--r--tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr48
-rw-r--r--tests/ui/async-await/issues/issue-63388-1.rs2
-rw-r--r--tests/ui/async-await/issues/issue-63388-1.stderr15
-rw-r--r--tests/ui/async-await/issues/issue-63388-2.rs2
-rw-r--r--tests/ui/async-await/issues/issue-63388-2.stderr15
-rw-r--r--tests/ui/borrowck/fn-item-check-type-params.stderr4
-rw-r--r--tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr8
-rw-r--r--tests/ui/borrowck/issue-7573.rs2
-rw-r--r--tests/ui/borrowck/issue-7573.stderr4
-rw-r--r--tests/ui/borrowck/two-phase-surprise-no-conflict.stderr22
-rw-r--r--tests/ui/c-variadic/variadic-ffi-4.stderr6
-rw-r--r--tests/ui/cast/ptr-to-trait-obj-different-regions-misc.rs2
-rw-r--r--tests/ui/cast/ptr-to-trait-obj-different-regions-misc.stderr18
-rw-r--r--tests/ui/coherence/auxiliary/pr_review_132289_2_lib.rs37
-rw-r--r--tests/ui/coherence/auxiliary/pr_review_132289_3_lib.rs12
-rw-r--r--tests/ui/coherence/pr-review-132289-1.rs52
-rw-r--r--tests/ui/coherence/pr-review-132289-2.rs26
-rw-r--r--tests/ui/coherence/pr-review-132289-3.rs50
-rw-r--r--tests/ui/coherence/pr-review-132289-3.run.stdout1
-rw-r--r--tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs1
-rw-r--r--tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr26
-rw-r--r--tests/ui/const-generics/generic_const_exprs/lit_type_mismatch.rs22
-rw-r--r--tests/ui/const-generics/generic_const_exprs/lit_type_mismatch.stderr21
-rw-r--r--tests/ui/const-generics/min_const_generics/invalid-patterns.32bit.stderr48
-rw-r--r--tests/ui/const-generics/min_const_generics/invalid-patterns.64bit.stderr48
-rw-r--r--tests/ui/consts/const_in_pattern/non_structural_with_escaping_bounds.rs15
-rw-r--r--tests/ui/consts/const_in_pattern/non_structural_with_escaping_bounds.stderr13
-rw-r--r--tests/ui/consts/fn_trait_refs.stderr93
-rw-r--r--tests/ui/consts/promoted_const_call.stderr4
-rw-r--r--tests/ui/consts/recursive-block.rs7
-rw-r--r--tests/ui/consts/recursive-block.stderr11
-rw-r--r--tests/ui/consts/recursive-const-in-impl.rs12
-rw-r--r--tests/ui/consts/recursive-const-in-impl.stderr11
-rw-r--r--tests/ui/coroutine/gen_block.e2024.stderr4
-rw-r--r--tests/ui/coroutine/gen_block.none.stderr4
-rw-r--r--tests/ui/coroutine/gen_block.rs4
-rw-r--r--tests/ui/coroutine/resume-arg-outlives-2.rs2
-rw-r--r--tests/ui/coroutine/resume-arg-outlives-2.stderr24
-rw-r--r--tests/ui/drop/lint-tail-expr-drop-order-borrowck.rs51
-rw-r--r--tests/ui/drop/lint-tail-expr-drop-order-borrowck.stderr52
-rw-r--r--tests/ui/drop/lint-tail-expr-drop-order.rs1
-rw-r--r--tests/ui/drop/lint-tail-expr-drop-order.stderr27
-rw-r--r--tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.stderr4
-rw-r--r--tests/ui/drop/tail_expr_drop_order-on-recursive-boxed-fut.rs13
-rw-r--r--tests/ui/drop/tail_expr_drop_order-on-thread-local.rs56
-rw-r--r--tests/ui/dyn-keyword/misspelled-associated-item.rs12
-rw-r--r--tests/ui/dyn-keyword/misspelled-associated-item.stderr18
-rw-r--r--tests/ui/fn/fn_def_coercion.rs4
-rw-r--r--tests/ui/fn/fn_def_coercion.stderr41
-rw-r--r--tests/ui/fn/implied-bounds-unnorm-associated-type-2.stderr2
-rw-r--r--tests/ui/force-inlining/asm.rs68
-rw-r--r--tests/ui/force-inlining/asm.stderr34
-rw-r--r--tests/ui/force-inlining/auxiliary/callees.rs10
-rw-r--r--tests/ui/force-inlining/cast.rs25
-rw-r--r--tests/ui/force-inlining/cast.stderr40
-rw-r--r--tests/ui/force-inlining/cross-crate.rs13
-rw-r--r--tests/ui/force-inlining/deny-async.rs24
-rw-r--r--tests/ui/force-inlining/deny-async.stderr24
-rw-r--r--tests/ui/force-inlining/deny-closure.rs25
-rw-r--r--tests/ui/force-inlining/deny-closure.stderr24
-rw-r--r--tests/ui/force-inlining/deny.rs23
-rw-r--r--tests/ui/force-inlining/deny.stderr24
-rw-r--r--tests/ui/force-inlining/early-deny.rs21
-rw-r--r--tests/ui/force-inlining/early-deny.stderr35
-rw-r--r--tests/ui/force-inlining/gate.rs12
-rw-r--r--tests/ui/force-inlining/gate.stderr21
-rw-r--r--tests/ui/force-inlining/invalid.rs164
-rw-r--r--tests/ui/force-inlining/invalid.stderr377
-rw-r--r--tests/ui/force-inlining/shims.rs9
-rw-r--r--tests/ui/generic-const-items/recursive.rs7
-rw-r--r--tests/ui/generic-const-items/recursive.stderr11
-rw-r--r--tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.edition2021.stderr14
-rw-r--r--tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.rs1
-rw-r--r--tests/ui/impl-trait/issue-99073-2.stderr18
-rw-r--r--tests/ui/impl-trait/issue-99073.stderr16
-rw-r--r--tests/ui/impl-trait/multiple-defining-usages-in-body.stderr24
-rw-r--r--tests/ui/impl-trait/multiple-lifetimes/error-handling.stderr3
-rw-r--r--tests/ui/impl-trait/normalize-tait-in-const.stderr19
-rw-r--r--tests/ui/impl-trait/precise-capturing/migration-note.rs4
-rw-r--r--tests/ui/impl-trait/precise-capturing/migration-note.stderr16
-rw-r--r--tests/ui/impl-trait/rpit/early_bound.stderr18
-rw-r--r--tests/ui/impl-trait/rpit/non-defining-use.stderr16
-rw-r--r--tests/ui/inline-const/collect-scopes-in-pat.rs16
-rw-r--r--tests/ui/inline-const/const-expr-lifetime-err.stderr7
-rw-r--r--tests/ui/inline-const/const-match-pat-lifetime-err.stderr2
-rw-r--r--tests/ui/invalid-compile-flags/crate-type-flag.rs1
-rw-r--r--tests/ui/issues/issue-25901.rs2
-rw-r--r--tests/ui/issues/issue-25901.stderr9
-rw-r--r--tests/ui/kindck/kindck-impl-type-params.stderr4
-rw-r--r--tests/ui/layout/debug.rs1
-rw-r--r--tests/ui/layout/debug.stderr56
-rw-r--r--tests/ui/layout/hexagon-enum.rs1
-rw-r--r--tests/ui/layout/hexagon-enum.stderr20
-rw-r--r--tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.rs1
-rw-r--r--tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr27
-rw-r--r--tests/ui/layout/issue-96185-overaligned-enum.rs1
-rw-r--r--tests/ui/layout/issue-96185-overaligned-enum.stderr10
-rw-r--r--tests/ui/layout/randomize.rs62
-rw-r--r--tests/ui/layout/thumb-enum.rs1
-rw-r--r--tests/ui/layout/thumb-enum.stderr20
-rw-r--r--tests/ui/layout/zero-sized-array-enum-niche.rs1
-rw-r--r--tests/ui/layout/zero-sized-array-enum-niche.stderr21
-rw-r--r--tests/ui/lifetimes/copy_modulo_regions.stderr5
-rw-r--r--tests/ui/lifetimes/issue-90170-elision-mismatch.stderr9
-rw-r--r--tests/ui/lifetimes/issue-90600-expected-return-static-indirect.rs2
-rw-r--r--tests/ui/lifetimes/issue-90600-expected-return-static-indirect.stderr28
-rw-r--r--tests/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr3
-rw-r--r--tests/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr3
-rw-r--r--tests/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.rs2
-rw-r--r--tests/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr10
-rw-r--r--tests/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.rs2
-rw-r--r--tests/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr10
-rw-r--r--tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.rs2
-rw-r--r--tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr14
-rw-r--r--tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr6
-rw-r--r--tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr3
-rw-r--r--tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr3
-rw-r--r--tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr3
-rw-r--r--tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr3
-rw-r--r--tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr3
-rw-r--r--tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr3
-rw-r--r--tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr3
-rw-r--r--tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr3
-rw-r--r--tests/ui/lint/invalid_value.stderr10
-rw-r--r--tests/ui/macros/stringify.rs2
-rw-r--r--tests/ui/methods/bad-wf-when-selecting-method.rs18
-rw-r--r--tests/ui/methods/bad-wf-when-selecting-method.stderr54
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr4
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-ref.rs3
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr20
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr12
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs3
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr27
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs3
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr27
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-val.rs3
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-val.stderr20
-rw-r--r--tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr4
-rw-r--r--tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr4
-rw-r--r--tests/ui/nll/issue-54779-anon-static-lifetime.rs2
-rw-r--r--tests/ui/nll/issue-54779-anon-static-lifetime.stderr14
-rw-r--r--tests/ui/nll/issue-62007-assign-const-index.stderr7
-rw-r--r--tests/ui/nll/issue-62007-assign-differing-fields.stderr7
-rw-r--r--tests/ui/nll/issue-67007-escaping-data.rs4
-rw-r--r--tests/ui/nll/issue-67007-escaping-data.stderr8
-rw-r--r--tests/ui/nll/issue-95272.rs2
-rw-r--r--tests/ui/nll/issue-95272.stderr9
-rw-r--r--tests/ui/nll/issue-98589-closures-relate-named-regions.stderr4
-rw-r--r--tests/ui/nll/outlives-suggestion-simple.stderr4
-rw-r--r--tests/ui/nll/polonius/assignment-to-differing-field.stderr16
-rw-r--r--tests/ui/nll/relate_tys/var-appears-twice.stderr7
-rw-r--r--tests/ui/nll/ty-outlives/projection-one-region-closure.stderr58
-rw-r--r--tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr14
-rw-r--r--tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr2
-rw-r--r--tests/ui/nll/type-check-pointer-comparisons.stderr18
-rw-r--r--tests/ui/nll/user-annotations/adt-nullary-enums.stderr73
-rw-r--r--tests/ui/nll/user-annotations/adt-tuple-struct-calls.stderr18
-rw-r--r--tests/ui/nll/user-annotations/method-ufcs-1.stderr7
-rw-r--r--tests/ui/nll/user-annotations/method-ufcs-2.stderr7
-rw-r--r--tests/ui/nll/where_clauses_in_structs.stderr4
-rw-r--r--tests/ui/pattern/patkind-litrange-no-expr.rs2
-rw-r--r--tests/ui/pattern/struct-pattern-on-non-struct-resolve-error.rs10
-rw-r--r--tests/ui/pattern/struct-pattern-on-non-struct-resolve-error.stderr34
-rw-r--r--tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.rs9
-rw-r--r--tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.stderr14
-rw-r--r--tests/ui/print_type_sizes/niche-filling.stdout2
-rw-r--r--tests/ui/proc-macro/quote-debug.stdout49
-rw-r--r--tests/ui/proc-macro/quote/auxiliary/basic.rs361
-rw-r--r--tests/ui/proc-macro/quote/basic.rs8
-rw-r--r--tests/ui/proc-macro/quote/debug.rs (renamed from tests/ui/proc-macro/quote-debug.rs)1
-rw-r--r--tests/ui/proc-macro/quote/debug.stdout72
-rw-r--r--tests/ui/proc-macro/quote/does-not-have-iter-interpolated-dup.rs17
-rw-r--r--tests/ui/proc-macro/quote/does-not-have-iter-interpolated-dup.stderr10
-rw-r--r--tests/ui/proc-macro/quote/does-not-have-iter-interpolated.rs17
-rw-r--r--tests/ui/proc-macro/quote/does-not-have-iter-interpolated.stderr10
-rw-r--r--tests/ui/proc-macro/quote/does-not-have-iter-separated.rs13
-rw-r--r--tests/ui/proc-macro/quote/does-not-have-iter-separated.stderr10
-rw-r--r--tests/ui/proc-macro/quote/does-not-have-iter.rs13
-rw-r--r--tests/ui/proc-macro/quote/does-not-have-iter.stderr10
-rw-r--r--tests/ui/proc-macro/quote/not-quotable.rs12
-rw-r--r--tests/ui/proc-macro/quote/not-quotable.stderr24
-rw-r--r--tests/ui/proc-macro/quote/not-repeatable.rs16
-rw-r--r--tests/ui/proc-macro/quote/not-repeatable.stderr10
-rw-r--r--tests/ui/query-system/query_depth.stderr2
-rw-r--r--tests/ui/regions/better-blame-constraint-for-outlives-static.rs13
-rw-r--r--tests/ui/regions/better-blame-constraint-for-outlives-static.stderr11
-rw-r--r--tests/ui/regions/lifetime-not-long-enough-suggestion-regression-test-124563.stderr4
-rw-r--r--tests/ui/regions/region-invariant-static-error-reporting.rs6
-rw-r--r--tests/ui/regions/region-invariant-static-error-reporting.stderr18
-rw-r--r--tests/ui/repeat-expr/repeat_count.stderr12
-rw-r--r--tests/ui/repeat-expr/typo-in-repeat-expr-issue-80173.rs70
-rw-r--r--tests/ui/repeat-expr/typo-in-repeat-expr-issue-80173.stderr124
-rw-r--r--tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr14
-rw-r--r--tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr14
-rw-r--r--tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr14
-rw-r--r--tests/ui/repr/repr-c-dead-variants.rs1
-rw-r--r--tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr14
-rw-r--r--tests/ui/repr/repr-c-int-dead-variants.rs1
-rw-r--r--tests/ui/repr/repr-c-int-dead-variants.stderr14
-rw-r--r--tests/ui/self/arbitrary-self-from-method-substs-ice.stderr1
-rw-r--r--tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021-without-dyn.stderr78
-rw-r--r--tests/ui/suggestions/issue-105761-suggest-self-for-closure.stderr4
-rw-r--r--tests/ui/traits/coercion-generic-regions.stderr6
-rw-r--r--tests/ui/traits/const-traits/const-drop-bound.rs3
-rw-r--r--tests/ui/traits/const-traits/const-drop-bound.stderr17
-rw-r--r--tests/ui/traits/const-traits/const-drop-fail-2.precise.stderr9
-rw-r--r--tests/ui/traits/const-traits/const-drop-fail-2.stock.stderr9
-rw-r--r--tests/ui/traits/const-traits/const-drop-fail.new_precise.stderr (renamed from tests/ui/traits/const-traits/const-drop-fail.precise.stderr)8
-rw-r--r--tests/ui/traits/const-traits/const-drop-fail.new_stock.stderr (renamed from tests/ui/traits/const-traits/const-drop-fail.stock.stderr)8
-rw-r--r--tests/ui/traits/const-traits/const-drop-fail.old_precise.stderr33
-rw-r--r--tests/ui/traits/const-traits/const-drop-fail.old_stock.stderr33
-rw-r--r--tests/ui/traits/const-traits/const-drop-fail.rs7
-rw-r--r--tests/ui/traits/const-traits/cross-crate.stock.stderr5
-rw-r--r--tests/ui/traits/const-traits/cross-crate.stocknc.stderr10
-rw-r--r--tests/ui/traits/const-traits/staged-api-user-crate.stderr1
-rw-r--r--tests/ui/traits/const-traits/super-traits-fail-3.nyn.stderr5
-rw-r--r--tests/ui/traits/const-traits/super-traits-fail-3.nyy.stderr5
-rw-r--r--tests/ui/traits/fn-pointer/bare-fn-no-impl-fn-ptr-99875.rs2
-rw-r--r--tests/ui/traits/fn-pointer/bare-fn-no-impl-fn-ptr-99875.stderr12
-rw-r--r--tests/ui/traits/issue-106072.rs4
-rw-r--r--tests/ui/traits/issue-106072.stderr13
-rw-r--r--tests/ui/traits/missing-for-type-in-impl.e2021.stderr24
-rw-r--r--tests/ui/traits/trait-upcasting/type-checking-test-3.stderr4
-rw-r--r--tests/ui/traits/trait-upcasting/type-checking-test-4.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr24
-rw-r--r--tests/ui/type/pattern_types/range_patterns.rs1
-rw-r--r--tests/ui/type/pattern_types/range_patterns.stderr19
-rw-r--r--tests/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr4
-rw-r--r--tests/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr3
-rw-r--r--tests/ui/unpretty/expanded-exhaustive.rs4
-rw-r--r--tests/ui/unpretty/expanded-exhaustive.stdout4
-rw-r--r--tests/ui/unpretty/unpretty-expr-fn-arg.stdout2
-rw-r--r--tests/ui/variance/variance-associated-types2.stderr4
-rw-r--r--tests/ui/variance/variance-uniquerc.rs27
-rw-r--r--tests/ui/variance/variance-uniquerc.stderr15
330 files changed, 6215 insertions, 1527 deletions
diff --git a/tests/assembly/targets/targets-pe.rs b/tests/assembly/targets/targets-pe.rs
index 6415aee6fae..ab74de5c8ec 100644
--- a/tests/assembly/targets/targets-pe.rs
+++ b/tests/assembly/targets/targets-pe.rs
@@ -39,6 +39,9 @@
 //@ revisions: i686_uwp_windows_gnu
 //@ [i686_uwp_windows_gnu] compile-flags: --target i686-uwp-windows-gnu
 //@ [i686_uwp_windows_gnu] needs-llvm-components: x86
+//@ revisions: i686_win7_windows_gnu
+//@ [i686_win7_windows_gnu] compile-flags: --target i686-win7-windows-gnu
+//@ [i686_win7_windows_gnu] needs-llvm-components: x86
 //@ revisions: i686_unknown_uefi
 //@ [i686_unknown_uefi] compile-flags: --target i686-unknown-uefi
 //@ [i686_unknown_uefi] needs-llvm-components: x86
@@ -72,6 +75,9 @@
 //@ revisions: x86_64_uwp_windows_gnu
 //@ [x86_64_uwp_windows_gnu] compile-flags: --target x86_64-uwp-windows-gnu
 //@ [x86_64_uwp_windows_gnu] needs-llvm-components: x86
+//@ revisions: x86_64_win7_windows_gnu
+//@ [x86_64_win7_windows_gnu] compile-flags: --target x86_64-win7-windows-gnu
+//@ [x86_64_win7_windows_gnu] needs-llvm-components: x86
 //@ revisions: x86_64_uwp_windows_msvc
 //@ [x86_64_uwp_windows_msvc] compile-flags: --target x86_64-uwp-windows-msvc
 //@ [x86_64_uwp_windows_msvc] needs-llvm-components: x86
diff --git a/tests/codegen-units/item-collection/closures.rs b/tests/codegen-units/item-collection/closures.rs
new file mode 100644
index 00000000000..5fc80230925
--- /dev/null
+++ b/tests/codegen-units/item-collection/closures.rs
@@ -0,0 +1,12 @@
+//@ edition: 2021
+//@ compile-flags: -Zprint-mono-items=eager --crate-type=lib
+
+//~ MONO_ITEM fn async_fn @@
+//~ MONO_ITEM fn async_fn::{closure#0} @@
+pub async fn async_fn() {}
+
+//~ MONO_ITEM fn closure @@
+//~ MONO_ITEM fn closure::{closure#0} @@
+pub fn closure() {
+    let _ = || {};
+}
diff --git a/tests/codegen-units/item-collection/non-generic-closures.rs b/tests/codegen-units/item-collection/non-generic-closures.rs
index dc0846f2cd3..8847a249b1e 100644
--- a/tests/codegen-units/item-collection/non-generic-closures.rs
+++ b/tests/codegen-units/item-collection/non-generic-closures.rs
@@ -13,6 +13,7 @@ fn temporary() {
 
 //~ MONO_ITEM fn assigned_to_variable_but_not_executed @@ non_generic_closures-cgu.0[Internal]
 fn assigned_to_variable_but_not_executed() {
+    //~ MONO_ITEM fn assigned_to_variable_but_not_executed::{closure#0}
     let _x = |a: i16| {
         let _ = a + 1;
     };
@@ -21,9 +22,9 @@ fn assigned_to_variable_but_not_executed() {
 //~ MONO_ITEM fn assigned_to_variable_executed_indirectly @@ non_generic_closures-cgu.0[Internal]
 fn assigned_to_variable_executed_indirectly() {
     //~ MONO_ITEM fn assigned_to_variable_executed_indirectly::{closure#0} @@ non_generic_closures-cgu.0[Internal]
-    //~ MONO_ITEM fn <{closure@TEST_PATH:27:13: 27:21} as std::ops::FnOnce<(i32,)>>::call_once - shim @@ non_generic_closures-cgu.0[Internal]
-    //~ MONO_ITEM fn <{closure@TEST_PATH:27:13: 27:21} as std::ops::FnOnce<(i32,)>>::call_once - shim(vtable) @@ non_generic_closures-cgu.0[Internal]
-    //~ MONO_ITEM fn std::ptr::drop_in_place::<{closure@TEST_PATH:27:13: 27:21}> - shim(None) @@ non_generic_closures-cgu.0[Internal]
+    //~ MONO_ITEM fn <{closure@TEST_PATH:28:13: 28:21} as std::ops::FnOnce<(i32,)>>::call_once - shim @@ non_generic_closures-cgu.0[Internal]
+    //~ MONO_ITEM fn <{closure@TEST_PATH:28:13: 28:21} as std::ops::FnOnce<(i32,)>>::call_once - shim(vtable) @@ non_generic_closures-cgu.0[Internal]
+    //~ MONO_ITEM fn std::ptr::drop_in_place::<{closure@TEST_PATH:28:13: 28:21}> - shim(None) @@ non_generic_closures-cgu.0[Internal]
     let f = |a: i32| {
         let _ = a + 2;
     };
diff --git a/tests/codegen/min-function-alignment.rs b/tests/codegen/min-function-alignment.rs
new file mode 100644
index 00000000000..7c0ad12402a
--- /dev/null
+++ b/tests/codegen/min-function-alignment.rs
@@ -0,0 +1,43 @@
+//@ revisions: align16 align1024
+//@ compile-flags: -C no-prepopulate-passes -Z mir-opt-level=0
+//@ [align16] compile-flags: -Zmin-function-alignment=16
+//@ [align1024] compile-flags: -Zmin-function-alignment=1024
+
+#![crate_type = "lib"]
+#![feature(fn_align)]
+
+// functions without explicit alignment use the global minimum
+//
+// CHECK-LABEL: @no_explicit_align
+// align16: align 16
+// align1024: align 1024
+#[no_mangle]
+pub fn no_explicit_align() {}
+
+// CHECK-LABEL: @lower_align
+// align16: align 16
+// align1024: align 1024
+#[no_mangle]
+#[repr(align(8))]
+pub fn lower_align() {}
+
+// the higher value of min-function-alignment and repr(align) wins out
+//
+// CHECK-LABEL: @higher_align
+// align16: align 32
+// align1024: align 1024
+#[no_mangle]
+#[repr(align(32))]
+pub fn higher_align() {}
+
+// cold functions follow the same rules as other functions
+//
+// in GCC, the `-falign-functions` does not apply to cold functions, but
+// `-Zmin-function-alignment` applies to all functions.
+//
+// CHECK-LABEL: @no_explicit_align_cold
+// align16: align 16
+// align1024: align 1024
+#[no_mangle]
+#[cold]
+pub fn no_explicit_align_cold() {}
diff --git a/tests/codegen/naked-fn/min-function-alignment.rs b/tests/codegen/naked-fn/min-function-alignment.rs
new file mode 100644
index 00000000000..1330d796d39
--- /dev/null
+++ b/tests/codegen/naked-fn/min-function-alignment.rs
@@ -0,0 +1,44 @@
+//@ compile-flags: -C no-prepopulate-passes -Copt-level=0 -Zmin-function-alignment=16
+//@ needs-asm-support
+//@ ignore-arm no "ret" mnemonic
+
+#![feature(naked_functions, fn_align)]
+#![crate_type = "lib"]
+
+// functions without explicit alignment use the global minimum
+//
+// CHECK: .balign 16
+#[no_mangle]
+#[naked]
+pub unsafe extern "C" fn naked_no_explicit_align() {
+    core::arch::naked_asm!("ret")
+}
+
+// CHECK: .balign 16
+#[no_mangle]
+#[repr(align(8))]
+#[naked]
+pub unsafe extern "C" fn naked_lower_align() {
+    core::arch::naked_asm!("ret")
+}
+
+// CHECK: .balign 32
+#[no_mangle]
+#[repr(align(32))]
+#[naked]
+pub unsafe extern "C" fn naked_higher_align() {
+    core::arch::naked_asm!("ret")
+}
+
+// cold functions follow the same rules as other functions
+//
+// in GCC, the `-falign-functions` does not apply to cold functions, but
+// `-Zmin-function-alignment` applies to all functions.
+//
+// CHECK: .balign 16
+#[no_mangle]
+#[cold]
+#[naked]
+pub unsafe extern "C" fn no_explicit_align_cold() {
+    core::arch::naked_asm!("ret")
+}
diff --git a/tests/codegen/slice-init.rs b/tests/codegen/slice-init.rs
index 8126bf84618..1c2dd3e8875 100644
--- a/tests/codegen/slice-init.rs
+++ b/tests/codegen/slice-init.rs
@@ -63,6 +63,32 @@ pub fn nonzero_integer_array() {
     opaque(&x);
 }
 
+const N: usize = 100;
+
+// CHECK-LABEL: @u16_init_one_bytes
+#[no_mangle]
+pub fn u16_init_one_bytes() -> [u16; N] {
+    // CHECK-NOT: select
+    // CHECK-NOT: br
+    // CHECK-NOT: switch
+    // CHECK-NOT: icmp
+    // CHECK: call void @llvm.memset.p0
+    [const { u16::from_be_bytes([1, 1]) }; N]
+}
+
+// FIXME: undef bytes can just be initialized with the same value as the
+// defined bytes, if the defines bytes are all the same.
+// CHECK-LABEL: @option_none_init
+#[no_mangle]
+pub fn option_none_init() -> [Option<u8>; N] {
+    // CHECK-NOT: select
+    // CHECK: br label %repeat_loop_header{{.*}}
+    // CHECK-NOT: switch
+    // CHECK: icmp
+    // CHECK-NOT: call void @llvm.memset.p0
+    [None; N]
+}
+
 // Use an opaque function to prevent rustc from removing useless drops.
 #[inline(never)]
 pub fn opaque(_: impl Sized) {}
diff --git a/tests/codegen/vec-in-place.rs b/tests/codegen/vec-in-place.rs
index 33de0913f77..e835a7ef69b 100644
--- a/tests/codegen/vec-in-place.rs
+++ b/tests/codegen/vec-in-place.rs
@@ -37,8 +37,11 @@ pub struct Baz {
 #[no_mangle]
 pub fn vec_iterator_cast_primitive(vec: Vec<i8>) -> Vec<u8> {
     // CHECK-NOT: loop
-    // CHECK: call
-    // CHECK-SAME: void @llvm.assume(i1 %{{.+}})
+    // CHECK-NOT: call
+    // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
+    // CHECK-NOT: loop
+    // CHECK-NOT: call
+    // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
     // CHECK-NOT: loop
     // CHECK-NOT: call
     vec.into_iter().map(|e| e as u8).collect()
@@ -48,8 +51,11 @@ pub fn vec_iterator_cast_primitive(vec: Vec<i8>) -> Vec<u8> {
 #[no_mangle]
 pub fn vec_iterator_cast_wrapper(vec: Vec<u8>) -> Vec<Wrapper<u8>> {
     // CHECK-NOT: loop
-    // CHECK: call
-    // CHECK-SAME: void @llvm.assume(i1 %{{.+}})
+    // CHECK-NOT: call
+    // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
+    // CHECK-NOT: loop
+    // CHECK-NOT: call
+    // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
     // CHECK-NOT: loop
     // CHECK-NOT: call
     vec.into_iter().map(|e| Wrapper(e)).collect()
@@ -76,8 +82,11 @@ pub fn vec_iterator_cast_signed_nested(vec: Vec<Vec<i32>>) -> Vec<Vec<u32>> {
 #[no_mangle]
 pub fn vec_iterator_cast_unwrap(vec: Vec<Wrapper<u8>>) -> Vec<u8> {
     // CHECK-NOT: loop
-    // CHECK: call
-    // CHECK-SAME: void @llvm.assume(i1 %{{.+}})
+    // CHECK-NOT: call
+    // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
+    // CHECK-NOT: loop
+    // CHECK-NOT: call
+    // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
     // CHECK-NOT: loop
     // CHECK-NOT: call
     vec.into_iter().map(|e| e.0).collect()
@@ -87,8 +96,11 @@ pub fn vec_iterator_cast_unwrap(vec: Vec<Wrapper<u8>>) -> Vec<u8> {
 #[no_mangle]
 pub fn vec_iterator_cast_aggregate(vec: Vec<[u64; 4]>) -> Vec<Foo> {
     // CHECK-NOT: loop
-    // CHECK: call
-    // CHECK-SAME: void @llvm.assume(i1 %{{.+}})
+    // CHECK-NOT: call
+    // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
+    // CHECK-NOT: loop
+    // CHECK-NOT: call
+    // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
     // CHECK-NOT: loop
     // CHECK-NOT: call
     vec.into_iter().map(|e| unsafe { std::mem::transmute(e) }).collect()
@@ -98,8 +110,11 @@ pub fn vec_iterator_cast_aggregate(vec: Vec<[u64; 4]>) -> Vec<Foo> {
 #[no_mangle]
 pub fn vec_iterator_cast_deaggregate_tra(vec: Vec<Bar>) -> Vec<[u64; 4]> {
     // CHECK-NOT: loop
-    // CHECK: call
-    // CHECK-SAME: void @llvm.assume(i1 %{{.+}})
+    // CHECK-NOT: call
+    // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
+    // CHECK-NOT: loop
+    // CHECK-NOT: call
+    // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
     // CHECK-NOT: loop
     // CHECK-NOT: call
 
@@ -114,8 +129,11 @@ pub fn vec_iterator_cast_deaggregate_tra(vec: Vec<Bar>) -> Vec<[u64; 4]> {
 #[no_mangle]
 pub fn vec_iterator_cast_deaggregate_fold(vec: Vec<Baz>) -> Vec<[u64; 4]> {
     // CHECK-NOT: loop
-    // CHECK: call
-    // CHECK-SAME: void @llvm.assume(i1 %{{.+}})
+    // CHECK-NOT: call
+    // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
+    // CHECK-NOT: loop
+    // CHECK-NOT: call
+    // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
     // CHECK-NOT: loop
     // CHECK-NOT: call
 
@@ -138,6 +156,12 @@ pub fn vec_iterator_cast_unwrap_drop(vec: Vec<Wrapper<String>>) -> Vec<String> {
     // CHECK-NOT: call
     // CHECK-NOT: %{{.*}} = mul
     // CHECK-NOT: %{{.*}} = udiv
+    // CHECK: call
+    // CHECK-SAME: void @llvm.assume(i1 %{{.+}})
+    // CHECK-NOT: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}
+    // CHECK-NOT: call
+    // CHECK-NOT: %{{.*}} = mul
+    // CHECK-NOT: %{{.*}} = udiv
 
     vec.into_iter().map(|Wrapper(e)| e).collect()
 }
@@ -154,6 +178,12 @@ pub fn vec_iterator_cast_wrap_drop(vec: Vec<String>) -> Vec<Wrapper<String>> {
     // CHECK-NOT: call
     // CHECK-NOT: %{{.*}} = mul
     // CHECK-NOT: %{{.*}} = udiv
+    // CHECK: call
+    // CHECK-SAME: void @llvm.assume(i1 %{{.+}})
+    // CHECK-NOT: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}
+    // CHECK-NOT: call
+    // CHECK-NOT: %{{.*}} = mul
+    // CHECK-NOT: %{{.*}} = udiv
     // CHECK: ret void
 
     vec.into_iter().map(Wrapper).collect()
diff --git a/tests/codegen/vec_pop_push_noop.rs b/tests/codegen/vec_pop_push_noop.rs
index a8ad5b6f1a3..4821e840884 100644
--- a/tests/codegen/vec_pop_push_noop.rs
+++ b/tests/codegen/vec_pop_push_noop.rs
@@ -12,9 +12,6 @@ pub fn noop(v: &mut Vec<u8>) {
     // CHECK-NOT: call
     // CHECK: tail call void @llvm.assume
     // CHECK-NOT: grow_one
-    // llvm-pre-19: call
-    // llvm-pre-19-same: void @llvm.assume
-    // llvm-pre-19-NOT: grow_one
     // CHECK-NOT: call
     // CHECK: {{ret|[}]}}
     if let Some(x) = v.pop() {
diff --git a/tests/coverage/generic-unused-impl.cov-map b/tests/coverage/generic-unused-impl.cov-map
new file mode 100644
index 00000000000..5878de231ba
--- /dev/null
+++ b/tests/coverage/generic-unused-impl.cov-map
@@ -0,0 +1,18 @@
+Function name: <generic_unused_impl::W<_> as core::convert::From<[<_ as generic_unused_impl::Foo>::Assoc; 1]>>::from (unused)
+Raw bytes (9): 0x[01, 01, 00, 01, 00, 0b, 05, 03, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Zero) at (prev + 11, 5) to (start + 3, 6)
+Highest counter ID seen: (none)
+
+Function name: generic_unused_impl::main
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 11, 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 + 17, 1) to (start + 0, 13)
+Highest counter ID seen: c0
+
diff --git a/tests/coverage/generic-unused-impl.coverage b/tests/coverage/generic-unused-impl.coverage
new file mode 100644
index 00000000000..c3a3c724290
--- /dev/null
+++ b/tests/coverage/generic-unused-impl.coverage
@@ -0,0 +1,18 @@
+   LL|       |// Regression test for #135235.
+   LL|       |trait Foo {
+   LL|       |    type Assoc;
+   LL|       |
+   LL|       |    fn from(s: Self::Assoc) -> Self;
+   LL|       |}
+   LL|       |
+   LL|       |struct W<T>(T);
+   LL|       |
+   LL|       |impl<T: Foo> From<[T::Assoc; 1]> for W<T> {
+   LL|      0|    fn from(from: [T::Assoc; 1]) -> Self {
+   LL|      0|        let [item] = from;
+   LL|      0|        W(Foo::from(item))
+   LL|      0|    }
+   LL|       |}
+   LL|       |
+   LL|      1|fn main() {}
+
diff --git a/tests/coverage/generic-unused-impl.rs b/tests/coverage/generic-unused-impl.rs
new file mode 100644
index 00000000000..86231389450
--- /dev/null
+++ b/tests/coverage/generic-unused-impl.rs
@@ -0,0 +1,17 @@
+// Regression test for #135235.
+trait Foo {
+    type Assoc;
+
+    fn from(s: Self::Assoc) -> Self;
+}
+
+struct W<T>(T);
+
+impl<T: Foo> From<[T::Assoc; 1]> for W<T> {
+    fn from(from: [T::Assoc; 1]) -> Self {
+        let [item] = from;
+        W(Foo::from(item))
+    }
+}
+
+fn main() {}
diff --git a/tests/crashes/114317.rs b/tests/crashes/114317.rs
deleted file mode 100644
index 09fd2beeba8..00000000000
--- a/tests/crashes/114317.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-//@ known-bug: #114317
-#![feature(generic_const_exprs)]
-
-struct A<const B: str = 1, C>;
-
-fn main() {}
diff --git a/tests/crashes/126182.rs b/tests/crashes/126182.rs
deleted file mode 100644
index 2219a6cb5fa..00000000000
--- a/tests/crashes/126182.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-//@ known-bug: rust-lang/rust#126182
-
-#![feature(generic_const_exprs)]
-#![allow(incomplete_features)]
-
-struct Cond<const B: bool>;
-
-struct Thing<T = Cond<0>>(T);
-
-impl Thing {}
diff --git a/tests/crashes/135122.rs b/tests/crashes/135122.rs
new file mode 100644
index 00000000000..77d943f23b4
--- /dev/null
+++ b/tests/crashes/135122.rs
@@ -0,0 +1,24 @@
+//@ known-bug: #135122
+trait Add {
+    type Output;
+    fn add(_: (), _: Self::Output) {}
+}
+
+trait IsSame<Lhs> {
+    type Assoc;
+}
+
+trait Data {
+    type Elem;
+}
+
+impl<B> IsSame<i16> for f32 where f32: IsSame<B, Assoc = B> {}
+
+impl<A> Add for i64
+where
+    f32: IsSame<A>,
+    i8: Data<Elem = A>,
+{
+    type Output = <f32 as IsSame<A>>::Assoc;
+    fn add(_: Data, _: Self::Output) {}
+}
diff --git a/tests/crashes/135124.rs b/tests/crashes/135124.rs
new file mode 100644
index 00000000000..d6655cb46fa
--- /dev/null
+++ b/tests/crashes/135124.rs
@@ -0,0 +1,9 @@
+//@ known-bug: #135124
+trait A  {
+    fn y(&self)
+    {
+        fn call() -> impl Sized {}
+        self.fold(call());
+    }
+    fn fold(&self, &self._) {}
+}
diff --git a/tests/crashes/135128.rs b/tests/crashes/135128.rs
new file mode 100644
index 00000000000..2ce17df824a
--- /dev/null
+++ b/tests/crashes/135128.rs
@@ -0,0 +1,10 @@
+//@ known-bug: #135128
+//@ compile-flags: -Copt-level=1 --edition=2021
+
+async fn return_str() -> str
+where
+    str: Sized,
+{
+    *"Sized".to_string().into_boxed_str()
+}
+fn main() {}
diff --git a/tests/crashes/135210.rs b/tests/crashes/135210.rs
new file mode 100644
index 00000000000..acb61e21090
--- /dev/null
+++ b/tests/crashes/135210.rs
@@ -0,0 +1,8 @@
+//@ known-bug: #135210
+
+#![feature(const_trait_impl)]
+const _: fn(&String) = |s| {
+    &*s as &str;
+};
+
+fn main() {}
diff --git a/tests/crashes/135341.rs b/tests/crashes/135341.rs
new file mode 100644
index 00000000000..0e33242a5f5
--- /dev/null
+++ b/tests/crashes/135341.rs
@@ -0,0 +1,5 @@
+//@ known-bug: #135341
+type A<T> = B;
+type B = _;
+
+pub fn main() {}
diff --git a/tests/debuginfo/strings-and-strs.rs b/tests/debuginfo/strings-and-strs.rs
index 3d6589db34b..543e74e1744 100644
--- a/tests/debuginfo/strings-and-strs.rs
+++ b/tests/debuginfo/strings-and-strs.rs
@@ -7,7 +7,7 @@
 // gdb-command:run
 
 // gdb-command:print plain_string
-// gdb-check:$1 = alloc::string::String {vec: alloc::vec::Vec<u8, alloc::alloc::Global> {buf: alloc::raw_vec::RawVec<u8, alloc::alloc::Global> {inner: alloc::raw_vec::RawVecInner<alloc::alloc::Global> {ptr: core::ptr::unique::Unique<u8> {pointer: core::ptr::non_null::NonNull<u8> {pointer: 0x[...]}, _marker: core::marker::PhantomData<u8>}, cap: alloc::raw_vec::Cap (5), alloc: alloc::alloc::Global}, _marker: core::marker::PhantomData<u8>}, len: 5}}
+// gdb-check:$1 = alloc::string::String {vec: alloc::vec::Vec<u8, alloc::alloc::Global> {buf: alloc::raw_vec::RawVec<u8, alloc::alloc::Global> {inner: alloc::raw_vec::RawVecInner<alloc::alloc::Global> {ptr: core::ptr::unique::Unique<u8> {pointer: core::ptr::non_null::NonNull<u8> {pointer: 0x[...]}, _marker: core::marker::PhantomData<u8>}, cap: core::num::niche_types::UsizeNoHighBit (5), alloc: alloc::alloc::Global}, _marker: core::marker::PhantomData<u8>}, len: 5}}
 
 // gdb-command:print plain_str
 // gdb-check:$2 = "Hello"
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
index 4097e060f4d..5ea9902b262 100644
--- 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
@@ -51,7 +51,6 @@
           StorageLive(_7);
           _7 = const 1_usize;
           _6 = const {0x1 as *mut [bool; 0]};
-          StorageDead(_7);
           StorageLive(_11);
           StorageLive(_8);
           _8 = UbChecks();
@@ -79,6 +78,7 @@
           _11 = const {0x1 as *const [bool; 0]};
           _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
           StorageDead(_11);
+          StorageDead(_7);
           StorageDead(_6);
           _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
           StorageDead(_5);
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
index ff44d0df5e3..cc5a41a7f63 100644
--- 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
@@ -51,7 +51,6 @@
           StorageLive(_7);
           _7 = const 1_usize;
           _6 = const {0x1 as *mut [bool; 0]};
-          StorageDead(_7);
           StorageLive(_11);
           StorageLive(_8);
           _8 = UbChecks();
@@ -83,6 +82,7 @@
           _11 = const {0x1 as *const [bool; 0]};
           _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
           StorageDead(_11);
+          StorageDead(_7);
           StorageDead(_6);
           _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
           StorageDead(_5);
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
index 3662c3b59d2..3d398fbea79 100644
--- 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
@@ -51,7 +51,6 @@
           StorageLive(_7);
           _7 = const 1_usize;
           _6 = const {0x1 as *mut [bool; 0]};
-          StorageDead(_7);
           StorageLive(_11);
           StorageLive(_8);
           _8 = UbChecks();
@@ -79,6 +78,7 @@
           _11 = const {0x1 as *const [bool; 0]};
           _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
           StorageDead(_11);
+          StorageDead(_7);
           StorageDead(_6);
           _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
           StorageDead(_5);
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
index 68dee57dee9..dc99c3f7a8c 100644
--- 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
@@ -51,7 +51,6 @@
           StorageLive(_7);
           _7 = const 1_usize;
           _6 = const {0x1 as *mut [bool; 0]};
-          StorageDead(_7);
           StorageLive(_11);
           StorageLive(_8);
           _8 = UbChecks();
@@ -83,6 +82,7 @@
           _11 = const {0x1 as *const [bool; 0]};
           _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
           StorageDead(_11);
+          StorageDead(_7);
           StorageDead(_6);
           _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
           StorageDead(_5);
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff
index e62fcb66e3a..6a3ec543069 100644
--- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff
@@ -53,7 +53,6 @@
 -         _6 = copy _7 as *mut [bool; 0] (Transmute);
 +         _7 = const 1_usize;
 +         _6 = const {0x1 as *mut [bool; 0]};
-          StorageDead(_7);
           StorageLive(_11);
           StorageLive(_8);
           _8 = UbChecks();
@@ -67,7 +66,7 @@
   
       bb2: {
           StorageLive(_10);
--         _10 = copy _6 as *mut () (PtrToPtr);
+-         _10 = copy _7 as *mut () (Transmute);
 -         _9 = NonNull::<T>::new_unchecked::precondition_check(move _10) -> [return: bb3, unwind unreachable];
 +         _10 = const {0x1 as *mut ()};
 +         _9 = NonNull::<T>::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [return: bb3, unwind unreachable];
@@ -80,11 +79,12 @@
   
       bb4: {
           StorageDead(_8);
--         _11 = copy _6 as *const [bool; 0] (PtrToPtr);
+-         _11 = copy _7 as *const [bool; 0] (Transmute);
 -         _5 = NonNull::<[bool; 0]> { pointer: copy _11 };
 +         _11 = const {0x1 as *const [bool; 0]};
 +         _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
           StorageDead(_11);
+          StorageDead(_7);
           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]> }};
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff
index 8183abd315a..9471ad47cd9 100644
--- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff
@@ -53,7 +53,6 @@
 -         _6 = copy _7 as *mut [bool; 0] (Transmute);
 +         _7 = const 1_usize;
 +         _6 = const {0x1 as *mut [bool; 0]};
-          StorageDead(_7);
           StorageLive(_11);
           StorageLive(_8);
           _8 = UbChecks();
@@ -71,7 +70,7 @@
   
       bb3: {
           StorageLive(_10);
--         _10 = copy _6 as *mut () (PtrToPtr);
+-         _10 = copy _7 as *mut () (Transmute);
 -         _9 = NonNull::<T>::new_unchecked::precondition_check(move _10) -> [return: bb4, unwind unreachable];
 +         _10 = const {0x1 as *mut ()};
 +         _9 = NonNull::<T>::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [return: bb4, unwind unreachable];
@@ -84,11 +83,12 @@
   
       bb5: {
           StorageDead(_8);
--         _11 = copy _6 as *const [bool; 0] (PtrToPtr);
+-         _11 = copy _7 as *const [bool; 0] (Transmute);
 -         _5 = NonNull::<[bool; 0]> { pointer: copy _11 };
 +         _11 = const {0x1 as *const [bool; 0]};
 +         _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
           StorageDead(_11);
+          StorageDead(_7);
           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]> }};
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff
index 4fa6ef29e06..187927b8eca 100644
--- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff
@@ -53,7 +53,6 @@
 -         _6 = copy _7 as *mut [bool; 0] (Transmute);
 +         _7 = const 1_usize;
 +         _6 = const {0x1 as *mut [bool; 0]};
-          StorageDead(_7);
           StorageLive(_11);
           StorageLive(_8);
           _8 = UbChecks();
@@ -67,7 +66,7 @@
   
       bb2: {
           StorageLive(_10);
--         _10 = copy _6 as *mut () (PtrToPtr);
+-         _10 = copy _7 as *mut () (Transmute);
 -         _9 = NonNull::<T>::new_unchecked::precondition_check(move _10) -> [return: bb3, unwind unreachable];
 +         _10 = const {0x1 as *mut ()};
 +         _9 = NonNull::<T>::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [return: bb3, unwind unreachable];
@@ -80,11 +79,12 @@
   
       bb4: {
           StorageDead(_8);
--         _11 = copy _6 as *const [bool; 0] (PtrToPtr);
+-         _11 = copy _7 as *const [bool; 0] (Transmute);
 -         _5 = NonNull::<[bool; 0]> { pointer: copy _11 };
 +         _11 = const {0x1 as *const [bool; 0]};
 +         _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
           StorageDead(_11);
+          StorageDead(_7);
           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]> }};
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff
index 75329204563..031c021ba5a 100644
--- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff
@@ -53,7 +53,6 @@
 -         _6 = copy _7 as *mut [bool; 0] (Transmute);
 +         _7 = const 1_usize;
 +         _6 = const {0x1 as *mut [bool; 0]};
-          StorageDead(_7);
           StorageLive(_11);
           StorageLive(_8);
           _8 = UbChecks();
@@ -71,7 +70,7 @@
   
       bb3: {
           StorageLive(_10);
--         _10 = copy _6 as *mut () (PtrToPtr);
+-         _10 = copy _7 as *mut () (Transmute);
 -         _9 = NonNull::<T>::new_unchecked::precondition_check(move _10) -> [return: bb4, unwind unreachable];
 +         _10 = const {0x1 as *mut ()};
 +         _9 = NonNull::<T>::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [return: bb4, unwind unreachable];
@@ -84,11 +83,12 @@
   
       bb5: {
           StorageDead(_8);
--         _11 = copy _6 as *const [bool; 0] (PtrToPtr);
+-         _11 = copy _7 as *const [bool; 0] (Transmute);
 -         _5 = NonNull::<[bool; 0]> { pointer: copy _11 };
 +         _11 = const {0x1 as *const [bool; 0]};
 +         _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
           StorageDead(_11);
+          StorageDead(_7);
           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]> }};
diff --git a/tests/mir-opt/gvn.aggregate_struct_then_transmute.GVN.panic-abort.diff b/tests/mir-opt/gvn.aggregate_struct_then_transmute.GVN.panic-abort.diff
new file mode 100644
index 00000000000..5ae575f300a
--- /dev/null
+++ b/tests/mir-opt/gvn.aggregate_struct_then_transmute.GVN.panic-abort.diff
@@ -0,0 +1,340 @@
+- // MIR for `aggregate_struct_then_transmute` before GVN
++ // MIR for `aggregate_struct_then_transmute` after GVN
+  
+  fn aggregate_struct_then_transmute(_1: u16, _2: *const u8) -> () {
+      debug id => _1;
+      debug thin => _2;
+      let mut _0: ();
+      let _3: MyId;
+      let mut _4: u16;
+      let _5: ();
+      let mut _6: u16;
+      let mut _7: MyId;
+      let mut _9: u16;
+      let mut _10: std::marker::PhantomData<std::string::String>;
+      let _11: ();
+      let mut _12: u16;
+      let mut _13: TypedId<std::string::String>;
+      let mut _15: u16;
+      let _16: ();
+      let mut _17: u16;
+      let mut _18: std::result::Result<Never, u16>;
+      let mut _20: u16;
+      let _21: ();
+      let mut _22: u32;
+      let mut _23: std::option::Option<u16>;
+      let mut _25: u16;
+      let _26: ();
+      let mut _27: i16;
+      let mut _28: MyId;
+      let mut _30: u16;
+      let mut _31: u16;
+      let _32: ();
+      let mut _33: u32;
+      let mut _34: aggregate_struct_then_transmute::Pair;
+      let mut _36: u16;
+      let mut _37: u16;
+      let _38: ();
+      let mut _39: u16;
+      let mut _40: aggregate_struct_then_transmute::Pair;
+      let mut _42: u16;
+      let _43: ();
+      let mut _44: u16;
+      let mut _45: (u16,);
+      let mut _47: u16;
+      let _48: ();
+      let mut _49: u16;
+      let mut _50: [u16; 1];
+      let mut _52: *const u8;
+      let mut _53: ();
+      let _54: ();
+      let mut _55: *const u8;
+      let mut _56: *const i32;
+      scope 1 {
+          debug a => _3;
+          let _8: TypedId<std::string::String>;
+          scope 2 {
+              debug b => _8;
+              let _14: std::result::Result<Never, u16>;
+              scope 3 {
+                  debug c => _14;
+                  let _19: std::option::Option<u16>;
+                  scope 4 {
+                      debug d => _19;
+                      let _24: MyId;
+                      scope 5 {
+                          debug e => _24;
+                          let _29: aggregate_struct_then_transmute::Pair;
+                          scope 6 {
+                              debug f => _29;
+                              let _35: aggregate_struct_then_transmute::Pair;
+                              scope 7 {
+                                  debug g => _35;
+                                  let _41: (u16,);
+                                  scope 8 {
+                                      debug h => _41;
+                                      let _46: [u16; 1];
+                                      scope 9 {
+                                          debug i => _46;
+                                          let _51: *const i32;
+                                          scope 10 {
+                                              debug j => _51;
+                                          }
+                                      }
+                                  }
+                              }
+                          }
+                      }
+                  }
+              }
+          }
+      }
+  
+      bb0: {
+-         StorageLive(_3);
++         nop;
+          StorageLive(_4);
+          _4 = copy _1;
+-         _3 = MyId(move _4);
++         _3 = MyId(copy _1);
+          StorageDead(_4);
+          StorageLive(_5);
+          StorageLive(_6);
+          StorageLive(_7);
+-         _7 = move _3;
+-         _6 = move _7 as u16 (Transmute);
++         _7 = copy _3;
++         _6 = copy _1;
+          StorageDead(_7);
+-         _5 = opaque::<u16>(move _6) -> [return: bb1, unwind unreachable];
++         _5 = opaque::<u16>(copy _1) -> [return: bb1, unwind unreachable];
+      }
+  
+      bb1: {
+          StorageDead(_6);
+          StorageDead(_5);
+-         StorageLive(_8);
++         nop;
+          StorageLive(_9);
+          _9 = copy _1;
+          StorageLive(_10);
+-         _10 = PhantomData::<String>;
+-         _8 = TypedId::<String>(move _9, move _10);
++         _10 = const PhantomData::<String>;
++         _8 = TypedId::<String>(copy _1, const PhantomData::<String>);
+          StorageDead(_10);
+          StorageDead(_9);
+          StorageLive(_11);
+          StorageLive(_12);
+          StorageLive(_13);
+-         _13 = move _8;
+-         _12 = move _13 as u16 (Transmute);
++         _13 = copy _8;
++         _12 = copy _1;
+          StorageDead(_13);
+-         _11 = opaque::<u16>(move _12) -> [return: bb2, unwind unreachable];
++         _11 = opaque::<u16>(copy _1) -> [return: bb2, unwind unreachable];
+      }
+  
+      bb2: {
+          StorageDead(_12);
+          StorageDead(_11);
+-         StorageLive(_14);
++         nop;
+          StorageLive(_15);
+          _15 = copy _1;
+-         _14 = Result::<Never, u16>::Err(move _15);
++         _14 = Result::<Never, u16>::Err(copy _1);
+          StorageDead(_15);
+          StorageLive(_16);
+          StorageLive(_17);
+          StorageLive(_18);
+-         _18 = move _14;
+-         _17 = move _18 as u16 (Transmute);
++         _18 = copy _14;
++         _17 = copy _1;
+          StorageDead(_18);
+-         _16 = opaque::<u16>(move _17) -> [return: bb3, unwind unreachable];
++         _16 = opaque::<u16>(copy _1) -> [return: bb3, unwind unreachable];
+      }
+  
+      bb3: {
+          StorageDead(_17);
+          StorageDead(_16);
+-         StorageLive(_19);
++         nop;
+          StorageLive(_20);
+          _20 = copy _1;
+-         _19 = Option::<u16>::Some(move _20);
++         _19 = Option::<u16>::Some(copy _1);
+          StorageDead(_20);
+          StorageLive(_21);
+          StorageLive(_22);
+          StorageLive(_23);
+          _23 = copy _19;
+-         _22 = move _23 as u32 (Transmute);
++         _22 = copy _19 as u32 (Transmute);
+          StorageDead(_23);
+          _21 = opaque::<u32>(move _22) -> [return: bb4, unwind unreachable];
+      }
+  
+      bb4: {
+          StorageDead(_22);
+          StorageDead(_21);
+          StorageLive(_24);
+          StorageLive(_25);
+          _25 = copy _1;
+-         _24 = MyId(move _25);
++         _24 = copy _3;
+          StorageDead(_25);
+          StorageLive(_26);
+          StorageLive(_27);
+          StorageLive(_28);
+-         _28 = move _24;
+-         _27 = move _28 as i16 (Transmute);
++         _28 = copy _3;
++         _27 = copy _1 as i16 (Transmute);
+          StorageDead(_28);
+          _26 = opaque::<i16>(move _27) -> [return: bb5, unwind unreachable];
+      }
+  
+      bb5: {
+          StorageDead(_27);
+          StorageDead(_26);
+-         StorageLive(_29);
++         nop;
+          StorageLive(_30);
+          _30 = copy _1;
+          StorageLive(_31);
+          _31 = copy _1;
+-         _29 = Pair(move _30, move _31);
++         _29 = Pair(copy _1, copy _1);
+          StorageDead(_31);
+          StorageDead(_30);
+          StorageLive(_32);
+          StorageLive(_33);
+          StorageLive(_34);
+-         _34 = move _29;
+-         _33 = move _34 as u32 (Transmute);
++         _34 = copy _29;
++         _33 = copy _29 as u32 (Transmute);
+          StorageDead(_34);
+          _32 = opaque::<u32>(move _33) -> [return: bb6, unwind unreachable];
+      }
+  
+      bb6: {
+          StorageDead(_33);
+          StorageDead(_32);
+          StorageLive(_35);
+          StorageLive(_36);
+          _36 = copy _1;
+          StorageLive(_37);
+          _37 = copy _1;
+-         _35 = Pair(move _36, move _37);
++         _35 = copy _29;
+          StorageDead(_37);
+          StorageDead(_36);
+          StorageLive(_38);
+          StorageLive(_39);
+          StorageLive(_40);
+-         _40 = move _35;
+-         _39 = move _40 as u16 (Transmute);
++         _40 = copy _29;
++         _39 = copy _29 as u16 (Transmute);
+          StorageDead(_40);
+          _38 = opaque::<u16>(move _39) -> [return: bb7, unwind unreachable];
+      }
+  
+      bb7: {
+          StorageDead(_39);
+          StorageDead(_38);
+-         StorageLive(_41);
++         nop;
+          StorageLive(_42);
+          _42 = copy _1;
+-         _41 = (move _42,);
++         _41 = (copy _1,);
+          StorageDead(_42);
+          StorageLive(_43);
+          StorageLive(_44);
+          StorageLive(_45);
+          _45 = copy _41;
+-         _44 = move _45 as u16 (Transmute);
++         _44 = copy _1;
+          StorageDead(_45);
+-         _43 = opaque::<u16>(move _44) -> [return: bb8, unwind unreachable];
++         _43 = opaque::<u16>(copy _1) -> [return: bb8, unwind unreachable];
+      }
+  
+      bb8: {
+          StorageDead(_44);
+          StorageDead(_43);
+-         StorageLive(_46);
++         nop;
+          StorageLive(_47);
+          _47 = copy _1;
+-         _46 = [move _47];
++         _46 = [copy _1];
+          StorageDead(_47);
+          StorageLive(_48);
+          StorageLive(_49);
+          StorageLive(_50);
+          _50 = copy _46;
+-         _49 = move _50 as u16 (Transmute);
++         _49 = copy _1;
+          StorageDead(_50);
+-         _48 = opaque::<u16>(move _49) -> [return: bb9, unwind unreachable];
++         _48 = opaque::<u16>(copy _1) -> [return: bb9, unwind unreachable];
+      }
+  
+      bb9: {
+          StorageDead(_49);
+          StorageDead(_48);
+-         StorageLive(_51);
++         nop;
+          StorageLive(_52);
+          _52 = copy _2;
+          StorageLive(_53);
+-         _53 = ();
+-         _51 = *const i32 from (move _52, move _53);
++         _53 = const ();
++         _51 = *const i32 from (copy _2, const ());
+          StorageDead(_53);
+          StorageDead(_52);
+          StorageLive(_54);
+          StorageLive(_55);
+          StorageLive(_56);
+          _56 = copy _51;
+-         _55 = move _56 as *const u8 (Transmute);
++         _55 = copy _2;
+          StorageDead(_56);
+-         _54 = opaque::<*const u8>(move _55) -> [return: bb10, unwind unreachable];
++         _54 = opaque::<*const u8>(copy _2) -> [return: bb10, unwind unreachable];
+      }
+  
+      bb10: {
+          StorageDead(_55);
+          StorageDead(_54);
+          _0 = const ();
+-         StorageDead(_51);
+-         StorageDead(_46);
+-         StorageDead(_41);
++         nop;
++         nop;
++         nop;
+          StorageDead(_35);
+-         StorageDead(_29);
++         nop;
+          StorageDead(_24);
+-         StorageDead(_19);
+-         StorageDead(_14);
+-         StorageDead(_8);
+-         StorageDead(_3);
++         nop;
++         nop;
++         nop;
++         nop;
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/gvn.aggregate_struct_then_transmute.GVN.panic-unwind.diff b/tests/mir-opt/gvn.aggregate_struct_then_transmute.GVN.panic-unwind.diff
new file mode 100644
index 00000000000..3119a93fb89
--- /dev/null
+++ b/tests/mir-opt/gvn.aggregate_struct_then_transmute.GVN.panic-unwind.diff
@@ -0,0 +1,340 @@
+- // MIR for `aggregate_struct_then_transmute` before GVN
++ // MIR for `aggregate_struct_then_transmute` after GVN
+  
+  fn aggregate_struct_then_transmute(_1: u16, _2: *const u8) -> () {
+      debug id => _1;
+      debug thin => _2;
+      let mut _0: ();
+      let _3: MyId;
+      let mut _4: u16;
+      let _5: ();
+      let mut _6: u16;
+      let mut _7: MyId;
+      let mut _9: u16;
+      let mut _10: std::marker::PhantomData<std::string::String>;
+      let _11: ();
+      let mut _12: u16;
+      let mut _13: TypedId<std::string::String>;
+      let mut _15: u16;
+      let _16: ();
+      let mut _17: u16;
+      let mut _18: std::result::Result<Never, u16>;
+      let mut _20: u16;
+      let _21: ();
+      let mut _22: u32;
+      let mut _23: std::option::Option<u16>;
+      let mut _25: u16;
+      let _26: ();
+      let mut _27: i16;
+      let mut _28: MyId;
+      let mut _30: u16;
+      let mut _31: u16;
+      let _32: ();
+      let mut _33: u32;
+      let mut _34: aggregate_struct_then_transmute::Pair;
+      let mut _36: u16;
+      let mut _37: u16;
+      let _38: ();
+      let mut _39: u16;
+      let mut _40: aggregate_struct_then_transmute::Pair;
+      let mut _42: u16;
+      let _43: ();
+      let mut _44: u16;
+      let mut _45: (u16,);
+      let mut _47: u16;
+      let _48: ();
+      let mut _49: u16;
+      let mut _50: [u16; 1];
+      let mut _52: *const u8;
+      let mut _53: ();
+      let _54: ();
+      let mut _55: *const u8;
+      let mut _56: *const i32;
+      scope 1 {
+          debug a => _3;
+          let _8: TypedId<std::string::String>;
+          scope 2 {
+              debug b => _8;
+              let _14: std::result::Result<Never, u16>;
+              scope 3 {
+                  debug c => _14;
+                  let _19: std::option::Option<u16>;
+                  scope 4 {
+                      debug d => _19;
+                      let _24: MyId;
+                      scope 5 {
+                          debug e => _24;
+                          let _29: aggregate_struct_then_transmute::Pair;
+                          scope 6 {
+                              debug f => _29;
+                              let _35: aggregate_struct_then_transmute::Pair;
+                              scope 7 {
+                                  debug g => _35;
+                                  let _41: (u16,);
+                                  scope 8 {
+                                      debug h => _41;
+                                      let _46: [u16; 1];
+                                      scope 9 {
+                                          debug i => _46;
+                                          let _51: *const i32;
+                                          scope 10 {
+                                              debug j => _51;
+                                          }
+                                      }
+                                  }
+                              }
+                          }
+                      }
+                  }
+              }
+          }
+      }
+  
+      bb0: {
+-         StorageLive(_3);
++         nop;
+          StorageLive(_4);
+          _4 = copy _1;
+-         _3 = MyId(move _4);
++         _3 = MyId(copy _1);
+          StorageDead(_4);
+          StorageLive(_5);
+          StorageLive(_6);
+          StorageLive(_7);
+-         _7 = move _3;
+-         _6 = move _7 as u16 (Transmute);
++         _7 = copy _3;
++         _6 = copy _1;
+          StorageDead(_7);
+-         _5 = opaque::<u16>(move _6) -> [return: bb1, unwind continue];
++         _5 = opaque::<u16>(copy _1) -> [return: bb1, unwind continue];
+      }
+  
+      bb1: {
+          StorageDead(_6);
+          StorageDead(_5);
+-         StorageLive(_8);
++         nop;
+          StorageLive(_9);
+          _9 = copy _1;
+          StorageLive(_10);
+-         _10 = PhantomData::<String>;
+-         _8 = TypedId::<String>(move _9, move _10);
++         _10 = const PhantomData::<String>;
++         _8 = TypedId::<String>(copy _1, const PhantomData::<String>);
+          StorageDead(_10);
+          StorageDead(_9);
+          StorageLive(_11);
+          StorageLive(_12);
+          StorageLive(_13);
+-         _13 = move _8;
+-         _12 = move _13 as u16 (Transmute);
++         _13 = copy _8;
++         _12 = copy _1;
+          StorageDead(_13);
+-         _11 = opaque::<u16>(move _12) -> [return: bb2, unwind continue];
++         _11 = opaque::<u16>(copy _1) -> [return: bb2, unwind continue];
+      }
+  
+      bb2: {
+          StorageDead(_12);
+          StorageDead(_11);
+-         StorageLive(_14);
++         nop;
+          StorageLive(_15);
+          _15 = copy _1;
+-         _14 = Result::<Never, u16>::Err(move _15);
++         _14 = Result::<Never, u16>::Err(copy _1);
+          StorageDead(_15);
+          StorageLive(_16);
+          StorageLive(_17);
+          StorageLive(_18);
+-         _18 = move _14;
+-         _17 = move _18 as u16 (Transmute);
++         _18 = copy _14;
++         _17 = copy _1;
+          StorageDead(_18);
+-         _16 = opaque::<u16>(move _17) -> [return: bb3, unwind continue];
++         _16 = opaque::<u16>(copy _1) -> [return: bb3, unwind continue];
+      }
+  
+      bb3: {
+          StorageDead(_17);
+          StorageDead(_16);
+-         StorageLive(_19);
++         nop;
+          StorageLive(_20);
+          _20 = copy _1;
+-         _19 = Option::<u16>::Some(move _20);
++         _19 = Option::<u16>::Some(copy _1);
+          StorageDead(_20);
+          StorageLive(_21);
+          StorageLive(_22);
+          StorageLive(_23);
+          _23 = copy _19;
+-         _22 = move _23 as u32 (Transmute);
++         _22 = copy _19 as u32 (Transmute);
+          StorageDead(_23);
+          _21 = opaque::<u32>(move _22) -> [return: bb4, unwind continue];
+      }
+  
+      bb4: {
+          StorageDead(_22);
+          StorageDead(_21);
+          StorageLive(_24);
+          StorageLive(_25);
+          _25 = copy _1;
+-         _24 = MyId(move _25);
++         _24 = copy _3;
+          StorageDead(_25);
+          StorageLive(_26);
+          StorageLive(_27);
+          StorageLive(_28);
+-         _28 = move _24;
+-         _27 = move _28 as i16 (Transmute);
++         _28 = copy _3;
++         _27 = copy _1 as i16 (Transmute);
+          StorageDead(_28);
+          _26 = opaque::<i16>(move _27) -> [return: bb5, unwind continue];
+      }
+  
+      bb5: {
+          StorageDead(_27);
+          StorageDead(_26);
+-         StorageLive(_29);
++         nop;
+          StorageLive(_30);
+          _30 = copy _1;
+          StorageLive(_31);
+          _31 = copy _1;
+-         _29 = Pair(move _30, move _31);
++         _29 = Pair(copy _1, copy _1);
+          StorageDead(_31);
+          StorageDead(_30);
+          StorageLive(_32);
+          StorageLive(_33);
+          StorageLive(_34);
+-         _34 = move _29;
+-         _33 = move _34 as u32 (Transmute);
++         _34 = copy _29;
++         _33 = copy _29 as u32 (Transmute);
+          StorageDead(_34);
+          _32 = opaque::<u32>(move _33) -> [return: bb6, unwind continue];
+      }
+  
+      bb6: {
+          StorageDead(_33);
+          StorageDead(_32);
+          StorageLive(_35);
+          StorageLive(_36);
+          _36 = copy _1;
+          StorageLive(_37);
+          _37 = copy _1;
+-         _35 = Pair(move _36, move _37);
++         _35 = copy _29;
+          StorageDead(_37);
+          StorageDead(_36);
+          StorageLive(_38);
+          StorageLive(_39);
+          StorageLive(_40);
+-         _40 = move _35;
+-         _39 = move _40 as u16 (Transmute);
++         _40 = copy _29;
++         _39 = copy _29 as u16 (Transmute);
+          StorageDead(_40);
+          _38 = opaque::<u16>(move _39) -> [return: bb7, unwind continue];
+      }
+  
+      bb7: {
+          StorageDead(_39);
+          StorageDead(_38);
+-         StorageLive(_41);
++         nop;
+          StorageLive(_42);
+          _42 = copy _1;
+-         _41 = (move _42,);
++         _41 = (copy _1,);
+          StorageDead(_42);
+          StorageLive(_43);
+          StorageLive(_44);
+          StorageLive(_45);
+          _45 = copy _41;
+-         _44 = move _45 as u16 (Transmute);
++         _44 = copy _1;
+          StorageDead(_45);
+-         _43 = opaque::<u16>(move _44) -> [return: bb8, unwind continue];
++         _43 = opaque::<u16>(copy _1) -> [return: bb8, unwind continue];
+      }
+  
+      bb8: {
+          StorageDead(_44);
+          StorageDead(_43);
+-         StorageLive(_46);
++         nop;
+          StorageLive(_47);
+          _47 = copy _1;
+-         _46 = [move _47];
++         _46 = [copy _1];
+          StorageDead(_47);
+          StorageLive(_48);
+          StorageLive(_49);
+          StorageLive(_50);
+          _50 = copy _46;
+-         _49 = move _50 as u16 (Transmute);
++         _49 = copy _1;
+          StorageDead(_50);
+-         _48 = opaque::<u16>(move _49) -> [return: bb9, unwind continue];
++         _48 = opaque::<u16>(copy _1) -> [return: bb9, unwind continue];
+      }
+  
+      bb9: {
+          StorageDead(_49);
+          StorageDead(_48);
+-         StorageLive(_51);
++         nop;
+          StorageLive(_52);
+          _52 = copy _2;
+          StorageLive(_53);
+-         _53 = ();
+-         _51 = *const i32 from (move _52, move _53);
++         _53 = const ();
++         _51 = *const i32 from (copy _2, const ());
+          StorageDead(_53);
+          StorageDead(_52);
+          StorageLive(_54);
+          StorageLive(_55);
+          StorageLive(_56);
+          _56 = copy _51;
+-         _55 = move _56 as *const u8 (Transmute);
++         _55 = copy _2;
+          StorageDead(_56);
+-         _54 = opaque::<*const u8>(move _55) -> [return: bb10, unwind continue];
++         _54 = opaque::<*const u8>(copy _2) -> [return: bb10, unwind continue];
+      }
+  
+      bb10: {
+          StorageDead(_55);
+          StorageDead(_54);
+          _0 = const ();
+-         StorageDead(_51);
+-         StorageDead(_46);
+-         StorageDead(_41);
++         nop;
++         nop;
++         nop;
+          StorageDead(_35);
+-         StorageDead(_29);
++         nop;
+          StorageDead(_24);
+-         StorageDead(_19);
+-         StorageDead(_14);
+-         StorageDead(_8);
+-         StorageDead(_3);
++         nop;
++         nop;
++         nop;
++         nop;
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/gvn.rs b/tests/mir-opt/gvn.rs
index 19b58a917f8..c895a579259 100644
--- a/tests/mir-opt/gvn.rs
+++ b/tests/mir-opt/gvn.rs
@@ -12,7 +12,7 @@
 #![allow(unused)]
 
 use std::intrinsics::mir::*;
-use std::marker::Freeze;
+use std::marker::{Freeze, PhantomData};
 use std::mem::transmute;
 
 struct S<T>(T);
@@ -933,6 +933,69 @@ fn cast_pointer_eq(p1: *mut u8, p2: *mut u32, p3: *mut u32, p4: *mut [u32]) {
     // CHECK: _0 = const ();
 }
 
+unsafe fn aggregate_struct_then_transmute(id: u16, thin: *const u8) {
+    // CHECK: opaque::<u16>(copy _1)
+    let a = MyId(id);
+    opaque(std::intrinsics::transmute::<_, u16>(a));
+
+    // CHECK: opaque::<u16>(copy _1)
+    let b = TypedId::<String>(id, PhantomData);
+    opaque(std::intrinsics::transmute::<_, u16>(b));
+
+    // CHECK: opaque::<u16>(copy _1)
+    let c = Err::<Never, u16>(id);
+    opaque(std::intrinsics::transmute::<_, u16>(c));
+
+    // CHECK: [[TEMP1:_[0-9]+]] = Option::<u16>::Some(copy _1);
+    // CHECK: [[TEMP2:_[0-9]+]] = copy [[TEMP1]] as u32 (Transmute);
+    // CHECK: opaque::<u32>(move [[TEMP2]])
+    let d = Some(id);
+    opaque(std::intrinsics::transmute::<_, u32>(d));
+
+    // Still need the transmute, but the aggregate can be skipped
+    // CHECK: [[TEMP:_[0-9]+]] = copy _1 as i16 (Transmute);
+    // CHECK: opaque::<i16>(move [[TEMP]])
+    let e = MyId(id);
+    opaque(std::intrinsics::transmute::<_, i16>(e));
+
+    // CHECK: [[PAIR:_[0-9]+]] = Pair(copy _1, copy _1);
+    // CHECK: [[TEMP:_[0-9]+]] = copy [[PAIR]] as u32 (Transmute);
+    // CHECK: opaque::<u32>(move [[TEMP]])
+    struct Pair(u16, u16);
+    let f = Pair(id, id);
+    opaque(std::intrinsics::transmute::<_, u32>(f));
+
+    // CHECK: [[TEMP:_[0-9]+]] = copy [[PAIR]] as u16 (Transmute);
+    // CHECK: opaque::<u16>(move [[TEMP]])
+    let g = Pair(id, id);
+    opaque(std::intrinsics::transmute_unchecked::<_, u16>(g));
+
+    // CHECK: opaque::<u16>(copy _1)
+    let h = (id,);
+    opaque(std::intrinsics::transmute::<_, u16>(h));
+
+    // CHECK: opaque::<u16>(copy _1)
+    let i = [id];
+    opaque(std::intrinsics::transmute::<_, u16>(i));
+
+    // CHECK: opaque::<*const u8>(copy _2)
+    let j: *const i32 = std::intrinsics::aggregate_raw_ptr(thin, ());
+    opaque(std::intrinsics::transmute::<_, *const u8>(j));
+}
+
+unsafe fn transmute_then_transmute_again(a: u32, c: char) {
+    // CHECK: [[TEMP1:_[0-9]+]] = copy _1 as char (Transmute);
+    // CHECK: [[TEMP2:_[0-9]+]] = copy [[TEMP1]] as i32 (Transmute);
+    // CHECK: opaque::<i32>(move [[TEMP2]])
+    let x = std::intrinsics::transmute::<u32, char>(a);
+    opaque(std::intrinsics::transmute::<char, i32>(x));
+
+    // CHECK: [[TEMP:_[0-9]+]] = copy _2 as i32 (Transmute);
+    // CHECK: opaque::<i32>(move [[TEMP]])
+    let x = std::intrinsics::transmute::<char, u32>(c);
+    opaque(std::intrinsics::transmute::<u32, i32>(x));
+}
+
 // Transmuting can skip a pointer cast so long as it wasn't a fat-to-thin cast.
 unsafe fn cast_pointer_then_transmute(thin: *mut u32, fat: *mut [u8]) {
     // CHECK-LABEL: fn cast_pointer_then_transmute
@@ -946,6 +1009,28 @@ unsafe fn cast_pointer_then_transmute(thin: *mut u32, fat: *mut [u8]) {
     let fat_addr: usize = std::intrinsics::transmute(fat as *const ());
 }
 
+unsafe fn transmute_then_cast_pointer(addr: usize, fat: *mut [u8]) {
+    // CHECK-LABEL: fn transmute_then_cast_pointer
+
+    // This is roughly what `NonNull::dangling` does
+    // CHECK: [[CPTR:_.+]] = copy _1 as *const u8 (Transmute);
+    // CHECK: takes_const_ptr::<u8>(move [[CPTR]])
+    let p: *mut u8 = std::intrinsics::transmute(addr);
+    takes_const_ptr(p);
+
+    // This cast is fat-to-thin, so can't be merged with the transmute
+    // CHECK: [[FAT:_.+]] = move {{.+}} as *const [i32] (Transmute);
+    // CHECK: [[THIN:_.+]] = copy [[FAT]] as *const i32 (PtrToPtr);
+    // CHECK: takes_const_ptr::<i32>(move [[THIN]])
+    let q = std::intrinsics::transmute::<&mut [i32], *const [i32]>(&mut [1, 2, 3]);
+    takes_const_ptr(q as *const i32);
+
+    // CHECK: [[TPTR:_.+]] = copy _2 as *const u8 (PtrToPtr);
+    // CHECK: takes_const_ptr::<u8>(move [[TPTR]])
+    let w = std::intrinsics::transmute::<*mut [u8], *const [u8]>(fat);
+    takes_const_ptr(w as *const u8);
+}
+
 #[custom_mir(dialect = "analysis")]
 fn remove_casts_must_change_both_sides(mut_a: &*mut u8, mut_b: *mut u8) -> bool {
     // CHECK-LABEL: fn remove_casts_must_change_both_sides(
@@ -1002,6 +1087,18 @@ fn identity<T>(x: T) -> T {
     x
 }
 
+#[inline(never)]
+fn takes_const_ptr<T>(_: *const T) {}
+
+#[repr(transparent)]
+#[rustc_layout_scalar_valid_range_end(55555)]
+struct MyId(u16);
+
+#[repr(transparent)]
+struct TypedId<T>(u16, PhantomData<T>);
+
+enum Never {}
+
 // EMIT_MIR gvn.subexpression_elimination.GVN.diff
 // EMIT_MIR gvn.wrap_unwrap.GVN.diff
 // EMIT_MIR gvn.repeated_index.GVN.diff
@@ -1034,5 +1131,8 @@ fn identity<T>(x: T) -> T {
 // EMIT_MIR gvn.dedup_multiple_bounds_checks_lengths.GVN.diff
 // EMIT_MIR gvn.generic_cast_metadata.GVN.diff
 // EMIT_MIR gvn.cast_pointer_eq.GVN.diff
+// EMIT_MIR gvn.aggregate_struct_then_transmute.GVN.diff
+// EMIT_MIR gvn.transmute_then_transmute_again.GVN.diff
 // EMIT_MIR gvn.cast_pointer_then_transmute.GVN.diff
+// EMIT_MIR gvn.transmute_then_cast_pointer.GVN.diff
 // EMIT_MIR gvn.remove_casts_must_change_both_sides.GVN.diff
diff --git a/tests/mir-opt/gvn.transmute_then_cast_pointer.GVN.panic-abort.diff b/tests/mir-opt/gvn.transmute_then_cast_pointer.GVN.panic-abort.diff
new file mode 100644
index 00000000000..0bec425dd99
--- /dev/null
+++ b/tests/mir-opt/gvn.transmute_then_cast_pointer.GVN.panic-abort.diff
@@ -0,0 +1,115 @@
+- // MIR for `transmute_then_cast_pointer` before GVN
++ // MIR for `transmute_then_cast_pointer` after GVN
+  
+  fn transmute_then_cast_pointer(_1: usize, _2: *mut [u8]) -> () {
+      debug addr => _1;
+      debug fat => _2;
+      let mut _0: ();
+      let _3: *mut u8;
+      let mut _4: usize;
+      let _5: ();
+      let mut _6: *const u8;
+      let mut _7: *mut u8;
+      let mut _9: &mut [i32];
+      let mut _10: &mut [i32; 3];
+      let mut _11: &mut [i32; 3];
+      let mut _12: [i32; 3];
+      let _13: ();
+      let mut _14: *const i32;
+      let mut _15: *const [i32];
+      let mut _17: *mut [u8];
+      let _18: ();
+      let mut _19: *const u8;
+      let mut _20: *const [u8];
+      scope 1 {
+          debug p => _3;
+          let _8: *const [i32];
+          scope 2 {
+              debug q => _8;
+              let _16: *const [u8];
+              scope 3 {
+                  debug w => _16;
+              }
+          }
+      }
+  
+      bb0: {
+-         StorageLive(_3);
++         nop;
+          StorageLive(_4);
+          _4 = copy _1;
+-         _3 = move _4 as *mut u8 (Transmute);
++         _3 = copy _1 as *mut u8 (Transmute);
+          StorageDead(_4);
+          StorageLive(_5);
+          StorageLive(_6);
+          StorageLive(_7);
+          _7 = copy _3;
+-         _6 = move _7 as *const u8 (PtrToPtr);
++         _6 = copy _1 as *const u8 (Transmute);
+          StorageDead(_7);
+          _5 = takes_const_ptr::<u8>(move _6) -> [return: bb1, unwind unreachable];
+      }
+  
+      bb1: {
+          StorageDead(_6);
+          StorageDead(_5);
+-         StorageLive(_8);
++         nop;
+          StorageLive(_9);
+          StorageLive(_10);
+          StorageLive(_11);
+          StorageLive(_12);
+          _12 = [const 1_i32, const 2_i32, const 3_i32];
+          _11 = &mut _12;
+          _10 = &mut (*_11);
+          _9 = move _10 as &mut [i32] (PointerCoercion(Unsize, Implicit));
+          StorageDead(_10);
+          _8 = move _9 as *const [i32] (Transmute);
+          StorageDead(_9);
+          StorageDead(_12);
+          StorageDead(_11);
+          StorageLive(_13);
+          StorageLive(_14);
+          StorageLive(_15);
+          _15 = copy _8;
+-         _14 = move _15 as *const i32 (PtrToPtr);
++         _14 = copy _8 as *const i32 (PtrToPtr);
+          StorageDead(_15);
+          _13 = takes_const_ptr::<i32>(move _14) -> [return: bb2, unwind unreachable];
+      }
+  
+      bb2: {
+          StorageDead(_14);
+          StorageDead(_13);
+-         StorageLive(_16);
++         nop;
+          StorageLive(_17);
+          _17 = copy _2;
+-         _16 = move _17 as *const [u8] (Transmute);
++         _16 = copy _2 as *const [u8] (PtrToPtr);
+          StorageDead(_17);
+          StorageLive(_18);
+          StorageLive(_19);
+          StorageLive(_20);
+          _20 = copy _16;
+-         _19 = move _20 as *const u8 (PtrToPtr);
++         _19 = copy _2 as *const u8 (PtrToPtr);
+          StorageDead(_20);
+          _18 = takes_const_ptr::<u8>(move _19) -> [return: bb3, unwind unreachable];
+      }
+  
+      bb3: {
+          StorageDead(_19);
+          StorageDead(_18);
+          _0 = const ();
+-         StorageDead(_16);
+-         StorageDead(_8);
+-         StorageDead(_3);
++         nop;
++         nop;
++         nop;
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/gvn.transmute_then_cast_pointer.GVN.panic-unwind.diff b/tests/mir-opt/gvn.transmute_then_cast_pointer.GVN.panic-unwind.diff
new file mode 100644
index 00000000000..14f2fe08a86
--- /dev/null
+++ b/tests/mir-opt/gvn.transmute_then_cast_pointer.GVN.panic-unwind.diff
@@ -0,0 +1,115 @@
+- // MIR for `transmute_then_cast_pointer` before GVN
++ // MIR for `transmute_then_cast_pointer` after GVN
+  
+  fn transmute_then_cast_pointer(_1: usize, _2: *mut [u8]) -> () {
+      debug addr => _1;
+      debug fat => _2;
+      let mut _0: ();
+      let _3: *mut u8;
+      let mut _4: usize;
+      let _5: ();
+      let mut _6: *const u8;
+      let mut _7: *mut u8;
+      let mut _9: &mut [i32];
+      let mut _10: &mut [i32; 3];
+      let mut _11: &mut [i32; 3];
+      let mut _12: [i32; 3];
+      let _13: ();
+      let mut _14: *const i32;
+      let mut _15: *const [i32];
+      let mut _17: *mut [u8];
+      let _18: ();
+      let mut _19: *const u8;
+      let mut _20: *const [u8];
+      scope 1 {
+          debug p => _3;
+          let _8: *const [i32];
+          scope 2 {
+              debug q => _8;
+              let _16: *const [u8];
+              scope 3 {
+                  debug w => _16;
+              }
+          }
+      }
+  
+      bb0: {
+-         StorageLive(_3);
++         nop;
+          StorageLive(_4);
+          _4 = copy _1;
+-         _3 = move _4 as *mut u8 (Transmute);
++         _3 = copy _1 as *mut u8 (Transmute);
+          StorageDead(_4);
+          StorageLive(_5);
+          StorageLive(_6);
+          StorageLive(_7);
+          _7 = copy _3;
+-         _6 = move _7 as *const u8 (PtrToPtr);
++         _6 = copy _1 as *const u8 (Transmute);
+          StorageDead(_7);
+          _5 = takes_const_ptr::<u8>(move _6) -> [return: bb1, unwind continue];
+      }
+  
+      bb1: {
+          StorageDead(_6);
+          StorageDead(_5);
+-         StorageLive(_8);
++         nop;
+          StorageLive(_9);
+          StorageLive(_10);
+          StorageLive(_11);
+          StorageLive(_12);
+          _12 = [const 1_i32, const 2_i32, const 3_i32];
+          _11 = &mut _12;
+          _10 = &mut (*_11);
+          _9 = move _10 as &mut [i32] (PointerCoercion(Unsize, Implicit));
+          StorageDead(_10);
+          _8 = move _9 as *const [i32] (Transmute);
+          StorageDead(_9);
+          StorageDead(_12);
+          StorageDead(_11);
+          StorageLive(_13);
+          StorageLive(_14);
+          StorageLive(_15);
+          _15 = copy _8;
+-         _14 = move _15 as *const i32 (PtrToPtr);
++         _14 = copy _8 as *const i32 (PtrToPtr);
+          StorageDead(_15);
+          _13 = takes_const_ptr::<i32>(move _14) -> [return: bb2, unwind continue];
+      }
+  
+      bb2: {
+          StorageDead(_14);
+          StorageDead(_13);
+-         StorageLive(_16);
++         nop;
+          StorageLive(_17);
+          _17 = copy _2;
+-         _16 = move _17 as *const [u8] (Transmute);
++         _16 = copy _2 as *const [u8] (PtrToPtr);
+          StorageDead(_17);
+          StorageLive(_18);
+          StorageLive(_19);
+          StorageLive(_20);
+          _20 = copy _16;
+-         _19 = move _20 as *const u8 (PtrToPtr);
++         _19 = copy _2 as *const u8 (PtrToPtr);
+          StorageDead(_20);
+          _18 = takes_const_ptr::<u8>(move _19) -> [return: bb3, unwind continue];
+      }
+  
+      bb3: {
+          StorageDead(_19);
+          StorageDead(_18);
+          _0 = const ();
+-         StorageDead(_16);
+-         StorageDead(_8);
+-         StorageDead(_3);
++         nop;
++         nop;
++         nop;
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/gvn.transmute_then_transmute_again.GVN.panic-abort.diff b/tests/mir-opt/gvn.transmute_then_transmute_again.GVN.panic-abort.diff
new file mode 100644
index 00000000000..962fecd2586
--- /dev/null
+++ b/tests/mir-opt/gvn.transmute_then_transmute_again.GVN.panic-abort.diff
@@ -0,0 +1,74 @@
+- // MIR for `transmute_then_transmute_again` before GVN
++ // MIR for `transmute_then_transmute_again` after GVN
+  
+  fn transmute_then_transmute_again(_1: u32, _2: char) -> () {
+      debug a => _1;
+      debug c => _2;
+      let mut _0: ();
+      let _3: char;
+      let mut _4: u32;
+      let _5: ();
+      let mut _6: i32;
+      let mut _7: char;
+      let mut _9: char;
+      let _10: ();
+      let mut _11: i32;
+      let mut _12: u32;
+      scope 1 {
+          debug x => _3;
+          let _8: u32;
+          scope 2 {
+              debug x => _8;
+          }
+      }
+  
+      bb0: {
+-         StorageLive(_3);
++         nop;
+          StorageLive(_4);
+          _4 = copy _1;
+-         _3 = move _4 as char (Transmute);
++         _3 = copy _1 as char (Transmute);
+          StorageDead(_4);
+          StorageLive(_5);
+          StorageLive(_6);
+          StorageLive(_7);
+          _7 = copy _3;
+-         _6 = move _7 as i32 (Transmute);
++         _6 = copy _3 as i32 (Transmute);
+          StorageDead(_7);
+          _5 = opaque::<i32>(move _6) -> [return: bb1, unwind unreachable];
+      }
+  
+      bb1: {
+          StorageDead(_6);
+          StorageDead(_5);
+-         StorageLive(_8);
++         nop;
+          StorageLive(_9);
+          _9 = copy _2;
+-         _8 = move _9 as u32 (Transmute);
++         _8 = copy _2 as u32 (Transmute);
+          StorageDead(_9);
+          StorageLive(_10);
+          StorageLive(_11);
+          StorageLive(_12);
+          _12 = copy _8;
+-         _11 = move _12 as i32 (Transmute);
++         _11 = copy _2 as i32 (Transmute);
+          StorageDead(_12);
+          _10 = opaque::<i32>(move _11) -> [return: bb2, unwind unreachable];
+      }
+  
+      bb2: {
+          StorageDead(_11);
+          StorageDead(_10);
+          _0 = const ();
+-         StorageDead(_8);
+-         StorageDead(_3);
++         nop;
++         nop;
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/gvn.transmute_then_transmute_again.GVN.panic-unwind.diff b/tests/mir-opt/gvn.transmute_then_transmute_again.GVN.panic-unwind.diff
new file mode 100644
index 00000000000..e32397c1aed
--- /dev/null
+++ b/tests/mir-opt/gvn.transmute_then_transmute_again.GVN.panic-unwind.diff
@@ -0,0 +1,74 @@
+- // MIR for `transmute_then_transmute_again` before GVN
++ // MIR for `transmute_then_transmute_again` after GVN
+  
+  fn transmute_then_transmute_again(_1: u32, _2: char) -> () {
+      debug a => _1;
+      debug c => _2;
+      let mut _0: ();
+      let _3: char;
+      let mut _4: u32;
+      let _5: ();
+      let mut _6: i32;
+      let mut _7: char;
+      let mut _9: char;
+      let _10: ();
+      let mut _11: i32;
+      let mut _12: u32;
+      scope 1 {
+          debug x => _3;
+          let _8: u32;
+          scope 2 {
+              debug x => _8;
+          }
+      }
+  
+      bb0: {
+-         StorageLive(_3);
++         nop;
+          StorageLive(_4);
+          _4 = copy _1;
+-         _3 = move _4 as char (Transmute);
++         _3 = copy _1 as char (Transmute);
+          StorageDead(_4);
+          StorageLive(_5);
+          StorageLive(_6);
+          StorageLive(_7);
+          _7 = copy _3;
+-         _6 = move _7 as i32 (Transmute);
++         _6 = copy _3 as i32 (Transmute);
+          StorageDead(_7);
+          _5 = opaque::<i32>(move _6) -> [return: bb1, unwind continue];
+      }
+  
+      bb1: {
+          StorageDead(_6);
+          StorageDead(_5);
+-         StorageLive(_8);
++         nop;
+          StorageLive(_9);
+          _9 = copy _2;
+-         _8 = move _9 as u32 (Transmute);
++         _8 = copy _2 as u32 (Transmute);
+          StorageDead(_9);
+          StorageLive(_10);
+          StorageLive(_11);
+          StorageLive(_12);
+          _12 = copy _8;
+-         _11 = move _12 as i32 (Transmute);
++         _11 = copy _2 as i32 (Transmute);
+          StorageDead(_12);
+          _10 = opaque::<i32>(move _11) -> [return: bb2, unwind continue];
+      }
+  
+      bb2: {
+          StorageDead(_11);
+          StorageDead(_10);
+          _0 = const ();
+-         StorageDead(_8);
+-         StorageDead(_3);
++         nop;
++         nop;
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/impossible_predicates.impossible_predicate.ImpossiblePredicates.diff b/tests/mir-opt/impossible_predicates.impossible_predicate.ImpossiblePredicates.diff
new file mode 100644
index 00000000000..46d1ca7464c
--- /dev/null
+++ b/tests/mir-opt/impossible_predicates.impossible_predicate.ImpossiblePredicates.diff
@@ -0,0 +1,30 @@
+- // MIR for `impossible_predicate` before ImpossiblePredicates
++ // MIR for `impossible_predicate` after ImpossiblePredicates
+  
+  fn impossible_predicate(_1: &mut i32) -> (&mut i32, &mut i32) {
+-     debug x => _1;
+      let mut _0: (&mut i32, &mut i32);
+-     let _2: &mut i32;
+-     let mut _3: &mut i32;
+-     let mut _4: &mut i32;
+      scope 1 {
+-         debug y => _2;
+      }
+  
+      bb0: {
+-         StorageLive(_2);
+-         _2 = copy _1;
+-         FakeRead(ForLet(None), _2);
+-         StorageLive(_3);
+-         _3 = &mut (*_2);
+-         StorageLive(_4);
+-         _4 = &mut (*_1);
+-         _0 = (move _3, move _4);
+-         StorageDead(_4);
+-         StorageDead(_3);
+-         StorageDead(_2);
+-         return;
++         unreachable;
+      }
+  }
+  
diff --git a/tests/mir-opt/impossible_predicates.rs b/tests/mir-opt/impossible_predicates.rs
new file mode 100644
index 00000000000..34adf7f9161
--- /dev/null
+++ b/tests/mir-opt/impossible_predicates.rs
@@ -0,0 +1,10 @@
+// skip-filecheck
+// EMIT_MIR impossible_predicates.impossible_predicate.ImpossiblePredicates.diff
+
+pub fn impossible_predicate(x: &mut i32) -> (&mut i32, &mut i32)
+where
+    for<'a> &'a mut i32: Copy,
+{
+    let y = x;
+    (y, x)
+}
diff --git a/tests/mir-opt/inline/forced.caller.ForceInline.panic-abort.diff b/tests/mir-opt/inline/forced.caller.ForceInline.panic-abort.diff
new file mode 100644
index 00000000000..f894f06e5a0
--- /dev/null
+++ b/tests/mir-opt/inline/forced.caller.ForceInline.panic-abort.diff
@@ -0,0 +1,21 @@
+- // MIR for `caller` before ForceInline
++ // MIR for `caller` after ForceInline
+  
+  fn caller() -> () {
+      let mut _0: ();
+      let _1: ();
++     scope 1 (inlined callee_forced) {
++     }
+  
+      bb0: {
+          StorageLive(_1);
+-         _1 = callee_forced() -> [return: bb1, unwind unreachable];
+-     }
+- 
+-     bb1: {
+          StorageDead(_1);
+          _0 = const ();
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/inline/forced.caller.ForceInline.panic-unwind.diff b/tests/mir-opt/inline/forced.caller.ForceInline.panic-unwind.diff
new file mode 100644
index 00000000000..7b70fd66566
--- /dev/null
+++ b/tests/mir-opt/inline/forced.caller.ForceInline.panic-unwind.diff
@@ -0,0 +1,21 @@
+- // MIR for `caller` before ForceInline
++ // MIR for `caller` after ForceInline
+  
+  fn caller() -> () {
+      let mut _0: ();
+      let _1: ();
++     scope 1 (inlined callee_forced) {
++     }
+  
+      bb0: {
+          StorageLive(_1);
+-         _1 = callee_forced() -> [return: bb1, unwind continue];
+-     }
+- 
+-     bb1: {
+          StorageDead(_1);
+          _0 = const ();
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/inline/forced.rs b/tests/mir-opt/inline/forced.rs
new file mode 100644
index 00000000000..0447ef2e4d7
--- /dev/null
+++ b/tests/mir-opt/inline/forced.rs
@@ -0,0 +1,13 @@
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+//@ compile-flags: -Copt-level=0 --crate-type=lib
+#![feature(rustc_attrs)]
+
+#[rustc_force_inline]
+pub fn callee_forced() {}
+
+// EMIT_MIR forced.caller.ForceInline.diff
+pub fn caller() {
+    callee_forced();
+    // CHECK-LABEL: fn caller(
+    // CHECK: (inlined callee_forced)
+}
diff --git a/tests/mir-opt/inline/forced_async.caller.ForceInline.panic-abort.diff b/tests/mir-opt/inline/forced_async.caller.ForceInline.panic-abort.diff
new file mode 100644
index 00000000000..42048bceef8
--- /dev/null
+++ b/tests/mir-opt/inline/forced_async.caller.ForceInline.panic-abort.diff
@@ -0,0 +1,12 @@
+- // MIR for `caller` before ForceInline
++ // MIR for `caller` after ForceInline
+  
+  fn caller() -> {async fn body of caller()} {
+      let mut _0: {async fn body of caller()};
+  
+      bb0: {
+          _0 = {coroutine@$DIR/forced_async.rs:10:19: 14:2 (#0)};
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/inline/forced_async.caller.ForceInline.panic-unwind.diff b/tests/mir-opt/inline/forced_async.caller.ForceInline.panic-unwind.diff
new file mode 100644
index 00000000000..42048bceef8
--- /dev/null
+++ b/tests/mir-opt/inline/forced_async.caller.ForceInline.panic-unwind.diff
@@ -0,0 +1,12 @@
+- // MIR for `caller` before ForceInline
++ // MIR for `caller` after ForceInline
+  
+  fn caller() -> {async fn body of caller()} {
+      let mut _0: {async fn body of caller()};
+  
+      bb0: {
+          _0 = {coroutine@$DIR/forced_async.rs:10:19: 14:2 (#0)};
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/inline/forced_async.rs b/tests/mir-opt/inline/forced_async.rs
new file mode 100644
index 00000000000..456f8fdc5ce
--- /dev/null
+++ b/tests/mir-opt/inline/forced_async.rs
@@ -0,0 +1,14 @@
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+//@ compile-flags: -Copt-level=0 --crate-type=lib
+//@ edition: 2021
+#![feature(rustc_attrs)]
+
+#[rustc_force_inline]
+pub fn callee_forced() {}
+
+// EMIT_MIR forced_async.caller.ForceInline.diff
+async fn caller() {
+    callee_forced();
+    // CHECK-LABEL: fn caller(
+    // CHECK: (inlined callee_forced)
+}
diff --git a/tests/mir-opt/inline/forced_closure.caller-{closure#0}.ForceInline.panic-abort.diff b/tests/mir-opt/inline/forced_closure.caller-{closure#0}.ForceInline.panic-abort.diff
new file mode 100644
index 00000000000..def2375efd0
--- /dev/null
+++ b/tests/mir-opt/inline/forced_closure.caller-{closure#0}.ForceInline.panic-abort.diff
@@ -0,0 +1,21 @@
+- // MIR for `caller::{closure#0}` before ForceInline
++ // MIR for `caller::{closure#0}` after ForceInline
+  
+  fn caller::{closure#0}(_1: &{closure@$DIR/forced_closure.rs:10:6: 10:8}) -> () {
+      let mut _0: ();
+      let _2: ();
++     scope 1 (inlined callee_forced) {
++     }
+  
+      bb0: {
+          StorageLive(_2);
+-         _2 = callee_forced() -> [return: bb1, unwind unreachable];
+-     }
+- 
+-     bb1: {
+          StorageDead(_2);
+          _0 = const ();
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/inline/forced_closure.caller-{closure#0}.ForceInline.panic-unwind.diff b/tests/mir-opt/inline/forced_closure.caller-{closure#0}.ForceInline.panic-unwind.diff
new file mode 100644
index 00000000000..8f50c20587d
--- /dev/null
+++ b/tests/mir-opt/inline/forced_closure.caller-{closure#0}.ForceInline.panic-unwind.diff
@@ -0,0 +1,21 @@
+- // MIR for `caller::{closure#0}` before ForceInline
++ // MIR for `caller::{closure#0}` after ForceInline
+  
+  fn caller::{closure#0}(_1: &{closure@$DIR/forced_closure.rs:10:6: 10:8}) -> () {
+      let mut _0: ();
+      let _2: ();
++     scope 1 (inlined callee_forced) {
++     }
+  
+      bb0: {
+          StorageLive(_2);
+-         _2 = callee_forced() -> [return: bb1, unwind continue];
+-     }
+- 
+-     bb1: {
+          StorageDead(_2);
+          _0 = const ();
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/inline/forced_closure.rs b/tests/mir-opt/inline/forced_closure.rs
new file mode 100644
index 00000000000..a5590d6c7f0
--- /dev/null
+++ b/tests/mir-opt/inline/forced_closure.rs
@@ -0,0 +1,15 @@
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+//@ compile-flags: -Copt-level=0 --crate-type=lib
+#![feature(rustc_attrs)]
+
+#[rustc_force_inline]
+pub fn callee_forced() {}
+
+// EMIT_MIR forced_closure.caller-{closure#0}.ForceInline.diff
+pub fn caller() {
+    (|| {
+        callee_forced();
+        // CHECK-LABEL: fn caller::{closure#0}(
+        // CHECK: (inlined callee_forced)
+    })();
+}
diff --git a/tests/mir-opt/inline/forced_dead_code.caller.ForceInline.panic-abort.diff b/tests/mir-opt/inline/forced_dead_code.caller.ForceInline.panic-abort.diff
new file mode 100644
index 00000000000..f894f06e5a0
--- /dev/null
+++ b/tests/mir-opt/inline/forced_dead_code.caller.ForceInline.panic-abort.diff
@@ -0,0 +1,21 @@
+- // MIR for `caller` before ForceInline
++ // MIR for `caller` after ForceInline
+  
+  fn caller() -> () {
+      let mut _0: ();
+      let _1: ();
++     scope 1 (inlined callee_forced) {
++     }
+  
+      bb0: {
+          StorageLive(_1);
+-         _1 = callee_forced() -> [return: bb1, unwind unreachable];
+-     }
+- 
+-     bb1: {
+          StorageDead(_1);
+          _0 = const ();
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/inline/forced_dead_code.caller.ForceInline.panic-unwind.diff b/tests/mir-opt/inline/forced_dead_code.caller.ForceInline.panic-unwind.diff
new file mode 100644
index 00000000000..7b70fd66566
--- /dev/null
+++ b/tests/mir-opt/inline/forced_dead_code.caller.ForceInline.panic-unwind.diff
@@ -0,0 +1,21 @@
+- // MIR for `caller` before ForceInline
++ // MIR for `caller` after ForceInline
+  
+  fn caller() -> () {
+      let mut _0: ();
+      let _1: ();
++     scope 1 (inlined callee_forced) {
++     }
+  
+      bb0: {
+          StorageLive(_1);
+-         _1 = callee_forced() -> [return: bb1, unwind continue];
+-     }
+- 
+-     bb1: {
+          StorageDead(_1);
+          _0 = const ();
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/inline/forced_dead_code.rs b/tests/mir-opt/inline/forced_dead_code.rs
new file mode 100644
index 00000000000..832272cde7f
--- /dev/null
+++ b/tests/mir-opt/inline/forced_dead_code.rs
@@ -0,0 +1,17 @@
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+//@ compile-flags: -Copt-level=0 -Clink-dead-code
+#![feature(rustc_attrs)]
+
+#[rustc_force_inline]
+pub fn callee_forced() {}
+
+// EMIT_MIR forced_dead_code.caller.ForceInline.diff
+pub fn caller() {
+    callee_forced();
+    // CHECK-LABEL: fn caller(
+    // CHECK: (inlined callee_forced)
+}
+
+fn main() {
+    caller();
+}
diff --git a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff
index 581244074b3..4337e0da183 100644
--- a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff
@@ -11,10 +11,43 @@
 +     scope 1 (inlined std::ptr::drop_in_place::<Vec<A>> - shim(Some(Vec<A>))) {
 +         let mut _6: &mut std::vec::Vec<A>;
 +         let mut _7: ();
++         scope 2 (inlined <Vec<A> as Drop>::drop) {
++             let mut _8: *mut [A];
++             let mut _9: *mut A;
++             let mut _10: usize;
++             scope 3 (inlined Vec::<A>::as_mut_ptr) {
++                 scope 4 (inlined alloc::raw_vec::RawVec::<A>::ptr) {
++                     scope 5 (inlined alloc::raw_vec::RawVecInner::ptr::<A>) {
++                         scope 6 (inlined alloc::raw_vec::RawVecInner::non_null::<A>) {
++                             let mut _11: std::ptr::NonNull<u8>;
++                             scope 7 (inlined Unique::<u8>::cast::<A>) {
++                                 scope 8 (inlined NonNull::<u8>::cast::<A>) {
++                                     scope 9 (inlined NonNull::<u8>::as_ptr) {
++                                     }
++                                 }
++                             }
++                             scope 10 (inlined Unique::<A>::as_non_null_ptr) {
++                             }
++                         }
++                         scope 11 (inlined NonNull::<A>::as_ptr) {
++                         }
++                     }
++                 }
++             }
++             scope 12 (inlined slice_from_raw_parts_mut::<A>) {
++                 scope 13 (inlined std::ptr::from_raw_parts_mut::<[A], A>) {
++                 }
++             }
++             scope 14 (inlined std::ptr::drop_in_place::<[A]> - shim(Some([A]))) {
++                 let mut _12: usize;
++                 let mut _13: *mut A;
++                 let mut _14: bool;
++             }
++         }
 +     }
-+     scope 2 (inlined std::ptr::drop_in_place::<Option<B>> - shim(Some(Option<B>))) {
-+         let mut _8: isize;
-+         let mut _9: isize;
++     scope 15 (inlined std::ptr::drop_in_place::<Option<B>> - shim(Some(Option<B>))) {
++         let mut _15: isize;
++         let mut _16: isize;
 +     }
   
       bb0: {
@@ -25,7 +58,21 @@
 +         StorageLive(_6);
 +         StorageLive(_7);
 +         _6 = &mut (*_4);
-+         _7 = <Vec<A> as Drop>::drop(move _6) -> [return: bb2, unwind unreachable];
++         StorageLive(_10);
++         StorageLive(_8);
++         StorageLive(_9);
++         StorageLive(_11);
++         _11 = copy (((((*_6).0: alloc::raw_vec::RawVec<A>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>);
++         _9 = copy _11 as *mut A (Transmute);
++         StorageDead(_11);
++         _10 = copy ((*_6).1: usize);
++         _8 = *mut [A] from (copy _9, copy _10);
++         StorageDead(_9);
++         StorageLive(_12);
++         StorageLive(_13);
++         StorageLive(_14);
++         _12 = const 0_usize;
++         goto -> bb4;
       }
   
       bb1: {
@@ -36,25 +83,41 @@
           StorageLive(_5);
           _5 = copy _2;
 -         _0 = std::ptr::drop_in_place::<Option<B>>(move _5) -> [return: bb2, unwind unreachable];
-+         StorageLive(_8);
-+         StorageLive(_9);
-+         _8 = discriminant((*_5));
-+         switchInt(move _8) -> [0: bb3, otherwise: bb4];
++         StorageLive(_15);
++         StorageLive(_16);
++         _15 = discriminant((*_5));
++         switchInt(move _15) -> [0: bb5, otherwise: bb6];
       }
   
       bb2: {
++         StorageDead(_14);
++         StorageDead(_13);
++         StorageDead(_12);
++         StorageDead(_8);
++         StorageDead(_10);
 +         drop(((*_4).0: alloc::raw_vec::RawVec<A>)) -> [return: bb1, unwind unreachable];
 +     }
 + 
 +     bb3: {
-+         StorageDead(_9);
-+         StorageDead(_8);
++         _13 = &raw mut (*_8)[_12];
++         _12 = Add(move _12, const 1_usize);
++         drop((*_13)) -> [return: bb4, unwind unreachable];
++     }
++ 
++     bb4: {
++         _14 = Eq(copy _12, copy _10);
++         switchInt(move _14) -> [0: bb3, otherwise: bb2];
++     }
++ 
++     bb5: {
++         StorageDead(_16);
++         StorageDead(_15);
           StorageDead(_5);
           return;
 +     }
 + 
-+     bb4: {
-+         drop((((*_5) as Some).0: B)) -> [return: bb3, unwind unreachable];
++     bb6: {
++         drop((((*_5) as Some).0: B)) -> [return: bb5, unwind unreachable];
       }
   }
   
diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir
index 02aadfc1de0..103475b608c 100644
--- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir
+++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir
@@ -20,7 +20,7 @@ fn b(_1: &mut Box<T>) -> &mut T {
         StorageLive(_5);
         StorageLive(_6);
         _5 = copy (*_4);
-        _6 = copy (((_5.0: std::ptr::Unique<T>).0: std::ptr::NonNull<T>).0: *const T);
+        _6 = copy ((_5.0: std::ptr::Unique<T>).0: std::ptr::NonNull<T>) as *const T (Transmute);
         _3 = &mut (*_6);
         StorageDead(_6);
         StorageDead(_5);
diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir
index 1ea347510fd..babb26808ce 100644
--- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir
+++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir
@@ -18,7 +18,7 @@ fn d(_1: &Box<T>) -> &T {
         StorageLive(_4);
         StorageLive(_5);
         _4 = copy (*_3);
-        _5 = copy (((_4.0: std::ptr::Unique<T>).0: std::ptr::NonNull<T>).0: *const T);
+        _5 = copy ((_4.0: std::ptr::Unique<T>).0: std::ptr::NonNull<T>) as *const T (Transmute);
         _2 = &(*_5);
         StorageDead(_5);
         StorageDead(_4);
diff --git a/tests/mir-opt/inline/unsized_argument.caller.Inline.diff b/tests/mir-opt/inline/unsized_argument.caller.Inline.diff
index 70671e2089a..644d6d320de 100644
--- a/tests/mir-opt/inline/unsized_argument.caller.Inline.diff
+++ b/tests/mir-opt/inline/unsized_argument.caller.Inline.diff
@@ -12,7 +12,7 @@
           StorageLive(_2);
           StorageLive(_3);
           _3 = move _1;
-          _4 = copy (((_3.0: std::ptr::Unique<[i32]>).0: std::ptr::NonNull<[i32]>).0: *const [i32]);
+          _4 = copy ((_3.0: std::ptr::Unique<[i32]>).0: std::ptr::NonNull<[i32]>) as *const [i32] (Transmute);
           _2 = callee(move (*_4)) -> [return: bb1, unwind: bb3];
       }
   
diff --git a/tests/mir-opt/instsimplify/aggregate_array.const_items.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/instsimplify/aggregate_array.const_items.InstSimplify-after-simplifycfg.diff
new file mode 100644
index 00000000000..bdeabee2e46
--- /dev/null
+++ b/tests/mir-opt/instsimplify/aggregate_array.const_items.InstSimplify-after-simplifycfg.diff
@@ -0,0 +1,13 @@
+- // MIR for `const_items` before InstSimplify-after-simplifycfg
++ // MIR for `const_items` after InstSimplify-after-simplifycfg
+  
+  fn const_items() -> [u8; 5] {
+      let mut _0: [u8; 5];
+  
+      bb0: {
+-         _0 = [const const_items::A, const const_items::B, const const_items::C, const const_items::D, const const_items::E];
++         _0 = [const const_items::A; 5];
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/instsimplify/aggregate_array.equal_referents.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/instsimplify/aggregate_array.equal_referents.InstSimplify-after-simplifycfg.diff
new file mode 100644
index 00000000000..86e0860ccfa
--- /dev/null
+++ b/tests/mir-opt/instsimplify/aggregate_array.equal_referents.InstSimplify-after-simplifycfg.diff
@@ -0,0 +1,12 @@
+- // MIR for `equal_referents` before InstSimplify-after-simplifycfg
++ // MIR for `equal_referents` after InstSimplify-after-simplifycfg
+  
+  fn equal_referents() -> [&u8; 5] {
+      let mut _0: [&u8; 5];
+  
+      bb0: {
+          _0 = [const equal_referents::A, const equal_referents::B, const equal_referents::C, const equal_referents::D, const equal_referents::E];
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/instsimplify/aggregate_array.literals.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/instsimplify/aggregate_array.literals.InstSimplify-after-simplifycfg.diff
new file mode 100644
index 00000000000..2f6963ad016
--- /dev/null
+++ b/tests/mir-opt/instsimplify/aggregate_array.literals.InstSimplify-after-simplifycfg.diff
@@ -0,0 +1,13 @@
+- // MIR for `literals` before InstSimplify-after-simplifycfg
++ // MIR for `literals` after InstSimplify-after-simplifycfg
+  
+  fn literals() -> [u8; 5] {
+      let mut _0: [u8; 5];
+  
+      bb0: {
+-         _0 = [const 0_u8, const 0_u8, const 0_u8, const 0_u8, const 0_u8];
++         _0 = [const 0_u8; 5];
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/instsimplify/aggregate_array.local.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/instsimplify/aggregate_array.local.InstSimplify-after-simplifycfg.diff
new file mode 100644
index 00000000000..2943aa54061
--- /dev/null
+++ b/tests/mir-opt/instsimplify/aggregate_array.local.InstSimplify-after-simplifycfg.diff
@@ -0,0 +1,39 @@
+- // MIR for `local` before InstSimplify-after-simplifycfg
++ // MIR for `local` after InstSimplify-after-simplifycfg
+  
+  fn local() -> [u8; 5] {
+      let mut _0: [u8; 5];
+      let _1: u8;
+      let mut _2: u8;
+      let mut _3: u8;
+      let mut _4: u8;
+      let mut _5: u8;
+      let mut _6: u8;
+      scope 1 {
+          debug val => _1;
+      }
+  
+      bb0: {
+          StorageLive(_1);
+          _1 = const 0_u8;
+          StorageLive(_2);
+          _2 = copy _1;
+          StorageLive(_3);
+          _3 = copy _1;
+          StorageLive(_4);
+          _4 = copy _1;
+          StorageLive(_5);
+          _5 = copy _1;
+          StorageLive(_6);
+          _6 = copy _1;
+          _0 = [move _2, move _3, move _4, move _5, move _6];
+          StorageDead(_6);
+          StorageDead(_5);
+          StorageDead(_4);
+          StorageDead(_3);
+          StorageDead(_2);
+          StorageDead(_1);
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/instsimplify/aggregate_array.rs b/tests/mir-opt/instsimplify/aggregate_array.rs
new file mode 100644
index 00000000000..8dd0d80b459
--- /dev/null
+++ b/tests/mir-opt/instsimplify/aggregate_array.rs
@@ -0,0 +1,56 @@
+//@ test-mir-pass: InstSimplify-after-simplifycfg
+#![crate_type = "lib"]
+
+// This is the easy case, and the most plausible to run into in real code.
+// EMIT_MIR aggregate_array.literals.InstSimplify-after-simplifycfg.diff
+pub fn literals() -> [u8; 5] {
+    // CHECK-LABEL: fn literals(
+    // CHECK: _0 = [const 0_u8; 5];
+    [0, 0, 0, 0, 0]
+}
+
+// Check that hiding the const value behind a const item doesn't prevent the optimization
+// EMIT_MIR aggregate_array.const_items.InstSimplify-after-simplifycfg.diff
+pub fn const_items() -> [u8; 5] {
+    const A: u8 = 0;
+    const B: u8 = 0;
+    const C: u8 = 0;
+    const D: u8 = 0;
+    const E: u8 = 0;
+
+    // CHECK-LABEL: fn const_items(
+    // CHECK: _0 = [const const_items::A; 5];
+    [A, B, C, D, E]
+}
+
+// EMIT_MIR aggregate_array.strs.InstSimplify-after-simplifycfg.diff
+pub fn strs() -> [&'static str; 5] {
+    // CHECK-LABEL: fn strs(
+    // CHECK: _0 = [const "a"; 5];
+    ["a", "a", "a", "a", "a"]
+}
+
+// InstSimplify isn't able to see through the move operands, but GVN can.
+// EMIT_MIR aggregate_array.local.InstSimplify-after-simplifycfg.diff
+pub fn local() -> [u8; 5] {
+    // CHECK-LABEL: fn local(
+    // CHECK: _0 = [move _2, move _3, move _4, move _5, move _6];
+    let val = 0;
+    [val, val, val, val, val]
+}
+
+// All of these consts refer to the same value, but the addresses are all different.
+// It would be wrong to apply the optimization here.
+// EMIT_MIR aggregate_array.equal_referents.InstSimplify-after-simplifycfg.diff
+pub fn equal_referents() -> [&'static u8; 5] {
+    const DATA: &[u8] = &[0, 0, 0, 0, 0];
+    const A: &u8 = &DATA[0];
+    const B: &u8 = &DATA[1];
+    const C: &u8 = &DATA[2];
+    const D: &u8 = &DATA[3];
+    const E: &u8 = &DATA[4];
+
+    // CHECK-LABEL: fn equal_referents(
+    // CHECK: _0 = [const equal_referents::A, const equal_referents::B, const equal_referents::C, const equal_referents::D, const equal_referents::E];
+    [A, B, C, D, E]
+}
diff --git a/tests/mir-opt/instsimplify/aggregate_array.strs.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/instsimplify/aggregate_array.strs.InstSimplify-after-simplifycfg.diff
new file mode 100644
index 00000000000..f8884881756
--- /dev/null
+++ b/tests/mir-opt/instsimplify/aggregate_array.strs.InstSimplify-after-simplifycfg.diff
@@ -0,0 +1,13 @@
+- // MIR for `strs` before InstSimplify-after-simplifycfg
++ // MIR for `strs` after InstSimplify-after-simplifycfg
+  
+  fn strs() -> [&str; 5] {
+      let mut _0: [&str; 5];
+  
+      bb0: {
+-         _0 = [const "a", const "a", const "a", const "a", const "a"];
++         _0 = [const "a"; 5];
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify-after-simplifycfg.diff
deleted file mode 100644
index 9844aa2a64e..00000000000
--- a/tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify-after-simplifycfg.diff
+++ /dev/null
@@ -1,83 +0,0 @@
-- // MIR for `adt_transmutes` before InstSimplify-after-simplifycfg
-+ // MIR for `adt_transmutes` after InstSimplify-after-simplifycfg
-  
-  fn adt_transmutes() -> () {
-      let mut _0: ();
-      let _1: u8;
-      let mut _2: std::option::Option<std::num::NonZero<u8>>;
-      let mut _4: std::num::Wrapping<i16>;
-      let mut _6: std::num::Wrapping<i16>;
-      let mut _8: Union32;
-      let mut _10: Union32;
-      let mut _12: std::mem::MaybeUninit<std::string::String>;
-      scope 1 {
-          debug _a => _1;
-          let _3: i16;
-          scope 2 {
-              debug _a => _3;
-              let _5: u16;
-              scope 3 {
-                  debug _a => _5;
-                  let _7: u32;
-                  scope 4 {
-                      debug _a => _7;
-                      let _9: i32;
-                      scope 5 {
-                          debug _a => _9;
-                          let _11: std::mem::ManuallyDrop<std::string::String>;
-                          scope 6 {
-                              debug _a => _11;
-                          }
-                      }
-                  }
-              }
-          }
-      }
-  
-      bb0: {
-          StorageLive(_1);
-          StorageLive(_2);
-          _2 = Option::<NonZero<u8>>::Some(const std::num::NonZero::<u8>::MAX);
-          _1 = move _2 as u8 (Transmute);
-          StorageDead(_2);
-          StorageLive(_3);
-          StorageLive(_4);
-          _4 = Wrapping::<i16>(const 0_i16);
--         _3 = move _4 as i16 (Transmute);
-+         _3 = move (_4.0: i16);
-          StorageDead(_4);
-          StorageLive(_5);
-          StorageLive(_6);
-          _6 = Wrapping::<i16>(const 0_i16);
-          _5 = move _6 as u16 (Transmute);
-          StorageDead(_6);
-          StorageLive(_7);
-          StorageLive(_8);
-          _8 = Union32 { u32: const 0_i32 };
-          _7 = move _8 as u32 (Transmute);
-          StorageDead(_8);
-          StorageLive(_9);
-          StorageLive(_10);
-          _10 = Union32 { u32: const 0_u32 };
-          _9 = move _10 as i32 (Transmute);
-          StorageDead(_10);
-          StorageLive(_11);
-          StorageLive(_12);
-          _12 = MaybeUninit::<String>::uninit() -> [return: bb1, unwind unreachable];
-      }
-  
-      bb1: {
--         _11 = move _12 as std::mem::ManuallyDrop<std::string::String> (Transmute);
-+         _11 = move (_12.1: std::mem::ManuallyDrop<std::string::String>);
-          StorageDead(_12);
-          _0 = const ();
-          StorageDead(_11);
-          StorageDead(_9);
-          StorageDead(_7);
-          StorageDead(_5);
-          StorageDead(_3);
-          StorageDead(_1);
-          return;
-      }
-  }
-  
diff --git a/tests/mir-opt/instsimplify/combine_transmutes.keep_transparent_transmute.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/instsimplify/combine_transmutes.keep_transparent_transmute.InstSimplify-after-simplifycfg.diff
new file mode 100644
index 00000000000..66a29629591
--- /dev/null
+++ b/tests/mir-opt/instsimplify/combine_transmutes.keep_transparent_transmute.InstSimplify-after-simplifycfg.diff
@@ -0,0 +1,30 @@
+- // MIR for `keep_transparent_transmute` before InstSimplify-after-simplifycfg
++ // MIR for `keep_transparent_transmute` after InstSimplify-after-simplifycfg
+  
+  fn keep_transparent_transmute() -> () {
+      let mut _0: ();
+      let _1: i16;
+      let mut _3: std::num::Wrapping<i16>;
+      scope 1 {
+          debug _a => _1;
+          let _2: i16;
+          scope 2 {
+              debug _a => _2;
+          }
+      }
+  
+      bb0: {
+          StorageLive(_1);
+          _1 = const keep_transparent_transmute::{constant#0} as i16 (Transmute);
+          StorageLive(_2);
+          StorageLive(_3);
+          _3 = Wrapping::<i16>(const 0_i16);
+          _2 = move _3 as i16 (Transmute);
+          StorageDead(_3);
+          _0 = const ();
+          StorageDead(_2);
+          StorageDead(_1);
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/instsimplify/combine_transmutes.rs b/tests/mir-opt/instsimplify/combine_transmutes.rs
index 8a670301825..c12f307ca0e 100644
--- a/tests/mir-opt/instsimplify/combine_transmutes.rs
+++ b/tests/mir-opt/instsimplify/combine_transmutes.rs
@@ -43,22 +43,19 @@ pub unsafe fn integer_transmutes() {
     }
 }
 
-// EMIT_MIR combine_transmutes.adt_transmutes.InstSimplify-after-simplifycfg.diff
-pub unsafe fn adt_transmutes() {
-    // CHECK-LABEL: fn adt_transmutes(
-    // CHECK: as u8 (Transmute);
-    // CHECK: ({{_.*}}.0: i16);
-    // CHECK: as u16 (Transmute);
-    // CHECK: as u32 (Transmute);
-    // CHECK: as i32 (Transmute);
-    // CHECK: ({{_.*}}.1: std::mem::ManuallyDrop<std::string::String>);
+// EMIT_MIR combine_transmutes.keep_transparent_transmute.InstSimplify-after-simplifycfg.diff
+pub unsafe fn keep_transparent_transmute() {
+    // CHECK-LABEL: fn keep_transparent_transmute(
+    // CHECK-NOT: .{{[0-9]+}}: i16
+    // CHECK: as i16 (Transmute);
+    // CHECK-NOT: .{{[0-9]+}}: i16
+    // CHECK: as i16 (Transmute);
+    // CHECK-NOT: .{{[0-9]+}}: i16
 
-    let _a: u8 = transmute(Some(std::num::NonZero::<u8>::MAX));
+    // Transmutes should not be converted to field accesses, because MCP#807
+    // bans projections into `[rustc_layout_scalar_valid_range_*]` types.
+    let _a: i16 = transmute(const { std::num::NonZero::new(12345_i16).unwrap() });
     let _a: i16 = transmute(std::num::Wrapping(0_i16));
-    let _a: u16 = transmute(std::num::Wrapping(0_i16));
-    let _a: u32 = transmute(Union32 { i32: 0 });
-    let _a: i32 = transmute(Union32 { u32: 0 });
-    let _a: ManuallyDrop<String> = transmute(MaybeUninit::<String>::uninit());
 }
 
 pub union Union32 {
diff --git a/tests/mir-opt/instsimplify/simplify_repeat.repeat_once_to_aggregate.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/instsimplify/simplify_repeat.repeat_once_to_aggregate.InstSimplify-after-simplifycfg.diff
new file mode 100644
index 00000000000..6c1b9abc5d7
--- /dev/null
+++ b/tests/mir-opt/instsimplify/simplify_repeat.repeat_once_to_aggregate.InstSimplify-after-simplifycfg.diff
@@ -0,0 +1,30 @@
+- // MIR for `repeat_once_to_aggregate` before InstSimplify-after-simplifycfg
++ // MIR for `repeat_once_to_aggregate` after InstSimplify-after-simplifycfg
+  
+  fn repeat_once_to_aggregate(_1: T) -> [T; 1] {
+      debug x => _1;
+      let mut _0: [T; 1];
+      let _2: [T; 1];
+      let mut _3: T;
+      let mut _4: T;
+      scope 1 {
+          debug other => _2;
+      }
+  
+      bb0: {
+          StorageLive(_2);
+          StorageLive(_3);
+          _3 = copy _1;
+-         _2 = [move _3; 1];
++         _2 = [move _3];
+          StorageDead(_3);
+          StorageLive(_4);
+          _4 = copy _1;
+-         _0 = [move _4; 1];
++         _0 = [move _4];
+          StorageDead(_4);
+          StorageDead(_2);
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/instsimplify/simplify_repeat.rs b/tests/mir-opt/instsimplify/simplify_repeat.rs
new file mode 100644
index 00000000000..abcdf32072b
--- /dev/null
+++ b/tests/mir-opt/instsimplify/simplify_repeat.rs
@@ -0,0 +1,20 @@
+//@ test-mir-pass: InstSimplify-after-simplifycfg
+//@ compile-flags: -C panic=abort
+#![crate_type = "lib"]
+
+const MYSTERY: usize = 3_usize.pow(2) - 2_usize.pow(3);
+
+// EMIT_MIR simplify_repeat.repeat_once_to_aggregate.InstSimplify-after-simplifycfg.diff
+pub fn repeat_once_to_aggregate<T: Copy>(x: T) -> [T; 1] {
+    // CHECK-LABEL: fn repeat_once_to_aggregate(
+    // CHECK: debug other => [[OTHER:_[0-9]+]]
+    // CHECK-NOT: [move {{_[0-9]+}}; 1]
+    // CHECK: [[OTHER]] = [move {{_[0-9]+}}];
+    // CHECK-NOT: [move {{_[0-9]+}}; 1]
+    // CHECK: _0 = [move {{_[0-9]+}}];
+    // CHECK-NOT: [move {{_[0-9]+}}; 1]
+
+    let other = [x; MYSTERY];
+
+    [x; 1]
+}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir
index a3308cc5df1..a2ef53e0e13 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir
@@ -4,28 +4,28 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
     debug slice => _1;
     debug f => _2;
     let mut _0: ();
-    let mut _13: std::slice::Iter<'_, T>;
-    let mut _14: std::iter::Enumerate<std::slice::Iter<'_, T>>;
-    let mut _15: std::iter::Enumerate<std::slice::Iter<'_, T>>;
-    let mut _23: std::option::Option<(usize, &T)>;
-    let mut _26: &impl Fn(usize, &T);
-    let mut _27: (usize, &T);
-    let _28: ();
+    let mut _11: std::slice::Iter<'_, T>;
+    let mut _12: std::iter::Enumerate<std::slice::Iter<'_, T>>;
+    let mut _13: std::iter::Enumerate<std::slice::Iter<'_, T>>;
+    let mut _21: std::option::Option<(usize, &T)>;
+    let mut _24: &impl Fn(usize, &T);
+    let mut _25: (usize, &T);
+    let _26: ();
     scope 1 {
-        debug iter => _15;
-        let _24: usize;
-        let _25: &T;
+        debug iter => _13;
+        let _22: usize;
+        let _23: &T;
         scope 2 {
-            debug i => _24;
-            debug x => _25;
+            debug i => _22;
+            debug x => _23;
         }
         scope 18 (inlined <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next) {
-            let mut _16: &mut std::slice::Iter<'_, T>;
-            let mut _17: std::option::Option<&T>;
-            let mut _21: (usize, bool);
-            let mut _22: (usize, &T);
+            let mut _14: &mut std::slice::Iter<'_, T>;
+            let mut _15: std::option::Option<&T>;
+            let mut _19: (usize, bool);
+            let mut _20: (usize, &T);
             scope 19 {
-                let _20: usize;
+                let _18: usize;
                 scope 24 {
                 }
             }
@@ -40,8 +40,8 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
                 }
             }
             scope 25 (inlined <Option<&T> as Try>::branch) {
-                let mut _18: isize;
-                let _19: &T;
+                let mut _16: isize;
+                let _17: &T;
                 scope 26 {
                 }
             }
@@ -50,14 +50,13 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
     scope 3 (inlined core::slice::<impl [T]>::iter) {
         scope 4 (inlined std::slice::Iter::<'_, T>::new) {
             let _3: usize;
-            let mut _5: std::ptr::NonNull<[T]>;
-            let mut _9: *mut T;
-            let mut _10: *mut T;
-            let mut _12: *const T;
+            let mut _7: *mut T;
+            let mut _8: *mut T;
+            let mut _10: *const T;
             scope 5 {
-                let _8: std::ptr::NonNull<T>;
+                let _6: std::ptr::NonNull<T>;
                 scope 6 {
-                    let _11: *const T;
+                    let _9: *const T;
                     scope 7 {
                     }
                     scope 12 (inlined without_provenance::<T>) {
@@ -73,8 +72,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
                     }
                 }
                 scope 10 (inlined NonNull::<[T]>::cast::<T>) {
-                    let mut _6: *mut [T];
-                    let mut _7: *const T;
+                    let mut _5: *const T;
                     scope 11 (inlined NonNull::<[T]>::as_ptr) {
                     }
                 }
@@ -89,82 +87,76 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
     }
 
     bb0: {
-        StorageLive(_13);
+        StorageLive(_11);
         StorageLive(_3);
-        StorageLive(_8);
-        _3 = PtrMetadata(copy _1);
-        StorageLive(_5);
+        StorageLive(_6);
         StorageLive(_4);
+        _3 = PtrMetadata(copy _1);
         _4 = &raw const (*_1);
-        _5 = NonNull::<[T]> { pointer: move _4 };
-        StorageDead(_4);
-        StorageLive(_6);
-        StorageLive(_7);
-        _6 = copy _5 as *mut [T] (Transmute);
-        _7 = copy _6 as *const T (PtrToPtr);
-        _8 = NonNull::<T> { pointer: move _7 };
-        StorageDead(_7);
-        StorageDead(_6);
+        StorageLive(_5);
+        _5 = copy _4 as *const T (PtrToPtr);
+        _6 = NonNull::<T> { pointer: move _5 };
         StorageDead(_5);
-        StorageLive(_11);
+        StorageLive(_9);
         switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2];
     }
 
     bb1: {
-        StorageLive(_10);
-        StorageLive(_9);
-        _9 = copy _8 as *mut T (Transmute);
-        _10 = Offset(copy _9, copy _3);
-        StorageDead(_9);
-        _11 = move _10 as *const T (PtrToPtr);
-        StorageDead(_10);
+        StorageLive(_8);
+        StorageLive(_7);
+        _7 = copy _4 as *mut T (PtrToPtr);
+        _8 = Offset(copy _7, copy _3);
+        StorageDead(_7);
+        _9 = move _8 as *const T (PtrToPtr);
+        StorageDead(_8);
         goto -> bb3;
     }
 
     bb2: {
-        _11 = copy _3 as *const T (Transmute);
+        _9 = copy _3 as *const T (Transmute);
         goto -> bb3;
     }
 
     bb3: {
-        StorageLive(_12);
-        _12 = copy _11;
-        _13 = std::slice::Iter::<'_, T> { ptr: copy _8, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
-        StorageDead(_12);
-        StorageDead(_11);
-        StorageDead(_8);
+        StorageLive(_10);
+        _10 = copy _9;
+        _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> };
+        StorageDead(_10);
+        StorageDead(_9);
+        StorageDead(_4);
+        StorageDead(_6);
         StorageDead(_3);
-        _14 = Enumerate::<std::slice::Iter<'_, T>> { iter: copy _13, count: const 0_usize };
-        StorageDead(_13);
-        StorageLive(_15);
-        _15 = copy _14;
+        _12 = Enumerate::<std::slice::Iter<'_, T>> { iter: copy _11, count: const 0_usize };
+        StorageDead(_11);
+        StorageLive(_13);
+        _13 = copy _12;
         goto -> bb4;
     }
 
     bb4: {
-        StorageLive(_23);
-        StorageLive(_20);
         StorageLive(_21);
-        StorageLive(_17);
-        StorageLive(_16);
-        _16 = &mut (_15.0: std::slice::Iter<'_, T>);
-        _17 = <std::slice::Iter<'_, T> as Iterator>::next(move _16) -> [return: bb5, unwind unreachable];
+        StorageLive(_18);
+        StorageLive(_19);
+        StorageLive(_15);
+        StorageLive(_14);
+        _14 = &mut (_13.0: std::slice::Iter<'_, T>);
+        _15 = <std::slice::Iter<'_, T> as Iterator>::next(move _14) -> [return: bb5, unwind unreachable];
     }
 
     bb5: {
-        StorageDead(_16);
-        StorageLive(_18);
-        _18 = discriminant(_17);
-        switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb11];
+        StorageDead(_14);
+        StorageLive(_16);
+        _16 = discriminant(_15);
+        switchInt(move _16) -> [0: bb6, 1: bb8, otherwise: bb11];
     }
 
     bb6: {
+        StorageDead(_16);
+        StorageDead(_15);
+        StorageDead(_19);
         StorageDead(_18);
-        StorageDead(_17);
         StorageDead(_21);
-        StorageDead(_20);
-        StorageDead(_23);
-        StorageDead(_15);
+        StorageDead(_13);
         drop(_2) -> [return: bb7, unwind unreachable];
     }
 
@@ -173,35 +165,35 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
     }
 
     bb8: {
-        _19 = move ((_17 as Some).0: &T);
-        StorageDead(_18);
-        StorageDead(_17);
-        _20 = copy (_15.1: usize);
-        _21 = AddWithOverflow(copy (_15.1: usize), const 1_usize);
-        assert(!move (_21.1: bool), "attempt to compute `{} + {}`, which would overflow", copy (_15.1: usize), const 1_usize) -> [success: bb9, unwind unreachable];
+        _17 = move ((_15 as Some).0: &T);
+        StorageDead(_16);
+        StorageDead(_15);
+        _18 = copy (_13.1: usize);
+        _19 = AddWithOverflow(copy (_13.1: usize), const 1_usize);
+        assert(!move (_19.1: bool), "attempt to compute `{} + {}`, which would overflow", copy (_13.1: usize), const 1_usize) -> [success: bb9, unwind unreachable];
     }
 
     bb9: {
-        (_15.1: usize) = move (_21.0: usize);
-        StorageLive(_22);
-        _22 = (copy _20, copy _19);
-        _23 = Option::<(usize, &T)>::Some(move _22);
-        StorageDead(_22);
-        StorageDead(_21);
+        (_13.1: usize) = move (_19.0: usize);
+        StorageLive(_20);
+        _20 = (copy _18, copy _17);
+        _21 = Option::<(usize, &T)>::Some(move _20);
         StorageDead(_20);
-        _24 = copy (((_23 as Some).0: (usize, &T)).0: usize);
-        _25 = copy (((_23 as Some).0: (usize, &T)).1: &T);
-        StorageLive(_26);
-        _26 = &_2;
-        StorageLive(_27);
-        _27 = (copy _24, copy _25);
-        _28 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _26, move _27) -> [return: bb10, unwind unreachable];
+        StorageDead(_19);
+        StorageDead(_18);
+        _22 = copy (((_21 as Some).0: (usize, &T)).0: usize);
+        _23 = copy (((_21 as Some).0: (usize, &T)).1: &T);
+        StorageLive(_24);
+        _24 = &_2;
+        StorageLive(_25);
+        _25 = (copy _22, copy _23);
+        _26 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _24, move _25) -> [return: bb10, unwind unreachable];
     }
 
     bb10: {
-        StorageDead(_27);
-        StorageDead(_26);
-        StorageDead(_23);
+        StorageDead(_25);
+        StorageDead(_24);
+        StorageDead(_21);
         goto -> bb4;
     }
 
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 2a837fabd4c..c1b846e662b 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
@@ -4,35 +4,34 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
     debug slice => _1;
     debug f => _2;
     let mut _0: ();
-    let mut _13: std::slice::Iter<'_, T>;
-    let mut _14: std::iter::Enumerate<std::slice::Iter<'_, T>>;
-    let mut _15: std::iter::Enumerate<std::slice::Iter<'_, T>>;
-    let mut _16: &mut std::iter::Enumerate<std::slice::Iter<'_, T>>;
-    let mut _17: std::option::Option<(usize, &T)>;
-    let mut _18: isize;
-    let mut _21: &impl Fn(usize, &T);
-    let mut _22: (usize, &T);
-    let _23: ();
+    let mut _11: std::slice::Iter<'_, T>;
+    let mut _12: std::iter::Enumerate<std::slice::Iter<'_, T>>;
+    let mut _13: std::iter::Enumerate<std::slice::Iter<'_, T>>;
+    let mut _14: &mut std::iter::Enumerate<std::slice::Iter<'_, T>>;
+    let mut _15: std::option::Option<(usize, &T)>;
+    let mut _16: isize;
+    let mut _19: &impl Fn(usize, &T);
+    let mut _20: (usize, &T);
+    let _21: ();
     scope 1 {
-        debug iter => _15;
-        let _19: usize;
-        let _20: &T;
+        debug iter => _13;
+        let _17: usize;
+        let _18: &T;
         scope 2 {
-            debug i => _19;
-            debug x => _20;
+            debug i => _17;
+            debug x => _18;
         }
     }
     scope 3 (inlined core::slice::<impl [T]>::iter) {
         scope 4 (inlined std::slice::Iter::<'_, T>::new) {
             let _3: usize;
-            let mut _5: std::ptr::NonNull<[T]>;
-            let mut _9: *mut T;
-            let mut _10: *mut T;
-            let mut _12: *const T;
+            let mut _7: *mut T;
+            let mut _8: *mut T;
+            let mut _10: *const T;
             scope 5 {
-                let _8: std::ptr::NonNull<T>;
+                let _6: std::ptr::NonNull<T>;
                 scope 6 {
-                    let _11: *const T;
+                    let _9: *const T;
                     scope 7 {
                     }
                     scope 12 (inlined without_provenance::<T>) {
@@ -48,8 +47,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
                     }
                 }
                 scope 10 (inlined NonNull::<[T]>::cast::<T>) {
-                    let mut _6: *mut [T];
-                    let mut _7: *const T;
+                    let mut _5: *const T;
                     scope 11 (inlined NonNull::<[T]>::as_ptr) {
                     }
                 }
@@ -64,72 +62,66 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
     }
 
     bb0: {
-        StorageLive(_13);
+        StorageLive(_11);
         StorageLive(_3);
-        StorageLive(_8);
-        _3 = PtrMetadata(copy _1);
-        StorageLive(_5);
+        StorageLive(_6);
         StorageLive(_4);
+        _3 = PtrMetadata(copy _1);
         _4 = &raw const (*_1);
-        _5 = NonNull::<[T]> { pointer: move _4 };
-        StorageDead(_4);
-        StorageLive(_6);
-        StorageLive(_7);
-        _6 = copy _5 as *mut [T] (Transmute);
-        _7 = copy _6 as *const T (PtrToPtr);
-        _8 = NonNull::<T> { pointer: move _7 };
-        StorageDead(_7);
-        StorageDead(_6);
+        StorageLive(_5);
+        _5 = copy _4 as *const T (PtrToPtr);
+        _6 = NonNull::<T> { pointer: move _5 };
         StorageDead(_5);
-        StorageLive(_11);
+        StorageLive(_9);
         switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2];
     }
 
     bb1: {
-        StorageLive(_10);
-        StorageLive(_9);
-        _9 = copy _8 as *mut T (Transmute);
-        _10 = Offset(copy _9, copy _3);
-        StorageDead(_9);
-        _11 = move _10 as *const T (PtrToPtr);
-        StorageDead(_10);
+        StorageLive(_8);
+        StorageLive(_7);
+        _7 = copy _4 as *mut T (PtrToPtr);
+        _8 = Offset(copy _7, copy _3);
+        StorageDead(_7);
+        _9 = move _8 as *const T (PtrToPtr);
+        StorageDead(_8);
         goto -> bb3;
     }
 
     bb2: {
-        _11 = copy _3 as *const T (Transmute);
+        _9 = copy _3 as *const T (Transmute);
         goto -> bb3;
     }
 
     bb3: {
-        StorageLive(_12);
-        _12 = copy _11;
-        _13 = std::slice::Iter::<'_, T> { ptr: copy _8, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
-        StorageDead(_12);
-        StorageDead(_11);
-        StorageDead(_8);
+        StorageLive(_10);
+        _10 = copy _9;
+        _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> };
+        StorageDead(_10);
+        StorageDead(_9);
+        StorageDead(_4);
+        StorageDead(_6);
         StorageDead(_3);
-        _14 = Enumerate::<std::slice::Iter<'_, T>> { iter: copy _13, count: const 0_usize };
-        StorageDead(_13);
-        StorageLive(_15);
-        _15 = copy _14;
+        _12 = Enumerate::<std::slice::Iter<'_, T>> { iter: copy _11, count: const 0_usize };
+        StorageDead(_11);
+        StorageLive(_13);
+        _13 = copy _12;
         goto -> bb4;
     }
 
     bb4: {
-        StorageLive(_17);
-        _16 = &mut _15;
-        _17 = <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next(move _16) -> [return: bb5, unwind: bb11];
+        StorageLive(_15);
+        _14 = &mut _13;
+        _15 = <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next(move _14) -> [return: bb5, unwind: bb11];
     }
 
     bb5: {
-        _18 = discriminant(_17);
-        switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10];
+        _16 = discriminant(_15);
+        switchInt(move _16) -> [0: bb6, 1: bb8, otherwise: bb10];
     }
 
     bb6: {
-        StorageDead(_17);
         StorageDead(_15);
+        StorageDead(_13);
         drop(_2) -> [return: bb7, unwind continue];
     }
 
@@ -138,19 +130,19 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
     }
 
     bb8: {
-        _19 = copy (((_17 as Some).0: (usize, &T)).0: usize);
-        _20 = copy (((_17 as Some).0: (usize, &T)).1: &T);
-        StorageLive(_21);
-        _21 = &_2;
-        StorageLive(_22);
-        _22 = (copy _19, copy _20);
-        _23 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _21, move _22) -> [return: bb9, unwind: bb11];
+        _17 = copy (((_15 as Some).0: (usize, &T)).0: usize);
+        _18 = copy (((_15 as Some).0: (usize, &T)).1: &T);
+        StorageLive(_19);
+        _19 = &_2;
+        StorageLive(_20);
+        _20 = (copy _17, copy _18);
+        _21 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _19, move _20) -> [return: bb9, unwind: bb11];
     }
 
     bb9: {
-        StorageDead(_22);
-        StorageDead(_21);
-        StorageDead(_17);
+        StorageDead(_20);
+        StorageDead(_19);
+        StorageDead(_15);
         goto -> bb4;
     }
 
diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir
index 063045caebb..8cebf2c6bac 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir
@@ -4,32 +4,31 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     debug slice => _1;
     debug f => _2;
     let mut _0: ();
-    let mut _13: std::slice::Iter<'_, T>;
-    let mut _14: std::slice::Iter<'_, T>;
-    let mut _15: &mut std::slice::Iter<'_, T>;
-    let mut _16: std::option::Option<&T>;
-    let mut _17: isize;
-    let mut _19: &impl Fn(&T);
-    let mut _20: (&T,);
-    let _21: ();
+    let mut _11: std::slice::Iter<'_, T>;
+    let mut _12: std::slice::Iter<'_, T>;
+    let mut _13: &mut std::slice::Iter<'_, T>;
+    let mut _14: std::option::Option<&T>;
+    let mut _15: isize;
+    let mut _17: &impl Fn(&T);
+    let mut _18: (&T,);
+    let _19: ();
     scope 1 {
-        debug iter => _14;
-        let _18: &T;
+        debug iter => _12;
+        let _16: &T;
         scope 2 {
-            debug x => _18;
+            debug x => _16;
         }
     }
     scope 3 (inlined core::slice::<impl [T]>::iter) {
         scope 4 (inlined std::slice::Iter::<'_, T>::new) {
             let _3: usize;
-            let mut _5: std::ptr::NonNull<[T]>;
-            let mut _9: *mut T;
-            let mut _10: *mut T;
-            let mut _12: *const T;
+            let mut _7: *mut T;
+            let mut _8: *mut T;
+            let mut _10: *const T;
             scope 5 {
-                let _8: std::ptr::NonNull<T>;
+                let _6: std::ptr::NonNull<T>;
                 scope 6 {
-                    let _11: *const T;
+                    let _9: *const T;
                     scope 7 {
                     }
                     scope 12 (inlined without_provenance::<T>) {
@@ -45,8 +44,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
                     }
                 }
                 scope 10 (inlined NonNull::<[T]>::cast::<T>) {
-                    let mut _6: *mut [T];
-                    let mut _7: *const T;
+                    let mut _5: *const T;
                     scope 11 (inlined NonNull::<[T]>::as_ptr) {
                     }
                 }
@@ -58,68 +56,62 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
 
     bb0: {
         StorageLive(_3);
-        StorageLive(_8);
-        _3 = PtrMetadata(copy _1);
-        StorageLive(_5);
+        StorageLive(_6);
         StorageLive(_4);
+        _3 = PtrMetadata(copy _1);
         _4 = &raw const (*_1);
-        _5 = NonNull::<[T]> { pointer: move _4 };
-        StorageDead(_4);
-        StorageLive(_6);
-        StorageLive(_7);
-        _6 = copy _5 as *mut [T] (Transmute);
-        _7 = copy _6 as *const T (PtrToPtr);
-        _8 = NonNull::<T> { pointer: move _7 };
-        StorageDead(_7);
-        StorageDead(_6);
+        StorageLive(_5);
+        _5 = copy _4 as *const T (PtrToPtr);
+        _6 = NonNull::<T> { pointer: move _5 };
         StorageDead(_5);
-        StorageLive(_11);
+        StorageLive(_9);
         switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2];
     }
 
     bb1: {
-        StorageLive(_10);
-        StorageLive(_9);
-        _9 = copy _8 as *mut T (Transmute);
-        _10 = Offset(copy _9, copy _3);
-        StorageDead(_9);
-        _11 = move _10 as *const T (PtrToPtr);
-        StorageDead(_10);
+        StorageLive(_8);
+        StorageLive(_7);
+        _7 = copy _4 as *mut T (PtrToPtr);
+        _8 = Offset(copy _7, copy _3);
+        StorageDead(_7);
+        _9 = move _8 as *const T (PtrToPtr);
+        StorageDead(_8);
         goto -> bb3;
     }
 
     bb2: {
-        _11 = copy _3 as *const T (Transmute);
+        _9 = copy _3 as *const T (Transmute);
         goto -> bb3;
     }
 
     bb3: {
+        StorageLive(_10);
+        _10 = copy _9;
+        _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> };
+        StorageDead(_10);
+        StorageDead(_9);
+        StorageDead(_4);
+        StorageDead(_6);
+        StorageDead(_3);
         StorageLive(_12);
         _12 = copy _11;
-        _13 = std::slice::Iter::<'_, T> { ptr: copy _8, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
-        StorageDead(_12);
-        StorageDead(_11);
-        StorageDead(_8);
-        StorageDead(_3);
-        StorageLive(_14);
-        _14 = copy _13;
         goto -> bb4;
     }
 
     bb4: {
-        StorageLive(_16);
-        _15 = &mut _14;
-        _16 = <std::slice::Iter<'_, T> as Iterator>::next(move _15) -> [return: bb5, unwind unreachable];
+        StorageLive(_14);
+        _13 = &mut _12;
+        _14 = <std::slice::Iter<'_, T> as Iterator>::next(move _13) -> [return: bb5, unwind unreachable];
     }
 
     bb5: {
-        _17 = discriminant(_16);
-        switchInt(move _17) -> [0: bb6, 1: bb8, otherwise: bb10];
+        _15 = discriminant(_14);
+        switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb10];
     }
 
     bb6: {
-        StorageDead(_16);
         StorageDead(_14);
+        StorageDead(_12);
         drop(_2) -> [return: bb7, unwind unreachable];
     }
 
@@ -128,18 +120,18 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     }
 
     bb8: {
-        _18 = copy ((_16 as Some).0: &T);
-        StorageLive(_19);
-        _19 = &_2;
-        StorageLive(_20);
-        _20 = (copy _18,);
-        _21 = <impl Fn(&T) as Fn<(&T,)>>::call(move _19, move _20) -> [return: bb9, unwind unreachable];
+        _16 = copy ((_14 as Some).0: &T);
+        StorageLive(_17);
+        _17 = &_2;
+        StorageLive(_18);
+        _18 = (copy _16,);
+        _19 = <impl Fn(&T) as Fn<(&T,)>>::call(move _17, move _18) -> [return: bb9, unwind unreachable];
     }
 
     bb9: {
-        StorageDead(_20);
-        StorageDead(_19);
-        StorageDead(_16);
+        StorageDead(_18);
+        StorageDead(_17);
+        StorageDead(_14);
         goto -> bb4;
     }
 
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 d401ed8fcf3..e7e39240fed 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
@@ -4,32 +4,31 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     debug slice => _1;
     debug f => _2;
     let mut _0: ();
-    let mut _13: std::slice::Iter<'_, T>;
-    let mut _14: std::slice::Iter<'_, T>;
-    let mut _15: &mut std::slice::Iter<'_, T>;
-    let mut _16: std::option::Option<&T>;
-    let mut _17: isize;
-    let mut _19: &impl Fn(&T);
-    let mut _20: (&T,);
-    let _21: ();
+    let mut _11: std::slice::Iter<'_, T>;
+    let mut _12: std::slice::Iter<'_, T>;
+    let mut _13: &mut std::slice::Iter<'_, T>;
+    let mut _14: std::option::Option<&T>;
+    let mut _15: isize;
+    let mut _17: &impl Fn(&T);
+    let mut _18: (&T,);
+    let _19: ();
     scope 1 {
-        debug iter => _14;
-        let _18: &T;
+        debug iter => _12;
+        let _16: &T;
         scope 2 {
-            debug x => _18;
+            debug x => _16;
         }
     }
     scope 3 (inlined core::slice::<impl [T]>::iter) {
         scope 4 (inlined std::slice::Iter::<'_, T>::new) {
             let _3: usize;
-            let mut _5: std::ptr::NonNull<[T]>;
-            let mut _9: *mut T;
-            let mut _10: *mut T;
-            let mut _12: *const T;
+            let mut _7: *mut T;
+            let mut _8: *mut T;
+            let mut _10: *const T;
             scope 5 {
-                let _8: std::ptr::NonNull<T>;
+                let _6: std::ptr::NonNull<T>;
                 scope 6 {
-                    let _11: *const T;
+                    let _9: *const T;
                     scope 7 {
                     }
                     scope 12 (inlined without_provenance::<T>) {
@@ -45,8 +44,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
                     }
                 }
                 scope 10 (inlined NonNull::<[T]>::cast::<T>) {
-                    let mut _6: *mut [T];
-                    let mut _7: *const T;
+                    let mut _5: *const T;
                     scope 11 (inlined NonNull::<[T]>::as_ptr) {
                     }
                 }
@@ -58,68 +56,62 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
 
     bb0: {
         StorageLive(_3);
-        StorageLive(_8);
-        _3 = PtrMetadata(copy _1);
-        StorageLive(_5);
+        StorageLive(_6);
         StorageLive(_4);
+        _3 = PtrMetadata(copy _1);
         _4 = &raw const (*_1);
-        _5 = NonNull::<[T]> { pointer: move _4 };
-        StorageDead(_4);
-        StorageLive(_6);
-        StorageLive(_7);
-        _6 = copy _5 as *mut [T] (Transmute);
-        _7 = copy _6 as *const T (PtrToPtr);
-        _8 = NonNull::<T> { pointer: move _7 };
-        StorageDead(_7);
-        StorageDead(_6);
+        StorageLive(_5);
+        _5 = copy _4 as *const T (PtrToPtr);
+        _6 = NonNull::<T> { pointer: move _5 };
         StorageDead(_5);
-        StorageLive(_11);
+        StorageLive(_9);
         switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2];
     }
 
     bb1: {
-        StorageLive(_10);
-        StorageLive(_9);
-        _9 = copy _8 as *mut T (Transmute);
-        _10 = Offset(copy _9, copy _3);
-        StorageDead(_9);
-        _11 = move _10 as *const T (PtrToPtr);
-        StorageDead(_10);
+        StorageLive(_8);
+        StorageLive(_7);
+        _7 = copy _4 as *mut T (PtrToPtr);
+        _8 = Offset(copy _7, copy _3);
+        StorageDead(_7);
+        _9 = move _8 as *const T (PtrToPtr);
+        StorageDead(_8);
         goto -> bb3;
     }
 
     bb2: {
-        _11 = copy _3 as *const T (Transmute);
+        _9 = copy _3 as *const T (Transmute);
         goto -> bb3;
     }
 
     bb3: {
+        StorageLive(_10);
+        _10 = copy _9;
+        _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> };
+        StorageDead(_10);
+        StorageDead(_9);
+        StorageDead(_4);
+        StorageDead(_6);
+        StorageDead(_3);
         StorageLive(_12);
         _12 = copy _11;
-        _13 = std::slice::Iter::<'_, T> { ptr: copy _8, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
-        StorageDead(_12);
-        StorageDead(_11);
-        StorageDead(_8);
-        StorageDead(_3);
-        StorageLive(_14);
-        _14 = copy _13;
         goto -> bb4;
     }
 
     bb4: {
-        StorageLive(_16);
-        _15 = &mut _14;
-        _16 = <std::slice::Iter<'_, T> as Iterator>::next(move _15) -> [return: bb5, unwind: bb11];
+        StorageLive(_14);
+        _13 = &mut _12;
+        _14 = <std::slice::Iter<'_, T> as Iterator>::next(move _13) -> [return: bb5, unwind: bb11];
     }
 
     bb5: {
-        _17 = discriminant(_16);
-        switchInt(move _17) -> [0: bb6, 1: bb8, otherwise: bb10];
+        _15 = discriminant(_14);
+        switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb10];
     }
 
     bb6: {
-        StorageDead(_16);
         StorageDead(_14);
+        StorageDead(_12);
         drop(_2) -> [return: bb7, unwind continue];
     }
 
@@ -128,18 +120,18 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     }
 
     bb8: {
-        _18 = copy ((_16 as Some).0: &T);
-        StorageLive(_19);
-        _19 = &_2;
-        StorageLive(_20);
-        _20 = (copy _18,);
-        _21 = <impl Fn(&T) as Fn<(&T,)>>::call(move _19, move _20) -> [return: bb9, unwind: bb11];
+        _16 = copy ((_14 as Some).0: &T);
+        StorageLive(_17);
+        _17 = &_2;
+        StorageLive(_18);
+        _18 = (copy _16,);
+        _19 = <impl Fn(&T) as Fn<(&T,)>>::call(move _17, move _18) -> [return: bb9, unwind: bb11];
     }
 
     bb9: {
-        StorageDead(_20);
-        StorageDead(_19);
-        StorageDead(_16);
+        StorageDead(_18);
+        StorageDead(_17);
+        StorageDead(_14);
         goto -> bb4;
     }
 
diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir
index deb12c4f1c2..58f95d0a432 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir
@@ -4,35 +4,34 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     debug slice => _1;
     debug f => _2;
     let mut _0: ();
-    let mut _13: std::slice::Iter<'_, T>;
-    let mut _14: std::iter::Rev<std::slice::Iter<'_, T>>;
-    let mut _15: std::iter::Rev<std::slice::Iter<'_, T>>;
-    let mut _17: std::option::Option<&T>;
-    let mut _18: isize;
-    let mut _20: &impl Fn(&T);
-    let mut _21: (&T,);
-    let _22: ();
+    let mut _11: std::slice::Iter<'_, T>;
+    let mut _12: std::iter::Rev<std::slice::Iter<'_, T>>;
+    let mut _13: std::iter::Rev<std::slice::Iter<'_, T>>;
+    let mut _15: std::option::Option<&T>;
+    let mut _16: isize;
+    let mut _18: &impl Fn(&T);
+    let mut _19: (&T,);
+    let _20: ();
     scope 1 {
-        debug iter => _15;
-        let _19: &T;
+        debug iter => _13;
+        let _17: &T;
         scope 2 {
-            debug x => _19;
+            debug x => _17;
         }
         scope 18 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) {
-            let mut _16: &mut std::slice::Iter<'_, T>;
+            let mut _14: &mut std::slice::Iter<'_, T>;
         }
     }
     scope 3 (inlined core::slice::<impl [T]>::iter) {
         scope 4 (inlined std::slice::Iter::<'_, T>::new) {
             let _3: usize;
-            let mut _5: std::ptr::NonNull<[T]>;
-            let mut _9: *mut T;
-            let mut _10: *mut T;
-            let mut _12: *const T;
+            let mut _7: *mut T;
+            let mut _8: *mut T;
+            let mut _10: *const T;
             scope 5 {
-                let _8: std::ptr::NonNull<T>;
+                let _6: std::ptr::NonNull<T>;
                 scope 6 {
-                    let _11: *const T;
+                    let _9: *const T;
                     scope 7 {
                     }
                     scope 12 (inlined without_provenance::<T>) {
@@ -48,8 +47,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
                     }
                 }
                 scope 10 (inlined NonNull::<[T]>::cast::<T>) {
-                    let mut _6: *mut [T];
-                    let mut _7: *const T;
+                    let mut _5: *const T;
                     scope 11 (inlined NonNull::<[T]>::as_ptr) {
                     }
                 }
@@ -64,74 +62,68 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     }
 
     bb0: {
-        StorageLive(_13);
+        StorageLive(_11);
         StorageLive(_3);
-        StorageLive(_8);
-        _3 = PtrMetadata(copy _1);
-        StorageLive(_5);
+        StorageLive(_6);
         StorageLive(_4);
+        _3 = PtrMetadata(copy _1);
         _4 = &raw const (*_1);
-        _5 = NonNull::<[T]> { pointer: move _4 };
-        StorageDead(_4);
-        StorageLive(_6);
-        StorageLive(_7);
-        _6 = copy _5 as *mut [T] (Transmute);
-        _7 = copy _6 as *const T (PtrToPtr);
-        _8 = NonNull::<T> { pointer: move _7 };
-        StorageDead(_7);
-        StorageDead(_6);
+        StorageLive(_5);
+        _5 = copy _4 as *const T (PtrToPtr);
+        _6 = NonNull::<T> { pointer: move _5 };
         StorageDead(_5);
-        StorageLive(_11);
+        StorageLive(_9);
         switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2];
     }
 
     bb1: {
-        StorageLive(_10);
-        StorageLive(_9);
-        _9 = copy _8 as *mut T (Transmute);
-        _10 = Offset(copy _9, copy _3);
-        StorageDead(_9);
-        _11 = move _10 as *const T (PtrToPtr);
-        StorageDead(_10);
+        StorageLive(_8);
+        StorageLive(_7);
+        _7 = copy _4 as *mut T (PtrToPtr);
+        _8 = Offset(copy _7, copy _3);
+        StorageDead(_7);
+        _9 = move _8 as *const T (PtrToPtr);
+        StorageDead(_8);
         goto -> bb3;
     }
 
     bb2: {
-        _11 = copy _3 as *const T (Transmute);
+        _9 = copy _3 as *const T (Transmute);
         goto -> bb3;
     }
 
     bb3: {
-        StorageLive(_12);
-        _12 = copy _11;
-        _13 = std::slice::Iter::<'_, T> { ptr: copy _8, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
-        StorageDead(_12);
-        StorageDead(_11);
-        StorageDead(_8);
+        StorageLive(_10);
+        _10 = copy _9;
+        _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> };
+        StorageDead(_10);
+        StorageDead(_9);
+        StorageDead(_4);
+        StorageDead(_6);
         StorageDead(_3);
-        _14 = Rev::<std::slice::Iter<'_, T>> { iter: copy _13 };
-        StorageDead(_13);
-        StorageLive(_15);
-        _15 = copy _14;
+        _12 = Rev::<std::slice::Iter<'_, T>> { iter: copy _11 };
+        StorageDead(_11);
+        StorageLive(_13);
+        _13 = copy _12;
         goto -> bb4;
     }
 
     bb4: {
-        StorageLive(_17);
-        StorageLive(_16);
-        _16 = &mut (_15.0: std::slice::Iter<'_, T>);
-        _17 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _16) -> [return: bb5, unwind unreachable];
+        StorageLive(_15);
+        StorageLive(_14);
+        _14 = &mut (_13.0: std::slice::Iter<'_, T>);
+        _15 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _14) -> [return: bb5, unwind unreachable];
     }
 
     bb5: {
-        StorageDead(_16);
-        _18 = discriminant(_17);
-        switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10];
+        StorageDead(_14);
+        _16 = discriminant(_15);
+        switchInt(move _16) -> [0: bb6, 1: bb8, otherwise: bb10];
     }
 
     bb6: {
-        StorageDead(_17);
         StorageDead(_15);
+        StorageDead(_13);
         drop(_2) -> [return: bb7, unwind unreachable];
     }
 
@@ -140,18 +132,18 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     }
 
     bb8: {
-        _19 = copy ((_17 as Some).0: &T);
-        StorageLive(_20);
-        _20 = &_2;
-        StorageLive(_21);
-        _21 = (copy _19,);
-        _22 = <impl Fn(&T) as Fn<(&T,)>>::call(move _20, move _21) -> [return: bb9, unwind unreachable];
+        _17 = copy ((_15 as Some).0: &T);
+        StorageLive(_18);
+        _18 = &_2;
+        StorageLive(_19);
+        _19 = (copy _17,);
+        _20 = <impl Fn(&T) as Fn<(&T,)>>::call(move _18, move _19) -> [return: bb9, unwind unreachable];
     }
 
     bb9: {
-        StorageDead(_21);
-        StorageDead(_20);
-        StorageDead(_17);
+        StorageDead(_19);
+        StorageDead(_18);
+        StorageDead(_15);
         goto -> bb4;
     }
 
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 acd5323eb7a..e7ddacf3144 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
@@ -4,35 +4,34 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     debug slice => _1;
     debug f => _2;
     let mut _0: ();
-    let mut _13: std::slice::Iter<'_, T>;
-    let mut _14: std::iter::Rev<std::slice::Iter<'_, T>>;
-    let mut _15: std::iter::Rev<std::slice::Iter<'_, T>>;
-    let mut _17: std::option::Option<&T>;
-    let mut _18: isize;
-    let mut _20: &impl Fn(&T);
-    let mut _21: (&T,);
-    let _22: ();
+    let mut _11: std::slice::Iter<'_, T>;
+    let mut _12: std::iter::Rev<std::slice::Iter<'_, T>>;
+    let mut _13: std::iter::Rev<std::slice::Iter<'_, T>>;
+    let mut _15: std::option::Option<&T>;
+    let mut _16: isize;
+    let mut _18: &impl Fn(&T);
+    let mut _19: (&T,);
+    let _20: ();
     scope 1 {
-        debug iter => _15;
-        let _19: &T;
+        debug iter => _13;
+        let _17: &T;
         scope 2 {
-            debug x => _19;
+            debug x => _17;
         }
         scope 18 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) {
-            let mut _16: &mut std::slice::Iter<'_, T>;
+            let mut _14: &mut std::slice::Iter<'_, T>;
         }
     }
     scope 3 (inlined core::slice::<impl [T]>::iter) {
         scope 4 (inlined std::slice::Iter::<'_, T>::new) {
             let _3: usize;
-            let mut _5: std::ptr::NonNull<[T]>;
-            let mut _9: *mut T;
-            let mut _10: *mut T;
-            let mut _12: *const T;
+            let mut _7: *mut T;
+            let mut _8: *mut T;
+            let mut _10: *const T;
             scope 5 {
-                let _8: std::ptr::NonNull<T>;
+                let _6: std::ptr::NonNull<T>;
                 scope 6 {
-                    let _11: *const T;
+                    let _9: *const T;
                     scope 7 {
                     }
                     scope 12 (inlined without_provenance::<T>) {
@@ -48,8 +47,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
                     }
                 }
                 scope 10 (inlined NonNull::<[T]>::cast::<T>) {
-                    let mut _6: *mut [T];
-                    let mut _7: *const T;
+                    let mut _5: *const T;
                     scope 11 (inlined NonNull::<[T]>::as_ptr) {
                     }
                 }
@@ -64,74 +62,68 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     }
 
     bb0: {
-        StorageLive(_13);
+        StorageLive(_11);
         StorageLive(_3);
-        StorageLive(_8);
-        _3 = PtrMetadata(copy _1);
-        StorageLive(_5);
+        StorageLive(_6);
         StorageLive(_4);
+        _3 = PtrMetadata(copy _1);
         _4 = &raw const (*_1);
-        _5 = NonNull::<[T]> { pointer: move _4 };
-        StorageDead(_4);
-        StorageLive(_6);
-        StorageLive(_7);
-        _6 = copy _5 as *mut [T] (Transmute);
-        _7 = copy _6 as *const T (PtrToPtr);
-        _8 = NonNull::<T> { pointer: move _7 };
-        StorageDead(_7);
-        StorageDead(_6);
+        StorageLive(_5);
+        _5 = copy _4 as *const T (PtrToPtr);
+        _6 = NonNull::<T> { pointer: move _5 };
         StorageDead(_5);
-        StorageLive(_11);
+        StorageLive(_9);
         switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2];
     }
 
     bb1: {
-        StorageLive(_10);
-        StorageLive(_9);
-        _9 = copy _8 as *mut T (Transmute);
-        _10 = Offset(copy _9, copy _3);
-        StorageDead(_9);
-        _11 = move _10 as *const T (PtrToPtr);
-        StorageDead(_10);
+        StorageLive(_8);
+        StorageLive(_7);
+        _7 = copy _4 as *mut T (PtrToPtr);
+        _8 = Offset(copy _7, copy _3);
+        StorageDead(_7);
+        _9 = move _8 as *const T (PtrToPtr);
+        StorageDead(_8);
         goto -> bb3;
     }
 
     bb2: {
-        _11 = copy _3 as *const T (Transmute);
+        _9 = copy _3 as *const T (Transmute);
         goto -> bb3;
     }
 
     bb3: {
-        StorageLive(_12);
-        _12 = copy _11;
-        _13 = std::slice::Iter::<'_, T> { ptr: copy _8, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
-        StorageDead(_12);
-        StorageDead(_11);
-        StorageDead(_8);
+        StorageLive(_10);
+        _10 = copy _9;
+        _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> };
+        StorageDead(_10);
+        StorageDead(_9);
+        StorageDead(_4);
+        StorageDead(_6);
         StorageDead(_3);
-        _14 = Rev::<std::slice::Iter<'_, T>> { iter: copy _13 };
-        StorageDead(_13);
-        StorageLive(_15);
-        _15 = copy _14;
+        _12 = Rev::<std::slice::Iter<'_, T>> { iter: copy _11 };
+        StorageDead(_11);
+        StorageLive(_13);
+        _13 = copy _12;
         goto -> bb4;
     }
 
     bb4: {
-        StorageLive(_17);
-        StorageLive(_16);
-        _16 = &mut (_15.0: std::slice::Iter<'_, T>);
-        _17 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _16) -> [return: bb5, unwind: bb11];
+        StorageLive(_15);
+        StorageLive(_14);
+        _14 = &mut (_13.0: std::slice::Iter<'_, T>);
+        _15 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _14) -> [return: bb5, unwind: bb11];
     }
 
     bb5: {
-        StorageDead(_16);
-        _18 = discriminant(_17);
-        switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10];
+        StorageDead(_14);
+        _16 = discriminant(_15);
+        switchInt(move _16) -> [0: bb6, 1: bb8, otherwise: bb10];
     }
 
     bb6: {
-        StorageDead(_17);
         StorageDead(_15);
+        StorageDead(_13);
         drop(_2) -> [return: bb7, unwind continue];
     }
 
@@ -140,18 +132,18 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     }
 
     bb8: {
-        _19 = copy ((_17 as Some).0: &T);
-        StorageLive(_20);
-        _20 = &_2;
-        StorageLive(_21);
-        _21 = (copy _19,);
-        _22 = <impl Fn(&T) as Fn<(&T,)>>::call(move _20, move _21) -> [return: bb9, unwind: bb11];
+        _17 = copy ((_15 as Some).0: &T);
+        StorageLive(_18);
+        _18 = &_2;
+        StorageLive(_19);
+        _19 = (copy _17,);
+        _20 = <impl Fn(&T) as Fn<(&T,)>>::call(move _18, move _19) -> [return: bb9, unwind: bb11];
     }
 
     bb9: {
-        StorageDead(_21);
-        StorageDead(_20);
-        StorageDead(_17);
+        StorageDead(_19);
+        StorageDead(_18);
+        StorageDead(_15);
         goto -> bb4;
     }
 
diff --git a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir
index 3f0d60b46f4..927deabd253 100644
--- a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir
@@ -7,20 +7,16 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] {
         debug self => _1;
         scope 2 (inlined Vec::<u8>::as_slice) {
             debug self => _1;
-            let mut _7: *const u8;
-            let mut _8: usize;
+            let mut _3: *const u8;
+            let mut _4: usize;
             scope 3 (inlined Vec::<u8>::as_ptr) {
                 debug self => _1;
-                let mut _6: *mut u8;
                 scope 4 (inlined alloc::raw_vec::RawVec::<u8>::ptr) {
                     scope 5 (inlined alloc::raw_vec::RawVecInner::ptr::<u8>) {
-                        let mut _5: std::ptr::NonNull<u8>;
                         scope 6 (inlined alloc::raw_vec::RawVecInner::non_null::<u8>) {
                             let mut _2: std::ptr::NonNull<u8>;
                             scope 7 (inlined Unique::<u8>::cast::<u8>) {
                                 scope 8 (inlined NonNull::<u8>::cast::<u8>) {
-                                    let mut _3: *mut u8;
-                                    let mut _4: *const u8;
                                     scope 9 (inlined NonNull::<u8>::as_ptr) {
                                     }
                                 }
@@ -34,9 +30,9 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] {
                 }
             }
             scope 12 (inlined std::slice::from_raw_parts::<'_, u8>) {
-                debug data => _7;
-                debug len => _8;
-                let _9: *const [u8];
+                debug data => _3;
+                debug len => _4;
+                let _5: *const [u8];
                 scope 13 (inlined core::ub_checks::check_language_ub) {
                     scope 14 (inlined core::ub_checks::check_language_ub::runtime) {
                     }
@@ -46,10 +42,10 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] {
                 scope 16 (inlined align_of::<u8>) {
                 }
                 scope 17 (inlined slice_from_raw_parts::<u8>) {
-                    debug data => _7;
-                    debug len => _8;
+                    debug data => _3;
+                    debug len => _4;
                     scope 18 (inlined std::ptr::from_raw_parts::<[u8], u8>) {
-                        debug data_pointer => _7;
+                        debug data_pointer => _3;
                     }
                 }
             }
@@ -57,31 +53,19 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] {
     }
 
     bb0: {
-        StorageLive(_6);
-        StorageLive(_7);
-        StorageLive(_5);
         StorageLive(_2);
-        _2 = copy (((((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>);
         StorageLive(_3);
+        _2 = copy (((((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>);
+        _3 = copy _2 as *const u8 (Transmute);
         StorageLive(_4);
-        _3 = copy _2 as *mut u8 (Transmute);
-        _4 = copy _3 as *const u8 (PtrToPtr);
-        _5 = NonNull::<u8> { pointer: move _4 };
+        _4 = copy ((*_1).1: usize);
+        StorageLive(_5);
+        _5 = *const [u8] from (copy _3, copy _4);
+        _0 = &(*_5);
+        StorageDead(_5);
         StorageDead(_4);
         StorageDead(_3);
         StorageDead(_2);
-        _6 = copy _5 as *mut u8 (Transmute);
-        StorageDead(_5);
-        _7 = copy _6 as *const u8 (PtrToPtr);
-        StorageLive(_8);
-        _8 = copy ((*_1).1: usize);
-        StorageLive(_9);
-        _9 = *const [u8] from (copy _7, copy _8);
-        _0 = &(*_9);
-        StorageDead(_9);
-        StorageDead(_8);
-        StorageDead(_7);
-        StorageDead(_6);
         return;
     }
 }
diff --git a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir
index 3f0d60b46f4..927deabd253 100644
--- a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir
@@ -7,20 +7,16 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] {
         debug self => _1;
         scope 2 (inlined Vec::<u8>::as_slice) {
             debug self => _1;
-            let mut _7: *const u8;
-            let mut _8: usize;
+            let mut _3: *const u8;
+            let mut _4: usize;
             scope 3 (inlined Vec::<u8>::as_ptr) {
                 debug self => _1;
-                let mut _6: *mut u8;
                 scope 4 (inlined alloc::raw_vec::RawVec::<u8>::ptr) {
                     scope 5 (inlined alloc::raw_vec::RawVecInner::ptr::<u8>) {
-                        let mut _5: std::ptr::NonNull<u8>;
                         scope 6 (inlined alloc::raw_vec::RawVecInner::non_null::<u8>) {
                             let mut _2: std::ptr::NonNull<u8>;
                             scope 7 (inlined Unique::<u8>::cast::<u8>) {
                                 scope 8 (inlined NonNull::<u8>::cast::<u8>) {
-                                    let mut _3: *mut u8;
-                                    let mut _4: *const u8;
                                     scope 9 (inlined NonNull::<u8>::as_ptr) {
                                     }
                                 }
@@ -34,9 +30,9 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] {
                 }
             }
             scope 12 (inlined std::slice::from_raw_parts::<'_, u8>) {
-                debug data => _7;
-                debug len => _8;
-                let _9: *const [u8];
+                debug data => _3;
+                debug len => _4;
+                let _5: *const [u8];
                 scope 13 (inlined core::ub_checks::check_language_ub) {
                     scope 14 (inlined core::ub_checks::check_language_ub::runtime) {
                     }
@@ -46,10 +42,10 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] {
                 scope 16 (inlined align_of::<u8>) {
                 }
                 scope 17 (inlined slice_from_raw_parts::<u8>) {
-                    debug data => _7;
-                    debug len => _8;
+                    debug data => _3;
+                    debug len => _4;
                     scope 18 (inlined std::ptr::from_raw_parts::<[u8], u8>) {
-                        debug data_pointer => _7;
+                        debug data_pointer => _3;
                     }
                 }
             }
@@ -57,31 +53,19 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] {
     }
 
     bb0: {
-        StorageLive(_6);
-        StorageLive(_7);
-        StorageLive(_5);
         StorageLive(_2);
-        _2 = copy (((((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>);
         StorageLive(_3);
+        _2 = copy (((((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>);
+        _3 = copy _2 as *const u8 (Transmute);
         StorageLive(_4);
-        _3 = copy _2 as *mut u8 (Transmute);
-        _4 = copy _3 as *const u8 (PtrToPtr);
-        _5 = NonNull::<u8> { pointer: move _4 };
+        _4 = copy ((*_1).1: usize);
+        StorageLive(_5);
+        _5 = *const [u8] from (copy _3, copy _4);
+        _0 = &(*_5);
+        StorageDead(_5);
         StorageDead(_4);
         StorageDead(_3);
         StorageDead(_2);
-        _6 = copy _5 as *mut u8 (Transmute);
-        StorageDead(_5);
-        _7 = copy _6 as *const u8 (PtrToPtr);
-        StorageLive(_8);
-        _8 = copy ((*_1).1: usize);
-        StorageLive(_9);
-        _9 = *const [u8] from (copy _7, copy _8);
-        _0 = &(*_9);
-        StorageDead(_9);
-        StorageDead(_8);
-        StorageDead(_7);
-        StorageDead(_6);
         return;
     }
 }
diff --git a/tests/mir-opt/remove_zsts.get_union.PreCodegen.after.mir b/tests/mir-opt/remove_zsts.get_union.PreCodegen.after.mir
deleted file mode 100644
index 5886a5bfeea..00000000000
--- a/tests/mir-opt/remove_zsts.get_union.PreCodegen.after.mir
+++ /dev/null
@@ -1,10 +0,0 @@
-// MIR for `get_union` after PreCodegen
-
-fn get_union() -> Foo {
-    let mut _0: Foo;
-
-    bb0: {
-        _0 = Foo { x: const () };
-        return;
-    }
-}
diff --git a/tests/mir-opt/remove_zsts.remove_generic_array.RemoveZsts.diff b/tests/mir-opt/remove_zsts.remove_generic_array.RemoveZsts.diff
new file mode 100644
index 00000000000..2ac944a6c6b
--- /dev/null
+++ b/tests/mir-opt/remove_zsts.remove_generic_array.RemoveZsts.diff
@@ -0,0 +1,44 @@
+- // MIR for `remove_generic_array` before RemoveZsts
++ // MIR for `remove_generic_array` after RemoveZsts
+  
+  fn remove_generic_array(_1: T) -> () {
+      debug x => _1;
+      let mut _0: ();
+      let _2: [T; 0];
+      let mut _3: T;
+      let mut _5: T;
+      scope 1 {
+-         debug a => _2;
++         debug a => const ZeroSized: [T; 0];
+          let _4: [T; 0];
+          scope 2 {
+-             debug b => _4;
++             debug b => const ZeroSized: [T; 0];
+          }
+      }
+  
+      bb0: {
+-         StorageLive(_2);
++         nop;
+          StorageLive(_3);
+          _3 = copy _1;
+-         _2 = [];
++         nop;
+          StorageDead(_3);
+-         StorageLive(_4);
++         nop;
+          StorageLive(_5);
+          _5 = copy _1;
+-         _4 = [];
++         nop;
+          StorageDead(_5);
+-         _0 = const ();
+-         StorageDead(_4);
+-         StorageDead(_2);
++         nop;
++         nop;
++         nop;
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/remove_zsts.rs b/tests/mir-opt/remove_zsts.rs
index e33a272fe16..baf9d8ece26 100644
--- a/tests/mir-opt/remove_zsts.rs
+++ b/tests/mir-opt/remove_zsts.rs
@@ -1,15 +1,30 @@
-// skip-filecheck
+//@ test-mir-pass: RemoveZsts
+
 union Foo {
     x: (),
     y: u64,
 }
 
 // EMIT_MIR remove_zsts.get_union.RemoveZsts.diff
-// EMIT_MIR remove_zsts.get_union.PreCodegen.after.mir
 fn get_union() -> Foo {
+    // CHECK-LABEL: fn get_union
+    // CHECK: _0 = Foo { x: const () };
     Foo { x: () }
 }
 
+const MYSTERY: usize = 280_usize.isqrt() - 260_usize.isqrt();
+
+// EMIT_MIR remove_zsts.remove_generic_array.RemoveZsts.diff
+fn remove_generic_array<T: Copy>(x: T) {
+    // CHECK-LABEL: fn remove_generic_array
+    // CHECK: debug a => const ZeroSized: [T; 0];
+    // CHECK: debug b => const ZeroSized: [T; 0];
+    // CHECK-NOT: = [];
+    // CHECK-NOT: ; 1]
+    let a = [x; 0];
+    let b = [x; MYSTERY];
+}
+
 fn main() {
     get_union();
 }
diff --git a/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-abort.mir b/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-abort.mir
index e9bbe30bd77..ee6e16d20fd 100644
--- a/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-abort.mir
+++ b/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-abort.mir
@@ -74,6 +74,7 @@ fn method_1(_1: Guard) -> () {
 
     bb7: {
         backward incompatible drop(_2);
+        backward incompatible drop(_4);
         backward incompatible drop(_5);
         goto -> bb21;
     }
diff --git a/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-unwind.mir b/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-unwind.mir
index e9bbe30bd77..ee6e16d20fd 100644
--- a/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-unwind.mir
+++ b/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-unwind.mir
@@ -74,6 +74,7 @@ fn method_1(_1: Guard) -> () {
 
     bb7: {
         backward incompatible drop(_2);
+        backward incompatible drop(_4);
         backward incompatible drop(_5);
         goto -> bb21;
     }
diff --git a/tests/rustdoc-json/reexport/simple_private.rs b/tests/rustdoc-json/reexport/simple_private.rs
index 8a936f5da1b..405d57d342e 100644
--- a/tests/rustdoc-json/reexport/simple_private.rs
+++ b/tests/rustdoc-json/reexport/simple_private.rs
@@ -12,3 +12,9 @@ mod inner {
 pub use inner::Public;
 
 //@ ismany "$.index[*][?(@.name=='simple_private')].inner.module.items[*]" $use_id
+
+// Test for https://github.com/rust-lang/rust/issues/135309
+//@ has  "$.paths[*][?(@.kind=='module')].path" '["simple_private"]'
+//@ !has "$.paths[*].path"                      '["simple_private", "inner"]'
+//@ has  "$.paths[*][?(@.kind=='struct')].path" '["simple_private", "inner", "Public"]'
+//@ !has "$.paths[*].path"                      '["simple_private", "Public"]'
diff --git a/tests/rustdoc-json/reexport/simple_public.rs b/tests/rustdoc-json/reexport/simple_public.rs
index e5a8dc7d2ad..f1335828314 100644
--- a/tests/rustdoc-json/reexport/simple_public.rs
+++ b/tests/rustdoc-json/reexport/simple_public.rs
@@ -14,3 +14,8 @@ pub mod inner {
 pub use inner::Public;
 
 //@ ismany "$.index[*][?(@.name=='simple_public')].inner.module.items[*]" $import_id $inner_id
+
+//@ has  "$.paths[*][?(@.kind=='module')].path" '["simple_public"]'
+//@ has  "$.paths[*][?(@.kind=='module')].path" '["simple_public", "inner"]'
+//@ has  "$.paths[*][?(@.kind=='struct')].path" '["simple_public", "inner", "Public"]'
+//@ !has "$.paths[*].path"                      '["simple_public", "Public"]'
diff --git a/tests/rustdoc-ui/crate-reference-in-block-module.stderr b/tests/rustdoc-ui/crate-reference-in-block-module.stderr
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/tests/rustdoc-ui/crate-reference-in-block-module.stderr
+++ /dev/null
diff --git a/tests/rustdoc-ui/macro-docs.stdout b/tests/rustdoc-ui/macro-docs.stdout
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/tests/rustdoc-ui/macro-docs.stdout
+++ /dev/null
diff --git a/tests/rustdoc/inline_local/staged-inline.rs b/tests/rustdoc/inline_local/staged-inline.rs
new file mode 100644
index 00000000000..f2131ad5f94
--- /dev/null
+++ b/tests/rustdoc/inline_local/staged-inline.rs
@@ -0,0 +1,18 @@
+// https://github.com/rust-lang/rust/issues/135078
+#![crate_name = "foo"]
+#![feature(staged_api)]
+#![stable(feature = "v1", since="1.0.0")]
+
+#[stable(feature = "v1", since="1.0.0")]
+pub mod ffi {
+    #[stable(feature = "core_ffi", since="1.99.0")]
+    //@ has "foo/ffi/struct.CStr.html" "//span[@class='sub-heading']/span[@class='since']" "1.99.0"
+    //@ !has - "//span[@class='sub-heading']/span[@class='since']" "1.0.0"
+    pub struct CStr;
+}
+
+#[stable(feature = "v1", since = "1.0.0")]
+#[doc(inline)]
+//@ has "foo/struct.CStr.html" "//span[@class='sub-heading']/span[@class='since']" "1.0.0"
+//@ !has - "//span[@class='sub-heading']/span[@class='since']" "1.99.0"
+pub use ffi::CStr;
diff --git a/tests/ui/abi/c-zst.aarch64-darwin.stderr b/tests/ui/abi/c-zst.aarch64-darwin.stderr
index 7d384bc875f..d9742612bcf 100644
--- a/tests/ui/abi/c-zst.aarch64-darwin.stderr
+++ b/tests/ui/abi/c-zst.aarch64-darwin.stderr
@@ -22,6 +22,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
                            },
                            max_repr_align: None,
                            unadjusted_abi_align: $SOME_ALIGN,
+                           randomization_seed: 0,
                        },
                    },
                    mode: Ignore,
@@ -49,6 +50,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: $SOME_ALIGN,
+                       randomization_seed: 0,
                    },
                },
                mode: Ignore,
diff --git a/tests/ui/abi/c-zst.powerpc-linux.stderr b/tests/ui/abi/c-zst.powerpc-linux.stderr
index 7980710bab6..0e98b5f806b 100644
--- a/tests/ui/abi/c-zst.powerpc-linux.stderr
+++ b/tests/ui/abi/c-zst.powerpc-linux.stderr
@@ -22,6 +22,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
                            },
                            max_repr_align: None,
                            unadjusted_abi_align: $SOME_ALIGN,
+                           randomization_seed: 0,
                        },
                    },
                    mode: Indirect {
@@ -60,6 +61,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: $SOME_ALIGN,
+                       randomization_seed: 0,
                    },
                },
                mode: Ignore,
diff --git a/tests/ui/abi/c-zst.s390x-linux.stderr b/tests/ui/abi/c-zst.s390x-linux.stderr
index 7980710bab6..0e98b5f806b 100644
--- a/tests/ui/abi/c-zst.s390x-linux.stderr
+++ b/tests/ui/abi/c-zst.s390x-linux.stderr
@@ -22,6 +22,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
                            },
                            max_repr_align: None,
                            unadjusted_abi_align: $SOME_ALIGN,
+                           randomization_seed: 0,
                        },
                    },
                    mode: Indirect {
@@ -60,6 +61,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: $SOME_ALIGN,
+                       randomization_seed: 0,
                    },
                },
                mode: Ignore,
diff --git a/tests/ui/abi/c-zst.sparc64-linux.stderr b/tests/ui/abi/c-zst.sparc64-linux.stderr
index 7980710bab6..0e98b5f806b 100644
--- a/tests/ui/abi/c-zst.sparc64-linux.stderr
+++ b/tests/ui/abi/c-zst.sparc64-linux.stderr
@@ -22,6 +22,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
                            },
                            max_repr_align: None,
                            unadjusted_abi_align: $SOME_ALIGN,
+                           randomization_seed: 0,
                        },
                    },
                    mode: Indirect {
@@ -60,6 +61,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: $SOME_ALIGN,
+                       randomization_seed: 0,
                    },
                },
                mode: Ignore,
diff --git a/tests/ui/abi/c-zst.x86_64-linux.stderr b/tests/ui/abi/c-zst.x86_64-linux.stderr
index 7d384bc875f..d9742612bcf 100644
--- a/tests/ui/abi/c-zst.x86_64-linux.stderr
+++ b/tests/ui/abi/c-zst.x86_64-linux.stderr
@@ -22,6 +22,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
                            },
                            max_repr_align: None,
                            unadjusted_abi_align: $SOME_ALIGN,
+                           randomization_seed: 0,
                        },
                    },
                    mode: Ignore,
@@ -49,6 +50,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: $SOME_ALIGN,
+                       randomization_seed: 0,
                    },
                },
                mode: Ignore,
diff --git a/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr b/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr
index 7980710bab6..0e98b5f806b 100644
--- a/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr
+++ b/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr
@@ -22,6 +22,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
                            },
                            max_repr_align: None,
                            unadjusted_abi_align: $SOME_ALIGN,
+                           randomization_seed: 0,
                        },
                    },
                    mode: Indirect {
@@ -60,6 +61,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: $SOME_ALIGN,
+                       randomization_seed: 0,
                    },
                },
                mode: Ignore,
diff --git a/tests/ui/abi/debug.rs b/tests/ui/abi/debug.rs
index 565743bf978..6dbc3161464 100644
--- a/tests/ui/abi/debug.rs
+++ b/tests/ui/abi/debug.rs
@@ -1,4 +1,5 @@
 //@ normalize-stderr: "(abi|pref|unadjusted_abi_align): Align\([1-8] bytes\)" -> "$1: $$SOME_ALIGN"
+//@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED"
 //@ normalize-stderr: "(size): Size\([48] bytes\)" -> "$1: $$SOME_SIZE"
 //@ normalize-stderr: "(can_unwind): (true|false)" -> "$1: $$SOME_BOOL"
 //@ normalize-stderr: "(valid_range): 0\.\.=(4294967295|18446744073709551615)" -> "$1: $$FULL"
diff --git a/tests/ui/abi/debug.stderr b/tests/ui/abi/debug.stderr
index aa51c42c58d..e550e5bfcf3 100644
--- a/tests/ui/abi/debug.stderr
+++ b/tests/ui/abi/debug.stderr
@@ -25,6 +25,7 @@ error: fn_abi_of(test) = FnAbi {
                            },
                            max_repr_align: None,
                            unadjusted_abi_align: $SOME_ALIGN,
+                           randomization_seed: $SEED,
                        },
                    },
                    mode: Direct(
@@ -71,6 +72,7 @@ error: fn_abi_of(test) = FnAbi {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: $SOME_ALIGN,
+                       randomization_seed: $SEED,
                    },
                },
                mode: Direct(
@@ -87,7 +89,7 @@ error: fn_abi_of(test) = FnAbi {
            conv: Rust,
            can_unwind: $SOME_BOOL,
        }
-  --> $DIR/debug.rs:15:1
+  --> $DIR/debug.rs:16:1
    |
 LL | fn test(_x: u8) -> bool { true }
    | ^^^^^^^^^^^^^^^^^^^^^^^
@@ -128,6 +130,7 @@ error: fn_abi_of(TestFnPtr) = FnAbi {
                            },
                            max_repr_align: None,
                            unadjusted_abi_align: $SOME_ALIGN,
+                           randomization_seed: $SEED,
                        },
                    },
                    mode: Direct(
@@ -165,6 +168,7 @@ error: fn_abi_of(TestFnPtr) = FnAbi {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: $SOME_ALIGN,
+                       randomization_seed: $SEED,
                    },
                },
                mode: Direct(
@@ -181,7 +185,7 @@ error: fn_abi_of(TestFnPtr) = FnAbi {
            conv: Rust,
            can_unwind: $SOME_BOOL,
        }
-  --> $DIR/debug.rs:18:1
+  --> $DIR/debug.rs:19:1
    |
 LL | type TestFnPtr = fn(bool) -> u8;
    | ^^^^^^^^^^^^^^
@@ -214,6 +218,7 @@ error: fn_abi_of(test_generic) = FnAbi {
                            },
                            max_repr_align: None,
                            unadjusted_abi_align: $SOME_ALIGN,
+                           randomization_seed: $SEED,
                        },
                    },
                    mode: Direct(
@@ -248,6 +253,7 @@ error: fn_abi_of(test_generic) = FnAbi {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: $SOME_ALIGN,
+                       randomization_seed: $SEED,
                    },
                },
                mode: Ignore,
@@ -257,13 +263,13 @@ error: fn_abi_of(test_generic) = FnAbi {
            conv: Rust,
            can_unwind: $SOME_BOOL,
        }
-  --> $DIR/debug.rs:21:1
+  --> $DIR/debug.rs:22: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
+  --> $DIR/debug.rs:25:1
    |
 LL | const C: () = ();
    | ^^^^^^^^^^^
@@ -296,6 +302,7 @@ error: ABIs are not compatible
                            },
                            max_repr_align: None,
                            unadjusted_abi_align: $SOME_ALIGN,
+                           randomization_seed: $SEED,
                        },
                    },
                    mode: Direct(
@@ -330,6 +337,7 @@ error: ABIs are not compatible
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: $SOME_ALIGN,
+                       randomization_seed: $SEED,
                    },
                },
                mode: Ignore,
@@ -366,6 +374,7 @@ error: ABIs are not compatible
                            },
                            max_repr_align: None,
                            unadjusted_abi_align: $SOME_ALIGN,
+                           randomization_seed: $SEED,
                        },
                    },
                    mode: Direct(
@@ -400,6 +409,7 @@ error: ABIs are not compatible
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: $SOME_ALIGN,
+                       randomization_seed: $SEED,
                    },
                },
                mode: Ignore,
@@ -409,7 +419,7 @@ error: ABIs are not compatible
            conv: Rust,
            can_unwind: $SOME_BOOL,
        }
-  --> $DIR/debug.rs:40:1
+  --> $DIR/debug.rs:41:1
    |
 LL | type TestAbiNe = (fn(u8), fn(u32));
    | ^^^^^^^^^^^^^^
@@ -439,6 +449,7 @@ error: ABIs are not compatible
                            },
                            max_repr_align: None,
                            unadjusted_abi_align: $SOME_ALIGN,
+                           randomization_seed: $SEED,
                        },
                    },
                    mode: Indirect {
@@ -477,6 +488,7 @@ error: ABIs are not compatible
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: $SOME_ALIGN,
+                       randomization_seed: $SEED,
                    },
                },
                mode: Ignore,
@@ -510,6 +522,7 @@ error: ABIs are not compatible
                            },
                            max_repr_align: None,
                            unadjusted_abi_align: $SOME_ALIGN,
+                           randomization_seed: $SEED,
                        },
                    },
                    mode: Indirect {
@@ -548,6 +561,7 @@ error: ABIs are not compatible
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: $SOME_ALIGN,
+                       randomization_seed: $SEED,
                    },
                },
                mode: Ignore,
@@ -557,7 +571,7 @@ error: ABIs are not compatible
            conv: Rust,
            can_unwind: $SOME_BOOL,
        }
-  --> $DIR/debug.rs:43:1
+  --> $DIR/debug.rs:44:1
    |
 LL | type TestAbiNeLarger = (fn([u8; 32]), fn([u32; 32]));
    | ^^^^^^^^^^^^^^^^^^^^
@@ -589,6 +603,7 @@ error: ABIs are not compatible
                            },
                            max_repr_align: None,
                            unadjusted_abi_align: $SOME_ALIGN,
+                           randomization_seed: $SEED,
                        },
                    },
                    mode: Direct(
@@ -623,6 +638,7 @@ error: ABIs are not compatible
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: $SOME_ALIGN,
+                       randomization_seed: $SEED,
                    },
                },
                mode: Ignore,
@@ -659,6 +675,7 @@ error: ABIs are not compatible
                            },
                            max_repr_align: None,
                            unadjusted_abi_align: $SOME_ALIGN,
+                           randomization_seed: $SEED,
                        },
                    },
                    mode: Direct(
@@ -693,6 +710,7 @@ error: ABIs are not compatible
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: $SOME_ALIGN,
+                       randomization_seed: $SEED,
                    },
                },
                mode: Ignore,
@@ -702,7 +720,7 @@ error: ABIs are not compatible
            conv: Rust,
            can_unwind: $SOME_BOOL,
        }
-  --> $DIR/debug.rs:46:1
+  --> $DIR/debug.rs:47:1
    |
 LL | type TestAbiNeFloat = (fn(f32), fn(u32));
    | ^^^^^^^^^^^^^^^^^^^
@@ -735,6 +753,7 @@ error: ABIs are not compatible
                            },
                            max_repr_align: None,
                            unadjusted_abi_align: $SOME_ALIGN,
+                           randomization_seed: $SEED,
                        },
                    },
                    mode: Direct(
@@ -769,6 +788,7 @@ error: ABIs are not compatible
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: $SOME_ALIGN,
+                       randomization_seed: $SEED,
                    },
                },
                mode: Ignore,
@@ -805,6 +825,7 @@ error: ABIs are not compatible
                            },
                            max_repr_align: None,
                            unadjusted_abi_align: $SOME_ALIGN,
+                           randomization_seed: $SEED,
                        },
                    },
                    mode: Direct(
@@ -839,6 +860,7 @@ error: ABIs are not compatible
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: $SOME_ALIGN,
+                       randomization_seed: $SEED,
                    },
                },
                mode: Ignore,
@@ -848,13 +870,13 @@ error: ABIs are not compatible
            conv: Rust,
            can_unwind: $SOME_BOOL,
        }
-  --> $DIR/debug.rs:50:1
+  --> $DIR/debug.rs:51: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
+  --> $DIR/debug.rs:54:46
    |
 LL | type TestAbiEqNonsense = (fn((str, str)), fn((str, str)));
    |                                              ^^^^^^^^^^ doesn't have a size known at compile-time
@@ -863,7 +885,7 @@ LL | type TestAbiEqNonsense = (fn((str, str)), fn((str, 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
+  --> $DIR/debug.rs:29:5
    |
 LL |     const C: () = ();
    |     ^^^^^^^^^^^
@@ -906,6 +928,7 @@ error: fn_abi_of(assoc_test) = FnAbi {
                            },
                            max_repr_align: None,
                            unadjusted_abi_align: $SOME_ALIGN,
+                           randomization_seed: $SEED,
                        },
                    },
                    mode: Direct(
@@ -942,6 +965,7 @@ error: fn_abi_of(assoc_test) = FnAbi {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: $SOME_ALIGN,
+                       randomization_seed: $SEED,
                    },
                },
                mode: Ignore,
@@ -951,7 +975,7 @@ error: fn_abi_of(assoc_test) = FnAbi {
            conv: Rust,
            can_unwind: $SOME_BOOL,
        }
-  --> $DIR/debug.rs:33:5
+  --> $DIR/debug.rs:34:5
    |
 LL |     fn assoc_test(&self) { }
    |     ^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/abi/sysv64-zst.stderr b/tests/ui/abi/sysv64-zst.stderr
index 8e1791e27d2..781e9b2f4c9 100644
--- a/tests/ui/abi/sysv64-zst.stderr
+++ b/tests/ui/abi/sysv64-zst.stderr
@@ -22,6 +22,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
                            },
                            max_repr_align: None,
                            unadjusted_abi_align: $SOME_ALIGN,
+                           randomization_seed: 0,
                        },
                    },
                    mode: Ignore,
@@ -49,6 +50,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: $SOME_ALIGN,
+                       randomization_seed: 0,
                    },
                },
                mode: Ignore,
diff --git a/tests/ui/abi/win64-zst.x86_64-linux.stderr b/tests/ui/abi/win64-zst.x86_64-linux.stderr
index 76d90670eb1..a28a59fdd8d 100644
--- a/tests/ui/abi/win64-zst.x86_64-linux.stderr
+++ b/tests/ui/abi/win64-zst.x86_64-linux.stderr
@@ -22,6 +22,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
                            },
                            max_repr_align: None,
                            unadjusted_abi_align: $SOME_ALIGN,
+                           randomization_seed: 0,
                        },
                    },
                    mode: Ignore,
@@ -49,6 +50,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: $SOME_ALIGN,
+                       randomization_seed: 0,
                    },
                },
                mode: Ignore,
diff --git a/tests/ui/abi/win64-zst.x86_64-windows-gnu.stderr b/tests/ui/abi/win64-zst.x86_64-windows-gnu.stderr
index 7ee90e24744..cf0cc00c5ed 100644
--- a/tests/ui/abi/win64-zst.x86_64-windows-gnu.stderr
+++ b/tests/ui/abi/win64-zst.x86_64-windows-gnu.stderr
@@ -22,6 +22,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
                            },
                            max_repr_align: None,
                            unadjusted_abi_align: $SOME_ALIGN,
+                           randomization_seed: 0,
                        },
                    },
                    mode: Indirect {
@@ -60,6 +61,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: $SOME_ALIGN,
+                       randomization_seed: 0,
                    },
                },
                mode: Ignore,
diff --git a/tests/ui/abi/win64-zst.x86_64-windows-msvc.stderr b/tests/ui/abi/win64-zst.x86_64-windows-msvc.stderr
index 76d90670eb1..a28a59fdd8d 100644
--- a/tests/ui/abi/win64-zst.x86_64-windows-msvc.stderr
+++ b/tests/ui/abi/win64-zst.x86_64-windows-msvc.stderr
@@ -22,6 +22,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
                            },
                            max_repr_align: None,
                            unadjusted_abi_align: $SOME_ALIGN,
+                           randomization_seed: 0,
                        },
                    },
                    mode: Ignore,
@@ -49,6 +50,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: $SOME_ALIGN,
+                       randomization_seed: 0,
                    },
                },
                mode: Ignore,
diff --git a/tests/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.stderr b/tests/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.stderr
index e12d42e5ed0..42d83fca6ca 100644
--- a/tests/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.stderr
+++ b/tests/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.stderr
@@ -7,9 +7,9 @@ LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
    |        lifetime `'a` defined here
 ...
 LL |     let z: I::A = if cond { x } else { y };
-   |                             ^ assignment requires that `'a` must outlive `'b`
+   |                             ^ assignment requires that `'b` must outlive `'a`
    |
-   = help: consider adding the following bound: `'a: 'b`
+   = help: consider adding the following bound: `'b: 'a`
 
 error: lifetime may not live long enough
   --> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:22:40
@@ -20,9 +20,9 @@ LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
    |        lifetime `'a` defined here
 ...
 LL |     let z: I::A = if cond { x } else { y };
-   |                                        ^ assignment requires that `'b` must outlive `'a`
+   |                                        ^ assignment requires that `'a` must outlive `'b`
    |
-   = help: consider adding the following bound: `'b: 'a`
+   = help: consider adding the following bound: `'a: 'b`
 
 help: `'a` and `'b` must be the same: replace one with the other
 
diff --git a/tests/ui/associated-types/cache/project-fn-ret-invariant.oneuse.stderr b/tests/ui/associated-types/cache/project-fn-ret-invariant.oneuse.stderr
index 77841780f62..3ef6b85c407 100644
--- a/tests/ui/associated-types/cache/project-fn-ret-invariant.oneuse.stderr
+++ b/tests/ui/associated-types/cache/project-fn-ret-invariant.oneuse.stderr
@@ -7,9 +7,9 @@ LL | fn baz<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
    |        lifetime `'a` defined here
 LL |     let f = foo; // <-- No consistent type can be inferred for `f` here.
 LL |     let a = bar(f, x);
-   |             ^^^^^^^^^ argument requires that `'a` must outlive `'b`
+   |             ^^^^^^^^^ argument requires that `'b` must outlive `'a`
    |
-   = help: consider adding the following bound: `'a: 'b`
+   = help: consider adding the following bound: `'b: 'a`
    = note: requirement occurs because of the type `Type<'_>`, which makes the generic argument `'_` invariant
    = note: the struct `Type<'a>` is invariant over the parameter `'a`
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
@@ -23,9 +23,9 @@ LL | fn baz<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
    |        lifetime `'a` defined here
 ...
 LL |     let b = bar(f, y);
-   |             ^^^^^^^^^ argument requires that `'b` must outlive `'a`
+   |             ^^^^^^^^^ argument requires that `'a` must outlive `'b`
    |
-   = help: consider adding the following bound: `'b: 'a`
+   = help: consider adding the following bound: `'a: 'b`
    = note: requirement occurs because of the type `Type<'_>`, which makes the generic argument `'_` invariant
    = note: the struct `Type<'a>` is invariant over the parameter `'a`
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
diff --git a/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr b/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr
index be39dbf313b..329cec6dad3 100644
--- a/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr
+++ b/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr
@@ -7,7 +7,7 @@ LL |     let c = async || { println!("{}", *x); };
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ borrowed value does not live long enough
 LL |     outlives::<'a>(c());
 LL |     outlives::<'a>(call_once(c));
-   |                    ------------ argument requires that `x` is borrowed for `'a`
+   |     ---------------------------- argument requires that `x` is borrowed for `'a`
 ...
 LL | }
    |  - `x` dropped here while still borrowed
@@ -21,10 +21,10 @@ LL | fn simple<'a>(x: &'a i32) {
 LL |     let c = async move || { println!("{}", *x); };
    |         - binding `c` declared here
 LL |     outlives::<'a>(c());
-   |                    ^--
-   |                    |
-   |                    borrowed value does not live long enough
-   |                    argument requires that `c` is borrowed for `'a`
+   |     ---------------^---
+   |     |              |
+   |     |              borrowed value does not live long enough
+   |     argument requires that `c` is borrowed for `'a`
 LL |     outlives::<'a>(call_once(c));
 LL | }
    | - `c` dropped here while still borrowed
@@ -38,7 +38,7 @@ LL |     let c = async || { println!("{}", *x.0); };
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ borrowed value does not live long enough
 LL |     outlives::<'a>(c());
 LL |     outlives::<'a>(call_once(c));
-   |                    ------------ argument requires that `x` is borrowed for `'a`
+   |     ---------------------------- argument requires that `x` is borrowed for `'a`
 ...
 LL | }
    |  - `x` dropped here while still borrowed
@@ -52,7 +52,7 @@ LL |     let c = async || { println!("{}", *x.0); };
    |             ---------------------------------- borrow of `x` occurs here
 LL |     outlives::<'a>(c());
 LL |     outlives::<'a>(call_once(c));
-   |                    ------------ argument requires that `x` is borrowed for `'a`
+   |     ---------------------------- argument requires that `x` is borrowed for `'a`
 LL |
 LL |     let c = async move || { println!("{}", *x.0); };
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ move out of `x` occurs here
@@ -66,10 +66,10 @@ LL | fn through_field<'a>(x: S<'a>) {
 LL |     let c = async move || { println!("{}", *x.0); };
    |         - binding `c` declared here
 LL |     outlives::<'a>(c());
-   |                    ^--
-   |                    |
-   |                    borrowed value does not live long enough
-   |                    argument requires that `c` is borrowed for `'a`
+   |     ---------------^---
+   |     |              |
+   |     |              borrowed value does not live long enough
+   |     argument requires that `c` is borrowed for `'a`
 LL |     outlives::<'a>(call_once(c));
 LL | }
    | - `c` dropped here while still borrowed
@@ -83,10 +83,10 @@ LL | fn through_field<'a>(x: S<'a>) {
 LL |     let c = async move || { println!("{}", *x.0); };
    |         - binding `c` declared here
 LL |     outlives::<'a>(c());
-   |                    ---
-   |                    |
-   |                    borrow of `c` occurs here
-   |                    argument requires that `c` is borrowed for `'a`
+   |     -------------------
+   |     |              |
+   |     |              borrow of `c` occurs here
+   |     argument requires that `c` is borrowed for `'a`
 LL |     outlives::<'a>(call_once(c));
    |                              ^ move out of `c` occurs here
 
@@ -99,18 +99,18 @@ LL |     let c = async || { println!("{}", *x.0); };
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ borrowed value does not live long enough
 LL |     outlives::<'a>(c());
 LL |     outlives::<'a>(call_once(c));
-   |                    ------------ argument requires that `x` is borrowed for `'a`
+   |     ---------------------------- argument requires that `x` is borrowed for `'a`
 LL | }
    |  - `x` dropped here while still borrowed
 
 error[E0621]: explicit lifetime required in the type of `x`
-  --> $DIR/without-precise-captures-we-are-powerless.rs:38:20
+  --> $DIR/without-precise-captures-we-are-powerless.rs:38:5
    |
 LL | fn through_field_and_ref<'a>(x: &S<'a>) {
    |                                 ------ help: add explicit lifetime `'a` to the type of `x`: `&'a S<'a>`
 ...
 LL |     outlives::<'a>(call_once(c));
-   |                    ^^^^^^^^^^^^ lifetime `'a` required
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required
 
 error[E0597]: `c` does not live long enough
   --> $DIR/without-precise-captures-we-are-powerless.rs:43:20
@@ -120,22 +120,22 @@ LL | fn through_field_and_ref_move<'a>(x: &S<'a>) {
 LL |     let c = async move || { println!("{}", *x.0); };
    |         - binding `c` declared here
 LL |     outlives::<'a>(c());
-   |                    ^--
-   |                    |
-   |                    borrowed value does not live long enough
-   |                    argument requires that `c` is borrowed for `'a`
+   |     ---------------^---
+   |     |              |
+   |     |              borrowed value does not live long enough
+   |     argument requires that `c` is borrowed for `'a`
 LL |     outlives::<'a>(call_once(c));
 LL | }
    | - `c` dropped here while still borrowed
 
 error[E0621]: explicit lifetime required in the type of `x`
-  --> $DIR/without-precise-captures-we-are-powerless.rs:44:20
+  --> $DIR/without-precise-captures-we-are-powerless.rs:44:5
    |
 LL | fn through_field_and_ref_move<'a>(x: &S<'a>) {
    |                                      ------ help: add explicit lifetime `'a` to the type of `x`: `&'a S<'a>`
 ...
 LL |     outlives::<'a>(call_once(c));
-   |                    ^^^^^^^^^^^^ lifetime `'a` required
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required
 
 error: aborting due to 10 previous errors
 
diff --git a/tests/ui/async-await/issues/issue-63388-1.rs b/tests/ui/async-await/issues/issue-63388-1.rs
index a6f499ba94e..acfc64baff9 100644
--- a/tests/ui/async-await/issues/issue-63388-1.rs
+++ b/tests/ui/async-await/issues/issue-63388-1.rs
@@ -11,8 +11,8 @@ impl Xyz {
         &'a self, foo: &dyn Foo
     ) -> &dyn Foo  //~ WARNING elided lifetime has a name
     {
-        //~^ ERROR explicit lifetime required in the type of `foo` [E0621]
         foo
+        //~^ ERROR explicit lifetime required in the type of `foo` [E0621]
     }
 }
 
diff --git a/tests/ui/async-await/issues/issue-63388-1.stderr b/tests/ui/async-await/issues/issue-63388-1.stderr
index ef74bfe3237..579caa45bc9 100644
--- a/tests/ui/async-await/issues/issue-63388-1.stderr
+++ b/tests/ui/async-await/issues/issue-63388-1.stderr
@@ -10,16 +10,13 @@ LL |     ) -> &dyn Foo
    = note: `#[warn(elided_named_lifetimes)]` on by default
 
 error[E0621]: explicit lifetime required in the type of `foo`
-  --> $DIR/issue-63388-1.rs:13:5
+  --> $DIR/issue-63388-1.rs:14:9
    |
-LL |           &'a self, foo: &dyn Foo
-   |                          -------- help: add explicit lifetime `'a` to the type of `foo`: `&'a (dyn Foo + 'a)`
-LL |       ) -> &dyn Foo
-LL | /     {
-LL | |
-LL | |         foo
-LL | |     }
-   | |_____^ lifetime `'a` required
+LL |         &'a self, foo: &dyn Foo
+   |                        -------- help: add explicit lifetime `'a` to the type of `foo`: `&'a (dyn Foo + 'a)`
+...
+LL |         foo
+   |         ^^^ lifetime `'a` required
 
 error: aborting due to 1 previous error; 1 warning emitted
 
diff --git a/tests/ui/async-await/issues/issue-63388-2.rs b/tests/ui/async-await/issues/issue-63388-2.rs
index 85718f41121..8bb5cfa4a59 100644
--- a/tests/ui/async-await/issues/issue-63388-2.rs
+++ b/tests/ui/async-await/issues/issue-63388-2.rs
@@ -11,8 +11,8 @@ impl Xyz {
         foo: &dyn Foo, bar: &'a dyn Foo
     ) -> &dyn Foo //~ ERROR missing lifetime specifier
     {
-        //~^ ERROR explicit lifetime required in the type of `foo` [E0621]
         foo
+        //~^ ERROR explicit lifetime required in the type of `foo` [E0621]
     }
 }
 
diff --git a/tests/ui/async-await/issues/issue-63388-2.stderr b/tests/ui/async-await/issues/issue-63388-2.stderr
index e515f227c7e..7e3c0a1227d 100644
--- a/tests/ui/async-await/issues/issue-63388-2.stderr
+++ b/tests/ui/async-await/issues/issue-63388-2.stderr
@@ -13,16 +13,13 @@ LL |     ) -> &'a dyn Foo
    |           ++
 
 error[E0621]: explicit lifetime required in the type of `foo`
-  --> $DIR/issue-63388-2.rs:13:5
+  --> $DIR/issue-63388-2.rs:14:9
    |
-LL |           foo: &dyn Foo, bar: &'a dyn Foo
-   |                -------- help: add explicit lifetime `'a` to the type of `foo`: `&'a (dyn Foo + 'a)`
-LL |       ) -> &dyn Foo
-LL | /     {
-LL | |
-LL | |         foo
-LL | |     }
-   | |_____^ lifetime `'a` required
+LL |         foo: &dyn Foo, bar: &'a dyn Foo
+   |              -------- help: add explicit lifetime `'a` to the type of `foo`: `&'a (dyn Foo + 'a)`
+...
+LL |         foo
+   |         ^^^ lifetime `'a` required
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/borrowck/fn-item-check-type-params.stderr b/tests/ui/borrowck/fn-item-check-type-params.stderr
index 3a29edc55c5..aafb7e66ef5 100644
--- a/tests/ui/borrowck/fn-item-check-type-params.stderr
+++ b/tests/ui/borrowck/fn-item-check-type-params.stderr
@@ -12,12 +12,12 @@ LL |     extend_lt(val);
    |     argument requires that `'a` must outlive `'static`
 
 error: lifetime may not live long enough
-  --> $DIR/fn-item-check-type-params.rs:39:12
+  --> $DIR/fn-item-check-type-params.rs:39:31
    |
 LL | pub fn test_coercion<'a>() {
    |                      -- lifetime `'a` defined here
 LL |     let _: fn(&'a str) -> _ = extend_lt;
-   |            ^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
+   |                               ^^^^^^^^^ coercion requires that `'a` must outlive `'static`
 
 error[E0716]: temporary value dropped while borrowed
   --> $DIR/fn-item-check-type-params.rs:48:11
diff --git a/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr b/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr
index 13c768dcbf6..4ec4d2138db 100644
--- a/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr
+++ b/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr
@@ -15,10 +15,10 @@ LL |     async {
 LL |         let not_static = 0;
    |             ---------- binding `not_static` declared here
 LL |         force_send(async_load(&not_static));
-   |                    -----------^^^^^^^^^^^-
-   |                    |          |
-   |                    |          borrowed value does not live long enough
-   |                    argument requires that `not_static` is borrowed for `'1`
+   |         ----------------------^^^^^^^^^^^--
+   |         |                     |
+   |         |                     borrowed value does not live long enough
+   |         argument requires that `not_static` is borrowed for `'1`
 ...
 LL |     }
    |     - `not_static` dropped here while still borrowed
diff --git a/tests/ui/borrowck/issue-7573.rs b/tests/ui/borrowck/issue-7573.rs
index 7c07411533f..f94cd75ab6e 100644
--- a/tests/ui/borrowck/issue-7573.rs
+++ b/tests/ui/borrowck/issue-7573.rs
@@ -17,6 +17,8 @@ pub fn remove_package_from_database() {
         lines_to_use.push(installed_id);
         //~^ ERROR borrowed data escapes outside of closure
         //~| NOTE `installed_id` escapes the closure body here
+        //~| NOTE requirement occurs because of a mutable reference to `Vec<&CrateId>`
+        //~| NOTE mutable references are invariant over their type parameter
     };
     list_database(push_id);
 
diff --git a/tests/ui/borrowck/issue-7573.stderr b/tests/ui/borrowck/issue-7573.stderr
index 07a67474c83..d0121f4ec17 100644
--- a/tests/ui/borrowck/issue-7573.stderr
+++ b/tests/ui/borrowck/issue-7573.stderr
@@ -9,6 +9,10 @@ LL |     let push_id = |installed_id: &CrateId| {
 LL |
 LL |         lines_to_use.push(installed_id);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `installed_id` escapes the closure body here
+   |
+   = note: requirement occurs because of a mutable reference to `Vec<&CrateId>`
+   = note: mutable references are invariant over their type parameter
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr b/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr
index 89b15a7a659..4d1d7ffd293 100644
--- a/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr
+++ b/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr
@@ -71,14 +71,13 @@ error[E0502]: cannot borrow `*reg` as mutable because it is also borrowed as imm
 LL | fn register_plugins<'a>(mk_reg: impl Fn() -> &'a mut Registry<'a>) {
    |                     -- lifetime `'a` defined here
 ...
+LL |     let reg = mk_reg();
+   |               -------- assignment requires that `reg.sess_mut` is borrowed for `'a`
 LL |     reg.register_univ(Box::new(CapturePass::new(&reg.sess_mut)));
-   |     ^^^^^^^^^^^^^^^^^^-----------------------------------------^
-   |     |                 |                         |
-   |     |                 |                         immutable borrow occurs here
-   |     |                 coercion requires that `reg.sess_mut` is borrowed for `'a`
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------^^^
+   |     |                                           |
+   |     |                                           immutable borrow occurs here
    |     mutable borrow occurs here
-   |
-   = note: due to object lifetime defaults, `Box<dyn for<'b> LateLintPass<'b>>` actually means `Box<(dyn for<'b> LateLintPass<'b> + 'static)>`
 
 error[E0502]: cannot borrow `*reg` as mutable because it is also borrowed as immutable
   --> $DIR/two-phase-surprise-no-conflict.rs:144:5
@@ -115,14 +114,13 @@ error[E0499]: cannot borrow `*reg` as mutable more than once at a time
 LL | fn register_plugins<'a>(mk_reg: impl Fn() -> &'a mut Registry<'a>) {
    |                     -- lifetime `'a` defined here
 ...
+LL |     let reg = mk_reg();
+   |               -------- assignment requires that `reg.sess_mut` is borrowed for `'a`
 LL |     reg.register_univ(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
-   |     ^^^^^^^^^^^^^^^^^^-------------------------------------------------^
-   |     |                 |                             |
-   |     |                 |                             first mutable borrow occurs here
-   |     |                 coercion requires that `reg.sess_mut` is borrowed for `'a`
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------^^^
+   |     |                                               |
+   |     |                                               first mutable borrow occurs here
    |     second mutable borrow occurs here
-   |
-   = note: due to object lifetime defaults, `Box<dyn for<'b> LateLintPass<'b>>` actually means `Box<(dyn for<'b> LateLintPass<'b> + 'static)>`
 
 error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
   --> $DIR/two-phase-surprise-no-conflict.rs:158:53
diff --git a/tests/ui/c-variadic/variadic-ffi-4.stderr b/tests/ui/c-variadic/variadic-ffi-4.stderr
index c9d90d73dea..fc9f8036083 100644
--- a/tests/ui/c-variadic/variadic-ffi-4.stderr
+++ b/tests/ui/c-variadic/variadic-ffi-4.stderr
@@ -120,14 +120,14 @@ LL | }
    | - `ap1` dropped here while still borrowed
 
 error: lifetime may not live long enough
-  --> $DIR/variadic-ffi-4.rs:35:12
+  --> $DIR/variadic-ffi-4.rs:35:5
    |
 LL | pub unsafe extern "C" fn no_escape5(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) {
    |                                               -------                   ------- has type `VaListImpl<'2>`
    |                                               |
    |                                               has type `&mut VaListImpl<'1>`
 LL |     *ap0 = ap1.clone();
-   |            ^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
+   |     ^^^^ assignment requires that `'2` must outlive `'1`
    |
    = note: requirement occurs because of the type `VaListImpl<'_>`, which makes the generic argument `'_` invariant
    = note: the struct `VaListImpl<'f>` is invariant over the parameter `'f`
@@ -141,7 +141,7 @@ LL | pub unsafe extern "C" fn no_escape5(_: usize, mut ap0: &mut VaListImpl, mut
    |                                               |
    |                                               has type `&mut VaListImpl<'1>`
 LL |     *ap0 = ap1.clone();
-   |            ^^^^^^^^^^^ argument requires that `'2` must outlive `'1`
+   |            ^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
    |
    = note: requirement occurs because of the type `VaListImpl<'_>`, which makes the generic argument `'_` invariant
    = note: the struct `VaListImpl<'f>` is invariant over the parameter `'f`
diff --git a/tests/ui/cast/ptr-to-trait-obj-different-regions-misc.rs b/tests/ui/cast/ptr-to-trait-obj-different-regions-misc.rs
index 18566acc07f..f8910c944c6 100644
--- a/tests/ui/cast/ptr-to-trait-obj-different-regions-misc.rs
+++ b/tests/ui/cast/ptr-to-trait-obj-different-regions-misc.rs
@@ -42,7 +42,7 @@ fn change_assoc_1<'a, 'b>(
 // This tests the default borrow check error, without the special casing for return values.
 fn require_static(_: *const dyn Trait<'static>) {}
 fn extend_to_static<'a>(ptr: *const dyn Trait<'a>) {
-    require_static(ptr as _) //~ error: lifetime may not live long enough
+    require_static(ptr as _) //~ error: borrowed data escapes outside of function
 }
 
 fn main() {}
diff --git a/tests/ui/cast/ptr-to-trait-obj-different-regions-misc.stderr b/tests/ui/cast/ptr-to-trait-obj-different-regions-misc.stderr
index 6f590585c4a..faaa6325f34 100644
--- a/tests/ui/cast/ptr-to-trait-obj-different-regions-misc.stderr
+++ b/tests/ui/cast/ptr-to-trait-obj-different-regions-misc.stderr
@@ -154,14 +154,22 @@ help: `'b` and `'a` must be the same: replace one with the other
    |
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
-error: lifetime may not live long enough
-  --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:45:20
+error[E0521]: borrowed data escapes outside of function
+  --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:45:5
    |
 LL | fn extend_to_static<'a>(ptr: *const dyn Trait<'a>) {
-   |                     -- lifetime `'a` defined here
+   |                     --  ---
+   |                     |   |
+   |                     |   `ptr` declared here, outside of the function body
+   |                     |   `ptr` is a reference that is only valid in the function body
+   |                     lifetime `'a` defined here
 LL |     require_static(ptr as _)
-   |                    ^^^^^^^^ cast requires that `'a` must outlive `'static`
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^
+   |     |
+   |     `ptr` escapes the function body here
+   |     argument requires that `'a` must outlive `'static`
 
 error: aborting due to 11 previous errors
 
-For more information about this error, try `rustc --explain E0308`.
+Some errors have detailed explanations: E0308, E0521.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/tests/ui/coherence/auxiliary/pr_review_132289_2_lib.rs b/tests/ui/coherence/auxiliary/pr_review_132289_2_lib.rs
new file mode 100644
index 00000000000..4b79147dce1
--- /dev/null
+++ b/tests/ui/coherence/auxiliary/pr_review_132289_2_lib.rs
@@ -0,0 +1,37 @@
+pub type A = &'static [usize; 1];
+pub type B = &'static [usize; 100];
+
+pub trait Trait<P> {
+    type Assoc;
+}
+
+pub type Dyn<P> = dyn Trait<P, Assoc = A>;
+
+pub trait LocallyUnimplemented<P> {}
+
+impl<P, T: ?Sized> Trait<P> for T
+where
+    T: LocallyUnimplemented<P>,
+{
+    type Assoc = B;
+}
+
+trait MakeArray<Arr> {
+    fn make() -> &'static Arr;
+}
+impl<const N: usize> MakeArray<[usize; N]> for () {
+    fn make() -> &'static [usize; N] {
+        &[1337; N]
+    }
+}
+
+// it would be sound for this return type to be interpreted as being
+// either of A or B, if that's what a soundness fix for overlap of
+// dyn Trait's impls would entail
+
+// In this test, we check at the call-site that the interpretation
+// is consistent across crates in this specific scenario.
+pub fn function<P>() -> (<Dyn<P> as Trait<P>>::Assoc, usize) {
+    let val = <() as MakeArray<_>>::make();
+    (val, val.len())
+}
diff --git a/tests/ui/coherence/auxiliary/pr_review_132289_3_lib.rs b/tests/ui/coherence/auxiliary/pr_review_132289_3_lib.rs
new file mode 100644
index 00000000000..f90be3b2487
--- /dev/null
+++ b/tests/ui/coherence/auxiliary/pr_review_132289_3_lib.rs
@@ -0,0 +1,12 @@
+use std::ops::Index;
+
+pub trait Trait {
+    fn f(&self)
+    where
+        dyn Index<(), Output = ()>: Index<()>;
+    //  rustc (correctly) determines ^^^^^^^^ this bound to be true
+}
+
+pub fn call(x: &dyn Trait) {
+    x.f(); // so we can call `f`
+}
diff --git a/tests/ui/coherence/pr-review-132289-1.rs b/tests/ui/coherence/pr-review-132289-1.rs
new file mode 100644
index 00000000000..ab3ed9655e0
--- /dev/null
+++ b/tests/ui/coherence/pr-review-132289-1.rs
@@ -0,0 +1,52 @@
+// This is a regression test for issues that came up during review of the (closed)
+// PR #132289; this single-crate test case is
+// the first example from @steffahn during review.
+// https://github.com/rust-lang/rust/pull/132289#issuecomment-2564492153
+
+//@ check-pass
+
+type A = &'static [usize; 1];
+type B = &'static [usize; 100];
+
+type DynSomething = dyn Something<Assoc = A>;
+
+trait Super {
+    type Assoc;
+}
+impl Super for Foo {
+    type Assoc = A;
+}
+
+trait IsDynSomething {}
+impl IsDynSomething for DynSomething {}
+
+impl<T: ?Sized> Super for T
+where
+    T: IsDynSomething,
+{
+    type Assoc = B;
+}
+
+trait Something: Super {
+    fn method(&self) -> Self::Assoc;
+}
+
+struct Foo;
+impl Something for Foo {
+    fn method(&self) -> Self::Assoc {
+        &[1337]
+    }
+}
+
+fn main() {
+    let x = &Foo;
+    let y: &DynSomething = x;
+
+    // no surprises here
+    let _arr1: A = x.method();
+
+    // this (`_arr2`) can't ever become B either, soundly
+    let _arr2: A = y.method();
+    // there aren't any other arrays being defined anywhere in this
+    // test case, besides the length-1 one containing [1337]
+}
diff --git a/tests/ui/coherence/pr-review-132289-2.rs b/tests/ui/coherence/pr-review-132289-2.rs
new file mode 100644
index 00000000000..95ad86c61ff
--- /dev/null
+++ b/tests/ui/coherence/pr-review-132289-2.rs
@@ -0,0 +1,26 @@
+// This is a regression test for issues that came up during review of the (closed)
+// PR #132289; this 2-crate test case is adapted from
+// the second example from @steffahn during review.
+// https://github.com/rust-lang/rust/pull/132289#issuecomment-2564587796
+
+//@ run-pass
+//@ aux-build: pr_review_132289_2_lib.rs
+
+extern crate pr_review_132289_2_lib;
+
+use pr_review_132289_2_lib::{function, Dyn, LocallyUnimplemented};
+
+struct Param;
+
+impl LocallyUnimplemented<Param> for Dyn<Param> {}
+
+// it would be sound for `function::<Param>`'s return type to be
+// either of A or B, if that's what a soundness fix for overlap of
+// dyn Trait's impls would entail
+
+// In this test, we check at this call-site that the interpretation
+// is consistent with the function definition's body.
+fn main() {
+    let (arr, len) = function::<Param>();
+    assert_eq!(arr.len(), len);
+}
diff --git a/tests/ui/coherence/pr-review-132289-3.rs b/tests/ui/coherence/pr-review-132289-3.rs
new file mode 100644
index 00000000000..7e597baa6ec
--- /dev/null
+++ b/tests/ui/coherence/pr-review-132289-3.rs
@@ -0,0 +1,50 @@
+// This is a regression test for issues that came up during review of the (closed)
+// PR #132289; this 3-ish-crate (including std) test case is adapted from
+// the third example from @steffahn during review.
+// https://github.com/rust-lang/rust/pull/132289#issuecomment-2564599221
+
+//@ run-pass
+//@ check-run-results
+//@ aux-build: pr_review_132289_3_lib.rs
+
+extern crate pr_review_132289_3_lib;
+
+use std::ops::Index;
+
+use pr_review_132289_3_lib::{call, Trait};
+
+trait SubIndex<I>: Index<I> {}
+
+struct Param;
+
+trait Project {
+    type Ty: ?Sized;
+}
+impl Project for () {
+    type Ty = dyn SubIndex<Param, Output = ()>;
+}
+
+impl Index<Param> for <() as Project>::Ty {
+    type Output = ();
+
+    fn index(&self, _: Param) -> &() {
+        &()
+    }
+}
+
+struct Struct;
+
+impl Trait for Struct {
+    fn f(&self)
+    where
+        // higher-ranked to allow potentially-false bounds
+        for<'a> dyn Index<(), Output = ()>: Index<()>,
+        // after #132289 rustc used to believe this bound false
+    {
+        println!("hello!");
+    }
+}
+
+fn main() {
+    call(&Struct); // <- would segfault if the method `f` wasn't part of the vtable
+}
diff --git a/tests/ui/coherence/pr-review-132289-3.run.stdout b/tests/ui/coherence/pr-review-132289-3.run.stdout
new file mode 100644
index 00000000000..4effa19f4f7
--- /dev/null
+++ b/tests/ui/coherence/pr-review-132289-3.run.stdout
@@ -0,0 +1 @@
+hello!
diff --git a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs
index c1d3321f840..d6bfe6fde82 100644
--- a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs
+++ b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs
@@ -15,6 +15,7 @@ fn f<T>(
      }],
 ) -> impl Iterator<Item = SubAssign> {
 //~^ ERROR expected a type, found a trait
+//~| ERROR expected a type, found a trait
 //~| ERROR `()` is not an iterator
 }
 
diff --git a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr
index 5c4d643a28e..80d711ca844 100644
--- a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr
@@ -16,13 +16,20 @@ help: you might be missing a type parameter
 LL | fn f<T, F>(
    |       +++
 
-error[E0277]: `()` is not an iterator
-  --> $DIR/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs:16:6
+error[E0782]: expected a type, found a trait
+  --> $DIR/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs:16:27
    |
 LL | ) -> impl Iterator<Item = SubAssign> {
-   |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator
+   |                           ^^^^^^^^^
    |
-   = help: the trait `Iterator` is not implemented for `()`
+help: you can add the `dyn` keyword if you want a trait object
+   |
+LL | ) -> impl Iterator<Item = dyn SubAssign> {
+   |                           +++
+help: you might have meant to write a bound here
+   |
+LL | ) -> impl Iterator<Item: SubAssign> {
+   |                        ~
 
 error[E0782]: expected a type, found a trait
   --> $DIR/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs:16:27
@@ -30,6 +37,7 @@ error[E0782]: expected a type, found a trait
 LL | ) -> impl Iterator<Item = SubAssign> {
    |                           ^^^^^^^^^
    |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 help: you can add the `dyn` keyword if you want a trait object
    |
 LL | ) -> impl Iterator<Item = dyn SubAssign> {
@@ -39,7 +47,15 @@ help: you might have meant to write a bound here
 LL | ) -> impl Iterator<Item: SubAssign> {
    |                        ~
 
-error: aborting due to 3 previous errors
+error[E0277]: `()` is not an iterator
+  --> $DIR/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs:16:6
+   |
+LL | ) -> impl Iterator<Item = SubAssign> {
+   |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator
+   |
+   = help: the trait `Iterator` is not implemented for `()`
+
+error: aborting due to 4 previous errors
 
 Some errors have detailed explanations: E0277, E0412, E0782.
 For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/const-generics/generic_const_exprs/lit_type_mismatch.rs b/tests/ui/const-generics/generic_const_exprs/lit_type_mismatch.rs
new file mode 100644
index 00000000000..1ed0965e1bd
--- /dev/null
+++ b/tests/ui/const-generics/generic_const_exprs/lit_type_mismatch.rs
@@ -0,0 +1,22 @@
+//! ICE regression test for #114317 and #126182
+//! Type mismatches of literals cause errors int typeck,
+//! but those errors cannot be propagated to the various
+//! `lit_to_const` call sites. Now `lit_to_const` just delays
+//! a bug and produces an error constant on its own.
+
+#![feature(adt_const_params)]
+#![feature(generic_const_exprs)]
+#![allow(incomplete_features)]
+
+struct A<const B: () = 1, C>(C);
+//~^ ERROR: generic parameters with a default must be trailing
+//~| ERROR: mismatched types
+
+struct Cond<const B: bool>;
+
+struct Thing<T = Cond<0>>(T);
+//~^ ERROR: mismatched types
+
+impl Thing {}
+
+fn main() {}
diff --git a/tests/ui/const-generics/generic_const_exprs/lit_type_mismatch.stderr b/tests/ui/const-generics/generic_const_exprs/lit_type_mismatch.stderr
new file mode 100644
index 00000000000..e4613e498b2
--- /dev/null
+++ b/tests/ui/const-generics/generic_const_exprs/lit_type_mismatch.stderr
@@ -0,0 +1,21 @@
+error: generic parameters with a default must be trailing
+  --> $DIR/lit_type_mismatch.rs:11:16
+   |
+LL | struct A<const B: () = 1, C>(C);
+   |                ^
+
+error[E0308]: mismatched types
+  --> $DIR/lit_type_mismatch.rs:11:24
+   |
+LL | struct A<const B: () = 1, C>(C);
+   |                        ^ expected `()`, found integer
+
+error[E0308]: mismatched types
+  --> $DIR/lit_type_mismatch.rs:17:23
+   |
+LL | struct Thing<T = Cond<0>>(T);
+   |                       ^ expected `bool`, found integer
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/const-generics/min_const_generics/invalid-patterns.32bit.stderr b/tests/ui/const-generics/min_const_generics/invalid-patterns.32bit.stderr
index be92429e3ab..11a824ba73b 100644
--- a/tests/ui/const-generics/min_const_generics/invalid-patterns.32bit.stderr
+++ b/tests/ui/const-generics/min_const_generics/invalid-patterns.32bit.stderr
@@ -1,27 +1,3 @@
-error[E0308]: mismatched types
-  --> $DIR/invalid-patterns.rs:29:21
-   |
-LL |   get_flag::<false, 0xFF>();
-   |                     ^^^^ expected `char`, found `u8`
-
-error[E0308]: mismatched types
-  --> $DIR/invalid-patterns.rs:31:14
-   |
-LL |   get_flag::<7, 'c'>();
-   |              ^ expected `bool`, found integer
-
-error[E0308]: mismatched types
-  --> $DIR/invalid-patterns.rs:33:14
-   |
-LL |   get_flag::<42, 0x5ad>();
-   |              ^^ expected `bool`, found integer
-
-error[E0308]: mismatched types
-  --> $DIR/invalid-patterns.rs:33:18
-   |
-LL |   get_flag::<42, 0x5ad>();
-   |                  ^^^^^ expected `char`, found `u8`
-
 error[E0080]: evaluation of constant value failed
   --> $DIR/invalid-patterns.rs:38:32
    |
@@ -56,6 +32,30 @@ error[E0080]: evaluation of constant value failed
 LL |   get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character } }>();
    |                                                          ^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
 
+error[E0308]: mismatched types
+  --> $DIR/invalid-patterns.rs:29:21
+   |
+LL |   get_flag::<false, 0xFF>();
+   |                     ^^^^ expected `char`, found `u8`
+
+error[E0308]: mismatched types
+  --> $DIR/invalid-patterns.rs:31:14
+   |
+LL |   get_flag::<7, 'c'>();
+   |              ^ expected `bool`, found integer
+
+error[E0308]: mismatched types
+  --> $DIR/invalid-patterns.rs:33:14
+   |
+LL |   get_flag::<42, 0x5ad>();
+   |              ^^ expected `bool`, found integer
+
+error[E0308]: mismatched types
+  --> $DIR/invalid-patterns.rs:33:18
+   |
+LL |   get_flag::<42, 0x5ad>();
+   |                  ^^^^^ expected `char`, found `u8`
+
 error: aborting due to 8 previous errors
 
 Some errors have detailed explanations: E0080, E0308.
diff --git a/tests/ui/const-generics/min_const_generics/invalid-patterns.64bit.stderr b/tests/ui/const-generics/min_const_generics/invalid-patterns.64bit.stderr
index be92429e3ab..11a824ba73b 100644
--- a/tests/ui/const-generics/min_const_generics/invalid-patterns.64bit.stderr
+++ b/tests/ui/const-generics/min_const_generics/invalid-patterns.64bit.stderr
@@ -1,27 +1,3 @@
-error[E0308]: mismatched types
-  --> $DIR/invalid-patterns.rs:29:21
-   |
-LL |   get_flag::<false, 0xFF>();
-   |                     ^^^^ expected `char`, found `u8`
-
-error[E0308]: mismatched types
-  --> $DIR/invalid-patterns.rs:31:14
-   |
-LL |   get_flag::<7, 'c'>();
-   |              ^ expected `bool`, found integer
-
-error[E0308]: mismatched types
-  --> $DIR/invalid-patterns.rs:33:14
-   |
-LL |   get_flag::<42, 0x5ad>();
-   |              ^^ expected `bool`, found integer
-
-error[E0308]: mismatched types
-  --> $DIR/invalid-patterns.rs:33:18
-   |
-LL |   get_flag::<42, 0x5ad>();
-   |                  ^^^^^ expected `char`, found `u8`
-
 error[E0080]: evaluation of constant value failed
   --> $DIR/invalid-patterns.rs:38:32
    |
@@ -56,6 +32,30 @@ error[E0080]: evaluation of constant value failed
 LL |   get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character } }>();
    |                                                          ^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
 
+error[E0308]: mismatched types
+  --> $DIR/invalid-patterns.rs:29:21
+   |
+LL |   get_flag::<false, 0xFF>();
+   |                     ^^^^ expected `char`, found `u8`
+
+error[E0308]: mismatched types
+  --> $DIR/invalid-patterns.rs:31:14
+   |
+LL |   get_flag::<7, 'c'>();
+   |              ^ expected `bool`, found integer
+
+error[E0308]: mismatched types
+  --> $DIR/invalid-patterns.rs:33:14
+   |
+LL |   get_flag::<42, 0x5ad>();
+   |              ^^ expected `bool`, found integer
+
+error[E0308]: mismatched types
+  --> $DIR/invalid-patterns.rs:33:18
+   |
+LL |   get_flag::<42, 0x5ad>();
+   |                  ^^^^^ expected `char`, found `u8`
+
 error: aborting due to 8 previous errors
 
 Some errors have detailed explanations: E0080, E0308.
diff --git a/tests/ui/consts/const_in_pattern/non_structural_with_escaping_bounds.rs b/tests/ui/consts/const_in_pattern/non_structural_with_escaping_bounds.rs
new file mode 100644
index 00000000000..e5d095fd617
--- /dev/null
+++ b/tests/ui/consts/const_in_pattern/non_structural_with_escaping_bounds.rs
@@ -0,0 +1,15 @@
+#![feature(structural_match)]
+impl<T: ?Sized> std::marker::StructuralPartialEq for O<T> { }
+
+enum O<T: ?Sized> {
+    Some(*const T),
+    None,
+}
+
+const C: O<dyn for<'a> Fn(Box<dyn Fn(&'a u8)>)> = O::None;
+
+fn main() {
+    match O::None {
+        C => (), //~ ERROR constant of non-structural type
+    }
+}
diff --git a/tests/ui/consts/const_in_pattern/non_structural_with_escaping_bounds.stderr b/tests/ui/consts/const_in_pattern/non_structural_with_escaping_bounds.stderr
new file mode 100644
index 00000000000..371be9982f7
--- /dev/null
+++ b/tests/ui/consts/const_in_pattern/non_structural_with_escaping_bounds.stderr
@@ -0,0 +1,13 @@
+error: constant of non-structural type `O<dyn for<'a> Fn(Box<dyn Fn(&'a u8)>)>` in a pattern
+  --> $DIR/non_structural_with_escaping_bounds.rs:13:9
+   |
+LL | const C: O<dyn for<'a> Fn(Box<dyn Fn(&'a u8)>)> = O::None;
+   | ----------------------------------------------- constant defined here
+...
+LL |         C => (),
+   |         ^ constant of non-structural type
+   |
+   = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/consts/fn_trait_refs.stderr b/tests/ui/consts/fn_trait_refs.stderr
index e0dbecff8e5..d688bfbde2b 100644
--- a/tests/ui/consts/fn_trait_refs.stderr
+++ b/tests/ui/consts/fn_trait_refs.stderr
@@ -155,90 +155,21 @@ note: `FnMut` can't be used with `~const` because it isn't annotated with `#[con
   --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
-error[E0277]: the trait bound `fn() -> i32 {one}: const Destruct` is not satisfied
-  --> $DIR/fn_trait_refs.rs:70:32
+error[E0015]: cannot call non-const operator in constants
+  --> $DIR/fn_trait_refs.rs:71:17
    |
-LL |         let test_one = test_fn(one);
-   |                        ------- ^^^
-   |                        |
-   |                        required by a bound introduced by this call
+LL |         assert!(test_one == (1, 1, 1));
+   |                 ^^^^^^^^^^^^^^^^^^^^^
    |
-note: required by a bound in `test_fn`
-  --> $DIR/fn_trait_refs.rs:35:24
-   |
-LL | const fn test_fn<T>(mut f: T) -> (T::Output, T::Output, T::Output)
-   |          ------- required by a bound in this function
-LL | where
-LL |     T: ~const Fn<()> + ~const Destruct,
-   |                        ^^^^^^ required by this bound in `test_fn`
-
-error[E0277]: the trait bound `fn() -> i32 {two}: const Destruct` is not satisfied
-  --> $DIR/fn_trait_refs.rs:73:36
-   |
-LL |         let test_two = test_fn_mut(two);
-   |                        ----------- ^^^
-   |                        |
-   |                        required by a bound introduced by this call
-   |
-note: required by a bound in `test_fn_mut`
-  --> $DIR/fn_trait_refs.rs:49:27
-   |
-LL | const fn test_fn_mut<T>(mut f: T) -> (T::Output, T::Output)
-   |          ----------- required by a bound in this function
-LL | where
-LL |     T: ~const FnMut<()> + ~const Destruct,
-   |                           ^^^^^^ required by this bound in `test_fn_mut`
+   = note: calls in constants are limited to constant functions, tuple structs and tuple variants
 
-error[E0277]: the trait bound `&T: ~const Destruct` is not satisfied
-  --> $DIR/fn_trait_refs.rs:39:19
-   |
-LL |         tester_fn(&f),
-   |         --------- ^^
-   |         |
-   |         required by a bound introduced by this call
+error[E0015]: cannot call non-const operator in constants
+  --> $DIR/fn_trait_refs.rs:74:17
    |
-note: required by a bound in `tester_fn`
-  --> $DIR/fn_trait_refs.rs:14:24
+LL |         assert!(test_two == (2, 2));
+   |                 ^^^^^^^^^^^^^^^^^^
    |
-LL | const fn tester_fn<T>(f: T) -> T::Output
-   |          --------- required by a bound in this function
-LL | where
-LL |     T: ~const Fn<()> + ~const Destruct,
-   |                        ^^^^^^ required by this bound in `tester_fn`
-
-error[E0277]: the trait bound `&T: ~const Destruct` is not satisfied
-  --> $DIR/fn_trait_refs.rs:41:23
-   |
-LL |         tester_fn_mut(&f),
-   |         ------------- ^^
-   |         |
-   |         required by a bound introduced by this call
-   |
-note: required by a bound in `tester_fn_mut`
-  --> $DIR/fn_trait_refs.rs:21:27
-   |
-LL | const fn tester_fn_mut<T>(mut f: T) -> T::Output
-   |          ------------- required by a bound in this function
-LL | where
-LL |     T: ~const FnMut<()> + ~const Destruct,
-   |                           ^^^^^^ required by this bound in `tester_fn_mut`
-
-error[E0277]: the trait bound `&mut T: ~const Destruct` is not satisfied
-  --> $DIR/fn_trait_refs.rs:53:23
-   |
-LL |         tester_fn_mut(&mut f),
-   |         ------------- ^^^^^^
-   |         |
-   |         required by a bound introduced by this call
-   |
-note: required by a bound in `tester_fn_mut`
-  --> $DIR/fn_trait_refs.rs:21:27
-   |
-LL | const fn tester_fn_mut<T>(mut f: T) -> T::Output
-   |          ------------- required by a bound in this function
-LL | where
-LL |     T: ~const FnMut<()> + ~const Destruct,
-   |                           ^^^^^^ required by this bound in `tester_fn_mut`
+   = note: calls in constants are limited to constant functions, tuple structs and tuple variants
 
 error[E0015]: cannot call non-const closure in constant functions
   --> $DIR/fn_trait_refs.rs:16:5
@@ -264,7 +195,7 @@ LL |     f()
    |
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
 
-error: aborting due to 25 previous errors
+error: aborting due to 22 previous errors
 
-Some errors have detailed explanations: E0015, E0277, E0635.
+Some errors have detailed explanations: E0015, E0635.
 For more information about an error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/promoted_const_call.stderr b/tests/ui/consts/promoted_const_call.stderr
index dd70bb601c4..40c6d083b06 100644
--- a/tests/ui/consts/promoted_const_call.stderr
+++ b/tests/ui/consts/promoted_const_call.stderr
@@ -5,6 +5,10 @@ LL |     let _: &'static _ = &id(&Panic);
    |                              ^^^^^ - value is dropped here
    |                              |
    |                              the destructor for this type cannot be evaluated in constants
+   |
+   = note: see issue #133214 <https://github.com/rust-lang/rust/issues/133214> for more information
+   = help: add `#![feature(const_destruct)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0716]: temporary value dropped while borrowed
   --> $DIR/promoted_const_call.rs:16:26
diff --git a/tests/ui/consts/recursive-block.rs b/tests/ui/consts/recursive-block.rs
new file mode 100644
index 00000000000..a3dcaa42836
--- /dev/null
+++ b/tests/ui/consts/recursive-block.rs
@@ -0,0 +1,7 @@
+const fn foo<T>() {
+    const { foo::<&T>() } //~ ERROR: queries overflow the depth limit!
+}
+
+fn main () {
+    const X: () = foo::<i32>();
+}
diff --git a/tests/ui/consts/recursive-block.stderr b/tests/ui/consts/recursive-block.stderr
new file mode 100644
index 00000000000..90814e2e000
--- /dev/null
+++ b/tests/ui/consts/recursive-block.stderr
@@ -0,0 +1,11 @@
+error: queries overflow the depth limit!
+  --> $DIR/recursive-block.rs:2:11
+   |
+LL |     const { foo::<&T>() }
+   |           ^^^^^^^^^^^^^^^
+   |
+   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursive_block`)
+   = note: query depth increased by 1 when computing layout of `foo<&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32>`
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/consts/recursive-const-in-impl.rs b/tests/ui/consts/recursive-const-in-impl.rs
new file mode 100644
index 00000000000..93f7201f921
--- /dev/null
+++ b/tests/ui/consts/recursive-const-in-impl.rs
@@ -0,0 +1,12 @@
+//@ build-fail
+#![recursion_limit = "7"]
+
+struct Thing<T>(T);
+
+impl<T> Thing<T> {
+    const X: usize = Thing::<Option<T>>::X;
+}
+
+fn main() {
+    println!("{}", Thing::<i32>::X); //~ ERROR: queries overflow the depth limit!
+}
diff --git a/tests/ui/consts/recursive-const-in-impl.stderr b/tests/ui/consts/recursive-const-in-impl.stderr
new file mode 100644
index 00000000000..6175112c8cc
--- /dev/null
+++ b/tests/ui/consts/recursive-const-in-impl.stderr
@@ -0,0 +1,11 @@
+error: queries overflow the depth limit!
+  --> $DIR/recursive-const-in-impl.rs:11:14
+   |
+LL |     println!("{}", Thing::<i32>::X);
+   |              ^^^^
+   |
+   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "14"]` attribute to your crate (`recursive_const_in_impl`)
+   = note: query depth increased by 9 when simplifying constant for the type system `main::promoted[1]`
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/coroutine/gen_block.e2024.stderr b/tests/ui/coroutine/gen_block.e2024.stderr
index 322259cf2f8..0491bdbc2e1 100644
--- a/tests/ui/coroutine/gen_block.e2024.stderr
+++ b/tests/ui/coroutine/gen_block.e2024.stderr
@@ -1,4 +1,4 @@
-error[E0658]: the `#[coroutines]` attribute is an experimental feature
+error[E0658]: the `#[coroutine]` attribute is an experimental feature
   --> $DIR/gen_block.rs:20:13
    |
 LL |     let _ = #[coroutine] || yield true;
@@ -8,7 +8,7 @@ LL |     let _ = #[coroutine] || yield true;
    = help: add `#![feature(coroutines)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: the `#[coroutines]` attribute is an experimental feature
+error[E0658]: the `#[coroutine]` attribute is an experimental feature
   --> $DIR/gen_block.rs:24:13
    |
 LL |     let _ = #[coroutine] || {};
diff --git a/tests/ui/coroutine/gen_block.none.stderr b/tests/ui/coroutine/gen_block.none.stderr
index 15123a49e48..43437793005 100644
--- a/tests/ui/coroutine/gen_block.none.stderr
+++ b/tests/ui/coroutine/gen_block.none.stderr
@@ -44,7 +44,7 @@ LL |     let _ = #[coroutine] || yield true;
    = help: add `#![feature(coroutines)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: the `#[coroutines]` attribute is an experimental feature
+error[E0658]: the `#[coroutine]` attribute is an experimental feature
   --> $DIR/gen_block.rs:20:13
    |
 LL |     let _ = #[coroutine] || yield true;
@@ -54,7 +54,7 @@ LL |     let _ = #[coroutine] || yield true;
    = help: add `#![feature(coroutines)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: the `#[coroutines]` attribute is an experimental feature
+error[E0658]: the `#[coroutine]` attribute is an experimental feature
   --> $DIR/gen_block.rs:24:13
    |
 LL |     let _ = #[coroutine] || {};
diff --git a/tests/ui/coroutine/gen_block.rs b/tests/ui/coroutine/gen_block.rs
index 6734de3b667..4494d654eeb 100644
--- a/tests/ui/coroutine/gen_block.rs
+++ b/tests/ui/coroutine/gen_block.rs
@@ -18,9 +18,9 @@ fn main() {
     //~^^ ERROR `yield` can only be used in
 
     let _ = #[coroutine] || yield true; //[none]~ ERROR yield syntax is experimental
-    //~^ ERROR `#[coroutines]` attribute is an experimental feature
+    //~^ ERROR `#[coroutine]` attribute is an experimental feature
     //~^^ ERROR yield syntax is experimental
 
     let _ = #[coroutine] || {};
-    //~^ ERROR `#[coroutines]` attribute is an experimental feature
+    //~^ ERROR `#[coroutine]` attribute is an experimental feature
 }
diff --git a/tests/ui/coroutine/resume-arg-outlives-2.rs b/tests/ui/coroutine/resume-arg-outlives-2.rs
index 387b143ea27..a805cea9b7e 100644
--- a/tests/ui/coroutine/resume-arg-outlives-2.rs
+++ b/tests/ui/coroutine/resume-arg-outlives-2.rs
@@ -18,8 +18,8 @@ fn demo<'not_static>(s: &'not_static str) -> thread::JoinHandle<()> {
     // exploit:
     generator.as_mut().resume("");
     generator.as_mut().resume(s); // <- generator hoards it as `let ctx`.
-    //~^ ERROR borrowed data escapes outside of function
     thread::spawn(move || {
+        //~^ ERROR borrowed data escapes outside of function
         thread::sleep(time::Duration::from_millis(200));
         generator.as_mut().resume(""); // <- resumes from the last `yield`, running `dbg!(ctx)`.
     })
diff --git a/tests/ui/coroutine/resume-arg-outlives-2.stderr b/tests/ui/coroutine/resume-arg-outlives-2.stderr
index 3d630d7e7e4..92192d9a557 100644
--- a/tests/ui/coroutine/resume-arg-outlives-2.stderr
+++ b/tests/ui/coroutine/resume-arg-outlives-2.stderr
@@ -1,16 +1,20 @@
 error[E0521]: borrowed data escapes outside of function
-  --> $DIR/resume-arg-outlives-2.rs:20:5
+  --> $DIR/resume-arg-outlives-2.rs:21:5
    |
-LL | fn demo<'not_static>(s: &'not_static str) -> thread::JoinHandle<()> {
-   |         -----------  - `s` is a reference that is only valid in the function body
-   |         |
-   |         lifetime `'not_static` defined here
+LL |   fn demo<'not_static>(s: &'not_static str) -> thread::JoinHandle<()> {
+   |           -----------  - `s` is a reference that is only valid in the function body
+   |           |
+   |           lifetime `'not_static` defined here
 ...
-LL |     generator.as_mut().resume(s); // <- generator hoards it as `let ctx`.
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |     |
-   |     `s` escapes the function body here
-   |     argument requires that `'not_static` must outlive `'static`
+LL | /     thread::spawn(move || {
+LL | |
+LL | |         thread::sleep(time::Duration::from_millis(200));
+LL | |         generator.as_mut().resume(""); // <- resumes from the last `yield`, running `dbg!(ctx)`.
+LL | |     })
+   | |      ^
+   | |      |
+   | |______`s` escapes the function body here
+   |        argument requires that `'not_static` must outlive `'static`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/drop/lint-tail-expr-drop-order-borrowck.rs b/tests/ui/drop/lint-tail-expr-drop-order-borrowck.rs
new file mode 100644
index 00000000000..6f64d83f8a0
--- /dev/null
+++ b/tests/ui/drop/lint-tail-expr-drop-order-borrowck.rs
@@ -0,0 +1,51 @@
+// Edition 2024 lint for change in drop order at tail expression
+// This lint is to capture potential borrow-checking errors
+// due to implementation of RFC 3606 <https://github.com/rust-lang/rfcs/pull/3606>
+//@ edition: 2021
+
+#![deny(tail_expr_drop_order)] //~ NOTE: the lint level is defined here
+
+fn should_lint_with_potential_borrowck_err() {
+    let _ = { String::new().as_str() }.len();
+    //~^ ERROR: relative drop order changing
+    //~| WARN: this changes meaning in Rust 2024
+    //~| NOTE: this temporary value will be dropped at the end of the block
+    //~| borrow later used by call
+    //~| NOTE: for more information, see
+}
+
+fn should_lint_with_unsafe_block() {
+    fn f(_: usize) {}
+    f(unsafe { String::new().as_str() }.len());
+    //~^ ERROR: relative drop order changing
+    //~| WARN: this changes meaning in Rust 2024
+    //~| NOTE: this temporary value will be dropped at the end of the block
+    //~| borrow later used by call
+    //~| NOTE: for more information, see
+}
+
+#[rustfmt::skip]
+fn should_lint_with_big_block() {
+    fn f<T>(_: T) {}
+    f({
+        &mut || 0
+        //~^ ERROR: relative drop order changing
+        //~| WARN: this changes meaning in Rust 2024
+        //~| NOTE: this temporary value will be dropped at the end of the block
+        //~| borrow later used here
+        //~| NOTE: for more information, see
+    })
+}
+
+fn another_temp_that_is_copy_in_arg() {
+    fn f() {}
+    fn g(_: &()) {}
+    g({ &f() });
+    //~^ ERROR: relative drop order changing
+    //~| WARN: this changes meaning in Rust 2024
+    //~| NOTE: this temporary value will be dropped at the end of the block
+    //~| borrow later used by call
+    //~| NOTE: for more information, see
+}
+
+fn main() {}
diff --git a/tests/ui/drop/lint-tail-expr-drop-order-borrowck.stderr b/tests/ui/drop/lint-tail-expr-drop-order-borrowck.stderr
new file mode 100644
index 00000000000..a55e366dd0b
--- /dev/null
+++ b/tests/ui/drop/lint-tail-expr-drop-order-borrowck.stderr
@@ -0,0 +1,52 @@
+error: relative drop order changing in Rust 2024
+  --> $DIR/lint-tail-expr-drop-order-borrowck.rs:9:15
+   |
+LL |     let _ = { String::new().as_str() }.len();
+   |               ^^^^^^^^^^^^^            --- borrow later used by call
+   |               |
+   |               this temporary value will be dropped at the end of the block
+   |
+   = warning: this changes meaning in Rust 2024
+   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-tail-expr-scope.html>
+note: the lint level is defined here
+  --> $DIR/lint-tail-expr-drop-order-borrowck.rs:6:9
+   |
+LL | #![deny(tail_expr_drop_order)]
+   |         ^^^^^^^^^^^^^^^^^^^^
+
+error: relative drop order changing in Rust 2024
+  --> $DIR/lint-tail-expr-drop-order-borrowck.rs:19:16
+   |
+LL |     f(unsafe { String::new().as_str() }.len());
+   |                ^^^^^^^^^^^^^            --- borrow later used by call
+   |                |
+   |                this temporary value will be dropped at the end of the block
+   |
+   = warning: this changes meaning in Rust 2024
+   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-tail-expr-scope.html>
+
+error: relative drop order changing in Rust 2024
+  --> $DIR/lint-tail-expr-drop-order-borrowck.rs:31:9
+   |
+LL |         &mut || 0
+   |         ^^^^^^^^^
+   |         |
+   |         this temporary value will be dropped at the end of the block
+   |         borrow later used here
+   |
+   = warning: this changes meaning in Rust 2024
+   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-tail-expr-scope.html>
+
+error: relative drop order changing in Rust 2024
+  --> $DIR/lint-tail-expr-drop-order-borrowck.rs:43:9
+   |
+LL |     g({ &f() });
+   |     -   ^^^^ this temporary value will be dropped at the end of the block
+   |     |
+   |     borrow later used by call
+   |
+   = warning: this changes meaning in Rust 2024
+   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-tail-expr-scope.html>
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/drop/lint-tail-expr-drop-order.rs b/tests/ui/drop/lint-tail-expr-drop-order.rs
index b2a5db0d871..55a2d1d3b75 100644
--- a/tests/ui/drop/lint-tail-expr-drop-order.rs
+++ b/tests/ui/drop/lint-tail-expr-drop-order.rs
@@ -17,7 +17,6 @@ impl Drop for LoudDropper {
     //~| NOTE: `#1` invokes this custom destructor
     //~| NOTE: `x` invokes this custom destructor
     //~| NOTE: `#1` invokes this custom destructor
-    //~| NOTE: `future` invokes this custom destructor
     //~| NOTE: `_x` invokes this custom destructor
     //~| NOTE: `#1` invokes this custom destructor
     fn drop(&mut self) {
diff --git a/tests/ui/drop/lint-tail-expr-drop-order.stderr b/tests/ui/drop/lint-tail-expr-drop-order.stderr
index 92afae5af67..6ff9b7c1268 100644
--- a/tests/ui/drop/lint-tail-expr-drop-order.stderr
+++ b/tests/ui/drop/lint-tail-expr-drop-order.stderr
@@ -1,5 +1,5 @@
 error: relative drop order changing in Rust 2024
-  --> $DIR/lint-tail-expr-drop-order.rs:41:15
+  --> $DIR/lint-tail-expr-drop-order.rs:40:15
    |
 LL |     let x = LoudDropper;
    |         -
@@ -40,7 +40,7 @@ LL | #![deny(tail_expr_drop_order)]
    |         ^^^^^^^^^^^^^^^^^^^^
 
 error: relative drop order changing in Rust 2024
-  --> $DIR/lint-tail-expr-drop-order.rs:66:19
+  --> $DIR/lint-tail-expr-drop-order.rs:65:19
    |
 LL |         let x = LoudDropper;
    |             -
@@ -76,7 +76,7 @@ LL | | }
    = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages
 
 error: relative drop order changing in Rust 2024
-  --> $DIR/lint-tail-expr-drop-order.rs:93:7
+  --> $DIR/lint-tail-expr-drop-order.rs:92:7
    |
 LL |     let x = LoudDropper;
    |         -
@@ -112,7 +112,7 @@ LL | | }
    = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages
 
 error: relative drop order changing in Rust 2024
-  --> $DIR/lint-tail-expr-drop-order.rs:146:5
+  --> $DIR/lint-tail-expr-drop-order.rs:145:5
    |
 LL |     let future = f();
    |         ------
@@ -138,17 +138,10 @@ LL | / impl Drop for LoudDropper {
 ...  |
 LL | | }
    | |_^
-note: `future` invokes this custom destructor
-  --> $DIR/lint-tail-expr-drop-order.rs:10:1
-   |
-LL | / impl Drop for LoudDropper {
-...  |
-LL | | }
-   | |_^
    = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages
 
 error: relative drop order changing in Rust 2024
-  --> $DIR/lint-tail-expr-drop-order.rs:163:14
+  --> $DIR/lint-tail-expr-drop-order.rs:162:14
    |
 LL |     let x = T::default();
    |         -
@@ -170,7 +163,7 @@ LL | }
    = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages
 
 error: relative drop order changing in Rust 2024
-  --> $DIR/lint-tail-expr-drop-order.rs:177:5
+  --> $DIR/lint-tail-expr-drop-order.rs:176:5
    |
 LL |     let x: Result<LoudDropper, ()> = Ok(LoudDropper);
    |         -
@@ -206,7 +199,7 @@ LL | | }
    = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages
 
 error: relative drop order changing in Rust 2024
-  --> $DIR/lint-tail-expr-drop-order.rs:221:5
+  --> $DIR/lint-tail-expr-drop-order.rs:220:5
    |
 LL |     let x = LoudDropper2;
    |         -
@@ -226,7 +219,7 @@ LL | }
    = warning: this changes meaning in Rust 2024
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-tail-expr-scope.html>
 note: `#1` invokes this custom destructor
-  --> $DIR/lint-tail-expr-drop-order.rs:194:5
+  --> $DIR/lint-tail-expr-drop-order.rs:193:5
    |
 LL | /     impl Drop for LoudDropper3 {
 LL | |
@@ -236,7 +229,7 @@ LL | |         }
 LL | |     }
    | |_____^
 note: `x` invokes this custom destructor
-  --> $DIR/lint-tail-expr-drop-order.rs:206:5
+  --> $DIR/lint-tail-expr-drop-order.rs:205:5
    |
 LL | /     impl Drop for LoudDropper2 {
 LL | |
@@ -248,7 +241,7 @@ LL | |     }
    = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages
 
 error: relative drop order changing in Rust 2024
-  --> $DIR/lint-tail-expr-drop-order.rs:234:13
+  --> $DIR/lint-tail-expr-drop-order.rs:233:13
    |
 LL |             LoudDropper.get()
    |             ^^^^^^^^^^^
diff --git a/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.stderr b/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.stderr
index d98100bc1b0..b0f971dd5ce 100644
--- a/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.stderr
+++ b/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.stderr
@@ -4,10 +4,14 @@ error: relative drop order changing in Rust 2024
 LL |         match func().await {
    |               ^^^^^^^-----
    |               |      |
+   |               |      this value will be stored in a temporary; let us call it `#3`
+   |               |      up until Edition 2021 `#3` is dropped last but will be dropped earlier in Edition 2024
    |               |      this value will be stored in a temporary; let us call it `#1`
    |               |      `#1` will be dropped later as of Edition 2024
    |               this value will be stored in a temporary; let us call it `#2`
    |               up until Edition 2021 `#2` is dropped last but will be dropped earlier in Edition 2024
+   |               `__awaitee` calls a custom destructor
+   |               `__awaitee` will be dropped later as of Edition 2024
 ...
 LL |             Err(e) => {}
    |                 -
diff --git a/tests/ui/drop/tail_expr_drop_order-on-recursive-boxed-fut.rs b/tests/ui/drop/tail_expr_drop_order-on-recursive-boxed-fut.rs
new file mode 100644
index 00000000000..4a72f224d94
--- /dev/null
+++ b/tests/ui/drop/tail_expr_drop_order-on-recursive-boxed-fut.rs
@@ -0,0 +1,13 @@
+//@ edition: 2021
+//@ check-pass
+
+// Make sure we don't cycle error when normalizing types for tail expr drop order lint.
+
+#![deny(tail_expr_drop_order)]
+
+async fn test() -> Result<(), Box<dyn std::error::Error>> {
+    Box::pin(test()).await?;
+    Ok(())
+}
+
+fn main() {}
diff --git a/tests/ui/drop/tail_expr_drop_order-on-thread-local.rs b/tests/ui/drop/tail_expr_drop_order-on-thread-local.rs
new file mode 100644
index 00000000000..e38175fd1b6
--- /dev/null
+++ b/tests/ui/drop/tail_expr_drop_order-on-thread-local.rs
@@ -0,0 +1,56 @@
+//@ check-pass
+
+#![feature(thread_local)]
+#![deny(tail_expr_drop_order)]
+
+use std::marker::PhantomData;
+use std::ops::{Deref, DerefMut};
+
+pub struct Global;
+
+#[thread_local]
+static REENTRANCY_STATE: State<Global> = State { marker: PhantomData, controller: Global };
+
+pub struct Token(PhantomData<*mut ()>);
+
+pub fn with_mut<T>(f: impl FnOnce(&mut Token) -> T) -> T {
+    f(&mut REENTRANCY_STATE.borrow_mut())
+}
+
+pub struct State<T: ?Sized = Global> {
+    marker: PhantomData<*mut ()>,
+    controller: T,
+}
+
+impl<T: ?Sized> State<T> {
+    pub fn borrow_mut(&self) -> TokenMut<'_, T> {
+        todo!()
+    }
+}
+
+pub struct TokenMut<'a, T: ?Sized = Global> {
+    state: &'a State<T>,
+    token: Token,
+}
+
+impl<T> Deref for TokenMut<'_, T> {
+    type Target = Token;
+
+    fn deref(&self) -> &Self::Target {
+        todo!()
+    }
+}
+
+impl<T> DerefMut for TokenMut<'_, T> {
+    fn deref_mut(&mut self) -> &mut Self::Target {
+        todo!()
+    }
+}
+
+impl<T: ?Sized> Drop for TokenMut<'_, T> {
+    fn drop(&mut self) {
+        todo!()
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/dyn-keyword/misspelled-associated-item.rs b/tests/ui/dyn-keyword/misspelled-associated-item.rs
new file mode 100644
index 00000000000..8319e797d62
--- /dev/null
+++ b/tests/ui/dyn-keyword/misspelled-associated-item.rs
@@ -0,0 +1,12 @@
+//@ edition: 2021
+
+trait Trait {
+    fn typo() -> Self;
+}
+
+fn main() {
+    let () = Trait::typoe();
+    //~^ ERROR expected a type, found a trait
+    //~| HELP you can add the `dyn` keyword if you want a trait object
+    //~| HELP you may have misspelled this associated item
+}
diff --git a/tests/ui/dyn-keyword/misspelled-associated-item.stderr b/tests/ui/dyn-keyword/misspelled-associated-item.stderr
new file mode 100644
index 00000000000..4211889e524
--- /dev/null
+++ b/tests/ui/dyn-keyword/misspelled-associated-item.stderr
@@ -0,0 +1,18 @@
+error[E0782]: expected a type, found a trait
+  --> $DIR/misspelled-associated-item.rs:8:14
+   |
+LL |     let () = Trait::typoe();
+   |              ^^^^^
+   |
+help: you can add the `dyn` keyword if you want a trait object
+   |
+LL |     let () = <dyn Trait>::typoe();
+   |              ++++      +
+help: you may have misspelled this associated item, causing `Trait` to be interpreted as a type rather than a trait
+   |
+LL |     let () = Trait::typo();
+   |                     ~~~~
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0782`.
diff --git a/tests/ui/fn/fn_def_coercion.rs b/tests/ui/fn/fn_def_coercion.rs
index 313be6f28cd..31c8fa41de1 100644
--- a/tests/ui/fn/fn_def_coercion.rs
+++ b/tests/ui/fn/fn_def_coercion.rs
@@ -46,12 +46,12 @@ fn j<'a, 'b, 'c: 'a + 'b>(a: &'a (), b: &'b (), c: &'c ()) {
 
 fn k<'a, 'b, 'c: 'a + 'b>(a: &'a (), b: &'b (), c: &'c ()) {
     let x = match true {
-        true => foo::<&'c ()>,
+        true => foo::<&'c ()>, //~ ERROR lifetime may not live long enough
         false => foo::<&'a ()>, //~ ERROR lifetime may not live long enough
     };
 
     x(a);
-    x(b); //~ ERROR lifetime may not live long enough
+    x(b);
     x(c);
 }
 
diff --git a/tests/ui/fn/fn_def_coercion.stderr b/tests/ui/fn/fn_def_coercion.stderr
index ec4a1bde7fd..c2776887b79 100644
--- a/tests/ui/fn/fn_def_coercion.stderr
+++ b/tests/ui/fn/fn_def_coercion.stderr
@@ -6,9 +6,9 @@ LL | fn f<'a, 'b, 'c: 'a + 'b>(a: &'a (), b: &'b (), c: &'c ()) {
    |      |
    |      lifetime `'a` defined here
 LL |     let mut x = foo::<&'a ()>;
-   |                 ^^^^^^^^^^^^^ assignment requires that `'a` must outlive `'b`
+   |                 ^^^^^^^^^^^^^ assignment requires that `'b` must outlive `'a`
    |
-   = help: consider adding the following bound: `'a: 'b`
+   = help: consider adding the following bound: `'b: 'a`
    = note: requirement occurs because of a function pointer to `foo`
    = note: the function `foo` is invariant over the parameter `T`
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
@@ -22,9 +22,9 @@ LL | fn f<'a, 'b, 'c: 'a + 'b>(a: &'a (), b: &'b (), c: &'c ()) {
    |      lifetime `'a` defined here
 LL |     let mut x = foo::<&'a ()>;
 LL |     x = foo::<&'b ()>;
-   |     ^^^^^^^^^^^^^^^^^ assignment requires that `'b` must outlive `'a`
+   |     ^^^^^^^^^^^^^^^^^ assignment requires that `'a` must outlive `'b`
    |
-   = help: consider adding the following bound: `'b: 'a`
+   = help: consider adding the following bound: `'a: 'b`
    = note: requirement occurs because of a function pointer to `foo`
    = note: the function `foo` is invariant over the parameter `T`
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
@@ -53,9 +53,9 @@ LL | fn i<'a, 'b, 'c: 'a + 'b>(a: &'a (), b: &'b (), c: &'c ()) {
    |      lifetime `'a` defined here
 LL |     let mut x = foo::<&'c ()>;
 LL |     x = foo::<&'b ()>;
-   |     ^^^^^^^^^^^^^^^^^ assignment requires that `'b` must outlive `'a`
+   |     ^^^^^^^^^^^^^^^^^ assignment requires that `'a` must outlive `'b`
    |
-   = help: consider adding the following bound: `'b: 'a`
+   = help: consider adding the following bound: `'a: 'b`
    = note: requirement occurs because of a function pointer to `foo`
    = note: the function `foo` is invariant over the parameter `T`
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
@@ -69,9 +69,9 @@ LL | fn i<'a, 'b, 'c: 'a + 'b>(a: &'a (), b: &'b (), c: &'c ()) {
    |      lifetime `'a` defined here
 ...
 LL |     x = foo::<&'a ()>;
-   |     ^^^^^^^^^^^^^^^^^ assignment requires that `'a` must outlive `'b`
+   |     ^^^^^^^^^^^^^^^^^ assignment requires that `'b` must outlive `'a`
    |
-   = help: consider adding the following bound: `'a: 'b`
+   = help: consider adding the following bound: `'b: 'a`
    = note: requirement occurs because of a function pointer to `foo`
    = note: the function `foo` is invariant over the parameter `T`
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
@@ -89,9 +89,9 @@ LL | fn j<'a, 'b, 'c: 'a + 'b>(a: &'a (), b: &'b (), c: &'c ()) {
    |      lifetime `'a` defined here
 LL |     let x = match true {
 LL |         true => foo::<&'b ()>,
-   |                 ^^^^^^^^^^^^^ assignment requires that `'b` must outlive `'a`
+   |                 ^^^^^^^^^^^^^ assignment requires that `'a` must outlive `'b`
    |
-   = help: consider adding the following bound: `'b: 'a`
+   = help: consider adding the following bound: `'a: 'b`
    = note: requirement occurs because of a function pointer to `foo`
    = note: the function `foo` is invariant over the parameter `T`
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
@@ -105,9 +105,9 @@ LL | fn j<'a, 'b, 'c: 'a + 'b>(a: &'a (), b: &'b (), c: &'c ()) {
    |      lifetime `'a` defined here
 ...
 LL |         false => foo::<&'a ()>,
-   |                  ^^^^^^^^^^^^^ assignment requires that `'a` must outlive `'b`
+   |                  ^^^^^^^^^^^^^ assignment requires that `'b` must outlive `'a`
    |
-   = help: consider adding the following bound: `'a: 'b`
+   = help: consider adding the following bound: `'b: 'a`
    = note: requirement occurs because of a function pointer to `foo`
    = note: the function `foo` is invariant over the parameter `T`
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
@@ -117,15 +117,15 @@ help: `'a` and `'b` must be the same: replace one with the other
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: lifetime may not live long enough
-  --> $DIR/fn_def_coercion.rs:50:18
+  --> $DIR/fn_def_coercion.rs:49:17
    |
 LL | fn k<'a, 'b, 'c: 'a + 'b>(a: &'a (), b: &'b (), c: &'c ()) {
    |      --      -- lifetime `'c` defined here
    |      |
    |      lifetime `'a` defined here
-...
-LL |         false => foo::<&'a ()>,
-   |                  ^^^^^^^^^^^^^ assignment requires that `'a` must outlive `'c`
+LL |     let x = match true {
+LL |         true => foo::<&'c ()>,
+   |                 ^^^^^^^^^^^^^ assignment requires that `'a` must outlive `'c`
    |
    = help: consider adding the following bound: `'a: 'c`
    = note: requirement occurs because of a function pointer to `foo`
@@ -133,17 +133,20 @@ LL |         false => foo::<&'a ()>,
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: lifetime may not live long enough
-  --> $DIR/fn_def_coercion.rs:54:5
+  --> $DIR/fn_def_coercion.rs:50:18
    |
 LL | fn k<'a, 'b, 'c: 'a + 'b>(a: &'a (), b: &'b (), c: &'c ()) {
    |      --  -- lifetime `'b` defined here
    |      |
    |      lifetime `'a` defined here
 ...
-LL |     x(b);
-   |     ^^^^ argument requires that `'b` must outlive `'a`
+LL |         false => foo::<&'a ()>,
+   |                  ^^^^^^^^^^^^^ assignment requires that `'b` must outlive `'a`
    |
    = help: consider adding the following bound: `'b: 'a`
+   = note: requirement occurs because of a function pointer to `foo`
+   = note: the function `foo` is invariant over the parameter `T`
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 help: the following changes may resolve your lifetime errors
    |
diff --git a/tests/ui/fn/implied-bounds-unnorm-associated-type-2.stderr b/tests/ui/fn/implied-bounds-unnorm-associated-type-2.stderr
index e57b5af82cd..85e3452fbf2 100644
--- a/tests/ui/fn/implied-bounds-unnorm-associated-type-2.stderr
+++ b/tests/ui/fn/implied-bounds-unnorm-associated-type-2.stderr
@@ -6,7 +6,7 @@ LL | fn g<'a, 'b>() {
    |      |
    |      lifetime `'a` defined here
 LL |     f::<'a, 'b>(());
-   |     ^^^^^^^^^^^^^^^ requires that `'b` must outlive `'a`
+   |     ^^^^^^^^^^^^^^^ generic argument requires that `'b` must outlive `'a`
    |
    = help: consider adding the following bound: `'b: 'a`
    = note: requirement occurs because of a function pointer to `f`
diff --git a/tests/ui/force-inlining/asm.rs b/tests/ui/force-inlining/asm.rs
new file mode 100644
index 00000000000..85014ffa515
--- /dev/null
+++ b/tests/ui/force-inlining/asm.rs
@@ -0,0 +1,68 @@
+//@ build-fail
+//@ compile-flags: --crate-type=lib --target thumbv4t-none-eabi
+//@ needs-llvm-components: arm
+
+// Checks that forced inlining won't mix asm with incompatible instruction sets.
+
+#![crate_type = "lib"]
+#![feature(rustc_attrs)]
+#![feature(no_core, lang_items)]
+#![no_core]
+
+#[lang = "sized"]
+pub trait Sized {}
+#[lang = "copy"]
+pub trait Copy {}
+#[lang = "freeze"]
+pub unsafe trait Freeze {}
+
+#[lang = "start"]
+fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
+    0
+}
+
+#[rustc_builtin_macro]
+#[macro_export]
+macro_rules! asm {
+    ("assembly template",
+        $(operands,)*
+        $(options($(option),*))?
+    ) => {
+        /* compiler built-in */
+    };
+}
+
+#[instruction_set(arm::a32)]
+#[rustc_force_inline]
+fn instruction_set_a32() {}
+
+#[instruction_set(arm::t32)]
+#[rustc_force_inline]
+fn instruction_set_t32() {}
+
+#[rustc_force_inline]
+fn instruction_set_default() {}
+
+#[rustc_force_inline]
+fn inline_always_and_using_inline_asm() {
+    unsafe { asm!("/* do nothing */") };
+}
+
+#[instruction_set(arm::t32)]
+pub fn t32() {
+    instruction_set_a32();
+//~^ ERROR `instruction_set_a32` could not be inlined into `t32` but is required to be inlined
+    instruction_set_t32();
+    instruction_set_default();
+    inline_always_and_using_inline_asm();
+//~^ ERROR `inline_always_and_using_inline_asm` could not be inlined into `t32` but is required to be inlined
+}
+
+pub fn default() {
+    instruction_set_a32();
+//~^ ERROR `instruction_set_a32` could not be inlined into `default` but is required to be inlined
+    instruction_set_t32();
+//~^ ERROR `instruction_set_t32` could not be inlined into `default` but is required to be inlined
+    instruction_set_default();
+    inline_always_and_using_inline_asm();
+}
diff --git a/tests/ui/force-inlining/asm.stderr b/tests/ui/force-inlining/asm.stderr
new file mode 100644
index 00000000000..ef04688965b
--- /dev/null
+++ b/tests/ui/force-inlining/asm.stderr
@@ -0,0 +1,34 @@
+error: `instruction_set_a32` could not be inlined into `t32` but is required to be inlined
+  --> $DIR/asm.rs:53:5
+   |
+LL |     instruction_set_a32();
+   |     ^^^^^^^^^^^^^^^^^^^^^ ...`instruction_set_a32` called here
+   |
+   = note: could not be inlined due to: incompatible instruction set
+
+error: `inline_always_and_using_inline_asm` could not be inlined into `t32` but is required to be inlined
+  --> $DIR/asm.rs:57:5
+   |
+LL |     inline_always_and_using_inline_asm();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...`inline_always_and_using_inline_asm` called here
+   |
+   = note: could not be inlined due to: cannot move inline-asm across instruction sets
+
+error: `instruction_set_a32` could not be inlined into `default` but is required to be inlined
+  --> $DIR/asm.rs:62:5
+   |
+LL |     instruction_set_a32();
+   |     ^^^^^^^^^^^^^^^^^^^^^ ...`instruction_set_a32` called here
+   |
+   = note: could not be inlined due to: incompatible instruction set
+
+error: `instruction_set_t32` could not be inlined into `default` but is required to be inlined
+  --> $DIR/asm.rs:64:5
+   |
+LL |     instruction_set_t32();
+   |     ^^^^^^^^^^^^^^^^^^^^^ ...`instruction_set_t32` called here
+   |
+   = note: could not be inlined due to: incompatible instruction set
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/force-inlining/auxiliary/callees.rs b/tests/ui/force-inlining/auxiliary/callees.rs
new file mode 100644
index 00000000000..7468b8f1098
--- /dev/null
+++ b/tests/ui/force-inlining/auxiliary/callees.rs
@@ -0,0 +1,10 @@
+//@ compile-flags: --crate-type=lib
+#![feature(rustc_attrs)]
+
+#[rustc_force_inline = "the test requires it"]
+pub fn forced_with_reason() {
+}
+
+#[rustc_force_inline]
+pub fn forced() {
+}
diff --git a/tests/ui/force-inlining/cast.rs b/tests/ui/force-inlining/cast.rs
new file mode 100644
index 00000000000..8f51ec83977
--- /dev/null
+++ b/tests/ui/force-inlining/cast.rs
@@ -0,0 +1,25 @@
+//@ check-fail
+//@ compile-flags: --crate-type=lib
+#![allow(internal_features)]
+#![feature(rustc_attrs)]
+
+#[rustc_force_inline]
+pub fn callee(x: isize) -> usize { unimplemented!() }
+
+fn a() {
+    let _: fn(isize) -> usize = callee;
+//~^ ERROR cannot coerce functions which must be inlined to function pointers
+}
+
+fn b() {
+    let _ = callee as fn(isize) -> usize;
+//~^ ERROR non-primitive cast
+}
+
+fn c() {
+    let _: [fn(isize) -> usize; 2] = [
+        callee,
+//~^ ERROR cannot coerce functions which must be inlined to function pointers
+        callee,
+    ];
+}
diff --git a/tests/ui/force-inlining/cast.stderr b/tests/ui/force-inlining/cast.stderr
new file mode 100644
index 00000000000..116919e5fe7
--- /dev/null
+++ b/tests/ui/force-inlining/cast.stderr
@@ -0,0 +1,40 @@
+error[E0308]: cannot coerce functions which must be inlined to function pointers
+  --> $DIR/cast.rs:10:33
+   |
+LL |     let _: fn(isize) -> usize = callee;
+   |            ------------------   ^^^^^^ cannot coerce functions which must be inlined to function pointers
+   |            |
+   |            expected due to this
+   |
+   = note: expected fn pointer `fn(_) -> _`
+                 found fn item `fn(_) -> _ {callee}`
+   = note: fn items are distinct from fn pointers
+help: consider casting to a fn pointer
+   |
+LL |     let _: fn(isize) -> usize = callee as fn(isize) -> usize;
+   |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+error[E0605]: non-primitive cast: `fn(isize) -> usize {callee}` as `fn(isize) -> usize`
+  --> $DIR/cast.rs:15:13
+   |
+LL |     let _ = callee as fn(isize) -> usize;
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid cast
+
+error[E0308]: cannot coerce functions which must be inlined to function pointers
+  --> $DIR/cast.rs:21:9
+   |
+LL |         callee,
+   |         ^^^^^^ cannot coerce functions which must be inlined to function pointers
+   |
+   = note: expected fn pointer `fn(_) -> _`
+                 found fn item `fn(_) -> _ {callee}`
+   = note: fn items are distinct from fn pointers
+help: consider casting to a fn pointer
+   |
+LL |         callee as fn(isize) -> usize,
+   |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0308, E0605.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/tests/ui/force-inlining/cross-crate.rs b/tests/ui/force-inlining/cross-crate.rs
new file mode 100644
index 00000000000..a3f0c2c873e
--- /dev/null
+++ b/tests/ui/force-inlining/cross-crate.rs
@@ -0,0 +1,13 @@
+//@ aux-build:callees.rs
+//@ build-pass
+//@ compile-flags: --crate-type=lib
+
+extern crate callees;
+
+// Test that forced inlining across crates works as expected.
+
+pub fn caller() {
+    callees::forced();
+
+    callees::forced_with_reason();
+}
diff --git a/tests/ui/force-inlining/deny-async.rs b/tests/ui/force-inlining/deny-async.rs
new file mode 100644
index 00000000000..bdf6271bd2a
--- /dev/null
+++ b/tests/ui/force-inlining/deny-async.rs
@@ -0,0 +1,24 @@
+//@ check-fail
+//@ compile-flags: --crate-type=lib
+//@ edition: 2021
+#![allow(internal_features)]
+#![feature(rustc_attrs)]
+
+// Test that forced inlining into async functions w/ errors works as expected.
+
+#[rustc_no_mir_inline]
+#[rustc_force_inline]
+//~^ ERROR `callee` is incompatible with `#[rustc_force_inline]`
+pub fn callee() {
+}
+
+#[rustc_no_mir_inline]
+#[rustc_force_inline = "the test requires it"]
+//~^ ERROR `callee_justified` is incompatible with `#[rustc_force_inline]`
+pub fn callee_justified() {
+}
+
+async fn async_caller() {
+    callee();
+    callee_justified();
+}
diff --git a/tests/ui/force-inlining/deny-async.stderr b/tests/ui/force-inlining/deny-async.stderr
new file mode 100644
index 00000000000..302ca419071
--- /dev/null
+++ b/tests/ui/force-inlining/deny-async.stderr
@@ -0,0 +1,24 @@
+error: `callee` is incompatible with `#[rustc_force_inline]`
+  --> $DIR/deny-async.rs:10:1
+   |
+LL | #[rustc_force_inline]
+   | ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | pub fn callee() {
+   | --------------- `callee` defined here
+   |
+   = note: incompatible due to: #[rustc_no_mir_inline]
+
+error: `callee_justified` is incompatible with `#[rustc_force_inline]`
+  --> $DIR/deny-async.rs:16:1
+   |
+LL | #[rustc_force_inline = "the test requires it"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | pub fn callee_justified() {
+   | ------------------------- `callee_justified` defined here
+   |
+   = note: incompatible due to: #[rustc_no_mir_inline]
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/force-inlining/deny-closure.rs b/tests/ui/force-inlining/deny-closure.rs
new file mode 100644
index 00000000000..31314c450fc
--- /dev/null
+++ b/tests/ui/force-inlining/deny-closure.rs
@@ -0,0 +1,25 @@
+//@ check-fail
+//@ compile-flags: --crate-type=lib
+#![allow(internal_features)]
+#![feature(rustc_attrs)]
+
+// Test that forced inlining into closures w/ errors works as expected.
+
+#[rustc_no_mir_inline]
+#[rustc_force_inline]
+//~^ ERROR `callee` is incompatible with `#[rustc_force_inline]`
+pub fn callee() {
+}
+
+#[rustc_no_mir_inline]
+#[rustc_force_inline = "the test requires it"]
+//~^ ERROR `callee_justified` is incompatible with `#[rustc_force_inline]`
+pub fn callee_justified() {
+}
+
+pub fn caller() {
+    (|| {
+        callee();
+        callee_justified();
+    })();
+}
diff --git a/tests/ui/force-inlining/deny-closure.stderr b/tests/ui/force-inlining/deny-closure.stderr
new file mode 100644
index 00000000000..e657a295420
--- /dev/null
+++ b/tests/ui/force-inlining/deny-closure.stderr
@@ -0,0 +1,24 @@
+error: `callee` is incompatible with `#[rustc_force_inline]`
+  --> $DIR/deny-closure.rs:9:1
+   |
+LL | #[rustc_force_inline]
+   | ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | pub fn callee() {
+   | --------------- `callee` defined here
+   |
+   = note: incompatible due to: #[rustc_no_mir_inline]
+
+error: `callee_justified` is incompatible with `#[rustc_force_inline]`
+  --> $DIR/deny-closure.rs:15:1
+   |
+LL | #[rustc_force_inline = "the test requires it"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | pub fn callee_justified() {
+   | ------------------------- `callee_justified` defined here
+   |
+   = note: incompatible due to: #[rustc_no_mir_inline]
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/force-inlining/deny.rs b/tests/ui/force-inlining/deny.rs
new file mode 100644
index 00000000000..7712f5f50f3
--- /dev/null
+++ b/tests/ui/force-inlining/deny.rs
@@ -0,0 +1,23 @@
+//@ check-fail
+//@ compile-flags: --crate-type=lib
+#![allow(internal_features)]
+#![feature(rustc_attrs)]
+
+// Test that forced inlining w/ errors works as expected.
+
+#[rustc_no_mir_inline]
+#[rustc_force_inline]
+//~^ ERROR `callee` is incompatible with `#[rustc_force_inline]`
+pub fn callee() {
+}
+
+#[rustc_no_mir_inline]
+#[rustc_force_inline = "the test requires it"]
+//~^ ERROR `callee_justified` is incompatible with `#[rustc_force_inline]`
+pub fn callee_justified() {
+}
+
+pub fn caller() {
+    callee();
+    callee_justified();
+}
diff --git a/tests/ui/force-inlining/deny.stderr b/tests/ui/force-inlining/deny.stderr
new file mode 100644
index 00000000000..c276fa28ba8
--- /dev/null
+++ b/tests/ui/force-inlining/deny.stderr
@@ -0,0 +1,24 @@
+error: `callee` is incompatible with `#[rustc_force_inline]`
+  --> $DIR/deny.rs:9:1
+   |
+LL | #[rustc_force_inline]
+   | ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | pub fn callee() {
+   | --------------- `callee` defined here
+   |
+   = note: incompatible due to: #[rustc_no_mir_inline]
+
+error: `callee_justified` is incompatible with `#[rustc_force_inline]`
+  --> $DIR/deny.rs:15:1
+   |
+LL | #[rustc_force_inline = "the test requires it"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | pub fn callee_justified() {
+   | ------------------------- `callee_justified` defined here
+   |
+   = note: incompatible due to: #[rustc_no_mir_inline]
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/force-inlining/early-deny.rs b/tests/ui/force-inlining/early-deny.rs
new file mode 100644
index 00000000000..99b03a4e0e2
--- /dev/null
+++ b/tests/ui/force-inlining/early-deny.rs
@@ -0,0 +1,21 @@
+//@ check-fail
+//@ compile-flags: --crate-type=lib
+#![feature(c_variadic)]
+#![feature(rustc_attrs)]
+
+#[rustc_no_mir_inline]
+#[rustc_force_inline]
+//~^ ERROR `rustc_attr` is incompatible with `#[rustc_force_inline]`
+pub fn rustc_attr() {
+}
+
+#[cold]
+#[rustc_force_inline]
+//~^ ERROR `cold` is incompatible with `#[rustc_force_inline]`
+pub fn cold() {
+}
+
+#[rustc_force_inline]
+//~^ ERROR `variadic` is incompatible with `#[rustc_force_inline]`
+pub unsafe extern "C" fn variadic(args: ...) {
+}
diff --git a/tests/ui/force-inlining/early-deny.stderr b/tests/ui/force-inlining/early-deny.stderr
new file mode 100644
index 00000000000..abee66fd293
--- /dev/null
+++ b/tests/ui/force-inlining/early-deny.stderr
@@ -0,0 +1,35 @@
+error: `rustc_attr` is incompatible with `#[rustc_force_inline]`
+  --> $DIR/early-deny.rs:7:1
+   |
+LL | #[rustc_force_inline]
+   | ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | pub fn rustc_attr() {
+   | ------------------- `rustc_attr` defined here
+   |
+   = note: incompatible due to: #[rustc_no_mir_inline]
+
+error: `cold` is incompatible with `#[rustc_force_inline]`
+  --> $DIR/early-deny.rs:13:1
+   |
+LL | #[rustc_force_inline]
+   | ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | pub fn cold() {
+   | ------------- `cold` defined here
+   |
+   = note: incompatible due to: cold
+
+error: `variadic` is incompatible with `#[rustc_force_inline]`
+  --> $DIR/early-deny.rs:18:1
+   |
+LL | #[rustc_force_inline]
+   | ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | pub unsafe extern "C" fn variadic(args: ...) {
+   | -------------------------------------------- `variadic` defined here
+   |
+   = note: incompatible due to: C variadic
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/force-inlining/gate.rs b/tests/ui/force-inlining/gate.rs
new file mode 100644
index 00000000000..d6a01a74a44
--- /dev/null
+++ b/tests/ui/force-inlining/gate.rs
@@ -0,0 +1,12 @@
+//@ compile-flags: --crate-type=lib
+#![allow(internal_features)]
+
+#[rustc_force_inline]
+//~^ ERROR #![rustc_force_inline] forces a free function to be inlined
+pub fn bare() {
+}
+
+#[rustc_force_inline = "the test requires it"]
+//~^ ERROR #![rustc_force_inline] forces a free function to be inlined
+pub fn justified() {
+}
diff --git a/tests/ui/force-inlining/gate.stderr b/tests/ui/force-inlining/gate.stderr
new file mode 100644
index 00000000000..e3973a08c23
--- /dev/null
+++ b/tests/ui/force-inlining/gate.stderr
@@ -0,0 +1,21 @@
+error[E0658]: #![rustc_force_inline] forces a free function to be inlined
+  --> $DIR/gate.rs:4:1
+   |
+LL | #[rustc_force_inline]
+   | ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0658]: #![rustc_force_inline] forces a free function to be inlined
+  --> $DIR/gate.rs:9:1
+   |
+LL | #[rustc_force_inline = "the test requires it"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/force-inlining/invalid.rs b/tests/ui/force-inlining/invalid.rs
new file mode 100644
index 00000000000..7574078b245
--- /dev/null
+++ b/tests/ui/force-inlining/invalid.rs
@@ -0,0 +1,164 @@
+//@ edition: 2024
+#![allow(internal_features, unused_imports, unused_macros)]
+#![feature(extern_types)]
+#![feature(gen_blocks)]
+#![feature(rustc_attrs)]
+#![feature(stmt_expr_attributes)]
+#![feature(trait_alias)]
+
+// Test that invalid force inlining attributes error as expected.
+
+#[rustc_force_inline("foo")]
+//~^ ERROR malformed `rustc_force_inline` attribute input
+pub fn forced1() {
+}
+
+#[rustc_force_inline(bar, baz)]
+//~^ ERROR malformed `rustc_force_inline` attribute input
+pub fn forced2() {
+}
+
+#[rustc_force_inline(2)]
+//~^ ERROR malformed `rustc_force_inline` attribute input
+pub fn forced3() {
+}
+
+#[rustc_force_inline = 2]
+//~^ ERROR malformed `rustc_force_inline` attribute input
+pub fn forced4() {
+}
+
+#[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+extern crate std as other_std;
+
+#[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+use std::collections::HashMap;
+
+#[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+static _FOO: &'static str = "FOO";
+
+#[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+const _BAR: u32 = 3;
+
+#[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+mod foo { }
+
+#[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+unsafe extern "C" {
+    #[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+    static X: &'static u32;
+
+    #[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+    type Y;
+
+    #[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+    fn foo();
+}
+
+#[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+type Foo = u32;
+
+#[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+enum Bar<#[rustc_force_inline] T> {
+//~^ ERROR attribute should be applied to a function
+    #[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+    Baz(std::marker::PhantomData<T>),
+}
+
+#[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+struct Qux {
+    #[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+    field: u32,
+}
+
+#[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+union FooBar {
+    x: u32,
+    y: u32,
+}
+
+#[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+trait FooBaz {
+    #[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+    type Foo;
+    #[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+    const Bar: i32;
+
+    #[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+    fn foo() {}
+}
+
+#[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+trait FooQux = FooBaz;
+
+#[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+impl<T> Bar<T> {
+    #[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+    fn foo() {}
+}
+
+#[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+impl<T> FooBaz for Bar<T> {
+    type Foo = u32;
+    const Bar: i32 = 3;
+}
+
+#[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+macro_rules! barqux { ($foo:tt) => { $foo }; }
+
+fn barqux(#[rustc_force_inline] _x: u32) {}
+//~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+//~^^ ERROR attribute should be applied to a function
+
+#[rustc_force_inline]
+//~^ ERROR attribute cannot be applied to a `async`, `gen` or `async gen` function
+async fn async_foo() {}
+
+#[rustc_force_inline]
+//~^ ERROR attribute cannot be applied to a `async`, `gen` or `async gen` function
+gen fn gen_foo() {}
+
+#[rustc_force_inline]
+//~^ ERROR attribute cannot be applied to a `async`, `gen` or `async gen` function
+async gen fn async_gen_foo() {}
+
+fn main() {
+    let _x = #[rustc_force_inline] || { };
+//~^ ERROR attribute should be applied to a function
+    let _y = #[rustc_force_inline] 3 + 4;
+//~^ ERROR attribute should be applied to a function
+    #[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+    let _z = 3;
+
+    match _z {
+        #[rustc_force_inline]
+//~^ ERROR attribute should be applied to a function
+        1 => (),
+        _ => (),
+    }
+}
diff --git a/tests/ui/force-inlining/invalid.stderr b/tests/ui/force-inlining/invalid.stderr
new file mode 100644
index 00000000000..5d280124129
--- /dev/null
+++ b/tests/ui/force-inlining/invalid.stderr
@@ -0,0 +1,377 @@
+error: malformed `rustc_force_inline` attribute input
+  --> $DIR/invalid.rs:11:1
+   |
+LL | #[rustc_force_inline("foo")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: the following are the possible correct uses
+   |
+LL | #[rustc_force_inline = "reason"]
+   |
+LL | #[rustc_force_inline]
+   |
+
+error: malformed `rustc_force_inline` attribute input
+  --> $DIR/invalid.rs:16:1
+   |
+LL | #[rustc_force_inline(bar, baz)]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: the following are the possible correct uses
+   |
+LL | #[rustc_force_inline = "reason"]
+   |
+LL | #[rustc_force_inline]
+   |
+
+error: malformed `rustc_force_inline` attribute input
+  --> $DIR/invalid.rs:21:1
+   |
+LL | #[rustc_force_inline(2)]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: the following are the possible correct uses
+   |
+LL | #[rustc_force_inline = "reason"]
+   |
+LL | #[rustc_force_inline]
+   |
+
+error: malformed `rustc_force_inline` attribute input
+  --> $DIR/invalid.rs:26:1
+   |
+LL | #[rustc_force_inline = 2]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: the following are the possible correct uses
+   |
+LL | #[rustc_force_inline = "reason"]
+   |
+LL | #[rustc_force_inline]
+   |
+
+error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+  --> $DIR/invalid.rs:133:11
+   |
+LL | fn barqux(#[rustc_force_inline] _x: u32) {}
+   |           ^^^^^^^^^^^^^^^^^^^^^
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:31:1
+   |
+LL | #[rustc_force_inline]
+   | ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | extern crate std as other_std;
+   | ------------------------------ not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:35:1
+   |
+LL | #[rustc_force_inline]
+   | ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | use std::collections::HashMap;
+   | ------------------------------ not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:39:1
+   |
+LL | #[rustc_force_inline]
+   | ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | static _FOO: &'static str = "FOO";
+   | ---------------------------------- not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:43:1
+   |
+LL | #[rustc_force_inline]
+   | ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | const _BAR: u32 = 3;
+   | -------------------- not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:47:1
+   |
+LL | #[rustc_force_inline]
+   | ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | mod foo { }
+   | ----------- not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:51:1
+   |
+LL |   #[rustc_force_inline]
+   |   ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | / unsafe extern "C" {
+LL | |     #[rustc_force_inline]
+LL | |
+LL | |     static X: &'static u32;
+...  |
+LL | |     fn foo();
+LL | | }
+   | |_- not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:67:1
+   |
+LL | #[rustc_force_inline]
+   | ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | type Foo = u32;
+   | --------------- not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:71:1
+   |
+LL |   #[rustc_force_inline]
+   |   ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | / enum Bar<#[rustc_force_inline] T> {
+LL | |
+LL | |     #[rustc_force_inline]
+...  |
+LL | | }
+   | |_- not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:73:10
+   |
+LL | enum Bar<#[rustc_force_inline] T> {
+   |          ^^^^^^^^^^^^^^^^^^^^^ - not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:75:5
+   |
+LL |     #[rustc_force_inline]
+   |     ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL |     Baz(std::marker::PhantomData<T>),
+   |     -------------------------------- not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:80:1
+   |
+LL |   #[rustc_force_inline]
+   |   ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | / struct Qux {
+LL | |     #[rustc_force_inline]
+LL | |
+LL | |     field: u32,
+LL | | }
+   | |_- not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:83:5
+   |
+LL |     #[rustc_force_inline]
+   |     ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL |     field: u32,
+   |     ---------- not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:88:1
+   |
+LL |   #[rustc_force_inline]
+   |   ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | / union FooBar {
+LL | |     x: u32,
+LL | |     y: u32,
+LL | | }
+   | |_- not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:95:1
+   |
+LL |   #[rustc_force_inline]
+   |   ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | / trait FooBaz {
+LL | |     #[rustc_force_inline]
+LL | |
+LL | |     type Foo;
+...  |
+LL | |     fn foo() {}
+LL | | }
+   | |_- not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:110:1
+   |
+LL | #[rustc_force_inline]
+   | ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | trait FooQux = FooBaz;
+   | ---------------------- not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:114:1
+   |
+LL |   #[rustc_force_inline]
+   |   ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | / impl<T> Bar<T> {
+LL | |     #[rustc_force_inline]
+LL | |
+LL | |     fn foo() {}
+LL | | }
+   | |_- not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:122:1
+   |
+LL |   #[rustc_force_inline]
+   |   ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | / impl<T> FooBaz for Bar<T> {
+LL | |     type Foo = u32;
+LL | |     const Bar: i32 = 3;
+LL | | }
+   | |_- not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:129:1
+   |
+LL | #[rustc_force_inline]
+   | ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | macro_rules! barqux { ($foo:tt) => { $foo }; }
+   | ---------------------------------------------- not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:133:11
+   |
+LL | fn barqux(#[rustc_force_inline] _x: u32) {}
+   |           ^^^^^^^^^^^^^^^^^^^^^--------
+   |           |
+   |           not a function definition
+
+error: attribute cannot be applied to a `async`, `gen` or `async gen` function
+  --> $DIR/invalid.rs:137:1
+   |
+LL | #[rustc_force_inline]
+   | ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | async fn async_foo() {}
+   | -------------------- `async`, `gen` or `async gen` function
+
+error: attribute cannot be applied to a `async`, `gen` or `async gen` function
+  --> $DIR/invalid.rs:141:1
+   |
+LL | #[rustc_force_inline]
+   | ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | gen fn gen_foo() {}
+   | ---------------- `async`, `gen` or `async gen` function
+
+error: attribute cannot be applied to a `async`, `gen` or `async gen` function
+  --> $DIR/invalid.rs:145:1
+   |
+LL | #[rustc_force_inline]
+   | ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | async gen fn async_gen_foo() {}
+   | ---------------------------- `async`, `gen` or `async gen` function
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:150:14
+   |
+LL |     let _x = #[rustc_force_inline] || { };
+   |              ^^^^^^^^^^^^^^^^^^^^^ ------ not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:152:14
+   |
+LL |     let _y = #[rustc_force_inline] 3 + 4;
+   |              ^^^^^^^^^^^^^^^^^^^^^ - not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:154:5
+   |
+LL |     #[rustc_force_inline]
+   |     ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL |     let _z = 3;
+   |     ----------- not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:159:9
+   |
+LL |         #[rustc_force_inline]
+   |         ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL |         1 => (),
+   |         ------- not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:98:5
+   |
+LL |     #[rustc_force_inline]
+   |     ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL |     type Foo;
+   |     --------- not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:101:5
+   |
+LL |     #[rustc_force_inline]
+   |     ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL |     const Bar: i32;
+   |     --------------- not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:105:5
+   |
+LL |     #[rustc_force_inline]
+   |     ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL |     fn foo() {}
+   |     ----------- not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:117:5
+   |
+LL |     #[rustc_force_inline]
+   |     ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL |     fn foo() {}
+   |     ----------- not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:54:5
+   |
+LL |     #[rustc_force_inline]
+   |     ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL |     static X: &'static u32;
+   |     ----------------------- not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:58:5
+   |
+LL |     #[rustc_force_inline]
+   |     ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL |     type Y;
+   |     ------- not a function definition
+
+error: attribute should be applied to a function
+  --> $DIR/invalid.rs:62:5
+   |
+LL |     #[rustc_force_inline]
+   |     ^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL |     fn foo();
+   |     --------- not a function definition
+
+error: aborting due to 38 previous errors
+
diff --git a/tests/ui/force-inlining/shims.rs b/tests/ui/force-inlining/shims.rs
new file mode 100644
index 00000000000..03b7d07cda3
--- /dev/null
+++ b/tests/ui/force-inlining/shims.rs
@@ -0,0 +1,9 @@
+//@ build-pass
+#![allow(internal_features)]
+#![feature(rustc_attrs)]
+
+#[rustc_force_inline]
+fn f() {}
+fn g<T: FnOnce()>(t: T) { t(); }
+
+fn main() { g(f); }
diff --git a/tests/ui/generic-const-items/recursive.rs b/tests/ui/generic-const-items/recursive.rs
index 8244772168b..94cf98ec64b 100644
--- a/tests/ui/generic-const-items/recursive.rs
+++ b/tests/ui/generic-const-items/recursive.rs
@@ -1,12 +1,11 @@
-// FIXME(generic_const_items): This leads to a stack overflow in the compiler!
-//@ known-bug: unknown
-//@ ignore-test
+//@ build-fail
 
 #![feature(generic_const_items)]
 #![allow(incomplete_features)]
+#![recursion_limit = "15"]
 
 const RECUR<T>: () = RECUR::<(T,)>;
 
 fn main() {
-    let _ = RECUR::<()>;
+    let _ = RECUR::<()>; //~ ERROR: queries overflow the depth limit!
 }
diff --git a/tests/ui/generic-const-items/recursive.stderr b/tests/ui/generic-const-items/recursive.stderr
new file mode 100644
index 00000000000..c9a57937428
--- /dev/null
+++ b/tests/ui/generic-const-items/recursive.stderr
@@ -0,0 +1,11 @@
+error: queries overflow the depth limit!
+  --> $DIR/recursive.rs:10:13
+   |
+LL |     let _ = RECUR::<()>;
+   |             ^^^^^^^^^^^
+   |
+   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "30"]` attribute to your crate (`recursive`)
+   = note: query depth increased by 17 when simplifying constant for the type system `RECUR`
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.edition2021.stderr b/tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.edition2021.stderr
index 1e268bc7f49..112341287f8 100644
--- a/tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.edition2021.stderr
+++ b/tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.edition2021.stderr
@@ -9,6 +9,18 @@ help: you can add the `dyn` keyword if you want a trait object
 LL | fn ice() -> impl AsRef<dyn Fn(&())> {
    |                        +++
 
-error: aborting due to 1 previous error
+error[E0782]: expected a type, found a trait
+  --> $DIR/generic-with-implicit-hrtb-without-dyn.rs:6:24
+   |
+LL | fn ice() -> impl AsRef<Fn(&())> {
+   |                        ^^^^^^^
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: you can add the `dyn` keyword if you want a trait object
+   |
+LL | fn ice() -> impl AsRef<dyn Fn(&())> {
+   |                        +++
+
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0782`.
diff --git a/tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.rs b/tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.rs
index c71f794d5d1..df43250f151 100644
--- a/tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.rs
+++ b/tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.rs
@@ -6,6 +6,7 @@
 fn ice() -> impl AsRef<Fn(&())> {
     //[edition2015]~^ ERROR: the trait bound `(): AsRef<(dyn for<'a> Fn(&'a ()) + 'static)>` is not satisfied [E0277]
     //[edition2021]~^^ ERROR: expected a type, found a trait [E0782]
+    //[edition2021]~| ERROR: expected a type, found a trait [E0782]
     todo!()
 }
 
diff --git a/tests/ui/impl-trait/issue-99073-2.stderr b/tests/ui/impl-trait/issue-99073-2.stderr
index 06b2b84569f..0bcac7c7c53 100644
--- a/tests/ui/impl-trait/issue-99073-2.stderr
+++ b/tests/ui/impl-trait/issue-99073-2.stderr
@@ -1,12 +1,3 @@
-error[E0792]: expected generic type parameter, found `i32`
-  --> $DIR/issue-99073-2.rs:9:22
-   |
-LL | fn test<T: Display>(t: T, recurse: bool) -> impl Display {
-   |         - this generic parameter must be used with a generic type parameter
-LL |     let f = || {
-LL |         let i: u32 = test::<i32>(-1, false);
-   |                      ^^^^^^^^^^^^^^^^^^^^^^
-
 error: concrete type differs from previous defining opaque type use
   --> $DIR/issue-99073-2.rs:9:22
    |
@@ -19,6 +10,15 @@ note: previous use here
 LL | fn test<T: Display>(t: T, recurse: bool) -> impl Display {
    |                                             ^^^^^^^^^^^^
 
+error[E0792]: expected generic type parameter, found `i32`
+  --> $DIR/issue-99073-2.rs:9:22
+   |
+LL | fn test<T: Display>(t: T, recurse: bool) -> impl Display {
+   |         - this generic parameter must be used with a generic type parameter
+LL |     let f = || {
+LL |         let i: u32 = test::<i32>(-1, false);
+   |                      ^^^^^^^^^^^^^^^^^^^^^^
+
 error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/impl-trait/issue-99073.stderr b/tests/ui/impl-trait/issue-99073.stderr
index 3c32f1794a0..19854ef8940 100644
--- a/tests/ui/impl-trait/issue-99073.stderr
+++ b/tests/ui/impl-trait/issue-99073.stderr
@@ -1,11 +1,3 @@
-error[E0792]: expected generic type parameter, found `&F`
-  --> $DIR/issue-99073.rs:6:11
-   |
-LL | fn fix<F: Fn(G), G: Fn()>(f: F) -> impl Fn() {
-   |        - this generic parameter must be used with a generic type parameter
-LL |   move || f(fix(&f))
-   |           ^^^^^^^^^^
-
 error: concrete type differs from previous defining opaque type use
   --> $DIR/issue-99073.rs:6:13
    |
@@ -18,6 +10,14 @@ note: previous use here
 LL | fn fix<F: Fn(G), G: Fn()>(f: F) -> impl Fn() {
    |                                    ^^^^^^^^^
 
+error[E0792]: expected generic type parameter, found `&F`
+  --> $DIR/issue-99073.rs:6:11
+   |
+LL | fn fix<F: Fn(G), G: Fn()>(f: F) -> impl Fn() {
+   |        - this generic parameter must be used with a generic type parameter
+LL |   move || f(fix(&f))
+   |           ^^^^^^^^^^
+
 error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/impl-trait/multiple-defining-usages-in-body.stderr b/tests/ui/impl-trait/multiple-defining-usages-in-body.stderr
index faa5d3ba448..aaa1958b584 100644
--- a/tests/ui/impl-trait/multiple-defining-usages-in-body.stderr
+++ b/tests/ui/impl-trait/multiple-defining-usages-in-body.stderr
@@ -1,15 +1,3 @@
-warning: function cannot return without recursing
-  --> $DIR/multiple-defining-usages-in-body.rs:4:1
-   |
-LL | fn foo<T: Trait, U: Trait>() -> impl Trait {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
-LL |
-LL |     let a: T = foo::<T, U>();
-   |                ------------- recursive call site
-   |
-   = help: a `loop` may express intention better if this is on purpose
-   = note: `#[warn(unconditional_recursion)]` on by default
-
 error: concrete type differs from previous defining opaque type use
   --> $DIR/multiple-defining-usages-in-body.rs:8:16
    |
@@ -22,5 +10,17 @@ note: previous use here
 LL |     let a: T = foo::<T, U>();
    |                ^^^^^^^^^^^^^
 
+warning: function cannot return without recursing
+  --> $DIR/multiple-defining-usages-in-body.rs:4:1
+   |
+LL | fn foo<T: Trait, U: Trait>() -> impl Trait {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
+LL |
+LL |     let a: T = foo::<T, U>();
+   |                ------------- recursive call site
+   |
+   = help: a `loop` may express intention better if this is on purpose
+   = note: `#[warn(unconditional_recursion)]` on by default
+
 error: aborting due to 1 previous error; 1 warning emitted
 
diff --git a/tests/ui/impl-trait/multiple-lifetimes/error-handling.stderr b/tests/ui/impl-trait/multiple-lifetimes/error-handling.stderr
index 00709ee7438..945fb0fc618 100644
--- a/tests/ui/impl-trait/multiple-lifetimes/error-handling.stderr
+++ b/tests/ui/impl-trait/multiple-lifetimes/error-handling.stderr
@@ -6,6 +6,9 @@ LL | fn foo<'a, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> {
    |        |
    |        lifetime `'a` defined here
 ...
+LL |     let u = v;
+   |             - requirement occurs due to copying this value
+...
 LL |         let _: &'b i32 = *u.0;
    |                ^^^^^^^ type annotation requires that `'a` must outlive `'b`
    |
diff --git a/tests/ui/impl-trait/normalize-tait-in-const.stderr b/tests/ui/impl-trait/normalize-tait-in-const.stderr
index 0f79cefeaec..f4e8a872cec 100644
--- a/tests/ui/impl-trait/normalize-tait-in-const.stderr
+++ b/tests/ui/impl-trait/normalize-tait-in-const.stderr
@@ -17,20 +17,6 @@ note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_
   --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
-error[E0277]: the trait bound `for<'a, 'b> fn(&'a foo::Alias<'b>) {foo}: const Destruct` is not satisfied
-  --> $DIR/normalize-tait-in-const.rs:33:19
-   |
-LL |     with_positive(foo);
-   |     ------------- ^^^
-   |     |
-   |     required by a bound introduced by this call
-   |
-note: required by a bound in `with_positive`
-  --> $DIR/normalize-tait-in-const.rs:26:62
-   |
-LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
-   |                                                              ^^^^^^ required by this bound in `with_positive`
-
 error[E0015]: cannot call non-const closure in constant functions
   --> $DIR/normalize-tait-in-const.rs:27:5
    |
@@ -39,7 +25,6 @@ LL |     fun(filter_positive());
    |
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
 
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
 
-Some errors have detailed explanations: E0015, E0277.
-For more information about an error, try `rustc --explain E0015`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/impl-trait/precise-capturing/migration-note.rs b/tests/ui/impl-trait/precise-capturing/migration-note.rs
index 36db07e5764..7587e89409a 100644
--- a/tests/ui/impl-trait/precise-capturing/migration-note.rs
+++ b/tests/ui/impl-trait/precise-capturing/migration-note.rs
@@ -29,11 +29,11 @@ fn needs_static() {
     let a = display_len(&x);
     //~^ ERROR `x` does not live long enough
     //~| NOTE this call may capture more lifetimes than intended
-    //~| NOTE argument requires that `x` is borrowed for `'static`
     //~| NOTE borrowed value does not live long enoug
 
     fn needs_static(_: impl Sized + 'static) {}
     needs_static(a);
+    //~^ NOTE argument requires that `x` is borrowed for `'static`
 }
 //~^ NOTE `x` dropped here while still borrowed
 
@@ -76,11 +76,11 @@ fn needs_static_mut() {
     let a = display_len_mut(&mut x);
     //~^ ERROR `x` does not live long enough
     //~| NOTE this call may capture more lifetimes than intended
-    //~| NOTE argument requires that `x` is borrowed for `'static`
     //~| NOTE borrowed value does not live long enough
 
     fn needs_static(_: impl Sized + 'static) {}
     needs_static(a);
+    //~^ NOTE argument requires that `x` is borrowed for `'static`
 }
 //~^ NOTE `x` dropped here while still borrowed
 
diff --git a/tests/ui/impl-trait/precise-capturing/migration-note.stderr b/tests/ui/impl-trait/precise-capturing/migration-note.stderr
index c9403532dfa..9caf7a201ef 100644
--- a/tests/ui/impl-trait/precise-capturing/migration-note.stderr
+++ b/tests/ui/impl-trait/precise-capturing/migration-note.stderr
@@ -42,11 +42,11 @@ LL |     let x = vec![1];
    |         - binding `x` declared here
 LL |
 LL |     let a = display_len(&x);
-   |             ------------^^-
-   |             |           |
-   |             |           borrowed value does not live long enough
-   |             argument requires that `x` is borrowed for `'static`
+   |                         ^^ borrowed value does not live long enough
 ...
+LL |     needs_static(a);
+   |     --------------- argument requires that `x` is borrowed for `'static`
+LL |
 LL | }
    | - `x` dropped here while still borrowed
    |
@@ -118,11 +118,11 @@ LL |     let mut x = vec![1];
    |         ----- binding `x` declared here
 LL |
 LL |     let a = display_len_mut(&mut x);
-   |             ----------------^^^^^^-
-   |             |               |
-   |             |               borrowed value does not live long enough
-   |             argument requires that `x` is borrowed for `'static`
+   |                             ^^^^^^ borrowed value does not live long enough
 ...
+LL |     needs_static(a);
+   |     --------------- argument requires that `x` is borrowed for `'static`
+LL |
 LL | }
    | - `x` dropped here while still borrowed
    |
diff --git a/tests/ui/impl-trait/rpit/early_bound.stderr b/tests/ui/impl-trait/rpit/early_bound.stderr
index b0c7bd4199c..230dde95764 100644
--- a/tests/ui/impl-trait/rpit/early_bound.stderr
+++ b/tests/ui/impl-trait/rpit/early_bound.stderr
@@ -1,12 +1,3 @@
-error[E0792]: expected generic lifetime parameter, found `'_`
-  --> $DIR/early_bound.rs:7:17
-   |
-LL | fn test<'a: 'a>(n: bool) -> impl Sized + 'a {
-   |                                          -- this generic parameter must be used with a generic lifetime parameter
-...
-LL |         let _ = identity::<&'a ()>(test(false));
-   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
 error: concrete type differs from previous defining opaque type use
   --> $DIR/early_bound.rs:3:29
    |
@@ -19,6 +10,15 @@ note: previous use here
 LL |         let _ = identity::<&'a ()>(test(false));
    |                                    ^^^^^^^^^^^
 
+error[E0792]: expected generic lifetime parameter, found `'_`
+  --> $DIR/early_bound.rs:7:17
+   |
+LL | fn test<'a: 'a>(n: bool) -> impl Sized + 'a {
+   |                                          -- this generic parameter must be used with a generic lifetime parameter
+...
+LL |         let _ = identity::<&'a ()>(test(false));
+   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
 error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/impl-trait/rpit/non-defining-use.stderr b/tests/ui/impl-trait/rpit/non-defining-use.stderr
index 19987d47672..10a8232e646 100644
--- a/tests/ui/impl-trait/rpit/non-defining-use.stderr
+++ b/tests/ui/impl-trait/rpit/non-defining-use.stderr
@@ -6,14 +6,6 @@ LL | fn foo<T>() -> impl Sized {
 LL |     let _: () = foo::<u8>();
    |            ^^
 
-error[E0792]: expected generic type parameter, found `u8`
-  --> $DIR/non-defining-use.rs:8:12
-   |
-LL | fn bar<T>(val: T) -> impl Sized {
-   |        - this generic parameter must be used with a generic type parameter
-LL |     let _: u8 = bar(0u8);
-   |            ^^
-
 error: concrete type differs from previous defining opaque type use
   --> $DIR/non-defining-use.rs:8:17
    |
@@ -26,6 +18,14 @@ note: previous use here
 LL | fn bar<T>(val: T) -> impl Sized {
    |                      ^^^^^^^^^^
 
+error[E0792]: expected generic type parameter, found `u8`
+  --> $DIR/non-defining-use.rs:8:12
+   |
+LL | fn bar<T>(val: T) -> impl Sized {
+   |        - this generic parameter must be used with a generic type parameter
+LL |     let _: u8 = bar(0u8);
+   |            ^^
+
 error: aborting due to 3 previous errors
 
 For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/inline-const/collect-scopes-in-pat.rs b/tests/ui/inline-const/collect-scopes-in-pat.rs
new file mode 100644
index 00000000000..024fde53741
--- /dev/null
+++ b/tests/ui/inline-const/collect-scopes-in-pat.rs
@@ -0,0 +1,16 @@
+// @compile-flags: -Zlint-mir
+//@ check-pass
+
+#![feature(inline_const_pat)]
+
+fn main() {
+    match 1 {
+        const {
+            || match 0 {
+                x => 0,
+            };
+            0
+        } => (),
+        _ => (),
+    }
+}
diff --git a/tests/ui/inline-const/const-expr-lifetime-err.stderr b/tests/ui/inline-const/const-expr-lifetime-err.stderr
index be3fc8d28c5..031bf98262a 100644
--- a/tests/ui/inline-const/const-expr-lifetime-err.stderr
+++ b/tests/ui/inline-const/const-expr-lifetime-err.stderr
@@ -6,10 +6,9 @@ LL | fn foo<'a>() {
 LL |     let y = ();
    |         - binding `y` declared here
 LL |     equate(InvariantRef::new(&y), const { InvariantRef::<'a>::NEW });
-   |            ------------------^^-
-   |            |                 |
-   |            |                 borrowed value does not live long enough
-   |            argument requires that `y` is borrowed for `'a`
+   |                              ^^           ----------------------- using this value as a constant requires that `y` is borrowed for `'a`
+   |                              |
+   |                              borrowed value does not live long enough
 LL |
 LL | }
    | - `y` dropped here while still borrowed
diff --git a/tests/ui/inline-const/const-match-pat-lifetime-err.stderr b/tests/ui/inline-const/const-match-pat-lifetime-err.stderr
index 95fe7085e50..7eea1846057 100644
--- a/tests/ui/inline-const/const-match-pat-lifetime-err.stderr
+++ b/tests/ui/inline-const/const-match-pat-lifetime-err.stderr
@@ -9,7 +9,7 @@ LL |     match InvariantRef::new(&y) {
    |                             ^^ borrowed value does not live long enough
 LL |
 LL |         const { InvariantRef::<'a>::NEW } => (),
-   |         --------------------------------- type annotation requires that `y` is borrowed for `'a`
+   |                 ----------------------- using this value as a constant requires that `y` is borrowed for `'a`
 LL |     }
 LL | }
    | - `y` dropped here while still borrowed
diff --git a/tests/ui/invalid-compile-flags/crate-type-flag.rs b/tests/ui/invalid-compile-flags/crate-type-flag.rs
index 42bd72cbfbf..bc7a0bc46c3 100644
--- a/tests/ui/invalid-compile-flags/crate-type-flag.rs
+++ b/tests/ui/invalid-compile-flags/crate-type-flag.rs
@@ -30,6 +30,7 @@
 //@[bin] check-pass
 
 //@[proc_dash_macro] ignore-wasm (proc-macro is not supported)
+//@[proc_dash_macro] needs-unwind (panic=abort causes warning to be emitted)
 //@[proc_dash_macro] compile-flags: --crate-type=proc-macro
 //@[proc_dash_macro] check-pass
 
diff --git a/tests/ui/issues/issue-25901.rs b/tests/ui/issues/issue-25901.rs
index eae038c71a0..bfcee1ac503 100644
--- a/tests/ui/issues/issue-25901.rs
+++ b/tests/ui/issues/issue-25901.rs
@@ -2,7 +2,7 @@ struct A;
 struct B;
 
 static S: &'static B = &A;
-//~^ ERROR cannot call conditionally-const method
+//~^ ERROR cannot perform conditionally-const deref coercion
 
 use std::ops::Deref;
 
diff --git a/tests/ui/issues/issue-25901.stderr b/tests/ui/issues/issue-25901.stderr
index 655a8b78c6a..a954f38af83 100644
--- a/tests/ui/issues/issue-25901.stderr
+++ b/tests/ui/issues/issue-25901.stderr
@@ -1,9 +1,16 @@
-error[E0658]: cannot call conditionally-const method `<A as Deref>::deref` in statics
+error[E0658]: cannot perform conditionally-const deref coercion on `A` in statics
   --> $DIR/issue-25901.rs:4:24
    |
 LL | static S: &'static B = &A;
    |                        ^^
    |
+   = note: attempting to deref into `B`
+note: deref defined here
+  --> $DIR/issue-25901.rs:10:5
+   |
+LL |     type Target = B;
+   |     ^^^^^^^^^^^
+   = note: calls in statics are limited to constant functions, tuple structs and tuple variants
    = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
    = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
diff --git a/tests/ui/kindck/kindck-impl-type-params.stderr b/tests/ui/kindck/kindck-impl-type-params.stderr
index a0a4ef09216..d375aa9cb59 100644
--- a/tests/ui/kindck/kindck-impl-type-params.stderr
+++ b/tests/ui/kindck/kindck-impl-type-params.stderr
@@ -112,13 +112,13 @@ LL |     struct Foo; // does not impl Copy
    |
 
 error: lifetime may not live long enough
-  --> $DIR/kindck-impl-type-params.rs:30:19
+  --> $DIR/kindck-impl-type-params.rs:30:13
    |
 LL | fn foo<'a>() {
    |        -- lifetime `'a` defined here
 LL |     let t: S<&'a isize> = S(marker::PhantomData);
 LL |     let a = &t as &dyn Gettable<&'a isize>;
-   |                   ^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cast requires that `'a` must outlive `'static`
 
 error: aborting due to 7 previous errors
 
diff --git a/tests/ui/layout/debug.rs b/tests/ui/layout/debug.rs
index 5602c4e711f..81dc7285254 100644
--- a/tests/ui/layout/debug.rs
+++ b/tests/ui/layout/debug.rs
@@ -1,4 +1,5 @@
 //@ normalize-stderr: "pref: Align\([1-8] bytes\)" -> "pref: $$SOME_ALIGN"
+//@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED"
 #![feature(never_type, rustc_attrs, type_alias_impl_trait, repr_simd)]
 #![crate_type = "lib"]
 
diff --git a/tests/ui/layout/debug.stderr b/tests/ui/layout/debug.stderr
index bd31665dac1..1fc55511384 100644
--- a/tests/ui/layout/debug.stderr
+++ b/tests/ui/layout/debug.stderr
@@ -1,5 +1,5 @@
 error: unions cannot have zero fields
-  --> $DIR/debug.rs:82:1
+  --> $DIR/debug.rs:83:1
    |
 LL | union EmptyUnion {}
    | ^^^^^^^^^^^^^^^^^^^
@@ -61,6 +61,7 @@ error: layout_of(E) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(12 bytes),
@@ -87,13 +88,15 @@ error: layout_of(E) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(4 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/debug.rs:7:1
+  --> $DIR/debug.rs:8:1
    |
 LL | enum E { Foo, Bar(!, i32, i32) }
    | ^^^^^^
@@ -138,8 +141,9 @@ error: layout_of(S) = Layout {
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/debug.rs:10:1
+  --> $DIR/debug.rs:11:1
    |
 LL | struct S { f1: i32, f2: (), f3: i32 }
    | ^^^^^^^^
@@ -162,8 +166,9 @@ error: layout_of(U) = Layout {
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/debug.rs:13:1
+  --> $DIR/debug.rs:14:1
    |
 LL | union U { f1: (i32, i32), f3: i32 }
    | ^^^^^^^
@@ -255,6 +260,7 @@ error: layout_of(Result<i32, i32>) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(4 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(8 bytes),
@@ -292,13 +298,15 @@ error: layout_of(Result<i32, i32>) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(4 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/debug.rs:16:1
+  --> $DIR/debug.rs:17:1
    |
 LL | type Test = Result<i32, i32>;
    | ^^^^^^^^^
@@ -325,8 +333,9 @@ error: layout_of(i32) = Layout {
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/debug.rs:19:1
+  --> $DIR/debug.rs:20:1
    |
 LL | type T = impl std::fmt::Debug;
    | ^^^^^^
@@ -349,8 +358,9 @@ error: layout_of(V) = Layout {
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(2 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/debug.rs:25:1
+  --> $DIR/debug.rs:26:1
    |
 LL | pub union V {
    | ^^^^^^^^^^^
@@ -373,8 +383,9 @@ error: layout_of(W) = Layout {
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(2 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/debug.rs:31:1
+  --> $DIR/debug.rs:32:1
    |
 LL | pub union W {
    | ^^^^^^^^^^^
@@ -397,8 +408,9 @@ error: layout_of(Y) = Layout {
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(2 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/debug.rs:37:1
+  --> $DIR/debug.rs:38:1
    |
 LL | pub union Y {
    | ^^^^^^^^^^^
@@ -421,8 +433,9 @@ error: layout_of(P1) = Layout {
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(1 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/debug.rs:44:1
+  --> $DIR/debug.rs:45:1
    |
 LL | union P1 { x: u32 }
    | ^^^^^^^^
@@ -445,8 +458,9 @@ error: layout_of(P2) = Layout {
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(1 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/debug.rs:48:1
+  --> $DIR/debug.rs:49:1
    |
 LL | union P2 { x: (u32, u32) }
    | ^^^^^^^^
@@ -469,8 +483,9 @@ error: layout_of(P3) = Layout {
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(1 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/debug.rs:56:1
+  --> $DIR/debug.rs:57:1
    |
 LL | union P3 { x: F32x4 }
    | ^^^^^^^^
@@ -493,8 +508,9 @@ error: layout_of(P4) = Layout {
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(1 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/debug.rs:60:1
+  --> $DIR/debug.rs:61:1
    |
 LL | union P4 { x: E }
    | ^^^^^^^^
@@ -522,8 +538,9 @@ error: layout_of(P5) = Layout {
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(1 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/debug.rs:64:1
+  --> $DIR/debug.rs:65:1
    |
 LL | union P5 { zst: [u16; 0], byte: u8 }
    | ^^^^^^^^
@@ -551,20 +568,21 @@ error: layout_of(MaybeUninit<u8>) = Layout {
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(1 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/debug.rs:67:1
+  --> $DIR/debug.rs:68:1
    |
 LL | type X = std::mem::MaybeUninit<u8>;
    | ^^^^^^
 
 error: `#[rustc_layout]` can only be applied to `struct`/`enum`/`union` declarations and type aliases
-  --> $DIR/debug.rs:70:1
+  --> $DIR/debug.rs:71:1
    |
 LL | const C: () = ();
    | ^^^^^^^^^^^
 
 error[E0277]: the size for values of type `str` cannot be known at compilation time
-  --> $DIR/debug.rs:78:19
+  --> $DIR/debug.rs:79:19
    |
 LL | type Impossible = (str, str);
    |                   ^^^^^^^^^^ doesn't have a size known at compile-time
@@ -573,13 +591,13 @@ LL | type Impossible = (str, str);
    = note: only the last element of a tuple may have a dynamically sized type
 
 error: the type `EmptyUnion` has an unknown layout
-  --> $DIR/debug.rs:82:1
+  --> $DIR/debug.rs:83:1
    |
 LL | union EmptyUnion {}
    | ^^^^^^^^^^^^^^^^
 
 error: `#[rustc_layout]` can only be applied to `struct`/`enum`/`union` declarations and type aliases
-  --> $DIR/debug.rs:74:5
+  --> $DIR/debug.rs:75:5
    |
 LL |     const C: () = ();
    |     ^^^^^^^^^^^
diff --git a/tests/ui/layout/hexagon-enum.rs b/tests/ui/layout/hexagon-enum.rs
index e3a5c53671d..5fa12e479e7 100644
--- a/tests/ui/layout/hexagon-enum.rs
+++ b/tests/ui/layout/hexagon-enum.rs
@@ -1,4 +1,5 @@
 //@ compile-flags: --target hexagon-unknown-linux-musl
+//@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED"
 //@ needs-llvm-components: hexagon
 //
 // Verify that the hexagon targets implement the repr(C) for enums correctly.
diff --git a/tests/ui/layout/hexagon-enum.stderr b/tests/ui/layout/hexagon-enum.stderr
index 59fe667923f..96f0a8c8740 100644
--- a/tests/ui/layout/hexagon-enum.stderr
+++ b/tests/ui/layout/hexagon-enum.stderr
@@ -61,13 +61,15 @@ error: layout_of(A) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(1 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/hexagon-enum.rs:16:1
+  --> $DIR/hexagon-enum.rs:17:1
    |
 LL | enum A { Apple }
    | ^^^^^^
@@ -135,13 +137,15 @@ error: layout_of(B) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(1 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/hexagon-enum.rs:20:1
+  --> $DIR/hexagon-enum.rs:21:1
    |
 LL | enum B { Banana = 255, }
    | ^^^^^^
@@ -209,13 +213,15 @@ error: layout_of(C) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(2 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(2 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/hexagon-enum.rs:24:1
+  --> $DIR/hexagon-enum.rs:25:1
    |
 LL | enum C { Chaenomeles = 256, }
    | ^^^^^^
@@ -283,13 +289,15 @@ error: layout_of(P) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(4 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/hexagon-enum.rs:28:1
+  --> $DIR/hexagon-enum.rs:29:1
    |
 LL | enum P { Peach = 0x1000_0000isize, }
    | ^^^^^^
@@ -357,13 +365,15 @@ error: layout_of(T) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(4 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/hexagon-enum.rs:34:1
+  --> $DIR/hexagon-enum.rs:35:1
    |
 LL | enum T { Tangerine = TANGERINE as isize }
    | ^^^^^^
diff --git a/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.rs b/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.rs
index 328d204aa3c..ab7e0897ce3 100644
--- a/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.rs
+++ b/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.rs
@@ -1,4 +1,5 @@
 //@ normalize-stderr: "pref: Align\([1-8] bytes\)" -> "pref: $$PREF_ALIGN"
+//@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED"
 #![crate_type = "lib"]
 #![feature(rustc_attrs)]
 
diff --git a/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr b/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr
index ca041fb539b..cd9e4c02781 100644
--- a/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr
+++ b/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr
@@ -83,6 +83,7 @@ error: layout_of(MissingPayloadField) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(1 bytes),
@@ -103,13 +104,15 @@ error: layout_of(MissingPayloadField) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(1 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:16:1
+  --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:17:1
    |
 LL | pub enum MissingPayloadField {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -201,6 +204,7 @@ error: layout_of(CommonPayloadField) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(2 bytes),
@@ -238,13 +242,15 @@ error: layout_of(CommonPayloadField) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(1 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:25:1
+  --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:26:1
    |
 LL | pub enum CommonPayloadField {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -334,6 +340,7 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(2 bytes),
@@ -370,13 +377,15 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(1 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:33:1
+  --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:34:1
    |
 LL | pub enum CommonPayloadFieldIsMaybeUninit {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -482,6 +491,7 @@ error: layout_of(NicheFirst) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(0 bytes),
@@ -502,6 +512,7 @@ error: layout_of(NicheFirst) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(0 bytes),
@@ -522,13 +533,15 @@ error: layout_of(NicheFirst) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(1 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:41:1
+  --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:42:1
    |
 LL | pub enum NicheFirst {
    | ^^^^^^^^^^^^^^^^^^^
@@ -634,6 +647,7 @@ error: layout_of(NicheSecond) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(0 bytes),
@@ -654,6 +668,7 @@ error: layout_of(NicheSecond) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(0 bytes),
@@ -674,13 +689,15 @@ error: layout_of(NicheSecond) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(1 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:50:1
+  --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:51:1
    |
 LL | pub enum NicheSecond {
    | ^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/layout/issue-96185-overaligned-enum.rs b/tests/ui/layout/issue-96185-overaligned-enum.rs
index 341233a7890..19da169105c 100644
--- a/tests/ui/layout/issue-96185-overaligned-enum.rs
+++ b/tests/ui/layout/issue-96185-overaligned-enum.rs
@@ -1,4 +1,5 @@
 //@ normalize-stderr: "pref: Align\([1-8] bytes\)" -> "pref: $$PREF_ALIGN"
+//@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED"
 #![crate_type = "lib"]
 #![feature(rustc_attrs)]
 
diff --git a/tests/ui/layout/issue-96185-overaligned-enum.stderr b/tests/ui/layout/issue-96185-overaligned-enum.stderr
index bc40a2aa482..15a3f6004f5 100644
--- a/tests/ui/layout/issue-96185-overaligned-enum.stderr
+++ b/tests/ui/layout/issue-96185-overaligned-enum.stderr
@@ -57,6 +57,7 @@ error: layout_of(Aligned1) = Layout {
                            Align(8 bytes),
                        ),
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(8 bytes),
@@ -79,6 +80,7 @@ error: layout_of(Aligned1) = Layout {
                            Align(8 bytes),
                        ),
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
@@ -86,8 +88,9 @@ error: layout_of(Aligned1) = Layout {
                Align(8 bytes),
            ),
            unadjusted_abi_align: Align(1 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/issue-96185-overaligned-enum.rs:8:1
+  --> $DIR/issue-96185-overaligned-enum.rs:9:1
    |
 LL | pub enum Aligned1 {
    | ^^^^^^^^^^^^^^^^^
@@ -157,6 +160,7 @@ error: layout_of(Aligned2) = Layout {
                            Align(1 bytes),
                        ),
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(1 bytes),
@@ -179,6 +183,7 @@ error: layout_of(Aligned2) = Layout {
                            Align(1 bytes),
                        ),
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
@@ -186,8 +191,9 @@ error: layout_of(Aligned2) = Layout {
                Align(1 bytes),
            ),
            unadjusted_abi_align: Align(1 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/issue-96185-overaligned-enum.rs:16:1
+  --> $DIR/issue-96185-overaligned-enum.rs:17:1
    |
 LL | pub enum Aligned2 {
    | ^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/layout/randomize.rs b/tests/ui/layout/randomize.rs
new file mode 100644
index 00000000000..27e99327a31
--- /dev/null
+++ b/tests/ui/layout/randomize.rs
@@ -0,0 +1,62 @@
+//@ run-pass
+//@ revisions: normal randomize-layout
+//@ [randomize-layout]compile-flags: -Zrandomize-layout -Zlayout-seed=2
+
+#![feature(offset_of_enum)]
+
+use std::ptr;
+
+
+// these types only have their field offsets taken, they're never constructed
+#[allow(dead_code)]
+pub struct Foo<T>(u32, T, u8);
+#[allow(dead_code)]
+pub struct Wrapper<T>(T);
+#[repr(transparent)]
+#[allow(dead_code)]
+pub struct TransparentWrapper(u16);
+
+const _: () = {
+    // Behavior of the current non-randomized implementation, not guaranteed
+    #[cfg(not(randomize_layout))]
+    assert!(std::mem::offset_of!(Foo::<u16>, 1) == std::mem::offset_of!(Foo::<Wrapper<u16>>, 1));
+
+    // under randomization Foo<T> != Foo<U>
+    #[cfg(randomize_layout)]
+    assert!(std::mem::offset_of!(Foo::<u16>, 1) != std::mem::offset_of!(Foo::<Wrapper<u16>>, 1));
+
+    // Even transparent wrapper inner types get a different layout since associated type
+    // specialization could result in the outer type behaving differently depending on the exact
+    // inner type.
+    #[cfg(randomize_layout)]
+    assert!(
+        std::mem::offset_of!(Foo::<u16>, 1) != std::mem::offset_of!(Foo::<TransparentWrapper>, 1)
+    );
+
+    // Currently all fn pointers are treated interchangably even with randomization. Not guaranteed.
+    // Associated type specialization could also break this.
+    assert!(
+        std::mem::offset_of!(Foo::<fn(u32)>, 1) == std::mem::offset_of!(Foo::<fn() -> usize>, 1)
+    );
+
+    // But subtype coercions must always result in the same layout.
+    assert!(
+        std::mem::offset_of!(Foo::<fn(&u32)>, 1) == std::mem::offset_of!(Foo::<fn(&'static u32)>, 1)
+    );
+
+    // Randomization must uphold NPO guarantees
+    assert!(std::mem::offset_of!(Option::<&usize>, Some.0) == 0);
+    assert!(std::mem::offset_of!(Result::<&usize, ()>, Ok.0) == 0);
+};
+
+#[allow(dead_code)]
+struct Unsizable<T: ?Sized>(usize, T);
+
+fn main() {
+    // offset_of doesn't let us probe the unsized field, check at runtime.
+    let x = &Unsizable::<[u32; 4]>(0, [0; 4]);
+    let y: &Unsizable::<[u32]> = x;
+
+    // type coercion must not change the layout.
+    assert_eq!(ptr::from_ref(&x.1).addr(), ptr::from_ref(&y.1).addr());
+}
diff --git a/tests/ui/layout/thumb-enum.rs b/tests/ui/layout/thumb-enum.rs
index 57a9a2d8137..2381d9d0292 100644
--- a/tests/ui/layout/thumb-enum.rs
+++ b/tests/ui/layout/thumb-enum.rs
@@ -1,4 +1,5 @@
 //@ compile-flags: --target thumbv8m.main-none-eabihf
+//@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED"
 //@ needs-llvm-components: arm
 //
 // Verify that thumb targets implement the repr(C) for enums correctly.
diff --git a/tests/ui/layout/thumb-enum.stderr b/tests/ui/layout/thumb-enum.stderr
index bf043af586b..120081d193c 100644
--- a/tests/ui/layout/thumb-enum.stderr
+++ b/tests/ui/layout/thumb-enum.stderr
@@ -61,13 +61,15 @@ error: layout_of(A) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(1 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/thumb-enum.rs:16:1
+  --> $DIR/thumb-enum.rs:17:1
    |
 LL | enum A { Apple }
    | ^^^^^^
@@ -135,13 +137,15 @@ error: layout_of(B) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(1 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/thumb-enum.rs:20:1
+  --> $DIR/thumb-enum.rs:21:1
    |
 LL | enum B { Banana = 255, }
    | ^^^^^^
@@ -209,13 +213,15 @@ error: layout_of(C) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(2 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(2 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/thumb-enum.rs:24:1
+  --> $DIR/thumb-enum.rs:25:1
    |
 LL | enum C { Chaenomeles = 256, }
    | ^^^^^^
@@ -283,13 +289,15 @@ error: layout_of(P) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(4 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/thumb-enum.rs:28:1
+  --> $DIR/thumb-enum.rs:29:1
    |
 LL | enum P { Peach = 0x1000_0000isize, }
    | ^^^^^^
@@ -357,13 +365,15 @@ error: layout_of(T) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(4 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/thumb-enum.rs:34:1
+  --> $DIR/thumb-enum.rs:35:1
    |
 LL | enum T { Tangerine = TANGERINE as isize }
    | ^^^^^^
diff --git a/tests/ui/layout/zero-sized-array-enum-niche.rs b/tests/ui/layout/zero-sized-array-enum-niche.rs
index 152f44bd863..d3ff016d8aa 100644
--- a/tests/ui/layout/zero-sized-array-enum-niche.rs
+++ b/tests/ui/layout/zero-sized-array-enum-niche.rs
@@ -1,4 +1,5 @@
 //@ normalize-stderr: "pref: Align\([1-8] bytes\)" -> "pref: $$PREF_ALIGN"
+//@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED"
 #![crate_type = "lib"]
 #![feature(rustc_attrs)]
 
diff --git a/tests/ui/layout/zero-sized-array-enum-niche.stderr b/tests/ui/layout/zero-sized-array-enum-niche.stderr
index d61408098df..b6fcc14c063 100644
--- a/tests/ui/layout/zero-sized-array-enum-niche.stderr
+++ b/tests/ui/layout/zero-sized-array-enum-niche.stderr
@@ -59,6 +59,7 @@ error: layout_of(Result<[u32; 0], bool>) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(4 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(2 bytes),
@@ -92,13 +93,15 @@ error: layout_of(Result<[u32; 0], bool>) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/zero-sized-array-enum-niche.rs:13:1
+  --> $DIR/zero-sized-array-enum-niche.rs:14:1
    |
 LL | type AlignedResult = Result<[u32; 0], bool>;
    | ^^^^^^^^^^^^^^^^^^
@@ -164,6 +167,7 @@ error: layout_of(MultipleAlignments) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(2 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(4 bytes),
@@ -188,6 +192,7 @@ error: layout_of(MultipleAlignments) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(4 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(2 bytes),
@@ -221,13 +226,15 @@ error: layout_of(MultipleAlignments) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/zero-sized-array-enum-niche.rs:21:1
+  --> $DIR/zero-sized-array-enum-niche.rs:22:1
    |
 LL | enum MultipleAlignments {
    | ^^^^^^^^^^^^^^^^^^^^^^^
@@ -293,6 +300,7 @@ error: layout_of(Result<[u32; 0], Packed<NonZero<u16>>>) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(4 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(3 bytes),
@@ -326,13 +334,15 @@ error: layout_of(Result<[u32; 0], Packed<NonZero<u16>>>) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/zero-sized-array-enum-niche.rs:37:1
+  --> $DIR/zero-sized-array-enum-niche.rs:38:1
    |
 LL | type NicheLosesToTagged = Result<[u32; 0], Packed<std::num::NonZero<u16>>>;
    | ^^^^^^^^^^^^^^^^^^^^^^^
@@ -402,6 +412,7 @@ error: layout_of(Result<[u32; 0], Packed<U16IsZero>>) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(4 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(2 bytes),
@@ -435,13 +446,15 @@ error: layout_of(Result<[u32; 0], Packed<U16IsZero>>) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/zero-sized-array-enum-niche.rs:44:1
+  --> $DIR/zero-sized-array-enum-niche.rs:45:1
    |
 LL | type NicheWinsOverTagged = Result<[u32; 0], Packed<U16IsZero>>;
    | ^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/lifetimes/copy_modulo_regions.stderr b/tests/ui/lifetimes/copy_modulo_regions.stderr
index 310ddb21647..0d69f0323d6 100644
--- a/tests/ui/lifetimes/copy_modulo_regions.stderr
+++ b/tests/ui/lifetimes/copy_modulo_regions.stderr
@@ -4,7 +4,10 @@ error: lifetime may not live long enough
 LL | fn foo<'a>() -> [Foo<'a>; 100] {
    |        -- lifetime `'a` defined here
 LL |     [mk_foo::<'a>(); 100]
-   |     ^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |     |
+   |     returning this value requires that `'a` must outlive `'static`
+   |     requirement occurs due to copying this value
    |
    = note: requirement occurs because of the type `Foo<'_>`, which makes the generic argument `'_` invariant
    = note: the struct `Foo<'a>` is invariant over the parameter `'a`
diff --git a/tests/ui/lifetimes/issue-90170-elision-mismatch.stderr b/tests/ui/lifetimes/issue-90170-elision-mismatch.stderr
index 82511d07b0e..5e16c57a618 100644
--- a/tests/ui/lifetimes/issue-90170-elision-mismatch.stderr
+++ b/tests/ui/lifetimes/issue-90170-elision-mismatch.stderr
@@ -7,6 +7,9 @@ LL | pub fn foo(x: &mut Vec<&u8>, y: &u8) { x.push(y); }
    |                        |        let's call the lifetime of this reference `'1`
    |                        let's call the lifetime of this reference `'2`
    |
+   = note: requirement occurs because of a mutable reference to `Vec<&u8>`
+   = note: mutable references are invariant over their type parameter
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 help: consider introducing a named lifetime parameter
    |
 LL | pub fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); }
@@ -21,6 +24,9 @@ LL | pub fn foo2(x: &mut Vec<&'_ u8>, y: &u8) { x.push(y); }
    |                         |           let's call the lifetime of this reference `'1`
    |                         let's call the lifetime of this reference `'2`
    |
+   = note: requirement occurs because of a mutable reference to `Vec<&u8>`
+   = note: mutable references are invariant over their type parameter
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 help: consider introducing a named lifetime parameter
    |
 LL | pub fn foo2<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); }
@@ -35,6 +41,9 @@ LL | pub fn foo3<'a>(_other: &'a [u8], x: &mut Vec<&u8>, y: &u8) { x.push(y); }
    |                                               |        let's call the lifetime of this reference `'1`
    |                                               let's call the lifetime of this reference `'2`
    |
+   = note: requirement occurs because of a mutable reference to `Vec<&u8>`
+   = note: mutable references are invariant over their type parameter
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 help: consider reusing a named lifetime parameter
    |
 LL | pub fn foo3<'a>(_other: &'a [u8], x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); }
diff --git a/tests/ui/lifetimes/issue-90600-expected-return-static-indirect.rs b/tests/ui/lifetimes/issue-90600-expected-return-static-indirect.rs
index ce4cddc9b39..30a1811fee5 100644
--- a/tests/ui/lifetimes/issue-90600-expected-return-static-indirect.rs
+++ b/tests/ui/lifetimes/issue-90600-expected-return-static-indirect.rs
@@ -7,9 +7,9 @@ fn inner(mut foo: &[u8]) {
     let refcell = RefCell::new(&mut foo);
     //~^ ERROR `foo` does not live long enough
     let read = &refcell as &RefCell<dyn Read>;
-    //~^ ERROR lifetime may not live long enough
 
     read_thing(read);
+    //~^ ERROR borrowed data escapes outside of function
 }
 
 fn read_thing(refcell: &RefCell<dyn Read>) {}
diff --git a/tests/ui/lifetimes/issue-90600-expected-return-static-indirect.stderr b/tests/ui/lifetimes/issue-90600-expected-return-static-indirect.stderr
index e4cd54ac337..4df2e906e22 100644
--- a/tests/ui/lifetimes/issue-90600-expected-return-static-indirect.stderr
+++ b/tests/ui/lifetimes/issue-90600-expected-return-static-indirect.stderr
@@ -5,22 +5,32 @@ LL | fn inner(mut foo: &[u8]) {
    |          ------- binding `foo` declared here
 LL |     let refcell = RefCell::new(&mut foo);
    |                                ^^^^^^^^ borrowed value does not live long enough
-LL |
-LL |     let read = &refcell as &RefCell<dyn Read>;
-   |                ------------------------------ cast requires that `foo` is borrowed for `'static`
 ...
+LL |     read_thing(read);
+   |     ---------------- argument requires that `foo` is borrowed for `'static`
+LL |
 LL | }
    |  - `foo` dropped here while still borrowed
 
-error: lifetime may not live long enough
-  --> $DIR/issue-90600-expected-return-static-indirect.rs:9:16
+error[E0521]: borrowed data escapes outside of function
+  --> $DIR/issue-90600-expected-return-static-indirect.rs:11:5
    |
 LL | fn inner(mut foo: &[u8]) {
-   |                   - let's call the lifetime of this reference `'1`
+   |          -------  - let's call the lifetime of this reference `'1`
+   |          |
+   |          `foo` is a reference that is only valid in the function body
 ...
-LL |     let read = &refcell as &RefCell<dyn Read>;
-   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cast requires that `'1` must outlive `'static`
+LL |     read_thing(read);
+   |     ^^^^^^^^^^^^^^^^
+   |     |
+   |     `foo` escapes the function body here
+   |     argument requires that `'1` must outlive `'static`
+   |
+   = note: requirement occurs because of the type `RefCell<(dyn std::io::Read + 'static)>`, which makes the generic argument `(dyn std::io::Read + 'static)` invariant
+   = note: the struct `RefCell<T>` is invariant over the parameter `T`
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0597`.
+Some errors have detailed explanations: E0521, E0597.
+For more information about an error, try `rustc --explain E0521`.
diff --git a/tests/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr b/tests/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr
index 6f7127d4c4c..a187cb755dd 100644
--- a/tests/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr
+++ b/tests/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr
@@ -8,6 +8,9 @@ LL | fn foo(x: &mut Vec<Ref<i32>>, y: Ref<i32>) {
 LL |     x.push(y);
    |     ^^^^^^^^^ argument requires that `'1` must outlive `'2`
    |
+   = note: requirement occurs because of a mutable reference to `Vec<Ref<'_, i32>>`
+   = note: mutable references are invariant over their type parameter
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 help: consider introducing a named lifetime parameter
    |
 LL | fn foo<'a>(x: &mut Vec<Ref<'a, i32>>, y: Ref<'a, i32>) {
diff --git a/tests/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr b/tests/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr
index cace80272f5..610a669cded 100644
--- a/tests/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr
+++ b/tests/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr
@@ -10,6 +10,9 @@ LL |     x.push(z);
    |     ^^^^^^^^^ argument requires that `'c` must outlive `'b`
    |
    = help: consider adding the following bound: `'c: 'b`
+   = note: requirement occurs because of a mutable reference to `Vec<Ref<'_, i32>>`
+   = note: mutable references are invariant over their type parameter
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.rs b/tests/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.rs
index f573230293e..4cd06e1c02b 100644
--- a/tests/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.rs
+++ b/tests/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.rs
@@ -4,9 +4,9 @@ struct Ref<'a, T: 'a> {
 
 fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
     let a: &mut Vec<Ref<i32>> = x;
+    //~^ ERROR lifetime may not live long enough
     let b = Ref { data: y.data };
     a.push(b);
-    //~^ ERROR lifetime may not live long enough
 }
 
 fn main() { }
diff --git a/tests/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr b/tests/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr
index 4a981e4de60..0da32aacdb3 100644
--- a/tests/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr
+++ b/tests/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr
@@ -1,15 +1,17 @@
 error: lifetime may not live long enough
-  --> $DIR/ex2d-push-inference-variable-2.rs:8:5
+  --> $DIR/ex2d-push-inference-variable-2.rs:6:33
    |
 LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
    |            --  -- lifetime `'c` defined here
    |            |
    |            lifetime `'b` defined here
-...
-LL |     a.push(b);
-   |     ^^^^^^^^^ argument requires that `'c` must outlive `'b`
+LL |     let a: &mut Vec<Ref<i32>> = x;
+   |                                 ^ assignment requires that `'c` must outlive `'b`
    |
    = help: consider adding the following bound: `'c: 'b`
+   = note: requirement occurs because of a mutable reference to `Vec<Ref<'_, i32>>`
+   = note: mutable references are invariant over their type parameter
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.rs b/tests/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.rs
index 4a934bbf080..498cea36824 100644
--- a/tests/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.rs
+++ b/tests/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.rs
@@ -4,9 +4,9 @@ struct Ref<'a, T: 'a> {
 
 fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
     let a: &mut Vec<Ref<i32>> = x;
+    //~^ ERROR lifetime may not live long enough
     let b = Ref { data: y.data };
     Vec::push(a, b);
-    //~^ ERROR lifetime may not live long enough
 }
 
 fn main() { }
diff --git a/tests/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr b/tests/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr
index 2bd047113bc..4474a898fdc 100644
--- a/tests/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr
+++ b/tests/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr
@@ -1,15 +1,17 @@
 error: lifetime may not live long enough
-  --> $DIR/ex2e-push-inference-variable-3.rs:8:5
+  --> $DIR/ex2e-push-inference-variable-3.rs:6:33
    |
 LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
    |            --  -- lifetime `'c` defined here
    |            |
    |            lifetime `'b` defined here
-...
-LL |     Vec::push(a, b);
-   |     ^^^^^^^^^^^^^^^ argument requires that `'c` must outlive `'b`
+LL |     let a: &mut Vec<Ref<i32>> = x;
+   |                                 ^ assignment requires that `'c` must outlive `'b`
    |
    = help: consider adding the following bound: `'c: 'b`
+   = note: requirement occurs because of a mutable reference to `Vec<Ref<'_, i32>>`
+   = note: mutable references are invariant over their type parameter
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.rs b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.rs
index 09ee9accccd..66e6eb91a22 100644
--- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.rs
+++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.rs
@@ -1,6 +1,6 @@
 fn foo(&mut (ref mut v, w): &mut (&u8, &u8), x: &u8) {
-    *v = x;
     //~^ ERROR lifetime may not live long enough
+    *v = x;
 }
 
 fn main() { }
diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr
index 30083b5ef54..e7cab52084d 100644
--- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr
+++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr
@@ -1,13 +1,15 @@
 error: lifetime may not live long enough
-  --> $DIR/ex3-both-anon-regions-2.rs:2:5
+  --> $DIR/ex3-both-anon-regions-2.rs:1:14
    |
 LL | fn foo(&mut (ref mut v, w): &mut (&u8, &u8), x: &u8) {
-   |                                   -             - let's call the lifetime of this reference `'1`
-   |                                   |
-   |                                   let's call the lifetime of this reference `'2`
-LL |     *v = x;
-   |     ^^^^^^ assignment requires that `'1` must outlive `'2`
+   |              ^^^^^^^^^            -             - let's call the lifetime of this reference `'1`
+   |              |                    |
+   |              |                    let's call the lifetime of this reference `'2`
+   |              assignment requires that `'1` must outlive `'2`
    |
+   = note: requirement occurs because of a mutable reference to `&u8`
+   = note: mutable references are invariant over their type parameter
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 help: consider introducing a named lifetime parameter
    |
 LL | fn foo<'a>(&mut (ref mut v, w): &mut (&'a u8, &u8), x: &'a u8) {
diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr
index 6ba130308a3..c67ea19effc 100644
--- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr
+++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr
@@ -8,6 +8,9 @@ LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) {
 LL |     z.push((x,y));
    |     ^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
    |
+   = note: requirement occurs because of a mutable reference to `Vec<(&u8, &u8)>`
+   = note: mutable references are invariant over their type parameter
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 help: consider introducing a named lifetime parameter
    |
 LL | fn foo<'a>(z: &mut Vec<(&'a u8,&u8)>, (x, y): (&'a u8, &u8)) {
@@ -23,6 +26,9 @@ LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) {
 LL |     z.push((x,y));
    |     ^^^^^^^^^^^^^ argument requires that `'3` must outlive `'4`
    |
+   = note: requirement occurs because of a mutable reference to `Vec<(&u8, &u8)>`
+   = note: mutable references are invariant over their type parameter
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 help: consider introducing a named lifetime parameter
    |
 LL | fn foo<'a>(z: &mut Vec<(&u8,&'a u8)>, (x, y): (&u8, &'a u8)) {
diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr
index 352619c0ffc..0980b37e535 100644
--- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr
+++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr
@@ -10,6 +10,9 @@ LL |     x.push(y);
    |     ^^^^^^^^^ argument requires that `'b` must outlive `'a`
    |
    = help: consider adding the following bound: `'b: 'a`
+   = note: requirement occurs because of a mutable reference to `Vec<Ref<'_>>`
+   = note: mutable references are invariant over their type parameter
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr
index 16cf009ee48..16cd47420a5 100644
--- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr
+++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr
@@ -9,6 +9,9 @@ LL |     x.push(y);
    |     ^^^^^^^^^ argument requires that `'b` must outlive `'a`
    |
    = help: consider adding the following bound: `'b: 'a`
+   = note: requirement occurs because of a mutable reference to `Vec<Ref<'_>>`
+   = note: mutable references are invariant over their type parameter
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr
index 017bfa71463..264673ff3e8 100644
--- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr
+++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr
@@ -8,6 +8,9 @@ LL | fn foo(mut x: Vec<Ref>, y: Ref) {
 LL |     x.push(y);
    |     ^^^^^^^^^ argument requires that `'1` must outlive `'2`
    |
+   = note: requirement occurs because of a mutable reference to `Vec<Ref<'_>>`
+   = note: mutable references are invariant over their type parameter
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 help: consider introducing a named lifetime parameter
    |
 LL | fn foo<'a>(mut x: Vec<Ref<'a>>, y: Ref<'a>) {
diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr
index 080eb43cecb..8552755d168 100644
--- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr
+++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr
@@ -9,6 +9,9 @@ LL |     x.push(y);
    |     ^^^^^^^^^ argument requires that `'b` must outlive `'a`
    |
    = help: consider adding the following bound: `'b: 'a`
+   = note: requirement occurs because of a mutable reference to `Vec<&u8>`
+   = note: mutable references are invariant over their type parameter
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr
index cb629d2e3d3..2a2cf6508fd 100644
--- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr
+++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr
@@ -19,6 +19,9 @@ LL | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) {
 LL |   y.push(z);
    |   ^^^^^^^^^ argument requires that `'1` must outlive `'2`
    |
+   = note: requirement occurs because of a mutable reference to `Vec<&u8>`
+   = note: mutable references are invariant over their type parameter
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 help: consider introducing a named lifetime parameter
    |
 LL | fn foo<'a>(x:fn(&u8, &u8), y: Vec<&'a u8>, z: &'a u8) {
diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr
index 420cfa6b569..01bfe782920 100644
--- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr
+++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr
@@ -8,6 +8,9 @@ LL |     fn foo(x: &mut Vec<&u8>, y: &u8) {
 LL |         x.push(y);
    |         ^^^^^^^^^ argument requires that `'1` must outlive `'2`
    |
+   = note: requirement occurs because of a mutable reference to `Vec<&u8>`
+   = note: mutable references are invariant over their type parameter
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 help: consider introducing a named lifetime parameter and update trait if needed
    |
 LL |     fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) {
diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr
index 05f9308124b..41154755b5d 100644
--- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr
+++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr
@@ -19,6 +19,9 @@ LL | fn foo(x:Box<dyn Fn(&u8, &u8)> , y: Vec<&u8>, z: &u8) {
 LL |   y.push(z);
    |   ^^^^^^^^^ argument requires that `'1` must outlive `'2`
    |
+   = note: requirement occurs because of a mutable reference to `Vec<&u8>`
+   = note: mutable references are invariant over their type parameter
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 help: consider introducing a named lifetime parameter
    |
 LL | fn foo<'a>(x:Box<dyn Fn(&u8, &u8)> , y: Vec<&'a u8>, z: &'a u8) {
diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr
index 875d22576e5..10e8ca852f0 100644
--- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr
+++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr
@@ -8,6 +8,9 @@ LL | fn foo(x: &mut Vec<&u8>, y: &u8) {
 LL |     x.push(y);
    |     ^^^^^^^^^ argument requires that `'1` must outlive `'2`
    |
+   = note: requirement occurs because of a mutable reference to `Vec<&u8>`
+   = note: mutable references are invariant over their type parameter
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 help: consider introducing a named lifetime parameter
    |
 LL | fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) {
diff --git a/tests/ui/lint/invalid_value.stderr b/tests/ui/lint/invalid_value.stderr
index b4e7421829f..cc6a2a1c8e5 100644
--- a/tests/ui/lint/invalid_value.stderr
+++ b/tests/ui/lint/invalid_value.stderr
@@ -323,7 +323,7 @@ LL |         let _val: (NonZero<u32>, i32) = mem::zeroed();
    |                                         ^^^^^^^^^^^^^ this code causes undefined behavior when executed
    |
    = note: `std::num::NonZero<u32>` must be non-null
-   = note: because `core::num::nonzero::private::NonZeroU32Inner` must be non-null
+   = note: because `core::num::niche_types::NonZeroU32Inner` must be non-null
 
 error: the type `(NonZero<u32>, i32)` does not permit being left uninitialized
   --> $DIR/invalid_value.rs:95:41
@@ -332,7 +332,7 @@ LL |         let _val: (NonZero<u32>, i32) = mem::uninitialized();
    |                                         ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
    |
    = note: `std::num::NonZero<u32>` must be non-null
-   = note: because `core::num::nonzero::private::NonZeroU32Inner` must be non-null
+   = note: because `core::num::niche_types::NonZeroU32Inner` must be non-null
    = note: integers must be initialized
 
 error: the type `*const dyn Send` does not permit zero-initialization
@@ -415,7 +415,7 @@ note: because `std::num::NonZero<u32>` must be non-null (in this field of the on
    |
 LL |     Banana(NonZero<u32>),
    |            ^^^^^^^^^^^^
-   = note: because `core::num::nonzero::private::NonZeroU32Inner` must be non-null
+   = note: because `core::num::niche_types::NonZeroU32Inner` must be non-null
 
 error: the type `OneFruitNonZero` does not permit being left uninitialized
   --> $DIR/invalid_value.rs:107:37
@@ -429,7 +429,7 @@ note: because `std::num::NonZero<u32>` must be non-null (in this field of the on
    |
 LL |     Banana(NonZero<u32>),
    |            ^^^^^^^^^^^^
-   = note: because `core::num::nonzero::private::NonZeroU32Inner` must be non-null
+   = note: because `core::num::niche_types::NonZeroU32Inner` must be non-null
    = note: integers must be initialized
 
 error: the type `bool` does not permit being left uninitialized
@@ -602,7 +602,7 @@ LL |         let _val: NonZero<u32> = mem::transmute(0);
    |                                  ^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
    |
    = note: `std::num::NonZero<u32>` must be non-null
-   = note: because `core::num::nonzero::private::NonZeroU32Inner` must be non-null
+   = note: because `core::num::niche_types::NonZeroU32Inner` must be non-null
 
 error: the type `NonNull<i32>` does not permit zero-initialization
   --> $DIR/invalid_value.rs:156:34
diff --git a/tests/ui/macros/stringify.rs b/tests/ui/macros/stringify.rs
index a560bf4c6ef..40033f546d3 100644
--- a/tests/ui/macros/stringify.rs
+++ b/tests/ui/macros/stringify.rs
@@ -569,7 +569,7 @@ fn test_pat() {
     c1!(pat, [ &pat ], "&pat");
     c1!(pat, [ &mut pat ], "&mut pat");
 
-    // PatKind::Lit
+    // PatKind::Expr
     c1!(pat, [ 1_000_i8 ], "1_000_i8");
 
     // PatKind::Range
diff --git a/tests/ui/methods/bad-wf-when-selecting-method.rs b/tests/ui/methods/bad-wf-when-selecting-method.rs
new file mode 100644
index 00000000000..638d1ffa982
--- /dev/null
+++ b/tests/ui/methods/bad-wf-when-selecting-method.rs
@@ -0,0 +1,18 @@
+trait Wf {
+    type Assoc;
+}
+
+struct Wrapper<T: Wf<Assoc = U>, U>(T);
+
+trait Trait {
+    fn needs_sized(self);
+}
+
+fn test<T>(t: T) {
+    Wrapper(t).needs_sized();
+    //~^ ERROR the trait bound `T: Wf` is not satisfied
+    //~| ERROR the trait bound `T: Wf` is not satisfied
+    //~| the method `needs_sized` exists for struct `Wrapper<T, _>`, but its trait bounds were not satisfied
+}
+
+fn main() {}
diff --git a/tests/ui/methods/bad-wf-when-selecting-method.stderr b/tests/ui/methods/bad-wf-when-selecting-method.stderr
new file mode 100644
index 00000000000..e6d50034967
--- /dev/null
+++ b/tests/ui/methods/bad-wf-when-selecting-method.stderr
@@ -0,0 +1,54 @@
+error[E0277]: the trait bound `T: Wf` is not satisfied
+  --> $DIR/bad-wf-when-selecting-method.rs:12:13
+   |
+LL |     Wrapper(t).needs_sized();
+   |     ------- ^ the trait `Wf` is not implemented for `T`
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `Wrapper`
+  --> $DIR/bad-wf-when-selecting-method.rs:5:19
+   |
+LL | struct Wrapper<T: Wf<Assoc = U>, U>(T);
+   |                   ^^^^^^^^^^^^^ required by this bound in `Wrapper`
+help: consider restricting type parameter `T` with trait `Wf`
+   |
+LL | fn test<T: Wf>(t: T) {
+   |          ++++
+
+error[E0277]: the trait bound `T: Wf` is not satisfied
+  --> $DIR/bad-wf-when-selecting-method.rs:12:5
+   |
+LL |     Wrapper(t).needs_sized();
+   |     ^^^^^^^^^^ the trait `Wf` is not implemented for `T`
+   |
+note: required by a bound in `Wrapper`
+  --> $DIR/bad-wf-when-selecting-method.rs:5:19
+   |
+LL | struct Wrapper<T: Wf<Assoc = U>, U>(T);
+   |                   ^^^^^^^^^^^^^ required by this bound in `Wrapper`
+help: consider restricting type parameter `T` with trait `Wf`
+   |
+LL | fn test<T: Wf>(t: T) {
+   |          ++++
+
+error[E0599]: the method `needs_sized` exists for struct `Wrapper<T, _>`, but its trait bounds were not satisfied
+  --> $DIR/bad-wf-when-selecting-method.rs:12:16
+   |
+LL | struct Wrapper<T: Wf<Assoc = U>, U>(T);
+   | ----------------------------------- method `needs_sized` not found for this struct
+...
+LL |     Wrapper(t).needs_sized();
+   |                ^^^^^^^^^^^ method cannot be called on `Wrapper<T, _>` due to unsatisfied trait bounds
+   |
+   = note: the following trait bounds were not satisfied:
+           `T: Wf`
+help: consider restricting the type parameter to satisfy the trait bound
+   |
+LL | fn test<T>(t: T) where T: Wf {
+   |                  +++++++++++
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0277, E0599.
+For more information about an error, try `rustc --explain E0277`.
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 f37ce967a1b..60087ec992b 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
@@ -23,6 +23,10 @@ LL |         |_outlives1, _outlives2, _outlives3, x, y| {
 ...
 LL |             demand_y(x, y, p)
    |             ^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
+   |
+   = note: requirement occurs because of the type `Cell<&'?34 u32>`, which makes the generic argument `&'?34 u32` invariant
+   = note: the struct `Cell<T>` is invariant over the parameter `T`
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 note: no external requirements
   --> $DIR/propagate-approximated-fail-no-postdom.rs:38:1
diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-ref.rs b/tests/ui/nll/closure-requirements/propagate-approximated-ref.rs
index 1c27e38f832..f4db723704c 100644
--- a/tests/ui/nll/closure-requirements/propagate-approximated-ref.rs
+++ b/tests/ui/nll/closure-requirements/propagate-approximated-ref.rs
@@ -41,9 +41,10 @@ fn demand_y<'x, 'y>(_cell_x: &Cell<&'x u32>, _cell_y: &Cell<&'y u32>, _y: &'y u3
 #[rustc_regions]
 fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
     establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
+        //~^ ERROR lifetime may not live long enough
+
         // Only works if 'x: 'y:
         demand_y(x, y, x.get())
-        //~^ ERROR lifetime may not live long enough
     });
 }
 
diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr
index e2d0b105ab1..7325a9de8b2 100644
--- a/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr
+++ b/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr
@@ -23,17 +23,21 @@ LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
    = note: defining type: supply
 
 error: lifetime may not live long enough
-  --> $DIR/propagate-approximated-ref.rs:45:9
+  --> $DIR/propagate-approximated-ref.rs:43:5
    |
-LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
-   |           --  -- lifetime `'b` defined here
-   |           |
-   |           lifetime `'a` defined here
-...
-LL |         demand_y(x, y, x.get())
-   |         ^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'a` must outlive `'b`
+LL |   fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
+   |             --  -- lifetime `'b` defined here
+   |             |
+   |             lifetime `'a` defined here
+LL | /     establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
+...  |
+LL | |     });
+   | |______^ argument requires that `'a` must outlive `'b`
    |
    = help: consider adding the following bound: `'a: 'b`
+   = note: requirement occurs because of the type `Cell<&'?11 u32>`, which makes the generic argument `&'?11 u32` invariant
+   = note: the struct `Cell<T>` is invariant over the parameter `T`
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: aborting due to 1 previous error
 
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 d7933a39eaa..0094d7a50d3 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
@@ -19,6 +19,10 @@ LL |     foo(cell, |cell_a, cell_x| {
    |                `cell_a` declared here, outside of the closure body
 LL |         cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure
    |         ^^^^^^^^^^^^^^^^^^^^^^^^ `cell_x` escapes the closure body here
+   |
+   = note: requirement occurs because of the type `Cell<&'?8 u32>`, which makes the generic argument `&'?8 u32` invariant
+   = note: the struct `Cell<T>` is invariant over the parameter `T`
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 note: no external requirements
   --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:18:1
@@ -56,11 +60,11 @@ error[E0597]: `a` does not live long enough
 LL |     let a = 0;
    |         - binding `a` declared here
 LL |     let cell = Cell::new(&a);
-   |                ----------^^-
-   |                |         |
-   |                |         borrowed value does not live long enough
-   |                argument requires that `a` is borrowed for `'static`
+   |                          ^^ borrowed value does not live long enough
 ...
+LL |         cell_x.set(cell_a.get()); // forces 'a: 'x, implies 'a = 'static -> borrow error
+   |         ------------------------ argument requires that `a` is borrowed for `'static`
+LL |     })
 LL | }
    | - `a` dropped here while still borrowed
 
diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs
index 25e212a7225..afabb69ec4c 100644
--- a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs
+++ b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs
@@ -30,10 +30,9 @@ fn demand_y<'x, 'y>(_cell_x: &Cell<&'x u32>, _cell_y: &Cell<&'y u32>, _y: &'y u3
 #[rustc_regions]
 fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
     establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
-        //~^ ERROR borrowed data escapes outside of function
-
         // Only works if 'x: 'y:
         demand_y(x, y, x.get())
+        //~^ ERROR borrowed data escapes outside of function
     });
 }
 
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 3c04cf300ad..b9365c94a1b 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
@@ -23,23 +23,18 @@ LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
    = note: defining type: supply
 
 error[E0521]: borrowed data escapes outside of function
-  --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:32:5
+  --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:34:9
    |
-LL |   fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
-   |             --      ------ `cell_a` is a reference that is only valid in the function body
-   |             |
-   |             lifetime `'a` defined here
-LL | /     establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
-...  |
-LL | |     });
-   | |      ^
-   | |      |
-   | |______`cell_a` escapes the function body here
-   |        argument requires that `'a` must outlive `'static`
-   |
-   = note: requirement occurs because of the type `Cell<&'?9 u32>`, which makes the generic argument `&'?9 u32` invariant
-   = note: the struct `Cell<T>` is invariant over the parameter `T`
-   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
+LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
+   |           --      ------ `cell_a` is a reference that is only valid in the function body
+   |           |
+   |           lifetime `'a` defined here
+...
+LL |         demand_y(x, y, x.get())
+   |         ^^^^^^^^^^^^^^^^^^^^^^^
+   |         |
+   |         `cell_a` escapes the function body here
+   |         argument requires that `'a` must outlive `'static`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs
index cda7b22362f..9f3e80d3db6 100644
--- a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs
+++ b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs
@@ -33,10 +33,9 @@ fn demand_y<'x, 'y>(_cell_x: &Cell<&'x u32>, _cell_y: &Cell<&'y u32>, _y: &'y u3
 #[rustc_regions]
 fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
     establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
-        //~^ ERROR borrowed data escapes outside of function
-
         // Only works if 'x: 'y:
         demand_y(x, y, x.get())
+        //~^ ERROR borrowed data escapes outside of function
     });
 }
 
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 9f5762ccbfa..e5d2867103c 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
@@ -23,23 +23,18 @@ LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
    = note: defining type: supply
 
 error[E0521]: borrowed data escapes outside of function
-  --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:35:5
+  --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:37:9
    |
-LL |   fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
-   |             --      ------ `cell_a` is a reference that is only valid in the function body
-   |             |
-   |             lifetime `'a` defined here
-LL | /     establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
-...  |
-LL | |     });
-   | |      ^
-   | |      |
-   | |______`cell_a` escapes the function body here
-   |        argument requires that `'a` must outlive `'static`
-   |
-   = note: requirement occurs because of the type `Cell<&'?10 u32>`, which makes the generic argument `&'?10 u32` invariant
-   = note: the struct `Cell<T>` is invariant over the parameter `T`
-   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
+LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
+   |           --      ------ `cell_a` is a reference that is only valid in the function body
+   |           |
+   |           lifetime `'a` defined here
+...
+LL |         demand_y(x, y, x.get())
+   |         ^^^^^^^^^^^^^^^^^^^^^^^
+   |         |
+   |         `cell_a` escapes the function body here
+   |         argument requires that `'a` must outlive `'static`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-val.rs b/tests/ui/nll/closure-requirements/propagate-approximated-val.rs
index e7e2f157604..4d663c53d27 100644
--- a/tests/ui/nll/closure-requirements/propagate-approximated-val.rs
+++ b/tests/ui/nll/closure-requirements/propagate-approximated-val.rs
@@ -34,9 +34,10 @@ fn demand_y<'x, 'y>(_outlives1: Cell<&&'x u32>, _outlives2: Cell<&'y &u32>, _y:
 #[rustc_regions]
 fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
     establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| {
+        //~^ ERROR lifetime may not live long enough
+
         // Only works if 'x: 'y:
         demand_y(outlives1, outlives2, x.get())
-        //~^ ERROR lifetime may not live long enough
     });
 }
 
diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr
index 4787577a6e1..a14bfb06e83 100644
--- a/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr
+++ b/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr
@@ -23,17 +23,21 @@ LL | fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
    = note: defining type: test
 
 error: lifetime may not live long enough
-  --> $DIR/propagate-approximated-val.rs:38:9
+  --> $DIR/propagate-approximated-val.rs:36:5
    |
-LL | fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
-   |         --  -- lifetime `'b` defined here
-   |         |
-   |         lifetime `'a` defined here
-...
-LL |         demand_y(outlives1, outlives2, x.get())
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'a` must outlive `'b`
+LL |   fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
+   |           --  -- lifetime `'b` defined here
+   |           |
+   |           lifetime `'a` defined here
+LL | /     establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| {
+...  |
+LL | |     });
+   | |______^ argument requires that `'a` must outlive `'b`
    |
    = help: consider adding the following bound: `'a: 'b`
+   = note: requirement occurs because of the type `Cell<&'?7 u32>`, which makes the generic argument `&'?7 u32` invariant
+   = note: the struct `Cell<T>` is invariant over the parameter `T`
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: aborting due to 1 previous error
 
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 669b56a0be7..4558ff50674 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
@@ -22,6 +22,10 @@ LL |     establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
 LL |         // Only works if 'x: 'y:
 LL |         demand_y(x, y, x.get())
    |         ^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
+   |
+   = note: requirement occurs because of the type `Cell<&'?37 u32>`, which makes the generic argument `&'?37 u32` invariant
+   = note: the struct `Cell<T>` is invariant over the parameter `T`
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 note: no external requirements
   --> $DIR/propagate-fail-to-approximate-longer-no-bounds.rs:34:1
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 75f476ac5f1..83173ae80c0 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
@@ -22,6 +22,10 @@ LL |     establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y
 LL |         // Only works if 'x: 'y:
 LL |         demand_y(x, y, x.get())
    |         ^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
+   |
+   = note: requirement occurs because of the type `Cell<&'?43 u32>`, which makes the generic argument `&'?43 u32` invariant
+   = note: the struct `Cell<T>` is invariant over the parameter `T`
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 note: no external requirements
   --> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:38:1
diff --git a/tests/ui/nll/issue-54779-anon-static-lifetime.rs b/tests/ui/nll/issue-54779-anon-static-lifetime.rs
index 260b6b109ca..6b8fa608ebb 100644
--- a/tests/ui/nll/issue-54779-anon-static-lifetime.rs
+++ b/tests/ui/nll/issue-54779-anon-static-lifetime.rs
@@ -29,7 +29,7 @@ impl DebugWith<dyn DebugContext> for Foo {
         fmt: &mut std::fmt::Formatter<'_>,
     ) -> std::fmt::Result {
         let Foo { bar } = self;
-        bar.debug_with(cx); //~ ERROR: lifetime may not live long enough
+        bar.debug_with(cx); //~ borrowed data escapes outside of method
         Ok(())
     }
 }
diff --git a/tests/ui/nll/issue-54779-anon-static-lifetime.stderr b/tests/ui/nll/issue-54779-anon-static-lifetime.stderr
index a454ed26568..03a55906614 100644
--- a/tests/ui/nll/issue-54779-anon-static-lifetime.stderr
+++ b/tests/ui/nll/issue-54779-anon-static-lifetime.stderr
@@ -1,11 +1,17 @@
-error: lifetime may not live long enough
-  --> $DIR/issue-54779-anon-static-lifetime.rs:32:24
+error[E0521]: borrowed data escapes outside of method
+  --> $DIR/issue-54779-anon-static-lifetime.rs:32:9
    |
 LL |         cx: &dyn DebugContext,
-   |             - let's call the lifetime of this reference `'1`
+   |         --  - let's call the lifetime of this reference `'1`
+   |         |
+   |         `cx` is a reference that is only valid in the method body
 ...
 LL |         bar.debug_with(cx);
-   |                        ^^ coercion requires that `'1` must outlive `'static`
+   |         ^^^^^^^^^^^^^^^^^^
+   |         |
+   |         `cx` escapes the method body here
+   |         argument requires that `'1` must outlive `'static`
 
 error: aborting due to 1 previous error
 
+For more information about this error, try `rustc --explain E0521`.
diff --git a/tests/ui/nll/issue-62007-assign-const-index.stderr b/tests/ui/nll/issue-62007-assign-const-index.stderr
index 0db9fe62c38..32716c47cd4 100644
--- a/tests/ui/nll/issue-62007-assign-const-index.stderr
+++ b/tests/ui/nll/issue-62007-assign-const-index.stderr
@@ -17,10 +17,9 @@ LL | fn to_refs<T>(mut list: [&mut List<T>; 2]) -> Vec<&mut T> {
    |                          - let's call the lifetime of this reference `'1`
 ...
 LL |         if let Some(n) = list[0].next.as_mut() {
-   |                          ^^^^^^^^^^^^---------
-   |                          |
-   |                          `list[_].next` was mutably borrowed here in the previous iteration of the loop
-   |                          argument requires that `list[_].next` is borrowed for `'1`
+   |                          ^^^^^^^^^^^^ `list[_].next` was mutably borrowed here in the previous iteration of the loop
+LL |             list[0] = n;
+   |             ----------- assignment requires that `list[_].next` is borrowed for `'1`
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/nll/issue-62007-assign-differing-fields.stderr b/tests/ui/nll/issue-62007-assign-differing-fields.stderr
index f1af2e855af..d51fd7a1389 100644
--- a/tests/ui/nll/issue-62007-assign-differing-fields.stderr
+++ b/tests/ui/nll/issue-62007-assign-differing-fields.stderr
@@ -17,10 +17,9 @@ LL | fn to_refs<'a, T>(mut list: (&'a mut List<T>, &'a mut List<T>)) -> Vec<&'a
    |            -- lifetime `'a` defined here
 ...
 LL |         if let Some(n) = (list.0).next.as_mut() {
-   |                          ^^^^^^^^^^^^^---------
-   |                          |
-   |                          `list.0.next` was mutably borrowed here in the previous iteration of the loop
-   |                          argument requires that `list.0.next` is borrowed for `'a`
+   |                          ^^^^^^^^^^^^^ `list.0.next` was mutably borrowed here in the previous iteration of the loop
+LL |             list.1 = n;
+   |             ---------- assignment requires that `list.0.next` is borrowed for `'a`
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/nll/issue-67007-escaping-data.rs b/tests/ui/nll/issue-67007-escaping-data.rs
index 49ea2e5964f..92a47f78843 100644
--- a/tests/ui/nll/issue-67007-escaping-data.rs
+++ b/tests/ui/nll/issue-67007-escaping-data.rs
@@ -12,8 +12,8 @@ struct Consumer<'tcx>(&'tcx ());
 
 impl<'tcx> Consumer<'tcx> {
     fn bad_method<'a>(&self, fcx: &FnCtxt<'a, 'tcx>) {
-        let other = self.use_fcx(fcx); //~ ERROR lifetime may not live long enough
-        fcx.use_it(other);
+        let other = self.use_fcx(fcx);
+        fcx.use_it(other); //~ ERROR lifetime may not live long enough
     }
 
     fn use_fcx<'a>(&self, _: &FnCtxt<'a, 'tcx>) -> &'a () {
diff --git a/tests/ui/nll/issue-67007-escaping-data.stderr b/tests/ui/nll/issue-67007-escaping-data.stderr
index eb7b57c7e99..3b9ed246851 100644
--- a/tests/ui/nll/issue-67007-escaping-data.stderr
+++ b/tests/ui/nll/issue-67007-escaping-data.stderr
@@ -1,14 +1,18 @@
 error: lifetime may not live long enough
-  --> $DIR/issue-67007-escaping-data.rs:15:21
+  --> $DIR/issue-67007-escaping-data.rs:16:9
    |
 LL | impl<'tcx> Consumer<'tcx> {
    |      ---- lifetime `'tcx` defined here
 LL |     fn bad_method<'a>(&self, fcx: &FnCtxt<'a, 'tcx>) {
    |                   -- lifetime `'a` defined here
 LL |         let other = self.use_fcx(fcx);
-   |                     ^^^^^^^^^^^^^^^^^ argument requires that `'a` must outlive `'tcx`
+LL |         fcx.use_it(other);
+   |         ^^^^^^^^^^^^^^^^^ argument requires that `'a` must outlive `'tcx`
    |
    = help: consider adding the following bound: `'a: 'tcx`
+   = note: requirement occurs because of the type `FnCtxt<'_, '_>`, which makes the generic argument `'_` invariant
+   = note: the struct `FnCtxt<'a, 'tcx>` is invariant over the parameter `'tcx`
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/nll/issue-95272.rs b/tests/ui/nll/issue-95272.rs
index 958cbde3788..b3325a05e5c 100644
--- a/tests/ui/nll/issue-95272.rs
+++ b/tests/ui/nll/issue-95272.rs
@@ -8,8 +8,8 @@ where
 
 fn test<'a, 'b>(x: Cell<&'a ()>, y: Cell<&'b ()>) {
     let f = check;
-    //~^ ERROR lifetime may not live long enough
     f(x, y);
+    //~^ ERROR lifetime may not live long enough
 }
 
 fn main() {}
diff --git a/tests/ui/nll/issue-95272.stderr b/tests/ui/nll/issue-95272.stderr
index 0453ef8e53e..3d1720239e9 100644
--- a/tests/ui/nll/issue-95272.stderr
+++ b/tests/ui/nll/issue-95272.stderr
@@ -1,16 +1,17 @@
 error: lifetime may not live long enough
-  --> $DIR/issue-95272.rs:10:13
+  --> $DIR/issue-95272.rs:11:5
    |
 LL | fn test<'a, 'b>(x: Cell<&'a ()>, y: Cell<&'b ()>) {
    |         --  -- lifetime `'b` defined here
    |         |
    |         lifetime `'a` defined here
 LL |     let f = check;
-   |             ^^^^^ assignment requires that `'a` must outlive `'b`
+LL |     f(x, y);
+   |     ^^^^^^^ argument requires that `'a` must outlive `'b`
    |
    = help: consider adding the following bound: `'a: 'b`
-   = note: requirement occurs because of a function pointer to `check`
-   = note: the function `check` is invariant over the parameter `'a`
+   = note: requirement occurs because of the type `Cell<&()>`, which makes the generic argument `&()` invariant
+   = note: the struct `Cell<T>` is invariant over the parameter `T`
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/nll/issue-98589-closures-relate-named-regions.stderr b/tests/ui/nll/issue-98589-closures-relate-named-regions.stderr
index 4e741abc2dc..4f244b54bd0 100644
--- a/tests/ui/nll/issue-98589-closures-relate-named-regions.stderr
+++ b/tests/ui/nll/issue-98589-closures-relate-named-regions.stderr
@@ -11,14 +11,14 @@ LL |     || { None::<&'a &'b ()>; };
    = help: consider adding the following bound: `'b: 'a`
 
 error: lifetime may not live long enough
-  --> $DIR/issue-98589-closures-relate-named-regions.rs:15:10
+  --> $DIR/issue-98589-closures-relate-named-regions.rs:15:5
    |
 LL | fn test_early_late<'a: 'a, 'b>() {
    |                    --      -- lifetime `'b` defined here
    |                    |
    |                    lifetime `'a` defined here
 LL |     || { None::<&'a &'b ()>; };
-   |          ^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'a`
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'a`
    |
    = help: consider adding the following bound: `'b: 'a`
 
diff --git a/tests/ui/nll/outlives-suggestion-simple.stderr b/tests/ui/nll/outlives-suggestion-simple.stderr
index bcffd575aed..669532005b2 100644
--- a/tests/ui/nll/outlives-suggestion-simple.stderr
+++ b/tests/ui/nll/outlives-suggestion-simple.stderr
@@ -99,6 +99,10 @@ LL |     fn get_bar(&self) -> Bar2 {
    |                - let's call the lifetime of this reference `'1`
 LL |         Bar2::new(&self)
    |         ^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'a`
+   |
+   = note: requirement occurs because of the type `Foo2<'_>`, which makes the generic argument `'_` invariant
+   = note: the struct `Foo2<'a>` is invariant over the parameter `'a`
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: aborting due to 9 previous errors
 
diff --git a/tests/ui/nll/polonius/assignment-to-differing-field.stderr b/tests/ui/nll/polonius/assignment-to-differing-field.stderr
index acac47eac4f..c46d010e4f5 100644
--- a/tests/ui/nll/polonius/assignment-to-differing-field.stderr
+++ b/tests/ui/nll/polonius/assignment-to-differing-field.stderr
@@ -17,10 +17,10 @@ LL | fn assignment_to_field_projection<'a, T>(
    |                                   -- lifetime `'a` defined here
 ...
 LL |         if let Some(n) = (list.0).next.as_mut() {
-   |                          ^^^^^^^^^^^^^---------
-   |                          |
-   |                          `list.0.next` was mutably borrowed here in the previous iteration of the loop
-   |                          argument requires that `list.0.next` is borrowed for `'a`
+   |                          ^^^^^^^^^^^^^ `list.0.next` was mutably borrowed here in the previous iteration of the loop
+LL |
+LL |             list.1 = n;
+   |             ---------- assignment requires that `list.0.next` is borrowed for `'a`
 
 error[E0499]: cannot borrow `list.0.0.0.0.0.value` as mutable more than once at a time
   --> $DIR/assignment-to-differing-field.rs:37:21
@@ -41,10 +41,10 @@ LL | fn assignment_through_projection_chain<'a, T>(
    |                                        -- lifetime `'a` defined here
 ...
 LL |         if let Some(n) = ((((list.0).0).0).0).0.next.as_mut() {
-   |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^---------
-   |                          |
-   |                          `list.0.0.0.0.0.next` was mutably borrowed here in the previous iteration of the loop
-   |                          argument requires that `list.0.0.0.0.0.next` is borrowed for `'a`
+   |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `list.0.0.0.0.0.next` was mutably borrowed here in the previous iteration of the loop
+LL |
+LL |             *((((list.0).0).0).0).1 = n;
+   |             --------------------------- assignment requires that `list.0.0.0.0.0.next` is borrowed for `'a`
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/nll/relate_tys/var-appears-twice.stderr b/tests/ui/nll/relate_tys/var-appears-twice.stderr
index 3f9a6cec0d2..2b2ec88ba8e 100644
--- a/tests/ui/nll/relate_tys/var-appears-twice.stderr
+++ b/tests/ui/nll/relate_tys/var-appears-twice.stderr
@@ -5,9 +5,10 @@ LL |     let b = 44;
    |         - binding `b` declared here
 ...
 LL |     let x: DoubleCell<_> = make_cell(&b);
-   |            -------------             ^^ borrowed value does not live long enough
-   |            |
-   |            type annotation requires that `b` is borrowed for `'static`
+   |                            ----------^^-
+   |                            |         |
+   |                            |         borrowed value does not live long enough
+   |                            assignment requires that `b` is borrowed for `'static`
 ...
 LL | }
    | - `b` dropped here while still borrowed
diff --git a/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr b/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr
index dda60398198..408c57a31ee 100644
--- a/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr
+++ b/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr
@@ -24,6 +24,22 @@ LL | |     T: Anything<'b>,
    |
    = note: defining type: no_relationships_late::<'?1, T>
 
+error: lifetime may not live long enough
+  --> $DIR/projection-one-region-closure.rs:45:5
+   |
+LL | fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
+   |                          --  -- lifetime `'b` defined here
+   |                          |
+   |                          lifetime `'a` defined here
+...
+LL |     with_signature(cell, t, |cell, t| require(cell, t));
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a`
+   |
+   = help: consider adding the following bound: `'b: 'a`
+   = note: requirement occurs because of the type `Cell<&'?6 ()>`, which makes the generic argument `&'?6 ()` invariant
+   = note: the struct `Cell<T>` is invariant over the parameter `T`
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
+
 error[E0309]: the parameter type `T` may not live long enough
   --> $DIR/projection-one-region-closure.rs:45:39
    |
@@ -38,19 +54,6 @@ help: consider adding an explicit lifetime bound
 LL |     T: Anything<'b> + 'a,
    |                     ++++
 
-error: lifetime may not live long enough
-  --> $DIR/projection-one-region-closure.rs:45:39
-   |
-LL | fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
-   |                          --  -- lifetime `'b` defined here
-   |                          |
-   |                          lifetime `'a` defined here
-...
-LL |     with_signature(cell, t, |cell, t| require(cell, t));
-   |                                       ^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a`
-   |
-   = help: consider adding the following bound: `'b: 'a`
-
 note: external requirements
   --> $DIR/projection-one-region-closure.rs:56:29
    |
@@ -77,6 +80,22 @@ LL | |     'a: 'a,
    |
    = note: defining type: no_relationships_early::<'?1, '?2, T>
 
+error: lifetime may not live long enough
+  --> $DIR/projection-one-region-closure.rs:56:5
+   |
+LL | fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
+   |                           --  -- lifetime `'b` defined here
+   |                           |
+   |                           lifetime `'a` defined here
+...
+LL |     with_signature(cell, t, |cell, t| require(cell, t));
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a`
+   |
+   = help: consider adding the following bound: `'b: 'a`
+   = note: requirement occurs because of the type `Cell<&'?7 ()>`, which makes the generic argument `&'?7 ()` invariant
+   = note: the struct `Cell<T>` is invariant over the parameter `T`
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
+
 error[E0309]: the parameter type `T` may not live long enough
   --> $DIR/projection-one-region-closure.rs:56:39
    |
@@ -91,19 +110,6 @@ help: consider adding an explicit lifetime bound
 LL |     T: Anything<'b> + 'a,
    |                     ++++
 
-error: lifetime may not live long enough
-  --> $DIR/projection-one-region-closure.rs:56:39
-   |
-LL | fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
-   |                           --  -- lifetime `'b` defined here
-   |                           |
-   |                           lifetime `'a` defined here
-...
-LL |     with_signature(cell, t, |cell, t| require(cell, t));
-   |                                       ^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a`
-   |
-   = help: consider adding the following bound: `'b: 'a`
-
 note: external requirements
   --> $DIR/projection-one-region-closure.rs:70:29
    |
diff --git a/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr b/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr
index 52040663e00..4ebdf10c5bf 100644
--- a/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr
+++ b/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr
@@ -24,7 +24,7 @@ LL | |     T: Anything<'b>,
    = note: defining type: no_relationships_late::<'?1, T>
 
 error: lifetime may not live long enough
-  --> $DIR/projection-one-region-trait-bound-closure.rs:37:39
+  --> $DIR/projection-one-region-trait-bound-closure.rs:37:5
    |
 LL | fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
    |                          --  -- lifetime `'b` defined here
@@ -32,9 +32,12 @@ LL | fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
    |                          lifetime `'a` defined here
 ...
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
-   |                                       ^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a`
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a`
    |
    = help: consider adding the following bound: `'b: 'a`
+   = note: requirement occurs because of the type `Cell<&'?6 ()>`, which makes the generic argument `&'?6 ()` invariant
+   = note: the struct `Cell<T>` is invariant over the parameter `T`
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 note: external requirements
   --> $DIR/projection-one-region-trait-bound-closure.rs:47:29
@@ -62,7 +65,7 @@ LL | |     'a: 'a,
    = note: defining type: no_relationships_early::<'?1, '?2, T>
 
 error: lifetime may not live long enough
-  --> $DIR/projection-one-region-trait-bound-closure.rs:47:39
+  --> $DIR/projection-one-region-trait-bound-closure.rs:47:5
    |
 LL | fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
    |                           --  -- lifetime `'b` defined here
@@ -70,9 +73,12 @@ LL | fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
    |                           lifetime `'a` defined here
 ...
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
-   |                                       ^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a`
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a`
    |
    = help: consider adding the following bound: `'b: 'a`
+   = note: requirement occurs because of the type `Cell<&'?7 ()>`, which makes the generic argument `&'?7 ()` invariant
+   = note: the struct `Cell<T>` is invariant over the parameter `T`
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 note: external requirements
   --> $DIR/projection-one-region-trait-bound-closure.rs:60:29
diff --git a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr
index c157e89ff8f..f8dbe08af61 100644
--- a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr
+++ b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr
@@ -182,7 +182,7 @@ LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a`
    |
    = help: consider adding the following bound: `'b: 'a`
-   = note: requirement occurs because of the type `Cell<&'?8 ()>`, which makes the generic argument `&'?8 ()` invariant
+   = note: requirement occurs because of the type `Cell<&'?6 ()>`, which makes the generic argument `&'?6 ()` invariant
    = note: the struct `Cell<T>` is invariant over the parameter `T`
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
diff --git a/tests/ui/nll/type-check-pointer-comparisons.stderr b/tests/ui/nll/type-check-pointer-comparisons.stderr
index 37098b585df..e362dfb3c6e 100644
--- a/tests/ui/nll/type-check-pointer-comparisons.stderr
+++ b/tests/ui/nll/type-check-pointer-comparisons.stderr
@@ -6,7 +6,7 @@ LL | fn compare_const<'a, 'b>(x: *const &mut &'a i32, y: *const &mut &'b i32) {
    |                  |
    |                  lifetime `'a` defined here
 LL |     x == y;
-   |     ^ requires that `'a` must outlive `'b`
+   |     ^^^^^^ argument requires that `'a` must outlive `'b`
    |
    = help: consider adding the following bound: `'a: 'b`
    = note: requirement occurs because of a mutable reference to `&i32`
@@ -14,14 +14,14 @@ LL |     x == y;
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: lifetime may not live long enough
-  --> $DIR/type-check-pointer-comparisons.rs:4:10
+  --> $DIR/type-check-pointer-comparisons.rs:4:5
    |
 LL | fn compare_const<'a, 'b>(x: *const &mut &'a i32, y: *const &mut &'b i32) {
    |                  --  -- lifetime `'b` defined here
    |                  |
    |                  lifetime `'a` defined here
 LL |     x == y;
-   |          ^ requires that `'b` must outlive `'a`
+   |     ^^^^^^ argument requires that `'b` must outlive `'a`
    |
    = help: consider adding the following bound: `'b: 'a`
    = note: requirement occurs because of a mutable reference to `&i32`
@@ -38,7 +38,7 @@ LL | fn compare_mut<'a, 'b>(x: *mut &'a i32, y: *mut &'b i32) {
    |                |
    |                lifetime `'a` defined here
 LL |     x == y;
-   |     ^ requires that `'a` must outlive `'b`
+   |     ^^^^^^ argument requires that `'a` must outlive `'b`
    |
    = help: consider adding the following bound: `'a: 'b`
    = note: requirement occurs because of a mutable pointer to `&i32`
@@ -46,14 +46,14 @@ LL |     x == y;
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: lifetime may not live long enough
-  --> $DIR/type-check-pointer-comparisons.rs:10:10
+  --> $DIR/type-check-pointer-comparisons.rs:10:5
    |
 LL | fn compare_mut<'a, 'b>(x: *mut &'a i32, y: *mut &'b i32) {
    |                --  -- lifetime `'b` defined here
    |                |
    |                lifetime `'a` defined here
 LL |     x == y;
-   |          ^ requires that `'b` must outlive `'a`
+   |     ^^^^^^ argument requires that `'b` must outlive `'a`
    |
    = help: consider adding the following bound: `'b: 'a`
    = note: requirement occurs because of a mutable pointer to `&i32`
@@ -72,7 +72,7 @@ LL | fn compare_fn_ptr<'a, 'b, 'c>(f: fn(&'c mut &'a i32), g: fn(&'c mut &'b i32
    |                   |
    |                   lifetime `'a` defined here
 LL |     f == g;
-   |     ^ requires that `'a` must outlive `'b`
+   |     ^^^^^^ argument requires that `'a` must outlive `'b`
    |
    = help: consider adding the following bound: `'a: 'b`
    = note: requirement occurs because of a mutable reference to `&i32`
@@ -80,14 +80,14 @@ LL |     f == g;
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: lifetime may not live long enough
-  --> $DIR/type-check-pointer-comparisons.rs:16:10
+  --> $DIR/type-check-pointer-comparisons.rs:16:5
    |
 LL | fn compare_fn_ptr<'a, 'b, 'c>(f: fn(&'c mut &'a i32), g: fn(&'c mut &'b i32)) {
    |                   --  -- lifetime `'b` defined here
    |                   |
    |                   lifetime `'a` defined here
 LL |     f == g;
-   |          ^ requires that `'b` must outlive `'a`
+   |     ^^^^^^ argument requires that `'b` must outlive `'a`
    |
    = help: consider adding the following bound: `'b: 'a`
    = note: requirement occurs because of a mutable reference to `&i32`
diff --git a/tests/ui/nll/user-annotations/adt-nullary-enums.stderr b/tests/ui/nll/user-annotations/adt-nullary-enums.stderr
index 644fc94f730..cdaa934122c 100644
--- a/tests/ui/nll/user-annotations/adt-nullary-enums.stderr
+++ b/tests/ui/nll/user-annotations/adt-nullary-enums.stderr
@@ -1,52 +1,49 @@
 error[E0597]: `c` does not live long enough
   --> $DIR/adt-nullary-enums.rs:33:41
    |
-LL |     let c = 66;
-   |         - binding `c` declared here
-LL |     combine(
-LL |         SomeEnum::SomeVariant(Cell::new(&c)),
-   |                               ----------^^-
-   |                               |         |
-   |                               |         borrowed value does not live long enough
-   |                               argument requires that `c` is borrowed for `'static`
-...
-LL | }
-   | - `c` dropped here while still borrowed
+LL |       let c = 66;
+   |           - binding `c` declared here
+LL | /     combine(
+LL | |         SomeEnum::SomeVariant(Cell::new(&c)),
+   | |                                         ^^ borrowed value does not live long enough
+LL | |         SomeEnum::SomeOtherVariant::<Cell<&'static u32>>,
+LL | |     );
+   | |_____- argument requires that `c` is borrowed for `'static`
+LL |   }
+   |   - `c` dropped here while still borrowed
 
 error[E0597]: `c` does not live long enough
   --> $DIR/adt-nullary-enums.rs:41:41
    |
-LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
-   |                                   -- lifetime `'a` defined here
-LL |     let c = 66;
-   |         - binding `c` declared here
-LL |     combine(
-LL |         SomeEnum::SomeVariant(Cell::new(&c)),
-   |                               ----------^^-
-   |                               |         |
-   |                               |         borrowed value does not live long enough
-   |                               argument requires that `c` is borrowed for `'a`
-...
-LL | }
-   | - `c` dropped here while still borrowed
+LL |   fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
+   |                                     -- lifetime `'a` defined here
+LL |       let c = 66;
+   |           - binding `c` declared here
+LL | /     combine(
+LL | |         SomeEnum::SomeVariant(Cell::new(&c)),
+   | |                                         ^^ borrowed value does not live long enough
+LL | |         SomeEnum::SomeOtherVariant::<Cell<&'a u32>>,
+LL | |     );
+   | |_____- argument requires that `c` is borrowed for `'a`
+LL |   }
+   |   - `c` dropped here while still borrowed
 
 error[E0597]: `c` does not live long enough
   --> $DIR/adt-nullary-enums.rs:54:45
    |
-LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) {
-   |                                              -- lifetime `'a` defined here
-LL |     let _closure = || {
-LL |         let c = 66;
-   |             - binding `c` declared here
-LL |         combine(
-LL |             SomeEnum::SomeVariant(Cell::new(&c)),
-   |                                   ----------^^-
-   |                                   |         |
-   |                                   |         borrowed value does not live long enough
-   |                                   argument requires that `c` is borrowed for `'a`
-...
-LL |     };
-   |     - `c` dropped here while still borrowed
+LL |   fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) {
+   |                                                -- lifetime `'a` defined here
+LL |       let _closure = || {
+LL |           let c = 66;
+   |               - binding `c` declared here
+LL | /         combine(
+LL | |             SomeEnum::SomeVariant(Cell::new(&c)),
+   | |                                             ^^ borrowed value does not live long enough
+LL | |             SomeEnum::SomeOtherVariant::<Cell<&'a u32>>,
+LL | |         );
+   | |_________- argument requires that `c` is borrowed for `'a`
+LL |       };
+   |       - `c` dropped here while still borrowed
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/nll/user-annotations/adt-tuple-struct-calls.stderr b/tests/ui/nll/user-annotations/adt-tuple-struct-calls.stderr
index 2084697e7e2..1478ad1431b 100644
--- a/tests/ui/nll/user-annotations/adt-tuple-struct-calls.stderr
+++ b/tests/ui/nll/user-annotations/adt-tuple-struct-calls.stderr
@@ -4,11 +4,9 @@ error[E0597]: `c` does not live long enough
 LL |     let c = 66;
    |         - binding `c` declared here
 LL |     let f = SomeStruct::<&'static u32>;
+   |             -------------------------- assignment requires that `c` is borrowed for `'static`
 LL |     f(&c);
-   |     --^^-
-   |     | |
-   |     | borrowed value does not live long enough
-   |     argument requires that `c` is borrowed for `'static`
+   |       ^^ borrowed value does not live long enough
 LL | }
    | - `c` dropped here while still borrowed
 
@@ -20,11 +18,9 @@ LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) {
 LL |     let c = 66;
    |         - binding `c` declared here
 LL |     let f = SomeStruct::<&'a u32>;
+   |             --------------------- assignment requires that `c` is borrowed for `'a`
 LL |     f(&c);
-   |     --^^-
-   |     | |
-   |     | borrowed value does not live long enough
-   |     argument requires that `c` is borrowed for `'a`
+   |       ^^ borrowed value does not live long enough
 LL | }
    | - `c` dropped here while still borrowed
 
@@ -37,11 +33,9 @@ LL |     let _closure = || {
 LL |         let c = 66;
    |             - binding `c` declared here
 LL |         let f = SomeStruct::<&'a u32>;
+   |                 --------------------- assignment requires that `c` is borrowed for `'a`
 LL |         f(&c);
-   |         --^^-
-   |         | |
-   |         | borrowed value does not live long enough
-   |         argument requires that `c` is borrowed for `'a`
+   |           ^^ borrowed value does not live long enough
 LL |     };
    |     - `c` dropped here while still borrowed
 
diff --git a/tests/ui/nll/user-annotations/method-ufcs-1.stderr b/tests/ui/nll/user-annotations/method-ufcs-1.stderr
index c42ea0172cf..087e270c70f 100644
--- a/tests/ui/nll/user-annotations/method-ufcs-1.stderr
+++ b/tests/ui/nll/user-annotations/method-ufcs-1.stderr
@@ -4,11 +4,10 @@ error[E0597]: `a` does not live long enough
 LL |     let a = 22;
    |         - binding `a` declared here
 ...
+LL |     let x = <&'static u32 as Bazoom<_>>::method;
+   |             ----------------------------------- assignment requires that `a` is borrowed for `'static`
 LL |     x(&a, b, c);
-   |     --^^-------
-   |     | |
-   |     | borrowed value does not live long enough
-   |     argument requires that `a` is borrowed for `'static`
+   |       ^^ borrowed value does not live long enough
 LL | }
    | - `a` dropped here while still borrowed
 
diff --git a/tests/ui/nll/user-annotations/method-ufcs-2.stderr b/tests/ui/nll/user-annotations/method-ufcs-2.stderr
index 287337c7d52..c89bed3b1b1 100644
--- a/tests/ui/nll/user-annotations/method-ufcs-2.stderr
+++ b/tests/ui/nll/user-annotations/method-ufcs-2.stderr
@@ -4,11 +4,10 @@ error[E0597]: `a` does not live long enough
 LL |     let a = 22;
    |         - binding `a` declared here
 ...
+LL |     let x = <&'static u32 as Bazoom<_>>::method;
+   |             ----------------------------------- assignment requires that `a` is borrowed for `'static`
 LL |     x(&a, b, c);
-   |     --^^-------
-   |     | |
-   |     | borrowed value does not live long enough
-   |     argument requires that `a` is borrowed for `'static`
+   |       ^^ borrowed value does not live long enough
 LL | }
    | - `a` dropped here while still borrowed
 
diff --git a/tests/ui/nll/where_clauses_in_structs.stderr b/tests/ui/nll/where_clauses_in_structs.stderr
index 4cc7e5ab1b4..19a1ce00e9a 100644
--- a/tests/ui/nll/where_clauses_in_structs.stderr
+++ b/tests/ui/nll/where_clauses_in_structs.stderr
@@ -1,12 +1,12 @@
 error: lifetime may not live long enough
-  --> $DIR/where_clauses_in_structs.rs:11:11
+  --> $DIR/where_clauses_in_structs.rs:11:14
    |
 LL | fn bar<'a, 'b>(x: Cell<&'a u32>, y: Cell<&'b u32>) {
    |        --  -- lifetime `'b` defined here
    |        |
    |        lifetime `'a` defined here
 LL |     Foo { x, y };
-   |           ^ this usage requires that `'a` must outlive `'b`
+   |              ^ this usage requires that `'a` must outlive `'b`
    |
    = help: consider adding the following bound: `'a: 'b`
    = note: requirement occurs because of the type `Cell<&u32>`, which makes the generic argument `&u32` invariant
diff --git a/tests/ui/pattern/patkind-litrange-no-expr.rs b/tests/ui/pattern/patkind-litrange-no-expr.rs
index 7ef541cb585..14d7dc737d6 100644
--- a/tests/ui/pattern/patkind-litrange-no-expr.rs
+++ b/tests/ui/pattern/patkind-litrange-no-expr.rs
@@ -6,7 +6,7 @@ macro_rules! enum_number {
 
         fn foo(value: i32) -> Option<$name> {
             match value {
-                $( $value => Some($name::$variant), )* // PatKind::Lit
+                $( $value => Some($name::$variant), )* // PatKind::Expr
                 $( $value ..= 42 => Some($name::$variant), )* // PatKind::Range
                 _ => None
             }
diff --git a/tests/ui/pattern/struct-pattern-on-non-struct-resolve-error.rs b/tests/ui/pattern/struct-pattern-on-non-struct-resolve-error.rs
new file mode 100644
index 00000000000..17a5bad0e6c
--- /dev/null
+++ b/tests/ui/pattern/struct-pattern-on-non-struct-resolve-error.rs
@@ -0,0 +1,10 @@
+// Regression test for #135209.
+// We ensure that we don't try to access fields on a non-struct pattern type.
+fn main() {
+    if let <Vec<()> as Iterator>::Item { .. } = 1 {
+        //~^ ERROR E0658
+        //~| ERROR E0071
+        //~| ERROR E0277
+        x //~ ERROR E0425
+    }
+}
diff --git a/tests/ui/pattern/struct-pattern-on-non-struct-resolve-error.stderr b/tests/ui/pattern/struct-pattern-on-non-struct-resolve-error.stderr
new file mode 100644
index 00000000000..793c2d1e97f
--- /dev/null
+++ b/tests/ui/pattern/struct-pattern-on-non-struct-resolve-error.stderr
@@ -0,0 +1,34 @@
+error[E0425]: cannot find value `x` in this scope
+  --> $DIR/struct-pattern-on-non-struct-resolve-error.rs:8:9
+   |
+LL |         x
+   |         ^ not found in this scope
+
+error[E0658]: usage of qualified paths in this context is experimental
+  --> $DIR/struct-pattern-on-non-struct-resolve-error.rs:4:12
+   |
+LL |     if let <Vec<()> as Iterator>::Item { .. } = 1 {
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #86935 <https://github.com/rust-lang/rust/issues/86935> for more information
+   = help: add `#![feature(more_qualified_paths)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0071]: expected struct, variant or union type, found inferred type
+  --> $DIR/struct-pattern-on-non-struct-resolve-error.rs:4:12
+   |
+LL |     if let <Vec<()> as Iterator>::Item { .. } = 1 {
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a struct
+
+error[E0277]: `Vec<()>` is not an iterator
+  --> $DIR/struct-pattern-on-non-struct-resolve-error.rs:4:12
+   |
+LL |     if let <Vec<()> as Iterator>::Item { .. } = 1 {
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Vec<()>` is not an iterator
+   |
+   = help: the trait `Iterator` is not implemented for `Vec<()>`
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0071, E0277, E0425, E0658.
+For more information about an error, try `rustc --explain E0071`.
diff --git a/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.rs b/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.rs
index 225891e390f..39f9f5a2c02 100644
--- a/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.rs
+++ b/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.rs
@@ -3,6 +3,10 @@ struct Website {
     title: Option<String>,
 }
 
+enum Foo {
+    Bar { a: i32 },
+}
+
 fn main() {
     let website = Website {
         url: "http://www.example.com".into(),
@@ -18,4 +22,9 @@ fn main() {
         println!("[{}]({})", title, url); //~ ERROR cannot find value `title` in this scope
         //~^ NOTE not found in this scope
     }
+
+    let x = Foo::Bar { a: 1 };
+    if let Foo::Bar { .. } = x { //~ NOTE this pattern
+        println!("{a}"); //~ ERROR cannot find value `a` in this scope
+    }
 }
diff --git a/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.stderr b/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.stderr
index 80fcd714400..b985b771754 100644
--- a/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.stderr
+++ b/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.stderr
@@ -1,5 +1,5 @@
 error: expected `,`
-  --> $DIR/struct-pattern-with-missing-fields-resolve-error.rs:12:31
+  --> $DIR/struct-pattern-with-missing-fields-resolve-error.rs:16:31
    |
 LL |     if let Website { url, Some(title) } = website {
    |            -------            ^
@@ -7,13 +7,21 @@ LL |     if let Website { url, Some(title) } = website {
    |            while parsing the fields for this pattern
 
 error[E0425]: cannot find value `title` in this scope
-  --> $DIR/struct-pattern-with-missing-fields-resolve-error.rs:18:30
+  --> $DIR/struct-pattern-with-missing-fields-resolve-error.rs:22:30
    |
 LL |     if let Website { url, .. } = website {
    |            ------------------- this pattern doesn't include `title`, which is available in `Website`
 LL |         println!("[{}]({})", title, url);
    |                              ^^^^^ not found in this scope
 
-error: aborting due to 2 previous errors
+error[E0425]: cannot find value `a` in this scope
+  --> $DIR/struct-pattern-with-missing-fields-resolve-error.rs:28:20
+   |
+LL |     if let Foo::Bar { .. } = x {
+   |            --------------- this pattern doesn't include `a`, which is available in `Bar`
+LL |         println!("{a}");
+   |                    ^ help: a local variable with a similar name exists: `x`
+
+error: aborting due to 3 previous errors
 
 For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/print_type_sizes/niche-filling.stdout b/tests/ui/print_type_sizes/niche-filling.stdout
index eeb5de53241..70612490a47 100644
--- a/tests/ui/print_type_sizes/niche-filling.stdout
+++ b/tests/ui/print_type_sizes/niche-filling.stdout
@@ -68,7 +68,7 @@ print-type-size type: `Union2<std::num::NonZero<u32>, u32>`: 4 bytes, alignment:
 print-type-size     variant `Union2`: 4 bytes
 print-type-size         field `.a`: 4 bytes
 print-type-size         field `.b`: 4 bytes, offset: 0 bytes, alignment: 4 bytes
-print-type-size type: `core::num::nonzero::private::NonZeroU32Inner`: 4 bytes, alignment: 4 bytes
+print-type-size type: `core::num::niche_types::NonZeroU32Inner`: 4 bytes, alignment: 4 bytes
 print-type-size     field `.0`: 4 bytes
 print-type-size type: `std::num::NonZero<u32>`: 4 bytes, alignment: 4 bytes
 print-type-size     field `.0`: 4 bytes
diff --git a/tests/ui/proc-macro/quote-debug.stdout b/tests/ui/proc-macro/quote-debug.stdout
deleted file mode 100644
index d84b4e051e8..00000000000
--- a/tests/ui/proc-macro/quote-debug.stdout
+++ /dev/null
@@ -1,49 +0,0 @@
-#![feature(prelude_import)]
-#![no_std]
-//@ check-pass
-//@ force-host
-//@ no-prefer-dynamic
-//@ compile-flags: -Z unpretty=expanded
-//@ needs-unwind compiling proc macros with panic=abort causes a warning
-//
-// This file is not actually used as a proc-macro - instead,
-// it's just used to show the output of the `quote!` macro
-
-#![feature(proc_macro_quote)]
-#![crate_type = "proc-macro"]
-#[prelude_import]
-use ::std::prelude::rust_2015::*;
-#[macro_use]
-extern crate std;
-
-extern crate proc_macro;
-
-fn main() {
-    [crate::TokenStream::from(crate::TokenTree::Ident(crate::Ident::new("let",
-                                    crate::Span::recover_proc_macro_span(0)))),
-                        crate::TokenStream::from(crate::TokenTree::Ident(crate::Ident::new("hello",
-                                    crate::Span::recover_proc_macro_span(1)))),
-                        crate::TokenStream::from(crate::TokenTree::Punct(crate::Punct::new('=',
-                                    crate::Spacing::Alone))),
-                        crate::TokenStream::from(crate::TokenTree::Literal({
-                                    let mut iter =
-                                        "\"world\"".parse::<crate::TokenStream>().unwrap().into_iter();
-                                    if let (Some(crate::TokenTree::Literal(mut lit)), None) =
-                                                (iter.next(), iter.next()) {
-                                            lit.set_span(crate::Span::recover_proc_macro_span(2));
-                                            lit
-                                        } else {
-                                           ::core::panicking::panic("internal error: entered unreachable code")
-                                       }
-                                })),
-                        crate::TokenStream::from(crate::TokenTree::Punct(crate::Punct::new(';',
-                                    crate::Spacing::Alone)))].iter().cloned().collect::<crate::TokenStream>()
-}
-const _: () =
-    {
-        extern crate proc_macro;
-        #[rustc_proc_macro_decls]
-        #[used]
-        #[allow(deprecated)]
-        static _DECLS: &[proc_macro::bridge::client::ProcMacro] = &[];
-    };
diff --git a/tests/ui/proc-macro/quote/auxiliary/basic.rs b/tests/ui/proc-macro/quote/auxiliary/basic.rs
new file mode 100644
index 00000000000..ef726bbfbe3
--- /dev/null
+++ b/tests/ui/proc-macro/quote/auxiliary/basic.rs
@@ -0,0 +1,361 @@
+#![feature(proc_macro_quote)]
+#![feature(proc_macro_totokens)]
+
+extern crate proc_macro;
+
+use std::borrow::Cow;
+use std::ffi::{CStr, CString};
+
+use proc_macro::*;
+
+#[proc_macro]
+pub fn run_tests(_: TokenStream) -> TokenStream {
+    test_quote_impl();
+    test_substitution();
+    test_advanced();
+    test_integer();
+    test_floating();
+    test_char();
+    test_str();
+    test_string();
+    test_c_str();
+    test_c_string();
+    test_interpolated_literal();
+    test_ident();
+    test_underscore();
+    test_duplicate();
+    test_empty_quote();
+    test_box_str();
+    test_cow();
+    test_append_tokens();
+    test_outer_line_comment();
+    test_inner_line_comment();
+    test_outer_block_comment();
+    test_inner_block_comment();
+    test_outer_attr();
+    test_inner_attr();
+    test_quote_raw_id();
+
+    TokenStream::new()
+}
+
+// Based on https://github.com/dtolnay/quote/blob/0245506323a3616daa2ee41c6ad0b871e4d78ae4/tests/test.rs
+//
+// FIXME(quote):
+// The following tests are removed because they are not supported yet in `proc_macro::quote!`
+//
+// - quote_spanned:
+//   - fn test_quote_spanned_impl
+//   - fn test_type_inference_for_span
+//   - wrong-type-span.rs
+// - format_ident:
+//   - fn test_format_ident
+//   - fn test_format_ident_strip_raw
+// - repetition:
+//   - fn test_iter
+//   - fn test_array
+//   - fn test_fancy_repetition
+//   - fn test_nested_fancy_repetition
+//   - fn test_duplicate_name_repetition
+//   - fn test_duplicate_name_repetition_no_copy
+//   - fn test_btreeset_repetition
+//   - fn test_variable_name_conflict
+//   - fn test_nonrep_in_repetition
+//   - fn test_closure
+//   - fn test_star_after_repetition
+
+struct X;
+
+impl ToTokens for X {
+    fn to_tokens(&self, tokens: &mut TokenStream) {
+        Ident::new("X", Span::call_site()).to_tokens(tokens)
+    }
+}
+
+fn test_quote_impl() {
+    let tokens = quote! {
+        impl<'a, T: ToTokens> ToTokens for &'a T {
+            fn to_tokens(&self, tokens: &mut TokenStream) {
+                (**self).to_tokens(tokens)
+            }
+        }
+    };
+
+    let expected = r#"impl < 'a, T : ToTokens > ToTokens for & 'a T
+{
+    fn to_tokens(& self, tokens : & mut TokenStream)
+    { (** self).to_tokens(tokens) }
+}"#;
+
+    assert_eq!(expected, tokens.to_string());
+}
+
+fn test_substitution() {
+    let x = X;
+    let tokens = quote!($x <$x> ($x) [$x] {$x});
+
+    let expected = "X <X > (X) [X] { X }";
+
+    assert_eq!(expected, tokens.to_string());
+}
+
+fn test_advanced() {
+    let generics = quote!( <'a, T> );
+
+    let where_clause = quote!( where T: Serialize );
+
+    let field_ty = quote!(String);
+
+    let item_ty = quote!(Cow<'a, str>);
+
+    let path = quote!(SomeTrait::serialize_with);
+
+    let value = quote!(self.x);
+
+    let tokens = quote! {
+        struct SerializeWith $generics $where_clause {
+            value: &'a $field_ty,
+            phantom: ::std::marker::PhantomData<$item_ty>,
+        }
+
+        impl $generics ::serde::Serialize for SerializeWith $generics $where_clause {
+            fn serialize<S>(&self, s: &mut S) -> Result<(), S::Error>
+                where S: ::serde::Serializer
+            {
+                $path(self.value, s)
+            }
+        }
+
+        SerializeWith {
+            value: $value,
+            phantom: ::std::marker::PhantomData::<$item_ty>,
+        }
+    };
+
+    let expected = r#"struct SerializeWith < 'a, T > where T : Serialize
+{
+    value : & 'a String, phantom : :: std :: marker :: PhantomData <Cow < 'a,
+    str > >,
+} impl < 'a, T > :: serde :: Serialize for SerializeWith < 'a, T > where T :
+Serialize
+{
+    fn serialize < S > (& self, s : & mut S) -> Result < (), S :: Error >
+    where S : :: serde :: Serializer
+    { SomeTrait :: serialize_with(self.value, s) }
+} SerializeWith
+{
+    value : self.x, phantom : :: std :: marker :: PhantomData ::<Cow < 'a, str
+    > >,
+}"#;
+
+    assert_eq!(expected, tokens.to_string());
+}
+
+fn test_integer() {
+    let ii8 = -1i8;
+    let ii16 = -1i16;
+    let ii32 = -1i32;
+    let ii64 = -1i64;
+    let ii128 = -1i128;
+    let iisize = -1isize;
+    let uu8 = 1u8;
+    let uu16 = 1u16;
+    let uu32 = 1u32;
+    let uu64 = 1u64;
+    let uu128 = 1u128;
+    let uusize = 1usize;
+
+    let tokens = quote! {
+        1 1i32 1u256
+        $ii8 $ii16 $ii32 $ii64 $ii128 $iisize
+        $uu8 $uu16 $uu32 $uu64 $uu128 $uusize
+    };
+    let expected = r#"1 1i32 1u256 -1i8 -1i16 -1i32 -1i64 -1i128 -1isize 1u8 1u16 1u32 1u64 1u128
+1usize"#;
+    assert_eq!(expected, tokens.to_string());
+}
+
+fn test_floating() {
+    let e32 = 2.345f32;
+
+    let e64 = 2.345f64;
+
+    let tokens = quote! {
+        $e32
+        $e64
+    };
+    let expected = concat!("2.345f32 2.345f64");
+    assert_eq!(expected, tokens.to_string());
+}
+
+fn test_char() {
+    let zero = '\u{1}';
+    let dollar = '$';
+    let pound = '#';
+    let quote = '"';
+    let apost = '\'';
+    let newline = '\n';
+    let heart = '\u{2764}';
+
+    let tokens = quote! {
+        $zero $dollar $pound $quote $apost $newline $heart
+    };
+    let expected = "'\\u{1}' '$' '#' '\"' '\\'' '\\n' '\u{2764}'";
+    assert_eq!(expected, tokens.to_string());
+}
+
+fn test_str() {
+    let s = "\u{1} a 'b \" c";
+    let tokens = quote!($s);
+    let expected = "\"\\u{1} a 'b \\\" c\"";
+    assert_eq!(expected, tokens.to_string());
+}
+
+fn test_string() {
+    let s = "\u{1} a 'b \" c".to_string();
+    let tokens = quote!($s);
+    let expected = "\"\\u{1} a 'b \\\" c\"";
+    assert_eq!(expected, tokens.to_string());
+}
+
+fn test_c_str() {
+    let s = CStr::from_bytes_with_nul(b"\x01 a 'b \" c\0").unwrap();
+    let tokens = quote!($s);
+    let expected = "c\"\\u{1} a 'b \\\" c\"";
+    assert_eq!(expected, tokens.to_string());
+}
+
+fn test_c_string() {
+    let s = CString::new(&b"\x01 a 'b \" c"[..]).unwrap();
+    let tokens = quote!($s);
+    let expected = "c\"\\u{1} a 'b \\\" c\"";
+    assert_eq!(expected, tokens.to_string());
+}
+
+fn test_interpolated_literal() {
+    macro_rules! m {
+        ($literal:literal) => {
+            quote!($literal)
+        };
+    }
+
+    let tokens = m!(1);
+    let expected = "1";
+    assert_eq!(expected, tokens.to_string());
+
+    let tokens = m!(-1);
+    let expected = "- 1";
+    assert_eq!(expected, tokens.to_string());
+
+    let tokens = m!(true);
+    let expected = "true";
+    assert_eq!(expected, tokens.to_string());
+
+    let tokens = m!(-true);
+    let expected = "- true";
+    assert_eq!(expected, tokens.to_string());
+}
+
+fn test_ident() {
+    let foo = Ident::new("Foo", Span::call_site());
+    let bar = Ident::new(&format!("Bar{}", 7), Span::call_site());
+    let tokens = quote!(struct $foo; enum $bar {});
+    let expected = "struct Foo; enum Bar7 {}";
+    assert_eq!(expected, tokens.to_string());
+}
+
+fn test_underscore() {
+    let tokens = quote!(let _;);
+    let expected = "let _;";
+    assert_eq!(expected, tokens.to_string());
+}
+
+fn test_duplicate() {
+    let ch = 'x';
+
+    let tokens = quote!($ch $ch);
+
+    let expected = "'x' 'x'";
+    assert_eq!(expected, tokens.to_string());
+}
+
+fn test_empty_quote() {
+    let tokens = quote!();
+    assert_eq!("", tokens.to_string());
+}
+
+fn test_box_str() {
+    let b = "str".to_owned().into_boxed_str();
+    let tokens = quote! { $b };
+    assert_eq!("\"str\"", tokens.to_string());
+}
+
+fn test_cow() {
+    let owned: Cow<Ident> = Cow::Owned(Ident::new("owned", Span::call_site()));
+
+    let ident = Ident::new("borrowed", Span::call_site());
+    let borrowed = Cow::Borrowed(&ident);
+
+    let tokens = quote! { $owned $borrowed };
+    assert_eq!("owned borrowed", tokens.to_string());
+}
+
+fn test_append_tokens() {
+    let mut a = quote!(a);
+    let b = quote!(b);
+    a.extend(b);
+    assert_eq!("a b", a.to_string());
+}
+
+fn test_outer_line_comment() {
+    let tokens = quote! {
+        /// doc
+    };
+    let expected = "#[doc = \" doc\"]";
+    assert_eq!(expected, tokens.to_string());
+}
+
+fn test_inner_line_comment() {
+    let tokens = quote! {
+        //! doc
+    };
+    let expected = "# ! [doc = \" doc\"]";
+    assert_eq!(expected, tokens.to_string());
+}
+
+fn test_outer_block_comment() {
+    let tokens = quote! {
+        /** doc */
+    };
+    let expected = "#[doc = \" doc \"]";
+    assert_eq!(expected, tokens.to_string());
+}
+
+fn test_inner_block_comment() {
+    let tokens = quote! {
+        /*! doc */
+    };
+    let expected = "# ! [doc = \" doc \"]";
+    assert_eq!(expected, tokens.to_string());
+}
+
+fn test_outer_attr() {
+    let tokens = quote! {
+        #[inline]
+    };
+    let expected = "#[inline]";
+    assert_eq!(expected, tokens.to_string());
+}
+
+fn test_inner_attr() {
+    let tokens = quote! {
+        #![no_std]
+    };
+    let expected = "#! [no_std]";
+    assert_eq!(expected, tokens.to_string());
+}
+
+fn test_quote_raw_id() {
+    let id = quote!(r#raw_id);
+    assert_eq!(id.to_string(), "r#raw_id");
+}
diff --git a/tests/ui/proc-macro/quote/basic.rs b/tests/ui/proc-macro/quote/basic.rs
new file mode 100644
index 00000000000..0336dbb7856
--- /dev/null
+++ b/tests/ui/proc-macro/quote/basic.rs
@@ -0,0 +1,8 @@
+//@ run-pass
+//@ proc-macro: basic.rs
+
+extern crate basic;
+
+fn main() {
+    basic::run_tests!();
+}
diff --git a/tests/ui/proc-macro/quote-debug.rs b/tests/ui/proc-macro/quote/debug.rs
index 11d144d609f..ce113079e56 100644
--- a/tests/ui/proc-macro/quote-debug.rs
+++ b/tests/ui/proc-macro/quote/debug.rs
@@ -15,5 +15,6 @@ extern crate proc_macro;
 fn main() {
     proc_macro::quote! {
         let hello = "world";
+        let r#raw_ident = r#"raw"literal"#;
     }
 }
diff --git a/tests/ui/proc-macro/quote/debug.stdout b/tests/ui/proc-macro/quote/debug.stdout
new file mode 100644
index 00000000000..3eaad9eb969
--- /dev/null
+++ b/tests/ui/proc-macro/quote/debug.stdout
@@ -0,0 +1,72 @@
+#![feature(prelude_import)]
+#![no_std]
+//@ check-pass
+//@ force-host
+//@ no-prefer-dynamic
+//@ compile-flags: -Z unpretty=expanded
+//@ needs-unwind compiling proc macros with panic=abort causes a warning
+//
+// This file is not actually used as a proc-macro - instead,
+// it's just used to show the output of the `quote!` macro
+
+#![feature(proc_macro_quote)]
+#![crate_type = "proc-macro"]
+#[prelude_import]
+use ::std::prelude::rust_2015::*;
+#[macro_use]
+extern crate std;
+
+extern crate proc_macro;
+
+fn main() {
+    {
+        let mut ts = crate::TokenStream::new();
+        crate::ToTokens::to_tokens(&crate::TokenTree::Ident(crate::Ident::new("let",
+                        crate::Span::recover_proc_macro_span(0))), &mut ts);
+        crate::ToTokens::to_tokens(&crate::TokenTree::Ident(crate::Ident::new("hello",
+                        crate::Span::recover_proc_macro_span(1))), &mut ts);
+        crate::ToTokens::to_tokens(&crate::TokenTree::Punct(crate::Punct::new('=',
+                        crate::Spacing::Alone)), &mut ts);
+        crate::ToTokens::to_tokens(&crate::TokenTree::Literal({
+                        let mut iter =
+                            "\"world\"".parse::<crate::TokenStream>().unwrap().into_iter();
+                        if let (Some(crate::TokenTree::Literal(mut lit)), None) =
+                                    (iter.next(), iter.next()) {
+                                lit.set_span(crate::Span::recover_proc_macro_span(2));
+                                lit
+                            } else {
+                               ::core::panicking::panic("internal error: entered unreachable code")
+                           }
+                    }), &mut ts);
+        crate::ToTokens::to_tokens(&crate::TokenTree::Punct(crate::Punct::new(';',
+                        crate::Spacing::Alone)), &mut ts);
+        crate::ToTokens::to_tokens(&crate::TokenTree::Ident(crate::Ident::new("let",
+                        crate::Span::recover_proc_macro_span(3))), &mut ts);
+        crate::ToTokens::to_tokens(&crate::TokenTree::Ident(crate::Ident::new_raw("raw_ident",
+                        crate::Span::recover_proc_macro_span(4))), &mut ts);
+        crate::ToTokens::to_tokens(&crate::TokenTree::Punct(crate::Punct::new('=',
+                        crate::Spacing::Alone)), &mut ts);
+        crate::ToTokens::to_tokens(&crate::TokenTree::Literal({
+                        let mut iter =
+                            "r#\"raw\"literal\"#".parse::<crate::TokenStream>().unwrap().into_iter();
+                        if let (Some(crate::TokenTree::Literal(mut lit)), None) =
+                                    (iter.next(), iter.next()) {
+                                lit.set_span(crate::Span::recover_proc_macro_span(5));
+                                lit
+                            } else {
+                               ::core::panicking::panic("internal error: entered unreachable code")
+                           }
+                    }), &mut ts);
+        crate::ToTokens::to_tokens(&crate::TokenTree::Punct(crate::Punct::new(';',
+                        crate::Spacing::Alone)), &mut ts);
+        ts
+    }
+}
+const _: () =
+    {
+        extern crate proc_macro;
+        #[rustc_proc_macro_decls]
+        #[used]
+        #[allow(deprecated)]
+        static _DECLS: &[proc_macro::bridge::client::ProcMacro] = &[];
+    };
diff --git a/tests/ui/proc-macro/quote/does-not-have-iter-interpolated-dup.rs b/tests/ui/proc-macro/quote/does-not-have-iter-interpolated-dup.rs
new file mode 100644
index 00000000000..2f67ae1bc6e
--- /dev/null
+++ b/tests/ui/proc-macro/quote/does-not-have-iter-interpolated-dup.rs
@@ -0,0 +1,17 @@
+// FIXME(quote): `proc_macro::quote!` doesn't support repetition at the moment, so the stderr is
+// expected to be incorrect.
+//@ known-bug: #54722
+
+#![feature(proc_macro_quote)]
+
+extern crate proc_macro;
+
+use proc_macro::quote;
+
+fn main() {
+    let nonrep = "";
+
+    // Without some protection against repetitions with no iterator somewhere
+    // inside, this would loop infinitely.
+    quote!($($nonrep $nonrep)*);
+}
diff --git a/tests/ui/proc-macro/quote/does-not-have-iter-interpolated-dup.stderr b/tests/ui/proc-macro/quote/does-not-have-iter-interpolated-dup.stderr
new file mode 100644
index 00000000000..5f28a46f318
--- /dev/null
+++ b/tests/ui/proc-macro/quote/does-not-have-iter-interpolated-dup.stderr
@@ -0,0 +1,10 @@
+error: proc macro panicked
+  --> $DIR/does-not-have-iter-interpolated-dup.rs:16:5
+   |
+LL |     quote!($($nonrep $nonrep)*);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: message: `$` must be followed by an ident or `$` in `quote!`
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/proc-macro/quote/does-not-have-iter-interpolated.rs b/tests/ui/proc-macro/quote/does-not-have-iter-interpolated.rs
new file mode 100644
index 00000000000..1efb3eac642
--- /dev/null
+++ b/tests/ui/proc-macro/quote/does-not-have-iter-interpolated.rs
@@ -0,0 +1,17 @@
+// FIXME(quote): `proc_macro::quote!` doesn't support repetition at the moment, so the stderr is
+// expected to be incorrect.
+//@ known-bug: #54722
+
+#![feature(proc_macro_quote)]
+
+extern crate proc_macro;
+
+use proc_macro::quote;
+
+fn main() {
+    let nonrep = "";
+
+    // Without some protection against repetitions with no iterator somewhere
+    // inside, this would loop infinitely.
+    quote!($($nonrep)*);
+}
diff --git a/tests/ui/proc-macro/quote/does-not-have-iter-interpolated.stderr b/tests/ui/proc-macro/quote/does-not-have-iter-interpolated.stderr
new file mode 100644
index 00000000000..595aa858763
--- /dev/null
+++ b/tests/ui/proc-macro/quote/does-not-have-iter-interpolated.stderr
@@ -0,0 +1,10 @@
+error: proc macro panicked
+  --> $DIR/does-not-have-iter-interpolated.rs:16:5
+   |
+LL |     quote!($($nonrep)*);
+   |     ^^^^^^^^^^^^^^^^^^^
+   |
+   = help: message: `$` must be followed by an ident or `$` in `quote!`
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/proc-macro/quote/does-not-have-iter-separated.rs b/tests/ui/proc-macro/quote/does-not-have-iter-separated.rs
new file mode 100644
index 00000000000..5f2ddabc390
--- /dev/null
+++ b/tests/ui/proc-macro/quote/does-not-have-iter-separated.rs
@@ -0,0 +1,13 @@
+// FIXME(quote): `proc_macro::quote!` doesn't support repetition at the moment, so the stderr is
+// expected to be incorrect.
+//@ known-bug: #54722
+
+#![feature(proc_macro_quote)]
+
+extern crate proc_macro;
+
+use proc_macro::quote;
+
+fn main() {
+    quote!($(a b),*);
+}
diff --git a/tests/ui/proc-macro/quote/does-not-have-iter-separated.stderr b/tests/ui/proc-macro/quote/does-not-have-iter-separated.stderr
new file mode 100644
index 00000000000..f6f5d7e007d
--- /dev/null
+++ b/tests/ui/proc-macro/quote/does-not-have-iter-separated.stderr
@@ -0,0 +1,10 @@
+error: proc macro panicked
+  --> $DIR/does-not-have-iter-separated.rs:12:5
+   |
+LL |     quote!($(a b),*);
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = help: message: `$` must be followed by an ident or `$` in `quote!`
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/proc-macro/quote/does-not-have-iter.rs b/tests/ui/proc-macro/quote/does-not-have-iter.rs
new file mode 100644
index 00000000000..25ffd786cc6
--- /dev/null
+++ b/tests/ui/proc-macro/quote/does-not-have-iter.rs
@@ -0,0 +1,13 @@
+// FIXME(quote): `proc_macro::quote!` doesn't support repetition at the moment, so the stderr is
+// expected to be incorrect.
+//@ known-bug: #54722
+
+#![feature(proc_macro_quote)]
+
+extern crate proc_macro;
+
+use proc_macro::quote;
+
+fn main() {
+    quote!($(a b)*);
+}
diff --git a/tests/ui/proc-macro/quote/does-not-have-iter.stderr b/tests/ui/proc-macro/quote/does-not-have-iter.stderr
new file mode 100644
index 00000000000..0ed1daffc8c
--- /dev/null
+++ b/tests/ui/proc-macro/quote/does-not-have-iter.stderr
@@ -0,0 +1,10 @@
+error: proc macro panicked
+  --> $DIR/does-not-have-iter.rs:12:5
+   |
+LL |     quote!($(a b)*);
+   |     ^^^^^^^^^^^^^^^
+   |
+   = help: message: `$` must be followed by an ident or `$` in `quote!`
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/proc-macro/quote/not-quotable.rs b/tests/ui/proc-macro/quote/not-quotable.rs
new file mode 100644
index 00000000000..7e38b441052
--- /dev/null
+++ b/tests/ui/proc-macro/quote/not-quotable.rs
@@ -0,0 +1,12 @@
+#![feature(proc_macro_quote)]
+
+extern crate proc_macro;
+
+use std::net::Ipv4Addr;
+
+use proc_macro::quote;
+
+fn main() {
+    let ip = Ipv4Addr::LOCALHOST;
+    let _ = quote! { $ip }; //~ ERROR the trait bound `Ipv4Addr: ToTokens` is not satisfied
+}
diff --git a/tests/ui/proc-macro/quote/not-quotable.stderr b/tests/ui/proc-macro/quote/not-quotable.stderr
new file mode 100644
index 00000000000..e349b2dce53
--- /dev/null
+++ b/tests/ui/proc-macro/quote/not-quotable.stderr
@@ -0,0 +1,24 @@
+error[E0277]: the trait bound `Ipv4Addr: ToTokens` is not satisfied
+  --> $DIR/not-quotable.rs:11:13
+   |
+LL |     let _ = quote! { $ip };
+   |             ^^^^^^^^^^^^^^
+   |             |
+   |             the trait `ToTokens` is not implemented for `Ipv4Addr`
+   |             required by a bound introduced by this call
+   |
+   = help: the following other types implement trait `ToTokens`:
+             &T
+             &mut T
+             Box<T>
+             CString
+             Cow<'_, T>
+             Option<T>
+             Rc<T>
+             bool
+           and 24 others
+   = note: this error originates in the macro `quote` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/proc-macro/quote/not-repeatable.rs b/tests/ui/proc-macro/quote/not-repeatable.rs
new file mode 100644
index 00000000000..d115da73181
--- /dev/null
+++ b/tests/ui/proc-macro/quote/not-repeatable.rs
@@ -0,0 +1,16 @@
+// FIXME(quote): `proc_macro::quote!` doesn't support repetition at the moment, so the stderr is
+// expected to be incorrect.
+//@ known-bug: #54722
+
+#![feature(proc_macro_quote)]
+
+extern crate proc_macro;
+
+use proc_macro::quote;
+
+struct Ipv4Addr;
+
+fn main() {
+    let ip = Ipv4Addr;
+    let _ = quote! { $($ip)* };
+}
diff --git a/tests/ui/proc-macro/quote/not-repeatable.stderr b/tests/ui/proc-macro/quote/not-repeatable.stderr
new file mode 100644
index 00000000000..18fbcd73798
--- /dev/null
+++ b/tests/ui/proc-macro/quote/not-repeatable.stderr
@@ -0,0 +1,10 @@
+error: proc macro panicked
+  --> $DIR/not-repeatable.rs:15:13
+   |
+LL |     let _ = quote! { $($ip)* };
+   |             ^^^^^^^^^^^^^^^^^^
+   |
+   = help: message: `$` must be followed by an ident or `$` in `quote!`
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/query-system/query_depth.stderr b/tests/ui/query-system/query_depth.stderr
index d455e0e4ff8..f738b01ed6c 100644
--- a/tests/ui/query-system/query_depth.stderr
+++ b/tests/ui/query-system/query_depth.stderr
@@ -5,7 +5,7 @@ LL | fn main() {
    | ^^^^^^^^^
    |
    = help: consider increasing the recursion limit by adding a `#![recursion_limit = "128"]` attribute to your crate (`query_depth`)
-   = note: query depth increased by 66 when computing layout of `core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<alloc::boxed::Box<alloc::string::String>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: query depth increased by 65 when computing layout of `core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<alloc::boxed::Box<alloc::string::String>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/regions/better-blame-constraint-for-outlives-static.rs b/tests/ui/regions/better-blame-constraint-for-outlives-static.rs
new file mode 100644
index 00000000000..77cadb78301
--- /dev/null
+++ b/tests/ui/regions/better-blame-constraint-for-outlives-static.rs
@@ -0,0 +1,13 @@
+//! diagnostic test for #132749: ensure we pick a decent span and reason to blame for region errors
+//! when failing to prove a region outlives 'static
+
+struct Bytes(&'static [u8]);
+
+fn deserialize_simple_string(buf: &[u8]) -> (Bytes, &[u8]) {
+    //~^ NOTE let's call the lifetime of this reference `'1`
+    let (s, rest) = buf.split_at(2);
+    (Bytes(s), rest) //~ ERROR lifetime may not live long enough
+    //~| NOTE this usage requires that `'1` must outlive `'static`
+}
+
+fn main() {}
diff --git a/tests/ui/regions/better-blame-constraint-for-outlives-static.stderr b/tests/ui/regions/better-blame-constraint-for-outlives-static.stderr
new file mode 100644
index 00000000000..e1e88829f2c
--- /dev/null
+++ b/tests/ui/regions/better-blame-constraint-for-outlives-static.stderr
@@ -0,0 +1,11 @@
+error: lifetime may not live long enough
+  --> $DIR/better-blame-constraint-for-outlives-static.rs:9:12
+   |
+LL | fn deserialize_simple_string(buf: &[u8]) -> (Bytes, &[u8]) {
+   |                                   - let's call the lifetime of this reference `'1`
+...
+LL |     (Bytes(s), rest)
+   |            ^ this usage requires that `'1` must outlive `'static`
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/regions/lifetime-not-long-enough-suggestion-regression-test-124563.stderr b/tests/ui/regions/lifetime-not-long-enough-suggestion-regression-test-124563.stderr
index fcd0a232a7b..9f1315070eb 100644
--- a/tests/ui/regions/lifetime-not-long-enough-suggestion-regression-test-124563.stderr
+++ b/tests/ui/regions/lifetime-not-long-enough-suggestion-regression-test-124563.stderr
@@ -25,6 +25,10 @@ LL |         self.enter_scope(|ctx| {
    |                           has type `&mut FooImpl<'2, '_, T>`
 LL |             BarImpl(ctx);
    |                     ^^^ this usage requires that `'1` must outlive `'2`
+   |
+   = note: requirement occurs because of a mutable reference to `FooImpl<'_, '_, T>`
+   = note: mutable references are invariant over their type parameter
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: lifetime may not live long enough
   --> $DIR/lifetime-not-long-enough-suggestion-regression-test-124563.rs:22:9
diff --git a/tests/ui/regions/region-invariant-static-error-reporting.rs b/tests/ui/regions/region-invariant-static-error-reporting.rs
index 9ab46a77578..e58eea3f61a 100644
--- a/tests/ui/regions/region-invariant-static-error-reporting.rs
+++ b/tests/ui/regions/region-invariant-static-error-reporting.rs
@@ -3,7 +3,7 @@
 // over time, but this test used to exhibit some pretty bogus messages
 // that were not remotely helpful.
 
-//@ error-pattern:argument requires that `'a` must outlive `'static`
+//@ error-pattern:requires that `'a` must outlive `'static`
 
 struct Invariant<'a>(Option<&'a mut &'a mut ()>);
 
@@ -11,9 +11,9 @@ fn mk_static() -> Invariant<'static> { Invariant(None) }
 
 fn unify<'a>(x: Option<Invariant<'a>>, f: fn(Invariant<'a>)) {
     let bad = if x.is_some() {
-        x.unwrap() //~ ERROR borrowed data escapes outside of function [E0521]
+        x.unwrap()
     } else {
-        mk_static()
+        mk_static() //~ ERROR lifetime may not live long enough
     };
     f(bad);
 }
diff --git a/tests/ui/regions/region-invariant-static-error-reporting.stderr b/tests/ui/regions/region-invariant-static-error-reporting.stderr
index 834d5c6cf5a..2ccf36713ae 100644
--- a/tests/ui/regions/region-invariant-static-error-reporting.stderr
+++ b/tests/ui/regions/region-invariant-static-error-reporting.stderr
@@ -1,16 +1,11 @@
-error[E0521]: borrowed data escapes outside of function
-  --> $DIR/region-invariant-static-error-reporting.rs:14:9
+error: lifetime may not live long enough
+  --> $DIR/region-invariant-static-error-reporting.rs:16:9
    |
 LL | fn unify<'a>(x: Option<Invariant<'a>>, f: fn(Invariant<'a>)) {
-   |          --  - `x` is a reference that is only valid in the function body
-   |          |
-   |          lifetime `'a` defined here
-LL |     let bad = if x.is_some() {
-LL |         x.unwrap()
-   |         ^^^^^^^^^^
-   |         |
-   |         `x` escapes the function body here
-   |         argument requires that `'a` must outlive `'static`
+   |          -- lifetime `'a` defined here
+...
+LL |         mk_static()
+   |         ^^^^^^^^^^^ assignment requires that `'a` must outlive `'static`
    |
    = note: requirement occurs because of the type `Invariant<'_>`, which makes the generic argument `'_` invariant
    = note: the struct `Invariant<'a>` is invariant over the parameter `'a`
@@ -18,4 +13,3 @@ LL |         x.unwrap()
 
 error: aborting due to 1 previous error
 
-For more information about this error, try `rustc --explain E0521`.
diff --git a/tests/ui/repeat-expr/repeat_count.stderr b/tests/ui/repeat-expr/repeat_count.stderr
index 350ac287507..c4aebfb0e20 100644
--- a/tests/ui/repeat-expr/repeat_count.stderr
+++ b/tests/ui/repeat-expr/repeat_count.stderr
@@ -16,6 +16,12 @@ LL |     let b = [0; ()];
    |                 ^^ expected `usize`, found `()`
 
 error[E0308]: mismatched types
+  --> $DIR/repeat_count.rs:31:17
+   |
+LL |     let g = [0; G { g: () }];
+   |                 ^^^^^^^^^^^ expected `usize`, found `G`
+
+error[E0308]: mismatched types
   --> $DIR/repeat_count.rs:10:17
    |
 LL |     let c = [0; true];
@@ -34,12 +40,6 @@ LL |     let e = [0; "foo"];
    |                 ^^^^^ expected `usize`, found `&str`
 
 error[E0308]: mismatched types
-  --> $DIR/repeat_count.rs:31:17
-   |
-LL |     let g = [0; G { g: () }];
-   |                 ^^^^^^^^^^^ expected `usize`, found `G`
-
-error[E0308]: mismatched types
   --> $DIR/repeat_count.rs:19:17
    |
 LL |     let f = [0; -4_isize];
diff --git a/tests/ui/repeat-expr/typo-in-repeat-expr-issue-80173.rs b/tests/ui/repeat-expr/typo-in-repeat-expr-issue-80173.rs
new file mode 100644
index 00000000000..c76e7a1d716
--- /dev/null
+++ b/tests/ui/repeat-expr/typo-in-repeat-expr-issue-80173.rs
@@ -0,0 +1,70 @@
+#[derive(Copy, Clone)]
+struct Type;
+
+struct NewType;
+
+const fn get_size() -> usize {
+    10
+}
+
+fn get_dyn_size() -> usize {
+    10
+}
+
+fn main() {
+    let a = ["a", 10];
+    //~^ ERROR mismatched types
+    //~| HELP replace the comma with a semicolon to create an array
+
+    const size_b: usize = 20;
+    let b = [Type, size_b];
+    //~^ ERROR mismatched types
+    //~| HELP replace the comma with a semicolon to create an array
+
+    let size_c: usize = 13;
+    let c = [Type, size_c];
+    //~^ ERROR mismatched types
+
+    const size_d: bool = true;
+    let d = [Type, size_d];
+    //~^ ERROR mismatched types
+
+    let e = [String::new(), 10];
+    //~^ ERROR mismatched types
+    //~| HELP try using a conversion method
+
+    let f = ["f", get_size()];
+    //~^ ERROR mismatched types
+    //~| HELP replace the comma with a semicolon to create an array
+
+    let m = ["m", get_dyn_size()];
+    //~^ ERROR mismatched types
+
+    // is_vec, is_clone, is_usize_like
+    let g = vec![String::new(), 10];
+    //~^ ERROR mismatched types
+    //~| HELP replace the comma with a semicolon to create a vector
+
+    let dyn_size = 10;
+    let h = vec![Type, dyn_size];
+    //~^ ERROR mismatched types
+    //~| HELP replace the comma with a semicolon to create a vector
+
+    let i = vec![Type, get_dyn_size()];
+    //~^ ERROR mismatched types
+    //~| HELP replace the comma with a semicolon to create a vector
+
+    let k = vec!['c', 10];
+    //~^ ERROR mismatched types
+    //~| HELP replace the comma with a semicolon to create a vector
+
+    let j = vec![Type, 10_u8];
+    //~^ ERROR mismatched types
+
+    let l = vec![NewType, 10];
+    //~^ ERROR mismatched types
+
+    let byte_size: u8 = 10;
+    let h = vec![Type, byte_size];
+    //~^ ERROR mismatched types
+}
diff --git a/tests/ui/repeat-expr/typo-in-repeat-expr-issue-80173.stderr b/tests/ui/repeat-expr/typo-in-repeat-expr-issue-80173.stderr
new file mode 100644
index 00000000000..95eddbde9e6
--- /dev/null
+++ b/tests/ui/repeat-expr/typo-in-repeat-expr-issue-80173.stderr
@@ -0,0 +1,124 @@
+error[E0308]: mismatched types
+  --> $DIR/typo-in-repeat-expr-issue-80173.rs:15:19
+   |
+LL |     let a = ["a", 10];
+   |                   ^^ expected `&str`, found integer
+   |
+help: replace the comma with a semicolon to create an array
+   |
+LL |     let a = ["a"; 10];
+   |                 ~
+
+error[E0308]: mismatched types
+  --> $DIR/typo-in-repeat-expr-issue-80173.rs:20:20
+   |
+LL |     let b = [Type, size_b];
+   |                    ^^^^^^ expected `Type`, found `usize`
+   |
+help: replace the comma with a semicolon to create an array
+   |
+LL |     let b = [Type; size_b];
+   |                  ~
+
+error[E0308]: mismatched types
+  --> $DIR/typo-in-repeat-expr-issue-80173.rs:25:20
+   |
+LL |     let c = [Type, size_c];
+   |                    ^^^^^^ expected `Type`, found `usize`
+
+error[E0308]: mismatched types
+  --> $DIR/typo-in-repeat-expr-issue-80173.rs:29:20
+   |
+LL |     let d = [Type, size_d];
+   |                    ^^^^^^ expected `Type`, found `bool`
+
+error[E0308]: mismatched types
+  --> $DIR/typo-in-repeat-expr-issue-80173.rs:32:29
+   |
+LL |     let e = [String::new(), 10];
+   |                             ^^- help: try using a conversion method: `.to_string()`
+   |                             |
+   |                             expected `String`, found integer
+
+error[E0308]: mismatched types
+  --> $DIR/typo-in-repeat-expr-issue-80173.rs:36:19
+   |
+LL |     let f = ["f", get_size()];
+   |                   ^^^^^^^^^^ expected `&str`, found `usize`
+   |
+help: replace the comma with a semicolon to create an array
+   |
+LL |     let f = ["f"; get_size()];
+   |                 ~
+
+error[E0308]: mismatched types
+  --> $DIR/typo-in-repeat-expr-issue-80173.rs:40:19
+   |
+LL |     let m = ["m", get_dyn_size()];
+   |                   ^^^^^^^^^^^^^^ expected `&str`, found `usize`
+
+error[E0308]: mismatched types
+  --> $DIR/typo-in-repeat-expr-issue-80173.rs:44:33
+   |
+LL |     let g = vec![String::new(), 10];
+   |                                 ^^ expected `String`, found integer
+   |
+help: replace the comma with a semicolon to create a vector
+   |
+LL |     let g = vec![String::new(); 10];
+   |                               ~
+
+error[E0308]: mismatched types
+  --> $DIR/typo-in-repeat-expr-issue-80173.rs:49:24
+   |
+LL |     let h = vec![Type, dyn_size];
+   |                        ^^^^^^^^ expected `Type`, found integer
+   |
+help: replace the comma with a semicolon to create a vector
+   |
+LL |     let h = vec![Type; dyn_size];
+   |                      ~
+
+error[E0308]: mismatched types
+  --> $DIR/typo-in-repeat-expr-issue-80173.rs:53:24
+   |
+LL |     let i = vec![Type, get_dyn_size()];
+   |                        ^^^^^^^^^^^^^^ expected `Type`, found `usize`
+   |
+help: replace the comma with a semicolon to create a vector
+   |
+LL |     let i = vec![Type; get_dyn_size()];
+   |                      ~
+
+error[E0308]: mismatched types
+  --> $DIR/typo-in-repeat-expr-issue-80173.rs:57:23
+   |
+LL |     let k = vec!['c', 10];
+   |                       ^^ expected `char`, found `u8`
+   |
+help: replace the comma with a semicolon to create a vector
+   |
+LL |     let k = vec!['c'; 10];
+   |                     ~
+
+error[E0308]: mismatched types
+  --> $DIR/typo-in-repeat-expr-issue-80173.rs:61:24
+   |
+LL |     let j = vec![Type, 10_u8];
+   |                        ^^^^^ expected `Type`, found `u8`
+
+error[E0308]: mismatched types
+  --> $DIR/typo-in-repeat-expr-issue-80173.rs:64:27
+   |
+LL |     let l = vec![NewType, 10];
+   |                           ^^ expected `NewType`, found integer
+
+error[E0308]: mismatched types
+  --> $DIR/typo-in-repeat-expr-issue-80173.rs:68:24
+   |
+LL |     let h = vec![Type, byte_size];
+   |                        ^^^^^^^^^ expected `Type`, found `u8`
+
+error: aborting due to 14 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr b/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr
index 64a0cb7f31a..8e8f1d159b7 100644
--- a/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr
+++ b/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr
@@ -55,13 +55,15 @@ error: layout_of(Univariant) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(4 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/repr-c-dead-variants.rs:38:1
+  --> $DIR/repr-c-dead-variants.rs:39:1
    |
 LL | enum Univariant {
    | ^^^^^^^^^^^^^^^
@@ -137,6 +139,7 @@ error: layout_of(TwoVariants) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(4 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(8 bytes),
@@ -173,13 +176,15 @@ error: layout_of(TwoVariants) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(4 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/repr-c-dead-variants.rs:45:1
+  --> $DIR/repr-c-dead-variants.rs:46:1
    |
 LL | enum TwoVariants {
    | ^^^^^^^^^^^^^^^^
@@ -247,6 +252,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout {
                            Align(8 bytes),
                        ),
                        unadjusted_abi_align: Align(8 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(16 bytes),
@@ -271,6 +277,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(8 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
@@ -278,8 +285,9 @@ error: layout_of(DeadBranchHasOtherField) = Layout {
                Align(8 bytes),
            ),
            unadjusted_abi_align: Align(8 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/repr-c-dead-variants.rs:57:1
+  --> $DIR/repr-c-dead-variants.rs:58:1
    |
 LL | enum DeadBranchHasOtherField {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr b/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr
index 5c4daa6d519..2cd0960ce3e 100644
--- a/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr
+++ b/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr
@@ -55,13 +55,15 @@ error: layout_of(Univariant) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(1 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/repr-c-dead-variants.rs:38:1
+  --> $DIR/repr-c-dead-variants.rs:39:1
    |
 LL | enum Univariant {
    | ^^^^^^^^^^^^^^^
@@ -137,6 +139,7 @@ error: layout_of(TwoVariants) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(2 bytes),
@@ -173,13 +176,15 @@ error: layout_of(TwoVariants) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(1 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/repr-c-dead-variants.rs:45:1
+  --> $DIR/repr-c-dead-variants.rs:46:1
    |
 LL | enum TwoVariants {
    | ^^^^^^^^^^^^^^^^
@@ -247,6 +252,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout {
                            Align(8 bytes),
                        ),
                        unadjusted_abi_align: Align(8 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(16 bytes),
@@ -271,6 +277,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(8 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
@@ -278,8 +285,9 @@ error: layout_of(DeadBranchHasOtherField) = Layout {
                Align(8 bytes),
            ),
            unadjusted_abi_align: Align(8 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/repr-c-dead-variants.rs:57:1
+  --> $DIR/repr-c-dead-variants.rs:58:1
    |
 LL | enum DeadBranchHasOtherField {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr b/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr
index 64a0cb7f31a..8e8f1d159b7 100644
--- a/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr
+++ b/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr
@@ -55,13 +55,15 @@ error: layout_of(Univariant) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(4 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/repr-c-dead-variants.rs:38:1
+  --> $DIR/repr-c-dead-variants.rs:39:1
    |
 LL | enum Univariant {
    | ^^^^^^^^^^^^^^^
@@ -137,6 +139,7 @@ error: layout_of(TwoVariants) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(4 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(8 bytes),
@@ -173,13 +176,15 @@ error: layout_of(TwoVariants) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(4 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/repr-c-dead-variants.rs:45:1
+  --> $DIR/repr-c-dead-variants.rs:46:1
    |
 LL | enum TwoVariants {
    | ^^^^^^^^^^^^^^^^
@@ -247,6 +252,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout {
                            Align(8 bytes),
                        ),
                        unadjusted_abi_align: Align(8 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(16 bytes),
@@ -271,6 +277,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(8 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
@@ -278,8 +285,9 @@ error: layout_of(DeadBranchHasOtherField) = Layout {
                Align(8 bytes),
            ),
            unadjusted_abi_align: Align(8 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/repr-c-dead-variants.rs:57:1
+  --> $DIR/repr-c-dead-variants.rs:58:1
    |
 LL | enum DeadBranchHasOtherField {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/repr/repr-c-dead-variants.rs b/tests/ui/repr/repr-c-dead-variants.rs
index 3e8ae3d096d..99f20982a99 100644
--- a/tests/ui/repr/repr-c-dead-variants.rs
+++ b/tests/ui/repr/repr-c-dead-variants.rs
@@ -7,6 +7,7 @@
 // See also: repr-c-int-dead-variants.rs
 
 //@ normalize-stderr: "pref: Align\([1-8] bytes\)" -> "pref: $$SOME_ALIGN"
+//@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED"
 
 // This test depends on the value of the `c_enum_min_bits` target option.
 // As there's no way to actually check it from UI test, we only run this test on a subset of archs.
diff --git a/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr b/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr
index 64a0cb7f31a..8e8f1d159b7 100644
--- a/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr
+++ b/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr
@@ -55,13 +55,15 @@ error: layout_of(Univariant) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(4 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/repr-c-dead-variants.rs:38:1
+  --> $DIR/repr-c-dead-variants.rs:39:1
    |
 LL | enum Univariant {
    | ^^^^^^^^^^^^^^^
@@ -137,6 +139,7 @@ error: layout_of(TwoVariants) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(4 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(8 bytes),
@@ -173,13 +176,15 @@ error: layout_of(TwoVariants) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(4 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/repr-c-dead-variants.rs:45:1
+  --> $DIR/repr-c-dead-variants.rs:46:1
    |
 LL | enum TwoVariants {
    | ^^^^^^^^^^^^^^^^
@@ -247,6 +252,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout {
                            Align(8 bytes),
                        ),
                        unadjusted_abi_align: Align(8 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(16 bytes),
@@ -271,6 +277,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(8 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
@@ -278,8 +285,9 @@ error: layout_of(DeadBranchHasOtherField) = Layout {
                Align(8 bytes),
            ),
            unadjusted_abi_align: Align(8 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/repr-c-dead-variants.rs:57:1
+  --> $DIR/repr-c-dead-variants.rs:58:1
    |
 LL | enum DeadBranchHasOtherField {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/repr/repr-c-int-dead-variants.rs b/tests/ui/repr/repr-c-int-dead-variants.rs
index 627569e080d..723e5730244 100644
--- a/tests/ui/repr/repr-c-int-dead-variants.rs
+++ b/tests/ui/repr/repr-c-int-dead-variants.rs
@@ -4,6 +4,7 @@
 // See also: repr-c-dead-variants.rs
 
 //@ normalize-stderr: "pref: Align\([1-8] bytes\)" -> "pref: $$SOME_ALIGN"
+//@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED"
 
 // A simple uninhabited type.
 enum Void {}
diff --git a/tests/ui/repr/repr-c-int-dead-variants.stderr b/tests/ui/repr/repr-c-int-dead-variants.stderr
index 75005a64523..fa08b323dec 100644
--- a/tests/ui/repr/repr-c-int-dead-variants.stderr
+++ b/tests/ui/repr/repr-c-int-dead-variants.stderr
@@ -55,13 +55,15 @@ error: layout_of(UnivariantU8) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(1 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/repr-c-int-dead-variants.rs:14:1
+  --> $DIR/repr-c-int-dead-variants.rs:15:1
    |
 LL | enum UnivariantU8 {
    | ^^^^^^^^^^^^^^^^^
@@ -137,6 +139,7 @@ error: layout_of(TwoVariantsU8) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(2 bytes),
@@ -173,13 +176,15 @@ error: layout_of(TwoVariantsU8) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(1 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/repr-c-int-dead-variants.rs:21:1
+  --> $DIR/repr-c-int-dead-variants.rs:22:1
    |
 LL | enum TwoVariantsU8 {
    | ^^^^^^^^^^^^^^^^^^
@@ -247,6 +252,7 @@ error: layout_of(DeadBranchHasOtherFieldU8) = Layout {
                            Align(8 bytes),
                        ),
                        unadjusted_abi_align: Align(8 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(16 bytes),
@@ -271,6 +277,7 @@ error: layout_of(DeadBranchHasOtherFieldU8) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(8 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
@@ -278,8 +285,9 @@ error: layout_of(DeadBranchHasOtherFieldU8) = Layout {
                Align(8 bytes),
            ),
            unadjusted_abi_align: Align(8 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/repr-c-int-dead-variants.rs:33:1
+  --> $DIR/repr-c-int-dead-variants.rs:34:1
    |
 LL | enum DeadBranchHasOtherFieldU8 {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/self/arbitrary-self-from-method-substs-ice.stderr b/tests/ui/self/arbitrary-self-from-method-substs-ice.stderr
index cf4c219215e..90b63249eca 100644
--- a/tests/ui/self/arbitrary-self-from-method-substs-ice.stderr
+++ b/tests/ui/self/arbitrary-self-from-method-substs-ice.stderr
@@ -4,6 +4,7 @@ error[E0658]: cannot call conditionally-const method `<R as Deref>::deref` in co
 LL |         self.0
    |         ^^^^^^
    |
+   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
    = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
    = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
diff --git a/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021-without-dyn.stderr b/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021-without-dyn.stderr
index c0cfb18955c..404df206e18 100644
--- a/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021-without-dyn.stderr
+++ b/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021-without-dyn.stderr
@@ -1,42 +1,3 @@
-error: associated item referring to unboxed trait object for its own trait
-  --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:4:13
-   |
-LL | trait A: Sized {
-   |       - in this trait
-LL |     fn f(a: A) -> A;
-   |             ^     ^
-   |
-help: you might have meant to use `Self` to refer to the implementing type
-   |
-LL |     fn f(a: Self) -> Self;
-   |             ~~~~     ~~~~
-
-error: associated item referring to unboxed trait object for its own trait
-  --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:10:13
-   |
-LL | trait B {
-   |       - in this trait
-LL |     fn f(b: B) -> B;
-   |             ^     ^
-   |
-help: you might have meant to use `Self` to refer to the implementing type
-   |
-LL |     fn f(b: Self) -> Self;
-   |             ~~~~     ~~~~
-
-error: associated item referring to unboxed trait object for its own trait
-  --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:16:20
-   |
-LL | trait C {
-   |       - in this trait
-LL |     fn f(&self, c: C) -> C;
-   |                    ^     ^
-   |
-help: you might have meant to use `Self` to refer to the implementing type
-   |
-LL |     fn f(&self, c: Self) -> Self;
-   |                    ~~~~     ~~~~
-
 error[E0782]: expected a type, found a trait
   --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:4:13
    |
@@ -118,6 +79,45 @@ help: `C` is dyn-incompatible, use `impl C` to return an opaque type, as long as
 LL |     fn f(&self, c: C) -> impl C;
    |                          ++++
 
+error: associated item referring to unboxed trait object for its own trait
+  --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:4:13
+   |
+LL | trait A: Sized {
+   |       - in this trait
+LL |     fn f(a: A) -> A;
+   |             ^     ^
+   |
+help: you might have meant to use `Self` to refer to the implementing type
+   |
+LL |     fn f(a: Self) -> Self;
+   |             ~~~~     ~~~~
+
+error: associated item referring to unboxed trait object for its own trait
+  --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:10:13
+   |
+LL | trait B {
+   |       - in this trait
+LL |     fn f(b: B) -> B;
+   |             ^     ^
+   |
+help: you might have meant to use `Self` to refer to the implementing type
+   |
+LL |     fn f(b: Self) -> Self;
+   |             ~~~~     ~~~~
+
+error: associated item referring to unboxed trait object for its own trait
+  --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:16:20
+   |
+LL | trait C {
+   |       - in this trait
+LL |     fn f(&self, c: C) -> C;
+   |                    ^     ^
+   |
+help: you might have meant to use `Self` to refer to the implementing type
+   |
+LL |     fn f(&self, c: Self) -> Self;
+   |                    ~~~~     ~~~~
+
 error: aborting due to 9 previous errors
 
 For more information about this error, try `rustc --explain E0782`.
diff --git a/tests/ui/suggestions/issue-105761-suggest-self-for-closure.stderr b/tests/ui/suggestions/issue-105761-suggest-self-for-closure.stderr
index bc97d32ebb6..8ddea4b222e 100644
--- a/tests/ui/suggestions/issue-105761-suggest-self-for-closure.stderr
+++ b/tests/ui/suggestions/issue-105761-suggest-self-for-closure.stderr
@@ -11,7 +11,7 @@ LL |         self.qux();
 LL |         x(1);
    |         - immutable borrow later used here
    |
-help: try explicitly pass `&Self` into the Closure as an argument
+help: try explicitly passing `&Self` into the closure as an argument
    |
 LL ~         let x = |this: &Self, v: i32| {
 LL ~             this.bar();
@@ -35,7 +35,7 @@ LL |         self.qux();
 LL |         y();
    |         - immutable borrow later used here
    |
-help: try explicitly pass `&Self` into the Closure as an argument
+help: try explicitly passing `&Self` into the closure as an argument
    |
 LL ~         let y = |this: &Self| {
 LL ~             this.bar();
diff --git a/tests/ui/traits/coercion-generic-regions.stderr b/tests/ui/traits/coercion-generic-regions.stderr
index 576035f8c13..c48767095df 100644
--- a/tests/ui/traits/coercion-generic-regions.stderr
+++ b/tests/ui/traits/coercion-generic-regions.stderr
@@ -4,11 +4,9 @@ error[E0597]: `person` does not live long enough
 LL |     let person = "Fred".to_string();
    |         ------ binding `person` declared here
 LL |     let person: &str = &person;
-   |                        ^^^^^^^
-   |                        |
-   |                        borrowed value does not live long enough
-   |                        assignment requires that `person` is borrowed for `'static`
+   |                        ^^^^^^^ borrowed value does not live long enough
 LL |     let s: Box<dyn Trait<&'static str>> = Box::new(Struct { person: person });
+   |                                                                     ------ this usage requires that `person` is borrowed for `'static`
 LL | }
    | - `person` dropped here while still borrowed
 
diff --git a/tests/ui/traits/const-traits/const-drop-bound.rs b/tests/ui/traits/const-traits/const-drop-bound.rs
index 398fb390640..4819da7c3a4 100644
--- a/tests/ui/traits/const-traits/const-drop-bound.rs
+++ b/tests/ui/traits/const-traits/const-drop-bound.rs
@@ -1,5 +1,4 @@
-//@ known-bug: #110395
-// FIXME check-pass
+//@ check-pass
 
 #![feature(const_trait_impl)]
 #![feature(const_precise_live_drops, const_destruct)]
diff --git a/tests/ui/traits/const-traits/const-drop-bound.stderr b/tests/ui/traits/const-traits/const-drop-bound.stderr
deleted file mode 100644
index 78ba0279566..00000000000
--- a/tests/ui/traits/const-traits/const-drop-bound.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0277]: the trait bound `Foo<E>: ~const Destruct` is not satisfied
-  --> $DIR/const-drop-bound.rs:23:9
-   |
-LL |     foo(res)
-   |     --- ^^^
-   |     |
-   |     required by a bound introduced by this call
-   |
-note: required by a bound in `foo`
-  --> $DIR/const-drop-bound.rs:9:61
-   |
-LL | const fn foo<T, E>(res: Result<T, E>) -> Option<T> where E: ~const Destruct {
-   |                                                             ^^^^^^ required by this bound in `foo`
-
-error: aborting due to 1 previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/const-traits/const-drop-fail-2.precise.stderr b/tests/ui/traits/const-traits/const-drop-fail-2.precise.stderr
index 7b2cafb6124..2b5e66b1a08 100644
--- a/tests/ui/traits/const-traits/const-drop-fail-2.precise.stderr
+++ b/tests/ui/traits/const-traits/const-drop-fail-2.precise.stderr
@@ -1,9 +1,16 @@
-error[E0277]: the trait bound `ConstDropImplWithBounds<NonTrivialDrop>: const Destruct` is not satisfied
+error[E0277]: the trait bound `NonTrivialDrop: const A` is not satisfied
   --> $DIR/const-drop-fail-2.rs:31:23
    |
 LL | const _: () = check::<ConstDropImplWithBounds<NonTrivialDrop>>(
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
+note: required for `ConstDropImplWithBounds<NonTrivialDrop>` to implement `const Drop`
+  --> $DIR/const-drop-fail-2.rs:25:25
+   |
+LL | impl<T: ~const A> const Drop for ConstDropImplWithBounds<T> {
+   |         ------          ^^^^     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |         |
+   |         unsatisfied trait bound introduced here
 note: required by a bound in `check`
   --> $DIR/const-drop-fail-2.rs:21:19
    |
diff --git a/tests/ui/traits/const-traits/const-drop-fail-2.stock.stderr b/tests/ui/traits/const-traits/const-drop-fail-2.stock.stderr
index 7b2cafb6124..2b5e66b1a08 100644
--- a/tests/ui/traits/const-traits/const-drop-fail-2.stock.stderr
+++ b/tests/ui/traits/const-traits/const-drop-fail-2.stock.stderr
@@ -1,9 +1,16 @@
-error[E0277]: the trait bound `ConstDropImplWithBounds<NonTrivialDrop>: const Destruct` is not satisfied
+error[E0277]: the trait bound `NonTrivialDrop: const A` is not satisfied
   --> $DIR/const-drop-fail-2.rs:31:23
    |
 LL | const _: () = check::<ConstDropImplWithBounds<NonTrivialDrop>>(
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
+note: required for `ConstDropImplWithBounds<NonTrivialDrop>` to implement `const Drop`
+  --> $DIR/const-drop-fail-2.rs:25:25
+   |
+LL | impl<T: ~const A> const Drop for ConstDropImplWithBounds<T> {
+   |         ------          ^^^^     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |         |
+   |         unsatisfied trait bound introduced here
 note: required by a bound in `check`
   --> $DIR/const-drop-fail-2.rs:21:19
    |
diff --git a/tests/ui/traits/const-traits/const-drop-fail.precise.stderr b/tests/ui/traits/const-traits/const-drop-fail.new_precise.stderr
index 8b3e777a0b0..682f48fe07a 100644
--- a/tests/ui/traits/const-traits/const-drop-fail.precise.stderr
+++ b/tests/ui/traits/const-traits/const-drop-fail.new_precise.stderr
@@ -1,5 +1,5 @@
 error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied
-  --> $DIR/const-drop-fail.rs:32:5
+  --> $DIR/const-drop-fail.rs:33:5
    |
 LL |         const _: () = check($exp);
    |                       ----- required by a bound introduced by this call
@@ -8,13 +8,13 @@ LL |     NonTrivialDrop,
    |     ^^^^^^^^^^^^^^
    |
 note: required by a bound in `check`
-  --> $DIR/const-drop-fail.rs:23:19
+  --> $DIR/const-drop-fail.rs:24:19
    |
 LL | const fn check<T: ~const Destruct>(_: T) {}
    |                   ^^^^^^ required by this bound in `check`
 
 error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied
-  --> $DIR/const-drop-fail.rs:34:5
+  --> $DIR/const-drop-fail.rs:35:5
    |
 LL |         const _: () = check($exp);
    |                       ----- required by a bound introduced by this call
@@ -23,7 +23,7 @@ LL |     ConstImplWithDropGlue(NonTrivialDrop),
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: required by a bound in `check`
-  --> $DIR/const-drop-fail.rs:23:19
+  --> $DIR/const-drop-fail.rs:24:19
    |
 LL | const fn check<T: ~const Destruct>(_: T) {}
    |                   ^^^^^^ required by this bound in `check`
diff --git a/tests/ui/traits/const-traits/const-drop-fail.stock.stderr b/tests/ui/traits/const-traits/const-drop-fail.new_stock.stderr
index 8b3e777a0b0..682f48fe07a 100644
--- a/tests/ui/traits/const-traits/const-drop-fail.stock.stderr
+++ b/tests/ui/traits/const-traits/const-drop-fail.new_stock.stderr
@@ -1,5 +1,5 @@
 error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied
-  --> $DIR/const-drop-fail.rs:32:5
+  --> $DIR/const-drop-fail.rs:33:5
    |
 LL |         const _: () = check($exp);
    |                       ----- required by a bound introduced by this call
@@ -8,13 +8,13 @@ LL |     NonTrivialDrop,
    |     ^^^^^^^^^^^^^^
    |
 note: required by a bound in `check`
-  --> $DIR/const-drop-fail.rs:23:19
+  --> $DIR/const-drop-fail.rs:24:19
    |
 LL | const fn check<T: ~const Destruct>(_: T) {}
    |                   ^^^^^^ required by this bound in `check`
 
 error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied
-  --> $DIR/const-drop-fail.rs:34:5
+  --> $DIR/const-drop-fail.rs:35:5
    |
 LL |         const _: () = check($exp);
    |                       ----- required by a bound introduced by this call
@@ -23,7 +23,7 @@ LL |     ConstImplWithDropGlue(NonTrivialDrop),
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: required by a bound in `check`
-  --> $DIR/const-drop-fail.rs:23:19
+  --> $DIR/const-drop-fail.rs:24:19
    |
 LL | const fn check<T: ~const Destruct>(_: T) {}
    |                   ^^^^^^ required by this bound in `check`
diff --git a/tests/ui/traits/const-traits/const-drop-fail.old_precise.stderr b/tests/ui/traits/const-traits/const-drop-fail.old_precise.stderr
new file mode 100644
index 00000000000..682f48fe07a
--- /dev/null
+++ b/tests/ui/traits/const-traits/const-drop-fail.old_precise.stderr
@@ -0,0 +1,33 @@
+error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied
+  --> $DIR/const-drop-fail.rs:33:5
+   |
+LL |         const _: () = check($exp);
+   |                       ----- required by a bound introduced by this call
+...
+LL |     NonTrivialDrop,
+   |     ^^^^^^^^^^^^^^
+   |
+note: required by a bound in `check`
+  --> $DIR/const-drop-fail.rs:24:19
+   |
+LL | const fn check<T: ~const Destruct>(_: T) {}
+   |                   ^^^^^^ required by this bound in `check`
+
+error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied
+  --> $DIR/const-drop-fail.rs:35:5
+   |
+LL |         const _: () = check($exp);
+   |                       ----- required by a bound introduced by this call
+...
+LL |     ConstImplWithDropGlue(NonTrivialDrop),
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+note: required by a bound in `check`
+  --> $DIR/const-drop-fail.rs:24:19
+   |
+LL | const fn check<T: ~const Destruct>(_: T) {}
+   |                   ^^^^^^ required by this bound in `check`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/const-traits/const-drop-fail.old_stock.stderr b/tests/ui/traits/const-traits/const-drop-fail.old_stock.stderr
new file mode 100644
index 00000000000..682f48fe07a
--- /dev/null
+++ b/tests/ui/traits/const-traits/const-drop-fail.old_stock.stderr
@@ -0,0 +1,33 @@
+error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied
+  --> $DIR/const-drop-fail.rs:33:5
+   |
+LL |         const _: () = check($exp);
+   |                       ----- required by a bound introduced by this call
+...
+LL |     NonTrivialDrop,
+   |     ^^^^^^^^^^^^^^
+   |
+note: required by a bound in `check`
+  --> $DIR/const-drop-fail.rs:24:19
+   |
+LL | const fn check<T: ~const Destruct>(_: T) {}
+   |                   ^^^^^^ required by this bound in `check`
+
+error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied
+  --> $DIR/const-drop-fail.rs:35:5
+   |
+LL |         const _: () = check($exp);
+   |                       ----- required by a bound introduced by this call
+...
+LL |     ConstImplWithDropGlue(NonTrivialDrop),
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+note: required by a bound in `check`
+  --> $DIR/const-drop-fail.rs:24:19
+   |
+LL | const fn check<T: ~const Destruct>(_: T) {}
+   |                   ^^^^^^ required by this bound in `check`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/const-traits/const-drop-fail.rs b/tests/ui/traits/const-traits/const-drop-fail.rs
index 5e05b9db474..a7f3d5654de 100644
--- a/tests/ui/traits/const-traits/const-drop-fail.rs
+++ b/tests/ui/traits/const-traits/const-drop-fail.rs
@@ -1,8 +1,9 @@
-//@ compile-flags: -Znext-solver
-//@ revisions: stock precise
+//@[new_precise] compile-flags: -Znext-solver
+//@[new_stock] compile-flags: -Znext-solver
+//@ revisions: new_stock old_stock new_precise old_precise
 
 #![feature(const_trait_impl, const_destruct)]
-#![cfg_attr(precise, feature(const_precise_live_drops))]
+#![cfg_attr(any(new_precise, old_precise), feature(const_precise_live_drops))]
 
 use std::marker::{Destruct, PhantomData};
 
diff --git a/tests/ui/traits/const-traits/cross-crate.stock.stderr b/tests/ui/traits/const-traits/cross-crate.stock.stderr
index 09bf9c023c8..7cdde5a079f 100644
--- a/tests/ui/traits/const-traits/cross-crate.stock.stderr
+++ b/tests/ui/traits/const-traits/cross-crate.stock.stderr
@@ -1,9 +1,10 @@
 error[E0658]: cannot call conditionally-const method `<cross_crate::Const as cross_crate::MyTrait>::func` in constant functions
-  --> $DIR/cross-crate.rs:22:5
+  --> $DIR/cross-crate.rs:22:11
    |
 LL |     Const.func();
-   |     ^^^^^^^^^^^^
+   |           ^^^^^^
    |
+   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
    = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
    = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
diff --git a/tests/ui/traits/const-traits/cross-crate.stocknc.stderr b/tests/ui/traits/const-traits/cross-crate.stocknc.stderr
index e52e5609b01..2358731c901 100644
--- a/tests/ui/traits/const-traits/cross-crate.stocknc.stderr
+++ b/tests/ui/traits/const-traits/cross-crate.stocknc.stderr
@@ -1,19 +1,21 @@
 error[E0658]: cannot call conditionally-const method `<cross_crate::NonConst as cross_crate::MyTrait>::func` in constant functions
-  --> $DIR/cross-crate.rs:19:5
+  --> $DIR/cross-crate.rs:19:14
    |
 LL |     NonConst.func();
-   |     ^^^^^^^^^^^^^^^
+   |              ^^^^^^
    |
+   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
    = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
    = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0658]: cannot call conditionally-const method `<cross_crate::Const as cross_crate::MyTrait>::func` in constant functions
-  --> $DIR/cross-crate.rs:22:5
+  --> $DIR/cross-crate.rs:22:11
    |
 LL |     Const.func();
-   |     ^^^^^^^^^^^^
+   |           ^^^^^^
    |
+   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
    = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
    = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
diff --git a/tests/ui/traits/const-traits/staged-api-user-crate.stderr b/tests/ui/traits/const-traits/staged-api-user-crate.stderr
index bf7466b8e16..400c76fcaf4 100644
--- a/tests/ui/traits/const-traits/staged-api-user-crate.stderr
+++ b/tests/ui/traits/const-traits/staged-api-user-crate.stderr
@@ -4,6 +4,7 @@ error[E0658]: cannot call conditionally-const associated function `<staged_api::
 LL |     Unstable::func();
    |     ^^^^^^^^^^^^^^^^
    |
+   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
    = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
    = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.nyn.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.nyn.stderr
index 8abda1c8f8a..024db4b6d68 100644
--- a/tests/ui/traits/const-traits/super-traits-fail-3.nyn.stderr
+++ b/tests/ui/traits/const-traits/super-traits-fail-3.nyn.stderr
@@ -39,11 +39,12 @@ LL | #[cfg_attr(any(yyy, yny, nyy, nyn), const_trait)]
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0658]: cannot call conditionally-const method `<T as Foo>::a` in constant functions
-  --> $DIR/super-traits-fail-3.rs:36:5
+  --> $DIR/super-traits-fail-3.rs:36:7
    |
 LL |     x.a();
-   |     ^^^^^
+   |       ^^^
    |
+   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
    = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
    = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.nyy.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.nyy.stderr
index 8abda1c8f8a..024db4b6d68 100644
--- a/tests/ui/traits/const-traits/super-traits-fail-3.nyy.stderr
+++ b/tests/ui/traits/const-traits/super-traits-fail-3.nyy.stderr
@@ -39,11 +39,12 @@ LL | #[cfg_attr(any(yyy, yny, nyy, nyn), const_trait)]
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0658]: cannot call conditionally-const method `<T as Foo>::a` in constant functions
-  --> $DIR/super-traits-fail-3.rs:36:5
+  --> $DIR/super-traits-fail-3.rs:36:7
    |
 LL |     x.a();
-   |     ^^^^^
+   |       ^^^
    |
+   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
    = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
    = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
diff --git a/tests/ui/traits/fn-pointer/bare-fn-no-impl-fn-ptr-99875.rs b/tests/ui/traits/fn-pointer/bare-fn-no-impl-fn-ptr-99875.rs
index cf73fd8d31f..f776a6ce4c1 100644
--- a/tests/ui/traits/fn-pointer/bare-fn-no-impl-fn-ptr-99875.rs
+++ b/tests/ui/traits/fn-pointer/bare-fn-no-impl-fn-ptr-99875.rs
@@ -1,3 +1,5 @@
+// Sets some arbitrarily large width for more consistent output (see #135288).
+//@ compile-flags: --diagnostic-width=120
 struct Argument;
 struct Return;
 
diff --git a/tests/ui/traits/fn-pointer/bare-fn-no-impl-fn-ptr-99875.stderr b/tests/ui/traits/fn-pointer/bare-fn-no-impl-fn-ptr-99875.stderr
index 5b89158b0db..ba0af763975 100644
--- a/tests/ui/traits/fn-pointer/bare-fn-no-impl-fn-ptr-99875.stderr
+++ b/tests/ui/traits/fn-pointer/bare-fn-no-impl-fn-ptr-99875.stderr
@@ -1,5 +1,5 @@
 error[E0277]: the trait bound `fn(Argument) -> Return {function}: Trait` is not satisfied
-  --> $DIR/bare-fn-no-impl-fn-ptr-99875.rs:12:11
+  --> $DIR/bare-fn-no-impl-fn-ptr-99875.rs:14:11
    |
 LL |     takes(function);
    |     ----- ^^^^^^^^ the trait `Trait` is not implemented for fn item `fn(Argument) -> Return {function}`
@@ -7,7 +7,7 @@ LL |     takes(function);
    |     required by a bound introduced by this call
    |
 note: required by a bound in `takes`
-  --> $DIR/bare-fn-no-impl-fn-ptr-99875.rs:9:18
+  --> $DIR/bare-fn-no-impl-fn-ptr-99875.rs:11:18
    |
 LL | fn takes(_: impl Trait) {}
    |                  ^^^^^ required by this bound in `takes`
@@ -16,18 +16,18 @@ 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/bare-fn-no-impl-fn-ptr-99875.rs:14:11: 14:34}: Trait` is not satisfied
-  --> $DIR/bare-fn-no-impl-fn-ptr-99875.rs:14:11
+error[E0277]: the trait bound `{closure@$DIR/bare-fn-no-impl-fn-ptr-99875.rs:16:11: 16:34}: Trait` is not satisfied
+  --> $DIR/bare-fn-no-impl-fn-ptr-99875.rs:16:11
    |
 LL |     takes(|_: Argument| -> Return { todo!() });
    |     ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
    |     |
    |     required by a bound introduced by this call
    |
-   = help: the trait `Trait` is not implemented for closure `{closure@$DIR/bare-fn-no-impl-fn-ptr-99875.rs:14:11: 14:34}`
+   = help: the trait `Trait` is not implemented for closure `{closure@$DIR/bare-fn-no-impl-fn-ptr-99875.rs:16:11: 16:34}`
    = help: the trait `Trait` is implemented for fn pointer `fn(Argument) -> Return`
 note: required by a bound in `takes`
-  --> $DIR/bare-fn-no-impl-fn-ptr-99875.rs:9:18
+  --> $DIR/bare-fn-no-impl-fn-ptr-99875.rs:11:18
    |
 LL | fn takes(_: impl Trait) {}
    |                  ^^^^^ required by this bound in `takes`
diff --git a/tests/ui/traits/issue-106072.rs b/tests/ui/traits/issue-106072.rs
index 696bd765ebc..d75c26642c6 100644
--- a/tests/ui/traits/issue-106072.rs
+++ b/tests/ui/traits/issue-106072.rs
@@ -1,4 +1,6 @@
-#[derive(Clone)] //~  expected a type, found a trait
+#[derive(Clone)]
+//~^ expected a type, found a trait
+//~| expected a type, found a trait
 struct Foo;
 trait Foo {} //~ the name `Foo` is defined multiple times
 fn main() {}
diff --git a/tests/ui/traits/issue-106072.stderr b/tests/ui/traits/issue-106072.stderr
index 4a48e4e898d..3e0d6d88086 100644
--- a/tests/ui/traits/issue-106072.stderr
+++ b/tests/ui/traits/issue-106072.stderr
@@ -1,5 +1,5 @@
 error[E0428]: the name `Foo` is defined multiple times
-  --> $DIR/issue-106072.rs:3:1
+  --> $DIR/issue-106072.rs:5:1
    |
 LL | struct Foo;
    | ----------- previous definition of the type `Foo` here
@@ -16,7 +16,16 @@ LL | #[derive(Clone)]
    |
    = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: aborting due to 2 previous errors
+error[E0782]: expected a type, found a trait
+  --> $DIR/issue-106072.rs:1:10
+   |
+LL | #[derive(Clone)]
+   |          ^^^^^
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 3 previous errors
 
 Some errors have detailed explanations: E0428, E0782.
 For more information about an error, try `rustc --explain E0428`.
diff --git a/tests/ui/traits/missing-for-type-in-impl.e2021.stderr b/tests/ui/traits/missing-for-type-in-impl.e2021.stderr
index a49c5d9d45b..e79bb0524e9 100644
--- a/tests/ui/traits/missing-for-type-in-impl.e2021.stderr
+++ b/tests/ui/traits/missing-for-type-in-impl.e2021.stderr
@@ -1,15 +1,3 @@
-error[E0277]: the trait bound `i64: Foo<i64>` is not satisfied
-  --> $DIR/missing-for-type-in-impl.rs:19:19
-   |
-LL |     let x: i64 = <i64 as Foo<i64>>::id(10);
-   |                   ^^^ the trait `Foo<i64>` is not implemented for `i64`
-   |
-help: this trait has no implementations, consider adding one
-  --> $DIR/missing-for-type-in-impl.rs:3:1
-   |
-LL | trait Foo<T> {
-   | ^^^^^^^^^^^^
-
 error[E0782]: expected a type, found a trait
   --> $DIR/missing-for-type-in-impl.rs:8:6
    |
@@ -25,6 +13,18 @@ help: you might have intended to implement this trait for a given type
 LL | impl Foo<i64> for /* Type */ {
    |               ++++++++++++++
 
+error[E0277]: the trait bound `i64: Foo<i64>` is not satisfied
+  --> $DIR/missing-for-type-in-impl.rs:19:19
+   |
+LL |     let x: i64 = <i64 as Foo<i64>>::id(10);
+   |                   ^^^ the trait `Foo<i64>` is not implemented for `i64`
+   |
+help: this trait has no implementations, consider adding one
+  --> $DIR/missing-for-type-in-impl.rs:3:1
+   |
+LL | trait Foo<T> {
+   | ^^^^^^^^^^^^
+
 error: aborting due to 2 previous errors
 
 Some errors have detailed explanations: E0277, E0782.
diff --git a/tests/ui/traits/trait-upcasting/type-checking-test-3.stderr b/tests/ui/traits/trait-upcasting/type-checking-test-3.stderr
index 0a969b611e9..01b8da645f3 100644
--- a/tests/ui/traits/trait-upcasting/type-checking-test-3.stderr
+++ b/tests/ui/traits/trait-upcasting/type-checking-test-3.stderr
@@ -1,10 +1,10 @@
 error: lifetime may not live long enough
-  --> $DIR/type-checking-test-3.rs:11:18
+  --> $DIR/type-checking-test-3.rs:11:13
    |
 LL | fn test_wrong1<'a>(x: &dyn Foo<'static>, y: &'a u32) {
    |                -- lifetime `'a` defined here
 LL |     let _ = x as &dyn Bar<'a>; // Error
-   |                  ^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
+   |             ^^^^^^^^^^^^^^^^^ cast requires that `'a` must outlive `'static`
 
 error: lifetime may not live long enough
   --> $DIR/type-checking-test-3.rs:16:18
diff --git a/tests/ui/traits/trait-upcasting/type-checking-test-4.stderr b/tests/ui/traits/trait-upcasting/type-checking-test-4.stderr
index 090120a2327..e91ea193a01 100644
--- a/tests/ui/traits/trait-upcasting/type-checking-test-4.stderr
+++ b/tests/ui/traits/trait-upcasting/type-checking-test-4.stderr
@@ -1,10 +1,10 @@
 error: lifetime may not live long enough
-  --> $DIR/type-checking-test-4.rs:19:18
+  --> $DIR/type-checking-test-4.rs:19:13
    |
 LL | fn test_wrong1<'a>(x: &dyn Foo<'static>, y: &'a u32) {
    |                -- lifetime `'a` defined here
 LL |     let _ = x as &dyn Bar<'static, 'a>; // Error
-   |                  ^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^ cast requires that `'a` must outlive `'static`
 
 error: lifetime may not live long enough
   --> $DIR/type-checking-test-4.rs:24:18
diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr b/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr
index 293c8ea09f1..feb161c3b04 100644
--- a/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr
+++ b/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr
@@ -1,3 +1,15 @@
+error: concrete type differs from previous defining opaque type use
+  --> $DIR/hkl_forbidden4.rs:12:1
+   |
+LL | async fn operation(_: &mut ()) -> () {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `FutNothing<'_>`, got `{async fn body of operation()}`
+   |
+note: previous use here
+  --> $DIR/hkl_forbidden4.rs:14:5
+   |
+LL |     call(operation).await
+   |     ^^^^^^^^^^^^^^^
+
 error: item does not constrain `FutNothing::{opaque#0}`, but has it in its signature
   --> $DIR/hkl_forbidden4.rs:18:10
    |
@@ -35,18 +47,6 @@ LL |
 LL |     call(operation).await
    |     ^^^^^^^^^^^^^^^
 
-error: concrete type differs from previous defining opaque type use
-  --> $DIR/hkl_forbidden4.rs:12:1
-   |
-LL | async fn operation(_: &mut ()) -> () {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `FutNothing<'_>`, got `{async fn body of operation()}`
-   |
-note: previous use here
-  --> $DIR/hkl_forbidden4.rs:14:5
-   |
-LL |     call(operation).await
-   |     ^^^^^^^^^^^^^^^
-
 error[E0792]: expected generic lifetime parameter, found `'any`
   --> $DIR/hkl_forbidden4.rs:22:1
    |
diff --git a/tests/ui/type/pattern_types/range_patterns.rs b/tests/ui/type/pattern_types/range_patterns.rs
index ff87444b49e..446a33195c8 100644
--- a/tests/ui/type/pattern_types/range_patterns.rs
+++ b/tests/ui/type/pattern_types/range_patterns.rs
@@ -3,6 +3,7 @@
 #![allow(incomplete_features)]
 
 //@ normalize-stderr: "pref: Align\([1-8] bytes\)" -> "pref: $$SOME_ALIGN"
+//@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED"
 
 use std::pat::pattern_type;
 
diff --git a/tests/ui/type/pattern_types/range_patterns.stderr b/tests/ui/type/pattern_types/range_patterns.stderr
index 0eed7c2ce1c..7da8cfd4dbc 100644
--- a/tests/ui/type/pattern_types/range_patterns.stderr
+++ b/tests/ui/type/pattern_types/range_patterns.stderr
@@ -36,8 +36,9 @@ error: layout_of(NonZero<u32>) = Layout {
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/range_patterns.rs:10:1
+  --> $DIR/range_patterns.rs:11:1
    |
 LL | type X = std::num::NonZeroU32;
    | ^^^^^^
@@ -73,8 +74,9 @@ error: layout_of((u32) is 1..=) = Layout {
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/range_patterns.rs:12:1
+  --> $DIR/range_patterns.rs:13:1
    |
 LL | type Y = pattern_type!(u32 is 1..);
    | ^^^^^^
@@ -137,6 +139,7 @@ error: layout_of(Option<(u32) is 1..=>) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(4 bytes),
@@ -176,13 +179,15 @@ error: layout_of(Option<(u32) is 1..=>) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(4 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/range_patterns.rs:14:1
+  --> $DIR/range_patterns.rs:15:1
    |
 LL | type Z = Option<pattern_type!(u32 is 1..)>;
    | ^^^^^^
@@ -245,6 +250,7 @@ error: layout_of(Option<NonZero<u32>>) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(1 bytes),
+                       randomization_seed: $SEED,
                    },
                    Layout {
                        size: Size(4 bytes),
@@ -284,13 +290,15 @@ error: layout_of(Option<NonZero<u32>>) = Layout {
                        },
                        max_repr_align: None,
                        unadjusted_abi_align: Align(4 bytes),
+                       randomization_seed: $SEED,
                    },
                ],
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/range_patterns.rs:16:1
+  --> $DIR/range_patterns.rs:17:1
    |
 LL | type A = Option<std::num::NonZeroU32>;
    | ^^^^^^
@@ -333,8 +341,9 @@ error: layout_of(NonZeroU32New) = Layout {
            },
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
+           randomization_seed: $SEED,
        }
-  --> $DIR/range_patterns.rs:18:1
+  --> $DIR/range_patterns.rs:19:1
    |
 LL | struct NonZeroU32New(pattern_type!(u32 is 1..));
    | ^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr b/tests/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr
index 40d34140245..e2f48f37f0d 100644
--- a/tests/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr
+++ b/tests/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr
@@ -7,6 +7,10 @@ LL |     doit(0, &|x, y| {
    |               has type `&Cell<&'2 i32>`
 LL |         x.set(y);
    |         ^^^^^^^^ argument requires that `'1` must outlive `'2`
+   |
+   = note: requirement occurs because of the type `Cell<&i32>`, which makes the generic argument `&i32` invariant
+   = note: the struct `Cell<T>` is invariant over the parameter `T`
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr b/tests/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr
index ed9d22d2558..8bd9b1112c5 100644
--- a/tests/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr
+++ b/tests/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr
@@ -7,6 +7,9 @@ LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); }
    |                    |           let's call the lifetime of this reference `'1`
    |                    let's call the lifetime of this reference `'2`
    |
+   = note: requirement occurs because of a mutable reference to `Vec<&u8>`
+   = note: mutable references are invariant over their type parameter
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 help: consider introducing a named lifetime parameter
    |
 LL | fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); }
diff --git a/tests/ui/unpretty/expanded-exhaustive.rs b/tests/ui/unpretty/expanded-exhaustive.rs
index e052627e71c..26c253d049b 100644
--- a/tests/ui/unpretty/expanded-exhaustive.rs
+++ b/tests/ui/unpretty/expanded-exhaustive.rs
@@ -651,8 +651,8 @@ mod patterns {
         let &mut pat;
     }
 
-    /// PatKind::Lit
-    fn pat_lit() {
+    /// PatKind::Expr
+    fn pat_expr() {
         let 1_000_i8;
         let -"";
     }
diff --git a/tests/ui/unpretty/expanded-exhaustive.stdout b/tests/ui/unpretty/expanded-exhaustive.stdout
index 132d00cd8ed..bd7aa1117cc 100644
--- a/tests/ui/unpretty/expanded-exhaustive.stdout
+++ b/tests/ui/unpretty/expanded-exhaustive.stdout
@@ -567,8 +567,8 @@ mod patterns {
     fn pat_deref() { let deref!(pat); }
     /// PatKind::Ref
     fn pat_ref() { let &pat; let &mut pat; }
-    /// PatKind::Lit
-    fn pat_lit() { let 1_000_i8; let -""; }
+    /// PatKind::Expr
+    fn pat_expr() { let 1_000_i8; let -""; }
     /// PatKind::Range
     fn pat_range() { let ..1; let 0..; let 0..1; let 0..=1; let -2..=-1; }
     /// PatKind::Slice
diff --git a/tests/ui/unpretty/unpretty-expr-fn-arg.stdout b/tests/ui/unpretty/unpretty-expr-fn-arg.stdout
index c424b1afa34..43aa93c83bd 100644
--- a/tests/ui/unpretty/unpretty-expr-fn-arg.stdout
+++ b/tests/ui/unpretty/unpretty-expr-fn-arg.stdout
@@ -14,4 +14,4 @@ extern crate std;
 
 fn main() ({ } as ())
 
-fn foo((-(128 as i8) as i8)...(127 as i8): i8) ({ } as ())
+fn foo(-128...127: i8) ({ } as ())
diff --git a/tests/ui/variance/variance-associated-types2.stderr b/tests/ui/variance/variance-associated-types2.stderr
index 158b09b0630..292d60941b1 100644
--- a/tests/ui/variance/variance-associated-types2.stderr
+++ b/tests/ui/variance/variance-associated-types2.stderr
@@ -1,10 +1,10 @@
 error: lifetime may not live long enough
-  --> $DIR/variance-associated-types2.rs:13:12
+  --> $DIR/variance-associated-types2.rs:13:42
    |
 LL | fn take<'a>(_: &'a u32) {
    |         -- lifetime `'a` defined here
 LL |     let _: Box<dyn Foo<Bar = &'a u32>> = make();
-   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
+   |                                          ^^^^^^ coercion requires that `'a` must outlive `'static`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/variance/variance-uniquerc.rs b/tests/ui/variance/variance-uniquerc.rs
new file mode 100644
index 00000000000..0c395ab06ea
--- /dev/null
+++ b/tests/ui/variance/variance-uniquerc.rs
@@ -0,0 +1,27 @@
+// regression test of https://github.com/rust-lang/rust/pull/133572#issuecomment-2543007164
+// we should also test UniqueArc once implemented
+//
+// inline comments explain how this code *would* compile if UniqueRc was still covariant
+
+#![feature(unique_rc_arc)]
+
+use std::rc::UniqueRc;
+
+fn extend_lifetime<'a, 'b>(x: &'a str) -> &'b str {
+    let r = UniqueRc::new(""); // UniqueRc<&'static str>
+    let w = UniqueRc::downgrade(&r); // Weak<&'static str>
+    let mut r = r; // [IF COVARIANT]: ==>> UniqueRc<&'a str>
+    *r = x; // assign the &'a str
+    let _r = UniqueRc::into_rc(r); // Rc<&'a str>, but we only care to activate the weak
+    let r = w.upgrade().unwrap(); // Rc<&'static str>
+    *r // &'static str, coerces to &'b str
+    //~^ ERROR lifetime may not live long enough
+}
+
+fn main() {
+    let s = String::from("Hello World!");
+    let r = extend_lifetime(&s);
+    println!("{r}");
+    drop(s);
+    println!("{r}");
+}
diff --git a/tests/ui/variance/variance-uniquerc.stderr b/tests/ui/variance/variance-uniquerc.stderr
new file mode 100644
index 00000000000..1557f7e40c5
--- /dev/null
+++ b/tests/ui/variance/variance-uniquerc.stderr
@@ -0,0 +1,15 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-uniquerc.rs:17:5
+   |
+LL | fn extend_lifetime<'a, 'b>(x: &'a str) -> &'b str {
+   |                    --  -- lifetime `'b` defined here
+   |                    |
+   |                    lifetime `'a` defined here
+...
+LL |     *r // &'static str, coerces to &'b str
+   |     ^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+   |
+   = help: consider adding the following bound: `'a: 'b`
+
+error: aborting due to 1 previous error
+