From f5dc3886b36008b635df1f1f61335d6eaaf5bfe5 Mon Sep 17 00:00:00 2001 From: Esteban Kuber Date: Tue, 5 Oct 2021 23:04:09 +0000 Subject: [PATCH] Point at source of trait bound obligations in more places Be more thorough in using `ItemObligation` and `BindingObligation` when evaluating obligations so that we can point at trait bounds that introduced unfulfilled obligations. We no longer incorrectly point at unrelated trait bounds (`substs-ppaux.verbose.stderr`). In particular, we now point at trait bounds on method calls. We no longer point at "obvious" obligation sources (we no longer have a note pointing at `Trait` saying "required by a bound in `Trait`", like in `associated-types-no-suitable-supertrait*`). Address part of #89418. --- .../src/infer/error_reporting/mod.rs | 15 ++++-- .../nice_region_error/static_impl_trait.rs | 6 ++- .../rustc_trait_selection/src/traits/util.rs | 19 +++++--- .../rustc_trait_selection/src/traits/wf.rs | 7 ++- .../rustc_typeck/src/check/compare_method.rs | 13 +++--- .../rustc_typeck/src/check/fn_ctxt/_impl.rs | 46 ++----------------- .../rustc_typeck/src/check/fn_ctxt/checks.rs | 5 +- .../rustc_typeck/src/check/method/confirm.rs | 24 +++++++--- compiler/rustc_typeck/src/collect.rs | 16 +++---- .../bad-bounds-on-assoc-in-trait.stderr | 29 ------------ .../bounds-on-assoc-in-trait.stderr | 22 --------- .../associated-types-for-unimpl-trait.stderr | 5 -- .../associated-types-no-suitable-bound.stderr | 5 -- ...ated-types-no-suitable-supertrait-2.stderr | 5 -- ...ciated-types-no-suitable-supertrait.stderr | 11 ----- ...ted-trait-in-method-without-default.stderr | 5 -- .../async-await/pin-needed-to-poll-2.stderr | 6 +-- src/test/ui/box/into-boxed-slice-fail.stderr | 12 ++--- src/test/ui/chalkify/type_wf.stderr | 6 +-- src/test/ui/closures/closure-expected.stderr | 5 ++ .../closures/coerce-unsafe-to-closure.stderr | 5 ++ .../coherence-overlap-trait-alias.stderr | 5 -- .../issue-72787.min.stderr | 10 ---- .../generic_const_exprs/issue-83765.stderr | 5 ++ .../occurs-check/unused-substs-1.stderr | 10 ++-- ...rives-span-Hash-enum-struct-variant.stderr | 4 +- .../ui/derives/derives-span-Hash-enum.stderr | 4 +- .../derives/derives-span-Hash-struct.stderr | 4 +- .../derives-span-Hash-tuple-struct.stderr | 4 +- ...e-21659-show-relevant-trait-impls-1.stderr | 5 ++ ...e-21659-show-relevant-trait-impls-2.stderr | 5 ++ src/test/ui/error-codes/E0275.stderr | 5 -- src/test/ui/error-codes/E0283.stderr | 5 ++ .../ruby_style_closure.stderr | 5 ++ ...feature-gate-associated_type_bounds.stderr | 7 --- .../issue-86483.stderr | 3 +- src/test/ui/hrtb/issue-62203-hrtb-ice.stderr | 26 +++++++++-- src/test/ui/inference/issue-71732.stderr | 9 ++++ src/test/ui/issues/issue-17651.stderr | 6 +-- src/test/ui/issues/issue-18400.stderr | 5 ++ src/test/ui/issues/issue-18611.stderr | 6 --- src/test/ui/issues/issue-20162.stderr | 6 +++ src/test/ui/issues/issue-20413.stderr | 30 ------------ src/test/ui/issues/issue-21160.stderr | 4 +- src/test/ui/issues/issue-21974.stderr | 5 -- src/test/ui/issues/issue-23966.stderr | 5 ++ src/test/ui/issues/issue-24424.stderr | 5 -- src/test/ui/issues/issue-31173.rs | 2 - src/test/ui/issues/issue-31173.stderr | 13 ++++-- src/test/ui/issues/issue-33941.stderr | 11 +++-- src/test/ui/issues/issue-34334.stderr | 5 ++ src/test/ui/issues/issue-47706-trait.stderr | 6 +++ src/test/ui/issues/issue-47706.stderr | 6 +++ src/test/ui/issues/issue-54954.stderr | 6 +-- ...e-66923-show-error-for-correct-call.stderr | 10 ++++ src/test/ui/issues/issue-69455.stderr | 5 ++ src/test/ui/issues/issue-69683.stderr | 8 ++++ src/test/ui/issues/issue-72690.stderr | 45 ++++++++++++++++++ src/test/ui/lifetimes/issue-34979.stderr | 5 -- .../marker_trait_attr/region-overlap.stderr | 10 ---- ...od-ambig-one-trait-unknown-int-type.stderr | 5 ++ .../mismatched_types/closure-arg-count.stderr | 24 ++++++++++ .../closure-arg-type-mismatch.stderr | 18 ++++++++ .../ui/mismatched_types/issue-36053-2.stderr | 6 +++ src/test/ui/not-clone-closure.stderr | 5 ++ ...ions-bounded-method-type-parameters.stderr | 6 ++- .../regions-close-object-into-object-5.stderr | 8 +++- .../const-and-non-const-impl.stderr | 33 ------------- .../const-drop-fail.precise.stderr | 6 +-- .../const-drop-fail.stock.stderr | 6 +-- .../trait-where-clause.stderr | 24 +++++----- src/test/ui/specialization/issue-39448.stderr | 5 ++ src/test/ui/str/str-idx.stderr | 10 ++++ src/test/ui/str/str-mut-idx.stderr | 10 ++++ .../structs/struct-path-alias-bounds.stderr | 6 +-- src/test/ui/substs-ppaux.normal.stderr | 6 +-- src/test/ui/substs-ppaux.verbose.stderr | 6 +-- .../expected-boxed-future-isnt-pinned.stderr | 12 ++--- src/test/ui/suggestions/issue-62843.stderr | 5 ++ .../issue-71394-no-from-impl.stderr | 5 ++ src/test/ui/suggestions/issue-84973.stderr | 9 ++-- .../missing-lifetimes-in-signature-2.stderr | 7 ++- .../mut-borrow-needed-by-trait.stderr | 6 +-- .../ui/suggestions/suggest-change-mut.stderr | 6 +-- .../ui/traits/bad-method-typaram-kind.stderr | 5 ++ src/test/ui/traits/bad-sized.stderr | 6 +-- .../bound/on-structs-and-enums-locals.stderr | 6 +-- .../bound/on-structs-and-enums-xc1.stderr | 6 +-- .../repeated-supertrait-ambig.stderr | 16 +++++++ src/test/ui/traits/issue-77982.stderr | 24 ++++++++++ src/test/ui/traits/issue-85735.stderr | 9 ---- .../negated-auto-traits-error.stderr | 6 +-- src/test/ui/traits/test-2.stderr | 10 ++++ .../ui/traits/vtable-res-trait-param.stderr | 6 +++ .../ui/type/type-check/issue-40294.stderr | 5 -- .../ui/union/union-generic.mirunsafeck.stderr | 12 ++--- .../union/union-generic.thirunsafeck.stderr | 12 ++--- src/test/ui/unsized/issue-71659.stderr | 9 ++++ src/test/ui/wf/wf-foreign-fn-decl-ret.stderr | 6 --- .../where-clause-method-substituion.stderr | 6 +++ .../where-clauses-method-unsatisfied.stderr | 6 +++ 101 files changed, 550 insertions(+), 421 deletions(-) diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index c25ec1356e230..5f4d16fa8b9ac 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -2113,10 +2113,19 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { None }, self.tcx.generics_of(owner.to_def_id()), + hir.span(hir_id), ) }); + + let span = match generics { + // This is to get around the trait identity obligation, that has a `DUMMY_SP` as signal + // for other diagnostics, so we need to recover it here. + Some((_, _, node)) if span.is_dummy() => node, + _ => span, + }; + let type_param_span = match (generics, bound_kind) { - (Some((_, ref generics)), GenericKind::Param(ref param)) => { + (Some((_, ref generics, _)), GenericKind::Param(ref param)) => { // Account for the case where `param` corresponds to `Self`, // which doesn't have the expected type argument. if !(generics.has_self && param.index == 0) { @@ -2153,7 +2162,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { }; let new_lt = generics .as_ref() - .and_then(|(parent_g, g)| { + .and_then(|(parent_g, g, _)| { let mut possible = (b'a'..=b'z').map(|c| format!("'{}", c as char)); let mut lts_names = g .params @@ -2175,7 +2184,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { .unwrap_or("'lt".to_string()); let add_lt_sugg = generics .as_ref() - .and_then(|(_, g)| g.params.first()) + .and_then(|(_, g, _)| g.params.first()) .and_then(|param| param.def_id.as_local()) .map(|def_id| { ( diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs index c6ccd9b60a9c4..2aaebed28ced7 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs @@ -192,14 +192,16 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { ObligationCauseCode::MatchImpl(parent, ..) => &parent.code, _ => &cause.code, }; - if let ObligationCauseCode::ItemObligation(item_def_id) = *code { + if let (ObligationCauseCode::ItemObligation(item_def_id), None) = + (code, override_error_code) + { // Same case of `impl Foo for dyn Bar { fn qux(&self) {} }` introducing a `'static` // lifetime as above, but called using a fully-qualified path to the method: // `Foo::qux(bar)`. let mut v = TraitObjectVisitor(FxHashSet::default()); v.visit_ty(param.param_ty); if let Some((ident, self_ty)) = - self.get_impl_ident_and_self_ty_from_trait(item_def_id, &v.0) + self.get_impl_ident_and_self_ty_from_trait(*item_def_id, &v.0) { if self.suggest_constrain_dyn_trait_in_impl(&mut err, &v.0, ident, self_ty) { override_error_code = Some(ident); diff --git a/compiler/rustc_trait_selection/src/traits/util.rs b/compiler/rustc_trait_selection/src/traits/util.rs index ed49abbbedc92..6d2323abba465 100644 --- a/compiler/rustc_trait_selection/src/traits/util.rs +++ b/compiler/rustc_trait_selection/src/traits/util.rs @@ -9,7 +9,9 @@ use rustc_middle::ty::subst::{GenericArg, Subst, SubstsRef}; use rustc_middle::ty::{self, ToPredicate, Ty, TyCtxt, TypeFoldable, WithConstness}; use super::{Normalized, Obligation, ObligationCause, PredicateObligation, SelectionContext}; -pub use rustc_infer::traits::util::*; +pub use rustc_infer::traits::{self, util::*}; + +use std::iter; /////////////////////////////////////////////////////////////////////////// // `TraitAliasExpander` iterator @@ -229,11 +231,16 @@ pub fn predicates_for_generics<'tcx>( ) -> impl Iterator> { debug!("predicates_for_generics(generic_bounds={:?})", generic_bounds); - generic_bounds.predicates.into_iter().map(move |predicate| Obligation { - cause: cause.clone(), - recursion_depth, - param_env, - predicate, + iter::zip(generic_bounds.predicates, generic_bounds.spans).map(move |(predicate, span)| { + let cause = match cause.code { + traits::ItemObligation(def_id) if !span.is_dummy() => traits::ObligationCause::new( + cause.span, + cause.body_id, + traits::BindingObligation(def_id, span), + ), + _ => cause.clone(), + }; + Obligation { cause, recursion_depth, param_env, predicate } }) } diff --git a/compiler/rustc_trait_selection/src/traits/wf.rs b/compiler/rustc_trait_selection/src/traits/wf.rs index cb47ba9c360da..2a66684e2a2a0 100644 --- a/compiler/rustc_trait_selection/src/traits/wf.rs +++ b/compiler/rustc_trait_selection/src/traits/wf.rs @@ -709,7 +709,12 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> { iter::zip(iter::zip(predicates.predicates, predicates.spans), origins.into_iter().rev()) .map(|((pred, span), origin_def_id)| { - let cause = self.cause(traits::BindingObligation(origin_def_id, span)); + let code = if span.is_dummy() { + traits::MiscObligation + } else { + traits::BindingObligation(origin_def_id, span) + }; + let cause = self.cause(code); traits::Obligation::with_depth(cause, self.recursion_depth, self.param_env, pred) }) .filter(|pred| !pred.has_escaping_bound_vars()) diff --git a/compiler/rustc_typeck/src/check/compare_method.rs b/compiler/rustc_typeck/src/check/compare_method.rs index cbfd8747ecf00..cce3e41e333ea 100644 --- a/compiler/rustc_typeck/src/check/compare_method.rs +++ b/compiler/rustc_typeck/src/check/compare_method.rs @@ -1391,12 +1391,13 @@ pub fn check_type_bounds<'tcx>( let impl_ty_hir_id = tcx.hir().local_def_id_to_hir_id(impl_ty.def_id.expect_local()); let normalize_cause = traits::ObligationCause::misc(impl_ty_span, impl_ty_hir_id); - let mk_cause = |span| { - ObligationCause::new( - impl_ty_span, - impl_ty_hir_id, - ObligationCauseCode::BindingObligation(trait_ty.def_id, span), - ) + let mk_cause = |span: Span| { + let code = if span.is_dummy() { + traits::MiscObligation + } else { + traits::BindingObligation(trait_ty.def_id, span) + }; + ObligationCause::new(impl_ty_span, impl_ty_hir_id, code) }; let obligations = tcx diff --git a/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs b/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs index aae59eee99142..142a0a8fc2501 100644 --- a/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs +++ b/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs @@ -586,38 +586,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } - /// Given a fully substituted set of bounds (`generic_bounds`), and the values with which each - /// type/region parameter was instantiated (`substs`), creates and registers suitable - /// trait/region obligations. - /// - /// For example, if there is a function: - /// - /// ``` - /// fn foo<'a,T:'a>(...) - /// ``` - /// - /// and a reference: - /// - /// ``` - /// let f = foo; - /// ``` - /// - /// Then we will create a fresh region variable `'$0` and a fresh type variable `$1` for `'a` - /// and `T`. This routine will add a region obligation `$1:'$0` and register it locally. - pub fn add_obligations_for_parameters( - &self, - cause: traits::ObligationCause<'tcx>, - predicates: ty::InstantiatedPredicates<'tcx>, - ) { - assert!(!predicates.has_escaping_bound_vars()); - - debug!("add_obligations_for_parameters(predicates={:?})", predicates); - - for obligation in traits::predicates_for_generics(cause, self.param_env, predicates) { - self.register_predicate(obligation); - } - } - // FIXME(arielb1): use this instead of field.ty everywhere // Only for fields! Returns for methods> // Indifferent to privacy flags @@ -1522,20 +1490,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { /// Add all the obligations that are required, substituting and normalized appropriately. #[tracing::instrument(level = "debug", skip(self, span, def_id, substs))] - fn add_required_obligations(&self, span: Span, def_id: DefId, substs: &SubstsRef<'tcx>) { - let (bounds, spans) = self.instantiate_bounds(span, def_id, &substs); + crate fn add_required_obligations(&self, span: Span, def_id: DefId, substs: &SubstsRef<'tcx>) { + let (bounds, _) = self.instantiate_bounds(span, def_id, &substs); - for (i, mut obligation) in traits::predicates_for_generics( + for obligation in traits::predicates_for_generics( traits::ObligationCause::new(span, self.body_id, traits::ItemObligation(def_id)), self.param_env, bounds, - ) - .enumerate() - { - // This makes the error point at the bound, but we want to point at the argument - if let Some(span) = spans.get(i) { - obligation.cause.make_mut().code = traits::BindingObligation(def_id, *span); - } + ) { self.register_predicate(obligation); } } diff --git a/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs b/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs index 7d9483201f6a5..a119a6838b8d2 100644 --- a/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs +++ b/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs @@ -509,10 +509,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.write_user_type_annotation_from_substs(hir_id, did, substs, None); // Check bounds on type arguments used in the path. - let (bounds, _) = self.instantiate_bounds(path_span, did, substs); - let cause = - traits::ObligationCause::new(path_span, self.body_id, traits::ItemObligation(did)); - self.add_obligations_for_parameters(cause, bounds); + self.add_required_obligations(path_span, did, substs); Some((variant, ty)) } else { diff --git a/compiler/rustc_typeck/src/check/method/confirm.rs b/compiler/rustc_typeck/src/check/method/confirm.rs index e7e4e72f6c1d9..dabfe92190b33 100644 --- a/compiler/rustc_typeck/src/check/method/confirm.rs +++ b/compiler/rustc_typeck/src/check/method/confirm.rs @@ -120,7 +120,12 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> { // We won't add these if we encountered an illegal sized bound, so that we can use // a custom error in that case. if illegal_sized_bound.is_none() { - self.add_obligations(self.tcx.mk_fn_ptr(method_sig), all_substs, method_predicates); + self.add_obligations( + self.tcx.mk_fn_ptr(method_sig), + all_substs, + method_predicates, + pick.item.def_id, + ); } // Create the final `MethodCallee`. @@ -471,16 +476,23 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> { fty: Ty<'tcx>, all_substs: SubstsRef<'tcx>, method_predicates: ty::InstantiatedPredicates<'tcx>, + def_id: DefId, ) { debug!( - "add_obligations: fty={:?} all_substs={:?} method_predicates={:?}", - fty, all_substs, method_predicates + "add_obligations: fty={:?} all_substs={:?} method_predicates={:?} def_id={:?}", + fty, all_substs, method_predicates, def_id ); - self.add_obligations_for_parameters( - traits::ObligationCause::misc(self.span, self.body_id), + // FIXME: could replace with the following, but we already calculated `method_predicates`, + // so we just call `predicates_for_generics` directly to avoid redoing work. + // `self.add_required_obligations(self.span, def_id, &all_substs);` + for obligation in traits::predicates_for_generics( + traits::ObligationCause::new(self.span, self.body_id, traits::ItemObligation(def_id)), + self.param_env, method_predicates, - ); + ) { + self.register_predicate(obligation); + } // this is a projection from a trait reference, so we have to // make sure that the trait reference inputs are well-formed. diff --git a/compiler/rustc_typeck/src/collect.rs b/compiler/rustc_typeck/src/collect.rs index 2f427305782c5..51e1669ef5a35 100644 --- a/compiler/rustc_typeck/src/collect.rs +++ b/compiler/rustc_typeck/src/collect.rs @@ -1990,16 +1990,12 @@ fn predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicates<'_> { // prove that the trait applies to the types that were // used, and adding the predicate into this list ensures // that this is done. - let mut span = tcx.def_span(def_id); - if tcx.sess.source_map().is_local_span(span) { - // `guess_head_span` reads the actual source file from - // disk to try to determine the 'head' snippet of the span. - // Don't do this for a span that comes from a file outside - // of our crate, since this would make our query output - // (and overall crate metadata) dependent on the - // *current* state of an external file. - span = tcx.sess.source_map().guess_head_span(span); - } + // + // We use a DUMMY_SP here as a way to signal trait bounds that come + // from the trait itself that *shouldn't* be shown as the source of + // an obligation and instead be skipped. Otherwise we'd use + // `tcx.def_span(def_id);` + let span = rustc_span::DUMMY_SP; result.predicates = tcx.arena.alloc_from_iter(result.predicates.iter().copied().chain(std::iter::once(( ty::TraitRef::identity(tcx, def_id).without_const().to_predicate(tcx), diff --git a/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr b/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr index 57aacf67e05fd..4ecae471ec2da 100644 --- a/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr +++ b/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr @@ -5,13 +5,6 @@ LL | type C: Clone + Iterator Lam<&'a u8 | ^^^^ `<::C as Iterator>::Item` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `<::C as Iterator>::Item` -note: required by a bound in `Send` - --> $SRC_DIR/core/src/marker.rs:LL:COL - | -LL | / pub unsafe auto trait Send { -LL | | // empty. -LL | | } - | |_^ required by this bound in `Send` help: consider further restricting the associated type | LL | trait Case1 where <::C as Iterator>::Item: Send { @@ -24,17 +17,6 @@ LL | type C: Clone + Iterator Lam<&'a u8 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `<::C as Iterator>::Item` is not an iterator | = help: the trait `Iterator` is not implemented for `<::C as Iterator>::Item` -note: required by a bound in `Iterator` - --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | / pub trait Iterator { -LL | | /// The type of the elements being iterated over. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Item; -... | -LL | | } -LL | | } - | |_^ required by this bound in `Iterator` help: consider further restricting the associated type | LL | trait Case1 where <::C as Iterator>::Item: Iterator { @@ -47,17 +29,6 @@ LL | type C: Clone + Iterator Lam<&'a u8 | ^^^^ `<::C as Iterator>::Item` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `<::C as Iterator>::Item` -note: required by a bound in `Sync` - --> $SRC_DIR/core/src/marker.rs:LL:COL - | -LL | / pub unsafe auto trait Sync { -LL | | // FIXME(estebank): once support to add notes in `rustc_on_unimplemented` -LL | | // lands in beta, and it has been extended to check whether a closure is -LL | | // anywhere in the requirement chain, extend it as such (#48534): -... | -LL | | // Empty -LL | | } - | |_^ required by this bound in `Sync` help: consider further restricting the associated type | LL | trait Case1 where <::C as Iterator>::Item: Sync { diff --git a/src/test/ui/associated-type-bounds/bounds-on-assoc-in-trait.stderr b/src/test/ui/associated-type-bounds/bounds-on-assoc-in-trait.stderr index 4da5a2cbd41a6..4e2313bd4e4a9 100644 --- a/src/test/ui/associated-type-bounds/bounds-on-assoc-in-trait.stderr +++ b/src/test/ui/associated-type-bounds/bounds-on-assoc-in-trait.stderr @@ -5,17 +5,6 @@ LL | type A: Iterator; | ^^^^^ `<::A as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = help: the trait `Debug` is not implemented for `<::A as Iterator>::Item` -note: required by a bound in `Debug` - --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL - | -LL | / pub trait Debug { -LL | | /// Formats the value using the given formatter. -LL | | /// -LL | | /// # Examples -... | -LL | | fn fmt(&self, f: &mut Formatter<'_>) -> Result; -LL | | } - | |_^ required by this bound in `Debug` help: consider further restricting the associated type | LL | trait Case1 where <::A as Iterator>::Item: Debug { @@ -27,17 +16,6 @@ error[E0277]: the trait bound `<::Out as Baz>::Assoc: Default` is n LL | pub trait Foo { type Out: Baz; } | ^^^^^^^ the trait `Default` is not implemented for `<::Out as Baz>::Assoc` | -note: required by a bound in `Default` - --> $SRC_DIR/core/src/default.rs:LL:COL - | -LL | / pub trait Default: Sized { -LL | | /// Returns the "default value" for a type. -LL | | /// -LL | | /// Default values are often some kind of initial value, identity value, or anything else that -... | -LL | | fn default() -> Self; -LL | | } - | |_^ required by this bound in `Default` help: consider further restricting the associated type | LL | pub trait Foo where <::Out as Baz>::Assoc: Default { type Out: Baz; } diff --git a/src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr b/src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr index 92c963a9ef9f2..6552c8be78089 100644 --- a/src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr +++ b/src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr @@ -4,11 +4,6 @@ error[E0277]: the trait bound `Self: Get` is not satisfied LL | fn uhoh(&self, foo: U, bar: ::Value) {} | ^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` | -note: required by a bound in `Get` - --> $DIR/associated-types-for-unimpl-trait.rs:4:1 - | -LL | trait Get { - | ^^^^^^^^^ required by this bound in `Get` help: consider further restricting `Self` | LL | fn uhoh(&self, foo: U, bar: ::Value) where Self: Get {} diff --git a/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr b/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr index 509d548c69df0..b2ee1b5e6d045 100644 --- a/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr +++ b/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr @@ -4,11 +4,6 @@ error[E0277]: the trait bound `T: Get` is not satisfied LL | fn uhoh(foo: ::Value) {} | ^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `T` | -note: required by a bound in `Get` - --> $DIR/associated-types-no-suitable-bound.rs:1:1 - | -LL | trait Get { - | ^^^^^^^^^ required by this bound in `Get` help: consider restricting type parameter `T` | LL | fn uhoh(foo: ::Value) {} diff --git a/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr b/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr index 1cb9ac8fdefc1..2e40dbd065d3e 100644 --- a/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr +++ b/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr @@ -4,11 +4,6 @@ error[E0277]: the trait bound `Self: Get` is not satisfied LL | fn uhoh(&self, foo: U, bar: ::Value) {} | ^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` | -note: required by a bound in `Get` - --> $DIR/associated-types-no-suitable-supertrait-2.rs:12:1 - | -LL | trait Get { - | ^^^^^^^^^ required by this bound in `Get` help: consider further restricting `Self` | LL | fn uhoh(&self, foo: U, bar: ::Value) where Self: Get {} diff --git a/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr b/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr index e3185fbe9392e..da79c7ac77f9d 100644 --- a/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr +++ b/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr @@ -4,11 +4,6 @@ error[E0277]: the trait bound `Self: Get` is not satisfied LL | fn uhoh(&self, foo: U, bar: ::Value) {} | ^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` | -note: required by a bound in `Get` - --> $DIR/associated-types-no-suitable-supertrait.rs:12:1 - | -LL | trait Get { - | ^^^^^^^^^ required by this bound in `Get` help: consider further restricting `Self` | LL | fn uhoh(&self, foo: U, bar: ::Value) where Self: Get {} @@ -19,12 +14,6 @@ error[E0277]: the trait bound `(T, U): Get` is not satisfied | LL | fn uhoh(&self, foo: U, bar: <(T, U) as Get>::Value) {} | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `(T, U)` - | -note: required by a bound in `Get` - --> $DIR/associated-types-no-suitable-supertrait.rs:12:1 - | -LL | trait Get { - | ^^^^^^^^^ required by this bound in `Get` error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr b/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr index 09ec0e116175d..2e67c21940fc7 100644 --- a/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr +++ b/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr @@ -4,11 +4,6 @@ error[E0277]: the trait bound `Self: Get` is not satisfied LL | fn okay(&self, foo: U, bar: ::Value); | ^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` | -note: required by a bound in `Get` - --> $DIR/associated-types-projection-to-unrelated-trait-in-method-without-default.rs:5:1 - | -LL | trait Get { - | ^^^^^^^^^ required by this bound in `Get` help: consider further restricting `Self` | LL | fn okay(&self, foo: U, bar: ::Value) where Self: Get; diff --git a/src/test/ui/async-await/pin-needed-to-poll-2.stderr b/src/test/ui/async-await/pin-needed-to-poll-2.stderr index b63ea106d9026..83d1a02c876b1 100644 --- a/src/test/ui/async-await/pin-needed-to-poll-2.stderr +++ b/src/test/ui/async-await/pin-needed-to-poll-2.stderr @@ -12,11 +12,11 @@ note: required because it appears within the type `Sleep` | LL | struct Sleep(std::marker::PhantomPinned); | ^^^^^ -note: required by `Pin::

