about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-07-01 14:59:58 +0000
committerbors <bors@rust-lang.org>2025-07-01 14:59:58 +0000
commit4e973370053a5fe87ee96d43c506623e9bd1eb9d (patch)
tree3aee0330fbc9174bfc1274ba909cfb5a2ece11c1
parent076a0a26fd6f4c445647a33d6daaac56f732ac05 (diff)
parent422eea2863e7b60dae30eb1a348eea446ac6003a (diff)
downloadrust-4e973370053a5fe87ee96d43c506623e9bd1eb9d.tar.gz
rust-4e973370053a5fe87ee96d43c506623e9bd1eb9d.zip
Auto merge of #142030 - oli-obk:wfck-less-hir, r=compiler-errors
Start moving wf checking away from HIR

I'm trying to only access the HIR in the error path. My hope is that once we move significant portions of wfcheck off HIR that incremental will be able to cache wfcheck queries significantly better.

I think I am reaching a blocker because we normally need to provide good spans to `ObligationCause`, so that the trait solver can report good errors. In some cases I have been able to use bad spans and improve them depending on the `ObligationCauseCode` (by loading HIR in the case where we actually want to error). To scale that further we'll likely need to remove spans from the `ObligationCause` entirely (leaving it to some variants of `ObligationCauseCode` to have a span when they can't recompute the information later). Unsure this is the right approach, but we've already been using it. I will create an MCP about it, but that should not affect this PR, which is fairly limited in where it does those kind of tricks.

Especially https://github.com/rust-lang/rust/commit/b862d8828e375ab8c128a9d9e93bf98b77cb5928 is interesting here, because I think it improves spans in all cases
-rw-r--r--compiler/rustc_hir/src/hir.rs4
-rw-r--r--compiler/rustc_hir_analysis/src/check/check.rs214
-rw-r--r--compiler/rustc_hir_analysis/src/check/wfcheck.rs331
-rw-r--r--compiler/rustc_hir_analysis/src/collect.rs150
-rw-r--r--compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs7
-rw-r--r--tests/incremental/issue-54242.rs2
-rw-r--r--tests/ui/associated-consts/assoc-const-eq-bound-var-in-ty-not-wf.rs2
-rw-r--r--tests/ui/associated-consts/assoc-const-eq-bound-var-in-ty-not-wf.stderr10
-rw-r--r--tests/ui/associated-inherent-types/issue-111879-0.stderr4
-rw-r--r--tests/ui/associated-inherent-types/normalization-overflow.stderr4
-rw-r--r--tests/ui/associated-inherent-types/regionck-1.stderr13
-rw-r--r--tests/ui/associated-types/impl-wf-cycle-4.stderr6
-rw-r--r--tests/ui/associated-types/issue-38821.rs10
-rw-r--r--tests/ui/associated-types/issue-38821.stderr68
-rw-r--r--tests/ui/associated-types/issue-59324.rs2
-rw-r--r--tests/ui/associated-types/issue-59324.stderr13
-rw-r--r--tests/ui/async-await/async-fn/impl-header.stderr16
-rw-r--r--tests/ui/coherence/coherence-impl-trait-for-trait-dyn-compatible.stderr16
-rw-r--r--tests/ui/coherence/fuzzing/best-obligation-ICE.stderr18
-rw-r--r--tests/ui/const-generics/generic_const_exprs/post-analysis-user-facing-param-env.rs1
-rw-r--r--tests/ui/const-generics/generic_const_exprs/post-analysis-user-facing-param-env.stderr23
-rw-r--r--tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr16
-rw-r--r--tests/ui/const-generics/ice-unexpected-inference-var-122549.rs1
-rw-r--r--tests/ui/const-generics/ice-unexpected-inference-var-122549.stderr22
-rw-r--r--tests/ui/const-generics/issues/issue-71202.stderr2
-rw-r--r--tests/ui/const-generics/normalizing_with_unconstrained_impl_params.rs1
-rw-r--r--tests/ui/const-generics/normalizing_with_unconstrained_impl_params.stderr15
-rw-r--r--tests/ui/const-generics/not_wf_param_in_rpitit.stderr2
-rw-r--r--tests/ui/consts/const-unsized.stderr8
-rw-r--r--tests/ui/consts/const_refs_to_static-ice-121413.stderr4
-rw-r--r--tests/ui/consts/dont-ctfe-unsized-initializer.stderr4
-rw-r--r--tests/ui/consts/issue-103790.stderr2
-rw-r--r--tests/ui/cycle-trait/cycle-trait-supertrait-direct.stderr6
-rw-r--r--tests/ui/cycle-trait/issue-12511.stderr6
-rw-r--r--tests/ui/delegation/unsupported.stderr16
-rw-r--r--tests/ui/dropck/explicit-drop-bounds.bad1.stderr12
-rw-r--r--tests/ui/dropck/explicit-drop-bounds.bad2.stderr12
-rw-r--r--tests/ui/dropck/unconstrained_const_param_on_drop.rs1
-rw-r--r--tests/ui/dropck/unconstrained_const_param_on_drop.stderr14
-rw-r--r--tests/ui/enum-discriminant/eval-error.stderr24
-rw-r--r--tests/ui/extern/issue-36122-accessing-externed-dst.stderr4
-rw-r--r--tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr48
-rw-r--r--tests/ui/fn/issue-39259.stderr16
-rw-r--r--tests/ui/generic-associated-types/bugs/issue-87735.stderr9
-rw-r--r--tests/ui/generic-associated-types/bugs/issue-88526.stderr9
-rw-r--r--tests/ui/generic-associated-types/gat-trait-path-generic-type-arg.rs1
-rw-r--r--tests/ui/generic-associated-types/gat-trait-path-generic-type-arg.stderr15
-rw-r--r--tests/ui/generic-associated-types/issue-84931.stderr9
-rw-r--r--tests/ui/generic-associated-types/static-lifetime-tip-with-default-type.stderr16
-rw-r--r--tests/ui/generic-const-items/evaluatable-bounds.stderr2
-rw-r--r--tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/false-positive-predicate-entailment-error.current.stderr40
-rw-r--r--tests/ui/impl-trait/in-trait/method-compatability-via-leakage-cycle.current.stderr8
-rw-r--r--tests/ui/impl-trait/in-trait/method-compatability-via-leakage-cycle.next.stderr16
-rw-r--r--tests/ui/impl-trait/in-trait/refine-resolution-errors.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/refine-resolution-errors.stderr29
-rw-r--r--tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr24
-rw-r--r--tests/ui/impl-trait/in-trait/unconstrained-lt.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/unconstrained-lt.stderr20
-rw-r--r--tests/ui/implied-bounds/impl-header-unnormalized-types.stderr4
-rw-r--r--tests/ui/infinite/infinite-trait-alias-recursion.stderr2
-rw-r--r--tests/ui/infinite/infinite-type-alias-mutual-recursion.feature.stderr12
-rw-r--r--tests/ui/infinite/infinite-vec-type-recursion.feature.stderr4
-rw-r--r--tests/ui/issues/issue-54410.stderr4
-rw-r--r--tests/ui/issues/issue-7364.stderr4
-rw-r--r--tests/ui/layout/ice-non-last-unsized-field-issue-121473.stderr24
-rw-r--r--tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.stderr30
-rw-r--r--tests/ui/lazy-type-alias/inherent-impls-overflow.current.stderr12
-rw-r--r--tests/ui/lazy-type-alias/inherent-impls-overflow.next.stderr12
-rw-r--r--tests/ui/lazy-type-alias/unconstrained-params-in-impl-due-to-overflow.stderr4
-rw-r--r--tests/ui/lifetimes/issue-64173-unused-lifetimes.stderr12
-rw-r--r--tests/ui/lifetimes/issue-76168-hr-outlives-3.rs4
-rw-r--r--tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr26
-rw-r--r--tests/ui/lifetimes/issue-95023.stderr16
-rw-r--r--tests/ui/macros/macro-span-issue-116502.stderr8
-rw-r--r--tests/ui/methods/filter-relevant-fn-bounds.rs5
-rw-r--r--tests/ui/methods/filter-relevant-fn-bounds.stderr40
-rw-r--r--tests/ui/regions/lifetime-not-long-enough-suggestion-regression-test-124563.stderr4
-rw-r--r--tests/ui/regions/region-bounds-on-objects-and-type-parameters.stderr16
-rw-r--r--tests/ui/regions/regions-normalize-in-where-clause-list.rs2
-rw-r--r--tests/ui/regions/regions-normalize-in-where-clause-list.stderr12
-rw-r--r--tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr12
-rw-r--r--tests/ui/simd/array-trait.stderr12
-rw-r--r--tests/ui/specialization/defaultimpl/validation.stderr16
-rw-r--r--tests/ui/specialization/issue-51892.stderr4
-rw-r--r--tests/ui/specialization/min_specialization/issue-79224.stderr12
-rw-r--r--tests/ui/static/issue-24446.stderr8
-rw-r--r--tests/ui/statics/issue-17718-static-sync.stderr4
-rw-r--r--tests/ui/statics/uninhabited-static.stderr24
-rw-r--r--tests/ui/statics/unsized_type2.stderr4
-rw-r--r--tests/ui/statics/unsizing-wfcheck-issue-127299.stderr4
-rw-r--r--tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr12
-rw-r--r--tests/ui/traits/constrained-type-params-trait-impl.stderr22
-rw-r--r--tests/ui/traits/deep-norm-pending.rs4
-rw-r--r--tests/ui/traits/deep-norm-pending.stderr49
-rw-r--r--tests/ui/traits/issue-105231.stderr22
-rw-r--r--tests/ui/traits/issue-78372.stderr12
-rw-r--r--tests/ui/traits/issue-87558.stderr16
-rw-r--r--tests/ui/traits/next-solver/issue-118950-root-region.stderr4
-rw-r--r--tests/ui/traits/trait-upcasting/cyclic-trait-resolution.stderr2
-rw-r--r--tests/ui/traits/unconstrained-projection-normalization-2.current.stderr29
-rw-r--r--tests/ui/traits/unconstrained-projection-normalization-2.next.stderr30
-rw-r--r--tests/ui/traits/unconstrained-projection-normalization-2.rs3
-rw-r--r--tests/ui/traits/unconstrained-projection-normalization.current.stderr29
-rw-r--r--tests/ui/traits/unconstrained-projection-normalization.next.stderr29
-rw-r--r--tests/ui/traits/unconstrained-projection-normalization.rs3
-rw-r--r--tests/ui/typeck/issue-13853-5.rs3
-rw-r--r--tests/ui/typeck/issue-13853-5.stderr15
-rw-r--r--tests/ui/union/issue-81199.stderr24
-rw-r--r--tests/ui/union/union-unsized.stderr30
-rw-r--r--tests/ui/unsized/unsized-trait-impl-self-type.stderr18
-rw-r--r--tests/ui/unsized/unsized-trait-impl-trait-arg.stderr18
-rw-r--r--tests/ui/unsized/unsized7.stderr18
-rw-r--r--tests/ui/variance/variance-regions-unused-indirect.stderr16
-rw-r--r--tests/ui/wf/hir-wf-check-erase-regions.stderr4
-rw-r--r--tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr2
-rw-r--r--tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr4
-rw-r--r--tests/ui/wf/wf-impl-associated-type-region.stderr4
-rw-r--r--tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr8
-rw-r--r--tests/ui/wf/wf-trait-associated-type-region.stderr4
124 files changed, 1149 insertions, 1012 deletions
diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs
index 4bb6a796be4..1fdee975e07 100644
--- a/compiler/rustc_hir/src/hir.rs
+++ b/compiler/rustc_hir/src/hir.rs
@@ -4834,6 +4834,10 @@ impl<'hir> Node<'hir> {
                 ImplItemKind::Type(ty) => Some(ty),
                 _ => None,
             },
+            Node::ForeignItem(it) => match it.kind {
+                ForeignItemKind::Static(ty, ..) => Some(ty),
+                _ => None,
+            },
             _ => None,
         }
     }
diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs
index a361679e8ad..f4fcb13b1a1 100644
--- a/compiler/rustc_hir_analysis/src/check/check.rs
+++ b/compiler/rustc_hir_analysis/src/check/check.rs
@@ -10,7 +10,7 @@ use rustc_errors::{EmissionGuarantee, MultiSpan};
 use rustc_hir::def::{CtorKind, DefKind};
 use rustc_hir::{LangItem, Node, intravisit};
 use rustc_infer::infer::{RegionVariableOrigin, TyCtxtInferExt};
-use rustc_infer::traits::{Obligation, ObligationCauseCode};
+use rustc_infer::traits::{Obligation, ObligationCauseCode, WellFormedLoc};
 use rustc_lint_defs::builtin::{
     REPR_TRANSPARENT_EXTERNAL_PRIVATE_FIELDS, UNSUPPORTED_CALLING_CONVENTIONS,
 };
@@ -36,6 +36,10 @@ use {rustc_attr_data_structures as attrs, rustc_hir as hir};
 
 use super::compare_impl_item::check_type_bounds;
 use super::*;
