about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2023-08-14 13:09:53 +0000
committerEsteban Küber <esteban@kuber.com.ar>2023-10-04 02:04:14 +0000
commit91b9ffeab0f8c491c81cd976c0d23d947cd6d12f (patch)
tree6b205f2c64d77221af8600edb9343968e05a49a4
parent2817ece19c67a182c0b0aae402c0e57c8ed22dab (diff)
downloadrust-91b9ffeab0f8c491c81cd976c0d23d947cd6d12f.tar.gz
rust-91b9ffeab0f8c491c81cd976c0d23d947cd6d12f.zip
Reorder fullfillment errors to keep more interesting ones first
In `report_fullfillment_errors` push back `T: Sized`, `T: WellFormed`
and coercion errors to the end of the list. The pre-existing
deduplication logic eliminates redundant errors better that way, keeping
the resulting output with fewer errors than before, while also having
more detail.
-rw-r--r--compiler/rustc_borrowck/src/region_infer/opaque_types.rs2
-rw-r--r--compiler/rustc_const_eval/src/transform/check_consts/check.rs2
-rw-r--r--compiler/rustc_hir_analysis/src/check/check.rs4
-rw-r--r--compiler/rustc_hir_analysis/src/check/compare_impl_item.rs12
-rw-r--r--compiler/rustc_hir_analysis/src/check/entry.rs2
-rw-r--r--compiler/rustc_hir_analysis/src/check/mod.rs2
-rw-r--r--compiler/rustc_hir_analysis/src/check/wfcheck.rs2
-rw-r--r--compiler/rustc_hir_analysis/src/coherence/builtin.rs4
-rw-r--r--compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs2
-rw-r--r--compiler/rustc_hir_typeck/src/expr.rs2
-rw-r--r--compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs6
-rw-r--r--compiler/rustc_passes/src/check_attr.rs2
-rw-r--r--compiler/rustc_passes/src/layout_test.rs2
-rw-r--r--compiler/rustc_trait_selection/src/traits/engine.rs2
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs22
-rw-r--r--compiler/rustc_trait_selection/src/traits/mod.rs2
-rw-r--r--tests/ui/array-slice-vec/vector-no-ann.stderr2
-rw-r--r--tests/ui/const-generics/const-argument-if-length.full.stderr16
-rw-r--r--tests/ui/const-generics/issues/issue-83249.stderr15
-rw-r--r--tests/ui/error-codes/E0282.rs3
-rw-r--r--tests/ui/error-codes/E0282.stderr43
-rw-r--r--tests/ui/error-codes/E0401.stderr14
-rw-r--r--tests/ui/for/issue-20605.next.stderr12
-rw-r--r--tests/ui/generic-associated-types/bugs/issue-91762.stderr5
-rw-r--r--tests/ui/generic-const-items/inference-failure.stderr2
-rw-r--r--tests/ui/impl-trait/cross-return-site-inference.rs4
-rw-r--r--tests/ui/impl-trait/cross-return-site-inference.stderr25
-rw-r--r--tests/ui/impl-trait/issues/issue-84073.stderr2
-rw-r--r--tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr6
-rw-r--r--tests/ui/impl-trait/where-allowed-2.stderr6
-rw-r--r--tests/ui/inference/cannot-infer-closure-circular.stderr3
-rw-r--r--tests/ui/inference/issue-104649.stderr2
-rw-r--r--tests/ui/inference/issue-72690.stderr16
-rw-r--r--tests/ui/inference/multiple-impl-apply.rs4
-rw-r--r--tests/ui/inference/multiple-impl-apply.stderr16
-rw-r--r--tests/ui/inference/need_type_info/concrete-impl.rs2
-rw-r--r--tests/ui/inference/need_type_info/concrete-impl.stderr11
-rw-r--r--tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.stderr14
-rw-r--r--tests/ui/inference/question-mark-type-infer.rs1
-rw-r--r--tests/ui/inference/question-mark-type-infer.stderr16
-rw-r--r--tests/ui/issues/issue-12187-1.stderr4
-rw-r--r--tests/ui/issues/issue-12187-2.stderr4
-rw-r--r--tests/ui/issues/issue-16966.stderr13
-rw-r--r--tests/ui/issues/issue-17551.stderr2
-rw-r--r--tests/ui/issues/issue-24036.stderr9
-rw-r--r--tests/ui/issues/issue-24446.stderr14
-rw-r--r--tests/ui/iterators/collect-into-slice.stderr20
-rw-r--r--tests/ui/methods/method-ambig-one-trait-unknown-int-type.stderr2
-rw-r--r--tests/ui/pattern/slice-patterns-irrefutable.stderr3
-rw-r--r--tests/ui/suggestions/slice-issue-87994.stderr8
-rw-r--r--tests/ui/traits/copy-guessing.stderr2
-rw-r--r--tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs4
-rw-r--r--tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr16
-rw-r--r--tests/ui/traits/issue-77982.stderr20
-rw-r--r--tests/ui/traits/multidispatch-convert-ambig-dest.rs1
-rw-r--r--tests/ui/traits/multidispatch-convert-ambig-dest.stderr16
-rw-r--r--tests/ui/traits/new-solver/alias-bound-unsound.rs1
-rw-r--r--tests/ui/traits/new-solver/alias-bound-unsound.stderr40
-rw-r--r--tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr11
-rw-r--r--tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs3
-rw-r--r--tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr11
-rw-r--r--tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr15
-rw-r--r--tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr14
-rw-r--r--tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs3
-rw-r--r--tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr11
-rw-r--r--tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr12
-rw-r--r--tests/ui/traits/not-suggest-non-existing-fully-qualified-path.rs4
-rw-r--r--tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr16
-rw-r--r--tests/ui/traits/suggest-fully-qualified-closure.stderr16
-rw-r--r--tests/ui/traits/suggest-fully-qualified-path-with-adjustment.rs4
-rw-r--r--tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr32
-rw-r--r--tests/ui/traits/suggest-fully-qualified-path-without-adjustment.rs4
-rw-r--r--tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr36
-rw-r--r--tests/ui/type-inference/sort_by_key.stderr11
-rw-r--r--tests/ui/type/type-check/cannot_infer_local_or_vec.stderr2
-rw-r--r--tests/ui/wf/wf-fn-where-clause.stderr18
76 files changed, 309 insertions, 403 deletions
diff --git a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs
index b7da15af6dc..ff04b0237c2 100644
--- a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs
+++ b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs
@@ -368,7 +368,7 @@ fn check_opaque_type_well_formed<'tcx>(
     if errors.is_empty() {
         Ok(definition_ty)
     } else {
-        Err(infcx.err_ctxt().report_fulfillment_errors(&errors))
+        Err(infcx.err_ctxt().report_fulfillment_errors(errors))
     }
 }
 
diff --git a/compiler/rustc_const_eval/src/transform/check_consts/check.rs b/compiler/rustc_const_eval/src/transform/check_consts/check.rs
index d380849fefe..2215cc9ad68 100644
--- a/compiler/rustc_const_eval/src/transform/check_consts/check.rs
+++ b/compiler/rustc_const_eval/src/transform/check_consts/check.rs
@@ -743,7 +743,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
 
                 let errors = ocx.select_all_or_error();
                 if !errors.is_empty() {
-                    infcx.err_ctxt().report_fulfillment_errors(&errors);
+                    infcx.err_ctxt().report_fulfillment_errors(errors);
                 }
 
                 // Attempting to call a trait method?
diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs
index 44e1bdb8370..486aac21972 100644
--- a/compiler/rustc_hir_analysis/src/check/check.rs
+++ b/compiler/rustc_hir_analysis/src/check/check.rs
@@ -327,7 +327,7 @@ fn check_opaque_meets_bounds<'tcx>(
     // version.
     let errors = ocx.select_all_or_error();
     if !errors.is_empty() {
-        let guar = infcx.err_ctxt().report_fulfillment_errors(&errors);
+        let guar = infcx.err_ctxt().report_fulfillment_errors(errors);
         return Err(guar);
     }
     match origin {
@@ -1512,6 +1512,6 @@ pub(super) fn check_generator_obligations(tcx: TyCtxt<'_>, def_id: LocalDefId) {
     let errors = fulfillment_cx.select_all_or_error(&infcx);
     debug!(?errors);
     if !errors.is_empty() {
-        infcx.err_ctxt().report_fulfillment_errors(&errors);
+        infcx.err_ctxt().report_fulfillment_errors(errors);
     }
 }
diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
index b5a3437c992..5f50eb7dfd2 100644
--- a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
+++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
@@ -323,7 +323,7 @@ fn compare_method_predicate_entailment<'tcx>(
         // FIXME(-Ztrait-solver=next): Not needed when the hack below is removed.
         let errors = ocx.select_where_possible();
         if !errors.is_empty() {
-            let reported = infcx.err_ctxt().report_fulfillment_errors(&errors);
+            let reported = infcx.err_ctxt().report_fulfillment_errors(errors);
             return Err(reported);
         }
 
@@ -394,7 +394,7 @@ fn compare_method_predicate_entailment<'tcx>(
                 });
             }
             CheckImpliedWfMode::Skip => {
-                let reported = infcx.err_ctxt().report_fulfillment_errors(&errors);
+                let reported = infcx.err_ctxt().report_fulfillment_errors(errors);
                 return Err(reported);
             }
         }
@@ -874,7 +874,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
     // RPITs.
     let errors = ocx.select_all_or_error();
     if !errors.is_empty() {
-        let reported = infcx.err_ctxt().report_fulfillment_errors(&errors);
+        let reported = infcx.err_ctxt().report_fulfillment_errors(errors);
         return Err(reported);
     }
 
@@ -2050,7 +2050,7 @@ fn compare_const_predicate_entailment<'tcx>(
     // version.
     let errors = ocx.select_all_or_error();
     if !errors.is_empty() {
-        return Err(infcx.err_ctxt().report_fulfillment_errors(&errors));
+        return Err(infcx.err_ctxt().report_fulfillment_errors(errors));
     }
 
     let outlives_env = OutlivesEnvironment::new(param_env);
@@ -2143,7 +2143,7 @@ fn compare_type_predicate_entailment<'tcx>(
     // version.
     let errors = ocx.select_all_or_error();
     if !errors.is_empty() {
-        let reported = infcx.err_ctxt().report_fulfillment_errors(&errors);
+        let reported = infcx.err_ctxt().report_fulfillment_errors(errors);
         return Err(reported);
     }
 