::new` +note: required by a bound in `Pin::

::new` --> $SRC_DIR/core/src/pin.rs:LL:COL | -LL | pub const fn new(pointer: P) -> Pin

{ - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl> Pin

{ + | ^^^^^ required by this bound in `Pin::

::new` error: aborting due to previous error diff --git a/src/test/ui/box/into-boxed-slice-fail.stderr b/src/test/ui/box/into-boxed-slice-fail.stderr index 2f1dec9d2090c..de654fdc1a4b5 100644 --- a/src/test/ui/box/into-boxed-slice-fail.stderr +++ b/src/test/ui/box/into-boxed-slice-fail.stderr @@ -7,11 +7,11 @@ LL | let _ = Box::into_boxed_slice(boxed_slice); | required by a bound introduced by this call | = help: the trait `Sized` is not implemented for `[u8]` -note: required by `Box::::into_boxed_slice` +note: required by a bound in `Box::::into_boxed_slice` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL | -LL | pub fn into_boxed_slice(boxed: Self) -> Box<[T], A> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl Box { + | ^ required by this bound in `Box::::into_boxed_slice` error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> $DIR/into-boxed-slice-fail.rs:7:13 @@ -31,11 +31,11 @@ LL | let _ = Box::into_boxed_slice(boxed_trait); | required by a bound introduced by this call | = help: the trait `Sized` is not implemented for `dyn Debug` -note: required by `Box::::into_boxed_slice` +note: required by a bound in `Box::::into_boxed_slice` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL | -LL | pub fn into_boxed_slice(boxed: Self) -> Box<[T], A> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl Box { + | ^ required by this bound in `Box::::into_boxed_slice` error[E0277]: the size for values of type `dyn Debug` cannot be known at compilation time --> $DIR/into-boxed-slice-fail.rs:11:13 diff --git a/src/test/ui/chalkify/type_wf.stderr b/src/test/ui/chalkify/type_wf.stderr index ebd885a7d323f..57902efa2015c 100644 --- a/src/test/ui/chalkify/type_wf.stderr +++ b/src/test/ui/chalkify/type_wf.stderr @@ -7,11 +7,11 @@ LL | let s = S { = help: the following implementations were found: as Foo> -note: required by `S` - --> $DIR/type_wf.rs:6:1 +note: required by a bound in `S` + --> $DIR/type_wf.rs:6:13 | LL | struct S { - | ^^^^^^^^^^^^^^^^ + | ^^^ required by this bound in `S` error: aborting due to previous error diff --git a/src/test/ui/closures/closure-expected.stderr b/src/test/ui/closures/closure-expected.stderr index d4f230780436e..8b38d5ff4592c 100644 --- a/src/test/ui/closures/closure-expected.stderr +++ b/src/test/ui/closures/closure-expected.stderr @@ -8,6 +8,11 @@ LL | let y = x.or_else(4); | = help: the trait `FnOnce<()>` is not implemented for `{integer}` = note: wrap the `{integer}` in a closure with no arguments: `|| { /* code */ }` +note: required by a bound in `Option::::or_else` + --> $SRC_DIR/core/src/option.rs:LL:COL + | +LL | pub fn or_else Option>(self, f: F) -> Option { + | ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Option::::or_else` error: aborting due to previous error diff --git a/src/test/ui/closures/coerce-unsafe-to-closure.stderr b/src/test/ui/closures/coerce-unsafe-to-closure.stderr index 4a47e0549155f..24db272534730 100644 --- a/src/test/ui/closures/coerce-unsafe-to-closure.stderr +++ b/src/test/ui/closures/coerce-unsafe-to-closure.stderr @@ -7,6 +7,11 @@ LL | let x: Option<&[u8]> = Some("foo").map(std::mem::transmute); | required by a bound introduced by this call | = help: the trait `FnOnce<(&str,)>` is not implemented for `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}` +note: required by a bound in `Option::::map` + --> $SRC_DIR/core/src/option.rs:LL:COL + | +LL | pub fn map U>(self, f: F) -> Option { + | ^^^^^^^^^^^^^^ required by this bound in `Option::::map` error: aborting due to previous error diff --git a/src/test/ui/coherence/coherence-overlap-trait-alias.stderr b/src/test/ui/coherence/coherence-overlap-trait-alias.stderr index affc58b84d46d..5b389f24bf151 100644 --- a/src/test/ui/coherence/coherence-overlap-trait-alias.stderr +++ b/src/test/ui/coherence/coherence-overlap-trait-alias.stderr @@ -12,11 +12,6 @@ LL | impl C for T {} LL | #[rustc_strict_coherence] LL | impl C for u32 {} | ^^^^^^^^^^^^^^ -note: required by a bound in `C` - --> $DIR/coherence-overlap-trait-alias.rs:11:1 - | -LL | trait C {} - | ^^^^^^^ required by this bound in `C` error: aborting due to previous error diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-72787.min.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-72787.min.stderr index 3c7a740e8434a..02dce4f7a97e8 100644 --- a/src/test/ui/const-generics/generic_const_exprs/issue-72787.min.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/issue-72787.min.stderr @@ -41,11 +41,6 @@ LL | IsLessOrEqual: True, | ^^^^ cannot infer type for struct `IsLessOrEqual` | = note: cannot satisfy `IsLessOrEqual: True` -note: required by a bound in `True` - --> $DIR/issue-72787.rs:8:1 - | -LL | pub trait True {} - | ^^^^^^^^^^^^^^ required by this bound in `True` error[E0283]: type annotations needed --> $DIR/issue-72787.rs:21:26 @@ -54,11 +49,6 @@ LL | IsLessOrEqual: True, | ^^^^ cannot infer type for struct `IsLessOrEqual` | = note: cannot satisfy `IsLessOrEqual: True` -note: required by a bound in `True` - --> $DIR/issue-72787.rs:8:1 - | -LL | pub trait True {} - | ^^^^^^^^^^^^^^ required by this bound in `True` error: aborting due to 6 previous errors diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-83765.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-83765.stderr index ef785bf07ebbf..0332e82fe0727 100644 --- a/src/test/ui/const-generics/generic_const_exprs/issue-83765.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/issue-83765.stderr @@ -14,6 +14,11 @@ LL | self.reference.size() | ^^^^ | = help: try adding a `where` bound using this expression: `where [(); Self::DIM]:` +note: required by a bound in `TensorSize::size` + --> $DIR/issue-83765.rs:9:31 + | +LL | fn size(&self) -> [usize; Self::DIM]; + | ^^^^^^^^^ required by this bound in `TensorSize::size` error[E0308]: mismatched types --> $DIR/issue-83765.rs:32:9 diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-1.stderr b/src/test/ui/const-generics/occurs-check/unused-substs-1.stderr index 382dd0ee5a64e..486a298a9ffe5 100644 --- a/src/test/ui/const-generics/occurs-check/unused-substs-1.stderr +++ b/src/test/ui/const-generics/occurs-check/unused-substs-1.stderr @@ -6,13 +6,11 @@ LL | let _ = A; | = help: the following implementations were found: as Bar> -note: required by `A` - --> $DIR/unused-substs-1.rs:7:1 +note: required by a bound in `A` + --> $DIR/unused-substs-1.rs:9:11 | -LL | / struct A -LL | | where -LL | | A: Bar; - | |_________________^ +LL | A: Bar; + | ^^^^^^ required by this bound in `A` error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr index 47c7f1c2c3340..af4576b7a17a2 100644 --- a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr @@ -7,11 +7,11 @@ LL | #[derive(Hash)] LL | x: Error | ^^^^^^^^ the trait `Hash` is not implemented for `Error` | -note: required by a bound in `std::hash::Hash::hash` +note: required by `std::hash::Hash::hash` --> $SRC_DIR/core/src/hash/mod.rs:LL:COL | LL | fn hash(&self, state: &mut H); - | ^ required by this bound in `std::hash::Hash::hash` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Hash-enum.stderr b/src/test/ui/derives/derives-span-Hash-enum.stderr index 92f084b58e35b..e4e507be2f24c 100644 --- a/src/test/ui/derives/derives-span-Hash-enum.stderr +++ b/src/test/ui/derives/derives-span-Hash-enum.stderr @@ -7,11 +7,11 @@ LL | #[derive(Hash)] LL | Error | ^^^^^ the trait `Hash` is not implemented for `Error` | -note: required by a bound in `std::hash::Hash::hash` +note: required by `std::hash::Hash::hash` --> $SRC_DIR/core/src/hash/mod.rs:LL:COL | LL | fn hash(&self, state: &mut H); - | ^ required by this bound in `std::hash::Hash::hash` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Hash-struct.stderr b/src/test/ui/derives/derives-span-Hash-struct.stderr index c57cebe04ebcb..401df39155d0c 100644 --- a/src/test/ui/derives/derives-span-Hash-struct.stderr +++ b/src/test/ui/derives/derives-span-Hash-struct.stderr @@ -7,11 +7,11 @@ LL | struct Struct { LL | x: Error | ^^^^^^^^ the trait `Hash` is not implemented for `Error` | -note: required by a bound in `std::hash::Hash::hash` +note: required by `std::hash::Hash::hash` --> $SRC_DIR/core/src/hash/mod.rs:LL:COL | LL | fn hash(&self, state: &mut H); - | ^ required by this bound in `std::hash::Hash::hash` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr b/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr index 200937f0c9fc3..ec92a1360fd0c 100644 --- a/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr @@ -7,11 +7,11 @@ LL | struct Struct( LL | Error | ^^^^^ the trait `Hash` is not implemented for `Error` | -note: required by a bound in `std::hash::Hash::hash` +note: required by `std::hash::Hash::hash` --> $SRC_DIR/core/src/hash/mod.rs:LL:COL | LL | fn hash(&self, state: &mut H); - | ^ required by this bound in `std::hash::Hash::hash` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr index 8aedb4229e6d3..44504aeb07c55 100644 --- a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr +++ b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr @@ -7,6 +7,11 @@ LL | f1.foo(1usize); = help: the following implementations were found: > > +note: required by `Foo::foo` + --> $DIR/issue-21659-show-relevant-trait-impls-1.rs:2:5 + | +LL | fn foo(&self, a: A) -> A { + | ^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr index d6d5ce4d1a7d2..c0553a37313b0 100644 --- a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr +++ b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr @@ -10,6 +10,11 @@ LL | f1.foo(1usize); > > and 2 others +note: required by `Foo::foo` + --> $DIR/issue-21659-show-relevant-trait-impls-2.rs:2:5 + | +LL | fn foo(&self, a: A) -> A { + | ^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0275.stderr b/src/test/ui/error-codes/E0275.stderr index e13f0961a18cf..dfffbb182ad31 100644 --- a/src/test/ui/error-codes/E0275.stderr +++ b/src/test/ui/error-codes/E0275.stderr @@ -12,11 +12,6 @@ LL | impl Foo for T where Bar: Foo {} | ^^^ ^ = note: 127 redundant requirements hidden = note: required because of the requirements on the impl of `Foo` for `Bar` -note: required by a bound in `Foo` - --> $DIR/E0275.rs:1:1 - | -LL | trait Foo {} - | ^^^^^^^^^ required by this bound in `Foo` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0283.stderr b/src/test/ui/error-codes/E0283.stderr index 95437bf11adec..33f966a6e6bdc 100644 --- a/src/test/ui/error-codes/E0283.stderr +++ b/src/test/ui/error-codes/E0283.stderr @@ -29,6 +29,11 @@ LL | impl Into for Impl { = note: and another `impl` found in the `core` crate: - impl Into for T where U: From; +note: required by `into` + --> $SRC_DIR/core/src/convert/mod.rs:LL:COL + | +LL | fn into(self) -> T; + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr b/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr index 14d28b59648c1..53924e24e4638 100644 --- a/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr +++ b/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr @@ -20,6 +20,11 @@ LL | | }); | |_____^ expected an `FnOnce<({integer},)>` closure, found `Option<_>` | = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>` +note: required by a bound in `Option::::and_then` + --> $SRC_DIR/core/src/option.rs:LL:COL + | +LL | pub fn and_then Option>(self, f: F) -> Option { + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Option::::and_then` error: aborting due to 2 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr b/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr index 8df5fbcc7eba2..8c5d72d7efefb 100644 --- a/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr +++ b/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr @@ -139,13 +139,6 @@ error[E0277]: the trait bound `<::A as Iterator>::Item: Copy` is n LL | type A: Iterator; | ^^^^ the trait `Copy` is not implemented for `<::A as Iterator>::Item` | -note: required by a bound in `Copy` - --> $SRC_DIR/core/src/marker.rs:LL:COL - | -LL | / pub trait Copy: Clone { -LL | | // Empty. -LL | | } - | |_^ required by this bound in `Copy` help: consider further restricting the associated type | LL | trait _Tr3 where <::A as Iterator>::Item: Copy { diff --git a/src/test/ui/generic-associated-types/issue-86483.stderr b/src/test/ui/generic-associated-types/issue-86483.stderr index d6978794e1e95..2f29cd5d9e900 100644 --- a/src/test/ui/generic-associated-types/issue-86483.stderr +++ b/src/test/ui/generic-associated-types/issue-86483.stderr @@ -11,8 +11,9 @@ LL | | { ... | LL | | LL | | } - | |_^ ...so that the type `T` will meet its required lifetime bounds... + | |_^ | + = note: ...so that the type `T` will meet its required lifetime bounds... note: ...that is required by this bound --> $DIR/issue-86483.rs:7:16 | diff --git a/src/test/ui/hrtb/issue-62203-hrtb-ice.stderr b/src/test/ui/hrtb/issue-62203-hrtb-ice.stderr index 4c5c59c22099a..5db17cb1bf4ec 100644 --- a/src/test/ui/hrtb/issue-62203-hrtb-ice.stderr +++ b/src/test/ui/hrtb/issue-62203-hrtb-ice.stderr @@ -2,12 +2,20 @@ error[E0271]: type mismatch resolving `for<'r> $DIR/issue-62203-hrtb-ice.rs:38:19 | LL | let v = Unit2.m( - | ^ expected struct `Unit4`, found associated type + | ^ expected associated type, found struct `Unit4` | - = note: expected struct `Unit4` - found associated type `<_ as Ty<'_>>::V` - = help: consider constraining the associated type `<_ as Ty<'_>>::V` to `Unit4` + = note: expected associated type `<_ as Ty<'_>>::V` + found struct `Unit4` + = help: consider constraining the associated type `<_ as Ty<'_>>::V` to `Unit4` or calling a method that returns `<_ as Ty<'_>>::V` = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html +note: required by a bound in `T1::m` + --> $DIR/issue-62203-hrtb-ice.rs:27:51 + | +LL | fn m<'a, B: Ty<'a>, F>(&self, f: F) -> Unit1 + | - required by a bound in this +LL | where +LL | F: for<'r> T0<'r, (>::V,), O = >::V>, + | ^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m` error[E0271]: type mismatch resolving `for<'r> <[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:39] as FnOnce<((&'r u8,),)>>::Output == Unit3` --> $DIR/issue-62203-hrtb-ice.rs:40:9 @@ -19,13 +27,21 @@ LL | / L { LL | | LL | | f : |x| { drop(x); Unit4 } LL | | }); - | |_________^ expected struct `Unit4`, found struct `Unit3` + | |_________^ expected struct `Unit3`, found struct `Unit4` | note: required because of the requirements on the impl of `for<'r> T0<'r, (&'r u8,)>` for `L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:39]>` --> $DIR/issue-62203-hrtb-ice.rs:17:16 | LL | impl<'a, A, T> T0<'a, A> for L | ^^^^^^^^^ ^^^^ +note: required by a bound in `T1::m` + --> $DIR/issue-62203-hrtb-ice.rs:27:12 + | +LL | fn m<'a, B: Ty<'a>, F>(&self, f: F) -> Unit1 + | - required by a bound in this +LL | where +LL | F: for<'r> T0<'r, (>::V,), O = >::V>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m` error: aborting due to 2 previous errors diff --git a/src/test/ui/inference/issue-71732.stderr b/src/test/ui/inference/issue-71732.stderr index 739847c5cd540..0369196c9108e 100644 --- a/src/test/ui/inference/issue-71732.stderr +++ b/src/test/ui/inference/issue-71732.stderr @@ -10,6 +10,15 @@ LL | .get(&"key".into()) - impl Borrow for String; - impl Borrow for T where T: ?Sized; +note: required by a bound in `HashMap::::get` + --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL + | +LL | K: Borrow, + | ^^^^^^^^^ required by this bound in `HashMap::::get` +help: consider specifying the type argument in the function call + | +LL | .get::(&"key".into()) + | +++++ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-17651.stderr b/src/test/ui/issues/issue-17651.stderr index 214477f6c60ef..efaaeeda2fab6 100644 --- a/src/test/ui/issues/issue-17651.stderr +++ b/src/test/ui/issues/issue-17651.stderr @@ -7,11 +7,11 @@ LL | (|| Box::new(*(&[0][..])))(); | required by a bound introduced by this call | = help: the trait `Sized` is not implemented for `[{integer}]` -note: required by `Box::::new` +note: required by a bound in `Box::::new` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL | -LL | pub fn new(x: T) -> Self { - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl Box { + | ^ required by this bound in `Box::::new` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-18400.stderr b/src/test/ui/issues/issue-18400.stderr index 92e0f60079f72..696ca402d11f9 100644 --- a/src/test/ui/issues/issue-18400.stderr +++ b/src/test/ui/issues/issue-18400.stderr @@ -12,6 +12,11 @@ LL | impl<'a, T, S> Set<&'a [T]> for S where | ^^^^^^^^^^^^ ^ = note: 128 redundant requirements hidden = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}` +note: required by `Set::contains` + --> $DIR/issue-18400.rs:2:5 + | +LL | fn contains(&self, _: T) -> bool; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-18611.stderr b/src/test/ui/issues/issue-18611.stderr index b702196abdf94..bd18d46223e69 100644 --- a/src/test/ui/issues/issue-18611.stderr +++ b/src/test/ui/issues/issue-18611.stderr @@ -3,12 +3,6 @@ error[E0277]: the trait bound `isize: HasState` is not satisfied | LL | fn add_state(op: ::State) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasState` is not implemented for `isize` - | -note: required by a bound in `HasState` - --> $DIR/issue-18611.rs:5:1 - | -LL | trait HasState { - | ^^^^^^^^^^^^^^ required by this bound in `HasState` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20162.stderr b/src/test/ui/issues/issue-20162.stderr index ef1eb2ea6c02c..6848c3f0d8a54 100644 --- a/src/test/ui/issues/issue-20162.stderr +++ b/src/test/ui/issues/issue-20162.stderr @@ -3,6 +3,12 @@ error[E0277]: the trait bound `X: Ord` is not satisfied | LL | b.sort(); | ^^^^ the trait `Ord` is not implemented for `X` + | +note: required by a bound in `slice::::sort` + --> $SRC_DIR/alloc/src/slice.rs:LL:COL + | +LL | T: Ord, + | ^^^ required by this bound in `slice::::sort` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20413.stderr b/src/test/ui/issues/issue-20413.stderr index 9135c5ac36af5..2935214140419 100644 --- a/src/test/ui/issues/issue-20413.stderr +++ b/src/test/ui/issues/issue-20413.stderr @@ -21,11 +21,6 @@ LL | impl Foo for T where NoData: Foo { | ^^^ ^ = note: 127 redundant requirements hidden = note: required because of the requirements on the impl of `Foo` for `NoData` -note: required by a bound in `Foo` - --> $DIR/issue-20413.rs:1:1 - | -LL | trait Foo { - | ^^^^^^^^^ required by this bound in `Foo` error[E0275]: overflow evaluating the requirement `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` --> $DIR/issue-20413.rs:8:36 @@ -41,11 +36,6 @@ LL | impl Foo for T where NoData: Foo { | ^^^ ^ = note: 127 redundant requirements hidden = note: required because of the requirements on the impl of `Foo` for `NoData` -note: required by a bound in `Foo` - --> $DIR/issue-20413.rs:1:1 - | -LL | trait Foo { - | ^^^^^^^^^ required by this bound in `Foo` error[E0275]: overflow evaluating the requirement `EvenLessData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Baz` --> $DIR/issue-20413.rs:28:42 @@ -66,11 +56,6 @@ LL | impl Baz for T where AlmostNoData: Bar { | ^^^ ^ = note: 126 redundant requirements hidden = note: required because of the requirements on the impl of `Baz` for `EvenLessData` -note: required by a bound in `Baz` - --> $DIR/issue-20413.rs:20:1 - | -LL | trait Baz { - | ^^^^^^^^^ required by this bound in `Baz` error[E0275]: overflow evaluating the requirement `EvenLessData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Baz` --> $DIR/issue-20413.rs:28:42 @@ -91,11 +76,6 @@ LL | impl Baz for T where AlmostNoData: Bar { | ^^^ ^ = note: 126 redundant requirements hidden = note: required because of the requirements on the impl of `Baz` for `EvenLessData` -note: required by a bound in `Baz` - --> $DIR/issue-20413.rs:20:1 - | -LL | trait Baz { - | ^^^^^^^^^ required by this bound in `Baz` error[E0275]: overflow evaluating the requirement `AlmostNoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Bar` --> $DIR/issue-20413.rs:36:42 @@ -116,11 +96,6 @@ LL | impl Bar for T where EvenLessData: Baz { | ^^^ ^ = note: 126 redundant requirements hidden = note: required because of the requirements on the impl of `Bar` for `AlmostNoData` -note: required by a bound in `Bar` - --> $DIR/issue-20413.rs:16:1 - | -LL | trait Bar { - | ^^^^^^^^^ required by this bound in `Bar` error[E0275]: overflow evaluating the requirement `AlmostNoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Bar` --> $DIR/issue-20413.rs:36:42 @@ -141,11 +116,6 @@ LL | impl Bar for T where EvenLessData: Baz { | ^^^ ^ = note: 126 redundant requirements hidden = note: required because of the requirements on the impl of `Bar` for `AlmostNoData` -note: required by a bound in `Bar` - --> $DIR/issue-20413.rs:16:1 - | -LL | trait Bar { - | ^^^^^^^^^ required by this bound in `Bar` error: aborting due to 7 previous errors diff --git a/src/test/ui/issues/issue-21160.stderr b/src/test/ui/issues/issue-21160.stderr index 92742b50619e0..e869180d2e686 100644 --- a/src/test/ui/issues/issue-21160.stderr +++ b/src/test/ui/issues/issue-21160.stderr @@ -6,11 +6,11 @@ LL | #[derive(Hash)] LL | struct Foo(Bar); | ^^^ the trait `Hash` is not implemented for `Bar` | -note: required by a bound in `std::hash::Hash::hash` +note: required by `std::hash::Hash::hash` --> $SRC_DIR/core/src/hash/mod.rs:LL:COL | LL | fn hash(&self, state: &mut H); - | ^ required by this bound in `std::hash::Hash::hash` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/issues/issue-21974.stderr b/src/test/ui/issues/issue-21974.stderr index 3b6663513bb5f..dfabde9abc978 100644 --- a/src/test/ui/issues/issue-21974.stderr +++ b/src/test/ui/issues/issue-21974.stderr @@ -5,11 +5,6 @@ LL | where &'a T : Foo, | ^^^ cannot infer type for reference `&'a T` | = note: cannot satisfy `&'a T: Foo` -note: required by a bound in `Foo` - --> $DIR/issue-21974.rs:6:1 - | -LL | trait Foo { - | ^^^^^^^^^ required by this bound in `Foo` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23966.stderr b/src/test/ui/issues/issue-23966.stderr index 9c87ee6104a0d..ae8233d5c76e6 100644 --- a/src/test/ui/issues/issue-23966.stderr +++ b/src/test/ui/issues/issue-23966.stderr @@ -7,6 +7,11 @@ LL | "".chars().fold(|_, _| (), ()); | required by a bound introduced by this call | = help: the trait `FnMut<(_, char)>` is not implemented for `()` +note: required by a bound in `fold` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | F: FnMut(B, Self::Item) -> B, + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `fold` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-24424.stderr b/src/test/ui/issues/issue-24424.stderr index 4896006b645da..fa59da852f901 100644 --- a/src/test/ui/issues/issue-24424.stderr +++ b/src/test/ui/issues/issue-24424.stderr @@ -5,11 +5,6 @@ LL | impl <'l0, 'l1, T0> Trait1<'l0, T0> for bool where T0 : Trait0<'l0>, T0 : T | ^^^^^^^^^^^ cannot infer type for type parameter `T0` | = note: cannot satisfy `T0: Trait0<'l0>` -note: required by a bound in `Trait0` - --> $DIR/issue-24424.rs:2:1 - | -LL | trait Trait0<'l0> {} - | ^^^^^^^^^^^^^^^^^ required by this bound in `Trait0` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-31173.rs b/src/test/ui/issues/issue-31173.rs index 40475426cff7a..48061ae54ae20 100644 --- a/src/test/ui/issues/issue-31173.rs +++ b/src/test/ui/issues/issue-31173.rs @@ -9,8 +9,6 @@ pub fn get_tok(it: &mut IntoIter) { }) .cloned() //~^ ERROR type mismatch resolving - //~| expected type `u8` - //~| found reference `&_` .collect(); //~ ERROR the method } diff --git a/src/test/ui/issues/issue-31173.stderr b/src/test/ui/issues/issue-31173.stderr index 8b7871ce31186..982b6118ce659 100644 --- a/src/test/ui/issues/issue-31173.stderr +++ b/src/test/ui/issues/issue-31173.stderr @@ -2,13 +2,18 @@ error[E0271]: type mismatch resolving `, [ --> $DIR/issue-31173.rs:10:10 | LL | .cloned() - | ^^^^^^ expected `u8`, found reference + | ^^^^^^ expected reference, found `u8` | - = note: expected type `u8` - found reference `&_` + = note: expected reference `&_` + found type `u8` +note: required by a bound in `cloned` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | Self: Sized + Iterator, + | ^^^^^^^^^^^^ required by this bound in `cloned` error[E0599]: the method `collect` exists for struct `Cloned, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>`, but its trait bounds were not satisfied - --> $DIR/issue-31173.rs:14:10 + --> $DIR/issue-31173.rs:12:10 | LL | .collect(); | ^^^^^^^ method cannot be called on `Cloned, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>` due to unsatisfied trait bounds diff --git a/src/test/ui/issues/issue-33941.stderr b/src/test/ui/issues/issue-33941.stderr index d588214f5077c..55cb7211ebda6 100644 --- a/src/test/ui/issues/issue-33941.stderr +++ b/src/test/ui/issues/issue-33941.stderr @@ -2,10 +2,15 @@ error[E0271]: type mismatch resolving ` $DIR/issue-33941.rs:4:36 | LL | for _ in HashMap::new().iter().cloned() {} - | ^^^^^^ expected tuple, found reference + | ^^^^^^ expected reference, found tuple | - = note: expected tuple `(&_, &_)` - found reference `&_` + = note: expected reference `&_` + found tuple `(&_, &_)` +note: required by a bound in `cloned` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | Self: Sized + Iterator, + | ^^^^^^^^^^^^ required by this bound in `cloned` error[E0271]: type mismatch resolving ` as Iterator>::Item == &_` --> $DIR/issue-33941.rs:4:14 diff --git a/src/test/ui/issues/issue-34334.stderr b/src/test/ui/issues/issue-34334.stderr index acb44ce2c3545..49d6709a86017 100644 --- a/src/test/ui/issues/issue-34334.stderr +++ b/src/test/ui/issues/issue-34334.stderr @@ -14,6 +14,11 @@ LL | let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_rece | ^^^^^^^ value of type `Vec<(u32, _, _)>` cannot be built from `std::iter::Iterator` | = help: the trait `FromIterator<()>` is not implemented for `Vec<(u32, _, _)>` +note: required by a bound in `collect` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | fn collect>(self) -> B + | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-47706-trait.stderr b/src/test/ui/issues/issue-47706-trait.stderr index 2e542644b70d4..eb0c80f8f0d1e 100644 --- a/src/test/ui/issues/issue-47706-trait.stderr +++ b/src/test/ui/issues/issue-47706-trait.stderr @@ -7,6 +7,12 @@ LL | None::<()>.map(Self::f); | --- ^^^^^^^ expected function that takes a single 0-tuple as argument | | | required by a bound introduced by this call + | +note: required by a bound in `Option::::map` + --> $SRC_DIR/core/src/option.rs:LL:COL + | +LL | pub fn map U>(self, f: F) -> Option { + | ^^^^^^^^^^^^^^ required by this bound in `Option::::map` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-47706.stderr b/src/test/ui/issues/issue-47706.stderr index acf7626c634e3..237b2b9e79859 100644 --- a/src/test/ui/issues/issue-47706.stderr +++ b/src/test/ui/issues/issue-47706.stderr @@ -8,6 +8,12 @@ LL | self.foo.map(Foo::new) | --- ^^^^^^^^ expected function that takes 1 argument | | | required by a bound introduced by this call + | +note: required by a bound in `Option::::map` + --> $SRC_DIR/core/src/option.rs:LL:COL + | +LL | pub fn map U>(self, f: F) -> Option { + | ^^^^^^^^^^^^^^ required by this bound in `Option::::map` error[E0593]: function is expected to take 0 arguments, but it takes 1 argument --> $DIR/issue-47706.rs:27:9 diff --git a/src/test/ui/issues/issue-54954.stderr b/src/test/ui/issues/issue-54954.stderr index df76a985559d0..b1b06a25179b9 100644 --- a/src/test/ui/issues/issue-54954.stderr +++ b/src/test/ui/issues/issue-54954.stderr @@ -11,11 +11,11 @@ LL | const ARR_LEN: usize = Tt::const_val::<[i8; 123]>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type | = note: cannot satisfy `_: Tt` -note: required by a bound in `Tt::const_val` - --> $DIR/issue-54954.rs:5:24 +note: required by `Tt::const_val` + --> $DIR/issue-54954.rs:5:5 | LL | const fn const_val() -> usize { - | ^ required by this bound in `Tt::const_val` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr b/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr index a08531000bc64..6a96709cbacdb 100644 --- a/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr +++ b/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr @@ -5,6 +5,11 @@ LL | let x2: Vec = x1.into_iter().collect(); | ^^^^^^^ value of type `Vec` cannot be built from `std::iter::Iterator` | = help: the trait `FromIterator<&f64>` is not implemented for `Vec` +note: required by a bound in `collect` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | fn collect>(self) -> B + | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` error[E0277]: a value of type `Vec` cannot be built from an iterator over elements of type `&f64` --> $DIR/issue-66923-show-error-for-correct-call.rs:12:29 @@ -13,6 +18,11 @@ LL | let x3 = x1.into_iter().collect::>(); | ^^^^^^^ value of type `Vec` cannot be built from `std::iter::Iterator` | = help: the trait `FromIterator<&f64>` is not implemented for `Vec` +note: required by a bound in `collect` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | fn collect>(self) -> B + | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-69455.stderr b/src/test/ui/issues/issue-69455.stderr index da84a6b52da2b..4e4471b1fec04 100644 --- a/src/test/ui/issues/issue-69455.stderr +++ b/src/test/ui/issues/issue-69455.stderr @@ -18,6 +18,11 @@ LL | impl Test for u64 { ... LL | impl Test for u64 { | ^^^^^^^^^^^^^^^^^^^^^^ +note: required by `Test::test` + --> $DIR/issue-69455.rs:8:5 + | +LL | fn test(self, rhs: Rhs) -> Self::Output; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider specifying the type argument in the method call | LL | println!("{}", 23u64.test(xs.iter().sum::())); diff --git a/src/test/ui/issues/issue-69683.stderr b/src/test/ui/issues/issue-69683.stderr index ecf78e48e0e2a..b53923eec1d88 100644 --- a/src/test/ui/issues/issue-69683.stderr +++ b/src/test/ui/issues/issue-69683.stderr @@ -18,6 +18,14 @@ LL | impl Element<()> for T { ... LL | impl, S> Element<[S; 3]> for T { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `Foo::foo` + --> $DIR/issue-69683.rs:15:9 + | +LL | u8: Element, + | ^^^^^^^^^^ required by this bound in `Foo::foo` +LL | { +LL | fn foo(self, x: >::Array); + | --- required by a bound in this error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-72690.stderr b/src/test/ui/issues/issue-72690.stderr index 1747ca5bb04b8..920a4548a9ae9 100644 --- a/src/test/ui/issues/issue-72690.stderr +++ b/src/test/ui/issues/issue-72690.stderr @@ -27,6 +27,11 @@ LL | String::from("x".as_ref()); - impl AsRef for str; - impl AsRef<[u8]> for str; - impl AsRef for str; +note: required by `as_ref` + --> $SRC_DIR/core/src/convert/mod.rs:LL:COL + | +LL | fn as_ref(&self) -> &T; + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0282]: type annotations needed --> $DIR/issue-72690.rs:12:6 @@ -63,6 +68,11 @@ LL | |x| String::from("x".as_ref()); - impl AsRef for str; - impl AsRef<[u8]> for str; - impl AsRef for str; +note: required by `as_ref` + --> $SRC_DIR/core/src/convert/mod.rs:LL:COL + | +LL | fn as_ref(&self) -> &T; + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0283]: type annotations needed for `&T` --> $DIR/issue-72690.rs:18:17 @@ -77,6 +87,11 @@ LL | let _ = "x".as_ref(); - impl AsRef for str; - impl AsRef<[u8]> for str; - impl AsRef for str; +note: required by `as_ref` + --> $SRC_DIR/core/src/convert/mod.rs:LL:COL + | +LL | fn as_ref(&self) -> &T; + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:22:5 @@ -107,6 +122,11 @@ LL | String::from("x".as_ref()); - impl AsRef for str; - impl AsRef<[u8]> for str; - impl AsRef for str; +note: required by `as_ref` + --> $SRC_DIR/core/src/convert/mod.rs:LL:COL + | +LL | fn as_ref(&self) -> &T; + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:29:5 @@ -137,6 +157,11 @@ LL | String::from("x".as_ref()); - impl AsRef for str; - impl AsRef<[u8]> for str; - impl AsRef for str; +note: required by `as_ref` + --> $SRC_DIR/core/src/convert/mod.rs:LL:COL + | +LL | fn as_ref(&self) -> &T; + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:38:5 @@ -167,6 +192,11 @@ LL | String::from("x".as_ref()); - impl AsRef for str; - impl AsRef<[u8]> for str; - impl AsRef for str; +note: required by `as_ref` + --> $SRC_DIR/core/src/convert/mod.rs:LL:COL + | +LL | fn as_ref(&self) -> &T; + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:47:5 @@ -197,6 +227,11 @@ LL | String::from("x".as_ref()); - impl AsRef for str; - impl AsRef<[u8]> for str; - impl AsRef for str; +note: required by `as_ref` + --> $SRC_DIR/core/src/convert/mod.rs:LL:COL + | +LL | fn as_ref(&self) -> &T; + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:54:5 @@ -227,6 +262,11 @@ LL | String::from("x".as_ref()); - impl AsRef for str; - impl AsRef<[u8]> for str; - impl AsRef for str; +note: required by `as_ref` + --> $SRC_DIR/core/src/convert/mod.rs:LL:COL + | +LL | fn as_ref(&self) -> &T; + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:63:5 @@ -257,6 +297,11 @@ LL | String::from("x".as_ref()); - impl AsRef for str; - impl AsRef<[u8]> for str; - impl AsRef for str; +note: required by `as_ref` + --> $SRC_DIR/core/src/convert/mod.rs:LL:COL + | +LL | fn as_ref(&self) -> &T; + | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 18 previous errors diff --git a/src/test/ui/lifetimes/issue-34979.stderr b/src/test/ui/lifetimes/issue-34979.stderr index b76d71a3d43c4..1b97f8d818a45 100644 --- a/src/test/ui/lifetimes/issue-34979.stderr +++ b/src/test/ui/lifetimes/issue-34979.stderr @@ -5,11 +5,6 @@ LL | &'a (): Foo, | ^^^ cannot infer type for reference `&'a ()` | = note: cannot satisfy `&'a (): Foo` -note: required by a bound in `Foo` - --> $DIR/issue-34979.rs:1:1 - | -LL | trait Foo {} - | ^^^^^^^^^ required by this bound in `Foo` error: aborting due to previous error diff --git a/src/test/ui/marker_trait_attr/region-overlap.stderr b/src/test/ui/marker_trait_attr/region-overlap.stderr index c1cc6cdaf53fa..2eeab801e3d9c 100644 --- a/src/test/ui/marker_trait_attr/region-overlap.stderr +++ b/src/test/ui/marker_trait_attr/region-overlap.stderr @@ -11,11 +11,6 @@ LL | impl<'a> A for (&'static (), &'a ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | impl<'a> A for (&'a (), &'static ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required by a bound in `A` - --> $DIR/region-overlap.rs:4:1 - | -LL | trait A {} - | ^^^^^^^ required by this bound in `A` error[E0283]: type annotations needed --> $DIR/region-overlap.rs:6:10 @@ -30,11 +25,6 @@ LL | impl<'a> A for (&'static (), &'a ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | impl<'a> A for (&'a (), &'static ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required by a bound in `A` - --> $DIR/region-overlap.rs:4:1 - | -LL | trait A {} - | ^^^^^^^ required by this bound in `A` error: aborting due to 2 previous errors diff --git a/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr b/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr index f33672433dee4..93d95fadc0bd2 100644 --- a/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr +++ b/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr @@ -20,6 +20,11 @@ LL | impl Foo for Vec { ... LL | impl Foo for Vec { | ^^^^^^^^^^^^^^^^^^^^^^^ +note: required by `Foo::foo` + --> $DIR/method-ambig-one-trait-unknown-int-type.rs:6:5 + | +LL | fn foo(&self) -> isize; + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/method-ambig-one-trait-unknown-int-type.rs:33:20 diff --git a/src/test/ui/mismatched_types/closure-arg-count.stderr b/src/test/ui/mismatched_types/closure-arg-count.stderr index e8fcf80e940d2..fed47e0f17471 100644 --- a/src/test/ui/mismatched_types/closure-arg-count.stderr +++ b/src/test/ui/mismatched_types/closure-arg-count.stderr @@ -125,6 +125,12 @@ LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(foo); ... LL | fn foo() {} | -------- takes 0 arguments + | +note: required by a bound in `map` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | F: FnMut(Self::Item) -> B, + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments --> $DIR/closure-arg-count.rs:27:57 @@ -135,6 +141,12 @@ LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(bar); | --- ^^^ expected closure that takes a single 2-tuple as argument | | | required by a bound introduced by this call + | +note: required by a bound in `map` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | F: FnMut(Self::Item) -> B, + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments --> $DIR/closure-arg-count.rs:29:57 @@ -146,6 +158,12 @@ LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(qux); ... LL | fn qux(x: usize, y: usize) {} | -------------------------- takes 2 distinct arguments + | +note: required by a bound in `map` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | F: FnMut(Self::Item) -> B, + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` error[E0593]: function is expected to take 1 argument, but it takes 2 arguments --> $DIR/closure-arg-count.rs:32:45 @@ -154,6 +172,12 @@ LL | let _it = vec![1, 2, 3].into_iter().map(usize::checked_add); | --- ^^^^^^^^^^^^^^^^^^ expected function that takes 1 argument | | | required by a bound introduced by this call + | +note: required by a bound in `map` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | F: FnMut(Self::Item) -> B, + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` error[E0593]: function is expected to take 0 arguments, but it takes 1 argument --> $DIR/closure-arg-count.rs:35:10 diff --git a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr index 0ec282dac45e2..f34ac35c75713 100644 --- a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr +++ b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr @@ -5,6 +5,12 @@ LL | a.iter().map(|_: (u32, u32)| 45); | ^^^ ------------------ found signature of `fn((u32, u32)) -> _` | | | expected signature of `fn(&(u32, u32)) -> _` + | +note: required by a bound in `map` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | F: FnMut(Self::Item) -> B, + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` error[E0631]: type mismatch in closure arguments --> $DIR/closure-arg-type-mismatch.rs:4:14 @@ -13,6 +19,12 @@ LL | a.iter().map(|_: &(u16, u16)| 45); | ^^^ ------------------- found signature of `for<'r> fn(&'r (u16, u16)) -> _` | | | expected signature of `fn(&(u32, u32)) -> _` + | +note: required by a bound in `map` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | F: FnMut(Self::Item) -> B, + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` error[E0631]: type mismatch in closure arguments --> $DIR/closure-arg-type-mismatch.rs:5:14 @@ -21,6 +33,12 @@ LL | a.iter().map(|_: (u16, u16)| 45); | ^^^ ------------------ found signature of `fn((u16, u16)) -> _` | | | expected signature of `fn(&(u32, u32)) -> _` + | +note: required by a bound in `map` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | F: FnMut(Self::Item) -> B, + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` error[E0308]: mismatched types --> $DIR/closure-arg-type-mismatch.rs:10:5 diff --git a/src/test/ui/mismatched_types/issue-36053-2.stderr b/src/test/ui/mismatched_types/issue-36053-2.stderr index 67e8ee2283689..a8bcdf5efe91e 100644 --- a/src/test/ui/mismatched_types/issue-36053-2.stderr +++ b/src/test/ui/mismatched_types/issue-36053-2.stderr @@ -5,6 +5,12 @@ LL | once::<&str>("str").fuse().filter(|a: &str| true).count(); | ^^^^^^ -------------- found signature of `for<'r> fn(&'r str) -> _` | | | expected signature of `for<'r> fn(&'r &str) -> _` + | +note: required by a bound in `filter` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | P: FnMut(&Self::Item) -> bool, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `filter` error[E0599]: the method `count` exists for struct `Filter>, [closure@$DIR/issue-36053-2.rs:7:39: 7:53]>`, but its trait bounds were not satisfied --> $DIR/issue-36053-2.rs:7:55 diff --git a/src/test/ui/not-clone-closure.stderr b/src/test/ui/not-clone-closure.stderr index a62c21f2ee971..d7546a5e39801 100644 --- a/src/test/ui/not-clone-closure.stderr +++ b/src/test/ui/not-clone-closure.stderr @@ -11,6 +11,11 @@ LL | let hello = hello.clone(); | ^^^^^ within `[closure@$DIR/not-clone-closure.rs:7:17: 9:6]`, the trait `Clone` is not implemented for `S` | = note: required because it appears within the type `[closure@$DIR/not-clone-closure.rs:7:17: 9:6]` +note: required by `clone` + --> $SRC_DIR/core/src/clone.rs:LL:COL + | +LL | fn clone(&self) -> Self; + | ^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters.stderr index 66b61b1349d2b..318e9d006a148 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters.stderr @@ -4,7 +4,11 @@ error[E0477]: the type `&'a isize` does not fulfill the required lifetime LL | Foo.some_method::<&'a isize>(); | ^^^^^^^^^^^ | - = note: type must satisfy the static lifetime +note: type must satisfy the static lifetime as required by this binding + --> $DIR/regions-bounded-method-type-parameters.rs:8:22 + | +LL | fn some_method(self) { } + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/regions/regions-close-object-into-object-5.stderr b/src/test/ui/regions/regions-close-object-into-object-5.stderr index 83f8d20b9e1de..512a7ab35fbfd 100644 --- a/src/test/ui/regions/regions-close-object-into-object-5.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-5.stderr @@ -29,7 +29,13 @@ LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` LL | // oh dear! LL | Box::new(B(&*v)) as Box - | ^ ...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-close-object-into-object-5.rs:9:17 + | +LL | struct B<'a, T: 'a>(&'a (A + 'a)); + | ^^ error[E0310]: the parameter type `T` may not live long enough --> $DIR/regions-close-object-into-object-5.rs:17:14 diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-and-non-const-impl.stderr b/src/test/ui/rfc-2632-const-trait-impl/const-and-non-const-impl.stderr index 785095c29ae4e..154a6a35a44ef 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-and-non-const-impl.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/const-and-non-const-impl.stderr @@ -31,17 +31,6 @@ note: multiple `impl`s satisfying `i32: Add` found LL | impl const std::ops::Add for i32 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: and another `impl` found in the `core` crate: `impl Add for i32;` -note: required by a bound in `Add` - --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | / pub trait Add { -LL | | /// The resulting type after applying the `+` operator. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Output; -... | -LL | | fn add(self, rhs: Rhs) -> Self::Output; -LL | | } - | |_^ required by this bound in `Add` error[E0283]: type annotations needed --> $DIR/const-and-non-const-impl.rs:14:6 @@ -57,17 +46,6 @@ LL | impl std::ops::Add for Int { ... LL | impl const std::ops::Add for Int { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required by a bound in `Add` - --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | / pub trait Add { -LL | | /// The resulting type after applying the `+` operator. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Output; -... | -LL | | fn add(self, rhs: Rhs) -> Self::Output; -LL | | } - | |_^ required by this bound in `Add` error[E0283]: type annotations needed --> $DIR/const-and-non-const-impl.rs:22:12 @@ -83,17 +61,6 @@ LL | impl std::ops::Add for Int { ... LL | impl const std::ops::Add for Int { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required by a bound in `Add` - --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | / pub trait Add { -LL | | /// The resulting type after applying the `+` operator. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Output; -... | -LL | | fn add(self, rhs: Rhs) -> Self::Output; -LL | | } - | |_^ required by this bound in `Add` error: aborting due to 5 previous errors diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr b/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr index efe46d7e81d3d..04c21101e758b 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr @@ -42,11 +42,11 @@ error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied LL | ConstDropImplWithBounds::(PhantomData), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `A` is not implemented for `NonTrivialDrop` | -note: required by `ConstDropImplWithBounds` - --> $DIR/const-drop-fail.rs:27:1 +note: required by a bound in `ConstDropImplWithBounds` + --> $DIR/const-drop-fail.rs:27:35 | LL | struct ConstDropImplWithBounds(PhantomData); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^ required by this bound in `ConstDropImplWithBounds` error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied --> $DIR/const-drop-fail.rs:49:5 diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr b/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr index efe46d7e81d3d..04c21101e758b 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr @@ -42,11 +42,11 @@ error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied LL | ConstDropImplWithBounds::(PhantomData), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `A` is not implemented for `NonTrivialDrop` | -note: required by `ConstDropImplWithBounds` - --> $DIR/const-drop-fail.rs:27:1 +note: required by a bound in `ConstDropImplWithBounds` + --> $DIR/const-drop-fail.rs:27:35 | LL | struct ConstDropImplWithBounds(PhantomData); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^ required by this bound in `ConstDropImplWithBounds` error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied --> $DIR/const-drop-fail.rs:49:5 diff --git a/src/test/ui/rfc-2632-const-trait-impl/trait-where-clause.stderr b/src/test/ui/rfc-2632-const-trait-impl/trait-where-clause.stderr index fffb91f98700b..08d91d7daf85b 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/trait-where-clause.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/trait-where-clause.stderr @@ -4,11 +4,11 @@ error[E0277]: the trait bound `T: Bar` is not satisfied LL | T::b(); | ^^^^ the trait `Bar` is not implemented for `T` | -note: required by `Foo::b` - --> $DIR/trait-where-clause.rs:8:5 +note: required by a bound in `Foo::b` + --> $DIR/trait-where-clause.rs:8:24 | LL | fn b() where Self: ~const Bar; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^ required by this bound in `Foo::b` help: consider further restricting this bound | LL | const fn test1() { @@ -20,11 +20,11 @@ error[E0277]: the trait bound `T: Bar` is not satisfied LL | T::c::(); | ^^^^^^^^^ the trait `Bar` is not implemented for `T` | -note: required by `Foo::c` - --> $DIR/trait-where-clause.rs:9:5 +note: required by a bound in `Foo::c` + --> $DIR/trait-where-clause.rs:9:13 | LL | fn c(); - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^ required by this bound in `Foo::c` help: consider further restricting this bound | LL | const fn test1() { @@ -36,11 +36,11 @@ error[E0277]: the trait bound `T: Bar` is not satisfied LL | T::b(); | ^^^^ the trait `Bar` is not implemented for `T` | -note: required by `Foo::b` - --> $DIR/trait-where-clause.rs:8:5 +note: required by a bound in `Foo::b` + --> $DIR/trait-where-clause.rs:8:24 | LL | fn b() where Self: ~const Bar; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^ required by this bound in `Foo::b` help: consider further restricting this bound | LL | fn test3() { @@ -52,11 +52,11 @@ error[E0277]: the trait bound `T: Bar` is not satisfied LL | T::c::(); | ^^^^^^^^^ the trait `Bar` is not implemented for `T` | -note: required by `Foo::c` - --> $DIR/trait-where-clause.rs:9:5 +note: required by a bound in `Foo::c` + --> $DIR/trait-where-clause.rs:9:13 | LL | fn c(); - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^ required by this bound in `Foo::c` help: consider further restricting this bound | LL | fn test3() { diff --git a/src/test/ui/specialization/issue-39448.stderr b/src/test/ui/specialization/issue-39448.stderr index c4fc44c737ec1..a8a4114e4dd92 100644 --- a/src/test/ui/specialization/issue-39448.stderr +++ b/src/test/ui/specialization/issue-39448.stderr @@ -24,6 +24,11 @@ note: required because of the requirements on the impl of `ToA` for `U` | LL | impl ToA for T | ^^^^^^ ^ +note: required by `ToA::to` + --> $DIR/issue-39448.rs:31:5 + | +LL | fn to(self) -> T; + | ^^^^^^^^^^^^^^^^^ error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/str/str-idx.stderr b/src/test/ui/str/str-idx.stderr index 47bd6f6bfa73d..9c3c3646139dc 100644 --- a/src/test/ui/str/str-idx.stderr +++ b/src/test/ui/str/str-idx.stderr @@ -20,6 +20,11 @@ LL | let _ = s.get(4); = help: the trait `SliceIndex` is not implemented for `{integer}` = note: you can use `.chars().nth()` or `.bytes().nth()` for more information, see chapter 8 in The Book: +note: required by a bound in `core::str::::get` + --> $SRC_DIR/core/src/str/mod.rs:LL:COL + | +LL | pub fn get>(&self, i: I) -> Option<&I::Output> { + | ^^^^^^^^^^^^^^^ required by this bound in `core::str::::get` error[E0277]: the type `str` cannot be indexed by `{integer}` --> $DIR/str-idx.rs:5:29 @@ -32,6 +37,11 @@ LL | let _ = s.get_unchecked(4); = help: the trait `SliceIndex` is not implemented for `{integer}` = note: you can use `.chars().nth()` or `.bytes().nth()` for more information, see chapter 8 in The Book: +note: required by a bound in `core::str::::get_unchecked` + --> $SRC_DIR/core/src/str/mod.rs:LL:COL + | +LL | pub unsafe fn get_unchecked>(&self, i: I) -> &I::Output { + | ^^^^^^^^^^^^^^^ required by this bound in `core::str::::get_unchecked` error[E0277]: the type `str` cannot be indexed by `char` --> $DIR/str-idx.rs:6:17 diff --git a/src/test/ui/str/str-mut-idx.stderr b/src/test/ui/str/str-mut-idx.stderr index ab647c75cf120..2559ee9eb49b2 100644 --- a/src/test/ui/str/str-mut-idx.stderr +++ b/src/test/ui/str/str-mut-idx.stderr @@ -44,6 +44,11 @@ LL | s.get_mut(1); = help: the trait `SliceIndex` is not implemented for `{integer}` = note: you can use `.chars().nth()` or `.bytes().nth()` for more information, see chapter 8 in The Book: +note: required by a bound in `core::str::::get_mut` + --> $SRC_DIR/core/src/str/mod.rs:LL:COL + | +LL | pub fn get_mut>(&mut self, i: I) -> Option<&mut I::Output> { + | ^^^^^^^^^^^^^^^ required by this bound in `core::str::::get_mut` error[E0277]: the type `str` cannot be indexed by `{integer}` --> $DIR/str-mut-idx.rs:11:25 @@ -56,6 +61,11 @@ LL | s.get_unchecked_mut(1); = help: the trait `SliceIndex` is not implemented for `{integer}` = note: you can use `.chars().nth()` or `.bytes().nth()` for more information, see chapter 8 in The Book: +note: required by a bound in `core::str::::get_unchecked_mut` + --> $SRC_DIR/core/src/str/mod.rs:LL:COL + | +LL | pub unsafe fn get_unchecked_mut>(&mut self, i: I) -> &mut I::Output { + | ^^^^^^^^^^^^^^^ required by this bound in `core::str::::get_unchecked_mut` error[E0277]: the type `str` cannot be indexed by `char` --> $DIR/str-mut-idx.rs:13:5 diff --git a/src/test/ui/structs/struct-path-alias-bounds.stderr b/src/test/ui/structs/struct-path-alias-bounds.stderr index e0a22c2df1aca..7a80e7270ba36 100644 --- a/src/test/ui/structs/struct-path-alias-bounds.stderr +++ b/src/test/ui/structs/struct-path-alias-bounds.stderr @@ -4,11 +4,11 @@ error[E0277]: the trait bound `NoClone: Clone` is not satisfied LL | let s = A { a: NoClone }; | ^ the trait `Clone` is not implemented for `NoClone` | -note: required by `S` - --> $DIR/struct-path-alias-bounds.rs:3:1 +note: required by a bound in `S` + --> $DIR/struct-path-alias-bounds.rs:3:13 | LL | struct S { a: T } - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^ required by this bound in `S` error: aborting due to previous error diff --git a/src/test/ui/substs-ppaux.normal.stderr b/src/test/ui/substs-ppaux.normal.stderr index 97caa833d2f58..eabda55e08f35 100644 --- a/src/test/ui/substs-ppaux.normal.stderr +++ b/src/test/ui/substs-ppaux.normal.stderr @@ -82,11 +82,11 @@ note: required because of the requirements on the impl of `Foo<'_, '_, u8>` for | LL | impl<'a,'b,T,S> Foo<'a, 'b, S> for T {} | ^^^^^^^^^^^^^^ ^ -note: required by a bound in `Foo::bar` - --> $DIR/substs-ppaux.rs:7:30 +note: required by `Foo::bar` + --> $DIR/substs-ppaux.rs:7:5 | LL | fn bar<'a, T>() where T: 'a {} - | ^^ required by this bound in `Foo::bar` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/substs-ppaux.verbose.stderr b/src/test/ui/substs-ppaux.verbose.stderr index 5829073c265bd..cd0dfb9c6b4c7 100644 --- a/src/test/ui/substs-ppaux.verbose.stderr +++ b/src/test/ui/substs-ppaux.verbose.stderr @@ -82,11 +82,11 @@ note: required because of the requirements on the impl of `Foo<'_#0r, '_#1r, u8> | LL | impl<'a,'b,T,S> Foo<'a, 'b, S> for T {} | ^^^^^^^^^^^^^^ ^ -note: required by a bound in `Foo::bar` - --> $DIR/substs-ppaux.rs:7:30 +note: required by `Foo::bar` + --> $DIR/substs-ppaux.rs:7:5 | LL | fn bar<'a, T>() where T: 'a {} - | ^^ required by this bound in `Foo::bar` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr b/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr index aa3175dae2e66..7ef4895249cec 100644 --- a/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr +++ b/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr @@ -46,11 +46,11 @@ LL | Pin::new(x) | ^^^^^^^^ the trait `Unpin` is not implemented for `dyn Future + Send` | = note: consider using `Box::pin` -note: required by `Pin::

::new` +note: required by a bound in `Pin::

::new` --> $SRC_DIR/core/src/pin.rs:LL:COL | -LL | pub const fn new(pointer: P) -> Pin

{ - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl> Pin

{ + | ^^^^^ required by this bound in `Pin::

::new` error[E0277]: `dyn Future + Send` cannot be unpinned --> $DIR/expected-boxed-future-isnt-pinned.rs:24:5 @@ -59,11 +59,11 @@ LL | Pin::new(Box::new(x)) | ^^^^^^^^ the trait `Unpin` is not implemented for `dyn Future + Send` | = note: consider using `Box::pin` -note: required by `Pin::

::new` +note: required by a bound in `Pin::

::new` --> $SRC_DIR/core/src/pin.rs:LL:COL | -LL | pub const fn new(pointer: P) -> Pin

{ - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl> Pin

{ + | ^^^^^ required by this bound in `Pin::

::new` error[E0308]: mismatched types --> $DIR/expected-boxed-future-isnt-pinned.rs:28:5 diff --git a/src/test/ui/suggestions/issue-62843.stderr b/src/test/ui/suggestions/issue-62843.stderr index 29ba39cbe109c..bc1c69406d139 100644 --- a/src/test/ui/suggestions/issue-62843.stderr +++ b/src/test/ui/suggestions/issue-62843.stderr @@ -8,6 +8,11 @@ LL | println!("{:?}", line.find(pattern)); | = note: the trait bound `String: Pattern<'_>` is not satisfied = note: required because of the requirements on the impl of `Pattern<'_>` for `String` +note: required by a bound in `core::str::::find` + --> $SRC_DIR/core/src/str/mod.rs:LL:COL + | +LL | pub fn find<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option { + | ^^^^^^^^^^^ required by this bound in `core::str::::find` help: consider borrowing here | LL | println!("{:?}", line.find(&pattern)); diff --git a/src/test/ui/suggestions/issue-71394-no-from-impl.stderr b/src/test/ui/suggestions/issue-71394-no-from-impl.stderr index 7972437771399..bee29dbb079dc 100644 --- a/src/test/ui/suggestions/issue-71394-no-from-impl.stderr +++ b/src/test/ui/suggestions/issue-71394-no-from-impl.stderr @@ -8,6 +8,11 @@ LL | let _: &[i8] = data.into(); <[T; LANES] as From>> <[bool; LANES] as From>> = note: required because of the requirements on the impl of `Into<&[i8]>` for `&[u8]` +note: required by `into` + --> $SRC_DIR/core/src/convert/mod.rs:LL:COL + | +LL | fn into(self) -> T; + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/suggestions/issue-84973.stderr b/src/test/ui/suggestions/issue-84973.stderr index 16a28c73aa724..24c989ec3e86d 100644 --- a/src/test/ui/suggestions/issue-84973.stderr +++ b/src/test/ui/suggestions/issue-84973.stderr @@ -6,11 +6,14 @@ LL | let o = Other::new(f); | | | required by a bound introduced by this call | -note: required by `Other::<'a, G>::new` - --> $DIR/issue-84973.rs:27:5 +note: required by a bound in `Other::<'a, G>::new` + --> $DIR/issue-84973.rs:25:8 | +LL | G: SomeTrait, + | ^^^^^^^^^ required by this bound in `Other::<'a, G>::new` +LL | { LL | pub fn new(g: G) -> Self { - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | --- required by a bound in this help: consider borrowing here | LL | let o = Other::new(&f); diff --git a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr index 0cf0074dc3d25..adb928aa8a376 100644 --- a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr +++ b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr @@ -11,11 +11,16 @@ note: the parameter type `T` must be valid for the anonymous lifetime defined he | LL | fn func(foo: &Foo, t: T) { | ^^^ -note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature-2.rs:20:13: 23:6]` will meet its required lifetime bounds +note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature-2.rs:20:13: 23:6]` will meet its required lifetime bounds... --> $DIR/missing-lifetimes-in-signature-2.rs:20:9 | LL | foo.bar(move |_| { | ^^^ +note: ...that is required by this bound + --> $DIR/missing-lifetimes-in-signature-2.rs:11:12 + | +LL | F: 'a, + | ^^ error: aborting due to previous error diff --git a/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr b/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr index e6a2231390076..d121932c842e3 100644 --- a/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr +++ b/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr @@ -7,11 +7,11 @@ LL | let fp = BufWriter::new(fp); | required by a bound introduced by this call | = note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write` -note: required by `BufWriter::::new` +note: required by a bound in `BufWriter::::new` --> $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL | -LL | pub fn new(inner: W) -> BufWriter { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl BufWriter { + | ^^^^^ required by this bound in `BufWriter::::new` error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied --> $DIR/mut-borrow-needed-by-trait.rs:17:14 diff --git a/src/test/ui/suggestions/suggest-change-mut.stderr b/src/test/ui/suggestions/suggest-change-mut.stderr index 8dfab8dfa17e5..2fa69cd5a2c8d 100644 --- a/src/test/ui/suggestions/suggest-change-mut.stderr +++ b/src/test/ui/suggestions/suggest-change-mut.stderr @@ -6,11 +6,11 @@ LL | let mut stream_reader = BufReader::new(&stream); | | | required by a bound introduced by this call | -note: required by `BufReader::::new` +note: required by a bound in `BufReader::::new` --> $SRC_DIR/std/src/io/buffered/bufreader.rs:LL:COL | -LL | pub fn new(inner: R) -> BufReader { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl BufReader { + | ^^^^ required by this bound in `BufReader::::new` help: consider removing the leading `&`-reference | LL - let mut stream_reader = BufReader::new(&stream); diff --git a/src/test/ui/traits/bad-method-typaram-kind.stderr b/src/test/ui/traits/bad-method-typaram-kind.stderr index 1e9d151629f2f..8befa4c5f738b 100644 --- a/src/test/ui/traits/bad-method-typaram-kind.stderr +++ b/src/test/ui/traits/bad-method-typaram-kind.stderr @@ -4,6 +4,11 @@ error[E0277]: `T` cannot be sent between threads safely LL | 1.bar::(); | ^^^ `T` cannot be sent between threads safely | +note: required by a bound in `Bar::bar` + --> $DIR/bad-method-typaram-kind.rs:6:14 + | +LL | fn bar(&self); + | ^^^^ required by this bound in `Bar::bar` help: consider further restricting this bound | LL | fn foo() { diff --git a/src/test/ui/traits/bad-sized.stderr b/src/test/ui/traits/bad-sized.stderr index 5421e71509f3a..6f9113fff5161 100644 --- a/src/test/ui/traits/bad-sized.stderr +++ b/src/test/ui/traits/bad-sized.stderr @@ -29,11 +29,11 @@ LL | let x: Vec = Vec::new(); | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `dyn Trait` -note: required by `Vec::::new` +note: required by a bound in `Vec::::new` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | -LL | pub const fn new() -> Self { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl Vec { + | ^ required by this bound in `Vec::::new` error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time --> $DIR/bad-sized.rs:4:37 diff --git a/src/test/ui/traits/bound/on-structs-and-enums-locals.stderr b/src/test/ui/traits/bound/on-structs-and-enums-locals.stderr index cd33e18cfb695..c9068a270020d 100644 --- a/src/test/ui/traits/bound/on-structs-and-enums-locals.stderr +++ b/src/test/ui/traits/bound/on-structs-and-enums-locals.stderr @@ -16,11 +16,11 @@ error[E0277]: the trait bound `{integer}: Trait` is not satisfied LL | let foo = Foo { | ^^^ the trait `Trait` is not implemented for `{integer}` | -note: required by `Foo` - --> $DIR/on-structs-and-enums-locals.rs:5:1 +note: required by a bound in `Foo` + --> $DIR/on-structs-and-enums-locals.rs:5:14 | LL | struct Foo { - | ^^^^^^^^^^^^^^^^^^^ + | ^^^^^ required by this bound in `Foo` error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/bound/on-structs-and-enums-xc1.stderr b/src/test/ui/traits/bound/on-structs-and-enums-xc1.stderr index 0f25c8856882c..f4cc64af94f37 100644 --- a/src/test/ui/traits/bound/on-structs-and-enums-xc1.stderr +++ b/src/test/ui/traits/bound/on-structs-and-enums-xc1.stderr @@ -16,11 +16,11 @@ error[E0277]: the trait bound `{integer}: Trait` is not satisfied LL | let foo = Foo { | ^^^ the trait `Trait` is not implemented for `{integer}` | -note: required by `Foo` - --> $DIR/auxiliary/on_structs_and_enums_xc.rs:5:1 +note: required by a bound in `Foo` + --> $DIR/auxiliary/on_structs_and_enums_xc.rs:5:18 | LL | pub struct Foo { - | ^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^ required by this bound in `Foo` error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr b/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr index fa8799bf7d8a1..73f680182fb10 100644 --- a/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr +++ b/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr @@ -3,6 +3,12 @@ error[E0277]: the trait bound `dyn CompareToInts: CompareTo` is not satisfi | LL | c.same_as(22) | ^^^^^^^ the trait `CompareTo` is not implemented for `dyn CompareToInts` + | +note: required by `CompareTo::same_as` + --> $DIR/repeated-supertrait-ambig.rs:9:5 + | +LL | fn same_as(&self, t: T) -> bool; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `C: CompareTo` is not satisfied --> $DIR/repeated-supertrait-ambig.rs:30:7 @@ -10,6 +16,11 @@ error[E0277]: the trait bound `C: CompareTo` is not satisfied LL | c.same_as(22) | ^^^^^^^ the trait `CompareTo` is not implemented for `C` | +note: required by `CompareTo::same_as` + --> $DIR/repeated-supertrait-ambig.rs:9:5 + | +LL | fn same_as(&self, t: T) -> bool; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider further restricting this bound | LL | fn with_trait>(c: &C) -> bool { @@ -52,6 +63,11 @@ LL | assert_eq!(22_i64.same_as(22), true); = help: the following implementations were found: > > +note: required by `CompareTo::same_as` + --> $DIR/repeated-supertrait-ambig.rs:9:5 + | +LL | fn same_as(&self, t: T) -> bool; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/traits/issue-77982.stderr b/src/test/ui/traits/issue-77982.stderr index e868756504f19..0d772c020cf36 100644 --- a/src/test/ui/traits/issue-77982.stderr +++ b/src/test/ui/traits/issue-77982.stderr @@ -10,6 +10,15 @@ LL | opts.get(opt.as_ref()); - impl Borrow for String; - impl Borrow for T where T: ?Sized; +note: required by a bound in `HashMap::::get` + --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL + | +LL | K: Borrow, + | ^^^^^^^^^ required by this bound in `HashMap::::get` +help: consider specifying the type argument in the function call + | +LL | opts.get::(opt.as_ref()); + | +++++ error[E0283]: type annotations needed --> $DIR/issue-77982.rs:8:18 @@ -25,6 +34,11 @@ LL | opts.get(opt.as_ref()); - impl AsRef for String; - impl AsRef<[u8]> for String; - impl AsRef for String; +note: required by `as_ref` + --> $SRC_DIR/core/src/convert/mod.rs:LL:COL + | +LL | fn as_ref(&self) -> &T; + | ^^^^^^^^^^^^^^^^^^^^^^^ help: use the fully qualified path for the potential candidates | LL | opts.get(>::as_ref(opt)); @@ -71,6 +85,11 @@ LL | impl Foo<'static, u32> for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | impl<'a> Foo<'a, i16> for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by `Foo::foo` + --> $DIR/issue-77982.rs:18:5 + | +LL | fn foo(&self) -> Box { + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0283]: type annotations needed for `Box` --> $DIR/issue-77982.rs:40:19 @@ -87,6 +106,11 @@ LL | impl<'a> Bar<'static, u32> for &'a () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | impl<'a> Bar<'a, i16> for &'a () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by `Bar::bar` + --> $DIR/issue-77982.rs:24:5 + | +LL | fn bar(&self) -> Box { + | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/traits/issue-85735.stderr b/src/test/ui/traits/issue-85735.stderr index 1f81fa72547df..33b12ef09ec26 100644 --- a/src/test/ui/traits/issue-85735.stderr +++ b/src/test/ui/traits/issue-85735.stderr @@ -5,15 +5,6 @@ LL | T: FnMut(&'a ()), | ^^^^^^^^^^^^^ cannot infer type for type parameter `T` | = note: cannot satisfy `T: FnMut<(&'a (),)>` -note: required by a bound in `FnMut` - --> $SRC_DIR/core/src/ops/function.rs:LL:COL - | -LL | / pub trait FnMut: FnOnce { -LL | | /// Performs the call operation. -LL | | #[unstable(feature = "fn_traits", issue = "29625")] -LL | | extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; -LL | | } - | |_^ required by this bound in `FnMut` error: aborting due to previous error diff --git a/src/test/ui/traits/negative-impls/negated-auto-traits-error.stderr b/src/test/ui/traits/negative-impls/negated-auto-traits-error.stderr index 1ab130e0ab143..c5d4ccc2fcd91 100644 --- a/src/test/ui/traits/negative-impls/negated-auto-traits-error.stderr +++ b/src/test/ui/traits/negative-impls/negated-auto-traits-error.stderr @@ -7,11 +7,11 @@ LL | Outer(TestType); | required by a bound introduced by this call | = help: the trait `Send` is not implemented for `dummy::TestType` -note: required by `Outer` - --> $DIR/negated-auto-traits-error.rs:10:1 +note: required by a bound in `Outer` + --> $DIR/negated-auto-traits-error.rs:10:17 | LL | struct Outer(T); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^ required by this bound in `Outer` error[E0277]: `dummy::TestType` cannot be sent between threads safely --> $DIR/negated-auto-traits-error.rs:23:5 diff --git a/src/test/ui/traits/test-2.stderr b/src/test/ui/traits/test-2.stderr index 5eec012458450..3e0dcda07f1b8 100644 --- a/src/test/ui/traits/test-2.stderr +++ b/src/test/ui/traits/test-2.stderr @@ -92,6 +92,11 @@ LL | impl bar for i32 { fn dup(&self) -> i32 { *self } fn blah(&self) {} } | ^^^^^^^^^^^^^^^^ LL | impl bar for u32 { fn dup(&self) -> u32 { *self } fn blah(&self) {} } | ^^^^^^^^^^^^^^^^ +note: required by `bar::dup` + --> $DIR/test-2.rs:4:13 + | +LL | trait bar { fn dup(&self) -> Self; fn blah(&self); } + | ^^^^^^^^^^^^^^^^^^^^^^ error[E0283]: type annotations needed --> $DIR/test-2.rs:11:8 @@ -106,6 +111,11 @@ LL | impl bar for i32 { fn dup(&self) -> i32 { *self } fn blah(&self) {} } | ^^^^^^^^^^^^^^^^ LL | impl bar for u32 { fn dup(&self) -> u32 { *self } fn blah(&self) {} } | ^^^^^^^^^^^^^^^^ +note: required by `bar::blah` + --> $DIR/test-2.rs:4:36 + | +LL | trait bar { fn dup(&self) -> Self; fn blah(&self); } + | ^^^^^^^^^^^^^^^^^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/traits/vtable-res-trait-param.stderr b/src/test/ui/traits/vtable-res-trait-param.stderr index c5fff622b6b23..2b3e3de9b1ab4 100644 --- a/src/test/ui/traits/vtable-res-trait-param.stderr +++ b/src/test/ui/traits/vtable-res-trait-param.stderr @@ -5,6 +5,12 @@ LL | b.gimme_an_a(y) | ---------- ^ the trait `TraitA` is not implemented for `{integer}` | | | required by a bound introduced by this call + | +note: required by a bound in `TraitB::gimme_an_a` + --> $DIR/vtable-res-trait-param.rs:6:21 + | +LL | fn gimme_an_a(&self, a: A) -> isize; + | ^^^^^^ required by this bound in `TraitB::gimme_an_a` error: aborting due to previous error diff --git a/src/test/ui/type/type-check/issue-40294.stderr b/src/test/ui/type/type-check/issue-40294.stderr index 9ca07eaba838a..6d1e490bcf330 100644 --- a/src/test/ui/type/type-check/issue-40294.stderr +++ b/src/test/ui/type/type-check/issue-40294.stderr @@ -5,11 +5,6 @@ LL | where &'a T : Foo, | ^^^ cannot infer type for reference `&'a T` | = note: cannot satisfy `&'a T: Foo` -note: required by a bound in `Foo` - --> $DIR/issue-40294.rs:1:1 - | -LL | trait Foo: Sized { - | ^^^^^^^^^^^^^^^^ required by this bound in `Foo` error: aborting due to previous error diff --git a/src/test/ui/union/union-generic.mirunsafeck.stderr b/src/test/ui/union/union-generic.mirunsafeck.stderr index cd8577818647a..a4f0c400d7310 100644 --- a/src/test/ui/union/union-generic.mirunsafeck.stderr +++ b/src/test/ui/union/union-generic.mirunsafeck.stderr @@ -4,11 +4,11 @@ error[E0277]: the trait bound `Rc: Copy` is not satisfied LL | let u = U { a: Rc::new(0u32) }; | ^ the trait `Copy` is not implemented for `Rc` | -note: required by `U` - --> $DIR/union-generic.rs:6:1 +note: required by a bound in `U` + --> $DIR/union-generic.rs:6:12 | LL | union U { - | ^^^^^^^^^^^^^^^^ + | ^^^^ required by this bound in `U` error[E0277]: the trait bound `Rc: Copy` is not satisfied --> $DIR/union-generic.rs:13:13 @@ -16,11 +16,11 @@ error[E0277]: the trait bound `Rc: Copy` is not satisfied LL | let u = U::> { a: Default::default() }; | ^^^^^^^^^^^^ the trait `Copy` is not implemented for `Rc` | -note: required by `U` - --> $DIR/union-generic.rs:6:1 +note: required by a bound in `U` + --> $DIR/union-generic.rs:6:12 | LL | union U { - | ^^^^^^^^^^^^^^^^ + | ^^^^ required by this bound in `U` error: aborting due to 2 previous errors diff --git a/src/test/ui/union/union-generic.thirunsafeck.stderr b/src/test/ui/union/union-generic.thirunsafeck.stderr index cd8577818647a..a4f0c400d7310 100644 --- a/src/test/ui/union/union-generic.thirunsafeck.stderr +++ b/src/test/ui/union/union-generic.thirunsafeck.stderr @@ -4,11 +4,11 @@ error[E0277]: the trait bound `Rc: Copy` is not satisfied LL | let u = U { a: Rc::new(0u32) }; | ^ the trait `Copy` is not implemented for `Rc` | -note: required by `U` - --> $DIR/union-generic.rs:6:1 +note: required by a bound in `U` + --> $DIR/union-generic.rs:6:12 | LL | union U { - | ^^^^^^^^^^^^^^^^ + | ^^^^ required by this bound in `U` error[E0277]: the trait bound `Rc: Copy` is not satisfied --> $DIR/union-generic.rs:13:13 @@ -16,11 +16,11 @@ error[E0277]: the trait bound `Rc: Copy` is not satisfied LL | let u = U::> { a: Default::default() }; | ^^^^^^^^^^^^ the trait `Copy` is not implemented for `Rc` | -note: required by `U` - --> $DIR/union-generic.rs:6:1 +note: required by a bound in `U` + --> $DIR/union-generic.rs:6:12 | LL | union U { - | ^^^^^^^^^^^^^^^^ + | ^^^^ required by this bound in `U` error: aborting due to 2 previous errors diff --git a/src/test/ui/unsized/issue-71659.stderr b/src/test/ui/unsized/issue-71659.stderr index be2df8c85e1af..d7b95f55769fd 100644 --- a/src/test/ui/unsized/issue-71659.stderr +++ b/src/test/ui/unsized/issue-71659.stderr @@ -3,6 +3,15 @@ error[E0277]: the trait bound `dyn Foo: CastTo<[i32]>` is not satisfied | LL | let x = x.cast::<[i32]>(); | ^^^^ the trait `CastTo<[i32]>` is not implemented for `dyn Foo` + | +note: required by a bound in `Cast::cast` + --> $DIR/issue-71659.rs:19:15 + | +LL | fn cast(&self) -> &T + | ---- required by a bound in this +LL | where +LL | Self: CastTo, + | ^^^^^^^^^ required by this bound in `Cast::cast` error: aborting due to previous error diff --git a/src/test/ui/wf/wf-foreign-fn-decl-ret.stderr b/src/test/ui/wf/wf-foreign-fn-decl-ret.stderr index 66bfdbc596266..b03023b5fd14f 100644 --- a/src/test/ui/wf/wf-foreign-fn-decl-ret.stderr +++ b/src/test/ui/wf/wf-foreign-fn-decl-ret.stderr @@ -3,12 +3,6 @@ error[E0277]: the trait bound `(): Foo` is not satisfied | LL | pub fn lint_me() -> <() as Foo>::Assoc; | ^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `()` - | -note: required by a bound in `Foo` - --> $DIR/wf-foreign-fn-decl-ret.rs:6:1 - | -LL | pub trait Foo { - | ^^^^^^^^^^^^^ required by this bound in `Foo` error[E0277]: the trait bound `u32: Unsatisfied` is not satisfied --> $DIR/wf-foreign-fn-decl-ret.rs:14:32 diff --git a/src/test/ui/where-clauses/where-clause-method-substituion.stderr b/src/test/ui/where-clauses/where-clause-method-substituion.stderr index cb381d2d9fe71..f431deee73f9a 100644 --- a/src/test/ui/where-clauses/where-clause-method-substituion.stderr +++ b/src/test/ui/where-clauses/where-clause-method-substituion.stderr @@ -3,6 +3,12 @@ error[E0277]: the trait bound `X: Foo` is not satisfied | LL | 1.method::(); | ^^^^^^ the trait `Foo` is not implemented for `X` + | +note: required by a bound in `Bar::method` + --> $DIR/where-clause-method-substituion.rs:6:34 + | +LL | fn method(&self) where A: Foo; + | ^^^^^^ required by this bound in `Bar::method` error: aborting due to previous error diff --git a/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr b/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr index 3223dca3cddbf..3a4cbb62d5597 100644 --- a/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr +++ b/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr @@ -5,6 +5,12 @@ LL | x.equals(&x); | ------ ^^ the trait `Eq` is not implemented for `Bar` | | | required by a bound introduced by this call + | +note: required by a bound in `Foo::::equals` + --> $DIR/where-clauses-method-unsatisfied.rs:11:52 + | +LL | fn equals(&self, u: &Foo) -> bool where T : Eq { + | ^^ required by this bound in `Foo::::equals` error: aborting due to previous error