about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/assembly/cstring-merging.rs27
-rw-r--r--tests/assembly/naked-functions/aarch64-naked-fn-no-bti-prolog.rs (renamed from tests/assembly/aarch64-naked-fn-no-bti-prolog.rs)0
-rw-r--r--tests/assembly/naked-functions/aix.rs35
-rw-r--r--tests/assembly/naked-functions/wasm32.rs (renamed from tests/assembly/wasm32-naked-fn.rs)0
-rw-r--r--tests/assembly/naked-functions/x86_64-naked-fn-no-cet-prolog.rs (renamed from tests/assembly/x86_64-naked-fn-no-cet-prolog.rs)0
-rw-r--r--tests/assembly/powerpc64-struct-abi.rs2
-rw-r--r--tests/assembly/s390x-vector-abi.rs4
-rw-r--r--tests/assembly/x86_64-cmp.rs46
-rw-r--r--tests/codegen/alloc-optimisation.rs2
-rw-r--r--tests/codegen/asm/goto.rs2
-rw-r--r--tests/codegen/asm/s390x-clobbers.rs2
-rw-r--r--tests/codegen/assign-desugar-debuginfo.rs18
-rw-r--r--tests/codegen/box-uninit-bytes.rs2
-rw-r--r--tests/codegen/comparison-operators-2-tuple.rs1
-rw-r--r--tests/codegen/const-array.rs4
-rw-r--r--tests/codegen/dealloc-no-unwind.rs2
-rw-r--r--tests/codegen/debug-vtable.rs2
-rw-r--r--tests/codegen/enum/enum-two-variants-match.rs37
-rw-r--r--tests/codegen/external-no-mangle-statics.rs32
-rw-r--r--tests/codegen/integer-cmp.rs35
-rw-r--r--tests/codegen/intrinsics/cold_path2.rs4
-rw-r--r--tests/codegen/intrinsics/three_way_compare.rs27
-rw-r--r--tests/codegen/issues/issue-129795.rs17
-rw-r--r--tests/codegen/iter-repeat-n-trivial-drop.rs2
-rw-r--r--tests/codegen/link_section.rs2
-rw-r--r--tests/codegen/match-optimizes-away.rs11
-rw-r--r--tests/codegen/naked-fn/naked-functions.rs72
-rw-r--r--tests/codegen/range-loop.rs44
-rw-r--r--tests/codegen/remap_path_prefix/main.rs2
-rw-r--r--tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs24
-rw-r--r--tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs22
-rw-r--r--tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs88
-rw-r--r--tests/codegen/sanitizer/cfi/external_weak_symbols.rs24
-rw-r--r--tests/codegen/slice-is-ascii.rs2
-rw-r--r--tests/codegen/try_question_mark_nop.rs147
-rw-r--r--tests/codegen/uninit-consts.rs6
-rw-r--r--tests/codegen/uninit-repeat-in-aggregate.rs21
-rw-r--r--tests/codegen/vec-calloc.rs2
-rw-r--r--tests/codegen/vec-optimizes-away.rs2
-rw-r--r--tests/coverage-run-rustdoc/doctest.coverage16
-rw-r--r--tests/coverage/async_closure.cov-map12
-rw-r--r--tests/coverage/async_closure.coverage2
-rw-r--r--tests/crashes/120016.rs1
-rw-r--r--tests/crashes/122904-2.rs2
-rw-r--r--tests/crashes/122904.rs11
-rw-r--r--tests/crashes/125059.rs12
-rw-r--r--tests/crashes/125185.rs14
-rw-r--r--tests/crashes/126680.rs22
-rw-r--r--tests/crashes/131298.rs12
-rw-r--r--tests/crashes/131886.rs5
-rw-r--r--tests/crashes/132826.rs10
-rw-r--r--tests/crashes/135528.rs2
-rw-r--r--tests/crashes/136286.rs7
-rw-r--r--tests/crashes/137049.rs1
-rw-r--r--tests/crashes/137706.rs7
-rw-r--r--tests/crashes/137865.rs5
-rw-r--r--tests/crashes/137895.rs6
-rw-r--r--tests/crashes/138048.rs8
-rw-r--r--tests/debuginfo/pretty-huge-vec.rs1
-rw-r--r--tests/incremental/define-opaques.rs19
-rw-r--r--tests/incremental/delayed_span_bug.rs4
-rw-r--r--tests/incremental/env/env_macro.rs18
-rw-r--r--tests/incremental/env/option_env_macro.rs18
-rw-r--r--tests/incremental/user-written-closure-synthetic-closure-conflict.rs15
-rw-r--r--tests/mir-opt/async_closure_fake_read_for_by_move.foo-{closure#0}-{closure#0}.built.after.mir81
-rw-r--r--tests/mir-opt/async_closure_fake_read_for_by_move.foo-{closure#0}-{synthetic#0}.built.after.mir64
-rw-r--r--tests/mir-opt/async_closure_fake_read_for_by_move.rs18
-rw-r--r--tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}-{synthetic#0}.built.after.mir (renamed from tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}-{closure#1}.built.after.mir)4
-rw-r--r--tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}-{synthetic#0}.built.after.mir (renamed from tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}-{closure#1}.built.after.mir)4
-rw-r--r--tests/mir-opt/async_closure_shims.rs4
-rw-r--r--tests/mir-opt/building/user_type_annotations.let_else.built.after.mir80
-rw-r--r--tests/mir-opt/building/user_type_annotations.let_else_bindless.built.after.mir62
-rw-r--r--tests/mir-opt/building/user_type_annotations.let_init.built.after.mir54
-rw-r--r--tests/mir-opt/building/user_type_annotations.let_init_bindless.built.after.mir39
-rw-r--r--tests/mir-opt/building/user_type_annotations.let_uninit.built.after.mir27
-rw-r--r--tests/mir-opt/building/user_type_annotations.let_uninit_bindless.built.after.mir15
-rw-r--r--tests/mir-opt/building/user_type_annotations.match_assoc_const.built.after.mir46
-rw-r--r--tests/mir-opt/building/user_type_annotations.match_assoc_const_range.built.after.mir74
-rw-r--r--tests/mir-opt/building/user_type_annotations.rs66
-rw-r--r--tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff1
-rw-r--r--tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff3
-rw-r--r--tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff11
-rw-r--r--tests/mir-opt/coverage/instrument_coverage.rs2
-rw-r--r--tests/mir-opt/coverage/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff1
-rw-r--r--tests/mir-opt/coverage/instrument_coverage_cleanup.main.InstrumentCoverage.diff1
-rw-r--r--tests/mir-opt/funky_arms.float_to_exponential_common.GVN.32bit.panic-abort.diff49
-rw-r--r--tests/mir-opt/funky_arms.float_to_exponential_common.GVN.32bit.panic-unwind.diff49
-rw-r--r--tests/mir-opt/funky_arms.float_to_exponential_common.GVN.64bit.panic-abort.diff49
-rw-r--r--tests/mir-opt/funky_arms.float_to_exponential_common.GVN.64bit.panic-unwind.diff49
-rw-r--r--tests/mir-opt/global_asm.rs9
-rw-r--r--tests/mir-opt/global_asm.{global_asm#0}.SimplifyLocals-final.after.mir9
-rw-r--r--tests/mir-opt/gvn_clone.{impl#0}-clone.GVN.diff10
-rw-r--r--tests/mir-opt/gvn_on_unsafe_binder.propagate.GVN.diff35
-rw-r--r--tests/mir-opt/gvn_on_unsafe_binder.rs29
-rw-r--r--tests/mir-opt/gvn_on_unsafe_binder.test.GVN.diff30
-rw-r--r--tests/mir-opt/inline/exponential_runtime.rs5
-rw-r--r--tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff5
-rw-r--r--tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff5
-rw-r--r--tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff125
-rw-r--r--tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff162
-rw-r--r--tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-abort.diff6
-rw-r--r--tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-unwind.diff6
-rw-r--r--tests/mir-opt/pre-codegen/checked_ops.rs39
-rw-r--r--tests/mir-opt/pre-codegen/checked_ops.saturating_sub_at_home.PreCodegen.after.panic-abort.mir48
-rw-r--r--tests/mir-opt/pre-codegen/checked_ops.saturating_sub_at_home.PreCodegen.after.panic-unwind.mir48
-rw-r--r--tests/mir-opt/pre-codegen/checked_ops.use_checked_sub.PreCodegen.after.panic-abort.mir44
-rw-r--r--tests/mir-opt/pre-codegen/checked_ops.use_checked_sub.PreCodegen.after.panic-unwind.mir44
-rw-r--r--tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir24
-rw-r--r--tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-abort.mir4
-rw-r--r--tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-unwind.mir4
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir20
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir26
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir21
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir21
-rw-r--r--tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir2
-rw-r--r--tests/mir-opt/pre-codegen/simple_option_map.map_via_question_mark.PreCodegen.after.mir70
-rw-r--r--tests/mir-opt/pre-codegen/simple_option_map.rs24
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir24
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir30
-rw-r--r--tests/mir-opt/pre-codegen/tuple_ord.demo_ge_partial.PreCodegen.after.mir70
-rw-r--r--tests/mir-opt/pre-codegen/tuple_ord.demo_le_total.PreCodegen.after.mir70
-rw-r--r--tests/mir-opt/pre-codegen/tuple_ord.rs16
-rw-r--r--tests/pretty/autodiff_forward.pp6
-rw-r--r--tests/pretty/autodiff_forward.rs2
-rw-r--r--tests/pretty/autodiff_reverse.pp2
-rw-r--r--tests/pretty/autodiff_reverse.rs2
-rw-r--r--tests/pretty/hir-fn-params.pp38
-rw-r--r--tests/pretty/hir-fn-params.rs34
-rw-r--r--tests/pretty/hir-lifetimes.pp96
-rw-r--r--tests/pretty/hir-lifetimes.rs91
-rw-r--r--tests/pretty/hir-pretty-attr.pp2
-rw-r--r--tests/pretty/hir-struct-expr.pp28
-rw-r--r--tests/pretty/hir-struct-expr.rs24
-rw-r--r--tests/pretty/postfix-yield.rs15
-rw-r--r--tests/pretty/tests-are-sorted.pp3
-rw-r--r--tests/run-make/core-no-fp-fmt-parse/rmake.rs2
-rw-r--r--tests/run-make/doctests-keep-binaries/rmake.rs2
-rw-r--r--tests/run-make/linker-warning/rmake.rs2
-rw-r--r--tests/run-make/non-unicode-env/non_unicode_env.stderr4
-rw-r--r--tests/run-make/rust-lld/rmake.rs5
-rw-r--r--tests/run-make/rustc-help/help-v.stdout2
-rw-r--r--tests/run-make/rustc-help/help.stdout2
-rw-r--r--tests/run-make/rustdoc-error-lines/rmake.rs6
-rw-r--r--tests/run-make/symbols-all-mangled/a_lib.rs1
-rw-r--r--tests/run-make/symbols-all-mangled/an_executable.rs3
-rw-r--r--tests/run-make/symbols-all-mangled/rmake.rs96
-rw-r--r--tests/run-make/target-cpu-native/rmake.rs2
-rw-r--r--tests/rustdoc-json/assoc_items.rs24
-rw-r--r--tests/rustdoc-json/assoc_type.rs8
-rw-r--r--tests/rustdoc-json/attrs/deprecated.rs38
-rw-r--r--tests/rustdoc-json/attrs/export_name_2021.rs2
-rw-r--r--tests/rustdoc-json/attrs/export_name_2024.rs2
-rw-r--r--tests/rustdoc-json/attrs/must_use.rs4
-rw-r--r--tests/rustdoc-json/attrs/no_mangle_2021.rs2
-rw-r--r--tests/rustdoc-json/attrs/no_mangle_2024.rs2
-rw-r--r--tests/rustdoc-json/attrs/non_exhaustive.rs6
-rw-r--r--tests/rustdoc-json/attrs/repr_align.rs8
-rw-r--r--tests/rustdoc-json/attrs/repr_c.rs18
-rw-r--r--tests/rustdoc-json/attrs/repr_combination.rs79
-rw-r--r--tests/rustdoc-json/attrs/repr_int_enum.rs19
-rw-r--r--tests/rustdoc-json/attrs/repr_packed.rs18
-rw-r--r--tests/rustdoc-json/attrs/repr_transparent.rs37
-rw-r--r--tests/rustdoc-json/blanket_impls.rs6
-rw-r--r--tests/rustdoc-json/doc_hidden_failure.rs4
-rw-r--r--tests/rustdoc-json/enums/discriminant/basic.rs12
-rw-r--r--tests/rustdoc-json/enums/discriminant/expr.rs36
-rw-r--r--tests/rustdoc-json/enums/discriminant/limits.rs32
-rw-r--r--tests/rustdoc-json/enums/discriminant/num_underscore_and_suffix.rs16
-rw-r--r--tests/rustdoc-json/enums/discriminant/only_some_have_discriminant.rs8
-rw-r--r--tests/rustdoc-json/enums/discriminant/struct.rs14
-rw-r--r--tests/rustdoc-json/enums/discriminant/tuple.rs14
-rw-r--r--tests/rustdoc-json/enums/doc_link_to_foreign_variant.rs6
-rw-r--r--tests/rustdoc-json/enums/field_hidden.rs8
-rw-r--r--tests/rustdoc-json/enums/field_order.rs40
-rw-r--r--tests/rustdoc-json/enums/kind.rs38
-rw-r--r--tests/rustdoc-json/enums/struct_field_hidden.rs12
-rw-r--r--tests/rustdoc-json/enums/tuple_fields_hidden.rs124
-rw-r--r--tests/rustdoc-json/enums/use_glob.rs10
-rw-r--r--tests/rustdoc-json/enums/use_variant.rs12
-rw-r--r--tests/rustdoc-json/enums/use_variant_foreign.rs6
-rw-r--r--tests/rustdoc-json/enums/variant_order.rs40
-rw-r--r--tests/rustdoc-json/enums/variant_struct.rs14
-rw-r--r--tests/rustdoc-json/enums/variant_tuple_struct.rs14
-rw-r--r--tests/rustdoc-json/fn_pointer/abi.rs14
-rw-r--r--tests/rustdoc-json/fn_pointer/generics.rs14
-rw-r--r--tests/rustdoc-json/fn_pointer/qualifiers.rs12
-rw-r--r--tests/rustdoc-json/fns/abi.rs14
-rw-r--r--tests/rustdoc-json/fns/async_return.rs24
-rw-r--r--tests/rustdoc-json/fns/extern_c_variadic.rs4
-rw-r--r--tests/rustdoc-json/fns/extern_safe.rs8
-rw-r--r--tests/rustdoc-json/fns/generic_args.rs88
-rw-r--r--tests/rustdoc-json/fns/generic_returns.rs10
-rw-r--r--tests/rustdoc-json/fns/generics.rs30
-rw-r--r--tests/rustdoc-json/fns/pattern_arg.rs4
-rw-r--r--tests/rustdoc-json/fns/qualifiers.rs36
-rw-r--r--tests/rustdoc-json/fns/return_type_alias.rs4
-rw-r--r--tests/rustdoc-json/generic-associated-types/gats.rs34
-rw-r--r--tests/rustdoc-json/generic_impl.rs6
-rw-r--r--tests/rustdoc-json/glob_import.rs4
-rw-r--r--tests/rustdoc-json/impl-trait-in-assoc-type.rs18
-rw-r--r--tests/rustdoc-json/impl-trait-precise-capturing.rs6
-rw-r--r--tests/rustdoc-json/impls/auto.rs6
-rw-r--r--tests/rustdoc-json/impls/blanket_with_local.rs8
-rw-r--r--tests/rustdoc-json/impls/foreign_for_local.rs12
-rw-r--r--tests/rustdoc-json/impls/impl_item_visibility.rs6
-rw-r--r--tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs6
-rw-r--r--tests/rustdoc-json/impls/impl_item_visibility_show_private.rs6
-rw-r--r--tests/rustdoc-json/impls/import_from_private.rs12
-rw-r--r--tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-2.rs10
-rw-r--r--tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs6
-rw-r--r--tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id.rs10
-rw-r--r--tests/rustdoc-json/impls/local_for_foreign.rs12
-rw-r--r--tests/rustdoc-json/impls/local_for_local.rs14
-rw-r--r--tests/rustdoc-json/impls/local_for_local_primitive.rs12
-rw-r--r--tests/rustdoc-json/impls/local_for_primitive.rs6
-rw-r--r--tests/rustdoc-json/impls/pub_for_hidden_private.rs2
-rw-r--r--tests/rustdoc-json/impls/trait-for-dyn-trait.rs14
-rw-r--r--tests/rustdoc-json/intra-doc-links/foreign_variant.rs6
-rw-r--r--tests/rustdoc-json/intra-doc-links/non_page.rs20
-rw-r--r--tests/rustdoc-json/intra-doc-links/user_written.rs4
-rw-r--r--tests/rustdoc-json/keyword.rs8
-rw-r--r--tests/rustdoc-json/keyword_private.rs16
-rw-r--r--tests/rustdoc-json/lifetime/longest.rs34
-rw-r--r--tests/rustdoc-json/lifetime/outlives.rs30
-rw-r--r--tests/rustdoc-json/lifetime/outlives_in_param.rs10
-rw-r--r--tests/rustdoc-json/lifetime/outlives_in_where.rs22
-rw-r--r--tests/rustdoc-json/methods/abi.rs30
-rw-r--r--tests/rustdoc-json/methods/qualifiers.rs36
-rw-r--r--tests/rustdoc-json/nested.rs38
-rw-r--r--tests/rustdoc-json/non_lifetime_binders.rs10
-rw-r--r--tests/rustdoc-json/output_generics.rs10
-rw-r--r--tests/rustdoc-json/path_name.rs42
-rw-r--r--tests/rustdoc-json/primitives/local_primitive.rs10
-rw-r--r--tests/rustdoc-json/primitives/primitive_impls.rs18
-rw-r--r--tests/rustdoc-json/primitives/primitive_overloading.rs4
-rw-r--r--tests/rustdoc-json/primitives/primitive_type.rs12
-rw-r--r--tests/rustdoc-json/primitives/use_primitive.rs16
-rw-r--r--tests/rustdoc-json/pub_mod_in_private_mod.rs2
-rw-r--r--tests/rustdoc-json/reexport/doc_inline_external_crate.rs8
-rw-r--r--tests/rustdoc-json/reexport/export_extern_crate_as_self.rs2
-rw-r--r--tests/rustdoc-json/reexport/extern_crate_glob.rs8
-rw-r--r--tests/rustdoc-json/reexport/glob_collision.rs26
-rw-r--r--tests/rustdoc-json/reexport/glob_empty_mod.rs6
-rw-r--r--tests/rustdoc-json/reexport/glob_extern.rs18
-rw-r--r--tests/rustdoc-json/reexport/glob_private.rs26
-rw-r--r--tests/rustdoc-json/reexport/in_root_and_mod.rs8
-rw-r--r--tests/rustdoc-json/reexport/in_root_and_mod_pub.rs16
-rw-r--r--tests/rustdoc-json/reexport/macro.rs6
-rw-r--r--tests/rustdoc-json/reexport/mod_not_included.rs6
-rw-r--r--tests/rustdoc-json/reexport/private_twice_one_inline.rs16
-rw-r--r--tests/rustdoc-json/reexport/private_two_names.rs18
-rw-r--r--tests/rustdoc-json/reexport/pub_use_doc_hidden.rs4
-rw-r--r--tests/rustdoc-json/reexport/reexport_method_from_private_module.rs12
-rw-r--r--tests/rustdoc-json/reexport/reexport_of_hidden.rs4
-rw-r--r--tests/rustdoc-json/reexport/rename_private.rs6
-rw-r--r--tests/rustdoc-json/reexport/rename_public.rs14
-rw-r--r--tests/rustdoc-json/reexport/same_name_different_types.rs12
-rw-r--r--tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs12
-rw-r--r--tests/rustdoc-json/reexport/simple_private.rs16
-rw-r--r--tests/rustdoc-json/reexport/simple_public.rs18
-rw-r--r--tests/rustdoc-json/reexport/synthesize_trait_with_docs.rs2
-rw-r--r--tests/rustdoc-json/return-type-notation.rs18
-rw-r--r--tests/rustdoc-json/return_private.rs8
-rw-r--r--tests/rustdoc-json/statics/extern.rs36
-rw-r--r--tests/rustdoc-json/statics/statics.rs16
-rw-r--r--tests/rustdoc-json/stripped_modules.rs10
-rw-r--r--tests/rustdoc-json/structs/field_order.rs40
-rw-r--r--tests/rustdoc-json/structs/plain_all_pub.rs12
-rw-r--r--tests/rustdoc-json/structs/plain_doc_hidden.rs10
-rw-r--r--tests/rustdoc-json/structs/plain_empty.rs8
-rw-r--r--tests/rustdoc-json/structs/plain_pub_priv.rs8
-rw-r--r--tests/rustdoc-json/structs/tuple.rs6
-rw-r--r--tests/rustdoc-json/structs/tuple_empty.rs2
-rw-r--r--tests/rustdoc-json/structs/tuple_pub_priv.rs10
-rw-r--r--tests/rustdoc-json/structs/unit.rs6
-rw-r--r--tests/rustdoc-json/structs/with_generics.rs16
-rw-r--r--tests/rustdoc-json/structs/with_primitives.rs12
-rw-r--r--tests/rustdoc-json/trait_alias.rs12
-rw-r--r--tests/rustdoc-json/traits/has_body.rs16
-rw-r--r--tests/rustdoc-json/traits/implementors.rs14
-rw-r--r--tests/rustdoc-json/traits/is_dyn_compatible.rs12
-rw-r--r--tests/rustdoc-json/traits/private_supertrait.rs8
-rw-r--r--tests/rustdoc-json/traits/self.rs30
-rw-r--r--tests/rustdoc-json/traits/supertrait.rs22
-rw-r--r--tests/rustdoc-json/traits/trait_alias.rs22
-rw-r--r--tests/rustdoc-json/traits/uses_extern_trait.rs4
-rw-r--r--tests/rustdoc-json/type/dyn.rs74
-rw-r--r--tests/rustdoc-json/type/extern.rs4
-rw-r--r--tests/rustdoc-json/type/fn_lifetime.rs38
-rw-r--r--tests/rustdoc-json/type/generic_default.rs46
-rw-r--r--tests/rustdoc-json/type/hrtb.rs16
-rw-r--r--tests/rustdoc-json/type/inherent_associated_type.rs16
-rw-r--r--tests/rustdoc-json/type/inherent_associated_type_bound.rs18
-rw-r--r--tests/rustdoc-json/type/inherent_associated_type_projections.rs26
-rw-r--r--tests/rustdoc-json/type_alias.rs12
-rw-r--r--tests/rustdoc-json/unions/field_order.rs40
-rw-r--r--tests/rustdoc-json/unions/impl.rs10
-rw-r--r--tests/rustdoc-json/unions/union.rs12
-rw-r--r--tests/rustdoc-ui/coverage/html.rs2
-rw-r--r--tests/rustdoc-ui/deprecated-attrs.rs4
-rw-r--r--tests/rustdoc-ui/doc-cfg-check-cfg.rs16
-rw-r--r--tests/rustdoc-ui/doc-cfg-unstable.rs10
-rw-r--r--tests/rustdoc-ui/doc-cfg-unstable.stderr23
-rw-r--r--tests/rustdoc-ui/doctest-output.rs2
-rw-r--r--tests/rustdoc-ui/doctest/display-output.stdout6
-rw-r--r--tests/rustdoc-ui/doctest/extern-crate.rs23
-rw-r--r--tests/rustdoc-ui/doctest/extern-crate.stdout6
-rw-r--r--tests/rustdoc-ui/doctest/per-target-ignores.rs14
-rw-r--r--tests/rustdoc-ui/doctest/per-target-ignores.stdout6
-rw-r--r--tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout2
-rw-r--r--tests/rustdoc-ui/extract-doctests.stdout2
-rw-r--r--tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.rs2
-rw-r--r--tests/rustdoc-ui/include-str-bare-urls.rs2
-rw-r--r--tests/rustdoc-ui/lints/check.rs2
-rw-r--r--tests/rustdoc-ui/remap-path-prefix-invalid-doctest.stdout4
-rw-r--r--tests/rustdoc-ui/remap-path-prefix-lint.rs2
-rw-r--r--tests/rustdoc-ui/remap-path-prefix-macro.rs9
-rw-r--r--tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.rs2
-rw-r--r--tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-1.rs2
-rw-r--r--tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-2.rs2
-rw-r--r--tests/rustdoc-ui/use_both_out_dir_and_output_options.rs2
-rw-r--r--tests/rustdoc/deref/deref-methods-24686-target.rs27
-rw-r--r--tests/rustdoc/playground.rs2
-rw-r--r--tests/rustdoc/return-type-notation.rs18
-rw-r--r--tests/ui-fulldeps/internal-lints/import-of-type-ir-traits.rs16
-rw-r--r--tests/ui-fulldeps/internal-lints/import-of-type-ir-traits.stderr15
-rw-r--r--tests/ui-fulldeps/pprust-expr-roundtrip.rs1
-rw-r--r--tests/ui-fulldeps/run-compiler-twice.rs2
-rw-r--r--tests/ui-fulldeps/stable-mir/smir_visitor.rs81
-rw-r--r--tests/ui/abi/compatibility.rs2
-rw-r--r--tests/ui/abi/simd-abi-checks-avx.rs1
-rw-r--r--tests/ui/abi/simd-abi-checks-avx.stderr44
-rw-r--r--tests/ui/abi/simd-abi-checks-s390x.rs2
-rw-r--r--tests/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr2
-rw-r--r--tests/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr2
-rw-r--r--tests/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr1
-rw-r--r--tests/ui/allocator/not-an-allocator.stderr4
-rw-r--r--tests/ui/allocator/two-allocators.stderr2
-rw-r--r--tests/ui/asm/ice-bad-err-span-in-template-129503.stderr2
-rw-r--r--tests/ui/asm/inline-syntax.rs5
-rw-r--r--tests/ui/asm/loongarch/bad-reg.loongarch64_lp64d.stderr12
-rw-r--r--tests/ui/asm/loongarch/bad-reg.loongarch64_lp64s.stderr20
-rw-r--r--tests/ui/asm/loongarch/bad-reg.rs1
-rw-r--r--tests/ui/asm/naked-functions-target-feature.rs21
-rw-r--r--tests/ui/asm/naked-functions.rs7
-rw-r--r--tests/ui/asm/x86_64/bad-options.rs2
-rw-r--r--tests/ui/asm/x86_64/goto-block-safe.rs1
-rw-r--r--tests/ui/asm/x86_64/goto-block-safe.stderr2
-rw-r--r--tests/ui/asm/x86_64/goto.rs2
-rw-r--r--tests/ui/asm/x86_64/goto.stderr1
-rw-r--r--tests/ui/associated-inherent-types/constrain_opaque_types_during_projection.rs3
-rw-r--r--tests/ui/associated-inherent-types/issue-109299-1.stderr2
-rw-r--r--tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.current.stderr (renamed from tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.stderr)4
-rw-r--r--tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.rs7
-rw-r--r--tests/ui/associated-type-bounds/dont-imply-atb-in-closure-inference.rs6
-rw-r--r--tests/ui/associated-type-bounds/duplicate.rs6
-rw-r--r--tests/ui/associated-type-bounds/duplicate.stderr126
-rw-r--r--tests/ui/associated-type-bounds/hrtb.rs3
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr4
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/display.stderr8
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/rendering.fixed15
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/rendering.rs14
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/rendering.stderr12
-rw-r--r--tests/ui/associated-type-bounds/supertrait-defines-ty.rs3
-rw-r--r--tests/ui/associated-type-bounds/trait-alias-impl-trait.rs4
-rw-r--r--tests/ui/associated-types/bound-lifetime-constrained.ok.stderr8
-rw-r--r--tests/ui/associated-types/bound-lifetime-constrained.rs5
-rw-r--r--tests/ui/associated-types/bound-lifetime-in-binding-only.ok.stderr8
-rw-r--r--tests/ui/associated-types/bound-lifetime-in-binding-only.rs5
-rw-r--r--tests/ui/associated-types/bound-lifetime-in-return-only.ok.stderr8
-rw-r--r--tests/ui/associated-types/bound-lifetime-in-return-only.rs5
-rw-r--r--tests/ui/associated-types/issue-38821.stderr16
-rw-r--r--tests/ui/associated-types/issue-59324.rs1
-rw-r--r--tests/ui/associated-types/issue-59324.stderr21
-rw-r--r--tests/ui/async-await/async-closures/imm-deref-lending.rs46
-rw-r--r--tests/ui/async-await/async-closures/imm-deref-not-lending.rs49
-rw-r--r--tests/ui/async-await/async-closures/imm-deref-not-lending.stderr14
-rw-r--r--tests/ui/async-await/async-fn/impl-trait.rs5
-rw-r--r--tests/ui/async-await/dyn/mut-is-pointer-like.rs4
-rw-r--r--tests/ui/async-await/dyn/mut-is-pointer-like.stderr64
-rw-r--r--tests/ui/async-await/dyn/works.rs4
-rw-r--r--tests/ui/async-await/dyn/works.stderr74
-rw-r--r--tests/ui/async-await/dyn/wrong-size.rs4
-rw-r--r--tests/ui/async-await/dyn/wrong-size.stderr38
-rw-r--r--tests/ui/async-await/issues/issue-60655-latebound-regions.rs4
-rw-r--r--tests/ui/async-await/normalize-output-in-signature-deduction.rs1
-rw-r--r--tests/ui/attributes/auxiliary/used_pre_main_constructor.rs1
-rw-r--r--tests/ui/attributes/collapse-debuginfo-invalid.rs19
-rw-r--r--tests/ui/attributes/collapse-debuginfo-invalid.stderr6
-rw-r--r--tests/ui/attributes/crate-name-empty.rs5
-rw-r--r--tests/ui/attributes/crate-name-empty.stderr8
-rw-r--r--tests/ui/attributes/extented-attribute-macro-error.stderr2
-rw-r--r--tests/ui/attributes/outer-mod-attr-applies-only-to-first.rs16
-rw-r--r--tests/ui/attributes/z-crate-attr/basic.rs (renamed from tests/ui/attributes/z-crate-attr.rs)0
-rw-r--r--tests/ui/attributes/z-crate-attr/cfg-false.rs7
-rw-r--r--tests/ui/attributes/z-crate-attr/comments.rs5
-rw-r--r--tests/ui/attributes/z-crate-attr/crate-name.rs6
-rw-r--r--tests/ui/attributes/z-crate-attr/crate-type.rs3
-rw-r--r--tests/ui/attributes/z-crate-attr/garbage.rs4
-rw-r--r--tests/ui/attributes/z-crate-attr/garbage.stderr20
-rw-r--r--tests/ui/attributes/z-crate-attr/injection.rs3
-rw-r--r--tests/ui/attributes/z-crate-attr/injection.stderr8
-rw-r--r--tests/ui/attributes/z-crate-attr/inner-attr.rs4
-rw-r--r--tests/ui/attributes/z-crate-attr/inner-attr.stderr8
-rw-r--r--tests/ui/attributes/z-crate-attr/multiple.rs3
-rw-r--r--tests/ui/attributes/z-crate-attr/multiple.stderr8
-rw-r--r--tests/ui/attributes/z-crate-attr/respect-existing-attrs.rs9
-rw-r--r--tests/ui/attributes/z-crate-attr/shebang.rs6
-rw-r--r--tests/ui/attributes/z-crate-attr/unbalanced-paren.rs4
-rw-r--r--tests/ui/attributes/z-crate-attr/unbalanced-paren.stderr10
-rw-r--r--tests/ui/autodiff/autodiff_illegal.rs52
-rw-r--r--tests/ui/autodiff/autodiff_illegal.stderr52
-rw-r--r--tests/ui/borrowck/borrowck-report-with-custom-diagnostic.rs3
-rw-r--r--tests/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr6
-rw-r--r--tests/ui/borrowck/issue-114374-invalid-help-fmt-args.stderr2
-rw-r--r--tests/ui/borrowck/issue-81899.stderr1
-rw-r--r--tests/ui/borrowck/issue-88434-minimal-example.stderr1
-rw-r--r--tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr1
-rw-r--r--tests/ui/borrowck/mut-borrow-outside-loop.rs4
-rw-r--r--tests/ui/borrowck/overwrite-anon-late-param-regions.rs1
-rw-r--r--tests/ui/borrowck/overwrite-anon-late-param-regions.stderr4
-rw-r--r--tests/ui/cast/cast_lit_suffix-issue-138392.fixed6
-rw-r--r--tests/ui/cast/cast_lit_suffix-issue-138392.rs6
-rw-r--r--tests/ui/cast/cast_lit_suffix-issue-138392.stderr31
-rw-r--r--tests/ui/cast/ptr-to-trait-obj-wrap-add-auto.rs36
-rw-r--r--tests/ui/cast/ptr-to-trait-obj-wrap-add-auto.stderr48
-rw-r--r--tests/ui/cast/ptr-to-trait-obj-wrap-different-args.rs36
-rw-r--r--tests/ui/cast/ptr-to-trait-obj-wrap-different-args.stderr43
-rw-r--r--tests/ui/cast/ptr-to-trait-obj-wrap-different-regions.rs41
-rw-r--r--tests/ui/cast/ptr-to-trait-obj-wrap-different-regions.stderr140
-rw-r--r--tests/ui/cast/ptr-to-trait-obj-wrap.rs33
-rw-r--r--tests/ui/cfg/disallowed-cli-cfgs.rs2
-rw-r--r--tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr2
-rw-r--r--tests/ui/check-cfg/exhaustive-names-values.feature.stderr2
-rw-r--r--tests/ui/check-cfg/exhaustive-names-values.full.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.rs2
-rw-r--r--tests/ui/check-cfg/target_feature.stderr43
-rw-r--r--tests/ui/check-cfg/well-known-values.stderr2
-rw-r--r--tests/ui/closures/upvar-or-pattern-issue-138958.rs11
-rw-r--r--tests/ui/codegen/duplicated-path-in-error.rs2
-rw-r--r--tests/ui/codegen/empty-static-libs-issue-108825.rs16
-rw-r--r--tests/ui/codemap_tests/issue-11715.rs3
-rw-r--r--tests/ui/codemap_tests/issue-11715.stderr2
-rw-r--r--tests/ui/codemap_tests/issue-28308.stderr2
-rw-r--r--tests/ui/coercion/struct-coerce-vec-to-slice.rs20
-rw-r--r--tests/ui/coercion/struct-literal-field-type-coercion-to-expected-type.rs16
-rw-r--r--tests/ui/coherence/coherence-with-closure.rs1
-rw-r--r--tests/ui/coherence/coherence-with-closure.stderr2
-rw-r--r--tests/ui/coherence/coherence-with-coroutine.rs1
-rw-r--r--tests/ui/coherence/coherence-with-coroutine.stock.stderr2
-rw-r--r--tests/ui/coherence/const-errs-dont-conflict-103369.stderr2
-rw-r--r--tests/ui/coherence/issue-99663-2.rs1
-rw-r--r--tests/ui/coherence/issue-99663.rs1
-rw-r--r--tests/ui/coherence/occurs-check/opaques.current.stderr6
-rw-r--r--tests/ui/coherence/occurs-check/opaques.next.stderr12
-rw-r--r--tests/ui/coherence/occurs-check/opaques.rs17
-rw-r--r--tests/ui/coherence/orphan-check-error-reporting-ty-var.rs17
-rw-r--r--tests/ui/coherence/orphan-check-error-reporting-ty-var.stderr16
-rw-r--r--tests/ui/coherence/orphan-check-opaque-types-not-covering.rs2
-rw-r--r--tests/ui/coherence/orphan-check-opaque-types-not-covering.stderr4
-rw-r--r--tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr2
-rw-r--r--tests/ui/conditional-compilation/cfg-attr-syntax-validation.rs1
-rw-r--r--tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr14
-rw-r--r--tests/ui/conditional-compilation/invalid-node-range-issue-129166.rs3
-rw-r--r--tests/ui/conditional-compilation/invalid-node-range-issue-129166.stderr8
-rw-r--r--tests/ui/const-generics/adt_const_params/check-type-in-mir.rs16
-rw-r--r--tests/ui/const-generics/adt_const_params/check-type-in-mir.stderr14
-rw-r--r--tests/ui/const-generics/adt_const_params/const_param_ty_impl_bad_field.stderr2
-rw-r--r--tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr2
-rw-r--r--tests/ui/const-generics/adt_const_params/nested_bad_const_param_ty.stderr6
-rw-r--r--tests/ui/const-generics/adt_const_params/unsized_field-1.stderr6
-rw-r--r--tests/ui/const-generics/adt_const_params/unsized_field-2.stderr1
-rw-r--r--tests/ui/const-generics/adt_const_params/unsizing-wfcheck-issue-126272.stderr8
-rw-r--r--tests/ui/const-generics/const-param-type-depends-on-const-param.rs8
-rw-r--r--tests/ui/const-generics/const-param-type-depends-on-parent-param.rs8
-rw-r--r--tests/ui/const-generics/const-param-type-depends-on-parent-param.stderr9
-rw-r--r--tests/ui/const-generics/defaults/default-const-param-cannot-reference-self.stderr6
-rw-r--r--tests/ui/const-generics/defaults/forward-declared.rs8
-rw-r--r--tests/ui/const-generics/defaults/forward-declared.stderr16
-rw-r--r--tests/ui/const-generics/generic_const_exprs/opaque_type.rs4
-rw-r--r--tests/ui/const-generics/generic_const_exprs/opaque_type.stderr4
-rw-r--r--tests/ui/const-generics/generic_const_parameter_types/bad-param-in-pat.rs10
-rw-r--r--tests/ui/const-generics/generic_const_parameter_types/bad-param-in-pat.stderr11
-rw-r--r--tests/ui/const-generics/generic_const_parameter_types/check-type-in-mir.rs12
-rw-r--r--tests/ui/const-generics/generic_const_parameter_types/check-type-in-mir.stderr27
-rw-r--r--tests/ui/const-generics/generic_const_parameter_types/forward_declared_type.rs4
-rw-r--r--tests/ui/const-generics/generic_const_parameter_types/forward_declared_type.stderr9
-rw-r--r--tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.feat.stderr25
-rw-r--r--tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.nofeat.stderr9
-rw-r--r--tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.rs19
-rw-r--r--tests/ui/const-generics/opaque_types.rs3
-rw-r--r--tests/ui/const-generics/opaque_types.stderr116
-rw-r--r--tests/ui/const-generics/opaque_types2.rs13
-rw-r--r--tests/ui/const-generics/opaque_types2.stderr6
-rw-r--r--tests/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.full.stderr4
-rw-r--r--tests/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.min.stderr4
-rw-r--r--tests/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs2
-rw-r--r--tests/ui/const-ptr/forbidden_slices.stderr1
-rw-r--r--tests/ui/consts/assoc-const-elided-lifetime.stderr2
-rw-r--r--tests/ui/consts/async-block.rs5
-rw-r--r--tests/ui/consts/async-block.with_feature.stderr8
-rw-r--r--tests/ui/consts/const-blocks/trait-error.stderr1
-rw-r--r--tests/ui/consts/const-eval/const_fn_ptr.rs2
-rw-r--r--tests/ui/consts/const-eval/const_fn_ptr_fail.rs2
-rw-r--r--tests/ui/consts/const-eval/const_fn_ptr_fail2.rs2
-rw-r--r--tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.stderr2
-rw-r--r--tests/ui/consts/const-eval/const_panic.stderr20
-rw-r--r--tests/ui/consts/const-eval/const_panic_2021.stderr16
-rw-r--r--tests/ui/consts/const-eval/const_panic_libcore_bin.stderr4
-rw-r--r--tests/ui/consts/const-eval/format.stderr1
-rw-r--r--tests/ui/consts/const-eval/ice-unhandled-type-122191.rs14
-rw-r--r--tests/ui/consts/const-eval/ice-unhandled-type-122191.stderr33
-rw-r--r--tests/ui/consts/const-eval/issue-85155.rs3
-rw-r--r--tests/ui/consts/const-eval/issue-85907.stderr2
-rw-r--r--tests/ui/consts/const-eval/panic-assoc-never-type.stderr2
-rw-r--r--tests/ui/consts/const-eval/panic-never-type.stderr2
-rw-r--r--tests/ui/consts/const-eval/unwind-abort.stderr1
-rw-r--r--tests/ui/consts/const-promoted-opaque.atomic.stderr8
-rw-r--r--tests/ui/consts/const-promoted-opaque.rs30
-rw-r--r--tests/ui/consts/const-promoted-opaque.string.stderr6
-rw-r--r--tests/ui/consts/const-promoted-opaque.unit.stderr24
-rw-r--r--tests/ui/consts/const-ptr-is-null.stderr1
-rw-r--r--tests/ui/consts/const-unsized.stderr12
-rw-r--r--tests/ui/consts/const_cmp_type_id.stderr1
-rw-r--r--tests/ui/consts/control-flow/assert.stderr2
-rw-r--r--tests/ui/consts/issue-32829.stderr2
-rw-r--r--tests/ui/consts/issue-66693-panic-in-array-len.stderr4
-rw-r--r--tests/ui/consts/issue-66693.stderr10
-rw-r--r--tests/ui/consts/issue-76064.stderr2
-rw-r--r--tests/ui/consts/large_const_alloc.rs3
-rw-r--r--tests/ui/consts/large_const_alloc.stderr4
-rw-r--r--tests/ui/consts/miri_unleashed/abi-mismatch.rs2
-rw-r--r--tests/ui/consts/miri_unleashed/assoc_const.rs2
-rw-r--r--tests/ui/consts/miri_unleashed/box.rs2
-rw-r--r--tests/ui/consts/miri_unleashed/const_refers_to_static.rs2
-rw-r--r--tests/ui/consts/miri_unleashed/extern-static.stderr4
-rw-r--r--tests/ui/consts/miri_unleashed/inline_asm.rs2
-rw-r--r--tests/ui/consts/miri_unleashed/mutable_references.rs2
-rw-r--r--tests/ui/consts/miri_unleashed/non_const_fn.rs2
-rw-r--r--tests/ui/consts/miri_unleashed/ptr_arith.rs2
-rw-r--r--tests/ui/consts/miri_unleashed/static-no-inner-mut.rs2
-rw-r--r--tests/ui/consts/miri_unleashed/tls.rs2
-rw-r--r--tests/ui/consts/miri_unleashed/tls.stderr4
-rw-r--r--tests/ui/consts/promoted_running_out_of_memory_issue-130687.rs3
-rw-r--r--tests/ui/consts/promoted_running_out_of_memory_issue-130687.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-called-fn.noopt.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-called-fn.opt.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-closure.noopt.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-closure.opt.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-drop.opt.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.noopt.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.opt.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.noopt.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.opt.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.noopt.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.opt.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.rs1
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fn.noopt.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fn.opt.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.noopt.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.opt.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fnptr.noopt.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fnptr.opt.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-move.opt.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-vtable.opt.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-promoted-const.noopt.stderr2
-rw-r--r--tests/ui/consts/required-consts/collect-in-promoted-const.opt.stderr4
-rw-r--r--tests/ui/consts/required-consts/interpret-in-const-called-fn.noopt.stderr2
-rw-r--r--tests/ui/consts/required-consts/interpret-in-const-called-fn.opt.stderr2
-rw-r--r--tests/ui/consts/required-consts/interpret-in-static.noopt.stderr2
-rw-r--r--tests/ui/consts/required-consts/interpret-in-static.opt.stderr2
-rw-r--r--tests/ui/consts/static-default-lifetime/elided-lifetime.rs2
-rw-r--r--tests/ui/consts/static-default-lifetime/elided-lifetime.stderr20
-rw-r--r--tests/ui/consts/static-default-lifetime/static-trait-impl.rs15
-rw-r--r--tests/ui/consts/static-default-lifetime/static-trait-impl.stderr24
-rw-r--r--tests/ui/consts/too_generic_eval_ice.current.stderr (renamed from tests/ui/consts/too_generic_eval_ice.stderr)8
-rw-r--r--tests/ui/consts/too_generic_eval_ice.next.stderr9
-rw-r--r--tests/ui/consts/too_generic_eval_ice.rs13
-rw-r--r--tests/ui/coroutine/layout-error.rs24
-rw-r--r--tests/ui/coroutine/layout-error.stderr6
-rw-r--r--tests/ui/coroutine/metadata-sufficient-for-layout.rs1
-rw-r--r--tests/ui/coroutine/postfix-yield.rs34
-rw-r--r--tests/ui/crate_type_flag.rs4
-rw-r--r--tests/ui/crate_type_flag.stderr2
-rw-r--r--tests/ui/custom_test_frameworks/mismatch.stderr1
-rw-r--r--tests/ui/delegation/fn-header-variadic.rs25
-rw-r--r--tests/ui/delegation/fn-header-variadic.stderr22
-rw-r--r--tests/ui/delegation/fn-header.rs11
-rw-r--r--tests/ui/delegation/foreign-fn.rs22
-rw-r--r--tests/ui/delegation/foreign-fn.stderr27
-rw-r--r--tests/ui/delegation/ice-issue-138362.rs15
-rw-r--r--tests/ui/delegation/ice-issue-138362.stderr19
-rw-r--r--tests/ui/dep-graph/dep-graph-dump.rs2
-rw-r--r--tests/ui/deprecation/deprecated_ar.rs2
-rw-r--r--tests/ui/deprecation/deprecated_inline_threshold.rs6
-rw-r--r--tests/ui/deprecation/deprecated_no_stack_check_opt.rs2
-rw-r--r--tests/ui/derives/derives-span-Clone-enum-struct-variant.stderr1
-rw-r--r--tests/ui/derives/derives-span-Clone-enum.stderr1
-rw-r--r--tests/ui/derives/derives-span-Clone-struct.stderr1
-rw-r--r--tests/ui/derives/derives-span-Clone-tuple-struct.stderr1
-rw-r--r--tests/ui/derives/derives-span-Debug-enum-struct-variant.stderr1
-rw-r--r--tests/ui/derives/derives-span-Debug-enum.stderr1
-rw-r--r--tests/ui/derives/derives-span-Debug-struct.stderr1
-rw-r--r--tests/ui/derives/derives-span-Debug-tuple-struct.stderr1
-rw-r--r--tests/ui/derives/derives-span-Default-struct.stderr1
-rw-r--r--tests/ui/derives/derives-span-Default-tuple-struct.stderr1
-rw-r--r--tests/ui/derives/derives-span-Eq-enum-struct-variant.stderr1
-rw-r--r--tests/ui/derives/derives-span-Eq-enum.stderr1
-rw-r--r--tests/ui/derives/derives-span-Eq-struct.stderr1
-rw-r--r--tests/ui/derives/derives-span-Eq-tuple-struct.stderr1
-rw-r--r--tests/ui/derives/derives-span-Hash-enum-struct-variant.stderr1
-rw-r--r--tests/ui/derives/derives-span-Hash-enum.stderr1
-rw-r--r--tests/ui/derives/derives-span-Hash-struct.stderr1
-rw-r--r--tests/ui/derives/derives-span-Hash-tuple-struct.stderr1
-rw-r--r--tests/ui/derives/derives-span-Ord-enum-struct-variant.stderr1
-rw-r--r--tests/ui/derives/derives-span-Ord-enum.stderr1
-rw-r--r--tests/ui/derives/derives-span-Ord-struct.stderr1
-rw-r--r--tests/ui/derives/derives-span-Ord-tuple-struct.stderr1
-rw-r--r--tests/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr1
-rw-r--r--tests/ui/derives/derives-span-PartialEq-enum.stderr1
-rw-r--r--tests/ui/derives/derives-span-PartialEq-struct.stderr1
-rw-r--r--tests/ui/derives/derives-span-PartialEq-tuple-struct.stderr1
-rw-r--r--tests/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr1
-rw-r--r--tests/ui/derives/derives-span-PartialOrd-enum.stderr1
-rw-r--r--tests/ui/derives/derives-span-PartialOrd-struct.stderr1
-rw-r--r--tests/ui/derives/derives-span-PartialOrd-tuple-struct.stderr1
-rw-r--r--tests/ui/derives/deriving-copyclone.stderr3
-rw-r--r--tests/ui/derives/deriving-no-inner-impl-error-message.stderr2
-rw-r--r--tests/ui/derives/deriving-with-repr-packed-move-errors.stderr9
-rw-r--r--tests/ui/derives/deriving-with-repr-packed.stderr3
-rw-r--r--tests/ui/derives/duplicate-derive-copy-clone-diagnostics.stderr4
-rw-r--r--tests/ui/derives/issue-97343.stderr1
-rw-r--r--tests/ui/deriving/deriving-coerce-pointee-neg.stderr15
-rw-r--r--tests/ui/deriving/do-not-suggest-calling-fn-in-derive-macro.stderr2
-rw-r--r--tests/ui/deriving/issue-103157.stderr1
-rw-r--r--tests/ui/deriving/multiple-defaults.stderr2
-rw-r--r--tests/ui/diagnostic-flags/allow-non-lint-warnings.rs10
-rw-r--r--tests/ui/diagnostic-flags/allow-non-lint-warnings.without_flag.stderr10
-rw-r--r--tests/ui/diagnostic-width/tabs-trimming.stderr2
-rw-r--r--tests/ui/diagnostic_namespace/suggest_typos.rs5
-rw-r--r--tests/ui/diagnostic_namespace/suggest_typos.stderr14
-rw-r--r--tests/ui/did_you_mean/recursion_limit_deref.rs3
-rw-r--r--tests/ui/drop/drop_elaboration_with_errors.rs1
-rw-r--r--tests/ui/drop/drop_elaboration_with_errors.stderr2
-rw-r--r--tests/ui/dupe-first-attr.rs25
-rw-r--r--tests/ui/duplicate_entry_error.rs18
-rw-r--r--tests/ui/dyn-compatibility/avoid-ice-on-warning-2.new.stderr2
-rw-r--r--tests/ui/dyn-compatibility/avoid-ice-on-warning-3.new.stderr4
-rw-r--r--tests/ui/editions/edition-keywords-2018-2015-parsing.rs2
-rw-r--r--tests/ui/editions/edition-keywords-2018-2018-parsing.rs2
-rw-r--r--tests/ui/entry-point/imported_main_const_fn_item_type_forbidden.rs6
-rw-r--r--tests/ui/entry-point/imported_main_const_fn_item_type_forbidden.stderr2
-rw-r--r--tests/ui/entry-point/imported_main_from_extern_crate_wrong_type.rs2
-rw-r--r--tests/ui/env-macro/env-escaped-var.stderr1
-rw-r--r--tests/ui/env-macro/env-not-defined-custom.stderr2
-rw-r--r--tests/ui/env-macro/env-not-defined-default.stderr1
-rw-r--r--tests/ui/env-macro/error-recovery-issue-55897.stderr1
-rw-r--r--tests/ui/env-macro/name-whitespace-issue-110547.stderr3
-rw-r--r--tests/ui/error-codes/E0128.stderr4
-rw-r--r--tests/ui/error-codes/E0152-duplicate-lang-items.rs20
-rw-r--r--tests/ui/error-codes/E0152-duplicate-lang-items.stderr (renamed from tests/ui/duplicate_entry_error.stderr)6
-rw-r--r--tests/ui/error-codes/E0184.stderr2
-rw-r--r--tests/ui/error-codes/E0381-duplicated-label.rs (renamed from tests/ui/duplicate-label-E0381-issue-129274.rs)3
-rw-r--r--tests/ui/error-codes/E0381-duplicated-label.stderr (renamed from tests/ui/duplicate-label-E0381-issue-129274.stderr)2
-rw-r--r--tests/ui/errors/wrong-target-spec.rs2
-rw-r--r--tests/ui/exclusive-drop-and-copy.stderr4
-rw-r--r--tests/ui/explicit-tail-calls/ctfe-tail-call-panic.stderr1
-rw-r--r--tests/ui/extern/issue-28324.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-asm_goto.rs10
-rw-r--r--tests/ui/feature-gates/feature-gate-asm_goto.stderr13
-rw-r--r--tests/ui/feature-gates/feature-gate-asm_goto_with_outputs.rs2
-rw-r--r--tests/ui/feature-gates/feature-gate-asm_goto_with_outputs.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-concat_idents2.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.rs9
-rw-r--r--tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.stderr20
-rw-r--r--tests/ui/feature-gates/feature-gate-link-arg-attribute.rs2
-rw-r--r--tests/ui/feature-gates/feature-gate-naked_functions_target_feature.rs15
-rw-r--r--tests/ui/feature-gates/feature-gate-naked_functions_target_feature.stderr13
-rw-r--r--tests/ui/feature-gates/feature-gate-native_link_modifiers_as_needed.rs2
-rw-r--r--tests/ui/feature-gates/feature-gate-precise_capturing_in_traits.rs6
-rw-r--r--tests/ui/feature-gates/feature-gate-precise_capturing_in_traits.stderr13
-rw-r--r--tests/ui/feature-gates/feature-gate-print-check-cfg.rs3
-rw-r--r--tests/ui/feature-gates/feature-gate-print-check-cfg.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-rustc-attrs-1.rs1
-rw-r--r--tests/ui/feature-gates/feature-gate-rustc-attrs-1.stderr13
-rw-r--r--tests/ui/feature-gates/feature-gate-type_alias_impl_trait.rs25
-rw-r--r--tests/ui/feature-gates/feature-gate-type_alias_impl_trait.stderr111
-rw-r--r--tests/ui/feature-gates/feature-gate-unqualified-local-imports.stderr1
-rw-r--r--tests/ui/fmt/fmt_debug/invalid.rs2
-rw-r--r--tests/ui/fmt/format-args-capture-first-literal-is-macro.stderr1
-rw-r--r--tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.stderr1
-rw-r--r--tests/ui/fmt/format-args-capture-macro-hygiene.stderr2
-rw-r--r--tests/ui/fmt/format-expanded-string.stderr1
-rw-r--r--tests/ui/fmt/ifmt-bad-format-args.stderr2
-rw-r--r--tests/ui/fmt/issue-86085.stderr1
-rw-r--r--tests/ui/fmt/issue-91556.stderr1
-rw-r--r--tests/ui/fmt/raw-idents.stderr1
-rw-r--r--tests/ui/fmt/respanned-literal-issue-106191.stderr1
-rw-r--r--tests/ui/fn/fn_def_opaque_coercion.rs5
-rw-r--r--tests/ui/fn/fn_def_opaque_coercion_to_fn_ptr.rs3
-rw-r--r--tests/ui/fn/fn_def_opaque_coercion_to_fn_ptr.stderr4
-rw-r--r--tests/ui/fn/trait-fn-generic-mismatch.rs12
-rw-r--r--tests/ui/fn/trait-fn-generic-mismatch.stderr32
-rw-r--r--tests/ui/generic-associated-types/impl_bounds.stderr2
-rw-r--r--tests/ui/generic-associated-types/issue-87258_b.rs1
-rw-r--r--tests/ui/generic-associated-types/issue-87258_b.stderr2
-rw-r--r--tests/ui/generic-associated-types/issue-88287.rs1
-rw-r--r--tests/ui/generic-associated-types/issue-88287.stderr2
-rw-r--r--tests/ui/generic-associated-types/issue-90014-tait.stderr15
-rw-r--r--tests/ui/generic-associated-types/issue-90014-tait2.rs1
-rw-r--r--tests/ui/generic-associated-types/issue-90014-tait2.stderr2
-rw-r--r--tests/ui/generic-const-items/def-site-eval.fail.stderr2
-rw-r--r--tests/ui/generics/generic-non-trailing-defaults.rs2
-rw-r--r--tests/ui/generics/generic-non-trailing-defaults.stderr4
-rw-r--r--tests/ui/generics/generic-type-params-forward-mention.rs2
-rw-r--r--tests/ui/generics/generic-type-params-forward-mention.stderr4
-rw-r--r--tests/ui/generics/issue-61631-default-type-param-cannot-reference-self.stderr12
-rw-r--r--tests/ui/generics/post_monomorphization_error_backtrace.stderr4
-rw-r--r--tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.old.stderr10
-rw-r--r--tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.rs1
-rw-r--r--tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness-2.rs36
-rw-r--r--tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness-2.stderr14
-rw-r--r--tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.rs13
-rw-r--r--tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.stderr15
-rw-r--r--tests/ui/impl-trait/associated-type-undefine.rs1
-rw-r--r--tests/ui/impl-trait/associated-type-undefine.stderr17
-rw-r--r--tests/ui/impl-trait/async_scope_creep.rs2
-rw-r--r--tests/ui/impl-trait/auto-trait-coherence.rs1
-rw-r--r--tests/ui/impl-trait/auto-trait-coherence.stderr2
-rw-r--r--tests/ui/impl-trait/bound-normalization-pass.rs1
-rw-r--r--tests/ui/impl-trait/coherence-treats-tait-ambig.rs3
-rw-r--r--tests/ui/impl-trait/deduce-signature-from-supertrait.rs3
-rw-r--r--tests/ui/impl-trait/define-via-const.rs12
-rw-r--r--tests/ui/impl-trait/define-via-extern.rs16
-rw-r--r--tests/ui/impl-trait/define-via-extern.stderr14
-rw-r--r--tests/ui/impl-trait/future-no-bound-vars-ice-112347.rs11
-rw-r--r--tests/ui/impl-trait/hidden-type-is-opaque-2.default.stderr2
-rw-r--r--tests/ui/impl-trait/hidden-type-is-opaque-2.next.stderr2
-rw-r--r--tests/ui/impl-trait/hidden-type-is-opaque-2.rs1
-rw-r--r--tests/ui/impl-trait/hidden-type-is-opaque.rs1
-rw-r--r--tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.current.stderr14
-rw-r--r--tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.next.stderr18
-rw-r--r--tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs1
-rw-r--r--tests/ui/impl-trait/impl-fn-predefined-lifetimes.rs3
-rw-r--r--tests/ui/impl-trait/impl-fn-predefined-lifetimes.stderr18
-rw-r--r--tests/ui/impl-trait/impl_trait_projections.rs5
-rw-r--r--tests/ui/impl-trait/impl_trait_projections.stderr10
-rw-r--r--tests/ui/impl-trait/in-assoc-type-unconstrained.stderr5
-rw-r--r--tests/ui/impl-trait/in-assoc-type.stderr5
-rw-r--r--tests/ui/impl-trait/in-trait/dump.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/refine-captures.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/refine-captures.stderr8
-rw-r--r--tests/ui/impl-trait/in-trait/variance.rs2
-rw-r--r--tests/ui/impl-trait/inside-item-nested-in-anon-const.rs25
-rw-r--r--tests/ui/impl-trait/issue-108591.rs1
-rw-r--r--tests/ui/impl-trait/issue-108592.rs11
-rw-r--r--tests/ui/impl-trait/issue-99642-2.rs3
-rw-r--r--tests/ui/impl-trait/issues/issue-53457.rs1
-rw-r--r--tests/ui/impl-trait/issues/issue-70877.rs38
-rw-r--r--tests/ui/impl-trait/issues/issue-70877.stderr63
-rw-r--r--tests/ui/impl-trait/issues/issue-74282.rs3
-rw-r--r--tests/ui/impl-trait/issues/issue-74282.stderr10
-rw-r--r--tests/ui/impl-trait/issues/issue-77987.rs13
-rw-r--r--tests/ui/impl-trait/issues/issue-78722-2.rs1
-rw-r--r--tests/ui/impl-trait/issues/issue-78722-2.stderr8
-rw-r--r--tests/ui/impl-trait/issues/issue-78722.rs1
-rw-r--r--tests/ui/impl-trait/issues/issue-78722.stderr6
-rw-r--r--tests/ui/impl-trait/issues/issue-86201.rs7
-rw-r--r--tests/ui/impl-trait/issues/issue-86800.rs25
-rw-r--r--tests/ui/impl-trait/issues/issue-86800.stderr49
-rw-r--r--tests/ui/impl-trait/issues/issue-89312.rs24
-rw-r--r--tests/ui/impl-trait/issues/issue-99348-impl-compatibility.rs1
-rw-r--r--tests/ui/impl-trait/multiple-lifetimes/error-handling-2.rs1
-rw-r--r--tests/ui/impl-trait/multiple-lifetimes/error-handling-2.stderr4
-rw-r--r--tests/ui/impl-trait/multiple-lifetimes/error-handling.rs1
-rw-r--r--tests/ui/impl-trait/multiple-lifetimes/error-handling.stderr2
-rw-r--r--tests/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original-type-alias-impl-trait.rs1
-rw-r--r--tests/ui/impl-trait/negative-reasoning.rs1
-rw-r--r--tests/ui/impl-trait/negative-reasoning.stderr2
-rw-r--r--tests/ui/impl-trait/nested-return-type2-tait.rs4
-rw-r--r--tests/ui/impl-trait/nested-return-type2-tait.stderr2
-rw-r--r--tests/ui/impl-trait/nested-return-type2-tait2.rs4
-rw-r--r--tests/ui/impl-trait/nested-return-type2-tait3.rs4
-rw-r--r--tests/ui/impl-trait/nested-return-type3-tait.rs4
-rw-r--r--tests/ui/impl-trait/nested-return-type3-tait.stderr2
-rw-r--r--tests/ui/impl-trait/nested-return-type3-tait2.rs4
-rw-r--r--tests/ui/impl-trait/nested-return-type3-tait3.rs4
-rw-r--r--tests/ui/impl-trait/normalize-tait-in-const.stderr32
-rw-r--r--tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.rs2
-rw-r--r--tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.stderr4
-rw-r--r--tests/ui/impl-trait/precise-capturing/redundant.rs1
-rw-r--r--tests/ui/impl-trait/precise-capturing/redundant.stderr10
-rw-r--r--tests/ui/impl-trait/precise-capturing/rpitit-captures-more-method-lifetimes.rs2
-rw-r--r--tests/ui/impl-trait/precise-capturing/rpitit-captures-more-method-lifetimes.stderr4
-rw-r--r--tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.rs2
-rw-r--r--tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.stderr4
-rw-r--r--tests/ui/impl-trait/precise-capturing/rpitit-outlives-2.rs2
-rw-r--r--tests/ui/impl-trait/precise-capturing/rpitit-outlives.rs2
-rw-r--r--tests/ui/impl-trait/precise-capturing/rpitit.rs2
-rw-r--r--tests/ui/impl-trait/precise-capturing/rpitit.stderr6
-rw-r--r--tests/ui/impl-trait/precise-capturing/self-capture.rs2
-rw-r--r--tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle-2.rs10
-rw-r--r--tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.rs1
-rw-r--r--tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr20
-rw-r--r--tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.rs1
-rw-r--r--tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.stderr2
-rw-r--r--tests/ui/impl-trait/two_tait_defining_each_other.current.stderr2
-rw-r--r--tests/ui/impl-trait/two_tait_defining_each_other.rs1
-rw-r--r--tests/ui/impl-trait/two_tait_defining_each_other2.current.stderr10
-rw-r--r--tests/ui/impl-trait/two_tait_defining_each_other2.next.stderr2
-rw-r--r--tests/ui/impl-trait/two_tait_defining_each_other2.rs1
-rw-r--r--tests/ui/impl-trait/two_tait_defining_each_other3.current.stderr2
-rw-r--r--tests/ui/impl-trait/two_tait_defining_each_other3.rs1
-rw-r--r--tests/ui/impl-trait/type-alias-impl-trait-in-fn-body.rs1
-rw-r--r--tests/ui/impl-trait/type-alias-impl-trait-in-fn-body.stderr6
-rw-r--r--tests/ui/impl-trait/where-allowed.rs1
-rw-r--r--tests/ui/impl-trait/where-allowed.stderr58
-rw-r--r--tests/ui/implied-bounds/dyn-erasure-tait.rs1
-rw-r--r--tests/ui/include-macros/mismatched-types.stderr2
-rw-r--r--tests/ui/include-macros/parent_dir.stderr4
-rw-r--r--tests/ui/infinite/infinite-struct.rs2
-rw-r--r--tests/ui/inline-const/const-expr-generic-err.stderr2
-rw-r--r--tests/ui/inline-const/required-const.stderr2
-rw-r--r--tests/ui/instrument-coverage/bad-value.rs3
-rw-r--r--tests/ui/instrument-coverage/coverage-options.rs2
-rw-r--r--tests/ui/invalid-compile-flags/branch-protection-missing-pac-ret.rs4
-rw-r--r--tests/ui/invalid-compile-flags/crate-type-flag.empty_crate_type.stderr2
-rw-r--r--tests/ui/invalid-compile-flags/crate-type-flag.proc_underscore_macro.stderr2
-rw-r--r--tests/ui/invalid-compile-flags/crate-type-flag.rs6
-rw-r--r--tests/ui/invalid-compile-flags/crate-type-flag.unknown.stderr2
-rw-r--r--tests/ui/invalid-compile-flags/invalid-llvm-passes.rs2
-rw-r--r--tests/ui/invalid-compile-flags/need-crate-arg-ignore-tidy$x.rs3
-rw-r--r--tests/ui/invalid-compile-flags/print-without-arg.stderr2
-rw-r--r--tests/ui/invalid-compile-flags/print.rs2
-rw-r--r--tests/ui/invalid-compile-flags/print.stderr3
-rw-r--r--tests/ui/invalid-module-declaration/invalid-module-declaration.rs2
-rw-r--r--tests/ui/issues/issue-14091-2.stderr1
-rw-r--r--tests/ui/issues/issue-18183.stderr4
-rw-r--r--tests/ui/issues/issue-21160.stderr1
-rw-r--r--tests/ui/issues/issue-26812.rs2
-rw-r--r--tests/ui/issues/issue-26812.stderr4
-rw-r--r--tests/ui/issues/issue-27340.stderr3
-rw-r--r--tests/ui/issues/issue-27592.stderr4
-rw-r--r--tests/ui/issues/issue-28777.rs22
-rw-r--r--tests/ui/issues/issue-31260.rs15
-rw-r--r--tests/ui/issues/issue-32950.stderr2
-rw-r--r--tests/ui/issues/issue-34229.stderr1
-rw-r--r--tests/ui/issues/issue-76191.stderr2
-rw-r--r--tests/ui/issues/issue-9382.rs37
-rw-r--r--tests/ui/lang-items/lang-item-generic-requirements.rs2
-rw-r--r--tests/ui/layout/debug.rs1
-rw-r--r--tests/ui/layout/debug.stderr30
-rw-r--r--tests/ui/layout/reprc-power-alignment.rs26
-rw-r--r--tests/ui/lazy-type-alias-impl-trait/branches.rs8
-rw-r--r--tests/ui/lazy-type-alias-impl-trait/branches.stderr2
-rw-r--r--tests/ui/lazy-type-alias-impl-trait/branches2.rs13
-rw-r--r--tests/ui/lazy-type-alias-impl-trait/branches3.rs3
-rw-r--r--tests/ui/lazy-type-alias-impl-trait/branches3.stderr8
-rw-r--r--tests/ui/lazy-type-alias-impl-trait/recursion.rs5
-rw-r--r--tests/ui/lazy-type-alias-impl-trait/recursion2.rs3
-rw-r--r--tests/ui/lazy-type-alias-impl-trait/recursion3.rs5
-rw-r--r--tests/ui/lazy-type-alias-impl-trait/recursion3.stderr4
-rw-r--r--tests/ui/lazy-type-alias-impl-trait/recursion4.rs1
-rw-r--r--tests/ui/lazy-type-alias-impl-trait/recursion4.stderr4
-rw-r--r--tests/ui/lazy-type-alias/inherent-impls-overflow.next.stderr7
-rw-r--r--tests/ui/lazy-type-alias/inherent-impls-overflow.rs2
-rw-r--r--tests/ui/link-native-libs/modifiers-bad.rs5
-rw-r--r--tests/ui/link-native-libs/modifiers-override-2.rs2
-rw-r--r--tests/ui/link-native-libs/msvc-non-utf8-output.rs2
-rw-r--r--tests/ui/linkage-attr/link-self-contained-consistency.rs3
-rw-r--r--tests/ui/linkage-attr/linkage-detect-extern-generated-name-collision.rs2
-rw-r--r--tests/ui/linkage-attr/raw-dylib/windows/dlltool-failed.rs2
-rw-r--r--tests/ui/linkage-attr/raw-dylib/windows/invalid-dlltool.rs2
-rw-r--r--tests/ui/lint/expansion-time.rs2
-rw-r--r--tests/ui/lint/inert-attr-macro.rs7
-rw-r--r--tests/ui/lint/inert-attr-macro.stderr14
-rw-r--r--tests/ui/lint/inline-exported.rs30
-rw-r--r--tests/ui/lint/inline-exported.stderr31
-rw-r--r--tests/ui/lint/invalid_from_utf8.rs41
-rw-r--r--tests/ui/lint/invalid_from_utf8.stderr65
-rw-r--r--tests/ui/lint/invalid_null_args.rs136
-rw-r--r--tests/ui/lint/invalid_null_args.stderr330
-rw-r--r--tests/ui/lint/issue-99387.rs1
-rw-r--r--tests/ui/lint/issue-99387.stderr6
-rw-r--r--tests/ui/lint/let_underscore/issue-119697-extra-let.rs2
-rw-r--r--tests/ui/lint/let_underscore/issue-119697-extra-let.stderr4
-rw-r--r--tests/ui/lint/linker-warning.stderr2
-rw-r--r--tests/ui/lint/lint-ctypes-73249-2.rs1
-rw-r--r--tests/ui/lint/lint-ctypes-73249-2.stderr2
-rw-r--r--tests/ui/lint/lint-ctypes-73249-3.rs1
-rw-r--r--tests/ui/lint/lint-ctypes-73249-3.stderr2
-rw-r--r--tests/ui/lint/lint-ctypes-73249-5.rs1
-rw-r--r--tests/ui/lint/lint-ctypes-73249-5.stderr2
-rw-r--r--tests/ui/lint/lint-ctypes-73251-1.rs1
-rw-r--r--tests/ui/lint/lint-ctypes-73251-1.stderr2
-rw-r--r--tests/ui/lint/lint-ctypes-73251-2.rs2
-rw-r--r--tests/ui/lint/lint-ctypes-73251-2.stderr2
-rw-r--r--tests/ui/lint/lint-ctypes-73251.rs1
-rw-r--r--tests/ui/lint/lint-unexported-no-mangle.rs7
-rw-r--r--tests/ui/lint/opaque-ty-ffi-normalization-cycle.rs2
-rw-r--r--tests/ui/lint/opaque-ty-ffi-normalization-cycle.stderr2
-rw-r--r--tests/ui/lint/opaque-ty-ffi-unsafe.rs1
-rw-r--r--tests/ui/lint/opaque-ty-ffi-unsafe.stderr2
-rw-r--r--tests/ui/lint/test-inner-fn.stderr3
-rw-r--r--tests/ui/lint/unused/lint-unused-imports-self-single.fixed29
-rw-r--r--tests/ui/lint/unused/lint-unused-imports-self-single.rs30
-rw-r--r--tests/ui/lint/unused/lint-unused-imports-self-single.stderr44
-rw-r--r--tests/ui/lint/unused/unused-field-in-pat-field.rs21
-rw-r--r--tests/ui/lint/wasm_c_abi_transition.rs41
-rw-r--r--tests/ui/lint/wasm_c_abi_transition.stderr85
-rw-r--r--tests/ui/loops/label-on-block-suggest-move.rs90
-rw-r--r--tests/ui/loops/label-on-block-suggest-move.stderr140
-rw-r--r--tests/ui/lto/lto-and-no-bitcode-in-rlib.rs2
-rw-r--r--tests/ui/macros/builtin-env-issue-114010.stderr2
-rw-r--r--tests/ui/macros/cfg.stderr4
-rw-r--r--tests/ui/macros/duplicate-builtin.rs17
-rw-r--r--tests/ui/macros/duplicate-builtin.stderr21
-rw-r--r--tests/ui/macros/include-single-expr.rs4
-rw-r--r--tests/ui/macros/macro-stmt-2.rs11
-rw-r--r--tests/ui/macros/macros-nonfatal-errors.stderr9
-rw-r--r--tests/ui/macros/nonterminal-matching.rs4
-rw-r--r--tests/ui/macros/nonterminal-matching.stderr6
-rw-r--r--tests/ui/macros/not-utf8.stderr1
-rw-r--r--tests/ui/macros/std-2024-macros.rs13
-rw-r--r--tests/ui/macros/unknown-builtin.rs5
-rw-r--r--tests/ui/macros/unknown-builtin.stderr14
-rw-r--r--tests/ui/macros/unreachable-format-args.edition_2015.stderr1
-rw-r--r--tests/ui/malformed/malformed-derive-entry.stderr2
-rw-r--r--tests/ui/match/privately-uninhabited-issue-137999.rs44
-rw-r--r--tests/ui/match/privately-uninhabited-issue-137999.stderr26
-rw-r--r--tests/ui/methods/opaque_param_in_ufc.rs2
-rw-r--r--tests/ui/mir-dataflow/inits-1.rs2
-rw-r--r--tests/ui/mir-dataflow/liveness-enum.rs2
-rw-r--r--tests/ui/mir-dataflow/liveness-projection.rs2
-rw-r--r--tests/ui/mir-dataflow/liveness-ptr.rs2
-rw-r--r--tests/ui/mir-dataflow/uninits-1.rs2
-rw-r--r--tests/ui/mir-dataflow/uninits-2.rs2
-rw-r--r--tests/ui/mir/enable_passes_validation.rs3
-rw-r--r--tests/ui/mir/inline-causes-trimmed-paths.rs36
-rw-r--r--tests/ui/mir/issue-75053.rs17
-rw-r--r--tests/ui/mir/issue-75053.stderr8
-rw-r--r--tests/ui/mir/var_debug_ref.rs24
-rw-r--r--tests/ui/missing/missing-allocator.rs2
-rw-r--r--tests/ui/missing_non_modrs_mod/missing_non_modrs_mod.rs2
-rw-r--r--tests/ui/missing_non_modrs_mod/missing_non_modrs_mod_inline.rs2
-rw-r--r--tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.current.fixed (renamed from tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.fixed)9
-rw-r--r--tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.current.stderr (renamed from tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.stderr)4
-rw-r--r--tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.next.fixed31
-rw-r--r--tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.next.stderr25
-rw-r--r--tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.rs9
-rw-r--r--tests/ui/never_type/fallback-closure-wrap.fallback.stderr1
-rw-r--r--tests/ui/never_type/impl_trait_fallback2.rs2
-rw-r--r--tests/ui/never_type/impl_trait_fallback2.stderr2
-rw-r--r--tests/ui/never_type/impl_trait_fallback3.rs1
-rw-r--r--tests/ui/never_type/impl_trait_fallback3.stderr2
-rw-r--r--tests/ui/never_type/impl_trait_fallback4.rs1
-rw-r--r--tests/ui/panic-handler/panic-handler-wrong-location.rs2
-rw-r--r--tests/ui/parser/attribute/attr-bad-meta-4.rs2
-rw-r--r--tests/ui/parser/attribute/attr-bad-meta-4.stderr24
-rw-r--r--tests/ui/parser/closure-return-syntax.rs16
-rw-r--r--tests/ui/parser/closure-return-syntax.stderr34
-rw-r--r--tests/ui/parser/issues/issue-103451.rs2
-rw-r--r--tests/ui/parser/issues/issue-10636-2.rs2
-rw-r--r--tests/ui/parser/issues/issue-111692.rs32
-rw-r--r--tests/ui/parser/issues/issue-111692.stderr46
-rw-r--r--tests/ui/parser/issues/issue-58094-missing-right-square-bracket.rs3
-rw-r--r--tests/ui/parser/issues/issue-58094-missing-right-square-bracket.stderr2
-rw-r--r--tests/ui/parser/issues/issue-62524.rs3
-rw-r--r--tests/ui/parser/issues/issue-62524.stderr2
-rw-r--r--tests/ui/parser/issues/issue-62554.rs3
-rw-r--r--tests/ui/parser/issues/issue-62554.stderr2
-rw-r--r--tests/ui/parser/issues/issue-62894.rs2
-rw-r--r--tests/ui/parser/issues/issue-62973.rs4
-rw-r--r--tests/ui/parser/issues/issue-62973.stderr6
-rw-r--r--tests/ui/parser/issues/issue-63116.rs3
-rw-r--r--tests/ui/parser/issues/issue-63116.stderr4
-rw-r--r--tests/ui/parser/issues/issue-63135.rs3
-rw-r--r--tests/ui/parser/issues/issue-63135.stderr2
-rw-r--r--tests/ui/parser/issues/issue-81804.rs5
-rw-r--r--tests/ui/parser/issues/issue-81804.stderr4
-rw-r--r--tests/ui/parser/issues/issue-81827.rs7
-rw-r--r--tests/ui/parser/issues/issue-81827.stderr4
-rw-r--r--tests/ui/parser/issues/issue-84104.rs2
-rw-r--r--tests/ui/parser/issues/issue-84148-2.rs2
-rw-r--r--tests/ui/parser/issues/issue-88770.rs3
-rw-r--r--tests/ui/parser/issues/issue-88770.stderr2
-rw-r--r--tests/ui/parser/issues/issue-94340.rs3
-rw-r--r--tests/ui/parser/mbe_missing_right_paren.rs2
-rw-r--r--tests/ui/parser/method-call-on-struct-literal-in-if-condition.rs13
-rw-r--r--tests/ui/parser/method-call-on-struct-literal-in-if-condition.stderr13
-rw-r--r--tests/ui/parser/missing_right_paren.rs3
-rw-r--r--tests/ui/parser/missing_right_paren.stderr2
-rw-r--r--tests/ui/parser/operator-precedence-braces-exprs.rs28
-rw-r--r--tests/ui/parser/shebang/issue-71471-ignore-tidy.stderr3
-rw-r--r--tests/ui/parser/shebang/shebang-must-start-file.stderr3
-rw-r--r--tests/ui/parser/shebang/shebang-split.rs5
-rw-r--r--tests/ui/parser/shebang/shebang-split.stderr8
-rw-r--r--tests/ui/parser/struct-literal-in-for.rs17
-rw-r--r--tests/ui/parser/struct-literal-in-for.stderr31
-rw-r--r--tests/ui/parser/struct-literal-in-if.rs22
-rw-r--r--tests/ui/parser/struct-literal-in-if.stderr34
-rw-r--r--tests/ui/parser/struct-literal-in-match-discriminant.rs13
-rw-r--r--tests/ui/parser/struct-literal-in-match-discriminant.stderr18
-rw-r--r--tests/ui/parser/struct-literal-in-while.rs22
-rw-r--r--tests/ui/parser/struct-literal-in-while.stderr34
-rw-r--r--tests/ui/parser/struct-literal-restrictions-in-lamda.rs17
-rw-r--r--tests/ui/parser/struct-literal-restrictions-in-lamda.stderr37
-rw-r--r--tests/ui/parser/struct-literal-variant-in-if.rs25
-rw-r--r--tests/ui/parser/struct-literal-variant-in-if.stderr76
-rw-r--r--tests/ui/parser/struct-literals-in-invalid-places.rs92
-rw-r--r--tests/ui/parser/struct-literals-in-invalid-places.stderr234
-rw-r--r--tests/ui/parser/type-ascription-in-pattern.rs9
-rw-r--r--tests/ui/parser/type-ascription-in-pattern.stderr80
-rw-r--r--tests/ui/parser/unbalanced-doublequote.rs4
-rw-r--r--tests/ui/parser/unbalanced-doublequote.stderr2
-rw-r--r--tests/ui/parser/unclosed-delimiter-in-dep.rs2
-rw-r--r--tests/ui/parser/use-unclosed-brace.rs2
-rw-r--r--tests/ui/patchable-function-entry/patchable-function-entry-flags.rs3
-rw-r--r--tests/ui/pattern/check-struct-pat-fields-stability-issue-138319.rs12
-rw-r--r--tests/ui/pattern/check-struct-pat-fields-stability-issue-138319.stderr10
-rw-r--r--tests/ui/pattern/deref-patterns/dont-ice-on-slice-in-deref-pat-in-closure.rs15
-rw-r--r--tests/ui/pattern/usefulness/impl-trait.rs6
-rw-r--r--tests/ui/pattern/usefulness/impl-trait.stderr80
-rw-r--r--tests/ui/pin-macro/pin_move.rs26
-rw-r--r--tests/ui/pin-macro/pin_move.stderr38
-rw-r--r--tests/ui/precondition-checks/copy-nonoverlapping.rs2
-rw-r--r--tests/ui/precondition-checks/copy.rs2
-rw-r--r--tests/ui/precondition-checks/read_volatile.rs2
-rw-r--r--tests/ui/precondition-checks/replace.rs2
-rw-r--r--tests/ui/precondition-checks/slice-from-raw-parts-mut.rs2
-rw-r--r--tests/ui/precondition-checks/slice-from-raw-parts.rs2
-rw-r--r--tests/ui/precondition-checks/swap-nonoverlapping.rs2
-rw-r--r--tests/ui/precondition-checks/write_volatile.rs2
-rw-r--r--tests/ui/precondition-checks/zero-size-null.rs2
-rw-r--r--tests/ui/print-request/invalid-target.rs2
-rw-r--r--tests/ui/print-request/print-lints-help.rs7
-rw-r--r--tests/ui/print-request/print-lints-help.stderr6
-rw-r--r--tests/ui/print-request/stability.rs107
-rw-r--r--tests/ui/print-request/supported-crate-types.linux.stdout7
-rw-r--r--tests/ui/print-request/supported-crate-types.musl.stdout5
-rw-r--r--tests/ui/print-request/supported-crate-types.rs20
-rw-r--r--tests/ui/print-request/supported-crate-types.wasm.stdout5
-rw-r--r--tests/ui/privacy/private-in-public-type-alias-impl-trait.rs1
-rw-r--r--tests/ui/privacy/pub-priv-dep/pub-priv1.rs7
-rw-r--r--tests/ui/privacy/pub-priv-dep/pub-priv1.stderr22
-rw-r--r--tests/ui/privacy/where-pub-type-impls-priv-trait.rs1
-rw-r--r--tests/ui/privacy/where-pub-type-impls-priv-trait.stderr20
-rw-r--r--tests/ui/proc-macro/cfg-attr-trace.rs23
-rw-r--r--tests/ui/proc-macro/cfg-attr-trace.stdout78
-rw-r--r--tests/ui/proc-macro/expand-to-derive.stdout80
-rw-r--r--tests/ui/proc-macro/inner-attr-non-inline-mod.rs5
-rw-r--r--tests/ui/proc-macro/inner-attr-non-inline-mod.stderr4
-rw-r--r--tests/ui/proc-macro/inner-attr-non-inline-mod.stdout30
-rw-r--r--tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr3
-rw-r--r--tests/ui/proc-macro/no-macro-use-attr.rs5
-rw-r--r--tests/ui/proc-macro/no-macro-use-attr.stderr8
-rw-r--r--tests/ui/proc-macro/nodelim-groups.rs13
-rw-r--r--tests/ui/proc-macro/nodelim-groups.stdout15
-rw-r--r--tests/ui/proc-macro/nonterminal-token-hygiene.stdout20
-rw-r--r--tests/ui/proc-macro/pretty-print-hack-show.rs2
-rw-r--r--tests/ui/proc-macro/quote/not-quotable.stderr1
-rw-r--r--tests/ui/range/range_traits-1.stderr18
-rw-r--r--tests/ui/range/range_traits-2.stderr2
-rw-r--r--tests/ui/range/range_traits-3.stderr2
-rw-r--r--tests/ui/range/range_traits-6.stderr2
-rw-r--r--tests/ui/resolve/multiple_definitions_attribute_merging.stderr4
-rw-r--r--tests/ui/resolve/parse-error-resolve.rs2
-rw-r--r--tests/ui/resolve/proc_macro_generated_packed.stderr4
-rw-r--r--tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.no_gate.stderr2
-rw-r--r--tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.rs6
-rw-r--r--tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.with_gate.stderr8
-rw-r--r--tests/ui/rfcs/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr1
-rw-r--r--tests/ui/rfcs/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.rs2
-rw-r--r--tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.rs13
-rw-r--r--tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr53
-rw-r--r--tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.rs7
-rw-r--r--tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.stderr6
-rw-r--r--tests/ui/rmeta/no_optitimized_mir.rs2
-rw-r--r--tests/ui/rmeta/rmeta_bin-pass.rs14
-rw-r--r--tests/ui/rmeta/rmeta_bin.rs14
-rw-r--r--tests/ui/rmeta/rmeta_bin.stderr4
-rw-r--r--tests/ui/runtime/on-broken-pipe/auxiliary/assert-sigpipe-disposition.rs9
-rw-r--r--tests/ui/runtime/on-broken-pipe/auxiliary/sigpipe-utils.rs9
-rw-r--r--tests/ui/runtime/on-broken-pipe/default.rs2
-rw-r--r--tests/ui/runtime/on-broken-pipe/no-flag-arg.rs2
-rw-r--r--tests/ui/runtime/on-broken-pipe/wrong-flag-arg.rs2
-rw-r--r--tests/ui/runtime/signal-alternate-stack-cleanup.rs9
-rw-r--r--tests/ui/rust-2021/ice-return-unsized-can-impl-2.stderr4
-rw-r--r--tests/ui/rust-2021/ice-return-unsized-can-impl.stderr2
-rw-r--r--tests/ui/rust-2021/ice-unsized-fn-params-2.stderr2
-rw-r--r--tests/ui/rust-2021/ice-unsized-fn-params.stderr4
-rw-r--r--tests/ui/rustc-env/min-stack-banana.rs3
-rw-r--r--tests/ui/rustc-error.rs6
-rw-r--r--tests/ui/rustc-error.stderr8
-rw-r--r--tests/ui/rustdoc/doc-alias-use-item-list-stem.rs11
-rw-r--r--tests/ui/sanitizer/cfi/canonical-jump-tables-requires-cfi.rs2
-rw-r--r--tests/ui/sanitizer/cfi/generalize-pointers-requires-cfi.rs2
-rw-r--r--tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.rs3
-rw-r--r--tests/ui/sanitizer/cfi/normalize-integers-requires-cfi.rs2
-rw-r--r--tests/ui/sanitizer/cfi/requires-lto.rs2
-rw-r--r--tests/ui/sanitizer/cfi/with-rustc-lto-requires-single-codegen-unit.rs2
-rw-r--r--tests/ui/sanitizer/crt-static.rs2
-rw-r--r--tests/ui/sanitizer/split-lto-unit-requires-lto.rs2
-rw-r--r--tests/ui/self/arbitrary-self-opaque.rs1
-rw-r--r--tests/ui/self/arbitrary-self-opaque.stderr10
-rw-r--r--tests/ui/self/dyn-dispatch-requires-supertrait-norm.rs38
-rw-r--r--tests/ui/self/dyn-dispatch-requires-supertrait.rs38
-rw-r--r--tests/ui/simd/array-trait.stderr2
-rw-r--r--tests/ui/simd/const-err-trumps-simd-err.stderr2
-rw-r--r--tests/ui/sized/dont-incompletely-prefer-built-in.rs21
-rw-r--r--tests/ui/span/E0204.stderr4
-rw-r--r--tests/ui/span/range-2.rs4
-rw-r--r--tests/ui/span/regionck-unboxed-closure-lifetimes.rs3
-rw-r--r--tests/ui/span/regionck-unboxed-closure-lifetimes.stderr2
-rw-r--r--tests/ui/specialization/min_specialization/impl-on-opaque.rs1
-rw-r--r--tests/ui/specialization/min_specialization/impl-on-opaque2.rs1
-rw-r--r--tests/ui/stability-attribute/check-stability-issue-138319.rs39
-rw-r--r--tests/ui/stability-attribute/check-stability-issue-138319.stderr10
-rw-r--r--tests/ui/stable-mir-print/async-closure.stdout2
-rw-r--r--tests/ui/stack-protector/warn-stack-protector-unsupported.rs4
-rw-r--r--tests/ui/statics/issue-14227.stderr2
-rw-r--r--tests/ui/stats/input-stats.stderr6
-rw-r--r--tests/ui/std/channel-stack-overflow-issue-102246.rs20
-rw-r--r--tests/ui/structs/default-field-values/failures.stderr1
-rw-r--r--tests/ui/structs/default-field-values/invalid-const.stderr2
-rw-r--r--tests/ui/structs/struct-construct-with-call-issue-138931.rs25
-rw-r--r--tests/ui/structs/struct-construct-with-call-issue-138931.stderr58
-rw-r--r--tests/ui/suggestions/attribute-typos.rs4
-rw-r--r--tests/ui/suggestions/attribute-typos.stderr10
-rw-r--r--tests/ui/suggestions/derive-clone-for-eq.stderr1
-rw-r--r--tests/ui/suggestions/derive-macro-missing-bounds.stderr5
-rw-r--r--tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021-without-dyn.stderr6
-rw-r--r--tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr3
-rw-r--r--tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr3
-rw-r--r--tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr6
-rw-r--r--tests/ui/suggestions/tuple-struct-where-clause-suggestion-91520.rs17
-rw-r--r--tests/ui/suggestions/tuple-struct-where-clause-suggestion-91520.stderr21
-rw-r--r--tests/ui/symbol-mangling-version/bad-value.rs4
-rw-r--r--tests/ui/symbol-mangling-version/unstable.rs3
-rw-r--r--tests/ui/target-feature/allowed-softfloat-target-feature-flag-disable.rs2
-rw-r--r--tests/ui/target-feature/invalid-attribute.stderr12
-rw-r--r--tests/ui/target-feature/missing-plusminus-2.rs2
-rw-r--r--tests/ui/target-feature/missing-plusminus.rs2
-rw-r--r--tests/ui/target-feature/similar-feature-suggestion.rs2
-rw-r--r--tests/ui/target-feature/tied-features-cli.rs4
-rw-r--r--tests/ui/target-feature/tied-features-no-implication-1.rs2
-rw-r--r--tests/ui/target-feature/unstable-feature.rs2
-rw-r--r--tests/ui/target_modifiers/auxiliary/enabled_reg_struct_return.rs7
-rw-r--r--tests/ui/target_modifiers/defaults_check.error.stderr4
-rw-r--r--tests/ui/target_modifiers/incompatible_regparm.rs2
-rw-r--r--tests/ui/target_modifiers/no_value_bool.error.stderr13
-rw-r--r--tests/ui/target_modifiers/no_value_bool.error_explicit.stderr13
-rw-r--r--tests/ui/target_modifiers/no_value_bool.rs22
-rw-r--r--tests/ui/test-attrs/custom-test-frameworks/issue-107454.stderr1
-rw-r--r--tests/ui/test-attrs/issue-12997-2.stderr1
-rw-r--r--tests/ui/test-attrs/test-function-signature.stderr1
-rw-r--r--tests/ui/thread-local/spawn-hook-atexit.rs24
-rw-r--r--tests/ui/tool-attributes/crate-attr.rs5
-rw-r--r--tests/ui/tool-attributes/duplicate-diagnostic.rs7
-rw-r--r--tests/ui/tool-attributes/duplicate-diagnostic.stderr2
-rw-r--r--tests/ui/tool-attributes/multiple-registered.rs7
-rw-r--r--tests/ui/tool-attributes/nested-disallowed.rs4
-rw-r--r--tests/ui/tool-attributes/nested-disallowed.stderr8
-rw-r--r--tests/ui/traits/alias/issue-83613.rs1
-rw-r--r--tests/ui/traits/alias/issue-83613.stderr2
-rw-r--r--tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr1
-rw-r--r--tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.stderr2
-rw-r--r--tests/ui/traits/const-traits/const_derives/derive-const-use.stderr6
-rw-r--r--tests/ui/traits/const-traits/const_derives/derive-const-with-params.stderr2
-rw-r--r--tests/ui/traits/const-traits/feature-gate.gated.stderr8
-rw-r--r--tests/ui/traits/const-traits/feature-gate.rs5
-rw-r--r--tests/ui/traits/incomplete-infer-via-sized-wc.current.stderr9
-rw-r--r--tests/ui/traits/incomplete-infer-via-sized-wc.next.stderr9
-rw-r--r--tests/ui/traits/incomplete-infer-via-sized-wc.rs19
-rw-r--r--tests/ui/traits/inductive-overflow/supertrait-auto-trait.rs2
-rw-r--r--tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr29
-rw-r--r--tests/ui/traits/issue-106072.stderr3
-rw-r--r--tests/ui/traits/issue-50480.stderr6
-rw-r--r--tests/ui/traits/issue-71136.stderr1
-rw-r--r--tests/ui/traits/issue-79458.stderr1
-rw-r--r--tests/ui/traits/lifetime-incomplete-prefer-sized-builtin-over-wc-2.rs28
-rw-r--r--tests/ui/traits/lifetime-incomplete-prefer-sized-builtin-over-wc.current.stderr27
-rw-r--r--tests/ui/traits/lifetime-incomplete-prefer-sized-builtin-over-wc.next.stderr25
-rw-r--r--tests/ui/traits/lifetime-incomplete-prefer-sized-builtin-over-wc.rs26
-rw-r--r--tests/ui/traits/next-solver/alias-relate/tait-eq-proj-2.rs3
-rw-r--r--tests/ui/traits/next-solver/alias-relate/tait-eq-proj.rs3
-rw-r--r--tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.rs8
-rw-r--r--tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr16
-rw-r--r--tests/ui/traits/next-solver/cycles/cyclic-normalization-to-error-nalgebra.rs21
-rw-r--r--tests/ui/traits/next-solver/cycles/unproductive-in-coherence.rs21
-rw-r--r--tests/ui/traits/next-solver/cycles/unproductive-in-coherence.stderr11
-rw-r--r--tests/ui/traits/next-solver/global-cache-and-parallel-frontend.stderr1
-rw-r--r--tests/ui/traits/next-solver/opaques/dont-remap-tait-substs.rs3
-rw-r--r--tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.is_send.stderr2
-rw-r--r--tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.not_send.stderr2
-rw-r--r--tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.rs4
-rw-r--r--tests/ui/traits/next-solver/opaques/no-define-in-wf-check.current.stderr14
-rw-r--r--tests/ui/traits/next-solver/opaques/no-define-in-wf-check.rs4
-rw-r--r--tests/ui/traits/next-solver/overflow/recursive-self-normalization-2.rs7
-rw-r--r--tests/ui/traits/next-solver/overflow/recursive-self-normalization-2.stderr54
-rw-r--r--tests/ui/traits/next-solver/overflow/recursive-self-normalization.rs7
-rw-r--r--tests/ui/traits/next-solver/overflow/recursive-self-normalization.stderr54
-rw-r--r--tests/ui/traits/next-solver/well-formed-in-relate.rs21
-rw-r--r--tests/ui/traits/next-solver/well-formed-in-relate.stderr27
-rw-r--r--tests/ui/traits/pointee-tail-is-generic-errors.rs1
-rw-r--r--tests/ui/traits/pointee-tail-is-generic-errors.stderr8
-rw-r--r--tests/ui/traits/pointee-tail-is-generic.rs11
-rw-r--r--tests/ui/traits/trait-upcasting/type-checking-test-4.stderr4
-rw-r--r--tests/ui/traits/trait-upcasting/type-checking-test-opaques.rs1
-rw-r--r--tests/ui/traits/trait-upcasting/upcast-defining-opaque.rs1
-rw-r--r--tests/ui/transmutability/malformed-program-gracefulness/coherence-bikeshed-intrinsic-from.stderr2
-rw-r--r--tests/ui/transmutability/uninhabited.stderr6
-rw-r--r--tests/ui/treat-err-as-bug/span_delayed_bug.rs2
-rw-r--r--tests/ui/treat-err-as-bug/span_delayed_bug.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/argument-types.rs19
-rw-r--r--tests/ui/type-alias-impl-trait/assoc-projection-ice.rs24
-rw-r--r--tests/ui/type-alias-impl-trait/associated-type-alias-impl-trait.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/auto-trait-leakage.rs11
-rw-r--r--tests/ui/type-alias-impl-trait/auto-trait-leakage2.rs17
-rw-r--r--tests/ui/type-alias-impl-trait/auto-trait-leakage2.stderr18
-rw-r--r--tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs4
-rw-r--r--tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr22
-rw-r--r--tests/ui/type-alias-impl-trait/auxiliary/cross_crate_ice.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/auxiliary/drop-shim-relates-opaque-aux.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/bad-tait-no-substs.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/bad-tait-no-substs.stderr22
-rw-r--r--tests/ui/type-alias-impl-trait/bivariant-duplicate-lifetime-unconstrained.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/bound-lifetime-through-dyn-trait.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/bound-lifetime-through-dyn-trait.stderr6
-rw-r--r--tests/ui/type-alias-impl-trait/bound_reduction.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/bound_reduction2.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/bound_reduction2.stderr14
-rw-r--r--tests/ui/type-alias-impl-trait/bounds-are-checked-2.rs12
-rw-r--r--tests/ui/type-alias-impl-trait/bounds-are-checked-2.stderr22
-rw-r--r--tests/ui/type-alias-impl-trait/bounds-are-checked.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/bounds-are-checked.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/bounds-are-checked3.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/bounds.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/closure-normalization-ice-109020.rs10
-rw-r--r--tests/ui/type-alias-impl-trait/closure_args.rs24
-rw-r--r--tests/ui/type-alias-impl-trait/closure_args2.rs34
-rw-r--r--tests/ui/type-alias-impl-trait/closure_infer.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/closure_parent_substs.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/closure_wf_outlives.rs4
-rw-r--r--tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr16
-rw-r--r--tests/ui/type-alias-impl-trait/closures_in_branches.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/closures_in_branches.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/coherence.classic.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/coherence.next.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/coherence.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/coherence_cross_crate.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/coherence_cross_crate.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/coherence_different_hidden_ty.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/coherence_generalization.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/const_generic_type.infer.stderr6
-rw-r--r--tests/ui/type-alias-impl-trait/const_generic_type.no_infer.stderr35
-rw-r--r--tests/ui/type-alias-impl-trait/const_generic_type.rs4
-rw-r--r--tests/ui/type-alias-impl-trait/constrain_in_projection.current.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/constrain_in_projection.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/constrain_in_projection2.current.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/constrain_in_projection2.next.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/constrain_in_projection2.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/constrain_inputs.rs5
-rw-r--r--tests/ui/type-alias-impl-trait/constrain_inputs.stderr30
-rw-r--r--tests/ui/type-alias-impl-trait/constrain_inputs_unsound.rs5
-rw-r--r--tests/ui/type-alias-impl-trait/constrain_inputs_unsound.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/debug-ty-with-weak.rs10
-rw-r--r--tests/ui/type-alias-impl-trait/declared_but_never_defined.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/declared_but_not_defined_in_scope.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/define_opaques_attr/foreign_type.rs5
-rw-r--r--tests/ui/type-alias-impl-trait/define_opaques_attr/foreign_type.stderr8
-rw-r--r--tests/ui/type-alias-impl-trait/define_opaques_attr/generics.rs12
-rw-r--r--tests/ui/type-alias-impl-trait/define_opaques_attr/generics.stderr22
-rw-r--r--tests/ui/type-alias-impl-trait/define_opaques_attr/invalid-extern-fn-body.rs11
-rw-r--r--tests/ui/type-alias-impl-trait/define_opaques_attr/invalid-extern-fn-body.stderr20
-rw-r--r--tests/ui/type-alias-impl-trait/define_opaques_attr/invalid_path.rs5
-rw-r--r--tests/ui/type-alias-impl-trait/define_opaques_attr/invalid_path.stderr9
-rw-r--r--tests/ui/type-alias-impl-trait/define_opaques_attr/missing_parens.rs5
-rw-r--r--tests/ui/type-alias-impl-trait/define_opaques_attr/missing_parens.stderr8
-rw-r--r--tests/ui/type-alias-impl-trait/define_opaques_attr/no_opaque.rs7
-rw-r--r--tests/ui/type-alias-impl-trait/define_opaques_attr/no_opaque.stderr8
-rw-r--r--tests/ui/type-alias-impl-trait/define_opaques_attr/non_type.rs7
-rw-r--r--tests/ui/type-alias-impl-trait/define_opaques_attr/non_type.stderr9
-rw-r--r--tests/ui/type-alias-impl-trait/defined-by-user-annotation.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/defined-in-closure-external-lifetime.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/defined-in-closure-external-lifetime.stderr8
-rw-r--r--tests/ui/type-alias-impl-trait/defining-use-submodule.rs11
-rw-r--r--tests/ui/type-alias-impl-trait/destructure_tait-ice-113594.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/different_args_considered_equal.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/different_args_considered_equal.stderr8
-rw-r--r--tests/ui/type-alias-impl-trait/different_args_considered_equal2.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/different_args_considered_equal2.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/different_args_considered_equal3.rs10
-rw-r--r--tests/ui/type-alias-impl-trait/different_args_considered_equal3.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/different_defining_uses.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/different_defining_uses.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.stderr8
-rw-r--r--tests/ui/type-alias-impl-trait/different_defining_uses_never_type-3.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/different_defining_uses_never_type-3.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/different_defining_uses_never_type.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/different_defining_uses_never_type.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/different_defining_uses_never_type2.rs5
-rw-r--r--tests/ui/type-alias-impl-trait/different_defining_uses_never_type3.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/different_defining_uses_never_type3.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/drop-analysis-on-unconstrained-tait.rs36
-rw-r--r--tests/ui/type-alias-impl-trait/drop-analysis-on-unconstrained-tait.stderr8
-rw-r--r--tests/ui/type-alias-impl-trait/duplicate-lifetimes-from-rpit-containing-tait.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/equal-lifetime-params-not-ok.rs5
-rw-r--r--tests/ui/type-alias-impl-trait/equal-lifetime-params-not-ok.stderr25
-rw-r--r--tests/ui/type-alias-impl-trait/equal-lifetime-params-ok.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/error-tainting-issue-122904.rs18
-rw-r--r--tests/ui/type-alias-impl-trait/error-tainting-issue-122904.stderr30
-rw-r--r--tests/ui/type-alias-impl-trait/escaping-bound-var.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/failed-to-normalize-ice-99945.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/failed-to-normalize-ice-99945.stderr36
-rw-r--r--tests/ui/type-alias-impl-trait/fallback.rs5
-rw-r--r--tests/ui/type-alias-impl-trait/fallback.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/field-types.rs4
-rw-r--r--tests/ui/type-alias-impl-trait/future.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/future.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/generic-not-strictly-equal.basic.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/generic-not-strictly-equal.member_constraints.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/generic-not-strictly-equal.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/generic_different_defining_uses.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/generic_different_defining_uses.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr14
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_param_use.rs6
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_param_use.stderr38
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_param_use10.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_param_use3.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_param_use3.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_param_use5.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_param_use5.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_param_use6.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_param_use6.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_param_use7.rs4
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_param_use8.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_param_use8.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_param_use9.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_param_use9.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/generic_lifetime_param.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/generic_nondefining_use.rs6
-rw-r--r--tests/ui/type-alias-impl-trait/generic_nondefining_use.stderr38
-rw-r--r--tests/ui/type-alias-impl-trait/generic_not_used.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/generic_not_used.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/generic_underconstrained.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/generic_underconstrained.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/generic_underconstrained2.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr12
-rw-r--r--tests/ui/type-alias-impl-trait/hidden_behind_projection_behind_struct_field.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/hidden_behind_projection_behind_struct_field.stderr19
-rw-r--r--tests/ui/type-alias-impl-trait/hidden_behind_struct_field2.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/hidden_behind_struct_field2.stderr19
-rw-r--r--tests/ui/type-alias-impl-trait/hidden_behind_struct_field3.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/hidden_behind_struct_field3.stderr17
-rw-r--r--tests/ui/type-alias-impl-trait/hidden_type_mismatch.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/hidden_type_mismatch.stderr10
-rw-r--r--tests/ui/type-alias-impl-trait/higher_kinded_params.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/higher_kinded_params2.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/higher_kinded_params2.stderr20
-rw-r--r--tests/ui/type-alias-impl-trait/higher_kinded_params3.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/higher_kinded_params3.stderr11
-rw-r--r--tests/ui/type-alias-impl-trait/hkl_forbidden.rs5
-rw-r--r--tests/ui/type-alias-impl-trait/hkl_forbidden.stderr14
-rw-r--r--tests/ui/type-alias-impl-trait/hkl_forbidden2.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/hkl_forbidden2.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/hkl_forbidden3.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/hkl_forbidden3.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/hkl_forbidden4.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr45
-rw-r--r--tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.stderr10
-rw-r--r--tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.stderr10
-rw-r--r--tests/ui/type-alias-impl-trait/impl_for_weak_alias.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/impl_trait_for_generic_tait.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/impl_trait_for_same_tait.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/impl_trait_for_same_tait.stderr6
-rw-r--r--tests/ui/type-alias-impl-trait/impl_trait_for_tait.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound.rs13
-rw-r--r--tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound.stderr6
-rw-r--r--tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound2.rs7
-rw-r--r--tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound2.stderr6
-rw-r--r--tests/ui/type-alias-impl-trait/impl_trait_in_trait_defined_outside_trait.stderr10
-rw-r--r--tests/ui/type-alias-impl-trait/implied_bounds.rs9
-rw-r--r--tests/ui/type-alias-impl-trait/implied_bounds.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/implied_bounds2.rs10
-rw-r--r--tests/ui/type-alias-impl-trait/implied_bounds_from_types.rs9
-rw-r--r--tests/ui/type-alias-impl-trait/implied_bounds_from_types.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/implied_lifetime_wf_check.error.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/implied_lifetime_wf_check.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs13
-rw-r--r--tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr8
-rw-r--r--tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.rs14
-rw-r--r--tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr24
-rw-r--r--tests/ui/type-alias-impl-trait/imply_bounds_from_bounds.rs20
-rw-r--r--tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.stderr10
-rw-r--r--tests/ui/type-alias-impl-trait/in-where-clause.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/in-where-clause.stderr6
-rw-r--r--tests/ui/type-alias-impl-trait/incomplete-inference.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/incomplete-inference.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/inference-cycle.rs28
-rw-r--r--tests/ui/type-alias-impl-trait/inference-cycle.stderr22
-rw-r--r--tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.rs5
-rw-r--r--tests/ui/type-alias-impl-trait/invalid_impl_trait_in_assoc_ty.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/invalid_impl_trait_in_assoc_ty.stderr19
-rw-r--r--tests/ui/type-alias-impl-trait/issue-101750.rs17
-rw-r--r--tests/ui/type-alias-impl-trait/issue-104817.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/issue-104817.stock.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/issue-109054.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/issue-109054.stderr10
-rw-r--r--tests/ui/type-alias-impl-trait/issue-52843-closure-constrain.rs13
-rw-r--r--tests/ui/type-alias-impl-trait/issue-52843-closure-constrain.stderr14
-rw-r--r--tests/ui/type-alias-impl-trait/issue-52843.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/issue-52843.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/issue-53092-2.rs8
-rw-r--r--tests/ui/type-alias-impl-trait/issue-53092-2.stderr40
-rw-r--r--tests/ui/type-alias-impl-trait/issue-53092.rs11
-rw-r--r--tests/ui/type-alias-impl-trait/issue-53092.stderr16
-rw-r--r--tests/ui/type-alias-impl-trait/issue-53096.rs16
-rw-r--r--tests/ui/type-alias-impl-trait/issue-53096.stderr8
-rw-r--r--tests/ui/type-alias-impl-trait/issue-53678-coroutine-and-const-fn.rs19
-rw-r--r--tests/ui/type-alias-impl-trait/issue-55099-lifetime-inference.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/issue-57961.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/issue-58662-coroutine-with-lifetime.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/issue-58662-simplified.rs5
-rw-r--r--tests/ui/type-alias-impl-trait/issue-58951-2.rs10
-rw-r--r--tests/ui/type-alias-impl-trait/issue-58951.rs11
-rw-r--r--tests/ui/type-alias-impl-trait/issue-60407.rs16
-rw-r--r--tests/ui/type-alias-impl-trait/issue-60407.stderr8
-rw-r--r--tests/ui/type-alias-impl-trait/issue-60564.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/issue-60564.stderr14
-rw-r--r--tests/ui/type-alias-impl-trait/issue-63263-closure-return.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/issue-63279.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/issue-63279.stderr12
-rw-r--r--tests/ui/type-alias-impl-trait/issue-63355.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/issue-63355.stderr10
-rw-r--r--tests/ui/type-alias-impl-trait/issue-63677-type-alias-coherence.rs5
-rw-r--r--tests/ui/type-alias-impl-trait/issue-65384.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.rs23
-rw-r--r--tests/ui/type-alias-impl-trait/issue-65918.rs12
-rw-r--r--tests/ui/type-alias-impl-trait/issue-66580-closure-coherence.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/issue-67844-nested-opaque.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.rs4
-rw-r--r--tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.stderr18
-rw-r--r--tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.stderr18
-rw-r--r--tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-ok.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/issue-69323.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/issue-70121.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/issue-70121.stderr6
-rw-r--r--tests/ui/type-alias-impl-trait/issue-72793.rs25
-rw-r--r--tests/ui/type-alias-impl-trait/issue-74244.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/issue-74280.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/issue-74280.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/issue-76202-trait-impl-for-tait.rs29
-rw-r--r--tests/ui/type-alias-impl-trait/issue-77179.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/issue-77179.stderr40
-rw-r--r--tests/ui/type-alias-impl-trait/issue-84660-trait-impl-for-tait.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/issue-84660-unsoundness.current.stderr10
-rw-r--r--tests/ui/type-alias-impl-trait/issue-84660-unsoundness.next.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/issue-84660-unsoundness.rs4
-rw-r--r--tests/ui/type-alias-impl-trait/issue-89686.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/issue-89686.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/issue-93411.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/itiat-forbid-nested-items.stderr5
-rw-r--r--tests/ui/type-alias-impl-trait/lazy_subtyping_of_opaques.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/lazy_subtyping_of_opaques.stderr6
-rw-r--r--tests/ui/type-alias-impl-trait/lifetime_mismatch.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/lifetime_mismatch.stderr8
-rw-r--r--tests/ui/type-alias-impl-trait/method_resolution.current.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/method_resolution.next.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/method_resolution.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/method_resolution2.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/method_resolution3.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/method_resolution4.current.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/method_resolution4.next.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/method_resolution4.rs10
-rw-r--r--tests/ui/type-alias-impl-trait/method_resolution5.rs8
-rw-r--r--tests/ui/type-alias-impl-trait/method_resolution_trait_method_from_opaque.current.stderr8
-rw-r--r--tests/ui/type-alias-impl-trait/method_resolution_trait_method_from_opaque.next.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/method_resolution_trait_method_from_opaque.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/missing_lifetime_bound.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr6
-rw-r--r--tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-infer.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-infer.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-pass.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn2.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn2.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn3.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn3.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/nested-in-anon-const.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/nested-tait-hrtb.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/nested-tait-hrtb.stderr7
-rw-r--r--tests/ui/type-alias-impl-trait/nested-tait-inference.current.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/nested-tait-inference.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/nested-tait-inference2.current.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/nested-tait-inference2.next.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/nested-tait-inference2.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/nested-tait-inference3.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/nested-tait-inference3.stderr8
-rw-r--r--tests/ui/type-alias-impl-trait/nested.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/nested.stderr10
-rw-r--r--tests/ui/type-alias-impl-trait/nested_inference_failure.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/nested_type_alias_impl_trait.rs24
-rw-r--r--tests/ui/type-alias-impl-trait/nested_type_alias_impl_trait.stderr36
-rw-r--r--tests/ui/type-alias-impl-trait/never_reveal_concrete_type.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.rs15
-rw-r--r--tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.stderr18
-rw-r--r--tests/ui/type-alias-impl-trait/no_revealing_outside_defining_module.rs13
-rw-r--r--tests/ui/type-alias-impl-trait/no_revealing_outside_defining_module.stderr26
-rw-r--r--tests/ui/type-alias-impl-trait/normalize-alias-type.rs15
-rw-r--r--tests/ui/type-alias-impl-trait/normalize-hidden-types.current.stderr14
-rw-r--r--tests/ui/type-alias-impl-trait/normalize-hidden-types.rs5
-rw-r--r--tests/ui/type-alias-impl-trait/not-matching-trait-refs-isnt-defining.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/not-matching-trait-refs-isnt-defining.stderr17
-rw-r--r--tests/ui/type-alias-impl-trait/not_a_defining_use.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/not_a_defining_use.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/not_well_formed.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/obligation_ice.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/outlives-bound-var.rs8
-rw-r--r--tests/ui/type-alias-impl-trait/param_mismatch.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/param_mismatch.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/param_mismatch2.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/param_mismatch2.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/param_mismatch3.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/param_mismatch3.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/param_mismatch4.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/param_mismatch4.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/path_resolution_taint.rs16
-rw-r--r--tests/ui/type-alias-impl-trait/path_resolution_taint.stderr9
-rw-r--r--tests/ui/type-alias-impl-trait/privacy.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/privacy.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/recursive-fn-tait.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr6
-rw-r--r--tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.rs6
-rw-r--r--tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.stderr8
-rw-r--r--tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn.rs25
-rw-r--r--tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn.stderr12
-rw-r--r--tests/ui/type-alias-impl-trait/reveal_local.rs7
-rw-r--r--tests/ui/type-alias-impl-trait/reveal_local.stderr22
-rw-r--r--tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.rs15
-rw-r--r--tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query_2.rs12
-rw-r--r--tests/ui/type-alias-impl-trait/self-referential-2.current.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/self-referential-2.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/self-referential-3.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/self-referential-3.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/self-referential-4.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/self-referential-4.stderr6
-rw-r--r--tests/ui/type-alias-impl-trait/self-referential.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/self-referential.stderr6
-rw-r--r--tests/ui/type-alias-impl-trait/self_implication.rs9
-rw-r--r--tests/ui/type-alias-impl-trait/static-const-types.rs13
-rw-r--r--tests/ui/type-alias-impl-trait/structural-match-no-leak.rs16
-rw-r--r--tests/ui/type-alias-impl-trait/structural-match-no-leak.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/structural-match.rs17
-rw-r--r--tests/ui/type-alias-impl-trait/structural-match.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/taint.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/taint.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/tait-in-function-return-type-issue-101903-fixed.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/tait-param-inference-issue-117310.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/type-alias-impl-trait-assoc-dyn.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/type-alias-impl-trait-assoc-impl-trait.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/type-alias-impl-trait-const.rs8
-rw-r--r--tests/ui/type-alias-impl-trait/type-alias-impl-trait-fns.rs4
-rw-r--r--tests/ui/type-alias-impl-trait/type-alias-impl-trait-fns.stderr10
-rw-r--r--tests/ui/type-alias-impl-trait/type-alias-impl-trait-sized.rs4
-rw-r--r--tests/ui/type-alias-impl-trait/type-alias-impl-trait-struct.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/type-alias-impl-trait-tuple.rs15
-rw-r--r--tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-1.stderr11
-rw-r--r--tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-2.stderr11
-rw-r--r--tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-3.stderr11
-rw-r--r--tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-no-traits.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-no-traits.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/type-alias-impl-trait.rs20
-rw-r--r--tests/ui/type-alias-impl-trait/type-alias-impl-trait2.rs105
-rw-r--r--tests/ui/type-alias-impl-trait/type-alias-nested-impl-trait.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/type_of_a_let.current.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/type_of_a_let.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/unbounded_opaque_type.rs9
-rw-r--r--tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/unconstrained-impl-param.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/unconstrained-impl-param.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/under-binder.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/under-binder.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/underconstrained_generic.rs5
-rw-r--r--tests/ui/type-alias-impl-trait/underconstrained_generic.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/underconstrained_lifetime.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/underconstrained_lifetime.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.stderr14
-rw-r--r--tests/ui/type-alias-impl-trait/unnameable_type.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/unnameable_type.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/unused_generic_param.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/variance.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/variance.stderr10
-rw-r--r--tests/ui/type-alias-impl-trait/weird-return-types.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/wf-check-definition-site.rs6
-rw-r--r--tests/ui/type-alias-impl-trait/wf-check-fn-def.rs5
-rw-r--r--tests/ui/type-alias-impl-trait/wf-check-fn-def.stderr6
-rw-r--r--tests/ui/type-alias-impl-trait/wf-check-fn-ptrs.rs5
-rw-r--r--tests/ui/type-alias-impl-trait/wf-nested.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/wf-nested.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/wf_check_closures.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/wf_check_closures.stderr8
-rw-r--r--tests/ui/type/pattern_types/derives.stderr2
-rw-r--r--tests/ui/type/pattern_types/literals.rs139
-rw-r--r--tests/ui/type/pattern_types/literals.stderr193
-rw-r--r--tests/ui/type/pattern_types/nested.rs4
-rw-r--r--tests/ui/type/pattern_types/nested.stderr9
-rw-r--r--tests/ui/type/pattern_types/range_patterns.rs25
-rw-r--r--tests/ui/type/pattern_types/range_patterns.stderr117
-rw-r--r--tests/ui/type/pattern_types/validity.rs2
-rw-r--r--tests/ui/type/pattern_types/validity.stderr26
-rw-r--r--tests/ui/typeck/cyclic_type_ice.stderr2
-rw-r--r--tests/ui/typeck/typeck_type_placeholder_item.rs1
-rw-r--r--tests/ui/typeck/typeck_type_placeholder_item.stderr42
-rw-r--r--tests/ui/uninhabited/auxiliary/staged-api.rs8
-rw-r--r--tests/ui/uninhabited/uninhabited-pin-field.rs10
-rw-r--r--tests/ui/uninhabited/uninhabited-pin-field.stderr19
-rw-r--r--tests/ui/uninhabited/uninhabited-unstable-field.current.stderr22
-rw-r--r--tests/ui/uninhabited/uninhabited-unstable-field.exhaustive.stderr22
-rw-r--r--tests/ui/uninhabited/uninhabited-unstable-field.rs29
-rw-r--r--tests/ui/union/union-derive-clone.stderr1
-rw-r--r--tests/ui/union/union-derive-eq.current.stderr1
-rw-r--r--tests/ui/union/union-derive-eq.next.stderr1
-rw-r--r--tests/ui/unpretty/avoid-crash.rs2
-rw-r--r--tests/ui/unpretty/deprecated-attr.rs2
-rw-r--r--tests/ui/unpretty/deprecated-attr.stdout21
-rw-r--r--tests/ui/variance/variance-uniquearc.rs27
-rw-r--r--tests/ui/variance/variance-uniquearc.stderr15
-rw-r--r--tests/ui/variance/variance-uniquerc.rs2
-rw-r--r--tests/ui/write-fmt-errors.rs4
1655 files changed, 12510 insertions, 6491 deletions
diff --git a/tests/assembly/cstring-merging.rs b/tests/assembly/cstring-merging.rs
new file mode 100644
index 00000000000..7436e241823
--- /dev/null
+++ b/tests/assembly/cstring-merging.rs
@@ -0,0 +1,27 @@
+//@ only-linux
+//@ assembly-output: emit-asm
+//@ compile-flags: --crate-type=lib -Copt-level=3 --edition 2024
+
+use std::ffi::CStr;
+
+// CHECK: .section .rodata.str1.1,"aMS"
+// CHECK: .Lanon.{{.+}}:
+// CHECK-NEXT: .asciz "foo"
+#[unsafe(no_mangle)]
+static CSTR: &[u8; 4] = b"foo\0";
+
+// CHECK-NOT: .section
+// CHECK: .Lanon.{{.+}}:
+// CHECK-NEXT: .asciz "bar"
+#[unsafe(no_mangle)]
+pub fn cstr() -> &'static CStr {
+    c"bar"
+}
+
+// CHECK-NOT: .section
+// CHECK: .Lanon.{{.+}}:
+// CHECK-NEXT: .asciz "baz"
+#[unsafe(no_mangle)]
+pub fn manual_cstr() -> &'static str {
+    "baz\0"
+}
diff --git a/tests/assembly/aarch64-naked-fn-no-bti-prolog.rs b/tests/assembly/naked-functions/aarch64-naked-fn-no-bti-prolog.rs
index 46e627eaa00..46e627eaa00 100644
--- a/tests/assembly/aarch64-naked-fn-no-bti-prolog.rs
+++ b/tests/assembly/naked-functions/aarch64-naked-fn-no-bti-prolog.rs
diff --git a/tests/assembly/naked-functions/aix.rs b/tests/assembly/naked-functions/aix.rs
new file mode 100644
index 00000000000..cc0825b3738
--- /dev/null
+++ b/tests/assembly/naked-functions/aix.rs
@@ -0,0 +1,35 @@
+//@ revisions: elfv1-be aix
+//@ add-core-stubs
+//@ assembly-output: emit-asm
+//
+//@[elfv1-be] compile-flags: --target powerpc64-unknown-linux-gnu
+//@[elfv1-be] needs-llvm-components: powerpc
+//
+//@[aix] compile-flags: --target powerpc64-ibm-aix
+//@[aix] needs-llvm-components: powerpc
+
+#![crate_type = "lib"]
+#![feature(no_core, naked_functions, asm_experimental_arch, f128, linkage, fn_align)]
+#![no_core]
+
+// tests that naked functions work for the `powerpc64-ibm-aix` target.
+//
+// This target is special because it uses the XCOFF binary format
+// It is tested alongside an elf powerpc target to pin down commonalities and differences.
+//
+// https://doc.rust-lang.org/rustc/platform-support/aix.html
+// https://www.ibm.com/docs/en/aix/7.2?topic=formats-xcoff-object-file-format
+
+extern crate minicore;
+use minicore::*;
+
+// elfv1-be: .p2align 2
+// aix: .align 2
+// CHECK: .globl blr
+// CHECK-LABEL: blr:
+// CHECK: blr
+#[no_mangle]
+#[naked]
+unsafe extern "C" fn blr() {
+    naked_asm!("blr")
+}
diff --git a/tests/assembly/wasm32-naked-fn.rs b/tests/assembly/naked-functions/wasm32.rs
index 4911a6bd08f..4911a6bd08f 100644
--- a/tests/assembly/wasm32-naked-fn.rs
+++ b/tests/assembly/naked-functions/wasm32.rs
diff --git a/tests/assembly/x86_64-naked-fn-no-cet-prolog.rs b/tests/assembly/naked-functions/x86_64-naked-fn-no-cet-prolog.rs
index 54e1d93c68b..54e1d93c68b 100644
--- a/tests/assembly/x86_64-naked-fn-no-cet-prolog.rs
+++ b/tests/assembly/naked-functions/x86_64-naked-fn-no-cet-prolog.rs
diff --git a/tests/assembly/powerpc64-struct-abi.rs b/tests/assembly/powerpc64-struct-abi.rs
index eb27afc4f23..ee4965deb4f 100644
--- a/tests/assembly/powerpc64-struct-abi.rs
+++ b/tests/assembly/powerpc64-struct-abi.rs
@@ -6,7 +6,7 @@
 //@[elfv1-be] needs-llvm-components: powerpc
 //@[elfv2-be] compile-flags: --target powerpc64-unknown-linux-musl
 //@[elfv2-be] needs-llvm-components: powerpc
-//@[elfv2-le] compile-flags: --target powerpc64le-unknown-linux-gnu
+//@[elfv2-le] compile-flags: --target powerpc64le-unknown-linux-gnu -C target-cpu=pwr8
 //@[elfv2-le] needs-llvm-components: powerpc
 //@[aix] compile-flags: --target powerpc64-ibm-aix
 //@[aix] needs-llvm-components: powerpc
diff --git a/tests/assembly/s390x-vector-abi.rs b/tests/assembly/s390x-vector-abi.rs
index 7d86559c002..e159a357685 100644
--- a/tests/assembly/s390x-vector-abi.rs
+++ b/tests/assembly/s390x-vector-abi.rs
@@ -2,9 +2,9 @@
 // ignore-tidy-linelength
 //@ assembly-output: emit-asm
 //@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
-//@[z10] compile-flags: --target s390x-unknown-linux-gnu --cfg no_vector
+//@[z10] compile-flags: --target s390x-unknown-linux-gnu  -C target-cpu=z10 --cfg no_vector
 //@[z10] needs-llvm-components: systemz
-//@[z10_vector] compile-flags: --target s390x-unknown-linux-gnu -C target-feature=+vector
+//@[z10_vector] compile-flags: --target s390x-unknown-linux-gnu -C target-cpu=z10 -C target-feature=+vector
 //@[z10_vector] needs-llvm-components: systemz
 //@[z13] compile-flags: --target s390x-unknown-linux-gnu -C target-cpu=z13
 //@[z13] needs-llvm-components: systemz
diff --git a/tests/assembly/x86_64-cmp.rs b/tests/assembly/x86_64-cmp.rs
index 8cccab7d40d..26c9013d96f 100644
--- a/tests/assembly/x86_64-cmp.rs
+++ b/tests/assembly/x86_64-cmp.rs
@@ -1,5 +1,8 @@
-//@ revisions: DEBUG LLVM-PRE-20-OPTIM LLVM-20-OPTIM
-//@ [DEBUG] compile-flags: -C opt-level=0
+//@ revisions: LLVM-PRE-20-DEBUG LLVM-20-DEBUG LLVM-PRE-20-OPTIM LLVM-20-OPTIM
+//@ [LLVM-PRE-20-DEBUG] compile-flags: -C opt-level=0
+//@ [LLVM-PRE-20-DEBUG] max-llvm-major-version: 19
+//@ [LLVM-20-DEBUG] compile-flags: -C opt-level=0
+//@ [LLVM-20-DEBUG] min-llvm-version: 20
 //@ [LLVM-PRE-20-OPTIM] compile-flags: -C opt-level=3
 //@ [LLVM-PRE-20-OPTIM] max-llvm-major-version: 19
 //@ [LLVM-20-OPTIM] compile-flags: -C opt-level=3
@@ -16,13 +19,19 @@ use std::intrinsics::three_way_compare;
 #[no_mangle]
 // CHECK-LABEL: signed_cmp:
 pub fn signed_cmp(a: i16, b: i16) -> std::cmp::Ordering {
-    // DEBUG: cmp
-    // DEBUG: setg
-    // DEBUG: and
-    // DEBUG: cmp
-    // DEBUG: setl
-    // DEBUG: and
-    // DEBUG: sub
+    // LLVM-PRE-20-DEBUG: cmp
+    // LLVM-PRE-20-DEBUG: setg
+    // LLVM-PRE-20-DEBUG: and
+    // LLVM-PRE-20-DEBUG: cmp
+    // LLVM-PRE-20-DEBUG: setl
+    // LLVM-PRE-20-DEBUG: and
+    // LLVM-PRE-20-DEBUG: sub
+    //
+    // LLVM-20-DEBUG: sub
+    // LLVM-20-DEBUG: setl
+    // LLVM-20-DEBUG: setg
+    // LLVM-20-DEBUG: sub
+    // LLVM-20-DEBUG: ret
 
     // LLVM-PRE-20-OPTIM: xor
     // LLVM-PRE-20-OPTIM: cmp
@@ -42,13 +51,18 @@ pub fn signed_cmp(a: i16, b: i16) -> std::cmp::Ordering {
 #[no_mangle]
 // CHECK-LABEL: unsigned_cmp:
 pub fn unsigned_cmp(a: u16, b: u16) -> std::cmp::Ordering {
-    // DEBUG: cmp
-    // DEBUG: seta
-    // DEBUG: and
-    // DEBUG: cmp
-    // DEBUG: setb
-    // DEBUG: and
-    // DEBUG: sub
+    // LLVM-PRE-20-DEBUG: cmp
+    // LLVM-PRE-20-DEBUG: seta
+    // LLVM-PRE-20-DEBUG: and
+    // LLVM-PRE-20-DEBUG: cmp
+    // LLVM-PRE-20-DEBUG: setb
+    // LLVM-PRE-20-DEBUG: and
+    // LLVM-PRE-20-DEBUG: sub
+    //
+    // LLVM-20-DEBUG: sub
+    // LLVM-20-DEBUG: seta
+    // LLVM-20-DEBUG: sbb
+    // LLVM-20-DEBUG: ret
 
     // LLVM-PRE-20-OPTIM: xor
     // LLVM-PRE-20-OPTIM: cmp
diff --git a/tests/codegen/alloc-optimisation.rs b/tests/codegen/alloc-optimisation.rs
index 8abeecf8550..19f14647c1d 100644
--- a/tests/codegen/alloc-optimisation.rs
+++ b/tests/codegen/alloc-optimisation.rs
@@ -5,7 +5,7 @@
 pub fn alloc_test(data: u32) {
     // CHECK-LABEL: @alloc_test
     // CHECK-NEXT: start:
-    // CHECK-NEXT: {{.*}} load volatile i8, ptr @__rust_no_alloc_shim_is_unstable, align 1
+    // CHECK-NEXT: {{.*}} load volatile i8, ptr @{{.*}}__rust_no_alloc_shim_is_unstable, align 1
     // CHECK-NEXT: ret void
     let x = Box::new(data);
     drop(x);
diff --git a/tests/codegen/asm/goto.rs b/tests/codegen/asm/goto.rs
index 7a87bb7983b..f68c399c920 100644
--- a/tests/codegen/asm/goto.rs
+++ b/tests/codegen/asm/goto.rs
@@ -2,7 +2,7 @@
 //@ only-x86_64
 
 #![crate_type = "rlib"]
-#![feature(asm_goto, asm_goto_with_outputs)]
+#![feature(asm_goto_with_outputs)]
 
 use std::arch::asm;
 
diff --git a/tests/codegen/asm/s390x-clobbers.rs b/tests/codegen/asm/s390x-clobbers.rs
index cbb6630553c..0ba22a32abf 100644
--- a/tests/codegen/asm/s390x-clobbers.rs
+++ b/tests/codegen/asm/s390x-clobbers.rs
@@ -1,6 +1,6 @@
 //@ add-core-stubs
 //@ revisions: s390x
-//@[s390x] compile-flags: --target s390x-unknown-linux-gnu
+//@[s390x] compile-flags: --target s390x-unknown-linux-gnu -C target-cpu=z10
 //@[s390x] needs-llvm-components: systemz
 
 #![crate_type = "rlib"]
diff --git a/tests/codegen/assign-desugar-debuginfo.rs b/tests/codegen/assign-desugar-debuginfo.rs
new file mode 100644
index 00000000000..77ee8758b3b
--- /dev/null
+++ b/tests/codegen/assign-desugar-debuginfo.rs
@@ -0,0 +1,18 @@
+//@ compile-flags: -g -Zmir-opt-level=0
+
+#![crate_type = "lib"]
+
+#[inline(never)]
+fn swizzle(a: u32, b: u32, c: u32) -> (u32, (u32, u32)) {
+    (b, (c, a))
+}
+
+pub fn work() {
+    let mut a = 1;
+    let mut b = 2;
+    let mut c = 3;
+    (a, (b, c)) = swizzle(a, b, c);
+    println!("{a} {b} {c}");
+}
+
+// CHECK-NOT: !DILocalVariable(name: "lhs",
diff --git a/tests/codegen/box-uninit-bytes.rs b/tests/codegen/box-uninit-bytes.rs
index 3b83ef3e250..0cc01148595 100644
--- a/tests/codegen/box-uninit-bytes.rs
+++ b/tests/codegen/box-uninit-bytes.rs
@@ -41,6 +41,6 @@ pub fn box_lotsa_padding() -> Box<LotsaPadding> {
 
 // Hide the `allocalign` attribute in the declaration of __rust_alloc
 // from the CHECK-NOT above, and also verify the attributes got set reasonably.
-// CHECK: declare {{(dso_local )?}}noalias noundef ptr @__rust_alloc(i{{[0-9]+}} noundef, i{{[0-9]+}} allocalign noundef) unnamed_addr [[RUST_ALLOC_ATTRS:#[0-9]+]]
+// CHECK: declare {{(dso_local )?}}noalias noundef ptr @{{.*}}__rust_alloc(i{{[0-9]+}} noundef, i{{[0-9]+}} allocalign noundef) unnamed_addr [[RUST_ALLOC_ATTRS:#[0-9]+]]
 
 // CHECK-DAG: attributes [[RUST_ALLOC_ATTRS]] = { {{.*}} allockind("alloc,uninitialized,aligned") allocsize(0) {{(uwtable )?}}"alloc-family"="__rust_alloc" {{.*}} }
diff --git a/tests/codegen/comparison-operators-2-tuple.rs b/tests/codegen/comparison-operators-2-tuple.rs
index 91a99f9b91f..6a7e489c82d 100644
--- a/tests/codegen/comparison-operators-2-tuple.rs
+++ b/tests/codegen/comparison-operators-2-tuple.rs
@@ -1,5 +1,4 @@
 //@ compile-flags: -C opt-level=1 -Z merge-functions=disabled
-//@ only-x86_64
 //@ min-llvm-version: 20
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/const-array.rs b/tests/codegen/const-array.rs
index e257d8acc08..b3df76c3d8e 100644
--- a/tests/codegen/const-array.rs
+++ b/tests/codegen/const-array.rs
@@ -2,7 +2,7 @@
 
 #![crate_type = "lib"]
 
-const LUT: [u8; 2] = [1, 1];
+const LUT: [u8; 4] = [1, 1, 1, 1];
 
 // CHECK-LABEL: @decode
 #[no_mangle]
@@ -11,5 +11,5 @@ pub fn decode(i: u8) -> u8 {
     // CHECK-NEXT: icmp
     // CHECK-NEXT: select
     // CHECK-NEXT: ret
-    if i < 2 { LUT[i as usize] } else { 2 }
+    if i < 4 { LUT[i as usize] } else { 2 }
 }
diff --git a/tests/codegen/dealloc-no-unwind.rs b/tests/codegen/dealloc-no-unwind.rs
index c560d7a9932..68597817d6f 100644
--- a/tests/codegen/dealloc-no-unwind.rs
+++ b/tests/codegen/dealloc-no-unwind.rs
@@ -18,7 +18,7 @@ impl Drop for A {
 #[no_mangle]
 pub fn a(a: Box<i32>) {
     // CHECK-LABEL: define{{.*}}void @a
-    // CHECK: call void @__rust_dealloc
+    // CHECK: call void @{{.*}}__rust_dealloc
     // CHECK-NEXT: call void @foo
     let _a = A;
     drop(a);
diff --git a/tests/codegen/debug-vtable.rs b/tests/codegen/debug-vtable.rs
index b9808e4079b..8a7b1cc3c4b 100644
--- a/tests/codegen/debug-vtable.rs
+++ b/tests/codegen/debug-vtable.rs
@@ -15,7 +15,7 @@
 
 // Make sure that vtables don't have the unnamed_addr attribute when debuginfo is enabled.
 // This helps debuggers more reliably map from dyn pointer to concrete type.
-// CHECK: @vtable.2 = private constant <{
+// CHECK: @vtable.2 = private constant [
 // CHECK: @vtable.3 = private constant <{
 // CHECK: @vtable.4 = private constant <{
 
diff --git a/tests/codegen/enum/enum-two-variants-match.rs b/tests/codegen/enum/enum-two-variants-match.rs
index e5978bfc761..c1f208d7909 100644
--- a/tests/codegen/enum/enum-two-variants-match.rs
+++ b/tests/codegen/enum/enum-two-variants-match.rs
@@ -7,19 +7,22 @@
 // CHECK-LABEL: @option_match
 #[no_mangle]
 pub fn option_match(x: Option<i32>) -> u16 {
-    // CHECK: %x = alloca [8 x i8]
-    // CHECK: store i32 %0, ptr %x
-    // CHECK: %[[TAG:.+]] = load i32, ptr %x
-    // CHECK-SAME: !range ![[ZERO_ONE_32:[0-9]+]]
-    // CHECK: %[[DISCR:.+]] = zext i32 %[[TAG]] to i64
+    // CHECK-NOT: %x = alloca
+    // CHECK: %[[OUT:.+]] = alloca [2 x i8]
+    // CHECK-NOT: %x = alloca
+
+    // CHECK: %[[DISCR:.+]] = zext i32 %x.0 to i64
     // CHECK: %[[COND:.+]] = trunc nuw i64 %[[DISCR]] to i1
     // CHECK: br i1 %[[COND]], label %[[TRUE:[a-z0-9]+]], label %[[FALSE:[a-z0-9]+]]
 
     // CHECK: [[TRUE]]:
-    // CHECK: store i16 13
+    // CHECK: store i16 13, ptr %[[OUT]]
 
     // CHECK: [[FALSE]]:
-    // CHECK: store i16 42
+    // CHECK: store i16 42, ptr %[[OUT]]
+
+    // CHECK: %[[RET:.+]] = load i16, ptr %[[OUT]]
+    // CHECK: ret i16 %[[RET]]
     match x {
         Some(_) => 13,
         None => 42,
@@ -29,23 +32,23 @@ pub fn option_match(x: Option<i32>) -> u16 {
 // CHECK-LABEL: @result_match
 #[no_mangle]
 pub fn result_match(x: Result<u64, i64>) -> u16 {
-    // CHECK: %x = alloca [16 x i8]
-    // CHECK: store i64 %0, ptr %x
-    // CHECK: %[[DISCR:.+]] = load i64, ptr %x
-    // CHECK-SAME: !range ![[ZERO_ONE_64:[0-9]+]]
-    // CHECK: %[[COND:.+]] = trunc nuw i64 %[[DISCR]] to i1
+    // CHECK-NOT: %x = alloca
+    // CHECK: %[[OUT:.+]] = alloca [2 x i8]
+    // CHECK-NOT: %x = alloca
+
+    // CHECK: %[[COND:.+]] = trunc nuw i64 %x.0 to i1
     // CHECK: br i1 %[[COND]], label %[[TRUE:[a-z0-9]+]], label %[[FALSE:[a-z0-9]+]]
 
     // CHECK: [[TRUE]]:
-    // CHECK: store i16 13
+    // CHECK: store i16 13, ptr %[[OUT]]
 
     // CHECK: [[FALSE]]:
-    // CHECK: store i16 42
+    // CHECK: store i16 42, ptr %[[OUT]]
+
+    // CHECK: %[[RET:.+]] = load i16, ptr %[[OUT]]
+    // CHECK: ret i16 %[[RET]]
     match x {
         Err(_) => 13,
         Ok(_) => 42,
     }
 }
-
-// CHECK: ![[ZERO_ONE_32]] = !{i32 0, i32 2}
-// CHECK: ![[ZERO_ONE_64]] = !{i64 0, i64 2}
diff --git a/tests/codegen/external-no-mangle-statics.rs b/tests/codegen/external-no-mangle-statics.rs
index dc4eca8c7b4..49f42ee977d 100644
--- a/tests/codegen/external-no-mangle-statics.rs
+++ b/tests/codegen/external-no-mangle-statics.rs
@@ -6,72 +6,72 @@
 // `#[no_mangle]`d static variables always have external linkage, i.e., no `internal` in their
 // definitions
 
-// CHECK: @A = {{(dso_local )?}}local_unnamed_addr constant
+// CHECK-DAG: @A = {{(dso_local )?}}local_unnamed_addr constant
 #[no_mangle]
 static A: u8 = 0;
 
-// CHECK: @B = {{(dso_local )?}}local_unnamed_addr global
+// CHECK-DAG: @B = {{(dso_local )?}}local_unnamed_addr global
 #[no_mangle]
 static mut B: u8 = 0;
 
-// CHECK: @C = {{(dso_local )?}}local_unnamed_addr constant
+// CHECK-DAG: @C = {{(dso_local )?}}local_unnamed_addr constant
 #[no_mangle]
 pub static C: u8 = 0;
 
-// CHECK: @D = {{(dso_local )?}}local_unnamed_addr global
+// CHECK-DAG: @D = {{(dso_local )?}}local_unnamed_addr global
 #[no_mangle]
 pub static mut D: u8 = 0;
 
 mod private {
-    // CHECK: @E = {{(dso_local )?}}local_unnamed_addr constant
+    // CHECK-DAG: @E = {{(dso_local )?}}local_unnamed_addr constant
     #[no_mangle]
     static E: u8 = 0;
 
-    // CHECK: @F = {{(dso_local )?}}local_unnamed_addr global
+    // CHECK-DAG: @F = {{(dso_local )?}}local_unnamed_addr global
     #[no_mangle]
     static mut F: u8 = 0;
 
-    // CHECK: @G = {{(dso_local )?}}local_unnamed_addr constant
+    // CHECK-DAG: @G = {{(dso_local )?}}local_unnamed_addr constant
     #[no_mangle]
     pub static G: u8 = 0;
 
-    // CHECK: @H = {{(dso_local )?}}local_unnamed_addr global
+    // CHECK-DAG: @H = {{(dso_local )?}}local_unnamed_addr global
     #[no_mangle]
     pub static mut H: u8 = 0;
 }
 
 const HIDDEN: () = {
-    // CHECK: @I = {{(dso_local )?}}local_unnamed_addr constant
+    // CHECK-DAG: @I = {{(dso_local )?}}local_unnamed_addr constant
     #[no_mangle]
     static I: u8 = 0;
 
-    // CHECK: @J = {{(dso_local )?}}local_unnamed_addr global
+    // CHECK-DAG: @J = {{(dso_local )?}}local_unnamed_addr global
     #[no_mangle]
     static mut J: u8 = 0;
 
-    // CHECK: @K = {{(dso_local )?}}local_unnamed_addr constant
+    // CHECK-DAG: @K = {{(dso_local )?}}local_unnamed_addr constant
     #[no_mangle]
     pub static K: u8 = 0;
 
-    // CHECK: @L = {{(dso_local )?}}local_unnamed_addr global
+    // CHECK-DAG: @L = {{(dso_local )?}}local_unnamed_addr global
     #[no_mangle]
     pub static mut L: u8 = 0;
 };
 
 fn x() {
-    // CHECK: @M = {{(dso_local )?}}local_unnamed_addr constant
+    // CHECK-DAG: @M = {{(dso_local )?}}local_unnamed_addr constant
     #[no_mangle]
     static M: fn() = x;
 
-    // CHECK: @N = {{(dso_local )?}}local_unnamed_addr global
+    // CHECK-DAG: @N = {{(dso_local )?}}local_unnamed_addr global
     #[no_mangle]
     static mut N: u8 = 0;
 
-    // CHECK: @O = {{(dso_local )?}}local_unnamed_addr constant
+    // CHECK-DAG: @O = {{(dso_local )?}}local_unnamed_addr constant
     #[no_mangle]
     pub static O: u8 = 0;
 
-    // CHECK: @P = {{(dso_local )?}}local_unnamed_addr global
+    // CHECK-DAG: @P = {{(dso_local )?}}local_unnamed_addr global
     #[no_mangle]
     pub static mut P: u8 = 0;
 }
diff --git a/tests/codegen/integer-cmp.rs b/tests/codegen/integer-cmp.rs
index 9bbf243946d..812fa8e4a42 100644
--- a/tests/codegen/integer-cmp.rs
+++ b/tests/codegen/integer-cmp.rs
@@ -4,7 +4,7 @@
 //@ revisions: llvm-pre-20 llvm-20
 //@ [llvm-20] min-llvm-version: 20
 //@ [llvm-pre-20] max-llvm-major-version: 19
-//@ compile-flags: -C opt-level=3
+//@ compile-flags: -C opt-level=3 -Zmerge-functions=disabled
 
 #![crate_type = "lib"]
 
@@ -13,7 +13,7 @@ use std::cmp::Ordering;
 // CHECK-LABEL: @cmp_signed
 #[no_mangle]
 pub fn cmp_signed(a: i64, b: i64) -> Ordering {
-    // llvm-20: @llvm.scmp.i8.i64
+    // llvm-20: call{{.*}} i8 @llvm.scmp.i8.i64
     // llvm-pre-20: icmp slt
     // llvm-pre-20: icmp ne
     // llvm-pre-20: zext i1
@@ -24,10 +24,39 @@ pub fn cmp_signed(a: i64, b: i64) -> Ordering {
 // CHECK-LABEL: @cmp_unsigned
 #[no_mangle]
 pub fn cmp_unsigned(a: u32, b: u32) -> Ordering {
-    // llvm-20: @llvm.ucmp.i8.i32
+    // llvm-20: call{{.*}} i8 @llvm.ucmp.i8.i32
     // llvm-pre-20: icmp ult
     // llvm-pre-20: icmp ne
     // llvm-pre-20: zext i1
     // llvm-pre-20: select i1
     a.cmp(&b)
 }
+
+// CHECK-LABEL: @cmp_char
+#[no_mangle]
+pub fn cmp_char(a: char, b: char) -> Ordering {
+    // llvm-20: call{{.*}} i8 @llvm.ucmp.i8.i32
+    // llvm-pre-20: icmp ult
+    // llvm-pre-20: icmp ne
+    // llvm-pre-20: zext i1
+    // llvm-pre-20: select i1
+    a.cmp(&b)
+}
+
+// CHECK-LABEL: @cmp_tuple
+#[no_mangle]
+pub fn cmp_tuple(a: (i16, u16), b: (i16, u16)) -> Ordering {
+    // llvm-20-DAG: call{{.*}} i8 @llvm.ucmp.i8.i16
+    // llvm-20-DAG: call{{.*}} i8 @llvm.scmp.i8.i16
+    // llvm-20: ret i8
+    // llvm-pre-20: icmp slt
+    // llvm-pre-20: icmp ne
+    // llvm-pre-20: zext i1
+    // llvm-pre-20: select i1
+    // llvm-pre-20: icmp ult
+    // llvm-pre-20: icmp ne
+    // llvm-pre-20: zext i1
+    // llvm-pre-20: select i1
+    // llvm-pre-20: select i1
+    a.cmp(&b)
+}
diff --git a/tests/codegen/intrinsics/cold_path2.rs b/tests/codegen/intrinsics/cold_path2.rs
index 54ee473e620..0891c878fd9 100644
--- a/tests/codegen/intrinsics/cold_path2.rs
+++ b/tests/codegen/intrinsics/cold_path2.rs
@@ -25,8 +25,8 @@ pub fn test(x: Option<bool>) {
         path_b();
     }
 
-    // CHECK-LABEL: @test(
-    // CHECK: %[[IS_NONE:.+]] = icmp eq i8 %0, 2
+    // CHECK-LABEL: void @test(i8{{.+}}%x)
+    // CHECK: %[[IS_NONE:.+]] = icmp eq i8 %x, 2
     // CHECK: br i1 %[[IS_NONE]], label %bb2, label %bb1, !prof ![[NUM:[0-9]+]]
     // CHECK: bb1:
     // CHECK: path_a
diff --git a/tests/codegen/intrinsics/three_way_compare.rs b/tests/codegen/intrinsics/three_way_compare.rs
index 9a476abe891..95fcb636f7c 100644
--- a/tests/codegen/intrinsics/three_way_compare.rs
+++ b/tests/codegen/intrinsics/three_way_compare.rs
@@ -2,6 +2,7 @@
 //@ [DEBUG] compile-flags: -C opt-level=0
 //@ [OPTIM] compile-flags: -C opt-level=3
 //@ compile-flags: -C no-prepopulate-passes
+//@ min-llvm-version: 20
 
 #![crate_type = "lib"]
 #![feature(core_intrinsics)]
@@ -12,17 +13,8 @@ use std::intrinsics::three_way_compare;
 // CHECK-LABEL: @signed_cmp
 // CHECK-SAME: (i16{{.*}} %a, i16{{.*}} %b)
 pub fn signed_cmp(a: i16, b: i16) -> std::cmp::Ordering {
-    // DEBUG: %[[GT:.+]] = icmp sgt i16 %a, %b
-    // DEBUG: %[[ZGT:.+]] = zext i1 %[[GT]] to i8
-    // DEBUG: %[[LT:.+]] = icmp slt i16 %a, %b
-    // DEBUG: %[[ZLT:.+]] = zext i1 %[[LT]] to i8
-    // DEBUG: %[[R:.+]] = sub nsw i8 %[[ZGT]], %[[ZLT]]
-
-    // OPTIM: %[[LT:.+]] = icmp slt i16 %a, %b
-    // OPTIM: %[[NE:.+]] = icmp ne i16 %a, %b
-    // OPTIM: %[[CGE:.+]] = select i1 %[[NE]], i8 1, i8 0
-    // OPTIM: %[[CGEL:.+]] = select i1 %[[LT]], i8 -1, i8 %[[CGE]]
-    // OPTIM: ret i8 %[[CGEL]]
+    // CHECK: %[[CMP:.+]] = call i8 @llvm.scmp.i8.i16(i16 %a, i16 %b)
+    // CHECK-NEXT: ret i8 %[[CMP]]
     three_way_compare(a, b)
 }
 
@@ -30,16 +22,7 @@ pub fn signed_cmp(a: i16, b: i16) -> std::cmp::Ordering {
 // CHECK-LABEL: @unsigned_cmp
 // CHECK-SAME: (i16{{.*}} %a, i16{{.*}} %b)
 pub fn unsigned_cmp(a: u16, b: u16) -> std::cmp::Ordering {
-    // DEBUG: %[[GT:.+]] = icmp ugt i16 %a, %b
-    // DEBUG: %[[ZGT:.+]] = zext i1 %[[GT]] to i8
-    // DEBUG: %[[LT:.+]] = icmp ult i16 %a, %b
-    // DEBUG: %[[ZLT:.+]] = zext i1 %[[LT]] to i8
-    // DEBUG: %[[R:.+]] = sub nsw i8 %[[ZGT]], %[[ZLT]]
-
-    // OPTIM: %[[LT:.+]] = icmp ult i16 %a, %b
-    // OPTIM: %[[NE:.+]] = icmp ne i16 %a, %b
-    // OPTIM: %[[CGE:.+]] = select i1 %[[NE]], i8 1, i8 0
-    // OPTIM: %[[CGEL:.+]] = select i1 %[[LT]], i8 -1, i8 %[[CGE]]
-    // OPTIM: ret i8 %[[CGEL]]
+    // CHECK: %[[CMP:.+]] = call i8 @llvm.ucmp.i8.i16(i16 %a, i16 %b)
+    // CHECK-NEXT: ret i8 %[[CMP]]
     three_way_compare(a, b)
 }
diff --git a/tests/codegen/issues/issue-129795.rs b/tests/codegen/issues/issue-129795.rs
new file mode 100644
index 00000000000..dc64ee35c97
--- /dev/null
+++ b/tests/codegen/issues/issue-129795.rs
@@ -0,0 +1,17 @@
+//@ compile-flags: -Copt-level=3
+//@ min-llvm-version: 20
+#![crate_type = "lib"]
+
+// Ensure that a modulo operation with an operand that is known to be
+// a power-of-two is properly optimized.
+
+// CHECK-LABEL: @modulo_with_power_of_two_divisor
+// CHECK: add i64 %divisor, -1
+// CHECK-NEXT: and i64
+// CHECK-NEXT: ret i64
+#[no_mangle]
+pub fn modulo_with_power_of_two_divisor(dividend: u64, divisor: u64) -> u64 {
+    assert!(divisor.is_power_of_two());
+    // should be optimized to (dividend & (divisor - 1))
+    dividend % divisor
+}
diff --git a/tests/codegen/iter-repeat-n-trivial-drop.rs b/tests/codegen/iter-repeat-n-trivial-drop.rs
index 4dab499a8a5..3bb942d11d5 100644
--- a/tests/codegen/iter-repeat-n-trivial-drop.rs
+++ b/tests/codegen/iter-repeat-n-trivial-drop.rs
@@ -47,7 +47,7 @@ pub fn iter_repeat_n_next(it: &mut std::iter::RepeatN<NotCopy>) -> Option<NotCop
 #[no_mangle]
 // CHECK-LABEL: @vec_extend_via_iter_repeat_n
 pub fn vec_extend_via_iter_repeat_n() -> Vec<u8> {
-    // CHECK: %[[ADDR:.+]] = tail call {{(noalias )?}}noundef dereferenceable_or_null(1234) ptr @__rust_alloc(i64 noundef {{(range\(i64 1, 0\) )?}}1234, i64 noundef {{(range\(i64 1, -9223372036854775807\) )?}}1)
+    // CHECK: %[[ADDR:.+]] = tail call {{(noalias )?}}noundef dereferenceable_or_null(1234) ptr @{{.*}}__rust_alloc(i64 noundef {{(range\(i64 1, 0\) )?}}1234, i64 noundef {{(range\(i64 1, -9223372036854775807\) )?}}1)
     // CHECK: tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(1234) %[[ADDR]], i8 42, i64 1234,
 
     let n = 1234_usize;
diff --git a/tests/codegen/link_section.rs b/tests/codegen/link_section.rs
index 196f5edb7d6..f62f6948079 100644
--- a/tests/codegen/link_section.rs
+++ b/tests/codegen/link_section.rs
@@ -3,7 +3,7 @@
 
 #![crate_type = "lib"]
 
-// CHECK: @VAR1 = {{(dso_local )?}}constant <{ [4 x i8] }> <{ [4 x i8] c"\01\00\00\00" }>, section ".test_one"
+// CHECK: @VAR1 = {{(dso_local )?}}constant [4 x i8] c"\01\00\00\00", section ".test_one"
 #[no_mangle]
 #[link_section = ".test_one"]
 #[cfg(target_endian = "little")]
diff --git a/tests/codegen/match-optimizes-away.rs b/tests/codegen/match-optimizes-away.rs
index 8a70d993423..5e9be72a09f 100644
--- a/tests/codegen/match-optimizes-away.rs
+++ b/tests/codegen/match-optimizes-away.rs
@@ -1,5 +1,4 @@
-//
-//@ compile-flags: -Copt-level=3
+//@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled
 #![crate_type = "lib"]
 
 pub enum Three {
@@ -18,9 +17,9 @@ pub enum Four {
 
 #[no_mangle]
 pub fn three_valued(x: Three) -> Three {
-    // CHECK-LABEL: @three_valued
+    // CHECK-LABEL: i8 @three_valued(i8{{.+}}%x)
     // CHECK-NEXT: {{^.*:$}}
-    // CHECK-NEXT: ret i8 %0
+    // CHECK-NEXT: ret i8 %x
     match x {
         Three::A => Three::A,
         Three::B => Three::B,
@@ -30,9 +29,9 @@ pub fn three_valued(x: Three) -> Three {
 
 #[no_mangle]
 pub fn four_valued(x: Four) -> Four {
-    // CHECK-LABEL: @four_valued
+    // CHECK-LABEL: i16 @four_valued(i16{{.+}}%x)
     // CHECK-NEXT: {{^.*:$}}
-    // CHECK-NEXT: ret i16 %0
+    // CHECK-NEXT: ret i16 %x
     match x {
         Four::A => Four::A,
         Four::B => Four::B,
diff --git a/tests/codegen/naked-fn/naked-functions.rs b/tests/codegen/naked-fn/naked-functions.rs
index 6483e27c97a..3fe795178b7 100644
--- a/tests/codegen/naked-fn/naked-functions.rs
+++ b/tests/codegen/naked-fn/naked-functions.rs
@@ -1,10 +1,12 @@
 //@ add-core-stubs
-//@ revisions: linux win macos thumb
+//@ revisions: linux win_x86 win_i686 macos thumb
 //
 //@[linux] compile-flags: --target x86_64-unknown-linux-gnu
 //@[linux] needs-llvm-components: x86
-//@[win] compile-flags: --target x86_64-pc-windows-gnu
-//@[win] needs-llvm-components: x86
+//@[win_x86] compile-flags: --target x86_64-pc-windows-gnu
+//@[win_x86] needs-llvm-components: x86
+//@[win_i686] compile-flags: --target i686-pc-windows-gnu
+//@[win_i686] needs-llvm-components: x86
 //@[macos] compile-flags: --target aarch64-apple-darwin
 //@[macos] needs-llvm-components: arm
 //@[thumb] compile-flags: --target thumbv7em-none-eabi
@@ -19,10 +21,11 @@ use minicore::*;
 
 // linux,win: .intel_syntax
 //
-// linux:   .pushsection .text.naked_empty,\22ax\22, @progbits
-// macos:   .pushsection __TEXT,__text,regular,pure_instructions
-// win: .pushsection .text.naked_empty,\22xr\22
-// thumb:   .pushsection .text.naked_empty,\22ax\22, %progbits
+// linux:    .pushsection .text.naked_empty,\22ax\22, @progbits
+// macos:    .pushsection __TEXT,__text,regular,pure_instructions
+// win_x86:  .pushsection .text.naked_empty,\22xr\22
+// win_i686: .pushsection .text._naked_empty,\22xr\22
+// thumb:    .pushsection .text.naked_empty,\22ax\22, %progbits
 //
 // CHECK: .balign 4
 //
@@ -34,10 +37,12 @@ use minicore::*;
 //
 // linux: .type naked_empty, @function
 //
-// win: .def naked_empty
-// win: .scl 2
-// win: .type 32
-// win: .endef naked_empty
+// win_x86:  .def naked_empty
+// win_i686: .def _naked_empty
+//
+// win_x86,win_i686: .scl 2
+// win_x86,win_i686: .type 32
+// win_x86,win_i686: .endef
 //
 // thumb: .type naked_empty, %function
 // thumb: .thumb
@@ -66,10 +71,11 @@ pub unsafe extern "C" fn naked_empty() {
 
 // linux,win: .intel_syntax
 //
-// linux:   .pushsection .text.naked_with_args_and_return,\22ax\22, @progbits
-// macos:   .pushsection __TEXT,__text,regular,pure_instructions
-// win: .pushsection .text.naked_with_args_and_return,\22xr\22
-// thumb:   .pushsection .text.naked_with_args_and_return,\22ax\22, %progbits
+// linux:    .pushsection .text.naked_with_args_and_return,\22ax\22, @progbits
+// macos:    .pushsection __TEXT,__text,regular,pure_instructions
+// win_x86:  .pushsection .text.naked_with_args_and_return,\22xr\22
+// win_i686: .pushsection .text._naked_with_args_and_return,\22xr\22
+// thumb:    .pushsection .text.naked_with_args_and_return,\22ax\22, %progbits
 //
 // CHECK: .balign 4
 //
@@ -81,10 +87,12 @@ pub unsafe extern "C" fn naked_empty() {
 //
 // linux: .type naked_with_args_and_return, @function
 //
-// win: .def naked_with_args_and_return
-// win: .scl 2
-// win: .type 32
-// win: .endef naked_with_args_and_return
+// win_x86:  .def naked_with_args_and_return
+// win_i686: .def _naked_with_args_and_return
+//
+// win_x86,win_i686: .scl 2
+// win_x86,win_i686: .type 32
+// win_x86,win_i686: .endef
 //
 // thumb: .type naked_with_args_and_return, %function
 // thumb: .thumb
@@ -92,7 +100,7 @@ pub unsafe extern "C" fn naked_empty() {
 //
 // CHECK-LABEL: naked_with_args_and_return:
 //
-// linux, win: lea rax, [rdi + rsi]
+// linux, win_x86,win_i686: lea rax, [rdi + rsi]
 // macos: add x0, x0, x1
 // thumb: adds r0, r0, r1
 //
@@ -124,10 +132,10 @@ pub unsafe extern "C" fn naked_with_args_and_return(a: isize, b: isize) -> isize
     }
 }
 
-// linux:   .pushsection .text.some_different_name,\22ax\22, @progbits
-// macos:   .pushsection .text.some_different_name,regular,pure_instructions
-// win: .pushsection .text.some_different_name,\22xr\22
-// thumb:   .pushsection .text.some_different_name,\22ax\22, %progbits
+// linux:            .pushsection .text.some_different_name,\22ax\22, @progbits
+// macos:            .pushsection .text.some_different_name,regular,pure_instructions
+// win_x86,win_i686: .pushsection .text.some_different_name,\22xr\22
+// thumb:            .pushsection .text.some_different_name,\22ax\22, %progbits
 // CHECK-LABEL: test_link_section:
 #[no_mangle]
 #[naked]
@@ -139,3 +147,19 @@ pub unsafe extern "C" fn test_link_section() {
     #[cfg(all(target_arch = "arm", target_feature = "thumb-mode"))]
     naked_asm!("bx lr");
 }
+
+// win_x86:  .def fastcall_cc
+// win_i686: .def @fastcall_cc@4
+//
+// win_x86,win_i686: .scl 2
+// win_x86,win_i686: .type 32
+// win_x86,win_i686: .endef
+//
+// win_x86-LABEL: fastcall_cc:
+// win_i686-LABEL: @fastcall_cc@4:
+#[cfg(target_os = "windows")]
+#[no_mangle]
+#[naked]
+pub unsafe extern "fastcall" fn fastcall_cc(x: i32) -> i32 {
+    naked_asm!("ret");
+}
diff --git a/tests/codegen/range-loop.rs b/tests/codegen/range-loop.rs
new file mode 100644
index 00000000000..b131beb40dd
--- /dev/null
+++ b/tests/codegen/range-loop.rs
@@ -0,0 +1,44 @@
+//@ ignore-std-debug-assertions
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
+
+#![crate_type = "lib"]
+
+// Ensure that MIR optimizations have cleaned things up enough that the IR we
+// emit is good even without running the LLVM optimizations.
+
+// CHECK-NOT: define
+
+// CHECK-LABEL: define{{.+}}void @call_for_zero_to_n
+#[no_mangle]
+pub fn call_for_zero_to_n(n: u32, f: fn(u32)) {
+    // CHECK: start:
+    // CHECK-NOT: alloca
+    // CHECK: %[[IND:.+]] = alloca [4 x i8]
+    // CHECK-NEXT: %[[ALWAYS_SOME_OPTION:.+]] = alloca
+    // CHECK-NOT: alloca
+    // CHECK: store i32 0, ptr %[[IND]],
+    // CHECK: br label %[[HEAD:.+]]
+
+    // CHECK: [[HEAD]]:
+    // CHECK: %[[T1:.+]] = load i32, ptr %[[IND]],
+    // CHECK: %[[NOT_DONE:.+]] = icmp ult i32 %[[T1]], %n
+    // CHECK: br i1 %[[NOT_DONE]], label %[[BODY:.+]], label %[[BREAK:.+]]
+
+    // CHECK: [[BREAK]]:
+    // CHECK: ret void
+
+    // CHECK: [[BODY]]:
+    // CHECK: %[[T2:.+]] = load i32, ptr %[[IND]],
+    // CHECK: %[[T3:.+]] = add nuw i32 %[[T2]], 1
+    // CHECK: store i32 %[[T3]], ptr %[[IND]],
+
+    // CHECK: store i32 %[[T2]]
+    // CHECK: %[[T4:.+]] = load i32
+    // CHECK: call void %f(i32{{.+}}%[[T4]])
+
+    for i in 0..n {
+        f(i);
+    }
+}
+
+// CHECK-NOT: define
diff --git a/tests/codegen/remap_path_prefix/main.rs b/tests/codegen/remap_path_prefix/main.rs
index bfbccfe0df8..7d17b3b67cf 100644
--- a/tests/codegen/remap_path_prefix/main.rs
+++ b/tests/codegen/remap_path_prefix/main.rs
@@ -12,7 +12,7 @@ mod aux_mod;
 include!("aux_mod.rs");
 
 // Here we check that the expansion of the file!() macro is mapped.
-// CHECK: @alloc_5761061597a97f66e13ef2ff92712c4b = private unnamed_addr constant <{ [34 x i8] }> <{ [34 x i8] c"/the/src/remap_path_prefix/main.rs" }>
+// CHECK: @alloc_5761061597a97f66e13ef2ff92712c4b = private unnamed_addr constant [34 x i8] c"/the/src/remap_path_prefix/main.rs"
 pub static FILE_PATH: &'static str = file!();
 
 fn main() {
diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs
index 3edc68e1347..9048c6a1f18 100644
--- a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs
+++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs
@@ -9,18 +9,16 @@
 
 extern crate core;
 
-mod defining_module {
-    pub type Type1 = impl Send;
+pub type Type1 = impl Send;
 
-    pub fn foo()
-    where
-        Type1: 'static,
-    {
-        pub struct Foo<T, const N: usize>([T; N]);
-        let _: Type1 = Foo([0; 32]);
-    }
+#[define_opaque(Type1)]
+pub fn foo()
+where
+    Type1: 'static,
+{
+    pub struct Foo<T, const N: usize>([T; N]);
+    let _: Type1 = Foo([0; 32]);
 }
-use defining_module::*;
 
 pub fn foo1(_: Type1) {}
 // CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
@@ -29,6 +27,6 @@ pub fn foo2(_: Type1, _: Type1) {}
 pub fn foo3(_: Type1, _: Type1, _: Type1) {}
 // CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
 
-// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNvNtC{{[[:print:]]+}}_{{[[:print:]]+}}15defining_module3foo3FooIu3i32Lu5usize32EEE"}
-// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNvNtC{{[[:print:]]+}}_{{[[:print:]]+}}15defining_module3foo3FooIu3i32Lu5usize32EES2_E"}
-// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNvNtC{{[[:print:]]+}}_{{[[:print:]]+}}15defining_module3foo3FooIu3i32Lu5usize32EES2_S2_E"}
+// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo3FooIu3i32Lu5usize32EEE"}
+// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo3FooIu3i32Lu5usize32EES2_E"}
+// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo3FooIu3i32Lu5usize32EES2_S2_E"}
diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs
index 09cfd2e10d6..36d2e8c9f25 100644
--- a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs
+++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs
@@ -9,22 +9,18 @@
 
 extern crate core;
 
-mod defining_module {
+pub type Type1 = impl Send;
 
-    pub type Type1 = impl Send;
-
-    pub fn foo<'a>()
-    where
-        Type1: 'static,
-    {
-        pub struct Foo<'a>(&'a i32);
-        pub struct Bar<'a, 'b>(&'a i32, &'b Foo<'b>);
-        let _: Type1 = Bar;
-    }
+#[define_opaque(Type1)]
+pub fn foo<'a>()
+where
+    Type1: 'static,
+{
+    pub struct Foo<'a>(&'a i32);
+    pub struct Bar<'a, 'b>(&'a i32, &'b Foo<'b>);
+    let _: Type1 = Bar;
 }
 
-use defining_module::*;
-
 pub fn foo1(_: Type1) {}
 // CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
 pub fn foo2(_: Type1, _: Type1) {}
diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs
index ffbfe021ba3..a8ba8db1be3 100644
--- a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs
+++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs
@@ -9,47 +9,41 @@
 
 extern crate core;
 
-mod defining_module {
-    pub type Type1 = impl Send;
-    pub type Type2 = impl Send;
-    pub type Type3 = impl Send;
-    pub type Type4 = impl Send;
+pub type Type1 = impl Send;
+pub type Type2 = impl Send;
+pub type Type3 = impl Send;
+pub type Type4 = impl Send;
 
-    pub fn foo()
-    where
-        Type1: 'static,
-        Type2: 'static,
-        Type4: 'static,
-    {
-        // Type in extern path
-        extern "C" {
-            fn bar();
-        }
-        let _: Type1 = bar;
-
-        // Type in closure path
-        || {
-            pub struct Foo;
-            let _: Type2 = Foo;
-        };
+#[define_opaque(Type1, Type2, Type4)]
+pub fn foo() {
+    // Type in extern path
+    extern "C" {
+        fn bar();
+    }
+    let _: Type1 = bar;
 
-        // Type in const path
-        const {
-            pub struct Foo;
-            fn bar() -> Type3 {
-                Foo
-            }
-        };
+    // Type in closure path
+    || {
+        pub struct Foo;
+        let _: Type2 = Foo;
+    };
 
-        // Type in impl path
-        struct Foo;
-        impl Foo {
-            fn bar(&self) {}
+    // Type in const path
+    const {
+        pub struct Foo;
+        #[define_opaque(Type3)]
+        fn bar() -> Type3 {
+            Foo
         }
-        let _: Type4 = <Foo>::bar;
+    };
+
+    // Type in impl path
+    struct Foo;
+    impl Foo {
+        fn bar(&self) {}
     }
+    let _: Type4 = <Foo>::bar;
 }
-use defining_module::*;
 
 // Force arguments to be passed by using a reference. Otherwise, they may end up PassMode::Ignore
 
@@ -78,15 +72,15 @@ pub fn foo11(_: &Type4, _: &Type4) {}
 pub fn foo12(_: &Type4, _: &Type4, _: &Type4) {}
 // CHECK: define{{.*}}5foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
 
-// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NvNFNvNtC{{[[:print:]]+}}_{{[[:print:]]+}}15defining_module3foo10{{[{}][{}]}}extern{{[}][}]}}3barEE"}
-// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NvNFNvNtC{{[[:print:]]+}}_{{[[:print:]]+}}15defining_module3foo10{{[{}][{}]}}extern{{[}][}]}}3barES0_E"}
-// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NvNFNvNtC{{[[:print:]]+}}_{{[[:print:]]+}}15defining_module3foo10{{[{}][{}]}}extern{{[}][}]}}3barES0_S0_E"}
-// CHECK: ![[TYPE4]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtNCNvNtC{{[[:print:]]+}}_{{[[:print:]]+}}15defining_module3foo11{{[{}][{}]}}closure{{[}][}]}}3FooEE"}
-// CHECK: ![[TYPE5]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtNCNvNtC{{[[:print:]]+}}_{{[[:print:]]+}}15defining_module3foo11{{[{}][{}]}}closure{{[}][}]}}3FooES0_E"}
-// CHECK: ![[TYPE6]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtNCNvNtC{{[[:print:]]+}}_{{[[:print:]]+}}15defining_module3foo11{{[{}][{}]}}closure{{[}][}]}}3FooES0_S0_E"}
-// CHECK: ![[TYPE7]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtNkNvNtC{{[[:print:]]+}}_{{[[:print:]]+}}15defining_module3foo12{{[{}][{}]}}constant{{[}][}]}}3FooEE"}
-// CHECK: ![[TYPE8]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtNkNvNtC{{[[:print:]]+}}_{{[[:print:]]+}}15defining_module3foo12{{[{}][{}]}}constant{{[}][}]}}3FooES0_E"}
-// CHECK: ![[TYPE9]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtNkNvNtC{{[[:print:]]+}}_{{[[:print:]]+}}15defining_module3foo12{{[{}][{}]}}constant{{[}][}]}}3FooES0_S0_E"}
-// CHECK: ![[TYPE10]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NvNINvNtC{{[[:print:]]+}}_{{[[:print:]]+}}15defining_module3foo8{{[{}][{}]}}impl{{[}][}]}}3barEE"}
-// CHECK: ![[TYPE11]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NvNINvNtC{{[[:print:]]+}}_{{[[:print:]]+}}15defining_module3foo8{{[{}][{}]}}impl{{[}][}]}}3barES0_E"}
-// CHECK: ![[TYPE12]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NvNINvNtC{{[[:print:]]+}}_{{[[:print:]]+}}15defining_module3foo8{{[{}][{}]}}impl{{[}][}]}}3barES0_S0_E"}
+// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NvNFNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo10{{[{}][{}]}}extern{{[}][}]}}3barEE"}
+// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NvNFNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo10{{[{}][{}]}}extern{{[}][}]}}3barES0_E"}
+// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NvNFNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo10{{[{}][{}]}}extern{{[}][}]}}3barES0_S0_E"}
+// CHECK: ![[TYPE4]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtNCNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo11{{[{}][{}]}}closure{{[}][}]}}3FooEE"}
+// CHECK: ![[TYPE5]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtNCNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo11{{[{}][{}]}}closure{{[}][}]}}3FooES0_E"}
+// CHECK: ![[TYPE6]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtNCNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo11{{[{}][{}]}}closure{{[}][}]}}3FooES0_S0_E"}
+// CHECK: ![[TYPE7]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtNkNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo12{{[{}][{}]}}constant{{[}][}]}}3FooEE"}
+// CHECK: ![[TYPE8]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtNkNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo12{{[{}][{}]}}constant{{[}][}]}}3FooES0_E"}
+// CHECK: ![[TYPE9]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtNkNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo12{{[{}][{}]}}constant{{[}][}]}}3FooES0_S0_E"}
+// CHECK: ![[TYPE10]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo8{{[{}][{}]}}impl{{[}][}]}}3barEE"}
+// CHECK: ![[TYPE11]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo8{{[{}][{}]}}impl{{[}][}]}}3barES0_E"}
+// CHECK: ![[TYPE12]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo8{{[{}][{}]}}impl{{[}][}]}}3barES0_S0_E"}
diff --git a/tests/codegen/sanitizer/cfi/external_weak_symbols.rs b/tests/codegen/sanitizer/cfi/external_weak_symbols.rs
new file mode 100644
index 00000000000..00e9b5029af
--- /dev/null
+++ b/tests/codegen/sanitizer/cfi/external_weak_symbols.rs
@@ -0,0 +1,24 @@
+// Verifies that type metadata identifiers for for weakly-linked symbols are
+// emitted correctly.
+//
+//@ needs-sanitizer-cfi
+//@ compile-flags: -Clinker-plugin-lto -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static
+#![crate_type = "bin"]
+#![feature(linkage)]
+
+unsafe extern "C" {
+    #[linkage = "extern_weak"]
+    static FOO: Option<unsafe extern "C" fn(f64) -> ()>;
+}
+// CHECK: @_rust_extern_with_linkage_FOO = internal global ptr @FOO
+
+fn main() {
+    unsafe {
+        if let Some(method) = FOO {
+            method(4.2);
+            // CHECK: call i1 @llvm.type.test(ptr {{%method|%0}}, metadata !"_ZTSFvdE")
+        }
+    }
+}
+
+// CHECK: declare !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} extern_weak void @FOO(double) unnamed_addr #{{[0-9]+}}
diff --git a/tests/codegen/slice-is-ascii.rs b/tests/codegen/slice-is-ascii.rs
index b1e97154609..67537c871a0 100644
--- a/tests/codegen/slice-is-ascii.rs
+++ b/tests/codegen/slice-is-ascii.rs
@@ -1,5 +1,5 @@
 //@ only-x86_64
-//@ compile-flags: -C opt-level=3
+//@ compile-flags: -C opt-level=3 -C target-cpu=x86-64
 #![crate_type = "lib"]
 
 /// Check that the fast-path of `is_ascii` uses a `pmovmskb` instruction.
diff --git a/tests/codegen/try_question_mark_nop.rs b/tests/codegen/try_question_mark_nop.rs
index ca15e510173..3a3453b22b4 100644
--- a/tests/codegen/try_question_mark_nop.rs
+++ b/tests/codegen/try_question_mark_nop.rs
@@ -17,10 +17,10 @@ use std::ptr::NonNull;
 pub fn option_nop_match_32(x: Option<u32>) -> Option<u32> {
     // CHECK: start:
     // TWENTY-NEXT: %[[IS_SOME:.+]] = trunc nuw i32 %0 to i1
-    // TWENTY-NEXT: %.2 = select i1 %[[IS_SOME]], i32 %1, i32 undef
+    // TWENTY-NEXT: %[[PAYLOAD:.+]] = select i1 %[[IS_SOME]], i32 %1, i32 undef
     // CHECK-NEXT: [[REG1:%.*]] = insertvalue { i32, i32 } poison, i32 %0, 0
     // NINETEEN-NEXT: [[REG2:%.*]] = insertvalue { i32, i32 } [[REG1]], i32 %1, 1
-    // TWENTY-NEXT: [[REG2:%.*]] = insertvalue { i32, i32 } [[REG1]], i32 %.2, 1
+    // TWENTY-NEXT: [[REG2:%.*]] = insertvalue { i32, i32 } [[REG1]], i32 %[[PAYLOAD]], 1
     // CHECK-NEXT: ret { i32, i32 } [[REG2]]
     match x {
         Some(x) => Some(x),
@@ -33,7 +33,7 @@ pub fn option_nop_match_32(x: Option<u32>) -> Option<u32> {
 pub fn option_nop_traits_32(x: Option<u32>) -> Option<u32> {
     // CHECK: start:
     // TWENTY-NEXT: %[[IS_SOME:.+]] = trunc nuw i32 %0 to i1
-    // TWENTY-NEXT: %.1 = select i1 %[[IS_SOME]], i32 %1, i32 undef
+    // TWENTY-NEXT: select i1 %[[IS_SOME]], i32 %1, i32 undef
     // CHECK-NEXT: insertvalue { i32, i32 }
     // CHECK-NEXT: insertvalue { i32, i32 }
     // CHECK-NEXT: ret { i32, i32 }
@@ -63,6 +63,57 @@ pub fn result_nop_traits_32(x: Result<i32, u32>) -> Result<i32, u32> {
     try { x? }
 }
 
+// CHECK-LABEL: @control_flow_nop_match_32
+#[no_mangle]
+pub fn control_flow_nop_match_32(x: ControlFlow<i32, u32>) -> ControlFlow<i32, u32> {
+    // CHECK: start:
+    // CHECK-NEXT: insertvalue { i32, i32 }
+    // CHECK-NEXT: insertvalue { i32, i32 }
+    // CHECK-NEXT: ret { i32, i32 }
+    match x {
+        Continue(x) => Continue(x),
+        Break(x) => Break(x),
+    }
+}
+
+// CHECK-LABEL: @control_flow_nop_traits_32
+#[no_mangle]
+pub fn control_flow_nop_traits_32(x: ControlFlow<i32, u32>) -> ControlFlow<i32, u32> {
+    // CHECK: start:
+    // CHECK-NEXT: insertvalue { i32, i32 }
+    // CHECK-NEXT: insertvalue { i32, i32 }
+    // CHECK-NEXT: ret { i32, i32 }
+    try { x? }
+}
+
+// CHECK-LABEL: @option_nop_match_64
+#[no_mangle]
+pub fn option_nop_match_64(x: Option<u64>) -> Option<u64> {
+    // CHECK: start:
+    // TWENTY-NEXT: %[[TRUNC:[0-9]+]] = trunc nuw i64 %0 to i1
+    // TWENTY-NEXT: %[[SEL:\.[0-9]+]] = select i1 %[[TRUNC]], i64 %1, i64 undef
+    // CHECK-NEXT: [[REG1:%[0-9a-zA-Z_.]+]] = insertvalue { i64, i64 } poison, i64 %0, 0
+    // NINETEEN-NEXT: [[REG2:%[0-9a-zA-Z_.]+]] = insertvalue { i64, i64 } [[REG1]], i64 %1, 1
+    // TWENTY-NEXT: [[REG2:%[0-9a-zA-Z_.]+]] = insertvalue { i64, i64 } [[REG1]], i64 %[[SEL]], 1
+    // CHECK-NEXT: ret { i64, i64 } [[REG2]]
+    match x {
+        Some(x) => Some(x),
+        None => None,
+    }
+}
+
+// CHECK-LABEL: @option_nop_traits_64
+#[no_mangle]
+pub fn option_nop_traits_64(x: Option<u64>) -> Option<u64> {
+    // CHECK: start:
+    // TWENTY-NEXT: %[[TRUNC:[0-9]+]] = trunc nuw i64 %0 to i1
+    // TWENTY-NEXT: %[[SEL:\.[0-9]+]] = select i1 %[[TRUNC]], i64 %1, i64 undef
+    // CHECK-NEXT: insertvalue { i64, i64 }
+    // CHECK-NEXT: insertvalue { i64, i64 }
+    // CHECK-NEXT: ret { i64, i64 }
+    try { x? }
+}
+
 // CHECK-LABEL: @result_nop_match_64
 #[no_mangle]
 pub fn result_nop_match_64(x: Result<i64, u64>) -> Result<i64, u64> {
@@ -86,48 +137,98 @@ pub fn result_nop_traits_64(x: Result<i64, u64>) -> Result<i64, u64> {
     try { x? }
 }
 
-// CHECK-LABEL: @result_nop_match_ptr
+// CHECK-LABEL: @control_flow_nop_match_64
 #[no_mangle]
-pub fn result_nop_match_ptr(x: Result<usize, Box<()>>) -> Result<usize, Box<()>> {
+pub fn control_flow_nop_match_64(x: ControlFlow<i64, u64>) -> ControlFlow<i64, u64> {
     // CHECK: start:
-    // CHECK-NEXT: insertvalue { i{{[0-9]+}}, ptr }
-    // CHECK-NEXT: insertvalue { i{{[0-9]+}}, ptr }
-    // CHECK-NEXT: ret
+    // CHECK-NEXT: insertvalue { i64, i64 }
+    // CHECK-NEXT: insertvalue { i64, i64 }
+    // CHECK-NEXT: ret { i64, i64 }
+    match x {
+        Continue(x) => Continue(x),
+        Break(x) => Break(x),
+    }
+}
+
+// CHECK-LABEL: @control_flow_nop_traits_64
+#[no_mangle]
+pub fn control_flow_nop_traits_64(x: ControlFlow<i64, u64>) -> ControlFlow<i64, u64> {
+    // CHECK: start:
+    // CHECK-NEXT: insertvalue { i64, i64 }
+    // CHECK-NEXT: insertvalue { i64, i64 }
+    // CHECK-NEXT: ret { i64, i64 }
+    try { x? }
+}
+
+// CHECK-LABEL: @result_nop_match_128
+#[no_mangle]
+pub fn result_nop_match_128(x: Result<i128, u128>) -> Result<i128, u128> {
+    // CHECK: start:
+    // CHECK-NEXT: getelementptr inbounds {{(nuw )?}}i8
+    // CHECK-NEXT: store i128
+    // CHECK-NEXT: store i128
+    // CHECK-NEXT: ret void
     match x {
         Ok(x) => Ok(x),
         Err(x) => Err(x),
     }
 }
 
-// CHECK-LABEL: @result_nop_traits_ptr
+// CHECK-LABEL: @result_nop_traits_128
 #[no_mangle]
-pub fn result_nop_traits_ptr(x: Result<u64, NonNull<()>>) -> Result<u64, NonNull<()>> {
+pub fn result_nop_traits_128(x: Result<i128, u128>) -> Result<i128, u128> {
     // CHECK: start:
-    // CHECK-NEXT: insertvalue { i{{[0-9]+}}, ptr }
-    // CHECK-NEXT: insertvalue { i{{[0-9]+}}, ptr }
-    // CHECK-NEXT: ret
+    // CHECK-NEXT: getelementptr inbounds {{(nuw )?}}i8
+    // CHECK-NEXT: store i128
+    // CHECK-NEXT: store i128
+    // CHECK-NEXT: ret void
     try { x? }
 }
 
-// CHECK-LABEL: @control_flow_nop_match_32
+// CHECK-LABEL: @control_flow_nop_match_128
 #[no_mangle]
-pub fn control_flow_nop_match_32(x: ControlFlow<i32, u32>) -> ControlFlow<i32, u32> {
+pub fn control_flow_nop_match_128(x: ControlFlow<i128, u128>) -> ControlFlow<i128, u128> {
     // CHECK: start:
-    // CHECK-NEXT: insertvalue { i32, i32 }
-    // CHECK-NEXT: insertvalue { i32, i32 }
-    // CHECK-NEXT: ret { i32, i32 }
+    // CHECK-NEXT: getelementptr inbounds {{(nuw )?}}i8
+    // CHECK-NEXT: store i128
+    // CHECK-NEXT: store i128
+    // CHECK-NEXT: ret void
     match x {
         Continue(x) => Continue(x),
         Break(x) => Break(x),
     }
 }
 
-// CHECK-LABEL: @control_flow_nop_traits_32
+// CHECK-LABEL: @control_flow_nop_traits_128
 #[no_mangle]
-pub fn control_flow_nop_traits_32(x: ControlFlow<i32, u32>) -> ControlFlow<i32, u32> {
+pub fn control_flow_nop_traits_128(x: ControlFlow<i128, u128>) -> ControlFlow<i128, u128> {
     // CHECK: start:
-    // CHECK-NEXT: insertvalue { i32, i32 }
-    // CHECK-NEXT: insertvalue { i32, i32 }
-    // CHECK-NEXT: ret { i32, i32 }
+    // CHECK-NEXT: getelementptr inbounds {{(nuw )?}}i8
+    // CHECK-NEXT: store i128
+    // CHECK-NEXT: store i128
+    // CHECK-NEXT: ret void
+    try { x? }
+}
+
+// CHECK-LABEL: @result_nop_match_ptr
+#[no_mangle]
+pub fn result_nop_match_ptr(x: Result<usize, Box<()>>) -> Result<usize, Box<()>> {
+    // CHECK: start:
+    // CHECK-NEXT: insertvalue { i{{[0-9]+}}, ptr }
+    // CHECK-NEXT: insertvalue { i{{[0-9]+}}, ptr }
+    // CHECK-NEXT: ret
+    match x {
+        Ok(x) => Ok(x),
+        Err(x) => Err(x),
+    }
+}
+
+// CHECK-LABEL: @result_nop_traits_ptr
+#[no_mangle]
+pub fn result_nop_traits_ptr(x: Result<u64, NonNull<()>>) -> Result<u64, NonNull<()>> {
+    // CHECK: start:
+    // CHECK-NEXT: insertvalue { i{{[0-9]+}}, ptr }
+    // CHECK-NEXT: insertvalue { i{{[0-9]+}}, ptr }
+    // CHECK-NEXT: ret
     try { x? }
 }
diff --git a/tests/codegen/uninit-consts.rs b/tests/codegen/uninit-consts.rs
index a58008e171e..bde71a35c47 100644
--- a/tests/codegen/uninit-consts.rs
+++ b/tests/codegen/uninit-consts.rs
@@ -11,15 +11,15 @@ pub struct PartiallyUninit {
     y: MaybeUninit<[u8; 10]>,
 }
 
-// CHECK: [[FULLY_UNINIT:@.*]] = private unnamed_addr constant <{ [10 x i8] }> undef
+// CHECK: [[FULLY_UNINIT:@.*]] = private unnamed_addr constant [10 x i8] undef
 
 // CHECK: [[PARTIALLY_UNINIT:@.*]] = private unnamed_addr constant <{ [4 x i8], [12 x i8] }> <{ [4 x i8] c"{{\\EF\\BE\\AD\\DE|\\DE\\AD\\BE\\EF}}", [12 x i8] undef }>, align 4
 
 // This shouldn't contain undef, since it contains more chunks
 // than the default value of uninit_const_chunk_threshold.
-// CHECK: [[UNINIT_PADDING_HUGE:@.*]] = private unnamed_addr constant <{ [32768 x i8] }> <{ [32768 x i8] c"{{.+}}" }>, align 4
+// CHECK: [[UNINIT_PADDING_HUGE:@.*]] = private unnamed_addr constant [32768 x i8] c"{{.+}}", align 4
 
-// CHECK: [[FULLY_UNINIT_HUGE:@.*]] = private unnamed_addr constant <{ [16384 x i8] }> undef
+// CHECK: [[FULLY_UNINIT_HUGE:@.*]] = private unnamed_addr constant [16384 x i8] undef
 
 // CHECK-LABEL: @fully_uninit
 #[no_mangle]
diff --git a/tests/codegen/uninit-repeat-in-aggregate.rs b/tests/codegen/uninit-repeat-in-aggregate.rs
new file mode 100644
index 00000000000..0fa2eb7d56c
--- /dev/null
+++ b/tests/codegen/uninit-repeat-in-aggregate.rs
@@ -0,0 +1,21 @@
+//@ compile-flags: -Copt-level=3
+
+#![crate_type = "lib"]
+
+use std::mem::MaybeUninit;
+
+// We need to make sure len is at offset 0, otherwise codegen needs an extra instruction
+#[repr(C)]
+pub struct SmallVec<T> {
+    pub len: u64,
+    pub arr: [MaybeUninit<T>; 24],
+}
+
+// CHECK-LABEL: @uninit_arr_via_const
+#[no_mangle]
+pub fn uninit_arr_via_const() -> SmallVec<String> {
+    // CHECK-NEXT: start:
+    // CHECK-NEXT: store i64 0,
+    // CHECK-NEXT: ret
+    SmallVec { len: 0, arr: [const { MaybeUninit::uninit() }; 24] }
+}
diff --git a/tests/codegen/vec-calloc.rs b/tests/codegen/vec-calloc.rs
index 2e2769ce130..d1c320ead01 100644
--- a/tests/codegen/vec-calloc.rs
+++ b/tests/codegen/vec-calloc.rs
@@ -177,6 +177,6 @@ pub fn vec_option_i32(n: usize) -> Vec<Option<i32>> {
 }
 
 // Ensure that __rust_alloc_zeroed gets the right attributes for LLVM to optimize it away.
-// CHECK: declare noalias noundef ptr @__rust_alloc_zeroed(i64 noundef, i64 allocalign noundef) unnamed_addr [[RUST_ALLOC_ZEROED_ATTRS:#[0-9]+]]
+// CHECK: declare noalias noundef ptr @{{.*}}__rust_alloc_zeroed(i64 noundef, i64 allocalign noundef) unnamed_addr [[RUST_ALLOC_ZEROED_ATTRS:#[0-9]+]]
 
 // CHECK-DAG: attributes [[RUST_ALLOC_ZEROED_ATTRS]] = { {{.*}} allockind("alloc,zeroed,aligned") allocsize(0) uwtable "alloc-family"="__rust_alloc" {{.*}} }
diff --git a/tests/codegen/vec-optimizes-away.rs b/tests/codegen/vec-optimizes-away.rs
index 39d5c1614c8..f6ed2898bda 100644
--- a/tests/codegen/vec-optimizes-away.rs
+++ b/tests/codegen/vec-optimizes-away.rs
@@ -5,7 +5,7 @@
 pub fn sum_me() -> i32 {
     // CHECK-LABEL: @sum_me
     // CHECK-NEXT: {{^.*:$}}
-    // CHECK-NEXT: {{.*}} load volatile i8, ptr @__rust_no_alloc_shim_is_unstable, align 1
+    // CHECK-NEXT: {{.*}} load volatile i8, ptr @{{.*}}__rust_no_alloc_shim_is_unstable, align 1
     // CHECK-NEXT: ret i32 6
     vec![1, 2, 3].iter().sum::<i32>()
 }
diff --git a/tests/coverage-run-rustdoc/doctest.coverage b/tests/coverage-run-rustdoc/doctest.coverage
index f007eb0cade..0fa94361c47 100644
--- a/tests/coverage-run-rustdoc/doctest.coverage
+++ b/tests/coverage-run-rustdoc/doctest.coverage
@@ -58,21 +58,21 @@ $DIR/doctest.rs:
    LL|       |//!
    LL|       |//! doctest with custom main:
    LL|       |//! ```
-   LL|      1|//! fn some_func() {
-   LL|      1|//!     println!("called some_func()");
-   LL|      1|//! }
-   LL|       |//!
-   LL|       |//! #[derive(Debug)]
-   LL|       |//! struct SomeError;
+   LL|       |//! fn some_func() {
+   LL|       |//!     println!("called some_func()");
+   LL|       |//! }
+   LL|      1|//!
+   LL|      1|//! #[derive(Debug)]
+   LL|      1|//! struct SomeError;
    LL|       |//!
    LL|       |//! extern crate doctest_crate;
    LL|       |//!
-   LL|      1|//! fn doctest_main() -> Result<(), SomeError> {
+   LL|       |//! fn doctest_main() -> Result<(), SomeError> {
    LL|      1|//!     some_func();
    LL|      1|//!     doctest_crate::fn_run_in_doctests(2);
    LL|      1|//!     Ok(())
    LL|      1|//! }
-   LL|       |//!
+   LL|      1|//!
    LL|       |//! // this `main` is not shown as covered, as it clashes with all the other
    LL|       |//! // `main` functions that were automatically generated for doctests
    LL|       |//! fn main() -> Result<(), SomeError> {
diff --git a/tests/coverage/async_closure.cov-map b/tests/coverage/async_closure.cov-map
index 9144a938a9e..0e1d9877830 100644
--- a/tests/coverage/async_closure.cov-map
+++ b/tests/coverage/async_closure.cov-map
@@ -38,21 +38,21 @@ Number of file 0 mappings: 1
 - Code(Counter(0)) at (prev + 11, 35) to (start + 0, 36)
 Highest counter ID seen: c0
 
-Function name: async_closure::main::{closure#0}::{closure#0}::<i16>
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 0b, 22, 00, 24]
+Function name: async_closure::main::{closure#0}
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 0b, 23, 00, 24]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 0
 Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 11, 34) to (start + 0, 36)
+- Code(Counter(0)) at (prev + 11, 35) to (start + 0, 36)
 Highest counter ID seen: c0
 
-Function name: async_closure::main::{closure#0}::{closure#1}::<i32>
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 0b, 23, 00, 24]
+Function name: async_closure::main::{closure#0}::{closure#0}::<i16>
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 0b, 22, 00, 24]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 0
 Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 11, 35) to (start + 0, 36)
+- Code(Counter(0)) at (prev + 11, 34) to (start + 0, 36)
 Highest counter ID seen: c0
 
diff --git a/tests/coverage/async_closure.coverage b/tests/coverage/async_closure.coverage
index 7fbea265812..10a8ea14504 100644
--- a/tests/coverage/async_closure.coverage
+++ b/tests/coverage/async_closure.coverage
@@ -14,7 +14,7 @@
   | async_closure::main::{closure#0}:
   |   LL|      1|    let async_closure = async || {};
   ------------------
-  | async_closure::main::{closure#0}::{closure#1}::<i32>:
+  | async_closure::main::{closure#0}:
   |   LL|      1|    let async_closure = async || {};
   ------------------
    LL|      1|    executor::block_on(async_closure());
diff --git a/tests/crashes/120016.rs b/tests/crashes/120016.rs
index 09175689256..faba1af91b4 100644
--- a/tests/crashes/120016.rs
+++ b/tests/crashes/120016.rs
@@ -6,6 +6,7 @@
 struct Bug {
     V1: [(); {
         type F = impl std::future::Future<Output = impl Sized>;
+        #[define_opaque(F)]
         fn concrete_use() -> F {
             //~^ ERROR to be a future that resolves to `u8`, but it resolves to `()`
             async {}
diff --git a/tests/crashes/122904-2.rs b/tests/crashes/122904-2.rs
index 85ed91c2fa4..db66b8625db 100644
--- a/tests/crashes/122904-2.rs
+++ b/tests/crashes/122904-2.rs
@@ -6,10 +6,12 @@ type Alias<'a> = impl T;
 struct S;
 impl<'a> T for &'a S {}
 
+#[define_opaque(Alias)]
 fn with_positive(fun: impl Fn(Alias<'_>)) {
     with_positive(|&n| ());
 }
 
+#[define_opaque(Alias)]
 fn main(Alias<'_>) {
     with_positive(|&a| ());
 }
diff --git a/tests/crashes/122904.rs b/tests/crashes/122904.rs
deleted file mode 100644
index 8b8bb35d56c..00000000000
--- a/tests/crashes/122904.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-//@ known-bug: #122904
-trait T {}
-
-type Alias<'a> = impl T;
-
-struct S;
-impl<'a> T for &'a S {}
-
-fn with_positive(fun: impl Fn(Alias<'_>)) {
-    with_positive(|&n| ());
-}
diff --git a/tests/crashes/125059.rs b/tests/crashes/125059.rs
deleted file mode 100644
index 7e9f7414816..00000000000
--- a/tests/crashes/125059.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-//@ known-bug: rust-lang/rust#125059
-#![feature(deref_patterns)]
-#![allow(incomplete_features)]
-
-fn simple_vec(vec: Vec<u32>) -> u32 {
-   (|| match Vec::<u32>::new() {
-        deref!([]) => 100,
-        _ => 2000,
-    })()
-}
-
-fn main() {}
diff --git a/tests/crashes/125185.rs b/tests/crashes/125185.rs
index 8693d6c7662..e77666ca73d 100644
--- a/tests/crashes/125185.rs
+++ b/tests/crashes/125185.rs
@@ -1,16 +1,26 @@
 //@ known-bug: rust-lang/rust#125185
 //@ compile-flags: -Zvalidate-mir
 
+#![feature(type_alias_impl_trait)]
+
 type Foo = impl Send;
 
 struct A;
 
-const VALUE: Foo = value();
+#[define_opaque(Foo)]
+const fn foo() -> Foo {
+    value()
+}
+
+const VALUE: Foo = foo();
 
-fn test(foo: Foo<'a>, f: impl for<'b> FnMut()) {
+#[define_opaque(Foo)]
+fn test(foo: Foo, f: impl for<'b> FnMut()) {
     match VALUE {
         0 | 0 => {}
 
         _ => (),
     }
 }
+
+fn main() {}
diff --git a/tests/crashes/126680.rs b/tests/crashes/126680.rs
index b1566d5e6be..dcb6ccad6b4 100644
--- a/tests/crashes/126680.rs
+++ b/tests/crashes/126680.rs
@@ -8,14 +8,18 @@ use std::path::Path;
 struct A {
     pub func: fn(check: Bar, b: Option<&Path>),
 }
-const MY_A: A = A {
-    func: |check, b| {
-        if check {
-            ()
-        } else if let Some(_) = b.and_then(|p| p.parent()) {
-            ()
-        }
-    },
-};
+
+#[define_opaque(Bar)]
+fn foo() -> A {
+    A {
+        func: |check, b| {
+            if check {
+                ()
+            } else if let Some(_) = b.and_then(|p| p.parent()) {
+                ()
+            }
+        },
+    }
+}
 
 fn main() {}
diff --git a/tests/crashes/131298.rs b/tests/crashes/131298.rs
deleted file mode 100644
index 833f1b04ffa..00000000000
--- a/tests/crashes/131298.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-//@ known-bug: #131298
-
-fn dyn_hoops<T>() -> *const dyn Iterator<Item = impl Captures> {
-    loop {}
-}
-
-mod typeck {
-    type Opaque = impl Sized;
-    fn define() -> Opaque {
-        let _: Opaque = super::dyn_hoops::<u8>();
-    }
-}
diff --git a/tests/crashes/131886.rs b/tests/crashes/131886.rs
index 2c692dfb777..16cb815f1c2 100644
--- a/tests/crashes/131886.rs
+++ b/tests/crashes/131886.rs
@@ -1,5 +1,5 @@
 //@ known-bug: #131886
-//@ compile-flags: -Zvalidate-mir --crate-type=lib
+//@ compile-flags: -Zvalidate-mir
 #![feature(type_alias_impl_trait)]
 
 type Tait = impl Sized;
@@ -7,6 +7,9 @@ type Tait = impl Sized;
 trait Foo<'a>: Bar<'a, 'a, Tait> {}
 trait Bar<'a, 'b, T> {}
 
+#[define_opaque(Tait)]
 fn test_correct3<'a>(x: &dyn Foo<'a>, _: Tait) {
     let _ = x as &dyn Bar<'_, '_, ()>;
 }
+
+fn main() {}
diff --git a/tests/crashes/132826.rs b/tests/crashes/132826.rs
deleted file mode 100644
index 9889cecdac5..00000000000
--- a/tests/crashes/132826.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-//@ known-bug: #132826
-pub trait MyTrait {
-    type Item;
-}
-
-impl<K> MyTrait for Vec<K> {
-    type Item = Vec<K>;
-}
-
-impl<K> From<Vec<K>> for <Vec<K> as MyTrait>::Item {}
diff --git a/tests/crashes/135528.rs b/tests/crashes/135528.rs
index a1418f40be6..171550e209e 100644
--- a/tests/crashes/135528.rs
+++ b/tests/crashes/135528.rs
@@ -7,10 +7,12 @@ fn set(x: &isize) -> isize {
     *x
 }
 
+#[define_opaque(Tait)]
 fn d(x: Tait) {
     set(x);
 }
 
+#[define_opaque(Tait)]
 fn other_define() -> Tait {
     ()
 }
diff --git a/tests/crashes/136286.rs b/tests/crashes/136286.rs
deleted file mode 100644
index f0ea14bd167..00000000000
--- a/tests/crashes/136286.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-//@ known-bug: #136286
-//@ compile-flags: --edition=2024
-
-#![feature(async_fn_in_dyn_trait)]
-trait A {
-    async fn b(self: A);
-}
diff --git a/tests/crashes/137049.rs b/tests/crashes/137049.rs
index a7132e4fa17..3dbbf280733 100644
--- a/tests/crashes/137049.rs
+++ b/tests/crashes/137049.rs
@@ -22,6 +22,7 @@ impl<T: Project1<Assoc1 = ()>> Project2 for PhantomData<T> {
 
 type Alias<T> = impl Project2;
 
+#[define_opaque(Alias)]
 fn constrain<T>() -> Alias<T> {
     PhantomData::<T>
 }
diff --git a/tests/crashes/137706.rs b/tests/crashes/137706.rs
deleted file mode 100644
index 0b46f9c237a..00000000000
--- a/tests/crashes/137706.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-//@ known-bug: #137706
-//@ needs-rustc-debug-assertions
-trait A {
-    fn b() -> impl IntoIterator<Item = ()>;
-}
-
-impl A<()> for dyn A {}
diff --git a/tests/crashes/137865.rs b/tests/crashes/137865.rs
deleted file mode 100644
index 7ecd8c734d3..00000000000
--- a/tests/crashes/137865.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-//@ known-bug: #137865
-trait Foo {
-    type Assoc<const N: Self>;
-    fn foo() -> Self::Assoc<3>;
-}
diff --git a/tests/crashes/137895.rs b/tests/crashes/137895.rs
deleted file mode 100644
index bb624d2e9fa..00000000000
--- a/tests/crashes/137895.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-//@ known-bug: #137895
-trait A {
-    fn b() -> impl ?Sized + 'a;
-}
-
-impl A for dyn A {}
diff --git a/tests/crashes/138048.rs b/tests/crashes/138048.rs
deleted file mode 100644
index fd59f46c752..00000000000
--- a/tests/crashes/138048.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-//@ known-bug: #138048
-struct Foo;
-
-impl<'b> Foo {
-    fn bar<const V: u8>() {
-        let V;
-    }
-}
diff --git a/tests/debuginfo/pretty-huge-vec.rs b/tests/debuginfo/pretty-huge-vec.rs
index 093fbc5b12d..6938158e365 100644
--- a/tests/debuginfo/pretty-huge-vec.rs
+++ b/tests/debuginfo/pretty-huge-vec.rs
@@ -1,5 +1,6 @@
 //@ ignore-windows-gnu: #128981
 //@ ignore-android: FIXME(#10381)
+//@ ignore-aix: FIXME(#137965)
 //@ compile-flags:-g
 
 // === GDB TESTS ===================================================================================
diff --git a/tests/incremental/define-opaques.rs b/tests/incremental/define-opaques.rs
new file mode 100644
index 00000000000..d6eae238341
--- /dev/null
+++ b/tests/incremental/define-opaques.rs
@@ -0,0 +1,19 @@
+//@ revisions: rpass1 cfail2
+
+#![feature(type_alias_impl_trait)]
+
+pub type Foo = impl Sized;
+
+#[cfg_attr(rpass1, define_opaque())]
+#[cfg_attr(cfail2, define_opaque(Foo))]
+fn a() {
+    //[cfail2]~^ ERROR item does not constrain `Foo::{opaque#0}`
+    let _: Foo = b();
+}
+
+#[define_opaque(Foo)]
+fn b() -> Foo {
+    ()
+}
+
+fn main() {}
diff --git a/tests/incremental/delayed_span_bug.rs b/tests/incremental/delayed_span_bug.rs
index 958e9dd07e2..1534aca5ddd 100644
--- a/tests/incremental/delayed_span_bug.rs
+++ b/tests/incremental/delayed_span_bug.rs
@@ -1,8 +1,8 @@
 //@ revisions: cfail1 cfail2
 //@ should-ice
-//@ error-pattern: delayed bug triggered by #[rustc_error(delayed_bug_from_inside_query)]
+//@ error-pattern: delayed bug triggered by #[rustc_delayed_bug_from_inside_query]
 
 #![feature(rustc_attrs)]
 
-#[rustc_error(delayed_bug_from_inside_query)]
+#[rustc_delayed_bug_from_inside_query]
 fn main() {}
diff --git a/tests/incremental/env/env_macro.rs b/tests/incremental/env/env_macro.rs
new file mode 100644
index 00000000000..0c026328874
--- /dev/null
+++ b/tests/incremental/env/env_macro.rs
@@ -0,0 +1,18 @@
+// Check that changes to environment variables are propagated to `env!`.
+//
+// This test is intentionally written to not use any `#[cfg(rpass*)]`, to
+// _really_ test that we re-compile if the environment variable changes.
+
+//@ revisions: cfail1 rpass2 rpass3 cfail4
+//@ [cfail1]unset-rustc-env:EXAMPLE_ENV
+//@ [rpass2]rustc-env:EXAMPLE_ENV=one
+//@ [rpass2]exec-env:EXAMPLE_ENV=one
+//@ [rpass3]rustc-env:EXAMPLE_ENV=two
+//@ [rpass3]exec-env:EXAMPLE_ENV=two
+//@ [cfail4]unset-rustc-env:EXAMPLE_ENV
+
+fn main() {
+    assert_eq!(env!("EXAMPLE_ENV"), std::env::var("EXAMPLE_ENV").unwrap());
+    //[cfail1]~^ ERROR environment variable `EXAMPLE_ENV` not defined at compile time
+    //[cfail4]~^^ ERROR environment variable `EXAMPLE_ENV` not defined at compile time
+}
diff --git a/tests/incremental/env/option_env_macro.rs b/tests/incremental/env/option_env_macro.rs
new file mode 100644
index 00000000000..44c3bfd69e0
--- /dev/null
+++ b/tests/incremental/env/option_env_macro.rs
@@ -0,0 +1,18 @@
+// Check that changes to environment variables are propagated to `option_env!`.
+//
+// This test is intentionally written to not use any `#[cfg(rpass*)]`, to
+// _really_ test that we re-compile if the environment variable changes.
+
+//@ revisions: rpass1 rpass2 rpass3 rpass4
+//@ [rpass1]unset-rustc-env:EXAMPLE_ENV
+//@ [rpass1]unset-exec-env:EXAMPLE_ENV
+//@ [rpass2]rustc-env:EXAMPLE_ENV=one
+//@ [rpass2]exec-env:EXAMPLE_ENV=one
+//@ [rpass3]rustc-env:EXAMPLE_ENV=two
+//@ [rpass3]exec-env:EXAMPLE_ENV=two
+//@ [rpass4]unset-rustc-env:EXAMPLE_ENV
+//@ [rpass4]unset-exec-env:EXAMPLE_ENV
+
+fn main() {
+    assert_eq!(option_env!("EXAMPLE_ENV"), std::env::var("EXAMPLE_ENV").ok().as_deref());
+}
diff --git a/tests/incremental/user-written-closure-synthetic-closure-conflict.rs b/tests/incremental/user-written-closure-synthetic-closure-conflict.rs
new file mode 100644
index 00000000000..618604d06b1
--- /dev/null
+++ b/tests/incremental/user-written-closure-synthetic-closure-conflict.rs
@@ -0,0 +1,15 @@
+//@ revisions: rpass1 rpass2
+//@ edition: 2024
+
+#![allow(unused)]
+
+fn main() {
+    #[cfg(rpass1)]
+    async || {};
+
+    #[cfg(rpass2)]
+    || {
+        || ();
+        || ();
+    };
+}
diff --git a/tests/mir-opt/async_closure_fake_read_for_by_move.foo-{closure#0}-{closure#0}.built.after.mir b/tests/mir-opt/async_closure_fake_read_for_by_move.foo-{closure#0}-{closure#0}.built.after.mir
new file mode 100644
index 00000000000..0c8a17ff70b
--- /dev/null
+++ b/tests/mir-opt/async_closure_fake_read_for_by_move.foo-{closure#0}-{closure#0}.built.after.mir
@@ -0,0 +1,81 @@
+// MIR for `foo::{closure#0}::{closure#0}` after built
+
+fn foo::{closure#0}::{closure#0}(_1: {async closure body@$DIR/async_closure_fake_read_for_by_move.rs:12:27: 15:6}, _2: ResumeTy) -> ()
+yields ()
+ {
+    debug _task_context => _2;
+    debug f => (*(_1.0: &&Foo));
+    let mut _0: ();
+    let mut _3: &Foo;
+    let mut _4: &&Foo;
+    let mut _5: &&&Foo;
+    let mut _6: isize;
+    let mut _7: bool;
+
+    bb0: {
+        PlaceMention((*(_1.0: &&Foo)));
+        _6 = discriminant((*(*(_1.0: &&Foo))));
+        switchInt(move _6) -> [0: bb2, otherwise: bb1];
+    }
+
+    bb1: {
+        _0 = const ();
+        goto -> bb10;
+    }
+
+    bb2: {
+        falseEdge -> [real: bb5, imaginary: bb1];
+    }
+
+    bb3: {
+        goto -> bb1;
+    }
+
+    bb4: {
+        FakeRead(ForMatchedPlace(None), (*(_1.0: &&Foo)));
+        unreachable;
+    }
+
+    bb5: {
+        _3 = &fake shallow (*(*(_1.0: &&Foo)));
+        _4 = &fake shallow (*(_1.0: &&Foo));
+        _5 = &fake shallow (_1.0: &&Foo);
+        StorageLive(_7);
+        _7 = const true;
+        switchInt(move _7) -> [0: bb8, otherwise: bb7];
+    }
+
+    bb6: {
+        falseEdge -> [real: bb3, imaginary: bb1];
+    }
+
+    bb7: {
+        StorageDead(_7);
+        FakeRead(ForMatchGuard, _3);
+        FakeRead(ForMatchGuard, _4);
+        FakeRead(ForMatchGuard, _5);
+        _0 = const ();
+        goto -> bb10;
+    }
+
+    bb8: {
+        goto -> bb9;
+    }
+
+    bb9: {
+        StorageDead(_7);
+        goto -> bb6;
+    }
+
+    bb10: {
+        drop(_1) -> [return: bb11, unwind: bb12];
+    }
+
+    bb11: {
+        return;
+    }
+
+    bb12 (cleanup): {
+        resume;
+    }
+}
diff --git a/tests/mir-opt/async_closure_fake_read_for_by_move.foo-{closure#0}-{synthetic#0}.built.after.mir b/tests/mir-opt/async_closure_fake_read_for_by_move.foo-{closure#0}-{synthetic#0}.built.after.mir
new file mode 100644
index 00000000000..9070c95bca4
--- /dev/null
+++ b/tests/mir-opt/async_closure_fake_read_for_by_move.foo-{closure#0}-{synthetic#0}.built.after.mir
@@ -0,0 +1,64 @@
+// MIR for `foo::{closure#0}::{synthetic#0}` after built
+
+fn foo::{closure#0}::{synthetic#0}(_1: {async closure body@$DIR/async_closure_fake_read_for_by_move.rs:12:27: 15:6}, _2: ResumeTy) -> ()
+yields ()
+ {
+    debug _task_context => _2;
+    debug f => (_1.0: &Foo);
+    let mut _0: ();
+    let mut _3: &Foo;
+    let mut _4: &&Foo;
+    let mut _5: &&&Foo;
+    let mut _6: isize;
+    let mut _7: bool;
+
+    bb0: {
+        PlaceMention((_1.0: &Foo));
+        _6 = discriminant((*(_1.0: &Foo)));
+        switchInt(move _6) -> [0: bb2, otherwise: bb1];
+    }
+
+    bb1: {
+        _0 = const ();
+        goto -> bb6;
+    }
+
+    bb2: {
+        falseEdge -> [real: bb3, imaginary: bb1];
+    }
+
+    bb3: {
+        _3 = &fake shallow (*(_1.0: &Foo));
+        _4 = &fake shallow (_1.0: &Foo);
+        nop;
+        StorageLive(_7);
+        _7 = const true;
+        switchInt(move _7) -> [0: bb5, otherwise: bb4];
+    }
+
+    bb4: {
+        StorageDead(_7);
+        FakeRead(ForMatchGuard, _3);
+        FakeRead(ForMatchGuard, _4);
+        FakeRead(ForMatchGuard, _5);
+        _0 = const ();
+        goto -> bb6;
+    }
+
+    bb5: {
+        StorageDead(_7);
+        falseEdge -> [real: bb1, imaginary: bb1];
+    }
+
+    bb6: {
+        drop(_1) -> [return: bb7, unwind: bb8];
+    }
+
+    bb7: {
+        return;
+    }
+
+    bb8 (cleanup): {
+        resume;
+    }
+}
diff --git a/tests/mir-opt/async_closure_fake_read_for_by_move.rs b/tests/mir-opt/async_closure_fake_read_for_by_move.rs
new file mode 100644
index 00000000000..e78671f5e9d
--- /dev/null
+++ b/tests/mir-opt/async_closure_fake_read_for_by_move.rs
@@ -0,0 +1,18 @@
+//@ edition:2021
+// skip-filecheck
+
+enum Foo {
+    Bar,
+    Baz,
+}
+
+// EMIT_MIR async_closure_fake_read_for_by_move.foo-{closure#0}-{closure#0}.built.after.mir
+// EMIT_MIR async_closure_fake_read_for_by_move.foo-{closure#0}-{synthetic#0}.built.after.mir
+fn foo(f: &Foo) {
+    let x = async move || match f {
+        Foo::Bar if true => {}
+        _ => {}
+    };
+}
+
+fn main() {}
diff --git a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}-{closure#1}.built.after.mir b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}-{synthetic#0}.built.after.mir
index a9e08d2e8f6..c5f538e5ecd 100644
--- a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}-{closure#1}.built.after.mir
+++ b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}-{synthetic#0}.built.after.mir
@@ -1,6 +1,6 @@
-// MIR for `main::{closure#0}::{closure#0}::{closure#1}` after built
+// MIR for `main::{closure#0}::{closure#0}::{synthetic#0}` after built
 
-fn main::{closure#0}::{closure#0}::{closure#1}(_1: {async closure body@$DIR/async_closure_shims.rs:53:53: 56:10}, _2: ResumeTy) -> ()
+fn main::{closure#0}::{closure#0}::{synthetic#0}(_1: {async closure body@$DIR/async_closure_shims.rs:53:53: 56:10}, _2: ResumeTy) -> ()
 yields ()
  {
     debug _task_context => _2;
diff --git a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}-{closure#1}.built.after.mir b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}-{synthetic#0}.built.after.mir
index 4452ae7812e..e295f9b3cf1 100644
--- a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}-{closure#1}.built.after.mir
+++ b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}-{synthetic#0}.built.after.mir
@@ -1,6 +1,6 @@
-// MIR for `main::{closure#0}::{closure#1}::{closure#1}` after built
+// MIR for `main::{closure#0}::{closure#1}::{synthetic#0}` after built
 
-fn main::{closure#0}::{closure#1}::{closure#1}(_1: {async closure body@$DIR/async_closure_shims.rs:62:48: 65:10}, _2: ResumeTy) -> ()
+fn main::{closure#0}::{closure#1}::{synthetic#0}(_1: {async closure body@$DIR/async_closure_shims.rs:62:48: 65:10}, _2: ResumeTy) -> ()
 yields ()
  {
     debug _task_context => _2;
diff --git a/tests/mir-opt/async_closure_shims.rs b/tests/mir-opt/async_closure_shims.rs
index cd2e83e939a..93cc7834a64 100644
--- a/tests/mir-opt/async_closure_shims.rs
+++ b/tests/mir-opt/async_closure_shims.rs
@@ -42,11 +42,11 @@ async fn call_normal_mut<F: Future<Output = ()>>(f: &mut impl FnMut(i32) -> F) {
 
 // EMIT_MIR async_closure_shims.main-{closure#0}-{closure#0}.coroutine_closure_by_move.0.mir
 // EMIT_MIR async_closure_shims.main-{closure#0}-{closure#0}-{closure#0}.built.after.mir
-// EMIT_MIR async_closure_shims.main-{closure#0}-{closure#0}-{closure#1}.built.after.mir
+// EMIT_MIR async_closure_shims.main-{closure#0}-{closure#0}-{synthetic#0}.built.after.mir
 // EMIT_MIR async_closure_shims.main-{closure#0}-{closure#1}.coroutine_closure_by_ref.0.mir
 // EMIT_MIR async_closure_shims.main-{closure#0}-{closure#1}.coroutine_closure_by_move.0.mir
 // EMIT_MIR async_closure_shims.main-{closure#0}-{closure#1}-{closure#0}.built.after.mir
-// EMIT_MIR async_closure_shims.main-{closure#0}-{closure#1}-{closure#1}.built.after.mir
+// EMIT_MIR async_closure_shims.main-{closure#0}-{closure#1}-{synthetic#0}.built.after.mir
 pub fn main() {
     block_on(async {
         let b = 2i32;
diff --git a/tests/mir-opt/building/user_type_annotations.let_else.built.after.mir b/tests/mir-opt/building/user_type_annotations.let_else.built.after.mir
new file mode 100644
index 00000000000..3a515787c10
--- /dev/null
+++ b/tests/mir-opt/building/user_type_annotations.let_else.built.after.mir
@@ -0,0 +1,80 @@
+// MIR for `let_else` after built
+
+| User Type Annotations
+| 0: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:35:20: 35:45, inferred_ty: (u32, u64, &char)
+| 1: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:35:20: 35:45, inferred_ty: (u32, u64, &char)
+|
+fn let_else() -> () {
+    let mut _0: ();
+    let mut _1: !;
+    let _2: u32 as UserTypeProjection { base: UserType(0), projs: [Field(0, ())] };
+    let _3: u64 as UserTypeProjection { base: UserType(0), projs: [Field(1, ())] };
+    let _4: &char as UserTypeProjection { base: UserType(0), projs: [Field(2, ())] };
+    let mut _5: (u32, u64, &char);
+    let mut _6: &char;
+    let _7: &char;
+    let _8: char;
+    scope 1 {
+        debug x => _2;
+        debug y => _3;
+        debug z => _4;
+    }
+
+    bb0: {
+        StorageLive(_2);
+        StorageLive(_3);
+        StorageLive(_4);
+        StorageLive(_5);
+        StorageLive(_6);
+        StorageLive(_7);
+        StorageLive(_8);
+        _8 = const 'u';
+        _7 = &_8;
+        _6 = &(*_7);
+        _5 = (const 7_u32, const 12_u64, move _6);
+        StorageDead(_6);
+        PlaceMention(_5);
+        falseEdge -> [real: bb4, imaginary: bb3];
+    }
+
+    bb1: {
+        _1 = core::panicking::panic(const "internal error: entered unreachable code") -> bb6;
+    }
+
+    bb2: {
+        unreachable;
+    }
+
+    bb3: {
+        goto -> bb5;
+    }
+
+    bb4: {
+        AscribeUserType(_5, +, UserTypeProjection { base: UserType(1), projs: [] });
+        _2 = copy (_5.0: u32);
+        _3 = copy (_5.1: u64);
+        _4 = copy (_5.2: &char);
+        StorageDead(_7);
+        StorageDead(_5);
+        _0 = const ();
+        StorageDead(_8);
+        StorageDead(_4);
+        StorageDead(_3);
+        StorageDead(_2);
+        return;
+    }
+
+    bb5: {
+        StorageDead(_7);
+        StorageDead(_5);
+        StorageDead(_8);
+        StorageDead(_4);
+        StorageDead(_3);
+        StorageDead(_2);
+        goto -> bb1;
+    }
+
+    bb6 (cleanup): {
+        resume;
+    }
+}
diff --git a/tests/mir-opt/building/user_type_annotations.let_else_bindless.built.after.mir b/tests/mir-opt/building/user_type_annotations.let_else_bindless.built.after.mir
new file mode 100644
index 00000000000..52a6d904d45
--- /dev/null
+++ b/tests/mir-opt/building/user_type_annotations.let_else_bindless.built.after.mir
@@ -0,0 +1,62 @@
+// MIR for `let_else_bindless` after built
+
+| User Type Annotations
+| 0: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:40:20: 40:45, inferred_ty: (u32, u64, &char)
+| 1: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:40:20: 40:45, inferred_ty: (u32, u64, &char)
+|
+fn let_else_bindless() -> () {
+    let mut _0: ();
+    let mut _1: !;
+    let mut _2: (u32, u64, &char);
+    let mut _3: &char;
+    let _4: &char;
+    let _5: char;
+    scope 1 {
+    }
+
+    bb0: {
+        StorageLive(_2);
+        StorageLive(_3);
+        StorageLive(_4);
+        StorageLive(_5);
+        _5 = const 'u';
+        _4 = &_5;
+        _3 = &(*_4);
+        _2 = (const 7_u32, const 12_u64, move _3);
+        StorageDead(_3);
+        PlaceMention(_2);
+        falseEdge -> [real: bb4, imaginary: bb3];
+    }
+
+    bb1: {
+        _1 = core::panicking::panic(const "internal error: entered unreachable code") -> bb6;
+    }
+
+    bb2: {
+        unreachable;
+    }
+
+    bb3: {
+        goto -> bb5;
+    }
+
+    bb4: {
+        AscribeUserType(_2, +, UserTypeProjection { base: UserType(1), projs: [] });
+        StorageDead(_4);
+        StorageDead(_2);
+        _0 = const ();
+        StorageDead(_5);
+        return;
+    }
+
+    bb5: {
+        StorageDead(_4);
+        StorageDead(_2);
+        StorageDead(_5);
+        goto -> bb1;
+    }
+
+    bb6 (cleanup): {
+        resume;
+    }
+}
diff --git a/tests/mir-opt/building/user_type_annotations.let_init.built.after.mir b/tests/mir-opt/building/user_type_annotations.let_init.built.after.mir
new file mode 100644
index 00000000000..d1b8f823e9b
--- /dev/null
+++ b/tests/mir-opt/building/user_type_annotations.let_init.built.after.mir
@@ -0,0 +1,54 @@
+// MIR for `let_init` after built
+
+| User Type Annotations
+| 0: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:25:20: 25:45, inferred_ty: (u32, u64, &char)
+| 1: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:25:20: 25:45, inferred_ty: (u32, u64, &char)
+|
+fn let_init() -> () {
+    let mut _0: ();
+    let _1: u32 as UserTypeProjection { base: UserType(0), projs: [Field(0, ())] };
+    let _2: u64 as UserTypeProjection { base: UserType(0), projs: [Field(1, ())] };
+    let _3: &char as UserTypeProjection { base: UserType(0), projs: [Field(2, ())] };
+    let mut _4: (u32, u64, &char);
+    let mut _5: &char;
+    let _6: &char;
+    let _7: char;
+    scope 1 {
+        debug x => _1;
+        debug y => _2;
+        debug z => _3;
+    }
+
+    bb0: {
+        StorageLive(_4);
+        StorageLive(_5);
+        StorageLive(_6);
+        StorageLive(_7);
+        _7 = const 'u';
+        _6 = &_7;
+        _5 = &(*_6);
+        _4 = (const 7_u32, const 12_u64, move _5);
+        StorageDead(_5);
+        PlaceMention(_4);
+        AscribeUserType(_4, +, UserTypeProjection { base: UserType(1), projs: [] });
+        StorageLive(_1);
+        _1 = copy (_4.0: u32);
+        StorageLive(_2);
+        _2 = copy (_4.1: u64);
+        StorageLive(_3);
+        _3 = copy (_4.2: &char);
+        StorageDead(_6);
+        StorageDead(_4);
+        _0 = const ();
+        StorageDead(_3);
+        StorageDead(_2);
+        StorageDead(_1);
+        StorageDead(_7);
+        return;
+    }
+
+    bb1: {
+        FakeRead(ForMatchedPlace(None), _4);
+        unreachable;
+    }
+}
diff --git a/tests/mir-opt/building/user_type_annotations.let_init_bindless.built.after.mir b/tests/mir-opt/building/user_type_annotations.let_init_bindless.built.after.mir
new file mode 100644
index 00000000000..6702f930060
--- /dev/null
+++ b/tests/mir-opt/building/user_type_annotations.let_init_bindless.built.after.mir
@@ -0,0 +1,39 @@
+// MIR for `let_init_bindless` after built
+
+| User Type Annotations
+| 0: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:30:20: 30:45, inferred_ty: (u32, u64, &char)
+| 1: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:30:20: 30:45, inferred_ty: (u32, u64, &char)
+|
+fn let_init_bindless() -> () {
+    let mut _0: ();
+    let mut _1: (u32, u64, &char);
+    let mut _2: &char;
+    let _3: &char;
+    let _4: char;
+    scope 1 {
+    }
+
+    bb0: {
+        StorageLive(_1);
+        StorageLive(_2);
+        StorageLive(_3);
+        StorageLive(_4);
+        _4 = const 'u';
+        _3 = &_4;
+        _2 = &(*_3);
+        _1 = (const 7_u32, const 12_u64, move _2);
+        StorageDead(_2);
+        PlaceMention(_1);
+        AscribeUserType(_1, +, UserTypeProjection { base: UserType(1), projs: [] });
+        StorageDead(_3);
+        StorageDead(_1);
+        _0 = const ();
+        StorageDead(_4);
+        return;
+    }
+
+    bb1: {
+        FakeRead(ForMatchedPlace(None), _1);
+        unreachable;
+    }
+}
diff --git a/tests/mir-opt/building/user_type_annotations.let_uninit.built.after.mir b/tests/mir-opt/building/user_type_annotations.let_uninit.built.after.mir
new file mode 100644
index 00000000000..76b5938b87d
--- /dev/null
+++ b/tests/mir-opt/building/user_type_annotations.let_uninit.built.after.mir
@@ -0,0 +1,27 @@
+// MIR for `let_uninit` after built
+
+| User Type Annotations
+| 0: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:15:20: 15:45, inferred_ty: (u32, u64, &char)
+|
+fn let_uninit() -> () {
+    let mut _0: ();
+    let _1: u32 as UserTypeProjection { base: UserType(0), projs: [Field(0, ())] };
+    let _2: u64 as UserTypeProjection { base: UserType(0), projs: [Field(1, ())] };
+    let _3: &char as UserTypeProjection { base: UserType(0), projs: [Field(2, ())] };
+    scope 1 {
+        debug x => _1;
+        debug y => _2;
+        debug z => _3;
+    }
+
+    bb0: {
+        StorageLive(_1);
+        StorageLive(_2);
+        StorageLive(_3);
+        _0 = const ();
+        StorageDead(_3);
+        StorageDead(_2);
+        StorageDead(_1);
+        return;
+    }
+}
diff --git a/tests/mir-opt/building/user_type_annotations.let_uninit_bindless.built.after.mir b/tests/mir-opt/building/user_type_annotations.let_uninit_bindless.built.after.mir
new file mode 100644
index 00000000000..0cd12558771
--- /dev/null
+++ b/tests/mir-opt/building/user_type_annotations.let_uninit_bindless.built.after.mir
@@ -0,0 +1,15 @@
+// MIR for `let_uninit_bindless` after built
+
+| User Type Annotations
+| 0: user_ty: Canonical { value: Ty((u32, u64, &'static char)), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:20:20: 20:45, inferred_ty: (u32, u64, &char)
+|
+fn let_uninit_bindless() -> () {
+    let mut _0: ();
+    scope 1 {
+    }
+
+    bb0: {
+        _0 = const ();
+        return;
+    }
+}
diff --git a/tests/mir-opt/building/user_type_annotations.match_assoc_const.built.after.mir b/tests/mir-opt/building/user_type_annotations.match_assoc_const.built.after.mir
new file mode 100644
index 00000000000..c0ce6f1d06b
--- /dev/null
+++ b/tests/mir-opt/building/user_type_annotations.match_assoc_const.built.after.mir
@@ -0,0 +1,46 @@
+// MIR for `match_assoc_const` after built
+
+| User Type Annotations
+| 0: user_ty: Canonical { value: TypeOf(DefId(0:11 ~ user_type_annotations[ee8e]::MyTrait::FOO), UserArgs { args: [MyStruct, 'static], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:54:9: 54:44, inferred_ty: u32
+| 1: user_ty: Canonical { value: TypeOf(DefId(0:11 ~ user_type_annotations[ee8e]::MyTrait::FOO), UserArgs { args: [MyStruct, 'static], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:54:9: 54:44, inferred_ty: u32
+|
+fn match_assoc_const() -> () {
+    let mut _0: ();
+    let mut _1: u32;
+
+    bb0: {
+        StorageLive(_1);
+        _1 = const 8_u32;
+        PlaceMention(_1);
+        switchInt(copy _1) -> [99: bb2, otherwise: bb1];
+    }
+
+    bb1: {
+        _0 = const ();
+        goto -> bb6;
+    }
+
+    bb2: {
+        falseEdge -> [real: bb5, imaginary: bb1];
+    }
+
+    bb3: {
+        goto -> bb1;
+    }
+
+    bb4: {
+        FakeRead(ForMatchedPlace(None), _1);
+        unreachable;
+    }
+
+    bb5: {
+        AscribeUserType(_1, -, UserTypeProjection { base: UserType(1), projs: [] });
+        _0 = const ();
+        goto -> bb6;
+    }
+
+    bb6: {
+        StorageDead(_1);
+        return;
+    }
+}
diff --git a/tests/mir-opt/building/user_type_annotations.match_assoc_const_range.built.after.mir b/tests/mir-opt/building/user_type_annotations.match_assoc_const_range.built.after.mir
new file mode 100644
index 00000000000..3a6aa5b7c2c
--- /dev/null
+++ b/tests/mir-opt/building/user_type_annotations.match_assoc_const_range.built.after.mir
@@ -0,0 +1,74 @@
+// MIR for `match_assoc_const_range` after built
+
+| User Type Annotations
+| 0: user_ty: Canonical { value: TypeOf(DefId(0:11 ~ user_type_annotations[ee8e]::MyTrait::FOO), UserArgs { args: [MyStruct, 'static], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:62:11: 62:46, inferred_ty: u32
+| 1: user_ty: Canonical { value: TypeOf(DefId(0:11 ~ user_type_annotations[ee8e]::MyTrait::FOO), UserArgs { args: [MyStruct, 'static], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:62:11: 62:46, inferred_ty: u32
+| 2: user_ty: Canonical { value: TypeOf(DefId(0:11 ~ user_type_annotations[ee8e]::MyTrait::FOO), UserArgs { args: [MyStruct, 'static], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:63:9: 63:44, inferred_ty: u32
+| 3: user_ty: Canonical { value: TypeOf(DefId(0:11 ~ user_type_annotations[ee8e]::MyTrait::FOO), UserArgs { args: [MyStruct, 'static], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/user_type_annotations.rs:63:9: 63:44, inferred_ty: u32
+|
+fn match_assoc_const_range() -> () {
+    let mut _0: ();
+    let mut _1: u32;
+    let mut _2: bool;
+    let mut _3: bool;
+
+    bb0: {
+        StorageLive(_1);
+        _1 = const 8_u32;
+        PlaceMention(_1);
+        _3 = Lt(copy _1, const 99_u32);
+        switchInt(move _3) -> [0: bb4, otherwise: bb2];
+    }
+
+    bb1: {
+        _0 = const ();
+        goto -> bb11;
+    }
+
+    bb2: {
+        falseEdge -> [real: bb10, imaginary: bb4];
+    }
+
+    bb3: {
+        goto -> bb1;
+    }
+
+    bb4: {
+        _2 = Le(const 99_u32, copy _1);
+        switchInt(move _2) -> [0: bb5, otherwise: bb6];
+    }
+
+    bb5: {
+        goto -> bb1;
+    }
+
+    bb6: {
+        falseEdge -> [real: bb9, imaginary: bb1];
+    }
+
+    bb7: {
+        goto -> bb5;
+    }
+
+    bb8: {
+        FakeRead(ForMatchedPlace(None), _1);
+        unreachable;
+    }
+
+    bb9: {
+        AscribeUserType(_1, -, UserTypeProjection { base: UserType(3), projs: [] });
+        _0 = const ();
+        goto -> bb11;
+    }
+
+    bb10: {
+        AscribeUserType(_1, -, UserTypeProjection { base: UserType(1), projs: [] });
+        _0 = const ();
+        goto -> bb11;
+    }
+
+    bb11: {
+        StorageDead(_1);
+        return;
+    }
+}
diff --git a/tests/mir-opt/building/user_type_annotations.rs b/tests/mir-opt/building/user_type_annotations.rs
new file mode 100644
index 00000000000..d55c678d5ae
--- /dev/null
+++ b/tests/mir-opt/building/user_type_annotations.rs
@@ -0,0 +1,66 @@
+//@ edition: 2024
+// skip-filecheck
+
+// This test demonstrates how many user type annotations are recorded in MIR
+// for various binding constructs. In particular, this makes it possible to see
+// the number of duplicate user-type-annotation entries, and whether that
+// number has changed.
+//
+// Duplicates are mostly harmless, other than being inefficient.
+// "Unused" entries that are _not_ duplicates may nevertheless be necessary so
+// that they are seen by MIR lifetime checks.
+
+// EMIT_MIR user_type_annotations.let_uninit.built.after.mir
+fn let_uninit() {
+    let (x, y, z): (u32, u64, &'static char);
+}
+
+// EMIT_MIR user_type_annotations.let_uninit_bindless.built.after.mir
+fn let_uninit_bindless() {
+    let (_, _, _): (u32, u64, &'static char);
+}
+
+// EMIT_MIR user_type_annotations.let_init.built.after.mir
+fn let_init() {
+    let (x, y, z): (u32, u64, &'static char) = (7, 12, &'u');
+}
+
+// EMIT_MIR user_type_annotations.let_init_bindless.built.after.mir
+fn let_init_bindless() {
+    let (_, _, _): (u32, u64, &'static char) = (7, 12, &'u');
+}
+
+// EMIT_MIR user_type_annotations.let_else.built.after.mir
+fn let_else() {
+    let (x, y, z): (u32, u64, &'static char) = (7, 12, &'u') else { unreachable!() };
+}
+
+// EMIT_MIR user_type_annotations.let_else_bindless.built.after.mir
+fn let_else_bindless() {
+    let (_, _, _): (u32, u64, &'static char) = (7, 12, &'u') else { unreachable!() };
+}
+
+trait MyTrait<'a> {
+    const FOO: u32;
+}
+struct MyStruct {}
+impl MyTrait<'static> for MyStruct {
+    const FOO: u32 = 99;
+}
+
+// EMIT_MIR user_type_annotations.match_assoc_const.built.after.mir
+fn match_assoc_const() {
+    match 8 {
+        <MyStruct as MyTrait<'static>>::FOO => {}
+        _ => {}
+    }
+}
+
+// EMIT_MIR user_type_annotations.match_assoc_const_range.built.after.mir
+fn match_assoc_const_range() {
+    match 8 {
+        ..<MyStruct as MyTrait<'static>>::FOO => {}
+        <MyStruct as MyTrait<'static>>::FOO.. => {}
+        _ => {}
+    }
+}
diff --git a/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff b/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff
index e9f48a85f9c..8e1cdb7182b 100644
--- a/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff
+++ b/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff
@@ -26,7 +26,6 @@
           debug a => _9;
       }
   
-+     coverage body span: $DIR/branch_match_arms.rs:14:11: 21:2 (#0)
 +     coverage Code { bcb: bcb0 } => $DIR/branch_match_arms.rs:14:1: 15:21 (#0);
 +     coverage Code { bcb: bcb1 } => $DIR/branch_match_arms.rs:16:17: 16:33 (#0);
 +     coverage Code { bcb: bcb3 } => $DIR/branch_match_arms.rs:17:17: 17:33 (#0);
diff --git a/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff b/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff
index cbef6de917d..06e5f011c76 100644
--- a/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff
+++ b/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff
@@ -4,8 +4,7 @@
   fn bar() -> bool {
       let mut _0: bool;
   
-+     coverage body span: $DIR/instrument_coverage.rs:29:18: 31:2 (#0)
-+     coverage Code { bcb: bcb0 } => $DIR/instrument_coverage.rs:29:1: 31:2 (#0);
++     coverage Code { bcb: bcb0 } => $DIR/instrument_coverage.rs:27:1: 29:2 (#0);
 + 
       bb0: {
 +         Coverage::VirtualCounter(bcb0);
diff --git a/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff b/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff
index b166d79a412..1a71cb8dea7 100644
--- a/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff
+++ b/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff
@@ -7,12 +7,11 @@
       let mut _2: bool;
       let mut _3: !;
   
-+     coverage body span: $DIR/instrument_coverage.rs:14:11: 20:2 (#0)
-+     coverage Code { bcb: bcb0 } => $DIR/instrument_coverage.rs:14:1: 14:11 (#0);
-+     coverage Code { bcb: bcb1 } => $DIR/instrument_coverage.rs:16:12: 16:17 (#0);
-+     coverage Code { bcb: bcb2 } => $DIR/instrument_coverage.rs:17:13: 17:18 (#0);
-+     coverage Code { bcb: bcb3 } => $DIR/instrument_coverage.rs:18:10: 18:10 (#0);
-+     coverage Code { bcb: bcb2 } => $DIR/instrument_coverage.rs:20:2: 20:2 (#0);
++     coverage Code { bcb: bcb0 } => $DIR/instrument_coverage.rs:13:1: 13:11 (#0);
++     coverage Code { bcb: bcb1 } => $DIR/instrument_coverage.rs:15:12: 15:17 (#0);
++     coverage Code { bcb: bcb2 } => $DIR/instrument_coverage.rs:16:13: 16:18 (#0);
++     coverage Code { bcb: bcb3 } => $DIR/instrument_coverage.rs:17:10: 17:10 (#0);
++     coverage Code { bcb: bcb2 } => $DIR/instrument_coverage.rs:19:2: 19:2 (#0);
 + 
       bb0: {
 +         Coverage::VirtualCounter(bcb0);
diff --git a/tests/mir-opt/coverage/instrument_coverage.rs b/tests/mir-opt/coverage/instrument_coverage.rs
index 48647402d0f..d4ed4b67375 100644
--- a/tests/mir-opt/coverage/instrument_coverage.rs
+++ b/tests/mir-opt/coverage/instrument_coverage.rs
@@ -7,7 +7,6 @@
 
 // EMIT_MIR instrument_coverage.main.InstrumentCoverage.diff
 // CHECK-LABEL: fn main()
-// CHECK: coverage body span:
 // CHECK: coverage Code { bcb: bcb{{[0-9]+}} } =>
 // CHECK: bb0:
 // CHECK: Coverage::VirtualCounter
@@ -21,7 +20,6 @@ fn main() {
 
 // EMIT_MIR instrument_coverage.bar.InstrumentCoverage.diff
 // CHECK-LABEL: fn bar()
-// CHECK: coverage body span:
 // CHECK: coverage Code { bcb: bcb{{[0-9]+}} } =>
 // CHECK: bb0:
 // CHECK: Coverage::VirtualCounter
diff --git a/tests/mir-opt/coverage/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff b/tests/mir-opt/coverage/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff
index 855f806aae1..1a22adeba6f 100644
--- a/tests/mir-opt/coverage/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff
+++ b/tests/mir-opt/coverage/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff
@@ -7,7 +7,6 @@
   
       coverage branch { true: BlockMarkerId(0), false: BlockMarkerId(1) } => $DIR/instrument_coverage_cleanup.rs:14:8: 14:36 (#0)
   
-      coverage body span: $DIR/instrument_coverage_cleanup.rs:13:11: 15:2 (#0)
       coverage Code { bcb: bcb0 } => $DIR/instrument_coverage_cleanup.rs:13:1: 14:36 (#0);
       coverage Code { bcb: bcb3 } => $DIR/instrument_coverage_cleanup.rs:14:37: 14:39 (#0);
       coverage Code { bcb: bcb1 } => $DIR/instrument_coverage_cleanup.rs:14:39: 14:39 (#0);
diff --git a/tests/mir-opt/coverage/instrument_coverage_cleanup.main.InstrumentCoverage.diff b/tests/mir-opt/coverage/instrument_coverage_cleanup.main.InstrumentCoverage.diff
index df1f1e8bc50..b77969a3e16 100644
--- a/tests/mir-opt/coverage/instrument_coverage_cleanup.main.InstrumentCoverage.diff
+++ b/tests/mir-opt/coverage/instrument_coverage_cleanup.main.InstrumentCoverage.diff
@@ -7,7 +7,6 @@
   
       coverage branch { true: BlockMarkerId(0), false: BlockMarkerId(1) } => $DIR/instrument_coverage_cleanup.rs:14:8: 14:36 (#0)
   
-+     coverage body span: $DIR/instrument_coverage_cleanup.rs:13:11: 15:2 (#0)
 +     coverage Code { bcb: bcb0 } => $DIR/instrument_coverage_cleanup.rs:13:1: 14:36 (#0);
 +     coverage Code { bcb: bcb3 } => $DIR/instrument_coverage_cleanup.rs:14:37: 14:39 (#0);
 +     coverage Code { bcb: bcb1 } => $DIR/instrument_coverage_cleanup.rs:14:39: 14:39 (#0);
diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.32bit.panic-abort.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.32bit.panic-abort.diff
index 45fc7365d8d..6baa902b6f4 100644
--- a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.32bit.panic-abort.diff
+++ b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.32bit.panic-abort.diff
@@ -29,16 +29,10 @@
                   debug precision => _8;
                   let _8: usize;
                   scope 5 (inlined Formatter::<'_>::precision) {
-                      let mut _22: std::option::Option<u16>;
-                      scope 6 (inlined Option::<u16>::map::<usize, {closure@Formatter<'_>::precision::{closure#0}}>) {
-                          let mut _23: isize;
-                          let _24: u16;
-                          let mut _25: usize;
-                          scope 7 {
-                              scope 8 (inlined Formatter::<'_>::precision::{closure#0}) {
-                              }
-                          }
-                      }
+                      let mut _22: u32;
+                      let mut _23: u32;
+                      let mut _24: usize;
+                      let mut _25: u16;
                   }
               }
           }
@@ -53,7 +47,7 @@
           StorageLive(_20);
           StorageLive(_21);
           _21 = copy (((*_1).0: std::fmt::FormattingOptions).0: u32);
-          _20 = BitAnd(move _21, const 1_u32);
+          _20 = BitAnd(move _21, const core::fmt::flags::SIGN_PLUS_FLAG);
           StorageDead(_21);
           _4 = Ne(move _20, const 0_u32);
           StorageDead(_20);
@@ -75,12 +69,12 @@
   
       bb3: {
           StorageLive(_6);
-          StorageLive(_24);
           StorageLive(_22);
-          _22 = copy (((*_1).0: std::fmt::FormattingOptions).4: std::option::Option<u16>);
           StorageLive(_23);
-          _23 = discriminant(_22);
-          switchInt(move _23) -> [0: bb11, 1: bb12, otherwise: bb10];
+          _23 = copy (((*_1).0: std::fmt::FormattingOptions).0: u32);
+          _22 = BitAnd(move _23, const core::fmt::flags::PRECISION_FLAG);
+          StorageDead(_23);
+          switchInt(move _22) -> [0: bb10, otherwise: bb11];
       }
   
       bb4: {
@@ -148,30 +142,31 @@
       }
   
       bb9: {
-          StorageDead(_23);
-          StorageDead(_22);
-          StorageDead(_24);
           _7 = discriminant(_6);
-          switchInt(move _7) -> [1: bb4, 0: bb6, otherwise: bb10];
+          switchInt(move _7) -> [1: bb4, 0: bb6, otherwise: bb12];
       }
   
       bb10: {
-          unreachable;
-      }
-  
-      bb11: {
+          StorageDead(_22);
           _6 = const Option::<usize>::None;
           goto -> bb9;
       }
   
-      bb12: {
-          _24 = move ((_22 as Some).0: u16);
+      bb11: {
+          StorageDead(_22);
+          StorageLive(_24);
           StorageLive(_25);
-          _25 = copy _24 as usize (IntToInt);
-          _6 = Option::<usize>::Some(move _25);
+          _25 = copy (((*_1).0: std::fmt::FormattingOptions).2: u16);
+          _24 = move _25 as usize (IntToInt);
           StorageDead(_25);
+          _6 = Option::<usize>::Some(move _24);
+          StorageDead(_24);
           goto -> bb9;
       }
+  
+      bb12: {
+          unreachable;
+      }
   }
   
   ALLOC0 (size: 8, align: 4) {
diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.32bit.panic-unwind.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.32bit.panic-unwind.diff
index 578d2c2194b..36540e03865 100644
--- a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.32bit.panic-unwind.diff
+++ b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.32bit.panic-unwind.diff
@@ -29,16 +29,10 @@
                   debug precision => _8;
                   let _8: usize;
                   scope 5 (inlined Formatter::<'_>::precision) {
-                      let mut _22: std::option::Option<u16>;
-                      scope 6 (inlined Option::<u16>::map::<usize, {closure@Formatter<'_>::precision::{closure#0}}>) {
-                          let mut _23: isize;
-                          let _24: u16;
-                          let mut _25: usize;
-                          scope 7 {
-                              scope 8 (inlined Formatter::<'_>::precision::{closure#0}) {
-                              }
-                          }
-                      }
+                      let mut _22: u32;
+                      let mut _23: u32;
+                      let mut _24: usize;
+                      let mut _25: u16;
                   }
               }
           }
@@ -53,7 +47,7 @@
           StorageLive(_20);
           StorageLive(_21);
           _21 = copy (((*_1).0: std::fmt::FormattingOptions).0: u32);
-          _20 = BitAnd(move _21, const 1_u32);
+          _20 = BitAnd(move _21, const core::fmt::flags::SIGN_PLUS_FLAG);
           StorageDead(_21);
           _4 = Ne(move _20, const 0_u32);
           StorageDead(_20);
@@ -75,12 +69,12 @@
   
       bb3: {
           StorageLive(_6);
-          StorageLive(_24);
           StorageLive(_22);
-          _22 = copy (((*_1).0: std::fmt::FormattingOptions).4: std::option::Option<u16>);
           StorageLive(_23);
-          _23 = discriminant(_22);
-          switchInt(move _23) -> [0: bb11, 1: bb12, otherwise: bb10];
+          _23 = copy (((*_1).0: std::fmt::FormattingOptions).0: u32);
+          _22 = BitAnd(move _23, const core::fmt::flags::PRECISION_FLAG);
+          StorageDead(_23);
+          switchInt(move _22) -> [0: bb10, otherwise: bb11];
       }
   
       bb4: {
@@ -148,30 +142,31 @@
       }
   
       bb9: {
-          StorageDead(_23);
-          StorageDead(_22);
-          StorageDead(_24);
           _7 = discriminant(_6);
-          switchInt(move _7) -> [1: bb4, 0: bb6, otherwise: bb10];
+          switchInt(move _7) -> [1: bb4, 0: bb6, otherwise: bb12];
       }
   
       bb10: {
-          unreachable;
-      }
-  
-      bb11: {
+          StorageDead(_22);
           _6 = const Option::<usize>::None;
           goto -> bb9;
       }
   
-      bb12: {
-          _24 = move ((_22 as Some).0: u16);
+      bb11: {
+          StorageDead(_22);
+          StorageLive(_24);
           StorageLive(_25);
-          _25 = copy _24 as usize (IntToInt);
-          _6 = Option::<usize>::Some(move _25);
+          _25 = copy (((*_1).0: std::fmt::FormattingOptions).2: u16);
+          _24 = move _25 as usize (IntToInt);
           StorageDead(_25);
+          _6 = Option::<usize>::Some(move _24);
+          StorageDead(_24);
           goto -> bb9;
       }
+  
+      bb12: {
+          unreachable;
+      }
   }
   
   ALLOC0 (size: 8, align: 4) {
diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.64bit.panic-abort.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.64bit.panic-abort.diff
index 5f0f7d6cc74..41c350f3eae 100644
--- a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.64bit.panic-abort.diff
+++ b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.64bit.panic-abort.diff
@@ -29,16 +29,10 @@
                   debug precision => _8;
                   let _8: usize;
                   scope 5 (inlined Formatter::<'_>::precision) {
-                      let mut _22: std::option::Option<u16>;
-                      scope 6 (inlined Option::<u16>::map::<usize, {closure@Formatter<'_>::precision::{closure#0}}>) {
-                          let mut _23: isize;
-                          let _24: u16;
-                          let mut _25: usize;
-                          scope 7 {
-                              scope 8 (inlined Formatter::<'_>::precision::{closure#0}) {
-                              }
-                          }
-                      }
+                      let mut _22: u32;
+                      let mut _23: u32;
+                      let mut _24: usize;
+                      let mut _25: u16;
                   }
               }
           }
@@ -53,7 +47,7 @@
           StorageLive(_20);
           StorageLive(_21);
           _21 = copy (((*_1).0: std::fmt::FormattingOptions).0: u32);
-          _20 = BitAnd(move _21, const 1_u32);
+          _20 = BitAnd(move _21, const core::fmt::flags::SIGN_PLUS_FLAG);
           StorageDead(_21);
           _4 = Ne(move _20, const 0_u32);
           StorageDead(_20);
@@ -75,12 +69,12 @@
   
       bb3: {
           StorageLive(_6);
-          StorageLive(_24);
           StorageLive(_22);
-          _22 = copy (((*_1).0: std::fmt::FormattingOptions).4: std::option::Option<u16>);
           StorageLive(_23);
-          _23 = discriminant(_22);
-          switchInt(move _23) -> [0: bb11, 1: bb12, otherwise: bb10];
+          _23 = copy (((*_1).0: std::fmt::FormattingOptions).0: u32);
+          _22 = BitAnd(move _23, const core::fmt::flags::PRECISION_FLAG);
+          StorageDead(_23);
+          switchInt(move _22) -> [0: bb10, otherwise: bb11];
       }
   
       bb4: {
@@ -148,30 +142,31 @@
       }
   
       bb9: {
-          StorageDead(_23);
-          StorageDead(_22);
-          StorageDead(_24);
           _7 = discriminant(_6);
-          switchInt(move _7) -> [1: bb4, 0: bb6, otherwise: bb10];
+          switchInt(move _7) -> [1: bb4, 0: bb6, otherwise: bb12];
       }
   
       bb10: {
-          unreachable;
-      }
-  
-      bb11: {
+          StorageDead(_22);
           _6 = const Option::<usize>::None;
           goto -> bb9;
       }
   
-      bb12: {
-          _24 = move ((_22 as Some).0: u16);
+      bb11: {
+          StorageDead(_22);
+          StorageLive(_24);
           StorageLive(_25);
-          _25 = copy _24 as usize (IntToInt);
-          _6 = Option::<usize>::Some(move _25);
+          _25 = copy (((*_1).0: std::fmt::FormattingOptions).2: u16);
+          _24 = move _25 as usize (IntToInt);
           StorageDead(_25);
+          _6 = Option::<usize>::Some(move _24);
+          StorageDead(_24);
           goto -> bb9;
       }
+  
+      bb12: {
+          unreachable;
+      }
   }
   
   ALLOC0 (size: 16, align: 8) {
diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.64bit.panic-unwind.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.64bit.panic-unwind.diff
index 10cc46a8b82..b839bf81eaf 100644
--- a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.64bit.panic-unwind.diff
+++ b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.64bit.panic-unwind.diff
@@ -29,16 +29,10 @@
                   debug precision => _8;
                   let _8: usize;
                   scope 5 (inlined Formatter::<'_>::precision) {
-                      let mut _22: std::option::Option<u16>;
-                      scope 6 (inlined Option::<u16>::map::<usize, {closure@Formatter<'_>::precision::{closure#0}}>) {
-                          let mut _23: isize;
-                          let _24: u16;
-                          let mut _25: usize;
-                          scope 7 {
-                              scope 8 (inlined Formatter::<'_>::precision::{closure#0}) {
-                              }
-                          }
-                      }
+                      let mut _22: u32;
+                      let mut _23: u32;
+                      let mut _24: usize;
+                      let mut _25: u16;
                   }
               }
           }
@@ -53,7 +47,7 @@
           StorageLive(_20);
           StorageLive(_21);
           _21 = copy (((*_1).0: std::fmt::FormattingOptions).0: u32);
-          _20 = BitAnd(move _21, const 1_u32);
+          _20 = BitAnd(move _21, const core::fmt::flags::SIGN_PLUS_FLAG);
           StorageDead(_21);
           _4 = Ne(move _20, const 0_u32);
           StorageDead(_20);
@@ -75,12 +69,12 @@
   
       bb3: {
           StorageLive(_6);
-          StorageLive(_24);
           StorageLive(_22);
-          _22 = copy (((*_1).0: std::fmt::FormattingOptions).4: std::option::Option<u16>);
           StorageLive(_23);
-          _23 = discriminant(_22);
-          switchInt(move _23) -> [0: bb11, 1: bb12, otherwise: bb10];
+          _23 = copy (((*_1).0: std::fmt::FormattingOptions).0: u32);
+          _22 = BitAnd(move _23, const core::fmt::flags::PRECISION_FLAG);
+          StorageDead(_23);
+          switchInt(move _22) -> [0: bb10, otherwise: bb11];
       }
   
       bb4: {
@@ -148,30 +142,31 @@
       }
   
       bb9: {
-          StorageDead(_23);
-          StorageDead(_22);
-          StorageDead(_24);
           _7 = discriminant(_6);
-          switchInt(move _7) -> [1: bb4, 0: bb6, otherwise: bb10];
+          switchInt(move _7) -> [1: bb4, 0: bb6, otherwise: bb12];
       }
   
       bb10: {
-          unreachable;
-      }
-  
-      bb11: {
+          StorageDead(_22);
           _6 = const Option::<usize>::None;
           goto -> bb9;
       }
   
-      bb12: {
-          _24 = move ((_22 as Some).0: u16);
+      bb11: {
+          StorageDead(_22);
+          StorageLive(_24);
           StorageLive(_25);
-          _25 = copy _24 as usize (IntToInt);
-          _6 = Option::<usize>::Some(move _25);
+          _25 = copy (((*_1).0: std::fmt::FormattingOptions).2: u16);
+          _24 = move _25 as usize (IntToInt);
           StorageDead(_25);
+          _6 = Option::<usize>::Some(move _24);
+          StorageDead(_24);
           goto -> bb9;
       }
+  
+      bb12: {
+          unreachable;
+      }
   }
   
   ALLOC0 (size: 16, align: 8) {
diff --git a/tests/mir-opt/global_asm.rs b/tests/mir-opt/global_asm.rs
new file mode 100644
index 00000000000..22b782d365e
--- /dev/null
+++ b/tests/mir-opt/global_asm.rs
@@ -0,0 +1,9 @@
+// skip-filecheck
+//@ needs-asm-support
+
+// `global_asm!` gets a fake body, make sure it is handled correctly
+
+// EMIT_MIR global_asm.{global_asm#0}.SimplifyLocals-final.after.mir
+core::arch::global_asm!("/* */");
+
+fn main() {}
diff --git a/tests/mir-opt/global_asm.{global_asm#0}.SimplifyLocals-final.after.mir b/tests/mir-opt/global_asm.{global_asm#0}.SimplifyLocals-final.after.mir
new file mode 100644
index 00000000000..cec3c4a8261
--- /dev/null
+++ b/tests/mir-opt/global_asm.{global_asm#0}.SimplifyLocals-final.after.mir
@@ -0,0 +1,9 @@
+// MIR for `{global_asm#0}` after SimplifyLocals-final
+
+{global_asm#0}: ! = {
+    let mut _0: !;
+
+    bb0: {
+        asm!("/* */", options()) -> unwind unreachable;
+    }
+}
diff --git a/tests/mir-opt/gvn_clone.{impl#0}-clone.GVN.diff b/tests/mir-opt/gvn_clone.{impl#0}-clone.GVN.diff
index 8d5991872e1..2a672e82970 100644
--- a/tests/mir-opt/gvn_clone.{impl#0}-clone.GVN.diff
+++ b/tests/mir-opt/gvn_clone.{impl#0}-clone.GVN.diff
@@ -55,16 +55,16 @@
       bb3: {
           StorageDead(_9);
 -         _0 = AllCopy { a: move _2, b: move _5, c: move _8 };
+-         StorageDead(_10);
 +         _0 = copy (*_1);
++         nop;
           StorageDead(_8);
-          StorageDead(_5);
-          StorageDead(_2);
--         StorageDead(_10);
 -         StorageDead(_7);
--         StorageDead(_4);
-+         nop;
 +         nop;
+          StorageDead(_5);
+-         StorageDead(_4);
 +         nop;
+          StorageDead(_2);
           return;
       }
   }
diff --git a/tests/mir-opt/gvn_on_unsafe_binder.propagate.GVN.diff b/tests/mir-opt/gvn_on_unsafe_binder.propagate.GVN.diff
new file mode 100644
index 00000000000..e28d04f1d58
--- /dev/null
+++ b/tests/mir-opt/gvn_on_unsafe_binder.propagate.GVN.diff
@@ -0,0 +1,35 @@
+- // MIR for `propagate` before GVN
++ // MIR for `propagate` after GVN
+  
+  fn propagate() -> unsafe<> i32 {
+      let mut _0: unsafe<> i32;
+      let _1: i32;
+      let mut _3: i32;
+      scope 1 {
+          debug x => _1;
+          let _2: unsafe<> i32;
+          scope 2 {
+              debug binder => _2;
+          }
+      }
+  
+      bb0: {
+-         StorageLive(_1);
++         nop;
+          _1 = const 1_i32;
+          StorageLive(_2);
+          StorageLive(_3);
+-         _3 = copy _1;
+-         _2 = wrap_binder!(move _3; unsafe<> i32);
++         _3 = const 1_i32;
++         _2 = const {transmute(0x00000001): unsafe<> i32};
+          StorageDead(_3);
+-         _0 = move _2;
++         _0 = const {transmute(0x00000001): unsafe<> i32};
+          StorageDead(_2);
+-         StorageDead(_1);
++         nop;
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/gvn_on_unsafe_binder.rs b/tests/mir-opt/gvn_on_unsafe_binder.rs
new file mode 100644
index 00000000000..b3c0576f990
--- /dev/null
+++ b/tests/mir-opt/gvn_on_unsafe_binder.rs
@@ -0,0 +1,29 @@
+// skip-filecheck
+//@ test-mir-pass: GVN
+
+// EMIT_MIR gvn_on_unsafe_binder.test.GVN.diff
+// EMIT_MIR gvn_on_unsafe_binder.propagate.GVN.diff
+
+#![feature(unsafe_binders)]
+
+use std::unsafe_binder::wrap_binder;
+
+// Test for ICE <https://github.com/rust-lang/rust/issues/137846>.
+fn test() {
+    unsafe {
+        let x = 1;
+        let binder: unsafe<'a> &'a i32 = wrap_binder!(&x);
+    }
+}
+
+// Test that GVN propagates const values through unsafe binders.
+//
+// The lifetime `'a` is redundant (and doesn't print when we print out the type).
+// However, we need it so that rustfmt doesn't rip out the `unsafe<>` part for now.
+fn propagate() -> unsafe<'a> i32 {
+    unsafe {
+        let x = 1;
+        let binder: unsafe<'a> i32 = wrap_binder!(x);
+        binder
+    }
+}
diff --git a/tests/mir-opt/gvn_on_unsafe_binder.test.GVN.diff b/tests/mir-opt/gvn_on_unsafe_binder.test.GVN.diff
new file mode 100644
index 00000000000..33814fb34f3
--- /dev/null
+++ b/tests/mir-opt/gvn_on_unsafe_binder.test.GVN.diff
@@ -0,0 +1,30 @@
+- // MIR for `test` before GVN
++ // MIR for `test` after GVN
+  
+  fn test() -> () {
+      let mut _0: ();
+      let _1: i32;
+      let mut _3: &i32;
+      scope 1 {
+          debug x => _1;
+          let _2: unsafe<'a> &'a i32;
+          scope 2 {
+              debug binder => _2;
+          }
+      }
+  
+      bb0: {
+          StorageLive(_1);
+          _1 = const 1_i32;
+          StorageLive(_2);
+          StorageLive(_3);
+          _3 = &_1;
+          _2 = wrap_binder!(move _3; unsafe<'a> &'a i32);
+          StorageDead(_3);
+          _0 = const ();
+          StorageDead(_2);
+          StorageDead(_1);
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/inline/exponential_runtime.rs b/tests/mir-opt/inline/exponential_runtime.rs
index 1199ce4e558..62c1d8be1bf 100644
--- a/tests/mir-opt/inline/exponential_runtime.rs
+++ b/tests/mir-opt/inline/exponential_runtime.rs
@@ -87,10 +87,15 @@ fn main() {
     // CHECK-LABEL: fn main(
     // CHECK-NOT: inlined
     // CHECK: (inlined <() as G>::call)
+    // CHECK-NOT: inlined
     // CHECK: (inlined <() as F>::call)
+    // CHECK-NOT: inlined
     // CHECK: (inlined <() as E>::call)
+    // CHECK-NOT: inlined
     // CHECK: (inlined <() as D>::call)
+    // CHECK-NOT: inlined
     // CHECK: (inlined <() as C>::call)
+    // CHECK-NOT: inlined
     // CHECK: (inlined <() as B>::call)
     // CHECK-NOT: inlined
     <() as G>::call();
diff --git a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff
index 75fc2ea16e3..f099d763c3d 100644
--- a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff
@@ -6,6 +6,7 @@
       let _1: (!, !);
 +     let mut _2: fn() -> ! {sleep};
 +     let mut _7: ();
++     let mut _8: ();
 +     scope 1 (inlined call_twice::<!, fn() -> ! {sleep}>) {
 +         debug f => _2;
 +         let mut _3: &fn() -> ! {sleep};
@@ -17,6 +18,10 @@
 +             scope 3 {
 +                 debug b => _6;
 +             }
++             scope 6 (inlined <fn() -> ! {sleep} as Fn<()>>::call - shim(fn() -> ! {sleep})) {
++                 scope 7 (inlined sleep) {
++                 }
++             }
 +         }
 +         scope 4 (inlined <fn() -> ! {sleep} as Fn<()>>::call - shim(fn() -> ! {sleep})) {
 +             scope 5 (inlined sleep) {
diff --git a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff
index 407cb24df67..c33e0810739 100644
--- a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff
@@ -6,6 +6,7 @@
       let _1: (!, !);
 +     let mut _2: fn() -> ! {sleep};
 +     let mut _8: ();
++     let mut _9: ();
 +     scope 1 (inlined call_twice::<!, fn() -> ! {sleep}>) {
 +         debug f => _2;
 +         let mut _3: &fn() -> ! {sleep};
@@ -18,6 +19,10 @@
 +             scope 3 {
 +                 debug b => _6;
 +             }
++             scope 6 (inlined <fn() -> ! {sleep} as Fn<()>>::call - shim(fn() -> ! {sleep})) {
++                 scope 7 (inlined sleep) {
++                 }
++             }
 +         }
 +         scope 4 (inlined <fn() -> ! {sleep} as Fn<()>>::call - shim(fn() -> ! {sleep})) {
 +             scope 5 (inlined sleep) {
diff --git a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff
index 1e33e222b27..eb97af1e284 100644
--- a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff
@@ -55,10 +55,46 @@
 +                         let _26: ();
 +                         scope 9 {
 +                         }
++                         scope 12 (inlined Pin::<&mut std::future::Ready<()>>::new_unchecked) {
++                         }
++                         scope 13 (inlined <std::future::Ready<()> as Future>::poll) {
++                             let mut _42: ();
++                             let mut _43: std::option::Option<()>;
++                             let mut _44: &mut std::option::Option<()>;
++                             let mut _45: &mut std::future::Ready<()>;
++                             let mut _46: &mut std::pin::Pin<&mut std::future::Ready<()>>;
++                             scope 14 (inlined <Pin<&mut std::future::Ready<()>> as DerefMut>::deref_mut) {
++                                 let mut _47: std::pin::Pin<&mut std::future::Ready<()>>;
++                                 scope 15 (inlined Pin::<&mut std::future::Ready<()>>::as_mut) {
++                                     let mut _48: &mut &mut std::future::Ready<()>;
++                                     scope 16 (inlined Pin::<&mut std::future::Ready<()>>::new_unchecked) {
++                                     }
++                                     scope 18 (inlined <&mut std::future::Ready<()> as DerefMut>::deref_mut) {
++                                     }
++                                 }
++                                 scope 17 (inlined Pin::<&mut std::future::Ready<()>>::get_mut) {
++                                 }
++                             }
++                             scope 19 (inlined Option::<()>::take) {
++                                 let mut _49: std::option::Option<()>;
++                                 scope 20 (inlined std::mem::replace::<Option<()>>) {
++                                     scope 21 {
++                                     }
++                                 }
++                             }
++                             scope 22 (inlined #[track_caller] Option::<()>::expect) {
++                                 let mut _50: isize;
++                                 let mut _51: !;
++                                 scope 23 {
++                                 }
++                             }
++                         }
 +                     }
 +                     scope 10 (inlined ready::<()>) {
 +                         let mut _41: std::option::Option<()>;
 +                     }
++                     scope 11 (inlined <std::future::Ready<()> as IntoFuture>::into_future) {
++                     }
 +                 }
 +             }
           }
@@ -113,7 +149,7 @@
 +         StorageLive(_40);
 +         _33 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
 +         _32 = discriminant((*_33));
-+         switchInt(move _32) -> [0: bb3, 1: bb13, 3: bb12, otherwise: bb8];
++         switchInt(move _32) -> [0: bb3, 1: bb10, 3: bb9, otherwise: bb5];
       }
   
 -     bb3: {
@@ -164,19 +200,16 @@
 +         _13 = std::future::Ready::<()>(move _41);
 +         StorageDead(_41);
 +         StorageDead(_14);
-+         _12 = <std::future::Ready<()> as IntoFuture>::into_future(move _13) -> [return: bb4, unwind unreachable];
-+     }
-+ 
-      bb4: {
--         StorageDead(_2);
--         return;
++         _12 = move _13;
 +         StorageDead(_13);
 +         _36 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
 +         (((*_36) as variant#3).1: std::future::Ready<()>) = move _12;
-+         goto -> bb5;
++         goto -> bb4;
 +     }
 + 
-+     bb5: {
+      bb4: {
+-         StorageDead(_2);
+-         return;
 +         StorageLive(_17);
 +         StorageLive(_18);
 +         StorageLive(_19);
@@ -185,10 +218,7 @@
 +         _37 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
 +         _21 = &mut (((*_37) as variant#3).1: std::future::Ready<()>);
 +         _20 = &mut (*_21);
-+         _19 = Pin::<&mut std::future::Ready<()>>::new_unchecked(move _20) -> [return: bb6, unwind unreachable];
-+     }
-+ 
-+     bb6: {
++         _19 = Pin::<&mut std::future::Ready<()>> { __pointer: copy _20 };
 +         StorageDead(_20);
 +         StorageLive(_22);
 +         StorageLive(_23);
@@ -197,21 +227,36 @@
 +         _23 = move _24;
 +         _22 = &mut (*_23);
 +         StorageDead(_24);
-+         _18 = <std::future::Ready<()> as Future>::poll(move _19, move _22) -> [return: bb7, unwind unreachable];
-+     }
-+ 
-+     bb7: {
-+         StorageDead(_22);
-+         StorageDead(_19);
-+         _25 = discriminant(_18);
-+         switchInt(move _25) -> [0: bb10, 1: bb9, otherwise: bb8];
++         StorageLive(_45);
++         StorageLive(_46);
++         StorageLive(_49);
++         StorageLive(_51);
++         StorageLive(_42);
++         StorageLive(_43);
++         StorageLive(_44);
++         _46 = &mut _19;
++         StorageLive(_47);
++         StorageLive(_48);
++         _48 = &mut (_19.0: &mut std::future::Ready<()>);
++         _45 = copy (_19.0: &mut std::future::Ready<()>);
++         StorageDead(_48);
++         _47 = Pin::<&mut std::future::Ready<()>> { __pointer: copy _45 };
++         StorageDead(_47);
++         _44 = &mut ((*_45).0: std::option::Option<()>);
++         _49 = Option::<()>::None;
++         _43 = copy ((*_45).0: std::option::Option<()>);
++         ((*_45).0: std::option::Option<()>) = copy _49;
++         StorageDead(_44);
++         StorageLive(_50);
++         _50 = discriminant(_43);
++         switchInt(move _50) -> [0: bb11, 1: bb12, otherwise: bb5];
 +     }
 + 
-+     bb8: {
++     bb5: {
 +         unreachable;
 +     }
 + 
-+     bb9: {
++     bb6: {
 +         _17 = const ();
 +         StorageDead(_23);
 +         StorageDead(_21);
@@ -229,7 +274,7 @@
 +         goto -> bb2;
 +     }
 + 
-+     bb10: {
++     bb7: {
 +         StorageLive(_26);
 +         _26 = copy ((_18 as Ready).0: ());
 +         _30 = copy _26;
@@ -240,17 +285,17 @@
 +         StorageDead(_17);
 +         StorageDead(_12);
 +         _39 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
-+         drop((((*_39) as variant#3).0: ActionPermit<'_, T>)) -> [return: bb11, unwind unreachable];
++         drop((((*_39) as variant#3).0: ActionPermit<'_, T>)) -> [return: bb8, unwind unreachable];
 +     }
 + 
-+     bb11: {
++     bb8: {
 +         _7 = Poll::<()>::Ready(move _30);
 +         _40 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
 +         discriminant((*_40)) = 1;
 +         goto -> bb2;
 +     }
 + 
-+     bb12: {
++     bb9: {
 +         StorageLive(_12);
 +         StorageLive(_28);
 +         StorageLive(_29);
@@ -259,11 +304,31 @@
 +         _31 = move _28;
 +         StorageDead(_28);
 +         _16 = const ();
-+         goto -> bb5;
++         goto -> bb4;
 +     }
 + 
-+     bb13: {
-+         assert(const false, "`async fn` resumed after completion") -> [success: bb13, unwind unreachable];
++     bb10: {
++         assert(const false, "`async fn` resumed after completion") -> [success: bb10, unwind unreachable];
++     }
++ 
++     bb11: {
++         _51 = option::expect_failed(const "`Ready` polled after completion") -> unwind unreachable;
++     }
++ 
++     bb12: {
++         _42 = move ((_43 as Some).0: ());
++         StorageDead(_50);
++         StorageDead(_43);
++         _18 = Poll::<()>::Ready(move _42);
++         StorageDead(_42);
++         StorageDead(_51);
++         StorageDead(_49);
++         StorageDead(_46);
++         StorageDead(_45);
++         StorageDead(_22);
++         StorageDead(_19);
++         _25 = discriminant(_18);
++         switchInt(move _25) -> [0: bb7, 1: bb6, otherwise: bb5];
       }
   }
   
diff --git a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff
index b1840beb3ef..eb757e09114 100644
--- a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff
@@ -57,10 +57,46 @@
 +                         let _26: ();
 +                         scope 9 {
 +                         }
++                         scope 12 (inlined Pin::<&mut std::future::Ready<()>>::new_unchecked) {
++                         }
++                         scope 13 (inlined <std::future::Ready<()> as Future>::poll) {
++                             let mut _44: ();
++                             let mut _45: std::option::Option<()>;
++                             let mut _46: &mut std::option::Option<()>;
++                             let mut _47: &mut std::future::Ready<()>;
++                             let mut _48: &mut std::pin::Pin<&mut std::future::Ready<()>>;
++                             scope 14 (inlined <Pin<&mut std::future::Ready<()>> as DerefMut>::deref_mut) {
++                                 let mut _49: std::pin::Pin<&mut std::future::Ready<()>>;
++                                 scope 15 (inlined Pin::<&mut std::future::Ready<()>>::as_mut) {
++                                     let mut _50: &mut &mut std::future::Ready<()>;
++                                     scope 16 (inlined Pin::<&mut std::future::Ready<()>>::new_unchecked) {
++                                     }
++                                     scope 18 (inlined <&mut std::future::Ready<()> as DerefMut>::deref_mut) {
++                                     }
++                                 }
++                                 scope 17 (inlined Pin::<&mut std::future::Ready<()>>::get_mut) {
++                                 }
++                             }
++                             scope 19 (inlined Option::<()>::take) {
++                                 let mut _51: std::option::Option<()>;
++                                 scope 20 (inlined std::mem::replace::<Option<()>>) {
++                                     scope 21 {
++                                     }
++                                 }
++                             }
++                             scope 22 (inlined #[track_caller] Option::<()>::expect) {
++                                 let mut _52: isize;
++                                 let mut _53: !;
++                                 scope 23 {
++                                 }
++                             }
++                         }
 +                     }
 +                     scope 10 (inlined ready::<()>) {
 +                         let mut _43: std::option::Option<()>;
 +                     }
++                     scope 11 (inlined <std::future::Ready<()> as IntoFuture>::into_future) {
++                     }
 +                 }
 +             }
           }
@@ -117,7 +153,7 @@
 +         StorageLive(_42);
 +         _33 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
 +         _32 = discriminant((*_33));
-+         switchInt(move _32) -> [0: bb5, 1: bb22, 2: bb21, 3: bb20, otherwise: bb10];
++         switchInt(move _32) -> [0: bb5, 1: bb15, 2: bb14, 3: bb13, otherwise: bb7];
       }
   
 -     bb3: {
@@ -181,21 +217,16 @@
 +         _13 = std::future::Ready::<()>(move _43);
 +         StorageDead(_43);
 +         StorageDead(_14);
-+         _12 = <std::future::Ready<()> as IntoFuture>::into_future(move _13) -> [return: bb6, unwind: bb17];
-      }
-  
--     bb5 (cleanup): {
--         drop(_2) -> [return: bb6, unwind terminate(cleanup)];
-+     bb6: {
++         _12 = move _13;
 +         StorageDead(_13);
 +         _36 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
 +         (((*_36) as variant#3).1: std::future::Ready<()>) = move _12;
-+         goto -> bb7;
++         goto -> bb6;
       }
   
--     bb6 (cleanup): {
--         resume;
-+     bb7: {
+-     bb5 (cleanup): {
+-         drop(_2) -> [return: bb6, unwind terminate(cleanup)];
++     bb6: {
 +         StorageLive(_17);
 +         StorageLive(_18);
 +         StorageLive(_19);
@@ -204,10 +235,7 @@
 +         _37 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
 +         _21 = &mut (((*_37) as variant#3).1: std::future::Ready<()>);
 +         _20 = &mut (*_21);
-+         _19 = Pin::<&mut std::future::Ready<()>>::new_unchecked(move _20) -> [return: bb8, unwind: bb15];
-+     }
-+ 
-+     bb8: {
++         _19 = Pin::<&mut std::future::Ready<()>> { __pointer: copy _20 };
 +         StorageDead(_20);
 +         StorageLive(_22);
 +         StorageLive(_23);
@@ -216,21 +244,38 @@
 +         _23 = move _24;
 +         _22 = &mut (*_23);
 +         StorageDead(_24);
-+         _18 = <std::future::Ready<()> as Future>::poll(move _19, move _22) -> [return: bb9, unwind: bb14];
-+     }
-+ 
-+     bb9: {
-+         StorageDead(_22);
-+         StorageDead(_19);
-+         _25 = discriminant(_18);
-+         switchInt(move _25) -> [0: bb12, 1: bb11, otherwise: bb10];
-+     }
-+ 
-+     bb10: {
++         StorageLive(_47);
++         StorageLive(_48);
++         StorageLive(_51);
++         StorageLive(_53);
++         StorageLive(_44);
++         StorageLive(_45);
++         StorageLive(_46);
++         _48 = &mut _19;
++         StorageLive(_49);
++         StorageLive(_50);
++         _50 = &mut (_19.0: &mut std::future::Ready<()>);
++         _47 = copy (_19.0: &mut std::future::Ready<()>);
++         StorageDead(_50);
++         _49 = Pin::<&mut std::future::Ready<()>> { __pointer: copy _47 };
++         StorageDead(_49);
++         _46 = &mut ((*_47).0: std::option::Option<()>);
++         _51 = Option::<()>::None;
++         _45 = copy ((*_47).0: std::option::Option<()>);
++         ((*_47).0: std::option::Option<()>) = copy _51;
++         StorageDead(_46);
++         StorageLive(_52);
++         _52 = discriminant(_45);
++         switchInt(move _52) -> [0: bb16, 1: bb17, otherwise: bb7];
+      }
+  
+-     bb6 (cleanup): {
+-         resume;
++     bb7: {
 +         unreachable;
 +     }
 + 
-+     bb11: {
++     bb8: {
 +         _17 = const ();
 +         StorageDead(_23);
 +         StorageDead(_21);
@@ -248,7 +293,7 @@
 +         goto -> bb4;
 +     }
 + 
-+     bb12: {
++     bb9: {
 +         StorageLive(_26);
 +         _26 = copy ((_18 as Ready).0: ());
 +         _30 = copy _26;
@@ -259,54 +304,35 @@
 +         StorageDead(_17);
 +         StorageDead(_12);
 +         _39 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
-+         drop((((*_39) as variant#3).0: ActionPermit<'_, T>)) -> [return: bb13, unwind: bb19];
++         drop((((*_39) as variant#3).0: ActionPermit<'_, T>)) -> [return: bb10, unwind: bb12];
 +     }
 + 
-+     bb13: {
++     bb10: {
 +         _7 = Poll::<()>::Ready(move _30);
 +         _40 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
 +         discriminant((*_40)) = 1;
 +         goto -> bb4;
 +     }
 + 
-+     bb14 (cleanup): {
++     bb11 (cleanup): {
 +         StorageDead(_22);
 +         StorageDead(_19);
 +         StorageDead(_23);
-+         goto -> bb16;
-+     }
-+ 
-+     bb15 (cleanup): {
-+         StorageDead(_20);
-+         StorageDead(_19);
-+         goto -> bb16;
-+     }
-+ 
-+     bb16 (cleanup): {
 +         StorageDead(_21);
 +         StorageDead(_18);
 +         StorageDead(_17);
-+         goto -> bb18;
-+     }
-+ 
-+     bb17 (cleanup): {
-+         StorageDead(_13);
-+         goto -> bb18;
-+     }
-+ 
-+     bb18 (cleanup): {
 +         StorageDead(_12);
 +         _41 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
-+         drop((((*_41) as variant#3).0: ActionPermit<'_, T>)) -> [return: bb19, unwind terminate(cleanup)];
++         drop((((*_41) as variant#3).0: ActionPermit<'_, T>)) -> [return: bb12, unwind terminate(cleanup)];
 +     }
 + 
-+     bb19 (cleanup): {
++     bb12 (cleanup): {
 +         _42 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
 +         discriminant((*_42)) = 2;
 +         goto -> bb2;
 +     }
 + 
-+     bb20: {
++     bb13: {
 +         StorageLive(_12);
 +         StorageLive(_28);
 +         StorageLive(_29);
@@ -315,15 +341,35 @@
 +         _31 = move _28;
 +         StorageDead(_28);
 +         _16 = const ();
-+         goto -> bb7;
++         goto -> bb6;
 +     }
 + 
-+     bb21: {
-+         assert(const false, "`async fn` resumed after panicking") -> [success: bb21, unwind: bb2];
++     bb14: {
++         assert(const false, "`async fn` resumed after panicking") -> [success: bb14, unwind: bb2];
 +     }
 + 
-+     bb22: {
-+         assert(const false, "`async fn` resumed after completion") -> [success: bb22, unwind: bb2];
++     bb15: {
++         assert(const false, "`async fn` resumed after completion") -> [success: bb15, unwind: bb2];
++     }
++ 
++     bb16: {
++         _53 = option::expect_failed(const "`Ready` polled after completion") -> bb11;
++     }
++ 
++     bb17: {
++         _44 = move ((_45 as Some).0: ());
++         StorageDead(_52);
++         StorageDead(_45);
++         _18 = Poll::<()>::Ready(move _44);
++         StorageDead(_44);
++         StorageDead(_53);
++         StorageDead(_51);
++         StorageDead(_48);
++         StorageDead(_47);
++         StorageDead(_22);
++         StorageDead(_19);
++         _25 = discriminant(_18);
++         switchInt(move _25) -> [0: bb9, 1: bb8, otherwise: bb7];
       }
   }
   
diff --git a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-abort.diff b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-abort.diff
index d0b50c597c4..5f9a8fe9547 100644
--- a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-abort.diff
+++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-abort.diff
@@ -53,12 +53,12 @@
       bb3: {
           StorageDead(_9);
           _0 = MyThing::<T> { v: move _2, i: move _5, a: move _8 };
-          StorageDead(_8);
-          StorageDead(_5);
-          StorageDead(_2);
           StorageDead(_10);
+          StorageDead(_8);
           StorageDead(_7);
+          StorageDead(_5);
           StorageDead(_4);
+          StorageDead(_2);
           return;
       }
   }
diff --git a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-unwind.diff b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-unwind.diff
index b8f4f348530..0a02c2d4c0f 100644
--- a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-unwind.diff
+++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-unwind.diff
@@ -53,12 +53,12 @@
       bb3: {
           StorageDead(_9);
           _0 = MyThing::<T> { v: move _2, i: move _5, a: move _8 };
-          StorageDead(_8);
-          StorageDead(_5);
-          StorageDead(_2);
           StorageDead(_10);
+          StorageDead(_8);
           StorageDead(_7);
+          StorageDead(_5);
           StorageDead(_4);
+          StorageDead(_2);
           return;
       }
   
diff --git a/tests/mir-opt/pre-codegen/checked_ops.rs b/tests/mir-opt/pre-codegen/checked_ops.rs
index 56f8e3f8338..8fd340503f5 100644
--- a/tests/mir-opt/pre-codegen/checked_ops.rs
+++ b/tests/mir-opt/pre-codegen/checked_ops.rs
@@ -1,4 +1,3 @@
-// skip-filecheck
 //@ compile-flags: -O -Zmir-opt-level=2
 // EMIT_MIR_FOR_EACH_PANIC_STRATEGY
 
@@ -8,10 +7,48 @@
 // EMIT_MIR checked_ops.step_forward.PreCodegen.after.mir
 pub fn step_forward(x: u16, n: usize) -> u16 {
     // This uses `u16` so that the conversion to usize is always widening.
+
+    // CHECK-LABEL: fn step_forward
+    // CHECK: inlined{{.+}}forward
     std::iter::Step::forward(x, n)
 }
 
 // EMIT_MIR checked_ops.checked_shl.PreCodegen.after.mir
 pub fn checked_shl(x: u32, rhs: u32) -> Option<u32> {
+    // CHECK-LABEL: fn checked_shl
+    // CHECK: [[TEMP:_[0-9]+]] = ShlUnchecked(copy _1, copy _2)
+    // CHECK: _0 = Option::<u32>::Some({{move|copy}} [[TEMP]])
     x.checked_shl(rhs)
 }
+
+// EMIT_MIR checked_ops.use_checked_sub.PreCodegen.after.mir
+pub fn use_checked_sub(x: u32, rhs: u32) {
+    // We want this to be equivalent to open-coding it, leaving no `Option`s around.
+    // FIXME(#138544): It's not yet.
+
+    // CHECK-LABEL: fn use_checked_sub
+    // CHECK: inlined{{.+}}u32{{.+}}checked_sub
+    // CHECK: [[DELTA:_[0-9]+]] = SubUnchecked(copy _1, copy _2)
+    // CHECK: [[TEMP1:_.+]] = Option::<u32>::Some(move [[DELTA]]);
+    // CHECK: [[TEMP2:_.+]] = {{move|copy}} (([[TEMP1]] as Some).0: u32);
+    // CHECK: do_something({{move|copy}} [[TEMP2]])
+    if let Some(delta) = x.checked_sub(rhs) {
+        do_something(delta);
+    }
+}
+
+// EMIT_MIR checked_ops.saturating_sub_at_home.PreCodegen.after.mir
+pub fn saturating_sub_at_home(lhs: u32, rhs: u32) -> u32 {
+    // FIXME(#138544): Similarly here, the `Option` ought to optimize away
+
+    // CHECK-LABEL: fn saturating_sub_at_home
+    // CHECK: [[DELTA:_[0-9]+]] = SubUnchecked(copy _1, copy _2)
+    // CHECK: [[TEMP1:_.+]] = Option::<u32>::Some({{move|copy}} [[DELTA]]);
+    // CHECK: [[TEMP2:_.+]] = {{move|copy}} (([[TEMP1]] as Some).0: u32);
+    // CHECK: _0 = {{move|copy}} [[TEMP2]];
+    u32::checked_sub(lhs, rhs).unwrap_or(0)
+}
+
+unsafe extern "Rust" {
+    safe fn do_something(_: u32);
+}
diff --git a/tests/mir-opt/pre-codegen/checked_ops.saturating_sub_at_home.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/checked_ops.saturating_sub_at_home.PreCodegen.after.panic-abort.mir
new file mode 100644
index 00000000000..5b4fdeda857
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/checked_ops.saturating_sub_at_home.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,48 @@
+// MIR for `saturating_sub_at_home` after PreCodegen
+
+fn saturating_sub_at_home(_1: u32, _2: u32) -> u32 {
+    debug lhs => _1;
+    debug rhs => _2;
+    let mut _0: u32;
+    let mut _5: std::option::Option<u32>;
+    scope 1 (inlined core::num::<impl u32>::checked_sub) {
+        let mut _3: bool;
+        let mut _4: u32;
+    }
+    scope 2 (inlined Option::<u32>::unwrap_or) {
+        let _6: u32;
+        scope 3 {
+        }
+    }
+
+    bb0: {
+        StorageLive(_5);
+        StorageLive(_3);
+        _3 = Lt(copy _1, copy _2);
+        switchInt(move _3) -> [0: bb1, otherwise: bb2];
+    }
+
+    bb1: {
+        StorageLive(_4);
+        _4 = SubUnchecked(copy _1, copy _2);
+        _5 = Option::<u32>::Some(move _4);
+        StorageDead(_4);
+        StorageDead(_3);
+        StorageLive(_6);
+        _6 = move ((_5 as Some).0: u32);
+        _0 = move _6;
+        StorageDead(_6);
+        goto -> bb3;
+    }
+
+    bb2: {
+        StorageDead(_3);
+        _0 = const 0_u32;
+        goto -> bb3;
+    }
+
+    bb3: {
+        StorageDead(_5);
+        return;
+    }
+}
diff --git a/tests/mir-opt/pre-codegen/checked_ops.saturating_sub_at_home.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/checked_ops.saturating_sub_at_home.PreCodegen.after.panic-unwind.mir
new file mode 100644
index 00000000000..5b4fdeda857
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/checked_ops.saturating_sub_at_home.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,48 @@
+// MIR for `saturating_sub_at_home` after PreCodegen
+
+fn saturating_sub_at_home(_1: u32, _2: u32) -> u32 {
+    debug lhs => _1;
+    debug rhs => _2;
+    let mut _0: u32;
+    let mut _5: std::option::Option<u32>;
+    scope 1 (inlined core::num::<impl u32>::checked_sub) {
+        let mut _3: bool;
+        let mut _4: u32;
+    }
+    scope 2 (inlined Option::<u32>::unwrap_or) {
+        let _6: u32;
+        scope 3 {
+        }
+    }
+
+    bb0: {
+        StorageLive(_5);
+        StorageLive(_3);
+        _3 = Lt(copy _1, copy _2);
+        switchInt(move _3) -> [0: bb1, otherwise: bb2];
+    }
+
+    bb1: {
+        StorageLive(_4);
+        _4 = SubUnchecked(copy _1, copy _2);
+        _5 = Option::<u32>::Some(move _4);
+        StorageDead(_4);
+        StorageDead(_3);
+        StorageLive(_6);
+        _6 = move ((_5 as Some).0: u32);
+        _0 = move _6;
+        StorageDead(_6);
+        goto -> bb3;
+    }
+
+    bb2: {
+        StorageDead(_3);
+        _0 = const 0_u32;
+        goto -> bb3;
+    }
+
+    bb3: {
+        StorageDead(_5);
+        return;
+    }
+}
diff --git a/tests/mir-opt/pre-codegen/checked_ops.use_checked_sub.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/checked_ops.use_checked_sub.PreCodegen.after.panic-abort.mir
new file mode 100644
index 00000000000..3c475cd4030
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/checked_ops.use_checked_sub.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,44 @@
+// MIR for `use_checked_sub` after PreCodegen
+
+fn use_checked_sub(_1: u32, _2: u32) -> () {
+    debug x => _1;
+    debug rhs => _2;
+    let mut _0: ();
+    let mut _5: std::option::Option<u32>;
+    let _7: ();
+    scope 1 {
+        debug delta => _6;
+        let _6: u32;
+        scope 2 (inlined core::num::<impl u32>::checked_sub) {
+            let mut _3: bool;
+            let mut _4: u32;
+        }
+    }
+
+    bb0: {
+        StorageLive(_5);
+        StorageLive(_3);
+        _3 = Lt(copy _1, copy _2);
+        switchInt(move _3) -> [0: bb1, otherwise: bb2];
+    }
+
+    bb1: {
+        StorageLive(_4);
+        _4 = SubUnchecked(copy _1, copy _2);
+        _5 = Option::<u32>::Some(move _4);
+        StorageDead(_4);
+        StorageDead(_3);
+        _6 = copy ((_5 as Some).0: u32);
+        _7 = do_something(move _6) -> [return: bb3, unwind unreachable];
+    }
+
+    bb2: {
+        StorageDead(_3);
+        goto -> bb3;
+    }
+
+    bb3: {
+        StorageDead(_5);
+        return;
+    }
+}
diff --git a/tests/mir-opt/pre-codegen/checked_ops.use_checked_sub.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/checked_ops.use_checked_sub.PreCodegen.after.panic-unwind.mir
new file mode 100644
index 00000000000..3ef09764b1c
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/checked_ops.use_checked_sub.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,44 @@
+// MIR for `use_checked_sub` after PreCodegen
+
+fn use_checked_sub(_1: u32, _2: u32) -> () {
+    debug x => _1;
+    debug rhs => _2;
+    let mut _0: ();
+    let mut _5: std::option::Option<u32>;
+    let _7: ();
+    scope 1 {
+        debug delta => _6;
+        let _6: u32;
+        scope 2 (inlined core::num::<impl u32>::checked_sub) {
+            let mut _3: bool;
+            let mut _4: u32;
+        }
+    }
+
+    bb0: {
+        StorageLive(_5);
+        StorageLive(_3);
+        _3 = Lt(copy _1, copy _2);
+        switchInt(move _3) -> [0: bb1, otherwise: bb2];
+    }
+
+    bb1: {
+        StorageLive(_4);
+        _4 = SubUnchecked(copy _1, copy _2);
+        _5 = Option::<u32>::Some(move _4);
+        StorageDead(_4);
+        StorageDead(_3);
+        _6 = copy ((_5 as Some).0: u32);
+        _7 = do_something(move _6) -> [return: bb3, unwind continue];
+    }
+
+    bb2: {
+        StorageDead(_3);
+        goto -> bb3;
+    }
+
+    bb3: {
+        StorageDead(_5);
+        return;
+    }
+}
diff --git a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir
index be69bbf10e7..1f9c464d633 100644
--- a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir
@@ -26,6 +26,18 @@ fn int_range(_1: usize, _2: usize) -> () {
                 let mut _12: usize;
                 scope 6 {
                     debug old => _11;
+                    scope 8 (inlined <usize as Step>::forward_unchecked) {
+                        debug start => _11;
+                        debug n => const 1_usize;
+                        scope 9 (inlined core::num::<impl usize>::unchecked_add) {
+                            debug self => _11;
+                            debug rhs => const 1_usize;
+                            scope 10 (inlined core::ub_checks::check_language_ub) {
+                                scope 11 (inlined core::ub_checks::check_language_ub::runtime) {
+                                }
+                            }
+                        }
+                    }
                 }
                 scope 7 (inlined std::cmp::impls::<impl PartialOrd for usize>::lt) {
                     debug self => _6;
@@ -50,7 +62,6 @@ fn int_range(_1: usize, _2: usize) -> () {
     bb1: {
         StorageLive(_13);
         _5 = &mut _4;
-        StorageLive(_11);
         StorageLive(_10);
         StorageLive(_6);
         _6 = &(_4.0: usize);
@@ -70,7 +81,6 @@ fn int_range(_1: usize, _2: usize) -> () {
         StorageDead(_7);
         StorageDead(_6);
         StorageDead(_10);
-        StorageDead(_11);
         StorageDead(_13);
         StorageDead(_4);
         return;
@@ -81,20 +91,16 @@ fn int_range(_1: usize, _2: usize) -> () {
         StorageDead(_6);
         _11 = copy (_4.0: usize);
         StorageLive(_12);
-        _12 = <usize as Step>::forward_unchecked(copy _11, const 1_usize) -> [return: bb4, unwind continue];
-    }
-
-    bb4: {
+        _12 = AddUnchecked(copy _11, const 1_usize);
         (_4.0: usize) = move _12;
         StorageDead(_12);
         _13 = Option::<usize>::Some(copy _11);
         StorageDead(_10);
-        StorageDead(_11);
         _14 = copy ((_13 as Some).0: usize);
-        _15 = opaque::<usize>(move _14) -> [return: bb5, unwind continue];
+        _15 = opaque::<usize>(move _14) -> [return: bb4, unwind continue];
     }
 
-    bb5: {
+    bb4: {
         StorageDead(_13);
         goto -> bb1;
     }
diff --git a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-abort.mir
index ed494f6e74c..958a06bcd34 100644
--- a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-abort.mir
@@ -6,10 +6,6 @@ fn mem_replace(_1: &mut u32, _2: u32) -> u32 {
     let mut _0: u32;
     scope 1 (inlined std::mem::replace::<u32>) {
         scope 2 {
-            scope 4 (inlined std::ptr::write::<u32>) {
-            }
-        }
-        scope 3 (inlined std::ptr::read::<u32>) {
         }
     }
 
diff --git a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-unwind.mir
index ed494f6e74c..958a06bcd34 100644
--- a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-unwind.mir
@@ -6,10 +6,6 @@ fn mem_replace(_1: &mut u32, _2: u32) -> u32 {
     let mut _0: u32;
     scope 1 (inlined std::mem::replace::<u32>) {
         scope 2 {
-            scope 4 (inlined std::ptr::write::<u32>) {
-            }
-        }
-        scope 3 (inlined std::ptr::read::<u32>) {
         }
     }
 
diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir
index 5d33c33d73f..0aa37203c1b 100644
--- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir
@@ -23,6 +23,14 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
                 let _7: u32;
                 let mut _8: u32;
                 scope 6 {
+                    scope 8 (inlined <u32 as Step>::forward_unchecked) {
+                        scope 9 (inlined core::num::<impl u32>::unchecked_add) {
+                            scope 10 (inlined core::ub_checks::check_language_ub) {
+                                scope 11 (inlined core::ub_checks::check_language_ub::runtime) {
+                                }
+                            }
+                        }
+                    }
                 }
                 scope 7 (inlined std::cmp::impls::<impl PartialOrd for u32>::lt) {
                     let mut _5: u32;
@@ -41,7 +49,6 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
 
     bb1: {
         StorageLive(_9);
-        StorageLive(_7);
         StorageLive(_6);
         StorageLive(_5);
         _5 = copy _4;
@@ -52,7 +59,6 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
 
     bb2: {
         StorageDead(_6);
-        StorageDead(_7);
         StorageDead(_9);
         StorageDead(_4);
         drop(_3) -> [return: bb3, unwind unreachable];
@@ -65,24 +71,20 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
     bb4: {
         _7 = copy _4;
         StorageLive(_8);
-        _8 = <u32 as Step>::forward_unchecked(copy _7, const 1_usize) -> [return: bb5, unwind unreachable];
-    }
-
-    bb5: {
+        _8 = AddUnchecked(copy _7, const 1_u32);
         _4 = move _8;
         StorageDead(_8);
         _9 = Option::<u32>::Some(copy _7);
         StorageDead(_6);
-        StorageDead(_7);
         _10 = copy ((_9 as Some).0: u32);
         StorageLive(_11);
         _11 = &_3;
         StorageLive(_12);
         _12 = (copy _10,);
-        _13 = <impl Fn(u32) as Fn<(u32,)>>::call(move _11, move _12) -> [return: bb6, unwind unreachable];
+        _13 = <impl Fn(u32) as Fn<(u32,)>>::call(move _11, move _12) -> [return: bb5, unwind unreachable];
     }
 
-    bb6: {
+    bb5: {
         StorageDead(_12);
         StorageDead(_11);
         StorageDead(_9);
diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir
index ded30a15520..699d8bc8fea 100644
--- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir
@@ -23,6 +23,14 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
                 let _7: u32;
                 let mut _8: u32;
                 scope 6 {
+                    scope 8 (inlined <u32 as Step>::forward_unchecked) {
+                        scope 9 (inlined core::num::<impl u32>::unchecked_add) {
+                            scope 10 (inlined core::ub_checks::check_language_ub) {
+                                scope 11 (inlined core::ub_checks::check_language_ub::runtime) {
+                                }
+                            }
+                        }
+                    }
                 }
                 scope 7 (inlined std::cmp::impls::<impl PartialOrd for u32>::lt) {
                     let mut _5: u32;
@@ -41,7 +49,6 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
 
     bb1: {
         StorageLive(_9);
-        StorageLive(_7);
         StorageLive(_6);
         StorageLive(_5);
         _5 = copy _4;
@@ -52,7 +59,6 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
 
     bb2: {
         StorageDead(_6);
-        StorageDead(_7);
         StorageDead(_9);
         StorageDead(_4);
         drop(_3) -> [return: bb3, unwind continue];
@@ -65,35 +71,31 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
     bb4: {
         _7 = copy _4;
         StorageLive(_8);
-        _8 = <u32 as Step>::forward_unchecked(copy _7, const 1_usize) -> [return: bb5, unwind: bb7];
-    }
-
-    bb5: {
+        _8 = AddUnchecked(copy _7, const 1_u32);
         _4 = move _8;
         StorageDead(_8);
         _9 = Option::<u32>::Some(copy _7);
         StorageDead(_6);
-        StorageDead(_7);
         _10 = copy ((_9 as Some).0: u32);
         StorageLive(_11);
         _11 = &_3;
         StorageLive(_12);
         _12 = (copy _10,);
-        _13 = <impl Fn(u32) as Fn<(u32,)>>::call(move _11, move _12) -> [return: bb6, unwind: bb7];
+        _13 = <impl Fn(u32) as Fn<(u32,)>>::call(move _11, move _12) -> [return: bb5, unwind: bb6];
     }
 
-    bb6: {
+    bb5: {
         StorageDead(_12);
         StorageDead(_11);
         StorageDead(_9);
         goto -> bb1;
     }
 
-    bb7 (cleanup): {
-        drop(_3) -> [return: bb8, unwind terminate(cleanup)];
+    bb6 (cleanup): {
+        drop(_3) -> [return: bb7, unwind terminate(cleanup)];
     }
 
-    bb8 (cleanup): {
+    bb7 (cleanup): {
         resume;
     }
 }
diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir
index 2621ec67531..f3033d4a2fa 100644
--- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir
@@ -9,6 +9,14 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> {
             let _5: u32;
             let mut _6: u32;
             scope 3 {
+                scope 5 (inlined <u32 as Step>::forward_unchecked) {
+                    scope 6 (inlined core::num::<impl u32>::unchecked_add) {
+                        scope 7 (inlined core::ub_checks::check_language_ub) {
+                            scope 8 (inlined core::ub_checks::check_language_ub::runtime) {
+                            }
+                        }
+                    }
+                }
             }
             scope 4 (inlined std::cmp::impls::<impl PartialOrd for u32>::lt) {
                 let mut _2: u32;
@@ -18,7 +26,6 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> {
     }
 
     bb0: {
-        StorageLive(_5);
         StorageLive(_4);
         StorageLive(_2);
         _2 = copy ((*_1).0: u32);
@@ -32,25 +39,21 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> {
 
     bb1: {
         _0 = const Option::<u32>::None;
-        goto -> bb4;
+        goto -> bb3;
     }
 
     bb2: {
         _5 = copy ((*_1).0: u32);
         StorageLive(_6);
-        _6 = <u32 as Step>::forward_unchecked(copy _5, const 1_usize) -> [return: bb3, unwind unreachable];
-    }
-
-    bb3: {
+        _6 = AddUnchecked(copy _5, const 1_u32);
         ((*_1).0: u32) = move _6;
         StorageDead(_6);
         _0 = Option::<u32>::Some(copy _5);
-        goto -> bb4;
+        goto -> bb3;
     }
 
-    bb4: {
+    bb3: {
         StorageDead(_4);
-        StorageDead(_5);
         return;
     }
 }
diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir
index 338fb4b9523..f3033d4a2fa 100644
--- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir
@@ -9,6 +9,14 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> {
             let _5: u32;
             let mut _6: u32;
             scope 3 {
+                scope 5 (inlined <u32 as Step>::forward_unchecked) {
+                    scope 6 (inlined core::num::<impl u32>::unchecked_add) {
+                        scope 7 (inlined core::ub_checks::check_language_ub) {
+                            scope 8 (inlined core::ub_checks::check_language_ub::runtime) {
+                            }
+                        }
+                    }
+                }
             }
             scope 4 (inlined std::cmp::impls::<impl PartialOrd for u32>::lt) {
                 let mut _2: u32;
@@ -18,7 +26,6 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> {
     }
 
     bb0: {
-        StorageLive(_5);
         StorageLive(_4);
         StorageLive(_2);
         _2 = copy ((*_1).0: u32);
@@ -32,25 +39,21 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> {
 
     bb1: {
         _0 = const Option::<u32>::None;
-        goto -> bb4;
+        goto -> bb3;
     }
 
     bb2: {
         _5 = copy ((*_1).0: u32);
         StorageLive(_6);
-        _6 = <u32 as Step>::forward_unchecked(copy _5, const 1_usize) -> [return: bb3, unwind continue];
-    }
-
-    bb3: {
+        _6 = AddUnchecked(copy _5, const 1_u32);
         ((*_1).0: u32) = move _6;
         StorageDead(_6);
         _0 = Option::<u32>::Some(copy _5);
-        goto -> bb4;
+        goto -> bb3;
     }
 
-    bb4: {
+    bb3: {
         StorageDead(_4);
-        StorageDead(_5);
         return;
     }
 }
diff --git a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir
index cbfc58194cc..7595ad88d9d 100644
--- a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir
@@ -3,7 +3,7 @@
 fn ezmap(_1: Option<i32>) -> Option<i32> {
     debug x => _1;
     let mut _0: std::option::Option<i32>;
-    scope 1 (inlined map::<i32, i32, {closure@$DIR/simple_option_map.rs:17:12: 17:15}>) {
+    scope 1 (inlined map::<i32, i32, {closure@$DIR/simple_option_map.rs:23:12: 23:15}>) {
         let mut _2: isize;
         let _3: i32;
         let mut _4: i32;
diff --git a/tests/mir-opt/pre-codegen/simple_option_map.map_via_question_mark.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/simple_option_map.map_via_question_mark.PreCodegen.after.mir
new file mode 100644
index 00000000000..b921b96966b
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/simple_option_map.map_via_question_mark.PreCodegen.after.mir
@@ -0,0 +1,70 @@
+// MIR for `map_via_question_mark` after PreCodegen
+
+fn map_via_question_mark(_1: Option<i32>) -> Option<i32> {
+    debug x => _1;
+    let mut _0: std::option::Option<i32>;
+    let mut _4: std::ops::ControlFlow<std::option::Option<std::convert::Infallible>, i32>;
+    let _5: i32;
+    let mut _6: i32;
+    scope 1 {
+        debug residual => const Option::<Infallible>::None;
+        scope 2 {
+            scope 7 (inlined <Option<i32> as FromResidual<Option<Infallible>>>::from_residual) {
+            }
+        }
+    }
+    scope 3 {
+        debug val => _5;
+        scope 4 {
+        }
+    }
+    scope 5 (inlined <Option<i32> as Try>::branch) {
+        let mut _2: isize;
+        let _3: i32;
+        scope 6 {
+        }
+    }
+
+    bb0: {
+        StorageLive(_6);
+        StorageLive(_4);
+        StorageLive(_2);
+        StorageLive(_3);
+        _2 = discriminant(_1);
+        switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb4];
+    }
+
+    bb1: {
+        StorageDead(_3);
+        StorageDead(_2);
+        _0 = const Option::<i32>::None;
+        StorageDead(_6);
+        StorageDead(_4);
+        goto -> bb3;
+    }
+
+    bb2: {
+        _3 = copy ((_1 as Some).0: i32);
+        _4 = ControlFlow::<Option<Infallible>, i32>::Continue(copy _3);
+        StorageDead(_3);
+        StorageDead(_2);
+        _5 = copy ((_4 as Continue).0: i32);
+        _6 = Add(copy _5, const 1_i32);
+        _0 = Option::<i32>::Some(move _6);
+        StorageDead(_6);
+        StorageDead(_4);
+        goto -> bb3;
+    }
+
+    bb3: {
+        return;
+    }
+
+    bb4: {
+        unreachable;
+    }
+}
+
+ALLOC0 (size: 8, align: 4) {
+    00 00 00 00 __ __ __ __                         │ ....░░░░
+}
diff --git a/tests/mir-opt/pre-codegen/simple_option_map.rs b/tests/mir-opt/pre-codegen/simple_option_map.rs
index 0c432be0419..f0d7b51a643 100644
--- a/tests/mir-opt/pre-codegen/simple_option_map.rs
+++ b/tests/mir-opt/pre-codegen/simple_option_map.rs
@@ -1,7 +1,6 @@
-// skip-filecheck
 //@ compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
 
-#[inline(always)]
+#[inline]
 fn map<T, U, F>(slf: Option<T>, f: F) -> Option<U>
 where
     F: FnOnce(T) -> U,
@@ -14,9 +13,30 @@ where
 
 // EMIT_MIR simple_option_map.ezmap.PreCodegen.after.mir
 pub fn ezmap(x: Option<i32>) -> Option<i32> {
+    // We expect this to all be inlined, as though it was written without the
+    // combinator and without the closure, using just a plain match.
+
+    // CHECK-LABEL: fn ezmap
+    // CHECK: [[INNER:_.+]] = copy ((_1 as Some).0: i32);
+    // CHECK: [[SUCC:_.+]] = Add({{copy|move}} [[INNER]], const 1_i32);
+    // CHECK: _0 = Option::<i32>::Some({{copy|move}} [[SUCC]]);
     map(x, |n| n + 1)
 }
 
+// EMIT_MIR simple_option_map.map_via_question_mark.PreCodegen.after.mir
+pub fn map_via_question_mark(x: Option<i32>) -> Option<i32> {
+    // FIXME(#138544): Ideally this would optimize out the `ControlFlow` local.
+
+    // CHECK-LABEL: fn map_via_question_mark
+    // CHECK: [[INNER:_.+]] = copy ((_1 as Some).0: i32);
+    // CHECK: [[TEMP1:_.+]] = ControlFlow::<Option<Infallible>, i32>::Continue(copy [[INNER]]);
+    // CHECK: [[TEMP2:_.+]] = copy (([[TEMP1]] as Continue).0: i32);
+    // CHECK: [[SUCC:_.+]] = Add({{copy|move}} [[TEMP2]], const 1_i32);
+    // CHECK: _0 = Option::<i32>::Some({{copy|move}} [[SUCC]]);
+    Some(x? + 1)
+}
+
 fn main() {
     assert_eq!(None, ezmap(None));
+    assert_eq!(None, map_via_question_mark(None));
 }
diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir
index 151783969dd..f8d11df5185 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir
@@ -28,6 +28,14 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
                 let _7: usize;
                 let mut _8: usize;
                 scope 7 {
+                    scope 9 (inlined <usize as Step>::forward_unchecked) {
+                        scope 10 (inlined core::num::<impl usize>::unchecked_add) {
+                            scope 11 (inlined core::ub_checks::check_language_ub) {
+                                scope 12 (inlined core::ub_checks::check_language_ub::runtime) {
+                                }
+                            }
+                        }
+                    }
                 }
                 scope 8 (inlined std::cmp::impls::<impl PartialOrd for usize>::lt) {
                     let mut _5: usize;
@@ -47,7 +55,6 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
 
     bb1: {
         StorageLive(_9);
-        StorageLive(_7);
         StorageLive(_6);
         StorageLive(_5);
         _5 = copy _4;
@@ -58,7 +65,6 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
 
     bb2: {
         StorageDead(_6);
-        StorageDead(_7);
         StorageDead(_9);
         StorageDead(_4);
         drop(_2) -> [return: bb3, unwind unreachable];
@@ -71,30 +77,26 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
     bb4: {
         _7 = copy _4;
         StorageLive(_8);
-        _8 = <usize as Step>::forward_unchecked(copy _7, const 1_usize) -> [return: bb5, unwind unreachable];
-    }
-
-    bb5: {
+        _8 = AddUnchecked(copy _7, const 1_usize);
         _4 = move _8;
         StorageDead(_8);
         _9 = Option::<usize>::Some(copy _7);
         StorageDead(_6);
-        StorageDead(_7);
         _10 = copy ((_9 as Some).0: usize);
         _11 = Lt(copy _10, copy _3);
-        assert(move _11, "index out of bounds: the length is {} but the index is {}", copy _3, copy _10) -> [success: bb6, unwind unreachable];
+        assert(move _11, "index out of bounds: the length is {} but the index is {}", copy _3, copy _10) -> [success: bb5, unwind unreachable];
     }
 
-    bb6: {
+    bb5: {
         _12 = &(*_1)[_10];
         StorageLive(_13);
         _13 = &_2;
         StorageLive(_14);
         _14 = (copy _10, copy _12);
-        _15 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _13, move _14) -> [return: bb7, unwind unreachable];
+        _15 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _13, move _14) -> [return: bb6, unwind unreachable];
     }
 
-    bb7: {
+    bb6: {
         StorageDead(_14);
         StorageDead(_13);
         StorageDead(_9);
diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir
index 006329dc20d..2c249197894 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir
@@ -28,6 +28,14 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
                 let _7: usize;
                 let mut _8: usize;
                 scope 7 {
+                    scope 9 (inlined <usize as Step>::forward_unchecked) {
+                        scope 10 (inlined core::num::<impl usize>::unchecked_add) {
+                            scope 11 (inlined core::ub_checks::check_language_ub) {
+                                scope 12 (inlined core::ub_checks::check_language_ub::runtime) {
+                                }
+                            }
+                        }
+                    }
                 }
                 scope 8 (inlined std::cmp::impls::<impl PartialOrd for usize>::lt) {
                     let mut _5: usize;
@@ -47,7 +55,6 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
 
     bb1: {
         StorageLive(_9);
-        StorageLive(_7);
         StorageLive(_6);
         StorageLive(_5);
         _5 = copy _4;
@@ -58,7 +65,6 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
 
     bb2: {
         StorageDead(_6);
-        StorageDead(_7);
         StorageDead(_9);
         StorageDead(_4);
         drop(_2) -> [return: bb3, unwind continue];
@@ -71,41 +77,37 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
     bb4: {
         _7 = copy _4;
         StorageLive(_8);
-        _8 = <usize as Step>::forward_unchecked(copy _7, const 1_usize) -> [return: bb5, unwind: bb8];
-    }
-
-    bb5: {
+        _8 = AddUnchecked(copy _7, const 1_usize);
         _4 = move _8;
         StorageDead(_8);
         _9 = Option::<usize>::Some(copy _7);
         StorageDead(_6);
-        StorageDead(_7);
         _10 = copy ((_9 as Some).0: usize);
         _11 = Lt(copy _10, copy _3);
-        assert(move _11, "index out of bounds: the length is {} but the index is {}", copy _3, copy _10) -> [success: bb6, unwind: bb8];
+        assert(move _11, "index out of bounds: the length is {} but the index is {}", copy _3, copy _10) -> [success: bb5, unwind: bb7];
     }
 
-    bb6: {
+    bb5: {
         _12 = &(*_1)[_10];
         StorageLive(_13);
         _13 = &_2;
         StorageLive(_14);
         _14 = (copy _10, copy _12);
-        _15 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _13, move _14) -> [return: bb7, unwind: bb8];
+        _15 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _13, move _14) -> [return: bb6, unwind: bb7];
     }
 
-    bb7: {
+    bb6: {
         StorageDead(_14);
         StorageDead(_13);
         StorageDead(_9);
         goto -> bb1;
     }
 
-    bb8 (cleanup): {
-        drop(_2) -> [return: bb9, unwind terminate(cleanup)];
+    bb7 (cleanup): {
+        drop(_2) -> [return: bb8, unwind terminate(cleanup)];
     }
 
-    bb9 (cleanup): {
+    bb8 (cleanup): {
         resume;
     }
 }
diff --git a/tests/mir-opt/pre-codegen/tuple_ord.demo_ge_partial.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/tuple_ord.demo_ge_partial.PreCodegen.after.mir
new file mode 100644
index 00000000000..dd2eebc8f4a
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/tuple_ord.demo_ge_partial.PreCodegen.after.mir
@@ -0,0 +1,70 @@
+// MIR for `demo_ge_partial` after PreCodegen
+
+fn demo_ge_partial(_1: &(f32, f32), _2: &(f32, f32)) -> bool {
+    debug a => _1;
+    debug b => _2;
+    let mut _0: bool;
+    scope 1 (inlined std::cmp::impls::<impl PartialOrd for &(f32, f32)>::ge) {
+        scope 2 (inlined core::tuple::<impl PartialOrd for (f32, f32)>::ge) {
+            let mut _7: std::ops::ControlFlow<bool>;
+            let _8: bool;
+            scope 3 {
+            }
+            scope 4 (inlined std::cmp::impls::<impl PartialOrd for f32>::__chaining_ge) {
+                let mut _3: f32;
+                let mut _4: f32;
+                let mut _5: bool;
+                let mut _6: bool;
+                scope 5 {
+                }
+            }
+            scope 6 (inlined std::cmp::impls::<impl PartialOrd for f32>::ge) {
+                let mut _9: f32;
+                let mut _10: f32;
+            }
+        }
+    }
+
+    bb0: {
+        StorageLive(_7);
+        StorageLive(_3);
+        StorageLive(_4);
+        _3 = copy ((*_1).0: f32);
+        _4 = copy ((*_2).0: f32);
+        StorageLive(_5);
+        _5 = Eq(copy _3, copy _4);
+        switchInt(move _5) -> [0: bb1, otherwise: bb2];
+    }
+
+    bb1: {
+        StorageLive(_6);
+        _6 = Ge(copy _3, copy _4);
+        _7 = ControlFlow::<bool>::Break(move _6);
+        StorageDead(_6);
+        StorageDead(_5);
+        StorageDead(_4);
+        StorageDead(_3);
+        _8 = copy ((_7 as Break).0: bool);
+        _0 = copy _8;
+        goto -> bb3;
+    }
+
+    bb2: {
+        StorageDead(_5);
+        StorageDead(_4);
+        StorageDead(_3);
+        StorageLive(_9);
+        _9 = copy ((*_1).1: f32);
+        StorageLive(_10);
+        _10 = copy ((*_2).1: f32);
+        _0 = Ge(move _9, move _10);
+        StorageDead(_10);
+        StorageDead(_9);
+        goto -> bb3;
+    }
+
+    bb3: {
+        StorageDead(_7);
+        return;
+    }
+}
diff --git a/tests/mir-opt/pre-codegen/tuple_ord.demo_le_total.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/tuple_ord.demo_le_total.PreCodegen.after.mir
new file mode 100644
index 00000000000..ea1d164cefa
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/tuple_ord.demo_le_total.PreCodegen.after.mir
@@ -0,0 +1,70 @@
+// MIR for `demo_le_total` after PreCodegen
+
+fn demo_le_total(_1: &(u16, i16), _2: &(u16, i16)) -> bool {
+    debug a => _1;
+    debug b => _2;
+    let mut _0: bool;
+    scope 1 (inlined std::cmp::impls::<impl PartialOrd for &(u16, i16)>::le) {
+        scope 2 (inlined core::tuple::<impl PartialOrd for (u16, i16)>::le) {
+            let mut _7: std::ops::ControlFlow<bool>;
+            let _8: bool;
+            scope 3 {
+            }
+            scope 4 (inlined std::cmp::impls::<impl PartialOrd for u16>::__chaining_le) {
+                let mut _3: u16;
+                let mut _4: u16;
+                let mut _5: bool;
+                let mut _6: bool;
+                scope 5 {
+                }
+            }
+            scope 6 (inlined std::cmp::impls::<impl PartialOrd for i16>::le) {
+                let mut _9: i16;
+                let mut _10: i16;
+            }
+        }
+    }
+
+    bb0: {
+        StorageLive(_7);
+        StorageLive(_3);
+        StorageLive(_4);
+        _3 = copy ((*_1).0: u16);
+        _4 = copy ((*_2).0: u16);
+        StorageLive(_5);
+        _5 = Eq(copy _3, copy _4);
+        switchInt(move _5) -> [0: bb1, otherwise: bb2];
+    }
+
+    bb1: {
+        StorageLive(_6);
+        _6 = Le(copy _3, copy _4);
+        _7 = ControlFlow::<bool>::Break(move _6);
+        StorageDead(_6);
+        StorageDead(_5);
+        StorageDead(_4);
+        StorageDead(_3);
+        _8 = copy ((_7 as Break).0: bool);
+        _0 = copy _8;
+        goto -> bb3;
+    }
+
+    bb2: {
+        StorageDead(_5);
+        StorageDead(_4);
+        StorageDead(_3);
+        StorageLive(_9);
+        _9 = copy ((*_1).1: i16);
+        StorageLive(_10);
+        _10 = copy ((*_2).1: i16);
+        _0 = Le(move _9, move _10);
+        StorageDead(_10);
+        StorageDead(_9);
+        goto -> bb3;
+    }
+
+    bb3: {
+        StorageDead(_7);
+        return;
+    }
+}
diff --git a/tests/mir-opt/pre-codegen/tuple_ord.rs b/tests/mir-opt/pre-codegen/tuple_ord.rs
new file mode 100644
index 00000000000..74a919e5424
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/tuple_ord.rs
@@ -0,0 +1,16 @@
+//@ compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=0
+//@ needs-unwind
+
+#![crate_type = "lib"]
+
+// EMIT_MIR tuple_ord.demo_le_total.PreCodegen.after.mir
+pub fn demo_le_total(a: &(u16, i16), b: &(u16, i16)) -> bool {
+    // CHECK-LABEL: demo_le_total
+    a <= b
+}
+
+// EMIT_MIR tuple_ord.demo_ge_partial.PreCodegen.after.mir
+pub fn demo_ge_partial(a: &(f32, f32), b: &(f32, f32)) -> bool {
+    // CHECK-LABEL: demo_ge_partial
+    a >= b
+}
diff --git a/tests/pretty/autodiff_forward.pp b/tests/pretty/autodiff_forward.pp
index 23c3b5b34a8..dc7a2712f42 100644
--- a/tests/pretty/autodiff_forward.pp
+++ b/tests/pretty/autodiff_forward.pp
@@ -53,7 +53,7 @@ pub fn df2(x: &[f64], bx: &[f64], y: f64) -> f64 {
 pub fn f3(x: &[f64], y: f64) -> f64 {
     ::core::panicking::panic("not implemented")
 }
-#[rustc_autodiff(ForwardFirst, Dual, Const, Const,)]
+#[rustc_autodiff(Forward, Dual, Const, Const,)]
 #[inline(never)]
 pub fn df3(x: &[f64], bx: &[f64], y: f64) -> f64 {
     unsafe { asm!("NOP", options(pure, nomem)); };
@@ -73,10 +73,6 @@ pub fn df4() {
 }
 #[rustc_autodiff]
 #[inline(never)]
-#[rustc_autodiff]
-#[inline(never)]
-#[rustc_autodiff]
-#[inline(never)]
 pub fn f5(x: &[f64], y: f64) -> f64 {
     ::core::panicking::panic("not implemented")
 }
diff --git a/tests/pretty/autodiff_forward.rs b/tests/pretty/autodiff_forward.rs
index 35108d0d6f1..bc558211632 100644
--- a/tests/pretty/autodiff_forward.rs
+++ b/tests/pretty/autodiff_forward.rs
@@ -19,7 +19,7 @@ pub fn f2(x: &[f64], y: f64) -> f64 {
     unimplemented!()
 }
 
-#[autodiff(df3, ForwardFirst, Dual, Const, Const)]
+#[autodiff(df3, Forward, Dual, Const, Const)]
 pub fn f3(x: &[f64], y: f64) -> f64 {
     unimplemented!()
 }
diff --git a/tests/pretty/autodiff_reverse.pp b/tests/pretty/autodiff_reverse.pp
index a98d3782c70..b2cf0244af4 100644
--- a/tests/pretty/autodiff_reverse.pp
+++ b/tests/pretty/autodiff_reverse.pp
@@ -51,7 +51,7 @@ pub fn df2() {
 pub fn f3(x: &[f64], y: f64) -> f64 {
     ::core::panicking::panic("not implemented")
 }
-#[rustc_autodiff(ReverseFirst, Duplicated, Const, Active,)]
+#[rustc_autodiff(Reverse, Duplicated, Const, Active,)]
 #[inline(never)]
 pub fn df3(x: &[f64], dx: &mut [f64], y: f64, dret: f64) -> f64 {
     unsafe { asm!("NOP", options(pure, nomem)); };
diff --git a/tests/pretty/autodiff_reverse.rs b/tests/pretty/autodiff_reverse.rs
index 657201caa94..3c024272f40 100644
--- a/tests/pretty/autodiff_reverse.rs
+++ b/tests/pretty/autodiff_reverse.rs
@@ -18,7 +18,7 @@ pub fn f1(x: &[f64], y: f64) -> f64 {
 #[autodiff(df2, Reverse)]
 pub fn f2() {}
 
-#[autodiff(df3, ReverseFirst, Duplicated, Const, Active)]
+#[autodiff(df3, Reverse, Duplicated, Const, Active)]
 pub fn f3(x: &[f64], y: f64) -> f64 {
     unimplemented!()
 }
diff --git a/tests/pretty/hir-fn-params.pp b/tests/pretty/hir-fn-params.pp
new file mode 100644
index 00000000000..3799c8a3c3b
--- /dev/null
+++ b/tests/pretty/hir-fn-params.pp
@@ -0,0 +1,38 @@
+#[prelude_import]
+use ::std::prelude::rust_2015::*;
+#[macro_use]
+extern crate std;
+//@ pretty-compare-only
+//@ pretty-mode:hir
+//@ pp-exact:hir-fn-params.pp
+
+// This tests the pretty-printing of various kinds of function parameters.
+
+//---------------------------------------------------------------------------
+// Normal functions and methods.
+
+fn normal_fn(_: u32, a: u32) { }
+
+struct S;
+impl S {
+    fn method(_: u32, a: u32) { }
+}
+
+//---------------------------------------------------------------------------
+// More exotic forms, which get a different pretty-printing path. In the past,
+// anonymous params and `_` params printed incorrectly, e.g. `fn(u32, _: u32)`
+// was printed as `fn(: u32, : u32)`.
+//
+// Ideally we would also test invalid patterns, e.g. `fn(1: u32, &a: u32)`,
+// because they had similar problems. But the pretty-printing tests currently
+// can't contain compile errors.
+
+fn bare_fn(x: fn(u32, _: u32, a: u32)) { }
+
+extern "C" {
+    unsafe fn foreign_fn(_: u32, a: u32);
+}
+
+trait T {
+    fn trait_fn(u32, _: u32, a: u32);
+}
diff --git a/tests/pretty/hir-fn-params.rs b/tests/pretty/hir-fn-params.rs
new file mode 100644
index 00000000000..5ace5289d08
--- /dev/null
+++ b/tests/pretty/hir-fn-params.rs
@@ -0,0 +1,34 @@
+//@ pretty-compare-only
+//@ pretty-mode:hir
+//@ pp-exact:hir-fn-params.pp
+
+// This tests the pretty-printing of various kinds of function parameters.
+
+//---------------------------------------------------------------------------
+// Normal functions and methods.
+
+fn normal_fn(_: u32, a: u32) {}
+
+struct S;
+impl S {
+    fn method(_: u32, a: u32) {}
+}
+
+//---------------------------------------------------------------------------
+// More exotic forms, which get a different pretty-printing path. In the past,
+// anonymous params and `_` params printed incorrectly, e.g. `fn(u32, _: u32)`
+// was printed as `fn(: u32, : u32)`.
+//
+// Ideally we would also test invalid patterns, e.g. `fn(1: u32, &a: u32)`,
+// because they had similar problems. But the pretty-printing tests currently
+// can't contain compile errors.
+
+fn bare_fn(x: fn(u32, _: u32, a: u32)) {}
+
+extern "C" {
+    fn foreign_fn(_: u32, a: u32);
+}
+
+trait T {
+    fn trait_fn(u32, _: u32, a: u32);
+}
diff --git a/tests/pretty/hir-lifetimes.pp b/tests/pretty/hir-lifetimes.pp
new file mode 100644
index 00000000000..4d1ab9d383b
--- /dev/null
+++ b/tests/pretty/hir-lifetimes.pp
@@ -0,0 +1,96 @@
+//@ pretty-compare-only
+//@ pretty-mode:hir
+//@ pp-exact:hir-lifetimes.pp
+
+// This tests the pretty-printing of lifetimes in lots of ways.
+
+#![allow(unused)]
+#[prelude_import]
+use ::std::prelude::rust_2015::*;
+#[macro_use]
+extern crate std;
+
+struct Foo<'a> {
+    x: &'a u32,
+}
+
+impl <'a> Foo<'a> {
+    fn f<'b>(x: &'b u32) { }
+}
+
+impl  Foo<'_> {
+    fn a(x: &'_ u32) { }
+
+    fn b(x: &'_ u32) { }
+
+    fn c(x: &'_ u32, y: &'static u32) { }
+
+    // FIXME: `'a` before `self` is omitted
+    fn d<'a>(&self, x: &'a u32) { }
+
+    // FIXME: impl Traits printed as just `/*impl Trait*/`, ugh
+    fn iter1<'a>(&self)
+        -> /*impl Trait*/ { #[lang = "Range"] { start: 0, end: 1 } }
+
+    fn iter2(&self)
+        -> /*impl Trait*/ { #[lang = "Range"] { start: 0, end: 1 } }
+}
+
+fn a(x: Foo<'_>) { }
+
+fn b<'a>(x: Foo<'a>) { }
+
+struct Bar<'a, 'b, 'c, T> {
+    x: &'a u32,
+    y: &'b &'c u32,
+    z: T,
+}
+
+fn f1<'a, 'b, T>(x: Bar<'a, 'b, '_, T>) { }
+
+fn f2(x: Bar<'_, '_, '_, u32>) { }
+
+trait MyTrait<'a, 'b> {
+    fn f(&self, x: Foo<'a>, y: Foo<'b>);
+}
+
+impl <'a, 'b, 'c, T> MyTrait<'a, 'b> for Bar<'a, 'b, 'c, T> {
+    fn f(&self, x: Foo<'a>, y: Foo<'b>) { }
+}
+
+fn g(x: &'_ dyn for<'a, 'b> MyTrait<'a, 'b>) { }
+
+trait Blah { }
+
+type T<'a> = dyn Blah + 'a;
+
+type Q<'a> = dyn MyTrait<'a, 'a> + 'a;
+
+fn h<'b, F>(f: F, y: Foo<'b>) where F: for<'d> MyTrait<'d, 'b> { }
+
+// FIXME(?): attr printing is weird
+#[attr = Repr([ReprC])]
+struct S<'a>(&'a u32);
+
+extern "C" {
+    unsafe fn g1(s: S<'_>);
+    unsafe fn g2(s: S<'_>);
+    unsafe fn g3<'a>(s: S<'a>);
+}
+
+struct St<'a> {
+    x: &'a u32,
+}
+
+fn f() { { let _ = St { x: &0 }; }; { let _ = St { x: &0 }; }; }
+
+struct Name<'a>(&'a str);
+
+const A: Name<'_> = Name("a");
+const B: &'_ str = "";
+static C: &'_ str = "";
+static D: &'static str = "";
+
+fn tr(_: Box<dyn Blah>) { }
+
+fn main() { }
diff --git a/tests/pretty/hir-lifetimes.rs b/tests/pretty/hir-lifetimes.rs
new file mode 100644
index 00000000000..1379be34392
--- /dev/null
+++ b/tests/pretty/hir-lifetimes.rs
@@ -0,0 +1,91 @@
+//@ pretty-compare-only
+//@ pretty-mode:hir
+//@ pp-exact:hir-lifetimes.pp
+
+// This tests the pretty-printing of lifetimes in lots of ways.
+
+#![allow(unused)]
+
+struct Foo<'a> {
+    x: &'a u32,
+}
+
+impl<'a> Foo<'a> {
+    fn f<'b>(x: &'b u32) {}
+}
+
+impl Foo<'_> {
+    fn a(x: &u32) {}
+
+    fn b(x: &'_ u32) {}
+
+    fn c(x: &'_ u32, y: &'static u32) {}
+
+    // FIXME: `'a` before `self` is omitted
+    fn d<'a>(&'a self, x: &'a u32) {}
+
+    // FIXME: impl Traits printed as just `/*impl Trait*/`, ugh
+    fn iter1<'a>(&self) -> impl Iterator<Item = u32> + 'a { 0..1 }
+
+    fn iter2(&self) -> impl Iterator<Item = u32> + '_ { 0..1 }
+}
+
+fn a(x: Foo<'_>) {}
+
+fn b<'a>(x: Foo<'a>) {}
+
+struct Bar<'a, 'b, 'c, T> {
+    x: &'a u32,
+    y: &'b &'c u32,
+    z: T,
+}
+
+fn f1<'a, 'b, T>(x: Bar<'a, 'b, '_, T>) {}
+
+fn f2(x: Bar<'_, '_, '_, u32>) {}
+
+trait MyTrait<'a, 'b> {
+    fn f(&self, x: Foo<'a>, y: Foo<'b>);
+}
+
+impl<'a, 'b, 'c, T> MyTrait<'a, 'b> for Bar<'a, 'b, 'c, T> {
+    fn f(&self, x: Foo<'a>, y: Foo<'b>) {}
+}
+
+fn g(x: &dyn for<'a, 'b> MyTrait<'a, 'b>) {}
+
+trait Blah {}
+
+type T<'a> = dyn Blah + 'a;
+
+type Q<'a> = dyn MyTrait<'a, 'a> + 'a;
+
+fn h<'b, F>(f: F, y: Foo<'b>) where F: for<'d> MyTrait<'d, 'b> {}
+
+// FIXME(?): attr printing is weird
+#[repr(C)]
+struct S<'a>(&'a u32);
+
+extern "C" {
+    fn g1(s: S);
+    fn g2(s: S<'_>);
+    fn g3<'a>(s: S<'a>);
+}
+
+struct St<'a> { x: &'a u32 }
+
+fn f() {
+    _ = St { x: &0 };
+    _ = St::<'_> { x: &0 };
+}
+
+struct Name<'a>(&'a str);
+
+const A: Name = Name("a");
+const B: &str = "";
+static C: &'_ str = "";
+static D: &'static str = "";
+
+fn tr(_: Box<dyn Blah>) {}
+
+fn main() {}
diff --git a/tests/pretty/hir-pretty-attr.pp b/tests/pretty/hir-pretty-attr.pp
index 586810b0046..d8cc8c424ca 100644
--- a/tests/pretty/hir-pretty-attr.pp
+++ b/tests/pretty/hir-pretty-attr.pp
@@ -6,6 +6,6 @@ extern crate std;
 //@ pretty-mode:hir
 //@ pp-exact:hir-pretty-attr.pp
 
-#[attr="Repr([ReprC, ReprPacked(Align(4 bytes)), ReprTransparent])")]
+#[attr = Repr([ReprC, ReprPacked(Align(4 bytes)), ReprTransparent])]
 struct Example {
 }
diff --git a/tests/pretty/hir-struct-expr.pp b/tests/pretty/hir-struct-expr.pp
new file mode 100644
index 00000000000..f85d17542df
--- /dev/null
+++ b/tests/pretty/hir-struct-expr.pp
@@ -0,0 +1,28 @@
+#[prelude_import]
+use ::std::prelude::rust_2015::*;
+#[macro_use]
+extern crate std;
+//@ pretty-compare-only
+//@ pretty-mode:hir
+//@ pp-exact:hir-struct-expr.pp
+
+struct StructWithSomeFields {
+    field_1: i32,
+    field_2: i32,
+    field_3: i32,
+    field_4: i32,
+    field_5: i32,
+    field_6: i32,
+}
+
+fn main() {
+    let a =
+        StructWithSomeFields {
+            field_1: 1,
+            field_2: 2,
+            field_3: 3,
+            field_4: 4,
+            field_5: 5,
+            field_6: 6 };
+    let a = StructWithSomeFields { field_1: 1, field_2: 2, ..a };
+}
diff --git a/tests/pretty/hir-struct-expr.rs b/tests/pretty/hir-struct-expr.rs
new file mode 100644
index 00000000000..9580f5d557d
--- /dev/null
+++ b/tests/pretty/hir-struct-expr.rs
@@ -0,0 +1,24 @@
+//@ pretty-compare-only
+//@ pretty-mode:hir
+//@ pp-exact:hir-struct-expr.pp
+
+struct StructWithSomeFields {
+    field_1: i32,
+    field_2: i32,
+    field_3: i32,
+    field_4: i32,
+    field_5: i32,
+    field_6: i32,
+}
+
+fn main() {
+    let a = StructWithSomeFields {
+        field_1: 1,
+        field_2: 2,
+        field_3: 3,
+        field_4: 4,
+        field_5: 5,
+        field_6: 6,
+    };
+    let a = StructWithSomeFields { field_1: 1, field_2: 2, ..a };
+}
diff --git a/tests/pretty/postfix-yield.rs b/tests/pretty/postfix-yield.rs
new file mode 100644
index 00000000000..f76e8142ae8
--- /dev/null
+++ b/tests/pretty/postfix-yield.rs
@@ -0,0 +1,15 @@
+// This demonstrates a proposed alternate or additional option of having yield in postfix position.
+//@ edition: 2024
+//@ pp-exact
+
+#![feature(gen_blocks, coroutines, coroutine_trait, yield_expr)]
+
+use std::ops::{Coroutine, CoroutineState};
+use std::pin::pin;
+
+fn main() {
+    let mut gn = gen { yield 1; 2.yield; (1 + 2).yield; };
+
+    let mut coro =
+        pin!(#[coroutine] |_: i32| { let x = 1.yield; (x + 2).yield; });
+}
diff --git a/tests/pretty/tests-are-sorted.pp b/tests/pretty/tests-are-sorted.pp
index 31449b51dc3..d6a2c0ff979 100644
--- a/tests/pretty/tests-are-sorted.pp
+++ b/tests/pretty/tests-are-sorted.pp
@@ -10,7 +10,6 @@ extern crate std;
 //@ pp-exact:tests-are-sorted.pp
 
 extern crate test;
-#[cfg(test)]
 #[rustc_test_marker = "m_test"]
 #[doc(hidden)]
 pub const m_test: test::TestDescAndFn =
@@ -35,7 +34,6 @@ pub const m_test: test::TestDescAndFn =
 fn m_test() {}
 
 extern crate test;
-#[cfg(test)]
 #[rustc_test_marker = "z_test"]
 #[doc(hidden)]
 pub const z_test: test::TestDescAndFn =
@@ -61,7 +59,6 @@ pub const z_test: test::TestDescAndFn =
 fn z_test() {}
 
 extern crate test;
-#[cfg(test)]
 #[rustc_test_marker = "a_test"]
 #[doc(hidden)]
 pub const a_test: test::TestDescAndFn =
diff --git a/tests/run-make/core-no-fp-fmt-parse/rmake.rs b/tests/run-make/core-no-fp-fmt-parse/rmake.rs
index 3586922f28e..a790ada40db 100644
--- a/tests/run-make/core-no-fp-fmt-parse/rmake.rs
+++ b/tests/run-make/core-no-fp-fmt-parse/rmake.rs
@@ -5,7 +5,7 @@ use run_make_support::{rustc, source_root};
 
 fn main() {
     rustc()
-        .edition("2021")
+        .edition("2024")
         .arg("-Dwarnings")
         .crate_type("rlib")
         .input(source_root().join("library/core/src/lib.rs"))
diff --git a/tests/run-make/doctests-keep-binaries/rmake.rs b/tests/run-make/doctests-keep-binaries/rmake.rs
index 246539bcf82..a05223994df 100644
--- a/tests/run-make/doctests-keep-binaries/rmake.rs
+++ b/tests/run-make/doctests-keep-binaries/rmake.rs
@@ -1,3 +1,5 @@
+//@ ignore-cross-compile attempts to run the doctests
+
 // Check that valid binaries are persisted by running them, regardless of whether the
 // --run or --no-run option is used.
 
diff --git a/tests/run-make/linker-warning/rmake.rs b/tests/run-make/linker-warning/rmake.rs
index 73ad248b6f3..bc21739fefc 100644
--- a/tests/run-make/linker-warning/rmake.rs
+++ b/tests/run-make/linker-warning/rmake.rs
@@ -4,7 +4,7 @@ fn run_rustc() -> Rustc {
     let mut rustc = rustc();
     rustc
         .arg("main.rs")
-        // NOTE: `link-self-contained` can vary depending on config.toml.
+        // NOTE: `link-self-contained` can vary depending on bootstrap.toml.
         // Make sure we use a consistent value.
         .arg("-Clink-self-contained=-linker")
         .arg("-Zunstable-options")
diff --git a/tests/run-make/non-unicode-env/non_unicode_env.stderr b/tests/run-make/non-unicode-env/non_unicode_env.stderr
index 1f260ac9c07..32868b13f74 100644
--- a/tests/run-make/non-unicode-env/non_unicode_env.stderr
+++ b/tests/run-make/non-unicode-env/non_unicode_env.stderr
@@ -3,16 +3,12 @@ error: environment variable `NON_UNICODE_VAR` is not a valid Unicode string
   |
 2 |     let _ = env!("NON_UNICODE_VAR");
   |             ^^^^^^^^^^^^^^^^^^^^^^^
-  |
-  = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: environment variable `NON_UNICODE_VAR` is not a valid Unicode string
  --> non_unicode_env.rs:3:13
   |
 3 |     let _ = option_env!("NON_UNICODE_VAR");
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-  |
-  = note: this error originates in the macro `option_env` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/run-make/rust-lld/rmake.rs b/tests/run-make/rust-lld/rmake.rs
index e5ae9435388..35f716c24c7 100644
--- a/tests/run-make/rust-lld/rmake.rs
+++ b/tests/run-make/rust-lld/rmake.rs
@@ -60,7 +60,8 @@ fn main() {
 }
 
 fn find_lld_version_in_logs(stderr: String) -> bool {
-    let lld_version_re =
-        Regex::new(r"^warning: linker std(out|err): LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap();
+    // Strip the `-Wlinker-messages` wrappers prefixing the linker output.
+    let stderr = Regex::new(r"warning: linker std(out|err):").unwrap().replace_all(&stderr, "");
+    let lld_version_re = Regex::new(r"^LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap();
     stderr.lines().any(|line| lld_version_re.is_match(line.trim()))
 }
diff --git a/tests/run-make/rustc-help/help-v.stdout b/tests/run-make/rustc-help/help-v.stdout
index c8ea09ee2c8..98e56735082 100644
--- a/tests/run-make/rustc-help/help-v.stdout
+++ b/tests/run-make/rustc-help/help-v.stdout
@@ -29,7 +29,7 @@ Options:
         --emit [asm|llvm-bc|llvm-ir|obj|metadata|link|dep-info|mir]
                         Comma separated list of types of output for the
                         compiler to emit
-        --print [all-target-specs-json|calling-conventions|cfg|check-cfg|code-models|crate-name|deployment-target|file-names|host-tuple|link-args|native-static-libs|relocation-models|split-debuginfo|stack-protector-strategies|sysroot|target-cpus|target-features|target-libdir|target-list|target-spec-json|tls-models]
+        --print [all-target-specs-json|calling-conventions|cfg|check-cfg|code-models|crate-name|deployment-target|file-names|host-tuple|link-args|native-static-libs|relocation-models|split-debuginfo|stack-protector-strategies|supported-crate-types|sysroot|target-cpus|target-features|target-libdir|target-list|target-spec-json|tls-models]
                         Compiler information to print on stdout
     -g                  Equivalent to -C debuginfo=2
     -O                  Equivalent to -C opt-level=3
diff --git a/tests/run-make/rustc-help/help.stdout b/tests/run-make/rustc-help/help.stdout
index 434e71e901e..040555f1d04 100644
--- a/tests/run-make/rustc-help/help.stdout
+++ b/tests/run-make/rustc-help/help.stdout
@@ -29,7 +29,7 @@ Options:
         --emit [asm|llvm-bc|llvm-ir|obj|metadata|link|dep-info|mir]
                         Comma separated list of types of output for the
                         compiler to emit
-        --print [all-target-specs-json|calling-conventions|cfg|check-cfg|code-models|crate-name|deployment-target|file-names|host-tuple|link-args|native-static-libs|relocation-models|split-debuginfo|stack-protector-strategies|sysroot|target-cpus|target-features|target-libdir|target-list|target-spec-json|tls-models]
+        --print [all-target-specs-json|calling-conventions|cfg|check-cfg|code-models|crate-name|deployment-target|file-names|host-tuple|link-args|native-static-libs|relocation-models|split-debuginfo|stack-protector-strategies|supported-crate-types|sysroot|target-cpus|target-features|target-libdir|target-list|target-spec-json|tls-models]
                         Compiler information to print on stdout
     -g                  Equivalent to -C debuginfo=2
     -O                  Equivalent to -C opt-level=3
diff --git a/tests/run-make/rustdoc-error-lines/rmake.rs b/tests/run-make/rustdoc-error-lines/rmake.rs
index ea5ec2faed9..0d8c500ed1e 100644
--- a/tests/run-make/rustdoc-error-lines/rmake.rs
+++ b/tests/run-make/rustdoc-error-lines/rmake.rs
@@ -8,11 +8,11 @@ fn main() {
 
     let should_contain = &[
         "input.rs - foo (line 5)",
-        "input.rs:7:15",
+        "input.rs:8:15",
         "input.rs - bar (line 13)",
-        "input.rs:15:15",
+        "input.rs:16:15",
         "input.rs - bar (line 22)",
-        "input.rs:24:15",
+        "input.rs:25:15",
     ];
     for text in should_contain {
         assert!(output.contains(text), "output doesn't contains {:?}", text);
diff --git a/tests/run-make/symbols-all-mangled/a_lib.rs b/tests/run-make/symbols-all-mangled/a_lib.rs
new file mode 100644
index 00000000000..716dd3263c5
--- /dev/null
+++ b/tests/run-make/symbols-all-mangled/a_lib.rs
@@ -0,0 +1 @@
+pub fn public_rust_function() {}
diff --git a/tests/run-make/symbols-all-mangled/an_executable.rs b/tests/run-make/symbols-all-mangled/an_executable.rs
new file mode 100644
index 00000000000..db8df13b9a7
--- /dev/null
+++ b/tests/run-make/symbols-all-mangled/an_executable.rs
@@ -0,0 +1,3 @@
+pub fn public_rust_function_from_exe() {}
+
+fn main() {}
diff --git a/tests/run-make/symbols-all-mangled/rmake.rs b/tests/run-make/symbols-all-mangled/rmake.rs
new file mode 100644
index 00000000000..1fb03c62399
--- /dev/null
+++ b/tests/run-make/symbols-all-mangled/rmake.rs
@@ -0,0 +1,96 @@
+// Check that all symbols in cdylibs, staticlibs and bins are mangled
+//@ only-elf some object file formats create multiple symbols for each function with different names
+
+use run_make_support::object::read::{Object, ObjectSymbol};
+use run_make_support::{bin_name, dynamic_lib_name, object, rfs, rustc, static_lib_name};
+
+fn main() {
+    let staticlib_name = static_lib_name("a_lib");
+    let cdylib_name = dynamic_lib_name("a_lib");
+    let exe_name = bin_name("an_executable");
+    rustc().crate_type("cdylib").input("a_lib.rs").run();
+    rustc().crate_type("staticlib").input("a_lib.rs").run();
+    rustc().crate_type("bin").input("an_executable.rs").run();
+
+    symbols_check_archive(&staticlib_name);
+    symbols_check(&cdylib_name);
+    symbols_check(&exe_name);
+}
+
+fn symbols_check_archive(path: &str) {
+    let binary_data = rfs::read(path);
+    let file = object::read::archive::ArchiveFile::parse(&*binary_data).unwrap();
+    for symbol in file.symbols().unwrap().unwrap() {
+        let symbol = symbol.unwrap();
+        let name = strip_underscore_if_apple(std::str::from_utf8(symbol.name()).unwrap());
+        if name.starts_with("_ZN") || name.starts_with("_R") {
+            continue; // Correctly mangled
+        }
+
+        let member_name =
+            std::str::from_utf8(file.member(symbol.offset()).unwrap().name()).unwrap();
+        if !member_name.ends_with(".rcgu.o") || member_name.contains("compiler_builtins") {
+            continue; // All compiler-builtins symbols must remain unmangled
+        }
+
+        if name == "__rust_no_alloc_shim_is_unstable" {
+            continue; // FIXME remove exception once we mangle this symbol
+        }
+
+        if name.contains("rust_eh_personality") {
+            continue; // Unfortunately LLVM doesn't allow us to mangle this symbol
+        }
+
+        if name.contains(".llvm.") {
+            // Starting in LLVM 21 we get various implementation-detail functions which
+            // contain .llvm. that are not a problem.
+            continue;
+        }
+
+        panic!("Unmangled symbol found in {path}: {name}");
+    }
+}
+
+fn symbols_check(path: &str) {
+    let binary_data = rfs::read(path);
+    let file = object::File::parse(&*binary_data).unwrap();
+    for symbol in file.symbols() {
+        if !symbol.is_definition() || !symbol.is_global() {
+            continue;
+        }
+        if symbol.is_weak() {
+            continue; // Likely an intrinsic from compiler-builtins
+        }
+        let name = strip_underscore_if_apple(symbol.name().unwrap());
+        if name.starts_with("_ZN") || name.starts_with("_R") {
+            continue; // Correctly mangled
+        }
+
+        if !name.contains("rust") {
+            // Assume that this symbol doesn't originate from rustc. This may
+            // be wrong, but even if so symbol_check_archive will likely
+            // catch it.
+            continue;
+        }
+
+        if name == "__rust_no_alloc_shim_is_unstable" {
+            continue; // FIXME remove exception once we mangle this symbol
+        }
+
+        if name.contains("rust_eh_personality") {
+            continue; // Unfortunately LLVM doesn't allow us to mangle this symbol
+        }
+
+        if name.contains(".llvm.") {
+            // Starting in LLVM 21 we get various implementation-detail functions which
+            // contain .llvm. that are not a problem.
+            continue;
+        }
+
+        panic!("Unmangled symbol found in {path}: {name}");
+    }
+}
+
+fn strip_underscore_if_apple(symbol: &str) -> &str {
+    if cfg!(target_vendor = "apple") { symbol.strip_prefix("_").unwrap() } else { symbol }
+}
diff --git a/tests/run-make/target-cpu-native/rmake.rs b/tests/run-make/target-cpu-native/rmake.rs
index fd5fb6193fe..7b7974f3097 100644
--- a/tests/run-make/target-cpu-native/rmake.rs
+++ b/tests/run-make/target-cpu-native/rmake.rs
@@ -3,6 +3,8 @@
 // warnings when used, and that binaries produced by it can also be successfully executed.
 // See https://github.com/rust-lang/rust/pull/23238
 
+//@ ignore-cross-compile target-cpu=native doesn't work well when cross compiling
+
 use run_make_support::{run, rustc};
 
 fn main() {
diff --git a/tests/rustdoc-json/assoc_items.rs b/tests/rustdoc-json/assoc_items.rs
index f315f37966d..f47a522e81a 100644
--- a/tests/rustdoc-json/assoc_items.rs
+++ b/tests/rustdoc-json/assoc_items.rs
@@ -3,32 +3,32 @@
 pub struct Simple;
 
 impl Simple {
-    //@ has "$.index[*][?(@.name=='CONSTANT')].inner.assoc_const"
+    //@ has "$.index[?(@.name=='CONSTANT')].inner.assoc_const"
     pub const CONSTANT: usize = 0;
 }
 
 pub trait EasyToImpl {
-    //@ has "$.index[*][?(@.docs=='ToDeclare trait')].inner.assoc_type"
-    //@ is "$.index[*][?(@.docs=='ToDeclare trait')].inner.assoc_type.type" null
-    //@ is "$.index[*][?(@.docs=='ToDeclare trait')].inner.assoc_type.bounds" []
+    //@ has "$.index[?(@.docs=='ToDeclare trait')].inner.assoc_type"
+    //@ is "$.index[?(@.docs=='ToDeclare trait')].inner.assoc_type.type" null
+    //@ is "$.index[?(@.docs=='ToDeclare trait')].inner.assoc_type.bounds" []
     /// ToDeclare trait
     type ToDeclare;
-    //@ has "$.index[*][?(@.docs=='AN_ATTRIBUTE trait')].inner.assoc_const"
-    //@ is "$.index[*][?(@.docs=='AN_ATTRIBUTE trait')].inner.assoc_const.value" null
-    //@ is "$.index[*][?(@.docs=='AN_ATTRIBUTE trait')].inner.assoc_const.type.primitive" '"usize"'
+    //@ has "$.index[?(@.docs=='AN_ATTRIBUTE trait')].inner.assoc_const"
+    //@ is "$.index[?(@.docs=='AN_ATTRIBUTE trait')].inner.assoc_const.value" null
+    //@ is "$.index[?(@.docs=='AN_ATTRIBUTE trait')].inner.assoc_const.type.primitive" '"usize"'
     /// AN_ATTRIBUTE trait
     const AN_ATTRIBUTE: usize;
 }
 
 impl EasyToImpl for Simple {
-    //@ has "$.index[*][?(@.docs=='ToDeclare impl')].inner.assoc_type"
-    //@ is "$.index[*][?(@.docs=='ToDeclare impl')].inner.assoc_type.type.primitive" \"usize\"
+    //@ has "$.index[?(@.docs=='ToDeclare impl')].inner.assoc_type"
+    //@ is "$.index[?(@.docs=='ToDeclare impl')].inner.assoc_type.type.primitive" \"usize\"
     /// ToDeclare impl
     type ToDeclare = usize;
 
-    //@ has "$.index[*][?(@.docs=='AN_ATTRIBUTE impl')].inner.assoc_const"
-    //@ is "$.index[*][?(@.docs=='AN_ATTRIBUTE impl')].inner.assoc_const.type.primitive" \"usize\"
-    //@ is "$.index[*][?(@.docs=='AN_ATTRIBUTE impl')].inner.assoc_const.value" \"12\"
+    //@ has "$.index[?(@.docs=='AN_ATTRIBUTE impl')].inner.assoc_const"
+    //@ is "$.index[?(@.docs=='AN_ATTRIBUTE impl')].inner.assoc_const.type.primitive" \"usize\"
+    //@ is "$.index[?(@.docs=='AN_ATTRIBUTE impl')].inner.assoc_const.value" \"12\"
     /// AN_ATTRIBUTE impl
     const AN_ATTRIBUTE: usize = 12;
 }
diff --git a/tests/rustdoc-json/assoc_type.rs b/tests/rustdoc-json/assoc_type.rs
index 43b4d387d92..816075ca17a 100644
--- a/tests/rustdoc-json/assoc_type.rs
+++ b/tests/rustdoc-json/assoc_type.rs
@@ -1,9 +1,9 @@
 // Regression test for <https://github.com/rust-lang/rust/issues/98547>.
 
-//@ has "$.index[*][?(@.name=='Trait')]"
-//@ has "$.index[*][?(@.name=='AssocType')]"
-//@ has "$.index[*][?(@.name=='S')]"
-//@ has "$.index[*][?(@.name=='S2')]"
+//@ has "$.index[?(@.name=='Trait')]"
+//@ has "$.index[?(@.name=='AssocType')]"
+//@ has "$.index[?(@.name=='S')]"
+//@ has "$.index[?(@.name=='S2')]"
 
 pub trait Trait {
     type AssocType;
diff --git a/tests/rustdoc-json/attrs/deprecated.rs b/tests/rustdoc-json/attrs/deprecated.rs
new file mode 100644
index 00000000000..0799471fc88
--- /dev/null
+++ b/tests/rustdoc-json/attrs/deprecated.rs
@@ -0,0 +1,38 @@
+//@ is "$.index[?(@.name=='not')].attrs" []
+//@ is "$.index[?(@.name=='not')].deprecation" null
+pub fn not() {}
+
+//@ is "$.index[?(@.name=='raw')].attrs" []
+//@ is "$.index[?(@.name=='raw')].deprecation" '{"since": null, "note": null}'
+#[deprecated]
+pub fn raw() {}
+
+//@ is "$.index[?(@.name=='equals_string')].attrs" []
+//@ is "$.index[?(@.name=='equals_string')].deprecation" '{"since": null, "note": "here is a reason"}'
+#[deprecated = "here is a reason"]
+pub fn equals_string() {}
+
+//@ is "$.index[?(@.name=='since')].attrs" []
+//@ is "$.index[?(@.name=='since')].deprecation" '{"since": "yoinks ago", "note": null}'
+#[deprecated(since = "yoinks ago")]
+pub fn since() {}
+
+//@ is "$.index[?(@.name=='note')].attrs" []
+//@ is "$.index[?(@.name=='note')].deprecation" '{"since": null, "note": "7"}'
+#[deprecated(note = "7")]
+pub fn note() {}
+
+//@ is "$.index[?(@.name=='since_and_note')].attrs" []
+//@ is "$.index[?(@.name=='since_and_note')].deprecation" '{"since": "tomorrow", "note": "sorry"}'
+#[deprecated(since = "tomorrow", note = "sorry")]
+pub fn since_and_note() {}
+
+//@ is "$.index[?(@.name=='note_and_since')].attrs" []
+//@ is "$.index[?(@.name=='note_and_since')].deprecation" '{"since": "a year from tomorrow", "note": "your welcome"}'
+#[deprecated(note = "your welcome", since = "a year from tomorrow")]
+pub fn note_and_since() {}
+
+//@ is "$.index[?(@.name=='neither_but_parens')].attrs" []
+//@ is "$.index[?(@.name=='neither_but_parens')].deprecation" '{"since": null, "note": null}'
+#[deprecated()]
+pub fn neither_but_parens() {}
diff --git a/tests/rustdoc-json/attrs/export_name_2021.rs b/tests/rustdoc-json/attrs/export_name_2021.rs
index badf124bdde..254e9f6ef5b 100644
--- a/tests/rustdoc-json/attrs/export_name_2021.rs
+++ b/tests/rustdoc-json/attrs/export_name_2021.rs
@@ -1,6 +1,6 @@
 //@ edition: 2021
 #![no_std]
 
-//@ is "$.index[*][?(@.name=='example')].attrs" '["#[export_name = \"altered\"]"]'
+//@ is "$.index[?(@.name=='example')].attrs" '["#[export_name = \"altered\"]"]'
 #[export_name = "altered"]
 pub extern "C" fn example() {}
diff --git a/tests/rustdoc-json/attrs/export_name_2024.rs b/tests/rustdoc-json/attrs/export_name_2024.rs
index c5bb9dcc8f6..8129c109306 100644
--- a/tests/rustdoc-json/attrs/export_name_2024.rs
+++ b/tests/rustdoc-json/attrs/export_name_2024.rs
@@ -4,6 +4,6 @@
 // The representation of `#[unsafe(export_name = ..)]` in rustdoc in edition 2024
 // is still `#[export_name = ..]` without the `unsafe` attribute wrapper.
 
-//@ is "$.index[*][?(@.name=='example')].attrs" '["#[export_name = \"altered\"]"]'
+//@ is "$.index[?(@.name=='example')].attrs" '["#[export_name = \"altered\"]"]'
 #[unsafe(export_name = "altered")]
 pub extern "C" fn example() {}
diff --git a/tests/rustdoc-json/attrs/must_use.rs b/tests/rustdoc-json/attrs/must_use.rs
index dca73abc76a..64df8e5f509 100644
--- a/tests/rustdoc-json/attrs/must_use.rs
+++ b/tests/rustdoc-json/attrs/must_use.rs
@@ -1,9 +1,9 @@
 #![no_std]
 
-//@ is "$.index[*][?(@.name=='example')].attrs" '["#[must_use]"]'
+//@ is "$.index[?(@.name=='example')].attrs" '["#[must_use]"]'
 #[must_use]
 pub fn example() -> impl Iterator<Item = i64> {}
 
-//@ is "$.index[*][?(@.name=='explicit_message')].attrs" '["#[must_use = \"does nothing if you do not use it\"]"]'
+//@ is "$.index[?(@.name=='explicit_message')].attrs" '["#[must_use = \"does nothing if you do not use it\"]"]'
 #[must_use = "does nothing if you do not use it"]
 pub fn explicit_message() -> impl Iterator<Item = i64> {}
diff --git a/tests/rustdoc-json/attrs/no_mangle_2021.rs b/tests/rustdoc-json/attrs/no_mangle_2021.rs
index 258542086ec..588be7256db 100644
--- a/tests/rustdoc-json/attrs/no_mangle_2021.rs
+++ b/tests/rustdoc-json/attrs/no_mangle_2021.rs
@@ -1,6 +1,6 @@
 //@ edition: 2021
 #![no_std]
 
-//@ is "$.index[*][?(@.name=='example')].attrs" '["#[no_mangle]"]'
+//@ is "$.index[?(@.name=='example')].attrs" '["#[no_mangle]"]'
 #[no_mangle]
 pub extern "C" fn example() {}
diff --git a/tests/rustdoc-json/attrs/no_mangle_2024.rs b/tests/rustdoc-json/attrs/no_mangle_2024.rs
index 4c01082d045..0d500e20e6c 100644
--- a/tests/rustdoc-json/attrs/no_mangle_2024.rs
+++ b/tests/rustdoc-json/attrs/no_mangle_2024.rs
@@ -4,6 +4,6 @@
 // The representation of `#[unsafe(no_mangle)]` in rustdoc in edition 2024
 // is still `#[no_mangle]` without the `unsafe` attribute wrapper.
 
-//@ is "$.index[*][?(@.name=='example')].attrs" '["#[no_mangle]"]'
+//@ is "$.index[?(@.name=='example')].attrs" '["#[no_mangle]"]'
 #[unsafe(no_mangle)]
 pub extern "C" fn example() {}
diff --git a/tests/rustdoc-json/attrs/non_exhaustive.rs b/tests/rustdoc-json/attrs/non_exhaustive.rs
index 5d738fc0560..b95f1a8171f 100644
--- a/tests/rustdoc-json/attrs/non_exhaustive.rs
+++ b/tests/rustdoc-json/attrs/non_exhaustive.rs
@@ -1,18 +1,18 @@
 #![no_std]
 
-//@ is "$.index[*][?(@.name=='MyEnum')].attrs" '["#[non_exhaustive]"]'
+//@ is "$.index[?(@.name=='MyEnum')].attrs" '["#[non_exhaustive]"]'
 #[non_exhaustive]
 pub enum MyEnum {
     First,
 }
 
 pub enum NonExhaustiveVariant {
-    //@ is "$.index[*][?(@.name=='Variant')].attrs" '["#[non_exhaustive]"]'
+    //@ is "$.index[?(@.name=='Variant')].attrs" '["#[non_exhaustive]"]'
     #[non_exhaustive]
     Variant(i64),
 }
 
-//@ is "$.index[*][?(@.name=='MyStruct')].attrs" '["#[non_exhaustive]"]'
+//@ is "$.index[?(@.name=='MyStruct')].attrs" '["#[non_exhaustive]"]'
 #[non_exhaustive]
 pub struct MyStruct {
     pub x: i64,
diff --git a/tests/rustdoc-json/attrs/repr_align.rs b/tests/rustdoc-json/attrs/repr_align.rs
new file mode 100644
index 00000000000..c6debda7f1c
--- /dev/null
+++ b/tests/rustdoc-json/attrs/repr_align.rs
@@ -0,0 +1,8 @@
+#![no_std]
+
+//@ is "$.index[?(@.name=='Aligned')].attrs" '["#[repr(align(4))]"]'
+#[repr(align(4))]
+pub struct Aligned {
+    a: i8,
+    b: i64,
+}
diff --git a/tests/rustdoc-json/attrs/repr_c.rs b/tests/rustdoc-json/attrs/repr_c.rs
new file mode 100644
index 00000000000..e6219413f30
--- /dev/null
+++ b/tests/rustdoc-json/attrs/repr_c.rs
@@ -0,0 +1,18 @@
+#![no_std]
+
+//@ is "$.index[?(@.name=='ReprCStruct')].attrs" '["#[repr(C)]"]'
+#[repr(C)]
+pub struct ReprCStruct(pub i64);
+
+//@ is "$.index[?(@.name=='ReprCEnum')].attrs" '["#[repr(C)]"]'
+#[repr(C)]
+pub enum ReprCEnum {
+    First,
+}
+
+//@ is "$.index[?(@.name=='ReprCUnion')].attrs" '["#[repr(C)]"]'
+#[repr(C)]
+pub union ReprCUnion {
+    pub left: i64,
+    pub right: u64,
+}
diff --git a/tests/rustdoc-json/attrs/repr_combination.rs b/tests/rustdoc-json/attrs/repr_combination.rs
new file mode 100644
index 00000000000..0e8e2ef0d83
--- /dev/null
+++ b/tests/rustdoc-json/attrs/repr_combination.rs
@@ -0,0 +1,79 @@
+#![no_std]
+
+// Combinations of `#[repr(..)]` attributes.
+// Rustdoc JSON emits normalized output, regardless of the original source.
+
+//@ is "$.index[?(@.name=='ReprCI8')].attrs" '["#[repr(C, i8)]"]'
+#[repr(C, i8)]
+pub enum ReprCI8 {
+    First,
+}
+
+//@ is "$.index[?(@.name=='SeparateReprCI16')].attrs" '["#[repr(C, i16)]"]'
+#[repr(C)]
+#[repr(i16)]
+pub enum SeparateReprCI16 {
+    First,
+}
+
+//@ is "$.index[?(@.name=='ReversedReprCUsize')].attrs" '["#[repr(C, usize)]"]'
+#[repr(usize, C)]
+pub enum ReversedReprCUsize {
+    First,
+}
+
+//@ is "$.index[?(@.name=='ReprCPacked')].attrs" '["#[repr(C, packed(1))]"]'
+#[repr(C, packed)]
+pub struct ReprCPacked {
+    a: i8,
+    b: i64,
+}
+
+//@ is "$.index[?(@.name=='SeparateReprCPacked')].attrs" '["#[repr(C, packed(2))]"]'
+#[repr(C)]
+#[repr(packed(2))]
+pub struct SeparateReprCPacked {
+    a: i8,
+    b: i64,
+}
+
+//@ is "$.index[?(@.name=='ReversedReprCPacked')].attrs" '["#[repr(C, packed(2))]"]'
+#[repr(packed(2), C)]
+pub struct ReversedReprCPacked {
+    a: i8,
+    b: i64,
+}
+
+//@ is "$.index[?(@.name=='ReprCAlign')].attrs" '["#[repr(C, align(16))]"]'
+#[repr(C, align(16))]
+pub struct ReprCAlign {
+    a: i8,
+    b: i64,
+}
+
+//@ is "$.index[?(@.name=='SeparateReprCAlign')].attrs" '["#[repr(C, align(2))]"]'
+#[repr(C)]
+#[repr(align(2))]
+pub struct SeparateReprCAlign {
+    a: i8,
+    b: i64,
+}
+
+//@ is "$.index[?(@.name=='ReversedReprCAlign')].attrs" '["#[repr(C, align(2))]"]'
+#[repr(align(2), C)]
+pub struct ReversedReprCAlign {
+    a: i8,
+    b: i64,
+}
+
+//@ is "$.index[?(@.name=='AlignedExplicitRepr')].attrs" '["#[repr(C, align(16), isize)]"]'
+#[repr(C, align(16), isize)]
+pub enum AlignedExplicitRepr {
+    First,
+}
+
+//@ is "$.index[?(@.name=='ReorderedAlignedExplicitRepr')].attrs" '["#[repr(C, align(16), isize)]"]'
+#[repr(isize, C, align(16))]
+pub enum ReorderedAlignedExplicitRepr {
+    First,
+}
diff --git a/tests/rustdoc-json/attrs/repr_int_enum.rs b/tests/rustdoc-json/attrs/repr_int_enum.rs
new file mode 100644
index 00000000000..9b09f341d4f
--- /dev/null
+++ b/tests/rustdoc-json/attrs/repr_int_enum.rs
@@ -0,0 +1,19 @@
+#![no_std]
+
+//@ is "$.index[?(@.name=='I8')].attrs" '["#[repr(i8)]"]'
+#[repr(i8)]
+pub enum I8 {
+    First,
+}
+
+//@ is "$.index[?(@.name=='I32')].attrs" '["#[repr(i32)]"]'
+#[repr(i32)]
+pub enum I32 {
+    First,
+}
+
+//@ is "$.index[?(@.name=='Usize')].attrs" '["#[repr(usize)]"]'
+#[repr(usize)]
+pub enum Usize {
+    First,
+}
diff --git a/tests/rustdoc-json/attrs/repr_packed.rs b/tests/rustdoc-json/attrs/repr_packed.rs
new file mode 100644
index 00000000000..9f3fd86c4b0
--- /dev/null
+++ b/tests/rustdoc-json/attrs/repr_packed.rs
@@ -0,0 +1,18 @@
+#![no_std]
+
+// Note the normalization:
+// `#[repr(packed)]` in source becomes `#[repr(packed(1))]` in rustdoc JSON.
+//
+//@ is "$.index[?(@.name=='Packed')].attrs" '["#[repr(packed(1))]"]'
+#[repr(packed)]
+pub struct Packed {
+    a: i8,
+    b: i64,
+}
+
+//@ is "$.index[?(@.name=='PackedAligned')].attrs" '["#[repr(packed(4))]"]'
+#[repr(packed(4))]
+pub struct PackedAligned {
+    a: i8,
+    b: i64,
+}
diff --git a/tests/rustdoc-json/attrs/repr_transparent.rs b/tests/rustdoc-json/attrs/repr_transparent.rs
new file mode 100644
index 00000000000..1e634ca901d
--- /dev/null
+++ b/tests/rustdoc-json/attrs/repr_transparent.rs
@@ -0,0 +1,37 @@
+#![no_std]
+
+// Rustdoc JSON *only* includes `#[repr(transparent)]`
+// if the transparency is public API:
+// - if a non-1-ZST field exists, it has to be public
+// - otherwise, all fields are 1-ZST and at least one of them is public
+//
+// More info: https://doc.rust-lang.org/nomicon/other-reprs.html#reprtransparent
+
+// Here, the non-1-ZST field is public.
+// We expect `#[repr(transparent)]` in the attributes.
+//
+//@ is "$.index[?(@.name=='Transparent')].attrs" '["#[repr(transparent)]"]'
+#[repr(transparent)]
+pub struct Transparent(pub i64);
+
+// Here the non-1-ZST field isn't public, so the attribute isn't included.
+//
+//@ has "$.index[?(@.name=='TransparentNonPub')]"
+//@ is "$.index[?(@.name=='TransparentNonPub')].attrs" '[]'
+#[repr(transparent)]
+pub struct TransparentNonPub(i64);
+
+// Only 1-ZST fields here, and one of them is public.
+// We expect `#[repr(transparent)]` in the attributes.
+//
+//@ is "$.index[?(@.name=='AllZst')].attrs" '["#[repr(transparent)]"]'
+#[repr(transparent)]
+pub struct AllZst<'a>(pub core::marker::PhantomData<&'a ()>, ());
+
+// Only 1-ZST fields here but none of them are public.
+// The attribute isn't included.
+//
+//@ has "$.index[?(@.name=='AllZstNotPublic')]"
+//@ is "$.index[?(@.name=='AllZstNotPublic')].attrs" '[]'
+#[repr(transparent)]
+pub struct AllZstNotPublic<'a>(core::marker::PhantomData<&'a ()>, ());
diff --git a/tests/rustdoc-json/blanket_impls.rs b/tests/rustdoc-json/blanket_impls.rs
index bf0983e66a1..d500bf5af6b 100644
--- a/tests/rustdoc-json/blanket_impls.rs
+++ b/tests/rustdoc-json/blanket_impls.rs
@@ -2,7 +2,7 @@
 
 #![no_std]
 
-//@ has "$.index[*][?(@.name=='Error')].inner.assoc_type"
-//@ has "$.index[*][?(@.name=='Error')].inner.assoc_type.type.resolved_path"
-//@ has "$.index[*][?(@.name=='Error')].inner.assoc_type.type.resolved_path.path" \"Infallible\"
+//@ has "$.index[?(@.name=='Error')].inner.assoc_type"
+//@ has "$.index[?(@.name=='Error')].inner.assoc_type.type.resolved_path"
+//@ has "$.index[?(@.name=='Error')].inner.assoc_type.type.resolved_path.path" \"Infallible\"
 pub struct ForBlanketTryFromImpl;
diff --git a/tests/rustdoc-json/doc_hidden_failure.rs b/tests/rustdoc-json/doc_hidden_failure.rs
index 249e35b7243..e68df7e9c61 100644
--- a/tests/rustdoc-json/doc_hidden_failure.rs
+++ b/tests/rustdoc-json/doc_hidden_failure.rs
@@ -11,8 +11,8 @@ mod auto {
     }
 }
 
-//@ count "$.index[*][?(@.name=='builders')]" 1
-//@ has "$.index[*][?(@.name == 'ActionRowBuilder')"]
+//@ count "$.index[?(@.name=='builders')]" 1
+//@ has "$.index[?(@.name == 'ActionRowBuilder')"]
 pub use auto::*;
 
 pub mod builders {
diff --git a/tests/rustdoc-json/enums/discriminant/basic.rs b/tests/rustdoc-json/enums/discriminant/basic.rs
index 06a240404fb..c7f164f3408 100644
--- a/tests/rustdoc-json/enums/discriminant/basic.rs
+++ b/tests/rustdoc-json/enums/discriminant/basic.rs
@@ -1,12 +1,12 @@
 #[repr(i8)]
 pub enum Ordering {
-    //@ is "$.index[*][?(@.name=='Less')].inner.variant.discriminant.expr" '"-1"'
-    //@ is "$.index[*][?(@.name=='Less')].inner.variant.discriminant.value" '"-1"'
+    //@ is "$.index[?(@.name=='Less')].inner.variant.discriminant.expr" '"-1"'
+    //@ is "$.index[?(@.name=='Less')].inner.variant.discriminant.value" '"-1"'
     Less = -1,
-    //@ is "$.index[*][?(@.name=='Equal')].inner.variant.discriminant.expr" '"0"'
-    //@ is "$.index[*][?(@.name=='Equal')].inner.variant.discriminant.value" '"0"'
+    //@ is "$.index[?(@.name=='Equal')].inner.variant.discriminant.expr" '"0"'
+    //@ is "$.index[?(@.name=='Equal')].inner.variant.discriminant.value" '"0"'
     Equal = 0,
-    //@ is "$.index[*][?(@.name=='Greater')].inner.variant.discriminant.expr" '"1"'
-    //@ is "$.index[*][?(@.name=='Greater')].inner.variant.discriminant.value" '"1"'
+    //@ is "$.index[?(@.name=='Greater')].inner.variant.discriminant.expr" '"1"'
+    //@ is "$.index[?(@.name=='Greater')].inner.variant.discriminant.value" '"1"'
     Greater = 1,
 }
diff --git a/tests/rustdoc-json/enums/discriminant/expr.rs b/tests/rustdoc-json/enums/discriminant/expr.rs
index bf2bce85108..3743b13fec8 100644
--- a/tests/rustdoc-json/enums/discriminant/expr.rs
+++ b/tests/rustdoc-json/enums/discriminant/expr.rs
@@ -1,30 +1,30 @@
 pub enum Foo {
-    //@ is "$.index[*][?(@.name=='Addition')].inner.variant.discriminant.value" '"0"'
-    //@ is "$.index[*][?(@.name=='Addition')].inner.variant.discriminant.expr" '"{ _ }"'
+    //@ is "$.index[?(@.name=='Addition')].inner.variant.discriminant.value" '"0"'
+    //@ is "$.index[?(@.name=='Addition')].inner.variant.discriminant.expr" '"{ _ }"'
     Addition = 0 + 0,
-    //@ is "$.index[*][?(@.name=='Bin')].inner.variant.discriminant.value" '"1"'
-    //@ is "$.index[*][?(@.name=='Bin')].inner.variant.discriminant.expr" '"0b1"'
+    //@ is "$.index[?(@.name=='Bin')].inner.variant.discriminant.value" '"1"'
+    //@ is "$.index[?(@.name=='Bin')].inner.variant.discriminant.expr" '"0b1"'
     Bin = 0b1,
-    //@ is "$.index[*][?(@.name=='Oct')].inner.variant.discriminant.value" '"2"'
-    //@ is "$.index[*][?(@.name=='Oct')].inner.variant.discriminant.expr" '"0o2"'
+    //@ is "$.index[?(@.name=='Oct')].inner.variant.discriminant.value" '"2"'
+    //@ is "$.index[?(@.name=='Oct')].inner.variant.discriminant.expr" '"0o2"'
     Oct = 0o2,
-    //@ is "$.index[*][?(@.name=='PubConst')].inner.variant.discriminant.value" '"3"'
-    //@ is "$.index[*][?(@.name=='PubConst')].inner.variant.discriminant.expr" '"THREE"'
+    //@ is "$.index[?(@.name=='PubConst')].inner.variant.discriminant.value" '"3"'
+    //@ is "$.index[?(@.name=='PubConst')].inner.variant.discriminant.expr" '"THREE"'
     PubConst = THREE,
-    //@ is "$.index[*][?(@.name=='Hex')].inner.variant.discriminant.value" '"4"'
-    //@ is "$.index[*][?(@.name=='Hex')].inner.variant.discriminant.expr" '"0x4"'
+    //@ is "$.index[?(@.name=='Hex')].inner.variant.discriminant.value" '"4"'
+    //@ is "$.index[?(@.name=='Hex')].inner.variant.discriminant.expr" '"0x4"'
     Hex = 0x4,
-    //@ is "$.index[*][?(@.name=='Cast')].inner.variant.discriminant.value" '"5"'
-    //@ is "$.index[*][?(@.name=='Cast')].inner.variant.discriminant.expr" '"{ _ }"'
+    //@ is "$.index[?(@.name=='Cast')].inner.variant.discriminant.value" '"5"'
+    //@ is "$.index[?(@.name=='Cast')].inner.variant.discriminant.expr" '"{ _ }"'
     Cast = 5 as isize,
-    //@ is "$.index[*][?(@.name=='PubCall')].inner.variant.discriminant.value" '"6"'
-    //@ is "$.index[*][?(@.name=='PubCall')].inner.variant.discriminant.expr" '"{ _ }"'
+    //@ is "$.index[?(@.name=='PubCall')].inner.variant.discriminant.value" '"6"'
+    //@ is "$.index[?(@.name=='PubCall')].inner.variant.discriminant.expr" '"{ _ }"'
     PubCall = six(),
-    //@ is "$.index[*][?(@.name=='PrivCall')].inner.variant.discriminant.value" '"7"'
-    //@ is "$.index[*][?(@.name=='PrivCall')].inner.variant.discriminant.expr" '"{ _ }"'
+    //@ is "$.index[?(@.name=='PrivCall')].inner.variant.discriminant.value" '"7"'
+    //@ is "$.index[?(@.name=='PrivCall')].inner.variant.discriminant.expr" '"{ _ }"'
     PrivCall = seven(),
-    //@ is "$.index[*][?(@.name=='PrivConst')].inner.variant.discriminant.value" '"8"'
-    //@ is "$.index[*][?(@.name=='PrivConst')].inner.variant.discriminant.expr" '"EIGHT"'
+    //@ is "$.index[?(@.name=='PrivConst')].inner.variant.discriminant.value" '"8"'
+    //@ is "$.index[?(@.name=='PrivConst')].inner.variant.discriminant.expr" '"EIGHT"'
     PrivConst = EIGHT,
 }
 
diff --git a/tests/rustdoc-json/enums/discriminant/limits.rs b/tests/rustdoc-json/enums/discriminant/limits.rs
index 7508490d666..c84181334e3 100644
--- a/tests/rustdoc-json/enums/discriminant/limits.rs
+++ b/tests/rustdoc-json/enums/discriminant/limits.rs
@@ -3,40 +3,40 @@
 
 #[repr(u64)]
 pub enum U64 {
-    //@ is "$.index[*][?(@.name=='U64Min')].inner.variant.discriminant.value" '"0"'
-    //@ is "$.index[*][?(@.name=='U64Min')].inner.variant.discriminant.expr" '"u64::MIN"'
+    //@ is "$.index[?(@.name=='U64Min')].inner.variant.discriminant.value" '"0"'
+    //@ is "$.index[?(@.name=='U64Min')].inner.variant.discriminant.expr" '"u64::MIN"'
     U64Min = u64::MIN,
-    //@ is "$.index[*][?(@.name=='U64Max')].inner.variant.discriminant.value" '"18446744073709551615"'
-    //@ is "$.index[*][?(@.name=='U64Max')].inner.variant.discriminant.expr" '"u64::MAX"'
+    //@ is "$.index[?(@.name=='U64Max')].inner.variant.discriminant.value" '"18446744073709551615"'
+    //@ is "$.index[?(@.name=='U64Max')].inner.variant.discriminant.expr" '"u64::MAX"'
     U64Max = u64::MAX,
 }
 
 #[repr(i64)]
 pub enum I64 {
-    //@ is "$.index[*][?(@.name=='I64Min')].inner.variant.discriminant.value" '"-9223372036854775808"'
-    //@ is "$.index[*][?(@.name=='I64Min')].inner.variant.discriminant.expr" '"i64::MIN"'
+    //@ is "$.index[?(@.name=='I64Min')].inner.variant.discriminant.value" '"-9223372036854775808"'
+    //@ is "$.index[?(@.name=='I64Min')].inner.variant.discriminant.expr" '"i64::MIN"'
     I64Min = i64::MIN,
-    //@ is "$.index[*][?(@.name=='I64Max')].inner.variant.discriminant.value" '"9223372036854775807"'
-    //@ is "$.index[*][?(@.name=='I64Max')].inner.variant.discriminant.expr" '"i64::MAX"'
+    //@ is "$.index[?(@.name=='I64Max')].inner.variant.discriminant.value" '"9223372036854775807"'
+    //@ is "$.index[?(@.name=='I64Max')].inner.variant.discriminant.expr" '"i64::MAX"'
     I64Max = i64::MAX,
 }
 
 #[repr(u128)]
 pub enum U128 {
-    //@ is "$.index[*][?(@.name=='U128Min')].inner.variant.discriminant.value" '"0"'
-    //@ is "$.index[*][?(@.name=='U128Min')].inner.variant.discriminant.expr" '"u128::MIN"'
+    //@ is "$.index[?(@.name=='U128Min')].inner.variant.discriminant.value" '"0"'
+    //@ is "$.index[?(@.name=='U128Min')].inner.variant.discriminant.expr" '"u128::MIN"'
     U128Min = u128::MIN,
-    //@ is "$.index[*][?(@.name=='U128Max')].inner.variant.discriminant.value" '"340282366920938463463374607431768211455"'
-    //@ is "$.index[*][?(@.name=='U128Max')].inner.variant.discriminant.expr" '"u128::MAX"'
+    //@ is "$.index[?(@.name=='U128Max')].inner.variant.discriminant.value" '"340282366920938463463374607431768211455"'
+    //@ is "$.index[?(@.name=='U128Max')].inner.variant.discriminant.expr" '"u128::MAX"'
     U128Max = u128::MAX,
 }
 
 #[repr(i128)]
 pub enum I128 {
-    //@ is "$.index[*][?(@.name=='I128Min')].inner.variant.discriminant.value" '"-170141183460469231731687303715884105728"'
-    //@ is "$.index[*][?(@.name=='I128Min')].inner.variant.discriminant.expr" '"i128::MIN"'
+    //@ is "$.index[?(@.name=='I128Min')].inner.variant.discriminant.value" '"-170141183460469231731687303715884105728"'
+    //@ is "$.index[?(@.name=='I128Min')].inner.variant.discriminant.expr" '"i128::MIN"'
     I128Min = i128::MIN,
-    //@ is "$.index[*][?(@.name=='I128Max')].inner.variant.discriminant.value" '"170141183460469231731687303715884105727"'
-    //@ is "$.index[*][?(@.name=='I128Max')].inner.variant.discriminant.expr" '"i128::MAX"'
+    //@ is "$.index[?(@.name=='I128Max')].inner.variant.discriminant.value" '"170141183460469231731687303715884105727"'
+    //@ is "$.index[?(@.name=='I128Max')].inner.variant.discriminant.expr" '"i128::MAX"'
     I128Max = i128::MAX,
 }
diff --git a/tests/rustdoc-json/enums/discriminant/num_underscore_and_suffix.rs b/tests/rustdoc-json/enums/discriminant/num_underscore_and_suffix.rs
index 6f66495bed2..acf58048d3a 100644
--- a/tests/rustdoc-json/enums/discriminant/num_underscore_and_suffix.rs
+++ b/tests/rustdoc-json/enums/discriminant/num_underscore_and_suffix.rs
@@ -1,15 +1,15 @@
 #[repr(u32)]
 pub enum Foo {
-    //@ is "$.index[*][?(@.name=='Basic')].inner.variant.discriminant.value" '"0"'
-    //@ is "$.index[*][?(@.name=='Basic')].inner.variant.discriminant.expr" '"0"'
+    //@ is "$.index[?(@.name=='Basic')].inner.variant.discriminant.value" '"0"'
+    //@ is "$.index[?(@.name=='Basic')].inner.variant.discriminant.expr" '"0"'
     Basic = 0,
-    //@ is "$.index[*][?(@.name=='Suffix')].inner.variant.discriminant.value" '"10"'
-    //@ is "$.index[*][?(@.name=='Suffix')].inner.variant.discriminant.expr" '"10u32"'
+    //@ is "$.index[?(@.name=='Suffix')].inner.variant.discriminant.value" '"10"'
+    //@ is "$.index[?(@.name=='Suffix')].inner.variant.discriminant.expr" '"10u32"'
     Suffix = 10u32,
-    //@ is "$.index[*][?(@.name=='Underscore')].inner.variant.discriminant.value" '"100"'
-    //@ is "$.index[*][?(@.name=='Underscore')].inner.variant.discriminant.expr" '"1_0_0"'
+    //@ is "$.index[?(@.name=='Underscore')].inner.variant.discriminant.value" '"100"'
+    //@ is "$.index[?(@.name=='Underscore')].inner.variant.discriminant.expr" '"1_0_0"'
     Underscore = 1_0_0,
-    //@ is "$.index[*][?(@.name=='SuffixUnderscore')].inner.variant.discriminant.value" '"1000"'
-    //@ is "$.index[*][?(@.name=='SuffixUnderscore')].inner.variant.discriminant.expr" '"1_0_0_0u32"'
+    //@ is "$.index[?(@.name=='SuffixUnderscore')].inner.variant.discriminant.value" '"1000"'
+    //@ is "$.index[?(@.name=='SuffixUnderscore')].inner.variant.discriminant.expr" '"1_0_0_0u32"'
     SuffixUnderscore = 1_0_0_0u32,
 }
diff --git a/tests/rustdoc-json/enums/discriminant/only_some_have_discriminant.rs b/tests/rustdoc-json/enums/discriminant/only_some_have_discriminant.rs
index 8e7985f07f4..d8b92cfabb3 100644
--- a/tests/rustdoc-json/enums/discriminant/only_some_have_discriminant.rs
+++ b/tests/rustdoc-json/enums/discriminant/only_some_have_discriminant.rs
@@ -1,10 +1,10 @@
 pub enum Foo {
-    //@ is "$.index[*][?(@.name=='Has')].inner.variant.discriminant" '{"expr":"0", "value":"0"}'
+    //@ is "$.index[?(@.name=='Has')].inner.variant.discriminant" '{"expr":"0", "value":"0"}'
     Has = 0,
-    //@ is "$.index[*][?(@.name=='Doesnt')].inner.variant.discriminant" null
+    //@ is "$.index[?(@.name=='Doesnt')].inner.variant.discriminant" null
     Doesnt,
-    //@ is "$.index[*][?(@.name=='AlsoDoesnt')].inner.variant.discriminant" null
+    //@ is "$.index[?(@.name=='AlsoDoesnt')].inner.variant.discriminant" null
     AlsoDoesnt,
-    //@ is "$.index[*][?(@.name=='AlsoHas')].inner.variant.discriminant" '{"expr":"44", "value":"44"}'
+    //@ is "$.index[?(@.name=='AlsoHas')].inner.variant.discriminant" '{"expr":"44", "value":"44"}'
     AlsoHas = 44,
 }
diff --git a/tests/rustdoc-json/enums/discriminant/struct.rs b/tests/rustdoc-json/enums/discriminant/struct.rs
index 82437f5ef03..ea669e6a0b3 100644
--- a/tests/rustdoc-json/enums/discriminant/struct.rs
+++ b/tests/rustdoc-json/enums/discriminant/struct.rs
@@ -1,13 +1,13 @@
 #[repr(i32)]
-//@ is "$.index[*][?(@.name=='Foo')].attrs" '["#[attr=\"Repr([ReprInt(SignedInt(I32))])\")]\n"]'
+//@ is "$.index[?(@.name=='Foo')].attrs" '["#[repr(i32)]"]'
 pub enum Foo {
-    //@ is    "$.index[*][?(@.name=='Struct')].inner.variant.discriminant" null
-    //@ count "$.index[*][?(@.name=='Struct')].inner.variant.kind.struct.fields[*]" 0
+    //@ is    "$.index[?(@.name=='Struct')].inner.variant.discriminant" null
+    //@ count "$.index[?(@.name=='Struct')].inner.variant.kind.struct.fields[*]" 0
     Struct {},
-    //@ is    "$.index[*][?(@.name=='StructWithDiscr')].inner.variant.discriminant" '{"expr": "42", "value": "42"}'
-    //@ count "$.index[*][?(@.name=='StructWithDiscr')].inner.variant.kind.struct.fields[*]" 1
+    //@ is    "$.index[?(@.name=='StructWithDiscr')].inner.variant.discriminant" '{"expr": "42", "value": "42"}'
+    //@ count "$.index[?(@.name=='StructWithDiscr')].inner.variant.kind.struct.fields[*]" 1
     StructWithDiscr { x: i32 } = 42,
-    //@ is    "$.index[*][?(@.name=='StructWithHexDiscr')].inner.variant.discriminant"  '{"expr": "0x42", "value": "66"}'
-    //@ count "$.index[*][?(@.name=='StructWithHexDiscr')].inner.variant.kind.struct.fields[*]" 2
+    //@ is    "$.index[?(@.name=='StructWithHexDiscr')].inner.variant.discriminant"  '{"expr": "0x42", "value": "66"}'
+    //@ count "$.index[?(@.name=='StructWithHexDiscr')].inner.variant.kind.struct.fields[*]" 2
     StructWithHexDiscr { x: i32, y: bool } = 0x42,
 }
diff --git a/tests/rustdoc-json/enums/discriminant/tuple.rs b/tests/rustdoc-json/enums/discriminant/tuple.rs
index 25bba07e8f7..1b8e791eb23 100644
--- a/tests/rustdoc-json/enums/discriminant/tuple.rs
+++ b/tests/rustdoc-json/enums/discriminant/tuple.rs
@@ -1,13 +1,13 @@
 #[repr(u32)]
-//@ is "$.index[*][?(@.name=='Foo')].attrs" '["#[attr=\"Repr([ReprInt(UnsignedInt(U32))])\")]\n"]'
+//@ is "$.index[?(@.name=='Foo')].attrs" '["#[repr(u32)]"]'
 pub enum Foo {
-    //@ is    "$.index[*][?(@.name=='Tuple')].inner.variant.discriminant" null
-    //@ count "$.index[*][?(@.name=='Tuple')].inner.variant.kind.tuple[*]" 0
+    //@ is    "$.index[?(@.name=='Tuple')].inner.variant.discriminant" null
+    //@ count "$.index[?(@.name=='Tuple')].inner.variant.kind.tuple[*]" 0
     Tuple(),
-    //@ is    "$.index[*][?(@.name=='TupleWithDiscr')].inner.variant.discriminant" '{"expr": "1", "value": "1"}'
-    //@ count "$.index[*][?(@.name=='TupleWithDiscr')].inner.variant.kind.tuple[*]" 1
+    //@ is    "$.index[?(@.name=='TupleWithDiscr')].inner.variant.discriminant" '{"expr": "1", "value": "1"}'
+    //@ count "$.index[?(@.name=='TupleWithDiscr')].inner.variant.kind.tuple[*]" 1
     TupleWithDiscr(i32) = 1,
-    //@ is    "$.index[*][?(@.name=='TupleWithBinDiscr')].inner.variant.discriminant" '{"expr": "0b10", "value": "2"}'
-    //@ count "$.index[*][?(@.name=='TupleWithBinDiscr')].inner.variant.kind.tuple[*]" 2
+    //@ is    "$.index[?(@.name=='TupleWithBinDiscr')].inner.variant.discriminant" '{"expr": "0b10", "value": "2"}'
+    //@ count "$.index[?(@.name=='TupleWithBinDiscr')].inner.variant.kind.tuple[*]" 2
     TupleWithBinDiscr(i32, i32) = 0b10,
 }
diff --git a/tests/rustdoc-json/enums/doc_link_to_foreign_variant.rs b/tests/rustdoc-json/enums/doc_link_to_foreign_variant.rs
index 6aec6960b5f..6ecd98fadf5 100644
--- a/tests/rustdoc-json/enums/doc_link_to_foreign_variant.rs
+++ b/tests/rustdoc-json/enums/doc_link_to_foreign_variant.rs
@@ -5,7 +5,7 @@
 extern crate color;
 use color::Color::Red;
 
-//@ set red = "$.index[*][?(@.inner.module.is_crate)].links.Red"
+//@ set red = "$.index[?(@.inner.module.is_crate)].links.Red"
 
-//@ !has "$.index[*][?(@.name == 'Red')]"
-//@ !has "$.index[*][?(@.name == 'Color')]"
+//@ !has "$.index[?(@.name == 'Red')]"
+//@ !has "$.index[?(@.name == 'Color')]"
diff --git a/tests/rustdoc-json/enums/field_hidden.rs b/tests/rustdoc-json/enums/field_hidden.rs
index b353678ac92..07ee0e62ea9 100644
--- a/tests/rustdoc-json/enums/field_hidden.rs
+++ b/tests/rustdoc-json/enums/field_hidden.rs
@@ -1,9 +1,9 @@
 // Regression test for <https://github.com/rust-lang/rust/issues/100529>.
 
-//@ has "$.index[*][?(@.name=='ParseError')]"
-//@ has "$.index[*][?(@.name=='UnexpectedEndTag')]"
-//@ is "$.index[*][?(@.name=='UnexpectedEndTag')].inner.variant.kind.tuple" [null]
-//@ is "$.index[*][?(@.name=='UnexpectedEndTag')].inner.variant.discriminant" null
+//@ has "$.index[?(@.name=='ParseError')]"
+//@ has "$.index[?(@.name=='UnexpectedEndTag')]"
+//@ is "$.index[?(@.name=='UnexpectedEndTag')].inner.variant.kind.tuple" [null]
+//@ is "$.index[?(@.name=='UnexpectedEndTag')].inner.variant.discriminant" null
 
 pub enum ParseError {
     UnexpectedEndTag(#[doc(hidden)] u32),
diff --git a/tests/rustdoc-json/enums/field_order.rs b/tests/rustdoc-json/enums/field_order.rs
index a78be200b41..e8560687954 100644
--- a/tests/rustdoc-json/enums/field_order.rs
+++ b/tests/rustdoc-json/enums/field_order.rs
@@ -17,24 +17,24 @@ pub enum Whatever {
     },
 }
 
-//@ set 0 = '$.index[*][?(@.name == "ews_0")].id'
-//@ set 1 = '$.index[*][?(@.name == "dik_1")].id'
-//@ set 2 = '$.index[*][?(@.name == "hsk_2")].id'
-//@ set 3 = '$.index[*][?(@.name == "djt_3")].id'
-//@ set 4 = '$.index[*][?(@.name == "jnr_4")].id'
-//@ set 5 = '$.index[*][?(@.name == "dfs_5")].id'
-//@ set 6 = '$.index[*][?(@.name == "bja_6")].id'
-//@ set 7 = '$.index[*][?(@.name == "lyc_7")].id'
-//@ set 8 = '$.index[*][?(@.name == "yqd_8")].id'
-//@ set 9 = '$.index[*][?(@.name == "vll_9")].id'
+//@ set 0 = '$.index[?(@.name == "ews_0")].id'
+//@ set 1 = '$.index[?(@.name == "dik_1")].id'
+//@ set 2 = '$.index[?(@.name == "hsk_2")].id'
+//@ set 3 = '$.index[?(@.name == "djt_3")].id'
+//@ set 4 = '$.index[?(@.name == "jnr_4")].id'
+//@ set 5 = '$.index[?(@.name == "dfs_5")].id'
+//@ set 6 = '$.index[?(@.name == "bja_6")].id'
+//@ set 7 = '$.index[?(@.name == "lyc_7")].id'
+//@ set 8 = '$.index[?(@.name == "yqd_8")].id'
+//@ set 9 = '$.index[?(@.name == "vll_9")].id'
 
-//@ is '$.index[*][?(@.name == "Foo")].inner.variant.kind.struct.fields[0]' $0
-//@ is '$.index[*][?(@.name == "Foo")].inner.variant.kind.struct.fields[1]' $1
-//@ is '$.index[*][?(@.name == "Foo")].inner.variant.kind.struct.fields[2]' $2
-//@ is '$.index[*][?(@.name == "Foo")].inner.variant.kind.struct.fields[3]' $3
-//@ is '$.index[*][?(@.name == "Foo")].inner.variant.kind.struct.fields[4]' $4
-//@ is '$.index[*][?(@.name == "Foo")].inner.variant.kind.struct.fields[5]' $5
-//@ is '$.index[*][?(@.name == "Foo")].inner.variant.kind.struct.fields[6]' $6
-//@ is '$.index[*][?(@.name == "Foo")].inner.variant.kind.struct.fields[7]' $7
-//@ is '$.index[*][?(@.name == "Foo")].inner.variant.kind.struct.fields[8]' $8
-//@ is '$.index[*][?(@.name == "Foo")].inner.variant.kind.struct.fields[9]' $9
+//@ is '$.index[?(@.name == "Foo")].inner.variant.kind.struct.fields[0]' $0
+//@ is '$.index[?(@.name == "Foo")].inner.variant.kind.struct.fields[1]' $1
+//@ is '$.index[?(@.name == "Foo")].inner.variant.kind.struct.fields[2]' $2
+//@ is '$.index[?(@.name == "Foo")].inner.variant.kind.struct.fields[3]' $3
+//@ is '$.index[?(@.name == "Foo")].inner.variant.kind.struct.fields[4]' $4
+//@ is '$.index[?(@.name == "Foo")].inner.variant.kind.struct.fields[5]' $5
+//@ is '$.index[?(@.name == "Foo")].inner.variant.kind.struct.fields[6]' $6
+//@ is '$.index[?(@.name == "Foo")].inner.variant.kind.struct.fields[7]' $7
+//@ is '$.index[?(@.name == "Foo")].inner.variant.kind.struct.fields[8]' $8
+//@ is '$.index[?(@.name == "Foo")].inner.variant.kind.struct.fields[9]' $9
diff --git a/tests/rustdoc-json/enums/kind.rs b/tests/rustdoc-json/enums/kind.rs
index 517a53828b7..3c011858630 100644
--- a/tests/rustdoc-json/enums/kind.rs
+++ b/tests/rustdoc-json/enums/kind.rs
@@ -1,27 +1,27 @@
 pub enum Foo {
-    //@ set Unit = "$.index[*][?(@.name=='Unit')].id"
-    //@ is "$.index[*][?(@.name=='Unit')].inner.variant.kind" '"plain"'
+    //@ set Unit = "$.index[?(@.name=='Unit')].id"
+    //@ is "$.index[?(@.name=='Unit')].inner.variant.kind" '"plain"'
     Unit,
-    //@ set Named = "$.index[*][?(@.name=='Named')].id"
-    //@ is "$.index[*][?(@.name=='Named')].inner.variant.kind.struct" '{"fields": [], "has_stripped_fields": false}'
+    //@ set Named = "$.index[?(@.name=='Named')].id"
+    //@ is "$.index[?(@.name=='Named')].inner.variant.kind.struct" '{"fields": [], "has_stripped_fields": false}'
     Named {},
-    //@ set Tuple = "$.index[*][?(@.name=='Tuple')].id"
-    //@ is "$.index[*][?(@.name=='Tuple')].inner.variant.kind.tuple" []
+    //@ set Tuple = "$.index[?(@.name=='Tuple')].id"
+    //@ is "$.index[?(@.name=='Tuple')].inner.variant.kind.tuple" []
     Tuple(),
-    //@ set NamedField = "$.index[*][?(@.name=='NamedField')].id"
-    //@ set x = "$.index[*][?(@.name=='x' && @.inner.struct_field)].id"
-    //@ is "$.index[*][?(@.name=='NamedField')].inner.variant.kind.struct.fields[*]" $x
-    //@ is "$.index[*][?(@.name=='NamedField')].inner.variant.kind.struct.has_stripped_fields" false
+    //@ set NamedField = "$.index[?(@.name=='NamedField')].id"
+    //@ set x = "$.index[?(@.name=='x' && @.inner.struct_field)].id"
+    //@ is "$.index[?(@.name=='NamedField')].inner.variant.kind.struct.fields[*]" $x
+    //@ is "$.index[?(@.name=='NamedField')].inner.variant.kind.struct.has_stripped_fields" false
     NamedField { x: i32 },
-    //@ set TupleField = "$.index[*][?(@.name=='TupleField')].id"
-    //@ set tup_field = "$.index[*][?(@.name=='0' && @.inner.struct_field)].id"
-    //@ is "$.index[*][?(@.name=='TupleField')].inner.variant.kind.tuple[*]" $tup_field
+    //@ set TupleField = "$.index[?(@.name=='TupleField')].id"
+    //@ set tup_field = "$.index[?(@.name=='0' && @.inner.struct_field)].id"
+    //@ is "$.index[?(@.name=='TupleField')].inner.variant.kind.tuple[*]" $tup_field
     TupleField(i32),
 }
 
-//@ is    "$.index[*][?(@.name=='Foo')].inner.enum.variants[0]" $Unit
-//@ is    "$.index[*][?(@.name=='Foo')].inner.enum.variants[1]" $Named
-//@ is    "$.index[*][?(@.name=='Foo')].inner.enum.variants[2]" $Tuple
-//@ is    "$.index[*][?(@.name=='Foo')].inner.enum.variants[3]" $NamedField
-//@ is    "$.index[*][?(@.name=='Foo')].inner.enum.variants[4]" $TupleField
-//@ count "$.index[*][?(@.name=='Foo')].inner.enum.variants[*]" 5
+//@ is    "$.index[?(@.name=='Foo')].inner.enum.variants[0]" $Unit
+//@ is    "$.index[?(@.name=='Foo')].inner.enum.variants[1]" $Named
+//@ is    "$.index[?(@.name=='Foo')].inner.enum.variants[2]" $Tuple
+//@ is    "$.index[?(@.name=='Foo')].inner.enum.variants[3]" $NamedField
+//@ is    "$.index[?(@.name=='Foo')].inner.enum.variants[4]" $TupleField
+//@ count "$.index[?(@.name=='Foo')].inner.enum.variants[*]" 5
diff --git a/tests/rustdoc-json/enums/struct_field_hidden.rs b/tests/rustdoc-json/enums/struct_field_hidden.rs
index 2184f58b1da..cd9d2ce0b8a 100644
--- a/tests/rustdoc-json/enums/struct_field_hidden.rs
+++ b/tests/rustdoc-json/enums/struct_field_hidden.rs
@@ -2,15 +2,15 @@ pub enum Foo {
     Variant {
         #[doc(hidden)]
         a: i32,
-        //@ set b = "$.index[*][?(@.name=='b')].id"
+        //@ set b = "$.index[?(@.name=='b')].id"
         b: i32,
         #[doc(hidden)]
         x: i32,
-        //@ set y = "$.index[*][?(@.name=='y')].id"
+        //@ set y = "$.index[?(@.name=='y')].id"
         y: i32,
     },
-    //@ is "$.index[*][?(@.name=='Variant')].inner.variant.kind.struct.has_stripped_fields" true
-    //@ is "$.index[*][?(@.name=='Variant')].inner.variant.kind.struct.fields[0]" $b
-    //@ is "$.index[*][?(@.name=='Variant')].inner.variant.kind.struct.fields[1]" $y
-    //@ count "$.index[*][?(@.name=='Variant')].inner.variant.kind.struct.fields[*]" 2
+    //@ is "$.index[?(@.name=='Variant')].inner.variant.kind.struct.has_stripped_fields" true
+    //@ is "$.index[?(@.name=='Variant')].inner.variant.kind.struct.fields[0]" $b
+    //@ is "$.index[?(@.name=='Variant')].inner.variant.kind.struct.fields[1]" $y
+    //@ count "$.index[?(@.name=='Variant')].inner.variant.kind.struct.fields[*]" 2
 }
diff --git a/tests/rustdoc-json/enums/tuple_fields_hidden.rs b/tests/rustdoc-json/enums/tuple_fields_hidden.rs
index 3ac7a3ce0fc..aa25625b94c 100644
--- a/tests/rustdoc-json/enums/tuple_fields_hidden.rs
+++ b/tests/rustdoc-json/enums/tuple_fields_hidden.rs
@@ -1,80 +1,80 @@
-//@ set 1.1.0 = "$.index[*][?(@.docs=='1.1.0')].id"
-//@ set 2.1.0 = "$.index[*][?(@.docs=='2.1.0')].id"
-//@ set 2.1.1 = "$.index[*][?(@.docs=='2.1.1')].id"
-//@ set 2.2.1 = "$.index[*][?(@.docs=='2.2.1')].id"
-//@ set 2.3.0 = "$.index[*][?(@.docs=='2.3.0')].id"
-//@ set 3.1.1 = "$.index[*][?(@.docs=='3.1.1')].id"
-//@ set 3.1.2 = "$.index[*][?(@.docs=='3.1.2')].id"
-//@ set 3.2.0 = "$.index[*][?(@.docs=='3.2.0')].id"
-//@ set 3.2.2 = "$.index[*][?(@.docs=='3.2.2')].id"
-//@ set 3.3.0 = "$.index[*][?(@.docs=='3.3.0')].id"
-//@ set 3.3.1 = "$.index[*][?(@.docs=='3.3.1')].id"
+//@ set 1.1.0 = "$.index[?(@.docs=='1.1.0')].id"
+//@ set 2.1.0 = "$.index[?(@.docs=='2.1.0')].id"
+//@ set 2.1.1 = "$.index[?(@.docs=='2.1.1')].id"
+//@ set 2.2.1 = "$.index[?(@.docs=='2.2.1')].id"
+//@ set 2.3.0 = "$.index[?(@.docs=='2.3.0')].id"
+//@ set 3.1.1 = "$.index[?(@.docs=='3.1.1')].id"
+//@ set 3.1.2 = "$.index[?(@.docs=='3.1.2')].id"
+//@ set 3.2.0 = "$.index[?(@.docs=='3.2.0')].id"
+//@ set 3.2.2 = "$.index[?(@.docs=='3.2.2')].id"
+//@ set 3.3.0 = "$.index[?(@.docs=='3.3.0')].id"
+//@ set 3.3.1 = "$.index[?(@.docs=='3.3.1')].id"
 
 pub enum EnumWithStrippedTupleVariants {
-    //@ count "$.index[*][?(@.name=='None')].inner.variant.kind.tuple[*]" 0
+    //@ count "$.index[?(@.name=='None')].inner.variant.kind.tuple[*]" 0
     None(),
 
-    //@ count "$.index[*][?(@.name=='One')].inner.variant.kind.tuple[*]" 1
-    //@ is    "$.index[*][?(@.name=='One')].inner.variant.kind.tuple[0]" $1.1.0
+    //@ count "$.index[?(@.name=='One')].inner.variant.kind.tuple[*]" 1
+    //@ is    "$.index[?(@.name=='One')].inner.variant.kind.tuple[0]" $1.1.0
     One(/** 1.1.0*/ bool),
-    //@ count "$.index[*][?(@.name=='OneHidden')].inner.variant.kind.tuple[*]" 1
-    //@ is    "$.index[*][?(@.name=='OneHidden')].inner.variant.kind.tuple[0]" null
+    //@ count "$.index[?(@.name=='OneHidden')].inner.variant.kind.tuple[*]" 1
+    //@ is    "$.index[?(@.name=='OneHidden')].inner.variant.kind.tuple[0]" null
     OneHidden(#[doc(hidden)] bool),
 
-    //@ count "$.index[*][?(@.name=='Two')].inner.variant.kind.tuple[*]" 2
-    //@ is    "$.index[*][?(@.name=='Two')].inner.variant.kind.tuple[0]" $2.1.0
-    //@ is    "$.index[*][?(@.name=='Two')].inner.variant.kind.tuple[1]" $2.1.1
+    //@ count "$.index[?(@.name=='Two')].inner.variant.kind.tuple[*]" 2
+    //@ is    "$.index[?(@.name=='Two')].inner.variant.kind.tuple[0]" $2.1.0
+    //@ is    "$.index[?(@.name=='Two')].inner.variant.kind.tuple[1]" $2.1.1
     Two(/** 2.1.0*/ bool, /** 2.1.1*/ bool),
-    //@ count "$.index[*][?(@.name=='TwoLeftHidden')].inner.variant.kind.tuple[*]" 2
-    //@ is    "$.index[*][?(@.name=='TwoLeftHidden')].inner.variant.kind.tuple[0]" null
-    //@ is    "$.index[*][?(@.name=='TwoLeftHidden')].inner.variant.kind.tuple[1]" $2.2.1
+    //@ count "$.index[?(@.name=='TwoLeftHidden')].inner.variant.kind.tuple[*]" 2
+    //@ is    "$.index[?(@.name=='TwoLeftHidden')].inner.variant.kind.tuple[0]" null
+    //@ is    "$.index[?(@.name=='TwoLeftHidden')].inner.variant.kind.tuple[1]" $2.2.1
     TwoLeftHidden(#[doc(hidden)] bool, /** 2.2.1*/ bool),
-    //@ count "$.index[*][?(@.name=='TwoRightHidden')].inner.variant.kind.tuple[*]" 2
-    //@ is    "$.index[*][?(@.name=='TwoRightHidden')].inner.variant.kind.tuple[0]" $2.3.0
-    //@ is    "$.index[*][?(@.name=='TwoRightHidden')].inner.variant.kind.tuple[1]" null
+    //@ count "$.index[?(@.name=='TwoRightHidden')].inner.variant.kind.tuple[*]" 2
+    //@ is    "$.index[?(@.name=='TwoRightHidden')].inner.variant.kind.tuple[0]" $2.3.0
+    //@ is    "$.index[?(@.name=='TwoRightHidden')].inner.variant.kind.tuple[1]" null
     TwoRightHidden(/** 2.3.0*/ bool, #[doc(hidden)] bool),
-    //@ count "$.index[*][?(@.name=='TwoBothHidden')].inner.variant.kind.tuple[*]" 2
-    //@ is    "$.index[*][?(@.name=='TwoBothHidden')].inner.variant.kind.tuple[0]" null
-    //@ is    "$.index[*][?(@.name=='TwoBothHidden')].inner.variant.kind.tuple[1]" null
+    //@ count "$.index[?(@.name=='TwoBothHidden')].inner.variant.kind.tuple[*]" 2
+    //@ is    "$.index[?(@.name=='TwoBothHidden')].inner.variant.kind.tuple[0]" null
+    //@ is    "$.index[?(@.name=='TwoBothHidden')].inner.variant.kind.tuple[1]" null
     TwoBothHidden(#[doc(hidden)] bool, #[doc(hidden)] bool),
 
-    //@ count "$.index[*][?(@.name=='Three1')].inner.variant.kind.tuple[*]" 3
-    //@ is    "$.index[*][?(@.name=='Three1')].inner.variant.kind.tuple[0]" null
-    //@ is    "$.index[*][?(@.name=='Three1')].inner.variant.kind.tuple[1]" $3.1.1
-    //@ is    "$.index[*][?(@.name=='Three1')].inner.variant.kind.tuple[2]" $3.1.2
+    //@ count "$.index[?(@.name=='Three1')].inner.variant.kind.tuple[*]" 3
+    //@ is    "$.index[?(@.name=='Three1')].inner.variant.kind.tuple[0]" null
+    //@ is    "$.index[?(@.name=='Three1')].inner.variant.kind.tuple[1]" $3.1.1
+    //@ is    "$.index[?(@.name=='Three1')].inner.variant.kind.tuple[2]" $3.1.2
     Three1(#[doc(hidden)] bool, /** 3.1.1*/ bool, /** 3.1.2*/ bool),
-    //@ count "$.index[*][?(@.name=='Three2')].inner.variant.kind.tuple[*]" 3
-    //@ is    "$.index[*][?(@.name=='Three2')].inner.variant.kind.tuple[0]" $3.2.0
-    //@ is    "$.index[*][?(@.name=='Three2')].inner.variant.kind.tuple[1]" null
-    //@ is    "$.index[*][?(@.name=='Three2')].inner.variant.kind.tuple[2]" $3.2.2
+    //@ count "$.index[?(@.name=='Three2')].inner.variant.kind.tuple[*]" 3
+    //@ is    "$.index[?(@.name=='Three2')].inner.variant.kind.tuple[0]" $3.2.0
+    //@ is    "$.index[?(@.name=='Three2')].inner.variant.kind.tuple[1]" null
+    //@ is    "$.index[?(@.name=='Three2')].inner.variant.kind.tuple[2]" $3.2.2
     Three2(/** 3.2.0*/ bool, #[doc(hidden)] bool, /** 3.2.2*/ bool),
-    //@ count "$.index[*][?(@.name=='Three3')].inner.variant.kind.tuple[*]" 3
-    //@ is    "$.index[*][?(@.name=='Three3')].inner.variant.kind.tuple[0]" $3.3.0
-    //@ is    "$.index[*][?(@.name=='Three3')].inner.variant.kind.tuple[1]" $3.3.1
-    //@ is    "$.index[*][?(@.name=='Three3')].inner.variant.kind.tuple[2]" null
+    //@ count "$.index[?(@.name=='Three3')].inner.variant.kind.tuple[*]" 3
+    //@ is    "$.index[?(@.name=='Three3')].inner.variant.kind.tuple[0]" $3.3.0
+    //@ is    "$.index[?(@.name=='Three3')].inner.variant.kind.tuple[1]" $3.3.1
+    //@ is    "$.index[?(@.name=='Three3')].inner.variant.kind.tuple[2]" null
     Three3(/** 3.3.0*/ bool, /** 3.3.1*/ bool, #[doc(hidden)] bool),
 }
 
-//@ is "$.index[*][?(@.docs=='1.1.0')].name" '"0"'
-//@ is "$.index[*][?(@.docs=='2.1.0')].name" '"0"'
-//@ is "$.index[*][?(@.docs=='2.1.1')].name" '"1"'
-//@ is "$.index[*][?(@.docs=='2.2.1')].name" '"1"'
-//@ is "$.index[*][?(@.docs=='2.3.0')].name" '"0"'
-//@ is "$.index[*][?(@.docs=='3.1.1')].name" '"1"'
-//@ is "$.index[*][?(@.docs=='3.1.2')].name" '"2"'
-//@ is "$.index[*][?(@.docs=='3.2.0')].name" '"0"'
-//@ is "$.index[*][?(@.docs=='3.2.2')].name" '"2"'
-//@ is "$.index[*][?(@.docs=='3.3.0')].name" '"0"'
-//@ is "$.index[*][?(@.docs=='3.3.1')].name" '"1"'
+//@ is "$.index[?(@.docs=='1.1.0')].name" '"0"'
+//@ is "$.index[?(@.docs=='2.1.0')].name" '"0"'
+//@ is "$.index[?(@.docs=='2.1.1')].name" '"1"'
+//@ is "$.index[?(@.docs=='2.2.1')].name" '"1"'
+//@ is "$.index[?(@.docs=='2.3.0')].name" '"0"'
+//@ is "$.index[?(@.docs=='3.1.1')].name" '"1"'
+//@ is "$.index[?(@.docs=='3.1.2')].name" '"2"'
+//@ is "$.index[?(@.docs=='3.2.0')].name" '"0"'
+//@ is "$.index[?(@.docs=='3.2.2')].name" '"2"'
+//@ is "$.index[?(@.docs=='3.3.0')].name" '"0"'
+//@ is "$.index[?(@.docs=='3.3.1')].name" '"1"'
 
-//@ is "$.index[*][?(@.docs=='1.1.0')].inner.struct_field" '{"primitive": "bool"}'
-//@ is "$.index[*][?(@.docs=='2.1.0')].inner.struct_field" '{"primitive": "bool"}'
-//@ is "$.index[*][?(@.docs=='2.1.1')].inner.struct_field" '{"primitive": "bool"}'
-//@ is "$.index[*][?(@.docs=='2.2.1')].inner.struct_field" '{"primitive": "bool"}'
-//@ is "$.index[*][?(@.docs=='2.3.0')].inner.struct_field" '{"primitive": "bool"}'
-//@ is "$.index[*][?(@.docs=='3.1.1')].inner.struct_field" '{"primitive": "bool"}'
-//@ is "$.index[*][?(@.docs=='3.1.2')].inner.struct_field" '{"primitive": "bool"}'
-//@ is "$.index[*][?(@.docs=='3.2.0')].inner.struct_field" '{"primitive": "bool"}'
-//@ is "$.index[*][?(@.docs=='3.2.2')].inner.struct_field" '{"primitive": "bool"}'
-//@ is "$.index[*][?(@.docs=='3.3.0')].inner.struct_field" '{"primitive": "bool"}'
-//@ is "$.index[*][?(@.docs=='3.3.1')].inner.struct_field" '{"primitive": "bool"}'
+//@ is "$.index[?(@.docs=='1.1.0')].inner.struct_field" '{"primitive": "bool"}'
+//@ is "$.index[?(@.docs=='2.1.0')].inner.struct_field" '{"primitive": "bool"}'
+//@ is "$.index[?(@.docs=='2.1.1')].inner.struct_field" '{"primitive": "bool"}'
+//@ is "$.index[?(@.docs=='2.2.1')].inner.struct_field" '{"primitive": "bool"}'
+//@ is "$.index[?(@.docs=='2.3.0')].inner.struct_field" '{"primitive": "bool"}'
+//@ is "$.index[?(@.docs=='3.1.1')].inner.struct_field" '{"primitive": "bool"}'
+//@ is "$.index[?(@.docs=='3.1.2')].inner.struct_field" '{"primitive": "bool"}'
+//@ is "$.index[?(@.docs=='3.2.0')].inner.struct_field" '{"primitive": "bool"}'
+//@ is "$.index[?(@.docs=='3.2.2')].inner.struct_field" '{"primitive": "bool"}'
+//@ is "$.index[?(@.docs=='3.3.0')].inner.struct_field" '{"primitive": "bool"}'
+//@ is "$.index[?(@.docs=='3.3.1')].inner.struct_field" '{"primitive": "bool"}'
diff --git a/tests/rustdoc-json/enums/use_glob.rs b/tests/rustdoc-json/enums/use_glob.rs
index 2631b43da8e..18f21ff0903 100644
--- a/tests/rustdoc-json/enums/use_glob.rs
+++ b/tests/rustdoc-json/enums/use_glob.rs
@@ -1,15 +1,15 @@
 // Regression test for <https://github.com/rust-lang/rust/issues/104942>
 
-//@ set Color = "$.index[*][?(@.name == 'Color')].id"
+//@ set Color = "$.index[?(@.name == 'Color')].id"
 pub enum Color {
     Red,
     Green,
     Blue,
 }
 
-//@ set use_Color = "$.index[*][?(@.inner.use)].id"
-//@ is "$.index[*][?(@.inner.use)].inner.use.id" $Color
-//@ is "$.index[*][?(@.inner.use)].inner.use.is_glob" true
+//@ set use_Color = "$.index[?(@.inner.use)].id"
+//@ is "$.index[?(@.inner.use)].inner.use.id" $Color
+//@ is "$.index[?(@.inner.use)].inner.use.is_glob" true
 pub use Color::*;
 
-//@ ismany "$.index[*][?(@.name == 'use_glob')].inner.module.items[*]" $Color $use_Color
+//@ ismany "$.index[?(@.name == 'use_glob')].inner.module.items[*]" $Color $use_Color
diff --git a/tests/rustdoc-json/enums/use_variant.rs b/tests/rustdoc-json/enums/use_variant.rs
index 6d3322e0ba9..26cca0743d9 100644
--- a/tests/rustdoc-json/enums/use_variant.rs
+++ b/tests/rustdoc-json/enums/use_variant.rs
@@ -1,12 +1,12 @@
-//@ set AlwaysNone = "$.index[*][?(@.name == 'AlwaysNone')].id"
+//@ set AlwaysNone = "$.index[?(@.name == 'AlwaysNone')].id"
 pub enum AlwaysNone {
-    //@ set None = "$.index[*][?(@.name == 'None')].id"
+    //@ set None = "$.index[?(@.name == 'None')].id"
     None,
 }
-//@ is "$.index[*][?(@.name == 'AlwaysNone')].inner.enum.variants[*]" $None
+//@ is "$.index[?(@.name == 'AlwaysNone')].inner.enum.variants[*]" $None
 
-//@ set use_None = "$.index[*][?(@.inner.use)].id"
-//@ is "$.index[*][?(@.inner.use)].inner.use.id" $None
+//@ set use_None = "$.index[?(@.inner.use)].id"
+//@ is "$.index[?(@.inner.use)].inner.use.id" $None
 pub use AlwaysNone::None;
 
-//@ ismany "$.index[*][?(@.name == 'use_variant')].inner.module.items[*]" $AlwaysNone $use_None
+//@ ismany "$.index[?(@.name == 'use_variant')].inner.module.items[*]" $AlwaysNone $use_None
diff --git a/tests/rustdoc-json/enums/use_variant_foreign.rs b/tests/rustdoc-json/enums/use_variant_foreign.rs
index a9ad61b9fe3..14e07b4123e 100644
--- a/tests/rustdoc-json/enums/use_variant_foreign.rs
+++ b/tests/rustdoc-json/enums/use_variant_foreign.rs
@@ -2,8 +2,8 @@
 
 extern crate color;
 
-//@ has "$.index[*].inner.use[?(@.name == 'Red')]"
+//@ has "$.index[?(@.inner.use.name == 'Red')]"
 pub use color::Color::Red;
 
-//@ !has "$.index[*][?(@.name == 'Red')]"
-//@ !has "$.index[*][?(@.name == 'Color')]"
+//@ !has "$.index[?(@.name == 'Red')]"
+//@ !has "$.index[?(@.name == 'Color')]"
diff --git a/tests/rustdoc-json/enums/variant_order.rs b/tests/rustdoc-json/enums/variant_order.rs
index 6ebe28c94ca..dd11c0963ee 100644
--- a/tests/rustdoc-json/enums/variant_order.rs
+++ b/tests/rustdoc-json/enums/variant_order.rs
@@ -15,24 +15,24 @@ pub enum Foo {
     Vll9,
 }
 
-//@ set 0 = '$.index[*][?(@.name == "Ews0")].id'
-//@ set 1 = '$.index[*][?(@.name == "Dik1")].id'
-//@ set 2 = '$.index[*][?(@.name == "Hsk2")].id'
-//@ set 3 = '$.index[*][?(@.name == "Djt3")].id'
-//@ set 4 = '$.index[*][?(@.name == "Jnr4")].id'
-//@ set 5 = '$.index[*][?(@.name == "Dfs5")].id'
-//@ set 6 = '$.index[*][?(@.name == "Bja6")].id'
-//@ set 7 = '$.index[*][?(@.name == "Lyc7")].id'
-//@ set 8 = '$.index[*][?(@.name == "Yqd8")].id'
-//@ set 9 = '$.index[*][?(@.name == "Vll9")].id'
+//@ set 0 = '$.index[?(@.name == "Ews0")].id'
+//@ set 1 = '$.index[?(@.name == "Dik1")].id'
+//@ set 2 = '$.index[?(@.name == "Hsk2")].id'
+//@ set 3 = '$.index[?(@.name == "Djt3")].id'
+//@ set 4 = '$.index[?(@.name == "Jnr4")].id'
+//@ set 5 = '$.index[?(@.name == "Dfs5")].id'
+//@ set 6 = '$.index[?(@.name == "Bja6")].id'
+//@ set 7 = '$.index[?(@.name == "Lyc7")].id'
+//@ set 8 = '$.index[?(@.name == "Yqd8")].id'
+//@ set 9 = '$.index[?(@.name == "Vll9")].id'
 
-//@ is '$.index[*][?(@.name == "Foo")].inner.enum.variants[0]' $0
-//@ is '$.index[*][?(@.name == "Foo")].inner.enum.variants[1]' $1
-//@ is '$.index[*][?(@.name == "Foo")].inner.enum.variants[2]' $2
-//@ is '$.index[*][?(@.name == "Foo")].inner.enum.variants[3]' $3
-//@ is '$.index[*][?(@.name == "Foo")].inner.enum.variants[4]' $4
-//@ is '$.index[*][?(@.name == "Foo")].inner.enum.variants[5]' $5
-//@ is '$.index[*][?(@.name == "Foo")].inner.enum.variants[6]' $6
-//@ is '$.index[*][?(@.name == "Foo")].inner.enum.variants[7]' $7
-//@ is '$.index[*][?(@.name == "Foo")].inner.enum.variants[8]' $8
-//@ is '$.index[*][?(@.name == "Foo")].inner.enum.variants[9]' $9
+//@ is '$.index[?(@.name == "Foo")].inner.enum.variants[0]' $0
+//@ is '$.index[?(@.name == "Foo")].inner.enum.variants[1]' $1
+//@ is '$.index[?(@.name == "Foo")].inner.enum.variants[2]' $2
+//@ is '$.index[?(@.name == "Foo")].inner.enum.variants[3]' $3
+//@ is '$.index[?(@.name == "Foo")].inner.enum.variants[4]' $4
+//@ is '$.index[?(@.name == "Foo")].inner.enum.variants[5]' $5
+//@ is '$.index[?(@.name == "Foo")].inner.enum.variants[6]' $6
+//@ is '$.index[?(@.name == "Foo")].inner.enum.variants[7]' $7
+//@ is '$.index[?(@.name == "Foo")].inner.enum.variants[8]' $8
+//@ is '$.index[?(@.name == "Foo")].inner.enum.variants[9]' $9
diff --git a/tests/rustdoc-json/enums/variant_struct.rs b/tests/rustdoc-json/enums/variant_struct.rs
index 44a0c946711..730689c8afa 100644
--- a/tests/rustdoc-json/enums/variant_struct.rs
+++ b/tests/rustdoc-json/enums/variant_struct.rs
@@ -1,10 +1,10 @@
-//@ is "$.index[*][?(@.name=='EnumStruct')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='EnumStruct')].inner.enum"
+//@ is "$.index[?(@.name=='EnumStruct')].visibility" \"public\"
+//@ has "$.index[?(@.name=='EnumStruct')].inner.enum"
 pub enum EnumStruct {
-    //@ has "$.index[*][?(@.name=='x')].inner.struct_field"
-    //@ set x = "$.index[*][?(@.name=='x')].id"
-    //@ has "$.index[*][?(@.name=='y')].inner.struct_field"
-    //@ set y = "$.index[*][?(@.name=='y')].id"
-    //@ ismany "$.index[*][?(@.name=='VariantS')].inner.variant.kind.struct.fields[*]" $x $y
+    //@ has "$.index[?(@.name=='x')].inner.struct_field"
+    //@ set x = "$.index[?(@.name=='x')].id"
+    //@ has "$.index[?(@.name=='y')].inner.struct_field"
+    //@ set y = "$.index[?(@.name=='y')].id"
+    //@ ismany "$.index[?(@.name=='VariantS')].inner.variant.kind.struct.fields[*]" $x $y
     VariantS { x: u32, y: String },
 }
diff --git a/tests/rustdoc-json/enums/variant_tuple_struct.rs b/tests/rustdoc-json/enums/variant_tuple_struct.rs
index 04f0cbb40c4..0fc06920e4b 100644
--- a/tests/rustdoc-json/enums/variant_tuple_struct.rs
+++ b/tests/rustdoc-json/enums/variant_tuple_struct.rs
@@ -1,10 +1,10 @@
-//@ is "$.index[*][?(@.name=='EnumTupleStruct')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='EnumTupleStruct')].inner.enum"
+//@ is "$.index[?(@.name=='EnumTupleStruct')].visibility" \"public\"
+//@ has "$.index[?(@.name=='EnumTupleStruct')].inner.enum"
 pub enum EnumTupleStruct {
-    //@ has "$.index[*][?(@.name=='0')].inner.struct_field"
-    //@ set f0 = "$.index[*][?(@.name=='0')].id"
-    //@ has "$.index[*][?(@.name=='1')].inner.struct_field"
-    //@ set f1 = "$.index[*][?(@.name=='1')].id"
-    //@ ismany "$.index[*][?(@.name=='VariantA')].inner.variant.kind.tuple[*]" $f0 $f1
+    //@ has "$.index[?(@.name=='0')].inner.struct_field"
+    //@ set f0 = "$.index[?(@.name=='0')].id"
+    //@ has "$.index[?(@.name=='1')].inner.struct_field"
+    //@ set f1 = "$.index[?(@.name=='1')].id"
+    //@ ismany "$.index[?(@.name=='VariantA')].inner.variant.kind.tuple[*]" $f0 $f1
     VariantA(u32, String),
 }
diff --git a/tests/rustdoc-json/fn_pointer/abi.rs b/tests/rustdoc-json/fn_pointer/abi.rs
index 13a967bd35e..34150c0fe89 100644
--- a/tests/rustdoc-json/fn_pointer/abi.rs
+++ b/tests/rustdoc-json/fn_pointer/abi.rs
@@ -1,22 +1,22 @@
 #![feature(abi_vectorcall)]
 
-//@ is "$.index[*][?(@.name=='AbiRust')].inner.type_alias.type.function_pointer.header.abi" \"Rust\"
+//@ is "$.index[?(@.name=='AbiRust')].inner.type_alias.type.function_pointer.header.abi" \"Rust\"
 pub type AbiRust = fn();
 
-//@ is "$.index[*][?(@.name=='AbiC')].inner.type_alias.type.function_pointer.header.abi" '{"C": {"unwind": false}}'
+//@ is "$.index[?(@.name=='AbiC')].inner.type_alias.type.function_pointer.header.abi" '{"C": {"unwind": false}}'
 pub type AbiC = extern "C" fn();
 
-//@ is "$.index[*][?(@.name=='AbiSystem')].inner.type_alias.type.function_pointer.header.abi" '{"System": {"unwind": false}}'
+//@ is "$.index[?(@.name=='AbiSystem')].inner.type_alias.type.function_pointer.header.abi" '{"System": {"unwind": false}}'
 pub type AbiSystem = extern "system" fn();
 
-//@ is "$.index[*][?(@.name=='AbiCUnwind')].inner.type_alias.type.function_pointer.header.abi" '{"C": {"unwind": true}}'
+//@ is "$.index[?(@.name=='AbiCUnwind')].inner.type_alias.type.function_pointer.header.abi" '{"C": {"unwind": true}}'
 pub type AbiCUnwind = extern "C-unwind" fn();
 
-//@ is "$.index[*][?(@.name=='AbiSystemUnwind')].inner.type_alias.type.function_pointer.header.abi" '{"System": {"unwind": true}}'
+//@ is "$.index[?(@.name=='AbiSystemUnwind')].inner.type_alias.type.function_pointer.header.abi" '{"System": {"unwind": true}}'
 pub type AbiSystemUnwind = extern "system-unwind" fn();
 
-//@ is "$.index[*][?(@.name=='AbiVecorcall')].inner.type_alias.type.function_pointer.header.abi.Other" '"\"vectorcall\""'
+//@ is "$.index[?(@.name=='AbiVecorcall')].inner.type_alias.type.function_pointer.header.abi.Other" '"\"vectorcall\""'
 pub type AbiVecorcall = extern "vectorcall" fn();
 
-//@ is "$.index[*][?(@.name=='AbiVecorcallUnwind')].inner.type_alias.type.function_pointer.header.abi.Other" '"\"vectorcall-unwind\""'
+//@ is "$.index[?(@.name=='AbiVecorcallUnwind')].inner.type_alias.type.function_pointer.header.abi.Other" '"\"vectorcall-unwind\""'
 pub type AbiVecorcallUnwind = extern "vectorcall-unwind" fn();
diff --git a/tests/rustdoc-json/fn_pointer/generics.rs b/tests/rustdoc-json/fn_pointer/generics.rs
index c974b472297..960b91e7d8e 100644
--- a/tests/rustdoc-json/fn_pointer/generics.rs
+++ b/tests/rustdoc-json/fn_pointer/generics.rs
@@ -1,8 +1,8 @@
-//@ count "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.sig.inputs[*]" 1
-//@ is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.sig.inputs[0][0]" '"val"'
-//@ is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.sig.inputs[0][1].borrowed_ref.lifetime" \"\'c\"
-//@ is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.sig.output.primitive" \"i32\"
-//@ count "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.generic_params[*]" 1
-//@ is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.generic_params[0].name" \"\'c\"
-//@ is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }'
+//@ count "$.index[?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.sig.inputs[*]" 1
+//@ is "$.index[?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.sig.inputs[0][0]" '"val"'
+//@ is "$.index[?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.sig.inputs[0][1].borrowed_ref.lifetime" \"\'c\"
+//@ is "$.index[?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.sig.output.primitive" \"i32\"
+//@ count "$.index[?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.generic_params[*]" 1
+//@ is "$.index[?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.generic_params[0].name" \"\'c\"
+//@ is "$.index[?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }'
 pub type WithHigherRankTraitBounds = for<'c> fn(val: &'c i32) -> i32;
diff --git a/tests/rustdoc-json/fn_pointer/qualifiers.rs b/tests/rustdoc-json/fn_pointer/qualifiers.rs
index 398e31f72db..769749d0dd4 100644
--- a/tests/rustdoc-json/fn_pointer/qualifiers.rs
+++ b/tests/rustdoc-json/fn_pointer/qualifiers.rs
@@ -1,9 +1,9 @@
-//@ is "$.index[*][?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.is_unsafe" false
-//@ is "$.index[*][?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.is_const" false
-//@ is "$.index[*][?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.is_async" false
+//@ is "$.index[?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.is_unsafe" false
+//@ is "$.index[?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.is_const" false
+//@ is "$.index[?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.is_async" false
 pub type FnPointer = fn();
 
-//@ is "$.index[*][?(@.name=='UnsafePointer')].inner.type_alias.type.function_pointer.header.is_unsafe" true
-//@ is "$.index[*][?(@.name=='UnsafePointer')].inner.type_alias.type.function_pointer.header.is_const" false
-//@ is "$.index[*][?(@.name=='UnsafePointer')].inner.type_alias.type.function_pointer.header.is_async" false
+//@ is "$.index[?(@.name=='UnsafePointer')].inner.type_alias.type.function_pointer.header.is_unsafe" true
+//@ is "$.index[?(@.name=='UnsafePointer')].inner.type_alias.type.function_pointer.header.is_const" false
+//@ is "$.index[?(@.name=='UnsafePointer')].inner.type_alias.type.function_pointer.header.is_async" false
 pub type UnsafePointer = unsafe fn();
diff --git a/tests/rustdoc-json/fns/abi.rs b/tests/rustdoc-json/fns/abi.rs
index 68957f79952..7277bb1f59a 100644
--- a/tests/rustdoc-json/fns/abi.rs
+++ b/tests/rustdoc-json/fns/abi.rs
@@ -1,22 +1,22 @@
 #![feature(abi_vectorcall)]
 
-//@ is "$.index[*][?(@.name=='abi_rust')].inner.function.header.abi" \"Rust\"
+//@ is "$.index[?(@.name=='abi_rust')].inner.function.header.abi" \"Rust\"
 pub fn abi_rust() {}
 
-//@ is "$.index[*][?(@.name=='abi_c')].inner.function.header.abi" '{"C": {"unwind": false}}'
+//@ is "$.index[?(@.name=='abi_c')].inner.function.header.abi" '{"C": {"unwind": false}}'
 pub extern "C" fn abi_c() {}
 
-//@ is "$.index[*][?(@.name=='abi_system')].inner.function.header.abi" '{"System": {"unwind": false}}'
+//@ is "$.index[?(@.name=='abi_system')].inner.function.header.abi" '{"System": {"unwind": false}}'
 pub extern "system" fn abi_system() {}
 
-//@ is "$.index[*][?(@.name=='abi_c_unwind')].inner.function.header.abi" '{"C": {"unwind": true}}'
+//@ is "$.index[?(@.name=='abi_c_unwind')].inner.function.header.abi" '{"C": {"unwind": true}}'
 pub extern "C-unwind" fn abi_c_unwind() {}
 
-//@ is "$.index[*][?(@.name=='abi_system_unwind')].inner.function.header.abi" '{"System": {"unwind": true}}'
+//@ is "$.index[?(@.name=='abi_system_unwind')].inner.function.header.abi" '{"System": {"unwind": true}}'
 pub extern "system-unwind" fn abi_system_unwind() {}
 
-//@ is "$.index[*][?(@.name=='abi_vectorcall')].inner.function.header.abi.Other" '"\"vectorcall\""'
+//@ is "$.index[?(@.name=='abi_vectorcall')].inner.function.header.abi.Other" '"\"vectorcall\""'
 pub extern "vectorcall" fn abi_vectorcall() {}
 
-//@ is "$.index[*][?(@.name=='abi_vectorcall_unwind')].inner.function.header.abi.Other" '"\"vectorcall-unwind\""'
+//@ is "$.index[?(@.name=='abi_vectorcall_unwind')].inner.function.header.abi.Other" '"\"vectorcall-unwind\""'
 pub extern "vectorcall-unwind" fn abi_vectorcall_unwind() {}
diff --git a/tests/rustdoc-json/fns/async_return.rs b/tests/rustdoc-json/fns/async_return.rs
index ddfd4ccf90d..e7c6a2981ac 100644
--- a/tests/rustdoc-json/fns/async_return.rs
+++ b/tests/rustdoc-json/fns/async_return.rs
@@ -4,30 +4,30 @@
 
 use std::future::Future;
 
-//@ is "$.index[*][?(@.name=='get_int')].inner.function.sig.output.primitive" \"i32\"
-//@ is "$.index[*][?(@.name=='get_int')].inner.function.header.is_async" false
+//@ is "$.index[?(@.name=='get_int')].inner.function.sig.output.primitive" \"i32\"
+//@ is "$.index[?(@.name=='get_int')].inner.function.header.is_async" false
 pub fn get_int() -> i32 {
     42
 }
 
-//@ is "$.index[*][?(@.name=='get_int_async')].inner.function.sig.output.primitive" \"i32\"
-//@ is "$.index[*][?(@.name=='get_int_async')].inner.function.header.is_async" true
+//@ is "$.index[?(@.name=='get_int_async')].inner.function.sig.output.primitive" \"i32\"
+//@ is "$.index[?(@.name=='get_int_async')].inner.function.header.is_async" true
 pub async fn get_int_async() -> i32 {
     42
 }
 
-//@ is "$.index[*][?(@.name=='get_int_future')].inner.function.sig.output.impl_trait[0].trait_bound.trait.path" '"Future"'
-//@ is "$.index[*][?(@.name=='get_int_future')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].name" '"Output"'
-//@ is "$.index[*][?(@.name=='get_int_future')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].binding.equality.type.primitive"  \"i32\"
-//@ is "$.index[*][?(@.name=='get_int_future')].inner.function.header.is_async" false
+//@ is "$.index[?(@.name=='get_int_future')].inner.function.sig.output.impl_trait[0].trait_bound.trait.path" '"Future"'
+//@ is "$.index[?(@.name=='get_int_future')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].name" '"Output"'
+//@ is "$.index[?(@.name=='get_int_future')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].binding.equality.type.primitive"  \"i32\"
+//@ is "$.index[?(@.name=='get_int_future')].inner.function.header.is_async" false
 pub fn get_int_future() -> impl Future<Output = i32> {
     async { 42 }
 }
 
-//@ is "$.index[*][?(@.name=='get_int_future_async')].inner.function.sig.output.impl_trait[0].trait_bound.trait.path" '"Future"'
-//@ is "$.index[*][?(@.name=='get_int_future_async')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].name" '"Output"'
-//@ is "$.index[*][?(@.name=='get_int_future_async')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].binding.equality.type.primitive" \"i32\"
-//@ is "$.index[*][?(@.name=='get_int_future_async')].inner.function.header.is_async" true
+//@ is "$.index[?(@.name=='get_int_future_async')].inner.function.sig.output.impl_trait[0].trait_bound.trait.path" '"Future"'
+//@ is "$.index[?(@.name=='get_int_future_async')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].name" '"Output"'
+//@ is "$.index[?(@.name=='get_int_future_async')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].binding.equality.type.primitive" \"i32\"
+//@ is "$.index[?(@.name=='get_int_future_async')].inner.function.header.is_async" true
 pub async fn get_int_future_async() -> impl Future<Output = i32> {
     async { 42 }
 }
diff --git a/tests/rustdoc-json/fns/extern_c_variadic.rs b/tests/rustdoc-json/fns/extern_c_variadic.rs
index 8e9085640e0..d90bb83d98f 100644
--- a/tests/rustdoc-json/fns/extern_c_variadic.rs
+++ b/tests/rustdoc-json/fns/extern_c_variadic.rs
@@ -1,6 +1,6 @@
 extern "C" {
-    //@ is "$.index[*][?(@.name == 'not_variadic')].inner.function.sig.is_c_variadic" false
+    //@ is "$.index[?(@.name == 'not_variadic')].inner.function.sig.is_c_variadic" false
     pub fn not_variadic(_: i32);
-    //@ is "$.index[*][?(@.name == 'variadic')].inner.function.sig.is_c_variadic" true
+    //@ is "$.index[?(@.name == 'variadic')].inner.function.sig.is_c_variadic" true
     pub fn variadic(_: i32, ...);
 }
diff --git a/tests/rustdoc-json/fns/extern_safe.rs b/tests/rustdoc-json/fns/extern_safe.rs
index b00f9f50bd2..bc217ae914c 100644
--- a/tests/rustdoc-json/fns/extern_safe.rs
+++ b/tests/rustdoc-json/fns/extern_safe.rs
@@ -1,17 +1,17 @@
 extern "C" {
-    //@ is "$.index[*][?(@.name=='f1')].inner.function.header.is_unsafe" true
+    //@ is "$.index[?(@.name=='f1')].inner.function.header.is_unsafe" true
     pub fn f1();
 
     // items in `extern` blocks without an `unsafe` qualifier cannot have safety qualifiers
 }
 
 unsafe extern "C" {
-    //@ is "$.index[*][?(@.name=='f4')].inner.function.header.is_unsafe" true
+    //@ is "$.index[?(@.name=='f4')].inner.function.header.is_unsafe" true
     pub fn f4();
 
-    //@ is "$.index[*][?(@.name=='f5')].inner.function.header.is_unsafe" true
+    //@ is "$.index[?(@.name=='f5')].inner.function.header.is_unsafe" true
     pub unsafe fn f5();
 
-    //@ is "$.index[*][?(@.name=='f6')].inner.function.header.is_unsafe" false
+    //@ is "$.index[?(@.name=='f6')].inner.function.header.is_unsafe" false
     pub safe fn f6();
 }
diff --git a/tests/rustdoc-json/fns/generic_args.rs b/tests/rustdoc-json/fns/generic_args.rs
index 6a7124976f8..2ea68173d68 100644
--- a/tests/rustdoc-json/fns/generic_args.rs
+++ b/tests/rustdoc-json/fns/generic_args.rs
@@ -1,58 +1,58 @@
-//@ set foo = "$.index[*][?(@.name=='Foo')].id"
+//@ set foo = "$.index[?(@.name=='Foo')].id"
 pub trait Foo {}
 
-//@ set generic_foo = "$.index[*][?(@.name=='GenericFoo')].id"
+//@ set generic_foo = "$.index[?(@.name=='GenericFoo')].id"
 pub trait GenericFoo<'a> {}
 
-//@ is "$.index[*][?(@.name=='generics')].inner.function.generics.where_predicates" "[]"
-//@ count "$.index[*][?(@.name=='generics')].inner.function.generics.params[*]" 1
-//@ is "$.index[*][?(@.name=='generics')].inner.function.generics.params[0].name" '"F"'
-//@ is "$.index[*][?(@.name=='generics')].inner.function.generics.params[0].kind.type.default" 'null'
-//@ count "$.index[*][?(@.name=='generics')].inner.function.generics.params[0].kind.type.bounds[*]" 1
-//@ is "$.index[*][?(@.name=='generics')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" '$foo'
-//@ count "$.index[*][?(@.name=='generics')].inner.function.sig.inputs[*]" 1
-//@ is "$.index[*][?(@.name=='generics')].inner.function.sig.inputs[0][0]" '"f"'
-//@ is "$.index[*][?(@.name=='generics')].inner.function.sig.inputs[0][1].generic" '"F"'
+//@ is "$.index[?(@.name=='generics')].inner.function.generics.where_predicates" "[]"
+//@ count "$.index[?(@.name=='generics')].inner.function.generics.params[*]" 1
+//@ is "$.index[?(@.name=='generics')].inner.function.generics.params[0].name" '"F"'
+//@ is "$.index[?(@.name=='generics')].inner.function.generics.params[0].kind.type.default" 'null'
+//@ count "$.index[?(@.name=='generics')].inner.function.generics.params[0].kind.type.bounds[*]" 1
+//@ is "$.index[?(@.name=='generics')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" '$foo'
+//@ count "$.index[?(@.name=='generics')].inner.function.sig.inputs[*]" 1
+//@ is "$.index[?(@.name=='generics')].inner.function.sig.inputs[0][0]" '"f"'
+//@ is "$.index[?(@.name=='generics')].inner.function.sig.inputs[0][1].generic" '"F"'
 pub fn generics<F: Foo>(f: F) {}
 
-//@ is "$.index[*][?(@.name=='impl_trait')].inner.function.generics.where_predicates" "[]"
-//@ count "$.index[*][?(@.name=='impl_trait')].inner.function.generics.params[*]" 1
-//@ is "$.index[*][?(@.name=='impl_trait')].inner.function.generics.params[0].name" '"impl Foo"'
-//@ is "$.index[*][?(@.name=='impl_trait')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $foo
-//@ count "$.index[*][?(@.name=='impl_trait')].inner.function.sig.inputs[*]" 1
-//@ is "$.index[*][?(@.name=='impl_trait')].inner.function.sig.inputs[0][0]" '"f"'
-//@ count "$.index[*][?(@.name=='impl_trait')].inner.function.sig.inputs[0][1].impl_trait[*]" 1
-//@ is "$.index[*][?(@.name=='impl_trait')].inner.function.sig.inputs[0][1].impl_trait[0].trait_bound.trait.id" $foo
+//@ is "$.index[?(@.name=='impl_trait')].inner.function.generics.where_predicates" "[]"
+//@ count "$.index[?(@.name=='impl_trait')].inner.function.generics.params[*]" 1
+//@ is "$.index[?(@.name=='impl_trait')].inner.function.generics.params[0].name" '"impl Foo"'
+//@ is "$.index[?(@.name=='impl_trait')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $foo
+//@ count "$.index[?(@.name=='impl_trait')].inner.function.sig.inputs[*]" 1
+//@ is "$.index[?(@.name=='impl_trait')].inner.function.sig.inputs[0][0]" '"f"'
+//@ count "$.index[?(@.name=='impl_trait')].inner.function.sig.inputs[0][1].impl_trait[*]" 1
+//@ is "$.index[?(@.name=='impl_trait')].inner.function.sig.inputs[0][1].impl_trait[0].trait_bound.trait.id" $foo
 pub fn impl_trait(f: impl Foo) {}
 
-//@ count "$.index[*][?(@.name=='where_clase')].inner.function.generics.params[*]" 3
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.params[0].name" '"F"'
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.params[0].kind" '{"type": {"bounds": [], "default": null, "is_synthetic": false}}'
-//@ count "$.index[*][?(@.name=='where_clase')].inner.function.sig.inputs[*]" 3
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.sig.inputs[0][0]" '"f"'
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.sig.inputs[0][1].generic" '"F"'
-//@ count "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[*]" 3
+//@ count "$.index[?(@.name=='where_clase')].inner.function.generics.params[*]" 3
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.params[0].name" '"F"'
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.params[0].kind" '{"type": {"bounds": [], "default": null, "is_synthetic": false}}'
+//@ count "$.index[?(@.name=='where_clase')].inner.function.sig.inputs[*]" 3
+//@ is "$.index[?(@.name=='where_clase')].inner.function.sig.inputs[0][0]" '"f"'
+//@ is "$.index[?(@.name=='where_clase')].inner.function.sig.inputs[0][1].generic" '"F"'
+//@ count "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[*]" 3
 
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[0].bound_predicate.type.generic" \"F\"
-//@ count "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[0].bound_predicate.bounds[*]" 1
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[0].bound_predicate.bounds[0].trait_bound.trait.id" $foo
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[0].bound_predicate.type.generic" \"F\"
+//@ count "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[0].bound_predicate.bounds[*]" 1
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[0].bound_predicate.bounds[0].trait_bound.trait.id" $foo
 
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.type.generic" \"G\"
-//@ count "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[*]" 1
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.trait.id" $generic_foo
-//@ count "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.generic_params[*]" 1
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.generic_params[0].name" \"\'a\"
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.generic_params[0].kind.lifetime.outlives" "[]"
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.generic_params" "[]"
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.type.generic" \"G\"
+//@ count "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[*]" 1
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.trait.id" $generic_foo
+//@ count "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.generic_params[*]" 1
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.generic_params[0].name" \"\'a\"
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.generic_params[0].kind.lifetime.outlives" "[]"
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.generic_params" "[]"
 
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.type.borrowed_ref.lifetime" \"\'b\"
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.type.borrowed_ref.type.generic" \"H\"
-//@ count "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.bounds[*]" 1
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.bounds[0].trait_bound.trait.id" $foo
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.bounds[0].trait_bound.generic_params" "[]"
-//@ count "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.generic_params[*]" 1
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.generic_params[0].name" \"\'b\"
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.generic_params[0].kind.lifetime.outlives" "[]"
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.type.borrowed_ref.lifetime" \"\'b\"
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.type.borrowed_ref.type.generic" \"H\"
+//@ count "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.bounds[*]" 1
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.bounds[0].trait_bound.trait.id" $foo
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.bounds[0].trait_bound.generic_params" "[]"
+//@ count "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.generic_params[*]" 1
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.generic_params[0].name" \"\'b\"
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.generic_params[0].kind.lifetime.outlives" "[]"
 pub fn where_clase<F, G, H>(f: F, g: G, h: H)
 where
     F: Foo,
diff --git a/tests/rustdoc-json/fns/generic_returns.rs b/tests/rustdoc-json/fns/generic_returns.rs
index 90e17525c44..a0d4c745599 100644
--- a/tests/rustdoc-json/fns/generic_returns.rs
+++ b/tests/rustdoc-json/fns/generic_returns.rs
@@ -1,11 +1,11 @@
-//@ count "$.index[*][?(@.name=='generic_returns')].inner.module.items[*]" 2
+//@ count "$.index[?(@.name=='generic_returns')].inner.module.items[*]" 2
 
-//@ set foo = "$.index[*][?(@.name=='Foo')].id"
+//@ set foo = "$.index[?(@.name=='Foo')].id"
 pub trait Foo {}
 
-//@ is "$.index[*][?(@.name=='get_foo')].inner.function.sig.inputs" []
-//@ count "$.index[*][?(@.name=='get_foo')].inner.function.sig.output.impl_trait[*]" 1
-//@ is "$.index[*][?(@.name=='get_foo')].inner.function.sig.output.impl_trait[0].trait_bound.trait.id" $foo
+//@ is "$.index[?(@.name=='get_foo')].inner.function.sig.inputs" []
+//@ count "$.index[?(@.name=='get_foo')].inner.function.sig.output.impl_trait[*]" 1
+//@ is "$.index[?(@.name=='get_foo')].inner.function.sig.output.impl_trait[0].trait_bound.trait.id" $foo
 pub fn get_foo() -> impl Foo {
     Fooer {}
 }
diff --git a/tests/rustdoc-json/fns/generics.rs b/tests/rustdoc-json/fns/generics.rs
index b953094b5de..3efd917309a 100644
--- a/tests/rustdoc-json/fns/generics.rs
+++ b/tests/rustdoc-json/fns/generics.rs
@@ -1,20 +1,20 @@
-//@ set wham_id = "$.index[*][?(@.name=='Wham')].id"
+//@ set wham_id = "$.index[?(@.name=='Wham')].id"
 pub trait Wham {}
 
-//@ is    "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.generics.where_predicates" []
-//@ count "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.generics.params[*]" 1
-//@ is    "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.generics.params[0].name" '"T"'
-//@ is    "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.generics.params[0].kind.type.is_synthetic" false
-//@ is    "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $wham_id
-//@ is    "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.sig.inputs" '[["w", {"generic": "T"}]]'
+//@ is    "$.index[?(@.name=='one_generic_param_fn')].inner.function.generics.where_predicates" []
+//@ count "$.index[?(@.name=='one_generic_param_fn')].inner.function.generics.params[*]" 1
+//@ is    "$.index[?(@.name=='one_generic_param_fn')].inner.function.generics.params[0].name" '"T"'
+//@ is    "$.index[?(@.name=='one_generic_param_fn')].inner.function.generics.params[0].kind.type.is_synthetic" false
+//@ is    "$.index[?(@.name=='one_generic_param_fn')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $wham_id
+//@ is    "$.index[?(@.name=='one_generic_param_fn')].inner.function.sig.inputs" '[["w", {"generic": "T"}]]'
 pub fn one_generic_param_fn<T: Wham>(w: T) {}
 
-//@ is    "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.where_predicates" []
-//@ count "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[*]" 1
-//@ is    "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[0].name" '"impl Wham"'
-//@ is    "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[0].kind.type.is_synthetic" true
-//@ is    "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $wham_id
-//@ count "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.sig.inputs[*]" 1
-//@ is    "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.sig.inputs[0][0]" '"w"'
-//@ is    "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.sig.inputs[0][1].impl_trait[0].trait_bound.trait.id" $wham_id
+//@ is    "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.where_predicates" []
+//@ count "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[*]" 1
+//@ is    "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[0].name" '"impl Wham"'
+//@ is    "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[0].kind.type.is_synthetic" true
+//@ is    "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $wham_id
+//@ count "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.sig.inputs[*]" 1
+//@ is    "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.sig.inputs[0][0]" '"w"'
+//@ is    "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.sig.inputs[0][1].impl_trait[0].trait_bound.trait.id" $wham_id
 pub fn one_synthetic_generic_param_fn(w: impl Wham) {}
diff --git a/tests/rustdoc-json/fns/pattern_arg.rs b/tests/rustdoc-json/fns/pattern_arg.rs
index d2a00f47438..059318a4295 100644
--- a/tests/rustdoc-json/fns/pattern_arg.rs
+++ b/tests/rustdoc-json/fns/pattern_arg.rs
@@ -1,7 +1,7 @@
-//@ is "$.index[*][?(@.name=='fst')].inner.function.sig.inputs[0][0]" '"(x, _)"'
+//@ is "$.index[?(@.name=='fst')].inner.function.sig.inputs[0][0]" '"(x, _)"'
 pub fn fst<X, Y>((x, _): (X, Y)) -> X {
     x
 }
 
-//@ is "$.index[*][?(@.name=='drop_int')].inner.function.sig.inputs[0][0]" '"_"'
+//@ is "$.index[?(@.name=='drop_int')].inner.function.sig.inputs[0][0]" '"_"'
 pub fn drop_int(_: i32) {}
diff --git a/tests/rustdoc-json/fns/qualifiers.rs b/tests/rustdoc-json/fns/qualifiers.rs
index 67e49f0780a..7d93a3bf243 100644
--- a/tests/rustdoc-json/fns/qualifiers.rs
+++ b/tests/rustdoc-json/fns/qualifiers.rs
@@ -1,33 +1,33 @@
 //@ edition:2018
 
-//@ is "$.index[*][?(@.name=='nothing_fn')].inner.function.header.is_async" false
-//@ is "$.index[*][?(@.name=='nothing_fn')].inner.function.header.is_const"  false
-//@ is "$.index[*][?(@.name=='nothing_fn')].inner.function.header.is_unsafe" false
+//@ is "$.index[?(@.name=='nothing_fn')].inner.function.header.is_async" false
+//@ is "$.index[?(@.name=='nothing_fn')].inner.function.header.is_const"  false
+//@ is "$.index[?(@.name=='nothing_fn')].inner.function.header.is_unsafe" false
 pub fn nothing_fn() {}
 
-//@ is "$.index[*][?(@.name=='unsafe_fn')].inner.function.header.is_async"  false
-//@ is "$.index[*][?(@.name=='unsafe_fn')].inner.function.header.is_const"  false
-//@ is "$.index[*][?(@.name=='unsafe_fn')].inner.function.header.is_unsafe" true
+//@ is "$.index[?(@.name=='unsafe_fn')].inner.function.header.is_async"  false
+//@ is "$.index[?(@.name=='unsafe_fn')].inner.function.header.is_const"  false
+//@ is "$.index[?(@.name=='unsafe_fn')].inner.function.header.is_unsafe" true
 pub unsafe fn unsafe_fn() {}
 
-//@ is "$.index[*][?(@.name=='const_fn')].inner.function.header.is_async"  false
-//@ is "$.index[*][?(@.name=='const_fn')].inner.function.header.is_const"  true
-//@ is "$.index[*][?(@.name=='const_fn')].inner.function.header.is_unsafe" false
+//@ is "$.index[?(@.name=='const_fn')].inner.function.header.is_async"  false
+//@ is "$.index[?(@.name=='const_fn')].inner.function.header.is_const"  true
+//@ is "$.index[?(@.name=='const_fn')].inner.function.header.is_unsafe" false
 pub const fn const_fn() {}
 
-//@ is "$.index[*][?(@.name=='async_fn')].inner.function.header.is_async"  true
-//@ is "$.index[*][?(@.name=='async_fn')].inner.function.header.is_const"  false
-//@ is "$.index[*][?(@.name=='async_fn')].inner.function.header.is_unsafe" false
+//@ is "$.index[?(@.name=='async_fn')].inner.function.header.is_async"  true
+//@ is "$.index[?(@.name=='async_fn')].inner.function.header.is_const"  false
+//@ is "$.index[?(@.name=='async_fn')].inner.function.header.is_unsafe" false
 pub async fn async_fn() {}
 
-//@ is "$.index[*][?(@.name=='async_unsafe_fn')].inner.function.header.is_async"  true
-//@ is "$.index[*][?(@.name=='async_unsafe_fn')].inner.function.header.is_const"  false
-//@ is "$.index[*][?(@.name=='async_unsafe_fn')].inner.function.header.is_unsafe" true
+//@ is "$.index[?(@.name=='async_unsafe_fn')].inner.function.header.is_async"  true
+//@ is "$.index[?(@.name=='async_unsafe_fn')].inner.function.header.is_const"  false
+//@ is "$.index[?(@.name=='async_unsafe_fn')].inner.function.header.is_unsafe" true
 pub async unsafe fn async_unsafe_fn() {}
 
-//@ is "$.index[*][?(@.name=='const_unsafe_fn')].inner.function.header.is_async"  false
-//@ is "$.index[*][?(@.name=='const_unsafe_fn')].inner.function.header.is_const"  true
-//@ is "$.index[*][?(@.name=='const_unsafe_fn')].inner.function.header.is_unsafe" true
+//@ is "$.index[?(@.name=='const_unsafe_fn')].inner.function.header.is_async"  false
+//@ is "$.index[?(@.name=='const_unsafe_fn')].inner.function.header.is_const"  true
+//@ is "$.index[?(@.name=='const_unsafe_fn')].inner.function.header.is_unsafe" true
 pub const unsafe fn const_unsafe_fn() {}
 
 // It's impossible for a function to be both const and async, so no test for that
diff --git a/tests/rustdoc-json/fns/return_type_alias.rs b/tests/rustdoc-json/fns/return_type_alias.rs
index d60c4b68258..0aa1db47b7f 100644
--- a/tests/rustdoc-json/fns/return_type_alias.rs
+++ b/tests/rustdoc-json/fns/return_type_alias.rs
@@ -1,9 +1,9 @@
 // Regression test for <https://github.com/rust-lang/rust/issues/104851>
 
-///@ set foo = "$.index[*][?(@.name=='Foo')].id"
+///@ set foo = "$.index[?(@.name=='Foo')].id"
 pub type Foo = i32;
 
-//@ is "$.index[*][?(@.name=='demo')].inner.function.sig.output.resolved_path.id" $foo
+//@ is "$.index[?(@.name=='demo')].inner.function.sig.output.resolved_path.id" $foo
 pub fn demo() -> Foo {
     42
 }
diff --git a/tests/rustdoc-json/generic-associated-types/gats.rs b/tests/rustdoc-json/generic-associated-types/gats.rs
index d1172b35fda..5218cc886e3 100644
--- a/tests/rustdoc-json/generic-associated-types/gats.rs
+++ b/tests/rustdoc-json/generic-associated-types/gats.rs
@@ -1,32 +1,32 @@
 pub trait Display {}
 
 pub trait LendingIterator {
-    //@ count "$.index[*][?(@.name=='LendingItem')].inner.assoc_type.generics.params[*]" 1
-    //@ is "$.index[*][?(@.name=='LendingItem')].inner.assoc_type.generics.params[*].name" \"\'a\"
-    //@ count "$.index[*][?(@.name=='LendingItem')].inner.assoc_type.generics.where_predicates[*]" 1
-    //@ is "$.index[*][?(@.name=='LendingItem')].inner.assoc_type.generics.where_predicates[*].bound_predicate.type.generic" \"Self\"
-    //@ is "$.index[*][?(@.name=='LendingItem')].inner.assoc_type.generics.where_predicates[*].bound_predicate.bounds[*].outlives" \"\'a\"
-    //@ count "$.index[*][?(@.name=='LendingItem')].inner.assoc_type.bounds[*]" 1
+    //@ count "$.index[?(@.name=='LendingItem')].inner.assoc_type.generics.params[*]" 1
+    //@ is "$.index[?(@.name=='LendingItem')].inner.assoc_type.generics.params[*].name" \"\'a\"
+    //@ count "$.index[?(@.name=='LendingItem')].inner.assoc_type.generics.where_predicates[*]" 1
+    //@ is "$.index[?(@.name=='LendingItem')].inner.assoc_type.generics.where_predicates[*].bound_predicate.type.generic" \"Self\"
+    //@ is "$.index[?(@.name=='LendingItem')].inner.assoc_type.generics.where_predicates[*].bound_predicate.bounds[*].outlives" \"\'a\"
+    //@ count "$.index[?(@.name=='LendingItem')].inner.assoc_type.bounds[*]" 1
     type LendingItem<'a>: Display
     where
         Self: 'a;
 
-    //@ count "$.index[*][?(@.name=='lending_next')].inner.function.sig.output.qualified_path.args.angle_bracketed.args[*]" 1
-    //@ count "$.index[*][?(@.name=='lending_next')].inner.function.sig.output.qualified_path.args.angle_bracketed.bindings[*]" 0
-    //@ is "$.index[*][?(@.name=='lending_next')].inner.function.sig.output.qualified_path.self_type.generic" \"Self\"
-    //@ is "$.index[*][?(@.name=='lending_next')].inner.function.sig.output.qualified_path.name" \"LendingItem\"
+    //@ count "$.index[?(@.name=='lending_next')].inner.function.sig.output.qualified_path.args.angle_bracketed.args[*]" 1
+    //@ count "$.index[?(@.name=='lending_next')].inner.function.sig.output.qualified_path.args.angle_bracketed.bindings[*]" 0
+    //@ is "$.index[?(@.name=='lending_next')].inner.function.sig.output.qualified_path.self_type.generic" \"Self\"
+    //@ is "$.index[?(@.name=='lending_next')].inner.function.sig.output.qualified_path.name" \"LendingItem\"
     fn lending_next<'a>(&'a self) -> Self::LendingItem<'a>;
 }
 
 pub trait Iterator {
-    //@ count "$.index[*][?(@.name=='Item')].inner.assoc_type.generics.params[*]" 0
-    //@ count "$.index[*][?(@.name=='Item')].inner.assoc_type.generics.where_predicates[*]" 0
-    //@ count "$.index[*][?(@.name=='Item')].inner.assoc_type.bounds[*]" 1
+    //@ count "$.index[?(@.name=='Item')].inner.assoc_type.generics.params[*]" 0
+    //@ count "$.index[?(@.name=='Item')].inner.assoc_type.generics.where_predicates[*]" 0
+    //@ count "$.index[?(@.name=='Item')].inner.assoc_type.bounds[*]" 1
     type Item: Display;
 
-    //@ count "$.index[*][?(@.name=='next')].inner.function.sig.output.qualified_path.args.angle_bracketed.args[*]" 0
-    //@ count "$.index[*][?(@.name=='next')].inner.function.sig.output.qualified_path.args.angle_bracketed.bindings[*]" 0
-    //@ is "$.index[*][?(@.name=='next')].inner.function.sig.output.qualified_path.self_type.generic" \"Self\"
-    //@ is "$.index[*][?(@.name=='next')].inner.function.sig.output.qualified_path.name" \"Item\"
+    //@ count "$.index[?(@.name=='next')].inner.function.sig.output.qualified_path.args.angle_bracketed.args[*]" 0
+    //@ count "$.index[?(@.name=='next')].inner.function.sig.output.qualified_path.args.angle_bracketed.bindings[*]" 0
+    //@ is "$.index[?(@.name=='next')].inner.function.sig.output.qualified_path.self_type.generic" \"Self\"
+    //@ is "$.index[?(@.name=='next')].inner.function.sig.output.qualified_path.name" \"Item\"
     fn next<'a>(&'a self) -> Self::Item;
 }
diff --git a/tests/rustdoc-json/generic_impl.rs b/tests/rustdoc-json/generic_impl.rs
index e7a5d2a78c1..90bda1644ff 100644
--- a/tests/rustdoc-json/generic_impl.rs
+++ b/tests/rustdoc-json/generic_impl.rs
@@ -1,8 +1,8 @@
 // Regression test for <https://github.com/rust-lang/rust/issues/97986>.
 
-//@ has "$.index[*][?(@.name=='f')]"
-//@ has "$.index[*][?(@.name=='AssocTy')]"
-//@ has "$.index[*][?(@.name=='AssocConst')]"
+//@ has "$.index[?(@.name=='f')]"
+//@ has "$.index[?(@.name=='AssocTy')]"
+//@ has "$.index[?(@.name=='AssocConst')]"
 
 pub mod m {
     pub struct S;
diff --git a/tests/rustdoc-json/glob_import.rs b/tests/rustdoc-json/glob_import.rs
index b63e5dadd9e..6887f9ff63d 100644
--- a/tests/rustdoc-json/glob_import.rs
+++ b/tests/rustdoc-json/glob_import.rs
@@ -2,8 +2,8 @@
 
 #![no_std]
 
-//@ has "$.index[*][?(@.name=='glob')]"
-//@ has "$.index[*][?(@.inner.use)].inner.use.name" \"*\"
+//@ has "$.index[?(@.name=='glob')]"
+//@ has "$.index[?(@.inner.use)].inner.use.name" \"*\"
 
 mod m1 {
     pub fn f() {}
diff --git a/tests/rustdoc-json/impl-trait-in-assoc-type.rs b/tests/rustdoc-json/impl-trait-in-assoc-type.rs
index fc12fc87e8d..742a46e8967 100644
--- a/tests/rustdoc-json/impl-trait-in-assoc-type.rs
+++ b/tests/rustdoc-json/impl-trait-in-assoc-type.rs
@@ -4,25 +4,25 @@ pub struct AlwaysTrue;
 
 /// impl IntoIterator
 impl IntoIterator for AlwaysTrue {
-    //@ set Item = '$.index[*][?(@.docs=="type Item")].id'
+    //@ set Item = '$.index[?(@.docs=="type Item")].id'
     /// type Item
     type Item = bool;
 
-    //@ count '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[*]' 1
-    //@ is    '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.path' '"Iterator"'
-    //@ count '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[*]' 1
-    //@ is    '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].name' '"Item"'
-    //@ is    '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].binding.equality.type.primitive' '"bool"'
+    //@ count '$.index[?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[*]' 1
+    //@ is    '$.index[?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.path' '"Iterator"'
+    //@ count '$.index[?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[*]' 1
+    //@ is    '$.index[?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].name' '"Item"'
+    //@ is    '$.index[?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].binding.equality.type.primitive' '"bool"'
 
-    //@ set IntoIter = '$.index[*][?(@.docs=="type IntoIter")].id'
+    //@ set IntoIter = '$.index[?(@.docs=="type IntoIter")].id'
     /// type IntoIter
     type IntoIter = impl Iterator<Item = bool>;
 
-    //@ set into_iter = '$.index[*][?(@.docs=="fn into_iter")].id'
+    //@ set into_iter = '$.index[?(@.docs=="fn into_iter")].id'
     /// fn into_iter
     fn into_iter(self) -> Self::IntoIter {
         std::iter::repeat(true)
     }
 }
 
-//@ ismany '$.index[*][?(@.docs=="impl IntoIterator")].inner.impl.items[*]' $Item $IntoIter $into_iter
+//@ ismany '$.index[?(@.docs=="impl IntoIterator")].inner.impl.items[*]' $Item $IntoIter $into_iter
diff --git a/tests/rustdoc-json/impl-trait-precise-capturing.rs b/tests/rustdoc-json/impl-trait-precise-capturing.rs
index 52252560e6f..37adb514f55 100644
--- a/tests/rustdoc-json/impl-trait-precise-capturing.rs
+++ b/tests/rustdoc-json/impl-trait-precise-capturing.rs
@@ -1,4 +1,4 @@
-//@ is "$.index[*][?(@.name=='hello')].inner.function.sig.output.impl_trait[1].use[0]" \"\'a\"
-//@ is "$.index[*][?(@.name=='hello')].inner.function.sig.output.impl_trait[1].use[1]" \"T\"
-//@ is "$.index[*][?(@.name=='hello')].inner.function.sig.output.impl_trait[1].use[2]" \"N\"
+//@ is "$.index[?(@.name=='hello')].inner.function.sig.output.impl_trait[1].use[0].lifetime" \"\'a\"
+//@ is "$.index[?(@.name=='hello')].inner.function.sig.output.impl_trait[1].use[1].param" \"T\"
+//@ is "$.index[?(@.name=='hello')].inner.function.sig.output.impl_trait[1].use[2].param" \"N\"
 pub fn hello<'a, T, const N: usize>() -> impl Sized + use<'a, T, N> {}
diff --git a/tests/rustdoc-json/impls/auto.rs b/tests/rustdoc-json/impls/auto.rs
index f37dae4c1ed..f94f7338480 100644
--- a/tests/rustdoc-json/impls/auto.rs
+++ b/tests/rustdoc-json/impls/auto.rs
@@ -15,8 +15,8 @@ impl Foo {
 }
 
 // Testing spans, so all tests below code
-//@ is "$.index[*][?(@.docs=='has span')].span.begin" "[13, 0]"
-//@ is "$.index[*][?(@.docs=='has span')].span.end" "[15, 1]"
+//@ is "$.index[?(@.docs=='has span')].span.begin" "[13, 0]"
+//@ is "$.index[?(@.docs=='has span')].span.end" "[15, 1]"
 // FIXME: this doesn't work due to https://github.com/freestrings/jsonpath/issues/91
-// is "$.index[*][?(@.inner.impl.is_synthetic==true)].span" null
+// is "$.index[?(@.inner.impl.is_synthetic==true)].span" null
 pub struct Foo;
diff --git a/tests/rustdoc-json/impls/blanket_with_local.rs b/tests/rustdoc-json/impls/blanket_with_local.rs
index de92dafae0b..24ee6cf6670 100644
--- a/tests/rustdoc-json/impls/blanket_with_local.rs
+++ b/tests/rustdoc-json/impls/blanket_with_local.rs
@@ -1,11 +1,11 @@
 // Test for the ICE in rust/83718
 // A blanket impl plus a local type together shouldn't result in mismatched ID issues
 
-//@ has "$.index[*][?(@.name=='Load')]"
+//@ has "$.index[?(@.name=='Load')]"
 pub trait Load {
-    //@ has "$.index[*][?(@.name=='load')]"
+    //@ has "$.index[?(@.name=='load')]"
     fn load() {}
-    //@ has "$.index[*][?(@.name=='write')]"
+    //@ has "$.index[?(@.name=='write')]"
     fn write(self) {}
 }
 
@@ -14,5 +14,5 @@ impl<P> Load for P {
     fn write(self) {}
 }
 
-//@ has "$.index[*][?(@.name=='Wrapper')]"
+//@ has "$.index[?(@.name=='Wrapper')]"
 pub struct Wrapper {}
diff --git a/tests/rustdoc-json/impls/foreign_for_local.rs b/tests/rustdoc-json/impls/foreign_for_local.rs
index 1347f954cad..e46b158d802 100644
--- a/tests/rustdoc-json/impls/foreign_for_local.rs
+++ b/tests/rustdoc-json/impls/foreign_for_local.rs
@@ -3,16 +3,16 @@ extern crate foreign_trait;
 
 /// ForeignTrait id hack
 pub use foreign_trait::ForeignTrait as _;
-//@ set ForeignTrait = "$.index[*][?(@.docs=='ForeignTrait id hack')].inner.use.id"
+//@ set ForeignTrait = "$.index[?(@.docs=='ForeignTrait id hack')].inner.use.id"
 
 pub struct LocalStruct;
-//@ set LocalStruct = "$.index[*][?(@.name=='LocalStruct')].id"
+//@ set LocalStruct = "$.index[?(@.name=='LocalStruct')].id"
 
 /// foreign for local
 impl foreign_trait::ForeignTrait for LocalStruct {}
 
-//@ set impl = "$.index[*][?(@.docs=='foreign for local')].id"
-//@ is "$.index[*][?(@.docs=='foreign for local')].inner.impl.for.resolved_path.id" $LocalStruct
-//@ is "$.index[*][?(@.docs=='foreign for local')].inner.impl.trait.id" $ForeignTrait
+//@ set impl = "$.index[?(@.docs=='foreign for local')].id"
+//@ is "$.index[?(@.docs=='foreign for local')].inner.impl.for.resolved_path.id" $LocalStruct
+//@ is "$.index[?(@.docs=='foreign for local')].inner.impl.trait.id" $ForeignTrait
 
-//@ has "$.index[*][?(@.name=='LocalStruct')].inner.struct.impls[*]" $impl
+//@ has "$.index[?(@.name=='LocalStruct')].inner.struct.impls[*]" $impl
diff --git a/tests/rustdoc-json/impls/impl_item_visibility.rs b/tests/rustdoc-json/impls/impl_item_visibility.rs
index 293dd965804..680ea175d0b 100644
--- a/tests/rustdoc-json/impls/impl_item_visibility.rs
+++ b/tests/rustdoc-json/impls/impl_item_visibility.rs
@@ -4,13 +4,13 @@ pub struct Foo;
 impl Foo {
     fn baz() {}
 }
-//@ !has '$.index[*][?(@.docs=="impl Foo priv")]'
+//@ !has '$.index[?(@.docs=="impl Foo priv")]'
 
 /// impl Foo pub
 impl Foo {
     pub fn qux() {}
 }
-//@ is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"'
+//@ is '$.index[?(@.docs=="impl Foo pub")].visibility' '"default"'
 
 /// impl Foo hidden
 impl Foo {
@@ -18,4 +18,4 @@ impl Foo {
     pub fn __quazl() {}
 }
 // FIXME(#111564): Is this the right behaviour?
-//@ is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"'
+//@ is '$.index[?(@.docs=="impl Foo hidden")].visibility' '"default"'
diff --git a/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs b/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs
index 77ee717b03a..82d59b97b01 100644
--- a/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs
+++ b/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs
@@ -7,13 +7,13 @@ impl Foo {
     fn baz() {}
 }
 // FIXME(#111564): Is this the right behaviour?
-//@ is '$.index[*][?(@.docs=="impl Foo priv")].visibility' '"default"'
+//@ is '$.index[?(@.docs=="impl Foo priv")].visibility' '"default"'
 
 /// impl Foo pub
 impl Foo {
     pub fn qux() {}
 }
-//@ is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"'
+//@ is '$.index[?(@.docs=="impl Foo pub")].visibility' '"default"'
 
 /// impl Foo hidden
 impl Foo {
@@ -21,4 +21,4 @@ impl Foo {
     pub fn __quazl() {}
 }
 // FIXME(#111564): Is this the right behaviour?
-//@ is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"'
+//@ is '$.index[?(@.docs=="impl Foo hidden")].visibility' '"default"'
diff --git a/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs b/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs
index 80c47eee6cb..a3b145adb86 100644
--- a/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs
+++ b/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs
@@ -6,13 +6,13 @@ pub struct Foo;
 impl Foo {
     fn baz() {}
 }
-//@ is '$.index[*][?(@.docs=="impl Foo priv")].visibility' '"default"'
+//@ is '$.index[?(@.docs=="impl Foo priv")].visibility' '"default"'
 
 /// impl Foo pub
 impl Foo {
     pub fn qux() {}
 }
-//@ is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"'
+//@ is '$.index[?(@.docs=="impl Foo pub")].visibility' '"default"'
 
 /// impl Foo hidden
 impl Foo {
@@ -20,4 +20,4 @@ impl Foo {
     pub fn __quazl() {}
 }
 // FIXME(#111564): Is this the right behaviour?
-//@ is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"'
+//@ is '$.index[?(@.docs=="impl Foo hidden")].visibility' '"default"'
diff --git a/tests/rustdoc-json/impls/import_from_private.rs b/tests/rustdoc-json/impls/import_from_private.rs
index 32b9abb0717..02262d9b65f 100644
--- a/tests/rustdoc-json/impls/import_from_private.rs
+++ b/tests/rustdoc-json/impls/import_from_private.rs
@@ -1,20 +1,20 @@
 // https://github.com/rust-lang/rust/issues/100252
 
 mod bar {
-    //@ set baz = "$.index[*][?(@.name == 'Baz')].id"
+    //@ set baz = "$.index[?(@.name == 'Baz')].id"
     pub struct Baz;
-    //@ set impl = "$.index[*][?(@.docs == 'impl')].id"
+    //@ set impl = "$.index[?(@.docs == 'impl')].id"
     /// impl
     impl Baz {
-        //@ set doit = "$.index[*][?(@.name == 'doit')].id"
+        //@ set doit = "$.index[?(@.name == 'doit')].id"
         pub fn doit() {}
     }
 }
 
-//@ set import = "$.index[*][?(@.inner.use)].id"
+//@ set import = "$.index[?(@.inner.use)].id"
 pub use bar::Baz;
 
 //@ is "$.index[*].inner.module.items[*]" $import
 //@ is "$.index[*].inner.use.id" $baz
-//@ has "$.index[*][?(@.name == 'Baz')].inner.struct.impls[*]" $impl
-//@ is "$.index[*][?(@.docs=='impl')].inner.impl.items[*]" $doit
+//@ has "$.index[?(@.name == 'Baz')].inner.struct.impls[*]" $impl
+//@ is "$.index[?(@.docs=='impl')].inner.impl.items[*]" $doit
diff --git a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-2.rs b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-2.rs
index 4a313044920..54ec08135be 100644
--- a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-2.rs
+++ b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-2.rs
@@ -1,8 +1,8 @@
-//@ has "$.index[*][?(@.docs=='Here')]"
-//@ !has "$.index[*][?(@.docs=='Not Here')]"
-//@ !has "$.index[*][?(@.name == 'HiddenPubStruct')]"
-//@ has "$.index[*][?(@.name == 'NotHiddenPubStruct')]"
-//@ has "$.index[*][?(@.name=='PubTrait')]"
+//@ has "$.index[?(@.docs=='Here')]"
+//@ !has "$.index[?(@.docs=='Not Here')]"
+//@ !has "$.index[?(@.name == 'HiddenPubStruct')]"
+//@ has "$.index[?(@.name == 'NotHiddenPubStruct')]"
+//@ has "$.index[?(@.name=='PubTrait')]"
 pub trait PubTrait {}
 
 #[doc(hidden)]
diff --git a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs
index d3f2180f22c..afb29fd6316 100644
--- a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs
+++ b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs
@@ -1,8 +1,8 @@
 //@ compile-flags: --document-hidden-items
 
-//@ has "$.index[*][?(@.name == 'HiddenPubStruct')]"
-//@ has "$.index[*][?(@.inner.impl)]"
-//@ has "$.index[*][?(@.name=='PubTrait')]"
+//@ has "$.index[?(@.name == 'HiddenPubStruct')]"
+//@ has "$.index[?(@.inner.impl)]"
+//@ has "$.index[?(@.name=='PubTrait')]"
 pub trait PubTrait {}
 
 #[doc(hidden)]
diff --git a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id.rs b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id.rs
index a3f05818842..7fc3f70fe5a 100644
--- a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id.rs
+++ b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id.rs
@@ -1,21 +1,21 @@
-//@ has "$.index[*][?(@.name=='PubTrait')]"
+//@ has "$.index[?(@.name=='PubTrait')]"
 pub trait PubTrait {}
 
 #[doc(hidden)]
 pub mod hidden {
-    //@ !has "$.index[*][?(@.name == 'HiddenPubStruct')]"
+    //@ !has "$.index[?(@.name == 'HiddenPubStruct')]"
     pub struct HiddenPubStruct;
 
-    //@ !has "$.index[*][?(@.docs == 'Not Here')]"
+    //@ !has "$.index[?(@.docs == 'Not Here')]"
     /// Not Here
     impl crate::PubTrait for HiddenPubStruct {}
 }
 
 pub mod not_hidden {
-    //@ has "$.index[*][?(@.name == 'NotHiddenPubStruct')]"
+    //@ has "$.index[?(@.name == 'NotHiddenPubStruct')]"
     pub struct NotHiddenPubStruct;
 
-    //@ has "$.index[*][?(@.docs == 'Here')]"
+    //@ has "$.index[?(@.docs == 'Here')]"
     /// Here
     impl crate::PubTrait for NotHiddenPubStruct {}
 }
diff --git a/tests/rustdoc-json/impls/local_for_foreign.rs b/tests/rustdoc-json/impls/local_for_foreign.rs
index cd89c475348..86c72a580b2 100644
--- a/tests/rustdoc-json/impls/local_for_foreign.rs
+++ b/tests/rustdoc-json/impls/local_for_foreign.rs
@@ -3,16 +3,16 @@ extern crate foreign_struct;
 
 /// ForeignStruct id hack
 pub use foreign_struct::ForeignStruct as _;
-//@ set ForeignStruct = "$.index[*][?(@.docs=='ForeignStruct id hack')].inner.use.id"
+//@ set ForeignStruct = "$.index[?(@.docs=='ForeignStruct id hack')].inner.use.id"
 
 pub trait LocalTrait {}
-//@ set LocalTrait = "$.index[*][?(@.name=='LocalTrait')].id"
+//@ set LocalTrait = "$.index[?(@.name=='LocalTrait')].id"
 
 /// local for foreign
 impl LocalTrait for foreign_struct::ForeignStruct {}
 
-//@ set impl = "$.index[*][?(@.docs=='local for foreign')].id"
-//@ is "$.index[*][?(@.docs=='local for foreign')].inner.impl.trait.id" $LocalTrait
-//@ is "$.index[*][?(@.docs=='local for foreign')].inner.impl.for.resolved_path.id" $ForeignStruct
+//@ set impl = "$.index[?(@.docs=='local for foreign')].id"
+//@ is "$.index[?(@.docs=='local for foreign')].inner.impl.trait.id" $LocalTrait
+//@ is "$.index[?(@.docs=='local for foreign')].inner.impl.for.resolved_path.id" $ForeignStruct
 
-//@ is "$.index[*][?(@.name=='LocalTrait')].inner.trait.implementations[*]" $impl
+//@ is "$.index[?(@.name=='LocalTrait')].inner.trait.implementations[*]" $impl
diff --git a/tests/rustdoc-json/impls/local_for_local.rs b/tests/rustdoc-json/impls/local_for_local.rs
index 1d141d6e4de..876a7912f09 100644
--- a/tests/rustdoc-json/impls/local_for_local.rs
+++ b/tests/rustdoc-json/impls/local_for_local.rs
@@ -1,12 +1,12 @@
-//@ set struct = "$.index[*][?(@.name=='Struct')].id"
+//@ set struct = "$.index[?(@.name=='Struct')].id"
 pub struct Struct;
-//@ set trait = "$.index[*][?(@.name=='Trait')].id"
+//@ set trait = "$.index[?(@.name=='Trait')].id"
 pub trait Trait {}
-//@ set impl = "$.index[*][?(@.docs=='impl')].id"
+//@ set impl = "$.index[?(@.docs=='impl')].id"
 /// impl
 impl Trait for Struct {}
 
-//@ has "$.index[*][?(@.name=='Struct')].inner.struct.impls[*]" $impl
-//@ is "$.index[*][?(@.name=='Trait')].inner.trait.implementations[*]" $impl
-//@ is "$.index[*][?(@.docs=='impl')].inner.impl.trait.id" $trait
-//@ is "$.index[*][?(@.docs=='impl')].inner.impl.for.resolved_path.id" $struct
+//@ has "$.index[?(@.name=='Struct')].inner.struct.impls[*]" $impl
+//@ is "$.index[?(@.name=='Trait')].inner.trait.implementations[*]" $impl
+//@ is "$.index[?(@.docs=='impl')].inner.impl.trait.id" $trait
+//@ is "$.index[?(@.docs=='impl')].inner.impl.for.resolved_path.id" $struct
diff --git a/tests/rustdoc-json/impls/local_for_local_primitive.rs b/tests/rustdoc-json/impls/local_for_local_primitive.rs
index 8c1eb044eae..859c0cb8ec8 100644
--- a/tests/rustdoc-json/impls/local_for_local_primitive.rs
+++ b/tests/rustdoc-json/impls/local_for_local_primitive.rs
@@ -1,18 +1,18 @@
 #![feature(rustc_attrs)]
 
-//@ set Local = "$.index[*][?(@.name=='Local')].id"
+//@ set Local = "$.index[?(@.name=='Local')].id"
 pub trait Local {}
 
-//@ is "$.index[*][?(@.docs=='Local for bool')].inner.impl.trait.id" $Local
-//@ is "$.index[*][?(@.docs=='Local for bool')].inner.impl.for.primitive" '"bool"'
+//@ is "$.index[?(@.docs=='Local for bool')].inner.impl.trait.id" $Local
+//@ is "$.index[?(@.docs=='Local for bool')].inner.impl.for.primitive" '"bool"'
 /// Local for bool
 impl Local for bool {}
 
-//@ set impl =  "$.index[*][?(@.docs=='Local for bool')].id"
-//@ is "$.index[*][?(@.name=='Local')].inner.trait.implementations[*]" $impl
+//@ set impl =  "$.index[?(@.docs=='Local for bool')].id"
+//@ is "$.index[?(@.name=='Local')].inner.trait.implementations[*]" $impl
 
 // FIXME(#101695): Test bool's `impls` include "Local for bool"
-//@ has "$.index[*][?(@.name=='bool')]"
+//@ has "$.index[?(@.name=='bool')]"
 #[rustc_doc_primitive = "bool"]
 /// Boolean docs
 mod prim_bool {}
diff --git a/tests/rustdoc-json/impls/local_for_primitive.rs b/tests/rustdoc-json/impls/local_for_primitive.rs
index 56d930ca5c4..a5ab3ec8a1b 100644
--- a/tests/rustdoc-json/impls/local_for_primitive.rs
+++ b/tests/rustdoc-json/impls/local_for_primitive.rs
@@ -1,7 +1,7 @@
-//@ set local = "$.index[*][?(@.name=='Local')]"
+//@ set local = "$.index[?(@.name=='Local')]"
 pub trait Local {}
 
-//@ set impl = "$.index[*][?(@.docs=='local for bool')].id"
-//@ is "$.index[*][?(@.name=='Local')].inner.trait.implementations[*]" $impl
+//@ set impl = "$.index[?(@.docs=='local for bool')].id"
+//@ is "$.index[?(@.name=='Local')].inner.trait.implementations[*]" $impl
 /// local for bool
 impl Local for bool {}
diff --git a/tests/rustdoc-json/impls/pub_for_hidden_private.rs b/tests/rustdoc-json/impls/pub_for_hidden_private.rs
index 261ffbfeb4a..eb89219022c 100644
--- a/tests/rustdoc-json/impls/pub_for_hidden_private.rs
+++ b/tests/rustdoc-json/impls/pub_for_hidden_private.rs
@@ -5,6 +5,6 @@ pub trait TheTrait {}
 #[doc(hidden)]
 struct Value {}
 
-//@ has '$.index[*][?(@.docs=="THE IMPL")]'
+//@ has '$.index[?(@.docs=="THE IMPL")]'
 /// THE IMPL
 impl TheTrait for Value {}
diff --git a/tests/rustdoc-json/impls/trait-for-dyn-trait.rs b/tests/rustdoc-json/impls/trait-for-dyn-trait.rs
index 0fbb4df0028..17cb07f3571 100644
--- a/tests/rustdoc-json/impls/trait-for-dyn-trait.rs
+++ b/tests/rustdoc-json/impls/trait-for-dyn-trait.rs
@@ -1,15 +1,15 @@
-//@ set t1 = '$.index[*][?(@.name=="T1")].id'
+//@ set t1 = '$.index[?(@.name=="T1")].id'
 pub trait T1 {}
 
-//@ set t2 = '$.index[*][?(@.name=="T2")].id'
+//@ set t2 = '$.index[?(@.name=="T2")].id'
 pub trait T2 {}
 
 /// Fun impl
 impl T1 for dyn T2 {}
 
-//@ set impl = '$.index[*][?(@.docs=="Fun impl")].id'
-//@ is '$.index[*][?(@.name=="T1")].inner.trait.implementations[*]' $impl
-//@ is '$.index[*][?(@.name=="T2")].inner.trait.implementations' []
+//@ set impl = '$.index[?(@.docs=="Fun impl")].id'
+//@ is '$.index[?(@.name=="T1")].inner.trait.implementations[*]' $impl
+//@ is '$.index[?(@.name=="T2")].inner.trait.implementations' []
 
-//@ is '$.index[*][?(@.docs=="Fun impl")].inner.impl.trait.id' $t1
-//@ is '$.index[*][?(@.docs=="Fun impl")].inner.impl.for.dyn_trait.traits[*].trait.id' $t2
+//@ is '$.index[?(@.docs=="Fun impl")].inner.impl.trait.id' $t1
+//@ is '$.index[?(@.docs=="Fun impl")].inner.impl.for.dyn_trait.traits[*].trait.id' $t2
diff --git a/tests/rustdoc-json/intra-doc-links/foreign_variant.rs b/tests/rustdoc-json/intra-doc-links/foreign_variant.rs
index 251c4884fbb..b3e6f51d23c 100644
--- a/tests/rustdoc-json/intra-doc-links/foreign_variant.rs
+++ b/tests/rustdoc-json/intra-doc-links/foreign_variant.rs
@@ -8,6 +8,6 @@ pub struct Local;
 /// local impl
 impl enum_variant_in_trait_method::Trait for Local {}
 
-//@ !has "$.index[*][?(@.name == 'Trait')]"
-//@ !has "$.index[*][?(@.name == 'method')]"
-//@ count "$.index[*][?(@.docs == 'local impl')].inner.items[*]" 0
+//@ !has "$.index[?(@.name == 'Trait')]"
+//@ !has "$.index[?(@.name == 'method')]"
+//@ count "$.index[?(@.docs == 'local impl')].inner.items[*]" 0
diff --git a/tests/rustdoc-json/intra-doc-links/non_page.rs b/tests/rustdoc-json/intra-doc-links/non_page.rs
index 00987d93c1e..e2d00ee64e9 100644
--- a/tests/rustdoc-json/intra-doc-links/non_page.rs
+++ b/tests/rustdoc-json/intra-doc-links/non_page.rs
@@ -7,17 +7,17 @@
 //! [`Trait::ASSOC_CONST`]
 //! [`Trait::method`]
 
-//@ set struct_field = "$.index[*][?(@.name=='struct_field')].id"
-//@ set Variant = "$.index[*][?(@.name=='Variant')].id"
-//@ set AssocType = "$.index[*][?(@.name=='AssocType')].id"
-//@ set ASSOC_CONST = "$.index[*][?(@.name=='ASSOC_CONST')].id"
-//@ set method = "$.index[*][?(@.name=='method')].id"
+//@ set struct_field = "$.index[?(@.name=='struct_field')].id"
+//@ set Variant = "$.index[?(@.name=='Variant')].id"
+//@ set AssocType = "$.index[?(@.name=='AssocType')].id"
+//@ set ASSOC_CONST = "$.index[?(@.name=='ASSOC_CONST')].id"
+//@ set method = "$.index[?(@.name=='method')].id"
 
-//@ is "$.index[*][?(@.name=='non_page')].links['`Struct::struct_field`']" $struct_field
-//@ is "$.index[*][?(@.name=='non_page')].links['`Enum::Variant`']" $Variant
-//@ is "$.index[*][?(@.name=='non_page')].links['`Trait::AssocType`']" $AssocType
-//@ is "$.index[*][?(@.name=='non_page')].links['`Trait::ASSOC_CONST`']" $ASSOC_CONST
-//@ is "$.index[*][?(@.name=='non_page')].links['`Trait::method`']" $method
+//@ is "$.index[?(@.name=='non_page')].links['`Struct::struct_field`']" $struct_field
+//@ is "$.index[?(@.name=='non_page')].links['`Enum::Variant`']" $Variant
+//@ is "$.index[?(@.name=='non_page')].links['`Trait::AssocType`']" $AssocType
+//@ is "$.index[?(@.name=='non_page')].links['`Trait::ASSOC_CONST`']" $ASSOC_CONST
+//@ is "$.index[?(@.name=='non_page')].links['`Trait::method`']" $method
 
 pub struct Struct {
     pub struct_field: i32,
diff --git a/tests/rustdoc-json/intra-doc-links/user_written.rs b/tests/rustdoc-json/intra-doc-links/user_written.rs
index c3f9df95a8f..97a643490e6 100644
--- a/tests/rustdoc-json/intra-doc-links/user_written.rs
+++ b/tests/rustdoc-json/intra-doc-links/user_written.rs
@@ -4,5 +4,5 @@
 /// To test rustdoc json
 pub fn foo() {}
 
-//@ set foo = "$.index[*][?(@.name=='foo')].id"
-//@ is "$.index[*][?(@.name=='user_written')].links['foo#reasons']" $foo
+//@ set foo = "$.index[?(@.name=='foo')].id"
+//@ is "$.index[?(@.name=='user_written')].links['foo#reasons']" $foo
diff --git a/tests/rustdoc-json/keyword.rs b/tests/rustdoc-json/keyword.rs
index 8a2130f1978..566b2c68bd5 100644
--- a/tests/rustdoc-json/keyword.rs
+++ b/tests/rustdoc-json/keyword.rs
@@ -6,15 +6,15 @@
 #![feature(rustdoc_internals)]
 #![no_std]
 
-//@ !has "$.index[*][?(@.name=='match')]"
-//@ has "$.index[*][?(@.name=='foo')]"
+//@ !has "$.index[?(@.name=='match')]"
+//@ has "$.index[?(@.name=='foo')]"
 
 #[doc(keyword = "match")]
 /// this is a test!
 pub mod foo {}
 
-//@ !has "$.index[*][?(@.name=='break')]"
-//@ !has "$.index[*][?(@.name=='bar')]"
+//@ !has "$.index[?(@.name=='break')]"
+//@ !has "$.index[?(@.name=='bar')]"
 #[doc(keyword = "break")]
 /// hello
 mod bar {}
diff --git a/tests/rustdoc-json/keyword_private.rs b/tests/rustdoc-json/keyword_private.rs
index 2a13bf10d5d..fea546c9fb6 100644
--- a/tests/rustdoc-json/keyword_private.rs
+++ b/tests/rustdoc-json/keyword_private.rs
@@ -3,18 +3,18 @@
 //@ compile-flags: --document-private-items
 #![feature(rustdoc_internals)]
 
-//@ !has "$.index[*][?(@.name=='match')]"
-//@ has  "$.index[*][?(@.name=='foo')]"
-//@ is   "$.index[*][?(@.name=='foo')].attrs" '["#[doc(keyword = \"match\")]"]'
-//@ is   "$.index[*][?(@.name=='foo')].docs" '"this is a test!"'
+//@ !has "$.index[?(@.name=='match')]"
+//@ has  "$.index[?(@.name=='foo')]"
+//@ is   "$.index[?(@.name=='foo')].attrs" '["#[doc(keyword = \"match\")]"]'
+//@ is   "$.index[?(@.name=='foo')].docs" '"this is a test!"'
 #[doc(keyword = "match")]
 /// this is a test!
 pub mod foo {}
 
-//@ !has "$.index[*][?(@.name=='break')]"
-//@ has "$.index[*][?(@.name=='bar')]"
-//@ is   "$.index[*][?(@.name=='bar')].attrs" '["#[doc(keyword = \"break\")]"]'
-//@ is   "$.index[*][?(@.name=='bar')].docs" '"hello"'
+//@ !has "$.index[?(@.name=='break')]"
+//@ has "$.index[?(@.name=='bar')]"
+//@ is   "$.index[?(@.name=='bar')].attrs" '["#[doc(keyword = \"break\")]"]'
+//@ is   "$.index[?(@.name=='bar')].docs" '"hello"'
 #[doc(keyword = "break")]
 /// hello
 mod bar {}
diff --git a/tests/rustdoc-json/lifetime/longest.rs b/tests/rustdoc-json/lifetime/longest.rs
index 2d4e098d696..50cf084c398 100644
--- a/tests/rustdoc-json/lifetime/longest.rs
+++ b/tests/rustdoc-json/lifetime/longest.rs
@@ -1,24 +1,24 @@
-//@ is "$.index[*][?(@.name=='longest')].inner.function.generics.params[0].name"  \"\'a\"
-//@ is "$.index[*][?(@.name=='longest')].inner.function.generics.params[0].kind"  '{"lifetime": {"outlives": []}}'
-//@ is "$.index[*][?(@.name=='longest')].inner.function.generics.params[0].kind"  '{"lifetime": {"outlives": []}}'
-//@ count "$.index[*][?(@.name=='longest')].inner.function.generics.params[*]" 1
-//@ is "$.index[*][?(@.name=='longest')].inner.function.generics.where_predicates" []
+//@ is "$.index[?(@.name=='longest')].inner.function.generics.params[0].name"  \"\'a\"
+//@ is "$.index[?(@.name=='longest')].inner.function.generics.params[0].kind"  '{"lifetime": {"outlives": []}}'
+//@ is "$.index[?(@.name=='longest')].inner.function.generics.params[0].kind"  '{"lifetime": {"outlives": []}}'
+//@ count "$.index[?(@.name=='longest')].inner.function.generics.params[*]" 1
+//@ is "$.index[?(@.name=='longest')].inner.function.generics.where_predicates" []
 
-//@ count "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[*]" 2
-//@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[0][0]" '"l"'
-//@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[1][0]" '"r"'
+//@ count "$.index[?(@.name=='longest')].inner.function.sig.inputs[*]" 2
+//@ is "$.index[?(@.name=='longest')].inner.function.sig.inputs[0][0]" '"l"'
+//@ is "$.index[?(@.name=='longest')].inner.function.sig.inputs[1][0]" '"r"'
 
-//@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[0][1].borrowed_ref.lifetime" \"\'a\"
-//@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable" false
-//@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[0][1].borrowed_ref.type.primitive" \"str\"
+//@ is "$.index[?(@.name=='longest')].inner.function.sig.inputs[0][1].borrowed_ref.lifetime" \"\'a\"
+//@ is "$.index[?(@.name=='longest')].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable" false
+//@ is "$.index[?(@.name=='longest')].inner.function.sig.inputs[0][1].borrowed_ref.type.primitive" \"str\"
 
-//@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[1][1].borrowed_ref.lifetime" \"\'a\"
-//@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[1][1].borrowed_ref.is_mutable" false
-//@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[1][1].borrowed_ref.type.primitive" \"str\"
+//@ is "$.index[?(@.name=='longest')].inner.function.sig.inputs[1][1].borrowed_ref.lifetime" \"\'a\"
+//@ is "$.index[?(@.name=='longest')].inner.function.sig.inputs[1][1].borrowed_ref.is_mutable" false
+//@ is "$.index[?(@.name=='longest')].inner.function.sig.inputs[1][1].borrowed_ref.type.primitive" \"str\"
 
-//@ is "$.index[*][?(@.name=='longest')].inner.function.sig.output.borrowed_ref.lifetime" \"\'a\"
-//@ is "$.index[*][?(@.name=='longest')].inner.function.sig.output.borrowed_ref.is_mutable" false
-//@ is "$.index[*][?(@.name=='longest')].inner.function.sig.output.borrowed_ref.type.primitive" \"str\"
+//@ is "$.index[?(@.name=='longest')].inner.function.sig.output.borrowed_ref.lifetime" \"\'a\"
+//@ is "$.index[?(@.name=='longest')].inner.function.sig.output.borrowed_ref.is_mutable" false
+//@ is "$.index[?(@.name=='longest')].inner.function.sig.output.borrowed_ref.type.primitive" \"str\"
 
 pub fn longest<'a>(l: &'a str, r: &'a str) -> &'a str {
     if l.len() > r.len() { l } else { r }
diff --git a/tests/rustdoc-json/lifetime/outlives.rs b/tests/rustdoc-json/lifetime/outlives.rs
index 257e43985ac..f191b386c6c 100644
--- a/tests/rustdoc-json/lifetime/outlives.rs
+++ b/tests/rustdoc-json/lifetime/outlives.rs
@@ -1,16 +1,16 @@
-//@ count "$.index[*][?(@.name=='foo')].inner.function.generics.params[*]" 3
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates" []
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.params[0].name" \"\'a\"
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.params[1].name" \"\'b\"
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.params[2].name" '"T"'
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.params[0].kind.lifetime.outlives" []
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.params[1].kind.lifetime.outlives" [\"\'a\"]
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.params[2].kind.type.default" null
-//@ count "$.index[*][?(@.name=='foo')].inner.function.generics.params[2].kind.type.bounds[*]" 1
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.params[2].kind.type.bounds[0].outlives" \"\'b\"
-//@ is "$.index[*][?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.lifetime" \"\'a\"
-//@ is "$.index[*][?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable" false
-//@ is "$.index[*][?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.type.borrowed_ref.lifetime" \"\'b\"
-//@ is "$.index[*][?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.type.borrowed_ref.is_mutable" false
-//@ is "$.index[*][?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.type.borrowed_ref.type.generic" \"T\"
+//@ count "$.index[?(@.name=='foo')].inner.function.generics.params[*]" 3
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.where_predicates" []
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.params[0].name" \"\'a\"
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.params[1].name" \"\'b\"
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.params[2].name" '"T"'
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.params[0].kind.lifetime.outlives" []
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.params[1].kind.lifetime.outlives" [\"\'a\"]
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.params[2].kind.type.default" null
+//@ count "$.index[?(@.name=='foo')].inner.function.generics.params[2].kind.type.bounds[*]" 1
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.params[2].kind.type.bounds[0].outlives" \"\'b\"
+//@ is "$.index[?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.lifetime" \"\'a\"
+//@ is "$.index[?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable" false
+//@ is "$.index[?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.type.borrowed_ref.lifetime" \"\'b\"
+//@ is "$.index[?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.type.borrowed_ref.is_mutable" false
+//@ is "$.index[?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.type.borrowed_ref.type.generic" \"T\"
 pub fn foo<'a, 'b: 'a, T: 'b>(_: &'a &'b T) {}
diff --git a/tests/rustdoc-json/lifetime/outlives_in_param.rs b/tests/rustdoc-json/lifetime/outlives_in_param.rs
index 55ff5250541..dc9f57ff8a1 100644
--- a/tests/rustdoc-json/lifetime/outlives_in_param.rs
+++ b/tests/rustdoc-json/lifetime/outlives_in_param.rs
@@ -1,6 +1,6 @@
-//@ count '$.index[*][?(@.name=="outlives")].inner.function.generics.params[*]' 2
-//@ is    '$.index[*][?(@.name=="outlives")].inner.function.generics.params[0].name' \"\'a\"
-//@ is    '$.index[*][?(@.name=="outlives")].inner.function.generics.params[0].kind.lifetime.outlives' []
-//@ is    '$.index[*][?(@.name=="outlives")].inner.function.generics.params[1].name' '"T"'
-//@ is    '$.index[*][?(@.name=="outlives")].inner.function.generics.params[1].kind.type.bounds' '[{"outlives": "'\''a"}]'
+//@ count '$.index[?(@.name=="outlives")].inner.function.generics.params[*]' 2
+//@ is    '$.index[?(@.name=="outlives")].inner.function.generics.params[0].name' \"\'a\"
+//@ is    '$.index[?(@.name=="outlives")].inner.function.generics.params[0].kind.lifetime.outlives' []
+//@ is    '$.index[?(@.name=="outlives")].inner.function.generics.params[1].name' '"T"'
+//@ is    '$.index[?(@.name=="outlives")].inner.function.generics.params[1].kind.type.bounds' '[{"outlives": "'\''a"}]'
 pub fn outlives<'a, T: 'a>() {}
diff --git a/tests/rustdoc-json/lifetime/outlives_in_where.rs b/tests/rustdoc-json/lifetime/outlives_in_where.rs
index 5158ff118a0..48faf8ff830 100644
--- a/tests/rustdoc-json/lifetime/outlives_in_where.rs
+++ b/tests/rustdoc-json/lifetime/outlives_in_where.rs
@@ -1,20 +1,20 @@
-//@ is '$.index[*][?(@.name=="on_lifetimes")].inner.function.generics.where_predicates' '[{"lifetime_predicate": {"lifetime": "'\''all", "outlives": ["'\''a", "'\''b", "'\''c"]}}]'
+//@ is '$.index[?(@.name=="on_lifetimes")].inner.function.generics.where_predicates' '[{"lifetime_predicate": {"lifetime": "'\''all", "outlives": ["'\''a", "'\''b", "'\''c"]}}]'
 pub fn on_lifetimes<'a, 'b, 'c, 'all>()
 where
     'all: 'a + 'b + 'c,
 {
 }
 
-//@ count '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[*]' 2
-//@ is    '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[0].name' \"\'a\"
-//@ is    '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[0].kind.lifetime.outlives' []
-//@ is    '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[1].name' '"T"'
-//@ is    '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[1].kind.type.bounds' []
-//@ is    '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[1].kind.type.bounds' []
-//@ count '$.index[*][?(@.name=="on_trait")].inner.function.generics.where_predicates[*]' 1
-//@ is    '$.index[*][?(@.name=="on_trait")].inner.function.generics.where_predicates[0].bound_predicate.type.generic' '"T"'
-//@ count '$.index[*][?(@.name=="on_trait")].inner.function.generics.where_predicates[0].bound_predicate.bounds[*]' 1
-//@ is    '$.index[*][?(@.name=="on_trait")].inner.function.generics.where_predicates[0].bound_predicate.bounds[0].outlives' \"\'a\"
+//@ count '$.index[?(@.name=="on_trait")].inner.function.generics.params[*]' 2
+//@ is    '$.index[?(@.name=="on_trait")].inner.function.generics.params[0].name' \"\'a\"
+//@ is    '$.index[?(@.name=="on_trait")].inner.function.generics.params[0].kind.lifetime.outlives' []
+//@ is    '$.index[?(@.name=="on_trait")].inner.function.generics.params[1].name' '"T"'
+//@ is    '$.index[?(@.name=="on_trait")].inner.function.generics.params[1].kind.type.bounds' []
+//@ is    '$.index[?(@.name=="on_trait")].inner.function.generics.params[1].kind.type.bounds' []
+//@ count '$.index[?(@.name=="on_trait")].inner.function.generics.where_predicates[*]' 1
+//@ is    '$.index[?(@.name=="on_trait")].inner.function.generics.where_predicates[0].bound_predicate.type.generic' '"T"'
+//@ count '$.index[?(@.name=="on_trait")].inner.function.generics.where_predicates[0].bound_predicate.bounds[*]' 1
+//@ is    '$.index[?(@.name=="on_trait")].inner.function.generics.where_predicates[0].bound_predicate.bounds[0].outlives' \"\'a\"
 pub fn on_trait<'a, T>()
 where
     T: 'a,
diff --git a/tests/rustdoc-json/methods/abi.rs b/tests/rustdoc-json/methods/abi.rs
index dac02a6ce3c..fa2387ddf67 100644
--- a/tests/rustdoc-json/methods/abi.rs
+++ b/tests/rustdoc-json/methods/abi.rs
@@ -1,50 +1,50 @@
 #![feature(abi_vectorcall)]
 
-//@ has "$.index[*][?(@.name=='Foo')]"
+//@ has "$.index[?(@.name=='Foo')]"
 pub struct Foo;
 
 impl Foo {
-    //@ is "$.index[*][?(@.name=='abi_rust')].inner.function.header.abi" \"Rust\"
+    //@ is "$.index[?(@.name=='abi_rust')].inner.function.header.abi" \"Rust\"
     pub fn abi_rust() {}
 
-    //@ is "$.index[*][?(@.name=='abi_c')].inner.function.header.abi" '{"C": {"unwind": false}}'
+    //@ is "$.index[?(@.name=='abi_c')].inner.function.header.abi" '{"C": {"unwind": false}}'
     pub extern "C" fn abi_c() {}
 
-    //@ is "$.index[*][?(@.name=='abi_system')].inner.function.header.abi" '{"System": {"unwind": false}}'
+    //@ is "$.index[?(@.name=='abi_system')].inner.function.header.abi" '{"System": {"unwind": false}}'
     pub extern "system" fn abi_system() {}
 
-    //@ is "$.index[*][?(@.name=='abi_c_unwind')].inner.function.header.abi" '{"C": {"unwind": true}}'
+    //@ is "$.index[?(@.name=='abi_c_unwind')].inner.function.header.abi" '{"C": {"unwind": true}}'
     pub extern "C-unwind" fn abi_c_unwind() {}
 
-    //@ is "$.index[*][?(@.name=='abi_system_unwind')].inner.function.header.abi" '{"System": {"unwind": true}}'
+    //@ is "$.index[?(@.name=='abi_system_unwind')].inner.function.header.abi" '{"System": {"unwind": true}}'
     pub extern "system-unwind" fn abi_system_unwind() {}
 
-    //@ is "$.index[*][?(@.name=='abi_vectorcall')].inner.function.header.abi.Other" '"\"vectorcall\""'
+    //@ is "$.index[?(@.name=='abi_vectorcall')].inner.function.header.abi.Other" '"\"vectorcall\""'
     pub extern "vectorcall" fn abi_vectorcall() {}
 
-    //@ is "$.index[*][?(@.name=='abi_vectorcall_unwind')].inner.function.header.abi.Other" '"\"vectorcall-unwind\""'
+    //@ is "$.index[?(@.name=='abi_vectorcall_unwind')].inner.function.header.abi.Other" '"\"vectorcall-unwind\""'
     pub extern "vectorcall-unwind" fn abi_vectorcall_unwind() {}
 }
 
 pub trait Bar {
-    //@ is "$.index[*][?(@.name=='trait_abi_rust')].inner.function.header.abi" \"Rust\"
+    //@ is "$.index[?(@.name=='trait_abi_rust')].inner.function.header.abi" \"Rust\"
     fn trait_abi_rust() {}
 
-    //@ is "$.index[*][?(@.name=='trait_abi_c')].inner.function.header.abi" '{"C": {"unwind": false}}'
+    //@ is "$.index[?(@.name=='trait_abi_c')].inner.function.header.abi" '{"C": {"unwind": false}}'
     extern "C" fn trait_abi_c() {}
 
-    //@ is "$.index[*][?(@.name=='trait_abi_system')].inner.function.header.abi" '{"System": {"unwind": false}}'
+    //@ is "$.index[?(@.name=='trait_abi_system')].inner.function.header.abi" '{"System": {"unwind": false}}'
     extern "system" fn trait_abi_system() {}
 
-    //@ is "$.index[*][?(@.name=='trait_abi_c_unwind')].inner.function.header.abi" '{"C": {"unwind": true}}'
+    //@ is "$.index[?(@.name=='trait_abi_c_unwind')].inner.function.header.abi" '{"C": {"unwind": true}}'
     extern "C-unwind" fn trait_abi_c_unwind() {}
 
-    //@ is "$.index[*][?(@.name=='trait_abi_system_unwind')].inner.function.header.abi" '{"System": {"unwind": true}}'
+    //@ is "$.index[?(@.name=='trait_abi_system_unwind')].inner.function.header.abi" '{"System": {"unwind": true}}'
     extern "system-unwind" fn trait_abi_system_unwind() {}
 
-    //@ is "$.index[*][?(@.name=='trait_abi_vectorcall')].inner.function.header.abi.Other" '"\"vectorcall\""'
+    //@ is "$.index[?(@.name=='trait_abi_vectorcall')].inner.function.header.abi.Other" '"\"vectorcall\""'
     extern "vectorcall" fn trait_abi_vectorcall() {}
 
-    //@ is "$.index[*][?(@.name=='trait_abi_vectorcall_unwind')].inner.function.header.abi.Other" '"\"vectorcall-unwind\""'
+    //@ is "$.index[?(@.name=='trait_abi_vectorcall_unwind')].inner.function.header.abi.Other" '"\"vectorcall-unwind\""'
     extern "vectorcall-unwind" fn trait_abi_vectorcall_unwind() {}
 }
diff --git a/tests/rustdoc-json/methods/qualifiers.rs b/tests/rustdoc-json/methods/qualifiers.rs
index ba7c2e60936..b1d9f0c1af3 100644
--- a/tests/rustdoc-json/methods/qualifiers.rs
+++ b/tests/rustdoc-json/methods/qualifiers.rs
@@ -3,34 +3,34 @@
 pub struct Foo;
 
 impl Foo {
-    //@ is "$.index[*][?(@.name=='const_meth')].inner.function.header.is_async" false
-    //@ is "$.index[*][?(@.name=='const_meth')].inner.function.header.is_const"  true
-    //@ is "$.index[*][?(@.name=='const_meth')].inner.function.header.is_unsafe" false
+    //@ is "$.index[?(@.name=='const_meth')].inner.function.header.is_async" false
+    //@ is "$.index[?(@.name=='const_meth')].inner.function.header.is_const"  true
+    //@ is "$.index[?(@.name=='const_meth')].inner.function.header.is_unsafe" false
     pub const fn const_meth() {}
 
-    //@ is "$.index[*][?(@.name=='nothing_meth')].inner.function.header.is_async"  false
-    //@ is "$.index[*][?(@.name=='nothing_meth')].inner.function.header.is_const"  false
-    //@ is "$.index[*][?(@.name=='nothing_meth')].inner.function.header.is_unsafe" false
+    //@ is "$.index[?(@.name=='nothing_meth')].inner.function.header.is_async"  false
+    //@ is "$.index[?(@.name=='nothing_meth')].inner.function.header.is_const"  false
+    //@ is "$.index[?(@.name=='nothing_meth')].inner.function.header.is_unsafe" false
     pub fn nothing_meth() {}
 
-    //@ is "$.index[*][?(@.name=='unsafe_meth')].inner.function.header.is_async"  false
-    //@ is "$.index[*][?(@.name=='unsafe_meth')].inner.function.header.is_const"  false
-    //@ is "$.index[*][?(@.name=='unsafe_meth')].inner.function.header.is_unsafe" true
+    //@ is "$.index[?(@.name=='unsafe_meth')].inner.function.header.is_async"  false
+    //@ is "$.index[?(@.name=='unsafe_meth')].inner.function.header.is_const"  false
+    //@ is "$.index[?(@.name=='unsafe_meth')].inner.function.header.is_unsafe" true
     pub unsafe fn unsafe_meth() {}
 
-    //@ is "$.index[*][?(@.name=='async_meth')].inner.function.header.is_async"  true
-    //@ is "$.index[*][?(@.name=='async_meth')].inner.function.header.is_const"  false
-    //@ is "$.index[*][?(@.name=='async_meth')].inner.function.header.is_unsafe" false
+    //@ is "$.index[?(@.name=='async_meth')].inner.function.header.is_async"  true
+    //@ is "$.index[?(@.name=='async_meth')].inner.function.header.is_const"  false
+    //@ is "$.index[?(@.name=='async_meth')].inner.function.header.is_unsafe" false
     pub async fn async_meth() {}
 
-    //@ is "$.index[*][?(@.name=='async_unsafe_meth')].inner.function.header.is_async"  true
-    //@ is "$.index[*][?(@.name=='async_unsafe_meth')].inner.function.header.is_const"  false
-    //@ is "$.index[*][?(@.name=='async_unsafe_meth')].inner.function.header.is_unsafe" true
+    //@ is "$.index[?(@.name=='async_unsafe_meth')].inner.function.header.is_async"  true
+    //@ is "$.index[?(@.name=='async_unsafe_meth')].inner.function.header.is_const"  false
+    //@ is "$.index[?(@.name=='async_unsafe_meth')].inner.function.header.is_unsafe" true
     pub async unsafe fn async_unsafe_meth() {}
 
-    //@ is "$.index[*][?(@.name=='const_unsafe_meth')].inner.function.header.is_async"  false
-    //@ is "$.index[*][?(@.name=='const_unsafe_meth')].inner.function.header.is_const"  true
-    //@ is "$.index[*][?(@.name=='const_unsafe_meth')].inner.function.header.is_unsafe" true
+    //@ is "$.index[?(@.name=='const_unsafe_meth')].inner.function.header.is_async"  false
+    //@ is "$.index[?(@.name=='const_unsafe_meth')].inner.function.header.is_const"  true
+    //@ is "$.index[?(@.name=='const_unsafe_meth')].inner.function.header.is_unsafe" true
     pub const unsafe fn const_unsafe_meth() {}
 
     // It's impossible for a method to be both const and async, so no test for that
diff --git a/tests/rustdoc-json/nested.rs b/tests/rustdoc-json/nested.rs
index 10ec2831c21..8cc564706d6 100644
--- a/tests/rustdoc-json/nested.rs
+++ b/tests/rustdoc-json/nested.rs
@@ -2,31 +2,31 @@
 //@ compile-flags: --crate-version 1.0.0
 
 //@ is "$.crate_version" \"1.0.0\"
-//@ has "$.index[*][?(@.name=='nested')].inner.module"
-//@ is "$.index[*][?(@.name=='nested')].inner.module.is_crate" true
+//@ has "$.index[?(@.name=='nested')].inner.module"
+//@ is "$.index[?(@.name=='nested')].inner.module.is_crate" true
 
-//@ set l1_id = "$.index[*][?(@.name=='l1')].id"
-//@ ismany "$.index[*][?(@.name=='nested')].inner.module.items[*]" $l1_id
+//@ set l1_id = "$.index[?(@.name=='l1')].id"
+//@ ismany "$.index[?(@.name=='nested')].inner.module.items[*]" $l1_id
 
-//@ has "$.index[*][?(@.name=='l1')].inner.module"
-//@ is "$.index[*][?(@.name=='l1')].inner.module.is_crate" false
+//@ has "$.index[?(@.name=='l1')].inner.module"
+//@ is "$.index[?(@.name=='l1')].inner.module.is_crate" false
 pub mod l1 {
-    //@ has "$.index[*][?(@.name=='l3')].inner.module"
-    //@ is "$.index[*][?(@.name=='l3')].inner.module.is_crate" false
-    //@ set l3_id = "$.index[*][?(@.name=='l3')].id"
+    //@ has "$.index[?(@.name=='l3')].inner.module"
+    //@ is "$.index[?(@.name=='l3')].inner.module.is_crate" false
+    //@ set l3_id = "$.index[?(@.name=='l3')].id"
     pub mod l3 {
 
-        //@ has "$.index[*][?(@.name=='L4')].inner.struct"
-        //@ is "$.index[*][?(@.name=='L4')].inner.struct.kind" '"unit"'
-        //@ set l4_id = "$.index[*][?(@.name=='L4')].id"
-        //@ ismany "$.index[*][?(@.name=='l3')].inner.module.items[*]" $l4_id
+        //@ has "$.index[?(@.name=='L4')].inner.struct"
+        //@ is "$.index[?(@.name=='L4')].inner.struct.kind" '"unit"'
+        //@ set l4_id = "$.index[?(@.name=='L4')].id"
+        //@ ismany "$.index[?(@.name=='l3')].inner.module.items[*]" $l4_id
         pub struct L4;
     }
-    //@ is "$.index[*][?(@.inner.use)].inner.use.is_glob" false
-    //@ is "$.index[*][?(@.inner.use)].inner.use.source" '"l3::L4"'
-    //@ is "$.index[*][?(@.inner.use)].inner.use.is_glob" false
-    //@ is "$.index[*][?(@.inner.use)].inner.use.id" $l4_id
-    //@ set l4_use_id = "$.index[*][?(@.inner.use)].id"
+    //@ is "$.index[?(@.inner.use)].inner.use.is_glob" false
+    //@ is "$.index[?(@.inner.use)].inner.use.source" '"l3::L4"'
+    //@ is "$.index[?(@.inner.use)].inner.use.is_glob" false
+    //@ is "$.index[?(@.inner.use)].inner.use.id" $l4_id
+    //@ set l4_use_id = "$.index[?(@.inner.use)].id"
     pub use l3::L4;
 }
-//@ ismany "$.index[*][?(@.name=='l1')].inner.module.items[*]" $l3_id $l4_use_id
+//@ ismany "$.index[?(@.name=='l1')].inner.module.items[*]" $l3_id $l4_use_id
diff --git a/tests/rustdoc-json/non_lifetime_binders.rs b/tests/rustdoc-json/non_lifetime_binders.rs
index 7c518a8f5a7..84318821c50 100644
--- a/tests/rustdoc-json/non_lifetime_binders.rs
+++ b/tests/rustdoc-json/non_lifetime_binders.rs
@@ -5,11 +5,11 @@ pub trait Trait {}
 
 pub struct Wrapper<T_>(std::marker::PhantomData<T_>);
 
-//@ count "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[*]" 2
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[0].name" \"\'a\"
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }'
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[1].name" \"T\"
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[1].kind" '{ "type": { "bounds": [], "default": null, "is_synthetic": false } }'
+//@ count "$.index[?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[*]" 2
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[0].name" \"\'a\"
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }'
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[1].name" \"T\"
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[1].kind" '{ "type": { "bounds": [], "default": null, "is_synthetic": false } }'
 pub fn foo()
 where
     for<'a, T> &'a Wrapper<T>: Trait,
diff --git a/tests/rustdoc-json/output_generics.rs b/tests/rustdoc-json/output_generics.rs
index 3454f421636..4d4339ceb23 100644
--- a/tests/rustdoc-json/output_generics.rs
+++ b/tests/rustdoc-json/output_generics.rs
@@ -2,11 +2,11 @@
 
 // This is a regression test for #98009.
 
-//@ has "$.index[*][?(@.name=='this_compiles')]"
-//@ has "$.index[*][?(@.name=='this_does_not')]"
-//@ has "$.index[*][?(@.name=='Events')]"
-//@ has "$.index[*][?(@.name=='Other')]"
-//@ has "$.index[*][?(@.name=='Trait')]"
+//@ has "$.index[?(@.name=='this_compiles')]"
+//@ has "$.index[?(@.name=='this_does_not')]"
+//@ has "$.index[?(@.name=='Events')]"
+//@ has "$.index[?(@.name=='Other')]"
+//@ has "$.index[?(@.name=='Trait')]"
 
 struct Events<R>(R);
 
diff --git a/tests/rustdoc-json/path_name.rs b/tests/rustdoc-json/path_name.rs
index a1b3ae294fa..dcfaa0607c4 100644
--- a/tests/rustdoc-json/path_name.rs
+++ b/tests/rustdoc-json/path_name.rs
@@ -19,49 +19,49 @@ pub use priv_mod::{InPrivMod, InPrivMod as InPrivMod2};
 use pub_mod::InPubMod as InPubMod3;
 pub use pub_mod::{InPubMod, InPubMod as InPubMod2};
 
-//@ is "$.index[*][?(@.name=='T0')].inner.type_alias.type.resolved_path.path" '"priv_mod::InPrivMod"'
+//@ is "$.index[?(@.name=='T0')].inner.type_alias.type.resolved_path.path" '"priv_mod::InPrivMod"'
 pub type T0 = priv_mod::InPrivMod;
-//@ is "$.index[*][?(@.name=='T1')].inner.type_alias.type.resolved_path.path" '"InPrivMod"'
+//@ is "$.index[?(@.name=='T1')].inner.type_alias.type.resolved_path.path" '"InPrivMod"'
 pub type T1 = InPrivMod;
-//@ is "$.index[*][?(@.name=='T2')].inner.type_alias.type.resolved_path.path" '"InPrivMod2"'
+//@ is "$.index[?(@.name=='T2')].inner.type_alias.type.resolved_path.path" '"InPrivMod2"'
 pub type T2 = InPrivMod2;
-//@ is "$.index[*][?(@.name=='T3')].inner.type_alias.type.resolved_path.path" '"priv_mod::InPrivMod"'
+//@ is "$.index[?(@.name=='T3')].inner.type_alias.type.resolved_path.path" '"priv_mod::InPrivMod"'
 pub type T3 = InPrivMod3;
 
-//@ is "$.index[*][?(@.name=='U0')].inner.type_alias.type.resolved_path.path" '"pub_mod::InPubMod"'
+//@ is "$.index[?(@.name=='U0')].inner.type_alias.type.resolved_path.path" '"pub_mod::InPubMod"'
 pub type U0 = pub_mod::InPubMod;
-//@ is "$.index[*][?(@.name=='U1')].inner.type_alias.type.resolved_path.path" '"InPubMod"'
+//@ is "$.index[?(@.name=='U1')].inner.type_alias.type.resolved_path.path" '"InPubMod"'
 pub type U1 = InPubMod;
-//@ is "$.index[*][?(@.name=='U2')].inner.type_alias.type.resolved_path.path" '"InPubMod2"'
+//@ is "$.index[?(@.name=='U2')].inner.type_alias.type.resolved_path.path" '"InPubMod2"'
 pub type U2 = InPubMod2;
-//@ is "$.index[*][?(@.name=='U3')].inner.type_alias.type.resolved_path.path" '"pub_mod::InPubMod"'
+//@ is "$.index[?(@.name=='U3')].inner.type_alias.type.resolved_path.path" '"pub_mod::InPubMod"'
 pub type U3 = InPubMod3;
 
 // Check we only have paths for structs at their original path
-//@ ismany "$.paths[*][?(@.crate_id==0 && @.kind=='struct')].path" '["path_name", "priv_mod", "InPrivMod"]' '["path_name", "pub_mod", "InPubMod"]'
+//@ ismany "$.paths[?(@.crate_id==0 && @.kind=='struct')].path" '["path_name", "priv_mod", "InPrivMod"]' '["path_name", "pub_mod", "InPubMod"]'
 
 pub use defines_and_reexports::{InPrivMod as XPrivMod, InPubMod as XPubMod};
 use defines_and_reexports::{InPrivMod as XPrivMod2, InPubMod as XPubMod2};
 
-//@ is "$.index[*][?(@.name=='X0')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::m1::InPubMod"'
+//@ is "$.index[?(@.name=='X0')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::m1::InPubMod"'
 pub type X0 = defines_and_reexports::m1::InPubMod;
-//@ is "$.index[*][?(@.name=='X1')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPubMod"'
+//@ is "$.index[?(@.name=='X1')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPubMod"'
 pub type X1 = defines_and_reexports::InPubMod;
-//@ is "$.index[*][?(@.name=='X2')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPubMod2"'
+//@ is "$.index[?(@.name=='X2')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPubMod2"'
 pub type X2 = defines_and_reexports::InPubMod2;
-//@ is "$.index[*][?(@.name=='X3')].inner.type_alias.type.resolved_path.path" '"XPubMod"'
+//@ is "$.index[?(@.name=='X3')].inner.type_alias.type.resolved_path.path" '"XPubMod"'
 pub type X3 = XPubMod;
 // N.B. This isn't the path as used *or* the original path!
-//@ is "$.index[*][?(@.name=='X4')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPubMod"'
+//@ is "$.index[?(@.name=='X4')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPubMod"'
 pub type X4 = XPubMod2;
 
-//@ is "$.index[*][?(@.name=='Y1')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPrivMod"'
+//@ is "$.index[?(@.name=='Y1')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPrivMod"'
 pub type Y1 = defines_and_reexports::InPrivMod;
-//@ is "$.index[*][?(@.name=='Y2')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPrivMod2"'
+//@ is "$.index[?(@.name=='Y2')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPrivMod2"'
 pub type Y2 = defines_and_reexports::InPrivMod2;
-//@ is "$.index[*][?(@.name=='Y3')].inner.type_alias.type.resolved_path.path" '"XPrivMod"'
+//@ is "$.index[?(@.name=='Y3')].inner.type_alias.type.resolved_path.path" '"XPrivMod"'
 pub type Y3 = XPrivMod;
-//@ is "$.index[*][?(@.name=='Y4')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPrivMod"'
+//@ is "$.index[?(@.name=='Y4')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPrivMod"'
 pub type Y4 = XPrivMod2;
 
 // For foreign items, $.paths contains the *origional* path, even if it's not publicly
@@ -74,9 +74,9 @@ pub type Y4 = XPrivMod2;
 
 // Tests for the example in the docs of Path::name.
 // If these change, chage the docs.
-//@ is "$.index[*][?(@.name=='Vec1')].inner.type_alias.type.resolved_path.path" '"std::vec::Vec"'
+//@ is "$.index[?(@.name=='Vec1')].inner.type_alias.type.resolved_path.path" '"std::vec::Vec"'
 pub type Vec1 = std::vec::Vec<i32>;
-//@ is "$.index[*][?(@.name=='Vec2')].inner.type_alias.type.resolved_path.path" '"Vec"'
+//@ is "$.index[?(@.name=='Vec2')].inner.type_alias.type.resolved_path.path" '"Vec"'
 pub type Vec2 = Vec<i32>;
-//@ is "$.index[*][?(@.name=='Vec3')].inner.type_alias.type.resolved_path.path" '"std::prelude::v1::Vec"'
+//@ is "$.index[?(@.name=='Vec3')].inner.type_alias.type.resolved_path.path" '"std::prelude::v1::Vec"'
 pub type Vec3 = std::prelude::v1::Vec<i32>;
diff --git a/tests/rustdoc-json/primitives/local_primitive.rs b/tests/rustdoc-json/primitives/local_primitive.rs
index b10ae45f3ec..b58120bae05 100644
--- a/tests/rustdoc-json/primitives/local_primitive.rs
+++ b/tests/rustdoc-json/primitives/local_primitive.rs
@@ -11,11 +11,11 @@
 #[rustc_doc_primitive = "i32"]
 mod prim_i32 {}
 
-//@ set local_i32 = "$.index[*][?(@.name=='i32')].id"
+//@ set local_i32 = "$.index[?(@.name=='i32')].id"
 
-//@ has "$.index[*][?(@.name=='local_primitive')]"
-//@ ismany "$.index[*][?(@.name=='local_primitive')].inner.module.items[*]" $local_i32
-//@ is "$.index[*][?(@.name=='local_primitive')].links['prim@i32']" $local_i32
+//@ has "$.index[?(@.name=='local_primitive')]"
+//@ ismany "$.index[?(@.name=='local_primitive')].inner.module.items[*]" $local_i32
+//@ is "$.index[?(@.name=='local_primitive')].links['prim@i32']" $local_i32
 
 // Let's ensure the `prim_i32` module isn't present in the output JSON:
-//@ !has "$.index[*][?(@.name=='prim_i32')]"
+//@ !has "$.index[?(@.name=='prim_i32')]"
diff --git a/tests/rustdoc-json/primitives/primitive_impls.rs b/tests/rustdoc-json/primitives/primitive_impls.rs
index 58c222ce4f0..a1f0ebd11b6 100644
--- a/tests/rustdoc-json/primitives/primitive_impls.rs
+++ b/tests/rustdoc-json/primitives/primitive_impls.rs
@@ -4,26 +4,26 @@
 #![no_core]
 #![rustc_coherence_is_core]
 
-//@ set impl_i32 = "$.index[*][?(@.docs=='Only core can do this')].id"
+//@ set impl_i32 = "$.index[?(@.docs=='Only core can do this')].id"
 
 #[lang = "sized"]
 trait Sized {}
 
 /// Only core can do this
 impl i32 {
-    //@ set identity = "$.index[*][?(@.docs=='Do Nothing')].id"
+    //@ set identity = "$.index[?(@.docs=='Do Nothing')].id"
 
     /// Do Nothing
     pub fn identity(self) -> Self {
         self
     }
 
-    //@ is "$.index[*][?(@.docs=='Only core can do this')].inner.impl.items[*]" $identity
+    //@ is "$.index[?(@.docs=='Only core can do this')].inner.impl.items[*]" $identity
 }
 
-//@ set Trait = "$.index[*][?(@.name=='Trait')].id"
+//@ set Trait = "$.index[?(@.name=='Trait')].id"
 pub trait Trait {}
-//@ set impl_trait_for_i32 = "$.index[*][?(@.docs=='impl Trait for i32')].id"
+//@ set impl_trait_for_i32 = "$.index[?(@.docs=='impl Trait for i32')].id"
 /// impl Trait for i32
 impl Trait for i32 {}
 
@@ -31,7 +31,7 @@ impl Trait for i32 {}
 #[rustc_doc_primitive = "i32"]
 mod prim_i32 {}
 
-//@ set i32 = "$.index[*][?(@.docs=='i32')].id"
-//@ is "$.index[*][?(@.docs=='i32')].name" '"i32"'
-//@ is "$.index[*][?(@.docs=='i32')].inner.primitive.name" '"i32"'
-//@ ismany "$.index[*][?(@.docs=='i32')].inner.primitive.impls[*]" $impl_i32 $impl_trait_for_i32
+//@ set i32 = "$.index[?(@.docs=='i32')].id"
+//@ is "$.index[?(@.docs=='i32')].name" '"i32"'
+//@ is "$.index[?(@.docs=='i32')].inner.primitive.name" '"i32"'
+//@ ismany "$.index[?(@.docs=='i32')].inner.primitive.impls[*]" $impl_i32 $impl_trait_for_i32
diff --git a/tests/rustdoc-json/primitives/primitive_overloading.rs b/tests/rustdoc-json/primitives/primitive_overloading.rs
index 5e5f3974ab3..ae0306843c5 100644
--- a/tests/rustdoc-json/primitives/primitive_overloading.rs
+++ b/tests/rustdoc-json/primitives/primitive_overloading.rs
@@ -4,8 +4,8 @@
 
 #![feature(rustc_attrs)]
 
-//@ has "$.index[*][?(@.name=='usize')]"
-//@ has "$.index[*][?(@.name=='prim')]"
+//@ has "$.index[?(@.name=='usize')]"
+//@ has "$.index[?(@.name=='prim')]"
 
 #[rustc_doc_primitive = "usize"]
 /// This is the built-in type `usize`.
diff --git a/tests/rustdoc-json/primitives/primitive_type.rs b/tests/rustdoc-json/primitives/primitive_type.rs
index 21ef5ab7196..a0d34218b80 100644
--- a/tests/rustdoc-json/primitives/primitive_type.rs
+++ b/tests/rustdoc-json/primitives/primitive_type.rs
@@ -1,17 +1,17 @@
 #![feature(never_type)]
 
-//@ is "$.index[*][?(@.name=='PrimNever')].visibility" \"public\"
-//@ is "$.index[*][?(@.name=='PrimNever')].inner.type_alias.type.primitive" \"never\"
+//@ is "$.index[?(@.name=='PrimNever')].visibility" \"public\"
+//@ is "$.index[?(@.name=='PrimNever')].inner.type_alias.type.primitive" \"never\"
 pub type PrimNever = !;
 
-//@ is "$.index[*][?(@.name=='PrimStr')].inner.type_alias.type.primitive" \"str\"
+//@ is "$.index[?(@.name=='PrimStr')].inner.type_alias.type.primitive" \"str\"
 pub type PrimStr = str;
 
-//@ is "$.index[*][?(@.name=='PrimBool')].inner.type_alias.type.primitive" \"bool\"
+//@ is "$.index[?(@.name=='PrimBool')].inner.type_alias.type.primitive" \"bool\"
 pub type PrimBool = bool;
 
-//@ is "$.index[*][?(@.name=='PrimChar')].inner.type_alias.type.primitive" \"char\"
+//@ is "$.index[?(@.name=='PrimChar')].inner.type_alias.type.primitive" \"char\"
 pub type PrimChar = char;
 
-//@ is "$.index[*][?(@.name=='PrimU8')].inner.type_alias.type.primitive" \"u8\"
+//@ is "$.index[?(@.name=='PrimU8')].inner.type_alias.type.primitive" \"u8\"
 pub type PrimU8 = u8;
diff --git a/tests/rustdoc-json/primitives/use_primitive.rs b/tests/rustdoc-json/primitives/use_primitive.rs
index d4cdef84de8..2991cc1e47c 100644
--- a/tests/rustdoc-json/primitives/use_primitive.rs
+++ b/tests/rustdoc-json/primitives/use_primitive.rs
@@ -5,15 +5,15 @@
 #[rustc_doc_primitive = "usize"]
 mod usize {}
 
-//@ set local_crate_id = "$.index[*][?(@.name=='use_primitive')].crate_id"
+//@ set local_crate_id = "$.index[?(@.name=='use_primitive')].crate_id"
 
-//@ has "$.index[*][?(@.name=='ilog10')]"
-//@ !is "$.index[*][?(@.name=='ilog10')].crate_id" $local_crate_id
-//@ has "$.index[*][?(@.name=='checked_add')]"
-//@ !is "$.index[*][?(@.name=='checked_add')]" $local_crate_id
-//@ !has "$.index[*][?(@.name=='is_ascii_uppercase')]"
+//@ has "$.index[?(@.name=='ilog10')]"
+//@ !is "$.index[?(@.name=='ilog10')].crate_id" $local_crate_id
+//@ has "$.index[?(@.name=='checked_add')]"
+//@ !is "$.index[?(@.name=='checked_add')]" $local_crate_id
+//@ !has "$.index[?(@.name=='is_ascii_uppercase')]"
 
-//@ is "$.index[*].inner.use[?(@.name=='my_i32')].id" null
+//@ is "$.index[?(@.inner.use.name=='my_i32')].inner.use.id" null
 pub use i32 as my_i32;
-//@ is "$.index[*].inner.use[?(@.name=='u32')].id" null
+//@ is "$.index[?(@.inner.use.name=='u32')].inner.use.id" null
 pub use u32;
diff --git a/tests/rustdoc-json/pub_mod_in_private_mod.rs b/tests/rustdoc-json/pub_mod_in_private_mod.rs
index 112ab9c68f0..8b31ad0bcfe 100644
--- a/tests/rustdoc-json/pub_mod_in_private_mod.rs
+++ b/tests/rustdoc-json/pub_mod_in_private_mod.rs
@@ -1,6 +1,6 @@
 // See https://github.com/rust-lang/rust/issues/101105
 
-//@ !has "$.index[*][?(@.name=='nucleus')]"
+//@ !has "$.index[?(@.name=='nucleus')]"
 mod corpus {
     pub mod nucleus {}
 }
diff --git a/tests/rustdoc-json/reexport/doc_inline_external_crate.rs b/tests/rustdoc-json/reexport/doc_inline_external_crate.rs
index 4debd395496..f7067857ddf 100644
--- a/tests/rustdoc-json/reexport/doc_inline_external_crate.rs
+++ b/tests/rustdoc-json/reexport/doc_inline_external_crate.rs
@@ -4,7 +4,7 @@
 #[doc(inline)]
 pub extern crate enum_with_discriminant;
 
-//@ !has '$.index[*][?(@.docs == "Should not be inlined")]'
-//@ has '$.index[*][?(@.name == "enum_with_discriminant")].inner.extern_crate'
-//@ set enum_with_discriminant = '$.index[*][?(@.name == "enum_with_discriminant")].id'
-//@ is '$.index[*][?(@.name == "doc_inline_external_crate")].inner.module.items[*]' $enum_with_discriminant
+//@ !has '$.index[?(@.docs == "Should not be inlined")]'
+//@ has '$.index[?(@.name == "enum_with_discriminant")].inner.extern_crate'
+//@ set enum_with_discriminant = '$.index[?(@.name == "enum_with_discriminant")].id'
+//@ is '$.index[?(@.name == "doc_inline_external_crate")].inner.module.items[*]' $enum_with_discriminant
diff --git a/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs b/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs
index 4efacd283ef..746749e0204 100644
--- a/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs
+++ b/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs
@@ -2,5 +2,5 @@
 
 #![crate_name = "export_extern_crate_as_self"]
 
-//@ is "$.index[*][?(@.inner.module)].name" \"export_extern_crate_as_self\"
+//@ is "$.index[?(@.inner.module)].name" \"export_extern_crate_as_self\"
 pub extern crate self as export_extern_crate_as_self; // Must be the same name as the crate already has
diff --git a/tests/rustdoc-json/reexport/extern_crate_glob.rs b/tests/rustdoc-json/reexport/extern_crate_glob.rs
index dfe6e7a03b1..8a4388feaca 100644
--- a/tests/rustdoc-json/reexport/extern_crate_glob.rs
+++ b/tests/rustdoc-json/reexport/extern_crate_glob.rs
@@ -5,7 +5,7 @@ extern crate enum_with_discriminant;
 #[doc(inline)]
 pub use enum_with_discriminant::*;
 
-//@ !has '$.index[*][?(@.docs == "Should not be inlined")]'
-//@ is '$.index[*][?(@.inner.use)].inner.use.name' \"enum_with_discriminant\"
-//@ set use = '$.index[*][?(@.inner.use)].id'
-//@ is '$.index[*][?(@.name == "extern_crate_glob")].inner.module.items[*]' $use
+//@ !has '$.index[?(@.docs == "Should not be inlined")]'
+//@ is '$.index[?(@.inner.use)].inner.use.name' \"enum_with_discriminant\"
+//@ set use = '$.index[?(@.inner.use)].id'
+//@ is '$.index[?(@.name == "extern_crate_glob")].inner.module.items[*]' $use
diff --git a/tests/rustdoc-json/reexport/glob_collision.rs b/tests/rustdoc-json/reexport/glob_collision.rs
index 8142c35f4c7..48de1b5e772 100644
--- a/tests/rustdoc-json/reexport/glob_collision.rs
+++ b/tests/rustdoc-json/reexport/glob_collision.rs
@@ -1,27 +1,27 @@
 // Regression test for https://github.com/rust-lang/rust/issues/100973
 
-//@ set m1 = "$.index[*][?(@.name == 'm1' && @.inner.module)].id"
-//@ is "$.index[*][?(@.name == 'm1')].inner.module.items" []
-//@ is "$.index[*][?(@.name == 'm1')].inner.module.is_stripped" true
+//@ set m1 = "$.index[?(@.name == 'm1' && @.inner.module)].id"
+//@ is "$.index[?(@.name == 'm1')].inner.module.items" []
+//@ is "$.index[?(@.name == 'm1')].inner.module.is_stripped" true
 mod m1 {
     pub fn f() {}
 }
-//@ set m2 = "$.index[*][?(@.name == 'm2' && @.inner.module)].id"
-//@ is "$.index[*][?(@.name == 'm2')].inner.module.items" []
-//@ is "$.index[*][?(@.name == 'm2')].inner.module.is_stripped" true
+//@ set m2 = "$.index[?(@.name == 'm2' && @.inner.module)].id"
+//@ is "$.index[?(@.name == 'm2')].inner.module.items" []
+//@ is "$.index[?(@.name == 'm2')].inner.module.is_stripped" true
 mod m2 {
     pub fn f(_: u8) {}
 }
 
-//@ set m1_use = "$.index[*][?(@.docs=='m1 re-export')].id"
-//@ is "$.index[*].inner.use[?(@.name=='m1')].id" $m1
-//@ is "$.index[*].inner.use[?(@.name=='m1')].is_glob" true
+//@ set m1_use = "$.index[?(@.docs=='m1 re-export')].id"
+//@ is "$.index[?(@.inner.use.name=='m1')].inner.use.id" $m1
+//@ is "$.index[?(@.inner.use.name=='m1')].inner.use.is_glob" true
 /// m1 re-export
 pub use m1::*;
-//@ set m2_use = "$.index[*][?(@.docs=='m2 re-export')].id"
-//@ is "$.index[*].inner.use[?(@.name=='m2')].id" $m2
-//@ is "$.index[*].inner.use[?(@.name=='m2')].is_glob" true
+//@ set m2_use = "$.index[?(@.docs=='m2 re-export')].id"
+//@ is "$.index[?(@.inner.use.name=='m2')].inner.use.id" $m2
+//@ is "$.index[?(@.inner.use.name=='m2')].inner.use.is_glob" true
 /// m2 re-export
 pub use m2::*;
 
-//@ ismany "$.index[*].inner.module[?(@.is_crate==true)].items[*]" $m1_use $m2_use
+//@ ismany "$.index[?(@.name=='glob_collision')].inner.module.items[*]" $m1_use $m2_use
diff --git a/tests/rustdoc-json/reexport/glob_empty_mod.rs b/tests/rustdoc-json/reexport/glob_empty_mod.rs
index ee1779407f4..69c0c0e6d5f 100644
--- a/tests/rustdoc-json/reexport/glob_empty_mod.rs
+++ b/tests/rustdoc-json/reexport/glob_empty_mod.rs
@@ -1,8 +1,8 @@
 // Regression test for https://github.com/rust-lang/rust/issues/100973
 
-//@ is "$.index[*][?(@.name=='m1' && @.inner.module)].inner.module.is_stripped" true
-//@ set m1 = "$.index[*][?(@.name=='m1')].id"
+//@ is "$.index[?(@.name=='m1' && @.inner.module)].inner.module.is_stripped" true
+//@ set m1 = "$.index[?(@.name=='m1')].id"
 mod m1 {}
 
-//@ is "$.index[*][?(@.inner.use)].inner.use.id" $m1
+//@ is "$.index[?(@.inner.use)].inner.use.id" $m1
 pub use m1::*;
diff --git a/tests/rustdoc-json/reexport/glob_extern.rs b/tests/rustdoc-json/reexport/glob_extern.rs
index 98be4773941..ccc6faffc8e 100644
--- a/tests/rustdoc-json/reexport/glob_extern.rs
+++ b/tests/rustdoc-json/reexport/glob_extern.rs
@@ -1,19 +1,19 @@
 //@ edition:2018
 
-//@ is "$.index[*][?(@.name=='mod1')].inner.module.is_stripped" "true"
+//@ is "$.index[?(@.name=='mod1')].inner.module.is_stripped" "true"
 mod mod1 {
     extern "C" {
-        //@ set public_fn_id = "$.index[*][?(@.name=='public_fn')].id"
+        //@ set public_fn_id = "$.index[?(@.name=='public_fn')].id"
         pub fn public_fn();
-        //@ !has "$.index[*][?(@.name=='private_fn')]"
+        //@ !has "$.index[?(@.name=='private_fn')]"
         fn private_fn();
     }
-    //@ ismany "$.index[*][?(@.name=='mod1')].inner.module.items[*]" $public_fn_id
-    //@ set mod1_id = "$.index[*][?(@.name=='mod1')].id"
+    //@ ismany "$.index[?(@.name=='mod1')].inner.module.items[*]" $public_fn_id
+    //@ set mod1_id = "$.index[?(@.name=='mod1')].id"
 }
 
-//@ is "$.index[*][?(@.inner.use)].inner.use.is_glob" true
-//@ is "$.index[*][?(@.inner.use)].inner.use.id" $mod1_id
-//@ set use_id = "$.index[*][?(@.inner.use)].id"
-//@ ismany "$.index[*][?(@.name=='glob_extern')].inner.module.items[*]" $use_id
+//@ is "$.index[?(@.inner.use)].inner.use.is_glob" true
+//@ is "$.index[?(@.inner.use)].inner.use.id" $mod1_id
+//@ set use_id = "$.index[?(@.inner.use)].id"
+//@ ismany "$.index[?(@.name=='glob_extern')].inner.module.items[*]" $use_id
 pub use mod1::*;
diff --git a/tests/rustdoc-json/reexport/glob_private.rs b/tests/rustdoc-json/reexport/glob_private.rs
index 2084ffc356e..f232914787b 100644
--- a/tests/rustdoc-json/reexport/glob_private.rs
+++ b/tests/rustdoc-json/reexport/glob_private.rs
@@ -1,32 +1,32 @@
 //@ edition:2018
 
-//@ is "$.index[*][?(@.name=='mod1')].inner.module.is_stripped" "true"
+//@ is "$.index[?(@.name=='mod1')].inner.module.is_stripped" "true"
 mod mod1 {
-    //@ is "$.index[*][?(@.name=='mod2')].inner.module.is_stripped" "true"
+    //@ is "$.index[?(@.name=='mod2')].inner.module.is_stripped" "true"
     mod mod2 {
-        //@ set m2pub_id = "$.index[*][?(@.name=='Mod2Public')].id"
+        //@ set m2pub_id = "$.index[?(@.name=='Mod2Public')].id"
         pub struct Mod2Public;
 
-        //@ !has "$.index[*][?(@.name=='Mod2Private')]"
+        //@ !has "$.index[?(@.name=='Mod2Private')]"
         struct Mod2Private;
     }
 
-    //@ set mod2_use_id = "$.index[*][?(@.docs=='Mod2 re-export')].id"
-    //@ is "$.index[*][?(@.docs=='Mod2 re-export')].inner.use.name" \"mod2\"
+    //@ set mod2_use_id = "$.index[?(@.docs=='Mod2 re-export')].id"
+    //@ is "$.index[?(@.docs=='Mod2 re-export')].inner.use.name" \"mod2\"
     /// Mod2 re-export
     pub use self::mod2::*;
 
-    //@ set m1pub_id = "$.index[*][?(@.name=='Mod1Public')].id"
+    //@ set m1pub_id = "$.index[?(@.name=='Mod1Public')].id"
     pub struct Mod1Public;
-    //@ !has "$.index[*][?(@.name=='Mod1Private')]"
+    //@ !has "$.index[?(@.name=='Mod1Private')]"
     struct Mod1Private;
 }
 
-//@ set mod1_use_id = "$.index[*][?(@.docs=='Mod1 re-export')].id"
-//@ is "$.index[*][?(@.docs=='Mod1 re-export')].inner.use.name" \"mod1\"
+//@ set mod1_use_id = "$.index[?(@.docs=='Mod1 re-export')].id"
+//@ is "$.index[?(@.docs=='Mod1 re-export')].inner.use.name" \"mod1\"
 /// Mod1 re-export
 pub use mod1::*;
 
-//@ ismany "$.index[*][?(@.name=='mod2')].inner.module.items[*]" $m2pub_id
-//@ ismany "$.index[*][?(@.name=='mod1')].inner.module.items[*]" $m1pub_id $mod2_use_id
-//@ ismany "$.index[*][?(@.name=='glob_private')].inner.module.items[*]" $mod1_use_id
+//@ ismany "$.index[?(@.name=='mod2')].inner.module.items[*]" $m2pub_id
+//@ ismany "$.index[?(@.name=='mod1')].inner.module.items[*]" $m1pub_id $mod2_use_id
+//@ ismany "$.index[?(@.name=='glob_private')].inner.module.items[*]" $mod1_use_id
diff --git a/tests/rustdoc-json/reexport/in_root_and_mod.rs b/tests/rustdoc-json/reexport/in_root_and_mod.rs
index a1d2080c068..005004e3b86 100644
--- a/tests/rustdoc-json/reexport/in_root_and_mod.rs
+++ b/tests/rustdoc-json/reexport/in_root_and_mod.rs
@@ -1,13 +1,13 @@
-//@ !has "$.index[*][?(@.name=='foo')]"
+//@ !has "$.index[*].name" '"foo"'
 mod foo {
-    //@ has "$.index[*][?(@.name=='Foo')]"
+    //@ has "$.index[*].name" '"Foo"'
     pub struct Foo;
 }
 
-//@ has "$.index[*].inner[?(@.use.source=='foo::Foo')]"
+//@ has "$.index[*].inner.use.source" '"foo::Foo"'
 pub use foo::Foo;
 
 pub mod bar {
-    //@ has "$.index[*].inner[?(@.use.source=='crate::foo::Foo')]"
+    //@ has "$.index[*].inner.use.source" '"crate::foo::Foo"'
     pub use crate::foo::Foo;
 }
diff --git a/tests/rustdoc-json/reexport/in_root_and_mod_pub.rs b/tests/rustdoc-json/reexport/in_root_and_mod_pub.rs
index 7d26d2a970d..54dda2a3cd0 100644
--- a/tests/rustdoc-json/reexport/in_root_and_mod_pub.rs
+++ b/tests/rustdoc-json/reexport/in_root_and_mod_pub.rs
@@ -1,19 +1,19 @@
 pub mod foo {
-    //@ set bar_id = "$.index[*][?(@.name=='Bar')].id"
-    //@ ismany "$.index[*][?(@.name=='foo')].inner.module.items[*]" $bar_id
+    //@ set bar_id = "$.index[?(@.name=='Bar')].id"
+    //@ ismany "$.index[?(@.name=='foo')].inner.module.items[*]" $bar_id
     pub struct Bar;
 }
 
-//@ set root_import_id = "$.index[*][?(@.docs=='Outer re-export')].id"
-//@ is "$.index[*].inner[?(@.use.source=='foo::Bar')].use.id" $bar_id
-//@ has "$.index[*][?(@.name=='in_root_and_mod_pub')].inner.module.items[*]" $root_import_id
+//@ set root_import_id = "$.index[?(@.docs=='Outer re-export')].id"
+//@ is "$.index[?(@.inner.use.source=='foo::Bar')].inner.use.id" $bar_id
+//@ has "$.index[?(@.name=='in_root_and_mod_pub')].inner.module.items[*]" $root_import_id
 /// Outer re-export
 pub use foo::Bar;
 
 pub mod baz {
-    //@ set baz_import_id = "$.index[*][?(@.docs=='Inner re-export')].id"
-    //@ is "$.index[*].inner[?(@.use.source=='crate::foo::Bar')].use.id" $bar_id
-    //@ ismany "$.index[*][?(@.name=='baz')].inner.module.items[*]" $baz_import_id
+    //@ set baz_import_id = "$.index[?(@.docs=='Inner re-export')].id"
+    //@ is "$.index[?(@.inner.use.source=='crate::foo::Bar')].inner.use.id" $bar_id
+    //@ ismany "$.index[?(@.name=='baz')].inner.module.items[*]" $baz_import_id
     /// Inner re-export
     pub use crate::foo::Bar;
 }
diff --git a/tests/rustdoc-json/reexport/macro.rs b/tests/rustdoc-json/reexport/macro.rs
index f182208c341..0bd37768255 100644
--- a/tests/rustdoc-json/reexport/macro.rs
+++ b/tests/rustdoc-json/reexport/macro.rs
@@ -1,13 +1,13 @@
 //@ edition:2018
 
-//@ set repro_id = "$.index[*][?(@.name=='repro')].id"
+//@ set repro_id = "$.index[?(@.name=='repro')].id"
 #[macro_export]
 macro_rules! repro {
     () => {};
 }
 
-//@ set repro2_id = "$.index[*][?(@.docs=='Re-export')].id"
+//@ set repro2_id = "$.index[?(@.docs=='Re-export')].id"
 /// Re-export
 pub use crate::repro as repro2;
 
-//@ ismany "$.index[*][?(@.name=='macro')].inner.module.items[*]" $repro_id $repro2_id
+//@ ismany "$.index[?(@.name=='macro')].inner.module.items[*]" $repro_id $repro2_id
diff --git a/tests/rustdoc-json/reexport/mod_not_included.rs b/tests/rustdoc-json/reexport/mod_not_included.rs
index d0ce95749f1..59e5fff59c9 100644
--- a/tests/rustdoc-json/reexport/mod_not_included.rs
+++ b/tests/rustdoc-json/reexport/mod_not_included.rs
@@ -6,6 +6,6 @@ mod m1 {
 
 pub use m1::x;
 
-//@ has "$.index[*][?(@.name=='x' && @.inner.function)]"
-//@ has "$.index[*].inner[?(@.use.name=='x')].use.source" '"m1::x"'
-//@ !has "$.index[*][?(@.name=='m1')]"
+//@ has "$.index[?(@.name=='x' && @.inner.function)]"
+//@ has "$.index[?(@.inner.use.name=='x')].inner.use.source" '"m1::x"'
+//@ !has "$.index[?(@.name=='m1')]"
diff --git a/tests/rustdoc-json/reexport/private_twice_one_inline.rs b/tests/rustdoc-json/reexport/private_twice_one_inline.rs
index fdf8cda103b..6b5d03e207e 100644
--- a/tests/rustdoc-json/reexport/private_twice_one_inline.rs
+++ b/tests/rustdoc-json/reexport/private_twice_one_inline.rs
@@ -5,19 +5,19 @@
 
 extern crate pub_struct as foo;
 #[doc(inline)]
-//@ set crate_use_id = "$.index[*][?(@.docs=='Hack A')].id"
-//@ set foo_id = "$.index[*][?(@.docs=='Hack A')].inner.use.id"
+//@ set crate_use_id = "$.index[?(@.docs=='Hack A')].id"
+//@ set foo_id = "$.index[?(@.docs=='Hack A')].inner.use.id"
 /// Hack A
 pub use foo::Foo;
 
-//@ set bar_id = "$.index[*][?(@.name=='bar')].id"
+//@ set bar_id = "$.index[?(@.name=='bar')].id"
 pub mod bar {
-    //@ is "$.index[*][?(@.docs=='Hack B')].inner.use.id" $foo_id
-    //@ set bar_use_id = "$.index[*][?(@.docs=='Hack B')].id"
-    //@ ismany "$.index[*][?(@.name=='bar')].inner.module.items[*]" $bar_use_id
+    //@ is "$.index[?(@.docs=='Hack B')].inner.use.id" $foo_id
+    //@ set bar_use_id = "$.index[?(@.docs=='Hack B')].id"
+    //@ ismany "$.index[?(@.name=='bar')].inner.module.items[*]" $bar_use_id
     /// Hack B
     pub use foo::Foo;
 }
 
-//@ ismany "$.index[*][?(@.inner.use)].id" $crate_use_id $bar_use_id
-//@ ismany "$.index[*][?(@.name=='private_twice_one_inline')].inner.module.items[*]" $bar_id $crate_use_id
+//@ ismany "$.index[?(@.inner.use)].id" $crate_use_id $bar_use_id
+//@ ismany "$.index[?(@.name=='private_twice_one_inline')].inner.module.items[*]" $bar_id $crate_use_id
diff --git a/tests/rustdoc-json/reexport/private_two_names.rs b/tests/rustdoc-json/reexport/private_two_names.rs
index 049100d7f49..79af40b83a4 100644
--- a/tests/rustdoc-json/reexport/private_two_names.rs
+++ b/tests/rustdoc-json/reexport/private_two_names.rs
@@ -1,21 +1,21 @@
 // Test for the ICE in https://github.com/rust-lang/rust/issues/83720
 // A pub-in-private type re-exported under two different names shouldn't cause an error
 
-//@ !has "$.index[*][?(@.name=='style')]"
+//@ !has "$.index[?(@.name=='style')]"
 mod style {
-    //@ set color_struct_id = "$.index[*][?(@.inner.struct && @.name=='Color')].id"
+    //@ set color_struct_id = "$.index[?(@.inner.struct && @.name=='Color')].id"
     pub struct Color;
 }
 
-//@ is "$.index[*][?(@.docs=='First re-export')].inner.use.id" $color_struct_id
-//@ is "$.index[*][?(@.docs=='First re-export')].inner.use.name" \"Color\"
-//@ set color_export_id = "$.index[*][?(@.docs=='First re-export')].id"
+//@ is "$.index[?(@.docs=='First re-export')].inner.use.id" $color_struct_id
+//@ is "$.index[?(@.docs=='First re-export')].inner.use.name" \"Color\"
+//@ set color_export_id = "$.index[?(@.docs=='First re-export')].id"
 /// First re-export
 pub use style::Color;
-//@ is "$.index[*][?(@.docs=='Second re-export')].inner.use.id" $color_struct_id
-//@ is "$.index[*][?(@.docs=='Second re-export')].inner.use.name" \"Colour\"
-//@ set colour_export_id = "$.index[*][?(@.docs=='Second re-export')].id"
+//@ is "$.index[?(@.docs=='Second re-export')].inner.use.id" $color_struct_id
+//@ is "$.index[?(@.docs=='Second re-export')].inner.use.name" \"Colour\"
+//@ set colour_export_id = "$.index[?(@.docs=='Second re-export')].id"
 /// Second re-export
 pub use style::Color as Colour;
 
-//@ ismany "$.index[*][?(@.name=='private_two_names')].inner.module.items[*]" $color_export_id $colour_export_id
+//@ ismany "$.index[?(@.name=='private_two_names')].inner.module.items[*]" $color_export_id $colour_export_id
diff --git a/tests/rustdoc-json/reexport/pub_use_doc_hidden.rs b/tests/rustdoc-json/reexport/pub_use_doc_hidden.rs
index e021b51ab4b..129ccb7e2eb 100644
--- a/tests/rustdoc-json/reexport/pub_use_doc_hidden.rs
+++ b/tests/rustdoc-json/reexport/pub_use_doc_hidden.rs
@@ -9,5 +9,5 @@ mod repeat_n {
 /// not here
 pub use repeat_n::RepeatN;
 
-//@ count "$.index[*][?(@.name=='pub_use_doc_hidden')].inner.items[*]" 0
-//@ !has "$.index[*][?(@.docs == 'not here')]"
+//@ count "$.index[?(@.name=='pub_use_doc_hidden')].inner.items[*]" 0
+//@ !has "$.index[?(@.docs == 'not here')]"
diff --git a/tests/rustdoc-json/reexport/reexport_method_from_private_module.rs b/tests/rustdoc-json/reexport/reexport_method_from_private_module.rs
index 25edd5dbb28..56922340a6f 100644
--- a/tests/rustdoc-json/reexport/reexport_method_from_private_module.rs
+++ b/tests/rustdoc-json/reexport/reexport_method_from_private_module.rs
@@ -1,11 +1,11 @@
 // Regression test for <https://github.com/rust-lang/rust/issues/102583>.
 
-//@ set impl_S = "$.index[*][?(@.docs=='impl S')].id"
-//@ has "$.index[*][?(@.name=='S')].inner.struct.impls[*]" $impl_S
-//@ set is_present = "$.index[*][?(@.name=='is_present')].id"
-//@ is "$.index[*][?(@.docs=='impl S')].inner.impl.items[*]" $is_present
-//@ !has "$.index[*][?(@.name=='hidden_impl')]"
-//@ !has "$.index[*][?(@.name=='hidden_fn')]"
+//@ set impl_S = "$.index[?(@.docs=='impl S')].id"
+//@ has "$.index[?(@.name=='S')].inner.struct.impls[*]" $impl_S
+//@ set is_present = "$.index[?(@.name=='is_present')].id"
+//@ is "$.index[?(@.docs=='impl S')].inner.impl.items[*]" $is_present
+//@ !has "$.index[?(@.name=='hidden_impl')]"
+//@ !has "$.index[?(@.name=='hidden_fn')]"
 
 #![no_std]
 
diff --git a/tests/rustdoc-json/reexport/reexport_of_hidden.rs b/tests/rustdoc-json/reexport/reexport_of_hidden.rs
index 80f171da888..119e699d815 100644
--- a/tests/rustdoc-json/reexport/reexport_of_hidden.rs
+++ b/tests/rustdoc-json/reexport/reexport_of_hidden.rs
@@ -1,7 +1,7 @@
 //@ compile-flags: --document-hidden-items
 
-//@ has "$.index[*].inner[?(@.use.name=='UsedHidden')]"
-//@ has "$.index[*][?(@.name=='Hidden')]"
+//@ has "$.index[*].inner.use.name" '"UsedHidden"'
+//@ has "$.index[*].name" '"Hidden"'
 pub mod submodule {
     #[doc(hidden)]
     pub struct Hidden {}
diff --git a/tests/rustdoc-json/reexport/rename_private.rs b/tests/rustdoc-json/reexport/rename_private.rs
index 3f13f305d64..0494dff5bca 100644
--- a/tests/rustdoc-json/reexport/rename_private.rs
+++ b/tests/rustdoc-json/reexport/rename_private.rs
@@ -1,10 +1,10 @@
 //@ edition:2018
 
-//@ !has "$.index[*][?(@.name=='inner')]"
+//@ !has "$.index[?(@.name=='inner')]"
 mod inner {
-    //@ has "$.index[*][?(@.name=='Public')]"
+    //@ has "$.index[?(@.name=='Public')]"
     pub struct Public;
 }
 
-//@ is "$.index[*][?(@.inner.use)].inner.use.name" \"NewName\"
+//@ is "$.index[?(@.inner.use)].inner.use.name" \"NewName\"
 pub use inner::Public as NewName;
diff --git a/tests/rustdoc-json/reexport/rename_public.rs b/tests/rustdoc-json/reexport/rename_public.rs
index 81c003a51c4..a3d712358f2 100644
--- a/tests/rustdoc-json/reexport/rename_public.rs
+++ b/tests/rustdoc-json/reexport/rename_public.rs
@@ -1,15 +1,15 @@
 //@ edition:2018
 
-//@ set inner_id = "$.index[*][?(@.name=='inner')].id"
+//@ set inner_id = "$.index[?(@.name=='inner')].id"
 pub mod inner {
-    //@ set public_id = "$.index[*][?(@.name=='Public')].id"
-    //@ ismany "$.index[*][?(@.name=='inner')].inner.module.items[*]" $public_id
+    //@ set public_id = "$.index[?(@.name=='Public')].id"
+    //@ ismany "$.index[?(@.name=='inner')].inner.module.items[*]" $public_id
     pub struct Public;
 }
-//@ set import_id = "$.index[*][?(@.docs=='Re-export')].id"
-//@ !has "$.index[*].inner[?(@.use.name=='Public')]"
-//@ is "$.index[*].inner[?(@.use.name=='NewName')].use.source" \"inner::Public\"
+//@ set import_id = "$.index[?(@.docs=='Re-export')].id"
+//@ !has "$.index[?(@.inner.use.name=='Public')]"
+//@ is "$.index[?(@.inner.use.name=='NewName')].inner.use.source" \"inner::Public\"
 /// Re-export
 pub use inner::Public as NewName;
 
-//@ ismany "$.index[*][?(@.name=='rename_public')].inner.module.items[*]" $inner_id $import_id
+//@ ismany "$.index[?(@.name=='rename_public')].inner.module.items[*]" $inner_id $import_id
diff --git a/tests/rustdoc-json/reexport/same_name_different_types.rs b/tests/rustdoc-json/reexport/same_name_different_types.rs
index 760e2c6f775..6e7ad3393e5 100644
--- a/tests/rustdoc-json/reexport/same_name_different_types.rs
+++ b/tests/rustdoc-json/reexport/same_name_different_types.rs
@@ -1,22 +1,22 @@
 // Regression test for <https://github.com/rust-lang/rust/issues/107677>.
 
 pub mod nested {
-    //@ set foo_struct = "$.index[*][?(@.docs == 'Foo the struct')].id"
+    //@ set foo_struct = "$.index[?(@.docs == 'Foo the struct')].id"
 
     /// Foo the struct
     pub struct Foo {}
 
-    //@ set foo_fn = "$.index[*][?(@.docs == 'Foo the function')].id"
+    //@ set foo_fn = "$.index[?(@.docs == 'Foo the function')].id"
 
     #[allow(non_snake_case)]
     /// Foo the function
     pub fn Foo() {}
 }
 
-//@ ismany "$.index[*].inner[?(@.use.name == 'Foo')].use.id" $foo_fn $foo_struct
-//@ ismany "$.index[*].inner[?(@.use.name == 'Bar')].use.id" $foo_fn $foo_struct
+//@ ismany "$.index[?(@.inner.use.name == 'Foo')].inner.use.id" $foo_fn $foo_struct
+//@ ismany "$.index[?(@.inner.use.name == 'Bar')].inner.use.id" $foo_fn $foo_struct
 
-//@ count "$.index[*].inner[?(@.use.name == 'Foo')]" 2
-//@ count "$.index[*].inner[?(@.use.name == 'Bar')]" 2
+//@ count "$.index[?(@.inner.use.name == 'Foo')]" 2
+//@ count "$.index[?(@.inner.use.name == 'Bar')]" 2
 pub use Foo as Bar;
 pub use nested::Foo;
diff --git a/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs b/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs
index f313171afa5..05b55c7b12a 100644
--- a/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs
+++ b/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs
@@ -3,17 +3,17 @@
 #![no_std]
 
 mod inner {
-    //@ set trait_id = "$.index[*][?(@.name=='Trait')].id"
+    //@ set trait_id = "$.index[?(@.name=='Trait')].id"
     pub trait Trait {}
 }
 
-//@ set export_id = "$.index[*][?(@.docs=='First re-export')].id"
-//@ is "$.index[*].inner[?(@.use.name=='Trait')].use.id" $trait_id
+//@ set export_id = "$.index[?(@.docs=='First re-export')].id"
+//@ is "$.index[?(@.inner.use.name=='Trait')].inner.use.id" $trait_id
 /// First re-export
 pub use inner::Trait;
-//@ set reexport_id = "$.index[*][?(@.docs=='Second re-export')].id"
-//@ is "$.index[*].inner[?(@.use.name=='Reexport')].use.id" $trait_id
+//@ set reexport_id = "$.index[?(@.docs=='Second re-export')].id"
+//@ is "$.index[?(@.inner.use.name=='Reexport')].inner.use.id" $trait_id
 /// Second re-export
 pub use inner::Trait as Reexport;
 
-//@ ismany "$.index[*][?(@.name=='same_type_reexported_more_than_once')].inner.module.items[*]" $reexport_id $export_id
+//@ ismany "$.index[?(@.name=='same_type_reexported_more_than_once')].inner.module.items[*]" $reexport_id $export_id
diff --git a/tests/rustdoc-json/reexport/simple_private.rs b/tests/rustdoc-json/reexport/simple_private.rs
index 405d57d342e..40be1708dc6 100644
--- a/tests/rustdoc-json/reexport/simple_private.rs
+++ b/tests/rustdoc-json/reexport/simple_private.rs
@@ -1,20 +1,20 @@
 //@ edition:2018
 
-//@ !has "$.index[*][?(@.name=='inner')]"
+//@ !has "$.index[?(@.name=='inner')]"
 mod inner {
-    //@ set pub_id = "$.index[*][?(@.name=='Public')].id"
+    //@ set pub_id = "$.index[?(@.name=='Public')].id"
     pub struct Public;
 }
 
-//@ is "$.index[*][?(@.inner.use)].inner.use.name" \"Public\"
-//@ is "$.index[*][?(@.inner.use)].inner.use.id" $pub_id
-//@ set use_id = "$.index[*][?(@.inner.use)].id"
+//@ is "$.index[?(@.inner.use)].inner.use.name" \"Public\"
+//@ is "$.index[?(@.inner.use)].inner.use.id" $pub_id
+//@ set use_id = "$.index[?(@.inner.use)].id"
 pub use inner::Public;
 
-//@ ismany "$.index[*][?(@.name=='simple_private')].inner.module.items[*]" $use_id
+//@ 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[?(@.kind=='module')].path" '["simple_private"]'
 //@ !has "$.paths[*].path"                      '["simple_private", "inner"]'
-//@ has  "$.paths[*][?(@.kind=='struct')].path" '["simple_private", "inner", "Public"]'
+//@ 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 f1335828314..cdb6c0dc88a 100644
--- a/tests/rustdoc-json/reexport/simple_public.rs
+++ b/tests/rustdoc-json/reexport/simple_public.rs
@@ -1,21 +1,21 @@
 //@ edition:2018
 
-//@ set inner_id = "$.index[*][?(@.name=='inner')].id"
+//@ set inner_id = "$.index[?(@.name=='inner')].id"
 pub mod inner {
 
-    //@ set public_id = "$.index[*][?(@.name=='Public')].id"
-    //@ ismany "$.index[*][?(@.name=='inner')].inner.module.items[*]" $public_id
+    //@ set public_id = "$.index[?(@.name=='Public')].id"
+    //@ ismany "$.index[?(@.name=='inner')].inner.module.items[*]" $public_id
     pub struct Public;
 }
 
-//@ set import_id = "$.index[*][?(@.docs=='Outer')].id"
-//@ is "$.index[*][?(@.docs=='Outer')].inner.use.source" \"inner::Public\"
+//@ set import_id = "$.index[?(@.docs=='Outer')].id"
+//@ is "$.index[?(@.docs=='Outer')].inner.use.source" \"inner::Public\"
 /// Outer
 pub use inner::Public;
 
-//@ ismany "$.index[*][?(@.name=='simple_public')].inner.module.items[*]" $import_id $inner_id
+//@ 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[?(@.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-json/reexport/synthesize_trait_with_docs.rs b/tests/rustdoc-json/reexport/synthesize_trait_with_docs.rs
index 59699e4861b..89591690bca 100644
--- a/tests/rustdoc-json/reexport/synthesize_trait_with_docs.rs
+++ b/tests/rustdoc-json/reexport/synthesize_trait_with_docs.rs
@@ -7,4 +7,4 @@ pub struct Local;
 
 impl trait_with_docs::HasDocs for Local {}
 
-//@ !has "$.index[*][?(@.name == 'HasDocs')]"
+//@ !has "$.index[?(@.name == 'HasDocs')]"
diff --git a/tests/rustdoc-json/return-type-notation.rs b/tests/rustdoc-json/return-type-notation.rs
new file mode 100644
index 00000000000..7943991616b
--- /dev/null
+++ b/tests/rustdoc-json/return-type-notation.rs
@@ -0,0 +1,18 @@
+//@ edition: 2021
+// ignore-tidy-linelength
+
+#![crate_type = "lib"]
+#![feature(return_type_notation)]
+
+pub trait Foo {
+    async fn bar();
+}
+
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.args.angle_bracketed.constraints[0].args" '"return_type_notation"'
+//@ ismany "$.index[?(@.name=='foo')].inner.function.generics.where_predicates[*].bound_predicate.type.qualified_path.args" '"return_type_notation"' '"return_type_notation"'
+pub fn foo<T: Foo<bar(..): Send>>()
+where
+    <T as Foo>::bar(..): 'static,
+    T::bar(..): Sync,
+{
+}
diff --git a/tests/rustdoc-json/return_private.rs b/tests/rustdoc-json/return_private.rs
index 214fda14aca..8fbdb6be5c9 100644
--- a/tests/rustdoc-json/return_private.rs
+++ b/tests/rustdoc-json/return_private.rs
@@ -1,13 +1,13 @@
 // Regression test for <https://github.com/rust-lang/rust/issues/96161>.
 
 mod secret {
-    //@ set struct_secret = "$.index[*][?(@.name == 'Secret' && @.inner.struct)].id"
+    //@ set struct_secret = "$.index[?(@.name == 'Secret' && @.inner.struct)].id"
     pub struct Secret;
 }
 
-//@ has "$.index[*][?(@.name=='get_secret')].inner.function"
-//@ is "$.index[*][?(@.name=='get_secret')].inner.function.sig.output.resolved_path.path" '"secret::Secret"'
-//@ is "$.index[*][?(@.name=='get_secret')].inner.function.sig.output.resolved_path.id" $struct_secret
+//@ has "$.index[?(@.name=='get_secret')].inner.function"
+//@ is "$.index[?(@.name=='get_secret')].inner.function.sig.output.resolved_path.path" '"secret::Secret"'
+//@ is "$.index[?(@.name=='get_secret')].inner.function.sig.output.resolved_path.id" $struct_secret
 pub fn get_secret() -> secret::Secret {
     secret::Secret
 }
diff --git a/tests/rustdoc-json/statics/extern.rs b/tests/rustdoc-json/statics/extern.rs
index 9e0265da8e2..5be13c8b8fc 100644
--- a/tests/rustdoc-json/statics/extern.rs
+++ b/tests/rustdoc-json/statics/extern.rs
@@ -1,38 +1,38 @@
 //@ edition: 2021
 
 extern "C" {
-    //@ is '$.index[*][?(@.name=="A")].inner.static.is_unsafe'  true
-    //@ is '$.index[*][?(@.name=="A")].inner.static.is_mutable' false
+    //@ is '$.index[?(@.name=="A")].inner.static.is_unsafe'  true
+    //@ is '$.index[?(@.name=="A")].inner.static.is_mutable' false
     pub static A: i32;
-    //@ is '$.index[*][?(@.name=="B")].inner.static.is_unsafe'  true
-    //@ is '$.index[*][?(@.name=="B")].inner.static.is_mutable' true
+    //@ is '$.index[?(@.name=="B")].inner.static.is_unsafe'  true
+    //@ is '$.index[?(@.name=="B")].inner.static.is_mutable' true
     pub static mut B: i32;
 
     // items in unadorned `extern` blocks cannot have safety qualifiers
 }
 
 unsafe extern "C" {
-    //@ is '$.index[*][?(@.name=="C")].inner.static.is_unsafe'  true
-    //@ is '$.index[*][?(@.name=="C")].inner.static.is_mutable' false
+    //@ is '$.index[?(@.name=="C")].inner.static.is_unsafe'  true
+    //@ is '$.index[?(@.name=="C")].inner.static.is_mutable' false
     pub static C: i32;
-    //@ is '$.index[*][?(@.name=="D")].inner.static.is_unsafe'  true
-    //@ is '$.index[*][?(@.name=="D")].inner.static.is_mutable' true
+    //@ is '$.index[?(@.name=="D")].inner.static.is_unsafe'  true
+    //@ is '$.index[?(@.name=="D")].inner.static.is_mutable' true
     pub static mut D: i32;
 
-    //@ is '$.index[*][?(@.name=="E")].inner.static.is_unsafe'  false
-    //@ is '$.index[*][?(@.name=="E")].inner.static.is_mutable' false
+    //@ is '$.index[?(@.name=="E")].inner.static.is_unsafe'  false
+    //@ is '$.index[?(@.name=="E")].inner.static.is_mutable' false
     pub safe static E: i32;
-    //@ is '$.index[*][?(@.name=="F")].inner.static.is_unsafe'  false
-    //@ is '$.index[*][?(@.name=="F")].inner.static.is_mutable' true
+    //@ is '$.index[?(@.name=="F")].inner.static.is_unsafe'  false
+    //@ is '$.index[?(@.name=="F")].inner.static.is_mutable' true
     pub safe static mut F: i32;
 
-    //@ is '$.index[*][?(@.name=="G")].inner.static.is_unsafe'  true
-    //@ is '$.index[*][?(@.name=="G")].inner.static.is_mutable' false
+    //@ is '$.index[?(@.name=="G")].inner.static.is_unsafe'  true
+    //@ is '$.index[?(@.name=="G")].inner.static.is_mutable' false
     pub unsafe static G: i32;
-    //@ is '$.index[*][?(@.name=="H")].inner.static.is_unsafe'  true
-    //@ is '$.index[*][?(@.name=="H")].inner.static.is_mutable' true
+    //@ is '$.index[?(@.name=="H")].inner.static.is_unsafe'  true
+    //@ is '$.index[?(@.name=="H")].inner.static.is_mutable' true
     pub unsafe static mut H: i32;
 }
 
-//@ ismany '$.index[*][?(@.inner.static)].inner.static.expr' '""' '""' '""' '""' '""' '""' '""' '""'
-//@ ismany '$.index[*][?(@.inner.static)].inner.static.type.primitive' '"i32"' '"i32"' '"i32"' '"i32"' '"i32"' '"i32"' '"i32"' '"i32"'
+//@ ismany '$.index[?(@.inner.static)].inner.static.expr' '""' '""' '""' '""' '""' '""' '""' '""'
+//@ ismany '$.index[?(@.inner.static)].inner.static.type.primitive' '"i32"' '"i32"' '"i32"' '"i32"' '"i32"' '"i32"' '"i32"' '"i32"'
diff --git a/tests/rustdoc-json/statics/statics.rs b/tests/rustdoc-json/statics/statics.rs
index a8af23cc87d..497a134c503 100644
--- a/tests/rustdoc-json/statics/statics.rs
+++ b/tests/rustdoc-json/statics/statics.rs
@@ -1,12 +1,12 @@
-//@ is '$.index[*][?(@.name=="A")].inner.static.type.primitive' '"i32"'
-//@ is '$.index[*][?(@.name=="A")].inner.static.is_mutable' false
-//@ is '$.index[*][?(@.name=="A")].inner.static.expr' '"5"'
-//@ is '$.index[*][?(@.name=="A")].inner.static.is_unsafe' false
+//@ is '$.index[?(@.name=="A")].inner.static.type.primitive' '"i32"'
+//@ is '$.index[?(@.name=="A")].inner.static.is_mutable' false
+//@ is '$.index[?(@.name=="A")].inner.static.expr' '"5"'
+//@ is '$.index[?(@.name=="A")].inner.static.is_unsafe' false
 pub static A: i32 = 5;
 
-//@ is '$.index[*][?(@.name=="B")].inner.static.type.primitive' '"u32"'
-//@ is '$.index[*][?(@.name=="B")].inner.static.is_mutable' true
+//@ is '$.index[?(@.name=="B")].inner.static.type.primitive' '"u32"'
+//@ is '$.index[?(@.name=="B")].inner.static.is_mutable' true
 // Expr value isn't gaurenteed, it'd be fine to change it.
-//@ is '$.index[*][?(@.name=="B")].inner.static.expr' '"_"'
-//@ is '$.index[*][?(@.name=="B")].inner.static.is_unsafe' false
+//@ is '$.index[?(@.name=="B")].inner.static.expr' '"_"'
+//@ is '$.index[?(@.name=="B")].inner.static.is_unsafe' false
 pub static mut B: u32 = 2 + 3;
diff --git a/tests/rustdoc-json/stripped_modules.rs b/tests/rustdoc-json/stripped_modules.rs
index d0db9c6588b..ba6644190a2 100644
--- a/tests/rustdoc-json/stripped_modules.rs
+++ b/tests/rustdoc-json/stripped_modules.rs
@@ -1,17 +1,17 @@
-//@ !has "$.index[*][?(@.name=='no_pub_inner')]"
+//@ !has "$.index[?(@.name=='no_pub_inner')]"
 mod no_pub_inner {
     fn priv_inner() {}
 }
 
-//@ !has "$.index[*][?(@.name=='pub_inner_unreachable')]"
+//@ !has "$.index[?(@.name=='pub_inner_unreachable')]"
 mod pub_inner_unreachable {
-    //@ !has "$.index[*][?(@.name=='pub_inner_1')]"
+    //@ !has "$.index[?(@.name=='pub_inner_1')]"
     pub fn pub_inner_1() {}
 }
 
-//@ !has "$.index[*][?(@.name=='pub_inner_reachable')]"
+//@ !has "$.index[?(@.name=='pub_inner_reachable')]"
 mod pub_inner_reachable {
-    //@ has "$.index[*][?(@.name=='pub_inner_2')]"
+    //@ has "$.index[?(@.name=='pub_inner_2')]"
     pub fn pub_inner_2() {}
 }
 
diff --git a/tests/rustdoc-json/structs/field_order.rs b/tests/rustdoc-json/structs/field_order.rs
index 7e556df777f..eb1740676a6 100644
--- a/tests/rustdoc-json/structs/field_order.rs
+++ b/tests/rustdoc-json/structs/field_order.rs
@@ -15,24 +15,24 @@ pub struct Foo {
     pub vll_9: i32,
 }
 
-//@ set 0 = '$.index[*][?(@.name == "ews_0")].id'
-//@ set 1 = '$.index[*][?(@.name == "dik_1")].id'
-//@ set 2 = '$.index[*][?(@.name == "hsk_2")].id'
-//@ set 3 = '$.index[*][?(@.name == "djt_3")].id'
-//@ set 4 = '$.index[*][?(@.name == "jnr_4")].id'
-//@ set 5 = '$.index[*][?(@.name == "dfs_5")].id'
-//@ set 6 = '$.index[*][?(@.name == "bja_6")].id'
-//@ set 7 = '$.index[*][?(@.name == "lyc_7")].id'
-//@ set 8 = '$.index[*][?(@.name == "yqd_8")].id'
-//@ set 9 = '$.index[*][?(@.name == "vll_9")].id'
+//@ set 0 = '$.index[?(@.name == "ews_0")].id'
+//@ set 1 = '$.index[?(@.name == "dik_1")].id'
+//@ set 2 = '$.index[?(@.name == "hsk_2")].id'
+//@ set 3 = '$.index[?(@.name == "djt_3")].id'
+//@ set 4 = '$.index[?(@.name == "jnr_4")].id'
+//@ set 5 = '$.index[?(@.name == "dfs_5")].id'
+//@ set 6 = '$.index[?(@.name == "bja_6")].id'
+//@ set 7 = '$.index[?(@.name == "lyc_7")].id'
+//@ set 8 = '$.index[?(@.name == "yqd_8")].id'
+//@ set 9 = '$.index[?(@.name == "vll_9")].id'
 
-//@ is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[0]' $0
-//@ is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[1]' $1
-//@ is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[2]' $2
-//@ is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[3]' $3
-//@ is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[4]' $4
-//@ is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[5]' $5
-//@ is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[6]' $6
-//@ is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[7]' $7
-//@ is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[8]' $8
-//@ is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[9]' $9
+//@ is '$.index[?(@.name == "Foo")].inner.struct.kind.plain.fields[0]' $0
+//@ is '$.index[?(@.name == "Foo")].inner.struct.kind.plain.fields[1]' $1
+//@ is '$.index[?(@.name == "Foo")].inner.struct.kind.plain.fields[2]' $2
+//@ is '$.index[?(@.name == "Foo")].inner.struct.kind.plain.fields[3]' $3
+//@ is '$.index[?(@.name == "Foo")].inner.struct.kind.plain.fields[4]' $4
+//@ is '$.index[?(@.name == "Foo")].inner.struct.kind.plain.fields[5]' $5
+//@ is '$.index[?(@.name == "Foo")].inner.struct.kind.plain.fields[6]' $6
+//@ is '$.index[?(@.name == "Foo")].inner.struct.kind.plain.fields[7]' $7
+//@ is '$.index[?(@.name == "Foo")].inner.struct.kind.plain.fields[8]' $8
+//@ is '$.index[?(@.name == "Foo")].inner.struct.kind.plain.fields[9]' $9
diff --git a/tests/rustdoc-json/structs/plain_all_pub.rs b/tests/rustdoc-json/structs/plain_all_pub.rs
index 67d2a4a7a8c..501044f62cc 100644
--- a/tests/rustdoc-json/structs/plain_all_pub.rs
+++ b/tests/rustdoc-json/structs/plain_all_pub.rs
@@ -3,9 +3,9 @@ pub struct Demo {
     pub y: i32,
 }
 
-//@ set x = "$.index[*][?(@.name=='x')].id"
-//@ set y = "$.index[*][?(@.name=='y')].id"
-//@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[0]" $x
-//@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[1]" $y
-//@ count "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[*]" 2
-//@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.has_stripped_fields" false
+//@ set x = "$.index[?(@.name=='x')].id"
+//@ set y = "$.index[?(@.name=='y')].id"
+//@ is "$.index[?(@.name=='Demo')].inner.struct.kind.plain.fields[0]" $x
+//@ is "$.index[?(@.name=='Demo')].inner.struct.kind.plain.fields[1]" $y
+//@ count "$.index[?(@.name=='Demo')].inner.struct.kind.plain.fields[*]" 2
+//@ is "$.index[?(@.name=='Demo')].inner.struct.kind.plain.has_stripped_fields" false
diff --git a/tests/rustdoc-json/structs/plain_doc_hidden.rs b/tests/rustdoc-json/structs/plain_doc_hidden.rs
index 4573adc73fa..e62fb27ae86 100644
--- a/tests/rustdoc-json/structs/plain_doc_hidden.rs
+++ b/tests/rustdoc-json/structs/plain_doc_hidden.rs
@@ -4,8 +4,8 @@ pub struct Demo {
     pub y: i32,
 }
 
-//@ set x = "$.index[*][?(@.name=='x')].id"
-//@ !has "$.index[*][?(@.name=='y')].id"
-//@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[0]" $x
-//@ count "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[*]" 1
-//@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.has_stripped_fields" true
+//@ set x = "$.index[?(@.name=='x')].id"
+//@ !has "$.index[?(@.name=='y')].id"
+//@ is "$.index[?(@.name=='Demo')].inner.struct.kind.plain.fields[0]" $x
+//@ count "$.index[?(@.name=='Demo')].inner.struct.kind.plain.fields[*]" 1
+//@ is "$.index[?(@.name=='Demo')].inner.struct.kind.plain.has_stripped_fields" true
diff --git a/tests/rustdoc-json/structs/plain_empty.rs b/tests/rustdoc-json/structs/plain_empty.rs
index 30013021abe..127f9ed1972 100644
--- a/tests/rustdoc-json/structs/plain_empty.rs
+++ b/tests/rustdoc-json/structs/plain_empty.rs
@@ -1,5 +1,5 @@
-//@ is "$.index[*][?(@.name=='PlainEmpty')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='PlainEmpty')].inner.struct"
-//@ is "$.index[*][?(@.name=='PlainEmpty')].inner.struct.kind.plain.has_stripped_fields" false
-//@ is "$.index[*][?(@.name=='PlainEmpty')].inner.struct.kind.plain.fields" []
+//@ is "$.index[?(@.name=='PlainEmpty')].visibility" \"public\"
+//@ has "$.index[?(@.name=='PlainEmpty')].inner.struct"
+//@ is "$.index[?(@.name=='PlainEmpty')].inner.struct.kind.plain.has_stripped_fields" false
+//@ is "$.index[?(@.name=='PlainEmpty')].inner.struct.kind.plain.fields" []
 pub struct PlainEmpty {}
diff --git a/tests/rustdoc-json/structs/plain_pub_priv.rs b/tests/rustdoc-json/structs/plain_pub_priv.rs
index 91079a30d42..181d5ea0de2 100644
--- a/tests/rustdoc-json/structs/plain_pub_priv.rs
+++ b/tests/rustdoc-json/structs/plain_pub_priv.rs
@@ -3,7 +3,7 @@ pub struct Demo {
     y: i32,
 }
 
-//@ set x = "$.index[*][?(@.name=='x')].id"
-//@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[0]" $x
-//@ count "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[*]" 1
-//@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.has_stripped_fields" true
+//@ set x = "$.index[?(@.name=='x')].id"
+//@ is "$.index[?(@.name=='Demo')].inner.struct.kind.plain.fields[0]" $x
+//@ count "$.index[?(@.name=='Demo')].inner.struct.kind.plain.fields[*]" 1
+//@ is "$.index[?(@.name=='Demo')].inner.struct.kind.plain.has_stripped_fields" true
diff --git a/tests/rustdoc-json/structs/tuple.rs b/tests/rustdoc-json/structs/tuple.rs
index 6c8dc79dfe2..115ce29bd70 100644
--- a/tests/rustdoc-json/structs/tuple.rs
+++ b/tests/rustdoc-json/structs/tuple.rs
@@ -1,4 +1,4 @@
-//@ is "$.index[*][?(@.name=='Tuple')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='Tuple')].inner.struct"
-//@ is "$.index[*][?(@.name=='Tuple')].inner.struct.kind.tuple" '[null, null]'
+//@ is "$.index[?(@.name=='Tuple')].visibility" \"public\"
+//@ has "$.index[?(@.name=='Tuple')].inner.struct"
+//@ is "$.index[?(@.name=='Tuple')].inner.struct.kind.tuple" '[null, null]'
 pub struct Tuple(u32, String);
diff --git a/tests/rustdoc-json/structs/tuple_empty.rs b/tests/rustdoc-json/structs/tuple_empty.rs
index 137915e6c05..af5b57fb133 100644
--- a/tests/rustdoc-json/structs/tuple_empty.rs
+++ b/tests/rustdoc-json/structs/tuple_empty.rs
@@ -1,2 +1,2 @@
-//@ is "$.index[*][?(@.name=='TupleUnit')].inner.struct.kind.tuple" []
+//@ is "$.index[?(@.name=='TupleUnit')].inner.struct.kind.tuple" []
 pub struct TupleUnit();
diff --git a/tests/rustdoc-json/structs/tuple_pub_priv.rs b/tests/rustdoc-json/structs/tuple_pub_priv.rs
index 11af26e6ea3..b97a17cc46a 100644
--- a/tests/rustdoc-json/structs/tuple_pub_priv.rs
+++ b/tests/rustdoc-json/structs/tuple_pub_priv.rs
@@ -5,9 +5,9 @@ pub struct Demo(
     #[doc(hidden)] i32,
 );
 
-//@ set field = "$.index[*][?(@.docs=='field')].id"
+//@ set field = "$.index[?(@.docs=='field')].id"
 
-//@ is    "$.index[*][?(@.name=='Demo')].inner.struct.kind.tuple[0]" null
-//@ is    "$.index[*][?(@.name=='Demo')].inner.struct.kind.tuple[1]" $field
-//@ is    "$.index[*][?(@.name=='Demo')].inner.struct.kind.tuple[2]" null
-//@ count "$.index[*][?(@.name=='Demo')].inner.struct.kind.tuple[*]" 3
+//@ is    "$.index[?(@.name=='Demo')].inner.struct.kind.tuple[0]" null
+//@ is    "$.index[?(@.name=='Demo')].inner.struct.kind.tuple[1]" $field
+//@ is    "$.index[?(@.name=='Demo')].inner.struct.kind.tuple[2]" null
+//@ count "$.index[?(@.name=='Demo')].inner.struct.kind.tuple[*]" 3
diff --git a/tests/rustdoc-json/structs/unit.rs b/tests/rustdoc-json/structs/unit.rs
index ad6af65c0e0..6a961725206 100644
--- a/tests/rustdoc-json/structs/unit.rs
+++ b/tests/rustdoc-json/structs/unit.rs
@@ -1,4 +1,4 @@
-//@ is "$.index[*][?(@.name=='Unit')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='Unit')].inner.struct"
-//@ is "$.index[*][?(@.name=='Unit')].inner.struct.kind" \"unit\"
+//@ is "$.index[?(@.name=='Unit')].visibility" \"public\"
+//@ has "$.index[?(@.name=='Unit')].inner.struct"
+//@ is "$.index[?(@.name=='Unit')].inner.struct.kind" \"unit\"
 pub struct Unit;
diff --git a/tests/rustdoc-json/structs/with_generics.rs b/tests/rustdoc-json/structs/with_generics.rs
index 3e7f175a5a1..979b002d0ee 100644
--- a/tests/rustdoc-json/structs/with_generics.rs
+++ b/tests/rustdoc-json/structs/with_generics.rs
@@ -1,13 +1,13 @@
 use std::collections::HashMap;
 
-//@ is "$.index[*][?(@.name=='WithGenerics')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='WithGenerics')].inner.struct"
-//@ is "$.index[*][?(@.name=='WithGenerics')].inner.struct.generics.params[0].name" \"T\"
-//@ is "$.index[*][?(@.name=='WithGenerics')].inner.struct.generics.params[0].kind.type.bounds" []
-//@ is "$.index[*][?(@.name=='WithGenerics')].inner.struct.generics.params[1].name" \"U\"
-//@ is "$.index[*][?(@.name=='WithGenerics')].inner.struct.generics.params[1].kind.type.bounds" []
-//@ is "$.index[*][?(@.name=='WithGenerics')].inner.struct.kind.plain.has_stripped_fields" true
-//@ is "$.index[*][?(@.name=='WithGenerics')].inner.struct.kind.plain.fields" []
+//@ is "$.index[?(@.name=='WithGenerics')].visibility" \"public\"
+//@ has "$.index[?(@.name=='WithGenerics')].inner.struct"
+//@ is "$.index[?(@.name=='WithGenerics')].inner.struct.generics.params[0].name" \"T\"
+//@ is "$.index[?(@.name=='WithGenerics')].inner.struct.generics.params[0].kind.type.bounds" []
+//@ is "$.index[?(@.name=='WithGenerics')].inner.struct.generics.params[1].name" \"U\"
+//@ is "$.index[?(@.name=='WithGenerics')].inner.struct.generics.params[1].kind.type.bounds" []
+//@ is "$.index[?(@.name=='WithGenerics')].inner.struct.kind.plain.has_stripped_fields" true
+//@ is "$.index[?(@.name=='WithGenerics')].inner.struct.kind.plain.fields" []
 pub struct WithGenerics<T, U> {
     stuff: Vec<T>,
     things: HashMap<U, U>,
diff --git a/tests/rustdoc-json/structs/with_primitives.rs b/tests/rustdoc-json/structs/with_primitives.rs
index fe99292456d..4e856bda296 100644
--- a/tests/rustdoc-json/structs/with_primitives.rs
+++ b/tests/rustdoc-json/structs/with_primitives.rs
@@ -1,9 +1,9 @@
-//@ is "$.index[*][?(@.name=='WithPrimitives')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='WithPrimitives')].inner.struct"
-//@ is "$.index[*][?(@.name=='WithPrimitives')].inner.struct.generics.params[0].name" \"\'a\"
-//@ is "$.index[*][?(@.name=='WithPrimitives')].inner.struct.generics.params[0].kind.lifetime.outlives" []
-//@ is "$.index[*][?(@.name=='WithPrimitives')].inner.struct.kind.plain.has_stripped_fields" true
-//@ is "$.index[*][?(@.name=='WithPrimitives')].inner.struct.kind.plain.fields" []
+//@ is "$.index[?(@.name=='WithPrimitives')].visibility" \"public\"
+//@ has "$.index[?(@.name=='WithPrimitives')].inner.struct"
+//@ is "$.index[?(@.name=='WithPrimitives')].inner.struct.generics.params[0].name" \"\'a\"
+//@ is "$.index[?(@.name=='WithPrimitives')].inner.struct.generics.params[0].kind.lifetime.outlives" []
+//@ is "$.index[?(@.name=='WithPrimitives')].inner.struct.kind.plain.has_stripped_fields" true
+//@ is "$.index[?(@.name=='WithPrimitives')].inner.struct.kind.plain.fields" []
 pub struct WithPrimitives<'a> {
     num: u32,
     s: &'a str,
diff --git a/tests/rustdoc-json/trait_alias.rs b/tests/rustdoc-json/trait_alias.rs
index d9ef256b106..e7a586ee95a 100644
--- a/tests/rustdoc-json/trait_alias.rs
+++ b/tests/rustdoc-json/trait_alias.rs
@@ -1,17 +1,17 @@
 #![feature(trait_alias)]
 
-//@ set StrLike = "$.index[*][?(@.name=='StrLike')].id"
-//@ is "$.index[*][?(@.name=='StrLike')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='StrLike')].inner.trait_alias"
-//@ is "$.index[*][?(@.name=='StrLike')].span.filename" $FILE
+//@ set StrLike = "$.index[?(@.name=='StrLike')].id"
+//@ is "$.index[?(@.name=='StrLike')].visibility" \"public\"
+//@ has "$.index[?(@.name=='StrLike')].inner.trait_alias"
+//@ is "$.index[?(@.name=='StrLike')].span.filename" $FILE
 pub trait StrLike = AsRef<str>;
 
-//@ is "$.index[*][?(@.name=='f')].inner.function.sig.output.impl_trait[0].trait_bound.trait.id" $StrLike
+//@ is "$.index[?(@.name=='f')].inner.function.sig.output.impl_trait[0].trait_bound.trait.id" $StrLike
 pub fn f() -> impl StrLike {
     "heya"
 }
 
-//@ !is "$.index[*][?(@.name=='g')].inner.function.sig.output.impl_trait[0].trait_bound.trait.id" $StrLike
+//@ !is "$.index[?(@.name=='g')].inner.function.sig.output.impl_trait[0].trait_bound.trait.id" $StrLike
 pub fn g() -> impl AsRef<str> {
     "heya"
 }
diff --git a/tests/rustdoc-json/traits/has_body.rs b/tests/rustdoc-json/traits/has_body.rs
index 95e0f97b52c..d17988474f9 100644
--- a/tests/rustdoc-json/traits/has_body.rs
+++ b/tests/rustdoc-json/traits/has_body.rs
@@ -1,21 +1,21 @@
-//@ has "$.index[*][?(@.name=='Foo')]"
+//@ has "$.index[?(@.name=='Foo')]"
 pub trait Foo {
-    //@ is "$.index[*][?(@.name=='no_self')].inner.function.has_body" false
+    //@ is "$.index[?(@.name=='no_self')].inner.function.has_body" false
     fn no_self();
-    //@ is "$.index[*][?(@.name=='move_self')].inner.function.has_body" false
+    //@ is "$.index[?(@.name=='move_self')].inner.function.has_body" false
     fn move_self(self);
-    //@ is "$.index[*][?(@.name=='ref_self')].inner.function.has_body" false
+    //@ is "$.index[?(@.name=='ref_self')].inner.function.has_body" false
     fn ref_self(&self);
 
-    //@ is "$.index[*][?(@.name=='no_self_def')].inner.function.has_body" true
+    //@ is "$.index[?(@.name=='no_self_def')].inner.function.has_body" true
     fn no_self_def() {}
-    //@ is "$.index[*][?(@.name=='move_self_def')].inner.function.has_body" true
+    //@ is "$.index[?(@.name=='move_self_def')].inner.function.has_body" true
     fn move_self_def(self) {}
-    //@ is "$.index[*][?(@.name=='ref_self_def')].inner.function.has_body" true
+    //@ is "$.index[?(@.name=='ref_self_def')].inner.function.has_body" true
     fn ref_self_def(&self) {}
 }
 
 pub trait Bar: Clone {
-    //@ is "$.index[*][?(@.name=='method')].inner.function.has_body" false
+    //@ is "$.index[?(@.name=='method')].inner.function.has_body" false
     fn method(&self, param: usize);
 }
diff --git a/tests/rustdoc-json/traits/implementors.rs b/tests/rustdoc-json/traits/implementors.rs
index 9fdb763b61e..499acefedb7 100644
--- a/tests/rustdoc-json/traits/implementors.rs
+++ b/tests/rustdoc-json/traits/implementors.rs
@@ -5,14 +5,14 @@ pub struct GeorgeMichael {}
 impl Wham for GeorgeMichael {}
 
 // Find IDs.
-//@ set wham = "$.index[*][?(@.name=='Wham')].id"
-//@ set gmWham = "$.index[*][?(@.docs=='Wham for George Michael')].id"
-//@ set gm = "$.index[*][?(@.name=='GeorgeMichael')].id"
+//@ set wham = "$.index[?(@.name=='Wham')].id"
+//@ set gmWham = "$.index[?(@.docs=='Wham for George Michael')].id"
+//@ set gm = "$.index[?(@.name=='GeorgeMichael')].id"
 
 // Both struct and trait point to impl.
-//@ has "$.index[*][?(@.name=='GeorgeMichael')].inner.struct.impls[*]" $gmWham
-//@ is "$.index[*][?(@.name=='Wham')].inner.trait.implementations[*]" $gmWham
+//@ has "$.index[?(@.name=='GeorgeMichael')].inner.struct.impls[*]" $gmWham
+//@ is "$.index[?(@.name=='Wham')].inner.trait.implementations[*]" $gmWham
 
 // Impl points to both struct and trait.
-//@ is "$.index[*][?(@.docs == 'Wham for George Michael')].inner.impl.trait.id" $wham
-//@ is "$.index[*][?(@.docs == 'Wham for George Michael')].inner.impl.for.resolved_path.id" $gm
+//@ is "$.index[?(@.docs == 'Wham for George Michael')].inner.impl.trait.id" $wham
+//@ is "$.index[?(@.docs == 'Wham for George Michael')].inner.impl.for.resolved_path.id" $gm
diff --git a/tests/rustdoc-json/traits/is_dyn_compatible.rs b/tests/rustdoc-json/traits/is_dyn_compatible.rs
index bccf94d17d6..b172b53807b 100644
--- a/tests/rustdoc-json/traits/is_dyn_compatible.rs
+++ b/tests/rustdoc-json/traits/is_dyn_compatible.rs
@@ -1,19 +1,19 @@
 #![no_std]
 
-//@ has "$.index[*][?(@.name=='FooDynIncompatible')]"
-//@ is "$.index[*][?(@.name=='FooDynIncompatible')].inner.trait.is_dyn_compatible" false
+//@ has "$.index[?(@.name=='FooDynIncompatible')]"
+//@ is "$.index[?(@.name=='FooDynIncompatible')].inner.trait.is_dyn_compatible" false
 pub trait FooDynIncompatible {
     fn foo() -> Self;
 }
 
-//@ has "$.index[*][?(@.name=='BarDynIncompatible')]"
-//@ is "$.index[*][?(@.name=='BarDynIncompatible')].inner.trait.is_dyn_compatible" false
+//@ has "$.index[?(@.name=='BarDynIncompatible')]"
+//@ is "$.index[?(@.name=='BarDynIncompatible')].inner.trait.is_dyn_compatible" false
 pub trait BarDynIncompatible<T> {
     fn foo(i: T);
 }
 
-//@ has "$.index[*][?(@.name=='FooDynCompatible')]"
-//@ is "$.index[*][?(@.name=='FooDynCompatible')].inner.trait.is_dyn_compatible" true
+//@ has "$.index[?(@.name=='FooDynCompatible')]"
+//@ is "$.index[?(@.name=='FooDynCompatible')].inner.trait.is_dyn_compatible" true
 pub trait FooDynCompatible {
     fn foo(&self);
 }
diff --git a/tests/rustdoc-json/traits/private_supertrait.rs b/tests/rustdoc-json/traits/private_supertrait.rs
index ce0642278e0..1e11abaecdf 100644
--- a/tests/rustdoc-json/traits/private_supertrait.rs
+++ b/tests/rustdoc-json/traits/private_supertrait.rs
@@ -1,9 +1,9 @@
-//@ !has "$.index[*][?(@.name == 'sealed')]"
+//@ !has "$.index[?(@.name == 'sealed')]"
 mod sealed {
-    //@ set sealed_id = "$.index[*][?(@.name=='Sealed')].id"
+    //@ set sealed_id = "$.index[?(@.name=='Sealed')].id"
     pub trait Sealed {}
 }
 
-//@ count "$.index[*][?(@.name=='Trait')].inner.trait.bounds[*]" 1
-//@ is    "$.index[*][?(@.name=='Trait')].inner.trait.bounds[0].trait_bound.trait.id" $sealed_id
+//@ count "$.index[?(@.name=='Trait')].inner.trait.bounds[*]" 1
+//@ is    "$.index[?(@.name=='Trait')].inner.trait.bounds[0].trait_bound.trait.id" $sealed_id
 pub trait Trait: sealed::Sealed {}
diff --git a/tests/rustdoc-json/traits/self.rs b/tests/rustdoc-json/traits/self.rs
index efd9efd556f..018bda9cc3c 100644
--- a/tests/rustdoc-json/traits/self.rs
+++ b/tests/rustdoc-json/traits/self.rs
@@ -7,29 +7,29 @@ pub struct Foo;
 // Each assertion matches 3 times, and should be the same each time.
 
 impl Foo {
-    //@ ismany '$.index[*][?(@.name=="by_ref")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
-    //@ ismany '$.index[*][?(@.name=="by_ref")].inner.function.sig.inputs[0][1].borrowed_ref.type.generic' '"Self"' '"Self"' '"Self"'
-    //@ ismany '$.index[*][?(@.name=="by_ref")].inner.function.sig.inputs[0][1].borrowed_ref.lifetime' null null null
-    //@ ismany '$.index[*][?(@.name=="by_ref")].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable' false false false
+    //@ ismany '$.index[?(@.name=="by_ref")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
+    //@ ismany '$.index[?(@.name=="by_ref")].inner.function.sig.inputs[0][1].borrowed_ref.type.generic' '"Self"' '"Self"' '"Self"'
+    //@ ismany '$.index[?(@.name=="by_ref")].inner.function.sig.inputs[0][1].borrowed_ref.lifetime' null null null
+    //@ ismany '$.index[?(@.name=="by_ref")].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable' false false false
     pub fn by_ref(&self) {}
 
-    //@ ismany '$.index[*][?(@.name=="by_exclusive_ref")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
-    //@ ismany '$.index[*][?(@.name=="by_exclusive_ref")].inner.function.sig.inputs[0][1].borrowed_ref.type.generic' '"Self"' '"Self"' '"Self"'
-    //@ ismany '$.index[*][?(@.name=="by_exclusive_ref")].inner.function.sig.inputs[0][1].borrowed_ref.lifetime' null null null
-    //@ ismany '$.index[*][?(@.name=="by_exclusive_ref")].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable' true true true
+    //@ ismany '$.index[?(@.name=="by_exclusive_ref")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
+    //@ ismany '$.index[?(@.name=="by_exclusive_ref")].inner.function.sig.inputs[0][1].borrowed_ref.type.generic' '"Self"' '"Self"' '"Self"'
+    //@ ismany '$.index[?(@.name=="by_exclusive_ref")].inner.function.sig.inputs[0][1].borrowed_ref.lifetime' null null null
+    //@ ismany '$.index[?(@.name=="by_exclusive_ref")].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable' true true true
     pub fn by_exclusive_ref(&mut self) {}
 
-    //@ ismany '$.index[*][?(@.name=="by_value")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
-    //@ ismany '$.index[*][?(@.name=="by_value")].inner.function.sig.inputs[0][1].generic' '"Self"' '"Self"' '"Self"'
+    //@ ismany '$.index[?(@.name=="by_value")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
+    //@ ismany '$.index[?(@.name=="by_value")].inner.function.sig.inputs[0][1].generic' '"Self"' '"Self"' '"Self"'
     pub fn by_value(self) {}
 
-    //@ ismany '$.index[*][?(@.name=="with_lifetime")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
-    //@ ismany '$.index[*][?(@.name=="with_lifetime")].inner.function.sig.inputs[0][1].borrowed_ref.type.generic' '"Self"' '"Self"' '"Self"'
-    //@ ismany '$.index[*][?(@.name=="with_lifetime")].inner.function.sig.inputs[0][1].borrowed_ref.lifetime' \"\'a\" \"\'a\" \"\'a\"
-    //@ ismany '$.index[*][?(@.name=="with_lifetime")].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable' false false false
+    //@ ismany '$.index[?(@.name=="with_lifetime")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
+    //@ ismany '$.index[?(@.name=="with_lifetime")].inner.function.sig.inputs[0][1].borrowed_ref.type.generic' '"Self"' '"Self"' '"Self"'
+    //@ ismany '$.index[?(@.name=="with_lifetime")].inner.function.sig.inputs[0][1].borrowed_ref.lifetime' \"\'a\" \"\'a\" \"\'a\"
+    //@ ismany '$.index[?(@.name=="with_lifetime")].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable' false false false
     pub fn with_lifetime<'a>(&'a self) {}
 
-    //@ ismany '$.index[*][?(@.name=="build")].inner.function.sig.output.generic' '"Self"' '"Self"' '"Self"'
+    //@ ismany '$.index[?(@.name=="build")].inner.function.sig.output.generic' '"Self"' '"Self"' '"Self"'
     pub fn build() -> Self {
         Self
     }
diff --git a/tests/rustdoc-json/traits/supertrait.rs b/tests/rustdoc-json/traits/supertrait.rs
index 4b6199d4b26..3accb0ff858 100644
--- a/tests/rustdoc-json/traits/supertrait.rs
+++ b/tests/rustdoc-json/traits/supertrait.rs
@@ -1,20 +1,20 @@
-//@ set loud_id = "$.index[*][?(@.name=='Loud')].id"
+//@ set loud_id = "$.index[?(@.name=='Loud')].id"
 pub trait Loud {}
 
-//@ set very_loud_id = "$.index[*][?(@.name=='VeryLoud')].id"
-//@ count "$.index[*][?(@.name=='VeryLoud')].inner.trait.bounds[*]" 1
-//@ is    "$.index[*][?(@.name=='VeryLoud')].inner.trait.bounds[0].trait_bound.trait.id" $loud_id
+//@ set very_loud_id = "$.index[?(@.name=='VeryLoud')].id"
+//@ count "$.index[?(@.name=='VeryLoud')].inner.trait.bounds[*]" 1
+//@ is    "$.index[?(@.name=='VeryLoud')].inner.trait.bounds[0].trait_bound.trait.id" $loud_id
 pub trait VeryLoud: Loud {}
 
-//@ set sounds_good_id = "$.index[*][?(@.name=='SoundsGood')].id"
+//@ set sounds_good_id = "$.index[?(@.name=='SoundsGood')].id"
 pub trait SoundsGood {}
 
-//@ count "$.index[*][?(@.name=='MetalBand')].inner.trait.bounds[*]" 2
-//@ is    "$.index[*][?(@.name=='MetalBand')].inner.trait.bounds[0].trait_bound.trait.id" $very_loud_id
-//@ is    "$.index[*][?(@.name=='MetalBand')].inner.trait.bounds[1].trait_bound.trait.id" $sounds_good_id
+//@ count "$.index[?(@.name=='MetalBand')].inner.trait.bounds[*]" 2
+//@ is    "$.index[?(@.name=='MetalBand')].inner.trait.bounds[0].trait_bound.trait.id" $very_loud_id
+//@ is    "$.index[?(@.name=='MetalBand')].inner.trait.bounds[1].trait_bound.trait.id" $sounds_good_id
 pub trait MetalBand: VeryLoud + SoundsGood {}
 
-//@ count "$.index[*][?(@.name=='DnabLatem')].inner.trait.bounds[*]" 2
-//@ is    "$.index[*][?(@.name=='DnabLatem')].inner.trait.bounds[1].trait_bound.trait.id" $very_loud_id
-//@ is    "$.index[*][?(@.name=='DnabLatem')].inner.trait.bounds[0].trait_bound.trait.id" $sounds_good_id
+//@ count "$.index[?(@.name=='DnabLatem')].inner.trait.bounds[*]" 2
+//@ is    "$.index[?(@.name=='DnabLatem')].inner.trait.bounds[1].trait_bound.trait.id" $very_loud_id
+//@ is    "$.index[?(@.name=='DnabLatem')].inner.trait.bounds[0].trait_bound.trait.id" $sounds_good_id
 pub trait DnabLatem: SoundsGood + VeryLoud {}
diff --git a/tests/rustdoc-json/traits/trait_alias.rs b/tests/rustdoc-json/traits/trait_alias.rs
index 137b8947e23..497930a67c8 100644
--- a/tests/rustdoc-json/traits/trait_alias.rs
+++ b/tests/rustdoc-json/traits/trait_alias.rs
@@ -2,25 +2,25 @@
 
 #![feature(trait_alias)]
 
-//@ set Orig = "$.index[*][?(@.name == 'Orig')].id"
-//@ has "$.index[*][?(@.name == 'Orig')].inner.trait"
+//@ set Orig = "$.index[?(@.name == 'Orig')].id"
+//@ has "$.index[?(@.name == 'Orig')].inner.trait"
 pub trait Orig<T> {}
 
-//@ set Alias = "$.index[*][?(@.name == 'Alias')].id"
-//@ has "$.index[*][?(@.name == 'Alias')].inner.trait_alias"
-//@ is "$.index[*][?(@.name == 'Alias')].inner.trait_alias.generics" '{"params": [], "where_predicates": []}'
-//@ count "$.index[*][?(@.name == 'Alias')].inner.trait_alias.params[*]" 1
-//@ is "$.index[*][?(@.name == 'Alias')].inner.trait_alias.params[0].trait_bound.trait.id" $Orig
-//@ is "$.index[*][?(@.name == 'Alias')].inner.trait_alias.params[0].trait_bound.trait.args.angle_bracketed.args[0].type.primitive" '"i32"'
+//@ set Alias = "$.index[?(@.name == 'Alias')].id"
+//@ has "$.index[?(@.name == 'Alias')].inner.trait_alias"
+//@ is "$.index[?(@.name == 'Alias')].inner.trait_alias.generics" '{"params": [], "where_predicates": []}'
+//@ count "$.index[?(@.name == 'Alias')].inner.trait_alias.params[*]" 1
+//@ is "$.index[?(@.name == 'Alias')].inner.trait_alias.params[0].trait_bound.trait.id" $Orig
+//@ is "$.index[?(@.name == 'Alias')].inner.trait_alias.params[0].trait_bound.trait.args.angle_bracketed.args[0].type.primitive" '"i32"'
 pub trait Alias = Orig<i32>;
 
 pub struct Struct;
 
 impl Orig<i32> for Struct {}
 
-//@ has "$.index[*][?(@.name=='takes_alias')].inner.function.sig.inputs[0][1].impl_trait"
-//@ is "$.index[*][?(@.name=='takes_alias')].inner.function.sig.inputs[0][1].impl_trait[0].trait_bound.trait.id" $Alias
-//@ is "$.index[*][?(@.name=='takes_alias')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $Alias
+//@ has "$.index[?(@.name=='takes_alias')].inner.function.sig.inputs[0][1].impl_trait"
+//@ is "$.index[?(@.name=='takes_alias')].inner.function.sig.inputs[0][1].impl_trait[0].trait_bound.trait.id" $Alias
+//@ is "$.index[?(@.name=='takes_alias')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $Alias
 pub fn takes_alias(_: impl Alias) {}
 // FIXME: Should the trait be mentioned in both the decl and generics?
 
diff --git a/tests/rustdoc-json/traits/uses_extern_trait.rs b/tests/rustdoc-json/traits/uses_extern_trait.rs
index 3a93bcaefd4..52983527f08 100644
--- a/tests/rustdoc-json/traits/uses_extern_trait.rs
+++ b/tests/rustdoc-json/traits/uses_extern_trait.rs
@@ -1,5 +1,5 @@
 #![no_std]
 pub fn drop_default<T: core::default::Default>(_x: T) {}
 
-//@ !has "$.index[*][?(@.name=='Debug')]"
-//@ !has "$.index[*][?(@.name=='Default')]"
+//@ !has "$.index[?(@.name=='Debug')]"
+//@ !has "$.index[?(@.name=='Default')]"
diff --git a/tests/rustdoc-json/type/dyn.rs b/tests/rustdoc-json/type/dyn.rs
index d8686d4e2fb..4e533a67f8b 100644
--- a/tests/rustdoc-json/type/dyn.rs
+++ b/tests/rustdoc-json/type/dyn.rs
@@ -1,45 +1,45 @@
 use std::fmt::Debug;
 
-//@ count "$.index[*][?(@.name=='dyn')].inner.module.items[*]" 3
-//@ set sync_int_gen = "$.index[*][?(@.name=='SyncIntGen')].id"
-//@ set ref_fn       = "$.index[*][?(@.name=='RefFn')].id"
-//@ set weird_order  = "$.index[*][?(@.name=='WeirdOrder')].id"
-//@ ismany "$.index[*][?(@.name=='dyn')].inner.module.items[*]" $sync_int_gen $ref_fn $weird_order
+//@ count "$.index[?(@.name=='dyn')].inner.module.items[*]" 3
+//@ set sync_int_gen = "$.index[?(@.name=='SyncIntGen')].id"
+//@ set ref_fn       = "$.index[?(@.name=='RefFn')].id"
+//@ set weird_order  = "$.index[?(@.name=='WeirdOrder')].id"
+//@ ismany "$.index[?(@.name=='dyn')].inner.module.items[*]" $sync_int_gen $ref_fn $weird_order
 
-//@ has    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias"
-//@ is    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.generics" '{"params": [], "where_predicates": []}'
-//@ has    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path"
-//@ is    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.path" \"Box\"
-//@ is    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.constraints" []
-//@ count "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args" 1
-//@ has    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait"
-//@ is    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.lifetime" \"\'static\"
-//@ count "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[*]" 3
-//@ is    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].generic_params" []
-//@ is    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[1].generic_params" []
-//@ is    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[2].generic_params" []
-//@ is    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].trait.path" '"Fn"'
-//@ is    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[1].trait.path" '"Send"'
-//@ is    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[2].trait.path" '"Sync"'
-//@ is    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].trait.args" '{"parenthesized": {"inputs": [],"output": {"primitive": "i32"}}}'
+//@ has    "$.index[?(@.name=='SyncIntGen')].inner.type_alias"
+//@ is    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.generics" '{"params": [], "where_predicates": []}'
+//@ has    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path"
+//@ is    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.path" \"Box\"
+//@ is    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.constraints" []
+//@ count "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args" 1
+//@ has    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait"
+//@ is    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.lifetime" \"\'static\"
+//@ count "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[*]" 3
+//@ is    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].generic_params" []
+//@ is    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[1].generic_params" []
+//@ is    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[2].generic_params" []
+//@ is    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].trait.path" '"Fn"'
+//@ is    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[1].trait.path" '"Send"'
+//@ is    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[2].trait.path" '"Sync"'
+//@ is    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].trait.args" '{"parenthesized": {"inputs": [],"output": {"primitive": "i32"}}}'
 pub type SyncIntGen = Box<dyn Fn() -> i32 + Send + Sync + 'static>;
 
-//@ has "$.index[*][?(@.name=='RefFn')].inner.type_alias"
-//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.generics" '{"params": [{"kind": {"lifetime": {"outlives": []}},"name": "'\''a"}],"where_predicates": []}'
-//@ has "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref"
-//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.is_mutable" 'false'
-//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.lifetime" "\"'a\""
-//@ has "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait"
-//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.lifetime" null
-//@ count "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[*]" 1
-//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].generic_params" '[{"kind": {"lifetime": {"outlives": []}},"name": "'\''b"}]'
-//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.path" '"Fn"'
-//@ has "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.inputs[0].borrowed_ref"
-//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.inputs[0].borrowed_ref.lifetime" "\"'b\""
-//@ has "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.output.borrowed_ref"
-//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.output.borrowed_ref.lifetime" "\"'b\""
+//@ has "$.index[?(@.name=='RefFn')].inner.type_alias"
+//@ is "$.index[?(@.name=='RefFn')].inner.type_alias.generics" '{"params": [{"kind": {"lifetime": {"outlives": []}},"name": "'\''a"}],"where_predicates": []}'
+//@ has "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref"
+//@ is "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.is_mutable" 'false'
+//@ is "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.lifetime" "\"'a\""
+//@ has "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait"
+//@ is "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.lifetime" null
+//@ count "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[*]" 1
+//@ is "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].generic_params" '[{"kind": {"lifetime": {"outlives": []}},"name": "'\''b"}]'
+//@ is "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.path" '"Fn"'
+//@ has "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.inputs[0].borrowed_ref"
+//@ is "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.inputs[0].borrowed_ref.lifetime" "\"'b\""
+//@ has "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.output.borrowed_ref"
+//@ is "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.output.borrowed_ref.lifetime" "\"'b\""
 pub type RefFn<'a> = &'a dyn for<'b> Fn(&'b i32) -> &'b i32;
 
-//@ is    "$.index[*][?(@.name=='WeirdOrder')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].trait.path" '"Send"'
-//@ is    "$.index[*][?(@.name=='WeirdOrder')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[1].trait.path" '"Debug"'
+//@ is    "$.index[?(@.name=='WeirdOrder')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].trait.path" '"Send"'
+//@ is    "$.index[?(@.name=='WeirdOrder')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[1].trait.path" '"Debug"'
 pub type WeirdOrder = Box<dyn Send + Debug>;
diff --git a/tests/rustdoc-json/type/extern.rs b/tests/rustdoc-json/type/extern.rs
index 97e1c3760ee..7963690e448 100644
--- a/tests/rustdoc-json/type/extern.rs
+++ b/tests/rustdoc-json/type/extern.rs
@@ -5,5 +5,5 @@ extern "C" {
     pub type Foo;
 }
 
-//@ is "$.index[*][?(@.docs=='No inner information')].name" '"Foo"'
-//@ is "$.index[*][?(@.docs=='No inner information')].inner" \"extern_type\"
+//@ is "$.index[?(@.docs=='No inner information')].name" '"Foo"'
+//@ is "$.index[?(@.docs=='No inner information')].inner" \"extern_type\"
diff --git a/tests/rustdoc-json/type/fn_lifetime.rs b/tests/rustdoc-json/type/fn_lifetime.rs
index aaa716bf11f..10e95cc5e56 100644
--- a/tests/rustdoc-json/type/fn_lifetime.rs
+++ b/tests/rustdoc-json/type/fn_lifetime.rs
@@ -1,24 +1,24 @@
-//@ has "$.index[*][?(@.name=='GenericFn')].inner.type_alias"
+//@ has "$.index[?(@.name=='GenericFn')].inner.type_alias"
 
-//@ ismany "$.index[*][?(@.name=='GenericFn')].inner.type_alias.generics.params[*].name" \"\'a\"
-//@ has    "$.index[*][?(@.name=='GenericFn')].inner.type_alias.generics.params[*].kind.lifetime"
-//@ count  "$.index[*][?(@.name=='GenericFn')].inner.type_alias.generics.params[*].kind.lifetime.outlives[*]" 0
-//@ count  "$.index[*][?(@.name=='GenericFn')].inner.type_alias.generics.where_predicates[*]" 0
-//@ count  "$.index[*][?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.generic_params[*]" 0
-//@ count  "$.index[*][?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.sig.inputs[*]" 1
-//@ is     "$.index[*][?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.sig.inputs[*][1].borrowed_ref.lifetime" \"\'a\"
-//@ is     "$.index[*][?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.sig.output.borrowed_ref.lifetime" \"\'a\"
+//@ ismany "$.index[?(@.name=='GenericFn')].inner.type_alias.generics.params[*].name" \"\'a\"
+//@ has    "$.index[?(@.name=='GenericFn')].inner.type_alias.generics.params[*].kind.lifetime"
+//@ count  "$.index[?(@.name=='GenericFn')].inner.type_alias.generics.params[*].kind.lifetime.outlives[*]" 0
+//@ count  "$.index[?(@.name=='GenericFn')].inner.type_alias.generics.where_predicates[*]" 0
+//@ count  "$.index[?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.generic_params[*]" 0
+//@ count  "$.index[?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.sig.inputs[*]" 1
+//@ is     "$.index[?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.sig.inputs[*][1].borrowed_ref.lifetime" \"\'a\"
+//@ is     "$.index[?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.sig.output.borrowed_ref.lifetime" \"\'a\"
 
 pub type GenericFn<'a> = fn(&'a i32) -> &'a i32;
 
-//@ has    "$.index[*][?(@.name=='ForAll')].inner.type_alias"
-//@ count "$.index[*][?(@.name=='ForAll')].inner.type_alias.generics.params[*]" 0
-//@ count "$.index[*][?(@.name=='ForAll')].inner.type_alias.generics.where_predicates[*]" 0
-//@ count "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*]" 1
-//@ is    "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*].name" \"\'a\"
-//@ has   "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*].kind.lifetime"
-//@ count "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*].kind.lifetime.outlives[*]" 0
-//@ count "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.sig.inputs[*]" 1
-//@ is    "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.sig.inputs[*][1].borrowed_ref.lifetime" \"\'a\"
-//@ is    "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.sig.output.borrowed_ref.lifetime" \"\'a\"
+//@ has    "$.index[?(@.name=='ForAll')].inner.type_alias"
+//@ count "$.index[?(@.name=='ForAll')].inner.type_alias.generics.params[*]" 0
+//@ count "$.index[?(@.name=='ForAll')].inner.type_alias.generics.where_predicates[*]" 0
+//@ count "$.index[?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*]" 1
+//@ is    "$.index[?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*].name" \"\'a\"
+//@ has   "$.index[?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*].kind.lifetime"
+//@ count "$.index[?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*].kind.lifetime.outlives[*]" 0
+//@ count "$.index[?(@.name=='ForAll')].inner.type_alias.type.function_pointer.sig.inputs[*]" 1
+//@ is    "$.index[?(@.name=='ForAll')].inner.type_alias.type.function_pointer.sig.inputs[*][1].borrowed_ref.lifetime" \"\'a\"
+//@ is    "$.index[?(@.name=='ForAll')].inner.type_alias.type.function_pointer.sig.output.borrowed_ref.lifetime" \"\'a\"
 pub type ForAll = for<'a> fn(&'a i32) -> &'a i32;
diff --git a/tests/rustdoc-json/type/generic_default.rs b/tests/rustdoc-json/type/generic_default.rs
index 2d2ce9cd103..26a232a1562 100644
--- a/tests/rustdoc-json/type/generic_default.rs
+++ b/tests/rustdoc-json/type/generic_default.rs
@@ -1,31 +1,31 @@
-//@ set result = "$.index[*][?(@.name=='Result')].id"
+//@ set result = "$.index[?(@.name=='Result')].id"
 pub enum Result<T, E> {
     Ok(T),
     Err(E),
 }
 
-//@ set my_error = "$.index[*][?(@.name=='MyError')].id"
+//@ set my_error = "$.index[?(@.name=='MyError')].id"
 pub struct MyError {}
 
-//@ has    "$.index[*][?(@.name=='MyResult')].inner.type_alias"
-//@ count "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.where_predicates[*]" 0
-//@ count "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[*]" 2
-//@ is    "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[0].name" \"T\"
-//@ is    "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[1].name" \"E\"
-//@ has   "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[0].kind.type"
-//@ has   "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type"
-//@ count "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[0].kind.type.bounds[*]" 0
-//@ count "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.bounds[*]" 0
-//@ is    "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[0].kind.type.default" null
-//@ has    "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.default.resolved_path"
-//@ is    "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.default.resolved_path.id" $my_error
-//@ is    "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.default.resolved_path.path" \"MyError\"
-//@ has    "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path"
-//@ is    "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.id" $result
-//@ is    "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.path" \"Result\"
-//@ is    "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.constraints" []
-//@ has    "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.generic"
-//@ has    "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[1].type.generic"
-//@ is    "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.generic" \"T\"
-//@ is    "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[1].type.generic" \"E\"
+//@ has    "$.index[?(@.name=='MyResult')].inner.type_alias"
+//@ count "$.index[?(@.name=='MyResult')].inner.type_alias.generics.where_predicates[*]" 0
+//@ count "$.index[?(@.name=='MyResult')].inner.type_alias.generics.params[*]" 2
+//@ is    "$.index[?(@.name=='MyResult')].inner.type_alias.generics.params[0].name" \"T\"
+//@ is    "$.index[?(@.name=='MyResult')].inner.type_alias.generics.params[1].name" \"E\"
+//@ has   "$.index[?(@.name=='MyResult')].inner.type_alias.generics.params[0].kind.type"
+//@ has   "$.index[?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type"
+//@ count "$.index[?(@.name=='MyResult')].inner.type_alias.generics.params[0].kind.type.bounds[*]" 0
+//@ count "$.index[?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.bounds[*]" 0
+//@ is    "$.index[?(@.name=='MyResult')].inner.type_alias.generics.params[0].kind.type.default" null
+//@ has    "$.index[?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.default.resolved_path"
+//@ is    "$.index[?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.default.resolved_path.id" $my_error
+//@ is    "$.index[?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.default.resolved_path.path" \"MyError\"
+//@ has    "$.index[?(@.name=='MyResult')].inner.type_alias.type.resolved_path"
+//@ is    "$.index[?(@.name=='MyResult')].inner.type_alias.type.resolved_path.id" $result
+//@ is    "$.index[?(@.name=='MyResult')].inner.type_alias.type.resolved_path.path" \"Result\"
+//@ is    "$.index[?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.constraints" []
+//@ has    "$.index[?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.generic"
+//@ has    "$.index[?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[1].type.generic"
+//@ is    "$.index[?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.generic" \"T\"
+//@ is    "$.index[?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[1].type.generic" \"E\"
 pub type MyResult<T, E = MyError> = Result<T, E>;
diff --git a/tests/rustdoc-json/type/hrtb.rs b/tests/rustdoc-json/type/hrtb.rs
index 08b35b90a2b..68b7a556a69 100644
--- a/tests/rustdoc-json/type/hrtb.rs
+++ b/tests/rustdoc-json/type/hrtb.rs
@@ -1,5 +1,5 @@
-//@ is "$.index[*][?(@.name=='genfn')].inner.function.generics.where_predicates[0].bound_predicate.type" '{"generic": "F"}'
-//@ is "$.index[*][?(@.name=='genfn')].inner.function.generics.where_predicates[0].bound_predicate.generic_params" '[{"kind": {"lifetime": {"outlives": []}},"name": "'\''a"},{"kind": {"lifetime": {"outlives": []}},"name": "'\''b"}]'
+//@ is "$.index[?(@.name=='genfn')].inner.function.generics.where_predicates[0].bound_predicate.type" '{"generic": "F"}'
+//@ is "$.index[?(@.name=='genfn')].inner.function.generics.where_predicates[0].bound_predicate.generic_params" '[{"kind": {"lifetime": {"outlives": []}},"name": "'\''a"},{"kind": {"lifetime": {"outlives": []}},"name": "'\''b"}]'
 pub fn genfn<F>(f: F)
 where
     for<'a, 'b> F: Fn(&'a i32, &'b i32),
@@ -8,12 +8,12 @@ where
     f(&zero, &zero);
 }
 
-//@ is "$.index[*][?(@.name=='dynfn')].inner.function.generics" '{"params": [], "where_predicates": []}'
-//@ is "$.index[*][?(@.name=='dynfn')].inner.function.generics" '{"params": [], "where_predicates": []}'
-//@ is "$.index[*][?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.lifetime" null
-//@ count "$.index[*][?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.traits[*]" 1
-//@ is "$.index[*][?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.traits[0].generic_params" '[{"kind": {"lifetime": {"outlives": []}},"name": "'\''a"},{"kind": {"lifetime": {"outlives": []}},"name": "'\''b"}]'
-//@ is "$.index[*][?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.traits[0].trait.path" '"Fn"'
+//@ is "$.index[?(@.name=='dynfn')].inner.function.generics" '{"params": [], "where_predicates": []}'
+//@ is "$.index[?(@.name=='dynfn')].inner.function.generics" '{"params": [], "where_predicates": []}'
+//@ is "$.index[?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.lifetime" null
+//@ count "$.index[?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.traits[*]" 1
+//@ is "$.index[?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.traits[0].generic_params" '[{"kind": {"lifetime": {"outlives": []}},"name": "'\''a"},{"kind": {"lifetime": {"outlives": []}},"name": "'\''b"}]'
+//@ is "$.index[?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.traits[0].trait.path" '"Fn"'
 pub fn dynfn(f: &dyn for<'a, 'b> Fn(&'a i32, &'b i32)) {
     let zero = 0;
     f(&zero, &zero);
diff --git a/tests/rustdoc-json/type/inherent_associated_type.rs b/tests/rustdoc-json/type/inherent_associated_type.rs
index e26f8f7c651..e96a92f7cfb 100644
--- a/tests/rustdoc-json/type/inherent_associated_type.rs
+++ b/tests/rustdoc-json/type/inherent_associated_type.rs
@@ -1,23 +1,23 @@
 #![feature(inherent_associated_types)]
 #![allow(incomplete_features)]
 
-//@ set OwnerMetadata = '$.index[*][?(@.name=="OwnerMetadata")].id'
+//@ set OwnerMetadata = '$.index[?(@.name=="OwnerMetadata")].id'
 pub struct OwnerMetadata;
-//@ set Owner = '$.index[*][?(@.name=="Owner")].id'
+//@ set Owner = '$.index[?(@.name=="Owner")].id'
 pub struct Owner;
 
 pub fn create() -> Owner::Metadata {
     OwnerMetadata
 }
-//@ is '$.index[*][?(@.name=="create")].inner.function.sig.output.qualified_path.name' '"Metadata"'
-//@ is '$.index[*][?(@.name=="create")].inner.function.sig.output.qualified_path.trait' null
-//@ is '$.index[*][?(@.name=="create")].inner.function.sig.output.qualified_path.self_type.resolved_path.id' $Owner
+//@ is '$.index[?(@.name=="create")].inner.function.sig.output.qualified_path.name' '"Metadata"'
+//@ is '$.index[?(@.name=="create")].inner.function.sig.output.qualified_path.trait' null
+//@ is '$.index[?(@.name=="create")].inner.function.sig.output.qualified_path.self_type.resolved_path.id' $Owner
 
 /// impl
 impl Owner {
     /// iat
     pub type Metadata = OwnerMetadata;
 }
-//@ set iat = '$.index[*][?(@.docs=="iat")].id'
-//@ is '$.index[*][?(@.docs=="impl")].inner.impl.items[*]' $iat
-//@ is '$.index[*][?(@.docs=="iat")].inner.assoc_type.type.resolved_path.id' $OwnerMetadata
+//@ set iat = '$.index[?(@.docs=="iat")].id'
+//@ is '$.index[?(@.docs=="impl")].inner.impl.items[*]' $iat
+//@ is '$.index[?(@.docs=="iat")].inner.assoc_type.type.resolved_path.id' $OwnerMetadata
diff --git a/tests/rustdoc-json/type/inherent_associated_type_bound.rs b/tests/rustdoc-json/type/inherent_associated_type_bound.rs
index 22c9c9c1149..20354909f8e 100644
--- a/tests/rustdoc-json/type/inherent_associated_type_bound.rs
+++ b/tests/rustdoc-json/type/inherent_associated_type_bound.rs
@@ -1,17 +1,17 @@
 #![feature(inherent_associated_types)]
 #![allow(incomplete_features)]
 
-//@ set Carrier = '$.index[*][?(@.name=="Carrier")].id'
+//@ set Carrier = '$.index[?(@.name=="Carrier")].id'
 pub struct Carrier<'a>(&'a ());
 
-//@ count "$.index[*][?(@.name=='user')].inner.function.sig.inputs[*]" 1
-//@ is "$.index[*][?(@.name=='user')].inner.function.sig.inputs[0][0]" '"_"'
-//@ is '$.index[*][?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.generic_params[*].name' \""'b"\"
-//@ is '$.index[*][?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.self_type.resolved_path.id' $Carrier
-//@ is '$.index[*][?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.self_type.resolved_path.args.angle_bracketed.args[0].lifetime' \""'b"\"
-//@ is '$.index[*][?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.name' '"Focus"'
-//@ is '$.index[*][?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.trait' null
-//@ is '$.index[*][?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.args.angle_bracketed.args[0].type.primitive' '"i32"'
+//@ count "$.index[?(@.name=='user')].inner.function.sig.inputs[*]" 1
+//@ is "$.index[?(@.name=='user')].inner.function.sig.inputs[0][0]" '"_"'
+//@ is '$.index[?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.generic_params[*].name' \""'b"\"
+//@ is '$.index[?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.self_type.resolved_path.id' $Carrier
+//@ is '$.index[?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.self_type.resolved_path.args.angle_bracketed.args[0].lifetime' \""'b"\"
+//@ is '$.index[?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.name' '"Focus"'
+//@ is '$.index[?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.trait' null
+//@ is '$.index[?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.args.angle_bracketed.args[0].type.primitive' '"i32"'
 pub fn user(_: for<'b> fn(Carrier<'b>::Focus<i32>)) {}
 
 impl<'a> Carrier<'a> {
diff --git a/tests/rustdoc-json/type/inherent_associated_type_projections.rs b/tests/rustdoc-json/type/inherent_associated_type_projections.rs
index 501694dce8b..934daba11bb 100644
--- a/tests/rustdoc-json/type/inherent_associated_type_projections.rs
+++ b/tests/rustdoc-json/type/inherent_associated_type_projections.rs
@@ -1,15 +1,15 @@
 #![feature(inherent_associated_types)]
 #![allow(incomplete_features)]
 
-//@ set Parametrized = '$.index[*][?(@.name=="Parametrized")].id'
+//@ set Parametrized = '$.index[?(@.name=="Parametrized")].id'
 pub struct Parametrized<T>(T);
 
-//@ count "$.index[*][?(@.name=='test')].inner.function.sig.inputs[*]" 1
-//@ is "$.index[*][?(@.name=='test')].inner.function.sig.inputs[0][0]" '"_"'
-//@ is '$.index[*][?(@.name=="test")].inner.function.sig.inputs[0][1].qualified_path.self_type.resolved_path.id' $Parametrized
-//@ is '$.index[*][?(@.name=="test")].inner.function.sig.inputs[0][1].qualified_path.self_type.resolved_path.args.angle_bracketed.args[0].type.primitive' \"i32\"
-//@ is '$.index[*][?(@.name=="test")].inner.function.sig.inputs[0][1].qualified_path.name' '"Proj"'
-//@ is '$.index[*][?(@.name=="test")].inner.function.sig.inputs[0][1].qualified_path.trait' null
+//@ count "$.index[?(@.name=='test')].inner.function.sig.inputs[*]" 1
+//@ is "$.index[?(@.name=='test')].inner.function.sig.inputs[0][0]" '"_"'
+//@ is '$.index[?(@.name=="test")].inner.function.sig.inputs[0][1].qualified_path.self_type.resolved_path.id' $Parametrized
+//@ is '$.index[?(@.name=="test")].inner.function.sig.inputs[0][1].qualified_path.self_type.resolved_path.args.angle_bracketed.args[0].type.primitive' \"i32\"
+//@ is '$.index[?(@.name=="test")].inner.function.sig.inputs[0][1].qualified_path.name' '"Proj"'
+//@ is '$.index[?(@.name=="test")].inner.function.sig.inputs[0][1].qualified_path.trait' null
 pub fn test(_: Parametrized<i32>::Proj) {}
 
 /// param_bool
@@ -24,10 +24,10 @@ impl Parametrized<i32> {
     pub type Proj = String;
 }
 
-//@ set param_bool = '$.index[*][?(@.docs=="param_bool")].id'
-//@ set param_i32 = '$.index[*][?(@.docs=="param_i32")].id'
-//@ set param_bool_proj = '$.index[*][?(@.docs=="param_bool_proj")].id'
-//@ set param_i32_proj = '$.index[*][?(@.docs=="param_i32_proj")].id'
+//@ set param_bool = '$.index[?(@.docs=="param_bool")].id'
+//@ set param_i32 = '$.index[?(@.docs=="param_i32")].id'
+//@ set param_bool_proj = '$.index[?(@.docs=="param_bool_proj")].id'
+//@ set param_i32_proj = '$.index[?(@.docs=="param_i32_proj")].id'
 
-//@ is '$.index[*][?(@.docs=="param_bool")].inner.impl.items[*]' $param_bool_proj
-//@ is '$.index[*][?(@.docs=="param_i32")].inner.impl.items[*]' $param_i32_proj
+//@ is '$.index[?(@.docs=="param_bool")].inner.impl.items[*]' $param_bool_proj
+//@ is '$.index[?(@.docs=="param_i32")].inner.impl.items[*]' $param_i32_proj
diff --git a/tests/rustdoc-json/type_alias.rs b/tests/rustdoc-json/type_alias.rs
index 2f2b4c42d44..7fd23a48040 100644
--- a/tests/rustdoc-json/type_alias.rs
+++ b/tests/rustdoc-json/type_alias.rs
@@ -1,15 +1,15 @@
-//@ set IntVec = "$.index[*][?(@.name=='IntVec')].id"
-//@ is "$.index[*][?(@.name=='IntVec')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='IntVec')].inner.type_alias"
-//@ is "$.index[*][?(@.name=='IntVec')].span.filename" $FILE
+//@ set IntVec = "$.index[?(@.name=='IntVec')].id"
+//@ is "$.index[?(@.name=='IntVec')].visibility" \"public\"
+//@ has "$.index[?(@.name=='IntVec')].inner.type_alias"
+//@ is "$.index[?(@.name=='IntVec')].span.filename" $FILE
 pub type IntVec = Vec<u32>;
 
-//@ is "$.index[*][?(@.name=='f')].inner.function.sig.output.resolved_path.id" $IntVec
+//@ is "$.index[?(@.name=='f')].inner.function.sig.output.resolved_path.id" $IntVec
 pub fn f() -> IntVec {
     vec![0; 32]
 }
 
-//@ !is "$.index[*][?(@.name=='g')].inner.function.sig.output.resolved_path.id" $IntVec
+//@ !is "$.index[?(@.name=='g')].inner.function.sig.output.resolved_path.id" $IntVec
 pub fn g() -> Vec<u32> {
     vec![0; 32]
 }
diff --git a/tests/rustdoc-json/unions/field_order.rs b/tests/rustdoc-json/unions/field_order.rs
index a1616f62751..b3a07a13bc8 100644
--- a/tests/rustdoc-json/unions/field_order.rs
+++ b/tests/rustdoc-json/unions/field_order.rs
@@ -15,24 +15,24 @@ pub union Foo {
     pub vll_9: i32,
 }
 
-//@ set 0 = '$.index[*][?(@.name == "ews_0")].id'
-//@ set 1 = '$.index[*][?(@.name == "dik_1")].id'
-//@ set 2 = '$.index[*][?(@.name == "hsk_2")].id'
-//@ set 3 = '$.index[*][?(@.name == "djt_3")].id'
-//@ set 4 = '$.index[*][?(@.name == "jnr_4")].id'
-//@ set 5 = '$.index[*][?(@.name == "dfs_5")].id'
-//@ set 6 = '$.index[*][?(@.name == "bja_6")].id'
-//@ set 7 = '$.index[*][?(@.name == "lyc_7")].id'
-//@ set 8 = '$.index[*][?(@.name == "yqd_8")].id'
-//@ set 9 = '$.index[*][?(@.name == "vll_9")].id'
+//@ set 0 = '$.index[?(@.name == "ews_0")].id'
+//@ set 1 = '$.index[?(@.name == "dik_1")].id'
+//@ set 2 = '$.index[?(@.name == "hsk_2")].id'
+//@ set 3 = '$.index[?(@.name == "djt_3")].id'
+//@ set 4 = '$.index[?(@.name == "jnr_4")].id'
+//@ set 5 = '$.index[?(@.name == "dfs_5")].id'
+//@ set 6 = '$.index[?(@.name == "bja_6")].id'
+//@ set 7 = '$.index[?(@.name == "lyc_7")].id'
+//@ set 8 = '$.index[?(@.name == "yqd_8")].id'
+//@ set 9 = '$.index[?(@.name == "vll_9")].id'
 
-//@ is '$.index[*][?(@.name == "Foo")].inner.union.fields[0]' $0
-//@ is '$.index[*][?(@.name == "Foo")].inner.union.fields[1]' $1
-//@ is '$.index[*][?(@.name == "Foo")].inner.union.fields[2]' $2
-//@ is '$.index[*][?(@.name == "Foo")].inner.union.fields[3]' $3
-//@ is '$.index[*][?(@.name == "Foo")].inner.union.fields[4]' $4
-//@ is '$.index[*][?(@.name == "Foo")].inner.union.fields[5]' $5
-//@ is '$.index[*][?(@.name == "Foo")].inner.union.fields[6]' $6
-//@ is '$.index[*][?(@.name == "Foo")].inner.union.fields[7]' $7
-//@ is '$.index[*][?(@.name == "Foo")].inner.union.fields[8]' $8
-//@ is '$.index[*][?(@.name == "Foo")].inner.union.fields[9]' $9
+//@ is '$.index[?(@.name == "Foo")].inner.union.fields[0]' $0
+//@ is '$.index[?(@.name == "Foo")].inner.union.fields[1]' $1
+//@ is '$.index[?(@.name == "Foo")].inner.union.fields[2]' $2
+//@ is '$.index[?(@.name == "Foo")].inner.union.fields[3]' $3
+//@ is '$.index[?(@.name == "Foo")].inner.union.fields[4]' $4
+//@ is '$.index[?(@.name == "Foo")].inner.union.fields[5]' $5
+//@ is '$.index[?(@.name == "Foo")].inner.union.fields[6]' $6
+//@ is '$.index[?(@.name == "Foo")].inner.union.fields[7]' $7
+//@ is '$.index[?(@.name == "Foo")].inner.union.fields[8]' $8
+//@ is '$.index[?(@.name == "Foo")].inner.union.fields[9]' $9
diff --git a/tests/rustdoc-json/unions/impl.rs b/tests/rustdoc-json/unions/impl.rs
index 989a025f669..6f398cc23f6 100644
--- a/tests/rustdoc-json/unions/impl.rs
+++ b/tests/rustdoc-json/unions/impl.rs
@@ -1,15 +1,15 @@
 #![no_std]
 
-//@ is "$.index[*][?(@.name=='Ux')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='Ux')].inner.union"
+//@ is "$.index[?(@.name=='Ux')].visibility" \"public\"
+//@ has "$.index[?(@.name=='Ux')].inner.union"
 pub union Ux {
     a: u32,
     b: u64,
 }
 
-//@ is "$.index[*][?(@.name=='Num')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='Num')].inner.trait"
+//@ is "$.index[?(@.name=='Num')].visibility" \"public\"
+//@ has "$.index[?(@.name=='Num')].inner.trait"
 pub trait Num {}
 
-//@ count "$.index[*][?(@.name=='Ux')].inner.union.impls" 1
+//@ count "$.index[?(@.name=='Ux')].inner.union.impls" 1
 impl Num for Ux {}
diff --git a/tests/rustdoc-json/unions/union.rs b/tests/rustdoc-json/unions/union.rs
index 7f135a72dec..24ee47f1957 100644
--- a/tests/rustdoc-json/unions/union.rs
+++ b/tests/rustdoc-json/unions/union.rs
@@ -1,14 +1,14 @@
-//@ has "$.index[*][?(@.name=='Union')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='Union')].inner.union"
-//@ !has "$.index[*][?(@.name=='Union')].inner.union.struct_type"
-//@ set Union = "$.index[*][?(@.name=='Union')].id"
+//@ has "$.index[?(@.name=='Union')].visibility" \"public\"
+//@ has "$.index[?(@.name=='Union')].inner.union"
+//@ !has "$.index[?(@.name=='Union')].inner.union.struct_type"
+//@ set Union = "$.index[?(@.name=='Union')].id"
 pub union Union {
     int: i32,
     float: f32,
 }
 
-//@ has "$.index[*][?(@.name=='make_int_union')].inner.function.sig.output.resolved_path"
-//@ is "$.index[*][?(@.name=='make_int_union')].inner.function.sig.output.resolved_path.id" $Union
+//@ has "$.index[?(@.name=='make_int_union')].inner.function.sig.output.resolved_path"
+//@ is "$.index[?(@.name=='make_int_union')].inner.function.sig.output.resolved_path.id" $Union
 pub fn make_int_union(int: i32) -> Union {
     Union { int }
 }
diff --git a/tests/rustdoc-ui/coverage/html.rs b/tests/rustdoc-ui/coverage/html.rs
index 41e1ce1609d..7fd080f0758 100644
--- a/tests/rustdoc-ui/coverage/html.rs
+++ b/tests/rustdoc-ui/coverage/html.rs
@@ -2,3 +2,5 @@
 
 /// Foo
 pub struct Xo;
+
+//~? ERROR `--output-format=html` is not supported for the `--show-coverage` option
diff --git a/tests/rustdoc-ui/deprecated-attrs.rs b/tests/rustdoc-ui/deprecated-attrs.rs
index 3b59e05a012..0ae65a5eaf7 100644
--- a/tests/rustdoc-ui/deprecated-attrs.rs
+++ b/tests/rustdoc-ui/deprecated-attrs.rs
@@ -19,3 +19,7 @@
 //~| NOTE see issue #44136
 //~| NOTE no longer functions
 //~| NOTE `doc(plugins)` is now a no-op
+
+//~? WARN the `passes` flag no longer functions
+//~? NOTE see issue #44136
+//~? HELP you may want to use --document-private-items
diff --git a/tests/rustdoc-ui/doc-cfg-check-cfg.rs b/tests/rustdoc-ui/doc-cfg-check-cfg.rs
new file mode 100644
index 00000000000..e3420dc0789
--- /dev/null
+++ b/tests/rustdoc-ui/doc-cfg-check-cfg.rs
@@ -0,0 +1,16 @@
+// Ensure that `doc(cfg())` respects `check-cfg`
+// Currently not properly working
+#![feature(doc_cfg)]
+#![deny(unexpected_cfgs)]
+
+//@revisions: no_check cfg_empty cfg_foo
+//@[cfg_empty] compile-flags: --check-cfg cfg()
+//@[cfg_foo] compile-flags: --check-cfg cfg(foo)
+
+//@[no_check] check-pass
+//@[cfg_empty] check-pass
+//@[cfg_empty] known-bug: #138358
+//@[cfg_foo] check-pass
+
+#[doc(cfg(foo))]
+pub fn foo() {}
diff --git a/tests/rustdoc-ui/doc-cfg-unstable.rs b/tests/rustdoc-ui/doc-cfg-unstable.rs
new file mode 100644
index 00000000000..14c2e83ec85
--- /dev/null
+++ b/tests/rustdoc-ui/doc-cfg-unstable.rs
@@ -0,0 +1,10 @@
+// #138113: rustdoc didn't gate unstable predicates inside `doc(cfg(..))`
+#![feature(doc_cfg)]
+
+// `cfg_boolean_literals`
+#[doc(cfg(false))] //~ ERROR `cfg(false)` is experimental and subject to change
+pub fn cfg_boolean_literals() {}
+
+// `cfg_version`
+#[doc(cfg(sanitize = "thread"))] //~ ERROR `cfg(sanitize)` is experimental and subject to change
+pub fn cfg_sanitize() {}
diff --git a/tests/rustdoc-ui/doc-cfg-unstable.stderr b/tests/rustdoc-ui/doc-cfg-unstable.stderr
new file mode 100644
index 00000000000..54de3b178ed
--- /dev/null
+++ b/tests/rustdoc-ui/doc-cfg-unstable.stderr
@@ -0,0 +1,23 @@
+error[E0658]: `cfg(false)` is experimental and subject to change
+  --> $DIR/doc-cfg-unstable.rs:5:11
+   |
+LL | #[doc(cfg(false))]
+   |           ^^^^^
+   |
+   = note: see issue #131204 <https://github.com/rust-lang/rust/issues/131204> for more information
+   = help: add `#![feature(cfg_boolean_literals)]` 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]: `cfg(sanitize)` is experimental and subject to change
+  --> $DIR/doc-cfg-unstable.rs:9:11
+   |
+LL | #[doc(cfg(sanitize = "thread"))]
+   |           ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #39699 <https://github.com/rust-lang/rust/issues/39699> for more information
+   = help: add `#![feature(cfg_sanitize)]` 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/rustdoc-ui/doctest-output.rs b/tests/rustdoc-ui/doctest-output.rs
index 720f2952980..28364c3a3ea 100644
--- a/tests/rustdoc-ui/doctest-output.rs
+++ b/tests/rustdoc-ui/doctest-output.rs
@@ -1 +1,3 @@
 //@ compile-flags:-Z unstable-options --show-coverage --output-format=doctest
+
+//~? ERROR `--output-format=doctest` is not supported for the `--show-coverage` option
diff --git a/tests/rustdoc-ui/doctest/display-output.stdout b/tests/rustdoc-ui/doctest/display-output.stdout
index ad25d1ce541..45e107b2c70 100644
--- a/tests/rustdoc-ui/doctest/display-output.stdout
+++ b/tests/rustdoc-ui/doctest/display-output.stdout
@@ -6,7 +6,7 @@ successes:
 
 ---- $DIR/display-output.rs - foo (line 9) stdout ----
 warning: unused variable: `x`
-  --> $DIR/display-output.rs:11:5
+  --> $DIR/display-output.rs:12:5
    |
 LL | let x = 12;
    |     ^ help: if this is intentional, prefix it with an underscore: `_x`
@@ -19,13 +19,13 @@ LL | #![warn(unused)]
    = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]`
 
 warning: unused variable: `x`
-  --> $DIR/display-output.rs:13:8
+  --> $DIR/display-output.rs:14:8
    |
 LL | fn foo(x: &dyn std::fmt::Display) {}
    |        ^ help: if this is intentional, prefix it with an underscore: `_x`
 
 warning: function `foo` is never used
-  --> $DIR/display-output.rs:13:4
+  --> $DIR/display-output.rs:14:4
    |
 LL | fn foo(x: &dyn std::fmt::Display) {}
    |    ^^^
diff --git a/tests/rustdoc-ui/doctest/extern-crate.rs b/tests/rustdoc-ui/doctest/extern-crate.rs
new file mode 100644
index 00000000000..0415d33bb72
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/extern-crate.rs
@@ -0,0 +1,23 @@
+//@ check-pass
+//@ compile-flags:--test --test-args=--test-threads=1
+//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
+//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
+
+// This test ensures that crate imports are placed outside of the `main` function
+// so they work all the time (even in 2015 edition).
+
+/// ```rust
+/// #![feature(test)]
+///
+/// extern crate test;
+/// use test::Bencher;
+///
+/// #[bench]
+/// fn bench_xor_1000_ints(b: &mut Bencher) {
+///     b.iter(|| {
+///         (0..1000).fold(0, |old, new| old ^ new);
+///     });
+/// }
+/// ```
+///
+pub fn foo() {}
diff --git a/tests/rustdoc-ui/doctest/extern-crate.stdout b/tests/rustdoc-ui/doctest/extern-crate.stdout
new file mode 100644
index 00000000000..b103343afdd
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/extern-crate.stdout
@@ -0,0 +1,6 @@
+
+running 1 test
+test $DIR/extern-crate.rs - foo (line 9) ... ok
+
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
+
diff --git a/tests/rustdoc-ui/doctest/per-target-ignores.rs b/tests/rustdoc-ui/doctest/per-target-ignores.rs
new file mode 100644
index 00000000000..3dea7099b4b
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/per-target-ignores.rs
@@ -0,0 +1,14 @@
+//@ only-aarch64
+//@ compile-flags:--test
+//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
+//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
+//@ check-pass
+
+///```ignore-x86_64
+/// assert!(cfg!(not(target_arch = "x86_64")));
+///```
+pub fn foo() -> u8 {
+    4
+}
+
+fn main() {}
diff --git a/tests/rustdoc-ui/doctest/per-target-ignores.stdout b/tests/rustdoc-ui/doctest/per-target-ignores.stdout
new file mode 100644
index 00000000000..fe7282144dd
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/per-target-ignores.stdout
@@ -0,0 +1,6 @@
+
+running 1 test
+test $DIR/per-target-ignores.rs - foo (line 7) ... ok
+
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
+
diff --git a/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout
index 13e142df837..ff26e7e3231 100644
--- a/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout
+++ b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout
@@ -10,8 +10,6 @@ error: couldn't read `$DIR/relative-dir-empty-file`: $FILE_NOT_FOUND_MSG (os err
    |
 LL | let x = include_bytes!("relative-dir-empty-file");
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/rustdoc-ui/extract-doctests.stdout b/tests/rustdoc-ui/extract-doctests.stdout
index fa8604cae94..b11531b844e 100644
--- a/tests/rustdoc-ui/extract-doctests.stdout
+++ b/tests/rustdoc-ui/extract-doctests.stdout
@@ -1 +1 @@
-{"format_version":1,"doctests":[{"file":"$DIR/extract-doctests.rs","line":8,"doctest_attributes":{"original":"ignore (checking attributes)","should_panic":false,"no_run":false,"ignore":"All","rust":true,"test_harness":false,"compile_fail":false,"standalone_crate":false,"error_codes":[],"edition":null,"added_css_classes":[],"unknown":[]},"original_code":"let x = 12;\nlet y = 14;","doctest_code":"#![allow(unused)]\nfn main() {\nlet x = 12;\nlet y = 14;\n}","name":"$DIR/extract-doctests.rs - (line 8)"},{"file":"$DIR/extract-doctests.rs","line":13,"doctest_attributes":{"original":"edition2018,compile_fail","should_panic":false,"no_run":true,"ignore":"None","rust":true,"test_harness":false,"compile_fail":true,"standalone_crate":false,"error_codes":[],"edition":"2018","added_css_classes":[],"unknown":[]},"original_code":"let","doctest_code":"#![allow(unused)]\nfn main() {\nlet\n}","name":"$DIR/extract-doctests.rs - (line 13)"}]}
\ No newline at end of file
+{"format_version":1,"doctests":[{"file":"$DIR/extract-doctests.rs","line":8,"doctest_attributes":{"original":"ignore (checking attributes)","should_panic":false,"no_run":false,"ignore":"All","rust":true,"test_harness":false,"compile_fail":false,"standalone_crate":false,"error_codes":[],"edition":null,"added_css_classes":[],"unknown":[]},"original_code":"let x = 12;\nlet y = 14;","doctest_code":"#![allow(unused)]\nfn main() {\nlet x = 12;\nlet y = 14;\n}","name":"$DIR/extract-doctests.rs - (line 8)"},{"file":"$DIR/extract-doctests.rs","line":13,"doctest_attributes":{"original":"edition2018,compile_fail","should_panic":false,"no_run":true,"ignore":"None","rust":true,"test_harness":false,"compile_fail":true,"standalone_crate":false,"error_codes":[],"edition":"2018","added_css_classes":[],"unknown":[]},"original_code":"let","doctest_code":null,"name":"$DIR/extract-doctests.rs - (line 13)"}]}
\ No newline at end of file
diff --git a/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.rs b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.rs
index babdbd0a692..9d6ec0caf9f 100644
--- a/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.rs
+++ b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.rs
@@ -5,3 +5,5 @@
 //@ check-pass
 
 pub fn f() {}
+
+//~? WARN `--generate-link-to-definition` option can only be used with HTML output format
diff --git a/tests/rustdoc-ui/include-str-bare-urls.rs b/tests/rustdoc-ui/include-str-bare-urls.rs
index c452c88cdd3..f80e28e8ca7 100644
--- a/tests/rustdoc-ui/include-str-bare-urls.rs
+++ b/tests/rustdoc-ui/include-str-bare-urls.rs
@@ -13,3 +13,5 @@
 
 #![deny(rustdoc::bare_urls)]
 #![doc=include_str!("auxiliary/include-str-bare-urls.md")]
+
+//~? ERROR this URL is not a hyperlink
diff --git a/tests/rustdoc-ui/lints/check.rs b/tests/rustdoc-ui/lints/check.rs
index 61c9f188952..0943f9f6053 100644
--- a/tests/rustdoc-ui/lints/check.rs
+++ b/tests/rustdoc-ui/lints/check.rs
@@ -12,3 +12,5 @@
 pub fn foo() {}
 //~^ WARN
 //~^^ WARN
+
+//~? WARN no documentation found for this crate's top-level module
diff --git a/tests/rustdoc-ui/remap-path-prefix-invalid-doctest.stdout b/tests/rustdoc-ui/remap-path-prefix-invalid-doctest.stdout
index a05b5169989..c0d2515998f 100644
--- a/tests/rustdoc-ui/remap-path-prefix-invalid-doctest.stdout
+++ b/tests/rustdoc-ui/remap-path-prefix-invalid-doctest.stdout
@@ -5,11 +5,11 @@ test remapped_path/remap-path-prefix-invalid-doctest.rs - SomeStruct (line 10) .
 failures:
 
 ---- remapped_path/remap-path-prefix-invalid-doctest.rs - SomeStruct (line 10) stdout ----
-error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `is`
+error: expected one of `!` or `::`, found `is`
   --> remapped_path/remap-path-prefix-invalid-doctest.rs:11:6
    |
 LL | this is not real code
-   |      ^^ expected one of 8 possible tokens
+   |      ^^ expected one of `!` or `::`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/rustdoc-ui/remap-path-prefix-lint.rs b/tests/rustdoc-ui/remap-path-prefix-lint.rs
index f27863e825d..d003e19f200 100644
--- a/tests/rustdoc-ui/remap-path-prefix-lint.rs
+++ b/tests/rustdoc-ui/remap-path-prefix-lint.rs
@@ -8,3 +8,5 @@
 
 /// </script>
 pub struct Bar;
+
+//~? ERROR unopened HTML tag `script`
diff --git a/tests/rustdoc-ui/remap-path-prefix-macro.rs b/tests/rustdoc-ui/remap-path-prefix-macro.rs
new file mode 100644
index 00000000000..1be22694b8c
--- /dev/null
+++ b/tests/rustdoc-ui/remap-path-prefix-macro.rs
@@ -0,0 +1,9 @@
+// Regression test for "attempted to remap an already remapped filename" ICE in rustdoc
+// when using --remap-path-prefix with macro rendering.
+// <https://github.com/rust-lang/rust/issues/138520>
+
+//@ compile-flags:-Z unstable-options --remap-path-prefix={{src-base}}=remapped_path
+//@ rustc-env:RUST_BACKTRACE=0
+//@ build-pass
+
+macro_rules! f(() => {});
diff --git a/tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.rs b/tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.rs
index 4fb5c9ab36f..c8e82d3a20b 100644
--- a/tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.rs
+++ b/tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.rs
@@ -5,3 +5,5 @@ pub fn foo() {
   INVALID_FUNC();
   //~^ ERROR could not resolve path
 }
+
+//~? ERROR Compilation failed, aborting rustdoc
diff --git a/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-1.rs b/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-1.rs
index df7b41e20f6..3db7924dbe1 100644
--- a/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-1.rs
+++ b/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-1.rs
@@ -1 +1,3 @@
 //@ compile-flags: -Z unstable-options --scrape-examples-target-crate foobar
+
+//~? ERROR must use --scrape-examples-output-path and --scrape-examples-target-crate together
diff --git a/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-2.rs b/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-2.rs
index ef270a08f48..7b6a30291ce 100644
--- a/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-2.rs
+++ b/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-2.rs
@@ -1 +1,3 @@
 //@ compile-flags: -Z unstable-options --scrape-examples-output-path ex.calls
+
+//~? ERROR must use --scrape-examples-output-path and --scrape-examples-target-crate together
diff --git a/tests/rustdoc-ui/use_both_out_dir_and_output_options.rs b/tests/rustdoc-ui/use_both_out_dir_and_output_options.rs
index 62d3d955855..42847203d48 100644
--- a/tests/rustdoc-ui/use_both_out_dir_and_output_options.rs
+++ b/tests/rustdoc-ui/use_both_out_dir_and_output_options.rs
@@ -1 +1,3 @@
 //@ compile-flags: --output ./foo
+
+//~? ERROR cannot use both 'out-dir' and 'output' at once
diff --git a/tests/rustdoc/deref/deref-methods-24686-target.rs b/tests/rustdoc/deref/deref-methods-24686-target.rs
new file mode 100644
index 00000000000..e019488ca80
--- /dev/null
+++ b/tests/rustdoc/deref/deref-methods-24686-target.rs
@@ -0,0 +1,27 @@
+#![crate_name = "foo"]
+
+// test for https://github.com/rust-lang/rust/issues/24686
+use std::ops::Deref;
+
+pub struct Foo<T>(T);
+impl Foo<i32> {
+    pub fn get_i32(&self) -> i32 { self.0 }
+}
+impl Foo<u32> {
+    pub fn get_u32(&self) -> u32 { self.0 }
+}
+
+// Note that the same href is used both on the method itself,
+// and on the sidebar items.
+//@ has foo/struct.Bar.html
+//@ has - '//a[@href="#method.get_i32"]' 'get_i32'
+//@ !has - '//a[@href="#method.get_u32"]' 'get_u32'
+//@ count - '//ul[@class="block deref-methods"]//a' 1
+//@ count - '//a[@href="#method.get_i32"]' 2
+pub struct Bar(Foo<i32>);
+impl Deref for Bar {
+    type Target = Foo<i32>;
+    fn deref(&self) -> &Foo<i32> {
+        &self.0
+    }
+}
diff --git a/tests/rustdoc/playground.rs b/tests/rustdoc/playground.rs
index db2d1669df6..65dad2a5195 100644
--- a/tests/rustdoc/playground.rs
+++ b/tests/rustdoc/playground.rs
@@ -24,4 +24,4 @@
 
 //@ matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0A++++println!(%22Hello,+world!%22);%0A%7D&edition=2015"]' ""
 //@ matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0A++++println!(%22Hello,+world!%22);%0A%7D&edition=2015"]' ""
-//@ matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0A%23!%5Bfeature(something)%5D%0A%0Afn+main()+%7B%0A++++println!(%22Hello,+world!%22);%0A%7D&version=nightly&edition=2015"]' ""
+//@ matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0A%23!%5Bfeature(something)%5D%0A%0A%0Afn+main()+%7B%0A++++println!(%22Hello,+world!%22);%0A%7D&version=nightly&edition=2015"]' ""
diff --git a/tests/rustdoc/return-type-notation.rs b/tests/rustdoc/return-type-notation.rs
new file mode 100644
index 00000000000..405e98eb28d
--- /dev/null
+++ b/tests/rustdoc/return-type-notation.rs
@@ -0,0 +1,18 @@
+//@ edition: 2021
+
+#![crate_type = "lib"]
+#![feature(return_type_notation)]
+
+pub trait Foo {
+    async fn bar();
+}
+
+//@ has "return_type_notation/fn.foo.html"
+//@ has - '//pre[@class="rust item-decl"]' "pub fn foo<T: Foo<bar(..): Send>>()"
+//@ has - '//pre[@class="rust item-decl"]' "where <T as Foo>::bar(..): 'static, T::bar(..): Sync"
+pub fn foo<T: Foo<bar(..): Send>>()
+where
+    <T as Foo>::bar(..): 'static,
+    T::bar(..): Sync,
+{
+}
diff --git a/tests/ui-fulldeps/internal-lints/import-of-type-ir-traits.rs b/tests/ui-fulldeps/internal-lints/import-of-type-ir-traits.rs
new file mode 100644
index 00000000000..3fdd65d6c87
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/import-of-type-ir-traits.rs
@@ -0,0 +1,16 @@
+//@ compile-flags: -Z unstable-options
+//@ ignore-stage1
+
+#![feature(rustc_private)]
+#![deny(rustc::usage_of_type_ir_traits)]
+
+extern crate rustc_type_ir;
+
+use rustc_type_ir::Interner;
+
+fn foo<I: Interner>(cx: I, did: I::DefId) {
+    let _ = cx.trait_is_unsafe(did);
+    //~^ ERROR do not use `rustc_type_ir::Interner` or `rustc_type_ir::InferCtxtLike` unless you're inside of the trait solver
+}
+
+fn main() {}
diff --git a/tests/ui-fulldeps/internal-lints/import-of-type-ir-traits.stderr b/tests/ui-fulldeps/internal-lints/import-of-type-ir-traits.stderr
new file mode 100644
index 00000000000..df29a494558
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/import-of-type-ir-traits.stderr
@@ -0,0 +1,15 @@
+error: do not use `rustc_type_ir::Interner` or `rustc_type_ir::InferCtxtLike` unless you're inside of the trait solver
+  --> $DIR/import-of-type-ir-traits.rs:12:13
+   |
+LL |     let _ = cx.trait_is_unsafe(did);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: the method or struct you're looking for is likely defined somewhere else downstream in the compiler
+note: the lint level is defined here
+  --> $DIR/import-of-type-ir-traits.rs:5:9
+   |
+LL | #![deny(rustc::usage_of_type_ir_traits)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui-fulldeps/pprust-expr-roundtrip.rs b/tests/ui-fulldeps/pprust-expr-roundtrip.rs
index 37e328a315f..4a866560e79 100644
--- a/tests/ui-fulldeps/pprust-expr-roundtrip.rs
+++ b/tests/ui-fulldeps/pprust-expr-roundtrip.rs
@@ -114,7 +114,6 @@ fn iter_exprs(depth: usize, f: &mut dyn FnMut(P<Expr>)) {
                     rules: BlockCheckMode::Default,
                     span: DUMMY_SP,
                     tokens: None,
-                    could_be_bare_literal: false,
                 });
                 iter_exprs(depth - 1, &mut |e| g(ExprKind::If(e, block.clone(), None)));
             }
diff --git a/tests/ui-fulldeps/run-compiler-twice.rs b/tests/ui-fulldeps/run-compiler-twice.rs
index f414c961627..ffc19b138a5 100644
--- a/tests/ui-fulldeps/run-compiler-twice.rs
+++ b/tests/ui-fulldeps/run-compiler-twice.rs
@@ -46,7 +46,7 @@ fn main() {
 fn compile(code: String, output: PathBuf, sysroot: PathBuf, linker: Option<&Path>) {
     let mut opts = Options::default();
     opts.output_types = OutputTypes::new(&[(OutputType::Exe, None)]);
-    opts.maybe_sysroot = Some(sysroot);
+    opts.sysroot = sysroot;
 
     if let Some(linker) = linker {
         opts.cg.linker = Some(linker.to_owned());
diff --git a/tests/ui-fulldeps/stable-mir/smir_visitor.rs b/tests/ui-fulldeps/stable-mir/smir_visitor.rs
index cffb41742b4..0a579a07cef 100644
--- a/tests/ui-fulldeps/stable-mir/smir_visitor.rs
+++ b/tests/ui-fulldeps/stable-mir/smir_visitor.rs
@@ -18,6 +18,7 @@ extern crate stable_mir;
 
 use rustc_smir::rustc_internal;
 use stable_mir::mir::MirVisitor;
+use stable_mir::mir::MutMirVisitor;
 use stable_mir::*;
 use std::collections::HashSet;
 use std::io::Write;
@@ -99,6 +100,83 @@ impl<'a> mir::MirVisitor for TestVisitor<'a> {
     }
 }
 
+fn test_mut_visitor() -> ControlFlow<()> {
+    let main_fn = stable_mir::entry_fn();
+    let mut main_body = main_fn.unwrap().expect_body();
+    let locals = main_body.locals().to_vec();
+    let mut main_visitor = TestMutVisitor::collect(locals);
+    main_visitor.visit_body(&mut main_body);
+    assert!(main_visitor.ret_val.is_some());
+    assert!(main_visitor.args.is_empty());
+    assert!(main_visitor.tys.contains(&main_visitor.ret_val.unwrap().ty));
+    assert!(!main_visitor.calls.is_empty());
+
+    let exit_fn = main_visitor.calls.last().unwrap();
+    assert!(exit_fn.mangled_name().contains("exit_fn"), "Unexpected last function: {exit_fn:?}");
+
+    let mut exit_body = exit_fn.body().unwrap();
+    let locals = exit_body.locals().to_vec();
+    let mut exit_visitor = TestMutVisitor::collect(locals);
+    exit_visitor.visit_body(&mut exit_body);
+    assert!(exit_visitor.ret_val.is_some());
+    assert_eq!(exit_visitor.args.len(), 1);
+    assert!(exit_visitor.tys.contains(&exit_visitor.ret_val.unwrap().ty));
+    assert!(exit_visitor.tys.contains(&exit_visitor.args[0].ty));
+    ControlFlow::Continue(())
+}
+
+struct TestMutVisitor {
+    locals: Vec<mir::LocalDecl>,
+    pub tys: HashSet<ty::Ty>,
+    pub ret_val: Option<mir::LocalDecl>,
+    pub args: Vec<mir::LocalDecl>,
+    pub calls: Vec<mir::mono::Instance>,
+}
+
+impl TestMutVisitor {
+    fn collect(locals: Vec<mir::LocalDecl>) -> TestMutVisitor {
+        let visitor = TestMutVisitor {
+            locals: locals,
+            tys: Default::default(),
+            ret_val: None,
+            args: vec![],
+            calls: vec![],
+        };
+        visitor
+    }
+}
+
+impl mir::MutMirVisitor for TestMutVisitor {
+    fn visit_ty(&mut self, ty: &mut ty::Ty, _location: mir::visit::Location) {
+        self.tys.insert(*ty);
+        self.super_ty(ty)
+    }
+
+    fn visit_ret_decl(&mut self, local: mir::Local, decl: &mut mir::LocalDecl) {
+        assert!(local == mir::RETURN_LOCAL);
+        assert!(self.ret_val.is_none());
+        self.ret_val = Some(decl.clone());
+        self.super_ret_decl(local, decl);
+    }
+
+    fn visit_arg_decl(&mut self, local: mir::Local, decl: &mut mir::LocalDecl) {
+        self.args.push(decl.clone());
+        assert_eq!(local, self.args.len());
+        self.super_arg_decl(local, decl);
+    }
+
+    fn visit_terminator(&mut self, term: &mut mir::Terminator, location: mir::visit::Location) {
+        if let mir::TerminatorKind::Call { func, .. } = &mut term.kind {
+            let ty::TyKind::RigidTy(ty) = func.ty(&self.locals).unwrap().kind() else {
+                unreachable!()
+            };
+            let ty::RigidTy::FnDef(def, args) = ty else { unreachable!() };
+            self.calls.push(mir::mono::Instance::resolve(def, &args).unwrap());
+        }
+        self.super_terminator(term, location);
+    }
+}
+
 /// This test will generate and analyze a dummy crate using the stable mir.
 /// For that, it will first write the dummy crate into a file.
 /// Then it will create a `StableMir` using custom arguments and then
@@ -113,7 +191,8 @@ fn main() {
         CRATE_NAME.to_string(),
         path.to_string(),
     ];
-    run!(args, test_visitor).unwrap();
+    run!(args.clone(), test_visitor).unwrap();
+    run!(args, test_mut_visitor).unwrap();
 }
 
 fn generate_input(path: &str) -> std::io::Result<()> {
diff --git a/tests/ui/abi/compatibility.rs b/tests/ui/abi/compatibility.rs
index 01d90717107..be649029c86 100644
--- a/tests/ui/abi/compatibility.rs
+++ b/tests/ui/abi/compatibility.rs
@@ -40,6 +40,7 @@
 //@ revisions: loongarch64
 //@[loongarch64] compile-flags: --target loongarch64-unknown-linux-gnu
 //@[loongarch64] needs-llvm-components: loongarch
+//@[loongarch64] min-llvm-version: 20
 //FIXME: wasm is disabled due to <https://github.com/rust-lang/rust/issues/115666>.
 //FIXME @ revisions: wasm
 //FIXME @[wasm] compile-flags: --target wasm32-unknown-unknown
@@ -61,7 +62,6 @@
 //@[nvptx64] needs-llvm-components: nvptx
 #![feature(no_core, rustc_attrs, lang_items)]
 #![feature(unsized_fn_params, transparent_unions)]
-#![no_std]
 #![no_core]
 #![allow(unused, improper_ctypes_definitions, internal_features)]
 
diff --git a/tests/ui/abi/simd-abi-checks-avx.rs b/tests/ui/abi/simd-abi-checks-avx.rs
index acab74300b8..fa4b3ba3054 100644
--- a/tests/ui/abi/simd-abi-checks-avx.rs
+++ b/tests/ui/abi/simd-abi-checks-avx.rs
@@ -1,6 +1,7 @@
 //@ only-x86_64
 //@ build-pass
 //@ ignore-pass (test emits codegen-time warnings)
+//@ compile-flags: -C target-feature=-avx
 
 #![feature(avx512_target_feature)]
 #![feature(portable_simd)]
diff --git a/tests/ui/abi/simd-abi-checks-avx.stderr b/tests/ui/abi/simd-abi-checks-avx.stderr
index 0dddc7dfa1c..5419970f809 100644
--- a/tests/ui/abi/simd-abi-checks-avx.stderr
+++ b/tests/ui/abi/simd-abi-checks-avx.stderr
@@ -1,5 +1,5 @@
 warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
-  --> $DIR/simd-abi-checks-avx.rs:64:11
+  --> $DIR/simd-abi-checks-avx.rs:65:11
    |
 LL |         f(g());
    |           ^^^ function called here
@@ -10,7 +10,7 @@ LL |         f(g());
    = note: `#[warn(abi_unsupported_vector_types)]` on by default
 
 warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
-  --> $DIR/simd-abi-checks-avx.rs:64:9
+  --> $DIR/simd-abi-checks-avx.rs:65:9
    |
 LL |         f(g());
    |         ^^^^^^ function called here
@@ -20,7 +20,7 @@ LL |         f(g());
    = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
 
 warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
-  --> $DIR/simd-abi-checks-avx.rs:72:14
+  --> $DIR/simd-abi-checks-avx.rs:73:14
    |
 LL |         gavx(favx());
    |              ^^^^^^ function called here
@@ -30,7 +30,7 @@ LL |         gavx(favx());
    = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
 
 warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
-  --> $DIR/simd-abi-checks-avx.rs:72:9
+  --> $DIR/simd-abi-checks-avx.rs:73:9
    |
 LL |         gavx(favx());
    |         ^^^^^^^^^^^^ function called here
@@ -40,7 +40,7 @@ LL |         gavx(favx());
    = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
 
 warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
-  --> $DIR/simd-abi-checks-avx.rs:84:19
+  --> $DIR/simd-abi-checks-avx.rs:85:19
    |
 LL |         w(Wrapper(g()));
    |                   ^^^ function called here
@@ -50,7 +50,7 @@ LL |         w(Wrapper(g()));
    = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
 
 warning: this function call uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
-  --> $DIR/simd-abi-checks-avx.rs:84:9
+  --> $DIR/simd-abi-checks-avx.rs:85:9
    |
 LL |         w(Wrapper(g()));
    |         ^^^^^^^^^^^^^^^ function called here
@@ -60,7 +60,7 @@ LL |         w(Wrapper(g()));
    = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
 
 warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
-  --> $DIR/simd-abi-checks-avx.rs:100:9
+  --> $DIR/simd-abi-checks-avx.rs:101:9
    |
 LL |         some_extern();
    |         ^^^^^^^^^^^^^ function called here
@@ -70,7 +70,7 @@ LL |         some_extern();
    = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
 
 warning: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
-  --> $DIR/simd-abi-checks-avx.rs:27:1
+  --> $DIR/simd-abi-checks-avx.rs:28:1
    |
 LL | unsafe extern "C" fn g() -> __m256 {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
@@ -80,7 +80,7 @@ LL | unsafe extern "C" fn g() -> __m256 {
    = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
 
 warning: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
-  --> $DIR/simd-abi-checks-avx.rs:21:1
+  --> $DIR/simd-abi-checks-avx.rs:22:1
    |
 LL | unsafe extern "C" fn f(_: __m256) {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
@@ -90,7 +90,7 @@ LL | unsafe extern "C" fn f(_: __m256) {
    = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
 
 warning: this function definition uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
-  --> $DIR/simd-abi-checks-avx.rs:15:1
+  --> $DIR/simd-abi-checks-avx.rs:16:1
    |
 LL | unsafe extern "C" fn w(_: Wrapper) {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
@@ -100,7 +100,7 @@ LL | unsafe extern "C" fn w(_: Wrapper) {
    = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
 
 warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
-  --> $DIR/simd-abi-checks-avx.rs:57:8
+  --> $DIR/simd-abi-checks-avx.rs:58:8
    |
 LL |     || g()
    |        ^^^ function called here
@@ -113,7 +113,7 @@ warning: 11 warnings emitted
 
 Future incompatibility report: Future breakage diagnostic:
 warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
-  --> $DIR/simd-abi-checks-avx.rs:64:11
+  --> $DIR/simd-abi-checks-avx.rs:65:11
    |
 LL |         f(g());
    |           ^^^ function called here
@@ -125,7 +125,7 @@ LL |         f(g());
 
 Future breakage diagnostic:
 warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
-  --> $DIR/simd-abi-checks-avx.rs:64:9
+  --> $DIR/simd-abi-checks-avx.rs:65:9
    |
 LL |         f(g());
    |         ^^^^^^ function called here
@@ -137,7 +137,7 @@ LL |         f(g());
 
 Future breakage diagnostic:
 warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
-  --> $DIR/simd-abi-checks-avx.rs:72:14
+  --> $DIR/simd-abi-checks-avx.rs:73:14
    |
 LL |         gavx(favx());
    |              ^^^^^^ function called here
@@ -149,7 +149,7 @@ LL |         gavx(favx());
 
 Future breakage diagnostic:
 warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
-  --> $DIR/simd-abi-checks-avx.rs:72:9
+  --> $DIR/simd-abi-checks-avx.rs:73:9
    |
 LL |         gavx(favx());
    |         ^^^^^^^^^^^^ function called here
@@ -161,7 +161,7 @@ LL |         gavx(favx());
 
 Future breakage diagnostic:
 warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
-  --> $DIR/simd-abi-checks-avx.rs:84:19
+  --> $DIR/simd-abi-checks-avx.rs:85:19
    |
 LL |         w(Wrapper(g()));
    |                   ^^^ function called here
@@ -173,7 +173,7 @@ LL |         w(Wrapper(g()));
 
 Future breakage diagnostic:
 warning: this function call uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
-  --> $DIR/simd-abi-checks-avx.rs:84:9
+  --> $DIR/simd-abi-checks-avx.rs:85:9
    |
 LL |         w(Wrapper(g()));
    |         ^^^^^^^^^^^^^^^ function called here
@@ -185,7 +185,7 @@ LL |         w(Wrapper(g()));
 
 Future breakage diagnostic:
 warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
-  --> $DIR/simd-abi-checks-avx.rs:100:9
+  --> $DIR/simd-abi-checks-avx.rs:101:9
    |
 LL |         some_extern();
    |         ^^^^^^^^^^^^^ function called here
@@ -197,7 +197,7 @@ LL |         some_extern();
 
 Future breakage diagnostic:
 warning: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
-  --> $DIR/simd-abi-checks-avx.rs:27:1
+  --> $DIR/simd-abi-checks-avx.rs:28:1
    |
 LL | unsafe extern "C" fn g() -> __m256 {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
@@ -209,7 +209,7 @@ LL | unsafe extern "C" fn g() -> __m256 {
 
 Future breakage diagnostic:
 warning: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
-  --> $DIR/simd-abi-checks-avx.rs:21:1
+  --> $DIR/simd-abi-checks-avx.rs:22:1
    |
 LL | unsafe extern "C" fn f(_: __m256) {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
@@ -221,7 +221,7 @@ LL | unsafe extern "C" fn f(_: __m256) {
 
 Future breakage diagnostic:
 warning: this function definition uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
-  --> $DIR/simd-abi-checks-avx.rs:15:1
+  --> $DIR/simd-abi-checks-avx.rs:16:1
    |
 LL | unsafe extern "C" fn w(_: Wrapper) {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
@@ -233,7 +233,7 @@ LL | unsafe extern "C" fn w(_: Wrapper) {
 
 Future breakage diagnostic:
 warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
-  --> $DIR/simd-abi-checks-avx.rs:57:8
+  --> $DIR/simd-abi-checks-avx.rs:58:8
    |
 LL |     || g()
    |        ^^^ function called here
diff --git a/tests/ui/abi/simd-abi-checks-s390x.rs b/tests/ui/abi/simd-abi-checks-s390x.rs
index 424ac00edcf..3743c75bf1e 100644
--- a/tests/ui/abi/simd-abi-checks-s390x.rs
+++ b/tests/ui/abi/simd-abi-checks-s390x.rs
@@ -1,7 +1,7 @@
 //@ add-core-stubs
 //@ revisions: z10 z13_no_vector z13_soft_float
 //@ build-fail
-//@[z10] compile-flags: --target s390x-unknown-linux-gnu
+//@[z10] compile-flags: --target s390x-unknown-linux-gnu -C target-cpu=z10
 //@[z10] needs-llvm-components: systemz
 //@[z13_no_vector] compile-flags: --target s390x-unknown-linux-gnu -C target-cpu=z13 -C target-feature=-vector
 //@[z13_no_vector] needs-llvm-components: systemz
diff --git a/tests/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr b/tests/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr
index 80ff10e13d8..15314fac37b 100644
--- a/tests/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr
+++ b/tests/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr
@@ -18,7 +18,6 @@ LL | fn oom(
    |    ^^^
 LL |     info: &Layout,
    |     -------------
-   = note: this error originates in the attribute macro `alloc_error_handler` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0308]: mismatched types
   --> $DIR/alloc-error-handler-bad-signature-1.rs:10:1
@@ -35,7 +34,6 @@ LL | |  }
    |
    = note:   expected type `!`
            found unit type `()`
-   = note: this error originates in the attribute macro `alloc_error_handler` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr b/tests/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr
index 7a495380f2b..2ab42638411 100644
--- a/tests/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr
+++ b/tests/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr
@@ -26,7 +26,6 @@ LL | fn oom(
    |    ^^^
 LL |     info: Layout,
    |     ------------
-   = note: this error originates in the attribute macro `alloc_error_handler` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0308]: mismatched types
   --> $DIR/alloc-error-handler-bad-signature-2.rs:10:1
@@ -43,7 +42,6 @@ LL | |  }
    |
    = note:   expected type `!`
            found unit type `()`
-   = note: this error originates in the attribute macro `alloc_error_handler` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr b/tests/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr
index 3be219bdb06..3a410174f54 100644
--- a/tests/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr
+++ b/tests/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr
@@ -14,7 +14,6 @@ note: function defined here
    |
 LL | fn oom() -> ! {
    |    ^^^
-   = note: this error originates in the attribute macro `alloc_error_handler` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/allocator/not-an-allocator.stderr b/tests/ui/allocator/not-an-allocator.stderr
index e1967b70013..079bf9334eb 100644
--- a/tests/ui/allocator/not-an-allocator.stderr
+++ b/tests/ui/allocator/not-an-allocator.stderr
@@ -7,7 +7,6 @@ LL | static A: usize = 0;
    |           ^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
    |
    = help: the trait `GlobalAlloc` is implemented for `System`
-   = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
   --> $DIR/not-an-allocator.rs:2:11
@@ -19,7 +18,6 @@ LL | static A: usize = 0;
    |
    = help: the trait `GlobalAlloc` is implemented for `System`
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-   = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
   --> $DIR/not-an-allocator.rs:2:11
@@ -31,7 +29,6 @@ LL | static A: usize = 0;
    |
    = help: the trait `GlobalAlloc` is implemented for `System`
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-   = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
   --> $DIR/not-an-allocator.rs:2:11
@@ -43,7 +40,6 @@ LL | static A: usize = 0;
    |
    = help: the trait `GlobalAlloc` is implemented for `System`
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-   = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/allocator/two-allocators.stderr b/tests/ui/allocator/two-allocators.stderr
index 1eecbc0a97b..5308232a20b 100644
--- a/tests/ui/allocator/two-allocators.stderr
+++ b/tests/ui/allocator/two-allocators.stderr
@@ -7,8 +7,6 @@ LL | #[global_allocator]
    | ------------------- in this procedural macro expansion
 LL | static B: System = System;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot define a new global allocator
-   |
-   = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/asm/ice-bad-err-span-in-template-129503.stderr b/tests/ui/asm/ice-bad-err-span-in-template-129503.stderr
index ffa9362ed95..066959a052d 100644
--- a/tests/ui/asm/ice-bad-err-span-in-template-129503.stderr
+++ b/tests/ui/asm/ice-bad-err-span-in-template-129503.stderr
@@ -5,7 +5,6 @@ LL |     asm!(concat!(r#"lJ𐏿Æ�.𐏿�"#, "r} {}"));
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unmatched `}` in asm template string
    |
    = note: if you intended to print `}`, you can escape it using `}}`
-   = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: invalid asm template string: unmatched `}` found
   --> $DIR/ice-bad-err-span-in-template-129503.rs:18:10
@@ -14,7 +13,6 @@ LL |     asm!(concat!("abc", "r} {}"));
    |          ^^^^^^^^^^^^^^^^^^^^^^^ unmatched `}` in asm template string
    |
    = note: if you intended to print `}`, you can escape it using `}}`
-   = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: invalid asm template string: unmatched `}` found
   --> $DIR/ice-bad-err-span-in-template-129503.rs:24:19
diff --git a/tests/ui/asm/inline-syntax.rs b/tests/ui/asm/inline-syntax.rs
index adbda369b6a..78f30d50d8c 100644
--- a/tests/ui/asm/inline-syntax.rs
+++ b/tests/ui/asm/inline-syntax.rs
@@ -58,3 +58,8 @@ pub fn main() {
 global_asm!(".intel_syntax noprefix", "nop");
 //[x86_64]~^ WARN avoid using `.intel_syntax`
 // Global assembly errors don't have line numbers, so no error on ARM.
+
+//[arm_llvm_18]~? ERROR unknown directive
+//[arm_llvm_18]~? ERROR unknown directive
+//[arm]~? ERROR unknown directive
+//[arm]~? ERROR unknown directive
diff --git a/tests/ui/asm/loongarch/bad-reg.loongarch64_lp64d.stderr b/tests/ui/asm/loongarch/bad-reg.loongarch64_lp64d.stderr
index 0e544119650..c88f3af7642 100644
--- a/tests/ui/asm/loongarch/bad-reg.loongarch64_lp64d.stderr
+++ b/tests/ui/asm/loongarch/bad-reg.loongarch64_lp64d.stderr
@@ -1,35 +1,35 @@
 error: invalid register `$r0`: constant zero cannot be used as an operand for inline asm
-  --> $DIR/bad-reg.rs:22:18
+  --> $DIR/bad-reg.rs:23:18
    |
 LL |         asm!("", out("$r0") _);
    |                  ^^^^^^^^^^^^
 
 error: invalid register `$tp`: reserved for TLS
-  --> $DIR/bad-reg.rs:24:18
+  --> $DIR/bad-reg.rs:25:18
    |
 LL |         asm!("", out("$tp") _);
    |                  ^^^^^^^^^^^^
 
 error: invalid register `$sp`: the stack pointer cannot be used as an operand for inline asm
-  --> $DIR/bad-reg.rs:26:18
+  --> $DIR/bad-reg.rs:27:18
    |
 LL |         asm!("", out("$sp") _);
    |                  ^^^^^^^^^^^^
 
 error: invalid register `$r21`: reserved by the ABI
-  --> $DIR/bad-reg.rs:28:18
+  --> $DIR/bad-reg.rs:29:18
    |
 LL |         asm!("", out("$r21") _);
    |                  ^^^^^^^^^^^^^
 
 error: invalid register `$fp`: the frame pointer cannot be used as an operand for inline asm
-  --> $DIR/bad-reg.rs:30:18
+  --> $DIR/bad-reg.rs:31:18
    |
 LL |         asm!("", out("$fp") _);
    |                  ^^^^^^^^^^^^
 
 error: invalid register `$r31`: $r31 is used internally by LLVM and cannot be used as an operand for inline asm
-  --> $DIR/bad-reg.rs:32:18
+  --> $DIR/bad-reg.rs:33:18
    |
 LL |         asm!("", out("$r31") _);
    |                  ^^^^^^^^^^^^^
diff --git a/tests/ui/asm/loongarch/bad-reg.loongarch64_lp64s.stderr b/tests/ui/asm/loongarch/bad-reg.loongarch64_lp64s.stderr
index 6d0410dc6a1..cb8e55a9722 100644
--- a/tests/ui/asm/loongarch/bad-reg.loongarch64_lp64s.stderr
+++ b/tests/ui/asm/loongarch/bad-reg.loongarch64_lp64s.stderr
@@ -1,59 +1,59 @@
 error: invalid register `$r0`: constant zero cannot be used as an operand for inline asm
-  --> $DIR/bad-reg.rs:22:18
+  --> $DIR/bad-reg.rs:23:18
    |
 LL |         asm!("", out("$r0") _);
    |                  ^^^^^^^^^^^^
 
 error: invalid register `$tp`: reserved for TLS
-  --> $DIR/bad-reg.rs:24:18
+  --> $DIR/bad-reg.rs:25:18
    |
 LL |         asm!("", out("$tp") _);
    |                  ^^^^^^^^^^^^
 
 error: invalid register `$sp`: the stack pointer cannot be used as an operand for inline asm
-  --> $DIR/bad-reg.rs:26:18
+  --> $DIR/bad-reg.rs:27:18
    |
 LL |         asm!("", out("$sp") _);
    |                  ^^^^^^^^^^^^
 
 error: invalid register `$r21`: reserved by the ABI
-  --> $DIR/bad-reg.rs:28:18
+  --> $DIR/bad-reg.rs:29:18
    |
 LL |         asm!("", out("$r21") _);
    |                  ^^^^^^^^^^^^^
 
 error: invalid register `$fp`: the frame pointer cannot be used as an operand for inline asm
-  --> $DIR/bad-reg.rs:30:18
+  --> $DIR/bad-reg.rs:31:18
    |
 LL |         asm!("", out("$fp") _);
    |                  ^^^^^^^^^^^^
 
 error: invalid register `$r31`: $r31 is used internally by LLVM and cannot be used as an operand for inline asm
-  --> $DIR/bad-reg.rs:32:18
+  --> $DIR/bad-reg.rs:33:18
    |
 LL |         asm!("", out("$r31") _);
    |                  ^^^^^^^^^^^^^
 
 error: register class `freg` requires at least one of the following target features: d, f
-  --> $DIR/bad-reg.rs:36:26
+  --> $DIR/bad-reg.rs:37:26
    |
 LL |         asm!("/* {} */", in(freg) f);
    |                          ^^^^^^^^^^
 
 error: register class `freg` requires at least one of the following target features: d, f
-  --> $DIR/bad-reg.rs:38:26
+  --> $DIR/bad-reg.rs:39:26
    |
 LL |         asm!("/* {} */", out(freg) _);
    |                          ^^^^^^^^^^^
 
 error: register class `freg` requires at least one of the following target features: d, f
-  --> $DIR/bad-reg.rs:40:26
+  --> $DIR/bad-reg.rs:41:26
    |
 LL |         asm!("/* {} */", in(freg) d);
    |                          ^^^^^^^^^^
 
 error: register class `freg` requires at least one of the following target features: d, f
-  --> $DIR/bad-reg.rs:42:26
+  --> $DIR/bad-reg.rs:43:26
    |
 LL |         asm!("/* {} */", out(freg) d);
    |                          ^^^^^^^^^^^
diff --git a/tests/ui/asm/loongarch/bad-reg.rs b/tests/ui/asm/loongarch/bad-reg.rs
index 685b460bc92..db1c778e5a2 100644
--- a/tests/ui/asm/loongarch/bad-reg.rs
+++ b/tests/ui/asm/loongarch/bad-reg.rs
@@ -1,6 +1,7 @@
 //@ add-core-stubs
 //@ needs-asm-support
 //@ revisions: loongarch64_lp64d loongarch64_lp64s
+//@ min-llvm-version: 20
 //@[loongarch64_lp64d] compile-flags: --target loongarch64-unknown-linux-gnu
 //@[loongarch64_lp64d] needs-llvm-components: loongarch
 //@[loongarch64_lp64s] compile-flags: --target loongarch64-unknown-none-softfloat
diff --git a/tests/ui/asm/naked-functions-target-feature.rs b/tests/ui/asm/naked-functions-target-feature.rs
new file mode 100644
index 00000000000..afe1a389147
--- /dev/null
+++ b/tests/ui/asm/naked-functions-target-feature.rs
@@ -0,0 +1,21 @@
+//@ build-pass
+//@ needs-asm-support
+
+#![feature(naked_functions, naked_functions_target_feature)]
+#![crate_type = "lib"]
+
+use std::arch::{asm, naked_asm};
+
+#[cfg(target_arch = "x86_64")]
+#[target_feature(enable = "sse2")]
+#[naked]
+pub unsafe extern "C" fn compatible_target_feature() {
+    naked_asm!("");
+}
+
+#[cfg(target_arch = "aarch64")]
+#[target_feature(enable = "neon")]
+#[naked]
+pub unsafe extern "C" fn compatible_target_feature() {
+    naked_asm!("");
+}
diff --git a/tests/ui/asm/naked-functions.rs b/tests/ui/asm/naked-functions.rs
index e7e5d84f2a5..3d4d414539c 100644
--- a/tests/ui/asm/naked-functions.rs
+++ b/tests/ui/asm/naked-functions.rs
@@ -230,13 +230,6 @@ pub unsafe extern "C" fn compatible_codegen_attributes() {
     naked_asm!("", options(raw));
 }
 
-#[cfg(target_arch = "x86_64")]
-#[target_feature(enable = "sse2")]
-#[naked]
-pub unsafe extern "C" fn compatible_target_feature() {
-    naked_asm!("");
-}
-
 #[doc = "foo bar baz"]
 /// a doc comment
 // a normal comment
diff --git a/tests/ui/asm/x86_64/bad-options.rs b/tests/ui/asm/x86_64/bad-options.rs
index 6424a1b1d42..123febc06fc 100644
--- a/tests/ui/asm/x86_64/bad-options.rs
+++ b/tests/ui/asm/x86_64/bad-options.rs
@@ -1,6 +1,6 @@
 //@ only-x86_64
 
-#![feature(asm_unwind, asm_goto)]
+#![feature(asm_unwind)]
 
 use std::arch::{asm, global_asm};
 
diff --git a/tests/ui/asm/x86_64/goto-block-safe.rs b/tests/ui/asm/x86_64/goto-block-safe.rs
index ee833a48a4b..b739e9f9ced 100644
--- a/tests/ui/asm/x86_64/goto-block-safe.rs
+++ b/tests/ui/asm/x86_64/goto-block-safe.rs
@@ -2,7 +2,6 @@
 //@ needs-asm-support
 
 #![deny(unreachable_code)]
-#![feature(asm_goto)]
 
 use std::arch::asm;
 
diff --git a/tests/ui/asm/x86_64/goto-block-safe.stderr b/tests/ui/asm/x86_64/goto-block-safe.stderr
index 49818db7484..ee7313bc8be 100644
--- a/tests/ui/asm/x86_64/goto-block-safe.stderr
+++ b/tests/ui/asm/x86_64/goto-block-safe.stderr
@@ -1,5 +1,5 @@
 error[E0133]: call to unsafe function `unreachable_unchecked` is unsafe and requires unsafe function or block
-  --> $DIR/goto-block-safe.rs:14:17
+  --> $DIR/goto-block-safe.rs:13:17
    |
 LL |     unsafe {
    |     ------ items do not inherit unsafety from separate enclosing items
diff --git a/tests/ui/asm/x86_64/goto.rs b/tests/ui/asm/x86_64/goto.rs
index 50e7441509a..00a8e588f96 100644
--- a/tests/ui/asm/x86_64/goto.rs
+++ b/tests/ui/asm/x86_64/goto.rs
@@ -3,7 +3,7 @@
 //@ needs-asm-support
 
 #![deny(unreachable_code)]
-#![feature(asm_goto, asm_goto_with_outputs)]
+#![feature(asm_goto_with_outputs)]
 
 use std::arch::asm;
 
diff --git a/tests/ui/asm/x86_64/goto.stderr b/tests/ui/asm/x86_64/goto.stderr
index 8f89e2b1290..78b726b3f3d 100644
--- a/tests/ui/asm/x86_64/goto.stderr
+++ b/tests/ui/asm/x86_64/goto.stderr
@@ -17,7 +17,6 @@ note: the lint level is defined here
    |
 LL | #[warn(unreachable_code)]
    |        ^^^^^^^^^^^^^^^^
-   = note: this warning originates in the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: 1 warning emitted
 
diff --git a/tests/ui/associated-inherent-types/constrain_opaque_types_during_projection.rs b/tests/ui/associated-inherent-types/constrain_opaque_types_during_projection.rs
index 292733cd492..929fa354cd0 100644
--- a/tests/ui/associated-inherent-types/constrain_opaque_types_during_projection.rs
+++ b/tests/ui/associated-inherent-types/constrain_opaque_types_during_projection.rs
@@ -11,7 +11,8 @@ impl Foo<i32> {
 
 type Tait = impl Sized;
 
-fn bar(_: Tait) {
+#[define_opaque(Tait)]
+fn bar() {
     let x: Foo<Tait>::Assoc = 42;
 }
 
diff --git a/tests/ui/associated-inherent-types/issue-109299-1.stderr b/tests/ui/associated-inherent-types/issue-109299-1.stderr
index 77a78da852f..940ccd7e400 100644
--- a/tests/ui/associated-inherent-types/issue-109299-1.stderr
+++ b/tests/ui/associated-inherent-types/issue-109299-1.stderr
@@ -29,7 +29,7 @@ error: unconstrained opaque type
 LL | type X = impl for<T> Fn() -> Lexer<T>::Cursor;
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: `X` must be used in combination with a concrete type within the same module
+   = note: `X` must be used in combination with a concrete type within the same crate
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.stderr b/tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.current.stderr
index 372d379de5a..64304be9d6b 100644
--- a/tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.stderr
+++ b/tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.current.stderr
@@ -1,12 +1,12 @@
 error[E0283]: type annotations needed
-  --> $DIR/dedup-normalized-2-higher-ranked.rs:23:5
+  --> $DIR/dedup-normalized-2-higher-ranked.rs:28:5
    |
 LL |     impls(rigid);
    |     ^^^^^ cannot infer type of the type parameter `U` declared on the function `impls`
    |
    = note: cannot satisfy `for<'b> <P as Trait>::Rigid: Bound<'b, _>`
 note: required by a bound in `impls`
-  --> $DIR/dedup-normalized-2-higher-ranked.rs:20:13
+  --> $DIR/dedup-normalized-2-higher-ranked.rs:25:13
    |
 LL | fn impls<T: for<'b> Bound<'b, U>, U>(_: T) {}
    |             ^^^^^^^^^^^^^^^^^^^^ required by this bound in `impls`
diff --git a/tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.rs b/tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.rs
index 9224d47d30f..32b8c689248 100644
--- a/tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.rs
+++ b/tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.rs
@@ -1,3 +1,8 @@
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
+//@[next] check-pass
+
 // We try to prove `for<'b> T::Rigid: Bound<'b, ?0>` and have 2 candidates from where-clauses:
 //
 // - `for<'a> Bound<'a, String>`
@@ -21,7 +26,7 @@ fn impls<T: for<'b> Bound<'b, U>, U>(_: T) {}
 
 fn test<P: Trait>(rigid: P::Rigid) {
     impls(rigid);
-    //~^ ERROR type annotations needed
+    //[current]~^ ERROR type annotations needed
 }
 
 fn main() {}
diff --git a/tests/ui/associated-type-bounds/dont-imply-atb-in-closure-inference.rs b/tests/ui/associated-type-bounds/dont-imply-atb-in-closure-inference.rs
index fecb3b15338..1cfbefb9daa 100644
--- a/tests/ui/associated-type-bounds/dont-imply-atb-in-closure-inference.rs
+++ b/tests/ui/associated-type-bounds/dont-imply-atb-in-closure-inference.rs
@@ -11,10 +11,8 @@ impl<T> IsPtr for T {
 
 type Tait = impl IsPtr<Assoc: Fn(i32)> + Fn(u32);
 
-fn hello()
-where
-    Tait:,
-{
+#[define_opaque(Tait)]
+fn hello() {
     let _: Tait = |x| {};
 }
 
diff --git a/tests/ui/associated-type-bounds/duplicate.rs b/tests/ui/associated-type-bounds/duplicate.rs
index 2b4a01376d7..e9d94787e98 100644
--- a/tests/ui/associated-type-bounds/duplicate.rs
+++ b/tests/ui/associated-type-bounds/duplicate.rs
@@ -179,19 +179,25 @@ where
 
 type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
 //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
+//~| ERROR unconstrained opaque type
 type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
 //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
+//~| ERROR unconstrained opaque type
 type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
 //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
+//~| ERROR unconstrained opaque type
 type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
 //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
 //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
+//~| ERROR unconstrained opaque type
 type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
 //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
 //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
+//~| ERROR unconstrained opaque type
 type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
 //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
 //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
+//~| ERROR unconstrained opaque type
 
 trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
 //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
diff --git a/tests/ui/associated-type-bounds/duplicate.stderr b/tests/ui/associated-type-bounds/duplicate.stderr
index 0dabcbdce1b..1ce212a9ff3 100644
--- a/tests/ui/associated-type-bounds/duplicate.stderr
+++ b/tests/ui/associated-type-bounds/duplicate.stderr
@@ -325,7 +325,7 @@ LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
    |                        `Item` bound here first
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:182:36
+  --> $DIR/duplicate.rs:183:36
    |
 LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
    |                        ----------  ^^^^^^^^^^ re-bound here
@@ -333,7 +333,7 @@ LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
    |                        `Item` bound here first
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:184:39
+  --> $DIR/duplicate.rs:186:39
    |
 LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
    |                        -------------  ^^^^^^^^^^^^^ re-bound here
@@ -341,7 +341,7 @@ LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
    |                        `Item` bound here first
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:186:40
+  --> $DIR/duplicate.rs:189:40
    |
 LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
    |                            ----------  ^^^^^^^^^^ re-bound here
@@ -349,7 +349,7 @@ LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
    |                            `Item` bound here first
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:186:40
+  --> $DIR/duplicate.rs:189:40
    |
 LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
    |                            ----------  ^^^^^^^^^^ re-bound here
@@ -359,7 +359,7 @@ LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:189:40
+  --> $DIR/duplicate.rs:193:40
    |
 LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
    |                            ----------  ^^^^^^^^^^ re-bound here
@@ -367,7 +367,7 @@ LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
    |                            `Item` bound here first
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:189:40
+  --> $DIR/duplicate.rs:193:40
    |
 LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
    |                            ----------  ^^^^^^^^^^ re-bound here
@@ -377,7 +377,7 @@ LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:192:43
+  --> $DIR/duplicate.rs:197:43
    |
 LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
    |                            -------------  ^^^^^^^^^^^^^ re-bound here
@@ -385,7 +385,7 @@ LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
    |                            `Item` bound here first
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:192:43
+  --> $DIR/duplicate.rs:197:43
    |
 LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
    |                            -------------  ^^^^^^^^^^^^^ re-bound here
@@ -395,7 +395,7 @@ LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:196:36
+  --> $DIR/duplicate.rs:202:36
    |
 LL | trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
    |                        ----------  ^^^^^^^^^^ re-bound here
@@ -403,7 +403,7 @@ LL | trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
    |                        `Item` bound here first
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:198:36
+  --> $DIR/duplicate.rs:204:36
    |
 LL | trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
    |                        ----------  ^^^^^^^^^^ re-bound here
@@ -411,7 +411,7 @@ LL | trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
    |                        `Item` bound here first
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:200:39
+  --> $DIR/duplicate.rs:206:39
    |
 LL | trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
    |                        -------------  ^^^^^^^^^^^^^ re-bound here
@@ -419,7 +419,7 @@ LL | trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
    |                        `Item` bound here first
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:202:34
+  --> $DIR/duplicate.rs:208:34
    |
 LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
    |                      ----------  ^^^^^^^^^^ re-bound here
@@ -427,7 +427,7 @@ LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
    |                      `Item` bound here first
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:202:34
+  --> $DIR/duplicate.rs:208:34
    |
 LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
    |                      ----------  ^^^^^^^^^^ re-bound here
@@ -437,7 +437,7 @@ LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:202:34
+  --> $DIR/duplicate.rs:208:34
    |
 LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
    |                      ----------  ^^^^^^^^^^ re-bound here
@@ -447,7 +447,7 @@ LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:206:34
+  --> $DIR/duplicate.rs:212:34
    |
 LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
    |                      ----------  ^^^^^^^^^^ re-bound here
@@ -455,7 +455,7 @@ LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
    |                      `Item` bound here first
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:206:34
+  --> $DIR/duplicate.rs:212:34
    |
 LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
    |                      ----------  ^^^^^^^^^^ re-bound here
@@ -465,7 +465,7 @@ LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:206:34
+  --> $DIR/duplicate.rs:212:34
    |
 LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
    |                      ----------  ^^^^^^^^^^ re-bound here
@@ -475,7 +475,7 @@ LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:210:37
+  --> $DIR/duplicate.rs:216:37
    |
 LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
    |                      -------------  ^^^^^^^^^^^^^ re-bound here
@@ -483,7 +483,7 @@ LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
    |                      `Item` bound here first
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:210:37
+  --> $DIR/duplicate.rs:216:37
    |
 LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
    |                      -------------  ^^^^^^^^^^^^^ re-bound here
@@ -493,7 +493,7 @@ LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:210:37
+  --> $DIR/duplicate.rs:216:37
    |
 LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
    |                      -------------  ^^^^^^^^^^^^^ re-bound here
@@ -503,7 +503,7 @@ LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:216:29
+  --> $DIR/duplicate.rs:222:29
    |
 LL |     T: Iterator<Item: Copy, Item: Send>,
    |                 ----------  ^^^^^^^^^^ re-bound here
@@ -511,7 +511,7 @@ LL |     T: Iterator<Item: Copy, Item: Send>,
    |                 `Item` bound here first
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:222:29
+  --> $DIR/duplicate.rs:228:29
    |
 LL |     T: Iterator<Item: Copy, Item: Copy>,
    |                 ----------  ^^^^^^^^^^ re-bound here
@@ -519,7 +519,7 @@ LL |     T: Iterator<Item: Copy, Item: Copy>,
    |                 `Item` bound here first
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:228:32
+  --> $DIR/duplicate.rs:234:32
    |
 LL |     T: Iterator<Item: 'static, Item: 'static>,
    |                 -------------  ^^^^^^^^^^^^^ re-bound here
@@ -527,7 +527,7 @@ LL |     T: Iterator<Item: 'static, Item: 'static>,
    |                 `Item` bound here first
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:234:32
+  --> $DIR/duplicate.rs:240:32
    |
 LL |     Self: Iterator<Item: Copy, Item: Send>,
    |                    ----------  ^^^^^^^^^^ re-bound here
@@ -535,7 +535,7 @@ LL |     Self: Iterator<Item: Copy, Item: Send>,
    |                    `Item` bound here first
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:234:32
+  --> $DIR/duplicate.rs:240:32
    |
 LL |     Self: Iterator<Item: Copy, Item: Send>,
    |                    ----------  ^^^^^^^^^^ re-bound here
@@ -545,7 +545,7 @@ LL |     Self: Iterator<Item: Copy, Item: Send>,
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:234:32
+  --> $DIR/duplicate.rs:240:32
    |
 LL |     Self: Iterator<Item: Copy, Item: Send>,
    |                    ----------  ^^^^^^^^^^ re-bound here
@@ -555,7 +555,7 @@ LL |     Self: Iterator<Item: Copy, Item: Send>,
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:242:32
+  --> $DIR/duplicate.rs:248:32
    |
 LL |     Self: Iterator<Item: Copy, Item: Copy>,
    |                    ----------  ^^^^^^^^^^ re-bound here
@@ -563,7 +563,7 @@ LL |     Self: Iterator<Item: Copy, Item: Copy>,
    |                    `Item` bound here first
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:242:32
+  --> $DIR/duplicate.rs:248:32
    |
 LL |     Self: Iterator<Item: Copy, Item: Copy>,
    |                    ----------  ^^^^^^^^^^ re-bound here
@@ -573,7 +573,7 @@ LL |     Self: Iterator<Item: Copy, Item: Copy>,
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:242:32
+  --> $DIR/duplicate.rs:248:32
    |
 LL |     Self: Iterator<Item: Copy, Item: Copy>,
    |                    ----------  ^^^^^^^^^^ re-bound here
@@ -583,7 +583,7 @@ LL |     Self: Iterator<Item: Copy, Item: Copy>,
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:250:35
+  --> $DIR/duplicate.rs:256:35
    |
 LL |     Self: Iterator<Item: 'static, Item: 'static>,
    |                    -------------  ^^^^^^^^^^^^^ re-bound here
@@ -591,7 +591,7 @@ LL |     Self: Iterator<Item: 'static, Item: 'static>,
    |                    `Item` bound here first
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:250:35
+  --> $DIR/duplicate.rs:256:35
    |
 LL |     Self: Iterator<Item: 'static, Item: 'static>,
    |                    -------------  ^^^^^^^^^^^^^ re-bound here
@@ -601,7 +601,7 @@ LL |     Self: Iterator<Item: 'static, Item: 'static>,
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:250:35
+  --> $DIR/duplicate.rs:256:35
    |
 LL |     Self: Iterator<Item: 'static, Item: 'static>,
    |                    -------------  ^^^^^^^^^^^^^ re-bound here
@@ -611,7 +611,7 @@ LL |     Self: Iterator<Item: 'static, Item: 'static>,
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:257:34
+  --> $DIR/duplicate.rs:263:34
    |
 LL |     type A: Iterator<Item: Copy, Item: Send>;
    |                      ----------  ^^^^^^^^^^ re-bound here
@@ -619,7 +619,7 @@ LL |     type A: Iterator<Item: Copy, Item: Send>;
    |                      `Item` bound here first
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:257:34
+  --> $DIR/duplicate.rs:263:34
    |
 LL |     type A: Iterator<Item: Copy, Item: Send>;
    |                      ----------  ^^^^^^^^^^ re-bound here
@@ -629,7 +629,7 @@ LL |     type A: Iterator<Item: Copy, Item: Send>;
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:262:34
+  --> $DIR/duplicate.rs:268:34
    |
 LL |     type A: Iterator<Item: Copy, Item: Copy>;
    |                      ----------  ^^^^^^^^^^ re-bound here
@@ -637,7 +637,7 @@ LL |     type A: Iterator<Item: Copy, Item: Copy>;
    |                      `Item` bound here first
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:262:34
+  --> $DIR/duplicate.rs:268:34
    |
 LL |     type A: Iterator<Item: Copy, Item: Copy>;
    |                      ----------  ^^^^^^^^^^ re-bound here
@@ -647,7 +647,7 @@ LL |     type A: Iterator<Item: Copy, Item: Copy>;
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:267:37
+  --> $DIR/duplicate.rs:273:37
    |
 LL |     type A: Iterator<Item: 'static, Item: 'static>;
    |                      -------------  ^^^^^^^^^^^^^ re-bound here
@@ -655,7 +655,7 @@ LL |     type A: Iterator<Item: 'static, Item: 'static>;
    |                      `Item` bound here first
 
 error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
-  --> $DIR/duplicate.rs:267:37
+  --> $DIR/duplicate.rs:273:37
    |
 LL |     type A: Iterator<Item: 'static, Item: 'static>;
    |                      -------------  ^^^^^^^^^^^^^ re-bound here
@@ -697,7 +697,55 @@ help: consider specifying the generic argument
 LL |     iter::empty::<T>()
    |                +++++
 
-error: aborting due to 81 previous errors
+error: unconstrained opaque type
+  --> $DIR/duplicate.rs:180:51
+   |
+LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
+   |                                                   ^^^^^^^^^
+   |
+   = note: `ETAI1` must be used in combination with a concrete type within the same crate
+
+error: unconstrained opaque type
+  --> $DIR/duplicate.rs:183:51
+   |
+LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
+   |                                                   ^^^^^^^^^
+   |
+   = note: `ETAI2` must be used in combination with a concrete type within the same crate
+
+error: unconstrained opaque type
+  --> $DIR/duplicate.rs:186:57
+   |
+LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
+   |                                                         ^^^^^^^^^
+   |
+   = note: `ETAI3` must be used in combination with a concrete type within the same crate
+
+error: unconstrained opaque type
+  --> $DIR/duplicate.rs:189:14
+   |
+LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `ETAI4` must be used in combination with a concrete type within the same crate
+
+error: unconstrained opaque type
+  --> $DIR/duplicate.rs:193:14
+   |
+LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `ETAI5` must be used in combination with a concrete type within the same crate
+
+error: unconstrained opaque type
+  --> $DIR/duplicate.rs:197:14
+   |
+LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `ETAI6` must be used in combination with a concrete type within the same crate
+
+error: aborting due to 87 previous errors
 
 Some errors have detailed explanations: E0282, E0719.
 For more information about an error, try `rustc --explain E0282`.
diff --git a/tests/ui/associated-type-bounds/hrtb.rs b/tests/ui/associated-type-bounds/hrtb.rs
index 1bf574f2e65..8ff7faec3a0 100644
--- a/tests/ui/associated-type-bounds/hrtb.rs
+++ b/tests/ui/associated-type-bounds/hrtb.rs
@@ -1,4 +1,7 @@
 //@ check-pass
+//@ revisions: current next
+//@[next] compile-flags: -Znext-solver
+//@ ignore-compare-mode-next-solver (explicit revisions)
 
 trait A<'a> {}
 trait B<'b> {}
diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr
index 0a31cc67533..459f3ea1642 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr
@@ -15,6 +15,10 @@ note: required by a bound in `is_send`
    |
 LL | fn is_send(_: impl Send) {}
    |                    ^^^^ required by this bound in `is_send`
+help: consider further restricting the associated type
+   |
+LL | >() where <T as Foo>::method(..): Send {
+   |     ++++++++++++++++++++++++++++++++++
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/associated-type-bounds/return-type-notation/display.stderr b/tests/ui/associated-type-bounds/return-type-notation/display.stderr
index b895d796952..a614089ce40 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/display.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/display.stderr
@@ -11,6 +11,10 @@ note: required by a bound in `needs_trait`
    |
 LL | fn needs_trait(_: impl Trait) {}
    |                        ^^^^^ required by this bound in `needs_trait`
+help: consider further restricting the associated type
+   |
+LL | fn foo<T: Assoc>(t: T) where <T as Assoc>::method(..): Trait {
+   |                        +++++++++++++++++++++++++++++++++++++
 
 error[E0277]: the trait bound `impl Sized { <T as Assoc>::method_with_lt(..) }: Trait` is not satisfied
   --> $DIR/display.rs:16:17
@@ -25,6 +29,10 @@ note: required by a bound in `needs_trait`
    |
 LL | fn needs_trait(_: impl Trait) {}
    |                        ^^^^^ required by this bound in `needs_trait`
+help: consider further restricting the associated type
+   |
+LL | fn foo<T: Assoc>(t: T) where <T as Assoc>::method_with_lt(..): Trait {
+   |                        +++++++++++++++++++++++++++++++++++++++++++++
 
 error[E0277]: the trait bound `impl Sized: Trait` is not satisfied
   --> $DIR/display.rs:18:17
diff --git a/tests/ui/associated-type-bounds/return-type-notation/rendering.fixed b/tests/ui/associated-type-bounds/return-type-notation/rendering.fixed
new file mode 100644
index 00000000000..72c174a0ca0
--- /dev/null
+++ b/tests/ui/associated-type-bounds/return-type-notation/rendering.fixed
@@ -0,0 +1,15 @@
+//@ run-rustfix
+
+#![allow(unused)]
+#![feature(return_type_notation)]
+
+trait Foo {
+    fn missing() -> impl Sized;
+}
+
+impl Foo for () {
+    //~^ ERROR not all trait items implemented, missing: `missing`
+fn missing() -> impl Sized { todo!() }
+}
+
+fn main() {}
diff --git a/tests/ui/associated-type-bounds/return-type-notation/rendering.rs b/tests/ui/associated-type-bounds/return-type-notation/rendering.rs
new file mode 100644
index 00000000000..4c9948d4c06
--- /dev/null
+++ b/tests/ui/associated-type-bounds/return-type-notation/rendering.rs
@@ -0,0 +1,14 @@
+//@ run-rustfix
+
+#![allow(unused)]
+#![feature(return_type_notation)]
+
+trait Foo {
+    fn missing() -> impl Sized;
+}
+
+impl Foo for () {
+    //~^ ERROR not all trait items implemented, missing: `missing`
+}
+
+fn main() {}
diff --git a/tests/ui/associated-type-bounds/return-type-notation/rendering.stderr b/tests/ui/associated-type-bounds/return-type-notation/rendering.stderr
new file mode 100644
index 00000000000..62fdeb059dd
--- /dev/null
+++ b/tests/ui/associated-type-bounds/return-type-notation/rendering.stderr
@@ -0,0 +1,12 @@
+error[E0046]: not all trait items implemented, missing: `missing`
+  --> $DIR/rendering.rs:10:1
+   |
+LL |     fn missing() -> impl Sized;
+   |     --------------------------- `missing` from trait
+...
+LL | impl Foo for () {
+   | ^^^^^^^^^^^^^^^ missing `missing` in implementation
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0046`.
diff --git a/tests/ui/associated-type-bounds/supertrait-defines-ty.rs b/tests/ui/associated-type-bounds/supertrait-defines-ty.rs
index ed1c1fa6f03..1c09ff3d3fb 100644
--- a/tests/ui/associated-type-bounds/supertrait-defines-ty.rs
+++ b/tests/ui/associated-type-bounds/supertrait-defines-ty.rs
@@ -1,4 +1,7 @@
 //@ check-pass
+//@ revisions: current next
+//@[next] compile-flags: -Znext-solver
+//@ ignore-compare-mode-next-solver (explicit revisions)
 
 // Make sure that we don't look into associated type bounds when looking for
 // supertraits that define an associated type. Fixes #76593.
diff --git a/tests/ui/associated-type-bounds/trait-alias-impl-trait.rs b/tests/ui/associated-type-bounds/trait-alias-impl-trait.rs
index fb6a4fcbe97..540c083e309 100644
--- a/tests/ui/associated-type-bounds/trait-alias-impl-trait.rs
+++ b/tests/ui/associated-type-bounds/trait-alias-impl-trait.rs
@@ -31,6 +31,7 @@ impl Tr1 for S1 {
 }
 
 type Et1 = impl Tr1<As1: Copy>;
+#[define_opaque(Et1)]
 fn def_et1() -> Et1 {
     S1
 }
@@ -39,6 +40,7 @@ pub fn use_et1() {
 }
 
 type Et2 = impl Tr1<As1: 'static>;
+#[define_opaque(Et2)]
 fn def_et2() -> Et2 {
     S1
 }
@@ -47,6 +49,7 @@ pub fn use_et2() {
 }
 
 type Et3 = impl Tr1<As1: Clone + Iterator<Item: Add<u8, Output: Into<u8>>>>;
+#[define_opaque(Et3)]
 fn def_et3() -> Et3 {
     struct A;
     impl Tr1 for A {
@@ -68,6 +71,7 @@ pub fn use_et3() {
 }
 
 type Et4 = impl Tr1<As1: for<'a> Tr2<'a>>;
+#[define_opaque(Et4)]
 fn def_et4() -> Et4 {
     #[derive(Copy, Clone)]
     struct A;
diff --git a/tests/ui/associated-types/bound-lifetime-constrained.ok.stderr b/tests/ui/associated-types/bound-lifetime-constrained.ok.stderr
deleted file mode 100644
index 9082044fe06..00000000000
--- a/tests/ui/associated-types/bound-lifetime-constrained.ok.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: fatal error triggered by #[rustc_error]
-  --> $DIR/bound-lifetime-constrained.rs:48:1
-   |
-LL | fn main() { }
-   | ^^^^^^^^^
-
-error: aborting due to 1 previous error
-
diff --git a/tests/ui/associated-types/bound-lifetime-constrained.rs b/tests/ui/associated-types/bound-lifetime-constrained.rs
index 1dc3b2f5c2b..3a5a77f57f2 100644
--- a/tests/ui/associated-types/bound-lifetime-constrained.rs
+++ b/tests/ui/associated-types/bound-lifetime-constrained.rs
@@ -1,7 +1,7 @@
 //@ revisions: func object clause ok
+//@[ok] check-pass
 
 #![allow(dead_code)]
-#![feature(rustc_attrs)]
 
 trait Foo<'a> {
     type Item;
@@ -44,5 +44,4 @@ fn clause2<T>() where T: for<'a> Fn() -> <() as Foo<'a>>::Item {
     //[clause]~^ ERROR `Output` references lifetime `'a`
 }
 
-#[rustc_error]
-fn main() { } //[ok]~ ERROR fatal error triggered by #[rustc_error]
+fn main() { }
diff --git a/tests/ui/associated-types/bound-lifetime-in-binding-only.ok.stderr b/tests/ui/associated-types/bound-lifetime-in-binding-only.ok.stderr
deleted file mode 100644
index 435e224bd89..00000000000
--- a/tests/ui/associated-types/bound-lifetime-in-binding-only.ok.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: fatal error triggered by #[rustc_error]
-  --> $DIR/bound-lifetime-in-binding-only.rs:71:1
-   |
-LL | fn main() { }
-   | ^^^^^^^^^
-
-error: aborting due to 1 previous error
-
diff --git a/tests/ui/associated-types/bound-lifetime-in-binding-only.rs b/tests/ui/associated-types/bound-lifetime-in-binding-only.rs
index e973e58b629..2401fe0ef1f 100644
--- a/tests/ui/associated-types/bound-lifetime-in-binding-only.rs
+++ b/tests/ui/associated-types/bound-lifetime-in-binding-only.rs
@@ -1,7 +1,7 @@
 //@ revisions: angle paren ok elision
+//@[ok] check-pass
 
 #![allow(dead_code)]
-#![feature(rustc_attrs)]
 #![feature(unboxed_closures)]
 
 trait Foo {
@@ -67,5 +67,4 @@ fn ok2<T: for<'a,'b> Fn<(&'b Parameterized<'a>,), Output=&'a i32>>() {
 fn ok3<T>() where for<'a> Parameterized<'a>: Foo<Item=&'a i32> {
 }
 
-#[rustc_error]
-fn main() { } //[ok]~ ERROR fatal error triggered by #[rustc_error]
+fn main() { }
diff --git a/tests/ui/associated-types/bound-lifetime-in-return-only.ok.stderr b/tests/ui/associated-types/bound-lifetime-in-return-only.ok.stderr
deleted file mode 100644
index 1815a7be7ee..00000000000
--- a/tests/ui/associated-types/bound-lifetime-in-return-only.ok.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: fatal error triggered by #[rustc_error]
-  --> $DIR/bound-lifetime-in-return-only.rs:49:1
-   |
-LL | fn main() { }
-   | ^^^^^^^^^
-
-error: aborting due to 1 previous error
-
diff --git a/tests/ui/associated-types/bound-lifetime-in-return-only.rs b/tests/ui/associated-types/bound-lifetime-in-return-only.rs
index bf3aa6149cc..8a28f5b7786 100644
--- a/tests/ui/associated-types/bound-lifetime-in-return-only.rs
+++ b/tests/ui/associated-types/bound-lifetime-in-return-only.rs
@@ -1,7 +1,7 @@
 //@ revisions: sig local structure ok elision
+//@[ok] check-pass
 
 #![allow(dead_code)]
-#![feature(rustc_attrs)]
 #![feature(unboxed_closures)]
 
 trait Foo {
@@ -45,5 +45,4 @@ fn ok1(_: &dyn for<'a> Fn(&Parameterized<'a>) -> &'a i32) {
 fn ok2(_: &dyn for<'a,'b> Fn<(&'b Parameterized<'a>,), Output=&'a i32>) {
 }
 
-#[rustc_error]
-fn main() { } //[ok]~ ERROR fatal error triggered by #[rustc_error]
+fn main() { }
diff --git a/tests/ui/associated-types/issue-38821.stderr b/tests/ui/associated-types/issue-38821.stderr
index dc919299710..8a19142b730 100644
--- a/tests/ui/associated-types/issue-38821.stderr
+++ b/tests/ui/associated-types/issue-38821.stderr
@@ -53,7 +53,6 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         -------  ^^^^^^^^^^^^     ^
    |         |
    |         unsatisfied trait bound introduced here
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider further restricting the associated type
    |
 LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
@@ -73,7 +72,6 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         |
    |         unsatisfied trait bound introduced here
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider further restricting the associated type
    |
 LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
@@ -92,7 +90,6 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         -------  ^^^^^^^^^^^^     ^
    |         |
    |         unsatisfied trait bound introduced here
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   --> $DIR/issue-38821.rs:23:10
@@ -108,7 +105,6 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         |
    |         unsatisfied trait bound introduced here
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   --> $DIR/issue-38821.rs:23:17
@@ -123,7 +119,6 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         -------  ^^^^^^^^^^^^     ^
    |         |
    |         unsatisfied trait bound introduced here
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider further restricting the associated type
    |
 LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
@@ -143,7 +138,6 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         |
    |         unsatisfied trait bound introduced here
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider further restricting the associated type
    |
 LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
@@ -162,7 +156,6 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         -------  ^^^^^^^^^^^^     ^
    |         |
    |         unsatisfied trait bound introduced here
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider further restricting the associated type
    |
 LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
@@ -182,7 +175,6 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         |
    |         unsatisfied trait bound introduced here
    = 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)
 help: consider further restricting the associated type
    |
 LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
@@ -201,7 +193,6 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         -------  ^^^^^^^^^^^^     ^
    |         |
    |         unsatisfied trait bound introduced here
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   --> $DIR/issue-38821.rs:23:23
@@ -217,7 +208,6 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         |
    |         unsatisfied trait bound introduced here
    = 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[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   --> $DIR/issue-38821.rs:23:10
@@ -233,7 +223,6 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         |
    |         unsatisfied trait bound introduced here
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   --> $DIR/issue-38821.rs:23:10
@@ -249,7 +238,6 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         |
    |         unsatisfied trait bound introduced here
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   --> $DIR/issue-38821.rs:23:23
@@ -265,7 +253,6 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         |
    |         unsatisfied trait bound introduced here
    = 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[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   --> $DIR/issue-38821.rs:23:23
@@ -281,7 +268,6 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         |
    |         unsatisfied trait bound introduced here
    = 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[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   --> $DIR/issue-38821.rs:23:10
@@ -297,7 +283,6 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         |
    |         unsatisfied trait bound introduced here
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   --> $DIR/issue-38821.rs:23:23
@@ -313,7 +298,6 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         |
    |         unsatisfied trait bound introduced here
    = 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 18 previous errors
 
diff --git a/tests/ui/associated-types/issue-59324.rs b/tests/ui/associated-types/issue-59324.rs
index 7421e08c898..3abe8473052 100644
--- a/tests/ui/associated-types/issue-59324.rs
+++ b/tests/ui/associated-types/issue-59324.rs
@@ -15,6 +15,7 @@ pub trait ThriftService<Bug: NotFoo>:
 {
     fn get_service(
     //~^ ERROR the trait bound `Bug: Foo` is not satisfied
+    //~| ERROR the trait bound `Bug: Foo` is not satisfied
         &self,
     ) -> Self::AssocType;
     //~^ ERROR the trait bound `Bug: Foo` is not satisfied
diff --git a/tests/ui/associated-types/issue-59324.stderr b/tests/ui/associated-types/issue-59324.stderr
index dc8f9cfe895..f5e696b7ac1 100644
--- a/tests/ui/associated-types/issue-59324.stderr
+++ b/tests/ui/associated-types/issue-59324.stderr
@@ -32,6 +32,7 @@ error[E0277]: the trait bound `Bug: Foo` is not satisfied
    |
 LL | /     fn get_service(
 LL | |
+LL | |
 LL | |         &self,
 LL | |     ) -> Self::AssocType;
    | |_________________________^ the trait `Foo` is not implemented for `Bug`
@@ -41,8 +42,18 @@ help: consider further restricting type parameter `Bug` with trait `Foo`
 LL | pub trait ThriftService<Bug: NotFoo + Foo>:
    |                                     +++++
 
+error[E0277]: the trait bound `Bug: Foo` is not satisfied
+  --> $DIR/issue-59324.rs:16:5
+   |
+LL | /     fn get_service(
+LL | |
+LL | |
+LL | |         &self,
+LL | |     ) -> Self::AssocType;
+   | |_________________________^ the trait `Foo` is not implemented for `Bug`
+
 error[E0277]: the trait bound `(): Foo` is not satisfied
-  --> $DIR/issue-59324.rs:23:29
+  --> $DIR/issue-59324.rs:24:29
    |
 LL | fn with_factory<H>(factory: dyn ThriftService<()>) {}
    |                             ^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `()`
@@ -54,7 +65,7 @@ LL | pub trait Foo: NotFoo {
    | ^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the trait bound `Bug: Foo` is not satisfied
-  --> $DIR/issue-59324.rs:19:10
+  --> $DIR/issue-59324.rs:20:10
    |
 LL |     ) -> Self::AssocType;
    |          ^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `Bug`
@@ -65,7 +76,7 @@ LL | pub trait ThriftService<Bug: NotFoo + Foo>:
    |                                     +++++
 
 error[E0277]: the trait bound `(): Foo` is not satisfied
-  --> $DIR/issue-59324.rs:23:29
+  --> $DIR/issue-59324.rs:24:29
    |
 LL | fn with_factory<H>(factory: dyn ThriftService<()>) {}
    |                             ^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `()`
@@ -78,7 +89,7 @@ LL | pub trait Foo: NotFoo {
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0277]: the size for values of type `(dyn ThriftService<(), AssocType = _> + 'static)` cannot be known at compilation time
-  --> $DIR/issue-59324.rs:23:29
+  --> $DIR/issue-59324.rs:24:29
    |
 LL | fn with_factory<H>(factory: dyn ThriftService<()>) {}
    |                             ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
@@ -95,6 +106,6 @@ help: function arguments must have a statically known size, borrowed types alway
 LL | fn with_factory<H>(factory: &dyn ThriftService<()>) {}
    |                             +
 
-error: aborting due to 7 previous errors
+error: aborting due to 8 previous errors
 
 For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/async-closures/imm-deref-lending.rs b/tests/ui/async-await/async-closures/imm-deref-lending.rs
new file mode 100644
index 00000000000..59f8d434d9c
--- /dev/null
+++ b/tests/ui/async-await/async-closures/imm-deref-lending.rs
@@ -0,0 +1,46 @@
+//@ edition: 2021
+//@ check-pass
+
+#![feature(impl_trait_in_bindings)]
+
+struct FooS {
+    precise: i32,
+}
+
+fn ref_inside_mut(f: &mut &FooS) {
+    let x: impl AsyncFn() = async move || {
+        let y = &f.precise;
+    };
+}
+
+fn mut_inside_ref(f: &&mut FooS) {
+    let x: impl AsyncFn() = async move || {
+        let y = &f.precise;
+    };
+}
+
+fn mut_ref_inside_mut(f: &mut &mut FooS) {
+    let x: impl AsyncFn() = async move || {
+        let y = &f.precise;
+    };
+}
+
+fn ref_inside_box(f: Box<&FooS>) {
+    let x: impl AsyncFn() = async move || {
+        let y = &f.precise;
+    };
+}
+
+fn box_inside_ref(f: &Box<FooS>) {
+    let x: impl AsyncFn() = async move || {
+        let y = &f.precise;
+    };
+}
+
+fn box_inside_box(f: Box<Box<FooS>>) {
+    let x: impl AsyncFn() = async move || {
+        let y = &f.precise;
+    };
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/async-closures/imm-deref-not-lending.rs b/tests/ui/async-await/async-closures/imm-deref-not-lending.rs
new file mode 100644
index 00000000000..bd1197cc636
--- /dev/null
+++ b/tests/ui/async-await/async-closures/imm-deref-not-lending.rs
@@ -0,0 +1,49 @@
+//@ edition: 2021
+
+#![feature(impl_trait_in_bindings)]
+
+struct FooS {
+    precise: i32,
+}
+
+fn ref_inside_mut(f: &mut &FooS) {
+    let x: impl Fn() -> _ = async move || {
+        let y = &f.precise;
+    };
+}
+
+fn mut_inside_ref(f: &&mut FooS) {
+    let x: impl Fn() -> _ = async move || {
+        let y = &f.precise;
+    };
+}
+
+// Expected to fail, no immutable reference here.
+fn mut_ref_inside_mut(f: &mut &mut FooS) {
+    let x: impl Fn() -> _ = async move || {
+        //~^ ERROR async closure does not implement `Fn`
+        let y = &f.precise;
+    };
+}
+
+fn ref_inside_box(f: Box<&FooS>) {
+    let x: impl Fn() -> _ = async move || {
+        let y = &f.precise;
+    };
+}
+
+fn box_inside_ref(f: &Box<FooS>) {
+    let x: impl Fn() -> _ = async move || {
+        let y = &f.precise;
+    };
+}
+
+// Expected to fail, no immutable reference here.
+fn box_inside_box(f: Box<Box<FooS>>) {
+    let x: impl Fn() -> _ = async move || {
+        //~^ ERROR async closure does not implement `Fn`
+        let y = &f.precise;
+    };
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/async-closures/imm-deref-not-lending.stderr b/tests/ui/async-await/async-closures/imm-deref-not-lending.stderr
new file mode 100644
index 00000000000..cd3ff55e458
--- /dev/null
+++ b/tests/ui/async-await/async-closures/imm-deref-not-lending.stderr
@@ -0,0 +1,14 @@
+error: async closure does not implement `Fn` because it captures state from its environment
+  --> $DIR/imm-deref-not-lending.rs:23:29
+   |
+LL |     let x: impl Fn() -> _ = async move || {
+   |                             ^^^^^^^^^^^^^
+
+error: async closure does not implement `Fn` because it captures state from its environment
+  --> $DIR/imm-deref-not-lending.rs:43:29
+   |
+LL |     let x: impl Fn() -> _ = async move || {
+   |                             ^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/async-await/async-fn/impl-trait.rs b/tests/ui/async-await/async-fn/impl-trait.rs
index f284de8981a..89c41ceb2da 100644
--- a/tests/ui/async-await/async-fn/impl-trait.rs
+++ b/tests/ui/async-await/async-fn/impl-trait.rs
@@ -4,11 +4,14 @@
 #![feature(type_alias_impl_trait)]
 
 type Tait = impl AsyncFn();
+#[define_opaque(Tait)]
 fn tait() -> Tait {
     || async {}
 }
 
-fn foo(x: impl AsyncFn()) -> impl AsyncFn() { x }
+fn foo(x: impl AsyncFn()) -> impl AsyncFn() {
+    x
+}
 
 fn param<T: AsyncFn()>() {}
 
diff --git a/tests/ui/async-await/dyn/mut-is-pointer-like.rs b/tests/ui/async-await/dyn/mut-is-pointer-like.rs
index 93e8281164c..a82567e372e 100644
--- a/tests/ui/async-await/dyn/mut-is-pointer-like.rs
+++ b/tests/ui/async-await/dyn/mut-is-pointer-like.rs
@@ -1,11 +1,9 @@
 //@ aux-build:block-on.rs
 //@ edition: 2021
-//@ run-pass
-//@ check-run-results
+//@ known-bug: #133119
 
 #![allow(refining_impl_trait)]
 #![feature(async_fn_in_dyn_trait)]
-//~^ WARN the feature `async_fn_in_dyn_trait` is incomplete
 
 extern crate block_on;
 
diff --git a/tests/ui/async-await/dyn/mut-is-pointer-like.stderr b/tests/ui/async-await/dyn/mut-is-pointer-like.stderr
index 7c72ce43cf0..bf20473924b 100644
--- a/tests/ui/async-await/dyn/mut-is-pointer-like.stderr
+++ b/tests/ui/async-await/dyn/mut-is-pointer-like.stderr
@@ -1,5 +1,5 @@
 warning: the feature `async_fn_in_dyn_trait` is incomplete and may not be safe to use and/or cause compiler crashes
-  --> $DIR/mut-is-pointer-like.rs:7:12
+  --> $DIR/mut-is-pointer-like.rs:6:12
    |
 LL | #![feature(async_fn_in_dyn_trait)]
    |            ^^^^^^^^^^^^^^^^^^^^^
@@ -7,5 +7,65 @@ LL | #![feature(async_fn_in_dyn_trait)]
    = note: see issue #133119 <https://github.com/rust-lang/rust/issues/133119> for more information
    = note: `#[warn(incomplete_features)]` on by default
 
-warning: 1 warning emitted
+error[E0038]: the trait `AsyncTrait` is not dyn compatible
+  --> $DIR/mut-is-pointer-like.rs:35:16
+   |
+LL |         let x: Pin<&mut dyn AsyncTrait<Output = ()>> = f;
+   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `AsyncTrait` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/mut-is-pointer-like.rs:16:14
+   |
+LL | trait AsyncTrait {
+   |       ---------- this trait is not dyn compatible...
+...
+LL |     async fn async_dispatch(self: Pin<&mut Self>) -> Self::Output;
+   |              ^^^^^^^^^^^^^^ ...because method `async_dispatch` is `async`
+   = help: consider moving `async_dispatch` to another trait
+
+error[E0038]: the trait `AsyncTrait` is not dyn compatible
+  --> $DIR/mut-is-pointer-like.rs:35:56
+   |
+LL |         let x: Pin<&mut dyn AsyncTrait<Output = ()>> = f;
+   |                                                        ^ `AsyncTrait` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/mut-is-pointer-like.rs:16:14
+   |
+LL | trait AsyncTrait {
+   |       ---------- this trait is not dyn compatible...
+...
+LL |     async fn async_dispatch(self: Pin<&mut Self>) -> Self::Output;
+   |              ^^^^^^^^^^^^^^ ...because method `async_dispatch` is `async`
+   = help: consider moving `async_dispatch` to another trait
+   = note: required for the cast from `Pin<&mut {async block@$DIR/mut-is-pointer-like.rs:32:32: 32:37}>` to `Pin<&mut dyn AsyncTrait<Output = ()>>`
+
+error[E0277]: the trait bound `dyn AsyncTrait<Output = ()>: AsyncTrait` is not satisfied
+  --> $DIR/mut-is-pointer-like.rs:36:11
+   |
+LL |         x.async_dispatch().await;
+   |           ^^^^^^^^^^^^^^ the trait `AsyncTrait` is not implemented for `dyn AsyncTrait<Output = ()>`
+
+error[E0038]: the trait `AsyncTrait` is not dyn compatible
+  --> $DIR/mut-is-pointer-like.rs:36:9
+   |
+LL |         x.async_dispatch().await;
+   |         ^^^^^^^^^^^^^^^^^^ `AsyncTrait` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/mut-is-pointer-like.rs:16:14
+   |
+LL | trait AsyncTrait {
+   |       ---------- this trait is not dyn compatible...
+...
+LL |     async fn async_dispatch(self: Pin<&mut Self>) -> Self::Output;
+   |              ^^^^^^^^^^^^^^ ...because method `async_dispatch` is `async`
+   = help: consider moving `async_dispatch` to another trait
+
+error: aborting due to 4 previous errors; 1 warning emitted
 
+Some errors have detailed explanations: E0038, E0277.
+For more information about an error, try `rustc --explain E0038`.
diff --git a/tests/ui/async-await/dyn/works.rs b/tests/ui/async-await/dyn/works.rs
index 0732a3ee2f2..f406a7b593f 100644
--- a/tests/ui/async-await/dyn/works.rs
+++ b/tests/ui/async-await/dyn/works.rs
@@ -1,11 +1,9 @@
 //@ aux-build:block-on.rs
 //@ edition: 2021
-//@ run-pass
-//@ check-run-results
+//@ known-bug: #133119
 
 #![allow(refining_impl_trait)]
 #![feature(async_fn_in_dyn_trait)]
-//~^ WARN the feature `async_fn_in_dyn_trait` is incomplete
 
 extern crate block_on;
 
diff --git a/tests/ui/async-await/dyn/works.stderr b/tests/ui/async-await/dyn/works.stderr
index 2c7db7c32f5..47abeab5aac 100644
--- a/tests/ui/async-await/dyn/works.stderr
+++ b/tests/ui/async-await/dyn/works.stderr
@@ -1,5 +1,5 @@
 warning: the feature `async_fn_in_dyn_trait` is incomplete and may not be safe to use and/or cause compiler crashes
-  --> $DIR/works.rs:7:12
+  --> $DIR/works.rs:6:12
    |
 LL | #![feature(async_fn_in_dyn_trait)]
    |            ^^^^^^^^^^^^^^^^^^^^^
@@ -7,5 +7,75 @@ LL | #![feature(async_fn_in_dyn_trait)]
    = note: see issue #133119 <https://github.com/rust-lang/rust/issues/133119> for more information
    = note: `#[warn(incomplete_features)]` on by default
 
-warning: 1 warning emitted
+error[E0038]: the trait `AsyncTrait` is not dyn compatible
+  --> $DIR/works.rs:27:34
+   |
+LL |         let x: &dyn AsyncTrait = &"hello, world!";
+   |                                  ^^^^^^^^^^^^^^^^ `AsyncTrait` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/works.rs:14:14
+   |
+LL | trait AsyncTrait {
+   |       ---------- this trait is not dyn compatible...
+LL |     async fn async_dispatch(&self);
+   |              ^^^^^^^^^^^^^^ ...because method `async_dispatch` is `async`
+   = help: consider moving `async_dispatch` to another trait
+   = help: only type `&'static str` implements `AsyncTrait`; consider using it directly instead.
+   = note: required for the cast from `&&'static str` to `&dyn AsyncTrait`
+
+error[E0038]: the trait `AsyncTrait` is not dyn compatible
+  --> $DIR/works.rs:27:16
+   |
+LL |         let x: &dyn AsyncTrait = &"hello, world!";
+   |                ^^^^^^^^^^^^^^^ `AsyncTrait` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/works.rs:14:14
+   |
+LL | trait AsyncTrait {
+   |       ---------- this trait is not dyn compatible...
+LL |     async fn async_dispatch(&self);
+   |              ^^^^^^^^^^^^^^ ...because method `async_dispatch` is `async`
+   = help: consider moving `async_dispatch` to another trait
+   = help: only type `&'static str` implements `AsyncTrait`; consider using it directly instead.
+
+error[E0038]: the trait `AsyncTrait` is not dyn compatible
+  --> $DIR/works.rs:28:11
+   |
+LL |         x.async_dispatch().await;
+   |           ^^^^^^^^^^^^^^ `AsyncTrait` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/works.rs:14:14
+   |
+LL | trait AsyncTrait {
+   |       ---------- this trait is not dyn compatible...
+LL |     async fn async_dispatch(&self);
+   |              ^^^^^^^^^^^^^^ ...because method `async_dispatch` is `async`
+   = help: consider moving `async_dispatch` to another trait
+   = help: only type `&'static str` implements `AsyncTrait`; consider using it directly instead.
+
+error[E0038]: the trait `AsyncTrait` is not dyn compatible
+  --> $DIR/works.rs:28:9
+   |
+LL |         x.async_dispatch().await;
+   |         ^^^^^^^^^^^^^^^^^^ `AsyncTrait` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/works.rs:14:14
+   |
+LL | trait AsyncTrait {
+   |       ---------- this trait is not dyn compatible...
+LL |     async fn async_dispatch(&self);
+   |              ^^^^^^^^^^^^^^ ...because method `async_dispatch` is `async`
+   = help: consider moving `async_dispatch` to another trait
+   = help: only type `&'static str` implements `AsyncTrait`; consider using it directly instead.
+
+error: aborting due to 4 previous errors; 1 warning emitted
 
+For more information about this error, try `rustc --explain E0038`.
diff --git a/tests/ui/async-await/dyn/wrong-size.rs b/tests/ui/async-await/dyn/wrong-size.rs
index ac15dd26067..f5fce3648ac 100644
--- a/tests/ui/async-await/dyn/wrong-size.rs
+++ b/tests/ui/async-await/dyn/wrong-size.rs
@@ -1,7 +1,7 @@
 //@ edition: 2021
+//@ known-bug: #133119
 
 #![feature(async_fn_in_dyn_trait)]
-//~^ WARN the feature `async_fn_in_dyn_trait` is incomplete
 
 use std::future::Future;
 
@@ -19,5 +19,5 @@ impl AsyncTrait for &'static str {
 
 fn main() {
     let x: &dyn AsyncTrait = &"hello, world!";
-    //~^ ERROR `impl Future<Output = ()>` needs to have the same ABI as a pointer
+    // FIXME ~^ ERROR `impl Future<Output = ()>` needs to have the same ABI as a pointer
 }
diff --git a/tests/ui/async-await/dyn/wrong-size.stderr b/tests/ui/async-await/dyn/wrong-size.stderr
index 0202b5f2409..b4684f4fc17 100644
--- a/tests/ui/async-await/dyn/wrong-size.stderr
+++ b/tests/ui/async-await/dyn/wrong-size.stderr
@@ -1,5 +1,5 @@
 warning: the feature `async_fn_in_dyn_trait` is incomplete and may not be safe to use and/or cause compiler crashes
-  --> $DIR/wrong-size.rs:3:12
+  --> $DIR/wrong-size.rs:4:12
    |
 LL | #![feature(async_fn_in_dyn_trait)]
    |            ^^^^^^^^^^^^^^^^^^^^^
@@ -7,15 +7,41 @@ LL | #![feature(async_fn_in_dyn_trait)]
    = note: see issue #133119 <https://github.com/rust-lang/rust/issues/133119> for more information
    = note: `#[warn(incomplete_features)]` on by default
 
-error[E0277]: `impl Future<Output = ()>` needs to have the same ABI as a pointer
+error[E0038]: the trait `AsyncTrait` is not dyn compatible
   --> $DIR/wrong-size.rs:21:30
    |
 LL |     let x: &dyn AsyncTrait = &"hello, world!";
-   |                              ^^^^^^^^^^^^^^^^ `impl Future<Output = ()>` needs to be a pointer-like type
+   |                              ^^^^^^^^^^^^^^^^ `AsyncTrait` is not dyn compatible
    |
-   = help: the trait `for<'a> PointerLike` is not implemented for `impl Future<Output = ()>`
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/wrong-size.rs:9:14
+   |
+LL | trait AsyncTrait {
+   |       ---------- this trait is not dyn compatible...
+LL |     async fn async_dispatch(&self);
+   |              ^^^^^^^^^^^^^^ ...because method `async_dispatch` is `async`
+   = help: consider moving `async_dispatch` to another trait
+   = help: only type `&'static str` implements `AsyncTrait`; consider using it directly instead.
    = note: required for the cast from `&&'static str` to `&dyn AsyncTrait`
 
-error: aborting due to 1 previous error; 1 warning emitted
+error[E0038]: the trait `AsyncTrait` is not dyn compatible
+  --> $DIR/wrong-size.rs:21:12
+   |
+LL |     let x: &dyn AsyncTrait = &"hello, world!";
+   |            ^^^^^^^^^^^^^^^ `AsyncTrait` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/wrong-size.rs:9:14
+   |
+LL | trait AsyncTrait {
+   |       ---------- this trait is not dyn compatible...
+LL |     async fn async_dispatch(&self);
+   |              ^^^^^^^^^^^^^^ ...because method `async_dispatch` is `async`
+   = help: consider moving `async_dispatch` to another trait
+   = help: only type `&'static str` implements `AsyncTrait`; consider using it directly instead.
+
+error: aborting due to 2 previous errors; 1 warning emitted
 
-For more information about this error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0038`.
diff --git a/tests/ui/async-await/issues/issue-60655-latebound-regions.rs b/tests/ui/async-await/issues/issue-60655-latebound-regions.rs
index 4a8b5af5769..f9eeb361b13 100644
--- a/tests/ui/async-await/issues/issue-60655-latebound-regions.rs
+++ b/tests/ui/async-await/issues/issue-60655-latebound-regions.rs
@@ -11,15 +11,17 @@ pub type Func = impl Sized;
 
 // Late bound region should be allowed to escape the function, since it's bound
 // in the type.
+#[define_opaque(Func)]
 fn null_function_ptr() -> Func {
     None::<for<'a> fn(&'a ())>
 }
 
 async fn async_nop(_: &u8) {}
 
-pub type ServeFut = impl Future<Output=()>;
+pub type ServeFut = impl Future<Output = ()>;
 
 // Late bound regions occur in the coroutine witness type here.
+#[define_opaque(ServeFut)]
 fn serve() -> ServeFut {
     async move {
         let x = 5;
diff --git a/tests/ui/async-await/normalize-output-in-signature-deduction.rs b/tests/ui/async-await/normalize-output-in-signature-deduction.rs
index 19d70c2c6ee..e2238d85093 100644
--- a/tests/ui/async-await/normalize-output-in-signature-deduction.rs
+++ b/tests/ui/async-await/normalize-output-in-signature-deduction.rs
@@ -13,6 +13,7 @@ pub trait Trait {}
 
 pub type TAIT<T> = impl Trait;
 
+#[define_opaque(TAIT)]
 async fn foo<T>() -> TAIT<T> {
     Foo
 }
diff --git a/tests/ui/attributes/auxiliary/used_pre_main_constructor.rs b/tests/ui/attributes/auxiliary/used_pre_main_constructor.rs
index d94572ef5d6..8ea7a9cb4b5 100644
--- a/tests/ui/attributes/auxiliary/used_pre_main_constructor.rs
+++ b/tests/ui/attributes/auxiliary/used_pre_main_constructor.rs
@@ -19,6 +19,7 @@
         target_os = "netbsd",
         target_os = "nto",
         target_os = "openbsd",
+        target_os = "fuchsia",
     ),
     link_section = ".init_array"
 )]
diff --git a/tests/ui/attributes/collapse-debuginfo-invalid.rs b/tests/ui/attributes/collapse-debuginfo-invalid.rs
index d6b3554a5a8..ccf11df2eb0 100644
--- a/tests/ui/attributes/collapse-debuginfo-invalid.rs
+++ b/tests/ui/attributes/collapse-debuginfo-invalid.rs
@@ -24,15 +24,15 @@ const BAR: u32 = 3;
 //~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
 fn foo() {
     let _ = #[collapse_debuginfo(yes)] || { };
-//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
+    //~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
     #[collapse_debuginfo(yes)]
-//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
+    //~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
     let _ = 3;
     let _ = #[collapse_debuginfo(yes)] 3;
-//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
+    //~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
     match (3, 4) {
         #[collapse_debuginfo(yes)]
-//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
+        //~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
         _ => (),
     }
 }
@@ -50,7 +50,7 @@ type Map = HashMap<u32, u32>;
 //~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
 enum Foo {
     #[collapse_debuginfo(yes)]
-//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
+    //~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
     Variant,
 }
 
@@ -58,7 +58,7 @@ enum Foo {
 //~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
 struct Bar {
     #[collapse_debuginfo(yes)]
-//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
+    //~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
     field: u32,
 }
 
@@ -73,7 +73,7 @@ union Qux {
 //~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
 trait Foobar {
     #[collapse_debuginfo(yes)]
-//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
+    //~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
     type Bar;
 }
 
@@ -85,6 +85,7 @@ impl Foobar for Bar {
     type Bar = u32;
 }
 
+#[define_opaque(AFoobar)]
 fn constraining() -> AFoobar {
     Bar { field: 3 }
 }
@@ -93,11 +94,11 @@ fn constraining() -> AFoobar {
 //~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
 impl Bar {
     #[collapse_debuginfo(yes)]
-//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
+    //~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
     const FOO: u32 = 3;
 
     #[collapse_debuginfo(yes)]
-//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
+    //~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
     fn bar(&self) {}
 }
 
diff --git a/tests/ui/attributes/collapse-debuginfo-invalid.stderr b/tests/ui/attributes/collapse-debuginfo-invalid.stderr
index 70376f985cb..081e4445a86 100644
--- a/tests/ui/attributes/collapse-debuginfo-invalid.stderr
+++ b/tests/ui/attributes/collapse-debuginfo-invalid.stderr
@@ -176,7 +176,7 @@ LL | type AFoobar = impl Foobar;
    | --------------------------- not a macro definition
 
 error: `collapse_debuginfo` attribute should be applied to macro definitions
-  --> $DIR/collapse-debuginfo-invalid.rs:92:1
+  --> $DIR/collapse-debuginfo-invalid.rs:93:1
    |
 LL |   #[collapse_debuginfo(yes)]
    |   ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -200,7 +200,7 @@ LL |     type Bar;
    |     --------- not a macro definition
 
 error: `collapse_debuginfo` attribute should be applied to macro definitions
-  --> $DIR/collapse-debuginfo-invalid.rs:95:5
+  --> $DIR/collapse-debuginfo-invalid.rs:96:5
    |
 LL |     #[collapse_debuginfo(yes)]
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -209,7 +209,7 @@ LL |     const FOO: u32 = 3;
    |     ------------------- not a macro definition
 
 error: `collapse_debuginfo` attribute should be applied to macro definitions
-  --> $DIR/collapse-debuginfo-invalid.rs:99:5
+  --> $DIR/collapse-debuginfo-invalid.rs:100:5
    |
 LL |     #[collapse_debuginfo(yes)]
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/attributes/crate-name-empty.rs b/tests/ui/attributes/crate-name-empty.rs
new file mode 100644
index 00000000000..dfba77a52de
--- /dev/null
+++ b/tests/ui/attributes/crate-name-empty.rs
@@ -0,0 +1,5 @@
+// Ensure we reject `#![crate_name = ""]`.
+
+#![crate_name = ""] //~ ERROR crate name must not be empty
+
+fn main() {}
diff --git a/tests/ui/attributes/crate-name-empty.stderr b/tests/ui/attributes/crate-name-empty.stderr
new file mode 100644
index 00000000000..509a42d05f7
--- /dev/null
+++ b/tests/ui/attributes/crate-name-empty.stderr
@@ -0,0 +1,8 @@
+error: crate name must not be empty
+  --> $DIR/crate-name-empty.rs:3:1
+   |
+LL | #![crate_name = ""]
+   | ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/attributes/extented-attribute-macro-error.stderr b/tests/ui/attributes/extented-attribute-macro-error.stderr
index 884f3c7b166..7b93b98f64c 100644
--- a/tests/ui/attributes/extented-attribute-macro-error.stderr
+++ b/tests/ui/attributes/extented-attribute-macro-error.stderr
@@ -3,8 +3,6 @@ error: couldn't read the file
    |
 LL | #![doc = include_str!("../not_existing_file.md")]
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/attributes/outer-mod-attr-applies-only-to-first.rs b/tests/ui/attributes/outer-mod-attr-applies-only-to-first.rs
new file mode 100644
index 00000000000..ec521c1afb5
--- /dev/null
+++ b/tests/ui/attributes/outer-mod-attr-applies-only-to-first.rs
@@ -0,0 +1,16 @@
+//! Regression test to check that outer attributes applied to the first module item is applied to
+//! its attached module item only, and not also to other subsequent module items
+//!
+//! Commit: <https://github.com/rust-lang/rust/commit/7aee9f7b56f8d96f9444ebb1d06e32e024b81974>
+
+//@ check-pass
+//@ compile-flags: --cfg=first
+//@ no-auto-check-cfg
+
+#[cfg(first)]
+mod hello {}
+
+#[cfg(not_set)]
+mod hello {}
+
+fn main() {}
diff --git a/tests/ui/attributes/z-crate-attr.rs b/tests/ui/attributes/z-crate-attr/basic.rs
index 119a48d5d65..119a48d5d65 100644
--- a/tests/ui/attributes/z-crate-attr.rs
+++ b/tests/ui/attributes/z-crate-attr/basic.rs
diff --git a/tests/ui/attributes/z-crate-attr/cfg-false.rs b/tests/ui/attributes/z-crate-attr/cfg-false.rs
new file mode 100644
index 00000000000..db37cfdd086
--- /dev/null
+++ b/tests/ui/attributes/z-crate-attr/cfg-false.rs
@@ -0,0 +1,7 @@
+// Ensure that `-Z crate-attr=cfg(FALSE)` can comment out the whole crate
+//@ compile-flags: --crate-type=lib -Zcrate-attr=cfg(FALSE)
+//@ check-pass
+
+// NOTE: duplicate items are load-bearing
+fn foo() {}
+fn foo() {}
diff --git a/tests/ui/attributes/z-crate-attr/comments.rs b/tests/ui/attributes/z-crate-attr/comments.rs
new file mode 100644
index 00000000000..c1ab041f344
--- /dev/null
+++ b/tests/ui/attributes/z-crate-attr/comments.rs
@@ -0,0 +1,5 @@
+//@ check-pass
+//@ compile-flags: -Zcrate-attr=/*hi-there*/feature(rustc_attrs)
+
+#[rustc_dummy]
+fn main() {}
diff --git a/tests/ui/attributes/z-crate-attr/crate-name.rs b/tests/ui/attributes/z-crate-attr/crate-name.rs
new file mode 100644
index 00000000000..d49830390e2
--- /dev/null
+++ b/tests/ui/attributes/z-crate-attr/crate-name.rs
@@ -0,0 +1,6 @@
+// Ensure that `crate_name` and `crate_type` can be set through `-Z crate-attr`.
+//@ check-pass
+//@ compile-flags: -Zcrate-attr=crate_name="override"
+fn main() {
+    assert_eq!(module_path!(), "r#override");
+}
diff --git a/tests/ui/attributes/z-crate-attr/crate-type.rs b/tests/ui/attributes/z-crate-attr/crate-type.rs
new file mode 100644
index 00000000000..0e7411865af
--- /dev/null
+++ b/tests/ui/attributes/z-crate-attr/crate-type.rs
@@ -0,0 +1,3 @@
+//@ check-pass
+//@ compile-flags: -Zcrate-attr=crate_type="lib"
+// notice the lack of `main` is load-bearing
diff --git a/tests/ui/attributes/z-crate-attr/garbage.rs b/tests/ui/attributes/z-crate-attr/garbage.rs
new file mode 100644
index 00000000000..ec81dd1bcaa
--- /dev/null
+++ b/tests/ui/attributes/z-crate-attr/garbage.rs
@@ -0,0 +1,4 @@
+// Show diagnostics for invalid tokens
+//@ compile-flags: -Zcrate-attr=`%~@$#
+//@ error-pattern:unknown start of token
+fn main() {}
diff --git a/tests/ui/attributes/z-crate-attr/garbage.stderr b/tests/ui/attributes/z-crate-attr/garbage.stderr
new file mode 100644
index 00000000000..082046e31f8
--- /dev/null
+++ b/tests/ui/attributes/z-crate-attr/garbage.stderr
@@ -0,0 +1,20 @@
+error: unknown start of token: `
+  --> <crate attribute>:1:1
+   |
+LL | `%~@$#
+   | ^
+   |
+help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
+   |
+LL - `%~@$#
+LL + '%~@$#
+   |
+
+error: expected identifier, found `%`
+  --> <crate attribute>:1:2
+   |
+LL | `%~@$#
+   |  ^ expected identifier
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/attributes/z-crate-attr/injection.rs b/tests/ui/attributes/z-crate-attr/injection.rs
new file mode 100644
index 00000000000..0c5c81ca71a
--- /dev/null
+++ b/tests/ui/attributes/z-crate-attr/injection.rs
@@ -0,0 +1,3 @@
+//@ compile-flags: '-Zcrate-attr=feature(yeet_expr)]fn main(){}#[inline'
+//@ error-pattern:unexpected closing delimiter
+fn foo() {}
diff --git a/tests/ui/attributes/z-crate-attr/injection.stderr b/tests/ui/attributes/z-crate-attr/injection.stderr
new file mode 100644
index 00000000000..6fec98baf8d
--- /dev/null
+++ b/tests/ui/attributes/z-crate-attr/injection.stderr
@@ -0,0 +1,8 @@
+error: unexpected closing delimiter: `]`
+  --> <crate attribute>:1:19
+   |
+LL | feature(yeet_expr)]fn main(){}#[inline
+   |                   ^ unexpected closing delimiter
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/attributes/z-crate-attr/inner-attr.rs b/tests/ui/attributes/z-crate-attr/inner-attr.rs
new file mode 100644
index 00000000000..522c906dcd8
--- /dev/null
+++ b/tests/ui/attributes/z-crate-attr/inner-attr.rs
@@ -0,0 +1,4 @@
+//@ compile-flags: -Zcrate-attr=#![feature(foo)]
+//@ error-pattern:expected identifier
+
+fn main() {}
diff --git a/tests/ui/attributes/z-crate-attr/inner-attr.stderr b/tests/ui/attributes/z-crate-attr/inner-attr.stderr
new file mode 100644
index 00000000000..06a063d310b
--- /dev/null
+++ b/tests/ui/attributes/z-crate-attr/inner-attr.stderr
@@ -0,0 +1,8 @@
+error: expected identifier, found `#`
+  --> <crate attribute>:1:1
+   |
+LL | #![feature(foo)]
+   | ^ expected identifier
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/attributes/z-crate-attr/multiple.rs b/tests/ui/attributes/z-crate-attr/multiple.rs
new file mode 100644
index 00000000000..ee13253f625
--- /dev/null
+++ b/tests/ui/attributes/z-crate-attr/multiple.rs
@@ -0,0 +1,3 @@
+//@ compile-flags: -Zcrate-attr=feature(foo),feature(bar)
+//@ error-pattern:invalid crate attr
+fn main() {}
diff --git a/tests/ui/attributes/z-crate-attr/multiple.stderr b/tests/ui/attributes/z-crate-attr/multiple.stderr
new file mode 100644
index 00000000000..9f968a7e134
--- /dev/null
+++ b/tests/ui/attributes/z-crate-attr/multiple.stderr
@@ -0,0 +1,8 @@
+error: invalid crate attribute
+  --> <crate attribute>:1:1
+   |
+LL | feature(foo),feature(bar)
+   | ^^^^^^^^^^^^^
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/attributes/z-crate-attr/respect-existing-attrs.rs b/tests/ui/attributes/z-crate-attr/respect-existing-attrs.rs
new file mode 100644
index 00000000000..71f2559998f
--- /dev/null
+++ b/tests/ui/attributes/z-crate-attr/respect-existing-attrs.rs
@@ -0,0 +1,9 @@
+// Make sure that existing root attributes are still respected even when `-Zcrate-attr` is present.
+//@ run-pass
+//@ compile-flags: -Zcrate-attr=feature(rustc_attrs)
+#![crate_name = "override"]
+
+#[rustc_dummy]
+fn main() {
+    assert_eq!(module_path!(), "r#override");
+}
diff --git a/tests/ui/attributes/z-crate-attr/shebang.rs b/tests/ui/attributes/z-crate-attr/shebang.rs
new file mode 100644
index 00000000000..195393acaf5
--- /dev/null
+++ b/tests/ui/attributes/z-crate-attr/shebang.rs
@@ -0,0 +1,6 @@
+#!/usr/bin/env -S cargo +nightly -Zscript
+// Make sure that shebangs are still allowed even when `-Zcrate-attr` is present.
+//@ check-pass
+//@ compile-flags: -Zcrate-attr=feature(rustc_attrs)
+#[rustc_dummy]
+fn main() {}
diff --git a/tests/ui/attributes/z-crate-attr/unbalanced-paren.rs b/tests/ui/attributes/z-crate-attr/unbalanced-paren.rs
new file mode 100644
index 00000000000..fc1d7f39a59
--- /dev/null
+++ b/tests/ui/attributes/z-crate-attr/unbalanced-paren.rs
@@ -0,0 +1,4 @@
+// Show diagnostics for unbalanced parens.
+//@ compile-flags: -Zcrate-attr=(
+//@ error-pattern:unclosed delimiter
+fn main() {}
diff --git a/tests/ui/attributes/z-crate-attr/unbalanced-paren.stderr b/tests/ui/attributes/z-crate-attr/unbalanced-paren.stderr
new file mode 100644
index 00000000000..47b1b764ba9
--- /dev/null
+++ b/tests/ui/attributes/z-crate-attr/unbalanced-paren.stderr
@@ -0,0 +1,10 @@
+error: this file contains an unclosed delimiter
+  --> <crate attribute>:1:2
+   |
+LL | (
+   | -^
+   | |
+   | unclosed delimiter
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/autodiff/autodiff_illegal.rs b/tests/ui/autodiff/autodiff_illegal.rs
index c0548d2bbb8..e810b9ba565 100644
--- a/tests/ui/autodiff/autodiff_illegal.rs
+++ b/tests/ui/autodiff/autodiff_illegal.rs
@@ -12,41 +12,40 @@ use std::autodiff::autodiff;
 // We can't use Duplicated on scalars
 #[autodiff(df1, Reverse, Duplicated)]
 pub fn f1(x: f64) {
-//~^ ERROR     Duplicated can not be used for this type
+    //~^ ERROR     Duplicated can not be used for this type
     unimplemented!()
 }
 
 // Too many activities
 #[autodiff(df3, Reverse, Duplicated, Const)]
 pub fn f3(x: f64) {
-//~^^ ERROR     expected 1 activities, but found 2
+    //~^^ ERROR     expected 1 activities, but found 2
     unimplemented!()
 }
 
 // To few activities
 #[autodiff(df4, Reverse)]
 pub fn f4(x: f64) {
-//~^^ ERROR     expected 1 activities, but found 0
+    //~^^ ERROR     expected 1 activities, but found 0
     unimplemented!()
 }
 
 // We can't use Dual in Reverse mode
 #[autodiff(df5, Reverse, Dual)]
 pub fn f5(x: f64) {
-//~^^ ERROR     Dual can not be used in Reverse Mode
+    //~^^ ERROR     Dual can not be used in Reverse Mode
     unimplemented!()
 }
 
 // We can't use Duplicated in Forward mode
 #[autodiff(df6, Forward, Duplicated)]
 pub fn f6(x: f64) {
-//~^^ ERROR Duplicated can not be used in Forward Mode
-//~^^ ERROR Duplicated can not be used for this type
+    //~^^ ERROR Duplicated can not be used in Forward Mode
+    //~^^ ERROR Duplicated can not be used for this type
     unimplemented!()
 }
 
 fn dummy() {
-
     #[autodiff(df7, Forward, Dual)]
     let mut x = 5;
     //~^ ERROR autodiff must be applied to function
@@ -64,21 +63,21 @@ fn dummy() {
 // Malformed, where args?
 #[autodiff]
 pub fn f7(x: f64) {
-//~^ ERROR autodiff must be applied to function
+    //~^ ERROR autodiff must be applied to function
     unimplemented!()
 }
 
 // Malformed, where args?
 #[autodiff()]
 pub fn f8(x: f64) {
-//~^ ERROR autodiff requires at least a name and mode
+    //~^ ERROR autodiff requires at least a name and mode
     unimplemented!()
 }
 
 // Invalid attribute syntax
 #[autodiff = ""]
 pub fn f9(x: f64) {
-//~^ ERROR autodiff must be applied to function
+    //~^ ERROR autodiff must be applied to function
     unimplemented!()
 }
 
@@ -87,21 +86,21 @@ fn fn_exists() {}
 // We colide with an already existing function
 #[autodiff(fn_exists, Reverse, Active)]
 pub fn f10(x: f64) {
-//~^^ ERROR the name `fn_exists` is defined multiple times [E0428]
+    //~^^ ERROR the name `fn_exists` is defined multiple times [E0428]
     unimplemented!()
 }
 
 // Malformed, missing a mode
 #[autodiff(df11)]
 pub fn f11() {
-//~^ ERROR autodiff requires at least a name and mode
+    //~^ ERROR autodiff requires at least a name and mode
     unimplemented!()
 }
 
 // Invalid Mode
 #[autodiff(df12, Debug)]
 pub fn f12() {
-//~^^ ERROR unknown Mode: `Debug`. Use `Forward` or `Reverse`
+    //~^^ ERROR unknown Mode: `Debug`. Use `Forward` or `Reverse`
     unimplemented!()
 }
 
@@ -109,7 +108,7 @@ pub fn f12() {
 // or use two autodiff macros.
 #[autodiff(df13, Forward, Reverse)]
 pub fn f13() {
-//~^^ ERROR did not recognize Activity: `Reverse`
+    //~^^ ERROR did not recognize Activity: `Reverse`
     unimplemented!()
 }
 
@@ -130,7 +129,7 @@ type MyFloat = f32;
 // like THIR which has type information available.
 #[autodiff(df15, Reverse, Active, Active)]
 fn f15(x: MyFloat) -> f32 {
-//~^^ ERROR failed to resolve: use of undeclared type `MyFloat` [E0433]
+    //~^^ ERROR failed to resolve: use of undeclared type `MyFloat` [E0433]
     unimplemented!()
 }
 
@@ -141,7 +140,9 @@ fn f16(x: f32) -> MyFloat {
 }
 
 #[repr(transparent)]
-struct F64Trans { inner: f64 }
+struct F64Trans {
+    inner: f64,
+}
 
 // We would like to support `#[repr(transparent)]` f32/f64 wrapper in return type in the future
 #[autodiff(df17, Reverse, Active, Active)]
@@ -156,5 +157,24 @@ fn f18(x: F64Trans) -> f64 {
     unimplemented!()
 }
 
+// Invalid return activity
+#[autodiff(df19, Forward, Dual, Active)]
+fn f19(x: f32) -> f32 {
+    //~^^ ERROR invalid return activity Active in Forward Mode
+    unimplemented!()
+}
+
+#[autodiff(df20, Reverse, Active, Dual)]
+fn f20(x: f32) -> f32 {
+    //~^^ ERROR invalid return activity Dual in Reverse Mode
+    unimplemented!()
+}
+
+// Duplicated cannot be used as return activity
+#[autodiff(df21, Reverse, Active, Duplicated)]
+fn f21(x: f32) -> f32 {
+    //~^^ ERROR invalid return activity Duplicated in Reverse Mode
+    unimplemented!()
+}
 
 fn main() {}
diff --git a/tests/ui/autodiff/autodiff_illegal.stderr b/tests/ui/autodiff/autodiff_illegal.stderr
index 3a7242b2f5d..47d53492700 100644
--- a/tests/ui/autodiff/autodiff_illegal.stderr
+++ b/tests/ui/autodiff/autodiff_illegal.stderr
@@ -1,5 +1,5 @@
 error[E0658]: attributes on expressions are experimental
-  --> $DIR/autodiff_illegal.rs:54:5
+  --> $DIR/autodiff_illegal.rs:53:5
    |
 LL |     #[autodiff(df7, Forward, Dual)]
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -53,25 +53,25 @@ LL | pub fn f6(x: f64) {
    |              ^^^
 
 error: autodiff must be applied to function
-  --> $DIR/autodiff_illegal.rs:51:5
+  --> $DIR/autodiff_illegal.rs:50:5
    |
 LL |     let mut x = 5;
    |     ^^^^^^^^^^^^^^
 
 error: autodiff must be applied to function
-  --> $DIR/autodiff_illegal.rs:55:5
+  --> $DIR/autodiff_illegal.rs:54:5
    |
 LL |     x = x + 3;
    |     ^
 
 error: autodiff must be applied to function
-  --> $DIR/autodiff_illegal.rs:60:5
+  --> $DIR/autodiff_illegal.rs:59:5
    |
 LL |     let add_one_v2 = |x: u32| -> u32 { x + 1 };
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: autodiff must be applied to function
-  --> $DIR/autodiff_illegal.rs:66:1
+  --> $DIR/autodiff_illegal.rs:65:1
    |
 LL | / pub fn f7(x: f64) {
 LL | |
@@ -80,7 +80,7 @@ LL | | }
    | |_^
 
 error: autodiff requires at least a name and mode
-  --> $DIR/autodiff_illegal.rs:73:1
+  --> $DIR/autodiff_illegal.rs:72:1
    |
 LL | / pub fn f8(x: f64) {
 LL | |
@@ -89,7 +89,7 @@ LL | | }
    | |_^
 
 error: autodiff must be applied to function
-  --> $DIR/autodiff_illegal.rs:80:1
+  --> $DIR/autodiff_illegal.rs:79:1
    |
 LL | / pub fn f9(x: f64) {
 LL | |
@@ -98,7 +98,7 @@ LL | | }
    | |_^
 
 error[E0428]: the name `fn_exists` is defined multiple times
-  --> $DIR/autodiff_illegal.rs:88:1
+  --> $DIR/autodiff_illegal.rs:87:1
    |
 LL | fn fn_exists() {}
    | -------------- previous definition of the value `fn_exists` here
@@ -110,7 +110,7 @@ LL | #[autodiff(fn_exists, Reverse, Active)]
    = note: this error originates in the attribute macro `autodiff` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: autodiff requires at least a name and mode
-  --> $DIR/autodiff_illegal.rs:96:1
+  --> $DIR/autodiff_illegal.rs:95:1
    |
 LL | / pub fn f11() {
 LL | |
@@ -119,19 +119,43 @@ LL | | }
    | |_^
 
 error: unknown Mode: `Debug`. Use `Forward` or `Reverse`
-  --> $DIR/autodiff_illegal.rs:102:18
+  --> $DIR/autodiff_illegal.rs:101:18
    |
 LL | #[autodiff(df12, Debug)]
    |                  ^^^^^
 
 error: did not recognize Activity: `Reverse`
-  --> $DIR/autodiff_illegal.rs:110:27
+  --> $DIR/autodiff_illegal.rs:109:27
    |
 LL | #[autodiff(df13, Forward, Reverse)]
    |                           ^^^^^^^
 
+error: invalid return activity Active in Forward Mode
+  --> $DIR/autodiff_illegal.rs:161:1
+   |
+LL | #[autodiff(df19, Forward, Dual, Active)]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this error originates in the attribute macro `autodiff` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: invalid return activity Dual in Reverse Mode
+  --> $DIR/autodiff_illegal.rs:167:1
+   |
+LL | #[autodiff(df20, Reverse, Active, Dual)]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this error originates in the attribute macro `autodiff` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: invalid return activity Duplicated in Reverse Mode
+  --> $DIR/autodiff_illegal.rs:174:1
+   |
+LL | #[autodiff(df21, Reverse, Active, Duplicated)]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this error originates in the attribute macro `autodiff` (in Nightly builds, run with -Z macro-backtrace for more info)
+
 error[E0433]: failed to resolve: use of undeclared type `MyFloat`
-  --> $DIR/autodiff_illegal.rs:131:1
+  --> $DIR/autodiff_illegal.rs:130:1
    |
 LL | #[autodiff(df15, Reverse, Active, Active)]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of undeclared type `MyFloat`
@@ -139,14 +163,14 @@ LL | #[autodiff(df15, Reverse, Active, Active)]
    = note: this error originates in the attribute macro `autodiff` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0433]: failed to resolve: use of undeclared type `F64Trans`
-  --> $DIR/autodiff_illegal.rs:153:1
+  --> $DIR/autodiff_illegal.rs:154:1
    |
 LL | #[autodiff(df18, Reverse, Active, Active)]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of undeclared type `F64Trans`
    |
    = note: this error originates in the attribute macro `autodiff` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: aborting due to 19 previous errors
+error: aborting due to 22 previous errors
 
 Some errors have detailed explanations: E0428, E0433, E0658.
 For more information about an error, try `rustc --explain E0428`.
diff --git a/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.rs b/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.rs
index 6f323d91227..9d323bf0324 100644
--- a/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.rs
+++ b/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.rs
@@ -1,6 +1,5 @@
-#![feature(rustc_attrs)]
 #![allow(dead_code)]
-fn main() { #![rustc_error] // rust-lang/rust#49855
+fn main() {
     // Original borrow ends at end of function
     let mut x = 1;
     let y = &mut x;
diff --git a/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr b/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr
index db73d4c04ac..444a74cbfcf 100644
--- a/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr
+++ b/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr
@@ -1,5 +1,5 @@
 error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
-  --> $DIR/borrowck-report-with-custom-diagnostic.rs:8:13
+  --> $DIR/borrowck-report-with-custom-diagnostic.rs:7:13
    |
 LL |     let y = &mut x;
    |             ------ mutable borrow occurs here
@@ -11,7 +11,7 @@ LL |     y.use_mut();
    |     - mutable borrow later used here
 
 error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
-  --> $DIR/borrowck-report-with-custom-diagnostic.rs:21:21
+  --> $DIR/borrowck-report-with-custom-diagnostic.rs:20:21
    |
 LL |             let y = &x;
    |                     -- immutable borrow occurs here
@@ -23,7 +23,7 @@ LL |             y.use_ref();
    |             - immutable borrow later used here
 
 error[E0499]: cannot borrow `x` as mutable more than once at a time
-  --> $DIR/borrowck-report-with-custom-diagnostic.rs:36:17
+  --> $DIR/borrowck-report-with-custom-diagnostic.rs:35:17
    |
 LL |         let y = &mut x;
    |                 ------ first mutable borrow occurs here
diff --git a/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.stderr b/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.stderr
index 3ee89d9734a..30f292f71a2 100644
--- a/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.stderr
+++ b/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.stderr
@@ -11,7 +11,6 @@ LL |     bar(x);
    |
    = note: the result of `format_args!` can only be assigned directly if no placeholders in its arguments are used
    = note: to learn more, visit <https://doc.rust-lang.org/std/macro.format_args.html>
-   = note: this error originates in the macro `format_args` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0716]: temporary value dropped while borrowed
   --> $DIR/issue-114374-invalid-help-fmt-args.rs:10:15
@@ -26,7 +25,6 @@ LL |     bar(foo);
    |
    = note: the result of `format_args!` can only be assigned directly if no placeholders in its arguments are used
    = note: to learn more, visit <https://doc.rust-lang.org/std/macro.format_args.html>
-   = note: this error originates in the macro `format_args` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/borrowck/issue-81899.stderr b/tests/ui/borrowck/issue-81899.stderr
index 2e6e7511ec9..b5cd5e4abf3 100644
--- a/tests/ui/borrowck/issue-81899.stderr
+++ b/tests/ui/borrowck/issue-81899.stderr
@@ -9,7 +9,6 @@ note: inside `f::<{closure@$DIR/issue-81899.rs:4:31: 4:34}>`
    |
 LL |     panic!()
    |     ^^^^^^^^ the failure occurred here
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/issue-81899.rs:4:23
diff --git a/tests/ui/borrowck/issue-88434-minimal-example.stderr b/tests/ui/borrowck/issue-88434-minimal-example.stderr
index c8ac13a3473..d9f3b4dcb90 100644
--- a/tests/ui/borrowck/issue-88434-minimal-example.stderr
+++ b/tests/ui/borrowck/issue-88434-minimal-example.stderr
@@ -9,7 +9,6 @@ note: inside `f::<{closure@$DIR/issue-88434-minimal-example.rs:3:25: 3:28}>`
    |
 LL |     panic!()
    |     ^^^^^^^^ the failure occurred here
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/issue-88434-minimal-example.rs:3:21
diff --git a/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr b/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr
index 0041759609c..c82b5cf786d 100644
--- a/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr
+++ b/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr
@@ -9,7 +9,6 @@ note: inside `f::<{closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31
    |
 LL |     panic!()
    |     ^^^^^^^^ the failure occurred here
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/issue-88434-removal-index-should-be-less.rs:3:23
diff --git a/tests/ui/borrowck/mut-borrow-outside-loop.rs b/tests/ui/borrowck/mut-borrow-outside-loop.rs
index c02bfbf8739..3cc362def38 100644
--- a/tests/ui/borrowck/mut-borrow-outside-loop.rs
+++ b/tests/ui/borrowck/mut-borrow-outside-loop.rs
@@ -1,6 +1,6 @@
 // ensure borrowck messages are correct outside special case
-#![feature(rustc_attrs)]
-fn main() { #![rustc_error] // rust-lang/rust#49855
+
+fn main() {
     let mut void = ();
 
     let first = &mut void;
diff --git a/tests/ui/borrowck/overwrite-anon-late-param-regions.rs b/tests/ui/borrowck/overwrite-anon-late-param-regions.rs
index 7b0f784068f..8e0e005cd78 100644
--- a/tests/ui/borrowck/overwrite-anon-late-param-regions.rs
+++ b/tests/ui/borrowck/overwrite-anon-late-param-regions.rs
@@ -6,6 +6,7 @@
 #![feature(type_alias_impl_trait)]
 type Opaque2<'a> = impl Sized + 'a;
 
+#[define_opaque(Opaque2)]
 fn test2() -> impl for<'a, 'b> Fn((&'a str, &'b str)) -> (Opaque2<'a>, Opaque2<'a>) {
     |x| x
     //~^ ERROR lifetime may not live long enough
diff --git a/tests/ui/borrowck/overwrite-anon-late-param-regions.stderr b/tests/ui/borrowck/overwrite-anon-late-param-regions.stderr
index c5b7284271e..96b3ebf1eb4 100644
--- a/tests/ui/borrowck/overwrite-anon-late-param-regions.stderr
+++ b/tests/ui/borrowck/overwrite-anon-late-param-regions.stderr
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/overwrite-anon-late-param-regions.rs:10:9
+  --> $DIR/overwrite-anon-late-param-regions.rs:11:9
    |
 LL |     |x| x
    |      -  ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
@@ -8,7 +8,7 @@ LL |     |x| x
    |      has type `(&'2 str, &str)`
 
 error[E0792]: expected generic lifetime parameter, found `'a`
-  --> $DIR/overwrite-anon-late-param-regions.rs:10:5
+  --> $DIR/overwrite-anon-late-param-regions.rs:11:5
    |
 LL | type Opaque2<'a> = impl Sized + 'a;
    |              -- this generic parameter must be used with a generic lifetime parameter
diff --git a/tests/ui/cast/cast_lit_suffix-issue-138392.fixed b/tests/ui/cast/cast_lit_suffix-issue-138392.fixed
new file mode 100644
index 00000000000..c6fbd09f89c
--- /dev/null
+++ b/tests/ui/cast/cast_lit_suffix-issue-138392.fixed
@@ -0,0 +1,6 @@
+//@ run-rustfix
+#![allow(unused_parens)]
+fn main() {
+    let _x: u8 = (4u8); //~ ERROR: mismatched types
+    let _y: u8 = (4u8); //~ ERROR: mismatched types
+}
diff --git a/tests/ui/cast/cast_lit_suffix-issue-138392.rs b/tests/ui/cast/cast_lit_suffix-issue-138392.rs
new file mode 100644
index 00000000000..86dbbbbf126
--- /dev/null
+++ b/tests/ui/cast/cast_lit_suffix-issue-138392.rs
@@ -0,0 +1,6 @@
+//@ run-rustfix
+#![allow(unused_parens)]
+fn main() {
+    let _x: u8 = (4i32); //~ ERROR: mismatched types
+    let _y: u8 = (4.0f32); //~ ERROR: mismatched types
+}
diff --git a/tests/ui/cast/cast_lit_suffix-issue-138392.stderr b/tests/ui/cast/cast_lit_suffix-issue-138392.stderr
new file mode 100644
index 00000000000..998fcfc36dc
--- /dev/null
+++ b/tests/ui/cast/cast_lit_suffix-issue-138392.stderr
@@ -0,0 +1,31 @@
+error[E0308]: mismatched types
+  --> $DIR/cast_lit_suffix-issue-138392.rs:4:18
+   |
+LL |     let _x: u8 = (4i32);
+   |             --   ^^^^^^ expected `u8`, found `i32`
+   |             |
+   |             expected due to this
+   |
+help: change the type of the numeric literal from `i32` to `u8`
+   |
+LL -     let _x: u8 = (4i32);
+LL +     let _x: u8 = (4u8);
+   |
+
+error[E0308]: mismatched types
+  --> $DIR/cast_lit_suffix-issue-138392.rs:5:18
+   |
+LL |     let _y: u8 = (4.0f32);
+   |             --   ^^^^^^^^ expected `u8`, found `f32`
+   |             |
+   |             expected due to this
+   |
+help: change the type of the numeric literal from `f32` to `u8`
+   |
+LL -     let _y: u8 = (4.0f32);
+LL +     let _y: u8 = (4u8);
+   |
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/cast/ptr-to-trait-obj-wrap-add-auto.rs b/tests/ui/cast/ptr-to-trait-obj-wrap-add-auto.rs
deleted file mode 100644
index cfc0a97989d..00000000000
--- a/tests/ui/cast/ptr-to-trait-obj-wrap-add-auto.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Combination of `ptr-to-trait-obj-wrap.rs` and `ptr-to-trait-obj-add-auto.rs`.
-//
-// Checks that you *can't* add auto traits to trait object in pointer casts involving wrapping said
-// traits structures.
-
-trait A {}
-
-struct W<T: ?Sized>(T);
-struct X<T: ?Sized>(T);
-
-fn unwrap(a: *const W<dyn A>) -> *const (dyn A + Send) {
-    a as _
-    //~^ error: cannot add auto trait `Send` to dyn bound via pointer cast
-}
-
-fn unwrap_nested(a: *const W<W<dyn A>>) -> *const W<dyn A + Send> {
-    a as _
-    //~^ error: cannot add auto trait `Send` to dyn bound via pointer cast
-}
-
-fn rewrap(a: *const W<dyn A>) -> *const X<dyn A + Send> {
-    a as _
-    //~^ error: cannot add auto trait `Send` to dyn bound via pointer cast
-}
-
-fn rewrap_nested(a: *const W<W<dyn A>>) -> *const W<X<dyn A + Send>> {
-    a as _
-    //~^ error: cannot add auto trait `Send` to dyn bound via pointer cast
-}
-
-fn wrap(a: *const dyn A) -> *const W<dyn A + Send> {
-    a as _
-    //~^ error: cannot add auto trait `Send` to dyn bound via pointer cast
-}
-
-fn main() {}
diff --git a/tests/ui/cast/ptr-to-trait-obj-wrap-add-auto.stderr b/tests/ui/cast/ptr-to-trait-obj-wrap-add-auto.stderr
deleted file mode 100644
index 42cdbc34ee8..00000000000
--- a/tests/ui/cast/ptr-to-trait-obj-wrap-add-auto.stderr
+++ /dev/null
@@ -1,48 +0,0 @@
-error[E0804]: cannot add auto trait `Send` to dyn bound via pointer cast
-  --> $DIR/ptr-to-trait-obj-wrap-add-auto.rs:12:5
-   |
-LL |     a as _
-   |     ^^^^^^ unsupported cast
-   |
-   = note: this could allow UB elsewhere
-   = help: use `transmute` if you're sure this is sound
-
-error[E0804]: cannot add auto trait `Send` to dyn bound via pointer cast
-  --> $DIR/ptr-to-trait-obj-wrap-add-auto.rs:17:5
-   |
-LL |     a as _
-   |     ^^^^^^ unsupported cast
-   |
-   = note: this could allow UB elsewhere
-   = help: use `transmute` if you're sure this is sound
-
-error[E0804]: cannot add auto trait `Send` to dyn bound via pointer cast
-  --> $DIR/ptr-to-trait-obj-wrap-add-auto.rs:22:5
-   |
-LL |     a as _
-   |     ^^^^^^ unsupported cast
-   |
-   = note: this could allow UB elsewhere
-   = help: use `transmute` if you're sure this is sound
-
-error[E0804]: cannot add auto trait `Send` to dyn bound via pointer cast
-  --> $DIR/ptr-to-trait-obj-wrap-add-auto.rs:27:5
-   |
-LL |     a as _
-   |     ^^^^^^ unsupported cast
-   |
-   = note: this could allow UB elsewhere
-   = help: use `transmute` if you're sure this is sound
-
-error[E0804]: cannot add auto trait `Send` to dyn bound via pointer cast
-  --> $DIR/ptr-to-trait-obj-wrap-add-auto.rs:32:5
-   |
-LL |     a as _
-   |     ^^^^^^ unsupported cast
-   |
-   = note: this could allow UB elsewhere
-   = help: use `transmute` if you're sure this is sound
-
-error: aborting due to 5 previous errors
-
-For more information about this error, try `rustc --explain E0804`.
diff --git a/tests/ui/cast/ptr-to-trait-obj-wrap-different-args.rs b/tests/ui/cast/ptr-to-trait-obj-wrap-different-args.rs
deleted file mode 100644
index ebe7a06a7a1..00000000000
--- a/tests/ui/cast/ptr-to-trait-obj-wrap-different-args.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Combination of `ptr-to-trait-obj-different-args.rs` and `ptr-to-trait-obj-wrap.rs`.
-//
-// Checks that you *can't* change type arguments of trait objects in pointer casts involving
-// wrapping said traits structures.
-
-trait A<T> {}
-
-struct W<T: ?Sized>(T);
-struct X<T: ?Sized>(T);
-
-fn unwrap<F, G>(a: *const W<dyn A<F>>) -> *const dyn A<G> {
-    a as _
-    //~^ error casting `*const W<(dyn A<F> + 'static)>` as `*const dyn A<G>` is invalid
-}
-
-fn unwrap_nested<F, G>(a: *const W<W<dyn A<F>>>) -> *const W<dyn A<G>> {
-    a as _
-    //~^ error casting `*const W<W<(dyn A<F> + 'static)>>` as `*const W<dyn A<G>>` is invalid
-}
-
-fn rewrap<F, G>(a: *const W<dyn A<F>>) -> *const X<dyn A<G>> {
-    a as _
-    //~^ error: casting `*const W<(dyn A<F> + 'static)>` as `*const X<dyn A<G>>` is invalid
-}
-
-fn rewrap_nested<F, G>(a: *const W<W<dyn A<F>>>) -> *const W<X<dyn A<G>>> {
-    a as _
-    //~^ error: casting `*const W<W<(dyn A<F> + 'static)>>` as `*const W<X<dyn A<G>>>` is invalid
-}
-
-fn wrap<F, G>(a: *const dyn A<F>) -> *const W<dyn A<G>> {
-    a as _
-    //~^ error: casting `*const (dyn A<F> + 'static)` as `*const W<dyn A<G>>` is invalid
-}
-
-fn main() {}
diff --git a/tests/ui/cast/ptr-to-trait-obj-wrap-different-args.stderr b/tests/ui/cast/ptr-to-trait-obj-wrap-different-args.stderr
deleted file mode 100644
index 4f85b208d05..00000000000
--- a/tests/ui/cast/ptr-to-trait-obj-wrap-different-args.stderr
+++ /dev/null
@@ -1,43 +0,0 @@
-error[E0606]: casting `*const W<(dyn A<F> + 'static)>` as `*const dyn A<G>` is invalid
-  --> $DIR/ptr-to-trait-obj-wrap-different-args.rs:12:5
-   |
-LL |     a as _
-   |     ^^^^^^
-   |
-   = note: the trait objects may have different vtables
-
-error[E0606]: casting `*const W<W<(dyn A<F> + 'static)>>` as `*const W<dyn A<G>>` is invalid
-  --> $DIR/ptr-to-trait-obj-wrap-different-args.rs:17:5
-   |
-LL |     a as _
-   |     ^^^^^^
-   |
-   = note: the trait objects may have different vtables
-
-error[E0606]: casting `*const W<(dyn A<F> + 'static)>` as `*const X<dyn A<G>>` is invalid
-  --> $DIR/ptr-to-trait-obj-wrap-different-args.rs:22:5
-   |
-LL |     a as _
-   |     ^^^^^^
-   |
-   = note: the trait objects may have different vtables
-
-error[E0606]: casting `*const W<W<(dyn A<F> + 'static)>>` as `*const W<X<dyn A<G>>>` is invalid
-  --> $DIR/ptr-to-trait-obj-wrap-different-args.rs:27:5
-   |
-LL |     a as _
-   |     ^^^^^^
-   |
-   = note: the trait objects may have different vtables
-
-error[E0606]: casting `*const (dyn A<F> + 'static)` as `*const W<dyn A<G>>` is invalid
-  --> $DIR/ptr-to-trait-obj-wrap-different-args.rs:32:5
-   |
-LL |     a as _
-   |     ^^^^^^
-   |
-   = note: the trait objects may have different vtables
-
-error: aborting due to 5 previous errors
-
-For more information about this error, try `rustc --explain E0606`.
diff --git a/tests/ui/cast/ptr-to-trait-obj-wrap-different-regions.rs b/tests/ui/cast/ptr-to-trait-obj-wrap-different-regions.rs
deleted file mode 100644
index b0941277d01..00000000000
--- a/tests/ui/cast/ptr-to-trait-obj-wrap-different-regions.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-// Combination of `ptr-to-trait-obj-different-regions-misc.rs` and `ptr-to-trait-obj-wrap.rs`.
-//
-// Checks that you *can't* change lifetime arguments of trait objects in pointer casts involving
-// wrapping said traits structures.
-
-trait A<'a> {}
-
-struct W<T: ?Sized>(T);
-struct X<T: ?Sized>(T);
-
-fn unwrap<'a, 'b>(a: *const W<dyn A<'a>>) -> *const dyn A<'b> {
-    a as _
-    //~^ error
-    //~| error
-}
-
-fn unwrap_nested<'a, 'b>(a: *const W<W<dyn A<'a>>>) -> *const W<dyn A<'b>> {
-    a as _
-    //~^ error
-    //~| error
-}
-
-fn rewrap<'a, 'b>(a: *const W<dyn A<'a>>) -> *const X<dyn A<'b>> {
-    a as _
-    //~^ error: lifetime may not live long enough
-    //~| error: lifetime may not live long enough
-}
-
-fn rewrap_nested<'a, 'b>(a: *const W<W<dyn A<'a>>>) -> *const W<X<dyn A<'b>>> {
-    a as _
-    //~^ error: lifetime may not live long enough
-    //~| error: lifetime may not live long enough
-}
-
-fn wrap<'a, 'b>(a: *const dyn A<'a>) -> *const W<dyn A<'b>> {
-    a as _
-    //~^ error: lifetime may not live long enough
-    //~| error: lifetime may not live long enough
-}
-
-fn main() {}
diff --git a/tests/ui/cast/ptr-to-trait-obj-wrap-different-regions.stderr b/tests/ui/cast/ptr-to-trait-obj-wrap-different-regions.stderr
deleted file mode 100644
index 17a0ca3c34f..00000000000
--- a/tests/ui/cast/ptr-to-trait-obj-wrap-different-regions.stderr
+++ /dev/null
@@ -1,140 +0,0 @@
-error: lifetime may not live long enough
-  --> $DIR/ptr-to-trait-obj-wrap-different-regions.rs:12:5
-   |
-LL | fn unwrap<'a, 'b>(a: *const W<dyn A<'a>>) -> *const dyn A<'b> {
-   |           --  -- lifetime `'b` defined here
-   |           |
-   |           lifetime `'a` defined here
-LL |     a as _
-   |     ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
-   |
-   = help: consider adding the following bound: `'b: 'a`
-
-error: lifetime may not live long enough
-  --> $DIR/ptr-to-trait-obj-wrap-different-regions.rs:12:5
-   |
-LL | fn unwrap<'a, 'b>(a: *const W<dyn A<'a>>) -> *const dyn A<'b> {
-   |           --  -- lifetime `'b` defined here
-   |           |
-   |           lifetime `'a` defined here
-LL |     a as _
-   |     ^^^^^^ 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`
-
-help: `'b` and `'a` must be the same: replace one with the other
-
-error: lifetime may not live long enough
-  --> $DIR/ptr-to-trait-obj-wrap-different-regions.rs:18:5
-   |
-LL | fn unwrap_nested<'a, 'b>(a: *const W<W<dyn A<'a>>>) -> *const W<dyn A<'b>> {
-   |                  --  -- lifetime `'b` defined here
-   |                  |
-   |                  lifetime `'a` defined here
-LL |     a as _
-   |     ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
-   |
-   = help: consider adding the following bound: `'b: 'a`
-
-error: lifetime may not live long enough
-  --> $DIR/ptr-to-trait-obj-wrap-different-regions.rs:18:5
-   |
-LL | fn unwrap_nested<'a, 'b>(a: *const W<W<dyn A<'a>>>) -> *const W<dyn A<'b>> {
-   |                  --  -- lifetime `'b` defined here
-   |                  |
-   |                  lifetime `'a` defined here
-LL |     a as _
-   |     ^^^^^^ 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`
-
-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-wrap-different-regions.rs:24:5
-   |
-LL | fn rewrap<'a, 'b>(a: *const W<dyn A<'a>>) -> *const X<dyn A<'b>> {
-   |           --  -- lifetime `'b` defined here
-   |           |
-   |           lifetime `'a` defined here
-LL |     a as _
-   |     ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
-   |
-   = help: consider adding the following bound: `'b: 'a`
-
-error: lifetime may not live long enough
-  --> $DIR/ptr-to-trait-obj-wrap-different-regions.rs:24:5
-   |
-LL | fn rewrap<'a, 'b>(a: *const W<dyn A<'a>>) -> *const X<dyn A<'b>> {
-   |           --  -- lifetime `'b` defined here
-   |           |
-   |           lifetime `'a` defined here
-LL |     a as _
-   |     ^^^^^^ 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`
-
-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-wrap-different-regions.rs:30:5
-   |
-LL | fn rewrap_nested<'a, 'b>(a: *const W<W<dyn A<'a>>>) -> *const W<X<dyn A<'b>>> {
-   |                  --  -- lifetime `'b` defined here
-   |                  |
-   |                  lifetime `'a` defined here
-LL |     a as _
-   |     ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
-   |
-   = help: consider adding the following bound: `'b: 'a`
-
-error: lifetime may not live long enough
-  --> $DIR/ptr-to-trait-obj-wrap-different-regions.rs:30:5
-   |
-LL | fn rewrap_nested<'a, 'b>(a: *const W<W<dyn A<'a>>>) -> *const W<X<dyn A<'b>>> {
-   |                  --  -- lifetime `'b` defined here
-   |                  |
-   |                  lifetime `'a` defined here
-LL |     a as _
-   |     ^^^^^^ 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`
-
-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-wrap-different-regions.rs:36:5
-   |
-LL | fn wrap<'a, 'b>(a: *const dyn A<'a>) -> *const W<dyn A<'b>> {
-   |         --  -- lifetime `'b` defined here
-   |         |
-   |         lifetime `'a` defined here
-LL |     a as _
-   |     ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
-   |
-   = help: consider adding the following bound: `'b: 'a`
-
-error: lifetime may not live long enough
-  --> $DIR/ptr-to-trait-obj-wrap-different-regions.rs:36:5
-   |
-LL | fn wrap<'a, 'b>(a: *const dyn A<'a>) -> *const W<dyn A<'b>> {
-   |         --  -- lifetime `'b` defined here
-   |         |
-   |         lifetime `'a` defined here
-LL |     a as _
-   |     ^^^^^^ 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`
-
-help: `'b` and `'a` must be the same: replace one with the other
-   |
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-
-error: aborting due to 10 previous errors
-
diff --git a/tests/ui/cast/ptr-to-trait-obj-wrap.rs b/tests/ui/cast/ptr-to-trait-obj-wrap.rs
deleted file mode 100644
index 6f9f6bddb99..00000000000
--- a/tests/ui/cast/ptr-to-trait-obj-wrap.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-// Checks that various casts of pointers to trait objects wrapped in structures
-// work. Note that the metadata doesn't change when a DST is wrapped in a
-// structure, so these casts *are* fine.
-//
-// `unwrap` and `unwrap_nested` currently don't work due to a compiler limitation.
-//@ check-pass
-
-trait A {}
-
-struct W<T: ?Sized>(T);
-struct X<T: ?Sized>(T);
-
-fn unwrap(a: *const W<dyn A>) -> *const dyn A {
-    a as _
-}
-
-fn unwrap_nested(a: *const W<W<dyn A>>) -> *const W<dyn A> {
-    a as _
-}
-
-fn rewrap(a: *const W<dyn A>) -> *const X<dyn A> {
-    a as _
-}
-
-fn rewrap_nested(a: *const W<W<dyn A>>) -> *const W<X<dyn A>> {
-    a as _
-}
-
-fn wrap(a: *const dyn A) -> *const W<dyn A> {
-    a as _
-}
-
-fn main() {}
diff --git a/tests/ui/cfg/disallowed-cli-cfgs.rs b/tests/ui/cfg/disallowed-cli-cfgs.rs
index cae9c65cb45..e9661abf3ab 100644
--- a/tests/ui/cfg/disallowed-cli-cfgs.rs
+++ b/tests/ui/cfg/disallowed-cli-cfgs.rs
@@ -37,3 +37,5 @@
 //@ [emscripten_wasm_eh_]compile-flags: --cfg emscripten_wasm_eh
 
 fn main() {}
+
+//~? ERROR unexpected `--cfg
diff --git a/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr b/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr
index e7b8f355057..b07d630e5f5 100644
--- a/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr
+++ b/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr
@@ -14,7 +14,7 @@ warning: unexpected `cfg` condition value: `value`
 LL | #[cfg(target_vendor = "value")]
    |       ^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: expected values for `target_vendor` are: `amd`, `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `mti`, `nintendo`, `nvidia`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs`
+   = note: expected values for `target_vendor` are: `amd`, `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `mti`, `nintendo`, `nvidia`, `openwrt`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition name: `feature`
diff --git a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr
index 95af0a90929..80f8f36c23f 100644
--- a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr
+++ b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr
@@ -15,7 +15,7 @@ warning: unexpected `cfg` condition value: `value`
 LL | #[cfg(target_vendor = "value")]
    |       ^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: expected values for `target_vendor` are: `amd`, `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `mti`, `nintendo`, `nvidia`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs`
+   = note: expected values for `target_vendor` are: `amd`, `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `mti`, `nintendo`, `nvidia`, `openwrt`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `unk`
diff --git a/tests/ui/check-cfg/exhaustive-names-values.full.stderr b/tests/ui/check-cfg/exhaustive-names-values.full.stderr
index 95af0a90929..80f8f36c23f 100644
--- a/tests/ui/check-cfg/exhaustive-names-values.full.stderr
+++ b/tests/ui/check-cfg/exhaustive-names-values.full.stderr
@@ -15,7 +15,7 @@ warning: unexpected `cfg` condition value: `value`
 LL | #[cfg(target_vendor = "value")]
    |       ^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: expected values for `target_vendor` are: `amd`, `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `mti`, `nintendo`, `nvidia`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs`
+   = note: expected values for `target_vendor` are: `amd`, `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `mti`, `nintendo`, `nvidia`, `openwrt`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `unk`
diff --git a/tests/ui/check-cfg/invalid-arguments.rs b/tests/ui/check-cfg/invalid-arguments.rs
index c6b1218ce27..3bea128e3e4 100644
--- a/tests/ui/check-cfg/invalid-arguments.rs
+++ b/tests/ui/check-cfg/invalid-arguments.rs
@@ -36,3 +36,5 @@
 //@ [unsafe_attr]compile-flags: --check-cfg=unsafe(cfg(foo))
 
 fn main() {}
+
+//~? ERROR invalid `--check-cfg` argument
diff --git a/tests/ui/check-cfg/target_feature.stderr b/tests/ui/check-cfg/target_feature.stderr
index 5b82d3f539f..e23984dc595 100644
--- a/tests/ui/check-cfg/target_feature.stderr
+++ b/tests/ui/check-cfg/target_feature.stderr
@@ -60,6 +60,7 @@ LL |     cfg!(target_feature = "_UNEXPECTED_VALUE");
 `d32`
 `deflate-conversion`
 `dit`
+`div32`
 `doloop`
 `dotprod`
 `dpb`
@@ -133,8 +134,11 @@ LL |     cfg!(target_feature = "_UNEXPECTED_VALUE");
 `jsconv`
 `kl`
 `lahfsahf`
+`lam-bh`
+`lamcas`
 `lasx`
 `lbt`
+`ld-seq-sa`
 `leoncasa`
 `lor`
 `lse`
@@ -190,6 +194,7 @@ LL |     cfg!(target_feature = "_UNEXPECTED_VALUE");
 `reserve-x18`
 `rtm`
 `sb`
+`scq`
 `sha`
 `sha2`
 `sha3`
@@ -240,6 +245,7 @@ LL |     cfg!(target_feature = "_UNEXPECTED_VALUE");
 `trustzone`
 `ual`
 `unaligned-scalar-mem`
+`unaligned-vector-mem`
 `v`
 `v5te`
 `v6`
@@ -320,7 +326,42 @@ LL |     cfg!(target_feature = "_UNEXPECTED_VALUE");
 `zkr`
 `zks`
 `zksed`
-`zksh`, and `zkt`
+`zksh`
+`zkt`
+`zvbb`
+`zvbc`
+`zve32f`
+`zve32x`
+`zve64d`
+`zve64f`
+`zve64x`
+`zvfh`
+`zvfhmin`
+`zvkb`
+`zvkg`
+`zvkn`
+`zvknc`
+`zvkned`
+`zvkng`
+`zvknha`
+`zvknhb`
+`zvks`
+`zvksc`
+`zvksed`
+`zvksg`
+`zvksh`
+`zvkt`
+`zvl1024b`
+`zvl128b`
+`zvl16384b`
+`zvl2048b`
+`zvl256b`
+`zvl32768b`
+`zvl32b`
+`zvl4096b`
+`zvl512b`
+`zvl64b`
+`zvl65536b`, and `zvl8192b`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
    = note: `#[warn(unexpected_cfgs)]` on by default
 
diff --git a/tests/ui/check-cfg/well-known-values.stderr b/tests/ui/check-cfg/well-known-values.stderr
index ba1900fcddb..4636b6945d0 100644
--- a/tests/ui/check-cfg/well-known-values.stderr
+++ b/tests/ui/check-cfg/well-known-values.stderr
@@ -230,7 +230,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
 LL |     target_vendor = "_UNEXPECTED_VALUE",
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: expected values for `target_vendor` are: `amd`, `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `mti`, `nintendo`, `nvidia`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs`
+   = note: expected values for `target_vendor` are: `amd`, `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `mti`, `nintendo`, `nvidia`, `openwrt`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
diff --git a/tests/ui/closures/upvar-or-pattern-issue-138958.rs b/tests/ui/closures/upvar-or-pattern-issue-138958.rs
new file mode 100644
index 00000000000..fe9ebc0a7e6
--- /dev/null
+++ b/tests/ui/closures/upvar-or-pattern-issue-138958.rs
@@ -0,0 +1,11 @@
+//@ edition:2024
+//@ check-pass
+
+pub fn f(x: (u32, u32)) {
+    let _ = || {
+        let ((0, a) | (a, _)) = x;
+        a
+    };
+}
+
+fn main() {}
diff --git a/tests/ui/codegen/duplicated-path-in-error.rs b/tests/ui/codegen/duplicated-path-in-error.rs
index cff20dd9bd6..a446395de20 100644
--- a/tests/ui/codegen/duplicated-path-in-error.rs
+++ b/tests/ui/codegen/duplicated-path-in-error.rs
@@ -5,3 +5,5 @@
 // the path of the dylib.
 
 fn main() {}
+
+//~? ERROR couldn't load codegen backend /non-existing-one.so
diff --git a/tests/ui/codegen/empty-static-libs-issue-108825.rs b/tests/ui/codegen/empty-static-libs-issue-108825.rs
new file mode 100644
index 00000000000..46bd6d6b2da
--- /dev/null
+++ b/tests/ui/codegen/empty-static-libs-issue-108825.rs
@@ -0,0 +1,16 @@
+//! Test that linking a no_std application still outputs the
+//! `native-static-libs: ` note, even though it is empty.
+
+//@ compile-flags: -Cpanic=abort --print=native-static-libs
+//@ build-pass
+//@ error-pattern: note: native-static-libs:
+//@ dont-check-compiler-stderr (libcore links `/defaultlib:msvcrt` or `/defaultlib:libcmt` on MSVC)
+//@ ignore-pass (the note is emitted later in the compilation pipeline, needs build)
+
+#![crate_type = "staticlib"]
+#![no_std]
+
+#[panic_handler]
+fn panic(_info: &core::panic::PanicInfo) -> ! {
+    loop {}
+}
diff --git a/tests/ui/codemap_tests/issue-11715.rs b/tests/ui/codemap_tests/issue-11715.rs
index 617d57ff75a..d0daaf444b3 100644
--- a/tests/ui/codemap_tests/issue-11715.rs
+++ b/tests/ui/codemap_tests/issue-11715.rs
@@ -1,5 +1,4 @@
-#![feature(rustc_attrs)]
-fn main() { #![rustc_error] // rust-lang/rust#49855
+fn main() {
     let mut x = "foo";
     let y = &mut x;
     let z = &mut x; //~ ERROR cannot borrow
diff --git a/tests/ui/codemap_tests/issue-11715.stderr b/tests/ui/codemap_tests/issue-11715.stderr
index 5d0cf718761..6b330560adb 100644
--- a/tests/ui/codemap_tests/issue-11715.stderr
+++ b/tests/ui/codemap_tests/issue-11715.stderr
@@ -1,5 +1,5 @@
 error[E0499]: cannot borrow `x` as mutable more than once at a time
-  --> $DIR/issue-11715.rs:5:13
+  --> $DIR/issue-11715.rs:4:13
    |
 LL |     let y = &mut x;
    |             ------ first mutable borrow occurs here
diff --git a/tests/ui/codemap_tests/issue-28308.stderr b/tests/ui/codemap_tests/issue-28308.stderr
index efd8fa22fa5..7bc9e05dfc0 100644
--- a/tests/ui/codemap_tests/issue-28308.stderr
+++ b/tests/ui/codemap_tests/issue-28308.stderr
@@ -3,8 +3,6 @@ error[E0600]: cannot apply unary operator `!` to type `&'static str`
    |
 LL |     assert!("foo");
    |     ^^^^^^^^^^^^^^ cannot apply unary operator `!`
-   |
-   = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/coercion/struct-coerce-vec-to-slice.rs b/tests/ui/coercion/struct-coerce-vec-to-slice.rs
new file mode 100644
index 00000000000..9ef20ac4ea6
--- /dev/null
+++ b/tests/ui/coercion/struct-coerce-vec-to-slice.rs
@@ -0,0 +1,20 @@
+//! Regression test that ensures struct field literals can be coerced into slice and `Box` types
+
+//@ check-pass
+
+struct Thing1<'a> {
+    baz: &'a [Box<isize>],
+    bar: Box<u64>,
+}
+
+struct Thing2<'a> {
+    baz: &'a [Box<isize>],
+    bar: u64,
+}
+
+pub fn main() {
+    let _a = Thing1 { baz: &[], bar: Box::new(32) };
+    let _b = Thing1 { baz: &Vec::new(), bar: Box::new(32) };
+    let _c = Thing2 { baz: &[], bar: 32 };
+    let _d = Thing2 { baz: &Vec::new(), bar: 32 };
+}
diff --git a/tests/ui/coercion/struct-literal-field-type-coercion-to-expected-type.rs b/tests/ui/coercion/struct-literal-field-type-coercion-to-expected-type.rs
new file mode 100644
index 00000000000..0b8ec7dc07a
--- /dev/null
+++ b/tests/ui/coercion/struct-literal-field-type-coercion-to-expected-type.rs
@@ -0,0 +1,16 @@
+//! Regression test to check that literal expressions in a struct field can be coerced to the
+//! expected field type, including block expressions.
+//!
+//! Issue: <https://github.com/rust-lang/rust/issues/31260>
+
+//@ check-pass
+
+pub struct Struct<K: 'static> {
+    pub field: K,
+}
+
+static STRUCT: Struct<&'static [u8]> = Struct { field: { &[1] } };
+
+static STRUCT2: Struct<&'static [u8]> = Struct { field: &[1] };
+
+fn main() {}
diff --git a/tests/ui/coherence/coherence-with-closure.rs b/tests/ui/coherence/coherence-with-closure.rs
index 5b6a62b24d4..ac2c5584392 100644
--- a/tests/ui/coherence/coherence-with-closure.rs
+++ b/tests/ui/coherence/coherence-with-closure.rs
@@ -1,6 +1,7 @@
 // Test that encountering closures during coherence does not cause issues.
 #![feature(type_alias_impl_trait)]
 type OpaqueClosure = impl Sized;
+#[define_opaque(OpaqueClosure)]
 fn defining_use() -> OpaqueClosure {
     || ()
 }
diff --git a/tests/ui/coherence/coherence-with-closure.stderr b/tests/ui/coherence/coherence-with-closure.stderr
index 501279ffe6a..37f393ceeb7 100644
--- a/tests/ui/coherence/coherence-with-closure.stderr
+++ b/tests/ui/coherence/coherence-with-closure.stderr
@@ -1,5 +1,5 @@
 error[E0119]: conflicting implementations of trait `Trait` for type `Wrapper<OpaqueClosure>`
-  --> $DIR/coherence-with-closure.rs:11:1
+  --> $DIR/coherence-with-closure.rs:12:1
    |
 LL | impl Trait for Wrapper<OpaqueClosure> {}
    | ------------------------------------- first implementation here
diff --git a/tests/ui/coherence/coherence-with-coroutine.rs b/tests/ui/coherence/coherence-with-coroutine.rs
index 6b0617e950b..0e65a6c1da0 100644
--- a/tests/ui/coherence/coherence-with-coroutine.rs
+++ b/tests/ui/coherence/coherence-with-coroutine.rs
@@ -7,6 +7,7 @@
 //@ [specialized]check-pass
 
 type OpaqueCoroutine = impl Sized;
+#[define_opaque(OpaqueCoroutine)]
 fn defining_use() -> OpaqueCoroutine {
     #[coroutine]
     || {
diff --git a/tests/ui/coherence/coherence-with-coroutine.stock.stderr b/tests/ui/coherence/coherence-with-coroutine.stock.stderr
index 5f58b3088f1..c7af384df6d 100644
--- a/tests/ui/coherence/coherence-with-coroutine.stock.stderr
+++ b/tests/ui/coherence/coherence-with-coroutine.stock.stderr
@@ -1,5 +1,5 @@
 error[E0119]: conflicting implementations of trait `Trait` for type `Wrapper<OpaqueCoroutine>`
-  --> $DIR/coherence-with-coroutine.rs:22:1
+  --> $DIR/coherence-with-coroutine.rs:23:1
    |
 LL | impl Trait for Wrapper<OpaqueCoroutine> {}
    | --------------------------------------- first implementation here
diff --git a/tests/ui/coherence/const-errs-dont-conflict-103369.stderr b/tests/ui/coherence/const-errs-dont-conflict-103369.stderr
index 4acaaf22ae8..b2104299f65 100644
--- a/tests/ui/coherence/const-errs-dont-conflict-103369.stderr
+++ b/tests/ui/coherence/const-errs-dont-conflict-103369.stderr
@@ -9,7 +9,6 @@ note: inside `my_fn`
    |
 LL |     panic!("Some error occurred");
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the failure occurred here
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const-errs-dont-conflict-103369.rs:7:25
@@ -22,7 +21,6 @@ note: inside `my_fn`
    |
 LL |     panic!("Some error occurred");
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the failure occurred here
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/coherence/issue-99663-2.rs b/tests/ui/coherence/issue-99663-2.rs
index 675e9fdfdba..9827df1d5e7 100644
--- a/tests/ui/coherence/issue-99663-2.rs
+++ b/tests/ui/coherence/issue-99663-2.rs
@@ -8,6 +8,7 @@ struct Outer<T: ?Sized> {
 
 type InnerSend<T: ?Sized> = impl Send;
 
+#[define_opaque(InnerSend)]
 fn constrain<T: ?Sized>() -> InnerSend<T> {
     ()
 }
diff --git a/tests/ui/coherence/issue-99663.rs b/tests/ui/coherence/issue-99663.rs
index 00d15977d8f..49156952990 100644
--- a/tests/ui/coherence/issue-99663.rs
+++ b/tests/ui/coherence/issue-99663.rs
@@ -8,6 +8,7 @@ struct Send<T> {
 
 type InnerSend<T> = impl Sized;
 
+#[define_opaque(InnerSend)]
 fn constrain<T>() -> InnerSend<T> {
     ()
 }
diff --git a/tests/ui/coherence/occurs-check/opaques.current.stderr b/tests/ui/coherence/occurs-check/opaques.current.stderr
index f3fc22027c2..d3850df5218 100644
--- a/tests/ui/coherence/occurs-check/opaques.current.stderr
+++ b/tests/ui/coherence/occurs-check/opaques.current.stderr
@@ -1,11 +1,11 @@
 error[E0119]: conflicting implementations of trait `Trait<_>`
-  --> $DIR/opaques.rs:28:1
+  --> $DIR/opaques.rs:27:1
    |
 LL | impl<T> Trait<T> for T {
    | ---------------------- first implementation here
 ...
-LL | impl<T> Trait<T> for defining_scope::Alias<T> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
+LL | impl<T> Trait<T> for Alias<T> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/coherence/occurs-check/opaques.next.stderr b/tests/ui/coherence/occurs-check/opaques.next.stderr
index 04fd139f901..508e6f40234 100644
--- a/tests/ui/coherence/occurs-check/opaques.next.stderr
+++ b/tests/ui/coherence/occurs-check/opaques.next.stderr
@@ -1,17 +1,17 @@
 error[E0119]: conflicting implementations of trait `Trait<_>`
-  --> $DIR/opaques.rs:28:1
+  --> $DIR/opaques.rs:27:1
    |
 LL | impl<T> Trait<T> for T {
    | ---------------------- first implementation here
 ...
-LL | impl<T> Trait<T> for defining_scope::Alias<T> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
+LL | impl<T> Trait<T> for Alias<T> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
 
 error[E0282]: type annotations needed
-  --> $DIR/opaques.rs:11:23
+  --> $DIR/opaques.rs:11:19
    |
-LL |     pub fn cast<T>(x: Container<Alias<T>, T>) -> Container<T, T> {
-   |                       ^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
+LL | pub fn cast<T>(x: Container<Alias<T>, T>) -> Container<T, T> {
+   |                   ^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/coherence/occurs-check/opaques.rs b/tests/ui/coherence/occurs-check/opaques.rs
index e197256c78c..5ea654189a9 100644
--- a/tests/ui/coherence/occurs-check/opaques.rs
+++ b/tests/ui/coherence/occurs-check/opaques.rs
@@ -4,14 +4,13 @@
 
 // A regression test for #105787
 #![feature(type_alias_impl_trait)]
-mod defining_scope {
-    use super::*;
-    pub type Alias<T> = impl Sized;
 
-    pub fn cast<T>(x: Container<Alias<T>, T>) -> Container<T, T> {
-        //[next]~^ ERROR type annotations needed
-        x
-    }
+pub type Alias<T> = impl Sized;
+
+#[define_opaque(Alias)]
+pub fn cast<T>(x: Container<Alias<T>, T>) -> Container<T, T> {
+    //[next]~^ ERROR type annotations needed
+    x
 }
 
 struct Container<T: Trait<U>, U> {
@@ -25,12 +24,12 @@ trait Trait<T> {
 impl<T> Trait<T> for T {
     type Assoc = Box<u32>;
 }
-impl<T> Trait<T> for defining_scope::Alias<T> {
+impl<T> Trait<T> for Alias<T> {
     //~^ ERROR conflicting implementations of trait
     type Assoc = usize;
 }
 
 fn main() {
-    let x: Box<u32> = defining_scope::cast::<()>(Container { x: 0 }).x;
+    let x: Box<u32> = cast::<()>(Container { x: 0 }).x;
     println!("{}", *x);
 }
diff --git a/tests/ui/coherence/orphan-check-error-reporting-ty-var.rs b/tests/ui/coherence/orphan-check-error-reporting-ty-var.rs
new file mode 100644
index 00000000000..99a83453354
--- /dev/null
+++ b/tests/ui/coherence/orphan-check-error-reporting-ty-var.rs
@@ -0,0 +1,17 @@
+// Regression test for #132826.
+
+// Make sure we don't try to resolve the variable `K1` in the generics of the impl
+// (which only has `K2`).
+
+pub trait MyTrait {
+    type Item;
+}
+
+impl<K1> MyTrait for Vec<K1> {
+    type Item = Vec<K1>;
+}
+
+impl<K2> From<Vec<K2>> for <Vec<K2> as MyTrait>::Item {}
+//~^ ERROR only traits defined in the current crate can be implemented for arbitrary types
+
+fn main() {}
diff --git a/tests/ui/coherence/orphan-check-error-reporting-ty-var.stderr b/tests/ui/coherence/orphan-check-error-reporting-ty-var.stderr
new file mode 100644
index 00000000000..f229f8b2e38
--- /dev/null
+++ b/tests/ui/coherence/orphan-check-error-reporting-ty-var.stderr
@@ -0,0 +1,16 @@
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+  --> $DIR/orphan-check-error-reporting-ty-var.rs:14:1
+   |
+LL | impl<K2> From<Vec<K2>> for <Vec<K2> as MyTrait>::Item {}
+   | ^^^^^^^^^-------------^^^^^--------------------------
+   |          |                 |
+   |          |                 `Vec` is not defined in the current crate
+   |          `Vec` is not defined in the current crate
+   |
+   = note: impl doesn't have any local type before any uncovered type parameters
+   = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
+   = note: define and implement a trait or new type instead
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0117`.
diff --git a/tests/ui/coherence/orphan-check-opaque-types-not-covering.rs b/tests/ui/coherence/orphan-check-opaque-types-not-covering.rs
index 02e9eb65570..ea91933e694 100644
--- a/tests/ui/coherence/orphan-check-opaque-types-not-covering.rs
+++ b/tests/ui/coherence/orphan-check-opaque-types-not-covering.rs
@@ -7,6 +7,7 @@
 
 type Identity<T> = impl Sized;
 
+#[define_opaque(Identity)]
 fn define_identity<T>(x: T) -> Identity<T> {
     x
 }
@@ -16,6 +17,7 @@ impl<T> foreign::Trait0<Local, T, ()> for Identity<T> {}
 
 type Opaque<T> = impl Sized;
 
+#[define_opaque(Opaque)]
 fn define_local<T>() -> Opaque<T> {
     Local
 }
diff --git a/tests/ui/coherence/orphan-check-opaque-types-not-covering.stderr b/tests/ui/coherence/orphan-check-opaque-types-not-covering.stderr
index 57f5bbd2278..6203742b47c 100644
--- a/tests/ui/coherence/orphan-check-opaque-types-not-covering.stderr
+++ b/tests/ui/coherence/orphan-check-opaque-types-not-covering.stderr
@@ -1,5 +1,5 @@
 error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`)
-  --> $DIR/orphan-check-opaque-types-not-covering.rs:14:6
+  --> $DIR/orphan-check-opaque-types-not-covering.rs:15:6
    |
 LL | impl<T> foreign::Trait0<Local, T, ()> for Identity<T> {}
    |      ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`)
@@ -8,7 +8,7 @@ LL | impl<T> foreign::Trait0<Local, T, ()> for Identity<T> {}
    = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last
 
 error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`)
-  --> $DIR/orphan-check-opaque-types-not-covering.rs:23:6
+  --> $DIR/orphan-check-opaque-types-not-covering.rs:25:6
    |
 LL | impl<T> foreign::Trait1<Local, T> for Opaque<T> {}
    |      ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`)
diff --git a/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr b/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr
index af4dbfcad0e..a9a99fb28d8 100644
--- a/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr
+++ b/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr
@@ -9,8 +9,6 @@ LL | | where
 LL | |     T: Borrow<Q>,
 LL | |     Q: ?Sized + PartialOrd,
    | |___________________________- first implementation here
-   |
-   = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.rs b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.rs
index 9a041557c7c..416145a0c15 100644
--- a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.rs
+++ b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.rs
@@ -29,7 +29,6 @@ macro_rules! generate_s10 {
     ($expr: expr) => {
         #[cfg(feature = $expr)]
         //~^ ERROR expected unsuffixed literal, found expression `concat!("nonexistent")`
-        //~| ERROR expected unsuffixed literal, found expression `concat!("nonexistent")`
         struct S10;
     }
 }
diff --git a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr
index 21a3712d939..d02d0d70a8b 100644
--- a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr
+++ b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr
@@ -65,19 +65,7 @@ LL | generate_s10!(concat!("nonexistent"));
    |
    = note: this error originates in the macro `generate_s10` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: expected unsuffixed literal, found expression `concat!("nonexistent")`
-  --> $DIR/cfg-attr-syntax-validation.rs:30:25
-   |
-LL |         #[cfg(feature = $expr)]
-   |                         ^^^^^
-...
-LL | generate_s10!(concat!("nonexistent"));
-   | ------------------------------------- in this macro invocation
-   |
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-   = note: this error originates in the macro `generate_s10` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: aborting due to 11 previous errors
+error: aborting due to 10 previous errors
 
 Some errors have detailed explanations: E0537, E0565.
 For more information about an error, try `rustc --explain E0537`.
diff --git a/tests/ui/conditional-compilation/invalid-node-range-issue-129166.rs b/tests/ui/conditional-compilation/invalid-node-range-issue-129166.rs
index 794e6fad3fc..7c42be3ed4d 100644
--- a/tests/ui/conditional-compilation/invalid-node-range-issue-129166.rs
+++ b/tests/ui/conditional-compilation/invalid-node-range-issue-129166.rs
@@ -1,11 +1,12 @@
 // This was triggering an assertion failure in `NodeRange::new`.
 
+//@ check-pass
+
 #![feature(cfg_eval)]
 #![feature(stmt_expr_attributes)]
 
 fn f() -> u32 {
     #[cfg_eval] #[cfg(not(FALSE))] 0
-    //~^ ERROR removing an expression is not supported in this position
 }
 
 fn main() {}
diff --git a/tests/ui/conditional-compilation/invalid-node-range-issue-129166.stderr b/tests/ui/conditional-compilation/invalid-node-range-issue-129166.stderr
deleted file mode 100644
index 0699e182bd5..00000000000
--- a/tests/ui/conditional-compilation/invalid-node-range-issue-129166.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: removing an expression is not supported in this position
-  --> $DIR/invalid-node-range-issue-129166.rs:7:17
-   |
-LL |     #[cfg_eval] #[cfg(not(FALSE))] 0
-   |                 ^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 1 previous error
-
diff --git a/tests/ui/const-generics/adt_const_params/check-type-in-mir.rs b/tests/ui/const-generics/adt_const_params/check-type-in-mir.rs
new file mode 100644
index 00000000000..bec485b001c
--- /dev/null
+++ b/tests/ui/const-generics/adt_const_params/check-type-in-mir.rs
@@ -0,0 +1,16 @@
+// Ensure that we actually treat `N`'s type as `Invariant<'static>` in MIR typeck.
+
+#![feature(adt_const_params)]
+
+use std::marker::ConstParamTy;
+use std::ops::Deref;
+
+#[derive(ConstParamTy, PartialEq, Eq)]
+struct Invariant<'a>(<&'a () as Deref>::Target);
+
+fn test<'a, const N: Invariant<'static>>() {
+    let x: Invariant<'a> = N;
+    //~^ ERROR lifetime may not live long enough
+}
+
+fn main() {}
diff --git a/tests/ui/const-generics/adt_const_params/check-type-in-mir.stderr b/tests/ui/const-generics/adt_const_params/check-type-in-mir.stderr
new file mode 100644
index 00000000000..7e265f33f35
--- /dev/null
+++ b/tests/ui/const-generics/adt_const_params/check-type-in-mir.stderr
@@ -0,0 +1,14 @@
+error: lifetime may not live long enough
+  --> $DIR/check-type-in-mir.rs:12:28
+   |
+LL | fn test<'a, const N: Invariant<'static>>() {
+   |         -- lifetime `'a` defined here
+LL |     let x: Invariant<'a> = N;
+   |                            ^ 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`
+   = 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/const-generics/adt_const_params/const_param_ty_impl_bad_field.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_bad_field.stderr
index 808a569fcad..a4e5736d834 100644
--- a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_bad_field.stderr
+++ b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_bad_field.stderr
@@ -15,8 +15,6 @@ LL | #[derive(std::marker::UnsizedConstParamTy, Eq, PartialEq)]
 LL |
 LL | struct CantParamDerive(NotParam);
    |                        -------- this field does not implement `ConstParamTy_`
-   |
-   = note: this error originates in the derive macro `std::marker::UnsizedConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr
index 80d9942c591..b651cca3216 100644
--- a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr
+++ b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr
@@ -29,7 +29,6 @@ LL | #[derive(std::marker::UnsizedConstParamTy)]
    |
 note: required by a bound in `UnsizedConstParamTy`
   --> $SRC_DIR/core/src/marker.rs:LL:COL
-   = note: this error originates in the derive macro `std::marker::UnsizedConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `CantParamDerive` with `#[derive(Eq)]`
    |
 LL + #[derive(Eq)]
@@ -44,7 +43,6 @@ LL | #[derive(std::marker::UnsizedConstParamTy)]
    |
 note: required by a bound in `UnsizedConstParamTy`
   --> $SRC_DIR/core/src/marker.rs:LL:COL
-   = note: this error originates in the derive macro `std::marker::UnsizedConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/const-generics/adt_const_params/nested_bad_const_param_ty.stderr b/tests/ui/const-generics/adt_const_params/nested_bad_const_param_ty.stderr
index c2520f1d103..6b8d2394a86 100644
--- a/tests/ui/const-generics/adt_const_params/nested_bad_const_param_ty.stderr
+++ b/tests/ui/const-generics/adt_const_params/nested_bad_const_param_ty.stderr
@@ -12,7 +12,6 @@ note: the `ConstParamTy_` impl for `[*const u8; 1]` requires that `*const u8: Co
    |
 LL | struct Foo([*const u8; 1]);
    |            ^^^^^^^^^^^^^^
-   = note: this error originates in the derive macro `ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type
   --> $DIR/nested_bad_const_param_ty.rs:11:10
@@ -28,7 +27,6 @@ note: the `ConstParamTy_` impl for `[*mut u8; 1]` requires that `*mut u8: ConstP
    |
 LL | struct Foo2([*mut u8; 1]);
    |             ^^^^^^^^^^^^
-   = note: this error originates in the derive macro `ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type
   --> $DIR/nested_bad_const_param_ty.rs:16:10
@@ -44,7 +42,6 @@ note: the `ConstParamTy_` impl for `[fn(); 1]` requires that `fn(): ConstParamTy
    |
 LL | struct Foo3([fn(); 1]);
    |             ^^^^^^^^^
-   = note: this error originates in the derive macro `ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type
   --> $DIR/nested_bad_const_param_ty.rs:6:10
@@ -60,7 +57,6 @@ note: the `ConstParamTy_` impl for `[*const u8; 1]` requires that `*const u8: Un
    |
 LL | struct Foo([*const u8; 1]);
    |            ^^^^^^^^^^^^^^
-   = note: this error originates in the derive macro `ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type
   --> $DIR/nested_bad_const_param_ty.rs:11:10
@@ -76,7 +72,6 @@ note: the `ConstParamTy_` impl for `[*mut u8; 1]` requires that `*mut u8: Unsize
    |
 LL | struct Foo2([*mut u8; 1]);
    |             ^^^^^^^^^^^^
-   = note: this error originates in the derive macro `ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type
   --> $DIR/nested_bad_const_param_ty.rs:16:10
@@ -92,7 +87,6 @@ note: the `ConstParamTy_` impl for `[fn(); 1]` requires that `fn(): UnsizedConst
    |
 LL | struct Foo3([fn(); 1]);
    |             ^^^^^^^^^
-   = note: this error originates in the derive macro `ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 6 previous errors
 
diff --git a/tests/ui/const-generics/adt_const_params/unsized_field-1.stderr b/tests/ui/const-generics/adt_const_params/unsized_field-1.stderr
index 7a4f9b99c63..3089b30bd76 100644
--- a/tests/ui/const-generics/adt_const_params/unsized_field-1.stderr
+++ b/tests/ui/const-generics/adt_const_params/unsized_field-1.stderr
@@ -6,8 +6,6 @@ LL | #[derive(ConstParamTy, Eq, PartialEq)]
 LL |
 LL | struct A([u8]);
    |          ---- this field does not implement `ConstParamTy_`
-   |
-   = note: this error originates in the derive macro `ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type
   --> $DIR/unsized_field-1.rs:12:10
@@ -17,8 +15,6 @@ LL | #[derive(ConstParamTy, Eq, PartialEq)]
 LL |
 LL | struct B(&'static [u8]);
    |          ------------- this field does not implement `ConstParamTy_`
-   |
-   = note: this error originates in the derive macro `ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type
   --> $DIR/unsized_field-1.rs:16:10
@@ -28,8 +24,6 @@ LL | #[derive(ConstParamTy, Eq, PartialEq)]
 LL |
 LL | struct C(unsized_const_param::Foo);
    |          ------------------------ this field does not implement `ConstParamTy_`
-   |
-   = note: this error originates in the derive macro `ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/const-generics/adt_const_params/unsized_field-2.stderr b/tests/ui/const-generics/adt_const_params/unsized_field-2.stderr
index 15acece538f..cef70ca0463 100644
--- a/tests/ui/const-generics/adt_const_params/unsized_field-2.stderr
+++ b/tests/ui/const-generics/adt_const_params/unsized_field-2.stderr
@@ -21,7 +21,6 @@ note: the `ConstParamTy_` impl for `GenericNotUnsizedParam<&'static [u8]>` requi
    |
 LL | struct A(unsized_const_param::GenericNotUnsizedParam<&'static [u8]>);
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   = note: this error originates in the derive macro `std::marker::ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error; 1 warning emitted
 
diff --git a/tests/ui/const-generics/adt_const_params/unsizing-wfcheck-issue-126272.stderr b/tests/ui/const-generics/adt_const_params/unsizing-wfcheck-issue-126272.stderr
index 72f3fd9de90..992a27c1c0e 100644
--- a/tests/ui/const-generics/adt_const_params/unsizing-wfcheck-issue-126272.stderr
+++ b/tests/ui/const-generics/adt_const_params/unsizing-wfcheck-issue-126272.stderr
@@ -26,8 +26,6 @@ LL | #[derive(Debug, PartialEq, Eq, ConstParamTy)]
 ...
 LL |     nested: &'static Bar<dyn std::fmt::Debug>,
    |     ----------------------------------------- this field does not implement `ConstParamTy_`
-   |
-   = note: this error originates in the derive macro `ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type
   --> $DIR/unsizing-wfcheck-issue-126272.rs:8:32
@@ -53,7 +51,6 @@ note: the `ConstParamTy_` impl for `&'static Bar<(dyn Debug + 'static)>` require
    |
 LL |     nested: &'static Bar<dyn std::fmt::Debug>,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   = note: this error originates in the derive macro `ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time
   --> $DIR/unsizing-wfcheck-issue-126272.rs:12:5
@@ -76,7 +73,6 @@ LL | struct Bar<T>(T);
    = note: 2 redundant requirements hidden
    = note: required for `&&'static Bar<(dyn Debug + 'static)>` to implement `Debug`
    = note: required for the cast from `&&&'static Bar<(dyn Debug + 'static)>` to `&dyn Debug`
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0369]: binary operation `==` cannot be applied to type `&Bar<dyn Debug>`
   --> $DIR/unsizing-wfcheck-issue-126272.rs:12:5
@@ -86,8 +82,6 @@ LL | #[derive(Debug, PartialEq, Eq, ConstParamTy)]
 ...
 LL |     nested: &'static Bar<dyn std::fmt::Debug>,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `dyn Debug: Eq` is not satisfied
   --> $DIR/unsizing-wfcheck-issue-126272.rs:12:5
@@ -108,7 +102,6 @@ LL | #[derive(Debug, PartialEq, Eq, ConstParamTy)]
    = note: required for `&'static Bar<dyn Debug>` to implement `Eq`
 note: required by a bound in `AssertParamIsEq`
   --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the size for values of type `dyn Debug` cannot be known at compilation time
   --> $DIR/unsizing-wfcheck-issue-126272.rs:12:5
@@ -132,7 +125,6 @@ LL | struct Bar<T>(T);
    |            ^  - ...if indirection were used here: `Box<T>`
    |            |
    |            this could be changed to `T: ?Sized`...
-   = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time
   --> $DIR/unsizing-wfcheck-issue-126272.rs:26:33
diff --git a/tests/ui/const-generics/const-param-type-depends-on-const-param.rs b/tests/ui/const-generics/const-param-type-depends-on-const-param.rs
index ee0e1326baa..3372ea5b853 100644
--- a/tests/ui/const-generics/const-param-type-depends-on-const-param.rs
+++ b/tests/ui/const-generics/const-param-type-depends-on-const-param.rs
@@ -9,11 +9,11 @@
 // We may want to lift this restriction in the future.
 
 pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]);
-//~^ ERROR: the type of const parameters must not depend on other generic parameters
-//[min]~^^ ERROR `[u8; N]` is forbidden
+//~^ ERROR the type of const parameters must not depend on other generic parameters
+//[min]~^^ ERROR `[u8; N]` is forbidden as the type of a const generic parameter
 
 pub struct SelfDependent<const N: [u8; N]>;
-//~^ ERROR: the type of const parameters must not depend on other generic parameters
-//[min]~^^ ERROR `[u8; N]` is forbidden
+//~^ ERROR the type of const parameters must not depend on other generic parameters
+//[min]~^^ ERROR `[u8; N]` is forbidden as the type of a const generic parameter
 
 fn main() {}
diff --git a/tests/ui/const-generics/const-param-type-depends-on-parent-param.rs b/tests/ui/const-generics/const-param-type-depends-on-parent-param.rs
new file mode 100644
index 00000000000..83fe8c139f9
--- /dev/null
+++ b/tests/ui/const-generics/const-param-type-depends-on-parent-param.rs
@@ -0,0 +1,8 @@
+#![feature(adt_const_params)]
+
+trait Trait<const N: usize> {
+    fn foo<const M: [u8; N]>() {}
+    //~^ ERROR the type of const parameters must not depend on other generic parameters
+}
+
+fn main() {}
diff --git a/tests/ui/const-generics/const-param-type-depends-on-parent-param.stderr b/tests/ui/const-generics/const-param-type-depends-on-parent-param.stderr
new file mode 100644
index 00000000000..ed0a4b118d4
--- /dev/null
+++ b/tests/ui/const-generics/const-param-type-depends-on-parent-param.stderr
@@ -0,0 +1,9 @@
+error[E0770]: the type of const parameters must not depend on other generic parameters
+  --> $DIR/const-param-type-depends-on-parent-param.rs:4:26
+   |
+LL |     fn foo<const M: [u8; N]>() {}
+   |                          ^ the type must not depend on the parameter `N`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0770`.
diff --git a/tests/ui/const-generics/defaults/default-const-param-cannot-reference-self.stderr b/tests/ui/const-generics/defaults/default-const-param-cannot-reference-self.stderr
index 72d7001fdf1..c074e2e897e 100644
--- a/tests/ui/const-generics/defaults/default-const-param-cannot-reference-self.stderr
+++ b/tests/ui/const-generics/defaults/default-const-param-cannot-reference-self.stderr
@@ -2,19 +2,19 @@ error[E0735]: generic parameters cannot use `Self` in their defaults
   --> $DIR/default-const-param-cannot-reference-self.rs:1:34
    |
 LL | struct Struct<const N: usize = { Self; 10 }>;
-   |                                  ^^^^ `Self` in generic parameter default
+   |                                  ^^^^
 
 error[E0735]: generic parameters cannot use `Self` in their defaults
   --> $DIR/default-const-param-cannot-reference-self.rs:4:30
    |
 LL | enum Enum<const N: usize = { Self; 10 }> { }
-   |                              ^^^^ `Self` in generic parameter default
+   |                              ^^^^
 
 error[E0735]: generic parameters cannot use `Self` in their defaults
   --> $DIR/default-const-param-cannot-reference-self.rs:7:32
    |
 LL | union Union<const N: usize = { Self; 10 }> { not_empty: () }
-   |                                ^^^^ `Self` in generic parameter default
+   |                                ^^^^
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/const-generics/defaults/forward-declared.rs b/tests/ui/const-generics/defaults/forward-declared.rs
index ede3d873bdc..bd3abd4dcaa 100644
--- a/tests/ui/const-generics/defaults/forward-declared.rs
+++ b/tests/ui/const-generics/defaults/forward-declared.rs
@@ -1,13 +1,13 @@
 struct Foo<const N: usize = M, const M: usize = 10>;
-//~^ ERROR generic parameters with a default cannot use forward declared identifiers
+//~^ ERROR generic parameter defaults cannot reference parameters before they are declared
 
 enum Bar<const N: usize = M, const M: usize = 10> {}
-//~^ ERROR generic parameters with a default cannot use forward declared identifiers
+//~^ ERROR generic parameter defaults cannot reference parameters before they are declared
 
 struct Foo2<const N: usize = N>;
-//~^ ERROR generic parameters with a default cannot use forward declared identifiers
+//~^ ERROR generic parameter defaults cannot reference parameters before they are declared
 
 enum Bar2<const N: usize = N> {}
-//~^ ERROR generic parameters with a default cannot use forward declared identifiers
+//~^ ERROR generic parameter defaults cannot reference parameters before they are declared
 
 fn main() {}
diff --git a/tests/ui/const-generics/defaults/forward-declared.stderr b/tests/ui/const-generics/defaults/forward-declared.stderr
index 4856c7a1fd2..4331996bffc 100644
--- a/tests/ui/const-generics/defaults/forward-declared.stderr
+++ b/tests/ui/const-generics/defaults/forward-declared.stderr
@@ -1,26 +1,26 @@
-error[E0128]: generic parameters with a default cannot use forward declared identifiers
+error[E0128]: generic parameter defaults cannot reference parameters before they are declared
   --> $DIR/forward-declared.rs:1:29
    |
 LL | struct Foo<const N: usize = M, const M: usize = 10>;
-   |                             ^ defaulted generic parameters cannot be forward declared
+   |                             ^ cannot reference `M` before it is declared
 
-error[E0128]: generic parameters with a default cannot use forward declared identifiers
+error[E0128]: generic parameter defaults cannot reference parameters before they are declared
   --> $DIR/forward-declared.rs:4:27
    |
 LL | enum Bar<const N: usize = M, const M: usize = 10> {}
-   |                           ^ defaulted generic parameters cannot be forward declared
+   |                           ^ cannot reference `M` before it is declared
 
-error[E0128]: generic parameters with a default cannot use forward declared identifiers
+error[E0128]: generic parameter defaults cannot reference parameters before they are declared
   --> $DIR/forward-declared.rs:7:30
    |
 LL | struct Foo2<const N: usize = N>;
-   |                              ^ defaulted generic parameters cannot be forward declared
+   |                              ^ cannot reference `N` before it is declared
 
-error[E0128]: generic parameters with a default cannot use forward declared identifiers
+error[E0128]: generic parameter defaults cannot reference parameters before they are declared
   --> $DIR/forward-declared.rs:10:28
    |
 LL | enum Bar2<const N: usize = N> {}
-   |                            ^ defaulted generic parameters cannot be forward declared
+   |                            ^ cannot reference `N` before it is declared
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/const-generics/generic_const_exprs/opaque_type.rs b/tests/ui/const-generics/generic_const_exprs/opaque_type.rs
index 56b8acbf88c..446112cc617 100644
--- a/tests/ui/const-generics/generic_const_exprs/opaque_type.rs
+++ b/tests/ui/const-generics/generic_const_exprs/opaque_type.rs
@@ -3,14 +3,14 @@
 
 type Foo = impl Sized;
 
-fn with_bound<const N: usize>() -> Foo
+#[define_opaque(Foo)]
+fn with_bound<const N: usize>()
 where
     [u8; (N / 2) as usize]: Sized,
 {
     let _: [u8; (N / 2) as Foo] = [0; (N / 2) as usize];
     //~^ ERROR mismatched types
     //~| ERROR non-primitive cast: `usize` as `Foo`
-    todo!()
 }
 
 fn main() {
diff --git a/tests/ui/const-generics/generic_const_exprs/opaque_type.stderr b/tests/ui/const-generics/generic_const_exprs/opaque_type.stderr
index e9fb8c0f403..9f48a8563c8 100644
--- a/tests/ui/const-generics/generic_const_exprs/opaque_type.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/opaque_type.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/opaque_type.rs:10:17
+  --> $DIR/opaque_type.rs:11:17
    |
 LL | type Foo = impl Sized;
    |            ---------- the found opaque type
@@ -11,7 +11,7 @@ LL |     let _: [u8; (N / 2) as Foo] = [0; (N / 2) as usize];
            found opaque type `Foo`
 
 error[E0605]: non-primitive cast: `usize` as `Foo`
-  --> $DIR/opaque_type.rs:10:17
+  --> $DIR/opaque_type.rs:11:17
    |
 LL |     let _: [u8; (N / 2) as Foo] = [0; (N / 2) as usize];
    |                 ^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
diff --git a/tests/ui/const-generics/generic_const_parameter_types/bad-param-in-pat.rs b/tests/ui/const-generics/generic_const_parameter_types/bad-param-in-pat.rs
new file mode 100644
index 00000000000..bc54aad59ba
--- /dev/null
+++ b/tests/ui/const-generics/generic_const_parameter_types/bad-param-in-pat.rs
@@ -0,0 +1,10 @@
+struct Foo<'a>(&'a ());
+
+// We need a lifetime in scope or else we do not write a user type annotation as a fast-path.
+impl<'a> Foo<'a> {
+    fn bar<const V: u8>() {
+        let V;
+        //~^ ERROR constant parameters cannot be referenced in patterns
+    }
+}
+fn main() {}
diff --git a/tests/ui/const-generics/generic_const_parameter_types/bad-param-in-pat.stderr b/tests/ui/const-generics/generic_const_parameter_types/bad-param-in-pat.stderr
new file mode 100644
index 00000000000..299ff4165e0
--- /dev/null
+++ b/tests/ui/const-generics/generic_const_parameter_types/bad-param-in-pat.stderr
@@ -0,0 +1,11 @@
+error[E0158]: constant parameters cannot be referenced in patterns
+  --> $DIR/bad-param-in-pat.rs:6:13
+   |
+LL |     fn bar<const V: u8>() {
+   |            ----------- constant defined here
+LL |         let V;
+   |             ^ can't be used in patterns
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0158`.
diff --git a/tests/ui/const-generics/generic_const_parameter_types/check-type-in-mir.rs b/tests/ui/const-generics/generic_const_parameter_types/check-type-in-mir.rs
new file mode 100644
index 00000000000..d3bc544ed6c
--- /dev/null
+++ b/tests/ui/const-generics/generic_const_parameter_types/check-type-in-mir.rs
@@ -0,0 +1,12 @@
+// Ensure that we actually treat `N`'s type as `&'a u32` in MIR typeck.
+
+#![feature(unsized_const_params, adt_const_params, generic_const_parameter_types)]
+//~^ WARN the feature `unsized_const_params` is incomplete
+//~| WARN the feature `generic_const_parameter_types` is incomplete
+
+fn foo<'a, const N: &'a u32>() {
+    let b: &'static u32 = N;
+    //~^ ERROR lifetime may not live long enough
+}
+
+fn main() {}
diff --git a/tests/ui/const-generics/generic_const_parameter_types/check-type-in-mir.stderr b/tests/ui/const-generics/generic_const_parameter_types/check-type-in-mir.stderr
new file mode 100644
index 00000000000..3dc7ce438fa
--- /dev/null
+++ b/tests/ui/const-generics/generic_const_parameter_types/check-type-in-mir.stderr
@@ -0,0 +1,27 @@
+warning: the feature `unsized_const_params` is incomplete and may not be safe to use and/or cause compiler crashes
+  --> $DIR/check-type-in-mir.rs:3:12
+   |
+LL | #![feature(unsized_const_params, adt_const_params, generic_const_parameter_types)]
+   |            ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information
+   = note: `#[warn(incomplete_features)]` on by default
+
+warning: the feature `generic_const_parameter_types` is incomplete and may not be safe to use and/or cause compiler crashes
+  --> $DIR/check-type-in-mir.rs:3:52
+   |
+LL | #![feature(unsized_const_params, adt_const_params, generic_const_parameter_types)]
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #137626 <https://github.com/rust-lang/rust/issues/137626> for more information
+
+error: lifetime may not live long enough
+  --> $DIR/check-type-in-mir.rs:8:12
+   |
+LL | fn foo<'a, const N: &'a u32>() {
+   |        -- lifetime `'a` defined here
+LL |     let b: &'static u32 = N;
+   |            ^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
+
+error: aborting due to 1 previous error; 2 warnings emitted
+
diff --git a/tests/ui/const-generics/generic_const_parameter_types/forward_declared_type.rs b/tests/ui/const-generics/generic_const_parameter_types/forward_declared_type.rs
index 91c1c80e07c..2abf7f44e20 100644
--- a/tests/ui/const-generics/generic_const_parameter_types/forward_declared_type.rs
+++ b/tests/ui/const-generics/generic_const_parameter_types/forward_declared_type.rs
@@ -4,8 +4,8 @@
 use std::marker::PhantomData;
 
 struct UsesConst<const N: [u8; M], const M: usize>;
-//~^ ERROR: the type of const parameters must not depend on other generic parameters
+//~^ ERROR: const parameter types cannot reference parameters before they are declared
 struct UsesType<const N: [T; 2], T>(PhantomData<T>);
-//~^ ERROR: the type of const parameters must not depend on other generic parameters
+//~^ ERROR: const parameter types cannot reference parameters before they are declared
 
 fn main() {}
diff --git a/tests/ui/const-generics/generic_const_parameter_types/forward_declared_type.stderr b/tests/ui/const-generics/generic_const_parameter_types/forward_declared_type.stderr
index b0dbdff8413..5526668b0be 100644
--- a/tests/ui/const-generics/generic_const_parameter_types/forward_declared_type.stderr
+++ b/tests/ui/const-generics/generic_const_parameter_types/forward_declared_type.stderr
@@ -1,15 +1,14 @@
-error[E0770]: the type of const parameters must not depend on other generic parameters
+error: const parameter types cannot reference parameters before they are declared
   --> $DIR/forward_declared_type.rs:6:32
    |
 LL | struct UsesConst<const N: [u8; M], const M: usize>;
-   |                                ^ the type must not depend on the parameter `M`
+   |                                ^ const parameter type cannot reference `M` before it is declared
 
-error[E0770]: the type of const parameters must not depend on other generic parameters
+error: const parameter types cannot reference parameters before they are declared
   --> $DIR/forward_declared_type.rs:8:27
    |
 LL | struct UsesType<const N: [T; 2], T>(PhantomData<T>);
-   |                           ^ the type must not depend on the parameter `T`
+   |                           ^ const parameter type cannot reference `T` before it is declared
 
 error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0770`.
diff --git a/tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.feat.stderr b/tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.feat.stderr
new file mode 100644
index 00000000000..2d47797aef2
--- /dev/null
+++ b/tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.feat.stderr
@@ -0,0 +1,25 @@
+warning: the feature `generic_const_parameter_types` is incomplete and may not be safe to use and/or cause compiler crashes
+  --> $DIR/references-parent-generics.rs:3:27
+   |
+LL | #![cfg_attr(feat, feature(generic_const_parameter_types))]
+   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #137626 <https://github.com/rust-lang/rust/issues/137626> for more information
+   = note: `#[warn(incomplete_features)]` on by default
+
+error: `Self` is forbidden as the type of a const generic parameter
+  --> $DIR/references-parent-generics.rs:7:25
+   |
+LL |     type Assoc<const N: Self>;
+   |                         ^^^^
+   |
+   = note: the only supported types are integers, `bool`, and `char`
+
+error: anonymous constants referencing generics are not yet supported
+  --> $DIR/references-parent-generics.rs:15:21
+   |
+LL |     let x: T::Assoc<3>;
+   |                     ^
+
+error: aborting due to 2 previous errors; 1 warning emitted
+
diff --git a/tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.nofeat.stderr b/tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.nofeat.stderr
new file mode 100644
index 00000000000..68ce17317f6
--- /dev/null
+++ b/tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.nofeat.stderr
@@ -0,0 +1,9 @@
+error[E0770]: the type of const parameters must not depend on other generic parameters
+  --> $DIR/references-parent-generics.rs:7:25
+   |
+LL |     type Assoc<const N: Self>;
+   |                         ^^^^ the type must not depend on the parameter `Self`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0770`.
diff --git a/tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.rs b/tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.rs
new file mode 100644
index 00000000000..b91050d540c
--- /dev/null
+++ b/tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.rs
@@ -0,0 +1,19 @@
+//@ revisions: feat nofeat
+
+#![cfg_attr(feat, feature(generic_const_parameter_types))]
+//[feat]~^ WARN the feature `generic_const_parameter_types` is incomplete
+
+trait Foo {
+    type Assoc<const N: Self>;
+    //[nofeat]~^ ERROR the type of const parameters must not depend on other generic parameters
+    //[feat]~^^ ERROR `Self` is forbidden as the type of a const generic parameter
+}
+
+fn foo<T: Foo>() {
+    // We used to end up feeding the type of this anon const to be `T`, but the anon const
+    // doesn't inherit the generics of `foo`, which led to index oob errors.
+    let x: T::Assoc<3>;
+    //[feat]~^ ERROR anonymous constants referencing generics are not yet supported
+}
+
+fn main() {}
diff --git a/tests/ui/const-generics/opaque_types.rs b/tests/ui/const-generics/opaque_types.rs
index 2c7170c889f..788d7951999 100644
--- a/tests/ui/const-generics/opaque_types.rs
+++ b/tests/ui/const-generics/opaque_types.rs
@@ -1,9 +1,8 @@
 #![feature(type_alias_impl_trait)]
 
 type Foo = impl Sized;
-//~^ ERROR: cycle
-//~| ERROR: cycle
 
+#[define_opaque(Foo)]
 fn foo<const C: Foo>() {}
 //~^ ERROR: `Foo` is forbidden as the type of a const generic parameter
 //~| ERROR: item does not constrain
diff --git a/tests/ui/const-generics/opaque_types.stderr b/tests/ui/const-generics/opaque_types.stderr
index a060488b328..f67e1c8ce69 100644
--- a/tests/ui/const-generics/opaque_types.stderr
+++ b/tests/ui/const-generics/opaque_types.stderr
@@ -1,26 +1,26 @@
 error: `Foo` is forbidden as the type of a const generic parameter
-  --> $DIR/opaque_types.rs:7:17
+  --> $DIR/opaque_types.rs:6:17
    |
 LL | fn foo<const C: Foo>() {}
    |                 ^^^
    |
    = note: the only supported types are integers, `bool`, and `char`
 
-error: item does not constrain `Foo::{opaque#0}`, but has it in its signature
-  --> $DIR/opaque_types.rs:7:4
+error: item does not constrain `Foo::{opaque#0}`
+  --> $DIR/opaque_types.rs:6:4
    |
 LL | fn foo<const C: Foo>() {}
    |    ^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
   --> $DIR/opaque_types.rs:3:12
    |
 LL | type Foo = impl Sized;
    |            ^^^^^^^^^^
 
 error[E0308]: mismatched types
-  --> $DIR/opaque_types.rs:12:11
+  --> $DIR/opaque_types.rs:11:11
    |
 LL | type Foo = impl Sized;
    |            ---------- the expected opaque type
@@ -31,106 +31,6 @@ LL |     foo::<42>();
    = note: expected opaque type `Foo`
                      found type `{integer}`
 
-error[E0391]: cycle detected when computing type of `Foo::{opaque#0}`
-  --> $DIR/opaque_types.rs:3:12
-   |
-LL | type Foo = impl Sized;
-   |            ^^^^^^^^^^
-   |
-note: ...which requires computing type of opaque `Foo::{opaque#0}`...
-  --> $DIR/opaque_types.rs:3:12
-   |
-LL | type Foo = impl Sized;
-   |            ^^^^^^^^^^
-note: ...which requires type-checking `main`...
-  --> $DIR/opaque_types.rs:11:1
-   |
-LL | fn main() {
-   | ^^^^^^^^^
-note: ...which requires evaluating type-level constant...
-  --> $DIR/opaque_types.rs:12:11
-   |
-LL |     foo::<42>();
-   |           ^^
-note: ...which requires const-evaluating + checking `main::{constant#0}`...
-  --> $DIR/opaque_types.rs:12:11
-   |
-LL |     foo::<42>();
-   |           ^^
-note: ...which requires caching mir of `main::{constant#0}` for CTFE...
-  --> $DIR/opaque_types.rs:12:11
-   |
-LL |     foo::<42>();
-   |           ^^
-note: ...which requires elaborating drops for `main::{constant#0}`...
-  --> $DIR/opaque_types.rs:12:11
-   |
-LL |     foo::<42>();
-   |           ^^
-   = note: ...which requires normalizing `Foo`...
-   = note: ...which again requires computing type of `Foo::{opaque#0}`, completing the cycle
-note: cycle used when checking that `Foo::{opaque#0}` is well-formed
-  --> $DIR/opaque_types.rs:3:12
-   |
-LL | type Foo = impl Sized;
-   |            ^^^^^^^^^^
-   = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-
-error[E0391]: cycle detected when computing type of opaque `Foo::{opaque#0}`
-  --> $DIR/opaque_types.rs:3:12
-   |
-LL | type Foo = impl Sized;
-   |            ^^^^^^^^^^
-   |
-note: ...which requires type-checking `main`...
-  --> $DIR/opaque_types.rs:11:1
-   |
-LL | fn main() {
-   | ^^^^^^^^^
-note: ...which requires evaluating type-level constant...
-  --> $DIR/opaque_types.rs:12:11
-   |
-LL |     foo::<42>();
-   |           ^^
-note: ...which requires const-evaluating + checking `main::{constant#0}`...
-  --> $DIR/opaque_types.rs:12:11
-   |
-LL |     foo::<42>();
-   |           ^^
-note: ...which requires caching mir of `main::{constant#0}` for CTFE...
-  --> $DIR/opaque_types.rs:12:11
-   |
-LL |     foo::<42>();
-   |           ^^
-note: ...which requires elaborating drops for `main::{constant#0}`...
-  --> $DIR/opaque_types.rs:12:11
-   |
-LL |     foo::<42>();
-   |           ^^
-note: ...which requires borrow-checking `main::{constant#0}`...
-  --> $DIR/opaque_types.rs:12:11
-   |
-LL |     foo::<42>();
-   |           ^^
-note: ...which requires promoting constants in MIR for `main::{constant#0}`...
-  --> $DIR/opaque_types.rs:12:11
-   |
-LL |     foo::<42>();
-   |           ^^
-note: ...which requires const checking `main::{constant#0}`...
-  --> $DIR/opaque_types.rs:12:11
-   |
-LL |     foo::<42>();
-   |           ^^
-   = note: ...which again requires computing type of opaque `Foo::{opaque#0}`, completing the cycle
-note: cycle used when computing type of `Foo::{opaque#0}`
-  --> $DIR/opaque_types.rs:3:12
-   |
-LL | type Foo = impl Sized;
-   |            ^^^^^^^^^^
-   = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-
-error: aborting due to 5 previous errors
+error: aborting due to 3 previous errors
 
-Some errors have detailed explanations: E0308, E0391.
-For more information about an error, try `rustc --explain E0308`.
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/const-generics/opaque_types2.rs b/tests/ui/const-generics/opaque_types2.rs
index fd57438bb61..69f813cf84a 100644
--- a/tests/ui/const-generics/opaque_types2.rs
+++ b/tests/ui/const-generics/opaque_types2.rs
@@ -4,13 +4,14 @@ type Foo = impl Sized;
 
 fn foo<const C: u32>() {}
 
-const C: Foo = 42;
+#[define_opaque(Foo)]
+const fn baz() -> Foo {
+    42
+}
 
-fn bar()
-where
-    Foo:,
-{
-    foo::<C>();
+#[define_opaque(Foo)]
+fn bar() {
+    foo::<{ baz() }>();
     //~^ ERROR: mismatched types
 }
 
diff --git a/tests/ui/const-generics/opaque_types2.stderr b/tests/ui/const-generics/opaque_types2.stderr
index 2fb1669b7bf..98d96c3ccee 100644
--- a/tests/ui/const-generics/opaque_types2.stderr
+++ b/tests/ui/const-generics/opaque_types2.stderr
@@ -1,11 +1,11 @@
 error[E0308]: mismatched types
-  --> $DIR/opaque_types2.rs:13:11
+  --> $DIR/opaque_types2.rs:14:13
    |
 LL | type Foo = impl Sized;
    |            ---------- the found opaque type
 ...
-LL |     foo::<C>();
-   |           ^ expected `u32`, found opaque type
+LL |     foo::<{ baz() }>();
+   |             ^^^^^ expected `u32`, found opaque type
    |
    = note:     expected type `u32`
            found opaque type `Foo`
diff --git a/tests/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.full.stderr b/tests/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.full.stderr
index 9f0b2efae96..dc28dea6851 100644
--- a/tests/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.full.stderr
+++ b/tests/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.full.stderr
@@ -4,11 +4,11 @@ error: generic parameters with a default must be trailing
 LL | struct Bar<T = [u8; N], const N: usize>(T);
    |            ^
 
-error[E0128]: generic parameters with a default cannot use forward declared identifiers
+error[E0128]: generic parameter defaults cannot reference parameters before they are declared
   --> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:8:21
    |
 LL | struct Bar<T = [u8; N], const N: usize>(T);
-   |                     ^ defaulted generic parameters cannot be forward declared
+   |                     ^ cannot reference `N` before it is declared
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.min.stderr b/tests/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.min.stderr
index 320c9c1c84d..3f0e5e96fc8 100644
--- a/tests/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.min.stderr
+++ b/tests/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.min.stderr
@@ -13,11 +13,11 @@ LL | struct Foo<T, U = [u8; std::mem::size_of::<T>()]>(T, U);
    = note: type parameters may not be used in const expressions
    = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
 
-error[E0128]: generic parameters with a default cannot use forward declared identifiers
+error[E0128]: generic parameter defaults cannot reference parameters before they are declared
   --> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:8:21
    |
 LL | struct Bar<T = [u8; N], const N: usize>(T);
-   |                     ^ defaulted generic parameters cannot be forward declared
+   |                     ^ cannot reference `N` before it is declared
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs b/tests/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs
index 2794ff3eaa9..d212cc425a0 100644
--- a/tests/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs
+++ b/tests/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs
@@ -6,7 +6,7 @@ struct Foo<T, U = [u8; std::mem::size_of::<T>()]>(T, U);
 //[min]~^ ERROR generic parameters may not be used in const operations
 
 struct Bar<T = [u8; N], const N: usize>(T);
-//~^ ERROR generic parameters with a default cannot use forward declared identifiers
+//~^ ERROR generic parameter defaults cannot reference parameters before they are declared
 //~| ERROR generic parameters with a default
 
 fn main() {}
diff --git a/tests/ui/const-ptr/forbidden_slices.stderr b/tests/ui/const-ptr/forbidden_slices.stderr
index a4e9c972ceb..6f2da272ad3 100644
--- a/tests/ui/const-ptr/forbidden_slices.stderr
+++ b/tests/ui/const-ptr/forbidden_slices.stderr
@@ -109,7 +109,6 @@ note: inside `from_ptr_range::<'_, ()>`
   --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
 note: inside `std::ptr::const_ptr::<impl *const ()>::offset_from_unsigned`
   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
-   = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: could not evaluate static initializer
   --> $DIR/forbidden_slices.rs:54:25
diff --git a/tests/ui/consts/assoc-const-elided-lifetime.stderr b/tests/ui/consts/assoc-const-elided-lifetime.stderr
index 0c3e455eb2d..95821526835 100644
--- a/tests/ui/consts/assoc-const-elided-lifetime.stderr
+++ b/tests/ui/consts/assoc-const-elided-lifetime.stderr
@@ -35,8 +35,6 @@ note: cannot automatically infer `'static` because of other lifetimes in scope
    |
 LL | impl<'a> Foo<'a> {
    |      ^^
-LL |     const FOO: Foo<'_> = Foo { x: PhantomData::<&()> };
-   |                    ^^
 help: use the `'static` lifetime
    |
 LL |     const BAR: &'static () = &();
diff --git a/tests/ui/consts/async-block.rs b/tests/ui/consts/async-block.rs
index 40be4d195d4..1211a150f7d 100644
--- a/tests/ui/consts/async-block.rs
+++ b/tests/ui/consts/async-block.rs
@@ -2,8 +2,8 @@
 
 //@ edition:2018
 //@ revisions: with_feature without_feature
+//@[with_feature] check-pass
 
-#![feature(rustc_attrs)]
 #![cfg_attr(with_feature, feature(const_async_blocks))]
 
 use std::future::Future;
@@ -15,5 +15,4 @@ const _: i32 = { core::mem::ManuallyDrop::new(async { 0 }); 4 };
 static _FUT: &(dyn Future<Output = ()> + Sync) = &async {};
 //[without_feature]~^ `async` block
 
-#[rustc_error]
-fn main() {} //[with_feature]~ fatal error triggered by #[rustc_error]
+fn main() {}
diff --git a/tests/ui/consts/async-block.with_feature.stderr b/tests/ui/consts/async-block.with_feature.stderr
deleted file mode 100644
index 8228fa29edf..00000000000
--- a/tests/ui/consts/async-block.with_feature.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: fatal error triggered by #[rustc_error]
-  --> $DIR/async-block.rs:19:1
-   |
-LL | fn main() {}
-   | ^^^^^^^^^
-
-error: aborting due to 1 previous error
-
diff --git a/tests/ui/consts/const-blocks/trait-error.stderr b/tests/ui/consts/const-blocks/trait-error.stderr
index 068720a53f6..58ddc047d03 100644
--- a/tests/ui/consts/const-blocks/trait-error.stderr
+++ b/tests/ui/consts/const-blocks/trait-error.stderr
@@ -13,7 +13,6 @@ note: required for `Foo<String>` to implement `Copy`
 LL | #[derive(Copy, Clone)]
    |          ^^^^ unsatisfied trait bound introduced in this `derive` macro
    = note: the `Copy` trait is required because this value will be copied for each element of the array
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/consts/const-eval/const_fn_ptr.rs b/tests/ui/consts/const-eval/const_fn_ptr.rs
index f8a2658f31e..1d65eedb93d 100644
--- a/tests/ui/consts/const-eval/const_fn_ptr.rs
+++ b/tests/ui/consts/const-eval/const_fn_ptr.rs
@@ -34,3 +34,5 @@ fn main() {
     let z = foo(double, 2);
     assert_eq!(z, 4);
 }
+
+//~? WARN skipping const checks
diff --git a/tests/ui/consts/const-eval/const_fn_ptr_fail.rs b/tests/ui/consts/const-eval/const_fn_ptr_fail.rs
index a0f804722db..00bf0ed0eba 100644
--- a/tests/ui/consts/const-eval/const_fn_ptr_fail.rs
+++ b/tests/ui/consts/const-eval/const_fn_ptr_fail.rs
@@ -10,3 +10,5 @@ const fn bar(x: usize) -> usize {
 }
 
 fn main() {}
+
+//~? WARN skipping const checks
diff --git a/tests/ui/consts/const-eval/const_fn_ptr_fail2.rs b/tests/ui/consts/const-eval/const_fn_ptr_fail2.rs
index 7db8c6e81ab..c6ae3af4427 100644
--- a/tests/ui/consts/const-eval/const_fn_ptr_fail2.rs
+++ b/tests/ui/consts/const-eval/const_fn_ptr_fail2.rs
@@ -24,3 +24,5 @@ fn main() {
     assert_eq!(Y, 4);
     assert_eq!(Z, 4);
 }
+
+//~? WARN skipping const checks
diff --git a/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.stderr b/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.stderr
index 64e227c4f45..fae971c09f2 100644
--- a/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.stderr
+++ b/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of constant value failed
    |
 LL | struct Bug([u8; panic!{"\t"}]);
    |                 ^^^^^^^^^^^^ evaluation panicked:     
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/consts/const-eval/const_panic.stderr b/tests/ui/consts/const-eval/const_panic.stderr
index 0816b04faca..0874224e5f2 100644
--- a/tests/ui/consts/const-eval/const_panic.stderr
+++ b/tests/ui/consts/const-eval/const_panic.stderr
@@ -3,24 +3,18 @@ error[E0080]: evaluation of constant value failed
    |
 LL | const Z: () = std::panic!("cheese");
    |               ^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: cheese
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `std::panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic.rs:9:16
    |
 LL | const Z2: () = std::panic!();
    |                ^^^^^^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `std::panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic.rs:12:15
    |
 LL | const Y: () = std::unreachable!();
    |               ^^^^^^^^^^^^^^^^^^^ evaluation panicked: internal error: entered unreachable code
-   |
-   = note: this error originates in the macro `$crate::panic::unreachable_2015` which comes from the expansion of the macro `std::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic.rs:15:15
@@ -35,40 +29,30 @@ error[E0080]: evaluation of constant value failed
    |
 LL | const W: () = std::panic!(MSG);
    |               ^^^^^^^^^^^^^^^^ evaluation panicked: hello
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `std::panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic.rs:21:16
    |
 LL | const W2: () = std::panic!("{}", MSG);
    |                ^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: hello
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `std::panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic.rs:24:20
    |
 LL | const Z_CORE: () = core::panic!("cheese");
    |                    ^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: cheese
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `core::panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic.rs:27:21
    |
 LL | const Z2_CORE: () = core::panic!();
    |                     ^^^^^^^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `core::panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic.rs:30:20
    |
 LL | const Y_CORE: () = core::unreachable!();
    |                    ^^^^^^^^^^^^^^^^^^^^ evaluation panicked: internal error: entered unreachable code
-   |
-   = note: this error originates in the macro `$crate::panic::unreachable_2015` which comes from the expansion of the macro `core::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic.rs:33:20
@@ -83,16 +67,12 @@ error[E0080]: evaluation of constant value failed
    |
 LL | const W_CORE: () = core::panic!(MSG);
    |                    ^^^^^^^^^^^^^^^^^ evaluation panicked: hello
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `core::panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic.rs:39:21
    |
 LL | const W2_CORE: () = core::panic!("{}", MSG);
    |                     ^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: hello
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `core::panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 12 previous errors
 
diff --git a/tests/ui/consts/const-eval/const_panic_2021.stderr b/tests/ui/consts/const-eval/const_panic_2021.stderr
index 4faa2a1e4cf..1496df4445a 100644
--- a/tests/ui/consts/const-eval/const_panic_2021.stderr
+++ b/tests/ui/consts/const-eval/const_panic_2021.stderr
@@ -3,24 +3,18 @@ error[E0080]: evaluation of constant value failed
    |
 LL | const A: () = std::panic!("blåhaj");
    |               ^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: blåhaj
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `std::panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic_2021.rs:9:15
    |
 LL | const B: () = std::panic!();
    |               ^^^^^^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `std::panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic_2021.rs:12:15
    |
 LL | const C: () = std::unreachable!();
    |               ^^^^^^^^^^^^^^^^^^^ evaluation panicked: internal error: entered unreachable code
-   |
-   = note: this error originates in the macro `$crate::panic::unreachable_2021` which comes from the expansion of the macro `std::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic_2021.rs:15:15
@@ -35,32 +29,24 @@ error[E0080]: evaluation of constant value failed
    |
 LL | const E: () = std::panic!("{}", MSG);
    |               ^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: hello
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `std::panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic_2021.rs:21:20
    |
 LL | const A_CORE: () = core::panic!("shark");
    |                    ^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: shark
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `core::panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic_2021.rs:24:20
    |
 LL | const B_CORE: () = core::panic!();
    |                    ^^^^^^^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `core::panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic_2021.rs:27:20
    |
 LL | const C_CORE: () = core::unreachable!();
    |                    ^^^^^^^^^^^^^^^^^^^^ evaluation panicked: internal error: entered unreachable code
-   |
-   = note: this error originates in the macro `$crate::panic::unreachable_2021` which comes from the expansion of the macro `core::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic_2021.rs:30:20
@@ -75,8 +61,6 @@ error[E0080]: evaluation of constant value failed
    |
 LL | const E_CORE: () = core::panic!("{}", MSG);
    |                    ^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: hello
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `core::panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 10 previous errors
 
diff --git a/tests/ui/consts/const-eval/const_panic_libcore_bin.stderr b/tests/ui/consts/const-eval/const_panic_libcore_bin.stderr
index 11e70c48499..2acab711290 100644
--- a/tests/ui/consts/const-eval/const_panic_libcore_bin.stderr
+++ b/tests/ui/consts/const-eval/const_panic_libcore_bin.stderr
@@ -3,16 +3,12 @@ error[E0080]: evaluation of constant value failed
    |
 LL | const Z: () = panic!("cheese");
    |               ^^^^^^^^^^^^^^^^ evaluation panicked: cheese
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic_libcore_bin.rs:11:15
    |
 LL | const Y: () = unreachable!();
    |               ^^^^^^^^^^^^^^ evaluation panicked: internal error: entered unreachable code
-   |
-   = note: this error originates in the macro `$crate::panic::unreachable_2015` which comes from the expansion of the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic_libcore_bin.rs:14:15
diff --git a/tests/ui/consts/const-eval/format.stderr b/tests/ui/consts/const-eval/format.stderr
index af90acc2a26..e8d7bbcea09 100644
--- a/tests/ui/consts/const-eval/format.stderr
+++ b/tests/ui/consts/const-eval/format.stderr
@@ -5,7 +5,6 @@ LL |     panic!("{:?}", 0);
    |             ^^^^
    |
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-   = note: this error originates in the macro `$crate::const_format_args` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0015]: cannot call non-const formatting macro in constant functions
   --> $DIR/format.rs:7:15
diff --git a/tests/ui/consts/const-eval/ice-unhandled-type-122191.rs b/tests/ui/consts/const-eval/ice-unhandled-type-122191.rs
index a92b99976e2..75bd6f7a123 100644
--- a/tests/ui/consts/const-eval/ice-unhandled-type-122191.rs
+++ b/tests/ui/consts/const-eval/ice-unhandled-type-122191.rs
@@ -3,14 +3,20 @@ type Foo = impl Send;
 
 struct A;
 
-const VALUE: Foo = value();
-//~^ ERROR cannot find function `value` in this scope
+#[define_opaque(Foo)]
+//~^ ERROR unstable library feature
+const fn foo() -> Foo {
+    value()
+    //~^ ERROR cannot find function `value` in this scope
+}
+
+const VALUE: Foo = foo();
 
 fn test() {
     match VALUE {
         0 | 0 => {}
-//~^ ERROR mismatched types
-//~| ERROR mismatched types
+        //~^ ERROR mismatched types
+        //~| ERROR mismatched types
         _ => (),
     }
 }
diff --git a/tests/ui/consts/const-eval/ice-unhandled-type-122191.stderr b/tests/ui/consts/const-eval/ice-unhandled-type-122191.stderr
index daf0ccaa776..bcb6a80a8f2 100644
--- a/tests/ui/consts/const-eval/ice-unhandled-type-122191.stderr
+++ b/tests/ui/consts/const-eval/ice-unhandled-type-122191.stderr
@@ -1,3 +1,13 @@
+error[E0658]: use of unstable library feature `type_alias_impl_trait`: `type_alias_impl_trait` has open design concerns
+  --> $DIR/ice-unhandled-type-122191.rs:6:3
+   |
+LL | #[define_opaque(Foo)]
+   |   ^^^^^^^^^^^^^
+   |
+   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
+   = help: add `#![feature(type_alias_impl_trait)]` 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]: `impl Trait` in type aliases is unstable
   --> $DIR/ice-unhandled-type-122191.rs:1:12
    |
@@ -9,13 +19,16 @@ LL | type Foo = impl Send;
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0425]: cannot find function `value` in this scope
-  --> $DIR/ice-unhandled-type-122191.rs:6:20
+  --> $DIR/ice-unhandled-type-122191.rs:9:5
    |
-LL | const VALUE: Foo = value();
-   |                    ^^^^^ not found in this scope
+LL |     value()
+   |     ^^^^^ help: a constant with a similar name exists: `VALUE`
+...
+LL | const VALUE: Foo = foo();
+   | ------------------------- similarly named constant `VALUE` defined here
 
 error[E0308]: mismatched types
-  --> $DIR/ice-unhandled-type-122191.rs:11:9
+  --> $DIR/ice-unhandled-type-122191.rs:17:9
    |
 LL | type Foo = impl Send;
    |            --------- the expected opaque type
@@ -27,14 +40,14 @@ LL |         0 | 0 => {}
    |
    = note: expected opaque type `Foo`
                      found type `{integer}`
-note: this item must have the opaque type in its signature in order to be able to register hidden types
-  --> $DIR/ice-unhandled-type-122191.rs:9:4
+note: this item must have a `#[define_opaque(Foo)]` attribute to be able to define hidden types
+  --> $DIR/ice-unhandled-type-122191.rs:15:4
    |
 LL | fn test() {
    |    ^^^^
 
 error[E0308]: mismatched types
-  --> $DIR/ice-unhandled-type-122191.rs:11:13
+  --> $DIR/ice-unhandled-type-122191.rs:17:13
    |
 LL | type Foo = impl Send;
    |            --------- the expected opaque type
@@ -46,13 +59,13 @@ LL |         0 | 0 => {}
    |
    = note: expected opaque type `Foo`
                      found type `{integer}`
-note: this item must have the opaque type in its signature in order to be able to register hidden types
-  --> $DIR/ice-unhandled-type-122191.rs:9:4
+note: this item must have a `#[define_opaque(Foo)]` attribute to be able to define hidden types
+  --> $DIR/ice-unhandled-type-122191.rs:15:4
    |
 LL | fn test() {
    |    ^^^^
 
-error: aborting due to 4 previous errors
+error: aborting due to 5 previous errors
 
 Some errors have detailed explanations: E0308, E0425, E0658.
 For more information about an error, try `rustc --explain E0308`.
diff --git a/tests/ui/consts/const-eval/issue-85155.rs b/tests/ui/consts/const-eval/issue-85155.rs
index 95253a0b288..cb5b3a08375 100644
--- a/tests/ui/consts/const-eval/issue-85155.rs
+++ b/tests/ui/consts/const-eval/issue-85155.rs
@@ -19,3 +19,6 @@ fn main() {
     post_monomorphization_error::stdarch_intrinsic::<2>();
     //~^ NOTE the above error was encountered while instantiating
 }
+
+//~? ERROR evaluation of `post_monomorphization_error::ValidateConstImm::<2, 0, 1>::VALID` failed
+//~? NOTE erroneous constant encountered
diff --git a/tests/ui/consts/const-eval/issue-85907.stderr b/tests/ui/consts/const-eval/issue-85907.stderr
index 519227bc693..fa1bbf2187f 100644
--- a/tests/ui/consts/const-eval/issue-85907.stderr
+++ b/tests/ui/consts/const-eval/issue-85907.stderr
@@ -3,8 +3,6 @@ error: argument to `panic!()` in a const context must have type `&str`
    |
 LL |     panic!(123);
    |     ^^^^^^^^^^^
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/consts/const-eval/panic-assoc-never-type.stderr b/tests/ui/consts/const-eval/panic-assoc-never-type.stderr
index efdbbe5698f..71b33d8d0d5 100644
--- a/tests/ui/consts/const-eval/panic-assoc-never-type.stderr
+++ b/tests/ui/consts/const-eval/panic-assoc-never-type.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of constant value failed
    |
 LL |     const VOID: ! = panic!();
    |                     ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/panic-assoc-never-type.rs:14:13
diff --git a/tests/ui/consts/const-eval/panic-never-type.stderr b/tests/ui/consts/const-eval/panic-never-type.stderr
index 30a320f8db2..1d9bba9aea2 100644
--- a/tests/ui/consts/const-eval/panic-never-type.stderr
+++ b/tests/ui/consts/const-eval/panic-never-type.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of constant value failed
    |
 LL | const VOID: ! = panic!();
    |                 ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/consts/const-eval/unwind-abort.stderr b/tests/ui/consts/const-eval/unwind-abort.stderr
index 96c0dd7c5e9..7d096c5d587 100644
--- a/tests/ui/consts/const-eval/unwind-abort.stderr
+++ b/tests/ui/consts/const-eval/unwind-abort.stderr
@@ -9,7 +9,6 @@ note: inside `foo`
    |
 LL |     panic!()
    |     ^^^^^^^^ the failure occurred here
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/consts/const-promoted-opaque.atomic.stderr b/tests/ui/consts/const-promoted-opaque.atomic.stderr
index b9d5cbf801a..9c0c969d586 100644
--- a/tests/ui/consts/const-promoted-opaque.atomic.stderr
+++ b/tests/ui/consts/const-promoted-opaque.atomic.stderr
@@ -1,5 +1,5 @@
-error[E0493]: destructor of `helper::Foo` cannot be evaluated at compile-time
-  --> $DIR/const-promoted-opaque.rs:28:26
+error[E0493]: destructor of `Foo` cannot be evaluated at compile-time
+  --> $DIR/const-promoted-opaque.rs:32:26
    |
 LL |     let _: &'static _ = &FOO;
    |                          ^^^ the destructor for this type cannot be evaluated in constants
@@ -8,13 +8,13 @@ LL | };
    | - value is dropped here
 
 error[E0492]: constants cannot refer to interior mutable data
-  --> $DIR/const-promoted-opaque.rs:32:19
+  --> $DIR/const-promoted-opaque.rs:36:19
    |
 LL | const BAZ: &Foo = &FOO;
    |                   ^^^^ this borrow of an interior mutable value may end up in the final value
 
 error[E0716]: temporary value dropped while borrowed
-  --> $DIR/const-promoted-opaque.rs:36:26
+  --> $DIR/const-promoted-opaque.rs:40:26
    |
 LL |     let _: &'static _ = &FOO;
    |            ----------    ^^^ creates a temporary value which is freed while still in use
diff --git a/tests/ui/consts/const-promoted-opaque.rs b/tests/ui/consts/const-promoted-opaque.rs
index bb33e92778a..188dacd1003 100644
--- a/tests/ui/consts/const-promoted-opaque.rs
+++ b/tests/ui/consts/const-promoted-opaque.rs
@@ -8,25 +8,29 @@
 //! hidden type of the opaque type. Thus we ended up relying on the
 //! result of our analysis to compute the result of our analysis.
 
-//@[unit] check-pass
+pub type Foo = impl Sized;
 
-mod helper {
-    pub type Foo = impl Sized;
+#[cfg(string)]
+#[define_opaque(Foo)]
+const fn foo() -> Foo {
+    String::new()
+}
 
-    #[cfg(string)]
-    pub const FOO: Foo = String::new();
+#[cfg(atomic)]
+#[define_opaque(Foo)]
+const fn foo() -> Foo {
+    std::sync::atomic::AtomicU8::new(42)
+}
 
-    #[cfg(atomic)]
-    pub const FOO: Foo = std::sync::atomic::AtomicU8::new(42);
+#[cfg(unit)]
+#[define_opaque(Foo)]
+const fn foo() -> Foo {}
 
-    #[cfg(unit)]
-    pub const FOO: Foo = ();
-}
-use helper::*;
+const FOO: Foo = foo();
 
 const BAR: () = {
     let _: &'static _ = &FOO;
-    //[string,atomic]~^ ERROR: destructor of `helper::Foo` cannot be evaluated at compile-time
+    //[string,atomic,unit]~^ ERROR: destructor of `Foo` cannot be evaluated at compile-time
 };
 
 const BAZ: &Foo = &FOO;
@@ -34,5 +38,5 @@ const BAZ: &Foo = &FOO;
 
 fn main() {
     let _: &'static _ = &FOO;
-    //[string,atomic]~^ ERROR: temporary value dropped while borrowed
+    //[string,atomic,unit]~^ ERROR: temporary value dropped while borrowed
 }
diff --git a/tests/ui/consts/const-promoted-opaque.string.stderr b/tests/ui/consts/const-promoted-opaque.string.stderr
index 33e5f426448..847a466f21c 100644
--- a/tests/ui/consts/const-promoted-opaque.string.stderr
+++ b/tests/ui/consts/const-promoted-opaque.string.stderr
@@ -1,5 +1,5 @@
-error[E0493]: destructor of `helper::Foo` cannot be evaluated at compile-time
-  --> $DIR/const-promoted-opaque.rs:28:26
+error[E0493]: destructor of `Foo` cannot be evaluated at compile-time
+  --> $DIR/const-promoted-opaque.rs:32:26
    |
 LL |     let _: &'static _ = &FOO;
    |                          ^^^ the destructor for this type cannot be evaluated in constants
@@ -8,7 +8,7 @@ LL | };
    | - value is dropped here
 
 error[E0716]: temporary value dropped while borrowed
-  --> $DIR/const-promoted-opaque.rs:36:26
+  --> $DIR/const-promoted-opaque.rs:40:26
    |
 LL |     let _: &'static _ = &FOO;
    |            ----------    ^^^ creates a temporary value which is freed while still in use
diff --git a/tests/ui/consts/const-promoted-opaque.unit.stderr b/tests/ui/consts/const-promoted-opaque.unit.stderr
new file mode 100644
index 00000000000..847a466f21c
--- /dev/null
+++ b/tests/ui/consts/const-promoted-opaque.unit.stderr
@@ -0,0 +1,24 @@
+error[E0493]: destructor of `Foo` cannot be evaluated at compile-time
+  --> $DIR/const-promoted-opaque.rs:32:26
+   |
+LL |     let _: &'static _ = &FOO;
+   |                          ^^^ the destructor for this type cannot be evaluated in constants
+LL |
+LL | };
+   | - value is dropped here
+
+error[E0716]: temporary value dropped while borrowed
+  --> $DIR/const-promoted-opaque.rs:40:26
+   |
+LL |     let _: &'static _ = &FOO;
+   |            ----------    ^^^ creates a temporary value which is freed while still in use
+   |            |
+   |            type annotation requires that borrow lasts for `'static`
+LL |
+LL | }
+   | - temporary value is freed at the end of this statement
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0493, E0716.
+For more information about an error, try `rustc --explain E0493`.
diff --git a/tests/ui/consts/const-ptr-is-null.stderr b/tests/ui/consts/const-ptr-is-null.stderr
index ff2db14a2f5..1a2be3b3cb1 100644
--- a/tests/ui/consts/const-ptr-is-null.stderr
+++ b/tests/ui/consts/const-ptr-is-null.stderr
@@ -8,7 +8,6 @@ note: inside `std::ptr::const_ptr::<impl *const i32>::is_null`
   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
 note: inside `std::ptr::const_ptr::<impl *const T>::is_null::compiletime`
   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
-   = note: this error originates in the macro `$crate::intrinsics::const_eval_select` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/consts/const-unsized.stderr b/tests/ui/consts/const-unsized.stderr
index 8328e19aac2..cee364b33f7 100644
--- a/tests/ui/consts/const-unsized.stderr
+++ b/tests/ui/consts/const-unsized.stderr
@@ -58,18 +58,18 @@ error[E0507]: cannot move out of a shared reference
 LL | static STATIC_BAR: str = *"bar";
    |                          ^^^^^^ move occurs because value has type `str`, which does not implement the `Copy` trait
 
-error[E0161]: cannot move a value of type `str`
-  --> $DIR/const-unsized.rs:20:48
-   |
-LL |     println!("{:?} {:?} {:?} {:?}", &CONST_0, &CONST_FOO, &STATIC_1, &STATIC_BAR);
-   |                                                ^^^^^^^^^ the size of `str` cannot be statically determined
-
 error[E0161]: cannot move a value of type `dyn Debug + Sync`
   --> $DIR/const-unsized.rs:20:38
    |
 LL |     println!("{:?} {:?} {:?} {:?}", &CONST_0, &CONST_FOO, &STATIC_1, &STATIC_BAR);
    |                                      ^^^^^^^ the size of `dyn Debug + Sync` cannot be statically determined
 
+error[E0161]: cannot move a value of type `str`
+  --> $DIR/const-unsized.rs:20:48
+   |
+LL |     println!("{:?} {:?} {:?} {:?}", &CONST_0, &CONST_FOO, &STATIC_1, &STATIC_BAR);
+   |                                                ^^^^^^^^^ the size of `str` cannot be statically determined
+
 error: aborting due to 10 previous errors
 
 Some errors have detailed explanations: E0161, E0277, E0507.
diff --git a/tests/ui/consts/const_cmp_type_id.stderr b/tests/ui/consts/const_cmp_type_id.stderr
index 2e9a8024eae..62f8d42c0e6 100644
--- a/tests/ui/consts/const_cmp_type_id.stderr
+++ b/tests/ui/consts/const_cmp_type_id.stderr
@@ -27,7 +27,6 @@ LL |         let _a = TypeId::of::<u8>() < TypeId::of::<u16>();
 note: impl defined here, but it is not `const`
   --> $SRC_DIR/core/src/any.rs:LL:COL
    = note: calls in constants are limited to constant functions, tuple structs and tuple variants
-   = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/consts/control-flow/assert.stderr b/tests/ui/consts/control-flow/assert.stderr
index fc378f57fa4..3fa98b74bf6 100644
--- a/tests/ui/consts/control-flow/assert.stderr
+++ b/tests/ui/consts/control-flow/assert.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of constant value failed
    |
 LL | const _: () = assert!(false);
    |               ^^^^^^^^^^^^^^ evaluation panicked: assertion failed: false
-   |
-   = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/consts/issue-32829.stderr b/tests/ui/consts/issue-32829.stderr
index 0cbc73cfaa3..542dce19151 100644
--- a/tests/ui/consts/issue-32829.stderr
+++ b/tests/ui/consts/issue-32829.stderr
@@ -3,8 +3,6 @@ error[E0080]: could not evaluate static initializer
    |
 LL | static S : u64 = { { panic!("foo"); 0 } };
    |                      ^^^^^^^^^^^^^ evaluation panicked: foo
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/consts/issue-66693-panic-in-array-len.stderr b/tests/ui/consts/issue-66693-panic-in-array-len.stderr
index 9cf5ad126f3..fdef515b6d4 100644
--- a/tests/ui/consts/issue-66693-panic-in-array-len.stderr
+++ b/tests/ui/consts/issue-66693-panic-in-array-len.stderr
@@ -3,16 +3,12 @@ error: argument to `panic!()` in a const context must have type `&str`
    |
 LL |     let _ = [0i32; panic!(2f32)];
    |                    ^^^^^^^^^^^^
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/issue-66693-panic-in-array-len.rs:10:21
    |
 LL |     let _ = [false; panic!()];
    |                     ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/consts/issue-66693.stderr b/tests/ui/consts/issue-66693.stderr
index 46f30a8cbab..ea657ec34bd 100644
--- a/tests/ui/consts/issue-66693.stderr
+++ b/tests/ui/consts/issue-66693.stderr
@@ -3,40 +3,30 @@ error: argument to `panic!()` in a const context must have type `&str`
    |
 LL | const _: () = panic!(1);
    |               ^^^^^^^^^
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: argument to `panic!()` in a const context must have type `&str`
   --> $DIR/issue-66693.rs:7:19
    |
 LL | static _FOO: () = panic!(true);
    |                   ^^^^^^^^^^^^
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/issue-66693.rs:16:15
    |
 LL | const _: () = panic!();
    |               ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: could not evaluate static initializer
   --> $DIR/issue-66693.rs:18:19
    |
 LL | static _BAR: () = panic!("panic in static");
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: panic in static
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: argument to `panic!()` in a const context must have type `&str`
   --> $DIR/issue-66693.rs:11:5
    |
 LL |     panic!(&1);
    |     ^^^^^^^^^^
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 5 previous errors
 
diff --git a/tests/ui/consts/issue-76064.stderr b/tests/ui/consts/issue-76064.stderr
index 55059220388..786d4213f1e 100644
--- a/tests/ui/consts/issue-76064.stderr
+++ b/tests/ui/consts/issue-76064.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of constant value failed
    |
 LL | struct Bug([u8; panic!("panic")]);
    |                 ^^^^^^^^^^^^^^^ evaluation panicked: panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/consts/large_const_alloc.rs b/tests/ui/consts/large_const_alloc.rs
index 14edc1bb696..3573a018630 100644
--- a/tests/ui/consts/large_const_alloc.rs
+++ b/tests/ui/consts/large_const_alloc.rs
@@ -2,6 +2,9 @@
 // on 32bit and 16bit platforms it is plausible that the maximum allocation size will succeed
 // FIXME (#135952) In some cases on AArch64 Linux the diagnostic does not trigger
 //@ ignore-aarch64-unknown-linux-gnu
+// AIX will allow the allocation to go through, and get SIGKILL when zero initializing
+// the overcommitted page.
+//@ ignore-aix
 
 const FOO: () = {
     // 128 TiB, unlikely anyone has that much RAM
diff --git a/tests/ui/consts/large_const_alloc.stderr b/tests/ui/consts/large_const_alloc.stderr
index fa7d5977a95..f3f3de7af63 100644
--- a/tests/ui/consts/large_const_alloc.stderr
+++ b/tests/ui/consts/large_const_alloc.stderr
@@ -1,11 +1,11 @@
 error[E0080]: evaluation of constant value failed
-  --> $DIR/large_const_alloc.rs:8:13
+  --> $DIR/large_const_alloc.rs:11:13
    |
 LL |     let x = [0_u8; (1 << 47) - 1];
    |             ^^^^^^^^^^^^^^^^^^^^^ tried to allocate more memory than available to compiler
 
 error[E0080]: could not evaluate static initializer
-  --> $DIR/large_const_alloc.rs:13:13
+  --> $DIR/large_const_alloc.rs:16:13
    |
 LL |     let x = [0_u8; (1 << 47) - 1];
    |             ^^^^^^^^^^^^^^^^^^^^^ tried to allocate more memory than available to compiler
diff --git a/tests/ui/consts/miri_unleashed/abi-mismatch.rs b/tests/ui/consts/miri_unleashed/abi-mismatch.rs
index ea640ae78d5..0a2b3f3abd6 100644
--- a/tests/ui/consts/miri_unleashed/abi-mismatch.rs
+++ b/tests/ui/consts/miri_unleashed/abi-mismatch.rs
@@ -13,3 +13,5 @@ static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn
 //~| NOTE calling a function with calling convention C using calling convention Rust
 
 fn main() {}
+
+//~? WARN skipping const checks
diff --git a/tests/ui/consts/miri_unleashed/assoc_const.rs b/tests/ui/consts/miri_unleashed/assoc_const.rs
index 96b47ff4e5e..812207ee809 100644
--- a/tests/ui/consts/miri_unleashed/assoc_const.rs
+++ b/tests/ui/consts/miri_unleashed/assoc_const.rs
@@ -28,3 +28,5 @@ fn main() {
     // this test only causes errors due to the line below, so post-monomorphization
     let y = <String as Bar<Vec<u32>, String>>::F;
 }
+
+//~? WARN skipping const checks
diff --git a/tests/ui/consts/miri_unleashed/box.rs b/tests/ui/consts/miri_unleashed/box.rs
index 89df4526b07..1539083f09c 100644
--- a/tests/ui/consts/miri_unleashed/box.rs
+++ b/tests/ui/consts/miri_unleashed/box.rs
@@ -9,3 +9,5 @@ static TEST_BAD: &mut i32 = {
     //~^ ERROR could not evaluate static initializer
     //~| NOTE calling non-const function `Box::<i32>::new`
 };
+
+//~? WARN skipping const checks
diff --git a/tests/ui/consts/miri_unleashed/const_refers_to_static.rs b/tests/ui/consts/miri_unleashed/const_refers_to_static.rs
index a6691fa2a2f..fdccc17ab49 100644
--- a/tests/ui/consts/miri_unleashed/const_refers_to_static.rs
+++ b/tests/ui/consts/miri_unleashed/const_refers_to_static.rs
@@ -31,3 +31,5 @@ const REF_IMMUT: &u8 = &MY_STATIC;
 const READ_IMMUT: u8 = *REF_IMMUT;
 
 fn main() {}
+
+//~? WARN skipping const checks
diff --git a/tests/ui/consts/miri_unleashed/extern-static.stderr b/tests/ui/consts/miri_unleashed/extern-static.stderr
index 0979a5e4fb1..4dbabbe44a2 100644
--- a/tests/ui/consts/miri_unleashed/extern-static.stderr
+++ b/tests/ui/consts/miri_unleashed/extern-static.stderr
@@ -2,13 +2,13 @@ error[E0080]: could not evaluate static initializer
   --> $DIR/extern-static.rs:11:25
    |
 LL |     unsafe { let _val = DATA; }
-   |                         ^^^^ cannot access extern static (DefId(0:4 ~ extern_static[c41e]::{extern#0}::DATA))
+   |                         ^^^^ cannot access extern static `DATA`
 
 error[E0080]: could not evaluate static initializer
   --> $DIR/extern-static.rs:16:14
    |
 LL |     unsafe { DATA = 0; }
-   |              ^^^^^^^^ cannot access extern static (DefId(0:4 ~ extern_static[c41e]::{extern#0}::DATA))
+   |              ^^^^^^^^ cannot access extern static `DATA`
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/consts/miri_unleashed/inline_asm.rs b/tests/ui/consts/miri_unleashed/inline_asm.rs
index 8627a6bf887..f1ce613b16e 100644
--- a/tests/ui/consts/miri_unleashed/inline_asm.rs
+++ b/tests/ui/consts/miri_unleashed/inline_asm.rs
@@ -11,3 +11,5 @@ static TEST_BAD: () = {
     //~^ ERROR could not evaluate static initializer
     //~| NOTE inline assembly is not supported
 };
+
+//~? WARN skipping const checks
diff --git a/tests/ui/consts/miri_unleashed/mutable_references.rs b/tests/ui/consts/miri_unleashed/mutable_references.rs
index 039d0fadfcc..e7fc5699236 100644
--- a/tests/ui/consts/miri_unleashed/mutable_references.rs
+++ b/tests/ui/consts/miri_unleashed/mutable_references.rs
@@ -114,3 +114,5 @@ fn main() {
     }
     *OH_YES = 99; //~ ERROR cannot assign to `*OH_YES`, as `OH_YES` is an immutable static item
 }
+
+//~? WARN skipping const checks
diff --git a/tests/ui/consts/miri_unleashed/non_const_fn.rs b/tests/ui/consts/miri_unleashed/non_const_fn.rs
index d3ffb61af11..201647ac8d8 100644
--- a/tests/ui/consts/miri_unleashed/non_const_fn.rs
+++ b/tests/ui/consts/miri_unleashed/non_const_fn.rs
@@ -9,3 +9,5 @@ static C: () = foo();
 //~| NOTE calling non-const function `foo`
 
 fn main() {}
+
+//~? WARN skipping const checks
diff --git a/tests/ui/consts/miri_unleashed/ptr_arith.rs b/tests/ui/consts/miri_unleashed/ptr_arith.rs
index 6dd8ab11e7c..4e118322079 100644
--- a/tests/ui/consts/miri_unleashed/ptr_arith.rs
+++ b/tests/ui/consts/miri_unleashed/ptr_arith.rs
@@ -21,3 +21,5 @@ static PTR_INT_TRANSMUTE: () = unsafe {
 // their `PartialEq` impl is non-`const`.
 
 fn main() {}
+
+//~? WARN skipping const checks
diff --git a/tests/ui/consts/miri_unleashed/static-no-inner-mut.rs b/tests/ui/consts/miri_unleashed/static-no-inner-mut.rs
index 126d78158fe..7fa173d8d9d 100644
--- a/tests/ui/consts/miri_unleashed/static-no-inner-mut.rs
+++ b/tests/ui/consts/miri_unleashed/static-no-inner-mut.rs
@@ -38,3 +38,5 @@ static RAW_MUT_COERCE: SyncPtr<i32> = SyncPtr { x: &mut 0 };
 //~^ ERROR mutable pointer in final value
 
 fn main() {}
+
+//~? WARN skipping const checks
diff --git a/tests/ui/consts/miri_unleashed/tls.rs b/tests/ui/consts/miri_unleashed/tls.rs
index b0c6c088361..ab23a524998 100644
--- a/tests/ui/consts/miri_unleashed/tls.rs
+++ b/tests/ui/consts/miri_unleashed/tls.rs
@@ -23,3 +23,5 @@ static TEST_BAD_REF: () = {
 };
 
 fn main() {}
+
+//~? WARN skipping const checks
diff --git a/tests/ui/consts/miri_unleashed/tls.stderr b/tests/ui/consts/miri_unleashed/tls.stderr
index a00b7eb1312..ef836544303 100644
--- a/tests/ui/consts/miri_unleashed/tls.stderr
+++ b/tests/ui/consts/miri_unleashed/tls.stderr
@@ -2,13 +2,13 @@ error[E0080]: could not evaluate static initializer
   --> $DIR/tls.rs:11:25
    |
 LL |     unsafe { let _val = A; }
-   |                         ^ cannot access thread local static (DefId(0:4 ~ tls[ca29]::A))
+   |                         ^ cannot access thread local static `A`
 
 error[E0080]: could not evaluate static initializer
   --> $DIR/tls.rs:20:26
    |
 LL |     unsafe { let _val = &A; }
-   |                          ^ cannot access thread local static (DefId(0:4 ~ tls[ca29]::A))
+   |                          ^ cannot access thread local static `A`
 
 warning: skipping const checks
    |
diff --git a/tests/ui/consts/promoted_running_out_of_memory_issue-130687.rs b/tests/ui/consts/promoted_running_out_of_memory_issue-130687.rs
index 53618e2e86a..75765596fa1 100644
--- a/tests/ui/consts/promoted_running_out_of_memory_issue-130687.rs
+++ b/tests/ui/consts/promoted_running_out_of_memory_issue-130687.rs
@@ -5,6 +5,9 @@
 //@ only-64bit
 // FIXME (#135952) In some cases on AArch64 Linux the diagnostic does not trigger
 //@ ignore-aarch64-unknown-linux-gnu
+// AIX will allow the allocation to go through, and get SIGKILL when zero initializing
+// the overcommitted page.
+//@ ignore-aix
 
 pub struct Data([u8; (1 << 47) - 1]);
 const _: &'static Data = &Data([0; (1 << 47) - 1]);
diff --git a/tests/ui/consts/promoted_running_out_of_memory_issue-130687.stderr b/tests/ui/consts/promoted_running_out_of_memory_issue-130687.stderr
index aac805dbd8c..02180c1e4c6 100644
--- a/tests/ui/consts/promoted_running_out_of_memory_issue-130687.stderr
+++ b/tests/ui/consts/promoted_running_out_of_memory_issue-130687.stderr
@@ -1,5 +1,5 @@
 error[E0080]: evaluation of constant value failed
-  --> $DIR/promoted_running_out_of_memory_issue-130687.rs:10:32
+  --> $DIR/promoted_running_out_of_memory_issue-130687.rs:13:32
    |
 LL | const _: &'static Data = &Data([0; (1 << 47) - 1]);
    |                                ^^^^^^^^^^^^^^^^^^ tried to allocate more memory than available to compiler
diff --git a/tests/ui/consts/required-consts/collect-in-called-fn.noopt.stderr b/tests/ui/consts/required-consts/collect-in-called-fn.noopt.stderr
index 08d0b338728..6812b3734ef 100644
--- a/tests/ui/consts/required-consts/collect-in-called-fn.noopt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-called-fn.noopt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-called-fn.rs:19:17
diff --git a/tests/ui/consts/required-consts/collect-in-called-fn.opt.stderr b/tests/ui/consts/required-consts/collect-in-called-fn.opt.stderr
index 08d0b338728..6812b3734ef 100644
--- a/tests/ui/consts/required-consts/collect-in-called-fn.opt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-called-fn.opt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-called-fn.rs:19:17
diff --git a/tests/ui/consts/required-consts/collect-in-dead-closure.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-closure.noopt.stderr
index 41fe2cf84e4..661aea71604 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-closure.noopt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-closure.noopt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-dead-closure.rs:17:17
diff --git a/tests/ui/consts/required-consts/collect-in-dead-closure.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-closure.opt.stderr
index 41fe2cf84e4..661aea71604 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-closure.opt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-closure.opt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-dead-closure.rs:17:17
diff --git a/tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr
index b62b25bd3aa..31e6b2f487f 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-dead-drop.rs:16:17
diff --git a/tests/ui/consts/required-consts/collect-in-dead-drop.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-drop.opt.stderr
index b62b25bd3aa..31e6b2f487f 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-drop.opt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-drop.opt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-dead-drop.rs:16:17
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.noopt.stderr
index c8a7cf983c4..32dc1cb304b 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.noopt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.noopt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-dead-fn-behind-assoc-type.rs:16:17
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.opt.stderr
index c8a7cf983c4..32dc1cb304b 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.opt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.opt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-dead-fn-behind-assoc-type.rs:16:17
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.noopt.stderr
index 1e68d66cf5e..d22cf579448 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.noopt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.noopt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-dead-fn-behind-generic.rs:15:17
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.opt.stderr
index 1e68d66cf5e..d22cf579448 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.opt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.opt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-dead-fn-behind-generic.rs:15:17
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.noopt.stderr
index a9cc56fba45..91daa2f9bc3 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.noopt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.noopt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `m::Fail::<i32>::C` failed
    |
 LL |         const C: () = panic!();
    |                       ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-dead-fn-behind-opaque-type.rs:19:21
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.opt.stderr
index a9cc56fba45..91daa2f9bc3 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.opt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.opt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `m::Fail::<i32>::C` failed
    |
 LL |         const C: () = panic!();
    |                       ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-dead-fn-behind-opaque-type.rs:19:21
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.rs b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.rs
index 795e021ceb0..f333f3462c7 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.rs
+++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.rs
@@ -20,6 +20,7 @@ mod m {
         }
     }
 
+    #[define_opaque(NotCalledFn)]
     fn mk_not_called() -> NotCalledFn {
         not_called::<i32>
     }
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn.noopt.stderr
index ec549561a17..d254fc60c0c 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-fn.noopt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-fn.noopt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-dead-fn.rs:19:17
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn.opt.stderr
index ec549561a17..d254fc60c0c 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-fn.opt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-fn.opt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-dead-fn.rs:19:17
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.noopt.stderr
index dfaf69d52b2..c14837ce442 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.noopt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.noopt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Late::<i32>::FAIL` failed
    |
 LL |     const FAIL: () = panic!();
    |                      ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-dead-fnptr-in-const.rs:10:28
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.opt.stderr
index dfaf69d52b2..c14837ce442 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.opt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.opt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Late::<i32>::FAIL` failed
    |
 LL |     const FAIL: () = panic!();
    |                      ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-dead-fnptr-in-const.rs:10:28
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fnptr.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fnptr.noopt.stderr
index 7cbd423cdc0..284e1a70a20 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-fnptr.noopt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-fnptr.noopt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-dead-fnptr.rs:18:17
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fnptr.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fnptr.opt.stderr
index 7cbd423cdc0..284e1a70a20 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-fnptr.opt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-fnptr.opt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-dead-fnptr.rs:18:17
diff --git a/tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr
index 58e9d7a2c9a..8b43c67c085 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-dead-move.rs:16:17
diff --git a/tests/ui/consts/required-consts/collect-in-dead-move.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-move.opt.stderr
index 58e9d7a2c9a..8b43c67c085 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-move.opt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-move.opt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-dead-move.rs:16:17
diff --git a/tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr
index 6c78ca79fd6..4056f28541d 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-dead-vtable.rs:22:21
diff --git a/tests/ui/consts/required-consts/collect-in-dead-vtable.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-vtable.opt.stderr
index 6c78ca79fd6..4056f28541d 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-vtable.opt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-vtable.opt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-dead-vtable.rs:22:21
diff --git a/tests/ui/consts/required-consts/collect-in-promoted-const.noopt.stderr b/tests/ui/consts/required-consts/collect-in-promoted-const.noopt.stderr
index fd231e1101d..c5f3b0009f5 100644
--- a/tests/ui/consts/required-consts/collect-in-promoted-const.noopt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-promoted-const.noopt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-promoted-const.rs:20:21
diff --git a/tests/ui/consts/required-consts/collect-in-promoted-const.opt.stderr b/tests/ui/consts/required-consts/collect-in-promoted-const.opt.stderr
index 0f3f77769ad..6f36aaf314d 100644
--- a/tests/ui/consts/required-consts/collect-in-promoted-const.opt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-promoted-const.opt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<T>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-promoted-const.rs:20:21
@@ -17,8 +15,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/collect-in-promoted-const.rs:20:21
diff --git a/tests/ui/consts/required-consts/interpret-in-const-called-fn.noopt.stderr b/tests/ui/consts/required-consts/interpret-in-const-called-fn.noopt.stderr
index d2145089028..9184df472c4 100644
--- a/tests/ui/consts/required-consts/interpret-in-const-called-fn.noopt.stderr
+++ b/tests/ui/consts/required-consts/interpret-in-const-called-fn.noopt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/interpret-in-const-called-fn.rs:17:9
diff --git a/tests/ui/consts/required-consts/interpret-in-const-called-fn.opt.stderr b/tests/ui/consts/required-consts/interpret-in-const-called-fn.opt.stderr
index d2145089028..9184df472c4 100644
--- a/tests/ui/consts/required-consts/interpret-in-const-called-fn.opt.stderr
+++ b/tests/ui/consts/required-consts/interpret-in-const-called-fn.opt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/interpret-in-const-called-fn.rs:17:9
diff --git a/tests/ui/consts/required-consts/interpret-in-static.noopt.stderr b/tests/ui/consts/required-consts/interpret-in-static.noopt.stderr
index f999bf370b8..aa778deb542 100644
--- a/tests/ui/consts/required-consts/interpret-in-static.noopt.stderr
+++ b/tests/ui/consts/required-consts/interpret-in-static.noopt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/interpret-in-static.rs:16:9
diff --git a/tests/ui/consts/required-consts/interpret-in-static.opt.stderr b/tests/ui/consts/required-consts/interpret-in-static.opt.stderr
index f999bf370b8..aa778deb542 100644
--- a/tests/ui/consts/required-consts/interpret-in-static.opt.stderr
+++ b/tests/ui/consts/required-consts/interpret-in-static.opt.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `Fail::<i32>::C` failed
    |
 LL |     const C: () = panic!();
    |                   ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/interpret-in-static.rs:16:9
diff --git a/tests/ui/consts/static-default-lifetime/elided-lifetime.rs b/tests/ui/consts/static-default-lifetime/elided-lifetime.rs
index 95d59f9b894..ccf63f86fcf 100644
--- a/tests/ui/consts/static-default-lifetime/elided-lifetime.rs
+++ b/tests/ui/consts/static-default-lifetime/elided-lifetime.rs
@@ -16,7 +16,7 @@ impl Bar for Foo<'_> {
     const STATIC: &str = "";
     //~^ ERROR `&` without an explicit lifetime name cannot be used here
     //~| WARN this was previously accepted by the compiler but is being phased out
-    //~| ERROR const not compatible with trait
+    //~| ERROR lifetime parameters or bounds on const `STATIC` do not match the trait declaration
 }
 
 fn main() {}
diff --git a/tests/ui/consts/static-default-lifetime/elided-lifetime.stderr b/tests/ui/consts/static-default-lifetime/elided-lifetime.stderr
index ec01225c6bf..33873f5c5a5 100644
--- a/tests/ui/consts/static-default-lifetime/elided-lifetime.stderr
+++ b/tests/ui/consts/static-default-lifetime/elided-lifetime.stderr
@@ -39,21 +39,15 @@ help: use the `'static` lifetime
 LL |     const STATIC: &'static str = "";
    |                    +++++++
 
-error[E0308]: const not compatible with trait
-  --> $DIR/elided-lifetime.rs:16:5
+error[E0195]: lifetime parameters or bounds on const `STATIC` do not match the trait declaration
+  --> $DIR/elided-lifetime.rs:16:17
    |
+LL |     const STATIC: &str;
+   |                 - lifetimes in impl do not match this const in trait
+...
 LL |     const STATIC: &str = "";
-   |     ^^^^^^^^^^^^^^^^^^ lifetime mismatch
-   |
-   = note: expected reference `&'static _`
-              found reference `&_`
-note: the anonymous lifetime as defined here...
-  --> $DIR/elided-lifetime.rs:16:19
-   |
-LL |     const STATIC: &str = "";
-   |                   ^
-   = note: ...does not necessarily outlive the static lifetime
+   |                 ^ lifetimes do not match const in trait
 
 error: aborting due to 3 previous errors
 
-For more information about this error, try `rustc --explain E0308`.
+For more information about this error, try `rustc --explain E0195`.
diff --git a/tests/ui/consts/static-default-lifetime/static-trait-impl.rs b/tests/ui/consts/static-default-lifetime/static-trait-impl.rs
index 025fda4df58..1e12259e483 100644
--- a/tests/ui/consts/static-default-lifetime/static-trait-impl.rs
+++ b/tests/ui/consts/static-default-lifetime/static-trait-impl.rs
@@ -9,7 +9,7 @@ impl Bar<'_> for A {
     const STATIC: &str = "";
     //~^ ERROR `&` without an explicit lifetime name cannot be used here
     //~| WARN this was previously accepted by the compiler but is being phased out
-    //~| ERROR const not compatible with trait
+    //~| ERROR lifetime parameters or bounds on const `STATIC` do not match the trait declaration
 }
 
 struct B;
@@ -17,4 +17,17 @@ impl Bar<'static> for B {
     const STATIC: &str = "";
 }
 
+struct C;
+impl Bar<'_> for C {
+    // make  ^^ not cause
+    const STATIC: &'static str = {
+        struct B;
+        impl Bar<'static> for B {
+            const STATIC: &str = "";
+            //            ^ to emit a future incompat warning
+        }
+        ""
+    };
+}
+
 fn main() {}
diff --git a/tests/ui/consts/static-default-lifetime/static-trait-impl.stderr b/tests/ui/consts/static-default-lifetime/static-trait-impl.stderr
index b8e2f412b49..116f28e8484 100644
--- a/tests/ui/consts/static-default-lifetime/static-trait-impl.stderr
+++ b/tests/ui/consts/static-default-lifetime/static-trait-impl.stderr
@@ -21,25 +21,15 @@ help: use the `'static` lifetime
 LL |     const STATIC: &'static str = "";
    |                    +++++++
 
-error[E0308]: const not compatible with trait
-  --> $DIR/static-trait-impl.rs:9:5
+error[E0195]: lifetime parameters or bounds on const `STATIC` do not match the trait declaration
+  --> $DIR/static-trait-impl.rs:9:17
    |
+LL |     const STATIC: &'a str;
+   |                 - lifetimes in impl do not match this const in trait
+...
 LL |     const STATIC: &str = "";
-   |     ^^^^^^^^^^^^^^^^^^ lifetime mismatch
-   |
-   = note: expected reference `&_`
-              found reference `&_`
-note: the anonymous lifetime as defined here...
-  --> $DIR/static-trait-impl.rs:9:19
-   |
-LL |     const STATIC: &str = "";
-   |                   ^
-note: ...does not necessarily outlive the anonymous lifetime as defined here
-  --> $DIR/static-trait-impl.rs:8:10
-   |
-LL | impl Bar<'_> for A {
-   |          ^^
+   |                 ^ lifetimes do not match const in trait
 
 error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0308`.
+For more information about this error, try `rustc --explain E0195`.
diff --git a/tests/ui/consts/too_generic_eval_ice.stderr b/tests/ui/consts/too_generic_eval_ice.current.stderr
index 3cc4377514a..02bcaee8015 100644
--- a/tests/ui/consts/too_generic_eval_ice.stderr
+++ b/tests/ui/consts/too_generic_eval_ice.current.stderr
@@ -1,5 +1,5 @@
 error: constant expression depends on a generic parameter
-  --> $DIR/too_generic_eval_ice.rs:7:13
+  --> $DIR/too_generic_eval_ice.rs:11:13
    |
 LL |         [5; Self::HOST_SIZE] == [6; 0]
    |             ^^^^^^^^^^^^^^^
@@ -7,7 +7,7 @@ LL |         [5; Self::HOST_SIZE] == [6; 0]
    = note: this may fail depending on what value the parameter takes
 
 error: constant expression depends on a generic parameter
-  --> $DIR/too_generic_eval_ice.rs:7:9
+  --> $DIR/too_generic_eval_ice.rs:11:9
    |
 LL |         [5; Self::HOST_SIZE] == [6; 0]
    |         ^^^^^^^^^^^^^^^^^^^^
@@ -15,7 +15,7 @@ LL |         [5; Self::HOST_SIZE] == [6; 0]
    = note: this may fail depending on what value the parameter takes
 
 error: constant expression depends on a generic parameter
-  --> $DIR/too_generic_eval_ice.rs:7:30
+  --> $DIR/too_generic_eval_ice.rs:11:30
    |
 LL |         [5; Self::HOST_SIZE] == [6; 0]
    |                              ^^
@@ -23,7 +23,7 @@ LL |         [5; Self::HOST_SIZE] == [6; 0]
    = note: this may fail depending on what value the parameter takes
 
 error[E0277]: can't compare `[{integer}; Self::HOST_SIZE]` with `[{integer}; 0]`
-  --> $DIR/too_generic_eval_ice.rs:7:30
+  --> $DIR/too_generic_eval_ice.rs:11:30
    |
 LL |         [5; Self::HOST_SIZE] == [6; 0]
    |                              ^^ no implementation for `[{integer}; Self::HOST_SIZE] == [{integer}; 0]`
diff --git a/tests/ui/consts/too_generic_eval_ice.next.stderr b/tests/ui/consts/too_generic_eval_ice.next.stderr
new file mode 100644
index 00000000000..01da33241c8
--- /dev/null
+++ b/tests/ui/consts/too_generic_eval_ice.next.stderr
@@ -0,0 +1,9 @@
+error[E0284]: type annotations needed: cannot satisfy `the constant `Self::HOST_SIZE` can be evaluated`
+  --> $DIR/too_generic_eval_ice.rs:11:13
+   |
+LL |         [5; Self::HOST_SIZE] == [6; 0]
+   |             ^^^^^^^^^^^^^^^ cannot satisfy `the constant `Self::HOST_SIZE` can be evaluated`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0284`.
diff --git a/tests/ui/consts/too_generic_eval_ice.rs b/tests/ui/consts/too_generic_eval_ice.rs
index 0d46a4c8276..ff741cdcf20 100644
--- a/tests/ui/consts/too_generic_eval_ice.rs
+++ b/tests/ui/consts/too_generic_eval_ice.rs
@@ -1,3 +1,7 @@
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
+
 pub struct Foo<A, B>(A, B);
 
 impl<A, B> Foo<A, B> {
@@ -5,10 +9,11 @@ impl<A, B> Foo<A, B> {
 
     pub fn crash() -> bool {
         [5; Self::HOST_SIZE] == [6; 0]
-        //~^ ERROR constant expression depends on a generic parameter
-        //~| ERROR constant expression depends on a generic parameter
-        //~| ERROR constant expression depends on a generic parameter
-        //~| ERROR can't compare `[{integer}; Self::HOST_SIZE]` with `[{integer}; 0]`
+        //[current]~^ ERROR constant expression depends on a generic parameter
+        //[current]~| ERROR constant expression depends on a generic parameter
+        //[current]~| ERROR constant expression depends on a generic parameter
+        //[current]~| ERROR can't compare `[{integer}; Self::HOST_SIZE]` with `[{integer}; 0]`
+        //[next]~^^^^^ ERROR type annotations needed
     }
 }
 
diff --git a/tests/ui/coroutine/layout-error.rs b/tests/ui/coroutine/layout-error.rs
index 3e26cf17d29..6cf32134025 100644
--- a/tests/ui/coroutine/layout-error.rs
+++ b/tests/ui/coroutine/layout-error.rs
@@ -16,22 +16,20 @@ impl<F: Future> Task<F> {
     }
 }
 
-mod helper {
-    use super::*;
-    pub type F = impl Future;
-    fn foo()
-    where
-        F:,
-    {
-        async fn cb() {
-            let a = Foo; //~ ERROR cannot find value `Foo` in this scope
-        }
-
-        Task::spawn(&POOL, || cb());
+pub type F = impl Future;
+#[define_opaque(F)]
+fn foo()
+where
+    F:,
+{
+    async fn cb() {
+        let a = Foo; //~ ERROR cannot find value `Foo` in this scope
     }
+
+    Task::spawn(&POOL, || cb());
 }
 
 // Check that statics are inhabited computes they layout.
-static POOL: Task<helper::F> = Task::new();
+static POOL: Task<F> = Task::new();
 
 fn main() {}
diff --git a/tests/ui/coroutine/layout-error.stderr b/tests/ui/coroutine/layout-error.stderr
index ceadb62c999..91e35216435 100644
--- a/tests/ui/coroutine/layout-error.stderr
+++ b/tests/ui/coroutine/layout-error.stderr
@@ -1,8 +1,8 @@
 error[E0425]: cannot find value `Foo` in this scope
-  --> $DIR/layout-error.rs:27:21
+  --> $DIR/layout-error.rs:26:17
    |
-LL |             let a = Foo;
-   |                     ^^^ not found in this scope
+LL |         let a = Foo;
+   |                 ^^^ not found in this scope
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/coroutine/metadata-sufficient-for-layout.rs b/tests/ui/coroutine/metadata-sufficient-for-layout.rs
index 9c3a7e4378e..b7d8575c761 100644
--- a/tests/ui/coroutine/metadata-sufficient-for-layout.rs
+++ b/tests/ui/coroutine/metadata-sufficient-for-layout.rs
@@ -15,6 +15,7 @@ mod helper {
     use std::ops::Coroutine;
     pub type F = impl Coroutine<(), Yield = (), Return = ()>;
 
+    #[define_opaque(F)]
     fn f() -> F {
         metadata_sufficient_for_layout::g()
     }
diff --git a/tests/ui/coroutine/postfix-yield.rs b/tests/ui/coroutine/postfix-yield.rs
new file mode 100644
index 00000000000..ff843138c8c
--- /dev/null
+++ b/tests/ui/coroutine/postfix-yield.rs
@@ -0,0 +1,34 @@
+// This demonstrates a proposed alternate or additional option of having yield in postfix position.
+
+//@ run-pass
+//@ edition: 2024
+
+#![feature(gen_blocks, coroutines, coroutine_trait, yield_expr)]
+
+use std::ops::{Coroutine, CoroutineState};
+use std::pin::pin;
+
+fn main() {
+    // generators (i.e. yield doesn't return anything useful)
+    let mut gn = gen {
+        yield 1;
+        2.yield;
+    };
+
+    assert_eq!(gn.next(), Some(1));
+    assert_eq!(gn.next(), Some(2));
+    assert_eq!(gn.next(), None);
+
+    //coroutines (i.e. yield returns something useful)
+    let mut coro = pin!(
+        #[coroutine]
+        |_: i32| {
+            let x = 1.yield;
+            (x + 2).yield;
+        }
+    );
+
+    assert_eq!(coro.as_mut().resume(0), CoroutineState::Yielded(1));
+    assert_eq!(coro.as_mut().resume(2), CoroutineState::Yielded(4));
+    assert_eq!(coro.as_mut().resume(3), CoroutineState::Complete(()));
+}
diff --git a/tests/ui/crate_type_flag.rs b/tests/ui/crate_type_flag.rs
new file mode 100644
index 00000000000..4f3cfbae45d
--- /dev/null
+++ b/tests/ui/crate_type_flag.rs
@@ -0,0 +1,4 @@
+//@ compile-flags: --crate-type dynlib
+//@ error-pattern: unknown crate type: `dynlib`, expected one of: `lib`, `rlib`, `staticlib`, `dylib`, `cdylib`, `bin`, `proc-macro`
+
+fn main() {}
diff --git a/tests/ui/crate_type_flag.stderr b/tests/ui/crate_type_flag.stderr
new file mode 100644
index 00000000000..26a3e1fbd68
--- /dev/null
+++ b/tests/ui/crate_type_flag.stderr
@@ -0,0 +1,2 @@
+error: unknown crate type: `dynlib`, expected one of: `lib`, `rlib`, `staticlib`, `dylib`, `cdylib`, `bin`, `proc-macro`
+
diff --git a/tests/ui/custom_test_frameworks/mismatch.stderr b/tests/ui/custom_test_frameworks/mismatch.stderr
index dad93cfbba4..c7798635fbf 100644
--- a/tests/ui/custom_test_frameworks/mismatch.stderr
+++ b/tests/ui/custom_test_frameworks/mismatch.stderr
@@ -7,7 +7,6 @@ LL | fn wrong_kind(){}
    | ^^^^^^^^^^^^^^^^^ the trait `Testable` is not implemented for `TestDescAndFn`
    |
    = note: required for the cast from `&TestDescAndFn` to `&dyn Testable`
-   = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/delegation/fn-header-variadic.rs b/tests/ui/delegation/fn-header-variadic.rs
new file mode 100644
index 00000000000..2c83d64d0b3
--- /dev/null
+++ b/tests/ui/delegation/fn-header-variadic.rs
@@ -0,0 +1,25 @@
+//@ aux-crate:fn_header_aux=fn-header-aux.rs
+
+#![feature(c_variadic)]
+#![feature(fn_delegation)]
+#![allow(incomplete_features)]
+
+mod to_reuse {
+    pub unsafe extern "C" fn variadic_fn(n: usize, mut args: ...) {}
+}
+
+reuse to_reuse::variadic_fn;
+//~^ ERROR delegation to C-variadic functions is not allowed
+reuse fn_header_aux::variadic_fn_extern;
+//~^ ERROR delegation to C-variadic functions is not allowed
+
+fn main() {
+    unsafe {
+        variadic_fn(0);
+        variadic_fn(0, 1);
+        variadic_fn_extern(0);
+        variadic_fn_extern(0, 1);
+    }
+    let _: unsafe extern "C" fn(usize, ...) = variadic_fn;
+    let _: unsafe extern "C" fn(usize, ...) = variadic_fn_extern;
+}
diff --git a/tests/ui/delegation/fn-header-variadic.stderr b/tests/ui/delegation/fn-header-variadic.stderr
new file mode 100644
index 00000000000..688a965fb4d
--- /dev/null
+++ b/tests/ui/delegation/fn-header-variadic.stderr
@@ -0,0 +1,22 @@
+error: delegation to C-variadic functions is not allowed
+  --> $DIR/fn-header-variadic.rs:11:17
+   |
+LL |     pub unsafe extern "C" fn variadic_fn(n: usize, mut args: ...) {}
+   |     ------------------------------------------------------------- callee defined here
+...
+LL | reuse to_reuse::variadic_fn;
+   |                 ^^^^^^^^^^^
+
+error: delegation to C-variadic functions is not allowed
+  --> $DIR/fn-header-variadic.rs:13:22
+   |
+LL | reuse fn_header_aux::variadic_fn_extern;
+   |                      ^^^^^^^^^^^^^^^^^^
+   |
+  ::: $DIR/auxiliary/fn-header-aux.rs:7:1
+   |
+LL | pub unsafe extern "C" fn variadic_fn_extern(n: usize, mut args: ...) {}
+   | -------------------------------------------------------------------- callee defined here
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/delegation/fn-header.rs b/tests/ui/delegation/fn-header.rs
index db20e1058e0..9de0d549f20 100644
--- a/tests/ui/delegation/fn-header.rs
+++ b/tests/ui/delegation/fn-header.rs
@@ -10,20 +10,17 @@
 mod to_reuse {
     pub unsafe fn unsafe_fn() {}
     pub extern "C" fn extern_fn() {}
-    pub unsafe extern "C" fn variadic_fn(n: usize, mut args: ...) {}
     pub const fn const_fn() {}
     pub async fn async_fn() {}
 }
 
 reuse to_reuse::unsafe_fn;
 reuse to_reuse::extern_fn;
-reuse to_reuse::variadic_fn;
 reuse to_reuse::const_fn;
 reuse to_reuse::async_fn;
 
 reuse fn_header_aux::unsafe_fn_extern;
 reuse fn_header_aux::extern_fn_extern;
-reuse fn_header_aux::variadic_fn_extern;
 reuse fn_header_aux::const_fn_extern;
 reuse fn_header_aux::async_fn_extern;
 
@@ -46,12 +43,4 @@ fn main() {
     extern_fn_extern();
     let _: extern "C" fn() = extern_fn;
     let _: extern "C" fn() = extern_fn_extern;
-    unsafe {
-        variadic_fn(0);
-        variadic_fn(0, 1);
-        variadic_fn_extern(0);
-        variadic_fn_extern(0, 1);
-    }
-    let _: unsafe extern "C" fn(usize, ...) = variadic_fn;
-    let _: unsafe extern "C" fn(usize, ...) = variadic_fn_extern;
 }
diff --git a/tests/ui/delegation/foreign-fn.rs b/tests/ui/delegation/foreign-fn.rs
new file mode 100644
index 00000000000..1d221da29ce
--- /dev/null
+++ b/tests/ui/delegation/foreign-fn.rs
@@ -0,0 +1,22 @@
+#![feature(fn_delegation)]
+#![allow(incomplete_features)]
+#![deny(unsafe_op_in_unsafe_fn)]
+#![deny(unused_unsafe)]
+
+mod to_reuse {
+    unsafe extern "C" {
+        pub fn default_unsafe_foo();
+        pub unsafe fn unsafe_foo();
+        pub safe fn safe_foo();
+    }
+}
+
+reuse to_reuse::{default_unsafe_foo, unsafe_foo, safe_foo};
+
+fn main() {
+    let _: extern "C" fn() = default_unsafe_foo;
+    //~^ ERROR mismatched types
+    let _: extern "C" fn() = unsafe_foo;
+    //~^ ERROR mismatched types
+    let _: extern "C" fn() = safe_foo;
+}
diff --git a/tests/ui/delegation/foreign-fn.stderr b/tests/ui/delegation/foreign-fn.stderr
new file mode 100644
index 00000000000..f7d3dba4bb1
--- /dev/null
+++ b/tests/ui/delegation/foreign-fn.stderr
@@ -0,0 +1,27 @@
+error[E0308]: mismatched types
+  --> $DIR/foreign-fn.rs:17:30
+   |
+LL |     let _: extern "C" fn() = default_unsafe_foo;
+   |            ---------------   ^^^^^^^^^^^^^^^^^^ expected safe fn, found unsafe fn
+   |            |
+   |            expected due to this
+   |
+   = note: expected fn pointer `extern "C" fn()`
+                 found fn item `unsafe extern "C" fn() {default_unsafe_foo}`
+   = note: unsafe functions cannot be coerced into safe function pointers
+
+error[E0308]: mismatched types
+  --> $DIR/foreign-fn.rs:19:30
+   |
+LL |     let _: extern "C" fn() = unsafe_foo;
+   |            ---------------   ^^^^^^^^^^ expected safe fn, found unsafe fn
+   |            |
+   |            expected due to this
+   |
+   = note: expected fn pointer `extern "C" fn()`
+                 found fn item `unsafe extern "C" fn() {unsafe_foo}`
+   = note: unsafe functions cannot be coerced into safe function pointers
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/delegation/ice-issue-138362.rs b/tests/ui/delegation/ice-issue-138362.rs
new file mode 100644
index 00000000000..c3066009855
--- /dev/null
+++ b/tests/ui/delegation/ice-issue-138362.rs
@@ -0,0 +1,15 @@
+#![feature(fn_delegation)]
+#![allow(incomplete_features)]
+
+trait HasSelf {
+    fn method(self);
+}
+trait NoSelf {
+    fn method();
+}
+impl NoSelf for u8 {
+    reuse HasSelf::method;
+    //~^ ERROR this function takes 1 argument but 0 arguments were supplied
+}
+
+fn main() {}
diff --git a/tests/ui/delegation/ice-issue-138362.stderr b/tests/ui/delegation/ice-issue-138362.stderr
new file mode 100644
index 00000000000..9feddc9feae
--- /dev/null
+++ b/tests/ui/delegation/ice-issue-138362.stderr
@@ -0,0 +1,19 @@
+error[E0061]: this function takes 1 argument but 0 arguments were supplied
+  --> $DIR/ice-issue-138362.rs:11:20
+   |
+LL |     reuse HasSelf::method;
+   |                    ^^^^^^ argument #1 is missing
+   |
+note: method defined here
+  --> $DIR/ice-issue-138362.rs:5:8
+   |
+LL |     fn method(self);
+   |        ^^^^^^ ----
+help: provide the argument
+   |
+LL |     reuse HasSelf::method(/* value */);
+   |                          +++++++++++++
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0061`.
diff --git a/tests/ui/dep-graph/dep-graph-dump.rs b/tests/ui/dep-graph/dep-graph-dump.rs
index 7aede27d125..5dc05045e82 100644
--- a/tests/ui/dep-graph/dep-graph-dump.rs
+++ b/tests/ui/dep-graph/dep-graph-dump.rs
@@ -4,3 +4,5 @@
 //@ compile-flags: -Z dump-dep-graph
 
 fn main() {}
+
+//~? ERROR can't dump dependency graph without `-Z query-dep-graph`
diff --git a/tests/ui/deprecation/deprecated_ar.rs b/tests/ui/deprecation/deprecated_ar.rs
index 404d062e6a4..00862d2c00a 100644
--- a/tests/ui/deprecation/deprecated_ar.rs
+++ b/tests/ui/deprecation/deprecated_ar.rs
@@ -2,3 +2,5 @@
 //@ compile-flags: -Car=foo
 
 fn main() {}
+
+//~? WARN `-C ar`: this option is deprecated and does nothing
diff --git a/tests/ui/deprecation/deprecated_inline_threshold.rs b/tests/ui/deprecation/deprecated_inline_threshold.rs
index b54fa36397a..284a6d6798e 100644
--- a/tests/ui/deprecation/deprecated_inline_threshold.rs
+++ b/tests/ui/deprecation/deprecated_inline_threshold.rs
@@ -6,3 +6,9 @@
 //@[no_val] compile-flags: -Cinline-threshold
 
 fn main() {}
+
+//[good_val]~? WARN `-C inline-threshold`: this option is deprecated and does nothing
+//[bad_val]~? WARN `-C inline-threshold`: this option is deprecated and does nothing
+//[bad_val]~? ERROR incorrect value `asd` for codegen option `inline-threshold`
+//[no_val]~? WARN `-C inline-threshold`: this option is deprecated and does nothing
+//[no_val]~? ERROR codegen option `inline-threshold` requires a number
diff --git a/tests/ui/deprecation/deprecated_no_stack_check_opt.rs b/tests/ui/deprecation/deprecated_no_stack_check_opt.rs
index 62584ec23e3..e014c7e80af 100644
--- a/tests/ui/deprecation/deprecated_no_stack_check_opt.rs
+++ b/tests/ui/deprecation/deprecated_no_stack_check_opt.rs
@@ -2,3 +2,5 @@
 //@ compile-flags: -Cno-stack-check
 
 fn main() {}
+
+//~? WARN `-C no-stack-check`: this option is deprecated and does nothing
diff --git a/tests/ui/derives/derives-span-Clone-enum-struct-variant.stderr b/tests/ui/derives/derives-span-Clone-enum-struct-variant.stderr
index 2c8d9431646..9aeb3a8c03d 100644
--- a/tests/ui/derives/derives-span-Clone-enum-struct-variant.stderr
+++ b/tests/ui/derives/derives-span-Clone-enum-struct-variant.stderr
@@ -7,7 +7,6 @@ LL | #[derive(Clone)]
 LL |      x: Error
    |      ^^^^^^^^ the trait `Clone` is not implemented for `Error`
    |
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Clone)]`
    |
 LL + #[derive(Clone)]
diff --git a/tests/ui/derives/derives-span-Clone-enum.stderr b/tests/ui/derives/derives-span-Clone-enum.stderr
index b683a8b8944..6b4f2241663 100644
--- a/tests/ui/derives/derives-span-Clone-enum.stderr
+++ b/tests/ui/derives/derives-span-Clone-enum.stderr
@@ -7,7 +7,6 @@ LL | #[derive(Clone)]
 LL |      Error
    |      ^^^^^ the trait `Clone` is not implemented for `Error`
    |
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Clone)]`
    |
 LL + #[derive(Clone)]
diff --git a/tests/ui/derives/derives-span-Clone-struct.stderr b/tests/ui/derives/derives-span-Clone-struct.stderr
index 305a9275271..17e3f0eccf9 100644
--- a/tests/ui/derives/derives-span-Clone-struct.stderr
+++ b/tests/ui/derives/derives-span-Clone-struct.stderr
@@ -7,7 +7,6 @@ LL | struct Struct {
 LL |     x: Error
    |     ^^^^^^^^ the trait `Clone` is not implemented for `Error`
    |
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Clone)]`
    |
 LL + #[derive(Clone)]
diff --git a/tests/ui/derives/derives-span-Clone-tuple-struct.stderr b/tests/ui/derives/derives-span-Clone-tuple-struct.stderr
index b636404ad9e..f8380d197b0 100644
--- a/tests/ui/derives/derives-span-Clone-tuple-struct.stderr
+++ b/tests/ui/derives/derives-span-Clone-tuple-struct.stderr
@@ -7,7 +7,6 @@ LL | struct Struct(
 LL |     Error
    |     ^^^^^ the trait `Clone` is not implemented for `Error`
    |
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Clone)]`
    |
 LL + #[derive(Clone)]
diff --git a/tests/ui/derives/derives-span-Debug-enum-struct-variant.stderr b/tests/ui/derives/derives-span-Debug-enum-struct-variant.stderr
index 3f6c39bf939..a7f6d094681 100644
--- a/tests/ui/derives/derives-span-Debug-enum-struct-variant.stderr
+++ b/tests/ui/derives/derives-span-Debug-enum-struct-variant.stderr
@@ -9,7 +9,6 @@ LL |      x: Error
    |
    = help: the trait `Debug` is not implemented for `Error`
    = note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error`
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Debug)]`
    |
 LL + #[derive(Debug)]
diff --git a/tests/ui/derives/derives-span-Debug-enum.stderr b/tests/ui/derives/derives-span-Debug-enum.stderr
index eaeffaeb849..b3a58478159 100644
--- a/tests/ui/derives/derives-span-Debug-enum.stderr
+++ b/tests/ui/derives/derives-span-Debug-enum.stderr
@@ -9,7 +9,6 @@ LL |      Error
    |
    = help: the trait `Debug` is not implemented for `Error`
    = note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error`
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Debug)]`
    |
 LL + #[derive(Debug)]
diff --git a/tests/ui/derives/derives-span-Debug-struct.stderr b/tests/ui/derives/derives-span-Debug-struct.stderr
index 4a725e260de..c8ad652716c 100644
--- a/tests/ui/derives/derives-span-Debug-struct.stderr
+++ b/tests/ui/derives/derives-span-Debug-struct.stderr
@@ -9,7 +9,6 @@ LL |     x: Error
    |
    = help: the trait `Debug` is not implemented for `Error`
    = note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error`
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Debug)]`
    |
 LL + #[derive(Debug)]
diff --git a/tests/ui/derives/derives-span-Debug-tuple-struct.stderr b/tests/ui/derives/derives-span-Debug-tuple-struct.stderr
index 2f816e1c85b..dbece4d2091 100644
--- a/tests/ui/derives/derives-span-Debug-tuple-struct.stderr
+++ b/tests/ui/derives/derives-span-Debug-tuple-struct.stderr
@@ -9,7 +9,6 @@ LL |     Error
    |
    = help: the trait `Debug` is not implemented for `Error`
    = note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error`
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Debug)]`
    |
 LL + #[derive(Debug)]
diff --git a/tests/ui/derives/derives-span-Default-struct.stderr b/tests/ui/derives/derives-span-Default-struct.stderr
index 359b61528e1..442081f78ce 100644
--- a/tests/ui/derives/derives-span-Default-struct.stderr
+++ b/tests/ui/derives/derives-span-Default-struct.stderr
@@ -7,7 +7,6 @@ LL | struct Struct {
 LL |     x: Error
    |     ^^^^^^^^ the trait `Default` is not implemented for `Error`
    |
-   = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Default)]`
    |
 LL + #[derive(Default)]
diff --git a/tests/ui/derives/derives-span-Default-tuple-struct.stderr b/tests/ui/derives/derives-span-Default-tuple-struct.stderr
index 1ddb4ec3f64..e786ec1e9da 100644
--- a/tests/ui/derives/derives-span-Default-tuple-struct.stderr
+++ b/tests/ui/derives/derives-span-Default-tuple-struct.stderr
@@ -7,7 +7,6 @@ LL | struct Struct(
 LL |     Error
    |     ^^^^^ the trait `Default` is not implemented for `Error`
    |
-   = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Default)]`
    |
 LL + #[derive(Default)]
diff --git a/tests/ui/derives/derives-span-Eq-enum-struct-variant.stderr b/tests/ui/derives/derives-span-Eq-enum-struct-variant.stderr
index c9edc89e1bc..e0cb3c1b43d 100644
--- a/tests/ui/derives/derives-span-Eq-enum-struct-variant.stderr
+++ b/tests/ui/derives/derives-span-Eq-enum-struct-variant.stderr
@@ -9,7 +9,6 @@ LL |      x: Error
    |
 note: required by a bound in `AssertParamIsEq`
   --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Eq)]`
    |
 LL + #[derive(Eq)]
diff --git a/tests/ui/derives/derives-span-Eq-enum.stderr b/tests/ui/derives/derives-span-Eq-enum.stderr
index 7db13e97111..2f09b9ea385 100644
--- a/tests/ui/derives/derives-span-Eq-enum.stderr
+++ b/tests/ui/derives/derives-span-Eq-enum.stderr
@@ -9,7 +9,6 @@ LL |      Error
    |
 note: required by a bound in `AssertParamIsEq`
   --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Eq)]`
    |
 LL + #[derive(Eq)]
diff --git a/tests/ui/derives/derives-span-Eq-struct.stderr b/tests/ui/derives/derives-span-Eq-struct.stderr
index 36eeb89bde1..c16d9118e10 100644
--- a/tests/ui/derives/derives-span-Eq-struct.stderr
+++ b/tests/ui/derives/derives-span-Eq-struct.stderr
@@ -9,7 +9,6 @@ LL |     x: Error
    |
 note: required by a bound in `AssertParamIsEq`
   --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Eq)]`
    |
 LL + #[derive(Eq)]
diff --git a/tests/ui/derives/derives-span-Eq-tuple-struct.stderr b/tests/ui/derives/derives-span-Eq-tuple-struct.stderr
index 126d1053540..dac295eed91 100644
--- a/tests/ui/derives/derives-span-Eq-tuple-struct.stderr
+++ b/tests/ui/derives/derives-span-Eq-tuple-struct.stderr
@@ -9,7 +9,6 @@ LL |     Error
    |
 note: required by a bound in `AssertParamIsEq`
   --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Eq)]`
    |
 LL + #[derive(Eq)]
diff --git a/tests/ui/derives/derives-span-Hash-enum-struct-variant.stderr b/tests/ui/derives/derives-span-Hash-enum-struct-variant.stderr
index ae973228cac..9854b61d31b 100644
--- a/tests/ui/derives/derives-span-Hash-enum-struct-variant.stderr
+++ b/tests/ui/derives/derives-span-Hash-enum-struct-variant.stderr
@@ -7,7 +7,6 @@ LL | #[derive(Hash)]
 LL |      x: Error
    |      ^^^^^^^^ the trait `Hash` is not implemented for `Error`
    |
-   = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Hash)]`
    |
 LL + #[derive(Hash)]
diff --git a/tests/ui/derives/derives-span-Hash-enum.stderr b/tests/ui/derives/derives-span-Hash-enum.stderr
index 85e26c84fa7..60e7d0cf1ff 100644
--- a/tests/ui/derives/derives-span-Hash-enum.stderr
+++ b/tests/ui/derives/derives-span-Hash-enum.stderr
@@ -7,7 +7,6 @@ LL | #[derive(Hash)]
 LL |      Error
    |      ^^^^^ the trait `Hash` is not implemented for `Error`
    |
-   = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Hash)]`
    |
 LL + #[derive(Hash)]
diff --git a/tests/ui/derives/derives-span-Hash-struct.stderr b/tests/ui/derives/derives-span-Hash-struct.stderr
index f9a654b2df7..3851cf8ce8b 100644
--- a/tests/ui/derives/derives-span-Hash-struct.stderr
+++ b/tests/ui/derives/derives-span-Hash-struct.stderr
@@ -7,7 +7,6 @@ LL | struct Struct {
 LL |     x: Error
    |     ^^^^^^^^ the trait `Hash` is not implemented for `Error`
    |
-   = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Hash)]`
    |
 LL + #[derive(Hash)]
diff --git a/tests/ui/derives/derives-span-Hash-tuple-struct.stderr b/tests/ui/derives/derives-span-Hash-tuple-struct.stderr
index 0a5fbe28658..e5a3e7a5566 100644
--- a/tests/ui/derives/derives-span-Hash-tuple-struct.stderr
+++ b/tests/ui/derives/derives-span-Hash-tuple-struct.stderr
@@ -7,7 +7,6 @@ LL | struct Struct(
 LL |     Error
    |     ^^^^^ the trait `Hash` is not implemented for `Error`
    |
-   = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Hash)]`
    |
 LL + #[derive(Hash)]
diff --git a/tests/ui/derives/derives-span-Ord-enum-struct-variant.stderr b/tests/ui/derives/derives-span-Ord-enum-struct-variant.stderr
index 96ef59ca963..e253a9173fc 100644
--- a/tests/ui/derives/derives-span-Ord-enum-struct-variant.stderr
+++ b/tests/ui/derives/derives-span-Ord-enum-struct-variant.stderr
@@ -7,7 +7,6 @@ LL | #[derive(Ord,Eq,PartialOrd,PartialEq)]
 LL |      x: Error
    |      ^^^^^^^^ the trait `Ord` is not implemented for `Error`
    |
-   = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Ord)]`
    |
 LL + #[derive(Ord)]
diff --git a/tests/ui/derives/derives-span-Ord-enum.stderr b/tests/ui/derives/derives-span-Ord-enum.stderr
index 7c75ecb6432..8a92458b51c 100644
--- a/tests/ui/derives/derives-span-Ord-enum.stderr
+++ b/tests/ui/derives/derives-span-Ord-enum.stderr
@@ -7,7 +7,6 @@ LL | #[derive(Ord,Eq,PartialOrd,PartialEq)]
 LL |      Error
    |      ^^^^^ the trait `Ord` is not implemented for `Error`
    |
-   = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Ord)]`
    |
 LL + #[derive(Ord)]
diff --git a/tests/ui/derives/derives-span-Ord-struct.stderr b/tests/ui/derives/derives-span-Ord-struct.stderr
index 429e7e06f5d..ae110d51196 100644
--- a/tests/ui/derives/derives-span-Ord-struct.stderr
+++ b/tests/ui/derives/derives-span-Ord-struct.stderr
@@ -7,7 +7,6 @@ LL | struct Struct {
 LL |     x: Error
    |     ^^^^^^^^ the trait `Ord` is not implemented for `Error`
    |
-   = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Ord)]`
    |
 LL + #[derive(Ord)]
diff --git a/tests/ui/derives/derives-span-Ord-tuple-struct.stderr b/tests/ui/derives/derives-span-Ord-tuple-struct.stderr
index a46133834c6..e2a6d5266b7 100644
--- a/tests/ui/derives/derives-span-Ord-tuple-struct.stderr
+++ b/tests/ui/derives/derives-span-Ord-tuple-struct.stderr
@@ -7,7 +7,6 @@ LL | struct Struct(
 LL |     Error
    |     ^^^^^ the trait `Ord` is not implemented for `Error`
    |
-   = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Ord)]`
    |
 LL + #[derive(Ord)]
diff --git a/tests/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr b/tests/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr
index e88a523ef4f..09104289c64 100644
--- a/tests/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr
+++ b/tests/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr
@@ -12,7 +12,6 @@ note: an implementation of `PartialEq` might be missing for `Error`
    |
 LL | struct Error;
    | ^^^^^^^^^^^^ must implement `PartialEq`
-   = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(PartialEq)]`
    |
 LL + #[derive(PartialEq)]
diff --git a/tests/ui/derives/derives-span-PartialEq-enum.stderr b/tests/ui/derives/derives-span-PartialEq-enum.stderr
index 80b225446b4..40dca92ef23 100644
--- a/tests/ui/derives/derives-span-PartialEq-enum.stderr
+++ b/tests/ui/derives/derives-span-PartialEq-enum.stderr
@@ -12,7 +12,6 @@ note: an implementation of `PartialEq` might be missing for `Error`
    |
 LL | struct Error;
    | ^^^^^^^^^^^^ must implement `PartialEq`
-   = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(PartialEq)]`
    |
 LL + #[derive(PartialEq)]
diff --git a/tests/ui/derives/derives-span-PartialEq-struct.stderr b/tests/ui/derives/derives-span-PartialEq-struct.stderr
index d7fc3da46e0..cfd9fc41d06 100644
--- a/tests/ui/derives/derives-span-PartialEq-struct.stderr
+++ b/tests/ui/derives/derives-span-PartialEq-struct.stderr
@@ -12,7 +12,6 @@ note: an implementation of `PartialEq` might be missing for `Error`
    |
 LL | struct Error;
    | ^^^^^^^^^^^^ must implement `PartialEq`
-   = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(PartialEq)]`
    |
 LL + #[derive(PartialEq)]
diff --git a/tests/ui/derives/derives-span-PartialEq-tuple-struct.stderr b/tests/ui/derives/derives-span-PartialEq-tuple-struct.stderr
index ea3920f406c..4e35cbb534d 100644
--- a/tests/ui/derives/derives-span-PartialEq-tuple-struct.stderr
+++ b/tests/ui/derives/derives-span-PartialEq-tuple-struct.stderr
@@ -12,7 +12,6 @@ note: an implementation of `PartialEq` might be missing for `Error`
    |
 LL | struct Error;
    | ^^^^^^^^^^^^ must implement `PartialEq`
-   = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(PartialEq)]`
    |
 LL + #[derive(PartialEq)]
diff --git a/tests/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr b/tests/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr
index 3f83eb56aaf..7fe09d45cc1 100644
--- a/tests/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr
+++ b/tests/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr
@@ -8,7 +8,6 @@ LL |      x: Error
    |      ^^^^^^^^ no implementation for `Error < Error` and `Error > Error`
    |
    = help: the trait `PartialOrd` is not implemented for `Error`
-   = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(PartialOrd)]`
    |
 LL + #[derive(PartialOrd)]
diff --git a/tests/ui/derives/derives-span-PartialOrd-enum.stderr b/tests/ui/derives/derives-span-PartialOrd-enum.stderr
index cf5915173c5..2a14e6e9618 100644
--- a/tests/ui/derives/derives-span-PartialOrd-enum.stderr
+++ b/tests/ui/derives/derives-span-PartialOrd-enum.stderr
@@ -8,7 +8,6 @@ LL |      Error
    |      ^^^^^ no implementation for `Error < Error` and `Error > Error`
    |
    = help: the trait `PartialOrd` is not implemented for `Error`
-   = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(PartialOrd)]`
    |
 LL + #[derive(PartialOrd)]
diff --git a/tests/ui/derives/derives-span-PartialOrd-struct.stderr b/tests/ui/derives/derives-span-PartialOrd-struct.stderr
index de21a903b6c..0904e3ace8f 100644
--- a/tests/ui/derives/derives-span-PartialOrd-struct.stderr
+++ b/tests/ui/derives/derives-span-PartialOrd-struct.stderr
@@ -8,7 +8,6 @@ LL |     x: Error
    |     ^^^^^^^^ no implementation for `Error < Error` and `Error > Error`
    |
    = help: the trait `PartialOrd` is not implemented for `Error`
-   = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(PartialOrd)]`
    |
 LL + #[derive(PartialOrd)]
diff --git a/tests/ui/derives/derives-span-PartialOrd-tuple-struct.stderr b/tests/ui/derives/derives-span-PartialOrd-tuple-struct.stderr
index 3050aeecc0d..501fea02e8e 100644
--- a/tests/ui/derives/derives-span-PartialOrd-tuple-struct.stderr
+++ b/tests/ui/derives/derives-span-PartialOrd-tuple-struct.stderr
@@ -8,7 +8,6 @@ LL |     Error
    |     ^^^^^ no implementation for `Error < Error` and `Error > Error`
    |
    = help: the trait `PartialOrd` is not implemented for `Error`
-   = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(PartialOrd)]`
    |
 LL + #[derive(PartialOrd)]
diff --git a/tests/ui/derives/deriving-copyclone.stderr b/tests/ui/derives/deriving-copyclone.stderr
index c0c2215c04a..befff880280 100644
--- a/tests/ui/derives/deriving-copyclone.stderr
+++ b/tests/ui/derives/deriving-copyclone.stderr
@@ -16,7 +16,6 @@ note: required by a bound in `is_copy`
    |
 LL | fn is_copy<T: Copy>(_: T) {}
    |               ^^^^ required by this bound in `is_copy`
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider borrowing here
    |
 LL |     is_copy(B { a: 1, b: &C });
@@ -40,7 +39,6 @@ note: required by a bound in `is_clone`
    |
 LL | fn is_clone<T: Clone>(_: T) {}
    |                ^^^^^ required by this bound in `is_clone`
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider borrowing here
    |
 LL |     is_clone(B { a: 1, b: &C });
@@ -64,7 +62,6 @@ note: required by a bound in `is_copy`
    |
 LL | fn is_copy<T: Copy>(_: T) {}
    |               ^^^^ required by this bound in `is_copy`
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider borrowing here
    |
 LL |     is_copy(B { a: 1, b: &D });
diff --git a/tests/ui/derives/deriving-no-inner-impl-error-message.stderr b/tests/ui/derives/deriving-no-inner-impl-error-message.stderr
index ab99ba9fab5..294f700d9de 100644
--- a/tests/ui/derives/deriving-no-inner-impl-error-message.stderr
+++ b/tests/ui/derives/deriving-no-inner-impl-error-message.stderr
@@ -12,7 +12,6 @@ note: an implementation of `PartialEq` might be missing for `NoCloneOrEq`
    |
 LL | struct NoCloneOrEq;
    | ^^^^^^^^^^^^^^^^^^ must implement `PartialEq`
-   = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `NoCloneOrEq` with `#[derive(PartialEq)]`
    |
 LL + #[derive(PartialEq)]
@@ -28,7 +27,6 @@ LL | struct C {
 LL |     x: NoCloneOrEq
    |     ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `NoCloneOrEq`
    |
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `NoCloneOrEq` with `#[derive(Clone)]`
    |
 LL + #[derive(Clone)]
diff --git a/tests/ui/derives/deriving-with-repr-packed-move-errors.stderr b/tests/ui/derives/deriving-with-repr-packed-move-errors.stderr
index 2de4ee4eabd..68c3c8ae9ea 100644
--- a/tests/ui/derives/deriving-with-repr-packed-move-errors.stderr
+++ b/tests/ui/derives/deriving-with-repr-packed-move-errors.stderr
@@ -7,7 +7,6 @@ LL | struct StructA(String);
    |                ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
    |
    = note: `#[derive(Debug)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider cloning the value if the performance cost is acceptable
    |
 LL | struct StructA(String.clone());
@@ -22,7 +21,6 @@ LL | struct StructA(String);
    |                ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
    |
    = note: `#[derive(PartialEq)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
-   = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider cloning the value if the performance cost is acceptable
    |
 LL | struct StructA(String.clone());
@@ -37,7 +35,6 @@ LL | struct StructA(String);
    |                ^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
    |
    = note: `#[derive(PartialEq)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
-   = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider cloning the value if the performance cost is acceptable
    |
 LL | struct StructA(String.clone());
@@ -52,7 +49,6 @@ LL | struct StructA(String);
    |                ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
    |
    = note: `#[derive(PartialOrd)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
-   = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider cloning the value if the performance cost is acceptable
    |
 LL | struct StructA(String.clone());
@@ -67,7 +63,6 @@ LL | struct StructA(String);
    |                ^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
    |
    = note: `#[derive(PartialOrd)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
-   = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider cloning the value if the performance cost is acceptable
    |
 LL | struct StructA(String.clone());
@@ -82,7 +77,6 @@ LL | struct StructA(String);
    |                ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
    |
    = note: `#[derive(Ord)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
-   = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider cloning the value if the performance cost is acceptable
    |
 LL | struct StructA(String.clone());
@@ -97,7 +91,6 @@ LL | struct StructA(String);
    |                ^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
    |
    = note: `#[derive(Ord)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
-   = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider cloning the value if the performance cost is acceptable
    |
 LL | struct StructA(String.clone());
@@ -112,7 +105,6 @@ LL | struct StructA(String);
    |                ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
    |
    = note: `#[derive(Hash)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
-   = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider cloning the value if the performance cost is acceptable
    |
 LL | struct StructA(String.clone());
@@ -127,7 +119,6 @@ LL | struct StructA(String);
    |                ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
    |
    = note: `#[derive(Clone)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider cloning the value if the performance cost is acceptable
    |
 LL | struct StructA(String.clone());
diff --git a/tests/ui/derives/deriving-with-repr-packed.stderr b/tests/ui/derives/deriving-with-repr-packed.stderr
index 321ffb27eeb..5117f8d1112 100644
--- a/tests/ui/derives/deriving-with-repr-packed.stderr
+++ b/tests/ui/derives/deriving-with-repr-packed.stderr
@@ -16,7 +16,6 @@ LL | struct Y(usize);
 LL | struct X(Y);
    |          - you could clone this value
    = note: `#[derive(Debug)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0161]: cannot move a value of type `[u8]`
   --> $DIR/deriving-with-repr-packed.rs:29:5
@@ -34,7 +33,6 @@ LL |     data: [u8],
    |     ^^^^^^^^^^ move occurs because `self.data` has type `[u8]`, which does not implement the `Copy` trait
    |
    = note: `#[derive(Debug)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0161]: cannot move a value of type `str`
   --> $DIR/deriving-with-repr-packed.rs:38:5
@@ -52,7 +50,6 @@ LL |     data: str,
    |     ^^^^^^^^^ move occurs because `self.data` has type `str`, which does not implement the `Copy` trait
    |
    = note: `#[derive(Debug)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 5 previous errors
 
diff --git a/tests/ui/derives/duplicate-derive-copy-clone-diagnostics.stderr b/tests/ui/derives/duplicate-derive-copy-clone-diagnostics.stderr
index f8e1db33f53..b9eb6194f6c 100644
--- a/tests/ui/derives/duplicate-derive-copy-clone-diagnostics.stderr
+++ b/tests/ui/derives/duplicate-derive-copy-clone-diagnostics.stderr
@@ -5,8 +5,6 @@ LL | #[derive(Copy, Clone)]
    |          ---- first implementation here
 LL | #[derive(Copy, Clone)]
    |          ^^^^ conflicting implementation for `E`
-   |
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0119]: conflicting implementations of trait `Clone` for type `E`
   --> $DIR/duplicate-derive-copy-clone-diagnostics.rs:6:16
@@ -15,8 +13,6 @@ LL | #[derive(Copy, Clone)]
    |                ----- first implementation here
 LL | #[derive(Copy, Clone)]
    |                ^^^^^ conflicting implementation for `E`
-   |
-   = 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
 
diff --git a/tests/ui/derives/issue-97343.stderr b/tests/ui/derives/issue-97343.stderr
index efb2fb70f5a..27691f57188 100644
--- a/tests/ui/derives/issue-97343.stderr
+++ b/tests/ui/derives/issue-97343.stderr
@@ -14,7 +14,6 @@ note: type parameter `Irrelevant` defined here
    |
 LL | pub struct Irrelevant<Irrelevant> {
    |                       ^^^^^^^^^^
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/deriving/deriving-coerce-pointee-neg.stderr b/tests/ui/deriving/deriving-coerce-pointee-neg.stderr
index d3d73132078..6c6e6312875 100644
--- a/tests/ui/deriving/deriving-coerce-pointee-neg.stderr
+++ b/tests/ui/deriving/deriving-coerce-pointee-neg.stderr
@@ -3,40 +3,30 @@ error[E0802]: `CoercePointee` can only be derived on `struct`s with `#[repr(tran
    |
 LL | #[derive(CoercePointee)]
    |          ^^^^^^^^^^^^^
-   |
-   = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0802]: `CoercePointee` can only be derived on `struct`s with at least one field
   --> $DIR/deriving-coerce-pointee-neg.rs:15:10
    |
 LL | #[derive(CoercePointee)]
    |          ^^^^^^^^^^^^^
-   |
-   = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0802]: `CoercePointee` can only be derived on `struct`s with at least one field
   --> $DIR/deriving-coerce-pointee-neg.rs:22:10
    |
 LL | #[derive(CoercePointee)]
    |          ^^^^^^^^^^^^^
-   |
-   = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0802]: `CoercePointee` can only be derived on `struct`s that are generic over at least one type
   --> $DIR/deriving-coerce-pointee-neg.rs:29:10
    |
 LL | #[derive(CoercePointee)]
    |          ^^^^^^^^^^^^^
-   |
-   = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0802]: exactly one generic type parameter must be marked as `#[pointee]` to derive `CoercePointee` traits
   --> $DIR/deriving-coerce-pointee-neg.rs:34:10
    |
 LL | #[derive(CoercePointee)]
    |          ^^^^^^^^^^^^^
-   |
-   = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0802]: only one type parameter can be marked as `#[pointee]` when deriving `CoercePointee` traits
   --> $DIR/deriving-coerce-pointee-neg.rs:43:39
@@ -126,8 +116,6 @@ LL | #[derive(CoercePointee)]
 ...
 LL |     inner: std::rc::Rc<(i32, Box<T>)>,
    |     --------------------------------- `Rc<(i32, Box<T>)>` must be a pointer, reference, or smart pointer that is allowed to be unsized
-   |
-   = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0375]: implementing `CoerceUnsized` does not allow multiple fields to be coerced
   --> $DIR/deriving-coerce-pointee-neg.rs:153:10
@@ -142,7 +130,6 @@ LL |     inner1: Box<T>,
    |     ^^^^^^^^^^^^^^
 LL |     inner2: Box<T>,
    |     ^^^^^^^^^^^^^^
-   = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: for `UsingNonCoercePointeeData<T>` to have a valid implementation of `CoerceUnsized`, it must be possible to coerce the field of type `NotCoercePointeeData<T>`
   --> $DIR/deriving-coerce-pointee-neg.rs:164:10
@@ -152,8 +139,6 @@ LL | #[derive(CoercePointee)]
 LL |
 LL | struct UsingNonCoercePointeeData<T: ?Sized>(NotCoercePointeeData<T>);
    |                                             ----------------------- `NotCoercePointeeData<T>` must be a pointer, reference, or smart pointer that is allowed to be unsized
-   |
-   = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0690]: transparent struct needs at most one field with non-trivial size or alignment, but has 2
   --> $DIR/deriving-coerce-pointee-neg.rs:155:1
diff --git a/tests/ui/deriving/do-not-suggest-calling-fn-in-derive-macro.stderr b/tests/ui/deriving/do-not-suggest-calling-fn-in-derive-macro.stderr
index 40464a49c34..af78f645463 100644
--- a/tests/ui/deriving/do-not-suggest-calling-fn-in-derive-macro.stderr
+++ b/tests/ui/deriving/do-not-suggest-calling-fn-in-derive-macro.stderr
@@ -6,8 +6,6 @@ LL | #[derive(PartialEq)]
 LL | pub struct Function {
 LL |     callback: Rc<dyn Fn()>,
    |     ^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/deriving/issue-103157.stderr b/tests/ui/deriving/issue-103157.stderr
index 9754b0289c0..51d4d0a8974 100644
--- a/tests/ui/deriving/issue-103157.stderr
+++ b/tests/ui/deriving/issue-103157.stderr
@@ -20,7 +20,6 @@ LL |     Float(Option<f64>),
    = note: required for `Option<f64>` to implement `Eq`
 note: required by a bound in `AssertParamIsEq`
   --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/deriving/multiple-defaults.stderr b/tests/ui/deriving/multiple-defaults.stderr
index 05fb6fecffa..a662ed248fe 100644
--- a/tests/ui/deriving/multiple-defaults.stderr
+++ b/tests/ui/deriving/multiple-defaults.stderr
@@ -11,7 +11,6 @@ LL |     B,
    |     - additional default
    |
    = note: only one variant can be default
-   = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: multiple declared defaults
   --> $DIR/multiple-defaults.rs:18:10
@@ -26,7 +25,6 @@ LL |     A,
    |     - additional default
    |
    = note: only one variant can be default
-   = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0428]: the name `A` is defined multiple times
   --> $DIR/multiple-defaults.rs:23:5
diff --git a/tests/ui/diagnostic-flags/allow-non-lint-warnings.rs b/tests/ui/diagnostic-flags/allow-non-lint-warnings.rs
index 8980ef9c422..f928e112289 100644
--- a/tests/ui/diagnostic-flags/allow-non-lint-warnings.rs
+++ b/tests/ui/diagnostic-flags/allow-non-lint-warnings.rs
@@ -13,14 +13,16 @@
 //! - Original impl PR: <https://github.com/rust-lang/rust/pull/21248>.
 //! - RFC 507 "Release channels":
 //!   <https://github.com/rust-lang/rfcs/blob/c017755b9bfa0421570d92ba38082302e0f3ad4f/text/0507-release-channels.md>.
-#![feature(rustc_attrs)]
 
 //@ revisions: without_flag with_flag
 
+//@ check-pass
+//@ compile-flags: -Zunleash-the-miri-inside-of-you
 //@[with_flag] compile-flags: -Awarnings
 
-//@ check-pass
+fn non_constant() {}
+const fn constant() { non_constant() }
 
-#[rustc_error(warn)]
 fn main() {}
-//[without_flag]~^ WARN unexpected annotation used with `#[rustc_error(...)]`!
+
+//[without_flag]~? WARN skipping const checks
diff --git a/tests/ui/diagnostic-flags/allow-non-lint-warnings.without_flag.stderr b/tests/ui/diagnostic-flags/allow-non-lint-warnings.without_flag.stderr
index 3f33ccbd1c9..08ae11fc18a 100644
--- a/tests/ui/diagnostic-flags/allow-non-lint-warnings.without_flag.stderr
+++ b/tests/ui/diagnostic-flags/allow-non-lint-warnings.without_flag.stderr
@@ -1,8 +1,10 @@
-warning: unexpected annotation used with `#[rustc_error(...)]`!
-  --> $DIR/allow-non-lint-warnings.rs:25:1
+warning: skipping const checks
    |
-LL | fn main() {}
-   | ^^^^^^^^^
+help: skipping check that does not even have a feature gate
+  --> $DIR/allow-non-lint-warnings.rs:24:23
+   |
+LL | const fn constant() { non_constant() }
+   |                       ^^^^^^^^^^^^^^
 
 warning: 1 warning emitted
 
diff --git a/tests/ui/diagnostic-width/tabs-trimming.stderr b/tests/ui/diagnostic-width/tabs-trimming.stderr
index a896345bd70..e0d1c2d95a9 100644
--- a/tests/ui/diagnostic-width/tabs-trimming.stderr
+++ b/tests/ui/diagnostic-width/tabs-trimming.stderr
@@ -15,8 +15,6 @@ LL | ...                     v @ 1 | 2 | 3 => panic!("You gave me too little mon
    |                         |
    |                         binding initialized here in some conditions
    |                         binding declared here but left uninitialized
-   |
-   = note: this error originates in the macro `$crate::const_format_args` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/diagnostic_namespace/suggest_typos.rs b/tests/ui/diagnostic_namespace/suggest_typos.rs
index 6fa4f800462..8d1dc6f59da 100644
--- a/tests/ui/diagnostic_namespace/suggest_typos.rs
+++ b/tests/ui/diagnostic_namespace/suggest_typos.rs
@@ -16,4 +16,9 @@ trait Y{}
 //~^^HELP an attribute with a similar name exists
 trait Z{}
 
+#[diagnostic::dont_recommend]
+//~^ERROR unknown diagnostic attribute
+//~^^HELP an attribute with a similar name exists
+impl X for u8 {}
+
 fn main(){}
diff --git a/tests/ui/diagnostic_namespace/suggest_typos.stderr b/tests/ui/diagnostic_namespace/suggest_typos.stderr
index 86d778c6ec0..1f19fd4bbcf 100644
--- a/tests/ui/diagnostic_namespace/suggest_typos.stderr
+++ b/tests/ui/diagnostic_namespace/suggest_typos.stderr
@@ -37,5 +37,17 @@ help: an attribute with a similar name exists
 LL | #[diagnostic::on_unimplemented]
    |                  ++
 
-error: aborting due to 3 previous errors
+error: unknown diagnostic attribute
+  --> $DIR/suggest_typos.rs:19:15
+   |
+LL | #[diagnostic::dont_recommend]
+   |               ^^^^^^^^^^^^^^
+   |
+help: an attribute with a similar name exists
+   |
+LL - #[diagnostic::dont_recommend]
+LL + #[diagnostic::do_not_recommend]
+   |
+
+error: aborting due to 4 previous errors
 
diff --git a/tests/ui/did_you_mean/recursion_limit_deref.rs b/tests/ui/did_you_mean/recursion_limit_deref.rs
index af4c4ddda69..e53007388af 100644
--- a/tests/ui/did_you_mean/recursion_limit_deref.rs
+++ b/tests/ui/did_you_mean/recursion_limit_deref.rs
@@ -51,3 +51,6 @@ fn main() {
     let x: &Bottom = &t; //~ ERROR mismatched types
     //~^ error recursion limit
 }
+
+//~? ERROR reached the recursion limit finding the struct tail for `K`
+//~? ERROR reached the recursion limit finding the struct tail for `Bottom`
diff --git a/tests/ui/drop/drop_elaboration_with_errors.rs b/tests/ui/drop/drop_elaboration_with_errors.rs
index 35d05e6cf64..6b686e49d45 100644
--- a/tests/ui/drop/drop_elaboration_with_errors.rs
+++ b/tests/ui/drop/drop_elaboration_with_errors.rs
@@ -10,6 +10,7 @@ struct Foo {
 
 type Tait = impl Sized;
 
+#[define_opaque(Tait)]
 fn ice_cold(beverage: Tait) {
     let Foo { field } = beverage;
     _ = field;
diff --git a/tests/ui/drop/drop_elaboration_with_errors.stderr b/tests/ui/drop/drop_elaboration_with_errors.stderr
index bec229631e1..ea2c9b949e4 100644
--- a/tests/ui/drop/drop_elaboration_with_errors.stderr
+++ b/tests/ui/drop/drop_elaboration_with_errors.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/drop_elaboration_with_errors.rs:19:5
+  --> $DIR/drop_elaboration_with_errors.rs:20:5
    |
 LL | fn main() {
    |          - expected `()` because of default return type
diff --git a/tests/ui/dupe-first-attr.rs b/tests/ui/dupe-first-attr.rs
deleted file mode 100644
index c254df050c1..00000000000
--- a/tests/ui/dupe-first-attr.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-//@ run-pass
-
-// Regression test for a problem with the first mod attribute
-// being applied to every mod
-
-
-#[cfg(target_os = "linux")]
-mod hello {}
-
-#[cfg(target_os = "macos")]
-mod hello {}
-
-#[cfg(target_os = "windows")]
-mod hello {}
-
-#[cfg(target_os = "freebsd")]
-mod hello {}
-
-#[cfg(target_os = "dragonfly")]
-mod hello {}
-
-#[cfg(target_os = "android")]
-mod hello {}
-
-fn main() {}
diff --git a/tests/ui/duplicate_entry_error.rs b/tests/ui/duplicate_entry_error.rs
deleted file mode 100644
index 5a25802c6e7..00000000000
--- a/tests/ui/duplicate_entry_error.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-//@ normalize-stderr: "loaded from .*libstd-.*.rlib" -> "loaded from SYSROOT/libstd-*.rlib"
-// note-pattern: first defined in crate `std`.
-
-// Test for issue #31788 and E0152
-
-#![feature(lang_items)]
-
-extern crate core;
-
-use core::panic::PanicInfo;
-
-#[lang = "panic_impl"]
-fn panic_impl(info: &PanicInfo) -> ! {
-//~^ ERROR: found duplicate lang item `panic_impl`
-    loop {}
-}
-
-fn main() {}
diff --git a/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.new.stderr b/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.new.stderr
index 87207d607e2..4c4cb45293f 100644
--- a/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.new.stderr
+++ b/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.new.stderr
@@ -4,7 +4,7 @@ error[E0782]: expected a type, found a trait
 LL | fn id<F>(f: Copy) -> usize {
    |             ^^^^
    |
-   = note: `Copy` it is dyn-incompatible, so it can't be `dyn`
+   = note: `Copy` is dyn-incompatible, otherwise a trait object could be used
 help: use a new generic type parameter, constrained by `Copy`
    |
 LL - fn id<F>(f: Copy) -> usize {
diff --git a/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.new.stderr b/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.new.stderr
index 6075e313f4e..d3208d07e91 100644
--- a/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.new.stderr
+++ b/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.new.stderr
@@ -4,7 +4,7 @@ error[E0782]: expected a type, found a trait
 LL | trait A { fn g(b: B) -> B; }
    |                   ^
    |
-   = note: `B` it is dyn-incompatible, so it can't be `dyn`
+   = note: `B` is dyn-incompatible, otherwise a trait object could be used
 help: use a new generic type parameter, constrained by `B`
    |
 LL - trait A { fn g(b: B) -> B; }
@@ -32,7 +32,7 @@ error[E0782]: expected a type, found a trait
 LL | trait B { fn f(a: A) -> A; }
    |                   ^
    |
-   = note: `A` it is dyn-incompatible, so it can't be `dyn`
+   = note: `A` is dyn-incompatible, otherwise a trait object could be used
 help: use a new generic type parameter, constrained by `A`
    |
 LL - trait B { fn f(a: A) -> A; }
diff --git a/tests/ui/editions/edition-keywords-2018-2015-parsing.rs b/tests/ui/editions/edition-keywords-2018-2015-parsing.rs
index c3dfcfb19cb..f8d2755b9d7 100644
--- a/tests/ui/editions/edition-keywords-2018-2015-parsing.rs
+++ b/tests/ui/editions/edition-keywords-2018-2015-parsing.rs
@@ -28,3 +28,5 @@ pub fn check_async() {
 
     let _recovery_witness: () = 0; //~ ERROR mismatched types
 }
+
+//~? ERROR macro expansion ends with an incomplete expression
diff --git a/tests/ui/editions/edition-keywords-2018-2018-parsing.rs b/tests/ui/editions/edition-keywords-2018-2018-parsing.rs
index 1447c49ef71..f4438472a0e 100644
--- a/tests/ui/editions/edition-keywords-2018-2018-parsing.rs
+++ b/tests/ui/editions/edition-keywords-2018-2018-parsing.rs
@@ -39,3 +39,5 @@ pub fn check_async() {
 
     let _recovery_witness: () = 0; //~ ERROR mismatched types
 }
+
+//~? ERROR macro expansion ends with an incomplete expression
diff --git a/tests/ui/entry-point/imported_main_const_fn_item_type_forbidden.rs b/tests/ui/entry-point/imported_main_const_fn_item_type_forbidden.rs
index d0be240e07b..4e6be341ef0 100644
--- a/tests/ui/entry-point/imported_main_const_fn_item_type_forbidden.rs
+++ b/tests/ui/entry-point/imported_main_const_fn_item_type_forbidden.rs
@@ -4,7 +4,11 @@ pub mod foo {
     type MainFn = impl Fn();
 
     fn bar() {}
-    pub const BAR: MainFn = bar;
+    #[define_opaque(MainFn)]
+    const fn def() -> MainFn {
+        bar
+    }
+    pub const BAR: MainFn = def();
 }
 
 use foo::BAR as main; //~ ERROR `main` function not found in crate
diff --git a/tests/ui/entry-point/imported_main_const_fn_item_type_forbidden.stderr b/tests/ui/entry-point/imported_main_const_fn_item_type_forbidden.stderr
index 50e4cd7d39f..375b3a53030 100644
--- a/tests/ui/entry-point/imported_main_const_fn_item_type_forbidden.stderr
+++ b/tests/ui/entry-point/imported_main_const_fn_item_type_forbidden.stderr
@@ -1,5 +1,5 @@
 error[E0601]: `main` function not found in crate `imported_main_const_fn_item_type_forbidden`
-  --> $DIR/imported_main_const_fn_item_type_forbidden.rs:10:22
+  --> $DIR/imported_main_const_fn_item_type_forbidden.rs:14:22
    |
 LL | use foo::BAR as main;
    |     ---------------- ^ consider adding a `main` function to `$DIR/imported_main_const_fn_item_type_forbidden.rs`
diff --git a/tests/ui/entry-point/imported_main_from_extern_crate_wrong_type.rs b/tests/ui/entry-point/imported_main_from_extern_crate_wrong_type.rs
index d8ae12d200f..0b527baaafe 100644
--- a/tests/ui/entry-point/imported_main_from_extern_crate_wrong_type.rs
+++ b/tests/ui/entry-point/imported_main_from_extern_crate_wrong_type.rs
@@ -2,3 +2,5 @@
 
 extern crate bad_main_functions;
 pub use bad_main_functions::boilerplate as main;
+
+//~? ERROR `main` function has wrong type
diff --git a/tests/ui/env-macro/env-escaped-var.stderr b/tests/ui/env-macro/env-escaped-var.stderr
index 53a2ead6742..65d53a7fa1f 100644
--- a/tests/ui/env-macro/env-escaped-var.stderr
+++ b/tests/ui/env-macro/env-escaped-var.stderr
@@ -5,7 +5,6 @@ LL |     env!("\t");
    |     ^^^^^^^^^^
    |
    = help: use `std::env::var("\t")` to read the variable at run time
-   = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/env-macro/env-not-defined-custom.stderr b/tests/ui/env-macro/env-not-defined-custom.stderr
index 70c41bcc52e..638f261e48e 100644
--- a/tests/ui/env-macro/env-not-defined-custom.stderr
+++ b/tests/ui/env-macro/env-not-defined-custom.stderr
@@ -3,8 +3,6 @@ error: my error message
    |
 LL | fn main() { env!("__HOPEFULLY_NOT_DEFINED__", "my error message"); }
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/env-macro/env-not-defined-default.stderr b/tests/ui/env-macro/env-not-defined-default.stderr
index efd7fdb4e53..77ba00e45c1 100644
--- a/tests/ui/env-macro/env-not-defined-default.stderr
+++ b/tests/ui/env-macro/env-not-defined-default.stderr
@@ -5,7 +5,6 @@ LL |     env!("CARGO__HOPEFULLY_NOT_DEFINED__");
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: Cargo sets build script variables at run time. Use `std::env::var("CARGO__HOPEFULLY_NOT_DEFINED__")` instead
-   = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/env-macro/error-recovery-issue-55897.stderr b/tests/ui/env-macro/error-recovery-issue-55897.stderr
index f1cacf5420e..3d9ef56c502 100644
--- a/tests/ui/env-macro/error-recovery-issue-55897.stderr
+++ b/tests/ui/env-macro/error-recovery-issue-55897.stderr
@@ -5,7 +5,6 @@ LL |     include!(concat!(env!("NON_EXISTENT"), "/data.rs"));
    |                      ^^^^^^^^^^^^^^^^^^^^
    |
    = help: use `std::env::var("NON_EXISTENT")` to read the variable at run time
-   = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: suffixes on string literals are invalid
   --> $DIR/error-recovery-issue-55897.rs:15:22
diff --git a/tests/ui/env-macro/name-whitespace-issue-110547.stderr b/tests/ui/env-macro/name-whitespace-issue-110547.stderr
index 5f34904d4ae..f29c5dbf8d1 100644
--- a/tests/ui/env-macro/name-whitespace-issue-110547.stderr
+++ b/tests/ui/env-macro/name-whitespace-issue-110547.stderr
@@ -5,7 +5,6 @@ LL |     env!{"\t"};
    |     ^^^^^^^^^^
    |
    = help: use `std::env::var("\t")` to read the variable at run time
-   = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: environment variable `\t` not defined at compile time
   --> $DIR/name-whitespace-issue-110547.rs:5:5
@@ -14,7 +13,6 @@ LL |     env!("\t");
    |     ^^^^^^^^^^
    |
    = help: use `std::env::var("\t")` to read the variable at run time
-   = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: environment variable `\u{2069}` not defined at compile time
   --> $DIR/name-whitespace-issue-110547.rs:6:5
@@ -23,7 +21,6 @@ LL |     env!("\u{2069}");
    |     ^^^^^^^^^^^^^^^^
    |
    = help: use `std::env::var("\u{2069}")` to read the variable at run time
-   = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/error-codes/E0128.stderr b/tests/ui/error-codes/E0128.stderr
index c1ccb4c9e74..22f1e200e29 100644
--- a/tests/ui/error-codes/E0128.stderr
+++ b/tests/ui/error-codes/E0128.stderr
@@ -1,8 +1,8 @@
-error[E0128]: generic parameters with a default cannot use forward declared identifiers
+error[E0128]: generic parameter defaults cannot reference parameters before they are declared
   --> $DIR/E0128.rs:1:14
    |
 LL | struct Foo<T=U, U=()> {
-   |              ^ defaulted generic parameters cannot be forward declared
+   |              ^ cannot reference `U` before it is declared
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/error-codes/E0152-duplicate-lang-items.rs b/tests/ui/error-codes/E0152-duplicate-lang-items.rs
new file mode 100644
index 00000000000..089810b1ad2
--- /dev/null
+++ b/tests/ui/error-codes/E0152-duplicate-lang-items.rs
@@ -0,0 +1,20 @@
+//! Validates the correct printing of E0152 in the case of duplicate "lang_item" function
+//! definitions.
+//!
+//! Issue: <https://github.com/rust-lang/rust/issues/31788>
+
+//@ error-pattern: first defined in crate `std`
+//@ normalize-stderr: "loaded from .*libstd-.*.rlib" -> "loaded from SYSROOT/libstd-*.rlib"
+#![feature(lang_items)]
+
+extern crate core;
+
+use core::panic::PanicInfo;
+
+#[lang = "panic_impl"]
+fn panic_impl(info: &PanicInfo) -> ! {
+    //~^ ERROR: found duplicate lang item `panic_impl`
+    loop {}
+}
+
+fn main() {}
diff --git a/tests/ui/duplicate_entry_error.stderr b/tests/ui/error-codes/E0152-duplicate-lang-items.stderr
index 958e9c7527d..3c3d64322f3 100644
--- a/tests/ui/duplicate_entry_error.stderr
+++ b/tests/ui/error-codes/E0152-duplicate-lang-items.stderr
@@ -1,5 +1,5 @@
 error[E0152]: found duplicate lang item `panic_impl`
-  --> $DIR/duplicate_entry_error.rs:13:1
+  --> $DIR/E0152-duplicate-lang-items.rs:15:1
    |
 LL | / fn panic_impl(info: &PanicInfo) -> ! {
 LL | |
@@ -7,9 +7,9 @@ LL | |     loop {}
 LL | | }
    | |_^
    |
-   = note: the lang item is first defined in crate `std` (which `duplicate_entry_error` depends on)
+   = note: the lang item is first defined in crate `std` (which `E0152_duplicate_lang_items` depends on)
    = note: first definition in `std` loaded from SYSROOT/libstd-*.rlib
-   = note: second definition in the local crate (`duplicate_entry_error`)
+   = note: second definition in the local crate (`E0152_duplicate_lang_items`)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/error-codes/E0184.stderr b/tests/ui/error-codes/E0184.stderr
index 625c6685a61..1a7df9ac095 100644
--- a/tests/ui/error-codes/E0184.stderr
+++ b/tests/ui/error-codes/E0184.stderr
@@ -3,8 +3,6 @@ error[E0184]: the trait `Copy` cannot be implemented for this type; the type has
    |
 LL | #[derive(Copy)]
    |          ^^^^ `Copy` not allowed on types with destructors
-   |
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/duplicate-label-E0381-issue-129274.rs b/tests/ui/error-codes/E0381-duplicated-label.rs
index b2156e630c8..84a85caa65d 100644
--- a/tests/ui/duplicate-label-E0381-issue-129274.rs
+++ b/tests/ui/error-codes/E0381-duplicated-label.rs
@@ -1,3 +1,6 @@
+//! Regression test for duplicated label in E0381 error message.
+//!
+//! Issue: <https://github.com/rust-lang/rust/issues/129274>
 fn main() {
     fn test() {
         loop {
diff --git a/tests/ui/duplicate-label-E0381-issue-129274.stderr b/tests/ui/error-codes/E0381-duplicated-label.stderr
index 7f8bddb17c5..36e6d966f09 100644
--- a/tests/ui/duplicate-label-E0381-issue-129274.stderr
+++ b/tests/ui/error-codes/E0381-duplicated-label.stderr
@@ -1,5 +1,5 @@
 error[E0381]: used binding `blah` is possibly-uninitialized
-  --> $DIR/duplicate-label-E0381-issue-129274.rs:8:33
+  --> $DIR/E0381-duplicated-label.rs:11:33
    |
 LL |             let blah: Option<String>;
    |                 ---- binding declared here but left uninitialized
diff --git a/tests/ui/errors/wrong-target-spec.rs b/tests/ui/errors/wrong-target-spec.rs
index bc9038c1fab..9b31c943e3e 100644
--- a/tests/ui/errors/wrong-target-spec.rs
+++ b/tests/ui/errors/wrong-target-spec.rs
@@ -6,3 +6,5 @@
 //@ compile-flags: --target x86_64_unknown-linux-musl
 
 fn main() {}
+
+//~? ERROR Error loading target specification: Could not find specification for target "x86_64_unknown-linux-musl"
diff --git a/tests/ui/exclusive-drop-and-copy.stderr b/tests/ui/exclusive-drop-and-copy.stderr
index 546079422a7..340ca89c396 100644
--- a/tests/ui/exclusive-drop-and-copy.stderr
+++ b/tests/ui/exclusive-drop-and-copy.stderr
@@ -3,16 +3,12 @@ error[E0184]: the trait `Copy` cannot be implemented for this type; the type has
    |
 LL | #[derive(Copy, Clone)]
    |          ^^^^ `Copy` not allowed on types with destructors
-   |
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0184]: the trait `Copy` cannot be implemented for this type; the type has a destructor
   --> $DIR/exclusive-drop-and-copy.rs:10:10
    |
 LL | #[derive(Copy, Clone)]
    |          ^^^^ `Copy` not allowed on types with destructors
-   |
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/explicit-tail-calls/ctfe-tail-call-panic.stderr b/tests/ui/explicit-tail-calls/ctfe-tail-call-panic.stderr
index ef71722a0ab..3bdd09e9683 100644
--- a/tests/ui/explicit-tail-calls/ctfe-tail-call-panic.stderr
+++ b/tests/ui/explicit-tail-calls/ctfe-tail-call-panic.stderr
@@ -9,7 +9,6 @@ note: inside `g`
    |
 LL |     panic!()
    |     ^^^^^^^^ the failure occurred here
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/extern/issue-28324.stderr b/tests/ui/extern/issue-28324.stderr
index 1fccb34fdf3..93eb6ff8174 100644
--- a/tests/ui/extern/issue-28324.stderr
+++ b/tests/ui/extern/issue-28324.stderr
@@ -2,7 +2,7 @@ error[E0080]: could not evaluate static initializer
   --> $DIR/issue-28324.rs:5:23
    |
 LL | pub static BAZ: u32 = *&error_message_count;
-   |                       ^^^^^^^^^^^^^^^^^^^^^ cannot access extern static (DefId(0:4 ~ issue_28324[8ec4]::{extern#0}::error_message_count))
+   |                       ^^^^^^^^^^^^^^^^^^^^^ cannot access extern static `error_message_count`
 
 error[E0133]: use of extern static is unsafe and requires unsafe function or block
   --> $DIR/issue-28324.rs:5:25
diff --git a/tests/ui/feature-gates/feature-gate-asm_goto.rs b/tests/ui/feature-gates/feature-gate-asm_goto.rs
deleted file mode 100644
index beac4590349..00000000000
--- a/tests/ui/feature-gates/feature-gate-asm_goto.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-//@ only-x86_64
-
-use std::arch::asm;
-
-fn main() {
-    unsafe {
-        asm!("jmp {}", label {});
-        //~^ ERROR label operands for inline assembly are unstable
-    }
-}
diff --git a/tests/ui/feature-gates/feature-gate-asm_goto.stderr b/tests/ui/feature-gates/feature-gate-asm_goto.stderr
deleted file mode 100644
index 62fd1a320d3..00000000000
--- a/tests/ui/feature-gates/feature-gate-asm_goto.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0658]: label operands for inline assembly are unstable
-  --> $DIR/feature-gate-asm_goto.rs:7:24
-   |
-LL |         asm!("jmp {}", label {});
-   |                        ^^^^^^^^
-   |
-   = note: see issue #119364 <https://github.com/rust-lang/rust/issues/119364> for more information
-   = help: add `#![feature(asm_goto)]` 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 1 previous error
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/feature-gates/feature-gate-asm_goto_with_outputs.rs b/tests/ui/feature-gates/feature-gate-asm_goto_with_outputs.rs
index 294827f78d2..26b7d5d2fbf 100644
--- a/tests/ui/feature-gates/feature-gate-asm_goto_with_outputs.rs
+++ b/tests/ui/feature-gates/feature-gate-asm_goto_with_outputs.rs
@@ -1,7 +1,5 @@
 //@ only-x86_64
 
-#![feature(asm_goto)]
-
 use std::arch::asm;
 
 fn main() {
diff --git a/tests/ui/feature-gates/feature-gate-asm_goto_with_outputs.stderr b/tests/ui/feature-gates/feature-gate-asm_goto_with_outputs.stderr
index ff7a7d5760a..06e11301565 100644
--- a/tests/ui/feature-gates/feature-gate-asm_goto_with_outputs.stderr
+++ b/tests/ui/feature-gates/feature-gate-asm_goto_with_outputs.stderr
@@ -1,5 +1,5 @@
 error[E0658]: using both label and output operands for inline assembly is unstable
-  --> $DIR/feature-gate-asm_goto_with_outputs.rs:10:52
+  --> $DIR/feature-gate-asm_goto_with_outputs.rs:8:52
    |
 LL |         asm!("mov {}, 1", "jmp {}", out(reg) _out, label {});
    |                                                    ^^^^^^^^
diff --git a/tests/ui/feature-gates/feature-gate-concat_idents2.stderr b/tests/ui/feature-gates/feature-gate-concat_idents2.stderr
index 2052813ea4a..b42a1d999e4 100644
--- a/tests/ui/feature-gates/feature-gate-concat_idents2.stderr
+++ b/tests/ui/feature-gates/feature-gate-concat_idents2.stderr
@@ -13,8 +13,6 @@ error[E0425]: cannot find value `ab` in this scope
    |
 LL |     concat_idents!(a, b);
    |     ^^^^^^^^^^^^^^^^^^^^ not found in this scope
-   |
-   = note: this error originates in the macro `concat_idents` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.rs b/tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.rs
index 2c130664e9a..f9b5176d78a 100644
--- a/tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.rs
+++ b/tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.rs
@@ -17,4 +17,13 @@ impl Mop {
     //~| ERROR: unconstrained opaque type
 }
 
+fn funky(_: [(); {
+    impl Foo for fn() {
+        type Bar = impl Sized;
+        //~^ ERROR: `impl Trait` in associated types is unstable
+        //~| ERROR: unconstrained opaque type
+    }
+    0
+}]) {}
+
 fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.stderr b/tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.stderr
index 7dfd79c7286..01d25c16228 100644
--- a/tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.stderr
+++ b/tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.stderr
@@ -18,6 +18,16 @@ LL |     type Bop = impl std::fmt::Debug;
    = help: add `#![feature(impl_trait_in_assoc_type)]` 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]: `impl Trait` in associated types is unstable
+  --> $DIR/feature-gate-impl_trait_in_assoc_type.rs:22:20
+   |
+LL |         type Bar = impl Sized;
+   |                    ^^^^^^^^^^
+   |
+   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
+   = help: add `#![feature(impl_trait_in_assoc_type)]` 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]: inherent associated types are unstable
   --> $DIR/feature-gate-impl_trait_in_assoc_type.rs:14:5
    |
@@ -44,6 +54,14 @@ LL |     type Bop = impl std::fmt::Debug;
    |
    = note: `Bop` must be used in combination with a concrete type within the same impl
 
-error: aborting due to 5 previous errors
+error: unconstrained opaque type
+  --> $DIR/feature-gate-impl_trait_in_assoc_type.rs:22:20
+   |
+LL |         type Bar = impl Sized;
+   |                    ^^^^^^^^^^
+   |
+   = note: `Bar` must be used in combination with a concrete type within the same impl
+
+error: aborting due to 7 previous errors
 
 For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/feature-gates/feature-gate-link-arg-attribute.rs b/tests/ui/feature-gates/feature-gate-link-arg-attribute.rs
index c12ff5b04dc..8e11a05c89b 100644
--- a/tests/ui/feature-gates/feature-gate-link-arg-attribute.rs
+++ b/tests/ui/feature-gates/feature-gate-link-arg-attribute.rs
@@ -7,3 +7,5 @@
 extern "C" {}
 
 fn main() {}
+
+//[in_flag]~? ERROR unknown linking modifier `link-arg`
diff --git a/tests/ui/feature-gates/feature-gate-naked_functions_target_feature.rs b/tests/ui/feature-gates/feature-gate-naked_functions_target_feature.rs
new file mode 100644
index 00000000000..0d3af4c5fe0
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-naked_functions_target_feature.rs
@@ -0,0 +1,15 @@
+//@ needs-asm-support
+//@ only-x86_64
+
+#![feature(naked_functions)]
+
+use std::arch::naked_asm;
+
+#[naked]
+#[target_feature(enable = "avx2")]
+//~^ ERROR: `#[target_feature(/* ... */)]` is currently unstable on `#[naked]` functions
+extern "C" fn naked() {
+    unsafe { naked_asm!("") }
+}
+
+fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-naked_functions_target_feature.stderr b/tests/ui/feature-gates/feature-gate-naked_functions_target_feature.stderr
new file mode 100644
index 00000000000..b0592d08046
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-naked_functions_target_feature.stderr
@@ -0,0 +1,13 @@
+error[E0658]: `#[target_feature(/* ... */)]` is currently unstable on `#[naked]` functions
+  --> $DIR/feature-gate-naked_functions_target_feature.rs:9:1
+   |
+LL | #[target_feature(enable = "avx2")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #138568 <https://github.com/rust-lang/rust/issues/138568> for more information
+   = help: add `#![feature(naked_functions_target_feature)]` 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 1 previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/feature-gates/feature-gate-native_link_modifiers_as_needed.rs b/tests/ui/feature-gates/feature-gate-native_link_modifiers_as_needed.rs
index c2965e42f27..c5859eec8db 100644
--- a/tests/ui/feature-gates/feature-gate-native_link_modifiers_as_needed.rs
+++ b/tests/ui/feature-gates/feature-gate-native_link_modifiers_as_needed.rs
@@ -7,3 +7,5 @@
 extern "C" {}
 
 fn main() {}
+
+//[in_flag]~? ERROR linking modifier `as-needed` is unstable
diff --git a/tests/ui/feature-gates/feature-gate-precise_capturing_in_traits.rs b/tests/ui/feature-gates/feature-gate-precise_capturing_in_traits.rs
deleted file mode 100644
index 308b41dfc68..00000000000
--- a/tests/ui/feature-gates/feature-gate-precise_capturing_in_traits.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-trait Foo {
-    fn test() -> impl Sized + use<Self>;
-    //~^ ERROR `use<...>` precise capturing syntax is currently not allowed in return-position
-}
-
-fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-precise_capturing_in_traits.stderr b/tests/ui/feature-gates/feature-gate-precise_capturing_in_traits.stderr
deleted file mode 100644
index b2c6bf61124..00000000000
--- a/tests/ui/feature-gates/feature-gate-precise_capturing_in_traits.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error: `use<...>` precise capturing syntax is currently not allowed in return-position `impl Trait` in traits
-  --> $DIR/feature-gate-precise_capturing_in_traits.rs:2:31
-   |
-LL |     fn test() -> impl Sized + use<Self>;
-   |                               ^^^^^^^^^
-   |
-   = note: currently, return-position `impl Trait` in traits and trait implementations capture all lifetimes in scope
-   = note: see issue #130044 <https://github.com/rust-lang/rust/issues/130044> for more information
-   = help: add `#![feature(precise_capturing_in_traits)]` 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 1 previous error
-
diff --git a/tests/ui/feature-gates/feature-gate-print-check-cfg.rs b/tests/ui/feature-gates/feature-gate-print-check-cfg.rs
deleted file mode 100644
index 304e0c132e5..00000000000
--- a/tests/ui/feature-gates/feature-gate-print-check-cfg.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-//@ compile-flags: --print=check-cfg
-
-fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-print-check-cfg.stderr b/tests/ui/feature-gates/feature-gate-print-check-cfg.stderr
deleted file mode 100644
index 62ee44b94a4..00000000000
--- a/tests/ui/feature-gates/feature-gate-print-check-cfg.stderr
+++ /dev/null
@@ -1,2 +0,0 @@
-error: the `-Z unstable-options` flag must also be passed to enable the check-cfg print option
-
diff --git a/tests/ui/feature-gates/feature-gate-rustc-attrs-1.rs b/tests/ui/feature-gates/feature-gate-rustc-attrs-1.rs
index 7ae4a8d911b..025b4b52f12 100644
--- a/tests/ui/feature-gates/feature-gate-rustc-attrs-1.rs
+++ b/tests/ui/feature-gates/feature-gate-rustc-attrs-1.rs
@@ -1,7 +1,6 @@
 // Test that `#[rustc_*]` attributes are gated by `rustc_attrs` feature gate.
 
 #[rustc_variance] //~ ERROR the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable
-#[rustc_error] //~ ERROR the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable
 #[rustc_nonnull_optimization_guaranteed] //~ ERROR the `#[rustc_nonnull_optimization_guaranteed]` attribute is just used to document guaranteed niche optimizations in libcore and libstd and will never be stable
 
 fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-rustc-attrs-1.stderr b/tests/ui/feature-gates/feature-gate-rustc-attrs-1.stderr
index 8c3a8eb2df8..0f760e0602d 100644
--- a/tests/ui/feature-gates/feature-gate-rustc-attrs-1.stderr
+++ b/tests/ui/feature-gates/feature-gate-rustc-attrs-1.stderr
@@ -7,18 +7,9 @@ LL | #[rustc_variance]
    = 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]: the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable
-  --> $DIR/feature-gate-rustc-attrs-1.rs:4:1
-   |
-LL | #[rustc_error]
-   | ^^^^^^^^^^^^^^
-   |
-   = 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]: the `#[rustc_nonnull_optimization_guaranteed]` attribute is just used to document guaranteed niche optimizations in libcore and libstd and will never be stable
               (note that the compiler does not even check whether the type indeed is being non-null-optimized; it is your responsibility to ensure that the attribute is only used on types that are optimized)
-  --> $DIR/feature-gate-rustc-attrs-1.rs:5:1
+  --> $DIR/feature-gate-rustc-attrs-1.rs:4:1
    |
 LL | #[rustc_nonnull_optimization_guaranteed]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -26,6 +17,6 @@ LL | #[rustc_nonnull_optimization_guaranteed]
    = 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 3 previous errors
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/feature-gates/feature-gate-type_alias_impl_trait.rs b/tests/ui/feature-gates/feature-gate-type_alias_impl_trait.rs
index 6d17f5e837d..d332fba0623 100644
--- a/tests/ui/feature-gates/feature-gate-type_alias_impl_trait.rs
+++ b/tests/ui/feature-gates/feature-gate-type_alias_impl_trait.rs
@@ -1,33 +1,42 @@
-//@ check-pass
-#![feature(type_alias_impl_trait)]
 use std::fmt::Debug;
 
-type Foo = impl Debug;
+type Foo = impl Debug; //~ ERROR `impl Trait` in type aliases is unstable
 
 struct Bar(Foo);
+#[define_opaque(Foo)] //~ ERROR use of unstable library feature `type_alias_impl_trait`
 fn define() -> Bar {
     Bar(42)
 }
 
-type Foo2 = impl Debug;
+type Foo2 = impl Debug; //~ ERROR `impl Trait` in type aliases is unstable
 
-fn define2(_: Foo2) {
+#[define_opaque(Foo2)] //~ ERROR use of unstable library feature `type_alias_impl_trait`
+fn define2() {
     let x = || -> Foo2 { 42 };
 }
 
-type Foo3 = impl Debug;
+type Foo3 = impl Debug; //~ ERROR `impl Trait` in type aliases is unstable
 
+#[define_opaque(Foo3)] //~ ERROR use of unstable library feature `type_alias_impl_trait`
 fn define3(x: Foo3) {
     let y: i32 = x;
 }
-fn define3_1(_: Foo3) {
+#[define_opaque(Foo3)] //~ ERROR use of unstable library feature `type_alias_impl_trait`
+fn define3_1() {
     define3(42)
 }
 
-type Foo4 = impl Debug;
+type Foo4 = impl Debug; //~ ERROR `impl Trait` in type aliases is unstable
 
+#[define_opaque(Foo4)] //~ ERROR use of unstable library feature `type_alias_impl_trait`
 fn define4(_: Foo4) {
     let y: Foo4 = 42;
 }
 
+type Foo5 = [(); {
+    type Foo = impl Debug; //~ ERROR `impl Trait` in type aliases is unstable
+    //~^ ERROR unconstrained opaque type
+    0
+}];
+
 fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-type_alias_impl_trait.stderr b/tests/ui/feature-gates/feature-gate-type_alias_impl_trait.stderr
new file mode 100644
index 00000000000..bab60eb4293
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-type_alias_impl_trait.stderr
@@ -0,0 +1,111 @@
+error[E0658]: use of unstable library feature `type_alias_impl_trait`: `type_alias_impl_trait` has open design concerns
+  --> $DIR/feature-gate-type_alias_impl_trait.rs:6:3
+   |
+LL | #[define_opaque(Foo)]
+   |   ^^^^^^^^^^^^^
+   |
+   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
+   = help: add `#![feature(type_alias_impl_trait)]` 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]: use of unstable library feature `type_alias_impl_trait`: `type_alias_impl_trait` has open design concerns
+  --> $DIR/feature-gate-type_alias_impl_trait.rs:13:3
+   |
+LL | #[define_opaque(Foo2)]
+   |   ^^^^^^^^^^^^^
+   |
+   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
+   = help: add `#![feature(type_alias_impl_trait)]` 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]: use of unstable library feature `type_alias_impl_trait`: `type_alias_impl_trait` has open design concerns
+  --> $DIR/feature-gate-type_alias_impl_trait.rs:20:3
+   |
+LL | #[define_opaque(Foo3)]
+   |   ^^^^^^^^^^^^^
+   |
+   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
+   = help: add `#![feature(type_alias_impl_trait)]` 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]: use of unstable library feature `type_alias_impl_trait`: `type_alias_impl_trait` has open design concerns
+  --> $DIR/feature-gate-type_alias_impl_trait.rs:24:3
+   |
+LL | #[define_opaque(Foo3)]
+   |   ^^^^^^^^^^^^^
+   |
+   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
+   = help: add `#![feature(type_alias_impl_trait)]` 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]: use of unstable library feature `type_alias_impl_trait`: `type_alias_impl_trait` has open design concerns
+  --> $DIR/feature-gate-type_alias_impl_trait.rs:31:3
+   |
+LL | #[define_opaque(Foo4)]
+   |   ^^^^^^^^^^^^^
+   |
+   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
+   = help: add `#![feature(type_alias_impl_trait)]` 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]: `impl Trait` in type aliases is unstable
+  --> $DIR/feature-gate-type_alias_impl_trait.rs:3:12
+   |
+LL | type Foo = impl Debug;
+   |            ^^^^^^^^^^
+   |
+   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
+   = help: add `#![feature(type_alias_impl_trait)]` 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]: `impl Trait` in type aliases is unstable
+  --> $DIR/feature-gate-type_alias_impl_trait.rs:11:13
+   |
+LL | type Foo2 = impl Debug;
+   |             ^^^^^^^^^^
+   |
+   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
+   = help: add `#![feature(type_alias_impl_trait)]` 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]: `impl Trait` in type aliases is unstable
+  --> $DIR/feature-gate-type_alias_impl_trait.rs:18:13
+   |
+LL | type Foo3 = impl Debug;
+   |             ^^^^^^^^^^
+   |
+   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
+   = help: add `#![feature(type_alias_impl_trait)]` 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]: `impl Trait` in type aliases is unstable
+  --> $DIR/feature-gate-type_alias_impl_trait.rs:29:13
+   |
+LL | type Foo4 = impl Debug;
+   |             ^^^^^^^^^^
+   |
+   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
+   = help: add `#![feature(type_alias_impl_trait)]` 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]: `impl Trait` in type aliases is unstable
+  --> $DIR/feature-gate-type_alias_impl_trait.rs:37:16
+   |
+LL |     type Foo = impl Debug;
+   |                ^^^^^^^^^^
+   |
+   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
+   = help: add `#![feature(type_alias_impl_trait)]` 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: unconstrained opaque type
+  --> $DIR/feature-gate-type_alias_impl_trait.rs:37:16
+   |
+LL |     type Foo = impl Debug;
+   |                ^^^^^^^^^^
+   |
+   = note: `Foo` must be used in combination with a concrete type within the same crate
+
+error: aborting due to 11 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/feature-gates/feature-gate-unqualified-local-imports.stderr b/tests/ui/feature-gates/feature-gate-unqualified-local-imports.stderr
index bc8edd847cc..30e36acb871 100644
--- a/tests/ui/feature-gates/feature-gate-unqualified-local-imports.stderr
+++ b/tests/ui/feature-gates/feature-gate-unqualified-local-imports.stderr
@@ -5,6 +5,7 @@ LL | #![allow(unqualified_local_imports)]
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: the `unqualified_local_imports` lint is unstable
+   = note: see issue #138299 <https://github.com/rust-lang/rust/issues/138299> for more information
    = help: add `#![feature(unqualified_local_imports)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
    = note: `#[warn(unknown_lints)]` on by default
diff --git a/tests/ui/fmt/fmt_debug/invalid.rs b/tests/ui/fmt/fmt_debug/invalid.rs
index 09cb46f1ea6..f2652fe277d 100644
--- a/tests/ui/fmt/fmt_debug/invalid.rs
+++ b/tests/ui/fmt/fmt_debug/invalid.rs
@@ -2,3 +2,5 @@
 //@ failure-status: 1
 fn main() {
 }
+
+//~? ERROR incorrect value `invalid-value` for unstable option `fmt-debug`
diff --git a/tests/ui/fmt/format-args-capture-first-literal-is-macro.stderr b/tests/ui/fmt/format-args-capture-first-literal-is-macro.stderr
index e399361579f..e9b2e83c288 100644
--- a/tests/ui/fmt/format-args-capture-first-literal-is-macro.stderr
+++ b/tests/ui/fmt/format-args-capture-first-literal-is-macro.stderr
@@ -24,7 +24,6 @@ LL |     format!(concat!("{a}"));
    |
    = note: did you intend to capture a variable `a` from the surrounding scope?
    = note: to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro
-   = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.stderr b/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.stderr
index 950dea721e2..e7ed2a76e6a 100644
--- a/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.stderr
+++ b/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.stderr
@@ -6,7 +6,6 @@ LL |     format_string_proc_macro::bad_format_args_captures!();
    |
    = note: did you intend to capture a variable `x` from the surrounding scope?
    = note: to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro
-   = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/fmt/format-args-capture-macro-hygiene.stderr b/tests/ui/fmt/format-args-capture-macro-hygiene.stderr
index 1b5fbd2af34..47ef581629e 100644
--- a/tests/ui/fmt/format-args-capture-macro-hygiene.stderr
+++ b/tests/ui/fmt/format-args-capture-macro-hygiene.stderr
@@ -6,7 +6,6 @@ LL |     format!(concat!("{foo}"));
    |
    = note: did you intend to capture a variable `foo` from the surrounding scope?
    = note: to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro
-   = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: there is no argument named `bar`
   --> $DIR/format-args-capture-macro-hygiene.rs:16:13
@@ -16,7 +15,6 @@ LL |     format!(concat!("{ba", "r} {}"), 1);
    |
    = note: did you intend to capture a variable `bar` from the surrounding scope?
    = note: to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro
-   = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: there is no argument named `foo`
   --> $DIR/format-args-capture-macro-hygiene.rs:7:13
diff --git a/tests/ui/fmt/format-expanded-string.stderr b/tests/ui/fmt/format-expanded-string.stderr
index 26ce7f26958..ab5baaf3789 100644
--- a/tests/ui/fmt/format-expanded-string.stderr
+++ b/tests/ui/fmt/format-expanded-string.stderr
@@ -5,7 +5,6 @@ LL |     format!(concat!("abc}"));
    |             ^^^^^^^^^^^^^^^ unmatched `}` in format string
    |
    = note: if you intended to print `}`, you can escape it using `}}`
-   = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: invalid format string: unmatched `}` found
   --> $DIR/format-expanded-string.rs:22:34
diff --git a/tests/ui/fmt/ifmt-bad-format-args.stderr b/tests/ui/fmt/ifmt-bad-format-args.stderr
index 2db280c5e2a..d458f2bc05b 100644
--- a/tests/ui/fmt/ifmt-bad-format-args.stderr
+++ b/tests/ui/fmt/ifmt-bad-format-args.stderr
@@ -3,8 +3,6 @@ error: requires at least a format string argument
    |
 LL |     format_args!();
    |     ^^^^^^^^^^^^^^
-   |
-   = note: this error originates in the macro `format_args` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: format argument must be a string literal
   --> $DIR/ifmt-bad-format-args.rs:3:18
diff --git a/tests/ui/fmt/issue-86085.stderr b/tests/ui/fmt/issue-86085.stderr
index f325a3ce293..4cc19ec4365 100644
--- a/tests/ui/fmt/issue-86085.stderr
+++ b/tests/ui/fmt/issue-86085.stderr
@@ -5,7 +5,6 @@ LL | format ! ( concat ! ( r#"lJ𐏿Æ�.𐏿�"# , "r} {}" )     ) ;
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unmatched `}` in format string
    |
    = note: if you intended to print `}`, you can escape it using `}}`
-   = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/fmt/issue-91556.stderr b/tests/ui/fmt/issue-91556.stderr
index 52917fb8c42..69f3779b93c 100644
--- a/tests/ui/fmt/issue-91556.stderr
+++ b/tests/ui/fmt/issue-91556.stderr
@@ -5,7 +5,6 @@ LL |   let _ = format!(concat!("{0}𝖳𝖾𝗌𝗍{"), i);
    |                   ^^^^^^^^^^^^^^^^^^^ expected `}` in format string
    |
    = note: if you intended to print `{`, you can escape it using `{{`
-   = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/fmt/raw-idents.stderr b/tests/ui/fmt/raw-idents.stderr
index 2ddc114d286..178340cf57e 100644
--- a/tests/ui/fmt/raw-idents.stderr
+++ b/tests/ui/fmt/raw-idents.stderr
@@ -27,7 +27,6 @@ LL |     println!(concat!("{r#", "type}"));
    |              ^^^^^^^^^^^^^^^^^^^^^^^ raw identifier used here in format string
    |
    = note: identifiers in format strings can be keywords and don't need to be prefixed with `r#`
-   = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: invalid format string: raw identifiers are not supported
   --> $DIR/raw-idents.rs:11:16
diff --git a/tests/ui/fmt/respanned-literal-issue-106191.stderr b/tests/ui/fmt/respanned-literal-issue-106191.stderr
index 17ab29e799b..5c9e538aa0c 100644
--- a/tests/ui/fmt/respanned-literal-issue-106191.stderr
+++ b/tests/ui/fmt/respanned-literal-issue-106191.stderr
@@ -13,7 +13,6 @@ LL |     format_args!(r#concat!("¡        {"));
    |                  ^^^^^^^^^^^^^^^^^^^^^^^ expected `}` in format string
    |
    = note: if you intended to print `{`, you can escape it using `{{`
-   = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/fn/fn_def_opaque_coercion.rs b/tests/ui/fn/fn_def_opaque_coercion.rs
index 0a8810cf4f8..8235878c59d 100644
--- a/tests/ui/fn/fn_def_opaque_coercion.rs
+++ b/tests/ui/fn/fn_def_opaque_coercion.rs
@@ -11,6 +11,7 @@ fn foo<T>(t: T) -> T {
 
 type F = impl Sized;
 
+#[define_opaque(F)]
 fn f(a: F) {
     let mut x = foo::<F>;
     x = foo::<()>;
@@ -20,6 +21,7 @@ fn f(a: F) {
 
 type G = impl Sized;
 
+#[define_opaque(G)]
 fn g(a: G) {
     let x = foo::<()>;
     let _: () = x(a);
@@ -27,6 +29,7 @@ fn g(a: G) {
 
 type H = impl Sized;
 
+#[define_opaque(H)]
 fn h(a: H) {
     let x = foo::<H>;
     let _: H = x(());
@@ -34,6 +37,7 @@ fn h(a: H) {
 
 type I = impl Sized;
 
+#[define_opaque(I)]
 fn i(a: I) {
     let mut x = foo::<()>;
     x = foo::<I>;
@@ -43,6 +47,7 @@ fn i(a: I) {
 
 type J = impl Sized;
 
+#[define_opaque(J)]
 fn j(a: J) {
     let x = match true {
         true => foo::<J>,
diff --git a/tests/ui/fn/fn_def_opaque_coercion_to_fn_ptr.rs b/tests/ui/fn/fn_def_opaque_coercion_to_fn_ptr.rs
index 5250e3a3d93..e090b7039b8 100644
--- a/tests/ui/fn/fn_def_opaque_coercion_to_fn_ptr.rs
+++ b/tests/ui/fn/fn_def_opaque_coercion_to_fn_ptr.rs
@@ -13,6 +13,7 @@ fn bar<T>(t: T) -> T {
 
 type F = impl Sized;
 
+#[define_opaque(F)]
 fn f(a: F) {
     let mut x = bar::<F>;
     x = foo::<()>; //~ ERROR: mismatched types
@@ -22,6 +23,7 @@ fn f(a: F) {
 
 type I = impl Sized;
 
+#[define_opaque(I)]
 fn i(a: I) {
     let mut x = bar::<()>;
     x = foo::<I>; //~ ERROR: mismatched types
@@ -31,6 +33,7 @@ fn i(a: I) {
 
 type J = impl Sized;
 
+#[define_opaque(J)]
 fn j(a: J) {
     let x = match true {
         true => bar::<J>,
diff --git a/tests/ui/fn/fn_def_opaque_coercion_to_fn_ptr.stderr b/tests/ui/fn/fn_def_opaque_coercion_to_fn_ptr.stderr
index 5000601e90f..4a0991d0eb3 100644
--- a/tests/ui/fn/fn_def_opaque_coercion_to_fn_ptr.stderr
+++ b/tests/ui/fn/fn_def_opaque_coercion_to_fn_ptr.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/fn_def_opaque_coercion_to_fn_ptr.rs:18:9
+  --> $DIR/fn_def_opaque_coercion_to_fn_ptr.rs:19:9
    |
 LL | type F = impl Sized;
    |          ---------- the expected opaque type
@@ -13,7 +13,7 @@ LL |     x = foo::<()>;
               found fn item `fn(()) -> () {foo::<()>}`
 
 error[E0308]: mismatched types
-  --> $DIR/fn_def_opaque_coercion_to_fn_ptr.rs:27:9
+  --> $DIR/fn_def_opaque_coercion_to_fn_ptr.rs:29:9
    |
 LL | fn foo<T>(t: T) -> T {
    | -------------------- function `foo` defined here
diff --git a/tests/ui/fn/trait-fn-generic-mismatch.rs b/tests/ui/fn/trait-fn-generic-mismatch.rs
new file mode 100644
index 00000000000..dc8222e967e
--- /dev/null
+++ b/tests/ui/fn/trait-fn-generic-mismatch.rs
@@ -0,0 +1,12 @@
+fn retry() -> impl Sized {}
+
+struct Core<T>(T);
+
+impl Core<XXX> { //~ ERROR cannot find type `XXX` in this scope
+    pub fn spawn(self) {}
+}
+
+fn main() {
+    let core = Core(1);
+    core.spawn(retry()); //~ ERROR this method takes 0 arguments but 1 argument was supplied
+}
diff --git a/tests/ui/fn/trait-fn-generic-mismatch.stderr b/tests/ui/fn/trait-fn-generic-mismatch.stderr
new file mode 100644
index 00000000000..8384d74e225
--- /dev/null
+++ b/tests/ui/fn/trait-fn-generic-mismatch.stderr
@@ -0,0 +1,32 @@
+error[E0412]: cannot find type `XXX` in this scope
+  --> $DIR/trait-fn-generic-mismatch.rs:5:11
+   |
+LL | impl Core<XXX> {
+   |           ^^^ not found in this scope
+   |
+help: you might be missing a type parameter
+   |
+LL | impl<XXX> Core<XXX> {
+   |     +++++
+
+error[E0061]: this method takes 0 arguments but 1 argument was supplied
+  --> $DIR/trait-fn-generic-mismatch.rs:11:10
+   |
+LL |     core.spawn(retry());
+   |          ^^^^^ ------- unexpected argument of type `impl Sized`
+   |
+note: method defined here
+  --> $DIR/trait-fn-generic-mismatch.rs:6:12
+   |
+LL |     pub fn spawn(self) {}
+   |            ^^^^^
+help: remove the extra argument
+   |
+LL -     core.spawn(retry());
+LL +     core.spawn();
+   |
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0061, E0412.
+For more information about an error, try `rustc --explain E0061`.
diff --git a/tests/ui/generic-associated-types/impl_bounds.stderr b/tests/ui/generic-associated-types/impl_bounds.stderr
index 291f0ade439..231c0dd89c5 100644
--- a/tests/ui/generic-associated-types/impl_bounds.stderr
+++ b/tests/ui/generic-associated-types/impl_bounds.stderr
@@ -41,7 +41,6 @@ LL | trait Foo {
 ...
 LL |     type C where Self: Clone;
    |          ^ this trait's associated type doesn't have the requirement `Fooy<T>: Copy`
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider restricting type parameter `T` with trait `Copy`
    |
 LL | impl<T: std::marker::Copy> Foo for Fooy<T> {
@@ -66,7 +65,6 @@ LL | trait Foo {
 ...
 LL |     fn d() where Self: Clone;
    |        ^ this trait's method doesn't have the requirement `Fooy<T>: Copy`
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider restricting type parameter `T` with trait `Copy`
    |
 LL | impl<T: std::marker::Copy> Foo for Fooy<T> {
diff --git a/tests/ui/generic-associated-types/issue-87258_b.rs b/tests/ui/generic-associated-types/issue-87258_b.rs
index 7b7610b21c7..84c7182cdcb 100644
--- a/tests/ui/generic-associated-types/issue-87258_b.rs
+++ b/tests/ui/generic-associated-types/issue-87258_b.rs
@@ -18,6 +18,7 @@ type Helper<'xenon, 'yttrium, KABOOM: Trait2> = impl Trait1;
 
 impl<'c, S: Trait2> Trait2 for &'c mut S {
     type FooFuture<'a> = Helper<'c, 'a, S>;
+    #[define_opaque(Helper)]
     fn foo<'a>() -> Self::FooFuture<'a> {
         Struct(unimplemented!())
     }
diff --git a/tests/ui/generic-associated-types/issue-87258_b.stderr b/tests/ui/generic-associated-types/issue-87258_b.stderr
index 73f984dcfb8..906ce1f50da 100644
--- a/tests/ui/generic-associated-types/issue-87258_b.stderr
+++ b/tests/ui/generic-associated-types/issue-87258_b.stderr
@@ -4,7 +4,7 @@ error: unconstrained opaque type
 LL | type Helper<'xenon, 'yttrium, KABOOM: Trait2> = impl Trait1;
    |                                                 ^^^^^^^^^^^
    |
-   = note: `Helper` must be used in combination with a concrete type within the same module
+   = note: `Helper` must be used in combination with a concrete type within the same crate
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/generic-associated-types/issue-88287.rs b/tests/ui/generic-associated-types/issue-88287.rs
index 5d64ad8eeae..ce0b9827d11 100644
--- a/tests/ui/generic-associated-types/issue-88287.rs
+++ b/tests/ui/generic-associated-types/issue-88287.rs
@@ -30,6 +30,7 @@ where
         A: SearchableResource<B> + ?Sized + 'f,
         Self: 'f;
 
+    #[define_opaque(SearchFutureTy)]
     fn search<'c>(&'c self, _client: &'c ()) -> Self::Future<'c, Self, Criteria> {
         async move { todo!() }
         //~^ ERROR: the size for values of type `A` cannot be known at compilation time
diff --git a/tests/ui/generic-associated-types/issue-88287.stderr b/tests/ui/generic-associated-types/issue-88287.stderr
index 54ecc5cfcd8..71cd6677e63 100644
--- a/tests/ui/generic-associated-types/issue-88287.stderr
+++ b/tests/ui/generic-associated-types/issue-88287.stderr
@@ -1,5 +1,5 @@
 error[E0277]: the size for values of type `A` cannot be known at compilation time
-  --> $DIR/issue-88287.rs:34:9
+  --> $DIR/issue-88287.rs:35:9
    |
 LL | type SearchFutureTy<'f, A, B: 'f>
    |                         - this type parameter needs to be `Sized`
diff --git a/tests/ui/generic-associated-types/issue-90014-tait.stderr b/tests/ui/generic-associated-types/issue-90014-tait.stderr
index 09c2903ab02..fffe5b93e5a 100644
--- a/tests/ui/generic-associated-types/issue-90014-tait.stderr
+++ b/tests/ui/generic-associated-types/issue-90014-tait.stderr
@@ -1,3 +1,11 @@
+error: unconstrained opaque type
+  --> $DIR/issue-90014-tait.rs:15:20
+   |
+LL |     type Fut<'a> = impl Future<Output = ()>;
+   |                    ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `Fut` must be used in combination with a concrete type within the same impl
+
 error[E0308]: mismatched types
   --> $DIR/issue-90014-tait.rs:18:9
    |
@@ -11,12 +19,7 @@ LL |         async { () }
    |
    = note: expected opaque type `Foo<'_>::Fut<'a>`
             found `async` block `{async block@$DIR/issue-90014-tait.rs:18:9: 18:14}`
-note: this item must have the opaque type in its signature in order to be able to register hidden types
-  --> $DIR/issue-90014-tait.rs:17:8
-   |
-LL |     fn make_fut<'a>(&'a self) -> Self::Fut<'a> {
-   |        ^^^^^^^^
 
-error: aborting due to 1 previous error
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/generic-associated-types/issue-90014-tait2.rs b/tests/ui/generic-associated-types/issue-90014-tait2.rs
index 3f7a9ff63c3..472a0d500c8 100644
--- a/tests/ui/generic-associated-types/issue-90014-tait2.rs
+++ b/tests/ui/generic-associated-types/issue-90014-tait2.rs
@@ -20,6 +20,7 @@ impl<'x, T: 'x> Trait<'x> for (T,) {
 }
 
 impl Foo<'_> {
+    #[define_opaque(Fut)]
     fn make_fut(&self) -> Box<dyn for<'a> Trait<'a, Thing = Fut<'a>>> {
         Box::new((async { () },))
         //~^ ERROR expected generic lifetime parameter, found `'a`
diff --git a/tests/ui/generic-associated-types/issue-90014-tait2.stderr b/tests/ui/generic-associated-types/issue-90014-tait2.stderr
index aa427d42649..bf944aac797 100644
--- a/tests/ui/generic-associated-types/issue-90014-tait2.stderr
+++ b/tests/ui/generic-associated-types/issue-90014-tait2.stderr
@@ -1,5 +1,5 @@
 error[E0792]: expected generic lifetime parameter, found `'a`
-  --> $DIR/issue-90014-tait2.rs:24:9
+  --> $DIR/issue-90014-tait2.rs:25:9
    |
 LL | type Fut<'a> = impl Future<Output = ()>;
    |          -- this generic parameter must be used with a generic lifetime parameter
diff --git a/tests/ui/generic-const-items/def-site-eval.fail.stderr b/tests/ui/generic-const-items/def-site-eval.fail.stderr
index 1ba4455c7be..fa07f385522 100644
--- a/tests/ui/generic-const-items/def-site-eval.fail.stderr
+++ b/tests/ui/generic-const-items/def-site-eval.fail.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `_::<'_>` failed
    |
 LL | const _<'_a>: () = panic!();
    |                    ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/generics/generic-non-trailing-defaults.rs b/tests/ui/generics/generic-non-trailing-defaults.rs
index 16ea71d48c8..ef500c42068 100644
--- a/tests/ui/generics/generic-non-trailing-defaults.rs
+++ b/tests/ui/generics/generic-non-trailing-defaults.rs
@@ -5,6 +5,6 @@ struct Vec<A = Heap, T>(A, T);
 
 struct Foo<A, B = Vec<C>, C>(A, B, C);
 //~^ ERROR generic parameters with a default must be trailing
-//~| ERROR generic parameters with a default cannot use
+//~| ERROR generic parameter defaults cannot reference parameters before they are declared
 
 fn main() {}
diff --git a/tests/ui/generics/generic-non-trailing-defaults.stderr b/tests/ui/generics/generic-non-trailing-defaults.stderr
index 713ba091b86..d9057e932f5 100644
--- a/tests/ui/generics/generic-non-trailing-defaults.stderr
+++ b/tests/ui/generics/generic-non-trailing-defaults.stderr
@@ -10,11 +10,11 @@ error: generic parameters with a default must be trailing
 LL | struct Foo<A, B = Vec<C>, C>(A, B, C);
    |               ^
 
-error[E0128]: generic parameters with a default cannot use forward declared identifiers
+error[E0128]: generic parameter defaults cannot reference parameters before they are declared
   --> $DIR/generic-non-trailing-defaults.rs:6:23
    |
 LL | struct Foo<A, B = Vec<C>, C>(A, B, C);
-   |                       ^ defaulted generic parameters cannot be forward declared
+   |                       ^ cannot reference `C` before it is declared
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/generics/generic-type-params-forward-mention.rs b/tests/ui/generics/generic-type-params-forward-mention.rs
index 000c47095d2..4a8f76d34aa 100644
--- a/tests/ui/generics/generic-type-params-forward-mention.rs
+++ b/tests/ui/generics/generic-type-params-forward-mention.rs
@@ -1,6 +1,6 @@
 // Ensure that we get an error and not an ICE for this problematic case.
 struct Foo<T = Option<U>, U = bool>(T, U);
-//~^ ERROR generic parameters with a default cannot use forward declared identifiers
+//~^ ERROR generic parameter defaults cannot reference parameters before they are declared
 fn main() {
     let x: Foo;
 }
diff --git a/tests/ui/generics/generic-type-params-forward-mention.stderr b/tests/ui/generics/generic-type-params-forward-mention.stderr
index d7a6faa1941..ecc2387b48b 100644
--- a/tests/ui/generics/generic-type-params-forward-mention.stderr
+++ b/tests/ui/generics/generic-type-params-forward-mention.stderr
@@ -1,8 +1,8 @@
-error[E0128]: generic parameters with a default cannot use forward declared identifiers
+error[E0128]: generic parameter defaults cannot reference parameters before they are declared
   --> $DIR/generic-type-params-forward-mention.rs:2:23
    |
 LL | struct Foo<T = Option<U>, U = bool>(T, U);
-   |                       ^ defaulted generic parameters cannot be forward declared
+   |                       ^ cannot reference `U` before it is declared
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/generics/issue-61631-default-type-param-cannot-reference-self.stderr b/tests/ui/generics/issue-61631-default-type-param-cannot-reference-self.stderr
index f3a550801b9..f659a144def 100644
--- a/tests/ui/generics/issue-61631-default-type-param-cannot-reference-self.stderr
+++ b/tests/ui/generics/issue-61631-default-type-param-cannot-reference-self.stderr
@@ -2,37 +2,37 @@ error[E0735]: generic parameters cannot use `Self` in their defaults
   --> $DIR/issue-61631-default-type-param-cannot-reference-self.rs:13:25
    |
 LL | struct Snobound<'a, P = Self> { x: Option<&'a P> }
-   |                         ^^^^ `Self` in generic parameter default
+   |                         ^^^^
 
 error[E0735]: generic parameters cannot use `Self` in their defaults
   --> $DIR/issue-61631-default-type-param-cannot-reference-self.rs:16:23
    |
 LL | enum Enobound<'a, P = Self> { A, B(Option<&'a P>) }
-   |                       ^^^^ `Self` in generic parameter default
+   |                       ^^^^
 
 error[E0735]: generic parameters cannot use `Self` in their defaults
   --> $DIR/issue-61631-default-type-param-cannot-reference-self.rs:19:24
    |
 LL | union Unobound<'a, P = Self> { x: i32, y: Option<&'a P> }
-   |                        ^^^^ `Self` in generic parameter default
+   |                        ^^^^
 
 error[E0735]: generic parameters cannot use `Self` in their defaults
   --> $DIR/issue-61631-default-type-param-cannot-reference-self.rs:25:31
    |
 LL | struct Ssized<'a, P: Sized = [Self]> { x: Option<&'a P> }
-   |                               ^^^^ `Self` in generic parameter default
+   |                               ^^^^
 
 error[E0735]: generic parameters cannot use `Self` in their defaults
   --> $DIR/issue-61631-default-type-param-cannot-reference-self.rs:28:29
    |
 LL | enum Esized<'a, P: Sized = [Self]> { A, B(Option<&'a P>) }
-   |                             ^^^^ `Self` in generic parameter default
+   |                             ^^^^
 
 error[E0735]: generic parameters cannot use `Self` in their defaults
   --> $DIR/issue-61631-default-type-param-cannot-reference-self.rs:31:30
    |
 LL | union Usized<'a, P: Sized = [Self]> { x: i32, y: Option<&'a P> }
-   |                              ^^^^ `Self` in generic parameter default
+   |                              ^^^^
 
 error: aborting due to 6 previous errors
 
diff --git a/tests/ui/generics/post_monomorphization_error_backtrace.stderr b/tests/ui/generics/post_monomorphization_error_backtrace.stderr
index 1366d5491f4..96aa04ee359 100644
--- a/tests/ui/generics/post_monomorphization_error_backtrace.stderr
+++ b/tests/ui/generics/post_monomorphization_error_backtrace.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `assert_zst::F::<u32>::V` failed
    |
 LL |         const V: () = assert!(std::mem::size_of::<T>() == 0);
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: assertion failed: std::mem::size_of::<T>() == 0
-   |
-   = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/post_monomorphization_error_backtrace.rs:14:5
@@ -23,8 +21,6 @@ error[E0080]: evaluation of `assert_zst::F::<i32>::V` failed
    |
 LL |         const V: () = assert!(std::mem::size_of::<T>() == 0);
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: assertion failed: std::mem::size_of::<T>() == 0
-   |
-   = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/post_monomorphization_error_backtrace.rs:14:5
diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.old.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.old.stderr
index 57cbe169118..34617448a69 100644
--- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.old.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.old.stderr
@@ -1,18 +1,18 @@
-error: item does not constrain `Foo::{opaque#0}`, but has it in its signature
-  --> $DIR/norm-before-method-resolution-opaque-type.rs:16:4
+error: item does not constrain `Foo::{opaque#0}`
+  --> $DIR/norm-before-method-resolution-opaque-type.rs:17:4
    |
 LL | fn weird_bound<X>(x: &<X as Trait<'static>>::Out<Foo>) -> X
    |    ^^^^^^^^^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
   --> $DIR/norm-before-method-resolution-opaque-type.rs:14:12
    |
 LL | type Foo = impl Sized;
    |            ^^^^^^^^^^
 
 error[E0507]: cannot move out of `*x` which is behind a shared reference
-  --> $DIR/norm-before-method-resolution-opaque-type.rs:22:13
+  --> $DIR/norm-before-method-resolution-opaque-type.rs:23:13
    |
 LL |     let x = *x;
    |             ^^ move occurs because `*x` has type `<X as Trait<'_>>::Out<Foo>`, which does not implement the `Copy` trait
diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.rs b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.rs
index 43207d89276..bb663c82abb 100644
--- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.rs
+++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.rs
@@ -13,6 +13,7 @@ impl<'a, T> Trait<'a> for T {
 
 type Foo = impl Sized;
 
+#[define_opaque(Foo)]
 fn weird_bound<X>(x: &<X as Trait<'static>>::Out<Foo>) -> X
 //[old]~^ ERROR: item does not constrain
 where
diff --git a/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness-2.rs b/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness-2.rs
index 65e90c1ca53..f703269a438 100644
--- a/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness-2.rs
+++ b/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness-2.rs
@@ -8,31 +8,29 @@ impl<T> Captures<'_> for T {}
 pub struct MyTy<'a, 'b>(Option<*mut &'a &'b ()>);
 unsafe impl Send for MyTy<'_, 'static> {}
 
-pub mod step1 {
-    use super::*;
-    pub type Step1<'a, 'b: 'a> = impl Sized + Captures<'b> + 'a;
-    pub fn step1<'a, 'b: 'a>() -> Step1<'a, 'b> {
-        MyTy::<'a, 'b>(None)
-    }
+pub type Step1<'a, 'b: 'a> = impl Sized + Captures<'b> + 'a;
+#[define_opaque(Step1)]
+pub fn step1<'a, 'b: 'a>() -> Step1<'a, 'b> {
+    MyTy::<'a, 'b>(None)
 }
 
-pub mod step2 {
-    pub type Step2<'a> = impl Send + 'a;
-
-    // Although `Step2` is WF at the definition site, it's not WF in its
-    // declaration site (above). We check this in `check_opaque_meets_bounds`,
-    // which must remain sound.
-    pub fn step2<'a, 'b: 'a>() -> Step2<'a>
-        where crate::step1::Step1<'a, 'b>: Send
-    {
-        crate::step1::step1::<'a, 'b>()
-        //~^ ERROR hidden type for `Step2<'a>` captures lifetime that does not appear in bounds
-    }
+pub type Step2<'a> = impl Send + 'a;
+
+// Although `Step2` is WF at the definition site, it's not WF in its
+// declaration site (above). We check this in `check_opaque_meets_bounds`,
+// which must remain sound.
+#[define_opaque(Step2)]
+pub fn step2<'a, 'b: 'a>() -> Step2<'a>
+where
+    Step1<'a, 'b>: Send,
+{
+    step1::<'a, 'b>()
+    //~^ ERROR hidden type for `Step2<'a>` captures lifetime that does not appear in bounds
 }
 
 fn step3<'a, 'b>() {
     fn is_send<T: Send>() {}
-    is_send::<crate::step2::Step2::<'a>>();
+    is_send::<Step2<'a>>();
 }
 
 fn main() {}
diff --git a/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness-2.stderr b/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness-2.stderr
index 58d7f9959d3..ce797ccf40c 100644
--- a/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness-2.stderr
+++ b/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness-2.stderr
@@ -1,14 +1,14 @@
 error[E0700]: hidden type for `Step2<'a>` captures lifetime that does not appear in bounds
-  --> $DIR/tait-hidden-erased-unsoundness-2.rs:28:9
+  --> $DIR/tait-hidden-erased-unsoundness-2.rs:27:5
    |
-LL |     pub type Step2<'a> = impl Send + 'a;
-   |                          -------------- opaque type defined here
+LL | pub type Step2<'a> = impl Send + 'a;
+   |                      -------------- opaque type defined here
 ...
-LL |     pub fn step2<'a, 'b: 'a>() -> Step2<'a>
-   |                      -- hidden type `Step1<'a, 'b>` captures the lifetime `'b` as defined here
+LL | pub fn step2<'a, 'b: 'a>() -> Step2<'a>
+   |                  -- hidden type `Step1<'a, 'b>` captures the lifetime `'b` as defined here
 ...
-LL |         crate::step1::step1::<'a, 'b>()
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |     step1::<'a, 'b>()
+   |     ^^^^^^^^^^^^^^^^^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.rs b/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.rs
index 40efd941e33..ba22f16003c 100644
--- a/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.rs
+++ b/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.rs
@@ -12,16 +12,15 @@ fn step1<'a, 'b: 'a>() -> impl Sized + Captures<'b> + 'a {
     MyTy::<'a, 'b>(None)
 }
 
-mod tait {
-    type Tait<'a> = impl Sized + 'a;
-    pub(super) fn step2<'a, 'b: 'a>() -> Tait<'a> {
-        super::step1::<'a, 'b>()
-        //~^ ERROR hidden type for `Tait<'a>` captures lifetime that does not appear in bounds
-    }
+type Tait<'a> = impl Sized + 'a;
+#[define_opaque(Tait)]
+fn step2<'a, 'b: 'a>() -> Tait<'a> {
+    step1::<'a, 'b>()
+    //~^ ERROR hidden type for `Tait<'a>` captures lifetime that does not appear in bounds
 }
 
 fn step3<'a, 'b: 'a>() -> impl Send + 'a {
-    tait::step2::<'a, 'b>()
+    step2::<'a, 'b>()
     // This should not be Send unless `'b: 'static`
 }
 
diff --git a/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.stderr b/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.stderr
index 6c9b8cf2427..ed1afd64507 100644
--- a/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.stderr
+++ b/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.stderr
@@ -1,12 +1,13 @@
 error[E0700]: hidden type for `Tait<'a>` captures lifetime that does not appear in bounds
-  --> $DIR/tait-hidden-erased-unsoundness.rs:18:9
+  --> $DIR/tait-hidden-erased-unsoundness.rs:18:5
    |
-LL |     type Tait<'a> = impl Sized + 'a;
-   |                     --------------- opaque type defined here
-LL |     pub(super) fn step2<'a, 'b: 'a>() -> Tait<'a> {
-   |                             -- hidden type `impl Captures<'b> + 'a` captures the lifetime `'b` as defined here
-LL |         super::step1::<'a, 'b>()
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^
+LL | type Tait<'a> = impl Sized + 'a;
+   |                 --------------- opaque type defined here
+LL | #[define_opaque(Tait)]
+LL | fn step2<'a, 'b: 'a>() -> Tait<'a> {
+   |              -- hidden type `impl Captures<'b> + 'a` captures the lifetime `'b` as defined here
+LL |     step1::<'a, 'b>()
+   |     ^^^^^^^^^^^^^^^^^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/impl-trait/associated-type-undefine.rs b/tests/ui/impl-trait/associated-type-undefine.rs
index c8f07021fbf..895525960fc 100644
--- a/tests/ui/impl-trait/associated-type-undefine.rs
+++ b/tests/ui/impl-trait/associated-type-undefine.rs
@@ -16,6 +16,7 @@ impl Foo for u32 {
 
 impl Foo for () {
     type Bar = impl Sized;
+    //~^ ERROR: unconstrained opaque type
     type Gat<T: Foo> = <T as Foo>::Bar;
     // Because we encounter `Gat<u32>` first, we never walk into another `Gat`
     // again, thus missing the opaque type that we could be defining.
diff --git a/tests/ui/impl-trait/associated-type-undefine.stderr b/tests/ui/impl-trait/associated-type-undefine.stderr
index 5d9d525eb93..e567f1bcdf6 100644
--- a/tests/ui/impl-trait/associated-type-undefine.stderr
+++ b/tests/ui/impl-trait/associated-type-undefine.stderr
@@ -1,5 +1,13 @@
+error: unconstrained opaque type
+  --> $DIR/associated-type-undefine.rs:18:16
+   |
+LL |     type Bar = impl Sized;
+   |                ^^^^^^^^^^
+   |
+   = note: `Bar` must be used in combination with a concrete type within the same impl
+
 error[E0308]: mismatched types
-  --> $DIR/associated-type-undefine.rs:23:14
+  --> $DIR/associated-type-undefine.rs:24:14
    |
 LL |     type Bar = impl Sized;
    |                ---------- the expected opaque type
@@ -9,12 +17,7 @@ LL |         ((), ())
    |
    = note: expected opaque type `<() as Foo>::Bar`
                 found unit type `()`
-note: this item must have the opaque type in its signature in order to be able to register hidden types
-  --> $DIR/associated-type-undefine.rs:22:8
-   |
-LL |     fn foo(self) -> (<Self as Foo>::Gat<u32>, <Self as Foo>::Gat<Self>) {
-   |        ^^^
 
-error: aborting due to 1 previous error
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/impl-trait/async_scope_creep.rs b/tests/ui/impl-trait/async_scope_creep.rs
index 0fb355c5233..449f090a2e4 100644
--- a/tests/ui/impl-trait/async_scope_creep.rs
+++ b/tests/ui/impl-trait/async_scope_creep.rs
@@ -22,11 +22,13 @@ impl Pending {
     }
 
     #[cfg(tait)]
+    #[define_opaque(OpeningReadFuture)]
     fn read_fut(&mut self) -> OpeningReadFuture<'_> {
         self.read()
     }
 
     #[cfg(rpit)]
+    #[define_opaque(PendingReader)]
     fn read_fut(
         &mut self,
     ) -> impl std::future::Future<Output = Result<PendingReader<'_>, CantOpen>> {
diff --git a/tests/ui/impl-trait/auto-trait-coherence.rs b/tests/ui/impl-trait/auto-trait-coherence.rs
index 0d7fef21cc9..fdb981ea406 100644
--- a/tests/ui/impl-trait/auto-trait-coherence.rs
+++ b/tests/ui/impl-trait/auto-trait-coherence.rs
@@ -5,6 +5,7 @@
 trait OpaqueTrait {}
 impl<T> OpaqueTrait for T {}
 type OpaqueType = impl OpaqueTrait;
+#[define_opaque(OpaqueType)]
 fn mk_opaque() -> OpaqueType {
     ()
 }
diff --git a/tests/ui/impl-trait/auto-trait-coherence.stderr b/tests/ui/impl-trait/auto-trait-coherence.stderr
index e0f4c857717..cfeccc3d766 100644
--- a/tests/ui/impl-trait/auto-trait-coherence.stderr
+++ b/tests/ui/impl-trait/auto-trait-coherence.stderr
@@ -1,5 +1,5 @@
 error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<_>`
-  --> $DIR/auto-trait-coherence.rs:21:1
+  --> $DIR/auto-trait-coherence.rs:22:1
    |
 LL | impl<T: Send> AnotherTrait for T {}
    | -------------------------------- first implementation here
diff --git a/tests/ui/impl-trait/bound-normalization-pass.rs b/tests/ui/impl-trait/bound-normalization-pass.rs
index 801187b6f5e..77bc0206830 100644
--- a/tests/ui/impl-trait/bound-normalization-pass.rs
+++ b/tests/ui/impl-trait/bound-normalization-pass.rs
@@ -77,6 +77,7 @@ mod opaque_types {
 
     type Ex = impl Trait<Out = <() as Implemented>::Assoc>;
 
+    #[define_opaque(Ex)]
     fn define() -> Ex {
         ()
     }
diff --git a/tests/ui/impl-trait/coherence-treats-tait-ambig.rs b/tests/ui/impl-trait/coherence-treats-tait-ambig.rs
index e8c1fcdd213..54d68afc31f 100644
--- a/tests/ui/impl-trait/coherence-treats-tait-ambig.rs
+++ b/tests/ui/impl-trait/coherence-treats-tait-ambig.rs
@@ -5,7 +5,8 @@ type T = impl Sized;
 struct Foo;
 
 impl Into<T> for Foo {
-//~^ ERROR conflicting implementations of trait `Into<_>` for type `Foo`
+    //~^ ERROR conflicting implementations of trait `Into<_>` for type `Foo`
+    #[define_opaque(T)]
     fn into(self) -> T {
         Foo
     }
diff --git a/tests/ui/impl-trait/deduce-signature-from-supertrait.rs b/tests/ui/impl-trait/deduce-signature-from-supertrait.rs
index 4e452994f72..28b6697f4bc 100644
--- a/tests/ui/impl-trait/deduce-signature-from-supertrait.rs
+++ b/tests/ui/impl-trait/deduce-signature-from-supertrait.rs
@@ -8,7 +8,8 @@ impl<T: Fn(i32)> SuperExpectation for T {}
 
 type Foo = impl SuperExpectation;
 
-fn bop(_: Foo) {
+#[define_opaque(Foo)]
+fn bop() {
     let _: Foo = |x| {
         let _ = x.to_string();
     };
diff --git a/tests/ui/impl-trait/define-via-const.rs b/tests/ui/impl-trait/define-via-const.rs
new file mode 100644
index 00000000000..a4b9123654c
--- /dev/null
+++ b/tests/ui/impl-trait/define-via-const.rs
@@ -0,0 +1,12 @@
+//@ check-pass
+
+#![feature(type_alias_impl_trait)]
+
+type Closure = impl Fn(u32) -> u32;
+
+#[define_opaque(Closure)]
+const ADDER: Closure = |x| x + 1;
+
+fn main() {
+    let z = (ADDER)(1);
+}
diff --git a/tests/ui/impl-trait/define-via-extern.rs b/tests/ui/impl-trait/define-via-extern.rs
new file mode 100644
index 00000000000..599c31ff917
--- /dev/null
+++ b/tests/ui/impl-trait/define-via-extern.rs
@@ -0,0 +1,16 @@
+#![feature(type_alias_impl_trait)]
+
+type Hi = impl Sized;
+
+extern "C" {
+    #[define_opaque(Hi)] fn foo();
+    //~^ ERROR only functions, statics, and consts can define opaque types
+
+    #[define_opaque(Hi)] static HI: Hi;
+    //~^ ERROR only functions, statics, and consts can define opaque types
+}
+
+#[define_opaque(Hi)]
+fn main() {
+    let _: Hi = 0;
+}
diff --git a/tests/ui/impl-trait/define-via-extern.stderr b/tests/ui/impl-trait/define-via-extern.stderr
new file mode 100644
index 00000000000..4a0ca5edd47
--- /dev/null
+++ b/tests/ui/impl-trait/define-via-extern.stderr
@@ -0,0 +1,14 @@
+error: only functions, statics, and consts can define opaque types
+  --> $DIR/define-via-extern.rs:6:5
+   |
+LL |     #[define_opaque(Hi)] fn foo();
+   |     ^^^^^^^^^^^^^^^^^^^^
+
+error: only functions, statics, and consts can define opaque types
+  --> $DIR/define-via-extern.rs:9:5
+   |
+LL |     #[define_opaque(Hi)] static HI: Hi;
+   |     ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/impl-trait/future-no-bound-vars-ice-112347.rs b/tests/ui/impl-trait/future-no-bound-vars-ice-112347.rs
index af623dc7cd9..e8be2082d7c 100644
--- a/tests/ui/impl-trait/future-no-bound-vars-ice-112347.rs
+++ b/tests/ui/impl-trait/future-no-bound-vars-ice-112347.rs
@@ -7,15 +7,12 @@
 
 use std::future::Future;
 
-mod foo {
-    use std::future::Future;
-    pub type Fut<'a> = impl Future<Output = ()> + 'a;
+pub type Fut<'a> = impl Future<Output = ()> + 'a;
 
-    fn foo<'a>(_: &()) -> Fut<'_> {
-        async {}
-    }
+#[define_opaque(Fut)]
+fn foo<'a>(_: &()) -> Fut<'_> {
+    async {}
 }
-use foo::*;
 
 trait Test {
     fn hello();
diff --git a/tests/ui/impl-trait/hidden-type-is-opaque-2.default.stderr b/tests/ui/impl-trait/hidden-type-is-opaque-2.default.stderr
index 01c5a553dc5..dca0a7b0a1a 100644
--- a/tests/ui/impl-trait/hidden-type-is-opaque-2.default.stderr
+++ b/tests/ui/impl-trait/hidden-type-is-opaque-2.default.stderr
@@ -13,7 +13,7 @@ LL |     Thunk::new(|mut cont: /* Type */| {
    |                         ++++++++++++
 
 error[E0282]: type annotations needed
-  --> $DIR/hidden-type-is-opaque-2.rs:20:17
+  --> $DIR/hidden-type-is-opaque-2.rs:21:17
    |
 LL |     Thunk::new(|mut cont| {
    |                 ^^^^^^^^
diff --git a/tests/ui/impl-trait/hidden-type-is-opaque-2.next.stderr b/tests/ui/impl-trait/hidden-type-is-opaque-2.next.stderr
index 01c5a553dc5..dca0a7b0a1a 100644
--- a/tests/ui/impl-trait/hidden-type-is-opaque-2.next.stderr
+++ b/tests/ui/impl-trait/hidden-type-is-opaque-2.next.stderr
@@ -13,7 +13,7 @@ LL |     Thunk::new(|mut cont: /* Type */| {
    |                         ++++++++++++
 
 error[E0282]: type annotations needed
-  --> $DIR/hidden-type-is-opaque-2.rs:20:17
+  --> $DIR/hidden-type-is-opaque-2.rs:21:17
    |
 LL |     Thunk::new(|mut cont| {
    |                 ^^^^^^^^
diff --git a/tests/ui/impl-trait/hidden-type-is-opaque-2.rs b/tests/ui/impl-trait/hidden-type-is-opaque-2.rs
index 78ac8363ba9..7725a04c358 100644
--- a/tests/ui/impl-trait/hidden-type-is-opaque-2.rs
+++ b/tests/ui/impl-trait/hidden-type-is-opaque-2.rs
@@ -16,6 +16,7 @@ fn reify_as() -> Thunk<impl FnOnce(Continuation) -> Continuation> {
 
 type Tait = impl FnOnce(Continuation) -> Continuation;
 
+#[define_opaque(Tait)]
 fn reify_as_tait() -> Thunk<Tait> {
     Thunk::new(|mut cont| {
         //~^ ERROR type annotations needed
diff --git a/tests/ui/impl-trait/hidden-type-is-opaque.rs b/tests/ui/impl-trait/hidden-type-is-opaque.rs
index 3111a21e209..aa9ea2a8a26 100644
--- a/tests/ui/impl-trait/hidden-type-is-opaque.rs
+++ b/tests/ui/impl-trait/hidden-type-is-opaque.rs
@@ -10,6 +10,7 @@ fn reify_as() -> Thunk<impl ContFn> {
 
 type Tait = impl ContFn;
 
+#[define_opaque(Tait)]
 fn reify_as_tait() -> Thunk<Tait> {
     Thunk::new(|mut cont| {
         cont.reify_as();
diff --git a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.current.stderr b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.current.stderr
index 146a3d21068..c76415d8114 100644
--- a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.current.stderr
+++ b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.current.stderr
@@ -1,5 +1,5 @@
 error[E0407]: method `line_stream` is not a member of trait `X`
-  --> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:28:5
+  --> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:29:5
    |
 LL |     fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {}
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `X`
@@ -17,15 +17,23 @@ LL |     type LineStream<'c, 'd> = impl Stream;
    |                     |
    |                     found 0 type parameters
 
+error: unconstrained opaque type
+  --> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:25:31
+   |
+LL |     type LineStream<'c, 'd> = impl Stream;
+   |                               ^^^^^^^^^^^
+   |
+   = note: `LineStream` must be used in combination with a concrete type within the same impl
+
 error[E0277]: `()` is not a future
-  --> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:28:43
+  --> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:29:43
    |
 LL |     fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {}
    |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future
    |
    = help: the trait `Future` is not implemented for `()`
 
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors
 
 Some errors have detailed explanations: E0049, E0277, E0407.
 For more information about an error, try `rustc --explain E0049`.
diff --git a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.next.stderr b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.next.stderr
index ce64a022214..4d72490ff95 100644
--- a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.next.stderr
+++ b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.next.stderr
@@ -1,5 +1,5 @@
 error[E0407]: method `line_stream` is not a member of trait `X`
-  --> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:28:5
+  --> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:29:5
    |
 LL |     fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {}
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `X`
@@ -17,25 +17,33 @@ LL |     type LineStream<'c, 'd> = impl Stream;
    |                     |
    |                     found 0 type parameters
 
+error: unconstrained opaque type
+  --> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:25:31
+   |
+LL |     type LineStream<'c, 'd> = impl Stream;
+   |                               ^^^^^^^^^^^
+   |
+   = note: `LineStream` must be used in combination with a concrete type within the same impl
+
 error[E0271]: type mismatch resolving `<Y as X>::LineStreamFut<'a, Repr> == ()`
-  --> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:28:43
+  --> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:29:43
    |
 LL |     fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {}
    |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
 
 error[E0271]: type mismatch resolving `<Y as X>::LineStreamFut<'a, Repr> normalizes-to _`
-  --> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:28:73
+  --> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:29:73
    |
 LL |     fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {}
    |                                                                         ^^ types differ
 
 error[E0271]: type mismatch resolving `<Y as X>::LineStreamFut<'a, Repr> normalizes-to _`
-  --> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:28:5
+  --> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:29:5
    |
 LL |     fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {}
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
 
-error: aborting due to 5 previous errors
+error: aborting due to 6 previous errors
 
 Some errors have detailed explanations: E0049, E0271, E0407.
 For more information about an error, try `rustc --explain E0049`.
diff --git a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs
index cb32723b22d..a5a37dbb210 100644
--- a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs
+++ b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs
@@ -24,6 +24,7 @@ struct Y;
 impl X for Y {
     type LineStream<'c, 'd> = impl Stream;
     //~^ ERROR type `LineStream` has 0 type parameters but its trait declaration has 1 type parameter
+    //~| ERROR: unconstrained opaque type
     type LineStreamFut<'a, Repr> = impl Future<Output = Self::LineStream<'a, Repr>>;
     fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {}
     //~^ method `line_stream` is not a member of trait `X`
diff --git a/tests/ui/impl-trait/impl-fn-predefined-lifetimes.rs b/tests/ui/impl-trait/impl-fn-predefined-lifetimes.rs
index 2f17c0ff508..776bb7278ce 100644
--- a/tests/ui/impl-trait/impl-fn-predefined-lifetimes.rs
+++ b/tests/ui/impl-trait/impl-fn-predefined-lifetimes.rs
@@ -2,8 +2,7 @@
 use std::fmt::Debug;
 
 fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) {
-    //~^ ERROR cannot resolve opaque type
-    //~| WARNING elided lifetime has a name
+    //~^ WARNING elided lifetime has a name
     |x| x
     //~^ ERROR expected generic lifetime parameter, found `'_`
 }
diff --git a/tests/ui/impl-trait/impl-fn-predefined-lifetimes.stderr b/tests/ui/impl-trait/impl-fn-predefined-lifetimes.stderr
index 91550f0e284..209186db4cc 100644
--- a/tests/ui/impl-trait/impl-fn-predefined-lifetimes.stderr
+++ b/tests/ui/impl-trait/impl-fn-predefined-lifetimes.stderr
@@ -7,24 +7,14 @@ LL | fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) {
    = note: `#[warn(elided_named_lifetimes)]` on by default
 
 error[E0792]: expected generic lifetime parameter, found `'_`
-  --> $DIR/impl-fn-predefined-lifetimes.rs:7:9
+  --> $DIR/impl-fn-predefined-lifetimes.rs:6:9
    |
 LL | fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) {
    |                                                -- this generic parameter must be used with a generic lifetime parameter
-...
+LL |
 LL |     |x| x
    |         ^
 
-error[E0720]: cannot resolve opaque type
-  --> $DIR/impl-fn-predefined-lifetimes.rs:4:35
-   |
-LL | fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) {
-   |                                   ^^^^^^^^^^^^^^^ recursive opaque type
-...
-LL |     |x| x
-   |     ----- returning here with type `{closure@$DIR/impl-fn-predefined-lifetimes.rs:7:5: 7:8}`
-
-error: aborting due to 2 previous errors; 1 warning emitted
+error: aborting due to 1 previous error; 1 warning emitted
 
-Some errors have detailed explanations: E0720, E0792.
-For more information about an error, try `rustc --explain E0720`.
+For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/impl-trait/impl_trait_projections.rs b/tests/ui/impl-trait/impl_trait_projections.rs
index 2c277aee06d..89fe3c1509c 100644
--- a/tests/ui/impl-trait/impl_trait_projections.rs
+++ b/tests/ui/impl-trait/impl_trait_projections.rs
@@ -35,4 +35,9 @@ fn projection_from_impl_trait_inside_dyn_trait_is_disallowed()
     panic!()
 }
 
+fn parametrized_value_in_anon_const_is_disallowed() -> [(); None::<impl Sized>] {
+    //~^ ERROR `impl Trait` is not allowed in paths
+    loop {}
+}
+
 fn main() {}
diff --git a/tests/ui/impl-trait/impl_trait_projections.stderr b/tests/ui/impl-trait/impl_trait_projections.stderr
index 5e0b80fcd59..21f45613938 100644
--- a/tests/ui/impl-trait/impl_trait_projections.stderr
+++ b/tests/ui/impl-trait/impl_trait_projections.stderr
@@ -30,6 +30,14 @@ LL |     -> <dyn Iterator<Item = impl Debug> as Iterator>::Item
    |
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
-error: aborting due to 4 previous errors
+error[E0562]: `impl Trait` is not allowed in paths
+  --> $DIR/impl_trait_projections.rs:38:68
+   |
+LL | fn parametrized_value_in_anon_const_is_disallowed() -> [(); None::<impl Sized>] {
+   |                                                                    ^^^^^^^^^^
+   |
+   = note: `impl Trait` is only allowed in arguments and return types of functions and methods
+
+error: aborting due to 5 previous errors
 
 For more information about this error, try `rustc --explain E0562`.
diff --git a/tests/ui/impl-trait/in-assoc-type-unconstrained.stderr b/tests/ui/impl-trait/in-assoc-type-unconstrained.stderr
index 8351175099c..c9e657b87d5 100644
--- a/tests/ui/impl-trait/in-assoc-type-unconstrained.stderr
+++ b/tests/ui/impl-trait/in-assoc-type-unconstrained.stderr
@@ -36,11 +36,6 @@ LL |         fn method() -> Self::Ty;
    |                        ^^^^^^^^
    = note: expected signature `fn() -> <() as compare_method::Trait>::Ty`
               found signature `fn() -> ()`
-note: this item must have the opaque type in its signature in order to be able to register hidden types
-  --> $DIR/in-assoc-type-unconstrained.rs:22:12
-   |
-LL |         fn method() -> () {}
-   |            ^^^^^^
 help: change the output type to match the trait
    |
 LL -         fn method() -> () {}
diff --git a/tests/ui/impl-trait/in-assoc-type.stderr b/tests/ui/impl-trait/in-assoc-type.stderr
index d5b543ea953..5a8cc40d027 100644
--- a/tests/ui/impl-trait/in-assoc-type.stderr
+++ b/tests/ui/impl-trait/in-assoc-type.stderr
@@ -11,11 +11,6 @@ LL |     fn foo(&self) -> <Self as Foo<()>>::Bar {}
    |
    = note: expected opaque type `<() as Foo<()>>::Bar`
                 found unit type `()`
-note: this item must have the opaque type in its signature in order to be able to register hidden types
-  --> $DIR/in-assoc-type.rs:20:8
-   |
-LL |     fn foo(&self) -> <Self as Foo<()>>::Bar {}
-   |        ^^^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/impl-trait/in-trait/dump.rs b/tests/ui/impl-trait/in-trait/dump.rs
index 47198d51150..20b0e60702f 100644
--- a/tests/ui/impl-trait/in-trait/dump.rs
+++ b/tests/ui/impl-trait/in-trait/dump.rs
@@ -1,6 +1,6 @@
 //@ compile-flags: -Zverbose-internals
 
-#![feature(precise_capturing_in_traits, rustc_attrs)]
+#![feature(rustc_attrs)]
 #![rustc_hidden_type_of_opaques]
 
 trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/refine-captures.rs b/tests/ui/impl-trait/in-trait/refine-captures.rs
index e7dffcb52aa..199cc464c4e 100644
--- a/tests/ui/impl-trait/in-trait/refine-captures.rs
+++ b/tests/ui/impl-trait/in-trait/refine-captures.rs
@@ -1,5 +1,3 @@
-#![feature(precise_capturing_in_traits)]
-
 trait LifetimeParam<'a> {
     fn test() -> impl Sized;
 }
diff --git a/tests/ui/impl-trait/in-trait/refine-captures.stderr b/tests/ui/impl-trait/in-trait/refine-captures.stderr
index 166991894d1..6f213f16144 100644
--- a/tests/ui/impl-trait/in-trait/refine-captures.stderr
+++ b/tests/ui/impl-trait/in-trait/refine-captures.stderr
@@ -1,5 +1,5 @@
 warning: impl trait in impl method captures fewer lifetimes than in trait
-  --> $DIR/refine-captures.rs:8:31
+  --> $DIR/refine-captures.rs:6:31
    |
 LL |     fn test() -> impl Sized + use<> {}
    |                               ^^^^^
@@ -13,7 +13,7 @@ LL |     fn test() -> impl Sized + use<'a> {}
    |                                   ++
 
 warning: impl trait in impl method captures fewer lifetimes than in trait
-  --> $DIR/refine-captures.rs:22:31
+  --> $DIR/refine-captures.rs:20:31
    |
 LL |     fn test() -> impl Sized + use<> {}
    |                               ^^^^^
@@ -26,7 +26,7 @@ LL |     fn test() -> impl Sized + use<'a> {}
    |                                   ++
 
 warning: impl trait in impl method captures fewer lifetimes than in trait
-  --> $DIR/refine-captures.rs:27:31
+  --> $DIR/refine-captures.rs:25:31
    |
 LL |     fn test() -> impl Sized + use<'b> {}
    |                               ^^^^^^^
@@ -39,7 +39,7 @@ LL |     fn test() -> impl Sized + use<'a, 'b> {}
    |                                    ++++
 
 error: `impl Trait` must mention all type parameters in scope in `use<...>`
-  --> $DIR/refine-captures.rs:32:18
+  --> $DIR/refine-captures.rs:30:18
    |
 LL | impl<T> TypeParam<T> for u64 {
    |      - type parameter is implicitly captured by this `impl Trait`
diff --git a/tests/ui/impl-trait/in-trait/variance.rs b/tests/ui/impl-trait/in-trait/variance.rs
index cd2f43fca9a..c0f569c690a 100644
--- a/tests/ui/impl-trait/in-trait/variance.rs
+++ b/tests/ui/impl-trait/in-trait/variance.rs
@@ -1,4 +1,4 @@
-#![feature(rustc_attrs, precise_capturing_in_traits)]
+#![feature(rustc_attrs)]
 #![allow(internal_features)]
 #![rustc_variance_of_opaques]
 
diff --git a/tests/ui/impl-trait/inside-item-nested-in-anon-const.rs b/tests/ui/impl-trait/inside-item-nested-in-anon-const.rs
new file mode 100644
index 00000000000..ab54d5f87ba
--- /dev/null
+++ b/tests/ui/impl-trait/inside-item-nested-in-anon-const.rs
@@ -0,0 +1,25 @@
+// Ensure we don't misclassify `impl Trait` as TAIT/ATPIT if located inside an anon const in a
+// type alias/assoc type.
+// issue: <https://github.com/rust-lang/rust/issues/139055>
+//@ check-pass
+#![forbid(unstable_features)]
+
+struct Girder<const N: usize>;
+
+type Alias = Girder<{
+    fn pass(input: impl Sized) -> impl Sized { input }
+    0
+}>;
+
+trait Trait {
+    type Assoc;
+}
+
+impl Trait for () {
+    type Assoc = [(); {
+        fn pass(input: impl Sized) -> impl Sized { input }
+        0
+    }];
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/issue-108591.rs b/tests/ui/impl-trait/issue-108591.rs
index caf08024568..db1c73831ee 100644
--- a/tests/ui/impl-trait/issue-108591.rs
+++ b/tests/ui/impl-trait/issue-108591.rs
@@ -15,6 +15,7 @@ impl MyTy<'_> {
 
 type Opaque2 = impl Sized;
 type Opaque<'a> = Opaque2;
+#[define_opaque(Opaque)]
 fn define<'a>() -> Opaque<'a> {}
 
 fn test<'a>() {
diff --git a/tests/ui/impl-trait/issue-108592.rs b/tests/ui/impl-trait/issue-108592.rs
index 7db2e31549c..facb8be9d23 100644
--- a/tests/ui/impl-trait/issue-108592.rs
+++ b/tests/ui/impl-trait/issue-108592.rs
@@ -11,13 +11,10 @@ fn test_closure() {
     closure(&opaque());
 }
 
-mod helper {
-    pub type Opaque2 = impl Sized;
-    pub type Opaque<'a> = Opaque2;
-    fn define<'a>() -> Opaque<'a> {}
-}
-
-use helper::*;
+pub type Opaque2 = impl Sized;
+pub type Opaque<'a> = Opaque2;
+#[define_opaque(Opaque)]
+fn define<'a>() -> Opaque<'a> {}
 
 fn test_tait(_: &Opaque<'_>) {
     None::<&'static Opaque<'_>>;
diff --git a/tests/ui/impl-trait/issue-99642-2.rs b/tests/ui/impl-trait/issue-99642-2.rs
index acbf3e3e2a0..d8d367a5d35 100644
--- a/tests/ui/impl-trait/issue-99642-2.rs
+++ b/tests/ui/impl-trait/issue-99642-2.rs
@@ -2,7 +2,8 @@
 
 #![feature(type_alias_impl_trait)]
 type Opq = impl Sized;
+#[define_opaque(Opq)]
 fn test() -> impl Iterator<Item = Opq> {
     Box::new(0..) as Box<dyn Iterator<Item = _>>
 }
-fn main(){}
+fn main() {}
diff --git a/tests/ui/impl-trait/issues/issue-53457.rs b/tests/ui/impl-trait/issues/issue-53457.rs
index bb248ef7177..a47c7655058 100644
--- a/tests/ui/impl-trait/issues/issue-53457.rs
+++ b/tests/ui/impl-trait/issues/issue-53457.rs
@@ -7,6 +7,7 @@ fn bar<F: Fn(&i32) + Clone>(f: F) -> F {
     f
 }
 
+#[define_opaque(X)]
 fn foo() -> X {
     bar(|_| ())
 }
diff --git a/tests/ui/impl-trait/issues/issue-70877.rs b/tests/ui/impl-trait/issues/issue-70877.rs
index 6ced0bbba8b..0f0a1b5187d 100644
--- a/tests/ui/impl-trait/issues/issue-70877.rs
+++ b/tests/ui/impl-trait/issues/issue-70877.rs
@@ -15,27 +15,27 @@ impl Iterator for Bar {
     }
 }
 
-mod ret {
-    pub type FooRet = impl std::fmt::Debug;
-    pub fn quux(st: super::FooArg) -> FooRet {
-        Some(st.to_string())
-    }
+pub type FooRet = impl std::fmt::Debug;
+#[define_opaque(FooRet)]
+pub fn quux(st: FooArg) -> FooRet {
+    Some(st.to_string())
 }
-use ret::*;
-mod foo {
-    pub type Foo = impl Iterator<Item = super::FooItem>;
-    pub fn ham() -> Foo {
-        super::Bar(1)
-    }
-    pub fn oof(_: Foo) -> impl std::fmt::Debug {
-        //~^ ERROR: item does not constrain `Foo::{opaque#0}`, but has it in its signature
-        let mut bar = ham();
-        let func = bar.next().unwrap();
-        return func(&"oof");
-    }
+pub type Foo = impl Iterator<Item = FooItem>;
+#[define_opaque(Foo)]
+pub fn ham() -> Foo {
+    //~^ ERROR: item does not constrain `FooRet::{opaque#0}`
+    Bar(1)
+}
+#[define_opaque(Foo)]
+pub fn oof() -> impl std::fmt::Debug {
+    //~^ ERROR: item does not constrain `FooRet::{opaque#0}`
+    //~| ERROR: item does not constrain `Foo::{opaque#0}`
+    let mut bar = ham();
+    let func = bar.next().unwrap();
+    return func(&"oof");
+    //~^ ERROR: opaque type's hidden type cannot be another opaque type
 }
-use foo::*;
 
 fn main() {
-    let _ = oof(ham());
+    let _ = oof();
 }
diff --git a/tests/ui/impl-trait/issues/issue-70877.stderr b/tests/ui/impl-trait/issues/issue-70877.stderr
index 4b23a02aaee..b2f37c8af9e 100644
--- a/tests/ui/impl-trait/issues/issue-70877.stderr
+++ b/tests/ui/impl-trait/issues/issue-70877.stderr
@@ -1,15 +1,58 @@
-error: item does not constrain `Foo::{opaque#0}`, but has it in its signature
-  --> $DIR/issue-70877.rs:30:12
+error: item does not constrain `FooRet::{opaque#0}`
+  --> $DIR/issue-70877.rs:25:8
    |
-LL |     pub fn oof(_: Foo) -> impl std::fmt::Debug {
-   |            ^^^
+LL | pub fn ham() -> Foo {
+   |        ^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
-  --> $DIR/issue-70877.rs:26:20
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
+  --> $DIR/issue-70877.rs:18:19
    |
-LL |     pub type Foo = impl Iterator<Item = super::FooItem>;
-   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | pub type FooRet = impl std::fmt::Debug;
+   |                   ^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to 1 previous error
+error: item does not constrain `FooRet::{opaque#0}`
+  --> $DIR/issue-70877.rs:30:8
+   |
+LL | pub fn oof() -> impl std::fmt::Debug {
+   |        ^^^
+   |
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
+  --> $DIR/issue-70877.rs:18:19
+   |
+LL | pub type FooRet = impl std::fmt::Debug;
+   |                   ^^^^^^^^^^^^^^^^^^^^
+
+error: item does not constrain `Foo::{opaque#0}`
+  --> $DIR/issue-70877.rs:30:8
+   |
+LL | pub fn oof() -> impl std::fmt::Debug {
+   |        ^^^
+   |
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
+  --> $DIR/issue-70877.rs:23:16
+   |
+LL | pub type Foo = impl Iterator<Item = FooItem>;
+   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: opaque type's hidden type cannot be another opaque type from the same scope
+  --> $DIR/issue-70877.rs:35:12
+   |
+LL |     return func(&"oof");
+   |            ^^^^^^^^^^^^ one of the two opaque types used here has to be outside its defining scope
+   |
+note: opaque type whose hidden type is being assigned
+  --> $DIR/issue-70877.rs:30:17
+   |
+LL | pub fn oof() -> impl std::fmt::Debug {
+   |                 ^^^^^^^^^^^^^^^^^^^^
+note: opaque type being used as hidden type
+  --> $DIR/issue-70877.rs:18:19
+   |
+LL | pub type FooRet = impl std::fmt::Debug;
+   |                   ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
 
diff --git a/tests/ui/impl-trait/issues/issue-74282.rs b/tests/ui/impl-trait/issues/issue-74282.rs
index 51bd5f67ed5..eb14a76a069 100644
--- a/tests/ui/impl-trait/issues/issue-74282.rs
+++ b/tests/ui/impl-trait/issues/issue-74282.rs
@@ -3,7 +3,8 @@
 type Closure = impl Fn() -> u64;
 struct Anonymous(Closure);
 
-fn bop(_: Closure) {
+#[define_opaque(Closure)]
+fn bop() {
     let y = || -> Closure { || 3 };
     Anonymous(|| {
         //~^ ERROR mismatched types
diff --git a/tests/ui/impl-trait/issues/issue-74282.stderr b/tests/ui/impl-trait/issues/issue-74282.stderr
index f8e85f7ae00..7a49041cace 100644
--- a/tests/ui/impl-trait/issues/issue-74282.stderr
+++ b/tests/ui/impl-trait/issues/issue-74282.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/issue-74282.rs:8:15
+  --> $DIR/issue-74282.rs:9:15
    |
 LL |   type Closure = impl Fn() -> u64;
    |                  ---------------- the expected opaque type
@@ -14,7 +14,7 @@ LL | |     })
    | |_____^ expected opaque type, found closure
    |
    = note: expected opaque type `Closure`
-                  found closure `{closure@$DIR/issue-74282.rs:8:15: 8:17}`
+                  found closure `{closure@$DIR/issue-74282.rs:9:15: 9:17}`
    = note: no two closures, even if identical, have the same type
    = help: consider boxing your closure and/or using it as a trait object
 note: tuple struct defined here
@@ -24,7 +24,7 @@ LL | struct Anonymous(Closure);
    |        ^^^^^^^^^
 
 error[E0308]: mismatched types
-  --> $DIR/issue-74282.rs:8:5
+  --> $DIR/issue-74282.rs:9:5
    |
 LL | /     Anonymous(|| {
 LL | |
@@ -38,8 +38,8 @@ LL |     });
    |       +
 help: try adding a return type
    |
-LL | fn bop(_: Closure) -> Anonymous {
-   |                    ++++++++++++
+LL | fn bop() -> Anonymous {
+   |          ++++++++++++
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/impl-trait/issues/issue-77987.rs b/tests/ui/impl-trait/issues/issue-77987.rs
index a7e7b067d5f..f134224071f 100644
--- a/tests/ui/impl-trait/issues/issue-77987.rs
+++ b/tests/ui/impl-trait/issues/issue-77987.rs
@@ -5,17 +5,16 @@
 pub trait Foo<T> {}
 impl<T, U> Foo<T> for U {}
 
-mod scope {
-    pub type Scope = impl super::Foo<()>;
+pub type Scope = impl Foo<()>;
 
-    #[allow(unused)]
-    fn infer_scope() -> Scope {
-        ()
-    }
+#[allow(unused)]
+#[define_opaque(Scope)]
+fn infer_scope() -> Scope {
+    ()
 }
 
 #[allow(unused)]
-fn ice() -> impl Foo<scope::Scope> {
+fn ice() -> impl Foo<Scope> {
     loop {}
 }
 
diff --git a/tests/ui/impl-trait/issues/issue-78722-2.rs b/tests/ui/impl-trait/issues/issue-78722-2.rs
index e811620c03b..ef4d26b6975 100644
--- a/tests/ui/impl-trait/issues/issue-78722-2.rs
+++ b/tests/ui/impl-trait/issues/issue-78722-2.rs
@@ -8,6 +8,7 @@ type F = impl core::future::Future<Output = u8>;
 
 struct Bug {
     V1: [(); {
+        #[define_opaque(F)]
         fn concrete_use() -> F {
             //~^ ERROR future that resolves to `u8`, but it resolves to `()`
             async {}
diff --git a/tests/ui/impl-trait/issues/issue-78722-2.stderr b/tests/ui/impl-trait/issues/issue-78722-2.stderr
index 27b4b712830..ede830bf72c 100644
--- a/tests/ui/impl-trait/issues/issue-78722-2.stderr
+++ b/tests/ui/impl-trait/issues/issue-78722-2.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/issue-78722-2.rs:16:20
+  --> $DIR/issue-78722-2.rs:17:20
    |
 LL | type F = impl core::future::Future<Output = u8>;
    |          -------------------------------------- the expected future
@@ -10,10 +10,10 @@ LL |         let f: F = async { 1 };
    |                expected due to this
    |
    = note: expected opaque type `F`
-            found `async` block `{async block@$DIR/issue-78722-2.rs:16:20: 16:25}`
+            found `async` block `{async block@$DIR/issue-78722-2.rs:17:20: 17:25}`
 
-error[E0271]: expected `{async block@$DIR/issue-78722-2.rs:13:13: 13:18}` to be a future that resolves to `u8`, but it resolves to `()`
-  --> $DIR/issue-78722-2.rs:11:30
+error[E0271]: expected `{async block@$DIR/issue-78722-2.rs:14:13: 14:18}` to be a future that resolves to `u8`, but it resolves to `()`
+  --> $DIR/issue-78722-2.rs:12:30
    |
 LL |         fn concrete_use() -> F {
    |                              ^ expected `u8`, found `()`
diff --git a/tests/ui/impl-trait/issues/issue-78722.rs b/tests/ui/impl-trait/issues/issue-78722.rs
index 5518c2cf12a..374cd564b8e 100644
--- a/tests/ui/impl-trait/issues/issue-78722.rs
+++ b/tests/ui/impl-trait/issues/issue-78722.rs
@@ -5,6 +5,7 @@
 struct Bug {
     V1: [(); {
         type F = impl core::future::Future<Output = u8>;
+        #[define_opaque(F)]
         fn concrete_use() -> F {
             //~^ ERROR to be a future that resolves to `u8`, but it resolves to `()`
             async {}
diff --git a/tests/ui/impl-trait/issues/issue-78722.stderr b/tests/ui/impl-trait/issues/issue-78722.stderr
index 109bda0c5cd..84c7dfb0338 100644
--- a/tests/ui/impl-trait/issues/issue-78722.stderr
+++ b/tests/ui/impl-trait/issues/issue-78722.stderr
@@ -1,5 +1,5 @@
 error[E0658]: `async` blocks are not allowed in constants
-  --> $DIR/issue-78722.rs:12:20
+  --> $DIR/issue-78722.rs:13:20
    |
 LL |         let f: F = async { 1 };
    |                    ^^^^^^^^^^^
@@ -8,8 +8,8 @@ LL |         let f: F = async { 1 };
    = help: add `#![feature(const_async_blocks)]` 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[E0271]: expected `{async block@$DIR/issue-78722.rs:10:13: 10:18}` to be a future that resolves to `u8`, but it resolves to `()`
-  --> $DIR/issue-78722.rs:8:30
+error[E0271]: expected `{async block@$DIR/issue-78722.rs:11:13: 11:18}` to be a future that resolves to `u8`, but it resolves to `()`
+  --> $DIR/issue-78722.rs:9:30
    |
 LL |         fn concrete_use() -> F {
    |                              ^ expected `u8`, found `()`
diff --git a/tests/ui/impl-trait/issues/issue-86201.rs b/tests/ui/impl-trait/issues/issue-86201.rs
index cde0b861160..19c68f7697b 100644
--- a/tests/ui/impl-trait/issues/issue-86201.rs
+++ b/tests/ui/impl-trait/issues/issue-86201.rs
@@ -4,10 +4,13 @@
 //@ check-pass
 
 type FunType = impl Fn<()>;
-static STATIC_FN: FunType = some_fn;
+#[define_opaque(FunType)]
+fn foo() -> FunType {
+    some_fn
+}
 
 fn some_fn() {}
 
 fn main() {
-    let _: <FunType as FnOnce<()>>::Output = STATIC_FN();
+    let _: <FunType as FnOnce<()>>::Output = foo()();
 }
diff --git a/tests/ui/impl-trait/issues/issue-86800.rs b/tests/ui/impl-trait/issues/issue-86800.rs
index ff1d273ae48..9e8ea439dde 100644
--- a/tests/ui/impl-trait/issues/issue-86800.rs
+++ b/tests/ui/impl-trait/issues/issue-86800.rs
@@ -4,45 +4,42 @@
 
 use std::future::Future;
 
-struct Connection {
-}
+struct Connection {}
 
-trait Transaction {
-}
+trait Transaction {}
 
 struct TestTransaction<'conn> {
-    conn: &'conn Connection
+    conn: &'conn Connection,
 }
 
-impl<'conn> Transaction for TestTransaction<'conn> {
-}
+impl<'conn> Transaction for TestTransaction<'conn> {}
 
-struct Context {
-}
+struct Context {}
 
 type TransactionResult<O> = Result<O, ()>;
 
 type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>;
 
+#[define_opaque(TransactionFuture)]
 fn execute_transaction_fut<'f, F, O>(
     //~^ ERROR: item does not constrain
     f: F,
 ) -> impl FnOnce(&mut dyn Transaction) -> TransactionFuture<'_, O>
 where
-    F: FnOnce(&mut dyn Transaction) -> TransactionFuture<'_, O> + 'f
+    F: FnOnce(&mut dyn Transaction) -> TransactionFuture<'_, O> + 'f,
 {
     f
     //~^ ERROR expected generic lifetime parameter, found `'_`
 }
 
 impl Context {
+    #[define_opaque(TransactionFuture)]
     async fn do_transaction<O>(
         //~^ ERROR: item does not constrain
-        &self, f: impl FnOnce(&mut dyn Transaction) -> TransactionFuture<'_, O>
-    ) -> TransactionResult<O>
-    {
+        &self,
+        f: impl FnOnce(&mut dyn Transaction) -> TransactionFuture<'_, O>,
+    ) -> TransactionResult<O> {
         //~^ ERROR expected generic lifetime parameter, found `'_`
-        //~| ERROR: item does not constrain
         let mut conn = Connection {};
         let mut transaction = TestTransaction { conn: &mut conn };
         f(&mut transaction).await
diff --git a/tests/ui/impl-trait/issues/issue-86800.stderr b/tests/ui/impl-trait/issues/issue-86800.stderr
index fd9b8e7ac99..80aa5d75c3c 100644
--- a/tests/ui/impl-trait/issues/issue-86800.stderr
+++ b/tests/ui/impl-trait/issues/issue-86800.stderr
@@ -1,50 +1,31 @@
-error: item does not constrain `TransactionFuture::{opaque#0}`, but has it in its signature
-  --> $DIR/issue-86800.rs:27:4
+error: item does not constrain `TransactionFuture::{opaque#0}`
+  --> $DIR/issue-86800.rs:24:4
    |
 LL | fn execute_transaction_fut<'f, F, O>(
    |    ^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
-  --> $DIR/issue-86800.rs:25:34
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
+  --> $DIR/issue-86800.rs:21:34
    |
 LL | type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>;
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: item does not constrain `TransactionFuture::{opaque#0}`, but has it in its signature
-  --> $DIR/issue-86800.rs:39:14
+error: item does not constrain `TransactionFuture::{opaque#0}`
+  --> $DIR/issue-86800.rs:37:14
    |
 LL |     async fn do_transaction<O>(
    |              ^^^^^^^^^^^^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
-  --> $DIR/issue-86800.rs:25:34
-   |
-LL | type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>;
-   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: item does not constrain `TransactionFuture::{opaque#0}`, but has it in its signature
-  --> $DIR/issue-86800.rs:43:5
-   |
-LL | /     {
-LL | |
-LL | |
-LL | |         let mut conn = Connection {};
-LL | |         let mut transaction = TestTransaction { conn: &mut conn };
-LL | |         f(&mut transaction).await
-LL | |     }
-   | |_____^
-   |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
-  --> $DIR/issue-86800.rs:25:34
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
+  --> $DIR/issue-86800.rs:21:34
    |
 LL | type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>;
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0792]: expected generic lifetime parameter, found `'_`
-  --> $DIR/issue-86800.rs:34:5
+  --> $DIR/issue-86800.rs:31:5
    |
 LL | type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>;
    |                        --- this generic parameter must be used with a generic lifetime parameter
@@ -53,13 +34,13 @@ LL |     f
    |     ^
 
 error[E0792]: expected generic lifetime parameter, found `'_`
-  --> $DIR/issue-86800.rs:43:5
+  --> $DIR/issue-86800.rs:41:31
    |
 LL |   type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>;
    |                          --- this generic parameter must be used with a generic lifetime parameter
 ...
-LL | /     {
-LL | |
+LL |       ) -> TransactionResult<O> {
+   |  _______________________________^
 LL | |
 LL | |         let mut conn = Connection {};
 LL | |         let mut transaction = TestTransaction { conn: &mut conn };
@@ -67,6 +48,6 @@ LL | |         f(&mut transaction).await
 LL | |     }
    | |_____^
 
-error: aborting due to 5 previous errors
+error: aborting due to 4 previous errors
 
 For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/impl-trait/issues/issue-89312.rs b/tests/ui/impl-trait/issues/issue-89312.rs
index 3b0e976780b..35cba41dd4b 100644
--- a/tests/ui/impl-trait/issues/issue-89312.rs
+++ b/tests/ui/impl-trait/issues/issue-89312.rs
@@ -2,23 +2,21 @@
 
 //@ check-pass
 
-mod helper {
-    pub trait T {
-        type Item;
-    }
+pub trait T {
+    type Item;
+}
 
-    pub type Alias<'a> = impl T<Item = &'a ()>;
+pub type Alias<'a> = impl T<Item = &'a ()>;
 
-    struct S;
-    impl<'a> T for &'a S {
-        type Item = &'a ();
-    }
+struct S;
+impl<'a> T for &'a S {
+    type Item = &'a ();
+}
 
-    pub fn filter_positive<'a>() -> Alias<'a> {
-        &S
-    }
+#[define_opaque(Alias)]
+pub fn filter_positive<'a>() -> Alias<'a> {
+    &S
 }
-use helper::*;
 
 fn with_positive(fun: impl Fn(Alias<'_>)) {
     fun(filter_positive());
diff --git a/tests/ui/impl-trait/issues/issue-99348-impl-compatibility.rs b/tests/ui/impl-trait/issues/issue-99348-impl-compatibility.rs
index b05579f2166..e19230b44b4 100644
--- a/tests/ui/impl-trait/issues/issue-99348-impl-compatibility.rs
+++ b/tests/ui/impl-trait/issues/issue-99348-impl-compatibility.rs
@@ -21,6 +21,7 @@ trait Bar {
     type Other;
 }
 
+#[define_opaque(Tait)]
 fn tait() -> Tait {}
 
 fn main() {}
diff --git a/tests/ui/impl-trait/multiple-lifetimes/error-handling-2.rs b/tests/ui/impl-trait/multiple-lifetimes/error-handling-2.rs
index 2a2be6b7429..21ca558153d 100644
--- a/tests/ui/impl-trait/multiple-lifetimes/error-handling-2.rs
+++ b/tests/ui/impl-trait/multiple-lifetimes/error-handling-2.rs
@@ -7,6 +7,7 @@ impl<T: Copy> Copy for CopyIfEq<T, T> {}
 
 type E<'a, 'b> = impl Sized;
 
+#[define_opaque(E)]
 fn foo<'a: 'b, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> {
     let v = CopyIfEq::<*mut _, *mut _>(&mut { x }, &mut y);
 
diff --git a/tests/ui/impl-trait/multiple-lifetimes/error-handling-2.stderr b/tests/ui/impl-trait/multiple-lifetimes/error-handling-2.stderr
index b968592beff..712cbbecd74 100644
--- a/tests/ui/impl-trait/multiple-lifetimes/error-handling-2.stderr
+++ b/tests/ui/impl-trait/multiple-lifetimes/error-handling-2.stderr
@@ -1,9 +1,9 @@
 error[E0700]: hidden type for `E<'b, 'c>` captures lifetime that does not appear in bounds
-  --> $DIR/error-handling-2.rs:22:5
+  --> $DIR/error-handling-2.rs:23:5
    |
 LL | type E<'a, 'b> = impl Sized;
    |                  ---------- opaque type defined here
-LL |
+...
 LL | fn foo<'a: 'b, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> {
    |        -- hidden type `*mut &'a i32` captures the lifetime `'a` as defined here
 ...
diff --git a/tests/ui/impl-trait/multiple-lifetimes/error-handling.rs b/tests/ui/impl-trait/multiple-lifetimes/error-handling.rs
index 367e7f4e6ea..0f3b7506318 100644
--- a/tests/ui/impl-trait/multiple-lifetimes/error-handling.rs
+++ b/tests/ui/impl-trait/multiple-lifetimes/error-handling.rs
@@ -7,6 +7,7 @@ impl<T: Copy> Copy for CopyIfEq<T, T> {}
 
 type E<'a, 'b> = impl Sized;
 
+#[define_opaque(E)]
 fn foo<'a, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> {
     let v = CopyIfEq::<*mut _, *mut _>(&mut { x }, &mut y);
 
diff --git a/tests/ui/impl-trait/multiple-lifetimes/error-handling.stderr b/tests/ui/impl-trait/multiple-lifetimes/error-handling.stderr
index 945fb0fc618..3732307ca35 100644
--- a/tests/ui/impl-trait/multiple-lifetimes/error-handling.stderr
+++ b/tests/ui/impl-trait/multiple-lifetimes/error-handling.stderr
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/error-handling.rs:20:16
+  --> $DIR/error-handling.rs:21:16
    |
 LL | fn foo<'a, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> {
    |        --  -- lifetime `'b` defined here
diff --git a/tests/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original-type-alias-impl-trait.rs b/tests/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original-type-alias-impl-trait.rs
index 6f90160866b..6a1cb61b8ba 100644
--- a/tests/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original-type-alias-impl-trait.rs
+++ b/tests/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original-type-alias-impl-trait.rs
@@ -10,6 +10,7 @@ impl<T> Trait<'_, '_> for T {}
 
 type Foo<'a, 'b> = impl Trait<'a, 'b>;
 
+#[define_opaque(Foo)]
 fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> Foo<'a, 'b> {
     // In this simple case, you have a hidden type `(&'0 u8, &'1 u8)` and constraints like
     //
diff --git a/tests/ui/impl-trait/negative-reasoning.rs b/tests/ui/impl-trait/negative-reasoning.rs
index 0474dc0beda..0d4a1ba75d8 100644
--- a/tests/ui/impl-trait/negative-reasoning.rs
+++ b/tests/ui/impl-trait/negative-reasoning.rs
@@ -5,6 +5,7 @@
 trait OpaqueTrait {}
 impl<T> OpaqueTrait for T {}
 type OpaqueType = impl OpaqueTrait;
+#[define_opaque(OpaqueType)]
 fn mk_opaque() -> OpaqueType {
     ()
 }
diff --git a/tests/ui/impl-trait/negative-reasoning.stderr b/tests/ui/impl-trait/negative-reasoning.stderr
index 631784c817b..2918be5135c 100644
--- a/tests/ui/impl-trait/negative-reasoning.stderr
+++ b/tests/ui/impl-trait/negative-reasoning.stderr
@@ -1,5 +1,5 @@
 error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<_>`
-  --> $DIR/negative-reasoning.rs:19:1
+  --> $DIR/negative-reasoning.rs:20:1
    |
 LL | impl<T: std::fmt::Debug> AnotherTrait for T {}
    | ------------------------------------------- first implementation here
diff --git a/tests/ui/impl-trait/nested-return-type2-tait.rs b/tests/ui/impl-trait/nested-return-type2-tait.rs
index 7cb98cfe060..aa871df9d9c 100644
--- a/tests/ui/impl-trait/nested-return-type2-tait.rs
+++ b/tests/ui/impl-trait/nested-return-type2-tait.rs
@@ -25,10 +25,10 @@ type Sendable = impl Send;
 // the hidden type. We already have obligations registered on the inference
 // var to make it uphold the `: Duh` bound on `Trait::Assoc`. The opaque
 // type does not implement `Duh`, but if its hidden type does.
+#[define_opaque(Sendable)]
 fn foo() -> impl Trait<Assoc = Sendable> {
     //~^ WARN opaque type `impl Trait<Assoc = Sendable>` does not satisfy its associated type bounds
     || 42
 }
 
-fn main() {
-}
+fn main() {}
diff --git a/tests/ui/impl-trait/nested-return-type2-tait.stderr b/tests/ui/impl-trait/nested-return-type2-tait.stderr
index 4383e8ab3a0..8105990eac4 100644
--- a/tests/ui/impl-trait/nested-return-type2-tait.stderr
+++ b/tests/ui/impl-trait/nested-return-type2-tait.stderr
@@ -1,5 +1,5 @@
 warning: opaque type `impl Trait<Assoc = Sendable>` does not satisfy its associated type bounds
-  --> $DIR/nested-return-type2-tait.rs:28:24
+  --> $DIR/nested-return-type2-tait.rs:29:24
    |
 LL |     type Assoc: Duh;
    |                 --- this associated type bound is unsatisfied for `Sendable`
diff --git a/tests/ui/impl-trait/nested-return-type2-tait2.rs b/tests/ui/impl-trait/nested-return-type2-tait2.rs
index 574602079d4..bd89dad7dfd 100644
--- a/tests/ui/impl-trait/nested-return-type2-tait2.rs
+++ b/tests/ui/impl-trait/nested-return-type2-tait2.rs
@@ -26,9 +26,9 @@ type Traitable = impl Trait<Assoc = Sendable>;
 // the hidden type. We already have obligations registered on the inference
 // var to make it uphold the `: Duh` bound on `Trait::Assoc`. The opaque
 // type does not implement `Duh`, even if its hidden type does. So we error out.
+#[define_opaque(Traitable)]
 fn foo() -> Traitable {
     || 42
 }
 
-fn main() {
-}
+fn main() {}
diff --git a/tests/ui/impl-trait/nested-return-type2-tait3.rs b/tests/ui/impl-trait/nested-return-type2-tait3.rs
index e3429731782..83bf441181a 100644
--- a/tests/ui/impl-trait/nested-return-type2-tait3.rs
+++ b/tests/ui/impl-trait/nested-return-type2-tait3.rs
@@ -25,9 +25,9 @@ type Traitable = impl Trait<Assoc = impl Send>;
 // the hidden type. We already have obligations registered on the inference
 // var to make it uphold the `: Duh` bound on `Trait::Assoc`. The opaque
 // type does not implement `Duh`, even if its hidden type does. So we error out.
+#[define_opaque(Traitable)]
 fn foo() -> Traitable {
     || 42
 }
 
-fn main() {
-}
+fn main() {}
diff --git a/tests/ui/impl-trait/nested-return-type3-tait.rs b/tests/ui/impl-trait/nested-return-type3-tait.rs
index 05759fb2697..fb2e4d87543 100644
--- a/tests/ui/impl-trait/nested-return-type3-tait.rs
+++ b/tests/ui/impl-trait/nested-return-type3-tait.rs
@@ -16,10 +16,10 @@ impl<F: Duh> Trait for F {
 
 type Sendable = impl Send;
 
+#[define_opaque(Sendable)]
 fn foo() -> impl Trait<Assoc = Sendable> {
     //~^ WARN opaque type `impl Trait<Assoc = Sendable>` does not satisfy its associated type bounds
     42
 }
 
-fn main() {
-}
+fn main() {}
diff --git a/tests/ui/impl-trait/nested-return-type3-tait.stderr b/tests/ui/impl-trait/nested-return-type3-tait.stderr
index d32944a0d72..bb1f524b992 100644
--- a/tests/ui/impl-trait/nested-return-type3-tait.stderr
+++ b/tests/ui/impl-trait/nested-return-type3-tait.stderr
@@ -1,5 +1,5 @@
 warning: opaque type `impl Trait<Assoc = Sendable>` does not satisfy its associated type bounds
-  --> $DIR/nested-return-type3-tait.rs:19:24
+  --> $DIR/nested-return-type3-tait.rs:20:24
    |
 LL |     type Assoc: Duh;
    |                 --- this associated type bound is unsatisfied for `Sendable`
diff --git a/tests/ui/impl-trait/nested-return-type3-tait2.rs b/tests/ui/impl-trait/nested-return-type3-tait2.rs
index 927fa8d596b..f3fda61e920 100644
--- a/tests/ui/impl-trait/nested-return-type3-tait2.rs
+++ b/tests/ui/impl-trait/nested-return-type3-tait2.rs
@@ -18,9 +18,9 @@ type Sendable = impl Send;
 type Traitable = impl Trait<Assoc = Sendable>;
 //~^ WARN opaque type `Traitable` does not satisfy its associated type bounds
 
+#[define_opaque(Traitable)]
 fn foo() -> Traitable {
     42
 }
 
-fn main() {
-}
+fn main() {}
diff --git a/tests/ui/impl-trait/nested-return-type3-tait3.rs b/tests/ui/impl-trait/nested-return-type3-tait3.rs
index 5b3b2d2e198..d2acee9cafd 100644
--- a/tests/ui/impl-trait/nested-return-type3-tait3.rs
+++ b/tests/ui/impl-trait/nested-return-type3-tait3.rs
@@ -17,9 +17,9 @@ impl<F: Duh> Trait for F {
 type Traitable = impl Trait<Assoc = impl Send>;
 //~^ WARN opaque type `Traitable` does not satisfy its associated type bounds
 
+#[define_opaque(Traitable)]
 fn foo() -> Traitable {
     42
 }
 
-fn main() {
-}
+fn main() {}
diff --git a/tests/ui/impl-trait/normalize-tait-in-const.stderr b/tests/ui/impl-trait/normalize-tait-in-const.stderr
index c6cd1b139c5..d4ba9a31170 100644
--- a/tests/ui/impl-trait/normalize-tait-in-const.stderr
+++ b/tests/ui/impl-trait/normalize-tait-in-const.stderr
@@ -17,6 +17,14 @@ 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: unconstrained opaque type
+  --> $DIR/normalize-tait-in-const.rs:14:26
+   |
+LL |     pub type Alias<'a> = impl T<Item = &'a ()>;
+   |                          ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `Alias` must be used in combination with a concrete type within the same crate
+
 error[E0015]: cannot call non-const closure in constant functions
   --> $DIR/normalize-tait-in-const.rs:28:5
    |
@@ -25,6 +33,26 @@ LL |     fun(filter_positive());
    |
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
 
-error: aborting due to 3 previous errors
+error[E0308]: mismatched types
+  --> $DIR/normalize-tait-in-const.rs:22:9
+   |
+LL |     pub type Alias<'a> = impl T<Item = &'a ()>;
+   |                          --------------------- the expected opaque type
+...
+LL |     pub const fn filter_positive<'a>() -> &'a Alias<'a> {
+   |                                           ------------- expected `&'a foo::Alias<'a>` because of return type
+LL |         &&S
+   |         ^^^ expected `&Alias<'_>`, found `&&S`
+   |
+   = note: expected reference `&'a foo::Alias<'a>`
+              found reference `&&S`
+note: this item must have a `#[define_opaque(foo::Alias)]` attribute to be able to define hidden types
+  --> $DIR/normalize-tait-in-const.rs:21:18
+   |
+LL |     pub const fn filter_positive<'a>() -> &'a Alias<'a> {
+   |                  ^^^^^^^^^^^^^^^
+
+error: aborting due to 5 previous errors
 
-For more information about this error, try `rustc --explain E0015`.
+Some errors have detailed explanations: E0015, E0308.
+For more information about an error, try `rustc --explain E0015`.
diff --git a/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.rs b/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.rs
index 6c2477c9744..1b52b170201 100644
--- a/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.rs
+++ b/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.rs
@@ -1,5 +1,3 @@
-#![feature(precise_capturing_in_traits)]
-
 fn type_param<T>() -> impl Sized + use<> {}
 //~^ ERROR `impl Trait` must mention all type parameters in scope
 
diff --git a/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.stderr b/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.stderr
index 93b44a0c18c..93c35203f1d 100644
--- a/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.stderr
+++ b/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.stderr
@@ -1,5 +1,5 @@
 error: `impl Trait` must mention all type parameters in scope in `use<...>`
-  --> $DIR/forgot-to-capture-type.rs:3:23
+  --> $DIR/forgot-to-capture-type.rs:1:23
    |
 LL | fn type_param<T>() -> impl Sized + use<> {}
    |               -       ^^^^^^^^^^^^^^^^^^
@@ -9,7 +9,7 @@ LL | fn type_param<T>() -> impl Sized + use<> {}
    = note: currently, all type parameters are required to be mentioned in the precise captures list
 
 error: `impl Trait` must mention the `Self` type of the trait in `use<...>`
-  --> $DIR/forgot-to-capture-type.rs:7:17
+  --> $DIR/forgot-to-capture-type.rs:5:17
    |
 LL | trait Foo {
    | --------- `Self` type parameter is implicitly captured by this `impl Trait`
diff --git a/tests/ui/impl-trait/precise-capturing/redundant.rs b/tests/ui/impl-trait/precise-capturing/redundant.rs
index 32dc0927317..2385827db22 100644
--- a/tests/ui/impl-trait/precise-capturing/redundant.rs
+++ b/tests/ui/impl-trait/precise-capturing/redundant.rs
@@ -1,6 +1,5 @@
 //@ edition: 2024
 
-#![feature(precise_capturing_in_traits)]
 #![deny(impl_trait_redundant_captures)]
 
 fn hello<'a>() -> impl Sized + use<'a> {}
diff --git a/tests/ui/impl-trait/precise-capturing/redundant.stderr b/tests/ui/impl-trait/precise-capturing/redundant.stderr
index 5c8b35c2285..c9f84d360e3 100644
--- a/tests/ui/impl-trait/precise-capturing/redundant.stderr
+++ b/tests/ui/impl-trait/precise-capturing/redundant.stderr
@@ -1,5 +1,5 @@
 error: all possible in-scope parameters are already captured, so `use<...>` syntax is redundant
-  --> $DIR/redundant.rs:6:19
+  --> $DIR/redundant.rs:5:19
    |
 LL | fn hello<'a>() -> impl Sized + use<'a> {}
    |                   ^^^^^^^^^^^^^-------
@@ -7,13 +7,13 @@ LL | fn hello<'a>() -> impl Sized + use<'a> {}
    |                                help: remove the `use<...>` syntax
    |
 note: the lint level is defined here
-  --> $DIR/redundant.rs:4:9
+  --> $DIR/redundant.rs:3:9
    |
 LL | #![deny(impl_trait_redundant_captures)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: all possible in-scope parameters are already captured, so `use<...>` syntax is redundant
-  --> $DIR/redundant.rs:11:27
+  --> $DIR/redundant.rs:10:27
    |
 LL |     fn inherent(&self) -> impl Sized + use<'_> {}
    |                           ^^^^^^^^^^^^^-------
@@ -21,7 +21,7 @@ LL |     fn inherent(&self) -> impl Sized + use<'_> {}
    |                                        help: remove the `use<...>` syntax
 
 error: all possible in-scope parameters are already captured, so `use<...>` syntax is redundant
-  --> $DIR/redundant.rs:16:22
+  --> $DIR/redundant.rs:15:22
    |
 LL |     fn in_trait() -> impl Sized + use<'a, Self>;
    |                      ^^^^^^^^^^^^^-------------
@@ -29,7 +29,7 @@ LL |     fn in_trait() -> impl Sized + use<'a, Self>;
    |                                   help: remove the `use<...>` syntax
 
 error: all possible in-scope parameters are already captured, so `use<...>` syntax is redundant
-  --> $DIR/redundant.rs:20:22
+  --> $DIR/redundant.rs:19:22
    |
 LL |     fn in_trait() -> impl Sized + use<'a> {}
    |                      ^^^^^^^^^^^^^-------
diff --git a/tests/ui/impl-trait/precise-capturing/rpitit-captures-more-method-lifetimes.rs b/tests/ui/impl-trait/precise-capturing/rpitit-captures-more-method-lifetimes.rs
index b39c1408c05..f6126c03339 100644
--- a/tests/ui/impl-trait/precise-capturing/rpitit-captures-more-method-lifetimes.rs
+++ b/tests/ui/impl-trait/precise-capturing/rpitit-captures-more-method-lifetimes.rs
@@ -2,8 +2,6 @@
 // trait definition, which is not allowed. Due to the default lifetime capture
 // rules of RPITITs, this is only doable if we use precise capturing.
 
-#![feature(precise_capturing_in_traits)]
-
 pub trait Foo {
     fn bar<'tr: 'tr>(&'tr mut self) -> impl Sized + use<Self>;
 }
diff --git a/tests/ui/impl-trait/precise-capturing/rpitit-captures-more-method-lifetimes.stderr b/tests/ui/impl-trait/precise-capturing/rpitit-captures-more-method-lifetimes.stderr
index 45f755d3cc1..d9066018880 100644
--- a/tests/ui/impl-trait/precise-capturing/rpitit-captures-more-method-lifetimes.stderr
+++ b/tests/ui/impl-trait/precise-capturing/rpitit-captures-more-method-lifetimes.stderr
@@ -1,5 +1,5 @@
 error: return type captures more lifetimes than trait definition
-  --> $DIR/rpitit-captures-more-method-lifetimes.rs:12:40
+  --> $DIR/rpitit-captures-more-method-lifetimes.rs:10:40
    |
 LL |     fn bar<'im: 'im>(&'im mut self) -> impl Sized + use<'im> {}
    |            ---                         ^^^^^^^^^^^^^^^^^^^^^
@@ -7,7 +7,7 @@ LL |     fn bar<'im: 'im>(&'im mut self) -> impl Sized + use<'im> {}
    |            this lifetime was captured
    |
 note: hidden type must only reference lifetimes captured by this impl trait
-  --> $DIR/rpitit-captures-more-method-lifetimes.rs:8:40
+  --> $DIR/rpitit-captures-more-method-lifetimes.rs:6:40
    |
 LL |     fn bar<'tr: 'tr>(&'tr mut self) -> impl Sized + use<Self>;
    |                                        ^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.rs b/tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.rs
index b16b0522d6e..115cab1cb99 100644
--- a/tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.rs
+++ b/tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.rs
@@ -1,5 +1,3 @@
-#![feature(precise_capturing_in_traits)]
-
 struct Invariant<'a>(&'a mut &'a mut ());
 
 trait Trait {
diff --git a/tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.stderr b/tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.stderr
index 360f0d7e7f3..123e0acf171 100644
--- a/tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.stderr
+++ b/tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.stderr
@@ -1,5 +1,5 @@
 error: return type captures more lifetimes than trait definition
-  --> $DIR/rpitit-impl-captures-too-much.rs:10:39
+  --> $DIR/rpitit-impl-captures-too-much.rs:8:39
    |
 LL |     fn hello(self_: Invariant<'_>) -> impl Sized + use<Self>;
    |                               -- this lifetime was captured
@@ -8,7 +8,7 @@ LL |     fn hello(self_: Invariant<'_>) -> impl Sized + use<'_> {}
    |                                       ^^^^^^^^^^^^^^^^^^^^
    |
 note: hidden type must only reference lifetimes captured by this impl trait
-  --> $DIR/rpitit-impl-captures-too-much.rs:6:39
+  --> $DIR/rpitit-impl-captures-too-much.rs:4:39
    |
 LL |     fn hello(self_: Invariant<'_>) -> impl Sized + use<Self>;
    |                                       ^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/impl-trait/precise-capturing/rpitit-outlives-2.rs b/tests/ui/impl-trait/precise-capturing/rpitit-outlives-2.rs
index 6f7e1a0eaef..6fc129a6480 100644
--- a/tests/ui/impl-trait/precise-capturing/rpitit-outlives-2.rs
+++ b/tests/ui/impl-trait/precise-capturing/rpitit-outlives-2.rs
@@ -2,8 +2,6 @@
 
 // Ensure that we skip uncaptured args from RPITITs when comptuing outlives.
 
-#![feature(precise_capturing_in_traits)]
-
 struct Invariant<T>(*mut T);
 
 trait Foo {
diff --git a/tests/ui/impl-trait/precise-capturing/rpitit-outlives.rs b/tests/ui/impl-trait/precise-capturing/rpitit-outlives.rs
index 94d81d766f7..616368d25cf 100644
--- a/tests/ui/impl-trait/precise-capturing/rpitit-outlives.rs
+++ b/tests/ui/impl-trait/precise-capturing/rpitit-outlives.rs
@@ -3,8 +3,6 @@
 // Ensure that we skip uncaptured args from RPITITs when collecting the regions
 // to enforce member constraints in opaque type inference.
 
-#![feature(precise_capturing_in_traits)]
-
 struct Invariant<T>(*mut T);
 
 trait Foo {
diff --git a/tests/ui/impl-trait/precise-capturing/rpitit.rs b/tests/ui/impl-trait/precise-capturing/rpitit.rs
index 3f887e8e47f..91c52817d85 100644
--- a/tests/ui/impl-trait/precise-capturing/rpitit.rs
+++ b/tests/ui/impl-trait/precise-capturing/rpitit.rs
@@ -3,8 +3,6 @@
 // To fix this soundly, we need to make sure that all the trait header args
 // remain captured, since they affect trait selection.
 
-#![feature(precise_capturing_in_traits)]
-
 fn eq_types<T>(_: T, _: T) {}
 
 trait TraitLt<'a: 'a> {
diff --git a/tests/ui/impl-trait/precise-capturing/rpitit.stderr b/tests/ui/impl-trait/precise-capturing/rpitit.stderr
index 498eae54a1c..ff461e81079 100644
--- a/tests/ui/impl-trait/precise-capturing/rpitit.stderr
+++ b/tests/ui/impl-trait/precise-capturing/rpitit.stderr
@@ -1,5 +1,5 @@
 error: `impl Trait` captures lifetime parameter, but it is not mentioned in `use<...>` precise captures list
-  --> $DIR/rpitit.rs:11:19
+  --> $DIR/rpitit.rs:9:19
    |
 LL | trait TraitLt<'a: 'a> {
    |               -- all lifetime parameters originating from a trait are captured implicitly
@@ -7,7 +7,7 @@ LL |     fn hello() -> impl Sized + use<Self>;
    |                   ^^^^^^^^^^^^^^^^^^^^^^
 
 error: lifetime may not live long enough
-  --> $DIR/rpitit.rs:15:5
+  --> $DIR/rpitit.rs:13:5
    |
 LL |   fn trait_lt<'a, 'b, T: for<'r> TraitLt<'r>> () {
    |               --  -- lifetime `'b` defined here
@@ -24,7 +24,7 @@ LL | |     );
    = help: consider adding the following bound: `'a: 'b`
 
 error: lifetime may not live long enough
-  --> $DIR/rpitit.rs:15:5
+  --> $DIR/rpitit.rs:13:5
    |
 LL |   fn trait_lt<'a, 'b, T: for<'r> TraitLt<'r>> () {
    |               --  -- lifetime `'b` defined here
diff --git a/tests/ui/impl-trait/precise-capturing/self-capture.rs b/tests/ui/impl-trait/precise-capturing/self-capture.rs
index 15985da50b5..66fbfc78043 100644
--- a/tests/ui/impl-trait/precise-capturing/self-capture.rs
+++ b/tests/ui/impl-trait/precise-capturing/self-capture.rs
@@ -1,7 +1,5 @@
 //@ check-pass
 
-#![feature(precise_capturing_in_traits)]
-
 trait Foo {
     fn bar<'a>() -> impl Sized + use<Self>;
 }
diff --git a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle-2.rs b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle-2.rs
index 0b29af5df5b..662c7ee2ecf 100644
--- a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle-2.rs
+++ b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle-2.rs
@@ -2,14 +2,12 @@
 
 //@ check-pass
 
-mod foo {
-    pub type Foo = impl PartialEq<(Foo, i32)>;
+pub type Foo = impl PartialEq<(Foo, i32)>;
 
-    fn foo() -> Foo {
-        super::Bar
-    }
+#[define_opaque(Foo)]
+fn foo() -> Foo {
+    Bar
 }
-use foo::Foo;
 
 struct Bar;
 
diff --git a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.rs b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.rs
index 3f41c5984b4..5b9c40ecede 100644
--- a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.rs
+++ b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.rs
@@ -6,6 +6,7 @@ mod a {
     struct Bar;
 
     impl PartialEq<(Bar, i32)> for Bar {
+        #[define_opaque(Foo)]
         fn eq(&self, _other: &(Foo, i32)) -> bool {
             //~^ ERROR: `eq` has an incompatible type for trait
             //~| ERROR: item does not constrain `a::Foo::{opaque#0}`
diff --git a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr
index 767bd312407..7f642fa1bed 100644
--- a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr
+++ b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr
@@ -1,5 +1,5 @@
 error[E0053]: method `eq` has an incompatible type for trait
-  --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:9:30
+  --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:10:30
    |
 LL |     type Foo = impl PartialEq<(Foo, i32)>;
    |                -------------------------- the found opaque type
@@ -15,21 +15,21 @@ LL -         fn eq(&self, _other: &(Foo, i32)) -> bool {
 LL +         fn eq(&self, _other: &(a::Bar, i32)) -> bool {
    |
 
-error: item does not constrain `a::Foo::{opaque#0}`, but has it in its signature
-  --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:9:12
+error: item does not constrain `a::Foo::{opaque#0}`
+  --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:10:12
    |
 LL |         fn eq(&self, _other: &(Foo, i32)) -> bool {
    |            ^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
   --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:4:16
    |
 LL |     type Foo = impl PartialEq<(Foo, i32)>;
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0053]: method `eq` has an incompatible type for trait
-  --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:24:30
+  --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:25:30
    |
 LL |     type Foo = impl PartialEq<(Foo, i32)>;
    |                -------------------------- the expected opaque type
@@ -39,8 +39,8 @@ LL |         fn eq(&self, _other: &(Bar, i32)) -> bool {
    |
    = note: expected signature `fn(&b::Bar, &(b::Foo, _)) -> _`
               found signature `fn(&b::Bar, &(b::Bar, _)) -> _`
-note: this item must have the opaque type in its signature in order to be able to register hidden types
-  --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:24:12
+note: this item must have a `#[define_opaque(b::Foo)]` attribute to be able to define hidden types
+  --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:25:12
    |
 LL |         fn eq(&self, _other: &(Bar, i32)) -> bool {
    |            ^^
@@ -51,12 +51,12 @@ LL +         fn eq(&self, _other: &(b::Foo, i32)) -> bool {
    |
 
 error: unconstrained opaque type
-  --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:18:16
+  --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:19:16
    |
 LL |     type Foo = impl PartialEq<(Foo, i32)>;
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: `Foo` must be used in combination with a concrete type within the same module
+   = note: `Foo` must be used in combination with a concrete type within the same crate
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.rs b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.rs
index aab10be2de2..372a095192b 100644
--- a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.rs
+++ b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.rs
@@ -10,6 +10,7 @@ impl PartialEq<(Bar, i32)> for Bar {
     }
 }
 
+#[define_opaque(Foo)]
 fn foo() -> Foo {
     //~^ ERROR can't compare `Bar` with `(Foo, i32)`
     Bar
diff --git a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.stderr b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.stderr
index bc810c0f88f..a9a5483caa9 100644
--- a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.stderr
+++ b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.stderr
@@ -1,5 +1,5 @@
 error[E0277]: can't compare `Bar` with `(Foo, i32)`
-  --> $DIR/recursive-type-alias-impl-trait-declaration.rs:13:13
+  --> $DIR/recursive-type-alias-impl-trait-declaration.rs:14:13
    |
 LL | fn foo() -> Foo {
    |             ^^^ no implementation for `Bar == (Foo, i32)`
diff --git a/tests/ui/impl-trait/two_tait_defining_each_other.current.stderr b/tests/ui/impl-trait/two_tait_defining_each_other.current.stderr
index bf194f997b4..8845b3ff2c8 100644
--- a/tests/ui/impl-trait/two_tait_defining_each_other.current.stderr
+++ b/tests/ui/impl-trait/two_tait_defining_each_other.current.stderr
@@ -1,5 +1,5 @@
 error: opaque type's hidden type cannot be another opaque type from the same scope
-  --> $DIR/two_tait_defining_each_other.rs:17:5
+  --> $DIR/two_tait_defining_each_other.rs:18:5
    |
 LL |     x // A's hidden type is `Bar`, because all the hidden types of `B` are compared with each other
    |     ^ one of the two opaque types used here has to be outside its defining scope
diff --git a/tests/ui/impl-trait/two_tait_defining_each_other.rs b/tests/ui/impl-trait/two_tait_defining_each_other.rs
index ebfe7f674be..d3038688eee 100644
--- a/tests/ui/impl-trait/two_tait_defining_each_other.rs
+++ b/tests/ui/impl-trait/two_tait_defining_each_other.rs
@@ -10,6 +10,7 @@ type B = impl Foo;
 
 trait Foo {}
 
+#[define_opaque(A, B)]
 fn muh(x: A) -> B {
     if false {
         return Bar; // B's hidden type is Bar
diff --git a/tests/ui/impl-trait/two_tait_defining_each_other2.current.stderr b/tests/ui/impl-trait/two_tait_defining_each_other2.current.stderr
index 7d02a0606fc..0711af1cad4 100644
--- a/tests/ui/impl-trait/two_tait_defining_each_other2.current.stderr
+++ b/tests/ui/impl-trait/two_tait_defining_each_other2.current.stderr
@@ -1,18 +1,18 @@
-error: item does not constrain `A::{opaque#0}`, but has it in its signature
-  --> $DIR/two_tait_defining_each_other2.rs:11:4
+error: item does not constrain `A::{opaque#0}`
+  --> $DIR/two_tait_defining_each_other2.rs:12:4
    |
 LL | fn muh(x: A) -> B {
    |    ^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
   --> $DIR/two_tait_defining_each_other2.rs:6:10
    |
 LL | type A = impl Foo;
    |          ^^^^^^^^
 
 error: opaque type's hidden type cannot be another opaque type from the same scope
-  --> $DIR/two_tait_defining_each_other2.rs:14:5
+  --> $DIR/two_tait_defining_each_other2.rs:15:5
    |
 LL |     x // B's hidden type is A (opaquely)
    |     ^ one of the two opaque types used here has to be outside its defining scope
diff --git a/tests/ui/impl-trait/two_tait_defining_each_other2.next.stderr b/tests/ui/impl-trait/two_tait_defining_each_other2.next.stderr
index 5316160125b..1a4c0f5f7ee 100644
--- a/tests/ui/impl-trait/two_tait_defining_each_other2.next.stderr
+++ b/tests/ui/impl-trait/two_tait_defining_each_other2.next.stderr
@@ -1,5 +1,5 @@
 error[E0284]: type annotations needed: cannot satisfy `_ == A`
-  --> $DIR/two_tait_defining_each_other2.rs:11:8
+  --> $DIR/two_tait_defining_each_other2.rs:12:8
    |
 LL | fn muh(x: A) -> B {
    |        ^ cannot satisfy `_ == A`
diff --git a/tests/ui/impl-trait/two_tait_defining_each_other2.rs b/tests/ui/impl-trait/two_tait_defining_each_other2.rs
index 1681b019418..a3223b07a7e 100644
--- a/tests/ui/impl-trait/two_tait_defining_each_other2.rs
+++ b/tests/ui/impl-trait/two_tait_defining_each_other2.rs
@@ -8,6 +8,7 @@ type B = impl Foo;
 
 trait Foo {}
 
+#[define_opaque(A, B)]
 fn muh(x: A) -> B {
     //[current]~^ ERROR: item does not constrain `A::{opaque#0}`
     //[next]~^^ ERROR: cannot satisfy `_ == A`
diff --git a/tests/ui/impl-trait/two_tait_defining_each_other3.current.stderr b/tests/ui/impl-trait/two_tait_defining_each_other3.current.stderr
index fa353a77536..7b0003ff59b 100644
--- a/tests/ui/impl-trait/two_tait_defining_each_other3.current.stderr
+++ b/tests/ui/impl-trait/two_tait_defining_each_other3.current.stderr
@@ -1,5 +1,5 @@
 error: opaque type's hidden type cannot be another opaque type from the same scope
-  --> $DIR/two_tait_defining_each_other3.rs:14:16
+  --> $DIR/two_tait_defining_each_other3.rs:15:16
    |
 LL |         return x;  // B's hidden type is A (opaquely)
    |                ^ one of the two opaque types used here has to be outside its defining scope
diff --git a/tests/ui/impl-trait/two_tait_defining_each_other3.rs b/tests/ui/impl-trait/two_tait_defining_each_other3.rs
index 33695d8ed80..ec3cd58a3a5 100644
--- a/tests/ui/impl-trait/two_tait_defining_each_other3.rs
+++ b/tests/ui/impl-trait/two_tait_defining_each_other3.rs
@@ -9,6 +9,7 @@ type B = impl Foo;
 
 trait Foo {}
 
+#[define_opaque(A, B)]
 fn muh(x: A) -> B {
     if false {
         return x;  // B's hidden type is A (opaquely)
diff --git a/tests/ui/impl-trait/type-alias-impl-trait-in-fn-body.rs b/tests/ui/impl-trait/type-alias-impl-trait-in-fn-body.rs
index 4879d2db40b..77b2407e304 100644
--- a/tests/ui/impl-trait/type-alias-impl-trait-in-fn-body.rs
+++ b/tests/ui/impl-trait/type-alias-impl-trait-in-fn-body.rs
@@ -9,6 +9,7 @@ fn main() {
     //~^ ERROR: item does not constrain
     type Existential = impl Debug;
 
+    #[define_opaque(Existential)]
     fn f() -> Existential {}
     println!("{:?}", f());
 }
diff --git a/tests/ui/impl-trait/type-alias-impl-trait-in-fn-body.stderr b/tests/ui/impl-trait/type-alias-impl-trait-in-fn-body.stderr
index 7744fa2f2ae..0877b4b71be 100644
--- a/tests/ui/impl-trait/type-alias-impl-trait-in-fn-body.stderr
+++ b/tests/ui/impl-trait/type-alias-impl-trait-in-fn-body.stderr
@@ -1,11 +1,11 @@
-error: item does not constrain `Existential::{opaque#0}`, but has it in its signature
+error: item does not constrain `Existential::{opaque#0}`
   --> $DIR/type-alias-impl-trait-in-fn-body.rs:8:4
    |
 LL | fn main() {
    |    ^^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
   --> $DIR/type-alias-impl-trait-in-fn-body.rs:10:24
    |
 LL |     type Existential = impl Debug;
diff --git a/tests/ui/impl-trait/where-allowed.rs b/tests/ui/impl-trait/where-allowed.rs
index 3f435f0f443..1c3c66c537f 100644
--- a/tests/ui/impl-trait/where-allowed.rs
+++ b/tests/ui/impl-trait/where-allowed.rs
@@ -157,6 +157,7 @@ extern "C" fn in_extern_fn_return() -> impl Debug {
 
 type InTypeAlias<R> = impl Debug;
 //~^ ERROR `impl Trait` in type aliases is unstable
+//~| ERROR unconstrained opaque type
 
 type InReturnInTypeAlias<R> = fn() -> impl Debug;
 //~^ ERROR `impl Trait` is not allowed in `fn` pointer
diff --git a/tests/ui/impl-trait/where-allowed.stderr b/tests/ui/impl-trait/where-allowed.stderr
index ebce9b7e445..052ae5a9931 100644
--- a/tests/ui/impl-trait/where-allowed.stderr
+++ b/tests/ui/impl-trait/where-allowed.stderr
@@ -37,7 +37,7 @@ LL | type InTypeAlias<R> = impl Debug;
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0658]: `impl Trait` in type aliases is unstable
-  --> $DIR/where-allowed.rs:161:39
+  --> $DIR/where-allowed.rs:162:39
    |
 LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
    |                                       ^^^^^^^^^^
@@ -199,7 +199,7 @@ LL |     fn in_foreign_return() -> impl Debug;
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in `fn` pointer return types
-  --> $DIR/where-allowed.rs:161:39
+  --> $DIR/where-allowed.rs:162:39
    |
 LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
    |                                       ^^^^^^^^^^
@@ -207,7 +207,7 @@ LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in traits
-  --> $DIR/where-allowed.rs:166:16
+  --> $DIR/where-allowed.rs:167:16
    |
 LL | impl PartialEq<impl Debug> for () {
    |                ^^^^^^^^^^
@@ -215,7 +215,7 @@ LL | impl PartialEq<impl Debug> for () {
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in impl headers
-  --> $DIR/where-allowed.rs:171:24
+  --> $DIR/where-allowed.rs:172:24
    |
 LL | impl PartialEq<()> for impl Debug {
    |                        ^^^^^^^^^^
@@ -223,7 +223,7 @@ LL | impl PartialEq<()> for impl Debug {
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in impl headers
-  --> $DIR/where-allowed.rs:176:6
+  --> $DIR/where-allowed.rs:177:6
    |
 LL | impl impl Debug {
    |      ^^^^^^^^^^
@@ -231,7 +231,7 @@ LL | impl impl Debug {
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in impl headers
-  --> $DIR/where-allowed.rs:182:24
+  --> $DIR/where-allowed.rs:183:24
    |
 LL | impl InInherentImplAdt<impl Debug> {
    |                        ^^^^^^^^^^
@@ -239,7 +239,7 @@ LL | impl InInherentImplAdt<impl Debug> {
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in bounds
-  --> $DIR/where-allowed.rs:188:11
+  --> $DIR/where-allowed.rs:189:11
    |
 LL |     where impl Debug: Debug
    |           ^^^^^^^^^^
@@ -247,7 +247,7 @@ LL |     where impl Debug: Debug
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in bounds
-  --> $DIR/where-allowed.rs:195:15
+  --> $DIR/where-allowed.rs:196:15
    |
 LL |     where Vec<impl Debug>: Debug
    |               ^^^^^^^^^^
@@ -255,7 +255,7 @@ LL |     where Vec<impl Debug>: Debug
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in bounds
-  --> $DIR/where-allowed.rs:202:24
+  --> $DIR/where-allowed.rs:203:24
    |
 LL |     where T: PartialEq<impl Debug>
    |                        ^^^^^^^^^^
@@ -263,7 +263,7 @@ LL |     where T: PartialEq<impl Debug>
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in the parameters of `Fn` trait bounds
-  --> $DIR/where-allowed.rs:209:17
+  --> $DIR/where-allowed.rs:210:17
    |
 LL |     where T: Fn(impl Debug)
    |                 ^^^^^^^^^^
@@ -271,7 +271,7 @@ LL |     where T: Fn(impl Debug)
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in the return type of `Fn` trait bounds
-  --> $DIR/where-allowed.rs:216:22
+  --> $DIR/where-allowed.rs:217:22
    |
 LL |     where T: Fn() -> impl Debug
    |                      ^^^^^^^^^^
@@ -279,7 +279,7 @@ LL |     where T: Fn() -> impl Debug
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in generic parameter defaults
-  --> $DIR/where-allowed.rs:222:40
+  --> $DIR/where-allowed.rs:223:40
    |
 LL | struct InStructGenericParamDefault<T = impl Debug>(T);
    |                                        ^^^^^^^^^^
@@ -287,7 +287,7 @@ LL | struct InStructGenericParamDefault<T = impl Debug>(T);
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in generic parameter defaults
-  --> $DIR/where-allowed.rs:226:36
+  --> $DIR/where-allowed.rs:227:36
    |
 LL | enum InEnumGenericParamDefault<T = impl Debug> { Variant(T) }
    |                                    ^^^^^^^^^^
@@ -295,7 +295,7 @@ LL | enum InEnumGenericParamDefault<T = impl Debug> { Variant(T) }
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in generic parameter defaults
-  --> $DIR/where-allowed.rs:230:38
+  --> $DIR/where-allowed.rs:231:38
    |
 LL | trait InTraitGenericParamDefault<T = impl Debug> {}
    |                                      ^^^^^^^^^^
@@ -303,7 +303,7 @@ LL | trait InTraitGenericParamDefault<T = impl Debug> {}
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in generic parameter defaults
-  --> $DIR/where-allowed.rs:234:41
+  --> $DIR/where-allowed.rs:235:41
    |
 LL | type InTypeAliasGenericParamDefault<T = impl Debug> = T;
    |                                         ^^^^^^^^^^
@@ -311,7 +311,7 @@ LL | type InTypeAliasGenericParamDefault<T = impl Debug> = T;
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in generic parameter defaults
-  --> $DIR/where-allowed.rs:238:11
+  --> $DIR/where-allowed.rs:239:11
    |
 LL | impl <T = impl Debug> T {}
    |           ^^^^^^^^^^
@@ -319,7 +319,7 @@ LL | impl <T = impl Debug> T {}
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in generic parameter defaults
-  --> $DIR/where-allowed.rs:245:40
+  --> $DIR/where-allowed.rs:246:40
    |
 LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
    |                                        ^^^^^^^^^^
@@ -327,7 +327,7 @@ LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in the type of variable bindings
-  --> $DIR/where-allowed.rs:251:29
+  --> $DIR/where-allowed.rs:252:29
    |
 LL |     let _in_local_variable: impl Fn() = || {};
    |                             ^^^^^^^^^
@@ -338,7 +338,7 @@ LL |     let _in_local_variable: impl Fn() = || {};
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0562]: `impl Trait` is not allowed in closure return types
-  --> $DIR/where-allowed.rs:253:46
+  --> $DIR/where-allowed.rs:254:46
    |
 LL |     let _in_return_in_local_variable = || -> impl Fn() { || {} };
    |                                              ^^^^^^^^^
@@ -369,7 +369,7 @@ LL +     fn in_trait_impl_return() -> <() as DummyTrait>::Out { () }
    |
 
 error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
-  --> $DIR/where-allowed.rs:245:36
+  --> $DIR/where-allowed.rs:246:36
    |
 LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
    |                                    ^^^^^^^^^^^^^^
@@ -379,7 +379,7 @@ LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
    = note: `#[deny(invalid_type_param_default)]` on by default
 
 error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
-  --> $DIR/where-allowed.rs:238:7
+  --> $DIR/where-allowed.rs:239:7
    |
 LL | impl <T = impl Debug> T {}
    |       ^^^^^^^^^^^^^^
@@ -408,7 +408,7 @@ LL | fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { pani
              where Args: Tuple, F: Fn<Args>, A: Allocator, F: ?Sized;
 
 error[E0118]: no nominal type found for inherent implementation
-  --> $DIR/where-allowed.rs:238:1
+  --> $DIR/where-allowed.rs:239:1
    |
 LL | impl <T = impl Debug> T {}
    | ^^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type
@@ -423,13 +423,21 @@ LL |     type Out = impl Debug;
    |
    = note: `Out` must be used in combination with a concrete type within the same impl
 
-error: aborting due to 49 previous errors
+error: unconstrained opaque type
+  --> $DIR/where-allowed.rs:158:23
+   |
+LL | type InTypeAlias<R> = impl Debug;
+   |                       ^^^^^^^^^^
+   |
+   = note: `InTypeAlias` must be used in combination with a concrete type within the same crate
+
+error: aborting due to 50 previous errors
 
 Some errors have detailed explanations: E0053, E0118, E0283, E0562, E0658, E0666.
 For more information about an error, try `rustc --explain E0053`.
 Future incompatibility report: Future breakage diagnostic:
 error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
-  --> $DIR/where-allowed.rs:245:36
+  --> $DIR/where-allowed.rs:246:36
    |
 LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
    |                                    ^^^^^^^^^^^^^^
@@ -440,7 +448,7 @@ LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
 
 Future breakage diagnostic:
 error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
-  --> $DIR/where-allowed.rs:238:7
+  --> $DIR/where-allowed.rs:239:7
    |
 LL | impl <T = impl Debug> T {}
    |       ^^^^^^^^^^^^^^
diff --git a/tests/ui/implied-bounds/dyn-erasure-tait.rs b/tests/ui/implied-bounds/dyn-erasure-tait.rs
index 4766d221d67..1744e529393 100644
--- a/tests/ui/implied-bounds/dyn-erasure-tait.rs
+++ b/tests/ui/implied-bounds/dyn-erasure-tait.rs
@@ -14,6 +14,7 @@ type T<'lt> = &'lt str;
 
 type F<'a, 'b> = impl 'static + Fn(T<'a>) -> T<'b>;
 
+#[define_opaque(F)]
 fn helper<'a, 'b>(_: [&'b &'a (); 0]) -> F<'a, 'b> {
     |x: T<'a>| -> T<'b> { x } // this should *not* be `: 'static`
 }
diff --git a/tests/ui/include-macros/mismatched-types.stderr b/tests/ui/include-macros/mismatched-types.stderr
index 9bc0e64464e..8d541966a6a 100644
--- a/tests/ui/include-macros/mismatched-types.stderr
+++ b/tests/ui/include-macros/mismatched-types.stderr
@@ -11,7 +11,6 @@ LL |     let b: &[u8] = include_str!("file.txt");
    |
    = note: expected reference `&[u8]`
               found reference `&'static str`
-   = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0308]: mismatched types
   --> $DIR/mismatched-types.rs:3:19
@@ -23,7 +22,6 @@ LL |     let s: &str = include_bytes!("file.txt");
    |
    = note: expected reference `&str`
               found reference `&'static [u8; 0]`
-   = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/include-macros/parent_dir.stderr b/tests/ui/include-macros/parent_dir.stderr
index d0a1f4fd3b9..4ee6fe104b0 100644
--- a/tests/ui/include-macros/parent_dir.stderr
+++ b/tests/ui/include-macros/parent_dir.stderr
@@ -4,7 +4,6 @@ error: couldn't read `$DIR/include-macros/file.txt`: $FILE_NOT_FOUND_MSG
 LL |     let _ = include_str!("include-macros/file.txt");
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: there is a file with the same name in a different directory
    |
 LL -     let _ = include_str!("include-macros/file.txt");
@@ -17,7 +16,6 @@ error: couldn't read `$DIR/hello.rs`: $FILE_NOT_FOUND_MSG
 LL |     let _ = include_str!("hello.rs");
    |             ^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: there is a file with the same name in a different directory
    |
 LL |     let _ = include_str!("../hello.rs");
@@ -29,7 +27,6 @@ error: couldn't read `$DIR/../../data.bin`: $FILE_NOT_FOUND_MSG
 LL |     let _ = include_bytes!("../../data.bin");
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: there is a file with the same name in a different directory
    |
 LL -     let _ = include_bytes!("../../data.bin");
@@ -42,7 +39,6 @@ error: couldn't read `$DIR/tests/ui/include-macros/file.txt`: $FILE_NOT_FOUND_MS
 LL |     let _ = include_str!("tests/ui/include-macros/file.txt");
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: there is a file with the same name in a different directory
    |
 LL -     let _ = include_str!("tests/ui/include-macros/file.txt");
diff --git a/tests/ui/infinite/infinite-struct.rs b/tests/ui/infinite/infinite-struct.rs
index 62f9702b9f4..fd47a4ec9cc 100644
--- a/tests/ui/infinite/infinite-struct.rs
+++ b/tests/ui/infinite/infinite-struct.rs
@@ -15,3 +15,5 @@ struct Foo { //~ ERROR has infinite size
 struct Bar<T>([T; 1]);
 
 fn main() {}
+
+//~? ERROR reached the recursion limit finding the struct tail for `Take`
diff --git a/tests/ui/inline-const/const-expr-generic-err.stderr b/tests/ui/inline-const/const-expr-generic-err.stderr
index e67c0b28e02..a40e8bceb36 100644
--- a/tests/ui/inline-const/const-expr-generic-err.stderr
+++ b/tests/ui/inline-const/const-expr-generic-err.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `foo::<i32>::{constant#0}` failed
    |
 LL |     const { assert!(std::mem::size_of::<T>() == 0); }
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: assertion failed: std::mem::size_of::<T>() == 0
-   |
-   = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/const-expr-generic-err.rs:4:5
diff --git a/tests/ui/inline-const/required-const.stderr b/tests/ui/inline-const/required-const.stderr
index a6c630b5477..2f618e54ed3 100644
--- a/tests/ui/inline-const/required-const.stderr
+++ b/tests/ui/inline-const/required-const.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `foo::<i32>::{constant#0}` failed
    |
 LL |         const { panic!() }
    |                 ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/required-const.rs:6:9
diff --git a/tests/ui/instrument-coverage/bad-value.rs b/tests/ui/instrument-coverage/bad-value.rs
index 34417385291..d44f982ea46 100644
--- a/tests/ui/instrument-coverage/bad-value.rs
+++ b/tests/ui/instrument-coverage/bad-value.rs
@@ -3,3 +3,6 @@
 //@ [bad] compile-flags: -Cinstrument-coverage=bad-value
 
 fn main() {}
+
+//[blank]~? ERROR incorrect value `` for codegen option `instrument-coverage`
+//[bad]~? ERROR incorrect value `bad-value` for codegen option `instrument-coverage`
diff --git a/tests/ui/instrument-coverage/coverage-options.rs b/tests/ui/instrument-coverage/coverage-options.rs
index 7615a0fb275..c3eae9625da 100644
--- a/tests/ui/instrument-coverage/coverage-options.rs
+++ b/tests/ui/instrument-coverage/coverage-options.rs
@@ -17,3 +17,5 @@
 //@ [bad] compile-flags: -Zcoverage-options=bad
 
 fn main() {}
+
+//[bad]~? ERROR incorrect value `bad` for unstable option `coverage-options`
diff --git a/tests/ui/invalid-compile-flags/branch-protection-missing-pac-ret.rs b/tests/ui/invalid-compile-flags/branch-protection-missing-pac-ret.rs
index b4025080034..2a39d579c51 100644
--- a/tests/ui/invalid-compile-flags/branch-protection-missing-pac-ret.rs
+++ b/tests/ui/invalid-compile-flags/branch-protection-missing-pac-ret.rs
@@ -15,3 +15,7 @@
 
 #[lang = "sized"]
 trait Sized {}
+
+//[BADFLAGS]~? ERROR incorrect value `leaf` for unstable option `branch-protection`
+//[BADFLAGSPC]~? ERROR incorrect value `pc` for unstable option `branch-protection`
+//[BADTARGET]~? ERROR `-Zbranch-protection` is only supported on aarch64
diff --git a/tests/ui/invalid-compile-flags/crate-type-flag.empty_crate_type.stderr b/tests/ui/invalid-compile-flags/crate-type-flag.empty_crate_type.stderr
index 0f8772024df..4ab816d30f6 100644
--- a/tests/ui/invalid-compile-flags/crate-type-flag.empty_crate_type.stderr
+++ b/tests/ui/invalid-compile-flags/crate-type-flag.empty_crate_type.stderr
@@ -1,2 +1,2 @@
-error: unknown crate type: ``
+error: unknown crate type: ``, expected one of: `lib`, `rlib`, `staticlib`, `dylib`, `cdylib`, `bin`, `proc-macro`
 
diff --git a/tests/ui/invalid-compile-flags/crate-type-flag.proc_underscore_macro.stderr b/tests/ui/invalid-compile-flags/crate-type-flag.proc_underscore_macro.stderr
index a4a97416996..91cc66801f1 100644
--- a/tests/ui/invalid-compile-flags/crate-type-flag.proc_underscore_macro.stderr
+++ b/tests/ui/invalid-compile-flags/crate-type-flag.proc_underscore_macro.stderr
@@ -1,2 +1,2 @@
-error: unknown crate type: `proc_macro`
+error: unknown crate type: `proc_macro`, expected one of: `lib`, `rlib`, `staticlib`, `dylib`, `cdylib`, `bin`, `proc-macro`
 
diff --git a/tests/ui/invalid-compile-flags/crate-type-flag.rs b/tests/ui/invalid-compile-flags/crate-type-flag.rs
index 07d853b3307..01014307149 100644
--- a/tests/ui/invalid-compile-flags/crate-type-flag.rs
+++ b/tests/ui/invalid-compile-flags/crate-type-flag.rs
@@ -45,16 +45,16 @@
 // `proc-macro` is accepted, but `proc_macro` is not.
 //@ revisions: proc_underscore_macro
 //@[proc_underscore_macro] compile-flags: --crate-type=proc_macro
-//@[proc_underscore_macro] error-pattern: "unknown crate type: `proc_macro`"
+//@[proc_underscore_macro] error-pattern: unknown crate type: `proc_macro`
 
 // Empty `--crate-type` not accepted.
 //@ revisions: empty_crate_type
 //@[empty_crate_type] compile-flags: --crate-type=
-//@[empty_crate_type] error-pattern: "unknown crate type: ``"
+//@[empty_crate_type] error-pattern: unknown crate type: ``
 
 // Random unknown crate type. Also check that we can handle non-ASCII.
 //@ revisions: unknown
 //@[unknown] compile-flags: --crate-type=🤡
-//@[unknown] error-pattern: "unknown crate type: `🤡`"
+//@[unknown] error-pattern: unknown crate type: `🤡`
 
 fn main() {}
diff --git a/tests/ui/invalid-compile-flags/crate-type-flag.unknown.stderr b/tests/ui/invalid-compile-flags/crate-type-flag.unknown.stderr
index 7fb0f09a1af..ec202e171f0 100644
--- a/tests/ui/invalid-compile-flags/crate-type-flag.unknown.stderr
+++ b/tests/ui/invalid-compile-flags/crate-type-flag.unknown.stderr
@@ -1,2 +1,2 @@
-error: unknown crate type: `🤡`
+error: unknown crate type: `🤡`, expected one of: `lib`, `rlib`, `staticlib`, `dylib`, `cdylib`, `bin`, `proc-macro`
 
diff --git a/tests/ui/invalid-compile-flags/invalid-llvm-passes.rs b/tests/ui/invalid-compile-flags/invalid-llvm-passes.rs
index ddb46e59711..832821c9c88 100644
--- a/tests/ui/invalid-compile-flags/invalid-llvm-passes.rs
+++ b/tests/ui/invalid-compile-flags/invalid-llvm-passes.rs
@@ -2,3 +2,5 @@
 //@ compile-flags: -Cpasses=unknown-pass
 
 fn main() {}
+
+//~? ERROR failed to run LLVM passes: unknown pass name 'unknown-pass'
diff --git a/tests/ui/invalid-compile-flags/need-crate-arg-ignore-tidy$x.rs b/tests/ui/invalid-compile-flags/need-crate-arg-ignore-tidy$x.rs
index b1ac4a4ae21..0e80b1dd178 100644
--- a/tests/ui/invalid-compile-flags/need-crate-arg-ignore-tidy$x.rs
+++ b/tests/ui/invalid-compile-flags/need-crate-arg-ignore-tidy$x.rs
@@ -1,2 +1,5 @@
 // issue: 113981
+
 pub fn main() {}
+
+//~? ERROR invalid character '$' in crate name: `need_crate_arg_ignore_tidy$x`
diff --git a/tests/ui/invalid-compile-flags/print-without-arg.stderr b/tests/ui/invalid-compile-flags/print-without-arg.stderr
index 05d42247d41..aa8a2ae42db 100644
--- a/tests/ui/invalid-compile-flags/print-without-arg.stderr
+++ b/tests/ui/invalid-compile-flags/print-without-arg.stderr
@@ -1,5 +1,5 @@
 error: Argument to option 'print' missing
        Usage:
-           --print [all-target-specs-json|calling-conventions|cfg|check-cfg|code-models|crate-name|deployment-target|file-names|host-tuple|link-args|native-static-libs|relocation-models|split-debuginfo|stack-protector-strategies|sysroot|target-cpus|target-features|target-libdir|target-list|target-spec-json|tls-models]
+           --print [all-target-specs-json|calling-conventions|cfg|check-cfg|code-models|crate-name|deployment-target|file-names|host-tuple|link-args|native-static-libs|relocation-models|split-debuginfo|stack-protector-strategies|supported-crate-types|sysroot|target-cpus|target-features|target-libdir|target-list|target-spec-json|tls-models]
                                Compiler information to print on stdout
 
diff --git a/tests/ui/invalid-compile-flags/print.rs b/tests/ui/invalid-compile-flags/print.rs
index 0d0a9d22750..4665bb2c536 100644
--- a/tests/ui/invalid-compile-flags/print.rs
+++ b/tests/ui/invalid-compile-flags/print.rs
@@ -1 +1,3 @@
 //@ compile-flags: --print yyyy
+
+//~? ERROR unknown print request: `yyyy`
diff --git a/tests/ui/invalid-compile-flags/print.stderr b/tests/ui/invalid-compile-flags/print.stderr
index df0c3977dc8..f9cfb1616ce 100644
--- a/tests/ui/invalid-compile-flags/print.stderr
+++ b/tests/ui/invalid-compile-flags/print.stderr
@@ -1,4 +1,5 @@
 error: unknown print request: `yyyy`
   |
-  = help: valid print requests are: `all-target-specs-json`, `calling-conventions`, `cfg`, `check-cfg`, `code-models`, `crate-name`, `deployment-target`, `file-names`, `host-tuple`, `link-args`, `native-static-libs`, `relocation-models`, `split-debuginfo`, `stack-protector-strategies`, `sysroot`, `target-cpus`, `target-features`, `target-libdir`, `target-list`, `target-spec-json`, `tls-models`
+  = help: valid print requests are: `all-target-specs-json`, `calling-conventions`, `cfg`, `check-cfg`, `code-models`, `crate-name`, `deployment-target`, `file-names`, `host-tuple`, `link-args`, `native-static-libs`, `relocation-models`, `split-debuginfo`, `stack-protector-strategies`, `supported-crate-types`, `sysroot`, `target-cpus`, `target-features`, `target-libdir`, `target-list`, `target-spec-json`, `tls-models`
+  = help: for more information, see the rustc book: https://doc.rust-lang.org/rustc/command-line-arguments.html#--print-print-compiler-information
 
diff --git a/tests/ui/invalid-module-declaration/invalid-module-declaration.rs b/tests/ui/invalid-module-declaration/invalid-module-declaration.rs
index 254d810d79d..1c6c282f4b7 100644
--- a/tests/ui/invalid-module-declaration/invalid-module-declaration.rs
+++ b/tests/ui/invalid-module-declaration/invalid-module-declaration.rs
@@ -3,3 +3,5 @@ mod auxiliary {
 }
 
 fn main() {}
+
+//~? ERROR file not found for module `baz`
diff --git a/tests/ui/issues/issue-14091-2.stderr b/tests/ui/issues/issue-14091-2.stderr
index ac894767059..d573a0917be 100644
--- a/tests/ui/issues/issue-14091-2.stderr
+++ b/tests/ui/issues/issue-14091-2.stderr
@@ -11,7 +11,6 @@ LL | pub struct BytePos(pub u32);
    | ^^^^^^^^^^^^^^^^^^ must implement `Not`
 note: the trait `Not` must be implemented
   --> $SRC_DIR/core/src/ops/bit.rs:LL:COL
-   = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/issues/issue-18183.stderr b/tests/ui/issues/issue-18183.stderr
index 11015d75d97..07fa4cdc753 100644
--- a/tests/ui/issues/issue-18183.stderr
+++ b/tests/ui/issues/issue-18183.stderr
@@ -1,8 +1,8 @@
-error[E0128]: generic parameters with a default cannot use forward declared identifiers
+error[E0128]: generic parameter defaults cannot reference parameters before they are declared
   --> $DIR/issue-18183.rs:1:20
    |
 LL | pub struct Foo<Bar=Bar>(Bar);
-   |                    ^^^ defaulted generic parameters cannot be forward declared
+   |                    ^^^ cannot reference `Bar` before it is declared
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/issues/issue-21160.stderr b/tests/ui/issues/issue-21160.stderr
index 892a4530ebc..f1145a0a7c1 100644
--- a/tests/ui/issues/issue-21160.stderr
+++ b/tests/ui/issues/issue-21160.stderr
@@ -6,7 +6,6 @@ LL | #[derive(Hash)]
 LL | struct Foo(Bar);
    |            ^^^ the trait `Hash` is not implemented for `Bar`
    |
-   = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Bar` with `#[derive(Hash)]`
    |
 LL + #[derive(Hash)]
diff --git a/tests/ui/issues/issue-26812.rs b/tests/ui/issues/issue-26812.rs
index e0723e016b3..8eb030a8ec9 100644
--- a/tests/ui/issues/issue-26812.rs
+++ b/tests/ui/issues/issue-26812.rs
@@ -1,5 +1,5 @@
 fn avg<T=T::Item>(_: T) {}
-//~^ ERROR generic parameters with a default cannot use forward declared identifiers
+//~^ ERROR generic parameter defaults cannot reference parameters before they are declared
 //~| ERROR defaults for type parameters
 //~| WARN previously accepted
 
diff --git a/tests/ui/issues/issue-26812.stderr b/tests/ui/issues/issue-26812.stderr
index 4a18b23fd8b..bb60d67e287 100644
--- a/tests/ui/issues/issue-26812.stderr
+++ b/tests/ui/issues/issue-26812.stderr
@@ -1,8 +1,8 @@
-error[E0128]: generic parameters with a default cannot use forward declared identifiers
+error[E0128]: generic parameter defaults cannot reference parameters before they are declared
   --> $DIR/issue-26812.rs:1:10
    |
 LL | fn avg<T=T::Item>(_: T) {}
-   |          ^^^^^^^ defaulted generic parameters cannot be forward declared
+   |          ^^^^^^^ cannot reference `T` before it is declared
 
 error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
   --> $DIR/issue-26812.rs:1:8
diff --git a/tests/ui/issues/issue-27340.stderr b/tests/ui/issues/issue-27340.stderr
index 61ae660f4cf..d5ff29a618b 100644
--- a/tests/ui/issues/issue-27340.stderr
+++ b/tests/ui/issues/issue-27340.stderr
@@ -6,8 +6,6 @@ LL | #[derive(Copy, Clone)]
 LL |
 LL | struct Bar(Foo);
    |            --- this field does not implement `Copy`
-   |
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `Foo: Clone` is not satisfied
   --> $DIR/issue-27340.rs:4:12
@@ -20,7 +18,6 @@ LL | struct Bar(Foo);
    |
 note: required by a bound in `AssertParamIsClone`
   --> $SRC_DIR/core/src/clone.rs:LL:COL
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Foo` with `#[derive(Clone)]`
    |
 LL + #[derive(Clone)]
diff --git a/tests/ui/issues/issue-27592.stderr b/tests/ui/issues/issue-27592.stderr
index 1205a8b656b..c8649d82d74 100644
--- a/tests/ui/issues/issue-27592.stderr
+++ b/tests/ui/issues/issue-27592.stderr
@@ -6,16 +6,12 @@ LL |     write(|| format_args!("{}", String::from("Hello world")));
    |              |                  |
    |              |                  temporary value created here
    |              returns a value referencing data owned by the current function
-   |
-   = note: this error originates in the macro `format_args` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0515]: cannot return reference to temporary value
   --> $DIR/issue-27592.rs:16:14
    |
 LL |     write(|| format_args!("{}", String::from("Hello world")));
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returns a reference to data owned by the current function
-   |
-   = note: this error originates in the macro `format_args` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/issues/issue-28777.rs b/tests/ui/issues/issue-28777.rs
deleted file mode 100644
index f67e11e3694..00000000000
--- a/tests/ui/issues/issue-28777.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-//@ run-pass
-#![allow(unused_braces)]
-fn main() {
-    let v1 = { 1 + {2} * {3} };
-    let v2 =   1 + {2} * {3}  ;
-
-    assert_eq!(7, v1);
-    assert_eq!(7, v2);
-
-    let v3;
-    v3 = { 1 + {2} * {3} };
-    let v4;
-    v4 = 1 + {2} * {3};
-    assert_eq!(7, v3);
-    assert_eq!(7, v4);
-
-    let v5 = { 1 + {2} * 3 };
-    assert_eq!(7, v5);
-
-    let v9 = { 1 + if 1 > 2 {1} else {2} * {3} };
-    assert_eq!(7, v9);
-}
diff --git a/tests/ui/issues/issue-31260.rs b/tests/ui/issues/issue-31260.rs
deleted file mode 100644
index 5e9fffb195c..00000000000
--- a/tests/ui/issues/issue-31260.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-//@ check-pass
-#![allow(dead_code)]
-pub struct Struct<K: 'static> {
-    pub field: K,
-}
-
-static STRUCT: Struct<&'static [u8]> = Struct {
-    field: {&[1]}
-};
-
-static STRUCT2: Struct<&'static [u8]> = Struct {
-    field: &[1]
-};
-
-fn main() {}
diff --git a/tests/ui/issues/issue-32950.stderr b/tests/ui/issues/issue-32950.stderr
index f6635d982e4..3cdf35af1d8 100644
--- a/tests/ui/issues/issue-32950.stderr
+++ b/tests/ui/issues/issue-32950.stderr
@@ -9,8 +9,6 @@ error[E0412]: cannot find type `FooBar` in this scope
    |
 LL |     concat_idents!(Foo, Bar)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
-   |
-   = note: this error originates in the macro `concat_idents` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/issues/issue-34229.stderr b/tests/ui/issues/issue-34229.stderr
index e6aa0d25934..2385284de0b 100644
--- a/tests/ui/issues/issue-34229.stderr
+++ b/tests/ui/issues/issue-34229.stderr
@@ -7,7 +7,6 @@ LL | #[derive(PartialEq, PartialOrd)] struct Nope(Comparable);
    |                     in this derive macro expansion
    |
    = help: the trait `PartialOrd` is not implemented for `Comparable`
-   = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Comparable` with `#[derive(PartialOrd)]`
    |
 LL | #[derive(PartialEq)] #[derive(PartialOrd)]
diff --git a/tests/ui/issues/issue-76191.stderr b/tests/ui/issues/issue-76191.stderr
index de08fc4ed0d..ac1bdfaa847 100644
--- a/tests/ui/issues/issue-76191.stderr
+++ b/tests/ui/issues/issue-76191.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of constant value failed
    |
 LL | const RANGE2: RangeInclusive<i32> = panic!();
    |                                     ^^^^^^^^ evaluation panicked: explicit panic
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0308]: mismatched types
   --> $DIR/issue-76191.rs:14:9
diff --git a/tests/ui/issues/issue-9382.rs b/tests/ui/issues/issue-9382.rs
deleted file mode 100644
index 27f9ab57743..00000000000
--- a/tests/ui/issues/issue-9382.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-//@ run-pass
-#![allow(dead_code)]
-
-// Tests for a previous bug that occurred due to an interaction
-// between struct field initialization and the auto-coercion
-// from a vector to a slice. The drop glue was being invoked on
-// the temporary slice with a wrong type, triggering an LLVM assert.
-
-
-struct Thing1<'a> {
-    baz: &'a [Box<isize>],
-    bar: Box<u64>,
-}
-
-struct Thing2<'a> {
-    baz: &'a [Box<isize>],
-    bar: u64,
-}
-
-pub fn main() {
-    let _t1_fixed = Thing1 {
-        baz: &[],
-        bar: Box::new(32),
-    };
-    Thing1 {
-        baz: &Vec::new(),
-        bar: Box::new(32),
-    };
-    let _t2_fixed = Thing2 {
-        baz: &[],
-        bar: 32,
-    };
-    Thing2 {
-        baz: &Vec::new(),
-        bar: 32,
-    };
-}
diff --git a/tests/ui/lang-items/lang-item-generic-requirements.rs b/tests/ui/lang-items/lang-item-generic-requirements.rs
index 0f982df61e8..90ed5f3f0ef 100644
--- a/tests/ui/lang-items/lang-item-generic-requirements.rs
+++ b/tests/ui/lang-items/lang-item-generic-requirements.rs
@@ -59,3 +59,5 @@ fn ice() {
 
 // use `start`
 fn main() {}
+
+//~? ERROR requires `copy` lang_item
diff --git a/tests/ui/layout/debug.rs b/tests/ui/layout/debug.rs
index b87a1d2031d..90e3c58dad7 100644
--- a/tests/ui/layout/debug.rs
+++ b/tests/ui/layout/debug.rs
@@ -18,6 +18,7 @@ type Test = Result<i32, i32>; //~ ERROR: layout_of
 
 #[rustc_layout(debug)]
 type T = impl std::fmt::Debug; //~ ERROR: layout_of
+#[define_opaque(T)]
 fn f() -> T {
     0i32
 }
diff --git a/tests/ui/layout/debug.stderr b/tests/ui/layout/debug.stderr
index 80b35ff6ad4..abaa16cdefa 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:83:1
+  --> $DIR/debug.rs:84:1
    |
 LL | union EmptyUnion {}
    | ^^^^^^^^^^^^^^^^^^^
@@ -372,7 +372,7 @@ error: layout_of(V) = Layout {
            unadjusted_abi_align: Align(2 bytes),
            randomization_seed: $SEED,
        }
-  --> $DIR/debug.rs:26:1
+  --> $DIR/debug.rs:27:1
    |
 LL | pub union V {
    | ^^^^^^^^^^^
@@ -398,7 +398,7 @@ error: layout_of(W) = Layout {
            unadjusted_abi_align: Align(2 bytes),
            randomization_seed: $SEED,
        }
-  --> $DIR/debug.rs:32:1
+  --> $DIR/debug.rs:33:1
    |
 LL | pub union W {
    | ^^^^^^^^^^^
@@ -424,7 +424,7 @@ error: layout_of(Y) = Layout {
            unadjusted_abi_align: Align(2 bytes),
            randomization_seed: $SEED,
        }
-  --> $DIR/debug.rs:38:1
+  --> $DIR/debug.rs:39:1
    |
 LL | pub union Y {
    | ^^^^^^^^^^^
@@ -450,7 +450,7 @@ error: layout_of(P1) = Layout {
            unadjusted_abi_align: Align(1 bytes),
            randomization_seed: $SEED,
        }
-  --> $DIR/debug.rs:45:1
+  --> $DIR/debug.rs:46:1
    |
 LL | union P1 { x: u32 }
    | ^^^^^^^^
@@ -476,7 +476,7 @@ error: layout_of(P2) = Layout {
            unadjusted_abi_align: Align(1 bytes),
            randomization_seed: $SEED,
        }
-  --> $DIR/debug.rs:49:1
+  --> $DIR/debug.rs:50:1
    |
 LL | union P2 { x: (u32, u32) }
    | ^^^^^^^^
@@ -502,7 +502,7 @@ error: layout_of(P3) = Layout {
            unadjusted_abi_align: Align(1 bytes),
            randomization_seed: $SEED,
        }
-  --> $DIR/debug.rs:57:1
+  --> $DIR/debug.rs:58:1
    |
 LL | union P3 { x: F32x4 }
    | ^^^^^^^^
@@ -528,7 +528,7 @@ error: layout_of(P4) = Layout {
            unadjusted_abi_align: Align(1 bytes),
            randomization_seed: $SEED,
        }
-  --> $DIR/debug.rs:61:1
+  --> $DIR/debug.rs:62:1
    |
 LL | union P4 { x: E }
    | ^^^^^^^^
@@ -559,7 +559,7 @@ error: layout_of(P5) = Layout {
            unadjusted_abi_align: Align(1 bytes),
            randomization_seed: $SEED,
        }
-  --> $DIR/debug.rs:65:1
+  --> $DIR/debug.rs:66:1
    |
 LL | union P5 { zst: [u16; 0], byte: u8 }
    | ^^^^^^^^
@@ -590,19 +590,19 @@ error: layout_of(MaybeUninit<u8>) = Layout {
            unadjusted_abi_align: Align(1 bytes),
            randomization_seed: $SEED,
        }
-  --> $DIR/debug.rs:68:1
+  --> $DIR/debug.rs:69: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:71:1
+  --> $DIR/debug.rs:72:1
    |
 LL | const C: () = ();
    | ^^^^^^^^^^^
 
 error[E0277]: the size for values of type `str` cannot be known at compilation time
-  --> $DIR/debug.rs:79:19
+  --> $DIR/debug.rs:80:19
    |
 LL | type Impossible = (str, str);
    |                   ^^^^^^^^^^ doesn't have a size known at compile-time
@@ -611,19 +611,19 @@ LL | type Impossible = (str, str);
    = note: only the last element of a tuple may have a dynamically sized type
 
 error: the type has an unknown layout
-  --> $DIR/debug.rs:83:1
+  --> $DIR/debug.rs:84:1
    |
 LL | union EmptyUnion {}
    | ^^^^^^^^^^^^^^^^
 
 error: the type `T` does not have a fixed layout
-  --> $DIR/debug.rs:89:1
+  --> $DIR/debug.rs:90:1
    |
 LL | type TooGeneric<T> = T;
    | ^^^^^^^^^^^^^^^^^^
 
 error: `#[rustc_layout]` can only be applied to `struct`/`enum`/`union` declarations and type aliases
-  --> $DIR/debug.rs:75:5
+  --> $DIR/debug.rs:76:5
    |
 LL |     const C: () = ();
    |     ^^^^^^^^^^^
diff --git a/tests/ui/layout/reprc-power-alignment.rs b/tests/ui/layout/reprc-power-alignment.rs
index f6c1df55988..f144094d43f 100644
--- a/tests/ui/layout/reprc-power-alignment.rs
+++ b/tests/ui/layout/reprc-power-alignment.rs
@@ -148,5 +148,29 @@ pub struct I {
     d: f32,
     e: f64,
 }
-
+#[repr(C)]
+pub struct J {
+    a: u8,
+    b: I,
+}
+// The lint also ignores diagnosing #[repr(align(n))].
+#[repr(C, align(8))]
+pub struct K {
+    a: u8,
+    b: u8,
+    c: f64,
+    d: f32,
+    e: f64,
+}
+#[repr(C)]
+pub struct L {
+    a: u8,
+    b: K,
+}
+#[repr(C, align(8))]
+pub struct M {
+    a: u8,
+    b: K,
+    c: L,
+}
 fn main() { }
diff --git a/tests/ui/lazy-type-alias-impl-trait/branches.rs b/tests/ui/lazy-type-alias-impl-trait/branches.rs
index 95239e2e341..30f9c08a27f 100644
--- a/tests/ui/lazy-type-alias-impl-trait/branches.rs
+++ b/tests/ui/lazy-type-alias-impl-trait/branches.rs
@@ -2,16 +2,14 @@
 
 type Foo = impl std::fmt::Debug;
 
+#[define_opaque(Foo)]
 fn foo(b: bool) -> Foo {
-    if b {
-        vec![42_i32]
-    } else {
-        std::iter::empty().collect()
-    }
+    if b { vec![42_i32] } else { std::iter::empty().collect() }
 }
 
 type Bar = impl std::fmt::Debug;
 
+#[define_opaque(Bar)]
 fn bar(b: bool) -> Bar {
     let x: Bar = if b {
         vec![42_i32]
diff --git a/tests/ui/lazy-type-alias-impl-trait/branches.stderr b/tests/ui/lazy-type-alias-impl-trait/branches.stderr
index 9e937622775..0cc727bc3de 100644
--- a/tests/ui/lazy-type-alias-impl-trait/branches.stderr
+++ b/tests/ui/lazy-type-alias-impl-trait/branches.stderr
@@ -1,5 +1,5 @@
 error[E0277]: a value of type `Bar` cannot be built from an iterator over elements of type `_`
-  --> $DIR/branches.rs:19:28
+  --> $DIR/branches.rs:17:28
    |
 LL |         std::iter::empty().collect()
    |                            ^^^^^^^ value of type `Bar` cannot be built from `std::iter::Iterator<Item=_>`
diff --git a/tests/ui/lazy-type-alias-impl-trait/branches2.rs b/tests/ui/lazy-type-alias-impl-trait/branches2.rs
index 467400f1c24..35b76845c85 100644
--- a/tests/ui/lazy-type-alias-impl-trait/branches2.rs
+++ b/tests/ui/lazy-type-alias-impl-trait/branches2.rs
@@ -4,20 +4,13 @@
 
 type Foo = impl std::iter::FromIterator<i32> + PartialEq<Vec<i32>> + std::fmt::Debug;
 
+#[define_opaque(Foo)]
 fn foo(b: bool) -> Foo {
-    if b {
-        vec![42_i32]
-    } else {
-        std::iter::empty().collect()
-    }
+    if b { vec![42_i32] } else { std::iter::empty().collect() }
 }
 
 fn bar(b: bool) -> impl PartialEq<Vec<i32>> + std::fmt::Debug {
-    if b {
-        vec![42_i32]
-    } else {
-        std::iter::empty().collect()
-    }
+    if b { vec![42_i32] } else { std::iter::empty().collect() }
 }
 
 fn main() {
diff --git a/tests/ui/lazy-type-alias-impl-trait/branches3.rs b/tests/ui/lazy-type-alias-impl-trait/branches3.rs
index 30c0af8a5dc..cff7a0b437f 100644
--- a/tests/ui/lazy-type-alias-impl-trait/branches3.rs
+++ b/tests/ui/lazy-type-alias-impl-trait/branches3.rs
@@ -3,6 +3,7 @@
 type Foo = impl for<'a> FnOnce(&'a str) -> usize;
 type Bar = impl FnOnce(&'static str) -> usize;
 
+#[define_opaque(Foo)]
 fn foo() -> Foo {
     if true {
         |s| s.len() //~ ERROR type annotations needed
@@ -10,6 +11,8 @@ fn foo() -> Foo {
         panic!()
     }
 }
+
+#[define_opaque(Bar)]
 fn bar() -> Bar {
     if true {
         |s| s.len() //~ ERROR type annotations needed
diff --git a/tests/ui/lazy-type-alias-impl-trait/branches3.stderr b/tests/ui/lazy-type-alias-impl-trait/branches3.stderr
index fe2631f9474..117d189867b 100644
--- a/tests/ui/lazy-type-alias-impl-trait/branches3.stderr
+++ b/tests/ui/lazy-type-alias-impl-trait/branches3.stderr
@@ -1,5 +1,5 @@
 error[E0282]: type annotations needed
-  --> $DIR/branches3.rs:8:10
+  --> $DIR/branches3.rs:9:10
    |
 LL |         |s| s.len()
    |          ^  - type must be known at this point
@@ -10,7 +10,7 @@ LL |         |s: /* Type */| s.len()
    |           ++++++++++++
 
 error[E0282]: type annotations needed
-  --> $DIR/branches3.rs:15:10
+  --> $DIR/branches3.rs:18:10
    |
 LL |         |s| s.len()
    |          ^  - type must be known at this point
@@ -21,7 +21,7 @@ LL |         |s: /* Type */| s.len()
    |           ++++++++++++
 
 error[E0282]: type annotations needed
-  --> $DIR/branches3.rs:23:10
+  --> $DIR/branches3.rs:26:10
    |
 LL |         |s| s.len()
    |          ^  - type must be known at this point
@@ -32,7 +32,7 @@ LL |         |s: /* Type */| s.len()
    |           ++++++++++++
 
 error[E0282]: type annotations needed
-  --> $DIR/branches3.rs:30:10
+  --> $DIR/branches3.rs:33:10
    |
 LL |         |s| s.len()
    |          ^  - type must be known at this point
diff --git a/tests/ui/lazy-type-alias-impl-trait/recursion.rs b/tests/ui/lazy-type-alias-impl-trait/recursion.rs
index 51933560599..33dbf8d0280 100644
--- a/tests/ui/lazy-type-alias-impl-trait/recursion.rs
+++ b/tests/ui/lazy-type-alias-impl-trait/recursion.rs
@@ -4,9 +4,10 @@
 
 type Foo = impl std::fmt::Debug;
 
+#[define_opaque(Foo)]
 fn foo(b: bool) -> Foo {
     if b {
-        return 42
+        return 42;
     }
     let x: u32 = foo(false);
     99
@@ -14,7 +15,7 @@ fn foo(b: bool) -> Foo {
 
 fn bar(b: bool) -> impl std::fmt::Debug {
     if b {
-        return 42
+        return 42;
     }
     let x: u32 = bar(false);
     99
diff --git a/tests/ui/lazy-type-alias-impl-trait/recursion2.rs b/tests/ui/lazy-type-alias-impl-trait/recursion2.rs
index e14da32e116..b28a95c53f4 100644
--- a/tests/ui/lazy-type-alias-impl-trait/recursion2.rs
+++ b/tests/ui/lazy-type-alias-impl-trait/recursion2.rs
@@ -4,6 +4,7 @@
 
 type Foo = impl std::fmt::Debug;
 
+#[define_opaque(Foo)]
 fn foo(b: bool) -> Foo {
     if b {
         return vec![];
@@ -14,7 +15,7 @@ fn foo(b: bool) -> Foo {
 
 fn bar(b: bool) -> impl std::fmt::Debug {
     if b {
-        return vec![]
+        return vec![];
     }
     let x: Vec<i32> = bar(false);
     std::iter::empty().collect()
diff --git a/tests/ui/lazy-type-alias-impl-trait/recursion3.rs b/tests/ui/lazy-type-alias-impl-trait/recursion3.rs
index 7f1cedae068..0b15484f7ef 100644
--- a/tests/ui/lazy-type-alias-impl-trait/recursion3.rs
+++ b/tests/ui/lazy-type-alias-impl-trait/recursion3.rs
@@ -2,9 +2,10 @@
 
 type Foo = impl std::fmt::Debug;
 
+#[define_opaque(Foo)]
 fn foo(b: bool) -> Foo {
     if b {
-        return 42
+        return 42;
     }
     let x: u32 = foo(false) + 42; //~ ERROR cannot add
     99
@@ -12,7 +13,7 @@ fn foo(b: bool) -> Foo {
 
 fn bar(b: bool) -> impl std::fmt::Debug {
     if b {
-        return 42
+        return 42;
     }
     let x: u32 = bar(false) + 42; //~ ERROR cannot add
     99
diff --git a/tests/ui/lazy-type-alias-impl-trait/recursion3.stderr b/tests/ui/lazy-type-alias-impl-trait/recursion3.stderr
index e1d5cafedc8..0cbedfb69f8 100644
--- a/tests/ui/lazy-type-alias-impl-trait/recursion3.stderr
+++ b/tests/ui/lazy-type-alias-impl-trait/recursion3.stderr
@@ -1,5 +1,5 @@
 error[E0369]: cannot add `{integer}` to `Foo`
-  --> $DIR/recursion3.rs:9:29
+  --> $DIR/recursion3.rs:10:29
    |
 LL |     let x: u32 = foo(false) + 42;
    |                  ---------- ^ -- {integer}
@@ -7,7 +7,7 @@ LL |     let x: u32 = foo(false) + 42;
    |                  Foo
 
 error[E0369]: cannot add `{integer}` to `impl Debug`
-  --> $DIR/recursion3.rs:17:29
+  --> $DIR/recursion3.rs:18:29
    |
 LL |     let x: u32 = bar(false) + 42;
    |                  ---------- ^ -- {integer}
diff --git a/tests/ui/lazy-type-alias-impl-trait/recursion4.rs b/tests/ui/lazy-type-alias-impl-trait/recursion4.rs
index 57dd7fb067c..892e72e2335 100644
--- a/tests/ui/lazy-type-alias-impl-trait/recursion4.rs
+++ b/tests/ui/lazy-type-alias-impl-trait/recursion4.rs
@@ -2,6 +2,7 @@
 
 type Foo = impl std::fmt::Debug;
 
+#[define_opaque(Foo)]
 fn foo(b: bool) -> Foo {
     if b {
         return vec![];
diff --git a/tests/ui/lazy-type-alias-impl-trait/recursion4.stderr b/tests/ui/lazy-type-alias-impl-trait/recursion4.stderr
index d8ac39a4f27..b04bf6b9987 100644
--- a/tests/ui/lazy-type-alias-impl-trait/recursion4.stderr
+++ b/tests/ui/lazy-type-alias-impl-trait/recursion4.stderr
@@ -1,5 +1,5 @@
 error[E0277]: a value of type `Foo` cannot be built from an iterator over elements of type `_`
-  --> $DIR/recursion4.rs:10:28
+  --> $DIR/recursion4.rs:11:28
    |
 LL |     x = std::iter::empty().collect();
    |                            ^^^^^^^ value of type `Foo` cannot be built from `std::iter::Iterator<Item=_>`
@@ -9,7 +9,7 @@ note: required by a bound in `collect`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error[E0277]: a value of type `impl Debug` cannot be built from an iterator over elements of type `_`
-  --> $DIR/recursion4.rs:19:28
+  --> $DIR/recursion4.rs:20:28
    |
 LL |     x = std::iter::empty().collect();
    |                            ^^^^^^^ value of type `impl Debug` cannot be built from `std::iter::Iterator<Item=_>`
diff --git a/tests/ui/lazy-type-alias/inherent-impls-overflow.next.stderr b/tests/ui/lazy-type-alias/inherent-impls-overflow.next.stderr
index 192b5eebdaa..4f1d339bc99 100644
--- a/tests/ui/lazy-type-alias/inherent-impls-overflow.next.stderr
+++ b/tests/ui/lazy-type-alias/inherent-impls-overflow.next.stderr
@@ -1,8 +1,8 @@
-error[E0275]: overflow evaluating the requirement `Loop == _`
+error[E0271]: type mismatch resolving `Loop normalizes-to _`
   --> $DIR/inherent-impls-overflow.rs:10:6
    |
 LL | impl Loop {}
-   |      ^^^^
+   |      ^^^^ types differ
 
 error: type parameter `T` is only used recursively
   --> $DIR/inherent-impls-overflow.rs:14:24
@@ -36,4 +36,5 @@ LL | impl Poly0<()> {}
 
 error: aborting due to 4 previous errors
 
-For more information about this error, try `rustc --explain E0275`.
+Some errors have detailed explanations: E0271, E0275.
+For more information about an error, try `rustc --explain E0271`.
diff --git a/tests/ui/lazy-type-alias/inherent-impls-overflow.rs b/tests/ui/lazy-type-alias/inherent-impls-overflow.rs
index 1397695a3fe..0d5ec7d1530 100644
--- a/tests/ui/lazy-type-alias/inherent-impls-overflow.rs
+++ b/tests/ui/lazy-type-alias/inherent-impls-overflow.rs
@@ -9,7 +9,7 @@ type Loop = Loop; //[current]~ ERROR overflow normalizing the type alias `Loop`
 
 impl Loop {}
 //[current]~^ ERROR overflow normalizing the type alias `Loop`
-//[next]~^^ ERROR overflow evaluating the requirement `Loop == _`
+//[next]~^^ ERROR type mismatch resolving `Loop normalizes-to _`
 
 type Poly0<T> = Poly1<(T,)>;
 //[current]~^ ERROR overflow normalizing the type alias `Poly0<(((((((...,),),),),),),)>`
diff --git a/tests/ui/link-native-libs/modifiers-bad.rs b/tests/ui/link-native-libs/modifiers-bad.rs
index 185201e0d84..4d6c8a278d4 100644
--- a/tests/ui/link-native-libs/modifiers-bad.rs
+++ b/tests/ui/link-native-libs/modifiers-bad.rs
@@ -9,3 +9,8 @@
 // Tests various illegal values for the "modifier" part of an `-l` flag.
 
 fn main() {}
+
+//[blank]~? ERROR invalid linking modifier syntax, expected '+' or '-' prefix
+//[no-prefix]~? ERROR invalid linking modifier syntax, expected '+' or '-' prefix
+//[prefix-only]~? ERROR unknown linking modifier ``
+//[unknown]~? ERROR unknown linking modifier `ferris`
diff --git a/tests/ui/link-native-libs/modifiers-override-2.rs b/tests/ui/link-native-libs/modifiers-override-2.rs
index a462a741ac6..d132f2419d8 100644
--- a/tests/ui/link-native-libs/modifiers-override-2.rs
+++ b/tests/ui/link-native-libs/modifiers-override-2.rs
@@ -1,3 +1,5 @@
 //@ compile-flags:-lstatic:+whole-archive,-whole-archive=foo
 
 fn main() {}
+
+//~? ERROR multiple `whole-archive` modifiers in a single `-l` option
diff --git a/tests/ui/link-native-libs/msvc-non-utf8-output.rs b/tests/ui/link-native-libs/msvc-non-utf8-output.rs
index 03b1f6516ab..5cc4cd9a3d6 100644
--- a/tests/ui/link-native-libs/msvc-non-utf8-output.rs
+++ b/tests/ui/link-native-libs/msvc-non-utf8-output.rs
@@ -3,3 +3,5 @@
 //@ only-msvc
 //@ normalize-stderr: "(?:.|\n)*(⦺ⅈ⽯⭏⽽◃⡽⚞)(?:.|\n)*" -> "$1"
 pub fn main() {}
+
+//~? ERROR linking with `
diff --git a/tests/ui/linkage-attr/link-self-contained-consistency.rs b/tests/ui/linkage-attr/link-self-contained-consistency.rs
index def63233e94..08227433891 100644
--- a/tests/ui/linkage-attr/link-self-contained-consistency.rs
+++ b/tests/ui/linkage-attr/link-self-contained-consistency.rs
@@ -8,3 +8,6 @@
 // ignore-tidy-linelength
 
 fn main() {}
+
+//[one]~? ERROR some `-C link-self-contained` components were both enabled and disabled: linker
+//[many]~? ERROR some `-C link-self-contained` components were both enabled and disabled: crto, linker
diff --git a/tests/ui/linkage-attr/linkage-detect-extern-generated-name-collision.rs b/tests/ui/linkage-attr/linkage-detect-extern-generated-name-collision.rs
index b43df634112..23848056ee1 100644
--- a/tests/ui/linkage-attr/linkage-detect-extern-generated-name-collision.rs
+++ b/tests/ui/linkage-attr/linkage-detect-extern-generated-name-collision.rs
@@ -22,3 +22,5 @@ fn main() {
        println!("{:p}", &dep1::collision);
     }
 }
+
+//~? ERROR symbol `collision` is already defined
diff --git a/tests/ui/linkage-attr/raw-dylib/windows/dlltool-failed.rs b/tests/ui/linkage-attr/raw-dylib/windows/dlltool-failed.rs
index e69a4537935..92cb60bb16d 100644
--- a/tests/ui/linkage-attr/raw-dylib/windows/dlltool-failed.rs
+++ b/tests/ui/linkage-attr/raw-dylib/windows/dlltool-failed.rs
@@ -19,3 +19,5 @@ extern "C" {
 pub fn lib_main() {
     unsafe { f(42); }
 }
+
+//~? ERROR Dlltool could not create import library with
diff --git a/tests/ui/linkage-attr/raw-dylib/windows/invalid-dlltool.rs b/tests/ui/linkage-attr/raw-dylib/windows/invalid-dlltool.rs
index 057242246f0..0c78d799bad 100644
--- a/tests/ui/linkage-attr/raw-dylib/windows/invalid-dlltool.rs
+++ b/tests/ui/linkage-attr/raw-dylib/windows/invalid-dlltool.rs
@@ -10,3 +10,5 @@ extern "C" {
 pub fn lib_main() {
     unsafe { f(42); }
 }
+
+//~? ERROR Error calling dlltool 'does_not_exist.exe': program not found
diff --git a/tests/ui/lint/expansion-time.rs b/tests/ui/lint/expansion-time.rs
index d0f26a87385..3cb4b91ff2b 100644
--- a/tests/ui/lint/expansion-time.rs
+++ b/tests/ui/lint/expansion-time.rs
@@ -31,3 +31,5 @@ fn main() {
     // WARN see in the stderr file, the warning points to the included file.
     include!("expansion-time-include.rs");
 }
+
+//~? WARN include macro expected single expression in source
diff --git a/tests/ui/lint/inert-attr-macro.rs b/tests/ui/lint/inert-attr-macro.rs
index 90303a1fc3d..5d4133d6c77 100644
--- a/tests/ui/lint/inert-attr-macro.rs
+++ b/tests/ui/lint/inert-attr-macro.rs
@@ -1,5 +1,6 @@
 //@ check-pass
 
+#![feature(cfg_boolean_literals)]
 #![warn(unused)]
 
 macro_rules! foo {
@@ -17,4 +18,10 @@ fn main() {
     // This does work, since the attribute is on a parent
     // of the macro invocation.
     #[allow(warnings)] { #[inline] foo!(); }
+
+    // Ok, `cfg` and `cfg_attr` are expanded eagerly and do not warn.
+    #[cfg(true)] foo!();
+    #[cfg(false)] foo!();
+    #[cfg_attr(true, cfg(true))] foo!();
+    #[cfg_attr(false, nonexistent)] foo!();
 }
diff --git a/tests/ui/lint/inert-attr-macro.stderr b/tests/ui/lint/inert-attr-macro.stderr
index 5ccb4ffe792..b85b0319e71 100644
--- a/tests/ui/lint/inert-attr-macro.stderr
+++ b/tests/ui/lint/inert-attr-macro.stderr
@@ -1,41 +1,41 @@
 warning: unused attribute `inline`
-  --> $DIR/inert-attr-macro.rs:10:5
+  --> $DIR/inert-attr-macro.rs:11:5
    |
 LL |     #[inline] foo!();
    |     ^^^^^^^^^
    |
 note: the built-in attribute `inline` will be ignored, since it's applied to the macro invocation `foo`
-  --> $DIR/inert-attr-macro.rs:10:15
+  --> $DIR/inert-attr-macro.rs:11:15
    |
 LL |     #[inline] foo!();
    |               ^^^
 note: the lint level is defined here
-  --> $DIR/inert-attr-macro.rs:3:9
+  --> $DIR/inert-attr-macro.rs:4:9
    |
 LL | #![warn(unused)]
    |         ^^^^^^
    = note: `#[warn(unused_attributes)]` implied by `#[warn(unused)]`
 
 warning: unused attribute `allow`
-  --> $DIR/inert-attr-macro.rs:14:5
+  --> $DIR/inert-attr-macro.rs:15:5
    |
 LL |     #[allow(warnings)] #[inline] foo!();
    |     ^^^^^^^^^^^^^^^^^^
    |
 note: the built-in attribute `allow` will be ignored, since it's applied to the macro invocation `foo`
-  --> $DIR/inert-attr-macro.rs:14:34
+  --> $DIR/inert-attr-macro.rs:15:34
    |
 LL |     #[allow(warnings)] #[inline] foo!();
    |                                  ^^^
 
 warning: unused attribute `inline`
-  --> $DIR/inert-attr-macro.rs:14:24
+  --> $DIR/inert-attr-macro.rs:15:24
    |
 LL |     #[allow(warnings)] #[inline] foo!();
    |                        ^^^^^^^^^
    |
 note: the built-in attribute `inline` will be ignored, since it's applied to the macro invocation `foo`
-  --> $DIR/inert-attr-macro.rs:14:34
+  --> $DIR/inert-attr-macro.rs:15:34
    |
 LL |     #[allow(warnings)] #[inline] foo!();
    |                                  ^^^
diff --git a/tests/ui/lint/inline-exported.rs b/tests/ui/lint/inline-exported.rs
new file mode 100644
index 00000000000..69e322ef513
--- /dev/null
+++ b/tests/ui/lint/inline-exported.rs
@@ -0,0 +1,30 @@
+//! Ensure the unused_attributes lint fires for externally exported functions with `#[inline]`,
+//! because `#[inline]` is ignored for such functions.
+
+#![crate_type = "lib"]
+
+#![feature(linkage)]
+#![feature(naked_functions)]
+#![deny(unused_attributes)]
+
+#[inline]
+//~^ ERROR: `#[inline]` is ignored on externally exported functions
+#[no_mangle]
+fn no_mangle() {}
+
+#[inline]
+//~^ ERROR: `#[inline]` is ignored on externally exported functions
+#[export_name = "export_name"]
+fn export_name() {}
+
+#[inline]
+//~^ ERROR: `#[inline]` is ignored on externally exported functions
+#[linkage = "external"]
+fn external_linkage() {}
+
+#[inline]
+fn normal() {}
+
+#[inline]
+#[linkage = "internal"] // not exported
+fn internal_linkage() {}
diff --git a/tests/ui/lint/inline-exported.stderr b/tests/ui/lint/inline-exported.stderr
new file mode 100644
index 00000000000..dcf63cc4090
--- /dev/null
+++ b/tests/ui/lint/inline-exported.stderr
@@ -0,0 +1,31 @@
+error: `#[inline]` is ignored on externally exported functions
+  --> $DIR/inline-exported.rs:10:1
+   |
+LL | #[inline]
+   | ^^^^^^^^^
+   |
+   = help: externally exported functions are functions with `#[no_mangle]`, `#[export_name]`, or `#[linkage]`
+note: the lint level is defined here
+  --> $DIR/inline-exported.rs:8:9
+   |
+LL | #![deny(unused_attributes)]
+   |         ^^^^^^^^^^^^^^^^^
+
+error: `#[inline]` is ignored on externally exported functions
+  --> $DIR/inline-exported.rs:15:1
+   |
+LL | #[inline]
+   | ^^^^^^^^^
+   |
+   = help: externally exported functions are functions with `#[no_mangle]`, `#[export_name]`, or `#[linkage]`
+
+error: `#[inline]` is ignored on externally exported functions
+  --> $DIR/inline-exported.rs:20:1
+   |
+LL | #[inline]
+   | ^^^^^^^^^
+   |
+   = help: externally exported functions are functions with `#[no_mangle]`, `#[export_name]`, or `#[linkage]`
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/lint/invalid_from_utf8.rs b/tests/ui/lint/invalid_from_utf8.rs
index 87a906761c0..cbc1d8e9045 100644
--- a/tests/ui/lint/invalid_from_utf8.rs
+++ b/tests/ui/lint/invalid_from_utf8.rs
@@ -128,18 +128,21 @@ pub fn from_utf8() {
 }
 
 pub fn from_utf8_with_indirections() {
-    let mut a = [99, 108, 130, 105, 112, 112, 121];
-    std::str::from_utf8_mut(&mut a);
-    //~^ WARN calls to `std::str::from_utf8_mut`
-    str::from_utf8_mut(&mut a);
-    //~^ WARN calls to `str::from_utf8_mut`
-    let mut b = &mut a;
-    let mut c = b;
-    std::str::from_utf8_mut(c);
-    //~^ WARN calls to `std::str::from_utf8_mut`
-    str::from_utf8_mut(c);
-    //~^ WARN calls to `str::from_utf8_mut`
-    let mut c = &[99, 108, 130, 105, 112, 112, 121];
+    // NOTE: We used to lint on the patterns below, but due to the
+    // binding being mutable it could be changed between the
+    // declaration and the call and that would have created a
+    // false-positive, so until we can reliably avoid those false
+    // postive we don't lint on them. Example of FP below.
+    //
+    // let mut a = [99, 108, 130, 105, 112, 112, 121];
+    // std::str::from_utf8_mut(&mut a);
+    // str::from_utf8_mut(&mut a);
+    // let mut b = &mut a;
+    // let mut c = b;
+    // std::str::from_utf8_mut(c);
+    // str::from_utf8_mut(c);
+
+    let c = &[99, 108, 130, 105, 112, 112, 121];
     std::str::from_utf8(c);
     //~^ WARN calls to `std::str::from_utf8`
     str::from_utf8(c);
@@ -164,6 +167,20 @@ pub fn from_utf8_with_indirections() {
     //~^ WARN calls to `std::str::from_utf8`
     str::from_utf8(INVALID_4);
     //~^ WARN calls to `str::from_utf8`
+
+    let mut a = [99, 108, 130, 105, 112, 112, 121]; // invalid
+    loop {
+        a = [99, 108, 130, 105, 112, 112, 121]; // still invalid, but too complex
+        break;
+    }
+    std::str::from_utf8_mut(&mut a);
+
+    let mut a = [99, 108, 130, 105, 112, 112]; // invalid
+    loop {
+        a = *b"clippy"; // valid
+        break;
+    }
+    std::str::from_utf8_mut(&mut a);
 }
 
 fn main() {}
diff --git a/tests/ui/lint/invalid_from_utf8.stderr b/tests/ui/lint/invalid_from_utf8.stderr
index 3cd4d227fc2..26bee5c4038 100644
--- a/tests/ui/lint/invalid_from_utf8.stderr
+++ b/tests/ui/lint/invalid_from_utf8.stderr
@@ -202,60 +202,25 @@ LL |         str::from_utf8(concat_bytes!(b"cl", b"\x82ippy"));
    |                        |
    |                        the literal was valid UTF-8 up to the 2 bytes
 
-warning: calls to `std::str::from_utf8_mut` with an invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:132:5
-   |
-LL |     let mut a = [99, 108, 130, 105, 112, 112, 121];
-   |                 ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
-LL |     std::str::from_utf8_mut(&mut a);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-warning: calls to `str::from_utf8_mut` with an invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:134:5
-   |
-LL |     let mut a = [99, 108, 130, 105, 112, 112, 121];
-   |                 ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
-...
-LL |     str::from_utf8_mut(&mut a);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-warning: calls to `std::str::from_utf8_mut` with an invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:138:5
-   |
-LL |     let mut a = [99, 108, 130, 105, 112, 112, 121];
-   |                 ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
-...
-LL |     std::str::from_utf8_mut(c);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-warning: calls to `str::from_utf8_mut` with an invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:140:5
-   |
-LL |     let mut a = [99, 108, 130, 105, 112, 112, 121];
-   |                 ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
-...
-LL |     str::from_utf8_mut(c);
-   |     ^^^^^^^^^^^^^^^^^^^^^
-
 warning: calls to `std::str::from_utf8` with an invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:143:5
+  --> $DIR/invalid_from_utf8.rs:146:5
    |
-LL |     let mut c = &[99, 108, 130, 105, 112, 112, 121];
-   |                  ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
+LL |     let c = &[99, 108, 130, 105, 112, 112, 121];
+   |              ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
 LL |     std::str::from_utf8(c);
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: calls to `str::from_utf8` with an invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:145:5
+  --> $DIR/invalid_from_utf8.rs:148:5
    |
-LL |     let mut c = &[99, 108, 130, 105, 112, 112, 121];
-   |                  ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
+LL |     let c = &[99, 108, 130, 105, 112, 112, 121];
+   |              ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
 ...
 LL |     str::from_utf8(c);
    |     ^^^^^^^^^^^^^^^^^
 
 warning: calls to `std::str::from_utf8` with an invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:148:5
+  --> $DIR/invalid_from_utf8.rs:151:5
    |
 LL |     const INVALID_1: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
    |                                ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@@ -263,7 +228,7 @@ LL |     std::str::from_utf8(&INVALID_1);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: calls to `str::from_utf8` with an invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:150:5
+  --> $DIR/invalid_from_utf8.rs:153:5
    |
 LL |     const INVALID_1: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
    |                                ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@@ -272,7 +237,7 @@ LL |     str::from_utf8(&INVALID_1);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: calls to `std::str::from_utf8` with an invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:153:5
+  --> $DIR/invalid_from_utf8.rs:156:5
    |
 LL |     static INVALID_2: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
    |                                 ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@@ -280,7 +245,7 @@ LL |     std::str::from_utf8(&INVALID_2);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: calls to `str::from_utf8` with an invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:155:5
+  --> $DIR/invalid_from_utf8.rs:158:5
    |
 LL |     static INVALID_2: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
    |                                 ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@@ -289,7 +254,7 @@ LL |     str::from_utf8(&INVALID_2);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: calls to `std::str::from_utf8` with an invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:158:5
+  --> $DIR/invalid_from_utf8.rs:161:5
    |
 LL |     const INVALID_3: &'static [u8; 7] = &[99, 108, 130, 105, 112, 112, 121];
    |                                          ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@@ -297,7 +262,7 @@ LL |     std::str::from_utf8(INVALID_3);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: calls to `str::from_utf8` with an invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:160:5
+  --> $DIR/invalid_from_utf8.rs:163:5
    |
 LL |     const INVALID_3: &'static [u8; 7] = &[99, 108, 130, 105, 112, 112, 121];
    |                                          ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@@ -306,7 +271,7 @@ LL |     str::from_utf8(INVALID_3);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: calls to `std::str::from_utf8` with an invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:163:5
+  --> $DIR/invalid_from_utf8.rs:166:5
    |
 LL |     const INVALID_4: &'static [u8; 7] = { &[99, 108, 130, 105, 112, 112, 121] };
    |                                            ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@@ -314,7 +279,7 @@ LL |     std::str::from_utf8(INVALID_4);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: calls to `str::from_utf8` with an invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:165:5
+  --> $DIR/invalid_from_utf8.rs:168:5
    |
 LL |     const INVALID_4: &'static [u8; 7] = { &[99, 108, 130, 105, 112, 112, 121] };
    |                                            ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@@ -322,5 +287,5 @@ LL |     const INVALID_4: &'static [u8; 7] = { &[99, 108, 130, 105, 112, 112, 12
 LL |     str::from_utf8(INVALID_4);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: 38 warnings emitted
+warning: 34 warnings emitted
 
diff --git a/tests/ui/lint/invalid_null_args.rs b/tests/ui/lint/invalid_null_args.rs
new file mode 100644
index 00000000000..7948f0d86d0
--- /dev/null
+++ b/tests/ui/lint/invalid_null_args.rs
@@ -0,0 +1,136 @@
+// check-fail
+// run-rustfix
+
+use std::ptr;
+use std::mem;
+
+unsafe fn null_ptr() {
+    ptr::write(
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+        ptr::null_mut() as *mut u32,
+        mem::transmute::<[u8; 4], _>([0, 0, 0, 255]),
+    );
+
+    let null_ptr = ptr::null_mut();
+    ptr::write(
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+        null_ptr as *mut u32,
+        mem::transmute::<[u8; 4], _>([0, 0, 0, 255]),
+    );
+
+    let _: &[usize] = std::slice::from_raw_parts(ptr::null(), 0);
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+    let _: &[usize] = std::slice::from_raw_parts(ptr::null_mut(), 0);
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+    let _: &[usize] = std::slice::from_raw_parts(0 as *mut _, 0);
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+    let _: &[usize] = std::slice::from_raw_parts(mem::transmute(0usize), 0);
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+
+    let _: &[usize] = std::slice::from_raw_parts_mut(ptr::null_mut(), 0);
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+
+    ptr::copy::<usize>(ptr::null(), ptr::NonNull::dangling().as_ptr(), 0);
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+    ptr::copy::<usize>(ptr::NonNull::dangling().as_ptr(), ptr::null_mut(), 0);
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+
+    ptr::copy_nonoverlapping::<usize>(ptr::null(), ptr::NonNull::dangling().as_ptr(), 0);
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+    ptr::copy_nonoverlapping::<usize>(
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+        ptr::NonNull::dangling().as_ptr(),
+        ptr::null_mut(),
+        0
+    );
+
+    #[derive(Copy, Clone)]
+    struct A(usize);
+    let mut v = A(200);
+
+    let _a: A = ptr::read(ptr::null());
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+    let _a: A = ptr::read(ptr::null_mut());
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+
+    let _a: A = ptr::read_unaligned(ptr::null());
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+    let _a: A = ptr::read_unaligned(ptr::null_mut());
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+
+    let _a: A = ptr::read_volatile(ptr::null());
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+    let _a: A = ptr::read_volatile(ptr::null_mut());
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+
+    let _a: A = ptr::replace(ptr::null_mut(), v);
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+
+    ptr::swap::<A>(ptr::null_mut(), &mut v);
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+    ptr::swap::<A>(&mut v, ptr::null_mut());
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+
+    ptr::swap_nonoverlapping::<A>(ptr::null_mut(), &mut v, 0);
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+    ptr::swap_nonoverlapping::<A>(&mut v, ptr::null_mut(), 0);
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+
+    ptr::write(ptr::null_mut(), v);
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+
+    ptr::write_unaligned(ptr::null_mut(), v);
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+
+    ptr::write_volatile(ptr::null_mut(), v);
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+
+    ptr::write_bytes::<usize>(ptr::null_mut(), 42, 0);
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+
+    // with indirections
+    let const_ptr = null_ptr as *const u8;
+    let _a: u8 = ptr::read(const_ptr);
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+}
+
+unsafe fn zst() {
+    struct Zst; // zero-sized type
+
+    std::slice::from_raw_parts::<()>(ptr::null(), 0);
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+    std::slice::from_raw_parts::<Zst>(ptr::null(), 0);
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+    std::slice::from_raw_parts_mut::<()>(ptr::null_mut(), 0);
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+    std::slice::from_raw_parts_mut::<Zst>(ptr::null_mut(), 0);
+    //~^ ERROR calling this function with a null pointer is undefined behavior
+
+    ptr::read::<()>(ptr::null());
+    ptr::read::<Zst>(ptr::null());
+
+    ptr::write(ptr::null_mut(), ());
+    ptr::write(ptr::null_mut(), Zst);
+
+    ptr::copy(ptr::null::<()>(), ptr::null_mut::<()>(), 1);
+    ptr::copy(ptr::null::<Zst>(), ptr::null_mut::<Zst>(), 1);
+}
+
+unsafe fn not_invalid() {
+    // Simplified false-positive from std quicksort implementation
+
+    let mut a = ptr::null_mut();
+    let mut b = ();
+
+    loop {
+        if false {
+            break;
+        }
+
+        a = &raw mut b;
+    }
+
+    ptr::write(a, ());
+}
+
+fn main() {}
diff --git a/tests/ui/lint/invalid_null_args.stderr b/tests/ui/lint/invalid_null_args.stderr
new file mode 100644
index 00000000000..f95bc2afa82
--- /dev/null
+++ b/tests/ui/lint/invalid_null_args.stderr
@@ -0,0 +1,330 @@
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:8:5
+   |
+LL | /     ptr::write(
+LL | |
+LL | |         ptr::null_mut() as *mut u32,
+   | |         --------------- null pointer originates from here
+LL | |         mem::transmute::<[u8; 4], _>([0, 0, 0, 255]),
+LL | |     );
+   | |_____^
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+   = note: `#[deny(invalid_null_arguments)]` on by default
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:15:5
+   |
+LL | /     ptr::write(
+LL | |
+LL | |         null_ptr as *mut u32,
+LL | |         mem::transmute::<[u8; 4], _>([0, 0, 0, 255]),
+LL | |     );
+   | |_____^
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+note: null pointer originates from here
+  --> $DIR/invalid_null_args.rs:14:20
+   |
+LL |     let null_ptr = ptr::null_mut();
+   |                    ^^^^^^^^^^^^^^^
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:21:23
+   |
+LL |     let _: &[usize] = std::slice::from_raw_parts(ptr::null(), 0);
+   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------^^^^
+   |                                                  |
+   |                                                  null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:23:23
+   |
+LL |     let _: &[usize] = std::slice::from_raw_parts(ptr::null_mut(), 0);
+   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^^^^
+   |                                                  |
+   |                                                  null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:25:23
+   |
+LL |     let _: &[usize] = std::slice::from_raw_parts(0 as *mut _, 0);
+   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^-^^^^^^^^^^^^^^
+   |                                                  |
+   |                                                  null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:27:23
+   |
+LL |     let _: &[usize] = std::slice::from_raw_parts(mem::transmute(0usize), 0);
+   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------^^^^^
+   |                                                                 |
+   |                                                                 null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:30:23
+   |
+LL |     let _: &[usize] = std::slice::from_raw_parts_mut(ptr::null_mut(), 0);
+   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^^^^
+   |                                                      |
+   |                                                      null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:33:5
+   |
+LL |     ptr::copy::<usize>(ptr::null(), ptr::NonNull::dangling().as_ptr(), 0);
+   |     ^^^^^^^^^^^^^^^^^^^-----------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |                        |
+   |                        null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:35:5
+   |
+LL |     ptr::copy::<usize>(ptr::NonNull::dangling().as_ptr(), ptr::null_mut(), 0);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^^^^
+   |                                                           |
+   |                                                           null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:38:5
+   |
+LL |     ptr::copy_nonoverlapping::<usize>(ptr::null(), ptr::NonNull::dangling().as_ptr(), 0);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |                                       |
+   |                                       null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:40:5
+   |
+LL | /     ptr::copy_nonoverlapping::<usize>(
+LL | |
+LL | |         ptr::NonNull::dangling().as_ptr(),
+LL | |         ptr::null_mut(),
+   | |         --------------- null pointer originates from here
+LL | |         0
+LL | |     );
+   | |_____^
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:51:17
+   |
+LL |     let _a: A = ptr::read(ptr::null());
+   |                 ^^^^^^^^^^-----------^
+   |                           |
+   |                           null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:53:17
+   |
+LL |     let _a: A = ptr::read(ptr::null_mut());
+   |                 ^^^^^^^^^^---------------^
+   |                           |
+   |                           null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:56:17
+   |
+LL |     let _a: A = ptr::read_unaligned(ptr::null());
+   |                 ^^^^^^^^^^^^^^^^^^^^-----------^
+   |                                     |
+   |                                     null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:58:17
+   |
+LL |     let _a: A = ptr::read_unaligned(ptr::null_mut());
+   |                 ^^^^^^^^^^^^^^^^^^^^---------------^
+   |                                     |
+   |                                     null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:61:17
+   |
+LL |     let _a: A = ptr::read_volatile(ptr::null());
+   |                 ^^^^^^^^^^^^^^^^^^^-----------^
+   |                                    |
+   |                                    null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:63:17
+   |
+LL |     let _a: A = ptr::read_volatile(ptr::null_mut());
+   |                 ^^^^^^^^^^^^^^^^^^^---------------^
+   |                                    |
+   |                                    null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:66:17
+   |
+LL |     let _a: A = ptr::replace(ptr::null_mut(), v);
+   |                 ^^^^^^^^^^^^^---------------^^^^
+   |                              |
+   |                              null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:69:5
+   |
+LL |     ptr::swap::<A>(ptr::null_mut(), &mut v);
+   |     ^^^^^^^^^^^^^^^---------------^^^^^^^^^
+   |                    |
+   |                    null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:71:5
+   |
+LL |     ptr::swap::<A>(&mut v, ptr::null_mut());
+   |     ^^^^^^^^^^^^^^^^^^^^^^^---------------^
+   |                            |
+   |                            null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:74:5
+   |
+LL |     ptr::swap_nonoverlapping::<A>(ptr::null_mut(), &mut v, 0);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^^^^^^^^^^^^
+   |                                   |
+   |                                   null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:76:5
+   |
+LL |     ptr::swap_nonoverlapping::<A>(&mut v, ptr::null_mut(), 0);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^^^^
+   |                                           |
+   |                                           null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:79:5
+   |
+LL |     ptr::write(ptr::null_mut(), v);
+   |     ^^^^^^^^^^^---------------^^^^
+   |                |
+   |                null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:82:5
+   |
+LL |     ptr::write_unaligned(ptr::null_mut(), v);
+   |     ^^^^^^^^^^^^^^^^^^^^^---------------^^^^
+   |                          |
+   |                          null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:85:5
+   |
+LL |     ptr::write_volatile(ptr::null_mut(), v);
+   |     ^^^^^^^^^^^^^^^^^^^^---------------^^^^
+   |                         |
+   |                         null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:88:5
+   |
+LL |     ptr::write_bytes::<usize>(ptr::null_mut(), 42, 0);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^^^^^^^^
+   |                               |
+   |                               null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:93:18
+   |
+LL |     let _a: u8 = ptr::read(const_ptr);
+   |                  ^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+note: null pointer originates from here
+  --> $DIR/invalid_null_args.rs:14:20
+   |
+LL |     let null_ptr = ptr::null_mut();
+   |                    ^^^^^^^^^^^^^^^
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:100:5
+   |
+LL |     std::slice::from_raw_parts::<()>(ptr::null(), 0);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------^^^^
+   |                                      |
+   |                                      null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:102:5
+   |
+LL |     std::slice::from_raw_parts::<Zst>(ptr::null(), 0);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------^^^^
+   |                                       |
+   |                                       null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:104:5
+   |
+LL |     std::slice::from_raw_parts_mut::<()>(ptr::null_mut(), 0);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^^^^
+   |                                          |
+   |                                          null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
+  --> $DIR/invalid_null_args.rs:106:5
+   |
+LL |     std::slice::from_raw_parts_mut::<Zst>(ptr::null_mut(), 0);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^^^^
+   |                                           |
+   |                                           null pointer originates from here
+   |
+   = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
+
+error: aborting due to 31 previous errors
+
diff --git a/tests/ui/lint/issue-99387.rs b/tests/ui/lint/issue-99387.rs
index 6f082239456..b40d31384be 100644
--- a/tests/ui/lint/issue-99387.rs
+++ b/tests/ui/lint/issue-99387.rs
@@ -6,6 +6,7 @@
 
 pub type Successors<'a> = impl Iterator<Item = &'a ()>;
 
+#[define_opaque(Successors)]
 pub fn f<'a>() -> Successors<'a> {
     None.into_iter()
 }
diff --git a/tests/ui/lint/issue-99387.stderr b/tests/ui/lint/issue-99387.stderr
index 4eee4f36392..0d9ded23c78 100644
--- a/tests/ui/lint/issue-99387.stderr
+++ b/tests/ui/lint/issue-99387.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/issue-99387.rs:22:5
+  --> $DIR/issue-99387.rs:23:5
    |
 LL | pub type Successors<'a> = impl Iterator<Item = &'a ()>;
    |                           ---------------------------- the expected opaque type
@@ -11,8 +11,8 @@ LL |     None.into_iter()
    |
    = note: expected opaque type `Successors<'a>`
                    found struct `std::option::IntoIter<_>`
-note: this item must have the opaque type in its signature in order to be able to register hidden types
-  --> $DIR/issue-99387.rs:21:8
+note: this item must have a `#[define_opaque(Successors)]` attribute to be able to define hidden types
+  --> $DIR/issue-99387.rs:22:8
    |
 LL | pub fn ohno<'a>() -> <&'a () as Tr>::Item {
    |        ^^^^
diff --git a/tests/ui/lint/let_underscore/issue-119697-extra-let.rs b/tests/ui/lint/let_underscore/issue-119697-extra-let.rs
index 84abb933911..9782b3191fd 100644
--- a/tests/ui/lint/let_underscore/issue-119697-extra-let.rs
+++ b/tests/ui/lint/let_underscore/issue-119697-extra-let.rs
@@ -8,6 +8,7 @@ pub struct Foo {
 
 pub type Tait = impl Sized;
 
+#[define_opaque(Tait)]
 pub fn ice_cold(beverage: Tait) {
     // Must destructure at least one field of `Foo`
     let Foo { field } = beverage;
@@ -17,5 +18,4 @@ pub fn ice_cold(beverage: Tait) {
     let _ = field; //~ ERROR non-binding let on a type that has a destructor
 }
 
-
 pub fn main() {}
diff --git a/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr b/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr
index 3ff57ab441d..8d5deadd46e 100644
--- a/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr
+++ b/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr
@@ -1,5 +1,5 @@
 error: non-binding let on a type that has a destructor
-  --> $DIR/issue-119697-extra-let.rs:15:5
+  --> $DIR/issue-119697-extra-let.rs:16:5
    |
 LL |     _ = field;
    |     ^^^^^^^^^
@@ -21,7 +21,7 @@ LL +     drop(field);
    |
 
 error: non-binding let on a type that has a destructor
-  --> $DIR/issue-119697-extra-let.rs:17:5
+  --> $DIR/issue-119697-extra-let.rs:18:5
    |
 LL |     let _ = field;
    |     ^^^^^^^^^^^^^^
diff --git a/tests/ui/lint/linker-warning.stderr b/tests/ui/lint/linker-warning.stderr
index 3a2c392fd03..c678562ab54 100644
--- a/tests/ui/lint/linker-warning.stderr
+++ b/tests/ui/lint/linker-warning.stderr
@@ -16,7 +16,7 @@ warning: unused attribute
 LL | #![allow(linker_messages)]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
    |
-   = note: the `linker_warnings` lint can only be controlled at the root of a crate that needs to be linked
+   = note: the `linker_messages` lint can only be controlled at the root of a crate that needs to be linked
 
 warning: 2 warnings emitted
 
diff --git a/tests/ui/lint/lint-ctypes-73249-2.rs b/tests/ui/lint/lint-ctypes-73249-2.rs
index f30377d6c16..31af0e3d381 100644
--- a/tests/ui/lint/lint-ctypes-73249-2.rs
+++ b/tests/ui/lint/lint-ctypes-73249-2.rs
@@ -7,6 +7,7 @@ impl Baz for () {}
 
 type Qux = impl Baz;
 
+#[define_opaque(Qux)]
 fn assign() -> Qux {}
 
 trait Foo {
diff --git a/tests/ui/lint/lint-ctypes-73249-2.stderr b/tests/ui/lint/lint-ctypes-73249-2.stderr
index ef30a406969..2d0dfe94f09 100644
--- a/tests/ui/lint/lint-ctypes-73249-2.stderr
+++ b/tests/ui/lint/lint-ctypes-73249-2.stderr
@@ -1,5 +1,5 @@
 error: `extern` block uses type `Qux`, which is not FFI-safe
-  --> $DIR/lint-ctypes-73249-2.rs:26:21
+  --> $DIR/lint-ctypes-73249-2.rs:27:21
    |
 LL |     fn lint_me() -> A<()>;
    |                     ^^^^^ not FFI-safe
diff --git a/tests/ui/lint/lint-ctypes-73249-3.rs b/tests/ui/lint/lint-ctypes-73249-3.rs
index ef8ab7e03d2..8bdf536bf77 100644
--- a/tests/ui/lint/lint-ctypes-73249-3.rs
+++ b/tests/ui/lint/lint-ctypes-73249-3.rs
@@ -7,6 +7,7 @@ impl Baz for u32 {}
 
 type Qux = impl Baz;
 
+#[define_opaque(Qux)]
 fn assign() -> Qux {
     3
 }
diff --git a/tests/ui/lint/lint-ctypes-73249-3.stderr b/tests/ui/lint/lint-ctypes-73249-3.stderr
index e5607ba72e9..e1a313a2906 100644
--- a/tests/ui/lint/lint-ctypes-73249-3.stderr
+++ b/tests/ui/lint/lint-ctypes-73249-3.stderr
@@ -1,5 +1,5 @@
 error: `extern` block uses type `Qux`, which is not FFI-safe
-  --> $DIR/lint-ctypes-73249-3.rs:20:25
+  --> $DIR/lint-ctypes-73249-3.rs:21:25
    |
 LL |     pub fn lint_me() -> A;
    |                         ^ not FFI-safe
diff --git a/tests/ui/lint/lint-ctypes-73249-5.rs b/tests/ui/lint/lint-ctypes-73249-5.rs
index 083fb6c5fb1..cc6da59950d 100644
--- a/tests/ui/lint/lint-ctypes-73249-5.rs
+++ b/tests/ui/lint/lint-ctypes-73249-5.rs
@@ -7,6 +7,7 @@ impl Baz for u32 {}
 
 type Qux = impl Baz;
 
+#[define_opaque(Qux)]
 fn assign() -> Qux {
     3
 }
diff --git a/tests/ui/lint/lint-ctypes-73249-5.stderr b/tests/ui/lint/lint-ctypes-73249-5.stderr
index fcb106c485d..c4fa955de05 100644
--- a/tests/ui/lint/lint-ctypes-73249-5.stderr
+++ b/tests/ui/lint/lint-ctypes-73249-5.stderr
@@ -1,5 +1,5 @@
 error: `extern` block uses type `Qux`, which is not FFI-safe
-  --> $DIR/lint-ctypes-73249-5.rs:20:25
+  --> $DIR/lint-ctypes-73249-5.rs:21:25
    |
 LL |     pub fn lint_me() -> A;
    |                         ^ not FFI-safe
diff --git a/tests/ui/lint/lint-ctypes-73251-1.rs b/tests/ui/lint/lint-ctypes-73251-1.rs
index fc11f23a104..07ae05be69f 100644
--- a/tests/ui/lint/lint-ctypes-73251-1.rs
+++ b/tests/ui/lint/lint-ctypes-73251-1.rs
@@ -15,6 +15,7 @@ impl Foo for u32 {
     type Assoc = Qux;
 }
 
+#[define_opaque(Qux)]
 fn assign() -> Qux {
     1
 }
diff --git a/tests/ui/lint/lint-ctypes-73251-1.stderr b/tests/ui/lint/lint-ctypes-73251-1.stderr
index a3b3ebaac30..675a9de51cd 100644
--- a/tests/ui/lint/lint-ctypes-73251-1.stderr
+++ b/tests/ui/lint/lint-ctypes-73251-1.stderr
@@ -1,5 +1,5 @@
 error: `extern` block uses type `Qux`, which is not FFI-safe
-  --> $DIR/lint-ctypes-73251-1.rs:23:21
+  --> $DIR/lint-ctypes-73251-1.rs:24:21
    |
 LL |     fn lint_me() -> <u32 as Foo>::Assoc;
    |                     ^^^^^^^^^^^^^^^^^^^ not FFI-safe
diff --git a/tests/ui/lint/lint-ctypes-73251-2.rs b/tests/ui/lint/lint-ctypes-73251-2.rs
index fbe0a58f3b5..c47118672e0 100644
--- a/tests/ui/lint/lint-ctypes-73251-2.rs
+++ b/tests/ui/lint/lint-ctypes-73251-2.rs
@@ -24,10 +24,12 @@ type AliasA = impl TraitA<Assoc = u32>;
 
 type AliasB = impl TraitB<Assoc = AliasA>;
 
+#[define_opaque(AliasA)]
 fn use_of_a() -> AliasA {
     3
 }
 
+#[define_opaque(AliasB)]
 fn use_of_b() -> AliasB {
     3
 }
diff --git a/tests/ui/lint/lint-ctypes-73251-2.stderr b/tests/ui/lint/lint-ctypes-73251-2.stderr
index 40a9cd00c50..634950b29ed 100644
--- a/tests/ui/lint/lint-ctypes-73251-2.stderr
+++ b/tests/ui/lint/lint-ctypes-73251-2.stderr
@@ -1,5 +1,5 @@
 error: `extern` block uses type `AliasA`, which is not FFI-safe
-  --> $DIR/lint-ctypes-73251-2.rs:36:21
+  --> $DIR/lint-ctypes-73251-2.rs:38:21
    |
 LL |     fn lint_me() -> <AliasB as TraitB>::Assoc;
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
diff --git a/tests/ui/lint/lint-ctypes-73251.rs b/tests/ui/lint/lint-ctypes-73251.rs
index 68eeb67deea..15c1dfcaabf 100644
--- a/tests/ui/lint/lint-ctypes-73251.rs
+++ b/tests/ui/lint/lint-ctypes-73251.rs
@@ -13,6 +13,7 @@ impl Foo for () {
 
 type Bar = impl Foo<Assoc = u32>;
 
+#[define_opaque(Bar)]
 fn assign() -> Bar {}
 
 extern "C" {
diff --git a/tests/ui/lint/lint-unexported-no-mangle.rs b/tests/ui/lint/lint-unexported-no-mangle.rs
index 63eeb3374d2..65a7fd9d769 100644
--- a/tests/ui/lint/lint-unexported-no-mangle.rs
+++ b/tests/ui/lint/lint-unexported-no-mangle.rs
@@ -27,3 +27,10 @@ fn main() {
     foo();
     bar();
 }
+
+//~? WARN lint `private_no_mangle_fns` has been removed
+//~? WARN lint `private_no_mangle_statics` has been removed
+//~? WARN lint `private_no_mangle_fns` has been removed
+//~? WARN lint `private_no_mangle_statics` has been removed
+//~? WARN lint `private_no_mangle_fns` has been removed
+//~? WARN lint `private_no_mangle_statics` has been removed
diff --git a/tests/ui/lint/opaque-ty-ffi-normalization-cycle.rs b/tests/ui/lint/opaque-ty-ffi-normalization-cycle.rs
index c83bca4a4c5..dee77cf4873 100644
--- a/tests/ui/lint/opaque-ty-ffi-normalization-cycle.rs
+++ b/tests/ui/lint/opaque-ty-ffi-normalization-cycle.rs
@@ -25,10 +25,12 @@ type AliasA = impl TraitA<Assoc = u32>;
 
 type AliasB = impl TraitB;
 
+#[define_opaque(AliasA)]
 fn use_of_a() -> AliasA {
     3
 }
 
+#[define_opaque(AliasB)]
 fn use_of_b() -> AliasB {
     3
 }
diff --git a/tests/ui/lint/opaque-ty-ffi-normalization-cycle.stderr b/tests/ui/lint/opaque-ty-ffi-normalization-cycle.stderr
index 9efc187833f..020eac4febb 100644
--- a/tests/ui/lint/opaque-ty-ffi-normalization-cycle.stderr
+++ b/tests/ui/lint/opaque-ty-ffi-normalization-cycle.stderr
@@ -1,5 +1,5 @@
 error: `extern` block uses type `AliasB`, which is not FFI-safe
-  --> $DIR/opaque-ty-ffi-normalization-cycle.rs:37:21
+  --> $DIR/opaque-ty-ffi-normalization-cycle.rs:39:21
    |
 LL |     fn lint_me() -> <AliasB as TraitB>::Assoc;
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
diff --git a/tests/ui/lint/opaque-ty-ffi-unsafe.rs b/tests/ui/lint/opaque-ty-ffi-unsafe.rs
index 5faeac9ed4c..97016267fa8 100644
--- a/tests/ui/lint/opaque-ty-ffi-unsafe.rs
+++ b/tests/ui/lint/opaque-ty-ffi-unsafe.rs
@@ -3,6 +3,7 @@
 
 type A = impl Fn();
 
+#[define_opaque(A)]
 pub(crate) fn ret_closure() -> A {
     || {}
 }
diff --git a/tests/ui/lint/opaque-ty-ffi-unsafe.stderr b/tests/ui/lint/opaque-ty-ffi-unsafe.stderr
index 7f5d1792bf1..5c52f702671 100644
--- a/tests/ui/lint/opaque-ty-ffi-unsafe.stderr
+++ b/tests/ui/lint/opaque-ty-ffi-unsafe.stderr
@@ -1,5 +1,5 @@
 error: `extern` block uses type `A`, which is not FFI-safe
-  --> $DIR/opaque-ty-ffi-unsafe.rs:11:24
+  --> $DIR/opaque-ty-ffi-unsafe.rs:12:24
    |
 LL |     pub(crate) fn a(_: A);
    |                        ^ not FFI-safe
diff --git a/tests/ui/lint/test-inner-fn.stderr b/tests/ui/lint/test-inner-fn.stderr
index 7a32bc86bf7..bf476a45f77 100644
--- a/tests/ui/lint/test-inner-fn.stderr
+++ b/tests/ui/lint/test-inner-fn.stderr
@@ -5,15 +5,12 @@ LL |     #[test]
    |     ^^^^^^^
    |
    = note: requested on the command line with `-D unnameable-test-items`
-   = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: cannot test inner items
   --> $DIR/test-inner-fn.rs:13:9
    |
 LL |         #[test]
    |         ^^^^^^^
-   |
-   = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/lint/unused/lint-unused-imports-self-single.fixed b/tests/ui/lint/unused/lint-unused-imports-self-single.fixed
new file mode 100644
index 00000000000..361548bfdc1
--- /dev/null
+++ b/tests/ui/lint/unused/lint-unused-imports-self-single.fixed
@@ -0,0 +1,29 @@
+//@ run-rustfix
+
+#![deny(unused_imports)]
+#![allow(unreachable_code)]
+
+use std::collections::{self as coll};
+//~^ ERROR unused import: `HashMap`
+
+//~^ ERROR unused import: `self as std_io`
+
+use std::sync::Mutex;
+//~^ ERROR unused import: `self as std_sync`
+
+use std::sync::mpsc::Sender;
+//~^ ERROR unused import: `self as std_sync_mpsc`
+
+use std::collections::hash_map::{self as std_coll_hm};
+//~^ ERROR unused import: `Keys`
+
+use std::borrow::Cow;
+//~^ ERROR unused import: `self`
+
+fn main() {
+    let _ = coll::BTreeSet::<String>::default();
+    let _ = Mutex::new(String::new());
+    let _: Cow<'static, str> = "foo".into();
+    let _: Sender<u32> = todo!();
+    let _: std_coll_hm::Entry<'static, u32, u32> = todo!();
+}
diff --git a/tests/ui/lint/unused/lint-unused-imports-self-single.rs b/tests/ui/lint/unused/lint-unused-imports-self-single.rs
new file mode 100644
index 00000000000..d03d3822e04
--- /dev/null
+++ b/tests/ui/lint/unused/lint-unused-imports-self-single.rs
@@ -0,0 +1,30 @@
+//@ run-rustfix
+
+#![deny(unused_imports)]
+#![allow(unreachable_code)]
+
+use std::collections::{HashMap, self as coll};
+//~^ ERROR unused import: `HashMap`
+
+use std::io::{self as std_io};
+//~^ ERROR unused import: `self as std_io`
+
+use std::sync::{Mutex, self as std_sync};
+//~^ ERROR unused import: `self as std_sync`
+
+use std::sync::{mpsc::{self as std_sync_mpsc, Sender}};
+//~^ ERROR unused import: `self as std_sync_mpsc`
+
+use std::collections::{hash_map::{self as std_coll_hm, Keys}};
+//~^ ERROR unused import: `Keys`
+
+use std::borrow::{self, Cow};
+//~^ ERROR unused import: `self`
+
+fn main() {
+    let _ = coll::BTreeSet::<String>::default();
+    let _ = Mutex::new(String::new());
+    let _: Cow<'static, str> = "foo".into();
+    let _: Sender<u32> = todo!();
+    let _: std_coll_hm::Entry<'static, u32, u32> = todo!();
+}
diff --git a/tests/ui/lint/unused/lint-unused-imports-self-single.stderr b/tests/ui/lint/unused/lint-unused-imports-self-single.stderr
new file mode 100644
index 00000000000..70a9b78a664
--- /dev/null
+++ b/tests/ui/lint/unused/lint-unused-imports-self-single.stderr
@@ -0,0 +1,44 @@
+error: unused import: `HashMap`
+  --> $DIR/lint-unused-imports-self-single.rs:6:24
+   |
+LL | use std::collections::{HashMap, self as coll};
+   |                        ^^^^^^^
+   |
+note: the lint level is defined here
+  --> $DIR/lint-unused-imports-self-single.rs:3:9
+   |
+LL | #![deny(unused_imports)]
+   |         ^^^^^^^^^^^^^^
+
+error: unused import: `self as std_io`
+  --> $DIR/lint-unused-imports-self-single.rs:9:15
+   |
+LL | use std::io::{self as std_io};
+   |               ^^^^^^^^^^^^^^
+
+error: unused import: `self as std_sync`
+  --> $DIR/lint-unused-imports-self-single.rs:12:24
+   |
+LL | use std::sync::{Mutex, self as std_sync};
+   |                        ^^^^^^^^^^^^^^^^
+
+error: unused import: `self as std_sync_mpsc`
+  --> $DIR/lint-unused-imports-self-single.rs:15:24
+   |
+LL | use std::sync::{mpsc::{self as std_sync_mpsc, Sender}};
+   |                        ^^^^^^^^^^^^^^^^^^^^^
+
+error: unused import: `Keys`
+  --> $DIR/lint-unused-imports-self-single.rs:18:56
+   |
+LL | use std::collections::{hash_map::{self as std_coll_hm, Keys}};
+   |                                                        ^^^^
+
+error: unused import: `self`
+  --> $DIR/lint-unused-imports-self-single.rs:21:19
+   |
+LL | use std::borrow::{self, Cow};
+   |                   ^^^^
+
+error: aborting due to 6 previous errors
+
diff --git a/tests/ui/lint/unused/unused-field-in-pat-field.rs b/tests/ui/lint/unused/unused-field-in-pat-field.rs
new file mode 100644
index 00000000000..34959a1023f
--- /dev/null
+++ b/tests/ui/lint/unused/unused-field-in-pat-field.rs
@@ -0,0 +1,21 @@
+//@ check-pass
+
+// Ensure we collect lint levels from pat fields in structs.
+
+#![deny(unused_variables)]
+
+pub struct Foo {
+    bar: u32,
+    baz: u32,
+}
+
+pub fn test(foo: Foo) {
+    let Foo {
+        #[allow(unused_variables)]
+        bar,
+        #[allow(unused_variables)]
+        baz,
+    } = foo;
+}
+
+fn main() {}
diff --git a/tests/ui/lint/wasm_c_abi_transition.rs b/tests/ui/lint/wasm_c_abi_transition.rs
new file mode 100644
index 00000000000..1fe81679e65
--- /dev/null
+++ b/tests/ui/lint/wasm_c_abi_transition.rs
@@ -0,0 +1,41 @@
+//@ compile-flags: --target wasm32-unknown-unknown
+//@ needs-llvm-components: webassembly
+//@ add-core-stubs
+//@ build-fail
+
+#![feature(no_core)]
+#![no_core]
+#![crate_type = "lib"]
+#![deny(wasm_c_abi)]
+
+extern crate minicore;
+use minicore::*;
+
+pub extern "C" fn my_fun_trivial(_x: i32, _y: f32) {}
+
+#[repr(C)]
+pub struct MyType(i32, i32);
+pub extern "C" fn my_fun(_x: MyType) {} //~ERROR: wasm ABI transition
+//~^WARN: previously accepted
+
+// This one is ABI-safe as it only wraps a single field,
+// and the return type can be anything.
+#[repr(C)]
+pub struct MySafeType(i32);
+pub extern "C" fn my_fun_safe(_x: MySafeType) -> MyType { loop {} }
+
+// This one not ABI-safe due to the alignment.
+#[repr(C, align(16))]
+pub struct MyAlignedType(i32);
+pub extern "C" fn my_fun_aligned(_x: MyAlignedType) {} //~ERROR: wasm ABI transition
+//~^WARN: previously accepted
+
+// Check call-site warning
+extern "C" {
+    fn other_fun(x: MyType);
+}
+
+pub fn call_other_fun(x: MyType) {
+    unsafe { other_fun(x) } //~ERROR: wasm ABI transition
+    //~^WARN: previously accepted
+}
diff --git a/tests/ui/lint/wasm_c_abi_transition.stderr b/tests/ui/lint/wasm_c_abi_transition.stderr
new file mode 100644
index 00000000000..389710d5cb3
--- /dev/null
+++ b/tests/ui/lint/wasm_c_abi_transition.stderr
@@ -0,0 +1,85 @@
+error: this function definition involves an argument of type `MyType` which is affected by the wasm ABI transition
+  --> $DIR/wasm_c_abi_transition.rs:18:1
+   |
+LL | pub extern "C" fn my_fun(_x: MyType) {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #138762 <https://github.com/rust-lang/rust/issues/138762>
+   = help: the "C" ABI Rust uses on wasm32-unknown-unknown will change to align with the standard "C" ABI for this target
+note: the lint level is defined here
+  --> $DIR/wasm_c_abi_transition.rs:9:9
+   |
+LL | #![deny(wasm_c_abi)]
+   |         ^^^^^^^^^^
+
+error: this function definition involves an argument of type `MyAlignedType` which is affected by the wasm ABI transition
+  --> $DIR/wasm_c_abi_transition.rs:30:1
+   |
+LL | pub extern "C" fn my_fun_aligned(_x: MyAlignedType) {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #138762 <https://github.com/rust-lang/rust/issues/138762>
+   = help: the "C" ABI Rust uses on wasm32-unknown-unknown will change to align with the standard "C" ABI for this target
+
+error: this function call involves an argument of type `MyType` which is affected by the wasm ABI transition
+  --> $DIR/wasm_c_abi_transition.rs:39:14
+   |
+LL |     unsafe { other_fun(x) }
+   |              ^^^^^^^^^^^^
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #138762 <https://github.com/rust-lang/rust/issues/138762>
+   = help: the "C" ABI Rust uses on wasm32-unknown-unknown will change to align with the standard "C" ABI for this target
+
+error: aborting due to 3 previous errors
+
+Future incompatibility report: Future breakage diagnostic:
+error: this function definition involves an argument of type `MyType` which is affected by the wasm ABI transition
+  --> $DIR/wasm_c_abi_transition.rs:18:1
+   |
+LL | pub extern "C" fn my_fun(_x: MyType) {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #138762 <https://github.com/rust-lang/rust/issues/138762>
+   = help: the "C" ABI Rust uses on wasm32-unknown-unknown will change to align with the standard "C" ABI for this target
+note: the lint level is defined here
+  --> $DIR/wasm_c_abi_transition.rs:9:9
+   |
+LL | #![deny(wasm_c_abi)]
+   |         ^^^^^^^^^^
+
+Future breakage diagnostic:
+error: this function definition involves an argument of type `MyAlignedType` which is affected by the wasm ABI transition
+  --> $DIR/wasm_c_abi_transition.rs:30:1
+   |
+LL | pub extern "C" fn my_fun_aligned(_x: MyAlignedType) {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #138762 <https://github.com/rust-lang/rust/issues/138762>
+   = help: the "C" ABI Rust uses on wasm32-unknown-unknown will change to align with the standard "C" ABI for this target
+note: the lint level is defined here
+  --> $DIR/wasm_c_abi_transition.rs:9:9
+   |
+LL | #![deny(wasm_c_abi)]
+   |         ^^^^^^^^^^
+
+Future breakage diagnostic:
+error: this function call involves an argument of type `MyType` which is affected by the wasm ABI transition
+  --> $DIR/wasm_c_abi_transition.rs:39:14
+   |
+LL |     unsafe { other_fun(x) }
+   |              ^^^^^^^^^^^^
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #138762 <https://github.com/rust-lang/rust/issues/138762>
+   = help: the "C" ABI Rust uses on wasm32-unknown-unknown will change to align with the standard "C" ABI for this target
+note: the lint level is defined here
+  --> $DIR/wasm_c_abi_transition.rs:9:9
+   |
+LL | #![deny(wasm_c_abi)]
+   |         ^^^^^^^^^^
+
diff --git a/tests/ui/loops/label-on-block-suggest-move.rs b/tests/ui/loops/label-on-block-suggest-move.rs
new file mode 100644
index 00000000000..656034cd0e9
--- /dev/null
+++ b/tests/ui/loops/label-on-block-suggest-move.rs
@@ -0,0 +1,90 @@
+// see https://github.com/rust-lang/rust/issues/138585
+#![allow(break_with_label_and_loop)] // doesn't work locally
+
+fn main() {
+    loop 'a: {}
+    //~^ ERROR: block label not supported here
+    //~| HELP: if you meant to label the loop, move this label before the loop
+    while false 'a: {}
+    //~^ ERROR: block label not supported here
+    //~| HELP: if you meant to label the loop, move this label before the loop
+    for i in [0] 'a: {}
+    //~^ ERROR: block label not supported here
+    //~| HELP: if you meant to label the loop, move this label before the loop
+    'a: loop {
+        // first block is parsed as the break expr's value with or without parens
+        while break 'a 'b: {} 'c: {}
+        //~^ ERROR: block label not supported here
+        //~| HELP: if you meant to label the loop, move this label before the loop
+        while break 'a ('b: {}) 'c: {}
+        //~^ ERROR: block label not supported here
+        //~| HELP: if you meant to label the loop, move this label before the loop
+
+        // without the parens, the first block is parsed as the while-loop's body
+        // (see the 'no errors' section)
+        // #[allow(break_with_label_and_loop)] (doesn't work locally)
+        while (break 'a {}) 'c: {}
+        //~^ ERROR: block label not supported here
+        //~| HELP: if you meant to label the loop, move this label before the loop
+    }
+
+    // do not suggest moving the label if there is already a label on the loop
+    'a: loop 'b: {}
+    //~^ ERROR: block label not supported here
+    //~| HELP: remove this block label
+    'a: while false 'b: {}
+    //~^ ERROR: block label not supported here
+    //~| HELP: remove this block label
+    'a: for i in [0] 'b: {}
+    //~^ ERROR: block label not supported here
+    //~| HELP: remove this block label
+    'a: loop {
+        // first block is parsed as the break expr's value with or without parens
+        'd: while break 'a 'b: {} 'c: {}
+        //~^ ERROR: block label not supported here
+        //~| HELP: remove this block label
+        'd: while break 'a ('b: {}) 'c: {}
+        //~^ ERROR: block label not supported here
+        //~| HELP: remove this block label
+
+        // without the parens, the first block is parsed as the while-loop's body
+        // (see the 'no errors' section)
+        // #[allow(break_with_label_and_loop)] (doesn't work locally)
+        'd: while (break 'a {}) 'c: {}
+        //~^ ERROR: block label not supported here
+        //~| HELP: remove this block label
+    }
+
+    // no errors
+    loop { 'a: {} }
+    'a: loop { 'b: {} }
+    while false { 'a: {} }
+    'a: while false { 'b: {} }
+    for i in [0] { 'a: {} }
+    'a: for i in [0] { 'b: {} }
+    'a: {}
+    'a: { 'b: {} }
+    'a: loop {
+        // first block is parsed as the break expr's value if it is a labeled block
+        while break 'a 'b: {} {}
+        'd: while break 'a 'b: {} {}
+        while break 'a ('b: {}) {}
+        'd: while break 'a ('b: {}) {}
+        // first block is parsed as the while-loop's body if it has no label
+        // (the break expr is parsed as having no value),
+        // so the second block is a normal stmt-block, and the label is allowed
+        while break 'a {} 'c: {}
+        while break 'a {} {}
+        'd: while break 'a {} 'c: {}
+        'd: while break 'a {} {}
+    }
+
+    // unrelated errors that should not be affected
+    'a: 'b: {}
+    //~^ ERROR: expected `while`, `for`, `loop` or `{` after a label
+    //~| HELP: consider removing the label
+    loop { while break 'b: {} {} }
+    //~^ ERROR: parentheses are required around this expression to avoid confusion with a labeled break expression
+    //~| HELP: wrap the expression in parentheses
+    //~| ERROR: `break` or `continue` with no label in the condition of a `while` loop [E0590]
+}
diff --git a/tests/ui/loops/label-on-block-suggest-move.stderr b/tests/ui/loops/label-on-block-suggest-move.stderr
new file mode 100644
index 00000000000..66866703ca6
--- /dev/null
+++ b/tests/ui/loops/label-on-block-suggest-move.stderr
@@ -0,0 +1,140 @@
+error: block label not supported here
+  --> $DIR/label-on-block-suggest-move.rs:5:10
+   |
+LL |     loop 'a: {}
+   |          ^^^ not supported here
+   |
+help: if you meant to label the loop, move this label before the loop
+   |
+LL -     loop 'a: {}
+LL +     'a: loop {}
+   |
+
+error: block label not supported here
+  --> $DIR/label-on-block-suggest-move.rs:8:17
+   |
+LL |     while false 'a: {}
+   |                 ^^^ not supported here
+   |
+help: if you meant to label the loop, move this label before the loop
+   |
+LL -     while false 'a: {}
+LL +     'a: while false {}
+   |
+
+error: block label not supported here
+  --> $DIR/label-on-block-suggest-move.rs:11:18
+   |
+LL |     for i in [0] 'a: {}
+   |                  ^^^ not supported here
+   |
+help: if you meant to label the loop, move this label before the loop
+   |
+LL -     for i in [0] 'a: {}
+LL +     'a: for i in [0] {}
+   |
+
+error: block label not supported here
+  --> $DIR/label-on-block-suggest-move.rs:16:31
+   |
+LL |         while break 'a 'b: {} 'c: {}
+   |                               ^^^ not supported here
+   |
+help: if you meant to label the loop, move this label before the loop
+   |
+LL -         while break 'a 'b: {} 'c: {}
+LL +         'c: while break 'a 'b: {} {}
+   |
+
+error: block label not supported here
+  --> $DIR/label-on-block-suggest-move.rs:19:33
+   |
+LL |         while break 'a ('b: {}) 'c: {}
+   |                                 ^^^ not supported here
+   |
+help: if you meant to label the loop, move this label before the loop
+   |
+LL -         while break 'a ('b: {}) 'c: {}
+LL +         'c: while break 'a ('b: {}) {}
+   |
+
+error: block label not supported here
+  --> $DIR/label-on-block-suggest-move.rs:26:29
+   |
+LL |         while (break 'a {}) 'c: {}
+   |                             ^^^ not supported here
+   |
+help: if you meant to label the loop, move this label before the loop
+   |
+LL -         while (break 'a {}) 'c: {}
+LL +         'c: while (break 'a {}) {}
+   |
+
+error: block label not supported here
+  --> $DIR/label-on-block-suggest-move.rs:32:14
+   |
+LL |     'a: loop 'b: {}
+   |              ^^^ not supported here
+
+error: block label not supported here
+  --> $DIR/label-on-block-suggest-move.rs:35:21
+   |
+LL |     'a: while false 'b: {}
+   |                     ^^^ not supported here
+
+error: block label not supported here
+  --> $DIR/label-on-block-suggest-move.rs:38:22
+   |
+LL |     'a: for i in [0] 'b: {}
+   |                      ^^^ not supported here
+
+error: block label not supported here
+  --> $DIR/label-on-block-suggest-move.rs:43:35
+   |
+LL |         'd: while break 'a 'b: {} 'c: {}
+   |                                   ^^^ not supported here
+
+error: block label not supported here
+  --> $DIR/label-on-block-suggest-move.rs:46:37
+   |
+LL |         'd: while break 'a ('b: {}) 'c: {}
+   |                                     ^^^ not supported here
+
+error: block label not supported here
+  --> $DIR/label-on-block-suggest-move.rs:53:33
+   |
+LL |         'd: while (break 'a {}) 'c: {}
+   |                                 ^^^ not supported here
+
+error: expected `while`, `for`, `loop` or `{` after a label
+  --> $DIR/label-on-block-suggest-move.rs:83:9
+   |
+LL |     'a: 'b: {}
+   |         ^^ expected `while`, `for`, `loop` or `{` after a label
+   |
+help: consider removing the label
+   |
+LL -     'a: 'b: {}
+LL +     'b: {}
+   |
+
+error: parentheses are required around this expression to avoid confusion with a labeled break expression
+  --> $DIR/label-on-block-suggest-move.rs:86:24
+   |
+LL |     loop { while break 'b: {} {} }
+   |                        ^^^^^^
+   |
+help: wrap the expression in parentheses
+   |
+LL |     loop { while break ('b: {}) {} }
+   |                        +      +
+
+error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
+  --> $DIR/label-on-block-suggest-move.rs:86:18
+   |
+LL |     loop { while break 'b: {} {} }
+   |                  ^^^^^^^^^^^^ unlabeled `break` in the condition of a `while` loop
+
+error: aborting due to 15 previous errors
+
+For more information about this error, try `rustc --explain E0590`.
diff --git a/tests/ui/lto/lto-and-no-bitcode-in-rlib.rs b/tests/ui/lto/lto-and-no-bitcode-in-rlib.rs
index f742cd78697..2f0aeb0b7ba 100644
--- a/tests/ui/lto/lto-and-no-bitcode-in-rlib.rs
+++ b/tests/ui/lto/lto-and-no-bitcode-in-rlib.rs
@@ -1,3 +1,5 @@
 //@ compile-flags: -C lto -C embed-bitcode=no
 
 fn main() {}
+
+//~? ERROR options `-C embed-bitcode=no` and `-C lto` are incompatible
diff --git a/tests/ui/macros/builtin-env-issue-114010.stderr b/tests/ui/macros/builtin-env-issue-114010.stderr
index 0da42089cce..2751160e2d4 100644
--- a/tests/ui/macros/builtin-env-issue-114010.stderr
+++ b/tests/ui/macros/builtin-env-issue-114010.stderr
@@ -5,7 +5,6 @@ LL | env![r#"oopsie"#];
    | ^^^^^^^^^^^^^^^^^
    |
    = help: use `std::env::var(r#"oopsie"#)` to read the variable at run time
-   = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: environment variable `a""a` not defined at compile time
   --> $DIR/builtin-env-issue-114010.rs:7:1
@@ -14,7 +13,6 @@ LL | env![r#"a""a"#];
    | ^^^^^^^^^^^^^^^
    |
    = help: use `std::env::var(r#"a""a"#)` to read the variable at run time
-   = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/macros/cfg.stderr b/tests/ui/macros/cfg.stderr
index 53326914865..ad3f9b188dd 100644
--- a/tests/ui/macros/cfg.stderr
+++ b/tests/ui/macros/cfg.stderr
@@ -3,8 +3,6 @@ error: macro requires a cfg-pattern as an argument
    |
 LL |     cfg!();
    |     ^^^^^^ cfg-pattern required
-   |
-   = note: this error originates in the macro `cfg` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0565]: literal in `cfg` predicate value must be a boolean
   --> $DIR/cfg.rs:3:10
@@ -23,8 +21,6 @@ error: expected 1 cfg-pattern
    |
 LL |     cfg!(foo, bar);
    |     ^^^^^^^^^^^^^^
-   |
-   = note: this error originates in the macro `cfg` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/macros/duplicate-builtin.rs b/tests/ui/macros/duplicate-builtin.rs
deleted file mode 100644
index c75782128f4..00000000000
--- a/tests/ui/macros/duplicate-builtin.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-//@ compile-flags:--crate-type lib
-#![feature(decl_macro)]
-#![feature(rustc_attrs)]
-
-#[rustc_builtin_macro]
-pub macro test($item:item) {
-//~^ NOTE previously defined
-    /* compiler built-in */
-}
-
-mod inner {
-    #[rustc_builtin_macro]
-    pub macro test($item:item) {
-    //~^ ERROR attempted to define built-in macro more than once [E0773]
-        /* compiler built-in */
-    }
-}
diff --git a/tests/ui/macros/duplicate-builtin.stderr b/tests/ui/macros/duplicate-builtin.stderr
deleted file mode 100644
index 887a4fbbdc8..00000000000
--- a/tests/ui/macros/duplicate-builtin.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0773]: attempted to define built-in macro more than once
-  --> $DIR/duplicate-builtin.rs:13:5
-   |
-LL | /     pub macro test($item:item) {
-LL | |
-LL | |         /* compiler built-in */
-LL | |     }
-   | |_____^
-   |
-note: previously defined here
-  --> $DIR/duplicate-builtin.rs:6:1
-   |
-LL | / pub macro test($item:item) {
-LL | |
-LL | |     /* compiler built-in */
-LL | | }
-   | |_^
-
-error: aborting due to 1 previous error
-
-For more information about this error, try `rustc --explain E0773`.
diff --git a/tests/ui/macros/include-single-expr.rs b/tests/ui/macros/include-single-expr.rs
index c501f5d97ca..e3ab1257b42 100644
--- a/tests/ui/macros/include-single-expr.rs
+++ b/tests/ui/macros/include-single-expr.rs
@@ -1,6 +1,6 @@
-//@ error-pattern include macro expected single expression
-
 fn main() {
     include!("include-single-expr-helper.rs");
     include!("include-single-expr-helper-1.rs");
 }
+
+//~? ERROR include macro expected single expression
diff --git a/tests/ui/macros/macro-stmt-2.rs b/tests/ui/macros/macro-stmt-2.rs
new file mode 100644
index 00000000000..663d8ddc484
--- /dev/null
+++ b/tests/ui/macros/macro-stmt-2.rs
@@ -0,0 +1,11 @@
+//@ check-pass
+//
+// This shows a tricky case for #124141, where `declare!(_x)` was incorrectly
+// being categorised as a `StmtKind::Expr` instead of a `StmtKind::MacCall` in
+// `parse_stmt_mac`.
+
+macro_rules! as_stmt { ($s:stmt) => { $s }; }
+
+macro_rules! declare { ($name:ident) => { let $name = 0u32; }; }
+
+fn main() { as_stmt!(declare!(_x)); }
diff --git a/tests/ui/macros/macros-nonfatal-errors.stderr b/tests/ui/macros/macros-nonfatal-errors.stderr
index fd5e41986a8..44194b506a4 100644
--- a/tests/ui/macros/macros-nonfatal-errors.stderr
+++ b/tests/ui/macros/macros-nonfatal-errors.stderr
@@ -57,7 +57,6 @@ LL | |     Bar,
 LL | | }
    | |_- this enum needs a unit variant marked with `#[default]`
    |
-   = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: make this unit variant default by placing `#[default]` on it
    |
 LL |     #[default] Foo,
@@ -77,8 +76,6 @@ LL | |     Foo(i32),
 LL | |     Bar(i32),
 LL | | }
    | |_- this enum needs a unit variant marked with `#[default]`
-   |
-   = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: multiple declared defaults
   --> $DIR/macros-nonfatal-errors.rs:54:10
@@ -96,7 +93,6 @@ LL |     Baz,
    |     --- additional default
    |
    = note: only one variant can be default
-   = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: `#[default]` attribute does not accept a value
   --> $DIR/macros-nonfatal-errors.rs:66:5
@@ -200,7 +196,6 @@ LL |     env!("RUST_HOPEFULLY_THIS_DOESNT_EXIST");
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: use `std::env::var("RUST_HOPEFULLY_THIS_DOESNT_EXIST")` to read the variable at run time
-   = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: format argument must be a string literal
   --> $DIR/macros-nonfatal-errors.rs:114:13
@@ -230,8 +225,6 @@ error: couldn't read `$DIR/i'd be quite surprised if a file with this name exist
    |
 LL |     include_str!("i'd be quite surprised if a file with this name existed");
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: argument must be a string literal
   --> $DIR/macros-nonfatal-errors.rs:120:20
@@ -244,8 +237,6 @@ error: couldn't read `$DIR/i'd be quite surprised if a file with this name exist
    |
 LL |     include_bytes!("i'd be quite surprised if a file with this name existed");
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: trace_macros! accepts only `true` or `false`
   --> $DIR/macros-nonfatal-errors.rs:123:5
diff --git a/tests/ui/macros/nonterminal-matching.rs b/tests/ui/macros/nonterminal-matching.rs
index ca95e8fac05..b0a7f3e4650 100644
--- a/tests/ui/macros/nonterminal-matching.rs
+++ b/tests/ui/macros/nonterminal-matching.rs
@@ -16,7 +16,7 @@ macro complex_nonterminal($nt_item: item) {
         struct S;
     }
 
-    n!(a $nt_item b); //~ ERROR no rules expected item `enum E {}`
+    n!(a $nt_item b); //~ ERROR no rules expected `item` metavariable
 }
 
 simple_nonterminal!(a, 'a, (x, y, z)); // OK
@@ -32,7 +32,7 @@ macro_rules! foo {
     (expr $x:expr) => { bar!(expr $x); }; //~ ERROR: no rules expected expression `3`
     (literal $x:literal) => { bar!(literal $x); }; //~ ERROR: no rules expected literal `4`
     (path $x:path) => { bar!(path $x); }; //~ ERROR: no rules expected `path` metavariable
-    (stmt $x:stmt) => { bar!(stmt $x); }; //~ ERROR: no rules expected statement `let abc = 0`
+    (stmt $x:stmt) => { bar!(stmt $x); }; //~ ERROR: no rules expected `stmt` metavariable
 }
 
 macro_rules! bar {
diff --git a/tests/ui/macros/nonterminal-matching.stderr b/tests/ui/macros/nonterminal-matching.stderr
index ba2b3e213ad..2d9252fbfc1 100644
--- a/tests/ui/macros/nonterminal-matching.stderr
+++ b/tests/ui/macros/nonterminal-matching.stderr
@@ -1,4 +1,4 @@
-error: no rules expected item `enum E {}`
+error: no rules expected `item` metavariable
   --> $DIR/nonterminal-matching.rs:19:10
    |
 LL |     macro n(a $nt_item b) {
@@ -10,7 +10,7 @@ LL |     n!(a $nt_item b);
 LL | complex_nonterminal!(enum E {});
    | ------------------------------- in this macro invocation
    |
-note: while trying to match item `enum E {}`
+note: while trying to match `item` metavariable
   --> $DIR/nonterminal-matching.rs:15:15
    |
 LL |     macro n(a $nt_item b) {
@@ -89,7 +89,7 @@ LL |     (path a::b::c) => {};
    = help: try using `:tt` instead in the macro definition
    = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: no rules expected statement `let abc = 0`
+error: no rules expected `stmt` metavariable
   --> $DIR/nonterminal-matching.rs:35:35
    |
 LL |     (stmt $x:stmt) => { bar!(stmt $x); };
diff --git a/tests/ui/macros/not-utf8.stderr b/tests/ui/macros/not-utf8.stderr
index be028816e0f..d466d5087d4 100644
--- a/tests/ui/macros/not-utf8.stderr
+++ b/tests/ui/macros/not-utf8.stderr
@@ -9,7 +9,6 @@ note: byte `193` is not valid utf-8
    |
 LL | �|�␂!5�cc␕␂�Ӻi��WWj�ȥ�'�}�␒�J�ȉ��W�␞O�@����␜w�V���LO����␔[ ␃_�'���SQ�~ذ��ų&��-    ��lN~��!@␌ _#���kQ��h�␝�:�␜␇�
    | ^
-   = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/macros/std-2024-macros.rs b/tests/ui/macros/std-2024-macros.rs
new file mode 100644
index 00000000000..453c7ee16e5
--- /dev/null
+++ b/tests/ui/macros/std-2024-macros.rs
@@ -0,0 +1,13 @@
+// Tests a small handful of macros in the standard library how they handle the
+// new behavior introduced in 2024 that allows `const{}` expressions.
+
+//@ check-pass
+
+fn main() {
+    assert_eq!(0, const { 0 });
+    assert_eq!(const { 0 }, const { 0 });
+    assert_eq!(const { 0 }, 0);
+
+    let _: Vec<Vec<String>> = vec![const { vec![] }];
+    let _: Vec<Vec<String>> = vec![const { vec![] }; 10];
+}
diff --git a/tests/ui/macros/unknown-builtin.rs b/tests/ui/macros/unknown-builtin.rs
index 048f5d68d34..aa6e04d3fb8 100644
--- a/tests/ui/macros/unknown-builtin.rs
+++ b/tests/ui/macros/unknown-builtin.rs
@@ -1,12 +1,11 @@
-//@ error-pattern: attempted to define built-in macro more than once
-
 #![feature(rustc_attrs)]
 
 #[rustc_builtin_macro]
 macro_rules! unknown { () => () } //~ ERROR cannot find a built-in macro with name `unknown`
 
+// Defining another `line` builtin macro should not cause an error.
 #[rustc_builtin_macro]
-macro_rules! line { () => () } //~ NOTE previously defined here
+macro_rules! line { () => () }
 
 fn main() {
     line!();
diff --git a/tests/ui/macros/unknown-builtin.stderr b/tests/ui/macros/unknown-builtin.stderr
index 22f54e04e54..1a83398891b 100644
--- a/tests/ui/macros/unknown-builtin.stderr
+++ b/tests/ui/macros/unknown-builtin.stderr
@@ -1,18 +1,8 @@
 error: cannot find a built-in macro with name `unknown`
-  --> $DIR/unknown-builtin.rs:6:1
+  --> $DIR/unknown-builtin.rs:4:1
    |
 LL | macro_rules! unknown { () => () }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error[E0773]: attempted to define built-in macro more than once
-  --> $SRC_DIR/core/src/macros/mod.rs:LL:COL
-   |
-note: previously defined here
-  --> $DIR/unknown-builtin.rs:9:1
-   |
-LL | macro_rules! line { () => () }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
-For more information about this error, try `rustc --explain E0773`.
diff --git a/tests/ui/macros/unreachable-format-args.edition_2015.stderr b/tests/ui/macros/unreachable-format-args.edition_2015.stderr
index 6a133d5e406..9104848a58b 100644
--- a/tests/ui/macros/unreachable-format-args.edition_2015.stderr
+++ b/tests/ui/macros/unreachable-format-args.edition_2015.stderr
@@ -6,7 +6,6 @@ LL |     unreachable!("x is {x} and y is {y}", y = 0);
    |
    = note: did you intend to capture a variable `x` from the surrounding scope?
    = note: to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro
-   = note: this error originates in the macro `$crate::concat` which comes from the expansion of the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/malformed/malformed-derive-entry.stderr b/tests/ui/malformed/malformed-derive-entry.stderr
index 3059d75d718..02036e8d4c9 100644
--- a/tests/ui/malformed/malformed-derive-entry.stderr
+++ b/tests/ui/malformed/malformed-derive-entry.stderr
@@ -24,7 +24,6 @@ LL | #[derive(Copy(Bad))]
    |
 note: required by a bound in `Copy`
   --> $SRC_DIR/core/src/marker.rs:LL:COL
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Test1` with `#[derive(Clone)]`
    |
 LL + #[derive(Clone)]
@@ -39,7 +38,6 @@ LL | #[derive(Copy="bad")]
    |
 note: required by a bound in `Copy`
   --> $SRC_DIR/core/src/marker.rs:LL:COL
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Test2` with `#[derive(Clone)]`
    |
 LL + #[derive(Clone)]
diff --git a/tests/ui/match/privately-uninhabited-issue-137999.rs b/tests/ui/match/privately-uninhabited-issue-137999.rs
new file mode 100644
index 00000000000..918393a0c6a
--- /dev/null
+++ b/tests/ui/match/privately-uninhabited-issue-137999.rs
@@ -0,0 +1,44 @@
+//@ edition:2024
+//@ check-fail
+
+mod m {
+    enum Void {}
+
+    pub struct Internal {
+        _v: Void,
+    }
+
+    pub enum Test {
+        A(u32, u32),
+        B(Internal),
+    }
+}
+
+use m::Test;
+
+pub fn f1(x: &mut Test) {
+    let r1: &mut u32 = match x {
+        Test::A(a, _) => a,
+        _ => todo!(),
+    };
+
+    let r2: &mut u32 = match x { //~ ERROR cannot use `*x` because it was mutably borrowed
+        Test::A(_, b) => b,
+        _ => todo!(),
+    };
+
+    let _ = *r1;
+    let _ = *r2;
+}
+
+pub fn f2(x: &mut Test) {
+    let r = &mut *x;
+    match x { //~ ERROR cannot use `*x` because it was mutably borrowed
+        Test::A(_, _) => {}
+        _ => {}
+    }
+
+    let _ = r;
+}
+
+fn main() {}
diff --git a/tests/ui/match/privately-uninhabited-issue-137999.stderr b/tests/ui/match/privately-uninhabited-issue-137999.stderr
new file mode 100644
index 00000000000..6f74a75375e
--- /dev/null
+++ b/tests/ui/match/privately-uninhabited-issue-137999.stderr
@@ -0,0 +1,26 @@
+error[E0503]: cannot use `*x` because it was mutably borrowed
+  --> $DIR/privately-uninhabited-issue-137999.rs:25:30
+   |
+LL |         Test::A(a, _) => a,
+   |                 - `x.0` is borrowed here
+...
+LL |     let r2: &mut u32 = match x {
+   |                              ^ use of borrowed `x.0`
+...
+LL |     let _ = *r1;
+   |             --- borrow later used here
+
+error[E0503]: cannot use `*x` because it was mutably borrowed
+  --> $DIR/privately-uninhabited-issue-137999.rs:36:11
+   |
+LL |     let r = &mut *x;
+   |             ------- `*x` is borrowed here
+LL |     match x {
+   |           ^ use of borrowed `*x`
+...
+LL |     let _ = r;
+   |             - borrow later used here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0503`.
diff --git a/tests/ui/methods/opaque_param_in_ufc.rs b/tests/ui/methods/opaque_param_in_ufc.rs
index b170e6805f6..3b0c8b778ff 100644
--- a/tests/ui/methods/opaque_param_in_ufc.rs
+++ b/tests/ui/methods/opaque_param_in_ufc.rs
@@ -11,11 +11,13 @@ impl Foo<u32> {
 
 type Bar = impl Sized;
 
+#[define_opaque(Bar)]
 fn bar() -> Bar {
     42_u32
 }
 
 impl Foo<Bar> {
+    #[define_opaque(Bar)]
     fn foo() -> Bar {
         Self::method();
         Foo::<Bar>::method();
diff --git a/tests/ui/mir-dataflow/inits-1.rs b/tests/ui/mir-dataflow/inits-1.rs
index 8fb1d4bc736..3331809f359 100644
--- a/tests/ui/mir-dataflow/inits-1.rs
+++ b/tests/ui/mir-dataflow/inits-1.rs
@@ -51,3 +51,5 @@ fn main() {
     foo(true, &mut S(13), S(14), S(15));
     foo(false, &mut S(13), S(14), S(15));
 }
+
+//~? ERROR stop_after_dataflow ended compilation
diff --git a/tests/ui/mir-dataflow/liveness-enum.rs b/tests/ui/mir-dataflow/liveness-enum.rs
index 5eb04ae8c8d..515f36698fb 100644
--- a/tests/ui/mir-dataflow/liveness-enum.rs
+++ b/tests/ui/mir-dataflow/liveness-enum.rs
@@ -20,3 +20,5 @@ fn foo() -> Option<i32> {
 }
 
 fn main() {}
+
+//~? ERROR stop_after_dataflow ended compilation
diff --git a/tests/ui/mir-dataflow/liveness-projection.rs b/tests/ui/mir-dataflow/liveness-projection.rs
index 486f31b635d..edea6ee60f6 100644
--- a/tests/ui/mir-dataflow/liveness-projection.rs
+++ b/tests/ui/mir-dataflow/liveness-projection.rs
@@ -30,3 +30,5 @@ fn foo() {
 }
 
 fn main() {}
+
+//~? ERROR stop_after_dataflow ended compilation
diff --git a/tests/ui/mir-dataflow/liveness-ptr.rs b/tests/ui/mir-dataflow/liveness-ptr.rs
index 786da523a33..704949aa9c8 100644
--- a/tests/ui/mir-dataflow/liveness-ptr.rs
+++ b/tests/ui/mir-dataflow/liveness-ptr.rs
@@ -26,3 +26,5 @@ fn foo() -> i32 {
 }
 
 fn main() {}
+
+//~? ERROR stop_after_dataflow ended compilation
diff --git a/tests/ui/mir-dataflow/uninits-1.rs b/tests/ui/mir-dataflow/uninits-1.rs
index c2b4284a7b4..c689512833d 100644
--- a/tests/ui/mir-dataflow/uninits-1.rs
+++ b/tests/ui/mir-dataflow/uninits-1.rs
@@ -49,3 +49,5 @@ fn main() {
     foo(true, &mut S(13), S(14), S(15));
     foo(false, &mut S(13), S(14), S(15));
 }
+
+//~? ERROR stop_after_dataflow ended compilation
diff --git a/tests/ui/mir-dataflow/uninits-2.rs b/tests/ui/mir-dataflow/uninits-2.rs
index c584ee74afb..04daf78e56f 100644
--- a/tests/ui/mir-dataflow/uninits-2.rs
+++ b/tests/ui/mir-dataflow/uninits-2.rs
@@ -22,3 +22,5 @@ fn main() {
     foo(&mut S(13));
     foo(&mut S(13));
 }
+
+//~? ERROR stop_after_dataflow ended compilation
diff --git a/tests/ui/mir/enable_passes_validation.rs b/tests/ui/mir/enable_passes_validation.rs
index 957e7d4d96d..405ada77183 100644
--- a/tests/ui/mir/enable_passes_validation.rs
+++ b/tests/ui/mir/enable_passes_validation.rs
@@ -19,3 +19,6 @@
 //@[mixed] error-pattern: warning: MIR pass `ThisPassDoesNotExist` is unknown and will be ignored
 
 fn main() {}
+
+//[empty]~? ERROR incorrect value `` for unstable option `mir-enable-passes`
+//[unprefixed]~? ERROR incorrect value `CheckAlignment` for unstable option `mir-enable-passes`
diff --git a/tests/ui/mir/inline-causes-trimmed-paths.rs b/tests/ui/mir/inline-causes-trimmed-paths.rs
new file mode 100644
index 00000000000..d626ab4e1d9
--- /dev/null
+++ b/tests/ui/mir/inline-causes-trimmed-paths.rs
@@ -0,0 +1,36 @@
+//@ build-pass
+//@ compile-flags: -Zinline-mir
+
+trait Storage {
+    type Buffer: ?Sized;
+}
+
+struct Array<const N: usize>;
+impl<const N: usize> Storage for Array<N> {
+    type Buffer = [(); N];
+}
+
+struct Slice;
+impl Storage for Slice {
+    type Buffer = [()];
+}
+
+struct Wrap<S: Storage> {
+    _b: S::Buffer,
+}
+
+fn coerce<const N: usize>(this: &Wrap<Array<N>>) -> &Wrap<Slice>
+where
+    Array<N>: Storage,
+{
+    coerce_again(this)
+}
+
+fn coerce_again<const N: usize>(this: &Wrap<Array<N>>) -> &Wrap<Slice> {
+    this
+}
+
+fn main() {
+    let inner: Wrap<Array<1>> = Wrap { _b: [(); 1] };
+    let _: &Wrap<Slice> = coerce(&inner);
+}
diff --git a/tests/ui/mir/issue-75053.rs b/tests/ui/mir/issue-75053.rs
index 38684f3548f..4bc481b82e5 100644
--- a/tests/ui/mir/issue-75053.rs
+++ b/tests/ui/mir/issue-75053.rs
@@ -1,6 +1,7 @@
+//@ check-pass
 //@ compile-flags: -Z mir-opt-level=3
 
-#![feature(type_alias_impl_trait, rustc_attrs)]
+#![feature(type_alias_impl_trait)]
 
 use std::marker::PhantomData;
 
@@ -13,13 +14,11 @@ trait MyFrom<T>: Sized {
     fn my_from(value: T) -> Result<Self, Self::Error>;
 }
 
-mod f {
-    pub trait F {}
-    impl F for () {}
-    pub type DummyT<T> = impl F;
-    fn _dummy_t<T>() -> DummyT<T> {}
-}
-use f::*;
+pub trait F {}
+impl F for () {}
+pub type DummyT<T> = impl F;
+#[define_opaque(DummyT)]
+fn _dummy_t<T>() -> DummyT<T> {}
 
 struct Phantom1<T>(PhantomData<T>);
 struct Phantom2<T>(PhantomData<T>);
@@ -45,8 +44,6 @@ impl<T: MyFrom<Phantom2<DummyT<U>>>, U> MyIndex<Phantom1<T>> for Scope<U> {
     }
 }
 
-#[rustc_error]
 fn main() {
-    //~^ ERROR
     let _pos: Phantom1<DummyT<()>> = Scope::new().my_index();
 }
diff --git a/tests/ui/mir/issue-75053.stderr b/tests/ui/mir/issue-75053.stderr
deleted file mode 100644
index a464d3266f4..00000000000
--- a/tests/ui/mir/issue-75053.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: fatal error triggered by #[rustc_error]
-  --> $DIR/issue-75053.rs:49:1
-   |
-LL | fn main() {
-   | ^^^^^^^^^
-
-error: aborting due to 1 previous error
-
diff --git a/tests/ui/mir/var_debug_ref.rs b/tests/ui/mir/var_debug_ref.rs
new file mode 100644
index 00000000000..1dcf38b5bb9
--- /dev/null
+++ b/tests/ui/mir/var_debug_ref.rs
@@ -0,0 +1,24 @@
+// Regression test for #138942, where a function was incorrectly internalized, despite the fact
+// that it was referenced by a var debug info from another code generation unit.
+//
+//@ build-pass
+//@ revisions: limited full
+//@ compile-flags: -Ccodegen-units=4
+//@[limited] compile-flags: -Cdebuginfo=limited
+//@[full]    compile-flags: -Cdebuginfo=full
+trait Fun {
+    const FUN: &'static fn();
+}
+impl Fun for () {
+    const FUN: &'static fn() = &(detail::f as fn());
+}
+mod detail {
+    // Place `f` in a distinct module to generate a separate code generation unit.
+    #[inline(never)]
+    pub(super) fn f() {}
+}
+fn main() {
+    // SingleUseConsts represents "x" using VarDebugInfoContents::Const.
+    // It is the only reference to `f` remaining.
+    let x = <() as ::Fun>::FUN;
+}
diff --git a/tests/ui/missing/missing-allocator.rs b/tests/ui/missing/missing-allocator.rs
index 3a65e657d0b..60aa9fcc898 100644
--- a/tests/ui/missing/missing-allocator.rs
+++ b/tests/ui/missing/missing-allocator.rs
@@ -16,3 +16,5 @@ fn oom(_: core::alloc::Layout) -> ! {
 }
 
 extern crate alloc;
+
+//~? ERROR no global memory allocator found but one is required
diff --git a/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod.rs b/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod.rs
index 4ff975af67d..b1ac0756688 100644
--- a/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod.rs
+++ b/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod.rs
@@ -1,2 +1,4 @@
 mod foo;
 fn main() {}
+
+//~? ERROR file not found for module `missing`
diff --git a/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod_inline.rs b/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod_inline.rs
index 9ebb4f1bdbd..987fe1166d7 100644
--- a/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod_inline.rs
+++ b/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod_inline.rs
@@ -1,2 +1,4 @@
 mod foo_inline;
 fn main() {}
+
+//~? ERROR file not found for module `missing`
diff --git a/tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.fixed b/tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.current.fixed
index 85b1853c23b..922c883f4f7 100644
--- a/tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.fixed
+++ b/tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.current.fixed
@@ -1,16 +1,17 @@
 //@ run-rustfix
+//@ revisions: current next
+//@[next] compile-flags: -Znext-solver
 #![allow(unused_variables, dead_code)]
-use std::collections::BTreeMap;
-use std::collections::HashSet;
+use std::collections::{BTreeMap, HashSet};
 
-#[derive(Debug,Eq,PartialEq,Hash)]
+#[derive(Debug, Eq, PartialEq, Hash)]
 #[derive(Clone)]
 enum Day {
     Mon,
 }
 
 struct Class {
-    days: BTreeMap<u32, HashSet<Day>>
+    days: BTreeMap<u32, HashSet<Day>>,
 }
 
 impl Class {
diff --git a/tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.stderr b/tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.current.stderr
index 6a9d76f7998..301f3c3a458 100644
--- a/tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.stderr
+++ b/tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.current.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/assignment-of-clone-call-on-ref-due-to-missing-bound.rs:18:39
+  --> $DIR/assignment-of-clone-call-on-ref-due-to-missing-bound.rs:19:39
    |
 LL |             let mut x: HashSet<Day> = v.clone();
    |                        ------------   ^^^^^^^^^ expected `HashSet<Day>`, found `&HashSet<Day>`
@@ -9,7 +9,7 @@ LL |             let mut x: HashSet<Day> = v.clone();
    = note: expected struct `HashSet<_>`
            found reference `&HashSet<_>`
 note: `HashSet<Day>` does not implement `Clone`, so `&HashSet<Day>` was cloned instead
-  --> $DIR/assignment-of-clone-call-on-ref-due-to-missing-bound.rs:18:39
+  --> $DIR/assignment-of-clone-call-on-ref-due-to-missing-bound.rs:19:39
    |
 LL |             let mut x: HashSet<Day> = v.clone();
    |                                       ^
diff --git a/tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.next.fixed b/tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.next.fixed
new file mode 100644
index 00000000000..922c883f4f7
--- /dev/null
+++ b/tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.next.fixed
@@ -0,0 +1,31 @@
+//@ run-rustfix
+//@ revisions: current next
+//@[next] compile-flags: -Znext-solver
+#![allow(unused_variables, dead_code)]
+use std::collections::{BTreeMap, HashSet};
+
+#[derive(Debug, Eq, PartialEq, Hash)]
+#[derive(Clone)]
+enum Day {
+    Mon,
+}
+
+struct Class {
+    days: BTreeMap<u32, HashSet<Day>>,
+}
+
+impl Class {
+    fn do_stuff(&self) {
+        for (_, v) in &self.days {
+            let mut x: HashSet<Day> = v.clone(); //~ ERROR
+            let y: Vec<Day> = x.drain().collect();
+            println!("{:?}", x);
+        }
+    }
+}
+
+fn fail() {
+    let c = Class { days: BTreeMap::new() };
+    c.do_stuff();
+}
+fn main() {}
diff --git a/tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.next.stderr b/tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.next.stderr
new file mode 100644
index 00000000000..301f3c3a458
--- /dev/null
+++ b/tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.next.stderr
@@ -0,0 +1,25 @@
+error[E0308]: mismatched types
+  --> $DIR/assignment-of-clone-call-on-ref-due-to-missing-bound.rs:19:39
+   |
+LL |             let mut x: HashSet<Day> = v.clone();
+   |                        ------------   ^^^^^^^^^ expected `HashSet<Day>`, found `&HashSet<Day>`
+   |                        |
+   |                        expected due to this
+   |
+   = note: expected struct `HashSet<_>`
+           found reference `&HashSet<_>`
+note: `HashSet<Day>` does not implement `Clone`, so `&HashSet<Day>` was cloned instead
+  --> $DIR/assignment-of-clone-call-on-ref-due-to-missing-bound.rs:19:39
+   |
+LL |             let mut x: HashSet<Day> = v.clone();
+   |                                       ^
+   = help: `Clone` is not implemented because the trait bound `Day: Clone` is not satisfied
+help: consider annotating `Day` with `#[derive(Clone)]`
+   |
+LL + #[derive(Clone)]
+LL | enum Day {
+   |
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.rs b/tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.rs
index 740cda470d9..6f7b55be8bd 100644
--- a/tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.rs
+++ b/tests/ui/moves/assignment-of-clone-call-on-ref-due-to-missing-bound.rs
@@ -1,15 +1,16 @@
 //@ run-rustfix
+//@ revisions: current next
+//@[next] compile-flags: -Znext-solver
 #![allow(unused_variables, dead_code)]
-use std::collections::BTreeMap;
-use std::collections::HashSet;
+use std::collections::{BTreeMap, HashSet};
 
-#[derive(Debug,Eq,PartialEq,Hash)]
+#[derive(Debug, Eq, PartialEq, Hash)]
 enum Day {
     Mon,
 }
 
 struct Class {
-    days: BTreeMap<u32, HashSet<Day>>
+    days: BTreeMap<u32, HashSet<Day>>,
 }
 
 impl Class {
diff --git a/tests/ui/never_type/fallback-closure-wrap.fallback.stderr b/tests/ui/never_type/fallback-closure-wrap.fallback.stderr
index ac99a1fc24c..afb929454c7 100644
--- a/tests/ui/never_type/fallback-closure-wrap.fallback.stderr
+++ b/tests/ui/never_type/fallback-closure-wrap.fallback.stderr
@@ -9,7 +9,6 @@ LL |         panic!("Can't connect to server.");
    = note: expected unit type `()`
                    found type `!`
    = note: required for the cast from `Box<{closure@$DIR/fallback-closure-wrap.rs:18:40: 18:47}>` to `Box<dyn FnMut()>`
-   = note: this error originates in the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/never_type/impl_trait_fallback2.rs b/tests/ui/never_type/impl_trait_fallback2.rs
index 12c187b9e82..399bd72561b 100644
--- a/tests/ui/never_type/impl_trait_fallback2.rs
+++ b/tests/ui/never_type/impl_trait_fallback2.rs
@@ -12,11 +12,13 @@ fn should_ret_unit() -> impl T {
 
 type Foo = impl T;
 
+#[define_opaque(Foo)]
 fn a() -> Foo {
     //~^ ERROR `(): T` is not satisfied
     panic!()
 }
 
+#[define_opaque(Foo)]
 fn b() -> Foo {
     42
 }
diff --git a/tests/ui/never_type/impl_trait_fallback2.stderr b/tests/ui/never_type/impl_trait_fallback2.stderr
index 4c32dce465b..0f197aa5cc6 100644
--- a/tests/ui/never_type/impl_trait_fallback2.stderr
+++ b/tests/ui/never_type/impl_trait_fallback2.stderr
@@ -10,7 +10,7 @@ LL |     panic!()
    = help: the trait `T` is implemented for `i32`
 
 error[E0277]: the trait bound `(): T` is not satisfied
-  --> $DIR/impl_trait_fallback2.rs:15:11
+  --> $DIR/impl_trait_fallback2.rs:16:11
    |
 LL | fn a() -> Foo {
    |           ^^^ the trait `T` is not implemented for `()`
diff --git a/tests/ui/never_type/impl_trait_fallback3.rs b/tests/ui/never_type/impl_trait_fallback3.rs
index ed645b82394..3740aad73f0 100644
--- a/tests/ui/never_type/impl_trait_fallback3.rs
+++ b/tests/ui/never_type/impl_trait_fallback3.rs
@@ -8,6 +8,7 @@ trait T {
 
 type Foo = impl T;
 
+#[define_opaque(Foo)]
 fn a() -> Foo {
     //~^ ERROR the trait bound `(): T` is not satisfied
     // This is not a defining use, it doesn't actually constrain the opaque type.
diff --git a/tests/ui/never_type/impl_trait_fallback3.stderr b/tests/ui/never_type/impl_trait_fallback3.stderr
index fde8d0896dd..11425a74953 100644
--- a/tests/ui/never_type/impl_trait_fallback3.stderr
+++ b/tests/ui/never_type/impl_trait_fallback3.stderr
@@ -1,5 +1,5 @@
 error[E0277]: the trait bound `(): T` is not satisfied
-  --> $DIR/impl_trait_fallback3.rs:11:11
+  --> $DIR/impl_trait_fallback3.rs:12:11
    |
 LL | fn a() -> Foo {
    |           ^^^ the trait `T` is not implemented for `()`
diff --git a/tests/ui/never_type/impl_trait_fallback4.rs b/tests/ui/never_type/impl_trait_fallback4.rs
index fe62773fa02..2fa3d0028be 100644
--- a/tests/ui/never_type/impl_trait_fallback4.rs
+++ b/tests/ui/never_type/impl_trait_fallback4.rs
@@ -15,6 +15,7 @@ fn foo() -> impl T {
     panic!()
 }
 
+#[define_opaque(Foo)]
 fn a() -> Foo {
     foo()
 }
diff --git a/tests/ui/panic-handler/panic-handler-wrong-location.rs b/tests/ui/panic-handler/panic-handler-wrong-location.rs
index 49685ee4592..c91580ae0c4 100644
--- a/tests/ui/panic-handler/panic-handler-wrong-location.rs
+++ b/tests/ui/panic-handler/panic-handler-wrong-location.rs
@@ -6,3 +6,5 @@
 #[panic_handler] //~ ERROR `panic_impl` lang item must be applied to a function
 #[no_mangle]
 static X: u32 = 42;
+
+//~? ERROR `#[panic_handler]` function required, but not found
diff --git a/tests/ui/parser/attribute/attr-bad-meta-4.rs b/tests/ui/parser/attribute/attr-bad-meta-4.rs
index 2d0c6dbb50a..937390a6da5 100644
--- a/tests/ui/parser/attribute/attr-bad-meta-4.rs
+++ b/tests/ui/parser/attribute/attr-bad-meta-4.rs
@@ -2,7 +2,6 @@ macro_rules! mac {
     ($attr_item: meta) => {
         #[cfg($attr_item)]
         //~^ ERROR expected unsuffixed literal, found `meta` metavariable
-        //~| ERROR expected unsuffixed literal, found `meta` metavariable
         struct S;
     }
 }
@@ -11,7 +10,6 @@ mac!(an(arbitrary token stream));
 
 #[cfg(feature = -1)]
 //~^ ERROR expected unsuffixed literal, found `-`
-//~| ERROR expected unsuffixed literal, found `-`
 fn handler() {}
 
 fn main() {}
diff --git a/tests/ui/parser/attribute/attr-bad-meta-4.stderr b/tests/ui/parser/attribute/attr-bad-meta-4.stderr
index dea574fd36d..9c6ab5adadf 100644
--- a/tests/ui/parser/attribute/attr-bad-meta-4.stderr
+++ b/tests/ui/parser/attribute/attr-bad-meta-4.stderr
@@ -1,5 +1,5 @@
 error: expected unsuffixed literal, found `-`
-  --> $DIR/attr-bad-meta-4.rs:12:17
+  --> $DIR/attr-bad-meta-4.rs:11:17
    |
 LL | #[cfg(feature = -1)]
    |                 ^
@@ -15,25 +15,5 @@ LL | mac!(an(arbitrary token stream));
    |
    = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: expected unsuffixed literal, found `meta` metavariable
-  --> $DIR/attr-bad-meta-4.rs:3:15
-   |
-LL |         #[cfg($attr_item)]
-   |               ^^^^^^^^^^
-...
-LL | mac!(an(arbitrary token stream));
-   | -------------------------------- in this macro invocation
-   |
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-   = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: expected unsuffixed literal, found `-`
-  --> $DIR/attr-bad-meta-4.rs:12:17
-   |
-LL | #[cfg(feature = -1)]
-   |                 ^
-   |
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-
-error: aborting due to 4 previous errors
+error: aborting due to 2 previous errors
 
diff --git a/tests/ui/parser/closure-return-syntax.rs b/tests/ui/parser/closure-return-syntax.rs
index c6a08abeff4..6865d8c5393 100644
--- a/tests/ui/parser/closure-return-syntax.rs
+++ b/tests/ui/parser/closure-return-syntax.rs
@@ -1,7 +1,21 @@
 // Test that we cannot parse a closure with an explicit return type
 // unless it uses braces.
 
-fn main() {
+fn needs_braces_1() {
     let x = || -> i32 22;
     //~^ ERROR expected `{`, found `22`
 }
+
+// Check other delimiters too.
+
+fn needs_braces_2() {
+        let x = || -> (i32, i32) (1, 2);
+        //~^ ERROR expected `{`, found `(`
+}
+
+fn needs_braces_3() {
+        let c = || -> [i32; 2] [1, 2];
+        //~^ ERROR expected `{`, found `[`
+}
+
+fn main() {}
diff --git a/tests/ui/parser/closure-return-syntax.stderr b/tests/ui/parser/closure-return-syntax.stderr
index aacc31ed871..763f19ccc64 100644
--- a/tests/ui/parser/closure-return-syntax.stderr
+++ b/tests/ui/parser/closure-return-syntax.stderr
@@ -2,12 +2,40 @@ error: expected `{`, found `22`
   --> $DIR/closure-return-syntax.rs:5:23
    |
 LL |     let x = || -> i32 22;
-   |                       ^^ expected `{`
+   |                   --- ^^
+   |                   |
+   |                   explicit return type requires closure body to be enclosed in braces
    |
-help: you might have meant to write this as part of a block
+help: wrap the expression in curly braces
    |
 LL |     let x = || -> i32 { 22 };
    |                       +    +
 
-error: aborting due to 1 previous error
+error: expected `{`, found `(`
+  --> $DIR/closure-return-syntax.rs:12:34
+   |
+LL |         let x = || -> (i32, i32) (1, 2);
+   |                       ---------- ^
+   |                       |
+   |                       explicit return type requires closure body to be enclosed in braces
+   |
+help: wrap the expression in curly braces
+   |
+LL |         let x = || -> (i32, i32) { (1, 2) };
+   |                                  +        +
+
+error: expected `{`, found `[`
+  --> $DIR/closure-return-syntax.rs:17:32
+   |
+LL |         let c = || -> [i32; 2] [1, 2];
+   |                       -------- ^
+   |                       |
+   |                       explicit return type requires closure body to be enclosed in braces
+   |
+help: wrap the expression in curly braces
+   |
+LL |         let c = || -> [i32; 2] { [1, 2] };
+   |                                +        +
+
+error: aborting due to 3 previous errors
 
diff --git a/tests/ui/parser/issues/issue-103451.rs b/tests/ui/parser/issues/issue-103451.rs
index 6b0928229e9..687dbc632d6 100644
--- a/tests/ui/parser/issues/issue-103451.rs
+++ b/tests/ui/parser/issues/issue-103451.rs
@@ -1,4 +1,4 @@
-//@ error-pattern: this file contains an unclosed delimiter
 struct R { }
+//~vv ERROR this file contains an unclosed delimiter
 struct S {
     x: [u8; R
diff --git a/tests/ui/parser/issues/issue-10636-2.rs b/tests/ui/parser/issues/issue-10636-2.rs
index 7200ea1f1dd..dcc03fec545 100644
--- a/tests/ui/parser/issues/issue-10636-2.rs
+++ b/tests/ui/parser/issues/issue-10636-2.rs
@@ -1,7 +1,7 @@
-//@ error-pattern: mismatched closing delimiter: `}`
 // FIXME(31528) we emit a bunch of silly errors here due to continuing past the
 // first one. This would be easy-ish to address by better recovery in tokenisation.
 
+//~vvvvv ERROR mismatched closing delimiter: `}`
 pub fn trace_option(option: Option<isize>) {
     option.map(|some| 42;
 
diff --git a/tests/ui/parser/issues/issue-111692.rs b/tests/ui/parser/issues/issue-111692.rs
deleted file mode 100644
index 56096f706a8..00000000000
--- a/tests/ui/parser/issues/issue-111692.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-mod module {
-    #[derive(Eq, PartialEq)]
-    pub struct Type {
-        pub x: u8,
-        pub y: u8,
-    }
-
-    pub const C: u8 = 32u8;
-}
-
-fn test(x: module::Type) {
-    if x == module::Type { x: module::C, y: 1 } { //~ ERROR invalid struct literal
-    }
-}
-
-fn test2(x: module::Type) {
-    if x ==module::Type { x: module::C, y: 1 } { //~ ERROR invalid struct literal
-    }
-}
-
-
-fn test3(x: module::Type) {
-    if x == Type { x: module::C, y: 1 } { //~ ERROR invalid struct literal
-    }
-}
-
-fn test4(x: module::Type) {
-    if x == demo_module::Type { x: module::C, y: 1 } { //~ ERROR invalid struct literal
-    }
-}
-
-fn main() { }
diff --git a/tests/ui/parser/issues/issue-111692.stderr b/tests/ui/parser/issues/issue-111692.stderr
deleted file mode 100644
index 068b0483b0f..00000000000
--- a/tests/ui/parser/issues/issue-111692.stderr
+++ /dev/null
@@ -1,46 +0,0 @@
-error: invalid struct literal
-  --> $DIR/issue-111692.rs:12:21
-   |
-LL |     if x == module::Type { x: module::C, y: 1 } {
-   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: you might need to surround the struct literal with parentheses
-   |
-LL |     if x == (module::Type { x: module::C, y: 1 }) {
-   |             +                                   +
-
-error: invalid struct literal
-  --> $DIR/issue-111692.rs:17:20
-   |
-LL |     if x ==module::Type { x: module::C, y: 1 } {
-   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: you might need to surround the struct literal with parentheses
-   |
-LL |     if x ==(module::Type { x: module::C, y: 1 }) {
-   |            +                                   +
-
-error: invalid struct literal
-  --> $DIR/issue-111692.rs:23:13
-   |
-LL |     if x == Type { x: module::C, y: 1 } {
-   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: you might need to surround the struct literal with parentheses
-   |
-LL |     if x == (Type { x: module::C, y: 1 }) {
-   |             +                           +
-
-error: invalid struct literal
-  --> $DIR/issue-111692.rs:28:26
-   |
-LL |     if x == demo_module::Type { x: module::C, y: 1 } {
-   |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: you might need to surround the struct literal with parentheses
-   |
-LL |     if x == (demo_module::Type { x: module::C, y: 1 }) {
-   |             +                                        +
-
-error: aborting due to 4 previous errors
-
diff --git a/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.rs b/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.rs
index 7952d29c260..0c0fbd7d592 100644
--- a/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.rs
+++ b/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.rs
@@ -1,5 +1,4 @@
 // Fixed in #66054.
 // ignore-tidy-trailing-newlines
-//@ error-pattern: this file contains an unclosed delimiter
-//@ error-pattern: aborting due to 1 previous error
+//~v ERROR this file contains an unclosed delimiter
 #[Ѕ
\ No newline at end of file
diff --git a/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.stderr b/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.stderr
index 14f5469f6af..28fd78d660d 100644
--- a/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.stderr
+++ b/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.stderr
@@ -1,5 +1,5 @@
 error: this file contains an unclosed delimiter
-  --> $DIR/issue-58094-missing-right-square-bracket.rs:5:4
+  --> $DIR/issue-58094-missing-right-square-bracket.rs:4:4
    |
 LL | #[Ѕ
    |  - ^
diff --git a/tests/ui/parser/issues/issue-62524.rs b/tests/ui/parser/issues/issue-62524.rs
index a219f662cf7..a8c7d6eb9fd 100644
--- a/tests/ui/parser/issues/issue-62524.rs
+++ b/tests/ui/parser/issues/issue-62524.rs
@@ -1,6 +1,7 @@
 // ignore-tidy-trailing-newlines
-//@ error-pattern: aborting due to 1 previous error
+
 #![allow(uncommon_codepoints)]
 
+//~vv ERROR this file contains an unclosed delimiter
 y![
 Ϥ,
\ No newline at end of file
diff --git a/tests/ui/parser/issues/issue-62524.stderr b/tests/ui/parser/issues/issue-62524.stderr
index d83a49aedd6..c1ff6e7e715 100644
--- a/tests/ui/parser/issues/issue-62524.stderr
+++ b/tests/ui/parser/issues/issue-62524.stderr
@@ -1,5 +1,5 @@
 error: this file contains an unclosed delimiter
-  --> $DIR/issue-62524.rs:6:3
+  --> $DIR/issue-62524.rs:7:3
    |
 LL | y![
    |   - unclosed delimiter
diff --git a/tests/ui/parser/issues/issue-62554.rs b/tests/ui/parser/issues/issue-62554.rs
index 9f196e4b0d6..4a8a1684a41 100644
--- a/tests/ui/parser/issues/issue-62554.rs
+++ b/tests/ui/parser/issues/issue-62554.rs
@@ -1,5 +1,4 @@
-//@ error-pattern:this file contains an unclosed delimiter
-
 fn main() {}
 
+//~v ERROR this file contains an unclosed delimiter
 fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
diff --git a/tests/ui/parser/issues/issue-62554.stderr b/tests/ui/parser/issues/issue-62554.stderr
index d4aaef16181..50515c4c574 100644
--- a/tests/ui/parser/issues/issue-62554.stderr
+++ b/tests/ui/parser/issues/issue-62554.stderr
@@ -1,5 +1,5 @@
 error: this file contains an unclosed delimiter
-  --> $DIR/issue-62554.rs:5:89
+  --> $DIR/issue-62554.rs:4:89
    |
 LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
    |               -                       -         -                  -                  -^
diff --git a/tests/ui/parser/issues/issue-62894.rs b/tests/ui/parser/issues/issue-62894.rs
index 5b1627a2553..c49cbe4b934 100644
--- a/tests/ui/parser/issues/issue-62894.rs
+++ b/tests/ui/parser/issues/issue-62894.rs
@@ -1,6 +1,6 @@
 // Regression test for #62894, shouldn't crash.
-//@ error-pattern: this file contains an unclosed delimiter
 
+//~vvv ERROR this file contains an unclosed delimiter
 fn f() { assert_eq!(f(), (), assert_eq!(assert_eq!
 
 fn main() {}
diff --git a/tests/ui/parser/issues/issue-62973.rs b/tests/ui/parser/issues/issue-62973.rs
index 5c666d802fe..a091e4eec1d 100644
--- a/tests/ui/parser/issues/issue-62973.rs
+++ b/tests/ui/parser/issues/issue-62973.rs
@@ -1,8 +1,10 @@
 // ignore-tidy-trailing-newlines
-//@ error-pattern: aborting due to 3 previous errors
 
 fn main() {}
 
+//~vvv ERROR mismatched closing delimiter: `)`
+//~vv ERROR mismatched closing delimiter: `)`
+//~vvv ERROR this file contains an unclosed delimiter
 fn p() { match s { v, E { [) {) }
 
 
diff --git a/tests/ui/parser/issues/issue-62973.stderr b/tests/ui/parser/issues/issue-62973.stderr
index 493183988e1..ea3e2bebee4 100644
--- a/tests/ui/parser/issues/issue-62973.stderr
+++ b/tests/ui/parser/issues/issue-62973.stderr
@@ -1,5 +1,5 @@
 error: mismatched closing delimiter: `)`
-  --> $DIR/issue-62973.rs:6:27
+  --> $DIR/issue-62973.rs:8:27
    |
 LL | fn p() { match s { v, E { [) {) }
    |                           ^^ mismatched closing delimiter
@@ -7,7 +7,7 @@ LL | fn p() { match s { v, E { [) {) }
    |                           unclosed delimiter
 
 error: mismatched closing delimiter: `)`
-  --> $DIR/issue-62973.rs:6:30
+  --> $DIR/issue-62973.rs:8:30
    |
 LL | fn p() { match s { v, E { [) {) }
    |                              ^^ mismatched closing delimiter
@@ -15,7 +15,7 @@ LL | fn p() { match s { v, E { [) {) }
    |                              unclosed delimiter
 
 error: this file contains an unclosed delimiter
-  --> $DIR/issue-62973.rs:8:2
+  --> $DIR/issue-62973.rs:10:2
    |
 LL | fn p() { match s { v, E { [) {) }
    |        -         -         -  - missing open `(` for this delimiter
diff --git a/tests/ui/parser/issues/issue-63116.rs b/tests/ui/parser/issues/issue-63116.rs
index 3be9606b4ed..48abe639e8d 100644
--- a/tests/ui/parser/issues/issue-63116.rs
+++ b/tests/ui/parser/issues/issue-63116.rs
@@ -1,3 +1,4 @@
 // fixed by #66361
-//@ error-pattern: aborting due to 2 previous errors
+//~vv ERROR mismatched closing delimiter: `]`
+//~v ERROR this file contains an unclosed delimiter
 impl W <s(f;Y(;]
diff --git a/tests/ui/parser/issues/issue-63116.stderr b/tests/ui/parser/issues/issue-63116.stderr
index e0f7dd176ce..e5bad84d112 100644
--- a/tests/ui/parser/issues/issue-63116.stderr
+++ b/tests/ui/parser/issues/issue-63116.stderr
@@ -1,5 +1,5 @@
 error: mismatched closing delimiter: `]`
-  --> $DIR/issue-63116.rs:3:14
+  --> $DIR/issue-63116.rs:4:14
    |
 LL | impl W <s(f;Y(;]
    |              ^ ^ mismatched closing delimiter
@@ -7,7 +7,7 @@ LL | impl W <s(f;Y(;]
    |              unclosed delimiter
 
 error: this file contains an unclosed delimiter
-  --> $DIR/issue-63116.rs:3:18
+  --> $DIR/issue-63116.rs:4:18
    |
 LL | impl W <s(f;Y(;]
    |          -     -^
diff --git a/tests/ui/parser/issues/issue-63135.rs b/tests/ui/parser/issues/issue-63135.rs
index 112dd4c83dd..63eca5b87ef 100644
--- a/tests/ui/parser/issues/issue-63135.rs
+++ b/tests/ui/parser/issues/issue-63135.rs
@@ -1,3 +1,2 @@
-//@ error-pattern: this file contains an unclosed delimiter
-//@ error-pattern: aborting due to 1 previous error
+//~v ERROR this file contains an unclosed delimiter
 fn i(n{...,f #
diff --git a/tests/ui/parser/issues/issue-63135.stderr b/tests/ui/parser/issues/issue-63135.stderr
index d6275901a53..061ec170388 100644
--- a/tests/ui/parser/issues/issue-63135.stderr
+++ b/tests/ui/parser/issues/issue-63135.stderr
@@ -1,5 +1,5 @@
 error: this file contains an unclosed delimiter
-  --> $DIR/issue-63135.rs:3:16
+  --> $DIR/issue-63135.rs:2:16
    |
 LL | fn i(n{...,f #
    |     - -       ^
diff --git a/tests/ui/parser/issues/issue-81804.rs b/tests/ui/parser/issues/issue-81804.rs
index 7c9e6e90582..57951ca5c4b 100644
--- a/tests/ui/parser/issues/issue-81804.rs
+++ b/tests/ui/parser/issues/issue-81804.rs
@@ -1,6 +1,5 @@
-//@ error-pattern: this file contains an unclosed delimiter
-//@ error-pattern: this file contains an unclosed delimiter
-
 fn main() {}
 
+//~vv ERROR mismatched closing delimiter: `}`
+//~v ERROR this file contains an unclosed delimiter
 fn p([=(}
diff --git a/tests/ui/parser/issues/issue-81804.stderr b/tests/ui/parser/issues/issue-81804.stderr
index 6caaaa792b1..f12c6a61ce5 100644
--- a/tests/ui/parser/issues/issue-81804.stderr
+++ b/tests/ui/parser/issues/issue-81804.stderr
@@ -1,5 +1,5 @@
 error: mismatched closing delimiter: `}`
-  --> $DIR/issue-81804.rs:6:8
+  --> $DIR/issue-81804.rs:5:8
    |
 LL | fn p([=(}
    |        ^^ mismatched closing delimiter
@@ -7,7 +7,7 @@ LL | fn p([=(}
    |        unclosed delimiter
 
 error: this file contains an unclosed delimiter
-  --> $DIR/issue-81804.rs:6:11
+  --> $DIR/issue-81804.rs:5:11
    |
 LL | fn p([=(}
    |     --   ^
diff --git a/tests/ui/parser/issues/issue-81827.rs b/tests/ui/parser/issues/issue-81827.rs
index a2bd345fc05..7dfeec13022 100644
--- a/tests/ui/parser/issues/issue-81827.rs
+++ b/tests/ui/parser/issues/issue-81827.rs
@@ -1,10 +1,7 @@
-//@ error-pattern: this file contains an unclosed delimiter
-//@ error-pattern: mismatched closing delimiter: `]`
-
 #![crate_name="0"]
 
-
-
 fn main() {}
 
+//~vv ERROR mismatched closing delimiter: `]`
+//~v ERROR this file contains an unclosed delimiter
 fn r()->i{0|{#[cfg(r(0{]0
diff --git a/tests/ui/parser/issues/issue-81827.stderr b/tests/ui/parser/issues/issue-81827.stderr
index d12c74b4a34..986ed6b7e70 100644
--- a/tests/ui/parser/issues/issue-81827.stderr
+++ b/tests/ui/parser/issues/issue-81827.stderr
@@ -1,5 +1,5 @@
 error: mismatched closing delimiter: `]`
-  --> $DIR/issue-81827.rs:10:23
+  --> $DIR/issue-81827.rs:7:23
    |
 LL | fn r()->i{0|{#[cfg(r(0{]0
    |               -       ^^ mismatched closing delimiter
@@ -8,7 +8,7 @@ LL | fn r()->i{0|{#[cfg(r(0{]0
    |               closing delimiter possibly meant for this
 
 error: this file contains an unclosed delimiter
-  --> $DIR/issue-81827.rs:10:27
+  --> $DIR/issue-81827.rs:7:27
    |
 LL | fn r()->i{0|{#[cfg(r(0{]0
    |          -  -          - ^
diff --git a/tests/ui/parser/issues/issue-84104.rs b/tests/ui/parser/issues/issue-84104.rs
index bced05e684a..6baf882701d 100644
--- a/tests/ui/parser/issues/issue-84104.rs
+++ b/tests/ui/parser/issues/issue-84104.rs
@@ -1,2 +1,2 @@
-//@ error-pattern: this file contains an unclosed delimiter
+//~v ERROR this file contains an unclosed delimiter
 #[i=i::<ښܖ<
diff --git a/tests/ui/parser/issues/issue-84148-2.rs b/tests/ui/parser/issues/issue-84148-2.rs
index 560475bd32c..452279021ab 100644
--- a/tests/ui/parser/issues/issue-84148-2.rs
+++ b/tests/ui/parser/issues/issue-84148-2.rs
@@ -1,2 +1,2 @@
-//@ error-pattern: this file contains an unclosed delimiter
+//~v ERROR this file contains an unclosed delimiter
 fn f(t:for<>t?
diff --git a/tests/ui/parser/issues/issue-88770.rs b/tests/ui/parser/issues/issue-88770.rs
index ecc50481f65..0dd18435ce3 100644
--- a/tests/ui/parser/issues/issue-88770.rs
+++ b/tests/ui/parser/issues/issue-88770.rs
@@ -1,7 +1,6 @@
 // Regression test for the ICE described in #88770.
 
-//@ error-pattern:this file contains an unclosed delimiter
-
+//~vvvv ERROR this file contains an unclosed delimiter
 fn m(){print!("",(c for&g
 u
 e
diff --git a/tests/ui/parser/issues/issue-88770.stderr b/tests/ui/parser/issues/issue-88770.stderr
index 5b54072d009..137cfea7e1d 100644
--- a/tests/ui/parser/issues/issue-88770.stderr
+++ b/tests/ui/parser/issues/issue-88770.stderr
@@ -1,5 +1,5 @@
 error: this file contains an unclosed delimiter
-  --> $DIR/issue-88770.rs:8:3
+  --> $DIR/issue-88770.rs:7:3
    |
 LL | fn m(){print!("",(c for&g
    |       -      -   - unclosed delimiter
diff --git a/tests/ui/parser/issues/issue-94340.rs b/tests/ui/parser/issues/issue-94340.rs
index d0fb84a689a..4f3dbc6acdd 100644
--- a/tests/ui/parser/issues/issue-94340.rs
+++ b/tests/ui/parser/issues/issue-94340.rs
@@ -6,3 +6,6 @@
 include!("auxiliary/issue-94340-inc.rs");
 
 fn main() {}
+
+//~? ERROR an inner attribute is not permitted in this context
+//~? ERROR an inner attribute is not permitted in this context
diff --git a/tests/ui/parser/mbe_missing_right_paren.rs b/tests/ui/parser/mbe_missing_right_paren.rs
index 9c57b0ebcfc..85191931664 100644
--- a/tests/ui/parser/mbe_missing_right_paren.rs
+++ b/tests/ui/parser/mbe_missing_right_paren.rs
@@ -1,3 +1,3 @@
 // ignore-tidy-trailing-newlines
-//@ error-pattern: this file contains an unclosed delimiter
+//~v ERROR this file contains an unclosed delimiter
 macro_rules! abc(ؼ
\ No newline at end of file
diff --git a/tests/ui/parser/method-call-on-struct-literal-in-if-condition.rs b/tests/ui/parser/method-call-on-struct-literal-in-if-condition.rs
deleted file mode 100644
index 8be7c9ee8ac..00000000000
--- a/tests/ui/parser/method-call-on-struct-literal-in-if-condition.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-pub struct Example { a: i32 }
-
-impl Example {
-    fn is_pos(&self) -> bool { self.a > 0 }
-}
-
-fn one() -> i32 { 1 }
-
-fn main() {
-    if Example { a: one(), }.is_pos() { //~ ERROR invalid struct literal
-        println!("Positive!");
-    }
-}
diff --git a/tests/ui/parser/method-call-on-struct-literal-in-if-condition.stderr b/tests/ui/parser/method-call-on-struct-literal-in-if-condition.stderr
deleted file mode 100644
index f7822ba1124..00000000000
--- a/tests/ui/parser/method-call-on-struct-literal-in-if-condition.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error: invalid struct literal
-  --> $DIR/method-call-on-struct-literal-in-if-condition.rs:10:8
-   |
-LL |     if Example { a: one(), }.is_pos() {
-   |        ^^^^^^^^^^^^^^^^^^^^^
-   |
-help: you might need to surround the struct literal with parentheses
-   |
-LL |     if (Example { a: one(), }).is_pos() {
-   |        +                     +
-
-error: aborting due to 1 previous error
-
diff --git a/tests/ui/parser/missing_right_paren.rs b/tests/ui/parser/missing_right_paren.rs
index bbf4519a713..311a16c214c 100644
--- a/tests/ui/parser/missing_right_paren.rs
+++ b/tests/ui/parser/missing_right_paren.rs
@@ -1,4 +1,3 @@
 // ignore-tidy-trailing-newlines
-//@ error-pattern: this file contains an unclosed delimiter
-//@ error-pattern: aborting due to 1 previous error
+//~v ERROR this file contains an unclosed delimiter
 fn main((ؼ
\ No newline at end of file
diff --git a/tests/ui/parser/missing_right_paren.stderr b/tests/ui/parser/missing_right_paren.stderr
index 4815f04fbce..97ccb40a5a2 100644
--- a/tests/ui/parser/missing_right_paren.stderr
+++ b/tests/ui/parser/missing_right_paren.stderr
@@ -1,5 +1,5 @@
 error: this file contains an unclosed delimiter
-  --> $DIR/missing_right_paren.rs:4:11
+  --> $DIR/missing_right_paren.rs:3:11
    |
 LL | fn main((ؼ
    |        -- ^
diff --git a/tests/ui/parser/operator-precedence-braces-exprs.rs b/tests/ui/parser/operator-precedence-braces-exprs.rs
new file mode 100644
index 00000000000..d6f44ef879c
--- /dev/null
+++ b/tests/ui/parser/operator-precedence-braces-exprs.rs
@@ -0,0 +1,28 @@
+//! Regression test for ensuring that operator precedence is correctly handled in the presence of
+//! braces
+//!
+//! Issue: <https://github.com/rust-lang/rust/issues/28777>
+
+//@ run-pass
+
+#[allow(unused_braces)]
+fn main() {
+    let v1 = { 1 + { 2 } * { 3 } };
+    let v2 = 1 + { 2 } * { 3 };
+
+    assert_eq!(7, v1);
+    assert_eq!(7, v2);
+
+    let v3;
+    v3 = { 1 + { 2 } * { 3 } };
+    let v4;
+    v4 = 1 + { 2 } * { 3 };
+    assert_eq!(7, v3);
+    assert_eq!(7, v4);
+
+    let v5 = { 1 + { 2 } * 3 };
+    assert_eq!(7, v5);
+
+    let v9 = { 1 + if 1 > 2 { 1 } else { 2 } * { 3 } };
+    assert_eq!(7, v9);
+}
diff --git a/tests/ui/parser/shebang/issue-71471-ignore-tidy.stderr b/tests/ui/parser/shebang/issue-71471-ignore-tidy.stderr
index 41cd4fb93fa..cdd36ba4cae 100644
--- a/tests/ui/parser/shebang/issue-71471-ignore-tidy.stderr
+++ b/tests/ui/parser/shebang/issue-71471-ignore-tidy.stderr
@@ -3,6 +3,9 @@ error: expected `[`, found `B`
    |
 LL | #!B
    |   ^ expected `[`
+   |
+   = note: the token sequence `#!` here looks like the start of a shebang interpreter directive but it is not
+   = help: if you meant this to be a shebang interpreter directive, move it to the very start of the file
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/parser/shebang/shebang-must-start-file.stderr b/tests/ui/parser/shebang/shebang-must-start-file.stderr
index 56991c96b7a..cf897d07780 100644
--- a/tests/ui/parser/shebang/shebang-must-start-file.stderr
+++ b/tests/ui/parser/shebang/shebang-must-start-file.stderr
@@ -3,6 +3,9 @@ error: expected `[`, found `/`
    |
 LL | #!/bin/bash
    |   ^ expected `[`
+   |
+   = note: the token sequence `#!` here looks like the start of a shebang interpreter directive but it is not
+   = help: if you meant this to be a shebang interpreter directive, move it to the very start of the file
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/parser/shebang/shebang-split.rs b/tests/ui/parser/shebang/shebang-split.rs
new file mode 100644
index 00000000000..470bb669143
--- /dev/null
+++ b/tests/ui/parser/shebang/shebang-split.rs
@@ -0,0 +1,5 @@
+// empty line
+# !/bin/env
+
+// checks that diagnostics for shebang lookalikes is not present
+//@ error-pattern: expected `[`\n\n
diff --git a/tests/ui/parser/shebang/shebang-split.stderr b/tests/ui/parser/shebang/shebang-split.stderr
new file mode 100644
index 00000000000..804df1f0086
--- /dev/null
+++ b/tests/ui/parser/shebang/shebang-split.stderr
@@ -0,0 +1,8 @@
+error: expected `[`, found `/`
+  --> $DIR/shebang-split.rs:2:4
+   |
+LL | # !/bin/env
+   |    ^ expected `[`
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/parser/struct-literal-in-for.rs b/tests/ui/parser/struct-literal-in-for.rs
deleted file mode 100644
index 3227ae37bfd..00000000000
--- a/tests/ui/parser/struct-literal-in-for.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-struct Foo {
-    x: isize,
-}
-
-impl Foo {
-    fn hi(&self) -> bool {
-        true
-    }
-}
-
-fn main() {
-    for x in Foo { //~ ERROR struct literals are not allowed here
-        x: 3       //~^ ERROR `bool` is not an iterator
-    }.hi() {
-        println!("yo");
-    }
-}
diff --git a/tests/ui/parser/struct-literal-in-for.stderr b/tests/ui/parser/struct-literal-in-for.stderr
deleted file mode 100644
index 1c91eba68e3..00000000000
--- a/tests/ui/parser/struct-literal-in-for.stderr
+++ /dev/null
@@ -1,31 +0,0 @@
-error: struct literals are not allowed here
-  --> $DIR/struct-literal-in-for.rs:12:14
-   |
-LL |       for x in Foo {
-   |  ______________^
-LL | |         x: 3
-LL | |     }.hi() {
-   | |_____^
-   |
-help: surround the struct literal with parentheses
-   |
-LL ~     for x in (Foo {
-LL |         x: 3
-LL ~     }).hi() {
-   |
-
-error[E0277]: `bool` is not an iterator
-  --> $DIR/struct-literal-in-for.rs:12:14
-   |
-LL |       for x in Foo {
-   |  ______________^
-LL | |         x: 3
-LL | |     }.hi() {
-   | |__________^ `bool` is not an iterator
-   |
-   = help: the trait `Iterator` is not implemented for `bool`
-   = note: required for `bool` to implement `IntoIterator`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/parser/struct-literal-in-if.rs b/tests/ui/parser/struct-literal-in-if.rs
deleted file mode 100644
index c4a253c3da2..00000000000
--- a/tests/ui/parser/struct-literal-in-if.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-struct Foo {
-    x: isize,
-}
-
-impl Foo {
-    fn hi(&self) -> bool {
-        true
-    }
-}
-
-fn main() {
-    if Foo { //~ ERROR struct literals are not allowed here
-        x: 3
-    }.hi() {
-        println!("yo");
-    }
-    if let true = Foo { //~ ERROR struct literals are not allowed here
-        x: 3
-    }.hi() {
-        println!("yo");
-    }
-}
diff --git a/tests/ui/parser/struct-literal-in-if.stderr b/tests/ui/parser/struct-literal-in-if.stderr
deleted file mode 100644
index 8b72469fcf5..00000000000
--- a/tests/ui/parser/struct-literal-in-if.stderr
+++ /dev/null
@@ -1,34 +0,0 @@
-error: struct literals are not allowed here
-  --> $DIR/struct-literal-in-if.rs:12:8
-   |
-LL |       if Foo {
-   |  ________^
-LL | |         x: 3
-LL | |     }.hi() {
-   | |_____^
-   |
-help: surround the struct literal with parentheses
-   |
-LL ~     if (Foo {
-LL |         x: 3
-LL ~     }).hi() {
-   |
-
-error: struct literals are not allowed here
-  --> $DIR/struct-literal-in-if.rs:17:19
-   |
-LL |       if let true = Foo {
-   |  ___________________^
-LL | |         x: 3
-LL | |     }.hi() {
-   | |_____^
-   |
-help: surround the struct literal with parentheses
-   |
-LL ~     if let true = (Foo {
-LL |         x: 3
-LL ~     }).hi() {
-   |
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/parser/struct-literal-in-match-discriminant.rs b/tests/ui/parser/struct-literal-in-match-discriminant.rs
deleted file mode 100644
index ce132df5a88..00000000000
--- a/tests/ui/parser/struct-literal-in-match-discriminant.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-struct Foo {
-    x: isize,
-}
-
-fn main() {
-    match Foo { //~ ERROR struct literals are not allowed here
-        x: 3
-    } {
-        Foo {
-            x: x
-        } => {}
-    }
-}
diff --git a/tests/ui/parser/struct-literal-in-match-discriminant.stderr b/tests/ui/parser/struct-literal-in-match-discriminant.stderr
deleted file mode 100644
index 5177f5f126e..00000000000
--- a/tests/ui/parser/struct-literal-in-match-discriminant.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error: struct literals are not allowed here
-  --> $DIR/struct-literal-in-match-discriminant.rs:6:11
-   |
-LL |       match Foo {
-   |  ___________^
-LL | |         x: 3
-LL | |     } {
-   | |_____^
-   |
-help: surround the struct literal with parentheses
-   |
-LL ~     match (Foo {
-LL |         x: 3
-LL ~     }) {
-   |
-
-error: aborting due to 1 previous error
-
diff --git a/tests/ui/parser/struct-literal-in-while.rs b/tests/ui/parser/struct-literal-in-while.rs
deleted file mode 100644
index 86931f7888d..00000000000
--- a/tests/ui/parser/struct-literal-in-while.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-struct Foo {
-    x: isize,
-}
-
-impl Foo {
-    fn hi(&self) -> bool {
-        true
-    }
-}
-
-fn main() {
-    while Foo { //~ ERROR struct literals are not allowed here
-        x: 3
-    }.hi() {
-        println!("yo");
-    }
-    while let true = Foo { //~ ERROR struct literals are not allowed here
-        x: 3
-    }.hi() {
-        println!("yo");
-    }
-}
diff --git a/tests/ui/parser/struct-literal-in-while.stderr b/tests/ui/parser/struct-literal-in-while.stderr
deleted file mode 100644
index 13d003608a1..00000000000
--- a/tests/ui/parser/struct-literal-in-while.stderr
+++ /dev/null
@@ -1,34 +0,0 @@
-error: struct literals are not allowed here
-  --> $DIR/struct-literal-in-while.rs:12:11
-   |
-LL |       while Foo {
-   |  ___________^
-LL | |         x: 3
-LL | |     }.hi() {
-   | |_____^
-   |
-help: surround the struct literal with parentheses
-   |
-LL ~     while (Foo {
-LL |         x: 3
-LL ~     }).hi() {
-   |
-
-error: struct literals are not allowed here
-  --> $DIR/struct-literal-in-while.rs:17:22
-   |
-LL |       while let true = Foo {
-   |  ______________________^
-LL | |         x: 3
-LL | |     }.hi() {
-   | |_____^
-   |
-help: surround the struct literal with parentheses
-   |
-LL ~     while let true = (Foo {
-LL |         x: 3
-LL ~     }).hi() {
-   |
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/parser/struct-literal-restrictions-in-lamda.rs b/tests/ui/parser/struct-literal-restrictions-in-lamda.rs
deleted file mode 100644
index e185153dcf6..00000000000
--- a/tests/ui/parser/struct-literal-restrictions-in-lamda.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-struct Foo {
-    x: isize,
-}
-
-impl Foo {
-    fn hi(&self) -> bool {
-        true
-    }
-}
-
-fn main() {
-    while || Foo { //~ ERROR struct literals are not allowed here
-        x: 3       //~^ ERROR mismatched types
-    }.hi() {
-        println!("yo");
-    }
-}
diff --git a/tests/ui/parser/struct-literal-restrictions-in-lamda.stderr b/tests/ui/parser/struct-literal-restrictions-in-lamda.stderr
deleted file mode 100644
index c715486e2da..00000000000
--- a/tests/ui/parser/struct-literal-restrictions-in-lamda.stderr
+++ /dev/null
@@ -1,37 +0,0 @@
-error: struct literals are not allowed here
-  --> $DIR/struct-literal-restrictions-in-lamda.rs:12:14
-   |
-LL |       while || Foo {
-   |  ______________^
-LL | |         x: 3
-LL | |     }.hi() {
-   | |_____^
-   |
-help: surround the struct literal with parentheses
-   |
-LL ~     while || (Foo {
-LL |         x: 3
-LL ~     }).hi() {
-   |
-
-error[E0308]: mismatched types
-  --> $DIR/struct-literal-restrictions-in-lamda.rs:12:11
-   |
-LL |       while || Foo {
-   |  ___________^
-LL | |         x: 3
-LL | |     }.hi() {
-   | |__________^ expected `bool`, found closure
-   |
-   = note: expected type `bool`
-           found closure `{closure@$DIR/struct-literal-restrictions-in-lamda.rs:12:11: 12:13}`
-help: use parentheses to call this closure
-   |
-LL ~     while (|| Foo {
-LL |         x: 3
-LL ~     }.hi())() {
-   |
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/parser/struct-literal-variant-in-if.rs b/tests/ui/parser/struct-literal-variant-in-if.rs
deleted file mode 100644
index 4ef8effaf1f..00000000000
--- a/tests/ui/parser/struct-literal-variant-in-if.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
-enum E {
-    V { field: bool },
-    I { field1: bool, field2: usize },
-    J { field: isize },
-    K { field: &'static str},
-}
-fn test_E(x: E) {
-    let field = true;
-    if x == E::V { field } {}
-    //~^ ERROR expected value, found struct variant `E::V`
-    //~| ERROR mismatched types
-    if x == E::I { field1: true, field2: 42 } {}
-    //~^ ERROR struct literals are not allowed here
-    if x == E::V { field: false } {}
-    //~^ ERROR struct literals are not allowed here
-    if x == E::J { field: -42 } {}
-    //~^ ERROR struct literals are not allowed here
-    if x == E::K { field: "" } {}
-    //~^ ERROR struct literals are not allowed here
-    let y: usize = ();
-    //~^ ERROR mismatched types
-}
-
-fn main() {}
diff --git a/tests/ui/parser/struct-literal-variant-in-if.stderr b/tests/ui/parser/struct-literal-variant-in-if.stderr
deleted file mode 100644
index 15f059f145b..00000000000
--- a/tests/ui/parser/struct-literal-variant-in-if.stderr
+++ /dev/null
@@ -1,76 +0,0 @@
-error: struct literals are not allowed here
-  --> $DIR/struct-literal-variant-in-if.rs:13:13
-   |
-LL |     if x == E::I { field1: true, field2: 42 } {}
-   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: surround the struct literal with parentheses
-   |
-LL |     if x == (E::I { field1: true, field2: 42 }) {}
-   |             +                                 +
-
-error: struct literals are not allowed here
-  --> $DIR/struct-literal-variant-in-if.rs:15:13
-   |
-LL |     if x == E::V { field: false } {}
-   |             ^^^^^^^^^^^^^^^^^^^^^
-   |
-help: surround the struct literal with parentheses
-   |
-LL |     if x == (E::V { field: false }) {}
-   |             +                     +
-
-error: struct literals are not allowed here
-  --> $DIR/struct-literal-variant-in-if.rs:17:13
-   |
-LL |     if x == E::J { field: -42 } {}
-   |             ^^^^^^^^^^^^^^^^^^^
-   |
-help: surround the struct literal with parentheses
-   |
-LL |     if x == (E::J { field: -42 }) {}
-   |             +                   +
-
-error: struct literals are not allowed here
-  --> $DIR/struct-literal-variant-in-if.rs:19:13
-   |
-LL |     if x == E::K { field: "" } {}
-   |             ^^^^^^^^^^^^^^^^^^
-   |
-help: surround the struct literal with parentheses
-   |
-LL |     if x == (E::K { field: "" }) {}
-   |             +                  +
-
-error[E0533]: expected value, found struct variant `E::V`
-  --> $DIR/struct-literal-variant-in-if.rs:10:13
-   |
-LL |     if x == E::V { field } {}
-   |             ^^^^ not a value
-   |
-help: you might have meant to create a new value of the struct
-   |
-LL |     if x == (E::V { field }) {}
-   |             +              +
-
-error[E0308]: mismatched types
-  --> $DIR/struct-literal-variant-in-if.rs:10:20
-   |
-LL |     if x == E::V { field } {}
-   |     ---------------^^^^^--
-   |     |              |
-   |     |              expected `()`, found `bool`
-   |     expected this to be `()`
-
-error[E0308]: mismatched types
-  --> $DIR/struct-literal-variant-in-if.rs:21:20
-   |
-LL |     let y: usize = ();
-   |            -----   ^^ expected `usize`, found `()`
-   |            |
-   |            expected due to this
-
-error: aborting due to 7 previous errors
-
-Some errors have detailed explanations: E0308, E0533.
-For more information about an error, try `rustc --explain E0308`.
diff --git a/tests/ui/parser/struct-literals-in-invalid-places.rs b/tests/ui/parser/struct-literals-in-invalid-places.rs
new file mode 100644
index 00000000000..eed51b94583
--- /dev/null
+++ b/tests/ui/parser/struct-literals-in-invalid-places.rs
@@ -0,0 +1,92 @@
+fn main() {
+    if Foo { x: 3 }.hi() { //~ ERROR struct literals are not allowed here
+        println!("yo");
+    }
+    if let true = Foo { x: 3 }.hi() { //~ ERROR struct literals are not allowed here
+        println!("yo");
+    }
+
+    for x in Foo { x: 3 }.hi() { //~ ERROR struct literals are not allowed here
+        //~^ ERROR `bool` is not an iterator
+        println!("yo");
+    }
+
+    while Foo { x: 3 }.hi() { //~ ERROR struct literals are not allowed here
+        println!("yo");
+    }
+    while let true = Foo { x: 3 }.hi() { //~ ERROR struct literals are not allowed here
+        println!("yo");
+    }
+
+    match Foo { x: 3 } { //~ ERROR struct literals are not allowed here
+        Foo { x: x } => {}
+    }
+
+    let _ = |x: E| {
+        let field = true;
+        if x == E::V { field } {}
+        //~^ ERROR expected value, found struct variant `E::V`
+        //~| ERROR mismatched types
+        if x == E::I { field1: true, field2: 42 } {}
+        //~^ ERROR struct literals are not allowed here
+        if x == E::V { field: false } {}
+        //~^ ERROR struct literals are not allowed here
+        if x == E::J { field: -42 } {}
+        //~^ ERROR struct literals are not allowed here
+        if x == E::K { field: "" } {}
+        //~^ ERROR struct literals are not allowed here
+        let y: usize = ();
+        //~^ ERROR mismatched types
+    };
+
+    // Regression test for <https://github.com/rust-lang/rust/issues/43412>.
+    while || Foo { x: 3 }.hi() { //~ ERROR struct literals are not allowed here
+        //~^ ERROR mismatched types
+        println!("yo");
+    }
+
+    // This uses `one()` over `1` as token `one` may begin a type and thus back when type ascription
+    // `$expr : $ty` still existed, `{ x: one` could've been the start of a block expr which used to
+    // make the compiler take a different execution path. Now it no longer makes a difference tho.
+
+    // Regression test for <https://github.com/rust-lang/rust/issues/82051>.
+    if Foo { x: one(), }.hi() { //~ ERROR struct literals are not allowed here
+        println!("Positive!");
+    }
+
+    const FOO: Foo = Foo { x: 1 };
+    // Below, test that we correctly parenthesize the struct literals.
+
+    // Regression test for <https://github.com/rust-lang/rust/issues/112278>.
+    if FOO == self::Foo { x: one() } {} //~ ERROR struct literals are not allowed here
+
+    if FOO == Foo::<> { x: one() } {} //~ ERROR struct literals are not allowed here
+
+    fn env<T: Trait<Out = Foo>>() {
+        if FOO == <T as Trait>::Out { x: one() } {} //~ ERROR struct literals are not allowed here
+        //~^ ERROR usage of qualified paths in this context is experimental
+    }
+}
+
+#[derive(PartialEq, Eq)]
+struct Foo {
+    x: isize,
+}
+
+impl Foo {
+    fn hi(&self) -> bool {
+        true
+    }
+}
+
+#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
+enum E {
+    V { field: bool },
+    I { field1: bool, field2: usize },
+    J { field: isize },
+    K { field: &'static str},
+}
+
+fn one() -> isize { 1 }
+
+trait Trait { type Out; }
diff --git a/tests/ui/parser/struct-literals-in-invalid-places.stderr b/tests/ui/parser/struct-literals-in-invalid-places.stderr
new file mode 100644
index 00000000000..39dc2d2efb7
--- /dev/null
+++ b/tests/ui/parser/struct-literals-in-invalid-places.stderr
@@ -0,0 +1,234 @@
+error: struct literals are not allowed here
+  --> $DIR/struct-literals-in-invalid-places.rs:2:8
+   |
+LL |     if Foo { x: 3 }.hi() {
+   |        ^^^^^^^^^^^^
+   |
+help: surround the struct literal with parentheses
+   |
+LL |     if (Foo { x: 3 }).hi() {
+   |        +            +
+
+error: struct literals are not allowed here
+  --> $DIR/struct-literals-in-invalid-places.rs:5:19
+   |
+LL |     if let true = Foo { x: 3 }.hi() {
+   |                   ^^^^^^^^^^^^
+   |
+help: surround the struct literal with parentheses
+   |
+LL |     if let true = (Foo { x: 3 }).hi() {
+   |                   +            +
+
+error: struct literals are not allowed here
+  --> $DIR/struct-literals-in-invalid-places.rs:9:14
+   |
+LL |     for x in Foo { x: 3 }.hi() {
+   |              ^^^^^^^^^^^^
+   |
+help: surround the struct literal with parentheses
+   |
+LL |     for x in (Foo { x: 3 }).hi() {
+   |              +            +
+
+error: struct literals are not allowed here
+  --> $DIR/struct-literals-in-invalid-places.rs:14:11
+   |
+LL |     while Foo { x: 3 }.hi() {
+   |           ^^^^^^^^^^^^
+   |
+help: surround the struct literal with parentheses
+   |
+LL |     while (Foo { x: 3 }).hi() {
+   |           +            +
+
+error: struct literals are not allowed here
+  --> $DIR/struct-literals-in-invalid-places.rs:17:22
+   |
+LL |     while let true = Foo { x: 3 }.hi() {
+   |                      ^^^^^^^^^^^^
+   |
+help: surround the struct literal with parentheses
+   |
+LL |     while let true = (Foo { x: 3 }).hi() {
+   |                      +            +
+
+error: struct literals are not allowed here
+  --> $DIR/struct-literals-in-invalid-places.rs:21:11
+   |
+LL |     match Foo { x: 3 } {
+   |           ^^^^^^^^^^^^
+   |
+help: surround the struct literal with parentheses
+   |
+LL |     match (Foo { x: 3 }) {
+   |           +            +
+
+error: struct literals are not allowed here
+  --> $DIR/struct-literals-in-invalid-places.rs:30:17
+   |
+LL |         if x == E::I { field1: true, field2: 42 } {}
+   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: surround the struct literal with parentheses
+   |
+LL |         if x == (E::I { field1: true, field2: 42 }) {}
+   |                 +                                 +
+
+error: struct literals are not allowed here
+  --> $DIR/struct-literals-in-invalid-places.rs:32:17
+   |
+LL |         if x == E::V { field: false } {}
+   |                 ^^^^^^^^^^^^^^^^^^^^^
+   |
+help: surround the struct literal with parentheses
+   |
+LL |         if x == (E::V { field: false }) {}
+   |                 +                     +
+
+error: struct literals are not allowed here
+  --> $DIR/struct-literals-in-invalid-places.rs:34:17
+   |
+LL |         if x == E::J { field: -42 } {}
+   |                 ^^^^^^^^^^^^^^^^^^^
+   |
+help: surround the struct literal with parentheses
+   |
+LL |         if x == (E::J { field: -42 }) {}
+   |                 +                   +
+
+error: struct literals are not allowed here
+  --> $DIR/struct-literals-in-invalid-places.rs:36:17
+   |
+LL |         if x == E::K { field: "" } {}
+   |                 ^^^^^^^^^^^^^^^^^^
+   |
+help: surround the struct literal with parentheses
+   |
+LL |         if x == (E::K { field: "" }) {}
+   |                 +                  +
+
+error: struct literals are not allowed here
+  --> $DIR/struct-literals-in-invalid-places.rs:43:14
+   |
+LL |     while || Foo { x: 3 }.hi() {
+   |              ^^^^^^^^^^^^
+   |
+help: surround the struct literal with parentheses
+   |
+LL |     while || (Foo { x: 3 }).hi() {
+   |              +            +
+
+error: struct literals are not allowed here
+  --> $DIR/struct-literals-in-invalid-places.rs:53:8
+   |
+LL |     if Foo { x: one(), }.hi() {
+   |        ^^^^^^^^^^^^^^^^^
+   |
+help: surround the struct literal with parentheses
+   |
+LL |     if (Foo { x: one(), }).hi() {
+   |        +                 +
+
+error: struct literals are not allowed here
+  --> $DIR/struct-literals-in-invalid-places.rs:61:15
+   |
+LL |     if FOO == self::Foo { x: one() } {}
+   |               ^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: surround the struct literal with parentheses
+   |
+LL |     if FOO == (self::Foo { x: one() }) {}
+   |               +                      +
+
+error: struct literals are not allowed here
+  --> $DIR/struct-literals-in-invalid-places.rs:63:15
+   |
+LL |     if FOO == Foo::<> { x: one() } {}
+   |               ^^^^^^^^^^^^^^^^^^^^
+   |
+help: surround the struct literal with parentheses
+   |
+LL |     if FOO == (Foo::<> { x: one() }) {}
+   |               +                    +
+
+error: struct literals are not allowed here
+  --> $DIR/struct-literals-in-invalid-places.rs:66:19
+   |
+LL |         if FOO == <T as Trait>::Out { x: one() } {}
+   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: surround the struct literal with parentheses
+   |
+LL |         if FOO == (<T as Trait>::Out { x: one() }) {}
+   |                   +                              +
+
+error[E0658]: usage of qualified paths in this context is experimental
+  --> $DIR/struct-literals-in-invalid-places.rs:66:19
+   |
+LL |         if FOO == <T as Trait>::Out { x: one() } {}
+   |                   ^^^^^^^^^^^^^^^^^
+   |
+   = 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[E0277]: `bool` is not an iterator
+  --> $DIR/struct-literals-in-invalid-places.rs:9:14
+   |
+LL |     for x in Foo { x: 3 }.hi() {
+   |              ^^^^^^^^^^^^^^^^^ `bool` is not an iterator
+   |
+   = help: the trait `Iterator` is not implemented for `bool`
+   = note: required for `bool` to implement `IntoIterator`
+
+error[E0533]: expected value, found struct variant `E::V`
+  --> $DIR/struct-literals-in-invalid-places.rs:27:17
+   |
+LL |         if x == E::V { field } {}
+   |                 ^^^^ not a value
+   |
+help: you might have meant to create a new value of the struct
+   |
+LL |         if x == (E::V { field }) {}
+   |                 +              +
+
+error[E0308]: mismatched types
+  --> $DIR/struct-literals-in-invalid-places.rs:27:24
+   |
+LL |         if x == E::V { field } {}
+   |         ---------------^^^^^--
+   |         |              |
+   |         |              expected `()`, found `bool`
+   |         expected this to be `()`
+   |
+help: you might have meant to return this value
+   |
+LL |         if x == E::V { return field; } {}
+   |                        ++++++      +
+
+error[E0308]: mismatched types
+  --> $DIR/struct-literals-in-invalid-places.rs:38:24
+   |
+LL |         let y: usize = ();
+   |                -----   ^^ expected `usize`, found `()`
+   |                |
+   |                expected due to this
+
+error[E0308]: mismatched types
+  --> $DIR/struct-literals-in-invalid-places.rs:43:11
+   |
+LL |     while || Foo { x: 3 }.hi() {
+   |           ^^^^^^^^^^^^^^^^^^^^ expected `bool`, found closure
+   |
+   = note: expected type `bool`
+           found closure `{closure@$DIR/struct-literals-in-invalid-places.rs:43:11: 43:13}`
+help: use parentheses to call this closure
+   |
+LL |     while (|| Foo { x: 3 }.hi())() {
+   |           +                    +++
+
+error: aborting due to 21 previous errors
+
+Some errors have detailed explanations: E0277, E0308, E0533, E0658.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/parser/type-ascription-in-pattern.rs b/tests/ui/parser/type-ascription-in-pattern.rs
index fec168afba1..18d7061d69c 100644
--- a/tests/ui/parser/type-ascription-in-pattern.rs
+++ b/tests/ui/parser/type-ascription-in-pattern.rs
@@ -1,11 +1,10 @@
 fn foo(x: bool) -> i32 {
-    match x {
+    match x { //~ ERROR struct literals are not allowed here
         x: i32 => x, //~ ERROR expected
-        //~^ ERROR mismatched types
-        true => 42.,
-        false => 0.333,
+        true => 42., //~ ERROR expected identifier
+        false => 0.333, //~ ERROR expected identifier
     }
-}
+} //~ ERROR expected one of
 
 fn main() {
     match foo(true) {
diff --git a/tests/ui/parser/type-ascription-in-pattern.stderr b/tests/ui/parser/type-ascription-in-pattern.stderr
index 09190754993..135879f208b 100644
--- a/tests/ui/parser/type-ascription-in-pattern.stderr
+++ b/tests/ui/parser/type-ascription-in-pattern.stderr
@@ -1,18 +1,64 @@
-error: expected one of `@` or `|`, found `:`
-  --> $DIR/type-ascription-in-pattern.rs:3:10
+error: expected one of `!`, `,`, `.`, `::`, `?`, `{`, `}`, or an operator, found `=>`
+  --> $DIR/type-ascription-in-pattern.rs:3:16
    |
+LL |     match x {
+   |           - while parsing this struct
 LL |         x: i32 => x,
-   |          ^ --- specifying the type of a pattern isn't supported
-   |          |
-   |          expected one of `@` or `|`
+   |               -^^ expected one of 8 possible tokens
+   |               |
+   |               help: try adding a comma: `,`
+
+error: expected identifier, found keyword `true`
+  --> $DIR/type-ascription-in-pattern.rs:4:9
    |
-help: maybe write a path separator here
+LL |     match x {
+   |           - while parsing this struct
+LL |         x: i32 => x,
+LL |         true => 42.,
+   |         ^^^^ expected identifier, found keyword
+
+error: expected identifier, found keyword `false`
+  --> $DIR/type-ascription-in-pattern.rs:5:9
    |
-LL |         x::i32 => x,
-   |          ~~
+LL |     match x {
+   |           - while parsing this struct
+...
+LL |         false => 0.333,
+   |         ^^^^^ expected identifier, found keyword
+
+error: struct literals are not allowed here
+  --> $DIR/type-ascription-in-pattern.rs:2:11
+   |
+LL |       match x {
+   |  ___________^
+LL | |         x: i32 => x,
+LL | |         true => 42.,
+LL | |         false => 0.333,
+LL | |     }
+   | |_____^
+   |
+help: surround the struct literal with parentheses
+   |
+LL ~     match (x {
+LL |         x: i32 => x,
+LL |         true => 42.,
+LL |         false => 0.333,
+LL ~     })
+   |
+
+error: expected one of `.`, `?`, `{`, or an operator, found `}`
+  --> $DIR/type-ascription-in-pattern.rs:7:1
+   |
+LL |     match x {
+   |     ----- while parsing this `match` expression
+...
+LL |     }
+   |      - expected one of `.`, `?`, `{`, or an operator
+LL | }
+   | ^ unexpected token
 
 error: expected one of `...`, `..=`, `..`, or `|`, found `:`
-  --> $DIR/type-ascription-in-pattern.rs:12:11
+  --> $DIR/type-ascription-in-pattern.rs:11:11
    |
 LL |         42: i32 => (),
    |           ^ --- specifying the type of a pattern isn't supported
@@ -20,7 +66,7 @@ LL |         42: i32 => (),
    |           expected one of `...`, `..=`, `..`, or `|`
 
 error: expected `|`, found `:`
-  --> $DIR/type-ascription-in-pattern.rs:13:10
+  --> $DIR/type-ascription-in-pattern.rs:12:10
    |
 LL |         _: f64 => (),
    |          ^ --- specifying the type of a pattern isn't supported
@@ -28,7 +74,7 @@ LL |         _: f64 => (),
    |          expected `|`
 
 error: expected one of `@` or `|`, found `:`
-  --> $DIR/type-ascription-in-pattern.rs:14:10
+  --> $DIR/type-ascription-in-pattern.rs:13:10
    |
 LL |         x: i32 => (),
    |          ^ --- specifying the type of a pattern isn't supported
@@ -40,15 +86,5 @@ help: maybe write a path separator here
 LL |         x::i32 => (),
    |          ~~
 
-error[E0308]: mismatched types
-  --> $DIR/type-ascription-in-pattern.rs:3:19
-   |
-LL | fn foo(x: bool) -> i32 {
-   |                    --- expected `i32` because of return type
-LL |     match x {
-LL |         x: i32 => x,
-   |                   ^ expected `i32`, found `bool`
-
-error: aborting due to 5 previous errors
+error: aborting due to 8 previous errors
 
-For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/parser/unbalanced-doublequote.rs b/tests/ui/parser/unbalanced-doublequote.rs
index d9c936186ea..43e23a70271 100644
--- a/tests/ui/parser/unbalanced-doublequote.rs
+++ b/tests/ui/parser/unbalanced-doublequote.rs
@@ -1,6 +1,4 @@
-//@ error-pattern: unterminated double quote string
-
-
+//~vv ERROR unterminated double quote string
 fn main() {
     "
 }
diff --git a/tests/ui/parser/unbalanced-doublequote.stderr b/tests/ui/parser/unbalanced-doublequote.stderr
index d40b982da7c..60057eddbb4 100644
--- a/tests/ui/parser/unbalanced-doublequote.stderr
+++ b/tests/ui/parser/unbalanced-doublequote.stderr
@@ -1,5 +1,5 @@
 error[E0765]: unterminated double quote string
-  --> $DIR/unbalanced-doublequote.rs:5:5
+  --> $DIR/unbalanced-doublequote.rs:3:5
    |
 LL | /     "
 LL | | }
diff --git a/tests/ui/parser/unclosed-delimiter-in-dep.rs b/tests/ui/parser/unclosed-delimiter-in-dep.rs
index 4de83ee640a..40f517f317e 100644
--- a/tests/ui/parser/unclosed-delimiter-in-dep.rs
+++ b/tests/ui/parser/unclosed-delimiter-in-dep.rs
@@ -3,3 +3,5 @@ mod unclosed_delim_mod;
 fn main() {
     let _: usize = unclosed_delim_mod::new();
 }
+
+//~? ERROR mismatched closing delimiter: `}`
diff --git a/tests/ui/parser/use-unclosed-brace.rs b/tests/ui/parser/use-unclosed-brace.rs
index 6679651fe47..aa52fe92ac1 100644
--- a/tests/ui/parser/use-unclosed-brace.rs
+++ b/tests/ui/parser/use-unclosed-brace.rs
@@ -1,4 +1,3 @@
-//@ error-pattern: this file contains an unclosed delimiter
 use foo::{bar, baz;
 
 use std::fmt::Display;
@@ -7,4 +6,5 @@ mod bar { }
 
 mod baz { }
 
+//~v ERROR this file contains an unclosed delimiter
 fn main() {}
diff --git a/tests/ui/patchable-function-entry/patchable-function-entry-flags.rs b/tests/ui/patchable-function-entry/patchable-function-entry-flags.rs
index cb5bc62b6b3..2d5a0b0a771 100644
--- a/tests/ui/patchable-function-entry/patchable-function-entry-flags.rs
+++ b/tests/ui/patchable-function-entry/patchable-function-entry-flags.rs
@@ -1,2 +1,5 @@
 //@ compile-flags: -Z patchable-function-entry=1,2
+
 fn main() {}
+
+//~? ERROR incorrect value `1,2` for unstable option `patchable-function-entry`
diff --git a/tests/ui/pattern/check-struct-pat-fields-stability-issue-138319.rs b/tests/ui/pattern/check-struct-pat-fields-stability-issue-138319.rs
new file mode 100644
index 00000000000..b951c6d92ee
--- /dev/null
+++ b/tests/ui/pattern/check-struct-pat-fields-stability-issue-138319.rs
@@ -0,0 +1,12 @@
+//@ check-pass
+struct Point {
+    #[deprecated = "x is deprecated"]
+    _x: i32,
+    _y: i32,
+}
+
+fn main() {
+    let p = Point { _x: 1, _y: 2 }; //~ WARNING use of deprecated field `Point::_x`
+    // Before fix, it report an warning
+    let Point { #[expect(deprecated)]_x, .. } = p;
+}
diff --git a/tests/ui/pattern/check-struct-pat-fields-stability-issue-138319.stderr b/tests/ui/pattern/check-struct-pat-fields-stability-issue-138319.stderr
new file mode 100644
index 00000000000..707eb58e547
--- /dev/null
+++ b/tests/ui/pattern/check-struct-pat-fields-stability-issue-138319.stderr
@@ -0,0 +1,10 @@
+warning: use of deprecated field `Point::_x`: x is deprecated
+  --> $DIR/check-struct-pat-fields-stability-issue-138319.rs:9:21
+   |
+LL |     let p = Point { _x: 1, _y: 2 };
+   |                     ^^^^^
+   |
+   = note: `#[warn(deprecated)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/pattern/deref-patterns/dont-ice-on-slice-in-deref-pat-in-closure.rs b/tests/ui/pattern/deref-patterns/dont-ice-on-slice-in-deref-pat-in-closure.rs
new file mode 100644
index 00000000000..e1a37b9c65f
--- /dev/null
+++ b/tests/ui/pattern/deref-patterns/dont-ice-on-slice-in-deref-pat-in-closure.rs
@@ -0,0 +1,15 @@
+//@ check-pass
+//! Regression test for ICE in `rustc_hir_typeck::expr_use_visitor` on nesting a slice pattern
+//! inside a deref pattern inside a closure: rust-lang/rust#125059
+
+#![feature(deref_patterns)]
+#![allow(incomplete_features, unused)]
+
+fn simple_vec(vec: Vec<u32>) -> u32 {
+   (|| match Vec::<u32>::new() {
+        deref!([]) => 100,
+        _ => 2000,
+    })()
+}
+
+fn main() {}
diff --git a/tests/ui/pattern/usefulness/impl-trait.rs b/tests/ui/pattern/usefulness/impl-trait.rs
index 16560a09267..47cee17b579 100644
--- a/tests/ui/pattern/usefulness/impl-trait.rs
+++ b/tests/ui/pattern/usefulness/impl-trait.rs
@@ -25,6 +25,7 @@ fn friend_of_return_never_rpit(x: Void) {
 }
 
 type T = impl Copy;
+#[define_opaque(T)]
 fn return_never_tait(x: Void) -> T {
     if false {
         match return_never_tait(x) {
@@ -88,6 +89,7 @@ fn inner_tuple() {
 }
 
 type U = impl Copy;
+#[define_opaque(U)]
 fn unify_never(x: Void, u: U) -> U {
     if false {
         match u {
@@ -98,6 +100,7 @@ fn unify_never(x: Void, u: U) -> U {
 }
 
 type V = impl Copy;
+#[define_opaque(V)]
 fn infer_in_match(x: Option<V>) {
     match x {
         None => {}
@@ -116,6 +119,7 @@ struct Rec<'a> {
     n: u32,
     w: Option<&'a W>,
 }
+#[define_opaque(W)]
 fn recursive_opaque() -> W {
     if false {
         match recursive_opaque() {
@@ -130,6 +134,7 @@ fn recursive_opaque() -> W {
 
 type X = impl Copy;
 struct SecretelyVoid(X);
+#[define_opaque(X)]
 fn nested_empty_opaque(x: Void) -> X {
     if false {
         let opaque_void = nested_empty_opaque(x);
@@ -143,6 +148,7 @@ fn nested_empty_opaque(x: Void) -> X {
 
 type Y = (impl Copy, impl Copy);
 struct SecretelyDoubleVoid(Y);
+#[define_opaque(Y)]
 fn super_nested_empty_opaque(x: Void) -> Y {
     if false {
         let opaque_void = super_nested_empty_opaque(x);
diff --git a/tests/ui/pattern/usefulness/impl-trait.stderr b/tests/ui/pattern/usefulness/impl-trait.stderr
index c3e1c267b61..62045151968 100644
--- a/tests/ui/pattern/usefulness/impl-trait.stderr
+++ b/tests/ui/pattern/usefulness/impl-trait.stderr
@@ -15,7 +15,7 @@ LL | #![deny(unreachable_patterns)]
    |         ^^^^^^^^^^^^^^^^^^^^
 
 error: unreachable pattern
-  --> $DIR/impl-trait.rs:31:13
+  --> $DIR/impl-trait.rs:32:13
    |
 LL |             _ => {}
    |             ^------
@@ -25,22 +25,8 @@ LL |             _ => {}
    |
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
-error[E0004]: non-exhaustive patterns: type `impl Copy` is non-empty
-  --> $DIR/impl-trait.rs:23:11
-   |
-LL |     match return_never_rpit(x) {}
-   |           ^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: the matched value is of type `impl Copy`
-help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
-   |
-LL ~     match return_never_rpit(x) {
-LL +         _ => todo!(),
-LL ~     }
-   |
-
 error: unreachable pattern
-  --> $DIR/impl-trait.rs:45:13
+  --> $DIR/impl-trait.rs:46:13
    |
 LL |             Some(_) => {}
    |             ^^^^^^^------
@@ -51,7 +37,7 @@ LL |             Some(_) => {}
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
-  --> $DIR/impl-trait.rs:49:13
+  --> $DIR/impl-trait.rs:50:13
    |
 LL |             None => {}
    |             ---- matches all the relevant values
@@ -59,7 +45,7 @@ LL |             _ => {}
    |             ^ no value can reach this
 
 error: unreachable pattern
-  --> $DIR/impl-trait.rs:59:13
+  --> $DIR/impl-trait.rs:60:13
    |
 LL |             Some(_) => {}
    |             ^^^^^^^------
@@ -70,7 +56,7 @@ LL |             Some(_) => {}
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
-  --> $DIR/impl-trait.rs:63:13
+  --> $DIR/impl-trait.rs:64:13
    |
 LL |             None => {}
    |             ---- matches all the relevant values
@@ -78,7 +64,7 @@ LL |             _ => {}
    |             ^ no value can reach this
 
 error: unreachable pattern
-  --> $DIR/impl-trait.rs:76:9
+  --> $DIR/impl-trait.rs:77:9
    |
 LL |         _ => {}
    |         ^------
@@ -89,7 +75,7 @@ LL |         _ => {}
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
-  --> $DIR/impl-trait.rs:86:9
+  --> $DIR/impl-trait.rs:87:9
    |
 LL |         _ => {}
    |         - matches any value
@@ -97,7 +83,7 @@ LL |         Some((a, b)) => {}
    |         ^^^^^^^^^^^^ no value can reach this
 
 error: unreachable pattern
-  --> $DIR/impl-trait.rs:94:13
+  --> $DIR/impl-trait.rs:96:13
    |
 LL |             _ => {}
    |             ^------
@@ -107,22 +93,8 @@ LL |             _ => {}
    |
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
-error[E0004]: non-exhaustive patterns: type `T` is non-empty
-  --> $DIR/impl-trait.rs:37:11
-   |
-LL |     match return_never_tait(x) {}
-   |           ^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: the matched value is of type `T`
-help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
-   |
-LL ~     match return_never_tait(x) {
-LL +         _ => todo!(),
-LL ~     }
-   |
-
 error: unreachable pattern
-  --> $DIR/impl-trait.rs:105:9
+  --> $DIR/impl-trait.rs:108:9
    |
 LL |         Some((a, b)) => {}
    |         ------------ matches all the relevant values
@@ -130,7 +102,7 @@ LL |         Some((mut x, mut y)) => {
    |         ^^^^^^^^^^^^^^^^^^^^ no value can reach this
 
 error: unreachable pattern
-  --> $DIR/impl-trait.rs:124:13
+  --> $DIR/impl-trait.rs:128:13
    |
 LL |             _ => {}
    |             - matches any value
@@ -138,7 +110,7 @@ LL |             Rec { n: 0, w: Some(Rec { n: 0, w: _ }) } => {}
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this
 
 error: unreachable pattern
-  --> $DIR/impl-trait.rs:138:13
+  --> $DIR/impl-trait.rs:143:13
    |
 LL |             _ => {}
    |             ^------
@@ -149,7 +121,7 @@ LL |             _ => {}
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
-  --> $DIR/impl-trait.rs:151:13
+  --> $DIR/impl-trait.rs:157:13
    |
 LL |             _ => {}
    |             ^------
@@ -159,6 +131,34 @@ LL |             _ => {}
    |
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
+error[E0004]: non-exhaustive patterns: type `impl Copy` is non-empty
+  --> $DIR/impl-trait.rs:23:11
+   |
+LL |     match return_never_rpit(x) {}
+   |           ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: the matched value is of type `impl Copy`
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
+   |
+LL ~     match return_never_rpit(x) {
+LL +         _ => todo!(),
+LL ~     }
+   |
+
+error[E0004]: non-exhaustive patterns: type `T` is non-empty
+  --> $DIR/impl-trait.rs:38:11
+   |
+LL |     match return_never_tait(x) {}
+   |           ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: the matched value is of type `T`
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
+   |
+LL ~     match return_never_tait(x) {
+LL +         _ => todo!(),
+LL ~     }
+   |
+
 error: aborting due to 15 previous errors
 
 For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/pin-macro/pin_move.rs b/tests/ui/pin-macro/pin_move.rs
new file mode 100644
index 00000000000..0f6d34fad95
--- /dev/null
+++ b/tests/ui/pin-macro/pin_move.rs
@@ -0,0 +1,26 @@
+//@ edition:2024
+
+use core::marker::PhantomPinned;
+use core::pin::pin;
+
+fn a() {
+    struct NotCopy<T>(T);
+    #[allow(unused_mut)]
+    let mut pointee = NotCopy(PhantomPinned);
+    pin!(pointee);
+    let _moved = pointee;
+    //~^ ERROR use of moved value
+}
+
+fn b() {
+    struct NotCopy<T>(T);
+    let mut pointee = NotCopy(PhantomPinned);
+    pin!(*&mut pointee);
+    //~^ ERROR cannot move
+    let _moved = pointee;
+}
+
+fn main() {
+    a();
+    b();
+}
diff --git a/tests/ui/pin-macro/pin_move.stderr b/tests/ui/pin-macro/pin_move.stderr
new file mode 100644
index 00000000000..c9b8ad9b202
--- /dev/null
+++ b/tests/ui/pin-macro/pin_move.stderr
@@ -0,0 +1,38 @@
+error[E0382]: use of moved value: `pointee`
+  --> $DIR/pin_move.rs:11:18
+   |
+LL |     let mut pointee = NotCopy(PhantomPinned);
+   |         ----------- move occurs because `pointee` has type `a::NotCopy<PhantomPinned>`, which does not implement the `Copy` trait
+LL |     pin!(pointee);
+   |          ------- value moved here
+LL |     let _moved = pointee;
+   |                  ^^^^^^^ value used here after move
+   |
+note: if `a::NotCopy<PhantomPinned>` implemented `Clone`, you could clone the value
+  --> $DIR/pin_move.rs:7:5
+   |
+LL |     struct NotCopy<T>(T);
+   |     ^^^^^^^^^^^^^^^^^ consider implementing `Clone` for this type
+...
+LL |     pin!(pointee);
+   |          ------- you could clone this value
+
+error[E0507]: cannot move out of a mutable reference
+  --> $DIR/pin_move.rs:18:10
+   |
+LL |     pin!(*&mut pointee);
+   |          ^^^^^^^^^^^^^ move occurs because value has type `b::NotCopy<PhantomPinned>`, which does not implement the `Copy` trait
+   |
+note: if `b::NotCopy<PhantomPinned>` implemented `Clone`, you could clone the value
+  --> $DIR/pin_move.rs:16:5
+   |
+LL |     struct NotCopy<T>(T);
+   |     ^^^^^^^^^^^^^^^^^ consider implementing `Clone` for this type
+LL |     let mut pointee = NotCopy(PhantomPinned);
+LL |     pin!(*&mut pointee);
+   |          ------------- you could clone this value
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0382, E0507.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/tests/ui/precondition-checks/copy-nonoverlapping.rs b/tests/ui/precondition-checks/copy-nonoverlapping.rs
index 81018e4bff3..eacaa63e543 100644
--- a/tests/ui/precondition-checks/copy-nonoverlapping.rs
+++ b/tests/ui/precondition-checks/copy-nonoverlapping.rs
@@ -3,6 +3,8 @@
 //@ error-pattern: unsafe precondition(s) violated: ptr::copy_nonoverlapping requires
 //@ revisions: null_src null_dst misaligned_src misaligned_dst overlapping
 
+#![allow(invalid_null_arguments)]
+
 use std::ptr;
 
 fn main() {
diff --git a/tests/ui/precondition-checks/copy.rs b/tests/ui/precondition-checks/copy.rs
index 694853f950a..1fadd90bf70 100644
--- a/tests/ui/precondition-checks/copy.rs
+++ b/tests/ui/precondition-checks/copy.rs
@@ -3,6 +3,8 @@
 //@ error-pattern: unsafe precondition(s) violated: ptr::copy requires
 //@ revisions: null_src null_dst misaligned_src misaligned_dst
 
+#![allow(invalid_null_arguments)]
+
 use std::ptr;
 
 fn main() {
diff --git a/tests/ui/precondition-checks/read_volatile.rs b/tests/ui/precondition-checks/read_volatile.rs
index e14881d0290..ada8932c398 100644
--- a/tests/ui/precondition-checks/read_volatile.rs
+++ b/tests/ui/precondition-checks/read_volatile.rs
@@ -3,6 +3,8 @@
 //@ error-pattern: unsafe precondition(s) violated: ptr::read_volatile requires
 //@ revisions: null misaligned
 
+#![allow(invalid_null_arguments)]
+
 use std::ptr;
 
 fn main() {
diff --git a/tests/ui/precondition-checks/replace.rs b/tests/ui/precondition-checks/replace.rs
index 2808cee7b64..44afbd8174c 100644
--- a/tests/ui/precondition-checks/replace.rs
+++ b/tests/ui/precondition-checks/replace.rs
@@ -3,6 +3,8 @@
 //@ error-pattern: unsafe precondition(s) violated: ptr::replace requires
 //@ revisions: null misaligned
 
+#![allow(invalid_null_arguments)]
+
 use std::ptr;
 
 fn main() {
diff --git a/tests/ui/precondition-checks/slice-from-raw-parts-mut.rs b/tests/ui/precondition-checks/slice-from-raw-parts-mut.rs
index 3801639e255..9b9ded69a83 100644
--- a/tests/ui/precondition-checks/slice-from-raw-parts-mut.rs
+++ b/tests/ui/precondition-checks/slice-from-raw-parts-mut.rs
@@ -3,6 +3,8 @@
 //@ error-pattern: unsafe precondition(s) violated: slice::from_raw_parts_mut requires
 //@ revisions: null misaligned toolarge
 
+#![allow(invalid_null_arguments)]
+
 fn main() {
     unsafe {
         #[cfg(null)]
diff --git a/tests/ui/precondition-checks/slice-from-raw-parts.rs b/tests/ui/precondition-checks/slice-from-raw-parts.rs
index a3690fa045e..96578c1eae5 100644
--- a/tests/ui/precondition-checks/slice-from-raw-parts.rs
+++ b/tests/ui/precondition-checks/slice-from-raw-parts.rs
@@ -3,6 +3,8 @@
 //@ error-pattern: unsafe precondition(s) violated: slice::from_raw_parts requires
 //@ revisions: null misaligned toolarge
 
+#![allow(invalid_null_arguments)]
+
 fn main() {
     unsafe {
         #[cfg(null)]
diff --git a/tests/ui/precondition-checks/swap-nonoverlapping.rs b/tests/ui/precondition-checks/swap-nonoverlapping.rs
index 52e4a3c870b..ea1f6f36ad7 100644
--- a/tests/ui/precondition-checks/swap-nonoverlapping.rs
+++ b/tests/ui/precondition-checks/swap-nonoverlapping.rs
@@ -3,6 +3,8 @@
 //@ error-pattern: unsafe precondition(s) violated: ptr::swap_nonoverlapping requires
 //@ revisions: null_src null_dst misaligned_src misaligned_dst overlapping
 
+#![allow(invalid_null_arguments)]
+
 use std::ptr;
 
 fn main() {
diff --git a/tests/ui/precondition-checks/write_volatile.rs b/tests/ui/precondition-checks/write_volatile.rs
index ac0b89b5ecf..0d5ecb014b3 100644
--- a/tests/ui/precondition-checks/write_volatile.rs
+++ b/tests/ui/precondition-checks/write_volatile.rs
@@ -3,6 +3,8 @@
 //@ error-pattern: unsafe precondition(s) violated: ptr::write_volatile requires
 //@ revisions: null misaligned
 
+#![allow(invalid_null_arguments)]
+
 use std::ptr;
 
 fn main() {
diff --git a/tests/ui/precondition-checks/zero-size-null.rs b/tests/ui/precondition-checks/zero-size-null.rs
index 43a81175f94..55d768fc9e5 100644
--- a/tests/ui/precondition-checks/zero-size-null.rs
+++ b/tests/ui/precondition-checks/zero-size-null.rs
@@ -7,8 +7,10 @@ use std::ptr;
 
 fn main() {
     unsafe {
+        #[expect(invalid_null_arguments)] // false-positive, copy of 0
         ptr::copy_nonoverlapping::<u8>(ptr::null(), ptr::null_mut(), 0);
         ptr::copy_nonoverlapping::<()>(ptr::null(), ptr::null_mut(), 123);
+        #[expect(invalid_null_arguments)] // false-positive, copy of 0
         ptr::copy::<u8>(ptr::null(), ptr::null_mut(), 0);
         ptr::copy::<()>(ptr::null(), ptr::null_mut(), 123);
         ptr::swap::<()>(ptr::null_mut(), ptr::null_mut());
diff --git a/tests/ui/print-request/invalid-target.rs b/tests/ui/print-request/invalid-target.rs
index 52f09ea73d7..573d5493b25 100644
--- a/tests/ui/print-request/invalid-target.rs
+++ b/tests/ui/print-request/invalid-target.rs
@@ -2,3 +2,5 @@
 //@ needs-llvm-components: x86
 
 fn main() {}
+
+//~? ERROR only Apple targets currently support deployment version info
diff --git a/tests/ui/print-request/print-lints-help.rs b/tests/ui/print-request/print-lints-help.rs
new file mode 100644
index 00000000000..420eae27ed4
--- /dev/null
+++ b/tests/ui/print-request/print-lints-help.rs
@@ -0,0 +1,7 @@
+//! Check that we point to `-Whelp` to guide the user to find the list of lints if the user requests
+//! `--print=lints` (which is not a valid print request).
+
+//@ compile-flags: --print lints
+//@ error-pattern: error: unknown print request: `lints`
+//@ error-pattern: help: use `-Whelp` to print a list of lints
+//@ error-pattern: help: for more information, see the rustc book
diff --git a/tests/ui/print-request/print-lints-help.stderr b/tests/ui/print-request/print-lints-help.stderr
new file mode 100644
index 00000000000..0530d11f2e8
--- /dev/null
+++ b/tests/ui/print-request/print-lints-help.stderr
@@ -0,0 +1,6 @@
+error: unknown print request: `lints`
+  |
+  = help: valid print requests are: `all-target-specs-json`, `calling-conventions`, `cfg`, `check-cfg`, `code-models`, `crate-name`, `deployment-target`, `file-names`, `host-tuple`, `link-args`, `native-static-libs`, `relocation-models`, `split-debuginfo`, `stack-protector-strategies`, `supported-crate-types`, `sysroot`, `target-cpus`, `target-features`, `target-libdir`, `target-list`, `target-spec-json`, `tls-models`
+  = help: use `-Whelp` to print a list of lints
+  = help: for more information, see the rustc book: https://doc.rust-lang.org/rustc/command-line-arguments.html#--print-print-compiler-information
+
diff --git a/tests/ui/print-request/stability.rs b/tests/ui/print-request/stability.rs
new file mode 100644
index 00000000000..c3421224d72
--- /dev/null
+++ b/tests/ui/print-request/stability.rs
@@ -0,0 +1,107 @@
+//! Check that we properly gate unstable print requests (`--print=KIND`) and require the user to
+//! specify `-Z unstable-options` to use unstable print requests.
+
+// We don't care about the exact *stdout* output (i.e. what the print requests actually give back)
+// for the purposes of this test.
+//@ dont-check-compiler-stdout
+
+// We want to check for the core error message of the unstable print requests being `-Z
+// unstable-options`-gated and not the help because the help can change with addition of a new print
+// request, which is not important for the purposes of this test.
+//@ dont-check-compiler-stderr
+
+// =======================
+// Unstable print requests
+// =======================
+
+//@ revisions: all_target_specs_json
+//@[all_target_specs_json] compile-flags: --print=all-target-specs-json
+//@[all_target_specs_json] error-pattern: the `-Z unstable-options` flag must also be passed
+
+//@ revisions: check_cfg
+//@[check_cfg] compile-flags: --print=check-cfg
+//@[check_cfg] error-pattern: the `-Z unstable-options` flag must also be passed
+
+//@ revisions: supported_crate_types
+//@[supported_crate_types] compile-flags: --print=supported-crate-types
+//@[supported_crate_types] error-pattern: the `-Z unstable-options` flag must also be passed
+
+//@ revisions: target_spec_json
+//@[target_spec_json] compile-flags: --print=target-spec-json
+//@[target_spec_json] error-pattern: the `-Z unstable-options` flag must also be passed
+
+// =======================
+// Stable print requests
+// =======================
+
+//@ revisions: calling_conventions
+//@[calling_conventions] compile-flags: --print=calling-conventions
+//@[calling_conventions] check-pass
+
+//@ revisions: cfg
+//@[cfg] compile-flags: --print=cfg
+//@[cfg] check-pass
+
+//@ revisions: code_models
+//@[code_models] compile-flags: --print=code-models
+//@[code_models] check-pass
+
+//@ revisions: crate_name
+//@[crate_name] compile-flags: --print=crate-name
+//@[crate_name] check-pass
+
+// Note: `--print=deployment_target` is only accepted on Apple targets.
+//@ revisions: deployment_target
+//@[deployment_target] only-apple
+//@[deployment_target] compile-flags: --print=deployment-target
+//@[deployment_target] check-pass
+
+//@ revisions: file_names
+//@[file_names] compile-flags: --print=file-names
+//@[file_names] check-pass
+
+//@ revisions: host_tuple
+//@[host_tuple] compile-flags: --print=host-tuple
+//@[host_tuple] check-pass
+
+//@ revisions: link_args
+//@[link_args] compile-flags: --print=link-args
+//@[link_args] check-pass
+
+//@ revisions: native_static_libs
+//@[native_static_libs] compile-flags: --print=native-static-libs
+//@[native_static_libs] check-pass
+
+//@ revisions: relocation_models
+//@[relocation_models] compile-flags: --print=relocation-models
+//@[relocation_models] check-pass
+
+//@ revisions: split_debuginfo
+//@[split_debuginfo] compile-flags: --print=split-debuginfo
+//@[split_debuginfo] check-pass
+
+//@ revisions: stack_protector_strategies
+//@[stack_protector_strategies] compile-flags: --print=stack-protector-strategies
+//@[stack_protector_strategies] check-pass
+
+//@ revisions: target_cpus
+//@[target_cpus] compile-flags: --print=target-cpus
+//@[target_cpus] check-pass
+
+//@ revisions: target_features
+//@[target_features] compile-flags: --print=target-features
+//@[target_features] check-pass
+
+//@ revisions: target_libdir
+//@[target_libdir] compile-flags: --print=target-libdir
+//@[target_libdir] check-pass
+
+//@ revisions: target_list
+//@[target_list] compile-flags: --print=target-list
+//@[target_list] check-pass
+
+//@ revisions: tls_models
+//@[tls_models] compile-flags: --print=tls-models
+//@[tls_models] check-pass
+
+fn main() {}
diff --git a/tests/ui/print-request/supported-crate-types.linux.stdout b/tests/ui/print-request/supported-crate-types.linux.stdout
new file mode 100644
index 00000000000..721adb432e7
--- /dev/null
+++ b/tests/ui/print-request/supported-crate-types.linux.stdout
@@ -0,0 +1,7 @@
+bin
+cdylib
+dylib
+lib
+proc-macro
+rlib
+staticlib
diff --git a/tests/ui/print-request/supported-crate-types.musl.stdout b/tests/ui/print-request/supported-crate-types.musl.stdout
new file mode 100644
index 00000000000..1f4b991e49f
--- /dev/null
+++ b/tests/ui/print-request/supported-crate-types.musl.stdout
@@ -0,0 +1,5 @@
+bin
+lib
+proc-macro
+rlib
+staticlib
diff --git a/tests/ui/print-request/supported-crate-types.rs b/tests/ui/print-request/supported-crate-types.rs
new file mode 100644
index 00000000000..c8b4c0c1a41
--- /dev/null
+++ b/tests/ui/print-request/supported-crate-types.rs
@@ -0,0 +1,20 @@
+//! Basic smoke test for `--print=supported-crate-types`, which should print a newline delimited
+//! list of crate types supported by the given target. This test cherry-picks a few well-known
+//! targets as examples.
+//!
+//! Tracking issue: <https://github.com/rust-lang/rust/issues/138640>
+
+// ignore-tidy-linelength
+
+//@ check-pass
+
+//@ revisions: wasm musl linux
+
+//@[wasm] compile-flags: --target=wasm32-unknown-unknown --print=supported-crate-types -Zunstable-options
+//@[wasm] needs-llvm-components: webassembly
+
+//@[musl] compile-flags: --target=x86_64-unknown-linux-musl --print=supported-crate-types -Zunstable-options
+//@[musl] needs-llvm-components: x86
+
+//@[linux] compile-flags: --target=x86_64-unknown-linux-gnu --print=supported-crate-types -Zunstable-options
+//@[linux] needs-llvm-components: x86
diff --git a/tests/ui/print-request/supported-crate-types.wasm.stdout b/tests/ui/print-request/supported-crate-types.wasm.stdout
new file mode 100644
index 00000000000..ca1de519598
--- /dev/null
+++ b/tests/ui/print-request/supported-crate-types.wasm.stdout
@@ -0,0 +1,5 @@
+bin
+cdylib
+lib
+rlib
+staticlib
diff --git a/tests/ui/privacy/private-in-public-type-alias-impl-trait.rs b/tests/ui/privacy/private-in-public-type-alias-impl-trait.rs
index fd0e07fb9b4..743ca650fdd 100644
--- a/tests/ui/privacy/private-in-public-type-alias-impl-trait.rs
+++ b/tests/ui/privacy/private-in-public-type-alias-impl-trait.rs
@@ -8,6 +8,7 @@ pub type Pub = impl Default;
 #[derive(Default)]
 struct Priv;
 
+#[define_opaque(Pub)]
 fn check() -> Pub {
     Priv
 }
diff --git a/tests/ui/privacy/pub-priv-dep/pub-priv1.rs b/tests/ui/privacy/pub-priv-dep/pub-priv1.rs
index 112eaf528be..877029f3de3 100644
--- a/tests/ui/privacy/pub-priv-dep/pub-priv1.rs
+++ b/tests/ui/privacy/pub-priv-dep/pub-priv1.rs
@@ -77,15 +77,14 @@ pub type Alias = OtherType;
 
 pub struct PublicWithPrivateImpl;
 
-// FIXME: This should trigger.
-// See https://github.com/rust-lang/rust/issues/71043
 impl OtherTrait for PublicWithPrivateImpl {}
+//~^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface
 
 pub trait PubTraitOnPrivate {}
 
-// FIXME: This should trigger.
-// See https://github.com/rust-lang/rust/issues/71043
 impl PubTraitOnPrivate for OtherType {}
+//~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
+//~| ERROR type `OtherType` from private dependency 'priv_dep' in public interface
 
 pub struct AllowedPrivType {
     #[allow(exported_private_dependencies)]
diff --git a/tests/ui/privacy/pub-priv-dep/pub-priv1.stderr b/tests/ui/privacy/pub-priv-dep/pub-priv1.stderr
index 53d461a5774..adfe13424cd 100644
--- a/tests/ui/privacy/pub-priv-dep/pub-priv1.stderr
+++ b/tests/ui/privacy/pub-priv-dep/pub-priv1.stderr
@@ -70,5 +70,25 @@ error: type `OtherType` from private dependency 'priv_dep' in public interface
 LL | pub type Alias = OtherType;
    | ^^^^^^^^^^^^^^
 
-error: aborting due to 11 previous errors
+error: trait `OtherTrait` from private dependency 'priv_dep' in public interface
+  --> $DIR/pub-priv1.rs:80:1
+   |
+LL | impl OtherTrait for PublicWithPrivateImpl {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: type `OtherType` from private dependency 'priv_dep' in public interface
+  --> $DIR/pub-priv1.rs:85:1
+   |
+LL | impl PubTraitOnPrivate for OtherType {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: type `OtherType` from private dependency 'priv_dep' in public interface
+  --> $DIR/pub-priv1.rs:85:1
+   |
+LL | impl PubTraitOnPrivate for OtherType {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error: aborting due to 14 previous errors
 
diff --git a/tests/ui/privacy/where-pub-type-impls-priv-trait.rs b/tests/ui/privacy/where-pub-type-impls-priv-trait.rs
index 1ebc396cdf5..57548f75d5e 100644
--- a/tests/ui/privacy/where-pub-type-impls-priv-trait.rs
+++ b/tests/ui/privacy/where-pub-type-impls-priv-trait.rs
@@ -3,7 +3,6 @@
 // priv-in-pub lint tests where the private trait bounds a public type
 
 #![crate_type = "lib"]
-#![feature(generic_const_exprs)]
 #![allow(incomplete_features)]
 
 struct PrivTy;
diff --git a/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr b/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr
index ee79ce3f5d7..33f82a3a4fe 100644
--- a/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr
+++ b/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr
@@ -1,30 +1,30 @@
 warning: trait `PrivTr` is more private than the item `S`
-  --> $DIR/where-pub-type-impls-priv-trait.rs:20:1
+  --> $DIR/where-pub-type-impls-priv-trait.rs:19:1
    |
 LL | pub struct S
    | ^^^^^^^^^^^^ struct `S` is reachable at visibility `pub`
    |
 note: but trait `PrivTr` is only usable at visibility `pub(crate)`
-  --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
+  --> $DIR/where-pub-type-impls-priv-trait.rs:9:1
    |
 LL | trait PrivTr {}
    | ^^^^^^^^^^^^
    = note: `#[warn(private_bounds)]` on by default
 
 warning: trait `PrivTr` is more private than the item `E`
-  --> $DIR/where-pub-type-impls-priv-trait.rs:27:1
+  --> $DIR/where-pub-type-impls-priv-trait.rs:26:1
    |
 LL | pub enum E
    | ^^^^^^^^^^ enum `E` is reachable at visibility `pub`
    |
 note: but trait `PrivTr` is only usable at visibility `pub(crate)`
-  --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
+  --> $DIR/where-pub-type-impls-priv-trait.rs:9:1
    |
 LL | trait PrivTr {}
    | ^^^^^^^^^^^^
 
 warning: trait `PrivTr` is more private than the item `f`
-  --> $DIR/where-pub-type-impls-priv-trait.rs:34:1
+  --> $DIR/where-pub-type-impls-priv-trait.rs:33:1
    |
 LL | / pub fn f()
 LL | |
@@ -33,13 +33,13 @@ LL | |     PubTy: PrivTr
    | |_________________^ function `f` is reachable at visibility `pub`
    |
 note: but trait `PrivTr` is only usable at visibility `pub(crate)`
-  --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
+  --> $DIR/where-pub-type-impls-priv-trait.rs:9:1
    |
 LL | trait PrivTr {}
    | ^^^^^^^^^^^^
 
 warning: trait `PrivTr` is more private than the item `S`
-  --> $DIR/where-pub-type-impls-priv-trait.rs:41:1
+  --> $DIR/where-pub-type-impls-priv-trait.rs:40:1
    |
 LL | / impl S
 LL | |
@@ -48,13 +48,13 @@ LL | |     PubTy: PrivTr
    | |_________________^ implementation `S` is reachable at visibility `pub`
    |
 note: but trait `PrivTr` is only usable at visibility `pub(crate)`
-  --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
+  --> $DIR/where-pub-type-impls-priv-trait.rs:9:1
    |
 LL | trait PrivTr {}
    | ^^^^^^^^^^^^
 
 warning: trait `PrivTr` is more private than the item `S::f`
-  --> $DIR/where-pub-type-impls-priv-trait.rs:46:5
+  --> $DIR/where-pub-type-impls-priv-trait.rs:45:5
    |
 LL | /     pub fn f()
 LL | |
@@ -63,7 +63,7 @@ LL | |         PubTy: PrivTr
    | |_____________________^ associated function `S::f` is reachable at visibility `pub`
    |
 note: but trait `PrivTr` is only usable at visibility `pub(crate)`
-  --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
+  --> $DIR/where-pub-type-impls-priv-trait.rs:9:1
    |
 LL | trait PrivTr {}
    | ^^^^^^^^^^^^
diff --git a/tests/ui/proc-macro/cfg-attr-trace.rs b/tests/ui/proc-macro/cfg-attr-trace.rs
new file mode 100644
index 00000000000..140dd10a7e0
--- /dev/null
+++ b/tests/ui/proc-macro/cfg-attr-trace.rs
@@ -0,0 +1,23 @@
+// Ensure that `cfg_attr_trace` attributes aren't observable by proc-macros.
+
+//@ check-pass
+//@ proc-macro: test-macros.rs
+
+#![feature(cfg_boolean_literals)]
+#![feature(cfg_eval)]
+
+#[macro_use]
+extern crate test_macros;
+
+#[cfg_eval]
+#[test_macros::print_attr]
+#[cfg_attr(false, test_macros::print_attr)]
+#[cfg_attr(true, test_macros::print_attr)]
+struct S;
+
+#[cfg_eval]
+#[test_macros::print_attr]
+#[cfg(true)]
+struct Z;
+
+fn main() {}
diff --git a/tests/ui/proc-macro/cfg-attr-trace.stdout b/tests/ui/proc-macro/cfg-attr-trace.stdout
new file mode 100644
index 00000000000..52f9ff4e05c
--- /dev/null
+++ b/tests/ui/proc-macro/cfg-attr-trace.stdout
@@ -0,0 +1,78 @@
+PRINT-ATTR INPUT (DISPLAY): #[test_macros::print_attr] struct S;
+PRINT-ATTR DEEP-RE-COLLECTED (DISPLAY): #[test_macros :: print_attr] struct S;
+PRINT-ATTR INPUT (DEBUG): TokenStream [
+    Punct {
+        ch: '#',
+        spacing: Alone,
+        span: #0 bytes(305..306),
+    },
+    Group {
+        delimiter: Bracket,
+        stream: TokenStream [
+            Ident {
+                ident: "test_macros",
+                span: #0 bytes(322..333),
+            },
+            Punct {
+                ch: ':',
+                spacing: Joint,
+                span: #0 bytes(333..334),
+            },
+            Punct {
+                ch: ':',
+                spacing: Alone,
+                span: #0 bytes(334..335),
+            },
+            Ident {
+                ident: "print_attr",
+                span: #0 bytes(335..345),
+            },
+        ],
+        span: #0 bytes(306..347),
+    },
+    Ident {
+        ident: "struct",
+        span: #0 bytes(348..354),
+    },
+    Ident {
+        ident: "S",
+        span: #0 bytes(355..356),
+    },
+    Punct {
+        ch: ';',
+        spacing: Alone,
+        span: #0 bytes(356..357),
+    },
+]
+PRINT-ATTR INPUT (DISPLAY): struct S;
+PRINT-ATTR INPUT (DEBUG): TokenStream [
+    Ident {
+        ident: "struct",
+        span: #0 bytes(348..354),
+    },
+    Ident {
+        ident: "S",
+        span: #0 bytes(355..356),
+    },
+    Punct {
+        ch: ';',
+        spacing: Alone,
+        span: #0 bytes(356..357),
+    },
+]
+PRINT-ATTR INPUT (DISPLAY): struct Z;
+PRINT-ATTR INPUT (DEBUG): TokenStream [
+    Ident {
+        ident: "struct",
+        span: #0 bytes(411..417),
+    },
+    Ident {
+        ident: "Z",
+        span: #0 bytes(418..419),
+    },
+    Punct {
+        ch: ';',
+        spacing: Alone,
+        span: #0 bytes(419..420),
+    },
+]
diff --git a/tests/ui/proc-macro/expand-to-derive.stdout b/tests/ui/proc-macro/expand-to-derive.stdout
index 81fc52ea22d..3a16f23ecf2 100644
--- a/tests/ui/proc-macro/expand-to-derive.stdout
+++ b/tests/ui/proc-macro/expand-to-derive.stdout
@@ -44,52 +44,58 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
                     Group {
                         delimiter: Brace,
                         stream: TokenStream [
-                            Punct {
-                                ch: '#',
-                                spacing: Alone,
-                                span: $DIR/expand-to-derive.rs:27:5: 27:6 (#0),
-                            },
-                            Group {
-                                delimiter: Bracket,
-                                stream: TokenStream [
-                                    Ident {
-                                        ident: "rustc_dummy",
-                                        span: $DIR/expand-to-derive.rs:27:28: 27:39 (#0),
-                                    },
-                                ],
-                                span: $DIR/expand-to-derive.rs:27:6: 27:41 (#0),
-                            },
-                            Ident {
-                                ident: "struct",
-                                span: $DIR/expand-to-derive.rs:28:5: 28:11 (#0),
-                            },
-                            Ident {
-                                ident: "Inner",
-                                span: $DIR/expand-to-derive.rs:28:12: 28:17 (#0),
-                            },
                             Group {
-                                delimiter: Brace,
+                                delimiter: None,
                                 stream: TokenStream [
-                                    Ident {
-                                        ident: "other_inner_field",
-                                        span: $DIR/expand-to-derive.rs:30:9: 30:26 (#0),
-                                    },
                                     Punct {
-                                        ch: ':',
+                                        ch: '#',
                                         spacing: Alone,
-                                        span: $DIR/expand-to-derive.rs:30:26: 30:27 (#0),
+                                        span: $DIR/expand-to-derive.rs:27:5: 27:6 (#0),
+                                    },
+                                    Group {
+                                        delimiter: Bracket,
+                                        stream: TokenStream [
+                                            Ident {
+                                                ident: "rustc_dummy",
+                                                span: $DIR/expand-to-derive.rs:27:28: 27:39 (#0),
+                                            },
+                                        ],
+                                        span: $DIR/expand-to-derive.rs:27:6: 27:41 (#0),
                                     },
                                     Ident {
-                                        ident: "u8",
-                                        span: $DIR/expand-to-derive.rs:30:28: 30:30 (#0),
+                                        ident: "struct",
+                                        span: $DIR/expand-to-derive.rs:28:5: 28:11 (#0),
                                     },
-                                    Punct {
-                                        ch: ',',
-                                        spacing: Alone,
-                                        span: $DIR/expand-to-derive.rs:30:30: 30:31 (#0),
+                                    Ident {
+                                        ident: "Inner",
+                                        span: $DIR/expand-to-derive.rs:28:12: 28:17 (#0),
+                                    },
+                                    Group {
+                                        delimiter: Brace,
+                                        stream: TokenStream [
+                                            Ident {
+                                                ident: "other_inner_field",
+                                                span: $DIR/expand-to-derive.rs:30:9: 30:26 (#0),
+                                            },
+                                            Punct {
+                                                ch: ':',
+                                                spacing: Alone,
+                                                span: $DIR/expand-to-derive.rs:30:26: 30:27 (#0),
+                                            },
+                                            Ident {
+                                                ident: "u8",
+                                                span: $DIR/expand-to-derive.rs:30:28: 30:30 (#0),
+                                            },
+                                            Punct {
+                                                ch: ',',
+                                                spacing: Alone,
+                                                span: $DIR/expand-to-derive.rs:30:30: 30:31 (#0),
+                                            },
+                                        ],
+                                        span: $DIR/expand-to-derive.rs:28:18: 31:6 (#0),
                                     },
                                 ],
-                                span: $DIR/expand-to-derive.rs:28:18: 31:6 (#0),
+                                span: $DIR/expand-to-derive.rs:19:17: 19:22 (#3),
                             },
                             Literal {
                                 kind: Integer,
diff --git a/tests/ui/proc-macro/inner-attr-non-inline-mod.rs b/tests/ui/proc-macro/inner-attr-non-inline-mod.rs
index d4336a7f3e1..2dcdbf3c402 100644
--- a/tests/ui/proc-macro/inner-attr-non-inline-mod.rs
+++ b/tests/ui/proc-macro/inner-attr-non-inline-mod.rs
@@ -1,6 +1,4 @@
 //@ compile-flags: -Z span-debug
-//@ error-pattern:custom inner attributes are unstable
-//@ error-pattern:inner macro attributes are unstable
 //@ proc-macro: test-macros.rs
 
 #![no_std] // Don't load unnecessary hygiene information from std
@@ -15,3 +13,6 @@ mod module_with_attrs;
 //~| ERROR custom inner attributes are unstable
 
 fn main() {}
+
+//~? ERROR custom inner attributes are unstable
+//~? ERROR inner macro attributes are unstable
diff --git a/tests/ui/proc-macro/inner-attr-non-inline-mod.stderr b/tests/ui/proc-macro/inner-attr-non-inline-mod.stderr
index 025eec24818..c0a9385f4c6 100644
--- a/tests/ui/proc-macro/inner-attr-non-inline-mod.stderr
+++ b/tests/ui/proc-macro/inner-attr-non-inline-mod.stderr
@@ -19,7 +19,7 @@ LL | #![print_attr]
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0658]: non-inline modules in proc macro input are unstable
-  --> $DIR/inner-attr-non-inline-mod.rs:13:1
+  --> $DIR/inner-attr-non-inline-mod.rs:11:1
    |
 LL | mod module_with_attrs;
    | ^^^^^^^^^^^^^^^^^^^^^^
@@ -29,7 +29,7 @@ LL | mod module_with_attrs;
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0658]: custom inner attributes are unstable
-  --> $DIR/inner-attr-non-inline-mod.rs:13:1
+  --> $DIR/inner-attr-non-inline-mod.rs:11:1
    |
 LL | mod module_with_attrs;
    | ^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/proc-macro/inner-attr-non-inline-mod.stdout b/tests/ui/proc-macro/inner-attr-non-inline-mod.stdout
index 450542f68c6..219794a8eb8 100644
--- a/tests/ui/proc-macro/inner-attr-non-inline-mod.stdout
+++ b/tests/ui/proc-macro/inner-attr-non-inline-mod.stdout
@@ -4,35 +4,35 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
     Punct {
         ch: '#',
         spacing: Alone,
-        span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
+        span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
     },
     Group {
         delimiter: Bracket,
         stream: TokenStream [
             Ident {
                 ident: "deny",
-                span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
+                span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
             },
             Group {
                 delimiter: Parenthesis,
                 stream: TokenStream [
                     Ident {
                         ident: "unused_attributes",
-                        span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
+                        span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
                     },
                 ],
-                span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
+                span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
             },
         ],
-        span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
+        span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
     },
     Ident {
         ident: "mod",
-        span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
+        span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
     },
     Ident {
         ident: "module_with_attrs",
-        span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
+        span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
     },
     Group {
         delimiter: Brace,
@@ -40,38 +40,38 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
             Punct {
                 ch: '#',
                 spacing: Joint,
-                span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
+                span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
             },
             Punct {
                 ch: '!',
                 spacing: Alone,
-                span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
+                span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
             },
             Group {
                 delimiter: Bracket,
                 stream: TokenStream [
                     Ident {
                         ident: "rustfmt",
-                        span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
+                        span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
                     },
                     Punct {
                         ch: ':',
                         spacing: Joint,
-                        span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
+                        span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
                     },
                     Punct {
                         ch: ':',
                         spacing: Alone,
-                        span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
+                        span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
                     },
                     Ident {
                         ident: "skip",
-                        span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
+                        span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
                     },
                 ],
-                span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
+                span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
             },
         ],
-        span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
+        span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
     },
 ]
diff --git a/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr b/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr
index 0fe560afcb5..c12c8d03361 100644
--- a/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr
+++ b/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr
@@ -7,7 +7,6 @@ LL | #[derive(PartialOrd, AddImpl)]
    = help: the trait `PartialEq` is not implemented for `PriorityQueue<T>`
 note: required by a bound in `PartialOrd`
   --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `PriorityQueue<T>: Eq` is not satisfied
   --> $DIR/issue-104884-trait-impl-sugg-err.rs:13:22
@@ -32,7 +31,6 @@ LL | #[derive(PartialOrd, AddImpl)]
    |          ^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
 note: required by a bound in `Ord`
   --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   = note: this error originates in the derive macro `AddImpl` which comes from the expansion of the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `BinaryHeap<PriorityQueueEntry<T>>` with `_`
   --> $DIR/issue-104884-trait-impl-sugg-err.rs:20:25
@@ -44,7 +42,6 @@ LL | struct PriorityQueue<T>(BinaryHeap<PriorityQueueEntry<T>>);
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `BinaryHeap<PriorityQueueEntry<T>> < _` and `BinaryHeap<PriorityQueueEntry<T>> > _`
    |
    = help: the trait `PartialOrd<_>` is not implemented for `BinaryHeap<PriorityQueueEntry<T>>`
-   = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0599]: no method named `cmp` found for struct `BinaryHeap<PriorityQueueEntry<T>>` in the current scope
   --> $DIR/issue-104884-trait-impl-sugg-err.rs:13:22
diff --git a/tests/ui/proc-macro/no-macro-use-attr.rs b/tests/ui/proc-macro/no-macro-use-attr.rs
index d44f51bfd8d..25200378131 100644
--- a/tests/ui/proc-macro/no-macro-use-attr.rs
+++ b/tests/ui/proc-macro/no-macro-use-attr.rs
@@ -1,10 +1,9 @@
+//@ check-pass
 //@ proc-macro: test-macros.rs
 
-#![feature(rustc_attrs)]
 #![warn(unused_extern_crates)]
 
 extern crate test_macros;
 //~^ WARN unused extern crate
 
-#[rustc_error]
-fn main() {} //~ ERROR fatal error triggered by #[rustc_error]
+fn main() {}
diff --git a/tests/ui/proc-macro/no-macro-use-attr.stderr b/tests/ui/proc-macro/no-macro-use-attr.stderr
index 3dda3cc7d5a..4913672450a 100644
--- a/tests/ui/proc-macro/no-macro-use-attr.stderr
+++ b/tests/ui/proc-macro/no-macro-use-attr.stderr
@@ -10,11 +10,5 @@ note: the lint level is defined here
 LL | #![warn(unused_extern_crates)]
    |         ^^^^^^^^^^^^^^^^^^^^
 
-error: fatal error triggered by #[rustc_error]
-  --> $DIR/no-macro-use-attr.rs:10:1
-   |
-LL | fn main() {}
-   | ^^^^^^^^^
-
-error: aborting due to 1 previous error; 1 warning emitted
+warning: 1 warning emitted
 
diff --git a/tests/ui/proc-macro/nodelim-groups.rs b/tests/ui/proc-macro/nodelim-groups.rs
index 9acdc7023c0..8b0324214b9 100644
--- a/tests/ui/proc-macro/nodelim-groups.rs
+++ b/tests/ui/proc-macro/nodelim-groups.rs
@@ -19,4 +19,17 @@ macro_rules! expand_it {
 fn main() {
     expand_it!(1 + (25) + 1);
     expand_it!(("hello".len()) ("world".len()));
+    f();
+}
+
+// The key thing here is to produce a single `None`-delimited `Group`, even
+// though there is multiple levels of macros.
+macro_rules! m5 { ($e:expr) => { print_bang_consume!($e) }; }
+macro_rules! m4 { ($e:expr) => { m5!($e); } }
+macro_rules! m3 { ($e:expr) => { m4!($e); } }
+macro_rules! m2 { ($e:expr) => { m3!($e); } }
+macro_rules! m1 { ($e:expr) => { m2!($e); } }
+
+fn f() {
+    m1!(123);
 }
diff --git a/tests/ui/proc-macro/nodelim-groups.stdout b/tests/ui/proc-macro/nodelim-groups.stdout
index cdf851b535a..61001035c26 100644
--- a/tests/ui/proc-macro/nodelim-groups.stdout
+++ b/tests/ui/proc-macro/nodelim-groups.stdout
@@ -165,3 +165,18 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
         span: $DIR/nodelim-groups.rs:16:52: 16:59 (#8),
     },
 ]
+PRINT-BANG INPUT (DISPLAY): 123
+PRINT-BANG INPUT (DEBUG): TokenStream [
+    Group {
+        delimiter: None,
+        stream: TokenStream [
+            Literal {
+                kind: Integer,
+                symbol: "123",
+                suffix: None,
+                span: $DIR/nodelim-groups.rs:34:9: 34:12 (#0),
+            },
+        ],
+        span: $DIR/nodelim-groups.rs:27:54: 27:56 (#16),
+    },
+]
diff --git a/tests/ui/proc-macro/nonterminal-token-hygiene.stdout b/tests/ui/proc-macro/nonterminal-token-hygiene.stdout
index c80a33206fb..6fd6cb47469 100644
--- a/tests/ui/proc-macro/nonterminal-token-hygiene.stdout
+++ b/tests/ui/proc-macro/nonterminal-token-hygiene.stdout
@@ -5,19 +5,19 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
         stream: TokenStream [
             Ident {
                 ident: "struct",
-                span: $DIR/nonterminal-token-hygiene.rs:32:5: 32:11 (#4),
+                span: $DIR/nonterminal-token-hygiene.rs:32:5: 32:11 (#5),
             },
             Ident {
                 ident: "S",
-                span: $DIR/nonterminal-token-hygiene.rs:32:12: 32:13 (#4),
+                span: $DIR/nonterminal-token-hygiene.rs:32:12: 32:13 (#5),
             },
             Punct {
                 ch: ';',
                 spacing: Alone,
-                span: $DIR/nonterminal-token-hygiene.rs:32:13: 32:14 (#4),
+                span: $DIR/nonterminal-token-hygiene.rs:32:13: 32:14 (#5),
             },
         ],
-        span: $DIR/nonterminal-token-hygiene.rs:22:27: 22:32 (#5),
+        span: $DIR/nonterminal-token-hygiene.rs:22:27: 22:32 (#4),
     },
 ]
 #![feature /* 0#0 */(prelude_import)]
@@ -59,7 +59,7 @@ macro_rules! outer
 struct S /* 0#0 */;
 macro inner /* 0#3 */ { () => { print_bang! { struct S; } } }
 
-struct S /* 0#4 */;
+struct S /* 0#5 */;
 // OK, not a duplicate definition of `S`
 
 fn main /* 0#0 */() {}
@@ -70,7 +70,7 @@ crate0::{{expn0}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt:
 crate0::{{expn1}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: AstPass(StdImports)
 crate0::{{expn2}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "outer")
 crate0::{{expn3}}: parent: crate0::{{expn2}}, call_site_ctxt: #3, def_site_ctxt: #3, kind: Macro(Bang, "inner")
-crate0::{{expn4}}: parent: crate0::{{expn3}}, call_site_ctxt: #5, def_site_ctxt: #0, kind: Macro(Bang, "print_bang")
+crate0::{{expn4}}: parent: crate0::{{expn3}}, call_site_ctxt: #4, def_site_ctxt: #0, kind: Macro(Bang, "print_bang")
 crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "diagnostic::on_unimplemented")
 crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "diagnostic::on_unimplemented")
 crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "diagnostic::on_unimplemented")
@@ -83,9 +83,9 @@ SyntaxContexts:
 #1: parent: #0, outer_mark: (crate0::{{expn1}}, Opaque)
 #2: parent: #0, outer_mark: (crate0::{{expn1}}, Transparent)
 #3: parent: #0, outer_mark: (crate0::{{expn2}}, SemiTransparent)
-#4: parent: #0, outer_mark: (crate0::{{expn3}}, Opaque)
-#5: parent: #3, outer_mark: (crate0::{{expn3}}, Opaque)
+#4: parent: #3, outer_mark: (crate0::{{expn3}}, Opaque)
+#5: parent: #0, outer_mark: (crate0::{{expn3}}, Opaque)
 #6: parent: #0, outer_mark: (crate0::{{expn4}}, Opaque)
-#7: parent: #5, outer_mark: (crate0::{{expn4}}, Transparent)
-#8: parent: #4, outer_mark: (crate0::{{expn4}}, SemiTransparent)
+#7: parent: #4, outer_mark: (crate0::{{expn4}}, Transparent)
+#8: parent: #5, outer_mark: (crate0::{{expn4}}, SemiTransparent)
 */
diff --git a/tests/ui/proc-macro/pretty-print-hack-show.rs b/tests/ui/proc-macro/pretty-print-hack-show.rs
index de6453c6a82..70f0d5f6ea9 100644
--- a/tests/ui/proc-macro/pretty-print-hack-show.rs
+++ b/tests/ui/proc-macro/pretty-print-hack-show.rs
@@ -18,3 +18,5 @@ mod second {
 }
 
 fn main() {}
+
+//~? ERROR using an old version of `rental`
diff --git a/tests/ui/proc-macro/quote/not-quotable.stderr b/tests/ui/proc-macro/quote/not-quotable.stderr
index e349b2dce53..62a02638e54 100644
--- a/tests/ui/proc-macro/quote/not-quotable.stderr
+++ b/tests/ui/proc-macro/quote/not-quotable.stderr
@@ -17,7 +17,6 @@ LL |     let _ = quote! { $ip };
              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
 
diff --git a/tests/ui/range/range_traits-1.stderr b/tests/ui/range/range_traits-1.stderr
index 617afc99530..ab1035778cd 100644
--- a/tests/ui/range/range_traits-1.stderr
+++ b/tests/ui/range/range_traits-1.stderr
@@ -8,7 +8,6 @@ LL |     a: Range<usize>,
    |     ^^^^^^^^^^^^^^^ no implementation for `std::ops::Range<usize> < std::ops::Range<usize>` and `std::ops::Range<usize> > std::ops::Range<usize>`
    |
    = help: the trait `PartialOrd` is not implemented for `std::ops::Range<usize>`
-   = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeTo<usize>` with `std::ops::RangeTo<usize>`
   --> $DIR/range_traits-1.rs:8:5
@@ -20,7 +19,6 @@ LL |     b: RangeTo<usize>,
    |     ^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeTo<usize> < std::ops::RangeTo<usize>` and `std::ops::RangeTo<usize> > std::ops::RangeTo<usize>`
    |
    = help: the trait `PartialOrd` is not implemented for `std::ops::RangeTo<usize>`
-   = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeFrom<usize>` with `std::ops::RangeFrom<usize>`
   --> $DIR/range_traits-1.rs:11:5
@@ -32,7 +30,6 @@ LL |     c: RangeFrom<usize>,
    |     ^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeFrom<usize> < std::ops::RangeFrom<usize>` and `std::ops::RangeFrom<usize> > std::ops::RangeFrom<usize>`
    |
    = help: the trait `PartialOrd` is not implemented for `std::ops::RangeFrom<usize>`
-   = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeFull` with `std::ops::RangeFull`
   --> $DIR/range_traits-1.rs:14:5
@@ -44,7 +41,6 @@ LL |     d: RangeFull,
    |     ^^^^^^^^^^^^ no implementation for `std::ops::RangeFull < std::ops::RangeFull` and `std::ops::RangeFull > std::ops::RangeFull`
    |
    = help: the trait `PartialOrd` is not implemented for `std::ops::RangeFull`
-   = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeInclusive<usize>` with `std::ops::RangeInclusive<usize>`
   --> $DIR/range_traits-1.rs:17:5
@@ -56,7 +52,6 @@ LL |     e: RangeInclusive<usize>,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeInclusive<usize> < std::ops::RangeInclusive<usize>` and `std::ops::RangeInclusive<usize> > std::ops::RangeInclusive<usize>`
    |
    = help: the trait `PartialOrd` is not implemented for `std::ops::RangeInclusive<usize>`
-   = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeToInclusive<usize>` with `std::ops::RangeToInclusive<usize>`
   --> $DIR/range_traits-1.rs:20:5
@@ -68,7 +63,6 @@ LL |     f: RangeToInclusive<usize>,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeToInclusive<usize> < std::ops::RangeToInclusive<usize>` and `std::ops::RangeToInclusive<usize> > std::ops::RangeToInclusive<usize>`
    |
    = help: the trait `PartialOrd` is not implemented for `std::ops::RangeToInclusive<usize>`
-   = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `std::ops::Range<usize>: Ord` is not satisfied
   --> $DIR/range_traits-1.rs:5:5
@@ -78,8 +72,6 @@ LL | #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
 LL | struct AllTheRanges {
 LL |     a: Range<usize>,
    |     ^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::Range<usize>`
-   |
-   = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `std::ops::RangeTo<usize>: Ord` is not satisfied
   --> $DIR/range_traits-1.rs:8:5
@@ -89,8 +81,6 @@ LL | #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
 ...
 LL |     b: RangeTo<usize>,
    |     ^^^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeTo<usize>`
-   |
-   = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `std::ops::RangeFrom<usize>: Ord` is not satisfied
   --> $DIR/range_traits-1.rs:11:5
@@ -100,8 +90,6 @@ LL | #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
 ...
 LL |     c: RangeFrom<usize>,
    |     ^^^^^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeFrom<usize>`
-   |
-   = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `std::ops::RangeFull: Ord` is not satisfied
   --> $DIR/range_traits-1.rs:14:5
@@ -111,8 +99,6 @@ LL | #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
 ...
 LL |     d: RangeFull,
    |     ^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeFull`
-   |
-   = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `std::ops::RangeInclusive<usize>: Ord` is not satisfied
   --> $DIR/range_traits-1.rs:17:5
@@ -122,8 +108,6 @@ LL | #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
 ...
 LL |     e: RangeInclusive<usize>,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeInclusive<usize>`
-   |
-   = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `std::ops::RangeToInclusive<usize>: Ord` is not satisfied
   --> $DIR/range_traits-1.rs:20:5
@@ -133,8 +117,6 @@ LL | #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
 ...
 LL |     f: RangeToInclusive<usize>,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeToInclusive<usize>`
-   |
-   = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 12 previous errors
 
diff --git a/tests/ui/range/range_traits-2.stderr b/tests/ui/range/range_traits-2.stderr
index 04778eecf56..2001c85c434 100644
--- a/tests/ui/range/range_traits-2.stderr
+++ b/tests/ui/range/range_traits-2.stderr
@@ -5,8 +5,6 @@ LL | #[derive(Copy, Clone)]
    |          ^^^^
 LL | struct R(Range<usize>);
    |          ------------ this field does not implement `Copy`
-   |
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/range/range_traits-3.stderr b/tests/ui/range/range_traits-3.stderr
index 094cc146b6c..71210379c79 100644
--- a/tests/ui/range/range_traits-3.stderr
+++ b/tests/ui/range/range_traits-3.stderr
@@ -5,8 +5,6 @@ LL | #[derive(Copy, Clone)]
    |          ^^^^
 LL | struct R(RangeFrom<usize>);
    |          ---------------- this field does not implement `Copy`
-   |
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/range/range_traits-6.stderr b/tests/ui/range/range_traits-6.stderr
index 7c66d1c749c..a58022ef7e4 100644
--- a/tests/ui/range/range_traits-6.stderr
+++ b/tests/ui/range/range_traits-6.stderr
@@ -5,8 +5,6 @@ LL | #[derive(Copy, Clone)]
    |          ^^^^
 LL | struct R(RangeInclusive<usize>);
    |          --------------------- this field does not implement `Copy`
-   |
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/resolve/multiple_definitions_attribute_merging.stderr b/tests/ui/resolve/multiple_definitions_attribute_merging.stderr
index ac6307c7a69..10ce68e506e 100644
--- a/tests/ui/resolve/multiple_definitions_attribute_merging.stderr
+++ b/tests/ui/resolve/multiple_definitions_attribute_merging.stderr
@@ -15,8 +15,8 @@ LL | #[derive(PartialEq)]
 LL | #[repr(C)]
 LL | struct Dealigned<T>(u8, T);
    |                         ^
-   |
-   = 
+
+
 Box<dyn Any>
 query stack during panic:
 #0 [mir_built] building MIR for `<impl at $DIR/multiple_definitions_attribute_merging.rs:15:10: 15:19>::eq`
diff --git a/tests/ui/resolve/parse-error-resolve.rs b/tests/ui/resolve/parse-error-resolve.rs
index 1e0772648af..cb15ec76403 100644
--- a/tests/ui/resolve/parse-error-resolve.rs
+++ b/tests/ui/resolve/parse-error-resolve.rs
@@ -5,3 +5,5 @@ fn main() {
     let _ = "" + 1; //~ ERROR E0369
     parse_error::Canonical.foo(); // ok, `parse_error.rs` had parse errors
 }
+
+//~? ERROR expected one of `+`, `,`, `::`, `=`, or `>`, found `From`
diff --git a/tests/ui/resolve/proc_macro_generated_packed.stderr b/tests/ui/resolve/proc_macro_generated_packed.stderr
index 8b700595034..47de5be82dd 100644
--- a/tests/ui/resolve/proc_macro_generated_packed.stderr
+++ b/tests/ui/resolve/proc_macro_generated_packed.stderr
@@ -6,8 +6,8 @@ LL | #[derive(PartialEq)]
 ...
 LL | struct Dealigned<T>(u8, T);
    |                         ^
-   |
-   = 
+
+
 Box<dyn Any>
 query stack during panic:
 #0 [mir_built] building MIR for `<impl at $DIR/proc_macro_generated_packed.rs:15:10: 15:19>::eq`
diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.no_gate.stderr b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.no_gate.stderr
index 08584349626..c5756269def 100644
--- a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.no_gate.stderr
+++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.no_gate.stderr
@@ -1,5 +1,5 @@
 error[E0658]: use of unstable library feature `structural_match`
-  --> $DIR/feature-gate.rs:29:6
+  --> $DIR/feature-gate.rs:27:6
    |
 LL | impl std::marker::StructuralPartialEq for Foo { }
    |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.rs b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.rs
index 711b07fee3b..694081654d5 100644
--- a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.rs
+++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.rs
@@ -3,11 +3,10 @@
 // used in a match.
 
 //@ revisions: with_gate no_gate
-
+//@[with_gate] check-pass
 // gate-test-structural_match
 
 #![allow(unused)]
-#![feature(rustc_attrs)]
 #![cfg_attr(with_gate, feature(structural_match))]
 
 
@@ -17,8 +16,7 @@ struct Foo {
 
 const FOO: Foo = Foo { x: 0 };
 
-#[rustc_error]
-fn main() { //[with_gate]~ ERROR fatal error triggered by #[rustc_error]
+fn main() {
     let y = Foo { x: 1 };
     match y {
         FOO => { }
diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.with_gate.stderr b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.with_gate.stderr
deleted file mode 100644
index 505b7d79cad..00000000000
--- a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.with_gate.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: fatal error triggered by #[rustc_error]
-  --> $DIR/feature-gate.rs:21:1
-   |
-LL | fn main() {
-   | ^^^^^^^^^
-
-error: aborting due to 1 previous error
-
diff --git a/tests/ui/rfcs/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr b/tests/ui/rfcs/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr
index 0a703367d96..b89c5e8dda8 100644
--- a/tests/ui/rfcs/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr
+++ b/tests/ui/rfcs/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr
@@ -9,7 +9,6 @@ LL | fn can_parse_zero_as_f32() -> Result<f32, ParseFloatError> {
    = note: required for `Result<f32, ParseFloatError>` to implement `Termination`
 note: required by a bound in `assert_test_result`
   --> $SRC_DIR/test/src/lib.rs:LL:COL
-   = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/rfcs/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.rs b/tests/ui/rfcs/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.rs
index ef970ebd14b..2b21d3987b9 100644
--- a/tests/ui/rfcs/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.rs
+++ b/tests/ui/rfcs/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.rs
@@ -30,3 +30,5 @@ fn main() {
         (CONSTANT.file(), CONSTANT.line(), CONSTANT.column()),
     );
 }
+
+//~? WARN skipping const checks
diff --git a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.rs b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.rs
index 34b94f2e1c7..4cf2d1ac4a6 100644
--- a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.rs
+++ b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.rs
@@ -12,6 +12,7 @@ impl<'a, T> Trait<'a> for T {
 mod basic_pass {
     use super::*;
     type Opq<'a> = impl Sized + 'a;
+    #[define_opaque(Opq)]
     fn test() -> impl for<'a> Trait<'a, Ty = Opq<'a>> {}
     //~^ ERROR: expected generic lifetime parameter, found `'a`
 }
@@ -27,6 +28,7 @@ mod capture_tait {
     type Opq0 = impl Sized;
     type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0>;
     type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>;
+    #[define_opaque(Opq2)]
     fn test() -> Opq2 {}
     //~^ ERROR hidden type for `capture_tait::Opq0` captures lifetime that does not appear in bounds
 }
@@ -36,6 +38,7 @@ mod capture_tait_complex_pass {
     type Opq0<'a> = impl Sized;
     type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'b>>; // <- Note 'b
     type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>;
+    #[define_opaque(Opq2)]
     fn test() -> Opq2 {}
     //~^ ERROR: expected generic lifetime parameter, found `'a`
 }
@@ -46,6 +49,7 @@ mod capture_tait_complex_fail {
     type Opq0<'a> = impl Sized;
     type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'a>>; // <- Note 'a
     type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>;
+    #[define_opaque(Opq2)]
     fn test() -> Opq2 {}
     //~^ ERROR hidden type for `capture_tait_complex_fail::Opq0<'a>` captures lifetime that does not appear in bounds
 }
@@ -54,18 +58,18 @@ mod capture_tait_complex_fail {
 mod constrain_fail0 {
     use super::*;
     type Opq0<'a, 'b> = impl Sized;
+    #[define_opaque(Opq0)]
     fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'static>> {}
-    //~^ ERROR non-defining opaque type use in defining scope
-    //~| ERROR: expected generic lifetime parameter, found `'a`
+    //~^ ERROR: expected generic lifetime parameter, found `'a`
 }
 
 // non-defining use because generic lifetime is used multiple times.
 mod constrain_fail {
     use super::*;
     type Opq0<'a, 'b> = impl Sized;
+    #[define_opaque(Opq0)]
     fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'a>> {}
-    //~^ ERROR non-defining opaque type use in defining scope
-    //~| ERROR: expected generic lifetime parameter, found `'a`
+    //~^ ERROR: expected generic lifetime parameter, found `'a`
 }
 
 mod constrain_pass {
@@ -73,6 +77,7 @@ mod constrain_pass {
     type Opq0<'a, 'b> = impl Sized;
     type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'a, 'b>>;
     type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>;
+    #[define_opaque(Opq2)]
     fn test() -> Opq2 {}
     //~^ ERROR: expected generic lifetime parameter, found `'a`
 }
diff --git a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr
index fb1e4cca3f4..3614fc8f45c 100644
--- a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr
+++ b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr
@@ -1,13 +1,14 @@
 error[E0792]: expected generic lifetime parameter, found `'a`
-  --> $DIR/higher-ranked-regions-basic.rs:15:55
+  --> $DIR/higher-ranked-regions-basic.rs:16:55
    |
 LL |     type Opq<'a> = impl Sized + 'a;
    |              -- this generic parameter must be used with a generic lifetime parameter
+LL |     #[define_opaque(Opq)]
 LL |     fn test() -> impl for<'a> Trait<'a, Ty = Opq<'a>> {}
    |                                                       ^^
 
 error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds
-  --> $DIR/higher-ranked-regions-basic.rs:21:58
+  --> $DIR/higher-ranked-regions-basic.rs:22:58
    |
 LL |     fn test() -> impl for<'a> Trait<'a, Ty = impl Sized> {}
    |                           --                 ----------  ^^
@@ -16,86 +17,64 @@ LL |     fn test() -> impl for<'a> Trait<'a, Ty = impl Sized> {}
    |                           hidden type `&'a ()` captures the lifetime `'a` as defined here
 
 error[E0700]: hidden type for `capture_tait::Opq0` captures lifetime that does not appear in bounds
-  --> $DIR/higher-ranked-regions-basic.rs:30:23
+  --> $DIR/higher-ranked-regions-basic.rs:32:23
    |
 LL |     type Opq0 = impl Sized;
    |                 ---------- opaque type defined here
 LL |     type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0>;
    |                              -- hidden type `&'b ()` captures the lifetime `'b` as defined here
-LL |     type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>;
+...
 LL |     fn test() -> Opq2 {}
    |                       ^^
 
 error[E0792]: expected generic lifetime parameter, found `'a`
-  --> $DIR/higher-ranked-regions-basic.rs:39:23
+  --> $DIR/higher-ranked-regions-basic.rs:42:23
    |
 LL |     type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'b>>; // <- Note 'b
    |               -- this generic parameter must be used with a generic lifetime parameter
-LL |     type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>;
+...
 LL |     fn test() -> Opq2 {}
    |                       ^^
 
 error[E0700]: hidden type for `capture_tait_complex_fail::Opq0<'a>` captures lifetime that does not appear in bounds
-  --> $DIR/higher-ranked-regions-basic.rs:49:23
+  --> $DIR/higher-ranked-regions-basic.rs:53:23
    |
 LL |     type Opq0<'a> = impl Sized;
    |                     ---------- opaque type defined here
 LL |     type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'a>>; // <- Note 'a
    |                              -- hidden type `&'b ()` captures the lifetime `'b` as defined here
-LL |     type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>;
+...
 LL |     fn test() -> Opq2 {}
    |                       ^^
 
-error[E0792]: non-defining opaque type use in defining scope
-  --> $DIR/higher-ranked-regions-basic.rs:57:41
-   |
-LL |     fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'static>> {}
-   |                                         ^^^^^^^^^^^^^^^^^^^^^^ argument `'static` is not a generic parameter
-   |
-note: for this opaque type
-  --> $DIR/higher-ranked-regions-basic.rs:56:25
-   |
-LL |     type Opq0<'a, 'b> = impl Sized;
-   |                         ^^^^^^^^^^
-
 error[E0792]: expected generic lifetime parameter, found `'a`
-  --> $DIR/higher-ranked-regions-basic.rs:57:65
+  --> $DIR/higher-ranked-regions-basic.rs:62:65
    |
 LL |     type Opq0<'a, 'b> = impl Sized;
    |               -- this generic parameter must be used with a generic lifetime parameter
+LL |     #[define_opaque(Opq0)]
 LL |     fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'static>> {}
    |                                                                 ^^
 
-error: non-defining opaque type use in defining scope
-  --> $DIR/higher-ranked-regions-basic.rs:66:41
-   |
-LL |     fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'a>> {}
-   |                                         ^^^^^^^^^^^^^^^^^ generic argument `'a` used twice
-   |
-note: for this opaque type
-  --> $DIR/higher-ranked-regions-basic.rs:65:25
-   |
-LL |     type Opq0<'a, 'b> = impl Sized;
-   |                         ^^^^^^^^^^
-
 error[E0792]: expected generic lifetime parameter, found `'a`
-  --> $DIR/higher-ranked-regions-basic.rs:66:60
+  --> $DIR/higher-ranked-regions-basic.rs:71:60
    |
 LL |     type Opq0<'a, 'b> = impl Sized;
    |               -- this generic parameter must be used with a generic lifetime parameter
+LL |     #[define_opaque(Opq0)]
 LL |     fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'a>> {}
    |                                                            ^^
 
 error[E0792]: expected generic lifetime parameter, found `'a`
-  --> $DIR/higher-ranked-regions-basic.rs:76:23
+  --> $DIR/higher-ranked-regions-basic.rs:81:23
    |
 LL |     type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'a, 'b>>;
    |               -- this generic parameter must be used with a generic lifetime parameter
-LL |     type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>;
+...
 LL |     fn test() -> Opq2 {}
    |                       ^^
 
-error: aborting due to 10 previous errors
+error: aborting due to 8 previous errors
 
 Some errors have detailed explanations: E0700, E0792.
 For more information about an error, try `rustc --explain E0700`.
diff --git a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.rs b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.rs
index db5e5e05e54..e0b7909c240 100644
--- a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.rs
+++ b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.rs
@@ -14,7 +14,10 @@ impl Trait for Struct {
     type Assoc<'a> = &'a u32;
 }
 
-const FOO: Foo = Struct;
-//~^ ERROR: expected generic lifetime parameter, found `'a`
+#[define_opaque(Foo)]
+fn foo() -> Foo {
+    Struct
+    //~^ ERROR: expected generic lifetime parameter, found `'a`
+}
 
 fn main() {}
diff --git a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.stderr b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.stderr
index 9b361445f1e..b3edc942732 100644
--- a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.stderr
+++ b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.stderr
@@ -1,11 +1,11 @@
 error[E0792]: expected generic lifetime parameter, found `'a`
-  --> $DIR/higher-ranked-regions-gat.rs:17:18
+  --> $DIR/higher-ranked-regions-gat.rs:19:5
    |
 LL | pub type FooAssoc<'a> = impl Sized;
    |                   -- this generic parameter must be used with a generic lifetime parameter
 ...
-LL | const FOO: Foo = Struct;
-   |                  ^^^^^^
+LL |     Struct
+   |     ^^^^^^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/rmeta/no_optitimized_mir.rs b/tests/ui/rmeta/no_optitimized_mir.rs
index 7d2e1b87215..708cdfc803f 100644
--- a/tests/ui/rmeta/no_optitimized_mir.rs
+++ b/tests/ui/rmeta/no_optitimized_mir.rs
@@ -9,3 +9,5 @@ extern crate rmeta_meta;
 fn main() {
     rmeta_meta::missing_optimized_mir();
 }
+
+//~? ERROR missing optimized MIR for an item in the crate `rmeta_meta`
diff --git a/tests/ui/rmeta/rmeta_bin-pass.rs b/tests/ui/rmeta/rmeta_bin-pass.rs
new file mode 100644
index 00000000000..7de4f3ba961
--- /dev/null
+++ b/tests/ui/rmeta/rmeta_bin-pass.rs
@@ -0,0 +1,14 @@
+//@ compile-flags: --emit=obj,metadata --crate-type=bin
+//@ aux-build:rmeta-meta.rs
+//@ no-prefer-dynamic
+//@ build-pass
+
+// Check that building a metadata bin crate works with a dependent, metadata
+// crate if linking is not requested.
+
+extern crate rmeta_meta;
+use rmeta_meta::Foo;
+
+pub fn main() {
+    let _ = Foo { field: 42 };
+}
diff --git a/tests/ui/rmeta/rmeta_bin.rs b/tests/ui/rmeta/rmeta_bin.rs
new file mode 100644
index 00000000000..c7d2050cd59
--- /dev/null
+++ b/tests/ui/rmeta/rmeta_bin.rs
@@ -0,0 +1,14 @@
+//@ build-fail
+//@ compile-flags: --crate-type=bin
+//@ aux-build:rmeta-meta.rs
+//@ no-prefer-dynamic
+//@ error-pattern: crate `rmeta_meta` required to be available in rlib format, but was not found
+
+// Check that building a bin crate fails if a dependent crate is metadata-only.
+
+extern crate rmeta_meta;
+use rmeta_meta::Foo;
+
+fn main() {
+    let _ = Foo { field: 42 };
+}
diff --git a/tests/ui/rmeta/rmeta_bin.stderr b/tests/ui/rmeta/rmeta_bin.stderr
new file mode 100644
index 00000000000..830169e032a
--- /dev/null
+++ b/tests/ui/rmeta/rmeta_bin.stderr
@@ -0,0 +1,4 @@
+error: crate `rmeta_meta` required to be available in rlib format, but was not found in this form
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/runtime/on-broken-pipe/auxiliary/assert-sigpipe-disposition.rs b/tests/ui/runtime/on-broken-pipe/auxiliary/assert-sigpipe-disposition.rs
index f3f9ce0bd87..3a574af9bba 100644
--- a/tests/ui/runtime/on-broken-pipe/auxiliary/assert-sigpipe-disposition.rs
+++ b/tests/ui/runtime/on-broken-pipe/auxiliary/assert-sigpipe-disposition.rs
@@ -26,14 +26,7 @@ extern "C" fn main(argc: core::ffi::c_int, argv: *const *const u8) -> core::ffi:
     let actual = unsafe {
         let mut actual: libc::sigaction = core::mem::zeroed();
         libc::sigaction(libc::SIGPIPE, core::ptr::null(), &mut actual);
-        #[cfg(not(target_os = "aix"))]
-        {
-            actual.sa_sigaction
-        }
-        #[cfg(target_os = "aix")]
-        {
-            actual.sa_union.__su_sigaction as libc::sighandler_t
-        }
+        actual.sa_sigaction
     };
 
     assert_eq!(actual, expected, "actual and expected SIGPIPE disposition in child differs");
diff --git a/tests/ui/runtime/on-broken-pipe/auxiliary/sigpipe-utils.rs b/tests/ui/runtime/on-broken-pipe/auxiliary/sigpipe-utils.rs
index d16a2b4d8c8..3d93d50ca3f 100644
--- a/tests/ui/runtime/on-broken-pipe/auxiliary/sigpipe-utils.rs
+++ b/tests/ui/runtime/on-broken-pipe/auxiliary/sigpipe-utils.rs
@@ -20,14 +20,7 @@ pub fn assert_sigpipe_handler(expected_handler: SignalHandler) {
         let actual = unsafe {
             let mut actual: libc::sigaction = std::mem::zeroed();
             libc::sigaction(libc::SIGPIPE, std::ptr::null(), &mut actual);
-            #[cfg(not(target_os = "aix"))]
-            {
-                actual.sa_sigaction
-            }
-            #[cfg(target_os = "aix")]
-            {
-                actual.sa_union.__su_sigaction as libc::sighandler_t
-            }
+            actual.sa_sigaction
         };
 
         let expected = match expected_handler {
diff --git a/tests/ui/runtime/on-broken-pipe/default.rs b/tests/ui/runtime/on-broken-pipe/default.rs
index c10d1cfacc0..61b7810e2a1 100644
--- a/tests/ui/runtime/on-broken-pipe/default.rs
+++ b/tests/ui/runtime/on-broken-pipe/default.rs
@@ -2,3 +2,5 @@
 //@ check-fail
 
 fn main() {}
+
+//~? ERROR incorrect value `default` for unstable option `on-broken-pipe`
diff --git a/tests/ui/runtime/on-broken-pipe/no-flag-arg.rs b/tests/ui/runtime/on-broken-pipe/no-flag-arg.rs
index 2273291bfa7..bb49533c023 100644
--- a/tests/ui/runtime/on-broken-pipe/no-flag-arg.rs
+++ b/tests/ui/runtime/on-broken-pipe/no-flag-arg.rs
@@ -2,3 +2,5 @@
 //@ check-fail
 
 fn main() {}
+
+//~? ERROR unstable option `on-broken-pipe` requires either `kill`, `error`, or `inherit`
diff --git a/tests/ui/runtime/on-broken-pipe/wrong-flag-arg.rs b/tests/ui/runtime/on-broken-pipe/wrong-flag-arg.rs
index 14d0ac56b5a..c4a07932bc2 100644
--- a/tests/ui/runtime/on-broken-pipe/wrong-flag-arg.rs
+++ b/tests/ui/runtime/on-broken-pipe/wrong-flag-arg.rs
@@ -2,3 +2,5 @@
 //@ check-fail
 
 fn main() {}
+
+//~? ERROR incorrect value `wrong` for unstable option `on-broken-pipe`
diff --git a/tests/ui/runtime/signal-alternate-stack-cleanup.rs b/tests/ui/runtime/signal-alternate-stack-cleanup.rs
index 8fce0928273..f2af86be0a5 100644
--- a/tests/ui/runtime/signal-alternate-stack-cleanup.rs
+++ b/tests/ui/runtime/signal-alternate-stack-cleanup.rs
@@ -29,14 +29,7 @@ fn main() {
         // Install signal handler that runs on alternate signal stack.
         let mut action: sigaction = std::mem::zeroed();
         action.sa_flags = (SA_ONSTACK | SA_SIGINFO) as _;
-        #[cfg(not(target_os = "aix"))]
-        {
-            action.sa_sigaction = signal_handler as sighandler_t;
-        }
-        #[cfg(target_os = "aix")]
-        {
-            action.sa_union.__su_sigaction = signal_handler as sighandler_t;
-        }
+        action.sa_sigaction = signal_handler as sighandler_t;
         sigaction(SIGWINCH, &action, std::ptr::null_mut());
 
         // Send SIGWINCH on exit.
diff --git a/tests/ui/rust-2021/ice-return-unsized-can-impl-2.stderr b/tests/ui/rust-2021/ice-return-unsized-can-impl-2.stderr
index f2942820e28..75718c94b19 100644
--- a/tests/ui/rust-2021/ice-return-unsized-can-impl-2.stderr
+++ b/tests/ui/rust-2021/ice-return-unsized-can-impl-2.stderr
@@ -4,7 +4,7 @@ error[E0782]: expected a type, found a trait
 LL |     fn concrete(b: B) -> B;
    |                    ^
    |
-   = note: `B` it is dyn-incompatible, so it can't be `dyn`
+   = note: `B` is dyn-incompatible, otherwise a trait object could be used
 help: use a new generic type parameter, constrained by `B`
    |
 LL -     fn concrete(b: B) -> B;
@@ -32,7 +32,7 @@ error[E0782]: expected a type, found a trait
 LL |     fn f(a: A) -> A;
    |             ^
    |
-   = note: `A` it is dyn-incompatible, so it can't be `dyn`
+   = note: `A` is dyn-incompatible, otherwise a trait object could be used
 help: use a new generic type parameter, constrained by `A`
    |
 LL -     fn f(a: A) -> A;
diff --git a/tests/ui/rust-2021/ice-return-unsized-can-impl.stderr b/tests/ui/rust-2021/ice-return-unsized-can-impl.stderr
index cfee506e29b..284232cf4f4 100644
--- a/tests/ui/rust-2021/ice-return-unsized-can-impl.stderr
+++ b/tests/ui/rust-2021/ice-return-unsized-can-impl.stderr
@@ -4,7 +4,7 @@ error[E0782]: expected a type, found a trait
 LL |     fn g(new: B) -> B;
    |               ^
    |
-   = note: `B` it is dyn-incompatible, so it can't be `dyn`
+   = note: `B` is dyn-incompatible, otherwise a trait object could be used
 help: use a new generic type parameter, constrained by `B`
    |
 LL -     fn g(new: B) -> B;
diff --git a/tests/ui/rust-2021/ice-unsized-fn-params-2.stderr b/tests/ui/rust-2021/ice-unsized-fn-params-2.stderr
index 7f837bbe50f..630bbc2b905 100644
--- a/tests/ui/rust-2021/ice-unsized-fn-params-2.stderr
+++ b/tests/ui/rust-2021/ice-unsized-fn-params-2.stderr
@@ -4,7 +4,7 @@ error[E0782]: expected a type, found a trait
 LL | fn guard(_s: Copy) -> bool {
    |              ^^^^
    |
-   = note: `Copy` it is dyn-incompatible, so it can't be `dyn`
+   = note: `Copy` is dyn-incompatible, otherwise a trait object could be used
 help: use a new generic type parameter, constrained by `Copy`
    |
 LL - fn guard(_s: Copy) -> bool {
diff --git a/tests/ui/rust-2021/ice-unsized-fn-params.stderr b/tests/ui/rust-2021/ice-unsized-fn-params.stderr
index 4d900711ed6..57708031d6b 100644
--- a/tests/ui/rust-2021/ice-unsized-fn-params.stderr
+++ b/tests/ui/rust-2021/ice-unsized-fn-params.stderr
@@ -4,7 +4,7 @@ error[E0782]: expected a type, found a trait
 LL |     fn g(b: B) -> B;
    |             ^
    |
-   = note: `B` it is dyn-incompatible, so it can't be `dyn`
+   = note: `B` is dyn-incompatible, otherwise a trait object could be used
 help: use a new generic type parameter, constrained by `B`
    |
 LL -     fn g(b: B) -> B;
@@ -32,7 +32,7 @@ error[E0782]: expected a type, found a trait
 LL |     fn f(a: A) -> A;
    |             ^
    |
-   = note: `A` it is dyn-incompatible, so it can't be `dyn`
+   = note: `A` is dyn-incompatible, otherwise a trait object could be used
 help: use a new generic type parameter, constrained by `A`
    |
 LL -     fn f(a: A) -> A;
diff --git a/tests/ui/rustc-env/min-stack-banana.rs b/tests/ui/rustc-env/min-stack-banana.rs
index abbb6843710..dfde277714b 100644
--- a/tests/ui/rustc-env/min-stack-banana.rs
+++ b/tests/ui/rustc-env/min-stack-banana.rs
@@ -1,2 +1,5 @@
 //@ rustc-env:RUST_MIN_STACK=banana
+
 fn main() {}
+
+//~? ERROR `RUST_MIN_STACK` should be a number of bytes, but was "banana"
diff --git a/tests/ui/rustc-error.rs b/tests/ui/rustc-error.rs
deleted file mode 100644
index 69d57948fb5..00000000000
--- a/tests/ui/rustc-error.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-#![feature(rustc_attrs)]
-
-#[rustc_error]
-fn main() {
-    //~^ ERROR fatal error triggered by #[rustc_error]
-}
diff --git a/tests/ui/rustc-error.stderr b/tests/ui/rustc-error.stderr
deleted file mode 100644
index 67451195b64..00000000000
--- a/tests/ui/rustc-error.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: fatal error triggered by #[rustc_error]
-  --> $DIR/rustc-error.rs:4:1
-   |
-LL | fn main() {
-   | ^^^^^^^^^
-
-error: aborting due to 1 previous error
-
diff --git a/tests/ui/rustdoc/doc-alias-use-item-list-stem.rs b/tests/ui/rustdoc/doc-alias-use-item-list-stem.rs
new file mode 100644
index 00000000000..ef310843e21
--- /dev/null
+++ b/tests/ui/rustdoc/doc-alias-use-item-list-stem.rs
@@ -0,0 +1,11 @@
+// Check that we don't ICE on `#[doc(alias)]`es placed on use items with list stems.
+// issue: <https://github.com/rust-lang/rust/issues/138723>
+//@ check-pass
+
+#[doc(alias = "empty")]
+pub use {};
+
+#[doc(alias = "id")]
+pub use {std::convert::identity};
+
+fn main() {}
diff --git a/tests/ui/sanitizer/cfi/canonical-jump-tables-requires-cfi.rs b/tests/ui/sanitizer/cfi/canonical-jump-tables-requires-cfi.rs
index 10c5bf6ea5e..36f6e3bc95e 100644
--- a/tests/ui/sanitizer/cfi/canonical-jump-tables-requires-cfi.rs
+++ b/tests/ui/sanitizer/cfi/canonical-jump-tables-requires-cfi.rs
@@ -6,3 +6,5 @@
 #![feature(no_core)]
 #![no_core]
 #![no_main]
+
+//~? ERROR `-Zsanitizer-cfi-canonical-jump-tables` requires `-Zsanitizer=cfi`
diff --git a/tests/ui/sanitizer/cfi/generalize-pointers-requires-cfi.rs b/tests/ui/sanitizer/cfi/generalize-pointers-requires-cfi.rs
index 8ba13bd3639..83277da528c 100644
--- a/tests/ui/sanitizer/cfi/generalize-pointers-requires-cfi.rs
+++ b/tests/ui/sanitizer/cfi/generalize-pointers-requires-cfi.rs
@@ -7,3 +7,5 @@
 #![feature(no_core)]
 #![no_core]
 #![no_main]
+
+//~? ERROR `-Zsanitizer-cfi-generalize-pointers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi`
diff --git a/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.rs b/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.rs
index c628709d7a1..db8d1161644 100644
--- a/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.rs
+++ b/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.rs
@@ -10,3 +10,6 @@
 #![feature(no_core)]
 #![no_core]
 #![no_main]
+
+//~? ERROR cfi sanitizer is not supported for this target
+//~? ERROR `-Zsanitizer=cfi` is incompatible with `-Zsanitizer=kcfi`
diff --git a/tests/ui/sanitizer/cfi/normalize-integers-requires-cfi.rs b/tests/ui/sanitizer/cfi/normalize-integers-requires-cfi.rs
index a7ecefbf7ef..b9d5b9623d5 100644
--- a/tests/ui/sanitizer/cfi/normalize-integers-requires-cfi.rs
+++ b/tests/ui/sanitizer/cfi/normalize-integers-requires-cfi.rs
@@ -7,3 +7,5 @@
 #![feature(no_core)]
 #![no_core]
 #![no_main]
+
+//~? ERROR `-Zsanitizer-cfi-normalize-integers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi`
diff --git a/tests/ui/sanitizer/cfi/requires-lto.rs b/tests/ui/sanitizer/cfi/requires-lto.rs
index 5a34f696e05..db83f5f6bf0 100644
--- a/tests/ui/sanitizer/cfi/requires-lto.rs
+++ b/tests/ui/sanitizer/cfi/requires-lto.rs
@@ -6,3 +6,5 @@
 #![feature(no_core)]
 #![no_core]
 #![no_main]
+
+//~? ERROR `-Zsanitizer=cfi` requires `-Clto` or `-Clinker-plugin-lto`
diff --git a/tests/ui/sanitizer/cfi/with-rustc-lto-requires-single-codegen-unit.rs b/tests/ui/sanitizer/cfi/with-rustc-lto-requires-single-codegen-unit.rs
index 954e4ec3b85..4ef5b6756a4 100644
--- a/tests/ui/sanitizer/cfi/with-rustc-lto-requires-single-codegen-unit.rs
+++ b/tests/ui/sanitizer/cfi/with-rustc-lto-requires-single-codegen-unit.rs
@@ -6,3 +6,5 @@
 #![feature(no_core)]
 #![no_core]
 #![no_main]
+
+//~? ERROR `-Zsanitizer=cfi` with `-Clto` requires `-Ccodegen-units=1`
diff --git a/tests/ui/sanitizer/crt-static.rs b/tests/ui/sanitizer/crt-static.rs
index c24faeca3dc..b8bdf28351c 100644
--- a/tests/ui/sanitizer/crt-static.rs
+++ b/tests/ui/sanitizer/crt-static.rs
@@ -4,3 +4,5 @@
 #![feature(no_core)]
 #![no_core]
 #![no_main]
+
+//~? ERROR sanitizer is incompatible with statically linked libc
diff --git a/tests/ui/sanitizer/split-lto-unit-requires-lto.rs b/tests/ui/sanitizer/split-lto-unit-requires-lto.rs
index 35e610f0307..1d08ca7423f 100644
--- a/tests/ui/sanitizer/split-lto-unit-requires-lto.rs
+++ b/tests/ui/sanitizer/split-lto-unit-requires-lto.rs
@@ -6,3 +6,5 @@
 #![feature(no_core)]
 #![no_core]
 #![no_main]
+
+//~? ERROR `-Zsplit-lto-unit` requires `-Clto`, `-Clto=thin`, or `-Clinker-plugin-lto`
diff --git a/tests/ui/self/arbitrary-self-opaque.rs b/tests/ui/self/arbitrary-self-opaque.rs
index c26ef658b69..b176a982e5f 100644
--- a/tests/ui/self/arbitrary-self-opaque.rs
+++ b/tests/ui/self/arbitrary-self-opaque.rs
@@ -4,6 +4,7 @@ struct Foo;
 type Bar = impl Sized;
 
 impl Foo {
+    #[define_opaque(Bar)]
     fn foo(self: Bar) {}
     //~^ ERROR: invalid `self` parameter type: `Bar`
     //~| ERROR: item does not constrain
diff --git a/tests/ui/self/arbitrary-self-opaque.stderr b/tests/ui/self/arbitrary-self-opaque.stderr
index c75165d9f8e..36ae3d6fd02 100644
--- a/tests/ui/self/arbitrary-self-opaque.stderr
+++ b/tests/ui/self/arbitrary-self-opaque.stderr
@@ -1,5 +1,5 @@
 error[E0307]: invalid `self` parameter type: `Bar`
-  --> $DIR/arbitrary-self-opaque.rs:7:18
+  --> $DIR/arbitrary-self-opaque.rs:8:18
    |
 LL |     fn foo(self: Bar) {}
    |                  ^^^
@@ -7,14 +7,14 @@ LL |     fn foo(self: Bar) {}
    = note: type of `self` must be `Self` or a type that dereferences to it
    = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
 
-error: item does not constrain `Bar::{opaque#0}`, but has it in its signature
-  --> $DIR/arbitrary-self-opaque.rs:7:8
+error: item does not constrain `Bar::{opaque#0}`
+  --> $DIR/arbitrary-self-opaque.rs:8:8
    |
 LL |     fn foo(self: Bar) {}
    |        ^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
   --> $DIR/arbitrary-self-opaque.rs:4:12
    |
 LL | type Bar = impl Sized;
diff --git a/tests/ui/self/dyn-dispatch-requires-supertrait-norm.rs b/tests/ui/self/dyn-dispatch-requires-supertrait-norm.rs
new file mode 100644
index 00000000000..55c070eb036
--- /dev/null
+++ b/tests/ui/self/dyn-dispatch-requires-supertrait-norm.rs
@@ -0,0 +1,38 @@
+//@ check-pass
+
+#![feature(derive_coerce_pointee)]
+#![feature(arbitrary_self_types)]
+
+use std::ops::Deref;
+use std::marker::CoercePointee;
+use std::sync::Arc;
+
+trait MyTrait<T> {}
+
+#[derive(CoercePointee)]
+#[repr(transparent)]
+struct MyArc<T: ?Sized + MyTrait<u8>>(Arc<T>);
+
+impl<T: ?Sized + MyTrait<u8>> Deref for MyArc<T> {
+    type Target = T;
+    fn deref(&self) -> &T {
+        &self.0
+    }
+}
+
+trait Mirror {
+    type Assoc;
+}
+impl<T> Mirror for T {
+    type Assoc = T;
+}
+
+// This is variant on "tests/ui/self/dyn-dispatch-requires-supertrait.rs" but with
+// a supertrait that requires normalization to match the pred in the old solver.
+trait MyOtherTrait: MyTrait<<u8 as Mirror>::Assoc> {
+    fn foo(self: MyArc<Self>);
+}
+
+fn test(_: MyArc<dyn MyOtherTrait>) {}
+
+fn main() {}
diff --git a/tests/ui/self/dyn-dispatch-requires-supertrait.rs b/tests/ui/self/dyn-dispatch-requires-supertrait.rs
new file mode 100644
index 00000000000..f2661c406fe
--- /dev/null
+++ b/tests/ui/self/dyn-dispatch-requires-supertrait.rs
@@ -0,0 +1,38 @@
+//@ check-pass
+
+#![feature(derive_coerce_pointee)]
+#![feature(arbitrary_self_types)]
+
+use std::ops::Deref;
+use std::marker::CoercePointee;
+use std::sync::Arc;
+
+trait MyTrait {}
+
+#[derive(CoercePointee)]
+#[repr(transparent)]
+struct MyArc<T>
+where
+    T: MyTrait + ?Sized,
+{
+    inner: Arc<T>
+}
+
+impl<T: MyTrait + ?Sized> Deref for MyArc<T> {
+    type Target = T;
+    fn deref(&self) -> &T {
+        &self.inner
+    }
+}
+
+// Proving that `MyArc<Self>` is dyn-dispatchable requires proving `MyArc<T>` implements
+// `DispatchFromDyn<MyArc<U>>`. The `DispatchFromDyn` impl that is generated from the
+// `CoercePointee` implementation requires the pointee impls `MyTrait`, but previously we
+// were only assuming the pointee impl'd `MyOtherTrait`. Elaboration comes to the rescue here.
+trait MyOtherTrait: MyTrait {
+    fn foo(self: MyArc<Self>);
+}
+
+fn test(_: MyArc<dyn MyOtherTrait>) {}
+
+fn main() {}
diff --git a/tests/ui/simd/array-trait.stderr b/tests/ui/simd/array-trait.stderr
index 2d2a11f25ad..299f0ad96ae 100644
--- a/tests/ui/simd/array-trait.stderr
+++ b/tests/ui/simd/array-trait.stderr
@@ -22,8 +22,6 @@ LL | #[derive(Copy, Clone)]
    |                ----- in this derive macro expansion
 LL | pub struct T<S: Simd>([S::Lane; S::SIZE]);
    |                       ^^^^^^^^^^^^^^^^^^
-   |
-   = 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
 
diff --git a/tests/ui/simd/const-err-trumps-simd-err.stderr b/tests/ui/simd/const-err-trumps-simd-err.stderr
index e88c277885e..a0f1c664a4f 100644
--- a/tests/ui/simd/const-err-trumps-simd-err.stderr
+++ b/tests/ui/simd/const-err-trumps-simd-err.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of `get_elem::<4>::{constant#0}` failed
    |
 LL |     const { assert!(LANE < 4); } // the error should be here...
    |             ^^^^^^^^^^^^^^^^^ evaluation panicked: assertion failed: LANE < 4
-   |
-   = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
   --> $DIR/const-err-trumps-simd-err.rs:16:5
diff --git a/tests/ui/sized/dont-incompletely-prefer-built-in.rs b/tests/ui/sized/dont-incompletely-prefer-built-in.rs
new file mode 100644
index 00000000000..f5bf0c8915e
--- /dev/null
+++ b/tests/ui/sized/dont-incompletely-prefer-built-in.rs
@@ -0,0 +1,21 @@
+//@ check-pass
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
+
+struct W<T: ?Sized>(T);
+
+fn is_sized<T: Sized>(x: *const T) {}
+
+fn dummy<T: ?Sized>() -> *const T { todo!() }
+
+fn non_param_where_bound<T: ?Sized>()
+where
+    W<T>: Sized,
+{
+    let x: *const W<_> = dummy();
+    is_sized::<W<_>>(x);
+    let _: *const W<T> = x;
+}
+
+fn main() {}
diff --git a/tests/ui/span/E0204.stderr b/tests/ui/span/E0204.stderr
index 3a0afb541ba..fe375b94781 100644
--- a/tests/ui/span/E0204.stderr
+++ b/tests/ui/span/E0204.stderr
@@ -15,8 +15,6 @@ LL | #[derive(Copy)]
 LL | struct Foo2<'a> {
 LL |     ty: &'a mut bool,
    |     ---------------- this field does not implement `Copy`
-   |
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0204]: the trait `Copy` cannot be implemented for this type
   --> $DIR/E0204.rs:17:15
@@ -35,8 +33,6 @@ LL | #[derive(Copy)]
 LL | enum EFoo2<'a> {
 LL |     Bar(&'a mut bool),
    |         ------------ this field does not implement `Copy`
-   |
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/span/range-2.rs b/tests/ui/span/range-2.rs
index c4bb16f44bd..2e8252169b7 100644
--- a/tests/ui/span/range-2.rs
+++ b/tests/ui/span/range-2.rs
@@ -1,6 +1,6 @@
 // Test range syntax - borrow errors.
-#![feature(rustc_attrs)]
-pub fn main() { #![rustc_error] // rust-lang/rust#49855
+
+pub fn main() {
     let r = {
         let a = 42;
         let b = 42;
diff --git a/tests/ui/span/regionck-unboxed-closure-lifetimes.rs b/tests/ui/span/regionck-unboxed-closure-lifetimes.rs
index 60ccaa872e7..fe6c353e8f8 100644
--- a/tests/ui/span/regionck-unboxed-closure-lifetimes.rs
+++ b/tests/ui/span/regionck-unboxed-closure-lifetimes.rs
@@ -1,7 +1,6 @@
-#![feature(rustc_attrs)]
 use std::ops::FnMut;
 
-fn main() { #![rustc_error] // rust-lang/rust#49855
+fn main() {
     let mut f;
     {
         let c = 1;
diff --git a/tests/ui/span/regionck-unboxed-closure-lifetimes.stderr b/tests/ui/span/regionck-unboxed-closure-lifetimes.stderr
index 225f83b6e66..bb6298211bc 100644
--- a/tests/ui/span/regionck-unboxed-closure-lifetimes.stderr
+++ b/tests/ui/span/regionck-unboxed-closure-lifetimes.stderr
@@ -1,5 +1,5 @@
 error[E0597]: `c` does not live long enough
-  --> $DIR/regionck-unboxed-closure-lifetimes.rs:8:21
+  --> $DIR/regionck-unboxed-closure-lifetimes.rs:7:21
    |
 LL |         let c = 1;
    |             - binding `c` declared here
diff --git a/tests/ui/specialization/min_specialization/impl-on-opaque.rs b/tests/ui/specialization/min_specialization/impl-on-opaque.rs
index 7531dcaccf2..131ad8b9d65 100644
--- a/tests/ui/specialization/min_specialization/impl-on-opaque.rs
+++ b/tests/ui/specialization/min_specialization/impl-on-opaque.rs
@@ -26,6 +26,7 @@ impl SpecTrait<u32> for () {
     fn f() {}
 }
 
+#[define_opaque(Opaque)]
 fn foo() -> Opaque {}
 
 fn main() {}
diff --git a/tests/ui/specialization/min_specialization/impl-on-opaque2.rs b/tests/ui/specialization/min_specialization/impl-on-opaque2.rs
index 0cd8be84ed3..bcdb54c2b4f 100644
--- a/tests/ui/specialization/min_specialization/impl-on-opaque2.rs
+++ b/tests/ui/specialization/min_specialization/impl-on-opaque2.rs
@@ -23,6 +23,7 @@ impl SpecTrait<(), Opaque> for () {
     fn f() {}
 }
 
+#[define_opaque(Opaque)]
 fn foo() -> Opaque {}
 
 fn main() {}
diff --git a/tests/ui/stability-attribute/check-stability-issue-138319.rs b/tests/ui/stability-attribute/check-stability-issue-138319.rs
new file mode 100644
index 00000000000..5440e0cad94
--- /dev/null
+++ b/tests/ui/stability-attribute/check-stability-issue-138319.rs
@@ -0,0 +1,39 @@
+//@ check-pass
+fn _foo() {
+    _Bar { //~ WARNING use of deprecated struct `_Bar`: reason
+        #[expect(deprecated)]
+        foo: 0,
+    };
+}
+
+#[deprecated = "reason"]
+struct _Bar {
+    foo: u32,
+}
+
+fn _foo2() {
+    #[expect(deprecated)]
+    _Bar2 {
+        foo2: 0,
+    };
+}
+
+#[deprecated = "reason"]
+struct _Bar2 {
+    foo2: u32,
+}
+
+fn _foo3() {
+    _Bar3 {
+        #[expect(deprecated)]
+        foo3: 0,
+    };
+}
+
+struct _Bar3 {
+    #[deprecated = "reason"]
+    foo3: u32,
+}
+
+
+fn main() {}
diff --git a/tests/ui/stability-attribute/check-stability-issue-138319.stderr b/tests/ui/stability-attribute/check-stability-issue-138319.stderr
new file mode 100644
index 00000000000..4a2c3554a1e
--- /dev/null
+++ b/tests/ui/stability-attribute/check-stability-issue-138319.stderr
@@ -0,0 +1,10 @@
+warning: use of deprecated struct `_Bar`: reason
+  --> $DIR/check-stability-issue-138319.rs:3:5
+   |
+LL |     _Bar {
+   |     ^^^^
+   |
+   = note: `#[warn(deprecated)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/stable-mir-print/async-closure.stdout b/tests/ui/stable-mir-print/async-closure.stdout
index 21df1fd3954..12e7a5530ac 100644
--- a/tests/ui/stable-mir-print/async-closure.stdout
+++ b/tests/ui/stable-mir-print/async-closure.stdout
@@ -56,7 +56,7 @@ fn foo::{closure#0}::{closure#0}(_1: Pin<&mut {async closure body@$DIR/async-clo
         unreachable;
     }
 }
-fn foo::{closure#0}::{closure#1}(_1: Pin<&mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}>, _2: &mut Context<'_>) -> Poll<()> {
+fn foo::{closure#0}::{synthetic#0}(_1: Pin<&mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}>, _2: &mut Context<'_>) -> Poll<()> {
     let mut _0: Poll<()>;
     let  _3: i32;
     let mut _4: &i32;
diff --git a/tests/ui/stack-protector/warn-stack-protector-unsupported.rs b/tests/ui/stack-protector/warn-stack-protector-unsupported.rs
index 9205d4052ad..dc61e35a089 100644
--- a/tests/ui/stack-protector/warn-stack-protector-unsupported.rs
+++ b/tests/ui/stack-protector/warn-stack-protector-unsupported.rs
@@ -17,3 +17,7 @@ trait Sized {}
 trait Copy {}
 
 pub fn main(){}
+
+//[all]~? WARN `-Z stack-protector=all` is not supported for target nvptx64-nvidia-cuda and will be ignored
+//[strong]~? WARN `-Z stack-protector=strong` is not supported for target nvptx64-nvidia-cuda and will be ignored
+//[basic]~? WARN `-Z stack-protector=basic` is not supported for target nvptx64-nvidia-cuda and will be ignored
diff --git a/tests/ui/statics/issue-14227.stderr b/tests/ui/statics/issue-14227.stderr
index 0aeb973bff3..3551821a3da 100644
--- a/tests/ui/statics/issue-14227.stderr
+++ b/tests/ui/statics/issue-14227.stderr
@@ -2,7 +2,7 @@ error[E0080]: could not evaluate static initializer
   --> $DIR/issue-14227.rs:4:21
    |
 LL | static CRASH: u32 = symbol;
-   |                     ^^^^^^ cannot access extern static (DefId(0:4 ~ issue_14227[1133]::{extern#0}::symbol))
+   |                     ^^^^^^ cannot access extern static `symbol`
 
 error[E0133]: use of extern static is unsafe and requires unsafe function or block
   --> $DIR/issue-14227.rs:4:21
diff --git a/tests/ui/stats/input-stats.stderr b/tests/ui/stats/input-stats.stderr
index dbc9e7d254c..191daff2137 100644
--- a/tests/ui/stats/input-stats.stderr
+++ b/tests/ui/stats/input-stats.stderr
@@ -119,7 +119,7 @@ hir-stats HIR STATS
 hir-stats Name                Accumulated Size         Count     Item Size
 hir-stats ----------------------------------------------------------------
 hir-stats ForeignItemRef            24 ( 0.3%)             1            24
-hir-stats Lifetime                  24 ( 0.3%)             1            24
+hir-stats Lifetime                  28 ( 0.3%)             1            28
 hir-stats Mod                       32 ( 0.4%)             1            32
 hir-stats ExprField                 40 ( 0.4%)             1            40
 hir-stats TraitItemRef              56 ( 0.6%)             2            28
@@ -155,7 +155,7 @@ hir-stats Generics                 560 ( 6.2%)            10            56
 hir-stats Ty                       720 ( 8.0%)            15            48
 hir-stats - Ptr                       48 ( 0.5%)             1
 hir-stats - Ref                       48 ( 0.5%)             1
-hir-stats - Path                     624 ( 7.0%)            13
+hir-stats - Path                     624 ( 6.9%)            13
 hir-stats Expr                     768 ( 8.6%)            12            64
 hir-stats - InlineAsm                 64 ( 0.7%)             1
 hir-stats - Match                     64 ( 0.7%)             1
@@ -174,5 +174,5 @@ hir-stats - Use                      352 ( 3.9%)             4
 hir-stats Path                   1_240 (13.8%)            31            40
 hir-stats PathSegment            1_920 (21.4%)            40            48
 hir-stats ----------------------------------------------------------------
-hir-stats Total                  8_976                   180
+hir-stats Total                  8_980                   180
 hir-stats
diff --git a/tests/ui/std/channel-stack-overflow-issue-102246.rs b/tests/ui/std/channel-stack-overflow-issue-102246.rs
index 984ebdd553f..7bf6647bdc5 100644
--- a/tests/ui/std/channel-stack-overflow-issue-102246.rs
+++ b/tests/ui/std/channel-stack-overflow-issue-102246.rs
@@ -10,9 +10,16 @@
 // Ref: https://github.com/rust-lang/rust/issues/102246
 
 use std::sync::mpsc::channel;
-use std::thread;
+use std::thread::Builder;
 
 const N: usize = 32_768;
+const SLOTS: usize = 32;
+// Use a stack size that's smaller than N * SLOTS, proving the allocation is on the heap.
+//
+// The test explicitly specifies the stack size, because not all platforms have the same default
+// size.
+const STACK_SIZE: usize = (N*SLOTS) - 1;
+
 struct BigStruct {
     _data: [u8; N],
 }
@@ -20,10 +27,13 @@ struct BigStruct {
 fn main() {
     let (sender, receiver) = channel::<BigStruct>();
 
-    let thread1 = thread::spawn(move || {
+    let thread1 = Builder::new().stack_size(STACK_SIZE).spawn(move || {
         sender.send(BigStruct { _data: [0u8; N] }).unwrap();
-    });
-
+    }).expect("thread1 should spawn successfully");
     thread1.join().unwrap();
-    for _data in receiver.try_iter() {}
+
+    let thread2 = Builder::new().stack_size(STACK_SIZE).spawn(move || {
+        for _data in receiver.try_iter() {}
+    }).expect("thread2 should spawn successfully");
+    thread2.join().unwrap();
 }
diff --git a/tests/ui/structs/default-field-values/failures.stderr b/tests/ui/structs/default-field-values/failures.stderr
index 50553816462..58f7baee4b2 100644
--- a/tests/ui/structs/default-field-values/failures.stderr
+++ b/tests/ui/structs/default-field-values/failures.stderr
@@ -21,7 +21,6 @@ LL | pub struct Bar {
 LL |     pub bar: S,
    |     ^^^^^^^^^^ the trait `Default` is not implemented for `S`
    |
-   = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `S` with `#[derive(Default)]`
    |
 LL + #[derive(Default)]
diff --git a/tests/ui/structs/default-field-values/invalid-const.stderr b/tests/ui/structs/default-field-values/invalid-const.stderr
index 56d20d8d711..030bdbfcc3e 100644
--- a/tests/ui/structs/default-field-values/invalid-const.stderr
+++ b/tests/ui/structs/default-field-values/invalid-const.stderr
@@ -3,8 +3,6 @@ error[E0080]: evaluation of constant value failed
    |
 LL |     pub bax: u8 = panic!("asdf"),
    |                   ^^^^^^^^^^^^^^ evaluation panicked: asdf
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of `Baz::<C>::bat::{constant#0}` failed
   --> $DIR/invalid-const.rs:11:19
diff --git a/tests/ui/structs/struct-construct-with-call-issue-138931.rs b/tests/ui/structs/struct-construct-with-call-issue-138931.rs
new file mode 100644
index 00000000000..5d50eb14bff
--- /dev/null
+++ b/tests/ui/structs/struct-construct-with-call-issue-138931.rs
@@ -0,0 +1,25 @@
+struct PersonOnlyName {
+    name: String
+}
+
+struct PersonWithAge {
+    name: String,
+    age: u8,
+    height: u8,
+}
+
+
+
+fn main() {
+    let wilfred = PersonOnlyName("Name1".to_owned());
+    //~^ ERROR expected function, tuple struct or tuple variant, found struct `PersonOnlyName` [E0423]
+
+    let bill = PersonWithAge( //~ ERROR expected function, tuple struct or tuple variant, found struct `PersonWithAge` [E0423]
+        "Name2".to_owned(),
+        20,
+        180,
+    );
+
+    let person = PersonWithAge("Name3".to_owned());
+    //~^ ERROR expected function, tuple struct or tuple variant, found struct `PersonWithAge` [E0423]
+}
diff --git a/tests/ui/structs/struct-construct-with-call-issue-138931.stderr b/tests/ui/structs/struct-construct-with-call-issue-138931.stderr
new file mode 100644
index 00000000000..acae01df563
--- /dev/null
+++ b/tests/ui/structs/struct-construct-with-call-issue-138931.stderr
@@ -0,0 +1,58 @@
+error[E0423]: expected function, tuple struct or tuple variant, found struct `PersonOnlyName`
+  --> $DIR/struct-construct-with-call-issue-138931.rs:14:19
+   |
+LL | / struct PersonOnlyName {
+LL | |     name: String
+LL | | }
+   | |_- `PersonOnlyName` defined here
+...
+LL |       let wilfred = PersonOnlyName("Name1".to_owned());
+   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: use struct literal syntax instead of calling
+   |
+LL -     let wilfred = PersonOnlyName("Name1".to_owned());
+LL +     let wilfred = PersonOnlyName{name: "Name1".to_owned()};
+   |
+
+error[E0423]: expected function, tuple struct or tuple variant, found struct `PersonWithAge`
+  --> $DIR/struct-construct-with-call-issue-138931.rs:17:16
+   |
+LL | / struct PersonWithAge {
+LL | |     name: String,
+LL | |     age: u8,
+LL | |     height: u8,
+LL | | }
+   | |_- `PersonWithAge` defined here
+...
+LL |       let bill = PersonWithAge(
+   |  ________________^
+LL | |         "Name2".to_owned(),
+LL | |         20,
+LL | |         180,
+LL | |     );
+   | |_____^
+   |
+help: use struct literal syntax instead of calling
+   |
+LL ~     let bill = PersonWithAge{name: "Name2".to_owned(),
+LL ~         age: 20,
+LL ~         height: 180};
+   |
+
+error[E0423]: expected function, tuple struct or tuple variant, found struct `PersonWithAge`
+  --> $DIR/struct-construct-with-call-issue-138931.rs:23:18
+   |
+LL | / struct PersonWithAge {
+LL | |     name: String,
+LL | |     age: u8,
+LL | |     height: u8,
+LL | | }
+   | |_- `PersonWithAge` defined here
+...
+LL |       let person = PersonWithAge("Name3".to_owned());
+   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `PersonWithAge { name: val, age: val, height: val }`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0423`.
diff --git a/tests/ui/suggestions/attribute-typos.rs b/tests/ui/suggestions/attribute-typos.rs
index 7c8231bbb24..4c2336e105e 100644
--- a/tests/ui/suggestions/attribute-typos.rs
+++ b/tests/ui/suggestions/attribute-typos.rs
@@ -4,8 +4,8 @@ fn foo() {}
 #[tests] //~ ERROR cannot find attribute `tests` in this scope
 fn bar() {}
 
-#[rustc_err]
-//~^ ERROR cannot find attribute `rustc_err` in this scope
+#[rustc_dumm]
+//~^ ERROR cannot find attribute `rustc_dumm` in this scope
 //~| ERROR attributes starting with `rustc` are reserved for use by the `rustc` compiler
 
 fn main() {}
diff --git a/tests/ui/suggestions/attribute-typos.stderr b/tests/ui/suggestions/attribute-typos.stderr
index b871c9b45a5..a1a01c0abd6 100644
--- a/tests/ui/suggestions/attribute-typos.stderr
+++ b/tests/ui/suggestions/attribute-typos.stderr
@@ -1,14 +1,14 @@
 error: attributes starting with `rustc` are reserved for use by the `rustc` compiler
   --> $DIR/attribute-typos.rs:7:3
    |
-LL | #[rustc_err]
-   |   ^^^^^^^^^
+LL | #[rustc_dumm]
+   |   ^^^^^^^^^^
 
-error: cannot find attribute `rustc_err` in this scope
+error: cannot find attribute `rustc_dumm` in this scope
   --> $DIR/attribute-typos.rs:7:3
    |
-LL | #[rustc_err]
-   |   ^^^^^^^^^ help: a built-in attribute with a similar name exists: `rustc_error`
+LL | #[rustc_dumm]
+   |   ^^^^^^^^^^ help: a built-in attribute with a similar name exists: `rustc_dummy`
 
 error: cannot find attribute `tests` in this scope
   --> $DIR/attribute-typos.rs:4:3
diff --git a/tests/ui/suggestions/derive-clone-for-eq.stderr b/tests/ui/suggestions/derive-clone-for-eq.stderr
index eae0b0ae817..eb0355853da 100644
--- a/tests/ui/suggestions/derive-clone-for-eq.stderr
+++ b/tests/ui/suggestions/derive-clone-for-eq.stderr
@@ -13,7 +13,6 @@ LL | impl<T: Clone, U> PartialEq<U> for Struct<T>
    |         unsatisfied trait bound introduced here
 note: required by a bound in `Eq`
   --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider restricting type parameter `T` with trait `Clone`
    |
 LL | pub struct Struct<T: std::clone::Clone>(T);
diff --git a/tests/ui/suggestions/derive-macro-missing-bounds.stderr b/tests/ui/suggestions/derive-macro-missing-bounds.stderr
index 37a5f4932ff..68c8204d1e1 100644
--- a/tests/ui/suggestions/derive-macro-missing-bounds.stderr
+++ b/tests/ui/suggestions/derive-macro-missing-bounds.stderr
@@ -8,7 +8,6 @@ LL |     struct Outer<T>(Inner<T>);
    |
    = help: the trait `Debug` is not implemented for `a::Inner<T>`
    = note: add `#[derive(Debug)]` to `a::Inner<T>` or manually `impl Debug for a::Inner<T>`
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `a::Inner<T>` with `#[derive(Debug)]`
    |
 LL +     #[derive(Debug)]
@@ -37,7 +36,6 @@ LL |     impl<T: Debug + Trait> Debug for Inner<T> {
    = note: 1 redundant requirement hidden
    = note: required for `&c::Inner<T>` to implement `Debug`
    = note: required for the cast from `&&c::Inner<T>` to `&dyn Debug`
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider restricting type parameter `T` with trait `Trait`
    |
 LL |     struct Outer<T: c::Trait>(Inner<T>);
@@ -59,7 +57,6 @@ LL |     impl<T> Debug for Inner<T> where T: Debug, T: Trait {
    = note: 1 redundant requirement hidden
    = note: required for `&d::Inner<T>` to implement `Debug`
    = note: required for the cast from `&&d::Inner<T>` to `&dyn Debug`
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider restricting type parameter `T` with trait `Trait`
    |
 LL |     struct Outer<T: d::Trait>(Inner<T>);
@@ -81,7 +78,6 @@ LL |     impl<T> Debug for Inner<T> where T: Debug + Trait {
    = note: 1 redundant requirement hidden
    = note: required for `&e::Inner<T>` to implement `Debug`
    = note: required for the cast from `&&e::Inner<T>` to `&dyn Debug`
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider restricting type parameter `T` with trait `Trait`
    |
 LL |     struct Outer<T: e::Trait>(Inner<T>);
@@ -103,7 +99,6 @@ LL |     impl<T: Debug> Debug for Inner<T> where T: Trait {
    = note: 1 redundant requirement hidden
    = note: required for `&f::Inner<T>` to implement `Debug`
    = note: required for the cast from `&&f::Inner<T>` to `&dyn Debug`
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider restricting type parameter `T` with trait `Trait`
    |
 LL |     struct Outer<T: f::Trait>(Inner<T>);
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 20aa227d10f..7b0fd979991 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
@@ -4,7 +4,7 @@ error[E0782]: expected a type, found a trait
 LL |     fn f(a: A) -> A;
    |             ^
    |
-   = note: `A` it is dyn-incompatible, so it can't be `dyn`
+   = note: `A` is dyn-incompatible, otherwise a trait object could be used
 help: use a new generic type parameter, constrained by `A`
    |
 LL -     fn f(a: A) -> A;
@@ -32,7 +32,7 @@ error[E0782]: expected a type, found a trait
 LL |     fn f(b: B) -> B;
    |             ^
    |
-   = note: `B` it is dyn-incompatible, so it can't be `dyn`
+   = note: `B` is dyn-incompatible, otherwise a trait object could be used
 help: use a new generic type parameter, constrained by `B`
    |
 LL -     fn f(b: B) -> B;
@@ -60,7 +60,7 @@ error[E0782]: expected a type, found a trait
 LL |     fn f(&self, c: C) -> C;
    |                    ^
    |
-   = note: `C` it is dyn-incompatible, so it can't be `dyn`
+   = note: `C` is dyn-incompatible, otherwise a trait object could be used
 help: use a new generic type parameter, constrained by `C`
    |
 LL -     fn f(&self, c: C) -> C;
diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr
index 4408fe0a0a4..a48dd30d008 100644
--- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr
+++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr
@@ -31,7 +31,6 @@ LL | #[derive(Debug, Copy, Clone)]
 LL | pub struct Vector2<T: Debug + Copy + Clone> {
    |                               ---- unsatisfied trait bound introduced in this `derive` macro
    = note: required for the cast from `&Vector2<K>` to `&dyn Debug`
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider further restricting type parameter `K` with trait `Copy`
    |
 LL | pub struct AABB<K: Debug + std::marker::Copy> {
@@ -51,7 +50,6 @@ note: required by a bound in `Vector2`
    |
 LL | pub struct Vector2<T: Debug + Copy + Clone> {
    |                               ^^^^ required by this bound in `Vector2`
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider further restricting type parameter `K` with trait `Copy`
    |
 LL | pub struct AABB<K: Debug + std::marker::Copy> {
@@ -73,7 +71,6 @@ LL | #[derive(Debug, Copy, Clone)]
    |                       ^^^^^
 LL | pub struct Vector2<T: Debug + Copy + Clone> {
    |                               ---- unsatisfied trait bound introduced in this `derive` macro
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider further restricting type parameter `K` with trait `Copy`
    |
 LL | pub struct AABB<K: Debug + std::marker::Copy> {
diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr
index 1bbf6f66ab2..3f8b6f93e1f 100644
--- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr
+++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr
@@ -12,7 +12,6 @@ note: the `Copy` impl for `Vector2<K>` requires that `K: Debug`
    |
 LL |     pub loc: Vector2<K>,
    |              ^^^^^^^^^^
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider further restricting type parameter `K` with trait `Debug`
    |
 LL | pub struct AABB<K: Copy + Debug>{
@@ -43,7 +42,6 @@ LL | pub struct AABB<K: Copy>{
 LL |     pub loc: Vector2<K>,
    |     ^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug`
    |
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider further restricting type parameter `K` with trait `Debug`
    |
 LL | pub struct AABB<K: Copy + std::fmt::Debug>{
@@ -58,7 +56,6 @@ LL | #[derive(Debug, Copy, Clone)]
 LL |     pub size: Vector2<K>
    |     ^^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug`
    |
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider further restricting type parameter `K` with trait `Debug`
    |
 LL | pub struct AABB<K: Copy + std::fmt::Debug>{
diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr b/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr
index 8b5cced4c4a..3766e3e2c7b 100644
--- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr
+++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr
@@ -12,7 +12,6 @@ note: the `Copy` impl for `Vector2<K>` requires that `K: Debug`
    |
 LL |     pub loc: Vector2<K>,
    |              ^^^^^^^^^^
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider restricting type parameter `K` with trait `Debug`
    |
 LL | pub struct AABB<K: Debug> {
@@ -67,7 +66,6 @@ LL | #[derive(Debug, Copy, Clone)]
 LL | pub struct Vector2<T: Debug + Copy + Clone> {
    |                               ---- unsatisfied trait bound introduced in this `derive` macro
    = note: required for the cast from `&Vector2<K>` to `&dyn Debug`
-   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider restricting type parameter `K` with trait `Copy`
    |
 LL | pub struct AABB<K: std::marker::Copy> {
@@ -82,7 +80,6 @@ LL | pub struct AABB<K> {
 LL |     pub loc: Vector2<K>,
    |     ^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug`
    |
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider restricting type parameter `K` with trait `Debug`
    |
 LL | pub struct AABB<K: std::fmt::Debug> {
@@ -102,7 +99,6 @@ note: required by a bound in `Vector2`
    |
 LL | pub struct Vector2<T: Debug + Copy + Clone> {
    |                               ^^^^ required by this bound in `Vector2`
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider restricting type parameter `K` with trait `Copy`
    |
 LL | pub struct AABB<K: std::marker::Copy> {
@@ -117,7 +113,6 @@ LL | #[derive(Debug, Copy, Clone)]
 LL |     pub size: Vector2<K>,
    |     ^^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug`
    |
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider restricting type parameter `K` with trait `Debug`
    |
 LL | pub struct AABB<K: std::fmt::Debug> {
@@ -139,7 +134,6 @@ LL | #[derive(Debug, Copy, Clone)]
    |                       ^^^^^
 LL | pub struct Vector2<T: Debug + Copy + Clone> {
    |                               ---- unsatisfied trait bound introduced in this `derive` macro
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider restricting type parameter `K` with trait `Copy`
    |
 LL | pub struct AABB<K: std::marker::Copy> {
diff --git a/tests/ui/suggestions/tuple-struct-where-clause-suggestion-91520.rs b/tests/ui/suggestions/tuple-struct-where-clause-suggestion-91520.rs
new file mode 100644
index 00000000000..b7086325d5f
--- /dev/null
+++ b/tests/ui/suggestions/tuple-struct-where-clause-suggestion-91520.rs
@@ -0,0 +1,17 @@
+// Verify that the `where` clause suggestion is in the correct place
+// Previously, the suggestion to add `where` clause was placed inside the derive
+// like `#[derive(Clone where Inner<T>: Clone)]`
+// instead of `struct Outer<T>(Inner<T>) where Inner<T>: Clone`
+
+#![crate_type = "lib"]
+
+struct Inner<T>(T);
+//~^ HELP consider annotating `Inner<T>` with `#[derive(Clone)]`
+impl Clone for Inner<()> {
+    fn clone(&self) -> Self { todo!() }
+}
+
+#[derive(Clone)]
+struct Outer<T>(Inner<T>);
+//~^ ERROR the trait bound `Inner<T>: Clone` is not satisfied [E0277]
+//~| HELP consider introducing a `where` clause
diff --git a/tests/ui/suggestions/tuple-struct-where-clause-suggestion-91520.stderr b/tests/ui/suggestions/tuple-struct-where-clause-suggestion-91520.stderr
new file mode 100644
index 00000000000..577b090ce1b
--- /dev/null
+++ b/tests/ui/suggestions/tuple-struct-where-clause-suggestion-91520.stderr
@@ -0,0 +1,21 @@
+error[E0277]: the trait bound `Inner<T>: Clone` is not satisfied
+  --> $DIR/tuple-struct-where-clause-suggestion-91520.rs:15:17
+   |
+LL | #[derive(Clone)]
+   |          ----- in this derive macro expansion
+LL | struct Outer<T>(Inner<T>);
+   |                 ^^^^^^^^ the trait `Clone` is not implemented for `Inner<T>`
+   |
+help: consider annotating `Inner<T>` with `#[derive(Clone)]`
+   |
+LL + #[derive(Clone)]
+LL | struct Inner<T>(T);
+   |
+help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
+   |
+LL | struct Outer<T>(Inner<T>) where Inner<T>: Clone;
+   |                           +++++++++++++++++++++
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/symbol-mangling-version/bad-value.rs b/tests/ui/symbol-mangling-version/bad-value.rs
index f6fa5c85f33..b0875f3a23c 100644
--- a/tests/ui/symbol-mangling-version/bad-value.rs
+++ b/tests/ui/symbol-mangling-version/bad-value.rs
@@ -4,3 +4,7 @@
 //@ [bad] compile-flags: -Csymbol-mangling-version=bad-value
 
 fn main() {}
+
+//[no-value]~? ERROR codegen option `symbol-mangling-version` requires one of
+//[blank]~? ERROR incorrect value `` for codegen option `symbol-mangling-version`
+//[bad]~? ERROR incorrect value `bad-value` for codegen option `symbol-mangling-version`
diff --git a/tests/ui/symbol-mangling-version/unstable.rs b/tests/ui/symbol-mangling-version/unstable.rs
index d5af8542996..d79320ccccd 100644
--- a/tests/ui/symbol-mangling-version/unstable.rs
+++ b/tests/ui/symbol-mangling-version/unstable.rs
@@ -7,3 +7,6 @@
 //@ [hashed-ok] compile-flags: -Zunstable-options -Csymbol-mangling-version=hashed
 
 fn main() {}
+
+//[legacy]~? ERROR `-C symbol-mangling-version=legacy` requires `-Z unstable-options`
+//[hashed]~? ERROR `-C symbol-mangling-version=hashed` requires `-Z unstable-options`
diff --git a/tests/ui/target-feature/allowed-softfloat-target-feature-flag-disable.rs b/tests/ui/target-feature/allowed-softfloat-target-feature-flag-disable.rs
index e34faf5a983..7368ef120fa 100644
--- a/tests/ui/target-feature/allowed-softfloat-target-feature-flag-disable.rs
+++ b/tests/ui/target-feature/allowed-softfloat-target-feature-flag-disable.rs
@@ -7,3 +7,5 @@
 
 #[lang = "sized"]
 pub trait Sized {}
+
+//~? WARN unstable feature specified for `-Ctarget-feature`: `x87`
diff --git a/tests/ui/target-feature/invalid-attribute.stderr b/tests/ui/target-feature/invalid-attribute.stderr
index dc8a5304164..05ae49d6b0d 100644
--- a/tests/ui/target-feature/invalid-attribute.stderr
+++ b/tests/ui/target-feature/invalid-attribute.stderr
@@ -98,6 +98,12 @@ LL |
 LL | trait Baz {}
    | ------------ not a function definition
 
+error: cannot use `#[inline(always)]` with `#[target_feature]`
+  --> $DIR/invalid-attribute.rs:69:1
+   |
+LL | #[inline(always)]
+   | ^^^^^^^^^^^^^^^^^
+
 error: attribute should be applied to a function definition
   --> $DIR/invalid-attribute.rs:74:1
    |
@@ -163,12 +169,6 @@ error: malformed `target_feature` attribute input
 LL | #[target_feature(disable = "baz")]
    |                  ^^^^^^^^^^^^^^^ help: must be of the form: `enable = ".."`
 
-error: cannot use `#[inline(always)]` with `#[target_feature]`
-  --> $DIR/invalid-attribute.rs:69:1
-   |
-LL | #[inline(always)]
-   | ^^^^^^^^^^^^^^^^^
-
 error[E0046]: not all trait items implemented, missing: `foo`
   --> $DIR/invalid-attribute.rs:81:1
    |
diff --git a/tests/ui/target-feature/missing-plusminus-2.rs b/tests/ui/target-feature/missing-plusminus-2.rs
index 19f4bc6e724..06291ab23ad 100644
--- a/tests/ui/target-feature/missing-plusminus-2.rs
+++ b/tests/ui/target-feature/missing-plusminus-2.rs
@@ -4,3 +4,5 @@
 
 #![feature(no_core)]
 #![no_core]
+
+//~? WARN unknown feature specified for `-Ctarget-feature`: `rdrand`
diff --git a/tests/ui/target-feature/missing-plusminus.rs b/tests/ui/target-feature/missing-plusminus.rs
index eb3e93c2ef7..e8356e0fa35 100644
--- a/tests/ui/target-feature/missing-plusminus.rs
+++ b/tests/ui/target-feature/missing-plusminus.rs
@@ -1,2 +1,4 @@
 //@ compile-flags: -Ctarget-feature=banana --crate-type=rlib
 //@ build-pass
+
+//~? WARN unknown feature specified for `-Ctarget-feature`: `banana`
diff --git a/tests/ui/target-feature/similar-feature-suggestion.rs b/tests/ui/target-feature/similar-feature-suggestion.rs
index 242d472b794..b82d7e408c7 100644
--- a/tests/ui/target-feature/similar-feature-suggestion.rs
+++ b/tests/ui/target-feature/similar-feature-suggestion.rs
@@ -4,3 +4,5 @@
 
 #![feature(no_core)]
 #![no_core]
+
+//~? WARN unknown and unstable feature specified for `-Ctarget-feature`: `rdrnd`
diff --git a/tests/ui/target-feature/tied-features-cli.rs b/tests/ui/target-feature/tied-features-cli.rs
index 17c13826ce9..ce1dc3224a1 100644
--- a/tests/ui/target-feature/tied-features-cli.rs
+++ b/tests/ui/target-feature/tied-features-cli.rs
@@ -18,3 +18,7 @@
 trait Sized {}
 
 fn main() {}
+
+//[one]~? ERROR the target features paca, pacg must all be either enabled or disabled together
+//[two]~? ERROR the target features paca, pacg must all be either enabled or disabled together
+//[three]~? ERROR the target features paca, pacg must all be either enabled or disabled together
diff --git a/tests/ui/target-feature/tied-features-no-implication-1.rs b/tests/ui/target-feature/tied-features-no-implication-1.rs
index 0473ca319b8..0a98a7eeccf 100644
--- a/tests/ui/target-feature/tied-features-no-implication-1.rs
+++ b/tests/ui/target-feature/tied-features-no-implication-1.rs
@@ -18,3 +18,5 @@ trait Sized {}
 #[cfg(target_feature = "pacg")]
 pub unsafe fn foo() {
 }
+
+//~? ERROR the target features paca, pacg must all be either enabled or disabled together
diff --git a/tests/ui/target-feature/unstable-feature.rs b/tests/ui/target-feature/unstable-feature.rs
index c74c5ad5d77..f62c4dd938a 100644
--- a/tests/ui/target-feature/unstable-feature.rs
+++ b/tests/ui/target-feature/unstable-feature.rs
@@ -4,3 +4,5 @@
 
 #![feature(no_core)]
 #![no_core]
+
+//~? WARN unstable feature specified for `-Ctarget-feature`: `vaes`
diff --git a/tests/ui/target_modifiers/auxiliary/enabled_reg_struct_return.rs b/tests/ui/target_modifiers/auxiliary/enabled_reg_struct_return.rs
new file mode 100644
index 00000000000..4bda4ba24c5
--- /dev/null
+++ b/tests/ui/target_modifiers/auxiliary/enabled_reg_struct_return.rs
@@ -0,0 +1,7 @@
+//@ no-prefer-dynamic
+//@ compile-flags: --target i686-unknown-linux-gnu -Zreg-struct-return=true
+//@ needs-llvm-components: x86
+
+#![feature(no_core)]
+#![crate_type = "rlib"]
+#![no_core]
diff --git a/tests/ui/target_modifiers/defaults_check.error.stderr b/tests/ui/target_modifiers/defaults_check.error.stderr
index 4833fe90677..936fbbc94d6 100644
--- a/tests/ui/target_modifiers/defaults_check.error.stderr
+++ b/tests/ui/target_modifiers/defaults_check.error.stderr
@@ -5,8 +5,8 @@ LL | #![feature(no_core)]
    | ^
    |
    = help: the `-Zreg-struct-return` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely
-   = note: `-Zreg-struct-return=true` in this crate is incompatible with `-Zreg-struct-return=` in dependency `default_reg_struct_return`
-   = help: set `-Zreg-struct-return=` in this crate or `-Zreg-struct-return=true` in `default_reg_struct_return`
+   = note: `-Zreg-struct-return=true` in this crate is incompatible with unset `-Zreg-struct-return` in dependency `default_reg_struct_return`
+   = help: unset `-Zreg-struct-return` in this crate or set `-Zreg-struct-return=true` in `default_reg_struct_return`
    = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=reg-struct-return` to silence this error
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/target_modifiers/incompatible_regparm.rs b/tests/ui/target_modifiers/incompatible_regparm.rs
index befe573b276..395c26fc2c0 100644
--- a/tests/ui/target_modifiers/incompatible_regparm.rs
+++ b/tests/ui/target_modifiers/incompatible_regparm.rs
@@ -14,3 +14,5 @@
 #![no_core]
 
 extern crate wrong_regparm;
+
+//[allow_no_value]~? ERROR codegen option `unsafe-allow-abi-mismatch` requires a comma-separated list of strings
diff --git a/tests/ui/target_modifiers/no_value_bool.error.stderr b/tests/ui/target_modifiers/no_value_bool.error.stderr
new file mode 100644
index 00000000000..0484960dc62
--- /dev/null
+++ b/tests/ui/target_modifiers/no_value_bool.error.stderr
@@ -0,0 +1,13 @@
+error: mixing `-Zreg-struct-return` will cause an ABI mismatch in crate `no_value_bool`
+  --> $DIR/no_value_bool.rs:16:1
+   |
+LL | #![feature(no_core)]
+   | ^
+   |
+   = help: the `-Zreg-struct-return` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely
+   = note: unset `-Zreg-struct-return` in this crate is incompatible with `-Zreg-struct-return=true` in dependency `enabled_reg_struct_return`
+   = help: set `-Zreg-struct-return=true` in this crate or unset `-Zreg-struct-return` in `enabled_reg_struct_return`
+   = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=reg-struct-return` to silence this error
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/target_modifiers/no_value_bool.error_explicit.stderr b/tests/ui/target_modifiers/no_value_bool.error_explicit.stderr
new file mode 100644
index 00000000000..0484960dc62
--- /dev/null
+++ b/tests/ui/target_modifiers/no_value_bool.error_explicit.stderr
@@ -0,0 +1,13 @@
+error: mixing `-Zreg-struct-return` will cause an ABI mismatch in crate `no_value_bool`
+  --> $DIR/no_value_bool.rs:16:1
+   |
+LL | #![feature(no_core)]
+   | ^
+   |
+   = help: the `-Zreg-struct-return` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely
+   = note: unset `-Zreg-struct-return` in this crate is incompatible with `-Zreg-struct-return=true` in dependency `enabled_reg_struct_return`
+   = help: set `-Zreg-struct-return=true` in this crate or unset `-Zreg-struct-return` in `enabled_reg_struct_return`
+   = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=reg-struct-return` to silence this error
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/target_modifiers/no_value_bool.rs b/tests/ui/target_modifiers/no_value_bool.rs
new file mode 100644
index 00000000000..ceba40afa89
--- /dev/null
+++ b/tests/ui/target_modifiers/no_value_bool.rs
@@ -0,0 +1,22 @@
+// Tests that bool target modifier value (true) in dependency crate is ok linked
+// with the -Zflag specified without value (-Zflag=true is consistent with -Zflag)
+
+//@ aux-build:enabled_reg_struct_return.rs
+//@ compile-flags: --target i686-unknown-linux-gnu -Cpanic=abort
+//@ needs-llvm-components: x86
+
+//@ revisions: ok ok_explicit error error_explicit
+//@[ok] compile-flags: -Zreg-struct-return
+//@[ok_explicit] compile-flags: -Zreg-struct-return=true
+//@[error] compile-flags:
+//@[error_explicit] compile-flags: -Zreg-struct-return=false
+//@[ok] check-pass
+//@[ok_explicit] check-pass
+
+#![feature(no_core)]
+//[error]~^ ERROR mixing `-Zreg-struct-return` will cause an ABI mismatch in crate `no_value_bool`
+//[error_explicit]~^^ ERROR mixing `-Zreg-struct-return` will cause an ABI mismatch in crate `no_value_bool`
+#![crate_type = "rlib"]
+#![no_core]
+
+extern crate enabled_reg_struct_return;
diff --git a/tests/ui/test-attrs/custom-test-frameworks/issue-107454.stderr b/tests/ui/test-attrs/custom-test-frameworks/issue-107454.stderr
index 6ac79924d80..1b1a59ec582 100644
--- a/tests/ui/test-attrs/custom-test-frameworks/issue-107454.stderr
+++ b/tests/ui/test-attrs/custom-test-frameworks/issue-107454.stderr
@@ -9,7 +9,6 @@ note: the lint level is defined here
    |
 LL | #![deny(unnameable_test_items)]
    |         ^^^^^^^^^^^^^^^^^^^^^
-   = note: this error originates in the attribute macro `test_case` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/test-attrs/issue-12997-2.stderr b/tests/ui/test-attrs/issue-12997-2.stderr
index bc84ff413df..1123630a4a1 100644
--- a/tests/ui/test-attrs/issue-12997-2.stderr
+++ b/tests/ui/test-attrs/issue-12997-2.stderr
@@ -14,7 +14,6 @@ note: function defined here
    |
 LL | fn bar(x: isize) { }
    |    ^^^ --------
-   = note: this error originates in the attribute macro `bench` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/test-attrs/test-function-signature.stderr b/tests/ui/test-attrs/test-function-signature.stderr
index abdb30dc931..c025163c0bd 100644
--- a/tests/ui/test-attrs/test-function-signature.stderr
+++ b/tests/ui/test-attrs/test-function-signature.stderr
@@ -32,7 +32,6 @@ LL | fn bar() -> i32 {
    |
 note: required by a bound in `assert_test_result`
   --> $SRC_DIR/test/src/lib.rs:LL:COL
-   = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 5 previous errors
 
diff --git a/tests/ui/thread-local/spawn-hook-atexit.rs b/tests/ui/thread-local/spawn-hook-atexit.rs
new file mode 100644
index 00000000000..b084e0bb387
--- /dev/null
+++ b/tests/ui/thread-local/spawn-hook-atexit.rs
@@ -0,0 +1,24 @@
+// Regression test for https://github.com/rust-lang/rust/issues/138696
+//@ only-unix
+//@ needs-threads
+//@ run-pass
+
+#![feature(rustc_private)]
+
+extern crate libc;
+
+fn main() {
+    std::thread::spawn(|| {
+        unsafe { libc::atexit(spawn_in_atexit) };
+    })
+    .join()
+    .unwrap();
+}
+
+extern "C" fn spawn_in_atexit() {
+    std::thread::spawn(|| {
+        println!("Thread spawned in atexit");
+    })
+    .join()
+    .unwrap();
+}
diff --git a/tests/ui/tool-attributes/crate-attr.rs b/tests/ui/tool-attributes/crate-attr.rs
new file mode 100644
index 00000000000..c6d7974945f
--- /dev/null
+++ b/tests/ui/tool-attributes/crate-attr.rs
@@ -0,0 +1,5 @@
+//@ check-pass
+//@ compile-flags: -Z crate-attr=feature(register_tool) -Z crate-attr=register_tool(foo)
+
+#[allow(foo::bar)]
+fn main() {}
diff --git a/tests/ui/tool-attributes/duplicate-diagnostic.rs b/tests/ui/tool-attributes/duplicate-diagnostic.rs
index 5061bcb9e44..c36179611af 100644
--- a/tests/ui/tool-attributes/duplicate-diagnostic.rs
+++ b/tests/ui/tool-attributes/duplicate-diagnostic.rs
@@ -1,13 +1,14 @@
 //@ aux-build: p1.rs
 //@ aux-build: p2.rs
 
-//@ error-pattern: duplicate diagnostic item in crate `p2`
-//@ error-pattern: note: the diagnostic item is first defined in crate `p1`
-
 #![feature(rustc_attrs)]
 extern crate p1;
 extern crate p2;
 
 #[rustc_diagnostic_item = "Foo"]
 pub struct Foo {} //~ ERROR duplicate diagnostic item in crate `duplicate_diagnostic`: `Foo`
+                  //~^ NOTE the diagnostic item is first defined in crate `p2`
 fn main() {}
+
+//~? ERROR duplicate diagnostic item in crate `p2`
+//~? NOTE the diagnostic item is first defined in crate `p1`
diff --git a/tests/ui/tool-attributes/duplicate-diagnostic.stderr b/tests/ui/tool-attributes/duplicate-diagnostic.stderr
index 3cd438004c8..16d78d03ae9 100644
--- a/tests/ui/tool-attributes/duplicate-diagnostic.stderr
+++ b/tests/ui/tool-attributes/duplicate-diagnostic.stderr
@@ -3,7 +3,7 @@ error: duplicate diagnostic item in crate `p2`: `Foo`
    = note: the diagnostic item is first defined in crate `p1`
 
 error: duplicate diagnostic item in crate `duplicate_diagnostic`: `Foo`
-  --> $DIR/duplicate-diagnostic.rs:12:1
+  --> $DIR/duplicate-diagnostic.rs:9:1
    |
 LL | pub struct Foo {}
    | ^^^^^^^^^^^^^^
diff --git a/tests/ui/tool-attributes/multiple-registered.rs b/tests/ui/tool-attributes/multiple-registered.rs
new file mode 100644
index 00000000000..4d54c2dcb08
--- /dev/null
+++ b/tests/ui/tool-attributes/multiple-registered.rs
@@ -0,0 +1,7 @@
+//@ check-pass
+
+#![feature(register_tool)]
+#![register_tool(foo, bar, baz)]
+
+#[allow(foo::a, bar::b, baz::c)]
+fn main() {}
diff --git a/tests/ui/tool-attributes/nested-disallowed.rs b/tests/ui/tool-attributes/nested-disallowed.rs
new file mode 100644
index 00000000000..8e780427761
--- /dev/null
+++ b/tests/ui/tool-attributes/nested-disallowed.rs
@@ -0,0 +1,4 @@
+#![feature(register_tool)]
+#![register_tool(foo::bar)] //~ ERROR only accepts identifiers
+
+fn main() {}
diff --git a/tests/ui/tool-attributes/nested-disallowed.stderr b/tests/ui/tool-attributes/nested-disallowed.stderr
new file mode 100644
index 00000000000..1af73fc2f19
--- /dev/null
+++ b/tests/ui/tool-attributes/nested-disallowed.stderr
@@ -0,0 +1,8 @@
+error: `register_tool` only accepts identifiers
+  --> $DIR/nested-disallowed.rs:2:18
+   |
+LL | #![register_tool(foo::bar)]
+   |                  ^^^^^^^^ not an identifier
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/traits/alias/issue-83613.rs b/tests/ui/traits/alias/issue-83613.rs
index 6f0012bf089..752c4b84546 100644
--- a/tests/ui/traits/alias/issue-83613.rs
+++ b/tests/ui/traits/alias/issue-83613.rs
@@ -2,6 +2,7 @@
 trait OpaqueTrait {}
 impl<T> OpaqueTrait for T {}
 type OpaqueType = impl OpaqueTrait;
+#[define_opaque(OpaqueType)]
 fn mk_opaque() -> OpaqueType {
     || 0
 }
diff --git a/tests/ui/traits/alias/issue-83613.stderr b/tests/ui/traits/alias/issue-83613.stderr
index 47181c3f33e..7d2bdd7e186 100644
--- a/tests/ui/traits/alias/issue-83613.stderr
+++ b/tests/ui/traits/alias/issue-83613.stderr
@@ -1,5 +1,5 @@
 error[E0119]: conflicting implementations of trait `AnotherTrait`
-  --> $DIR/issue-83613.rs:10:1
+  --> $DIR/issue-83613.rs:11:1
    |
 LL | impl<T: Send> AnotherTrait for T {}
    | -------------------------------- first implementation here
diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr b/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr
index fae871a4c85..202210a2e65 100644
--- a/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr
+++ b/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr
@@ -15,7 +15,6 @@ LL | #[derive_const(Default)]
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
-   = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.stderr b/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.stderr
index 64564de2a0c..27f4bcf46ef 100644
--- a/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.stderr
+++ b/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.stderr
@@ -6,7 +6,6 @@ LL | #[derive_const(Default)]
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
-   = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0015]: cannot call non-const associated function `<A as Default>::default` in constant functions
   --> $DIR/derive-const-non-const-type.rs:11:14
@@ -17,7 +16,6 @@ LL | pub struct S(A);
    |              ^
    |
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-   = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-use.stderr b/tests/ui/traits/const-traits/const_derives/derive-const-use.stderr
index 9ad3b0c1617..8297911a3f3 100644
--- a/tests/ui/traits/const-traits/const_derives/derive-const-use.stderr
+++ b/tests/ui/traits/const-traits/const_derives/derive-const-use.stderr
@@ -27,7 +27,6 @@ LL | #[derive_const(Default, PartialEq)]
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
-   = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
   --> $DIR/derive-const-use.rs:11:12
@@ -46,7 +45,6 @@ LL | #[derive_const(Default, PartialEq)]
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
-   = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0015]: cannot call non-const associated function `<S as Default>::default` in constants
   --> $DIR/derive-const-use.rs:18:35
@@ -73,7 +71,6 @@ LL | pub struct S((), A);
    |              ^^
    |
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-   = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0015]: cannot call non-const associated function `<A as Default>::default` in constant functions
   --> $DIR/derive-const-use.rs:16:18
@@ -84,7 +81,6 @@ LL | pub struct S((), A);
    |                  ^
    |
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-   = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0015]: cannot call non-const operator in constant functions
   --> $DIR/derive-const-use.rs:16:14
@@ -95,7 +91,6 @@ LL | pub struct S((), A);
    |              ^^
    |
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-   = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0015]: cannot call non-const operator in constant functions
   --> $DIR/derive-const-use.rs:16:18
@@ -106,7 +101,6 @@ LL | pub struct S((), A);
    |                  ^
    |
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-   = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 12 previous errors
 
diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-with-params.stderr b/tests/ui/traits/const-traits/const_derives/derive-const-with-params.stderr
index 6b1405712ef..d1dbf62d566 100644
--- a/tests/ui/traits/const-traits/const_derives/derive-const-with-params.stderr
+++ b/tests/ui/traits/const-traits/const_derives/derive-const-with-params.stderr
@@ -6,7 +6,6 @@ LL | #[derive_const(PartialEq)]
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
-   = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: `~const` can only be applied to `#[const_trait]` traits
    |
@@ -22,7 +21,6 @@ LL | pub struct Reverse<T>(T);
    |                       ^
    |
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-   = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0015]: cannot call non-const operator in constant functions
   --> $DIR/derive-const-with-params.rs:11:5
diff --git a/tests/ui/traits/const-traits/feature-gate.gated.stderr b/tests/ui/traits/const-traits/feature-gate.gated.stderr
deleted file mode 100644
index 12f9355e41d..00000000000
--- a/tests/ui/traits/const-traits/feature-gate.gated.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: fatal error triggered by #[rustc_error]
-  --> $DIR/feature-gate.rs:22:1
-   |
-LL | fn main() {}
-   | ^^^^^^^^^
-
-error: aborting due to 1 previous error
-
diff --git a/tests/ui/traits/const-traits/feature-gate.rs b/tests/ui/traits/const-traits/feature-gate.rs
index c36ec3538c3..921dfb054e3 100644
--- a/tests/ui/traits/const-traits/feature-gate.rs
+++ b/tests/ui/traits/const-traits/feature-gate.rs
@@ -1,8 +1,8 @@
 //@ revisions: stock gated
+//@[gated] check-pass
 // gate-test-const_trait_impl
 
 #![cfg_attr(gated, feature(const_trait_impl))]
-#![feature(rustc_attrs)]
 
 struct S;
 #[const_trait] //[stock]~ ERROR `const_trait` is a temporary placeholder
@@ -18,5 +18,4 @@ macro_rules! discard { ($ty:ty) => {} }
 discard! { impl ~const T } //[stock]~ ERROR const trait impls are experimental
 discard! { impl const T } //[stock]~ ERROR const trait impls are experimental
 
-#[rustc_error]
-fn main() {} //[gated]~ ERROR fatal error triggered by #[rustc_error]
+fn main() {}
diff --git a/tests/ui/traits/incomplete-infer-via-sized-wc.current.stderr b/tests/ui/traits/incomplete-infer-via-sized-wc.current.stderr
new file mode 100644
index 00000000000..f4930bf890c
--- /dev/null
+++ b/tests/ui/traits/incomplete-infer-via-sized-wc.current.stderr
@@ -0,0 +1,9 @@
+error[E0282]: type annotations needed
+  --> $DIR/incomplete-infer-via-sized-wc.rs:15:5
+   |
+LL |     is_sized::<MaybeSized<_>>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `is_sized`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/traits/incomplete-infer-via-sized-wc.next.stderr b/tests/ui/traits/incomplete-infer-via-sized-wc.next.stderr
new file mode 100644
index 00000000000..f4930bf890c
--- /dev/null
+++ b/tests/ui/traits/incomplete-infer-via-sized-wc.next.stderr
@@ -0,0 +1,9 @@
+error[E0282]: type annotations needed
+  --> $DIR/incomplete-infer-via-sized-wc.rs:15:5
+   |
+LL |     is_sized::<MaybeSized<_>>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `is_sized`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/traits/incomplete-infer-via-sized-wc.rs b/tests/ui/traits/incomplete-infer-via-sized-wc.rs
new file mode 100644
index 00000000000..9dcddea3551
--- /dev/null
+++ b/tests/ui/traits/incomplete-infer-via-sized-wc.rs
@@ -0,0 +1,19 @@
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
+
+// Exercises change in <https://github.com/rust-lang/rust/pull/138176>.
+
+struct MaybeSized<T: ?Sized>(T);
+
+fn is_sized<T: Sized>() -> Box<T> { todo!() }
+
+fn foo<T: ?Sized>()
+where
+    MaybeSized<T>: Sized,
+{
+    is_sized::<MaybeSized<_>>();
+    //~^ ERROR type annotations needed
+}
+
+fn main() {}
diff --git a/tests/ui/traits/inductive-overflow/supertrait-auto-trait.rs b/tests/ui/traits/inductive-overflow/supertrait-auto-trait.rs
index 5fea47a1be8..ca31d39de98 100644
--- a/tests/ui/traits/inductive-overflow/supertrait-auto-trait.rs
+++ b/tests/ui/traits/inductive-overflow/supertrait-auto-trait.rs
@@ -13,6 +13,6 @@ fn copy<T: Magic>(x: T) -> (T, T) { (x, x) }
 struct NoClone;
 
 fn main() {
-    let (a, b) = copy(NoClone); //~ ERROR
+    let (a, b) = copy(NoClone);
     println!("{:?} {:?}", a, b);
 }
diff --git a/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr b/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr
index 07edc4ede76..3a3b99f6c5b 100644
--- a/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr
+++ b/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr
@@ -6,31 +6,6 @@ LL | auto trait Magic: Copy {}
    |            |
    |            auto traits cannot have super traits or lifetime bounds
 
-error[E0277]: the trait bound `NoClone: Magic` is not satisfied
-  --> $DIR/supertrait-auto-trait.rs:16:23
-   |
-LL |     let (a, b) = copy(NoClone);
-   |                  ---- ^^^^^^^ the trait `Copy` is not implemented for `NoClone`
-   |                  |
-   |                  required by a bound introduced by this call
-   |
-note: required for `NoClone` to implement `Magic`
-  --> $DIR/supertrait-auto-trait.rs:8:12
-   |
-LL | auto trait Magic: Copy {}
-   |            ^^^^^
-note: required by a bound in `copy`
-  --> $DIR/supertrait-auto-trait.rs:10:12
-   |
-LL | fn copy<T: Magic>(x: T) -> (T, T) { (x, x) }
-   |            ^^^^^ required by this bound in `copy`
-help: consider annotating `NoClone` with `#[derive(Copy)]`
-   |
-LL + #[derive(Copy)]
-LL | struct NoClone;
-   |
-
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
-Some errors have detailed explanations: E0277, E0568.
-For more information about an error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0568`.
diff --git a/tests/ui/traits/issue-106072.stderr b/tests/ui/traits/issue-106072.stderr
index 3e0d6d88086..815787c3bfe 100644
--- a/tests/ui/traits/issue-106072.stderr
+++ b/tests/ui/traits/issue-106072.stderr
@@ -13,8 +13,6 @@ error[E0782]: expected a type, found a trait
    |
 LL | #[derive(Clone)]
    |          ^^^^^
-   |
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0782]: expected a type, found a trait
   --> $DIR/issue-106072.rs:1:10
@@ -23,7 +21,6 @@ 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
 
diff --git a/tests/ui/traits/issue-50480.stderr b/tests/ui/traits/issue-50480.stderr
index d3c11238ede..ed8c74e9bdd 100644
--- a/tests/ui/traits/issue-50480.stderr
+++ b/tests/ui/traits/issue-50480.stderr
@@ -79,8 +79,6 @@ LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
    |                                                    --------  ------ this field does not implement `Copy`
    |                                                    |
    |                                                    this field does not implement `Copy`
-   |
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0204]: the trait `Copy` cannot be implemented for this type
   --> $DIR/issue-50480.rs:11:17
@@ -92,8 +90,6 @@ LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
    |                                                          --------  ------ this field does not implement `Copy`
    |                                                          |
    |                                                          this field does not implement `Copy`
-   |
-   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: `i32` is not an iterator
   --> $DIR/issue-50480.rs:14:33
@@ -118,7 +114,6 @@ LL | #[derive(Clone, Copy)]
    |          ^^^^^ `i32` is not an iterator
    |
    = help: the trait `Iterator` is not implemented for `i32`
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: `i32` is not an iterator
   --> $DIR/issue-50480.rs:14:33
@@ -130,7 +125,6 @@ LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
    |                                 ^^^^^^^^^^^^^^^^^^^^^^^ `i32` is not an iterator
    |
    = help: the trait `Iterator` is not implemented for `i32`
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 13 previous errors
 
diff --git a/tests/ui/traits/issue-71136.stderr b/tests/ui/traits/issue-71136.stderr
index 2c03c6bf08e..cd891c88c9f 100644
--- a/tests/ui/traits/issue-71136.stderr
+++ b/tests/ui/traits/issue-71136.stderr
@@ -8,7 +8,6 @@ LL |     the_foos: Vec<Foo>,
    |     ^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `Foo`
    |
    = note: required for `Vec<Foo>` to implement `Clone`
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Foo` with `#[derive(Clone)]`
    |
 LL + #[derive(Clone)]
diff --git a/tests/ui/traits/issue-79458.stderr b/tests/ui/traits/issue-79458.stderr
index c80efbe9287..9e53ec8cc90 100644
--- a/tests/ui/traits/issue-79458.stderr
+++ b/tests/ui/traits/issue-79458.stderr
@@ -9,7 +9,6 @@ LL |     bar: &'a mut T
    |
    = help: the trait `Clone` is implemented for `&T`
    = note: `Clone` is implemented for `&T`, but not for `&mut T`
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/traits/lifetime-incomplete-prefer-sized-builtin-over-wc-2.rs b/tests/ui/traits/lifetime-incomplete-prefer-sized-builtin-over-wc-2.rs
new file mode 100644
index 00000000000..8a8f7b933b5
--- /dev/null
+++ b/tests/ui/traits/lifetime-incomplete-prefer-sized-builtin-over-wc-2.rs
@@ -0,0 +1,28 @@
+//@ check-pass
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
+
+// Exercises change in <https://github.com/rust-lang/rust/pull/138176>.
+
+trait Trait<T>: Sized {}
+impl<T> Trait<T> for T {}
+
+fn is_sized<T: Sized>() {}
+
+fn normal_ref<'a, 'b, T>()
+where
+    &'a u32: Trait<T>,
+{
+    is_sized::<&'b u32>();
+}
+
+struct MyRef<'a, U: ?Sized = ()>(&'a u32, U);
+fn my_ref<'a, 'b, T>()
+where
+    MyRef<'a>: Trait<T>,
+{
+    is_sized::<MyRef<'b>>();
+}
+
+fn main() {}
diff --git a/tests/ui/traits/lifetime-incomplete-prefer-sized-builtin-over-wc.current.stderr b/tests/ui/traits/lifetime-incomplete-prefer-sized-builtin-over-wc.current.stderr
new file mode 100644
index 00000000000..dd9393fae85
--- /dev/null
+++ b/tests/ui/traits/lifetime-incomplete-prefer-sized-builtin-over-wc.current.stderr
@@ -0,0 +1,27 @@
+error[E0308]: mismatched types
+  --> $DIR/lifetime-incomplete-prefer-sized-builtin-over-wc.rs:13:23
+   |
+LL |     (MyType<'a, T>,): Sized,
+   |                       ^^^^^ lifetime mismatch
+   |
+   = note: expected trait `<MyType<'a, T> as Sized>`
+              found trait `<MyType<'static, T> as Sized>`
+note: the lifetime `'a` as defined here...
+  --> $DIR/lifetime-incomplete-prefer-sized-builtin-over-wc.rs:11:8
+   |
+LL | fn foo<'a, T: ?Sized>()
+   |        ^^
+   = note: ...does not necessarily outlive the static lifetime
+
+error: lifetime may not live long enough
+  --> $DIR/lifetime-incomplete-prefer-sized-builtin-over-wc.rs:22:5
+   |
+LL | fn foo<'a, T: ?Sized>()
+   |        -- lifetime `'a` defined here
+...
+LL |     is_sized::<(MyType<'a, T>,)>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/traits/lifetime-incomplete-prefer-sized-builtin-over-wc.next.stderr b/tests/ui/traits/lifetime-incomplete-prefer-sized-builtin-over-wc.next.stderr
new file mode 100644
index 00000000000..05861877d41
--- /dev/null
+++ b/tests/ui/traits/lifetime-incomplete-prefer-sized-builtin-over-wc.next.stderr
@@ -0,0 +1,25 @@
+error[E0478]: lifetime bound not satisfied
+  --> $DIR/lifetime-incomplete-prefer-sized-builtin-over-wc.rs:13:23
+   |
+LL |     (MyType<'a, T>,): Sized,
+   |                       ^^^^^
+   |
+note: lifetime parameter instantiated with the lifetime `'a` as defined here
+  --> $DIR/lifetime-incomplete-prefer-sized-builtin-over-wc.rs:11:8
+   |
+LL | fn foo<'a, T: ?Sized>()
+   |        ^^
+   = note: but lifetime parameter must outlive the static lifetime
+
+error: lifetime may not live long enough
+  --> $DIR/lifetime-incomplete-prefer-sized-builtin-over-wc.rs:22:5
+   |
+LL | fn foo<'a, T: ?Sized>()
+   |        -- lifetime `'a` defined here
+...
+LL |     is_sized::<(MyType<'a, T>,)>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0478`.
diff --git a/tests/ui/traits/lifetime-incomplete-prefer-sized-builtin-over-wc.rs b/tests/ui/traits/lifetime-incomplete-prefer-sized-builtin-over-wc.rs
new file mode 100644
index 00000000000..ae7a6c9bba3
--- /dev/null
+++ b/tests/ui/traits/lifetime-incomplete-prefer-sized-builtin-over-wc.rs
@@ -0,0 +1,26 @@
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
+
+// Exercises change in <https://github.com/rust-lang/rust/pull/138176>.
+
+struct MyType<'a, T: ?Sized>(&'a (), T);
+
+fn is_sized<T>() {}
+
+fn foo<'a, T: ?Sized>()
+where
+    (MyType<'a, T>,): Sized,
+    //[current]~^ ERROR mismatched types
+    //[next]~^^ ERROR lifetime bound not satisfied
+    MyType<'static, T>: Sized,
+{
+    // Preferring the builtin `Sized` impl of tuples
+    // requires proving `MyType<'a, T>: Sized` which
+    // can only be proven by using the where-clause,
+    // adding an unnecessary `'static` constraint.
+    is_sized::<(MyType<'a, T>,)>();
+    //~^ ERROR lifetime may not live long enough
+}
+
+fn main() {}
diff --git a/tests/ui/traits/next-solver/alias-relate/tait-eq-proj-2.rs b/tests/ui/traits/next-solver/alias-relate/tait-eq-proj-2.rs
index cb9fe176ac9..92a0913dee2 100644
--- a/tests/ui/traits/next-solver/alias-relate/tait-eq-proj-2.rs
+++ b/tests/ui/traits/next-solver/alias-relate/tait-eq-proj-2.rs
@@ -12,7 +12,8 @@ fn mk<T>() -> T {
     todo!()
 }
 
-fn a(_: Tait) {
+#[define_opaque(Tait)]
+fn a() {
     let x: Tait = mk();
     let mut array = mk();
     let mut z = IntoIterator::into_iter(array);
diff --git a/tests/ui/traits/next-solver/alias-relate/tait-eq-proj.rs b/tests/ui/traits/next-solver/alias-relate/tait-eq-proj.rs
index 8d92c88ae72..0e99ef87c89 100644
--- a/tests/ui/traits/next-solver/alias-relate/tait-eq-proj.rs
+++ b/tests/ui/traits/next-solver/alias-relate/tait-eq-proj.rs
@@ -28,7 +28,8 @@ goals together. Essentially:
 
 */
 
-fn a(_: Tait) {
+#[define_opaque(Tait)]
+fn a() {
     let _: Tait = IntoIterator::into_iter([0i32; 32]);
 }
 
diff --git a/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.rs b/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.rs
index 3238f028362..28fd66cd169 100644
--- a/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.rs
+++ b/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.rs
@@ -6,9 +6,11 @@
 trait Overflow {
     type Assoc;
 }
-impl<T> Overflow for T {
-    type Assoc = <T as Overflow>::Assoc;
-    //~^ ERROR: overflow
+impl<T> Overflow for T
+where
+    (T,): Overflow
+{
+    type Assoc = <(T,) as Overflow>::Assoc;
 }
 
 
diff --git a/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr b/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr
index 294fa0d7613..34a45e93630 100644
--- a/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr
+++ b/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr
@@ -1,19 +1,15 @@
-error[E0275]: overflow evaluating the requirement `<T as Overflow>::Assoc == _`
-  --> $DIR/trait_ref_is_knowable-norm-overflow.rs:10:18
-   |
-LL |     type Assoc = <T as Overflow>::Assoc;
-   |                  ^^^^^^^^^^^^^^^^^^^^^^
-
 error[E0119]: conflicting implementations of trait `Trait`
-  --> $DIR/trait_ref_is_knowable-norm-overflow.rs:18:1
+  --> $DIR/trait_ref_is_knowable-norm-overflow.rs:20:1
    |
 LL | impl<T: Copy> Trait for T {}
    | ------------------------- first implementation here
 LL | struct LocalTy;
 LL | impl Trait for <LocalTy as Overflow>::Assoc {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
+   |
+   = note: overflow evaluating the requirement `_ == <LocalTy as Overflow>::Assoc`
+   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`trait_ref_is_knowable_norm_overflow`)
 
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
-Some errors have detailed explanations: E0119, E0275.
-For more information about an error, try `rustc --explain E0119`.
+For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/traits/next-solver/cycles/cyclic-normalization-to-error-nalgebra.rs b/tests/ui/traits/next-solver/cycles/cyclic-normalization-to-error-nalgebra.rs
new file mode 100644
index 00000000000..ec478aa02b7
--- /dev/null
+++ b/tests/ui/traits/next-solver/cycles/cyclic-normalization-to-error-nalgebra.rs
@@ -0,0 +1,21 @@
+// Regression test for trait-system-refactor-initiative#114.
+//
+// We previously treated the cycle when trying to use the
+// `<R as DimMin<C>>::Output: DimMin` where-bound when
+// normalizing `<R as DimMin<C>>::Output` as ambiguous, causing
+// this to error.
+
+//@ check-pass
+//@ compile-flags: -Znext-solver
+//@ ignore-compare-mode-next-solver
+
+pub trait DimMin<D> {
+    type Output;
+}
+pub fn repro<R: DimMin<C>, C>()
+where
+    <R as DimMin<C>>::Output: DimMin<C, Output = <R as DimMin<C>>::Output>,
+{
+}
+
+fn main() {}
diff --git a/tests/ui/traits/next-solver/cycles/unproductive-in-coherence.rs b/tests/ui/traits/next-solver/cycles/unproductive-in-coherence.rs
new file mode 100644
index 00000000000..46dd6adf662
--- /dev/null
+++ b/tests/ui/traits/next-solver/cycles/unproductive-in-coherence.rs
@@ -0,0 +1,21 @@
+// If we treat known inductive cycles as errors, this test compiles
+// as normalizing `Overflow::Assoc<Overflow>` fails.
+//
+// As coherence already uses the new solver on stable, this change
+// would require an FCP.
+
+trait Trait {
+    type Assoc<T: Trait>;
+}
+
+struct Overflow;
+impl Trait for Overflow {
+    type Assoc<T: Trait> = <T as Trait>::Assoc<Overflow>;
+}
+
+trait Overlap<T, WfHack> {}
+impl<T: Trait, U: Copy> Overlap<T::Assoc<T>, U> for T {}
+impl<U> Overlap<u32, U> for Overflow {}
+//~^ ERROR conflicting implementations of trait `Overlap<<Overflow as Trait>::Assoc<Overflow>, _>` for type `Overflow`
+
+fn main() {}
diff --git a/tests/ui/traits/next-solver/cycles/unproductive-in-coherence.stderr b/tests/ui/traits/next-solver/cycles/unproductive-in-coherence.stderr
new file mode 100644
index 00000000000..6605a28d547
--- /dev/null
+++ b/tests/ui/traits/next-solver/cycles/unproductive-in-coherence.stderr
@@ -0,0 +1,11 @@
+error[E0119]: conflicting implementations of trait `Overlap<<Overflow as Trait>::Assoc<Overflow>, _>` for type `Overflow`
+  --> $DIR/unproductive-in-coherence.rs:18:1
+   |
+LL | impl<T: Trait, U: Copy> Overlap<T::Assoc<T>, U> for T {}
+   | ----------------------------------------------------- first implementation here
+LL | impl<U> Overlap<u32, U> for Overflow {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Overflow`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/traits/next-solver/global-cache-and-parallel-frontend.stderr b/tests/ui/traits/next-solver/global-cache-and-parallel-frontend.stderr
index da269bbeae4..290b1df1665 100644
--- a/tests/ui/traits/next-solver/global-cache-and-parallel-frontend.stderr
+++ b/tests/ui/traits/next-solver/global-cache-and-parallel-frontend.stderr
@@ -13,7 +13,6 @@ LL | impl<T: Clone, U> PartialEq<U> for Struct<T>
    |         unsatisfied trait bound introduced here
 note: required by a bound in `Eq`
   --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider restricting type parameter `T` with trait `Clone`
    |
 LL | pub struct Struct<T: std::clone::Clone>(T);
diff --git a/tests/ui/traits/next-solver/opaques/dont-remap-tait-substs.rs b/tests/ui/traits/next-solver/opaques/dont-remap-tait-substs.rs
index 904bc179495..38fcc561b32 100644
--- a/tests/ui/traits/next-solver/opaques/dont-remap-tait-substs.rs
+++ b/tests/ui/traits/next-solver/opaques/dont-remap-tait-substs.rs
@@ -12,7 +12,8 @@ type Foo<T: Send, U> = impl NeedsSend<T>;
 trait NeedsSend<T> {}
 impl<T: Send> NeedsSend<T> for T {}
 
-fn define<A, B: Send>(a: A, b: B, _: Foo<B, A>) {
+#[define_opaque(Foo)]
+fn define<A, B: Send>(a: A, b: B) {
     let y: Option<Foo<B, A>> = Some(b);
 }
 
diff --git a/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.is_send.stderr b/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.is_send.stderr
index 158fefd1538..736c8c10da9 100644
--- a/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.is_send.stderr
+++ b/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.is_send.stderr
@@ -1,5 +1,5 @@
 error[E0284]: type annotations needed: cannot satisfy `Foo == _`
-  --> $DIR/dont-type_of-tait-in-defining-scope.rs:15:18
+  --> $DIR/dont-type_of-tait-in-defining-scope.rs:16:18
    |
 LL |     needs_send::<Foo>();
    |                  ^^^ cannot satisfy `Foo == _`
diff --git a/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.not_send.stderr b/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.not_send.stderr
index 158fefd1538..736c8c10da9 100644
--- a/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.not_send.stderr
+++ b/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.not_send.stderr
@@ -1,5 +1,5 @@
 error[E0284]: type annotations needed: cannot satisfy `Foo == _`
-  --> $DIR/dont-type_of-tait-in-defining-scope.rs:15:18
+  --> $DIR/dont-type_of-tait-in-defining-scope.rs:16:18
    |
 LL |     needs_send::<Foo>();
    |                  ^^^ cannot satisfy `Foo == _`
diff --git a/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.rs b/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.rs
index 10b746cc989..2a08a3b2b94 100644
--- a/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.rs
+++ b/tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.rs
@@ -11,12 +11,14 @@ type Foo = impl Sized;
 
 fn needs_send<T: Send>() {}
 
+#[define_opaque(Foo)]
 fn test(_: Foo) {
     needs_send::<Foo>();
     //~^ ERROR type annotations needed: cannot satisfy `Foo == _`
 }
 
-fn defines(_: Foo) {
+#[define_opaque(Foo)]
+fn defines() {
     let _: Foo = ();
 }
 
diff --git a/tests/ui/traits/next-solver/opaques/no-define-in-wf-check.current.stderr b/tests/ui/traits/next-solver/opaques/no-define-in-wf-check.current.stderr
index 9a28dc093c1..5625cb24d42 100644
--- a/tests/ui/traits/next-solver/opaques/no-define-in-wf-check.current.stderr
+++ b/tests/ui/traits/next-solver/opaques/no-define-in-wf-check.current.stderr
@@ -4,31 +4,31 @@ error: unconstrained opaque type
 LL |     type Tait1 = impl Sized;
    |                  ^^^^^^^^^^
    |
-   = note: `Tait1` must be used in combination with a concrete type within the same module
+   = note: `Tait1` must be used in combination with a concrete type within the same crate
 
 error: unconstrained opaque type
-  --> $DIR/no-define-in-wf-check.rs:27:18
+  --> $DIR/no-define-in-wf-check.rs:28:18
    |
 LL |     type Tait1 = impl Sized;
    |                  ^^^^^^^^^^
    |
-   = note: `Tait1` must be used in combination with a concrete type within the same module
+   = note: `Tait1` must be used in combination with a concrete type within the same crate
 
 error: unconstrained opaque type
-  --> $DIR/no-define-in-wf-check.rs:36:18
+  --> $DIR/no-define-in-wf-check.rs:38:18
    |
 LL |     type Tait1 = impl Sized;
    |                  ^^^^^^^^^^
    |
-   = note: `Tait1` must be used in combination with a concrete type within the same module
+   = note: `Tait1` must be used in combination with a concrete type within the same crate
 
 error: unconstrained opaque type
-  --> $DIR/no-define-in-wf-check.rs:47:18
+  --> $DIR/no-define-in-wf-check.rs:50:18
    |
 LL |     type Tait1 = impl Sized;
    |                  ^^^^^^^^^^
    |
-   = note: `Tait1` must be used in combination with a concrete type within the same module
+   = note: `Tait1` must be used in combination with a concrete type within the same crate
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/traits/next-solver/opaques/no-define-in-wf-check.rs b/tests/ui/traits/next-solver/opaques/no-define-in-wf-check.rs
index dd6df097da1..31d07d89d8d 100644
--- a/tests/ui/traits/next-solver/opaques/no-define-in-wf-check.rs
+++ b/tests/ui/traits/next-solver/opaques/no-define-in-wf-check.rs
@@ -18,6 +18,7 @@ mod ex0 {
 mod ex1 {
     type Tait1 = impl Sized;
     //[current]~^ ERROR unconstrained opaque type
+    #[define_opaque(Tait1)]
     fn foo(x: Tait1) -> impl Sized {
         let () = x;
     }
@@ -27,6 +28,7 @@ mod ex2 {
     type Tait1 = impl Sized;
     //[current]~^ ERROR unconstrained opaque type
     type Tait2 = impl Sized;
+    #[define_opaque(Tait1, Tait2)]
     fn foo(x: Tait1) -> Tait2 {
         let () = x;
     }
@@ -38,6 +40,7 @@ mod ex3 {
     trait Something<T> {}
     impl<T, U> Something<U> for T {}
     type Tait2 = impl Something<Tait1>;
+    #[define_opaque(Tait1, Tait2)]
     fn foo(x: Tait1) -> Tait2 {
         let () = x;
     }
@@ -58,6 +61,7 @@ mod ex4 {
     //
     // ambiguity proving `(): Trait<Tait1>`.
     type Tait2 = impl Trait<(), Assoc = impl Trait<Tait1>>;
+    #[define_opaque(Tait1, Tait2)]
     fn foo(x: Tait1) -> Tait2 {
         let () = x;
     }
diff --git a/tests/ui/traits/next-solver/overflow/recursive-self-normalization-2.rs b/tests/ui/traits/next-solver/overflow/recursive-self-normalization-2.rs
index 0f01a453b33..94a9484ecdc 100644
--- a/tests/ui/traits/next-solver/overflow/recursive-self-normalization-2.rs
+++ b/tests/ui/traits/next-solver/overflow/recursive-self-normalization-2.rs
@@ -13,12 +13,7 @@ fn needs_bar<S: Bar>() {}
 
 fn test<T: Foo1<Assoc1 = <T as Foo2>::Assoc2> + Foo2<Assoc2 = <T as Foo1>::Assoc1>>() {
     needs_bar::<T::Assoc1>();
-    //~^ ERROR overflow evaluating the requirement `<T as Foo1>::Assoc1 == _`
-    //~| ERROR overflow evaluating the requirement `<T as Foo1>::Assoc1 == _`
-    //~| ERROR overflow evaluating the requirement `<T as Foo1>::Assoc1 == _`
-    //~| ERROR overflow evaluating the requirement `<T as Foo1>::Assoc1 == _`
-    //~| ERROR overflow evaluating the requirement `<T as Foo1>::Assoc1: Sized`
-    //~| ERROR overflow evaluating the requirement `<T as Foo1>::Assoc1: Bar`
+    //~^ ERROR the trait bound `<T as Foo1>::Assoc1: Bar` is not satisfied
 }
 
 fn main() {}
diff --git a/tests/ui/traits/next-solver/overflow/recursive-self-normalization-2.stderr b/tests/ui/traits/next-solver/overflow/recursive-self-normalization-2.stderr
index 2b0e57966fe..6f5111a6193 100644
--- a/tests/ui/traits/next-solver/overflow/recursive-self-normalization-2.stderr
+++ b/tests/ui/traits/next-solver/overflow/recursive-self-normalization-2.stderr
@@ -1,59 +1,19 @@
-error[E0275]: overflow evaluating the requirement `<T as Foo1>::Assoc1 == _`
+error[E0277]: the trait bound `<T as Foo1>::Assoc1: Bar` is not satisfied
   --> $DIR/recursive-self-normalization-2.rs:15:17
    |
 LL |     needs_bar::<T::Assoc1>();
-   |                 ^^^^^^^^^
-
-error[E0275]: overflow evaluating the requirement `<T as Foo1>::Assoc1: Bar`
-  --> $DIR/recursive-self-normalization-2.rs:15:17
-   |
-LL |     needs_bar::<T::Assoc1>();
-   |                 ^^^^^^^^^
+   |                 ^^^^^^^^^ the trait `Bar` is not implemented for `<T as Foo1>::Assoc1`
    |
 note: required by a bound in `needs_bar`
   --> $DIR/recursive-self-normalization-2.rs:12:17
    |
 LL | fn needs_bar<S: Bar>() {}
    |                 ^^^ required by this bound in `needs_bar`
-
-error[E0275]: overflow evaluating the requirement `<T as Foo1>::Assoc1: Sized`
-  --> $DIR/recursive-self-normalization-2.rs:15:17
-   |
-LL |     needs_bar::<T::Assoc1>();
-   |                 ^^^^^^^^^
-   |
-note: required by an implicit `Sized` bound in `needs_bar`
-  --> $DIR/recursive-self-normalization-2.rs:12:14
-   |
-LL | fn needs_bar<S: Bar>() {}
-   |              ^ required by the implicit `Sized` requirement on this type parameter in `needs_bar`
-help: consider relaxing the implicit `Sized` restriction
-   |
-LL | fn needs_bar<S: Bar + ?Sized>() {}
-   |                     ++++++++
-
-error[E0275]: overflow evaluating the requirement `<T as Foo1>::Assoc1 == _`
-  --> $DIR/recursive-self-normalization-2.rs:15:5
-   |
-LL |     needs_bar::<T::Assoc1>();
-   |     ^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0275]: overflow evaluating the requirement `<T as Foo1>::Assoc1 == _`
-  --> $DIR/recursive-self-normalization-2.rs:15:5
-   |
-LL |     needs_bar::<T::Assoc1>();
-   |     ^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-
-error[E0275]: overflow evaluating the requirement `<T as Foo1>::Assoc1 == _`
-  --> $DIR/recursive-self-normalization-2.rs:15:17
-   |
-LL |     needs_bar::<T::Assoc1>();
-   |                 ^^^^^^^^^
+help: consider further restricting the associated type
    |
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+LL | fn test<T: Foo1<Assoc1 = <T as Foo2>::Assoc2> + Foo2<Assoc2 = <T as Foo1>::Assoc1>>() where <T as Foo1>::Assoc1: Bar {
+   |                                                                                       ++++++++++++++++++++++++++++++
 
-error: aborting due to 6 previous errors
+error: aborting due to 1 previous error
 
-For more information about this error, try `rustc --explain E0275`.
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/next-solver/overflow/recursive-self-normalization.rs b/tests/ui/traits/next-solver/overflow/recursive-self-normalization.rs
index f435b48737e..f441ac499f9 100644
--- a/tests/ui/traits/next-solver/overflow/recursive-self-normalization.rs
+++ b/tests/ui/traits/next-solver/overflow/recursive-self-normalization.rs
@@ -9,12 +9,7 @@ fn needs_bar<S: Bar>() {}
 
 fn test<T: Foo<Assoc = <T as Foo>::Assoc>>() {
     needs_bar::<T::Assoc>();
-    //~^ ERROR overflow evaluating the requirement `<T as Foo>::Assoc == _`
-    //~| ERROR overflow evaluating the requirement `<T as Foo>::Assoc == _`
-    //~| ERROR overflow evaluating the requirement `<T as Foo>::Assoc == _`
-    //~| ERROR overflow evaluating the requirement `<T as Foo>::Assoc == _`
-    //~| ERROR overflow evaluating the requirement `<T as Foo>::Assoc: Sized`
-    //~| ERROR overflow evaluating the requirement `<T as Foo>::Assoc: Bar`
+    //~^ ERROR the trait bound `<T as Foo>::Assoc: Bar` is not satisfied
 }
 
 fn main() {}
diff --git a/tests/ui/traits/next-solver/overflow/recursive-self-normalization.stderr b/tests/ui/traits/next-solver/overflow/recursive-self-normalization.stderr
index af8504dcaee..c5518234687 100644
--- a/tests/ui/traits/next-solver/overflow/recursive-self-normalization.stderr
+++ b/tests/ui/traits/next-solver/overflow/recursive-self-normalization.stderr
@@ -1,59 +1,19 @@
-error[E0275]: overflow evaluating the requirement `<T as Foo>::Assoc == _`
+error[E0277]: the trait bound `<T as Foo>::Assoc: Bar` is not satisfied
   --> $DIR/recursive-self-normalization.rs:11:17
    |
 LL |     needs_bar::<T::Assoc>();
-   |                 ^^^^^^^^
-
-error[E0275]: overflow evaluating the requirement `<T as Foo>::Assoc: Bar`
-  --> $DIR/recursive-self-normalization.rs:11:17
-   |
-LL |     needs_bar::<T::Assoc>();
-   |                 ^^^^^^^^
+   |                 ^^^^^^^^ the trait `Bar` is not implemented for `<T as Foo>::Assoc`
    |
 note: required by a bound in `needs_bar`
   --> $DIR/recursive-self-normalization.rs:8:17
    |
 LL | fn needs_bar<S: Bar>() {}
    |                 ^^^ required by this bound in `needs_bar`
-
-error[E0275]: overflow evaluating the requirement `<T as Foo>::Assoc: Sized`
-  --> $DIR/recursive-self-normalization.rs:11:17
-   |
-LL |     needs_bar::<T::Assoc>();
-   |                 ^^^^^^^^
-   |
-note: required by an implicit `Sized` bound in `needs_bar`
-  --> $DIR/recursive-self-normalization.rs:8:14
-   |
-LL | fn needs_bar<S: Bar>() {}
-   |              ^ required by the implicit `Sized` requirement on this type parameter in `needs_bar`
-help: consider relaxing the implicit `Sized` restriction
-   |
-LL | fn needs_bar<S: Bar + ?Sized>() {}
-   |                     ++++++++
-
-error[E0275]: overflow evaluating the requirement `<T as Foo>::Assoc == _`
-  --> $DIR/recursive-self-normalization.rs:11:5
-   |
-LL |     needs_bar::<T::Assoc>();
-   |     ^^^^^^^^^^^^^^^^^^^^^
-
-error[E0275]: overflow evaluating the requirement `<T as Foo>::Assoc == _`
-  --> $DIR/recursive-self-normalization.rs:11:5
-   |
-LL |     needs_bar::<T::Assoc>();
-   |     ^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-
-error[E0275]: overflow evaluating the requirement `<T as Foo>::Assoc == _`
-  --> $DIR/recursive-self-normalization.rs:11:17
-   |
-LL |     needs_bar::<T::Assoc>();
-   |                 ^^^^^^^^
+help: consider further restricting the associated type
    |
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+LL | fn test<T: Foo<Assoc = <T as Foo>::Assoc>>() where <T as Foo>::Assoc: Bar {
+   |                                              ++++++++++++++++++++++++++++
 
-error: aborting due to 6 previous errors
+error: aborting due to 1 previous error
 
-For more information about this error, try `rustc --explain E0275`.
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/next-solver/well-formed-in-relate.rs b/tests/ui/traits/next-solver/well-formed-in-relate.rs
new file mode 100644
index 00000000000..eec1ddef228
--- /dev/null
+++ b/tests/ui/traits/next-solver/well-formed-in-relate.rs
@@ -0,0 +1,21 @@
+fn main() {
+    let x;
+    //~^ ERROR type annotations needed for `Map<_, _>`
+    higher_ranked();
+    x = unconstrained_map();
+}
+
+fn higher_ranked() where for<'a> &'a (): Sized {}
+
+struct Map<T, U> where T: Fn() -> U {
+    t: T,
+}
+
+trait Mirror {
+    type Assoc;
+}
+impl<T> Mirror for T {
+    type Assoc = T;
+}
+
+fn unconstrained_map<T: Fn() -> U, U>() -> <Map<T, U> as Mirror>::Assoc { todo!() }
diff --git a/tests/ui/traits/next-solver/well-formed-in-relate.stderr b/tests/ui/traits/next-solver/well-formed-in-relate.stderr
new file mode 100644
index 00000000000..5294a072d31
--- /dev/null
+++ b/tests/ui/traits/next-solver/well-formed-in-relate.stderr
@@ -0,0 +1,27 @@
+error[E0283]: type annotations needed for `Map<_, _>`
+  --> $DIR/well-formed-in-relate.rs:2:9
+   |
+LL |     let x;
+   |         ^
+...
+LL |     x = unconstrained_map();
+   |         ------------------- type must be known at this point
+   |
+   = note: multiple `impl`s satisfying `_: Fn()` found in the following crates: `alloc`, `core`:
+           - impl<A, F> Fn<A> for &F
+             where A: Tuple, F: Fn<A>, F: ?Sized;
+           - impl<Args, F, A> Fn<Args> for Box<F, A>
+             where Args: Tuple, F: Fn<Args>, A: Allocator, F: ?Sized;
+note: required by a bound in `unconstrained_map`
+  --> $DIR/well-formed-in-relate.rs:21:25
+   |
+LL | fn unconstrained_map<T: Fn() -> U, U>() -> <Map<T, U> as Mirror>::Assoc { todo!() }
+   |                         ^^^^^^^^^ required by this bound in `unconstrained_map`
+help: consider giving `x` an explicit type, where the type for type parameter `T` is specified
+   |
+LL |     let x: Map<T, U>;
+   |          +++++++++++
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/pointee-tail-is-generic-errors.rs b/tests/ui/traits/pointee-tail-is-generic-errors.rs
index 92a83f40b18..8ddac5b2f39 100644
--- a/tests/ui/traits/pointee-tail-is-generic-errors.rs
+++ b/tests/ui/traits/pointee-tail-is-generic-errors.rs
@@ -5,6 +5,7 @@
 
 type Opaque = impl std::fmt::Debug + ?Sized;
 
+#[define_opaque(Opaque)]
 fn opaque() -> &'static Opaque {
     &[1] as &[i32]
 }
diff --git a/tests/ui/traits/pointee-tail-is-generic-errors.stderr b/tests/ui/traits/pointee-tail-is-generic-errors.stderr
index 0c3d7060dd7..907f07026a4 100644
--- a/tests/ui/traits/pointee-tail-is-generic-errors.stderr
+++ b/tests/ui/traits/pointee-tail-is-generic-errors.stderr
@@ -1,5 +1,5 @@
 error[E0271]: type mismatch resolving `<T as Pointee>::Metadata == ()`
-  --> $DIR/pointee-tail-is-generic-errors.rs:13:15
+  --> $DIR/pointee-tail-is-generic-errors.rs:14:15
    |
 LL |     is_thin::<T>();
    |               ^ expected `()`, found associated type
@@ -9,13 +9,13 @@ LL |     is_thin::<T>();
    = help: consider constraining the associated type `<T as Pointee>::Metadata` to `()`
    = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
 note: required by a bound in `is_thin`
-  --> $DIR/pointee-tail-is-generic-errors.rs:20:33
+  --> $DIR/pointee-tail-is-generic-errors.rs:21:33
    |
 LL | fn is_thin<T: std::ptr::Pointee<Metadata = ()> + ?Sized>() {}
    |                                 ^^^^^^^^^^^^^ required by this bound in `is_thin`
 
 error[E0271]: type mismatch resolving `<Opaque as Pointee>::Metadata == ()`
-  --> $DIR/pointee-tail-is-generic-errors.rs:16:15
+  --> $DIR/pointee-tail-is-generic-errors.rs:17:15
    |
 LL | type Opaque = impl std::fmt::Debug + ?Sized;
    |               ----------------------------- the found opaque type
@@ -26,7 +26,7 @@ LL |     is_thin::<Opaque>();
    = note:    expected unit type `()`
            found associated type `<Opaque as Pointee>::Metadata`
 note: required by a bound in `is_thin`
-  --> $DIR/pointee-tail-is-generic-errors.rs:20:33
+  --> $DIR/pointee-tail-is-generic-errors.rs:21:33
    |
 LL | fn is_thin<T: std::ptr::Pointee<Metadata = ()> + ?Sized>() {}
    |                                 ^^^^^^^^^^^^^ required by this bound in `is_thin`
diff --git a/tests/ui/traits/pointee-tail-is-generic.rs b/tests/ui/traits/pointee-tail-is-generic.rs
index 14bdf0880c7..b41fb61e4a4 100644
--- a/tests/ui/traits/pointee-tail-is-generic.rs
+++ b/tests/ui/traits/pointee-tail-is-generic.rs
@@ -4,12 +4,11 @@
 #![feature(ptr_metadata)]
 #![feature(type_alias_impl_trait)]
 
-mod opaque {
-    pub type Opaque = impl std::future::Future;
+pub type Opaque = impl std::future::Future;
 
-    fn opaque() -> Opaque {
-        async {}
-    }
+#[define_opaque(Opaque)]
+fn opaque() -> Opaque {
+    async {}
 }
 
 fn a<T>() {
@@ -18,7 +17,7 @@ fn a<T>() {
     // tail of ADT (which is a type param) is known to be sized
     is_thin::<std::cell::Cell<T>>();
     // opaque type is known to be sized
-    is_thin::<opaque::Opaque>();
+    is_thin::<Opaque>();
 }
 
 fn a2<T: Iterator>() {
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 55a5e4cd497..0fca91fd2f2 100644
--- a/tests/ui/traits/trait-upcasting/type-checking-test-4.stderr
+++ b/tests/ui/traits/trait-upcasting/type-checking-test-4.stderr
@@ -7,12 +7,12 @@ LL |     let _ = x as &dyn Bar<'static, 'a>; // Error
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^ cast requires that `'a` must outlive `'static`
 
 error: lifetime may not live long enough
-  --> $DIR/type-checking-test-4.rs:22:18
+  --> $DIR/type-checking-test-4.rs:22:13
    |
 LL | fn test_wrong2<'a>(x: &dyn Foo<'static>, y: &'a u32) {
    |                -- lifetime `'a` defined here
 LL |     let _ = x as &dyn Bar<'a, 'static>; // 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:28:5
diff --git a/tests/ui/traits/trait-upcasting/type-checking-test-opaques.rs b/tests/ui/traits/trait-upcasting/type-checking-test-opaques.rs
index ab3817da28b..ed852ef986a 100644
--- a/tests/ui/traits/trait-upcasting/type-checking-test-opaques.rs
+++ b/tests/ui/traits/trait-upcasting/type-checking-test-opaques.rs
@@ -15,6 +15,7 @@ fn test_correct2<'a>(x: &dyn Foo<'a>) {
     let _ = x as &dyn Bar<'_, '_, Tait>;
 }
 
+#[define_opaque(Tait)]
 fn test_correct3<'a>(x: &dyn Foo<'a>, _: Tait) {
     let _ = x as &dyn Bar<'_, '_, ()>;
 }
diff --git a/tests/ui/traits/trait-upcasting/upcast-defining-opaque.rs b/tests/ui/traits/trait-upcasting/upcast-defining-opaque.rs
index 0548eda0468..3e36ce0dc72 100644
--- a/tests/ui/traits/trait-upcasting/upcast-defining-opaque.rs
+++ b/tests/ui/traits/trait-upcasting/upcast-defining-opaque.rs
@@ -17,6 +17,7 @@ impl<T: ?Sized> Super for T {
 
 type Foo = impl Sized;
 
+#[define_opaque(Foo)]
 fn upcast(x: &dyn Sub<Assoc = Foo>) -> &dyn Super<Assoc = i32> {
     x
 }
diff --git a/tests/ui/transmutability/malformed-program-gracefulness/coherence-bikeshed-intrinsic-from.stderr b/tests/ui/transmutability/malformed-program-gracefulness/coherence-bikeshed-intrinsic-from.stderr
index cdf9deecd51..7f51d1519db 100644
--- a/tests/ui/transmutability/malformed-program-gracefulness/coherence-bikeshed-intrinsic-from.stderr
+++ b/tests/ui/transmutability/malformed-program-gracefulness/coherence-bikeshed-intrinsic-from.stderr
@@ -19,7 +19,7 @@ error: unconstrained opaque type
 LL | type OpaqueType = impl OpaqueTrait;
    |                   ^^^^^^^^^^^^^^^^
    |
-   = note: `OpaqueType` must be used in combination with a concrete type within the same module
+   = note: `OpaqueType` must be used in combination with a concrete type within the same crate
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/transmutability/uninhabited.stderr b/tests/ui/transmutability/uninhabited.stderr
index 39f8bf19c36..4c5c4107a85 100644
--- a/tests/ui/transmutability/uninhabited.stderr
+++ b/tests/ui/transmutability/uninhabited.stderr
@@ -3,24 +3,18 @@ error[E0080]: evaluation of constant value failed
    |
 LL |         assert!(false);
    |         ^^^^^^^^^^^^^^ evaluation panicked: assertion failed: false
-   |
-   = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/uninhabited.rs:63:9
    |
 LL |         assert!(false);
    |         ^^^^^^^^^^^^^^ evaluation panicked: assertion failed: false
-   |
-   = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/uninhabited.rs:87:9
    |
 LL |         assert!(false);
    |         ^^^^^^^^^^^^^^ evaluation panicked: assertion failed: false
-   |
-   = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: `()` cannot be safely transmuted into `void::Void`
   --> $DIR/uninhabited.rs:29:41
diff --git a/tests/ui/treat-err-as-bug/span_delayed_bug.rs b/tests/ui/treat-err-as-bug/span_delayed_bug.rs
index 296bdd7a12d..88a9d07c94c 100644
--- a/tests/ui/treat-err-as-bug/span_delayed_bug.rs
+++ b/tests/ui/treat-err-as-bug/span_delayed_bug.rs
@@ -8,5 +8,5 @@
 
 #![feature(rustc_attrs)]
 
-#[rustc_error(delayed_bug_from_inside_query)]
+#[rustc_delayed_bug_from_inside_query]
 fn main() {}
diff --git a/tests/ui/treat-err-as-bug/span_delayed_bug.stderr b/tests/ui/treat-err-as-bug/span_delayed_bug.stderr
index aec1b89c766..1c8d279c14c 100644
--- a/tests/ui/treat-err-as-bug/span_delayed_bug.stderr
+++ b/tests/ui/treat-err-as-bug/span_delayed_bug.stderr
@@ -1,4 +1,4 @@
-error: internal compiler error: delayed bug triggered by #[rustc_error(delayed_bug_from_inside_query)]
+error: internal compiler error: delayed bug triggered by #[rustc_delayed_bug_from_inside_query]
   --> $DIR/span_delayed_bug.rs:12:1
    |
 LL | fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/argument-types.rs b/tests/ui/type-alias-impl-trait/argument-types.rs
index 7382d4c78c7..ea87bcb3e45 100644
--- a/tests/ui/type-alias-impl-trait/argument-types.rs
+++ b/tests/ui/type-alias-impl-trait/argument-types.rs
@@ -2,20 +2,19 @@
 #![allow(dead_code)]
 //@ check-pass
 
-mod foo {
-    use std::fmt::Debug;
+use std::fmt::Debug;
 
-    pub type Foo = impl Debug;
+pub type Foo = impl Debug;
 
-    fn foo1(mut x: Foo) {
-        x = 22_u32;
-    }
+#[define_opaque(Foo)]
+fn foo1(mut x: Foo) {
+    x = 22_u32;
+}
 
-    pub fn foo_value() -> Foo {
-        11_u32
-    }
+#[define_opaque(Foo)]
+pub fn foo_value() -> Foo {
+    11_u32
 }
-use foo::*;
 
 fn foo2(mut x: Foo) {
     // no constraint on x
diff --git a/tests/ui/type-alias-impl-trait/assoc-projection-ice.rs b/tests/ui/type-alias-impl-trait/assoc-projection-ice.rs
index 9dcbc75db3f..97c1c1b64cc 100644
--- a/tests/ui/type-alias-impl-trait/assoc-projection-ice.rs
+++ b/tests/ui/type-alias-impl-trait/assoc-projection-ice.rs
@@ -2,23 +2,21 @@
 
 //@ build-pass
 
-mod helper {
-    pub trait T {
-        type Item;
-    }
+pub trait T {
+    type Item;
+}
 
-    pub type Alias<'a> = impl T<Item = &'a ()>;
+pub type Alias<'a> = impl T<Item = &'a ()>;
 
-    struct S;
-    impl<'a> T for &'a S {
-        type Item = &'a ();
-    }
+struct S;
+impl<'a> T for &'a S {
+    type Item = &'a ();
+}
 
-    pub fn filter_positive<'a>() -> Alias<'a> {
-        &S
-    }
+#[define_opaque(Alias)]
+pub fn filter_positive<'a>() -> Alias<'a> {
+    &S
 }
-use helper::*;
 
 fn with_positive(fun: impl Fn(Alias<'_>)) {
     fun(filter_positive());
diff --git a/tests/ui/type-alias-impl-trait/associated-type-alias-impl-trait.rs b/tests/ui/type-alias-impl-trait/associated-type-alias-impl-trait.rs
index a1185cd5ba8..6761835be89 100644
--- a/tests/ui/type-alias-impl-trait/associated-type-alias-impl-trait.rs
+++ b/tests/ui/type-alias-impl-trait/associated-type-alias-impl-trait.rs
@@ -15,9 +15,11 @@ type Helper = impl Bar;
 
 impl Foo for i32 {
     type Assoc = Helper;
+    #[define_opaque(Helper)]
     fn foo() -> Helper {
         Dummy
     }
+    #[define_opaque(Helper)]
     fn bar() -> Helper {
         Dummy
     }
diff --git a/tests/ui/type-alias-impl-trait/auto-trait-leakage.rs b/tests/ui/type-alias-impl-trait/auto-trait-leakage.rs
index a03a146d041..cf385223ce4 100644
--- a/tests/ui/type-alias-impl-trait/auto-trait-leakage.rs
+++ b/tests/ui/type-alias-impl-trait/auto-trait-leakage.rs
@@ -3,16 +3,15 @@
 #![feature(type_alias_impl_trait)]
 #![allow(dead_code)]
 
-mod m {
-    pub(crate) type Foo = impl std::fmt::Debug;
+pub(crate) type Foo = impl std::fmt::Debug;
 
-    pub(crate) fn foo() -> Foo {
-        22_u32
-    }
+#[define_opaque(Foo)]
+pub(crate) fn foo() -> Foo {
+    22_u32
 }
 
 fn is_send<T: Send>(_: T) {}
 
 fn main() {
-    is_send(m::foo());
+    is_send(foo());
 }
diff --git a/tests/ui/type-alias-impl-trait/auto-trait-leakage2.rs b/tests/ui/type-alias-impl-trait/auto-trait-leakage2.rs
index fc89b0e870e..6132eef0db5 100644
--- a/tests/ui/type-alias-impl-trait/auto-trait-leakage2.rs
+++ b/tests/ui/type-alias-impl-trait/auto-trait-leakage2.rs
@@ -1,16 +1,15 @@
 #![feature(type_alias_impl_trait)]
 #![allow(dead_code)]
 
-mod m {
-    use std::rc::Rc;
+use std::rc::Rc;
 
-    type Foo = impl std::fmt::Debug; //~ NOTE appears within the type
-    //~^ within this `Foo`
-    //~| expansion of desugaring
+type Foo = impl std::fmt::Debug; //~ NOTE appears within the type
+//~^ within this `Foo`
+//~| expansion of desugaring
 
-    pub fn foo() -> Foo {
-        Rc::new(22_u32)
-    }
+#[define_opaque(Foo)]
+pub fn foo() -> Foo {
+    Rc::new(22_u32)
 }
 
 fn is_send<T: Send>(_: T) {}
@@ -18,7 +17,7 @@ fn is_send<T: Send>(_: T) {}
 //~| required by a bound
 
 fn main() {
-    is_send(m::foo());
+    is_send(foo());
     //~^ ERROR: `Rc<u32>` cannot be sent between threads safely [E0277]
     //~| NOTE cannot be sent
     //~| NOTE required by a bound
diff --git a/tests/ui/type-alias-impl-trait/auto-trait-leakage2.stderr b/tests/ui/type-alias-impl-trait/auto-trait-leakage2.stderr
index 2ed918eca17..d2db468b519 100644
--- a/tests/ui/type-alias-impl-trait/auto-trait-leakage2.stderr
+++ b/tests/ui/type-alias-impl-trait/auto-trait-leakage2.stderr
@@ -1,22 +1,22 @@
 error[E0277]: `Rc<u32>` cannot be sent between threads safely
-  --> $DIR/auto-trait-leakage2.rs:21:13
+  --> $DIR/auto-trait-leakage2.rs:20:13
    |
-LL |     type Foo = impl std::fmt::Debug;
-   |                -------------------- within this `Foo`
+LL | type Foo = impl std::fmt::Debug;
+   |            -------------------- within this `Foo`
 ...
-LL |     is_send(m::foo());
-   |     ------- ^^^^^^^^ `Rc<u32>` cannot be sent between threads safely
+LL |     is_send(foo());
+   |     ------- ^^^^^ `Rc<u32>` cannot be sent between threads safely
    |     |
    |     required by a bound introduced by this call
    |
    = help: within `Foo`, the trait `Send` is not implemented for `Rc<u32>`
 note: required because it appears within the type `Foo`
-  --> $DIR/auto-trait-leakage2.rs:7:16
+  --> $DIR/auto-trait-leakage2.rs:6:12
    |
-LL |     type Foo = impl std::fmt::Debug;
-   |                ^^^^^^^^^^^^^^^^^^^^
+LL | type Foo = impl std::fmt::Debug;
+   |            ^^^^^^^^^^^^^^^^^^^^
 note: required by a bound in `is_send`
-  --> $DIR/auto-trait-leakage2.rs:16:15
+  --> $DIR/auto-trait-leakage2.rs:15:15
    |
 LL | fn is_send<T: Send>(_: T) {}
    |               ^^^^ required by this bound in `is_send`
diff --git a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs b/tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs
index cad75cffe05..3e0bd3b6521 100644
--- a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs
+++ b/tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs
@@ -1,17 +1,17 @@
 #![feature(type_alias_impl_trait)]
 #![allow(dead_code)]
 
-// FIXME This should compile, but it currently doesn't
+//@ check-pass
 
 mod m {
     pub type Foo = impl std::fmt::Debug;
+    #[define_opaque(Foo)]
     pub fn foo() -> Foo {
         22_u32
     }
 
     pub fn bar() {
         is_send(foo());
-        //~^ ERROR: cannot check whether the hidden type of `auto_trait_leakage3[211d]::m::Foo::{opaque#0}
     }
 
     fn is_send<T: Send>(_: T) {}
diff --git a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr b/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr
deleted file mode 100644
index 6bdc76aab45..00000000000
--- a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr
+++ /dev/null
@@ -1,22 +0,0 @@
-error: cannot check whether the hidden type of `auto_trait_leakage3[211d]::m::Foo::{opaque#0}` satisfies auto traits
-  --> $DIR/auto-trait-leakage3.rs:13:17
-   |
-LL |         is_send(foo());
-   |         ------- ^^^^^
-   |         |
-   |         required by a bound introduced by this call
-   |
-   = note: fetching the hidden types of an opaque inside of the defining scope is not supported. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
-note: opaque type is declared here
-  --> $DIR/auto-trait-leakage3.rs:7:20
-   |
-LL |     pub type Foo = impl std::fmt::Debug;
-   |                    ^^^^^^^^^^^^^^^^^^^^
-note: required by a bound in `is_send`
-  --> $DIR/auto-trait-leakage3.rs:17:19
-   |
-LL |     fn is_send<T: Send>(_: T) {}
-   |                   ^^^^ required by this bound in `is_send`
-
-error: aborting due to 1 previous error
-
diff --git a/tests/ui/type-alias-impl-trait/auxiliary/cross_crate_ice.rs b/tests/ui/type-alias-impl-trait/auxiliary/cross_crate_ice.rs
index e7bca2231de..c60fd0b6798 100644
--- a/tests/ui/type-alias-impl-trait/auxiliary/cross_crate_ice.rs
+++ b/tests/ui/type-alias-impl-trait/auxiliary/cross_crate_ice.rs
@@ -5,6 +5,7 @@
 
 pub type Foo = impl std::fmt::Debug;
 
+#[define_opaque(Foo)]
 pub fn foo() -> Foo {
     5
 }
diff --git a/tests/ui/type-alias-impl-trait/auxiliary/drop-shim-relates-opaque-aux.rs b/tests/ui/type-alias-impl-trait/auxiliary/drop-shim-relates-opaque-aux.rs
index 54a22510066..3c823d3e5d2 100644
--- a/tests/ui/type-alias-impl-trait/auxiliary/drop-shim-relates-opaque-aux.rs
+++ b/tests/ui/type-alias-impl-trait/auxiliary/drop-shim-relates-opaque-aux.rs
@@ -3,6 +3,7 @@
 #![feature(type_alias_impl_trait)]
 
 type Tait = impl Sized;
+#[define_opaque(Tait)]
 fn _constrain() -> Tait {}
 
 struct WrapperWithDrop<T>(T);
diff --git a/tests/ui/type-alias-impl-trait/bad-tait-no-substs.rs b/tests/ui/type-alias-impl-trait/bad-tait-no-substs.rs
index 4b2ee344aa3..b6870b16450 100644
--- a/tests/ui/type-alias-impl-trait/bad-tait-no-substs.rs
+++ b/tests/ui/type-alias-impl-trait/bad-tait-no-substs.rs
@@ -8,9 +8,9 @@ pub enum UninhabitedVariants {
     Tuple(Alias),
     //~^ ERROR missing lifetime specifier
     //~| ERROR missing generics
-    //~| ERROR non-defining opaque type use in defining scope
 }
 
+#[define_opaque(Alias)]
 fn uwu(x: UninhabitedVariants) {
     //~^ ERROR item does not constrain
     match x {}
diff --git a/tests/ui/type-alias-impl-trait/bad-tait-no-substs.stderr b/tests/ui/type-alias-impl-trait/bad-tait-no-substs.stderr
index 38fbff9d59d..59909197e7b 100644
--- a/tests/ui/type-alias-impl-trait/bad-tait-no-substs.stderr
+++ b/tests/ui/type-alias-impl-trait/bad-tait-no-substs.stderr
@@ -26,26 +26,14 @@ help: add missing generic argument
 LL |     Tuple(Alias<U>),
    |                +++
 
-error[E0792]: non-defining opaque type use in defining scope
-  --> $DIR/bad-tait-no-substs.rs:8:11
-   |
-LL |     Tuple(Alias),
-   |           ^^^^^ argument `'_` is not a generic parameter
-   |
-note: for this opaque type
-  --> $DIR/bad-tait-no-substs.rs:5:21
-   |
-LL | type Alias<'a, U> = impl Trait<U>;
-   |                     ^^^^^^^^^^^^^
-
-error: item does not constrain `Alias::{opaque#0}`, but has it in its signature
+error: item does not constrain `Alias::{opaque#0}`
   --> $DIR/bad-tait-no-substs.rs:14:4
    |
 LL | fn uwu(x: UninhabitedVariants) {
    |    ^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
   --> $DIR/bad-tait-no-substs.rs:5:21
    |
 LL | type Alias<'a, U> = impl Trait<U>;
@@ -72,7 +60,7 @@ LL +         UninhabitedVariants::Tuple(_) => todo!(),
 LL ~     }
    |
 
-error: aborting due to 5 previous errors
+error: aborting due to 4 previous errors
 
-Some errors have detailed explanations: E0004, E0106, E0107, E0792.
+Some errors have detailed explanations: E0004, E0106, E0107.
 For more information about an error, try `rustc --explain E0004`.
diff --git a/tests/ui/type-alias-impl-trait/bivariant-duplicate-lifetime-unconstrained.rs b/tests/ui/type-alias-impl-trait/bivariant-duplicate-lifetime-unconstrained.rs
index 3b83b2e544b..4dba8d7b230 100644
--- a/tests/ui/type-alias-impl-trait/bivariant-duplicate-lifetime-unconstrained.rs
+++ b/tests/ui/type-alias-impl-trait/bivariant-duplicate-lifetime-unconstrained.rs
@@ -11,6 +11,7 @@
 
 type Opaque<'a> = impl Sized + 'a;
 
+#[define_opaque(Opaque)]
 fn test<'a>() -> Opaque<'a> {
     let _: () = test::<'a>();
 }
diff --git a/tests/ui/type-alias-impl-trait/bound-lifetime-through-dyn-trait.rs b/tests/ui/type-alias-impl-trait/bound-lifetime-through-dyn-trait.rs
index df589473a84..e714aca812b 100644
--- a/tests/ui/type-alias-impl-trait/bound-lifetime-through-dyn-trait.rs
+++ b/tests/ui/type-alias-impl-trait/bound-lifetime-through-dyn-trait.rs
@@ -9,7 +9,7 @@ fn dyn_hoops<T: Sized>() -> dyn for<'a> Iterator<Item = impl Captures<'a>> {
 }
 
 pub fn main() {
-    //~^ ERROR item does not constrain `Opaque::{opaque#0}`, but has it in its signature
+    //~^ ERROR item does not constrain `Opaque::{opaque#0}`
     type Opaque = impl Sized;
     fn define() -> Opaque {
         let x: Opaque = dyn_hoops::<()>();
diff --git a/tests/ui/type-alias-impl-trait/bound-lifetime-through-dyn-trait.stderr b/tests/ui/type-alias-impl-trait/bound-lifetime-through-dyn-trait.stderr
index 59d9ff86c6e..7219fda4772 100644
--- a/tests/ui/type-alias-impl-trait/bound-lifetime-through-dyn-trait.stderr
+++ b/tests/ui/type-alias-impl-trait/bound-lifetime-through-dyn-trait.stderr
@@ -10,14 +10,14 @@ note: lifetime declared here
 LL | fn dyn_hoops<T: Sized>() -> dyn for<'a> Iterator<Item = impl Captures<'a>> {
    |                                     ^^
 
-error: item does not constrain `Opaque::{opaque#0}`, but has it in its signature
+error: item does not constrain `Opaque::{opaque#0}`
   --> $DIR/bound-lifetime-through-dyn-trait.rs:11:8
    |
 LL | pub fn main() {
    |        ^^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
   --> $DIR/bound-lifetime-through-dyn-trait.rs:13:19
    |
 LL |     type Opaque = impl Sized;
diff --git a/tests/ui/type-alias-impl-trait/bound_reduction.rs b/tests/ui/type-alias-impl-trait/bound_reduction.rs
index 74012e34e92..5966b5cc815 100644
--- a/tests/ui/type-alias-impl-trait/bound_reduction.rs
+++ b/tests/ui/type-alias-impl-trait/bound_reduction.rs
@@ -10,6 +10,7 @@ type Foo<V> = impl std::fmt::Debug;
 
 trait Trait<U> {}
 
+#[define_opaque(Foo)]
 fn foo_desugared<T: Trait<[u32; {
     #[no_mangle]
     static FOO: usize = 42;
diff --git a/tests/ui/type-alias-impl-trait/bound_reduction2.rs b/tests/ui/type-alias-impl-trait/bound_reduction2.rs
index 4e9f65d88a1..78288caffef 100644
--- a/tests/ui/type-alias-impl-trait/bound_reduction2.rs
+++ b/tests/ui/type-alias-impl-trait/bound_reduction2.rs
@@ -12,8 +12,8 @@ trait Trait<U> {}
 
 impl<W> Trait<W> for () {}
 
+#[define_opaque(Foo)]
 fn foo_desugared<T: TraitWithAssoc>(_: T) -> Foo<T::Assoc> {
-    //~^ ERROR non-defining opaque type use
     ()
     //~^ ERROR expected generic type parameter, found `<T as TraitWithAssoc>::Assoc`
 }
diff --git a/tests/ui/type-alias-impl-trait/bound_reduction2.stderr b/tests/ui/type-alias-impl-trait/bound_reduction2.stderr
index 14f9dbbdb4e..289826cc1d0 100644
--- a/tests/ui/type-alias-impl-trait/bound_reduction2.stderr
+++ b/tests/ui/type-alias-impl-trait/bound_reduction2.stderr
@@ -1,15 +1,3 @@
-error[E0792]: non-defining opaque type use in defining scope
-  --> $DIR/bound_reduction2.rs:15:46
-   |
-LL | fn foo_desugared<T: TraitWithAssoc>(_: T) -> Foo<T::Assoc> {
-   |                                              ^^^^^^^^^^^^^ argument `<T as TraitWithAssoc>::Assoc` is not a generic parameter
-   |
-note: for this opaque type
-  --> $DIR/bound_reduction2.rs:9:15
-   |
-LL | type Foo<V> = impl Trait<V>;
-   |               ^^^^^^^^^^^^^
-
 error[E0792]: expected generic type parameter, found `<T as TraitWithAssoc>::Assoc`
   --> $DIR/bound_reduction2.rs:17:5
    |
@@ -19,6 +7,6 @@ LL | type Foo<V> = impl Trait<V>;
 LL |     ()
    |     ^^
 
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
 For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/type-alias-impl-trait/bounds-are-checked-2.rs b/tests/ui/type-alias-impl-trait/bounds-are-checked-2.rs
index 45f54266014..4151a6a5f12 100644
--- a/tests/ui/type-alias-impl-trait/bounds-are-checked-2.rs
+++ b/tests/ui/type-alias-impl-trait/bounds-are-checked-2.rs
@@ -3,15 +3,13 @@
 
 #![feature(type_alias_impl_trait)]
 
-mod foo {
-    pub type X<T> = impl Clone;
+pub type X<T> = impl Clone;
 
-    fn f<T: Clone>(t: T) -> X<T> {
-        t
-        //~^ ERROR the trait bound `T: Clone` is not satisfied
-    }
+#[define_opaque(X)]
+fn f<T: Clone>(t: T) -> X<T> {
+    t
+    //~^ ERROR the trait bound `T: Clone` is not satisfied
 }
-use foo::X;
 
 fn g<T>(o: Option<X<T>>) -> Option<X<T>> {
     o.clone()
diff --git a/tests/ui/type-alias-impl-trait/bounds-are-checked-2.stderr b/tests/ui/type-alias-impl-trait/bounds-are-checked-2.stderr
index bbb32b2d604..21166631c3e 100644
--- a/tests/ui/type-alias-impl-trait/bounds-are-checked-2.stderr
+++ b/tests/ui/type-alias-impl-trait/bounds-are-checked-2.stderr
@@ -1,23 +1,23 @@
 error[E0277]: the trait bound `T: Clone` is not satisfied
-  --> $DIR/bounds-are-checked-2.rs:10:9
+  --> $DIR/bounds-are-checked-2.rs:10:5
    |
-LL |         t
-   |         ^ the trait `Clone` is not implemented for `T`
+LL |     t
+   |     ^ the trait `Clone` is not implemented for `T`
    |
 note: required by a bound in an opaque type
-  --> $DIR/bounds-are-checked-2.rs:7:26
+  --> $DIR/bounds-are-checked-2.rs:6:22
    |
-LL |     pub type X<T> = impl Clone;
-   |                          ^^^^^
+LL | pub type X<T> = impl Clone;
+   |                      ^^^^^
 note: this definition site has more where clauses than the opaque type
-  --> $DIR/bounds-are-checked-2.rs:9:5
+  --> $DIR/bounds-are-checked-2.rs:9:1
    |
-LL |     fn f<T: Clone>(t: T) -> X<T> {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | fn f<T: Clone>(t: T) -> X<T> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: consider restricting type parameter `T` with trait `Clone`
    |
-LL |     pub type X<T: std::clone::Clone> = impl Clone;
-   |                 +++++++++++++++++++
+LL | pub type X<T: std::clone::Clone> = impl Clone;
+   |             +++++++++++++++++++
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/type-alias-impl-trait/bounds-are-checked.rs b/tests/ui/type-alias-impl-trait/bounds-are-checked.rs
index 7c3a3a84406..3d295358728 100644
--- a/tests/ui/type-alias-impl-trait/bounds-are-checked.rs
+++ b/tests/ui/type-alias-impl-trait/bounds-are-checked.rs
@@ -5,6 +5,7 @@
 
 type X<'a> = impl Into<&'static str> + From<&'a str>;
 
+#[define_opaque(X)]
 fn f<'a: 'static>(t: &'a str) -> X<'a> {
     t
     //~^ ERROR expected generic lifetime parameter, found `'static`
diff --git a/tests/ui/type-alias-impl-trait/bounds-are-checked.stderr b/tests/ui/type-alias-impl-trait/bounds-are-checked.stderr
index ad1b9f19d8e..7617268dd8e 100644
--- a/tests/ui/type-alias-impl-trait/bounds-are-checked.stderr
+++ b/tests/ui/type-alias-impl-trait/bounds-are-checked.stderr
@@ -1,5 +1,5 @@
 error[E0792]: expected generic lifetime parameter, found `'static`
-  --> $DIR/bounds-are-checked.rs:9:5
+  --> $DIR/bounds-are-checked.rs:10:5
    |
 LL | type X<'a> = impl Into<&'static str> + From<&'a str>;
    |        -- cannot use static lifetime; use a bound lifetime instead or remove the lifetime parameter from the opaque type
diff --git a/tests/ui/type-alias-impl-trait/bounds-are-checked3.rs b/tests/ui/type-alias-impl-trait/bounds-are-checked3.rs
index 5a9e87c0919..a8524770a85 100644
--- a/tests/ui/type-alias-impl-trait/bounds-are-checked3.rs
+++ b/tests/ui/type-alias-impl-trait/bounds-are-checked3.rs
@@ -9,6 +9,7 @@ struct Struct<V: Display>(Option<V>);
 type Foo<T: Debug> = (impl Debug, Struct<T>);
 //~^ ERROR: `T` doesn't implement `std::fmt::Display`
 
+#[define_opaque(Foo)]
 fn foo<U: Debug + Display>() -> Foo<U> {
     (Vec::<U>::new(), Struct(None))
 }
diff --git a/tests/ui/type-alias-impl-trait/bounds.rs b/tests/ui/type-alias-impl-trait/bounds.rs
index 8e24a937d1d..c131d52a4ba 100644
--- a/tests/ui/type-alias-impl-trait/bounds.rs
+++ b/tests/ui/type-alias-impl-trait/bounds.rs
@@ -9,6 +9,7 @@ use std::fmt::Debug;
 // type alias bounds.
 type Foo<T: Debug> = (impl Debug, usize);
 
+#[define_opaque(Foo)]
 fn foo<U: Debug>() -> Foo<U> {
     (Vec::<U>::new(), 1234)
 }
diff --git a/tests/ui/type-alias-impl-trait/closure-normalization-ice-109020.rs b/tests/ui/type-alias-impl-trait/closure-normalization-ice-109020.rs
index 0dfa1f40ae6..7fd8fa6f9db 100644
--- a/tests/ui/type-alias-impl-trait/closure-normalization-ice-109020.rs
+++ b/tests/ui/type-alias-impl-trait/closure-normalization-ice-109020.rs
@@ -6,14 +6,12 @@
 
 use std::marker::PhantomData;
 
-mod foo {
-    pub type WithEmplacableForFn<'a> = impl super::EmplacableFn + 'a;
+type WithEmplacableForFn<'a> = impl EmplacableFn + 'a;
 
-    fn _constrain(_: &mut ()) -> WithEmplacableForFn<'_> {
-        ()
-    }
+#[define_opaque(WithEmplacableForFn)]
+fn _constrain(_: &mut ()) -> WithEmplacableForFn<'_> {
+    ()
 }
-use foo::*;
 
 fn with_emplacable_for<'a, F, R>(mut f: F) -> R
 where
diff --git a/tests/ui/type-alias-impl-trait/closure_args.rs b/tests/ui/type-alias-impl-trait/closure_args.rs
index 0141a01aad0..8a518c19dba 100644
--- a/tests/ui/type-alias-impl-trait/closure_args.rs
+++ b/tests/ui/type-alias-impl-trait/closure_args.rs
@@ -4,21 +4,19 @@
 
 #![feature(type_alias_impl_trait)]
 
-mod foo {
-    pub trait Anything {}
-    impl<T> Anything for T {}
-    pub type Input = impl Anything;
+pub trait Anything {}
+impl<T> Anything for T {}
+pub type Input = impl Anything;
 
-    fn bop(_: Input) {
-        super::run(
-            |x: u32| {
-                println!("{x}");
-            },
-            0,
-        );
-    }
+#[define_opaque(Input)]
+fn bop(_: Input) {
+    run(
+        |x: u32| {
+            println!("{x}");
+        },
+        0,
+    );
 }
-use foo::Input;
 
 fn run<F: FnOnce(Input) -> ()>(f: F, i: Input) {
     f(i);
diff --git a/tests/ui/type-alias-impl-trait/closure_args2.rs b/tests/ui/type-alias-impl-trait/closure_args2.rs
index 13ac3d31d83..257c5f86633 100644
--- a/tests/ui/type-alias-impl-trait/closure_args2.rs
+++ b/tests/ui/type-alias-impl-trait/closure_args2.rs
@@ -2,27 +2,25 @@
 
 #![feature(type_alias_impl_trait)]
 
-mod foo {
-    pub trait Foo {
-        // This was reachable in https://github.com/rust-lang/rust/issues/100800
-        fn foo(&self) {
-            unreachable!()
-        }
+pub trait Foo {
+    // This was reachable in https://github.com/rust-lang/rust/issues/100800
+    fn foo(&self) {
+        unreachable!()
     }
-    impl<T> Foo for T {}
+}
+impl<T> Foo for T {}
 
-    pub struct B;
-    impl B {
-        fn foo(&self) {}
-    }
-    pub type Input = impl Foo;
-    fn bop() -> Input {
-        super::run1(|x: B| x.foo(), B);
-        super::run2(|x: B| x.foo(), B);
-        panic!()
-    }
+pub struct B;
+impl B {
+    fn foo(&self) {}
+}
+pub type Input = impl Foo;
+#[define_opaque(Input)]
+fn bop() -> Input {
+    run1(|x: B| x.foo(), B);
+    run2(|x: B| x.foo(), B);
+    panic!()
 }
-use foo::*;
 
 fn run1<F: FnOnce(Input)>(f: F, i: Input) {
     f(i)
diff --git a/tests/ui/type-alias-impl-trait/closure_infer.rs b/tests/ui/type-alias-impl-trait/closure_infer.rs
index fa0514c34a0..2aa19913ad6 100644
--- a/tests/ui/type-alias-impl-trait/closure_infer.rs
+++ b/tests/ui/type-alias-impl-trait/closure_infer.rs
@@ -22,12 +22,14 @@ impl StreamConsumer for DispatchExecutor {
 
 // Functions that constrain TAITs can contain closures with an `_` in the return type.
 type Foo = impl Sized;
+#[define_opaque(Foo)]
 fn foo() -> Foo {
     || -> _ {}
 }
 
 // The `_` in the closure return type can also be the TAIT itself.
 type Bar = impl Sized;
+#[define_opaque(Bar)]
 fn bar() -> impl FnOnce() -> Bar {
     || -> _ {}
 }
diff --git a/tests/ui/type-alias-impl-trait/closure_parent_substs.rs b/tests/ui/type-alias-impl-trait/closure_parent_substs.rs
index e78c7c16c8e..4c99778b66e 100644
--- a/tests/ui/type-alias-impl-trait/closure_parent_substs.rs
+++ b/tests/ui/type-alias-impl-trait/closure_parent_substs.rs
@@ -15,6 +15,7 @@ mod test1 {
     // Hidden type = Closure['?0]
     type Opaque = impl Sized;
 
+    #[define_opaque(Opaque)]
     fn define<'a: 'a>() -> Opaque {
         || {}
     }
@@ -31,6 +32,7 @@ mod test2 {
         &'a (): Trait,
     = impl Sized + 'a;
 
+    #[define_opaque(Opaque)]
     fn define<'a, 'x, 'y>() -> Opaque<'a>
     where
         &'a (): Trait,
@@ -52,6 +54,7 @@ mod test3 {
         (&'a (), &'b ()): Trait,
     = impl Sized + 'a + 'b;
 
+    #[define_opaque(Opaque)]
     fn define<'a, 'b, 'x>() -> Opaque<'a, 'b>
     where
         (&'a (), &'b ()): Trait,
diff --git a/tests/ui/type-alias-impl-trait/closure_wf_outlives.rs b/tests/ui/type-alias-impl-trait/closure_wf_outlives.rs
index caa9b6d979a..5316a47bbd4 100644
--- a/tests/ui/type-alias-impl-trait/closure_wf_outlives.rs
+++ b/tests/ui/type-alias-impl-trait/closure_wf_outlives.rs
@@ -13,6 +13,7 @@
 mod test1 {
     type Opaque<'a, 'b> = impl Sized + 'a + 'b;
 
+    #[define_opaque(Opaque)]
     fn define<'a, 'b>() -> Opaque<'a, 'b>
     where
         'a: 'b,
@@ -26,6 +27,7 @@ mod test1 {
 mod test2 {
     type Opaque<'a, 'b> = impl Sized + 'a + 'b;
 
+    #[define_opaque(Opaque)]
     fn define<'a, 'b, 'x>() -> Opaque<'a, 'b>
     where
         'a: 'x,
@@ -40,6 +42,7 @@ mod test2 {
 mod test2_fixed {
     type Opaque<'a: 'b, 'b> = impl Sized + 'a + 'b;
 
+    #[define_opaque(Opaque)]
     fn define<'a, 'b, 'x>() -> Opaque<'a, 'b>
     where
         'a: 'x,
@@ -53,6 +56,7 @@ mod test2_fixed {
 mod test3 {
     type Opaque<T> = impl Sized;
 
+    #[define_opaque(Opaque)]
     fn define<T>() -> Opaque<T>
     where
         T: 'static,
diff --git a/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr b/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr
index ae00d3fc667..ccba2d37fd0 100644
--- a/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr
+++ b/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr
@@ -1,5 +1,5 @@
 error[E0478]: lifetime bound not satisfied
-  --> $DIR/closure_wf_outlives.rs:20:9
+  --> $DIR/closure_wf_outlives.rs:21:9
    |
 LL |         || {}
    |         ^^^^^
@@ -16,34 +16,34 @@ LL |     type Opaque<'a, 'b> = impl Sized + 'a + 'b;
    |                     ^^
 
 error[E0803]: cannot infer an appropriate lifetime due to conflicting requirements
-  --> $DIR/closure_wf_outlives.rs:34:9
+  --> $DIR/closure_wf_outlives.rs:36:9
    |
 LL |         || {}
    |         ^^^^^
    |
 note: first, the lifetime cannot outlive the lifetime `'a` as defined here...
-  --> $DIR/closure_wf_outlives.rs:27:17
+  --> $DIR/closure_wf_outlives.rs:28:17
    |
 LL |     type Opaque<'a, 'b> = impl Sized + 'a + 'b;
    |                 ^^
 note: ...so that the declared lifetime parameter bounds are satisfied
-  --> $DIR/closure_wf_outlives.rs:34:9
+  --> $DIR/closure_wf_outlives.rs:36:9
    |
 LL |         || {}
    |         ^^^^^
 note: but, the lifetime must be valid for the lifetime `'b` as defined here...
-  --> $DIR/closure_wf_outlives.rs:27:21
+  --> $DIR/closure_wf_outlives.rs:28:21
    |
 LL |     type Opaque<'a, 'b> = impl Sized + 'a + 'b;
    |                     ^^
 note: ...so that the declared lifetime parameter bounds are satisfied
-  --> $DIR/closure_wf_outlives.rs:34:9
+  --> $DIR/closure_wf_outlives.rs:36:9
    |
 LL |         || {}
    |         ^^^^^
 
 error[E0310]: the parameter type `T` may not live long enough
-  --> $DIR/closure_wf_outlives.rs:60:9
+  --> $DIR/closure_wf_outlives.rs:64:9
    |
 LL |         || {}
    |         ^^^^^
@@ -52,7 +52,7 @@ LL |         || {}
    |         ...so that the type `T` will meet its required lifetime bounds...
    |
 note: ...that is required by this bound
-  --> $DIR/closure_wf_outlives.rs:58:12
+  --> $DIR/closure_wf_outlives.rs:62:12
    |
 LL |         T: 'static,
    |            ^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/closures_in_branches.rs b/tests/ui/type-alias-impl-trait/closures_in_branches.rs
index 7bb490bbec8..d83bf36a444 100644
--- a/tests/ui/type-alias-impl-trait/closures_in_branches.rs
+++ b/tests/ui/type-alias-impl-trait/closures_in_branches.rs
@@ -2,6 +2,7 @@
 
 type Foo = impl std::ops::FnOnce(String) -> usize;
 
+#[define_opaque(Foo)]
 fn foo(b: bool) -> Foo {
     if b {
         |x| x.len() //~ ERROR type annotations needed
@@ -10,8 +11,8 @@ fn foo(b: bool) -> Foo {
     }
 }
 
-
 type Foo1 = impl std::ops::FnOnce(String) -> usize;
+#[define_opaque(Foo1)]
 fn foo1(b: bool) -> Foo1 {
     |x| x.len()
 }
diff --git a/tests/ui/type-alias-impl-trait/closures_in_branches.stderr b/tests/ui/type-alias-impl-trait/closures_in_branches.stderr
index 9cc15f14a99..849ffd214f0 100644
--- a/tests/ui/type-alias-impl-trait/closures_in_branches.stderr
+++ b/tests/ui/type-alias-impl-trait/closures_in_branches.stderr
@@ -1,5 +1,5 @@
 error[E0282]: type annotations needed
-  --> $DIR/closures_in_branches.rs:7:10
+  --> $DIR/closures_in_branches.rs:8:10
    |
 LL |         |x| x.len()
    |          ^  - type must be known at this point
@@ -10,7 +10,7 @@ LL |         |x: /* Type */| x.len()
    |           ++++++++++++
 
 error[E0282]: type annotations needed
-  --> $DIR/closures_in_branches.rs:21:10
+  --> $DIR/closures_in_branches.rs:22:10
    |
 LL |         |x| x.len()
    |          ^  - type must be known at this point
diff --git a/tests/ui/type-alias-impl-trait/coherence.classic.stderr b/tests/ui/type-alias-impl-trait/coherence.classic.stderr
index 98badeef382..e99d4636b13 100644
--- a/tests/ui/type-alias-impl-trait/coherence.classic.stderr
+++ b/tests/ui/type-alias-impl-trait/coherence.classic.stderr
@@ -1,5 +1,5 @@
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
-  --> $DIR/coherence.rs:16:1
+  --> $DIR/coherence.rs:17:1
    |
 LL | impl foreign_crate::ForeignTrait for AliasOfForeignType<()> {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------
diff --git a/tests/ui/type-alias-impl-trait/coherence.next.stderr b/tests/ui/type-alias-impl-trait/coherence.next.stderr
index 8d718383110..6d14594e33a 100644
--- a/tests/ui/type-alias-impl-trait/coherence.next.stderr
+++ b/tests/ui/type-alias-impl-trait/coherence.next.stderr
@@ -1,5 +1,5 @@
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
-  --> $DIR/coherence.rs:16:1
+  --> $DIR/coherence.rs:17:1
    |
 LL | impl foreign_crate::ForeignTrait for AliasOfForeignType<()> {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------
diff --git a/tests/ui/type-alias-impl-trait/coherence.rs b/tests/ui/type-alias-impl-trait/coherence.rs
index 760e5210c5b..eb27c270804 100644
--- a/tests/ui/type-alias-impl-trait/coherence.rs
+++ b/tests/ui/type-alias-impl-trait/coherence.rs
@@ -9,6 +9,7 @@ trait LocalTrait {}
 impl<T> LocalTrait for foreign_crate::ForeignType<T> {}
 
 type AliasOfForeignType<T> = impl LocalTrait;
+#[define_opaque(AliasOfForeignType)]
 fn use_alias<T>(val: T) -> AliasOfForeignType<T> {
     foreign_crate::ForeignType(val)
 }
diff --git a/tests/ui/type-alias-impl-trait/coherence_cross_crate.rs b/tests/ui/type-alias-impl-trait/coherence_cross_crate.rs
index c1958e4f246..73f13f22bee 100644
--- a/tests/ui/type-alias-impl-trait/coherence_cross_crate.rs
+++ b/tests/ui/type-alias-impl-trait/coherence_cross_crate.rs
@@ -13,6 +13,7 @@ trait OtherTrait {}
 
 type Alias = impl SomeTrait;
 
+#[define_opaque(Alias)]
 fn constrain() -> Alias {
     ()
 }
diff --git a/tests/ui/type-alias-impl-trait/coherence_cross_crate.stderr b/tests/ui/type-alias-impl-trait/coherence_cross_crate.stderr
index 893a27faced..6b251cfac73 100644
--- a/tests/ui/type-alias-impl-trait/coherence_cross_crate.stderr
+++ b/tests/ui/type-alias-impl-trait/coherence_cross_crate.stderr
@@ -1,5 +1,5 @@
 error[E0119]: conflicting implementations of trait `OtherTrait` for type `Alias`
-  --> $DIR/coherence_cross_crate.rs:21:1
+  --> $DIR/coherence_cross_crate.rs:22:1
    |
 LL | impl OtherTrait for Alias {}
    | ------------------------- first implementation here
diff --git a/tests/ui/type-alias-impl-trait/coherence_different_hidden_ty.rs b/tests/ui/type-alias-impl-trait/coherence_different_hidden_ty.rs
index 39b3d535ad4..a7e251b1ab9 100644
--- a/tests/ui/type-alias-impl-trait/coherence_different_hidden_ty.rs
+++ b/tests/ui/type-alias-impl-trait/coherence_different_hidden_ty.rs
@@ -20,6 +20,7 @@ impl Trait for (TAIT, TAIT) {}
 impl Trait for (u32, i32) {}
 //~^ ERROR conflicting implementations of trait `Trait` for type `(TAIT, TAIT)`
 
+#[define_opaque(TAIT)]
 fn define() -> TAIT {}
 
 fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/coherence_generalization.rs b/tests/ui/type-alias-impl-trait/coherence_generalization.rs
index 2d7de1add49..46cde115b7f 100644
--- a/tests/ui/type-alias-impl-trait/coherence_generalization.rs
+++ b/tests/ui/type-alias-impl-trait/coherence_generalization.rs
@@ -6,6 +6,7 @@
 #![feature(type_alias_impl_trait)]
 trait Trait {}
 type Opaque<T> = impl Sized;
+#[define_opaque(Opaque)]
 fn foo<T>() -> Opaque<T> {
     ()
 }
diff --git a/tests/ui/type-alias-impl-trait/const_generic_type.infer.stderr b/tests/ui/type-alias-impl-trait/const_generic_type.infer.stderr
index 5b77bb6c2bc..dc15d530fd7 100644
--- a/tests/ui/type-alias-impl-trait/const_generic_type.infer.stderr
+++ b/tests/ui/type-alias-impl-trait/const_generic_type.infer.stderr
@@ -1,8 +1,8 @@
 error: `Bar` is forbidden as the type of a const generic parameter
-  --> $DIR/const_generic_type.rs:7:24
+  --> $DIR/const_generic_type.rs:8:24
    |
-LL | async fn test<const N: crate::Bar>() {
-   |                        ^^^^^^^^^^
+LL | async fn test<const N: Bar>() {
+   |                        ^^^
    |
    = note: the only supported types are integers, `bool`, and `char`
 
diff --git a/tests/ui/type-alias-impl-trait/const_generic_type.no_infer.stderr b/tests/ui/type-alias-impl-trait/const_generic_type.no_infer.stderr
index c7c93eee63e..241eccc5f2b 100644
--- a/tests/ui/type-alias-impl-trait/const_generic_type.no_infer.stderr
+++ b/tests/ui/type-alias-impl-trait/const_generic_type.no_infer.stderr
@@ -1,40 +1,23 @@
 error: `Bar` is forbidden as the type of a const generic parameter
-  --> $DIR/const_generic_type.rs:7:24
+  --> $DIR/const_generic_type.rs:8:24
    |
-LL | async fn test<const N: crate::Bar>() {
-   |                        ^^^^^^^^^^
+LL | async fn test<const N: Bar>() {
+   |                        ^^^
    |
    = note: the only supported types are integers, `bool`, and `char`
 
-error: item does not constrain `Bar::{opaque#0}`, but has it in its signature
-  --> $DIR/const_generic_type.rs:7:10
+error: item does not constrain `Bar::{opaque#0}`
+  --> $DIR/const_generic_type.rs:8:10
    |
-LL | async fn test<const N: crate::Bar>() {
+LL | async fn test<const N: Bar>() {
    |          ^^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
   --> $DIR/const_generic_type.rs:5:12
    |
 LL | type Bar = impl std::fmt::Display;
    |            ^^^^^^^^^^^^^^^^^^^^^^
 
-error: item does not constrain `Bar::{opaque#0}`, but has it in its signature
-  --> $DIR/const_generic_type.rs:7:38
-   |
-LL |   async fn test<const N: crate::Bar>() {
-   |  ______________________________________^
-...  |
-LL | |     let x: u32 = N;
-LL | | }
-   | |_^
-   |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
-  --> $DIR/const_generic_type.rs:5:12
-   |
-LL | type Bar = impl std::fmt::Display;
-   |            ^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
diff --git a/tests/ui/type-alias-impl-trait/const_generic_type.rs b/tests/ui/type-alias-impl-trait/const_generic_type.rs
index 7149370048b..9b38f1449f8 100644
--- a/tests/ui/type-alias-impl-trait/const_generic_type.rs
+++ b/tests/ui/type-alias-impl-trait/const_generic_type.rs
@@ -4,10 +4,10 @@
 #![feature(type_alias_impl_trait)]
 type Bar = impl std::fmt::Display;
 
-async fn test<const N: crate::Bar>() {
+#[define_opaque(Bar)]
+async fn test<const N: Bar>() {
     //~^ ERROR: `Bar` is forbidden as the type of a const generic parameter
     //[no_infer]~^^ ERROR item does not constrain
-    //[no_infer]~| ERROR item does not constrain
     #[cfg(infer)]
     let x: u32 = N;
 }
diff --git a/tests/ui/type-alias-impl-trait/constrain_in_projection.current.stderr b/tests/ui/type-alias-impl-trait/constrain_in_projection.current.stderr
index 580258bbb28..c4c55d8e092 100644
--- a/tests/ui/type-alias-impl-trait/constrain_in_projection.current.stderr
+++ b/tests/ui/type-alias-impl-trait/constrain_in_projection.current.stderr
@@ -1,5 +1,5 @@
 error[E0277]: the trait bound `Foo: Trait<Bar>` is not satisfied
-  --> $DIR/constrain_in_projection.rs:24:14
+  --> $DIR/constrain_in_projection.rs:25:14
    |
 LL |     let x = <Foo as Trait<Bar>>::Assoc::default();
    |              ^^^ the trait `Trait<Bar>` is not implemented for `Foo`
@@ -8,7 +8,7 @@ LL |     let x = <Foo as Trait<Bar>>::Assoc::default();
            but trait `Trait<()>` is implemented for it
 
 error[E0277]: the trait bound `Foo: Trait<Bar>` is not satisfied
-  --> $DIR/constrain_in_projection.rs:24:13
+  --> $DIR/constrain_in_projection.rs:25:13
    |
 LL |     let x = <Foo as Trait<Bar>>::Assoc::default();
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<Bar>` is not implemented for `Foo`
diff --git a/tests/ui/type-alias-impl-trait/constrain_in_projection.rs b/tests/ui/type-alias-impl-trait/constrain_in_projection.rs
index 355c0e1692b..64b9c583ca2 100644
--- a/tests/ui/type-alias-impl-trait/constrain_in_projection.rs
+++ b/tests/ui/type-alias-impl-trait/constrain_in_projection.rs
@@ -20,7 +20,8 @@ impl Trait<()> for Foo {
     type Assoc = u32;
 }
 
-fn bop(_: Bar) {
+#[define_opaque(Bar)]
+fn bop() {
     let x = <Foo as Trait<Bar>>::Assoc::default();
     //[current]~^ `Foo: Trait<Bar>` is not satisfied
     //[current]~| `Foo: Trait<Bar>` is not satisfied
diff --git a/tests/ui/type-alias-impl-trait/constrain_in_projection2.current.stderr b/tests/ui/type-alias-impl-trait/constrain_in_projection2.current.stderr
index 777fe1e2788..d7fb6e67ad2 100644
--- a/tests/ui/type-alias-impl-trait/constrain_in_projection2.current.stderr
+++ b/tests/ui/type-alias-impl-trait/constrain_in_projection2.current.stderr
@@ -1,5 +1,5 @@
 error[E0277]: the trait bound `Foo: Trait<Bar>` is not satisfied
-  --> $DIR/constrain_in_projection2.rs:27:14
+  --> $DIR/constrain_in_projection2.rs:28:14
    |
 LL |     let x = <Foo as Trait<Bar>>::Assoc::default();
    |              ^^^ the trait `Trait<Bar>` is not implemented for `Foo`
@@ -9,7 +9,7 @@ LL |     let x = <Foo as Trait<Bar>>::Assoc::default();
              `Foo` implements `Trait<u32>`
 
 error[E0277]: the trait bound `Foo: Trait<Bar>` is not satisfied
-  --> $DIR/constrain_in_projection2.rs:27:13
+  --> $DIR/constrain_in_projection2.rs:28:13
    |
 LL |     let x = <Foo as Trait<Bar>>::Assoc::default();
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<Bar>` is not implemented for `Foo`
diff --git a/tests/ui/type-alias-impl-trait/constrain_in_projection2.next.stderr b/tests/ui/type-alias-impl-trait/constrain_in_projection2.next.stderr
index 0d6eac4216b..7c09ab6a91a 100644
--- a/tests/ui/type-alias-impl-trait/constrain_in_projection2.next.stderr
+++ b/tests/ui/type-alias-impl-trait/constrain_in_projection2.next.stderr
@@ -1,5 +1,5 @@
 error[E0283]: type annotations needed: cannot satisfy `Foo: Trait<Bar>`
-  --> $DIR/constrain_in_projection2.rs:27:14
+  --> $DIR/constrain_in_projection2.rs:28:14
    |
 LL |     let x = <Foo as Trait<Bar>>::Assoc::default();
    |              ^^^ help: use the fully qualified path to an implementation: `<Type as Trait>::Assoc`
diff --git a/tests/ui/type-alias-impl-trait/constrain_in_projection2.rs b/tests/ui/type-alias-impl-trait/constrain_in_projection2.rs
index 16b1329b52f..61773cf59d4 100644
--- a/tests/ui/type-alias-impl-trait/constrain_in_projection2.rs
+++ b/tests/ui/type-alias-impl-trait/constrain_in_projection2.rs
@@ -23,7 +23,8 @@ impl Trait<u32> for Foo {
     type Assoc = u32;
 }
 
-fn bop(_: Bar) {
+#[define_opaque(Bar)]
+fn bop() {
     let x = <Foo as Trait<Bar>>::Assoc::default();
     //[next]~^ ERROR: cannot satisfy `Foo: Trait<Bar>`
     //[current]~^^ ERROR: `Foo: Trait<Bar>` is not satisfied
diff --git a/tests/ui/type-alias-impl-trait/constrain_inputs.rs b/tests/ui/type-alias-impl-trait/constrain_inputs.rs
index 1391a2036b2..7f6698e641d 100644
--- a/tests/ui/type-alias-impl-trait/constrain_inputs.rs
+++ b/tests/ui/type-alias-impl-trait/constrain_inputs.rs
@@ -2,7 +2,9 @@
 
 mod lifetime_params {
     type Ty<'a> = impl Sized;
+    #[define_opaque(Ty)]
     fn defining(s: &str) -> Ty<'_> { s }
+    #[define_opaque(Ty)]
     fn execute(ty: Ty<'_>) -> &str { todo!() }
     //~^ ERROR return type references an anonymous lifetime, which is not constrained by the fn input types
     //~| ERROR item does not constrain
@@ -15,7 +17,9 @@ mod lifetime_params {
 
 mod lifetime_params_2 {
     type Ty<'a> = impl FnOnce() -> &'a str;
+    #[define_opaque(Ty)]
     fn defining(s: &str) -> Ty<'_> { move || s }
+    #[define_opaque(Ty)]
     fn execute(ty: Ty<'_>) -> &str { ty() }
     //~^ ERROR return type references an anonymous lifetime, which is not constrained by the fn input types
     //~| ERROR item does not constrain
@@ -24,6 +28,7 @@ mod lifetime_params_2 {
 // regression test for https://github.com/rust-lang/rust/issues/97104
 mod type_params {
     type Ty<T> = impl Sized;
+    #[define_opaque(Ty)]
     fn define<T>(s: T) -> Ty<T> { s }
 
     type BadFnSig = fn(Ty<&str>) -> &str;
diff --git a/tests/ui/type-alias-impl-trait/constrain_inputs.stderr b/tests/ui/type-alias-impl-trait/constrain_inputs.stderr
index 436326e66c3..b016715b129 100644
--- a/tests/ui/type-alias-impl-trait/constrain_inputs.stderr
+++ b/tests/ui/type-alias-impl-trait/constrain_inputs.stderr
@@ -1,5 +1,5 @@
 error[E0581]: return type references an anonymous lifetime, which is not constrained by the fn input types
-  --> $DIR/constrain_inputs.rs:6:31
+  --> $DIR/constrain_inputs.rs:8:31
    |
 LL |     fn execute(ty: Ty<'_>) -> &str { todo!() }
    |                               ^^^^
@@ -8,7 +8,7 @@ LL |     fn execute(ty: Ty<'_>) -> &str { todo!() }
    = note: consider introducing a named lifetime parameter
 
 error[E0581]: return type references an anonymous lifetime, which is not constrained by the fn input types
-  --> $DIR/constrain_inputs.rs:10:35
+  --> $DIR/constrain_inputs.rs:12:35
    |
 LL |     type BadFnSig = fn(Ty<'_>) -> &str;
    |                                   ^^^^
@@ -17,7 +17,7 @@ LL |     type BadFnSig = fn(Ty<'_>) -> &str;
    = note: consider introducing a named lifetime parameter
 
 error[E0582]: binding for associated type `Output` references an anonymous lifetime, which does not appear in the trait input types
-  --> $DIR/constrain_inputs.rs:12:42
+  --> $DIR/constrain_inputs.rs:14:42
    |
 LL |     type BadTraitRef = dyn Fn(Ty<'_>) -> &str;
    |                                          ^^^^
@@ -25,21 +25,21 @@ LL |     type BadTraitRef = dyn Fn(Ty<'_>) -> &str;
    = note: lifetimes appearing in an associated or opaque type are not considered constrained
    = note: consider introducing a named lifetime parameter
 
-error: item does not constrain `lifetime_params::Ty::{opaque#0}`, but has it in its signature
-  --> $DIR/constrain_inputs.rs:6:8
+error: item does not constrain `lifetime_params::Ty::{opaque#0}`
+  --> $DIR/constrain_inputs.rs:8:8
    |
 LL |     fn execute(ty: Ty<'_>) -> &str { todo!() }
    |        ^^^^^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
   --> $DIR/constrain_inputs.rs:4:19
    |
 LL |     type Ty<'a> = impl Sized;
    |                   ^^^^^^^^^^
 
 error[E0581]: return type references an anonymous lifetime, which is not constrained by the fn input types
-  --> $DIR/constrain_inputs.rs:19:31
+  --> $DIR/constrain_inputs.rs:23:31
    |
 LL |     fn execute(ty: Ty<'_>) -> &str { ty() }
    |                               ^^^^
@@ -47,21 +47,21 @@ LL |     fn execute(ty: Ty<'_>) -> &str { ty() }
    = note: lifetimes appearing in an associated or opaque type are not considered constrained
    = note: consider introducing a named lifetime parameter
 
-error: item does not constrain `lifetime_params_2::Ty::{opaque#0}`, but has it in its signature
-  --> $DIR/constrain_inputs.rs:19:8
+error: item does not constrain `lifetime_params_2::Ty::{opaque#0}`
+  --> $DIR/constrain_inputs.rs:23:8
    |
 LL |     fn execute(ty: Ty<'_>) -> &str { ty() }
    |        ^^^^^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
-  --> $DIR/constrain_inputs.rs:17:19
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
+  --> $DIR/constrain_inputs.rs:19:19
    |
 LL |     type Ty<'a> = impl FnOnce() -> &'a str;
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0581]: return type references an anonymous lifetime, which is not constrained by the fn input types
-  --> $DIR/constrain_inputs.rs:29:37
+  --> $DIR/constrain_inputs.rs:34:37
    |
 LL |     type BadFnSig = fn(Ty<&str>) -> &str;
    |                                     ^^^^
@@ -70,7 +70,7 @@ LL |     type BadFnSig = fn(Ty<&str>) -> &str;
    = note: consider introducing a named lifetime parameter
 
 error[E0582]: binding for associated type `Output` references an anonymous lifetime, which does not appear in the trait input types
-  --> $DIR/constrain_inputs.rs:31:44
+  --> $DIR/constrain_inputs.rs:36:44
    |
 LL |     type BadTraitRef = dyn Fn(Ty<&str>) -> &str;
    |                                            ^^^^
diff --git a/tests/ui/type-alias-impl-trait/constrain_inputs_unsound.rs b/tests/ui/type-alias-impl-trait/constrain_inputs_unsound.rs
index 3bae0f17309..dc38e9a8cdc 100644
--- a/tests/ui/type-alias-impl-trait/constrain_inputs_unsound.rs
+++ b/tests/ui/type-alias-impl-trait/constrain_inputs_unsound.rs
@@ -4,9 +4,12 @@ trait Static: 'static {}
 impl Static for () {}
 
 type Gal<T> = impl Static;
+#[define_opaque(Gal)]
 fn _defining<T>() -> Gal<T> {}
 
-trait Callable<Arg> { type Output; }
+trait Callable<Arg> {
+    type Output;
+}
 
 /// We can infer `<C as Callable<Arg>>::Output: 'static`,
 /// because we know `C: 'static` and `Arg: 'static`,
diff --git a/tests/ui/type-alias-impl-trait/constrain_inputs_unsound.stderr b/tests/ui/type-alias-impl-trait/constrain_inputs_unsound.stderr
index 948bd6deacd..0edb0a06884 100644
--- a/tests/ui/type-alias-impl-trait/constrain_inputs_unsound.stderr
+++ b/tests/ui/type-alias-impl-trait/constrain_inputs_unsound.stderr
@@ -1,5 +1,5 @@
 error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types
-  --> $DIR/constrain_inputs_unsound.rs:23:58
+  --> $DIR/constrain_inputs_unsound.rs:26:58
    |
 LL |     type MalformedTy = dyn for<'a> Callable<Gal<&'a ()>, Output = &'a str>;
    |                                                          ^^^^^^^^^^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/debug-ty-with-weak.rs b/tests/ui/type-alias-impl-trait/debug-ty-with-weak.rs
index db9c2cc096a..6d9c05d9c68 100644
--- a/tests/ui/type-alias-impl-trait/debug-ty-with-weak.rs
+++ b/tests/ui/type-alias-impl-trait/debug-ty-with-weak.rs
@@ -3,12 +3,10 @@
 
 #![feature(type_alias_impl_trait)]
 
-mod bar {
-    pub type Debuggable = impl core::fmt::Debug;
-    fn foo() -> Debuggable {
-        0u32
-    }
+pub type Debuggable = impl core::fmt::Debug;
+#[define_opaque(Debuggable)]
+fn foo() -> Debuggable {
+    0u32
 }
-use bar::Debuggable;
 
 static mut TEST: Option<Debuggable> = None;
diff --git a/tests/ui/type-alias-impl-trait/declared_but_never_defined.stderr b/tests/ui/type-alias-impl-trait/declared_but_never_defined.stderr
index 772f487d96a..c2c401da0e8 100644
--- a/tests/ui/type-alias-impl-trait/declared_but_never_defined.stderr
+++ b/tests/ui/type-alias-impl-trait/declared_but_never_defined.stderr
@@ -4,7 +4,7 @@ error: unconstrained opaque type
 LL | type Bar = impl std::fmt::Debug;
    |            ^^^^^^^^^^^^^^^^^^^^
    |
-   = note: `Bar` must be used in combination with a concrete type within the same module
+   = note: `Bar` must be used in combination with a concrete type within the same crate
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/type-alias-impl-trait/declared_but_not_defined_in_scope.stderr b/tests/ui/type-alias-impl-trait/declared_but_not_defined_in_scope.stderr
index d60f1ffbccc..e97a69bd92c 100644
--- a/tests/ui/type-alias-impl-trait/declared_but_not_defined_in_scope.stderr
+++ b/tests/ui/type-alias-impl-trait/declared_but_not_defined_in_scope.stderr
@@ -4,7 +4,7 @@ error: unconstrained opaque type
 LL |     pub type Boo = impl ::std::fmt::Debug;
    |                    ^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: `Boo` must be used in combination with a concrete type within the same module
+   = note: `Boo` must be used in combination with a concrete type within the same crate
 
 error[E0308]: mismatched types
   --> $DIR/declared_but_not_defined_in_scope.rs:11:5
@@ -19,7 +19,7 @@ LL |     ""
    |
    = note: expected opaque type `Boo`
                 found reference `&'static str`
-note: this item must have the opaque type in its signature in order to be able to register hidden types
+note: this item must have a `#[define_opaque(Boo)]` attribute to be able to define hidden types
   --> $DIR/declared_but_not_defined_in_scope.rs:10:4
    |
 LL | fn bomp() -> boo::Boo {
diff --git a/tests/ui/type-alias-impl-trait/define_opaques_attr/foreign_type.rs b/tests/ui/type-alias-impl-trait/define_opaques_attr/foreign_type.rs
new file mode 100644
index 00000000000..c8b6bdbe2b9
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/define_opaques_attr/foreign_type.rs
@@ -0,0 +1,5 @@
+#![feature(type_alias_impl_trait)]
+
+#[define_opaque(String)]
+//~^ ERROR: only opaque types defined in the local crate can be defined
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/define_opaques_attr/foreign_type.stderr b/tests/ui/type-alias-impl-trait/define_opaques_attr/foreign_type.stderr
new file mode 100644
index 00000000000..65820e158f3
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/define_opaques_attr/foreign_type.stderr
@@ -0,0 +1,8 @@
+error: only opaque types defined in the local crate can be defined
+  --> $DIR/foreign_type.rs:3:17
+   |
+LL | #[define_opaque(String)]
+   |                 ^^^^^^
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/type-alias-impl-trait/define_opaques_attr/generics.rs b/tests/ui/type-alias-impl-trait/define_opaques_attr/generics.rs
new file mode 100644
index 00000000000..2ca2a753e20
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/define_opaques_attr/generics.rs
@@ -0,0 +1,12 @@
+#![feature(type_alias_impl_trait)]
+
+type Tait<T> = impl Sized;
+//~^ ERROR: unconstrained opaque type
+
+#[define_opaque(Tait::<()>)]
+//~^ ERROR: expected unsuffixed literal
+fn foo() {}
+
+#[define_opaque(Tait<()>)]
+//~^ ERROR: expected one of `(`, `,`, `::`, or `=`, found `<`
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/define_opaques_attr/generics.stderr b/tests/ui/type-alias-impl-trait/define_opaques_attr/generics.stderr
new file mode 100644
index 00000000000..96e8bc9851c
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/define_opaques_attr/generics.stderr
@@ -0,0 +1,22 @@
+error: expected unsuffixed literal, found `<`
+  --> $DIR/generics.rs:6:23
+   |
+LL | #[define_opaque(Tait::<()>)]
+   |                       ^
+
+error: expected one of `(`, `,`, `::`, or `=`, found `<`
+  --> $DIR/generics.rs:10:21
+   |
+LL | #[define_opaque(Tait<()>)]
+   |                     ^ expected one of `(`, `,`, `::`, or `=`
+
+error: unconstrained opaque type
+  --> $DIR/generics.rs:3:16
+   |
+LL | type Tait<T> = impl Sized;
+   |                ^^^^^^^^^^
+   |
+   = note: `Tait` must be used in combination with a concrete type within the same crate
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/type-alias-impl-trait/define_opaques_attr/invalid-extern-fn-body.rs b/tests/ui/type-alias-impl-trait/define_opaques_attr/invalid-extern-fn-body.rs
new file mode 100644
index 00000000000..d873af44adf
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/define_opaques_attr/invalid-extern-fn-body.rs
@@ -0,0 +1,11 @@
+#![feature(type_alias_impl_trait)]
+
+extern "C" {
+    fn a() {
+        //~^ ERROR incorrect function inside `extern` block
+        #[define_opaque(String)]
+        fn c() {}
+    }
+}
+
+pub fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/define_opaques_attr/invalid-extern-fn-body.stderr b/tests/ui/type-alias-impl-trait/define_opaques_attr/invalid-extern-fn-body.stderr
new file mode 100644
index 00000000000..2e944257d8f
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/define_opaques_attr/invalid-extern-fn-body.stderr
@@ -0,0 +1,20 @@
+error: incorrect function inside `extern` block
+  --> $DIR/invalid-extern-fn-body.rs:4:8
+   |
+LL |   extern "C" {
+   |   ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body
+LL |       fn a() {
+   |  ________^___-
+   | |        |
+   | |        cannot have a body
+LL | |
+LL | |         #[define_opaque(String)]
+LL | |         fn c() {}
+LL | |     }
+   | |_____- help: remove the invalid body: `;`
+   |
+   = help: you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block
+   = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/type-alias-impl-trait/define_opaques_attr/invalid_path.rs b/tests/ui/type-alias-impl-trait/define_opaques_attr/invalid_path.rs
new file mode 100644
index 00000000000..a02e80c6d89
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/define_opaques_attr/invalid_path.rs
@@ -0,0 +1,5 @@
+#![feature(type_alias_impl_trait)]
+
+#[define_opaque(Boom)]
+//~^ ERROR: cannot find type alias or associated type
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/define_opaques_attr/invalid_path.stderr b/tests/ui/type-alias-impl-trait/define_opaques_attr/invalid_path.stderr
new file mode 100644
index 00000000000..6b4cd4eac51
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/define_opaques_attr/invalid_path.stderr
@@ -0,0 +1,9 @@
+error[E0412]: cannot find type alias or associated type with opaqaue types `Boom` in this scope
+  --> $DIR/invalid_path.rs:3:17
+   |
+LL | #[define_opaque(Boom)]
+   |                 ^^^^ not found in this scope
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0412`.
diff --git a/tests/ui/type-alias-impl-trait/define_opaques_attr/missing_parens.rs b/tests/ui/type-alias-impl-trait/define_opaques_attr/missing_parens.rs
new file mode 100644
index 00000000000..6a5a1b456c3
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/define_opaques_attr/missing_parens.rs
@@ -0,0 +1,5 @@
+#![feature(type_alias_impl_trait)]
+
+#[define_opaque]
+//~^ ERROR: expected list of type aliases
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/define_opaques_attr/missing_parens.stderr b/tests/ui/type-alias-impl-trait/define_opaques_attr/missing_parens.stderr
new file mode 100644
index 00000000000..a3b98ec83b2
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/define_opaques_attr/missing_parens.stderr
@@ -0,0 +1,8 @@
+error: expected list of type aliases
+  --> $DIR/missing_parens.rs:3:1
+   |
+LL | #[define_opaque]
+   | ^^^^^^^^^^^^^^^^
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/type-alias-impl-trait/define_opaques_attr/no_opaque.rs b/tests/ui/type-alias-impl-trait/define_opaques_attr/no_opaque.rs
new file mode 100644
index 00000000000..4b60bad5c03
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/define_opaques_attr/no_opaque.rs
@@ -0,0 +1,7 @@
+#![feature(type_alias_impl_trait)]
+
+type Thing = ();
+
+#[define_opaque(Thing)]
+//~^ ERROR item does not contain any opaque types
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/define_opaques_attr/no_opaque.stderr b/tests/ui/type-alias-impl-trait/define_opaques_attr/no_opaque.stderr
new file mode 100644
index 00000000000..66ae3a43b95
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/define_opaques_attr/no_opaque.stderr
@@ -0,0 +1,8 @@
+error: item does not contain any opaque types
+  --> $DIR/no_opaque.rs:5:17
+   |
+LL | #[define_opaque(Thing)]
+   |                 ^^^^^
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/type-alias-impl-trait/define_opaques_attr/non_type.rs b/tests/ui/type-alias-impl-trait/define_opaques_attr/non_type.rs
new file mode 100644
index 00000000000..0ad87616a51
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/define_opaques_attr/non_type.rs
@@ -0,0 +1,7 @@
+#![feature(type_alias_impl_trait)]
+
+fn foo() {}
+
+#[define_opaque(foo)]
+//~^ ERROR: expected type alias or associated type with opaqaue types
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/define_opaques_attr/non_type.stderr b/tests/ui/type-alias-impl-trait/define_opaques_attr/non_type.stderr
new file mode 100644
index 00000000000..0f91533bf7e
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/define_opaques_attr/non_type.stderr
@@ -0,0 +1,9 @@
+error[E0573]: expected type alias or associated type with opaqaue types, found function `foo`
+  --> $DIR/non_type.rs:5:17
+   |
+LL | #[define_opaque(foo)]
+   |                 ^^^ not a type alias or associated type with opaqaue types
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0573`.
diff --git a/tests/ui/type-alias-impl-trait/defined-by-user-annotation.rs b/tests/ui/type-alias-impl-trait/defined-by-user-annotation.rs
index 75a4fbdb5d6..6a07ea05c1a 100644
--- a/tests/ui/type-alias-impl-trait/defined-by-user-annotation.rs
+++ b/tests/ui/type-alias-impl-trait/defined-by-user-annotation.rs
@@ -11,9 +11,11 @@ impl<A, B: Equate<Proj = A>> Indirect for (A, B) { type Ty = (); }
 mod basic {
     use super::*;
     type Opq = impl Sized;
+    #[define_opaque(Opq)]
     fn define_1(_: Opq) {
         let _ = None::<<(Opq, u8) as Indirect>::Ty>;
     }
+    #[define_opaque(Opq)]
     fn define_2() -> Opq {
         0u8
     }
@@ -23,6 +25,7 @@ mod basic {
 mod lifetime {
     use super::*;
     type Opq<'a> = impl Sized + 'a;
+    #[define_opaque(Opq)]
     fn define<'a: 'b, 'b: 'a>(_: Opq<'a>) {
         let _ = None::<<(Opq<'a>, &'b u8) as Indirect>::Ty>;
     }
diff --git a/tests/ui/type-alias-impl-trait/defined-in-closure-external-lifetime.rs b/tests/ui/type-alias-impl-trait/defined-in-closure-external-lifetime.rs
index 9101e4385b3..bc3904eb4e5 100644
--- a/tests/ui/type-alias-impl-trait/defined-in-closure-external-lifetime.rs
+++ b/tests/ui/type-alias-impl-trait/defined-in-closure-external-lifetime.rs
@@ -2,6 +2,7 @@
 
 mod case1 {
     type Opaque<'x> = impl Sized + 'x;
+    #[define_opaque(Opaque)]
     fn foo<'s>() -> Opaque<'s> {
         let _ = || { let _: Opaque<'s> = (); };
         //~^ ERROR expected generic lifetime parameter, found `'_`
@@ -10,6 +11,7 @@ mod case1 {
 
 mod case2 {
     type Opaque<'x> = impl Sized + 'x;
+    #[define_opaque(Opaque)]
     fn foo<'s>() -> Opaque<'s> {
         let _ = || -> Opaque<'s> {};
         //~^ ERROR expected generic lifetime parameter, found `'_`
diff --git a/tests/ui/type-alias-impl-trait/defined-in-closure-external-lifetime.stderr b/tests/ui/type-alias-impl-trait/defined-in-closure-external-lifetime.stderr
index a8fd1f691dd..2210291d37b 100644
--- a/tests/ui/type-alias-impl-trait/defined-in-closure-external-lifetime.stderr
+++ b/tests/ui/type-alias-impl-trait/defined-in-closure-external-lifetime.stderr
@@ -1,18 +1,18 @@
 error[E0792]: expected generic lifetime parameter, found `'_`
-  --> $DIR/defined-in-closure-external-lifetime.rs:6:29
+  --> $DIR/defined-in-closure-external-lifetime.rs:7:29
    |
 LL |     type Opaque<'x> = impl Sized + 'x;
    |                 -- this generic parameter must be used with a generic lifetime parameter
-LL |     fn foo<'s>() -> Opaque<'s> {
+...
 LL |         let _ = || { let _: Opaque<'s> = (); };
    |                             ^^^^^^^^^^
 
 error[E0792]: expected generic lifetime parameter, found `'_`
-  --> $DIR/defined-in-closure-external-lifetime.rs:14:34
+  --> $DIR/defined-in-closure-external-lifetime.rs:16:34
    |
 LL |     type Opaque<'x> = impl Sized + 'x;
    |                 -- this generic parameter must be used with a generic lifetime parameter
-LL |     fn foo<'s>() -> Opaque<'s> {
+...
 LL |         let _ = || -> Opaque<'s> {};
    |                                  ^^
 
diff --git a/tests/ui/type-alias-impl-trait/defining-use-submodule.rs b/tests/ui/type-alias-impl-trait/defining-use-submodule.rs
index 3e7bc32640f..b953cd646a0 100644
--- a/tests/ui/type-alias-impl-trait/defining-use-submodule.rs
+++ b/tests/ui/type-alias-impl-trait/defining-use-submodule.rs
@@ -11,13 +11,24 @@ type Foo = impl std::fmt::Display;
 type Bar = impl std::fmt::Display;
 
 mod foo {
+    #[define_opaque(super::Foo)]
     pub(crate) fn foo() -> super::Foo {
         "foo"
     }
 
     pub(crate) mod bar {
+        #[define_opaque(crate::Bar)]
         pub(crate) fn bar() -> crate::Bar {
             1
         }
     }
 }
+
+mod bar {
+    pub type Baz = impl std::fmt::Display;
+}
+
+#[define_opaque(bar::Baz)]
+fn baz() -> bar::Baz {
+    "boom"
+}
diff --git a/tests/ui/type-alias-impl-trait/destructure_tait-ice-113594.rs b/tests/ui/type-alias-impl-trait/destructure_tait-ice-113594.rs
index eadf21c9138..a3b1aba7041 100644
--- a/tests/ui/type-alias-impl-trait/destructure_tait-ice-113594.rs
+++ b/tests/ui/type-alias-impl-trait/destructure_tait-ice-113594.rs
@@ -10,6 +10,7 @@ pub struct Foo {
 
 pub type Tait = impl Sized;
 
+#[define_opaque(Tait)]
 pub async fn ice_cold(beverage: Tait) {
     // Must destructure at least one field of `Foo`
     let Foo { field } = beverage;
diff --git a/tests/ui/type-alias-impl-trait/different_args_considered_equal.rs b/tests/ui/type-alias-impl-trait/different_args_considered_equal.rs
index 8ce471e3956..e56f60a6693 100644
--- a/tests/ui/type-alias-impl-trait/different_args_considered_equal.rs
+++ b/tests/ui/type-alias-impl-trait/different_args_considered_equal.rs
@@ -2,10 +2,12 @@
 
 pub type Opaque<'a> = impl Sized;
 
+#[define_opaque(Opaque)]
 fn get_one<'a>(a: *mut &'a str) -> Opaque<'a> {
     a
 }
 
+#[define_opaque(Opaque)]
 fn get_iter<'a>() -> impl IntoIterator<Item = Opaque<'a>> {
     //~^ ERROR:  item does not constrain
     None::<Opaque<'static>>
diff --git a/tests/ui/type-alias-impl-trait/different_args_considered_equal.stderr b/tests/ui/type-alias-impl-trait/different_args_considered_equal.stderr
index f27f2234525..587328e2870 100644
--- a/tests/ui/type-alias-impl-trait/different_args_considered_equal.stderr
+++ b/tests/ui/type-alias-impl-trait/different_args_considered_equal.stderr
@@ -1,11 +1,11 @@
-error: item does not constrain `Opaque::{opaque#0}`, but has it in its signature
-  --> $DIR/different_args_considered_equal.rs:9:4
+error: item does not constrain `Opaque::{opaque#0}`
+  --> $DIR/different_args_considered_equal.rs:11:4
    |
 LL | fn get_iter<'a>() -> impl IntoIterator<Item = Opaque<'a>> {
    |    ^^^^^^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
   --> $DIR/different_args_considered_equal.rs:3:23
    |
 LL | pub type Opaque<'a> = impl Sized;
diff --git a/tests/ui/type-alias-impl-trait/different_args_considered_equal2.rs b/tests/ui/type-alias-impl-trait/different_args_considered_equal2.rs
index 43dfea97e6d..902d6ca57e6 100644
--- a/tests/ui/type-alias-impl-trait/different_args_considered_equal2.rs
+++ b/tests/ui/type-alias-impl-trait/different_args_considered_equal2.rs
@@ -2,6 +2,7 @@
 
 pub type Opaque<'a> = impl Sized;
 
+#[define_opaque(Opaque)]
 fn get_one<'a>(a: *mut &'a str) -> impl IntoIterator<Item = Opaque<'a>> {
     if a.is_null() {
         Some(a)
diff --git a/tests/ui/type-alias-impl-trait/different_args_considered_equal2.stderr b/tests/ui/type-alias-impl-trait/different_args_considered_equal2.stderr
index 213272f5f34..562ab4168b5 100644
--- a/tests/ui/type-alias-impl-trait/different_args_considered_equal2.stderr
+++ b/tests/ui/type-alias-impl-trait/different_args_considered_equal2.stderr
@@ -1,9 +1,9 @@
 error[E0700]: hidden type for `Opaque<'static>` captures lifetime that does not appear in bounds
-  --> $DIR/different_args_considered_equal2.rs:9:9
+  --> $DIR/different_args_considered_equal2.rs:10:9
    |
 LL | pub type Opaque<'a> = impl Sized;
    |                       ---------- opaque type defined here
-LL |
+...
 LL | fn get_one<'a>(a: *mut &'a str) -> impl IntoIterator<Item = Opaque<'a>> {
    |            -- hidden type `*mut &'a str` captures the lifetime `'a` as defined here
 ...
diff --git a/tests/ui/type-alias-impl-trait/different_args_considered_equal3.rs b/tests/ui/type-alias-impl-trait/different_args_considered_equal3.rs
index ea69175ba31..85a7e371b07 100644
--- a/tests/ui/type-alias-impl-trait/different_args_considered_equal3.rs
+++ b/tests/ui/type-alias-impl-trait/different_args_considered_equal3.rs
@@ -5,14 +5,12 @@
 
 #![feature(type_alias_impl_trait)]
 
-mod defining_scope {
-    pub type Opaque<'a> = impl Sized;
+pub type Opaque<'a> = impl Sized;
 
-    fn get_one<'a>(a: *mut &'a str) -> Opaque<'a> {
-        a
-    }
+#[define_opaque(Opaque)]
+fn get_one<'a>(a: *mut &'a str) -> Opaque<'a> {
+    a
 }
-use defining_scope::Opaque;
 
 fn get_iter<'a>() -> impl IntoIterator<Item = Opaque<'a>> {
     None::<Opaque<'static>>
diff --git a/tests/ui/type-alias-impl-trait/different_args_considered_equal3.stderr b/tests/ui/type-alias-impl-trait/different_args_considered_equal3.stderr
index d8f70e3d778..06d6433c4b5 100644
--- a/tests/ui/type-alias-impl-trait/different_args_considered_equal3.stderr
+++ b/tests/ui/type-alias-impl-trait/different_args_considered_equal3.stderr
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/different_args_considered_equal3.rs:18:5
+  --> $DIR/different_args_considered_equal3.rs:16:5
    |
 LL | fn get_iter<'a>() -> impl IntoIterator<Item = Opaque<'a>> {
    |             -- lifetime `'a` defined here
diff --git a/tests/ui/type-alias-impl-trait/different_defining_uses.rs b/tests/ui/type-alias-impl-trait/different_defining_uses.rs
index 4505c4d9524..246f255e8fc 100644
--- a/tests/ui/type-alias-impl-trait/different_defining_uses.rs
+++ b/tests/ui/type-alias-impl-trait/different_defining_uses.rs
@@ -5,10 +5,12 @@ fn main() {}
 // two definitions with different types
 type Foo = impl std::fmt::Debug;
 
+#[define_opaque(Foo)]
 fn foo() -> Foo {
     ""
 }
 
+#[define_opaque(Foo)]
 fn bar() -> Foo {
     42i32
     //~^ ERROR concrete type differs from previous
diff --git a/tests/ui/type-alias-impl-trait/different_defining_uses.stderr b/tests/ui/type-alias-impl-trait/different_defining_uses.stderr
index 9e6169b2af7..9a7f4b416f4 100644
--- a/tests/ui/type-alias-impl-trait/different_defining_uses.stderr
+++ b/tests/ui/type-alias-impl-trait/different_defining_uses.stderr
@@ -1,11 +1,11 @@
 error: concrete type differs from previous defining opaque type use
-  --> $DIR/different_defining_uses.rs:13:5
+  --> $DIR/different_defining_uses.rs:15:5
    |
 LL |     42i32
    |     ^^^^^ expected `&'static str`, got `i32`
    |
 note: previous use here
-  --> $DIR/different_defining_uses.rs:9:5
+  --> $DIR/different_defining_uses.rs:10:5
    |
 LL |     ""
    |     ^^
diff --git a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.rs b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.rs
index 4b5f455e381..e8c40e8bf92 100644
--- a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.rs
+++ b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.rs
@@ -2,6 +2,7 @@
 
 type Tait<'a> = impl Sized + 'a;
 
+#[define_opaque(Tait)]
 fn foo<'a, 'b>() -> Tait<'a> {
     if false {
         if { return } {
diff --git a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.stderr b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.stderr
index 6f5be5467f7..d4bd3975924 100644
--- a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.stderr
+++ b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.stderr
@@ -1,23 +1,23 @@
 error: concrete type differs from previous defining opaque type use
-  --> $DIR/different_defining_uses_never_type-2.rs:13:5
+  --> $DIR/different_defining_uses_never_type-2.rs:14:5
    |
 LL |     x
    |     ^ expected `i32`, got `()`
    |
 note: previous use here
-  --> $DIR/different_defining_uses_never_type-2.rs:8:31
+  --> $DIR/different_defining_uses_never_type-2.rs:9:31
    |
 LL |             let y: Tait<'b> = 1i32;
    |                               ^^^^
 
 error: concrete type differs from previous defining opaque type use
-  --> $DIR/different_defining_uses_never_type-2.rs:8:31
+  --> $DIR/different_defining_uses_never_type-2.rs:9:31
    |
 LL |             let y: Tait<'b> = 1i32;
    |                               ^^^^ expected `()`, got `i32`
    |
 note: previous use here
-  --> $DIR/different_defining_uses_never_type-2.rs:7:14
+  --> $DIR/different_defining_uses_never_type-2.rs:8:14
    |
 LL |         if { return } {
    |              ^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-3.rs b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-3.rs
index a4ac27378e1..b2713b9602c 100644
--- a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-3.rs
+++ b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-3.rs
@@ -2,6 +2,7 @@
 
 type Tait<T> = impl Sized;
 
+#[define_opaque(Tait)]
 fn foo<T, U>() -> Tait<T> {
     if false {
         if { return } {
diff --git a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-3.stderr b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-3.stderr
index 0fdcb81f667..cb12fddd9a0 100644
--- a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-3.stderr
+++ b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-3.stderr
@@ -1,11 +1,11 @@
 error: concrete type differs from previous defining opaque type use
-  --> $DIR/different_defining_uses_never_type-3.rs:8:30
+  --> $DIR/different_defining_uses_never_type-3.rs:9:30
    |
 LL |             let y: Tait<U> = 1i32;
    |                              ^^^^ expected `()`, got `i32`
    |
 note: previous use here
-  --> $DIR/different_defining_uses_never_type-3.rs:12:22
+  --> $DIR/different_defining_uses_never_type-3.rs:13:22
    |
 LL |     let x: Tait<T> = ();
    |                      ^^
diff --git a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type.rs b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type.rs
index 0b8157fe33d..38597ccaf42 100644
--- a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type.rs
+++ b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type.rs
@@ -5,14 +5,17 @@ fn main() {}
 // two definitions with different types
 type Foo = impl std::fmt::Debug;
 
+#[define_opaque(Foo)]
 fn foo() -> Foo {
     ""
 }
 
+#[define_opaque(Foo)]
 fn bar() -> Foo { //~ ERROR: concrete type differs from previous defining opaque type use
     panic!()
 }
 
+#[define_opaque(Foo)]
 fn boo() -> Foo {
     loop {}
 }
diff --git a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type.stderr b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type.stderr
index 2a77eb4c4ac..38afa3cbcd0 100644
--- a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type.stderr
+++ b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type.stderr
@@ -1,11 +1,11 @@
 error: concrete type differs from previous defining opaque type use
-  --> $DIR/different_defining_uses_never_type.rs:12:13
+  --> $DIR/different_defining_uses_never_type.rs:14:13
    |
 LL | fn bar() -> Foo {
    |             ^^^ expected `&'static str`, got `()`
    |
 note: previous use here
-  --> $DIR/different_defining_uses_never_type.rs:9:5
+  --> $DIR/different_defining_uses_never_type.rs:10:5
    |
 LL |     ""
    |     ^^
diff --git a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type2.rs b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type2.rs
index c39cc192dc7..03766da34cb 100644
--- a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type2.rs
+++ b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type2.rs
@@ -7,10 +7,12 @@ fn main() {}
 // two definitions with different types
 type Foo = impl std::fmt::Debug;
 
+#[define_opaque(Foo)]
 fn foo() -> Foo {
     ""
 }
 
+#[define_opaque(Foo)]
 fn bar(arg: bool) -> Foo {
     if arg {
         panic!()
@@ -19,6 +21,7 @@ fn bar(arg: bool) -> Foo {
     }
 }
 
+#[define_opaque(Foo)]
 fn boo(arg: bool) -> Foo {
     if arg {
         loop {}
@@ -27,6 +30,7 @@ fn boo(arg: bool) -> Foo {
     }
 }
 
+#[define_opaque(Foo)]
 fn bar2(arg: bool) -> Foo {
     if arg {
         "bar2"
@@ -35,6 +39,7 @@ fn bar2(arg: bool) -> Foo {
     }
 }
 
+#[define_opaque(Foo)]
 fn boo2(arg: bool) -> Foo {
     if arg {
         "boo2"
diff --git a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type3.rs b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type3.rs
index bc827a8f211..b5c2bf504ac 100644
--- a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type3.rs
+++ b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type3.rs
@@ -3,9 +3,11 @@
 type Tait = impl Sized;
 
 struct One;
+#[define_opaque(Tait)]
 fn one() -> Tait { One }
 
 struct Two<T>(T);
+#[define_opaque(Tait)]
 fn two() -> Tait { Two::<()>(todo!()) }
 //~^ ERROR concrete type differs from previous defining opaque type use
 
diff --git a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type3.stderr b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type3.stderr
index abf4a0d241b..21fab818063 100644
--- a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type3.stderr
+++ b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type3.stderr
@@ -1,11 +1,11 @@
 error: concrete type differs from previous defining opaque type use
-  --> $DIR/different_defining_uses_never_type3.rs:9:13
+  --> $DIR/different_defining_uses_never_type3.rs:11:13
    |
 LL | fn two() -> Tait { Two::<()>(todo!()) }
    |             ^^^^ expected `One`, got `Two<()>`
    |
 note: previous use here
-  --> $DIR/different_defining_uses_never_type3.rs:6:20
+  --> $DIR/different_defining_uses_never_type3.rs:7:20
    |
 LL | fn one() -> Tait { One }
    |                    ^^^
diff --git a/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.rs b/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.rs
index 4f424b8c665..ba3265343c6 100644
--- a/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.rs
+++ b/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.rs
@@ -3,10 +3,12 @@
 
 type OneLifetime<'a, 'b> = impl std::fmt::Debug;
 
+#[define_opaque(OneLifetime)]
 fn foo<'a, 'b>(a: &'a u32, b: &'b u32) -> OneLifetime<'a, 'b> {
     a
 }
 
+#[define_opaque(OneLifetime)]
 fn bar<'a, 'b>(a: &'a u32, b: &'b u32) -> OneLifetime<'a, 'b> {
     b
     //~^ ERROR: concrete type differs from previous defining opaque type use
diff --git a/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.stderr b/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.stderr
index 07ba17ad27b..b87e884708a 100644
--- a/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.stderr
+++ b/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.stderr
@@ -1,11 +1,11 @@
 error: concrete type differs from previous defining opaque type use
-  --> $DIR/different_lifetimes_defining_uses.rs:11:5
+  --> $DIR/different_lifetimes_defining_uses.rs:13:5
    |
 LL |     b
    |     ^ expected `&'a u32`, got `&'b u32`
    |
 note: previous use here
-  --> $DIR/different_lifetimes_defining_uses.rs:7:5
+  --> $DIR/different_lifetimes_defining_uses.rs:8:5
    |
 LL |     a
    |     ^
diff --git a/tests/ui/type-alias-impl-trait/drop-analysis-on-unconstrained-tait.rs b/tests/ui/type-alias-impl-trait/drop-analysis-on-unconstrained-tait.rs
index 4332f1264a8..987ac381289 100644
--- a/tests/ui/type-alias-impl-trait/drop-analysis-on-unconstrained-tait.rs
+++ b/tests/ui/type-alias-impl-trait/drop-analysis-on-unconstrained-tait.rs
@@ -2,29 +2,32 @@
 
 #![feature(type_alias_impl_trait)]
 
-mod impl_trait_mod {
-    use super::*;
-    pub type OpaqueBlock = impl Trait;
-    //~^ ERROR unconstrained opaque type
-    pub type OpaqueIf = impl Trait;
+pub type OpaqueBlock = impl Trait;
+//~^ ERROR unconstrained opaque type
+pub type OpaqueIf = impl Trait;
 
-    pub struct BlockWrapper(OpaqueBlock);
-    pub struct IfWrapper(pub OpaqueIf);
+pub struct BlockWrapper(OpaqueBlock);
+pub struct IfWrapper(pub OpaqueIf);
 
-    pub fn if_impl() -> Parser<OpaqueIf> {
-        bind(option(block()), |_| block())
-    }
+#[define_opaque(OpaqueIf)]
+pub fn if_impl() -> Parser<OpaqueIf> {
+    bind(option(block()), |_| block())
 }
-use impl_trait_mod::*;
 
 pub trait Trait {
     type Assoc;
 }
 pub struct Parser<P>(P);
 pub struct Bind<P, F>(P, F);
-impl<P, F> Trait for Bind<P, F> { type Assoc = (); }
-impl Trait for BlockWrapper { type Assoc = (); }
-impl Trait for IfWrapper { type Assoc = (); }
+impl<P, F> Trait for Bind<P, F> {
+    type Assoc = ();
+}
+impl Trait for BlockWrapper {
+    type Assoc = ();
+}
+impl Trait for IfWrapper {
+    type Assoc = ();
+}
 
 pub fn block() -> Parser<BlockWrapper> {
     loop {}
@@ -32,8 +35,9 @@ pub fn block() -> Parser<BlockWrapper> {
 pub fn option<P: Trait>(arg: Parser<P>) -> Parser<impl Trait> {
     bind(arg, |_| block())
 }
-fn bind<P: Trait, P2, F: Fn(P::Assoc) -> Parser<P2>>(_: Parser<P>, _: F) -> Parser<Bind<P, F>>
-    { loop {} }
+fn bind<P: Trait, P2, F: Fn(P::Assoc) -> Parser<P2>>(_: Parser<P>, _: F) -> Parser<Bind<P, F>> {
+    loop {}
+}
 
 fn main() {
     if_impl().0;
diff --git a/tests/ui/type-alias-impl-trait/drop-analysis-on-unconstrained-tait.stderr b/tests/ui/type-alias-impl-trait/drop-analysis-on-unconstrained-tait.stderr
index 8e5838d5ddf..db97954f698 100644
--- a/tests/ui/type-alias-impl-trait/drop-analysis-on-unconstrained-tait.stderr
+++ b/tests/ui/type-alias-impl-trait/drop-analysis-on-unconstrained-tait.stderr
@@ -1,10 +1,10 @@
 error: unconstrained opaque type
-  --> $DIR/drop-analysis-on-unconstrained-tait.rs:7:28
+  --> $DIR/drop-analysis-on-unconstrained-tait.rs:5:24
    |
-LL |     pub type OpaqueBlock = impl Trait;
-   |                            ^^^^^^^^^^
+LL | pub type OpaqueBlock = impl Trait;
+   |                        ^^^^^^^^^^
    |
-   = note: `OpaqueBlock` must be used in combination with a concrete type within the same module
+   = note: `OpaqueBlock` must be used in combination with a concrete type within the same crate
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/type-alias-impl-trait/duplicate-lifetimes-from-rpit-containing-tait.rs b/tests/ui/type-alias-impl-trait/duplicate-lifetimes-from-rpit-containing-tait.rs
index b1d5961067b..5dda2597c66 100644
--- a/tests/ui/type-alias-impl-trait/duplicate-lifetimes-from-rpit-containing-tait.rs
+++ b/tests/ui/type-alias-impl-trait/duplicate-lifetimes-from-rpit-containing-tait.rs
@@ -4,6 +4,7 @@
 
 type Opaque<'lt> = impl Sized + 'lt;
 
+#[define_opaque(Opaque)]
 fn test<'a>(
     arg: impl Iterator<Item = &'a u8>,
 ) -> impl Iterator<Item = Opaque<'a>> {
diff --git a/tests/ui/type-alias-impl-trait/equal-lifetime-params-not-ok.rs b/tests/ui/type-alias-impl-trait/equal-lifetime-params-not-ok.rs
index b209b4bc89d..64f926fba9e 100644
--- a/tests/ui/type-alias-impl-trait/equal-lifetime-params-not-ok.rs
+++ b/tests/ui/type-alias-impl-trait/equal-lifetime-params-not-ok.rs
@@ -7,19 +7,21 @@ impl<T> Trait<'_, '_> for T {}
 
 mod mod1 {
     type Opaque<'a, 'b> = impl super::Trait<'a, 'b>;
+    #[define_opaque(Opaque)]
     fn test<'a>() -> Opaque<'a, 'a> {}
     //~^ ERROR non-defining opaque type use in defining scope
-    //~| ERROR non-defining opaque type use in defining scope
 }
 
 mod mod2 {
     type Opaque<'a, 'b> = impl super::Trait<'a, 'b>;
+    #[define_opaque(Opaque)]
     fn test<'a: 'b, 'b: 'a>() -> Opaque<'a, 'b> {}
     //~^ ERROR non-defining opaque type use in defining scope
 }
 
 mod mod3 {
     type Opaque<'a, 'b> = impl super::Trait<'a, 'b>;
+    #[define_opaque(Opaque)]
     fn test<'a: 'b, 'b: 'a>(a: &'a str) -> Opaque<'a, 'b> { a }
     //~^ ERROR non-defining opaque type use in defining scope
 }
@@ -30,6 +32,7 @@ mod mod3 {
 // it is ambiguous whether `Opaque<'a> := &'a ()` or `Opaque<'a> := &'static ()`
 mod mod4 {
     type Opaque<'a> = impl super::Trait<'a, 'a>;
+    #[define_opaque(Opaque)]
     fn test<'a: 'static>() -> Opaque<'a> {}
     //~^ ERROR expected generic lifetime parameter, found `'static`
 }
diff --git a/tests/ui/type-alias-impl-trait/equal-lifetime-params-not-ok.stderr b/tests/ui/type-alias-impl-trait/equal-lifetime-params-not-ok.stderr
index b08bc8b8268..34af7cb32c2 100644
--- a/tests/ui/type-alias-impl-trait/equal-lifetime-params-not-ok.stderr
+++ b/tests/ui/type-alias-impl-trait/equal-lifetime-params-not-ok.stderr
@@ -1,17 +1,5 @@
 error: non-defining opaque type use in defining scope
-  --> $DIR/equal-lifetime-params-not-ok.rs:10:22
-   |
-LL |     fn test<'a>() -> Opaque<'a, 'a> {}
-   |                      ^^^^^^^^^^^^^^ generic argument `'a` used twice
-   |
-note: for this opaque type
-  --> $DIR/equal-lifetime-params-not-ok.rs:9:27
-   |
-LL |     type Opaque<'a, 'b> = impl super::Trait<'a, 'b>;
-   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: non-defining opaque type use in defining scope
-  --> $DIR/equal-lifetime-params-not-ok.rs:10:37
+  --> $DIR/equal-lifetime-params-not-ok.rs:11:37
    |
 LL |     fn test<'a>() -> Opaque<'a, 'a> {}
    |                                     ^^
@@ -23,7 +11,7 @@ LL |     type Opaque<'a, 'b> = impl super::Trait<'a, 'b>;
    |                 ^^  ^^
 
 error: non-defining opaque type use in defining scope
-  --> $DIR/equal-lifetime-params-not-ok.rs:17:49
+  --> $DIR/equal-lifetime-params-not-ok.rs:18:49
    |
 LL |     fn test<'a: 'b, 'b: 'a>() -> Opaque<'a, 'b> {}
    |                                                 ^^
@@ -35,25 +23,26 @@ LL |     type Opaque<'a, 'b> = impl super::Trait<'a, 'b>;
    |                 ^^  ^^
 
 error: non-defining opaque type use in defining scope
-  --> $DIR/equal-lifetime-params-not-ok.rs:23:61
+  --> $DIR/equal-lifetime-params-not-ok.rs:25:61
    |
 LL |     fn test<'a: 'b, 'b: 'a>(a: &'a str) -> Opaque<'a, 'b> { a }
    |                                                             ^
    |
 note: lifetime used multiple times
-  --> $DIR/equal-lifetime-params-not-ok.rs:22:17
+  --> $DIR/equal-lifetime-params-not-ok.rs:23:17
    |
 LL |     type Opaque<'a, 'b> = impl super::Trait<'a, 'b>;
    |                 ^^  ^^
 
 error[E0792]: expected generic lifetime parameter, found `'static`
-  --> $DIR/equal-lifetime-params-not-ok.rs:33:42
+  --> $DIR/equal-lifetime-params-not-ok.rs:36:42
    |
 LL |     type Opaque<'a> = impl super::Trait<'a, 'a>;
    |                 -- cannot use static lifetime; use a bound lifetime instead or remove the lifetime parameter from the opaque type
+LL |     #[define_opaque(Opaque)]
 LL |     fn test<'a: 'static>() -> Opaque<'a> {}
    |                                          ^^
 
-error: aborting due to 5 previous errors
+error: aborting due to 4 previous errors
 
 For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/type-alias-impl-trait/equal-lifetime-params-ok.rs b/tests/ui/type-alias-impl-trait/equal-lifetime-params-ok.rs
index 0ce85a4d6cb..711aca662d1 100644
--- a/tests/ui/type-alias-impl-trait/equal-lifetime-params-ok.rs
+++ b/tests/ui/type-alias-impl-trait/equal-lifetime-params-ok.rs
@@ -12,6 +12,7 @@ impl<T> Trait<'_, '_> for T {}
 
 mod equal_params {
     type Opaque<'a: 'b, 'b: 'a> = impl super::Trait<'a, 'b>;
+    #[define_opaque(Opaque)]
     fn test<'a: 'b, 'b: 'a>() -> Opaque<'a, 'b> {
         let _ = None::<&'a &'b &'a ()>;
         0u8
@@ -20,6 +21,7 @@ mod equal_params {
 
 mod equal_static {
     type Opaque<'a: 'static> = impl Sized + 'a;
+    #[define_opaque(Opaque)]
     fn test<'a: 'static>() -> Opaque<'a> {
         let _ = None::<&'static &'a ()>;
         0u8
diff --git a/tests/ui/type-alias-impl-trait/error-tainting-issue-122904.rs b/tests/ui/type-alias-impl-trait/error-tainting-issue-122904.rs
new file mode 100644
index 00000000000..a2de3957c0b
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/error-tainting-issue-122904.rs
@@ -0,0 +1,18 @@
+// We previously didn't taint the borrowck result in this test,
+// causing an ICE later on.
+#![feature(type_alias_impl_trait)]
+trait T {}
+
+type Alias<'a> = impl T;
+
+struct S;
+impl<'a> T for &'a S {}
+
+#[define_opaque(Alias)]
+fn with_positive(fun: impl Fn(Alias<'_>)) {
+    //~^ WARN function cannot return without recursing
+    with_positive(|&n| ());
+    //~^ ERROR cannot move out of a shared reference
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/error-tainting-issue-122904.stderr b/tests/ui/type-alias-impl-trait/error-tainting-issue-122904.stderr
new file mode 100644
index 00000000000..956ce3e5936
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/error-tainting-issue-122904.stderr
@@ -0,0 +1,30 @@
+warning: function cannot return without recursing
+  --> $DIR/error-tainting-issue-122904.rs:12:1
+   |
+LL | fn with_positive(fun: impl Fn(Alias<'_>)) {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
+LL |
+LL |     with_positive(|&n| ());
+   |     ---------------------- recursive call site
+   |
+   = help: a `loop` may express intention better if this is on purpose
+   = note: `#[warn(unconditional_recursion)]` on by default
+
+error[E0507]: cannot move out of a shared reference
+  --> $DIR/error-tainting-issue-122904.rs:14:20
+   |
+LL |     with_positive(|&n| ());
+   |                    ^-
+   |                     |
+   |                     data moved here
+   |                     move occurs because `n` has type `S`, which does not implement the `Copy` trait
+   |
+help: consider removing the borrow
+   |
+LL -     with_positive(|&n| ());
+LL +     with_positive(|n| ());
+   |
+
+error: aborting due to 1 previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/tests/ui/type-alias-impl-trait/escaping-bound-var.rs b/tests/ui/type-alias-impl-trait/escaping-bound-var.rs
index 07206dd2491..31bdd0815ec 100644
--- a/tests/ui/type-alias-impl-trait/escaping-bound-var.rs
+++ b/tests/ui/type-alias-impl-trait/escaping-bound-var.rs
@@ -16,6 +16,7 @@ impl Trait<'_> for () {
 
 impl Test<'_> for () {}
 
+#[define_opaque(Foo)]
 fn constrain() -> Foo {
     ()
 }
diff --git a/tests/ui/type-alias-impl-trait/failed-to-normalize-ice-99945.rs b/tests/ui/type-alias-impl-trait/failed-to-normalize-ice-99945.rs
index 9ed010f2293..726820bbd5a 100644
--- a/tests/ui/type-alias-impl-trait/failed-to-normalize-ice-99945.rs
+++ b/tests/ui/type-alias-impl-trait/failed-to-normalize-ice-99945.rs
@@ -22,10 +22,12 @@ type StateWidget<'a> = impl Widget<&'a ()>;
 impl<F: for<'a> Fn(&'a ()) -> StateWidget<'a>> Widget<()> for StatefulWidget<F> {
     type State = ();
 
+    #[define_opaque(StateWidget)]
     fn make_state(&self) -> Self::State {}
     //~^ ERROR item does not constrain
 }
 
+#[define_opaque(StateWidget)]
 fn new_stateful_widget<F: for<'a> Fn(&'a ()) -> StateWidget<'a>>(build: F) -> impl Widget<()> {
     //~^ ERROR item does not constrain
     StatefulWidget(build)
diff --git a/tests/ui/type-alias-impl-trait/failed-to-normalize-ice-99945.stderr b/tests/ui/type-alias-impl-trait/failed-to-normalize-ice-99945.stderr
index 9a3f4ae4c1c..4f5c65adab9 100644
--- a/tests/ui/type-alias-impl-trait/failed-to-normalize-ice-99945.stderr
+++ b/tests/ui/type-alias-impl-trait/failed-to-normalize-ice-99945.stderr
@@ -1,31 +1,40 @@
-error: item does not constrain `StateWidget::{opaque#0}`, but has it in its signature
-  --> $DIR/failed-to-normalize-ice-99945.rs:25:8
+error: item does not constrain `StateWidget::{opaque#0}`
+  --> $DIR/failed-to-normalize-ice-99945.rs:26:8
    |
 LL |     fn make_state(&self) -> Self::State {}
    |        ^^^^^^^^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
   --> $DIR/failed-to-normalize-ice-99945.rs:20:24
    |
 LL | type StateWidget<'a> = impl Widget<&'a ()>;
    |                        ^^^^^^^^^^^^^^^^^^^
 
-error: item does not constrain `StateWidget::{opaque#0}`, but has it in its signature
-  --> $DIR/failed-to-normalize-ice-99945.rs:29:4
+error: item does not constrain `StateWidget::{opaque#0}`
+  --> $DIR/failed-to-normalize-ice-99945.rs:31:4
    |
 LL | fn new_stateful_widget<F: for<'a> Fn(&'a ()) -> StateWidget<'a>>(build: F) -> impl Widget<()> {
    |    ^^^^^^^^^^^^^^^^^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
   --> $DIR/failed-to-normalize-ice-99945.rs:20:24
    |
 LL | type StateWidget<'a> = impl Widget<&'a ()>;
    |                        ^^^^^^^^^^^^^^^^^^^
 
+error[E0792]: expected generic lifetime parameter, found `'a`
+  --> $DIR/failed-to-normalize-ice-99945.rs:33:5
+   |
+LL | type StateWidget<'a> = impl Widget<&'a ()>;
+   |                  -- this generic parameter must be used with a generic lifetime parameter
+...
+LL |     StatefulWidget(build)
+   |     ^^^^^^^^^^^^^^^^^^^^^
+
 error[E0308]: mismatched types
-  --> $DIR/failed-to-normalize-ice-99945.rs:36:29
+  --> $DIR/failed-to-normalize-ice-99945.rs:38:29
    |
 LL | type StateWidget<'a> = impl Widget<&'a ()>;
    |                        ------------------- the expected opaque type
@@ -36,15 +45,6 @@ LL |     new_stateful_widget(|_| ()).make_state();
    = note: expected opaque type `StateWidget<'_>`
                 found unit type `()`
 
-error[E0792]: expected generic lifetime parameter, found `'a`
-  --> $DIR/failed-to-normalize-ice-99945.rs:31:5
-   |
-LL | type StateWidget<'a> = impl Widget<&'a ()>;
-   |                  -- this generic parameter must be used with a generic lifetime parameter
-...
-LL |     StatefulWidget(build)
-   |     ^^^^^^^^^^^^^^^^^^^^^
-
 error: aborting due to 4 previous errors
 
 Some errors have detailed explanations: E0308, E0792.
diff --git a/tests/ui/type-alias-impl-trait/fallback.rs b/tests/ui/type-alias-impl-trait/fallback.rs
index d8cf7d71fef..a2f25acca0d 100644
--- a/tests/ui/type-alias-impl-trait/fallback.rs
+++ b/tests/ui/type-alias-impl-trait/fallback.rs
@@ -7,19 +7,20 @@ type Foo = impl Copy;
 
 enum Wrapper<T> {
     First(T),
-    Second
+    Second,
 }
 
 // This method constrains `Foo` to be `bool`
+#[define_opaque(Foo)]
 fn constrained_foo() -> Foo {
     true
 }
 
-
 // This method does not constrain `Foo`.
 // Per RFC 2071, function bodies may either
 // fully constrain an opaque type, or place no
 // constraints on it.
+#[define_opaque(Foo)]
 fn unconstrained_foo() -> Wrapper<Foo> {
     Wrapper::Second
     //~^ ERROR: type annotations needed
diff --git a/tests/ui/type-alias-impl-trait/fallback.stderr b/tests/ui/type-alias-impl-trait/fallback.stderr
index c909ab66f0e..1eb0afb13a8 100644
--- a/tests/ui/type-alias-impl-trait/fallback.stderr
+++ b/tests/ui/type-alias-impl-trait/fallback.stderr
@@ -1,5 +1,5 @@
 error[E0283]: type annotations needed
-  --> $DIR/fallback.rs:24:5
+  --> $DIR/fallback.rs:25:5
    |
 LL | fn unconstrained_foo() -> Wrapper<Foo> {
    |                           ------------ type must be known at this point
diff --git a/tests/ui/type-alias-impl-trait/field-types.rs b/tests/ui/type-alias-impl-trait/field-types.rs
index 24e430afac3..3ea73abb03f 100644
--- a/tests/ui/type-alias-impl-trait/field-types.rs
+++ b/tests/ui/type-alias-impl-trait/field-types.rs
@@ -1,3 +1,6 @@
+//! Show that `defines(StructName)` works for
+//! fields of that struct being an opaque type.
+
 #![feature(type_alias_impl_trait)]
 #![allow(dead_code)]
 
@@ -11,6 +14,7 @@ struct Bar {
     foo: Foo,
 }
 
+#[define_opaque(Bar)]
 fn bar() -> Bar {
     Bar { foo: "foo" }
 }
diff --git a/tests/ui/type-alias-impl-trait/future.rs b/tests/ui/type-alias-impl-trait/future.rs
index 36d1dcd00ad..e233554f6a1 100644
--- a/tests/ui/type-alias-impl-trait/future.rs
+++ b/tests/ui/type-alias-impl-trait/future.rs
@@ -11,6 +11,7 @@ trait Bar {
 
 type FooFuture<B> = impl Future<Output = ()>;
 
+#[define_opaque(FooFuture)]
 fn foo<B: Bar>(bar: B) -> FooFuture<B> {
     async move { bar.bar() }
     //~^ ERROR: the trait bound `B: Bar` is not satisfied
diff --git a/tests/ui/type-alias-impl-trait/future.stderr b/tests/ui/type-alias-impl-trait/future.stderr
index 047ad164239..8510ab27fb7 100644
--- a/tests/ui/type-alias-impl-trait/future.stderr
+++ b/tests/ui/type-alias-impl-trait/future.stderr
@@ -1,11 +1,11 @@
 error[E0277]: the trait bound `B: Bar` is not satisfied
-  --> $DIR/future.rs:15:5
+  --> $DIR/future.rs:16:5
    |
 LL |     async move { bar.bar() }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `B`
    |
 note: required by a bound in `foo`
-  --> $DIR/future.rs:14:11
+  --> $DIR/future.rs:15:11
    |
 LL | fn foo<B: Bar>(bar: B) -> FooFuture<B> {
    |           ^^^ required by this bound in `foo`
diff --git a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.basic.stderr b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.basic.stderr
index e5f86c8c193..43e887f36c5 100644
--- a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.basic.stderr
+++ b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.basic.stderr
@@ -1,5 +1,5 @@
 error[E0792]: expected generic lifetime parameter, found `'_`
-  --> $DIR/generic-not-strictly-equal.rs:33:5
+  --> $DIR/generic-not-strictly-equal.rs:34:5
    |
 LL | type Opaque<'a> = impl Copy + Captures<'a>;
    |             -- this generic parameter must be used with a generic lifetime parameter
diff --git a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.member_constraints.stderr b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.member_constraints.stderr
index 693af69d6fa..4a5360c9922 100644
--- a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.member_constraints.stderr
+++ b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.member_constraints.stderr
@@ -1,9 +1,9 @@
 error[E0700]: hidden type for `Opaque<'x>` captures lifetime that does not appear in bounds
-  --> $DIR/generic-not-strictly-equal.rs:33:5
+  --> $DIR/generic-not-strictly-equal.rs:34:5
    |
 LL | type Opaque<'a> = impl Copy + Captures<'a>;
    |                   ------------------------ opaque type defined here
-LL |
+...
 LL | fn test<'x>(_: Opaque<'x>) {
    |         -- hidden type `&'x u8` captures the lifetime `'x` as defined here
 ...
diff --git a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.rs b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.rs
index a059fd3b822..c1059e3da33 100644
--- a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.rs
+++ b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.rs
@@ -20,6 +20,7 @@ fn relate<X>(_: X, _: X) {}
 
 type Opaque<'a> = impl Copy + Captures<'a>;
 
+#[define_opaque(Opaque)]
 fn test<'x>(_: Opaque<'x>) {
     let opaque = None::<Opaque<'_>>; // let's call this lifetime '?1
 
diff --git a/tests/ui/type-alias-impl-trait/generic_different_defining_uses.rs b/tests/ui/type-alias-impl-trait/generic_different_defining_uses.rs
index 8b683ad2828..d55a9a376b9 100644
--- a/tests/ui/type-alias-impl-trait/generic_different_defining_uses.rs
+++ b/tests/ui/type-alias-impl-trait/generic_different_defining_uses.rs
@@ -4,10 +4,12 @@ fn main() {}
 
 type MyIter<T> = impl Iterator<Item = T>;
 
+#[define_opaque(MyIter)]
 fn my_iter<T>(t: T) -> MyIter<T> {
     std::iter::once(t)
 }
 
+#[define_opaque(MyIter)]
 fn my_iter2<T>(t: T) -> MyIter<T> {
     Some(t).into_iter()
     //~^ ERROR concrete type differs from previous
diff --git a/tests/ui/type-alias-impl-trait/generic_different_defining_uses.stderr b/tests/ui/type-alias-impl-trait/generic_different_defining_uses.stderr
index 72271d158a1..6d3279144d8 100644
--- a/tests/ui/type-alias-impl-trait/generic_different_defining_uses.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_different_defining_uses.stderr
@@ -1,11 +1,11 @@
 error: concrete type differs from previous defining opaque type use
-  --> $DIR/generic_different_defining_uses.rs:12:5
+  --> $DIR/generic_different_defining_uses.rs:14:5
    |
 LL |     Some(t).into_iter()
    |     ^^^^^^^^^^^^^^^^^^^ expected `std::iter::Once<T>`, got `std::option::IntoIter<T>`
    |
 note: previous use here
-  --> $DIR/generic_different_defining_uses.rs:8:5
+  --> $DIR/generic_different_defining_uses.rs:9:5
    |
 LL |     std::iter::once(t)
    |     ^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.rs b/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.rs
index 169d4f8d509..45da4145278 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.rs
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.rs
@@ -4,8 +4,8 @@ fn main() {}
 
 type Two<'a, 'b> = impl std::fmt::Debug;
 
+#[define_opaque(Two)]
 fn one<'a>(t: &'a ()) -> Two<'a, 'a> {
-    //~^ ERROR non-defining opaque type use
     t
     //~^ ERROR non-defining opaque type use
 }
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr
index b03bf2466e6..352e6fd3c5c 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr
@@ -1,16 +1,4 @@
 error: non-defining opaque type use in defining scope
-  --> $DIR/generic_duplicate_lifetime_param.rs:7:26
-   |
-LL | fn one<'a>(t: &'a ()) -> Two<'a, 'a> {
-   |                          ^^^^^^^^^^^ generic argument `'a` used twice
-   |
-note: for this opaque type
-  --> $DIR/generic_duplicate_lifetime_param.rs:5:20
-   |
-LL | type Two<'a, 'b> = impl std::fmt::Debug;
-   |                    ^^^^^^^^^^^^^^^^^^^^
-
-error: non-defining opaque type use in defining scope
   --> $DIR/generic_duplicate_lifetime_param.rs:9:5
    |
 LL |     t
@@ -22,5 +10,5 @@ note: lifetime used multiple times
 LL | type Two<'a, 'b> = impl std::fmt::Debug;
    |          ^^  ^^
 
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.rs b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.rs
index e3c6f4d874b..e8ed38a24ce 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.rs
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.rs
@@ -18,20 +18,20 @@ type TwoLifetimes<'a, 'b> = impl Debug;
 
 type TwoConsts<const X: usize, const Y: usize> = impl Debug;
 
+#[define_opaque(TwoTys)]
 fn one_ty<T: Debug>(t: T) -> TwoTys<T, T> {
-    //~^ ERROR non-defining opaque type use in defining scope
     t
     //~^ ERROR non-defining opaque type use in defining scope
 }
 
+#[define_opaque(TwoLifetimes)]
 fn one_lifetime<'a>(t: &'a u32) -> TwoLifetimes<'a, 'a> {
-    //~^ ERROR non-defining opaque type use in defining scope
     t
     //~^ ERROR non-defining opaque type use in defining scope
 }
 
+#[define_opaque(TwoConsts)]
 fn one_const<const N: usize>(t: *mut [u8; N]) -> TwoConsts<N, N> {
-    //~^ ERROR non-defining opaque type use in defining scope
     t
     //~^ ERROR non-defining opaque type use in defining scope
 }
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.stderr
index 73570de5326..3e048c8138d 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.stderr
@@ -1,16 +1,4 @@
 error: non-defining opaque type use in defining scope
-  --> $DIR/generic_duplicate_param_use.rs:21:30
-   |
-LL | fn one_ty<T: Debug>(t: T) -> TwoTys<T, T> {
-   |                              ^^^^^^^^^^^^ generic argument `T` used twice
-   |
-note: for this opaque type
-  --> $DIR/generic_duplicate_param_use.rs:15:21
-   |
-LL | type TwoTys<T, U> = impl Debug;
-   |                     ^^^^^^^^^^
-
-error: non-defining opaque type use in defining scope
   --> $DIR/generic_duplicate_param_use.rs:23:5
    |
 LL |     t
@@ -23,30 +11,6 @@ LL | type TwoTys<T, U> = impl Debug;
    |             ^  ^
 
 error: non-defining opaque type use in defining scope
-  --> $DIR/generic_duplicate_param_use.rs:27:36
-   |
-LL | fn one_lifetime<'a>(t: &'a u32) -> TwoLifetimes<'a, 'a> {
-   |                                    ^^^^^^^^^^^^^^^^^^^^ generic argument `'a` used twice
-   |
-note: for this opaque type
-  --> $DIR/generic_duplicate_param_use.rs:17:29
-   |
-LL | type TwoLifetimes<'a, 'b> = impl Debug;
-   |                             ^^^^^^^^^^
-
-error: non-defining opaque type use in defining scope
-  --> $DIR/generic_duplicate_param_use.rs:33:50
-   |
-LL | fn one_const<const N: usize>(t: *mut [u8; N]) -> TwoConsts<N, N> {
-   |                                                  ^^^^^^^^^^^^^^^ generic argument `N` used twice
-   |
-note: for this opaque type
-  --> $DIR/generic_duplicate_param_use.rs:19:50
-   |
-LL | type TwoConsts<const X: usize, const Y: usize> = impl Debug;
-   |                                                  ^^^^^^^^^^
-
-error: non-defining opaque type use in defining scope
   --> $DIR/generic_duplicate_param_use.rs:29:5
    |
 LL |     t
@@ -70,5 +34,5 @@ note: constant used multiple times
 LL | type TwoConsts<const X: usize, const Y: usize> = impl Debug;
    |                ^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^
 
-error: aborting due to 6 previous errors
+error: aborting due to 3 previous errors
 
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use10.rs b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use10.rs
index 439214911eb..849d237b809 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use10.rs
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use10.rs
@@ -7,6 +7,7 @@ fn main() {}
 
 type Two<T: Debug, U> = impl Debug;
 
+#[define_opaque(Two)]
 fn two<T: Debug, U: Debug>(t: T, _: U) -> Two<T, U> {
     (t, 4u32)
 }
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.rs b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.rs
index 201535efe15..073684b8add 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.rs
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.rs
@@ -7,6 +7,7 @@ fn main() {}
 // test that unused generic parameters are ok
 type Two<T, U> = impl Debug;
 
+#[define_opaque(Two)]
 fn two<T: Debug, U>(t: T, _: U) -> Two<T, U> {
     t
     //~^ ERROR `T` doesn't implement `Debug`
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.stderr
index cd6e85764bd..ef0e73f1481 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.stderr
@@ -1,5 +1,5 @@
 error[E0277]: `T` doesn't implement `Debug`
-  --> $DIR/generic_duplicate_param_use2.rs:11:5
+  --> $DIR/generic_duplicate_param_use2.rs:12:5
    |
 LL |     t
    |     ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug`
@@ -10,7 +10,7 @@ note: required by a bound in an opaque type
 LL | type Two<T, U> = impl Debug;
    |                       ^^^^^
 note: this definition site has more where clauses than the opaque type
-  --> $DIR/generic_duplicate_param_use2.rs:10:1
+  --> $DIR/generic_duplicate_param_use2.rs:11:1
    |
 LL | fn two<T: Debug, U>(t: T, _: U) -> Two<T, U> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use3.rs b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use3.rs
index 2074f12750f..f732b233396 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use3.rs
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use3.rs
@@ -7,10 +7,12 @@ fn main() {}
 // test that unused generic parameters are ok
 type Two<T, U> = impl Debug;
 
+#[define_opaque(Two)]
 fn two<T: Debug, U>(t: T, _: U) -> Two<T, U> {
     t
 }
 
+#[define_opaque(Two)]
 fn three<T, U: Debug>(_: T, u: U) -> Two<T, U> {
     u
     //~^ ERROR concrete type differs
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use3.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use3.stderr
index 9a10a4980d8..b0a1bd77f85 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use3.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use3.stderr
@@ -1,11 +1,11 @@
 error: concrete type differs from previous defining opaque type use
-  --> $DIR/generic_duplicate_param_use3.rs:15:5
+  --> $DIR/generic_duplicate_param_use3.rs:17:5
    |
 LL |     u
    |     ^ expected `T`, got `U`
    |
 note: previous use here
-  --> $DIR/generic_duplicate_param_use3.rs:11:5
+  --> $DIR/generic_duplicate_param_use3.rs:12:5
    |
 LL |     t
    |     ^
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.rs b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.rs
index d1e5a0f0198..68a8f3da168 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.rs
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.rs
@@ -7,6 +7,7 @@ fn main() {}
 // test that unused generic parameters are ok
 type Two<T, U> = impl Debug;
 
+#[define_opaque(Two)]
 fn three<T, U: Debug>(_: T, u: U) -> Two<T, U> {
     u
     //~^ ERROR `U` doesn't implement `Debug`
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.stderr
index bf3c4a0e04f..0932c72ff93 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.stderr
@@ -1,5 +1,5 @@
 error[E0277]: `U` doesn't implement `Debug`
-  --> $DIR/generic_duplicate_param_use4.rs:11:5
+  --> $DIR/generic_duplicate_param_use4.rs:12:5
    |
 LL |     u
    |     ^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug`
@@ -10,7 +10,7 @@ note: required by a bound in an opaque type
 LL | type Two<T, U> = impl Debug;
    |                       ^^^^^
 note: this definition site has more where clauses than the opaque type
-  --> $DIR/generic_duplicate_param_use4.rs:10:1
+  --> $DIR/generic_duplicate_param_use4.rs:11:1
    |
 LL | fn three<T, U: Debug>(_: T, u: U) -> Two<T, U> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use5.rs b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use5.rs
index b3d6beaf848..d450bef5758 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use5.rs
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use5.rs
@@ -7,10 +7,12 @@ fn main() {}
 // test that unused generic parameters are ok
 type Two<T, U> = impl Debug;
 
+#[define_opaque(Two)]
 fn two<T: Debug, U: Debug>(t: T, u: U) -> Two<T, U> {
     (t, u)
 }
 
+#[define_opaque(Two)]
 fn three<T: Debug, U: Debug>(t: T, u: U) -> Two<T, U> {
     (u, t)
     //~^ ERROR concrete type differs
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use5.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use5.stderr
index b0027f8fa57..b8a2a937416 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use5.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use5.stderr
@@ -1,11 +1,11 @@
 error: concrete type differs from previous defining opaque type use
-  --> $DIR/generic_duplicate_param_use5.rs:15:5
+  --> $DIR/generic_duplicate_param_use5.rs:17:5
    |
 LL |     (u, t)
    |     ^^^^^^ expected `(T, U)`, got `(U, T)`
    |
 note: previous use here
-  --> $DIR/generic_duplicate_param_use5.rs:11:5
+  --> $DIR/generic_duplicate_param_use5.rs:12:5
    |
 LL |     (t, u)
    |     ^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use6.rs b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use6.rs
index fa8b2a290b9..24d03b9e60d 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use6.rs
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use6.rs
@@ -7,10 +7,12 @@ fn main() {}
 // test that unused generic parameters are ok
 type Two<T, U> = impl Debug;
 
+#[define_opaque(Two)]
 fn two<T: Copy + Debug, U: Debug>(t: T, u: U) -> Two<T, U> {
     (t, t)
 }
 
+#[define_opaque(Two)]
 fn three<T: Copy + Debug, U: Debug>(t: T, u: U) -> Two<T, U> {
     (u, t)
     //~^ ERROR concrete type differs
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use6.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use6.stderr
index 09c01932cef..983e58d3c70 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use6.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use6.stderr
@@ -1,11 +1,11 @@
 error: concrete type differs from previous defining opaque type use
-  --> $DIR/generic_duplicate_param_use6.rs:15:5
+  --> $DIR/generic_duplicate_param_use6.rs:17:5
    |
 LL |     (u, t)
    |     ^^^^^^ expected `(T, T)`, got `(U, T)`
    |
 note: previous use here
-  --> $DIR/generic_duplicate_param_use6.rs:11:5
+  --> $DIR/generic_duplicate_param_use6.rs:12:5
    |
 LL |     (t, t)
    |     ^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use7.rs b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use7.rs
index adc912294fd..6f4a81ed760 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use7.rs
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use7.rs
@@ -7,18 +7,22 @@ fn main() {}
 
 type Two<A: Debug, B> = impl Debug;
 
+#[define_opaque(Two)]
 fn two<T: Debug + Copy, U>(t: T, u: U) -> Two<T, U> {
     (t, t)
 }
 
+#[define_opaque(Two)]
 fn three<T: Debug, U>(t: T, t2: T, u: U) -> Two<T, U> {
     (t, t2)
 }
 
+#[define_opaque(Two)]
 fn four<T: Debug, U, V>(t: T, t2: T, u: U, v: V) -> Two<T, U> {
     (t, t2)
 }
 
+#[define_opaque(Two)]
 fn five<X, Y: Debug>(x: X, y: Y, y2: Y) -> Two<Y, X> {
     (y, y2)
 }
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use8.rs b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use8.rs
index 76c13bb027b..03057c84782 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use8.rs
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use8.rs
@@ -6,10 +6,12 @@ fn main() {}
 
 type Two<T, U> = impl Debug;
 
+#[define_opaque(Two)]
 fn two<T: Debug, U: Debug>(t: T, _: U) -> Two<T, U> {
     (t, 4u32)
 }
 
+#[define_opaque(Two)]
 fn three<T: Debug, U: Debug>(_: T, u: U) -> Two<T, U> {
     (u, 4u32)
     //~^ concrete type differs
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use8.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use8.stderr
index 09d2abe3663..48c98c1e2b1 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use8.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use8.stderr
@@ -1,11 +1,11 @@
 error: concrete type differs from previous defining opaque type use
-  --> $DIR/generic_duplicate_param_use8.rs:14:5
+  --> $DIR/generic_duplicate_param_use8.rs:16:5
    |
 LL |     (u, 4u32)
    |     ^^^^^^^^^ expected `(T, u32)`, got `(U, u32)`
    |
 note: previous use here
-  --> $DIR/generic_duplicate_param_use8.rs:10:5
+  --> $DIR/generic_duplicate_param_use8.rs:11:5
    |
 LL |     (t, 4u32)
    |     ^^^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use9.rs b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use9.rs
index 5da7aab0da7..74176550ab2 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use9.rs
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use9.rs
@@ -11,10 +11,12 @@ trait Foo {
     const BAR: Self::Bar;
 }
 
+#[define_opaque(Two)]
 fn two<T: Debug + Foo, U: Debug>(t: T, u: U) -> Two<T, U> {
     (t, u, T::BAR)
 }
 
+#[define_opaque(Two)]
 fn three<T: Debug, U: Debug>(t: T, u: U) -> Two<T, U> {
     (t, u, 42)
     //~^ ERROR concrete type differs
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use9.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use9.stderr
index 6e1bb3dfa17..542324c949f 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use9.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use9.stderr
@@ -1,11 +1,11 @@
 error: concrete type differs from previous defining opaque type use
-  --> $DIR/generic_duplicate_param_use9.rs:19:5
+  --> $DIR/generic_duplicate_param_use9.rs:21:5
    |
 LL |     (t, u, 42)
    |     ^^^^^^^^^^ expected `(A, B, <A as Foo>::Bar)`, got `(A, B, i32)`
    |
 note: previous use here
-  --> $DIR/generic_duplicate_param_use9.rs:15:5
+  --> $DIR/generic_duplicate_param_use9.rs:16:5
    |
 LL |     (t, u, T::BAR)
    |     ^^^^^^^^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/generic_lifetime_param.rs b/tests/ui/type-alias-impl-trait/generic_lifetime_param.rs
index b9b34f55e7e..d5fb1b461ec 100644
--- a/tests/ui/type-alias-impl-trait/generic_lifetime_param.rs
+++ b/tests/ui/type-alias-impl-trait/generic_lifetime_param.rs
@@ -6,6 +6,7 @@ fn main() {}
 
 type Region<'a> = impl std::fmt::Debug;
 
+#[define_opaque(Region)]
 fn region<'b>(a: &'b ()) -> Region<'b> {
     a
 }
diff --git a/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs b/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs
index 68f4c6923ae..7791410294c 100644
--- a/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs
+++ b/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs
@@ -12,20 +12,20 @@ type OneConst<const X: usize> = impl Debug;
 
 // Not defining uses, because they doesn't define *all* possible generics.
 
+#[define_opaque(OneTy)]
 fn concrete_ty() -> OneTy<u32> {
-    //~^ ERROR: non-defining opaque type use in defining scope
     5u32
     //~^ ERROR: expected generic type parameter, found `u32`
 }
 
+#[define_opaque(OneLifetime)]
 fn concrete_lifetime() -> OneLifetime<'static> {
-    //~^ ERROR: non-defining opaque type use in defining scope
     6u32
     //~^ ERROR: expected generic lifetime parameter, found `'static`
 }
 
+#[define_opaque(OneConst)]
 fn concrete_const() -> OneConst<{ 123 }> {
-    //~^ ERROR: non-defining opaque type use in defining scope
     7u32
     //~^ ERROR: expected generic constant parameter, found `123`
 }
diff --git a/tests/ui/type-alias-impl-trait/generic_nondefining_use.stderr b/tests/ui/type-alias-impl-trait/generic_nondefining_use.stderr
index bd68b4e3ea4..1b0ce7cc619 100644
--- a/tests/ui/type-alias-impl-trait/generic_nondefining_use.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_nondefining_use.stderr
@@ -1,15 +1,3 @@
-error[E0792]: non-defining opaque type use in defining scope
-  --> $DIR/generic_nondefining_use.rs:15:21
-   |
-LL | fn concrete_ty() -> OneTy<u32> {
-   |                     ^^^^^^^^^^ argument `u32` is not a generic parameter
-   |
-note: for this opaque type
-  --> $DIR/generic_nondefining_use.rs:7:17
-   |
-LL | type OneTy<T> = impl Debug;
-   |                 ^^^^^^^^^^
-
 error[E0792]: expected generic type parameter, found `u32`
   --> $DIR/generic_nondefining_use.rs:17:5
    |
@@ -19,30 +7,6 @@ LL | type OneTy<T> = impl Debug;
 LL |     5u32
    |     ^^^^
 
-error[E0792]: non-defining opaque type use in defining scope
-  --> $DIR/generic_nondefining_use.rs:21:27
-   |
-LL | fn concrete_lifetime() -> OneLifetime<'static> {
-   |                           ^^^^^^^^^^^^^^^^^^^^ argument `'static` is not a generic parameter
-   |
-note: for this opaque type
-  --> $DIR/generic_nondefining_use.rs:9:24
-   |
-LL | type OneLifetime<'a> = impl Debug;
-   |                        ^^^^^^^^^^
-
-error[E0792]: non-defining opaque type use in defining scope
-  --> $DIR/generic_nondefining_use.rs:27:24
-   |
-LL | fn concrete_const() -> OneConst<{ 123 }> {
-   |                        ^^^^^^^^^^^^^^^^^ argument `123` is not a generic parameter
-   |
-note: for this opaque type
-  --> $DIR/generic_nondefining_use.rs:11:33
-   |
-LL | type OneConst<const X: usize> = impl Debug;
-   |                                 ^^^^^^^^^^
-
 error[E0792]: expected generic lifetime parameter, found `'static`
   --> $DIR/generic_nondefining_use.rs:23:5
    |
@@ -61,6 +25,6 @@ LL | type OneConst<const X: usize> = impl Debug;
 LL |     7u32
    |     ^^^^
 
-error: aborting due to 6 previous errors
+error: aborting due to 3 previous errors
 
 For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/type-alias-impl-trait/generic_not_used.rs b/tests/ui/type-alias-impl-trait/generic_not_used.rs
index c70f473cff5..6042cdd30a9 100644
--- a/tests/ui/type-alias-impl-trait/generic_not_used.rs
+++ b/tests/ui/type-alias-impl-trait/generic_not_used.rs
@@ -5,6 +5,7 @@ fn main() {}
 type WrongGeneric<T: 'static> = impl 'static;
 //~^ ERROR: at least one trait must be specified
 
+#[define_opaque(WrongGeneric)]
 fn wrong_generic<U: 'static, V: 'static>(_: U, v: V) -> WrongGeneric<U> {
     v
     //~^ ERROR type parameter `V` is part of concrete type but not used in parameter list
diff --git a/tests/ui/type-alias-impl-trait/generic_not_used.stderr b/tests/ui/type-alias-impl-trait/generic_not_used.stderr
index fd720239a52..5fe2fefcecf 100644
--- a/tests/ui/type-alias-impl-trait/generic_not_used.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_not_used.stderr
@@ -5,7 +5,7 @@ LL | type WrongGeneric<T: 'static> = impl 'static;
    |                                 ^^^^^^^^^^^^
 
 error: type parameter `V` is part of concrete type but not used in parameter list for the `impl Trait` type alias
-  --> $DIR/generic_not_used.rs:9:5
+  --> $DIR/generic_not_used.rs:10:5
    |
 LL |     v
    |     ^
diff --git a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs
index c60f5c11cd1..4b8a1cfc472 100644
--- a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs
+++ b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs
@@ -9,6 +9,7 @@ fn main() {
     type WrongGeneric<T> = impl 'static;
     //~^ ERROR: at least one trait must be specified
 
+    #[define_opaque(WrongGeneric)]
     fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
         t
         //~^ ERROR the parameter type `T` may not live long enough
diff --git a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr
index c352a33fbbc..2b3f7d75028 100644
--- a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr
@@ -14,7 +14,7 @@ LL |     type WrongGeneric<T> = impl 'static;
    |                       - this generic parameter must be used with a generic type parameter
 
 error[E0310]: the parameter type `T` may not live long enough
-  --> $DIR/generic_type_does_not_live_long_enough.rs:13:9
+  --> $DIR/generic_type_does_not_live_long_enough.rs:14:9
    |
 LL |         t
    |         ^
diff --git a/tests/ui/type-alias-impl-trait/generic_underconstrained.rs b/tests/ui/type-alias-impl-trait/generic_underconstrained.rs
index 1acacc778de..9c2180e92fc 100644
--- a/tests/ui/type-alias-impl-trait/generic_underconstrained.rs
+++ b/tests/ui/type-alias-impl-trait/generic_underconstrained.rs
@@ -6,6 +6,7 @@ trait Trait {}
 type Underconstrained<T: Trait> = impl Send;
 
 // no `Trait` bound
+#[define_opaque(Underconstrained)]
 fn underconstrain<T>(_: T) -> Underconstrained<T> {
     //~^ ERROR the trait bound `T: Trait`
     //~| ERROR the trait bound `T: Trait`
diff --git a/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr b/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr
index c24f8fd867f..b1bc62c5910 100644
--- a/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr
@@ -1,5 +1,5 @@
 error[E0277]: the trait bound `T: Trait` is not satisfied
-  --> $DIR/generic_underconstrained.rs:9:31
+  --> $DIR/generic_underconstrained.rs:10:31
    |
 LL | fn underconstrain<T>(_: T) -> Underconstrained<T> {
    |                               ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T`
@@ -15,7 +15,7 @@ LL | fn underconstrain<T: Trait>(_: T) -> Underconstrained<T> {
    |                    +++++++
 
 error[E0277]: the trait bound `T: Trait` is not satisfied
-  --> $DIR/generic_underconstrained.rs:9:31
+  --> $DIR/generic_underconstrained.rs:10:31
    |
 LL | fn underconstrain<T>(_: T) -> Underconstrained<T> {
    |                               ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T`
diff --git a/tests/ui/type-alias-impl-trait/generic_underconstrained2.rs b/tests/ui/type-alias-impl-trait/generic_underconstrained2.rs
index 1e1bece9a1c..f05f9776006 100644
--- a/tests/ui/type-alias-impl-trait/generic_underconstrained2.rs
+++ b/tests/ui/type-alias-impl-trait/generic_underconstrained2.rs
@@ -5,6 +5,7 @@ fn main() {}
 type Underconstrained<T: std::fmt::Debug> = impl Send;
 
 // not a defining use, because it doesn't define *all* possible generics
+#[define_opaque(Underconstrained)]
 fn underconstrained<U>(_: U) -> Underconstrained<U> {
     //~^ ERROR `U` doesn't implement `Debug`
     //~| ERROR `U` doesn't implement `Debug`
@@ -14,6 +15,7 @@ fn underconstrained<U>(_: U) -> Underconstrained<U> {
 type Underconstrained2<T: std::fmt::Debug> = impl Send;
 
 // not a defining use, because it doesn't define *all* possible generics
+#[define_opaque(Underconstrained2)]
 fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> {
     //~^ ERROR `V` doesn't implement `Debug`
     //~| ERROR `V` doesn't implement `Debug`
diff --git a/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr b/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr
index 93df5ddca79..429c3b9175a 100644
--- a/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr
@@ -1,5 +1,5 @@
 error[E0277]: `U` doesn't implement `Debug`
-  --> $DIR/generic_underconstrained2.rs:8:33
+  --> $DIR/generic_underconstrained2.rs:9:33
    |
 LL | fn underconstrained<U>(_: U) -> Underconstrained<U> {
    |                                 ^^^^^^^^^^^^^^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug`
@@ -15,13 +15,13 @@ LL | fn underconstrained<U: std::fmt::Debug>(_: U) -> Underconstrained<U> {
    |                      +++++++++++++++++
 
 error[E0277]: `V` doesn't implement `Debug`
-  --> $DIR/generic_underconstrained2.rs:17:43
+  --> $DIR/generic_underconstrained2.rs:19:43
    |
 LL | fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> {
    |                                           ^^^^^^^^^^^^^^^^^^^^ `V` cannot be formatted using `{:?}` because it doesn't implement `Debug`
    |
 note: required by a bound on the type alias `Underconstrained2`
-  --> $DIR/generic_underconstrained2.rs:14:27
+  --> $DIR/generic_underconstrained2.rs:15:27
    |
 LL | type Underconstrained2<T: std::fmt::Debug> = impl Send;
    |                           ^^^^^^^^^^^^^^^ required by this bound
@@ -31,7 +31,7 @@ LL | fn underconstrained2<U, V: std::fmt::Debug>(_: U, _: V) -> Underconstrained
    |                          +++++++++++++++++
 
 error[E0277]: `U` doesn't implement `Debug`
-  --> $DIR/generic_underconstrained2.rs:8:33
+  --> $DIR/generic_underconstrained2.rs:9:33
    |
 LL | fn underconstrained<U>(_: U) -> Underconstrained<U> {
    |                                 ^^^^^^^^^^^^^^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug`
@@ -48,13 +48,13 @@ LL | fn underconstrained<U: std::fmt::Debug>(_: U) -> Underconstrained<U> {
    |                      +++++++++++++++++
 
 error[E0277]: `V` doesn't implement `Debug`
-  --> $DIR/generic_underconstrained2.rs:17:43
+  --> $DIR/generic_underconstrained2.rs:19:43
    |
 LL | fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> {
    |                                           ^^^^^^^^^^^^^^^^^^^^ `V` cannot be formatted using `{:?}` because it doesn't implement `Debug`
    |
 note: required by a bound on the type alias `Underconstrained2`
-  --> $DIR/generic_underconstrained2.rs:14:27
+  --> $DIR/generic_underconstrained2.rs:15:27
    |
 LL | type Underconstrained2<T: std::fmt::Debug> = impl Send;
    |                           ^^^^^^^^^^^^^^^ required by this bound
diff --git a/tests/ui/type-alias-impl-trait/hidden_behind_projection_behind_struct_field.rs b/tests/ui/type-alias-impl-trait/hidden_behind_projection_behind_struct_field.rs
index eb19b49c7e2..bf97dd9a25c 100644
--- a/tests/ui/type-alias-impl-trait/hidden_behind_projection_behind_struct_field.rs
+++ b/tests/ui/type-alias-impl-trait/hidden_behind_projection_behind_struct_field.rs
@@ -15,6 +15,7 @@ trait Trait: Sized {
 
 impl Trait for Bar {
     type Assoc = impl std::fmt::Debug;
+    //~^ ERROR: unconstrained opaque type
     fn foo() -> Foo<Bar> {
         Foo { field: () }
         //~^ ERROR: mismatched types
diff --git a/tests/ui/type-alias-impl-trait/hidden_behind_projection_behind_struct_field.stderr b/tests/ui/type-alias-impl-trait/hidden_behind_projection_behind_struct_field.stderr
index 00aedfae463..879f024dee7 100644
--- a/tests/ui/type-alias-impl-trait/hidden_behind_projection_behind_struct_field.stderr
+++ b/tests/ui/type-alias-impl-trait/hidden_behind_projection_behind_struct_field.stderr
@@ -1,20 +1,23 @@
+error: unconstrained opaque type
+  --> $DIR/hidden_behind_projection_behind_struct_field.rs:17:18
+   |
+LL |     type Assoc = impl std::fmt::Debug;
+   |                  ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `Assoc` must be used in combination with a concrete type within the same impl
+
 error[E0308]: mismatched types
-  --> $DIR/hidden_behind_projection_behind_struct_field.rs:19:22
+  --> $DIR/hidden_behind_projection_behind_struct_field.rs:20:22
    |
 LL |     type Assoc = impl std::fmt::Debug;
    |                  -------------------- the expected opaque type
-LL |     fn foo() -> Foo<Bar> {
+...
 LL |         Foo { field: () }
    |                      ^^ expected opaque type, found `()`
    |
    = note: expected opaque type `<Bar as Trait>::Assoc`
                 found unit type `()`
-note: this item must have the opaque type in its signature in order to be able to register hidden types
-  --> $DIR/hidden_behind_projection_behind_struct_field.rs:18:8
-   |
-LL |     fn foo() -> Foo<Bar> {
-   |        ^^^
 
-error: aborting due to 1 previous error
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/type-alias-impl-trait/hidden_behind_struct_field2.rs b/tests/ui/type-alias-impl-trait/hidden_behind_struct_field2.rs
index 3117060cef0..b1dcf98f4dd 100644
--- a/tests/ui/type-alias-impl-trait/hidden_behind_struct_field2.rs
+++ b/tests/ui/type-alias-impl-trait/hidden_behind_struct_field2.rs
@@ -13,6 +13,7 @@ trait Trait: Sized {
 
 impl Trait for Bar {
     type Assoc = impl std::fmt::Debug;
+    //~^ ERROR: unconstrained opaque type
     fn foo() -> Foo {
         Foo { field: () }
         //~^ ERROR: mismatched types
diff --git a/tests/ui/type-alias-impl-trait/hidden_behind_struct_field2.stderr b/tests/ui/type-alias-impl-trait/hidden_behind_struct_field2.stderr
index 4910e794e8d..1820560eadd 100644
--- a/tests/ui/type-alias-impl-trait/hidden_behind_struct_field2.stderr
+++ b/tests/ui/type-alias-impl-trait/hidden_behind_struct_field2.stderr
@@ -1,20 +1,23 @@
+error: unconstrained opaque type
+  --> $DIR/hidden_behind_struct_field2.rs:15:18
+   |
+LL |     type Assoc = impl std::fmt::Debug;
+   |                  ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `Assoc` must be used in combination with a concrete type within the same impl
+
 error[E0308]: mismatched types
-  --> $DIR/hidden_behind_struct_field2.rs:17:22
+  --> $DIR/hidden_behind_struct_field2.rs:18:22
    |
 LL |     type Assoc = impl std::fmt::Debug;
    |                  -------------------- the expected opaque type
-LL |     fn foo() -> Foo {
+...
 LL |         Foo { field: () }
    |                      ^^ expected opaque type, found `()`
    |
    = note: expected opaque type `<Bar as Trait>::Assoc`
                 found unit type `()`
-note: this item must have the opaque type in its signature in order to be able to register hidden types
-  --> $DIR/hidden_behind_struct_field2.rs:16:8
-   |
-LL |     fn foo() -> Foo {
-   |        ^^^
 
-error: aborting due to 1 previous error
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/type-alias-impl-trait/hidden_behind_struct_field3.rs b/tests/ui/type-alias-impl-trait/hidden_behind_struct_field3.rs
index c1f13599412..70697e2fa65 100644
--- a/tests/ui/type-alias-impl-trait/hidden_behind_struct_field3.rs
+++ b/tests/ui/type-alias-impl-trait/hidden_behind_struct_field3.rs
@@ -14,6 +14,7 @@ trait Trait: Sized {
 
 impl Trait for Bar {
     type Assoc2 = impl std::fmt::Debug;
+    //~^ ERROR: unconstrained opaque type
     type Assoc = impl Iterator<Item = Foo>;
     fn foo() -> Self::Assoc {
         vec![Foo { field: () }].into_iter()
diff --git a/tests/ui/type-alias-impl-trait/hidden_behind_struct_field3.stderr b/tests/ui/type-alias-impl-trait/hidden_behind_struct_field3.stderr
index f10ccc00299..9ce696fa26c 100644
--- a/tests/ui/type-alias-impl-trait/hidden_behind_struct_field3.stderr
+++ b/tests/ui/type-alias-impl-trait/hidden_behind_struct_field3.stderr
@@ -1,5 +1,13 @@
+error: unconstrained opaque type
+  --> $DIR/hidden_behind_struct_field3.rs:16:19
+   |
+LL |     type Assoc2 = impl std::fmt::Debug;
+   |                   ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `Assoc2` must be used in combination with a concrete type within the same impl
+
 error[E0308]: mismatched types
-  --> $DIR/hidden_behind_struct_field3.rs:19:27
+  --> $DIR/hidden_behind_struct_field3.rs:20:27
    |
 LL |     type Assoc2 = impl std::fmt::Debug;
    |                   -------------------- the expected opaque type
@@ -9,12 +17,7 @@ LL |         vec![Foo { field: () }].into_iter()
    |
    = note: expected opaque type `<Bar as Trait>::Assoc2`
                 found unit type `()`
-note: this item must have the opaque type in its signature in order to be able to register hidden types
-  --> $DIR/hidden_behind_struct_field3.rs:18:8
-   |
-LL |     fn foo() -> Self::Assoc {
-   |        ^^^
 
-error: aborting due to 1 previous error
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/type-alias-impl-trait/hidden_type_mismatch.rs b/tests/ui/type-alias-impl-trait/hidden_type_mismatch.rs
index 5b5acb31812..0a8860321da 100644
--- a/tests/ui/type-alias-impl-trait/hidden_type_mismatch.rs
+++ b/tests/ui/type-alias-impl-trait/hidden_type_mismatch.rs
@@ -9,6 +9,7 @@
 mod sus {
     use super::*;
     pub type Sep = impl Sized + std::fmt::Display;
+    #[define_opaque(Sep)]
     pub fn mk_sep() -> Sep {
         String::from("hello")
     }
@@ -34,6 +35,7 @@ mod sus {
     // `define_tait` is not actually callable, and thus assumed
     // `Bar<()>: Copy` even though it isn't.
     pub type Tait = impl Copy + From<Bar<()>> + Into<Bar<()>>;
+    #[define_opaque(Tait)]
     pub fn define_tait() -> Tait
     where
         // this proves `Bar<()>: Copy`, but `define_tait` is
diff --git a/tests/ui/type-alias-impl-trait/hidden_type_mismatch.stderr b/tests/ui/type-alias-impl-trait/hidden_type_mismatch.stderr
index 8547fd53c18..20991a30b53 100644
--- a/tests/ui/type-alias-impl-trait/hidden_type_mismatch.stderr
+++ b/tests/ui/type-alias-impl-trait/hidden_type_mismatch.stderr
@@ -1,5 +1,5 @@
 error[E0271]: type mismatch resolving `<() as Proj>::Assoc == i32`
-  --> $DIR/hidden_type_mismatch.rs:43:9
+  --> $DIR/hidden_type_mismatch.rs:45:9
    |
 LL |     pub type Sep = impl Sized + std::fmt::Display;
    |                    ------------------------------ the found opaque type
@@ -8,26 +8,26 @@ LL |         Bar { inner: 1i32, _marker: () }
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<() as Proj>::Assoc == i32`
    |
 note: expected this to be `i32`
-  --> $DIR/hidden_type_mismatch.rs:20:22
+  --> $DIR/hidden_type_mismatch.rs:21:22
    |
 LL |         type Assoc = sus::Sep;
    |                      ^^^^^^^^
    = note:     expected type `i32`
            found opaque type `Sep`
 note: required for `Bar<()>` to implement `Copy`
-  --> $DIR/hidden_type_mismatch.rs:32:39
+  --> $DIR/hidden_type_mismatch.rs:33:39
    |
 LL |     impl<T: Proj<Assoc = i32> + Copy> Copy for Bar<T> {}
    |                  -----------          ^^^^     ^^^^^^
    |                  |
    |                  unsatisfied trait bound introduced here
 note: required by a bound in an opaque type
-  --> $DIR/hidden_type_mismatch.rs:36:26
+  --> $DIR/hidden_type_mismatch.rs:37:26
    |
 LL |     pub type Tait = impl Copy + From<Bar<()>> + Into<Bar<()>>;
    |                          ^^^^
 note: this definition site has more where clauses than the opaque type
-  --> $DIR/hidden_type_mismatch.rs:37:5
+  --> $DIR/hidden_type_mismatch.rs:39:5
    |
 LL | /     pub fn define_tait() -> Tait
 LL | |     where
diff --git a/tests/ui/type-alias-impl-trait/higher_kinded_params.rs b/tests/ui/type-alias-impl-trait/higher_kinded_params.rs
index e43f53e4057..6008df3b0a2 100644
--- a/tests/ui/type-alias-impl-trait/higher_kinded_params.rs
+++ b/tests/ui/type-alias-impl-trait/higher_kinded_params.rs
@@ -22,6 +22,7 @@ struct Terminator;
 type Successors<'a> = impl std::fmt::Debug + 'a;
 
 impl Terminator {
+    #[define_opaque(Successors)]
     fn successors(&self, _: for<'x> fn(&'x ()) -> <&'x A as B>::C) -> Successors<'_> {}
 }
 
diff --git a/tests/ui/type-alias-impl-trait/higher_kinded_params2.rs b/tests/ui/type-alias-impl-trait/higher_kinded_params2.rs
index 19c6099135d..8ed7c1336f2 100644
--- a/tests/ui/type-alias-impl-trait/higher_kinded_params2.rs
+++ b/tests/ui/type-alias-impl-trait/higher_kinded_params2.rs
@@ -2,6 +2,7 @@
 //! and normalizing something behind them actually works.
 
 //@ edition: 2021
+//@ check-pass
 
 #![feature(type_alias_impl_trait)]
 
@@ -22,9 +23,9 @@ struct Terminator;
 type Successors<'a> = impl std::fmt::Debug + 'a;
 
 impl Terminator {
+    #[define_opaque(Successors, Tait)]
     fn successors(&self, mut f: for<'x> fn(&'x ()) -> <&'x A as B>::C) -> Successors<'_> {
         f = g;
-        //~^ ERROR mismatched types
     }
 }
 
diff --git a/tests/ui/type-alias-impl-trait/higher_kinded_params2.stderr b/tests/ui/type-alias-impl-trait/higher_kinded_params2.stderr
deleted file mode 100644
index 790e7fe8580..00000000000
--- a/tests/ui/type-alias-impl-trait/higher_kinded_params2.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/higher_kinded_params2.rs:26:13
-   |
-LL | type Tait = impl std::fmt::Debug;
-   |             -------------------- the expected opaque type
-...
-LL |         f = g;
-   |             ^ expected fn pointer, found fn item
-   |
-   = note: expected fn pointer `for<'x> fn(&'x ()) -> Tait`
-                 found fn item `for<'a> fn(&'a ()) -> String {g}`
-note: this item must have the opaque type in its signature in order to be able to register hidden types
-  --> $DIR/higher_kinded_params2.rs:25:8
-   |
-LL |     fn successors(&self, mut f: for<'x> fn(&'x ()) -> <&'x A as B>::C) -> Successors<'_> {
-   |        ^^^^^^^^^^
-
-error: aborting due to 1 previous error
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/type-alias-impl-trait/higher_kinded_params3.rs b/tests/ui/type-alias-impl-trait/higher_kinded_params3.rs
index 3845cde29fa..4fb2e60b5c5 100644
--- a/tests/ui/type-alias-impl-trait/higher_kinded_params3.rs
+++ b/tests/ui/type-alias-impl-trait/higher_kinded_params3.rs
@@ -22,6 +22,7 @@ struct Terminator;
 type Successors<'a> = impl std::fmt::Debug + 'a;
 
 impl Terminator {
+    #[define_opaque(Successors, Tait)]
     fn successors(&self, mut f: for<'x> fn(&'x ()) -> <&'x A as B>::C) -> Successors<'_> {
         f = g;
         //~^ ERROR mismatched types
diff --git a/tests/ui/type-alias-impl-trait/higher_kinded_params3.stderr b/tests/ui/type-alias-impl-trait/higher_kinded_params3.stderr
index 41a3f9ce268..558792987f3 100644
--- a/tests/ui/type-alias-impl-trait/higher_kinded_params3.stderr
+++ b/tests/ui/type-alias-impl-trait/higher_kinded_params3.stderr
@@ -1,19 +1,14 @@
 error[E0308]: mismatched types
-  --> $DIR/higher_kinded_params3.rs:26:13
+  --> $DIR/higher_kinded_params3.rs:27:9
    |
 LL | type Tait<'a> = impl std::fmt::Debug + 'a;
    |                 ------------------------- the expected opaque type
 ...
 LL |         f = g;
-   |             ^ expected fn pointer, found fn item
+   |         ^^^^^ one type is more general than the other
    |
    = note: expected fn pointer `for<'x> fn(&'x ()) -> Tait<'x>`
-                 found fn item `for<'a> fn(&'a ()) -> &'a () {g}`
-note: this item must have the opaque type in its signature in order to be able to register hidden types
-  --> $DIR/higher_kinded_params3.rs:25:8
-   |
-LL |     fn successors(&self, mut f: for<'x> fn(&'x ()) -> <&'x A as B>::C) -> Successors<'_> {
-   |        ^^^^^^^^^^
+              found fn pointer `for<'a> fn(&'a ()) -> &'a ()`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden.rs b/tests/ui/type-alias-impl-trait/hkl_forbidden.rs
index c6d1202ef85..994adc476e2 100644
--- a/tests/ui/type-alias-impl-trait/hkl_forbidden.rs
+++ b/tests/ui/type-alias-impl-trait/hkl_forbidden.rs
@@ -6,6 +6,7 @@ fn id(s: &str) -> &str {
 
 type Opaque<'a> = impl Sized + 'a;
 
+#[define_opaque(Opaque)]
 fn test(s: &str) -> (impl Fn(&str) -> Opaque<'_>, impl Fn(&str) -> Opaque<'_>) {
     (id, id) //~ ERROR expected generic lifetime parameter, found `'_`
 }
@@ -16,22 +17,26 @@ fn id2<'a, 'b>(s: (&'a str, &'b str)) -> (&'a str, &'b str) {
 
 type Opaque2<'a> = impl Sized + 'a;
 
+#[define_opaque(Opaque2)]
 fn test2() -> impl for<'a, 'b> Fn((&'a str, &'b str)) -> (Opaque2<'a>, Opaque2<'b>) {
     id2 //~ ERROR expected generic lifetime parameter, found `'a`
 }
 
 type Opaque3<'a> = impl Sized + 'a;
 
+#[define_opaque(Opaque3)]
 fn test3(s: &str) -> (impl Fn(&str) -> Opaque3<'_>, Opaque3<'_>) {
     (id, s) //~ ERROR expected generic lifetime parameter, found `'_`
 }
 
 type Opaque4<'a> = impl Sized + 'a;
+#[define_opaque(Opaque4)]
 fn test4(s: &str) -> (Opaque4<'_>, impl Fn(&str) -> Opaque4<'_>) {
     (s, id) //~ ERROR expected generic lifetime parameter, found `'_`
 }
 
 type Inner<'a> = impl Sized;
+#[define_opaque(Inner)]
 fn outer_impl() -> impl for<'a> Fn(&'a ()) -> Inner<'a> {
     |x| x //~ ERROR expected generic lifetime parameter, found `'a`
 }
diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden.stderr b/tests/ui/type-alias-impl-trait/hkl_forbidden.stderr
index d49be73d94e..d404d60f31e 100644
--- a/tests/ui/type-alias-impl-trait/hkl_forbidden.stderr
+++ b/tests/ui/type-alias-impl-trait/hkl_forbidden.stderr
@@ -1,5 +1,5 @@
 error[E0792]: expected generic lifetime parameter, found `'_`
-  --> $DIR/hkl_forbidden.rs:10:5
+  --> $DIR/hkl_forbidden.rs:11:5
    |
 LL | type Opaque<'a> = impl Sized + 'a;
    |             -- this generic parameter must be used with a generic lifetime parameter
@@ -8,7 +8,7 @@ LL |     (id, id)
    |     ^^^^^^^^
 
 error[E0792]: expected generic lifetime parameter, found `'a`
-  --> $DIR/hkl_forbidden.rs:20:5
+  --> $DIR/hkl_forbidden.rs:22:5
    |
 LL | type Opaque2<'a> = impl Sized + 'a;
    |              -- this generic parameter must be used with a generic lifetime parameter
@@ -17,7 +17,7 @@ LL |     id2
    |     ^^^
 
 error[E0792]: expected generic lifetime parameter, found `'_`
-  --> $DIR/hkl_forbidden.rs:26:5
+  --> $DIR/hkl_forbidden.rs:29:5
    |
 LL | type Opaque3<'a> = impl Sized + 'a;
    |              -- this generic parameter must be used with a generic lifetime parameter
@@ -26,20 +26,20 @@ LL |     (id, s)
    |     ^^^^^^^
 
 error[E0792]: expected generic lifetime parameter, found `'_`
-  --> $DIR/hkl_forbidden.rs:31:5
+  --> $DIR/hkl_forbidden.rs:35:5
    |
 LL | type Opaque4<'a> = impl Sized + 'a;
    |              -- this generic parameter must be used with a generic lifetime parameter
-LL | fn test4(s: &str) -> (Opaque4<'_>, impl Fn(&str) -> Opaque4<'_>) {
+...
 LL |     (s, id)
    |     ^^^^^^^
 
 error[E0792]: expected generic lifetime parameter, found `'a`
-  --> $DIR/hkl_forbidden.rs:36:5
+  --> $DIR/hkl_forbidden.rs:41:5
    |
 LL | type Inner<'a> = impl Sized;
    |            -- this generic parameter must be used with a generic lifetime parameter
-LL | fn outer_impl() -> impl for<'a> Fn(&'a ()) -> Inner<'a> {
+...
 LL |     |x| x
    |     ^^^^^
 
diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden2.rs b/tests/ui/type-alias-impl-trait/hkl_forbidden2.rs
index 3d583d4413d..92e383d11f1 100644
--- a/tests/ui/type-alias-impl-trait/hkl_forbidden2.rs
+++ b/tests/ui/type-alias-impl-trait/hkl_forbidden2.rs
@@ -10,6 +10,7 @@ impl<'a> Trait<'a> for () {
     type Assoc = ();
 }
 
+#[define_opaque(Opaque)]
 fn test() -> &'static dyn for<'a> Trait<'a, Assoc = Opaque<'a>> {
     &()
     //~^ ERROR: expected generic lifetime parameter, found `'a`
diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden2.stderr b/tests/ui/type-alias-impl-trait/hkl_forbidden2.stderr
index 0a9a9d6bcf4..7404c844ae7 100644
--- a/tests/ui/type-alias-impl-trait/hkl_forbidden2.stderr
+++ b/tests/ui/type-alias-impl-trait/hkl_forbidden2.stderr
@@ -1,5 +1,5 @@
 error[E0792]: expected generic lifetime parameter, found `'a`
-  --> $DIR/hkl_forbidden2.rs:14:5
+  --> $DIR/hkl_forbidden2.rs:15:5
    |
 LL | type Opaque<'a> = impl Sized + 'a;
    |             -- this generic parameter must be used with a generic lifetime parameter
diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden3.rs b/tests/ui/type-alias-impl-trait/hkl_forbidden3.rs
index a4148599f77..c7f04dc07bb 100644
--- a/tests/ui/type-alias-impl-trait/hkl_forbidden3.rs
+++ b/tests/ui/type-alias-impl-trait/hkl_forbidden3.rs
@@ -6,6 +6,7 @@ fn foo<'a>(x: &'a ()) -> &'a () {
     x
 }
 
+#[define_opaque(Opaque)]
 fn test() -> for<'a> fn(&'a ()) -> Opaque<'a> {
     foo //~ ERROR: mismatched types
 }
diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden3.stderr b/tests/ui/type-alias-impl-trait/hkl_forbidden3.stderr
index d262177a86b..b8c04185a7d 100644
--- a/tests/ui/type-alias-impl-trait/hkl_forbidden3.stderr
+++ b/tests/ui/type-alias-impl-trait/hkl_forbidden3.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/hkl_forbidden3.rs:10:5
+  --> $DIR/hkl_forbidden3.rs:11:5
    |
 LL | type Opaque<'a> = impl Sized + 'a;
    |                   --------------- the expected opaque type
diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden4.rs b/tests/ui/type-alias-impl-trait/hkl_forbidden4.rs
index fd06ea677c3..cbd8150d117 100644
--- a/tests/ui/type-alias-impl-trait/hkl_forbidden4.rs
+++ b/tests/ui/type-alias-impl-trait/hkl_forbidden4.rs
@@ -15,13 +15,13 @@ async fn operation(_: &mut ()) -> () {
     //~^ ERROR: expected generic lifetime parameter, found `'any`
 }
 
+#[define_opaque(FutNothing)]
 async fn call<F>(_f: F)
 //~^ ERROR item does not constrain
 where
     for<'any> F: FnMut(&'any mut ()) -> FutNothing<'any>,
 {
     //~^ ERROR: expected generic lifetime parameter, found `'any`
-    //~| ERROR item does not constrain
 }
 
 fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr b/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr
index feb161c3b04..2c0be0cbcdc 100644
--- a/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr
+++ b/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr
@@ -1,42 +1,27 @@
-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
+error: item does not constrain `FutNothing::{opaque#0}`
+  --> $DIR/hkl_forbidden4.rs:19:10
    |
 LL | async fn call<F>(_f: F)
    |          ^^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
   --> $DIR/hkl_forbidden4.rs:10:23
    |
 LL | type FutNothing<'a> = impl 'a + Future<Output = ()>;
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: item does not constrain `FutNothing::{opaque#0}`, but has it in its signature
-  --> $DIR/hkl_forbidden4.rs:22:1
+error: concrete type differs from previous defining opaque type use
+  --> $DIR/hkl_forbidden4.rs:12:1
    |
-LL | / {
-...  |
-LL | | }
-   | |_^
+LL | async fn operation(_: &mut ()) -> () {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `FutNothing<'_>`, got `{async fn body of operation()}`
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
-  --> $DIR/hkl_forbidden4.rs:10:23
+note: previous use here
+  --> $DIR/hkl_forbidden4.rs:14:5
    |
-LL | type FutNothing<'a> = impl 'a + Future<Output = ()>;
-   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |     call(operation).await
+   |     ^^^^^^^^^^^^^^^
 
 error[E0792]: expected generic lifetime parameter, found `'any`
   --> $DIR/hkl_forbidden4.rs:14:5
@@ -48,16 +33,16 @@ LL |     call(operation).await
    |     ^^^^^^^^^^^^^^^
 
 error[E0792]: expected generic lifetime parameter, found `'any`
-  --> $DIR/hkl_forbidden4.rs:22:1
+  --> $DIR/hkl_forbidden4.rs:23:1
    |
 LL |   type FutNothing<'a> = impl 'a + Future<Output = ()>;
    |                   -- this generic parameter must be used with a generic lifetime parameter
 ...
 LL | / {
-...  |
+LL | |
 LL | | }
    | |_^
 
-error: aborting due to 5 previous errors
+error: aborting due to 4 previous errors
 
 For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.rs b/tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.rs
index 2bcb8f06f4f..29e7c7d19fc 100644
--- a/tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.rs
+++ b/tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.rs
@@ -18,6 +18,7 @@ trait MyFrom<T>: Sized {
 trait F {}
 impl F for () {}
 type DummyT<T> = impl F;
+#[define_opaque(DummyT)]
 fn _dummy_t<T>() -> DummyT<T> {}
 
 struct Phantom1<T>(PhantomData<T>);
@@ -25,6 +26,7 @@ struct Phantom2<T>(PhantomData<T>);
 struct Scope<T>(Phantom2<DummyT<T>>);
 
 impl<T> Scope<T> {
+    #[define_opaque(DummyT)]
     fn new() -> Self {
         //~^ ERROR item does not constrain
         unimplemented!()
@@ -41,6 +43,7 @@ impl<T> MyFrom<Phantom2<T>> for Phantom1<T> {
 impl<T: MyFrom<Phantom2<DummyT<U>>>, U> MyIndex<DummyT<T>> for Scope<U> {
     //~^ ERROR the type parameter `T` is not constrained by the impl
     type O = T;
+    #[define_opaque(DummyT)]
     fn my_index(self) -> Self::O {
         MyFrom::my_from(self.0).ok().unwrap()
     }
diff --git a/tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.stderr b/tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.stderr
index 0ab4c34381a..d18a824287c 100644
--- a/tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.stderr
+++ b/tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.stderr
@@ -1,17 +1,17 @@
 error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
-  --> $DIR/ice-failed-to-resolve-instance-for-110696.rs:41:6
+  --> $DIR/ice-failed-to-resolve-instance-for-110696.rs:43:6
    |
 LL | impl<T: MyFrom<Phantom2<DummyT<U>>>, U> MyIndex<DummyT<T>> for Scope<U> {
    |      ^ unconstrained type parameter
 
-error: item does not constrain `DummyT::{opaque#0}`, but has it in its signature
-  --> $DIR/ice-failed-to-resolve-instance-for-110696.rs:28:8
+error: item does not constrain `DummyT::{opaque#0}`
+  --> $DIR/ice-failed-to-resolve-instance-for-110696.rs:30:8
    |
 LL |     fn new() -> Self {
    |        ^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
   --> $DIR/ice-failed-to-resolve-instance-for-110696.rs:20:18
    |
 LL | type DummyT<T> = impl F;
diff --git a/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.rs b/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.rs
index 71416eb531a..a9cae611ec5 100644
--- a/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.rs
+++ b/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.rs
@@ -18,6 +18,7 @@ impl Foo for () {
 
     type Baz<T> = impl Sized;
     //~^ ERROR type `Baz` has 1 type parameter but its trait declaration has 0 type parameters
+    //~| ERROR: unconstrained opaque type
 
     fn test<'a>() -> Self::Bar<'a> {
         &()
diff --git a/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.stderr b/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.stderr
index e5a21ff8b4e..13f5d8b8ea6 100644
--- a/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.stderr
+++ b/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.stderr
@@ -7,6 +7,14 @@ LL |     type Baz<'a>;
 LL |     type Baz<T> = impl Sized;
    |              ^ found 1 type parameter
 
-error: aborting due to 1 previous error
+error: unconstrained opaque type
+  --> $DIR/impl-trait-in-type-alias-with-bad-substs.rs:19:19
+   |
+LL |     type Baz<T> = impl Sized;
+   |                   ^^^^^^^^^^
+   |
+   = note: `Baz` must be used in combination with a concrete type within the same impl
+
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0049`.
diff --git a/tests/ui/type-alias-impl-trait/impl_for_weak_alias.rs b/tests/ui/type-alias-impl-trait/impl_for_weak_alias.rs
index 00d1a1a226d..b50345bb637 100644
--- a/tests/ui/type-alias-impl-trait/impl_for_weak_alias.rs
+++ b/tests/ui/type-alias-impl-trait/impl_for_weak_alias.rs
@@ -7,6 +7,7 @@ auto trait Trait {}
 impl Trait for Alias {}
 //~^ ERROR traits with a default impl, like `Trait`, cannot be implemented for type alias `Alias`
 
+#[define_opaque(Alias)]
 fn _def() -> Alias {
     (42, 42)
 }
diff --git a/tests/ui/type-alias-impl-trait/impl_trait_for_generic_tait.rs b/tests/ui/type-alias-impl-trait/impl_trait_for_generic_tait.rs
index 91610c92d22..3bbfee42ef6 100644
--- a/tests/ui/type-alias-impl-trait/impl_trait_for_generic_tait.rs
+++ b/tests/ui/type-alias-impl-trait/impl_trait_for_generic_tait.rs
@@ -9,6 +9,7 @@ impl Foo for i32 {
     type Assoc = u32;
 }
 type ImplTrait = impl Sized;
+#[define_opaque(ImplTrait)]
 fn constrain() -> ImplTrait {
     1u64
 }
diff --git a/tests/ui/type-alias-impl-trait/impl_trait_for_same_tait.rs b/tests/ui/type-alias-impl-trait/impl_trait_for_same_tait.rs
index 3f1a9d12b44..a05c65be48b 100644
--- a/tests/ui/type-alias-impl-trait/impl_trait_for_same_tait.rs
+++ b/tests/ui/type-alias-impl-trait/impl_trait_for_same_tait.rs
@@ -5,6 +5,7 @@ impl Foo for () {}
 impl Foo for i32 {}
 
 type Bar<T: Foo> = impl std::fmt::Debug;
+#[define_opaque(Bar)]
 fn defining_use<T: Foo>() -> Bar<T> {
     42
 }
@@ -18,6 +19,7 @@ impl Bop for Bar<i32> {}
 //~^ ERROR conflicting implementations
 
 type Barr = impl std::fmt::Debug;
+#[define_opaque(Barr)]
 fn defining_use2() -> Barr {
     42
 }
diff --git a/tests/ui/type-alias-impl-trait/impl_trait_for_same_tait.stderr b/tests/ui/type-alias-impl-trait/impl_trait_for_same_tait.stderr
index aaf75cc3db9..2f44ee481ad 100644
--- a/tests/ui/type-alias-impl-trait/impl_trait_for_same_tait.stderr
+++ b/tests/ui/type-alias-impl-trait/impl_trait_for_same_tait.stderr
@@ -1,5 +1,5 @@
 error[E0119]: conflicting implementations of trait `Bop` for type `Bar<()>`
-  --> $DIR/impl_trait_for_same_tait.rs:17:1
+  --> $DIR/impl_trait_for_same_tait.rs:18:1
    |
 LL | impl Bop for Bar<()> {}
    | -------------------- first implementation here
@@ -8,7 +8,7 @@ LL | impl Bop for Bar<i32> {}
    | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Bar<()>`
 
 error[E0119]: conflicting implementations of trait `Bop` for type `Bar<()>`
-  --> $DIR/impl_trait_for_same_tait.rs:26:1
+  --> $DIR/impl_trait_for_same_tait.rs:28:1
    |
 LL | impl Bop for Bar<()> {}
    | -------------------- first implementation here
@@ -17,7 +17,7 @@ LL | impl Bop for Barr {}
    | ^^^^^^^^^^^^^^^^^ conflicting implementation for `Bar<()>`
 
 error[E0119]: conflicting implementations of trait `Bop` for type `Bar<()>`
-  --> $DIR/impl_trait_for_same_tait.rs:30:1
+  --> $DIR/impl_trait_for_same_tait.rs:32:1
    |
 LL | impl Bop for Bar<()> {}
    | -------------------- first implementation here
diff --git a/tests/ui/type-alias-impl-trait/impl_trait_for_tait.rs b/tests/ui/type-alias-impl-trait/impl_trait_for_tait.rs
index bce5ba7c91c..07ac284d501 100644
--- a/tests/ui/type-alias-impl-trait/impl_trait_for_tait.rs
+++ b/tests/ui/type-alias-impl-trait/impl_trait_for_tait.rs
@@ -4,6 +4,7 @@
 #![feature(type_alias_impl_trait)]
 type Alias = impl Sized;
 
+#[define_opaque(Alias)]
 fn constrain() -> Alias {
     1i32
 }
diff --git a/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound.rs b/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound.rs
index 8ec20acef4d..e0045df08ec 100644
--- a/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound.rs
+++ b/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound.rs
@@ -3,17 +3,18 @@
 use std::fmt::Debug;
 
 type Foo = impl Debug;
-pub trait Yay { }
-impl Yay for Foo { }
+pub trait Yay {}
+impl Yay for Foo {}
 
+#[define_opaque(Foo)]
 fn foo() {
-    is_yay::<u32>();   //~ ERROR: the trait bound `u32: Yay` is not satisfied
+    is_yay::<u32>(); //~ ERROR: the trait bound `u32: Yay` is not satisfied
     is_debug::<u32>(); // OK
-    is_yay::<Foo>();   // OK
+    is_yay::<Foo>(); // OK
     is_debug::<Foo>(); // OK
 }
 
-fn is_yay<T: Yay>() { }
-fn is_debug<T: Debug>() { }
+fn is_yay<T: Yay>() {}
+fn is_debug<T: Debug>() {}
 
 fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound.stderr b/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound.stderr
index 9840bcef7d1..0ebf9f06437 100644
--- a/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound.stderr
+++ b/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound.stderr
@@ -1,14 +1,14 @@
 error[E0277]: the trait bound `u32: Yay` is not satisfied
-  --> $DIR/impl_trait_for_tait_bound.rs:10:14
+  --> $DIR/impl_trait_for_tait_bound.rs:11:14
    |
 LL |     is_yay::<u32>();
    |              ^^^ the trait `Yay` is not implemented for `u32`
    |
    = help: the trait `Yay` is implemented for `Foo`
 note: required by a bound in `is_yay`
-  --> $DIR/impl_trait_for_tait_bound.rs:16:14
+  --> $DIR/impl_trait_for_tait_bound.rs:17:14
    |
-LL | fn is_yay<T: Yay>() { }
+LL | fn is_yay<T: Yay>() {}
    |              ^^^ required by this bound in `is_yay`
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound2.rs b/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound2.rs
index a4b8c2d190d..0a8dadb89e2 100644
--- a/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound2.rs
+++ b/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound2.rs
@@ -4,13 +4,14 @@ use std::fmt::Debug;
 
 type Foo = impl Debug;
 
-pub trait Yay { }
-impl Yay for u32 { }
+pub trait Yay {}
+impl Yay for u32 {}
 
+#[define_opaque(Foo)]
 fn foo() {
     is_yay::<Foo>(); //~ ERROR: the trait bound `Foo: Yay` is not satisfied
 }
 
-fn is_yay<T: Yay>() { }
+fn is_yay<T: Yay>() {}
 
 fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound2.stderr b/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound2.stderr
index 2259aa7bb15..4fff9ad26cb 100644
--- a/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound2.stderr
+++ b/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound2.stderr
@@ -1,14 +1,14 @@
 error[E0277]: the trait bound `Foo: Yay` is not satisfied
-  --> $DIR/impl_trait_for_tait_bound2.rs:11:14
+  --> $DIR/impl_trait_for_tait_bound2.rs:12:14
    |
 LL |     is_yay::<Foo>();
    |              ^^^ the trait `Yay` is not implemented for `Foo`
    |
    = help: the trait `Yay` is implemented for `u32`
 note: required by a bound in `is_yay`
-  --> $DIR/impl_trait_for_tait_bound2.rs:14:14
+  --> $DIR/impl_trait_for_tait_bound2.rs:15:14
    |
-LL | fn is_yay<T: Yay>() { }
+LL | fn is_yay<T: Yay>() {}
    |              ^^^ required by this bound in `is_yay`
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/type-alias-impl-trait/impl_trait_in_trait_defined_outside_trait.stderr b/tests/ui/type-alias-impl-trait/impl_trait_in_trait_defined_outside_trait.stderr
index 1d7a97c5367..a7e4ba29d3a 100644
--- a/tests/ui/type-alias-impl-trait/impl_trait_in_trait_defined_outside_trait.stderr
+++ b/tests/ui/type-alias-impl-trait/impl_trait_in_trait_defined_outside_trait.stderr
@@ -11,11 +11,6 @@ LL |         let x: Self::Assoc = 42;
    |
    = note: expected opaque type `<() as Trait>::Assoc`
                      found type `{integer}`
-note: this item must have the opaque type in its signature in order to be able to register hidden types
-  --> $DIR/impl_trait_in_trait_defined_outside_trait.rs:14:8
-   |
-LL |     fn foo() {
-   |        ^^^
 
 error[E0308]: mismatched types
   --> $DIR/impl_trait_in_trait_defined_outside_trait.rs:31:30
@@ -30,11 +25,6 @@ LL |         let x: Self::Assoc = 42;
    |
    = note: expected opaque type `<() as Trait2>::Assoc`
                      found type `{integer}`
-note: this item must have the opaque type in its signature in order to be able to register hidden types
-  --> $DIR/impl_trait_in_trait_defined_outside_trait.rs:30:11
-   |
-LL |     const FOO: () = {
-   |           ^^^
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/type-alias-impl-trait/implied_bounds.rs b/tests/ui/type-alias-impl-trait/implied_bounds.rs
index 269c0eff025..65d7234bd44 100644
--- a/tests/ui/type-alias-impl-trait/implied_bounds.rs
+++ b/tests/ui/type-alias-impl-trait/implied_bounds.rs
@@ -1,11 +1,8 @@
 #![feature(type_alias_impl_trait)]
 
-mod foo {
-    use super::Equals;
-    pub type WithLifetime<'a> = impl Equals<SelfType = ()>;
-    fn _defining_use<'a>() -> WithLifetime<'a> {}
-}
-use foo::WithLifetime;
+pub type WithLifetime<'a> = impl Equals<SelfType = ()>;
+#[define_opaque(WithLifetime)]
+fn _defining_use<'a>() -> WithLifetime<'a> {}
 
 trait Convert<'a> {
     type Witness;
diff --git a/tests/ui/type-alias-impl-trait/implied_bounds.stderr b/tests/ui/type-alias-impl-trait/implied_bounds.stderr
index 23f1141e544..eda87bcbf90 100644
--- a/tests/ui/type-alias-impl-trait/implied_bounds.stderr
+++ b/tests/ui/type-alias-impl-trait/implied_bounds.stderr
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/implied_bounds.rs:21:9
+  --> $DIR/implied_bounds.rs:18:9
    |
 LL | impl<'a> Convert<'a> for () {
    |      -- lifetime `'a` defined here
diff --git a/tests/ui/type-alias-impl-trait/implied_bounds2.rs b/tests/ui/type-alias-impl-trait/implied_bounds2.rs
index 845476ef974..0d829113ce7 100644
--- a/tests/ui/type-alias-impl-trait/implied_bounds2.rs
+++ b/tests/ui/type-alias-impl-trait/implied_bounds2.rs
@@ -2,12 +2,10 @@
 
 #![feature(type_alias_impl_trait)]
 
-mod helper {
-    pub type Ty<'a, A> = impl Sized + 'a;
-    fn defining<'a, A>() -> Ty<'a, A> {}
-    pub fn assert_static<T: 'static>() {}
-}
-use helper::*;
+pub type Ty<'a, A> = impl Sized + 'a;
+#[define_opaque(Ty)]
+fn defining<'a, A>() -> Ty<'a, A> {}
+pub fn assert_static<T: 'static>() {}
 fn test<'a, A>()
 where
     Ty<'a, A>: 'static,
diff --git a/tests/ui/type-alias-impl-trait/implied_bounds_from_types.rs b/tests/ui/type-alias-impl-trait/implied_bounds_from_types.rs
index 76a63741e18..b6120cd4cc3 100644
--- a/tests/ui/type-alias-impl-trait/implied_bounds_from_types.rs
+++ b/tests/ui/type-alias-impl-trait/implied_bounds_from_types.rs
@@ -1,11 +1,8 @@
 #![feature(type_alias_impl_trait)]
 
-mod foo {
-    use super::Equals;
-    pub type WithLifetime<T> = impl Equals<SelfType = ()>;
-    fn _defining_use<T>() -> WithLifetime<T> {}
-}
-use foo::WithLifetime;
+pub type WithLifetime<T> = impl Equals<SelfType = ()>;
+#[define_opaque(WithLifetime)]
+fn _defining_use<T>() -> WithLifetime<T> {}
 
 trait Convert<'a> {
     type Witness;
diff --git a/tests/ui/type-alias-impl-trait/implied_bounds_from_types.stderr b/tests/ui/type-alias-impl-trait/implied_bounds_from_types.stderr
index 391a8a75786..887c8552d2f 100644
--- a/tests/ui/type-alias-impl-trait/implied_bounds_from_types.stderr
+++ b/tests/ui/type-alias-impl-trait/implied_bounds_from_types.stderr
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/implied_bounds_from_types.rs:21:9
+  --> $DIR/implied_bounds_from_types.rs:18:9
    |
 LL | impl<'a> Convert<'a> for () {
    |      -- lifetime `'a` defined here
diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check.error.stderr b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check.error.stderr
index 49997b073c9..3bc6b9205ec 100644
--- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check.error.stderr
+++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check.error.stderr
@@ -1,5 +1,5 @@
 error[E0119]: conflicting implementations of trait `Yay` for type `<() as HideIt>::Assoc`
-  --> $DIR/implied_lifetime_wf_check.rs:26:1
+  --> $DIR/implied_lifetime_wf_check.rs:27:1
    |
 LL | impl Yay for <() as HideIt>::Assoc {}
    | ---------------------------------- first implementation here
diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check.rs b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check.rs
index d85c7f60023..7950d6ad80c 100644
--- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check.rs
+++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check.rs
@@ -7,6 +7,7 @@
 
 type Alias = impl Sized;
 
+#[define_opaque(Alias)]
 fn constrain() -> Alias {
     1i32
 }
diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs
index fb251e9bde1..889438d1b73 100644
--- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs
+++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs
@@ -2,6 +2,7 @@
 
 mod test_lifetime_param {
     pub type Ty<'a> = impl Sized;
+    #[define_opaque(Ty)]
     fn defining(a: &str) -> Ty<'_> {
         a
     }
@@ -17,6 +18,7 @@ where
 
 mod test_higher_kinded_lifetime_param {
     pub type Ty<'a> = impl Sized + 'a;
+    #[define_opaque(Ty)]
     fn defining(a: &str) -> Ty<'_> {
         a
     }
@@ -40,6 +42,7 @@ mod test_higher_kinded_lifetime_param2 {
 
 mod test_type_param {
     pub type Ty<A> = impl Sized;
+    #[define_opaque(Ty)]
     fn defining<A>(s: A) -> Ty<A> {
         s
     }
@@ -54,13 +57,13 @@ where
 }
 
 mod test_implied_from_fn_sig {
-    mod foo {
-        pub type Opaque<T: 'static> = impl Sized;
-        fn defining<T: 'static>() -> Opaque<T> {}
-    }
+    pub type Opaque<T: 'static> = impl Sized;
+    #[define_opaque(Opaque)]
+    fn defining<T: 'static>() -> Opaque<T> {}
+
     fn assert_static<T: 'static>() {}
 
-    fn test<T>(_: foo::Opaque<T>) {
+    fn test<T>(_: Opaque<T>) {
         assert_static::<T>();
     }
 }
diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr
index c9af4bda572..7311f5882f7 100644
--- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr
+++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/implied_lifetime_wf_check3.rs:14:5
+  --> $DIR/implied_lifetime_wf_check3.rs:15:5
    |
 LL | fn test_lifetime_param_test<'a>()
    |                             -- lifetime `'a` defined here
@@ -8,7 +8,7 @@ LL |     test_lifetime_param::assert_static::<'a>()
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
 
 error: lifetime may not live long enough
-  --> $DIR/implied_lifetime_wf_check3.rs:29:5
+  --> $DIR/implied_lifetime_wf_check3.rs:31:5
    |
 LL | fn test_higher_kinded_lifetime_param_test<'a>()
    |                                           -- lifetime `'a` defined here
@@ -17,7 +17,7 @@ LL |     test_higher_kinded_lifetime_param::assert_static::<'a>()
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
 
 error: lifetime may not live long enough
-  --> $DIR/implied_lifetime_wf_check3.rs:36:9
+  --> $DIR/implied_lifetime_wf_check3.rs:38:9
    |
 LL |     fn test<'a>() {
    |             -- lifetime `'a` defined here
@@ -25,7 +25,7 @@ LL |         assert_static::<'a>()
    |         ^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
 
 error[E0310]: the parameter type `A` may not live long enough
-  --> $DIR/implied_lifetime_wf_check3.rs:52:5
+  --> $DIR/implied_lifetime_wf_check3.rs:55:5
    |
 LL |     test_type_param::assert_static::<A>()
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.rs b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.rs
index 7b2bbc99530..5484b91e6f1 100644
--- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.rs
+++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.rs
@@ -1,14 +1,12 @@
 #![feature(type_alias_impl_trait)]
 
-mod test_type_param_static {
-    pub type Ty<A> = impl Sized + 'static;
-    fn defining<A: 'static>(s: A) -> Ty<A> {
-        s
-        //~^ ERROR: the parameter type `A` may not live long enough
-    }
-    pub fn assert_static<A: 'static>() {}
+pub type Ty<A> = impl Sized + 'static;
+#[define_opaque(Ty)]
+fn defining<A: 'static>(s: A) -> Ty<A> {
+    s
+    //~^ ERROR: the parameter type `A` may not live long enough
 }
-use test_type_param_static::*;
+pub fn assert_static<A: 'static>() {}
 
 fn test<A>()
 where
diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr
index 060d68eb632..3cec4bbb099 100644
--- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr
+++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr
@@ -1,24 +1,24 @@
 error[E0310]: the parameter type `A` may not live long enough
-  --> $DIR/implied_lifetime_wf_check4_static.rs:6:9
+  --> $DIR/implied_lifetime_wf_check4_static.rs:6:5
    |
-LL |         s
-   |         ^
-   |         |
-   |         the parameter type `A` must be valid for the static lifetime...
-   |         ...so that the type `A` will meet its required lifetime bounds...
+LL |     s
+   |     ^
+   |     |
+   |     the parameter type `A` must be valid for the static lifetime...
+   |     ...so that the type `A` will meet its required lifetime bounds...
    |
 note: ...that is required by this bound
-  --> $DIR/implied_lifetime_wf_check4_static.rs:4:35
+  --> $DIR/implied_lifetime_wf_check4_static.rs:3:31
    |
-LL |     pub type Ty<A> = impl Sized + 'static;
-   |                                   ^^^^^^^
+LL | pub type Ty<A> = impl Sized + 'static;
+   |                               ^^^^^^^
 help: consider adding an explicit lifetime bound
    |
-LL |     pub type Ty<A: 'static> = impl Sized + 'static;
-   |                  +++++++++
+LL | pub type Ty<A: 'static> = impl Sized + 'static;
+   |              +++++++++
 
 error[E0310]: the parameter type `A` may not live long enough
-  --> $DIR/implied_lifetime_wf_check4_static.rs:17:5
+  --> $DIR/implied_lifetime_wf_check4_static.rs:15:5
    |
 LL |     assert_static::<A>()
    |     ^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds.rs b/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds.rs
index 4a9f162823e..126fb66b9db 100644
--- a/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds.rs
+++ b/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds.rs
@@ -2,19 +2,17 @@
 
 #![feature(impl_trait_in_assoc_type, type_alias_impl_trait)]
 
-mod foo {
-    pub trait Callable {
-        type Output;
-        fn call() -> Self::Output;
-    }
+pub trait Callable {
+    type Output;
+    fn call() -> Self::Output;
+}
 
-    pub type OutputHelper = impl Sized;
-    impl<'a> Callable for &'a () {
-        type Output = OutputHelper;
-        fn call() -> Self::Output {}
-    }
+pub type OutputHelper = impl Sized;
+impl<'a> Callable for &'a () {
+    type Output = OutputHelper;
+    #[define_opaque(OutputHelper)]
+    fn call() -> Self::Output {}
 }
-use foo::*;
 
 fn test<'a>() -> impl Sized {
     <&'a () as Callable>::call()
diff --git a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.rs b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.rs
index 7452000b65d..92c8a8f3216 100644
--- a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.rs
+++ b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.rs
@@ -6,7 +6,7 @@ trait Foo {
 }
 
 impl Foo for () {
-    type Assoc<'a> = impl Sized; //~ ERROR unconstrained opaque type
+    type Assoc<'a> = impl Sized;
     fn bar<'a: 'a>()
     where
         Self::Assoc<'a>:,
diff --git a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.stderr b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.stderr
index 1274a8b60de..7ce4517fb1e 100644
--- a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.stderr
+++ b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.stderr
@@ -9,14 +9,6 @@ LL |     fn bar<'a: 'a>()
 LL |             let _: Self::Assoc<'a> = x;
    |                    ^^^^^^^^^^^^^^^
 
-error: unconstrained opaque type
-  --> $DIR/in-assoc-ty-early-bound2.rs:9:22
-   |
-LL |     type Assoc<'a> = impl Sized;
-   |                      ^^^^^^^^^^
-   |
-   = note: `Assoc` must be used in combination with a concrete type within the same impl
-
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
 For more information about this error, try `rustc --explain E0700`.
diff --git a/tests/ui/type-alias-impl-trait/in-where-clause.rs b/tests/ui/type-alias-impl-trait/in-where-clause.rs
index 065af57a864..8d5bfc48a66 100644
--- a/tests/ui/type-alias-impl-trait/in-where-clause.rs
+++ b/tests/ui/type-alias-impl-trait/in-where-clause.rs
@@ -5,6 +5,7 @@
 type Bar = impl Sized;
 //~^ ERROR: cycle
 
+#[define_opaque(Bar)]
 fn foo() -> Bar
 where
     Bar: Send,
diff --git a/tests/ui/type-alias-impl-trait/in-where-clause.stderr b/tests/ui/type-alias-impl-trait/in-where-clause.stderr
index 5ac09e20b02..114cac64573 100644
--- a/tests/ui/type-alias-impl-trait/in-where-clause.stderr
+++ b/tests/ui/type-alias-impl-trait/in-where-clause.stderr
@@ -1,12 +1,12 @@
 error[E0283]: type annotations needed: cannot satisfy `Bar: Send`
-  --> $DIR/in-where-clause.rs:12:9
+  --> $DIR/in-where-clause.rs:13:9
    |
 LL |     [0; 1 + 2]
    |         ^^^^^
    |
    = note: cannot satisfy `Bar: Send`
 note: required by a bound in `foo`
-  --> $DIR/in-where-clause.rs:10:10
+  --> $DIR/in-where-clause.rs:11:10
    |
 LL | fn foo() -> Bar
    |    --- required by a bound in this function
@@ -21,7 +21,7 @@ LL | type Bar = impl Sized;
    |            ^^^^^^^^^^
    |
 note: ...which requires type-checking `foo`...
-  --> $DIR/in-where-clause.rs:8:1
+  --> $DIR/in-where-clause.rs:9:1
    |
 LL | / fn foo() -> Bar
 LL | | where
diff --git a/tests/ui/type-alias-impl-trait/incomplete-inference.rs b/tests/ui/type-alias-impl-trait/incomplete-inference.rs
index 4c8bf2cfca1..70acb1870e2 100644
--- a/tests/ui/type-alias-impl-trait/incomplete-inference.rs
+++ b/tests/ui/type-alias-impl-trait/incomplete-inference.rs
@@ -2,11 +2,13 @@
 
 type Foo = impl Sized;
 
+#[define_opaque(Foo)]
 fn bar() -> Foo {
     None
     //~^ ERROR: type annotations needed [E0282]
 }
 
+#[define_opaque(Foo)]
 fn baz() -> Foo {
     Some(())
 }
diff --git a/tests/ui/type-alias-impl-trait/incomplete-inference.stderr b/tests/ui/type-alias-impl-trait/incomplete-inference.stderr
index 3976a43a89c..0b2bac0a153 100644
--- a/tests/ui/type-alias-impl-trait/incomplete-inference.stderr
+++ b/tests/ui/type-alias-impl-trait/incomplete-inference.stderr
@@ -1,5 +1,5 @@
 error[E0282]: type annotations needed
-  --> $DIR/incomplete-inference.rs:6:5
+  --> $DIR/incomplete-inference.rs:7:5
    |
 LL |     None
    |     ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option`
diff --git a/tests/ui/type-alias-impl-trait/inference-cycle.rs b/tests/ui/type-alias-impl-trait/inference-cycle.rs
index 6e4507ed460..951f177377a 100644
--- a/tests/ui/type-alias-impl-trait/inference-cycle.rs
+++ b/tests/ui/type-alias-impl-trait/inference-cycle.rs
@@ -1,24 +1,24 @@
 #![feature(type_alias_impl_trait)]
 #![allow(dead_code)]
 
-mod m {
-    pub type Foo = impl std::fmt::Debug;
+//@ check-pass
 
-    pub fn foo() -> Foo {
-        is_send(bar())
-    }
+pub type Foo = impl std::fmt::Debug;
 
-    pub fn bar() {
-        // Cycle: error today, but it'd be nice if it eventually worked
-        is_send(foo());
-        //~^ ERROR: cannot check whether the hidden type of `inference_cycle[4ecc]::m::Foo::{opaque#0}` satisfies auto traits
-    }
+#[define_opaque(Foo)]
+pub fn foo() -> Foo {
+    is_send(bar())
+}
 
-    fn baz() -> Foo {
-        ()
-    }
+pub fn bar() {
+    is_send(foo());
+}
 
-    fn is_send<T: Send>(_: T) {}
+#[define_opaque(Foo)]
+fn baz() -> Foo {
+    ()
 }
 
+fn is_send<T: Send>(_: T) {}
+
 fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/inference-cycle.stderr b/tests/ui/type-alias-impl-trait/inference-cycle.stderr
deleted file mode 100644
index 8b809ba014d..00000000000
--- a/tests/ui/type-alias-impl-trait/inference-cycle.stderr
+++ /dev/null
@@ -1,22 +0,0 @@
-error: cannot check whether the hidden type of `inference_cycle[4ecc]::m::Foo::{opaque#0}` satisfies auto traits
-  --> $DIR/inference-cycle.rs:13:17
-   |
-LL |         is_send(foo());
-   |         ------- ^^^^^
-   |         |
-   |         required by a bound introduced by this call
-   |
-   = note: fetching the hidden types of an opaque inside of the defining scope is not supported. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
-note: opaque type is declared here
-  --> $DIR/inference-cycle.rs:5:20
-   |
-LL |     pub type Foo = impl std::fmt::Debug;
-   |                    ^^^^^^^^^^^^^^^^^^^^
-note: required by a bound in `is_send`
-  --> $DIR/inference-cycle.rs:21:19
-   |
-LL |     fn is_send<T: Send>(_: T) {}
-   |                   ^^^^ required by this bound in `is_send`
-
-error: aborting due to 1 previous error
-
diff --git a/tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.rs b/tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.rs
index 6609d4eb5a2..ef6871bec7c 100644
--- a/tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.rs
+++ b/tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.rs
@@ -3,6 +3,9 @@
 type T = impl Copy;
 //~^ ERROR cannot resolve opaque type
 
-static STATIC: T = None::<&'static T>;
+#[define_opaque(T)]
+fn foo() -> T {
+    None::<&'static T>
+}
 
 fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/invalid_impl_trait_in_assoc_ty.rs b/tests/ui/type-alias-impl-trait/invalid_impl_trait_in_assoc_ty.rs
index 93c52126d69..ae9712bd891 100644
--- a/tests/ui/type-alias-impl-trait/invalid_impl_trait_in_assoc_ty.rs
+++ b/tests/ui/type-alias-impl-trait/invalid_impl_trait_in_assoc_ty.rs
@@ -7,6 +7,7 @@ trait Foo {
 
 impl Foo for () {
     type Foo = impl std::fmt::Debug;
+    //~^ ERROR: unconstrained opaque type
     fn bar() {
         let x: Self::Foo = ();
         //~^ ERROR: mismatched types
diff --git a/tests/ui/type-alias-impl-trait/invalid_impl_trait_in_assoc_ty.stderr b/tests/ui/type-alias-impl-trait/invalid_impl_trait_in_assoc_ty.stderr
index 169d8e41d20..82bd0025d6d 100644
--- a/tests/ui/type-alias-impl-trait/invalid_impl_trait_in_assoc_ty.stderr
+++ b/tests/ui/type-alias-impl-trait/invalid_impl_trait_in_assoc_ty.stderr
@@ -1,9 +1,17 @@
+error: unconstrained opaque type
+  --> $DIR/invalid_impl_trait_in_assoc_ty.rs:9:16
+   |
+LL |     type Foo = impl std::fmt::Debug;
+   |                ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `Foo` must be used in combination with a concrete type within the same impl
+
 error[E0308]: mismatched types
-  --> $DIR/invalid_impl_trait_in_assoc_ty.rs:11:28
+  --> $DIR/invalid_impl_trait_in_assoc_ty.rs:12:28
    |
 LL |     type Foo = impl std::fmt::Debug;
    |                -------------------- the expected opaque type
-LL |     fn bar() {
+...
 LL |         let x: Self::Foo = ();
    |                ---------   ^^ expected opaque type, found `()`
    |                |
@@ -11,12 +19,7 @@ LL |         let x: Self::Foo = ();
    |
    = note: expected opaque type `<() as Foo>::Foo`
                 found unit type `()`
-note: this item must have the opaque type in its signature in order to be able to register hidden types
-  --> $DIR/invalid_impl_trait_in_assoc_ty.rs:10:8
-   |
-LL |     fn bar() {
-   |        ^^^
 
-error: aborting due to 1 previous error
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/type-alias-impl-trait/issue-101750.rs b/tests/ui/type-alias-impl-trait/issue-101750.rs
index 9367be8ca07..2f9304ce3bc 100644
--- a/tests/ui/type-alias-impl-trait/issue-101750.rs
+++ b/tests/ui/type-alias-impl-trait/issue-101750.rs
@@ -2,21 +2,18 @@
 
 //@ check-pass
 
-mod foo {
-    pub trait Trait {}
+pub trait Trait {}
 
-    pub type TAIT = impl Trait;
+pub type TAIT = impl Trait;
 
-    pub struct Concrete;
-    impl Trait for Concrete {}
+pub struct Concrete;
+impl Trait for Concrete {}
 
-    pub fn tait() -> TAIT {
-        Concrete
-    }
+#[define_opaque(TAIT)]
+pub fn tait() -> TAIT {
+    Concrete
 }
 
-use foo::*;
-
 trait OuterTrait {
     type Item;
 }
diff --git a/tests/ui/type-alias-impl-trait/issue-104817.rs b/tests/ui/type-alias-impl-trait/issue-104817.rs
index 49146321614..13bbfa12a67 100644
--- a/tests/ui/type-alias-impl-trait/issue-104817.rs
+++ b/tests/ui/type-alias-impl-trait/issue-104817.rs
@@ -8,6 +8,7 @@
 trait OpaqueTrait {}
 impl<T> OpaqueTrait for T {}
 type OpaqueType = impl OpaqueTrait;
+#[define_opaque(OpaqueType)]
 fn mk_opaque() -> OpaqueType {
     || 0
 }
diff --git a/tests/ui/type-alias-impl-trait/issue-104817.stock.stderr b/tests/ui/type-alias-impl-trait/issue-104817.stock.stderr
index df5a6c320a8..4f227310ee7 100644
--- a/tests/ui/type-alias-impl-trait/issue-104817.stock.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-104817.stock.stderr
@@ -1,5 +1,5 @@
 error[E0119]: conflicting implementations of trait `AnotherTrait`
-  --> $DIR/issue-104817.rs:16:1
+  --> $DIR/issue-104817.rs:17:1
    |
 LL | impl<T: Send> AnotherTrait for T {}
    | -------------------------------- first implementation here
diff --git a/tests/ui/type-alias-impl-trait/issue-109054.rs b/tests/ui/type-alias-impl-trait/issue-109054.rs
index d3eb6521593..0c9304a42f3 100644
--- a/tests/ui/type-alias-impl-trait/issue-109054.rs
+++ b/tests/ui/type-alias-impl-trait/issue-109054.rs
@@ -10,8 +10,10 @@ type FnType = impl Fn(&u32) -> ReturnType;
 impl std::ops::Deref for CallMe {
     type Target = FnType;
 
+    #[define_opaque(FnType)]
     fn deref(&self) -> &Self::Target {
         //~^ ERROR: item does not constrain `ReturnType
+        #[define_opaque(ReturnType)]
         fn inner(val: &u32) -> ReturnType {
             async move { *val * 2 }
         }
diff --git a/tests/ui/type-alias-impl-trait/issue-109054.stderr b/tests/ui/type-alias-impl-trait/issue-109054.stderr
index 2a4aa63bb8c..919b0a287c4 100644
--- a/tests/ui/type-alias-impl-trait/issue-109054.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-109054.stderr
@@ -1,18 +1,18 @@
-error: item does not constrain `ReturnType::{opaque#0}`, but has it in its signature
-  --> $DIR/issue-109054.rs:13:8
+error: item does not constrain `ReturnType::{opaque#0}`
+  --> $DIR/issue-109054.rs:14:8
    |
 LL |     fn deref(&self) -> &Self::Target {
    |        ^^^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
   --> $DIR/issue-109054.rs:7:23
    |
 LL | type ReturnType<'a> = impl std::future::Future<Output = u32> + 'a;
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0792]: expected generic lifetime parameter, found `'_`
-  --> $DIR/issue-109054.rs:19:9
+  --> $DIR/issue-109054.rs:21:9
    |
 LL | type ReturnType<'a> = impl std::future::Future<Output = u32> + 'a;
    |                 -- this generic parameter must be used with a generic lifetime parameter
diff --git a/tests/ui/type-alias-impl-trait/issue-52843-closure-constrain.rs b/tests/ui/type-alias-impl-trait/issue-52843-closure-constrain.rs
deleted file mode 100644
index 50eeff0b18f..00000000000
--- a/tests/ui/type-alias-impl-trait/issue-52843-closure-constrain.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// Checks to ensure that we properly detect when a closure constrains an opaque type
-
-#![feature(type_alias_impl_trait)]
-
-use std::fmt::Debug;
-
-fn main() {
-    type Opaque = impl Debug;
-    fn _unused() -> Opaque { String::new() }
-    let null = || -> Opaque { 0 };
-    //~^ ERROR: concrete type differs from previous defining opaque type use
-    println!("{:?}", null());
-}
diff --git a/tests/ui/type-alias-impl-trait/issue-52843-closure-constrain.stderr b/tests/ui/type-alias-impl-trait/issue-52843-closure-constrain.stderr
deleted file mode 100644
index 4570ce8e41d..00000000000
--- a/tests/ui/type-alias-impl-trait/issue-52843-closure-constrain.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error: concrete type differs from previous defining opaque type use
-  --> $DIR/issue-52843-closure-constrain.rs:10:31
-   |
-LL |     let null = || -> Opaque { 0 };
-   |                               ^ expected `String`, got `i32`
-   |
-note: previous use here
-  --> $DIR/issue-52843-closure-constrain.rs:9:30
-   |
-LL |     fn _unused() -> Opaque { String::new() }
-   |                              ^^^^^^^^^^^^^
-
-error: aborting due to 1 previous error
-
diff --git a/tests/ui/type-alias-impl-trait/issue-52843.rs b/tests/ui/type-alias-impl-trait/issue-52843.rs
index 159d3ccd27e..fd28eb8381d 100644
--- a/tests/ui/type-alias-impl-trait/issue-52843.rs
+++ b/tests/ui/type-alias-impl-trait/issue-52843.rs
@@ -3,6 +3,7 @@
 type Foo<T> = impl Default;
 
 #[allow(unused)]
+#[define_opaque(Foo)]
 fn foo<T: Default>(t: T) -> Foo<T> {
     t
     //~^ ERROR: the trait bound `T: Default` is not satisfied
diff --git a/tests/ui/type-alias-impl-trait/issue-52843.stderr b/tests/ui/type-alias-impl-trait/issue-52843.stderr
index 6673b03525d..ee2390d0945 100644
--- a/tests/ui/type-alias-impl-trait/issue-52843.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-52843.stderr
@@ -1,5 +1,5 @@
 error[E0277]: the trait bound `T: Default` is not satisfied
-  --> $DIR/issue-52843.rs:7:5
+  --> $DIR/issue-52843.rs:8:5
    |
 LL |     t
    |     ^ the trait `Default` is not implemented for `T`
@@ -10,7 +10,7 @@ note: required by a bound in an opaque type
 LL | type Foo<T> = impl Default;
    |                    ^^^^^^^
 note: this definition site has more where clauses than the opaque type
-  --> $DIR/issue-52843.rs:6:1
+  --> $DIR/issue-52843.rs:7:1
    |
 LL | fn foo<T: Default>(t: T) -> Foo<T> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/issue-53092-2.rs b/tests/ui/type-alias-impl-trait/issue-53092-2.rs
index 43df49adc42..1a530d27971 100644
--- a/tests/ui/type-alias-impl-trait/issue-53092-2.rs
+++ b/tests/ui/type-alias-impl-trait/issue-53092-2.rs
@@ -2,13 +2,13 @@
 #![allow(dead_code)]
 
 type Bug<T, U> = impl Fn(T) -> U + Copy;
-//~^ ERROR cycle detected
+//~^ ERROR cycle detected when computing type of `Bug::{opaque#0}`
 
+#[define_opaque(Bug)]
 const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) };
-//~^ ERROR item does not constrain `Bug::{opaque#0}`, but has it in its signature
-//~| ERROR item does not constrain `Bug::{opaque#0}`, but has it in its signature
-//~| ERROR non-defining opaque type use in defining scope
+//~^ ERROR item does not constrain `Bug::{opaque#0}`
 
+#[define_opaque(Bug)]
 fn make_bug<T, U: From<T>>() -> Bug<T, U> {
     |x| x.into()
 }
diff --git a/tests/ui/type-alias-impl-trait/issue-53092-2.stderr b/tests/ui/type-alias-impl-trait/issue-53092-2.stderr
index 678b0c84f78..3062e55dc49 100644
--- a/tests/ui/type-alias-impl-trait/issue-53092-2.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-53092-2.stderr
@@ -1,15 +1,3 @@
-error[E0792]: non-defining opaque type use in defining scope
-  --> $DIR/issue-53092-2.rs:7:18
-   |
-LL | const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) };
-   |                  ^^^^^^^^^^^ argument `u8` is not a generic parameter
-   |
-note: for this opaque type
-  --> $DIR/issue-53092-2.rs:4:18
-   |
-LL | type Bug<T, U> = impl Fn(T) -> U + Copy;
-   |                  ^^^^^^^^^^^^^^^^^^^^^^
-
 error[E0391]: cycle detected when computing type of `Bug::{opaque#0}`
   --> $DIR/issue-53092-2.rs:4:18
    |
@@ -22,7 +10,7 @@ note: ...which requires computing type of opaque `Bug::{opaque#0}`...
 LL | type Bug<T, U> = impl Fn(T) -> U + Copy;
    |                  ^^^^^^^^^^^^^^^^^^^^^^
 note: ...which requires type-checking `CONST_BUG`...
-  --> $DIR/issue-53092-2.rs:7:1
+  --> $DIR/issue-53092-2.rs:8:1
    |
 LL | const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -36,33 +24,19 @@ LL | type Bug<T, U> = impl Fn(T) -> U + Copy;
    |                  ^^^^^^^^^^^^^^^^^^^^^^
    = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
 
-error: item does not constrain `Bug::{opaque#0}`, but has it in its signature
-  --> $DIR/issue-53092-2.rs:7:7
+error: item does not constrain `Bug::{opaque#0}`
+  --> $DIR/issue-53092-2.rs:8:7
    |
 LL | const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) };
    |       ^^^^^^^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
-  --> $DIR/issue-53092-2.rs:4:18
-   |
-LL | type Bug<T, U> = impl Fn(T) -> U + Copy;
-   |                  ^^^^^^^^^^^^^^^^^^^^^^
-
-error: item does not constrain `Bug::{opaque#0}`, but has it in its signature
-  --> $DIR/issue-53092-2.rs:7:61
-   |
-LL | const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) };
-   |                                                             ^^^^^^^
-   |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
   --> $DIR/issue-53092-2.rs:4:18
    |
 LL | type Bug<T, U> = impl Fn(T) -> U + Copy;
    |                  ^^^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to 4 previous errors
+error: aborting due to 2 previous errors
 
-Some errors have detailed explanations: E0391, E0792.
-For more information about an error, try `rustc --explain E0391`.
+For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/type-alias-impl-trait/issue-53092.rs b/tests/ui/type-alias-impl-trait/issue-53092.rs
index 83b51227aaa..a2e6ddc11b6 100644
--- a/tests/ui/type-alias-impl-trait/issue-53092.rs
+++ b/tests/ui/type-alias-impl-trait/issue-53092.rs
@@ -1,14 +1,13 @@
 #![feature(type_alias_impl_trait)]
 #![allow(dead_code)]
 
-mod bug {
-    pub type Bug<T, U> = impl Fn(T) -> U + Copy;
+pub type Bug<T, U> = impl Fn(T) -> U + Copy;
 
-    fn make_bug<T, U: From<T>>() -> Bug<T, U> {
-        |x| x.into() //~ ERROR the trait bound `U: From<T>` is not satisfied
-    }
+#[define_opaque(Bug)]
+fn make_bug<T, U: From<T>>() -> Bug<T, U> {
+    |x| x.into()
+    //~^ ERROR the trait bound `U: From<T>` is not satisfied
 }
-use bug::Bug;
 
 union Moo {
     x: Bug<u8, ()>,
diff --git a/tests/ui/type-alias-impl-trait/issue-53092.stderr b/tests/ui/type-alias-impl-trait/issue-53092.stderr
index 579902aa3ab..a8554b9a989 100644
--- a/tests/ui/type-alias-impl-trait/issue-53092.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-53092.stderr
@@ -1,18 +1,18 @@
 error[E0277]: the trait bound `U: From<T>` is not satisfied
-  --> $DIR/issue-53092.rs:8:9
+  --> $DIR/issue-53092.rs:8:5
    |
-LL |         |x| x.into()
-   |         ^^^^^^^^^^^^ the trait `From<T>` is not implemented for `U`
+LL |     |x| x.into()
+   |     ^^^^^^^^^^^^ the trait `From<T>` is not implemented for `U`
    |
 note: required by a bound in `make_bug`
-  --> $DIR/issue-53092.rs:7:23
+  --> $DIR/issue-53092.rs:7:19
    |
-LL |     fn make_bug<T, U: From<T>>() -> Bug<T, U> {
-   |                       ^^^^^^^ required by this bound in `make_bug`
+LL | fn make_bug<T, U: From<T>>() -> Bug<T, U> {
+   |                   ^^^^^^^ required by this bound in `make_bug`
 help: consider restricting type parameter `U` with trait `From`
    |
-LL |     pub type Bug<T, U: std::convert::From<T>> = impl Fn(T) -> U + Copy;
-   |                      +++++++++++++++++++++++
+LL | pub type Bug<T, U: std::convert::From<T>> = impl Fn(T) -> U + Copy;
+   |                  +++++++++++++++++++++++
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/type-alias-impl-trait/issue-53096.rs b/tests/ui/type-alias-impl-trait/issue-53096.rs
index 590fce84fc9..60e455a6a07 100644
--- a/tests/ui/type-alias-impl-trait/issue-53096.rs
+++ b/tests/ui/type-alias-impl-trait/issue-53096.rs
@@ -1,14 +1,12 @@
-#![feature(rustc_attrs)]
+//@ check-pass
+
 #![feature(type_alias_impl_trait)]
 
-mod foo {
-    pub type Foo = impl Fn() -> usize;
-    pub const fn bar() -> Foo {
-        || 0usize
-    }
+pub type Foo = impl Fn() -> usize;
+#[define_opaque(Foo)]
+pub const fn bar() -> Foo {
+    || 0usize
 }
-use foo::*;
 const BAZR: Foo = bar();
 
-#[rustc_error]
-fn main() {} //~ ERROR
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/issue-53096.stderr b/tests/ui/type-alias-impl-trait/issue-53096.stderr
deleted file mode 100644
index 0a744e7be9c..00000000000
--- a/tests/ui/type-alias-impl-trait/issue-53096.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: fatal error triggered by #[rustc_error]
-  --> $DIR/issue-53096.rs:14:1
-   |
-LL | fn main() {}
-   | ^^^^^^^^^
-
-error: aborting due to 1 previous error
-
diff --git a/tests/ui/type-alias-impl-trait/issue-53678-coroutine-and-const-fn.rs b/tests/ui/type-alias-impl-trait/issue-53678-coroutine-and-const-fn.rs
index 0d9126d3993..f02ccbbb93c 100644
--- a/tests/ui/type-alias-impl-trait/issue-53678-coroutine-and-const-fn.rs
+++ b/tests/ui/type-alias-impl-trait/issue-53678-coroutine-and-const-fn.rs
@@ -3,21 +3,20 @@
 
 //@ check-pass
 
-mod gen {
-    use std::ops::Coroutine;
+use std::ops::Coroutine;
 
-    pub type CoroOnce<Y, R> = impl Coroutine<Yield = Y, Return = R>;
+pub type CoroOnce<Y, R> = impl Coroutine<Yield = Y, Return = R>;
 
-    pub const fn const_coroutine<Y, R>(yielding: Y, returning: R) -> CoroOnce<Y, R> {
-        #[coroutine]
-        move || {
-            yield yielding;
+#[define_opaque(CoroOnce)]
+pub const fn const_coroutine<Y, R>(yielding: Y, returning: R) -> CoroOnce<Y, R> {
+    #[coroutine]
+    move || {
+        yield yielding;
 
-            return returning;
-        }
+        return returning;
     }
 }
 
-const FOO: gen::CoroOnce<usize, usize> = gen::const_coroutine(10, 100);
+const FOO: CoroOnce<usize, usize> = const_coroutine(10, 100);
 
 fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/issue-55099-lifetime-inference.rs b/tests/ui/type-alias-impl-trait/issue-55099-lifetime-inference.rs
index e54dd01122e..a3c37759ac0 100644
--- a/tests/ui/type-alias-impl-trait/issue-55099-lifetime-inference.rs
+++ b/tests/ui/type-alias-impl-trait/issue-55099-lifetime-inference.rs
@@ -18,6 +18,7 @@ struct Foo<'a> {
 type F = impl Future;
 
 impl<'a> Foo<'a> {
+    #[define_opaque(F)]
     fn reply(&mut self) -> F {
         AndThen(|| ())
     }
diff --git a/tests/ui/type-alias-impl-trait/issue-57961.rs b/tests/ui/type-alias-impl-trait/issue-57961.rs
index 61af7a0f625..0b39e21d8b7 100644
--- a/tests/ui/type-alias-impl-trait/issue-57961.rs
+++ b/tests/ui/type-alias-impl-trait/issue-57961.rs
@@ -11,6 +11,7 @@ impl Foo for () {
     //~^ ERROR expected `IntoIter<u32>` to be an iterator that yields `X`, but it yields `u32`
 }
 
+#[define_opaque(X)]
 fn incoherent() -> X {
     22_i32
 }
diff --git a/tests/ui/type-alias-impl-trait/issue-58662-coroutine-with-lifetime.rs b/tests/ui/type-alias-impl-trait/issue-58662-coroutine-with-lifetime.rs
index 899e81ed562..c2a9f153815 100644
--- a/tests/ui/type-alias-impl-trait/issue-58662-coroutine-with-lifetime.rs
+++ b/tests/ui/type-alias-impl-trait/issue-58662-coroutine-with-lifetime.rs
@@ -7,6 +7,7 @@ use std::ops::{Coroutine, CoroutineState};
 use std::pin::Pin;
 
 type RandCoroutine<'a> = impl Coroutine<Return = (), Yield = u64> + 'a;
+#[define_opaque(RandCoroutine)]
 fn rand_coroutine<'a>(rng: &'a ()) -> RandCoroutine<'a> {
     #[coroutine]
     move || {
@@ -18,6 +19,7 @@ fn rand_coroutine<'a>(rng: &'a ()) -> RandCoroutine<'a> {
 }
 
 pub type RandCoroutineWithIndirection<'c> = impl Coroutine<Return = (), Yield = u64> + 'c;
+#[define_opaque(RandCoroutineWithIndirection)]
 pub fn rand_coroutine_with_indirection<'a>(rng: &'a ()) -> RandCoroutineWithIndirection<'a> {
     fn helper<'b>(rng: &'b ()) -> impl 'b + Coroutine<Return = (), Yield = u64> {
         #[coroutine]
diff --git a/tests/ui/type-alias-impl-trait/issue-58662-simplified.rs b/tests/ui/type-alias-impl-trait/issue-58662-simplified.rs
index 9d74c0687fe..aef13947f55 100644
--- a/tests/ui/type-alias-impl-trait/issue-58662-simplified.rs
+++ b/tests/ui/type-alias-impl-trait/issue-58662-simplified.rs
@@ -8,6 +8,8 @@ trait Trait {}
 impl<T> Trait for T {}
 
 type Foo<'c> = impl Trait + 'c;
+
+#[define_opaque(Foo)]
 fn foo<'a>(rng: &'a ()) -> Foo<'a> {
     fn helper<'b>(rng: &'b ()) -> impl 'b + Trait {
         rng
@@ -16,5 +18,4 @@ fn foo<'a>(rng: &'a ()) -> Foo<'a> {
     helper(rng)
 }
 
-fn main() {
-}
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/issue-58951-2.rs b/tests/ui/type-alias-impl-trait/issue-58951-2.rs
index fb92b127436..de6b9e74119 100644
--- a/tests/ui/type-alias-impl-trait/issue-58951-2.rs
+++ b/tests/ui/type-alias-impl-trait/issue-58951-2.rs
@@ -2,14 +2,12 @@
 
 #![feature(type_alias_impl_trait)]
 
-mod defining_use_scope {
-    pub type A = impl Iterator;
+pub type A = impl Iterator;
 
-    pub fn def_a() -> A {
-        0..1
-    }
+#[define_opaque(A)]
+pub fn def_a() -> A {
+    0..1
 }
-use defining_use_scope::*;
 
 pub fn use_a() {
     def_a().map(|x| x);
diff --git a/tests/ui/type-alias-impl-trait/issue-58951.rs b/tests/ui/type-alias-impl-trait/issue-58951.rs
index b9f27b031c7..de6b9e74119 100644
--- a/tests/ui/type-alias-impl-trait/issue-58951.rs
+++ b/tests/ui/type-alias-impl-trait/issue-58951.rs
@@ -2,16 +2,15 @@
 
 #![feature(type_alias_impl_trait)]
 
-mod helper {
-    pub type A = impl Iterator;
+pub type A = impl Iterator;
 
-    pub fn def_a() -> A {
-        0..1
-    }
+#[define_opaque(A)]
+pub fn def_a() -> A {
+    0..1
 }
 
 pub fn use_a() {
-    helper::def_a().map(|x| x);
+    def_a().map(|x| x);
 }
 
 fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/issue-60407.rs b/tests/ui/type-alias-impl-trait/issue-60407.rs
index 6c7c76b5ac7..53280c28ecb 100644
--- a/tests/ui/type-alias-impl-trait/issue-60407.rs
+++ b/tests/ui/type-alias-impl-trait/issue-60407.rs
@@ -1,18 +1,16 @@
-#![feature(type_alias_impl_trait, rustc_attrs)]
+//@ check-pass
 
-mod bar {
-    pub type Debuggable = impl core::fmt::Debug;
+#![feature(type_alias_impl_trait)]
 
-    pub fn foo() -> Debuggable {
-        0u32
-    }
+pub type Debuggable = impl core::fmt::Debug;
+
+#[define_opaque(Debuggable)]
+pub fn foo() -> Debuggable {
+    0u32
 }
-use bar::*;
 
 static mut TEST: Option<Debuggable> = None;
 
-#[rustc_error]
 fn main() {
-    //~^ ERROR
     unsafe { TEST = Some(foo()) }
 }
diff --git a/tests/ui/type-alias-impl-trait/issue-60407.stderr b/tests/ui/type-alias-impl-trait/issue-60407.stderr
deleted file mode 100644
index bba9092e977..00000000000
--- a/tests/ui/type-alias-impl-trait/issue-60407.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: fatal error triggered by #[rustc_error]
-  --> $DIR/issue-60407.rs:15:1
-   |
-LL | fn main() {
-   | ^^^^^^^^^
-
-error: aborting due to 1 previous error
-
diff --git a/tests/ui/type-alias-impl-trait/issue-60564.rs b/tests/ui/type-alias-impl-trait/issue-60564.rs
index 48bd70bcca9..f28258b3b22 100644
--- a/tests/ui/type-alias-impl-trait/issue-60564.rs
+++ b/tests/ui/type-alias-impl-trait/issue-60564.rs
@@ -16,8 +16,8 @@ where
     E: std::fmt::Debug,
 {
     type BitsIter = IterBitsIter<T, E, u8>;
+    #[define_opaque(IterBitsIter)]
     fn iter_bits(self, n: u8) -> Self::BitsIter {
-        //~^ ERROR non-defining opaque type use
         (0u8..n).rev().map(move |shift| ((self >> T::from(shift)) & T::from(1)).try_into().unwrap())
         //~^ ERROR expected generic type parameter, found `u8`
     }
diff --git a/tests/ui/type-alias-impl-trait/issue-60564.stderr b/tests/ui/type-alias-impl-trait/issue-60564.stderr
index d42495e934d..6aaed7d4296 100644
--- a/tests/ui/type-alias-impl-trait/issue-60564.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-60564.stderr
@@ -1,15 +1,3 @@
-error[E0792]: non-defining opaque type use in defining scope
-  --> $DIR/issue-60564.rs:19:34
-   |
-LL |     fn iter_bits(self, n: u8) -> Self::BitsIter {
-   |                                  ^^^^^^^^^^^^^^ argument `u8` is not a generic parameter
-   |
-note: for this opaque type
-  --> $DIR/issue-60564.rs:8:30
-   |
-LL | type IterBitsIter<T, E, I> = impl std::iter::Iterator<Item = I>;
-   |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
 error[E0792]: expected generic type parameter, found `u8`
   --> $DIR/issue-60564.rs:21:9
    |
@@ -19,6 +7,6 @@ LL | type IterBitsIter<T, E, I> = impl std::iter::Iterator<Item = I>;
 LL |         (0u8..n).rev().map(move |shift| ((self >> T::from(shift)) & T::from(1)).try_into().unwrap())
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
 For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/type-alias-impl-trait/issue-63263-closure-return.rs b/tests/ui/type-alias-impl-trait/issue-63263-closure-return.rs
index 38abc3ec7e8..6de026a26d5 100644
--- a/tests/ui/type-alias-impl-trait/issue-63263-closure-return.rs
+++ b/tests/ui/type-alias-impl-trait/issue-63263-closure-return.rs
@@ -8,6 +8,7 @@
 
 pub type Closure = impl FnOnce();
 
+#[define_opaque(Closure)]
 fn bop() -> Closure {
     || -> Closure { || () };
     panic!()
diff --git a/tests/ui/type-alias-impl-trait/issue-63279.rs b/tests/ui/type-alias-impl-trait/issue-63279.rs
index 02f2111468a..10da40d2f90 100644
--- a/tests/ui/type-alias-impl-trait/issue-63279.rs
+++ b/tests/ui/type-alias-impl-trait/issue-63279.rs
@@ -2,6 +2,7 @@
 
 type Closure = impl FnOnce();
 
+#[define_opaque(Closure)]
 fn c() -> Closure {
     //~^ ERROR: expected a `FnOnce()` closure, found `()`
     || -> Closure { || () }
diff --git a/tests/ui/type-alias-impl-trait/issue-63279.stderr b/tests/ui/type-alias-impl-trait/issue-63279.stderr
index 97158ee297d..8f0e9c5fde0 100644
--- a/tests/ui/type-alias-impl-trait/issue-63279.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-63279.stderr
@@ -1,5 +1,5 @@
 error[E0277]: expected a `FnOnce()` closure, found `()`
-  --> $DIR/issue-63279.rs:5:11
+  --> $DIR/issue-63279.rs:6:11
    |
 LL | fn c() -> Closure {
    |           ^^^^^^^ expected an `FnOnce()` closure, found `()`
@@ -8,7 +8,7 @@ LL | fn c() -> Closure {
    = note: wrap the `()` in a closure with no arguments: `|| { /* code */ }`
 
 error[E0277]: expected a `FnOnce()` closure, found `()`
-  --> $DIR/issue-63279.rs:7:11
+  --> $DIR/issue-63279.rs:8:11
    |
 LL |     || -> Closure { || () }
    |           ^^^^^^^ expected an `FnOnce()` closure, found `()`
@@ -17,26 +17,26 @@ LL |     || -> Closure { || () }
    = note: wrap the `()` in a closure with no arguments: `|| { /* code */ }`
 
 error[E0308]: mismatched types
-  --> $DIR/issue-63279.rs:7:21
+  --> $DIR/issue-63279.rs:8:21
    |
 LL |     || -> Closure { || () }
    |                     ^^^^^ expected `()`, found closure
    |
    = note: expected unit type `()`
-                found closure `{closure@$DIR/issue-63279.rs:7:21: 7:23}`
+                found closure `{closure@$DIR/issue-63279.rs:8:21: 8:23}`
 help: use parentheses to call this closure
    |
 LL |     || -> Closure { (|| ())() }
    |                     +     +++
 
 error[E0308]: mismatched types
-  --> $DIR/issue-63279.rs:7:5
+  --> $DIR/issue-63279.rs:8:5
    |
 LL |     || -> Closure { || () }
    |     ^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found closure
    |
    = note: expected unit type `()`
-                found closure `{closure@$DIR/issue-63279.rs:7:5: 7:18}`
+                found closure `{closure@$DIR/issue-63279.rs:8:5: 8:18}`
 help: use parentheses to call this closure
    |
 LL |     (|| -> Closure { || () })()
diff --git a/tests/ui/type-alias-impl-trait/issue-63355.rs b/tests/ui/type-alias-impl-trait/issue-63355.rs
index a0d0355b5af..0b29bfeb98f 100644
--- a/tests/ui/type-alias-impl-trait/issue-63355.rs
+++ b/tests/ui/type-alias-impl-trait/issue-63355.rs
@@ -21,6 +21,7 @@ impl Foo for () {}
 impl Bar for () {
     type Foo = FooImpl;
 
+    #[define_opaque(FooImpl)]
     fn foo() -> Self::Foo {
         ()
     }
@@ -33,10 +34,12 @@ impl Baz for () {
     type Foo = FooImpl;
     type Bar = BarImpl;
 
+    #[define_opaque(FooImpl)]
     fn foo() -> Self::Foo {
         ()
     }
 
+    #[define_opaque(BarImpl)]
     fn bar() -> Self::Bar {
         //~^ ERROR: item does not constrain `FooImpl::{opaque#0}`
         ()
diff --git a/tests/ui/type-alias-impl-trait/issue-63355.stderr b/tests/ui/type-alias-impl-trait/issue-63355.stderr
index 6755c038056..cb1ef0ce41d 100644
--- a/tests/ui/type-alias-impl-trait/issue-63355.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-63355.stderr
@@ -1,12 +1,12 @@
-error: item does not constrain `FooImpl::{opaque#0}`, but has it in its signature
-  --> $DIR/issue-63355.rs:40:8
+error: item does not constrain `FooImpl::{opaque#0}`
+  --> $DIR/issue-63355.rs:43:8
    |
 LL |     fn bar() -> Self::Bar {
    |        ^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
-  --> $DIR/issue-63355.rs:29:20
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
+  --> $DIR/issue-63355.rs:30:20
    |
 LL | pub type FooImpl = impl Foo;
    |                    ^^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/issue-63677-type-alias-coherence.rs b/tests/ui/type-alias-impl-trait/issue-63677-type-alias-coherence.rs
index 51f95637969..5ea73965701 100644
--- a/tests/ui/type-alias-impl-trait/issue-63677-type-alias-coherence.rs
+++ b/tests/ui/type-alias-impl-trait/issue-63677-type-alias-coherence.rs
@@ -16,6 +16,9 @@ impl<T> Trait for S1<T> {}
 impl<T: Trait> S2<T> {}
 impl T3 {}
 
-pub fn use_t1() -> T1 { S1(()) }
+#[define_opaque(T1)]
+pub fn use_t1() -> T1 {
+    S1(())
+}
 
 fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/issue-65384.rs b/tests/ui/type-alias-impl-trait/issue-65384.rs
index 44ca5cb94b0..86bbc93c8bd 100644
--- a/tests/ui/type-alias-impl-trait/issue-65384.rs
+++ b/tests/ui/type-alias-impl-trait/issue-65384.rs
@@ -9,6 +9,7 @@ type Bar = impl MyTrait;
 impl MyTrait for Bar {}
 //~^ ERROR: conflicting implementations of trait `MyTrait` for type `()`
 
-fn bazr() -> Bar { }
+#[define_opaque(Bar)]
+fn bazr() -> Bar {}
 
 fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.rs b/tests/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.rs
index f98ce4a426c..6fc3aa8ce7e 100644
--- a/tests/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.rs
+++ b/tests/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.rs
@@ -1,20 +1,19 @@
 //@ check-pass
 
 #![feature(type_alias_impl_trait, rustc_attrs)]
-mod foo {
-    pub type T = impl Sized;
-    // The concrete type referred by impl-trait-type-alias(`T`) is guaranteed
-    // to be the same as where it occurs, whereas `impl Trait`'s instance is location sensitive;
-    // so difference assertion should not be declared on impl-trait-type-alias's instances.
-    // for details, check RFC-2515:
-    // https://github.com/rust-lang/rfcs/blob/master/text/2515-type_alias_impl_trait.md
 
-    fn bop(_: T) {
-        super::take(|| {});
-        super::take(|| {});
-    }
+pub type T = impl Sized;
+// The concrete type referred by impl-trait-type-alias(`T`) is guaranteed
+// to be the same as where it occurs, whereas `impl Trait`'s instance is location sensitive;
+// so difference assertion should not be declared on impl-trait-type-alias's instances.
+// for details, check RFC-2515:
+// https://github.com/rust-lang/rfcs/blob/master/text/2515-type_alias_impl_trait.md
+
+#[define_opaque(T)]
+fn bop() {
+    take(|| {});
+    take(|| {});
 }
-use foo::*;
 
 fn take(_: fn() -> T) {}
 
diff --git a/tests/ui/type-alias-impl-trait/issue-65918.rs b/tests/ui/type-alias-impl-trait/issue-65918.rs
index 275b9717cef..00dab6f2744 100644
--- a/tests/ui/type-alias-impl-trait/issue-65918.rs
+++ b/tests/ui/type-alias-impl-trait/issue-65918.rs
@@ -15,13 +15,11 @@ trait MyFrom<T>: Sized {
 }
 
 /* MCVE starts here */
-mod f {
-    pub trait F {}
-    impl F for () {}
-    pub type DummyT<T> = impl F;
-    fn _dummy_t<T>() -> DummyT<T> {}
-}
-use f::DummyT;
+pub trait F {}
+impl F for () {}
+pub type DummyT<T> = impl F;
+#[define_opaque(DummyT)]
+fn _dummy_t<T>() -> DummyT<T> {}
 
 struct Phantom1<T>(PhantomData<T>);
 struct Phantom2<T>(PhantomData<T>);
diff --git a/tests/ui/type-alias-impl-trait/issue-66580-closure-coherence.rs b/tests/ui/type-alias-impl-trait/issue-66580-closure-coherence.rs
index 0e3d01c2d61..009dc31ba26 100644
--- a/tests/ui/type-alias-impl-trait/issue-66580-closure-coherence.rs
+++ b/tests/ui/type-alias-impl-trait/issue-66580-closure-coherence.rs
@@ -6,6 +6,7 @@
 
 type Closure = impl FnOnce();
 
+#[define_opaque(Closure)]
 fn closure() -> Closure {
     || {}
 }
diff --git a/tests/ui/type-alias-impl-trait/issue-67844-nested-opaque.rs b/tests/ui/type-alias-impl-trait/issue-67844-nested-opaque.rs
index c320b0db31b..2d38b3030be 100644
--- a/tests/ui/type-alias-impl-trait/issue-67844-nested-opaque.rs
+++ b/tests/ui/type-alias-impl-trait/issue-67844-nested-opaque.rs
@@ -22,6 +22,7 @@ impl WithAssoc for MyStruct {
     type AssocType = MyParam;
 }
 
+#[define_opaque(Return)]
 fn my_fun<A>() -> Return<A> {
     MyStruct
 }
diff --git a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.rs b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.rs
index 9dcdb578568..205d4832b0a 100644
--- a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.rs
+++ b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.rs
@@ -6,9 +6,9 @@
 trait Trait<T> {}
 type Alias<'a, U> = impl Trait<U>;
 
+#[define_opaque(Alias)]
 fn f<'a>() -> Alias<'a, ()> {}
-//~^ ERROR non-defining opaque type use
-//~| ERROR expected generic type parameter, found `()`
+//~^ ERROR expected generic type parameter, found `()`
 
 fn main() {}
 
diff --git a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.stderr b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.stderr
index 085bffe907b..178aa5cf345 100644
--- a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.stderr
@@ -1,24 +1,12 @@
-error[E0792]: non-defining opaque type use in defining scope
-  --> $DIR/issue-68368-non-defining-use-2.rs:9:15
-   |
-LL | fn f<'a>() -> Alias<'a, ()> {}
-   |               ^^^^^^^^^^^^^ argument `()` is not a generic parameter
-   |
-note: for this opaque type
-  --> $DIR/issue-68368-non-defining-use-2.rs:7:21
-   |
-LL | type Alias<'a, U> = impl Trait<U>;
-   |                     ^^^^^^^^^^^^^
-
 error[E0792]: expected generic type parameter, found `()`
-  --> $DIR/issue-68368-non-defining-use-2.rs:9:29
+  --> $DIR/issue-68368-non-defining-use-2.rs:10:29
    |
 LL | type Alias<'a, U> = impl Trait<U>;
    |                - this generic parameter must be used with a generic type parameter
-LL |
+...
 LL | fn f<'a>() -> Alias<'a, ()> {}
    |                             ^^
 
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
 For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.rs b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.rs
index dfe2ee8204c..f3fa4fea746 100644
--- a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.rs
+++ b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.rs
@@ -6,9 +6,9 @@
 trait Trait<T> {}
 type Alias<'a, U> = impl Trait<U>;
 
+#[define_opaque(Alias)]
 fn f<'a>() -> Alias<'a, ()> {}
 //~^ ERROR expected generic type parameter, found `()`
-//~| ERROR non-defining opaque type use
 
 fn main() {}
 
diff --git a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.stderr b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.stderr
index ea704ffff97..bfbd506a7a5 100644
--- a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.stderr
@@ -1,24 +1,12 @@
-error[E0792]: non-defining opaque type use in defining scope
-  --> $DIR/issue-68368-non-defining-use.rs:9:15
-   |
-LL | fn f<'a>() -> Alias<'a, ()> {}
-   |               ^^^^^^^^^^^^^ argument `()` is not a generic parameter
-   |
-note: for this opaque type
-  --> $DIR/issue-68368-non-defining-use.rs:7:21
-   |
-LL | type Alias<'a, U> = impl Trait<U>;
-   |                     ^^^^^^^^^^^^^
-
 error[E0792]: expected generic type parameter, found `()`
-  --> $DIR/issue-68368-non-defining-use.rs:9:29
+  --> $DIR/issue-68368-non-defining-use.rs:10:29
    |
 LL | type Alias<'a, U> = impl Trait<U>;
    |                - this generic parameter must be used with a generic type parameter
-LL |
+...
 LL | fn f<'a>() -> Alias<'a, ()> {}
    |                             ^^
 
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
 For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.rs b/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.rs
index a0f8e48e268..f9a68a1b0b3 100644
--- a/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.rs
+++ b/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.rs
@@ -19,6 +19,7 @@ impl<T> WithAssoc<T> for () {
 type Return<A> = impl WithAssoc<A, AssocType = impl SomeTrait + 'a>;
 //~^ ERROR use of undeclared lifetime name `'a`
 
+#[define_opaque(Return)]
 fn my_fun<T>() -> Return<T> {}
 
 fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-ok.rs b/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-ok.rs
index 8e631fd1b6a..f62260bd3f0 100644
--- a/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-ok.rs
+++ b/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-ok.rs
@@ -18,6 +18,7 @@ impl WithAssoc for () {
 
 type Return<'a> = impl WithAssoc<AssocType = impl Sized + 'a>;
 
+#[define_opaque(Return)]
 fn my_fun<'a>() -> Return<'a> {}
 
 fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/issue-69323.rs b/tests/ui/type-alias-impl-trait/issue-69323.rs
index 18bc4cf9178..af536186f72 100644
--- a/tests/ui/type-alias-impl-trait/issue-69323.rs
+++ b/tests/ui/type-alias-impl-trait/issue-69323.rs
@@ -9,6 +9,7 @@ fn test1<A: Iterator<Item = &'static str>>(x: A) -> Chain<A, impl Iterator<Item
 }
 
 type I<A> = Chain<A, impl Iterator<Item = &'static str>>;
+#[define_opaque(I)]
 fn test2<A: Iterator<Item = &'static str>>(x: A) -> I<A> {
     x.chain(once(","))
 }
diff --git a/tests/ui/type-alias-impl-trait/issue-70121.rs b/tests/ui/type-alias-impl-trait/issue-70121.rs
index b90bd312a0b..5aec99a1c37 100644
--- a/tests/ui/type-alias-impl-trait/issue-70121.rs
+++ b/tests/ui/type-alias-impl-trait/issue-70121.rs
@@ -2,6 +2,7 @@
 
 pub type Successors<'a> = impl Iterator<Item = &'a ()>;
 
+#[define_opaque(Successors)]
 pub fn f<'a>() -> Successors<'a> {
     None.into_iter()
 }
diff --git a/tests/ui/type-alias-impl-trait/issue-70121.stderr b/tests/ui/type-alias-impl-trait/issue-70121.stderr
index ed2eb17fbea..8388998956f 100644
--- a/tests/ui/type-alias-impl-trait/issue-70121.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-70121.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/issue-70121.rs:18:5
+  --> $DIR/issue-70121.rs:19:5
    |
 LL | pub type Successors<'a> = impl Iterator<Item = &'a ()>;
    |                           ---------------------------- the expected opaque type
@@ -11,8 +11,8 @@ LL |     None.into_iter()
    |
    = note: expected opaque type `Successors<'a>`
                    found struct `std::option::IntoIter<_>`
-note: this item must have the opaque type in its signature in order to be able to register hidden types
-  --> $DIR/issue-70121.rs:17:8
+note: this item must have a `#[define_opaque(Successors)]` attribute to be able to define hidden types
+  --> $DIR/issue-70121.rs:18:8
    |
 LL | pub fn kazusa<'a>() -> <&'a () as Tr>::Item {
    |        ^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/issue-72793.rs b/tests/ui/type-alias-impl-trait/issue-72793.rs
index 0353b7f3787..a51d7f5634a 100644
--- a/tests/ui/type-alias-impl-trait/issue-72793.rs
+++ b/tests/ui/type-alias-impl-trait/issue-72793.rs
@@ -3,24 +3,21 @@
 
 #![feature(type_alias_impl_trait)]
 
-mod foo {
-    pub trait T {
-        type Item;
-    }
-
-    pub type Alias<'a> = impl T<Item = &'a ()>;
+pub trait T {
+    type Item;
+}
 
-    struct S;
-    impl<'a> T for &'a S {
-        type Item = &'a ();
-    }
+pub type Alias<'a> = impl T<Item = &'a ()>;
 
-    pub fn filter_positive<'a>() -> Alias<'a> {
-        &S
-    }
+struct S;
+impl<'a> T for &'a S {
+    type Item = &'a ();
 }
 
-use foo::*;
+#[define_opaque(Alias)]
+pub fn filter_positive<'a>() -> Alias<'a> {
+    &S
+}
 
 fn with_positive(fun: impl Fn(Alias<'_>)) {
     fun(filter_positive());
diff --git a/tests/ui/type-alias-impl-trait/issue-74244.rs b/tests/ui/type-alias-impl-trait/issue-74244.rs
index bb4104b3d25..60b1bee9ff6 100644
--- a/tests/ui/type-alias-impl-trait/issue-74244.rs
+++ b/tests/ui/type-alias-impl-trait/issue-74244.rs
@@ -13,6 +13,7 @@ impl<T> Allocator for DefaultAllocator {
 
 type A = impl Fn(<DefaultAllocator as Allocator>::Buffer);
 
+#[define_opaque(A)]
 fn foo() -> A {
     |_| ()
 }
diff --git a/tests/ui/type-alias-impl-trait/issue-74280.rs b/tests/ui/type-alias-impl-trait/issue-74280.rs
index ad641eaa00d..c8dc1adec41 100644
--- a/tests/ui/type-alias-impl-trait/issue-74280.rs
+++ b/tests/ui/type-alias-impl-trait/issue-74280.rs
@@ -4,6 +4,7 @@
 
 type Test = impl Copy;
 
+#[define_opaque(Test)]
 fn test() -> Test {
     let y = || -> Test { () };
     7 //~ ERROR mismatched types
diff --git a/tests/ui/type-alias-impl-trait/issue-74280.stderr b/tests/ui/type-alias-impl-trait/issue-74280.stderr
index c09efbe4e13..a89a3f77b3d 100644
--- a/tests/ui/type-alias-impl-trait/issue-74280.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-74280.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/issue-74280.rs:9:5
+  --> $DIR/issue-74280.rs:10:5
    |
 LL | fn test() -> Test {
    |              ---- expected `()` because of return type
diff --git a/tests/ui/type-alias-impl-trait/issue-76202-trait-impl-for-tait.rs b/tests/ui/type-alias-impl-trait/issue-76202-trait-impl-for-tait.rs
index 90ab4fd8d97..3e17126834c 100644
--- a/tests/ui/type-alias-impl-trait/issue-76202-trait-impl-for-tait.rs
+++ b/tests/ui/type-alias-impl-trait/issue-76202-trait-impl-for-tait.rs
@@ -7,19 +7,17 @@
 //@ check-pass
 #![feature(type_alias_impl_trait)]
 
-mod g {
-    pub trait Dummy {}
-    impl Dummy for () {}
-    pub type F = impl Dummy;
-    pub fn f() -> F {}
-}
-use g::*;
+pub trait Dummy {}
+impl Dummy for () {}
+pub type F = impl Dummy;
+#[define_opaque(F)]
+pub fn f() -> F {}
 
 trait Test {
     fn test(self);
 }
 
-impl Test for define::F {
+impl Test for F {
     fn test(self) {}
 }
 
@@ -29,17 +27,14 @@ impl Test for i32 {
     fn test(self) {}
 }
 
-mod define {
-    use super::*;
-
-    pub trait Dummy {}
-    impl Dummy for () {}
+pub trait Dummy2 {}
+impl Dummy2 for () {}
 
-    pub type F = impl Dummy;
-    pub fn f() -> F {}
-}
+pub type F2 = impl Dummy2;
+#[define_opaque(F2)]
+pub fn f2() -> F2 {}
 
 fn main() {
-    let x = define::f();
+    let x = f();
     x.test();
 }
diff --git a/tests/ui/type-alias-impl-trait/issue-77179.rs b/tests/ui/type-alias-impl-trait/issue-77179.rs
index 1dc74c6b5fe..18afc54dbdc 100644
--- a/tests/ui/type-alias-impl-trait/issue-77179.rs
+++ b/tests/ui/type-alias-impl-trait/issue-77179.rs
@@ -4,10 +4,11 @@
 
 type Pointer<T> = impl std::ops::Deref<Target = T>;
 
+#[define_opaque(Pointer)]
 fn test() -> Pointer<_> {
     //~^ ERROR: the placeholder `_` is not allowed within types
     Box::new(1)
-    //~^ ERROR: mismatched types
+    //~^ ERROR: expected generic type parameter, found `i32`
 }
 
 fn main() {
diff --git a/tests/ui/type-alias-impl-trait/issue-77179.stderr b/tests/ui/type-alias-impl-trait/issue-77179.stderr
index 16bbc996d90..bc11283f328 100644
--- a/tests/ui/type-alias-impl-trait/issue-77179.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-77179.stderr
@@ -1,36 +1,28 @@
-error[E0308]: mismatched types
-  --> $DIR/issue-77179.rs:9:5
-   |
-LL | type Pointer<T> = impl std::ops::Deref<Target = T>;
-   |                   -------------------------------- the expected opaque type
-LL |
-LL | fn test() -> Pointer<_> {
-   |              ---------- expected `Pointer<_>` because of return type
-LL |
-LL |     Box::new(1)
-   |     ^^^^^^^^^^^ expected opaque type, found `Box<{integer}>`
-   |
-   = note: expected opaque type `Pointer<_>`
-                   found struct `Box<{integer}>`
-note: this item must have the opaque type in its signature in order to be able to register hidden types
-  --> $DIR/issue-77179.rs:7:4
-   |
-LL | fn test() -> Pointer<_> {
-   |    ^^^^
-
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
-  --> $DIR/issue-77179.rs:7:22
+  --> $DIR/issue-77179.rs:8:22
    |
 LL | fn test() -> Pointer<_> {
-   |                      ^ not allowed in type signatures
+   |              --------^-
+   |              |       |
+   |              |       not allowed in type signatures
+   |              help: replace with the correct return type: `Pointer<i32>`
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
-  --> $DIR/issue-77179.rs:18:25
+  --> $DIR/issue-77179.rs:19:25
    |
 LL |     fn bar() -> Pointer<_>;
    |                         ^ not allowed in type signatures
 
+error[E0792]: expected generic type parameter, found `i32`
+  --> $DIR/issue-77179.rs:10:5
+   |
+LL | type Pointer<T> = impl std::ops::Deref<Target = T>;
+   |              - this generic parameter must be used with a generic type parameter
+...
+LL |     Box::new(1)
+   |     ^^^^^^^^^^^
+
 error: aborting due to 3 previous errors
 
-Some errors have detailed explanations: E0121, E0308.
+Some errors have detailed explanations: E0121, E0792.
 For more information about an error, try `rustc --explain E0121`.
diff --git a/tests/ui/type-alias-impl-trait/issue-84660-trait-impl-for-tait.rs b/tests/ui/type-alias-impl-trait/issue-84660-trait-impl-for-tait.rs
index 2a39da1176c..99ad48c8c32 100644
--- a/tests/ui/type-alias-impl-trait/issue-84660-trait-impl-for-tait.rs
+++ b/tests/ui/type-alias-impl-trait/issue-84660-trait-impl-for-tait.rs
@@ -8,6 +8,7 @@
 trait Foo {}
 impl Foo for () {}
 type Bar = impl Foo;
+#[define_opaque(Bar)]
 fn _defining_use() -> Bar {}
 
 trait TraitArg<T> {
diff --git a/tests/ui/type-alias-impl-trait/issue-84660-unsoundness.current.stderr b/tests/ui/type-alias-impl-trait/issue-84660-unsoundness.current.stderr
index ec7b9e0e12b..577d8667a57 100644
--- a/tests/ui/type-alias-impl-trait/issue-84660-unsoundness.current.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-84660-unsoundness.current.stderr
@@ -1,5 +1,5 @@
 error[E0119]: conflicting implementations of trait `Trait<Bar, _>`
-  --> $DIR/issue-84660-unsoundness.rs:29:1
+  --> $DIR/issue-84660-unsoundness.rs:31:1
    |
 LL | impl<In, Out> Trait<Bar, In> for Out {
    | ------------------------------------ first implementation here
@@ -7,14 +7,14 @@ LL | impl<In, Out> Trait<Bar, In> for Out {
 LL | impl<In, Out> Trait<(), In> for Out {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
 
-error: item does not constrain `Bar::{opaque#0}`, but has it in its signature
-  --> $DIR/issue-84660-unsoundness.rs:22:8
+error: item does not constrain `Bar::{opaque#0}`
+  --> $DIR/issue-84660-unsoundness.rs:24:8
    |
 LL |     fn convert(_i: In) -> Self::Out {
    |        ^^^^^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
   --> $DIR/issue-84660-unsoundness.rs:12:12
    |
 LL | type Bar = impl Foo;
diff --git a/tests/ui/type-alias-impl-trait/issue-84660-unsoundness.next.stderr b/tests/ui/type-alias-impl-trait/issue-84660-unsoundness.next.stderr
index e33102f687c..9e83de5375f 100644
--- a/tests/ui/type-alias-impl-trait/issue-84660-unsoundness.next.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-84660-unsoundness.next.stderr
@@ -1,5 +1,5 @@
 error[E0119]: conflicting implementations of trait `Trait<Bar, _>`
-  --> $DIR/issue-84660-unsoundness.rs:29:1
+  --> $DIR/issue-84660-unsoundness.rs:31:1
    |
 LL | impl<In, Out> Trait<Bar, In> for Out {
    | ------------------------------------ first implementation here
@@ -8,7 +8,7 @@ LL | impl<In, Out> Trait<(), In> for Out {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
 
 error[E0284]: type annotations needed: cannot satisfy `Bar == _`
-  --> $DIR/issue-84660-unsoundness.rs:22:37
+  --> $DIR/issue-84660-unsoundness.rs:24:37
    |
 LL |       fn convert(_i: In) -> Self::Out {
    |  _____________________________________^
diff --git a/tests/ui/type-alias-impl-trait/issue-84660-unsoundness.rs b/tests/ui/type-alias-impl-trait/issue-84660-unsoundness.rs
index f3234bafd11..4391bf01dc9 100644
--- a/tests/ui/type-alias-impl-trait/issue-84660-unsoundness.rs
+++ b/tests/ui/type-alias-impl-trait/issue-84660-unsoundness.rs
@@ -10,6 +10,7 @@
 trait Foo {}
 impl Foo for () {}
 type Bar = impl Foo;
+#[define_opaque(Bar)]
 fn _defining_use() -> Bar {}
 
 trait Trait<T, In> {
@@ -19,9 +20,10 @@ trait Trait<T, In> {
 
 impl<In, Out> Trait<Bar, In> for Out {
     type Out = Out;
+    #[define_opaque(Bar)]
     fn convert(_i: In) -> Self::Out {
         //[next]~^  ERROR: cannot satisfy `Bar == _`
-        //[current]~^^ ERROR: item does not constrain `Bar::{opaque#0}`, but has it in its signature
+        //[current]~^^ ERROR: item does not constrain `Bar::{opaque#0}`
         unreachable!();
     }
 }
diff --git a/tests/ui/type-alias-impl-trait/issue-89686.rs b/tests/ui/type-alias-impl-trait/issue-89686.rs
index f734c518dd2..5370b8844ff 100644
--- a/tests/ui/type-alias-impl-trait/issue-89686.rs
+++ b/tests/ui/type-alias-impl-trait/issue-89686.rs
@@ -11,6 +11,7 @@ trait Trait {
 
     fn f(&self) -> Self::F;
 
+    #[define_opaque(G)]
     fn g<'a>(&'a self) -> G<'a, Self>
     where
         Self: Sized,
diff --git a/tests/ui/type-alias-impl-trait/issue-89686.stderr b/tests/ui/type-alias-impl-trait/issue-89686.stderr
index 6fa7e197c40..7ad1442f666 100644
--- a/tests/ui/type-alias-impl-trait/issue-89686.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-89686.stderr
@@ -1,5 +1,5 @@
 error[E0277]: the trait bound `T: Trait` is not satisfied
-  --> $DIR/issue-89686.rs:18:9
+  --> $DIR/issue-89686.rs:19:9
    |
 LL |         async move { self.f().await }
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T`
diff --git a/tests/ui/type-alias-impl-trait/issue-93411.rs b/tests/ui/type-alias-impl-trait/issue-93411.rs
index 2d08b7ba4c1..11cbb876631 100644
--- a/tests/ui/type-alias-impl-trait/issue-93411.rs
+++ b/tests/ui/type-alias-impl-trait/issue-93411.rs
@@ -14,6 +14,7 @@ fn main() {
 }
 
 type BlahFut<'a> = impl Future<Output = ()> + Send + 'a;
+#[define_opaque(BlahFut)]
 fn blah<'a>(_value: &'a u8) -> BlahFut<'a> {
     async {}
 }
diff --git a/tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs b/tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs
index 7097123d608..08f3c404bed 100644
--- a/tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs
+++ b/tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs
@@ -44,6 +44,7 @@ fn r#struct() {
 mod only_pattern {
     type T = impl Copy;
 
+    #[define_opaque(T)]
     fn foo(foo: T) {
         let (mut x, mut y) = foo;
         x = 42;
@@ -52,6 +53,7 @@ mod only_pattern {
 
     type U = impl Copy;
 
+    #[define_opaque(U)]
     fn bar(bar: Option<U>) {
         match bar {
             Some((mut x, mut y)) => {
@@ -64,6 +66,7 @@ mod only_pattern {
 
     type V = impl Copy;
 
+    #[define_opaque(V)]
     fn baz(baz: Option<V>) {
         match baz {
             _ => {}
diff --git a/tests/ui/type-alias-impl-trait/itiat-forbid-nested-items.stderr b/tests/ui/type-alias-impl-trait/itiat-forbid-nested-items.stderr
index c177201431a..5b38b83e4d9 100644
--- a/tests/ui/type-alias-impl-trait/itiat-forbid-nested-items.stderr
+++ b/tests/ui/type-alias-impl-trait/itiat-forbid-nested-items.stderr
@@ -11,11 +11,6 @@ LL |             let x: <() as Foo>::Assoc = 42_i32;
    |
    = note: expected opaque type `<() as Foo>::Assoc`
                      found type `i32`
-note: this item must have the opaque type in its signature in order to be able to register hidden types
-  --> $DIR/itiat-forbid-nested-items.rs:11:12
-   |
-LL |         fn foo() -> <() as Foo>::Assoc {
-   |            ^^^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/type-alias-impl-trait/lazy_subtyping_of_opaques.rs b/tests/ui/type-alias-impl-trait/lazy_subtyping_of_opaques.rs
index 1bc352041a5..075b0bd75fa 100644
--- a/tests/ui/type-alias-impl-trait/lazy_subtyping_of_opaques.rs
+++ b/tests/ui/type-alias-impl-trait/lazy_subtyping_of_opaques.rs
@@ -6,6 +6,7 @@
 
 type Tait = impl FnOnce() -> ();
 
+#[define_opaque(Tait)]
 fn reify_as_tait() -> Thunk<Tait> {
     //~^ ERROR: expected a `FnOnce()` closure, found `()`
     Thunk::new(|cont| cont)
diff --git a/tests/ui/type-alias-impl-trait/lazy_subtyping_of_opaques.stderr b/tests/ui/type-alias-impl-trait/lazy_subtyping_of_opaques.stderr
index 921667f577b..0bee0dfa9c7 100644
--- a/tests/ui/type-alias-impl-trait/lazy_subtyping_of_opaques.stderr
+++ b/tests/ui/type-alias-impl-trait/lazy_subtyping_of_opaques.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/lazy_subtyping_of_opaques.rs:11:5
+  --> $DIR/lazy_subtyping_of_opaques.rs:12:5
    |
 LL | fn reify_as_tait() -> Thunk<Tait> {
    |                       ----------- expected `Thunk<_>` because of return type
@@ -11,7 +11,7 @@ LL |     Thunk::new(|cont| cont)
            found unit type `()`
 
 error[E0277]: expected a `FnOnce()` closure, found `()`
-  --> $DIR/lazy_subtyping_of_opaques.rs:11:23
+  --> $DIR/lazy_subtyping_of_opaques.rs:12:23
    |
 LL |     Thunk::new(|cont| cont)
    |                       ^^^^ expected an `FnOnce()` closure, found `()`
@@ -20,7 +20,7 @@ LL |     Thunk::new(|cont| cont)
    = note: wrap the `()` in a closure with no arguments: `|| { /* code */ }`
 
 error[E0277]: expected a `FnOnce()` closure, found `()`
-  --> $DIR/lazy_subtyping_of_opaques.rs:9:23
+  --> $DIR/lazy_subtyping_of_opaques.rs:10:23
    |
 LL | fn reify_as_tait() -> Thunk<Tait> {
    |                       ^^^^^^^^^^^ expected an `FnOnce()` closure, found `()`
diff --git a/tests/ui/type-alias-impl-trait/lifetime_mismatch.rs b/tests/ui/type-alias-impl-trait/lifetime_mismatch.rs
index 45a55050c44..b58840718a3 100644
--- a/tests/ui/type-alias-impl-trait/lifetime_mismatch.rs
+++ b/tests/ui/type-alias-impl-trait/lifetime_mismatch.rs
@@ -2,6 +2,7 @@
 
 type Foo<'a> = impl Sized;
 
+#[define_opaque(Foo)]
 fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> (Foo<'a>, Foo<'b>) {
     (x, y)
     //~^ ERROR opaque type used twice with different lifetimes
@@ -9,6 +10,7 @@ fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> (Foo<'a>, Foo<'b>) {
 
 type Bar<'a, 'b> = impl std::fmt::Debug;
 
+#[define_opaque(Bar)]
 fn bar<'x, 'y>(i: &'x i32, j: &'y i32) -> (Bar<'x, 'y>, Bar<'y, 'x>) {
     (i, j)
     //~^ ERROR opaque type used twice with different lifetimes
diff --git a/tests/ui/type-alias-impl-trait/lifetime_mismatch.stderr b/tests/ui/type-alias-impl-trait/lifetime_mismatch.stderr
index 4f7b0f17407..719748edc01 100644
--- a/tests/ui/type-alias-impl-trait/lifetime_mismatch.stderr
+++ b/tests/ui/type-alias-impl-trait/lifetime_mismatch.stderr
@@ -1,5 +1,5 @@
 error: opaque type used twice with different lifetimes
-  --> $DIR/lifetime_mismatch.rs:6:5
+  --> $DIR/lifetime_mismatch.rs:7:5
    |
 LL |     (x, y)
    |     ^^^^^^
@@ -8,13 +8,13 @@ LL |     (x, y)
    |     lifetime `'b` previously used here
    |
 note: if all non-lifetime generic parameters are the same, but the lifetime parameters differ, it is not possible to differentiate the opaque types
-  --> $DIR/lifetime_mismatch.rs:6:5
+  --> $DIR/lifetime_mismatch.rs:7:5
    |
 LL |     (x, y)
    |     ^^^^^^
 
 error: opaque type used twice with different lifetimes
-  --> $DIR/lifetime_mismatch.rs:13:5
+  --> $DIR/lifetime_mismatch.rs:15:5
    |
 LL |     (i, j)
    |     ^^^^^^
@@ -23,7 +23,7 @@ LL |     (i, j)
    |     lifetime `'y` previously used here
    |
 note: if all non-lifetime generic parameters are the same, but the lifetime parameters differ, it is not possible to differentiate the opaque types
-  --> $DIR/lifetime_mismatch.rs:13:5
+  --> $DIR/lifetime_mismatch.rs:15:5
    |
 LL |     (i, j)
    |     ^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/method_resolution.current.stderr b/tests/ui/type-alias-impl-trait/method_resolution.current.stderr
index a9c05ad3342..07e7126f8a0 100644
--- a/tests/ui/type-alias-impl-trait/method_resolution.current.stderr
+++ b/tests/ui/type-alias-impl-trait/method_resolution.current.stderr
@@ -1,5 +1,5 @@
 error[E0599]: no method named `bar` found for struct `Bar<u32>` in the current scope
-  --> $DIR/method_resolution.rs:21:14
+  --> $DIR/method_resolution.rs:22:14
    |
 LL | struct Bar<T>(T);
    | ------------- method `bar` not found for this struct
diff --git a/tests/ui/type-alias-impl-trait/method_resolution.next.stderr b/tests/ui/type-alias-impl-trait/method_resolution.next.stderr
index 6b34358a56e..7462d2b478b 100644
--- a/tests/ui/type-alias-impl-trait/method_resolution.next.stderr
+++ b/tests/ui/type-alias-impl-trait/method_resolution.next.stderr
@@ -1,5 +1,5 @@
 error[E0599]: no method named `bar` found for struct `Bar<u32>` in the current scope
-  --> $DIR/method_resolution.rs:21:14
+  --> $DIR/method_resolution.rs:22:14
    |
 LL | struct Bar<T>(T);
    | ------------- method `bar` not found for this struct
diff --git a/tests/ui/type-alias-impl-trait/method_resolution.rs b/tests/ui/type-alias-impl-trait/method_resolution.rs
index f636aba15c0..a9162d0e28b 100644
--- a/tests/ui/type-alias-impl-trait/method_resolution.rs
+++ b/tests/ui/type-alias-impl-trait/method_resolution.rs
@@ -11,6 +11,7 @@ type Foo = impl Sized;
 struct Bar<T>(T);
 
 impl Bar<Foo> {
+    #[define_opaque(Foo)]
     fn bar(mut self) {
         self.0 = 42_u32;
     }
@@ -23,6 +24,7 @@ impl Bar<u32> {
     }
 }
 
+#[define_opaque(Foo)]
 fn foo() -> Foo {
     42_u32
 }
diff --git a/tests/ui/type-alias-impl-trait/method_resolution2.rs b/tests/ui/type-alias-impl-trait/method_resolution2.rs
index f69661db799..a4c4bbbace6 100644
--- a/tests/ui/type-alias-impl-trait/method_resolution2.rs
+++ b/tests/ui/type-alias-impl-trait/method_resolution2.rs
@@ -12,6 +12,7 @@ type Foo = impl Sized;
 struct Bar<T>(T);
 
 impl Bar<Foo> {
+    #[define_opaque(Foo)]
     fn bar(self) {
         self.foo()
     }
@@ -21,6 +22,7 @@ impl Bar<u32> {
     fn foo(self) {}
 }
 
+#[define_opaque(Foo)]
 fn foo() -> Foo {
     42_u32
 }
diff --git a/tests/ui/type-alias-impl-trait/method_resolution3.rs b/tests/ui/type-alias-impl-trait/method_resolution3.rs
index 0e6176bfe03..a18dcc9a2fe 100644
--- a/tests/ui/type-alias-impl-trait/method_resolution3.rs
+++ b/tests/ui/type-alias-impl-trait/method_resolution3.rs
@@ -27,6 +27,7 @@ impl Bar<u32> {
     fn foo(self) {}
 }
 
+#[define_opaque(Foo)]
 fn foo() -> Foo {
     42_u32
 }
diff --git a/tests/ui/type-alias-impl-trait/method_resolution4.current.stderr b/tests/ui/type-alias-impl-trait/method_resolution4.current.stderr
index e4c4d121733..569a9f49bbe 100644
--- a/tests/ui/type-alias-impl-trait/method_resolution4.current.stderr
+++ b/tests/ui/type-alias-impl-trait/method_resolution4.current.stderr
@@ -1,5 +1,5 @@
 error[E0307]: invalid `self` parameter type: `Bar<Foo>`
-  --> $DIR/method_resolution4.rs:27:18
+  --> $DIR/method_resolution4.rs:25:18
    |
 LL |     fn foo(self: Bar<Foo>) {
    |                  ^^^^^^^^
@@ -8,7 +8,7 @@ LL |     fn foo(self: Bar<Foo>) {
    = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`
 
 error[E0307]: invalid `self` parameter type: `&Bar<Foo>`
-  --> $DIR/method_resolution4.rs:31:20
+  --> $DIR/method_resolution4.rs:29:20
    |
 LL |     fn foomp(self: &Bar<Foo>) {
    |                    ^^^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/method_resolution4.next.stderr b/tests/ui/type-alias-impl-trait/method_resolution4.next.stderr
index e4c4d121733..569a9f49bbe 100644
--- a/tests/ui/type-alias-impl-trait/method_resolution4.next.stderr
+++ b/tests/ui/type-alias-impl-trait/method_resolution4.next.stderr
@@ -1,5 +1,5 @@
 error[E0307]: invalid `self` parameter type: `Bar<Foo>`
-  --> $DIR/method_resolution4.rs:27:18
+  --> $DIR/method_resolution4.rs:25:18
    |
 LL |     fn foo(self: Bar<Foo>) {
    |                  ^^^^^^^^
@@ -8,7 +8,7 @@ LL |     fn foo(self: Bar<Foo>) {
    = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`
 
 error[E0307]: invalid `self` parameter type: `&Bar<Foo>`
-  --> $DIR/method_resolution4.rs:31:20
+  --> $DIR/method_resolution4.rs:29:20
    |
 LL |     fn foomp(self: &Bar<Foo>) {
    |                    ^^^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/method_resolution4.rs b/tests/ui/type-alias-impl-trait/method_resolution4.rs
index f33b4e473ae..8a1b60b0c6e 100644
--- a/tests/ui/type-alias-impl-trait/method_resolution4.rs
+++ b/tests/ui/type-alias-impl-trait/method_resolution4.rs
@@ -7,14 +7,12 @@
 
 #![feature(type_alias_impl_trait, arbitrary_self_types)]
 
-mod foo {
-    pub type Foo = impl Copy;
+pub type Foo = impl Copy;
 
-    fn foo() -> Foo {
-        42_u32
-    }
+#[define_opaque(Foo)]
+fn foo() -> Foo {
+    42_u32
 }
-use foo::Foo;
 
 #[derive(Copy, Clone)]
 struct Bar<T>(T);
diff --git a/tests/ui/type-alias-impl-trait/method_resolution5.rs b/tests/ui/type-alias-impl-trait/method_resolution5.rs
index 64355e4560d..b22c44ceb13 100644
--- a/tests/ui/type-alias-impl-trait/method_resolution5.rs
+++ b/tests/ui/type-alias-impl-trait/method_resolution5.rs
@@ -12,20 +12,20 @@ type Foo = impl Sized;
 struct Bar<T>(T);
 
 impl Bar<Foo> {
+    #[define_opaque(Foo)]
     fn bar(mut self) {
         self.0 = 42_u32;
     }
 }
 
 impl Bar<u32> {
-    fn foo(self)
-    where
-        Foo:,
-    {
+    #[define_opaque(Foo)]
+    fn foo(self) {
         self.bar()
     }
 }
 
+#[define_opaque(Foo)]
 fn foo() -> Foo {
     42_u32
 }
diff --git a/tests/ui/type-alias-impl-trait/method_resolution_trait_method_from_opaque.current.stderr b/tests/ui/type-alias-impl-trait/method_resolution_trait_method_from_opaque.current.stderr
index f331da1af87..841aa12f983 100644
--- a/tests/ui/type-alias-impl-trait/method_resolution_trait_method_from_opaque.current.stderr
+++ b/tests/ui/type-alias-impl-trait/method_resolution_trait_method_from_opaque.current.stderr
@@ -1,11 +1,11 @@
-error: item does not constrain `Tait::{opaque#0}`, but has it in its signature
-  --> $DIR/method_resolution_trait_method_from_opaque.rs:24:8
+error: item does not constrain `Tait::{opaque#0}`
+  --> $DIR/method_resolution_trait_method_from_opaque.rs:26:8
    |
 LL |     fn foo(&mut self) {
    |        ^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
   --> $DIR/method_resolution_trait_method_from_opaque.rs:17:13
    |
 LL | type Tait = impl Iterator<Item = ()>;
diff --git a/tests/ui/type-alias-impl-trait/method_resolution_trait_method_from_opaque.next.stderr b/tests/ui/type-alias-impl-trait/method_resolution_trait_method_from_opaque.next.stderr
index 2617ce124c1..bbdd3923821 100644
--- a/tests/ui/type-alias-impl-trait/method_resolution_trait_method_from_opaque.next.stderr
+++ b/tests/ui/type-alias-impl-trait/method_resolution_trait_method_from_opaque.next.stderr
@@ -1,5 +1,5 @@
 error[E0282]: type annotations needed
-  --> $DIR/method_resolution_trait_method_from_opaque.rs:26:9
+  --> $DIR/method_resolution_trait_method_from_opaque.rs:28:9
    |
 LL |         self.bar.next().unwrap();
    |         ^^^^^^^^ cannot infer type
diff --git a/tests/ui/type-alias-impl-trait/method_resolution_trait_method_from_opaque.rs b/tests/ui/type-alias-impl-trait/method_resolution_trait_method_from_opaque.rs
index b6adf08853f..93461fcbb0b 100644
--- a/tests/ui/type-alias-impl-trait/method_resolution_trait_method_from_opaque.rs
+++ b/tests/ui/type-alias-impl-trait/method_resolution_trait_method_from_opaque.rs
@@ -17,10 +17,12 @@ pub struct Foo {
 type Tait = impl Iterator<Item = ()>;
 
 impl Foo {
+    #[define_opaque(Tait)]
     pub fn new() -> Foo {
         Foo { bar: std::iter::empty() }
     }
 
+    #[define_opaque(Tait)]
     fn foo(&mut self) {
         //[current]~^ ERROR: item does not constrain
         self.bar.next().unwrap();
diff --git a/tests/ui/type-alias-impl-trait/missing_lifetime_bound.rs b/tests/ui/type-alias-impl-trait/missing_lifetime_bound.rs
index c178fcf5a91..d77efa39aeb 100644
--- a/tests/ui/type-alias-impl-trait/missing_lifetime_bound.rs
+++ b/tests/ui/type-alias-impl-trait/missing_lifetime_bound.rs
@@ -2,6 +2,7 @@
 
 type Opaque2<T> = impl Sized;
 type Opaque<'a, T> = Opaque2<T>;
+#[define_opaque(Opaque)]
 fn defining<'a, T>(x: &'a i32) -> Opaque<T> { x } //~ WARNING elided lifetime has a name
 //~^ ERROR: hidden type for `Opaque2<T>` captures lifetime that does not appear in bounds
 
diff --git a/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr b/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr
index e2c21f1636b..61eb76ffc5a 100644
--- a/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr
+++ b/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr
@@ -1,5 +1,5 @@
 warning: elided lifetime has a name
-  --> $DIR/missing_lifetime_bound.rs:5:41
+  --> $DIR/missing_lifetime_bound.rs:6:41
    |
 LL | fn defining<'a, T>(x: &'a i32) -> Opaque<T> { x }
    |             --                          ^ this elided lifetime gets resolved as `'a`
@@ -9,11 +9,11 @@ LL | fn defining<'a, T>(x: &'a i32) -> Opaque<T> { x }
    = note: `#[warn(elided_named_lifetimes)]` on by default
 
 error[E0700]: hidden type for `Opaque2<T>` captures lifetime that does not appear in bounds
-  --> $DIR/missing_lifetime_bound.rs:5:47
+  --> $DIR/missing_lifetime_bound.rs:6:47
    |
 LL | type Opaque2<T> = impl Sized;
    |                   ---------- opaque type defined here
-LL | type Opaque<'a, T> = Opaque2<T>;
+...
 LL | fn defining<'a, T>(x: &'a i32) -> Opaque<T> { x }
    |             --                                ^
    |             |
diff --git a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-infer.rs b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-infer.rs
index b887fcf3083..3dd2d53fe3d 100644
--- a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-infer.rs
+++ b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-infer.rs
@@ -6,6 +6,7 @@
 
 type Y<A, B> = impl std::fmt::Debug;
 
+#[define_opaque(Y)]
 fn g<A, B>() -> (Y<A, B>, Y<B, A>) {
     (42_i64, 60) //~ ERROR concrete type differs from previous defining opaque type use
 }
diff --git a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-infer.stderr b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-infer.stderr
index b050b08a8e2..d6558576577 100644
--- a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-infer.stderr
+++ b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-infer.stderr
@@ -1,5 +1,5 @@
 error: concrete type differs from previous defining opaque type use
-  --> $DIR/multiple-def-uses-in-one-fn-infer.rs:10:5
+  --> $DIR/multiple-def-uses-in-one-fn-infer.rs:11:5
    |
 LL |     (42_i64, 60)
    |     ^^^^^^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.rs b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.rs
index 580fb58ef83..39e4912ae3a 100644
--- a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.rs
+++ b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.rs
@@ -2,6 +2,7 @@
 
 type Foo<'a, 'b> = impl std::fmt::Debug;
 
+#[define_opaque(Foo)]
 fn foo<'x, 'y>(i: &'x i32, j: &'y i32) -> (Foo<'x, 'y>, Foo<'y, 'x>) {
     (i, j)
     //~^ ERROR opaque type used twice with different lifetimes
diff --git a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.stderr b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.stderr
index b2b9e604a6b..03f2b1c532a 100644
--- a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.stderr
+++ b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.stderr
@@ -1,5 +1,5 @@
 error: opaque type used twice with different lifetimes
-  --> $DIR/multiple-def-uses-in-one-fn-lifetimes.rs:6:5
+  --> $DIR/multiple-def-uses-in-one-fn-lifetimes.rs:7:5
    |
 LL |     (i, j)
    |     ^^^^^^
@@ -8,7 +8,7 @@ LL |     (i, j)
    |     lifetime `'y` previously used here
    |
 note: if all non-lifetime generic parameters are the same, but the lifetime parameters differ, it is not possible to differentiate the opaque types
-  --> $DIR/multiple-def-uses-in-one-fn-lifetimes.rs:6:5
+  --> $DIR/multiple-def-uses-in-one-fn-lifetimes.rs:7:5
    |
 LL |     (i, j)
    |     ^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-pass.rs b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-pass.rs
index aba41a9d852..50c97060cef 100644
--- a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-pass.rs
+++ b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-pass.rs
@@ -3,11 +3,13 @@
 
 type X<A: ToString + Clone, B: ToString + Clone> = impl ToString;
 
+#[define_opaque(X)]
 fn f<A: ToString + Clone, B: ToString + Clone>(a: A, b: B) -> (X<A, B>, X<A, B>) {
     (a.clone(), a)
 }
 
 type Tait<'x> = impl Sized;
+#[define_opaque(Tait)]
 fn define<'a: 'b, 'b: 'a>(x: &'a u8, y: &'b u8) -> (Tait<'a>, Tait<'b>) {
     ((), ())
 }
diff --git a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.rs b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.rs
index da845e86147..5e2b140ef8b 100644
--- a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.rs
+++ b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.rs
@@ -6,6 +6,7 @@
 
 type X<A, B> = impl Into<&'static A>;
 
+#[define_opaque(X)]
 fn f<A, B: 'static>(a: &'static A, b: B) -> (X<A, B>, X<B, A>) {
     //~^ ERROR the trait bound `&'static B: From<&A>` is not satisfied
     (a, a)
diff --git a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr
index b5f38074632..05a169882cb 100644
--- a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr
+++ b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr
@@ -1,5 +1,5 @@
 error[E0277]: the trait bound `&'static B: From<&A>` is not satisfied
-  --> $DIR/multiple-def-uses-in-one-fn.rs:9:45
+  --> $DIR/multiple-def-uses-in-one-fn.rs:10:45
    |
 LL | fn f<A, B: 'static>(a: &'static A, b: B) -> (X<A, B>, X<B, A>) {
    |                                             ^^^^^^^^^^^^^^^^^^ the trait `From<&A>` is not implemented for `&'static B`
diff --git a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn2.rs b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn2.rs
index 14510a5294e..1357d772be1 100644
--- a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn2.rs
+++ b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn2.rs
@@ -6,6 +6,7 @@
 
 type X<A: ToString + Clone, B: ToString + Clone> = impl ToString;
 
+#[define_opaque(X)]
 fn f<A: ToString + Clone, B: ToString + Clone>(a: A, b: B) -> (X<A, B>, X<B, A>) {
     (a.clone(), a)
     //~^ ERROR concrete type differs from previous defining opaque type
diff --git a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn2.stderr b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn2.stderr
index c7a4b2115bf..15e9b6fbf76 100644
--- a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn2.stderr
+++ b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn2.stderr
@@ -1,5 +1,5 @@
 error: concrete type differs from previous defining opaque type use
-  --> $DIR/multiple-def-uses-in-one-fn2.rs:10:5
+  --> $DIR/multiple-def-uses-in-one-fn2.rs:11:5
    |
 LL |     (a.clone(), a)
    |     ^^^^^^^^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn3.rs b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn3.rs
index 11a922443e6..11d23efec75 100644
--- a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn3.rs
+++ b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn3.rs
@@ -6,10 +6,12 @@
 
 type X<A: ToString + Clone, B: ToString + Clone> = impl ToString;
 
+#[define_opaque(X)]
 fn f<A: ToString + Clone, B: ToString + Clone>(a: A, b: B) -> (X<A, B>, X<B, A>) {
     (a, b)
 }
 
+#[define_opaque(X)]
 fn g<A: ToString + Clone, B: ToString + Clone>(a: A, b: B) -> (X<A, B>, X<A, B>) {
     (a, b)
     //~^ ERROR mismatched types
diff --git a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn3.stderr b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn3.stderr
index c3128ea6f5e..42ba769797b 100644
--- a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn3.stderr
+++ b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn3.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/multiple-def-uses-in-one-fn3.rs:14:9
+  --> $DIR/multiple-def-uses-in-one-fn3.rs:16:9
    |
 LL | fn g<A: ToString + Clone, B: ToString + Clone>(a: A, b: B) -> (X<A, B>, X<A, B>) {
    |      -                    - found type parameter
diff --git a/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.stderr b/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.stderr
index ca15b134a99..3a13ab7cb95 100644
--- a/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.stderr
+++ b/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.stderr
@@ -31,7 +31,7 @@ error: unconstrained opaque type
 LL | pub type Tait = impl Iterator<Item = (&'db LocalKey, impl Iterator)>;
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: `Tait` must be used in combination with a concrete type within the same module
+   = note: `Tait` must be used in combination with a concrete type within the same crate
 
 error: unconstrained opaque type
   --> $DIR/nested-impl-trait-in-tait.rs:3:54
@@ -39,7 +39,7 @@ error: unconstrained opaque type
 LL | pub type Tait = impl Iterator<Item = (&'db LocalKey, impl Iterator)>;
    |                                                      ^^^^^^^^^^^^^
    |
-   = note: `Tait` must be used in combination with a concrete type within the same module
+   = note: `Tait` must be used in combination with a concrete type within the same crate
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/type-alias-impl-trait/nested-in-anon-const.stderr b/tests/ui/type-alias-impl-trait/nested-in-anon-const.stderr
index aa0c1076117..54389efc9c6 100644
--- a/tests/ui/type-alias-impl-trait/nested-in-anon-const.stderr
+++ b/tests/ui/type-alias-impl-trait/nested-in-anon-const.stderr
@@ -13,7 +13,7 @@ error: unconstrained opaque type
 LL |                     type B<Z> = impl Sized;
    |                                 ^^^^^^^^^^
    |
-   = note: `B` must be used in combination with a concrete type within the same item
+   = note: `B` must be used in combination with a concrete type within the same crate
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/type-alias-impl-trait/nested-tait-hrtb.rs b/tests/ui/type-alias-impl-trait/nested-tait-hrtb.rs
index ba705d6f85a..6ef6f31953f 100644
--- a/tests/ui/type-alias-impl-trait/nested-tait-hrtb.rs
+++ b/tests/ui/type-alias-impl-trait/nested-tait-hrtb.rs
@@ -4,11 +4,13 @@ trait Trait<'a> { type Assoc; }
 impl<'a> Trait<'a> for () { type Assoc = &'a str; }
 
 type WithoutLt = impl Sized;
+#[define_opaque(WithoutLt)]
 fn without_lt() -> impl for<'a> Trait<'a, Assoc = WithoutLt> {}
 //~^ ERROR captures lifetime that does not appear in bounds
 
 type WithLt<'a> = impl Sized + 'a;
 
+#[define_opaque(WithLt)]
 fn with_lt() -> impl for<'a> Trait<'a, Assoc = WithLt<'a>> {}
 //~^ ERROR expected generic lifetime parameter, found `'a`
 
diff --git a/tests/ui/type-alias-impl-trait/nested-tait-hrtb.stderr b/tests/ui/type-alias-impl-trait/nested-tait-hrtb.stderr
index f208730552d..ad60d186dd3 100644
--- a/tests/ui/type-alias-impl-trait/nested-tait-hrtb.stderr
+++ b/tests/ui/type-alias-impl-trait/nested-tait-hrtb.stderr
@@ -1,19 +1,20 @@
 error[E0700]: hidden type for `WithoutLt` captures lifetime that does not appear in bounds
-  --> $DIR/nested-tait-hrtb.rs:7:62
+  --> $DIR/nested-tait-hrtb.rs:8:62
    |
 LL | type WithoutLt = impl Sized;
    |                  ---------- opaque type defined here
+LL | #[define_opaque(WithoutLt)]
 LL | fn without_lt() -> impl for<'a> Trait<'a, Assoc = WithoutLt> {}
    |                             --                               ^^
    |                             |
    |                             hidden type `&'a str` captures the lifetime `'a` as defined here
 
 error[E0792]: expected generic lifetime parameter, found `'a`
-  --> $DIR/nested-tait-hrtb.rs:12:60
+  --> $DIR/nested-tait-hrtb.rs:14:60
    |
 LL | type WithLt<'a> = impl Sized + 'a;
    |             -- this generic parameter must be used with a generic lifetime parameter
-LL |
+...
 LL | fn with_lt() -> impl for<'a> Trait<'a, Assoc = WithLt<'a>> {}
    |                                                            ^^
 
diff --git a/tests/ui/type-alias-impl-trait/nested-tait-inference.current.stderr b/tests/ui/type-alias-impl-trait/nested-tait-inference.current.stderr
index 915432bbe67..b19f34a67ff 100644
--- a/tests/ui/type-alias-impl-trait/nested-tait-inference.current.stderr
+++ b/tests/ui/type-alias-impl-trait/nested-tait-inference.current.stderr
@@ -1,5 +1,5 @@
 error[E0277]: the trait bound `(): Foo<FooX>` is not satisfied
-  --> $DIR/nested-tait-inference.rs:17:13
+  --> $DIR/nested-tait-inference.rs:18:13
    |
 LL | fn foo() -> impl Foo<FooX> {
    |             ^^^^^^^^^^^^^^ the trait `Foo<FooX>` is not implemented for `()`
diff --git a/tests/ui/type-alias-impl-trait/nested-tait-inference.rs b/tests/ui/type-alias-impl-trait/nested-tait-inference.rs
index 50d51c7faf9..d4ad72797cf 100644
--- a/tests/ui/type-alias-impl-trait/nested-tait-inference.rs
+++ b/tests/ui/type-alias-impl-trait/nested-tait-inference.rs
@@ -14,6 +14,7 @@ trait Foo<A> {}
 
 impl Foo<()> for () {}
 
+#[define_opaque(FooX)]
 fn foo() -> impl Foo<FooX> {
     //[current]~^ ERROR: the trait bound `(): Foo<FooX>` is not satisfied
     // FIXME(type-alias-impl-trait): We could probably make this work.
diff --git a/tests/ui/type-alias-impl-trait/nested-tait-inference2.current.stderr b/tests/ui/type-alias-impl-trait/nested-tait-inference2.current.stderr
index 9da3926ac70..27372ceed94 100644
--- a/tests/ui/type-alias-impl-trait/nested-tait-inference2.current.stderr
+++ b/tests/ui/type-alias-impl-trait/nested-tait-inference2.current.stderr
@@ -1,5 +1,5 @@
 error[E0277]: the trait bound `(): Foo<FooX>` is not satisfied
-  --> $DIR/nested-tait-inference2.rs:17:13
+  --> $DIR/nested-tait-inference2.rs:18:13
    |
 LL | fn foo() -> impl Foo<FooX> {
    |             ^^^^^^^^^^^^^^ the trait `Foo<FooX>` is not implemented for `()`
diff --git a/tests/ui/type-alias-impl-trait/nested-tait-inference2.next.stderr b/tests/ui/type-alias-impl-trait/nested-tait-inference2.next.stderr
index 9647d9e376e..b733739e4c8 100644
--- a/tests/ui/type-alias-impl-trait/nested-tait-inference2.next.stderr
+++ b/tests/ui/type-alias-impl-trait/nested-tait-inference2.next.stderr
@@ -1,5 +1,5 @@
 error[E0284]: type annotations needed: cannot satisfy `impl Foo<FooX> == ()`
-  --> $DIR/nested-tait-inference2.rs:19:5
+  --> $DIR/nested-tait-inference2.rs:20:5
    |
 LL |     ()
    |     ^^ cannot satisfy `impl Foo<FooX> == ()`
diff --git a/tests/ui/type-alias-impl-trait/nested-tait-inference2.rs b/tests/ui/type-alias-impl-trait/nested-tait-inference2.rs
index 28d72b0cbee..4aeecb9140c 100644
--- a/tests/ui/type-alias-impl-trait/nested-tait-inference2.rs
+++ b/tests/ui/type-alias-impl-trait/nested-tait-inference2.rs
@@ -14,6 +14,7 @@ trait Foo<A> {}
 impl Foo<()> for () {}
 impl Foo<u32> for () {}
 
+#[define_opaque(FooX)]
 fn foo() -> impl Foo<FooX> {
     //[current]~^ ERROR: the trait bound `(): Foo<FooX>` is not satisfied
     ()
diff --git a/tests/ui/type-alias-impl-trait/nested-tait-inference3.rs b/tests/ui/type-alias-impl-trait/nested-tait-inference3.rs
index aaf2812532d..3e7b8c80d1b 100644
--- a/tests/ui/type-alias-impl-trait/nested-tait-inference3.rs
+++ b/tests/ui/type-alias-impl-trait/nested-tait-inference3.rs
@@ -9,6 +9,7 @@ trait Foo<A> {}
 
 impl Foo<FooX> for () {}
 
+#[define_opaque(FooX)]
 fn foo() -> impl Foo<FooX> {
     //~^ ERROR: item does not constrain
     ()
diff --git a/tests/ui/type-alias-impl-trait/nested-tait-inference3.stderr b/tests/ui/type-alias-impl-trait/nested-tait-inference3.stderr
index 969409ebc59..be7aec92312 100644
--- a/tests/ui/type-alias-impl-trait/nested-tait-inference3.stderr
+++ b/tests/ui/type-alias-impl-trait/nested-tait-inference3.stderr
@@ -1,11 +1,11 @@
-error: item does not constrain `FooX::{opaque#0}`, but has it in its signature
-  --> $DIR/nested-tait-inference3.rs:12:4
+error: item does not constrain `FooX::{opaque#0}`
+  --> $DIR/nested-tait-inference3.rs:13:4
    |
 LL | fn foo() -> impl Foo<FooX> {
    |    ^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
   --> $DIR/nested-tait-inference3.rs:6:13
    |
 LL | type FooX = impl Debug;
diff --git a/tests/ui/type-alias-impl-trait/nested.rs b/tests/ui/type-alias-impl-trait/nested.rs
index 524703939f1..1a89039af8a 100644
--- a/tests/ui/type-alias-impl-trait/nested.rs
+++ b/tests/ui/type-alias-impl-trait/nested.rs
@@ -7,6 +7,7 @@ trait Trait<T> {}
 
 impl<T, U> Trait<T> for U {}
 
+#[define_opaque(Bar)]
 fn bar() -> Bar {
     //~^ ERROR: item does not constrain
     42
diff --git a/tests/ui/type-alias-impl-trait/nested.stderr b/tests/ui/type-alias-impl-trait/nested.stderr
index ca1cf6058ea..59911f65a23 100644
--- a/tests/ui/type-alias-impl-trait/nested.stderr
+++ b/tests/ui/type-alias-impl-trait/nested.stderr
@@ -1,18 +1,18 @@
-error: item does not constrain `Foo::{opaque#0}`, but has it in its signature
-  --> $DIR/nested.rs:10:4
+error: item does not constrain `Foo::{opaque#0}`
+  --> $DIR/nested.rs:11:4
    |
 LL | fn bar() -> Bar {
    |    ^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
   --> $DIR/nested.rs:3:12
    |
 LL | type Foo = impl std::fmt::Debug;
    |            ^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: `Bar` doesn't implement `Debug`
-  --> $DIR/nested.rs:16:22
+  --> $DIR/nested.rs:17:22
    |
 LL |     println!("{:?}", bar());
    |                      ^^^^^ `Bar` cannot be formatted using `{:?}` because it doesn't implement `Debug`
diff --git a/tests/ui/type-alias-impl-trait/nested_inference_failure.rs b/tests/ui/type-alias-impl-trait/nested_inference_failure.rs
index 004e79d6738..c0581b018e9 100644
--- a/tests/ui/type-alias-impl-trait/nested_inference_failure.rs
+++ b/tests/ui/type-alias-impl-trait/nested_inference_failure.rs
@@ -22,6 +22,7 @@ struct Foo<T: Debug, F: FnOnce(T)> {
 type ImplT = impl Debug;
 type FooImpl = Foo<ImplT, impl FnOnce(ImplT)>;
 
+#[define_opaque(FooImpl)]
 fn bar() -> FooImpl {
     Foo::<i32, _> { f: |_| (), _phantom: PhantomData }
 }
diff --git a/tests/ui/type-alias-impl-trait/nested_type_alias_impl_trait.rs b/tests/ui/type-alias-impl-trait/nested_type_alias_impl_trait.rs
index 4def8948708..5adae476bfe 100644
--- a/tests/ui/type-alias-impl-trait/nested_type_alias_impl_trait.rs
+++ b/tests/ui/type-alias-impl-trait/nested_type_alias_impl_trait.rs
@@ -1,21 +1,21 @@
 #![feature(type_alias_impl_trait)]
 
-mod my_mod {
-    use std::fmt::Debug;
+use std::fmt::Debug;
 
-    pub type Foo = impl Debug;
-    pub type Foot = impl Debug;
+pub type Foo = impl Debug;
+pub type Foot = impl Debug;
 
-    pub fn get_foo() -> Foo {
-        5i32
-    }
+#[define_opaque(Foo)]
+pub fn get_foo() -> Foo {
+    5i32
+}
 
-    pub fn get_foot(_: Foo) -> Foot {
-        //~^ ERROR: item does not constrain `Foo::{opaque#0}`, but has it in its signature
-        get_foo() //~ ERROR opaque type's hidden type cannot be another opaque type
-    }
+#[define_opaque(Foot, Foo)]
+pub fn get_foot(_: Foo) -> Foot {
+    //~^ ERROR: item does not constrain `Foo::{opaque#0}`
+    get_foo() //~ ERROR opaque type's hidden type cannot be another opaque type
 }
 
 fn main() {
-    let _: my_mod::Foot = my_mod::get_foot(my_mod::get_foo());
+    let _: Foot = get_foot(get_foo());
 }
diff --git a/tests/ui/type-alias-impl-trait/nested_type_alias_impl_trait.stderr b/tests/ui/type-alias-impl-trait/nested_type_alias_impl_trait.stderr
index 889cff1ba09..aabae315777 100644
--- a/tests/ui/type-alias-impl-trait/nested_type_alias_impl_trait.stderr
+++ b/tests/ui/type-alias-impl-trait/nested_type_alias_impl_trait.stderr
@@ -1,32 +1,32 @@
-error: item does not constrain `Foo::{opaque#0}`, but has it in its signature
-  --> $DIR/nested_type_alias_impl_trait.rs:13:12
+error: item does not constrain `Foo::{opaque#0}`
+  --> $DIR/nested_type_alias_impl_trait.rs:14:8
    |
-LL |     pub fn get_foot(_: Foo) -> Foot {
-   |            ^^^^^^^^
+LL | pub fn get_foot(_: Foo) -> Foot {
+   |        ^^^^^^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
-  --> $DIR/nested_type_alias_impl_trait.rs:6:20
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
+  --> $DIR/nested_type_alias_impl_trait.rs:5:16
    |
-LL |     pub type Foo = impl Debug;
-   |                    ^^^^^^^^^^
+LL | pub type Foo = impl Debug;
+   |                ^^^^^^^^^^
 
 error: opaque type's hidden type cannot be another opaque type from the same scope
-  --> $DIR/nested_type_alias_impl_trait.rs:15:9
+  --> $DIR/nested_type_alias_impl_trait.rs:16:5
    |
-LL |         get_foo()
-   |         ^^^^^^^^^ one of the two opaque types used here has to be outside its defining scope
+LL |     get_foo()
+   |     ^^^^^^^^^ one of the two opaque types used here has to be outside its defining scope
    |
 note: opaque type whose hidden type is being assigned
-  --> $DIR/nested_type_alias_impl_trait.rs:7:21
+  --> $DIR/nested_type_alias_impl_trait.rs:6:17
    |
-LL |     pub type Foot = impl Debug;
-   |                     ^^^^^^^^^^
+LL | pub type Foot = impl Debug;
+   |                 ^^^^^^^^^^
 note: opaque type being used as hidden type
-  --> $DIR/nested_type_alias_impl_trait.rs:6:20
+  --> $DIR/nested_type_alias_impl_trait.rs:5:16
    |
-LL |     pub type Foo = impl Debug;
-   |                    ^^^^^^^^^^
+LL | pub type Foo = impl Debug;
+   |                ^^^^^^^^^^
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/type-alias-impl-trait/never_reveal_concrete_type.rs b/tests/ui/type-alias-impl-trait/never_reveal_concrete_type.rs
index 590107d1038..fc47243d693 100644
--- a/tests/ui/type-alias-impl-trait/never_reveal_concrete_type.rs
+++ b/tests/ui/type-alias-impl-trait/never_reveal_concrete_type.rs
@@ -4,10 +4,12 @@ fn main() {}
 
 type NoReveal = impl std::fmt::Debug;
 
+#[define_opaque(NoReveal)]
 fn define_no_reveal() -> NoReveal {
     ""
 }
 
+#[define_opaque(NoReveal)]
 fn no_reveal(x: NoReveal) {
     let _: &'static str = x;
     let _ = x as &'static str;
diff --git a/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.rs b/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.rs
index 41238c27351..8e5e4719415 100644
--- a/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.rs
+++ b/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.rs
@@ -3,18 +3,17 @@
 
 #![feature(type_alias_impl_trait)]
 
-mod foo {
-    pub type Foo = impl Copy;
+pub type Foo = impl Copy;
 
-    // make compiler happy about using 'Foo'
-    pub fn bar(x: Foo) -> Foo {
-        //~^ ERROR: item does not constrain `Foo::{opaque#0}`
-        x
-    }
+// make compiler happy about using 'Foo'
+#[define_opaque(Foo)]
+pub fn bar(x: Foo) -> Foo {
+    //~^ ERROR: item does not constrain `Foo::{opaque#0}`
+    x
 }
 
 fn main() {
     unsafe {
-        let _: foo::Foo = std::mem::transmute(0u8);
+        let _: Foo = std::mem::transmute(0u8);
     }
 }
diff --git a/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.stderr b/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.stderr
index eed88c5df4f..a57793d5a77 100644
--- a/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.stderr
+++ b/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.stderr
@@ -1,15 +1,15 @@
-error: item does not constrain `Foo::{opaque#0}`, but has it in its signature
-  --> $DIR/no_inferrable_concrete_type.rs:10:12
+error: item does not constrain `Foo::{opaque#0}`
+  --> $DIR/no_inferrable_concrete_type.rs:10:8
    |
-LL |     pub fn bar(x: Foo) -> Foo {
-   |            ^^^
+LL | pub fn bar(x: Foo) -> Foo {
+   |        ^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
-  --> $DIR/no_inferrable_concrete_type.rs:7:20
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
+  --> $DIR/no_inferrable_concrete_type.rs:6:16
    |
-LL |     pub type Foo = impl Copy;
-   |                    ^^^^^^^^^
+LL | pub type Foo = impl Copy;
+   |                ^^^^^^^^^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/type-alias-impl-trait/no_revealing_outside_defining_module.rs b/tests/ui/type-alias-impl-trait/no_revealing_outside_defining_module.rs
index 61153b1e171..42161dcde66 100644
--- a/tests/ui/type-alias-impl-trait/no_revealing_outside_defining_module.rs
+++ b/tests/ui/type-alias-impl-trait/no_revealing_outside_defining_module.rs
@@ -2,11 +2,10 @@
 
 fn main() {}
 
-mod boo {
-    pub type Boo = impl ::std::fmt::Debug;
-    fn bomp() -> Boo {
-        ""
-    }
+pub type Boo = impl ::std::fmt::Debug;
+#[define_opaque(Boo)]
+fn define() -> Boo {
+    ""
 }
 
 // We don't actually know the type here.
@@ -15,10 +14,10 @@ fn bomp2() {
     let _: &str = bomp(); //~ ERROR mismatched types
 }
 
-fn bomp() -> boo::Boo {
+fn bomp() -> Boo {
     "" //~ ERROR mismatched types
 }
 
-fn bomp_loop() -> boo::Boo {
+fn bomp_loop() -> Boo {
     loop {}
 }
diff --git a/tests/ui/type-alias-impl-trait/no_revealing_outside_defining_module.stderr b/tests/ui/type-alias-impl-trait/no_revealing_outside_defining_module.stderr
index 863282a0ff9..f4416eb009a 100644
--- a/tests/ui/type-alias-impl-trait/no_revealing_outside_defining_module.stderr
+++ b/tests/ui/type-alias-impl-trait/no_revealing_outside_defining_module.stderr
@@ -1,8 +1,8 @@
 error[E0308]: mismatched types
-  --> $DIR/no_revealing_outside_defining_module.rs:15:19
+  --> $DIR/no_revealing_outside_defining_module.rs:14:19
    |
-LL |     pub type Boo = impl ::std::fmt::Debug;
-   |                    ---------------------- the found opaque type
+LL | pub type Boo = impl ::std::fmt::Debug;
+   |                ---------------------- the found opaque type
 ...
 LL |     let _: &str = bomp();
    |            ----   ^^^^^^ expected `&str`, found opaque type
@@ -11,29 +11,29 @@ LL |     let _: &str = bomp();
    |
    = note: expected reference `&str`
             found opaque type `Boo`
-note: this item must have the opaque type in its signature in order to be able to register hidden types
-  --> $DIR/no_revealing_outside_defining_module.rs:14:4
+note: this item must have a `#[define_opaque(Boo)]` attribute to be able to define hidden types
+  --> $DIR/no_revealing_outside_defining_module.rs:13:4
    |
 LL | fn bomp2() {
    |    ^^^^^
 
 error[E0308]: mismatched types
-  --> $DIR/no_revealing_outside_defining_module.rs:19:5
+  --> $DIR/no_revealing_outside_defining_module.rs:18:5
    |
-LL |     pub type Boo = impl ::std::fmt::Debug;
-   |                    ---------------------- the expected opaque type
+LL | pub type Boo = impl ::std::fmt::Debug;
+   |                ---------------------- the expected opaque type
 ...
-LL | fn bomp() -> boo::Boo {
-   |              -------- expected `Boo` because of return type
+LL | fn bomp() -> Boo {
+   |              --- expected `Boo` because of return type
 LL |     ""
    |     ^^ expected opaque type, found `&str`
    |
    = note: expected opaque type `Boo`
                 found reference `&'static str`
-note: this item must have the opaque type in its signature in order to be able to register hidden types
-  --> $DIR/no_revealing_outside_defining_module.rs:18:4
+note: this item must have a `#[define_opaque(Boo)]` attribute to be able to define hidden types
+  --> $DIR/no_revealing_outside_defining_module.rs:17:4
    |
-LL | fn bomp() -> boo::Boo {
+LL | fn bomp() -> Boo {
    |    ^^^^
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/type-alias-impl-trait/normalize-alias-type.rs b/tests/ui/type-alias-impl-trait/normalize-alias-type.rs
index 9fcf42e188c..d0fcfb438fb 100644
--- a/tests/ui/type-alias-impl-trait/normalize-alias-type.rs
+++ b/tests/ui/type-alias-impl-trait/normalize-alias-type.rs
@@ -18,7 +18,7 @@ pub fn tr1() -> impl Tr {
 }
 
 struct Inner {
-    x: helper::X,
+    x: X,
 }
 impl Tr for Inner {
     fn get(&self) -> u32 {
@@ -26,14 +26,9 @@ impl Tr for Inner {
     }
 }
 
-mod helper {
-    pub use super::*;
-    pub type X = impl Tr;
+pub type X = impl Tr;
 
-    pub fn tr2() -> impl Tr
-    where
-        X:,
-    {
-        Inner { x: tr1() }
-    }
+#[define_opaque(X)]
+pub fn tr2() -> impl Tr {
+    Inner { x: tr1() }
 }
diff --git a/tests/ui/type-alias-impl-trait/normalize-hidden-types.current.stderr b/tests/ui/type-alias-impl-trait/normalize-hidden-types.current.stderr
index a40dac06a01..75cc5948e93 100644
--- a/tests/ui/type-alias-impl-trait/normalize-hidden-types.current.stderr
+++ b/tests/ui/type-alias-impl-trait/normalize-hidden-types.current.stderr
@@ -1,29 +1,29 @@
 error: concrete type differs from previous defining opaque type use
-  --> $DIR/normalize-hidden-types.rs:26:20
+  --> $DIR/normalize-hidden-types.rs:27:20
    |
 LL |     fn define() -> Opaque {
    |                    ^^^^^^ expected `*const (dyn FnOnce(()) + 'static)`, got `*const dyn for<'a> FnOnce(<u8 as Trait>::Gat<'a>)`
    |
 note: previous use here
-  --> $DIR/normalize-hidden-types.rs:27:9
+  --> $DIR/normalize-hidden-types.rs:28:9
    |
 LL |         dyn_hoops::<_>(0)
    |         ^^^^^^^^^^^^^^^^^
 
 error: concrete type differs from previous defining opaque type use
-  --> $DIR/normalize-hidden-types.rs:34:22
+  --> $DIR/normalize-hidden-types.rs:36:22
    |
 LL |     fn define_1() -> Opaque { dyn_hoops::<_>(0) }
    |                      ^^^^^^ expected `*const (dyn FnOnce(()) + 'static)`, got `*const dyn for<'a> FnOnce(<u8 as Trait>::Gat<'a>)`
    |
 note: previous use here
-  --> $DIR/normalize-hidden-types.rs:34:31
+  --> $DIR/normalize-hidden-types.rs:36:31
    |
 LL |     fn define_1() -> Opaque { dyn_hoops::<_>(0) }
    |                               ^^^^^^^^^^^^^^^^^
 
 error[E0308]: mismatched types
-  --> $DIR/normalize-hidden-types.rs:43:25
+  --> $DIR/normalize-hidden-types.rs:47:25
    |
 LL |     type Opaque = impl Sized;
    |                   ---------- the expected opaque type
@@ -39,13 +39,13 @@ LL |         let _: Opaque = dyn_hoops::<u8>(0);
    = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
 
 error: concrete type differs from previous defining opaque type use
-  --> $DIR/normalize-hidden-types.rs:52:25
+  --> $DIR/normalize-hidden-types.rs:57:25
    |
 LL |         let _: Opaque = dyn_hoops::<_>(0);
    |                         ^^^^^^^^^^^^^^^^^ expected `*const (dyn FnOnce(()) + 'static)`, got `*const dyn for<'a> FnOnce(<u8 as Trait>::Gat<'a>)`
    |
 note: previous use here
-  --> $DIR/normalize-hidden-types.rs:53:9
+  --> $DIR/normalize-hidden-types.rs:58:9
    |
 LL |         None
    |         ^^^^
diff --git a/tests/ui/type-alias-impl-trait/normalize-hidden-types.rs b/tests/ui/type-alias-impl-trait/normalize-hidden-types.rs
index 4028dba82bf..bc007169b83 100644
--- a/tests/ui/type-alias-impl-trait/normalize-hidden-types.rs
+++ b/tests/ui/type-alias-impl-trait/normalize-hidden-types.rs
@@ -23,6 +23,7 @@ fn dyn_hoops<T: Trait>(_: T) -> *const dyn FnOnce(T::Gat<'_>) {
 mod typeof_1 {
     use super::*;
     type Opaque = impl Sized;
+    #[define_opaque(Opaque)]
     fn define() -> Opaque {
         dyn_hoops::<_>(0)
     }
@@ -31,13 +32,16 @@ mod typeof_1 {
 mod typeof_2 {
     use super::*;
     type Opaque = impl Sized;
+    #[define_opaque(Opaque)]
     fn define_1() -> Opaque { dyn_hoops::<_>(0) }
+    #[define_opaque(Opaque)]
     fn define_2() -> Opaque { dyn_hoops::<u8>(0) }
 }
 
 mod typeck {
     use super::*;
     type Opaque = impl Sized;
+    #[define_opaque(Opaque)]
     fn define() -> Option<Opaque> {
         let _: Opaque = dyn_hoops::<_>(0);
         let _: Opaque = dyn_hoops::<u8>(0);
@@ -48,6 +52,7 @@ mod typeck {
 mod borrowck {
     use super::*;
     type Opaque = impl Sized;
+    #[define_opaque(Opaque)]
     fn define() -> Option<Opaque> {
         let _: Opaque = dyn_hoops::<_>(0);
         None
diff --git a/tests/ui/type-alias-impl-trait/not-matching-trait-refs-isnt-defining.rs b/tests/ui/type-alias-impl-trait/not-matching-trait-refs-isnt-defining.rs
index 131f8d999d8..112ee4d5571 100644
--- a/tests/ui/type-alias-impl-trait/not-matching-trait-refs-isnt-defining.rs
+++ b/tests/ui/type-alias-impl-trait/not-matching-trait-refs-isnt-defining.rs
@@ -9,6 +9,7 @@ trait Foo<T> {
 struct DefinesOpaque;
 impl Foo<DefinesOpaque> for () {
     type Assoc = impl Sized;
+    //~^ ERROR: unconstrained opaque type
 
     // This test's return type is `u32`, *not* the opaque that is defined above.
     // Previously we were only checking that the self type of the assoc matched,
diff --git a/tests/ui/type-alias-impl-trait/not-matching-trait-refs-isnt-defining.stderr b/tests/ui/type-alias-impl-trait/not-matching-trait-refs-isnt-defining.stderr
index d4528fb76fe..1d1b14e1463 100644
--- a/tests/ui/type-alias-impl-trait/not-matching-trait-refs-isnt-defining.stderr
+++ b/tests/ui/type-alias-impl-trait/not-matching-trait-refs-isnt-defining.stderr
@@ -1,5 +1,13 @@
+error: unconstrained opaque type
+  --> $DIR/not-matching-trait-refs-isnt-defining.rs:11:18
+   |
+LL |     type Assoc = impl Sized;
+   |                  ^^^^^^^^^^
+   |
+   = note: `Assoc` must be used in combination with a concrete type within the same impl
+
 error[E0308]: mismatched types
-  --> $DIR/not-matching-trait-refs-isnt-defining.rs:17:54
+  --> $DIR/not-matching-trait-refs-isnt-defining.rs:18:54
    |
 LL |     type Assoc = impl Sized;
    |                  ---------- the expected opaque type
@@ -11,12 +19,7 @@ LL |         let _: <Self as Foo<DefinesOpaque>>::Assoc = "";
    |
    = note: expected opaque type `<() as Foo<DefinesOpaque>>::Assoc`
                 found reference `&'static str`
-note: this item must have the opaque type in its signature in order to be able to register hidden types
-  --> $DIR/not-matching-trait-refs-isnt-defining.rs:16:8
-   |
-LL |     fn test() -> <() as Foo<NoOpaques>>::Assoc {
-   |        ^^^^
 
-error: aborting due to 1 previous error
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/type-alias-impl-trait/not_a_defining_use.rs b/tests/ui/type-alias-impl-trait/not_a_defining_use.rs
index b5ef1470629..d20622dc2e0 100644
--- a/tests/ui/type-alias-impl-trait/not_a_defining_use.rs
+++ b/tests/ui/type-alias-impl-trait/not_a_defining_use.rs
@@ -6,6 +6,7 @@ fn main() {}
 
 type Two<T, U> = impl Debug;
 
+#[define_opaque(Two)]
 fn three<T: Debug, U>(t: T) -> Two<T, U> {
     (t, 5i8)
 }
@@ -20,6 +21,7 @@ impl Bar for u32 {
     const FOO: i32 = 42;
 }
 
+#[define_opaque(Two)]
 fn four<T: Debug, U: Bar>(t: T) -> Two<T, U> {
     (t, <U as Bar>::FOO)
     //~^ ERROR concrete type differs
diff --git a/tests/ui/type-alias-impl-trait/not_a_defining_use.stderr b/tests/ui/type-alias-impl-trait/not_a_defining_use.stderr
index b59f9c49b07..d90e4531879 100644
--- a/tests/ui/type-alias-impl-trait/not_a_defining_use.stderr
+++ b/tests/ui/type-alias-impl-trait/not_a_defining_use.stderr
@@ -1,11 +1,11 @@
 error: concrete type differs from previous defining opaque type use
-  --> $DIR/not_a_defining_use.rs:24:5
+  --> $DIR/not_a_defining_use.rs:26:5
    |
 LL |     (t, <U as Bar>::FOO)
    |     ^^^^^^^^^^^^^^^^^^^^ expected `(T, i8)`, got `(T, <U as Bar>::Blub)`
    |
 note: previous use here
-  --> $DIR/not_a_defining_use.rs:10:5
+  --> $DIR/not_a_defining_use.rs:11:5
    |
 LL |     (t, 5i8)
    |     ^^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/not_well_formed.rs b/tests/ui/type-alias-impl-trait/not_well_formed.rs
index 0cf8d41c7fd..bd4477dbf0f 100644
--- a/tests/ui/type-alias-impl-trait/not_well_formed.rs
+++ b/tests/ui/type-alias-impl-trait/not_well_formed.rs
@@ -16,6 +16,7 @@ trait Trait<U> {}
 
 impl<W> Trait<W> for () {}
 
+#[define_opaque(Foo)]
 fn foo_desugared<T: TraitWithAssoc>(_: T) -> Foo<T> {
     ()
 }
diff --git a/tests/ui/type-alias-impl-trait/obligation_ice.rs b/tests/ui/type-alias-impl-trait/obligation_ice.rs
index e3698b23be8..134255e1eb2 100644
--- a/tests/ui/type-alias-impl-trait/obligation_ice.rs
+++ b/tests/ui/type-alias-impl-trait/obligation_ice.rs
@@ -8,6 +8,7 @@ trait Trait<'a, 'b: 'a> {}
 impl<'a, 'b: 'a, T> Trait<'a, 'b> for std::iter::Cloned<T> {}
 
 type I<'a, 'b: 'a, A: Trait<'a, 'b>> = Chain<A, impl Iterator<Item = &'static str>>;
+#[define_opaque(I)]
 fn test2<'a, 'b, A: Trait<'a, 'b> + Iterator<Item = &'static str>>(x: A) -> I<'a, 'b, A> {
     x.chain(once("5"))
 }
diff --git a/tests/ui/type-alias-impl-trait/outlives-bound-var.rs b/tests/ui/type-alias-impl-trait/outlives-bound-var.rs
index 2c6f44d5416..b1711e9eab8 100644
--- a/tests/ui/type-alias-impl-trait/outlives-bound-var.rs
+++ b/tests/ui/type-alias-impl-trait/outlives-bound-var.rs
@@ -5,11 +5,9 @@
 //@ check-pass
 #![feature(type_alias_impl_trait)]
 
-mod tait {
-    pub type Ty<'a> = impl Sized + 'a;
-    fn define<'a>() -> Ty<'a> {}
-}
-use tait::Ty;
+pub type Ty<'a> = impl Sized + 'a;
+#[define_opaque(Ty)]
+fn define<'a>() -> Ty<'a> {}
 
 // Ty<'^0>: 'static
 fn test1(_: &'static fn(Ty<'_>)) {}
diff --git a/tests/ui/type-alias-impl-trait/param_mismatch.rs b/tests/ui/type-alias-impl-trait/param_mismatch.rs
index c7465030713..4e4e06acfd4 100644
--- a/tests/ui/type-alias-impl-trait/param_mismatch.rs
+++ b/tests/ui/type-alias-impl-trait/param_mismatch.rs
@@ -8,6 +8,7 @@ fn id(s: &str) -> &str {
 }
 type Opaque<'a> = impl Sized + 'a;
 // The second `Opaque<'_>` has a higher kinded lifetime, not a generic parameter
+#[define_opaque(Opaque)]
 fn test(s: &str) -> (Opaque<'_>, impl Fn(&str) -> Opaque<'_>) {
     (s, id)
     //~^ ERROR: expected generic lifetime parameter, found `'_`
diff --git a/tests/ui/type-alias-impl-trait/param_mismatch.stderr b/tests/ui/type-alias-impl-trait/param_mismatch.stderr
index 09ec550d718..07a8ce38f98 100644
--- a/tests/ui/type-alias-impl-trait/param_mismatch.stderr
+++ b/tests/ui/type-alias-impl-trait/param_mismatch.stderr
@@ -1,5 +1,5 @@
 error[E0792]: expected generic lifetime parameter, found `'_`
-  --> $DIR/param_mismatch.rs:12:5
+  --> $DIR/param_mismatch.rs:13:5
    |
 LL | type Opaque<'a> = impl Sized + 'a;
    |             -- this generic parameter must be used with a generic lifetime parameter
diff --git a/tests/ui/type-alias-impl-trait/param_mismatch2.rs b/tests/ui/type-alias-impl-trait/param_mismatch2.rs
index c7d5eaa16aa..f6a99711411 100644
--- a/tests/ui/type-alias-impl-trait/param_mismatch2.rs
+++ b/tests/ui/type-alias-impl-trait/param_mismatch2.rs
@@ -9,6 +9,7 @@ fn id(s: &str) -> &str {
 
 type Opaque<'a> = impl Sized + 'a;
 
+#[define_opaque(Opaque)]
 fn test(s: &str) -> (impl Fn(&str) -> Opaque<'_>, impl Fn(&str) -> Opaque<'_>) {
     (id, id) //~ ERROR: expected generic lifetime parameter, found `'_`
 }
diff --git a/tests/ui/type-alias-impl-trait/param_mismatch2.stderr b/tests/ui/type-alias-impl-trait/param_mismatch2.stderr
index 1ecdd7c2b54..f5ecade2f02 100644
--- a/tests/ui/type-alias-impl-trait/param_mismatch2.stderr
+++ b/tests/ui/type-alias-impl-trait/param_mismatch2.stderr
@@ -1,5 +1,5 @@
 error[E0792]: expected generic lifetime parameter, found `'_`
-  --> $DIR/param_mismatch2.rs:13:5
+  --> $DIR/param_mismatch2.rs:14:5
    |
 LL | type Opaque<'a> = impl Sized + 'a;
    |             -- this generic parameter must be used with a generic lifetime parameter
diff --git a/tests/ui/type-alias-impl-trait/param_mismatch3.rs b/tests/ui/type-alias-impl-trait/param_mismatch3.rs
index 03c133d5d3c..17b6f8bce2a 100644
--- a/tests/ui/type-alias-impl-trait/param_mismatch3.rs
+++ b/tests/ui/type-alias-impl-trait/param_mismatch3.rs
@@ -9,6 +9,7 @@ fn id2<'a, 'b>(s: (&'a str, &'b str)) -> (&'a str, &'b str) {
 
 type Opaque<'a> = impl Sized + 'a;
 
+#[define_opaque(Opaque)]
 fn test() -> impl for<'a, 'b> Fn((&'a str, &'b str)) -> (Opaque<'a>, Opaque<'b>) {
     id2 //~ ERROR expected generic lifetime parameter, found `'a`
 }
@@ -19,6 +20,7 @@ fn id(s: &str) -> &str {
 
 type Opaque2<'a> = impl Sized + 'a;
 
+#[define_opaque(Opaque2)]
 fn test2(s: &str) -> (impl Fn(&str) -> Opaque2<'_>, Opaque2<'_>) {
     (id, s) //~ ERROR: expected generic lifetime parameter, found `'_`
 }
diff --git a/tests/ui/type-alias-impl-trait/param_mismatch3.stderr b/tests/ui/type-alias-impl-trait/param_mismatch3.stderr
index b8805f9b7f6..7565bbfc6ff 100644
--- a/tests/ui/type-alias-impl-trait/param_mismatch3.stderr
+++ b/tests/ui/type-alias-impl-trait/param_mismatch3.stderr
@@ -1,5 +1,5 @@
 error[E0792]: expected generic lifetime parameter, found `'a`
-  --> $DIR/param_mismatch3.rs:13:5
+  --> $DIR/param_mismatch3.rs:14:5
    |
 LL | type Opaque<'a> = impl Sized + 'a;
    |             -- this generic parameter must be used with a generic lifetime parameter
@@ -8,7 +8,7 @@ LL |     id2
    |     ^^^
 
 error[E0792]: expected generic lifetime parameter, found `'_`
-  --> $DIR/param_mismatch3.rs:23:5
+  --> $DIR/param_mismatch3.rs:25:5
    |
 LL | type Opaque2<'a> = impl Sized + 'a;
    |              -- this generic parameter must be used with a generic lifetime parameter
diff --git a/tests/ui/type-alias-impl-trait/param_mismatch4.rs b/tests/ui/type-alias-impl-trait/param_mismatch4.rs
index e072f3ab8e0..bc32143d0eb 100644
--- a/tests/ui/type-alias-impl-trait/param_mismatch4.rs
+++ b/tests/ui/type-alias-impl-trait/param_mismatch4.rs
@@ -8,6 +8,7 @@ type Opq<'a> = impl Sized;
 // Two defining uses: Opq<'{empty}> and Opq<'a>.
 // This used to ICE.
 // issue: #122782
+#[define_opaque(Opq)]
 fn build<'a>() -> Opq<'a> {
     let _: Opq<'_> = ();
     //~^ ERROR expected generic lifetime parameter, found `'_`
diff --git a/tests/ui/type-alias-impl-trait/param_mismatch4.stderr b/tests/ui/type-alias-impl-trait/param_mismatch4.stderr
index d3fdea25a3d..647637ae32a 100644
--- a/tests/ui/type-alias-impl-trait/param_mismatch4.stderr
+++ b/tests/ui/type-alias-impl-trait/param_mismatch4.stderr
@@ -1,5 +1,5 @@
 error[E0792]: expected generic lifetime parameter, found `'_`
-  --> $DIR/param_mismatch4.rs:12:12
+  --> $DIR/param_mismatch4.rs:13:12
    |
 LL | type Opq<'a> = impl Sized;
    |          -- this generic parameter must be used with a generic lifetime parameter
diff --git a/tests/ui/type-alias-impl-trait/path_resolution_taint.rs b/tests/ui/type-alias-impl-trait/path_resolution_taint.rs
new file mode 100644
index 00000000000..b320e88450b
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/path_resolution_taint.rs
@@ -0,0 +1,16 @@
+//! This test used to ICE #131298
+
+#![feature(type_alias_impl_trait)]
+
+fn dyn_hoops<T>() -> *const dyn Iterator<Item = impl Captures> {
+    //~^ ERROR: cannot find trait `Captures` in this scope
+    loop {}
+}
+
+type Opaque = impl Sized;
+#[define_opaque(Opaque)]
+fn define() -> Opaque {
+    let _: Opaque = dyn_hoops::<u8>();
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/path_resolution_taint.stderr b/tests/ui/type-alias-impl-trait/path_resolution_taint.stderr
new file mode 100644
index 00000000000..122c7c1ffbf
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/path_resolution_taint.stderr
@@ -0,0 +1,9 @@
+error[E0405]: cannot find trait `Captures` in this scope
+  --> $DIR/path_resolution_taint.rs:5:54
+   |
+LL | fn dyn_hoops<T>() -> *const dyn Iterator<Item = impl Captures> {
+   |                                                      ^^^^^^^^ not found in this scope
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0405`.
diff --git a/tests/ui/type-alias-impl-trait/privacy.rs b/tests/ui/type-alias-impl-trait/privacy.rs
index a5386bbec0d..4fbb9c7313f 100644
--- a/tests/ui/type-alias-impl-trait/privacy.rs
+++ b/tests/ui/type-alias-impl-trait/privacy.rs
@@ -3,6 +3,7 @@
 #![feature(type_alias_impl_trait)]
 
 type Foo = (impl Sized, u8);
+#[define_opaque(Foo)]
 pub fn foo() -> Foo {
     //~^ WARNING type alias `Foo` is more private than the item `foo`
     (42, 42)
diff --git a/tests/ui/type-alias-impl-trait/privacy.stderr b/tests/ui/type-alias-impl-trait/privacy.stderr
index 50870905c30..eeb49b1a4ac 100644
--- a/tests/ui/type-alias-impl-trait/privacy.stderr
+++ b/tests/ui/type-alias-impl-trait/privacy.stderr
@@ -1,5 +1,5 @@
 warning: type alias `Foo` is more private than the item `foo`
-  --> $DIR/privacy.rs:6:1
+  --> $DIR/privacy.rs:7:1
    |
 LL | pub fn foo() -> Foo {
    | ^^^^^^^^^^^^^^^^^^^ function `foo` is reachable at visibility `pub`
diff --git a/tests/ui/type-alias-impl-trait/recursive-fn-tait.rs b/tests/ui/type-alias-impl-trait/recursive-fn-tait.rs
index 3d1759097d6..cfd7e1bf382 100644
--- a/tests/ui/type-alias-impl-trait/recursive-fn-tait.rs
+++ b/tests/ui/type-alias-impl-trait/recursive-fn-tait.rs
@@ -3,10 +3,12 @@
 
 pub type Diff = impl Fn(usize) -> usize;
 
+#[define_opaque(Diff)]
 pub fn lift() -> Diff {
     |_: usize |loop {}
 }
 
+#[define_opaque(Diff)]
 pub fn add(
     n: Diff,
     m: Diff,
diff --git a/tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr b/tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr
index e8925b9b489..1a8ab219404 100644
--- a/tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr
+++ b/tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr
@@ -1,11 +1,11 @@
 error: concrete type differs from previous defining opaque type use
-  --> $DIR/recursive-fn-tait.rs:14:5
+  --> $DIR/recursive-fn-tait.rs:16:5
    |
 LL |     move |x: usize| m(n(x))
-   |     ^^^^^^^^^^^^^^^^^^^^^^^ expected `{closure@$DIR/recursive-fn-tait.rs:7:5: 7:16}`, got `{closure@$DIR/recursive-fn-tait.rs:14:5: 14:20}`
+   |     ^^^^^^^^^^^^^^^^^^^^^^^ expected `{closure@$DIR/recursive-fn-tait.rs:8:5: 8:16}`, got `{closure@$DIR/recursive-fn-tait.rs:16:5: 16:20}`
    |
 note: previous use here
-  --> $DIR/recursive-fn-tait.rs:7:5
+  --> $DIR/recursive-fn-tait.rs:8:5
    |
 LL |     |_: usize |loop {}
    |     ^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.rs b/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.rs
index 10588398c9d..26ffd5c16a2 100644
--- a/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.rs
+++ b/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.rs
@@ -3,11 +3,15 @@
 #![feature(type_alias_impl_trait)]
 
 type Op = impl std::fmt::Display;
-fn foo() -> Op { &"hello world" }
+#[define_opaque(Op)]
+fn foo() -> Op {
+    &"hello world"
+}
 
 fn transform<S>() -> impl std::fmt::Display {
     &0usize
 }
+#[define_opaque(Op)]
 fn bad() -> Op {
     transform::<Op>()
     //~^ ERROR concrete type differs from previous defining opaque type use
diff --git a/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.stderr b/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.stderr
index eec35548c55..259f3b2b9f3 100644
--- a/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.stderr
+++ b/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.stderr
@@ -1,14 +1,14 @@
 error: concrete type differs from previous defining opaque type use
-  --> $DIR/recursive-tait-conflicting-defn-2.rs:12:5
+  --> $DIR/recursive-tait-conflicting-defn-2.rs:16:5
    |
 LL |     transform::<Op>()
    |     ^^^^^^^^^^^^^^^^^ expected `&'static &'static str`, got `impl std::fmt::Display`
    |
 note: previous use here
-  --> $DIR/recursive-tait-conflicting-defn-2.rs:6:18
+  --> $DIR/recursive-tait-conflicting-defn-2.rs:8:5
    |
-LL | fn foo() -> Op { &"hello world" }
-   |                  ^^^^^^^^^^^^^^
+LL |     &"hello world"
+   |     ^^^^^^^^^^^^^^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn.rs b/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn.rs
index 38fb493b498..c9e2773905d 100644
--- a/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn.rs
+++ b/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn.rs
@@ -14,24 +14,23 @@ struct B<T> {
 
 impl<T: Test> Test for B<T> {}
 
-mod helper {
-    use super::*;
-    pub type TestImpl = impl Test;
+pub type TestImpl = impl Test;
 
-    pub fn test() -> TestImpl {
-        A
-    }
+#[define_opaque(TestImpl)]
+pub fn test() -> TestImpl {
+    A
+}
 
-    fn make_option2() -> Option<TestImpl> {
-        let inner = make_option().unwrap();
+#[define_opaque(TestImpl)]
+fn make_option2() -> Option<TestImpl> {
+    let inner = make_option().unwrap();
 
-        Some(B { inner })
-        //~^ ERROR concrete type differs from previous defining opaque type use
-    }
+    Some(B { inner })
+    //~^ ERROR concrete type differs from previous defining opaque type use
 }
 
-fn make_option() -> Option<helper::TestImpl> {
-    Some(helper::test())
+fn make_option() -> Option<TestImpl> {
+    Some(test())
 }
 
 fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn.stderr b/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn.stderr
index 252c5d7dfa7..47471c9728c 100644
--- a/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn.stderr
+++ b/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn.stderr
@@ -1,14 +1,14 @@
 error: concrete type differs from previous defining opaque type use
-  --> $DIR/recursive-tait-conflicting-defn.rs:28:9
+  --> $DIR/recursive-tait-conflicting-defn.rs:28:5
    |
-LL |         Some(B { inner })
-   |         ^^^^^^^^^^^^^^^^^ expected `A`, got `B<TestImpl>`
+LL |     Some(B { inner })
+   |     ^^^^^^^^^^^^^^^^^ expected `A`, got `B<TestImpl>`
    |
 note: previous use here
-  --> $DIR/recursive-tait-conflicting-defn.rs:22:9
+  --> $DIR/recursive-tait-conflicting-defn.rs:21:5
    |
-LL |         A
-   |         ^
+LL |     A
+   |     ^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/type-alias-impl-trait/reveal_local.rs b/tests/ui/type-alias-impl-trait/reveal_local.rs
index 34f3788e234..1e1e118937b 100644
--- a/tests/ui/type-alias-impl-trait/reveal_local.rs
+++ b/tests/ui/type-alias-impl-trait/reveal_local.rs
@@ -7,12 +7,13 @@ type Foo = impl Debug;
 fn is_send<T: Send>() {}
 
 fn not_good() {
-    // Error: this function does not constrain `Foo` to any particular
-    // hidden type, so it cannot rely on `Send` being true.
+    // This function does not define `Foo`,
+    // so it can actually check auto traits on the hidden type without
+    // risking cycle errors.
     is_send::<Foo>();
-    //~^ ERROR: cannot check whether the hidden type of `reveal_local[9507]::Foo::{opaque#0}` satisfies auto traits
 }
 
+#[define_opaque(Foo)]
 fn not_gooder() -> Foo {
     // Constrain `Foo = u32`
     let x: Foo = 22_u32;
diff --git a/tests/ui/type-alias-impl-trait/reveal_local.stderr b/tests/ui/type-alias-impl-trait/reveal_local.stderr
index 9829c58cf73..bd082888591 100644
--- a/tests/ui/type-alias-impl-trait/reveal_local.stderr
+++ b/tests/ui/type-alias-impl-trait/reveal_local.stderr
@@ -1,23 +1,5 @@
-error: cannot check whether the hidden type of `reveal_local[9507]::Foo::{opaque#0}` satisfies auto traits
-  --> $DIR/reveal_local.rs:12:15
-   |
-LL |     is_send::<Foo>();
-   |               ^^^
-   |
-   = note: fetching the hidden types of an opaque inside of the defining scope is not supported. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
-note: opaque type is declared here
-  --> $DIR/reveal_local.rs:5:12
-   |
-LL | type Foo = impl Debug;
-   |            ^^^^^^^^^^
-note: required by a bound in `is_send`
-  --> $DIR/reveal_local.rs:7:15
-   |
-LL | fn is_send<T: Send>() {}
-   |               ^^^^ required by this bound in `is_send`
-
 error[E0283]: type annotations needed: cannot satisfy `Foo: Send`
-  --> $DIR/reveal_local.rs:22:15
+  --> $DIR/reveal_local.rs:23:15
    |
 LL |     is_send::<Foo>();
    |               ^^^
@@ -29,6 +11,6 @@ note: required by a bound in `is_send`
 LL | fn is_send<T: Send>() {}
    |               ^^^^ required by this bound in `is_send`
 
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
 For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.rs b/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.rs
index 37d84feee4b..242a4b3cd3e 100644
--- a/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.rs
+++ b/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.rs
@@ -12,19 +12,16 @@
 
 #![feature(type_alias_impl_trait)]
 
-mod helper {
-    pub type Opaque = impl Sized;
+pub type Opaque = impl Sized;
 
-    pub fn get_rpit() -> impl Clone {}
+pub fn get_rpit() -> impl Clone {}
 
-    fn test() -> Opaque {
-        super::query(get_rpit);
-        get_rpit()
-    }
+#[define_opaque(Opaque)]
+fn test() -> Opaque {
+    query(get_rpit);
+    get_rpit()
 }
 
-use helper::*;
-
 fn query(_: impl FnOnce() -> Opaque) {}
 
 fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query_2.rs b/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query_2.rs
index 80f1b1502d3..dc489c0d6fb 100644
--- a/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query_2.rs
+++ b/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query_2.rs
@@ -5,16 +5,14 @@
 
 #![feature(type_alias_impl_trait)]
 
-mod helper {
-    pub type Opaque = impl Sized;
+pub type Opaque = impl Sized;
 
-    pub fn get_rpit() -> impl Sized {}
+pub fn get_rpit() -> impl Sized {}
 
-    fn test(_: Opaque) {
-        super::query(get_rpit);
-    }
+#[define_opaque(Opaque)]
+fn test() {
+    query(get_rpit);
 }
-use helper::*;
 
 fn query(_: impl FnOnce() -> Opaque) {}
 
diff --git a/tests/ui/type-alias-impl-trait/self-referential-2.current.stderr b/tests/ui/type-alias-impl-trait/self-referential-2.current.stderr
index e4399f2d8f4..dca3ae05bb0 100644
--- a/tests/ui/type-alias-impl-trait/self-referential-2.current.stderr
+++ b/tests/ui/type-alias-impl-trait/self-referential-2.current.stderr
@@ -1,5 +1,5 @@
 error[E0277]: can't compare `i32` with `Foo`
-  --> $DIR/self-referential-2.rs:10:13
+  --> $DIR/self-referential-2.rs:11:13
    |
 LL | fn bar() -> Bar {
    |             ^^^ no implementation for `i32 == Foo`
diff --git a/tests/ui/type-alias-impl-trait/self-referential-2.rs b/tests/ui/type-alias-impl-trait/self-referential-2.rs
index f96364ccfcd..d3effe817b8 100644
--- a/tests/ui/type-alias-impl-trait/self-referential-2.rs
+++ b/tests/ui/type-alias-impl-trait/self-referential-2.rs
@@ -7,6 +7,7 @@
 type Foo = impl std::fmt::Debug;
 type Bar = impl PartialEq<Foo>;
 
+#[define_opaque(Bar)]
 fn bar() -> Bar {
     42_i32 //[current]~^ ERROR can't compare `i32` with `Foo`
 }
diff --git a/tests/ui/type-alias-impl-trait/self-referential-3.rs b/tests/ui/type-alias-impl-trait/self-referential-3.rs
index 18f09b54867..b5562532893 100644
--- a/tests/ui/type-alias-impl-trait/self-referential-3.rs
+++ b/tests/ui/type-alias-impl-trait/self-referential-3.rs
@@ -2,6 +2,7 @@
 
 type Bar<'a, 'b> = impl PartialEq<Bar<'a, 'b>> + std::fmt::Debug;
 
+#[define_opaque(Bar)]
 fn bar<'a, 'b>(i: &'a i32) -> Bar<'a, 'b> {
     //~^ ERROR can't compare `&i32` with `Bar<'a, 'b>`
     i
diff --git a/tests/ui/type-alias-impl-trait/self-referential-3.stderr b/tests/ui/type-alias-impl-trait/self-referential-3.stderr
index 15ebcdafca6..d0b1d46c29e 100644
--- a/tests/ui/type-alias-impl-trait/self-referential-3.stderr
+++ b/tests/ui/type-alias-impl-trait/self-referential-3.stderr
@@ -1,5 +1,5 @@
 error[E0277]: can't compare `&i32` with `Bar<'a, 'b>`
-  --> $DIR/self-referential-3.rs:5:31
+  --> $DIR/self-referential-3.rs:6:31
    |
 LL | fn bar<'a, 'b>(i: &'a i32) -> Bar<'a, 'b> {
    |                               ^^^^^^^^^^^ no implementation for `&i32 == Bar<'a, 'b>`
diff --git a/tests/ui/type-alias-impl-trait/self-referential-4.rs b/tests/ui/type-alias-impl-trait/self-referential-4.rs
index 36742c8ad57..36df087dfcb 100644
--- a/tests/ui/type-alias-impl-trait/self-referential-4.rs
+++ b/tests/ui/type-alias-impl-trait/self-referential-4.rs
@@ -2,18 +2,21 @@
 
 type Bar<'a, 'b> = impl PartialEq<Bar<'b, 'static>> + std::fmt::Debug;
 
+#[define_opaque(Bar)]
 fn bar<'a, 'b>(i: &'a i32) -> Bar<'a, 'b> {
     i //~^ ERROR can't compare `&i32` with `Bar<'b, 'static>`
 }
 
 type Foo<'a, 'b> = impl PartialEq<Foo<'static, 'b>> + std::fmt::Debug;
 
+#[define_opaque(Foo)]
 fn foo<'a, 'b>(i: &'a i32) -> Foo<'a, 'b> {
     i //~^ ERROR can't compare `&i32` with `Foo<'static, 'b>`
 }
 
 type Moo<'a, 'b> = impl PartialEq<Moo<'static, 'a>> + std::fmt::Debug;
 
+#[define_opaque(Moo)]
 fn moo<'a, 'b>(i: &'a i32) -> Moo<'a, 'b> {
     i //~^ ERROR can't compare `&i32` with `Moo<'static, 'a>`
 }
diff --git a/tests/ui/type-alias-impl-trait/self-referential-4.stderr b/tests/ui/type-alias-impl-trait/self-referential-4.stderr
index 98c762e3d38..92534981eb9 100644
--- a/tests/ui/type-alias-impl-trait/self-referential-4.stderr
+++ b/tests/ui/type-alias-impl-trait/self-referential-4.stderr
@@ -1,5 +1,5 @@
 error[E0277]: can't compare `&i32` with `Bar<'b, 'static>`
-  --> $DIR/self-referential-4.rs:5:31
+  --> $DIR/self-referential-4.rs:6:31
    |
 LL | fn bar<'a, 'b>(i: &'a i32) -> Bar<'a, 'b> {
    |                               ^^^^^^^^^^^ no implementation for `&i32 == Bar<'b, 'static>`
@@ -10,7 +10,7 @@ LL |     i
    = help: the trait `PartialEq` is implemented for `i32`
 
 error[E0277]: can't compare `&i32` with `Foo<'static, 'b>`
-  --> $DIR/self-referential-4.rs:11:31
+  --> $DIR/self-referential-4.rs:13:31
    |
 LL | fn foo<'a, 'b>(i: &'a i32) -> Foo<'a, 'b> {
    |                               ^^^^^^^^^^^ no implementation for `&i32 == Foo<'static, 'b>`
@@ -21,7 +21,7 @@ LL |     i
    = help: the trait `PartialEq` is implemented for `i32`
 
 error[E0277]: can't compare `&i32` with `Moo<'static, 'a>`
-  --> $DIR/self-referential-4.rs:17:31
+  --> $DIR/self-referential-4.rs:20:31
    |
 LL | fn moo<'a, 'b>(i: &'a i32) -> Moo<'a, 'b> {
    |                               ^^^^^^^^^^^ no implementation for `&i32 == Moo<'static, 'a>`
diff --git a/tests/ui/type-alias-impl-trait/self-referential.rs b/tests/ui/type-alias-impl-trait/self-referential.rs
index b899b12cc4a..a1d3b275b19 100644
--- a/tests/ui/type-alias-impl-trait/self-referential.rs
+++ b/tests/ui/type-alias-impl-trait/self-referential.rs
@@ -2,6 +2,7 @@
 
 type Bar<'a, 'b> = impl PartialEq<Bar<'b, 'a>> + std::fmt::Debug;
 
+#[define_opaque(Bar)]
 fn bar<'a, 'b>(i: &'a i32) -> Bar<'a, 'b> {
     //~^ ERROR can't compare `&i32` with `Bar<'b, 'a>`
     i
@@ -9,6 +10,7 @@ fn bar<'a, 'b>(i: &'a i32) -> Bar<'a, 'b> {
 
 type Foo<'a, 'b> = (i32, impl PartialEq<Foo<'a, 'b>> + std::fmt::Debug);
 
+#[define_opaque(Foo)]
 fn foo<'a, 'b>(i: &'a i32) -> Foo<'a, 'b> {
     //~^ ERROR can't compare `&i32` with `(i32, Foo<'a, 'b>::{opaque#0}<'a, 'b>)`
     (42, i)
@@ -16,6 +18,7 @@ fn foo<'a, 'b>(i: &'a i32) -> Foo<'a, 'b> {
 
 type Moo<'a, 'b> = (i32, impl PartialEq<Moo<'b, 'a>> + std::fmt::Debug);
 
+#[define_opaque(Moo)]
 fn moo<'a, 'b>(i: &'a i32) -> Moo<'a, 'b> {
     //~^ ERROR can't compare `&i32` with `(i32, Moo<'b, 'a>::{opaque#0}<'b, 'a>)`
     (42, i)
diff --git a/tests/ui/type-alias-impl-trait/self-referential.stderr b/tests/ui/type-alias-impl-trait/self-referential.stderr
index 57d67f69376..4bcf659e8e6 100644
--- a/tests/ui/type-alias-impl-trait/self-referential.stderr
+++ b/tests/ui/type-alias-impl-trait/self-referential.stderr
@@ -1,5 +1,5 @@
 error[E0277]: can't compare `&i32` with `Bar<'b, 'a>`
-  --> $DIR/self-referential.rs:5:31
+  --> $DIR/self-referential.rs:6:31
    |
 LL | fn bar<'a, 'b>(i: &'a i32) -> Bar<'a, 'b> {
    |                               ^^^^^^^^^^^ no implementation for `&i32 == Bar<'b, 'a>`
@@ -11,7 +11,7 @@ LL |     i
    = help: the trait `PartialEq` is implemented for `i32`
 
 error[E0277]: can't compare `&i32` with `(i32, Foo<'a, 'b>::{opaque#0}<'a, 'b>)`
-  --> $DIR/self-referential.rs:12:31
+  --> $DIR/self-referential.rs:14:31
    |
 LL | fn foo<'a, 'b>(i: &'a i32) -> Foo<'a, 'b> {
    |                               ^^^^^^^^^^^ no implementation for `&i32 == (i32, Foo<'a, 'b>::{opaque#0}<'a, 'b>)`
@@ -23,7 +23,7 @@ LL |     (42, i)
    = help: the trait `PartialEq` is implemented for `i32`
 
 error[E0277]: can't compare `&i32` with `(i32, Moo<'b, 'a>::{opaque#0}<'b, 'a>)`
-  --> $DIR/self-referential.rs:19:31
+  --> $DIR/self-referential.rs:22:31
    |
 LL | fn moo<'a, 'b>(i: &'a i32) -> Moo<'a, 'b> {
    |                               ^^^^^^^^^^^ no implementation for `&i32 == (i32, Moo<'b, 'a>::{opaque#0}<'b, 'a>)`
diff --git a/tests/ui/type-alias-impl-trait/self_implication.rs b/tests/ui/type-alias-impl-trait/self_implication.rs
index 56464af96ed..d7f70159571 100644
--- a/tests/ui/type-alias-impl-trait/self_implication.rs
+++ b/tests/ui/type-alias-impl-trait/self_implication.rs
@@ -20,11 +20,10 @@ struct Foo<'a> {
     x: &'a mut u8,
 }
 // desugared
-mod foo {
-    pub type FooX = impl Sized;
-    impl<'a> super::Foo<'a> {
-        pub fn foo(&self) -> FooX {}
-    }
+pub type FooX = impl Sized;
+impl<'a> Foo<'a> {
+    #[define_opaque(FooX)]
+    pub fn foo(&self) -> FooX {}
 }
 
 fn bar() {
diff --git a/tests/ui/type-alias-impl-trait/static-const-types.rs b/tests/ui/type-alias-impl-trait/static-const-types.rs
deleted file mode 100644
index dad515aaa7b..00000000000
--- a/tests/ui/type-alias-impl-trait/static-const-types.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-#![feature(type_alias_impl_trait)]
-#![allow(dead_code)]
-
-//@ check-pass
-
-use std::fmt::Debug;
-
-type Foo = impl Debug;
-
-static FOO1: Foo = 22_u32;
-const FOO2: Foo = 22_u32;
-
-fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/structural-match-no-leak.rs b/tests/ui/type-alias-impl-trait/structural-match-no-leak.rs
index 27f5799c380..a20ae814908 100644
--- a/tests/ui/type-alias-impl-trait/structural-match-no-leak.rs
+++ b/tests/ui/type-alias-impl-trait/structural-match-no-leak.rs
@@ -1,15 +1,15 @@
 #![feature(type_alias_impl_trait)]
 
-mod bar {
-    pub type Bar = impl Send;
+pub type Bar = impl Send;
 
-    // While i32 is structural-match, we do not want to leak this information.
-    // (See https://github.com/rust-lang/rust/issues/72156)
-    pub const fn leak_free() -> Bar {
-        7i32
-    }
+// While i32 is structural-match, we do not want to leak this information.
+// (See https://github.com/rust-lang/rust/issues/72156)
+#[define_opaque(Bar)]
+pub const fn leak_free() -> Bar {
+    7i32
 }
-const LEAK_FREE: bar::Bar = bar::leak_free();
+
+const LEAK_FREE: Bar = leak_free();
 
 fn leak_free_test() {
     match LEAK_FREE {
diff --git a/tests/ui/type-alias-impl-trait/structural-match-no-leak.stderr b/tests/ui/type-alias-impl-trait/structural-match-no-leak.stderr
index 28f5d6728a9..5067d78d169 100644
--- a/tests/ui/type-alias-impl-trait/structural-match-no-leak.stderr
+++ b/tests/ui/type-alias-impl-trait/structural-match-no-leak.stderr
@@ -1,8 +1,8 @@
 error: opaque type `Bar` cannot be used in patterns
   --> $DIR/structural-match-no-leak.rs:16:9
    |
-LL | const LEAK_FREE: bar::Bar = bar::leak_free();
-   | ------------------------- constant defined here
+LL | const LEAK_FREE: Bar = leak_free();
+   | -------------------- constant defined here
 ...
 LL |         LEAK_FREE => (),
    |         ^^^^^^^^^ opaque type can't be used in patterns
diff --git a/tests/ui/type-alias-impl-trait/structural-match.rs b/tests/ui/type-alias-impl-trait/structural-match.rs
index 50259591539..68a95560a46 100644
--- a/tests/ui/type-alias-impl-trait/structural-match.rs
+++ b/tests/ui/type-alias-impl-trait/structural-match.rs
@@ -1,22 +1,21 @@
 #![feature(type_alias_impl_trait)]
 
-mod foo {
-    pub type Foo = impl Send;
+pub type Foo = impl Send;
 
-    // This is not structural-match
-    struct A;
+// This is not structural-match
+struct A;
 
-    pub const fn value() -> Foo {
-        A
-    }
+#[define_opaque(Foo)]
+pub const fn value() -> Foo {
+    A
 }
-use foo::*;
+
 const VALUE: Foo = value();
 
 fn test() {
     match VALUE {
         VALUE => (),
-        //~^ `foo::Foo` cannot be used in patterns
+        //~^ `Foo` cannot be used in patterns
         _ => (),
     }
 }
diff --git a/tests/ui/type-alias-impl-trait/structural-match.stderr b/tests/ui/type-alias-impl-trait/structural-match.stderr
index b06b31a060f..a86b7f42ead 100644
--- a/tests/ui/type-alias-impl-trait/structural-match.stderr
+++ b/tests/ui/type-alias-impl-trait/structural-match.stderr
@@ -1,5 +1,5 @@
-error: opaque type `foo::Foo` cannot be used in patterns
-  --> $DIR/structural-match.rs:18:9
+error: opaque type `Foo` cannot be used in patterns
+  --> $DIR/structural-match.rs:17:9
    |
 LL | const VALUE: Foo = value();
    | ---------------- constant defined here
diff --git a/tests/ui/type-alias-impl-trait/taint.rs b/tests/ui/type-alias-impl-trait/taint.rs
index dfb947637c0..3d67c9bca41 100644
--- a/tests/ui/type-alias-impl-trait/taint.rs
+++ b/tests/ui/type-alias-impl-trait/taint.rs
@@ -9,6 +9,7 @@ fn set(x: &mut isize) -> isize {
     *x
 }
 
+#[define_opaque(Two)]
 fn d(x: Two) {
     let c1 = || set(x); //~ ERROR: expected generic lifetime parameter, found `'_`
     c1;
diff --git a/tests/ui/type-alias-impl-trait/taint.stderr b/tests/ui/type-alias-impl-trait/taint.stderr
index 17fcd4b7e93..e2e34a5d1ba 100644
--- a/tests/ui/type-alias-impl-trait/taint.stderr
+++ b/tests/ui/type-alias-impl-trait/taint.stderr
@@ -1,5 +1,5 @@
 error[E0792]: expected generic lifetime parameter, found `'_`
-  --> $DIR/taint.rs:13:17
+  --> $DIR/taint.rs:14:17
    |
 LL | type Two<'a, 'b> = impl std::fmt::Debug;
    |          -- this generic parameter must be used with a generic lifetime parameter
diff --git a/tests/ui/type-alias-impl-trait/tait-in-function-return-type-issue-101903-fixed.rs b/tests/ui/type-alias-impl-trait/tait-in-function-return-type-issue-101903-fixed.rs
index 109a70c766d..ab33e9e794e 100644
--- a/tests/ui/type-alias-impl-trait/tait-in-function-return-type-issue-101903-fixed.rs
+++ b/tests/ui/type-alias-impl-trait/tait-in-function-return-type-issue-101903-fixed.rs
@@ -19,6 +19,7 @@ type Sendable = impl Send + Duh;
 
 type Foo = impl Trait<Assoc = Sendable>;
 
+#[define_opaque(Foo)]
 fn foo() -> Foo {
     || 42
 }
diff --git a/tests/ui/type-alias-impl-trait/tait-param-inference-issue-117310.rs b/tests/ui/type-alias-impl-trait/tait-param-inference-issue-117310.rs
index be743e8e270..488c581247d 100644
--- a/tests/ui/type-alias-impl-trait/tait-param-inference-issue-117310.rs
+++ b/tests/ui/type-alias-impl-trait/tait-param-inference-issue-117310.rs
@@ -10,9 +10,11 @@ impl<A, B> Trait for (A, B, u8) where A: Deref, B: Deref<Target = A::Target>, {}
 impl<A, B> Trait for (A, B, i8) {}
 
 type TaitSized = impl Sized;
+#[define_opaque(TaitSized)]
 fn def_tait1() -> TaitSized {}
 
 type TaitCopy = impl Copy;
+#[define_opaque(TaitCopy)]
 fn def_tait2() -> TaitCopy {}
 
 fn impl_trait<T: Trait> () {}
diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-assoc-dyn.rs b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-assoc-dyn.rs
index 66a6c0a35b5..af787d66cc1 100644
--- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-assoc-dyn.rs
+++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-assoc-dyn.rs
@@ -5,6 +5,7 @@
 
 type Foo = Box<dyn Iterator<Item = impl Send>>;
 
+#[define_opaque(Foo)]
 fn make_foo() -> Foo {
     Box::new(vec![1, 2, 3].into_iter())
 }
diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-assoc-impl-trait.rs b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-assoc-impl-trait.rs
index e46d2bd559c..921dc17593d 100644
--- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-assoc-impl-trait.rs
+++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-assoc-impl-trait.rs
@@ -5,6 +5,7 @@
 
 type Foo = impl Iterator<Item = impl Send>;
 
+#[define_opaque(Foo)]
 fn make_foo() -> Foo {
     vec![1, 2].into_iter()
 }
@@ -12,6 +13,7 @@ fn make_foo() -> Foo {
 type Bar = impl Send;
 type Baz = impl Iterator<Item = Bar>;
 
+#[define_opaque(Baz)]
 fn make_baz() -> Baz {
     vec!["1", "2"].into_iter()
 }
diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-const.rs b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-const.rs
index 6b37552fed1..e21627e14b0 100644
--- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-const.rs
+++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-const.rs
@@ -1,11 +1,15 @@
-#![feature(type_alias_impl_trait)]
 //@ check-pass
-// Ensures that `const` items can constrain an opaque `impl Trait`.
+
+#![feature(type_alias_impl_trait)]
 
 use std::fmt::Debug;
 
 pub type Foo = impl Debug;
 
+#[define_opaque(Foo)]
 const _FOO: Foo = 5;
 
+#[define_opaque(Foo)]
+static _BAR: Foo = 22_i32;
+
 fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fns.rs b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fns.rs
index cbd91066c49..95d52e1ff96 100644
--- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fns.rs
+++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fns.rs
@@ -11,12 +11,14 @@ struct MyStruct {
 
 impl MyTrait for MyStruct {}
 
+#[define_opaque(TE)]
 fn bla() -> TE {
     return MyStruct { v: 1 };
 }
 
+#[define_opaque(TE)]
 fn bla2() -> TE {
-    //~^ ERROR: item does not constrain `TE::{opaque#0}`, but has it in its signature
+    //~^ ERROR: item does not constrain `TE::{opaque#0}`
     bla()
 }
 
diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fns.stderr b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fns.stderr
index 819bde02183..12aa94386dc 100644
--- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fns.stderr
+++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fns.stderr
@@ -1,12 +1,12 @@
-error: item does not constrain `TE::{opaque#0}`, but has it in its signature
-  --> $DIR/type-alias-impl-trait-fns.rs:18:4
+error: item does not constrain `TE::{opaque#0}`
+  --> $DIR/type-alias-impl-trait-fns.rs:20:4
    |
 LL | fn bla2() -> TE {
    |    ^^^^
    |
-   = note: consider moving the opaque type's declaration and defining uses into a separate module
-note: this opaque type is in the signature
-  --> $DIR/type-alias-impl-trait-fns.rs:23:11
+   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
+note: this opaque type is supposed to be constrained
+  --> $DIR/type-alias-impl-trait-fns.rs:25:11
    |
 LL | type TE = impl MyTrait;
    |           ^^^^^^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-sized.rs b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-sized.rs
index 188b23732f9..929dec39b2f 100644
--- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-sized.rs
+++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-sized.rs
@@ -3,21 +3,25 @@
 #![feature(type_alias_impl_trait)]
 
 type A = impl Sized;
+#[define_opaque(A)]
 fn f1() -> A {
     0
 }
 
 type B = impl ?Sized;
+#[define_opaque(B)]
 fn f2() -> &'static B {
     &[0]
 }
 
 type C = impl ?Sized + 'static;
+#[define_opaque(C)]
 fn f3() -> &'static C {
     &[0]
 }
 
 type D = impl ?Sized;
+#[define_opaque(D)]
 fn f4() -> &'static D {
     &1
 }
diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-struct.rs b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-struct.rs
index 1340a4214ee..3fcb40df832 100644
--- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-struct.rs
+++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-struct.rs
@@ -5,6 +5,7 @@
 
 type Foo = Vec<impl Send>;
 
+#[define_opaque(Foo)]
 fn make_foo() -> Foo {
     vec![true, false]
 }
diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-tuple.rs b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-tuple.rs
index 8e90f969953..32b39c8823d 100644
--- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-tuple.rs
+++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-tuple.rs
@@ -6,20 +6,17 @@
 #![feature(type_alias_impl_trait)]
 #![allow(dead_code)]
 
-mod foo {
-    pub trait MyTrait {}
+pub trait MyTrait {}
 
-    impl MyTrait for bool {}
+impl MyTrait for bool {}
 
-    pub type Foo = impl MyTrait;
+pub type Foo = impl MyTrait;
 
-    pub fn make_foo() -> Foo {
-        true
-    }
+#[define_opaque(Foo)]
+pub fn make_foo() -> Foo {
+    true
 }
 
-use foo::*;
-
 struct Blah {
     my_foo: Foo,
     my_u8: u8,
diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-1.stderr b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-1.stderr
index ee8922b673e..ad96a0eeb87 100644
--- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-1.stderr
+++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-1.stderr
@@ -1,9 +1,10 @@
-error[E0275]: overflow evaluating the requirement `<Foo as FnOnce<()>>::Output == Foo`
-  --> $DIR/type-alias-impl-trait-with-cycle-error-1.rs:6:21
+error: unconstrained opaque type
+  --> $DIR/type-alias-impl-trait-with-cycle-error-1.rs:4:12
    |
-LL | fn crash(x: Foo) -> Foo {
-   |                     ^^^
+LL | type Foo = impl Fn() -> Foo;
+   |            ^^^^^^^^^^^^^^^^
+   |
+   = note: `Foo` must be used in combination with a concrete type within the same crate
 
 error: aborting due to 1 previous error
 
-For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-2.stderr b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-2.stderr
index 3d0f1d30ca2..e5bb8163a81 100644
--- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-2.stderr
+++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-2.stderr
@@ -1,9 +1,10 @@
-error[E0275]: overflow evaluating the requirement `<Foo as Bar<Foo>>::Item == Foo`
-  --> $DIR/type-alias-impl-trait-with-cycle-error-2.rs:10:21
+error: unconstrained opaque type
+  --> $DIR/type-alias-impl-trait-with-cycle-error-2.rs:8:12
    |
-LL | fn crash(x: Foo) -> Foo {
-   |                     ^^^
+LL | type Foo = impl Bar<Foo, Item = Foo>;
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `Foo` must be used in combination with a concrete type within the same crate
 
 error: aborting due to 1 previous error
 
-For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-3.stderr b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-3.stderr
index 675689bac42..157310bf623 100644
--- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-3.stderr
+++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-3.stderr
@@ -1,9 +1,10 @@
-error[E0275]: overflow evaluating the requirement `<Foo<'_> as FnOnce<()>>::Output == Foo<'a>`
-  --> $DIR/type-alias-impl-trait-with-cycle-error-3.rs:6:40
+error: unconstrained opaque type
+  --> $DIR/type-alias-impl-trait-with-cycle-error-3.rs:4:16
    |
-LL | fn crash<'a>(_: &'a (), x: Foo<'a>) -> Foo<'a> {
-   |                                        ^^^^^^^
+LL | type Foo<'a> = impl Fn() -> Foo<'a>;
+   |                ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `Foo` must be used in combination with a concrete type within the same crate
 
 error: aborting due to 1 previous error
 
-For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-no-traits.rs b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-no-traits.rs
index 8ca279eec92..115df16bd3e 100644
--- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-no-traits.rs
+++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-no-traits.rs
@@ -3,6 +3,7 @@
 type Foo = impl 'static;
 //~^ ERROR: at least one trait must be specified
 
+#[define_opaque(Foo)]
 fn foo() -> Foo {
     "foo"
 }
diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-no-traits.stderr b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-no-traits.stderr
index 3f7acd33830..da8fc595f6a 100644
--- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-no-traits.stderr
+++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-no-traits.stderr
@@ -5,7 +5,7 @@ LL | type Foo = impl 'static;
    |            ^^^^^^^^^^^^
 
 error: at least one trait must be specified
-  --> $DIR/type-alias-impl-trait-with-no-traits.rs:10:13
+  --> $DIR/type-alias-impl-trait-with-no-traits.rs:11:13
    |
 LL | fn bar() -> impl 'static {
    |             ^^^^^^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait.rs b/tests/ui/type-alias-impl-trait/type-alias-impl-trait.rs
index 0fe653ac471..ff11fb4fcaf 100644
--- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait.rs
+++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait.rs
@@ -17,6 +17,7 @@ fn main() {
 // single definition
 type Foo = impl std::fmt::Display;
 
+#[define_opaque(Foo)]
 fn foo() -> Foo {
     "foo"
 }
@@ -24,30 +25,36 @@ fn foo() -> Foo {
 // two definitions
 type Bar = impl std::fmt::Display;
 
+#[define_opaque(Bar)]
 fn bar1() -> Bar {
     "bar1"
 }
 
+#[define_opaque(Bar)]
 fn bar2() -> Bar {
     "bar2"
 }
 
 type MyIter<T> = impl Iterator<Item = T>;
 
+#[define_opaque(MyIter)]
 fn my_iter<T>(t: T) -> MyIter<T> {
     std::iter::once(t)
 }
 
+#[define_opaque(MyIter)]
 fn my_iter2<T>(t: T) -> MyIter<T> {
     std::iter::once(t)
 }
 
 // param names should not have an effect!
+#[define_opaque(MyIter)]
 fn my_iter3<U>(u: U) -> MyIter<U> {
     std::iter::once(u)
 }
 
 // param position should not have an effect!
+#[define_opaque(MyIter)]
 fn my_iter4<U, V>(_: U, v: V) -> MyIter<V> {
     std::iter::once(v)
 }
@@ -55,6 +62,7 @@ fn my_iter4<U, V>(_: U, v: V) -> MyIter<V> {
 // param names should not have an effect!
 type MyOtherIter<T> = impl Iterator<Item = T>;
 
+#[define_opaque(MyOtherIter)]
 fn my_other_iter<U>(u: U) -> MyOtherIter<U> {
     std::iter::once(u)
 }
@@ -62,18 +70,18 @@ fn my_other_iter<U>(u: U) -> MyOtherIter<U> {
 trait Trait {}
 type GenericBound<'a, T: Trait + 'a> = impl Sized + 'a;
 
+#[define_opaque(GenericBound)]
 fn generic_bound<'a, T: Trait + 'a>(t: T) -> GenericBound<'a, T> {
     t
 }
 
-mod pass_through {
-    pub type Passthrough<T: 'static> = impl Sized + 'static;
+pub type Passthrough<T: 'static> = impl Sized + 'static;
 
-    fn define_passthrough<T: 'static>(t: T) -> Passthrough<T> {
-        t
-    }
+#[define_opaque(Passthrough)]
+fn define_passthrough<T: 'static>(t: T) -> Passthrough<T> {
+    t
 }
 
-fn use_passthrough(x: pass_through::Passthrough<u32>) -> pass_through::Passthrough<u32> {
+fn use_passthrough(x: Passthrough<u32>) -> Passthrough<u32> {
     x
 }
diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait2.rs b/tests/ui/type-alias-impl-trait/type-alias-impl-trait2.rs
index 65e2feaf795..e87fda8159b 100644
--- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait2.rs
+++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait2.rs
@@ -14,71 +14,74 @@ fn main() {
     assert_eq!(my_iter(42u8).collect::<Vec<u8>>(), vec![42u8]);
 }
 
-use defining_use_scope::*;
+// single definition
+pub type Foo = impl std::fmt::Display;
 
-mod defining_use_scope {
-    // single definition
-    pub type Foo = impl std::fmt::Display;
-
-    pub fn foo() -> Foo {
-        "foo"
-    }
-
-    // two definitions
-    pub type Bar = impl std::fmt::Display;
+#[define_opaque(Foo)]
+pub fn foo() -> Foo {
+    "foo"
+}
 
-    pub fn bar1() -> Bar {
-        "bar1"
-    }
+// two definitions
+pub type Bar = impl std::fmt::Display;
 
-    pub fn bar2() -> Bar {
-        "bar2"
-    }
+#[define_opaque(Bar)]
+pub fn bar1() -> Bar {
+    "bar1"
+}
 
-    pub type MyIter<T> = impl Iterator<Item = T>;
+#[define_opaque(Bar)]
+pub fn bar2() -> Bar {
+    "bar2"
+}
 
-    pub fn my_iter<T>(t: T) -> MyIter<T> {
-        std::iter::once(t)
-    }
+pub type MyIter<T> = impl Iterator<Item = T>;
 
-    fn my_iter2<T>(t: T) -> MyIter<T> {
-        std::iter::once(t)
-    }
+#[define_opaque(MyIter)]
+pub fn my_iter<T>(t: T) -> MyIter<T> {
+    std::iter::once(t)
+}
 
-    // param names should not have an effect!
-    fn my_iter3<U>(u: U) -> MyIter<U> {
-        std::iter::once(u)
-    }
+#[define_opaque(MyIter)]
+fn my_iter2<T>(t: T) -> MyIter<T> {
+    std::iter::once(t)
+}
 
-    // param position should not have an effect!
-    fn my_iter4<U, V>(_: U, v: V) -> MyIter<V> {
-        std::iter::once(v)
-    }
+// param names should not have an effect!
+#[define_opaque(MyIter)]
+fn my_iter3<U>(u: U) -> MyIter<U> {
+    std::iter::once(u)
+}
 
-    // param names should not have an effect!
-    type MyOtherIter<T> = impl Iterator<Item = T>;
+// param position should not have an effect!
+#[define_opaque(MyIter)]
+fn my_iter4<U, V>(_: U, v: V) -> MyIter<V> {
+    std::iter::once(v)
+}
 
-    fn my_other_iter<U>(u: U) -> MyOtherIter<U> {
-        std::iter::once(u)
-    }
+// param names should not have an effect!
+type MyOtherIter<T> = impl Iterator<Item = T>;
 
-    trait Trait {}
-    type GenericBound<'a, T: Trait + 'a> = impl Sized + 'a;
+#[define_opaque(MyOtherIter)]
+fn my_other_iter<U>(u: U) -> MyOtherIter<U> {
+    std::iter::once(u)
+}
 
-    fn generic_bound<'a, T: Trait + 'a>(t: T) -> GenericBound<'a, T> {
-        t
-    }
+trait Trait {}
+type GenericBound<'a, T: Trait + 'a> = impl Sized + 'a;
 
-    mod pass_through {
-        pub type Passthrough<T: 'static> = impl Sized + 'static;
+#[define_opaque(GenericBound)]
+fn generic_bound<'a, T: Trait + 'a>(t: T) -> GenericBound<'a, T> {
+    t
+}
 
-        fn define_passthrough<T: 'static>(t: T) -> Passthrough<T> {
-            t
-        }
-    }
+pub type Passthrough<T: 'static> = impl Sized + 'static;
 
-    fn use_passthrough(x: pass_through::Passthrough<u32>) -> pass_through::Passthrough<u32> {
-        x
-    }
+#[define_opaque(Passthrough)]
+fn define_passthrough<T: 'static>(t: T) -> Passthrough<T> {
+    t
+}
 
+fn use_passthrough(x: Passthrough<u32>) -> Passthrough<u32> {
+    x
 }
diff --git a/tests/ui/type-alias-impl-trait/type-alias-nested-impl-trait.rs b/tests/ui/type-alias-impl-trait/type-alias-nested-impl-trait.rs
index af575a4ff36..20209c7b28c 100644
--- a/tests/ui/type-alias-impl-trait/type-alias-nested-impl-trait.rs
+++ b/tests/ui/type-alias-impl-trait/type-alias-nested-impl-trait.rs
@@ -2,9 +2,10 @@
 
 #![feature(type_alias_impl_trait)]
 
-use std::iter::{once, Chain};
+use std::iter::{Chain, once};
 
 type I<A> = Chain<A, impl Iterator<Item = &'static str>>;
+#[define_opaque(I)]
 fn test2<A: Iterator<Item = &'static str>>(x: A) -> I<A> {
     x.chain(once("5"))
 }
diff --git a/tests/ui/type-alias-impl-trait/type_of_a_let.current.stderr b/tests/ui/type-alias-impl-trait/type_of_a_let.current.stderr
index 7cf2fe42da8..d4a2c23f7a7 100644
--- a/tests/ui/type-alias-impl-trait/type_of_a_let.current.stderr
+++ b/tests/ui/type-alias-impl-trait/type_of_a_let.current.stderr
@@ -1,5 +1,5 @@
 error[E0382]: use of moved value: `x`
-  --> $DIR/type_of_a_let.rs:21:16
+  --> $DIR/type_of_a_let.rs:23:16
    |
 LL |     let x: Foo = 22_u32;
    |         - move occurs because `x` has type `Foo`, which does not implement the `Copy` trait
@@ -9,7 +9,7 @@ LL |     same_type((x, y));
    |                ^ value used here after move
 
 error[E0382]: use of moved value: `y`
-  --> $DIR/type_of_a_let.rs:22:6
+  --> $DIR/type_of_a_let.rs:24:6
    |
 LL |     let y: Foo = x;
    |         - move occurs because `y` has type `Foo`, which does not implement the `Copy` trait
diff --git a/tests/ui/type-alias-impl-trait/type_of_a_let.rs b/tests/ui/type-alias-impl-trait/type_of_a_let.rs
index cc8caf886cf..9479b1084df 100644
--- a/tests/ui/type-alias-impl-trait/type_of_a_let.rs
+++ b/tests/ui/type-alias-impl-trait/type_of_a_let.rs
@@ -10,11 +10,13 @@ use std::fmt::Debug;
 
 type Foo = impl Debug;
 
+#[define_opaque(Foo)]
 fn foo1() -> (u32, Foo) {
     let x: Foo = 22_u32;
     (x, todo!())
 }
 
+#[define_opaque(Foo)]
 fn foo2() -> (u32, Foo) {
     let x: Foo = 22_u32;
     let y: Foo = x;
diff --git a/tests/ui/type-alias-impl-trait/unbounded_opaque_type.rs b/tests/ui/type-alias-impl-trait/unbounded_opaque_type.rs
index 09ff006acbd..063c4deaf06 100644
--- a/tests/ui/type-alias-impl-trait/unbounded_opaque_type.rs
+++ b/tests/ui/type-alias-impl-trait/unbounded_opaque_type.rs
@@ -2,12 +2,9 @@
 
 #![feature(type_alias_impl_trait)]
 
-mod opaque {
-    pub type Opaque<T> = impl Sized;
-    fn defining<T>() -> Opaque<T> {}
-}
-
-use opaque::Opaque;
+pub type Opaque<T> = impl Sized;
+#[define_opaque(Opaque)]
+fn defining<T>() -> Opaque<T> {}
 
 struct Ss<'a, T>(&'a Opaque<T>);
 
diff --git a/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.rs b/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.rs
index ae3d317ab46..3f4d9d244ec 100644
--- a/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.rs
+++ b/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.rs
@@ -3,6 +3,7 @@
 type Tait = impl Copy;
 // Make sure that this TAIT isn't considered unconstrained...
 
+#[define_opaque(Tait)]
 fn empty_opaque() -> Tait {
     if false {
         match empty_opaque() {}
diff --git a/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.stderr b/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.stderr
index 5c9a4688105..549e3bc8dc1 100644
--- a/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.stderr
+++ b/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.stderr
@@ -1,5 +1,5 @@
 error[E0004]: non-exhaustive patterns: type `Tait` is non-empty
-  --> $DIR/unconstrained-due-to-bad-pattern.rs:8:15
+  --> $DIR/unconstrained-due-to-bad-pattern.rs:9:15
    |
 LL |         match empty_opaque() {}
    |               ^^^^^^^^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/unconstrained-impl-param.rs b/tests/ui/type-alias-impl-trait/unconstrained-impl-param.rs
index b3510067047..415021a1808 100644
--- a/tests/ui/type-alias-impl-trait/unconstrained-impl-param.rs
+++ b/tests/ui/type-alias-impl-trait/unconstrained-impl-param.rs
@@ -3,6 +3,7 @@
 use std::fmt::Display;
 
 type Opaque<X> = impl Sized + 'static;
+#[define_opaque(Opaque)]
 fn define<X>() -> Opaque<X> {}
 
 trait Trait {
diff --git a/tests/ui/type-alias-impl-trait/unconstrained-impl-param.stderr b/tests/ui/type-alias-impl-trait/unconstrained-impl-param.stderr
index 6206f169c5b..7a86685787c 100644
--- a/tests/ui/type-alias-impl-trait/unconstrained-impl-param.stderr
+++ b/tests/ui/type-alias-impl-trait/unconstrained-impl-param.stderr
@@ -1,5 +1,5 @@
 error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
-  --> $DIR/unconstrained-impl-param.rs:11:6
+  --> $DIR/unconstrained-impl-param.rs:12:6
    |
 LL | impl<'a> Trait for Opaque<&'a str> {
    |      ^^ unconstrained lifetime parameter
diff --git a/tests/ui/type-alias-impl-trait/under-binder.rs b/tests/ui/type-alias-impl-trait/under-binder.rs
index caf21d64027..bf8635b7d81 100644
--- a/tests/ui/type-alias-impl-trait/under-binder.rs
+++ b/tests/ui/type-alias-impl-trait/under-binder.rs
@@ -2,6 +2,7 @@
 
 type Opaque<'a> = impl Sized + 'a;
 
+#[define_opaque(Opaque)]
 fn test(f: fn(u8)) -> fn(Opaque<'_>) {
     f //~ ERROR E0792
 }
diff --git a/tests/ui/type-alias-impl-trait/under-binder.stderr b/tests/ui/type-alias-impl-trait/under-binder.stderr
index f4a121ce440..0589f9ae11c 100644
--- a/tests/ui/type-alias-impl-trait/under-binder.stderr
+++ b/tests/ui/type-alias-impl-trait/under-binder.stderr
@@ -1,5 +1,5 @@
 error[E0792]: expected generic lifetime parameter, found `'_`
-  --> $DIR/under-binder.rs:6:5
+  --> $DIR/under-binder.rs:7:5
    |
 LL | type Opaque<'a> = impl Sized + 'a;
    |             -- this generic parameter must be used with a generic lifetime parameter
diff --git a/tests/ui/type-alias-impl-trait/underconstrained_generic.rs b/tests/ui/type-alias-impl-trait/underconstrained_generic.rs
index aa537dfc917..dc2d37b9d05 100644
--- a/tests/ui/type-alias-impl-trait/underconstrained_generic.rs
+++ b/tests/ui/type-alias-impl-trait/underconstrained_generic.rs
@@ -18,11 +18,10 @@ impl<X: Trait> ProofForConversion<X> for () {
 
 type Converter<T> = impl ProofForConversion<T>;
 
+#[define_opaque(Converter)]
 fn _defining_use<T: Trait>() -> Converter<T> {
     ()
     //~^ ERROR the trait bound `T: Trait` is not satisfied
 }
 
-
-fn main() {
-}
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr b/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr
index e50949ed8f3..e05c3094d53 100644
--- a/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr
+++ b/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr
@@ -1,5 +1,5 @@
 error[E0277]: the trait bound `T: Trait` is not satisfied
-  --> $DIR/underconstrained_generic.rs:22:5
+  --> $DIR/underconstrained_generic.rs:23:5
    |
 LL |     ()
    |     ^^ the trait `Trait` is not implemented for `T`
@@ -17,7 +17,7 @@ note: required by a bound in an opaque type
 LL | type Converter<T> = impl ProofForConversion<T>;
    |                          ^^^^^^^^^^^^^^^^^^^^^
 note: this definition site has more where clauses than the opaque type
-  --> $DIR/underconstrained_generic.rs:21:1
+  --> $DIR/underconstrained_generic.rs:22:1
    |
 LL | fn _defining_use<T: Trait>() -> Converter<T> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/underconstrained_lifetime.rs b/tests/ui/type-alias-impl-trait/underconstrained_lifetime.rs
index e8e7dd0ea08..f4611f33d23 100644
--- a/tests/ui/type-alias-impl-trait/underconstrained_lifetime.rs
+++ b/tests/ui/type-alias-impl-trait/underconstrained_lifetime.rs
@@ -15,6 +15,7 @@ impl<'a, 'b> ProofForConversion<'a, 'b> for &'b &'a () {
 type Converter<'a, 'b> = impl ProofForConversion<'a, 'b>;
 
 // Even _defining_use with an explicit `'a: 'b` compiles fine, too.
+#[define_opaque(Converter)]
 fn _defining_use<'a, 'b>(x: &'b &'a ()) -> Converter<'a, 'b> {
     x
     //~^ ERROR reference has a longer lifetime than the data it references
diff --git a/tests/ui/type-alias-impl-trait/underconstrained_lifetime.stderr b/tests/ui/type-alias-impl-trait/underconstrained_lifetime.stderr
index 7c07578d887..6a1f2b49397 100644
--- a/tests/ui/type-alias-impl-trait/underconstrained_lifetime.stderr
+++ b/tests/ui/type-alias-impl-trait/underconstrained_lifetime.stderr
@@ -1,5 +1,5 @@
 error[E0491]: in type `&'b &'a ()`, reference has a longer lifetime than the data it references
-  --> $DIR/underconstrained_lifetime.rs:19:5
+  --> $DIR/underconstrained_lifetime.rs:20:5
    |
 LL |     x
    |     ^
diff --git a/tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.rs b/tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.rs
index 56d975355c3..2dab81cba6f 100644
--- a/tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.rs
+++ b/tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.rs
@@ -5,6 +5,7 @@ mod foo {
     pub trait T {}
 
     pub type Alias<'a> = impl T;
+    //~^ ERROR: unconstrained opaque type
     fn bar() {
         super::with_positive(|&n| ());
         //~^ ERROR mismatched types
diff --git a/tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.stderr b/tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.stderr
index 279bd3bca5a..b58eae67120 100644
--- a/tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.stderr
+++ b/tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.stderr
@@ -1,9 +1,17 @@
+error: unconstrained opaque type
+  --> $DIR/underef-index-out-of-bounds-121472.rs:7:26
+   |
+LL |     pub type Alias<'a> = impl T;
+   |                          ^^^^^^
+   |
+   = note: `Alias` must be used in combination with a concrete type within the same crate
+
 error[E0308]: mismatched types
-  --> $DIR/underef-index-out-of-bounds-121472.rs:9:31
+  --> $DIR/underef-index-out-of-bounds-121472.rs:10:31
    |
 LL |     pub type Alias<'a> = impl T;
    |                          ------ the expected opaque type
-LL |     fn bar() {
+...
 LL |         super::with_positive(|&n| ());
    |                               ^^
    |                               |
@@ -18,6 +26,6 @@ LL -         super::with_positive(|&n| ());
 LL +         super::with_positive(|n| ());
    |
 
-error: aborting due to 1 previous error
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/type-alias-impl-trait/unnameable_type.rs b/tests/ui/type-alias-impl-trait/unnameable_type.rs
index 5813f529dea..0b97cc2941f 100644
--- a/tests/ui/type-alias-impl-trait/unnameable_type.rs
+++ b/tests/ui/type-alias-impl-trait/unnameable_type.rs
@@ -16,6 +16,7 @@ use private::Trait;
 // downstream
 type MyPrivate = impl Sized;
 impl Trait for u32 {
+    #[define_opaque(MyPrivate)]
     fn dont_define_this(private: MyPrivate) {
         //~^ ERROR: incompatible type for trait
         let _: () = private;
diff --git a/tests/ui/type-alias-impl-trait/unnameable_type.stderr b/tests/ui/type-alias-impl-trait/unnameable_type.stderr
index 25dc41df419..6e4e024ce69 100644
--- a/tests/ui/type-alias-impl-trait/unnameable_type.stderr
+++ b/tests/ui/type-alias-impl-trait/unnameable_type.stderr
@@ -1,9 +1,9 @@
 error[E0053]: method `dont_define_this` has an incompatible type for trait
-  --> $DIR/unnameable_type.rs:19:34
+  --> $DIR/unnameable_type.rs:20:34
    |
 LL | type MyPrivate = impl Sized;
    |                  ---------- the found opaque type
-LL | impl Trait for u32 {
+...
 LL |     fn dont_define_this(private: MyPrivate) {
    |                                  ^^^^^^^^^ expected `Private`, found opaque type
    |
diff --git a/tests/ui/type-alias-impl-trait/unused_generic_param.rs b/tests/ui/type-alias-impl-trait/unused_generic_param.rs
index b675bc2e622..556e70d1c96 100644
--- a/tests/ui/type-alias-impl-trait/unused_generic_param.rs
+++ b/tests/ui/type-alias-impl-trait/unused_generic_param.rs
@@ -7,16 +7,19 @@ fn main() {}
 
 type PartiallyDefined<T> = impl Sized;
 
+#[define_opaque(PartiallyDefined)]
 fn partially_defined<T: std::fmt::Debug>(_: T) -> PartiallyDefined<T> {
     4u32
 }
 
 type PartiallyDefined2<T> = impl Sized;
 
+#[define_opaque(PartiallyDefined2)]
 fn partially_defined2<T: std::fmt::Debug>(_: T) -> PartiallyDefined2<T> {
     4u32
 }
 
+#[define_opaque(PartiallyDefined2)]
 fn partially_defined22<T>(_: T) -> PartiallyDefined2<T> {
     4u32
 }
diff --git a/tests/ui/type-alias-impl-trait/variance.rs b/tests/ui/type-alias-impl-trait/variance.rs
index 40e8ec0129a..ecd7158223c 100644
--- a/tests/ui/type-alias-impl-trait/variance.rs
+++ b/tests/ui/type-alias-impl-trait/variance.rs
@@ -72,6 +72,7 @@ type NestedDeeply<'a> =
             >,
         >,
     >;
+#[define_opaque(NestedDeeply)]
 fn test<'a>() -> NestedDeeply<'a> {
     &()
 }
diff --git a/tests/ui/type-alias-impl-trait/variance.stderr b/tests/ui/type-alias-impl-trait/variance.stderr
index 79ce8148f19..138e4080c29 100644
--- a/tests/ui/type-alias-impl-trait/variance.stderr
+++ b/tests/ui/type-alias-impl-trait/variance.stderr
@@ -28,7 +28,7 @@ error: unconstrained opaque type
 LL | type NotCapturedEarly<'a> = impl Sized;
    |                             ^^^^^^^^^^
    |
-   = note: `NotCapturedEarly` must be used in combination with a concrete type within the same module
+   = note: `NotCapturedEarly` must be used in combination with a concrete type within the same crate
 
 error: unconstrained opaque type
   --> $DIR/variance.rs:11:26
@@ -36,7 +36,7 @@ error: unconstrained opaque type
 LL | type CapturedEarly<'a> = impl Sized + Captures<'a>;
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: `CapturedEarly` must be used in combination with a concrete type within the same module
+   = note: `CapturedEarly` must be used in combination with a concrete type within the same crate
 
 error: unconstrained opaque type
   --> $DIR/variance.rs:14:56
@@ -44,7 +44,7 @@ error: unconstrained opaque type
 LL | type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>;
    |                                                        ^^^^^^^^^^
    |
-   = note: `NotCapturedLate` must be used in combination with a concrete type within the same module
+   = note: `NotCapturedLate` must be used in combination with a concrete type within the same crate
 
 error: unconstrained opaque type
   --> $DIR/variance.rs:18:49
@@ -52,7 +52,7 @@ error: unconstrained opaque type
 LL | type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>;
    |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: `Captured` must be used in combination with a concrete type within the same module
+   = note: `Captured` must be used in combination with a concrete type within the same crate
 
 error: unconstrained opaque type
   --> $DIR/variance.rs:22:27
@@ -60,7 +60,7 @@ error: unconstrained opaque type
 LL | type Bar<'a, 'b: 'b, T> = impl Sized;
    |                           ^^^^^^^^^^
    |
-   = note: `Bar` must be used in combination with a concrete type within the same module
+   = note: `Bar` must be used in combination with a concrete type within the same crate
 
 error: unconstrained opaque type
   --> $DIR/variance.rs:34:32
diff --git a/tests/ui/type-alias-impl-trait/weird-return-types.rs b/tests/ui/type-alias-impl-trait/weird-return-types.rs
index 29d4faa7ba9..05668c836f9 100644
--- a/tests/ui/type-alias-impl-trait/weird-return-types.rs
+++ b/tests/ui/type-alias-impl-trait/weird-return-types.rs
@@ -4,11 +4,12 @@
 #![feature(type_alias_impl_trait)]
 #![allow(dead_code)]
 
-use std::future::Future;
 use std::fmt::Debug;
+use std::future::Future;
 
 type Foo = impl Debug;
 
+#[define_opaque(Foo)]
 fn f() -> impl Future<Output = Foo> {
     async move { 22_u32 }
 }
diff --git a/tests/ui/type-alias-impl-trait/wf-check-definition-site.rs b/tests/ui/type-alias-impl-trait/wf-check-definition-site.rs
index 19dd4c17936..fd5edcc89ee 100644
--- a/tests/ui/type-alias-impl-trait/wf-check-definition-site.rs
+++ b/tests/ui/type-alias-impl-trait/wf-check-definition-site.rs
@@ -14,6 +14,7 @@
 struct Static<T: 'static>(T);
 
 type OpaqueRet<'a> = impl Sized + 'a;
+#[define_opaque(OpaqueRet)]
 fn test_return<'a>(msg: Static<&'static u8>) -> OpaqueRet<'a> {
     msg
 }
@@ -23,9 +24,9 @@ fn test_rpit<'a>(msg: Static<&'static u8>) -> impl Sized + 'a {
 }
 
 type OpaqueAssign<'a> = impl Sized + 'a;
-fn test_assign<'a>(msg: Static<&'static u8>) -> Option<OpaqueAssign<'a>> {
+#[define_opaque(OpaqueAssign)]
+fn test_assign<'a>(msg: Static<&'static u8>) {
     let _: OpaqueAssign<'a> = msg;
-    None
 }
 
 // `OpaqueRef<'a, T> = Ref<'a, T>`, vs
@@ -33,6 +34,7 @@ fn test_assign<'a>(msg: Static<&'static u8>) -> Option<OpaqueAssign<'a>> {
 trait RefAt<'a>: 'a {}
 struct Ref<'a, T: RefAt<'a>>(&'a T);
 type OpaqueRef<'a, T: RefAt<'static>> = impl Sized + 'a;
+#[define_opaque(OpaqueRef)]
 fn test_trait<'a, T: RefAt<'static>>(msg: Ref<'static, T>) -> OpaqueRef<'a, T> {
     msg
 }
diff --git a/tests/ui/type-alias-impl-trait/wf-check-fn-def.rs b/tests/ui/type-alias-impl-trait/wf-check-fn-def.rs
index 449e9fbd0d8..6de2c0ccc37 100644
--- a/tests/ui/type-alias-impl-trait/wf-check-fn-def.rs
+++ b/tests/ui/type-alias-impl-trait/wf-check-fn-def.rs
@@ -6,8 +6,11 @@ trait Bar {
 
 type FooFn<B> = impl FnOnce(B);
 
+#[define_opaque(FooFn)]
 fn foo<B: Bar>() -> FooFn<B> {
-    fn mop<B: Bar>(bar: B) { bar.bar() }
+    fn mop<B: Bar>(bar: B) {
+        bar.bar()
+    }
     mop // NOTE: no function pointer, but function zst item
     //~^ ERROR the trait bound `B: Bar` is not satisfied
 }
diff --git a/tests/ui/type-alias-impl-trait/wf-check-fn-def.stderr b/tests/ui/type-alias-impl-trait/wf-check-fn-def.stderr
index 9046a8a76b8..b52ed3f43f4 100644
--- a/tests/ui/type-alias-impl-trait/wf-check-fn-def.stderr
+++ b/tests/ui/type-alias-impl-trait/wf-check-fn-def.stderr
@@ -1,13 +1,13 @@
 error[E0277]: the trait bound `B: Bar` is not satisfied
-  --> $DIR/wf-check-fn-def.rs:11:5
+  --> $DIR/wf-check-fn-def.rs:14:5
    |
 LL |     mop // NOTE: no function pointer, but function zst item
    |     ^^^ the trait `Bar` is not implemented for `B`
    |
 note: required by a bound in `mop`
-  --> $DIR/wf-check-fn-def.rs:10:15
+  --> $DIR/wf-check-fn-def.rs:11:15
    |
-LL |     fn mop<B: Bar>(bar: B) { bar.bar() }
+LL |     fn mop<B: Bar>(bar: B) {
    |               ^^^ required by this bound in `mop`
 help: consider restricting type parameter `B` with trait `Bar`
    |
diff --git a/tests/ui/type-alias-impl-trait/wf-check-fn-ptrs.rs b/tests/ui/type-alias-impl-trait/wf-check-fn-ptrs.rs
index 1484d9fd073..fd9ed533756 100644
--- a/tests/ui/type-alias-impl-trait/wf-check-fn-ptrs.rs
+++ b/tests/ui/type-alias-impl-trait/wf-check-fn-ptrs.rs
@@ -8,8 +8,11 @@ trait Bar {
 
 type FooFn<B> = impl FnOnce(B);
 
+#[define_opaque(FooFn)]
 fn foo<B: Bar>() -> FooFn<B> {
-    fn mop<B: Bar>(bar: B) { bar.bar() }
+    fn mop<B: Bar>(bar: B) {
+        bar.bar()
+    }
     mop as fn(B)
     // function pointers don't have any obligations on them,
     // thus the above compiles. It's obviously unsound to just
diff --git a/tests/ui/type-alias-impl-trait/wf-nested.rs b/tests/ui/type-alias-impl-trait/wf-nested.rs
index 56c524c6db0..074ea8703a4 100644
--- a/tests/ui/type-alias-impl-trait/wf-nested.rs
+++ b/tests/ui/type-alias-impl-trait/wf-nested.rs
@@ -19,7 +19,6 @@ impl<T> Trait<&'static T> for () {
     type Out = IsStatic<T>;
 }
 
-
 // We could theoretically allow this (and previously did), as even
 // though the nested opaque is not well-formed, it can only be
 // used by normalizing the projection
@@ -27,6 +26,7 @@ impl<T> Trait<&'static T> for () {
 // Assuming that we check that this projection is well-formed, the wf
 // of the nested opaque is implied.
 type OuterOpaque1<T> = impl Trait<&'static T, Out = impl Sized>;
+#[define_opaque(OuterOpaque1)]
 fn define<T>() -> OuterOpaque1<T> {}
 //~^ ERROR `T` may not live long enough
 
@@ -38,6 +38,7 @@ fn define_rpit<T>() -> impl Trait<&'static T, Out = impl Sized> {}
 // soundness.
 type InnerOpaque<T> = impl Sized;
 type OuterOpaque2<T> = impl Trait<&'static T, Out = InnerOpaque<T>>;
+#[define_opaque(OuterOpaque2)]
 fn define_nested_rpit<T>() -> OuterOpaque2<T> {}
 //~^ ERROR the parameter type `T` may not live long enough
 
diff --git a/tests/ui/type-alias-impl-trait/wf-nested.stderr b/tests/ui/type-alias-impl-trait/wf-nested.stderr
index 6d50e11c5da..d7ac5146c1e 100644
--- a/tests/ui/type-alias-impl-trait/wf-nested.stderr
+++ b/tests/ui/type-alias-impl-trait/wf-nested.stderr
@@ -27,7 +27,7 @@ LL | fn define_rpit<T: 'static>() -> impl Trait<&'static T, Out = impl Sized> {}
    |                 +++++++++
 
 error[E0310]: the parameter type `T` may not live long enough
-  --> $DIR/wf-nested.rs:41:47
+  --> $DIR/wf-nested.rs:42:47
    |
 LL | fn define_nested_rpit<T>() -> OuterOpaque2<T> {}
    |                                               ^^
diff --git a/tests/ui/type-alias-impl-trait/wf_check_closures.rs b/tests/ui/type-alias-impl-trait/wf_check_closures.rs
index 2c70696ffcf..c633909f513 100644
--- a/tests/ui/type-alias-impl-trait/wf_check_closures.rs
+++ b/tests/ui/type-alias-impl-trait/wf_check_closures.rs
@@ -6,8 +6,9 @@ trait Bar {
 
 type FooFn<B> = impl FnOnce();
 
+#[define_opaque(FooFn)]
 fn foo<B: Bar>(bar: B) -> FooFn<B> {
-    move || { bar.bar() }
+    move || bar.bar()
     //~^ ERROR the trait bound `B: Bar` is not satisfied
 }
 
diff --git a/tests/ui/type-alias-impl-trait/wf_check_closures.stderr b/tests/ui/type-alias-impl-trait/wf_check_closures.stderr
index 4156f0ca96a..57e40445c87 100644
--- a/tests/ui/type-alias-impl-trait/wf_check_closures.stderr
+++ b/tests/ui/type-alias-impl-trait/wf_check_closures.stderr
@@ -1,11 +1,11 @@
 error[E0277]: the trait bound `B: Bar` is not satisfied
-  --> $DIR/wf_check_closures.rs:10:5
+  --> $DIR/wf_check_closures.rs:11:5
    |
-LL |     move || { bar.bar() }
-   |     ^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `B`
+LL |     move || bar.bar()
+   |     ^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `B`
    |
 note: required by a bound in `foo`
-  --> $DIR/wf_check_closures.rs:9:11
+  --> $DIR/wf_check_closures.rs:10:11
    |
 LL | fn foo<B: Bar>(bar: B) -> FooFn<B> {
    |           ^^^ required by this bound in `foo`
diff --git a/tests/ui/type/pattern_types/derives.stderr b/tests/ui/type/pattern_types/derives.stderr
index 9d4baef621b..f59617ebc45 100644
--- a/tests/ui/type/pattern_types/derives.stderr
+++ b/tests/ui/type/pattern_types/derives.stderr
@@ -6,8 +6,6 @@ LL | #[derive(Clone, Copy, PartialEq)]
 LL | #[repr(transparent)]
 LL | struct Nanoseconds(NanoI32);
    |                    ^^^^^^^
-   |
-   = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/type/pattern_types/literals.rs b/tests/ui/type/pattern_types/literals.rs
new file mode 100644
index 00000000000..7fd630dab3a
--- /dev/null
+++ b/tests/ui/type/pattern_types/literals.rs
@@ -0,0 +1,139 @@
+//! Check where literals can be used to initialize pattern types and where not.
+
+#![feature(pattern_types, const_trait_impl, pattern_type_range_trait)]
+#![feature(pattern_type_macro)]
+
+use std::pat::pattern_type;
+
+fn out_of_range() -> pattern_type!(u32 is 1..) {
+    0
+    //~^ mismatched types
+}
+
+fn at_range_start() -> pattern_type!(u32 is 1..) {
+    1
+}
+
+fn in_range() -> pattern_type!(u32 is 1..) {
+    2
+}
+
+fn negative_lit_on_unsigned_ty() -> pattern_type!(u32 is 1..) {
+    -3
+    //~^ ERROR: cannot apply unary operator `-` to type `(u32) is 1..`
+}
+
+fn negative_lit_in_range() -> pattern_type!(i8 is -5..5) {
+    -2
+    //~^ ERROR: cannot apply unary operator `-` to type `(i8) is -5..=4`
+}
+
+fn positive_lit_in_range_of_signed() -> pattern_type!(i8 is -5..5) {
+    2
+}
+
+fn negative_lit_at_range_start() -> pattern_type!(i8 is -5..5) {
+    -5
+    //~^ mismatched types
+}
+
+fn positive_lit_at_range_end() -> pattern_type!(i8 is -5..5) {
+    4
+}
+
+fn lit_one_beyond_range_end() -> pattern_type!(i8 is -5..5) {
+    5
+    //~^ mismatched types
+}
+
+fn wrong_lit_kind() -> pattern_type!(u32 is 1..) {
+    '3'
+    //~^ mismatched types
+}
+
+fn char_lit_in_range() -> pattern_type!(char is 'a'..'z') {
+    'b'
+    //~^ mismatched types
+}
+
+fn char_lit_out_of_range() -> pattern_type!(char is 'a'..'z') {
+    'A'
+    //~^ mismatched types
+}
+
+fn lit_at_unsigned_range_inclusive_end() -> pattern_type!(u32 is 0..=1) {
+    1
+}
+
+fn single_element_range() -> pattern_type!(u32 is 0..=0) {
+    0
+}
+
+fn lit_oob_single_element_range() -> pattern_type!(u32 is 0..=0) {
+    1
+    //~^ mismatched types
+}
+
+fn lit_oob_single_element_range_exclusive() -> pattern_type!(u32 is 0..1) {
+    1
+    //~^ mismatched types
+}
+
+fn single_element_range_exclusive() -> pattern_type!(u32 is 0..1) {
+    0
+}
+
+fn empty_range_at_base_type_min() -> pattern_type!(u32 is 0..0) {
+    //~^ evaluation of constant value failed
+    0
+}
+
+fn empty_range_at_base_type_min2() -> pattern_type!(u32 is 0..0) {
+    //~^ evaluation of constant value failed
+    1
+}
+
+fn empty_range() -> pattern_type!(u32 is 1..1) {
+    0
+    //~^ mismatched types
+}
+
+fn empty_range2() -> pattern_type!(u32 is 1..1) {
+    1
+    //~^ mismatched types
+}
+
+fn wraparound_range_at_base_ty_end() -> pattern_type!(u32 is 1..0) {
+    //~^ evaluation of constant value failed
+    1
+}
+
+fn wraparound_range_at_base_ty_end2() -> pattern_type!(u32 is 1..0) {
+    //~^ evaluation of constant value failed
+    0
+}
+
+fn wraparound_range_at_base_ty_end3() -> pattern_type!(u32 is 1..0) {
+    //~^ evaluation of constant value failed
+    2
+}
+
+fn wraparound_range() -> pattern_type!(u32 is 2..1) {
+    1
+    //~^ mismatched types
+}
+
+fn lit_in_wraparound_range() -> pattern_type!(u32 is 2..1) {
+    0
+    //~^ mismatched types
+}
+
+fn lit_at_wraparound_range_start() -> pattern_type!(u32 is 2..1) {
+    2
+    //~^ mismatched types
+}
+
+fn main() {}
+
+//~? ERROR pattern type ranges cannot wrap: 1..=0
+//~? ERROR pattern type ranges cannot wrap: 2..=0
diff --git a/tests/ui/type/pattern_types/literals.stderr b/tests/ui/type/pattern_types/literals.stderr
new file mode 100644
index 00000000000..5c926742f3c
--- /dev/null
+++ b/tests/ui/type/pattern_types/literals.stderr
@@ -0,0 +1,193 @@
+error[E0080]: evaluation of constant value failed
+  --> $DIR/literals.rs:86:62
+   |
+LL | fn empty_range_at_base_type_min() -> pattern_type!(u32 is 0..0) {
+   |                                                              ^ evaluation panicked: exclusive range end at minimum value of type
+
+error[E0080]: evaluation of constant value failed
+  --> $DIR/literals.rs:91:63
+   |
+LL | fn empty_range_at_base_type_min2() -> pattern_type!(u32 is 0..0) {
+   |                                                               ^ evaluation panicked: exclusive range end at minimum value of type
+
+error[E0080]: evaluation of constant value failed
+  --> $DIR/literals.rs:106:65
+   |
+LL | fn wraparound_range_at_base_ty_end() -> pattern_type!(u32 is 1..0) {
+   |                                                                 ^ evaluation panicked: exclusive range end at minimum value of type
+
+error[E0080]: evaluation of constant value failed
+  --> $DIR/literals.rs:111:66
+   |
+LL | fn wraparound_range_at_base_ty_end2() -> pattern_type!(u32 is 1..0) {
+   |                                                                  ^ evaluation panicked: exclusive range end at minimum value of type
+
+error[E0080]: evaluation of constant value failed
+  --> $DIR/literals.rs:116:66
+   |
+LL | fn wraparound_range_at_base_ty_end3() -> pattern_type!(u32 is 1..0) {
+   |                                                                  ^ evaluation panicked: exclusive range end at minimum value of type
+
+error[E0308]: mismatched types
+  --> $DIR/literals.rs:9:5
+   |
+LL | fn out_of_range() -> pattern_type!(u32 is 1..) {
+   |                      ------------------------- expected `(u32) is 1..` because of return type
+LL |     0
+   |     ^ expected `(u32) is 1..`, found integer
+   |
+   = note: expected pattern type `(u32) is 1..`
+                      found type `{integer}`
+
+error[E0600]: cannot apply unary operator `-` to type `(u32) is 1..`
+  --> $DIR/literals.rs:22:5
+   |
+LL |     -3
+   |     ^^ cannot apply unary operator `-`
+
+error[E0600]: cannot apply unary operator `-` to type `(i8) is -5..=4`
+  --> $DIR/literals.rs:27:5
+   |
+LL |     -2
+   |     ^^ cannot apply unary operator `-`
+
+error[E0308]: mismatched types
+  --> $DIR/literals.rs:36:5
+   |
+LL | fn negative_lit_at_range_start() -> pattern_type!(i8 is -5..5) {
+   |                                     -------------------------- expected `(i8) is -5..=4` because of return type
+LL |     -5
+   |     ^^ expected `(i8) is -5..=4`, found integer
+   |
+   = note: expected pattern type `(i8) is -5..=4`
+                      found type `{integer}`
+
+error[E0308]: mismatched types
+  --> $DIR/literals.rs:45:5
+   |
+LL | fn lit_one_beyond_range_end() -> pattern_type!(i8 is -5..5) {
+   |                                  -------------------------- expected `(i8) is -5..=4` because of return type
+LL |     5
+   |     ^ expected `(i8) is -5..=4`, found integer
+   |
+   = note: expected pattern type `(i8) is -5..=4`
+                      found type `{integer}`
+
+error[E0308]: mismatched types
+  --> $DIR/literals.rs:50:5
+   |
+LL | fn wrong_lit_kind() -> pattern_type!(u32 is 1..) {
+   |                        ------------------------- expected `(u32) is 1..` because of return type
+LL |     '3'
+   |     ^^^ expected `(u32) is 1..`, found `char`
+   |
+   = note: expected pattern type `(u32) is 1..`
+                      found type `char`
+
+error[E0308]: mismatched types
+  --> $DIR/literals.rs:55:5
+   |
+LL | fn char_lit_in_range() -> pattern_type!(char is 'a'..'z') {
+   |                           ------------------------------- expected `(char) is 'a'..='y'` because of return type
+LL |     'b'
+   |     ^^^ expected `(char) is 'a'..='y'`, found `char`
+   |
+   = note: expected pattern type `(char) is 'a'..='y'`
+                      found type `char`
+
+error[E0308]: mismatched types
+  --> $DIR/literals.rs:60:5
+   |
+LL | fn char_lit_out_of_range() -> pattern_type!(char is 'a'..'z') {
+   |                               ------------------------------- expected `(char) is 'a'..='y'` because of return type
+LL |     'A'
+   |     ^^^ expected `(char) is 'a'..='y'`, found `char`
+   |
+   = note: expected pattern type `(char) is 'a'..='y'`
+                      found type `char`
+
+error[E0308]: mismatched types
+  --> $DIR/literals.rs:73:5
+   |
+LL | fn lit_oob_single_element_range() -> pattern_type!(u32 is 0..=0) {
+   |                                      --------------------------- expected `(u32) is 0..=0` because of return type
+LL |     1
+   |     ^ expected `(u32) is 0..=0`, found integer
+   |
+   = note: expected pattern type `(u32) is 0..=0`
+                      found type `{integer}`
+
+error[E0308]: mismatched types
+  --> $DIR/literals.rs:78:5
+   |
+LL | fn lit_oob_single_element_range_exclusive() -> pattern_type!(u32 is 0..1) {
+   |                                                -------------------------- expected `(u32) is 0..=0` because of return type
+LL |     1
+   |     ^ expected `(u32) is 0..=0`, found integer
+   |
+   = note: expected pattern type `(u32) is 0..=0`
+                      found type `{integer}`
+
+error: pattern type ranges cannot wrap: 1..=0
+
+error[E0308]: mismatched types
+  --> $DIR/literals.rs:97:5
+   |
+LL | fn empty_range() -> pattern_type!(u32 is 1..1) {
+   |                     -------------------------- expected `(u32) is 1..=0` because of return type
+LL |     0
+   |     ^ expected `(u32) is 1..=0`, found integer
+   |
+   = note: expected pattern type `(u32) is 1..=0`
+                      found type `{integer}`
+
+error[E0308]: mismatched types
+  --> $DIR/literals.rs:102:5
+   |
+LL | fn empty_range2() -> pattern_type!(u32 is 1..1) {
+   |                      -------------------------- expected `(u32) is 1..=0` because of return type
+LL |     1
+   |     ^ expected `(u32) is 1..=0`, found integer
+   |
+   = note: expected pattern type `(u32) is 1..=0`
+                      found type `{integer}`
+
+error: pattern type ranges cannot wrap: 2..=0
+
+error[E0308]: mismatched types
+  --> $DIR/literals.rs:122:5
+   |
+LL | fn wraparound_range() -> pattern_type!(u32 is 2..1) {
+   |                          -------------------------- expected `(u32) is 2..=0` because of return type
+LL |     1
+   |     ^ expected `(u32) is 2..=0`, found integer
+   |
+   = note: expected pattern type `(u32) is 2..=0`
+                      found type `{integer}`
+
+error[E0308]: mismatched types
+  --> $DIR/literals.rs:127:5
+   |
+LL | fn lit_in_wraparound_range() -> pattern_type!(u32 is 2..1) {
+   |                                 -------------------------- expected `(u32) is 2..=0` because of return type
+LL |     0
+   |     ^ expected `(u32) is 2..=0`, found integer
+   |
+   = note: expected pattern type `(u32) is 2..=0`
+                      found type `{integer}`
+
+error[E0308]: mismatched types
+  --> $DIR/literals.rs:132:5
+   |
+LL | fn lit_at_wraparound_range_start() -> pattern_type!(u32 is 2..1) {
+   |                                       -------------------------- expected `(u32) is 2..=0` because of return type
+LL |     2
+   |     ^ expected `(u32) is 2..=0`, found integer
+   |
+   = note: expected pattern type `(u32) is 2..=0`
+                      found type `{integer}`
+
+error: aborting due to 22 previous errors
+
+Some errors have detailed explanations: E0080, E0308, E0600.
+For more information about an error, try `rustc --explain E0080`.
diff --git a/tests/ui/type/pattern_types/nested.rs b/tests/ui/type/pattern_types/nested.rs
index 0d8cd22190e..fd950d73291 100644
--- a/tests/ui/type/pattern_types/nested.rs
+++ b/tests/ui/type/pattern_types/nested.rs
@@ -1,6 +1,6 @@
 //! Check that pattern types can only have specific base types
 
-#![feature(pattern_types)]
+#![feature(pattern_types, const_trait_impl, pattern_type_range_trait)]
 #![feature(pattern_type_macro)]
 
 use std::pat::pattern_type;
@@ -14,7 +14,7 @@ const BAD_NESTING: pattern_type!(pattern_type!(u32 is 1..) is 0..) = todo!();
 // We want to get the most narrowest version that a pattern could be
 const BAD_NESTING2: pattern_type!(pattern_type!(i32 is 1..) is ..=-1) = todo!();
 //~^ ERROR: not a valid base type for range patterns
-//~| ERROR: mismatched types
+//~| ERROR: cannot apply unary operator `-` to type `(i32) is 1..`
 
 const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo!();
 //~^ ERROR: not a valid base type for range patterns
diff --git a/tests/ui/type/pattern_types/nested.stderr b/tests/ui/type/pattern_types/nested.stderr
index f79d12bc3f3..bb206d9db3d 100644
--- a/tests/ui/type/pattern_types/nested.stderr
+++ b/tests/ui/type/pattern_types/nested.stderr
@@ -43,14 +43,11 @@ LL | const BAD_NESTING2: pattern_type!(pattern_type!(i32 is 1..) is ..=-1) = tod
              u128
            and 5 others
 
-error[E0308]: mismatched types
+error[E0600]: cannot apply unary operator `-` to type `(i32) is 1..`
   --> $DIR/nested.rs:15:67
    |
 LL | const BAD_NESTING2: pattern_type!(pattern_type!(i32 is 1..) is ..=-1) = todo!();
-   |                                                                   ^^ expected `(i32) is 1..`, found integer
-   |
-   = note: expected pattern type `(i32) is 1..`
-                      found type `{integer}`
+   |                                                                   ^^ cannot apply unary operator `-`
 
 error[E0277]: `(i32) is 1..` is not a valid base type for range patterns
   --> $DIR/nested.rs:19:35
@@ -180,5 +177,5 @@ LL | const BAD_NESTING5: pattern_type!(f32 is 1.0 .. 2.0) = todo!();
 
 error: aborting due to 11 previous errors
 
-Some errors have detailed explanations: E0277, E0308.
+Some errors have detailed explanations: E0277, E0308, E0600.
 For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/type/pattern_types/range_patterns.rs b/tests/ui/type/pattern_types/range_patterns.rs
index 446a33195c8..21c1454d6cd 100644
--- a/tests/ui/type/pattern_types/range_patterns.rs
+++ b/tests/ui/type/pattern_types/range_patterns.rs
@@ -1,4 +1,4 @@
-#![feature(pattern_types, rustc_attrs)]
+#![feature(pattern_types, rustc_attrs, const_trait_impl, pattern_type_range_trait)]
 #![feature(pattern_type_macro)]
 #![allow(incomplete_features)]
 
@@ -18,6 +18,29 @@ type A = Option<std::num::NonZeroU32>; //~ ERROR layout_of
 #[rustc_layout(debug)]
 struct NonZeroU32New(pattern_type!(u32 is 1..)); //~ ERROR layout_of
 
+#[rustc_layout(debug)]
+type EMPTY = pattern_type!(u32 is 1..1); //~ ERROR unknown layout
+
+#[rustc_layout(debug)]
+type WRAP = pattern_type!(u32 is 1..0); //~ ERROR unknown layout
+//~^ ERROR: evaluation of constant value failed
+
+#[rustc_layout(debug)]
+type WRAP2 = pattern_type!(u32 is 5..2); //~ ERROR unknown layout
+
+#[rustc_layout(debug)]
+type SIGN = pattern_type!(i8 is -10..=10); //~ ERROR layout_of
+
+#[rustc_layout(debug)]
+type MIN = pattern_type!(i8 is -128..=0); //~ ERROR layout_of
+
+#[rustc_layout(debug)]
+type SignedWrap = pattern_type!(i8 is 120..=-120); //~ ERROR unknown layout
+
 fn main() {
     let x: pattern_type!(u32 is 1..) = unsafe { std::mem::transmute(42_u32) };
 }
+
+//~? ERROR pattern type ranges cannot wrap: 1..=0
+//~? ERROR pattern type ranges cannot wrap: 5..=1
+//~? ERROR pattern type ranges cannot wrap: 120..=-120
diff --git a/tests/ui/type/pattern_types/range_patterns.stderr b/tests/ui/type/pattern_types/range_patterns.stderr
index cb24a303404..a05995a33f9 100644
--- a/tests/ui/type/pattern_types/range_patterns.stderr
+++ b/tests/ui/type/pattern_types/range_patterns.stderr
@@ -357,5 +357,120 @@ error: layout_of(NonZeroU32New) = Layout {
 LL | struct NonZeroU32New(pattern_type!(u32 is 1..));
    | ^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to 5 previous errors
+error: pattern type ranges cannot wrap: 1..=0
 
+error: the type has an unknown layout
+  --> $DIR/range_patterns.rs:22:1
+   |
+LL | type EMPTY = pattern_type!(u32 is 1..1);
+   | ^^^^^^^^^^
+
+error[E0080]: evaluation of constant value failed
+  --> $DIR/range_patterns.rs:25:37
+   |
+LL | type WRAP = pattern_type!(u32 is 1..0);
+   |                                     ^ evaluation panicked: exclusive range end at minimum value of type
+
+error: the type has an unknown layout
+  --> $DIR/range_patterns.rs:25:1
+   |
+LL | type WRAP = pattern_type!(u32 is 1..0);
+   | ^^^^^^^^^
+
+error: pattern type ranges cannot wrap: 5..=1
+
+error: the type has an unknown layout
+  --> $DIR/range_patterns.rs:29:1
+   |
+LL | type WRAP2 = pattern_type!(u32 is 5..2);
+   | ^^^^^^^^^^
+
+error: layout_of((i8) is -10..=10) = Layout {
+           size: Size(1 bytes),
+           align: AbiAndPrefAlign {
+               abi: Align(1 bytes),
+               pref: $SOME_ALIGN,
+           },
+           backend_repr: Scalar(
+               Initialized {
+                   value: Int(
+                       I8,
+                       true,
+                   ),
+                   valid_range: (..=10) | (246..),
+               },
+           ),
+           fields: Primitive,
+           largest_niche: Some(
+               Niche {
+                   offset: Size(0 bytes),
+                   value: Int(
+                       I8,
+                       true,
+                   ),
+                   valid_range: (..=10) | (246..),
+               },
+           ),
+           uninhabited: false,
+           variants: Single {
+               index: 0,
+           },
+           max_repr_align: None,
+           unadjusted_abi_align: Align(1 bytes),
+           randomization_seed: $SEED,
+       }
+  --> $DIR/range_patterns.rs:32:1
+   |
+LL | type SIGN = pattern_type!(i8 is -10..=10);
+   | ^^^^^^^^^
+
+error: layout_of((i8) is i8::MIN..=0) = Layout {
+           size: Size(1 bytes),
+           align: AbiAndPrefAlign {
+               abi: Align(1 bytes),
+               pref: $SOME_ALIGN,
+           },
+           backend_repr: Scalar(
+               Initialized {
+                   value: Int(
+                       I8,
+                       true,
+                   ),
+                   valid_range: (..=0) | (128..),
+               },
+           ),
+           fields: Primitive,
+           largest_niche: Some(
+               Niche {
+                   offset: Size(0 bytes),
+                   value: Int(
+                       I8,
+                       true,
+                   ),
+                   valid_range: (..=0) | (128..),
+               },
+           ),
+           uninhabited: false,
+           variants: Single {
+               index: 0,
+           },
+           max_repr_align: None,
+           unadjusted_abi_align: Align(1 bytes),
+           randomization_seed: $SEED,
+       }
+  --> $DIR/range_patterns.rs:35:1
+   |
+LL | type MIN = pattern_type!(i8 is -128..=0);
+   | ^^^^^^^^
+
+error: pattern type ranges cannot wrap: 120..=-120
+
+error: the type has an unknown layout
+  --> $DIR/range_patterns.rs:38:1
+   |
+LL | type SignedWrap = pattern_type!(i8 is 120..=-120);
+   | ^^^^^^^^^^^^^^^
+
+error: aborting due to 15 previous errors
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/type/pattern_types/validity.rs b/tests/ui/type/pattern_types/validity.rs
index 5a6a688e1b3..c61bb71ac25 100644
--- a/tests/ui/type/pattern_types/validity.rs
+++ b/tests/ui/type/pattern_types/validity.rs
@@ -1,4 +1,6 @@
 //! Check that pattern types have their validity checked
+// Strip out raw byte dumps to make tests platform-independent:
+//@ normalize-stderr: "([[:xdigit:]]{2}\s){4,8}\s+│\s.{4,8}" -> "HEX_DUMP"
 
 #![feature(pattern_types, const_trait_impl, pattern_type_range_trait)]
 #![feature(pattern_type_macro)]
diff --git a/tests/ui/type/pattern_types/validity.stderr b/tests/ui/type/pattern_types/validity.stderr
index 5bc18cfba3f..b990ec2d368 100644
--- a/tests/ui/type/pattern_types/validity.stderr
+++ b/tests/ui/type/pattern_types/validity.stderr
@@ -1,22 +1,22 @@
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/validity.rs:8:1
+  --> $DIR/validity.rs:10:1
    |
 LL | const BAD: pattern_type!(u32 is 1..) = unsafe { std::mem::transmute(0) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
    = note: the raw bytes of the constant (size: 4, align: 4) {
-               00 00 00 00                                     │ ....
+               HEX_DUMP
            }
 
 error[E0080]: evaluation of constant value failed
-  --> $DIR/validity.rs:11:1
+  --> $DIR/validity.rs:13:1
    |
 LL | const BAD_UNINIT: pattern_type!(u32 is 1..) =
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
 
 error[E0080]: evaluation of constant value failed
-  --> $DIR/validity.rs:15:1
+  --> $DIR/validity.rs:17:1
    |
 LL | const BAD_PTR: pattern_type!(usize is 1..) = unsafe { std::mem::transmute(&42) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
@@ -25,53 +25,53 @@ LL | const BAD_PTR: pattern_type!(usize is 1..) = unsafe { std::mem::transmute(&
    = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/validity.rs:18:1
+  --> $DIR/validity.rs:20:1
    |
 LL | const BAD_AGGREGATE: (pattern_type!(u32 is 1..), u32) = (unsafe { std::mem::transmute(0) }, 0);
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0, but expected something greater or equal to 1
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
    = note: the raw bytes of the constant (size: 8, align: 4) {
-               00 00 00 00 00 00 00 00                         │ ........
+               HEX_DUMP
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/validity.rs:24:1
+  --> $DIR/validity.rs:26:1
    |
 LL | const BAD_FOO: Foo = Foo(Bar(unsafe { std::mem::transmute(0) }));
    | ^^^^^^^^^^^^^^^^^^ constructing invalid value at .0.0: encountered 0, but expected something greater or equal to 1
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
    = note: the raw bytes of the constant (size: 4, align: 4) {
-               00 00 00 00                                     │ ....
+               HEX_DUMP
            }
 
 error[E0080]: evaluation of constant value failed
-  --> $DIR/validity.rs:27:1
+  --> $DIR/validity.rs:29:1
    |
 LL | const CHAR_UNINIT: pattern_type!(char is 'A'..'Z') =
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/validity.rs:31:1
+  --> $DIR/validity.rs:33:1
    |
 LL | const CHAR_OOB_PAT: pattern_type!(char is 'A'..'Z') = unsafe { std::mem::transmute('a') };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 97, but expected something in the range 65..=89
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
    = note: the raw bytes of the constant (size: 4, align: 4) {
-               61 00 00 00                                     │ a...
+               HEX_DUMP
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/validity.rs:34:1
+  --> $DIR/validity.rs:36:1
    |
 LL | const CHAR_OOB: pattern_type!(char is 'A'..'Z') = unsafe { std::mem::transmute(u32::MAX) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
    = note: the raw bytes of the constant (size: 4, align: 4) {
-               ff ff ff ff                                     │ ....
+               HEX_DUMP
            }
 
 error: aborting due to 8 previous errors
diff --git a/tests/ui/typeck/cyclic_type_ice.stderr b/tests/ui/typeck/cyclic_type_ice.stderr
index 4dc02a53c02..645766becbf 100644
--- a/tests/ui/typeck/cyclic_type_ice.stderr
+++ b/tests/ui/typeck/cyclic_type_ice.stderr
@@ -23,7 +23,7 @@ LL |     let f = |_, _| ();
 help: provide the argument
    |
 LL -     f(f);
-LL +     f(/*  */, /*  */);
+LL +     f(/* _ */, /* _ */);
    |
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/typeck/typeck_type_placeholder_item.rs b/tests/ui/typeck/typeck_type_placeholder_item.rs
index 9f1bfd7909e..d7351f2e51a 100644
--- a/tests/ui/typeck/typeck_type_placeholder_item.rs
+++ b/tests/ui/typeck/typeck_type_placeholder_item.rs
@@ -181,6 +181,7 @@ trait Trait<T> {}
 impl Trait<usize> for Struct {}
 type Y = impl Trait<_>;
 //~^ ERROR the placeholder `_` is not allowed within types on item signatures for type aliases
+#[define_opaque(Y)]
 fn foo() -> Y {
     Struct
 }
diff --git a/tests/ui/typeck/typeck_type_placeholder_item.stderr b/tests/ui/typeck/typeck_type_placeholder_item.stderr
index c5bf9a47e91..2a4a5a62ab4 100644
--- a/tests/ui/typeck/typeck_type_placeholder_item.stderr
+++ b/tests/ui/typeck/typeck_type_placeholder_item.stderr
@@ -29,7 +29,7 @@ LL | struct BadStruct2<_, T>(_, T);
    |                   ^ expected identifier, found reserved identifier
 
 error: associated constant in `impl` without body
-  --> $DIR/typeck_type_placeholder_item.rs:206:5
+  --> $DIR/typeck_type_placeholder_item.rs:207:5
    |
 LL |     const C: _;
    |     ^^^^^^^^^^-
@@ -578,13 +578,13 @@ LL | type Y = impl Trait<_>;
    |                     ^ not allowed in type signatures
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
-  --> $DIR/typeck_type_placeholder_item.rs:206:14
+  --> $DIR/typeck_type_placeholder_item.rs:207:14
    |
 LL |     const C: _;
    |              ^ not allowed in type signatures
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
-  --> $DIR/typeck_type_placeholder_item.rs:194:14
+  --> $DIR/typeck_type_placeholder_item.rs:195:14
    |
 LL |     const D: _ = 42;
    |              ^ not allowed in type signatures
@@ -596,13 +596,13 @@ LL +     const D: i32 = 42;
    |
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
-  --> $DIR/typeck_type_placeholder_item.rs:209:14
+  --> $DIR/typeck_type_placeholder_item.rs:210:14
    |
 LL |     const D: _ = 42;
    |              ^ not allowed in type signatures
 
 error[E0046]: not all trait items implemented, missing: `F`
-  --> $DIR/typeck_type_placeholder_item.rs:200:1
+  --> $DIR/typeck_type_placeholder_item.rs:201:1
    |
 LL |     type F: std::ops::Fn(_);
    |     ----------------------- `F` from trait
@@ -611,7 +611,7 @@ LL | impl Qux for Struct {
    | ^^^^^^^^^^^^^^^^^^^ missing `F` in implementation
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
-  --> $DIR/typeck_type_placeholder_item.rs:217:31
+  --> $DIR/typeck_type_placeholder_item.rs:218:31
    |
 LL | fn value() -> Option<&'static _> {
    |               ----------------^-
@@ -620,7 +620,7 @@ LL | fn value() -> Option<&'static _> {
    |               help: replace with the correct return type: `Option<&'static u8>`
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants
-  --> $DIR/typeck_type_placeholder_item.rs:222:17
+  --> $DIR/typeck_type_placeholder_item.rs:223:17
    |
 LL | const _: Option<_> = map(value);
    |                 ^ not allowed in type signatures
@@ -632,7 +632,7 @@ LL + const _: Option<u8> = map(value);
    |
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
-  --> $DIR/typeck_type_placeholder_item.rs:226:31
+  --> $DIR/typeck_type_placeholder_item.rs:227:31
    |
 LL | fn evens_squared(n: usize) -> _ {
    |                               ^
@@ -641,13 +641,13 @@ LL | fn evens_squared(n: usize) -> _ {
    |                               help: replace with an appropriate return type: `impl Iterator<Item = usize>`
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants
-  --> $DIR/typeck_type_placeholder_item.rs:231:10
+  --> $DIR/typeck_type_placeholder_item.rs:232:10
    |
 LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x);
    |          ^ not allowed in type signatures
    |
-note: however, the inferred type `Map<Filter<Range<i32>, {closure@typeck_type_placeholder_item.rs:231:29}>, {closure@typeck_type_placeholder_item.rs:231:49}>` cannot be named
-  --> $DIR/typeck_type_placeholder_item.rs:231:14
+note: however, the inferred type `Map<Filter<Range<i32>, {closure@typeck_type_placeholder_item.rs:232:29}>, {closure@typeck_type_placeholder_item.rs:232:49}>` cannot be named
+  --> $DIR/typeck_type_placeholder_item.rs:232:14
    |
 LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x);
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -695,53 +695,53 @@ LL +         fn fn_test10<T>(&self, _x : T) { }
    |
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types
-  --> $DIR/typeck_type_placeholder_item.rs:202:14
+  --> $DIR/typeck_type_placeholder_item.rs:203:14
    |
 LL |     type A = _;
    |              ^ not allowed in type signatures
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types
-  --> $DIR/typeck_type_placeholder_item.rs:204:14
+  --> $DIR/typeck_type_placeholder_item.rs:205:14
    |
 LL |     type B = _;
    |              ^ not allowed in type signatures
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types
-  --> $DIR/typeck_type_placeholder_item.rs:190:14
+  --> $DIR/typeck_type_placeholder_item.rs:191:14
    |
 LL |     type B = _;
    |              ^ not allowed in type signatures
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
-  --> $DIR/typeck_type_placeholder_item.rs:192:14
+  --> $DIR/typeck_type_placeholder_item.rs:193:14
    |
 LL |     const C: _;
    |              ^ not allowed in type signatures
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types
-  --> $DIR/typeck_type_placeholder_item.rs:197:26
+  --> $DIR/typeck_type_placeholder_item.rs:198:26
    |
 LL |     type F: std::ops::Fn(_);
    |                          ^ not allowed in type signatures
 
 error[E0015]: cannot call non-const function `map::<u8>` in constants
-  --> $DIR/typeck_type_placeholder_item.rs:222:22
+  --> $DIR/typeck_type_placeholder_item.rs:223:22
    |
 LL | const _: Option<_> = map(value);
    |                      ^^^^^^^^^^
    |
    = note: calls in constants are limited to constant functions, tuple structs and tuple variants
 
-error[E0015]: cannot call non-const method `<std::ops::Range<i32> as Iterator>::filter::<{closure@$DIR/typeck_type_placeholder_item.rs:231:29: 231:32}>` in constants
-  --> $DIR/typeck_type_placeholder_item.rs:231:22
+error[E0015]: cannot call non-const method `<std::ops::Range<i32> as Iterator>::filter::<{closure@$DIR/typeck_type_placeholder_item.rs:232:29: 232:32}>` in constants
+  --> $DIR/typeck_type_placeholder_item.rs:232:22
    |
 LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x);
    |                      ^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: calls in constants are limited to constant functions, tuple structs and tuple variants
 
-error[E0015]: cannot call non-const method `<Filter<std::ops::Range<i32>, {closure@$DIR/typeck_type_placeholder_item.rs:231:29: 231:32}> as Iterator>::map::<i32, {closure@$DIR/typeck_type_placeholder_item.rs:231:49: 231:52}>` in constants
-  --> $DIR/typeck_type_placeholder_item.rs:231:45
+error[E0015]: cannot call non-const method `<Filter<std::ops::Range<i32>, {closure@$DIR/typeck_type_placeholder_item.rs:232:29: 232:32}> as Iterator>::map::<i32, {closure@$DIR/typeck_type_placeholder_item.rs:232:49: 232:52}>` in constants
+  --> $DIR/typeck_type_placeholder_item.rs:232:45
    |
 LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x);
    |                                             ^^^^^^^^^^^^^^
diff --git a/tests/ui/uninhabited/auxiliary/staged-api.rs b/tests/ui/uninhabited/auxiliary/staged-api.rs
new file mode 100644
index 00000000000..342ecf020ea
--- /dev/null
+++ b/tests/ui/uninhabited/auxiliary/staged-api.rs
@@ -0,0 +1,8 @@
+#![feature(staged_api)]
+#![stable(feature = "stable", since = "1.0.0")]
+
+#[stable(feature = "stable", since = "1.0.0")]
+pub struct Foo<T> {
+    #[unstable(feature = "unstable", issue = "none")]
+    pub field: T,
+}
diff --git a/tests/ui/uninhabited/uninhabited-pin-field.rs b/tests/ui/uninhabited/uninhabited-pin-field.rs
new file mode 100644
index 00000000000..3d0d9a7a4f8
--- /dev/null
+++ b/tests/ui/uninhabited/uninhabited-pin-field.rs
@@ -0,0 +1,10 @@
+use std::pin::Pin;
+
+enum Void {}
+
+fn demo(x: Pin<Void>) {
+    match x {}
+    //~^ ERROR non-exhaustive patterns
+}
+
+fn main() {}
diff --git a/tests/ui/uninhabited/uninhabited-pin-field.stderr b/tests/ui/uninhabited/uninhabited-pin-field.stderr
new file mode 100644
index 00000000000..93254ca9b98
--- /dev/null
+++ b/tests/ui/uninhabited/uninhabited-pin-field.stderr
@@ -0,0 +1,19 @@
+error[E0004]: non-exhaustive patterns: type `Pin<Void>` is non-empty
+  --> $DIR/uninhabited-pin-field.rs:6:11
+   |
+LL |     match x {}
+   |           ^
+   |
+note: `Pin<Void>` defined here
+  --> $SRC_DIR/core/src/pin.rs:LL:COL
+   = note: the matched value is of type `Pin<Void>`
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
+   |
+LL ~     match x {
+LL +         _ => todo!(),
+LL ~     }
+   |
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/uninhabited/uninhabited-unstable-field.current.stderr b/tests/ui/uninhabited/uninhabited-unstable-field.current.stderr
new file mode 100644
index 00000000000..9e0feb4c473
--- /dev/null
+++ b/tests/ui/uninhabited/uninhabited-unstable-field.current.stderr
@@ -0,0 +1,22 @@
+error[E0004]: non-exhaustive patterns: type `Foo<Void>` is non-empty
+  --> $DIR/uninhabited-unstable-field.rs:13:11
+   |
+LL |     match x {}
+   |           ^
+   |
+note: `Foo<Void>` defined here
+  --> $DIR/auxiliary/staged-api.rs:5:1
+   |
+LL | pub struct Foo<T> {
+   | ^^^^^^^^^^^^^^^^^
+   = note: the matched value is of type `Foo<Void>`
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
+   |
+LL ~     match x {
+LL +         _ => todo!(),
+LL ~     }
+   |
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/uninhabited/uninhabited-unstable-field.exhaustive.stderr b/tests/ui/uninhabited/uninhabited-unstable-field.exhaustive.stderr
new file mode 100644
index 00000000000..9e0feb4c473
--- /dev/null
+++ b/tests/ui/uninhabited/uninhabited-unstable-field.exhaustive.stderr
@@ -0,0 +1,22 @@
+error[E0004]: non-exhaustive patterns: type `Foo<Void>` is non-empty
+  --> $DIR/uninhabited-unstable-field.rs:13:11
+   |
+LL |     match x {}
+   |           ^
+   |
+note: `Foo<Void>` defined here
+  --> $DIR/auxiliary/staged-api.rs:5:1
+   |
+LL | pub struct Foo<T> {
+   | ^^^^^^^^^^^^^^^^^
+   = note: the matched value is of type `Foo<Void>`
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
+   |
+LL ~     match x {
+LL +         _ => todo!(),
+LL ~     }
+   |
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/uninhabited/uninhabited-unstable-field.rs b/tests/ui/uninhabited/uninhabited-unstable-field.rs
new file mode 100644
index 00000000000..9b507c518ab
--- /dev/null
+++ b/tests/ui/uninhabited/uninhabited-unstable-field.rs
@@ -0,0 +1,29 @@
+//@ aux-build: staged-api.rs
+//@ revisions: current exhaustive
+
+#![feature(exhaustive_patterns)]
+
+extern crate staged_api;
+
+use staged_api::Foo;
+
+enum Void {}
+
+fn demo(x: Foo<Void>) {
+    match x {}
+    //~^ ERROR non-exhaustive patterns
+}
+
+// Ensure that the pattern is not considered unreachable.
+fn demo2(x: Foo<Void>) {
+    match x {
+        Foo { .. } => {}
+    }
+}
+
+// Same as above, but for wildcard.
+fn demo3(x: Foo<Void>) {
+    match x { _ => {} }
+}
+
+fn main() {}
diff --git a/tests/ui/union/union-derive-clone.stderr b/tests/ui/union/union-derive-clone.stderr
index a2b81f0dba1..679ab6a38e4 100644
--- a/tests/ui/union/union-derive-clone.stderr
+++ b/tests/ui/union/union-derive-clone.stderr
@@ -6,7 +6,6 @@ LL | #[derive(Clone)]
    |
 note: required by a bound in `AssertParamIsCopy`
   --> $SRC_DIR/core/src/clone.rs:LL:COL
-   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `U1` with `#[derive(Copy)]`
    |
 LL + #[derive(Copy)]
diff --git a/tests/ui/union/union-derive-eq.current.stderr b/tests/ui/union/union-derive-eq.current.stderr
index 151ceebe1ba..a0339687dad 100644
--- a/tests/ui/union/union-derive-eq.current.stderr
+++ b/tests/ui/union/union-derive-eq.current.stderr
@@ -9,7 +9,6 @@ LL |     a: PartialEqNotEq,
    |
 note: required by a bound in `AssertParamIsEq`
   --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `PartialEqNotEq` with `#[derive(Eq)]`
    |
 LL + #[derive(Eq)]
diff --git a/tests/ui/union/union-derive-eq.next.stderr b/tests/ui/union/union-derive-eq.next.stderr
index 151ceebe1ba..a0339687dad 100644
--- a/tests/ui/union/union-derive-eq.next.stderr
+++ b/tests/ui/union/union-derive-eq.next.stderr
@@ -9,7 +9,6 @@ LL |     a: PartialEqNotEq,
    |
 note: required by a bound in `AssertParamIsEq`
   --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `PartialEqNotEq` with `#[derive(Eq)]`
    |
 LL + #[derive(Eq)]
diff --git a/tests/ui/unpretty/avoid-crash.rs b/tests/ui/unpretty/avoid-crash.rs
index 7fcabfe6a8d..64fa778bed4 100644
--- a/tests/ui/unpretty/avoid-crash.rs
+++ b/tests/ui/unpretty/avoid-crash.rs
@@ -2,3 +2,5 @@
 //@ compile-flags: -o. -Zunpretty=ast-tree
 
 fn main() {}
+
+//~? ERROR failed to write `.` due to error
diff --git a/tests/ui/unpretty/deprecated-attr.rs b/tests/ui/unpretty/deprecated-attr.rs
index 24a32d8a9ac..dda362a595e 100644
--- a/tests/ui/unpretty/deprecated-attr.rs
+++ b/tests/ui/unpretty/deprecated-attr.rs
@@ -1,8 +1,6 @@
 //@ compile-flags: -Zunpretty=hir
 //@ check-pass
 
-// FIXME(jdonszelmann): the pretty printing output for deprecated (and possibly more attrs) is
-// slightly broken.
 #[deprecated]
 pub struct PlainDeprecated;
 
diff --git a/tests/ui/unpretty/deprecated-attr.stdout b/tests/ui/unpretty/deprecated-attr.stdout
index 675351351a0..42de7b4533e 100644
--- a/tests/ui/unpretty/deprecated-attr.stdout
+++ b/tests/ui/unpretty/deprecated-attr.stdout
@@ -5,24 +5,21 @@ extern crate std;
 //@ compile-flags: -Zunpretty=hir
 //@ check-pass
 
-// FIXME(jdonszelmann): the pretty printing output for deprecated (and possibly more attrs) is
-// slightly broken.
-#[attr="Deprecation{deprecation: Deprecation{since: Unspecifiednote:
-suggestion: }span: }")]
+#[attr = Deprecation {deprecation: Deprecation {since: Unspecified}}]
 struct PlainDeprecated;
 
-#[attr="Deprecation{deprecation: Deprecation{since: Unspecifiednote:
-here's why this is deprecatedsuggestion: }span: }")]
+#[attr = Deprecation {deprecation: Deprecation {since: Unspecified, note:
+"here's why this is deprecated"}}]
 struct DirectNote;
 
-#[attr="Deprecation{deprecation: Deprecation{since: Unspecifiednote:
-here's why this is deprecatedsuggestion: }span: }")]
+#[attr = Deprecation {deprecation: Deprecation {since: Unspecified, note:
+"here's why this is deprecated"}}]
 struct ExplicitNote;
 
-#[attr="Deprecation{deprecation: Deprecation{since: NonStandard(1.2.3)note:
-here's why this is deprecatedsuggestion: }span: }")]
+#[attr = Deprecation {deprecation: Deprecation {since: NonStandard("1.2.3"),
+note: "here's why this is deprecated"}}]
 struct SinceAndNote;
 
-#[attr="Deprecation{deprecation: Deprecation{since: NonStandard(1.2.3)note:
-here's why this is deprecatedsuggestion: }span: }")]
+#[attr = Deprecation {deprecation: Deprecation {since: NonStandard("1.2.3"),
+note: "here's why this is deprecated"}}]
 struct FlippedOrder;
diff --git a/tests/ui/variance/variance-uniquearc.rs b/tests/ui/variance/variance-uniquearc.rs
new file mode 100644
index 00000000000..03589512388
--- /dev/null
+++ b/tests/ui/variance/variance-uniquearc.rs
@@ -0,0 +1,27 @@
+// regression test of https://github.com/rust-lang/rust/pull/133572#issuecomment-2543007164
+// see also the test for UniqueRc` in variance-uniquerc.rs
+//
+// inline comments explain how this code *would* compile if UniqueArc was still covariant
+
+#![feature(unique_rc_arc)]
+
+use std::sync::UniqueArc;
+
+fn extend_lifetime<'a, 'b>(x: &'a str) -> &'b str {
+    let r = UniqueArc::new(""); // UniqueArc<&'static str>
+    let w = UniqueArc::downgrade(&r); // Weak<&'static str>
+    let mut r = r; // [IF COVARIANT]: ==>> UniqueArc<&'a str>
+    *r = x; // assign the &'a str
+    let _r = UniqueArc::into_arc(r); // Arc<&'a str>, but we only care to activate the weak
+    let r = w.upgrade().unwrap(); // Arc<&'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-uniquearc.stderr b/tests/ui/variance/variance-uniquearc.stderr
new file mode 100644
index 00000000000..55076dae732
--- /dev/null
+++ b/tests/ui/variance/variance-uniquearc.stderr
@@ -0,0 +1,15 @@
+error: lifetime may not live long enough
+  --> $DIR/variance-uniquearc.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
+
diff --git a/tests/ui/variance/variance-uniquerc.rs b/tests/ui/variance/variance-uniquerc.rs
index 0c395ab06ea..2e9738f66dc 100644
--- a/tests/ui/variance/variance-uniquerc.rs
+++ b/tests/ui/variance/variance-uniquerc.rs
@@ -1,5 +1,5 @@
 // regression test of https://github.com/rust-lang/rust/pull/133572#issuecomment-2543007164
-// we should also test UniqueArc once implemented
+// see also the test for UniqueArc in variance-uniquearc.rs
 //
 // inline comments explain how this code *would* compile if UniqueRc was still covariant
 
diff --git a/tests/ui/write-fmt-errors.rs b/tests/ui/write-fmt-errors.rs
index 1dafb9a784b..b48fa3f11cc 100644
--- a/tests/ui/write-fmt-errors.rs
+++ b/tests/ui/write-fmt-errors.rs
@@ -4,7 +4,7 @@
 #![feature(io_error_uncategorized)]
 
 use std::fmt;
-use std::io::{self, Error, Write, sink};
+use std::io::{self, Error, Write};
 use std::panic::catch_unwind;
 
 struct ErrorDisplay;
@@ -33,7 +33,7 @@ fn main() {
     assert!(res.is_err(), "writer error did not propagate");
 
     // Test that the error from the formatter is detected.
-    let res = catch_unwind(|| write!(sink(), "{} {} {}", 1, ErrorDisplay, "bar"));
+    let res = catch_unwind(|| write!(vec![], "{} {} {}", 1, ErrorDisplay, "bar"));
     let err = res.expect_err("formatter error did not lead to panic").downcast::<&str>().unwrap();
     assert!(
         err.contains("formatting trait implementation returned an error"),