@@ -2358,7 +2358,7 @@ pub(super) fn check_type_bounds<'tcx>(
     // version.
     let errors = ocx.select_all_or_error();
     if !errors.is_empty() {
-        let reported = infcx.err_ctxt().report_fulfillment_errors(&errors);
+        let reported = infcx.err_ctxt().report_fulfillment_errors(errors);
         return Err(reported);
     }
 
diff --git a/compiler/rustc_hir_analysis/src/check/entry.rs b/compiler/rustc_hir_analysis/src/check/entry.rs
index 3cd3f5bcfdd..6681292c93d 100644
--- a/compiler/rustc_hir_analysis/src/check/entry.rs
+++ b/compiler/rustc_hir_analysis/src/check/entry.rs
@@ -158,7 +158,7 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) {
         ocx.register_bound(cause, param_env, norm_return_ty, term_did);
         let errors = ocx.select_all_or_error();
         if !errors.is_empty() {
-            infcx.err_ctxt().report_fulfillment_errors(&errors);
+            infcx.err_ctxt().report_fulfillment_errors(errors);
             error = true;
         }
         // now we can take the return type of the given main function
diff --git a/compiler/rustc_hir_analysis/src/check/mod.rs b/compiler/rustc_hir_analysis/src/check/mod.rs
index 5fa65f33c76..5d67a36288c 100644
--- a/compiler/rustc_hir_analysis/src/check/mod.rs
+++ b/compiler/rustc_hir_analysis/src/check/mod.rs
@@ -588,7 +588,7 @@ pub fn check_function_signature<'tcx>(
         Ok(()) => {
             let errors = ocx.select_all_or_error();
             if !errors.is_empty() {
-                infcx.err_ctxt().report_fulfillment_errors(&errors);
+                infcx.err_ctxt().report_fulfillment_errors(errors);
                 return;
             }
         }
diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs
index de6ca0d61dc..97ebd42d077 100644
--- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs
+++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs
@@ -116,7 +116,7 @@ pub(super) fn enter_wf_checking_ctxt<'tcx, F>(
 
     let errors = wfcx.select_all_or_error();
     if !errors.is_empty() {
-        infcx.err_ctxt().report_fulfillment_errors(&errors);
+        infcx.err_ctxt().report_fulfillment_errors(errors);
         return;
     }
 
diff --git a/compiler/rustc_hir_analysis/src/coherence/builtin.rs b/compiler/rustc_hir_analysis/src/coherence/builtin.rs
index be70acfc35d..e3e724df272 100644
--- a/compiler/rustc_hir_analysis/src/coherence/builtin.rs
+++ b/compiler/rustc_hir_analysis/src/coherence/builtin.rs
@@ -261,7 +261,7 @@ fn visit_implementation_of_dispatch_from_dyn(tcx: TyCtxt<'_>, impl_did: LocalDef
                 }
                 let errors = ocx.select_all_or_error();
                 if !errors.is_empty() {
-                    infcx.err_ctxt().report_fulfillment_errors(&errors);
+                    infcx.err_ctxt().report_fulfillment_errors(errors);
                 }
 
                 // Finally, resolve all regions.
@@ -470,7 +470,7 @@ pub fn coerce_unsized_info<'tcx>(tcx: TyCtxt<'tcx>, impl_did: LocalDefId) -> Coe
     ocx.register_obligation(obligation);
     let errors = ocx.select_all_or_error();
     if !errors.is_empty() {
-        infcx.err_ctxt().report_fulfillment_errors(&errors);
+        infcx.err_ctxt().report_fulfillment_errors(errors);
     }
 
     // Finally, resolve all regions.
diff --git a/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs b/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs
index dbd38e1b1fe..b4af321fcc9 100644
--- a/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs
+++ b/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs
@@ -196,7 +196,7 @@ fn get_impl_args(
 
     let errors = ocx.select_all_or_error();
     if !errors.is_empty() {
-        let guar = ocx.infcx.err_ctxt().report_fulfillment_errors(&errors);
+        let guar = ocx.infcx.err_ctxt().report_fulfillment_errors(errors);
         return Err(guar);
     }
 
diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs
index eead4da5e3e..cbfc98db2f0 100644
--- a/compiler/rustc_hir_typeck/src/expr.rs
+++ b/compiler/rustc_hir_typeck/src/expr.rs
@@ -3010,7 +3010,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             // There should be at least one error reported. If not, we
             // will still delay a span bug in `report_fulfillment_errors`.
             Ok::<_, NoSolution>((
-                self.err_ctxt().report_fulfillment_errors(&errors),
+                self.err_ctxt().report_fulfillment_errors(errors),
                 impl_trait_ref.args.type_at(1),
                 element_ty,
             ))
diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
index 415920221f5..5dae74a1f9b 100644
--- a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
+++ b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
@@ -564,7 +564,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
         if !errors.is_empty() {
             self.adjust_fulfillment_errors_for_expr_obligation(&mut errors);
-            self.err_ctxt().report_fulfillment_errors(&errors);
+            self.err_ctxt().report_fulfillment_errors(errors);
         }
     }
 
@@ -577,7 +577,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         if !result.is_empty() {
             mutate_fulfillment_errors(&mut result);
             self.adjust_fulfillment_errors_for_expr_obligation(&mut result);
-            self.err_ctxt().report_fulfillment_errors(&result);
+            self.err_ctxt().report_fulfillment_errors(result);
         }
     }
 
@@ -1477,7 +1477,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             {
                 Ok(normalized_ty) => normalized_ty,
                 Err(errors) => {
-                    let guar = self.err_ctxt().report_fulfillment_errors(&errors);
+                    let guar = self.err_ctxt().report_fulfillment_errors(errors);
                     return Ty::new_error(self.tcx,guar);
                 }
             }
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index 9a7564cb213..52fb193f3da 100644
--- a/compiler/rustc_passes/src/check_attr.rs
+++ b/compiler/rustc_passes/src/check_attr.rs
@@ -2373,7 +2373,7 @@ impl CheckAttrVisitor<'_> {
 
         let errors = ocx.select_all_or_error();
         if !errors.is_empty() {
-            infcx.err_ctxt().report_fulfillment_errors(&errors);
+            infcx.err_ctxt().report_fulfillment_errors(errors);
             self.abort.set(true);
         }
     }