+use crate::check::wfcheck::{
+    check_associated_item, check_trait_item, check_variances_for_type_defn, check_where_clauses,
+    enter_wf_checking_ctxt,
+};
 
 fn add_abi_diag_help<T: EmissionGuarantee>(abi: ExternAbi, diag: &mut Diag<'_, T>) {
     if let ExternAbi::Cdecl { unwind } = abi {
@@ -729,7 +733,8 @@ fn check_static_linkage(tcx: TyCtxt<'_>, def_id: LocalDefId) {
     }
 }
 
-pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
+pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorGuaranteed> {
+    let mut res = Ok(());
     let generics = tcx.generics_of(def_id);
 
     for param in &generics.own_params {
@@ -754,15 +759,39 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
     }
 
     match tcx.def_kind(def_id) {
-        DefKind::Static { .. } => {
-            check_static_inhabited(tcx, def_id);
-            check_static_linkage(tcx, def_id);
+        def_kind @ (DefKind::Static { .. } | DefKind::Const) => {
+            tcx.ensure_ok().generics_of(def_id);
+            tcx.ensure_ok().type_of(def_id);
+            tcx.ensure_ok().predicates_of(def_id);
+            match def_kind {
+                DefKind::Static { .. } => {
+                    check_static_inhabited(tcx, def_id);
+                    check_static_linkage(tcx, def_id);
+                    res = res.and(wfcheck::check_static_item(tcx, def_id));
+
+                    // Only `Node::Item` and `Node::ForeignItem` still have HIR based
+                    // checks. Returning early here does not miss any checks and
+                    // avoids this query from having a direct dependency edge on the HIR
+                    return res;
+                }
+                DefKind::Const => {}
+                _ => unreachable!(),
+            }
         }
-        DefKind::Const => {}
         DefKind::Enum => {
+            tcx.ensure_ok().generics_of(def_id);
+            tcx.ensure_ok().type_of(def_id);
+            tcx.ensure_ok().predicates_of(def_id);
+            crate::collect::lower_enum_variant_types(tcx, def_id.to_def_id());
             check_enum(tcx, def_id);
+            check_variances_for_type_defn(tcx, def_id);
         }
         DefKind::Fn => {
+            tcx.ensure_ok().generics_of(def_id);
+            tcx.ensure_ok().type_of(def_id);
+            tcx.ensure_ok().predicates_of(def_id);
+            tcx.ensure_ok().fn_sig(def_id);
+            tcx.ensure_ok().codegen_fn_attrs(def_id);
             if let Some(i) = tcx.intrinsic(def_id) {
                 intrinsic::check_intrinsic_type(
                     tcx,
@@ -773,17 +802,31 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
             }
         }
         DefKind::Impl { of_trait } => {
+            tcx.ensure_ok().generics_of(def_id);
+            tcx.ensure_ok().type_of(def_id);
+            tcx.ensure_ok().impl_trait_header(def_id);
+            tcx.ensure_ok().predicates_of(def_id);
+            tcx.ensure_ok().associated_items(def_id);
             if of_trait && let Some(impl_trait_header) = tcx.impl_trait_header(def_id) {
-                if tcx
-                    .ensure_ok()
-                    .coherent_trait(impl_trait_header.trait_ref.instantiate_identity().def_id)
-                    .is_ok()
-                {
+                res = res.and(
+                    tcx.ensure_ok()
+                        .coherent_trait(impl_trait_header.trait_ref.instantiate_identity().def_id),
+                );
+
+                if res.is_ok() {
+                    // Checking this only makes sense if the all trait impls satisfy basic
+                    // requirements (see `coherent_trait` query), otherwise
+                    // we run into infinite recursions a lot.
                     check_impl_items_against_trait(tcx, def_id, impl_trait_header);
                 }
             }
         }
         DefKind::Trait => {
+            tcx.ensure_ok().generics_of(def_id);
+            tcx.ensure_ok().trait_def(def_id);
+            tcx.ensure_ok().explicit_super_predicates_of(def_id);
+            tcx.ensure_ok().predicates_of(def_id);
+            tcx.ensure_ok().associated_items(def_id);
             let assoc_items = tcx.associated_items(def_id);
             check_on_unimplemented(tcx, def_id);
 
@@ -802,11 +845,33 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
                 }
             }
         }
-        DefKind::Struct => {
-            check_struct(tcx, def_id);
+        DefKind::TraitAlias => {
+            tcx.ensure_ok().generics_of(def_id);
+            tcx.ensure_ok().explicit_implied_predicates_of(def_id);
+            tcx.ensure_ok().explicit_super_predicates_of(def_id);
+            tcx.ensure_ok().predicates_of(def_id);
         }
-        DefKind::Union => {
-            check_union(tcx, def_id);
+        def_kind @ (DefKind::Struct | DefKind::Union) => {
+            tcx.ensure_ok().generics_of(def_id);
+            tcx.ensure_ok().type_of(def_id);
+            tcx.ensure_ok().predicates_of(def_id);
+
+            let adt = tcx.adt_def(def_id).non_enum_variant();
+            for f in adt.fields.iter() {
+                tcx.ensure_ok().generics_of(f.did);
+                tcx.ensure_ok().type_of(f.did);
+                tcx.ensure_ok().predicates_of(f.did);
+            }
+
+            if let Some((_, ctor_def_id)) = adt.ctor {
+                crate::collect::lower_variant_ctor(tcx, ctor_def_id.expect_local());
+            }
+            match def_kind {
+                DefKind::Struct => check_struct(tcx, def_id),
+                DefKind::Union => check_union(tcx, def_id),
+                _ => unreachable!(),
+            }
+            check_variances_for_type_defn(tcx, def_id);
         }
         DefKind::OpaqueTy => {
             check_opaque_precise_captures(tcx, def_id);
@@ -831,14 +896,37 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
                 tcx.ensure_ok().explicit_implied_const_bounds(def_id);
                 tcx.ensure_ok().const_conditions(def_id);
             }
+
+            // Only `Node::Item` and `Node::ForeignItem` still have HIR based
+            // checks. Returning early here does not miss any checks and
+            // avoids this query from having a direct dependency edge on the HIR
+            return res;
         }
         DefKind::TyAlias => {
+            tcx.ensure_ok().generics_of(def_id);
+            tcx.ensure_ok().type_of(def_id);
+            tcx.ensure_ok().predicates_of(def_id);
             check_type_alias_type_params_are_used(tcx, def_id);
+            if tcx.type_alias_is_lazy(def_id) {
+                res = res.and(enter_wf_checking_ctxt(tcx, def_id, |wfcx| {
+                    let ty = tcx.type_of(def_id).instantiate_identity();
+                    let span = tcx.def_span(def_id);
+                    let item_ty = wfcx.deeply_normalize(span, Some(WellFormedLoc::Ty(def_id)), ty);
+                    wfcx.register_wf_obligation(
+                        span,
+                        Some(WellFormedLoc::Ty(def_id)),
+                        item_ty.into(),
+                    );
+                    check_where_clauses(wfcx, def_id);
+                    Ok(())
+                }));
+                check_variances_for_type_defn(tcx, def_id);
+            }
         }
         DefKind::ForeignMod => {
             let it = tcx.hir_expect_item(def_id);
             let hir::ItemKind::ForeignMod { abi, items } = it.kind else {
-                return;
+                return Ok(());
             };
 
             check_abi(tcx, it.hir_id(), it.span, abi);
@@ -877,15 +965,23 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
                 }
 
                 let item = tcx.hir_foreign_item(item.id);
-                match &item.kind {
-                    hir::ForeignItemKind::Fn(sig, _, _) => {
+                tcx.ensure_ok().generics_of(item.owner_id);
+                tcx.ensure_ok().type_of(item.owner_id);
+                tcx.ensure_ok().predicates_of(item.owner_id);
+                if tcx.is_conditionally_const(def_id) {
+                    tcx.ensure_ok().explicit_implied_const_bounds(def_id);
+                    tcx.ensure_ok().const_conditions(def_id);
+                }
+                match item.kind {
+                    hir::ForeignItemKind::Fn(sig, ..) => {
+                        tcx.ensure_ok().codegen_fn_attrs(item.owner_id);
+                        tcx.ensure_ok().fn_sig(item.owner_id);
                         require_c_abi_if_c_variadic(tcx, sig.decl, abi, item.span);
                     }
                     hir::ForeignItemKind::Static(..) => {
-                        check_static_inhabited(tcx, def_id);
-                        check_static_linkage(tcx, def_id);
+                        tcx.ensure_ok().codegen_fn_attrs(item.owner_id);
                     }
-                    _ => {}
+                    _ => (),
                 }
             }
         }
@@ -897,9 +993,85 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
             // We do not call `type_of` for closures here as that
             // depends on typecheck and would therefore hide
             // any further errors in case one typeck fails.
+
+            // Only `Node::Item` and `Node::ForeignItem` still have HIR based
+            // checks. Returning early here does not miss any checks and
+            // avoids this query from having a direct dependency edge on the HIR
+            return res;
+        }
+        DefKind::AssocFn => {
+            tcx.ensure_ok().codegen_fn_attrs(def_id);
+            tcx.ensure_ok().type_of(def_id);
+            tcx.ensure_ok().fn_sig(def_id);
+            tcx.ensure_ok().predicates_of(def_id);
+            res = res.and(check_associated_item(tcx, def_id));
+            let assoc_item = tcx.associated_item(def_id);
+            match assoc_item.container {
+                ty::AssocItemContainer::Impl => {}
+                ty::AssocItemContainer::Trait => {
+                    res = res.and(check_trait_item(tcx, def_id));
+                }
+            }
+
+            // Only `Node::Item` and `Node::ForeignItem` still have HIR based
+            // checks. Returning early here does not miss any checks and
+            // avoids this query from having a direct dependency edge on the HIR
+            return res;
+        }
+        DefKind::AssocConst => {
+            tcx.ensure_ok().type_of(def_id);
+            tcx.ensure_ok().predicates_of(def_id);
+            res = res.and(check_associated_item(tcx, def_id));
+            let assoc_item = tcx.associated_item(def_id);
+            match assoc_item.container {
+                ty::AssocItemContainer::Impl => {}
+                ty::AssocItemContainer::Trait => {
+                    res = res.and(check_trait_item(tcx, def_id));
+                }
+            }
+
+            // Only `Node::Item` and `Node::ForeignItem` still have HIR based
+            // checks. Returning early here does not miss any checks and
+            // avoids this query from having a direct dependency edge on the HIR
+            return res;
         }
+        DefKind::AssocTy => {
+            tcx.ensure_ok().predicates_of(def_id);
+            res = res.and(check_associated_item(tcx, def_id));
+
+            let assoc_item = tcx.associated_item(def_id);
+            let has_type = match assoc_item.container {
+                ty::AssocItemContainer::Impl => true,
+                ty::AssocItemContainer::Trait => {
+                    tcx.ensure_ok().item_bounds(def_id);
+                    tcx.ensure_ok().item_self_bounds(def_id);
+                    res = res.and(check_trait_item(tcx, def_id));
+                    assoc_item.defaultness(tcx).has_value()
+                }
+            };
+            if has_type {
+                tcx.ensure_ok().type_of(def_id);
+            }
+
+            // Only `Node::Item` and `Node::ForeignItem` still have HIR based
+            // checks. Returning early here does not miss any checks and
+            // avoids this query from having a direct dependency edge on the HIR
+            return res;
+        }
+
+        // Only `Node::Item` and `Node::ForeignItem` still have HIR based
+        // checks. Returning early here does not miss any checks and
+        // avoids this query from having a direct dependency edge on the HIR
+        DefKind::AnonConst | DefKind::InlineConst => return res,
         _ => {}
     }
+    let node = tcx.hir_node_by_def_id(def_id);
+    res.and(match node {
+        hir::Node::Crate(_) => bug!("check_well_formed cannot be applied to the crate root"),
+        hir::Node::Item(item) => wfcheck::check_item(tcx, item),
+        hir::Node::ForeignItem(item) => wfcheck::check_foreign_item(tcx, item),
+        _ => unreachable!("{node:?}"),
+    })
 }
 
 pub(super) fn check_on_unimplemented(tcx: TyCtxt<'_>, def_id: LocalDefId) {
diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs
index b9124ea0e5e..ed8d25e9915 100644
--- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs
+++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs
@@ -25,7 +25,7 @@ use rustc_middle::ty::{
 };
 use rustc_middle::{bug, span_bug};
 use rustc_session::parse::feature_err;
-use rustc_span::{DUMMY_SP, Ident, Span, sym};
+use rustc_span::{DUMMY_SP, Span, sym};
 use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
 use rustc_trait_selection::regions::{InferCtxtRegionExt, OutlivesEnvironmentBuildExt};
 use rustc_trait_selection::traits::misc::{
@@ -46,7 +46,6 @@ use crate::{errors, fluent_generated as fluent};
 
 pub(super) struct WfCheckingCtxt<'a, 'tcx> {
     pub(super) ocx: ObligationCtxt<'a, 'tcx, FulfillmentError<'tcx>>,
-    span: Span,
     body_def_id: LocalDefId,
     param_env: ty::ParamEnv<'tcx>,
 }
@@ -84,7 +83,7 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> {
     /// signature types for implied bounds when checking regions.
     // FIXME(-Znext-solver): This should be removed when we compute implied outlives
     // bounds using the unnormalized signature of the function we're checking.
-    fn deeply_normalize<T>(&self, span: Span, loc: Option<WellFormedLoc>, value: T) -> T
+    pub(super) fn deeply_normalize<T>(&self, span: Span, loc: Option<WellFormedLoc>, value: T) -> T
     where
         T: TypeFoldable<TyCtxt<'tcx>>,
     {
@@ -105,7 +104,12 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> {
         }
     }
 
-    fn register_wf_obligation(&self, span: Span, loc: Option<WellFormedLoc>, term: ty::Term<'tcx>) {
+    pub(super) fn register_wf_obligation(
+        &self,
+        span: Span,
+        loc: Option<WellFormedLoc>,
+        term: ty::Term<'tcx>,
+    ) {
         let cause = traits::ObligationCause::new(
             span,
             self.body_def_id,
@@ -122,7 +126,6 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> {
 
 pub(super) fn enter_wf_checking_ctxt<'tcx, F>(
     tcx: TyCtxt<'tcx>,
-    span: Span,
     body_def_id: LocalDefId,
     f: F,
 ) -> Result<(), ErrorGuaranteed>
@@ -133,7 +136,7 @@ where
     let infcx = &tcx.infer_ctxt().build(TypingMode::non_body_analysis());
     let ocx = ObligationCtxt::new_with_diagnostics(infcx);
 
-    let mut wfcx = WfCheckingCtxt { ocx, span, body_def_id, param_env };
+    let mut wfcx = WfCheckingCtxt { ocx, body_def_id, param_env };
 
     if !tcx.features().trivial_bounds() {
         wfcx.check_false_global_bounds()
@@ -187,23 +190,10 @@ where
 }
 
 fn check_well_formed(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorGuaranteed> {
-    let node = tcx.hir_node_by_def_id(def_id);
-    let mut res = match node {
-        hir::Node::Crate(_) => bug!("check_well_formed cannot be applied to the crate root"),
-        hir::Node::Item(item) => check_item(tcx, item),
-        hir::Node::TraitItem(item) => check_trait_item(tcx, item),
-        hir::Node::ImplItem(item) => check_impl_item(tcx, item),
-        hir::Node::ForeignItem(item) => check_foreign_item(tcx, item),
-        hir::Node::ConstBlock(_) | hir::Node::Expr(_) | hir::Node::OpaqueTy(_) => {
-            Ok(crate::check::check::check_item_type(tcx, def_id))
-        }
-        _ => unreachable!("{node:?}"),
-    };
+    let mut res = crate::check::check::check_item_type(tcx, def_id);
 
-    if let Some(generics) = node.generics() {
-        for param in generics.params {
-            res = res.and(check_param_wf(tcx, param));
-        }
+    for param in &tcx.generics_of(def_id).own_params {
+        res = res.and(check_param_wf(tcx, param));
     }
 
     res
@@ -223,16 +213,18 @@ fn check_well_formed(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorGua
 /// not included it frequently leads to confusing errors in fn bodies. So it's better to check
 /// the types first.
 #[instrument(skip(tcx), level = "debug")]
-fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<(), ErrorGuaranteed> {
+pub(super) fn check_item<'tcx>(
+    tcx: TyCtxt<'tcx>,
+    item: &'tcx hir::Item<'tcx>,
+) -> Result<(), ErrorGuaranteed> {
     let def_id = item.owner_id.def_id;
 
     debug!(
         ?item.owner_id,
         item.name = ? tcx.def_path_str(def_id)
     );
-    crate::collect::lower_item(tcx, item.item_id());
 
-    let res = match item.kind {
+    match item.kind {
         // Right now we check that every default trait implementation
         // has an implementation of itself. Basically, a case like:
         //
@@ -295,57 +287,18 @@ fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<()
             }
             res
         }
-        hir::ItemKind::Fn { ident, sig, .. } => {
-            check_item_fn(tcx, def_id, ident, item.span, sig.decl)
-        }
-        hir::ItemKind::Static(_, _, ty, _) => {
-            check_static_item(tcx, def_id, ty.span, UnsizedHandling::Forbid)
-        }
-        hir::ItemKind::Const(_, _, ty, _) => check_const_item(tcx, def_id, ty.span, item.span),
-        hir::ItemKind::Struct(_, generics, _) => {
-            let res = check_type_defn(tcx, item, false);
-            check_variances_for_type_defn(tcx, item, generics);
-            res
-        }
-        hir::ItemKind::Union(_, generics, _) => {
-            let res = check_type_defn(tcx, item, true);
-            check_variances_for_type_defn(tcx, item, generics);
-            res
-        }
-        hir::ItemKind::Enum(_, generics, _) => {
-            let res = check_type_defn(tcx, item, true);
-            check_variances_for_type_defn(tcx, item, generics);
-            res
-        }
+        hir::ItemKind::Fn { sig, .. } => check_item_fn(tcx, def_id, sig.decl),
+        hir::ItemKind::Const(_, _, ty, _) => check_const_item(tcx, def_id, ty.span),
+        hir::ItemKind::Struct(..) => check_type_defn(tcx, item, false),
+        hir::ItemKind::Union(..) => check_type_defn(tcx, item, true),
+        hir::ItemKind::Enum(..) => check_type_defn(tcx, item, true),
         hir::ItemKind::Trait(..) => check_trait(tcx, item),
         hir::ItemKind::TraitAlias(..) => check_trait(tcx, item),
-        // `ForeignItem`s are handled separately.
-        hir::ItemKind::ForeignMod { .. } => Ok(()),
-        hir::ItemKind::TyAlias(_, generics, hir_ty) if tcx.type_alias_is_lazy(item.owner_id) => {
-            let res = enter_wf_checking_ctxt(tcx, item.span, def_id, |wfcx| {
-                let ty = tcx.type_of(def_id).instantiate_identity();
-                let item_ty =
-                    wfcx.deeply_normalize(hir_ty.span, Some(WellFormedLoc::Ty(def_id)), ty);
-                wfcx.register_wf_obligation(
-                    hir_ty.span,
-                    Some(WellFormedLoc::Ty(def_id)),
-                    item_ty.into(),
-                );
-                check_where_clauses(wfcx, item.span, def_id);
-                Ok(())
-            });
-            check_variances_for_type_defn(tcx, item, generics);
-            res
-        }
         _ => Ok(()),
-    };
-
-    crate::check::check::check_item_type(tcx, def_id);
-
-    res
+    }
 }
 
-fn check_foreign_item<'tcx>(
+pub(super) fn check_foreign_item<'tcx>(
     tcx: TyCtxt<'tcx>,
     item: &'tcx hir::ForeignItem<'tcx>,
 ) -> Result<(), ErrorGuaranteed> {
@@ -357,43 +310,23 @@ fn check_foreign_item<'tcx>(
     );
 
     match item.kind {
-        hir::ForeignItemKind::Fn(sig, ..) => {
-            check_item_fn(tcx, def_id, item.ident, item.span, sig.decl)
-        }
-        hir::ForeignItemKind::Static(ty, ..) => {
-            check_static_item(tcx, def_id, ty.span, UnsizedHandling::AllowIfForeignTail)
-        }
-        hir::ForeignItemKind::Type => Ok(()),
+        hir::ForeignItemKind::Fn(sig, ..) => check_item_fn(tcx, def_id, sig.decl),
+        hir::ForeignItemKind::Static(..) | hir::ForeignItemKind::Type => Ok(()),
     }
 }
 
-fn check_trait_item<'tcx>(
+pub(crate) fn check_trait_item<'tcx>(
     tcx: TyCtxt<'tcx>,
-    trait_item: &'tcx hir::TraitItem<'tcx>,
+    def_id: LocalDefId,
 ) -> Result<(), ErrorGuaranteed> {
-    let def_id = trait_item.owner_id.def_id;
-
-    crate::collect::lower_trait_item(tcx, trait_item.trait_item_id());
-
-    let (method_sig, span) = match trait_item.kind {
-        hir::TraitItemKind::Fn(ref sig, _) => (Some(sig), trait_item.span),
-        hir::TraitItemKind::Type(_bounds, Some(ty)) => (None, ty.span),
-        _ => (None, trait_item.span),
-    };
-
     // Check that an item definition in a subtrait is shadowing a supertrait item.
     lint_item_shadowing_supertrait_item(tcx, def_id);
 
-    let mut res = check_associated_item(tcx, def_id, span, method_sig);
+    let mut res = Ok(());
 
-    if matches!(trait_item.kind, hir::TraitItemKind::Fn(..)) {
+    if matches!(tcx.def_kind(def_id), DefKind::AssocFn) {
         for &assoc_ty_def_id in tcx.associated_types_for_impl_traits_in_associated_fn(def_id) {
-            res = res.and(check_associated_item(
-                tcx,
-                assoc_ty_def_id.expect_local(),
-                tcx.def_span(assoc_ty_def_id),
-                None,
-            ));
+            res = res.and(check_associated_item(tcx, assoc_ty_def_id.expect_local()));
         }
     }
     res
@@ -872,67 +805,54 @@ fn lint_item_shadowing_supertrait_item<'tcx>(tcx: TyCtxt<'tcx>, trait_item_def_i
     }
 }
 
-fn check_impl_item<'tcx>(
-    tcx: TyCtxt<'tcx>,
-    impl_item: &'tcx hir::ImplItem<'tcx>,
-) -> Result<(), ErrorGuaranteed> {
-    crate::collect::lower_impl_item(tcx, impl_item.impl_item_id());
-
-    let (method_sig, span) = match impl_item.kind {
-        hir::ImplItemKind::Fn(ref sig, _) => (Some(sig), impl_item.span),
-        // Constrain binding and overflow error spans to `<Ty>` in `type foo = <Ty>`.
-        hir::ImplItemKind::Type(ty) if ty.span != DUMMY_SP => (None, ty.span),
-        _ => (None, impl_item.span),
-    };
-    check_associated_item(tcx, impl_item.owner_id.def_id, span, method_sig)
-}
-
-fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) -> Result<(), ErrorGuaranteed> {
+fn check_param_wf(tcx: TyCtxt<'_>, param: &ty::GenericParamDef) -> Result<(), ErrorGuaranteed> {
     match param.kind {
         // We currently only check wf of const params here.
-        hir::GenericParamKind::Lifetime { .. } | hir::GenericParamKind::Type { .. } => Ok(()),
+        ty::GenericParamDefKind::Lifetime | ty::GenericParamDefKind::Type { .. } => Ok(()),
 
         // Const parameters are well formed if their type is structural match.
-        hir::GenericParamKind::Const { ty: hir_ty, default: _, synthetic: _ } => {
+        ty::GenericParamDefKind::Const { .. } => {
             let ty = tcx.type_of(param.def_id).instantiate_identity();
+            let span = tcx.def_span(param.def_id);
+            let def_id = param.def_id.expect_local();
 
             if tcx.features().unsized_const_params() {
-                enter_wf_checking_ctxt(tcx, hir_ty.span, tcx.local_parent(param.def_id), |wfcx| {
+                enter_wf_checking_ctxt(tcx, tcx.local_parent(def_id), |wfcx| {
                     wfcx.register_bound(
-                        ObligationCause::new(
-                            hir_ty.span,
-                            param.def_id,
-                            ObligationCauseCode::ConstParam(ty),
-                        ),
+                        ObligationCause::new(span, def_id, ObligationCauseCode::ConstParam(ty)),
                         wfcx.param_env,
                         ty,
-                        tcx.require_lang_item(LangItem::UnsizedConstParamTy, hir_ty.span),
+                        tcx.require_lang_item(LangItem::UnsizedConstParamTy, span),
                     );
                     Ok(())
                 })
             } else if tcx.features().adt_const_params() {
-                enter_wf_checking_ctxt(tcx, hir_ty.span, tcx.local_parent(param.def_id), |wfcx| {
+                enter_wf_checking_ctxt(tcx, tcx.local_parent(def_id), |wfcx| {
                     wfcx.register_bound(
-                        ObligationCause::new(
-                            hir_ty.span,
-                            param.def_id,
-                            ObligationCauseCode::ConstParam(ty),
-                        ),
+                        ObligationCause::new(span, def_id, ObligationCauseCode::ConstParam(ty)),
                         wfcx.param_env,
                         ty,
-                        tcx.require_lang_item(LangItem::ConstParamTy, hir_ty.span),
+                        tcx.require_lang_item(LangItem::ConstParamTy, span),
                     );
                     Ok(())
                 })
             } else {
+                let span = || {
+                    let hir::GenericParamKind::Const { ty: &hir::Ty { span, .. }, .. } =
+                        tcx.hir_node_by_def_id(def_id).expect_generic_param().kind
+                    else {
+                        bug!()
+                    };
+                    span
+                };
                 let mut diag = match ty.kind() {
                     ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) | ty::Error(_) => return Ok(()),
                     ty::FnPtr(..) => tcx.dcx().struct_span_err(
-                        hir_ty.span,
+                        span(),
                         "using function pointers as const generic parameters is forbidden",
                     ),
                     ty::RawPtr(_, _) => tcx.dcx().struct_span_err(
-                        hir_ty.span,
+                        span(),
                         "using raw pointers as const generic parameters is forbidden",
                     ),
                     _ => {
@@ -940,7 +860,7 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) -> Result<(),
                         ty.error_reported()?;
 
                         tcx.dcx().struct_span_err(
-                            hir_ty.span,
+                            span(),
                             format!(
                                 "`{ty}` is forbidden as the type of a const generic parameter",
                             ),
@@ -950,7 +870,7 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) -> Result<(),
 
                 diag.note("the only supported types are integers, `bool`, and `char`");
 
-                let cause = ObligationCause::misc(hir_ty.span, param.def_id);
+                let cause = ObligationCause::misc(span(), def_id);
                 let adt_const_params_feature_string =
                     " more complex and user defined types".to_string();
                 let may_suggest_feature = match type_allowed_to_implement_const_param_ty(
@@ -1010,15 +930,13 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) -> Result<(),
     }
 }
 
-#[instrument(level = "debug", skip(tcx, span, sig_if_method))]
-fn check_associated_item(
+#[instrument(level = "debug", skip(tcx))]
+pub(crate) fn check_associated_item(
     tcx: TyCtxt<'_>,
     item_id: LocalDefId,
-    span: Span,
-    sig_if_method: Option<&hir::FnSig<'_>>,
 ) -> Result<(), ErrorGuaranteed> {
     let loc = Some(WellFormedLoc::Ty(item_id));
-    enter_wf_checking_ctxt(tcx, span, item_id, |wfcx| {
+    enter_wf_checking_ctxt(tcx, item_id, |wfcx| {
         let item = tcx.associated_item(item_id);
 
         // Avoid bogus "type annotations needed `Foo: Bar`" errors on `impl Bar for Foo` in case
@@ -1033,6 +951,8 @@ fn check_associated_item(
             }
         };
 
+        let span = tcx.def_span(item_id);
+
         match item.kind {
             ty::AssocKind::Const { .. } => {
                 let ty = tcx.type_of(item.def_id).instantiate_identity();
@@ -1049,14 +969,9 @@ fn check_associated_item(
             }
             ty::AssocKind::Fn { .. } => {
                 let sig = tcx.fn_sig(item.def_id).instantiate_identity();
-                let hir_sig = sig_if_method.expect("bad signature for method");
-                check_fn_or_method(
-                    wfcx,
-                    item.ident(tcx).span,
-                    sig,
-                    hir_sig.decl,
-                    item.def_id.expect_local(),
-                );
+                let hir_sig =
+                    tcx.hir_node_by_def_id(item_id).fn_sig().expect("bad signature for method");
+                check_fn_or_method(wfcx, sig, hir_sig.decl, item_id);
                 check_method_receiver(wfcx, hir_sig, item, self_ty)
             }
             ty::AssocKind::Type { .. } => {
@@ -1083,7 +998,7 @@ fn check_type_defn<'tcx>(
     let _ = tcx.representability(item.owner_id.def_id);
     let adt_def = tcx.adt_def(item.owner_id);
 
-    enter_wf_checking_ctxt(tcx, item.span, item.owner_id.def_id, |wfcx| {
+    enter_wf_checking_ctxt(tcx, item.owner_id.def_id, |wfcx| {
         let variants = adt_def.variants();
         let packed = adt_def.repr().packed();
 
@@ -1185,7 +1100,7 @@ fn check_type_defn<'tcx>(
             }
         }
 
-        check_where_clauses(wfcx, item.span, item.owner_id.def_id);
+        check_where_clauses(wfcx, item.owner_id.def_id);
         Ok(())
     })
 }
@@ -1215,8 +1130,8 @@ fn check_trait(tcx: TyCtxt<'_>, item: &hir::Item<'_>) -> Result<(), ErrorGuarant
         }
     }
 
-    let res = enter_wf_checking_ctxt(tcx, item.span, def_id, |wfcx| {
-        check_where_clauses(wfcx, item.span, def_id);
+    let res = enter_wf_checking_ctxt(tcx, def_id, |wfcx| {
+        check_where_clauses(wfcx, def_id);
         Ok(())
     });
 
@@ -1252,72 +1167,63 @@ fn check_associated_type_bounds(wfcx: &WfCheckingCtxt<'_, '_>, item: ty::AssocIt
 fn check_item_fn(
     tcx: TyCtxt<'_>,
     def_id: LocalDefId,
-    ident: Ident,
-    span: Span,
     decl: &hir::FnDecl<'_>,
 ) -> Result<(), ErrorGuaranteed> {
-    enter_wf_checking_ctxt(tcx, span, def_id, |wfcx| {
+    enter_wf_checking_ctxt(tcx, def_id, |wfcx| {
         let sig = tcx.fn_sig(def_id).instantiate_identity();
-        check_fn_or_method(wfcx, ident.span, sig, decl, def_id);
+        check_fn_or_method(wfcx, sig, decl, def_id);
         Ok(())
     })
 }
 
-enum UnsizedHandling {
-    Forbid,
-    AllowIfForeignTail,
-}
-
-#[instrument(level = "debug", skip(tcx, ty_span, unsized_handling))]
-fn check_static_item(
+#[instrument(level = "debug", skip(tcx))]
+pub(super) fn check_static_item(
     tcx: TyCtxt<'_>,
     item_id: LocalDefId,
-    ty_span: Span,
-    unsized_handling: UnsizedHandling,
 ) -> Result<(), ErrorGuaranteed> {
-    enter_wf_checking_ctxt(tcx, ty_span, item_id, |wfcx| {
+    enter_wf_checking_ctxt(tcx, item_id, |wfcx| {
         let ty = tcx.type_of(item_id).instantiate_identity();
-        let item_ty = wfcx.deeply_normalize(ty_span, Some(WellFormedLoc::Ty(item_id)), ty);
-
-        let forbid_unsized = match unsized_handling {
-            UnsizedHandling::Forbid => true,
-            UnsizedHandling::AllowIfForeignTail => {
-                let tail =
-                    tcx.struct_tail_for_codegen(item_ty, wfcx.infcx.typing_env(wfcx.param_env));
-                !matches!(tail.kind(), ty::Foreign(_))
-            }
+        let item_ty = wfcx.deeply_normalize(DUMMY_SP, Some(WellFormedLoc::Ty(item_id)), ty);
+
+        let is_foreign_item = tcx.is_foreign_item(item_id);
+
+        let forbid_unsized = !is_foreign_item || {
+            let tail = tcx.struct_tail_for_codegen(item_ty, wfcx.infcx.typing_env(wfcx.param_env));
+            !matches!(tail.kind(), ty::Foreign(_))
         };
 
-        wfcx.register_wf_obligation(ty_span, Some(WellFormedLoc::Ty(item_id)), item_ty.into());
+        wfcx.register_wf_obligation(DUMMY_SP, Some(WellFormedLoc::Ty(item_id)), item_ty.into());
         if forbid_unsized {
+            let span = tcx.def_span(item_id);
             wfcx.register_bound(
                 traits::ObligationCause::new(
-                    ty_span,
+                    span,
                     wfcx.body_def_id,
                     ObligationCauseCode::SizedConstOrStatic,
                 ),
                 wfcx.param_env,
                 item_ty,
-                tcx.require_lang_item(LangItem::Sized, ty_span),
+                tcx.require_lang_item(LangItem::Sized, span),
             );
         }
 
         // Ensure that the end result is `Sync` in a non-thread local `static`.
         let should_check_for_sync = tcx.static_mutability(item_id.to_def_id())
             == Some(hir::Mutability::Not)
-            && !tcx.is_foreign_item(item_id.to_def_id())
+            && !is_foreign_item
             && !tcx.is_thread_local_static(item_id.to_def_id());
 
         if should_check_for_sync {
+            let span = tcx.def_span(item_id);
             wfcx.register_bound(
                 traits::ObligationCause::new(
-                    ty_span,
+                    span,
                     wfcx.body_def_id,
                     ObligationCauseCode::SharedStatic,
                 ),
                 wfcx.param_env,
                 item_ty,
-                tcx.require_lang_item(LangItem::Sync, ty_span),
+                tcx.require_lang_item(LangItem::Sync, span),
             );
         }
         Ok(())
@@ -1328,9 +1234,8 @@ fn check_const_item(
     tcx: TyCtxt<'_>,
     def_id: LocalDefId,
     ty_span: Span,
-    item_span: Span,
 ) -> Result<(), ErrorGuaranteed> {
-    enter_wf_checking_ctxt(tcx, ty_span, def_id, |wfcx| {
+    enter_wf_checking_ctxt(tcx, def_id, |wfcx| {
         let ty = tcx.type_of(def_id).instantiate_identity();
         let ty = wfcx.deeply_normalize(ty_span, Some(WellFormedLoc::Ty(def_id)), ty);
 
@@ -1346,7 +1251,7 @@ fn check_const_item(
             tcx.require_lang_item(LangItem::Sized, ty_span),
         );
 
-        check_where_clauses(wfcx, item_span, def_id);
+        check_where_clauses(wfcx, def_id);
 
         Ok(())
     })
@@ -1359,7 +1264,7 @@ fn check_impl<'tcx>(
     hir_self_ty: &hir::Ty<'_>,
     hir_trait_ref: &Option<hir::TraitRef<'_>>,
 ) -> Result<(), ErrorGuaranteed> {
-    enter_wf_checking_ctxt(tcx, item.span, item.owner_id.def_id, |wfcx| {
+    enter_wf_checking_ctxt(tcx, item.owner_id.def_id, |wfcx| {
         match hir_trait_ref {
             Some(hir_trait_ref) => {
                 // `#[rustc_reservation_impl]` impls are not real impls and
@@ -1443,14 +1348,14 @@ fn check_impl<'tcx>(
             }
         }
 
-        check_where_clauses(wfcx, item.span, item.owner_id.def_id);
+        check_where_clauses(wfcx, item.owner_id.def_id);
         Ok(())
     })
 }
 
 /// Checks where-clauses and inline bounds that are declared on `def_id`.
 #[instrument(level = "debug", skip(wfcx))]
-fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, span: Span, def_id: LocalDefId) {
+pub(super) fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, def_id: LocalDefId) {
     let infcx = wfcx.infcx;
     let tcx = wfcx.tcx();
 
@@ -1605,21 +1510,18 @@ fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, span: Span, def_id
 
     let predicates = predicates.instantiate_identity(tcx);
 
-    let predicates = wfcx.normalize(span, None, predicates);
-
-    debug!(?predicates.predicates);
     assert_eq!(predicates.predicates.len(), predicates.spans.len());
     let wf_obligations = predicates.into_iter().flat_map(|(p, sp)| {
+        let p = wfcx.normalize(sp, None, p);
         traits::wf::clause_obligations(infcx, wfcx.param_env, wfcx.body_def_id, p, sp)
     });
     let obligations: Vec<_> = wf_obligations.chain(default_obligations).collect();
     wfcx.register_obligations(obligations);
 }
 
-#[instrument(level = "debug", skip(wfcx, span, hir_decl))]
+#[instrument(level = "debug", skip(wfcx, hir_decl))]
 fn check_fn_or_method<'tcx>(
     wfcx: &WfCheckingCtxt<'_, 'tcx>,
-    span: Span,
     sig: ty::PolyFnSig<'tcx>,
     hir_decl: &hir::FnDecl<'_>,
     def_id: LocalDefId,
@@ -1657,7 +1559,7 @@ fn check_fn_or_method<'tcx>(
         );
     }
 
-    check_where_clauses(wfcx, span, def_id);
+    check_where_clauses(wfcx, def_id);
 
     if sig.abi == ExternAbi::RustCall {
         let span = tcx.def_span(def_id);
@@ -1746,17 +1648,18 @@ fn check_method_receiver<'tcx>(
     }
 
     let span = fn_sig.decl.inputs[0].span;
+    let loc = Some(WellFormedLoc::Param { function: method.def_id.expect_local(), param_idx: 0 });
 
     let sig = tcx.fn_sig(method.def_id).instantiate_identity();
     let sig = tcx.liberate_late_bound_regions(method.def_id, sig);
-    let sig = wfcx.normalize(span, None, sig);
+    let sig = wfcx.normalize(DUMMY_SP, loc, sig);
 
     debug!("check_method_receiver: sig={:?}", sig);
 
-    let self_ty = wfcx.normalize(span, None, self_ty);
+    let self_ty = wfcx.normalize(DUMMY_SP, loc, self_ty);
 
     let receiver_ty = sig.inputs()[0];
-    let receiver_ty = wfcx.normalize(span, None, receiver_ty);
+    let receiver_ty = wfcx.normalize(DUMMY_SP, loc, receiver_ty);
 
     // If the receiver already has errors reported, consider it valid to avoid
     // unnecessary errors (#58712).
@@ -2004,27 +1907,23 @@ fn legacy_receiver_is_implemented<'tcx>(
     }
 }
 
-fn check_variances_for_type_defn<'tcx>(
-    tcx: TyCtxt<'tcx>,
-    item: &'tcx hir::Item<'tcx>,
-    hir_generics: &hir::Generics<'tcx>,
-) {
-    match item.kind {
-        ItemKind::Enum(..) | ItemKind::Struct(..) | ItemKind::Union(..) => {
+pub(super) fn check_variances_for_type_defn<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) {
+    match tcx.def_kind(def_id) {
+        DefKind::Enum | DefKind::Struct | DefKind::Union => {
             // Ok
         }
-        ItemKind::TyAlias(..) => {
+        DefKind::TyAlias => {
             assert!(
-                tcx.type_alias_is_lazy(item.owner_id),
+                tcx.type_alias_is_lazy(def_id),
                 "should not be computing variance of non-free type alias"
             );
         }
-        kind => span_bug!(item.span, "cannot compute the variances of {kind:?}"),
+        kind => span_bug!(tcx.def_span(def_id), "cannot compute the variances of {kind:?}"),
     }
 
-    let ty_predicates = tcx.predicates_of(item.owner_id);
+    let ty_predicates = tcx.predicates_of(def_id);
     assert_eq!(ty_predicates.parent, None);
-    let variances = tcx.variances_of(item.owner_id);
+    let variances = tcx.variances_of(def_id);
 
     let mut constrained_parameters: FxHashSet<_> = variances
         .iter()
@@ -2037,8 +1936,10 @@ fn check_variances_for_type_defn<'tcx>(
 
     // Lazily calculated because it is only needed in case of an error.
     let explicitly_bounded_params = LazyCell::new(|| {
-        let icx = crate::collect::ItemCtxt::new(tcx, item.owner_id.def_id);
-        hir_generics
+        let icx = crate::collect::ItemCtxt::new(tcx, def_id);
+        tcx.hir_node_by_def_id(def_id)
+            .generics()
+            .unwrap()
             .predicates
             .iter()
             .filter_map(|predicate| match predicate.kind {
@@ -2053,8 +1954,6 @@ fn check_variances_for_type_defn<'tcx>(
             .collect::<FxHashSet<_>>()
     });
 
-    let ty_generics = tcx.generics_of(item.owner_id);
-
     for (index, _) in variances.iter().enumerate() {
         let parameter = Parameter(index as u32);
 
@@ -2062,9 +1961,13 @@ fn check_variances_for_type_defn<'tcx>(
             continue;
         }
 
-        let ty_param = &ty_generics.own_params[index];
+        let node = tcx.hir_node_by_def_id(def_id);
+        let item = node.expect_item();
+        let hir_generics = node.generics().unwrap();
         let hir_param = &hir_generics.params[index];
 
+        let ty_param = &tcx.generics_of(item.owner_id).own_params[index];
+
         if ty_param.def_id != hir_param.def_id.into() {
             // Valid programs always have lifetimes before types in the generic parameter list.
             // ty_generics are normalized to be in this required order, and variances are built
@@ -2082,7 +1985,7 @@ fn check_variances_for_type_defn<'tcx>(
 
         // Look for `ErrorGuaranteed` deeply within this type.
         if let ControlFlow::Break(ErrorGuaranteed { .. }) = tcx
-            .type_of(item.owner_id)
+            .type_of(def_id)
             .instantiate_identity()
             .visit_with(&mut HasErrorDeep { tcx, seen: Default::default() })
         {
@@ -2301,7 +2204,7 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> {
     #[instrument(level = "debug", skip(self))]
     fn check_false_global_bounds(&mut self) {
         let tcx = self.ocx.infcx.tcx;
-        let mut span = self.span;
+        let mut span = tcx.def_span(self.body_def_id);
         let empty_env = ty::ParamEnv::empty();
 
         let predicates_with_span = tcx.predicates_of(self.body_def_id).predicates.iter().copied();
diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs
index 3ee39fb71b2..b10d5b55789 100644
--- a/compiler/rustc_hir_analysis/src/collect.rs
+++ b/compiler/rustc_hir_analysis/src/collect.rs
@@ -605,159 +605,13 @@ fn get_new_lifetime_name<'tcx>(
     (1..).flat_map(a_to_z_repeat_n).find(|lt| !existing_lifetimes.contains(lt.as_str())).unwrap()
 }
 
-#[instrument(level = "debug", skip_all)]
-pub(super) fn lower_item(tcx: TyCtxt<'_>, item_id: hir::ItemId) {
-    let it = tcx.hir_item(item_id);
-    debug!(item = ?it.kind.ident(), id = %it.hir_id());
-    let def_id = item_id.owner_id.def_id;
-
-    match &it.kind {
-        // These don't define types.
-        hir::ItemKind::ExternCrate(..)
-        | hir::ItemKind::Use(..)
-        | hir::ItemKind::Macro(..)
-        | hir::ItemKind::Mod(..)
-        | hir::ItemKind::GlobalAsm { .. } => {}
-        hir::ItemKind::ForeignMod { items, .. } => {
-            for item in *items {
-                let item = tcx.hir_foreign_item(item.id);
-                tcx.ensure_ok().generics_of(item.owner_id);
-                tcx.ensure_ok().type_of(item.owner_id);
-                tcx.ensure_ok().predicates_of(item.owner_id);
-                if tcx.is_conditionally_const(def_id) {
-                    tcx.ensure_ok().explicit_implied_const_bounds(def_id);
-                    tcx.ensure_ok().const_conditions(def_id);
-                }
-                match item.kind {
-                    hir::ForeignItemKind::Fn(..) => {
-                        tcx.ensure_ok().codegen_fn_attrs(item.owner_id);
-                        tcx.ensure_ok().fn_sig(item.owner_id)
-                    }
-                    hir::ForeignItemKind::Static(..) => {
-                        tcx.ensure_ok().codegen_fn_attrs(item.owner_id);
-                    }
-                    _ => (),
-                }
-            }
-        }
-        hir::ItemKind::Enum(..) => {
-            tcx.ensure_ok().generics_of(def_id);
-            tcx.ensure_ok().type_of(def_id);
-            tcx.ensure_ok().predicates_of(def_id);
-            lower_enum_variant_types(tcx, def_id.to_def_id());
-        }
-        hir::ItemKind::Impl { .. } => {
-            tcx.ensure_ok().generics_of(def_id);
-            tcx.ensure_ok().type_of(def_id);
-            tcx.ensure_ok().impl_trait_header(def_id);
-            tcx.ensure_ok().predicates_of(def_id);
-            tcx.ensure_ok().associated_items(def_id);
-        }
-        hir::ItemKind::Trait(..) => {
-            tcx.ensure_ok().generics_of(def_id);
-            tcx.ensure_ok().trait_def(def_id);
-            tcx.at(it.span).explicit_super_predicates_of(def_id);
-            tcx.ensure_ok().predicates_of(def_id);
-            tcx.ensure_ok().associated_items(def_id);
-        }
-        hir::ItemKind::TraitAlias(..) => {
-            tcx.ensure_ok().generics_of(def_id);
-            tcx.at(it.span).explicit_implied_predicates_of(def_id);
-            tcx.at(it.span).explicit_super_predicates_of(def_id);
-            tcx.ensure_ok().predicates_of(def_id);
-        }
-        hir::ItemKind::Struct(_, _, struct_def) | hir::ItemKind::Union(_, _, struct_def) => {
-            tcx.ensure_ok().generics_of(def_id);
-            tcx.ensure_ok().type_of(def_id);
-            tcx.ensure_ok().predicates_of(def_id);
-
-            for f in struct_def.fields() {
-                tcx.ensure_ok().generics_of(f.def_id);
-                tcx.ensure_ok().type_of(f.def_id);
-                tcx.ensure_ok().predicates_of(f.def_id);
-            }
-
-            if let Some(ctor_def_id) = struct_def.ctor_def_id() {
-                lower_variant_ctor(tcx, ctor_def_id);
-            }
-        }
-
-        hir::ItemKind::TyAlias(..) => {
-            tcx.ensure_ok().generics_of(def_id);
-            tcx.ensure_ok().type_of(def_id);
-            tcx.ensure_ok().predicates_of(def_id);
-        }
-
-        hir::ItemKind::Static(..) | hir::ItemKind::Const(..) => {
-            tcx.ensure_ok().generics_of(def_id);
-            tcx.ensure_ok().type_of(def_id);
-            tcx.ensure_ok().predicates_of(def_id);
-        }
-
-        hir::ItemKind::Fn { .. } => {
-            tcx.ensure_ok().generics_of(def_id);
-            tcx.ensure_ok().type_of(def_id);
-            tcx.ensure_ok().predicates_of(def_id);
-            tcx.ensure_ok().fn_sig(def_id);
-            tcx.ensure_ok().codegen_fn_attrs(def_id);
-        }
-    }
-}
-
-pub(crate) fn lower_trait_item(tcx: TyCtxt<'_>, trait_item_id: hir::TraitItemId) {
-    let trait_item = tcx.hir_trait_item(trait_item_id);
-    let def_id = trait_item_id.owner_id;
-    tcx.ensure_ok().generics_of(def_id);
-
-    match trait_item.kind {
-        hir::TraitItemKind::Fn(..) => {
-            tcx.ensure_ok().codegen_fn_attrs(def_id);
-            tcx.ensure_ok().type_of(def_id);
-            tcx.ensure_ok().fn_sig(def_id);
-        }
-
-        hir::TraitItemKind::Const(..) => {
-            tcx.ensure_ok().type_of(def_id);
-        }
-
-        hir::TraitItemKind::Type(_, Some(_)) => {
-            tcx.ensure_ok().item_bounds(def_id);
-            tcx.ensure_ok().item_self_bounds(def_id);
-            tcx.ensure_ok().type_of(def_id);
-        }
-
-        hir::TraitItemKind::Type(_, None) => {
-            tcx.ensure_ok().item_bounds(def_id);
-            tcx.ensure_ok().item_self_bounds(def_id);
-        }
-    };
-
-    tcx.ensure_ok().predicates_of(def_id);
-}
-
-pub(super) fn lower_impl_item(tcx: TyCtxt<'_>, impl_item_id: hir::ImplItemId) {
-    let def_id = impl_item_id.owner_id;
-    tcx.ensure_ok().generics_of(def_id);
-    tcx.ensure_ok().type_of(def_id);
-    tcx.ensure_ok().predicates_of(def_id);
-    let impl_item = tcx.hir_impl_item(impl_item_id);
-    match impl_item.kind {
-        hir::ImplItemKind::Fn(..) => {
-            tcx.ensure_ok().codegen_fn_attrs(def_id);
-            tcx.ensure_ok().fn_sig(def_id);
-        }
-        hir::ImplItemKind::Type(_) => {}
-        hir::ImplItemKind::Const(..) => {}
-    }
-}
-
-fn lower_variant_ctor(tcx: TyCtxt<'_>, def_id: LocalDefId) {
+pub(super) fn lower_variant_ctor(tcx: TyCtxt<'_>, def_id: LocalDefId) {
     tcx.ensure_ok().generics_of(def_id);
     tcx.ensure_ok().type_of(def_id);
     tcx.ensure_ok().predicates_of(def_id);
 }
 
-fn lower_enum_variant_types(tcx: TyCtxt<'_>, def_id: DefId) {
+pub(super) fn lower_enum_variant_types(tcx: TyCtxt<'_>, def_id: DefId) {
     let def = tcx.adt_def(def_id);
     let repr_type = def.repr().discr_type();
     let initial = repr_type.initial_discriminant(tcx);
diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs
index 02edf482795..c72eff1d231 100644
--- a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs
+++ b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs
@@ -1186,7 +1186,12 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
         ty: Ty<'tcx>,
         obligation: &PredicateObligation<'tcx>,
     ) -> Diag<'a> {
-        let span = obligation.cause.span;
+        let param = obligation.cause.body_id;
+        let hir::GenericParamKind::Const { ty: &hir::Ty { span, .. }, .. } =
+            self.tcx.hir_node_by_def_id(param).expect_generic_param().kind
+        else {
+            bug!()
+        };
 
         let mut diag = match ty.kind() {
             ty::Float(_) => {
diff --git a/tests/incremental/issue-54242.rs b/tests/incremental/issue-54242.rs
index 9fa5363e004..17bbd619a8f 100644
--- a/tests/incremental/issue-54242.rs
+++ b/tests/incremental/issue-54242.rs
@@ -14,7 +14,7 @@ impl Tr for str {
     type Arr = [u8; 8];
     #[cfg(cfail)]
     type Arr = [u8; Self::C];
-    //[cfail]~^ ERROR cycle detected when evaluating type-level constant
+    //[cfail]~^ ERROR cycle detected when caching mir
 }
 
 fn main() {}
diff --git a/tests/ui/associated-consts/assoc-const-eq-bound-var-in-ty-not-wf.rs b/tests/ui/associated-consts/assoc-const-eq-bound-var-in-ty-not-wf.rs
index a718eb23bed..e583b12b1d7 100644
--- a/tests/ui/associated-consts/assoc-const-eq-bound-var-in-ty-not-wf.rs
+++ b/tests/ui/associated-consts/assoc-const-eq-bound-var-in-ty-not-wf.rs
@@ -12,7 +12,7 @@ fn take(
         K = { () }
     >,
 ) {}
-//~^^^^^^ ERROR implementation of `Project` is not general enough
+//~^^^^^ ERROR implementation of `Project` is not general enough
 //~^^^^ ERROR higher-ranked subtype error
 //~| ERROR higher-ranked subtype error
 
diff --git a/tests/ui/associated-consts/assoc-const-eq-bound-var-in-ty-not-wf.stderr b/tests/ui/associated-consts/assoc-const-eq-bound-var-in-ty-not-wf.stderr
index 967814c9c3d..42e084f39c0 100644
--- a/tests/ui/associated-consts/assoc-const-eq-bound-var-in-ty-not-wf.stderr
+++ b/tests/ui/associated-consts/assoc-const-eq-bound-var-in-ty-not-wf.stderr
@@ -13,10 +13,14 @@ LL |         K = { () }
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: implementation of `Project` is not general enough
-  --> $DIR/assoc-const-eq-bound-var-in-ty-not-wf.rs:9:4
+  --> $DIR/assoc-const-eq-bound-var-in-ty-not-wf.rs:10:13
    |
-LL | fn take(
-   |    ^^^^ implementation of `Project` is not general enough
+LL |       _: impl Trait<
+   |  _____________^
+LL | |         <<for<'a> fn(&'a str) -> &'a str as Project>::Out as Discard>::Out,
+LL | |         K = { () }
+LL | |     >,
+   | |_____^ implementation of `Project` is not general enough
    |
    = note: `Project` would have to be implemented for the type `for<'a> fn(&'a str) -> &'a str`
    = note: ...but `Project` is actually implemented for the type `fn(&'0 str) -> &'0 str`, for some specific lifetime `'0`
diff --git a/tests/ui/associated-inherent-types/issue-111879-0.stderr b/tests/ui/associated-inherent-types/issue-111879-0.stderr
index f60fd58c23b..144f6486b3b 100644
--- a/tests/ui/associated-inherent-types/issue-111879-0.stderr
+++ b/tests/ui/associated-inherent-types/issue-111879-0.stderr
@@ -1,8 +1,8 @@
 error: overflow evaluating associated type `Carrier<'b>::Focus<i32>`
-  --> $DIR/issue-111879-0.rs:9:25
+  --> $DIR/issue-111879-0.rs:9:5
    |
 LL |     pub type Focus<T> = &'a mut for<'b> fn(Carrier<'b>::Focus<i32>);
-   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/associated-inherent-types/normalization-overflow.stderr b/tests/ui/associated-inherent-types/normalization-overflow.stderr
index 7f991a53c9b..05aad31c5f4 100644
--- a/tests/ui/associated-inherent-types/normalization-overflow.stderr
+++ b/tests/ui/associated-inherent-types/normalization-overflow.stderr
@@ -1,8 +1,8 @@
 error: overflow evaluating associated type `T::This`
-  --> $DIR/normalization-overflow.rs:9:17
+  --> $DIR/normalization-overflow.rs:9:5
    |
 LL |     type This = Self::This;
-   |                 ^^^^^^^^^^
+   |     ^^^^^^^^^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/associated-inherent-types/regionck-1.stderr b/tests/ui/associated-inherent-types/regionck-1.stderr
index 62a00868248..4e0ecc3c80e 100644
--- a/tests/ui/associated-inherent-types/regionck-1.stderr
+++ b/tests/ui/associated-inherent-types/regionck-1.stderr
@@ -1,10 +1,11 @@
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/regionck-1.rs:9:30
+  --> $DIR/regionck-1.rs:9:5
    |
 LL |     type NoTyOutliv<'a, T> = &'a T;
-   |                     --       ^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at
-   |                     |
-   |                     the parameter type `T` must be valid for the lifetime `'a` as defined here...
+   |     ^^^^^^^^^^^^^^^^--^^^^
+   |     |               |
+   |     |               the parameter type `T` must be valid for the lifetime `'a` as defined here...
+   |     ...so that the reference type `&'a T` does not outlive the data it points at
    |
 help: consider adding an explicit lifetime bound
    |
@@ -12,10 +13,10 @@ LL |     type NoTyOutliv<'a, T: 'a> = &'a T;
    |                          ++++
 
 error[E0491]: in type `&'a &'b ()`, reference has a longer lifetime than the data it references
-  --> $DIR/regionck-1.rs:10:31
+  --> $DIR/regionck-1.rs:10:5
    |
 LL |     type NoReOutliv<'a, 'b> = &'a &'b ();
-   |                               ^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: the pointer is valid for the lifetime `'a` as defined here
   --> $DIR/regionck-1.rs:10:21
diff --git a/tests/ui/associated-types/impl-wf-cycle-4.stderr b/tests/ui/associated-types/impl-wf-cycle-4.stderr
index c966579aecf..fac06e64a31 100644
--- a/tests/ui/associated-types/impl-wf-cycle-4.stderr
+++ b/tests/ui/associated-types/impl-wf-cycle-4.stderr
@@ -1,4 +1,4 @@
-error[E0391]: cycle detected when computing normalized predicates of `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>`
+error[E0391]: cycle detected when computing whether `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>` has a guaranteed unsized self type
   --> $DIR/impl-wf-cycle-4.rs:5:1
    |
 LL | / impl<T> Filter for T
@@ -6,14 +6,14 @@ LL | | where
 LL | |     T: Fn(Self::ToMatch),
    | |_________________________^
    |
-note: ...which requires computing whether `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>` has a guaranteed unsized self type...
+note: ...which requires computing normalized predicates of `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>`...
   --> $DIR/impl-wf-cycle-4.rs:5:1
    |
 LL | / impl<T> Filter for T
 LL | | where
 LL | |     T: Fn(Self::ToMatch),
    | |_________________________^
-   = note: ...which again requires computing normalized predicates of `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>`, completing the cycle
+   = note: ...which again requires computing whether `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>` has a guaranteed unsized self type, completing the cycle
 note: cycle used when checking that `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>` is well-formed
   --> $DIR/impl-wf-cycle-4.rs:5:1
    |
diff --git a/tests/ui/associated-types/issue-38821.rs b/tests/ui/associated-types/issue-38821.rs
index c9be1369f16..60d3b224a5b 100644
--- a/tests/ui/associated-types/issue-38821.rs
+++ b/tests/ui/associated-types/issue-38821.rs
@@ -32,16 +32,16 @@ pub trait Column: Expression {}
 //~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
 //~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
 //~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
+pub enum ColumnInsertValue<Col, Expr> where
+//~^ ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
+    Col: Column,
+    Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
+//~^ ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
 //~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
 //~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
 //~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
 //~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
 //~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
-pub enum ColumnInsertValue<Col, Expr> where
-//~^ ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
-//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
-    Col: Column,
-    Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
 {
     Expression(Col, Expr),
     Default(Col),
diff --git a/tests/ui/associated-types/issue-38821.stderr b/tests/ui/associated-types/issue-38821.stderr
index 8a19142b730..b03a3cf7f47 100644
--- a/tests/ui/associated-types/issue-38821.stderr
+++ b/tests/ui/associated-types/issue-38821.stderr
@@ -1,5 +1,5 @@
 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
-  --> $DIR/issue-38821.rs:40:1
+  --> $DIR/issue-38821.rs:35:1
    |
 LL | pub enum ColumnInsertValue<Col, Expr> where
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
@@ -17,16 +17,10 @@ LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Co
    |                                                                         +++++++++++++++++++++++++++++++++++++
 
 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
-  --> $DIR/issue-38821.rs:40:1
+  --> $DIR/issue-38821.rs:38:22
    |
-LL | / pub enum ColumnInsertValue<Col, Expr> where
-LL | |
-LL | |
-LL | |     Col: Column,
-...  |
-LL | |     Default(Col),
-LL | | }
-   | |_^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
+LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
+   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
    |
 note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   --> $DIR/issue-38821.rs:9:18
@@ -71,11 +65,6 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         -------  ^^^^^^^^^^^^     ^
    |         |
    |         unsatisfied trait bound introduced here
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-help: consider further restricting the associated type
-   |
-LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
-   |                                                                       +++++++++++++++++++++++++++++++++++++++
 
 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   --> $DIR/issue-38821.rs:23:10
@@ -90,12 +79,13 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         -------  ^^^^^^^^^^^^     ^
    |         |
    |         unsatisfied trait bound introduced here
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
-  --> $DIR/issue-38821.rs:23:10
+  --> $DIR/issue-38821.rs:38:22
    |
-LL | #[derive(Debug, Copy, Clone)]
-   |          ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
+LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
+   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
    |
 note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   --> $DIR/issue-38821.rs:9:18
@@ -104,7 +94,10 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         -------  ^^^^^^^^^^^^     ^
    |         |
    |         unsatisfied trait bound introduced here
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: consider further restricting the associated type
+   |
+LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
+   |                                                                       +++++++++++++++++++++++++++++++++++++++
 
 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   --> $DIR/issue-38821.rs:23:17
@@ -125,10 +118,10 @@ LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Co
    |                                                                       +++++++++++++++++++++++++++++++++++++++
 
 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
-  --> $DIR/issue-38821.rs:23:17
+  --> $DIR/issue-38821.rs:38:22
    |
-LL | #[derive(Debug, Copy, Clone)]
-   |                 ^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
+LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
+   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
    |
 note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   --> $DIR/issue-38821.rs:9:18
@@ -137,7 +130,6 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         -------  ^^^^^^^^^^^^     ^
    |         |
    |         unsatisfied trait bound introduced here
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 help: consider further restricting the associated type
    |
 LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
@@ -174,11 +166,6 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         -------  ^^^^^^^^^^^^     ^
    |         |
    |         unsatisfied trait bound introduced here
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-help: consider further restricting the associated type
-   |
-LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
-   |                                                                       +++++++++++++++++++++++++++++++++++++++
 
 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   --> $DIR/issue-38821.rs:23:23
@@ -193,12 +180,13 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         -------  ^^^^^^^^^^^^     ^
    |         |
    |         unsatisfied trait bound introduced here
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
-  --> $DIR/issue-38821.rs:23:23
+  --> $DIR/issue-38821.rs:38:22
    |
-LL | #[derive(Debug, Copy, Clone)]
-   |                       ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
+LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
+   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
    |
 note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   --> $DIR/issue-38821.rs:9:18
@@ -207,7 +195,10 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         -------  ^^^^^^^^^^^^     ^
    |         |
    |         unsatisfied trait bound introduced here
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: consider further restricting the associated type
+   |
+LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
+   |                                                                       +++++++++++++++++++++++++++++++++++++++
 
 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   --> $DIR/issue-38821.rs:23:10
@@ -225,10 +216,10 @@ LL | impl<T: NotNull> IntoNullable for T {
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
-  --> $DIR/issue-38821.rs:23:10
+  --> $DIR/issue-38821.rs:38:22
    |
-LL | #[derive(Debug, Copy, Clone)]
-   |          ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
+LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
+   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
    |
 note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   --> $DIR/issue-38821.rs:9:18
@@ -237,7 +228,6 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         -------  ^^^^^^^^^^^^     ^
    |         |
    |         unsatisfied trait bound introduced here
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   --> $DIR/issue-38821.rs:23:23
@@ -255,10 +245,10 @@ LL | impl<T: NotNull> IntoNullable for T {
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
-  --> $DIR/issue-38821.rs:23:23
+  --> $DIR/issue-38821.rs:38:22
    |
-LL | #[derive(Debug, Copy, Clone)]
-   |                       ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
+LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
+   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
    |
 note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   --> $DIR/issue-38821.rs:9:18
diff --git a/tests/ui/associated-types/issue-59324.rs b/tests/ui/associated-types/issue-59324.rs
index 3abe8473052..9d4c7cb39ae 100644
--- a/tests/ui/associated-types/issue-59324.rs
+++ b/tests/ui/associated-types/issue-59324.rs
@@ -10,8 +10,8 @@ pub trait Service {
 
 pub trait ThriftService<Bug: NotFoo>:
 //~^ ERROR the trait bound `Bug: Foo` is not satisfied
-//~| ERROR the trait bound `Bug: Foo` is not satisfied
     Service<AssocType = <Bug as Foo>::OnlyFoo>
+//~^ ERROR the trait bound `Bug: Foo` is not satisfied
 {
     fn get_service(
     //~^ 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 f79afc89d10..3e2b0f41889 100644
--- a/tests/ui/associated-types/issue-59324.stderr
+++ b/tests/ui/associated-types/issue-59324.stderr
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `Bug: Foo` is not satisfied
   --> $DIR/issue-59324.rs:11:1
    |
 LL | / pub trait ThriftService<Bug: NotFoo>:
-...  |
+LL | |
 LL | |     Service<AssocType = <Bug as Foo>::OnlyFoo>
    | |______________________________________________^ the trait `Foo` is not implemented for `Bug`
    |
@@ -12,15 +12,10 @@ LL | pub trait ThriftService<Bug: NotFoo + Foo>:
    |                                     +++++
 
 error[E0277]: the trait bound `Bug: Foo` is not satisfied
-  --> $DIR/issue-59324.rs:11:1
+  --> $DIR/issue-59324.rs:13:13
    |
-LL | / pub trait ThriftService<Bug: NotFoo>:
-LL | |
-LL | |
-LL | |     Service<AssocType = <Bug as Foo>::OnlyFoo>
-...  |
-LL | | }
-   | |_^ the trait `Foo` is not implemented for `Bug`
+LL |     Service<AssocType = <Bug as Foo>::OnlyFoo>
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `Bug`
    |
 help: consider further restricting type parameter `Bug` with trait `Foo`
    |
diff --git a/tests/ui/async-await/async-fn/impl-header.stderr b/tests/ui/async-await/async-fn/impl-header.stderr
index 64a98aab17b..2fc7a900a1e 100644
--- a/tests/ui/async-await/async-fn/impl-header.stderr
+++ b/tests/ui/async-await/async-fn/impl-header.stderr
@@ -22,6 +22,14 @@ LL | impl async Fn<()> for F {}
    |
    = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
 
+error[E0046]: not all trait items implemented, missing: `call`
+  --> $DIR/impl-header.rs:5:1
+   |
+LL | impl async Fn<()> for F {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation
+   |
+   = help: implement the missing item: `fn call(&self, _: ()) -> <Self as FnOnce<()>>::Output { todo!() }`
+
 error[E0277]: expected a `FnMut()` closure, found `F`
   --> $DIR/impl-header.rs:5:23
    |
@@ -33,14 +41,6 @@ LL | impl async Fn<()> for F {}
 note: required by a bound in `Fn`
   --> $SRC_DIR/core/src/ops/function.rs:LL:COL
 
-error[E0046]: not all trait items implemented, missing: `call`
-  --> $DIR/impl-header.rs:5:1
-   |
-LL | impl async Fn<()> for F {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation
-   |
-   = help: implement the missing item: `fn call(&self, _: ()) -> <Self as FnOnce<()>>::Output { todo!() }`
-
 error: aborting due to 5 previous errors
 
 Some errors have detailed explanations: E0046, E0183, E0277, E0658.
diff --git a/tests/ui/coherence/coherence-impl-trait-for-trait-dyn-compatible.stderr b/tests/ui/coherence/coherence-impl-trait-for-trait-dyn-compatible.stderr
index 033bfee226f..aafedc30b17 100644
--- a/tests/ui/coherence/coherence-impl-trait-for-trait-dyn-compatible.stderr
+++ b/tests/ui/coherence/coherence-impl-trait-for-trait-dyn-compatible.stderr
@@ -1,3 +1,11 @@
+error[E0046]: not all trait items implemented, missing: `eq`
+  --> $DIR/coherence-impl-trait-for-trait-dyn-compatible.rs:7:1
+   |
+LL | trait DynIncompatible { fn eq(&self, other: Self); }
+   |                         -------------------------- `eq` from trait
+LL | impl DynIncompatible for dyn DynIncompatible { }
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `eq` in implementation
+
 error[E0038]: the trait `DynIncompatible` is not dyn compatible
   --> $DIR/coherence-impl-trait-for-trait-dyn-compatible.rs:7:26
    |
@@ -14,14 +22,6 @@ LL | trait DynIncompatible { fn eq(&self, other: Self); }
    |       this trait is not dyn compatible...
    = help: consider moving `eq` to another trait
 
-error[E0046]: not all trait items implemented, missing: `eq`
-  --> $DIR/coherence-impl-trait-for-trait-dyn-compatible.rs:7:1
-   |
-LL | trait DynIncompatible { fn eq(&self, other: Self); }
-   |                         -------------------------- `eq` from trait
-LL | impl DynIncompatible for dyn DynIncompatible { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `eq` in implementation
-
 error: aborting due to 2 previous errors
 
 Some errors have detailed explanations: E0038, E0046.
diff --git a/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr b/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr
index 01b6eaf422e..fe28f4ff136 100644
--- a/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr
+++ b/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr
@@ -1,3 +1,12 @@
+error[E0046]: not all trait items implemented, missing: `Assoc`
+  --> $DIR/best-obligation-ICE.rs:10:1
+   |
+LL |     type Assoc;
+   |     ---------- `Assoc` from trait
+...
+LL | impl<T> Trait for W<W<W<T>>> {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Assoc` in implementation
+
 error[E0277]: the trait bound `W<W<T>>: Trait` is not satisfied
   --> $DIR/best-obligation-ICE.rs:10:19
    |
@@ -46,15 +55,6 @@ help: consider restricting type parameter `T` with trait `Trait`
 LL | impl<T: Trait> Trait for W<W<W<T>>> {}
    |       +++++++
 
-error[E0046]: not all trait items implemented, missing: `Assoc`
-  --> $DIR/best-obligation-ICE.rs:10:1
-   |
-LL |     type Assoc;
-   |     ---------- `Assoc` from trait
-...
-LL | impl<T> Trait for W<W<W<T>>> {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Assoc` in implementation
-
 error[E0119]: conflicting implementations of trait `NoOverlap` for type `W<W<W<W<_>>>>`
   --> $DIR/best-obligation-ICE.rs:18:1
    |
diff --git a/tests/ui/const-generics/generic_const_exprs/post-analysis-user-facing-param-env.rs b/tests/ui/const-generics/generic_const_exprs/post-analysis-user-facing-param-env.rs
index e5af632da75..478fa3706e8 100644
--- a/tests/ui/const-generics/generic_const_exprs/post-analysis-user-facing-param-env.rs
+++ b/tests/ui/const-generics/generic_const_exprs/post-analysis-user-facing-param-env.rs
@@ -5,6 +5,7 @@
 struct Foo;
 impl<'a, const NUM: usize> std::ops::Add<&'a Foo> for Foo
 //~^ ERROR the const parameter `NUM` is not constrained by the impl trait, self type, or predicates
+//~| ERROR missing: `Output`, `add`
 where
     [(); 1 + 0]: Sized,
 {
diff --git a/tests/ui/const-generics/generic_const_exprs/post-analysis-user-facing-param-env.stderr b/tests/ui/const-generics/generic_const_exprs/post-analysis-user-facing-param-env.stderr
index ade18eb88b9..29bbd23a469 100644
--- a/tests/ui/const-generics/generic_const_exprs/post-analysis-user-facing-param-env.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/post-analysis-user-facing-param-env.stderr
@@ -1,5 +1,5 @@
 error[E0407]: method `unimplemented` is not a member of trait `std::ops::Add`
-  --> $DIR/post-analysis-user-facing-param-env.rs:11:5
+  --> $DIR/post-analysis-user-facing-param-env.rs:12:5
    |
 LL | /     fn unimplemented(self, _: &Foo) -> Self::Output {
 LL | |
@@ -17,6 +17,19 @@ LL | #![feature(generic_const_exprs)]
    = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
    = note: `#[warn(incomplete_features)]` on by default
 
+error[E0046]: not all trait items implemented, missing: `Output`, `add`
+  --> $DIR/post-analysis-user-facing-param-env.rs:6:1
+   |
+LL | / impl<'a, const NUM: usize> std::ops::Add<&'a Foo> for Foo
+LL | |
+LL | |
+LL | | where
+LL | |     [(); 1 + 0]: Sized,
+   | |_______________________^ missing `Output`, `add` in implementation
+   |
+   = help: implement the missing item: `type Output = /* Type */;`
+   = help: implement the missing item: `fn add(self, _: &'a Foo) -> <Self as Add<&'a Foo>>::Output { todo!() }`
+
 error[E0207]: the const parameter `NUM` is not constrained by the impl trait, self type, or predicates
   --> $DIR/post-analysis-user-facing-param-env.rs:6:10
    |
@@ -27,7 +40,7 @@ LL | impl<'a, const NUM: usize> std::ops::Add<&'a Foo> for Foo
    = note: proving the result of expressions other than the parameter are unique is not supported
 
 error[E0284]: type annotations needed
-  --> $DIR/post-analysis-user-facing-param-env.rs:11:40
+  --> $DIR/post-analysis-user-facing-param-env.rs:12:40
    |
 LL |     fn unimplemented(self, _: &Foo) -> Self::Output {
    |                                        ^^^^^^^^^^^^ cannot infer the value of const parameter `NUM`
@@ -40,7 +53,7 @@ LL | impl<'a, const NUM: usize> std::ops::Add<&'a Foo> for Foo
    |          |
    |          unsatisfied trait bound introduced here
 
-error: aborting due to 3 previous errors; 1 warning emitted
+error: aborting due to 4 previous errors; 1 warning emitted
 
-Some errors have detailed explanations: E0207, E0284, E0407.
-For more information about an error, try `rustc --explain E0207`.
+Some errors have detailed explanations: E0046, E0207, E0284, E0407.
+For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr b/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr
index 7cb67252da5..3b4b5798c80 100644
--- a/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr
@@ -1,11 +1,3 @@
-error: the constant `N` is not of type `usize`
-  --> $DIR/type_mismatch.rs:8:26
-   |
-LL | impl<const N: u64> Q for [u8; N] {}
-   |                          ^^^^^^^ expected `usize`, found `u64`
-   |
-   = note: the length of array `[u8; N]` must be type `usize`
-
 error[E0046]: not all trait items implemented, missing: `ASSOC`
   --> $DIR/type_mismatch.rs:8:1
    |
@@ -15,6 +7,14 @@ LL |     const ASSOC: usize;
 LL | impl<const N: u64> Q for [u8; N] {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `ASSOC` in implementation
 
+error: the constant `N` is not of type `usize`
+  --> $DIR/type_mismatch.rs:8:26
+   |
+LL | impl<const N: u64> Q for [u8; N] {}
+   |                          ^^^^^^^ expected `usize`, found `u64`
+   |
+   = note: the length of array `[u8; N]` must be type `usize`
+
 error: the constant `13` is not of type `u64`
   --> $DIR/type_mismatch.rs:12:26
    |
diff --git a/tests/ui/const-generics/ice-unexpected-inference-var-122549.rs b/tests/ui/const-generics/ice-unexpected-inference-var-122549.rs
index 126ea667290..34c7a252f11 100644
--- a/tests/ui/const-generics/ice-unexpected-inference-var-122549.rs
+++ b/tests/ui/const-generics/ice-unexpected-inference-var-122549.rs
@@ -15,6 +15,7 @@ struct ConstChunksExact<'rem, T: 'a, const N: usize> {}
 impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
 //~^ ERROR the const parameter `N` is not constrained by the impl trait, self type, or predicates
 //~^^ ERROR mismatched types
+//~| ERROR missing: `next`
     type Item = &'a [T; N];
 }
 
diff --git a/tests/ui/const-generics/ice-unexpected-inference-var-122549.stderr b/tests/ui/const-generics/ice-unexpected-inference-var-122549.stderr
index 3b24808cd16..311caaede09 100644
--- a/tests/ui/const-generics/ice-unexpected-inference-var-122549.stderr
+++ b/tests/ui/const-generics/ice-unexpected-inference-var-122549.stderr
@@ -49,6 +49,20 @@ LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {}
    |
    = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
 
+error[E0308]: mismatched types
+  --> $DIR/ice-unexpected-inference-var-122549.rs:15:66
+   |
+LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
+   |                                                                  ^^ expected `usize`, found `()`
+
+error[E0046]: not all trait items implemented, missing: `next`
+  --> $DIR/ice-unexpected-inference-var-122549.rs:15:1
+   |
+LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `next` in implementation
+   |
+   = help: implement the missing item: `fn next(&mut self) -> Option<<Self as Iterator>::Item> { todo!() }`
+
 error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates
   --> $DIR/ice-unexpected-inference-var-122549.rs:15:13
    |
@@ -58,13 +72,7 @@ LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
    = note: expressions using a const parameter must map each value to a distinct output value
    = note: proving the result of expressions other than the parameter are unique is not supported
 
-error[E0308]: mismatched types
-  --> $DIR/ice-unexpected-inference-var-122549.rs:15:66
-   |
-LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
-   |                                                                  ^^ expected `usize`, found `()`
-
-error: aborting due to 7 previous errors
+error: aborting due to 8 previous errors
 
 Some errors have detailed explanations: E0046, E0207, E0261, E0308, E0392.
 For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/const-generics/issues/issue-71202.stderr b/tests/ui/const-generics/issues/issue-71202.stderr
index b7c3db494a5..dd0611a7223 100644
--- a/tests/ui/const-generics/issues/issue-71202.stderr
+++ b/tests/ui/const-generics/issues/issue-71202.stderr
@@ -7,7 +7,7 @@ LL | |             const VALUE: bool = false;
 ...  |
 LL | |         <IsCopy<T>>::VALUE
 LL | |     } as usize] = [];
-   | |_____________________^
+   | |_______________^
    |
 help: try adding a `where` bound
    |
diff --git a/tests/ui/const-generics/normalizing_with_unconstrained_impl_params.rs b/tests/ui/const-generics/normalizing_with_unconstrained_impl_params.rs
index ba37087135f..9a39ab1ba02 100644
--- a/tests/ui/const-generics/normalizing_with_unconstrained_impl_params.rs
+++ b/tests/ui/const-generics/normalizing_with_unconstrained_impl_params.rs
@@ -14,5 +14,6 @@ impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T
     //~^ ERROR mismatched types [E0308]
     //~| ERROR the const parameter `N` is not constrained by the impl trait, self type, or predicates [E0207]
     type Item = &'a [T; N]; }
+    //~^ ERROR: `Item` specializes an item from a parent `impl`, but that item is not marked `default`
 
 fn main() {}
diff --git a/tests/ui/const-generics/normalizing_with_unconstrained_impl_params.stderr b/tests/ui/const-generics/normalizing_with_unconstrained_impl_params.stderr
index 1ee68647594..ad89705e1dc 100644
--- a/tests/ui/const-generics/normalizing_with_unconstrained_impl_params.stderr
+++ b/tests/ui/const-generics/normalizing_with_unconstrained_impl_params.stderr
@@ -34,6 +34,17 @@ LL | struct ConstChunksExact<'a, T: '_, const assert: usize> {}
    |
    = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
 
+error[E0520]: `Item` specializes an item from a parent `impl`, but that item is not marked `default`
+  --> $DIR/normalizing_with_unconstrained_impl_params.rs:16:5
+   |
+LL | impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T, { N }> {
+   | ---------------------------------------------------------------------------------------- parent `impl` is here
+...
+LL |     type Item = &'a [T; N]; }
+   |     ^^^^^^^^^ cannot specialize default item `Item`
+   |
+   = note: to specialize, `Item` in the parent `impl` must be marked `default`
+
 error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates
   --> $DIR/normalizing_with_unconstrained_impl_params.rs:13:30
    |
@@ -54,7 +65,7 @@ LL |     fn next(&mut self) -> Option<Self::Item> {}
    = note:   expected enum `Option<_>`
            found unit type `()`
 
-error: aborting due to 7 previous errors
+error: aborting due to 8 previous errors
 
-Some errors have detailed explanations: E0046, E0207, E0308, E0392, E0637.
+Some errors have detailed explanations: E0046, E0207, E0308, E0392, E0520, E0637.
 For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/const-generics/not_wf_param_in_rpitit.stderr b/tests/ui/const-generics/not_wf_param_in_rpitit.stderr
index 42ae012fa55..3612cfad0d4 100644
--- a/tests/ui/const-generics/not_wf_param_in_rpitit.stderr
+++ b/tests/ui/const-generics/not_wf_param_in_rpitit.stderr
@@ -11,7 +11,7 @@ LL | trait Trait<const N: dyn Trait = bar> {
    |                          ^^^^^
    |
    = note: ...which immediately requires computing type of `Trait::N` again
-note: cycle used when computing explicit predicates of trait `Trait`
+note: cycle used when checking that `Trait` is well-formed
   --> $DIR/not_wf_param_in_rpitit.rs:3:1
    |
 LL | trait Trait<const N: dyn Trait = bar> {
diff --git a/tests/ui/consts/const-unsized.stderr b/tests/ui/consts/const-unsized.stderr
index cee364b33f7..c92fbc17f9c 100644
--- a/tests/ui/consts/const-unsized.stderr
+++ b/tests/ui/consts/const-unsized.stderr
@@ -17,19 +17,19 @@ LL | const CONST_FOO: str = *"foo";
    = note: statics and constants must have a statically known size
 
 error[E0277]: the size for values of type `(dyn Debug + Sync + 'static)` cannot be known at compilation time
-  --> $DIR/const-unsized.rs:11:18
+  --> $DIR/const-unsized.rs:11:1
    |
 LL | static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync));
-   |                  ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)`
    = note: statics and constants must have a statically known size
 
 error[E0277]: the size for values of type `str` cannot be known at compilation time
-  --> $DIR/const-unsized.rs:15:20
+  --> $DIR/const-unsized.rs:15:1
    |
 LL | static STATIC_BAR: str = *"bar";
-   |                    ^^^ doesn't have a size known at compile-time
+   | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `Sized` is not implemented for `str`
    = note: statics and constants must have a statically known size
diff --git a/tests/ui/consts/const_refs_to_static-ice-121413.stderr b/tests/ui/consts/const_refs_to_static-ice-121413.stderr
index 3980a7e9b93..1263deebf76 100644
--- a/tests/ui/consts/const_refs_to_static-ice-121413.stderr
+++ b/tests/ui/consts/const_refs_to_static-ice-121413.stderr
@@ -24,10 +24,10 @@ LL |     static FOO: dyn Sync = AtomicUsize::new(0);
    |                 +++
 
 error[E0277]: the size for values of type `(dyn Sync + 'static)` cannot be known at compilation time
-  --> $DIR/const_refs_to_static-ice-121413.rs:8:17
+  --> $DIR/const_refs_to_static-ice-121413.rs:8:5
    |
 LL |     static FOO: Sync = AtomicUsize::new(0);
-   |                 ^^^^ doesn't have a size known at compile-time
+   |     ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `Sized` is not implemented for `(dyn Sync + 'static)`
    = note: statics and constants must have a statically known size
diff --git a/tests/ui/consts/dont-ctfe-unsized-initializer.stderr b/tests/ui/consts/dont-ctfe-unsized-initializer.stderr
index e69790fc182..5b0a0166f31 100644
--- a/tests/ui/consts/dont-ctfe-unsized-initializer.stderr
+++ b/tests/ui/consts/dont-ctfe-unsized-initializer.stderr
@@ -1,8 +1,8 @@
 error[E0277]: the size for values of type `str` cannot be known at compilation time
-  --> $DIR/dont-ctfe-unsized-initializer.rs:1:11
+  --> $DIR/dont-ctfe-unsized-initializer.rs:1:1
    |
 LL | static S: str = todo!();
-   |           ^^^ doesn't have a size known at compile-time
+   | ^^^^^^^^^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `Sized` is not implemented for `str`
    = note: statics and constants must have a statically known size
diff --git a/tests/ui/consts/issue-103790.stderr b/tests/ui/consts/issue-103790.stderr
index 1515fa60a5c..adfac02bd0c 100644
--- a/tests/ui/consts/issue-103790.stderr
+++ b/tests/ui/consts/issue-103790.stderr
@@ -29,7 +29,7 @@ LL | struct S<const S: (), const S: S = { S }>;
    |                                ^
    |
    = note: ...which immediately requires computing type of `S::S` again
-note: cycle used when computing explicit predicates of `S`
+note: cycle used when checking that `S` is well-formed
   --> $DIR/issue-103790.rs:4:1
    |
 LL | struct S<const S: (), const S: S = { S }>;
diff --git a/tests/ui/cycle-trait/cycle-trait-supertrait-direct.stderr b/tests/ui/cycle-trait/cycle-trait-supertrait-direct.stderr
index 2e11a59c3a4..3e5579d2e4a 100644
--- a/tests/ui/cycle-trait/cycle-trait-supertrait-direct.stderr
+++ b/tests/ui/cycle-trait/cycle-trait-supertrait-direct.stderr
@@ -8,10 +8,8 @@ LL | trait Chromosome: Chromosome {
 note: cycle used when checking that `Chromosome` is well-formed
   --> $DIR/cycle-trait-supertrait-direct.rs:3:1
    |
-LL | / trait Chromosome: Chromosome {
-LL | |
-LL | | }
-   | |_^
+LL | trait Chromosome: Chromosome {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = 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 1 previous error
diff --git a/tests/ui/cycle-trait/issue-12511.stderr b/tests/ui/cycle-trait/issue-12511.stderr
index 0246bf21983..45fc86a7413 100644
--- a/tests/ui/cycle-trait/issue-12511.stderr
+++ b/tests/ui/cycle-trait/issue-12511.stderr
@@ -13,10 +13,8 @@ LL | trait T2 : T1 {
 note: cycle used when checking that `T1` is well-formed
   --> $DIR/issue-12511.rs:1:1
    |
-LL | / trait T1 : T2 {
-LL | |
-LL | | }
-   | |_^
+LL | trait T1 : T2 {
+   | ^^^^^^^^^^^^^
    = 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 1 previous error
diff --git a/tests/ui/delegation/unsupported.stderr b/tests/ui/delegation/unsupported.stderr
index 53d05c3db8c..f69be60133e 100644
--- a/tests/ui/delegation/unsupported.stderr
+++ b/tests/ui/delegation/unsupported.stderr
@@ -10,11 +10,11 @@ note: ...which requires comparing an impl and trait method signature, inferring
 LL |         reuse to_reuse::opaque_ret;
    |                         ^^^^^^^^^^
    = note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:21:5: 21:24>::opaque_ret::{anon_assoc#0}`, completing the cycle
-note: cycle used when checking that `opaque::<impl at $DIR/unsupported.rs:21:5: 21:24>` is well-formed
-  --> $DIR/unsupported.rs:21:5
+note: cycle used when checking assoc item `opaque::<impl at $DIR/unsupported.rs:21:5: 21:24>::opaque_ret` is compatible with trait definition
+  --> $DIR/unsupported.rs:22:25
    |
-LL |     impl ToReuse for u8 {
-   |     ^^^^^^^^^^^^^^^^^^^
+LL |         reuse to_reuse::opaque_ret;
+   |                         ^^^^^^^^^^
    = 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::<impl at $DIR/unsupported.rs:24:5: 24:25>::opaque_ret::{anon_assoc#0}`
@@ -29,11 +29,11 @@ note: ...which requires comparing an impl and trait method signature, inferring
 LL |         reuse ToReuse::opaque_ret;
    |                        ^^^^^^^^^^
    = note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:24:5: 24:25>::opaque_ret::{anon_assoc#0}`, completing the cycle
-note: cycle used when checking that `opaque::<impl at $DIR/unsupported.rs:24:5: 24:25>` is well-formed
-  --> $DIR/unsupported.rs:24:5
+note: cycle used when checking assoc item `opaque::<impl at $DIR/unsupported.rs:24:5: 24:25>::opaque_ret` is compatible with trait definition
+  --> $DIR/unsupported.rs:25:24
    |
-LL |     impl ToReuse for u16 {
-   |     ^^^^^^^^^^^^^^^^^^^^
+LL |         reuse ToReuse::opaque_ret;
+   |                        ^^^^^^^^^^
    = 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: recursive delegation is not supported yet
diff --git a/tests/ui/dropck/explicit-drop-bounds.bad1.stderr b/tests/ui/dropck/explicit-drop-bounds.bad1.stderr
index 28d7546d0c9..d898f2f9761 100644
--- a/tests/ui/dropck/explicit-drop-bounds.bad1.stderr
+++ b/tests/ui/dropck/explicit-drop-bounds.bad1.stderr
@@ -1,8 +1,8 @@
 error[E0277]: the trait bound `T: Copy` is not satisfied
-  --> $DIR/explicit-drop-bounds.rs:27:18
+  --> $DIR/explicit-drop-bounds.rs:32:5
    |
-LL | impl<T> Drop for DropMe<T>
-   |                  ^^^^^^^^^ the trait `Copy` is not implemented for `T`
+LL |     fn drop(&mut self) {}
+   |     ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T`
    |
 note: required by a bound in `DropMe`
   --> $DIR/explicit-drop-bounds.rs:7:18
@@ -15,10 +15,10 @@ LL |     [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply
    |                   ++++++++++++++++++++
 
 error[E0277]: the trait bound `T: Copy` is not satisfied
-  --> $DIR/explicit-drop-bounds.rs:32:5
+  --> $DIR/explicit-drop-bounds.rs:27:18
    |
-LL |     fn drop(&mut self) {}
-   |     ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T`
+LL | impl<T> Drop for DropMe<T>
+   |                  ^^^^^^^^^ the trait `Copy` is not implemented for `T`
    |
 note: required by a bound in `DropMe`
   --> $DIR/explicit-drop-bounds.rs:7:18
diff --git a/tests/ui/dropck/explicit-drop-bounds.bad2.stderr b/tests/ui/dropck/explicit-drop-bounds.bad2.stderr
index c363676edea..8155bd4134d 100644
--- a/tests/ui/dropck/explicit-drop-bounds.bad2.stderr
+++ b/tests/ui/dropck/explicit-drop-bounds.bad2.stderr
@@ -1,8 +1,8 @@
 error[E0277]: the trait bound `T: Copy` is not satisfied
-  --> $DIR/explicit-drop-bounds.rs:38:18
+  --> $DIR/explicit-drop-bounds.rs:41:5
    |
-LL | impl<T> Drop for DropMe<T>
-   |                  ^^^^^^^^^ the trait `Copy` is not implemented for `T`
+LL |     fn drop(&mut self) {}
+   |     ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T`
    |
 note: required by a bound in `DropMe`
   --> $DIR/explicit-drop-bounds.rs:7:18
@@ -15,10 +15,10 @@ LL | impl<T: std::marker::Copy> Drop for DropMe<T>
    |       +++++++++++++++++++
 
 error[E0277]: the trait bound `T: Copy` is not satisfied
-  --> $DIR/explicit-drop-bounds.rs:41:5
+  --> $DIR/explicit-drop-bounds.rs:38:18
    |
-LL |     fn drop(&mut self) {}
-   |     ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T`
+LL | impl<T> Drop for DropMe<T>
+   |                  ^^^^^^^^^ the trait `Copy` is not implemented for `T`
    |
 note: required by a bound in `DropMe`
   --> $DIR/explicit-drop-bounds.rs:7:18
diff --git a/tests/ui/dropck/unconstrained_const_param_on_drop.rs b/tests/ui/dropck/unconstrained_const_param_on_drop.rs
index de77fa55fb2..839aca07a6a 100644
--- a/tests/ui/dropck/unconstrained_const_param_on_drop.rs
+++ b/tests/ui/dropck/unconstrained_const_param_on_drop.rs
@@ -3,5 +3,6 @@ struct Foo {}
 impl<const UNUSED: usize> Drop for Foo {}
 //~^ ERROR: `Drop` impl requires `the constant `_` has type `usize``
 //~| ERROR: the const parameter `UNUSED` is not constrained by the impl trait, self type, or predicates
+//~| ERROR: missing: `drop`
 
 fn main() {}
diff --git a/tests/ui/dropck/unconstrained_const_param_on_drop.stderr b/tests/ui/dropck/unconstrained_const_param_on_drop.stderr
index 851888534ee..515637dd47f 100644
--- a/tests/ui/dropck/unconstrained_const_param_on_drop.stderr
+++ b/tests/ui/dropck/unconstrained_const_param_on_drop.stderr
@@ -10,6 +10,14 @@ note: the implementor must specify the same requirement
 LL | struct Foo {}
    | ^^^^^^^^^^
 
+error[E0046]: not all trait items implemented, missing: `drop`
+  --> $DIR/unconstrained_const_param_on_drop.rs:3:1
+   |
+LL | impl<const UNUSED: usize> Drop for Foo {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `drop` in implementation
+   |
+   = help: implement the missing item: `fn drop(&mut self) { todo!() }`
+
 error[E0207]: the const parameter `UNUSED` is not constrained by the impl trait, self type, or predicates
   --> $DIR/unconstrained_const_param_on_drop.rs:3:6
    |
@@ -19,7 +27,7 @@ LL | impl<const UNUSED: usize> Drop for Foo {}
    = note: expressions using a const parameter must map each value to a distinct output value
    = note: proving the result of expressions other than the parameter are unique is not supported
 
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
 
-Some errors have detailed explanations: E0207, E0367.
-For more information about an error, try `rustc --explain E0207`.
+Some errors have detailed explanations: E0046, E0207, E0367.
+For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/enum-discriminant/eval-error.stderr b/tests/ui/enum-discriminant/eval-error.stderr
index c29d258a90b..77449656ea6 100644
--- a/tests/ui/enum-discriminant/eval-error.stderr
+++ b/tests/ui/enum-discriminant/eval-error.stderr
@@ -15,6 +15,18 @@ LL | |     A
 LL | | }
    | |_- not a struct or union
 
+error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
+  --> $DIR/eval-error.rs:2:5
+   |
+LL |     a: str,
+   |     ^^^^^^
+   |
+   = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
+help: wrap the field type in `ManuallyDrop<...>`
+   |
+LL |     a: std::mem::ManuallyDrop<str>,
+   |        +++++++++++++++++++++++   +
+
 error[E0277]: the size for values of type `str` cannot be known at compilation time
   --> $DIR/eval-error.rs:2:8
    |
@@ -33,18 +45,6 @@ help: the `Box` type always has a statically known size and allocates its conten
 LL |     a: Box<str>,
    |        ++++   +
 
-error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
-  --> $DIR/eval-error.rs:2:5
-   |
-LL |     a: str,
-   |     ^^^^^^
-   |
-   = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
-help: wrap the field type in `ManuallyDrop<...>`
-   |
-LL |     a: std::mem::ManuallyDrop<str>,
-   |        +++++++++++++++++++++++   +
-
 error[E0080]: the type `Foo` has an unknown layout
   --> $DIR/eval-error.rs:9:30
    |
diff --git a/tests/ui/extern/issue-36122-accessing-externed-dst.stderr b/tests/ui/extern/issue-36122-accessing-externed-dst.stderr
index 6f805aec1df..8007c3f13e5 100644
--- a/tests/ui/extern/issue-36122-accessing-externed-dst.stderr
+++ b/tests/ui/extern/issue-36122-accessing-externed-dst.stderr
@@ -1,8 +1,8 @@
 error[E0277]: the size for values of type `[usize]` cannot be known at compilation time
-  --> $DIR/issue-36122-accessing-externed-dst.rs:3:24
+  --> $DIR/issue-36122-accessing-externed-dst.rs:3:9
    |
 LL |         static symbol: [usize];
-   |                        ^^^^^^^ doesn't have a size known at compile-time
+   |         ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `Sized` is not implemented for `[usize]`
    = note: statics and constants must have a statically known size
diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr
index 7768c25bd2c..334bc63b7ee 100644
--- a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr
+++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr
@@ -56,6 +56,19 @@ LL | impl Fn<()> for Foo {
    |
    = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
 
+error[E0053]: method `call` has an incompatible type for trait
+  --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:13:32
+   |
+LL |     extern "rust-call" fn call(self, args: ()) -> () {}
+   |                                ^^^^ expected `&Foo`, found `Foo`
+   |
+   = note: expected signature `extern "rust-call" fn(&Foo, ()) -> _`
+              found signature `extern "rust-call" fn(Foo, ()) -> ()`
+help: change the self-receiver type to match the trait
+   |
+LL |     extern "rust-call" fn call(&self, args: ()) -> () {}
+   |                                +
+
 error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change
   --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:26:6
    |
@@ -85,19 +98,6 @@ LL | impl Fn<()> for Foo {
 note: required by a bound in `Fn`
   --> $SRC_DIR/core/src/ops/function.rs:LL:COL
 
-error[E0053]: method `call` has an incompatible type for trait
-  --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:13:32
-   |
-LL |     extern "rust-call" fn call(self, args: ()) -> () {}
-   |                                ^^^^ expected `&Foo`, found `Foo`
-   |
-   = note: expected signature `extern "rust-call" fn(&Foo, ()) -> _`
-              found signature `extern "rust-call" fn(Foo, ()) -> ()`
-help: change the self-receiver type to match the trait
-   |
-LL |     extern "rust-call" fn call(&self, args: ()) -> () {}
-   |                                +
-
 error[E0183]: manual implementations of `FnOnce` are experimental
   --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6
    |
@@ -144,17 +144,6 @@ LL | impl FnOnce() for Foo1 {
    |
    = help: implement the missing item: `type Output = /* Type */;`
 
-error[E0277]: expected a `FnOnce()` closure, found `Bar`
-  --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:26:20
-   |
-LL | impl FnMut<()> for Bar {
-   |                    ^^^ expected an `FnOnce()` closure, found `Bar`
-   |
-   = help: the trait `FnOnce()` is not implemented for `Bar`
-   = note: wrap the `Bar` in a closure with no arguments: `|| { /* code */ }`
-note: required by a bound in `FnMut`
-  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
-
 error[E0053]: method `call_mut` has an incompatible type for trait
   --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:30:36
    |
@@ -168,6 +157,17 @@ help: change the self-receiver type to match the trait
 LL |     extern "rust-call" fn call_mut(&mut self, args: ()) -> () {}
    |                                     +++
 
+error[E0277]: expected a `FnOnce()` closure, found `Bar`
+  --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:26:20
+   |
+LL | impl FnMut<()> for Bar {
+   |                    ^^^ expected an `FnOnce()` closure, found `Bar`
+   |
+   = help: the trait `FnOnce()` is not implemented for `Bar`
+   = note: wrap the `Bar` in a closure with no arguments: `|| { /* code */ }`
+note: required by a bound in `FnMut`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
+
 error[E0046]: not all trait items implemented, missing: `Output`
   --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:35:1
    |
diff --git a/tests/ui/fn/issue-39259.stderr b/tests/ui/fn/issue-39259.stderr
index a923d7b26ef..90e305ca17a 100644
--- a/tests/ui/fn/issue-39259.stderr
+++ b/tests/ui/fn/issue-39259.stderr
@@ -10,6 +10,14 @@ help: parenthesized trait syntax expands to `Fn<(u32,), Output=u32>`
 LL | impl Fn(u32) -> u32 for S {
    |      ^^^^^^^^^^^^^^
 
+error[E0050]: method `call` has 1 parameter but the declaration in trait `call` has 2
+  --> $DIR/issue-39259.rs:9:13
+   |
+LL |     fn call(&self) -> u32 {
+   |             ^^^^^ expected 2 parameters, found 1
+   |
+   = note: `call` from trait: `extern "rust-call" fn(&Self, Args) -> <Self as FnOnce<Args>>::Output`
+
 error[E0277]: expected a `FnMut(u32)` closure, found `S`
   --> $DIR/issue-39259.rs:6:25
    |
@@ -20,14 +28,6 @@ LL | impl Fn(u32) -> u32 for S {
 note: required by a bound in `Fn`
   --> $SRC_DIR/core/src/ops/function.rs:LL:COL
 
-error[E0050]: method `call` has 1 parameter but the declaration in trait `call` has 2
-  --> $DIR/issue-39259.rs:9:13
-   |
-LL |     fn call(&self) -> u32 {
-   |             ^^^^^ expected 2 parameters, found 1
-   |
-   = note: `call` from trait: `extern "rust-call" fn(&Self, Args) -> <Self as FnOnce<Args>>::Output`
-
 error: aborting due to 3 previous errors
 
 Some errors have detailed explanations: E0050, E0229, E0277.
diff --git a/tests/ui/generic-associated-types/bugs/issue-87735.stderr b/tests/ui/generic-associated-types/bugs/issue-87735.stderr
index 1b955431363..c3f4f7a73f3 100644
--- a/tests/ui/generic-associated-types/bugs/issue-87735.stderr
+++ b/tests/ui/generic-associated-types/bugs/issue-87735.stderr
@@ -5,12 +5,13 @@ LL | impl<'b, T, U> AsRef2 for Foo<T>
    |             ^ unconstrained type parameter
 
 error[E0309]: the parameter type `U` may not live long enough
-  --> $DIR/issue-87735.rs:34:21
+  --> $DIR/issue-87735.rs:34:3
    |
 LL |   type Output<'a> = FooRef<'a, U> where Self: 'a;
-   |               --    ^^^^^^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds...
-   |               |
-   |               the parameter type `U` must be valid for the lifetime `'a` as defined here...
+   |   ^^^^^^^^^^^^--^
+   |   |           |
+   |   |           the parameter type `U` must be valid for the lifetime `'a` as defined here...
+   |   ...so that the type `U` will meet its required lifetime bounds...
    |
 note: ...that is required by this bound
   --> $DIR/issue-87735.rs:23:22
diff --git a/tests/ui/generic-associated-types/bugs/issue-88526.stderr b/tests/ui/generic-associated-types/bugs/issue-88526.stderr
index 5da3e3ff64a..5e39eb7a6b9 100644
--- a/tests/ui/generic-associated-types/bugs/issue-88526.stderr
+++ b/tests/ui/generic-associated-types/bugs/issue-88526.stderr
@@ -5,12 +5,13 @@ LL | impl<'q, Q, I, F> A for TestB<Q, F>
    |             ^ unconstrained type parameter
 
 error[E0309]: the parameter type `F` may not live long enough
-  --> $DIR/issue-88526.rs:16:18
+  --> $DIR/issue-88526.rs:16:5
    |
 LL |     type I<'a> = &'a F;
-   |            --    ^^^^^ ...so that the reference type `&'a F` does not outlive the data it points at
-   |            |
-   |            the parameter type `F` must be valid for the lifetime `'a` as defined here...
+   |     ^^^^^^^--^
+   |     |      |
+   |     |      the parameter type `F` must be valid for the lifetime `'a` as defined here...
+   |     ...so that the reference type `&'a F` does not outlive the data it points at
    |
 help: consider adding an explicit lifetime bound
    |
diff --git a/tests/ui/generic-associated-types/gat-trait-path-generic-type-arg.rs b/tests/ui/generic-associated-types/gat-trait-path-generic-type-arg.rs
index d00c036fbd5..81e2db182bc 100644
--- a/tests/ui/generic-associated-types/gat-trait-path-generic-type-arg.rs
+++ b/tests/ui/generic-associated-types/gat-trait-path-generic-type-arg.rs
@@ -9,6 +9,7 @@ impl <T, T1> Foo for T {
     type F<T1> = &[u8];
       //~^ ERROR: the name `T1` is already used for
       //~| ERROR: `&` without an explicit lifetime name cannot be used here
+      //~| ERROR: has 1 type parameter but its trait declaration has 0 type parameters
 }
 
 fn main() {}
diff --git a/tests/ui/generic-associated-types/gat-trait-path-generic-type-arg.stderr b/tests/ui/generic-associated-types/gat-trait-path-generic-type-arg.stderr
index cb2b9f32bfe..42aa83c8f43 100644
--- a/tests/ui/generic-associated-types/gat-trait-path-generic-type-arg.stderr
+++ b/tests/ui/generic-associated-types/gat-trait-path-generic-type-arg.stderr
@@ -13,13 +13,22 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here
 LL |     type F<T1> = &[u8];
    |                  ^ explicit lifetime name needed here
 
+error[E0049]: associated type `F` has 1 type parameter but its trait declaration has 0 type parameters
+  --> $DIR/gat-trait-path-generic-type-arg.rs:9:12
+   |
+LL |     type F<'a>;
+   |            -- expected 0 type parameters
+...
+LL |     type F<T1> = &[u8];
+   |            ^^ found 1 type parameter
+
 error[E0207]: the type parameter `T1` is not constrained by the impl trait, self type, or predicates
   --> $DIR/gat-trait-path-generic-type-arg.rs:7:10
    |
 LL | impl <T, T1> Foo for T {
    |          ^^ unconstrained type parameter
 
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors
 
-Some errors have detailed explanations: E0207, E0403, E0637.
-For more information about an error, try `rustc --explain E0207`.
+Some errors have detailed explanations: E0049, E0207, E0403, E0637.
+For more information about an error, try `rustc --explain E0049`.
diff --git a/tests/ui/generic-associated-types/issue-84931.stderr b/tests/ui/generic-associated-types/issue-84931.stderr
index 71d112277a3..01819481108 100644
--- a/tests/ui/generic-associated-types/issue-84931.stderr
+++ b/tests/ui/generic-associated-types/issue-84931.stderr
@@ -18,12 +18,13 @@ LL |     type Item<'a> = &'a mut T where Self: 'a;
    |                               ++++++++++++++
 
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/issue-84931.rs:14:21
+  --> $DIR/issue-84931.rs:14:5
    |
 LL |     type Item<'a> = &'a mut T;
-   |               --    ^^^^^^^^^ ...so that the reference type `&'a mut T` does not outlive the data it points at
-   |               |
-   |               the parameter type `T` must be valid for the lifetime `'a` as defined here...
+   |     ^^^^^^^^^^--^
+   |     |         |
+   |     |         the parameter type `T` must be valid for the lifetime `'a` as defined here...
+   |     ...so that the reference type `&'a mut T` does not outlive the data it points at
    |
 help: consider adding an explicit lifetime bound
    |
diff --git a/tests/ui/generic-associated-types/static-lifetime-tip-with-default-type.stderr b/tests/ui/generic-associated-types/static-lifetime-tip-with-default-type.stderr
index 7d985a9013f..786aa00350c 100644
--- a/tests/ui/generic-associated-types/static-lifetime-tip-with-default-type.stderr
+++ b/tests/ui/generic-associated-types/static-lifetime-tip-with-default-type.stderr
@@ -82,6 +82,14 @@ help: consider adding an explicit lifetime bound
 LL | struct Far<T: 'static
    |             +++++++++
 
+error[E0392]: lifetime parameter `'a` is never used
+  --> $DIR/static-lifetime-tip-with-default-type.rs:22:10
+   |
+LL | struct S<'a, K: 'a = i32>(&'static K);
+   |          ^^ unused lifetime parameter
+   |
+   = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`
+
 error[E0310]: the parameter type `K` may not live long enough
   --> $DIR/static-lifetime-tip-with-default-type.rs:22:27
    |
@@ -96,14 +104,6 @@ help: consider adding an explicit lifetime bound
 LL | struct S<'a, K: 'a + 'static = i32>(&'static K);
    |                    +++++++++
 
-error[E0392]: lifetime parameter `'a` is never used
-  --> $DIR/static-lifetime-tip-with-default-type.rs:22:10
-   |
-LL | struct S<'a, K: 'a = i32>(&'static K);
-   |          ^^ unused lifetime parameter
-   |
-   = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`
-
 error: aborting due to 8 previous errors
 
 Some errors have detailed explanations: E0310, E0392.
diff --git a/tests/ui/generic-const-items/evaluatable-bounds.stderr b/tests/ui/generic-const-items/evaluatable-bounds.stderr
index ca26d633658..8bc4a3d236f 100644
--- a/tests/ui/generic-const-items/evaluatable-bounds.stderr
+++ b/tests/ui/generic-const-items/evaluatable-bounds.stderr
@@ -2,7 +2,7 @@ error: unconstrained generic constant
   --> $DIR/evaluatable-bounds.rs:14:5
    |
 LL |     const ARRAY: [i32; Self::LEN];
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 help: try adding a `where` bound
    |
diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr
index 7fe803550bd..5ded3a5e76c 100644
--- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr
@@ -53,10 +53,10 @@ LL |     Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>;
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `EthernetWorker`
 
 error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied
-  --> $DIR/issue-89118.rs:22:20
+  --> $DIR/issue-89118.rs:22:5
    |
 LL |     type Handler = Ctx<C::Dispatcher>;
-   |                    ^^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`
+   |     ^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`
    |
 help: this trait has no implementations, consider adding one
   --> $DIR/issue-89118.rs:1:1
diff --git a/tests/ui/impl-trait/in-trait/false-positive-predicate-entailment-error.current.stderr b/tests/ui/impl-trait/in-trait/false-positive-predicate-entailment-error.current.stderr
index b6e7e02f331..2351b18fdfc 100644
--- a/tests/ui/impl-trait/in-trait/false-positive-predicate-entailment-error.current.stderr
+++ b/tests/ui/impl-trait/in-trait/false-positive-predicate-entailment-error.current.stderr
@@ -19,11 +19,14 @@ help: consider further restricting type parameter `F` with trait `MyFn`
 LL |         F: Callback<Self::CallbackArg> + MyFn<i32>,
    |                                        +++++++++++
 
-error[E0277]: the trait bound `F: Callback<i32>` is not satisfied
-  --> $DIR/false-positive-predicate-entailment-error.rs:42:12
+error[E0277]: the trait bound `F: MyFn<i32>` is not satisfied
+  --> $DIR/false-positive-predicate-entailment-error.rs:36:5
    |
-LL |         F: Callback<Self::CallbackArg>,
-   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `MyFn<i32>` is not implemented for `F`
+LL | /     fn autobatch<F>(self) -> impl Trait
+...  |
+LL | |     where
+LL | |         F: Callback<Self::CallbackArg>,
+   | |_______________________________________^ the trait `MyFn<i32>` is not implemented for `F`
    |
 note: required for `F` to implement `Callback<i32>`
   --> $DIR/false-positive-predicate-entailment-error.rs:14:21
@@ -32,27 +35,17 @@ LL | impl<A, F: MyFn<A>> Callback<A> for F {
    |            -------  ^^^^^^^^^^^     ^
    |            |
    |            unsatisfied trait bound introduced here
-note: the requirement `F: Callback<i32>` appears on the `impl`'s method `autobatch` but not on the corresponding trait's method
-  --> $DIR/false-positive-predicate-entailment-error.rs:25:8
-   |
-LL | trait ChannelSender {
-   |       ------------- in this trait
-...
-LL |     fn autobatch<F>(self) -> impl Trait
-   |        ^^^^^^^^^ this trait's method doesn't have the requirement `F: Callback<i32>`
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 help: consider further restricting type parameter `F` with trait `MyFn`
    |
 LL |         F: Callback<Self::CallbackArg> + MyFn<i32>,
    |                                        +++++++++++
 
-error[E0277]: the trait bound `F: MyFn<i32>` is not satisfied
-  --> $DIR/false-positive-predicate-entailment-error.rs:36:5
+error[E0277]: the trait bound `F: Callback<i32>` is not satisfied
+  --> $DIR/false-positive-predicate-entailment-error.rs:42:12
    |
-LL | /     fn autobatch<F>(self) -> impl Trait
-...  |
-LL | |     where
-LL | |         F: Callback<Self::CallbackArg>,
-   | |_______________________________________^ the trait `MyFn<i32>` is not implemented for `F`
+LL |         F: Callback<Self::CallbackArg>,
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `MyFn<i32>` is not implemented for `F`
    |
 note: required for `F` to implement `Callback<i32>`
   --> $DIR/false-positive-predicate-entailment-error.rs:14:21
@@ -61,7 +54,14 @@ LL | impl<A, F: MyFn<A>> Callback<A> for F {
    |            -------  ^^^^^^^^^^^     ^
    |            |
    |            unsatisfied trait bound introduced here
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+note: the requirement `F: Callback<i32>` appears on the `impl`'s method `autobatch` but not on the corresponding trait's method
+  --> $DIR/false-positive-predicate-entailment-error.rs:25:8
+   |
+LL | trait ChannelSender {
+   |       ------------- in this trait
+...
+LL |     fn autobatch<F>(self) -> impl Trait
+   |        ^^^^^^^^^ this trait's method doesn't have the requirement `F: Callback<i32>`
 help: consider further restricting type parameter `F` with trait `MyFn`
    |
 LL |         F: Callback<Self::CallbackArg> + MyFn<i32>,
diff --git a/tests/ui/impl-trait/in-trait/method-compatability-via-leakage-cycle.current.stderr b/tests/ui/impl-trait/in-trait/method-compatability-via-leakage-cycle.current.stderr
index 5d651245746..ff3a726477e 100644
--- a/tests/ui/impl-trait/in-trait/method-compatability-via-leakage-cycle.current.stderr
+++ b/tests/ui/impl-trait/in-trait/method-compatability-via-leakage-cycle.current.stderr
@@ -46,11 +46,11 @@ note: ...which requires type-checking `<impl at $DIR/method-compatability-via-le
 LL |     fn foo(b: bool) -> impl Sized {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: ...which again requires computing type of `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo::{anon_assoc#0}`, completing the cycle
-note: cycle used when checking that `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>` is well-formed
-  --> $DIR/method-compatability-via-leakage-cycle.rs:17:1
+note: cycle used when checking assoc item `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo` is compatible with trait definition
+  --> $DIR/method-compatability-via-leakage-cycle.rs:21:5
    |
-LL | impl Trait for u32 {
-   | ^^^^^^^^^^^^^^^^^^
+LL |     fn foo(b: bool) -> 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 1 previous error
diff --git a/tests/ui/impl-trait/in-trait/method-compatability-via-leakage-cycle.next.stderr b/tests/ui/impl-trait/in-trait/method-compatability-via-leakage-cycle.next.stderr
index 4bbba62bd71..f0a20367a4a 100644
--- a/tests/ui/impl-trait/in-trait/method-compatability-via-leakage-cycle.next.stderr
+++ b/tests/ui/impl-trait/in-trait/method-compatability-via-leakage-cycle.next.stderr
@@ -50,11 +50,11 @@ note: ...which requires type-checking `<impl at $DIR/method-compatability-via-le
 LL |     fn foo(b: bool) -> impl Sized {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: ...which again requires computing type of `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo::{anon_assoc#0}`, completing the cycle
-note: cycle used when checking that `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>` is well-formed
-  --> $DIR/method-compatability-via-leakage-cycle.rs:17:1
+note: cycle used when checking assoc item `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo` is compatible with trait definition
+  --> $DIR/method-compatability-via-leakage-cycle.rs:21:5
    |
-LL | impl Trait for u32 {
-   | ^^^^^^^^^^^^^^^^^^
+LL |     fn foo(b: bool) -> 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 `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo::{anon_assoc#0}`
@@ -109,11 +109,11 @@ note: ...which requires type-checking `<impl at $DIR/method-compatability-via-le
 LL |     fn foo(b: bool) -> impl Sized {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: ...which again requires computing type of `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo::{anon_assoc#0}`, completing the cycle
-note: cycle used when checking that `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>` is well-formed
-  --> $DIR/method-compatability-via-leakage-cycle.rs:17:1
+note: cycle used when checking assoc item `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo` is compatible with trait definition
+  --> $DIR/method-compatability-via-leakage-cycle.rs:21:5
    |
-LL | impl Trait for u32 {
-   | ^^^^^^^^^^^^^^^^^^
+LL |     fn foo(b: bool) -> 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
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
diff --git a/tests/ui/impl-trait/in-trait/refine-resolution-errors.rs b/tests/ui/impl-trait/in-trait/refine-resolution-errors.rs
index 894f592d9e2..8433fb72b5e 100644
--- a/tests/ui/impl-trait/in-trait/refine-resolution-errors.rs
+++ b/tests/ui/impl-trait/in-trait/refine-resolution-errors.rs
@@ -9,6 +9,7 @@ pub trait Mirror {
 impl<T: ?Sized> Mirror for () {
     //~^ ERROR the type parameter `T` is not constrained
     type Assoc = T;
+    //~^ ERROR the size for values of type `T` cannot be known at compilation time
 }
 
 pub trait First {
diff --git a/tests/ui/impl-trait/in-trait/refine-resolution-errors.stderr b/tests/ui/impl-trait/in-trait/refine-resolution-errors.stderr
index 10ebad2a7d5..fd53c9fef44 100644
--- a/tests/ui/impl-trait/in-trait/refine-resolution-errors.stderr
+++ b/tests/ui/impl-trait/in-trait/refine-resolution-errors.stderr
@@ -4,6 +4,31 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self
 LL | impl<T: ?Sized> Mirror for () {
    |      ^ unconstrained type parameter
 
-error: aborting due to 1 previous error
+error[E0277]: the size for values of type `T` cannot be known at compilation time
+  --> $DIR/refine-resolution-errors.rs:11:18
+   |
+LL | impl<T: ?Sized> Mirror for () {
+   |      - this type parameter needs to be `Sized`
+LL |
+LL |     type Assoc = T;
+   |                  ^ doesn't have a size known at compile-time
+   |
+note: required by a bound in `Mirror::Assoc`
+  --> $DIR/refine-resolution-errors.rs:7:5
+   |
+LL |     type Assoc;
+   |     ^^^^^^^^^^^ required by this bound in `Mirror::Assoc`
+help: consider removing the `?Sized` bound to make the type parameter `Sized`
+   |
+LL - impl<T: ?Sized> Mirror for () {
+LL + impl<T> Mirror for () {
+   |
+help: consider relaxing the implicit `Sized` restriction
+   |
+LL |     type Assoc: ?Sized;
+   |               ++++++++
+
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0207`.
+Some errors have detailed explanations: E0207, E0277.
+For more information about an error, try `rustc --explain E0207`.
diff --git a/tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr b/tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr
index eaa320455bb..f95f6fab413 100644
--- a/tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr
+++ b/tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr
@@ -1,3 +1,15 @@
+error[E0195]: lifetime parameters or bounds on associated type `Item` do not match the trait declaration
+  --> $DIR/span-bug-issue-121457.rs:10:14
+   |
+LL |     type Item<'a>
+   |              ---- lifetimes in impl do not match this associated type in trait
+LL |     where
+LL |         Self: 'a;
+   |               -- this bound might be missing in the impl
+...
+LL |     type Item = u32;
+   |              ^ lifetimes do not match associated type in trait
+
 error[E0582]: binding for associated type `Item` references lifetime `'missing`, which does not appear in the trait input types
   --> $DIR/span-bug-issue-121457.rs:13:51
    |
@@ -12,18 +24,6 @@ LL |     fn iter(&self) -> impl for<'missing> Iterator<Item = Self::Item<'missin
    |
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
-error[E0195]: lifetime parameters or bounds on associated type `Item` do not match the trait declaration
-  --> $DIR/span-bug-issue-121457.rs:10:14
-   |
-LL |     type Item<'a>
-   |              ---- lifetimes in impl do not match this associated type in trait
-LL |     where
-LL |         Self: 'a;
-   |               -- this bound might be missing in the impl
-...
-LL |     type Item = u32;
-   |              ^ lifetimes do not match associated type in trait
-
 error[E0277]: `()` is not an iterator
   --> $DIR/span-bug-issue-121457.rs:13:23
    |
diff --git a/tests/ui/impl-trait/in-trait/unconstrained-lt.rs b/tests/ui/impl-trait/in-trait/unconstrained-lt.rs
index ff3753de5a2..12e0a4263f5 100644
--- a/tests/ui/impl-trait/in-trait/unconstrained-lt.rs
+++ b/tests/ui/impl-trait/in-trait/unconstrained-lt.rs
@@ -6,6 +6,7 @@ impl<'a, T> Foo for T {
     //~^ ERROR the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
 
     fn test() -> &'a () {
+        //~^ WARN: does not match trait method signature
         &()
     }
 }
diff --git a/tests/ui/impl-trait/in-trait/unconstrained-lt.stderr b/tests/ui/impl-trait/in-trait/unconstrained-lt.stderr
index 4c5a42c0b4b..27340c5b362 100644
--- a/tests/ui/impl-trait/in-trait/unconstrained-lt.stderr
+++ b/tests/ui/impl-trait/in-trait/unconstrained-lt.stderr
@@ -1,9 +1,27 @@
+warning: impl trait in impl method signature does not match trait method signature
+  --> $DIR/unconstrained-lt.rs:8:18
+   |
+LL |     fn test() -> impl Sized;
+   |                  ---------- return type from trait method defined here
+...
+LL |     fn test() -> &'a () {
+   |                  ^^^^^^
+   |
+   = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
+   = note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information
+   = note: `#[warn(refining_impl_trait_internal)]` on by default
+help: replace the return type so that it matches the trait
+   |
+LL -     fn test() -> &'a () {
+LL +     fn test() -> impl Sized {
+   |
+
 error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
   --> $DIR/unconstrained-lt.rs:5:6
    |
 LL | impl<'a, T> Foo for T {
    |      ^^ unconstrained lifetime parameter
 
-error: aborting due to 1 previous error
+error: aborting due to 1 previous error; 1 warning emitted
 
 For more information about this error, try `rustc --explain E0207`.
diff --git a/tests/ui/implied-bounds/impl-header-unnormalized-types.stderr b/tests/ui/implied-bounds/impl-header-unnormalized-types.stderr
index 07cb0aecda8..dcb68fbf2cd 100644
--- a/tests/ui/implied-bounds/impl-header-unnormalized-types.stderr
+++ b/tests/ui/implied-bounds/impl-header-unnormalized-types.stderr
@@ -1,8 +1,8 @@
 error[E0491]: in type `&'a &'b ()`, reference has a longer lifetime than the data it references
-  --> $DIR/impl-header-unnormalized-types.rs:15:18
+  --> $DIR/impl-header-unnormalized-types.rs:15:5
    |
 LL |     type Assoc = &'a &'b ();
-   |                  ^^^^^^^^^^
+   |     ^^^^^^^^^^
    |
 note: the pointer is valid for the lifetime `'a` as defined here
   --> $DIR/impl-header-unnormalized-types.rs:14:6
diff --git a/tests/ui/infinite/infinite-trait-alias-recursion.stderr b/tests/ui/infinite/infinite-trait-alias-recursion.stderr
index 5b0cbd58231..fa51914415d 100644
--- a/tests/ui/infinite/infinite-trait-alias-recursion.stderr
+++ b/tests/ui/infinite/infinite-trait-alias-recursion.stderr
@@ -20,7 +20,7 @@ note: cycle used when checking that `T1` is well-formed
   --> $DIR/infinite-trait-alias-recursion.rs:3:1
    |
 LL | trait T1 = T2;
-   | ^^^^^^^^^^^^^^
+   | ^^^^^^^^
    = 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 1 previous error
diff --git a/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature.stderr b/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature.stderr
index 3dec2c3084f..e586248f5d2 100644
--- a/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature.stderr
+++ b/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature.stderr
@@ -1,24 +1,24 @@
 error[E0275]: overflow normalizing the type alias `X2`
-  --> $DIR/infinite-type-alias-mutual-recursion.rs:6:11
+  --> $DIR/infinite-type-alias-mutual-recursion.rs:6:1
    |
 LL | type X1 = X2;
-   |           ^^
+   | ^^^^^^^
    |
    = note: in case this is a recursive type alias, consider using a struct, enum, or union instead
 
 error[E0275]: overflow normalizing the type alias `X3`
-  --> $DIR/infinite-type-alias-mutual-recursion.rs:9:11
+  --> $DIR/infinite-type-alias-mutual-recursion.rs:9:1
    |
 LL | type X2 = X3;
-   |           ^^
+   | ^^^^^^^
    |
    = note: in case this is a recursive type alias, consider using a struct, enum, or union instead
 
 error[E0275]: overflow normalizing the type alias `X1`
-  --> $DIR/infinite-type-alias-mutual-recursion.rs:11:11
+  --> $DIR/infinite-type-alias-mutual-recursion.rs:11:1
    |
 LL | type X3 = X1;
-   |           ^^
+   | ^^^^^^^
    |
    = note: in case this is a recursive type alias, consider using a struct, enum, or union instead
 
diff --git a/tests/ui/infinite/infinite-vec-type-recursion.feature.stderr b/tests/ui/infinite/infinite-vec-type-recursion.feature.stderr
index 5c8d50341c1..3e07a46ea26 100644
--- a/tests/ui/infinite/infinite-vec-type-recursion.feature.stderr
+++ b/tests/ui/infinite/infinite-vec-type-recursion.feature.stderr
@@ -1,8 +1,8 @@
 error[E0275]: overflow normalizing the type alias `X`
-  --> $DIR/infinite-vec-type-recursion.rs:6:10
+  --> $DIR/infinite-vec-type-recursion.rs:6:1
    |
 LL | type X = Vec<X>;
-   |          ^^^^^^
+   | ^^^^^^
    |
    = note: in case this is a recursive type alias, consider using a struct, enum, or union instead
 
diff --git a/tests/ui/issues/issue-54410.stderr b/tests/ui/issues/issue-54410.stderr
index 2cd5a2a49ef..cb68ada7e13 100644
--- a/tests/ui/issues/issue-54410.stderr
+++ b/tests/ui/issues/issue-54410.stderr
@@ -1,8 +1,8 @@
 error[E0277]: the size for values of type `[i8]` cannot be known at compilation time
-  --> $DIR/issue-54410.rs:2:28
+  --> $DIR/issue-54410.rs:2:5
    |
 LL |     pub static mut symbol: [i8];
-   |                            ^^^^ doesn't have a size known at compile-time
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `Sized` is not implemented for `[i8]`
    = note: statics and constants must have a statically known size
diff --git a/tests/ui/issues/issue-7364.stderr b/tests/ui/issues/issue-7364.stderr
index a47a90c90ce..e07f88b806c 100644
--- a/tests/ui/issues/issue-7364.stderr
+++ b/tests/ui/issues/issue-7364.stderr
@@ -1,8 +1,8 @@
 error[E0277]: `RefCell<isize>` cannot be shared between threads safely
-  --> $DIR/issue-7364.rs:4:15
+  --> $DIR/issue-7364.rs:4:1
    |
 LL | static boxed: Box<RefCell<isize>> = Box::new(RefCell::new(0));
-   |               ^^^^^^^^^^^^^^^^^^^ `RefCell<isize>` cannot be shared between threads safely
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `RefCell<isize>` cannot be shared between threads safely
    |
    = help: the trait `Sync` is not implemented for `RefCell<isize>`
    = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
diff --git a/tests/ui/layout/ice-non-last-unsized-field-issue-121473.stderr b/tests/ui/layout/ice-non-last-unsized-field-issue-121473.stderr
index 626be7ac283..b0ea655fc67 100644
--- a/tests/ui/layout/ice-non-last-unsized-field-issue-121473.stderr
+++ b/tests/ui/layout/ice-non-last-unsized-field-issue-121473.stderr
@@ -70,6 +70,18 @@ help: the `Box` type always has a statically known size and allocates its conten
 LL |         field2: Box<str>, // Unsized
    |                 ++++   +
 
+error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
+  --> $DIR/ice-non-last-unsized-field-issue-121473.rs:46:5
+   |
+LL |     field2: str, // Unsized
+   |     ^^^^^^^^^^^
+   |
+   = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
+help: wrap the field type in `ManuallyDrop<...>`
+   |
+LL |     field2: std::mem::ManuallyDrop<str>, // Unsized
+   |             +++++++++++++++++++++++   +
+
 error[E0277]: the size for values of type `str` cannot be known at compilation time
   --> $DIR/ice-non-last-unsized-field-issue-121473.rs:46:13
    |
@@ -88,18 +100,6 @@ help: the `Box` type always has a statically known size and allocates its conten
 LL |     field2: Box<str>, // Unsized
    |             ++++   +
 
-error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
-  --> $DIR/ice-non-last-unsized-field-issue-121473.rs:46:5
-   |
-LL |     field2: str, // Unsized
-   |     ^^^^^^^^^^^
-   |
-   = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
-help: wrap the field type in `ManuallyDrop<...>`
-   |
-LL |     field2: std::mem::ManuallyDrop<str>, // Unsized
-   |             +++++++++++++++++++++++   +
-
 error: aborting due to 6 previous errors
 
 Some errors have detailed explanations: E0277, E0740.
diff --git a/tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.stderr b/tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.stderr
index 32a564e466b..75ee936d9e8 100644
--- a/tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.stderr
+++ b/tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.stderr
@@ -1,4 +1,17 @@
 error[E0059]: type parameter to bare `FnOnce` trait must be a tuple
+  --> $DIR/rust-call-abi-not-a-tuple-ice-81974.rs:31:5
+   |
+LL |     extern "rust-call" fn call_once(mut self, a: A) -> Self::Output {
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Tuple` is not implemented for `A`
+   |
+note: required by a bound in `FnOnce`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
+help: consider further restricting type parameter `A` with unstable trait `Tuple`
+   |
+LL |     A: Eq + Hash + Clone + std::marker::Tuple,
+   |                          ++++++++++++++++++++
+
+error[E0059]: type parameter to bare `FnOnce` trait must be a tuple
   --> $DIR/rust-call-abi-not-a-tuple-ice-81974.rs:24:12
    |
 LL | impl<A, B> FnOnce<A> for CachedFun<A, B>
@@ -12,9 +25,9 @@ LL |     A: Eq + Hash + Clone + std::marker::Tuple,
    |                          ++++++++++++++++++++
 
 error[E0059]: type parameter to bare `FnOnce` trait must be a tuple
-  --> $DIR/rust-call-abi-not-a-tuple-ice-81974.rs:31:5
+  --> $DIR/rust-call-abi-not-a-tuple-ice-81974.rs:45:5
    |
-LL |     extern "rust-call" fn call_once(mut self, a: A) -> Self::Output {
+LL |     extern "rust-call" fn call_mut(&mut self, a: A) -> Self::Output {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Tuple` is not implemented for `A`
    |
 note: required by a bound in `FnOnce`
@@ -37,19 +50,6 @@ help: consider further restricting type parameter `A` with unstable trait `Tuple
 LL |     A: Eq + Hash + Clone + std::marker::Tuple,
    |                          ++++++++++++++++++++
 
-error[E0059]: type parameter to bare `FnOnce` trait must be a tuple
-  --> $DIR/rust-call-abi-not-a-tuple-ice-81974.rs:45:5
-   |
-LL |     extern "rust-call" fn call_mut(&mut self, a: A) -> Self::Output {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Tuple` is not implemented for `A`
-   |
-note: required by a bound in `FnOnce`
-  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
-help: consider further restricting type parameter `A` with unstable trait `Tuple`
-   |
-LL |     A: Eq + Hash + Clone + std::marker::Tuple,
-   |                          ++++++++++++++++++++
-
 error[E0277]: functions with the "rust-call" ABI must take a single non-self tuple argument
   --> $DIR/rust-call-abi-not-a-tuple-ice-81974.rs:31:5
    |
diff --git a/tests/ui/lazy-type-alias/inherent-impls-overflow.current.stderr b/tests/ui/lazy-type-alias/inherent-impls-overflow.current.stderr
index 85ac98f4050..e91946066bd 100644
--- a/tests/ui/lazy-type-alias/inherent-impls-overflow.current.stderr
+++ b/tests/ui/lazy-type-alias/inherent-impls-overflow.current.stderr
@@ -1,8 +1,8 @@
 error[E0275]: overflow normalizing the type alias `Loop`
-  --> $DIR/inherent-impls-overflow.rs:8:13
+  --> $DIR/inherent-impls-overflow.rs:8:1
    |
 LL | type Loop = Loop;
-   |             ^^^^
+   | ^^^^^^^^^
    |
    = note: in case this is a recursive type alias, consider using a struct, enum, or union instead
 
@@ -15,18 +15,18 @@ LL | impl Loop {}
    = note: in case this is a recursive type alias, consider using a struct, enum, or union instead
 
 error[E0275]: overflow normalizing the type alias `Poly0<(((((((...,),),),),),),)>`
-  --> $DIR/inherent-impls-overflow.rs:17:17
+  --> $DIR/inherent-impls-overflow.rs:17:1
    |
 LL | type Poly0<T> = Poly1<(T,)>;
-   |                 ^^^^^^^^^^^
+   | ^^^^^^^^^^^^^
    |
    = note: in case this is a recursive type alias, consider using a struct, enum, or union instead
 
 error[E0275]: overflow normalizing the type alias `Poly1<(((((((...,),),),),),),)>`
-  --> $DIR/inherent-impls-overflow.rs:21:17
+  --> $DIR/inherent-impls-overflow.rs:21:1
    |
 LL | type Poly1<T> = Poly0<(T,)>;
-   |                 ^^^^^^^^^^^
+   | ^^^^^^^^^^^^^
    |
    = note: in case this is a recursive type alias, consider using a struct, enum, or union instead
 
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 e94f29de44f..62ed6e8e513 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[E0271]: type mismatch resolving `Loop normalizes-to _`
-  --> $DIR/inherent-impls-overflow.rs:8:13
+  --> $DIR/inherent-impls-overflow.rs:8:1
    |
 LL | type Loop = Loop;
-   |             ^^^^ types differ
+   | ^^^^^^^^^ types differ
 
 error[E0271]: type mismatch resolving `Loop normalizes-to _`
   --> $DIR/inherent-impls-overflow.rs:12:1
@@ -17,10 +17,10 @@ LL | impl Loop {}
    |      ^^^^ types differ
 
 error[E0275]: overflow evaluating the requirement `Poly1<(T,)> == _`
-  --> $DIR/inherent-impls-overflow.rs:17:17
+  --> $DIR/inherent-impls-overflow.rs:17:1
    |
 LL | type Poly0<T> = Poly1<(T,)>;
-   |                 ^^^^^^^^^^^
+   | ^^^^^^^^^^^^^
    |
    = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inherent_impls_overflow`)
 
@@ -36,10 +36,10 @@ LL | type Poly0<T> = Poly1<(T,)>;
    = note: all type parameters must be used in a non-recursive way in order to constrain their variance
 
 error[E0275]: overflow evaluating the requirement `Poly0<(T,)> == _`
-  --> $DIR/inherent-impls-overflow.rs:21:17
+  --> $DIR/inherent-impls-overflow.rs:21:1
    |
 LL | type Poly1<T> = Poly0<(T,)>;
-   |                 ^^^^^^^^^^^
+   | ^^^^^^^^^^^^^
    |
    = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inherent_impls_overflow`)
 
diff --git a/tests/ui/lazy-type-alias/unconstrained-params-in-impl-due-to-overflow.stderr b/tests/ui/lazy-type-alias/unconstrained-params-in-impl-due-to-overflow.stderr
index bcffa02ddd4..d8270a0abdd 100644
--- a/tests/ui/lazy-type-alias/unconstrained-params-in-impl-due-to-overflow.stderr
+++ b/tests/ui/lazy-type-alias/unconstrained-params-in-impl-due-to-overflow.stderr
@@ -5,10 +5,10 @@ LL | impl<T> Loop<T> {}
    |      ^ unconstrained type parameter
 
 error[E0275]: overflow normalizing the type alias `Loop<T>`
-  --> $DIR/unconstrained-params-in-impl-due-to-overflow.rs:6:16
+  --> $DIR/unconstrained-params-in-impl-due-to-overflow.rs:6:1
    |
 LL | type Loop<T> = Loop<T>;
-   |                ^^^^^^^
+   | ^^^^^^^^^^^^
    |
    = note: in case this is a recursive type alias, consider using a struct, enum, or union instead
 
diff --git a/tests/ui/lifetimes/issue-64173-unused-lifetimes.stderr b/tests/ui/lifetimes/issue-64173-unused-lifetimes.stderr
index 534ba933ba5..4bfbe0eeff7 100644
--- a/tests/ui/lifetimes/issue-64173-unused-lifetimes.stderr
+++ b/tests/ui/lifetimes/issue-64173-unused-lifetimes.stderr
@@ -7,12 +7,6 @@ LL |     beta: [(); foo::<&'a ()>()],
    = note: lifetime parameters may not be used in const expressions
    = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
 
-error: generic `Self` types are currently not permitted in anonymous constants
-  --> $DIR/issue-64173-unused-lifetimes.rs:4:28
-   |
-LL |     array: [(); size_of::<&Self>()],
-   |                            ^^^^
-
 error[E0392]: lifetime parameter `'s` is never used
   --> $DIR/issue-64173-unused-lifetimes.rs:3:12
    |
@@ -21,6 +15,12 @@ LL | struct Foo<'s> {
    |
    = help: consider removing `'s`, referring to it in a field, or using a marker such as `PhantomData`
 
+error: generic `Self` types are currently not permitted in anonymous constants
+  --> $DIR/issue-64173-unused-lifetimes.rs:4:28
+   |
+LL |     array: [(); size_of::<&Self>()],
+   |                            ^^^^
+
 error[E0392]: lifetime parameter `'a` is never used
   --> $DIR/issue-64173-unused-lifetimes.rs:15:12
    |
diff --git a/tests/ui/lifetimes/issue-76168-hr-outlives-3.rs b/tests/ui/lifetimes/issue-76168-hr-outlives-3.rs
index eab436fa341..d6fda129e36 100644
--- a/tests/ui/lifetimes/issue-76168-hr-outlives-3.rs
+++ b/tests/ui/lifetimes/issue-76168-hr-outlives-3.rs
@@ -7,10 +7,12 @@ async fn wrapper<F>(f: F)
 //~^ ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
 //~| ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
 //~| ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
-//~| ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
 where
 F:,
 for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
+//~^ ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
+//~| ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
+//~| ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
 {
     //~^ ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
     let mut i = 41;
diff --git a/tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr b/tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr
index 90572fed0ed..945d38d17f6 100644
--- a/tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr
+++ b/tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr
@@ -10,10 +10,26 @@ LL | | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a
    = help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
 
 error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
-  --> $DIR/issue-76168-hr-outlives-3.rs:6:10
+  --> $DIR/issue-76168-hr-outlives-3.rs:12:50
    |
-LL | async fn wrapper<F>(f: F)
-   |          ^^^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
+LL | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
+   |                                                  ^^^^^^^^^^^^^^^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
+   |
+   = help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
+
+error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
+  --> $DIR/issue-76168-hr-outlives-3.rs:12:57
+   |
+LL | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
+   |                                                         ^^^^^^^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
+   |
+   = help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
+
+error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
+  --> $DIR/issue-76168-hr-outlives-3.rs:12:72
+   |
+LL | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
+   |                                                                        ^^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
    |
    = help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
 
@@ -41,7 +57,7 @@ LL | | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
-  --> $DIR/issue-76168-hr-outlives-3.rs:14:1
+  --> $DIR/issue-76168-hr-outlives-3.rs:16:1
    |
 LL | / {
 LL | |
@@ -52,6 +68,6 @@ LL | | }
    |
    = help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
 
-error: aborting due to 5 previous errors
+error: aborting due to 7 previous errors
 
 For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/lifetimes/issue-95023.stderr b/tests/ui/lifetimes/issue-95023.stderr
index cbc0eeebee1..dffa033fb17 100644
--- a/tests/ui/lifetimes/issue-95023.stderr
+++ b/tests/ui/lifetimes/issue-95023.stderr
@@ -32,6 +32,14 @@ help: parenthesized trait syntax expands to `Fn<(&isize,), Output=()>`
 LL | impl Fn(&isize) for Error {
    |      ^^^^^^^^^^
 
+error[E0046]: not all trait items implemented, missing: `call`
+  --> $DIR/issue-95023.rs:3:1
+   |
+LL | impl Fn(&isize) for Error {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation
+   |
+   = help: implement the missing item: `fn call(&self, _: (&isize,)) -> <Self as FnOnce<(&isize,)>>::Output { todo!() }`
+
 error[E0277]: expected a `FnMut(&isize)` closure, found `Error`
   --> $DIR/issue-95023.rs:3:21
    |
@@ -42,14 +50,6 @@ LL | impl Fn(&isize) for Error {
 note: required by a bound in `Fn`
   --> $SRC_DIR/core/src/ops/function.rs:LL:COL
 
-error[E0046]: not all trait items implemented, missing: `call`
-  --> $DIR/issue-95023.rs:3:1
-   |
-LL | impl Fn(&isize) for Error {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation
-   |
-   = help: implement the missing item: `fn call(&self, _: (&isize,)) -> <Self as FnOnce<(&isize,)>>::Output { todo!() }`
-
 error[E0220]: associated type `B` not found for `Self`
   --> $DIR/issue-95023.rs:8:44
    |
diff --git a/tests/ui/macros/macro-span-issue-116502.stderr b/tests/ui/macros/macro-span-issue-116502.stderr
index 68f8874f5d6..024656e685f 100644
--- a/tests/ui/macros/macro-span-issue-116502.stderr
+++ b/tests/ui/macros/macro-span-issue-116502.stderr
@@ -4,7 +4,7 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures
 LL |             _
    |             ^ not allowed in type signatures
 ...
-LL |         T: Trait<m!()>;
+LL |     struct S<T = m!()>(m!(), T)
    |                  ---- in this macro invocation
    |
    = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -15,8 +15,8 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures
 LL |             _
    |             ^ not allowed in type signatures
 ...
-LL |     struct S<T = m!()>(m!(), T)
-   |                        ---- in this macro invocation
+LL |         T: Trait<m!()>;
+   |                  ---- in this macro invocation
    |
    = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
 
@@ -27,7 +27,7 @@ LL |             _
    |             ^ not allowed in type signatures
 ...
 LL |     struct S<T = m!()>(m!(), T)
-   |                  ---- in this macro invocation
+   |                        ---- in this macro invocation
    |
    = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
 
diff --git a/tests/ui/methods/filter-relevant-fn-bounds.rs b/tests/ui/methods/filter-relevant-fn-bounds.rs
index 76ececf7baa..6233c9db53a 100644
--- a/tests/ui/methods/filter-relevant-fn-bounds.rs
+++ b/tests/ui/methods/filter-relevant-fn-bounds.rs
@@ -7,11 +7,10 @@ struct Wrapper;
 impl Wrapper {
     fn do_something_wrapper<O, F>(self, _: F)
     //~^ ERROR the trait bound `for<'a> F: Output<'a>` is not satisfied
-    //~| ERROR the trait bound `for<'a> F: Output<'a>` is not satisfied
     where
         F: for<'a> FnOnce(<F as Output<'a>>::Type),
-        //~^ ERROR the trait bound `F: Output<'_>` is not satisfied
-        //~| ERROR the trait bound `F: Output<'_>` is not satisfied
+        //~^ ERROR the trait bound `for<'a> F: Output<'a>` is not satisfied
+        //~| ERROR the trait bound `for<'a> F: Output<'a>` is not satisfied
     {
     }
 }
diff --git a/tests/ui/methods/filter-relevant-fn-bounds.stderr b/tests/ui/methods/filter-relevant-fn-bounds.stderr
index 0e00adf6ea6..82103e62ddf 100644
--- a/tests/ui/methods/filter-relevant-fn-bounds.stderr
+++ b/tests/ui/methods/filter-relevant-fn-bounds.stderr
@@ -3,7 +3,6 @@ error[E0277]: the trait bound `for<'a> F: Output<'a>` is not satisfied
    |
 LL | /     fn do_something_wrapper<O, F>(self, _: F)
 LL | |
-LL | |
 LL | |     where
 LL | |         F: for<'a> FnOnce(<F as Output<'a>>::Type),
    | |___________________________________________________^ the trait `for<'a> Output<'a>` is not implemented for `F`
@@ -14,54 +13,43 @@ LL |         F: for<'a> FnOnce(<F as Output<'a>>::Type) + for<'a> Output<'a>,
    |                                                    ++++++++++++++++++++
 
 error[E0277]: the trait bound `for<'a> F: Output<'a>` is not satisfied
-  --> $DIR/filter-relevant-fn-bounds.rs:8:8
+  --> $DIR/filter-relevant-fn-bounds.rs:11:12
    |
-LL |     fn do_something_wrapper<O, F>(self, _: F)
-   |        ^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Output<'a>` is not implemented for `F`
+LL |         F: for<'a> FnOnce(<F as Output<'a>>::Type),
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Output<'a>` is not implemented for `F`
    |
 help: consider further restricting type parameter `F` with trait `Output`
    |
 LL |         F: for<'a> FnOnce(<F as Output<'a>>::Type) + for<'a> Output<'a>,
    |                                                    ++++++++++++++++++++
 
-error[E0277]: the trait bound `F: Output<'_>` is not satisfied
-  --> $DIR/filter-relevant-fn-bounds.rs:12:12
-   |
-LL |         F: for<'a> FnOnce(<F as Output<'a>>::Type),
-   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Output<'_>` is not implemented for `F`
-   |
-help: consider further restricting type parameter `F` with trait `Output`
-   |
-LL |         F: for<'a> FnOnce(<F as Output<'a>>::Type) + Output<'_>,
-   |                                                    ++++++++++++
-
-error[E0277]: the trait bound `F: Output<'_>` is not satisfied
-  --> $DIR/filter-relevant-fn-bounds.rs:12:20
+error[E0277]: the trait bound `for<'a> F: Output<'a>` is not satisfied
+  --> $DIR/filter-relevant-fn-bounds.rs:11:20
    |
 LL |         F: for<'a> FnOnce(<F as Output<'a>>::Type),
-   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Output<'_>` is not implemented for `F`
+   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Output<'a>` is not implemented for `F`
    |
 help: consider further restricting type parameter `F` with trait `Output`
    |
-LL |         F: for<'a> FnOnce(<F as Output<'a>>::Type) + Output<'_>,
-   |                                                    ++++++++++++
+LL |         F: for<'a> FnOnce(<F as Output<'a>>::Type) + for<'a> Output<'a>,
+   |                                                    ++++++++++++++++++++
 
-error[E0277]: expected a `FnOnce(<{closure@$DIR/filter-relevant-fn-bounds.rs:21:34: 21:41} as Output<'a>>::Type)` closure, found `{closure@$DIR/filter-relevant-fn-bounds.rs:21:34: 21:41}`
-  --> $DIR/filter-relevant-fn-bounds.rs:21:34
+error[E0277]: expected a `FnOnce(<{closure@$DIR/filter-relevant-fn-bounds.rs:20:34: 20:41} as Output<'a>>::Type)` closure, found `{closure@$DIR/filter-relevant-fn-bounds.rs:20:34: 20:41}`
+  --> $DIR/filter-relevant-fn-bounds.rs:20:34
    |
 LL |     wrapper.do_something_wrapper(|value| ());
-   |             -------------------- ^^^^^^^^^^ expected an `FnOnce(<{closure@$DIR/filter-relevant-fn-bounds.rs:21:34: 21:41} as Output<'a>>::Type)` closure, found `{closure@$DIR/filter-relevant-fn-bounds.rs:21:34: 21:41}`
+   |             -------------------- ^^^^^^^^^^ expected an `FnOnce(<{closure@$DIR/filter-relevant-fn-bounds.rs:20:34: 20:41} as Output<'a>>::Type)` closure, found `{closure@$DIR/filter-relevant-fn-bounds.rs:20:34: 20:41}`
    |             |
    |             required by a bound introduced by this call
    |
-   = help: the trait `for<'a> Output<'a>` is not implemented for closure `{closure@$DIR/filter-relevant-fn-bounds.rs:21:34: 21:41}`
+   = help: the trait `for<'a> Output<'a>` is not implemented for closure `{closure@$DIR/filter-relevant-fn-bounds.rs:20:34: 20:41}`
 help: this trait has no implementations, consider adding one
   --> $DIR/filter-relevant-fn-bounds.rs:1:1
    |
 LL | trait Output<'a> {
    | ^^^^^^^^^^^^^^^^
 note: required by a bound in `Wrapper::do_something_wrapper`
-  --> $DIR/filter-relevant-fn-bounds.rs:12:12
+  --> $DIR/filter-relevant-fn-bounds.rs:11:12
    |
 LL |     fn do_something_wrapper<O, F>(self, _: F)
    |        -------------------- required by a bound in this associated function
@@ -69,6 +57,6 @@ LL |     fn do_something_wrapper<O, F>(self, _: F)
 LL |         F: for<'a> FnOnce(<F as Output<'a>>::Type),
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Wrapper::do_something_wrapper`
 
-error: aborting due to 5 previous errors
+error: aborting due to 4 previous errors
 
 For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/regions/lifetime-not-long-enough-suggestion-regression-test-124563.stderr b/tests/ui/regions/lifetime-not-long-enough-suggestion-regression-test-124563.stderr
index 9f1315070eb..e94074548e9 100644
--- a/tests/ui/regions/lifetime-not-long-enough-suggestion-regression-test-124563.stderr
+++ b/tests/ui/regions/lifetime-not-long-enough-suggestion-regression-test-124563.stderr
@@ -1,8 +1,8 @@
 error[E0478]: lifetime bound not satisfied
-  --> $DIR/lifetime-not-long-enough-suggestion-regression-test-124563.rs:19:16
+  --> $DIR/lifetime-not-long-enough-suggestion-regression-test-124563.rs:19:5
    |
 LL |     type Bar = BarImpl<'a, 'b, T>;
-   |                ^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^
    |
 note: lifetime parameter instantiated with the lifetime `'a` as defined here
   --> $DIR/lifetime-not-long-enough-suggestion-regression-test-124563.rs:14:6
diff --git a/tests/ui/regions/region-bounds-on-objects-and-type-parameters.stderr b/tests/ui/regions/region-bounds-on-objects-and-type-parameters.stderr
index b15d2affeea..e2a5027e710 100644
--- a/tests/ui/regions/region-bounds-on-objects-and-type-parameters.stderr
+++ b/tests/ui/regions/region-bounds-on-objects-and-type-parameters.stderr
@@ -4,6 +4,14 @@ error[E0226]: only a single explicit lifetime bound is permitted
 LL |     z: Box<dyn Is<'a>+'b+'c>,
    |                          ^^
 
+error[E0392]: lifetime parameter `'c` is never used
+  --> $DIR/region-bounds-on-objects-and-type-parameters.rs:11:18
+   |
+LL | struct Foo<'a,'b,'c> {
+   |                  ^^ unused lifetime parameter
+   |
+   = help: consider removing `'c`, referring to it in a field, or using a marker such as `PhantomData`
+
 error[E0478]: lifetime bound not satisfied
   --> $DIR/region-bounds-on-objects-and-type-parameters.rs:21:8
    |
@@ -21,14 +29,6 @@ note: but lifetime parameter must outlive the lifetime `'a` as defined here
 LL | struct Foo<'a,'b,'c> {
    |            ^^
 
-error[E0392]: lifetime parameter `'c` is never used
-  --> $DIR/region-bounds-on-objects-and-type-parameters.rs:11:18
-   |
-LL | struct Foo<'a,'b,'c> {
-   |                  ^^ unused lifetime parameter
-   |
-   = help: consider removing `'c`, referring to it in a field, or using a marker such as `PhantomData`
-
 error: aborting due to 3 previous errors
 
 Some errors have detailed explanations: E0226, E0392, E0478.
diff --git a/tests/ui/regions/regions-normalize-in-where-clause-list.rs b/tests/ui/regions/regions-normalize-in-where-clause-list.rs
index 389f82e794b..9b046e6baed 100644
--- a/tests/ui/regions/regions-normalize-in-where-clause-list.rs
+++ b/tests/ui/regions/regions-normalize-in-where-clause-list.rs
@@ -22,9 +22,9 @@ where
 
 // Here we get an error: we need `'a: 'b`.
 fn bar<'a, 'b>()
-//~^ ERROR cannot infer
 where
     <() as Project<'a, 'b>>::Item: Eq,
+    //~^ ERROR cannot infer
 {
 }
 
diff --git a/tests/ui/regions/regions-normalize-in-where-clause-list.stderr b/tests/ui/regions/regions-normalize-in-where-clause-list.stderr
index ca9ceeeeff3..9a5c9ae53de 100644
--- a/tests/ui/regions/regions-normalize-in-where-clause-list.stderr
+++ b/tests/ui/regions/regions-normalize-in-where-clause-list.stderr
@@ -1,8 +1,8 @@
 error[E0803]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
-  --> $DIR/regions-normalize-in-where-clause-list.rs:24:4
+  --> $DIR/regions-normalize-in-where-clause-list.rs:26:36
    |
-LL | fn bar<'a, 'b>()
-   |    ^^^
+LL |     <() as Project<'a, 'b>>::Item: Eq,
+   |                                    ^^
    |
 note: first, the lifetime cannot outlive the lifetime `'a` as defined here...
   --> $DIR/regions-normalize-in-where-clause-list.rs:24:8
@@ -15,10 +15,10 @@ note: ...but the lifetime must also be valid for the lifetime `'b` as defined he
 LL | fn bar<'a, 'b>()
    |            ^^
 note: ...so that the types are compatible
-  --> $DIR/regions-normalize-in-where-clause-list.rs:24:4
+  --> $DIR/regions-normalize-in-where-clause-list.rs:26:36
    |
-LL | fn bar<'a, 'b>()
-   |    ^^^
+LL |     <() as Project<'a, 'b>>::Item: Eq,
+   |                                    ^^
    = note: expected `Project<'a, 'b>`
               found `Project<'_, '_>`
 
diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr
index 591585c88f5..01a3f528359 100644
--- a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr
+++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr
@@ -1,8 +1,8 @@
 error[E0491]: in type `&'a Foo<'b>`, reference has a longer lifetime than the data it references
-  --> $DIR/regions-outlives-nominal-type-region-rev.rs:17:20
+  --> $DIR/regions-outlives-nominal-type-region-rev.rs:17:9
    |
 LL |         type Out = &'a Foo<'b>;
-   |                    ^^^^^^^^^^^
+   |         ^^^^^^^^
    |
 note: the pointer is valid for the lifetime `'a` as defined here
   --> $DIR/regions-outlives-nominal-type-region-rev.rs:16:10
diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr
index 0404b52d9ef..ff4c5f07284 100644
--- a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr
+++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr
@@ -1,8 +1,8 @@
 error[E0491]: in type `&'a Foo<'b>`, reference has a longer lifetime than the data it references
-  --> $DIR/regions-outlives-nominal-type-region.rs:17:20
+  --> $DIR/regions-outlives-nominal-type-region.rs:17:9
    |
 LL |         type Out = &'a Foo<'b>;
-   |                    ^^^^^^^^^^^
+   |         ^^^^^^^^
    |
 note: the pointer is valid for the lifetime `'a` as defined here
   --> $DIR/regions-outlives-nominal-type-region.rs:16:10
diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr
index 62415e250ec..a0ede2aeada 100644
--- a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr
+++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr
@@ -1,8 +1,8 @@
 error[E0491]: in type `&'a Foo<&'b i32>`, reference has a longer lifetime than the data it references
-  --> $DIR/regions-outlives-nominal-type-type-rev.rs:17:20
+  --> $DIR/regions-outlives-nominal-type-type-rev.rs:17:9
    |
 LL |         type Out = &'a Foo<&'b i32>;
-   |                    ^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^
    |
 note: the pointer is valid for the lifetime `'a` as defined here
   --> $DIR/regions-outlives-nominal-type-type-rev.rs:16:10
diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr
index 464d7968b74..23d3f4ac606 100644
--- a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr
+++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr
@@ -1,8 +1,8 @@
 error[E0491]: in type `&'a Foo<&'b i32>`, reference has a longer lifetime than the data it references
-  --> $DIR/regions-outlives-nominal-type-type.rs:17:20
+  --> $DIR/regions-outlives-nominal-type-type.rs:17:9
    |
 LL |         type Out = &'a Foo<&'b i32>;
-   |                    ^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^
    |
 note: the pointer is valid for the lifetime `'a` as defined here
   --> $DIR/regions-outlives-nominal-type-type.rs:16:10
diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr
index eb17ce736f7..73c0bbc44fb 100644
--- a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr
+++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr
@@ -1,10 +1,10 @@
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/regions-struct-not-wf.rs:13:16
+  --> $DIR/regions-struct-not-wf.rs:13:5
    |
 LL | impl<'a, T> Trait<'a, T> for usize {
    |      -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
 LL |     type Out = &'a T;
-   |                ^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at
+   |     ^^^^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at
    |
 help: consider adding an explicit lifetime bound
    |
@@ -12,12 +12,12 @@ LL | impl<'a, T: 'a> Trait<'a, T> for usize {
    |           ++++
 
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/regions-struct-not-wf.rs:21:16
+  --> $DIR/regions-struct-not-wf.rs:21:5
    |
 LL | impl<'a, T> Trait<'a, T> for u32 {
    |      -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
 LL |     type Out = RefOk<'a, T>;
-   |                ^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds...
+   |     ^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds...
    |
 note: ...that is required by this bound
   --> $DIR/regions-struct-not-wf.rs:16:20
@@ -30,10 +30,10 @@ LL | impl<'a, T: 'a> Trait<'a, T> for u32 {
    |           ++++
 
 error[E0491]: in type `&'a &'b T`, reference has a longer lifetime than the data it references
-  --> $DIR/regions-struct-not-wf.rs:25:16
+  --> $DIR/regions-struct-not-wf.rs:25:5
    |
 LL |     type Out = &'a &'b T;
-   |                ^^^^^^^^^
+   |     ^^^^^^^^
    |
 note: the pointer is valid for the lifetime `'a` as defined here
   --> $DIR/regions-struct-not-wf.rs:24:6
diff --git a/tests/ui/simd/array-trait.stderr b/tests/ui/simd/array-trait.stderr
index 299f0ad96ae..47f395044ff 100644
--- a/tests/ui/simd/array-trait.stderr
+++ b/tests/ui/simd/array-trait.stderr
@@ -1,3 +1,9 @@
+error[E0077]: SIMD vector element type should be a primitive scalar (integer/float/pointer) type
+  --> $DIR/array-trait.rs:22:1
+   |
+LL | pub struct T<S: Simd>([S::Lane; S::SIZE]);
+   | ^^^^^^^^^^^^^^^^^^^^^
+
 error: unconstrained generic constant
   --> $DIR/array-trait.rs:22:23
    |
@@ -9,12 +15,6 @@ help: try adding a `where` bound
 LL | pub struct T<S: Simd>([S::Lane; S::SIZE]) where [(); S::SIZE]:;
    |                                           ++++++++++++++++++++
 
-error[E0077]: SIMD vector element type should be a primitive scalar (integer/float/pointer) type
-  --> $DIR/array-trait.rs:22:1
-   |
-LL | pub struct T<S: Simd>([S::Lane; S::SIZE]);
-   | ^^^^^^^^^^^^^^^^^^^^^
-
 error: unconstrained generic constant
   --> $DIR/array-trait.rs:22:23
    |
diff --git a/tests/ui/specialization/defaultimpl/validation.stderr b/tests/ui/specialization/defaultimpl/validation.stderr
index d034386b842..82a33bf9cdc 100644
--- a/tests/ui/specialization/defaultimpl/validation.stderr
+++ b/tests/ui/specialization/defaultimpl/validation.stderr
@@ -18,14 +18,6 @@ LL | #![feature(specialization)]
    = help: consider using `min_specialization` instead, which is more stable and complete
    = note: `#[warn(incomplete_features)]` on by default
 
-error: impls of auto traits cannot be default
-  --> $DIR/validation.rs:9:21
-   |
-LL | default unsafe impl Send for S {}
-   | -------             ^^^^ auto trait
-   | |
-   | default because of this
-
 error[E0367]: `!Send` impl requires `Z: Send` but the struct it is implemented for does not
   --> $DIR/validation.rs:12:1
    |
@@ -39,6 +31,14 @@ LL | struct Z;
    | ^^^^^^^^
 
 error: impls of auto traits cannot be default
+  --> $DIR/validation.rs:9:21
+   |
+LL | default unsafe impl Send for S {}
+   | -------             ^^^^ auto trait
+   | |
+   | default because of this
+
+error: impls of auto traits cannot be default
   --> $DIR/validation.rs:12:15
    |
 LL | default impl !Send for Z {}
diff --git a/tests/ui/specialization/issue-51892.stderr b/tests/ui/specialization/issue-51892.stderr
index b1cabc0ac0e..f327f10438d 100644
--- a/tests/ui/specialization/issue-51892.stderr
+++ b/tests/ui/specialization/issue-51892.stderr
@@ -1,8 +1,8 @@
 error: unconstrained generic constant
-  --> $DIR/issue-51892.rs:14:17
+  --> $DIR/issue-51892.rs:14:5
    |
 LL |     type Type = [u8; std::mem::size_of::<<T as Trait>::Type>()];
-   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^
    |
 help: try adding a `where` bound
    |
diff --git a/tests/ui/specialization/min_specialization/issue-79224.stderr b/tests/ui/specialization/min_specialization/issue-79224.stderr
index 2ed614f1857..9b6c931f909 100644
--- a/tests/ui/specialization/min_specialization/issue-79224.stderr
+++ b/tests/ui/specialization/min_specialization/issue-79224.stderr
@@ -1,8 +1,8 @@
 error[E0277]: the trait bound `B: Clone` is not satisfied
-  --> $DIR/issue-79224.rs:28:29
+  --> $DIR/issue-79224.rs:30:5
    |
-LL | impl<B: ?Sized> Display for Cow<'_, B> {
-   |                             ^^^^^^^^^^ the trait `Clone` is not implemented for `B`
+LL |     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `B`
    |
    = note: required for `B` to implement `ToOwned`
 help: consider further restricting type parameter `B` with trait `Clone`
@@ -11,10 +11,10 @@ LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
    |                +++++++++++++++++++
 
 error[E0277]: the trait bound `B: Clone` is not satisfied
-  --> $DIR/issue-79224.rs:30:5
+  --> $DIR/issue-79224.rs:28:29
    |
-LL |     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `B`
+LL | impl<B: ?Sized> Display for Cow<'_, B> {
+   |                             ^^^^^^^^^^ the trait `Clone` is not implemented for `B`
    |
    = note: required for `B` to implement `ToOwned`
 help: consider further restricting type parameter `B` with trait `Clone`
diff --git a/tests/ui/static/issue-24446.stderr b/tests/ui/static/issue-24446.stderr
index 0e6e338c5ef..6e35db7cc4a 100644
--- a/tests/ui/static/issue-24446.stderr
+++ b/tests/ui/static/issue-24446.stderr
@@ -1,17 +1,17 @@
 error[E0277]: `(dyn Fn() -> u32 + 'static)` cannot be shared between threads safely
-  --> $DIR/issue-24446.rs:2:17
+  --> $DIR/issue-24446.rs:2:5
    |
 LL |     static foo: dyn Fn() -> u32 = || -> u32 {
-   |                 ^^^^^^^^^^^^^^^ `(dyn Fn() -> u32 + 'static)` cannot be shared between threads safely
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Fn() -> u32 + 'static)` cannot be shared between threads safely
    |
    = help: the trait `Sync` is not implemented for `(dyn Fn() -> u32 + 'static)`
    = note: shared static variables must have a type that implements `Sync`
 
 error[E0277]: the size for values of type `(dyn Fn() -> u32 + 'static)` cannot be known at compilation time
-  --> $DIR/issue-24446.rs:2:17
+  --> $DIR/issue-24446.rs:2:5
    |
 LL |     static foo: dyn Fn() -> u32 = || -> u32 {
-   |                 ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `Sized` is not implemented for `(dyn Fn() -> u32 + 'static)`
    = note: statics and constants must have a statically known size
diff --git a/tests/ui/statics/issue-17718-static-sync.stderr b/tests/ui/statics/issue-17718-static-sync.stderr
index 96f894146c5..d49dbd947c5 100644
--- a/tests/ui/statics/issue-17718-static-sync.stderr
+++ b/tests/ui/statics/issue-17718-static-sync.stderr
@@ -1,8 +1,8 @@
 error[E0277]: `Foo` cannot be shared between threads safely
-  --> $DIR/issue-17718-static-sync.rs:9:13
+  --> $DIR/issue-17718-static-sync.rs:9:1
    |
 LL | static BAR: Foo = Foo;
-   |             ^^^ `Foo` cannot be shared between threads safely
+   | ^^^^^^^^^^^^^^^ `Foo` cannot be shared between threads safely
    |
    = help: the trait `Sync` is not implemented for `Foo`
    = note: shared static variables must have a type that implements `Sync`
diff --git a/tests/ui/statics/uninhabited-static.stderr b/tests/ui/statics/uninhabited-static.stderr
index f799a82f139..a0f9ad6772d 100644
--- a/tests/ui/statics/uninhabited-static.stderr
+++ b/tests/ui/statics/uninhabited-static.stderr
@@ -1,8 +1,8 @@
 error: static of uninhabited type
-  --> $DIR/uninhabited-static.rs:6:5
+  --> $DIR/uninhabited-static.rs:12:1
    |
-LL |     static VOID: Void;
-   |     ^^^^^^^^^^^^^^^^^
+LL | static VOID2: Void = unsafe { std::mem::transmute(()) };
+   | ^^^^^^^^^^^^^^^^^^
    |
    = 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 #74840 <https://github.com/rust-lang/rust/issues/74840>
@@ -14,30 +14,30 @@ LL | #![deny(uninhabited_static)]
    |         ^^^^^^^^^^^^^^^^^^
 
 error: static of uninhabited type
-  --> $DIR/uninhabited-static.rs:8:5
+  --> $DIR/uninhabited-static.rs:15:1
    |
-LL |     static NEVER: !;
-   |     ^^^^^^^^^^^^^^^
+LL | static NEVER2: Void = unsafe { std::mem::transmute(()) };
+   | ^^^^^^^^^^^^^^^^^^^
    |
    = 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 #74840 <https://github.com/rust-lang/rust/issues/74840>
    = note: uninhabited statics cannot be initialized, and any access would be an immediate error
 
 error: static of uninhabited type
-  --> $DIR/uninhabited-static.rs:12:1
+  --> $DIR/uninhabited-static.rs:6:5
    |
-LL | static VOID2: Void = unsafe { std::mem::transmute(()) };
-   | ^^^^^^^^^^^^^^^^^^
+LL |     static VOID: Void;
+   |     ^^^^^^^^^^^^^^^^^
    |
    = 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 #74840 <https://github.com/rust-lang/rust/issues/74840>
    = note: uninhabited statics cannot be initialized, and any access would be an immediate error
 
 error: static of uninhabited type
-  --> $DIR/uninhabited-static.rs:15:1
+  --> $DIR/uninhabited-static.rs:8:5
    |
-LL | static NEVER2: Void = unsafe { std::mem::transmute(()) };
-   | ^^^^^^^^^^^^^^^^^^^
+LL |     static NEVER: !;
+   |     ^^^^^^^^^^^^^^^
    |
    = 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 #74840 <https://github.com/rust-lang/rust/issues/74840>
diff --git a/tests/ui/statics/unsized_type2.stderr b/tests/ui/statics/unsized_type2.stderr
index 3f9b0879c16..293df7554e9 100644
--- a/tests/ui/statics/unsized_type2.stderr
+++ b/tests/ui/statics/unsized_type2.stderr
@@ -1,8 +1,8 @@
 error[E0277]: the size for values of type `str` cannot be known at compilation time
-  --> $DIR/unsized_type2.rs:14:24
+  --> $DIR/unsized_type2.rs:14:1
    |
 LL | pub static WITH_ERROR: Foo = Foo { version: 0 };
-   |                        ^^^ doesn't have a size known at compile-time
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
    |
    = help: within `Foo`, the trait `Sized` is not implemented for `str`
 note: required because it appears within the type `Foo`
diff --git a/tests/ui/statics/unsizing-wfcheck-issue-127299.stderr b/tests/ui/statics/unsizing-wfcheck-issue-127299.stderr
index e401277a020..8a19207c5d7 100644
--- a/tests/ui/statics/unsizing-wfcheck-issue-127299.stderr
+++ b/tests/ui/statics/unsizing-wfcheck-issue-127299.stderr
@@ -22,10 +22,10 @@ LL |     fn bar() -> i32 where Self: Sized;
    |                     +++++++++++++++++
 
 error[E0277]: `(dyn Qux + 'static)` cannot be shared between threads safely
-  --> $DIR/unsizing-wfcheck-issue-127299.rs:12:13
+  --> $DIR/unsizing-wfcheck-issue-127299.rs:12:1
    |
 LL | static FOO: &Lint = &Lint { desc: "desc" };
-   |             ^^^^^ `(dyn Qux + 'static)` cannot be shared between threads safely
+   | ^^^^^^^^^^^^^^^^^ `(dyn Qux + 'static)` cannot be shared between threads safely
    |
    = help: within `&'static Lint`, the trait `Sync` is not implemented for `(dyn Qux + 'static)`
    = note: required because it appears within the type `&'static (dyn Qux + 'static)`
diff --git a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr
index eedaae43f9a..54c0cf8ebee 100644
--- a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr
+++ b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr
@@ -1,9 +1,3 @@
-error[E0207]: the type parameter `S` is not constrained by the impl trait, self type, or predicates
-  --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:9:9
-   |
-LL | impl<T, S> Trait<T> for i32 {
-   |         ^ unconstrained type parameter
-
 error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
   --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:15:12
    |
@@ -16,6 +10,12 @@ note: trait defined here, with 1 generic parameter: `T`
 LL | pub trait Trait<T> {
    |           ^^^^^ -
 
+error[E0207]: the type parameter `S` is not constrained by the impl trait, self type, or predicates
+  --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:9:9
+   |
+LL | impl<T, S> Trait<T> for i32 {
+   |         ^ unconstrained type parameter
+
 error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
   --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:19:12
    |
diff --git a/tests/ui/traits/constrained-type-params-trait-impl.stderr b/tests/ui/traits/constrained-type-params-trait-impl.stderr
index 2175129a8df..e59fad6e72d 100644
--- a/tests/ui/traits/constrained-type-params-trait-impl.stderr
+++ b/tests/ui/traits/constrained-type-params-trait-impl.stderr
@@ -35,6 +35,17 @@ error[E0207]: the type parameter `U` is not constrained by the impl trait, self
 LL | impl<T, U> Foo<T> for [isize; 1] {
    |         ^ unconstrained type parameter
 
+error[E0119]: conflicting implementations of trait `Bar`
+  --> $DIR/constrained-type-params-trait-impl.rs:48:1
+   |
+LL |   impl<T, U> Bar for T {
+   |   -------------------- first implementation here
+...
+LL | / impl<T, U> Bar for T
+LL | | where
+LL | |     T: Bar<Out = U>,
+   | |____________________^ conflicting implementation
+
 error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates
   --> $DIR/constrained-type-params-trait-impl.rs:42:9
    |
@@ -59,17 +70,6 @@ error[E0207]: the type parameter `V` is not constrained by the impl trait, self
 LL | impl<T, U, V> Foo<T> for T
    |            ^ unconstrained type parameter
 
-error[E0119]: conflicting implementations of trait `Bar`
-  --> $DIR/constrained-type-params-trait-impl.rs:48:1
-   |
-LL |   impl<T, U> Bar for T {
-   |   -------------------- first implementation here
-...
-LL | / impl<T, U> Bar for T
-LL | | where
-LL | |     T: Bar<Out = U>,
-   | |____________________^ conflicting implementation
-
 error: aborting due to 9 previous errors
 
 Some errors have detailed explanations: E0119, E0207.
diff --git a/tests/ui/traits/deep-norm-pending.rs b/tests/ui/traits/deep-norm-pending.rs
index f56c3cfa3ea..d6c498dcf2b 100644
--- a/tests/ui/traits/deep-norm-pending.rs
+++ b/tests/ui/traits/deep-norm-pending.rs
@@ -8,9 +8,10 @@ trait Bar {
 }
 impl<T> Bar for T
 //~^ ERROR the trait bound `T: Foo` is not satisfied
-//~| ERROR the trait bound `T: Foo` is not satisfied
 where
     <T as Foo>::Assoc: Sized,
+    //~^ ERROR the trait bound `T: Foo` is not satisfied
+    //~| ERROR the trait bound `T: Foo` is not satisfied
 {
     fn method() {}
     //~^ ERROR the trait bound `T: Foo` is not satisfied
@@ -18,7 +19,6 @@ where
     //~| ERROR the trait bound `T: Foo` is not satisfied
     //~| ERROR the trait bound `T: Foo` is not satisfied
     //~| ERROR the trait bound `T: Foo` is not satisfied
-    //~| ERROR the trait bound `T: Foo` is not satisfied
 }
 
 fn main() {}
diff --git a/tests/ui/traits/deep-norm-pending.stderr b/tests/ui/traits/deep-norm-pending.stderr
index b95b9d7f4ae..c1d6120c390 100644
--- a/tests/ui/traits/deep-norm-pending.stderr
+++ b/tests/ui/traits/deep-norm-pending.stderr
@@ -1,20 +1,8 @@
 error[E0277]: the trait bound `T: Foo` is not satisfied
-  --> $DIR/deep-norm-pending.rs:15:5
-   |
-LL |     fn method() {}
-   |     ^^^^^^^^^^^ the trait `Foo` is not implemented for `T`
-   |
-help: consider further restricting type parameter `T` with trait `Foo`
-   |
-LL |     <T as Foo>::Assoc: Sized, T: Foo
-   |                               ++++++
-
-error[E0277]: the trait bound `T: Foo` is not satisfied
   --> $DIR/deep-norm-pending.rs:9:1
    |
 LL | / impl<T> Bar for T
 LL | |
-LL | |
 LL | | where
 LL | |     <T as Foo>::Assoc: Sized,
    | |_____________________________^ the trait `Foo` is not implemented for `T`
@@ -25,15 +13,10 @@ LL |     <T as Foo>::Assoc: Sized, T: Foo
    |                               ++++++
 
 error[E0277]: the trait bound `T: Foo` is not satisfied
-  --> $DIR/deep-norm-pending.rs:9:1
+  --> $DIR/deep-norm-pending.rs:16:5
    |
-LL | / impl<T> Bar for T
-LL | |
-LL | |
-LL | | where
-...  |
-LL | | }
-   | |_^ the trait `Foo` is not implemented for `T`
+LL |     fn method() {}
+   |     ^^^^^^^^^^^ the trait `Foo` is not implemented for `T`
    |
 help: consider further restricting type parameter `T` with trait `Foo`
    |
@@ -41,7 +24,7 @@ LL |     <T as Foo>::Assoc: Sized, T: Foo
    |                               ++++++
 
 error[E0277]: the trait bound `T: Foo` is not satisfied
-  --> $DIR/deep-norm-pending.rs:15:5
+  --> $DIR/deep-norm-pending.rs:16:5
    |
 LL |     fn method() {}
    |     ^^^^^^^^^^^ the trait `Foo` is not implemented for `T`
@@ -53,7 +36,7 @@ LL |     <T as Foo>::Assoc: Sized, T: Foo
    |                               ++++++
 
 error[E0277]: the trait bound `T: Foo` is not satisfied
-  --> $DIR/deep-norm-pending.rs:15:5
+  --> $DIR/deep-norm-pending.rs:16:5
    |
 LL |     fn method() {}
    |     ^^^^^^^^^^^ the trait `Foo` is not implemented for `T`
@@ -72,7 +55,7 @@ LL |     <T as Foo>::Assoc: Sized, T: Foo
    |                               ++++++
 
 error[E0277]: the trait bound `T: Foo` is not satisfied
-  --> $DIR/deep-norm-pending.rs:15:5
+  --> $DIR/deep-norm-pending.rs:16:5
    |
 LL |     fn method() {}
    |     ^^^^^^^^^^^ the trait `Foo` is not implemented for `T`
@@ -103,7 +86,18 @@ LL |     <T as Foo>::Assoc: Sized, T: Foo
    |                               ++++++
 
 error[E0277]: the trait bound `T: Foo` is not satisfied
-  --> $DIR/deep-norm-pending.rs:15:5
+  --> $DIR/deep-norm-pending.rs:12:24
+   |
+LL |     <T as Foo>::Assoc: Sized,
+   |                        ^^^^^ the trait `Foo` is not implemented for `T`
+   |
+help: consider further restricting type parameter `T` with trait `Foo`
+   |
+LL |     <T as Foo>::Assoc: Sized, T: Foo
+   |                               ++++++
+
+error[E0277]: the trait bound `T: Foo` is not satisfied
+  --> $DIR/deep-norm-pending.rs:16:5
    |
 LL |     fn method() {}
    |     ^^^^^^^^^^^ the trait `Foo` is not implemented for `T`
@@ -115,11 +109,12 @@ LL |     <T as Foo>::Assoc: Sized, T: Foo
    |                               ++++++
 
 error[E0277]: the trait bound `T: Foo` is not satisfied
-  --> $DIR/deep-norm-pending.rs:15:8
+  --> $DIR/deep-norm-pending.rs:12:24
    |
-LL |     fn method() {}
-   |        ^^^^^^ the trait `Foo` is not implemented for `T`
+LL |     <T as Foo>::Assoc: Sized,
+   |                        ^^^^^ the trait `Foo` is not implemented for `T`
    |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 help: consider further restricting type parameter `T` with trait `Foo`
    |
 LL |     <T as Foo>::Assoc: Sized, T: Foo
diff --git a/tests/ui/traits/issue-105231.stderr b/tests/ui/traits/issue-105231.stderr
index e113f8382b2..b048548018a 100644
--- a/tests/ui/traits/issue-105231.stderr
+++ b/tests/ui/traits/issue-105231.stderr
@@ -1,3 +1,14 @@
+error: type parameter `T` is only used recursively
+  --> $DIR/issue-105231.rs:1:15
+   |
+LL | struct A<T>(B<T>);
+   |          -    ^
+   |          |
+   |          type parameter must be used non-recursively in the definition
+   |
+   = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
+   = note: all type parameters must be used in a non-recursive way in order to constrain their variance
+
 error[E0072]: recursive types `A` and `B` have infinite size
   --> $DIR/issue-105231.rs:1:1
    |
@@ -16,17 +27,6 @@ LL ~ struct B<T>(Box<A<A<T>>>);
    |
 
 error: type parameter `T` is only used recursively
-  --> $DIR/issue-105231.rs:1:15
-   |
-LL | struct A<T>(B<T>);
-   |          -    ^
-   |          |
-   |          type parameter must be used non-recursively in the definition
-   |
-   = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
-   = note: all type parameters must be used in a non-recursive way in order to constrain their variance
-
-error: type parameter `T` is only used recursively
   --> $DIR/issue-105231.rs:4:17
    |
 LL | struct B<T>(A<A<T>>);
diff --git a/tests/ui/traits/issue-78372.stderr b/tests/ui/traits/issue-78372.stderr
index fbc60ce5d83..a1c772f58e1 100644
--- a/tests/ui/traits/issue-78372.stderr
+++ b/tests/ui/traits/issue-78372.stderr
@@ -56,6 +56,12 @@ LL | impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {}
    = help: add `#![feature(dispatch_from_dyn)]` 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[E0377]: the trait `DispatchFromDyn` may only be implemented for a coercion between structures
+  --> $DIR/issue-78372.rs:3:1
+   |
+LL | impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
 error[E0307]: invalid `self` parameter type: `Smaht<Self, T>`
   --> $DIR/issue-78372.rs:9:18
    |
@@ -65,12 +71,6 @@ LL |     fn foo(self: Smaht<Self, T>);
    = 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[E0377]: the trait `DispatchFromDyn` may only be implemented for a coercion between structures
-  --> $DIR/issue-78372.rs:3:1
-   |
-LL | impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
 error: aborting due to 7 previous errors
 
 Some errors have detailed explanations: E0307, E0377, E0412, E0658.
diff --git a/tests/ui/traits/issue-87558.stderr b/tests/ui/traits/issue-87558.stderr
index 4cc3ec2ea8b..dc5bd6ece36 100644
--- a/tests/ui/traits/issue-87558.stderr
+++ b/tests/ui/traits/issue-87558.stderr
@@ -24,6 +24,14 @@ help: parenthesized trait syntax expands to `Fn<(&isize,), Output=()>`
 LL | impl Fn(&isize) for Error {
    |      ^^^^^^^^^^
 
+error[E0046]: not all trait items implemented, missing: `call`
+  --> $DIR/issue-87558.rs:3:1
+   |
+LL | impl Fn(&isize) for Error {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation
+   |
+   = help: implement the missing item: `fn call(&self, _: (&isize,)) -> <Self as FnOnce<(&isize,)>>::Output { todo!() }`
+
 error[E0277]: expected a `FnMut(&isize)` closure, found `Error`
   --> $DIR/issue-87558.rs:3:21
    |
@@ -34,14 +42,6 @@ LL | impl Fn(&isize) for Error {
 note: required by a bound in `Fn`
   --> $SRC_DIR/core/src/ops/function.rs:LL:COL
 
-error[E0046]: not all trait items implemented, missing: `call`
-  --> $DIR/issue-87558.rs:3:1
-   |
-LL | impl Fn(&isize) for Error {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation
-   |
-   = help: implement the missing item: `fn call(&self, _: (&isize,)) -> <Self as FnOnce<(&isize,)>>::Output { todo!() }`
-
 error: aborting due to 5 previous errors
 
 Some errors have detailed explanations: E0046, E0183, E0229, E0277, E0407.
diff --git a/tests/ui/traits/next-solver/issue-118950-root-region.stderr b/tests/ui/traits/next-solver/issue-118950-root-region.stderr
index 45fa33dff52..391272b8d3b 100644
--- a/tests/ui/traits/next-solver/issue-118950-root-region.stderr
+++ b/tests/ui/traits/next-solver/issue-118950-root-region.stderr
@@ -14,10 +14,10 @@ LL | #![feature(lazy_type_alias)]
    = note: `#[warn(incomplete_features)]` on by default
 
 error[E0277]: the trait bound `*const T: ToUnit<'a>` is not satisfied
-  --> $DIR/issue-118950-root-region.rs:14:21
+  --> $DIR/issue-118950-root-region.rs:14:1
    |
 LL | type Assoc<'a, T> = <*const T as ToUnit<'a>>::Unit;
-   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `ToUnit<'a>` is not implemented for `*const T`
+   | ^^^^^^^^^^^^^^^^^ the trait `ToUnit<'a>` is not implemented for `*const T`
    |
 help: this trait has no implementations, consider adding one
   --> $DIR/issue-118950-root-region.rs:8:1
diff --git a/tests/ui/traits/trait-upcasting/cyclic-trait-resolution.stderr b/tests/ui/traits/trait-upcasting/cyclic-trait-resolution.stderr
index b9988e2e6d3..4264f2688ac 100644
--- a/tests/ui/traits/trait-upcasting/cyclic-trait-resolution.stderr
+++ b/tests/ui/traits/trait-upcasting/cyclic-trait-resolution.stderr
@@ -9,7 +9,7 @@ note: cycle used when checking that `A` is well-formed
   --> $DIR/cyclic-trait-resolution.rs:1:1
    |
 LL | trait A: B + A {}
-   | ^^^^^^^^^^^^^^^^^
+   | ^^^^^^^^^^^^^^
    = 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 the implied predicates of `A`
diff --git a/tests/ui/traits/unconstrained-projection-normalization-2.current.stderr b/tests/ui/traits/unconstrained-projection-normalization-2.current.stderr
index 2bb389c6ec1..9ce0e8d957d 100644
--- a/tests/ui/traits/unconstrained-projection-normalization-2.current.stderr
+++ b/tests/ui/traits/unconstrained-projection-normalization-2.current.stderr
@@ -4,6 +4,31 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self
 LL | impl<T: ?Sized> Every for Thing {
    |      ^ unconstrained type parameter
 
-error: aborting due to 1 previous error
+error[E0277]: the size for values of type `T` cannot be known at compilation time
+  --> $DIR/unconstrained-projection-normalization-2.rs:16:18
+   |
+LL | impl<T: ?Sized> Every for Thing {
+   |      - this type parameter needs to be `Sized`
+LL |
+LL |     type Assoc = T;
+   |                  ^ doesn't have a size known at compile-time
+   |
+note: required by a bound in `Every::Assoc`
+  --> $DIR/unconstrained-projection-normalization-2.rs:12:5
+   |
+LL |     type Assoc;
+   |     ^^^^^^^^^^^ required by this bound in `Every::Assoc`
+help: consider removing the `?Sized` bound to make the type parameter `Sized`
+   |
+LL - impl<T: ?Sized> Every for Thing {
+LL + impl<T> Every for Thing {
+   |
+help: consider relaxing the implicit `Sized` restriction
+   |
+LL |     type Assoc: ?Sized;
+   |               ++++++++
+
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0207`.
+Some errors have detailed explanations: E0207, E0277.
+For more information about an error, try `rustc --explain E0207`.
diff --git a/tests/ui/traits/unconstrained-projection-normalization-2.next.stderr b/tests/ui/traits/unconstrained-projection-normalization-2.next.stderr
index 3eacab33e46..2da655afa93 100644
--- a/tests/ui/traits/unconstrained-projection-normalization-2.next.stderr
+++ b/tests/ui/traits/unconstrained-projection-normalization-2.next.stderr
@@ -4,13 +4,37 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self
 LL | impl<T: ?Sized> Every for Thing {
    |      ^ unconstrained type parameter
 
+error[E0277]: the size for values of type `T` cannot be known at compilation time
+  --> $DIR/unconstrained-projection-normalization-2.rs:16:18
+   |
+LL | impl<T: ?Sized> Every for Thing {
+   |      - this type parameter needs to be `Sized`
+LL |
+LL |     type Assoc = T;
+   |                  ^ doesn't have a size known at compile-time
+   |
+note: required by a bound in `Every::Assoc`
+  --> $DIR/unconstrained-projection-normalization-2.rs:12:5
+   |
+LL |     type Assoc;
+   |     ^^^^^^^^^^^ required by this bound in `Every::Assoc`
+help: consider removing the `?Sized` bound to make the type parameter `Sized`
+   |
+LL - impl<T: ?Sized> Every for Thing {
+LL + impl<T> Every for Thing {
+   |
+help: consider relaxing the implicit `Sized` restriction
+   |
+LL |     type Assoc: ?Sized;
+   |               ++++++++
+
 error[E0282]: type annotations needed
-  --> $DIR/unconstrained-projection-normalization-2.rs:19:11
+  --> $DIR/unconstrained-projection-normalization-2.rs:20:11
    |
 LL | fn foo(_: <Thing as Every>::Assoc) {}
    |           ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for associated type `<Thing as Every>::Assoc`
 
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
 
-Some errors have detailed explanations: E0207, E0282.
+Some errors have detailed explanations: E0207, E0277, E0282.
 For more information about an error, try `rustc --explain E0207`.
diff --git a/tests/ui/traits/unconstrained-projection-normalization-2.rs b/tests/ui/traits/unconstrained-projection-normalization-2.rs
index 9d95c73eea7..899d67571e7 100644
--- a/tests/ui/traits/unconstrained-projection-normalization-2.rs
+++ b/tests/ui/traits/unconstrained-projection-normalization-2.rs
@@ -12,8 +12,9 @@ pub trait Every {
     type Assoc;
 }
 impl<T: ?Sized> Every for Thing {
-//~^ ERROR the type parameter `T` is not constrained
+    //~^ ERROR the type parameter `T` is not constrained
     type Assoc = T;
+    //~^ ERROR: the size for values of type `T` cannot be known at compilation time
 }
 
 fn foo(_: <Thing as Every>::Assoc) {}
diff --git a/tests/ui/traits/unconstrained-projection-normalization.current.stderr b/tests/ui/traits/unconstrained-projection-normalization.current.stderr
index 991f0e8ba66..c52e8dd68aa 100644
--- a/tests/ui/traits/unconstrained-projection-normalization.current.stderr
+++ b/tests/ui/traits/unconstrained-projection-normalization.current.stderr
@@ -4,6 +4,31 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self
 LL | impl<T: ?Sized> Every for Thing {
    |      ^ unconstrained type parameter
 
-error: aborting due to 1 previous error
+error[E0277]: the size for values of type `T` cannot be known at compilation time
+  --> $DIR/unconstrained-projection-normalization.rs:15:18
+   |
+LL | impl<T: ?Sized> Every for Thing {
+   |      - this type parameter needs to be `Sized`
+LL |
+LL |     type Assoc = T;
+   |                  ^ doesn't have a size known at compile-time
+   |
+note: required by a bound in `Every::Assoc`
+  --> $DIR/unconstrained-projection-normalization.rs:11:5
+   |
+LL |     type Assoc;
+   |     ^^^^^^^^^^^ required by this bound in `Every::Assoc`
+help: consider removing the `?Sized` bound to make the type parameter `Sized`
+   |
+LL - impl<T: ?Sized> Every for Thing {
+LL + impl<T> Every for Thing {
+   |
+help: consider relaxing the implicit `Sized` restriction
+   |
+LL |     type Assoc: ?Sized;
+   |               ++++++++
+
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0207`.
+Some errors have detailed explanations: E0207, E0277.
+For more information about an error, try `rustc --explain E0207`.
diff --git a/tests/ui/traits/unconstrained-projection-normalization.next.stderr b/tests/ui/traits/unconstrained-projection-normalization.next.stderr
index 991f0e8ba66..c52e8dd68aa 100644
--- a/tests/ui/traits/unconstrained-projection-normalization.next.stderr
+++ b/tests/ui/traits/unconstrained-projection-normalization.next.stderr
@@ -4,6 +4,31 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self
 LL | impl<T: ?Sized> Every for Thing {
    |      ^ unconstrained type parameter
 
-error: aborting due to 1 previous error
+error[E0277]: the size for values of type `T` cannot be known at compilation time
+  --> $DIR/unconstrained-projection-normalization.rs:15:18
+   |
+LL | impl<T: ?Sized> Every for Thing {
+   |      - this type parameter needs to be `Sized`
+LL |
+LL |     type Assoc = T;
+   |                  ^ doesn't have a size known at compile-time
+   |
+note: required by a bound in `Every::Assoc`
+  --> $DIR/unconstrained-projection-normalization.rs:11:5
+   |
+LL |     type Assoc;
+   |     ^^^^^^^^^^^ required by this bound in `Every::Assoc`
+help: consider removing the `?Sized` bound to make the type parameter `Sized`
+   |
+LL - impl<T: ?Sized> Every for Thing {
+LL + impl<T> Every for Thing {
+   |
+help: consider relaxing the implicit `Sized` restriction
+   |
+LL |     type Assoc: ?Sized;
+   |               ++++++++
+
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0207`.
+Some errors have detailed explanations: E0207, E0277.
+For more information about an error, try `rustc --explain E0207`.
diff --git a/tests/ui/traits/unconstrained-projection-normalization.rs b/tests/ui/traits/unconstrained-projection-normalization.rs
index fa4ab7fec4c..8e9444533a8 100644
--- a/tests/ui/traits/unconstrained-projection-normalization.rs
+++ b/tests/ui/traits/unconstrained-projection-normalization.rs
@@ -11,8 +11,9 @@ pub trait Every {
     type Assoc;
 }
 impl<T: ?Sized> Every for Thing {
-//~^ ERROR the type parameter `T` is not constrained
+    //~^ ERROR the type parameter `T` is not constrained
     type Assoc = T;
+    //~^ ERROR: the size for values of type `T` cannot be known at compilation time
 }
 
 static I: <Thing as Every>::Assoc = 3;
diff --git a/tests/ui/typeck/issue-13853-5.rs b/tests/ui/typeck/issue-13853-5.rs
index fc97c6c67d6..47596aa4927 100644
--- a/tests/ui/typeck/issue-13853-5.rs
+++ b/tests/ui/typeck/issue-13853-5.rs
@@ -1,4 +1,4 @@
-trait Deserializer<'a> { }
+trait Deserializer<'a> {}
 
 trait Deserializable {
     fn deserialize_token<'a, D: Deserializer<'a>>(_: D, _: &'a str) -> Self;
@@ -8,6 +8,7 @@ impl<'a, T: Deserializable> Deserializable for &'a str {
     //~^ ERROR type parameter `T` is not constrained
     fn deserialize_token<D: Deserializer<'a>>(_x: D, _y: &'a str) -> &'a str {
         //~^ ERROR mismatched types
+        //~| ERROR do not match the trait declaration
     }
 }
 
diff --git a/tests/ui/typeck/issue-13853-5.stderr b/tests/ui/typeck/issue-13853-5.stderr
index 4e483a0a58e..bb967b07b81 100644
--- a/tests/ui/typeck/issue-13853-5.stderr
+++ b/tests/ui/typeck/issue-13853-5.stderr
@@ -1,3 +1,12 @@
+error[E0195]: lifetime parameters or bounds on associated function `deserialize_token` do not match the trait declaration
+  --> $DIR/issue-13853-5.rs:9:25
+   |
+LL |     fn deserialize_token<'a, D: Deserializer<'a>>(_: D, _: &'a str) -> Self;
+   |                         ------------------------- lifetimes in impl do not match this associated function in trait
+...
+LL |     fn deserialize_token<D: Deserializer<'a>>(_x: D, _y: &'a str) -> &'a str {
+   |                         ^^^^^^^^^^^^^^^^^^^^^ lifetimes do not match associated function in trait
+
 error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
   --> $DIR/issue-13853-5.rs:7:10
    |
@@ -19,7 +28,7 @@ LL ~         _y
 LL ~
    |
 
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
 
-Some errors have detailed explanations: E0207, E0308.
-For more information about an error, try `rustc --explain E0207`.
+Some errors have detailed explanations: E0195, E0207, E0308.
+For more information about an error, try `rustc --explain E0195`.
diff --git a/tests/ui/union/issue-81199.stderr b/tests/ui/union/issue-81199.stderr
index 8b78ddcf4a5..7deba88fc80 100644
--- a/tests/ui/union/issue-81199.stderr
+++ b/tests/ui/union/issue-81199.stderr
@@ -1,3 +1,15 @@
+error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
+  --> $DIR/issue-81199.rs:5:5
+   |
+LL |     components: PtrComponents<T>,
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
+help: wrap the field type in `ManuallyDrop<...>`
+   |
+LL |     components: std::mem::ManuallyDrop<PtrComponents<T>>,
+   |                 +++++++++++++++++++++++                +
+
 error[E0277]: the trait bound `T: Pointee` is not satisfied
   --> $DIR/issue-81199.rs:5:17
    |
@@ -14,18 +26,6 @@ help: consider further restricting type parameter `T` with trait `Pointee`
 LL | union PtrRepr<T: ?Sized + Pointee> {
    |                         +++++++++
 
-error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
-  --> $DIR/issue-81199.rs:5:5
-   |
-LL |     components: PtrComponents<T>,
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
-help: wrap the field type in `ManuallyDrop<...>`
-   |
-LL |     components: std::mem::ManuallyDrop<PtrComponents<T>>,
-   |                 +++++++++++++++++++++++                +
-
 error: aborting due to 2 previous errors
 
 Some errors have detailed explanations: E0277, E0740.
diff --git a/tests/ui/union/union-unsized.stderr b/tests/ui/union/union-unsized.stderr
index 851ad8939d4..89ab716071a 100644
--- a/tests/ui/union/union-unsized.stderr
+++ b/tests/ui/union/union-unsized.stderr
@@ -1,3 +1,15 @@
+error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
+  --> $DIR/union-unsized.rs:2:5
+   |
+LL |     a: str,
+   |     ^^^^^^
+   |
+   = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
+help: wrap the field type in `ManuallyDrop<...>`
+   |
+LL |     a: std::mem::ManuallyDrop<str>,
+   |        +++++++++++++++++++++++   +
+
 error[E0277]: the size for values of type `str` cannot be known at compilation time
   --> $DIR/union-unsized.rs:2:8
    |
@@ -17,15 +29,15 @@ LL |     a: Box<str>,
    |        ++++   +
 
 error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
-  --> $DIR/union-unsized.rs:2:5
+  --> $DIR/union-unsized.rs:11:5
    |
-LL |     a: str,
+LL |     b: str,
    |     ^^^^^^
    |
    = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
 help: wrap the field type in `ManuallyDrop<...>`
    |
-LL |     a: std::mem::ManuallyDrop<str>,
+LL |     b: std::mem::ManuallyDrop<str>,
    |        +++++++++++++++++++++++   +
 
 error[E0277]: the size for values of type `str` cannot be known at compilation time
@@ -46,18 +58,6 @@ help: the `Box` type always has a statically known size and allocates its conten
 LL |     b: Box<str>,
    |        ++++   +
 
-error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
-  --> $DIR/union-unsized.rs:11:5
-   |
-LL |     b: str,
-   |     ^^^^^^
-   |
-   = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
-help: wrap the field type in `ManuallyDrop<...>`
-   |
-LL |     b: std::mem::ManuallyDrop<str>,
-   |        +++++++++++++++++++++++   +
-
 error: aborting due to 4 previous errors
 
 Some errors have detailed explanations: E0277, E0740.
diff --git a/tests/ui/unsized/unsized-trait-impl-self-type.stderr b/tests/ui/unsized/unsized-trait-impl-self-type.stderr
index 3b684193b4a..61165d49b2d 100644
--- a/tests/ui/unsized/unsized-trait-impl-self-type.stderr
+++ b/tests/ui/unsized/unsized-trait-impl-self-type.stderr
@@ -1,3 +1,12 @@
+error[E0046]: not all trait items implemented, missing: `foo`
+  --> $DIR/unsized-trait-impl-self-type.rs:10:1
+   |
+LL |     fn foo(&self, z: &Z);
+   |     --------------------- `foo` from trait
+...
+LL | impl<X: ?Sized> T3<X> for S5<X> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
+
 error[E0277]: the size for values of type `X` cannot be known at compilation time
   --> $DIR/unsized-trait-impl-self-type.rs:10:27
    |
@@ -24,15 +33,6 @@ LL - impl<X: ?Sized> T3<X> for S5<X> {
 LL + impl<X> T3<X> for S5<X> {
    |
 
-error[E0046]: not all trait items implemented, missing: `foo`
-  --> $DIR/unsized-trait-impl-self-type.rs:10:1
-   |
-LL |     fn foo(&self, z: &Z);
-   |     --------------------- `foo` from trait
-...
-LL | impl<X: ?Sized> T3<X> for S5<X> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
-
 error: aborting due to 2 previous errors
 
 Some errors have detailed explanations: E0046, E0277.
diff --git a/tests/ui/unsized/unsized-trait-impl-trait-arg.stderr b/tests/ui/unsized/unsized-trait-impl-trait-arg.stderr
index 79fc9567dae..f46a6f678a9 100644
--- a/tests/ui/unsized/unsized-trait-impl-trait-arg.stderr
+++ b/tests/ui/unsized/unsized-trait-impl-trait-arg.stderr
@@ -1,3 +1,12 @@
+error[E0046]: not all trait items implemented, missing: `foo`
+  --> $DIR/unsized-trait-impl-trait-arg.rs:8:1
+   |
+LL |     fn foo(&self, z: Z);
+   |     -------------------- `foo` from trait
+...
+LL | impl<X: ?Sized> T2<X> for S4<X> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
+
 error[E0277]: the size for values of type `X` cannot be known at compilation time
   --> $DIR/unsized-trait-impl-trait-arg.rs:8:17
    |
@@ -21,15 +30,6 @@ help: consider relaxing the implicit `Sized` restriction
 LL | trait T2<Z: ?Sized> {
    |           ++++++++
 
-error[E0046]: not all trait items implemented, missing: `foo`
-  --> $DIR/unsized-trait-impl-trait-arg.rs:8:1
-   |
-LL |     fn foo(&self, z: Z);
-   |     -------------------- `foo` from trait
-...
-LL | impl<X: ?Sized> T2<X> for S4<X> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
-
 error: aborting due to 2 previous errors
 
 Some errors have detailed explanations: E0046, E0277.
diff --git a/tests/ui/unsized/unsized7.stderr b/tests/ui/unsized/unsized7.stderr
index 6e9c052a070..2e65c8c3357 100644
--- a/tests/ui/unsized/unsized7.stderr
+++ b/tests/ui/unsized/unsized7.stderr
@@ -1,3 +1,12 @@
+error[E0046]: not all trait items implemented, missing: `dummy`
+  --> $DIR/unsized7.rs:12:1
+   |
+LL |     fn dummy(&self) -> Z;
+   |     --------------------- `dummy` from trait
+...
+LL | impl<X: ?Sized + T> T1<X> for S3<X> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `dummy` in implementation
+
 error[E0277]: the size for values of type `X` cannot be known at compilation time
   --> $DIR/unsized7.rs:12:21
    |
@@ -21,15 +30,6 @@ help: consider relaxing the implicit `Sized` restriction
 LL | trait T1<Z: T + ?Sized> {
    |               ++++++++
 
-error[E0046]: not all trait items implemented, missing: `dummy`
-  --> $DIR/unsized7.rs:12:1
-   |
-LL |     fn dummy(&self) -> Z;
-   |     --------------------- `dummy` from trait
-...
-LL | impl<X: ?Sized + T> T1<X> for S3<X> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `dummy` in implementation
-
 error: aborting due to 2 previous errors
 
 Some errors have detailed explanations: E0046, E0277.
diff --git a/tests/ui/variance/variance-regions-unused-indirect.stderr b/tests/ui/variance/variance-regions-unused-indirect.stderr
index 8cdbb3c0f5e..f942c51b05b 100644
--- a/tests/ui/variance/variance-regions-unused-indirect.stderr
+++ b/tests/ui/variance/variance-regions-unused-indirect.stderr
@@ -1,3 +1,11 @@
+error[E0392]: lifetime parameter `'a` is never used
+  --> $DIR/variance-regions-unused-indirect.rs:3:10
+   |
+LL | enum Foo<'a> {
+   |          ^^ unused lifetime parameter
+   |
+   = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`
+
 error[E0072]: recursive types `Foo` and `Bar` have infinite size
   --> $DIR/variance-regions-unused-indirect.rs:3:1
    |
@@ -22,14 +30,6 @@ LL ~     Bar1(Box<Foo<'a>>)
    |
 
 error[E0392]: lifetime parameter `'a` is never used
-  --> $DIR/variance-regions-unused-indirect.rs:3:10
-   |
-LL | enum Foo<'a> {
-   |          ^^ unused lifetime parameter
-   |
-   = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`
-
-error[E0392]: lifetime parameter `'a` is never used
   --> $DIR/variance-regions-unused-indirect.rs:8:10
    |
 LL | enum Bar<'a> {
diff --git a/tests/ui/wf/hir-wf-check-erase-regions.stderr b/tests/ui/wf/hir-wf-check-erase-regions.stderr
index e4d48bf82c0..07304cd448e 100644
--- a/tests/ui/wf/hir-wf-check-erase-regions.stderr
+++ b/tests/ui/wf/hir-wf-check-erase-regions.stderr
@@ -11,10 +11,10 @@ note: required by a bound in `std::iter::IntoIterator::IntoIter`
   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
 
 error[E0277]: `&'a T` is not an iterator
-  --> $DIR/hir-wf-check-erase-regions.rs:7:21
+  --> $DIR/hir-wf-check-erase-regions.rs:7:5
    |
 LL |     type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>;
-   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'a T` is not an iterator
+   |     ^^^^^^^^^^^^^ `&'a T` is not an iterator
    |
    = help: the trait `Iterator` is not implemented for `&'a T`
    = help: the trait `Iterator` is implemented for `&mut I`
diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr
index e10bb98c134..dc5a1cf3485 100644
--- a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr
+++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr
@@ -32,7 +32,7 @@ LL | trait Trait<const N: dyn Trait = bar> {
    |                          ^^^^^
    |
    = note: ...which immediately requires computing type of `Trait::N` again
-note: cycle used when computing explicit predicates of trait `Trait`
+note: cycle used when checking that `Trait` is well-formed
   --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:1
    |
 LL | trait Trait<const N: dyn Trait = bar> {
diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr
index a381f2acdce..a99728f4b66 100644
--- a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr
+++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr
@@ -37,7 +37,7 @@ note: ...which requires computing type of `Bar::M`...
 LL | trait Bar<const M: Foo<2>> {}
    |           ^^^^^^^^^^^^^^^
    = note: ...which again requires computing type of `Foo::N`, completing the cycle
-note: cycle used when computing explicit predicates of trait `Foo`
+note: cycle used when checking that `Foo` is well-formed
   --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:1
    |
 LL | trait Foo<const N: Bar<2>> {
@@ -56,7 +56,7 @@ note: ...which requires computing type of `Bar::M`...
 LL | trait Bar<const M: Foo<2>> {}
    |           ^^^^^^^^^^^^^^^
    = note: ...which again requires computing type of `Foo::N`, completing the cycle
-note: cycle used when computing explicit predicates of trait `Foo`
+note: cycle used when checking that `Foo` is well-formed
   --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:1
    |
 LL | trait Foo<const N: Bar<2>> {
diff --git a/tests/ui/wf/wf-impl-associated-type-region.stderr b/tests/ui/wf/wf-impl-associated-type-region.stderr
index f17d33474f4..86e35b86fb1 100644
--- a/tests/ui/wf/wf-impl-associated-type-region.stderr
+++ b/tests/ui/wf/wf-impl-associated-type-region.stderr
@@ -1,10 +1,10 @@
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/wf-impl-associated-type-region.rs:10:16
+  --> $DIR/wf-impl-associated-type-region.rs:10:5
    |
 LL | impl<'a, T> Foo<'a> for T {
    |      -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
 LL |     type Bar = &'a T;
-   |                ^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at
+   |     ^^^^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at
    |
 help: consider adding an explicit lifetime bound
    |
diff --git a/tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr b/tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr
index e0cf42fd10c..f2989ae97b5 100644
--- a/tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr
+++ b/tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr
@@ -1,10 +1,10 @@
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:9:16
+  --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:9:5
    |
 LL | impl<'a, T> Trait<'a, T> for usize {
    |      -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
 LL |     type Out = &'a fn(T);
-   |                ^^^^^^^^^ ...so that the reference type `&'a fn(T)` does not outlive the data it points at
+   |     ^^^^^^^^ ...so that the reference type `&'a fn(T)` does not outlive the data it points at
    |
 help: consider adding an explicit lifetime bound
    |
@@ -12,12 +12,12 @@ LL | impl<'a, T: 'a> Trait<'a, T> for usize {
    |           ++++
 
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:19:16
+  --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:19:5
    |
 LL | impl<'a, T> Trait<'a, T> for u32 {
    |      -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
 LL |     type Out = &'a dyn Baz<T>;
-   |                ^^^^^^^^^^^^^^ ...so that the reference type `&'a (dyn Baz<T> + 'a)` does not outlive the data it points at
+   |     ^^^^^^^^ ...so that the reference type `&'a (dyn Baz<T> + 'a)` does not outlive the data it points at
    |
 help: consider adding an explicit lifetime bound
    |
diff --git a/tests/ui/wf/wf-trait-associated-type-region.stderr b/tests/ui/wf/wf-trait-associated-type-region.stderr
index d6647b2cb96..9589e1d7853 100644
--- a/tests/ui/wf/wf-trait-associated-type-region.stderr
+++ b/tests/ui/wf/wf-trait-associated-type-region.stderr
@@ -1,11 +1,11 @@
 error[E0309]: the associated type `<Self as SomeTrait<'a>>::Type1` may not live long enough
-  --> $DIR/wf-trait-associated-type-region.rs:9:18
+  --> $DIR/wf-trait-associated-type-region.rs:9:5
    |
 LL | trait SomeTrait<'a> {
    |                 -- the associated type `<Self as SomeTrait<'a>>::Type1` must be valid for the lifetime `'a` as defined here...
 LL |     type Type1;
 LL |     type Type2 = &'a Self::Type1;
-   |                  ^^^^^^^^^^^^^^^ ...so that the reference type `&'a <Self as SomeTrait<'a>>::Type1` does not outlive the data it points at
+   |     ^^^^^^^^^^ ...so that the reference type `&'a <Self as SomeTrait<'a>>::Type1` does not outlive the data it points at
    |
 help: consider adding an explicit lifetime bound
    |