diff --git a/compiler/rustc_passes/src/layout_test.rs b/compiler/rustc_passes/src/layout_test.rs
index e195f9ab6da..2129a98cda3 100644
--- a/compiler/rustc_passes/src/layout_test.rs
+++ b/compiler/rustc_passes/src/layout_test.rs
@@ -57,7 +57,7 @@ pub fn ensure_wf<'tcx>(
     ocx.register_obligation(obligation);
     let errors = ocx.select_all_or_error();
     if !errors.is_empty() {
-        infcx.err_ctxt().report_fulfillment_errors(&errors);
+        infcx.err_ctxt().report_fulfillment_errors(errors);
         false
     } else {
         // looks WF!
diff --git a/compiler/rustc_trait_selection/src/traits/engine.rs b/compiler/rustc_trait_selection/src/traits/engine.rs
index 015e38b2ac0..88f47b03cc8 100644
--- a/compiler/rustc_trait_selection/src/traits/engine.rs
+++ b/compiler/rustc_trait_selection/src/traits/engine.rs
@@ -218,7 +218,7 @@ impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> {
         def_id: LocalDefId,
     ) -> Result<FxIndexSet<Ty<'tcx>>, ErrorGuaranteed> {
         self.assumed_wf_types(param_env, def_id)
-            .map_err(|errors| self.infcx.err_ctxt().report_fulfillment_errors(&errors))
+            .map_err(|errors| self.infcx.err_ctxt().report_fulfillment_errors(errors))
     }
 
     pub fn assumed_wf_types(
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
index ae56e3d3d4f..5e77b5904f6 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
@@ -137,7 +137,7 @@ pub trait TypeErrCtxtExt<'tcx> {
 
     fn report_overflow_no_abort(&self, obligation: PredicateObligation<'tcx>) -> ErrorGuaranteed;
 
-    fn report_fulfillment_errors(&self, errors: &[FulfillmentError<'tcx>]) -> ErrorGuaranteed;
+    fn report_fulfillment_errors(&self, errors: Vec<FulfillmentError<'tcx>>) -> ErrorGuaranteed;
 
     fn report_overflow_obligation<T>(
         &self,
@@ -401,7 +401,10 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
 }
 
 impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
-    fn report_fulfillment_errors(&self, errors: &[FulfillmentError<'tcx>]) -> ErrorGuaranteed {
+    fn report_fulfillment_errors(
+        &self,
+        mut errors: Vec<FulfillmentError<'tcx>>,
+    ) -> ErrorGuaranteed {
         #[derive(Debug)]
         struct ErrorDescriptor<'tcx> {
             predicate: ty::Predicate<'tcx>,
@@ -423,6 +426,19 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
             })
             .collect();
 
+        // Ensure `T: Sized` and `T: WF` obligations come last. This lets us display diagnostics
+        // with more relevant type information and hide redundant E0282 errors.
+        errors.sort_by_key(|e| match e.obligation.predicate.kind().skip_binder() {
+            ty::PredicateKind::Clause(ty::ClauseKind::Trait(pred))
+                if Some(pred.def_id()) == self.tcx.lang_items().sized_trait() =>
+            {
+                1
+            }
+            ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(_)) => 3,
+            ty::PredicateKind::Coerce(_) => 2,
+            _ => 0,
+        });
+
         for (index, error) in errors.iter().enumerate() {
             // We want to ignore desugarings here: spans are equivalent even
             // if one is the result of a desugaring and the other is not.
@@ -476,7 +492,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
         }
 
         for from_expansion in [false, true] {
-            for (error, suppressed) in iter::zip(errors, &is_suppressed) {
+            for (error, suppressed) in iter::zip(&errors, &is_suppressed) {
                 if !suppressed && error.obligation.cause.span.from_expansion() == from_expansion {
                     self.report_fulfillment_error(error);
                 }
diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs
index 956f8e047d7..ab81d77a268 100644
--- a/compiler/rustc_trait_selection/src/traits/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/mod.rs
@@ -204,7 +204,7 @@ fn do_normalize_predicates<'tcx>(
     let predicates = match fully_normalize(&infcx, cause, elaborated_env, predicates) {
         Ok(predicates) => predicates,
         Err(errors) => {
-            let reported = infcx.err_ctxt().report_fulfillment_errors(&errors);
+            let reported = infcx.err_ctxt().report_fulfillment_errors(errors);
             return Err(reported);
         }
     };
diff --git a/tests/ui/array-slice-vec/vector-no-ann.stderr b/tests/ui/array-slice-vec/vector-no-ann.stderr
index d2ea08aa474..619417a73c9 100644
--- a/tests/ui/array-slice-vec/vector-no-ann.stderr
+++ b/tests/ui/array-slice-vec/vector-no-ann.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `Vec<T>`
   --> $DIR/vector-no-ann.rs:2:9
    |
 LL |     let _foo = Vec::new();
-   |         ^^^^
+   |         ^^^^   ---------- type must be known at this point
    |
 help: consider giving `_foo` an explicit type, where the type for type parameter `T` is specified
    |
diff --git a/tests/ui/const-generics/const-argument-if-length.full.stderr b/tests/ui/const-generics/const-argument-if-length.full.stderr
index 7997026dfe4..315b0f0a064 100644
--- a/tests/ui/const-generics/const-argument-if-length.full.stderr
+++ b/tests/ui/const-generics/const-argument-if-length.full.stderr
@@ -1,3 +1,11 @@
+error: unconstrained generic constant
+  --> $DIR/const-argument-if-length.rs:17:10
+   |
+LL |     pad: [u8; is_zst::<T>()],
+   |          ^^^^^^^^^^^^^^^^^^^
+   |
+   = help: try adding a `where` bound using this expression: `where [(); is_zst::<T>()]:`
+
 error[E0277]: the size for values of type `T` cannot be known at compilation time
   --> $DIR/const-argument-if-length.rs:15:12
    |
@@ -22,14 +30,6 @@ help: the `Box` type always has a statically known size and allocates its conten
 LL |     value: Box<T>,
    |            ++++ +
 
-error: unconstrained generic constant
-  --> $DIR/const-argument-if-length.rs:17:10
-   |
-LL |     pad: [u8; is_zst::<T>()],
-   |          ^^^^^^^^^^^^^^^^^^^
-   |
-   = help: try adding a `where` bound using this expression: `where [(); is_zst::<T>()]:`
-
 error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/const-generics/issues/issue-83249.stderr b/tests/ui/const-generics/issues/issue-83249.stderr
index 7491fdc8a69..5187434ff40 100644
--- a/tests/ui/const-generics/issues/issue-83249.stderr
+++ b/tests/ui/const-generics/issues/issue-83249.stderr
@@ -1,9 +1,18 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
   --> $DIR/issue-83249.rs:19:9
    |
 LL |     let _ = foo([0; 1]);
-   |         ^
+   |         ^   --- ------ type must be known at this point
+   |             |
+   |             required by a bound introduced by this call
    |
+   = note: cannot satisfy `_: Foo`
+   = help: the trait `Foo` is implemented for `u8`
+note: required by a bound in `foo`
+  --> $DIR/issue-83249.rs:12:11
+   |
+LL | fn foo<T: Foo>(_: [u8; T::N]) -> T {
+   |           ^^^ required by this bound in `foo`
 help: consider giving this pattern a type
    |
 LL |     let _: /* Type */ = foo([0; 1]);
@@ -11,4 +20,4 @@ LL |     let _: /* Type */ = foo([0; 1]);
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/error-codes/E0282.rs b/tests/ui/error-codes/E0282.rs
index a7d8ae2d7f5..5bc29cda9ea 100644
--- a/tests/ui/error-codes/E0282.rs
+++ b/tests/ui/error-codes/E0282.rs
@@ -1,5 +1,4 @@
 fn main() {
-    let x = "hello".chars().rev().collect();
+    let x;
     //~^ ERROR E0282
-    //~| ERROR E0283
 }
diff --git a/tests/ui/error-codes/E0282.stderr b/tests/ui/error-codes/E0282.stderr
index 20d115e1711..58332454a37 100644
--- a/tests/ui/error-codes/E0282.stderr
+++ b/tests/ui/error-codes/E0282.stderr
@@ -1,47 +1,14 @@
 error[E0282]: type annotations needed
   --> $DIR/E0282.rs:2:9
    |
-LL |     let x = "hello".chars().rev().collect();
+LL |     let x;
    |         ^
    |
 help: consider giving `x` an explicit type
    |
-LL |     let x: Vec<_> = "hello".chars().rev().collect();
-   |          ++++++++
+LL |     let x: /* Type */;
+   |          ++++++++++++
 
-error[E0283]: type annotations needed
-  --> $DIR/E0282.rs:2:9
-   |
-LL |     let x = "hello".chars().rev().collect();
-   |         ^                         ------- type must be known at this point
-   |
-   = note: multiple `impl`s satisfying `_: FromIterator<char>` found in the following crates: `alloc`, `hashbrown`, `std`:
-           - impl FromIterator<char> for String;
-           - impl<'a, T> FromIterator<T> for Cow<'a, [T]>
-             where T: Clone;
-           - impl<'a> FromIterator<char> for Cow<'a, str>;
-           - impl<I> FromIterator<I> for Box<[I]>;
-           - impl<T, S, A> FromIterator<T> for hashbrown::set::HashSet<T, S, A>
-             where T: Eq, T: Hash, S: BuildHasher, S: Default, A: Default, A: Allocator, A: Clone;
-           - impl<T, S> FromIterator<T> for HashSet<T, S>
-             where T: Eq, T: Hash, S: BuildHasher, S: Default;
-           - impl<T> FromIterator<T> for Arc<[T]>;
-           - impl<T> FromIterator<T> for BTreeSet<T>
-             where T: Ord;
-           - impl<T> FromIterator<T> for BinaryHeap<T>
-             where T: Ord;
-           - impl<T> FromIterator<T> for LinkedList<T>;
-           - impl<T> FromIterator<T> for Rc<[T]>;
-           - impl<T> FromIterator<T> for Vec<T>;
-           - impl<T> FromIterator<T> for VecDeque<T>;
-note: required by a bound in `collect`
-  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-help: consider giving `x` an explicit type
-   |
-LL |     let x: Vec<_> = "hello".chars().rev().collect();
-   |          ++++++++
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/error-codes/E0401.stderr b/tests/ui/error-codes/E0401.stderr
index 928c8d11d20..0a069e8d350 100644
--- a/tests/ui/error-codes/E0401.stderr
+++ b/tests/ui/error-codes/E0401.stderr
@@ -32,12 +32,18 @@ LL |         fn helper(sel: &Self) -> u8 {
    |                         use of generic parameter from outer item
    |                         refer to the type directly here instead
 
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
   --> $DIR/E0401.rs:11:5
    |
 LL |     bfnr(x);
-   |     ^^^^ cannot infer type of the type parameter `U` declared on the function `bfnr`
+   |     ^^^^ cannot infer type of the type parameter `V` declared on the function `bfnr`
+   |
+   = note: cannot satisfy `_: Baz<_>`
+note: required by a bound in `bfnr`
+  --> $DIR/E0401.rs:4:19
    |
+LL |     fn bfnr<U, V: Baz<U>, W: Fn()>(y: T) {
+   |                   ^^^^^^ required by this bound in `bfnr`
 help: consider specifying the generic arguments
    |
 LL |     bfnr::<U, V, W>(x);
@@ -66,5 +72,5 @@ LL |     bfnr::<U, V, W>(x);
 
 error: aborting due to 5 previous errors
 
-Some errors have detailed explanations: E0282, E0283, E0401.
-For more information about an error, try `rustc --explain E0282`.
+Some errors have detailed explanations: E0283, E0401.
+For more information about an error, try `rustc --explain E0283`.
diff --git a/tests/ui/for/issue-20605.next.stderr b/tests/ui/for/issue-20605.next.stderr
index 0955efdbb73..28dbdf4c374 100644
--- a/tests/ui/for/issue-20605.next.stderr
+++ b/tests/ui/for/issue-20605.next.stderr
@@ -44,12 +44,6 @@ LL |     for item in *things { *item = 0 }
    = note: all local variables must have a statically known size
    = help: unsized locals are gated as an unstable feature
 
-error: the type `Option<<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item>` is not well-formed
-  --> $DIR/issue-20605.rs:5:17
-   |
-LL |     for item in *things { *item = 0 }
-   |                 ^^^^^^^
-
 error[E0277]: the size for values of type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be known at compilation time
   --> $DIR/issue-20605.rs:5:5
    |
@@ -60,6 +54,12 @@ LL |     for item in *things { *item = 0 }
 note: required by a bound in `None`
   --> $SRC_DIR/core/src/option.rs:LL:COL
 
+error: the type `Option<<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item>` is not well-formed
+  --> $DIR/issue-20605.rs:5:17
+   |
+LL |     for item in *things { *item = 0 }
+   |                 ^^^^^^^
+
 error[E0614]: type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be dereferenced
   --> $DIR/issue-20605.rs:5:27
    |
diff --git a/tests/ui/generic-associated-types/bugs/issue-91762.stderr b/tests/ui/generic-associated-types/bugs/issue-91762.stderr
index 1272c8b8ae2..1045e80f046 100644
--- a/tests/ui/generic-associated-types/bugs/issue-91762.stderr
+++ b/tests/ui/generic-associated-types/bugs/issue-91762.stderr
@@ -1,9 +1,10 @@
-error[E0282]: type annotations needed
+error[E0284]: type annotations needed
   --> $DIR/issue-91762.rs:24:15
    |
 LL |         ret = <Self::Base as Functor>::fmap(arg);
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the associated function `fmap`
    |
+   = note: cannot satisfy `<<Self as FunctorExt<T>>::Base as Functor>::With<_> == Self`
 help: consider specifying the generic arguments
    |
 LL |         ret = <Self::Base as Functor>::fmap::<T, U>(arg);
@@ -11,4 +12,4 @@ LL |         ret = <Self::Base as Functor>::fmap::<T, U>(arg);
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0284`.
diff --git a/tests/ui/generic-const-items/inference-failure.stderr b/tests/ui/generic-const-items/inference-failure.stderr
index 22ff1b9ba7f..10ecd83ec53 100644
--- a/tests/ui/generic-const-items/inference-failure.stderr
+++ b/tests/ui/generic-const-items/inference-failure.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `Option<T>`
   --> $DIR/inference-failure.rs:8:9
    |
 LL |     let _ = NONE;
-   |         ^
+   |         ^   ---- type must be known at this point
    |
 help: consider giving this pattern a type, where the type for type parameter `T` is specified
    |
diff --git a/tests/ui/impl-trait/cross-return-site-inference.rs b/tests/ui/impl-trait/cross-return-site-inference.rs
index 00aed2ad95a..e1071b08c55 100644
--- a/tests/ui/impl-trait/cross-return-site-inference.rs
+++ b/tests/ui/impl-trait/cross-return-site-inference.rs
@@ -36,13 +36,13 @@ fn muh() -> Result<(), impl std::fmt::Debug> {
 
 fn muh2() -> Result<(), impl std::fmt::Debug> {
     return Err(From::from("foo"));
-    //~^ ERROR type annotations needed
+    //~^ ERROR cannot call associated function on trait
     Ok(())
 }
 
 fn muh3() -> Result<(), impl std::fmt::Debug> {
     Err(From::from("foo"))
-    //~^ ERROR type annotations needed
+    //~^ ERROR cannot call associated function on trait
 }
 
 fn main() {}
diff --git a/tests/ui/impl-trait/cross-return-site-inference.stderr b/tests/ui/impl-trait/cross-return-site-inference.stderr
index 766614e9e50..a86e00fa04a 100644
--- a/tests/ui/impl-trait/cross-return-site-inference.stderr
+++ b/tests/ui/impl-trait/cross-return-site-inference.stderr
@@ -9,28 +9,19 @@ help: consider specifying the generic arguments
 LL |     Ok::<(), E>(())
    |       +++++++++
 
-error[E0282]: type annotations needed
-  --> $DIR/cross-return-site-inference.rs:38:12
+error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
+  --> $DIR/cross-return-site-inference.rs:38:16
    |
 LL |     return Err(From::from("foo"));
-   |            ^^^ cannot infer type of the type parameter `E` declared on the enum `Result`
-   |
-help: consider specifying the generic arguments
-   |
-LL |     return Err::<(), E>(From::from("foo"));
-   |               +++++++++
+   |                ^^^^^^^^^^ cannot call associated function of trait
 
-error[E0282]: type annotations needed
-  --> $DIR/cross-return-site-inference.rs:44:5
+error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
+  --> $DIR/cross-return-site-inference.rs:44:9
    |
 LL |     Err(From::from("foo"))
-   |     ^^^ cannot infer type of the type parameter `E` declared on the enum `Result`
-   |
-help: consider specifying the generic arguments
-   |
-LL |     Err::<(), E>(From::from("foo"))
-   |        +++++++++
+   |         ^^^^^^^^^^ cannot call associated function of trait
 
 error: aborting due to 3 previous errors
 
-For more information about this error, try `rustc --explain E0282`.
+Some errors have detailed explanations: E0282, E0790.
+For more information about an error, try `rustc --explain E0282`.
diff --git a/tests/ui/impl-trait/issues/issue-84073.stderr b/tests/ui/impl-trait/issues/issue-84073.stderr
index 3c39aa6ce5b..b4be16ff042 100644
--- a/tests/ui/impl-trait/issues/issue-84073.stderr
+++ b/tests/ui/impl-trait/issues/issue-84073.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `RaceBuilder<T, Never<T>>`
   --> $DIR/issue-84073.rs:32:16
    |
 LL |     Race::new(|race| race.when());
-   |                ^^^^
+   |                ^^^^  ---- type must be known at this point
    |
 help: consider giving this closure parameter an explicit type, where the type for type parameter `T` is specified
    |
diff --git a/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr b/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr
index ee4343b110f..2347805343c 100644
--- a/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr
+++ b/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr
@@ -1,9 +1,11 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
   --> $DIR/opaque-cast-field-access-in-future.rs:22:17
    |
 LL | fn run() -> Foo<impl Future<Output = ()>> {
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
+   |
+   = note: cannot satisfy `_: Future`
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/impl-trait/where-allowed-2.stderr b/tests/ui/impl-trait/where-allowed-2.stderr
index 2b328c01c87..b3765ac1a54 100644
--- a/tests/ui/impl-trait/where-allowed-2.stderr
+++ b/tests/ui/impl-trait/where-allowed-2.stderr
@@ -1,9 +1,11 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
   --> $DIR/where-allowed-2.rs:3:30
    |
 LL | fn in_adt_in_return() -> Vec<impl Debug> { panic!() }
    |                              ^^^^^^^^^^ cannot infer type
+   |
+   = note: cannot satisfy `_: Debug`
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/inference/cannot-infer-closure-circular.stderr b/tests/ui/inference/cannot-infer-closure-circular.stderr
index b706cd2bc36..98639f307fb 100644
--- a/tests/ui/inference/cannot-infer-closure-circular.stderr
+++ b/tests/ui/inference/cannot-infer-closure-circular.stderr
@@ -3,6 +3,9 @@ error[E0282]: type annotations needed for `Result<(), E>`
    |
 LL |     let x = |r| {
    |              ^
+LL |         let v = r?;
+LL |         Ok(v)
+   |         ----- type must be known at this point
    |
 help: consider giving this closure parameter an explicit type, where the type for type parameter `E` is specified
    |
diff --git a/tests/ui/inference/issue-104649.stderr b/tests/ui/inference/issue-104649.stderr
index 4962b21f9fd..2819329275d 100644
--- a/tests/ui/inference/issue-104649.stderr
+++ b/tests/ui/inference/issue-104649.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `A<std::result::Result<std::result::Re
   --> $DIR/issue-104649.rs:24:9
    |
 LL |     let a = A(Result::Ok(Result::Ok(())));
-   |         ^
+   |         ^                -------------- type must be known at this point
    |
 help: consider giving `a` an explicit type, where the type for type parameter `E` is specified
    |
diff --git a/tests/ui/inference/issue-72690.stderr b/tests/ui/inference/issue-72690.stderr
index 225558805e0..6c93241ea07 100644
--- a/tests/ui/inference/issue-72690.stderr
+++ b/tests/ui/inference/issue-72690.stderr
@@ -24,16 +24,15 @@ help: try using a fully qualified path to specify the expected types
 LL |     String::from(<str as AsRef<T>>::as_ref("x"));
    |                  ++++++++++++++++++++++++++   ~
 
-error[E0282]: type annotations needed
-  --> $DIR/issue-72690.rs:12:6
+error[E0283]: type annotations needed
+  --> $DIR/issue-72690.rs:12:9
    |
 LL |     |x| String::from("x".as_ref());
-   |      ^
-   |
-help: consider giving this closure parameter an explicit type
+   |         ^^^^^^ cannot infer type for reference `&_`
    |
-LL |     |x: /* Type */| String::from("x".as_ref());
-   |       ++++++++++++
+   = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
+           - impl From<&String> for String;
+           - impl From<&str> for String;
 
 error[E0283]: type annotations needed
   --> $DIR/issue-72690.rs:12:26
@@ -225,5 +224,4 @@ LL |     String::from(<str as AsRef<T>>::as_ref("x"));
 
 error: aborting due to 17 previous errors
 
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/inference/multiple-impl-apply.rs b/tests/ui/inference/multiple-impl-apply.rs
index e6a6b928e56..314fe0f2ae5 100644
--- a/tests/ui/inference/multiple-impl-apply.rs
+++ b/tests/ui/inference/multiple-impl-apply.rs
@@ -31,9 +31,7 @@ fn main() {
     let x: Baz = Baz { inner: 42 };
 
     // DOESN'T Compile: Multiple options!
-    let y = x.into();
-    //~^ ERROR E0282
-    //~| ERROR E0283
+    let y = x.into(); //~ ERROR E0283
 
     let y_1: Foo = x.into();
     let y_2: Bar = x.into();
diff --git a/tests/ui/inference/multiple-impl-apply.stderr b/tests/ui/inference/multiple-impl-apply.stderr
index 47ed4916881..ec49e15201a 100644
--- a/tests/ui/inference/multiple-impl-apply.stderr
+++ b/tests/ui/inference/multiple-impl-apply.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
-  --> $DIR/multiple-impl-apply.rs:34:9
-   |
-LL |     let y = x.into();
-   |         ^
-   |
-help: consider giving `y` an explicit type
-   |
-LL |     let y: /* Type */ = x.into();
-   |          ++++++++++++
-
 error[E0283]: type annotations needed
   --> $DIR/multiple-impl-apply.rs:34:9
    |
@@ -29,7 +18,6 @@ help: consider giving `y` an explicit type
 LL |     let y: /* Type */ = x.into();
    |          ++++++++++++
 
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/inference/need_type_info/concrete-impl.rs b/tests/ui/inference/need_type_info/concrete-impl.rs
index fc79e6201bd..8960f870c39 100644
--- a/tests/ui/inference/need_type_info/concrete-impl.rs
+++ b/tests/ui/inference/need_type_info/concrete-impl.rs
@@ -14,6 +14,4 @@ fn main() {
     <Struct as Ambiguous<_>>::method();
     //~^ ERROR type annotations needed
     //~| NOTE cannot infer type of the type parameter `A`
-    //~| ERROR type annotations needed
-    //~| NOTE infer type of the type parameter `A`
 }
diff --git a/tests/ui/inference/need_type_info/concrete-impl.stderr b/tests/ui/inference/need_type_info/concrete-impl.stderr
index 74c3f6cd5cf..6b86753caf9 100644
--- a/tests/ui/inference/need_type_info/concrete-impl.stderr
+++ b/tests/ui/inference/need_type_info/concrete-impl.stderr
@@ -1,9 +1,3 @@
-error[E0282]: type annotations needed
-  --> $DIR/concrete-impl.rs:14:5
-   |
-LL |     <Struct as Ambiguous<_>>::method();
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `A` declared on the trait `Ambiguous`
-
 error[E0283]: type annotations needed
   --> $DIR/concrete-impl.rs:14:5
    |
@@ -19,7 +13,6 @@ LL |
 LL | impl Ambiguous<Two> for Struct {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.stderr b/tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.stderr
index 0ec219415ab..9ca94cd58df 100644
--- a/tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.stderr
+++ b/tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.stderr
@@ -1,9 +1,17 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
   --> $DIR/issue-113264-incorrect-impl-trait-in-path-suggestion.rs:10:16
    |
 LL |     (S {}).owo(None)
-   |                ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option`
+   |            --- ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option`
+   |            |
+   |            required by a bound introduced by this call
    |
+   = note: cannot satisfy `_: T`
+note: required by a bound in `S::owo`
+  --> $DIR/issue-113264-incorrect-impl-trait-in-path-suggestion.rs:6:35
+   |
+LL |     fn owo(&self, _: Option<&impl T>) {}
+   |                                   ^ required by this bound in `S::owo`
 help: consider specifying the generic argument
    |
 LL |     (S {}).owo(None::<&_>)
@@ -11,4 +19,4 @@ LL |     (S {}).owo(None::<&_>)
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/inference/question-mark-type-infer.rs b/tests/ui/inference/question-mark-type-infer.rs
index ab44c830b03..10560f85ed4 100644
--- a/tests/ui/inference/question-mark-type-infer.rs
+++ b/tests/ui/inference/question-mark-type-infer.rs
@@ -9,7 +9,6 @@ fn g() -> Result<Vec<i32>, ()> {
     let l = [1, 2, 3, 4];
     l.iter().map(f).collect()?
     //~^ ERROR type annotations needed
-    //~| ERROR type annotations needed
 }
 
 fn main() {
diff --git a/tests/ui/inference/question-mark-type-infer.stderr b/tests/ui/inference/question-mark-type-infer.stderr
index e8f040138fe..52baa213302 100644
--- a/tests/ui/inference/question-mark-type-infer.stderr
+++ b/tests/ui/inference/question-mark-type-infer.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
-  --> $DIR/question-mark-type-infer.rs:10:21
-   |
-LL |     l.iter().map(f).collect()?
-   |                     ^^^^^^^ cannot infer type of the type parameter `B` declared on the method `collect`
-   |
-help: consider specifying the generic argument
-   |
-LL |     l.iter().map(f).collect::<Vec<_>>()?
-   |                            ++++++++++
-
 error[E0283]: type annotations needed
   --> $DIR/question-mark-type-infer.rs:10:21
    |
@@ -23,7 +12,6 @@ help: consider specifying the generic argument
 LL |     l.iter().map(f).collect::<Vec<_>>()?
    |                            ++++++++++
 
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/issues/issue-12187-1.stderr b/tests/ui/issues/issue-12187-1.stderr
index 806b7f0ac05..d2a6a96082e 100644
--- a/tests/ui/issues/issue-12187-1.stderr
+++ b/tests/ui/issues/issue-12187-1.stderr
@@ -2,9 +2,9 @@ error[E0282]: type annotations needed for `&T`
   --> $DIR/issue-12187-1.rs:6:9
    |
 LL |     let &v = new();
-   |         ^^
+   |         ^^   ----- type must be known at this point
    |
-help: consider giving this pattern a type, where the placeholders `_` are specified
+help: consider giving this pattern a type, where the type for type parameter `T` is specified
    |
 LL |     let &v: &T = new();
    |           ++++
diff --git a/tests/ui/issues/issue-12187-2.stderr b/tests/ui/issues/issue-12187-2.stderr
index a1fa0a2b002..ac75ebb4256 100644
--- a/tests/ui/issues/issue-12187-2.stderr
+++ b/tests/ui/issues/issue-12187-2.stderr
@@ -2,9 +2,9 @@ error[E0282]: type annotations needed for `&T`
   --> $DIR/issue-12187-2.rs:6:9
    |
 LL |     let &v = new();
-   |         ^^
+   |         ^^   ----- type must be known at this point
    |
-help: consider giving this pattern a type, where the placeholders `_` are specified
+help: consider giving this pattern a type, where the type for type parameter `T` is specified
    |
 LL |     let &v: &T = new();
    |           ++++
diff --git a/tests/ui/issues/issue-16966.stderr b/tests/ui/issues/issue-16966.stderr
index 8c92505b5eb..c53707c5d69 100644
--- a/tests/ui/issues/issue-16966.stderr
+++ b/tests/ui/issues/issue-16966.stderr
@@ -1,9 +1,16 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
   --> $DIR/issue-16966.rs:2:12
    |
 LL |     panic!(std::default::Default::default());
-   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
+   |     -------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
+   |     |      |
+   |     |      cannot infer type
+   |     required by a bound introduced by this call
+   |
+   = note: cannot satisfy `_: Any`
+note: required by a bound in `begin_panic`
+  --> $SRC_DIR/std/src/panicking.rs:LL:COL
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/issues/issue-17551.stderr b/tests/ui/issues/issue-17551.stderr
index 5f45a2f8443..3a8f569a3a5 100644
--- a/tests/ui/issues/issue-17551.stderr
+++ b/tests/ui/issues/issue-17551.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `B<T>`
   --> $DIR/issue-17551.rs:6:9
    |
 LL |     let foo = B(marker::PhantomData);
-   |         ^^^
+   |         ^^^     ------------------- type must be known at this point
    |
 help: consider giving `foo` an explicit type, where the type for type parameter `T` is specified
    |
diff --git a/tests/ui/issues/issue-24036.stderr b/tests/ui/issues/issue-24036.stderr
index a425816cdeb..184383b7369 100644
--- a/tests/ui/issues/issue-24036.stderr
+++ b/tests/ui/issues/issue-24036.stderr
@@ -11,12 +11,13 @@ LL |     x = |c| c + 1;
    = note: no two closures, even if identical, have the same type
    = help: consider boxing your closure and/or using it as a trait object
 
-error[E0282]: type annotations needed
+error[E0284]: type annotations needed
   --> $DIR/issue-24036.rs:9:15
    |
 LL |         1 => |c| c + 1,
-   |               ^
+   |               ^    - type must be known at this point
    |
+   = note: cannot satisfy `<_ as Add<i32>>::Output == _`
 help: consider giving this closure parameter an explicit type
    |
 LL |         1 => |c: /* Type */| c + 1,
@@ -24,5 +25,5 @@ LL |         1 => |c: /* Type */| c + 1,
 
 error: aborting due to 2 previous errors
 
-Some errors have detailed explanations: E0282, E0308.
-For more information about an error, try `rustc --explain E0282`.
+Some errors have detailed explanations: E0284, E0308.
+For more information about an error, try `rustc --explain E0284`.
diff --git a/tests/ui/issues/issue-24446.stderr b/tests/ui/issues/issue-24446.stderr
index 4afb87c4825..72d528f1619 100644
--- a/tests/ui/issues/issue-24446.stderr
+++ b/tests/ui/issues/issue-24446.stderr
@@ -1,19 +1,19 @@
-error[E0277]: the size for values of type `(dyn Fn() -> u32 + 'static)` cannot be known at compilation time
+error[E0277]: `(dyn Fn() -> u32 + 'static)` cannot be shared between threads safely
   --> $DIR/issue-24446.rs:2:17
    |
 LL |     static foo: dyn Fn() -> u32 = || -> u32 {
-   |                 ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+   |                 ^^^^^^^^^^^^^^^ `(dyn Fn() -> u32 + 'static)` cannot be shared between threads safely
    |
-   = help: the trait `Sized` is not implemented for `(dyn Fn() -> u32 + 'static)`
+   = 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]: `(dyn Fn() -> u32 + 'static)` cannot be shared between threads safely
+error[E0277]: the size for values of type `(dyn Fn() -> u32 + 'static)` cannot be known at compilation time
   --> $DIR/issue-24446.rs:2:17
    |
 LL |     static foo: dyn Fn() -> u32 = || -> u32 {
-   |                 ^^^^^^^^^^^^^^^ `(dyn Fn() -> u32 + 'static)` cannot be shared between threads safely
+   |                 ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
    |
-   = help: the trait `Sync` is not implemented for `(dyn Fn() -> u32 + 'static)`
-   = note: shared static variables must have a type that implements `Sync`
+   = help: the trait `Sized` is not implemented for `(dyn Fn() -> u32 + 'static)`
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/iterators/collect-into-slice.stderr b/tests/ui/iterators/collect-into-slice.stderr
index 07dc561f06a..45685ef0ce9 100644
--- a/tests/ui/iterators/collect-into-slice.stderr
+++ b/tests/ui/iterators/collect-into-slice.stderr
@@ -1,3 +1,13 @@
+error[E0277]: a slice of type `[i32]` cannot be built since `[i32]` has no definite size
+  --> $DIR/collect-into-slice.rs:6:38
+   |
+LL |     let some_generated_vec = (0..10).collect();
+   |                                      ^^^^^^^ try explicitly collecting into a `Vec<{integer}>`
+   |
+   = help: the trait `FromIterator<{integer}>` is not implemented for `[i32]`
+note: required by a bound in `collect`
+  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+
 error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
   --> $DIR/collect-into-slice.rs:6:9
    |
@@ -18,16 +28,6 @@ LL |     let some_generated_vec = (0..10).collect();
 note: required by a bound in `collect`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
-error[E0277]: a slice of type `[i32]` cannot be built since `[i32]` has no definite size
-  --> $DIR/collect-into-slice.rs:6:38
-   |
-LL |     let some_generated_vec = (0..10).collect();
-   |                                      ^^^^^^^ try explicitly collecting into a `Vec<{integer}>`
-   |
-   = help: the trait `FromIterator<{integer}>` is not implemented for `[i32]`
-note: required by a bound in `collect`
-  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-
 error[E0277]: a slice of type `&[i32]` cannot be built since we need to store the elements somewhere
   --> $DIR/collect-into-slice.rs:18:38
    |
diff --git a/tests/ui/methods/method-ambig-one-trait-unknown-int-type.stderr b/tests/ui/methods/method-ambig-one-trait-unknown-int-type.stderr
index e0f8a5447b0..0a022dc3984 100644
--- a/tests/ui/methods/method-ambig-one-trait-unknown-int-type.stderr
+++ b/tests/ui/methods/method-ambig-one-trait-unknown-int-type.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `Vec<T>`
   --> $DIR/method-ambig-one-trait-unknown-int-type.rs:24:9
    |
 LL |     let mut x = Vec::new();
-   |         ^^^^^
+   |         ^^^^^   ---------- type must be known at this point
    |
 help: consider giving `x` an explicit type, where the type for type parameter `T` is specified
    |
diff --git a/tests/ui/pattern/slice-patterns-irrefutable.stderr b/tests/ui/pattern/slice-patterns-irrefutable.stderr
index fac99534f3e..e98ee28d686 100644
--- a/tests/ui/pattern/slice-patterns-irrefutable.stderr
+++ b/tests/ui/pattern/slice-patterns-irrefutable.stderr
@@ -3,6 +3,9 @@ error[E0282]: type annotations needed for `[_; 3]`
    |
 LL |     let b;
    |         ^
+LL |
+LL |     [a, b] = Default::default();
+   |      - type must be known at this point
    |
 help: consider giving `b` an explicit type, where the placeholders `_` are specified
    |
diff --git a/tests/ui/suggestions/slice-issue-87994.stderr b/tests/ui/suggestions/slice-issue-87994.stderr
index 84ecd749b0d..656f71eb877 100644
--- a/tests/ui/suggestions/slice-issue-87994.stderr
+++ b/tests/ui/suggestions/slice-issue-87994.stderr
@@ -1,4 +1,4 @@
-error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
+error[E0277]: `[i32]` is not an iterator
   --> $DIR/slice-issue-87994.rs:3:12
    |
 LL |   for _ in v[1..] {
@@ -13,7 +13,7 @@ LL |   for _ in &v[1..] {
 LL |   for _ in &mut v[1..] {
    |            ++++
 
-error[E0277]: `[i32]` is not an iterator
+error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
   --> $DIR/slice-issue-87994.rs:3:12
    |
 LL |   for _ in v[1..] {
@@ -28,7 +28,7 @@ LL |   for _ in &v[1..] {
 LL |   for _ in &mut v[1..] {
    |            ++++
 
-error[E0277]: the size for values of type `[K]` cannot be known at compilation time
+error[E0277]: `[K]` is not an iterator
   --> $DIR/slice-issue-87994.rs:11:13
    |
 LL |   for i2 in v2[1..] {
@@ -43,7 +43,7 @@ LL |   for i2 in &v2[1..] {
 LL |   for i2 in &mut v2[1..] {
    |             ++++
 
-error[E0277]: `[K]` is not an iterator
+error[E0277]: the size for values of type `[K]` cannot be known at compilation time
   --> $DIR/slice-issue-87994.rs:11:13
    |
 LL |   for i2 in v2[1..] {
diff --git a/tests/ui/traits/copy-guessing.stderr b/tests/ui/traits/copy-guessing.stderr
index 568b7e5a64a..7e676c9da01 100644
--- a/tests/ui/traits/copy-guessing.stderr
+++ b/tests/ui/traits/copy-guessing.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `Option<T>`
   --> $DIR/copy-guessing.rs:20:9
    |
 LL |     let n = None;
-   |         ^
+   |         ^   ---- type must be known at this point
    |
 help: consider giving `n` an explicit type, where the type for type parameter `T` is specified
    |
diff --git a/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs b/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs
index 9a444be500c..205b1173e07 100644
--- a/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs
+++ b/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs
@@ -14,7 +14,5 @@ impl<X> Method<u32> for Thing<X> {
 
 fn main() {
     let thing = Thing(true);
-    thing.method(42);
-    //~^ ERROR type annotations needed
-    //~| ERROR type annotations needed
+    thing.method(42); //~ ERROR type annotations needed
 }
diff --git a/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr b/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr
index 57b2587ae5c..2185c51e59d 100644
--- a/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr
+++ b/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
-  --> $DIR/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs:17:11
-   |
-LL |     thing.method(42);
-   |           ^^^^^^
-   |
-help: try using a fully qualified path to specify the expected types
-   |
-LL |     <Thing<bool> as Method<T>>::method(thing, 42);
-   |     +++++++++++++++++++++++++++++++++++     ~
-
 error[E0283]: type annotations needed
   --> $DIR/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs:17:11
    |
@@ -28,7 +17,6 @@ help: try using a fully qualified path to specify the expected types
 LL |     <Thing<bool> as Method<T>>::method(thing, 42);
    |     +++++++++++++++++++++++++++++++++++     ~
 
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/issue-77982.stderr b/tests/ui/traits/issue-77982.stderr
index 33cc186ac0b..d08b0d68e0f 100644
--- a/tests/ui/traits/issue-77982.stderr
+++ b/tests/ui/traits/issue-77982.stderr
@@ -35,12 +35,23 @@ help: consider specifying the generic argument
 LL |     opts.get::<Q>(opt.as_ref());
    |             +++++
 
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
   --> $DIR/issue-77982.rs:13:59
    |
 LL |     let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect();
-   |                                                           ^^^^
-   |
+   |                                            ---            ^^^^
+   |                                            |
+   |                                            type must be known at this point
+   |
+   = note: multiple `impl`s satisfying `u32: From<_>` found in the `core` crate:
+           - impl From<Ipv4Addr> for u32;
+           - impl From<NonZeroU32> for u32;
+           - impl From<bool> for u32;
+           - impl From<char> for u32;
+           - impl From<u16> for u32;
+           - impl From<u8> for u32;
+           - impl<T> From<!> for T;
+           - impl<T> From<T> for T;
 help: try using a fully qualified path to specify the expected types
    |
 LL |     let ips: Vec<_> = (0..100_000).map(|_| u32::from(<u32 as Into<T>>::into(0u32))).collect();
@@ -84,5 +95,4 @@ LL |     let _: Box<T> = (&()).bar();
 
 error: aborting due to 5 previous errors
 
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/multidispatch-convert-ambig-dest.rs b/tests/ui/traits/multidispatch-convert-ambig-dest.rs
index aa74e11c362..36e1e868fca 100644
--- a/tests/ui/traits/multidispatch-convert-ambig-dest.rs
+++ b/tests/ui/traits/multidispatch-convert-ambig-dest.rs
@@ -25,7 +25,6 @@ where T : Convert<U>
 fn a() {
     test(22, std::default::Default::default());
     //~^ ERROR type annotations needed
-    //~| ERROR type annotations needed
 }
 
 fn main() {}
diff --git a/tests/ui/traits/multidispatch-convert-ambig-dest.stderr b/tests/ui/traits/multidispatch-convert-ambig-dest.stderr
index e927f26e96d..e3bfc78bb08 100644
--- a/tests/ui/traits/multidispatch-convert-ambig-dest.stderr
+++ b/tests/ui/traits/multidispatch-convert-ambig-dest.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
-  --> $DIR/multidispatch-convert-ambig-dest.rs:26:5
-   |
-LL |     test(22, std::default::Default::default());
-   |     ^^^^ cannot infer type of the type parameter `U` declared on the function `test`
-   |
-help: consider specifying the generic arguments
-   |
-LL |     test::<i32, U>(22, std::default::Default::default());
-   |         ++++++++++
-
 error[E0283]: type annotations needed
   --> $DIR/multidispatch-convert-ambig-dest.rs:26:5
    |
@@ -37,7 +26,6 @@ help: consider specifying the generic arguments
 LL |     test::<i32, U>(22, std::default::Default::default());
    |         ++++++++++
 
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/new-solver/alias-bound-unsound.rs b/tests/ui/traits/new-solver/alias-bound-unsound.rs
index 38d83d289f1..825e874d71b 100644
--- a/tests/ui/traits/new-solver/alias-bound-unsound.rs
+++ b/tests/ui/traits/new-solver/alias-bound-unsound.rs
@@ -27,6 +27,5 @@ fn main() {
     //~| ERROR overflow evaluating the requirement `<() as Foo>::Item well-formed`
     //~| ERROR overflow evaluating the requirement `String <: <() as Foo>::Item`
     //~| ERROR overflow evaluating the requirement `&<() as Foo>::Item well-formed`
-    //~| ERROR type annotations needed
     println!("{x}");
 }
diff --git a/tests/ui/traits/new-solver/alias-bound-unsound.stderr b/tests/ui/traits/new-solver/alias-bound-unsound.stderr
index abc6677c132..ca4b5c90ff2 100644
--- a/tests/ui/traits/new-solver/alias-bound-unsound.stderr
+++ b/tests/ui/traits/new-solver/alias-bound-unsound.stderr
@@ -11,18 +11,7 @@ note: required by a bound in `Foo::Item`
 LL |     type Item: Copy
    |                ^^^^ required by this bound in `Foo::Item`
 
-error[E0282]: type annotations needed
-  --> $DIR/alias-bound-unsound.rs:24:5
-   |
-LL |     drop(<() as Foo>::copy_me(&x));
-   |     ^^^^ cannot infer type of the type parameter `T` declared on the function `drop`
-   |
-help: consider specifying the generic argument
-   |
-LL |     drop::<T>(<() as Foo>::copy_me(&x));
-   |         +++++
-
-error[E0275]: overflow evaluating the requirement `&<() as Foo>::Item well-formed`
+error[E0275]: overflow evaluating the requirement `String <: <() as Foo>::Item`
   --> $DIR/alias-bound-unsound.rs:24:31
    |
 LL |     drop(<() as Foo>::copy_me(&x));
@@ -30,40 +19,39 @@ LL |     drop(<() as Foo>::copy_me(&x));
    |
    = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
 
-error[E0275]: overflow evaluating the requirement `String <: <() as Foo>::Item`
-  --> $DIR/alias-bound-unsound.rs:24:31
+error[E0275]: overflow evaluating the requirement `<() as Foo>::Item == _`
+  --> $DIR/alias-bound-unsound.rs:24:10
    |
 LL |     drop(<() as Foo>::copy_me(&x));
-   |                               ^^
+   |          ^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
 
-error[E0275]: overflow evaluating the requirement `<() as Foo>::Item well-formed`
+error[E0275]: overflow evaluating the requirement `<() as Foo>::Item: Sized`
   --> $DIR/alias-bound-unsound.rs:24:10
    |
 LL |     drop(<() as Foo>::copy_me(&x));
-   |          ^^^^^^^^^^^^^^^^^^^^^^^^
+   |          ^^^^^^^^^^^^^^^^^^^^
    |
    = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
+   = note: the return type of a function must have a statically known size
 
-error[E0275]: overflow evaluating the requirement `<() as Foo>::Item == _`
-  --> $DIR/alias-bound-unsound.rs:24:10
+error[E0275]: overflow evaluating the requirement `&<() as Foo>::Item well-formed`
+  --> $DIR/alias-bound-unsound.rs:24:31
    |
 LL |     drop(<() as Foo>::copy_me(&x));
-   |          ^^^^^^^^^^^^^^^^^^^^^^^^
+   |                               ^^
    |
    = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
 
-error[E0275]: overflow evaluating the requirement `<() as Foo>::Item: Sized`
+error[E0275]: overflow evaluating the requirement `<() as Foo>::Item well-formed`
   --> $DIR/alias-bound-unsound.rs:24:10
    |
 LL |     drop(<() as Foo>::copy_me(&x));
-   |          ^^^^^^^^^^^^^^^^^^^^
+   |          ^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
-   = note: the return type of a function must have a statically known size
 
-error: aborting due to 7 previous errors
+error: aborting due to 6 previous errors
 
-Some errors have detailed explanations: E0275, E0282.
-For more information about an error, try `rustc --explain E0275`.
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr b/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr
index 47004821ad7..414deb47727 100644
--- a/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr
+++ b/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr
@@ -1,9 +1,16 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
   --> $DIR/runaway-impl-candidate-selection.rs:13:22
    |
 LL |     println!("{:?}", iter::<_>());
    |                      ^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `iter`
+   |
+   = note: cannot satisfy `_: Iterator`
+note: required by a bound in `iter`
+  --> $DIR/runaway-impl-candidate-selection.rs:8:12
+   |
+LL | fn iter<T: Iterator>() -> <T as Iterator>::Item {
+   |            ^^^^^^^^ required by this bound in `iter`
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs
index fcafdcf637a..44e763ef990 100644
--- a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs
+++ b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs
@@ -27,6 +27,5 @@ fn impls<T: Trait>() {}
 
 fn main() {
     impls::<W<_>>();
-    //~^ ERROR type annotations needed
-    //~| ERROR overflow evaluating the requirement
+    //~^ ERROR overflow evaluating the requirement
 }
diff --git a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr
index a861156711d..1ac0e297729 100644
--- a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr
+++ b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr
@@ -1,9 +1,3 @@
-error[E0282]: type annotations needed
-  --> $DIR/fixpoint-exponential-growth.rs:29:5
-   |
-LL |     impls::<W<_>>();
-   |     ^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `impls`
-
 error[E0275]: overflow evaluating the requirement `W<_>: Trait`
   --> $DIR/fixpoint-exponential-growth.rs:29:13
    |
@@ -17,7 +11,6 @@ note: required by a bound in `impls`
 LL | fn impls<T: Trait>() {}
    |             ^^^^^ required by this bound in `impls`
 
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
-Some errors have detailed explanations: E0275, E0282.
-For more information about an error, try `rustc --explain E0275`.
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr b/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr
index 9a8060133b8..9aa4f4531f9 100644
--- a/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr
+++ b/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr
@@ -1,9 +1,18 @@
-error[E0282]: type annotations needed
+error[E0284]: type annotations needed: cannot satisfy `<<Leaf as WithAssoc<_>>::Assoc as Id>::Assoc == <<Leaf as WithAssoc<_>>::Assoc as Id>::Assoc`
   --> $DIR/generalize-proj-new-universe-index-2.rs:74:5
    |
 LL |     bound::<<Rigid as IdHigherRankedBound>::Assoc, <Wrapper<Leaf> as Id>::Assoc, _>()
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `V` declared on the function `bound`
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `<<Leaf as WithAssoc<_>>::Assoc as Id>::Assoc == <<Leaf as WithAssoc<_>>::Assoc as Id>::Assoc`
+   |
+note: required by a bound in `bound`
+  --> $DIR/generalize-proj-new-universe-index-2.rs:69:21
+   |
+LL | fn bound<T: ?Sized, U: ?Sized, V: ?Sized>()
+   |    ----- required by a bound in this function
+LL | where
+LL |     T: WithAssoc<U, Assoc = V>,
+   |                     ^^^^^^^^^ required by this bound in `bound`
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0284`.
diff --git a/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr b/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr
index 06283201261..f482e8cfaf9 100644
--- a/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr
+++ b/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr
@@ -1,9 +1,17 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
   --> $DIR/normalizes_to_ignores_unnormalizable_candidate.rs:36:5
    |
 LL |     foo(unconstrained())
-   |     ^^^ cannot infer type of the type parameter `T` declared on the function `foo`
+   |     ^^^ --------------- type must be known at this point
+   |     |
+   |     cannot infer type of the type parameter `T` declared on the function `foo`
    |
+   = note: cannot satisfy `_: Trait`
+note: required by a bound in `foo`
+  --> $DIR/normalizes_to_ignores_unnormalizable_candidate.rs:19:11
+   |
+LL | fn foo<T: Trait<Assoc = u8>>(x: T) {}
+   |           ^^^^^^^^^^^^^^^^^ required by this bound in `foo`
 help: consider specifying the generic argument
    |
 LL |     foo::<T>(unconstrained())
@@ -11,4 +19,4 @@ LL |     foo::<T>(unconstrained())
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs
index b37f09ee185..3d2e70a639f 100644
--- a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs
+++ b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs
@@ -15,6 +15,5 @@ fn impls<T: Trait>() {}
 
 fn main() {
     impls::<W<_>>();
-    //~^ ERROR type annotations needed
-    //~| ERROR overflow evaluating the requirement `W<_>: Trait`
+    //~^ ERROR overflow evaluating the requirement `W<_>: Trait`
 }
diff --git a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr
index beed40f3649..023efc41aeb 100644
--- a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr
+++ b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr
@@ -1,9 +1,3 @@
-error[E0282]: type annotations needed
-  --> $DIR/exponential-trait-goals.rs:17:5
-   |
-LL |     impls::<W<_>>();
-   |     ^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `impls`
-
 error[E0275]: overflow evaluating the requirement `W<_>: Trait`
   --> $DIR/exponential-trait-goals.rs:17:13
    |
@@ -17,7 +11,6 @@ note: required by a bound in `impls`
 LL | fn impls<T: Trait>() {}
    |             ^^^^^ required by this bound in `impls`
 
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
-Some errors have detailed explanations: E0275, E0282.
-For more information about an error, try `rustc --explain E0275`.
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr b/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr
index ed9b57cb1bd..d8db07277c5 100644
--- a/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr
+++ b/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr
@@ -23,13 +23,13 @@ LL | where
 LL |     for<V> V: Sized,
    |               ^^^^^ required by this bound in `foo`
 
-error[E0277]: the size for values of type `V` cannot be known at compilation time
+error[E0277]: `V` is not an iterator
   --> $DIR/bad-sized-cond.rs:20:5
    |
 LL |     bar();
-   |     ^^^ doesn't have a size known at compile-time
+   |     ^^^ `V` is not an iterator
    |
-   = help: the trait `Sized` is not implemented for `V`
+   = help: the trait `Iterator` is not implemented for `V`
    = note: required for `V` to implement `IntoIterator`
 note: required by a bound in `bar`
   --> $DIR/bad-sized-cond.rs:12:15
@@ -40,13 +40,13 @@ LL | where
 LL |     for<V> V: IntoIterator,
    |               ^^^^^^^^^^^^ required by this bound in `bar`
 
-error[E0277]: `V` is not an iterator
+error[E0277]: the size for values of type `V` cannot be known at compilation time
   --> $DIR/bad-sized-cond.rs:20:5
    |
 LL |     bar();
-   |     ^^^ `V` is not an iterator
+   |     ^^^ doesn't have a size known at compile-time
    |
-   = help: the trait `Iterator` is not implemented for `V`
+   = help: the trait `Sized` is not implemented for `V`
    = note: required for `V` to implement `IntoIterator`
 note: required by a bound in `bar`
   --> $DIR/bad-sized-cond.rs:12:15
diff --git a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.rs b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.rs
index 538e74ee1b0..e9e2f6b1290 100644
--- a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.rs
+++ b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.rs
@@ -18,7 +18,5 @@ where
 
 fn main() {
     let a = A(B);
-    a.method();
-    //~^ ERROR type annotations needed
-    //~| ERROR type annotations needed
+    a.method(); //~ ERROR type annotations needed
 }
diff --git a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr
index 92d9d32cf9c..86ae49b32fc 100644
--- a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr
+++ b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
-  --> $DIR/not-suggest-non-existing-fully-qualified-path.rs:21:7
-   |
-LL |     a.method();
-   |       ^^^^^^
-   |
-help: try using a fully qualified path to specify the expected types
-   |
-LL |     <A<B> as V<U>>::method(a);
-   |     +++++++++++++++++++++++ ~
-
 error[E0283]: type annotations needed
   --> $DIR/not-suggest-non-existing-fully-qualified-path.rs:21:7
    |
@@ -35,7 +24,6 @@ help: try using a fully qualified path to specify the expected types
 LL |     <A<B> as V<U>>::method(a);
    |     +++++++++++++++++++++++ ~
 
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/suggest-fully-qualified-closure.stderr b/tests/ui/traits/suggest-fully-qualified-closure.stderr
index 2aea3783fea..43cef7027a2 100644
--- a/tests/ui/traits/suggest-fully-qualified-closure.stderr
+++ b/tests/ui/traits/suggest-fully-qualified-closure.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
-  --> $DIR/suggest-fully-qualified-closure.rs:23:7
-   |
-LL |     q.lol(||());
-   |       ^^^
-   |
-help: try using a fully qualified path to specify the expected types
-   |
-LL |     <Qqq as MyTrait<T>>::lol::<{closure@}>(&q, ||());
-   |     +++ ~
-
 error[E0283]: type annotations needed
   --> $DIR/suggest-fully-qualified-closure.rs:23:7
    |
@@ -28,7 +17,6 @@ help: try using a fully qualified path to specify the expected types
 LL |     <Qqq as MyTrait<T>>::lol::<{closure@}>(&q, ||());
    |     +++ ~
 
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.rs b/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.rs
index 9a2cf469d08..f0861857bf7 100644
--- a/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.rs
+++ b/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.rs
@@ -42,9 +42,7 @@ impl<T> DerefMut for DerefsTo<T> {
 
 fn main() {
     let mut thing = Thing;
-    thing.method();
-    //~^ ERROR type annotations needed
-    //~| ERROR type annotations needed
+    thing.method(); //~ ERROR type annotations needed
     thing.mut_method(); //~ ERROR type annotations needed
     thing.by_self(); //~ ERROR type annotations needed
 
diff --git a/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr b/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr
index 68b31a1ca34..841acb5ffd3 100644
--- a/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr
+++ b/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
-  --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:45:11
-   |
-LL |     thing.method();
-   |           ^^^^^^
-   |
-help: try using a fully qualified path to specify the expected types
-   |
-LL |     <Thing as Method<T>>::method(&thing);
-   |     ++++++++++++++++++++++++++++++     ~
-
 error[E0283]: type annotations needed
   --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:45:11
    |
@@ -29,7 +18,7 @@ LL |     <Thing as Method<T>>::method(&thing);
    |     ++++++++++++++++++++++++++++++     ~
 
 error[E0283]: type annotations needed
-  --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:48:11
+  --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:46:11
    |
 LL |     thing.mut_method();
    |           ^^^^^^^^^^
@@ -48,7 +37,7 @@ LL |     <Thing as Method<T>>::mut_method(&mut thing);
    |     +++++++++++++++++++++++++++++++++++++      ~
 
 error[E0283]: type annotations needed
-  --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:49:11
+  --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:47:11
    |
 LL |     thing.by_self();
    |           ^^^^^^^
@@ -67,7 +56,7 @@ LL |     <&Thing as MethodRef<T>>::by_self(&thing);
    |     +++++++++++++++++++++++++++++++++++     ~
 
 error[E0283]: type annotations needed
-  --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:52:14
+  --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:50:14
    |
 LL |     deref_to.method();
    |              ^^^^^^
@@ -86,7 +75,7 @@ LL |     <Thing as Method<T>>::method(&deref_to);
    |     ++++++++++++++++++++++++++++++        ~
 
 error[E0283]: type annotations needed
-  --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:53:14
+  --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:51:14
    |
 LL |     deref_to.mut_method();
    |              ^^^^^^^^^^
@@ -105,7 +94,7 @@ LL |     <Thing as Method<T>>::mut_method(&mut deref_to);
    |     +++++++++++++++++++++++++++++++++++++         ~
 
 error[E0283]: type annotations needed
-  --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:54:14
+  --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:52:14
    |
 LL |     deref_to.by_self();
    |              ^^^^^^^
@@ -124,7 +113,7 @@ LL |     <&Thing as MethodRef<T>>::by_self(&deref_to);
    |     +++++++++++++++++++++++++++++++++++        ~
 
 error[E0283]: type annotations needed
-  --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:57:20
+  --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:55:20
    |
 LL |     deref_deref_to.method();
    |                    ^^^^^^
@@ -143,7 +132,7 @@ LL |     <Thing as Method<T>>::method(&deref_deref_to);
    |     ++++++++++++++++++++++++++++++              ~
 
 error[E0283]: type annotations needed
-  --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:58:20
+  --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:56:20
    |
 LL |     deref_deref_to.mut_method();
    |                    ^^^^^^^^^^
@@ -162,7 +151,7 @@ LL |     <Thing as Method<T>>::mut_method(&mut deref_deref_to);
    |     +++++++++++++++++++++++++++++++++++++               ~
 
 error[E0283]: type annotations needed
-  --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:59:20
+  --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:57:20
    |
 LL |     deref_deref_to.by_self();
    |                    ^^^^^^^
@@ -180,7 +169,6 @@ help: try using a fully qualified path to specify the expected types
 LL |     <&Thing as MethodRef<T>>::by_self(&deref_deref_to);
    |     +++++++++++++++++++++++++++++++++++              ~
 
-error: aborting due to 10 previous errors
+error: aborting due to 9 previous errors
 
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.rs b/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.rs
index da640c8c8c2..6a63e27f75f 100644
--- a/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.rs
+++ b/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.rs
@@ -42,9 +42,7 @@ impl<T> DerefMut for DerefsTo<T> {
 
 fn main() {
     let mut ref_thing = &Thing;
-    ref_thing.method();
-    //~^ ERROR type annotations needed
-    //~| ERROR type annotations needed
+    ref_thing.method(); //~ ERROR type annotations needed
     ref_thing.by_self(); //~ ERROR type annotations needed
 
     let mut mut_thing = &mut Thing;
diff --git a/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr b/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr
index 27518a54e75..1865d81bad1 100644
--- a/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr
+++ b/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
-  --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:45:15
-   |
-LL |     ref_thing.method();
-   |               ^^^^^^
-   |
-help: try using a fully qualified path to specify the expected types
-   |
-LL |     <Thing as Method<T>>::method(ref_thing);
-   |     +++++++++++++++++++++++++++++         ~
-
 error[E0283]: type annotations needed
   --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:45:15
    |
@@ -29,7 +18,7 @@ LL |     <Thing as Method<T>>::method(ref_thing);
    |     +++++++++++++++++++++++++++++         ~
 
 error[E0283]: type annotations needed
-  --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:48:15
+  --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:46:15
    |
 LL |     ref_thing.by_self();
    |               ^^^^^^^
@@ -48,7 +37,7 @@ LL |     <&Thing as MethodRef<T>>::by_self(ref_thing);
    |     ++++++++++++++++++++++++++++++++++         ~
 
 error[E0283]: type annotations needed
-  --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:51:15
+  --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:49:15
    |
 LL |     mut_thing.method();
    |               ^^^^^^
@@ -67,7 +56,7 @@ LL |     <Thing as Method<T>>::method(mut_thing);
    |     +++++++++++++++++++++++++++++         ~
 
 error[E0283]: type annotations needed
-  --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:52:15
+  --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:50:15
    |
 LL |     mut_thing.mut_method();
    |               ^^^^^^^^^^
@@ -86,7 +75,7 @@ LL |     <Thing as Method<T>>::mut_method(mut_thing);
    |     +++++++++++++++++++++++++++++++++         ~
 
 error[E0283]: type annotations needed
-  --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:53:15
+  --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:51:15
    |
 LL |     mut_thing.by_self();
    |               ^^^^^^^
@@ -105,7 +94,7 @@ LL |     <&Thing as MethodRef<T>>::by_self(mut_thing);
    |     ++++++++++++++++++++++++++++++++++         ~
 
 error[E0283]: type annotations needed
-  --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:56:14
+  --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:54:14
    |
 LL |     deref_to.method();
    |              ^^^^^^
@@ -124,7 +113,7 @@ LL |     <Thing as Method<T>>::method(deref_to);
    |     +++++++++++++++++++++++++++++        ~
 
 error[E0283]: type annotations needed
-  --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:57:14
+  --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:55:14
    |
 LL |     deref_to.mut_method();
    |              ^^^^^^^^^^
@@ -143,7 +132,7 @@ LL |     <Thing as Method<T>>::mut_method(deref_to);
    |     +++++++++++++++++++++++++++++++++        ~
 
 error[E0283]: type annotations needed
-  --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:58:14
+  --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:56:14
    |
 LL |     deref_to.by_self();
    |              ^^^^^^^
@@ -162,7 +151,7 @@ LL |     <&Thing as MethodRef<T>>::by_self(deref_to);
    |     ++++++++++++++++++++++++++++++++++        ~
 
 error[E0283]: type annotations needed
-  --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:61:20
+  --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:59:20
    |
 LL |     deref_deref_to.method();
    |                    ^^^^^^
@@ -181,7 +170,7 @@ LL |     <Thing as Method<T>>::method(deref_deref_to);
    |     +++++++++++++++++++++++++++++              ~
 
 error[E0283]: type annotations needed
-  --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:62:20
+  --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:60:20
    |
 LL |     deref_deref_to.mut_method();
    |                    ^^^^^^^^^^
@@ -200,7 +189,7 @@ LL |     <Thing as Method<T>>::mut_method(deref_deref_to);
    |     +++++++++++++++++++++++++++++++++              ~
 
 error[E0283]: type annotations needed
-  --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:63:20
+  --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:61:20
    |
 LL |     deref_deref_to.by_self();
    |                    ^^^^^^^
@@ -218,7 +207,6 @@ help: try using a fully qualified path to specify the expected types
 LL |     <&Thing as MethodRef<T>>::by_self(deref_deref_to);
    |     ++++++++++++++++++++++++++++++++++              ~
 
-error: aborting due to 12 previous errors
+error: aborting due to 11 previous errors
 
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/type-inference/sort_by_key.stderr b/tests/ui/type-inference/sort_by_key.stderr
index de7b4b24899..81af024b3fb 100644
--- a/tests/ui/type-inference/sort_by_key.stderr
+++ b/tests/ui/type-inference/sort_by_key.stderr
@@ -1,9 +1,14 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
   --> $DIR/sort_by_key.rs:3:40
    |
 LL |     lst.sort_by_key(|&(v, _)| v.iter().sum());
-   |                                        ^^^ cannot infer type of the type parameter `S` declared on the method `sum`
+   |         -----------                    ^^^ cannot infer type of the type parameter `S` declared on the method `sum`
+   |         |
+   |         type must be known at this point
    |
+   = note: cannot satisfy `_: Ord`
+note: required by a bound in `slice::<impl [T]>::sort_by_key`
+  --> $SRC_DIR/alloc/src/slice.rs:LL:COL
 help: consider specifying the generic argument
    |
 LL |     lst.sort_by_key(|&(v, _)| v.iter().sum::<S>());
@@ -11,4 +16,4 @@ LL |     lst.sort_by_key(|&(v, _)| v.iter().sum::<S>());
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/type/type-check/cannot_infer_local_or_vec.stderr b/tests/ui/type/type-check/cannot_infer_local_or_vec.stderr
index 09c4b2053b2..7be00341d10 100644
--- a/tests/ui/type/type-check/cannot_infer_local_or_vec.stderr
+++ b/tests/ui/type/type-check/cannot_infer_local_or_vec.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `Vec<_>`
   --> $DIR/cannot_infer_local_or_vec.rs:2:9
    |
 LL |     let x = vec![];
-   |         ^
+   |         ^   ------ type must be known at this point
    |
 help: consider giving `x` an explicit type, where the placeholders `_` are specified
    |
diff --git a/tests/ui/wf/wf-fn-where-clause.stderr b/tests/ui/wf/wf-fn-where-clause.stderr
index 2aec641e71e..cd6c051feed 100644
--- a/tests/ui/wf/wf-fn-where-clause.stderr
+++ b/tests/ui/wf/wf-fn-where-clause.stderr
@@ -14,6 +14,15 @@ help: consider further restricting type parameter `U`
 LL | fn foo<T,U>() where T: ExtraCopy<U>, U: std::marker::Copy
    |                                    ++++++++++++++++++++++
 
+error[E0038]: the trait `Copy` cannot be made into an object
+  --> $DIR/wf-fn-where-clause.rs:12:16
+   |
+LL | fn bar() where Vec<dyn Copy>:, {}
+   |                ^^^^^^^^^^^^^ `Copy` cannot be made into an object
+   |
+   = note: the trait cannot be made into an object because it requires `Self: Sized`
+   = note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
+
 error[E0277]: the size for values of type `(dyn Copy + 'static)` cannot be known at compilation time
   --> $DIR/wf-fn-where-clause.rs:12:16
    |
@@ -34,15 +43,6 @@ LL | struct Vec<T> {
 LL |     t: T,
    |        - ...if indirection were used here: `Box<T>`
 
-error[E0038]: the trait `Copy` cannot be made into an object
-  --> $DIR/wf-fn-where-clause.rs:12:16
-   |
-LL | fn bar() where Vec<dyn Copy>:, {}
-   |                ^^^^^^^^^^^^^ `Copy` cannot be made into an object
-   |
-   = note: the trait cannot be made into an object because it requires `Self: Sized`
-   = note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
-
 error: aborting due to 3 previous errors
 
 Some errors have detailed explanations: E0038, E0277.